aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/access/amazon/amazon_logic.cpp4
-rw-r--r--engines/access/amazon/amazon_room.h2
-rw-r--r--engines/access/animation.h2
-rw-r--r--engines/access/asurface.cpp2
-rw-r--r--engines/access/debugger.cpp2
-rw-r--r--engines/access/decompress.cpp2
-rw-r--r--engines/access/events.cpp8
-rw-r--r--engines/access/files.h2
-rw-r--r--engines/access/inventory.h2
-rw-r--r--engines/access/player.cpp2
-rw-r--r--engines/access/screen.cpp4
-rw-r--r--engines/access/scripts.cpp6
-rw-r--r--engines/access/scripts.h6
-rw-r--r--engines/access/sound.cpp2
-rw-r--r--engines/access/video.cpp2
-rw-r--r--engines/adl/configure.engine2
-rw-r--r--engines/adl/detection.cpp8
-rw-r--r--engines/adl/disk.h2
-rw-r--r--engines/agi/agi.h2
-rw-r--r--engines/agi/cycle.cpp22
-rw-r--r--engines/agi/global.cpp2
-rw-r--r--engines/agi/mouse_cursor.h2
-rw-r--r--engines/agi/systemui.cpp2
-rw-r--r--engines/agi/systemui.h2
-rw-r--r--engines/agos/midi.cpp2
-rw-r--r--engines/agos/saveload.cpp2
-rw-r--r--engines/director/frame.cpp11
-rw-r--r--engines/director/lingo/lingo-gr.cpp2
-rw-r--r--engines/director/lingo/lingo-lex.cpp86
-rw-r--r--engines/dm/detection.cpp24
-rw-r--r--engines/dm/dm.cpp5
-rw-r--r--engines/dm/dm.h4
-rw-r--r--engines/dm/dungeonman.cpp9
-rw-r--r--engines/dm/gfx.cpp4
-rw-r--r--engines/dm/group.cpp3
-rw-r--r--engines/dm/loadsave.cpp2
-rw-r--r--engines/dm/movesens.cpp2
-rw-r--r--engines/drascula/actors.cpp2
-rw-r--r--engines/drascula/graphics.cpp12
-rw-r--r--engines/drascula/saveload.cpp10
-rw-r--r--engines/drascula/talk.cpp6
-rw-r--r--engines/fullpipe/constants.h12
-rw-r--r--engines/fullpipe/detection.cpp2
-rw-r--r--engines/fullpipe/fullpipe.cpp10
-rw-r--r--engines/fullpipe/fullpipe.h3
-rw-r--r--engines/fullpipe/interaction.cpp4
-rw-r--r--engines/fullpipe/interaction.h2
-rw-r--r--engines/fullpipe/messagehandlers.cpp9
-rw-r--r--engines/fullpipe/modal.cpp2
-rw-r--r--engines/fullpipe/motion.cpp36
-rw-r--r--engines/fullpipe/motion.h2
-rw-r--r--engines/fullpipe/objects.h1
-rw-r--r--engines/fullpipe/scenes.cpp4
-rw-r--r--engines/fullpipe/scenes.h2
-rw-r--r--engines/fullpipe/scenes/scene06.cpp10
-rw-r--r--engines/fullpipe/scenes/scene10.cpp2
-rw-r--r--engines/fullpipe/scenes/scene11.cpp196
-rw-r--r--engines/fullpipe/scenes/scene13.cpp8
-rw-r--r--engines/fullpipe/scenes/scene14.cpp31
-rw-r--r--engines/fullpipe/scenes/scene16.cpp6
-rw-r--r--engines/fullpipe/scenes/scene25.cpp54
-rw-r--r--engines/fullpipe/scenes/scene26.cpp10
-rw-r--r--engines/fullpipe/scenes/scene27.cpp3
-rw-r--r--engines/fullpipe/scenes/scene28.cpp4
-rw-r--r--engines/fullpipe/scenes/scene37.cpp32
-rw-r--r--engines/fullpipe/statesaver.cpp7
-rw-r--r--engines/gnap/configure.engine2
-rw-r--r--engines/gnap/detection.cpp8
-rw-r--r--engines/gnap/fontdata.h2
-rw-r--r--engines/gnap/gamesys.h2
-rw-r--r--engines/groovie/script.cpp2
-rw-r--r--engines/lab/engine.cpp2
-rw-r--r--engines/lab/eventman.cpp2
-rw-r--r--engines/lab/processroom.cpp2
-rw-r--r--engines/lab/resource.cpp2
-rw-r--r--engines/lab/special.cpp2
-rw-r--r--engines/macventure/gui.cpp3
-rw-r--r--engines/made/screenfx.cpp2
-rw-r--r--engines/mads/camera.cpp2
-rw-r--r--engines/mads/conversations.cpp10
-rw-r--r--engines/mads/conversations.h8
-rw-r--r--engines/mads/nebular/menu_nebular.h2
-rw-r--r--engines/mads/nebular/sound_nebular.cpp2
-rw-r--r--engines/mads/player.cpp4
-rw-r--r--engines/mads/screen.h2
-rw-r--r--engines/mads/user_interface.cpp2
-rw-r--r--engines/mohawk/POTFILES1
-rw-r--r--engines/mohawk/detection_tables.h34
-rw-r--r--engines/mohawk/dialogs.h4
-rw-r--r--engines/mohawk/livingbooks.cpp2
-rw-r--r--engines/mohawk/mohawk.cpp3
-rw-r--r--engines/mohawk/myst_stacks/myst.cpp2
-rw-r--r--engines/mohawk/riven_sound.h2
-rw-r--r--engines/mohawk/video.h2
-rw-r--r--engines/sci/console.cpp166
-rw-r--r--engines/sci/console.h9
-rw-r--r--engines/sci/detection.cpp8
-rw-r--r--engines/sci/detection_tables.h50
-rw-r--r--engines/sci/engine/file.cpp84
-rw-r--r--engines/sci/engine/file.h24
-rw-r--r--engines/sci/engine/gc.cpp2
-rw-r--r--engines/sci/engine/kernel.cpp1
-rw-r--r--engines/sci/engine/kernel.h57
-rw-r--r--engines/sci/engine/kernel_tables.h188
-rw-r--r--engines/sci/engine/kevent.cpp28
-rw-r--r--engines/sci/engine/kfile.cpp633
-rw-r--r--engines/sci/engine/kgraphics.cpp6
-rw-r--r--engines/sci/engine/kgraphics32.cpp134
-rw-r--r--engines/sci/engine/klists.cpp248
-rw-r--r--engines/sci/engine/kmisc.cpp8
-rw-r--r--engines/sci/engine/kpathing.cpp4
-rw-r--r--engines/sci/engine/kscripts.cpp4
-rw-r--r--engines/sci/engine/kstring.cpp356
-rw-r--r--engines/sci/engine/kvideo.cpp23
-rw-r--r--engines/sci/engine/message.cpp17
-rw-r--r--engines/sci/engine/savegame.cpp145
-rw-r--r--engines/sci/engine/savegame.h10
-rw-r--r--engines/sci/engine/script_patches.cpp228
-rw-r--r--engines/sci/engine/seg_manager.cpp65
-rw-r--r--engines/sci/engine/seg_manager.h13
-rw-r--r--engines/sci/engine/segment.cpp75
-rw-r--r--engines/sci/engine/segment.h524
-rw-r--r--engines/sci/engine/selector.cpp25
-rw-r--r--engines/sci/engine/state.cpp54
-rw-r--r--engines/sci/engine/state.h24
-rw-r--r--engines/sci/engine/vm.cpp46
-rw-r--r--engines/sci/engine/vm.h16
-rw-r--r--engines/sci/engine/vm_types.cpp7
-rw-r--r--engines/sci/engine/workarounds.cpp88
-rw-r--r--engines/sci/engine/workarounds.h15
-rw-r--r--engines/sci/event.cpp80
-rw-r--r--engines/sci/event.h16
-rw-r--r--engines/sci/graphics/animate.cpp4
-rw-r--r--engines/sci/graphics/celobj32.cpp146
-rw-r--r--engines/sci/graphics/celobj32.h19
-rw-r--r--engines/sci/graphics/controls32.cpp12
-rw-r--r--engines/sci/graphics/cursor32.cpp3
-rw-r--r--engines/sci/graphics/cursor32.h2
-rw-r--r--engines/sci/graphics/font.h2
-rw-r--r--engines/sci/graphics/frameout.cpp41
-rw-r--r--engines/sci/graphics/frameout.h6
-rw-r--r--engines/sci/graphics/paint16.cpp6
-rw-r--r--engines/sci/graphics/paint32.cpp52
-rw-r--r--engines/sci/graphics/palette32.cpp521
-rw-r--r--engines/sci/graphics/palette32.h451
-rw-r--r--engines/sci/graphics/picture.cpp6
-rw-r--r--engines/sci/graphics/plane32.cpp10
-rw-r--r--engines/sci/graphics/screen.cpp14
-rw-r--r--engines/sci/graphics/screen.h2
-rw-r--r--engines/sci/graphics/screen_item32.cpp109
-rw-r--r--engines/sci/graphics/screen_item32.h10
-rw-r--r--engines/sci/graphics/text16.cpp6
-rw-r--r--engines/sci/graphics/text16.h2
-rw-r--r--engines/sci/graphics/text32.cpp49
-rw-r--r--engines/sci/graphics/text32.h12
-rw-r--r--engines/sci/graphics/transitions32.cpp167
-rw-r--r--engines/sci/graphics/video32.cpp74
-rw-r--r--engines/sci/resource.cpp4
-rw-r--r--engines/sci/resource_audio.cpp5
-rw-r--r--engines/sci/sci.cpp164
-rw-r--r--engines/sci/sci.h3
-rw-r--r--engines/sci/sound/audio32.cpp21
-rw-r--r--engines/sci/video/robot_decoder.cpp26
-rw-r--r--engines/scumm/actor.cpp36
-rw-r--r--engines/scumm/detection.cpp2
-rw-r--r--engines/scumm/detection_tables.h8
-rw-r--r--engines/scumm/file.cpp2
-rw-r--r--engines/scumm/he/logic/moonbase_logic.cpp4
-rw-r--r--engines/scumm/he/moonbase/net_main.h2
-rw-r--r--engines/scumm/he/script_v72he.cpp2
-rw-r--r--engines/scumm/insane/insane.cpp12
-rw-r--r--engines/scumm/resource_v2.cpp2
-rw-r--r--engines/scumm/script_v0.cpp2
-rw-r--r--engines/scumm/verbs.cpp2
-rw-r--r--engines/sherlock/animation.h4
-rw-r--r--engines/sherlock/events.cpp4
-rw-r--r--engines/sherlock/fonts.cpp2
-rw-r--r--engines/sherlock/fonts.h2
-rw-r--r--engines/sherlock/music.cpp2
-rw-r--r--engines/sherlock/music.h6
-rw-r--r--engines/sherlock/objects.cpp12
-rw-r--r--engines/sherlock/objects.h4
-rw-r--r--engines/sherlock/people.cpp2
-rw-r--r--engines/sherlock/people.h8
-rw-r--r--engines/sherlock/resources.cpp2
-rw-r--r--engines/sherlock/resources.h4
-rw-r--r--engines/sherlock/saveload.h2
-rw-r--r--engines/sherlock/scalpel/3do/movie_decoder.cpp2
-rw-r--r--engines/sherlock/scalpel/3do/scalpel_3do_screen.h2
-rw-r--r--engines/sherlock/scalpel/scalpel.cpp2
-rw-r--r--engines/sherlock/scalpel/scalpel_darts.cpp2
-rw-r--r--engines/sherlock/scalpel/scalpel_darts.h4
-rw-r--r--engines/sherlock/scalpel/scalpel_people.h8
-rw-r--r--engines/sherlock/scalpel/scalpel_saveload.cpp6
-rw-r--r--engines/sherlock/scalpel/scalpel_scene.cpp2
-rw-r--r--engines/sherlock/scalpel/scalpel_talk.cpp12
-rw-r--r--engines/sherlock/scalpel/scalpel_user_interface.h20
-rw-r--r--engines/sherlock/scalpel/tsage/logo.cpp10
-rw-r--r--engines/sherlock/scalpel/tsage/logo.h2
-rw-r--r--engines/sherlock/scene.cpp14
-rw-r--r--engines/sherlock/screen.h4
-rw-r--r--engines/sherlock/sound.cpp2
-rw-r--r--engines/sherlock/sound.h8
-rw-r--r--engines/sherlock/talk.cpp4
-rw-r--r--engines/sherlock/talk.h8
-rw-r--r--engines/sherlock/tattoo/tattoo.cpp4
-rw-r--r--engines/sherlock/tattoo/tattoo_darts.cpp30
-rw-r--r--engines/sherlock/tattoo/tattoo_darts.h2
-rw-r--r--engines/sherlock/tattoo/tattoo_inventory.h2
-rw-r--r--engines/sherlock/tattoo/tattoo_map.cpp8
-rw-r--r--engines/sherlock/tattoo/tattoo_map.h2
-rw-r--r--engines/sherlock/tattoo/tattoo_people.cpp28
-rw-r--r--engines/sherlock/tattoo/tattoo_people.h12
-rw-r--r--engines/sherlock/tattoo/tattoo_resources.cpp2
-rw-r--r--engines/sherlock/tattoo/tattoo_scene.cpp16
-rw-r--r--engines/sherlock/tattoo/tattoo_talk.cpp38
-rw-r--r--engines/sherlock/tattoo/tattoo_talk.h2
-rw-r--r--engines/sherlock/tattoo/tattoo_user_interface.cpp36
-rw-r--r--engines/sherlock/tattoo/tattoo_user_interface.h4
-rw-r--r--engines/sherlock/tattoo/widget_base.cpp10
-rw-r--r--engines/sherlock/tattoo/widget_credits.cpp4
-rw-r--r--engines/sherlock/tattoo/widget_files.cpp20
-rw-r--r--engines/sherlock/tattoo/widget_files.h2
-rw-r--r--engines/sherlock/tattoo/widget_foolscap.cpp2
-rw-r--r--engines/sherlock/tattoo/widget_inventory.cpp40
-rw-r--r--engines/sherlock/tattoo/widget_lab.cpp4
-rw-r--r--engines/sherlock/tattoo/widget_options.cpp24
-rw-r--r--engines/sherlock/tattoo/widget_password.cpp6
-rw-r--r--engines/sherlock/tattoo/widget_quit.cpp2
-rw-r--r--engines/sherlock/tattoo/widget_talk.cpp8
-rw-r--r--engines/sherlock/tattoo/widget_text.cpp8
-rw-r--r--engines/sherlock/tattoo/widget_tooltip.cpp8
-rw-r--r--engines/sherlock/tattoo/widget_verbs.cpp10
-rw-r--r--engines/sherlock/user_interface.h2
-rw-r--r--engines/sky/compact.cpp4
-rw-r--r--engines/sky/detection.cpp2
-rw-r--r--engines/sword25/gfx/animationresource.cpp2
-rw-r--r--engines/sword25/gfx/fontresource.cpp2
-rw-r--r--engines/sword25/package/packagemanager.cpp2
-rw-r--r--engines/sword25/package/packagemanager.h2
-rw-r--r--engines/testbed/graphics.cpp2
-rw-r--r--engines/titanic/carry/glass.cpp2
-rw-r--r--engines/titanic/carry/note.cpp2
-rw-r--r--engines/titanic/carry/phonograph_cylinder.cpp4
-rw-r--r--engines/titanic/core/file_item.h2
-rw-r--r--engines/titanic/core/game_object.cpp27
-rw-r--r--engines/titanic/core/game_object.h20
-rw-r--r--engines/titanic/core/link_item.cpp4
-rw-r--r--engines/titanic/core/list.h4
-rw-r--r--engines/titanic/core/message_target.cpp2
-rw-r--r--engines/titanic/core/project_item.cpp4
-rw-r--r--engines/titanic/core/project_item.h6
-rw-r--r--engines/titanic/core/resource_key.cpp2
-rw-r--r--engines/titanic/core/room_item.cpp4
-rw-r--r--engines/titanic/core/saveable_object.cpp4
-rw-r--r--engines/titanic/core/saveable_object.h8
-rw-r--r--engines/titanic/core/tree_item.cpp2
-rw-r--r--engines/titanic/core/turn_on_play_sound.cpp2
-rw-r--r--engines/titanic/core/view_item.cpp8
-rw-r--r--engines/titanic/debugger.cpp40
-rw-r--r--engines/titanic/debugger.h15
-rw-r--r--engines/titanic/detection.cpp2
-rw-r--r--engines/titanic/detection_tables.h2
-rw-r--r--engines/titanic/events.h4
-rw-r--r--engines/titanic/game/bar_menu.cpp4
-rw-r--r--engines/titanic/game/cdrom_computer.cpp4
-rw-r--r--engines/titanic/game/cdrom_tray.cpp2
-rw-r--r--engines/titanic/game/chev_code.cpp4
-rw-r--r--engines/titanic/game/chev_panel.cpp2
-rw-r--r--engines/titanic/game/chicken_dispensor.cpp2
-rw-r--r--engines/titanic/game/code_wheel.cpp4
-rw-r--r--engines/titanic/game/computer_screen.cpp4
-rw-r--r--engines/titanic/game/credits.cpp4
-rw-r--r--engines/titanic/game/fan_control.cpp2
-rw-r--r--engines/titanic/game/fan_noises.cpp2
-rw-r--r--engines/titanic/game/gondolier/gondolier_mixer.cpp2
-rw-r--r--engines/titanic/game/gondolier/gondolier_slider.cpp2
-rw-r--r--engines/titanic/game/head_slot.cpp4
-rw-r--r--engines/titanic/game/idle_summoner.cpp2
-rw-r--r--engines/titanic/game/light_switch.cpp2
-rw-r--r--engines/titanic/game/missiveomat.cpp6
-rw-r--r--engines/titanic/game/movie_tester.h8
-rw-r--r--engines/titanic/game/music_console_button.cpp4
-rw-r--r--engines/titanic/game/nav_helmet.cpp2
-rw-r--r--engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp4
-rw-r--r--engines/titanic/game/parrot/parrot_nut_eater.cpp2
-rw-r--r--engines/titanic/game/place_holder_item.cpp4
-rw-r--r--engines/titanic/game/placeholder/bar_shelf_vis_centre.h2
-rw-r--r--engines/titanic/game/restaurant_cylinder_holder.cpp2
-rw-r--r--engines/titanic/game/sauce_dispensor.cpp4
-rw-r--r--engines/titanic/game/service_elevator_window.cpp4
-rw-r--r--engines/titanic/game/sgt/chest_of_drawers.cpp2
-rw-r--r--engines/titanic/game/television.cpp4
-rw-r--r--engines/titanic/game/transport/lift_indicator.cpp2
-rw-r--r--engines/titanic/game/transport/service_elevator.cpp4
-rw-r--r--engines/titanic/game/variable_list.cpp4
-rw-r--r--engines/titanic/game_location.cpp2
-rw-r--r--engines/titanic/game_manager.cpp8
-rw-r--r--engines/titanic/game_manager.h2
-rw-r--r--engines/titanic/game_state.cpp2
-rw-r--r--engines/titanic/game_state.h2
-rw-r--r--engines/titanic/game_view.cpp2
-rw-r--r--engines/titanic/game_view.h2
-rw-r--r--engines/titanic/gfx/send_to_succ.h2
-rw-r--r--engines/titanic/input_handler.cpp2
-rw-r--r--engines/titanic/main_game_window.cpp4
-rw-r--r--engines/titanic/messages/messages.cpp2
-rw-r--r--engines/titanic/messages/messages.h2
-rw-r--r--engines/titanic/messages/mouse_messages.cpp2
-rw-r--r--engines/titanic/messages/mouse_messages.h2
-rw-r--r--engines/titanic/module.mk1
-rw-r--r--engines/titanic/moves/enter_exit_sec_class_mini_lift.cpp2
-rw-r--r--engines/titanic/moves/enter_exit_sec_class_mini_lift.h2
-rw-r--r--engines/titanic/moves/enter_exit_view.cpp2
-rw-r--r--engines/titanic/moves/exit_arboretum.cpp2
-rw-r--r--engines/titanic/moves/exit_pellerator.cpp2
-rw-r--r--engines/titanic/npcs/barbot.cpp10
-rw-r--r--engines/titanic/npcs/bellbot.cpp2
-rw-r--r--engines/titanic/npcs/callbot.cpp2
-rw-r--r--engines/titanic/npcs/deskbot.cpp4
-rw-r--r--engines/titanic/npcs/maitre_d.cpp2
-rw-r--r--engines/titanic/npcs/parrot.cpp6
-rw-r--r--engines/titanic/npcs/parrot_succubus.cpp4
-rw-r--r--engines/titanic/npcs/succubus.cpp10
-rw-r--r--engines/titanic/npcs/titania.cpp6
-rw-r--r--engines/titanic/pet_control/pet_control.cpp14
-rw-r--r--engines/titanic/pet_control/pet_control.h6
-rw-r--r--engines/titanic/pet_control/pet_conversations.cpp4
-rw-r--r--engines/titanic/pet_control/pet_conversations.h10
-rw-r--r--engines/titanic/pet_control/pet_frame.cpp4
-rw-r--r--engines/titanic/pet_control/pet_frame.h4
-rw-r--r--engines/titanic/pet_control/pet_gfx_element.cpp2
-rw-r--r--engines/titanic/pet_control/pet_glyphs.h10
-rw-r--r--engines/titanic/pet_control/pet_inventory.cpp4
-rw-r--r--engines/titanic/pet_control/pet_inventory.h8
-rw-r--r--engines/titanic/pet_control/pet_inventory_glyphs.h8
-rw-r--r--engines/titanic/pet_control/pet_load.cpp2
-rw-r--r--engines/titanic/pet_control/pet_load.h2
-rw-r--r--engines/titanic/pet_control/pet_load_save.cpp4
-rw-r--r--engines/titanic/pet_control/pet_quit.cpp4
-rw-r--r--engines/titanic/pet_control/pet_quit.h2
-rw-r--r--engines/titanic/pet_control/pet_real_life.h10
-rw-r--r--engines/titanic/pet_control/pet_remote.cpp4
-rw-r--r--engines/titanic/pet_control/pet_remote_glyphs.cpp4
-rw-r--r--engines/titanic/pet_control/pet_remote_glyphs.h16
-rw-r--r--engines/titanic/pet_control/pet_rooms.h6
-rw-r--r--engines/titanic/pet_control/pet_rooms_glyphs.h6
-rw-r--r--engines/titanic/pet_control/pet_save.cpp2
-rw-r--r--engines/titanic/pet_control/pet_save.h4
-rw-r--r--engines/titanic/pet_control/pet_section.h22
-rw-r--r--engines/titanic/pet_control/pet_slider.h10
-rw-r--r--engines/titanic/pet_control/pet_sound.cpp4
-rw-r--r--engines/titanic/pet_control/pet_starfield.cpp4
-rw-r--r--engines/titanic/pet_control/pet_starfield.h4
-rw-r--r--engines/titanic/pet_control/pet_text.cpp12
-rw-r--r--engines/titanic/pet_control/pet_translation.h4
-rw-r--r--engines/titanic/sound/auto_music_player_base.cpp2
-rw-r--r--engines/titanic/sound/enter_view_toggles_other_music.cpp2
-rw-r--r--engines/titanic/sound/proximity.cpp4
-rw-r--r--engines/titanic/sound/qmixer.cpp6
-rw-r--r--engines/titanic/sound/qmixer.h6
-rw-r--r--engines/titanic/sound/room_trigger_auto_music_player.h2
-rw-r--r--engines/titanic/sound/season_noises.cpp2
-rw-r--r--engines/titanic/sound/sound.cpp2
-rw-r--r--engines/titanic/sound/sound_manager.cpp4
-rw-r--r--engines/titanic/sound/sound_manager.h4
-rw-r--r--engines/titanic/sound/view_toggles_other_music.cpp2
-rw-r--r--engines/titanic/star_control/star_control.cpp4
-rw-r--r--engines/titanic/star_control/star_control_sub12.cpp4
-rw-r--r--engines/titanic/star_control/star_control_sub13.cpp4
-rw-r--r--engines/titanic/star_control/star_control_sub20.cpp2
-rw-r--r--engines/titanic/star_control/star_control_sub25.h2
-rw-r--r--engines/titanic/star_control/star_field.cpp4
-rw-r--r--engines/titanic/star_control/star_field.h4
-rw-r--r--engines/titanic/star_control/star_view.cpp4
-rw-r--r--engines/titanic/star_control/surface_fader_base.cpp2
-rw-r--r--engines/titanic/support/avi_surface.cpp196
-rw-r--r--engines/titanic/support/avi_surface.h25
-rw-r--r--engines/titanic/support/credit_text.cpp4
-rw-r--r--engines/titanic/support/direct_draw.h2
-rw-r--r--engines/titanic/support/files_manager.cpp2
-rw-r--r--engines/titanic/support/files_manager.h2
-rw-r--r--engines/titanic/support/font.cpp9
-rw-r--r--engines/titanic/support/font.h4
-rw-r--r--engines/titanic/support/image_decoders.cpp4
-rw-r--r--engines/titanic/support/mouse_cursor.cpp54
-rw-r--r--engines/titanic/support/mouse_cursor.h8
-rw-r--r--engines/titanic/support/movie.cpp4
-rw-r--r--engines/titanic/support/movie.h30
-rw-r--r--engines/titanic/support/movie_clip.h2
-rw-r--r--engines/titanic/support/movie_range_info.cpp2
-rw-r--r--engines/titanic/support/screen_manager.cpp4
-rw-r--r--engines/titanic/support/screen_manager.h22
-rw-r--r--engines/titanic/support/simple_file.cpp12
-rw-r--r--engines/titanic/support/string.cpp4
-rw-r--r--engines/titanic/support/text_cursor.cpp6
-rw-r--r--engines/titanic/support/time_event_info.cpp4
-rw-r--r--engines/titanic/support/transparency_surface.cpp73
-rw-r--r--engines/titanic/support/transparency_surface.h84
-rw-r--r--engines/titanic/support/video_surface.cpp240
-rw-r--r--engines/titanic/support/video_surface.h89
-rw-r--r--engines/titanic/titanic.cpp2
-rw-r--r--engines/titanic/true_talk/barbot_script.cpp18
-rw-r--r--engines/titanic/true_talk/barbot_script.h2
-rw-r--r--engines/titanic/true_talk/bellbot_script.cpp18
-rw-r--r--engines/titanic/true_talk/bellbot_script.h2
-rw-r--r--engines/titanic/true_talk/deskbot_script.cpp28
-rw-r--r--engines/titanic/true_talk/dialogue_file.cpp2
-rw-r--r--engines/titanic/true_talk/doorbot_script.cpp10
-rw-r--r--engines/titanic/true_talk/maitred_script.cpp2
-rw-r--r--engines/titanic/true_talk/parrot_script.h2
-rw-r--r--engines/titanic/true_talk/script_handler.cpp2
-rw-r--r--engines/titanic/true_talk/script_handler.h2
-rw-r--r--engines/titanic/true_talk/script_support.cpp2
-rw-r--r--engines/titanic/true_talk/script_support.h2
-rw-r--r--engines/titanic/true_talk/succubus_script.h2
-rw-r--r--engines/titanic/true_talk/true_talk_manager.cpp12
-rw-r--r--engines/titanic/true_talk/tt_action.h2
-rw-r--r--engines/titanic/true_talk/tt_concept.cpp10
-rw-r--r--engines/titanic/true_talk/tt_concept.h4
-rw-r--r--engines/titanic/true_talk/tt_node.cpp2
-rw-r--r--engines/titanic/true_talk/tt_npc_script.h10
-rw-r--r--engines/titanic/true_talk/tt_parser.cpp38
-rw-r--r--engines/titanic/true_talk/tt_parser.h4
-rw-r--r--engines/titanic/true_talk/tt_picture.h4
-rw-r--r--engines/titanic/true_talk/tt_pronoun.h4
-rw-r--r--engines/titanic/true_talk/tt_quotes_tree.cpp16
-rw-r--r--engines/titanic/true_talk/tt_response.cpp4
-rw-r--r--engines/titanic/true_talk/tt_room_script.cpp2
-rw-r--r--engines/titanic/true_talk/tt_room_script.h4
-rw-r--r--engines/titanic/true_talk/tt_script_base.h4
-rw-r--r--engines/titanic/true_talk/tt_scripts.cpp2
-rw-r--r--engines/titanic/true_talk/tt_string.h4
-rw-r--r--engines/titanic/true_talk/tt_synonym.cpp4
-rw-r--r--engines/titanic/true_talk/tt_title_script.cpp2
-rw-r--r--engines/titanic/true_talk/tt_word.h8
-rw-r--r--engines/toon/anim.cpp2
-rw-r--r--engines/tsage/graphics.cpp2
-rw-r--r--engines/tsage/tsage.cpp2
-rw-r--r--engines/voyeur/configure.engine1
-rw-r--r--engines/voyeur/screen.cpp2
-rw-r--r--engines/wage/dialog.cpp3
-rw-r--r--engines/wage/entities.cpp17
-rw-r--r--engines/wage/entities.h6
-rw-r--r--engines/wage/gui-console.cpp3
-rw-r--r--engines/wage/world.cpp6
-rw-r--r--engines/wintermute/base/base_game.cpp8
-rw-r--r--engines/wintermute/detection_tables.h180
-rw-r--r--engines/wintermute/ui/ui_edit.cpp2
-rw-r--r--engines/xeen/character.cpp26
-rw-r--r--engines/xeen/combat.cpp30
-rw-r--r--engines/xeen/dialogs.cpp8
-rw-r--r--engines/xeen/dialogs_automap.cpp14
-rw-r--r--engines/xeen/dialogs_char_info.cpp4
-rw-r--r--engines/xeen/dialogs_error.h4
-rw-r--r--engines/xeen/dialogs_info.cpp2
-rw-r--r--engines/xeen/dialogs_input.cpp6
-rw-r--r--engines/xeen/dialogs_input.h6
-rw-r--r--engines/xeen/dialogs_items.cpp38
-rw-r--r--engines/xeen/dialogs_items.h6
-rw-r--r--engines/xeen/dialogs_party.cpp22
-rw-r--r--engines/xeen/dialogs_party.h2
-rw-r--r--engines/xeen/dialogs_query.cpp2
-rw-r--r--engines/xeen/dialogs_spells.cpp12
-rw-r--r--engines/xeen/dialogs_spells.h2
-rw-r--r--engines/xeen/files.cpp6
-rw-r--r--engines/xeen/files.h2
-rw-r--r--engines/xeen/font.cpp10
-rw-r--r--engines/xeen/interface.cpp36
-rw-r--r--engines/xeen/interface_map.cpp30
-rw-r--r--engines/xeen/interface_map.h10
-rw-r--r--engines/xeen/map.cpp34
-rw-r--r--engines/xeen/map.h4
-rw-r--r--engines/xeen/music.h2
-rw-r--r--engines/xeen/party.cpp14
-rw-r--r--engines/xeen/party.h2
-rw-r--r--engines/xeen/resources.cpp110
-rw-r--r--engines/xeen/saves.cpp4
-rw-r--r--engines/xeen/screen.cpp8
-rw-r--r--engines/xeen/screen.h2
-rw-r--r--engines/xeen/scripts.cpp56
-rw-r--r--engines/xeen/scripts.h4
-rw-r--r--engines/xeen/spells.cpp24
-rw-r--r--engines/xeen/sprites.cpp22
-rw-r--r--engines/xeen/sprites.h4
-rw-r--r--engines/xeen/town.cpp16
-rw-r--r--engines/xeen/town.h2
-rw-r--r--engines/xeen/worldofxeen/clouds_cutscenes.cpp8
-rw-r--r--engines/xeen/worldofxeen/darkside_cutscenes.cpp16
-rw-r--r--engines/xeen/worldofxeen/worldofxeen.cpp2
-rw-r--r--engines/xeen/worldofxeen/worldofxeen.h4
-rw-r--r--engines/xeen/worldofxeen/worldofxeen_menu.cpp4
-rw-r--r--engines/xeen/worldofxeen/worldofxeen_menu.h2
-rw-r--r--engines/zvision/video/zork_avi_decoder.cpp2
494 files changed, 5562 insertions, 3916 deletions
diff --git a/engines/access/amazon/amazon_logic.cpp b/engines/access/amazon/amazon_logic.cpp
index 08006fe1b7..5a0f79721e 100644
--- a/engines/access/amazon/amazon_logic.cpp
+++ b/engines/access/amazon/amazon_logic.cpp
@@ -1333,7 +1333,7 @@ void Cast::doCast(int param1) {
for (int idx = 0; idx < 5 && !_vm->shouldQuit() &&
!_vm->_events->isKeyMousePressed(); ++idx)
_vm->_events->pollEventsAndWait();
-
+
if (_vm->_events->isKeyMousePressed())
break;
@@ -1682,7 +1682,7 @@ void River::updateObstacles() {
void River::riverSetPhysX() {
int xAmt = (_vm->_scrollCol * 16) + _vm->_scrollX;
-
+
for (RiverStruct *cur = _topList; cur <= _botList; ++cur) {
cur->_xp = xAmt - (_screenVertX - cur->_riverX);
}
diff --git a/engines/access/amazon/amazon_room.h b/engines/access/amazon/amazon_room.h
index 6396f80199..003178ea15 100644
--- a/engines/access/amazon/amazon_room.h
+++ b/engines/access/amazon/amazon_room.h
@@ -61,7 +61,7 @@ public:
virtual ~AmazonRoom();
virtual void init4Quads();
-
+
virtual void roomMenu();
};
diff --git a/engines/access/animation.h b/engines/access/animation.h
index 72621c4d11..49417ec5fc 100644
--- a/engines/access/animation.h
+++ b/engines/access/animation.h
@@ -49,7 +49,7 @@ public:
~AnimationManager();
void freeAnimationData();
void loadAnimations(Resource *res);
-
+
Animation *findAnimation(int animId);
Animation *setAnimation(int animId);
diff --git a/engines/access/asurface.cpp b/engines/access/asurface.cpp
index 37f4c7082e..577746f7b4 100644
--- a/engines/access/asurface.cpp
+++ b/engines/access/asurface.cpp
@@ -173,7 +173,7 @@ void BaseSurface::copyTo(BaseSurface *dest) {
if (dest->empty())
dest->create(this->w, this->h);
- dest->blitFrom(*this);
+ dest->blitFrom(*this);
}
void BaseSurface::saveBlock(const Common::Rect &bounds) {
diff --git a/engines/access/debugger.cpp b/engines/access/debugger.cpp
index 48c7290249..308733ece2 100644
--- a/engines/access/debugger.cpp
+++ b/engines/access/debugger.cpp
@@ -94,7 +94,7 @@ bool Debugger::Cmd_LoadScene(int argc, const char **argv) {
debugPrintf("Unused Room Number\n");
return true;
}
-
+
_vm->_player->_roomNumber = newRoom;
_vm->_room->_function = FN_CLEAR1;
diff --git a/engines/access/decompress.cpp b/engines/access/decompress.cpp
index 3de376c193..6d5b613fe2 100644
--- a/engines/access/decompress.cpp
+++ b/engines/access/decompress.cpp
@@ -31,7 +31,7 @@ namespace Access {
void LzwDecompressor::decompress(byte *source, byte *dest) {
_source = source;
-
+
byte litByte = 0;
uint16 oldCode = 0;
uint16 copyLength, maxCodeValue, code, nextCode, lastCode;
diff --git a/engines/access/events.cpp b/engines/access/events.cpp
index 21ff0d0928..3d3b97e028 100644
--- a/engines/access/events.cpp
+++ b/engines/access/events.cpp
@@ -65,9 +65,9 @@ void EventsManager::setNormalCursor(CursorType cursorId) {
void EventsManager::setCursor(CursorType cursorId) {
if (cursorId == _cursorId)
- return;
+ return;
_cursorId = cursorId;
-
+
if (cursorId == CURSOR_INVENTORY) {
// Set the cursor
CursorMan.replaceCursor(_invCursor.getPixels(), _invCursor.w, _invCursor.h,
@@ -209,9 +209,9 @@ void EventsManager::keyControl(Common::KeyCode keycode, bool isKeyDown) {
}
return;
}
-
+
_keyCode = keycode;
-
+
switch (keycode) {
case Common::KEYCODE_UP:
case Common::KEYCODE_KP8:
diff --git a/engines/access/files.h b/engines/access/files.h
index 61fccc2431..151890f338 100644
--- a/engines/access/files.h
+++ b/engines/access/files.h
@@ -77,7 +77,7 @@ private:
* Handles setting up the resource with a stream for the located resource
*/
void handleFile(Resource *res);
-
+
/**
* Handles loading a screen surface and palette with decoded resource
*/
diff --git a/engines/access/inventory.h b/engines/access/inventory.h
index 1d88bf4555..e91ca2484e 100644
--- a/engines/access/inventory.h
+++ b/engines/access/inventory.h
@@ -119,7 +119,7 @@ public:
int _startTravelItem;
public:
InventoryManager(AccessEngine *vm);
-
+
int &operator[](int idx);
int useItem();
diff --git a/engines/access/player.cpp b/engines/access/player.cpp
index 0162491aee..ccef0d6740 100644
--- a/engines/access/player.cpp
+++ b/engines/access/player.cpp
@@ -142,7 +142,7 @@ void Player::loadTexPalette() {
int size = texPal->_size;
assert(size == 768);
_manPal1 = new byte[size];
- memcpy(_manPal1, texPal->data(), size);
+ memcpy(_manPal1, texPal->data(), size);
}
void Player::loadSprites(const Common::String &name) {
diff --git a/engines/access/screen.cpp b/engines/access/screen.cpp
index 2d29ad0718..7da9dfc429 100644
--- a/engines/access/screen.cpp
+++ b/engines/access/screen.cpp
@@ -300,10 +300,10 @@ void Screen::cyclePaletteBackwards() {
_vm->_timers[6]._flag++;
byte *pStart = &_rawPalette[_cycleStart * 3];
byte *pEnd = &_rawPalette[_endCycle * 3];
-
+
for (int idx = _startCycle; idx < _endCycle; ++idx) {
g_system->getPaletteManager()->setPalette(pStart, idx, 1);
-
+
pStart += 3;
if (pStart == pEnd)
pStart = &_rawPalette[_cycleStart * 3];
diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index 38313640f1..2cebc3e3c6 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -840,7 +840,7 @@ void Scripts::cmdTexChoice() {
_vm->_fonts._charSet._lo = 1;
_vm->_fonts._charSet._hi = 8;
_vm->_fonts._charFor._hi = 255;
-
+
if (_vm->getGameID() == GType_MartianMemorandum) {
_vm->_fonts._charFor._lo = 247;
_vm->_screen->_maxChars = 23;
@@ -912,7 +912,7 @@ void Scripts::cmdTexChoice() {
_vm->_events->debounceLeft();
int x = _vm->_events->_mousePos.x;
for (int i = 0; i < BTN_COUNT; i++) {
- if (((_vm->getGameID() == GType_MartianMemorandum) && (x >= BTN_RANGES_v1[i][0]) && (x < BTN_RANGES_v1[i][1]))
+ if (((_vm->getGameID() == GType_MartianMemorandum) && (x >= BTN_RANGES_v1[i][0]) && (x < BTN_RANGES_v1[i][1]))
|| ((_vm->getGameID() == GType_Amazon) && (x >= BTN_RANGES_v2[i][0]) && (x < BTN_RANGES_v2[i][1]))) {
choice = i;
@@ -1049,7 +1049,7 @@ void Scripts::cmdDispAbout() {
if (btnSelected == 2)
_vm->_useItem = -1;
else
- _vm->_useItem = _vm->_travelBox->_tempListIdx[boxX];
+ _vm->_useItem = _vm->_travelBox->_tempListIdx[boxX];
}
void Scripts::cmdPushLocation() {
diff --git a/engines/access/scripts.h b/engines/access/scripts.h
index 4cfedf3b3f..ad9cb8661e 100644
--- a/engines/access/scripts.h
+++ b/engines/access/scripts.h
@@ -73,12 +73,12 @@ protected:
void cmdAnim();
void cmdSetFlag();
void cmdCheckFlag();
-
+
/**
* Jump to another script
*/
void cmdGoto();
-
+
void cmdAddScore();
void cmdSetInventory();
void cmdCheckInventory();
@@ -162,7 +162,7 @@ public:
void freeScriptData();
void searchForSequence();
-
+
int executeScript();
void findNull();
diff --git a/engines/access/sound.cpp b/engines/access/sound.cpp
index cf52bc58c5..baa14ce21e 100644
--- a/engines/access/sound.cpp
+++ b/engines/access/sound.cpp
@@ -155,7 +155,7 @@ void SoundManager::playSound(Resource *res, int priority, bool loop, int soundIn
error("Unknown format");
if (loop) {
- _queue.push_back(QueuedSound(new Audio::LoopingAudioStream(audioStream, 0,
+ _queue.push_back(QueuedSound(new Audio::LoopingAudioStream(audioStream, 0,
DisposeAfterUse::NO), soundIndex));
} else {
_queue.push_back(QueuedSound(audioStream, soundIndex));
diff --git a/engines/access/video.cpp b/engines/access/video.cpp
index 22842a5855..54231a9efe 100644
--- a/engines/access/video.cpp
+++ b/engines/access/video.cpp
@@ -97,7 +97,7 @@ void VideoPlayer::setVideo(BaseSurface *vidSurface, const Common::Point &pt, con
void VideoPlayer::setVideo(BaseSurface *vidSurface, const Common::Point &pt, const FileIdent &videoFile, int rate) {
// Open up video stream
_videoData = _vm->_files->loadFile(videoFile);
-
+
setVideo(vidSurface, pt, rate);
}
diff --git a/engines/adl/configure.engine b/engines/adl/configure.engine
index 844e2b8e6a..944b043af8 100644
--- a/engines/adl/configure.engine
+++ b/engines/adl/configure.engine
@@ -1,3 +1,3 @@
# This file is included from the main "configure" script
# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
-add_engine adl "ADL" no
+add_engine adl "ADL" yes
diff --git a/engines/adl/detection.cpp b/engines/adl/detection.cpp
index 2d568b28d7..1cfeb9a859 100644
--- a/engines/adl/detection.cpp
+++ b/engines/adl/detection.cpp
@@ -93,7 +93,7 @@ static const AdlGameDescription gameDescriptions[] = {
},
Common::EN_ANY,
Common::kPlatformApple2,
- ADGF_TESTING,
+ ADGF_NO_FLAGS,
GUIO2(GAMEOPTION_COLOR_DEFAULT_OFF, GAMEOPTION_SCANLINES)
},
GAME_TYPE_HIRES1
@@ -107,7 +107,7 @@ static const AdlGameDescription gameDescriptions[] = {
},
Common::EN_ANY,
Common::kPlatformApple2,
- ADGF_TESTING,
+ ADGF_NO_FLAGS,
GUIO2(GAMEOPTION_COLOR_DEFAULT_OFF, GAMEOPTION_SCANLINES)
},
GAME_TYPE_HIRES1
@@ -121,7 +121,7 @@ static const AdlGameDescription gameDescriptions[] = {
},
Common::EN_ANY,
Common::kPlatformApple2,
- ADGF_TESTING,
+ ADGF_NO_FLAGS,
GUIO2(GAMEOPTION_COLOR_DEFAULT_ON, GAMEOPTION_SCANLINES)
},
GAME_TYPE_HIRES2
@@ -135,7 +135,7 @@ static const AdlGameDescription gameDescriptions[] = {
},
Common::EN_ANY,
Common::kPlatformApple2,
- ADGF_TESTING,
+ ADGF_NO_FLAGS,
GUIO2(GAMEOPTION_COLOR_DEFAULT_ON, GAMEOPTION_SCANLINES)
},
GAME_TYPE_HIRES0
diff --git a/engines/adl/disk.h b/engines/adl/disk.h
index 653d76ff10..4c0df834fa 100644
--- a/engines/adl/disk.h
+++ b/engines/adl/disk.h
@@ -135,7 +135,7 @@ private:
enum FileType {
kFileTypeText = 0,
kFileTypeAppleSoft = 2,
- kFileTypeBinary = 4
+ kFileTypeBinary = 4
};
enum {
diff --git a/engines/agi/agi.h b/engines/agi/agi.h
index 79d05c4b1d..b8c30e9d5c 100644
--- a/engines/agi/agi.h
+++ b/engines/agi/agi.h
@@ -978,7 +978,7 @@ public:
void inGameTimerUpdate();
private:
- uint32 _lastUsedPlayTimeInCycles; // 20 per second
+ uint32 _lastUsedPlayTimeInCycles; // 40 per second
uint32 _lastUsedPlayTimeInSeconds; // actual seconds
uint32 _passedPlayTimeCycles; // increased by 1 every time we passed a cycle
diff --git a/engines/agi/cycle.cpp b/engines/agi/cycle.cpp
index 19aca6f2c4..4148306de2 100644
--- a/engines/agi/cycle.cpp
+++ b/engines/agi/cycle.cpp
@@ -353,7 +353,7 @@ int AgiEngine::playGame() {
if (appleIIgsDelayOverwrite->gameId == getGameID())
break; // game found
appleIIgsDelayOverwrite++;
- }
+ }
}
do {
@@ -413,7 +413,27 @@ int AgiEngine::playGame() {
}
}
+ // Increment the delay value by one, so that we wait for at least 1 cycle
+ // In Original AGI 1 cycle was 50 milliseconds, so 20 frames per second
+ // So TIME_DELAY 1 resulted in around 20 frames per second
+ // 2 resulted in around 10 frames per second
+ // 0 however resulted in no limits at all, so the game ran as fast as possible
+ // We obviously do not want the game to run as fast as possible, so we will use 40 frames per second instead.
+ timeDelay = timeDelay * 2;
+ if (!timeDelay)
+ timeDelay = 1;
+
+ // Our cycle counter runs at 25 milliseconds.
+ // So time delay has to be 1 for the originally unlimited speed - for our 40 fps
+ // 2 for 20 frames per second
+ // 4 for 10 frames per second
+ // and so on.
+
if (_passedPlayTimeCycles >= timeDelay) {
+ // code to check for executed cycles
+ // TimeDate time;
+ // g_system->getTimeAndDate(time);
+ // warning("cycle %d", time.tm_sec);
inGameTimerResetPassedCycles();
interpretCycle();
diff --git a/engines/agi/global.cpp b/engines/agi/global.cpp
index 6f83f02a4e..bd7e4e490f 100644
--- a/engines/agi/global.cpp
+++ b/engines/agi/global.cpp
@@ -247,7 +247,7 @@ void AgiEngine::setVarSecondsTrigger(byte newSeconds) {
// This is also called in the main loop, because the game needs to be sync'd to 20 cycles per second
void AgiEngine::inGameTimerUpdate() {
uint32 curPlayTimeMilliseconds = inGameTimerGet();
- uint32 curPlayTimeCycles = curPlayTimeMilliseconds / 50;
+ uint32 curPlayTimeCycles = curPlayTimeMilliseconds / 25;
if (curPlayTimeCycles == _lastUsedPlayTimeInCycles) {
// No difference, skip updating
diff --git a/engines/agi/mouse_cursor.h b/engines/agi/mouse_cursor.h
index c086359b0f..f8dc21dc4c 100644
--- a/engines/agi/mouse_cursor.h
+++ b/engines/agi/mouse_cursor.h
@@ -192,7 +192,7 @@ static const byte MOUSECURSOR_MACINTOSH_BUSY[] = {
1,2,2,2,2,1,2,2,2,1,
1,2,2,2,2,1,2,2,2,1,
1,2,2,2,2,1,2,2,2,1,
- 1,2,2,1,1,1,2,2,2,1,
+ 1,2,2,1,1,1,2,2,2,1,
1,2,2,2,2,2,2,2,2,1,
1,2,2,2,2,2,2,2,2,1,
0,1,2,2,2,2,2,2,1,0,
diff --git a/engines/agi/systemui.cpp b/engines/agi/systemui.cpp
index 1f26267ad6..c7ca7cd5d4 100644
--- a/engines/agi/systemui.cpp
+++ b/engines/agi/systemui.cpp
@@ -975,7 +975,7 @@ void SystemUI::askForVerificationKeyPress(uint16 newKey) {
if (executeButton) {
if (_askForVerificationMouseActiveButtonNr >= 0) {
SystemUIButtonEntry *button = &_buttonArray[_askForVerificationMouseActiveButtonNr];
-
+
if (button->active) {
if (!button->isDefault) {
// Not default button? -> that's cancel
diff --git a/engines/agi/systemui.h b/engines/agi/systemui.h
index 283de8794c..1f6e2988bf 100644
--- a/engines/agi/systemui.h
+++ b/engines/agi/systemui.h
@@ -69,7 +69,7 @@ public:
bool quitDialog();
private:
-
+
public:
const char *getInventoryTextNothing();
diff --git a/engines/agos/midi.cpp b/engines/agos/midi.cpp
index d11ff201ea..3a7158a203 100644
--- a/engines/agos/midi.cpp
+++ b/engines/agos/midi.cpp
@@ -179,7 +179,7 @@ int MidiPlayer::open(int gameType, bool isDemo) {
//setTimerRate(_driver->getBaseTempo());
return 0;
}
-
+
case kMusicModeMilesAudio: {
switch (musicType) {
case MT_ADLIB: {
diff --git a/engines/agos/saveload.cpp b/engines/agos/saveload.cpp
index 1ba0f56353..6ec8931108 100644
--- a/engines/agos/saveload.cpp
+++ b/engines/agos/saveload.cpp
@@ -1317,7 +1317,7 @@ bool AGOSEngine_Elvira2::loadGame(const Common::String &filename, bool restartMo
if (getGameType() == GType_WW && getPlatform() == Common::kPlatformDOS && derefItem(item->parent) == NULL)
item->parent = 0;
-
+
parent_item = derefItem(parent);
setItemParent(item, parent_item);
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index d6f63a8584..2eaddc50f2 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -22,6 +22,7 @@
#include "common/system.h"
#include "graphics/font.h"
+#include "graphics/macgui/macfontmanager.h"
#include "graphics/macgui/macwindowmanager.h"
#include "image/bmp.h"
@@ -606,16 +607,14 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteID) {
int height = _sprites[spriteID]->_height;
int width = _sprites[spriteID]->_width;
- const char *fontName;
+ Graphics::MacFont macFont(textCast->fontId, textCast->fontSize);
if (_vm->_currentScore->_fontMap.contains(textCast->fontId)) {
- fontName = _vm->_currentScore->_fontMap[textCast->fontId].c_str();
- } else if ((fontName = _vm->_wm->getFontName(textCast->fontId, textCast->fontSize)) == NULL) {
- warning("Unknown font id %d, falling back to default", textCast->fontId);
- fontName = _vm->_wm->getFontName(0, 12);
+ // Override
+ macFont.setName(_vm->_currentScore->_fontMap[textCast->fontId]);
}
- const Graphics::Font *font = _vm->_wm->getFont(fontName, Graphics::FontManager::kBigGUIFont);
+ const Graphics::Font *font = _vm->_wm->_fontMan->getFont(macFont);
font->drawString(&surface, text, x, y, width, 0);
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index f92e030c88..aef81fad8a 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -1624,7 +1624,7 @@ yyparse ()
#endif
#endif
{
-
+
int yystate;
int yyn;
int yyresult;
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index d268be4aec..5c0eeedf7e 100644
--- a/engines/director/lingo/lingo-lex.cpp
+++ b/engines/director/lingo/lingo-lex.cpp
@@ -34,7 +34,7 @@
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
- * if you want the limit (max/min) macros for int types.
+ * if you want the limit (max/min) macros for int types.
*/
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS 1
@@ -52,7 +52,7 @@ typedef uint64_t flex_uint64_t;
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t;
+typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
#endif /* ! C99 */
@@ -168,7 +168,7 @@ extern FILE *yyin, *yyout;
#define EOB_ACT_LAST_MATCH 2
#define YY_LESS_LINENO(n)
-
+
/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
do \
@@ -225,7 +225,7 @@ struct yy_buffer_state
int yy_bs_lineno; /**< The line count. */
int yy_bs_column; /**< The column count. */
-
+
/* Whether to try to fill the input buffer when we reach the
* end of it.
*/
@@ -764,7 +764,7 @@ extern int yywrap (void );
#endif
static void yyunput (int c,char *buf_ptr );
-
+
#ifndef yytext_ptr
static void yy_flex_strncpy (char *,yyconst char *,int );
#endif
@@ -888,7 +888,7 @@ YY_DECL
register yy_state_type yy_current_state;
register char *yy_cp, *yy_bp;
register int yy_act;
-
+
#line 69 "engines/director/lingo/lingo-lex.l"
@@ -1641,7 +1641,7 @@ static int yy_get_next_buffer (void)
{
register yy_state_type yy_current_state;
register char *yy_cp;
-
+
yy_current_state = (yy_start);
yy_current_state += YY_AT_BOL();
@@ -1696,7 +1696,7 @@ static int yy_get_next_buffer (void)
static void yyunput (int c, register char * yy_bp )
{
register char *yy_cp;
-
+
yy_cp = (yy_c_buf_p);
/* undo effects of setting up yytext */
@@ -1739,7 +1739,7 @@ static int yy_get_next_buffer (void)
{
int c;
-
+
*(yy_c_buf_p) = (yy_hold_char);
if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
@@ -1808,12 +1808,12 @@ static int yy_get_next_buffer (void)
/** Immediately switch to a different input stream.
* @param input_file A readable stream.
- *
+ *
* @note This function does not reset the start condition to @c INITIAL .
*/
void yyrestart (FILE * input_file )
{
-
+
if ( ! YY_CURRENT_BUFFER ){
yyensure_buffer_stack ();
YY_CURRENT_BUFFER_LVALUE =
@@ -1826,11 +1826,11 @@ static int yy_get_next_buffer (void)
/** Switch to a different input buffer.
* @param new_buffer The new input buffer.
- *
+ *
*/
void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
{
-
+
/* TODO. We should be able to replace this entire function body
* with
* yypop_buffer_state();
@@ -1870,13 +1870,13 @@ static void yy_load_buffer_state (void)
/** Allocate and initialize an input buffer state.
* @param file A readable stream.
* @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
- *
+ *
* @return the allocated buffer state.
*/
YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
{
YY_BUFFER_STATE b;
-
+
b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
@@ -1899,11 +1899,11 @@ static void yy_load_buffer_state (void)
/** Destroy the buffer.
* @param b a buffer created with yy_create_buffer()
- *
+ *
*/
void yy_delete_buffer (YY_BUFFER_STATE b )
{
-
+
if ( ! b )
return;
@@ -1919,7 +1919,7 @@ static void yy_load_buffer_state (void)
#ifndef __cplusplus
extern int isatty (int );
#endif /* __cplusplus */
-
+
/* Initializes or reinitializes a buffer.
* This function is sometimes called more than once on the same buffer,
* such as during a yyrestart() or at EOF.
@@ -1928,7 +1928,7 @@ extern int isatty (int );
{
int oerrno = errno;
-
+
yy_flush_buffer(b );
b->yy_input_file = file;
@@ -1944,13 +1944,13 @@ extern int isatty (int );
}
b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
-
+
errno = oerrno;
}
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
* @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
- *
+ *
*/
void yy_flush_buffer (YY_BUFFER_STATE b )
{
@@ -1979,7 +1979,7 @@ extern int isatty (int );
* the current state. This function will allocate the stack
* if necessary.
* @param new_buffer The new state.
- *
+ *
*/
void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
{
@@ -2009,7 +2009,7 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
/** Removes and deletes the top of the stack, if present.
* The next element becomes the new top.
- *
+ *
*/
void yypop_buffer_state (void)
{
@@ -2033,7 +2033,7 @@ void yypop_buffer_state (void)
static void yyensure_buffer_stack (void)
{
yy_size_t num_to_alloc;
-
+
if (!(yy_buffer_stack)) {
/* First allocation is just for 2 elements, since we don't know if this
@@ -2046,9 +2046,9 @@ static void yyensure_buffer_stack (void)
);
if ( ! (yy_buffer_stack) )
YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
-
+
memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
-
+
(yy_buffer_stack_max) = num_to_alloc;
(yy_buffer_stack_top) = 0;
return;
@@ -2076,13 +2076,13 @@ static void yyensure_buffer_stack (void)
/** Setup the input buffer state to scan directly from a user-specified character buffer.
* @param base the character buffer
* @param size the size in bytes of the character buffer
- *
- * @return the newly allocated buffer state object.
+ *
+ * @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
{
YY_BUFFER_STATE b;
-
+
if ( size < 2 ||
base[size-2] != YY_END_OF_BUFFER_CHAR ||
base[size-1] != YY_END_OF_BUFFER_CHAR )
@@ -2111,14 +2111,14 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
/** Setup the input buffer state to scan a string. The next call to yylex() will
* scan from a @e copy of @a str.
* @param yystr a NUL-terminated string to scan
- *
+ *
* @return the newly allocated buffer state object.
* @note If you want to scan bytes that may contain NUL values, then use
* yy_scan_bytes() instead.
*/
YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
{
-
+
return yy_scan_bytes(yystr,strlen(yystr) );
}
@@ -2126,7 +2126,7 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
* scan from a @e copy of @a bytes.
* @param bytes the byte buffer to scan
* @param len the number of bytes in the buffer pointed to by @a bytes.
- *
+ *
* @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
@@ -2134,7 +2134,7 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len
YY_BUFFER_STATE b;
char *buf;
yy_size_t n, i;
-
+
/* Get memory for full buffer, including space for trailing EOB's. */
n = _yybytes_len + 2;
buf = (char *) yyalloc(n );
@@ -2188,16 +2188,16 @@ static void yy_fatal_error (yyconst char* msg )
/* Accessor methods (get/set functions) to struct members. */
/** Get the current line number.
- *
+ *
*/
int yyget_lineno (void)
{
-
+
return yylineno;
}
/** Get the input stream.
- *
+ *
*/
FILE *yyget_in (void)
{
@@ -2205,7 +2205,7 @@ FILE *yyget_in (void)
}
/** Get the output stream.
- *
+ *
*/
FILE *yyget_out (void)
{
@@ -2213,7 +2213,7 @@ FILE *yyget_out (void)
}
/** Get the length of the current token.
- *
+ *
*/
yy_size_t yyget_leng (void)
{
@@ -2221,7 +2221,7 @@ yy_size_t yyget_leng (void)
}
/** Get the current token.
- *
+ *
*/
char *yyget_text (void)
@@ -2231,18 +2231,18 @@ char *yyget_text (void)
/** Set the current line number.
* @param line_number
- *
+ *
*/
void yyset_lineno (int line_number )
{
-
+
yylineno = line_number;
}
/** Set the input stream. This does not discard the current
* input buffer.
* @param in_str A readable stream.
- *
+ *
* @see yy_switch_to_buffer
*/
void yyset_in (FILE * in_str )
@@ -2296,7 +2296,7 @@ static int yy_init_globals (void)
/* yylex_destroy is for both reentrant and non-reentrant scanners. */
int yylex_destroy (void)
{
-
+
/* Pop the buffer stack, destroying each element. */
while(YY_CURRENT_BUFFER){
yy_delete_buffer(YY_CURRENT_BUFFER );
diff --git a/engines/dm/detection.cpp b/engines/dm/detection.cpp
index 8ac2aa552c..a8f44acdba 100644
--- a/engines/dm/detection.cpp
+++ b/engines/dm/detection.cpp
@@ -43,7 +43,7 @@ static const PlainGameDescriptor DMGames[] = {
static const DMADGameDescription gameDescriptions[] = {
{
- {"dm", "Amiga 2.0v English",
+ {"dm", "Amiga v2.0 English",
{
{"graphics.dat", 0, "c2205f6225bde728417de29394f97d55", 411960},
{"Dungeon.dat", 0, "43a213da8eda413541dd12f90ce202f6", 25006},
@@ -57,7 +57,7 @@ static const DMADGameDescription gameDescriptions[] = {
{ kDMSavePlatformAcceptAny}
},
{
- {"dm", "Atari ???v English",
+ {"dm", "Atari v??? English",
{
{"graphics.dat", 0, "6ffff2a17e2df0effa9a12fb4b1bf6b6", 271911},
{"Dungeon.dat", 0, "be9468b460515741babec9a70501e2e9", 33286},
@@ -70,19 +70,31 @@ static const DMADGameDescription gameDescriptions[] = {
{ kDMSaveFormatAmigaPC98FmTowns, kDMSaveFormatEndOfList},
{ kDMSavePlatformAcceptAny }
},
-
- {
+ {
+ // Added by Strangerke
+ {"dm", "Amiga Demo v2.0 English",
+ {
+ {"graphics.dat", 0, "3932c8359bb36c24291b09e915114d38", 192421},
+ {"DemoDun.dat", 0, "78848e1a2d3d5a11e5954deb8c7b772b", 1209},
+ AD_LISTEND
+ },
+ Common::EN_ANY, Common::kPlatformAmiga, ADGF_DEMO, GUIO1(GUIO_NONE),
+ },
+ kDMSaveTargetDM21, kDMSaveFormatAmigaPC98FmTowns, kDMSavePlatformAtariSt,
+ { kDMSaveTargetDM21, kDMSaveTargetEndOfList},
+ { kDMSaveFormatAmigaPC98FmTowns, kDMSaveFormatEndOfList},
+ { kDMSavePlatformAcceptAny }
+ },
+ {
AD_TABLE_END_MARKER, kDMSaveTargetNone, kDMSaveFormatNone, kDMSavePlatformNone,
{kDMSaveTargetNone}, {kDMSaveFormatNone}, {kDMSavePlatformNone}
}
};
-
static const ADExtraGuiOptionsMap optionsList[] = {
AD_EXTRA_GUI_OPTIONS_TERMINATOR
};
-
class DMMetaEngine : public AdvancedMetaEngine {
public:
DMMetaEngine() : AdvancedMetaEngine(DM::gameDescriptions, sizeof(DMADGameDescription), DMGames, optionsList) {
diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp
index cfed9eb894..25d741f376 100644
--- a/engines/dm/dm.cpp
+++ b/engines/dm/dm.cpp
@@ -68,6 +68,11 @@
#include "dm/sounds.h"
namespace DM {
+
+bool DMEngine::isDemo() const {
+ return (bool)(_gameVersion->_desc.flags & ADGF_DEMO);
+}
+
Direction DMEngine::turnDirRight(int16 dir) {
Direction result = (Direction)((dir + 1) & 3);
return result;
diff --git a/engines/dm/dm.h b/engines/dm/dm.h
index 6549db13b5..9056a744fb 100644
--- a/engines/dm/dm.h
+++ b/engines/dm/dm.h
@@ -211,7 +211,7 @@ public:
// Note: F0026_MAIN_GetBoundedValue<T> has been replaced by CLIP<T>
-#define CALL_MEMBER_FN(object,ptrToMember) ((object).*(ptrToMember))
+#define CALL_MEMBER_FN(object, ptrToMember) ((object).*(ptrToMember))
struct SaveGameHeader {
byte _version;
@@ -243,6 +243,8 @@ public:
virtual Common::Error loadGameState(int slot);
virtual bool canLoadGameStateCurrently();
+ bool isDemo() const;
+
GUI::Debugger *getDebugger() { return _console; }
void delay(uint16 verticalBlank); // @ F0022_MAIN_Delay
diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp
index 5746ee03c2..417f3e31e7 100644
--- a/engines/dm/dungeonman.cpp
+++ b/engines/dm/dungeonman.cpp
@@ -477,7 +477,14 @@ DungeonMan::~DungeonMan() {
void DungeonMan::decompressDungeonFile() {
Common::File f;
- f.open("Dungeon.dat");
+ if (_vm->isDemo())
+ f.open("DemoDun.dat");
+ else
+ f.open("Dungeon.dat");
+
+ if (!f.isOpen())
+ error("Unable to open Dungeon.dat file");
+
if (f.readUint16BE() == 0x8104) { // if dungeon is compressed
_rawDunFileDataSize = f.readUint32BE();
delete[] _rawDunFileData;
diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp
index 39ae3da50f..46d90366cd 100644
--- a/engines/dm/gfx.cpp
+++ b/engines/dm/gfx.cpp
@@ -63,7 +63,7 @@ DoorFrames::DoorFrames(Frame f1, Frame f2_1, Frame f2_2, Frame f2_3,
_rightHorizontal[1] = f4_2;
_rightHorizontal[2] = f4_3;
}
-
+
DisplayMan::DisplayMan(DMEngine *dmEngine) : _vm(dmEngine) {
_bitmapScreen = nullptr;
_bitmaps = nullptr;
@@ -898,7 +898,7 @@ void DisplayMan::fillBoxBitmap(byte *destBitmap, Box &box, Color color, int16 by
void DisplayMan::blitBoxFilledWithMaskedBitmap(byte *src, byte *dest, byte *mask, byte *tmp, Box& box,
int16 lastUnitIndex, int16 firstUnitIndex, int16 destByteWidth, Color transparent,
int16 xPos, int16 yPos, int16 destHeight, int16 height2) {
-
+
// FIXME: does not produce the same effect as the original
byte nextUnitIndex = firstUnitIndex;
diff --git a/engines/dm/group.cpp b/engines/dm/group.cpp
index b1d9766912..cf748ffa41 100644
--- a/engines/dm/group.cpp
+++ b/engines/dm/group.cpp
@@ -1832,6 +1832,9 @@ Thing GroupMan::groupGetGenerated(CreatureType creatureType, int16 healthMultipl
}
bool GroupMan::isSquareACorridorTeleporterPitOrDoor(int16 mapX, int16 mapY) {
+ if (_vm->isDemo())
+ return false;
+
int16 squareType = Square(_vm->_dungeonMan->getSquare(mapX, mapY)).getType();
return ((squareType == kDMElementTypeCorridor) || (squareType == kDMElementTypeTeleporter)
diff --git a/engines/dm/loadsave.cpp b/engines/dm/loadsave.cpp
index 111280c958..8bc3770226 100644
--- a/engines/dm/loadsave.cpp
+++ b/engines/dm/loadsave.cpp
@@ -393,7 +393,7 @@ bool DMEngine::writeCompleteSaveFile(int16 saveSlot, Common::String& saveDescrip
file->flush();
file->finalize();
delete file;
-
+
return true;
}
diff --git a/engines/dm/movesens.cpp b/engines/dm/movesens.cpp
index 3fb477cbbc..7c7dc19606 100644
--- a/engines/dm/movesens.cpp
+++ b/engines/dm/movesens.cpp
@@ -904,8 +904,6 @@ bool MovesensMan::isObjectInPartyPossession(int16 objectType) {
}
void MovesensMan::triggerEffect(Sensor *sensor, SensorEffect effect, int16 mapX, int16 mapY, uint16 cell) {
- bool leaderHandObjectProcessed = false;
-
static const TimelineEventType squareTypeToEventTypeArray[7] = { // @ G0059_auc_Graphic562_SquareTypeToEventType
kDMEventTypeWall,
kDMEventTypeCorridor,
diff --git a/engines/drascula/actors.cpp b/engines/drascula/actors.cpp
index b459c4539b..3b1ac7cb60 100644
--- a/engines/drascula/actors.cpp
+++ b/engines/drascula/actors.cpp
@@ -398,7 +398,7 @@ void DrasculaEngine::increaseFrameNum() {
curHeight = (int)newHeight;
curWidth = (int)newWidth;
}
-
+
// Fix bug #5903 DRASCULA-IT: Crash/graphic glitch at castle towers
// Chapter 5 Room 45 is the castle tower part
// Fixing the character's coordinate(0,0) in the tower section to prevent out of window coordinates and crash
diff --git a/engines/drascula/graphics.cpp b/engines/drascula/graphics.cpp
index 6bfb2e1823..8634b6c586 100644
--- a/engines/drascula/graphics.cpp
+++ b/engines/drascula/graphics.cpp
@@ -217,7 +217,7 @@ void DrasculaEngine::print_abc(const char *said, int screenX, int screenY) {
int letterY = 0, letterX = 0, i;
uint len = strlen(said);
byte c;
-
+
byte *srcSurface = tableSurface;
if (_lang == kSpanish && currentChapter == 6)
srcSurface = extraSurface;
@@ -329,7 +329,7 @@ bool DrasculaEngine::textFitsCentered(char *text, int x) {
//if (x > 160)
// x = 315 - x;
//return (halfLen <= x);
-
+
// The commented out code above is what the original engine is doing. Instead of testing the
// upper bound if x is greater than 160 it takes the complement to 315 and test only the lower
// bounds.
@@ -349,15 +349,15 @@ bool DrasculaEngine::textFitsCentered(char *text, int x) {
void DrasculaEngine::centerText(const char *message, int textX, int textY) {
char msg[200];
Common::strlcpy(msg, message, 200);
-
+
// We make sure to have a width of at least 120 pixels by clipping the center.
// In theory since the screen width is 320 I would expect something like this:
// x = CLIP<int>(x, 60, 260);
// return (x - halfLen >= 0 && x + halfLen <= 319);
-
+
// The engines does things differently though. It tries to clips text at 315 instead of 319.
// See also the comment in textFitsCentered().
-
+
textX = CLIP<int>(textX, 60, 255);
// If the message fits on screen as-is, just print it here
@@ -424,7 +424,7 @@ void DrasculaEngine::centerText(const char *message, int textX, int textY) {
Common::strlcpy(messageLines[curLine++], messageCurLine, 41);
}
}
-
+
// The original starts to draw (nbLines + 2) lines above textY.
// Also clip to the screen height although the original does not do it.
int y = textY - (curLine + 2) * CHAR_HEIGHT;
diff --git a/engines/drascula/saveload.cpp b/engines/drascula/saveload.cpp
index e99898da5a..a1d7d615ea 100644
--- a/engines/drascula/saveload.cpp
+++ b/engines/drascula/saveload.cpp
@@ -255,7 +255,7 @@ bool DrasculaEngine::loadGame(int slot) {
if (!(in = _saveFileMan->openForLoading(saveFileName))) {
error("missing savegame file %s", saveFileName.c_str());
}
-
+
// If we currently are in room 102 while being attached below the pendulum
// the character is invisible and some surface are temporarily used for other
// things. Reset those before loading the savegame otherwise we may have some
@@ -267,7 +267,7 @@ bool DrasculaEngine::loadGame(int slot) {
loadPic(97, extraSurface);
loadPic(99, backSurface);
}
-
+
loadMetaData(in, slot, true);
Graphics::skipThumbnail(*in);
@@ -300,7 +300,7 @@ bool DrasculaEngine::loadGame(int slot) {
if (!sscanf(currentData, "%d.ald", &roomNum)) {
error("Bad save format");
}
-
+
// When loading room 102 while being attached below the pendulum Some variables
// are not correctly set and can cause random crashes when calling enterRoom below.
// The crash occurs in moveCharacters() when accessing factor_red[curY + curHeight].
@@ -309,10 +309,10 @@ bool DrasculaEngine::loadGame(int slot) {
curY = 108;
curWidth = curHeight = 0;
}
-
+
enterRoom(roomNum);
selectVerb(kVerbNone);
-
+
// When loading room 102 while being attached below the pendulum we
// need to call activatePendulum() to properly initialized the scene.
if (_roomNumber == 102 && flags[1] == 2)
diff --git a/engines/drascula/talk.cpp b/engines/drascula/talk.cpp
index cc329b206b..7ac2cc6406 100644
--- a/engines/drascula/talk.cpp
+++ b/engines/drascula/talk.cpp
@@ -379,10 +379,10 @@ void DrasculaEngine::talk(const char *said, const char *filename) {
int y_mask_talk = 170;
int face;
-
+
// Fix bug #5903 DRASCULA-IT: Crash/graphic glitch at castle towers
// Chapter 5 Room 45 is the castle tower part
- // We use this variable as a condition below because at the castle towers we don't want to draw out the head
+ // We use this variable as a condition below because at the castle towers we don't want to draw out the head
bool notTowers = !((currentChapter == 5) && (_roomNumber == 45));
if (currentChapter == 6) {
@@ -488,7 +488,7 @@ void DrasculaEngine::talk(const char *said, const char *filename) {
centerText(said, 160, 25);
}
}
-
+
updateScreen();
updateEvents();
diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h
index 9bd1319a07..2818397ced 100644
--- a/engines/fullpipe/constants.h
+++ b/engines/fullpipe/constants.h
@@ -62,6 +62,8 @@ namespace Fullpipe {
#define PIC_CSR_DEFAULT_INV 4892
#define PIC_CSR_ITN 4893
#define PIC_CSR_ITN_INV 4894
+#define PIC_CSR_ITN_GREEN 5330
+#define PIC_CSR_ITN_RED 5329
#define PIC_CSR_GOFAR_L 4895
#define PIC_CSR_GOFAR_R 4896
#define PIC_CSR_ARCADE1 4901
@@ -75,19 +77,11 @@ namespace Fullpipe {
#define PIC_CSR_ARCADE7 4909
#define PIC_CSR_ARCADE7_D 4910
#define PIC_CSR_ARCADE8 4911
-#define PIC_CSR_DEFAULT 4891
-#define PIC_CSR_DEFAULT_INV 4892
#define PIC_CSR_GOD 4900
-#define PIC_CSR_GOFAR_L 4895
-#define PIC_CSR_GOFAR_R 4896
#define PIC_CSR_GOL 4897
#define PIC_CSR_GOR 4898
#define PIC_CSR_GOU 4899
#define PIC_CSR_HELPERBGR 5331
-#define PIC_CSR_ITN 4893
-#define PIC_CSR_ITN_GREEN 5330
-#define PIC_CSR_ITN_INV 4894
-#define PIC_CSR_ITN_RED 5329
#define PIC_CSR_LIFT 5176
#define PIC_CSR_MAP 5339
#define PIC_HLP_BGR 3562
@@ -462,7 +456,6 @@ namespace Fullpipe {
#define MV_SC4_COIN_default 1029
#define MV_SPK4_PLAY 3276
#define MV_SPR_LOWER 543
-#define PIC_MAP_P03 5279
#define PIC_SC4_BOTTLE 568
#define PIC_SC4_BOTTLE2 2936
#define PIC_SC4_DOWNTRUBA 619
@@ -1137,7 +1130,6 @@ namespace Fullpipe {
#define ST_WTR24_FLOWLOWER 1843
// Scene 25
-#define ANI_BEARDED_CMN 3420
#define ANI_BOARD25 1898
#define ANI_DROP_25 3499
#define ANI_INV_BOARD 1872
diff --git a/engines/fullpipe/detection.cpp b/engines/fullpipe/detection.cpp
index af2b0cab3a..16895b539f 100644
--- a/engines/fullpipe/detection.cpp
+++ b/engines/fullpipe/detection.cpp
@@ -88,7 +88,7 @@ public:
}
virtual bool hasFeature(MetaEngineFeature f) const;
- virtual int getMaximumSaveSlot() const { return 8; }
+ virtual int getMaximumSaveSlot() const { return 99; }
virtual SaveStateList listSaves(const char *target) const;
virtual void removeSaveState(const char *target, int slot) const;
virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp
index 11d8852988..2250a5d4d1 100644
--- a/engines/fullpipe/fullpipe.cpp
+++ b/engines/fullpipe/fullpipe.cpp
@@ -57,6 +57,7 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc)
DebugMan.addDebugChannel(kDebugEvents, "events", "Event handling");
DebugMan.addDebugChannel(kDebugInventory, "inventory", "Inventory");
DebugMan.addDebugChannel(kDebugSceneLogic, "scenelogic", "Scene Logic");
+ DebugMan.addDebugChannel(kDebugInteractions, "interactions", "Interactions");
// Setup mixer
if (!_mixer->isReady()) {
@@ -307,6 +308,9 @@ Common::Error FullpipeEngine::run() {
int time1 = g_fp->_system->getMillis();
+ // Center mouse
+ _system->warpMouse(400, 300);
+
while (_gameContinue) {
updateEvents();
@@ -584,8 +588,10 @@ void FullpipeEngine::disableSaves(ExCommand *ex) {
}
// Original was makeing a save on every room entering
- //if (_currentScene)
- // _gameLoader->writeSavegame(_currentScene, "savetmp.sav");
+ if (_currentScene) {
+ _gameLoader->saveScenePicAniInfos(_currentScene->_sceneId);
+ // _gameLoader->writeSavegame(_currentScene, "savetmp.sav");
+ }
}
}
diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h
index 1b6e222d22..d8f438b3da 100644
--- a/engines/fullpipe/fullpipe.h
+++ b/engines/fullpipe/fullpipe.h
@@ -57,7 +57,8 @@ enum {
kDebugEvents = 1 << 5,
kDebugBehavior = 1 << 6,
kDebugInventory = 1 << 7,
- kDebugSceneLogic = 1 << 8
+ kDebugSceneLogic = 1 << 8,
+ kDebugInteractions = 1 << 9
};
class BehaviorManager;
diff --git a/engines/fullpipe/interaction.cpp b/engines/fullpipe/interaction.cpp
index accba788f9..8f6ec5dd72 100644
--- a/engines/fullpipe/interaction.cpp
+++ b/engines/fullpipe/interaction.cpp
@@ -128,6 +128,8 @@ bool InteractionController::handleInteraction(StaticANIObject *subj, GameObject
if (cinter->_messageQueue)
cinter->_messageQueue->calcDuration(subj);
+ debugC(5, kDebugInteractions, "Interaction: %s", transCyrillic((byte *)cinter->_actionName));
+
PicAniInfo aniInfo;
obj->getPicAniInfo(&aniInfo);
@@ -259,7 +261,7 @@ LABEL_38:
if (!(inter->_flags & 0x10000)) {
ex = new ExCommand(obj->_id, 34, 0x80, 0, 0, 0, 1, 0, 0, 0);
ex->_param = obj->_odelay;
- ex->_field_14 = 0x100;
+ ex->_field_14 = 0x80;
ex->_messageNum = 0;
ex->_excFlags = 3;
mq->addExCommandToEnd(ex);
diff --git a/engines/fullpipe/interaction.h b/engines/fullpipe/interaction.h
index cb1eac002a..40df9035e9 100644
--- a/engines/fullpipe/interaction.h
+++ b/engines/fullpipe/interaction.h
@@ -49,7 +49,7 @@ class Interaction : public CObject {
MessageQueue *_messageQueue;
int _sceneId;
int _field_28;
- int _flags;
+ uint _flags;
char *_actionName;
public:
diff --git a/engines/fullpipe/messagehandlers.cpp b/engines/fullpipe/messagehandlers.cpp
index ec01597244..b4338a237a 100644
--- a/engines/fullpipe/messagehandlers.cpp
+++ b/engines/fullpipe/messagehandlers.cpp
@@ -197,6 +197,15 @@ int global_messageHandler1(ExCommand *cmd) {
g_fp->openHelp();
cmd->_messageKind = 0;
break;
+ case '8':
+ {
+ int num = 32;
+ for (uint i = 0; i < g_fp->_gameLoader->_sc2array[num]._picAniInfosCount; i++) {
+ debug("pic %d, %d:", num, i);
+ g_fp->_gameLoader->_sc2array[num]._picAniInfos[i]->print();
+ }
+ }
+ break;
default:
break;
}
diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp
index b73eaab5c7..05e83fca06 100644
--- a/engines/fullpipe/modal.cpp
+++ b/engines/fullpipe/modal.cpp
@@ -1224,6 +1224,8 @@ void ModalMainMenu::enableDebugMenuButton() {
area->picObjL = _scene->getPictureObjectById(area->picIdL, 0);
area->picObjL->_flags &= 0xFFFB;
_areas.push_back(area);
+
+ g_fp->_mainMenu_debugEnabled = true;
}
void ModalMainMenu::setSliderPos() {
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index 51f5ae7869..e5eb9721f4 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -38,7 +38,31 @@ bool MotionController::load(MfcArchive &file) {
}
void MotionController::enableLinks(const char *linkName, bool enable) {
- warning("STUB: MotionController::enableLinks()");
+ if (_objtype != kObjTypeMctlCompound)
+ return;
+
+ MctlCompound *obj = (MctlCompound *)this;
+
+ for (uint i = 0; i < obj->getMotionControllerCount(); i++) {
+ MotionController *con = obj->getMotionController(i);
+
+ if (con->_objtype == kObjTypeMovGraph) {
+ MovGraph *gr = (MovGraph *)con;
+
+ for (ObList::iterator l = gr->_links.begin(); l != gr->_links.end(); ++l) {
+ assert(((CObject *)*l)->_objtype == kObjTypeMovGraphLink);
+
+ MovGraphLink *lnk = (MovGraphLink *)*l;
+
+ if (!strcmp(lnk->_name, linkName)) {
+ if (enable)
+ lnk->_flags |= 0x20000000;
+ else
+ lnk->_flags &= 0xDFFFFFFF;
+ }
+ }
+ }
+ }
}
MovGraphLink *MotionController::getLinkByName(const char *name) {
@@ -2735,16 +2759,16 @@ MovGraphLink *MctlGraph::getNearestLink(int x, int y) {
double n1y = lnk->_graphSrc->_y;
double n2x = lnk->_graphDst->_x;
double n2y = lnk->_graphDst->_y;
- double n1dx = n1x - x;
+ double n1dx = x - n1x;
double n1dy = n1y - y;
double dst1 = sqrt(n1dy * n1dy + n1dx * n1dx);
double coeff1 = ((n1y - n2y) * n1dy + (n2x - n1x) * n1dx) / lnk->_length / dst1;
double dst3 = coeff1 * dst1;
double dst2 = sqrt(1.0 - coeff1 * coeff1) * dst1;
- if (coeff1 * dst1 < 0.0) {
+ if (dst3 < 0.0) {
dst3 = 0.0;
- dst2 = sqrt(n1dy * n1dy + n1dx * n1dx);
+ dst2 = sqrt((n1x - x) * (n1x - x) + (n1y - y) * (n1y - y));
}
if (dst3 > lnk->_length) {
dst3 = lnk->_length;
@@ -3055,13 +3079,13 @@ void ReactPolygonal::getBBox(Common::Rect *rect) {
if (rect->left > _points[i]->x)
rect->left = _points[i]->x;
- if (rect->top < _points[i]->y)
+ if (rect->top > _points[i]->y)
rect->top = _points[i]->y;
if (rect->right < _points[i]->x)
rect->right = _points[i]->x;
- if (rect->bottom > _points[i]->y)
+ if (rect->bottom < _points[i]->y)
rect->bottom = _points[i]->y;
}
diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h
index 93b57c7aaa..5b225143ad 100644
--- a/engines/fullpipe/motion.h
+++ b/engines/fullpipe/motion.h
@@ -222,7 +222,7 @@ class MovGraphLink : public CObject {
MovGraphNode *_graphDst;
DWordArray _dwordArray1;
DWordArray _dwordArray2;
- int _flags;
+ uint32 _flags;
int _field_38;
int _field_3C;
double _length;
diff --git a/engines/fullpipe/objects.h b/engines/fullpipe/objects.h
index 9f0ccf18de..12ad6105d3 100644
--- a/engines/fullpipe/objects.h
+++ b/engines/fullpipe/objects.h
@@ -62,6 +62,7 @@ struct PicAniInfo {
bool load(MfcArchive &file);
void save(MfcArchive &file);
+ void print();
PicAniInfo() { memset(this, 0, sizeof(PicAniInfo)); }
};
diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp
index d37f5dba39..5ac25c82f8 100644
--- a/engines/fullpipe/scenes.cpp
+++ b/engines/fullpipe/scenes.cpp
@@ -199,7 +199,7 @@ Vars::Vars() {
scene11_swingOldAngle = 1.0;
scene11_swingSpeed = 1.0;
scene11_swingAngleDiff = 1.0;
- scene11_swingInertia = 0.0;
+ scene11_swingInertia = 0.01;
scene11_swingCounter = 0;
scene11_swingCounterPrevTurn = 0;
scene11_swingDirection = 0;
@@ -445,7 +445,7 @@ Vars::Vars() {
scene37_rings.clear();
scene37_lastDudeX = -1;
- scene37_cursorIsLocked = 0;
+ scene37_pipeIsOpen = 0;
scene37_plusMinus1 = 0;
scene37_plusMinus2 = 0;
scene37_plusMinus3 = 0;
diff --git a/engines/fullpipe/scenes.h b/engines/fullpipe/scenes.h
index fc593a6088..918fb72b37 100644
--- a/engines/fullpipe/scenes.h
+++ b/engines/fullpipe/scenes.h
@@ -636,7 +636,7 @@ public:
Common::Array<Ring *> scene37_rings;
int scene37_lastDudeX;
- bool scene37_cursorIsLocked;
+ bool scene37_pipeIsOpen;
StaticANIObject *scene37_plusMinus1;
StaticANIObject *scene37_plusMinus2;
StaticANIObject *scene37_plusMinus3;
diff --git a/engines/fullpipe/scenes/scene06.cpp b/engines/fullpipe/scenes/scene06.cpp
index 9b483a0b3e..5fab4b5862 100644
--- a/engines/fullpipe/scenes/scene06.cpp
+++ b/engines/fullpipe/scenes/scene06.cpp
@@ -474,15 +474,11 @@ void sceneHandler06_catchBall() {
}
void sceneHandler06_checkBallTarget(int par) {
- uint32 pixel;
-
if (g_vars->scene06_ballY <= 475) {
- if (g_vars->scene06_mumsy->getPixelAtPos(g_vars->scene06_ballX, g_vars->scene06_ballY, &pixel)) {
- if (pixel) {
- chainObjQueue(g_vars->scene06_mumsy, QU_MOM_JUMPBK, 0);
+ if (g_vars->scene06_mumsy->isPixelHitAtPos(g_vars->scene06_ballX, g_vars->scene06_ballY)) {
+ chainObjQueue(g_vars->scene06_mumsy, QU_MOM_JUMPBK, 0);
- sceneHandler06_catchBall();
- }
+ sceneHandler06_catchBall();
}
} else {
sceneHandler06_fallBall();
diff --git a/engines/fullpipe/scenes/scene10.cpp b/engines/fullpipe/scenes/scene10.cpp
index 47328967d0..990a8f2525 100644
--- a/engines/fullpipe/scenes/scene10.cpp
+++ b/engines/fullpipe/scenes/scene10.cpp
@@ -65,7 +65,7 @@ int scene10_updateCursor() {
if (g_fp->_objectIdAtCursor == ANI_PACHKA || g_fp->_objectIdAtCursor == ANI_GUM) {
if (g_fp->_cursorId == PIC_CSR_ITN) {
if (g_vars->scene10_hasGum)
- g_fp->_cursorId = (sceneHandler10_inflaterIsBlind() != 0) ? PIC_CSR_ITN_RED : PIC_CSR_ITN_GREEN;
+ g_fp->_cursorId = (sceneHandler10_inflaterIsBlind() != 0) ? PIC_CSR_ITN_GREEN : PIC_CSR_ITN_RED;
else
g_fp->_cursorId = PIC_CSR_DEFAULT;
}
diff --git a/engines/fullpipe/scenes/scene11.cpp b/engines/fullpipe/scenes/scene11.cpp
index 6866dcf821..8c3de9e11e 100644
--- a/engines/fullpipe/scenes/scene11.cpp
+++ b/engines/fullpipe/scenes/scene11.cpp
@@ -114,7 +114,7 @@ void scene11_initScene(Scene *sc) {
g_vars->scene11_swingOldAngle = 0.0;
g_vars->scene11_swingSpeed = 0.0;
g_vars->scene11_swingAngleDiff = 0.0;
- g_vars->scene11_swingInertia = 1.28; //1.9849218750000000;
+ g_vars->scene11_swingInertia = 0.01; //1.9849218750000000;
g_vars->scene11_swingCounter = 0;
g_vars->scene11_swingCounterPrevTurn = 0;
g_vars->scene11_swingDirection = 0;
@@ -232,6 +232,8 @@ int sceneHandler11_updateScreenCallback() {
}
void sceneHandler11_manToSwing() {
+ debugC(1, kDebugSceneLogic, "sceneHandler11_manToSwing()");
+
g_vars->scene11_arcadeIsOn = true;
getCurrSceneSc2MotionController()->deactivate();
@@ -240,7 +242,7 @@ void sceneHandler11_manToSwing() {
g_fp->_aniMan2->hide();
g_vars->scene11_swingCounter = 0;
- g_vars->scene11_swingInertia = 1.28; //1.9849218;
+ g_vars->scene11_swingInertia = 0.01; //1.9849218;
g_vars->scene11_dudeOnSwing->_flags &= 0xFFFB;
g_vars->scene11_dudeOnSwing = g_fp->_currentScene->getStaticANIObject1ById(ANI_MAN11, -1);
@@ -334,11 +336,14 @@ void sceneHandler11_jumpFromSwing() {
}
void sceneHandler11_swing0() {
+ debugC(1, kDebugSceneLogic, "sceneHandler11_swing0()");
+
+ int phase = g_vars->scene11_dudeOnSwing->_movement->_currDynamicPhaseIndex;
g_vars->scene11_dudeOnSwing->_statics = g_vars->scene11_dudeOnSwing->getStaticsById(ST_MAN11_EMPTY);
g_vars->scene11_dudeOnSwing->_movement = 0;
g_vars->scene11_dudeOnSwing->show1(690, 215, MV_MAN11_SWING_0, 0);
g_vars->scene11_dudeOnSwing->startAnim(MV_MAN11_SWING_0, 0, -1);
- g_vars->scene11_dudeOnSwing->_movement->setDynamicPhaseIndex(g_vars->scene11_dudeOnSwing->_movement->_currDynamicPhaseIndex);
+ g_vars->scene11_dudeOnSwing->_movement->setDynamicPhaseIndex(phase);
g_vars->scene11_swingDirection = 0;
g_vars->scene11_swingMaxAngle = 45;
@@ -346,11 +351,14 @@ void sceneHandler11_swing0() {
}
void sceneHandler11_swing1() {
+ debugC(1, kDebugSceneLogic, "sceneHandler11_swing1()");
+
+ int phase = g_vars->scene11_dudeOnSwing->_movement->_currDynamicPhaseIndex;
g_vars->scene11_dudeOnSwing->_statics = g_vars->scene11_dudeOnSwing->getStaticsById(ST_MAN11_EMPTY);
g_vars->scene11_dudeOnSwing->_movement = 0;
g_vars->scene11_dudeOnSwing->show1(690, 215, MV_MAN11_SWING_1, 0);
g_vars->scene11_dudeOnSwing->startAnim(MV_MAN11_SWING_1, 0, -1);
- g_vars->scene11_dudeOnSwing->_movement->setDynamicPhaseIndex(g_vars->scene11_dudeOnSwing->_movement->_currDynamicPhaseIndex);
+ g_vars->scene11_dudeOnSwing->_movement->setDynamicPhaseIndex(phase);
g_vars->scene11_swingDirection = 1;
g_vars->scene11_swingMaxAngle = 42;
@@ -358,11 +366,14 @@ void sceneHandler11_swing1() {
}
void sceneHandler11_swing2() {
+ debugC(1, kDebugSceneLogic, "sceneHandler11_swing2()");
+
+ int phase = g_vars->scene11_dudeOnSwing->_movement->_currDynamicPhaseIndex;
g_vars->scene11_dudeOnSwing->_statics = g_vars->scene11_dudeOnSwing->getStaticsById(ST_MAN11_EMPTY);
g_vars->scene11_dudeOnSwing->_movement = 0;
g_vars->scene11_dudeOnSwing->show1(690, 215, MV_MAN11_SWING_2, 0);
g_vars->scene11_dudeOnSwing->startAnim(MV_MAN11_SWING_2, 0, -1);
- g_vars->scene11_dudeOnSwing->_movement->setDynamicPhaseIndex(g_vars->scene11_dudeOnSwing->_movement->_currDynamicPhaseIndex);
+ g_vars->scene11_dudeOnSwing->_movement->setDynamicPhaseIndex(phase);
g_vars->scene11_swingDirection = 2;
g_vars->scene11_swingMaxAngle = 48;
@@ -370,6 +381,7 @@ void sceneHandler11_swing2() {
}
void sceneHandler11_emptySwing() {
+ int phase = g_vars->scene11_dudeOnSwing->_movement->_currDynamicPhaseIndex;
if (g_vars->scene11_swingDirection)
sceneHandler11_swing0();
@@ -379,7 +391,7 @@ void sceneHandler11_emptySwing() {
g_vars->scene11_dudeOnSwing->show1(-1, -1, -1, 0);
g_vars->scene11_dudeOnSwing->changeStatics2(ST_KCH_EMPTY);
g_vars->scene11_dudeOnSwing->startAnim(MV_KCH_MOVE2, 0, -1);
- g_vars->scene11_dudeOnSwing->_movement->setDynamicPhaseIndex(g_vars->scene11_dudeOnSwing->_movement->_currDynamicPhaseIndex);
+ g_vars->scene11_dudeOnSwing->_movement->setDynamicPhaseIndex(phase);
g_vars->scene11_swingInertia = 0.03; //1.9881250;
}
@@ -531,7 +543,7 @@ void sceneHandler11_setSwingDirection() {
else if (g_vars->scene11_swingDirection == 1)
g_vars->scene11_swingDirectionPrevTurn = 2;
else
- g_vars->scene11_swingDirectionPrevTurn = (g_vars->scene11_dudeOnSwing->_movement->_currDynamicPhaseIndex <= 45) + 1;
+ g_vars->scene11_swingDirectionPrevTurn = (g_vars->scene11_dudeOnSwing->_movement->_currDynamicPhaseIndex <= 45 ? 1 : 0) + 1;
}
void sceneHandler11_swingieSit() {
@@ -629,123 +641,95 @@ int sceneHandler11(ExCommand *cmd) {
case 33:
{
int res = 0;
- int x, y;
-
- if (!g_fp->_aniMan2)
- goto LABEL_27;
- x = g_fp->_aniMan2->_ox;
- y = g_fp->_aniMan2->_oy;
+ if (g_fp->_aniMan2) {
+ int x, y;
+ x = g_fp->_aniMan2->_ox;
+ y = g_fp->_aniMan2->_oy;
- g_vars->scene11_dudeX = x;
- g_vars->scene11_dudeY = y;
+ g_vars->scene11_dudeX = x;
+ g_vars->scene11_dudeY = y;
- if (g_vars->scene11_scrollIsEnabled) {
- if (x > g_fp->_sceneRect.right - 200)
- g_fp->_currentScene->_x = x - g_fp->_sceneRect.right + 300;
- goto LABEL_26;
- }
+ if (g_vars->scene11_scrollIsEnabled) {
+ if (x > g_fp->_sceneRect.right - 200)
+ g_fp->_currentScene->_x = x - g_fp->_sceneRect.right + 200;
+ } else if (g_vars->scene11_scrollIsMaximized) {
+ g_fp->_currentScene->_x = g_fp->_sceneWidth - x;
- if (g_vars->scene11_scrollIsMaximized) {
- g_fp->_currentScene->_x = g_fp->_sceneWidth - x;
+ if (g_vars->scene11_dudeX < 910)
+ g_vars->scene11_scrollIsMaximized = false;
+ } else {
+ if (x < g_fp->_sceneRect.left + 200)
+ g_fp->_currentScene->_x = x - g_fp->_sceneRect.left - 300;
+ else if (x > g_fp->_sceneRect.right - 200)
+ g_fp->_currentScene->_x = x - g_fp->_sceneRect.right + 300;
- if (g_vars->scene11_dudeX < 910)
- g_vars->scene11_scrollIsMaximized = false;
+ if (y < g_fp->_sceneRect.top + 200)
+ g_fp->_currentScene->_y = y - g_fp->_sceneRect.top - 300;
+ if (y > g_fp->_sceneRect.bottom - 300)
+ g_fp->_currentScene->_y = y - g_fp->_sceneRect.bottom + 300;
- LABEL_26:
+ if (x >= 940)
+ g_vars->scene11_scrollIsMaximized = true;
+ }
res = 1;
- LABEL_27:
- if (g_vars->scene11_swingieStands) {
- if (g_fp->_sceneRect.left >= 534 && g_vars->scene11_swingieScreenEdge < 534)
- sceneHandler11_swingieSit();
+ }
- g_vars->scene11_swingieScreenEdge = g_fp->_sceneRect.left;
- }
+ if (g_vars->scene11_swingieStands) {
+ if (g_fp->_sceneRect.left >= 534 && g_vars->scene11_swingieScreenEdge < 534)
+ sceneHandler11_swingieSit();
- if (!g_vars->scene11_arcadeIsOn)
- goto LABEL_50;
+ g_vars->scene11_swingieScreenEdge = g_fp->_sceneRect.left;
+ }
- if (g_vars->scene11_swingCounterPrevTurn <= 0 || g_vars->scene11_swingCounter - g_vars->scene11_swingCounterPrevTurn <= 72) {
- } else {
+ if (g_vars->scene11_arcadeIsOn) {
+ if (g_vars->scene11_swingCounterPrevTurn > 0 && g_vars->scene11_swingCounter - g_vars->scene11_swingCounterPrevTurn > 72) {
sceneHandler11_swing0();
g_vars->scene11_swingDirectionPrevTurn = 0;
g_vars->scene11_swingCounterPrevTurn = 0;
}
+ }
- if (!g_vars->scene11_arcadeIsOn)
- goto LABEL_50;
-
- if (g_vars->scene11_swingDirection == g_vars->scene11_swingDirectionPrevTurn || g_vars->scene11_swingCounterPrevTurn <= 0 || g_vars->scene11_swingCounter - g_vars->scene11_swingCounterPrevTurn <= 2) {
- LABEL_49:
- if (g_vars->scene11_arcadeIsOn) {
- g_fp->_behaviorManager->updateBehaviors();
- g_fp->startSceneTrack();
- return res;
- }
- LABEL_50:
- if (g_vars->scene11_swingIsSwinging
- || (0.0 == g_vars->scene11_swingSpeed
- && g_vars->scene11_dudeOnSwing->_movement != 0
- && g_vars->scene11_dudeOnSwing->_movement->_currDynamicPhaseIndex == 45
- && (g_vars->scene11_dudeOnSwing->changeStatics2(ST_KCH_STATIC), !g_vars->scene11_arcadeIsOn)
- && g_vars->scene11_swingIsSwinging)) {
- if (!g_vars->scene11_swingie->_movement) {
- if ((g_vars->scene11_boots->_flags & 4) && g_vars->scene11_boots->_statics->_staticsId == ST_BTS11_2) {
- sceneHandler11_swingieJumpDown();
-
- g_fp->_behaviorManager->updateBehaviors();
- g_fp->startSceneTrack();
- return res;
- }
- g_vars->scene11_swingie->startAnim(MV_SWR_SWING, 0, -1);
- }
+ if (g_vars->scene11_arcadeIsOn) {
+ if (g_vars->scene11_swingDirection != g_vars->scene11_swingDirectionPrevTurn
+ && g_vars->scene11_swingCounterPrevTurn > 0 && g_vars->scene11_swingCounter - g_vars->scene11_swingCounterPrevTurn > 2) {
+
+ if (g_vars->scene11_swingDirectionPrevTurn == 1) {
+ if (g_vars->scene11_swingDirection == 0)
+ sceneHandler11_swing1();
+ else
+ sceneHandler11_swing0();
+ } else if (g_vars->scene11_swingDirectionPrevTurn == 2) {
+ if (g_vars->scene11_swingDirection == 0)
+ sceneHandler11_swing2();
+ else
+ sceneHandler11_swing0();
}
- g_fp->_behaviorManager->updateBehaviors();
- g_fp->startSceneTrack();
- return res;
- }
- if (g_vars->scene11_swingDirectionPrevTurn == 1) {
- if (!g_vars->scene11_swingDirection)
- sceneHandler11_swing1();
- else
- sceneHandler11_swing0();
- } else if (g_vars->scene11_swingDirectionPrevTurn == 2) {
- if (!g_vars->scene11_swingDirection)
- sceneHandler11_swing2();
- else
- sceneHandler11_swing0();
+ g_vars->scene11_swingCounterPrevTurn = g_vars->scene11_swingCounter;
}
+ }
- g_vars->scene11_swingCounterPrevTurn = g_vars->scene11_swingCounter;
- goto LABEL_49;
+ if (!g_vars->scene11_arcadeIsOn && !g_vars->scene11_swingIsSwinging) {
+ if (g_vars->scene11_swingSpeed == 0.0
+ && g_vars->scene11_dudeOnSwing->_movement && g_vars->scene11_dudeOnSwing->_movement->_currDynamicPhaseIndex == 45) {
+ g_vars->scene11_dudeOnSwing->changeStatics2(ST_KCH_STATIC);
+ }
}
- if (x >= g_fp->_sceneRect.left + 200) {
- if (x <= g_fp->_sceneRect.right - 200) {
- LABEL_18:
- if (y < g_fp->_sceneRect.top + 200) {
- g_fp->_currentScene->_y = y - g_fp->_sceneRect.top - 300;
- y = g_vars->scene11_dudeY;
- x = g_vars->scene11_dudeX;
- }
- if (y > g_fp->_sceneRect.bottom - 300) {
- g_fp->_currentScene->_y = y - g_fp->_sceneRect.bottom + 300;
- x = g_vars->scene11_dudeX;
- }
- if (x >= 940)
- g_vars->scene11_scrollIsMaximized = true;
- goto LABEL_26;
+
+ if (!g_vars->scene11_arcadeIsOn && g_vars->scene11_swingIsSwinging) {
+ if (!g_vars->scene11_swingie->_movement) {
+ if ((g_vars->scene11_boots->_flags & 4) && g_vars->scene11_boots->_statics->_staticsId == ST_BTS11_2)
+ sceneHandler11_swingieJumpDown();
+ else
+ g_vars->scene11_swingie->startAnim(MV_SWR_SWING, 0, -1);
}
- g_fp->_currentScene->_x = x - g_fp->_sceneRect.right + 300;
- } else {
- g_fp->_currentScene->_x = x - g_fp->_sceneRect.left - 300;
}
- y = g_vars->scene11_dudeY;
- x = g_vars->scene11_dudeX;
- goto LABEL_18;
- }
- break;
+ g_fp->_behaviorManager->updateBehaviors();
+ g_fp->startSceneTrack();
+ return res;
+ }
case 29:
if (g_vars->scene11_swingIsSwinging) {
@@ -753,14 +737,16 @@ int sceneHandler11(ExCommand *cmd) {
&& cmd->_param == ANI_INV_BOOT)
sceneHandler11_putBoot();
} else {
- if (g_vars->scene11_arcadeIsOn) {
- sceneHandler11_setSwingDirection();
+ if (!g_vars->scene11_arcadeIsOn)
+ goto LABEL_69;
- g_vars->scene11_swingCounterPrevTurn = g_vars->scene11_swingCounter;
- }
+ sceneHandler11_setSwingDirection();
+
+ g_vars->scene11_swingCounterPrevTurn = g_vars->scene11_swingCounter;
}
if (!g_vars->scene11_arcadeIsOn) {
+ LABEL_69:
StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
if (!ani || !canInteractAny(g_fp->_aniMan, ani, cmd->_param)) {
diff --git a/engines/fullpipe/scenes/scene13.cpp b/engines/fullpipe/scenes/scene13.cpp
index 9908b9a7c9..12fe1dd35d 100644
--- a/engines/fullpipe/scenes/scene13.cpp
+++ b/engines/fullpipe/scenes/scene13.cpp
@@ -36,6 +36,10 @@
namespace Fullpipe {
+void scene13_whirlgigCallback(int *phase) {
+ // Do nothing
+}
+
void scene13_initScene(Scene *sc) {
g_vars->scene13_whirlgig = sc->getStaticANIObject1ById(ANI_WHIRLGIG_13, -1);
g_vars->scene13_guard = sc->getStaticANIObject1ById(ANI_STOROZH, -1);
@@ -63,7 +67,7 @@ void scene13_initScene(Scene *sc) {
lnk->_flags &= 0xDFFFFFFF;
g_vars->scene13_whirlgig->stopAnim_maybe();
- g_vars->scene13_whirlgig->_callback2 = 0;
+ g_vars->scene13_whirlgig->_callback2 = scene13_whirlgigCallback;
g_vars->scene13_whirlgig->startAnim(MV_WHR13_SPIN, 0, -1);
if (g_vars->scene13_whirlgig->_movement)
@@ -155,7 +159,7 @@ void sceneHandler13_closeFast() {
}
void sceneHandler13_stopWhirlgig() {
- g_vars->scene13_whirlgig->_callback2 = 0;
+ g_vars->scene13_whirlgig->_callback2 = scene13_whirlgigCallback;
g_fp->stopAllSoundInstances(SND_13_018);
g_fp->playSound(SND_13_033, 0);
diff --git a/engines/fullpipe/scenes/scene14.cpp b/engines/fullpipe/scenes/scene14.cpp
index f6841a8bbe..977f3d95ac 100644
--- a/engines/fullpipe/scenes/scene14.cpp
+++ b/engines/fullpipe/scenes/scene14.cpp
@@ -306,7 +306,7 @@ void sceneHandler14_endArcade() {
void sceneHandler14_winArcade() {
if (g_vars->scene14_arcadeIsOn) {
if (g_vars->scene14_dudeIsKicking) {
- g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000);
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT | 0x4000);
g_vars->scene14_dudeIsKicking = false;
}
@@ -424,7 +424,7 @@ void sceneHandler14_dudeDecline() {
g_vars->scene14_mouseCursorPos.y = g_fp->_mouseVirtY;
g_fp->_aniMan->_callback2 = sceneHandler14_declineCallback;
- g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000);
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT | 0x4000);
g_fp->_aniMan->startAnim(MV_MAN14_DECLINE, 0, -1);
g_vars->scene14_dudeIsKicking = true;
@@ -481,7 +481,7 @@ bool sceneHandler14_arcadeProcessClick(ExCommand *cmd) {
void sceneHandler14_grandmaThrow() {
g_vars->scene14_grandma->changeStatics2(ST_GMA_SIT);
- MessageQueue *mq = new MessageQueue;
+ MessageQueue *mq = new MessageQueue(0);
ExCommand *ex = new ExCommand(ANI_GRANDMA, 2, 30, 0, 0, 0, 1, 0, 0, 0);
ex->_excFlags |= 2;
@@ -521,7 +521,7 @@ void sceneHandler14_passToGrandma() {
void sceneHandler14_grandmaJumpThrow() {
g_vars->scene14_grandma->changeStatics2(ST_GMA_SIT);
- MessageQueue *mq = new MessageQueue;
+ MessageQueue *mq = new MessageQueue(0);
ExCommand *ex = new ExCommand(ANI_GRANDMA, 2, 30, 0, 0, 0, 1, 0, 0, 0);
ex->_excFlags |= 2;
@@ -547,7 +547,7 @@ void sceneHandler14_dudeFall() {
if (!g_fp->_aniMan->_movement || g_fp->_aniMan->_movement->_id != MV_MAN14_FALL) {
sceneHandler14_clearCallback();
- g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000);
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT | 0x4000);
g_fp->_aniMan->startAnim(MV_MAN14_FALL, 0, -1);
g_vars->scene14_flyingBall->stopAnim_maybe();
g_vars->scene14_flyingBall->hide();
@@ -558,7 +558,7 @@ void sceneHandler14_dudeFall() {
}
void sceneHandler14_grandmaStepForward() {
- g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000);
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT | 0x4000);
g_fp->_aniMan->startAnim(MV_MAN14_STEPFW, 0, -1);
g_vars->scene14_dude2X -= 71;
@@ -622,17 +622,18 @@ void sceneHandler14_arcadeLogic() {
}
void sceneHandler14_animateBall() {
- int x = g_vars->scene14_ballDeltaX + g_vars->scene14_ballX;
- int y = g_vars->scene14_ballDeltaY + g_vars->scene14_ballY;
-
g_vars->scene14_ballX += g_vars->scene14_ballDeltaX;
g_vars->scene14_ballY += g_vars->scene14_ballDeltaY;
+ int x = g_vars->scene14_ballX;
+ int y = g_vars->scene14_ballY;
+
g_vars->scene14_ballDeltaY++;
- if (g_vars->scene14_ballDeltaY - 1 + g_vars->scene14_ballY > 517) {
- if (x <= g_vars->scene14_dudeX - 16 ) {
- if ( g_vars->scene14_ballDeltaX >= 0 || x >= g_vars->scene14_grandmaX + 65 || x <= g_vars->scene14_grandmaX - 135 || y <= g_vars->scene14_grandmaY - 102 ) {
+ if (g_vars->scene14_ballY <= 517) {
+ if (x <= g_vars->scene14_dudeX - 16) {
+ if (g_vars->scene14_ballDeltaX >= 0 || x >= g_vars->scene14_grandmaX + 65
+ || x <= g_vars->scene14_grandmaX - 135 || y <= g_vars->scene14_grandmaY - 102) {
if (g_vars->scene14_flyingBall->_movement)
g_vars->scene14_flyingBall->_movement->setOXY(x, y);
else
@@ -810,9 +811,7 @@ int sceneHandler14(ExCommand *cmd) {
case 29:
if (g_vars->scene14_arcadeIsOn) {
- uint32 pixel;
-
- if (g_vars->scene14_dudeCanKick && g_fp->_aniMan->getPixelAtPos(cmd->_sceneClickX, cmd->_sceneClickY, &pixel) && !g_fp->_aniMan->_movement) {
+ if (g_vars->scene14_dudeCanKick && g_fp->_aniMan->isPixelHitAtPos(cmd->_sceneClickX, cmd->_sceneClickY) && !g_fp->_aniMan->_movement) {
sceneHandler14_dudeDecline();
break;
}
@@ -832,7 +831,7 @@ int sceneHandler14(ExCommand *cmd) {
if (!pic || !canInteractAny(g_fp->_aniMan, pic, cmd->_param)) {
if ((g_fp->_sceneRect.right - cmd->_sceneClickX < 47 && g_fp->_sceneRect.right < g_fp->_sceneWidth - 1)
- || (cmd->_sceneClickX - g_fp->_sceneRect.left < 47 && g_fp->_sceneRect.left > 0)) {
+ || (cmd->_sceneClickX - g_fp->_sceneRect.left < 47 && g_fp->_sceneRect.left > 0)) {
g_fp->processArcade(cmd);
sceneHandler14_arcadeProcessClick(cmd);
break;
diff --git a/engines/fullpipe/scenes/scene16.cpp b/engines/fullpipe/scenes/scene16.cpp
index 52daef3b8a..b7a63dff46 100644
--- a/engines/fullpipe/scenes/scene16.cpp
+++ b/engines/fullpipe/scenes/scene16.cpp
@@ -65,7 +65,7 @@ void scene16_initScene(Scene *sc) {
idx++;
- if (idx >= 2)
+ if (idx > 1)
idx = 0;
}
@@ -76,7 +76,7 @@ void scene16_initScene(Scene *sc) {
idx++;
- if (idx >= 2)
+ if (idx > 1)
idx = 0;
}
} else {
@@ -460,7 +460,7 @@ int sceneHandler16(ExCommand *cmd) {
if (g_vars->scene16_placeIsOccupied) {
g_vars->scene16_walkingCount++;
- if (g_vars->scene16_walkingCount < 280) {
+ if (g_vars->scene16_walkingCount >= 280) {
sceneHandler16_putOnWheel();
g_vars->scene16_walkingCount = 0;
diff --git a/engines/fullpipe/scenes/scene25.cpp b/engines/fullpipe/scenes/scene25.cpp
index 9bc8f412f1..ec3184a5f4 100644
--- a/engines/fullpipe/scenes/scene25.cpp
+++ b/engines/fullpipe/scenes/scene25.cpp
@@ -101,9 +101,9 @@ int scene25_updateCursor() {
if (g_fp->_objectIdAtCursor == ANI_WATER25) {
if ((g_vars->scene25_boardIsSelectable && (!inv || inv == ANI_INV_BOARD)) || (g_vars->scene25_dudeIsOnBoard && (inv == ANI_INV_LOPAT || !inv)))
- g_fp->_cursorId = (g_fp->_cursorId != PIC_CSR_DEFAULT) ? PIC_CSR_ITN : PIC_CSR_ITN_INV; // FIXME check
+ g_fp->_cursorId = (g_fp->_cursorId != PIC_CSR_DEFAULT) ? PIC_CSR_ITN_INV : PIC_CSR_ITN;
} else if (g_fp->_objectIdAtCursor == ANI_BOARD25 && (!inv || inv == ANI_INV_SWAB || inv == ANI_INV_BROOM || inv == ANI_INV_LOPAT)) {
- g_fp->_cursorId = (g_fp->_cursorId != PIC_CSR_DEFAULT) ? PIC_CSR_ITN : PIC_CSR_ITN_INV;
+ g_fp->_cursorId = (g_fp->_cursorId != PIC_CSR_DEFAULT) ? PIC_CSR_ITN_INV : PIC_CSR_ITN;
}
}
@@ -365,7 +365,7 @@ void sceneHandler25_tryRow(int obj) {
g_fp->_aniMan->getPicAniInfo(&info);
g_fp->_aniMan->_messageQueueId = 0;
- g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000);
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT | 0x4000);
int x = g_fp->_aniMan->_ox;
int y = g_fp->_aniMan->_oy;
@@ -377,12 +377,12 @@ void sceneHandler25_tryRow(int obj) {
if (x == 788 && y == 468) {
if (g_vars->scene25_board->_statics->_staticsId == ST_BRD25_RIGHT2) {
if (obj == ANI_INV_BROOM) {
- g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000);
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT | 0x4000);
qid = QU_SC25_TRYBROOM;
}
if (obj == ANI_INV_LOPAT) {
- g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000);
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT | 0x4000);
qid = QU_SC25_TRYSPADE;
}
@@ -396,18 +396,18 @@ void sceneHandler25_tryRow(int obj) {
}
if (obj == ANI_INV_SWAB) {
- g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000);
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT | 0x4000);
chainQueue(QU_SC25_TRYSWAB, 1);
} else if (!obj) {
- g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000);
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT | 0x4000);
chainObjQueue(g_fp->_aniMan, QU_SC25_TRYHAND, 1);
g_fp->playSound(SND_25_028, 0);
}
- } else if (g_vars->scene25_board->_statics->_staticsId == (ST_MAN_RIGHT|0x4000) && !obj) {
- g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000);
+ } else if (g_vars->scene25_board->_statics->_staticsId == (ST_BRD25_RIGHT2 | 0x4000) && !obj) {
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT | 0x4000);
chainQueue(QU_SC25_TRUBATOBOARD, 1);
@@ -645,7 +645,7 @@ int sceneHandler25(ExCommand *cmd) {
if ((picId == PIC_SC25_LADDERUP || picId == PIC_SC25_LADDERDOWN) && sceneHandler25_isOnLadder(cmd))
cmd->_messageKind = 0;
- break;
+ return 0;
}
StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
@@ -656,23 +656,31 @@ int sceneHandler25(ExCommand *cmd) {
if (!(g_fp->_aniMan->_flags & 0x100)) {
if (ani->_id == ANI_WATER25) {
if (g_vars->scene25_dudeIsOnBoard) {
- if (cmd->_param == ANI_INV_LOPAT)
+ if (cmd->_param == ANI_INV_LOPAT) {
sceneHandler25_rowShovel();
+ return 0;
+ }
- if (!cmd->_param)
+ if (!cmd->_param) {
sceneHandler25_rowHand();
+ return 0;
+ }
} else {
- if (cmd->_param == ANI_INV_BOARD)
+ if (cmd->_param == ANI_INV_BOARD) {
sceneHandler25_putBoard();
+ return 0;
+ }
- if (!cmd->_param)
+ if (!cmd->_param) {
sceneHandler25_tryWater();
+ return 0;
+ }
}
} else if (ani->_id == ANI_BOARD25) {
sceneHandler25_tryRow(cmd->_param);
- break;
+ return 0;
}
- break;
+ return 0;
}
}
}
@@ -682,37 +690,37 @@ int sceneHandler25(ExCommand *cmd) {
cmd->_messageKind = 0;
if (!g_fp->_aniMan->isIdle() || (g_fp->_aniMan->_flags & 0x100))
- break;
+ return 0;
if (g_vars->scene25_dudeIsOnBoard) {
if (picId == PIC_SC25_RTRUBA && !cmd->_param) {
sceneHandler25_enterTruba();
- break;
+ return 0;
}
} else {
if (picId != PIC_SC25_RTRUBA) {
if (picId == PIC_SC25_LADDERUP && !cmd->_param)
sceneHandler25_ladderUp();
- break;
+ return 0;
}
if (!cmd->_param) {
sceneHandler25_backToPipe();
- break;
+ return 0;
}
}
if (g_vars->scene25_dudeIsOnBoard) {
if (picId != PIC_SC25_LADDERUP || cmd->_param)
- break;
+ return 0;
sceneHandler25_toLadder();
- break;
+ return 0;
}
if (picId == PIC_SC25_LADDERUP && !cmd->_param)
sceneHandler25_ladderUp();
- break;
+ return 0;
}
}
diff --git a/engines/fullpipe/scenes/scene26.cpp b/engines/fullpipe/scenes/scene26.cpp
index d183ee9da8..9706bd5927 100644
--- a/engines/fullpipe/scenes/scene26.cpp
+++ b/engines/fullpipe/scenes/scene26.cpp
@@ -94,17 +94,17 @@ void sceneHandler26_showChi() {
}
void sceneHandler26_updatePool() {
- if (g_fp->getObjectState(sO_Valve1_26) == g_fp->getObjectEnumState(sO_Valve1_26, sO_Valve1_26))
+ if (g_fp->getObjectState(sO_Valve1_26) == g_fp->getObjectEnumState(sO_Valve1_26, sO_Opened))
g_fp->setObjectState(sO_Pool, g_fp->getObjectEnumState(sO_Pool, sO_Overfull));
else if (g_fp->getObjectState(sO_Pool) == g_fp->getObjectEnumState(sO_Pool, sO_Overfull))
g_fp->setObjectState(sO_Pool, g_fp->getObjectEnumState(sO_Pool, sO_Full));
- if (g_fp->getObjectState(sO_Valve2_26) == g_fp->getObjectEnumState(sO_Valve2_26, sO_Valve1_26)) {
+ if (g_fp->getObjectState(sO_Valve2_26) == g_fp->getObjectEnumState(sO_Valve2_26, sO_Opened)) {
if (g_fp->getObjectState(sO_Pool) >= g_fp->getObjectEnumState(sO_Pool, sO_Full))
g_fp->setObjectState(sO_Pool, g_fp->getObjectEnumState(sO_Pool, sO_HalfFull));
}
- if (g_fp->getObjectState(sO_Valve3_26) == g_fp->getObjectEnumState(sO_Valve3_26, sO_Valve1_26)) {
+ if (g_fp->getObjectState(sO_Valve3_26) == g_fp->getObjectEnumState(sO_Valve3_26, sO_Opened)) {
if (g_fp->getObjectState(sO_Pool) >= g_fp->getObjectEnumState(sO_Pool, sO_HalfFull))
g_fp->setObjectState(sO_Pool, g_fp->getObjectEnumState(sO_Pool, sO_Empty));
}
@@ -241,7 +241,7 @@ void sceneHandler26_animateVents(StaticANIObject *ani) {
}
if (qId) {
- MessageQueue *mq = g_fp->_currentScene->getMessageQueueById(qId);
+ MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(qId), 0, 0);
mq->setFlags(mq->getFlags() | 1);
mq->chain(0);
@@ -249,7 +249,7 @@ void sceneHandler26_animateVents(StaticANIObject *ani) {
}
void sceneHandler26_clickVent(StaticANIObject *ani, ExCommand *cmd) {
- if (ani->_odelay || g_fp->getObjectState(sO_Hatch_26) == g_fp->getObjectEnumState(sO_Hatch_26, sO_Opened)) {
+ if (ani->_odelay || g_fp->getObjectState(sO_Hatch_26) != g_fp->getObjectEnumState(sO_Hatch_26, sO_Opened)) {
if (g_fp->_aniMan->isIdle() && !(g_fp->_aniMan->_flags & 0x100)) {
g_vars->scene26_activeVent = ani;
diff --git a/engines/fullpipe/scenes/scene27.cpp b/engines/fullpipe/scenes/scene27.cpp
index 17bf3916de..a6ddbab5e3 100644
--- a/engines/fullpipe/scenes/scene27.cpp
+++ b/engines/fullpipe/scenes/scene27.cpp
@@ -53,9 +53,6 @@ void scene27_initScene(Scene *sc) {
g_vars->scene27_maid = sc->getStaticANIObject1ById(ANI_MAID, -1);
g_vars->scene27_batHandler = sc->getStaticANIObject1ById(ANI_BITAHANDLER, -1);
- for (uint i = 0; i < g_vars->scene27_balls.size(); i++)
- delete g_vars->scene27_balls[i];
-
g_vars->scene27_balls.clear();
g_vars->scene27_bats.clear();
g_vars->scene27_var07.clear();
diff --git a/engines/fullpipe/scenes/scene28.cpp b/engines/fullpipe/scenes/scene28.cpp
index b9cdf7ae1c..8d829d7b98 100644
--- a/engines/fullpipe/scenes/scene28.cpp
+++ b/engines/fullpipe/scenes/scene28.cpp
@@ -172,12 +172,12 @@ void sceneHandler28_turnOn2() {
if (g_vars->scene28_fliesArePresent) {
g_fp->_floaters->genFlies(g_fp->_currentScene, 1013, 329, 60, 4);
- g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->val15 = 30;
+ g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->val13 = 30;
g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->countdown = g_fp->_rnd->getRandomNumber(12) + 12;
g_fp->_floaters->genFlies(g_fp->_currentScene, 1074, 311, 60, 4);
- g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->val15 = 30;
+ g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->val13 = 30;
g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->countdown = g_fp->_rnd->getRandomNumber(12) + 12;
}
diff --git a/engines/fullpipe/scenes/scene37.cpp b/engines/fullpipe/scenes/scene37.cpp
index 0e5685f4a9..ba181642df 100644
--- a/engines/fullpipe/scenes/scene37.cpp
+++ b/engines/fullpipe/scenes/scene37.cpp
@@ -52,6 +52,11 @@ void scene37_initScene(Scene *sc) {
Ring *ring;
StaticANIObject *ani;
+ for (uint i = 0; i < g_vars->scene37_rings.size(); i++)
+ delete g_vars->scene37_rings[i];
+
+ g_vars->scene37_rings.clear();
+
g_vars->scene37_lastDudeX = -1;
ring = new Ring();
@@ -96,7 +101,7 @@ void scene37_initScene(Scene *sc) {
g_fp->_currentScene = sc;
- g_vars->scene37_cursorIsLocked = false;
+ g_vars->scene37_pipeIsOpen = false;
g_vars->scene37_plusMinus1 = sc->getStaticANIObject1ById(ANI_PLUSMINUS, 1);
@@ -149,7 +154,7 @@ int scene37_updateCursor() {
g_fp->updateCursorCommon();
if (g_fp->_cursorId == PIC_CSR_ITN && g_fp->_objectIdAtCursor == PIC_SC37_MASK) {
- if (g_vars->scene37_cursorIsLocked)
+ if (g_vars->scene37_pipeIsOpen)
g_fp->_cursorId = PIC_CSR_GOL;
}
@@ -175,20 +180,29 @@ void sceneHandler37_updateRing(int ringNum) {
}
}
- g_vars->scene37_cursorIsLocked = true;
+ g_vars->scene37_pipeIsOpen = true;
+
+ for (uint i = 0; i < g_vars->scene37_rings.size(); i++) {
+ for (int j = 0; j < g_vars->scene37_rings[i]->numSubRings; j++) {
+ ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_RING, g_vars->scene37_rings[i]->subRings[j]);
- for (uint j = 0; j < g_vars->scene37_rings.size(); j++) {
- for (int i = 0; i < g_vars->scene37_rings[ringNum]->numSubRings; i++) {
- ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_RING, g_vars->scene37_rings[j]->subRings[i]);
+ debugC(2, kDebugSceneLogic, "ring[%d][%d]: mov: %d st: %d", i, j, (ani->_movement ? ani->_movement->_id : 0), ani->_statics->_staticsId);
- if ((ani->_movement && ani->_movement->_id != MV_RNG_CLOSE) || ani->_statics->_staticsId != ST_RNG_CLOSED2)
- g_vars->scene37_cursorIsLocked = false;
+ if (ani->_movement) {
+ if (ani->_movement->_id == MV_RNG_CLOSE)
+ g_vars->scene37_pipeIsOpen = false;
+ } else {
+ if (ani->_statics->_staticsId == ST_RNG_CLOSED2)
+ g_vars->scene37_pipeIsOpen = false;
+ }
}
}
+ debugC(1, kDebugSceneLogic, "Pipe is: %s", g_vars->scene37_pipeIsOpen ? "open" : "closed");
+
int state;
- if (g_vars->scene37_cursorIsLocked)
+ if (g_vars->scene37_pipeIsOpen)
state = g_fp->getObjectEnumState(sO_LeftPipe_37, sO_IsOpened);
else
state = g_fp->getObjectEnumState(sO_LeftPipe_37, sO_IsClosed);
diff --git a/engines/fullpipe/statesaver.cpp b/engines/fullpipe/statesaver.cpp
index 509376790d..e582d4b438 100644
--- a/engines/fullpipe/statesaver.cpp
+++ b/engines/fullpipe/statesaver.cpp
@@ -181,6 +181,13 @@ void PicAniInfo::save(MfcArchive &file) {
file.writeUint32LE(someDynamicPhaseIndex);
}
+void PicAniInfo::print() {
+ debug("type: %d objectId: %d field_6: %d field_8: %d", type, objectId, field_6, field_8);
+ debug("sceneId: %d field_E: %d ox: %d oy: %d priority: %d", sceneId, field_E, ox, oy, priority);
+ debug("staticsId: %d movementId: %d dynamicPhaseIndex: %d flags: %x field_24: %d someDynamicPhaseIndex: %d",
+ staticsId, movementId, dynamicPhaseIndex, flags, field_24, someDynamicPhaseIndex);
+}
+
void GameVar::save(MfcArchive &file) {
file.writePascalString(_varName);
file.writeUint32LE(_varType);
diff --git a/engines/gnap/configure.engine b/engines/gnap/configure.engine
index f3742ef0d2..8723ef501b 100644
--- a/engines/gnap/configure.engine
+++ b/engines/gnap/configure.engine
@@ -1,3 +1,3 @@
# This file is included from the main "configure" script
# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
-add_engine gnap "UFOs" no "" "" "highres"
+add_engine gnap "UFOs" yes "" "" "highres"
diff --git a/engines/gnap/detection.cpp b/engines/gnap/detection.cpp
index b1e9818d29..d19d420ff8 100644
--- a/engines/gnap/detection.cpp
+++ b/engines/gnap/detection.cpp
@@ -43,7 +43,7 @@ static const ADGameDescription gameDescriptions[] = {
{"stock_n.dat", 0, "46819043d019a2f36b727cc2bdd6980f", 12515823},
AD_LISTEND
},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_TESTING, GUIO0()
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_NO_FLAGS, GUIO0()
},
{
"gnap", "",
@@ -51,7 +51,7 @@ static const ADGameDescription gameDescriptions[] = {
{"stock_n.dat", 0, "46819043d019a2f36b727cc2bdd6980f", 13497301},
AD_LISTEND
},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_TESTING, GUIO0()
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_NO_FLAGS, GUIO0()
},
{
"gnap", "",
@@ -59,7 +59,7 @@ static const ADGameDescription gameDescriptions[] = {
{"stock_n.dat", 0, "46819043d019a2f36b727cc2bdd6980f", 12995485},
AD_LISTEND
},
- Common::RU_RUS, Common::kPlatformWindows, ADGF_TESTING, GUIO0()
+ Common::RU_RUS, Common::kPlatformWindows, ADGF_NO_FLAGS, GUIO0()
},
{
"gnap", "Fargus",
@@ -67,7 +67,7 @@ static const ADGameDescription gameDescriptions[] = {
{"stock_n.dat", 0, "46819043d019a2f36b727cc2bdd6980f", 12847726},
AD_LISTEND
},
- Common::RU_RUS, Common::kPlatformWindows, ADGF_TESTING, GUIO0()
+ Common::RU_RUS, Common::kPlatformWindows, ADGF_NO_FLAGS, GUIO0()
},
AD_TABLE_END_MARKER
diff --git a/engines/gnap/fontdata.h b/engines/gnap/fontdata.h
index 61128211fc..0631d1d214 100644
--- a/engines/gnap/fontdata.h
+++ b/engines/gnap/fontdata.h
@@ -32,7 +32,7 @@ struct FONT_CHAR_INFO {
FONT_CHAR_INFO(byte width, uint16 offset) : _width(width), _offset(offset) {}
};
-/*
+/*
** Font data for DejaVu Sans 9pt
*/
diff --git a/engines/gnap/gamesys.h b/engines/gnap/gamesys.h
index b9752bde06..789789e5e7 100644
--- a/engines/gnap/gamesys.h
+++ b/engines/gnap/gamesys.h
@@ -168,7 +168,7 @@ public:
int32 _gameSysClock, _lastUpdateClock;
bool _animationsDone;
-
+
Graphics::Surface *_backgroundSurface;
Graphics::Surface *_frontSurface;
diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp
index 47fdaacf7a..eaeb64a64d 100644
--- a/engines/groovie/script.cpp
+++ b/engines/groovie/script.cpp
@@ -1681,7 +1681,7 @@ void Script::o2_copyscreentobg() {
// TODO: Parameter
if (val)
warning("o2_copyscreentobg: Param is %d", val);
-
+
Graphics::Surface *screen = _vm->_system->lockScreen();
_vm->_graphicsMan->_background.copyFrom(screen->getSubArea(Common::Rect(0, 80, 640, 320)));
_vm->_system->unlockScreen();
diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp
index 4f0a0da777..11a64114b5 100644
--- a/engines/lab/engine.cpp
+++ b/engines/lab/engine.cpp
@@ -379,7 +379,7 @@ void LabEngine::decIncInv(uint16 *curInv, bool decreaseFl) {
newInv = 1;
interfaceOff();
-
+
while (newInv && (newInv <= _numInv)) {
if (_conditions->in(newInv) && !_inventory[newInv]._bitmapName.empty()) {
_nextFileName = getInvName(newInv);
diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp
index 0a603f7691..62e1f75202 100644
--- a/engines/lab/eventman.cpp
+++ b/engines/lab/eventman.cpp
@@ -151,7 +151,7 @@ IntuiMessage *EventManager::getMsg() {
message._msgClass = kMessageButtonUp;
message._code = lastButtonHit->_buttonId;
message._qualifier = _keyPressed.flags;
-
+
return &message;
} else
return nullptr;
diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp
index 68e6e63c1d..58b7e253f1 100644
--- a/engines/lab/processroom.cpp
+++ b/engines/lab/processroom.cpp
@@ -267,7 +267,7 @@ void LabEngine::doActions(const ActionList &actionList) {
// Puts a file into memory
_graphics->loadPict(action->_messages[0]);
break;
-
+
case kActionLoadBitmap:
error("Unused opcode kActionLoadBitmap has been called");
diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp
index 9cb35d1088..44d3caaf43 100644
--- a/engines/lab/resource.cpp
+++ b/engines/lab/resource.cpp
@@ -147,7 +147,7 @@ void Resource::readViews(uint16 roomNum) {
Common::String Resource::translateFileName(const Common::String filename) {
Common::String upperFilename;
- // The DOS and Windows version aren't looking for the right file,
+ // The DOS and Windows version aren't looking for the right file,
if (!filename.compareToIgnoreCase("P:ZigInt/BLK") && (_vm->getPlatform() != Common::kPlatformAmiga))
upperFilename = "P:ZigInt/ZIGINT.BLK";
else
diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp
index 7c3cb39931..577384f99a 100644
--- a/engines/lab/special.cpp
+++ b/engines/lab/special.cpp
@@ -397,7 +397,7 @@ void LabEngine::processMonitor(const Common::String &ntext, TextFont *monitorFon
// Exit button
return;
}
-
+
if (mouseX <= _utils->vgaScaleX(59)) {
// Back button
if (isInteractive) {
diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp
index 9e0a6e9f00..3b7c3a244b 100644
--- a/engines/macventure/gui.cpp
+++ b/engines/macventure/gui.cpp
@@ -33,6 +33,7 @@
#include "common/debug-channels.h"
#include "common/debug.h"
#include "image/bmp.h"
+#include "graphics/macgui/macfontmanager.h"
#include "macventure/gui.h"
#include "macventure/dialog.h"
@@ -266,7 +267,7 @@ const WindowData &Gui::getWindowData(WindowReference reference) {
}
const Graphics::Font &Gui::getCurrentFont() {
- return *_wm.getFont("Chicago-12", Graphics::FontManager::kBigGUIFont);
+ return *_wm._fontMan->getFont(Graphics::MacFont(Graphics::kMacFontChicago, 12));
}
void Gui::bringToFront(WindowReference winID) {
diff --git a/engines/made/screenfx.cpp b/engines/made/screenfx.cpp
index bae59f05cc..3452f44480 100644
--- a/engines/made/screenfx.cpp
+++ b/engines/made/screenfx.cpp
@@ -51,7 +51,7 @@ ScreenEffects::ScreenEffects(Screen *screen) : _screen(screen) {
vfxHeight = 0;
_fxPalette = new byte[768];
-
+
_blendedPaletteStatus._active = false;
_blendedPaletteStatus._palette = _blendedPaletteStatus._newPalette = nullptr;
_blendedPaletteStatus._colorCount = 0;
diff --git a/engines/mads/camera.cpp b/engines/mads/camera.cpp
index c9b2f1429e..eb5942842a 100644
--- a/engines/mads/camera.cpp
+++ b/engines/mads/camera.cpp
@@ -148,7 +148,7 @@ bool Camera::camPan(int16 *picture_view, int16 *player_loc, int display_size, in
if (_direction < 0)
newTarget -= _distOffCenter;
- else
+ else
newTarget += _distOffCenter;
newTarget = MAX(0, newTarget);
diff --git a/engines/mads/conversations.cpp b/engines/mads/conversations.cpp
index 469aaedb81..e5c90768da 100644
--- a/engines/mads/conversations.cpp
+++ b/engines/mads/conversations.cpp
@@ -72,7 +72,7 @@ void GameConversations::load(int id) {
_conversations[slotIndex]._convId = id;
// Load the conversation data
- Common::String cnvFilename = Common::String::format("CONV%03d.CNV", id);
+ Common::String cnvFilename = Common::String::format("CONV%03d.CNV", id);
_conversations[slotIndex]._data.load(cnvFilename);
// Load the conversation's CND data
@@ -371,7 +371,7 @@ void GameConversations::update(bool flag) {
_personSpeaking = 0;
executeEntry(_verbId);
generateMessage(_runningConv->_cnd._messageList1, _runningConv->_cnd._messageList3);
-
+
if (_heroTrigger && _popupVisible) {
_vm->_game->_scene._action._activeAction._verbId = _verbId;
_vm->_game->_trigger = _heroTrigger;
@@ -438,7 +438,7 @@ void GameConversations::generateMessage(Common::Array<int> &messageList, Common:
// Create the new text dialog
_dialog = new TextDialog(_vm, FONT_INTERFACE,
- Common::Point(_popupX[_personSpeaking], _popupY[_personSpeaking]),
+ Common::Point(_popupX[_personSpeaking], _popupY[_personSpeaking]),
portrait, _popupMaxLen[_personSpeaking]);
// Add in the lines
@@ -785,7 +785,7 @@ void ConversationConditionals::load(const Common::String &filename) {
// **** Section: Imports *************************************************
int streamNum = 1;
-
+
_importVariables.resize(importsCount);
if (importsCount > 0) {
convFile = convFileUnpacked.getItemStream(streamNum++);
@@ -848,7 +848,7 @@ void DialogScript::load(Common::SeekableReadStream &s, uint startingOffset) {
instructionOffsets[startingOffset + s.pos()] = size();
push_back(ScriptEntry());
ScriptEntry &se = (*this)[size() - 1];
-
+
// Load the instruction
se.load(s);
}
diff --git a/engines/mads/conversations.h b/engines/mads/conversations.h
index 7b7d3485ef..57e89964a5 100644
--- a/engines/mads/conversations.h
+++ b/engines/mads/conversations.h
@@ -172,7 +172,7 @@ struct ScriptEntry {
DialogCommand _command;
Conditional _conditionals[3];
-
+
// Extra parameters for different opcodes
int _index;
Common::Array<int> _entries;
@@ -338,7 +338,7 @@ private:
int _personSpeaking;
TextDialog *_dialog;
bool _dialogAltFlag;
-
+
/**
* Returns the record for the specified conversation, if it's loaded
*/
@@ -435,7 +435,7 @@ public:
* Set the hero trigger
*/
void setHeroTrigger(int val);
-
+
/**
* Set the interlocutor trigger
*/
@@ -473,7 +473,7 @@ public:
void exportValue(int val);
void reset(int id);
-
+
/**
* Handles updating the conversation display
*/
diff --git a/engines/mads/nebular/menu_nebular.h b/engines/mads/nebular/menu_nebular.h
index 8a0cc3575d..d44b5f2022 100644
--- a/engines/mads/nebular/menu_nebular.h
+++ b/engines/mads/nebular/menu_nebular.h
@@ -35,7 +35,7 @@ class MADSEngine;
namespace Nebular {
-enum MADSGameAction {
+enum MADSGameAction {
START_GAME, RESUME_GAME, SHOW_INTRO, CREDITS, QUOTES, EXIT,
SETS, EVOLVE
};
diff --git a/engines/mads/nebular/sound_nebular.cpp b/engines/mads/nebular/sound_nebular.cpp
index 5f71c99a94..15dd44a4af 100644
--- a/engines/mads/nebular/sound_nebular.cpp
+++ b/engines/mads/nebular/sound_nebular.cpp
@@ -194,7 +194,7 @@ ASound::ASound(Audio::Mixer *mixer, OPL::OPL *opl, const Common::String &filenam
_channelData[i]._freqBase = 0;
_channelData[i]._field6 = 0;
}
-
+
for (int i = 0; i < ADLIB_CHANNEL_COUNT; ++i)
_channels[i]._owner = this;
diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp
index 0940e79562..f1fe7eaf59 100644
--- a/engines/mads/player.cpp
+++ b/engines/mads/player.cpp
@@ -320,11 +320,11 @@ void Player::activateTrigger() {
_commandsAllowed |= _enableAtTarget;
_enableAtTarget = false;
-
+
if (_walkTrigger) {
game._trigger = _walkTrigger;
game._triggerMode = SEQUENCE_TRIGGER_DAEMON;
-
+
if (game._triggerMode != SEQUENCE_TRIGGER_DAEMON) {
action._activeAction = _walkTriggerAction;
}
diff --git a/engines/mads/screen.h b/engines/mads/screen.h
index eeb15453f8..15436942fe 100644
--- a/engines/mads/screen.h
+++ b/engines/mads/screen.h
@@ -254,7 +254,7 @@ public:
/**
* Return the current drawing/clip area
*/
- const Common::Rect getClipBounds() const {
+ const Common::Rect getClipBounds() const {
const Common::Point pt = getOffsetFromOwner();
return Common::Rect(pt.x, pt.y, pt.x + this->w, pt.y + this->h);
}
diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp
index 204f71fe43..adde5fc67c 100644
--- a/engines/mads/user_interface.cpp
+++ b/engines/mads/user_interface.cpp
@@ -339,7 +339,7 @@ UserInterface::UserInterface(MADSEngine *vm) : _vm(vm), _dirtyAreas(vm),
Common::fill(&_categoryIndexes[0], &_categoryIndexes[7], 0);
// Map the user interface to the bottom of the game's screen surface
- create(*_vm->_screen, Common::Rect(0, MADS_SCENE_HEIGHT, MADS_SCREEN_WIDTH,
+ create(*_vm->_screen, Common::Rect(0, MADS_SCENE_HEIGHT, MADS_SCREEN_WIDTH,
MADS_SCREEN_HEIGHT));
_surface.create(MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT);
diff --git a/engines/mohawk/POTFILES b/engines/mohawk/POTFILES
index 036059da6a..ced02735c7 100644
--- a/engines/mohawk/POTFILES
+++ b/engines/mohawk/POTFILES
@@ -2,3 +2,4 @@ engines/mohawk/detection.cpp
engines/mohawk/dialogs.cpp
engines/mohawk/myst.cpp
engines/mohawk/riven.cpp
+engines/mohawk/mohawk.cpp
diff --git a/engines/mohawk/detection_tables.h b/engines/mohawk/detection_tables.h
index f481472bae..2636cc4434 100644
--- a/engines/mohawk/detection_tables.h
+++ b/engines/mohawk/detection_tables.h
@@ -40,7 +40,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("MYST.DAT", "ae3258c9c90128d274aa6a790b3ad181"),
Common::EN_ANY,
Common::kPlatformWindows,
- ADGF_TESTING,
+ ADGF_NO_FLAGS,
GUI_OPTIONS_MYST
},
GType_MYST,
@@ -58,7 +58,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("DEMO.DAT", "c39303dd53fb5c4e7f3c23231c606cd0"),
Common::EN_ANY,
Common::kPlatformWindows,
- ADGF_DEMO | ADGF_TESTING,
+ ADGF_DEMO | ADGF_NO_FLAGS,
GUI_OPTIONS_MYST_DEMO
},
GType_MYST,
@@ -76,7 +76,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("MYST.DAT", "4beb3366ed3f3b9bfb6e81a14a43bdcc"),
Common::DE_DEU,
Common::kPlatformWindows,
- ADGF_TESTING,
+ ADGF_NO_FLAGS,
GUI_OPTIONS_MYST
},
GType_MYST,
@@ -94,7 +94,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("MYST.DAT", "e0937cca1ab125e48e30dc3cd5046ddf"),
Common::DE_DEU,
Common::kPlatformWindows,
- ADGF_TESTING,
+ ADGF_NO_FLAGS,
GUI_OPTIONS_MYST
},
GType_MYST,
@@ -112,7 +112,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("MYST.DAT", "f7e7d7ca69934f1351b5acd4fe4d44c2"),
Common::ES_ESP,
Common::kPlatformWindows,
- ADGF_TESTING,
+ ADGF_NO_FLAGS,
GUI_OPTIONS_MYST
},
GType_MYST,
@@ -130,7 +130,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("MYST.DAT", "a5795ce1751fc42525e4f9a1859181d5"),
Common::IT_ITA,
Common::kPlatformWindows,
- ADGF_TESTING,
+ ADGF_NO_FLAGS,
GUI_OPTIONS_MYST
},
GType_MYST,
@@ -148,7 +148,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("MYST.DAT", "032c88e3b7e8db4ca475e7b7db9a66bb"),
Common::JA_JPN,
Common::kPlatformWindows,
- ADGF_TESTING,
+ ADGF_NO_FLAGS,
GUI_OPTIONS_MYST
},
GType_MYST,
@@ -166,7 +166,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("MYST.DAT", "d631d42567a941c67c78f2e491f4ea58"),
Common::FR_FRA,
Common::kPlatformWindows,
- ADGF_TESTING,
+ ADGF_NO_FLAGS,
GUI_OPTIONS_MYST
},
GType_MYST,
@@ -184,7 +184,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("MAKING.DAT", "f6387e8f0f7b8a3e42c95294315d6a0e"),
Common::EN_ANY,
Common::kPlatformWindows,
- ADGF_TESTING,
+ ADGF_NO_FLAGS,
GUI_OPTIONS_MYST_MAKING_OF
},
GType_MAKINGOF,
@@ -202,7 +202,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("MAKING.DAT", "03ff62607e64419ab2b6ebf7b7bcdf63"),
Common::JA_JPN,
Common::kPlatformWindows,
- ADGF_TESTING,
+ ADGF_NO_FLAGS,
GUI_OPTIONS_MYST_MAKING_OF
},
GType_MAKINGOF,
@@ -220,7 +220,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("MYST.DAT", "c4cae9f143b5947262e6cb2397e1617e"),
Common::EN_ANY,
Common::kPlatformWindows,
- ADGF_TESTING,
+ ADGF_NO_FLAGS,
GUI_OPTIONS_MYST_ME
},
GType_MYST,
@@ -238,7 +238,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("MYST.DAT", "f88e0ace66dbca78eebdaaa1d3314ceb"),
Common::DE_DEU,
Common::kPlatformWindows,
- ADGF_TESTING,
+ ADGF_NO_FLAGS,
GUI_OPTIONS_MYST_ME
},
GType_MYST,
@@ -256,7 +256,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("MYST.DAT", "aea81633b2d2ae498f09072fb87263b6"),
Common::FR_FRA,
Common::kPlatformWindows,
- ADGF_TESTING,
+ ADGF_NO_FLAGS,
GUI_OPTIONS_MYST_ME
},
GType_MYST,
@@ -274,7 +274,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("MYST.DAT", "4a05771b60f4a69869838d01e85c9e80"),
Common::PL_POL,
Common::kPlatformWindows,
- ADGF_TESTING,
+ ADGF_NO_FLAGS,
GUI_OPTIONS_MYST_ME
},
GType_MYST,
@@ -2754,7 +2754,7 @@ static const MohawkGameDescription fallbackDescs[] = {
AD_ENTRY1(0, 0),
Common::UNK_LANG,
Common::kPlatformWindows,
- ADGF_TESTING,
+ ADGF_NO_FLAGS,
GUI_OPTIONS_MYST
},
GType_MYST,
@@ -2769,7 +2769,7 @@ static const MohawkGameDescription fallbackDescs[] = {
AD_ENTRY1(0, 0),
Common::UNK_LANG,
Common::kPlatformWindows,
- ADGF_TESTING,
+ ADGF_NO_FLAGS,
GUI_OPTIONS_MYST_MAKING_OF
},
GType_MAKINGOF,
@@ -2784,7 +2784,7 @@ static const MohawkGameDescription fallbackDescs[] = {
AD_ENTRY1(0, 0),
Common::UNK_LANG,
Common::kPlatformWindows,
- ADGF_TESTING,
+ ADGF_NO_FLAGS,
GUI_OPTIONS_MYST_ME
},
GType_MYST,
diff --git a/engines/mohawk/dialogs.h b/engines/mohawk/dialogs.h
index 99db641948..443f2fb67e 100644
--- a/engines/mohawk/dialogs.h
+++ b/engines/mohawk/dialogs.h
@@ -81,7 +81,7 @@ public:
virtual void open() override;
virtual void reflowLayout() override;
virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
-
+
int getLoadSlot() const {return _loadSlot;}
private:
@@ -92,7 +92,7 @@ private:
GUI::SaveLoadChooser *_loadDialog;
GUI::SaveLoadChooser *_saveDialog;
-
+
int _loadSlot;
void save();
diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp
index 579e3792b3..6ee18d1576 100644
--- a/engines/mohawk/livingbooks.cpp
+++ b/engines/mohawk/livingbooks.cpp
@@ -3889,7 +3889,7 @@ bool LBMiniGameItem::togglePlaying(bool playing, bool restart) {
// Go back to the menu if requested, otherwise go to the requested page
if (returnToMenu)
_vm->addNotifyEvent(NotifyEvent(kLBNotifyGoToControls, 1));
- else
+ else
_vm->addNotifyEvent(NotifyEvent(kLBNotifyChangePage, destPage));
return false;
diff --git a/engines/mohawk/mohawk.cpp b/engines/mohawk/mohawk.cpp
index b38409f9f1..40290d4e4c 100644
--- a/engines/mohawk/mohawk.cpp
+++ b/engines/mohawk/mohawk.cpp
@@ -24,6 +24,7 @@
#include "common/error.h"
#include "common/system.h"
#include "common/textconsole.h"
+#include "common/translation.h"
#include "mohawk/mohawk.h"
#include "mohawk/cursors.h"
@@ -57,7 +58,7 @@ MohawkEngine::~MohawkEngine() {
Common::Error MohawkEngine::run() {
_video = new VideoManager(this);
- _pauseDialog = new PauseDialog(this, "The game is paused. Press any key to continue.");
+ _pauseDialog = new PauseDialog(this, _("The game is paused. Press any key to continue."));
return Common::kNoError;
}
diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp
index ffab55fa1f..f9ba6a42fa 100644
--- a/engines/mohawk/myst_stacks/myst.cpp
+++ b/engines/mohawk/myst_stacks/myst.cpp
@@ -3609,7 +3609,7 @@ void Myst::gullsFly2_run() {
VideoHandle handle = _vm->_video->playMovie(_vm->wrapMovieFilename(gulls[video], kMystStack));
if (!handle)
error("Failed to open gulls movie");
-
+
handle->moveTo(424, 0);
_gullsNextTime = time + _vm->_rnd->getRandomNumber(16667) + 13334;
}
diff --git a/engines/mohawk/riven_sound.h b/engines/mohawk/riven_sound.h
index f673d1ee3f..c79ccc3e3a 100644
--- a/engines/mohawk/riven_sound.h
+++ b/engines/mohawk/riven_sound.h
@@ -70,7 +70,7 @@ public:
/**
* Play an effect sound
- *
+ *
* @param id Sound ID in the stack
* @param volume Playback volume, between 0 and 255
* @param playOnDraw Start playing when the current card is drawn instead of immediatly
diff --git a/engines/mohawk/video.h b/engines/mohawk/video.h
index d0edab9def..e2b09b6afd 100644
--- a/engines/mohawk/video.h
+++ b/engines/mohawk/video.h
@@ -346,7 +346,7 @@ private:
// Utility functions for managing entries
VideoEntryPtr open(uint16 id);
VideoEntryPtr open(const Common::String &fileName);
-
+
VideoList::iterator findEntry(VideoEntryPtr ptr);
void removeEntry(VideoEntryPtr ptr);
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index b20ed3f8be..8737c8b954 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -675,7 +675,7 @@ bool Console::cmdRegisters(int argc, const char **argv) {
bool Console::parseResourceNumber36(const char *userParameter, uint16 &resourceNumber, uint32 &resourceTuple) {
int userParameterLen = strlen(userParameter);
-
+
if (userParameterLen != 10) {
debugPrintf("Audio36/Sync36 resource numbers must be specified as RRRNNVVCCS\n");
debugPrintf("where RRR is the resource number/map\n");
@@ -760,7 +760,7 @@ void Console::cmdDiskDumpWorker(ResourceType resourceType, int resourceNumber, u
ResourceId resourceId;
Resource *resource = NULL;
char outFileName[50];
-
+
switch (resourceType) {
case kResourceTypeAudio36:
case kResourceTypeSync36: {
@@ -877,7 +877,7 @@ bool Console::cmdList(int argc, const char **argv) {
currentMap = map;
displayCount = 0;
}
-
+
if (displayCount % 3 == 0)
debugPrintf(" ");
@@ -2075,10 +2075,6 @@ bool Console::cmdPrintSegmentTable(int argc, const char **argv) {
debugPrintf("A SCI32 arrays (%d)", (*(ArrayTable *)mobj).entries_used);
break;
- case SEG_TYPE_STRING:
- debugPrintf("T SCI32 strings (%d)", (*(StringTable *)mobj).entries_used);
- break;
-
case SEG_TYPE_BITMAP:
debugPrintf("T SCI32 bitmaps (%d)", (*(BitmapTable *)mobj).entries_used);
break;
@@ -2179,7 +2175,7 @@ bool Console::segmentInfo(int nr) {
for (uint i = 0; i < lt.size(); i++)
if (lt.isValidEntry(i)) {
debugPrintf(" [%04x]: ", i);
- printList(&lt[i]);
+ printList(lt[i]);
}
}
break;
@@ -2210,9 +2206,6 @@ bool Console::segmentInfo(int nr) {
break;
#ifdef ENABLE_SCI32
- case SEG_TYPE_STRING:
- debugPrintf("SCI32 strings\n");
- break;
case SEG_TYPE_ARRAY:
debugPrintf("SCI32 arrays\n");
break;
@@ -2786,16 +2779,8 @@ bool Console::cmdViewReference(int argc, const char **argv) {
switch (type) {
case 0:
break;
- case SIG_TYPE_LIST: {
- List *list = _engine->_gamestate->_segMan->lookupList(reg);
-
- debugPrintf("list\n");
-
- if (list)
- printList(list);
- else
- debugPrintf("Invalid list.\n");
- }
+ case SIG_TYPE_LIST:
+ printList(reg);
break;
case SIG_TYPE_NODE:
debugPrintf("list node\n");
@@ -2808,22 +2793,12 @@ bool Console::cmdViewReference(int argc, const char **argv) {
case SIG_TYPE_REFERENCE: {
switch (_engine->_gamestate->_segMan->getSegmentType(reg.getSegment())) {
#ifdef ENABLE_SCI32
- case SEG_TYPE_STRING: {
- debugPrintf("SCI32 string\n");
- const SciString *str = _engine->_gamestate->_segMan->lookupString(reg);
- Common::hexdump((const byte *) str->getRawData(), str->getSize(), 16, 0);
- break;
- }
case SEG_TYPE_ARRAY: {
- debugPrintf("SCI32 array:\n");
- const SciArray<reg_t> *array = _engine->_gamestate->_segMan->lookupArray(reg);
- hexDumpReg(array->getRawData(), array->getSize(), 4, 0, true);
+ printArray(reg);
break;
}
case SEG_TYPE_BITMAP: {
- debugPrintf("SCI32 bitmap:\n");
- const SciBitmap *bitmap = _engine->_gamestate->_segMan->lookupBitmap(reg);
- Common::hexdump((const byte *) bitmap->getRawData(), bitmap->getRawSize(), 16, 0);
+ printBitmap(reg);
break;
}
#endif
@@ -2919,7 +2894,7 @@ bool Console::cmdScriptObjects(int argc, const char **argv) {
debugPrintf("<script number> may be * to show objects inside all loaded scripts\n");
return true;
}
-
+
if (strcmp(argv[1], "*") == 0) {
// get said-strings of all currently loaded scripts
curScriptNr = -1;
@@ -2941,7 +2916,7 @@ bool Console::cmdScriptStrings(int argc, const char **argv) {
debugPrintf("<script number> may be * to show strings inside all loaded scripts\n");
return true;
}
-
+
if (strcmp(argv[1], "*") == 0) {
// get strings of all currently loaded scripts
curScriptNr = -1;
@@ -2963,7 +2938,7 @@ bool Console::cmdScriptSaid(int argc, const char **argv) {
debugPrintf("<script number> may be * to show said-strings inside all loaded scripts\n");
return true;
}
-
+
if (strcmp(argv[1], "*") == 0) {
// get said-strings of all currently loaded scripts
curScriptNr = -1;
@@ -3778,7 +3753,7 @@ bool Console::cmdBreakpointKernel(int argc, const char **argv) {
bool Console::cmdBreakpointFunction(int argc, const char **argv) {
if (argc != 3) {
debugPrintf("Sets a breakpoint on the execution of the specified exported function.\n");
- debugPrintf("Usage: %s <script number> <export number\n", argv[0]);
+ debugPrintf("Usage: %s <script number> <export number>\n", argv[0]);
return true;
}
@@ -4373,8 +4348,28 @@ void Console::printBasicVarInfo(reg_t variable) {
debugPrintf(" IS INVALID!");
}
-void Console::printList(List *list) {
- reg_t pos = list->first;
+void Console::printList(reg_t reg) {
+ SegmentObj *mobj = _engine->_gamestate->_segMan->getSegment(reg.getSegment(), SEG_TYPE_LISTS);
+
+ if (!mobj) {
+ debugPrintf("list:\nCould not find list segment.\n");
+ return;
+ }
+
+ ListTable *table = static_cast<ListTable *>(mobj);
+
+ if (!table->isValidEntry(reg.getOffset())) {
+ debugPrintf("list:\nAddress does not contain a valid list.\n");
+ return;
+ }
+
+ const List &list = table->at(reg.getOffset());
+ debugPrintf("list:\n");
+ printList(list);
+}
+
+void Console::printList(const List &list) {
+ reg_t pos = list.first;
reg_t my_prev = NULL_REG;
debugPrintf("\t<\n");
@@ -4384,8 +4379,7 @@ void Console::printList(List *list) {
NodeTable *nt = (NodeTable *)_engine->_gamestate->_segMan->getSegment(pos.getSegment(), SEG_TYPE_NODES);
if (!nt || !nt->isValidEntry(pos.getOffset())) {
- debugPrintf(" WARNING: %04x:%04x: Doesn't contain list node!\n",
- PRINT_REG(pos));
+ debugPrintf(" WARNING: %04x:%04x: Doesn't contain list node!\n", PRINT_REG(pos));
return;
}
@@ -4394,16 +4388,15 @@ void Console::printList(List *list) {
debugPrintf("\t%04x:%04x : %04x:%04x -> %04x:%04x\n", PRINT_REG(pos), PRINT_REG(node->key), PRINT_REG(node->value));
if (my_prev != node->pred)
- debugPrintf(" WARNING: current node gives %04x:%04x as predecessor!\n",
- PRINT_REG(node->pred));
+ debugPrintf(" WARNING: current node gives %04x:%04x as predecessor!\n", PRINT_REG(node->pred));
my_prev = pos;
pos = node->succ;
}
- if (my_prev != list->last)
+ if (my_prev != list.last)
debugPrintf(" WARNING: Last node was expected to be %04x:%04x, was %04x:%04x!\n",
- PRINT_REG(list->last), PRINT_REG(my_prev));
+ PRINT_REG(list.last), PRINT_REG(my_prev));
debugPrintf("\t>\n");
}
@@ -4447,6 +4440,89 @@ int Console::printNode(reg_t addr) {
return 0;
}
+#ifdef ENABLE_SCI32
+void Console::printArray(reg_t reg) {
+ SegmentObj *mobj = _engine->_gamestate->_segMan->getSegment(reg.getSegment(), SEG_TYPE_ARRAY);
+
+ if (!mobj) {
+ debugPrintf("SCI32 array:\nCould not find array segment.\n");
+ return;
+ }
+
+ ArrayTable *table = static_cast<ArrayTable *>(mobj);
+
+ if (!table->isValidEntry(reg.getOffset())) {
+ debugPrintf("SCI32 array:\nAddress does not contain a valid array.\n");
+ return;
+ }
+
+ const SciArray &array = table->at(reg.getOffset());
+
+ const char *arrayType;
+ switch (array.getType()) {
+ case kArrayTypeID:
+ arrayType = "reg_t";
+ break;
+ case kArrayTypeByte:
+ arrayType = "byte";
+ break;
+ case kArrayTypeInt16:
+ arrayType = "int16 (as reg_t)";
+ break;
+ case kArrayTypeString:
+ arrayType = "string";
+ break;
+ default:
+ arrayType = "invalid";
+ break;
+ }
+ debugPrintf("SCI32 %s array (%u entries):\n", arrayType, array.size());
+ switch (array.getType()) {
+ case kArrayTypeInt16:
+ case kArrayTypeID: {
+ hexDumpReg((const reg_t *)array.getRawData(), array.size(), 4, 0, true);
+ break;
+ }
+ case kArrayTypeByte:
+ case kArrayTypeString: {
+ Common::hexdump((const byte *)array.getRawData(), array.size(), 16, 0);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+void Console::printBitmap(reg_t reg) {
+ SegmentObj *mobj = _engine->_gamestate->_segMan->getSegment(reg.getSegment(), SEG_TYPE_BITMAP);
+
+ if (!mobj) {
+ debugPrintf("SCI32 bitmap:\nCould not find bitmap segment.\n");
+ return;
+ }
+
+ BitmapTable *table = static_cast<BitmapTable *>(mobj);
+
+ if (!table->isValidEntry(reg.getOffset())) {
+ debugPrintf("SCI32 bitmap:\nAddress does not contain a valid bitmap.\n");
+ return;
+ }
+
+ const SciBitmap &bitmap = table->at(reg.getOffset());
+
+ debugPrintf("SCI32 bitmap (%dx%d; res %dx%d; origin %dx%d; skip color %u; %s; %s):\n",
+ bitmap.getWidth(), bitmap.getHeight(),
+ bitmap.getXResolution(), bitmap.getYResolution(),
+ bitmap.getOrigin().x, bitmap.getOrigin().y,
+ bitmap.getSkipColor(),
+ bitmap.getRemap() ? "remap" : "no remap",
+ bitmap.getShouldGC() ? "GC" : "no GC");
+
+ Common::hexdump((const byte *) bitmap.getRawData(), bitmap.getRawSize(), 16, 0);
+}
+
+#endif
+
int Console::printObject(reg_t pos) {
EngineState *s = _engine->_gamestate; // for the several defines in this function
const Object *obj = s->_segMan->getObject(pos);
diff --git a/engines/sci/console.h b/engines/sci/console.h
index cf85def950..0b87a4408b 100644
--- a/engines/sci/console.h
+++ b/engines/sci/console.h
@@ -41,7 +41,11 @@ public:
Console(SciEngine *engine);
virtual ~Console();
- int printObject(reg_t pos);
+#ifdef ENABLE_SCI32
+ void printArray(reg_t reg);
+ void printBitmap(reg_t reg);
+#endif
+ int printObject(reg_t reg);
private:
virtual void preEnter();
@@ -169,7 +173,8 @@ private:
void printBasicVarInfo(reg_t variable);
bool segmentInfo(int nr);
- void printList(List *list);
+ void printList(reg_t addr);
+ void printList(const List &list);
int printNode(reg_t addr);
void hexDumpReg(const reg_t *data, int len, int regsPerLine = 4, int startOffset = 0, bool isArray = false);
void printOffsets(int scriptNr, uint16 showType);
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index ad2b0f31a5..83f1d30916 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -772,8 +772,7 @@ SaveStateList SciMetaEngine::listSaves(const char *target) const {
SaveStateDescriptor descriptor(slotNr, meta.name);
if (slotNr == 0) {
- // ScummVM auto-save slot, not used by SCI
- // SCI does not support auto-saving, but slot 0 is reserved for auto-saving in ScummVM.
+ // ScummVM auto-save slot
descriptor.setWriteProtectedFlag(true);
} else {
descriptor.setWriteProtectedFlag(false);
@@ -795,9 +794,8 @@ SaveStateDescriptor SciMetaEngine::querySaveMetaInfos(const char *target, int sl
Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(fileName);
SaveStateDescriptor descriptor(slotNr, "");
- // Do not allow save slot 0 (used for auto-saving) to be deleted or
- // overwritten. SCI does not support auto-saving, but slot 0 is reserved for auto-saving in ScummVM.
if (slotNr == 0) {
+ // ScummVM auto-save slot
descriptor.setWriteProtectedFlag(true);
descriptor.setDeletableFlag(false);
} else {
@@ -807,7 +805,7 @@ SaveStateDescriptor SciMetaEngine::querySaveMetaInfos(const char *target, int sl
if (in) {
SavegameMetadata meta;
-
+
if (!get_savegame_metadata(in, &meta)) {
// invalid
delete in;
diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h
index fafbf60d5a..22d2b6f308 100644
--- a/engines/sci/detection_tables.h
+++ b/engines/sci/detection_tables.h
@@ -866,7 +866,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "b996fa1e57389a1e179a00a0049de1f4", 8110},
{"ressci.000", 0, "a19fc3604c6e5407abcf03d59ee87217", 168522221},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO_GK2 },
+ Common::EN_ANY, Common::kPlatformDOS, ADGF_CD | ADGF_UNSTABLE, GUIO_GK2 },
// Gabriel Knight 2 - English DOS (from jvprat)
// Executable scanning reports "2.100.002", VERSION file reports "1.1"
@@ -884,7 +884,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.006", 0, "ce9359037277b7d7976da185c2fa0aad", 2977},
{"ressci.006", 0, "8e44e03890205a7be12f45aaba9644b4", 60659424},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO_GK2 },
+ Common::EN_ANY, Common::kPlatformDOS, ADGF_CD | ADGF_UNSTABLE, GUIO_GK2 },
// Gabriel Knight 2 - French DOS (6-CDs Sierra Originals reedition)
// Executable scanning reports "2.100.002", VERSION file reports "1.0"
@@ -902,7 +902,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.006", 0, "11b2e722170b8c93fdaa5428e2c7676f", 3001},
{"ressci.006", 0, "4037d941aec39d2e654e20960429aefc", 60568486},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO_GK2 },
+ Common::FR_FRA, Common::kPlatformDOS, ADGF_CD | ADGF_UNSTABLE, GUIO_GK2 },
// Gabriel Knight 2 - English Macintosh
// NOTE: This only contains disc 1 files (as well as the persistent file:
@@ -914,7 +914,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"Data4", 0, "8b843c62eb53136a855d6e0087e3cb0d", 5889553},
{"Data5", 0, "f9fcf9ab2eb13b2125c33a1cda03a093", 14349984},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK | ADGF_UNSTABLE, GUIO_GK2_MAC },
+ Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK | ADGF_CD | ADGF_UNSTABLE, GUIO_GK2_MAC },
#endif // ENABLE_SCI32
@@ -2580,7 +2580,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "0c0804434ea62278dd15032b1947426c", 8872},
{"resource.000", 0, "9a9f4870504444cda863dd14d077a680", 18520872},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO_LSL6HIRES },
+ Common::EN_ANY, Common::kPlatformDOS, ADGF_CD | ADGF_UNSTABLE, GUIO_LSL6HIRES },
// Larry 6 - German DOS CD - HIRES (provided by richiefs in bug report #2670691)
// SCI interpreter version 2.100.002
@@ -2588,7 +2588,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "badfdf446ffed569a310d2c63a249421", 8896},
{"resource.000", 0, "bd944d2b06614a5b39f1586906f0ee88", 18534274},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO_LSL6HIRES },
+ Common::DE_DEU, Common::kPlatformDOS, ADGF_CD | ADGF_UNSTABLE, GUIO_LSL6HIRES },
// Larry 6 - French DOS CD - HIRES (provided by richiefs in bug report #2670691)
// SCI interpreter version 2.100.002
@@ -2596,7 +2596,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "d184e9aa4f2d4b5670ddb3669db82cda", 8896},
{"resource.000", 0, "bd944d2b06614a5b39f1586906f0ee88", 18538987},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO_LSL6HIRES },
+ Common::FR_FRA, Common::kPlatformDOS, ADGF_CD | ADGF_UNSTABLE, GUIO_LSL6HIRES },
#define GUIO_LSL7_DEMO GUIO5(GUIO_NOSPEECH, \
GUIO_NOASPECT, \
@@ -2624,7 +2624,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "eae93e1b1d1ccc58b4691c371281c95d", 8188},
{"ressci.000", 0, "89353723488219e25589165d73ed663e", 66965678},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO_LSL7 },
+ Common::EN_ANY, Common::kPlatformDOS, ADGF_CD | ADGF_UNSTABLE, GUIO_LSL7 },
// Larry 7 - German DOS (from Tobis87)
// SCI interpreter version 3.000.000
@@ -2632,7 +2632,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "c11e6bfcfc2f2d05da47e5a7df3e9b1a", 8188},
{"ressci.000", 0, "a8c6817bb94f332ff498a71c8b47f893", 66971724},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO_LSL7 },
+ Common::DE_DEU, Common::kPlatformDOS, ADGF_CD | ADGF_UNSTABLE, GUIO_LSL7 },
// Larry 7 - French DOS (provided by richiefs in bug report #2670691)
// SCI interpreter version 3.000.000
@@ -2640,7 +2640,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "4407849fd52fe3efb0c30fba60cd5cd4", 8206},
{"ressci.000", 0, "dc37c3055fffbefb494ff22b145d377b", 66964472},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO_LSL7 },
+ Common::FR_FRA, Common::kPlatformDOS, ADGF_CD | ADGF_UNSTABLE, GUIO_LSL7 },
// Larry 7 - Italian DOS CD (from glorifindel)
// SCI interpreter version 3.000.000
@@ -2648,7 +2648,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "9852a97141f789413f29bf956052acdb", 8212},
{"ressci.000", 0, "440b9fed89590abb4e4386ed6f948ee2", 67140181},
AD_LISTEND},
- Common::IT_ITA, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO_LSL7 },
+ Common::IT_ITA, Common::kPlatformDOS, ADGF_CD | ADGF_UNSTABLE, GUIO_LSL7 },
// Larry 7 - Spanish DOS (from the Leisure Suit Larry Collection)
// Executable scanning reports "3.000.000", VERSION file reports "1.0s"
@@ -2656,7 +2656,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "8f3d603e1acc834a5d598b30cdfc93f3", 8188},
{"ressci.000", 0, "32792f9bc1bf3633a88b382bb3f6e40d", 67071418},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO_LSL7 },
+ Common::ES_ESP, Common::kPlatformDOS, ADGF_CD | ADGF_UNSTABLE, GUIO_LSL7 },
#endif
#define GUIO_LIGHTHOUSE_DEMO GUIO5(GUIO_NOSPEECH, \
@@ -2696,7 +2696,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.002", 0, "c68db5333f152fea6ca2dfc75cad8b34", 7573},
{"ressci.002", 0, "175468431a979b9f317c294ce3bc1430", 94628315},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO_LIGHTHOUSE },
+ Common::EN_ANY, Common::kPlatformDOS, ADGF_CD | ADGF_UNSTABLE, GUIO_LIGHTHOUSE },
// Lighthouse - Japanese DOS (from m_kiewitz)
// Executable scanning reports "3.000.000", VERSION file reports "1.0C"
@@ -2706,7 +2706,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.002", 0, "723fc742c623d8933e5753a264324cb0", 7657},
{"ressci.002", 0, "175468431a979b9f317c294ce3bc1430", 94627469},
AD_LISTEND},
- Common::JA_JPN, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO_LIGHTHOUSE },
+ Common::JA_JPN, Common::kPlatformDOS, ADGF_CD | ADGF_UNSTABLE, GUIO_LIGHTHOUSE },
// Lighthouse - Spanish DOS (from jvprat)
// Executable scanning reports "3.000.000", VERSION file reports "1.1"
@@ -2716,7 +2716,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.002", 0, "e7dc85884a2417e2eff9de0c63dd65fa", 7630},
{"ressci.002", 0, "3c8d627c555b0e3e4f1d9955bc0f0df4", 94631127},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO_LIGHTHOUSE },
+ Common::ES_ESP, Common::kPlatformDOS, ADGF_CD | ADGF_UNSTABLE, GUIO_LIGHTHOUSE },
#endif // ENABLE_SCI3_GAMES
#endif // ENABLE_SCI32
@@ -2850,7 +2850,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "5159a1578c4306bfe070a3e4d8c2e1d3", 4741},
{"resource.000", 0, "1926925c95d82f0999590e93b02887c5", 15150768},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO_MOTHERGOOSEHIRES },
+ Common::EN_ANY, Common::kPlatformDOS, ADGF_CD | ADGF_UNSTABLE, GUIO_MOTHERGOOSEHIRES },
// Mixed-Up Mother Goose Deluxe - Multilingual Windows CD (English/French/German/Spanish)
// Executable scanning reports "2.100.002"
@@ -2858,7 +2858,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "ef611af561898dcfea87846919ebf3eb", 4969},
{"ressci.000", 0, "227685bc59d90821978d330713e44a7a", 17205800},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO_MOTHERGOOSEHIRES },
+ Common::EN_ANY, Common::kPlatformDOS, ADGF_CD | ADGF_UNSTABLE, GUIO_MOTHERGOOSEHIRES },
#endif // ENABLE_SCI32
// Ms. Astro Chicken - English DOS
@@ -2904,7 +2904,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.007", 0, "aa8175cfc93242af6f5e65bdceaafc0d", 7972},
//{"ressci.007", 0, "3aae6559aa1df273bc542d5ac6330d75", 25859038},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO_PHANTASMAGORIA },
+ Common::EN_ANY, Common::kPlatformDOS, ADGF_CD | ADGF_UNSTABLE, GUIO_PHANTASMAGORIA },
// Phantasmagoria - English DOS (from jvprat)
// Executable scanning reports "2.100.002", VERSION file reports "1.100.000UK"
@@ -2924,7 +2924,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.007", 0, "afbd16ea77869a720afa1c5371de107d", 7972},
//{"ressci.007", 0, "3aae6559aa1df273bc542d5ac6330d75", 25859038},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO_PHANTASMAGORIA },
+ Common::EN_ANY, Common::kPlatformDOS, ADGF_CD | ADGF_UNSTABLE, GUIO_PHANTASMAGORIA },
// Phantasmagoria - German DOS/Windows
// Windows executable scanning reports "unknown" - "Sep 19 1995 09:39:48"
@@ -2947,7 +2947,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.007", 0, "06309b8043aecb85bd507b15d16cb544", 7984},
//{"ressci.007", 0, "3aae6559aa1df273bc542d5ac6330d75", 26898681},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO_PHANTASMAGORIA },
+ Common::DE_DEU, Common::kPlatformDOS, ADGF_CD | ADGF_UNSTABLE, GUIO_PHANTASMAGORIA },
// Phantasmagoria - French DOS
// Supplied by Kervala in bug #6574
@@ -2966,7 +2966,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"ressci.006", 0, "3aae6559aa1df273bc542d5ac6330d75", 85415107},
{"resmap.007", 0, "5633960bc106c39ca91d2d8fce18fd2d", 7984},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO_PHANTASMAGORIA },
+ Common::FR_FRA, Common::kPlatformDOS, ADGF_CD | ADGF_UNSTABLE, GUIO_PHANTASMAGORIA },
// Phantasmagoria - English DOS Demo
// Executable scanning reports "2.100.002"
@@ -2985,7 +2985,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"ressci.000", 0, "cd5967f9b9586e3380645961c0765be3", 116822037},
{"resmap.000", 0, "3cafc1c6a53945c1f3babbfd6380c64c", 16468},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO_PHANTASMAGORIA },
+ Common::EN_ANY, Common::kPlatformDOS, ADGF_CD | ADGF_UNSTABLE, GUIO_PHANTASMAGORIA },
// Phantasmagoria - English Macintosh
// NOTE: This only contains disc 1 files (as well as the two persistent files:
@@ -3001,7 +3001,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
// Data8-12 are empty
{"Data13", 0, "6d2c450fca19a69b5af74ed5b03c0a17", 14923328},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK | ADGF_UNSTABLE, GUIO_PHANTASMAGORIA_MAC },
+ Common::EN_ANY, Common::kPlatformMacintosh, ADGF_CD | ADGF_MACRESFORK | ADGF_UNSTABLE, GUIO_PHANTASMAGORIA_MAC },
#ifdef ENABLE_SCI3_GAMES
@@ -3368,7 +3368,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "1c2563fee189885e29d9348f37306d94", 12175},
{"ressci.000", 0, "b2e1826ca81ce2e7e764587f5a14eee9", 127149181},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformDOS, ADGF_UNSTABLE, GUIO_PQSWAT },
+ Common::EN_ANY, Common::kPlatformDOS, ADGF_CD | ADGF_UNSTABLE, GUIO_PQSWAT },
// Police Quest: SWAT - English Windows (from the Police Quest Collection)
// Executable scanning reports "2.100.002", VERSION file reports "1.0c"
@@ -3383,7 +3383,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.004", 0, "4228038906f041623e65789500b22285", 6835},
{"ressci.004", 0, "b7e619e6ecf62fe65d5116a3a422e5f0", 46223872},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO_PQSWAT },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_CD | ADGF_UNSTABLE, GUIO_PQSWAT },
#endif // ENABLE_SCI32
// Quest for Glory 1 / Hero's Quest - English DOS 3.5" Floppy (supplied by merkur in bug report #2718784)
diff --git a/engines/sci/engine/file.cpp b/engines/sci/engine/file.cpp
index 8cecd8c82c..d46d68d9df 100644
--- a/engines/sci/engine/file.cpp
+++ b/engines/sci/engine/file.cpp
@@ -311,43 +311,65 @@ static bool _savegame_sort_byDate(const SavegameDesc &l, const SavegameDesc &r)
return (l.time > r.time);
}
-// Create a sorted array containing all found savedgames
-void listSavegames(Common::Array<SavegameDesc> &saves) {
+bool fillSavegameDesc(const Common::String &filename, SavegameDesc *desc) {
Common::SaveFileManager *saveFileMan = g_sci->getSaveFileManager();
+ Common::SeekableReadStream *in;
+ if ((in = saveFileMan->openForLoading(filename)) == nullptr) {
+ return false;
+ }
+
+ SavegameMetadata meta;
+ if (!get_savegame_metadata(in, &meta) || meta.name.empty()) {
+ // invalid
+ delete in;
+ return false;
+ }
+ delete in;
+
+ const int id = strtol(filename.end() - 3, NULL, 10);
+ desc->id = id;
+ desc->date = meta.saveDate;
+ // We need to fix date in here, because we save DDMMYYYY instead of
+ // YYYYMMDD, so sorting wouldn't work
+ desc->date = ((desc->date & 0xFFFF) << 16) | ((desc->date & 0xFF0000) >> 8) | ((desc->date & 0xFF000000) >> 24);
+ desc->time = meta.saveTime;
+ desc->version = meta.version;
+ desc->gameVersion = meta.gameVersion;
+#ifdef ENABLE_SCI32
+ if (g_sci->getGameId() == GID_SHIVERS) {
+ desc->lowScore = meta.lowScore;
+ desc->highScore = meta.highScore;
+ } else if (g_sci->getGameId() == GID_MOTHERGOOSEHIRES) {
+ desc->avatarId = meta.avatarId;
+ }
+#endif
+
+ if (meta.name.lastChar() == '\n')
+ meta.name.deleteLastChar();
+
+ Common::strlcpy(desc->name, meta.name.c_str(), SCI_MAX_SAVENAME_LENGTH);
- // Load all saves
+ return desc;
+}
+
+// Create an array containing all found savedgames, sorted by creation date
+void listSavegames(Common::Array<SavegameDesc> &saves) {
+ Common::SaveFileManager *saveFileMan = g_sci->getSaveFileManager();
Common::StringArray saveNames = saveFileMan->listSavefiles(g_sci->getSavegamePattern());
for (Common::StringArray::const_iterator iter = saveNames.begin(); iter != saveNames.end(); ++iter) {
- Common::String filename = *iter;
- Common::SeekableReadStream *in;
- if ((in = saveFileMan->openForLoading(filename))) {
- SavegameMetadata meta;
- if (!get_savegame_metadata(in, &meta) || meta.name.empty()) {
- // invalid
- delete in;
- continue;
- }
- delete in;
-
- SavegameDesc desc;
- desc.id = strtol(filename.end() - 3, NULL, 10);
- desc.date = meta.saveDate;
- // We need to fix date in here, because we save DDMMYYYY instead of
- // YYYYMMDD, so sorting wouldn't work
- desc.date = ((desc.date & 0xFFFF) << 16) | ((desc.date & 0xFF0000) >> 8) | ((desc.date & 0xFF000000) >> 24);
- desc.time = meta.saveTime;
- desc.version = meta.version;
-
- if (meta.name.lastChar() == '\n')
- meta.name.deleteLastChar();
-
- Common::strlcpy(desc.name, meta.name.c_str(), SCI_MAX_SAVENAME_LENGTH);
-
- debug(3, "Savegame in file %s ok, id %d", filename.c_str(), desc.id);
-
- saves.push_back(desc);
+ const Common::String &filename = *iter;
+
+#ifdef ENABLE_SCI32
+ const int id = strtol(filename.end() - 3, NULL, 10);
+ if (id == kNewGameId || id == kAutoSaveId) {
+ continue;
}
+#endif
+
+ SavegameDesc desc;
+ fillSavegameDesc(filename, &desc);
+ saves.push_back(desc);
}
// Sort the list by creation date of the saves
diff --git a/engines/sci/engine/file.h b/engines/sci/engine/file.h
index 982d7b7823..0154338f6c 100644
--- a/engines/sci/engine/file.h
+++ b/engines/sci/engine/file.h
@@ -34,12 +34,22 @@ enum {
_K_FILE_MODE_CREATE = 2
};
-/* Maximum length of a savegame name (including terminator character). */
-#define SCI_MAX_SAVENAME_LENGTH 0x24
+enum {
+ SCI_MAX_SAVENAME_LENGTH = 36, ///< Maximum length of a savegame name (including terminator character).
+ MAX_SAVEGAME_NR = 20 ///< Maximum number of savegames
+};
+#ifdef ENABLE_SCI32
enum {
- MAX_SAVEGAME_NR = 20 /**< Maximum number of savegames */
+ kAutoSaveId = 0, ///< The save game slot number for autosaves
+ kNewGameId = 999, ///< The save game slot number for a "new game" save
+
+ // SCI engine expects game IDs to start at 0, but slot 0 in ScummVM is
+ // reserved for autosave, so non-autosave games get their IDs shifted up
+ // when saving or restoring, and shifted down when enumerating save games
+ kSaveIdShift = 1
};
+#endif
#define VIRTUALFILE_HANDLE_START 32000
#define VIRTUALFILE_HANDLE_SCI32SAVE 32100
@@ -53,6 +63,14 @@ struct SavegameDesc {
int time;
int version;
char name[SCI_MAX_SAVENAME_LENGTH];
+ Common::String gameVersion;
+#ifdef ENABLE_SCI32
+ // Used by Shivers 1
+ uint16 lowScore;
+ uint16 highScore;
+ // Used by MGDX
+ uint8 avatarId;
+#endif
};
class FileHandle {
diff --git a/engines/sci/engine/gc.cpp b/engines/sci/engine/gc.cpp
index 6c1713bed9..50f7709baf 100644
--- a/engines/sci/engine/gc.cpp
+++ b/engines/sci/engine/gc.cpp
@@ -46,7 +46,7 @@ const char *segmentTypeNames[] = {
"dynmem", // 9
"obsolete", // 10: obsolete string fragments
"array", // 11: SCI32 arrays
- "string" // 12: SCI32 strings
+ "obsolete" // 12: obsolete SCI32 strings
};
#endif
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index c03504d277..85cad99226 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -410,7 +410,6 @@ uint16 Kernel::findRegType(reg_t reg) {
case SEG_TYPE_HUNK:
#ifdef ENABLE_SCI32
case SEG_TYPE_ARRAY:
- case SEG_TYPE_STRING:
case SEG_TYPE_BITMAP:
#endif
result |= SIG_TYPE_REFERENCE;
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index 45477e1153..cce9a223d3 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -483,30 +483,46 @@ reg_t kShowMovieWinGetDuration(EngineState *s, int argc, reg_t *argv);
reg_t kShowMovieWinPlayUntilEvent(EngineState *s, int argc, reg_t *argv);
reg_t kShowMovieWinInitDouble(EngineState *s, int argc, reg_t *argv);
+reg_t kSave(EngineState *s, int argc, reg_t *argv);
+reg_t kSaveGame32(EngineState *s, int argc, reg_t *argv);
+reg_t kRestoreGame32(EngineState *s, int argc, reg_t *argv);
+reg_t kGetSaveFiles32(EngineState *s, int argc, reg_t *argv);
+reg_t kCheckSaveGame32(EngineState *s, int argc, reg_t *argv);
+reg_t kMakeSaveCatName(EngineState *s, int argc, reg_t *argv);
+reg_t kMakeSaveFileName(EngineState *s, int argc, reg_t *argv);
+
+reg_t kSetHotRectangles(EngineState *s, int argc, reg_t *argv);
reg_t kIsHiRes(EngineState *s, int argc, reg_t *argv);
-reg_t kArray(EngineState *s, int argc, reg_t *argv);
reg_t kListAt(EngineState *s, int argc, reg_t *argv);
-reg_t kString(EngineState *s, int argc, reg_t *argv);
+reg_t kArray(EngineState *s, int argc, reg_t *argv);
+reg_t kArrayNew(EngineState *s, int argc, reg_t *argv);
+reg_t kArrayGetSize(EngineState *s, int argc, reg_t *argv);
+reg_t kArrayGetElement(EngineState *s, int argc, reg_t *argv);
+reg_t kArraySetElements(EngineState *s, int argc, reg_t *argv);
+reg_t kArrayFree(EngineState *s, int argc, reg_t *argv);
+reg_t kArrayFill(EngineState *s, int argc, reg_t *argv);
+reg_t kArrayCopy(EngineState *s, int argc, reg_t *argv);
+reg_t kArrayCompare(EngineState *s, int argc, reg_t *argv);
+reg_t kArrayDuplicate(EngineState *s, int argc, reg_t *argv);
+reg_t kArrayGetData(EngineState *s, int argc, reg_t *argv);
+reg_t kArrayByteCopy(EngineState *s, int argc, reg_t *argv);
+
+reg_t kString(EngineState *s, int argc, reg_t *argv);
reg_t kStringNew(EngineState *s, int argc, reg_t *argv);
-reg_t kStringSize(EngineState *s, int argc, reg_t *argv);
-reg_t kStringAt(EngineState *s, int argc, reg_t *argv);
-reg_t kStringPutAt(EngineState *s, int argc, reg_t *argv);
+reg_t kStringGetChar(EngineState *s, int argc, reg_t *argv);
reg_t kStringFree(EngineState *s, int argc, reg_t *argv);
-reg_t kStringFill(EngineState *s, int argc, reg_t *argv);
-reg_t kStringCopy(EngineState *s, int argc, reg_t *argv);
reg_t kStringCompare(EngineState *s, int argc, reg_t *argv);
-reg_t kStringDup(EngineState *s, int argc, reg_t *argv);
reg_t kStringGetData(EngineState *s, int argc, reg_t *argv);
-reg_t kStringLen(EngineState *s, int argc, reg_t *argv);
-reg_t kStringPrintf(EngineState *s, int argc, reg_t *argv);
-reg_t kStringPrintfBuf(EngineState *s, int argc, reg_t *argv);
-reg_t kStringAtoi(EngineState *s, int argc, reg_t *argv);
+reg_t kStringLength(EngineState *s, int argc, reg_t *argv);
+reg_t kStringFormat(EngineState *s, int argc, reg_t *argv);
+reg_t kStringFormatAt(EngineState *s, int argc, reg_t *argv);
+reg_t kStringToInteger(EngineState *s, int argc, reg_t *argv);
reg_t kStringTrim(EngineState *s, int argc, reg_t *argv);
-reg_t kStringUpper(EngineState *s, int argc, reg_t *argv);
-reg_t kStringLower(EngineState *s, int argc, reg_t *argv);
-reg_t kStringTrn(EngineState *s, int argc, reg_t *argv);
-reg_t kStringTrnExclude(EngineState *s, int argc, reg_t *argv);
+reg_t kStringToUpperCase(EngineState *s, int argc, reg_t *argv);
+reg_t kStringToLowerCase(EngineState *s, int argc, reg_t *argv);
+reg_t kStringReplaceSubstring(EngineState *s, int argc, reg_t *argv);
+reg_t kStringReplaceSubstringEx(EngineState *s, int argc, reg_t *argv);
reg_t kScrollWindowCreate(EngineState *s, int argc, reg_t *argv);
reg_t kScrollWindowAdd(EngineState *s, int argc, reg_t *argv);
@@ -547,7 +563,7 @@ reg_t kBitmapDrawText(EngineState *s, int argc, reg_t *argv);
reg_t kBitmapDrawColor(EngineState *s, int argc, reg_t *argv);
reg_t kBitmapDrawBitmap(EngineState *s, int argc, reg_t *argv);
reg_t kBitmapInvert(EngineState *s, int argc, reg_t *argv);
-reg_t kBitmapSetDisplace(EngineState *s, int argc, reg_t *argv);
+reg_t kBitmapSetOrigin(EngineState *s, int argc, reg_t *argv);
reg_t kBitmapCreateFromView(EngineState *s, int argc, reg_t *argv);
reg_t kBitmapCopyPixels(EngineState *s, int argc, reg_t *argv);
reg_t kBitmapClone(EngineState *s, int argc, reg_t *argv);
@@ -576,8 +592,6 @@ reg_t kListFirstTrue(EngineState *s, int argc, reg_t *argv);
reg_t kListAllTrue(EngineState *s, int argc, reg_t *argv);
reg_t kEditText(EngineState *s, int argc, reg_t *argv);
-reg_t kMakeSaveCatName(EngineState *s, int argc, reg_t *argv);
-reg_t kMakeSaveFileName(EngineState *s, int argc, reg_t *argv);
reg_t kSetScroll(EngineState *s, int argc, reg_t *argv);
reg_t kPaletteSetFromResource32(EngineState *s, int argc, reg_t *argv);
@@ -607,8 +621,6 @@ reg_t kMorphOn(EngineState *s, int argc, reg_t *argv);
reg_t kText(EngineState *s, int argc, reg_t *argv);
reg_t kTextSize32(EngineState *s, int argc, reg_t *argv);
reg_t kTextWidth(EngineState *s, int argc, reg_t *argv);
-reg_t kSave(EngineState *s, int argc, reg_t *argv);
-reg_t kAutoSave(EngineState *s, int argc, reg_t *argv);
reg_t kList(EngineState *s, int argc, reg_t *argv);
reg_t kCD(EngineState *s, int argc, reg_t *argv);
reg_t kCheckCD(EngineState *s, int argc, reg_t *argv);
@@ -622,6 +634,7 @@ reg_t kWinHelp(EngineState *s, int argc, reg_t *argv);
reg_t kMessageBox(EngineState *s, int argc, reg_t *argv);
reg_t kGetConfig(EngineState *s, int argc, reg_t *argv);
reg_t kGetSierraProfileInt(EngineState *s, int argc, reg_t *argv);
+reg_t kPrintDebug(EngineState *s, int argc, reg_t *argv);
reg_t kCelInfo(EngineState *s, int argc, reg_t *argv);
reg_t kSetLanguage(EngineState *s, int argc, reg_t *argv);
reg_t kScrollWindow(EngineState *s, int argc, reg_t *argv);
@@ -707,7 +720,7 @@ reg_t kFileIOReadByte(EngineState *s, int argc, reg_t *argv);
reg_t kFileIOWriteByte(EngineState *s, int argc, reg_t *argv);
reg_t kFileIOReadWord(EngineState *s, int argc, reg_t *argv);
reg_t kFileIOWriteWord(EngineState *s, int argc, reg_t *argv);
-reg_t kFileIOCreateSaveSlot(EngineState *s, int argc, reg_t *argv);
+reg_t kFileIOGetCWD(EngineState *s, int argc, reg_t *argv);
reg_t kFileIOIsValidDirectory(EngineState *s, int argc, reg_t *argv);
#endif
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index 6e141e7f3b..0f1210e0e1 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -67,8 +67,8 @@ struct SciKernelMapSubEntry {
#define SIG_SINCE_SCI11 SCI_VERSION_1_1, SCI_VERSION_NONE
#define SIG_SCI2 SCI_VERSION_2, SCI_VERSION_2
#define SIG_SCI21EARLY SCI_VERSION_2_1_EARLY, SCI_VERSION_2_1_EARLY
-#define SIG_UNTIL_SCI21EARLY SCI_VERSION_2, SCI_VERSION_2_1_EARLY
-#define SIG_UNTIL_SCI21MID SCI_VERSION_2, SCI_VERSION_2_1_MIDDLE
+#define SIG_THRU_SCI21EARLY SCI_VERSION_2, SCI_VERSION_2_1_EARLY
+#define SIG_THRU_SCI21MID SCI_VERSION_2, SCI_VERSION_2_1_MIDDLE
#define SIG_SINCE_SCI21 SCI_VERSION_2_1_EARLY, SCI_VERSION_3
#define SIG_SINCE_SCI21MID SCI_VERSION_2_1_MIDDLE, SCI_VERSION_3
#define SIG_SINCE_SCI21LATE SCI_VERSION_2_1_LATE, SCI_VERSION_3
@@ -248,7 +248,7 @@ static const SciKernelMapSubEntry kDoAudio_subops[] = {
// version, subId, function-mapping, signature, workarounds
static const SciKernelMapSubEntry kGraph_subops[] = {
- { SIG_SCI32, 1, MAP_CALL(StubNull), "", NULL }, // called by gk1 sci32 right at the start
+ // 1 - load bits
{ SIG_SCIALL, 2, MAP_CALL(GraphGetColorCount), "", NULL },
// 3 - set palette via resource
{ SIG_SCIALL, 4, MAP_CALL(GraphDrawLine), "iiiii(i)(i)", kGraphDrawLine_workarounds },
@@ -311,9 +311,9 @@ static const SciKernelMapSubEntry kPalette_subops[] = {
SCI_SUBOPENTRY_TERMINATOR
};
+// version, subId, function-mapping, signature, workarounds
static const SciKernelMapSubEntry kFileIO_subops[] = {
- { SIG_SCI32, 0, MAP_CALL(FileIOOpen), "r(i)", NULL },
- { SIG_SCIALL, 0, MAP_CALL(FileIOOpen), "ri", NULL },
+ { SIG_SCIALL, 0, MAP_CALL(FileIOOpen), "ri", kFileIOOpen_workarounds },
{ SIG_SCIALL, 1, MAP_CALL(FileIOClose), "i", NULL },
{ SIG_SCIALL, 2, MAP_CALL(FileIOReadRaw), "iri", NULL },
{ SIG_SCIALL, 3, MAP_CALL(FileIOWriteRaw), "iri", NULL },
@@ -326,13 +326,13 @@ static const SciKernelMapSubEntry kFileIO_subops[] = {
{ SIG_SCIALL, 10, MAP_CALL(FileIOExists), "r", NULL },
{ SIG_SINCE_SCI11, 11, MAP_CALL(FileIORename), "rr", NULL },
#ifdef ENABLE_SCI32
- { SIG_SCI32, 13, MAP_CALL(FileIOReadByte), "i", NULL },
- { SIG_SCI32, 14, MAP_CALL(FileIOWriteByte), "ii", NULL },
- { SIG_SCI32, 15, MAP_CALL(FileIOReadWord), "i", NULL },
- { SIG_SCI32, 16, MAP_CALL(FileIOWriteWord), "ii", NULL },
- { SIG_SCI32, 17, MAP_CALL(FileIOCreateSaveSlot), "ir", NULL },
- { SIG_SCI32, 18, MAP_EMPTY(FileIOChangeDirectory), "r", NULL }, // for SQ6, when changing the savegame directory in the save/load dialog
- { SIG_SCI32, 19, MAP_CALL(FileIOIsValidDirectory), "r", NULL }, // for Torin / Torin demo
+ { SIG_SINCE_SCI21MID, 13, MAP_CALL(FileIOReadByte), "i", NULL },
+ { SIG_SINCE_SCI21MID, 14, MAP_CALL(FileIOWriteByte), "ii", NULL },
+ { SIG_SINCE_SCI21MID, 15, MAP_CALL(FileIOReadWord), "i", NULL },
+ { SIG_SINCE_SCI21MID, 16, MAP_CALL(FileIOWriteWord), "ii", NULL },
+ { SIG_SINCE_SCI21MID, 17, "FileIOCheckFreeSpace", kCheckFreeSpace, "i(r)", NULL },
+ { SIG_SINCE_SCI21MID, 18, MAP_CALL(FileIOGetCWD), "r", NULL },
+ { SIG_SINCE_SCI21MID, 19, MAP_CALL(FileIOIsValidDirectory), "r", NULL },
#endif
SCI_SUBOPENTRY_TERMINATOR
};
@@ -351,15 +351,19 @@ static const SciKernelMapSubEntry kPalCycle_subops[] = {
// version, subId, function-mapping, signature, workarounds
static const SciKernelMapSubEntry kSave_subops[] = {
- { SIG_SCI32, 0, MAP_CALL(SaveGame), "[r0]i[r0](r0)", NULL },
- { SIG_SCI32, 1, MAP_CALL(RestoreGame), "[r0]i[r0]", NULL },
- { SIG_SCI32, 2, MAP_CALL(GetSaveDir), "(r*)", NULL },
- { SIG_SCI32, 3, MAP_CALL(CheckSaveGame), ".*", NULL },
+ { SIG_SCI32, 0, MAP_CALL(SaveGame32), "[r0]i[r0][r0]", NULL },
+ { SIG_SCI32, 1, MAP_CALL(RestoreGame32), "[r0]i[r0]", NULL },
+ // System script 64994 in several SCI2.1mid games (KQ7 2.00b, Phant1,
+ // PQ:SWAT, SQ6, Torin) calls GetSaveDir with an extra unused argument, and
+ // it is easier to just handle it here than to bother with creating
+ // workarounds
+ { SIG_SCI32, 2, MAP_CALL(GetSaveDir), "(r)", NULL },
+ { SIG_SCI32, 3, MAP_CALL(CheckSaveGame32), "ri[r0]", NULL },
// Subop 4 hasn't been encountered yet
- { SIG_SCI32, 5, MAP_CALL(GetSaveFiles), "rrr", NULL },
+ { SIG_SCI32, 5, MAP_CALL(GetSaveFiles32), "rrr", NULL },
{ SIG_SCI32, 6, MAP_CALL(MakeSaveCatName), "rr", NULL },
{ SIG_SCI32, 7, MAP_CALL(MakeSaveFileName), "rri", NULL },
- { SIG_SCI32, 8, MAP_CALL(AutoSave), "[o0]", NULL },
+ { SIG_SCI32, 8, MAP_EMPTY(GameIsRestarting), "(.*)", NULL },
SCI_SUBOPENTRY_TERMINATOR
};
@@ -387,12 +391,12 @@ static const SciKernelMapSubEntry kBitmap_subops[] = {
{ SIG_SINCE_SCI21, 5, MAP_CALL(BitmapDrawColor), "riiiii", NULL },
{ SIG_SINCE_SCI21, 6, MAP_CALL(BitmapDrawBitmap), "rr(i)(i)(i)", NULL },
{ SIG_SINCE_SCI21, 7, MAP_CALL(BitmapInvert), "riiiiii", NULL },
- { SIG_SINCE_SCI21MID, 8, MAP_CALL(BitmapSetDisplace), "rii", NULL },
+ { SIG_SINCE_SCI21MID, 8, MAP_CALL(BitmapSetOrigin), "rii", NULL },
{ SIG_SINCE_SCI21MID, 9, MAP_CALL(BitmapCreateFromView), "iii(i)(i)(i)([r0])", NULL },
{ SIG_SINCE_SCI21MID, 10, MAP_CALL(BitmapCopyPixels), "rr", NULL },
{ SIG_SINCE_SCI21MID, 11, MAP_CALL(BitmapClone), "r", NULL },
- { SIG_SINCE_SCI21LATE, 12, MAP_CALL(BitmapGetInfo), "r(i)(i)", NULL },
- { SIG_SINCE_SCI21LATE, 13, MAP_CALL(BitmapScale), "r...ii", NULL },
+ { SIG_SINCE_SCI21MID, 12, MAP_CALL(BitmapGetInfo), "r(i)(i)", NULL },
+ { SIG_SINCE_SCI21LATE,13, MAP_CALL(BitmapScale), "r...ii", NULL },
{ SIG_SCI3, 14, MAP_CALL(BitmapCreateFromUnknown), "......", NULL },
{ SIG_SCI3, 15, MAP_EMPTY(Bitmap), "(.*)", NULL },
{ SIG_SCI3, 16, MAP_EMPTY(Bitmap), "(.*)", NULL },
@@ -501,44 +505,56 @@ static const SciKernelMapSubEntry kRemapColors_subops[] = {
};
// version, subId, function-mapping, signature, workarounds
+static const SciKernelMapSubEntry kArray_subops[] = {
+ { SIG_SCI32, 0, MAP_CALL(ArrayNew), "ii", NULL },
+ { SIG_SCI32, 1, MAP_CALL(ArrayGetSize), "r", NULL },
+ { SIG_SCI32, 2, MAP_CALL(ArrayGetElement), "ri", NULL },
+ { SIG_SCI32, 3, MAP_CALL(ArraySetElements), "ri(.*)", kArraySetElements_workarounds },
+ { SIG_SCI32, 4, MAP_CALL(ArrayFree), "r", NULL },
+ { SIG_SCI32, 5, MAP_CALL(ArrayFill), "riii", NULL },
+ { SIG_SCI32, 6, MAP_CALL(ArrayCopy), "ririi", NULL },
+ // there is no subop 7
+ { SIG_SCI32, 8, MAP_CALL(ArrayDuplicate), "r", NULL },
+ { SIG_SCI32, 9, MAP_CALL(ArrayGetData), "[or]", NULL },
+ { SIG_SCI3, 10, MAP_CALL(ArrayByteCopy), "ririi", NULL },
+ SCI_SUBOPENTRY_TERMINATOR
+};
+
+// version, subId, function-mapping, signature, workarounds
static const SciKernelMapSubEntry kString_subops[] = {
- { SIG_SCI32, 0, MAP_CALL(StringNew), "i(i)", NULL },
- { SIG_SCI32, 1, MAP_CALL(StringSize), "[or]", NULL },
- { SIG_SCI32, 2, MAP_CALL(StringAt), "[or]i", NULL },
- { SIG_SCI32, 3, MAP_CALL(StringPutAt), "[or]i(i*)", kStringPutAt_workarounds },
- // StringFree accepts invalid references
- { SIG_SCI32, 4, MAP_CALL(StringFree), "[or0!]", NULL },
- { SIG_SCI32, 5, MAP_CALL(StringFill), "[or]ii", NULL },
- { SIG_SCI32, 6, MAP_CALL(StringCopy), "[or]i[or]ii", NULL },
- { SIG_SCI32, 7, MAP_CALL(StringCompare), "[or][or](i)", NULL },
-
- // =SCI2, SCI2.1 Early and SCI2.1 Middle=
- { SIG_UNTIL_SCI21MID, 8, MAP_CALL(StringDup), "[or]", NULL },
- // TODO: This gets called with null references in Torin. Check if this is correct, or it's
- // caused by missing functionality
- { SIG_UNTIL_SCI21MID, 9, MAP_CALL(StringGetData), "[or0]", NULL },
- { SIG_UNTIL_SCI21MID, 10, MAP_CALL(StringLen), "[or]", NULL },
- { SIG_UNTIL_SCI21MID, 11, MAP_CALL(StringPrintf), "[or](.*)", NULL },
- { SIG_UNTIL_SCI21MID, 12, MAP_CALL(StringPrintfBuf), "[or](.*)", NULL },
- { SIG_UNTIL_SCI21MID, 13, MAP_CALL(StringAtoi), "[or]", NULL },
- { SIG_UNTIL_SCI21MID, 14, MAP_CALL(StringTrim), "[or]i", NULL },
- { SIG_UNTIL_SCI21MID, 15, MAP_CALL(StringUpper), "[or]", NULL },
- { SIG_UNTIL_SCI21MID, 16, MAP_CALL(StringLower), "[or]", NULL },
- // the following 2 are unknown atm (happen in Phantasmagoria)
- // possibly translate?
- { SIG_UNTIL_SCI21MID, 17, MAP_CALL(StringTrn), "[or]", NULL },
- { SIG_UNTIL_SCI21MID, 18, MAP_CALL(StringTrnExclude), "[or]", NULL },
-
- // SCI2.1 Late + SCI3 - kStringDup + kStringGetData were removed
- { SIG_SINCE_SCI21LATE, 8, MAP_CALL(StringLen), "[or]", NULL },
- { SIG_SINCE_SCI21LATE, 9, MAP_CALL(StringPrintf), "[or](.*)", NULL },
- { SIG_SINCE_SCI21LATE,10, MAP_CALL(StringPrintfBuf), "[or](.*)", NULL },
- { SIG_SINCE_SCI21LATE,11, MAP_CALL(StringAtoi), "[or]", NULL },
- { SIG_SINCE_SCI21LATE,12, MAP_CALL(StringTrim), "[or]i", NULL },
- { SIG_SINCE_SCI21LATE,13, MAP_CALL(StringUpper), "[or]", NULL },
- { SIG_SINCE_SCI21LATE,14, MAP_CALL(StringLower), "[or]", NULL },
- { SIG_SINCE_SCI21LATE,15, MAP_CALL(StringTrn), "[or]", NULL },
- { SIG_SINCE_SCI21LATE,16, MAP_CALL(StringTrnExclude), "[or]", NULL },
+ // every single copy of script 64918 in SCI2 through 2.1mid calls StringNew
+ // with a second type argument which is unused (new strings are always type
+ // 3)
+ { SIG_THRU_SCI21MID, 0, MAP_CALL(StringNew), "i(i)", NULL },
+ { SIG_THRU_SCI21MID, 1, MAP_CALL(ArrayGetSize), "r", NULL },
+ { SIG_THRU_SCI21MID, 2, MAP_CALL(StringGetChar), "ri", NULL },
+ { SIG_THRU_SCI21MID, 3, MAP_CALL(ArraySetElements), "ri(i*)", kArraySetElements_workarounds },
+ { SIG_THRU_SCI21MID, 4, MAP_CALL(StringFree), "[0r]", NULL },
+ { SIG_THRU_SCI21MID, 5, MAP_CALL(ArrayFill), "rii", NULL },
+ { SIG_THRU_SCI21MID, 6, MAP_CALL(ArrayCopy), "ririi", NULL },
+ { SIG_SCI32, 7, MAP_CALL(StringCompare), "rr(i)", NULL },
+
+ { SIG_THRU_SCI21MID, 8, MAP_CALL(ArrayDuplicate), "r", NULL },
+ { SIG_THRU_SCI21MID, 9, MAP_CALL(StringGetData), "[0or]", NULL },
+ { SIG_THRU_SCI21MID, 10, MAP_CALL(StringLength), "r", NULL },
+ { SIG_THRU_SCI21MID, 11, MAP_CALL(StringFormat), "r(.*)", NULL },
+ { SIG_THRU_SCI21MID, 12, MAP_CALL(StringFormatAt), "r[ro](.*)", NULL },
+ { SIG_THRU_SCI21MID, 13, MAP_CALL(StringToInteger), "r", NULL },
+ { SIG_THRU_SCI21MID, 14, MAP_CALL(StringTrim), "ri(i)", NULL },
+ { SIG_THRU_SCI21MID, 15, MAP_CALL(StringToUpperCase), "r", NULL },
+ { SIG_THRU_SCI21MID, 16, MAP_CALL(StringToLowerCase), "r", NULL },
+ { SIG_THRU_SCI21MID, 17, MAP_CALL(StringReplaceSubstring), "rrrr", NULL },
+ { SIG_THRU_SCI21MID, 18, MAP_CALL(StringReplaceSubstringEx), "rrrr", NULL },
+
+ { SIG_SINCE_SCI21LATE, 8, MAP_CALL(StringLength), "r", NULL },
+ { SIG_SINCE_SCI21LATE, 9, MAP_CALL(StringFormat), "r(.*)", NULL },
+ { SIG_SINCE_SCI21LATE,10, MAP_CALL(StringFormatAt), "rr(.*)", NULL },
+ { SIG_SINCE_SCI21LATE,11, MAP_CALL(StringToInteger), "r", NULL },
+ { SIG_SINCE_SCI21LATE,12, MAP_CALL(StringTrim), "ri(i)", NULL },
+ { SIG_SINCE_SCI21LATE,13, MAP_CALL(StringToUpperCase), "r", NULL },
+ { SIG_SINCE_SCI21LATE,14, MAP_CALL(StringToLowerCase), "r", NULL },
+ { SIG_SINCE_SCI21LATE,15, MAP_CALL(StringReplaceSubstring), "rrrr", NULL },
+ { SIG_SINCE_SCI21LATE,16, MAP_CALL(StringReplaceSubstringEx), "rrrr", NULL },
SCI_SUBOPENTRY_TERMINATOR
};
@@ -613,10 +629,13 @@ static SciKernelMapEntry s_kernelMap[] = {
{ "CelHigh", kCelHigh32, SIG_SCI32, SIGFOR_ALL, "iii", NULL, NULL },
{ "CelWide", kCelWide32, SIG_SCI32, SIGFOR_ALL, "iii", NULL, kCelWide_workarounds },
#endif
- { MAP_CALL(CheckFreeSpace), SIG_SCI32, SIGFOR_ALL, "r.*", NULL, NULL },
+ { MAP_CALL(CheckFreeSpace), SIG_THRU_SCI21EARLY, SIGFOR_ALL, "r(i)", NULL, NULL },
{ MAP_CALL(CheckFreeSpace), SIG_SCI11, SIGFOR_ALL, "r(i)", NULL, NULL },
- { MAP_CALL(CheckFreeSpace), SIG_EVERYWHERE, "r", NULL, NULL },
- { MAP_CALL(CheckSaveGame), SIG_EVERYWHERE, ".*", NULL, NULL },
+ { MAP_CALL(CheckFreeSpace), SIG_SCI16, SIGFOR_ALL, "r", NULL, NULL },
+#ifdef ENABLE_SCI32
+ { "CheckSaveGame", kCheckSaveGame32, SIG_THRU_SCI21EARLY, SIGFOR_ALL, "ri[r0]", NULL, NULL },
+#endif
+ { MAP_CALL(CheckSaveGame), SIG_SCI16, SIGFOR_ALL, ".*", NULL, NULL },
{ MAP_CALL(Clone), SIG_EVERYWHERE, "o", NULL, NULL },
{ MAP_CALL(CoordPri), SIG_EVERYWHERE, "i(i)", NULL, NULL },
{ MAP_CALL(CosDiv), SIG_EVERYWHERE, "ii", NULL, NULL },
@@ -632,7 +651,7 @@ static SciKernelMapEntry s_kernelMap[] = {
{ MAP_CALL(DisposeWindow), SIG_EVERYWHERE, "i(i)", NULL, NULL },
{ MAP_CALL(DoAudio), SCI_VERSION_NONE, SCI_VERSION_2, SIGFOR_ALL, "i(.*)", NULL, NULL }, // subop
#ifdef ENABLE_SCI32
- { "DoAudio", kDoAudio32, SIG_SINCE_SCI21, SIGFOR_ALL, "(.*)", kDoAudio_subops, NULL },
+ { "DoAudio", kDoAudio32, SIG_SINCE_SCI21, SIGFOR_ALL, "(.*)", kDoAudio_subops, NULL },
#endif
{ MAP_CALL(DoAvoider), SIG_EVERYWHERE, "o(i)", NULL, NULL },
{ MAP_CALL(DoBresen), SIG_EVERYWHERE, "o", NULL, NULL },
@@ -666,15 +685,23 @@ static SciKernelMapEntry s_kernelMap[] = {
{ MAP_CALL(GetMenu), SIG_EVERYWHERE, "i.", NULL, NULL },
{ MAP_CALL(GetMessage), SIG_EVERYWHERE, "iiir", NULL, NULL },
{ MAP_CALL(GetPort), SIG_EVERYWHERE, "", NULL, NULL },
- { MAP_CALL(GetSaveDir), SIG_SCI32, SIGFOR_ALL, "(r*)", NULL, NULL },
- { MAP_CALL(GetSaveDir), SIG_EVERYWHERE, "", NULL, NULL },
+#ifdef ENABLE_SCI32
+ { MAP_CALL(GetSaveDir), SIG_THRU_SCI21EARLY, SIGFOR_ALL, "(r)", NULL, NULL },
+#endif
+ { MAP_CALL(GetSaveDir), SIG_SCI16, SIGFOR_ALL, "", NULL, NULL },
+#ifdef ENABLE_SCI32
+ { "GetSaveFiles", kGetSaveFiles32, SIG_THRU_SCI21EARLY, SIGFOR_ALL, "rrr", NULL, NULL },
+#endif
{ MAP_CALL(GetSaveFiles), SIG_EVERYWHERE, "rrr", NULL, NULL },
{ MAP_CALL(GetTime), SIG_EVERYWHERE, "(i)", NULL, NULL },
{ MAP_CALL(GlobalToLocal), SIG_SCI16, SIGFOR_ALL, "o", NULL, NULL },
#ifdef ENABLE_SCI32
{ "GlobalToLocal", kGlobalToLocal32, SIG_SCI32, SIGFOR_ALL, "oo", NULL, NULL },
#endif
- { MAP_CALL(Graph), SIG_EVERYWHERE, NULL, kGraph_subops, NULL },
+ { MAP_CALL(Graph), SIG_SCI16, SIGFOR_ALL, NULL, kGraph_subops, NULL },
+#ifdef ENABLE_SCI32
+ { MAP_EMPTY(Graph), SIG_SCI32, SIGFOR_ALL, "(.*)", NULL, NULL },
+#endif
{ MAP_CALL(HaveMouse), SIG_EVERYWHERE, "", NULL, NULL },
{ MAP_CALL(HiliteControl), SIG_EVERYWHERE, "o", NULL, NULL },
{ MAP_CALL(InitBresen), SIG_EVERYWHERE, "o(i)", NULL, NULL },
@@ -729,9 +756,15 @@ static SciKernelMapEntry s_kernelMap[] = {
{ MAP_CALL(ResCheck), SIG_EVERYWHERE, "ii(iiii)", NULL, NULL },
{ MAP_CALL(RespondsTo), SIG_EVERYWHERE, ".i", NULL, NULL },
{ MAP_CALL(RestartGame), SIG_EVERYWHERE, "", NULL, NULL },
+#ifdef ENABLE_SCI32
+ { "RestoreGame", kRestoreGame32, SIG_THRU_SCI21EARLY, SIGFOR_ALL, "[r0]i[r0]", NULL, NULL },
+#endif
{ MAP_CALL(RestoreGame), SIG_EVERYWHERE, "[r0]i[r0]", NULL, NULL },
{ MAP_CALL(Said), SIG_EVERYWHERE, "[r0]", NULL, NULL },
- { MAP_CALL(SaveGame), SIG_EVERYWHERE, "[r0]i[r0](r0)", NULL, NULL },
+#ifdef ENABLE_SCI32
+ { "SaveGame", kSaveGame32, SIG_THRU_SCI21EARLY, SIGFOR_ALL, "[r0]i[r0][r0]", NULL, NULL },
+#endif
+ { MAP_CALL(SaveGame), SIG_SCI16, SIGFOR_ALL, "[r0]i[r0](r0)", NULL, NULL },
{ MAP_CALL(ScriptID), SIG_EVERYWHERE, "[io](i)", NULL, NULL },
{ MAP_CALL(SetCursor), SIG_SCI11, SIGFOR_ALL, "i(i)(i)(i)(iiiiii)", NULL, NULL },
{ MAP_CALL(SetCursor), SIG_SCI16, SIGFOR_ALL, "i(i)(i)(i)(i)", NULL, kSetCursor_workarounds },
@@ -805,13 +838,13 @@ static SciKernelMapEntry s_kernelMap[] = {
#ifdef ENABLE_SCI32
// SCI2 Kernel Functions
// TODO: whoever knows his way through those calls, fix the signatures.
- { "TextSize", kTextSize32, SIG_UNTIL_SCI21EARLY, SIGFOR_ALL, "r[r0]i(i)", NULL, NULL },
- { MAP_DUMMY(TextColors), SIG_UNTIL_SCI21EARLY, SIGFOR_ALL, "(.*)", NULL, NULL },
- { MAP_DUMMY(TextFonts), SIG_UNTIL_SCI21EARLY, SIGFOR_ALL, "(.*)", NULL, NULL },
+ { "TextSize", kTextSize32, SIG_THRU_SCI21EARLY, SIGFOR_ALL, "r[r0]i(i)", NULL, NULL },
+ { MAP_DUMMY(TextColors), SIG_THRU_SCI21EARLY, SIGFOR_ALL, "(.*)", NULL, NULL },
+ { MAP_DUMMY(TextFonts), SIG_THRU_SCI21EARLY, SIGFOR_ALL, "(.*)", NULL, NULL },
{ MAP_CALL(AddPlane), SIG_EVERYWHERE, "o", NULL, NULL },
{ MAP_CALL(AddScreenItem), SIG_EVERYWHERE, "o", NULL, NULL },
- { MAP_CALL(Array), SIG_EVERYWHERE, "(.*)", NULL, NULL },
+ { MAP_CALL(Array), SIG_EVERYWHERE, "i(.*)", kArray_subops, NULL },
{ MAP_CALL(CreateTextBitmap), SIG_EVERYWHERE, "i(.*)", NULL, NULL },
{ MAP_CALL(DeletePlane), SIG_EVERYWHERE, "o", NULL, NULL },
{ MAP_CALL(DeleteScreenItem), SIG_EVERYWHERE, "o", NULL, NULL },
@@ -840,8 +873,8 @@ static SciKernelMapEntry s_kernelMap[] = {
{ MAP_CALL(UpdateScreenItem), SIG_EVERYWHERE, "o", NULL, NULL },
{ MAP_CALL(ObjectIntersect), SIG_EVERYWHERE, "oo", NULL, NULL },
{ MAP_CALL(EditText), SIG_EVERYWHERE, "o", NULL, NULL },
- { MAP_CALL(MakeSaveCatName), SIG_EVERYWHERE, "rr", NULL, NULL },
- { MAP_CALL(MakeSaveFileName), SIG_EVERYWHERE, "rri", NULL, NULL },
+ { MAP_CALL(MakeSaveCatName), SIG_THRU_SCI21EARLY, SIGFOR_ALL, "rr", NULL, NULL },
+ { MAP_CALL(MakeSaveFileName), SIG_THRU_SCI21EARLY, SIGFOR_ALL, "rri", NULL, NULL },
{ MAP_CALL(SetScroll), SIG_EVERYWHERE, "oiiii(i)(i)", NULL, NULL },
{ MAP_CALL(PalCycle), SIG_EVERYWHERE, "(.*)", kPalCycle_subops, NULL },
@@ -879,9 +912,9 @@ static SciKernelMapEntry s_kernelMap[] = {
{ MAP_DUMMY(MarkMemory), SIG_EVERYWHERE, "(.*)", NULL, NULL },
{ MAP_DUMMY(GetHighItemPri), SIG_EVERYWHERE, "(.*)", NULL, NULL },
{ MAP_DUMMY(ShowStylePercent), SIG_EVERYWHERE, "(.*)", NULL, NULL },
- { MAP_DUMMY(InvertRect), SIG_UNTIL_SCI21EARLY, SIGFOR_ALL, "(.*)", NULL, NULL },
+ { MAP_DUMMY(InvertRect), SIG_THRU_SCI21EARLY, SIGFOR_ALL, "(.*)", NULL, NULL },
{ MAP_DUMMY(InputText), SIG_EVERYWHERE, "(.*)", NULL, NULL },
- { MAP_CALL(TextWidth), SIG_UNTIL_SCI21EARLY, SIGFOR_ALL, "ri", NULL, NULL },
+ { MAP_CALL(TextWidth), SIG_THRU_SCI21EARLY, SIGFOR_ALL, "ri", NULL, NULL },
{ MAP_DUMMY(PointSize), SIG_EVERYWHERE, "(.*)", NULL, NULL },
// SCI2.1 Kernel Functions
@@ -917,14 +950,14 @@ static SciKernelMapEntry s_kernelMap[] = {
// stub in the original interpreters, but it gets called by the game scripts.
// Usually, it gets called with a string (which is the output format) and a
// variable number of parameters
- { MAP_EMPTY(PrintDebug), SIG_EVERYWHERE, "(.*)", NULL, NULL },
+ { MAP_CALL(PrintDebug), SIG_SCI32, SIGFOR_ALL, "r(.*)", NULL, NULL },
// SetWindowsOption is used to set Windows specific options, like for example the title bar visibility of
// the game window in Phantasmagoria 2. We ignore these settings completely.
- { MAP_EMPTY(SetWindowsOption), SIG_EVERYWHERE, "ii", NULL, NULL },
+ { MAP_EMPTY(SetWindowsOption), SIG_EVERYWHERE, "ii", NULL, NULL },
// Debug function called whenever the current room changes
- { MAP_EMPTY(NewRoom), SIG_EVERYWHERE, "(.*)", NULL, NULL },
+ { MAP_EMPTY(NewRoom), SIG_EVERYWHERE, "(.*)", NULL, NULL },
// Unused / debug SCI2.1 unused functions, always mapped to kDummy
@@ -957,6 +990,7 @@ static SciKernelMapEntry s_kernelMap[] = {
// SetHotRectangles - used by Phantasmagoria 1, script 64981 (used in the chase scene)
// <lskovlun> The idea, if I understand correctly, is that the engine generates events
// of a special HotRect type continuously when the mouse is on that rectangle
+ { MAP_CALL(SetHotRectangles), SIG_SINCE_SCI21MID, SIGFOR_ALL, "i(r)", NULL, NULL },
// Used by SQ6 to scroll through the inventory via the up/down buttons
{ MAP_CALL(MovePlaneItems), SIG_SINCE_SCI21, SIGFOR_ALL, "oii(i)", NULL, NULL },
diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp
index 9250e0fc13..a00630622e 100644
--- a/engines/sci/engine/kevent.cpp
+++ b/engines/sci/engine/kevent.cpp
@@ -73,7 +73,7 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) {
g_debug_simulated_key = 0;
return make_reg(0, 1);
}
-
+
curEvent = g_sci->getEventManager()->getSciEvent(mask);
if (s->_delayedRestoreGame) {
@@ -236,7 +236,7 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) {
// check bugs #3058865 and #3127824
if (s->_gameIsBenchmarking) {
// Game is benchmarking, don't add a delay
- } else {
+ } else if (getSciVersion() < SCI_VERSION_2) {
g_system->delayMillis(10);
}
@@ -369,6 +369,30 @@ reg_t kLocalToGlobal32(EngineState *s, int argc, reg_t *argv) {
return make_reg(0, visible);
}
+
+reg_t kSetHotRectangles(EngineState *s, int argc, reg_t *argv) {
+ if (argc == 1) {
+ g_sci->getEventManager()->setHotRectanglesActive((bool)argv[0].toUint16());
+ return s->r_acc;
+ }
+
+ const int16 numRects = argv[0].toSint16();
+ SciArray &hotRects = *s->_segMan->lookupArray(argv[1]);
+
+ Common::Array<Common::Rect> rects;
+ rects.resize(numRects);
+
+ for (int16 i = 0; i < numRects; ++i) {
+ rects[i].left = hotRects.getAsInt16(i * 4);
+ rects[i].top = hotRects.getAsInt16(i * 4 + 1);
+ rects[i].right = hotRects.getAsInt16(i * 4 + 2) + 1;
+ rects[i].bottom = hotRects.getAsInt16(i * 4 + 3) + 1;
+ }
+
+ g_sci->getEventManager()->setHotRectanglesActive(true);
+ g_sci->getEventManager()->setHotRectangles(rects);
+ return s->r_acc;
+}
#endif
} // End of namespace Sci
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index e8b9d0461d..6aad256664 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -51,6 +51,7 @@ extern FileHandle *getFileFromHandle(EngineState *s, uint handle);
extern int fgets_wrapper(EngineState *s, char *dest, int maxsize, int handle);
extern void listSavegames(Common::Array<SavegameDesc> &saves);
extern int findSavegame(Common::Array<SavegameDesc> &saves, int16 savegameId);
+extern bool fillSavegameDesc(const Common::String &filename, SavegameDesc *desc);
/**
* Writes the cwd to the supplied address and returns the address in acc.
@@ -158,33 +159,37 @@ reg_t kDeviceInfo(EngineState *s, int argc, reg_t *argv) {
}
reg_t kCheckFreeSpace(EngineState *s, int argc, reg_t *argv) {
- if (argc > 1) {
- // SCI1.1/SCI32
- // TODO: don't know if those are right for SCI32 as well
- // Please note that sierra sci supported both calls either w/ or w/o opcode in SCI1.1
- switch (argv[1].toUint16()) {
- case 0: // return saved game size
- return make_reg(0, 0); // we return 0
-
- case 1: // return free harddisc space (shifted right somehow)
- return make_reg(0, 0x7fff); // we return maximum
-
- case 2: // same as call w/o opcode
- break;
- return make_reg(0, 1);
-
- default:
- error("kCheckFreeSpace: called with unknown sub-op %d", argv[1].toUint16());
- }
+ // A file path to test is also passed to this function as a separate
+ // argument, but we do not actually check anything, so it is unused
+
+ enum {
+ kSaveGameSize = 0,
+ kFreeDiskSpace = 1,
+ kEnoughSpaceToSave = 2
+ };
+
+ int16 subop;
+ // In SCI2.1mid, the call is moved into kFileIO and the arguments are
+ // flipped
+ if (getSciVersion() >= SCI_VERSION_2_1_MIDDLE) {
+ subop = argc > 0 ? argv[0].toSint16() : 2;
+ } else {
+ subop = argc > 1 ? argv[1].toSint16() : 2;
}
- Common::String path = s->_segMan->getString(argv[0]);
+ switch (subop) {
+ case kSaveGameSize:
+ return make_reg(0, 0);
- debug(3, "kCheckFreeSpace(%s)", path.c_str());
- // We simply always pretend that there is enough space. The alternative
- // would be to write a big test file, which is not nice on systems where
- // doing so is very slow.
- return make_reg(0, 1);
+ case kFreeDiskSpace: // in KiB; up to 32MiB maximum
+ return make_reg(0, 0x7fff);
+
+ case kEnoughSpaceToSave:
+ return make_reg(0, 1);
+
+ default:
+ error("kCheckFreeSpace: called with unknown sub-op %d", subop);
+ }
}
reg_t kValidPath(EngineState *s, int argc, reg_t *argv) {
@@ -224,6 +229,45 @@ reg_t kGetSavedCD(EngineState *s, int argc, reg_t *argv) {
// ---- FileIO operations -----------------------------------------------------
+#ifdef ENABLE_SCI32
+static bool isSaveCatalogue(const Common::String &name) {
+ return name == "autosave.cat" || name.hasSuffix("sg.cat");
+}
+
+// SCI32 save game scripts check for, and write directly to, the save game
+// catalogue. Since ScummVM does not use these catalogues, when looking for a
+// catalogue, we instead check for save games within ScummVM that are logically
+// equivalent to the behaviour of SSCI.
+static bool saveCatalogueExists(const Common::String &name) {
+ bool exists = false;
+ Common::SaveFileManager *saveFileMan = g_sci->getSaveFileManager();
+
+ // There will always be one save game in some games, the "new game"
+ // game, which should be ignored when deciding if there are any save
+ // games available
+ uint numPermanentSaves;
+ switch (g_sci->getGameId()) {
+ case GID_TORIN:
+ case GID_LSL7:
+ case GID_LIGHTHOUSE:
+ numPermanentSaves = 1;
+ break;
+ default:
+ numPermanentSaves = 0;
+ break;
+ }
+
+ // Torin uses autosave.cat; LSL7 uses autosvsg.cat
+ if (name == "autosave.cat" || name == "autosvsg.cat") {
+ exists = !saveFileMan->listSavefiles(g_sci->getSavegameName(0)).empty();
+ } else {
+ exists = saveFileMan->listSavefiles(g_sci->getSavegamePattern()).size() > numPermanentSaves;
+ }
+
+ return exists;
+}
+#endif
+
reg_t kFileIO(EngineState *s, int argc, reg_t *argv) {
if (!s)
return make_reg(0, getSciVersion());
@@ -233,9 +277,13 @@ reg_t kFileIO(EngineState *s, int argc, reg_t *argv) {
reg_t kFileIOOpen(EngineState *s, int argc, reg_t *argv) {
Common::String name = s->_segMan->getString(argv[0]);
- // SCI32 can call K_FILEIO_OPEN with only one argument. It seems to
- // just be checking if it exists.
- int mode = (argc < 2) ? (int)_K_FILE_MODE_OPEN_OR_FAIL : argv[1].toUint16();
+ if (name.empty()) {
+ // Happens many times during KQ1 (e.g. when typing something)
+ debugC(kDebugLevelFile, "Attempted to open a file with an empty filename");
+ return SIGNAL_REG;
+ }
+
+ int mode = argv[1].toUint16();
bool unwrapFilename = true;
// SQ4 floppy prepends /\ to the filenames
@@ -253,94 +301,158 @@ reg_t kFileIOOpen(EngineState *s, int argc, reg_t *argv) {
return SIGNAL_REG;
}
- // Torin's autosave system checks for the presence of autosave.cat
- // by opening it. Since we don't use .cat files, we instead check
- // for autosave.000 or autosave.001.
- //
- // The same logic is being followed for torinsg.cat - this shows
- // the "Open..." button when continuing a game.
- //
- // This has the added benefit of not detecting an SSCI autosave.cat
- // accompanying SSCI autosave files that we wouldn't be able to load.
- if (g_sci->getGameId() == GID_TORIN && (name == "autosave.cat" || name == "torinsg.cat")) {
- Common::SaveFileManager *saveFileMan = g_sci->getSaveFileManager();
- const Common::String pattern = (name == "autosave.cat") ? g_sci->wrapFilename("autosave.###") : g_sci->getSavegamePattern();
- bool exists = !saveFileMan->listSavefiles(pattern).empty();
- if (exists) {
- // Dummy handle. Torin only checks if this is SIGNAL_REG,
- // and calls kFileIOClose on it.
- return make_reg(0, VIRTUALFILE_HANDLE_SCI32SAVE);
- } else {
- return SIGNAL_REG;
+#ifdef ENABLE_SCI32
+ // GK1, GK2, KQ7, LSL6hires, Phant1, PQ4, PQ:SWAT, and SQ6 read in
+ // their game version from the VERSION file
+ if (name.compareToIgnoreCase("version") == 0) {
+ unwrapFilename = false;
+
+ // LSL6hires version is in a file with an empty extension
+ if (Common::File::exists(name + ".")) {
+ name += ".";
}
}
- if (name.empty()) {
- // Happens many times during KQ1 (e.g. when typing something)
- debugC(kDebugLevelFile, "Attempted to open a file with an empty filename");
- return SIGNAL_REG;
- }
- debugC(kDebugLevelFile, "kFileIO(open): %s, 0x%x", name.c_str(), mode);
+ if (g_sci->getGameId() == GID_SHIVERS && name.hasSuffix(".SG")) {
+ // Shivers stores the name and score of save games in separate %d.SG
+ // files, which are used by the save/load screen
+ if (mode == _K_FILE_MODE_OPEN_OR_CREATE || mode == _K_FILE_MODE_CREATE) {
+ // Suppress creation of the SG file, since it is not necessary
+ debugC(kDebugLevelFile, "Not creating unused file %s", name.c_str());
+ return SIGNAL_REG;
+ } else if (mode == _K_FILE_MODE_OPEN_OR_FAIL) {
+ // Create a virtual file containing the save game description
+ // and slot number, as the game scripts expect.
+ int saveNo;
+ sscanf(name.c_str(), "%d.SG", &saveNo);
+ saveNo += kSaveIdShift;
+
+ SavegameDesc save;
+ fillSavegameDesc(g_sci->getSavegameName(saveNo), &save);
+
+ Common::String score;
+ if (!save.highScore) {
+ score = Common::String::format("%u", save.lowScore);
+ } else {
+ score = Common::String::format("%u%03u", save.highScore, save.lowScore);
+ }
- if (name.hasPrefix("sciAudio\\")) {
- // fan-made sciAudio extension, don't create those files and instead return a virtual handle
- return make_reg(0, VIRTUALFILE_HANDLE_SCIAUDIO);
- }
+ const uint nameLength = strlen(save.name);
+ const uint size = nameLength + /* \r\n */ 2 + score.size();
+ char *buffer = (char *)malloc(size);
+ memcpy(buffer, save.name, nameLength);
+ buffer[nameLength] = '\r';
+ buffer[nameLength + 1] = '\n';
+ memcpy(buffer + nameLength + 2, score.c_str(), score.size());
-#ifdef ENABLE_SCI32
- // Shivers is trying to store savegame descriptions and current spots in
- // separate .SG files, which are hardcoded in the scripts.
- // Essentially, there is a normal save file, created by the executable
- // and an extra hardcoded save file, created by the game scripts, probably
- // because they didn't want to modify the save/load code to add the extra
- // information.
- // Each slot in the book then has two strings, the save description and a
- // description of the current spot that the player is at. Currently, the
- // spot strings are always empty (probably related to the unimplemented
- // kString subop 14, which gets called right before this call).
- // For now, we don't allow the creation of these files, which means that
- // all the spot descriptions next to each slot description will be empty
- // (they are empty anyway). Until a viable solution is found to handle these
- // extra files and until the spot description strings are initialized
- // correctly, we resort to virtual files in order to make the load screen
- // useable. Without this code it is unusable, as the extra information is
- // always saved to 0.SG for some reason, but on restore the correct file is
- // used. Perhaps the virtual ID is not taken into account when saving.
- //
- // Future TODO: maintain spot descriptions and show them too, ideally without
- // having to return to this logic of extra hardcoded files.
- if (g_sci->getGameId() == GID_SHIVERS && name.hasSuffix(".SG")) {
+ const uint handle = findFreeFileHandle(s);
+
+ s->_fileHandles[handle]._in = new Common::MemoryReadStream((byte *)buffer, size, DisposeAfterUse::YES);
+ s->_fileHandles[handle]._out = nullptr;
+ s->_fileHandles[handle]._name = "";
+
+ return make_reg(0, handle);
+ }
+ } else if (g_sci->getGameId() == GID_MOTHERGOOSEHIRES && name.hasSuffix(".DTA")) {
+ // MGDX stores the name and avatar ID in separate %d.DTA files, which
+ // are used by the save/load screen
if (mode == _K_FILE_MODE_OPEN_OR_CREATE || mode == _K_FILE_MODE_CREATE) {
- // Game scripts are trying to create a file with the save
- // description, stop them here
+ // Suppress creation of the DTA file, since it is not necessary
debugC(kDebugLevelFile, "Not creating unused file %s", name.c_str());
return SIGNAL_REG;
} else if (mode == _K_FILE_MODE_OPEN_OR_FAIL) {
// Create a virtual file containing the save game description
// and slot number, as the game scripts expect.
- int slotNumber;
- sscanf(name.c_str(), "%d.SG", &slotNumber);
+ int saveNo;
+ sscanf(name.c_str(), "%d.DTA", &saveNo);
+ saveNo += kSaveIdShift;
- Common::Array<SavegameDesc> saves;
- listSavegames(saves);
- int savegameNr = findSavegame(saves, slotNumber - SAVEGAMEID_OFFICIALRANGE_START);
+ SavegameDesc save;
+ fillSavegameDesc(g_sci->getSavegameName(saveNo), &save);
- int size = strlen(saves[savegameNr].name) + 2;
- char *buf = (char *)malloc(size);
- strcpy(buf, saves[savegameNr].name);
- buf[size - 1] = 0; // Spot description (empty)
+ const Common::String avatarId = Common::String::format("%02d", save.avatarId);
+ const uint nameLength = strlen(save.name);
+ const uint size = nameLength + /* \r\n */ 2 + avatarId.size() + 1;
+ char *buffer = (char *)malloc(size);
+ memcpy(buffer, save.name, nameLength);
+ buffer[nameLength] = '\r';
+ buffer[nameLength + 1] = '\n';
+ memcpy(buffer + nameLength + 2, avatarId.c_str(), avatarId.size() + 1);
- uint handle = findFreeFileHandle(s);
+ const uint handle = findFreeFileHandle(s);
- s->_fileHandles[handle]._in = new Common::MemoryReadStream((byte *)buf, size, DisposeAfterUse::YES);
+ s->_fileHandles[handle]._in = new Common::MemoryReadStream((byte *)buffer, size, DisposeAfterUse::YES);
s->_fileHandles[handle]._out = nullptr;
s->_fileHandles[handle]._name = "";
return make_reg(0, handle);
}
+ } else if (g_sci->getGameId() == GID_KQ7) {
+ // KQ7 creates a temp.tmp file to perform an atomic rewrite of the
+ // catalogue, but since we do not create catalogues for most SCI32
+ // games, ignore the write
+ if (name == "temp.tmp") {
+ return make_reg(0, VIRTUALFILE_HANDLE_SCI32SAVE);
+ }
+
+ // KQ7 tries to read out game information from catalogues directly
+ // instead of using the standard kSaveGetFiles function
+ if (name == "kq7cdsg.cat") {
+ if (mode == _K_FILE_MODE_OPEN_OR_CREATE || mode == _K_FILE_MODE_CREATE) {
+ // Suppress creation of the catalogue file, since it is not necessary
+ debugC(kDebugLevelFile, "Not creating unused file %s", name.c_str());
+ return SIGNAL_REG;
+ } else if (mode == _K_FILE_MODE_OPEN_OR_FAIL) {
+ Common::Array<SavegameDesc> saves;
+ listSavegames(saves);
+
+ const uint recordSize = sizeof(int16) + SCI_MAX_SAVENAME_LENGTH;
+ const uint numSaves = MIN<uint>(saves.size(), 10);
+ const uint size = numSaves * recordSize + /* terminator */ 2;
+ byte *const buffer = (byte *)malloc(size);
+
+ byte *out = buffer;
+ for (uint i = 0; i < numSaves; ++i) {
+ WRITE_UINT16(out, saves[i].id - kSaveIdShift);
+ Common::strlcpy((char *)out + sizeof(int16), saves[i].name, SCI_MAX_SAVENAME_LENGTH);
+ out += recordSize;
+ }
+ WRITE_UINT16(out, 0xFFFF);
+
+ const uint handle = findFreeFileHandle(s);
+ s->_fileHandles[handle]._in = new Common::MemoryReadStream(buffer, size, DisposeAfterUse::YES);
+ s->_fileHandles[handle]._out = nullptr;
+ s->_fileHandles[handle]._name = "";
+
+ return make_reg(0, handle);
+ }
+ }
+ }
+
+ // See kMakeSaveCatName
+ if (name == "fake.cat") {
+ return make_reg(0, VIRTUALFILE_HANDLE_SCI32SAVE);
+ }
+
+ if (isSaveCatalogue(name)) {
+ const bool exists = saveCatalogueExists(name);
+ if (exists) {
+ // Dummy handle is used to represent the catalogue and ignore any
+ // direct game script writes
+ return make_reg(0, VIRTUALFILE_HANDLE_SCI32SAVE);
+ } else {
+ return SIGNAL_REG;
+ }
}
#endif
+ debugC(kDebugLevelFile, "kFileIO(open): %s, 0x%x", name.c_str(), mode);
+
+ if (name.hasPrefix("sciAudio\\")) {
+ // fan-made sciAudio extension, don't create those files and instead return a virtual handle
+ return make_reg(0, VIRTUALFILE_HANDLE_SCIAUDIO);
+ }
+
// QFG import rooms get a virtual filelisting instead of an actual one
if (g_sci->inQfGImportRoom()) {
// We need to find out what the user actually selected, "savedHeroes" is
@@ -363,7 +475,7 @@ reg_t kFileIOClose(EngineState *s, int argc, reg_t *argv) {
if (handle >= VIRTUALFILE_HANDLE_START) {
// it's a virtual handle? ignore it
- return SIGNAL_REG;
+ return getSciVersion() >= SCI_VERSION_2 ? TRUE_REG : SIGNAL_REG;
}
FileHandle *f = getFileFromHandle(s, handle);
@@ -371,7 +483,7 @@ reg_t kFileIOClose(EngineState *s, int argc, reg_t *argv) {
f->close();
if (getSciVersion() <= SCI_VERSION_0_LATE)
return s->r_acc; // SCI0 semantics: no value returned
- return SIGNAL_REG;
+ return getSciVersion() >= SCI_VERSION_2 ? TRUE_REG : SIGNAL_REG;
}
if (getSciVersion() <= SCI_VERSION_0_LATE)
@@ -403,18 +515,37 @@ reg_t kFileIOReadRaw(EngineState *s, int argc, reg_t *argv) {
reg_t kFileIOWriteRaw(EngineState *s, int argc, reg_t *argv) {
uint16 handle = argv[0].toUint16();
uint16 size = argv[2].toUint16();
+
+#ifdef ENABLE_SCI32
+ if (handle == VIRTUALFILE_HANDLE_SCI32SAVE) {
+ return make_reg(0, size);
+ }
+#endif
+
char *buf = new char[size];
+ uint bytesWritten = 0;
bool success = false;
s->_segMan->memcpy((byte *)buf, argv[1], size);
debugC(kDebugLevelFile, "kFileIO(writeRaw): %d, %d", handle, size);
FileHandle *f = getFileFromHandle(s, handle);
if (f) {
- f->_out->write(buf, size);
- success = true;
+ bytesWritten = f->_out->write(buf, size);
+ success = !f->_out->err();
}
delete[] buf;
+
+#ifdef ENABLE_SCI32
+ if (getSciVersion() >= SCI_VERSION_2) {
+ if (!success) {
+ return SIGNAL_REG;
+ }
+
+ return make_reg(0, bytesWritten);
+ }
+#endif
+
if (success)
return NULL_REG;
return make_reg(0, 6); // DOS - invalid handle
@@ -444,19 +575,35 @@ reg_t kFileIOUnlink(EngineState *s, int argc, reg_t *argv) {
int savedir_nr = saves[slotNum].id;
name = g_sci->getSavegameName(savedir_nr);
result = saveFileMan->removeSavefile(name);
+#ifdef ENABLE_SCI32
} else if (getSciVersion() >= SCI_VERSION_2) {
+ // Special case for KQ7, basically identical to the SQ4 case above,
+ // where the game hardcodes its save game names
+ if (name.hasPrefix("kq7cdsg.")) {
+ int saveNo = atoi(name.c_str() + name.size() - 3);
+ name = g_sci->getSavegameName(saveNo + kSaveIdShift);
+ }
+
// The file name may be already wrapped, so check both cases
result = saveFileMan->removeSavefile(name);
if (!result) {
const Common::String wrappedName = g_sci->wrapFilename(name);
result = saveFileMan->removeSavefile(wrappedName);
}
+#endif
} else {
const Common::String wrappedName = g_sci->wrapFilename(name);
result = saveFileMan->removeSavefile(wrappedName);
}
debugC(kDebugLevelFile, "kFileIO(unlink): %s", name.c_str());
+
+#ifdef ENABLE_SCI32
+ if (getSciVersion() >= SCI_VERSION_2) {
+ return make_reg(0, result);
+ }
+#endif
+
if (result)
return NULL_REG;
return make_reg(0, 2); // DOS - file not found error code
@@ -567,6 +714,12 @@ reg_t kFileIOExists(EngineState *s, int argc, reg_t *argv) {
return NULL_REG;
}
+#ifdef ENABLE_SCI32
+ if (isSaveCatalogue(name)) {
+ return saveCatalogueExists(name) ? TRUE_REG : NULL_REG;
+ }
+#endif
+
// TODO: It may apparently be worth caching the existence of
// phantsg.dir, and possibly even keeping it open persistently
@@ -662,7 +815,7 @@ reg_t kFileIOWriteByte(EngineState *s, int argc, reg_t *argv) {
FileHandle *f = getFileFromHandle(s, argv[0].toUint16());
if (f)
f->_out->writeByte(argv[1].toUint16() & 0xff);
- return s->r_acc; // FIXME: does this really not return anything?
+ return s->r_acc;
}
reg_t kFileIOReadWord(EngineState *s, int argc, reg_t *argv) {
@@ -676,27 +829,13 @@ reg_t kFileIOWriteWord(EngineState *s, int argc, reg_t *argv) {
FileHandle *f = getFileFromHandle(s, argv[0].toUint16());
if (f)
f->_out->writeUint16LE(argv[1].toUint16());
- return s->r_acc; // FIXME: does this really not return anything?
+ return s->r_acc;
}
-reg_t kFileIOCreateSaveSlot(EngineState *s, int argc, reg_t *argv) {
- // Used in Shivers when the user enters his name on the guest book
- // in the beginning to start the game.
-
- // Creates a new save slot, and returns if the operation was successful
-
- // Argument 0 denotes the save slot as a negative integer, 2 means "0"
- // Argument 1 is a string, with the file name, obtained from kSave(5).
- // The interpreter checks if it can be written to (by checking for free
- // disk space and write permissions)
-
- // We don't really use or need any of this...
-
- uint16 saveSlot = argv[0].toUint16();
- char* fileName = s->_segMan->lookupString(argv[1])->getRawData();
- warning("kFileIOCreateSaveSlot(%d, '%s')", saveSlot, fileName);
-
- return TRUE_REG; // slot creation was successful
+reg_t kFileIOGetCWD(EngineState *s, int argc, reg_t *argv) {
+ SciArray &fileName = *s->_segMan->lookupArray(argv[0]);
+ fileName.fromString("C:\\SIERRA\\");
+ return argv[0];
}
reg_t kFileIOIsValidDirectory(EngineState *s, int argc, reg_t *argv) {
@@ -721,6 +860,13 @@ reg_t kSave(EngineState *s, int argc, reg_t *argv) {
#endif
reg_t kSaveGame(EngineState *s, int argc, reg_t *argv) {
+ // slot 0 is the ScummVM auto-save slot, which is not used by us, but is
+ // still reserved
+ enum {
+ SAVEGAMESLOT_FIRST = 1,
+ SAVEGAMESLOT_LAST = 99
+ };
+
Common::String game_id = !argv[0].isNull() ? s->_segMan->getString(argv[0]) : "";
int16 virtualId = argv[1].toSint16();
int16 savegameId = -1;
@@ -736,13 +882,6 @@ reg_t kSaveGame(EngineState *s, int argc, reg_t *argv) {
return NULL_REG;
}
- // Torin has two sets of saves: autosave.### and torinsg.###, both with
- // their own slots and .cat file.
- // The autosave system uses autosave.000 and autosave.001.
- // It also checks the presence of autosave.cat to determine if it should
- // show the chapter selection menu on startup. (See kFileIOOpen.)
- bool torinAutosave = g_sci->getGameId() == GID_TORIN && game_id == "Autosave";
-
if (argv[0].isNull()) {
// Direct call, from a patched Game::save
if ((argv[1] != SIGNAL_REG) || (!argv[2].isNull()))
@@ -761,14 +900,6 @@ reg_t kSaveGame(EngineState *s, int argc, reg_t *argv) {
g_sci->_soundCmd->pauseAll(false); // unpause music (we can't have it paused during save)
if (savegameId < 0)
return NULL_REG;
-
- } else if (torinAutosave) {
- if (argv[2].isNull())
- error("kSaveGame: called with description being NULL");
- game_description = s->_segMan->getString(argv[2]);
- savegameId = virtualId;
-
- debug(3, "kSaveGame(%s,%d,%s,%s) [Torin autosave]", game_id.c_str(), virtualId, game_description.c_str(), version.c_str());
} else {
// Real call from script
if (argv[2].isNull())
@@ -844,10 +975,6 @@ reg_t kSaveGame(EngineState *s, int argc, reg_t *argv) {
Common::SaveFileManager *saveFileMan = g_sci->getSaveFileManager();
Common::OutSaveFile *out;
- if (torinAutosave) {
- filename = g_sci->wrapFilename(Common::String::format("autosave.%03d", savegameId));
- }
-
out = saveFileMan->openForSaving(filename);
if (!out) {
warning("Error opening savegame \"%s\" for writing", filename.c_str());
@@ -876,10 +1003,6 @@ reg_t kRestoreGame(EngineState *s, int argc, reg_t *argv) {
debug(3, "kRestoreGame(%s,%d)", game_id.c_str(), savegameId);
-
- // See comment in kSaveGame
- bool torinAutosave = g_sci->getGameId() == GID_TORIN && game_id == "Autosave";
-
if (argv[0].isNull()) {
// Direct call, either from launcher or from a patched Game::restore
if (savegameId == -1) {
@@ -895,7 +1018,7 @@ reg_t kRestoreGame(EngineState *s, int argc, reg_t *argv) {
pausedMusic = true;
}
// don't adjust ID of the saved game, it's already correct
- } else if (!torinAutosave) {
+ } else {
if (g_sci->getGameId() == GID_JONES) {
// Jones has one save slot only
savegameId = 0;
@@ -912,9 +1035,8 @@ reg_t kRestoreGame(EngineState *s, int argc, reg_t *argv) {
s->r_acc = NULL_REG; // signals success
Common::Array<SavegameDesc> saves;
- if (!torinAutosave)
- listSavegames(saves);
- if (!torinAutosave && findSavegame(saves, savegameId) == -1) {
+ listSavegames(saves);
+ if (findSavegame(saves, savegameId) == -1) {
s->r_acc = TRUE_REG;
warning("Savegame ID %d not found", savegameId);
} else {
@@ -922,10 +1044,6 @@ reg_t kRestoreGame(EngineState *s, int argc, reg_t *argv) {
Common::String filename = g_sci->getSavegameName(savegameId);
Common::SeekableReadStream *in;
- if (torinAutosave) {
- filename = g_sci->wrapFilename(Common::String::format("autosave.%03d", savegameId));
- }
-
in = saveFileMan->openForLoading(filename);
if (in) {
// found a savegame file
@@ -998,10 +1116,6 @@ reg_t kCheckSaveGame(EngineState *s, int argc, reg_t *argv) {
}
reg_t kGetSaveFiles(EngineState *s, int argc, reg_t *argv) {
- Common::String game_id = s->_segMan->getString(argv[0]);
-
- debug(3, "kGetSaveFiles(%s)", game_id.c_str());
-
// Scripts ask for current save files, we can assume that if afterwards they ask us to create a new slot they really
// mean new slot instead of overwriting the old one
s->_lastSaveVirtualId = SAVEGAMEID_OFFICIALRANGE_START;
@@ -1010,6 +1124,10 @@ reg_t kGetSaveFiles(EngineState *s, int argc, reg_t *argv) {
listSavegames(saves);
uint totalSaves = MIN<uint>(saves.size(), MAX_SAVEGAME_NR);
+ Common::String game_id = s->_segMan->getString(argv[0]);
+
+ debug(3, "kGetSaveFiles(%s)", game_id.c_str());
+
reg_t *slot = s->_segMan->derefRegPtr(argv[2], totalSaves);
if (!slot) {
@@ -1037,46 +1155,205 @@ reg_t kGetSaveFiles(EngineState *s, int argc, reg_t *argv) {
#ifdef ENABLE_SCI32
-reg_t kMakeSaveCatName(EngineState *s, int argc, reg_t *argv) {
- // Normally, this creates the name of the save catalogue/directory to save into.
- // First parameter is the string to save the result into. Second is a string
- // with game parameters. We don't have a use for this at all, as we have our own
- // savegame directory management, thus we always return an empty string.
- return argv[0];
+reg_t kSaveGame32(EngineState *s, int argc, reg_t *argv) {
+ const bool isScummVMSave = argv[0].isNull();
+ Common::String gameName = "";
+ int16 saveNo;
+ Common::String saveDescription;
+ Common::String gameVersion = (argc <= 3 || argv[3].isNull()) ? "" : s->_segMan->getString(argv[3]);
+
+ if (isScummVMSave) {
+ // ScummVM call, from a patched Game::save
+ g_sci->_soundCmd->pauseAll(true);
+ GUI::SaveLoadChooser dialog(_("Save game:"), _("Save"), true);
+ saveNo = dialog.runModalWithCurrentTarget();
+ g_sci->_soundCmd->pauseAll(false);
+
+ if (saveNo < 0) {
+ // User cancelled save
+ return NULL_REG;
+ }
+
+ saveDescription = dialog.getResultString();
+ if (saveDescription.empty()) {
+ saveDescription = dialog.createDefaultSaveDescription(saveNo);
+ }
+ } else {
+ // Native script call
+ gameName = s->_segMan->getString(argv[0]);
+ saveNo = argv[1].toSint16();
+ saveDescription = argv[2].isNull() ? "" : s->_segMan->getString(argv[2]);
+ }
+
+ debugC(kDebugLevelFile, "Game name %s save %d desc %s ver %s", gameName.c_str(), saveNo, saveDescription.c_str(), gameVersion.c_str());
+
+ // Auto-save system used by Torin and LSL7
+ if (gameName == "Autosave" || gameName == "Autosv") {
+ if (saveNo == 0) {
+ // Autosave slot 0 is the autosave
+ } else {
+ // Autosave slot 1 is a "new game" save
+ saveNo = kNewGameId;
+ }
+ } else if (!isScummVMSave) {
+ // ScummVM save screen will give a pre-corrected save number, but native
+ // save-load will not
+ saveNo += kSaveIdShift;
+ }
+
+ Common::SaveFileManager *saveFileMan = g_sci->getSaveFileManager();
+ const Common::String filename = g_sci->getSavegameName(saveNo);
+ Common::OutSaveFile *saveStream = saveFileMan->openForSaving(filename);
+
+ if (saveStream == nullptr) {
+ warning("Error opening savegame \"%s\" for writing", filename.c_str());
+ return NULL_REG;
+ }
+
+ if (!gamestate_save(s, saveStream, saveDescription, gameVersion)) {
+ warning("Saving the game failed");
+ saveStream->finalize();
+ delete saveStream;
+ return NULL_REG;
+ }
+
+ saveStream->finalize();
+ if (saveStream->err()) {
+ warning("Writing the savegame failed");
+ delete saveStream;
+ return NULL_REG;
+ }
+
+ delete saveStream;
+ return TRUE_REG;
}
-reg_t kMakeSaveFileName(EngineState *s, int argc, reg_t *argv) {
- // Creates a savegame name from a slot number. Used when deleting saved games.
- // Param 0: the output buffer (same as in kMakeSaveCatName)
- // Param 1: a string with game parameters, ignored
- // Param 2: the selected slot
+reg_t kRestoreGame32(EngineState *s, int argc, reg_t *argv) {
+ const bool isScummVMRestore = argv[0].isNull();
+ Common::String gameName = "";
+ int16 saveNo = argv[1].toSint16();
+ const Common::String gameVersion = argv[2].isNull() ? "" : s->_segMan->getString(argv[2]);
+
+ if (isScummVMRestore && saveNo == -1) {
+ // ScummVM call, either from lancher or a patched Game::restore
+ g_sci->_soundCmd->pauseAll(true);
+ GUI::SaveLoadChooser dialog(_("Restore game:"), _("Restore"), false);
+ saveNo = dialog.runModalWithCurrentTarget();
+ g_sci->_soundCmd->pauseAll(false);
+
+ if (saveNo < 0) {
+ // User cancelled restore
+ return s->r_acc;
+ }
+ } else {
+ gameName = s->_segMan->getString(argv[0]);
+ }
- SciString *resultString = s->_segMan->lookupString(argv[0]);
- uint16 virtualId = argv[2].toUint16();
- if ((virtualId < SAVEGAMEID_OFFICIALRANGE_START) || (virtualId > SAVEGAMEID_OFFICIALRANGE_END))
- error("kMakeSaveFileName: invalid savegame ID specified");
- uint saveSlot = virtualId - SAVEGAMEID_OFFICIALRANGE_START;
+ if (gameName == "Autosave" || gameName == "Autosv") {
+ if (saveNo == 0) {
+ // Autosave slot 0 is the autosave
+ } else {
+ // Autosave slot 1 is a "new game" save
+ saveNo = kNewGameId;
+ }
+ } else if (!isScummVMRestore) {
+ // ScummVM save screen will give a pre-corrected save number, but native
+ // save-load will not
+ saveNo += kSaveIdShift;
+ }
+
+ Common::SaveFileManager *saveFileMan = g_sci->getSaveFileManager();
+ const Common::String filename = g_sci->getSavegameName(saveNo);
+ Common::SeekableReadStream *saveStream = saveFileMan->openForLoading(filename);
+
+ if (saveStream == nullptr) {
+ warning("Savegame #%d not found", saveNo);
+ return NULL_REG;
+ }
+
+ gamestate_restore(s, saveStream);
+ delete saveStream;
+
+ gamestate_afterRestoreFixUp(s, saveNo);
+ return TRUE_REG;
+}
+
+reg_t kCheckSaveGame32(EngineState *s, int argc, reg_t *argv) {
+ const Common::String gameName = s->_segMan->getString(argv[0]);
+ int16 saveNo = argv[1].toSint16();
+ const Common::String gameVersion = argv[2].isNull() ? "" : s->_segMan->getString(argv[2]);
Common::Array<SavegameDesc> saves;
listSavegames(saves);
- Common::String filename = g_sci->getSavegameName(saveSlot);
- resultString->fromString(filename);
+ if (gameName == "Autosave" || gameName == "Autosv") {
+ if (saveNo == 1) {
+ saveNo = kNewGameId;
+ }
+ } else {
+ saveNo += kSaveIdShift;
+ }
- return argv[0];
-}
+ SavegameDesc save;
+ if (!fillSavegameDesc(g_sci->getSavegameName(saveNo), &save)) {
+ return NULL_REG;
+ }
+
+ if (save.version < MINIMUM_SAVEGAME_VERSION ||
+ save.version > CURRENT_SAVEGAME_VERSION ||
+ save.gameVersion != gameVersion) {
-reg_t kAutoSave(EngineState *s, int argc, reg_t *argv) {
- // TODO
- // This is a timer callback, with 1 parameter: the timer object
- // (e.g. "timers").
- // It's used for auto-saving (i.e. save every X minutes, by checking
- // the elapsed time from the timer object)
+ return NULL_REG;
+ }
- // This function has to return something other than 0 to proceed
return TRUE_REG;
}
+reg_t kGetSaveFiles32(EngineState *s, int argc, reg_t *argv) {
+ // argv[0] is gameName, used in SSCI as the name of the save game catalogue
+ // but unused here since ScummVM does not support multiple catalogues
+ SciArray &descriptions = *s->_segMan->lookupArray(argv[1]);
+ SciArray &saveIds = *s->_segMan->lookupArray(argv[2]);
+
+ Common::Array<SavegameDesc> saves;
+ listSavegames(saves);
+
+ // Normally SSCI limits to 20 games per directory, but ScummVM allows more
+ // than that with games that use the standard save-load dialogue
+ descriptions.resize(SCI_MAX_SAVENAME_LENGTH * saves.size() + 1, true);
+ saveIds.resize(saves.size() + 1, true);
+
+ for (uint i = 0; i < saves.size(); ++i) {
+ const SavegameDesc &save = saves[i];
+ char *target = &descriptions.charAt(SCI_MAX_SAVENAME_LENGTH * i);
+ Common::strlcpy(target, save.name, SCI_MAX_SAVENAME_LENGTH);
+ saveIds.setFromInt16(i, save.id - kSaveIdShift);
+ }
+
+ descriptions.charAt(SCI_MAX_SAVENAME_LENGTH * saves.size()) = '\0';
+ saveIds.setFromInt16(saves.size(), 0);
+
+ return make_reg(0, saves.size());
+}
+
+reg_t kMakeSaveCatName(EngineState *s, int argc, reg_t *argv) {
+ // ScummVM does not use SCI catalogues for save games, but game scripts try
+ // to write out catalogues manually after a save game is deleted, so we need
+ // to be able to identify and ignore these IO operations by always giving
+ // back a fixed catalogue name and then ignoring it in kFileIO
+ SciArray &outCatName = *s->_segMan->lookupArray(argv[0]);
+ outCatName.fromString("fake.cat");
+ return argv[0];
+}
+
+reg_t kMakeSaveFileName(EngineState *s, int argc, reg_t *argv) {
+ SciArray &outFileName = *s->_segMan->lookupArray(argv[0]);
+ // argv[1] is the game name, which is not used by ScummVM
+ const int16 saveNo = argv[2].toSint16();
+ outFileName.fromString(g_sci->getSavegameName(saveNo + kSaveIdShift));
+ return argv[0];
+}
+
#endif
} // End of namespace Sci
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index d375a27954..c605ba29e1 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -356,7 +356,7 @@ reg_t kTextSize(EngineState *s, int argc, reg_t *argv) {
}
textWidth = dest[3].toUint16(); textHeight = dest[2].toUint16();
-
+
uint16 languageSplitter = 0;
Common::String splitText = g_sci->strSplitLanguage(text.c_str(), &languageSplitter, sep);
@@ -832,7 +832,7 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) {
uint16 languageSplitter = 0;
Common::String splitText;
-
+
switch (type) {
case SCI_CONTROLS_TYPE_BUTTON:
case SCI_CONTROLS_TYPE_TEXTEDIT:
@@ -1191,7 +1191,7 @@ reg_t kDisplay(EngineState *s, int argc, reg_t *argv) {
argc--; argc--; argv++; argv++;
text = g_sci->getKernel()->lookupText(textp, index);
}
-
+
uint16 languageSplitter = 0;
Common::String splitText = g_sci->strSplitLanguage(text.c_str(), &languageSplitter);
diff --git a/engines/sci/engine/kgraphics32.cpp b/engines/sci/engine/kgraphics32.cpp
index a33fcf3167..e5b8da4620 100644
--- a/engines/sci/engine/kgraphics32.cpp
+++ b/engines/sci/engine/kgraphics32.cpp
@@ -75,17 +75,14 @@ reg_t kBaseSetter32(EngineState *s, int argc, reg_t *argv) {
CelObjView celObj(viewId, loopNo, celNo);
const int16 scriptWidth = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth;
- const int16 scriptHeight = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight;
-
- const Ratio scaleX(scriptWidth, celObj._scaledWidth);
- const Ratio scaleY(scriptHeight, celObj._scaledHeight);
+ const Ratio scaleX(scriptWidth, celObj._xResolution);
int16 brLeft;
if (celObj._mirrorX) {
- brLeft = x - ((celObj._width - celObj._displace.x) * scaleX).toInt();
+ brLeft = x - ((celObj._width - celObj._origin.x) * scaleX).toInt();
} else {
- brLeft = x - (celObj._displace.x * scaleX).toInt();
+ brLeft = x - (celObj._origin.x * scaleX).toInt();
}
const int16 brRight = brLeft + (celObj._width * scaleX).toInt() - 1;
@@ -317,7 +314,7 @@ reg_t kText(EngineState *s, int argc, reg_t *argv) {
reg_t kTextSize32(EngineState *s, int argc, reg_t *argv) {
g_sci->_gfxText32->setFont(argv[2].toUint16());
- reg_t *rect = s->_segMan->derefRegPtr(argv[0], 4);
+ SciArray *rect = s->_segMan->lookupArray(argv[0]);
if (rect == nullptr) {
error("kTextSize: %04x:%04x cannot be dereferenced", PRINT_REG(argv[0]));
}
@@ -327,10 +324,14 @@ reg_t kTextSize32(EngineState *s, int argc, reg_t *argv) {
bool doScaling = argc > 4 ? argv[4].toSint16() : true;
Common::Rect textRect = g_sci->_gfxText32->getTextSize(text, maxWidth, doScaling);
- rect[0] = make_reg(0, textRect.left);
- rect[1] = make_reg(0, textRect.top);
- rect[2] = make_reg(0, textRect.right - 1);
- rect[3] = make_reg(0, textRect.bottom - 1);
+
+ reg_t value[4] = {
+ make_reg(0, textRect.left),
+ make_reg(0, textRect.top),
+ make_reg(0, textRect.right - 1),
+ make_reg(0, textRect.bottom - 1) };
+
+ rect->setElements(0, 4, value);
return s->r_acc;
}
@@ -426,7 +427,7 @@ reg_t kCelHigh32(EngineState *s, int argc, reg_t *argv) {
int16 loopNo = argv[1].toSint16();
int16 celNo = argv[2].toSint16();
CelObjView celObj(resourceId, loopNo, celNo);
- return make_reg(0, mulru(celObj._height, Ratio(g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight, celObj._scaledHeight)));
+ return make_reg(0, mulru(celObj._height, Ratio(g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight, celObj._yResolution)));
}
reg_t kCelWide32(EngineState *s, int argc, reg_t *argv) {
@@ -434,7 +435,7 @@ reg_t kCelWide32(EngineState *s, int argc, reg_t *argv) {
int16 loopNo = argv[1].toSint16();
int16 celNo = argv[2].toSint16();
CelObjView celObj(resourceId, loopNo, celNo);
- return make_reg(0, mulru(celObj._width, Ratio(g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth, celObj._scaledWidth)));
+ return make_reg(0, mulru(celObj._width, Ratio(g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth, celObj._xResolution)));
}
reg_t kCelInfo(EngineState *s, int argc, reg_t *argv) {
@@ -447,10 +448,10 @@ reg_t kCelInfo(EngineState *s, int argc, reg_t *argv) {
switch (argv[0].toUint16()) {
case 0:
- result = view._displace.x;
+ result = view._origin.x;
break;
case 1:
- result = view._displace.y;
+ result = view._origin.y;
break;
case 2:
case 3:
@@ -615,13 +616,13 @@ reg_t kSetFontHeight(EngineState *s, int argc, reg_t *argv) {
// of setting the fontHeight on the font manager, in
// which case we could just get the font directly ourselves.
g_sci->_gfxText32->setFont(argv[0].toUint16());
- g_sci->_gfxText32->_scaledHeight = (g_sci->_gfxText32->_font->getHeight() * g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight + g_sci->_gfxText32->_scaledHeight - 1) / g_sci->_gfxText32->_scaledHeight;
- return make_reg(0, g_sci->_gfxText32->_scaledHeight);
+ g_sci->_gfxText32->_yResolution = (g_sci->_gfxText32->_font->getHeight() * g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight + g_sci->_gfxText32->_yResolution - 1) / g_sci->_gfxText32->_yResolution;
+ return make_reg(0, g_sci->_gfxText32->_yResolution);
}
reg_t kSetFontRes(EngineState *s, int argc, reg_t *argv) {
- g_sci->_gfxText32->_scaledWidth = argv[0].toUint16();
- g_sci->_gfxText32->_scaledHeight = argv[1].toUint16();
+ g_sci->_gfxText32->_xResolution = argv[0].toUint16();
+ g_sci->_gfxText32->_yResolution = argv[1].toUint16();
return s->r_acc;
}
@@ -636,12 +637,12 @@ reg_t kBitmapCreate(EngineState *s, int argc, reg_t *argv) {
int16 height = argv[1].toSint16();
int16 skipColor = argv[2].toSint16();
int16 backColor = argv[3].toSint16();
- int16 scaledWidth = argc > 4 ? argv[4].toSint16() : g_sci->_gfxText32->_scaledWidth;
- int16 scaledHeight = argc > 5 ? argv[5].toSint16() : g_sci->_gfxText32->_scaledHeight;
+ int16 xResolution = argc > 4 ? argv[4].toSint16() : g_sci->_gfxText32->_xResolution;
+ int16 yResolution = argc > 5 ? argv[5].toSint16() : g_sci->_gfxText32->_yResolution;
bool useRemap = argc > 6 ? argv[6].toSint16() : false;
reg_t bitmapId;
- SciBitmap &bitmap = *s->_segMan->allocateBitmap(&bitmapId, width, height, skipColor, 0, 0, scaledWidth, scaledHeight, 0, useRemap, true);
+ SciBitmap &bitmap = *s->_segMan->allocateBitmap(&bitmapId, width, height, skipColor, 0, 0, xResolution, yResolution, 0, useRemap, true);
memset(bitmap.getPixels(), backColor, width * height);
return bitmapId;
}
@@ -675,12 +676,12 @@ reg_t kBitmapDrawView(EngineState *s, int argc, reg_t *argv) {
const int16 alignY = argc > 8 ? argv[8].toSint16() : -1;
Common::Point position(
- x == -1 ? bitmap.getDisplace().x : x,
- y == -1 ? bitmap.getDisplace().y : y
+ x == -1 ? bitmap.getOrigin().x : x,
+ y == -1 ? bitmap.getOrigin().y : y
);
- position.x -= alignX == -1 ? view._displace.x : alignX;
- position.y -= alignY == -1 ? view._displace.y : alignY;
+ position.x -= alignX == -1 ? view._origin.x : alignX;
+ position.y -= alignY == -1 ? view._origin.y : alignY;
Common::Rect drawRect(
position.x,
@@ -755,16 +756,37 @@ reg_t kBitmapInvert(EngineState *s, int argc, reg_t *argv) {
return kStubNull(s, argc + 1, argv - 1);
}
-reg_t kBitmapSetDisplace(EngineState *s, int argc, reg_t *argv) {
+reg_t kBitmapSetOrigin(EngineState *s, int argc, reg_t *argv) {
SciBitmap &bitmap = *s->_segMan->lookupBitmap(argv[0]);
- bitmap.setDisplace(Common::Point(argv[1].toSint16(), argv[2].toSint16()));
+ bitmap.setOrigin(Common::Point(argv[1].toSint16(), argv[2].toSint16()));
return s->r_acc;
}
reg_t kBitmapCreateFromView(EngineState *s, int argc, reg_t *argv) {
- // viewId, loopNo, celNo, skipColor, backColor, useRemap, source overlay bitmap
+ CelObjView view(argv[0].toUint16(), argv[1].toSint16(), argv[2].toSint16());
+ const uint8 skipColor = argc > 3 && argv[3].toSint16() != -1 ? argv[3].toSint16() : view._skipColor;
+ const uint8 backColor = argc > 4 && argv[4].toSint16() != -1 ? argv[4].toSint16() : view._skipColor;
+ const bool useRemap = argc > 5 ? (bool)argv[5].toSint16() : false;
- return kStub(s, argc + 1, argv - 1);
+ reg_t bitmapId;
+ SciBitmap &bitmap = *s->_segMan->allocateBitmap(&bitmapId, view._width, view._height, skipColor, 0, 0, view._xResolution, view._yResolution, 0, useRemap, true);
+ Buffer &buffer = bitmap.getBuffer();
+
+ const Common::Rect viewRect(view._width, view._height);
+ buffer.fillRect(viewRect, backColor);
+ view.draw(buffer, viewRect, Common::Point(0, 0), view._mirrorX);
+
+ if (argc > 6 && !argv[6].isNull()) {
+ reg_t clutHandle = argv[6];
+ if (s->_segMan->isObject(clutHandle)) {
+ clutHandle = readSelector(s->_segMan, clutHandle, SELECTOR(data));
+ }
+
+ SciArray &clut = *s->_segMan->lookupArray(clutHandle);
+ bitmap.applyRemap(clut);
+ }
+
+ return bitmapId;
}
reg_t kBitmapCopyPixels(EngineState *s, int argc, reg_t *argv) {
@@ -780,12 +802,24 @@ reg_t kBitmapClone(EngineState *s, int argc, reg_t *argv) {
}
reg_t kBitmapGetInfo(EngineState *s, int argc, reg_t *argv) {
- // bitmap
+ SciBitmap &bitmap = *s->_segMan->lookupBitmap(argv[0]);
- // argc 1 = get width
- // argc 2 = pixel at row 0 col n
- // argc 3 = pixel at row n col n
- return kStub(s, argc + 1, argv - 1);
+ if (argc == 1) {
+ return make_reg(0, bitmap.getWidth());
+ }
+
+ int32 offset;
+ if (argc == 2) {
+ offset = argv[1].toUint16();
+ } else {
+ const int16 x = argv[1].toSint16();
+ const int16 y = argv[2].toSint16();
+ offset = y * bitmap.getWidth() + x;
+ }
+
+ assert(offset >= 0 && offset < bitmap.getWidth() * bitmap.getHeight());
+ const uint8 color = bitmap.getPixels()[offset];
+ return make_reg(0, color);
}
reg_t kBitmapScale(EngineState *s, int argc, reg_t *argv) {
@@ -924,17 +958,17 @@ reg_t kPaletteSetGamma(EngineState *s, int argc, reg_t *argv) {
}
reg_t kPaletteSetFade(EngineState *s, int argc, reg_t *argv) {
- uint16 fromColor = argv[0].toUint16();
- uint16 toColor = argv[1].toUint16();
- uint16 percent = argv[2].toUint16();
+ const uint16 fromColor = argv[0].toUint16();
+ const uint16 toColor = argv[1].toUint16();
+ const uint16 percent = argv[2].toUint16();
g_sci->_gfxPalette32->setFade(percent, fromColor, toColor);
return s->r_acc;
}
reg_t kPalVarySetVary(EngineState *s, int argc, reg_t *argv) {
- GuiResourceId paletteId = argv[0].toUint16();
- int time = argc > 1 ? argv[1].toSint16() * 60 : 0;
- int16 percent = argc > 2 ? argv[2].toSint16() : 100;
+ const GuiResourceId paletteId = argv[0].toUint16();
+ const int32 time = argc > 1 ? argv[1].toSint16() * 60 : 0;
+ const int16 percent = argc > 2 ? argv[2].toSint16() : 100;
int16 fromColor;
int16 toColor;
@@ -950,9 +984,9 @@ reg_t kPalVarySetVary(EngineState *s, int argc, reg_t *argv) {
}
reg_t kPalVarySetPercent(EngineState *s, int argc, reg_t *argv) {
- int time = argc > 0 ? argv[0].toSint16() * 60 : 0;
- int16 percent = argc > 1 ? argv[1].toSint16() : 0;
- g_sci->_gfxPalette32->setVaryPercent(percent, time, -1, -1);
+ const int32 time = argc > 0 ? argv[0].toSint16() * 60 : 0;
+ const int16 percent = argc > 1 ? argv[1].toSint16() : 0;
+ g_sci->_gfxPalette32->setVaryPercent(percent, time);
return s->r_acc;
}
@@ -966,31 +1000,31 @@ reg_t kPalVaryOff(EngineState *s, int argc, reg_t *argv) {
}
reg_t kPalVaryMergeTarget(EngineState *s, int argc, reg_t *argv) {
- GuiResourceId paletteId = argv[0].toUint16();
+ const GuiResourceId paletteId = argv[0].toUint16();
g_sci->_gfxPalette32->kernelPalVaryMergeTarget(paletteId);
return make_reg(0, g_sci->_gfxPalette32->getVaryPercent());
}
reg_t kPalVarySetTime(EngineState *s, int argc, reg_t *argv) {
- int time = argv[0].toSint16() * 60;
+ const int32 time = argv[0].toSint16() * 60;
g_sci->_gfxPalette32->setVaryTime(time);
return s->r_acc;
}
reg_t kPalVarySetTarget(EngineState *s, int argc, reg_t *argv) {
- GuiResourceId paletteId = argv[0].toUint16();
+ const GuiResourceId paletteId = argv[0].toUint16();
g_sci->_gfxPalette32->kernelPalVarySetTarget(paletteId);
return make_reg(0, g_sci->_gfxPalette32->getVaryPercent());
}
reg_t kPalVarySetStart(EngineState *s, int argc, reg_t *argv) {
- GuiResourceId paletteId = argv[0].toUint16();
+ const GuiResourceId paletteId = argv[0].toUint16();
g_sci->_gfxPalette32->kernelPalVarySetStart(paletteId);
return make_reg(0, g_sci->_gfxPalette32->getVaryPercent());
}
reg_t kPalVaryMergeStart(EngineState *s, int argc, reg_t *argv) {
- GuiResourceId paletteId = argv[0].toUint16();
+ const GuiResourceId paletteId = argv[0].toUint16();
g_sci->_gfxPalette32->kernelPalVaryMergeStart(paletteId);
return make_reg(0, g_sci->_gfxPalette32->getVaryPercent());
}
@@ -1006,7 +1040,6 @@ reg_t kPalCycleSetCycle(EngineState *s, int argc, reg_t *argv) {
const uint16 toColor = argv[1].toUint16();
const int16 direction = argv[2].toSint16();
const uint16 delay = argc > 3 ? argv[3].toUint16() : 0;
-
g_sci->_gfxPalette32->setCycle(fromColor, toColor, direction, delay);
return s->r_acc;
}
@@ -1014,7 +1047,6 @@ reg_t kPalCycleSetCycle(EngineState *s, int argc, reg_t *argv) {
reg_t kPalCycleDoCycle(EngineState *s, int argc, reg_t *argv) {
const uint16 fromColor = argv[0].toUint16();
const int16 speed = argc > 1 ? argv[1].toSint16() : 1;
-
g_sci->_gfxPalette32->doCycle(fromColor, speed);
return s->r_acc;
}
diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp
index e780d3cdc3..5cd9c3623d 100644
--- a/engines/sci/engine/klists.cpp
+++ b/engines/sci/engine/klists.cpp
@@ -554,7 +554,7 @@ reg_t kListEachElementDo(EngineState *s, int argc, reg_t *argv) {
++list->numRecursions;
- if (list->numRecursions > ARRAYSIZE(list->nextNodes)) {
+ if (list->numRecursions >= ARRAYSIZE(list->nextNodes)) {
error("Too much recursion in kListEachElementDo");
}
@@ -683,197 +683,105 @@ reg_t kMoveToEnd(EngineState *s, int argc, reg_t *argv) {
}
reg_t kArray(EngineState *s, int argc, reg_t *argv) {
- uint16 op = argv[0].toUint16();
-
- // Use kString when accessing strings
- // This is possible, as strings inherit from arrays
- // and in this case (type 3) arrays are of type char *.
- // kString is almost exactly the same as kArray, so
- // this call is possible
- // TODO: we need to either merge SCI2 strings and
- // arrays together, and in the future merge them with
- // the SCI1 strings and arrays in the segment manager
- bool callStringFunc = false;
- if (op == 0) {
- // New, check if the target type is 3 (string)
- if (argv[2].toUint16() == 3)
- callStringFunc = true;
- } else {
- if (s->_segMan->getSegmentType(argv[1].getSegment()) == SEG_TYPE_STRING ||
- s->_segMan->getSegmentType(argv[1].getSegment()) == SEG_TYPE_SCRIPT) {
- callStringFunc = true;
- }
-
-#if 0
- if (op == 6) {
- if (s->_segMan->getSegmentType(argv[3].getSegment()) == SEG_TYPE_STRING ||
- s->_segMan->getSegmentType(argv[3].getSegment()) == SEG_TYPE_SCRIPT) {
- callStringFunc = true;
- }
- }
-#endif
- }
+ if (!s)
+ return make_reg(0, getSciVersion());
+ error("not supposed to call this");
+}
- if (callStringFunc) {
- Kernel *kernel = g_sci->getKernel();
- uint16 kernelStringFuncId = kernel->_kernelFunc_StringId;
- if (kernelStringFuncId) {
- const KernelFunction *kernelStringFunc = &kernel->_kernelFuncs[kernelStringFuncId];
-
- if (op < kernelStringFunc->subFunctionCount) {
- // subfunction-id is valid
- const KernelSubFunction *kernelStringSubCall = &kernelStringFunc->subFunctions[op];
- argc--;
- argv++; // remove subfunction-id from arguments
- // and call the kString subfunction
- return kernelStringSubCall->function(s, argc, argv);
- }
- }
- }
+reg_t kArrayNew(EngineState *s, int argc, reg_t *argv) {
+ uint16 size = argv[0].toUint16();
+ const SciArrayType type = (SciArrayType)argv[1].toUint16();
- switch (op) {
- case 0: { // New
- reg_t arrayHandle;
- SciArray<reg_t> *array = s->_segMan->allocateArray(&arrayHandle);
- array->setType(argv[2].toUint16());
- array->setSize(argv[1].toUint16());
- return arrayHandle;
- }
- case 1: { // Size
- SciArray<reg_t> *array = s->_segMan->lookupArray(argv[1]);
- return make_reg(0, array->getSize());
+ if (type == kArrayTypeString) {
+ ++size;
}
- case 2: { // At (return value at an index)
- SciArray<reg_t> *array = s->_segMan->lookupArray(argv[1]);
- if (g_sci->getGameId() == GID_PHANTASMAGORIA2) {
- // HACK: Phantasmagoria 2 keeps trying to access past the end of an
- // array when it starts. I'm assuming it's trying to see where the
- // array ends, or tries to resize it. Adjust the array size
- // accordingly, and return NULL for now.
- if (array->getSize() == argv[2].toUint16()) {
- array->setSize(argv[2].toUint16());
- return NULL_REG;
- }
- }
- return array->getValue(argv[2].toUint16());
- }
- case 3: { // Atput (put value at an index)
- SciArray<reg_t> *array = s->_segMan->lookupArray(argv[1]);
-
- uint32 index = argv[2].toUint16();
- uint32 count = argc - 3;
- if (index + count > 65535)
- break;
+ reg_t arrayHandle;
+ s->_segMan->allocateArray(type, size, &arrayHandle);
+ return arrayHandle;
+}
- if (array->getSize() < index + count)
- array->setSize(index + count);
+reg_t kArrayGetSize(EngineState *s, int argc, reg_t *argv) {
+ const SciArray &array = *s->_segMan->lookupArray(argv[0]);
+ return make_reg(0, array.size());
+}
- for (uint16 i = 0; i < count; i++)
- array->setValue(i + index, argv[i + 3]);
+reg_t kArrayGetElement(EngineState *s, int argc, reg_t *argv) {
+ SciArray &array = *s->_segMan->lookupArray(argv[0]);
+ return array.getAsID(argv[1].toUint16());
+}
- return argv[1]; // We also have to return the handle
- }
- case 4: // Free
- // Freeing of arrays is handled by the garbage collector
- return s->r_acc;
- case 5: { // Fill
- SciArray<reg_t> *array = s->_segMan->lookupArray(argv[1]);
- uint16 index = argv[2].toUint16();
+reg_t kArraySetElements(EngineState *s, int argc, reg_t *argv) {
+ SciArray &array = *s->_segMan->lookupArray(argv[0]);
+ array.setElements(argv[1].toUint16(), argc - 2, argv + 2);
+ return argv[0];
+}
- // A count of -1 means fill the rest of the array
- uint16 count = argv[3].toSint16() == -1 ? array->getSize() - index : argv[3].toUint16();
- uint16 arraySize = array->getSize();
+reg_t kArrayFree(EngineState *s, int argc, reg_t *argv) {
+ s->_segMan->freeArray(argv[0]);
+ return s->r_acc;
+}
- if (arraySize < index + count)
- array->setSize(index + count);
+reg_t kArrayFill(EngineState *s, int argc, reg_t *argv) {
+ SciArray &array = *s->_segMan->lookupArray(argv[0]);
+ array.fill(argv[1].toUint16(), argv[2].toUint16(), argv[3]);
+ return argv[0];
+}
- for (uint16 i = 0; i < count; i++)
- array->setValue(i + index, argv[4]);
+reg_t kArrayCopy(EngineState *s, int argc, reg_t *argv) {
+ SciArray &target = *s->_segMan->lookupArray(argv[0]);
+ const uint16 targetIndex = argv[1].toUint16();
- return argv[1];
+ SciArray source;
+ // String copies may be made from static script data
+ if (!s->_segMan->isArray(argv[2])) {
+ source.setType(kArrayTypeString);
+ source.fromString(s->_segMan->getString(argv[2]));
+ } else {
+ source = *s->_segMan->lookupArray(argv[2]);
}
- case 6: { // Cpy
- if (argv[1].isNull() || argv[3].isNull()) {
- if (getSciVersion() == SCI_VERSION_3) {
- // FIXME: Happens in SCI3, probably because of a missing kernel function.
- warning("kArray(Cpy): Request to copy from or to a null pointer");
- return NULL_REG;
- } else {
- // SCI2-2.1: error out
- error("kArray(Cpy): Request to copy from or to a null pointer");
- }
- }
+ const uint16 sourceIndex = argv[3].toUint16();
+ const uint16 count = argv[4].toUint16();
- reg_t arrayHandle = argv[1];
- SciArray<reg_t> *array1 = s->_segMan->lookupArray(argv[1]);
- SciArray<reg_t> *array2 = s->_segMan->lookupArray(argv[3]);
- uint32 index1 = argv[2].toUint16();
- uint32 index2 = argv[4].toUint16();
-
- // The original engine ignores bad copies too
- if (index2 > array2->getSize())
- break;
-
- // A count of -1 means fill the rest of the array
- uint32 count = argv[5].toSint16() == -1 ? array2->getSize() - index2 : argv[5].toUint16();
-
- if (array1->getSize() < index1 + count)
- array1->setSize(index1 + count);
+ target.copy(source, sourceIndex, targetIndex, count);
+ return argv[0];
+}
- for (uint16 i = 0; i < count; i++)
- array1->setValue(i + index1, array2->getValue(i + index2));
+reg_t kArrayDuplicate(EngineState *s, int argc, reg_t *argv) {
+ reg_t targetHandle;
- return arrayHandle;
+ // String duplicates may be made from static script data
+ if (!s->_segMan->isArray(argv[0])) {
+ const Common::String source = s->_segMan->getString(argv[0]);
+ SciArray &target = *s->_segMan->allocateArray(kArrayTypeString, source.size(), &targetHandle);
+ target.fromString(source);
+ } else {
+ SciArray &source = *s->_segMan->lookupArray(argv[0]);
+ SciArray &target = *s->_segMan->allocateArray(source.getType(), source.size(), &targetHandle);
+ target = source;
}
- case 7: // Cmp
- // Not implemented in SSCI
- warning("kArray(Cmp) called");
- return s->r_acc;
- case 8: { // Dup
- if (argv[1].isNull()) {
- warning("kArray(Dup): Request to duplicate a null pointer");
-#if 0
- // Allocate an array anyway
- reg_t arrayHandle;
- SciArray<reg_t> *dupArray = s->_segMan->allocateArray(&arrayHandle);
- dupArray->setType(3);
- dupArray->setSize(0);
- return arrayHandle;
-#endif
- return NULL_REG;
- }
- SegmentObj *sobj = s->_segMan->getSegmentObj(argv[1].getSegment());
- if (!sobj || sobj->getType() != SEG_TYPE_ARRAY)
- error("kArray(Dup): Request to duplicate a segment which isn't an array");
-
- reg_t arrayHandle;
- SciArray<reg_t> *dupArray = s->_segMan->allocateArray(&arrayHandle);
- // This must occur after allocateArray, as inserting a new object
- // in the heap object list might invalidate this pointer. Also refer
- // to the same issue in kClone()
- SciArray<reg_t> *array = s->_segMan->lookupArray(argv[1]);
-
- dupArray->setType(array->getType());
- dupArray->setSize(array->getSize());
- for (uint32 i = 0; i < array->getSize(); i++)
- dupArray->setValue(i, array->getValue(i));
-
- return arrayHandle;
- }
- case 9: // Getdata
- if (!s->_segMan->isHeapObject(argv[1]))
- return argv[1];
+ return targetHandle;
+}
- return readSelector(s->_segMan, argv[1], SELECTOR(data));
- default:
- error("Unknown kArray subop %d", op);
+reg_t kArrayGetData(EngineState *s, int argc, reg_t *argv) {
+ if (s->_segMan->isObject(argv[0])) {
+ return readSelector(s->_segMan, argv[0], SELECTOR(data));
}
- return NULL_REG;
+ return argv[0];
}
+reg_t kArrayByteCopy(EngineState *s, int argc, reg_t *argv) {
+ SciArray &target = *s->_segMan->lookupArray(argv[0]);
+ const uint16 targetOffset = argv[1].toUint16();
+ const SciArray &source = *s->_segMan->lookupArray(argv[2]);
+ const uint16 sourceOffset = argv[3].toUint16();
+ const uint16 count = argv[4].toUint16();
+
+ target.byteCopy(source, sourceOffset, targetOffset, count);
+ return argv[0];
+}
#endif
} // End of namespace Sci
diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp
index f2a3c6b0f7..9aa03a4760 100644
--- a/engines/sci/engine/kmisc.cpp
+++ b/engines/sci/engine/kmisc.cpp
@@ -459,6 +459,14 @@ reg_t kGetWindowsOption(EngineState *s, int argc, reg_t *argv) {
}
}
+extern Common::String format(const Common::String &source, int argc, const reg_t *argv);
+
+reg_t kPrintDebug(EngineState *s, int argc, reg_t *argv) {
+ const Common::String debugString = s->_segMan->getString(argv[0]);
+ debugC(kDebugLevelGame, "%s", format(debugString, argc - 1, argv + 1).c_str());
+ return s->r_acc;
+}
+
#endif
// kIconBar is really a subop of kMacPlatform for SCI1.1 Mac
diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp
index 06f16299aa..937b1cfc2f 100644
--- a/engines/sci/engine/kpathing.cpp
+++ b/engines/sci/engine/kpathing.cpp
@@ -1397,10 +1397,8 @@ static reg_t allocateOutputArray(SegManager *segMan, int size) {
#ifdef ENABLE_SCI32
if (getSciVersion() >= SCI_VERSION_2) {
- SciArray<reg_t> *array = segMan->allocateArray(&addr);
+ SciArray *array = segMan->allocateArray(kArrayTypeInt16, size * 2, &addr);
assert(array);
- array->setType(0);
- array->setSize(size * 2);
return addr;
}
#endif
diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp
index 6fd130bceb..0e29ccf783 100644
--- a/engines/sci/engine/kscripts.cpp
+++ b/engines/sci/engine/kscripts.cpp
@@ -238,8 +238,8 @@ reg_t kScriptID(EngineState *s, int argc, reg_t *argv) {
// initialized to 0, whereas it's 6 in other versions. Thus, we assign it
// to 6 here, fixing the speed of the introduction. Refer to bug #3102071.
if (g_sci->getGameId() == GID_PQ2 && script == 200 &&
- s->variables[VAR_GLOBAL][3].isNull()) {
- s->variables[VAR_GLOBAL][3] = make_reg(0, 6);
+ s->variables[VAR_GLOBAL][kGlobalVarSpeed].isNull()) {
+ s->variables[VAR_GLOBAL][kGlobalVarSpeed] = make_reg(0, 6);
}
return make_reg(scriptSeg, address);
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index 1c08bf597c..6ec61343b0 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -202,11 +202,6 @@ reg_t kReadNumber(EngineState *s, int argc, reg_t *argv) {
}
-#define ALIGN_NONE 0
-#define ALIGN_RIGHT 1
-#define ALIGN_LEFT -1
-#define ALIGN_CENTER 2
-
/* Format(targ_address, textresnr, index_inside_res, ...)
** or
** Format(targ_address, heap_text_addr, ...)
@@ -214,6 +209,13 @@ reg_t kReadNumber(EngineState *s, int argc, reg_t *argv) {
** the supplied parameters and writes it to the targ_address.
*/
reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
+ enum {
+ ALIGN_NONE = 0,
+ ALIGN_RIGHT = 1,
+ ALIGN_LEFT = -1,
+ ALIGN_CENTER = 2
+ };
+
uint16 *arguments;
reg_t dest = argv[0];
int maxsize = 4096; /* Arbitrary... */
@@ -301,12 +303,6 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
case 's': { /* Copy string */
reg_t reg = argv[startarg + paramindex];
-#ifdef ENABLE_SCI32
- // If the string is a string object, get to the actual string in the data selector
- if (s->_segMan->isObject(reg))
- reg = readSelector(s->_segMan, reg, SELECTOR(data));
-#endif
-
Common::String tempsource = g_sci->getKernel()->lookupText(reg,
arguments[paramindex + 1]);
int slen = strlen(tempsource.c_str());
@@ -379,12 +375,6 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
case 'u':
unsignedVar = true;
case 'd': { /* Copy decimal */
- // In the new SCI2 kString function, %d is used for unsigned
- // integers. An example is script 962 in Shivers - it uses %d
- // to create file names.
- if (getSciVersion() >= SCI_VERSION_2)
- unsignedVar = true;
-
/* int templen; -- unused atm */
const char *format_string = "%d";
@@ -437,14 +427,6 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
*target = 0; /* Terminate string */
-#ifdef ENABLE_SCI32
- // Resize SCI32 strings if necessary
- if (getSciVersion() >= SCI_VERSION_2) {
- SciString *string = s->_segMan->lookupString(dest);
- string->setSize(strlen(targetbuf) + 1);
- }
-#endif
-
s->_segMan->strcpy(dest, targetbuf);
return dest; /* Return target addr */
@@ -661,238 +643,236 @@ reg_t kStrSplit(EngineState *s, int argc, reg_t *argv) {
#ifdef ENABLE_SCI32
-// TODO: there is an unused second argument, happens at least in LSL6 right during the intro
+reg_t kString(EngineState *s, int argc, reg_t *argv) {
+ if (!s)
+ return make_reg(0, getSciVersion());
+ error("not supposed to call this");
+}
+
reg_t kStringNew(EngineState *s, int argc, reg_t *argv) {
reg_t stringHandle;
- SciString *string = s->_segMan->allocateString(&stringHandle);
- string->setSize(argv[0].toUint16());
-
- // Make sure the first character is a null character
- if (string->getSize() > 0)
- string->setValue(0, 0);
-
+ const uint16 size = argv[0].toUint16();
+ s->_segMan->allocateArray(kArrayTypeString, size, &stringHandle);
return stringHandle;
}
-reg_t kStringSize(EngineState *s, int argc, reg_t *argv) {
- return make_reg(0, s->_segMan->getString(argv[0]).size());
-}
-
-// At (return value at an index)
-reg_t kStringAt(EngineState *s, int argc, reg_t *argv) {
- // Note that values are put in bytes to avoid sign extension
- if (argv[0].getSegment() == s->_segMan->getStringSegmentId()) {
- SciString *string = s->_segMan->lookupString(argv[0]);
- byte val = string->getRawData()[argv[1].toUint16()];
- return make_reg(0, val);
- } else {
- Common::String string = s->_segMan->getString(argv[0]);
- byte val = string[argv[1].toUint16()];
- return make_reg(0, val);
- }
-}
-
-// Atput (put value at an index)
-reg_t kStringPutAt(EngineState *s, int argc, reg_t *argv) {
- SciString *string = s->_segMan->lookupString(argv[0]);
+reg_t kStringGetChar(EngineState *s, int argc, reg_t *argv) {
+ const uint16 index = argv[1].toUint16();
- uint32 index = argv[1].toUint16();
- uint32 count = argc - 2;
+ // Game scripts may contain static raw string data
+ if (!s->_segMan->isArray(argv[0])) {
+ const Common::String string = s->_segMan->getString(argv[0]);
+ if (index >= string.size()) {
+ return make_reg(0, 0);
+ }
- if (index + count > 65535)
- return NULL_REG;
+ return make_reg(0, (byte)string[index]);
+ }
- if (string->getSize() < index + count)
- string->setSize(index + count);
+ SciArray &array = *s->_segMan->lookupArray(argv[0]);
- for (uint16 i = 0; i < count; i++)
- string->setValue(i + index, argv[i + 2].toUint16());
+ if (index >= array.size()) {
+ return make_reg(0, 0);
+ }
- return argv[0]; // We also have to return the handle
+ return array.getAsID(index);
}
reg_t kStringFree(EngineState *s, int argc, reg_t *argv) {
- // Freeing of strings is handled by the garbage collector
+ if (!argv[0].isNull()) {
+ s->_segMan->freeArray(argv[0]);
+ }
return s->r_acc;
}
-reg_t kStringFill(EngineState *s, int argc, reg_t *argv) {
- SciString *string = s->_segMan->lookupString(argv[0]);
- uint16 index = argv[1].toUint16();
+reg_t kStringCompare(EngineState *s, int argc, reg_t *argv) {
+ const Common::String string1 = s->_segMan->getString(argv[0]);
+ const Common::String string2 = s->_segMan->getString(argv[1]);
- // A count of -1 means fill the rest of the array
- uint16 count = argv[2].toSint16() == -1 ? string->getSize() - index : argv[2].toUint16();
- uint16 stringSize = string->getSize();
+ int result;
+ if (argc == 3) {
+ result = strncmp(string1.c_str(), string2.c_str(), argv[2].toUint16());
+ } else {
+ result = strcmp(string1.c_str(), string2.c_str());
+ }
- if (stringSize < index + count)
- string->setSize(index + count);
+ return make_reg(0, (result > 0) - (result < 0));
+}
- for (uint16 i = 0; i < count; i++)
- string->setValue(i + index, argv[3].toUint16());
+reg_t kStringGetData(EngineState *s, int argc, reg_t *argv) {
+ if (s->_segMan->isObject(argv[0])) {
+ return readSelector(s->_segMan, argv[0], SELECTOR(data));
+ }
return argv[0];
}
-reg_t kStringCopy(EngineState *s, int argc, reg_t *argv) {
- const char *string2 = 0;
- uint32 string2Size = 0;
- Common::String string;
+reg_t kStringLength(EngineState *s, int argc, reg_t *argv) {
+ return make_reg(0, s->_segMan->getString(argv[0]).size());
+}
- if (argv[2].getSegment() == s->_segMan->getStringSegmentId()) {
- SciString *sstr;
- sstr = s->_segMan->lookupString(argv[2]);
- string2 = sstr->getRawData();
- string2Size = sstr->getSize();
- } else {
- string = s->_segMan->getString(argv[2]);
- string2 = string.c_str();
- string2Size = string.size() + 1;
+namespace {
+ bool isFlag(const char c) {
+ return strchr("-+ 0#", c);
}
- uint32 index1 = argv[1].toUint16();
- uint32 index2 = argv[3].toUint16();
-
- if (argv[0] == argv[2]) {
- // source and destination string are one and the same
- if (index1 == index2) {
- // even same index? ignore this call
- // Happens in KQ7, when starting a chapter
- return argv[0];
- }
- // TODO: this will crash, when setSize() is triggered later
- // we need to exactly replicate original interpreter behavior
- warning("kString(Copy): source is the same as destination string");
+ bool isPrecision(const char c) {
+ return strchr(".0123456789*", c);
}
- // The original engine ignores bad copies too
- if (index2 >= string2Size)
- return NULL_REG;
-
- // A count of -1 means fill the rest of the array
- uint32 count = string2Size - index2;
- if (argv[4].toSint16() != -1) {
- count = MIN(count, (uint32)argv[4].toUint16());
+ bool isWidth(const char c) {
+ return strchr("0123456789*", c);
}
-// reg_t strAddress = argv[0];
- SciString *string1 = s->_segMan->lookupString(argv[0]);
- //SciString *string1 = !argv[1].isNull() ? s->_segMan->lookupString(argv[1]) : s->_segMan->allocateString(&strAddress);
+ bool isLength(const char c) {
+ return strchr("hjlLtz", c);
+ }
- if (string1->getSize() < index1 + count)
- string1->setSize(index1 + count);
+ bool isType(const char c) {
+ return strchr("dsuxXaAceEfFgGinop", c);
+ }
- // Note: We're accessing from c_str() here because the
- // string's size ignores the trailing 0 and therefore
- // triggers an assert when doing string2[i + index2].
- for (uint16 i = 0; i < count; i++)
- string1->setValue(i + index1, string2[i + index2]);
+ bool isSignedType(const char type) {
+ return type == 'd' || type == 'i';
+ }
- return argv[0];
-}
+ bool isUnsignedType(const char type) {
+ return strchr("uxXoc", type);
+ }
-reg_t kStringCompare(EngineState *s, int argc, reg_t *argv) {
- Common::String string1 = argv[0].isNull() ? "" : s->_segMan->getString(argv[0]);
- Common::String string2 = argv[1].isNull() ? "" : s->_segMan->getString(argv[1]);
+ bool isStringType(const char type) {
+ return type == 's';
+ }
- if (argc == 3) // Strncmp
- return make_reg(0, strncmp(string1.c_str(), string2.c_str(), argv[2].toUint16()));
- else // Strcmp
- return make_reg(0, strcmp(string1.c_str(), string2.c_str()));
-}
+ Common::String readPlaceholder(const char *&in, reg_t arg) {
+ const char *const start = in;
-// was removed for SCI2.1 Late+
-reg_t kStringDup(EngineState *s, int argc, reg_t *argv) {
- reg_t stringHandle;
+ assert(*in == '%');
+ ++in;
- SciString *dupString = s->_segMan->allocateString(&stringHandle);
+ while (isFlag(*in)) {
+ ++in;
+ }
+ while (isWidth(*in)) {
+ ++in;
+ }
+ while (isPrecision(*in)) {
+ ++in;
+ }
+ while (isLength(*in)) {
+ ++in;
+ }
- if (argv[0].getSegment() == s->_segMan->getStringSegmentId()) {
- *dupString = *s->_segMan->lookupString(argv[0]);
- } else {
- dupString->fromString(s->_segMan->getString(argv[0]));
+ char format[64];
+ format[0] = '\0';
+ const char type = *in++;
+ Common::strlcpy(format, start, MIN<size_t>(64, in - start + 1));
+
+ if (isType(type)) {
+ if (isSignedType(type)) {
+ const int value = arg.toSint16();
+ return Common::String::format(format, value);
+ } else if (isUnsignedType(type)) {
+ const uint value = arg.toUint16();
+ return Common::String::format(format, value);
+ } else if (isStringType(type)) {
+ Common::String value;
+ SegManager *segMan = g_sci->getEngineState()->_segMan;
+ if (segMan->isObject(arg)) {
+ value = segMan->getString(readSelector(segMan, arg, SELECTOR(data)));
+ } else {
+ value = segMan->getString(arg);
+ }
+ return Common::String::format(format, value.c_str());
+ } else {
+ error("Unsupported format type %c", type);
+ }
+ } else {
+ return Common::String::format("%s", format);
+ }
}
-
- return stringHandle;
}
-// was removed for SCI2.1 Late+
-reg_t kStringGetData(EngineState *s, int argc, reg_t *argv) {
- if (!s->_segMan->isHeapObject(argv[0]))
- return argv[0];
+Common::String format(const Common::String &source, int argc, const reg_t *argv) {
+ Common::String out;
+ const char *in = source.c_str();
+ int argIndex = 0;
+ while (*in != '\0') {
+ if (*in == '%') {
+ if (in[1] == '%') {
+ in += 2;
+ out += "%";
+ continue;
+ }
- return readSelector(s->_segMan, argv[0], SELECTOR(data));
-}
+ assert(argIndex < argc);
+ out += readPlaceholder(in, argv[argIndex++]);
+ } else {
+ out += *in++;
+ }
+ }
-reg_t kStringLen(EngineState *s, int argc, reg_t *argv) {
- return make_reg(0, s->_segMan->strlen(argv[0]));
+ return out;
}
-reg_t kStringPrintf(EngineState *s, int argc, reg_t *argv) {
+reg_t kStringFormat(EngineState *s, int argc, reg_t *argv) {
reg_t stringHandle;
- s->_segMan->allocateString(&stringHandle);
-
- reg_t *adjustedArgs = new reg_t[argc + 1];
- adjustedArgs[0] = stringHandle;
- memcpy(&adjustedArgs[1], argv, argc * sizeof(reg_t));
-
- kFormat(s, argc + 1, adjustedArgs);
- delete[] adjustedArgs;
+ SciArray &target = *s->_segMan->allocateArray(kArrayTypeString, 0, &stringHandle);
+ reg_t source = argv[0];
+ // Str objects may be passed in place of direct references to string data
+ if (s->_segMan->isObject(argv[0])) {
+ source = readSelector(s->_segMan, argv[0], SELECTOR(data));
+ }
+ target.fromString(format(s->_segMan->getString(source), argc - 1, argv + 1));
return stringHandle;
}
-reg_t kStringPrintfBuf(EngineState *s, int argc, reg_t *argv) {
- return kFormat(s, argc, argv);
+reg_t kStringFormatAt(EngineState *s, int argc, reg_t *argv) {
+ SciArray &target = *s->_segMan->lookupArray(argv[0]);
+ reg_t source = argv[1];
+ // Str objects may be passed in place of direct references to string data
+ if (s->_segMan->isObject(argv[1])) {
+ source = readSelector(s->_segMan, argv[1], SELECTOR(data));
+ }
+ target.fromString(format(s->_segMan->getString(source), argc - 2, argv + 2));
+ return argv[0];
}
-reg_t kStringAtoi(EngineState *s, int argc, reg_t *argv) {
- Common::String string = s->_segMan->getString(argv[0]);
- return make_reg(0, (uint16)atoi(string.c_str()));
+reg_t kStringToInteger(EngineState *s, int argc, reg_t *argv) {
+ return make_reg(0, (uint16)s->_segMan->getString(argv[0]).asUint64());
}
reg_t kStringTrim(EngineState *s, int argc, reg_t *argv) {
- Common::String string = s->_segMan->getString(argv[0]);
-
- string.trim();
- // TODO: Second parameter (bitfield, trim from left, right, center)
- warning("kStringTrim (%d)", argv[1].getOffset());
- s->_segMan->strcpy(argv[0], string.c_str());
- return NULL_REG;
+ SciArray &array = *s->_segMan->lookupArray(argv[0]);
+ const int8 flags = argv[1].toSint16();
+ const char showChar = argc > 2 ? argv[2].toSint16() : '\0';
+ array.trim(flags, showChar);
+ return s->r_acc;
}
-reg_t kStringUpper(EngineState *s, int argc, reg_t *argv) {
+reg_t kStringToUpperCase(EngineState *s, int argc, reg_t *argv) {
Common::String string = s->_segMan->getString(argv[0]);
-
string.toUppercase();
s->_segMan->strcpy(argv[0], string.c_str());
- return NULL_REG;
+ return argv[0];
}
-reg_t kStringLower(EngineState *s, int argc, reg_t *argv) {
+reg_t kStringToLowerCase(EngineState *s, int argc, reg_t *argv) {
Common::String string = s->_segMan->getString(argv[0]);
-
string.toLowercase();
s->_segMan->strcpy(argv[0], string.c_str());
- return NULL_REG;
-}
-
-// Possibly kStringTranslate?
-reg_t kStringTrn(EngineState *s, int argc, reg_t *argv) {
- warning("kStringTrn (argc = %d)", argc);
- return NULL_REG;
+ return argv[0];
}
-// Possibly kStringTranslateExclude?
-reg_t kStringTrnExclude(EngineState *s, int argc, reg_t *argv) {
- warning("kStringTrnExclude (argc = %d)", argc);
- return NULL_REG;
+reg_t kStringReplaceSubstring(EngineState *s, int argc, reg_t *argv) {
+ error("TODO: kStringReplaceSubstring not implemented");
+ return argv[3];
}
-reg_t kString(EngineState *s, int argc, reg_t *argv) {
- if (!s)
- return make_reg(0, getSciVersion());
- error("not supposed to call this");
+reg_t kStringReplaceSubstringEx(EngineState *s, int argc, reg_t *argv) {
+ error("TODO: kStringReplaceSubstringEx not implemented");
+ return argv[3];
}
-
#endif
} // End of namespace Sci
diff --git a/engines/sci/engine/kvideo.cpp b/engines/sci/engine/kvideo.cpp
index b539c84f5d..83a02883af 100644
--- a/engines/sci/engine/kvideo.cpp
+++ b/engines/sci/engine/kvideo.cpp
@@ -165,7 +165,6 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) {
switch (argv[0].toUint16()) {
case 0: {
Common::String filename = s->_segMan->getString(argv[1]);
- videoDecoder = new Video::AVIDecoder();
if (filename.equalsIgnoreCase("gk2a.avi")) {
// HACK: Switch to 16bpp graphics for Indeo3.
@@ -180,6 +179,8 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) {
}
}
+ videoDecoder = new Video::AVIDecoder();
+
if (!videoDecoder->loadFile(filename.c_str())) {
warning("Failed to open movie file %s", filename.c_str());
delete videoDecoder;
@@ -253,11 +254,13 @@ reg_t kRobotGetFrameSize(EngineState *s, int argc, reg_t *argv) {
Common::Rect frameRect;
const uint16 numFramesTotal = g_sci->_video32->getRobotPlayer().getFrameSize(frameRect);
- reg_t *outRect = s->_segMan->derefRegPtr(argv[0], 4);
- outRect[0] = make_reg(0, frameRect.left);
- outRect[1] = make_reg(0, frameRect.top);
- outRect[2] = make_reg(0, frameRect.right - 1);
- outRect[3] = make_reg(0, frameRect.bottom - 1);
+ SciArray *outRect = s->_segMan->lookupArray(argv[0]);
+ reg_t values[4] = {
+ make_reg(0, frameRect.left),
+ make_reg(0, frameRect.top),
+ make_reg(0, frameRect.right - 1),
+ make_reg(0, frameRect.bottom - 1) };
+ outRect->setElements(0, 4, values);
return make_reg(0, numFramesTotal);
}
@@ -446,10 +449,10 @@ reg_t kPlayVMDSetBlackoutArea(EngineState *s, int argc, reg_t *argv) {
const int16 scriptHeight = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight;
Common::Rect blackoutArea;
- blackoutArea.left = MAX((int16)0, argv[0].toSint16());
- blackoutArea.top = MAX((int16)0, argv[1].toSint16());
- blackoutArea.right = MIN(scriptWidth, (int16)(argv[2].toSint16() + 1));
- blackoutArea.bottom = MIN(scriptHeight, (int16)(argv[3].toSint16() + 1));
+ blackoutArea.left = MAX<int16>(0, argv[0].toSint16());
+ blackoutArea.top = MAX<int16>(0, argv[1].toSint16());
+ blackoutArea.right = MIN<int16>(scriptWidth, argv[2].toSint16() + 1);
+ blackoutArea.bottom = MIN<int16>(scriptHeight, argv[3].toSint16() + 1);
g_sci->_video32->getVMDPlayer().setBlackoutArea(blackoutArea);
return s->r_acc;
}
diff --git a/engines/sci/engine/message.cpp b/engines/sci/engine/message.cpp
index 5300b72b71..b0615b4213 100644
--- a/engines/sci/engine/message.cpp
+++ b/engines/sci/engine/message.cpp
@@ -439,21 +439,8 @@ Common::String MessageState::processString(const char *s) {
void MessageState::outputString(reg_t buf, const Common::String &str) {
#ifdef ENABLE_SCI32
if (getSciVersion() >= SCI_VERSION_2) {
- if (_segMan->getSegmentType(buf.getSegment()) == SEG_TYPE_STRING) {
- SciString *sciString = _segMan->lookupString(buf);
- sciString->setSize(str.size() + 1);
- for (uint32 i = 0; i < str.size(); i++)
- sciString->setValue(i, str.c_str()[i]);
- sciString->setValue(str.size(), 0);
- } else if (_segMan->getSegmentType(buf.getSegment()) == SEG_TYPE_ARRAY) {
- // Happens in the intro of LSL6, we are asked to write the string
- // into an array
- SciArray<reg_t> *sciString = _segMan->lookupArray(buf);
- sciString->setSize(str.size() + 1);
- for (uint32 i = 0; i < str.size(); i++)
- sciString->setValue(i, make_reg(0, str.c_str()[i]));
- sciString->setValue(str.size(), NULL_REG);
- }
+ SciArray *sciString = _segMan->lookupArray(buf);
+ sciString->fromString(str);
} else {
#endif
SegmentRef buffer_r = _segMan->dereference(buf);
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index be2d7660cb..2e4da46b70 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -102,66 +102,6 @@ void syncWithSerializer(Common::Serializer &s, Node &obj) {
syncWithSerializer(s, obj.value);
}
-#ifdef ENABLE_SCI32
-void syncWithSerializer(Common::Serializer &s, SciArray<reg_t> &obj) {
- byte type = 0;
- uint32 size = 0;
-
- if (s.isSaving()) {
- type = (byte)obj.getType();
- size = obj.getSize();
- }
- s.syncAsByte(type);
- s.syncAsUint32LE(size);
- if (s.isLoading()) {
- obj.setType((int8)type);
-
- // HACK: Skip arrays that have a negative type
- if ((int8)type < 0)
- return;
-
- obj.setSize(size);
- }
-
- for (uint32 i = 0; i < size; i++) {
- reg_t value;
-
- if (s.isSaving())
- value = obj.getValue(i);
-
- syncWithSerializer(s, value);
-
- if (s.isLoading())
- obj.setValue(i, value);
- }
-}
-
-void syncWithSerializer(Common::Serializer &s, SciString &obj) {
- uint32 size = 0;
-
- if (s.isSaving()) {
- size = obj.getSize();
- s.syncAsUint32LE(size);
- } else {
- s.syncAsUint32LE(size);
- obj.setSize(size);
- }
-
- for (uint32 i = 0; i < size; i++) {
- char value = 0;
-
- if (s.isSaving())
- value = obj.getValue(i);
-
- s.syncAsByte(value);
-
- if (s.isLoading())
- obj.setValue(i, value);
- }
-}
-
-#endif
-
#pragma mark -
// By default, sync using syncWithSerializer, which in turn can easily be overloaded.
@@ -292,9 +232,6 @@ void SegManager::saveLoadWithSerializer(Common::Serializer &s) {
} else if (type == SEG_TYPE_ARRAY) {
// Set the correct segment for SCI32 arrays
_arraysSegId = i;
- } else if (type == SEG_TYPE_STRING) {
- // Set the correct segment for SCI32 strings
- _stringSegId = i;
} else if (s.getVersion() >= 36 && type == SEG_TYPE_BITMAP) {
_bitmapSegId = i;
#endif
@@ -393,6 +330,28 @@ static void sync_SavegameMetadata(Common::Serializer &s, SavegameMetadata &obj)
}
s.syncAsUint32LE(obj.playTime);
}
+
+ // Some games require additional metadata to display their restore screens
+ // correctly
+ if (s.getVersion() >= 39) {
+ if (s.isSaving()) {
+ const reg_t *globals = g_sci->getEngineState()->variables[VAR_GLOBAL];
+ if (g_sci->getGameId() == GID_SHIVERS) {
+ obj.lowScore = globals[kGlobalVarScore].toUint16();
+ obj.highScore = globals[kGlobalVarShivers1Score].toUint16();
+ obj.avatarId = 0;
+ } else if (g_sci->getGameId() == GID_MOTHERGOOSEHIRES) {
+ obj.lowScore = obj.highScore = 0;
+ obj.avatarId = readSelectorValue(g_sci->getEngineState()->_segMan, globals[kGlobalVarEgo], SELECTOR(view));
+ } else {
+ obj.lowScore = obj.highScore = obj.avatarId = 0;
+ }
+ }
+
+ s.syncAsUint16LE(obj.lowScore);
+ s.syncAsUint16LE(obj.highScore);
+ s.syncAsByte(obj.avatarId);
+ }
}
void EngineState::saveLoadWithSerializer(Common::Serializer &s) {
@@ -673,13 +632,16 @@ void SoundCommandParser::syncPlayList(Common::Serializer &s) {
}
void SoundCommandParser::reconstructPlayList() {
- Common::StackLock lock(_music->_mutex);
+ _music->_mutex.lock();
// We store all songs here because starting songs may re-shuffle their order
MusicList songs;
for (MusicList::iterator i = _music->getPlayListStart(); i != _music->getPlayListEnd(); ++i)
songs.push_back(*i);
+ // Done with main playlist, so release lock
+ _music->_mutex.unlock();
+
for (MusicList::iterator i = songs.begin(); i != songs.end(); ++i) {
initSoundResource(*i);
@@ -707,11 +669,35 @@ void ArrayTable::saveLoadWithSerializer(Common::Serializer &ser) {
sync_Table<ArrayTable>(ser, *this);
}
-void StringTable::saveLoadWithSerializer(Common::Serializer &ser) {
- if (ser.getVersion() < 18)
- return;
+void SciArray::saveLoadWithSerializer(Common::Serializer &s) {
+ uint16 savedSize;
+
+ if (s.isSaving()) {
+ savedSize = _size;
+ }
+
+ s.syncAsByte(_type);
+ s.syncAsByte(_elementSize);
+ s.syncAsUint16LE(savedSize);
+
+ if (s.isLoading()) {
+ resize(savedSize);
+ }
- sync_Table<StringTable>(ser, *this);
+ switch (_type) {
+ case kArrayTypeInt16:
+ case kArrayTypeID:
+ for (int i = 0; i < savedSize; ++i) {
+ syncWithSerializer(s, ((reg_t *)_data)[i]);
+ }
+ break;
+ case kArrayTypeByte:
+ case kArrayTypeString:
+ s.syncBytes((byte *)_data, savedSize);
+ break;
+ default:
+ error("Attempt to sync invalid SciArray type %d", _type);
+ }
}
void BitmapTable::saveLoadWithSerializer(Common::Serializer &ser) {
@@ -784,7 +770,7 @@ void GfxPalette::saveLoadWithSerializer(Common::Serializer &s) {
}
#ifdef ENABLE_SCI32
-void saveLoadPalette32(Common::Serializer &s, Palette *const palette) {
+static void saveLoadPalette32(Common::Serializer &s, Palette *const palette) {
s.syncAsUint32LE(palette->timestamp);
for (int i = 0; i < ARRAYSIZE(palette->colors); ++i) {
s.syncAsByte(palette->colors[i].used);
@@ -794,7 +780,7 @@ void saveLoadPalette32(Common::Serializer &s, Palette *const palette) {
}
}
-void saveLoadOptionalPalette32(Common::Serializer &s, Palette **const palette) {
+static void saveLoadOptionalPalette32(Common::Serializer &s, Palette **const palette) {
bool hasPalette;
if (s.isSaving()) {
hasPalette = (*palette != nullptr);
@@ -815,6 +801,16 @@ void GfxPalette32::saveLoadWithSerializer(Common::Serializer &s) {
if (s.isLoading()) {
++_version;
+
+ for (int i = 0; i < kNumCyclers; ++i) {
+ delete _cyclers[i];
+ _cyclers[i] = nullptr;
+ }
+
+ delete _varyTargetPalette;
+ _varyTargetPalette = nullptr;
+ delete _varyStartPalette;
+ _varyStartPalette = nullptr;
}
s.syncAsSint16LE(_varyDirection);
@@ -1044,10 +1040,11 @@ bool gamestate_save(EngineState *s, Common::WriteStream *fh, const Common::Strin
meta.gameObjectOffset = g_sci->getGameObject().getOffset();
// Checking here again
- if (s->executionStackBase) {
- warning("Cannot save from below kernel function");
- return false;
- }
+// TODO: This breaks Torin autosave, is there actually any reason for it?
+// if (s->executionStackBase) {
+// warning("Cannot save from below kernel function");
+// return false;
+// }
Common::Serializer ser(0, fh);
sync_SavegameMetadata(ser, meta);
diff --git a/engines/sci/engine/savegame.h b/engines/sci/engine/savegame.h
index 6616081a20..873394aebb 100644
--- a/engines/sci/engine/savegame.h
+++ b/engines/sci/engine/savegame.h
@@ -37,6 +37,7 @@ struct EngineState;
*
* Version - new/changed feature
* =============================
+ * 39 - Accurate SCI32 arrays/strings, score metadata, avatar metadata
* 38 - SCI32 cursor
* 37 - Segment entry data changed to pointers
* 36 - SCI32 bitmap segment
@@ -63,7 +64,7 @@ struct EngineState;
*/
enum {
- CURRENT_SAVEGAME_VERSION = 38,
+ CURRENT_SAVEGAME_VERSION = 39,
MINIMUM_SAVEGAME_VERSION = 14
};
@@ -77,6 +78,13 @@ struct SavegameMetadata {
uint32 playTime;
uint16 gameObjectOffset;
uint16 script0Size;
+
+ // Used by Shivers 1
+ uint16 lowScore;
+ uint16 highScore;
+
+ // Used by MGDX
+ uint8 avatarId;
};
/**
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 664e7fa0c4..f2f290fa9e 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -103,6 +103,9 @@ static const char *const selectorNameTable[] = {
"modNum", // King's Quest 6 CD / Laura Bow 2 CD for audio+text support
"cycler", // Space Quest 4 / system selector
"setLoop", // Laura Bow 1 Colonel's Bequest
+#ifdef ENABLE_SCI32
+ "newWith", // SCI2 array script
+#endif
NULL
};
@@ -132,8 +135,86 @@ enum ScriptPatcherSelectors {
SELECTOR_modNum,
SELECTOR_cycler,
SELECTOR_setLoop
+#ifdef ENABLE_SCI32
+ ,
+ SELECTOR_newWith
+#endif
+};
+
+#ifdef ENABLE_SCI32
+// It is not possible to change the directory for ScummVM save games, so disable
+// the "change directory" button in the standard save dialogue
+static const uint16 sci2ChangeDirSignature[] = {
+ 0x72, SIG_ADDTOOFFSET(+2), // lofsa changeDirI
+ 0x4a, SIG_UINT16(0x04), // send 4
+ SIG_MAGICDWORD,
+ 0x36, // push
+ 0x35, 0xF7, // ldi $f7
+ 0x12, // and
+ 0x36, // push
+ SIG_END
+};
+
+static const uint16 sci2ChangeDirPatch[] = {
+ PATCH_ADDTOOFFSET(+3), // lofsa changeDirI
+ PATCH_ADDTOOFFSET(+3), // send 4
+ PATCH_ADDTOOFFSET(+1), // push
+ 0x35, 0x00, // ldi 0
+ PATCH_END
+};
+
+// Save game script hardcodes the maximum number of save games to 20, but
+// this is an artificial constraint that does not apply to ScummVM
+static const uint16 sci2NumSavesSignature1[] = {
+ SIG_MAGICDWORD,
+ 0x8b, 0x02, // lsl local[2]
+ 0x35, 0x14, // ldi 20
+ 0x22, // lt?
+ SIG_END
+};
+
+static const uint16 sci2NumSavesPatch1[] = {
+ PATCH_ADDTOOFFSET(+2), // lsl local[2]
+ 0x35, 0x63, // ldi 99
+ PATCH_END
+};
+
+static const uint16 sci2NumSavesSignature2[] = {
+ SIG_MAGICDWORD,
+ 0x8b, 0x02, // lsl local[2]
+ 0x35, 0x14, // ldi 20
+ 0x1a, // eq?
+ SIG_END
+};
+
+static const uint16 sci2NumSavesPatch2[] = {
+ PATCH_ADDTOOFFSET(+2), // lsl local[2]
+ 0x35, 0x63, // ldi 99
+ PATCH_END
};
+// Phantasmagoria & SQ6 try to initialize the first entry of an int16 array
+// using an empty string, which is not valid (it should be a number)
+static const uint16 sci21IntArraySignature[] = {
+ 0x38, SIG_SELECTOR16(newWith), // pushi newWith
+ 0x7a, // push2
+ 0x39, 0x04, // pushi $4
+ 0x72, SIG_ADDTOOFFSET(+2), // lofsa string ""
+ SIG_MAGICDWORD,
+ 0x36, // push
+ 0x51, 0x0b, // class IntArray
+ 0x4a, 0x8, // send $8
+ SIG_END
+};
+
+static const uint16 sci21IntArrayPatch[] = {
+ PATCH_ADDTOOFFSET(+6), // push $b9; push2; pushi $4
+ 0x76, // push0
+ 0x34, PATCH_UINT16(0x0001), // ldi 0001 (waste bytes)
+ PATCH_END
+};
+#endif
+
// ===========================================================================
// Conquests of Camelot
// At the bazaar in Jerusalem, it's possible to see a girl taking a shower.
@@ -614,6 +695,10 @@ static const SciScriptPatcherEntry freddypharkasSignatures[] = {
SCI_SIGNATUREENTRY_TERMINATOR
};
+#ifdef ENABLE_SCI32
+#pragma mark -
+#pragma mark Gabriel Knight 1
+
// ===========================================================================
// 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
@@ -918,9 +1003,25 @@ static const SciScriptPatcherEntry gk1Signatures[] = {
{ true, 230, "day 6 police beignet timer issue", 1, gk1SignatureDay6PoliceBeignet, gk1PatchDay6PoliceBeignet },
{ true, 230, "day 6 police sleep timer issue", 1, gk1SignatureDay6PoliceSleep, gk1PatchDay6PoliceSleep },
{ true, 808, "day 10 gabriel dress up infinite turning", 1, gk1SignatureDay10GabrielDressUp, gk1PatchDay10GabrielDressUp },
+ { true, 64990, "increase number of save games", 1, sci2NumSavesSignature1, sci2NumSavesPatch1 },
+ { true, 64990, "increase number of save games", 1, sci2NumSavesSignature2, sci2NumSavesPatch2 },
+ { true, 64990, "disable change directory button", 1, sci2ChangeDirSignature, sci2ChangeDirPatch },
+ SCI_SIGNATUREENTRY_TERMINATOR
+};
+
+#pragma mark -
+#pragma mark Gabriel Knight 2
+
+// script, description, signature patch
+static const SciScriptPatcherEntry gk2Signatures[] = {
+ { true, 64990, "increase number of save games", 1, sci2NumSavesSignature1, sci2NumSavesPatch1 },
+ { true, 64990, "increase number of save games", 1, sci2NumSavesSignature2, sci2NumSavesPatch2 },
+ { true, 64990, "disable change directory button", 1, sci2ChangeDirSignature, sci2ChangeDirPatch },
SCI_SIGNATUREENTRY_TERMINATOR
};
+#endif
+
// ===========================================================================
// at least during harpy scene export 29 of script 0 is called in kq5cd and
// has an issue for those calls, where temp 3 won't get inititialized, but
@@ -1618,6 +1719,10 @@ static const SciScriptPatcherEntry kq6Signatures[] = {
SCI_SIGNATUREENTRY_TERMINATOR
};
+#ifdef ENABLE_SCI32
+#pragma mark -
+#pragma mark Kings Quest 7
+
// ===========================================================================
// King's Quest 7 has really weird subtitles. It seems as if the subtitles were
@@ -1753,7 +1858,7 @@ static const uint16 kq7SignatureSubtitleFix3[] = {
static const uint16 kq7PatchSubtitleFix3[] = {
PATCH_ADDTOOFFSET(+2), // skip over "pToa initialized code"
0x2f, 0x0c, // bt [skip init code] - saved 1 byte
- 0x38,
+ 0x38,
PATCH_GETORIGINALBYTE(+6),
PATCH_GETORIGINALBYTE(+7), // pushi (init)
0x76, // push0
@@ -1779,6 +1884,8 @@ static const SciScriptPatcherEntry kq7Signatures[] = {
SCI_SIGNATUREENTRY_TERMINATOR
};
+#endif
+
// ===========================================================================
// Script 210 in the German version of Longbow handles the case where Robin
// hands out the scroll to Marion and then types his name using the hand code.
@@ -2079,6 +2186,20 @@ static const SciScriptPatcherEntry larry6Signatures[] = {
SCI_SIGNATUREENTRY_TERMINATOR
};
+#ifdef ENABLE_SCI32
+#pragma mark -
+#pragma mark Leisure Suit Larry 6 Hires
+
+// script, description, signature patch
+static const SciScriptPatcherEntry larry6HiresSignatures[] = {
+ { true, 64990, "increase number of save games", 1, sci2NumSavesSignature1, sci2NumSavesPatch1 },
+ { true, 64990, "increase number of save games", 1, sci2NumSavesSignature2, sci2NumSavesPatch2 },
+ { true, 64990, "disable change directory button", 1, sci2ChangeDirSignature, sci2ChangeDirPatch },
+ SCI_SIGNATUREENTRY_TERMINATOR
+};
+
+#endif
+
// ===========================================================================
// Laura Bow 1 - Colonel's Bequest
//
@@ -2700,6 +2821,18 @@ static const SciScriptPatcherEntry mothergoose256Signatures[] = {
SCI_SIGNATUREENTRY_TERMINATOR
};
+#ifdef ENABLE_SCI32
+#pragma mark -
+#pragma mark Phantasmagoria
+
+// script, description, signature patch
+static const SciScriptPatcherEntry phantasmagoriaSignatures[] = {
+ { true, 901, "invalid array construction", 1, sci21IntArraySignature, sci21IntArrayPatch },
+ SCI_SIGNATUREENTRY_TERMINATOR
+};
+
+#endif
+
// ===========================================================================
// Police Quest 1 VGA
@@ -2841,6 +2974,20 @@ static const SciScriptPatcherEntry pq1vgaSignatures[] = {
SCI_SIGNATUREENTRY_TERMINATOR
};
+#ifdef ENABLE_SCI32
+#pragma mark -
+#pragma mark Police Quest 4
+
+// script, description, signature patch
+static const SciScriptPatcherEntry pq4Signatures[] = {
+ { true, 64990, "increase number of save games", 1, sci2NumSavesSignature1, sci2NumSavesPatch1 },
+ { true, 64990, "increase number of save games", 1, sci2NumSavesSignature2, sci2NumSavesPatch2 },
+ { true, 64990, "disable change directory button", 1, sci2ChangeDirSignature, sci2ChangeDirPatch },
+ SCI_SIGNATUREENTRY_TERMINATOR
+};
+
+#endif
+
// ===========================================================================
// At the healer's house there is a bird's nest up on the tree.
// The player can throw rocks at it until it falls to the ground.
@@ -3745,7 +3892,7 @@ static const uint16 qfg3PatchRoom750Bounds1[] = {
static const uint16 qfg3SignatureRoom750Bounds2[] = {
// (ego x: 294 y: 39)
0x78, // push1 ("x")
- 0x78, // push1
+ 0x78, // push1
0x38, SIG_UINT16(294), // pushi 294
0x76, // push0 ("y")
0x78, // push1
@@ -3808,6 +3955,20 @@ static const SciScriptPatcherEntry qfg3Signatures[] = {
SCI_SIGNATUREENTRY_TERMINATOR
};
+#ifdef ENABLE_SCI32
+#pragma mark -
+#pragma mark Quest for Glory 4
+
+// script, description, signature patch
+static const SciScriptPatcherEntry qfg4Signatures[] = {
+ { true, 64990, "increase number of save games", 1, sci2NumSavesSignature1, sci2NumSavesPatch1 },
+ { true, 64990, "increase number of save games", 1, sci2NumSavesSignature2, sci2NumSavesPatch2 },
+ { true, 64990, "disable change directory button", 1, sci2ChangeDirSignature, sci2ChangeDirPatch },
+ SCI_SIGNATUREENTRY_TERMINATOR
+};
+
+#endif
+
// ===========================================================================
// script 298 of sq4/floppy has an issue. object "nest" uses another property
// which isn't included in property count. We return 0 in that case, the game
@@ -4371,6 +4532,34 @@ static const SciScriptPatcherEntry sq5Signatures[] = {
SCI_SIGNATUREENTRY_TERMINATOR
};
+#ifdef ENABLE_SCI32
+#pragma mark -
+#pragma mark Space Quest 6
+
+// script, description, signature patch
+static const SciScriptPatcherEntry sq6Signatures[] = {
+ { true, 15, "invalid array construction", 1, sci21IntArraySignature, sci21IntArrayPatch },
+ { true, 22, "invalid array construction", 1, sci21IntArraySignature, sci21IntArrayPatch },
+ { true, 460, "invalid array construction", 1, sci21IntArraySignature, sci21IntArrayPatch },
+ { true, 510, "invalid array construction", 1, sci21IntArraySignature, sci21IntArrayPatch },
+ { true, 64990, "increase number of save games", 1, sci2NumSavesSignature1, sci2NumSavesPatch1 },
+ { true, 64990, "increase number of save games", 1, sci2NumSavesSignature2, sci2NumSavesPatch2 },
+ { true, 64990, "disable change directory button", 1, sci2ChangeDirSignature, sci2ChangeDirPatch },
+ SCI_SIGNATUREENTRY_TERMINATOR
+};
+
+#pragma mark -
+#pragma mark Torins Passage
+
+// script, description, signature patch
+static const SciScriptPatcherEntry torinSignatures[] = {
+ { true, 64990, "increase number of save games", 1, sci2NumSavesSignature1, sci2NumSavesPatch1 },
+ { true, 64990, "increase number of save games", 1, sci2NumSavesSignature2, sci2NumSavesPatch2 },
+ SCI_SIGNATUREENTRY_TERMINATOR
+};
+
+#endif
+
// =================================================================================
ScriptPatcher::ScriptPatcher() {
@@ -4802,18 +4991,25 @@ void ScriptPatcher::processScript(uint16 scriptNr, byte *scriptData, const uint3
case GID_FREDDYPHARKAS:
signatureTable = freddypharkasSignatures;
break;
+#ifdef ENABLE_SCI32
case GID_GK1:
signatureTable = gk1Signatures;
break;
+ case GID_GK2:
+ signatureTable = gk2Signatures;
+ break;
+#endif
case GID_KQ5:
signatureTable = kq5Signatures;
break;
case GID_KQ6:
signatureTable = kq6Signatures;
break;
+#ifdef ENABLE_SCI32
case GID_KQ7:
signatureTable = kq7Signatures;
break;
+#endif
case GID_LAURABOW:
signatureTable = laurabow1Signatures;
break;
@@ -4832,12 +5028,27 @@ void ScriptPatcher::processScript(uint16 scriptNr, byte *scriptData, const uint3
case GID_LSL6:
signatureTable = larry6Signatures;
break;
+#ifdef ENABLE_SCI32
+ case GID_LSL6HIRES:
+ signatureTable = larry6HiresSignatures;
+ break;
+#endif
case GID_MOTHERGOOSE256:
signatureTable = mothergoose256Signatures;
break;
+#ifdef ENABLE_SCI32
+ case GID_PHANTASMAGORIA:
+ signatureTable = phantasmagoriaSignatures;
+ break;
+#endif
case GID_PQ1:
signatureTable = pq1vgaSignatures;
break;
+#ifdef ENABLE_SCI32
+ case GID_PQ4:
+ signatureTable = pq4Signatures;
+ break;
+#endif
case GID_QFG1:
signatureTable = qfg1egaSignatures;
break;
@@ -4850,6 +5061,11 @@ void ScriptPatcher::processScript(uint16 scriptNr, byte *scriptData, const uint3
case GID_QFG3:
signatureTable = qfg3Signatures;
break;
+#ifdef ENABLE_SCI32
+ case GID_QFG4:
+ signatureTable = qfg4Signatures;
+ break;
+#endif
case GID_SQ1:
signatureTable = sq1vgaSignatures;
break;
@@ -4859,6 +5075,14 @@ void ScriptPatcher::processScript(uint16 scriptNr, byte *scriptData, const uint3
case GID_SQ5:
signatureTable = sq5Signatures;
break;
+#ifdef ENABLE_SCI32
+ case GID_SQ6:
+ signatureTable = sq6Signatures;
+ break;
+ case GID_TORIN:
+ signatureTable = torinSignatures;
+ break;
+#endif
default:
break;
}
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index 5cf8d6162d..83e7495b3c 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -42,7 +42,6 @@ SegManager::SegManager(ResourceManager *resMan, ScriptPatcher *scriptPatcher)
#ifdef ENABLE_SCI32
_arraysSegId = 0;
- _stringSegId = 0;
_bitmapSegId = 0;
#endif
@@ -72,7 +71,6 @@ void SegManager::resetSegMan() {
#ifdef ENABLE_SCI32
_arraysSegId = 0;
- _stringSegId = 0;
_bitmapSegId = 0;
#endif
@@ -88,9 +86,8 @@ void SegManager::initSysStrings() {
_parserPtr = make_reg(_saveDirPtr.getSegment(), _saveDirPtr.getOffset() + 256);
#ifdef ENABLE_SCI32
} else {
- SciString *saveDirString = allocateString(&_saveDirPtr);
- saveDirString->setSize(256);
- saveDirString->setValue(0, 0);
+ SciArray *saveDirString = allocateArray(kArrayTypeString, 256, &_saveDirPtr);
+ saveDirString->byteAt(0) = '\0';
_parserPtr = NULL_REG; // no SCI2 game had a parser
#endif
@@ -863,7 +860,10 @@ bool SegManager::freeDynmem(reg_t addr) {
}
#ifdef ENABLE_SCI32
-SciArray<reg_t> *SegManager::allocateArray(reg_t *addr) {
+#pragma mark -
+#pragma mark Arrays
+
+SciArray *SegManager::allocateArray(SciArrayType type, uint16 size, reg_t *addr) {
ArrayTable *table;
int offset;
@@ -875,10 +875,14 @@ SciArray<reg_t> *SegManager::allocateArray(reg_t *addr) {
offset = table->allocEntry();
*addr = make_reg(_arraysSegId, offset);
- return &table->at(offset);
+
+ SciArray *array = &table->at(offset);
+ array->setType(type);
+ array->resize(size);
+ return array;
}
-SciArray<reg_t> *SegManager::lookupArray(reg_t addr) {
+SciArray *SegManager::lookupArray(reg_t addr) {
if (_heap[addr.getSegment()]->getType() != SEG_TYPE_ARRAY)
error("Attempt to use non-array %04x:%04x as array", PRINT_REG(addr));
@@ -899,54 +903,17 @@ void SegManager::freeArray(reg_t addr) {
if (!arrayTable.isValidEntry(addr.getOffset()))
error("Attempt to use non-array %04x:%04x as array", PRINT_REG(addr));
- arrayTable[addr.getOffset()].destroy();
arrayTable.freeEntry(addr.getOffset());
}
-SciString *SegManager::allocateString(reg_t *addr) {
- StringTable *table;
- int offset;
-
- if (!_stringSegId) {
- table = (StringTable *)allocSegment(new StringTable(), &(_stringSegId));
- } else
- table = (StringTable *)_heap[_stringSegId];
-
- offset = table->allocEntry();
-
- *addr = make_reg(_stringSegId, offset);
- return &table->at(offset);
-}
-
-SciString *SegManager::lookupString(reg_t addr) {
- if (_heap[addr.getSegment()]->getType() != SEG_TYPE_STRING)
- error("lookupString: Attempt to use non-string %04x:%04x as string", PRINT_REG(addr));
-
- StringTable &stringTable = *(StringTable *)_heap[addr.getSegment()];
-
- if (!stringTable.isValidEntry(addr.getOffset()))
- error("lookupString: Attempt to use non-string %04x:%04x as string", PRINT_REG(addr));
-
- return &(stringTable[addr.getOffset()]);
-}
-
-void SegManager::freeString(reg_t addr) {
- if (_heap[addr.getSegment()]->getType() != SEG_TYPE_STRING)
- error("freeString: Attempt to use non-string %04x:%04x as string", PRINT_REG(addr));
-
- StringTable &stringTable = *(StringTable *)_heap[addr.getSegment()];
-
- if (!stringTable.isValidEntry(addr.getOffset()))
- error("freeString: Attempt to use non-string %04x:%04x as string", PRINT_REG(addr));
-
- stringTable[addr.getOffset()].destroy();
- stringTable.freeEntry(addr.getOffset());
+bool SegManager::isArray(reg_t addr) const {
+ return addr.getSegment() == _arraysSegId;
}
#pragma mark -
#pragma mark Bitmaps
-SciBitmap *SegManager::allocateBitmap(reg_t *addr, const int16 width, const int16 height, const uint8 skipColor, const int16 displaceX, const int16 displaceY, const int16 scaledWidth, const int16 scaledHeight, const uint32 paletteSize, const bool remap, const bool gc) {
+SciBitmap *SegManager::allocateBitmap(reg_t *addr, const int16 width, const int16 height, const uint8 skipColor, const int16 originX, const int16 originY, const int16 xResolution, const int16 yResolution, const uint32 paletteSize, const bool remap, const bool gc) {
BitmapTable *table;
int offset;
@@ -961,7 +928,7 @@ SciBitmap *SegManager::allocateBitmap(reg_t *addr, const int16 width, const int1
*addr = make_reg(_bitmapSegId, offset);
SciBitmap &bitmap = table->at(offset);
- bitmap.create(width, height, skipColor, displaceX, displaceY, scaledWidth, scaledHeight, paletteSize, remap, gc);
+ bitmap.create(width, height, skipColor, originX, originY, xResolution, yResolution, paletteSize, remap, gc);
return &bitmap;
}
diff --git a/engines/sci/engine/seg_manager.h b/engines/sci/engine/seg_manager.h
index 8ed1c3a143..c409744711 100644
--- a/engines/sci/engine/seg_manager.h
+++ b/engines/sci/engine/seg_manager.h
@@ -433,16 +433,12 @@ public:
reg_t getParserPtr() const { return _parserPtr; }
#ifdef ENABLE_SCI32
- SciArray<reg_t> *allocateArray(reg_t *addr);
- SciArray<reg_t> *lookupArray(reg_t addr);
+ SciArray *allocateArray(SciArrayType type, uint16 size, reg_t *addr);
+ SciArray *lookupArray(reg_t addr);
void freeArray(reg_t addr);
+ bool isArray(reg_t addr) const;
- SciString *allocateString(reg_t *addr);
- SciString *lookupString(reg_t addr);
- void freeString(reg_t addr);
- SegmentId getStringSegmentId() { return _stringSegId; }
-
- SciBitmap *allocateBitmap(reg_t *addr, const int16 width, const int16 height, const uint8 skipColor = kDefaultSkipColor, const int16 displaceX = 0, const int16 displaceY = 0, const int16 scaledWidth = kLowResX, const int16 scaledHeight = kLowResY, const uint32 paletteSize = 0, const bool remap = false, const bool gc = true);
+ SciBitmap *allocateBitmap(reg_t *addr, const int16 width, const int16 height, const uint8 skipColor = kDefaultSkipColor, const int16 originX = 0, const int16 originY = 0, const int16 xResolution = kLowResX, const int16 yResolution = kLowResY, const uint32 paletteSize = 0, const bool remap = false, const bool gc = true);
SciBitmap *lookupBitmap(reg_t addr);
void freeBitmap(reg_t addr);
#endif
@@ -469,7 +465,6 @@ private:
#ifdef ENABLE_SCI32
SegmentId _arraysSegId;
- SegmentId _stringSegId;
SegmentId _bitmapSegId;
#endif
diff --git a/engines/sci/engine/segment.cpp b/engines/sci/engine/segment.cpp
index 7943946ee4..fffa7f4d7e 100644
--- a/engines/sci/engine/segment.cpp
+++ b/engines/sci/engine/segment.cpp
@@ -67,9 +67,6 @@ SegmentObj *SegmentObj::createSegmentObj(SegmentType type) {
case SEG_TYPE_ARRAY:
mem = new ArrayTable();
break;
- case SEG_TYPE_STRING:
- mem = new StringTable();
- break;
case SEG_TYPE_BITMAP:
mem = new BitmapTable();
break;
@@ -254,63 +251,39 @@ SegmentRef DynMem::dereference(reg_t pointer) {
SegmentRef ArrayTable::dereference(reg_t pointer) {
SegmentRef ret;
- ret.isRaw = false;
- ret.maxSize = at(pointer.getOffset()).getSize() * 2;
- ret.reg = at(pointer.getOffset()).getRawData();
- return ret;
-}
-void ArrayTable::freeAtAddress(SegManager *segMan, reg_t sub_addr) {
- at(sub_addr.getOffset()).destroy();
- freeEntry(sub_addr.getOffset());
+ SciArray &array = at(pointer.getOffset());
+ const bool isRaw = array.getType() == kArrayTypeByte || array.getType() == kArrayTypeString;
+
+ ret.isRaw = isRaw;
+ ret.maxSize = array.byteSize();
+ if (isRaw) {
+ ret.raw = (byte *)array.getRawData();
+ } else {
+ ret.reg = (reg_t *)array.getRawData();
+ }
+ return ret;
}
Common::Array<reg_t> ArrayTable::listAllOutgoingReferences(reg_t addr) const {
- Common::Array<reg_t> tmp;
+ Common::Array<reg_t> refs;
if (!isValidEntry(addr.getOffset())) {
- error("Invalid array referenced for outgoing references: %04x:%04x", PRINT_REG(addr));
+ // Scripts may still hold references to array memory that has been
+ // explicitly freed; ignore these references
+ return refs;
}
- const SciArray<reg_t> *array = &at(addr.getOffset());
-
- for (uint32 i = 0; i < array->getSize(); i++) {
- reg_t value = array->getValue(i);
- if (value.getSegment() != 0)
- tmp.push_back(value);
+ SciArray &array = const_cast<SciArray &>(at(addr.getOffset()));
+ if (array.getType() == kArrayTypeID || array.getType() == kArrayTypeInt16) {
+ for (uint16 i = 0; i < array.size(); ++i) {
+ const reg_t value = array.getAsID(i);
+ if (value.isPointer()) {
+ refs.push_back(value);
+ }
+ }
}
- return tmp;
-}
-
-Common::String SciString::toString() const {
- if (_type != 3)
- error("SciString::toString(): Array is not a string");
-
- Common::String string;
- for (uint32 i = 0; i < _size && _data[i] != 0; i++)
- string += _data[i];
-
- return string;
-}
-
-void SciString::fromString(const Common::String &string) {
- if (_type != 3)
- error("SciString::fromString(): Array is not a string");
-
- setSize(string.size() + 1);
-
- for (uint32 i = 0; i < string.size(); i++)
- _data[i] = string[i];
-
- _data[string.size()] = 0;
-}
-
-SegmentRef StringTable::dereference(reg_t pointer) {
- SegmentRef ret;
- ret.isRaw = true;
- ret.maxSize = at(pointer.getOffset()).getSize();
- ret.raw = (byte *)at(pointer.getOffset()).getRawData();
- return ret;
+ return refs;
}
#endif
diff --git a/engines/sci/engine/segment.h b/engines/sci/engine/segment.h
index add5f4c57c..361c1cb895 100644
--- a/engines/sci/engine/segment.h
+++ b/engines/sci/engine/segment.h
@@ -24,7 +24,7 @@
#define SCI_ENGINE_SEGMENT_H
#include "common/serializer.h"
-
+#include "common/str.h"
#include "sci/engine/object.h"
#include "sci/engine/vm.h"
#include "sci/engine/vm_types.h" // for reg_t
@@ -70,7 +70,7 @@ enum SegmentType {
#ifdef ENABLE_SCI32
SEG_TYPE_ARRAY = 11,
- SEG_TYPE_STRING = 12,
+ // 12 used to be string, now obsolete
SEG_TYPE_BITMAP = 13,
#endif
@@ -408,142 +408,456 @@ public:
#ifdef ENABLE_SCI32
-template<typename T>
-class SciArray {
+#pragma mark -
+#pragma mark Arrays
+
+enum SciArrayType {
+ kArrayTypeInt16 = 0,
+ kArrayTypeID = 1,
+ kArrayTypeByte = 2,
+ kArrayTypeString = 3,
+ // Type 4 was for 32-bit integers; never used
+ kArrayTypeInvalid = 5
+};
+
+enum SciArrayTrim {
+ kArrayTrimRight = 1, ///< Trim whitespace after the last non-whitespace character
+ kArrayTrimCenter = 2, ///< Trim whitespace between non-whitespace characters
+ kArrayTrimLeft = 4 ///< Trim whitespace before the first non-whitespace character
+};
+
+class SciArray : public Common::Serializable {
public:
- SciArray() : _type(-1), _data(NULL), _size(0), _actualSize(0) { }
+ SciArray() :
+ _type(kArrayTypeInvalid),
+ _size(0),
+ _data(nullptr) {}
- SciArray(const SciArray<T> &array) {
+ SciArray(const SciArray &array) {
_type = array._type;
_size = array._size;
- _actualSize = array._actualSize;
- _data = new T[_actualSize];
+ _elementSize = array._elementSize;
+ _data = malloc(_elementSize * _size);
assert(_data);
- memcpy(_data, array._data, _size * sizeof(T));
+ memcpy(_data, array._data, _elementSize * _size);
}
- SciArray<T>& operator=(const SciArray<T> &array) {
+ SciArray &operator=(const SciArray &array) {
if (this == &array)
return *this;
- delete[] _data;
+ free(_data);
_type = array._type;
_size = array._size;
- _actualSize = array._actualSize;
- _data = new T[_actualSize];
+ _elementSize = array._elementSize;
+ _data = malloc(_elementSize * _size);
assert(_data);
- memcpy(_data, array._data, _size * sizeof(T));
+ memcpy(_data, array._data, _elementSize * _size);
return *this;
}
virtual ~SciArray() {
- destroy();
+ free(_data);
+ _size = 0;
+ _type = kArrayTypeInvalid;
}
- virtual void destroy() {
- delete[] _data;
- _data = NULL;
- _type = -1;
- _size = _actualSize = 0;
- }
+ void saveLoadWithSerializer(Common::Serializer &s);
- void setType(byte type) {
- if (_type >= 0)
- error("SciArray::setType(): Type already set");
+ /**
+ * Returns the type of this array.
+ */
+ SciArrayType getType() const {
+ return _type;
+ }
+ /**
+ * Sets the type of this array. The type of the array may only be set once.
+ */
+ void setType(const SciArrayType type) {
+ assert(_type == kArrayTypeInvalid);
+ switch(type) {
+ case kArrayTypeInt16:
+ case kArrayTypeID:
+ _elementSize = sizeof(reg_t);
+ break;
+ case kArrayTypeString:
+ _elementSize = sizeof(char);
+ break;
+ case kArrayTypeByte:
+ _elementSize = sizeof(byte);
+ break;
+ default:
+ error("Invalid array type %d", type);
+ }
_type = type;
}
- void setSize(uint32 size) {
- if (_type < 0)
- error("SciArray::setSize(): No type set");
+ /**
+ * Returns the size of the array, in elements.
+ */
+ uint16 size() const {
+ return _size;
+ }
- // Check if we don't have to do anything
- if (_size == size)
- return;
+ /**
+ * Returns the size of the array, in bytes.
+ */
+ uint16 byteSize() const {
+ return _size * _elementSize;
+ }
- // Check if we don't have to expand the array
- if (size <= _actualSize) {
- _size = size;
- return;
+ /**
+ * Ensures the array is large enough to store at least the given number of
+ * values given in `newSize`. If `force` is true, the array will be resized
+ * to store exactly `newSize` values. New values are initialized to zero.
+ */
+ void resize(uint16 newSize, const bool force = false) {
+ if (force || newSize > _size) {
+ _data = realloc(_data, _elementSize * newSize);
+ if (newSize > _size) {
+ memset((byte *)_data + _elementSize * _size, 0, (newSize - _size) * _elementSize);
+ }
+ _size = newSize;
}
+ }
- // So, we're going to have to create an array of some sort
- T *newArray = new T[size];
- memset(newArray, 0, size * sizeof(T));
+ /**
+ * Shrinks a string array to its optimal size.
+ */
+ void snug() {
+ assert(_type == kArrayTypeString || _type == kArrayTypeByte);
+ resize(strlen((char *)_data) + 1, true);
+ }
- // Check if we never created an array before
- if (!_data) {
- _size = _actualSize = size;
- _data = newArray;
- return;
+ /**
+ * Returns a pointer to the array's raw data storage.
+ */
+ void *getRawData() { return _data; }
+ const void *getRawData() const { return _data; }
+
+ /**
+ * Gets the value at the given index as a reg_t.
+ */
+ reg_t getAsID(const uint16 index) {
+ if (getSciVersion() >= SCI_VERSION_3) {
+ resize(index);
+ } else {
+ assert(index < _size);
}
- // Copy data from the old array to the new
- memcpy(newArray, _data, _size * sizeof(T));
+ switch(_type) {
+ case kArrayTypeInt16:
+ case kArrayTypeID:
+ return ((reg_t *)_data)[index];
+ case kArrayTypeByte:
+ case kArrayTypeString:
+ return make_reg(0, ((byte *)_data)[index]);
+ default:
+ error("Invalid array type %d", _type);
+ }
+ }
+
+ /**
+ * Sets the value at the given index from a reg_t.
+ */
+ void setFromID(const uint16 index, const reg_t value) {
+ if (getSciVersion() >= SCI_VERSION_3) {
+ resize(index);
+ } else {
+ assert(index < _size);
+ }
- // Now set the new array to the old and set the sizes
- delete[] _data;
- _data = newArray;
- _size = _actualSize = size;
+ switch(_type) {
+ case kArrayTypeInt16:
+ case kArrayTypeID:
+ ((reg_t *)_data)[index] = value;
+ break;
+ case kArrayTypeByte:
+ case kArrayTypeString:
+ ((byte *)_data)[index] = value.toSint16();
+ break;
+ default:
+ error("Invalid array type %d", _type);
+ }
}
- T getValue(uint16 index) const {
- if (index >= _size)
- error("SciArray::getValue(): %d is out of bounds (%d)", index, _size);
+ /**
+ * Gets the value at the given index as an int16.
+ */
+ int16 getAsInt16(const uint16 index) {
+ assert(_type == kArrayTypeInt16);
- return _data[index];
+ if (getSciVersion() >= SCI_VERSION_3) {
+ resize(index);
+ } else {
+ assert(index < _size);
+ }
+
+ const reg_t value = ((reg_t *)_data)[index];
+ assert(value.isNumber());
+ return value.toSint16();
}
- void setValue(uint16 index, T value) {
- if (index >= _size)
- error("SciArray::setValue(): %d is out of bounds (%d)", index, _size);
+ /**
+ * Sets the value at the given index from an int16.
+ */
+ void setFromInt16(const uint16 index, const int16 value) {
+ assert(_type == kArrayTypeInt16);
+
+ if (getSciVersion() >= SCI_VERSION_3) {
+ resize(index + 1);
+ } else {
+ assert(index < _size);
+ }
- _data[index] = value;
+ ((reg_t *)_data)[index] = make_reg(0, value);
}
- byte getType() const { return _type; }
- uint32 getSize() const { return _size; }
- T *getRawData() { return _data; }
- const T *getRawData() const { return _data; }
+ /**
+ * Returns a reference to the byte at the given index. Only valid for
+ * string and byte arrays.
+ */
+ byte &byteAt(const uint16 index) {
+ assert(_type == kArrayTypeString || _type == kArrayTypeByte);
-protected:
- int8 _type;
- T *_data;
- uint32 _size; // _size holds the number of entries that the scripts have requested
- uint32 _actualSize; // _actualSize is the actual numbers of entries allocated
-};
+ if (getSciVersion() >= SCI_VERSION_3) {
+ resize(index);
+ } else {
+ assert(index < _size);
+ }
-class SciString : public SciArray<char> {
-public:
- SciString() : SciArray<char>() { setType(3); }
+ return ((byte *)_data)[index];
+ }
- // We overload destroy to ensure the string type is 3 after destroying
- void destroy() { SciArray<char>::destroy(); _type = 3; }
+ /**
+ * Returns a reference to the char at the given index. Only valid for
+ * string and byte arrays.
+ */
+ char &charAt(const uint16 index) {
+ assert(_type == kArrayTypeString || _type == kArrayTypeByte);
- Common::String toString() const;
- void fromString(const Common::String &string);
-};
+ if (getSciVersion() >= SCI_VERSION_3) {
+ resize(index);
+ } else {
+ assert(index < _size);
+ }
-struct ArrayTable : public SegmentObjTable<SciArray<reg_t> > {
- ArrayTable() : SegmentObjTable<SciArray<reg_t> >(SEG_TYPE_ARRAY) {}
+ return ((char *)_data)[index];
+ }
- virtual void freeAtAddress(SegManager *segMan, reg_t sub_addr);
- virtual Common::Array<reg_t> listAllOutgoingReferences(reg_t object) const;
+ /**
+ * Returns a reference to the reg_t at the given index. Only valid for ID
+ * and int16 arrays.
+ */
+ reg_t &IDAt(const uint16 index) {
+ assert(_type == kArrayTypeID || _type == kArrayTypeInt16);
- void saveLoadWithSerializer(Common::Serializer &ser);
- SegmentRef dereference(reg_t pointer);
-};
+ if (getSciVersion() >= SCI_VERSION_3) {
+ resize(index);
+ } else {
+ assert(index < _size);
+ }
-struct StringTable : public SegmentObjTable<SciString> {
- StringTable() : SegmentObjTable<SciString>(SEG_TYPE_STRING) {}
+ return ((reg_t *)_data)[index];
+ }
- virtual void freeAtAddress(SegManager *segMan, reg_t sub_addr) {
- at(sub_addr.getOffset()).destroy();
- freeEntry(sub_addr.getOffset());
+ /**
+ * Reads values from the given reg_t pointer and sets them in the array,
+ * growing the array if needed to store all values.
+ */
+ void setElements(const uint16 index, uint16 count, const reg_t *values) {
+ resize(index + count);
+
+ switch (_type) {
+ case kArrayTypeInt16:
+ case kArrayTypeID: {
+ const reg_t *source = values;
+ reg_t *target = (reg_t *)_data + index;
+ while (count--) {
+ *target++ = *source++;
+ }
+ break;
+ }
+ case kArrayTypeByte:
+ case kArrayTypeString: {
+ const reg_t *source = values;
+ byte *target = (byte *)_data + index;
+ while (count--) {
+ if (!source->isNumber()) {
+ error("Non-number %04x:%04x sent to byte or string array", PRINT_REG(*source));
+ }
+ *target++ = source->getOffset();
+ ++source;
+ }
+ break;
+ }
+ default:
+ error("Attempted write to SciArray with invalid type %d", _type);
+ }
+ }
+
+ /**
+ * Fills the array with the given value. Existing values will be
+ * overwritten. The array will be grown if needed to store all values.
+ */
+ void fill(const uint16 index, uint16 count, const reg_t value) {
+ if (count == 65535 /* -1 */) {
+ count = size() - index;
+ }
+
+ if (!count) {
+ return;
+ }
+
+ resize(index + count);
+
+ switch (_type) {
+ case kArrayTypeInt16:
+ case kArrayTypeID: {
+ reg_t *target = (reg_t *)_data + index;
+ while (count--) {
+ *target = value;
+ }
+ break;
+ }
+ case kArrayTypeByte:
+ case kArrayTypeString: {
+ byte *target = (byte *)_data + index;
+ const byte fillValue = value.getOffset();
+ while (count--) {
+ *target = fillValue;
+ }
+ break;
+ }
+ case kArrayTypeInvalid:
+ error("Attempted write to uninitialized SciArray");
+ }
+ }
+
+ /**
+ * Copies values from the source array. Both arrays will be grown if needed
+ * to prevent out-of-bounds reads/writes.
+ */
+ void copy(SciArray &source, const uint16 sourceIndex, const uint16 targetIndex, uint16 count) {
+ if (count == 65535 /* -1 */) {
+ count = source.size() - sourceIndex;
+ }
+
+ if (!count) {
+ return;
+ }
+
+ resize(targetIndex + count);
+ source.resize(sourceIndex + count);
+
+ assert(source._elementSize == _elementSize);
+
+ const byte *sourceData = (byte *)source._data + sourceIndex * source._elementSize;
+ byte *targetData = (byte *)_data + targetIndex * _elementSize;
+ memmove(targetData, sourceData, count * _elementSize);
+ }
+
+ void byteCopy(const SciArray &source, const uint16 sourceOffset, const uint16 targetOffset, const uint16 count) {
+ error("SciArray::byteCopy not implemented");
}
+ /**
+ * Removes whitespace from string data held in this array.
+ */
+ void trim(const int8 flags, const char showChar) {
+ enum {
+ kWhitespaceBoundary = 32,
+ kAsciiBoundary = 128
+ };
+
+ byte *data = (byte *)_data;
+ byte *source;
+ byte *target;
+
+ if (flags & kArrayTrimLeft) {
+ target = data;
+ source = data;
+ while (*source != '\0' && *source != showChar && *source <= kWhitespaceBoundary) {
+ ++source;
+ }
+ strcpy((char *)target, (char *)source);
+ }
+
+ if (flags & kArrayTrimRight) {
+ source = data + strlen((char *)data) - 1;
+ while (source > data && *source != showChar && *source <= kWhitespaceBoundary) {
+ --source;
+ }
+ *source = '\0';
+ }
+
+ if (flags & kArrayTrimCenter) {
+ target = data;
+ while (*target && *target <= kWhitespaceBoundary && *target != showChar) {
+ ++target;
+ }
+
+ if (*target) {
+ while (*target && (*target > kWhitespaceBoundary || *target == showChar)) {
+ ++target;
+ }
+
+ if (*target) {
+ source = target;
+ while (*source) {
+ while (*source && *source <= kWhitespaceBoundary && *source != showChar) {
+ ++source;
+ }
+
+ while (*source && (*source > kWhitespaceBoundary || *source == showChar)) {
+ *target++ = *source++;
+ }
+ }
+
+ --source;
+ while (source > target && (*source <= kWhitespaceBoundary || *source >= kAsciiBoundary) && *source != showChar) {
+ --source;
+ }
+ ++source;
+
+ memmove(target, source, strlen((char *)source) + 1);
+ }
+ }
+ }
+ }
+
+ /**
+ * Copies the string data held by this array into a new Common::String.
+ */
+ Common::String toString() const {
+ assert(_type == kArrayTypeString);
+ return Common::String((char *)_data);
+ }
+
+ /**
+ * Copies the string from the given Common::String into this array.
+ */
+ void fromString(const Common::String &string) {
+ // At least LSL6hires uses a byte-type array to hold string data
+ assert(_type == kArrayTypeString || _type == kArrayTypeByte);
+ resize(string.size() + 1, true);
+ Common::strlcpy((char *)_data, string.c_str(), string.size() + 1);
+ }
+
+protected:
+ void *_data;
+ SciArrayType _type;
+ uint16 _size;
+ uint8 _elementSize;
+};
+
+struct ArrayTable : public SegmentObjTable<SciArray> {
+ ArrayTable() : SegmentObjTable<SciArray>(SEG_TYPE_ARRAY) {}
+
+ virtual Common::Array<reg_t> listAllOutgoingReferences(reg_t object) const;
+
void saveLoadWithSerializer(Common::Serializer &ser);
SegmentRef dereference(reg_t pointer);
};
@@ -649,7 +963,7 @@ public:
/**
* Allocates and initialises a new bitmap.
*/
- inline void create(const int16 width, const int16 height, const uint8 skipColor, const int16 displaceX, const int16 displaceY, const int16 scaledWidth, const int16 scaledHeight, const uint32 paletteSize, const bool remap, const bool gc) {
+ inline void create(const int16 width, const int16 height, const uint8 skipColor, const int16 originX, const int16 originY, const int16 xResolution, const int16 yResolution, const uint32 paletteSize, const bool remap, const bool gc) {
_dataSize = getBitmapSize(width, height) + paletteSize;
_data = (byte *)realloc(_data, _dataSize);
@@ -659,7 +973,7 @@ public:
setWidth(width);
setHeight(height);
- setDisplace(Common::Point(displaceX, displaceY));
+ setOrigin(Common::Point(originX, originY));
setSkipColor(skipColor);
_data[9] = 0;
WRITE_SCI11ENDIAN_UINT16(_data + 10, 0);
@@ -670,8 +984,8 @@ public:
setDataOffset(bitmapHeaderSize);
setUncompressedDataOffset(bitmapHeaderSize);
setControlOffset(0);
- setScaledWidth(scaledWidth);
- setScaledHeight(scaledHeight);
+ setXResolution(xResolution);
+ setYResolution(yResolution);
_buffer = Buffer(getWidth(), getHeight(), getPixels());
}
@@ -703,16 +1017,16 @@ public:
BITMAP_PROPERTY(16, Width, 0);
BITMAP_PROPERTY(16, Height, 2);
- inline Common::Point getDisplace() const {
+ inline Common::Point getOrigin() const {
return Common::Point(
(int16)READ_SCI11ENDIAN_UINT16(_data + 4),
(int16)READ_SCI11ENDIAN_UINT16(_data + 6)
);
}
- inline void setDisplace(const Common::Point &displace) {
- WRITE_SCI11ENDIAN_UINT16(_data + 4, (uint16)displace.x);
- WRITE_SCI11ENDIAN_UINT16(_data + 6, (uint16)displace.y);
+ inline void setOrigin(const Common::Point &origin) {
+ WRITE_SCI11ENDIAN_UINT16(_data + 4, (uint16)origin.x);
+ WRITE_SCI11ENDIAN_UINT16(_data + 6, (uint16)origin.y);
}
inline uint8 getSkipColor() const {
@@ -761,7 +1075,7 @@ public:
// NOTE: This property always seems to be zero
BITMAP_PROPERTY(32, ControlOffset, 32);
- inline uint16 getScaledWidth() const {
+ inline uint16 getXResolution() const {
if (getDataOffset() >= 40) {
return READ_SCI11ENDIAN_UINT16(_data + 36);
}
@@ -770,13 +1084,13 @@ public:
return 320;
}
- inline void setScaledWidth(uint16 scaledWidth) {
+ inline void setXResolution(uint16 xResolution) {
if (getDataOffset() >= 40) {
- WRITE_SCI11ENDIAN_UINT16(_data + 36, scaledWidth);
+ WRITE_SCI11ENDIAN_UINT16(_data + 36, xResolution);
}
}
- inline uint16 getScaledHeight() const {
+ inline uint16 getYResolution() const {
if (getDataOffset() >= 40) {
return READ_SCI11ENDIAN_UINT16(_data + 38);
}
@@ -785,9 +1099,9 @@ public:
return 200;
}
- inline void setScaledHeight(uint16 scaledHeight) {
+ inline void setYResolution(uint16 yResolution) {
if (getDataOffset() >= 40) {
- WRITE_SCI11ENDIAN_UINT16(_data + 38, scaledHeight);
+ WRITE_SCI11ENDIAN_UINT16(_data + 38, yResolution);
}
}
@@ -803,6 +1117,16 @@ public:
}
virtual void saveLoadWithSerializer(Common::Serializer &ser);
+
+ void applyRemap(SciArray &clut) {
+ const int length = getWidth() * getHeight();
+ uint8 *pixel = getPixels();
+ for (int i = 0; i < length; ++i) {
+ const int16 color = clut.getAsInt16(*pixel);
+ assert(color >= 0 && color <= 255);
+ *pixel++ = (uint8)color;
+ }
+ }
};
struct BitmapTable : public SegmentObjTable<SciBitmap> {
diff --git a/engines/sci/engine/selector.cpp b/engines/sci/engine/selector.cpp
index ac621f58ae..3ae902215c 100644
--- a/engines/sci/engine/selector.cpp
+++ b/engines/sci/engine/selector.cpp
@@ -226,15 +226,14 @@ void writeSelector(SegManager *segMan, reg_t object, Selector selectorId, reg_t
ObjVarRef address;
if ((selectorId < 0) || (selectorId > (int)g_sci->getKernel()->getSelectorNamesSize())) {
- error("Attempt to write to invalid selector %d of"
- " object at %04x:%04x.", selectorId, PRINT_REG(object));
- return;
+ const SciCallOrigin origin = g_sci->getEngineState()->getCurrentCallOrigin();
+ error("Attempt to write to invalid selector %d. Address %04x:%04x, %s", selectorId, PRINT_REG(object), origin.toString().c_str());
}
- if (lookupSelector(segMan, object, selectorId, &address, NULL) != kSelectorVariable)
- error("Selector '%s' of object at %04x:%04x could not be"
- " written to", g_sci->getKernel()->getSelectorName(selectorId).c_str(), PRINT_REG(object));
- else {
+ if (lookupSelector(segMan, object, selectorId, &address, NULL) != kSelectorVariable) {
+ const SciCallOrigin origin = g_sci->getEngineState()->getCurrentCallOrigin();
+ error("Selector '%s' of object could not be written to. Address %04x:%04x, %s", g_sci->getKernel()->getSelectorName(selectorId).c_str(), PRINT_REG(object), origin.toString().c_str());
+ } else {
*address.getPointer(segMan) = value;
#ifdef ENABLE_SCI32
updateInfoFlagViewVisible(segMan->getObject(object), selectorId);
@@ -255,12 +254,12 @@ void invokeSelector(EngineState *s, reg_t object, int selectorId,
slc_type = lookupSelector(s->_segMan, object, selectorId, NULL, NULL);
if (slc_type == kSelectorNone) {
- error("Selector '%s' of object at %04x:%04x could not be invoked",
- g_sci->getKernel()->getSelectorName(selectorId).c_str(), PRINT_REG(object));
+ const SciCallOrigin origin = g_sci->getEngineState()->getCurrentCallOrigin();
+ error("invokeSelector: Selector '%s' could not be invoked. Address %04x:%04x, %s", g_sci->getKernel()->getSelectorName(selectorId).c_str(), PRINT_REG(object), origin.toString().c_str());
}
if (slc_type == kSelectorVariable) {
- error("Attempting to invoke variable selector %s of object %04x:%04x",
- g_sci->getKernel()->getSelectorName(selectorId).c_str(), PRINT_REG(object));
+ const SciCallOrigin origin = g_sci->getEngineState()->getCurrentCallOrigin();
+ error("invokeSelector: Attempting to invoke variable selector %s. Address %04x:%04x, %s", g_sci->getKernel()->getSelectorName(selectorId).c_str(), PRINT_REG(object), origin.toString().c_str());
}
for (i = 0; i < argc; i++)
@@ -288,8 +287,8 @@ SelectorType lookupSelector(SegManager *segMan, reg_t obj_location, Selector sel
selectorId &= ~1;
if (!obj) {
- error("lookupSelector(): Attempt to send to non-object or invalid script. Address was %04x:%04x",
- PRINT_REG(obj_location));
+ const SciCallOrigin origin = g_sci->getEngineState()->getCurrentCallOrigin();
+ error("lookupSelector: Attempt to send to non-object or invalid script. Address %04x:%04x, %s", PRINT_REG(obj_location), origin.toString().c_str());
}
index = obj->locateVarSelector(segMan, selectorId);
diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp
index a338beffc9..c23add1211 100644
--- a/engines/sci/engine/state.cpp
+++ b/engines/sci/engine/state.cpp
@@ -159,11 +159,11 @@ void EngineState::initGlobals() {
}
uint16 EngineState::currentRoomNumber() const {
- return variables[VAR_GLOBAL][13].toUint16();
+ return variables[VAR_GLOBAL][kGlobalVarNewRoomNo].toUint16();
}
void EngineState::setRoomNumber(uint16 roomNumber) {
- variables[VAR_GLOBAL][13] = make_reg(0, roomNumber);
+ variables[VAR_GLOBAL][kGlobalVarNewRoomNo] = make_reg(0, roomNumber);
}
void EngineState::shrinkStackToBase() {
@@ -202,12 +202,12 @@ Common::String SciEngine::getSciLanguageString(const Common::String &str, kLangu
const byte *textPtr = (const byte *)str.c_str();
byte curChar = 0;
byte curChar2 = 0;
-
+
while (1) {
curChar = *textPtr;
if (!curChar)
break;
-
+
if ((curChar == '%') || (curChar == '#')) {
curChar2 = *(textPtr + 1);
foundLanguage = charToLanguage(curChar2);
@@ -236,7 +236,7 @@ Common::String SciEngine::getSciLanguageString(const Common::String &str, kLangu
while (1) {
curChar = *textPtr;
-
+
switch (curChar) {
case 0: // Terminator NUL
return fullWidth;
@@ -257,7 +257,7 @@ Common::String SciEngine::getSciLanguageString(const Common::String &str, kLangu
continue;
}
}
-
+
textPtr++;
mappedChar = s_halfWidthSJISMap[curChar];
@@ -380,4 +380,46 @@ void SciEngine::checkVocabularySwitch() {
}
}
+SciCallOrigin EngineState::getCurrentCallOrigin() const {
+ // IMPORTANT: This method must always return values that match *exactly* the
+ // values in the workaround tables in workarounds.cpp, or workarounds will
+ // be broken
+
+ Common::String curObjectName = _segMan->getObjectName(xs->sendp);
+ Common::String curMethodName;
+ const Script *localScript = _segMan->getScriptIfLoaded(xs->local_segment);
+ int curScriptNr = localScript->getScriptNumber();
+
+ if (xs->debugLocalCallOffset != -1) {
+ // if lastcall was actually a local call search back for a real call
+ Common::List<ExecStack>::const_iterator callIterator = _executionStack.end();
+ while (callIterator != _executionStack.begin()) {
+ callIterator--;
+ const ExecStack &loopCall = *callIterator;
+ if ((loopCall.debugSelector != -1) || (loopCall.debugExportId != -1)) {
+ xs->debugSelector = loopCall.debugSelector;
+ xs->debugExportId = loopCall.debugExportId;
+ break;
+ }
+ }
+ }
+
+ if (xs->type == EXEC_STACK_TYPE_CALL) {
+ if (xs->debugSelector != -1) {
+ curMethodName = g_sci->getKernel()->getSelectorName(xs->debugSelector);
+ } else if (xs->debugExportId != -1) {
+ curObjectName = "";
+ curMethodName = Common::String::format("export %d", xs->debugExportId);
+ }
+ }
+
+ SciCallOrigin reply;
+ reply.objectName = curObjectName;
+ reply.methodName = curMethodName;
+ reply.scriptNr = curScriptNr;
+ reply.localCallOffset = xs->debugLocalCallOffset;
+ reply.roomNr = currentRoomNumber();
+ return reply;
+}
+
} // End of namespace Sci
diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h
index baa912b60e..5297a176d3 100644
--- a/engines/sci/engine/state.h
+++ b/engines/sci/engine/state.h
@@ -57,10 +57,6 @@ enum AbortGameState {
kAbortQuitGame = 3
};
-// slot 0 is the ScummVM auto-save slot, which is not used by us, but is still reserved
-#define SAVEGAMESLOT_FIRST 1
-#define SAVEGAMESLOT_LAST 99
-
// We assume that scripts give us savegameId 0->99 for creating a new save slot
// and savegameId 100->199 for existing save slots. Refer to kfile.cpp
enum {
@@ -99,6 +95,21 @@ struct VideoState {
}
};
+/**
+ * Trace information about a VM function call.
+ */
+struct SciCallOrigin {
+ int scriptNr; //< The source script of the function
+ Common::String objectName; //< The name of the object being called
+ Common::String methodName; //< The name of the method being called
+ int localCallOffset; //< The byte offset of a local script subroutine called by the origin method. -1 if not in a local subroutine.
+ int roomNr; //< The room that was loaded at the time of the call
+
+ Common::String toString() const {
+ return Common::String::format("method %s::%s (room %d, script %d, localCall %x)", objectName.c_str(), methodName.c_str(), roomNr, scriptNr, localCallOffset);
+ }
+};
+
struct EngineState : public Common::Serializable {
public:
EngineState(SegManager *segMan);
@@ -209,6 +220,11 @@ public:
* Resets the engine state.
*/
void reset(bool isRestoring);
+
+ /**
+ * Finds and returns the origin of the current call.
+ */
+ SciCallOrigin getCurrentCallOrigin() const;
};
} // End of namespace Sci
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 548fd477bf..82de957387 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -20,6 +20,7 @@
*
*/
+#include "common/config-manager.h"
#include "common/debug.h"
#include "common/debug-channels.h"
@@ -124,21 +125,17 @@ static reg_t read_var(EngineState *s, int type, int index) {
case VAR_TEMP: {
// Uninitialized read on a temp
// We need to find correct replacements for each situation manually
- SciTrackOriginReply originReply;
+ SciCallOrigin originReply;
SciWorkaroundSolution solution = trackOriginAndFindWorkaround(index, uninitializedReadWorkarounds, &originReply);
if (solution.type == WORKAROUND_NONE) {
#ifdef RELEASE_BUILD
// If we are running an official ScummVM release -> fake 0 in unknown cases
- warning("Uninitialized read for temp %d from method %s::%s (room %d, script %d, localCall %x)",
- index, originReply.objectName.c_str(), originReply.methodName.c_str(), s->currentRoomNumber(),
- originReply.scriptNr, originReply.localCallOffset);
+ warning("Uninitialized read for temp %d from %s", index, originReply.toString().c_str());
s->variables[type][index] = NULL_REG;
break;
#else
- error("Uninitialized read for temp %d from method %s::%s (room %d, script %d, localCall %x)",
- index, originReply.objectName.c_str(), originReply.methodName.c_str(), s->currentRoomNumber(),
- originReply.scriptNr, originReply.localCallOffset);
+ error("Uninitialized read for temp %d from %s", index, originReply.toString().c_str());
#endif
}
assert(solution.type == WORKAROUND_FAKE);
@@ -179,7 +176,7 @@ static void write_var(EngineState *s, int type, int index, reg_t value) {
// stopGroop object, which points to ego, to the new ego object. If this is not
// done, ego's movement will not be updated properly, so the result is
// unpredictable (for example in LSL5, Patti spins around instead of walking).
- if (index == 0 && type == VAR_GLOBAL && getSciVersion() > SCI_VERSION_0_EARLY) { // global 0 is ego
+ if (index == kGlobalVarEgo && type == VAR_GLOBAL && getSciVersion() > SCI_VERSION_0_EARLY) {
reg_t stopGroopPos = s->_segMan->findObjectByName("stopGroop");
if (!stopGroopPos.isNull()) { // does the game have a stopGroop object?
// Find the "client" member variable of the stopGroop object, and update it
@@ -200,9 +197,9 @@ static void write_var(EngineState *s, int type, int index, reg_t value) {
s->variables[type][index] = value;
- if (type == VAR_GLOBAL && index == 90) {
+ if (type == VAR_GLOBAL && index == kGlobalVarMessageType) {
// The game is trying to change its speech/subtitle settings
- if (!g_sci->getEngineState()->_syncedAudioOptions || s->variables[VAR_GLOBAL][4] == TRUE_REG) {
+ if (!g_sci->getEngineState()->_syncedAudioOptions || s->variables[VAR_GLOBAL][kGlobalVarQuit] == 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.
@@ -213,6 +210,12 @@ static void write_var(EngineState *s, int type, int index, reg_t value) {
g_sci->updateScummVMAudioOptions();
}
}
+
+#ifdef ENABLE_SCI32
+ if (type == VAR_GLOBAL && index == kGlobalVarTextSpeed && getSciVersion() >= SCI_VERSION_2) {
+ ConfMan.setInt("talkspeed", (8 - value.toSint16()) * 255 / 8);
+ }
+#endif
}
}
@@ -361,16 +364,13 @@ static void callKernelFunc(EngineState *s, int kernelCallNr, int argc) {
if (kernelCall.signature
&& !kernel->signatureMatch(kernelCall.signature, argc, argv)) {
// signature mismatch, check if a workaround is available
- SciTrackOriginReply originReply;
+ SciCallOrigin originReply;
SciWorkaroundSolution solution = trackOriginAndFindWorkaround(0, kernelCall.workarounds, &originReply);
switch (solution.type) {
case WORKAROUND_NONE: {
Common::String signatureDetailsStr;
kernel->signatureDebug(signatureDetailsStr, kernelCall.signature, argc, argv);
- error("\n%s[VM] k%s[%x]: signature mismatch in method %s::%s (room %d, script %d, localCall 0x%x)",
- signatureDetailsStr.c_str(),
- kernelCall.name, kernelCallNr, originReply.objectName.c_str(), originReply.methodName.c_str(),
- s->currentRoomNumber(), originReply.scriptNr, originReply.localCallOffset);
+ error("\n%s[VM] k%s[%x]: signature mismatch in %s", signatureDetailsStr.c_str(), kernelCall.name, kernelCallNr, originReply.toString().c_str());
break;
}
case WORKAROUND_IGNORE: // don't do kernel call, leave acc alone
@@ -429,7 +429,7 @@ static void callKernelFunc(EngineState *s, int kernelCallNr, int argc) {
const KernelSubFunction &kernelSubCall = kernelCall.subFunctions[subId];
if (kernelSubCall.signature && !kernel->signatureMatch(kernelSubCall.signature, argc, argv)) {
// Signature mismatch
- SciTrackOriginReply originReply;
+ SciCallOrigin originReply;
SciWorkaroundSolution solution = trackOriginAndFindWorkaround(0, kernelSubCall.workarounds, &originReply);
switch (solution.type) {
case WORKAROUND_NONE: {
@@ -438,15 +438,13 @@ static void callKernelFunc(EngineState *s, int kernelCallNr, int argc) {
int callNameLen = strlen(kernelCall.name);
if (strncmp(kernelCall.name, kernelSubCall.name, callNameLen) == 0) {
const char *subCallName = kernelSubCall.name + callNameLen;
- error("\n%s[VM] k%s(%s): signature mismatch in method %s::%s (room %d, script %d, localCall %x)",
- signatureDetailsStr.c_str(),
- kernelCall.name, subCallName, originReply.objectName.c_str(), originReply.methodName.c_str(),
- s->currentRoomNumber(), originReply.scriptNr, originReply.localCallOffset);
+ error("\n%s[VM] k%s(%s): signature mismatch in %s",
+ signatureDetailsStr.c_str(), kernelCall.name, subCallName,
+ originReply.toString().c_str());
}
- error("\n%s[VM] k%s: signature mismatch in method %s::%s (room %d, script %d, localCall %x)",
- signatureDetailsStr.c_str(),
- kernelSubCall.name, originReply.objectName.c_str(), originReply.methodName.c_str(),
- s->currentRoomNumber(), originReply.scriptNr, originReply.localCallOffset);
+ error("\n%s[VM] k%s: signature mismatch in %s",
+ signatureDetailsStr.c_str(), kernelSubCall.name,
+ originReply.toString().c_str());
break;
}
case WORKAROUND_IGNORE: // don't do kernel call, leave acc alone
diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h
index c41060dc32..dd66d9d52c 100644
--- a/engines/sci/engine/vm.h
+++ b/engines/sci/engine/vm.h
@@ -136,6 +136,22 @@ enum {
VAR_PARAM = 3
};
+enum GlobalVar {
+ kGlobalVarEgo = 0,
+ kGlobalVarCurrentRoom = 2,
+ kGlobalVarSpeed = 3, // SCI16
+ kGlobalVarQuit = 4,
+ kGlobalVarPlanes = 10, // SCI32
+ kGlobalVarCurrentRoomNo = 11,
+ kGlobalVarPreviousRoomNo = 12,
+ kGlobalVarNewRoomNo = 13,
+ kGlobalVarScore = 15,
+ kGlobalVarFastCast = 84, // SCI16
+ kGlobalVarMessageType = 90,
+ kGlobalVarTextSpeed = 94, // SCI32; 0 is fastest, 8 is slowest
+ kGlobalVarShivers1Score = 349
+};
+
/** Number of kernel calls in between gcs; should be < 50000 */
enum {
GC_INTERVAL = 0x8000
diff --git a/engines/sci/engine/vm_types.cpp b/engines/sci/engine/vm_types.cpp
index d74e2b194c..b2e250ab8b 100644
--- a/engines/sci/engine/vm_types.cpp
+++ b/engines/sci/engine/vm_types.cpp
@@ -66,13 +66,10 @@ void reg_t::setOffset(uint32 offset) {
}
reg_t reg_t::lookForWorkaround(const reg_t right, const char *operation) const {
- SciTrackOriginReply originReply;
+ SciCallOrigin originReply;
SciWorkaroundSolution solution = trackOriginAndFindWorkaround(0, arithmeticWorkarounds, &originReply);
if (solution.type == WORKAROUND_NONE)
- error("Invalid arithmetic operation (%s - params: %04x:%04x and %04x:%04x) from method %s::%s (room %d, script %d, localCall %x)",
- operation, PRINT_REG(*this), PRINT_REG(right), originReply.objectName.c_str(),
- originReply.methodName.c_str(), g_sci->getEngineState()->currentRoomNumber(), originReply.scriptNr,
- originReply.localCallOffset);
+ error("Invalid arithmetic operation (%s - params: %04x:%04x and %04x:%04x) from %s", operation, PRINT_REG(*this), PRINT_REG(right), originReply.toString().c_str());
assert(solution.type == WORKAROUND_FAKE);
return make_reg(0, solution.value);
}
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index 7aaea0902a..4c0fee49c5 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -318,15 +318,15 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = {
{ GID_LSL6, 820, 82, 0, "", "export 0", NULL, -1, { WORKAROUND_FAKE, 0 } }, // when touching the electric fence - bug #5103
{ GID_LSL6, -1, 85, 0, "washcloth", "doVerb", NULL, 0, { WORKAROUND_FAKE, 0 } }, // washcloth in inventory
{ GID_LSL6, -1, 928, -1, "Narrator", "startText", NULL, 0, { WORKAROUND_FAKE, 0 } }, // used by various objects that are even translated in foreign versions, that's why we use the base-class
- { GID_LSL6HIRES, 0, 85, 0, "LL6Inv", "init", NULL, 0, { WORKAROUND_FAKE, 0 } }, // on startup
+ { GID_LSL6HIRES, -1, 85, 0, "LL6Inv", "init", NULL, 0, { WORKAROUND_FAKE, 0 } }, // when creating a new game
{ GID_LSL6HIRES, -1, 64950, 1, "Feature", "handleEvent", NULL, 0, { WORKAROUND_FAKE, 0 } }, // at least when entering swimming pool area
{ GID_LSL6HIRES, -1, 64964, 0, "DPath", "init", NULL, 1, { WORKAROUND_FAKE, 0 } }, // during the game
{ GID_MOTHERGOOSE256, -1, 0, 0, "MG", "doit", NULL, 5, { WORKAROUND_FAKE, 0 } }, // SCI1.1: When moving the cursor all the way to the left during the game - bug #5224
{ GID_MOTHERGOOSE256, -1, 992, 0, "AIPath", "init", NULL, 0, { WORKAROUND_FAKE, 0 } }, // Happens in the demo and full version. In the demo, it happens when walking two screens from mother goose's house to the north. In the full version, it happens in rooms 7 and 23 - bug #5269
{ GID_MOTHERGOOSE256, 90, 90, 0, "introScript", "changeState", NULL, 65, { WORKAROUND_FAKE, 0 } }, // SCI1(CD): At the very end, after the game is completed and restarted - bug #5626
{ GID_MOTHERGOOSE256, 94, 94, 0, "sunrise", "changeState", NULL, 367, { WORKAROUND_FAKE, 0 } }, // At the very end, after the game is completed - bug #5294
- { GID_MOTHERGOOSEHIRES,-1,64950, 1, "Feature", "handleEvent", NULL, 0, { WORKAROUND_FAKE, 0 } }, // right when clicking on a child at the start and probably also later
- { GID_MOTHERGOOSEHIRES,-1,64950, 1, "View", "handleEvent", NULL, 0, { WORKAROUND_FAKE, 0 } }, // see above
+ { GID_MOTHERGOOSEHIRES,-1,64950, -1, "Feature", "handleEvent", NULL, 0, { WORKAROUND_FAKE, 0 } }, // right when clicking on a child at the start and probably also later
+ { GID_MOTHERGOOSEHIRES,-1,64950, -1, "View", "handleEvent", NULL, 0, { WORKAROUND_FAKE, 0 } }, // see above
{ GID_PEPPER, -1, 894, 0, "Package", "doVerb", NULL, 3, { WORKAROUND_FAKE, 0 } }, // using the hand on the book in the inventory - bug #5154
{ GID_PEPPER, 150, 928, 0, "Narrator", "startText", NULL, 0, { WORKAROUND_FAKE, 0 } }, // happens during the non-interactive demo of Pepper
{ GID_PQ4, -1, 25, 0, "iconToggle", "select", NULL, 1, { WORKAROUND_FAKE, 0 } }, // when toggling the icon bar to auto-hide or not
@@ -347,6 +347,7 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = {
{ GID_QFG3, 330, 330, -1, "Teller", "doChild", NULL, -1, { WORKAROUND_FAKE, 0 } }, // when talking to King Rajah about "Rajah" (bug #5033, temp 1) or "Tarna" (temp 0), or when clicking on yourself and saying "Greet" (bug #5148, temp 1)
{ GID_QFG3, 700, 700, -1, "monsterIsDead", "changeState", NULL, 0, { WORKAROUND_FAKE, 0 } }, // in the jungle, after winning any fight, bug #5169
{ GID_QFG3, 470, 470, -1, "rm470", "notify", NULL, 0, { WORKAROUND_FAKE, 0 } }, // closing the character screen in the Simbani village in the room with the bridge, bug #5165
+ { GID_QFG3, 470, 470, -1, "<invalid name>", "notify", NULL, 0, { WORKAROUND_FAKE, 0 } }, // same as previous, with rm470::name used for temp storage by fan patches added by GOG
{ GID_QFG3, 490, 490, -1, "computersMove", "changeState", NULL, 0, { WORKAROUND_FAKE, 0 } }, // when finishing awari game, bug #5167
{ GID_QFG3, 490, 490, -1, "computersMove", "changeState", sig_uninitread_qfg3_2, 4, { WORKAROUND_FAKE, 0 } }, // also when finishing awari game
{ GID_QFG3, 851, 32, -1, "ProjObj", "doit", NULL, 1, { WORKAROUND_FAKE, 0 } }, // near the end, when throwing the spear of death, bug #5282
@@ -379,6 +380,7 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = {
{ GID_SQ6, -1, 0, 0, "SQ6", "init", NULL, 2, { WORKAROUND_FAKE, 0 } }, // Demo and full version: called when the game starts (demo: room 0, full: room 100)
{ GID_SQ6, -1, 64950, -1, "Feature", "handleEvent", NULL, 0, { WORKAROUND_FAKE, 0 } }, // called when pressing "Start game" in the main menu, when entering the Orion's Belt bar (room 300), and perhaps other places
{ GID_SQ6, -1, 64964, 0, "DPath", "init", NULL, 1, { WORKAROUND_FAKE, 0 } }, // during the game
+ { GID_SQ6, 210, 210, 0, "buttonSecret", "doVerb", NULL, 0, { WORKAROUND_FAKE, 0 } }, // after winning the first round of stooge fighter 3
{ GID_TORIN, -1, 64017, 0, "oFlags", "clear", NULL, 0, { WORKAROUND_FAKE, 0 } }, // entering Torin's home in the French version
{ GID_TORIN, 10000, 64029, 0, "oMessager", "nextMsg", NULL, 3, { WORKAROUND_FAKE, 0 } }, // start of chapter one
{ GID_TORIN, 20100, 64964, 0, "DPath", "init", NULL, 1, { WORKAROUND_FAKE, 0 } }, // going down the cliff at the first screen of chapter 2 (washing area)
@@ -396,6 +398,12 @@ const SciWorkaroundEntry kAbs_workarounds[] = {
};
// gameID, room,script,lvl, object-name, method-name, local-call-signature, index, workaround
+const SciWorkaroundEntry kArraySetElements_workarounds[] = {
+ { GID_PHANTASMAGORIA,902, 64918, 0, "Str", "callKernel", NULL, 0, { WORKAROUND_FAKE, 0 } }, // tries to set an element of a string array to the ego object when starting a new game and selecting a chapter above 1
+ SCI_WORKAROUNDENTRY_TERMINATOR
+};
+
+// gameID, room,script,lvl, object-name, method-name, local-call-signature, index, workaround
const SciWorkaroundEntry kCelHigh_workarounds[] = {
{ GID_KQ5, -1, 255, 0, "deathIcon", "setSize", NULL, 0, { WORKAROUND_STILLCALL, 0 } }, // english floppy: when getting beaten up in the inn and probably more, called with 2nd parameter as object - bug #5049
{ GID_PQ2, -1, 255, 0, "DIcon", "setSize", NULL, 0, { WORKAROUND_STILLCALL, 0 } }, // when showing picture within windows, called with 2nd/3rd parameters as objects
@@ -544,6 +552,12 @@ const SciWorkaroundEntry kGetAngle_workarounds[] = {
};
// gameID, room,script,lvl, object-name, method-name, local-call-signature, index, workaround
+const SciWorkaroundEntry kFileIOOpen_workarounds[] = {
+ { GID_TORIN, 61000, 61000, 0, "roSierraLogo", "init", NULL, 0, { WORKAROUND_STILLCALL, 0 } }, // Missing second argument when the game checks for autosave.cat after the Sierra logo
+ SCI_WORKAROUNDENTRY_TERMINATOR
+};
+
+// gameID, room,script,lvl, object-name, method-name, local-call-signature, index, workaround
const SciWorkaroundEntry kFindKey_workarounds[] = {
{ GID_ECOQUEST2, 100, 999, 0, "myList", "contains", NULL, 0, { WORKAROUND_FAKE, 0 } }, // When Noah Greene gives Adam the Ecorder, and just before the game gives a demonstration, a null reference to a list is passed - bug #4987
{ GID_HOYLE4, 300, 999, 0, "Piles", "contains", NULL, 0, { WORKAROUND_FAKE, 0 } }, // When passing the three cards in Hearts, a null reference to a list is passed - bug #5664
@@ -670,6 +684,20 @@ const SciWorkaroundEntry kNewWindow_workarounds[] = {
};
// gameID, room,script,lvl, object-name, method-name, local-call-signature, index, workaround
+const SciWorkaroundEntry kNumCels_workarounds[] = {
+ { GID_GK1, 460, 64998, -1, "GKEgo", "lastCel", NULL, -1, { WORKAROUND_FAKE, 5 } }, // when Gabriel clicks "ask" on the bartender from a distance
+ { GID_GK1, 808, 64998, -1, "sDJEnters", "changeState", NULL, -1, { WORKAROUND_FAKE, 6 } }, //
+ { GID_GK2, 470, 64998, -1, "pLookieLoos", "lastCel", NULL, -1, { WORKAROUND_FAKE, 50 } }, // random background movement in the crime scene in Munich city centre
+ { GID_GK2, 470, 64998, -1, "pNewsCrew", "lastCel", NULL, -1, { WORKAROUND_FAKE, 18 } }, // random background movement in the crime scene in Munich city centre
+ { GID_GK2, 470, 64998, -1, "pLeberGroup", "lastCel", NULL, -1, { WORKAROUND_FAKE, 22 } }, // random background movement in the crime scene in Munich city centre
+ { GID_SQ6, 270, 64998, -1, "offWorld", "lastCel", NULL, -1, { WORKAROUND_FAKE, 3 } }, // when exiting the kidnapping room
+ { GID_SQ6, 320, 64998, -1, "wandererB", "lastCel", NULL, -1, { WORKAROUND_FAKE, 8 } }, // random background movement on Polysorbate LX street 3
+ { GID_SQ6, 340, 64998, -1, "wandererB", "lastCel", NULL, -1, { WORKAROUND_FAKE, 8 } }, // random background movement on Polysorbate LX street 1
+ { GID_SQ6, 530, 64998, -1, "monitors", "lastCel", NULL, -1, { WORKAROUND_FAKE, 5 } }, // random background movement during cutscene
+ SCI_WORKAROUNDENTRY_TERMINATOR
+};
+
+// gameID, room,script,lvl, object-name, method-name, local-call-signature, index, workaround
const SciWorkaroundEntry kPalVarySetPercent_workarounds[] = {
{ GID_GK1, 370, 370, 0, "graceComeOut", "changeState", NULL, 0, { WORKAROUND_STILLCALL, 0 } }, // there's an extra parameter in GK1, when changing chapters. This extra parameter seems to be a bug or just unimplemented functionality, as there's no visible change from the original in the chapter change room
SCI_WORKAROUNDENTRY_TERMINATOR
@@ -699,7 +727,7 @@ const SciWorkaroundEntry kPaletteUnsetFlag_workarounds[] = {
// gameID, room,script,lvl, object-name, method-name, local-call-signature, index, workaround
const SciWorkaroundEntry kSetCursor_workarounds[] = {
{ GID_KQ5, -1, 768, 0, "KQCursor", "init", NULL, 0, { WORKAROUND_STILLCALL, 0 } }, // CD: gets called with 4 additional "900d" parameters
- { GID_MOTHERGOOSEHIRES,0, 0, -1, "MG", "setCursor", NULL, 0, { WORKAROUND_STILLCALL, 0 } }, // At the start of the game, an object is passed as the cel number
+ { GID_MOTHERGOOSEHIRES,-1, 0, -1, "MG", "setCursor", NULL, 0, { WORKAROUND_STILLCALL, 0 } }, // At the start of the game, an object is passed as the cel number
SCI_WORKAROUNDENTRY_TERMINATOR
};
@@ -767,17 +795,12 @@ const SciWorkaroundEntry kUnLoad_workarounds[] = {
};
// gameID, room,script,lvl, object-name, method-name, local-call-signature, index, workaround
-const SciWorkaroundEntry kStringPutAt_workarounds[] = {
- { GID_PHANTASMAGORIA,902, 64918, 0, "Str", "callKernel", NULL, 0, { WORKAROUND_IGNORE, 0 } }, // When starting a new game from after chapter 1, the game tries to save ego's object in a string
-};
-
-// gameID, room,script,lvl, object-name, method-name, local-call-signature, index, workaround
const SciWorkaroundEntry kScrollWindowAdd_workarounds[] = {
{ GID_PHANTASMAGORIA, 45, 64907, 0, "ScrollableWindow", "addString", NULL, 0, { WORKAROUND_STILLCALL, 0 } }, // ScrollWindow interface passes the last two parameters twice
+ SCI_WORKAROUNDENTRY_TERMINATOR
};
-
-SciWorkaroundSolution trackOriginAndFindWorkaround(int index, const SciWorkaroundEntry *workaroundList, SciTrackOriginReply *trackOrigin) {
+SciWorkaroundSolution trackOriginAndFindWorkaround(int index, const SciWorkaroundEntry *workaroundList, SciCallOrigin *trackOrigin) {
// HACK for SCI3: Temporarily ignore this
if (getSciVersion() == SCI_VERSION_3) {
warning("SCI3 HACK: trackOriginAndFindWorkaround() called, ignoring");
@@ -789,37 +812,14 @@ SciWorkaroundSolution trackOriginAndFindWorkaround(int index, const SciWorkaroun
const EngineState *state = g_sci->getEngineState();
ExecStack *lastCall = state->xs;
- const Script *localScript = state->_segMan->getScriptIfLoaded(lastCall->local_segment);
- int curScriptNr = localScript->getScriptNumber();
- int curLocalCallOffset = lastCall->debugLocalCallOffset;
-
- if (curLocalCallOffset != -1) {
- // if lastcall was actually a local call search back for a real call
- Common::List<ExecStack>::const_iterator callIterator = state->_executionStack.end();
- while (callIterator != state->_executionStack.begin()) {
- callIterator--;
- const ExecStack &loopCall = *callIterator;
- if ((loopCall.debugSelector != -1) || (loopCall.debugExportId != -1)) {
- lastCall->debugSelector = loopCall.debugSelector;
- lastCall->debugExportId = loopCall.debugExportId;
- break;
- }
- }
- }
-
- Common::String curObjectName = state->_segMan->getObjectName(lastCall->sendp);
- Common::String curMethodName;
const SciGameId gameId = g_sci->getGameId();
- const int curRoomNumber = state->currentRoomNumber();
-
- if (lastCall->type == EXEC_STACK_TYPE_CALL) {
- if (lastCall->debugSelector != -1) {
- curMethodName = g_sci->getKernel()->getSelectorName(lastCall->debugSelector);
- } else if (lastCall->debugExportId != -1) {
- curObjectName = "";
- curMethodName = Common::String::format("export %d", lastCall->debugExportId);
- }
- }
+
+ *trackOrigin = state->getCurrentCallOrigin();
+ const Common::String &curObjectName = trackOrigin->objectName;
+ const Common::String &curMethodName = trackOrigin->methodName;
+ const int &curRoomNumber = trackOrigin->roomNr;
+ const int &curScriptNr = trackOrigin->scriptNr;
+ const int &curLocalCallOffset = trackOrigin->localCallOffset;
if (workaroundList) {
// Search if there is a workaround for this one
@@ -895,12 +895,6 @@ SciWorkaroundSolution trackOriginAndFindWorkaround(int index, const SciWorkaroun
} while (!searchObject.isNull()); // no parent left?
}
- // give caller origin data
- trackOrigin->objectName = curObjectName;
- trackOrigin->methodName = curMethodName;
- trackOrigin->scriptNr = curScriptNr;
- trackOrigin->localCallOffset = lastCall->debugLocalCallOffset;
-
SciWorkaroundSolution noneFound;
noneFound.type = WORKAROUND_NONE;
noneFound.value = 0;
diff --git a/engines/sci/engine/workarounds.h b/engines/sci/engine/workarounds.h
index 2cccd05475..d1e985dcf1 100644
--- a/engines/sci/engine/workarounds.h
+++ b/engines/sci/engine/workarounds.h
@@ -24,6 +24,7 @@
#define SCI_ENGINE_WORKAROUNDS_H
#include "sci/engine/vm_types.h"
+#include "sci/engine/state.h"
#include "sci/sci.h"
namespace Sci {
@@ -35,13 +36,6 @@ enum SciWorkaroundType {
WORKAROUND_FAKE // fake kernel call / replace temp value / fake opcode
};
-struct SciTrackOriginReply {
- int scriptNr;
- Common::String objectName;
- Common::String methodName;
- int localCallOffset;
-};
-
struct SciWorkaroundSolution {
SciWorkaroundType type;
uint16 value;
@@ -76,6 +70,7 @@ extern const SciWorkaroundEntry kDirLoop_workarounds[];
extern const SciWorkaroundEntry kDisposeScript_workarounds[];
extern const SciWorkaroundEntry kDoSoundPlay_workarounds[];
extern const SciWorkaroundEntry kDoSoundFade_workarounds[];
+extern const SciWorkaroundEntry kFileIOOpen_workarounds[];
extern const SciWorkaroundEntry kFindKey_workarounds[];
extern const SciWorkaroundEntry kDeleteKey_workarounds[];
extern const SciWorkaroundEntry kGetAngle_workarounds[];
@@ -90,20 +85,22 @@ extern const SciWorkaroundEntry kIsObject_workarounds[];
extern const SciWorkaroundEntry kMemory_workarounds[];
extern const SciWorkaroundEntry kMoveCursor_workarounds[];
extern const SciWorkaroundEntry kNewWindow_workarounds[];
+extern const SciWorkaroundEntry kNumCels_workarounds[];
extern const SciWorkaroundEntry kPalVarySetPercent_workarounds[];
extern const SciWorkaroundEntry kRandom_workarounds[];
extern const SciWorkaroundEntry kReadNumber_workarounds[];
extern const SciWorkaroundEntry kPaletteUnsetFlag_workarounds[];
extern const SciWorkaroundEntry kSetCursor_workarounds[];
+extern const SciWorkaroundEntry kArraySetElements_workarounds[];
extern const SciWorkaroundEntry kSetPort_workarounds[];
extern const SciWorkaroundEntry kStrAt_workarounds[];
extern const SciWorkaroundEntry kStrCpy_workarounds[];
extern const SciWorkaroundEntry kStrLen_workarounds[];
extern const SciWorkaroundEntry kUnLoad_workarounds[];
-extern const SciWorkaroundEntry kStringPutAt_workarounds[];
+extern const SciWorkaroundEntry kStringNew_workarounds[];
extern const SciWorkaroundEntry kScrollWindowAdd_workarounds[];
-extern SciWorkaroundSolution trackOriginAndFindWorkaround(int index, const SciWorkaroundEntry *workaroundList, SciTrackOriginReply *trackOrigin);
+extern SciWorkaroundSolution trackOriginAndFindWorkaround(int index, const SciWorkaroundEntry *workaroundList, SciCallOrigin *trackOrigin);
} // End of namespace Sci
diff --git a/engines/sci/event.cpp b/engines/sci/event.cpp
index b267d2ebc2..44ac7ef4cf 100644
--- a/engines/sci/event.cpp
+++ b/engines/sci/event.cpp
@@ -109,8 +109,12 @@ static const MouseEventConversion mouseEventMappings[] = {
{ Common::EVENT_MBUTTONUP, SCI_EVENT_MOUSE_RELEASE }
};
-EventManager::EventManager(bool fontIsExtended) : _fontIsExtended(fontIsExtended) {
-}
+EventManager::EventManager(bool fontIsExtended) :
+ _fontIsExtended(fontIsExtended)
+#ifdef ENABLE_SCI32
+ , _hotRectanglesActive(false)
+#endif
+ {}
EventManager::~EventManager() {
}
@@ -138,8 +142,8 @@ static int altify(int ch) {
SciEvent EventManager::getScummVMEvent() {
#ifdef ENABLE_SCI32
- SciEvent input = { SCI_EVENT_NONE, 0, 0, Common::Point(), Common::Point() };
- SciEvent noEvent = { SCI_EVENT_NONE, 0, 0, Common::Point(), Common::Point() };
+ SciEvent input = { SCI_EVENT_NONE, 0, 0, Common::Point(), Common::Point(), -1 };
+ SciEvent noEvent = { SCI_EVENT_NONE, 0, 0, Common::Point(), Common::Point(), -1 };
#else
SciEvent input = { SCI_EVENT_NONE, 0, 0, Common::Point() };
SciEvent noEvent = { SCI_EVENT_NONE, 0, 0, Common::Point() };
@@ -169,17 +173,20 @@ SciEvent EventManager::getScummVMEvent() {
if (getSciVersion() >= SCI_VERSION_2) {
const Buffer &screen = g_sci->_gfxFrameout->getCurrentBuffer();
+ Common::Point mousePosSci = mousePos;
+ mulru(mousePosSci, Ratio(screen.scriptWidth, screen.screenWidth), Ratio(screen.scriptHeight, screen.screenHeight));
+ noEvent.mousePosSci = input.mousePosSci = mousePosSci;
+
if (ev.type == Common::EVENT_MOUSEMOVE) {
// This will clamp `mousePos` according to the restricted zone,
// so any cursor or screen item associated with the mouse position
// does not bounce when it hits the edge (or ignore the edge)
g_sci->_gfxCursor32->deviceMoved(mousePos);
+ if (_hotRectanglesActive) {
+ checkHotRectangles(mousePosSci);
+ }
}
- Common::Point mousePosSci = mousePos;
- mulru(mousePosSci, Ratio(screen.scriptWidth, screen.screenWidth), Ratio(screen.scriptHeight, screen.screenHeight));
- noEvent.mousePosSci = input.mousePosSci = mousePosSci;
-
} else {
#endif
g_sci->_gfxScreen->adjustBackUpscaledCoordinates(mousePos.y, mousePos.x);
@@ -198,7 +205,7 @@ SciEvent EventManager::getScummVMEvent() {
return noEvent;
}
- if (ev.type == Common::EVENT_QUIT) {
+ if (ev.type == Common::EVENT_QUIT || ev.type == Common::EVENT_RTL) {
input.type = SCI_EVENT_QUIT;
return input;
}
@@ -365,12 +372,14 @@ void EventManager::updateScreen() {
SciEvent EventManager::getSciEvent(uint32 mask) {
#ifdef ENABLE_SCI32
- SciEvent event = { SCI_EVENT_NONE, 0, 0, Common::Point(), Common::Point() };
+ SciEvent event = { SCI_EVENT_NONE, 0, 0, Common::Point(), Common::Point(), -1 };
#else
SciEvent event = { SCI_EVENT_NONE, 0, 0, Common::Point() };
#endif
- EventManager::updateScreen();
+ if (getSciVersion() < SCI_VERSION_2) {
+ updateScreen();
+ }
// Get all queued events from graphics driver
do {
@@ -401,24 +410,43 @@ SciEvent EventManager::getSciEvent(uint32 mask) {
return event;
}
-void SciEngine::sleep(uint32 msecs) {
- uint32 time;
- const uint32 wakeUpTime = g_system->getMillis() + msecs;
-
- while (true) {
- // let backend process events and update the screen
- _eventMan->getSciEvent(SCI_EVENT_PEEK);
- time = g_system->getMillis();
- if (time + 10 < wakeUpTime) {
- g_system->delayMillis(10);
- } else {
- if (time < wakeUpTime)
- g_system->delayMillis(wakeUpTime - time);
- break;
+#ifdef ENABLE_SCI32
+void EventManager::setHotRectanglesActive(const bool active) {
+ _hotRectanglesActive = active;
+}
+
+void EventManager::setHotRectangles(const Common::Array<Common::Rect> &rects) {
+ _hotRects = rects;
+ _activeRectIndex = -1;
+}
+
+void EventManager::checkHotRectangles(const Common::Point &mousePosition) {
+ int lastActiveRectIndex = _activeRectIndex;
+ _activeRectIndex = -1;
+
+ for (int16 i = 0; i < (int16)_hotRects.size(); ++i) {
+ if (_hotRects[i].contains(mousePosition)) {
+ _activeRectIndex = i;
+ if (i != lastActiveRectIndex) {
+ SciEvent hotRectEvent;
+ hotRectEvent.type = SCI_EVENT_HOT_RECTANGLE;
+ hotRectEvent.hotRectangleIndex = i;
+ _events.push_front(hotRectEvent);
+ break;
+ }
+
+ lastActiveRectIndex = _activeRectIndex;
}
+ }
+ if (lastActiveRectIndex != _activeRectIndex && lastActiveRectIndex != -1) {
+ _activeRectIndex = -1;
+ SciEvent hotRectEvent;
+ hotRectEvent.type = SCI_EVENT_HOT_RECTANGLE;
+ hotRectEvent.hotRectangleIndex = -1;
+ _events.push_front(hotRectEvent);
}
}
-
+#endif
} // End of namespace Sci
diff --git a/engines/sci/event.h b/engines/sci/event.h
index 15a94b3e73..23b59f964a 100644
--- a/engines/sci/event.h
+++ b/engines/sci/event.h
@@ -50,6 +50,8 @@ struct SciEvent {
* in script coordinates.
*/
Common::Point mousePosSci;
+
+ int16 hotRectangleIndex;
#endif
};
@@ -60,6 +62,9 @@ struct SciEvent {
#define SCI_EVENT_KEYBOARD (1 << 2)
#define SCI_EVENT_DIRECTION (1 << 6)
#define SCI_EVENT_SAID (1 << 7)
+#ifdef ENABLE_SCI32
+#define SCI_EVENT_HOT_RECTANGLE (1 << 8)
+#endif
/*Fake values for other events*/
#define SCI_EVENT_QUIT (1 << 11)
#define SCI_EVENT_PEEK (1 << 15)
@@ -138,6 +143,17 @@ private:
const bool _fontIsExtended;
Common::List<SciEvent> _events;
+#ifdef ENABLE_SCI32
+public:
+ void setHotRectanglesActive(const bool active);
+ void setHotRectangles(const Common::Array<Common::Rect> &rects);
+ void checkHotRectangles(const Common::Point &mousePosition);
+
+private:
+ bool _hotRectanglesActive;
+ Common::Array<Common::Rect> _hotRects;
+ int16 _activeRectIndex;
+#endif
};
} // End of namespace Sci
diff --git a/engines/sci/graphics/animate.cpp b/engines/sci/graphics/animate.cpp
index 98278397b7..8d92cb905f 100644
--- a/engines/sci/graphics/animate.cpp
+++ b/engines/sci/graphics/animate.cpp
@@ -145,7 +145,7 @@ bool GfxAnimate::invoke(List *list, int argc, reg_t *argv) {
if (_fastCastEnabled) {
// Check if the game has a fastCast object set
// if we don't abort kAnimate processing, at least in kq5 there will be animation cels drawn into speech boxes.
- if (!_s->variables[VAR_GLOBAL][84].isNull()) {
+ if (!_s->variables[VAR_GLOBAL][kGlobalVarFastCast].isNull()) {
// This normally points to an object called "fastCast",
// but for example in Eco Quest 1 it may also point to an object called "EventHandler" (see bug #5170)
// Original SCI only checked, if this global was not 0.
@@ -338,7 +338,7 @@ void GfxAnimate::applyGlobalScaling(AnimateList::iterator entry, GfxView *view)
int16 maxScale = readSelectorValue(_s->_segMan, entry->object, SELECTOR(maxScale));
int16 celHeight = view->getHeight(entry->loopNo, entry->celNo);
int16 maxCelHeight = (maxScale * celHeight) >> 7;
- reg_t globalVar2 = _s->variables[VAR_GLOBAL][2]; // current room object
+ reg_t globalVar2 = _s->variables[VAR_GLOBAL][kGlobalVarCurrentRoom]; // current room object
int16 vanishingY = readSelectorValue(_s->_segMan, globalVar2, SELECTOR(vanishingY));
int16 fixedPortY = _ports->getPort()->rect.bottom - vanishingY;
diff --git a/engines/sci/graphics/celobj32.cpp b/engines/sci/graphics/celobj32.cpp
index d67a4dc03c..430500ce1e 100644
--- a/engines/sci/graphics/celobj32.cpp
+++ b/engines/sci/graphics/celobj32.cpp
@@ -28,6 +28,7 @@
#include "sci/graphics/palette32.h"
#include "sci/graphics/remap32.h"
#include "sci/graphics/text32.h"
+#include "sci/engine/workarounds.h"
namespace Sci {
#pragma mark CelScaler
@@ -35,9 +36,6 @@ namespace Sci {
CelScaler *CelObj::_scaler = nullptr;
void CelScaler::activateScaleTables(const Ratio &scaleX, const Ratio &scaleY) {
- const int16 screenWidth = g_sci->_gfxFrameout->getCurrentBuffer().screenWidth;
- const int16 screenHeight = g_sci->_gfxFrameout->getCurrentBuffer().screenHeight;
-
for (int i = 0; i < ARRAYSIZE(_scaleTables); ++i) {
if (_scaleTables[i].scaleX == scaleX && _scaleTables[i].scaleY == scaleY) {
_activeIndex = i;
@@ -50,14 +48,12 @@ void CelScaler::activateScaleTables(const Ratio &scaleX, const Ratio &scaleY) {
CelScalerTable &table = _scaleTables[i];
if (table.scaleX != scaleX) {
- assert(screenWidth <= ARRAYSIZE(table.valuesX));
- buildLookupTable(table.valuesX, scaleX, screenWidth);
+ buildLookupTable(table.valuesX, scaleX, kCelScalerTableSize);
table.scaleX = scaleX;
}
if (table.scaleY != scaleY) {
- assert(screenHeight <= ARRAYSIZE(table.valuesY));
- buildLookupTable(table.valuesY, scaleY, screenHeight);
+ buildLookupTable(table.valuesY, scaleY, kCelScalerTableSize);
table.scaleY = scaleY;
}
}
@@ -159,17 +155,19 @@ struct SCALER_NoScale {
template<bool FLIP, typename READER>
struct SCALER_Scale {
#ifndef NDEBUG
+ int16 _minX;
int16 _maxX;
#endif
const byte *_row;
READER _reader;
int16 _x;
- static int16 _valuesX[4096];
- static int16 _valuesY[4096];
+ static int16 _valuesX[kCelScalerTableSize];
+ static int16 _valuesY[kCelScalerTableSize];
SCALER_Scale(const CelObj &celObj, const Common::Rect &targetRect, const Common::Point &scaledPosition, const Ratio scaleX, const Ratio scaleY) :
_row(nullptr),
#ifndef NDEBUG
+ _minX(targetRect.left),
_maxX(targetRect.right - 1),
#endif
// The maximum width of the scaled object may not be as
@@ -221,17 +219,17 @@ struct SCALER_Scale {
} else {
if (FLIP) {
const int lastIndex = celObj._width - 1;
- for (int16 x = 0; x < targetRect.width(); ++x) {
- _valuesX[targetRect.left + x] = lastIndex - table->valuesX[x];
+ for (int16 x = targetRect.left; x < targetRect.right; ++x) {
+ _valuesX[x] = lastIndex - table->valuesX[x - scaledPosition.x];
}
} else {
- for (int16 x = 0; x < targetRect.width(); ++x) {
- _valuesX[targetRect.left + x] = table->valuesX[x];
+ for (int16 x = targetRect.left; x < targetRect.right; ++x) {
+ _valuesX[x] = table->valuesX[x - scaledPosition.x];
}
}
- for (int16 y = 0; y < targetRect.height(); ++y) {
- _valuesY[targetRect.top + y] = table->valuesY[y];
+ for (int16 y = targetRect.top; y < targetRect.bottom; ++y) {
+ _valuesY[y] = table->valuesY[y - scaledPosition.y];
}
}
}
@@ -239,19 +237,19 @@ struct SCALER_Scale {
inline void setTarget(const int16 x, const int16 y) {
_row = _reader.getRow(_valuesY[y]);
_x = x;
- assert(_x >= 0 && _x <= _maxX);
+ assert(_x >= _minX && _x <= _maxX);
}
inline byte read() {
- assert(_x >= 0 && _x <= _maxX);
+ assert(_x >= _minX && _x <= _maxX);
return _row[_valuesX[_x++]];
}
};
template<bool FLIP, typename READER>
-int16 SCALER_Scale<FLIP, READER>::_valuesX[4096];
+int16 SCALER_Scale<FLIP, READER>::_valuesX[kCelScalerTableSize];
template<bool FLIP, typename READER>
-int16 SCALER_Scale<FLIP, READER>::_valuesY[4096];
+int16 SCALER_Scale<FLIP, READER>::_valuesY[kCelScalerTableSize];
#pragma mark -
#pragma mark CelObj - Resource readers
@@ -283,13 +281,13 @@ public:
struct READER_Compressed {
private:
const byte *const _resource;
- byte _buffer[4096];
+ byte _buffer[kCelScalerTableSize];
uint32 _controlOffset;
uint32 _dataOffset;
uint32 _uncompressedDataOffset;
int16 _y;
const int16 _sourceHeight;
- const uint8 _transparentColor;
+ const uint8 _skipColor;
const int16 _maxWidth;
public:
@@ -297,7 +295,7 @@ public:
_resource(celObj.getResPointer()),
_y(-1),
_sourceHeight(celObj._height),
- _transparentColor(celObj._transparentColor),
+ _skipColor(celObj._skipColor),
_maxWidth(maxWidth) {
assert(maxWidth <= celObj._width);
@@ -328,7 +326,7 @@ public:
// Fill with skip color
if (controlByte & 0x40) {
- memset(_buffer + i, _transparentColor, length);
+ memset(_buffer + i, _skipColor, length);
// Next value is fill color
} else {
memset(_buffer + i, *literal, length);
@@ -570,7 +568,7 @@ uint8 CelObj::readPixel(uint16 x, const uint16 y, bool mirrorX) const {
void CelObj::submitPalette() const {
if (_hunkPaletteOffset) {
- HunkPalette palette(getResPointer() + _hunkPaletteOffset);
+ const HunkPalette palette(getResPointer() + _hunkPaletteOffset);
g_sci->_gfxPalette32->submit(palette);
}
}
@@ -667,7 +665,7 @@ void CelObj::render(Buffer &target, const Common::Rect &targetRect, const Common
MAPPER mapper;
SCALER scaler(*this, targetRect.left - scaledPosition.x + targetRect.width(), scaledPosition);
- RENDERER<MAPPER, SCALER, false> renderer(mapper, scaler, _transparentColor);
+ RENDERER<MAPPER, SCALER, false> renderer(mapper, scaler, _skipColor);
renderer.draw(target, targetRect, scaledPosition);
}
@@ -677,10 +675,10 @@ void CelObj::render(Buffer &target, const Common::Rect &targetRect, const Common
MAPPER mapper;
SCALER scaler(*this, targetRect, scaledPosition, scaleX, scaleY);
if (_drawBlackLines) {
- RENDERER<MAPPER, SCALER, true> renderer(mapper, scaler, _transparentColor);
+ RENDERER<MAPPER, SCALER, true> renderer(mapper, scaler, _skipColor);
renderer.draw(target, targetRect, scaledPosition);
} else {
- RENDERER<MAPPER, SCALER, false> renderer(mapper, scaler, _transparentColor);
+ RENDERER<MAPPER, SCALER, false> renderer(mapper, scaler, _skipColor);
renderer.draw(target, targetRect, scaledPosition);
}
}
@@ -812,7 +810,31 @@ int16 CelObjView::getNumCels(const GuiResourceId viewId, const int16 loopNo) {
const byte *const data = resource->data;
const uint16 loopCount = data[2];
- if (loopNo >= loopCount || loopNo < 0) {
+
+ // Every version of SCI32 has a logic error in this function that causes
+ // random memory to be read if a script requests the cel count for one
+ // past the maximum loop index. At least GK1 room 800 does this, and gets
+ // stuck in an infinite loop because the game script expects this method
+ // to return a non-zero value.
+ // The scope of this bug means it is likely to pop up in other games, so we
+ // explicitly trap the bad condition here and report it so that any other
+ // game scripts relying on this broken behavior can be fixed as well
+ if (loopNo == loopCount) {
+ SciCallOrigin origin;
+ SciWorkaroundSolution solution = trackOriginAndFindWorkaround(0, kNumCels_workarounds, &origin);
+ switch (solution.type) {
+ case WORKAROUND_NONE:
+ error("[CelObjView::getNumCels]: loop number %d is equal to loop count in view %u, %s", loopNo, viewId, origin.toString().c_str());
+ case WORKAROUND_FAKE:
+ return (int16)solution.value;
+ case WORKAROUND_IGNORE:
+ return 0;
+ case WORKAROUND_STILLCALL:
+ break;
+ }
+ }
+
+ if (loopNo > loopCount || loopNo < 0) {
return 0;
}
@@ -869,20 +891,20 @@ CelObjView::CelObjView(const GuiResourceId viewId, const int16 loopNo, const int
const byte *const data = resource->data;
- _scaledWidth = READ_SCI11ENDIAN_UINT16(data + 14);
- _scaledHeight = READ_SCI11ENDIAN_UINT16(data + 16);
+ _xResolution = READ_SCI11ENDIAN_UINT16(data + 14);
+ _yResolution = READ_SCI11ENDIAN_UINT16(data + 16);
- if (_scaledWidth == 0 && _scaledHeight == 0) {
+ if (_xResolution == 0 && _yResolution == 0) {
byte sizeFlag = data[5];
if (sizeFlag == 0) {
- _scaledWidth = kLowResX;
- _scaledHeight = kLowResY;
+ _xResolution = kLowResX;
+ _yResolution = kLowResY;
} else if (sizeFlag == 1) {
- _scaledWidth = 640;
- _scaledHeight = 480;
+ _xResolution = 640;
+ _yResolution = 480;
} else if (sizeFlag == 2) {
- _scaledWidth = 640;
- _scaledHeight = 400;
+ _xResolution = 640;
+ _yResolution = 400;
}
}
@@ -936,9 +958,9 @@ CelObjView::CelObjView(const GuiResourceId viewId, const int16 loopNo, const int
_width = READ_SCI11ENDIAN_UINT16(celHeader);
_height = READ_SCI11ENDIAN_UINT16(celHeader + 2);
- _displace.x = _width / 2 - (int16)READ_SCI11ENDIAN_UINT16(celHeader + 4);
- _displace.y = _height - (int16)READ_SCI11ENDIAN_UINT16(celHeader + 6) - 1;
- _transparentColor = celHeader[8];
+ _origin.x = _width / 2 - (int16)READ_SCI11ENDIAN_UINT16(celHeader + 4);
+ _origin.y = _height - (int16)READ_SCI11ENDIAN_UINT16(celHeader + 6) - 1;
+ _skipColor = celHeader[8];
_compressionType = (CelCompressionType)celHeader[9];
if (_compressionType != kCelCompressionNone && _compressionType != kCelCompressionRLE) {
@@ -967,7 +989,7 @@ bool CelObjView::analyzeUncompressedForRemap() const {
if (
pixel >= g_sci->_gfxRemap32->getStartColor() &&
pixel <= g_sci->_gfxRemap32->getEndColor() &&
- pixel != _transparentColor
+ pixel != _skipColor
) {
return true;
}
@@ -984,7 +1006,7 @@ bool CelObjView::analyzeForRemap() const {
if (
pixel >= g_sci->_gfxRemap32->getStartColor() &&
pixel <= g_sci->_gfxRemap32->getEndColor() &&
- pixel != _transparentColor
+ pixel != _skipColor
) {
return true;
}
@@ -1058,9 +1080,9 @@ CelObjPic::CelObjPic(const GuiResourceId picId, const int16 celNo) {
_width = READ_SCI11ENDIAN_UINT16(celHeader);
_height = READ_SCI11ENDIAN_UINT16(celHeader + 2);
- _displace.x = (int16)READ_SCI11ENDIAN_UINT16(celHeader + 4);
- _displace.y = (int16)READ_SCI11ENDIAN_UINT16(celHeader + 6);
- _transparentColor = celHeader[8];
+ _origin.x = (int16)READ_SCI11ENDIAN_UINT16(celHeader + 4);
+ _origin.y = (int16)READ_SCI11ENDIAN_UINT16(celHeader + 6);
+ _skipColor = celHeader[8];
_compressionType = (CelCompressionType)celHeader[9];
_priority = READ_SCI11ENDIAN_UINT16(celHeader + 36);
_relativePosition.x = (int16)READ_SCI11ENDIAN_UINT16(celHeader + 38);
@@ -1070,17 +1092,17 @@ CelObjPic::CelObjPic(const GuiResourceId picId, const int16 celNo) {
const uint16 sizeFlag2 = READ_SCI11ENDIAN_UINT16(data + 12);
if (sizeFlag2) {
- _scaledWidth = sizeFlag1;
- _scaledHeight = sizeFlag2;
+ _xResolution = sizeFlag1;
+ _yResolution = sizeFlag2;
} else if (sizeFlag1 == 0) {
- _scaledWidth = kLowResX;
- _scaledHeight = kLowResY;
+ _xResolution = kLowResX;
+ _yResolution = kLowResY;
} else if (sizeFlag1 == 1) {
- _scaledWidth = 640;
- _scaledHeight = 480;
+ _xResolution = 640;
+ _yResolution = 480;
} else if (sizeFlag1 == 2) {
- _scaledWidth = 640;
- _scaledHeight = 400;
+ _xResolution = 640;
+ _yResolution = 400;
}
if (celHeader[10] & 128) {
@@ -1105,7 +1127,7 @@ bool CelObjPic::analyzeUncompressedForSkip() const {
const byte *const pixels = resource + READ_SCI11ENDIAN_UINT32(resource + _celHeaderOffset + 24);
for (int i = 0; i < _width * _height; ++i) {
uint8 pixel = pixels[i];
- if (pixel == _transparentColor) {
+ if (pixel == _skipColor) {
return true;
}
}
@@ -1151,10 +1173,10 @@ CelObjMem::CelObjMem(const reg_t bitmapObject) {
_width = bitmap->getWidth();
_height = bitmap->getHeight();
- _displace = bitmap->getDisplace();
- _transparentColor = bitmap->getSkipColor();
- _scaledWidth = bitmap->getScaledWidth();
- _scaledHeight = bitmap->getScaledHeight();
+ _origin = bitmap->getOrigin();
+ _skipColor = bitmap->getSkipColor();
+ _xResolution = bitmap->getXResolution();
+ _yResolution = bitmap->getYResolution();
_hunkPaletteOffset = bitmap->getHunkPaletteOffset();
_remap = bitmap->getRemap();
}
@@ -1173,10 +1195,10 @@ byte *CelObjMem::getResPointer() const {
CelObjColor::CelObjColor(const uint8 color, const int16 width, const int16 height) {
_info.type = kCelTypeColor;
_info.color = color;
- _displace.x = 0;
- _displace.y = 0;
- _scaledWidth = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth;
- _scaledHeight = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight;
+ _origin.x = 0;
+ _origin.y = 0;
+ _xResolution = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth;
+ _yResolution = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight;
_hunkPaletteOffset = 0;
_mirrorX = false;
_remap = false;
diff --git a/engines/sci/graphics/celobj32.h b/engines/sci/graphics/celobj32.h
index 21e86d03e0..03d950a3c3 100644
--- a/engines/sci/graphics/celobj32.h
+++ b/engines/sci/graphics/celobj32.h
@@ -141,13 +141,20 @@ typedef Common::Array<CelCacheEntry> CelCache;
#pragma mark -
#pragma mark CelScaler
+enum {
+ /**
+ * The maximum size of a row/column of scaled pixel data.
+ */
+ kCelScalerTableSize = 4096
+};
+
struct CelScalerTable {
/**
* A lookup table of indexes that should be used to find
* the correct column to read from the source bitmap
* when drawing a scaled version of the source bitmap.
*/
- int valuesX[4096];
+ int valuesX[kCelScalerTableSize];
/**
* The ratio used to generate the x-values.
@@ -159,7 +166,7 @@ struct CelScalerTable {
* the correct row to read from a source bitmap when
* drawing a scaled version of the source bitmap.
*/
- int valuesY[4096];
+ int valuesY[kCelScalerTableSize];
/**
* The ratio used to generate the y-values.
@@ -279,7 +286,7 @@ public:
/**
* TODO: Documentation
*/
- Common::Point _displace;
+ Common::Point _origin;
/**
* The dimensions of the original coordinate system for
@@ -294,21 +301,21 @@ public:
* scriptWidth/Height but seems to typically be changed
* to more closely match the native screen resolution.
*/
- uint16 _scaledWidth, _scaledHeight;
+ uint16 _xResolution, _yResolution;
/**
* The skip (transparent) color for the cel. When
* compositing, any pixels matching this color will not
* be copied to the buffer.
*/
- uint8 _transparentColor;
+ uint8 _skipColor;
/**
* Whether or not this cel has any transparent regions.
* This is used for optimised drawing of non-transparent
* cels.
*/
- bool _transparent; // TODO: probably "skip"?
+ bool _transparent;
/**
* The compression type for the pixel data for this cel.
diff --git a/engines/sci/graphics/controls32.cpp b/engines/sci/graphics/controls32.cpp
index 7689655d1d..0cd924b38d 100644
--- a/engines/sci/graphics/controls32.cpp
+++ b/engines/sci/graphics/controls32.cpp
@@ -160,7 +160,6 @@ reg_t GfxControls32::kernelEditText(const reg_t controlObject) {
// Original engine did not have a QUIT event but we have to handle it
if (event.type == SCI_EVENT_QUIT) {
focused = false;
- break;
} else if (event.type == SCI_EVENT_MOUSE_PRESS && !editorPlaneRect.contains(event.mousePosSci)) {
focused = false;
} else if (event.type == SCI_EVENT_KEYBOARD) {
@@ -313,8 +312,8 @@ reg_t GfxControls32::kernelEditText(const reg_t controlObject) {
if (textChanged) {
editor.text.trim();
- SciString *string = _segMan->lookupString(textObject);
- string->fromString(editor.text);
+ SciArray &string = *_segMan->lookupArray(textObject);
+ string.fromString(editor.text);
}
return make_reg(0, textChanged);
@@ -400,7 +399,7 @@ ScrollWindow::ScrollWindow(SegManager *segMan, const Common::Rect &gameRect, con
const uint16 scriptHeight = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight;
Common::Rect bitmapRect(gameRect);
- mulinc(bitmapRect, Ratio(_gfxText32._scaledWidth, scriptWidth), Ratio(_gfxText32._scaledHeight, scriptHeight));
+ mulinc(bitmapRect, Ratio(_gfxText32._xResolution, scriptWidth), Ratio(_gfxText32._yResolution, scriptHeight));
_textRect.left = 2;
_textRect.top = 2;
@@ -441,6 +440,11 @@ void ScrollWindow::show() {
}
Plane *plane = g_sci->_gfxFrameout->getPlanes().findByObject(_plane);
+
+ if (plane == nullptr) {
+ error("[ScrollWindow::show]: Plane %04x:%04x not found", PRINT_REG(_plane));
+ }
+
plane->_screenItemList.add(_screenItem);
_visible = true;
diff --git a/engines/sci/graphics/cursor32.cpp b/engines/sci/graphics/cursor32.cpp
index 88150db6e6..2f2611c769 100644
--- a/engines/sci/graphics/cursor32.cpp
+++ b/engines/sci/graphics/cursor32.cpp
@@ -122,6 +122,7 @@ void GfxCursor32::drawToHardware(const DrawRegion &source) {
byte *sourcePixel = source.data + (sourceYOffset * source.rect.width()) + sourceXOffset;
g_system->copyRectToScreen(sourcePixel, source.rect.width(), drawRect.left, drawRect.top, drawRect.width(), drawRect.height());
+ g_system->updateScreen();
}
void GfxCursor32::unhide() {
@@ -181,7 +182,7 @@ void GfxCursor32::setView(const GuiResourceId viewId, const int16 loopNo, const
if (_macCursorRemap.empty() && viewId != -1) {
CelObjView view(viewId, loopNo, celNo);
- _hotSpot = view._displace;
+ _hotSpot = view._origin;
_width = view._width;
_height = view._height;
diff --git a/engines/sci/graphics/cursor32.h b/engines/sci/graphics/cursor32.h
index 88a75beb7f..00a8b9baa4 100644
--- a/engines/sci/graphics/cursor32.h
+++ b/engines/sci/graphics/cursor32.h
@@ -31,7 +31,7 @@
namespace Sci {
-class GfxCursor32 : Common::Serializable {
+class GfxCursor32 : public Common::Serializable {
public:
GfxCursor32();
~GfxCursor32();
diff --git a/engines/sci/graphics/font.h b/engines/sci/graphics/font.h
index 451261f315..b79fb2f0ba 100644
--- a/engines/sci/graphics/font.h
+++ b/engines/sci/graphics/font.h
@@ -75,7 +75,7 @@ private:
byte height;
int16 offset;
};
-
+
byte _fontHeight;
uint16 _numChars;
Charinfo *_chars;
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index 4e0aa22669..843fe5ed86 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -58,7 +58,7 @@
namespace Sci {
GfxFrameout::GfxFrameout(SegManager *segMan, GfxPalette32 *palette, GfxTransitions32 *transitions, GfxCursor32 *cursor) :
- _isHiRes(ConfMan.getBool("enable_high_resolution_graphics")),
+ _isHiRes(gameIsHiRes()),
_palette(palette),
_cursor(cursor),
_segMan(segMan),
@@ -71,11 +71,6 @@ GfxFrameout::GfxFrameout(SegManager *segMan, GfxPalette32 *palette, GfxTransitio
_overdrawThreshold(0),
_palMorphIsOn(false) {
- // QFG4 is the only SCI32 game that doesn't have a high-resolution version
- if (g_sci->getGameId() == GID_QFG4) {
- _isHiRes = false;
- }
-
if (g_sci->getGameId() == GID_PHANTASMAGORIA) {
_currentBuffer = Buffer(630, 450, nullptr);
} else if (_isHiRes) {
@@ -146,7 +141,7 @@ void GfxFrameout::syncWithScripts(bool addElements) {
return;
// Get planes list object
- reg_t planesListObject = engineState->variables[VAR_GLOBAL][10];
+ reg_t planesListObject = engineState->variables[VAR_GLOBAL][kGlobalVarPlanes];
reg_t planesListElements = readSelector(segMan, planesListObject, SELECTOR(elements));
List *planesList = segMan->lookupList(planesListElements);
@@ -213,6 +208,26 @@ void GfxFrameout::syncWithScripts(bool addElements) {
}
}
+bool GfxFrameout::gameIsHiRes() const {
+ // QFG4 is always low resolution
+ if (g_sci->getGameId() == GID_QFG4) {
+ return false;
+ }
+
+ // GK1 DOS floppy is low resolution only, but GK1 Mac floppy is high
+ // resolution only
+ if (g_sci->getGameId() == GID_GK1 &&
+ !g_sci->isCD() &&
+ g_sci->getPlatform() != Common::kPlatformMacintosh) {
+
+ return false;
+ }
+
+ // All other games are either high resolution by default, or have a
+ // user-defined toggle
+ return ConfMan.getBool("enable_high_resolution_graphics");
+}
+
#pragma mark -
#pragma mark Benchmarking
@@ -550,7 +565,7 @@ void GfxFrameout::palMorphFrameOut(const int8 *styleRanges, PlaneShowStyle *show
Palette sourcePalette(_palette->getNextPalette());
alterVmap(sourcePalette, sourcePalette, -1, styleRanges);
- int16 prevRoom = g_sci->getEngineState()->variables[VAR_GLOBAL][12].toSint16();
+ int16 prevRoom = g_sci->getEngineState()->variables[VAR_GLOBAL][kGlobalVarPreviousRoomNo].toSint16();
Common::Rect rect(_currentBuffer.screenWidth, _currentBuffer.screenHeight);
_showList.add(rect);
@@ -989,6 +1004,10 @@ void GfxFrameout::calcLists(ScreenItemListList &drawLists, EraseListList &eraseL
_visiblePlanes.add(new Plane(plane));
--plane._created;
} else if (plane._updated) {
+ if (visiblePlane == nullptr) {
+ error("[GfxFrameout::calcLists]: Attempt to update nonexistent visible plane");
+ }
+
*visiblePlane = plane;
--plane._updated;
}
@@ -1108,6 +1127,7 @@ void GfxFrameout::mergeToShowList(const Common::Rect &drawRect, RectList &showLi
void GfxFrameout::showBits() {
if (!_showList.size()) {
+ g_system->updateScreen();
return;
}
@@ -1146,6 +1166,7 @@ void GfxFrameout::showBits() {
_cursor->donePainting();
_showList.clear();
+ g_system->updateScreen();
}
void GfxFrameout::alterVmap(const Palette &palette1, const Palette &palette2, const int8 style, const int8 *const styleRanges) {
@@ -1327,7 +1348,7 @@ bool GfxFrameout::isOnMe(const ScreenItem &screenItem, const Plane &plane, const
scaledPosition.x -= screenItem._scaledPosition.x;
scaledPosition.y -= screenItem._scaledPosition.y;
- mulru(scaledPosition, Ratio(celObj._scaledWidth, _currentBuffer.screenWidth), Ratio(celObj._scaledHeight, _currentBuffer.screenHeight));
+ mulru(scaledPosition, Ratio(celObj._xResolution, _currentBuffer.screenWidth), Ratio(celObj._yResolution, _currentBuffer.screenHeight));
if (screenItem._scale.signal != kScaleSignalNone && screenItem._scale.x && screenItem._scale.y) {
scaledPosition.x = scaledPosition.x * 128 / screenItem._scale.x;
@@ -1335,7 +1356,7 @@ bool GfxFrameout::isOnMe(const ScreenItem &screenItem, const Plane &plane, const
}
uint8 pixel = celObj.readPixel(scaledPosition.x, scaledPosition.y, mirrorX);
- return pixel != celObj._transparentColor;
+ return pixel != celObj._skipColor;
}
return true;
diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h
index e4caffd9e5..9481b0ef5a 100644
--- a/engines/sci/graphics/frameout.h
+++ b/engines/sci/graphics/frameout.h
@@ -44,6 +44,12 @@ private:
GfxPalette32 *_palette;
SegManager *_segMan;
+ /**
+ * Determines whether the current game should be rendered in
+ * high resolution.
+ */
+ bool gameIsHiRes() const;
+
public:
GfxFrameout(SegManager *segMan, GfxPalette32 *palette, GfxTransitions32 *transitions, GfxCursor32 *cursor);
~GfxFrameout();
diff --git a/engines/sci/graphics/paint16.cpp b/engines/sci/graphics/paint16.cpp
index 91817d4060..aac922d278 100644
--- a/engines/sci/graphics/paint16.cpp
+++ b/engines/sci/graphics/paint16.cpp
@@ -541,12 +541,10 @@ reg_t GfxPaint16::kernelDisplay(const char *text, uint16 languageSplitter, int a
break;
default:
- SciTrackOriginReply originReply;
+ SciCallOrigin originReply;
SciWorkaroundSolution solution = trackOriginAndFindWorkaround(0, kDisplay_workarounds, &originReply);
if (solution.type == WORKAROUND_NONE)
- error("Unknown kDisplay argument (%04x:%04x) from method %s::%s (script %d, localCall %x)",
- PRINT_REG(displayArg), originReply.objectName.c_str(), originReply.methodName.c_str(),
- originReply.scriptNr, originReply.localCallOffset);
+ error("Unknown kDisplay argument (%04x:%04x) from %s", PRINT_REG(displayArg), originReply.toString().c_str());
assert(solution.type == WORKAROUND_IGNORE);
break;
}
diff --git a/engines/sci/graphics/paint32.cpp b/engines/sci/graphics/paint32.cpp
index 338b70901e..bf7c73623e 100644
--- a/engines/sci/graphics/paint32.cpp
+++ b/engines/sci/graphics/paint32.cpp
@@ -38,7 +38,6 @@ reg_t GfxPaint32::kernelAddLine(const reg_t planeObject, const Common::Point &st
Common::Rect gameRect;
reg_t bitmapId = makeLineBitmap(startPoint, endPoint, priority, color, style, pattern, thickness, gameRect);
- SciBitmap &bitmap = *_segMan->lookupBitmap(bitmapId);
CelInfo32 celInfo;
celInfo.type = kCelTypeMem;
@@ -48,7 +47,7 @@ reg_t GfxPaint32::kernelAddLine(const reg_t planeObject, const Common::Point &st
// `kUpdateLine` can get the originally used color
celInfo.color = color;
- ScreenItem *screenItem = new ScreenItem(planeObject, celInfo, Common::Rect(startPoint.x, startPoint.y, startPoint.x + bitmap.getWidth(), startPoint.y + bitmap.getHeight()));
+ ScreenItem *screenItem = new ScreenItem(planeObject, celInfo, gameRect);
screenItem->_priority = priority;
screenItem->_fixedPriority = true;
@@ -89,9 +88,13 @@ void GfxPaint32::plotter(int x, int y, int color, void *data) {
LineProperties &properties = *static_cast<LineProperties *>(data);
byte *pixels = properties.bitmap->getPixels();
- const uint32 index = properties.bitmap->getWidth() * y + x;
+ const uint16 bitmapWidth = properties.bitmap->getWidth();
+ const uint16 bitmapHeight = properties.bitmap->getHeight();
+ const uint32 index = bitmapWidth * y + x;
- if (index < properties.bitmap->getDataSize()) {
+ // Only draw the points in the bitmap, and ignore the rest. SSCI scripts
+ // can draw lines ending outside the visible area (e.g. negative coordinates)
+ if (x >= 0 && x < bitmapWidth && y >= 0 && y < bitmapHeight) {
if (properties.solid) {
pixels[index] = (uint8)color;
return;
@@ -112,25 +115,29 @@ void GfxPaint32::plotter(int x, int y, int color, void *data) {
if (properties.patternIndex == ARRAYSIZE(properties.pattern)) {
properties.patternIndex = 0;
}
- } else {
- warning("GfxPaint32::plotter: Attempted to write out of bounds (%u >= %u)", index, properties.bitmap->getDataSize());
}
}
reg_t GfxPaint32::makeLineBitmap(const Common::Point &startPoint, const Common::Point &endPoint, const int16 priority, const uint8 color, const LineStyle style, uint16 pattern, uint8 thickness, Common::Rect &outRect) {
const uint8 skipColor = color != kDefaultSkipColor ? kDefaultSkipColor : 0;
- // Thickness is expected to be 2n+1
- thickness = ((MAX((uint8)1, thickness) - 1) | 1);
+ // Line thickness is expected to be 2 * thickness + 1
+ thickness = (MAX<uint8>(1, thickness) - 1) | 1;
const uint8 halfThickness = thickness >> 1;
- outRect.left = (startPoint.x < endPoint.x ? startPoint.x : endPoint.x) - halfThickness;
- outRect.top = (startPoint.y < endPoint.y ? startPoint.y : endPoint.y) - halfThickness;
- outRect.right = (startPoint.x > endPoint.x ? startPoint.x : endPoint.x) + halfThickness + 1;
- outRect.bottom = (startPoint.y > endPoint.y ? startPoint.y : endPoint.y) + halfThickness + 1;
+ const uint16 scriptWidth = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth;
+ const uint16 scriptHeight = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight;
+
+ outRect.left = MIN<int16>(startPoint.x, endPoint.x);
+ outRect.top = MIN<int16>(startPoint.y, endPoint.y);
+ outRect.right = MAX<int16>(startPoint.x, endPoint.x) + 1 + 1; // rect lower edge + thickness offset
+ outRect.bottom = MAX<int16>(startPoint.y, endPoint.y) + 1 + 1; // rect lower edge + thickness offset
+
+ outRect.grow(halfThickness);
+ outRect.clip(Common::Rect(scriptWidth, scriptHeight));
reg_t bitmapId;
- SciBitmap &bitmap = *_segMan->allocateBitmap(&bitmapId, outRect.width(), outRect.height(), skipColor, 0, 0, g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth, g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight, 0, false, true);
+ SciBitmap &bitmap = *_segMan->allocateBitmap(&bitmapId, outRect.width(), outRect.height(), skipColor, 0, 0, scriptWidth, scriptHeight, 0, false, true);
byte *pixels = bitmap.getPixels();
memset(pixels, skipColor, bitmap.getWidth() * bitmap.getHeight());
@@ -152,12 +159,11 @@ reg_t GfxPaint32::makeLineBitmap(const Common::Point &startPoint, const Common::
break;
}
- const Common::Rect drawRect(
- startPoint.x - outRect.left,
- startPoint.y - outRect.top,
- endPoint.x - outRect.left,
- endPoint.y - outRect.top
- );
+ // Change coordinates to be relative to the bitmap
+ const int16 x1 = startPoint.x - outRect.left;
+ const int16 y1 = startPoint.y - outRect.top;
+ const int16 x2 = endPoint.x - outRect.left;
+ const int16 y2 = endPoint.y - outRect.top;
if (!properties.solid) {
for (int i = 0; i < ARRAYSIZE(properties.pattern); ++i) {
@@ -166,14 +172,14 @@ reg_t GfxPaint32::makeLineBitmap(const Common::Point &startPoint, const Common::
}
properties.patternIndex = 0;
- properties.horizontal = ABS(drawRect.right - drawRect.left) > ABS(drawRect.bottom - drawRect.top);
- properties.lastAddress = properties.horizontal ? drawRect.left : drawRect.top;
+ properties.horizontal = ABS(x2 - x1) > ABS(y2 - y1);
+ properties.lastAddress = properties.horizontal ? x1 : y1;
}
if (thickness <= 1) {
- Graphics::drawLine(drawRect.left, drawRect.top, drawRect.right, drawRect.bottom, color, plotter, &properties);
+ Graphics::drawLine(x1, y1, x2, y2, color, plotter, &properties);
} else {
- Graphics::drawThickLine2(drawRect.left, drawRect.top, drawRect.right, drawRect.bottom, thickness, color, plotter, &properties);
+ Graphics::drawThickLine2(x1, y1, x2, y2, thickness, color, plotter, &properties);
}
return bitmapId;
diff --git a/engines/sci/graphics/palette32.cpp b/engines/sci/graphics/palette32.cpp
index c7098bc3e4..ec3d912365 100644
--- a/engines/sci/graphics/palette32.cpp
+++ b/engines/sci/graphics/palette32.cpp
@@ -52,7 +52,7 @@ HunkPalette::HunkPalette(byte *rawPalette) :
}
}
-void HunkPalette::setVersion(const uint32 version) {
+void HunkPalette::setVersion(const uint32 version) const {
if (_numPalettes != _data[10]) {
error("Invalid HunkPalette");
}
@@ -93,9 +93,9 @@ const Palette HunkPalette::toPalette() const {
if (_numPalettes) {
const EntryHeader header = getEntryHeader();
- byte *data = getPalPointer() + kEntryHeaderSize;
+ const byte *data = getPalPointer() + kEntryHeaderSize;
- int16 end = header.startColor + header.numColors;
+ const int16 end = header.startColor + header.numColors;
assert(end <= 256);
if (header.sharedUsed) {
@@ -118,20 +118,19 @@ const Palette HunkPalette::toPalette() const {
return outPalette;
}
-
#pragma mark -
#pragma mark GfxPalette32
GfxPalette32::GfxPalette32(ResourceManager *resMan)
: _resMan(resMan),
+
// Palette versioning
_version(1),
_needsUpdate(false),
_currentPalette(),
_sourcePalette(),
_nextPalette(),
- // Clut
- _clutTable(nullptr),
+
// Palette varying
_varyStartPalette(nullptr),
_varyTargetPalette(nullptr),
@@ -142,6 +141,7 @@ GfxPalette32::GfxPalette32(ResourceManager *resMan)
_varyDirection(0),
_varyTargetPercent(0),
_varyNumTimesPaused(0),
+
// Palette cycling
_cyclers(),
_cycleMap() {
@@ -161,44 +161,6 @@ GfxPalette32::~GfxPalette32() {
cycleAllOff();
}
-inline void mergePaletteInternal(Palette *const to, const Palette *const from) {
- // The last color is always white, so it is not copied.
- // (Some palettes try to set the last color, which causes
- // churning in the palettes when they are merged)
- for (int i = 0, len = ARRAYSIZE(to->colors) - 1; i < len; ++i) {
- if (from->colors[i].used) {
- to->colors[i] = from->colors[i];
- }
- }
-}
-
-void GfxPalette32::submit(const Palette &palette) {
- const Palette oldSourcePalette(_sourcePalette);
- mergePaletteInternal(&_sourcePalette, &palette);
-
- if (!_needsUpdate && _sourcePalette != oldSourcePalette) {
- ++_version;
- _needsUpdate = true;
- }
-}
-
-void GfxPalette32::submit(HunkPalette &hunkPalette) {
- if (hunkPalette.getVersion() == _version) {
- return;
- }
-
- const Palette oldSourcePalette(_sourcePalette);
- const Palette palette = hunkPalette.toPalette();
- mergePaletteInternal(&_sourcePalette, &palette);
-
- if (!_needsUpdate && oldSourcePalette != _sourcePalette) {
- ++_version;
- _needsUpdate = true;
- }
-
- hunkPalette.setVersion(_version);
-}
-
bool GfxPalette32::loadPalette(const GuiResourceId resourceId) {
Resource *palResource = _resMan->findResource(ResourceId(kResourceTypePalette, resourceId), false);
@@ -206,7 +168,7 @@ bool GfxPalette32::loadPalette(const GuiResourceId resourceId) {
return false;
}
- HunkPalette palette(palResource->data);
+ const HunkPalette palette(palResource->data);
submit(palette);
return true;
}
@@ -241,6 +203,33 @@ int16 GfxPalette32::matchColor(const uint8 r, const uint8 g, const uint8 b) {
return bestIndex;
}
+void GfxPalette32::submit(const Palette &palette) {
+ const Palette oldSourcePalette(_sourcePalette);
+ mergePalette(_sourcePalette, palette);
+
+ if (!_needsUpdate && _sourcePalette != oldSourcePalette) {
+ ++_version;
+ _needsUpdate = true;
+ }
+}
+
+void GfxPalette32::submit(const HunkPalette &hunkPalette) {
+ if (hunkPalette.getVersion() == _version) {
+ return;
+ }
+
+ const Palette oldSourcePalette(_sourcePalette);
+ const Palette palette = hunkPalette.toPalette();
+ mergePalette(_sourcePalette, palette);
+
+ if (!_needsUpdate && oldSourcePalette != _sourcePalette) {
+ ++_version;
+ _needsUpdate = true;
+ }
+
+ hunkPalette.setVersion(_version);
+}
+
bool GfxPalette32::updateForFrame() {
applyAll();
_needsUpdate = false;
@@ -266,10 +255,10 @@ void GfxPalette32::updateHardware(const bool updateScreen) {
_currentPalette.colors[i] = _nextPalette.colors[i];
// NOTE: If the brightness option in the user configuration file is set,
- // SCI engine adjusts palette brightnesses here by mapping RGB values to values
- // in some hard-coded brightness tables. There is no reason on modern hardware
- // to implement this, unless it is discovered that some game uses a non-standard
- // brightness setting by default
+ // SCI engine adjusts palette brightnesses here by mapping RGB values to
+ // values in some hard-coded brightness tables. There is no reason on
+ // modern hardware to implement this, unless it is discovered that some
+ // game uses a non-standard brightness setting by default
// All color entries MUST be copied, not just "used" entries, otherwise
// uninitialised memory from bpal makes its way into the system palette.
@@ -295,7 +284,30 @@ void GfxPalette32::updateHardware(const bool updateScreen) {
g_system->getPaletteManager()->setPalette(bpal, 0, 256);
if (updateScreen) {
- g_sci->getEventManager()->updateScreen();
+ g_system->updateScreen();
+ }
+}
+
+Palette GfxPalette32::getPaletteFromResource(const GuiResourceId resourceId) const {
+ Resource *palResource = _resMan->findResource(ResourceId(kResourceTypePalette, resourceId), false);
+
+ if (!palResource) {
+ error("Could not load vary palette %d", resourceId);
+ }
+
+ const HunkPalette rawPalette(palResource->data);
+ return rawPalette.toPalette();
+}
+
+void GfxPalette32::mergePalette(Palette &to, const Palette &from) {
+ // The last color is always white in SCI, so it is not copied. (Some
+ // palettes, particularly in KQ7, try to set the last color, which causes
+ // unnecessary palette updates since the last color is forced by SSCI to a
+ // specific value)
+ for (int i = 0; i < ARRAYSIZE(to.colors) - 1; ++i) {
+ if (from.colors[i].used) {
+ to.colors[i] = from.colors[i];
+ }
}
}
@@ -306,81 +318,43 @@ void GfxPalette32::applyAll() {
}
#pragma mark -
-#pragma mark Colour look-up
-
-#ifdef ENABLE_SCI3_GAMES
-bool GfxPalette32::loadClut(uint16 clutId) {
- // loadClut() will load a color lookup table from a clu file and set
- // the palette found in the file. This is to be used with Phantasmagoria 2.
-
- unloadClut();
-
- Common::String filename = Common::String::format("%d.clu", clutId);
- Common::File clut;
-
- if (!clut.open(filename) || clut.size() != 0x10000 + 236 * 3)
- return false;
-
- // Read in the lookup table
- // It maps each RGB565 color to a palette index
- _clutTable = new byte[0x10000];
- clut.read(_clutTable, 0x10000);
+#pragma mark Varying
- Palette pal;
- memset(&pal, 0, sizeof(Palette));
+void GfxPalette32::setVary(const Palette &target, const int16 percent, const int32 ticks, const int16 fromColor, const int16 toColor) {
+ setTarget(target);
+ setVaryTime(percent, ticks);
- // Setup 1:1 mapping
- for (int i = 0; i < 256; i++) {
- pal.mapping[i] = i;
+ if (fromColor > -1) {
+ _varyFromColor = fromColor;
}
-
- // Now load in the palette
- for (int i = 1; i <= 236; i++) {
- pal.colors[i].used = 1;
- pal.colors[i].r = clut.readByte();
- pal.colors[i].g = clut.readByte();
- pal.colors[i].b = clut.readByte();
+ if (toColor > -1) {
+ assert(toColor < 256);
+ _varyToColor = toColor;
}
-
- set(&pal, true);
- setOnScreen();
- return true;
}
-byte GfxPalette32::matchClutColor(uint16 color) {
- // Match a color in RGB565 format to a palette index based on the loaded CLUT
- assert(_clutTable);
- return _clutTable[color];
-}
+void GfxPalette32::setVaryPercent(const int16 percent, const int32 ticks) {
+ if (_varyTargetPalette != nullptr) {
+ setVaryTime(percent, ticks);
+ }
-void GfxPalette32::unloadClut() {
- // This will only unload the actual table, but not reset any palette
- delete[] _clutTable;
- _clutTable = nullptr;
+ // NOTE: SSCI had two additional parameters for this function to change the
+ // `_varyFromColor`, but they were always hardcoded to be ignored
}
-#endif
-
-#pragma mark -
-#pragma mark Varying
-
-inline Palette GfxPalette32::getPaletteFromResourceInternal(const GuiResourceId resourceId) const {
- Resource *palResource = _resMan->findResource(ResourceId(kResourceTypePalette, resourceId), false);
- if (!palResource) {
- error("Could not load vary palette %d", resourceId);
+void GfxPalette32::setVaryTime(const int32 time) {
+ if (_varyTargetPalette != nullptr) {
+ setVaryTime(_varyTargetPercent, time);
}
-
- HunkPalette rawPalette(palResource->data);
- return rawPalette.toPalette();
}
-inline void GfxPalette32::setVaryTimeInternal(const int16 percent, const int time) {
+void GfxPalette32::setVaryTime(const int16 percent, const int32 ticks) {
_varyLastTick = g_sci->getTickCount();
- if (!time || _varyPercent == percent) {
+ if (!ticks || _varyPercent == percent) {
_varyDirection = 0;
_varyTargetPercent = _varyPercent = percent;
} else {
- _varyTime = time / (percent - _varyPercent);
+ _varyTime = ticks / (percent - _varyPercent);
_varyTargetPercent = percent;
if (_varyTime > 0) {
@@ -395,72 +369,6 @@ inline void GfxPalette32::setVaryTimeInternal(const int16 percent, const int tim
}
}
-void GfxPalette32::kernelPalVarySet(const GuiResourceId paletteId, const int16 percent, const int time, const int16 fromColor, const int16 toColor) {
- Palette palette = getPaletteFromResourceInternal(paletteId);
- setVary(&palette, percent, time, fromColor, toColor);
-}
-
-void GfxPalette32::kernelPalVaryMergeTarget(GuiResourceId paletteId) {
- Palette palette = getPaletteFromResourceInternal(paletteId);
- mergeTarget(&palette);
-}
-
-void GfxPalette32::kernelPalVarySetTarget(GuiResourceId paletteId) {
- Palette palette = getPaletteFromResourceInternal(paletteId);
- setTarget(&palette);
-}
-
-void GfxPalette32::kernelPalVarySetStart(GuiResourceId paletteId) {
- Palette palette = getPaletteFromResourceInternal(paletteId);
- setStart(&palette);
-}
-
-void GfxPalette32::kernelPalVaryMergeStart(GuiResourceId paletteId) {
- Palette palette = getPaletteFromResourceInternal(paletteId);
- mergeStart(&palette);
-}
-
-void GfxPalette32::kernelPalVaryPause(bool pause) {
- if (pause) {
- varyPause();
- } else {
- varyOn();
- }
-}
-
-void GfxPalette32::setVary(const Palette *const target, const int16 percent, const int time, const int16 fromColor, const int16 toColor) {
- setTarget(target);
- setVaryTimeInternal(percent, time);
-
- if (fromColor > -1) {
- _varyFromColor = fromColor;
- }
- if (toColor > -1) {
- assert(toColor < 256);
- _varyToColor = toColor;
- }
-}
-
-void GfxPalette32::setVaryPercent(const int16 percent, const int time, const int16 fromColor, const int16 fromColorAlternate) {
- if (_varyTargetPalette != nullptr) {
- setVaryTimeInternal(percent, time);
- }
-
- // This looks like a mistake in the actual SCI engine (both SQ6 and Lighthouse);
- // the values are always hardcoded to -1 in kPalVary, so this code can never
- // actually be executed
- if (fromColor > -1) {
- _varyFromColor = fromColor;
- }
- if (fromColorAlternate > -1) {
- _varyFromColor = fromColorAlternate;
- }
-}
-
-int16 GfxPalette32::getVaryPercent() const {
- return ABS(_varyPercent);
-}
-
void GfxPalette32::varyOff() {
_varyNumTimesPaused = 0;
_varyPercent = _varyTargetPercent = 0;
@@ -479,14 +387,6 @@ void GfxPalette32::varyOff() {
}
}
-void GfxPalette32::mergeTarget(const Palette *const palette) {
- if (_varyTargetPalette != nullptr) {
- mergePaletteInternal(_varyTargetPalette, palette);
- } else {
- _varyTargetPalette = new Palette(*palette);
- }
-}
-
void GfxPalette32::varyPause() {
_varyDirection = 0;
++_varyNumTimesPaused;
@@ -497,51 +397,44 @@ void GfxPalette32::varyOn() {
--_varyNumTimesPaused;
}
- if (_varyTargetPalette != nullptr && _varyNumTimesPaused == 0 && _varyPercent != _varyTargetPercent) {
- if (_varyTime == 0) {
- _varyPercent = _varyTargetPercent;
- } else if (_varyTargetPercent < _varyPercent) {
- _varyDirection = -1;
+ if (_varyTargetPalette != nullptr && _varyNumTimesPaused == 0) {
+ if (_varyPercent != _varyTargetPercent && _varyTime != 0) {
+ _varyDirection = (_varyTargetPercent - _varyPercent > 0) ? 1 : -1;
} else {
- _varyDirection = 1;
+ _varyPercent = _varyTargetPercent;
}
}
}
-void GfxPalette32::setVaryTime(const int time) {
- if (_varyTargetPalette == nullptr) {
- return;
- }
-
- setVaryTimeInternal(_varyTargetPercent, time);
+void GfxPalette32::setTarget(const Palette &palette) {
+ delete _varyTargetPalette;
+ _varyTargetPalette = new Palette(palette);
}
-void GfxPalette32::setTarget(const Palette *const palette) {
- if (_varyTargetPalette != nullptr) {
- delete _varyTargetPalette;
- }
-
- _varyTargetPalette = new Palette(*palette);
+void GfxPalette32::setStart(const Palette &palette) {
+ delete _varyStartPalette;
+ _varyStartPalette = new Palette(palette);
}
-void GfxPalette32::setStart(const Palette *const palette) {
+void GfxPalette32::mergeStart(const Palette &palette) {
if (_varyStartPalette != nullptr) {
- delete _varyStartPalette;
+ mergePalette(*_varyStartPalette, palette);
+ } else {
+ _varyStartPalette = new Palette(palette);
}
-
- _varyStartPalette = new Palette(*palette);
}
-void GfxPalette32::mergeStart(const Palette *const palette) {
- if (_varyStartPalette != nullptr) {
- mergePaletteInternal(_varyStartPalette, palette);
+void GfxPalette32::mergeTarget(const Palette &palette) {
+ if (_varyTargetPalette != nullptr) {
+ mergePalette(*_varyTargetPalette, palette);
} else {
- _varyStartPalette = new Palette(*palette);
+ _varyTargetPalette = new Palette(palette);
}
}
void GfxPalette32::applyVary() {
- while (g_sci->getTickCount() - _varyLastTick > (uint32)_varyTime && _varyDirection != 0) {
+ const uint32 now = g_sci->getTickCount();
+ while ((int32)(now - _varyLastTick) > _varyTime && _varyDirection != 0) {
_varyLastTick += _varyTime;
if (_varyPercent == _varyTargetPercent) {
@@ -552,7 +445,7 @@ void GfxPalette32::applyVary() {
}
if (_varyPercent == 0 || _varyTargetPalette == nullptr) {
- for (int i = 0, len = ARRAYSIZE(_nextPalette.colors); i < len; ++i) {
+ for (int i = 0; i < ARRAYSIZE(_nextPalette.colors); ++i) {
if (_varyStartPalette != nullptr && i >= _varyFromColor && i <= _varyToColor) {
_nextPalette.colors[i] = _varyStartPalette->colors[i];
} else {
@@ -560,7 +453,7 @@ void GfxPalette32::applyVary() {
}
}
} else {
- for (int i = 0, len = ARRAYSIZE(_nextPalette.colors); i < len; ++i) {
+ for (int i = 0; i < ARRAYSIZE(_nextPalette.colors); ++i) {
if (i >= _varyFromColor && i <= _varyToColor) {
Color targetColor = _varyTargetPalette->colors[i];
Color sourceColor;
@@ -591,82 +484,67 @@ void GfxPalette32::applyVary() {
}
}
-#pragma mark -
-#pragma mark Cycling
-
-inline void GfxPalette32::clearCycleMap(const uint16 fromColor, const uint16 numColorsToClear) {
- bool *mapEntry = _cycleMap + fromColor;
- const bool *lastEntry = _cycleMap + numColorsToClear;
- while (mapEntry < lastEntry) {
- *mapEntry++ = false;
- }
+void GfxPalette32::kernelPalVarySet(const GuiResourceId paletteId, const int16 percent, const int32 ticks, const int16 fromColor, const int16 toColor) {
+ const Palette palette = getPaletteFromResource(paletteId);
+ setVary(palette, percent, ticks, fromColor, toColor);
}
-inline void GfxPalette32::setCycleMap(const uint16 fromColor, const uint16 numColorsToSet) {
- bool *mapEntry = _cycleMap + fromColor;
- const bool *lastEntry = _cycleMap + numColorsToSet;
- while (mapEntry < lastEntry) {
- if (*mapEntry != false) {
- error("Cycles intersect");
- }
- *mapEntry++ = true;
- }
+void GfxPalette32::kernelPalVaryMergeTarget(const GuiResourceId paletteId) {
+ const Palette palette = getPaletteFromResource(paletteId);
+ mergeTarget(palette);
}
-inline PalCycler *GfxPalette32::getCycler(const uint16 fromColor) {
- const int numCyclers = ARRAYSIZE(_cyclers);
-
- for (int cyclerIndex = 0; cyclerIndex < numCyclers; ++cyclerIndex) {
- PalCycler *cycler = _cyclers[cyclerIndex];
- if (cycler != nullptr && cycler->fromColor == fromColor) {
- return cycler;
- }
- }
+void GfxPalette32::kernelPalVarySetTarget(const GuiResourceId paletteId) {
+ const Palette palette = getPaletteFromResource(paletteId);
+ setTarget(palette);
+}
- return nullptr;
+void GfxPalette32::kernelPalVarySetStart(const GuiResourceId paletteId) {
+ const Palette palette = getPaletteFromResource(paletteId);
+ setStart(palette);
}
-inline void doCycleInternal(PalCycler *cycler, const int16 speed) {
- int16 currentCycle = cycler->currentCycle;
- const uint16 numColorsToCycle = cycler->numColorsToCycle;
+void GfxPalette32::kernelPalVaryMergeStart(const GuiResourceId paletteId) {
+ const Palette palette = getPaletteFromResource(paletteId);
+ mergeStart(palette);
+}
- if (cycler->direction == 0) {
- currentCycle = (currentCycle - (speed % numColorsToCycle)) + numColorsToCycle;
+void GfxPalette32::kernelPalVaryPause(const bool pause) {
+ if (pause) {
+ varyPause();
} else {
- currentCycle = currentCycle + speed;
+ varyOn();
}
-
- cycler->currentCycle = (uint8) (currentCycle % numColorsToCycle);
}
+#pragma mark -
+#pragma mark Cycling
+
void GfxPalette32::setCycle(const uint8 fromColor, const uint8 toColor, const int16 direction, const int16 delay) {
assert(fromColor < toColor);
- int cyclerIndex;
- const int numCyclers = ARRAYSIZE(_cyclers);
-
PalCycler *cycler = getCycler(fromColor);
if (cycler != nullptr) {
clearCycleMap(fromColor, cycler->numColorsToCycle);
} else {
- for (cyclerIndex = 0; cyclerIndex < numCyclers; ++cyclerIndex) {
- if (_cyclers[cyclerIndex] == nullptr) {
- cycler = new PalCycler;
- _cyclers[cyclerIndex] = cycler;
+ for (int i = 0; i < kNumCyclers; ++i) {
+ if (_cyclers[i] == nullptr) {
+ _cyclers[i] = cycler = new PalCycler;
break;
}
}
}
- // SCI engine overrides the first oldest cycler that it finds where
- // “oldest” is determined by the difference between the tick and now
+ // If there are no free cycler slots, SCI engine overrides the first oldest
+ // cycler that it finds, where "oldest" is determined by the difference
+ // between the tick and now
if (cycler == nullptr) {
const uint32 now = g_sci->getTickCount();
uint32 minUpdateDelta = 0xFFFFFFFF;
- for (cyclerIndex = 0; cyclerIndex < numCyclers; ++cyclerIndex) {
- PalCycler *candidate = _cyclers[cyclerIndex];
+ for (int i = 0; i < kNumCyclers; ++i) {
+ PalCycler *const candidate = _cyclers[i];
const uint32 updateDelta = now - candidate->lastUpdateTick;
if (updateDelta < minUpdateDelta) {
@@ -678,11 +556,14 @@ void GfxPalette32::setCycle(const uint8 fromColor, const uint8 toColor, const in
clearCycleMap(cycler->fromColor, cycler->numColorsToCycle);
}
- const uint16 numColorsToCycle = 1 + ((uint8) toColor) - fromColor;
- cycler->fromColor = (uint8) fromColor;
- cycler->numColorsToCycle = (uint8) numColorsToCycle;
- cycler->currentCycle = (uint8) fromColor;
- cycler->direction = direction < 0 ? PalCycleBackward : PalCycleForward;
+ uint16 numColorsToCycle = toColor - fromColor;
+ if (getSciVersion() >= SCI_VERSION_2_1_MIDDLE || g_sci->getGameId() == GID_KQ7) {
+ numColorsToCycle += 1;
+ }
+ cycler->fromColor = fromColor;
+ cycler->numColorsToCycle = numColorsToCycle;
+ cycler->currentCycle = fromColor;
+ cycler->direction = direction < 0 ? kPalCycleBackward : kPalCycleForward;
cycler->delay = delay;
cycler->lastUpdateTick = g_sci->getTickCount();
cycler->numTimesPaused = 0;
@@ -691,30 +572,30 @@ void GfxPalette32::setCycle(const uint8 fromColor, const uint8 toColor, const in
}
void GfxPalette32::doCycle(const uint8 fromColor, const int16 speed) {
- PalCycler *cycler = getCycler(fromColor);
+ PalCycler *const cycler = getCycler(fromColor);
if (cycler != nullptr) {
cycler->lastUpdateTick = g_sci->getTickCount();
- doCycleInternal(cycler, speed);
+ updateCycler(*cycler, speed);
}
}
void GfxPalette32::cycleOn(const uint8 fromColor) {
- PalCycler *cycler = getCycler(fromColor);
+ PalCycler *const cycler = getCycler(fromColor);
if (cycler != nullptr && cycler->numTimesPaused > 0) {
--cycler->numTimesPaused;
}
}
void GfxPalette32::cyclePause(const uint8 fromColor) {
- PalCycler *cycler = getCycler(fromColor);
+ PalCycler *const cycler = getCycler(fromColor);
if (cycler != nullptr) {
++cycler->numTimesPaused;
}
}
void GfxPalette32::cycleAllOn() {
- for (int i = 0, len = ARRAYSIZE(_cyclers); i < len; ++i) {
- PalCycler *cycler = _cyclers[i];
+ for (int i = 0; i < kNumCyclers; ++i) {
+ PalCycler *const cycler = _cyclers[i];
if (cycler != nullptr && cycler->numTimesPaused > 0) {
--cycler->numTimesPaused;
}
@@ -724,8 +605,8 @@ void GfxPalette32::cycleAllOn() {
void GfxPalette32::cycleAllPause() {
// NOTE: The original engine did not check for null pointers in the
// palette cyclers pointer array.
- for (int i = 0, len = ARRAYSIZE(_cyclers); i < len; ++i) {
- PalCycler *cycler = _cyclers[i];
+ for (int i = 0; i < kNumCyclers; ++i) {
+ PalCycler *const cycler = _cyclers[i];
if (cycler != nullptr) {
// This seems odd, because currentCycle is 0..numColorsPerCycle,
// but fromColor is 0..255. When applyAllCycles runs, the values
@@ -736,8 +617,8 @@ void GfxPalette32::cycleAllPause() {
applyAllCycles();
- for (int i = 0, len = ARRAYSIZE(_cyclers); i < len; ++i) {
- PalCycler *cycler = _cyclers[i];
+ for (int i = 0; i < kNumCyclers; ++i) {
+ PalCycler *const cycler = _cyclers[i];
if (cycler != nullptr) {
++cycler->numTimesPaused;
}
@@ -745,8 +626,8 @@ void GfxPalette32::cycleAllPause() {
}
void GfxPalette32::cycleOff(const uint8 fromColor) {
- for (int i = 0, len = ARRAYSIZE(_cyclers); i < len; ++i) {
- PalCycler *cycler = _cyclers[i];
+ for (int i = 0; i < kNumCyclers; ++i) {
+ PalCycler *const cycler = _cyclers[i];
if (cycler != nullptr && cycler->fromColor == fromColor) {
clearCycleMap(fromColor, cycler->numColorsToCycle);
delete cycler;
@@ -757,8 +638,8 @@ void GfxPalette32::cycleOff(const uint8 fromColor) {
}
void GfxPalette32::cycleAllOff() {
- for (int i = 0, len = ARRAYSIZE(_cyclers); i < len; ++i) {
- PalCycler *cycler = _cyclers[i];
+ for (int i = 0; i < kNumCyclers; ++i) {
+ PalCycler *const cycler = _cyclers[i];
if (cycler != nullptr) {
clearCycleMap(cycler->fromColor, cycler->numColorsToCycle);
delete cycler;
@@ -767,16 +648,57 @@ void GfxPalette32::cycleAllOff() {
}
}
+void GfxPalette32::updateCycler(PalCycler &cycler, const int16 speed) {
+ int16 currentCycle = cycler.currentCycle;
+ const uint16 numColorsToCycle = cycler.numColorsToCycle;
+
+ if (cycler.direction == kPalCycleBackward) {
+ currentCycle = (currentCycle - (speed % numColorsToCycle)) + numColorsToCycle;
+ } else {
+ currentCycle = currentCycle + speed;
+ }
+
+ cycler.currentCycle = currentCycle % numColorsToCycle;
+}
+
+void GfxPalette32::clearCycleMap(const uint16 fromColor, const uint16 numColorsToClear) {
+ bool *mapEntry = _cycleMap + fromColor;
+ const bool *const lastEntry = _cycleMap + numColorsToClear;
+ while (mapEntry < lastEntry) {
+ *mapEntry++ = false;
+ }
+}
+
+void GfxPalette32::setCycleMap(const uint16 fromColor, const uint16 numColorsToSet) {
+ bool *mapEntry = _cycleMap + fromColor;
+ const bool *const lastEntry = _cycleMap + numColorsToSet;
+ while (mapEntry < lastEntry) {
+ if (*mapEntry != false) {
+ error("Cycles intersect");
+ }
+ *mapEntry++ = true;
+ }
+}
+
+PalCycler *GfxPalette32::getCycler(const uint16 fromColor) {
+ for (int cyclerIndex = 0; cyclerIndex < kNumCyclers; ++cyclerIndex) {
+ PalCycler *cycler = _cyclers[cyclerIndex];
+ if (cycler != nullptr && cycler->fromColor == fromColor) {
+ return cycler;
+ }
+ }
+
+ return nullptr;
+}
+
void GfxPalette32::applyAllCycles() {
Color paletteCopy[256];
memcpy(paletteCopy, _nextPalette.colors, sizeof(Color) * 256);
- for (int cyclerIndex = 0, numCyclers = ARRAYSIZE(_cyclers); cyclerIndex < numCyclers; ++cyclerIndex) {
- PalCycler *cycler = _cyclers[cyclerIndex];
+ for (int i = 0; i < kNumCyclers; ++i) {
+ PalCycler *const cycler = _cyclers[i];
if (cycler != nullptr) {
- cycler->currentCycle = (uint8) ((((int) cycler->currentCycle) + 1) % cycler->numColorsToCycle);
- // Disassembly was not fully evaluated to verify this is exactly the same
- // as the code from applyCycles, but it appeared to be at a glance
+ cycler->currentCycle = (((int) cycler->currentCycle) + 1) % cycler->numColorsToCycle;
for (int j = 0; j < cycler->numColorsToCycle; j++) {
_nextPalette.colors[cycler->fromColor + j] = paletteCopy[cycler->fromColor + (cycler->currentCycle + j) % cycler->numColorsToCycle];
}
@@ -788,15 +710,16 @@ void GfxPalette32::applyCycles() {
Color paletteCopy[256];
memcpy(paletteCopy, _nextPalette.colors, sizeof(Color) * 256);
- for (int i = 0, len = ARRAYSIZE(_cyclers); i < len; ++i) {
- PalCycler *cycler = _cyclers[i];
+ const uint32 now = g_sci->getTickCount();
+ for (int i = 0; i < kNumCyclers; ++i) {
+ PalCycler *const cycler = _cyclers[i];
if (cycler == nullptr) {
continue;
}
if (cycler->delay != 0 && cycler->numTimesPaused == 0) {
- while ((cycler->delay + cycler->lastUpdateTick) < g_sci->getTickCount()) {
- doCycleInternal(cycler, 1);
+ while ((cycler->delay + cycler->lastUpdateTick) < now) {
+ updateCycler(*cycler, 1);
cycler->lastUpdateTick += cycler->delay;
}
}
@@ -810,31 +733,31 @@ void GfxPalette32::applyCycles() {
#pragma mark -
#pragma mark Fading
-// NOTE: There are some game scripts (like SQ6 Sierra logo and main menu) that call
-// setFade with numColorsToFade set to 256, but other parts of the engine like
-// processShowStyleNone use 255 instead of 256. It is not clear if this is because
-// the last palette entry is intentionally left unmodified, or if this is a bug
-// in the engine. It certainly seems confused because all other places that accept
-// color ranges typically receive values in the range of 0–255.
-void GfxPalette32::setFade(uint16 percent, uint8 fromColor, uint16 numColorsToFade) {
- if (fromColor > numColorsToFade) {
+void GfxPalette32::setFade(const uint16 percent, const uint8 fromColor, uint16 toColor) {
+ if (fromColor > toColor) {
return;
}
- assert(numColorsToFade <= ARRAYSIZE(_fadeTable));
+ // Some game scripts (like SQ6 Sierra logo and main menu) incorrectly call
+ // setFade with toColor set to 256
+ if (toColor > 255) {
+ toColor = 255;
+ }
- for (int i = fromColor; i < numColorsToFade; i++)
+ for (int i = fromColor; i <= toColor; i++) {
_fadeTable[i] = percent;
+ }
}
void GfxPalette32::fadeOff() {
- setFade(100, 0, 256);
+ setFade(100, 0, 255);
}
void GfxPalette32::applyFade() {
for (int i = 0; i < ARRAYSIZE(_fadeTable); ++i) {
- if (_fadeTable[i] == 100)
+ if (_fadeTable[i] == 100) {
continue;
+ }
Color &color = _nextPalette.colors[i];
diff --git a/engines/sci/graphics/palette32.h b/engines/sci/graphics/palette32.h
index dc2158022f..81e9bbbfd3 100644
--- a/engines/sci/graphics/palette32.h
+++ b/engines/sci/graphics/palette32.h
@@ -24,30 +24,33 @@
#define SCI_GRAPHICS_PALETTE32_H
#include "sci/graphics/palette.h"
-
namespace Sci {
+#pragma mark HunkPalette
+
/**
- * HunkPalette represents a raw palette resource
- * read from disk.
+ * HunkPalette represents a raw palette resource read from disk. The data
+ * structure of a HunkPalette allows palettes to be smaller than 256 colors. It
+ * also allows multiple palettes to be stored in one HunkPalette, though in
+ * SCI32 games there seems to only ever be one palette per HunkPalette.
*/
class HunkPalette {
public:
HunkPalette(byte *rawPalette);
/**
- * Gets the version of the palette.
+ * Gets the version of the palette. Used to avoid resubmitting a HunkPalette
+ * which has already been submitted for the next frame.
*/
uint32 getVersion() const { return _version; }
/**
* Sets the version of the palette.
*/
- void setVersion(const uint32 version);
+ void setVersion(const uint32 version) const;
/**
- * Converts the hunk palette to a standard
- * palette.
+ * Converts the hunk palette to a standard Palette.
*/
const Palette toPalette() const;
@@ -64,15 +67,14 @@ private:
kEntryHeaderSize = 22,
/**
- * The offset of the hunk palette version
- * within the palette entry header.
+ * The offset of the hunk palette version within the palette entry
+ * header.
*/
kEntryVersionOffset = 18
};
/**
- * The header for a palette inside the
- * HunkPalette.
+ * The header for a palette inside the HunkPalette.
*/
struct EntryHeader {
/**
@@ -81,8 +83,7 @@ private:
uint8 startColor;
/**
- * The number of palette colors in this
- * entry.
+ * The number of palette colors in this entry.
*/
uint16 numColors;
@@ -92,8 +93,7 @@ private:
bool used;
/**
- * Whether or not all palette entries
- * share the same `used` value in
+ * Whether or not all palette entries share the same `used` value in
* `defaultFlag`.
*/
bool sharedUsed;
@@ -105,14 +105,14 @@ private:
};
/**
- * The version number from the last time this
- * palette was submitted to GfxPalette32.
+ * The version number from the last time this palette was submitted to
+ * GfxPalette32.
*/
- uint32 _version;
+ mutable uint32 _version;
/**
- * The number of palettes stored in the hunk
- * palette. In SCI32 games this is always 1.
+ * The number of palettes stored in the hunk palette. In SCI32 games this is
+ * always 1.
*/
uint8 _numPalettes;
@@ -122,41 +122,44 @@ private:
byte *_data;
/**
- * Returns a struct that describes the palette
- * held by this HunkPalette. The entry header
- * is reconstructed on every call from the raw
- * palette data.
+ * Returns a struct that describes the palette held by this HunkPalette. The
+ * entry header is reconstructed on every call from the raw palette data.
*/
const EntryHeader getEntryHeader() const;
/**
- * Returns a pointer to the palette data within
- * the hunk palette.
+ * Returns a pointer to the palette data within the hunk palette.
*/
byte *getPalPointer() const {
return _data + kHunkPaletteHeaderSize + (2 * _numPalettes);
}
};
+#pragma mark -
+#pragma mark PalCycler
+
enum PalCyclerDirection {
- PalCycleBackward = 0,
- PalCycleForward = 1
+ kPalCycleBackward = 0,
+ kPalCycleForward = 1
};
+/**
+ * PalCycler represents a range of palette entries that are rotated on a timer.
+ */
struct PalCycler {
/**
- * The color index of the palette cycler. This value is effectively used as the ID for the
- * cycler.
+ * The color index of this palette cycler. This value is used as the unique
+ * key for this PalCycler object.
*/
uint8 fromColor;
/**
- * The number of palette slots which are cycled by the palette cycler.
+ * The number of palette slots which are to be cycled by this cycler.
*/
uint16 numColorsToCycle;
/**
- * The position of the cursor in its cycle.
+ * The current position of the first palette entry.
*/
uint8 currentCycle;
@@ -166,15 +169,15 @@ struct PalCycler {
PalCyclerDirection direction;
/**
- * The cycle tick at the last time the cycler’s currentCycle was updated.
- * 795 days of game time ought to be enough for everyone? :)
+ * The last tick the cycler cycled.
*/
uint32 lastUpdateTick;
/**
- * The amount of time in ticks each cycle should take to complete. In other words,
- * the higher the delay, the slower the cycle animation. If delay is 0, the cycler
- * does not automatically cycle and needs to be pumped manually with DoCycle.
+ * The amount of time in ticks each cycle should take to complete. In other
+ * words, the higher the delay, the slower the cycle animation. If delay is
+ * 0, the cycler does not automatically cycle and needs to be cycled
+ * manually by calling `doCycle`.
*/
int16 delay;
@@ -184,17 +187,72 @@ struct PalCycler {
uint16 numTimesPaused;
};
+#pragma mark -
+#pragma mark GfxPalette32
+
class GfxPalette32 {
public:
GfxPalette32(ResourceManager *resMan);
~GfxPalette32();
+ void saveLoadWithSerializer(Common::Serializer &s);
+
+ /**
+ * Gets the palette that will be use for the next frame.
+ */
+ inline const Palette &getNextPalette() const { return _nextPalette; };
+
+ /**
+ * Gets the palette that is used for the current frame.
+ */
+ inline const Palette &getCurrentPalette() const { return _currentPalette; };
+
+ /**
+ * Loads a palette into GfxPalette32 with the given resource ID.
+ */
+ bool loadPalette(const GuiResourceId resourceId);
+
+ /**
+ * Finds the nearest color in the current palette matching the given RGB
+ * value.
+ */
+ int16 matchColor(const uint8 r, const uint8 g, const uint8 b);
+
+ /**
+ * Submits a palette to display. Entries marked as "used" in the submitted
+ * palette are merged into `_sourcePalette`.
+ */
+ void submit(const Palette &palette);
+ void submit(const HunkPalette &palette);
+
+ /**
+ * Applies all fades, cycles, remaps, and varies for the current frame to
+ * `nextPalette`.
+ */
+ bool updateForFrame();
+
+ /**
+ * Copies all palette entries from `sourcePalette` to `nextPalette` and
+ * applies remaps. Unlike `updateForFrame`, this call does not apply fades,
+ * cycles, or varies.
+ */
+ void updateFFrame();
+
+ /**
+ * Copies all entries from `nextPalette` to `currentPalette` and updates the
+ * backend's raw palette.
+ *
+ * @param updateScreen If true, this call will also tell the backend to draw
+ * to the screen.
+ */
+ void updateHardware(const bool updateScreen = true);
+
private:
ResourceManager *_resMan;
/**
- * The palette revision version. Increments once per game
- * loop that changes the source palette.
+ * The palette revision version. Increments once per game loop that changes
+ * the source palette.
*/
uint32 _version;
@@ -209,90 +267,140 @@ private:
Palette _currentPalette;
/**
- * The unmodified source palette loaded by kPalette. Additional
- * palette entries may be mixed into the source palette by
- * CelObj objects, which contain their own palettes.
+ * The unmodified source palette loaded by kPalette. Additional palette
+ * entries may be mixed into the source palette by CelObj objects, which
+ * contain their own palettes.
*/
Palette _sourcePalette;
/**
* The palette to be used when the hardware is next updated.
- * On update, _nextPalette is transferred to _currentPalette.
+ * On update, `_nextPalette` is transferred to `_currentPalette`.
*/
Palette _nextPalette;
- bool createPaletteFromResourceInternal(const GuiResourceId paletteId, Palette *const out) const;
- Palette getPaletteFromResourceInternal(const GuiResourceId paletteId) const;
+ /**
+ * Creates and returns a new Palette object with data from the given
+ * resource ID.
+ */
+ Palette getPaletteFromResource(const GuiResourceId paletteId) const;
+
+ /**
+ * Merges used colors in the `from` palette into the `to` palette.
+ */
+ void mergePalette(Palette &to, const Palette &from);
+
+ /**
+ * Applies all varies, cycles, and fades to `_nextPalette`.
+ */
+ void applyAll();
+#pragma mark -
+#pragma mark Varying
public:
- void saveLoadWithSerializer(Common::Serializer &s);
- inline const Palette &getNextPalette() const { return _nextPalette; };
- inline const Palette &getCurrentPalette() const { return _currentPalette; };
+ /**
+ * Blends the `target` palette into the current palette over `time` ticks.
+ *
+ * @param target The target palette.
+ * @param percent The amount that the target palette should be blended into
+ * the source palette by the end of the vary.
+ * @param ticks The number of ticks that it should take for the blend to be
+ * completed.
+ * @param fromColor The first palette entry that should be blended.
+ * @param toColor The last palette entry that should be blended.
+ */
+ void setVary(const Palette &target, const int16 percent, const int32 ticks, const int16 fromColor, const int16 toColor);
/**
- * Loads a palette into GfxPalette32 with the given resource
- * ID.
+ * Gets the current vary blend amount.
*/
- bool loadPalette(const GuiResourceId resourceId);
+ inline int16 getVaryPercent() const { return ABS(_varyPercent); }
/**
- * Finds the nearest color in the current palette matching the
- * given RGB value.
+ * Changes the percentage of the current vary to `percent`, to be completed
+ * over `time` ticks, if there is a currently active vary target palette.
*/
- int16 matchColor(const uint8 r, const uint8 g, const uint8 b);
+ void setVaryPercent(const int16 percent, const int32 time);
/**
- * Submits a palette to display. Entries marked as “used” in the
- * submitted palette are merged into the existing entries of
- * _sourcePalette.
+ * Changes the amount of time, in ticks, an in-progress palette vary should
+ * take to finish.
*/
- void submit(const Palette &palette);
- void submit(HunkPalette &palette);
+ void setVaryTime(const int32 ticks);
- bool updateForFrame();
- void updateFFrame();
- void updateHardware(const bool updateScreen = true);
- void applyAll();
+ /**
+ * Changes the vary percent and time to perform the vary.
+ */
+ void setVaryTime(const int16 percent, const int32 ticks);
-#pragma mark -
-#pragma mark Color look-up
-private:
/**
- * An optional lookup table used to remap RGB565 colors to a palette
- * index. Used by Phantasmagoria 2 in 8-bit color environments.
+ * Removes the active palette vary.
*/
- byte *_clutTable;
+ void varyOff();
-public:
- bool loadClut(uint16 clutId);
- byte matchClutColor(uint16 color);
- void unloadClut();
+ /**
+ * Pauses any active palette vary.
+ */
+ void varyPause();
+
+ /**
+ * Unpauses any paused palette vary.
+ */
+ void varyOn();
+
+ /**
+ * Sets the target palette for the blend.
+ */
+ void setTarget(const Palette &palette);
+
+ /**
+ * Sets the start palette for the blend.
+ */
+ void setStart(const Palette &palette);
+
+ /**
+ * Merges a new start palette into the existing start palette.
+ */
+ void mergeStart(const Palette &palette);
+
+ /**
+ * Merges a new target palette into the existing target palette.
+ */
+ void mergeTarget(const Palette &palette);
+
+ /**
+ * Applies any active palette vary to `_nextPalette`.
+ */
+ void applyVary();
+
+ void kernelPalVarySet(const GuiResourceId paletteId, const int16 percent, const int32 ticks, const int16 fromColor, const int16 toColor);
+ void kernelPalVaryMergeTarget(const GuiResourceId paletteId);
+ void kernelPalVarySetTarget(const GuiResourceId paletteId);
+ void kernelPalVarySetStart(const GuiResourceId paletteId);
+ void kernelPalVaryMergeStart(const GuiResourceId paletteId);
+ void kernelPalVaryPause(const bool pause);
-#pragma mark -
-#pragma mark Varying
private:
/**
- * An optional palette used to describe the source colors used
- * in a palette vary operation. If this palette is not specified,
- * sourcePalette is used instead.
+ * An optional palette used to provide source colors for a palette vary
+ * operation. If this palette is not specified, `_sourcePalette` is used
+ * instead.
*/
Palette *_varyStartPalette;
/**
- * An optional palette used to describe the target colors used
- * in a palette vary operation.
+ * An optional palette used to provide target colors for a palette vary
+ * operation.
*/
Palette *_varyTargetPalette;
/**
- * The minimum palette index that has been varied from the
- * source palette. 0–255
+ * The minimum palette index that has been varied from the source palette.
*/
uint8 _varyFromColor;
/**
- * The maximum palette index that is has been varied from the
- * source palette. 0-255
+ * The maximum palette index that has been varied from the source palette.
*/
uint8 _varyToColor;
@@ -302,10 +410,10 @@ private:
uint32 _varyLastTick;
/**
- * The amount of time to elapse, in ticks, between each cycle
- * of a palette vary animation.
+ * The amount of time that should elapse, in ticks, between each cycle of a
+ * palette vary animation.
*/
- int _varyTime;
+ int32 _varyTime;
/**
* The direction of change: -1, 0, or 1.
@@ -313,97 +421,158 @@ private:
int16 _varyDirection;
/**
- * The amount, in percent, that the vary color is currently
- * blended into the source color.
+ * The amount, in percent, that the vary color is currently blended into the
+ * source color.
*/
int16 _varyPercent;
/**
- * The target amount that a vary color will be blended into
- * the source color.
+ * The target amount that a vary color will be blended into the source
+ * color.
*/
int16 _varyTargetPercent;
/**
- * The number of time palette varying has been paused.
+ * The number of times palette varying has been paused.
*/
uint16 _varyNumTimesPaused;
-public:
- void kernelPalVarySet(const GuiResourceId paletteId, const int16 percent, const int time, const int16 fromColor, const int16 toColor);
- void kernelPalVaryMergeTarget(const GuiResourceId paletteId);
- void kernelPalVarySetTarget(const GuiResourceId paletteId);
- void kernelPalVarySetStart(const GuiResourceId paletteId);
- void kernelPalVaryMergeStart(const GuiResourceId paletteId);
- void kernelPalVaryPause(bool pause);
-
- void setVary(const Palette *const targetPalette, const int16 percent, const int time, const int16 fromColor, const int16 toColor);
- void setVaryPercent(const int16 percent, const int time, const int16 fromColor, const int16 fromColorAlternate);
- int16 getVaryPercent() const;
- void varyOff();
- void mergeTarget(const Palette *const palette);
- void varyPause();
- void varyOn();
- void setVaryTime(const int time);
- void setTarget(const Palette *const palette);
- void setStart(const Palette *const palette);
- void mergeStart(const Palette *const palette);
- void setVaryTimeInternal(const int16 percent, const int time);
- void applyVary();
-
#pragma mark -
#pragma mark Cycling
-private:
- // SQ6 defines 10 cyclers
- PalCycler *_cyclers[10];
+public:
+ inline const bool *getCycleMap() const { return _cycleMap; }
/**
- * The cycle map is used to detect overlapping cyclers.
- * According to SCI engine code, when two cyclers overlap,
- * a fatal error has occurred and the engine will display
- * an error and then exit.
+ * Cycle palette entries between `fromColor` and `toColor`, inclusive.
+ * Palette cyclers may not overlap. `fromColor` is used in other methods as
+ * the key for looking up a cycler.
*
- * The cycle map is also by the color remapping system to
- * avoid attempting to remap to palette entries that are
- * cycling (so won't be the expected color once the cycler
- * runs again).
+ * @param fromColor The first color in the cycle.
+ * @param toColor The last color in the cycle.
+ * @param delay The number of ticks that should elapse between cycles.
+ * @param direction A negative `direction` will cycle backwards instead of
+ * forwards. The numeric value of this argument is ignored;
+ * only its sign is used to determine direction.
*/
- bool _cycleMap[256];
- inline void clearCycleMap(uint16 fromColor, uint16 numColorsToClear);
- inline void setCycleMap(uint16 fromColor, uint16 numColorsToClear);
- inline PalCycler *getCycler(uint16 fromColor);
-
-public:
void setCycle(const uint8 fromColor, const uint8 toColor, const int16 direction, const int16 delay);
+
+ /**
+ * Performs a round of palette cycling.
+ *
+ * @param fromColor The color key for the cycler.
+ * @param speed The number of entries that should be cycled this round.
+ */
void doCycle(const uint8 fromColor, const int16 speed);
+
+ /**
+ * Unpauses the cycler starting at `fromColor`.
+ */
void cycleOn(const uint8 fromColor);
+
+ /**
+ * Pauses the cycler starting at `fromColor`.
+ */
void cyclePause(const uint8 fromColor);
+
+ /**
+ * Unpauses all cyclers.
+ */
void cycleAllOn();
+
+ /**
+ * Pauses all cyclers.
+ */
void cycleAllPause();
+
+ /**
+ * Removes the cycler starting at `fromColor`.
+ */
void cycleOff(const uint8 fromColor);
+
+ /**
+ * Removes all cyclers.
+ */
void cycleAllOff();
+
+private:
+ enum {
+ kNumCyclers = 10
+ };
+
+ PalCycler *_cyclers[kNumCyclers];
+
+ /**
+ * Updates the `currentCycle` of the given `cycler` by `speed` entries.
+ */
+ void updateCycler(PalCycler &cycler, const int16 speed);
+
+ /**
+ * The cycle map is used to detect overlapping cyclers, and to avoid
+ * remapping to palette entries that are being cycled.
+ *
+ * According to SCI engine code, when two cyclers overlap, a fatal error has
+ * occurred and the engine will display an error and then exit.
+ *
+ * The color remapping system avoids attempts to remap to palette entries
+ * that are cycling because they won't be the expected color once the cycler
+ * updates the palette entries.
+ */
+ bool _cycleMap[256];
+
+ /**
+ * Marks `numColorsToClear` colors starting at `fromColor` in the cycle
+ * map as inactive.
+ */
+ void clearCycleMap(const uint16 fromColor, const uint16 numColorsToClear);
+
+ /**
+ * Marks `numColorsToClear` colors starting at `fromColor` in the cycle
+ * map as active.
+ */
+ void setCycleMap(const uint16 fromColor, const uint16 numColorsToClear);
+
+ /**
+ * Gets the cycler object that starts at the given `fromColor`, or NULL if
+ * there is no cycler for that color.
+ */
+ PalCycler *getCycler(const uint16 fromColor);
+
+ /**
+ * Advances all cyclers by one step, regardless of whether or not it is time
+ * to perform another cycle.
+ */
void applyAllCycles();
+
+ /**
+ * Advances, by one step, only the cyclers whose time has come to cycle.
+ */
void applyCycles();
- inline const bool *getCycleMap() const { return _cycleMap; }
#pragma mark -
#pragma mark Fading
-private:
+public:
/**
- * The fade table records the expected intensity level of each pixel
- * in the palette that will be displayed on the next frame.
+ * Sets the intensity level for a range of palette entries. An intensity of
+ * zero indicates total darkness. Intensity may also be set above 100
+ * percent to increase the intensity of a palette entry.
*/
- uint16 _fadeTable[256];
+ void setFade(const uint16 percent, const uint8 fromColor, const uint16 toColor);
-public:
/**
- * Sets the intensity level for a range of palette
- * entries. An intensity of zero indicates total
- * darkness. Intensity may be set to over 100 percent.
+ * Resets the intensity of all palette entries to 100%.
*/
- void setFade(const uint16 percent, const uint8 fromColor, const uint16 toColor);
void fadeOff();
+
+ /**
+ * Applies intensity values to the palette entries in `_nextPalette`.
+ */
void applyFade();
+
+private:
+ /**
+ * The intensity levels of each palette entry, in percent. Defaults to 100.
+ */
+ uint16 _fadeTable[256];
};
} // End of namespace Sci
diff --git a/engines/sci/graphics/picture.cpp b/engines/sci/graphics/picture.cpp
index 0025b24476..75a885da57 100644
--- a/engines/sci/graphics/picture.cpp
+++ b/engines/sci/graphics/picture.cpp
@@ -1004,14 +1004,14 @@ void GfxPicture::vectorFloodFill(int16 x, int16 y, byte color, byte priority, by
int16 borderRight = curPort->rect.right + curPort->left - 1;
int16 borderBottom = curPort->rect.bottom + curPort->top - 1;
int16 curToLeft, curToRight, a_set, b_set;
-
+
// Translate coordinates, if required (needed for Macintosh 480x300)
_screen->vectorAdjustCoordinate(&borderLeft, &borderTop);
_screen->vectorAdjustCoordinate(&borderRight, &borderBottom);
//return;
stack.push(p);
-
+
while (stack.size()) {
p = stack.pop();
if ((matchedMask = _screen->vectorIsFillMatch(p.x, p.y, matchMask, searchColor, searchPriority, searchControl, isEGA)) == 0) // already filled
@@ -1239,7 +1239,7 @@ void GfxPicture::vectorPatternTexturedCircle(Common::Rect box, byte size, byte c
byte bitNo = 0;
const bool *textureData = &vectorPatternTextures[vectorPatternTextureOffset[texture]];
int y, x;
-
+
for (y = box.top; y < box.bottom; y++) {
for (x = box.left; x < box.right; x++) {
if (bitmap & 1) {
diff --git a/engines/sci/graphics/plane32.cpp b/engines/sci/graphics/plane32.cpp
index 1cd88d667b..e7da8b815d 100644
--- a/engines/sci/graphics/plane32.cpp
+++ b/engines/sci/graphics/plane32.cpp
@@ -527,14 +527,8 @@ void Plane::decrementScreenItemArrayCounts(Plane *visiblePlane, const bool force
if (item != nullptr) {
// update item in visiblePlane if item is updated
- if (
- item->_updated ||
- (
- forceUpdate &&
- visiblePlane != nullptr &&
- visiblePlane->_screenItemList.findByObject(item->_object) != nullptr
- )
- ) {
+ if (visiblePlane != nullptr && (
+ item->_updated || (forceUpdate && visiblePlane->_screenItemList.findByObject(item->_object) != nullptr))) {
*visiblePlane->_screenItemList[i] = *item;
}
diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp
index 601ab9f09f..23e92ef6a9 100644
--- a/engines/sci/graphics/screen.cpp
+++ b/engines/sci/graphics/screen.cpp
@@ -37,7 +37,7 @@ GfxScreen::GfxScreen(ResourceManager *resMan) : _resMan(resMan) {
// Scale the screen, if needed
_upscaledHires = GFX_SCREEN_UPSCALED_DISABLED;
-
+
// we default to scripts running at 320x200
_scriptWidth = 320;
_scriptHeight = 200;
@@ -45,7 +45,7 @@ GfxScreen::GfxScreen(ResourceManager *resMan) : _resMan(resMan) {
_height = 0;
_displayWidth = 0;
_displayHeight = 0;
-
+
// King's Quest 6 and Gabriel Knight 1 have hires content, gk1/cd was able
// to provide that under DOS as well, but as gk1/floppy does support
// upscaled hires scriptswise, but doesn't actually have the hires content
@@ -58,7 +58,7 @@ GfxScreen::GfxScreen(ResourceManager *resMan) : _resMan(resMan) {
// Japanese versions of games use hi-res font on upscaled version of the game.
if ((g_sci->getLanguage() == Common::JA_JPN) && (getSciVersion() <= SCI_VERSION_1_1))
_upscaledHires = GFX_SCREEN_UPSCALED_640x400;
-
+
// Macintosh SCI0 games used 480x300, while the scripts were running at 320x200
if (g_sci->getPlatform() == Common::kPlatformMacintosh) {
if (getSciVersion() <= SCI_VERSION_01) {
@@ -66,7 +66,7 @@ GfxScreen::GfxScreen(ResourceManager *resMan) : _resMan(resMan) {
_width = 480;
_height = 300; // regular visual, priority and control map are 480x300 (this is different than other upscaled SCI games)
}
-
+
// Some Mac SCI1/1.1 games only take up 190 rows and do not
// have the menu bar.
// TODO: Verify that LSL1 and LSL5 use height 190
@@ -145,7 +145,7 @@ GfxScreen::GfxScreen(ResourceManager *resMan) : _resMan(resMan) {
}
_displayPixels = _displayWidth * _displayHeight;
-
+
// Allocate visual, priority, control and display screen
_visualScreen = (byte *)calloc(_pixels, 1);
_priorityScreen = (byte *)calloc(_pixels, 1);
@@ -314,7 +314,7 @@ void GfxScreen::vectorAdjustLineCoordinates(int16 *left, int16 *top, int16 *righ
void GfxScreen::vectorPutLinePixel(int16 x, int16 y, byte drawMask, byte color, byte priority, byte control) {
if (_upscaledHires == GFX_SCREEN_UPSCALED_480x300) {
vectorPutLinePixel480x300(x, y, drawMask, color, priority, control);
- return;
+ return;
}
// For anything else forward to the regular putPixel
@@ -628,7 +628,7 @@ void GfxScreen::dither(bool addToFlag) {
byte color, ditheredColor;
byte *visualPtr = _visualScreen;
byte *displayPtr = _displayScreen;
-
+
if (!_unditheringEnabled) {
// Do dithering on visual and display-screen
for (y = 0; y < _height; y++) {
diff --git a/engines/sci/graphics/screen.h b/engines/sci/graphics/screen.h
index 65416252f6..63ee4ed09e 100644
--- a/engines/sci/graphics/screen.h
+++ b/engines/sci/graphics/screen.h
@@ -289,7 +289,7 @@ public:
default:
break;
}
-
+
// For non-upscaled mode and 480x300 Mac put pixels directly
int offset = y * _width + x;
diff --git a/engines/sci/graphics/screen_item32.cpp b/engines/sci/graphics/screen_item32.cpp
index f4ed269265..9b0d390cc3 100644
--- a/engines/sci/graphics/screen_item32.cpp
+++ b/engines/sci/graphics/screen_item32.cpp
@@ -263,33 +263,30 @@ void ScreenItem::calcRects(const Plane &plane) {
}
Ratio scaleX, scaleY;
-
- if (_scale.signal & kScaleSignalDoScaling32) {
- if (_scale.signal & kScaleSignalUseVanishingPoint) {
- int num = _scale.max * (_position.y - plane._vanishingPoint.y) / (scriptWidth - plane._vanishingPoint.y);
- scaleX = Ratio(num, 128);
- scaleY = Ratio(num, 128);
- } else {
- scaleX = Ratio(_scale.x, 128);
- scaleY = Ratio(_scale.y, 128);
- }
+ if (_scale.signal == kScaleSignalManual) {
+ scaleX = Ratio(_scale.x, 128);
+ scaleY = Ratio(_scale.y, 128);
+ } else if (_scale.signal == kScaleSignalVanishingPoint) {
+ int num = _scale.max * (_position.y - plane._vanishingPoint.y) / (scriptWidth - plane._vanishingPoint.y);
+ scaleX = Ratio(num, 128);
+ scaleY = Ratio(num, 128);
}
if (scaleX.getNumerator() && scaleY.getNumerator()) {
_screenItemRect = _insetRect;
- const Ratio celToScreenX(screenWidth, celObj._scaledWidth);
- const Ratio celToScreenY(screenHeight, celObj._scaledHeight);
+ const Ratio celToScreenX(screenWidth, celObj._xResolution);
+ const Ratio celToScreenY(screenHeight, celObj._yResolution);
// Cel may use a coordinate system that is not the same size as the
// script coordinate system (usually this means high-resolution
// pictures with low-resolution scripts)
- if (celObj._scaledWidth != kLowResX || celObj._scaledHeight != kLowResY) {
+ if (celObj._xResolution != kLowResX || celObj._yResolution != kLowResY) {
// high resolution coordinates
if (_useInsetRect) {
- const Ratio scriptToCelX(celObj._scaledWidth, scriptWidth);
- const Ratio scriptToCelY(celObj._scaledHeight, scriptHeight);
+ const Ratio scriptToCelX(celObj._xResolution, scriptWidth);
+ const Ratio scriptToCelY(celObj._yResolution, scriptHeight);
mulru(_screenItemRect, scriptToCelX, scriptToCelY, 0);
if (_screenItemRect.intersects(celRect)) {
@@ -299,11 +296,11 @@ void ScreenItem::calcRects(const Plane &plane) {
}
}
- int displaceX = celObj._displace.x;
- int displaceY = celObj._displace.y;
+ int originX = celObj._origin.x;
+ int originY = celObj._origin.y;
if (_mirrorX != celObj._mirrorX && _celInfo.type != kCelTypePic) {
- displaceX = celObj._width - celObj._displace.x - 1;
+ originX = celObj._width - celObj._origin.x - 1;
}
if (!scaleX.isOne() || !scaleY.isOne()) {
@@ -331,13 +328,13 @@ void ScreenItem::calcRects(const Plane &plane) {
}
}
- displaceX = (displaceX * scaleX).toInt();
- displaceY = (displaceY * scaleY).toInt();
+ originX = (originX * scaleX).toInt();
+ originY = (originY * scaleY).toInt();
}
mulinc(_screenItemRect, celToScreenX, celToScreenY);
- displaceX = (displaceX * celToScreenX).toInt();
- displaceY = (displaceY * celToScreenY).toInt();
+ originX = (originX * celToScreenX).toInt();
+ originY = (originY * celToScreenY).toInt();
const Ratio scriptToScreenX = Ratio(screenWidth, scriptWidth);
const Ratio scriptToScreenY = Ratio(screenHeight, scriptHeight);
@@ -346,8 +343,8 @@ void ScreenItem::calcRects(const Plane &plane) {
_scaledPosition.x = _position.x;
_scaledPosition.y = _position.y;
} else {
- _scaledPosition.x = (_position.x * scriptToScreenX).toInt() - displaceX;
- _scaledPosition.y = (_position.y * scriptToScreenY).toInt() - displaceY;
+ _scaledPosition.x = (_position.x * scriptToScreenX).toInt() - originX;
+ _scaledPosition.y = (_position.y * scriptToScreenY).toInt() - originY;
}
_screenItemRect.translate(_scaledPosition.x, _scaledPosition.y);
@@ -365,7 +362,7 @@ void ScreenItem::calcRects(const Plane &plane) {
if (celObjPic == nullptr) {
error("Expected a CelObjPic");
}
- temp.translate((celObjPic->_relativePosition.x * scriptToScreenX).toInt() - displaceX, 0);
+ temp.translate((celObjPic->_relativePosition.x * scriptToScreenX).toInt() - originX, 0);
// TODO: This is weird.
int deltaX = plane._planeRect.width() - temp.right - 1 - temp.left;
@@ -383,9 +380,9 @@ void ScreenItem::calcRects(const Plane &plane) {
} else {
// low resolution coordinates
- int displaceX = celObj._displace.x;
+ int originX = celObj._origin.x;
if (_mirrorX != celObj._mirrorX && _celInfo.type != kCelTypePic) {
- displaceX = celObj._width - celObj._displace.x - 1;
+ originX = celObj._width - celObj._origin.x - 1;
}
if (!scaleX.isOne() || !scaleY.isOne()) {
@@ -397,8 +394,8 @@ void ScreenItem::calcRects(const Plane &plane) {
_screenItemRect.bottom -= 1;
}
- _scaledPosition.x = _position.x - (displaceX * scaleX).toInt();
- _scaledPosition.y = _position.y - (celObj._displace.y * scaleY).toInt();
+ _scaledPosition.x = _position.x - (originX * scaleX).toInt();
+ _scaledPosition.y = _position.y - (celObj._origin.y * scaleY).toInt();
_screenItemRect.translate(_scaledPosition.x, _scaledPosition.y);
if (_mirrorX != celObj._mirrorX && _celInfo.type == kCelTypePic) {
@@ -413,7 +410,7 @@ void ScreenItem::calcRects(const Plane &plane) {
if (celObjPic == nullptr) {
error("Expected a CelObjPic");
}
- temp.translate(celObjPic->_relativePosition.x - (displaceX * scaleX).toInt(), celObjPic->_relativePosition.y - (celObj._displace.y * scaleY).toInt());
+ temp.translate(celObjPic->_relativePosition.x - (originX * scaleX).toInt(), celObjPic->_relativePosition.y - (celObj._origin.y * scaleY).toInt());
// TODO: This is weird.
int deltaX = plane._gameRect.width() - temp.right - 1 - temp.left;
@@ -426,7 +423,7 @@ void ScreenItem::calcRects(const Plane &plane) {
_scaledPosition.y += plane._gameRect.top;
_screenItemRect.translate(plane._gameRect.left, plane._gameRect.top);
- if (celObj._scaledWidth != screenWidth || celObj._scaledHeight != screenHeight) {
+ if (celObj._xResolution != screenWidth || celObj._yResolution != screenHeight) {
mulru(_scaledPosition, celToScreenX, celToScreenY);
mulru(_screenItemRect, celToScreenX, celToScreenY, 1);
}
@@ -520,11 +517,11 @@ void ScreenItem::printDebugInfo(Console *con) const {
_celInfo.color
);
if (_celObj != nullptr) {
- con->debugPrintf(" width %d, height %d, scaledWidth %d, scaledHeight %d\n",
+ con->debugPrintf(" width %d, height %d, x-resolution %d, y-resolution %d\n",
_celObj->_width,
_celObj->_height,
- _celObj->_scaledWidth,
- _celObj->_scaledHeight
+ _celObj->_xResolution,
+ _celObj->_yResolution
);
}
}
@@ -593,34 +590,32 @@ Common::Rect ScreenItem::getNowSeenRect(const Plane &plane) const {
const uint16 scriptHeight = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight;
Ratio scaleX, scaleY;
- if (_scale.signal & kScaleSignalDoScaling32) {
- if (_scale.signal & kScaleSignalUseVanishingPoint) {
- int num = _scale.max * (_position.y - plane._vanishingPoint.y) / (scriptWidth - plane._vanishingPoint.y);
- scaleX = Ratio(num, 128);
- scaleY = Ratio(num, 128);
- } else {
- scaleX = Ratio(_scale.x, 128);
- scaleY = Ratio(_scale.y, 128);
- }
+ if (_scale.signal == kScaleSignalManual) {
+ scaleX = Ratio(_scale.x, 128);
+ scaleY = Ratio(_scale.y, 128);
+ } else if (_scale.signal == kScaleSignalVanishingPoint) {
+ int num = _scale.max * (_position.y - plane._vanishingPoint.y) / (scriptWidth - plane._vanishingPoint.y);
+ scaleX = Ratio(num, 128);
+ scaleY = Ratio(num, 128);
}
if (scaleX.getNumerator() == 0 || scaleY.getNumerator() == 0) {
return Common::Rect();
}
- int16 displaceX = celObj._displace.x;
- int16 displaceY = celObj._displace.y;
+ int16 originX = celObj._origin.x;
+ int16 originY = celObj._origin.y;
if (_mirrorX != celObj._mirrorX && _celInfo.type != kCelTypePic) {
- displaceX = celObj._width - displaceX - 1;
+ originX = celObj._width - originX - 1;
}
- if (celObj._scaledWidth != kLowResX || celObj._scaledHeight != kLowResY) {
+ if (celObj._xResolution != kLowResX || celObj._yResolution != kLowResY) {
// high resolution coordinates
if (_useInsetRect) {
- Ratio scriptToCelX(celObj._scaledWidth, scriptWidth);
- Ratio scriptToCelY(celObj._scaledHeight, scriptHeight);
+ Ratio scriptToCelX(celObj._xResolution, scriptWidth);
+ Ratio scriptToCelY(celObj._yResolution, scriptHeight);
mulru(nsRect, scriptToCelX, scriptToCelY, 0);
if (nsRect.intersects(celObjRect)) {
@@ -661,14 +656,14 @@ Common::Rect ScreenItem::getNowSeenRect(const Plane &plane) const {
}
}
- Ratio celToScriptX(scriptWidth, celObj._scaledWidth);
- Ratio celToScriptY(scriptHeight, celObj._scaledHeight);
+ Ratio celToScriptX(scriptWidth, celObj._xResolution);
+ Ratio celToScriptY(scriptHeight, celObj._yResolution);
- displaceX = (displaceX * scaleX * celToScriptX).toInt();
- displaceY = (displaceY * scaleY * celToScriptY).toInt();
+ originX = (originX * scaleX * celToScriptX).toInt();
+ originY = (originY * scaleY * celToScriptY).toInt();
mulinc(nsRect, celToScriptX, celToScriptY);
- nsRect.translate(_position.x - displaceX, _position.y - displaceY);
+ nsRect.translate(_position.x - originX, _position.y - originY);
} else {
// low resolution coordinates
@@ -681,9 +676,9 @@ Common::Rect ScreenItem::getNowSeenRect(const Plane &plane) const {
nsRect.bottom -= 1;
}
- displaceX = (displaceX * scaleX).toInt();
- displaceY = (displaceY * scaleY).toInt();
- nsRect.translate(_position.x - displaceX, _position.y - displaceY);
+ originX = (originX * scaleX).toInt();
+ originY = (originY * scaleY).toInt();
+ nsRect.translate(_position.x - originX, _position.y - originY);
if (_mirrorX != celObj._mirrorX && _celInfo.type != kCelTypePic) {
nsRect.translate(plane._gameRect.width() - nsRect.width(), 0);
diff --git a/engines/sci/graphics/screen_item32.h b/engines/sci/graphics/screen_item32.h
index 4221c0ea52..009b608f18 100644
--- a/engines/sci/graphics/screen_item32.h
+++ b/engines/sci/graphics/screen_item32.h
@@ -30,13 +30,9 @@
namespace Sci {
enum ScaleSignals32 {
- kScaleSignalNone = 0,
- // TODO: rename to 'manual'
- kScaleSignalDoScaling32 = 1, // enables scaling when drawing that cel (involves scaleX and scaleY)
- kScaleSignalUseVanishingPoint = 2,
- // TODO: Is this actually a thing? I have not seen it and
- // the original engine masks &3 where it uses scale signals.
- kScaleSignalDisableGlobalScaling32 = 4
+ kScaleSignalNone = 0,
+ kScaleSignalManual = 1,
+ kScaleSignalVanishingPoint = 2
};
struct ScaleInfo {
diff --git a/engines/sci/graphics/text16.cpp b/engines/sci/graphics/text16.cpp
index cb6e614657..b5dd9aee0b 100644
--- a/engines/sci/graphics/text16.cpp
+++ b/engines/sci/graphics/text16.cpp
@@ -83,7 +83,7 @@ void GfxText16::ClearChar(int16 chr) {
}
// This internal function gets called as soon as a '|' is found in a text. It
-// will process the encountered code and set new font/set color.
+// will process the encountered code and set new font/set color.
// Returns textcode character count.
int16 GfxText16::CodeProcessing(const char *&text, GuiResourceId orgFontId, int16 orgPenColor, bool doingDrawing) {
const char *textCode = text;
@@ -179,7 +179,7 @@ static const uint16 text16_shiftJIS_punctuation_SCI01[] = {
// return max # of chars to fit maxwidth with full words, does not include
// breaking space
// Also adjusts text pointer to the new position for the caller
-//
+//
// Special cases in games:
// Laura Bow 2 - Credits in the game menu - all the text lines start with spaces (bug #5159)
// Act 6 Coroner questionaire - the text of all control buttons has trailing spaces
@@ -245,7 +245,7 @@ int16 GfxText16::GetLongest(const char *&textPtr, int16 maxWidth, GuiResourceId
break;
}
tempWidth += _font->getCharWidth(curChar);
-
+
// Width is too large? -> break out
if (tempWidth > maxWidth)
break;
diff --git a/engines/sci/graphics/text16.h b/engines/sci/graphics/text16.h
index 2724d97347..eb39fb2513 100644
--- a/engines/sci/graphics/text16.h
+++ b/engines/sci/graphics/text16.h
@@ -64,7 +64,7 @@ public:
void Box(const char *text, bool show, const Common::Rect &rect, TextAlignment alignment, GuiResourceId fontId) {
Box(text, 0, show, rect, alignment, fontId);
}
-
+
void DrawString(const char *text);
void DrawStatus(const char *text);
diff --git a/engines/sci/graphics/text32.cpp b/engines/sci/graphics/text32.cpp
index 11572581ff..d142ff75c3 100644
--- a/engines/sci/graphics/text32.cpp
+++ b/engines/sci/graphics/text32.cpp
@@ -39,8 +39,8 @@
namespace Sci {
int16 GfxText32::_defaultFontId = 0;
-int16 GfxText32::_scaledWidth = 0;
-int16 GfxText32::_scaledHeight = 0;
+int16 GfxText32::_xResolution = 0;
+int16 GfxText32::_yResolution = 0;
GfxText32::GfxText32(SegManager *segMan, GfxCache *fonts) :
_segMan(segMan),
@@ -52,10 +52,10 @@ GfxText32::GfxText32(SegManager *segMan, GfxCache *fonts) :
_fontId = _defaultFontId;
_font = _cache->getFont(_defaultFontId);
- if (_scaledWidth == 0) {
+ if (_xResolution == 0) {
// initialize the statics
- _scaledWidth = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth;
- _scaledHeight = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight;
+ _xResolution = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth;
+ _yResolution = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight;
}
}
@@ -78,8 +78,8 @@ reg_t GfxText32::createFontBitmap(int16 width, int16 height, const Common::Rect
int16 scriptWidth = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth;
int16 scriptHeight = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight;
- Ratio scaleX(_scaledWidth, scriptWidth);
- Ratio scaleY(_scaledHeight, scriptHeight);
+ Ratio scaleX(_xResolution, scriptWidth);
+ Ratio scaleY(_yResolution, scriptHeight);
_width = (_width * scaleX).toInt();
_height = (_height * scaleY).toInt();
@@ -96,7 +96,7 @@ reg_t GfxText32::createFontBitmap(int16 width, int16 height, const Common::Rect
_textRect = Common::Rect();
}
- _segMan->allocateBitmap(&_bitmap, _width, _height, _skipColor, 0, 0, _scaledWidth, _scaledHeight, 0, false, gc);
+ _segMan->allocateBitmap(&_bitmap, _width, _height, _skipColor, 0, 0, _xResolution, _yResolution, 0, false, gc);
erase(bitmapRect, false);
@@ -120,12 +120,12 @@ reg_t GfxText32::createFontBitmap(const CelInfo32 &celInfo, const Common::Rect &
int16 scriptWidth = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth;
int16 scriptHeight = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight;
- mulinc(_textRect, Ratio(_scaledWidth, scriptWidth), Ratio(_scaledHeight, scriptHeight));
+ mulinc(_textRect, Ratio(_xResolution, scriptWidth), Ratio(_yResolution, scriptHeight));
CelObjView view(celInfo.resourceId, celInfo.loopNo, celInfo.celNo);
- _skipColor = view._transparentColor;
- _width = view._width * _scaledWidth / view._scaledWidth;
- _height = view._height * _scaledHeight / view._scaledHeight;
+ _skipColor = view._skipColor;
+ _width = view._width * _xResolution / view._xResolution;
+ _height = view._height * _yResolution / view._yResolution;
Common::Rect bitmapRect(_width, _height);
if (_textRect.intersects(bitmapRect)) {
@@ -134,7 +134,7 @@ reg_t GfxText32::createFontBitmap(const CelInfo32 &celInfo, const Common::Rect &
_textRect = Common::Rect();
}
- SciBitmap &bitmap = *_segMan->allocateBitmap(&_bitmap, _width, _height, _skipColor, 0, 0, _scaledWidth, _scaledHeight, 0, false, gc);
+ SciBitmap &bitmap = *_segMan->allocateBitmap(&_bitmap, _width, _height, _skipColor, 0, 0, _xResolution, _yResolution, 0, false, gc);
// NOTE: The engine filled the bitmap pixels with 11 here, which is silly
// because then it just erased the bitmap using the skip color. So we don't
@@ -144,7 +144,7 @@ reg_t GfxText32::createFontBitmap(const CelInfo32 &celInfo, const Common::Rect &
erase(bitmapRect, false);
_backColor = backColor;
- view.draw(bitmap.getBuffer(), bitmapRect, Common::Point(0, 0), false, Ratio(_scaledWidth, view._scaledWidth), Ratio(_scaledHeight, view._scaledHeight));
+ view.draw(bitmap.getBuffer(), bitmapRect, Common::Point(0, 0), false, Ratio(_xResolution, view._xResolution), Ratio(_yResolution, view._yResolution));
if (_backColor != skipColor && _foreColor != skipColor) {
erase(_textRect, false);
@@ -183,13 +183,15 @@ void GfxText32::drawFrame(const Common::Rect &rect, const int16 size, const uint
// NOTE: Not fully disassembled, but this should be right
int16 rectWidth = targetRect.width();
- int16 sidesHeight = targetRect.height() - size * 2;
+ int16 heightRemaining = targetRect.height();
+ int16 sidesHeight = heightRemaining - size * 2;
int16 centerWidth = rectWidth - size * 2;
int16 stride = _width - rectWidth;
- for (int16 y = 0; y < size; ++y) {
+ for (int16 y = 0; y < size && y < heightRemaining; ++y) {
memset(pixels, color, rectWidth);
pixels += _width;
+ --heightRemaining;
}
for (int16 y = 0; y < sidesHeight; ++y) {
for (int16 x = 0; x < size; ++x) {
@@ -201,9 +203,10 @@ void GfxText32::drawFrame(const Common::Rect &rect, const int16 size, const uint
}
pixels += stride;
}
- for (int16 y = 0; y < size; ++y) {
+ for (int16 y = 0; y < size && y < heightRemaining; ++y) {
memset(pixels, color, rectWidth);
pixels += _width;
+ --heightRemaining;
}
}
@@ -329,7 +332,7 @@ void GfxText32::drawText(const uint index, uint length) {
void GfxText32::invertRect(const reg_t bitmapId, int16 bitmapStride, const Common::Rect &rect, const uint8 foreColor, const uint8 backColor, const bool doScaling) {
Common::Rect targetRect = rect;
if (doScaling) {
- bitmapStride = bitmapStride * _scaledWidth / g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth;
+ bitmapStride = bitmapStride * _xResolution / g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth;
targetRect = scaleRect(rect);
}
@@ -554,13 +557,13 @@ Common::Rect GfxText32::getTextSize(const Common::String &text, int16 maxWidth,
int16 scriptWidth = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth;
int16 scriptHeight = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight;
- maxWidth = maxWidth * _scaledWidth / scriptWidth;
+ maxWidth = maxWidth * _xResolution / scriptWidth;
_text = text;
if (maxWidth >= 0) {
if (maxWidth == 0) {
- maxWidth = _scaledWidth * 3 / 5;
+ maxWidth = _xResolution * 3 / 5;
}
result.right = maxWidth;
@@ -603,8 +606,8 @@ Common::Rect GfxText32::getTextSize(const Common::String &text, int16 maxWidth,
if (doScaling) {
// NOTE: The original engine code also scaled top/left but these are
// always zero so there is no reason to do that.
- result.right = ((result.right - 1) * scriptWidth + _scaledWidth - 1) / _scaledWidth + 1;
- result.bottom = ((result.bottom - 1) * scriptHeight + _scaledHeight - 1) / _scaledHeight + 1;
+ result.right = ((result.right - 1) * scriptWidth + _xResolution - 1) / _xResolution + 1;
+ result.bottom = ((result.bottom - 1) * scriptHeight + _yResolution - 1) / _yResolution + 1;
}
return result;
@@ -627,7 +630,7 @@ int16 GfxText32::getTextCount(const Common::String &text, const uint index, cons
Common::Rect scaledRect(textRect);
if (doScaling) {
- mulinc(scaledRect, Ratio(_scaledWidth, scriptWidth), Ratio(_scaledHeight, scriptHeight));
+ mulinc(scaledRect, Ratio(_xResolution, scriptWidth), Ratio(_yResolution, scriptHeight));
}
Common::String oldText = _text;
diff --git a/engines/sci/graphics/text32.h b/engines/sci/graphics/text32.h
index 44bd48afd5..c4521a4f56 100644
--- a/engines/sci/graphics/text32.h
+++ b/engines/sci/graphics/text32.h
@@ -151,8 +151,8 @@ private:
Common::Rect scaledRect(rect);
int16 scriptWidth = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth;
int16 scriptHeight = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight;
- Ratio scaleX(_scaledWidth, scriptWidth);
- Ratio scaleY(_scaledHeight, scriptHeight);
+ Ratio scaleX(_xResolution, scriptWidth);
+ Ratio scaleY(_yResolution, scriptHeight);
mulinc(scaledRect, scaleX, scaleY);
return scaledRect;
}
@@ -169,13 +169,13 @@ public:
* The size of the x-dimension of the coordinate system
* used by the text renderer. Static since it was global in SSCI.
*/
- static int16 _scaledWidth;
+ static int16 _xResolution;
/**
* The size of the y-dimension of the coordinate system
* used by the text renderer. Static since it was global in SSCI.
*/
- static int16 _scaledHeight;
+ static int16 _yResolution;
/**
* The currently active font resource used to write text
@@ -199,12 +199,12 @@ public:
inline int scaleUpWidth(int value) const {
const int scriptWidth = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth;
- return (value * scriptWidth + _scaledWidth - 1) / _scaledWidth;
+ return (value * scriptWidth + _xResolution - 1) / _xResolution;
}
inline int scaleUpHeight(int value) const {
const int scriptHeight = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight;
- return (value * scriptHeight + _scaledHeight - 1) / _scaledHeight;
+ return (value * scriptHeight + _yResolution - 1) / _yResolution;
}
/**
diff --git a/engines/sci/graphics/transitions32.cpp b/engines/sci/graphics/transitions32.cpp
index 37f608da85..ee230f50a8 100644
--- a/engines/sci/graphics/transitions32.cpp
+++ b/engines/sci/graphics/transitions32.cpp
@@ -20,6 +20,7 @@
*
*/
+#include "sci/console.h"
#include "sci/engine/segment.h"
#include "sci/engine/seg_manager.h"
#include "sci/engine/state.h"
@@ -118,6 +119,7 @@ void GfxTransitions32::processShowStyles() {
if (doFrameOut) {
g_sci->_gfxFrameout->frameOut(true);
+ g_sci->getSciDebugger()->onFrame();
throttle();
}
} while(continueProcessing && doFrameOut);
@@ -233,92 +235,98 @@ void GfxTransitions32::kernelSetShowStyle(const uint16 argc, const reg_t planeOb
}
}
- if (type > 0) {
- if (createNewEntry) {
- entry = new PlaneShowStyle;
- // NOTE: SCI2.1 engine tests if allocation returned a null pointer
- // but then only avoids setting currentStep if this is so. Since
- // this is a nonsensical approach, we do not do that here
- entry->currentStep = 0;
- entry->processed = false;
- entry->divisions = hasDivisions ? divisions : _defaultDivisions[type];
- entry->plane = planeObj;
- entry->fadeColorRangesCount = 0;
-
- if (getSciVersion() < SCI_VERSION_2_1_MIDDLE) {
- // for pixel dissolve
- entry->bitmap = NULL_REG;
- entry->bitmapScreenItem = nullptr;
-
- // for wipe
- entry->screenItems.clear();
- entry->width = plane->_gameRect.width();
- entry->height = plane->_gameRect.height();
- } else {
- entry->fadeColorRanges = nullptr;
- if (hasFadeArray) {
- // NOTE: SCI2.1mid engine does no check to verify that an array is
- // successfully retrieved, and SegMan will cause a fatal error
- // if we try to use a memory segment that is not an array
- SciArray<reg_t> *table = _segMan->lookupArray(pFadeArray);
-
- uint32 rangeCount = table->getSize();
- entry->fadeColorRangesCount = rangeCount;
-
- // NOTE: SCI engine code always allocates memory even if the range
- // table has no entries, but this does not really make sense, so
- // we avoid the allocation call in this case
- if (rangeCount > 0) {
- entry->fadeColorRanges = new uint16[rangeCount];
- for (size_t i = 0; i < rangeCount; ++i) {
- entry->fadeColorRanges[i] = table->getValue(i).toUint16();
- }
+ if (type == kShowStyleNone) {
+ if (createNewEntry == false) {
+ deleteShowStyle(findIteratorForPlane(planeObj));
+ }
+
+ return;
+ }
+
+ if (createNewEntry) {
+ entry = new PlaneShowStyle;
+ // NOTE: SCI2.1 engine tests if allocation returned a null pointer
+ // but then only avoids setting currentStep if this is so. Since
+ // this is a nonsensical approach, we do not do that here
+ entry->currentStep = 0;
+ entry->processed = false;
+ entry->divisions = hasDivisions ? divisions : _defaultDivisions[type];
+ entry->plane = planeObj;
+ entry->fadeColorRangesCount = 0;
+
+ if (getSciVersion() < SCI_VERSION_2_1_MIDDLE) {
+ // for pixel dissolve
+ entry->bitmap = NULL_REG;
+ entry->bitmapScreenItem = nullptr;
+
+ // for wipe
+ entry->screenItems.clear();
+ entry->width = plane->_gameRect.width();
+ entry->height = plane->_gameRect.height();
+ } else {
+ entry->fadeColorRanges = nullptr;
+ if (hasFadeArray) {
+ // NOTE: SCI2.1mid engine does no check to verify that an array is
+ // successfully retrieved, and SegMan will cause a fatal error
+ // if we try to use a memory segment that is not an array
+ SciArray &table = *_segMan->lookupArray(pFadeArray);
+
+ uint32 rangeCount = table.size();
+ entry->fadeColorRangesCount = rangeCount;
+
+ // NOTE: SCI engine code always allocates memory even if the range
+ // table has no entries, but this does not really make sense, so
+ // we avoid the allocation call in this case
+ if (rangeCount > 0) {
+ entry->fadeColorRanges = new uint16[rangeCount];
+ for (size_t i = 0; i < rangeCount; ++i) {
+ entry->fadeColorRanges[i] = table.getAsInt16(i);
}
}
}
}
+ }
- // NOTE: The original engine had no nullptr check and would just crash
- // if it got to here
- if (entry == nullptr) {
- error("Cannot edit non-existing ShowStyle entry");
- }
+ // NOTE: The original engine had no nullptr check and would just crash
+ // if it got to here
+ if (entry == nullptr) {
+ error("Cannot edit non-existing ShowStyle entry");
+ }
- entry->fadeUp = isFadeUp;
- entry->color = color;
- entry->nextTick = g_sci->getTickCount();
- entry->type = type;
- entry->animate = animate;
- entry->delay = (seconds * 60 + entry->divisions - 1) / entry->divisions;
+ entry->fadeUp = isFadeUp;
+ entry->color = color;
+ entry->nextTick = g_sci->getTickCount();
+ entry->type = type;
+ entry->animate = animate;
+ entry->delay = (seconds * 60 + entry->divisions - 1) / entry->divisions;
- if (entry->delay == 0) {
- error("ShowStyle has no duration");
- }
+ if (entry->delay == 0) {
+ error("ShowStyle has no duration");
+ }
- if (frameOutNow) {
- // Creates a reference frame for the pixel dissolves to use
- g_sci->_gfxFrameout->frameOut(false);
- }
+ if (frameOutNow) {
+ // Creates a reference frame for the pixel dissolves to use
+ g_sci->_gfxFrameout->frameOut(false);
+ }
- if (createNewEntry) {
- if (getSciVersion() <= SCI_VERSION_2_1_EARLY) {
- switch (entry->type) {
- case kShowStyleIrisOut:
- case kShowStyleIrisIn:
- configure21EarlyIris(*entry, priority);
- break;
- case kShowStyleDissolve:
- configure21EarlyDissolve(*entry, priority, plane->_gameRect);
- break;
- default:
- // do nothing
- break;
- }
+ if (createNewEntry) {
+ if (getSciVersion() <= SCI_VERSION_2_1_EARLY) {
+ switch (entry->type) {
+ case kShowStyleIrisOut:
+ case kShowStyleIrisIn:
+ configure21EarlyIris(*entry, priority);
+ break;
+ case kShowStyleDissolve:
+ configure21EarlyDissolve(*entry, priority, plane->_gameRect);
+ break;
+ default:
+ // do nothing
+ break;
}
-
- _showStyles.push_back(*entry);
- delete entry;
}
+
+ _showStyles.push_back(*entry);
+ delete entry;
}
}
@@ -940,8 +948,9 @@ void GfxTransitions32::kernelSetScroll(const reg_t planeId, const int16 deltaX,
g_sci->_gfxFrameout->frameOut(true);
throttle();
}
- delete scroll;
}
+
+ delete scroll;
}
bool GfxTransitions32::processScroll(PlaneScroll &scroll) {
@@ -953,7 +962,7 @@ bool GfxTransitions32::processScroll(PlaneScroll &scroll) {
int deltaX = scroll.deltaX;
int deltaY = scroll.deltaY;
- if (((scroll.x + deltaX) * scroll.y) <= 0) {
+ if (((scroll.x + deltaX) * scroll.x) <= 0) {
deltaX = -scroll.x;
}
if (((scroll.y + deltaY) * scroll.y) <= 0) {
@@ -965,6 +974,10 @@ bool GfxTransitions32::processScroll(PlaneScroll &scroll) {
Plane *plane = g_sci->_gfxFrameout->getPlanes().findByObject(scroll.plane);
+ if (plane == nullptr) {
+ error("[GfxTransitions32::processScroll]: Plane %04x:%04x not found", PRINT_REG(scroll.plane));
+ }
+
if ((scroll.x == 0) && (scroll.y == 0)) {
plane->deletePic(scroll.oldPictureId, scroll.newPictureId);
finished = true;
diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp
index 8b1d4ef32b..1db66644c8 100644
--- a/engines/sci/graphics/video32.cpp
+++ b/engines/sci/graphics/video32.cpp
@@ -58,7 +58,10 @@ SEQPlayer::SEQPlayer(SegManager *segMan) :
void SEQPlayer::play(const Common::String &fileName, const int16 numTicks, const int16 x, const int16 y) {
delete _decoder;
_decoder = new SEQDecoder(numTicks);
- _decoder->loadFile(fileName);
+ if (!_decoder->loadFile(fileName)) {
+ warning("[SEQPlayer::play]: Failed to load %s", fileName.c_str());
+ return;
+ }
// NOTE: In the original engine, video was output directly to the hardware,
// bypassing the game's rendering engine. Instead of doing this, we use a
@@ -86,9 +89,8 @@ void SEQPlayer::play(const Common::String &fileName, const int16 numTicks, const
_decoder->start();
while (!g_engine->shouldQuit() && !_decoder->endOfVideo()) {
+ g_sci->sleep(_decoder->getTimeToNextFrame());
renderFrame();
- g_sci->getEngineState()->speedThrottler(_decoder->getTimeToNextFrame());
- g_sci->getEngineState()->_throttleTrigger = true;
}
_segMan->freeBitmap(_screenItem->_celInfo.bitmap);
@@ -119,8 +121,8 @@ void SEQPlayer::renderFrame() const {
}
g_sci->_gfxFrameout->updateScreenItem(*_screenItem);
- g_sci->getSciDebugger()->onFrame();
g_sci->_gfxFrameout->frameOut(true);
+ g_sci->getSciDebugger()->onFrame();
}
#pragma mark -
@@ -311,9 +313,8 @@ AVIPlayer::IOStatus AVIPlayer::play(const int16 from, const int16 to, const int1
void AVIPlayer::renderVideo() const {
_decoder->start();
while (!g_engine->shouldQuit() && !_decoder->endOfVideo()) {
- g_sci->getEngineState()->speedThrottler(_decoder->getTimeToNextFrame());
- g_sci->getEngineState()->_throttleTrigger = true;
- if (_decoder->needsUpdate()) {
+ g_sci->sleep(_decoder->getTimeToNextFrame());
+ while (_decoder->needsUpdate()) {
renderFrame();
}
}
@@ -408,8 +409,8 @@ void AVIPlayer::renderFrame() const {
}
g_sci->_gfxFrameout->updateScreenItem(*_screenItem);
- g_sci->getSciDebugger()->onFrame();
g_sci->_gfxFrameout->frameOut(true);
+ g_sci->getSciDebugger()->onFrame();
} else {
assert(surface->format.bytesPerPixel == 4);
@@ -457,9 +458,8 @@ AVIPlayer::EventFlags AVIPlayer::playUntilEvent(EventFlags flags) {
break;
}
- g_sci->getEngineState()->speedThrottler(_decoder->getTimeToNextFrame());
- g_sci->getEngineState()->_throttleTrigger = true;
- if (_decoder->needsUpdate()) {
+ g_sci->sleep(_decoder->getTimeToNextFrame());
+ while (_decoder->needsUpdate()) {
renderFrame();
}
@@ -485,13 +485,6 @@ AVIPlayer::EventFlags AVIPlayer::playUntilEvent(EventFlags flags) {
break;
}
}
-
- // TODO: Hot rectangles
- if ((flags & kEventFlagHotRectangle) /* && event.type == SCI_EVENT_HOT_RECTANGLE */) {
- warning("Hot rectangles not implemented in VMD player");
- stopFlag = kEventFlagHotRectangle;
- break;
- }
}
return stopFlag;
@@ -635,7 +628,7 @@ VMDPlayer::EventFlags VMDPlayer::kernelPlayUntilEvent(const EventFlags flags, co
const int32 maxFrameNo = (int32)(_decoder->getFrameCount() - 1);
if ((flags & kEventFlagToFrame) && lastFrameNo > 0) {
- _decoder->setEndFrame(MIN((int32)lastFrameNo, maxFrameNo));
+ _decoder->setEndFrame(MIN<int32>(lastFrameNo, maxFrameNo));
} else {
_decoder->setEndFrame(maxFrameNo);
}
@@ -645,7 +638,7 @@ VMDPlayer::EventFlags VMDPlayer::kernelPlayUntilEvent(const EventFlags flags, co
if (yieldInterval == -1 && !(flags & kEventFlagToFrame)) {
_yieldInterval = lastFrameNo;
} else if (yieldInterval != -1) {
- _yieldInterval = MIN((int32)yieldInterval, maxFrameNo);
+ _yieldInterval = MIN<int32>(yieldInterval, maxFrameNo);
}
} else {
_yieldInterval = maxFrameNo;
@@ -655,11 +648,11 @@ VMDPlayer::EventFlags VMDPlayer::kernelPlayUntilEvent(const EventFlags flags, co
}
VMDPlayer::EventFlags VMDPlayer::playUntilEvent(const EventFlags flags) {
- // Flushing all the keyboard and mouse events out of the event manager to
- // avoid letting any events queued from before the video started from
- // accidentally activating an event callback
+ // Flushing all the keyboard and mouse events out of the event manager
+ // keeps events queued from before the start of playback from accidentally
+ // activating a video stop flag
for (;;) {
- const SciEvent event = _eventMan->getSciEvent(SCI_EVENT_KEYBOARD | SCI_EVENT_MOUSE_PRESS | SCI_EVENT_MOUSE_RELEASE | SCI_EVENT_QUIT);
+ const SciEvent event = _eventMan->getSciEvent(SCI_EVENT_KEYBOARD | SCI_EVENT_MOUSE_PRESS | SCI_EVENT_MOUSE_RELEASE | SCI_EVENT_HOT_RECTANGLE | SCI_EVENT_QUIT);
if (event.type == SCI_EVENT_NONE) {
break;
} else if (event.type == SCI_EVENT_QUIT) {
@@ -667,8 +660,6 @@ VMDPlayer::EventFlags VMDPlayer::playUntilEvent(const EventFlags flags) {
}
}
- _decoder->pauseVideo(false);
-
if (flags & kEventFlagReverse) {
// NOTE: This flag may not work properly since SSCI does not care
// if a video has audio, but the VMD decoder does.
@@ -698,12 +689,12 @@ VMDPlayer::EventFlags VMDPlayer::playUntilEvent(const EventFlags flags) {
if (_doublePixels) {
vmdScaleInfo.x = 256;
vmdScaleInfo.y = 256;
- vmdScaleInfo.signal = kScaleSignalDoScaling32;
+ vmdScaleInfo.signal = kScaleSignalManual;
vmdRect.right += vmdRect.width();
vmdRect.bottom += vmdRect.height();
} else if (_stretchVertical) {
vmdScaleInfo.y = 256;
- vmdScaleInfo.signal = kScaleSignalDoScaling32;
+ vmdScaleInfo.signal = kScaleSignalManual;
vmdRect.bottom += vmdRect.height();
}
@@ -748,6 +739,14 @@ VMDPlayer::EventFlags VMDPlayer::playUntilEvent(const EventFlags flags) {
g_sci->_gfxFrameout->addScreenItem(*_screenItem);
+ // HACK: When VMD playback is allowed to yield back to the VM, this
+ // causes the VMD decoder to freak out for some reason and video output
+ // starts jittering horribly. This problem does not happen if audio sync
+ // is disabled, but this causes some audible clicking between frames
+ // of audio (and, presumably, will cause some AV sync problems). Still,
+ // that's better than really bad jitter.
+ _decoder->setAudioSync(!(flags & kEventFlagYieldToVM));
+
_decoder->start();
}
@@ -758,9 +757,11 @@ VMDPlayer::EventFlags VMDPlayer::playUntilEvent(const EventFlags flags) {
break;
}
- g_sci->getEngineState()->speedThrottler(_decoder->getTimeToNextFrame());
- g_sci->getEngineState()->_throttleTrigger = true;
- if (_decoder->needsUpdate()) {
+ // Sleeping any more than 1/60th of a second will make the mouse feel
+ // very sluggish during VMD action sequences because the frame rate of
+ // VMDs is usually only 15fps
+ g_sci->sleep(MIN<uint32>(10, _decoder->getTimeToNextFrame()));
+ while (_decoder->needsUpdate()) {
renderFrame();
}
@@ -802,15 +803,13 @@ VMDPlayer::EventFlags VMDPlayer::playUntilEvent(const EventFlags flags) {
}
}
- // TODO: Hot rectangles
- if ((flags & kEventFlagHotRectangle) /* && event.type == SCI_EVENT_HOT_RECTANGLE */) {
- warning("Hot rectangles not implemented in VMD player");
+ event = _eventMan->getSciEvent(SCI_EVENT_HOT_RECTANGLE | SCI_EVENT_PEEK);
+ if ((flags & kEventFlagHotRectangle) && event.type == SCI_EVENT_HOT_RECTANGLE) {
stopFlag = kEventFlagHotRectangle;
break;
}
}
- _decoder->pauseVideo(true);
return stopFlag;
}
@@ -857,9 +856,8 @@ void VMDPlayer::renderFrame() const {
}
} else {
g_sci->_gfxFrameout->updateScreenItem(*_screenItem);
- g_sci->getSciDebugger()->onFrame();
g_sci->_gfxFrameout->frameOut(true);
- g_sci->_gfxFrameout->throttle();
+ g_sci->getSciDebugger()->onFrame();
}
}
@@ -891,7 +889,7 @@ void VMDPlayer::restrictPalette(const uint8 startColor, const int16 endColor) {
// At least GK2 sends 256 as the end color, which is wrong,
// but works in the original engine as the storage size is 4 bytes
// and used values are clamped to 0-255
- _endColor = MIN((int16)255, endColor);
+ _endColor = MIN<int16>(255, endColor);
}
} // End of namespace Sci
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 2e69932e49..8826b0625a 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -159,7 +159,7 @@ static const ResourceType s_resTypeMapSci21[] = {
kResourceTypeView, kResourceTypePic, kResourceTypeScript, kResourceTypeAnimation, // 0x00-0x03
kResourceTypeSound, kResourceTypeEtc, kResourceTypeVocab, kResourceTypeFont, // 0x04-0x07
kResourceTypeCursor, kResourceTypePatch, kResourceTypeBitmap, kResourceTypePalette, // 0x08-0x0B
- kResourceTypeInvalid, kResourceTypeAudio, kResourceTypeSync, kResourceTypeMessage, // 0x0C-0x0F
+ kResourceTypeAudio, kResourceTypeAudio, kResourceTypeSync, kResourceTypeMessage, // 0x0C-0x0F
kResourceTypeMap, kResourceTypeHeap, kResourceTypeChunk, kResourceTypeAudio36, // 0x10-0x13
kResourceTypeSync36, kResourceTypeTranslation, kResourceTypeRobot, kResourceTypeVMD, // 0x14-0x17
kResourceTypeDuck, kResourceTypeClut, kResourceTypeTGA, kResourceTypeZZZ // 0x18-0x1B
@@ -948,7 +948,7 @@ void ResourceManager::init() {
// cache, leading to constant decompression of picture resources
// and making the renderer very slow.
if (getSciVersion() >= SCI_VERSION_2) {
- _maxMemoryLRU = 2048 * 1024; // 2MiB
+ _maxMemoryLRU = 4096 * 1024; // 4MiB
}
switch (_viewType) {
diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp
index cbc4a02739..4b3a13c490 100644
--- a/engines/sci/resource_audio.cpp
+++ b/engines/sci/resource_audio.cpp
@@ -965,6 +965,10 @@ bool ResourceManager::addAudioSources() {
}
void ResourceManager::changeAudioDirectory(Common::String path) {
+ // TODO: This implementation is broken.
+ return;
+
+#if 0
// Remove all of the audio map resource sources, as well as the audio resource sources
for (Common::List<ResourceSource *>::iterator it = _sources.begin(); it != _sources.end();) {
ResourceSource *source = *it;
@@ -1007,6 +1011,7 @@ void ResourceManager::changeAudioDirectory(Common::String path) {
// Rescan the newly added resources
scanNewSources();
+#endif
}
} // End of namespace Sci
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 86c0cffe15..246c031c06 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -128,6 +128,7 @@ SciEngine::SciEngine(OSystem *syst, const ADGameDescription *desc, SciGameId gam
DebugMan.addDebugChannel(kDebugLevelScriptPatcher, "ScriptPatcher", "Notifies when scripts are patched");
DebugMan.addDebugChannel(kDebugLevelWorkarounds, "Workarounds", "Notifies when workarounds are triggered");
DebugMan.addDebugChannel(kDebugLevelVideo, "Video", "Video (SEQ, VMD, RBT) debugging");
+ DebugMan.addDebugChannel(kDebugLevelGame, "Game", "Debug calls from game scripts");
DebugMan.addDebugChannel(kDebugLevelGC, "GC", "Garbage Collector debugging");
DebugMan.addDebugChannel(kDebugLevelResMan, "ResMan", "Resource manager debugging");
DebugMan.addDebugChannel(kDebugLevelOnStartup, "OnStartup", "Enter debugger at start of game");
@@ -494,62 +495,89 @@ static byte patchGameRestoreSave[] = {
0x48, // ret
};
+#ifdef ENABLE_SCI32
// SCI2 version: Same as above, but the second parameter to callk is a word
-static byte patchGameRestoreSaveSci2[] = {
- 0x39, 0x03, // pushi 03
- 0x76, // push0
- 0x38, 0xff, 0xff, // pushi -1
- 0x76, // push0
- 0x43, 0xff, 0x06, 0x00, // callk kRestoreGame/kSaveGame (will get changed afterwards)
- 0x48, // ret
+// and third parameter is a string reference
+static byte patchGameRestoreSci2[] = {
+ 0x39, 0x03, // pushi 03
+ 0x76, // push0 (game name)
+ 0x38, 0xff, 0xff, // pushi -1 (save number)
+ 0x89, 0x1b, // lsg global[27] (game version)
+ 0x43, 0xff, 0x06, 0x00, // callk kRestoreGame (0xFF will be overwritten by patcher)
+ 0x48, // ret
};
-// SCI21 version: Same as above, but the second parameter to callk is a word
-static byte patchGameRestoreSaveSci21[] = {
- 0x39, 0x04, // pushi 04
- 0x76, // push0 // 0: save, 1: restore (will get changed afterwards)
- 0x76, // push0
- 0x38, 0xff, 0xff, // pushi -1
- 0x76, // push0
- 0x43, 0xff, 0x08, 0x00, // callk kSave (will get changed afterwards)
- 0x48, // ret
+static byte patchGameSaveSci2[] = {
+ 0x39, 0x04, // pushi 04
+ 0x76, // push0 (game name)
+ 0x38, 0xff, 0xff, // pushi -1 (save number)
+ 0x76, // push0 (save description)
+ 0x89, 0x1b, // lsg global[27] (game version)
+ 0x43, 0xff, 0x08, 0x00, // callk kSaveGame (0xFF will be overwritten by patcher)
+ 0x48, // ret
+};
+
+// SCI2.1mid version: Same as above, but with an extra subop parameter
+static byte patchGameRestoreSci21[] = {
+ 0x39, 0x04, // pushi 04
+ 0x78, // push1 (subop)
+ 0x76, // push0 (game name)
+ 0x38, 0xff, 0xff, // pushi -1 (save number)
+ 0x89, 0x1b, // lsg global[27] (game version)
+ 0x43, 0xff, 0x08, 0x00, // callk kSave (0xFF will be overwritten by patcher)
+ 0x48, // ret
};
+static byte patchGameSaveSci21[] = {
+ 0x39, 0x05, // pushi 05
+ 0x76, // push0 (subop)
+ 0x76, // push0 (game name)
+ 0x38, 0xff, 0xff, // pushi -1 (save number)
+ 0x76, // push0 (save description)
+ 0x89, 0x1b, // lsg global[27] (game version)
+ 0x43, 0xff, 0x0a, 0x00, // callk kSave (0xFF will be overwritten by patcher)
+ 0x48, // ret
+};
+#endif
+
static void patchGameSaveRestoreCode(SegManager *segMan, reg_t methodAddress, byte id) {
Script *script = segMan->getScript(methodAddress.getSegment());
byte *patchPtr = const_cast<byte *>(script->getBuf(methodAddress.getOffset()));
- if (getSciVersion() <= SCI_VERSION_1_1) {
- memcpy(patchPtr, patchGameRestoreSave, sizeof(patchGameRestoreSave));
- } else { // SCI2+
- memcpy(patchPtr, patchGameRestoreSaveSci2, sizeof(patchGameRestoreSaveSci2));
-
- if (g_sci->isBE()) {
- // LE -> BE
- patchPtr[9] = 0x00;
- patchPtr[10] = 0x06;
- }
- }
-
+ memcpy(patchPtr, patchGameRestoreSave, sizeof(patchGameRestoreSave));
patchPtr[8] = id;
}
-static void patchGameSaveRestoreCodeSci21(SegManager *segMan, reg_t methodAddress, byte id, bool doRestore) {
+#ifdef ENABLE_SCI32
+static void patchGameSaveRestoreCodeSci2(SegManager *segMan, reg_t methodAddress, byte id, bool doRestore) {
Script *script = segMan->getScript(methodAddress.getSegment());
byte *patchPtr = const_cast<byte *>(script->getBuf(methodAddress.getOffset()));
- memcpy(patchPtr, patchGameRestoreSaveSci21, sizeof(patchGameRestoreSaveSci21));
+ int kcallOffset;
- if (doRestore)
- patchPtr[2] = 0x78; // push1
+ if (getSciVersion() < SCI_VERSION_2_1_MIDDLE) {
+ if (doRestore) {
+ memcpy(patchPtr, patchGameRestoreSci2, sizeof(patchGameRestoreSci2));
+ kcallOffset = 9;
+ } else {
+ memcpy(patchPtr, patchGameSaveSci2, sizeof(patchGameSaveSci2));
+ kcallOffset = 10;
+ }
+ } else {
+ if (doRestore) {
+ memcpy(patchPtr, patchGameRestoreSci21, sizeof(patchGameRestoreSci21));
+ kcallOffset = 10;
+ } else {
+ memcpy(patchPtr, patchGameSaveSci21, sizeof(patchGameSaveSci21));
+ kcallOffset = 11;
+ }
+ }
+ patchPtr[kcallOffset] = id;
if (g_sci->isBE()) {
- // LE -> BE
- patchPtr[10] = 0x00;
- patchPtr[11] = 0x08;
+ SWAP(patchPtr[kcallOffset + 1], patchPtr[kcallOffset + 2]);
}
-
- patchPtr[9] = id;
}
+#endif
void SciEngine::patchGameSaveRestore() {
SegManager *segMan = _gamestate->_segMan;
@@ -564,9 +592,12 @@ void SciEngine::patchGameSaveRestore() {
case GID_HOYLE1: // gets confused, although the game doesn't support saving/restoring at all
case GID_HOYLE2: // gets confused, see hoyle1
case GID_JONES: // gets confused, when we patch us in, the game is only able to save to 1 slot, so hooking is not required
+ case GID_KQ7: // has custom save/load code
case GID_MOTHERGOOSE: // mother goose EGA saves/restores directly and has no save/restore dialogs
case GID_MOTHERGOOSE256: // mother goose saves/restores directly and has no save/restore dialogs
+ case GID_MOTHERGOOSEHIRES: // has custom save/load code
case GID_PHANTASMAGORIA: // has custom save/load code
+ case GID_PQSWAT: // has custom save/load code
case GID_SHIVERS: // has custom save/load code
return;
default:
@@ -593,17 +624,21 @@ void SciEngine::patchGameSaveRestore() {
uint16 selectorId = gameSuperObject->getFuncSelector(methodNr);
Common::String methodName = _kernel->getSelectorName(selectorId);
if (methodName == "restore") {
- if (kernelIdSave != kernelIdRestore)
+#ifdef ENABLE_SCI32
+ if (getSciVersion() >= SCI_VERSION_2) {
+ patchGameSaveRestoreCodeSci2(segMan, gameSuperObject->getFunction(methodNr), kernelIdRestore, true);
+ } else
+#endif
patchGameSaveRestoreCode(segMan, gameSuperObject->getFunction(methodNr), kernelIdRestore);
- else
- patchGameSaveRestoreCodeSci21(segMan, gameSuperObject->getFunction(methodNr), kernelIdRestore, true);
}
else if (methodName == "save") {
if (_gameId != GID_FAIRYTALES) { // Fairy Tales saves automatically without a dialog
- if (kernelIdSave != kernelIdRestore)
+#ifdef ENABLE_SCI32
+ if (getSciVersion() >= SCI_VERSION_2) {
+ patchGameSaveRestoreCodeSci2(segMan, gameSuperObject->getFunction(methodNr), kernelIdSave, false);
+ } else
+#endif
patchGameSaveRestoreCode(segMan, gameSuperObject->getFunction(methodNr), kernelIdSave);
- else
- patchGameSaveRestoreCodeSci21(segMan, gameSuperObject->getFunction(methodNr), kernelIdSave, false);
}
}
}
@@ -627,10 +662,12 @@ void SciEngine::patchGameSaveRestore() {
Common::String methodName = _kernel->getSelectorName(selectorId);
if (methodName == "save") {
if (_gameId != GID_FAIRYTALES) { // Fairy Tales saves automatically without a dialog
- if (kernelIdSave != kernelIdRestore)
+#ifdef ENABLE_SCI32
+ if (getSciVersion() >= SCI_VERSION_2) {
+ patchGameSaveRestoreCodeSci2(segMan, gameSuperObject->getFunction(methodNr), kernelIdSave, false);
+ } else
+#endif
patchGameSaveRestoreCode(segMan, patchObjectSave->getFunction(methodNr), kernelIdSave);
- else
- patchGameSaveRestoreCodeSci21(segMan, patchObjectSave->getFunction(methodNr), kernelIdSave, false);
}
break;
}
@@ -955,6 +992,25 @@ int SciEngine::inQfGImportRoom() const {
return 0;
}
+void SciEngine::sleep(uint32 msecs) {
+ uint32 time;
+ const uint32 wakeUpTime = g_system->getMillis() + msecs;
+
+ for (;;) {
+ // let backend process events and update the screen
+ _eventMan->getSciEvent(SCI_EVENT_PEEK);
+ time = g_system->getMillis();
+ if (time + 10 < wakeUpTime) {
+ g_system->delayMillis(10);
+ } else {
+ if (time < wakeUpTime)
+ g_system->delayMillis(wakeUpTime - time);
+ break;
+ }
+
+ }
+}
+
void SciEngine::setLauncherLanguage() {
if (_gameDescription->flags & ADGF_ADDENGLISH) {
// If game is multilingual
@@ -1065,11 +1121,17 @@ void SciEngine::syncIngameAudioOptions() {
bool subtitlesOn = ConfMan.getBool("subtitles");
bool speechOn = !ConfMan.getBool("speech_mute");
+#ifdef ENABLE_SCI32
+ if (getSciVersion() >= SCI_VERSION_2) {
+ _gamestate->variables[VAR_GLOBAL][kGlobalVarTextSpeed] = make_reg(0, 8 - ConfMan.getInt("talkspeed") * 8 / 255);
+ }
+#endif
+
if (useGlobal90) {
if (subtitlesOn && !speechOn) {
- _gamestate->variables[VAR_GLOBAL][90] = make_reg(0, 1); // subtitles
+ _gamestate->variables[VAR_GLOBAL][kGlobalVarMessageType] = make_reg(0, 1); // subtitles
} else if (!subtitlesOn && speechOn) {
- _gamestate->variables[VAR_GLOBAL][90] = make_reg(0, 2); // speech
+ _gamestate->variables[VAR_GLOBAL][kGlobalVarMessageType] = make_reg(0, 2); // speech
} else if (subtitlesOn && speechOn) {
// Is it a game that supports simultaneous speech and subtitles?
switch (_gameId) {
@@ -1090,11 +1152,11 @@ void SciEngine::syncIngameAudioOptions() {
// Phantasmagoria does not support simultaneous speech + subtitles
// Mixed Up Mother Goose Deluxe does not support simultaneous speech + subtitles
#endif // ENABLE_SCI32
- _gamestate->variables[VAR_GLOBAL][90] = make_reg(0, 3); // speech + subtitles
+ _gamestate->variables[VAR_GLOBAL][kGlobalVarMessageType] = make_reg(0, 3); // speech + subtitles
break;
default:
// Game does not support speech and subtitles, set it to speech
- _gamestate->variables[VAR_GLOBAL][90] = make_reg(0, 2); // speech
+ _gamestate->variables[VAR_GLOBAL][kGlobalVarMessageType] = make_reg(0, 2); // speech
}
}
}
@@ -1105,7 +1167,7 @@ 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) {
- uint16 ingameSetting = _gamestate->variables[VAR_GLOBAL][90].getOffset();
+ uint16 ingameSetting = _gamestate->variables[VAR_GLOBAL][kGlobalVarMessageType].getOffset();
switch (ingameSetting) {
case 1:
diff --git a/engines/sci/sci.h b/engines/sci/sci.h
index b336eb8cce..b46207b075 100644
--- a/engines/sci/sci.h
+++ b/engines/sci/sci.h
@@ -125,7 +125,8 @@ enum kDebugLevels {
kDebugLevelDebugMode = 1 << 21,
kDebugLevelScriptPatcher = 1 << 22,
kDebugLevelWorkarounds = 1 << 23,
- kDebugLevelVideo = 1 << 24
+ kDebugLevelVideo = 1 << 24,
+ kDebugLevelGame = 1 << 25
};
enum SciGameId {
diff --git a/engines/sci/sound/audio32.cpp b/engines/sci/sound/audio32.cpp
index 4af474b918..659a5265d4 100644
--- a/engines/sci/sound/audio32.cpp
+++ b/engines/sci/sound/audio32.cpp
@@ -183,6 +183,9 @@ int Audio32::writeAudioInternal(Audio::AudioStream *const sourceStream, Audio::R
do {
if (loop && sourceStream->endOfStream()) {
Audio::RewindableAudioStream *rewindableStream = dynamic_cast<Audio::RewindableAudioStream *>(sourceStream);
+ if (rewindableStream == nullptr) {
+ error("[Audio32::writeAudioInternal]: Unable to cast stream");
+ }
rewindableStream->rewind();
}
@@ -453,7 +456,11 @@ void Audio32::freeUnusedChannels() {
const AudioChannel &channel = getChannel(channelIndex);
if (!channel.robot && channel.stream->endOfStream()) {
if (channel.loop) {
- dynamic_cast<Audio::SeekableAudioStream *>(channel.stream)->rewind();
+ Audio::SeekableAudioStream *stream = dynamic_cast<Audio::SeekableAudioStream *>(channel.stream);
+ if (stream == nullptr) {
+ error("[Audio32::freeUnusedChannels]: Unable to cast stream for resource %s", channel.id.toString().c_str());
+ }
+ stream->rewind();
} else {
stop(channelIndex--);
}
@@ -658,6 +665,9 @@ uint16 Audio32::play(int16 channelIndex, const ResourceId resourceId, const bool
if (channelIndex != kNoExistingChannel) {
AudioChannel &channel = getChannel(channelIndex);
Audio::SeekableAudioStream *stream = dynamic_cast<Audio::SeekableAudioStream *>(channel.stream);
+ if (stream == nullptr) {
+ error("[Audio32::play]: Unable to cast stream for resource %s", resourceId.toString().c_str());
+ }
if (channel.pausedAtTick) {
resume(channelIndex);
@@ -764,7 +774,12 @@ uint16 Audio32::play(int16 channelIndex, const ResourceId resourceId, const bool
// use audio streams, and allocate and fill the monitoring buffer
// when reading audio data from the stream.
- channel.duration = /* round up */ 1 + (dynamic_cast<Audio::SeekableAudioStream *>(channel.stream)->getLength().msecs() * 60 / 1000);
+ Audio::SeekableAudioStream *stream = dynamic_cast<Audio::SeekableAudioStream *>(channel.stream);
+ if (stream == nullptr) {
+ error("[Audio32::play]: Unable to cast stream for resource %s", resourceId.toString().c_str());
+ }
+
+ channel.duration = /* round up */ 1 + (stream->getLength().msecs() * 60 / 1000);
const uint32 now = g_sci->getTickCount();
channel.pausedAtTick = autoPlay ? 0 : now;
@@ -1012,7 +1027,7 @@ int16 Audio32::getVolume(const int16 channelIndex) const {
}
void Audio32::setVolume(const int16 channelIndex, int16 volume) {
- volume = MIN((int16)kMaxVolume, volume);
+ volume = MIN<int16>(kMaxVolume, volume);
if (channelIndex == kAllChannels) {
ConfMan.setInt("sfx_volume", volume * Audio::Mixer::kMaxChannelVolume / kMaxVolume);
ConfMan.setInt("speech_volume", volume * Audio::Mixer::kMaxChannelVolume / kMaxVolume);
diff --git a/engines/sci/video/robot_decoder.cpp b/engines/sci/video/robot_decoder.cpp
index 1757088ea4..446b986581 100644
--- a/engines/sci/video/robot_decoder.cpp
+++ b/engines/sci/video/robot_decoder.cpp
@@ -445,7 +445,7 @@ void RobotDecoder::initVideo(const int16 x, const int16 y, const int16 scale, co
if (scale != 128) {
_scaleInfo.x = scale;
_scaleInfo.y = scale;
- _scaleInfo.signal = kScaleSignalDoScaling32;
+ _scaleInfo.signal = kScaleSignalManual;
}
_plane = g_sci->_gfxFrameout->getPlanes().findByObject(plane);
@@ -703,7 +703,7 @@ void RobotDecoder::showFrame(const uint16 frameNo, const uint16 newX, const uint
const int16 lowResX = (scaledX * screenToLowResX).toInt();
const int16 lowResY = (scaledY2 * screenToLowResY).toInt();
- bitmap.setDisplace(Common::Point(
+ bitmap.setOrigin(Common::Point(
(scaledX - (lowResX * lowResToScreenX).toInt()) * -1,
(lowResY * lowResToScreenY).toInt() - scaledY1
));
@@ -713,7 +713,7 @@ void RobotDecoder::showFrame(const uint16 frameNo, const uint16 newX, const uint
} else {
const int16 scaledX = _originalScreenItemX[i] + _position.x;
const int16 scaledY = _originalScreenItemY[i] + _position.y + bitmap.getHeight() - 1;
- bitmap.setDisplace(Common::Point(0, bitmap.getHeight() - 1));
+ bitmap.setOrigin(Common::Point(0, bitmap.getHeight() - 1));
_screenItemX[i] = scaledX;
_screenItemY[i] = scaledY;
}
@@ -1391,7 +1391,7 @@ void RobotDecoder::doVersion5(const bool shouldSubmitAudio) {
// TODO: Version 6 robot?
// int scaleXRemainder;
- if (_scaleInfo.signal == kScaleSignalDoScaling32) {
+ if (_scaleInfo.signal == kScaleSignalManual) {
position.x = (position.x * _scaleInfo.x) / 128;
// TODO: Version 6 robot?
// scaleXRemainder = (position.x * _scaleInfo.x) % 128;
@@ -1461,7 +1461,7 @@ uint32 RobotDecoder::createCel5(const byte *rawVideoData, const int16 screenItem
const int16 screenWidth = g_sci->_gfxFrameout->getCurrentBuffer().screenWidth;
const int16 screenHeight = g_sci->_gfxFrameout->getCurrentBuffer().screenHeight;
- Common::Point displace;
+ Common::Point origin;
if (scriptWidth == kLowResX && scriptHeight == kLowResY) {
const Ratio lowResToScreenX(screenWidth, kLowResX);
const Ratio lowResToScreenY(screenHeight, kLowResY);
@@ -1475,22 +1475,22 @@ uint32 RobotDecoder::createCel5(const byte *rawVideoData, const int16 screenItem
const int16 lowResX = (scaledX * screenToLowResX).toInt();
const int16 lowResY = (scaledY2 * screenToLowResY).toInt();
- displace.x = (scaledX - (lowResX * lowResToScreenX).toInt()) * -1;
- displace.y = (lowResY * lowResToScreenY).toInt() - scaledY1;
+ origin.x = (scaledX - (lowResX * lowResToScreenX).toInt()) * -1;
+ origin.y = (lowResY * lowResToScreenY).toInt() - scaledY1;
_screenItemX[screenItemIndex] = lowResX;
_screenItemY[screenItemIndex] = lowResY;
- debugC(kDebugLevelVideo, "Low resolution position c: %d %d l: %d/%d %d/%d d: %d %d s: %d/%d %d/%d x: %d y: %d", celPosition.x, celPosition.y, lowResX, scriptWidth, lowResY, scriptHeight, displace.x, displace.y, scaledX, screenWidth, scaledY2, screenHeight, scaledX - displace.x, scaledY2 - displace.y);
+ debugC(kDebugLevelVideo, "Low resolution position c: %d %d l: %d/%d %d/%d d: %d %d s: %d/%d %d/%d x: %d y: %d", celPosition.x, celPosition.y, lowResX, scriptWidth, lowResY, scriptHeight, origin.x, origin.y, scaledX, screenWidth, scaledY2, screenHeight, scaledX - origin.x, scaledY2 - origin.y);
} else {
const int16 highResX = celPosition.x + _position.x;
const int16 highResY = celPosition.y + _position.y + celHeight - 1;
- displace.x = 0;
- displace.y = celHeight - 1;
+ origin.x = 0;
+ origin.y = celHeight - 1;
_screenItemX[screenItemIndex] = highResX;
_screenItemY[screenItemIndex] = highResY;
- debugC(kDebugLevelVideo, "High resolution position c: %d %d s: %d %d d: %d %d", celPosition.x, celPosition.y, highResX, highResY, displace.x, displace.y);
+ debugC(kDebugLevelVideo, "High resolution position c: %d %d s: %d %d d: %d %d", celPosition.x, celPosition.y, highResX, highResY, origin.x, origin.y);
}
_originalScreenItemX[screenItemIndex] = celPosition.x;
@@ -1500,9 +1500,9 @@ uint32 RobotDecoder::createCel5(const byte *rawVideoData, const int16 screenItem
SciBitmap &bitmap = *_segMan->lookupBitmap(_celHandles[screenItemIndex].bitmapId);
assert(bitmap.getWidth() == celWidth && bitmap.getHeight() == celHeight);
- assert(bitmap.getScaledWidth() == _xResolution && bitmap.getScaledHeight() == _yResolution);
+ assert(bitmap.getXResolution() == _xResolution && bitmap.getYResolution() == _yResolution);
assert(bitmap.getHunkPaletteOffset() == (uint32)bitmap.getWidth() * bitmap.getHeight() + SciBitmap::getBitmapHeaderSize());
- bitmap.setDisplace(displace);
+ bitmap.setOrigin(origin);
byte *targetBuffer = nullptr;
if (_verticalScaleFactor == 100) {
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index b3e7926015..f09729a1ed 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -99,7 +99,7 @@ static const byte v0ActorTalk[25] = {
0x06, // Sandy (Cut-Scene)
};
-static const byte v0WalkboxSlantedModifier[0x16] = {
+static const byte v0WalkboxSlantedModifier[0x16] = {
0x00,0x01,0x02,0x03,0x03,0x04,0x05,0x06,
0x06,0x07,0x08,0x09,0x09,0x0A,0x0B,
0x0C,0x0C,0x0D,0x0E,0x0F,0x10,0x10
@@ -237,7 +237,7 @@ void Actor_v0::initActor(int mode) {
_costCommand = 0xFF;
_miscflags = 0;
_speaking = 0;
-
+
_walkCountModulo = 0;
_newWalkBoxEntered = false;
_walkDirX = 0;
@@ -297,7 +297,7 @@ void Actor_v0::walkboxQueueReverse() {
return;
for (int i = 1; i < j && j >= 1 ; ++i, --j) {
-
+
byte tmp = _walkboxQueue[i];
_walkboxQueue[i] = _walkboxQueue[j];
@@ -371,7 +371,7 @@ bool Actor_v0::walkBoxQueuePrepare() {
_walkboxQueue[--_walkboxQueueIndex] = kInvalidBox;
BoxFound = _walkboxQueue[_walkboxQueueIndex - 1];
- }
+ }
} while (_walkboxQueueIndex > 0);
@@ -616,7 +616,7 @@ bool Actor_v0::calcWalkDistances() {
if (!_walkXCountInc && !_walkYCountInc)
return true;
- if (_walkXCountInc <= _walkYCountInc)
+ if (_walkXCountInc <= _walkYCountInc)
_walkYCountGreaterThanXCount = 1;
// 2FCC
@@ -652,7 +652,7 @@ byte Actor_v0::actorWalkX() {
setActorFromTmp();
return 3;
- }
+ }
// 2EBF
if (_tmp_Dest.x == _CurrentWalkTo.x)
return 1;
@@ -679,7 +679,7 @@ byte Actor_v0::actorWalkY() {
// 2EF8
setActorFromTmp();
return 4;
- }
+ }
// 2EFE
if (_walkYCountInc != 0) {
if (_walkYCountInc == 0xFF) {
@@ -690,7 +690,7 @@ byte Actor_v0::actorWalkY() {
// 2F0D
if (_CurrentWalkTo.y == _tmp_Dest.y)
return 1;
-
+
return 0;
}
@@ -904,8 +904,8 @@ L2A33:;
}
directionUpdate();
-
- if (_moving & 0x80)
+
+ if (_moving & 0x80)
return;
animateActor(newDirToOldDir(_facing));
@@ -913,7 +913,7 @@ L2A33:;
} else {
// 2A0A
if ((_moving & 0x7F) != 1) {
-
+
if (_NewWalkTo == _pos)
return;
}
@@ -1025,7 +1025,7 @@ L2CA3:;
_moving &= 0xF0;
_moving |= A;
} else {
- if (A == 4)
+ if (A == 4)
stopActorMoving();
}
@@ -1061,7 +1061,7 @@ L2CA3:;
} else {
_targetFacing = getAngleFromPos(V12_X_MULTIPLIER*-1, V12_Y_MULTIPLIER*0, false);
}
-
+
directionUpdate();
animateActor(newDirToOldDir(_facing));
goto L2CA3;
@@ -1433,13 +1433,13 @@ void Actor::turnToDirection(int newdir) {
if (_vm->_game.version <= 6) {
_targetFacing = newdir;
-
+
if (_vm->_game.version == 0) {
setDirection(newdir);
return;
}
_moving = MF_TURN;
-
+
} else {
_moving &= ~MF_TURN;
if (newdir != _facing) {
@@ -1637,7 +1637,7 @@ AdjustBoxResult Actor_v0::adjustPosInBorderWalkbox(AdjustBoxResult box) {
int16 A;
boxMask &= 0x7C;
- if (boxMask == 0x0C)
+ if (boxMask == 0x0C)
A = 2;
else {
if (boxMask != 0x08)
@@ -2114,7 +2114,7 @@ void ScummEngine::processActors() {
// comment further up in this method for some details.
if (a->_costume) {
- // Unfortunately in V0, the 'animateCostume' call happens right after the call to 'walkActor' (which is before drawing the actor)...
+ // Unfortunately in V0, the 'animateCostume' call happens right after the call to 'walkActor' (which is before drawing the actor)...
// doing it the other way with V0, causes animation glitches (when beginnning to walk, as the costume hasnt been updated).
// Updating the costume directly after 'walkActor' and again, after drawing... causes frame skipping
if (_game.version == 0) {
@@ -3476,7 +3476,7 @@ void Actor_v0::saveLoadWithSerializer(Serializer *ser) {
// valid costume command?
if (_costCommand != 0xFF) {
-
+
// Do we have a walkbox queue?
if (_walkboxQueueIndex < 1) {
_costCommand = 0xFF;
diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
index e6740df482..6366ffd998 100644
--- a/engines/scumm/detection.cpp
+++ b/engines/scumm/detection.cpp
@@ -1124,7 +1124,7 @@ Common::Error ScummMetaEngine::createInstance(OSystem *syst, Engine **engine) co
md5Warning += Common::String::format(" SCUMM gameid '%s', file '%s', MD5 '%s'\n\n",
res.game.gameid,
- generateFilenameForDetection(res.fp.pattern, res.fp.genMethod, Common::kPlatformUnknown).c_str(),
+ generateFilenameForDetection(res.fp.pattern, res.fp.genMethod, res.game.platform).c_str(),
res.md5.c_str());
g_system->logMessage(LogMessageType::kWarning, md5Warning.c_str());
diff --git a/engines/scumm/detection_tables.h b/engines/scumm/detection_tables.h
index bb3e7f6ec3..adcecaba55 100644
--- a/engines/scumm/detection_tables.h
+++ b/engines/scumm/detection_tables.h
@@ -488,13 +488,13 @@ static const GameFilenamePattern gameFilenamesTable[] = {
{ "monkey2", "mi2demo.%03d", kGenDiskNum, UNK_LANG, UNK, 0 },
{ "atlantis", "atlantis.%03d", kGenDiskNum, UNK_LANG, UNK, 0 },
- { "atlantis", "atlantis.%03d", kGenDiskNumSteam, UNK_LANG, Common::kPlatformWindows, "Steam" },
- { "atlantis", "atlantis.%03d", kGenDiskNumSteam, UNK_LANG, Common::kPlatformMacintosh, "Steam" },
{ "atlantis", "fate.%03d", kGenDiskNum, UNK_LANG, UNK, 0 },
{ "atlantis", "playfate.%03d", kGenDiskNum, UNK_LANG, UNK, 0 },
{ "atlantis", "indy4.%03d", kGenDiskNum, Common::JA_JPN, Common::kPlatformFMTowns, "FM-TOWNS" },
{ "atlantis", "indydemo.%03d", kGenDiskNum, Common::JA_JPN, Common::kPlatformFMTowns, "FM-TOWNS" },
{ "atlantis", "Fate of Atlantis Data", kGenUnchanged, UNK_LANG, Common::kPlatformMacintosh, 0 },
+ { "atlantis", "atlantis.%03d", kGenDiskNumSteam, UNK_LANG, Common::kPlatformWindows, "Steam" },
+ { "atlantis", "atlantis.%03d", kGenDiskNumSteam, UNK_LANG, Common::kPlatformMacintosh, "Steam" },
{ "tentacle", "tentacle.%03d", kGenDiskNum, UNK_LANG, UNK, 0 },
{ "tentacle", "dottdemo.%03d", kGenDiskNum, UNK_LANG, UNK, 0 },
@@ -513,11 +513,11 @@ static const GameFilenamePattern gameFilenamesTable[] = {
#ifdef ENABLE_SCUMM_7_8
{ "dig", "dig.la%d", kGenDiskNum, UNK_LANG, UNK, 0 },
- { "dig", "dig.la%d", kGenDiskNumSteam, UNK_LANG, Common::kPlatformWindows, "Steam" },
- { "dig", "dig.la%d", kGenDiskNumSteam, UNK_LANG, Common::kPlatformMacintosh, "Steam" },
{ "dig", "thedig.la%d", kGenDiskNum, UNK_LANG, UNK, "Demo" }, // Used by an alternate version of the demo
{ "dig", "The Dig Data", kGenUnchanged, UNK_LANG, Common::kPlatformMacintosh, 0 },
{ "dig", "The Dig Demo Data", kGenUnchanged, UNK_LANG, Common::kPlatformMacintosh, "Demo" },
+ { "dig", "dig.la%d", kGenDiskNumSteam, UNK_LANG, Common::kPlatformWindows, "Steam" },
+ { "dig", "dig.la%d", kGenDiskNumSteam, UNK_LANG, Common::kPlatformMacintosh, "Steam" },
{ "ft", "ft.la%d", kGenDiskNum, UNK_LANG, UNK, 0 },
{ "ft", "ft.%03d", kGenDiskNum, UNK_LANG, UNK, "Demo" }, // Used by PC version of Full Throttle demo
diff --git a/engines/scumm/file.cpp b/engines/scumm/file.cpp
index 96b46aa21a..139f798d83 100644
--- a/engines/scumm/file.cpp
+++ b/engines/scumm/file.cpp
@@ -262,7 +262,7 @@ ScummDiskImage::ScummDiskImage(const char *disk1, const char *disk2, GameSetting
_numGlobalObjects = 256;
_numRooms = 55;
_numCostumes = 25;
-
+
if (_game.features & GF_DEMO) {
_numScripts = 55;
_numSounds = 40;
diff --git a/engines/scumm/he/logic/moonbase_logic.cpp b/engines/scumm/he/logic/moonbase_logic.cpp
index c504ad4fe8..8e4b5c9cc7 100644
--- a/engines/scumm/he/logic/moonbase_logic.cpp
+++ b/engines/scumm/he/logic/moonbase_logic.cpp
@@ -446,7 +446,7 @@ int LogicHEmoonbase::op_net_get_session_player_count(int op, int numArgs, int32
return _vm1->_moonbase->_net->getSessionPlayerCount(args[0] - 1);
}
-int LogicHEmoonbase::op_net_destroy_player(int op, int numArgs, int32 *args) {
+int LogicHEmoonbase::op_net_destroy_player(int op, int numArgs, int32 *args) {
return _vm1->_moonbase->_net->destroyPlayer(args[0]);
}
@@ -506,7 +506,7 @@ int LogicHEmoonbase::op_net_who_am_i(int op, int numArgs, int32 *args) {
}
int LogicHEmoonbase::op_net_set_provider_by_name(int op, int numArgs, int32 *args) {
- // Parameter 1 is the provider name and
+ // Parameter 1 is the provider name and
// Parameter 2 is the (optional) tcp/ip address
return _vm1->_moonbase->_net->setProviderByName(args[0], args[1]);
}
diff --git a/engines/scumm/he/moonbase/net_main.h b/engines/scumm/he/moonbase/net_main.h
index 8350904fcd..dd8cce5937 100644
--- a/engines/scumm/he/moonbase/net_main.h
+++ b/engines/scumm/he/moonbase/net_main.h
@@ -72,7 +72,7 @@ public:
void getSessionName(int sessionNumber, char *buffer, int length);
int getSessionPlayerCount(int sessionNumber);
void getProviderName(int providerIndex, char *buffer, int length);
-
+
private:
//mostly getters
diff --git a/engines/scumm/he/script_v72he.cpp b/engines/scumm/he/script_v72he.cpp
index a922af1671..b2af816afe 100644
--- a/engines/scumm/he/script_v72he.cpp
+++ b/engines/scumm/he/script_v72he.cpp
@@ -1506,7 +1506,7 @@ void ScummEngine_v72he::getStringFromArray(int arrayNumber, char *buffer, int ma
// this is ARRAY_GetStringFromArray() from ARRAYS.cpp of SPUTM
// this function makes a C-string out of <arrayNumber> contents
-
+
VAR(0) = arrayNumber; // it was 0 in original code, but I've seen ScummVM Moonbase code which uses VAR_U32_ARRAY_UNK
int i, ch;
diff --git a/engines/scumm/insane/insane.cpp b/engines/scumm/insane/insane.cpp
index f0bbab53e6..c0ba9ea6c8 100644
--- a/engines/scumm/insane/insane.cpp
+++ b/engines/scumm/insane/insane.cpp
@@ -66,6 +66,18 @@ Insane::Insane(ScummEngine_v7 *scumm) {
readFileToMem("minefite.flu", &_smush_minefiteFlu);
_smush_bensgoggNut = new NutRenderer(_vm, "bensgogg.nut");
_smush_bencutNut = new NutRenderer(_vm, "bencut.nut");
+ } else {
+ _smush_roadrashRip = NULL;
+ _smush_roadrsh2Rip = NULL;
+ _smush_roadrsh3Rip = NULL;
+ _smush_goglpaltRip = NULL;
+ _smush_tovista1Flu = NULL;
+ _smush_tovista2Flu = NULL;
+ _smush_toranchFlu = NULL;
+ _smush_minedrivFlu = NULL;
+ _smush_minefiteFlu = NULL;
+ _smush_bensgoggNut = NULL;
+ _smush_bencutNut = NULL;
}
_smush_iconsNut = new NutRenderer(_vm, "icons.nut");
diff --git a/engines/scumm/resource_v2.cpp b/engines/scumm/resource_v2.cpp
index 87dc132ff0..2e37e4de76 100644
--- a/engines/scumm/resource_v2.cpp
+++ b/engines/scumm/resource_v2.cpp
@@ -39,7 +39,7 @@ void ScummEngine_v2::readClassicIndexFile() {
_numSounds = 40;
} else {
_numScripts = 160;
- _numSounds = 70;
+ _numSounds = 70;
}
} else if (_game.platform == Common::kPlatformNES) {
diff --git a/engines/scumm/script_v0.cpp b/engines/scumm/script_v0.cpp
index 609cbd1e89..7bacd847ac 100644
--- a/engines/scumm/script_v0.cpp
+++ b/engines/scumm/script_v0.cpp
@@ -641,7 +641,7 @@ void ScummEngine_v0::setMode(byte mode) {
// Note: do not change freeze state here
state = USERSTATE_SET_IFACE |
USERSTATE_SET_CURSOR;
-
+
break;
case kModeKeypad:
if (_game.features & GF_DEMO) {
diff --git a/engines/scumm/verbs.cpp b/engines/scumm/verbs.cpp
index fe936b550c..8bcbb70e97 100644
--- a/engines/scumm/verbs.cpp
+++ b/engines/scumm/verbs.cpp
@@ -905,7 +905,7 @@ void ScummEngine_v0::checkExecVerbs() {
}
}
}
-
+
if (_drawDemo && _game.features & GF_DEMO) {
verbDemoMode();
}
diff --git a/engines/sherlock/animation.h b/engines/sherlock/animation.h
index f3c95d4027..24d2bc3c3c 100644
--- a/engines/sherlock/animation.h
+++ b/engines/sherlock/animation.h
@@ -57,7 +57,7 @@ public:
* Load the prologue name array
*/
void setPrologueNames(const char *const *names, int count);
-
+
/**
* Load the prologue frame array
*/
@@ -67,7 +67,7 @@ public:
* Load the title name array
*/
void setTitleNames(const char *const *names, int count);
-
+
/**
* Load the title frame array
*/
diff --git a/engines/sherlock/events.cpp b/engines/sherlock/events.cpp
index 6cfee5d822..12ea1dbbdf 100644
--- a/engines/sherlock/events.cpp
+++ b/engines/sherlock/events.cpp
@@ -94,7 +94,7 @@ void Events::setCursor(CursorId cursorId) {
void Events::setCursor(const Graphics::Surface &src, int hotspotX, int hotspotY) {
_cursorId = INVALID_CURSOR;
_hotspotPos = Common::Point(hotspotX, hotspotY);
-
+
if (!IS_3DO) {
// PC 8-bit palettized
CursorMan.replaceCursor(src.getPixels(), src.w, src.h, hotspotX, hotspotY, 0xff);
@@ -400,7 +400,7 @@ bool Events::checkInput() {
void Events::incWaitCounter() {
setCursor(WAIT);
- ++_waitCounter;
+ ++_waitCounter;
}
void Events::decWaitCounter() {
diff --git a/engines/sherlock/fonts.cpp b/engines/sherlock/fonts.cpp
index dc7ecd521e..853591305d 100644
--- a/engines/sherlock/fonts.cpp
+++ b/engines/sherlock/fonts.cpp
@@ -140,7 +140,7 @@ void Fonts::setFont(int fontNum) {
_yOffsets[idx] = 0;
if (IS_ROSE_TATTOO) {
- if ((idx >= 129 && idx < 135) || (idx >= 136 && idx < 143) || (idx >= 147 && idx < 155) ||
+ if ((idx >= 129 && idx < 135) || (idx >= 136 && idx < 143) || (idx >= 147 && idx < 155) ||
(idx >= 156 && idx < 165))
_yOffsets[idx] = 1;
else if ((idx >= 143 && idx < 146) || idx == 165)
diff --git a/engines/sherlock/fonts.h b/engines/sherlock/fonts.h
index 6c805447b3..1ee4cbd6eb 100644
--- a/engines/sherlock/fonts.h
+++ b/engines/sherlock/fonts.h
@@ -44,7 +44,7 @@ protected:
static int _widestChar;
static uint16 _charCount;
- static void writeString(BaseSurface *surface, const Common::String &str,
+ static void writeString(BaseSurface *surface, const Common::String &str,
const Common::Point &pt, int overrideColor = 0);
static inline byte translateChar(byte c);
diff --git a/engines/sherlock/music.cpp b/engines/sherlock/music.cpp
index da4aec6994..cef7157034 100644
--- a/engines/sherlock/music.cpp
+++ b/engines/sherlock/music.cpp
@@ -196,7 +196,7 @@ bool MidiParser_SH::loadMusic(byte *musData, uint32 musDataSize) {
_numTracks = 1;
_tracks[0] = pos;
-
+
_ppqn = 1;
setTempo(16667);
setTrack(0);
diff --git a/engines/sherlock/music.h b/engines/sherlock/music.h
index b1eba1d889..5dc173c824 100644
--- a/engines/sherlock/music.h
+++ b/engines/sherlock/music.h
@@ -66,7 +66,7 @@ private:
Audio::SoundHandle _digitalMusicHandle;
MusicType _musicType;
byte *_midiMusicData;
-
+
/**
* Play the specified music resource
*/
@@ -100,7 +100,7 @@ public:
* Start playing a song
*/
void startSong();
-
+
/**
* Free any currently loaded song
*/
@@ -110,7 +110,7 @@ public:
* Stop playing the music
*/
void stopMusic();
-
+
bool isPlaying();
uint32 getCurrentPosition();
diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp
index a05351b170..c7eee36544 100644
--- a/engines/sherlock/objects.cpp
+++ b/engines/sherlock/objects.cpp
@@ -267,7 +267,7 @@ void BaseObject::checkObject() {
break;
}
_frameNumber += 3;
-
+
} else {
v -= 128;
@@ -306,7 +306,7 @@ void BaseObject::checkObject() {
}
} else if (IS_ROSE_TATTOO && v == 10) {
// Set delta for objects
- _delta = Common::Point(READ_LE_UINT16(&_sequences[_frameNumber + 1]),
+ _delta = Common::Point(READ_LE_UINT16(&_sequences[_frameNumber + 1]),
READ_LE_UINT16(&_sequences[_frameNumber + 3]));
_noShapeSize = Common::Point(0, 0);
_frameNumber += 4;
@@ -644,7 +644,7 @@ void Sprite::clear() {
void Sprite::setImageFrame() {
int frameNum = MAX(_frameNumber, 0);
int imageNumber = _walkSequences[_sequenceNumber][frameNum];
-
+
if (IS_SERRATED_SCALPEL)
imageNumber = imageNumber + _walkSequences[_sequenceNumber][0] - 2;
else if (imageNumber > _maxFrames)
@@ -1014,7 +1014,7 @@ void Object::load(Common::SeekableReadStream &s, bool isRoseTattoo) {
_oldPosition.y = s.readSint16LE();
_oldSize.x = s.readUint16LE();
_oldSize.y = s.readUint16LE();
-
+
_goto.x = s.readSint16LE();
_goto.y = s.readSint16LE();
if (!isRoseTattoo) {
@@ -1113,7 +1113,7 @@ void Object::load3DO(Common::SeekableReadStream &s) {
_oldPosition.y = s.readSint16BE();
_oldSize.x = s.readUint16BE();
_oldSize.y = s.readUint16BE();
-
+
_goto.x = s.readSint16BE();
_goto.y = s.readSint16BE();
_goto.x = _goto.x * FIXED_INT_MULTIPLIER / 100;
@@ -1485,7 +1485,7 @@ void CAnim::load(Common::SeekableReadStream &s, bool isRoseTattoo, uint32 dataOf
_position.x = s.readSint16LE();
_position.y = s.readSint16LE();
-
+
if (isRoseTattoo) {
_flags = s.readByte();
_scaleVal = s.readSint16LE();
diff --git a/engines/sherlock/objects.h b/engines/sherlock/objects.h
index 38b02aeae8..25ccddedbb 100644
--- a/engines/sherlock/objects.h
+++ b/engines/sherlock/objects.h
@@ -92,7 +92,7 @@ enum {
#define GOTO_CODE 228
#define TALK_SEQ_CODE 252 // Code specifying start of talk sequence frames in a Sequence
#define TALK_LISTEN_CODE 251 // Code specifying start of talk listen frames in a Sequence
-#define ALLOW_TALK_CODE 250
+#define ALLOW_TALK_CODE 250
#define UPPER_LIMIT 0
#define LOWER_LIMIT (IS_SERRATED_SCALPEL ? CONTROLS_Y : SHERLOCK_SCREEN_HEIGHT)
@@ -124,7 +124,7 @@ public:
PositionFacing() : Point32(), _facing(0) {}
PositionFacing(int xp, int yp, int theFacing) : Point32(xp, yp), _facing(theFacing) {}
- PositionFacing &operator=(const Point32 &pt) {
+ PositionFacing &operator=(const Point32 &pt) {
x = pt.x; y = pt.y;
return *this;
}
diff --git a/engines/sherlock/people.cpp b/engines/sherlock/people.cpp
index 8057e26204..2b282c35b0 100644
--- a/engines/sherlock/people.cpp
+++ b/engines/sherlock/people.cpp
@@ -244,7 +244,7 @@ bool People::freeWalk() {
if (_data[idx]->_walkLoaded) {
delete _data[idx]->_images;
_data[idx]->_images = nullptr;
-
+
_data[idx]->_walkLoaded = false;
result = true;
}
diff --git a/engines/sherlock/people.h b/engines/sherlock/people.h
index c47d45145a..41e298b2a9 100644
--- a/engines/sherlock/people.h
+++ b/engines/sherlock/people.h
@@ -168,10 +168,10 @@ public:
virtual const Common::Point restrictToZone(int zoneId, const Common::Point &destPos) = 0;
/**
- * If the specified speaker is a background object, it will set it so that it uses
- * the Listen Sequence (specified by the sequence number). If the current sequence
- * has an Allow Talk Code in it, the _gotoSeq field will be set so that the object
- * begins listening as soon as it hits the Allow Talk Code. If there is no Abort Code,
+ * If the specified speaker is a background object, it will set it so that it uses
+ * the Listen Sequence (specified by the sequence number). If the current sequence
+ * has an Allow Talk Code in it, the _gotoSeq field will be set so that the object
+ * begins listening as soon as it hits the Allow Talk Code. If there is no Abort Code,
* the Listen Sequence will begin immediately.
* @param speaker Who is speaking
* @param sequenceNum Which listen sequence to use
diff --git a/engines/sherlock/resources.cpp b/engines/sherlock/resources.cpp
index c4093048bd..ec7d60a1a2 100644
--- a/engines/sherlock/resources.cpp
+++ b/engines/sherlock/resources.cpp
@@ -119,7 +119,7 @@ void Resources::addToCache(const Common::String &filename) {
// Return immediately if the library has already been loaded
if (_indexes.contains(filename))
return;
-
+
_cache.load(filename);
// Check to see if the file is a library
diff --git a/engines/sherlock/resources.h b/engines/sherlock/resources.h
index 99d58a51b1..72d5e907da 100644
--- a/engines/sherlock/resources.h
+++ b/engines/sherlock/resources.h
@@ -100,12 +100,12 @@ public:
* loading its index for future use
*/
void addToCache(const Common::String &filename);
-
+
/**
* Adds a resource from a library file to the cache
*/
void addToCache(const Common::String &filename, const Common::String &libFilename);
-
+
/**
* Adds a given stream to the cache under the given name
*/
diff --git a/engines/sherlock/saveload.h b/engines/sherlock/saveload.h
index f4f3e7cfd9..9a26741172 100644
--- a/engines/sherlock/saveload.h
+++ b/engines/sherlock/saveload.h
@@ -133,7 +133,7 @@ public:
* Load the game in the specified slot
*/
void loadGame(int slot);
-
+
/**
* Save the game in the specified slot with the given name
*/
diff --git a/engines/sherlock/scalpel/3do/movie_decoder.cpp b/engines/sherlock/scalpel/3do/movie_decoder.cpp
index da0d16c145..bd2f44209f 100644
--- a/engines/sherlock/scalpel/3do/movie_decoder.cpp
+++ b/engines/sherlock/scalpel/3do/movie_decoder.cpp
@@ -140,7 +140,7 @@ bool Scalpel3DOMovieDecoder::loadStream(Common::SeekableReadStream *stream) {
_stream->readUint32BE(); // Unknown 0x00004000
_stream->readUint32BE(); // Unknown 0x00000000
_stream->readUint32BE(); // Unknown 0x00000010
- audioSampleRate = _stream->readUint32BE();
+ audioSampleRate = _stream->readUint32BE();
audioChannels = _stream->readUint32BE();
audioCodecTag = _stream->readUint32BE();
_stream->readUint32BE(); // Unknown 0x00000004 compression ratio?
diff --git a/engines/sherlock/scalpel/3do/scalpel_3do_screen.h b/engines/sherlock/scalpel/3do/scalpel_3do_screen.h
index 422f588b17..71674803ba 100644
--- a/engines/sherlock/scalpel/3do/scalpel_3do_screen.h
+++ b/engines/sherlock/scalpel/3do/scalpel_3do_screen.h
@@ -42,7 +42,7 @@ protected:
/**
* Draws a surface at a given position within this surface with transparency
*/
- virtual void transBlitFromUnscaled(const Graphics::Surface &src, const Common::Point &pt, bool flipped,
+ virtual void transBlitFromUnscaled(const Graphics::Surface &src, const Common::Point &pt, bool flipped,
int overrideColor);
public:
Scalpel3DOScreen(SherlockEngine *vm);
diff --git a/engines/sherlock/scalpel/scalpel.cpp b/engines/sherlock/scalpel/scalpel.cpp
index cbb202095f..5050062938 100644
--- a/engines/sherlock/scalpel/scalpel.cpp
+++ b/engines/sherlock/scalpel/scalpel.cpp
@@ -507,7 +507,7 @@ bool ScalpelEngine::showAlleyCutscene() {
}
if (finished) {
- // quick fade out
+ // quick fade out
_screen->fadeToBlack(1);
// wait until after third "scream" in music happened
diff --git a/engines/sherlock/scalpel/scalpel_darts.cpp b/engines/sherlock/scalpel/scalpel_darts.cpp
index c5ba8032f3..1b7c266de7 100644
--- a/engines/sherlock/scalpel/scalpel_darts.cpp
+++ b/engines/sherlock/scalpel/scalpel_darts.cpp
@@ -408,7 +408,7 @@ int Darts::doPowerBar(const Common::Point &pt, byte color, int goToPower, bool i
if (!(idx % 8))
events.wait(1);
-
+
++idx;
} while (!done);
diff --git a/engines/sherlock/scalpel/scalpel_darts.h b/engines/sherlock/scalpel/scalpel_darts.h
index 483a163510..24198a4052 100644
--- a/engines/sherlock/scalpel/scalpel_darts.h
+++ b/engines/sherlock/scalpel/scalpel_darts.h
@@ -53,7 +53,7 @@ private:
* Initializes the variables needed for the dart game
*/
void initDarts();
-
+
/**
* Frees the images used by the dart game
*/
@@ -98,7 +98,7 @@ private:
* Returns true if a mouse button or key is pressed.
*/
int dartHit();
-
+
/**
* Return the score of the given location on the dart-board
*/
diff --git a/engines/sherlock/scalpel/scalpel_people.h b/engines/sherlock/scalpel/scalpel_people.h
index 2ab6f5bc7d..1e29309d35 100644
--- a/engines/sherlock/scalpel/scalpel_people.h
+++ b/engines/sherlock/scalpel/scalpel_people.h
@@ -112,10 +112,10 @@ public:
virtual bool loadWalk();
/**
- * If the specified speaker is a background object, it will set it so that it uses
- * the Listen Sequence (specified by the sequence number). If the current sequence
- * has an Allow Talk Code in it, the _gotoSeq field will be set so that the object
- * begins listening as soon as it hits the Allow Talk Code. If there is no Abort Code,
+ * If the specified speaker is a background object, it will set it so that it uses
+ * the Listen Sequence (specified by the sequence number). If the current sequence
+ * has an Allow Talk Code in it, the _gotoSeq field will be set so that the object
+ * begins listening as soon as it hits the Allow Talk Code. If there is no Abort Code,
* the Listen Sequence will begin immediately.
* @param speaker Who is speaking
* @param sequenceNum Which listen sequence to use
diff --git a/engines/sherlock/scalpel/scalpel_saveload.cpp b/engines/sherlock/scalpel/scalpel_saveload.cpp
index 90eab5930c..7098d47065 100644
--- a/engines/sherlock/scalpel/scalpel_saveload.cpp
+++ b/engines/sherlock/scalpel/scalpel_saveload.cpp
@@ -40,7 +40,7 @@ const int ENV_POINTS[6][3] = {
/*----------------------------------------------------------------*/
-ScalpelSaveManager::ScalpelSaveManager(SherlockEngine *vm, const Common::String &target) :
+ScalpelSaveManager::ScalpelSaveManager(SherlockEngine *vm, const Common::String &target) :
SaveManager(vm, target), _envMode(SAVEMODE_NONE) {
_fixedTextExit = FIXED(LoadSave_Exit);
@@ -262,14 +262,14 @@ bool ScalpelSaveManager::promptForDescription(int slot) {
xp -= screen.charWidth(saveName.lastChar());
screen.vgaBar(Common::Rect(xp, yp - 1, xp + 8, yp + 9), INV_FOREGROUND);
saveName.deleteLastChar();
-
+
} else if (keyState.keycode == Common::KEYCODE_RETURN && saveName.compareToIgnoreCase(EMPTY_SAVEGAME_SLOT)) {
done = 1;
} else if (keyState.keycode == Common::KEYCODE_ESCAPE) {
screen.vgaBar(Common::Rect(xp, yp - 1, xp + 8, yp + 9), INV_BACKGROUND);
done = -1;
-
+
} else if (keyState.ascii >= ' ' && keyState.ascii <= 'z' && saveName.size() < 50
&& (xp + screen.charWidth(keyState.ascii)) < 308) {
char c = (char)keyState.ascii;
diff --git a/engines/sherlock/scalpel/scalpel_scene.cpp b/engines/sherlock/scalpel/scalpel_scene.cpp
index 11fb807c3b..3a7c04baee 100644
--- a/engines/sherlock/scalpel/scalpel_scene.cpp
+++ b/engines/sherlock/scalpel/scalpel_scene.cpp
@@ -741,7 +741,7 @@ int ScalpelScene::findBgShape(const Common::Point &pt) {
for (int idx = (int)_bgShapes.size() - 1; idx >= 0; --idx) {
Object &o = _bgShapes[idx];
if (o._type != INVALID && o._type != NO_SHAPE && o._type != HIDDEN
- && o._aType <= PERSON) {
+ && o._type != REMOVE && o._aType <= PERSON) {
if (o.getNewBounds().contains(pt))
return idx;
} else if (o._type == NO_SHAPE) {
diff --git a/engines/sherlock/scalpel/scalpel_talk.cpp b/engines/sherlock/scalpel/scalpel_talk.cpp
index ff38c07537..f1460fd01d 100644
--- a/engines/sherlock/scalpel/scalpel_talk.cpp
+++ b/engines/sherlock/scalpel/scalpel_talk.cpp
@@ -136,7 +136,7 @@ ScalpelTalk::ScalpelTalk(SherlockEngine *vm) : Talk(vm) {
(OpcodeMethod)&ScalpelTalk::cmdHolmesOn,
(OpcodeMethod)&ScalpelTalk::cmdGotoScene,
(OpcodeMethod)&ScalpelTalk::cmdPlayPrologue,
-
+
(OpcodeMethod)&ScalpelTalk::cmdAddItemToInventory,
(OpcodeMethod)&ScalpelTalk::cmdSetObject,
(OpcodeMethod)&ScalpelTalk::cmdCallTalkFile,
@@ -147,7 +147,7 @@ ScalpelTalk::ScalpelTalk(SherlockEngine *vm) : Talk(vm) {
(OpcodeMethod)&ScalpelTalk::cmdRemoveItemFromInventory,
(OpcodeMethod)&ScalpelTalk::cmdEnableEndKey,
(OpcodeMethod)&ScalpelTalk::cmdDisableEndKey,
-
+
(OpcodeMethod)&ScalpelTalk::cmdEndTextWindow,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
@@ -387,7 +387,7 @@ OpcodeReturn ScalpelTalk::cmdClearInfoLine(const byte *&str) {
OpcodeReturn ScalpelTalk::cmdClearWindow(const byte *&str) {
UserInterface &ui = *_vm->_ui;
-
+
ui.clearWindow();
_yp = CONTROLS_Y + 12;
_charCount = _line = 0;
@@ -450,7 +450,7 @@ OpcodeReturn ScalpelTalk::cmdMoveMouse(const byte *&str) {
if (_talkToAbort)
return RET_EXIT;
str += 3;
-
+
return RET_SUCCESS;
}
@@ -650,7 +650,7 @@ bool ScalpelTalk::talk3DOMovieTrigger(int subIndex) {
}
Common::Point ScalpelTalk::get3doPortraitPosition() const {
- // TODO: This current method is only an assumption of how the original figured
+ // TODO: This current method is only an assumption of how the original figured
// out where to place each character's portrait movie.
People &people = *_vm->_people;
Scene &scene = *_vm->_scene;
@@ -672,7 +672,7 @@ Common::Point ScalpelTalk::get3doPortraitPosition() const {
pt = scene._bgShapes[objNum]._position;
}
-
+
// Adjust the top-left so the center of the portrait will be on the character,
// but ensure the portrait will be entirely on-screen
pt -= Common::Point(PORTRAIT_W / 2, PORTRAIT_H / 2);
diff --git a/engines/sherlock/scalpel/scalpel_user_interface.h b/engines/sherlock/scalpel/scalpel_user_interface.h
index cc3aafff65..586f9ab000 100644
--- a/engines/sherlock/scalpel/scalpel_user_interface.h
+++ b/engines/sherlock/scalpel/scalpel_user_interface.h
@@ -105,38 +105,38 @@ private:
* Handles input when the file list window is being displayed
*/
void doEnvControl();
-
+
/**
* Handle input whilst the inventory is active
*/
void doInvControl();
-
+
/**
* Handles waiting whilst an object's description window is open.
*/
void doLookControl();
-
+
/**
* Handles input until one of the user interface buttons/commands is selected
*/
void doMainControl();
-
+
/**
* Handles the input for the MOVE, OPEN, and CLOSE commands
*/
void doMiscControl(int allowed);
-
+
/**
* Handles input for picking up items
*/
void doPickControl();
-
+
/**
* Handles input when in talk mode. It highlights the buttons and available statements,
* and handles allowing the user to click on them
*/
void doTalkControl();
-
+
/**
* Handles events when the Journal is active.
* @remarks Whilst this would in theory be better in the Journal class, since it displays in
@@ -150,7 +150,7 @@ private:
*/
void checkUseAction(const UseType *use, const Common::String &invName, FixedTextActionId fixedTextActionId,
int objNum, bool giveMode);
-
+
/**
* Print the previously selected object's decription
*/
@@ -212,7 +212,7 @@ public:
/**
* Draw the user interface onto the screen's back buffers
- */
+ */
virtual void drawInterface(int bufferNum = 3);
/**
@@ -243,7 +243,7 @@ public:
/**
* Print the previously selected object's decription
- */
+ */
virtual void printObjectDesc();
};
diff --git a/engines/sherlock/scalpel/tsage/logo.cpp b/engines/sherlock/scalpel/tsage/logo.cpp
index a885057f35..67959a19f9 100644
--- a/engines/sherlock/scalpel/tsage/logo.cpp
+++ b/engines/sherlock/scalpel/tsage/logo.cpp
@@ -181,7 +181,7 @@ void Object::setAnimMode(bool isAnimating) {
}
void Object::setDestination(const Common::Point &pt) {
- _destination = pt;
+ _destination = pt;
int moveRate = 10;
_walkStartFrame = _vm->_events->getFrameCounter();
@@ -215,7 +215,7 @@ void Object::setDestination(const Common::Point &pt) {
void Object::erase() {
Screen &screen = *_vm->_screen;
-
+
if (_visage.isLoaded() && !_oldBounds.isEmpty())
screen.SHblitFrom(screen._backBuffer1, Common::Point(_oldBounds.left, _oldBounds.top), _oldBounds);
}
@@ -233,7 +233,7 @@ void Object::update() {
move();
}
}
-
+
if (_isAnimating) {
if (_frame < _visage.getFrameCount())
_frame = changeFrame();
@@ -436,7 +436,7 @@ Logo::Logo(ScalpelEngine *vm) : _vm(vm), _lib("sf3.rlb") {
_animateFrameDelay = 0;
_animateFrames = NULL;
_animateFrame = 0;
-
+
// Save a copy of the original palette
_vm->_screen->getPalette(_originalPalette);
@@ -630,7 +630,7 @@ void Logo::startAnimation(uint object, uint frameDelay, const AnimationFrame *fr
void Logo::loadBackground() {
Screen &screen = *_vm->_screen;
-
+
for (int idx = 0; idx < 4; ++idx) {
// Get the portion of the screen
Common::SeekableReadStream *stream = _lib.getResource(RES_BITMAP, 10, idx);
diff --git a/engines/sherlock/scalpel/tsage/logo.h b/engines/sherlock/scalpel/tsage/logo.h
index 8e47ea42a1..5a669da19a 100644
--- a/engines/sherlock/scalpel/tsage/logo.h
+++ b/engines/sherlock/scalpel/tsage/logo.h
@@ -79,7 +79,7 @@ public:
* Get a frame from the visage
*/
void getFrame(ObjectSurface &s, int frameNum);
-
+
/**
* Return the number of frames
*/
diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp
index 78d0cd862c..b02569b26e 100644
--- a/engines/sherlock/scene.cpp
+++ b/engines/sherlock/scene.cpp
@@ -374,7 +374,7 @@ bool Scene::loadScene(const Common::String &filename) {
} else {
rrmStream->read(screen._backBuffer1.getPixels(), fullWidth * SHERLOCK_SCREEN_HEIGHT);
}
- }
+ }
// Read in the shapes header info
Common::Array<BgFileHeaderInfo> bgInfo;
@@ -528,7 +528,7 @@ bool Scene::loadScene(const Common::String &filename) {
delete[] cAnimOffsetTablePtr;
}
-
+
// Read in the room bounding areas
int size = rrmStream->readUint16LE();
@@ -627,7 +627,7 @@ bool Scene::loadScene(const Common::String &filename) {
if (IS_ROSE_TATTOO) {
// Load the object sound list
char buffer[27];
-
+
_objSoundList.resize(rrmStream->readUint16LE());
for (uint idx = 0; idx < _objSoundList.size(); ++idx) {
rrmStream->read(buffer, 27);
@@ -1205,9 +1205,9 @@ void Scene::transitionToScene() {
if (hSavedFacing < 8 && !saves._justLoaded) {
if (IS_ROSE_TATTOO)
hSavedFacing = Tattoo::FS_TRANS[hSavedFacing];
- else
+ else
hSavedFacing = Scalpel::FS_TRANS[hSavedFacing];
-
+
hSavedPos.x *= FIXED_INT_MULTIPLIER;
hSavedPos.y *= FIXED_INT_MULTIPLIER;
}
@@ -1235,7 +1235,7 @@ void Scene::transitionToScene() {
people[HOLMES]._position = Common::Point(0, 0);
}
- // If the scene is capable of scrolling, set the current scroll so that whoever has control
+ // If the scene is capable of scrolling, set the current scroll so that whoever has control
// of the scroll code is in the middle of the screen
if (screen._backBuffer1.width() > SHERLOCK_SCREEN_WIDTH)
people[people._walkControl].centerScreenOnPerson();
@@ -1256,7 +1256,7 @@ void Scene::transitionToScene() {
}
if (Common::Rect(topLeft.x, topLeft.y, bottomRight.x, bottomRight.y).contains(
- Common::Point(people[HOLMES]._position.x / FIXED_INT_MULTIPLIER,
+ Common::Point(people[HOLMES]._position.x / FIXED_INT_MULTIPLIER,
people[HOLMES]._position.y / FIXED_INT_MULTIPLIER))) {
// Current point is already inside box - impact occurred on
// a previous call. So simply do nothing except talk until the
diff --git a/engines/sherlock/screen.h b/engines/sherlock/screen.h
index fb44c6dde2..d1ec1885c7 100644
--- a/engines/sherlock/screen.h
+++ b/engines/sherlock/screen.h
@@ -132,14 +132,14 @@ public:
* Copy an image from the back buffer to the screen, taking care of both the
* new area covered by the shape as well as the old area, which must be restored
*/
- void flushImage(ImageFrame *frame, const Common::Point &pt, int16 *xp, int16 *yp,
+ void flushImage(ImageFrame *frame, const Common::Point &pt, int16 *xp, int16 *yp,
int16 *width, int16 *height);
/**
* Similar to flushImage, this method takes in an extra parameter for the scale proporation,
* which affects the calculated bounds accordingly
*/
- void flushScaleImage(ImageFrame *frame, const Common::Point &pt, int16 *xp, int16 *yp,
+ void flushScaleImage(ImageFrame *frame, const Common::Point &pt, int16 *xp, int16 *yp,
int16 *width, int16 *height, int scaleVal);
/**
diff --git a/engines/sherlock/sound.cpp b/engines/sherlock/sound.cpp
index e5b1099123..0e5652d52c 100644
--- a/engines/sherlock/sound.cpp
+++ b/engines/sherlock/sound.cpp
@@ -72,7 +72,7 @@ Sound::Sound(SherlockEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer) {
_vm->_res->addToCache("TITLE.SND");
else {
_vm->_res->addToCache("MUSIC.LIB");
-
+
if (IS_ROSE_TATTOO) {
_vm->_res->addToCache("SOUND.LIB");
} else {
diff --git a/engines/sherlock/sound.h b/engines/sherlock/sound.h
index a82aaf6730..2ca8d2d0e6 100644
--- a/engines/sherlock/sound.h
+++ b/engines/sherlock/sound.h
@@ -85,7 +85,7 @@ public:
* Load a sound
*/
void loadSound(const Common::String &name, int priority);
-
+
/**
* Play the sound in the specified resource
*/
@@ -100,17 +100,17 @@ public:
* Stop the AIFF sound that was started with playAiff().
*/
void stopAiff();
-
+
/**
* Play a previously loaded sound
*/
void playLoadedSound(int bufNum, WaitType waitType);
-
+
/**
* Free any previously loaded sounds
*/
void freeLoadedSounds();
-
+
/**
* Stop playing any active sound
*/
diff --git a/engines/sherlock/talk.cpp b/engines/sherlock/talk.cpp
index 3c6bf44837..b4987f070a 100644
--- a/engines/sherlock/talk.cpp
+++ b/engines/sherlock/talk.cpp
@@ -172,7 +172,7 @@ void Talk::talkTo(const Common::String filename) {
// Turn on the Exit option
ui._endKeyActive = true;
- if (people[HOLMES]._walkCount || (!people[HOLMES]._walkTo.empty() &&
+ if (people[HOLMES]._walkCount || (!people[HOLMES]._walkTo.empty() &&
(IS_SERRATED_SCALPEL || people._allowWalkAbort))) {
// Only interrupt if trying to do an action, and not just if player is walking around the scene
if (people._allowWalkAbort)
@@ -1195,7 +1195,7 @@ OpcodeReturn Talk::cmdWalkToCAnimation(const byte *&str) {
++str;
CAnim &animation = scene._cAnim[str[0] - 1];
people[HOLMES].walkToCoords(animation._goto[0], animation._goto[0]._facing);
-
+
return _talkToAbort ? RET_EXIT : RET_SUCCESS;
}
diff --git a/engines/sherlock/talk.h b/engines/sherlock/talk.h
index 2c0da24d69..1fa015362b 100644
--- a/engines/sherlock/talk.h
+++ b/engines/sherlock/talk.h
@@ -71,7 +71,7 @@ enum {
OP_ENABLE_END_KEY = 31,
OP_DISABLE_END_KEY = 32,
OP_END_TEXT_WINDOW = 33,
-
+
OP_MOUSE_OFF_ON = 34,
OP_SET_WALK_CONTROL = 35,
OP_SET_TALK_SEQUENCE = 36,
@@ -123,7 +123,7 @@ struct SequenceEntry {
short _frameNumber; // Frame number in frame sequence to draw
short _sequenceNumber; // Start frame of sequences that are repeated
int _seqStack; // Allows gosubs to return to calling frame
- int _seqTo; // Allows 1-5, 8-3 type sequences encoded
+ int _seqTo; // Allows 1-5, 8-3 type sequences encoded
int _seqCounter; // How many times this sequence has been executed
int _seqCounter2;
@@ -315,7 +315,7 @@ public:
* saved onto the sequence stack.
*/
void pushSequence(int speaker);
-
+
/**
* Push the details of a passed object onto the saved sequences stack
*/
@@ -351,7 +351,7 @@ public:
* Prints a single conversation option in the interface window
*/
virtual int talkLine(int lineNum, int stateNum, byte color, int lineY, bool slamIt) { return 0; }
-
+
/**
* Pulls a background object sequence from the sequence stack and restore's the
* object's sequence
diff --git a/engines/sherlock/tattoo/tattoo.cpp b/engines/sherlock/tattoo/tattoo.cpp
index 3131df7649..31a65783e3 100644
--- a/engines/sherlock/tattoo/tattoo.cpp
+++ b/engines/sherlock/tattoo/tattoo.cpp
@@ -63,7 +63,7 @@ void TattooEngine::initialize() {
// Add some more files to the cache
_res->addToCache("walk.lib");
-
+
// Set up list of people
TattooFixedText &fixedText = *(TattooFixedText *)_fixedText;
const char *peopleNamePtr = nullptr;
@@ -122,7 +122,7 @@ void TattooEngine::startScene() {
// Darts Board minigame
_darts.playDarts(GAME_CRICKET);
break;
-
+
case 102:
// Darts Board minigame
_darts.playDarts(GAME_301);
diff --git a/engines/sherlock/tattoo/tattoo_darts.cpp b/engines/sherlock/tattoo/tattoo_darts.cpp
index cbc3ea1fe8..b3fa8cda9e 100644
--- a/engines/sherlock/tattoo/tattoo_darts.cpp
+++ b/engines/sherlock/tattoo/tattoo_darts.cpp
@@ -121,7 +121,7 @@ void Darts::playDarts(GameType gameType) {
numHits = 1;
if (numHits > 3)
numHits = 3;
-
+
lastDart = lastDart & 0xffff;
updateCricketScore(playerNum, lastDart, numHits);
score = (playerNum == 0) ? _score1 : _score2;
@@ -134,7 +134,7 @@ void Darts::playDarts(GameType gameType) {
done = true;
playerNum = 0;
}
-
+
if (_gameType == GAME_301) {
if (playerNum == 0)
@@ -217,7 +217,7 @@ void Darts::playDarts(GameType gameType) {
}
if (score != 0 && playerNum == 0 && !gameOver)
- screen.print(Common::Point(_dartInfo.left, _dartInfo.top + _spacing * 3), 0,
+ screen.print(Common::Point(_dartInfo.left, _dartInfo.top + _spacing * 3), 0,
"%s", FIXED(DartsPressKey));
if (gameOver) {
@@ -388,14 +388,14 @@ void Darts::showNames(int playerNum) {
color = playerNum == 0 ? PLAYER_COLOR : DART_COLOR_FORE;
screen.print(Common::Point(STATUS_INFO_X, STATUS_INFO_Y), 0, "%s", FIXED(DartsPlayerHolmes));
- screen._backBuffer1.fillRect(Common::Rect(STATUS_INFO_X, STATUS_INFO_Y + _spacing + 1,
+ screen._backBuffer1.fillRect(Common::Rect(STATUS_INFO_X, STATUS_INFO_Y + _spacing + 1,
STATUS_INFO_X + 50, STATUS_INFO_Y + _spacing + 3), color);
screen.fillRect(Common::Rect(STATUS_INFO_X, STATUS_INFO_Y + _spacing + 1,
STATUS_INFO_X + 50, STATUS_INFO_Y + _spacing + 3), color);
color = playerNum == 1 ? PLAYER_COLOR : DART_COLOR_FORE;
screen.print(Common::Point(STATUS2_INFO_X, STATUS_INFO_Y), 0, "%s", _opponent.c_str());
- screen._backBuffer1.fillRect(Common::Rect(STATUS2_INFO_X, STATUS_INFO_Y + _spacing + 1,
+ screen._backBuffer1.fillRect(Common::Rect(STATUS2_INFO_X, STATUS_INFO_Y + _spacing + 1,
STATUS2_INFO_X + 50, STATUS_INFO_Y + _spacing + 3), color);
screen.fillRect(Common::Rect(STATUS2_INFO_X, STATUS_INFO_Y + _spacing + 1,
STATUS2_INFO_X + 50, STATUS_INFO_Y + _spacing + 3), color);
@@ -449,7 +449,7 @@ void Darts::showStatus(int playerNum) {
}
screen.SHblitFrom(screen._backBuffer1, Common::Point(STATUS_INFO_X, STATUS_INFO_Y + 10),
- Common::Rect(STATUS_INFO_X, STATUS_INFO_Y + 10, STATUS_INFO_X + STATUS_INFO_WIDTH,
+ Common::Rect(STATUS_INFO_X, STATUS_INFO_Y + 10, STATUS_INFO_X + STATUS_INFO_WIDTH,
STATUS_INFO_Y + STATUS_INFO_HEIGHT - 10));
}
@@ -674,9 +674,9 @@ void Darts::drawDartThrow(const Common::Point &dartPos, int computer) {
screen.slamArea(drawPos.x, drawPos.y, xSize, ySize);
if (oldDrawPos.x != -1)
// Flush the erased dart area
- screen.slamArea(oldDrawPos.x, oldDrawPos.y, oldxSize, oldySize);
+ screen.slamArea(oldDrawPos.x, oldDrawPos.y, oldxSize, oldySize);
- screen._backBuffer1.SHblitFrom(screen._backBuffer2, Common::Point(drawPos.x, drawPos.y),
+ screen._backBuffer1.SHblitFrom(screen._backBuffer2, Common::Point(drawPos.x, drawPos.y),
Common::Rect(drawPos.x, drawPos.y, drawPos.x + xSize, drawPos.y + ySize));
oldDrawPos.x = drawPos.x;
@@ -745,7 +745,7 @@ void Darts::drawDartThrow(const Common::Point &dartPos, int computer) {
screen.slamArea(oldDrawPos.x, oldDrawPos.y, oldxSize, oldySize);
if (idx != 23)
- screen._backBuffer1.SHblitFrom(screen._backBuffer2, drawPos,
+ screen._backBuffer1.SHblitFrom(screen._backBuffer2, drawPos,
Common::Rect(drawPos.x, drawPos.y, drawPos.x + xSize, drawPos.y + ySize)); // erase dart
events.wait(1);
@@ -805,7 +805,7 @@ int Darts::findNumberOnBoard(int aim, Common::Point &pt) {
}
}
}
-
+
pt = convertFromScreenToScoreCoords(pt);
if (aim == 3)
@@ -832,7 +832,7 @@ void Darts::getComputerNumber(int playerNum, Common::Point &targetPos) {
if (_gameType == GAME_301) {
// Try to hit number
- aim = score;
+ aim = score;
if(score > 60)
shootBull = true;
} else {
@@ -855,7 +855,7 @@ void Darts::getComputerNumber(int playerNum, Common::Point &targetPos) {
if (!cricketaimset) {
// Everything is closed
// just in case we don't get set in loop below, which should never happen
- aim = 14;
+ aim = 14;
for (int idx = 0; idx < 7; ++idx) {
if (_cricketScore[playerNum^1][idx] < 3) {
// Opponent has this open
@@ -896,7 +896,7 @@ void Darts::getComputerNumber(int playerNum, Common::Point &targetPos) {
// the higher the level, the more accurate the throw
int v = _vm->getRandomNumber(9);
- v += _level * 2;
+ v += _level * 2;
if (v <= 2) {
targetPos.x += _vm->getRandomNumber(70) - 35;
@@ -981,12 +981,12 @@ int Darts::throwDart(int dartNum, int computer) {
// Copy power bars to the secondary back buffer
screen._backBuffer2.SHblitFrom(screen._backBuffer1, Common::Point(DART_BAR_VX - 1, DART_HEIGHT_Y - 1),
- Common::Rect(DART_BAR_VX - 1, DART_HEIGHT_Y - 1, DART_BAR_VX - 1 + 10,
+ Common::Rect(DART_BAR_VX - 1, DART_HEIGHT_Y - 1, DART_BAR_VX - 1 + 10,
DART_HEIGHT_Y - 1 + DART_BAR_SIZE + 2));
Common::Point dartPos(DARTBOARD_TOTALLEFT + horiz*DARTBOARD_TOTALX / 100,
DARTBOARD_TOTALTOP + height * DARTBOARD_TOTALY / 100);
-
+
dartPos.x += 2 - _vm->getRandomNumber(4);
dartPos.y += 2 - _vm->getRandomNumber(4);
diff --git a/engines/sherlock/tattoo/tattoo_darts.h b/engines/sherlock/tattoo/tattoo_darts.h
index ab6b1c8204..94402a5b1b 100644
--- a/engines/sherlock/tattoo/tattoo_darts.h
+++ b/engines/sherlock/tattoo/tattoo_darts.h
@@ -103,7 +103,7 @@ private:
int doPowerBar(const Common::Point &pt, byte color, int goToPower, int orientation);
/**
- * This is similar to doPowerBar, except it draws the player's hand moving across the
+ * This is similar to doPowerBar, except it draws the player's hand moving across the
* bottom of the screen to indicate the positioning of the darts
*/
int drawHand(int goToPower, int computer);
diff --git a/engines/sherlock/tattoo/tattoo_inventory.h b/engines/sherlock/tattoo/tattoo_inventory.h
index a18324b785..0a46045d4b 100644
--- a/engines/sherlock/tattoo/tattoo_inventory.h
+++ b/engines/sherlock/tattoo/tattoo_inventory.h
@@ -38,7 +38,7 @@ public:
* Load the list of names the inventory items correspond to, if not already loaded,
* and then calls loadGraphics to load the associated graphics
*/
- virtual void loadInv();
+ virtual void loadInv();
};
} // End of namespace Tattoo
diff --git a/engines/sherlock/tattoo/tattoo_map.cpp b/engines/sherlock/tattoo/tattoo_map.cpp
index 23e8bd9739..e432c255d8 100644
--- a/engines/sherlock/tattoo/tattoo_map.cpp
+++ b/engines/sherlock/tattoo/tattoo_map.cpp
@@ -70,7 +70,7 @@ int TattooMap::show() {
}
if (music._musicOn) {
- // See if Holmes or Watson is the active character
+ // See if Holmes or Watson is the active character
Common::String song;
if (_vm->readFlags(FLAG_PLAYER_IS_HOLMES))
// Player is Holmes
@@ -86,7 +86,7 @@ int TattooMap::show() {
}
screen.initPaletteFade(1364485);
-
+
// Load the custom mouse cursors for the map
ImageFile cursors("omouse.vgs");
events.setCursor(cursors[0]._frame);
@@ -298,7 +298,7 @@ void TattooMap::loadData() {
void TattooMap::drawMapIcons() {
Debugger &debugger = *_vm->_debugger;
Screen &screen = *_vm->_screen;
-
+
for (uint idx = 0; idx < _data.size(); ++idx) {
if (debugger._showAllLocations != LOC_DISABLED)
_vm->setFlagsDirect(idx + 1);
@@ -344,7 +344,7 @@ void TattooMap::checkMapNames(bool slamIt) {
const Common::String &desc = _data[_bgFound]._description;
_mapTooltip.setText(desc);
}
-
+
_oldBgFound = _bgFound;
}
diff --git a/engines/sherlock/tattoo/tattoo_map.h b/engines/sherlock/tattoo/tattoo_map.h
index 1c7173bdb0..df3e3b3def 100644
--- a/engines/sherlock/tattoo/tattoo_map.h
+++ b/engines/sherlock/tattoo/tattoo_map.h
@@ -51,7 +51,7 @@ private:
int _bgFound, _oldBgFound;
WidgetMapTooltip _mapTooltip;
Common::Point _targetScroll;
-
+
/**
* Load data needed for the map
*/
diff --git a/engines/sherlock/tattoo/tattoo_people.cpp b/engines/sherlock/tattoo/tattoo_people.cpp
index 65cc283b66..fc3c2e6574 100644
--- a/engines/sherlock/tattoo/tattoo_people.cpp
+++ b/engines/sherlock/tattoo/tattoo_people.cpp
@@ -197,7 +197,7 @@ void TattooPerson::adjustSprite() {
// See if the player has come to a stop after clicking on an Arrow zone to leave the scene.
// If so, this will set up the exit information for the scene transition
if (!_walkCount && ui._exitZone != -1 && scene._walkedInScene && scene._goToScene == -1 &&
- !_description.compareToIgnoreCase(people[HOLMES]._description)) {
+ !_description.compareToIgnoreCase(people[HOLMES]._description)) {
Exit &exit = scene._exits[ui._exitZone];
scene._goToScene = exit._scene;
@@ -221,7 +221,7 @@ void TattooPerson::gotoStand() {
_walkCount = 0;
int oldFacing = _sequenceNumber;
- // If the person was talking or listening, just return it to the standing sequence
+ // If the person was talking or listening, just return it to the standing sequence
// in the direction they were pointing
if (_sequenceNumber >= TALK_UPRIGHT && _sequenceNumber <= LISTEN_UPLEFT) {
switch (_sequenceNumber) {
@@ -269,7 +269,7 @@ void TattooPerson::gotoStand() {
return;
}
- // If the sprite that is stopping is an NPC and he is supposed to face a certain direction
+ // If the sprite that is stopping is an NPC and he is supposed to face a certain direction
// when he stops, set that direction here
int npc = -1;
for (int idx = 1; idx < MAX_CHARACTERS; ++idx) {
@@ -317,7 +317,7 @@ void TattooPerson::gotoStand() {
}
}
- // Only restart the frame number at 0 if the new sequence is different from the last sequence
+ // Only restart the frame number at 0 if the new sequence is different from the last sequence
// so we don't let Holmes repeat standing.
if (_oldWalkSequence != -1) {
if (_seqTo) {
@@ -356,7 +356,7 @@ void TattooPerson::setWalking() {
Common::Point diagSpeed(MAX(WALK_SPEED_DIAG_X[scene._currentScene - 1] * SCALE_THRESHOLD / scaleVal, 2),
MAX((WALK_SPEED_Y[scene._currentScene - 1] - 2) * SCALE_THRESHOLD / scaleVal, 2));
- // If the player is already close to the given destination that no walking is needed,
+ // If the player is already close to the given destination that no walking is needed,
// move to the next straight line segment in the overall walking route, if there is one
for (;;) {
if (_centerWalk || !_walkTo.empty()) {
@@ -505,7 +505,7 @@ void TattooPerson::setWalking() {
if (!_walkCount && _walkTo.empty())
gotoStand();
- // If the sequence is the same as when we started, then Holmes was standing still and we're trying
+ // If the sequence is the same as when we started, then Holmes was standing still and we're trying
// to re-stand him, so reset Holmes' rame to the old frame number from before it was reset to 0
if (_sequenceNumber == oldDirection)
_frameNumber = oldFrame;
@@ -536,7 +536,7 @@ void TattooPerson::walkToCoords(const Point32 &destPos, int destDir) {
_centerWalk = false;
// Only move the person if they're going an appreciable distance
- if (ABS(_walkDest.x - (_position.x / FIXED_INT_MULTIPLIER)) > 8 ||
+ if (ABS(_walkDest.x - (_position.x / FIXED_INT_MULTIPLIER)) > 8 ||
ABS(_walkDest.y - (_position.y / FIXED_INT_MULTIPLIER)) > 4) {
goAllTheWay();
@@ -631,7 +631,7 @@ void TattooPerson::updateNPC() {
// Now see if we need to update the NPC's frame sequence so that he faces Holmes
if (_lookHolmes) {
- // See where Holmes is with respect to the NPC (x coordinate)
+ // See where Holmes is with respect to the NPC (x coordinate)
_npcFacing = (people[HOLMES]._position.x < _position.x) ? STOP_LEFT : STOP_RIGHT;
// See where Holmes is with respect to the NPC (y coordinate)
@@ -643,7 +643,7 @@ void TattooPerson::updateNPC() {
_npcFacing = (_npcFacing == STOP_RIGHT) ? STOP_DOWNRIGHT : STOP_DOWNLEFT;
}
- // See if we need to set the old_walk_sequence so the NPC will put his arms
+ // See if we need to set the old_walk_sequence so the NPC will put his arms
// up if he turns another way
if (_sequenceNumber != _npcFacing)
_oldWalkSequence = _sequenceNumber;
@@ -660,7 +660,7 @@ void TattooPerson::updateNPC() {
if (!_npcPath[_npcIndex])
_npcIndex = 0;
- // The NPC is stopped and any pause he was doing is done. We can now see what
+ // The NPC is stopped and any pause he was doing is done. We can now see what
// the next command in the NPC path is.
// Scan Past any NPC Path Labels since they do nothing except mark places for If's and Goto's
@@ -725,7 +725,7 @@ void TattooPerson::updateNPC() {
}
case NPCPATH_TAKE_NOTES:
- // Set the NPC to Pause where he is and set his frame sequences
+ // Set the NPC to Pause where he is and set his frame sequences
// so he takes notes while he's paused
_npcPause = (_npcPath[_npcIndex + 1] - 1) * 256 + _npcPath[_npcIndex + 2] - 1;
_npcIndex += 3;
@@ -875,7 +875,7 @@ Common::Point TattooPerson::getSourcePoint() const {
TattooScene &scene = *(TattooScene *)_vm->_scene;
int scaleVal = scene.getScaleVal(_position);
- return Common::Point(_position.x / FIXED_INT_MULTIPLIER +
+ return Common::Point(_position.x / FIXED_INT_MULTIPLIER +
(_imageFrame ? _imageFrame->sDrawXSize(scaleVal) / 2 : 0), _position.y / FIXED_INT_MULTIPLIER);
}
@@ -1028,7 +1028,7 @@ void TattooPerson::walkHolmesToNPC() {
// Clear the path variables
memset(_npcPath, 0, 100);
-
+
// Set the NPC path so he pauses for 250 while looking at Holmes
_npcPath[0] = 6;
_npcPath[1] = 1;
@@ -1426,7 +1426,7 @@ bool TattooPeople::loadWalk() {
// Load the walk sequence data
Common::SeekableReadStream *stream = res.load(fname, _useWalkLib ? "walk.lib" : "vgs.lib");
-
+
person._walkSequences.resize(stream->readByte());
for (uint seqNum = 0; seqNum < person._walkSequences.size(); ++seqNum)
diff --git a/engines/sherlock/tattoo/tattoo_people.h b/engines/sherlock/tattoo/tattoo_people.h
index c844d86e19..1517084c1c 100644
--- a/engines/sherlock/tattoo/tattoo_people.h
+++ b/engines/sherlock/tattoo/tattoo_people.h
@@ -64,7 +64,7 @@ enum TattooSequences {
TALK_UPLEFT = 21,
// NPC Listen Sequence Numbers
- LISTEN_UPRIGHT = 22,
+ LISTEN_UPRIGHT = 22,
LISTEN_RIGHT = 23,
LISTEN_DOWNRIGHT = 24,
LISTEN_DOWNLEFT = 25,
@@ -160,7 +160,7 @@ public:
* This means that the index must be decremented by 3
* 2) The NPC was in route to a position
* He must be set to walk to that position again. This is done by moving the path index
- * so that it points to the code that set the NPC walking there in the first place.
+ * so that it points to the code that set the NPC walking there in the first place.
* The regular calls to updateNPC will handle the rest
*/
void pullNPCPath();
@@ -262,10 +262,10 @@ public:
virtual const Common::Point restrictToZone(int zoneId, const Common::Point &destPos);
/**
- * If the specified speaker is a background object, it will set it so that it uses
- * the Listen Sequence (specified by the sequence number). If the current sequence
- * has an Allow Talk Code in it, the _gotoSeq field will be set so that the object
- * begins listening as soon as it hits the Allow Talk Code. If there is no Abort Code,
+ * If the specified speaker is a background object, it will set it so that it uses
+ * the Listen Sequence (specified by the sequence number). If the current sequence
+ * has an Allow Talk Code in it, the _gotoSeq field will be set so that the object
+ * begins listening as soon as it hits the Allow Talk Code. If there is no Abort Code,
* the Listen Sequence will begin immediately.
* @param speaker Who is speaking
* @param sequenceNum Which listen sequence to use
diff --git a/engines/sherlock/tattoo/tattoo_resources.cpp b/engines/sherlock/tattoo/tattoo_resources.cpp
index 4b73356d58..6247750911 100644
--- a/engines/sherlock/tattoo/tattoo_resources.cpp
+++ b/engines/sherlock/tattoo/tattoo_resources.cpp
@@ -27,7 +27,7 @@ namespace Sherlock {
namespace Tattoo {
-const PeopleData PEOPLE_DATA[TATTOO_MAX_PEOPLE] = {
+const PeopleData PEOPLE_DATA[TATTOO_MAX_PEOPLE] = {
{ "HOLM", kFixedText_People_SherlockHolmes },
{ "WATS", kFixedText_People_DrWatson },
{ "HUDS", kFixedText_People_MrsHudson },
diff --git a/engines/sherlock/tattoo/tattoo_scene.cpp b/engines/sherlock/tattoo/tattoo_scene.cpp
index 00015cb189..628e8a3b7a 100644
--- a/engines/sherlock/tattoo/tattoo_scene.cpp
+++ b/engines/sherlock/tattoo/tattoo_scene.cpp
@@ -49,7 +49,7 @@ struct ShapeEntry {
_shape(nullptr), _person(person), _yp(yp), _isAnimation(false), _ordering(ordering) {}
ShapeEntry(Object *shape, int yp, int ordering) :
_shape(shape), _person(nullptr), _yp(yp), _isAnimation(false), _ordering(ordering) {}
- ShapeEntry(int yp, int ordering) :
+ ShapeEntry(int yp, int ordering) :
_shape(nullptr), _person(nullptr), _yp(yp), _isAnimation(true), _ordering(ordering) {}
};
typedef Common::List<ShapeEntry> ShapeList;
@@ -99,7 +99,7 @@ bool TattooScene::loadScene(const Common::String &filename) {
// If it's a new song, then start it up
if (music._currentSongName.compareToIgnoreCase(music._nextSongName)) {
- // WORKAROUND: Stop playing music after Diogenes fire scene in the intro,
+ // WORKAROUND: Stop playing music after Diogenes fire scene in the intro,
// since it overlaps slightly into the next scene
if (talk._scriptName == "prol80p" && _currentScene == 80) {
music.stopMusic();
@@ -361,7 +361,7 @@ void TattooScene::doBgAnim() {
if (people[idx]._type == CHARACTER)
people[idx].checkSprite();
}
-
+
for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
if (_bgShapes[idx]._type == ACTIVE_BG_SHAPE)
_bgShapes[idx].checkObject();
@@ -539,10 +539,10 @@ void TattooScene::doBgAnimDrawSprites() {
if (obj._type == ACTIVE_BG_SHAPE || obj._type == REMOVE) {
if (_goToScene == -1) {
if (obj._scaleVal == SCALE_THRESHOLD)
- screen.flushImage(obj._imageFrame, obj._position, &obj._oldPosition.x, &obj._oldPosition.y,
+ screen.flushImage(obj._imageFrame, obj._position, &obj._oldPosition.x, &obj._oldPosition.y,
&obj._oldSize.x, &obj._oldSize.y);
else
- screen.flushScaleImage(obj._imageFrame, obj._position, &obj._oldPosition.x, &obj._oldPosition.y,
+ screen.flushScaleImage(obj._imageFrame, obj._position, &obj._oldPosition.x, &obj._oldPosition.y,
&obj._oldSize.x, &obj._oldSize.y, obj._scaleVal);
if (obj._type == REMOVE)
@@ -595,7 +595,7 @@ int TattooScene::getScaleVal(const Point32 &pt) {
}
}
- // If it wasn't found, we may be off screen to the left or right, so find the scale zone
+ // If it wasn't found, we may be off screen to the left or right, so find the scale zone
// that would apply to the y val passed in disregarding the x
if (!found) {
for (uint idx = 0; idx < _scaleZones.size() && !found; ++idx) {
@@ -659,7 +659,7 @@ int TattooScene::startCAnim(int cAnimNum, int playRate) {
if (ui._windowOpen)
ui.banishWindow();
-
+
// Open up the room resource file and get the data for the animation
Common::SeekableReadStream *stream = res.load(_roomFilename);
stream->seek(44 + cAnimNum * 4);
@@ -768,7 +768,7 @@ int TattooScene::findBgShape(const Common::Point &pt) {
for (int idx = (int)_bgShapes.size() - 1; idx >= 0 && result == -1; --idx) {
Object &o = _bgShapes[idx];
- if (o._type != INVALID && o._type != NO_SHAPE && o._type != HIDDEN &&
+ if (o._type != INVALID && o._type != NO_SHAPE && o._type != HIDDEN &&
(o._aType <= PERSON || (ui._menuMode == LAB_MODE && o._aType == SOLID))) {
if (o.getNewBounds().contains(pt))
result = idx;
diff --git a/engines/sherlock/tattoo/tattoo_talk.cpp b/engines/sherlock/tattoo/tattoo_talk.cpp
index e6b9a9627e..8eda7368ea 100644
--- a/engines/sherlock/tattoo/tattoo_talk.cpp
+++ b/engines/sherlock/tattoo/tattoo_talk.cpp
@@ -34,7 +34,7 @@ namespace Tattoo {
static const uint8 DIRECTION_CONVERSION[] = {
WALK_RIGHT, WALK_DOWN, WALK_LEFT, WALK_UP, STOP_RIGHT, STOP_DOWN, STOP_LEFT, STOP_UP,
- WALK_UPRIGHT, WALK_DOWNRIGHT, WALK_UPLEFT, WALK_DOWNLEFT, STOP_UPRIGHT, STOP_UPLEFT,
+ WALK_UPRIGHT, WALK_DOWNRIGHT, WALK_UPLEFT, WALK_DOWNLEFT, STOP_UPRIGHT, STOP_UPLEFT,
STOP_DOWNRIGHT, STOP_DOWNLEFT
};
@@ -254,7 +254,7 @@ OpcodeReturn TattooTalk::cmdSwitchSpeaker(const byte *&str) {
return RET_EXIT;
ui.clearWindow();
-
+
_yp = screen.fontHeight() + 11;
_charCount = _line = 0;
@@ -267,7 +267,7 @@ OpcodeReturn TattooTalk::cmdSwitchSpeaker(const byte *&str) {
return RET_SUCCESS;
}
-OpcodeReturn TattooTalk::cmdMouseOnOff(const byte *&str) {
+OpcodeReturn TattooTalk::cmdMouseOnOff(const byte *&str) {
Events &events = *_vm->_events;
bool mouseOn = *++str == 2;
if (mouseOn)
@@ -286,7 +286,7 @@ OpcodeReturn TattooTalk::cmdWalkHolmesToCoords(const byte *&str) {
// Negative X
xp = -1 * (xp - 16384);
int yp = (str[2] - 1) * 256 + str[3] - 1;
-
+
people[HOLMES].walkToCoords(Point32(xp * FIXED_INT_MULTIPLIER, yp * FIXED_INT_MULTIPLIER),
DIRECTION_CONVERSION[str[4] - 1]);
@@ -352,7 +352,7 @@ OpcodeReturn TattooTalk::cmdNPCLabelGoto(const byte *&str) {
int npcNum = *++str;
TattooPeople &people = *(TattooPeople *)_vm->_people;
TattooPerson &person = people[npcNum];
-
+
if (person._resetNPCPath) {
person._npcIndex = person._npcPause = 0;
person._resetNPCPath = false;
@@ -371,7 +371,7 @@ OpcodeReturn TattooTalk::cmdNPCLabelIfFlagGoto(const byte *&str) {
int npcNum = *++str;
TattooPeople &people = *(TattooPeople *)_vm->_people;
TattooPerson &person = people[npcNum];
-
+
if (person._resetNPCPath) {
person._npcIndex = person._npcPause = 0;
person._resetNPCPath = false;
@@ -392,7 +392,7 @@ OpcodeReturn TattooTalk::cmdNPCLabelSet(const byte *&str) {
int npcNum = *++str;
TattooPeople &people = *(TattooPeople *)_vm->_people;
TattooPerson &person = people[npcNum];
-
+
if (person._resetNPCPath) {
person._npcIndex = person._npcPause = 0;
person._resetNPCPath = false;
@@ -413,7 +413,7 @@ OpcodeReturn TattooTalk::cmdPassword(const byte *&str) {
return RET_EXIT;
}
-OpcodeReturn TattooTalk::cmdPlaySong(const byte *&str) {
+OpcodeReturn TattooTalk::cmdPlaySong(const byte *&str) {
Music &music = *_vm->_music;
Common::String currentSong = music._currentSongName;
@@ -498,7 +498,7 @@ OpcodeReturn TattooTalk::cmdSetNPCOff(const byte *&str) {
return RET_SUCCESS;
}
-OpcodeReturn TattooTalk::cmdSetNPCOn(const byte *&str) {
+OpcodeReturn TattooTalk::cmdSetNPCOn(const byte *&str) {
TattooPeople &people = *(TattooPeople *)_vm->_people;
int npcNum = *++str;
people[npcNum]._type = CHARACTER;
@@ -510,7 +510,7 @@ OpcodeReturn TattooTalk::cmdSetNPCPathDest(const byte *&str) {
int npcNum = *++str;
TattooPeople &people = *(TattooPeople *)_vm->_people;
TattooPerson &person = people[npcNum];
-
+
if (person._resetNPCPath) {
person._npcIndex = person._npcPause = 0;
person._resetNPCPath = false;
@@ -532,7 +532,7 @@ OpcodeReturn TattooTalk::cmdSetNPCPathPause(const byte *&str) {
int npcNum = *++str;
TattooPeople &people = *(TattooPeople *)_vm->_people;
TattooPerson &person = people[npcNum];
-
+
if (person._resetNPCPath) {
person._npcIndex = person._npcPause = 0;
person._resetNPCPath = false;
@@ -553,7 +553,7 @@ OpcodeReturn TattooTalk::cmdSetNPCPathPauseTakingNotes(const byte *&str) {
int npcNum = *++str;
TattooPeople &people = *(TattooPeople *)_vm->_people;
TattooPerson &person = people[npcNum];
-
+
if (person._resetNPCPath) {
person._npcIndex = person._npcPause = 0;
person._resetNPCPath = false;
@@ -574,7 +574,7 @@ OpcodeReturn TattooTalk::cmdSetNPCPathPauseLookingHolmes(const byte *&str) {
int npcNum = *++str;
TattooPeople &people = *(TattooPeople *)_vm->_people;
TattooPerson &person = people[npcNum];
-
+
if (person._resetNPCPath) {
person._npcIndex = person._npcPause = 0;
person._resetNPCPath = false;
@@ -600,7 +600,7 @@ OpcodeReturn TattooTalk::cmdSetNPCPosition(const byte *&str) {
if (posX > 16384)
posX = -1 * (posX - 16384);
int posY = (str[2] - 1) * 256 + str[3] - 1;
-
+
person._position = Point32(posX * FIXED_INT_MULTIPLIER, posY * FIXED_INT_MULTIPLIER);
if (person._seqTo && person._walkLoaded) {
person._walkSequences[person._sequenceNumber]._sequences[person._frameNumber] = person._seqTo;
@@ -637,7 +637,7 @@ OpcodeReturn TattooTalk::cmdSetNPCTalkFile(const byte *&str) {
int npcNum = *++str;
TattooPeople &people = *(TattooPeople *)_vm->_people;
TattooPerson &person = people[npcNum];
-
+
if (person._resetNPCPath) {
person._npcIndex = person._npcPause = 0;
person._resetNPCPath = false;
@@ -691,7 +691,7 @@ OpcodeReturn TattooTalk::cmdSetNPCVerbScript(const byte *&str) {
int verbNum = *++str - 1;
TattooPeople &people = *(TattooPeople *)_vm->_people;
UseType &useType = people[npcNum]._use[verbNum];
-
+
Common::String &name = useType._names[0];
name = "*C";
@@ -775,7 +775,7 @@ OpcodeReturn TattooTalk::cmdSetTalkSequence(const byte *&str) {
people.setTalkSequence(speaker, sequenceNumber);
else
people.setListenSequence(speaker, sequenceNumber);
-
+
str += 2;
return RET_SUCCESS;
@@ -785,7 +785,7 @@ OpcodeReturn TattooTalk::cmdSetWalkControl(const byte *&str) {
TattooPeople &people = *(TattooPeople *)_vm->_people;
++str;
people._walkControl = str[0] - 1;
-
+
return RET_SUCCESS;
}
@@ -958,7 +958,7 @@ void TattooTalk::pullSequence(int slot) {
// Check for an entry in this slot
if (seq._obj) {
Object &o = *seq._obj;
-
+
// See if we're not supposed to restore it until an Allow Talk Interrupt
if (slot == -1 && seq._obj->hasAborts()) {
seq._obj->_gotoSeq = -1;
diff --git a/engines/sherlock/tattoo/tattoo_talk.h b/engines/sherlock/tattoo/tattoo_talk.h
index 9b010513dc..b1e294725d 100644
--- a/engines/sherlock/tattoo/tattoo_talk.h
+++ b/engines/sherlock/tattoo/tattoo_talk.h
@@ -103,7 +103,7 @@ protected:
public:
TattooTalk(SherlockEngine *vm);
virtual ~TattooTalk() {}
-
+
/**
* Called whenever a conversation or item script needs to be run. For standard conversations,
* it opens up a description window similar to how 'talk' does, but shows a 'reply' directly
diff --git a/engines/sherlock/tattoo/tattoo_user_interface.cpp b/engines/sherlock/tattoo/tattoo_user_interface.cpp
index 677a662535..1cb0220bba 100644
--- a/engines/sherlock/tattoo/tattoo_user_interface.cpp
+++ b/engines/sherlock/tattoo/tattoo_user_interface.cpp
@@ -42,7 +42,7 @@ bool WidgetList::contains(const WidgetBase *item) const {
/*-------------------------------------------------------------------------*/
TattooUserInterface::TattooUserInterface(SherlockEngine *vm): UserInterface(vm),
- _inventoryWidget(vm), _messageWidget(vm), _textWidget(vm), _tooltipWidget(vm),
+ _inventoryWidget(vm), _messageWidget(vm), _textWidget(vm), _tooltipWidget(vm),
_verbsWidget(vm), _creditsWidget(vm), _optionsWidget(vm), _quitWidget(vm) {
Common::fill(&_lookupTable[0], &_lookupTable[PALETTE_COUNT], 0);
Common::fill(&_lookupTable1[0], &_lookupTable1[PALETTE_COUNT], 0);
@@ -126,7 +126,7 @@ void TattooUserInterface::lookAtObject() {
name.deleteLastChar();
// See if this Object Sound List entry matches the object's name
- if (!_bgShape->_name.compareToIgnoreCase(name)) {
+ if (!_bgShape->_name.compareToIgnoreCase(name)) {
// Move forward to get the sound filename
while ((*p == ' ') || (*p == '='))
++p;
@@ -266,7 +266,7 @@ void TattooUserInterface::handleInput() {
if (_lockoutTimer)
--_lockoutTimer;
-
+
// Key handling
if (events.kbHit()) {
_keyState = events.getKey();
@@ -416,7 +416,7 @@ void TattooUserInterface::doStandardControl() {
if (vm.readFlags(FLAG_PLAYER_IS_HOLMES)) {
freeMenu();
doJournal();
-
+
// See if we're in a Lab Table Room
_menuMode = (scene._labTableScene) ? LAB_MODE : STD_MODE;
return;
@@ -573,7 +573,7 @@ void TattooUserInterface::displayObjectNames() {
void TattooUserInterface::doInventory(int mode) {
People &people = *_vm->_people;
people[HOLMES].gotoStand();
-
+
_inventoryWidget.load(mode);
_inventoryWidget.summonWindow();
@@ -661,7 +661,7 @@ void TattooUserInterface::putMessage(const char *formatStr, ...) {
void TattooUserInterface::setupBGArea(const byte cMap[PALETTE_SIZE]) {
Scene &scene = *_vm->_scene;
- // This requires that there is a 16 grayscale palette sequence in the palette that goes from lighter
+ // This requires that there is a 16 grayscale palette sequence in the palette that goes from lighter
// to darker as the palette numbers go up. The last palette entry in that run is specified by _bgColor
byte *p = &_lookupTable[0];
for (int idx = 0; idx < PALETTE_COUNT; ++idx)
@@ -693,7 +693,7 @@ void TattooUserInterface::setupBGArea(const byte cMap[PALETTE_SIZE]) {
g = cMap[idx * 3 + 1] * 4 / 3;
b = cMap[idx * 3 + 2] * 4 / 3;
break;
-
+
default:
r = g = b = 0;
break;
@@ -703,7 +703,7 @@ void TattooUserInterface::setupBGArea(const byte cMap[PALETTE_SIZE]) {
int cd = 99999;
for (int pal = 0; pal < PALETTE_COUNT; ++pal) {
- int d = (r - cMap[pal * 3]) * (r - cMap[pal * 3]) + (g - cMap[pal * 3 + 1]) * (g - cMap[pal * 3 + 1]) +
+ int d = (r - cMap[pal * 3]) * (r - cMap[pal * 3]) + (g - cMap[pal * 3 + 1]) * (g - cMap[pal * 3 + 1]) +
(b - cMap[pal * 3 + 2]) * (b - cMap[pal * 3 + 2]);
if (d < cd) {
@@ -722,12 +722,12 @@ void TattooUserInterface::doBgAnimEraseBackground() {
People &people = *_vm->_people;
Scene &scene = *_vm->_scene;
Screen &screen = *_vm->_screen;
-
+
static const int16 OFFSETS[16] = { -1, -2, -3, -3, -2, -1, -1, 0, 1, 2, 3, 3, 2, 1, 0, 0 };
if (_mask != nullptr) {
// Since a mask is active, restore the screen from the secondary back buffer prior to applying the mask
- screen._backBuffer1.SHblitFrom(screen._backBuffer2, screen._currentScroll, Common::Rect(screen._currentScroll.x, 0,
+ screen._backBuffer1.SHblitFrom(screen._backBuffer2, screen._currentScroll, Common::Rect(screen._currentScroll.x, 0,
screen._currentScroll.x + SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT));
switch (scene._currentScene) {
@@ -768,7 +768,7 @@ void TattooUserInterface::doBgAnimEraseBackground() {
} else {
// Standard scene without mask, so call user interface to erase any UI elements as necessary
doBgAnimRestoreUI();
-
+
// Restore background for any areas covered by characters and shapes
for (int idx = 0; idx < MAX_CHARACTERS; ++idx)
screen.restoreBackground(Common::Rect(people[idx]._oldPosition.x, people[idx]._oldPosition.y,
@@ -776,10 +776,10 @@ void TattooUserInterface::doBgAnimEraseBackground() {
for (uint idx = 0; idx < scene._bgShapes.size(); ++idx) {
Object &obj = scene._bgShapes[idx];
-
- if ((obj._type == ACTIVE_BG_SHAPE && (obj._maxFrames > 1 || obj._delta.x != 0 || obj._delta.y != 0)) ||
+
+ if ((obj._type == ACTIVE_BG_SHAPE && (obj._maxFrames > 1 || obj._delta.x != 0 || obj._delta.y != 0)) ||
obj._type == HIDE_SHAPE || obj._type == REMOVE)
- screen._backBuffer1.SHblitFrom(screen._backBuffer2, obj._oldPosition,
+ screen._backBuffer1.SHblitFrom(screen._backBuffer2, obj._oldPosition,
Common::Rect(obj._oldPosition.x, obj._oldPosition.y, obj._oldPosition.x + obj._oldSize.x,
obj._oldPosition.y + obj._oldSize.y));
}
@@ -801,10 +801,10 @@ void TattooUserInterface::doBgAnimEraseBackground() {
}
// Adjust the Target Scroll if needed
- if ((people[people._walkControl]._position.x / FIXED_INT_MULTIPLIER - screen._currentScroll.x) <
+ if ((people[people._walkControl]._position.x / FIXED_INT_MULTIPLIER - screen._currentScroll.x) <
(SHERLOCK_SCREEN_WIDTH / 8) && people[people._walkControl]._delta.x < 0) {
-
- _targetScroll.x = (short)(people[people._walkControl]._position.x / FIXED_INT_MULTIPLIER -
+
+ _targetScroll.x = (short)(people[people._walkControl]._position.x / FIXED_INT_MULTIPLIER -
SHERLOCK_SCREEN_WIDTH / 8 - 250);
if (_targetScroll.x < 0)
_targetScroll.x = 0;
@@ -812,7 +812,7 @@ void TattooUserInterface::doBgAnimEraseBackground() {
if ((people[people._walkControl]._position.x / FIXED_INT_MULTIPLIER - screen._currentScroll.x) >
(SHERLOCK_SCREEN_WIDTH / 4 * 3) && people[people._walkControl]._delta.x > 0)
- _targetScroll.x = (short)(people[people._walkControl]._position.x / FIXED_INT_MULTIPLIER -
+ _targetScroll.x = (short)(people[people._walkControl]._position.x / FIXED_INT_MULTIPLIER -
SHERLOCK_SCREEN_WIDTH / 4 * 3 + 250);
if (_targetScroll.x > _scrollSize)
diff --git a/engines/sherlock/tattoo/tattoo_user_interface.h b/engines/sherlock/tattoo/tattoo_user_interface.h
index d89da4a6da..28e41219bf 100644
--- a/engines/sherlock/tattoo/tattoo_user_interface.h
+++ b/engines/sherlock/tattoo/tattoo_user_interface.h
@@ -42,7 +42,7 @@ namespace Sherlock {
namespace Tattoo {
// Button width/height
-#define BUTTON_SIZE 15
+#define BUTTON_SIZE 15
// How long to play the intro before it can be skipped
#define STARTUP_KEYS_DISABLED_DELAY 200
@@ -241,7 +241,7 @@ public:
/**
* Draw the user interface onto the screen's back buffers
- */
+ */
virtual void drawInterface(int bufferNum = 3);
/**
diff --git a/engines/sherlock/tattoo/widget_base.cpp b/engines/sherlock/tattoo/widget_base.cpp
index a35f4e5d74..eab8e3217a 100644
--- a/engines/sherlock/tattoo/widget_base.cpp
+++ b/engines/sherlock/tattoo/widget_base.cpp
@@ -106,7 +106,7 @@ void WidgetBase::draw() {
if (_bounds.width() > 0 && !_surface.empty()) {
// Get the area to draw, adjusted for scroll position
restrictToScreen();
-
+
// Draw the background for the widget
drawBackground();
@@ -146,7 +146,7 @@ Common::String WidgetBase::splitLines(const Common::String &str, Common::StringA
const char *lineStartP = strP;
// Find how many characters will fit on the next line
- while (width < maxWidth && *strP && ((byte)*strP < talk._opcodes[OP_SWITCH_SPEAKER] ||
+ while (width < maxWidth && *strP && ((byte)*strP < talk._opcodes[OP_SWITCH_SPEAKER] ||
(byte)*strP == talk._opcodes[OP_NULL])) {
width += _surface.charWidth(*strP);
@@ -156,7 +156,7 @@ Common::String WidgetBase::splitLines(const Common::String &str, Common::StringA
++strP;
}
- // If the line was too wide to fit on a single line, go back to the last space
+ // If the line was too wide to fit on a single line, go back to the last space
// if there was one, or otherwise simply break the line at this point
if (width >= maxWidth && spaceP != nullptr)
strP = spaceP;
@@ -167,7 +167,7 @@ Common::String WidgetBase::splitLines(const Common::String &str, Common::StringA
// Move the string ahead to the next line
if (*strP == ' ' || *strP == 13)
++strP;
- } while (*strP && (lines.size() < maxLines) && ((byte)*strP < talk._opcodes[OP_SWITCH_SPEAKER]
+ } while (*strP && (lines.size() < maxLines) && ((byte)*strP < talk._opcodes[OP_SWITCH_SPEAKER]
|| (byte)*strP == talk._opcodes[OP_NULL]));
// Return any remaining text left over
@@ -266,7 +266,7 @@ void WidgetBase::drawScrollBar(int index, int pageSize, int count) {
// Draw the scroll position bar
int barHeight = (r.height() - BUTTON_SIZE * 2) * pageSize / count;
barHeight = CLIP(barHeight, BUTTON_SIZE, r.height() - BUTTON_SIZE * 2);
- int barY = (count <= pageSize) ? r.top + BUTTON_SIZE : r.top + BUTTON_SIZE +
+ int barY = (count <= pageSize) ? r.top + BUTTON_SIZE : r.top + BUTTON_SIZE +
(r.height() - BUTTON_SIZE * 2 - barHeight) * index / (count - pageSize);
_surface.fillRect(Common::Rect(r.left + 2, barY + 2, r.right - 2, barY + barHeight - 3), INFO_MIDDLE);
diff --git a/engines/sherlock/tattoo/widget_credits.cpp b/engines/sherlock/tattoo/widget_credits.cpp
index 1c878daaf6..fa1ac6fbae 100644
--- a/engines/sherlock/tattoo/widget_credits.cpp
+++ b/engines/sherlock/tattoo/widget_credits.cpp
@@ -49,7 +49,7 @@ void WidgetCredits::initCredits() {
const char *p = line.c_str() + 12;
while ((*p < '0') || (*p > '9'))
p++;
-
+
_creditSpeed = atoi(p);
} else if (line.hasPrefix("Y Spacing")) {
const char *p = line.c_str() + 12;
@@ -73,7 +73,7 @@ void WidgetCredits::initCredits() {
if (p != nullptr && p[1] == '>') {
cl._line2 = Common::String(p + 3);
cl._line = Common::String(cl._line.c_str(), p);
-
+
int width = cl._width;
int width1 = screen.stringWidth(cl._line);
int width2 = screen.stringWidth(cl._line2);
diff --git a/engines/sherlock/tattoo/widget_files.cpp b/engines/sherlock/tattoo/widget_files.cpp
index 7666e81480..5e877c53f4 100644
--- a/engines/sherlock/tattoo/widget_files.cpp
+++ b/engines/sherlock/tattoo/widget_files.cpp
@@ -54,7 +54,7 @@ void WidgetFiles::show(SaveMode mode) {
createSavegameList();
// Set up the display area
- _bounds = Common::Rect(SHERLOCK_SCREEN_WIDTH * 2 / 3, (_surface.fontHeight() + 1) *
+ _bounds = Common::Rect(SHERLOCK_SCREEN_WIDTH * 2 / 3, (_surface.fontHeight() + 1) *
(FILES_LINES_COUNT + 1) + 17);
_bounds.moveTo(mousePos.x - _bounds.width() / 2, mousePos.y - _bounds.height() / 2);
@@ -141,7 +141,7 @@ void WidgetFiles::render(FilesRenderMode mode) {
int xp = _surface.stringWidth("00.") + _surface.widestChar() + 5;
int yp = _surface.fontHeight() + 14;
-
+
for (int idx = _savegameIndex; idx < (_savegameIndex + FILES_LINES_COUNT); ++idx) {
if (idx == _selector && mode != RENDER_ALL)
color = COMMAND_HIGHLIGHTED;
@@ -150,7 +150,7 @@ void WidgetFiles::render(FilesRenderMode mode) {
if (mode == RENDER_NAMES_AND_SCROLLBAR)
_surface.fillRect(Common::Rect(4, yp, _surface.width() - BUTTON_SIZE - 9, yp + _surface.fontHeight()), TRANSPARENCY);
-
+
Common::String numStr = Common::String::format("%d.", idx + 1);
_surface.writeString(numStr, Common::Point(_surface.widestChar(), yp), color);
_surface.writeString(_savegames[idx], Common::Point(xp, yp), color);
@@ -170,7 +170,7 @@ void WidgetFiles::handleEvents() {
Common::KeyState keyState = ui._keyState;
// Handle scrollbar events
- ScrollHighlight oldHighlight = ui._scrollHighlight;
+ ScrollHighlight oldHighlight = ui._scrollHighlight;
handleScrollbarEvents(_savegameIndex, FILES_LINES_COUNT, _savegames.size());
int oldScrollIndex = _savegameIndex;
@@ -258,11 +258,11 @@ bool WidgetFiles::getFilename() {
assert(_selector != -1);
Common::Point pt(_surface.stringWidth("00.") + _surface.widestChar() + 5,
_surface.fontHeight() + 14 + (_selector - _savegameIndex) * (_surface.fontHeight() + 1));
-
+
Common::String numStr = Common::String::format("%d.", _selector + 1);
_surface.writeString(numStr, Common::Point(_surface.widestChar(), pt.y), COMMAND_HIGHLIGHTED);
- Common::String filename = _savegames[_selector];
+ Common::String filename = _savegames[_selector];
if (isSlotEmpty(_selector)) {
index = 0;
@@ -328,7 +328,7 @@ bool WidgetFiles::getFilename() {
_surface.writeString(filename.c_str() + index, pt, COMMAND_HIGHLIGHTED);
} else if ((keyState.keycode == Common::KEYCODE_LEFT && index > 0)
- || (keyState.keycode == Common::KEYCODE_RIGHT && index < 49 && pt.x < (_bounds.right - BUTTON_SIZE - 20))
+ || (keyState.keycode == Common::KEYCODE_RIGHT && index < 49 && pt.x < (_bounds.right - BUTTON_SIZE - 20))
|| (keyState.keycode == Common::KEYCODE_HOME && index > 0)
|| (keyState.keycode == Common::KEYCODE_END)) {
_surface.fillRect(Common::Rect(pt.x, pt.y, pt.x + width, pt.y + _surface.fontHeight()), TRANSPARENCY);
@@ -345,7 +345,7 @@ bool WidgetFiles::getFilename() {
pt.x += _surface.charWidth(filename[index]);
++index;
break;
-
+
case Common::KEYCODE_HOME:
pt.x = _surface.stringWidth("00.") + _surface.widestChar() + 5;
index = 0;
@@ -376,7 +376,7 @@ bool WidgetFiles::getFilename() {
_surface.fillRect(Common::Rect(pt.x, pt.y, _bounds.right - BUTTON_SIZE - 9, pt.y + _surface.fontHeight() - 1), TRANSPARENCY);
_surface.writeString(filename + index, pt, COMMAND_HIGHLIGHTED);
-
+
} else if (keyState.keycode == Common::KEYCODE_RETURN) {
done = 1;
@@ -393,7 +393,7 @@ bool WidgetFiles::getFilename() {
else
filename.setChar(keyState.ascii, index);
- _surface.fillRect(Common::Rect(pt.x, pt.y, _bounds.width() - BUTTON_SIZE - 9,
+ _surface.fillRect(Common::Rect(pt.x, pt.y, _bounds.width() - BUTTON_SIZE - 9,
pt.y + _surface.fontHeight() - 1), TRANSPARENCY);
_surface.writeString(filename.c_str() + index, pt, COMMAND_HIGHLIGHTED);
pt.x += _surface.charWidth(keyState.ascii);
diff --git a/engines/sherlock/tattoo/widget_files.h b/engines/sherlock/tattoo/widget_files.h
index 87106f8edb..a4feb0d6dd 100644
--- a/engines/sherlock/tattoo/widget_files.h
+++ b/engines/sherlock/tattoo/widget_files.h
@@ -50,7 +50,7 @@ private:
* Show the ScummVM Save Game dialog
*/
void showScummVMSaveDialog();
-
+
/**
* Show the ScummVM Load Game dialog
*/
diff --git a/engines/sherlock/tattoo/widget_foolscap.cpp b/engines/sherlock/tattoo/widget_foolscap.cpp
index 8225946838..f5afa56856 100644
--- a/engines/sherlock/tattoo/widget_foolscap.cpp
+++ b/engines/sherlock/tattoo/widget_foolscap.cpp
@@ -125,7 +125,7 @@ void WidgetFoolscap::show() {
// Show the window
summonWindow();
ui._menuMode = FOOLSCAP_MODE;
-}
+}
void WidgetFoolscap::handleEvents() {
Events &events = *_vm->_events;
diff --git a/engines/sherlock/tattoo/widget_inventory.cpp b/engines/sherlock/tattoo/widget_inventory.cpp
index 5e7238680a..24c32f6332 100644
--- a/engines/sherlock/tattoo/widget_inventory.cpp
+++ b/engines/sherlock/tattoo/widget_inventory.cpp
@@ -36,7 +36,7 @@ namespace Tattoo {
#define MAX_INV_COMMANDS 10 // Maximum elements in dialog
#define NUM_INV_PER_LINE 4 // Number of inentory items per line in the dialog
-WidgetInventoryTooltip::WidgetInventoryTooltip(SherlockEngine *vm, WidgetInventory *owner) :
+WidgetInventoryTooltip::WidgetInventoryTooltip(SherlockEngine *vm, WidgetInventory *owner) :
WidgetTooltipBase(vm), _owner(owner) {
}
@@ -100,7 +100,7 @@ void WidgetInventoryTooltip::setText(const Common::String &str) {
_surface.writeFancyString(str, Common::Point(0, 0), BLACK, INFO_TOP);
} else {
int xp, yp;
-
+
xp = (_bounds.width() - _surface.stringWidth(line1) - 2) / 2;
_surface.writeFancyString(line1, Common::Point(xp, 0), BLACK, INFO_TOP);
@@ -110,7 +110,7 @@ void WidgetInventoryTooltip::setText(const Common::String &str) {
}
}
-void WidgetInventoryTooltip::handleEvents() {
+void WidgetInventoryTooltip::handleEvents() {
Events &events = *_vm->_events;
FixedText &fixedText = *_vm->_fixedText;
Inventory &inv = *_vm->_inventory;
@@ -133,7 +133,7 @@ void WidgetInventoryTooltip::handleEvents() {
if (_owner->_invVerbMode == 3) {
select = ui._bgFound;
oldSelect = ui._oldBgFound;
-
+
if (select != -1 && (select != oldSelect || (select != -1 && _surface.empty()))) {
// See if we're pointing at a shape or a sprite
if (select < 1000) {
@@ -143,17 +143,17 @@ void WidgetInventoryTooltip::handleEvents() {
if (_vm->getLanguage() == Common::GR_GRE) {
if (!_owner->_swapItems)
- str = Common::String::format("%s %s %s %s", _owner->_action.c_str(), obj._description.c_str(),
+ str = Common::String::format("%s %s %s %s", _owner->_action.c_str(), obj._description.c_str(),
inv[_owner->_invSelect]._name.c_str(), _owner->_verb.c_str());
else
- str = Common::String::format("%s %s %s %s", _owner->_action.c_str(), inv[_owner->_invSelect]._name.c_str(),
+ str = Common::String::format("%s %s %s %s", _owner->_action.c_str(), inv[_owner->_invSelect]._name.c_str(),
obj._description.c_str(), _owner->_verb.c_str());
} else {
if (_owner->_swapItems)
- str = Common::String::format("%s %s %s %s", _owner->_verb.c_str(), obj._description.c_str(), _owner->_action.c_str(),
+ str = Common::String::format("%s %s %s %s", _owner->_verb.c_str(), obj._description.c_str(), _owner->_action.c_str(),
inv[_owner->_invSelect]._name.c_str());
else
- str = Common::String::format("%s %s %s %s", _owner->_verb.c_str(), inv[_owner->_invSelect]._name.c_str(),
+ str = Common::String::format("%s %s %s %s", _owner->_verb.c_str(), inv[_owner->_invSelect]._name.c_str(),
_owner->_action.c_str(), obj._description.c_str());
}
}
@@ -192,7 +192,7 @@ void WidgetInventoryTooltip::handleEvents() {
select = -1;
} else {
oldSelect = _owner->_invSelect;
-
+
if (select != _owner->_invSelect || _surface.empty()) {
if (_owner->_invMode == 1) {
@@ -249,7 +249,7 @@ void WidgetInventoryTooltip::handleEvents() {
/*----------------------------------------------------------------*/
-WidgetInventoryVerbs::WidgetInventoryVerbs(SherlockEngine *vm, WidgetInventory *owner) :
+WidgetInventoryVerbs::WidgetInventoryVerbs(SherlockEngine *vm, WidgetInventory *owner) :
WidgetBase(vm), _owner(owner) {
_invVerbSelect = _oldInvVerbSelect = -1;
}
@@ -472,7 +472,7 @@ void WidgetInventoryVerbs::highlightControls() {
/*----------------------------------------------------------------*/
-WidgetInventory::WidgetInventory(SherlockEngine *vm) : WidgetBase(vm),
+WidgetInventory::WidgetInventory(SherlockEngine *vm) : WidgetBase(vm),
_tooltipWidget(vm, this), _verbList(vm, this) {
_invMode = 0;
_invVerbMode = 0;
@@ -571,7 +571,7 @@ void WidgetInventory::drawInventory() {
}
}
- drawScrollBar(inv._invIndex / NUM_INV_PER_LINE, NUM_INVENTORY_SHOWN / NUM_INV_PER_LINE,
+ drawScrollBar(inv._invIndex / NUM_INV_PER_LINE, NUM_INVENTORY_SHOWN / NUM_INV_PER_LINE,
(inv._holdings + NUM_INV_PER_LINE - 1) / NUM_INV_PER_LINE);
}
@@ -594,10 +594,10 @@ void WidgetInventory::handleEvents() {
int invIndex = inv._invIndex / NUM_INV_PER_LINE;
ScrollHighlight oldHighlight = ui._scrollHighlight;
- handleScrollbarEvents(invIndex, NUM_INVENTORY_SHOWN / NUM_INV_PER_LINE,
+ handleScrollbarEvents(invIndex, NUM_INVENTORY_SHOWN / NUM_INV_PER_LINE,
(inv._holdings + NUM_INV_PER_LINE - 1) / NUM_INV_PER_LINE);
- handleScrolling(invIndex, NUM_INVENTORY_SHOWN / NUM_INV_PER_LINE,
+ handleScrolling(invIndex, NUM_INVENTORY_SHOWN / NUM_INV_PER_LINE,
(inv._holdings + NUM_INV_PER_LINE - 1) / NUM_INV_PER_LINE);
if (oldScrollIndex != invIndex) {
@@ -665,16 +665,16 @@ void WidgetInventory::handleEvents() {
ui.putMessage("%s", FIXED(NoEffect));
}
} else if ((_outsideMenu && !_bounds.contains(mousePos)) || ui._keyState.keycode == Common::KEYCODE_ESCAPE) {
- // Want to close the window (clicked outside of it). So close the window and return to Standard
+ // Want to close the window (clicked outside of it). So close the window and return to Standard
close();
} else if (_bounds.contains(mousePos)) {
// Mouse button was released inside the inventory window
_outsideMenu = false;
-
+
// See if they are pointing at one of the inventory items
if (_invSelect != -1) {
- // See if they are in Use Obj with Inv. Mode (they right clicked on an item
+ // See if they are in Use Obj with Inv. Mode (they right clicked on an item
// in the room and selected "Use with Inv.")
if (_invMode == 1) {
_tooltipWidget.banishWindow();
@@ -709,13 +709,13 @@ void WidgetInventory::handleEvents() {
_verbList._oldInvVerbSelect = -1;
_tooltipWidget.banishWindow();
- // Keep track of the name of the inventory object so we can check it against the target fields
+ // Keep track of the name of the inventory object so we can check it against the target fields
// of verbs when we activate it
_invTarget = inv[_invSelect]._name;
_swapItems = false;
_verbList.load();
- } else {
+ } else {
// They left clicked on an inventory item, so Look at it
// Check if they are looking at the solved Foolscap
@@ -726,7 +726,7 @@ void WidgetInventory::handleEvents() {
_invVerbMode = 0;
inv.freeInv();
-
+
events.clearEvents();
events.setCursor(ARROW);
ui._menuMode = scene._labTableScene ? LAB_MODE : STD_MODE;
diff --git a/engines/sherlock/tattoo/widget_lab.cpp b/engines/sherlock/tattoo/widget_lab.cpp
index eb32e2e22c..5e6b88df9d 100644
--- a/engines/sherlock/tattoo/widget_lab.cpp
+++ b/engines/sherlock/tattoo/widget_lab.cpp
@@ -93,7 +93,7 @@ void WidgetLab::handleEvents() {
// Show the command list for this object
ui._verbsWidget.load(!noDesc);
} else if (!noDesc) {
- // The player has released on an object, see if they had an object selected
+ // The player has released on an object, see if they had an object selected
// that will be used with this new object
if (_labObject) {
// See if the dragged object can be used with the new object
@@ -150,7 +150,7 @@ void WidgetLab::handleEvents() {
// Set the mouse cursor to the object
Graphics::Surface &img = _labObject->_imageFrame->_frame;
- Common::Point cursorOffset = mousePos - _labObject->_position;
+ Common::Point cursorOffset = mousePos - _labObject->_position;
events.setCursor(ARROW, cursorOffset, img);
ui._tooltipWidget._offsetY = cursorOffset.y;
diff --git a/engines/sherlock/tattoo/widget_options.cpp b/engines/sherlock/tattoo/widget_options.cpp
index 81f50f3bc5..35f1f267dc 100644
--- a/engines/sherlock/tattoo/widget_options.cpp
+++ b/engines/sherlock/tattoo/widget_options.cpp
@@ -192,7 +192,7 @@ void WidgetOptions::handleEvents() {
render(OP_NAMES);
vm.saveConfig();
break;
-
+
case 7:
// Toggle Text Windows
vm._textWindowsOn = !vm._textWindowsOn;
@@ -230,7 +230,7 @@ void WidgetOptions::handleEvents() {
default:
break;
}
-
+
_oldSelector = -1;
}
}
@@ -302,17 +302,17 @@ void WidgetOptions::render(OptionRenderMode mode) {
int num = (_surface.fontHeight() + 4) & 0xfe;
int sliderY = yp + num / 2 - 8;
- _surface.fillRect(Common::Rect(4, sliderY - (num - 6) / 2, _surface.width() - 5,
+ _surface.fillRect(Common::Rect(4, sliderY - (num - 6) / 2, _surface.width() - 5,
sliderY - (num - 6) / 2 + num - 1), TRANSPARENCY);
- _surface.fillRect(Common::Rect(_surface.widestChar(), sliderY + 2,
+ _surface.fillRect(Common::Rect(_surface.widestChar(), sliderY + 2,
_surface.width() - _surface.widestChar() - 1, sliderY + 3), INFO_MIDDLE);
drawDialogRect(Common::Rect(_surface.widestChar(), sliderY, _surface.width() - _surface.widestChar(), sliderY + 6));
-
- _surface.fillRect(Common::Rect(_midiSliderX - 1, sliderY - (num - 6) / 2 + 2,
+
+ _surface.fillRect(Common::Rect(_midiSliderX - 1, sliderY - (num - 6) / 2 + 2,
_midiSliderX + 1, sliderY - (num - 6) / 2 + num - 3), INFO_MIDDLE);
- drawDialogRect(Common::Rect(_midiSliderX - 3, sliderY - (num - 6) / 2,
+ drawDialogRect(Common::Rect(_midiSliderX - 3, sliderY - (num - 6) / 2,
_midiSliderX + 4, sliderY - (num - 6) / 2 + num));
-
+
if (_midiSliderX - 4 > _surface.widestChar())
_surface.fillRect(Common::Rect(_midiSliderX - 4, sliderY, _midiSliderX - 4, sliderY + 4), INFO_BOTTOM);
if (_midiSliderX + 4 < _surface.width() - _surface.widestChar())
@@ -332,14 +332,14 @@ void WidgetOptions::render(OptionRenderMode mode) {
int num = (_surface.fontHeight() + 4) & 0xfe;
int sliderY = yp + num / 2 - 8;
- _surface.fillRect(Common::Rect(4, sliderY - (num - 6) / 2, _surface.width() - 5,
+ _surface.fillRect(Common::Rect(4, sliderY - (num - 6) / 2, _surface.width() - 5,
sliderY - (num - 6) / 2 + num - 1), TRANSPARENCY);
- _surface.fillRect(Common::Rect(_surface.widestChar(), sliderY + 2, _surface.width() - _surface.widestChar() - 1,
+ _surface.fillRect(Common::Rect(_surface.widestChar(), sliderY + 2, _surface.width() - _surface.widestChar() - 1,
sliderY + 3), INFO_MIDDLE);
drawDialogRect(Common::Rect(_surface.widestChar(), sliderY, _surface.width() - _surface.widestChar(), sliderY + 6));
- _surface.fillRect(Common::Rect(_digiSliderX - 1, sliderY - (num - 6) / 2 + 2, _digiSliderX + 1,
+ _surface.fillRect(Common::Rect(_digiSliderX - 1, sliderY - (num - 6) / 2 + 2, _digiSliderX + 1,
sliderY - (num - 6) / 2 + num - 3), INFO_MIDDLE);
- drawDialogRect(Common::Rect(_digiSliderX - 3, sliderY - (num - 6) / 2, _digiSliderX + 4,
+ drawDialogRect(Common::Rect(_digiSliderX - 3, sliderY - (num - 6) / 2, _digiSliderX + 4,
sliderY - (num - 6) / 2 + num));
if (_digiSliderX - 4 > _surface.widestChar())
_surface.fillRect(Common::Rect(_digiSliderX - 4, sliderY, _digiSliderX - 4, sliderY + 4), INFO_BOTTOM);
diff --git a/engines/sherlock/tattoo/widget_password.cpp b/engines/sherlock/tattoo/widget_password.cpp
index 2a2921026d..90e67729c5 100644
--- a/engines/sherlock/tattoo/widget_password.cpp
+++ b/engines/sherlock/tattoo/widget_password.cpp
@@ -119,7 +119,7 @@ void WidgetPassword::handleEvents() {
_surface.fillRect(Common::Rect(_cursorPos.x, _cursorPos.y, _cursorPos.x + width, _cursorPos.y + _surface.fontHeight()), TRANSPARENCY);
if (currentChar != ' ')
_surface.writeString(Common::String::format("%c", _password[_index]), _cursorPos, COMMAND_HIGHLIGHTED);
-
+
switch (keycode) {
case Common::KEYCODE_LEFT:
_cursorPos.x -= _surface.charWidth(_password[_index - 1]);
@@ -136,7 +136,7 @@ void WidgetPassword::handleEvents() {
case Common::KEYCODE_END:
_cursorPos.x = _surface.stringWidth(_password) + _surface.widestChar();
_index = _password.size();
-
+
while (_index > 0 && _password[_index - 1] == ' ') {
_cursorPos.x -= _surface.charWidth(_password[_index - 1]);
--_index;
@@ -187,7 +187,7 @@ void WidgetPassword::handleEvents() {
void WidgetPassword::close() {
Talk &talk = *_vm->_talk;
-
+
banishWindow();
if (talk._talkToAbort)
return;
diff --git a/engines/sherlock/tattoo/widget_quit.cpp b/engines/sherlock/tattoo/widget_quit.cpp
index ea8f2e080c..92fabc49bf 100644
--- a/engines/sherlock/tattoo/widget_quit.cpp
+++ b/engines/sherlock/tattoo/widget_quit.cpp
@@ -130,7 +130,7 @@ void WidgetQuit::handleEvents() {
byte color = (_select == 1) ? COMMAND_HIGHLIGHTED : INFO_TOP;
int yp = (_surface.fontHeight() + 4) * 2 + 8;
_surface.writeString(FIXED(Yes), Common::Point((_surface.width() - _surface.stringWidth(FIXED(Yes))) / 2, yp), color);
-
+
color = (_select == 0) ? COMMAND_HIGHLIGHTED : INFO_TOP;
yp += (_surface.fontHeight() + 7);
_surface.writeString(FIXED(No), Common::Point((_surface.width() - _surface.stringWidth(FIXED(No))) / 2, yp), color);
diff --git a/engines/sherlock/tattoo/widget_talk.cpp b/engines/sherlock/tattoo/widget_talk.cpp
index aec664561e..4a5b7f7dc7 100644
--- a/engines/sherlock/tattoo/widget_talk.cpp
+++ b/engines/sherlock/tattoo/widget_talk.cpp
@@ -133,7 +133,7 @@ void WidgetTalk::handleEvents() {
// Flag if they started pressing outside of the window
if (events._firstPress && !_bounds.contains(mousePos))
_outsideMenu = true;
-
+
// Check for which statement they are pointing at
_selector = -1;
if (ui._scrollHighlight == SH_NONE) {
@@ -159,7 +159,7 @@ void WidgetTalk::handleEvents() {
if (keycode == Common::KEYCODE_TAB && ui._scrollHighlight == SH_NONE) {
if (_selector == -1) {
_selector = _statementLines[_scroll ? _talkScrollIndex : 0]._num;
-
+
events.warpMouse(Common::Point(_bounds.right - BUTTON_SIZE - 10, _bounds.top + _surface.fontHeight() + 2));
} else {
if (ui._keyState.flags & Common::KBD_SHIFT) {
@@ -275,7 +275,7 @@ void WidgetTalk::handleEvents() {
do {
talk._scriptSelect = _selector;
talk._speaker = talk._talkTo;
-
+
// Make a copy of the reply (since talkTo can reload the statements list), and call talkTo
Common::String reply = talk._statements[_selector]._reply;
talk.doScript(reply);
@@ -430,7 +430,7 @@ void WidgetTalk::setStatementLines() {
++numStatements;
}
- // If there are more lines than can be displayed in the interface window at one time, adjust the allowed
+ // If there are more lines than can be displayed in the interface window at one time, adjust the allowed
// width to take into account needing a scrollbar
int xSize = _scroll ? _bounds.width() - BUTTON_SIZE - 3 : _bounds.width();
diff --git a/engines/sherlock/tattoo/widget_text.cpp b/engines/sherlock/tattoo/widget_text.cpp
index a29cd2700f..b9653e371a 100644
--- a/engines/sherlock/tattoo/widget_text.cpp
+++ b/engines/sherlock/tattoo/widget_text.cpp
@@ -56,14 +56,14 @@ void WidgetText::load(const Common::String &str, int speaker) {
// See if it's only a single line long
if (height == _surface.fontHeight() + 10) {
width = _surface.widestChar() * 2 + 6;
-
+
const char *strP = str.c_str();
while (*strP && (*strP < talk._opcodes[OP_SWITCH_SPEAKER] || *strP == talk._opcodes[OP_NULL]))
width += _surface.charWidth(*strP++);
}
_bounds = Common::Rect(width, height);
-
+
if (speaker == -1) {
// No speaker specified, so center window on look position
_bounds.translate(ui._lookPos.x - width / 2, ui._lookPos.y - height / 2);
@@ -89,11 +89,11 @@ void WidgetText::centerWindowOnSpeaker(int speaker) {
int scaleVal = scene.getScaleVal(people[HOLMES]._position);
if (scaleVal == SCALE_THRESHOLD) {
pt.x += people[HOLMES].frameWidth() / 2;
- pt.y = people[HOLMES]._position.y / FIXED_INT_MULTIPLIER - people[HOLMES].frameHeight()
+ pt.y = people[HOLMES]._position.y / FIXED_INT_MULTIPLIER - people[HOLMES].frameHeight()
- _bounds.height() - _surface.fontHeight();
} else {
pt.x += people[HOLMES]._imageFrame->sDrawXSize(scaleVal) / 2;
- pt.y = people[HOLMES]._position.y / FIXED_INT_MULTIPLIER - people[HOLMES]._imageFrame->sDrawYSize(scaleVal)
+ pt.y = people[HOLMES]._position.y / FIXED_INT_MULTIPLIER - people[HOLMES]._imageFrame->sDrawYSize(scaleVal)
- _bounds.height() - _surface.fontHeight();
}
} else {
diff --git a/engines/sherlock/tattoo/widget_tooltip.cpp b/engines/sherlock/tattoo/widget_tooltip.cpp
index 1560cb9a80..27f9c22d69 100644
--- a/engines/sherlock/tattoo/widget_tooltip.cpp
+++ b/engines/sherlock/tattoo/widget_tooltip.cpp
@@ -44,10 +44,10 @@ void WidgetTooltipBase::draw() {
// Blit the affected area to the screen
screen.slamRect(_bounds);
-
+
// Draw the widget directly onto the screen. Unlike other widgets, we don't draw to the back buffer,
// since nothing should be drawing on top of tooltips, so there's no need to store in the back buffer
- screen.SHtransBlitFrom(_surface, Common::Point(_bounds.left - screen._currentScroll.x,
+ screen.SHtransBlitFrom(_surface, Common::Point(_bounds.left - screen._currentScroll.x,
_bounds.top - screen._currentScroll.y));
// Store a copy of the drawn area for later erasing
@@ -76,7 +76,7 @@ void WidgetTooltip::setText(const Common::String &str) {
Events &events = *_vm->_events;
Common::Point mousePos = events.mousePos();
bool reset = false;
-
+
// Make sure that the description is present
if (!str.empty()) {
int width = _surface.stringWidth(str) + 2;
@@ -200,7 +200,7 @@ void WidgetSceneTooltip::handleEvents() {
str = scene._exits[ui._arrowZone]._dest;
}
- setText(str.hasPrefix(" ") ? Common::String() : str);
+ setText(str.hasPrefix(" ") ? Common::String() : str);
} else if ((ui._bgFound == -1 && ui._oldBgFound != -1) || (ui._arrowZone == -1 && ui._oldArrowZone != -1)) {
setText("");
}
diff --git a/engines/sherlock/tattoo/widget_verbs.cpp b/engines/sherlock/tattoo/widget_verbs.cpp
index 5041888ffb..171fb247bc 100644
--- a/engines/sherlock/tattoo/widget_verbs.cpp
+++ b/engines/sherlock/tattoo/widget_verbs.cpp
@@ -65,7 +65,7 @@ void WidgetVerbs::load(bool objectsOn) {
if (scumm_strnicmp(person._examine.c_str(), "_EXIT", 5))
_verbCommands.push_back(FIXED(Look));
-
+
_verbCommands.push_back(FIXED(Talk));
// Add any extra active verbs from the NPC's verb list
@@ -116,7 +116,7 @@ void WidgetVerbs::load(bool objectsOn) {
// Set the bounds
_bounds = Common::Rect(width, height);
_bounds.moveTo(mousePos.x - _bounds.width() / 2, mousePos.y - _bounds.height() / 2);
-
+
// Render the window on the internal surface
render();
}
@@ -134,7 +134,7 @@ void WidgetVerbs::render() {
// Draw the verb commands and the lines separating them
for (uint idx = 0; idx < _verbCommands.size(); ++idx) {
- _surface.writeString(_verbCommands[idx], Common::Point((_bounds.width() - _surface.stringWidth(_verbCommands[idx])) / 2,
+ _surface.writeString(_verbCommands[idx], Common::Point((_bounds.width() - _surface.stringWidth(_verbCommands[idx])) / 2,
(_surface.fontHeight() + 7) * idx + 5), INFO_TOP);
if (idx < (_verbCommands.size() - 1)) {
@@ -143,7 +143,7 @@ void WidgetVerbs::render() {
_surface.hLine(3, (_surface.fontHeight() + 7) * (idx + 1) + 2, _bounds.width() - 4, INFO_BOTTOM);
_surface.SHtransBlitFrom(images[4], Common::Point(0, (_surface.fontHeight() + 7) * (idx + 1) - 1));
- _surface.SHtransBlitFrom(images[5], Common::Point(_bounds.width() - images[5]._width,
+ _surface.SHtransBlitFrom(images[5], Common::Point(_bounds.width() - images[5]._width,
(_surface.fontHeight() + 7) * (idx + 1) - 1));
}
}
@@ -226,7 +226,7 @@ void WidgetVerbs::handleEvents() {
// Talk command is being activated
talk.initTalk(ui._activeObj);
ui._activeObj = -1;
-
+
} else if (!_verbCommands[_selector].compareToIgnoreCase(strJournal)) {
ui.doJournal();
diff --git a/engines/sherlock/user_interface.h b/engines/sherlock/user_interface.h
index c16c9f5d11..852b608245 100644
--- a/engines/sherlock/user_interface.h
+++ b/engines/sherlock/user_interface.h
@@ -102,7 +102,7 @@ public:
/**
* Draw the user interface onto the screen's back buffers
- */
+ */
virtual void drawInterface(int bufferNum = 3) {}
/**
diff --git a/engines/sky/compact.cpp b/engines/sky/compact.cpp
index ce62dcb2ae..c2ca557ec2 100644
--- a/engines/sky/compact.cpp
+++ b/engines/sky/compact.cpp
@@ -236,7 +236,7 @@ SkyCompact::SkyCompact() {
for (cnt = 0; cnt < _numSaveIds; cnt++)
_saveIds[cnt] = FROM_LE_16(_saveIds[cnt]);
_resetDataPos = _cptFile->pos();
-
+
checkAndFixOfficerBluntError();
}
@@ -259,7 +259,7 @@ SkyCompact::~SkyCompact() {
delete _cptFile;
}
-/* WORKAROUND for bug #2687:
+/* WORKAROUND for bug #2687:
The first release of scummvm with externalized, binary compact data has one broken 16 bit reference.
When talking to Officer Blunt on ground level while in a crouched position, the game enters an
unfinishable state because Blunt jumps into the lake and can no longer be interacted with.
diff --git a/engines/sky/detection.cpp b/engines/sky/detection.cpp
index d86689e5d7..4b91f50a61 100644
--- a/engines/sky/detection.cpp
+++ b/engines/sky/detection.cpp
@@ -78,7 +78,7 @@ public:
virtual bool hasFeature(MetaEngineFeature f) const;
virtual GameList getSupportedGames() const;
virtual const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const;
- virtual GameDescriptor findGame(const char *gameid) const;
+ virtual GameDescriptor findGame(const char *gameid) const;
virtual GameList detectGames(const Common::FSList &fslist) const;
virtual Common::Error createInstance(OSystem *syst, Engine **engine) const;
diff --git a/engines/sword25/gfx/animationresource.cpp b/engines/sword25/gfx/animationresource.cpp
index 423a2b86b4..cd65855653 100644
--- a/engines/sword25/gfx/animationresource.cpp
+++ b/engines/sword25/gfx/animationresource.cpp
@@ -211,7 +211,7 @@ bool AnimationResource::precacheAllFrames() const {
error("Could not precache \"%s\".", (*iter).fileName.c_str());
return false;
}
-#else
+#else
Resource *pResource = Kernel::getInstance()->getResourceManager()->requestResource((*iter).fileName);
pResource->release(); //unlock precached resource
#endif
diff --git a/engines/sword25/gfx/fontresource.cpp b/engines/sword25/gfx/fontresource.cpp
index 1d7aedcb6e..78276338da 100644
--- a/engines/sword25/gfx/fontresource.cpp
+++ b/engines/sword25/gfx/fontresource.cpp
@@ -103,7 +103,7 @@ bool FontResource::parserCallback_font(ParserNode *node) {
if (!_pKernel->getResourceManager()->precacheResource(_bitmapFileName)) {
error("Could not precache \"%s\".", _bitmapFileName.c_str());
}
-#else
+#else
Resource *pResource = _pKernel->getResourceManager()->requestResource(_bitmapFileName);
pResource->release(); //unlock precached resource
#endif
diff --git a/engines/sword25/package/packagemanager.cpp b/engines/sword25/package/packagemanager.cpp
index 87bedcc9c1..19425b50ab 100644
--- a/engines/sword25/package/packagemanager.cpp
+++ b/engines/sword25/package/packagemanager.cpp
@@ -75,7 +75,7 @@ PackageManager::~PackageManager() {
Common::String PackageManager::ensureSpeechLang(const Common::String &fileName) {
if (!_useEnglishSpeech || fileName.size() < 9 || !fileName.hasPrefix("/speech/"))
return fileName;
-
+
// Always keep German speech as a fallback in case the English speech pack is not present.
// However this means we cannot play with German text and English voice.
if (fileName.hasPrefix("/speech/de"))
diff --git a/engines/sword25/package/packagemanager.h b/engines/sword25/package/packagemanager.h
index 5475cb02fc..72e15e6bcd 100644
--- a/engines/sword25/package/packagemanager.h
+++ b/engines/sword25/package/packagemanager.h
@@ -87,7 +87,7 @@ private:
Common::String _currentDirectory;
Common::FSNode _rootFolder;
Common::List<ArchiveEntry *> _archiveList;
-
+
bool _useEnglishSpeech;
Common::String ensureSpeechLang(const Common::String &fileName);
diff --git a/engines/testbed/graphics.cpp b/engines/testbed/graphics.cpp
index afb1c5800a..e774008560 100644
--- a/engines/testbed/graphics.cpp
+++ b/engines/testbed/graphics.cpp
@@ -488,7 +488,7 @@ TestExitStatus GFXtests::fullScreenMode() {
prompt = "This should be your initial state. Is it?";
- if (!Testsuite::handleInteractiveInput(prompt, "Yes, it is", "Nopes", shouldSelect)) {
+ if (!Testsuite::handleInteractiveInput(prompt, "Yes, it is", "Nopes", kOptionLeft)) {
// User selected incorrect mode
Testsuite::logDetailedPrintf("switching back to initial state failed\n");
passed = kTestFailed;
diff --git a/engines/titanic/carry/glass.cpp b/engines/titanic/carry/glass.cpp
index 03050dc60d..ff4c54ca39 100644
--- a/engines/titanic/carry/glass.cpp
+++ b/engines/titanic/carry/glass.cpp
@@ -90,7 +90,7 @@ bool CGlass::UseWithCharMsg(CUseWithCharMsg *msg) {
if (_string6 != "Bird")
setPosition(_origPos);
-
+
actMsg.execute(msg->_character);
} else {
petAddToInventory();
diff --git a/engines/titanic/carry/note.cpp b/engines/titanic/carry/note.cpp
index 388f87e638..f06e41094f 100644
--- a/engines/titanic/carry/note.cpp
+++ b/engines/titanic/carry/note.cpp
@@ -35,7 +35,7 @@ void CNote::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeQuotedLine(_string6, indent);
file->writeNumberLine(_field138, indent);
-
+
CCarry::save(file, indent);
}
diff --git a/engines/titanic/carry/phonograph_cylinder.cpp b/engines/titanic/carry/phonograph_cylinder.cpp
index 3dedbc4ac9..777aa8be5b 100644
--- a/engines/titanic/carry/phonograph_cylinder.cpp
+++ b/engines/titanic/carry/phonograph_cylinder.cpp
@@ -118,7 +118,7 @@ bool CPhonographCylinder::QueryCylinderMsg(CQueryCylinderMsg *msg) {
bool CPhonographCylinder::RecordOntoCylinderMsg(CRecordOntoCylinderMsg *msg) {
_itemName = "STMusic";
-
+
CQueryMusicControlSettingMsg queryMsg;
queryMsg.execute("Bells Mute Control");
_bellsMuteControl = queryMsg._value;
@@ -145,7 +145,7 @@ bool CPhonographCylinder::RecordOntoCylinderMsg(CRecordOntoCylinderMsg *msg) {
queryMsg.execute("Piano Speed Control");
_pianoSpeedControl = queryMsg._value;
queryMsg.execute("Piano Pitch Control");
- _pianoPitchControl = queryMsg._value;
+ _pianoPitchControl = queryMsg._value;
queryMsg.execute("Piano Inversion Control");
_pianoInversionControl = queryMsg._value;
queryMsg.execute("Piano Direction Control");
diff --git a/engines/titanic/core/file_item.h b/engines/titanic/core/file_item.h
index 4cecee4882..0b02d9d938 100644
--- a/engines/titanic/core/file_item.h
+++ b/engines/titanic/core/file_item.h
@@ -44,7 +44,7 @@ public:
/**
* Load the data for the class from file
*/
- virtual void load(SimpleFile *file);
+ virtual void load(SimpleFile *file);
/**
* Returns true if the item is a file item
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index 56c838995e..8f71b3d995 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -89,7 +89,7 @@ void CGameObject::save(SimpleFile *file, int indent) {
if (_surface) {
const CMovieRangeInfoList *rangeList = _surface->getMovieRangeInfo();
-
+
if (rangeList) {
for (CMovieRangeInfoList::const_iterator i = rangeList->begin();
i != rangeList->end(); ++i) {
@@ -109,7 +109,7 @@ void CGameObject::save(SimpleFile *file, int indent) {
file->writeNumberLine(_field40, indent + 1);
file->writeQuotedLine(_resource, indent + 1);
file->writeBounds(_bounds, indent + 1);
-
+
file->writeFloatLine(_field34, indent + 1);
file->writeFloatLine(_field38, indent + 1);
file->writeFloatLine(_field3C, indent + 1);
@@ -178,7 +178,7 @@ void CGameObject::load(SimpleFile *file) {
_id = file->readNumber();
_roomFlags = file->readNumber();
- resourceKey.load(file);
+ resourceKey.load(file);
_surface = nullptr;
val = file->readNumber();
if (val) {
@@ -199,7 +199,7 @@ void CGameObject::draw(CScreenManager *screenManager) {
if (_credits && _credits->_objectP == this) {
if (!_credits->draw())
CGameObject::deinit();
-
+
return;
}
@@ -281,7 +281,7 @@ bool CGameObject::checkPoint(const Point &pt, bool ignore40, bool visibleOnly) {
}
Common::Point pixelPos = pt - _bounds;
- if (_surface->_transBlitFlag) {
+ if (_surface->_flipVertically) {
pixelPos.y = ((_bounds.height() - _bounds.top) / 2) * 2 - pixelPos.y;
}
@@ -354,7 +354,7 @@ void CGameObject::loadMovie(const CString &name, bool pendingFlag) {
// Create the surface if it doesn't already exist
if (!_surface) {
CGameManager *gameManager = getGameManager();
- _surface = new OSVideoSurface(gameManager->setScreenManager(), nullptr);
+ _surface = new OSVideoSurface(gameManager->setScreenManager(), nullptr);
}
// Load the new movie resource
@@ -402,9 +402,10 @@ void CGameObject::loadImage(const CString &name, bool pendingFlag) {
}
void CGameObject::loadFrame(int frameNumber) {
- if (frameNumber != -1 && !_resource.empty())
+ _frameNumber = -1;
+ if (!_resource.empty())
loadResource(_resource);
-
+
if (_surface)
_surface->setMovieFrame(frameNumber);
@@ -858,14 +859,14 @@ CViewItem *CGameObject::parseView(const CString &viewString) {
CRoomItem *room = gameManager->getRoom();
CProjectItem *project = room->getRoot();
-
+
// Ensure we have the specified room
if (project) {
if (room->getName() != roomName) {
// Scan for the correct room
for (room = project->findFirstRoom(); room && room->getName() != roomName;
room = project->findNextRoom(room)) ;
- }
+ }
}
if (!room)
return nullptr;
@@ -953,7 +954,7 @@ CGameObject *CGameObject::findMailByFlags(int mode, uint roomFlags) {
CMailMan *mailMan = getMailMan();
if (!mailMan)
return nullptr;
-
+
for (CGameObject *obj = mailMan->getFirstObject(); obj;
obj = mailMan->getNextObject(obj)) {
if (compareRoomFlags(mode, roomFlags, obj->_roomFlags))
@@ -1077,7 +1078,7 @@ void CGameObject::setText(const CString &str, int border, int borderRight) {
_text = new CPetText();
_textBorder = border;
_textBorderRight = borderRight;
-
+
_text->setText(str);
CScreenManager *screenManager = getGameManager()->setScreenManager();
_text->scrollToTop(screenManager);
@@ -1207,7 +1208,7 @@ bool CGameObject::changeView(const CString &viewName, const CString &clipName) {
if (!oldView || !newView)
return false;
-
+
CMovieClip *clip = nullptr;
if (!clipName.empty()) {
clip = oldView->findNode()->findRoom()->findClip(clipName);
diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h
index b9a55ac008..b50278cf21 100644
--- a/engines/titanic/core/game_object.h
+++ b/engines/titanic/core/game_object.h
@@ -401,7 +401,7 @@ protected:
* Clear the PET display
*/
void petClear() const;
-
+
/**
* Returns the MailMan
*/
@@ -488,7 +488,7 @@ protected:
* Locks the PET, disabling all input. Can be called multiple times
*/
void petLockInput();
-
+
/**
* Unlocks PET input
*/
@@ -646,7 +646,7 @@ public:
* Change the object's status
*/
void playMovie(uint flags);
-
+
/**
* Play the movie specified in _resource
*/
@@ -671,7 +671,7 @@ public:
* Get the current movie frame
*/
int getMovieFrame() const;
-
+
/**
* Returns the object's frame number
*/
@@ -706,7 +706,7 @@ public:
* Return the player's passenger class
*/
int getPassengerClass() const;
-
+
/**
* Return the player's previous passenger class
*/
@@ -732,7 +732,7 @@ public:
* Returns a hidden object
*/
CGameObject *getHiddenObject(const CString &name) const;
-
+
/**
* Sets up credits text
*/
@@ -742,7 +742,7 @@ public:
* Support function for drag moving
*/
void dragMove(const Point &pt);
-
+
/**
* Returns the currently dragging item (if any) if it's a game object
*/
@@ -965,17 +965,17 @@ public:
/*--- CGameState Methods ---*/
void setState1C(bool flag);
-
+
/**
* Change to the next season
*/
void stateChangeSeason();
-
+
/**
* Returns the currently active season
*/
Season stateGetSeason() const;
-
+
void stateSet24();
int stateGet24() const;
void stateInc38();
diff --git a/engines/titanic/core/link_item.cpp b/engines/titanic/core/link_item.cpp
index f77d081c61..559191efc9 100644
--- a/engines/titanic/core/link_item.cpp
+++ b/engines/titanic/core/link_item.cpp
@@ -57,8 +57,8 @@ CString CLinkItem::formName() {
view->getName().c_str(), destView->getName().c_str());
case 3:
- return CString::format("_TRACK,%d,%s,%d,%s",
- node->_nodeNumber, view->getName().c_str(),
+ return CString::format("_TRACK,%d,%s,%d,%s",
+ node->_nodeNumber, view->getName().c_str(),
destNode->_nodeNumber, destView->getName().c_str());
case 4:
diff --git a/engines/titanic/core/list.h b/engines/titanic/core/list.h
index 91a74adbdc..09068fb06a 100644
--- a/engines/titanic/core/list.h
+++ b/engines/titanic/core/list.h
@@ -130,7 +130,7 @@ public:
*/
void destroyContents() {
typename Common::List<T *>::iterator i;
- for (i = Common::List<T *>::begin();
+ for (i = Common::List<T *>::begin();
i != Common::List<T *>::end(); ++i) {
CSaveableObject *obj = *i;
delete obj;
@@ -149,7 +149,7 @@ public:
}
bool contains(const T *item) const {
- for (typename Common::List<T *>::const_iterator i = Common::List<T *>::begin();
+ for (typename Common::List<T *>::const_iterator i = Common::List<T *>::begin();
i != Common::List<T *>::end(); ++i) {
if (*i == item)
return true;
diff --git a/engines/titanic/core/message_target.cpp b/engines/titanic/core/message_target.cpp
index 4815d03973..a1060c643e 100644
--- a/engines/titanic/core/message_target.cpp
+++ b/engines/titanic/core/message_target.cpp
@@ -24,7 +24,7 @@
namespace Titanic {
-const MSGMAP *CMessageTarget::getMessageMap() const {
+const MSGMAP *CMessageTarget::getMessageMap() const {
return getThisMessageMap();
}
diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp
index 76293233b0..65e8645baa 100644
--- a/engines/titanic/core/project_item.cpp
+++ b/engines/titanic/core/project_item.cpp
@@ -287,7 +287,7 @@ void CProjectItem::saveData(SimpleFile *file, CTreeItem *item) const {
item->saveHeader(file, 0);
item->save(file, 1);
item->saveFooter(file, 0);
-
+
CTreeItem *child = item->getFirstChild();
if (child) {
file->write("\n{\n", 3);
@@ -300,7 +300,7 @@ void CProjectItem::saveData(SimpleFile *file, CTreeItem *item) const {
file->write("\n{\n", 3);
file->writeQuotedString("ALONG");
}
-
+
file->write("\n}\n", 3);
item = item->getNextSibling();
}
diff --git a/engines/titanic/core/project_item.h b/engines/titanic/core/project_item.h
index 473ffd9556..4d009dd50b 100644
--- a/engines/titanic/core/project_item.h
+++ b/engines/titanic/core/project_item.h
@@ -66,7 +66,7 @@ public:
/**
* Load the data for the class from file
*/
- virtual void load(SimpleFile *file);
+ virtual void load(SimpleFile *file);
};
/**
@@ -89,7 +89,7 @@ private:
* Called during save, iterates through the children to do some stuff
*/
void buildFilesList();
-
+
/**
* Called at the beginning of loading a game
*/
@@ -161,7 +161,7 @@ public:
/**
* Load the data for the class from file
*/
- virtual void load(SimpleFile *file);
+ virtual void load(SimpleFile *file);
/**
* Get the game manager for the project
diff --git a/engines/titanic/core/resource_key.cpp b/engines/titanic/core/resource_key.cpp
index 3b390af2d4..3db5812d7d 100644
--- a/engines/titanic/core/resource_key.cpp
+++ b/engines/titanic/core/resource_key.cpp
@@ -37,7 +37,7 @@ void CResourceKey::save(SimpleFile *file, int indent) {
void CResourceKey::load(SimpleFile *file) {
int val = file->readNumber();
-
+
if (val == 0 || val == 1) {
file->readBuffer();
CString str = file->readString();
diff --git a/engines/titanic/core/room_item.cpp b/engines/titanic/core/room_item.cpp
index 49b3232ba1..1c360c7571 100644
--- a/engines/titanic/core/room_item.cpp
+++ b/engines/titanic/core/room_item.cpp
@@ -59,7 +59,7 @@ void CRoomItem::save(SimpleFile *file, int indent) {
void CRoomItem::load(SimpleFile *file) {
int val = file->readNumber();
-
+
switch (val) {
case 3:
// Read exit movie
@@ -114,7 +114,7 @@ void CRoomItem::postLoad() {
void CRoomItem::calcNodePosition(const Point &nodePos, double &xVal, double &yVal) const {
xVal = yVal = 0.0;
-
+
if (_roomDimensionX >= 0.0 && _roomDimensionY >= 0.0) {
xVal = _roomRect.width() / _roomDimensionX;
yVal = _roomRect.height() / _roomDimensionY;
diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp
index 630404a6ee..7522a34737 100644
--- a/engines/titanic/core/saveable_object.cpp
+++ b/engines/titanic/core/saveable_object.cpp
@@ -421,7 +421,7 @@ CSaveableObject *ClassDef::create() {
/*------------------------------------------------------------------------*/
-Common::HashMap<Common::String, CSaveableObject::CreateFunction> *
+Common::HashMap<Common::String, CSaveableObject::CreateFunction> *
CSaveableObject::_classList = nullptr;
Common::List<ClassDef *> *CSaveableObject::_classDefs;
@@ -1346,7 +1346,7 @@ void CSaveableObject::initClassList() {
ADDFN(CTextUp, CPetGraphic);
ADDFN(CToggleButton, CBackground);
ADDFN(CToggleSwitch, CGameObject);
-
+
ADDFN(CActMsg, CMessage);
ADDFN(CActivationmsg, CMessage);
ADDFN(CAddHeadPieceMsg, CMessage);
diff --git a/engines/titanic/core/saveable_object.h b/engines/titanic/core/saveable_object.h
index 6d80ad121d..4c7c1a7737 100644
--- a/engines/titanic/core/saveable_object.h
+++ b/engines/titanic/core/saveable_object.h
@@ -47,7 +47,7 @@ public:
template<typename T>
class TypeTemplate : public ClassDef {
public:
- TypeTemplate(const char *className, ClassDef *parent) :
+ TypeTemplate(const char *className, ClassDef *parent) :
ClassDef(className, parent) {}
virtual CSaveableObject *create() { return new T(); }
};
@@ -79,7 +79,7 @@ public:
public:
CLASSDEF
virtual ~CSaveableObject() {}
-
+
bool isInstanceOf(const ClassDef *classDef) const;
/**
@@ -91,13 +91,13 @@ public:
* Load the data for the class from file
*/
virtual void load(SimpleFile *file);
-
+
/**
* Write out a header definition for the class to file
* prior to saving the actual data for the class
*/
virtual void saveHeader(SimpleFile *file, int indent);
-
+
/**
* Writes out a footer for the class after it's data has
* been written to file
diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp
index 86c34cab8b..97d06d7bbe 100644
--- a/engines/titanic/core/tree_item.cpp
+++ b/engines/titanic/core/tree_item.cpp
@@ -51,7 +51,7 @@ void CTreeItem::dump(int indent) {
CTreeItem *item = getFirstChild();
while (item) {
item->dump(indent + 1);
-
+
item = item->getNextSibling();
}
}
diff --git a/engines/titanic/core/turn_on_play_sound.cpp b/engines/titanic/core/turn_on_play_sound.cpp
index ab50b33134..44a9b3b0eb 100644
--- a/engines/titanic/core/turn_on_play_sound.cpp
+++ b/engines/titanic/core/turn_on_play_sound.cpp
@@ -28,7 +28,7 @@ BEGIN_MESSAGE_MAP(CTurnOnPlaySound, CTurnOnObject)
ON_MESSAGE(MouseButtonUpMsg)
END_MESSAGE_MAP()
-CTurnOnPlaySound::CTurnOnPlaySound() : CTurnOnObject(),
+CTurnOnPlaySound::CTurnOnPlaySound() : CTurnOnObject(),
_soundName("NULL"), _soundVolume(80), _soundVal3(0) {
}
diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp
index 176765b12f..9b20860a46 100644
--- a/engines/titanic/core/view_item.cpp
+++ b/engines/titanic/core/view_item.cpp
@@ -63,7 +63,7 @@ void CViewItem::save(SimpleFile *file, int indent) {
void CViewItem::load(SimpleFile *file) {
int val = file->readNumber();
-
+
switch (val) {
case 1:
_resourceKey.load(file);
@@ -86,7 +86,7 @@ bool CViewItem::getResourceKey(CResourceKey *key) {
}
void CViewItem::leaveView(CViewItem *newView) {
- // Only do the processing if we've been passed a view, and it's not the same
+ // Only do the processing if we've been passed a view, and it's not the same
if (newView && newView != this) {
CLeaveViewMsg viewMsg(this, newView);
viewMsg.execute(this, nullptr, MSGFLAG_SCAN);
@@ -112,7 +112,7 @@ void CViewItem::leaveView(CViewItem *newView) {
}
void CViewItem::preEnterView(CViewItem *newView) {
- // Only do the processing if we've been passed a view, and it's not the same
+ // Only do the processing if we've been passed a view, and it's not the same
if (newView && newView != this) {
CPreEnterViewMsg viewMsg(this, newView);
viewMsg.execute(newView, nullptr, MSGFLAG_SCAN);
@@ -134,7 +134,7 @@ void CViewItem::preEnterView(CViewItem *newView) {
}
void CViewItem::enterView(CViewItem *newView) {
- // Only do the processing if we've been passed a view, and it's not the same
+ // Only do the processing if we've been passed a view, and it's not the same
if (newView && newView != this) {
CEnterViewMsg viewMsg(this, newView);
viewMsg.execute(newView, nullptr, MSGFLAG_SCAN);
diff --git a/engines/titanic/debugger.cpp b/engines/titanic/debugger.cpp
index a9da83f724..5d95ef5186 100644
--- a/engines/titanic/debugger.cpp
+++ b/engines/titanic/debugger.cpp
@@ -23,7 +23,9 @@
#include "titanic/debugger.h"
#include "titanic/titanic.h"
#include "titanic/core/tree_item.h"
+#include "titanic/game/movie_tester.h"
#include "titanic/pet_control/pet_control.h"
+#include "titanic/support/movie.h"
namespace Titanic {
@@ -33,6 +35,7 @@ Debugger::Debugger(TitanicEngine *vm) : GUI::Debugger(), _vm(vm) {
registerCmd("room", WRAP_METHOD(Debugger, cmdRoom));
registerCmd("pet", WRAP_METHOD(Debugger, cmdPET));
registerCmd("item", WRAP_METHOD(Debugger, cmdItem));
+ registerCmd("movie", WRAP_METHOD(Debugger, cmdMovie));
}
int Debugger::strToInt(const char *s) {
@@ -109,7 +112,7 @@ void Debugger::listRooms() {
CRoomItem *room = gm._gameState._gameLocation.getRoom();
debugPrintf("Current location: %s, %s, %s\n", room->getName().c_str(),
node->getName().c_str(), view->getName().c_str());
-
+
debugPrintf("Available rooms:\n");
for (CTreeItem *treeItem = root; treeItem; treeItem = treeItem->scan(root)) {
CRoomItem *roomItem = dynamic_cast<CRoomItem *>(treeItem);
@@ -139,7 +142,7 @@ bool Debugger::cmdDump(int argc, const char **argv) {
CTreeItem *root = g_vm->_window->_gameManager->_project;
if (argc == 2)
root = root->findByName(argv[1]);
-
+
if (root == nullptr) {
debugPrintf("Could not find item\n");
} else {
@@ -204,7 +207,7 @@ bool Debugger::cmdPET(int argc, const char **argv) {
return true;
}
}
-
+
debugPrintf("%s [on | off]\n", argv[0]);
return true;
}
@@ -260,4 +263,35 @@ bool Debugger::cmdItem(int argc, const char **argv) {
return true;
}
+bool Debugger::cmdMovie(int argc, const char **argv) {
+ if (argc < 2) {
+ debugPrintf("movie filename.avi [startFrame endFrame]\n");
+ return true;
+ }
+
+ CViewItem *view = g_vm->_window->_gameManager->getView();
+ CMovieTester *tester = static_cast<CMovieTester *>(
+ view->findChildInstanceOf(CMovieTester::_type));
+ if (!tester) {
+ // No movie tester present, so create one
+ tester = new CMovieTester();
+ tester->addUnder(view);
+ }
+
+ CString filename(argv[1]);
+ if (!filename.hasSuffix(".avi"))
+ filename += ".avi";
+ tester->loadMovie(filename);
+
+ if (argc == 2) {
+ tester->playMovie(MOVIE_STOP_PREVIOUS);
+ } else {
+ uint startFrame = strToInt(argv[2]);
+ uint endFrame = strToInt(argv[2]);
+ tester->playMovie(startFrame, endFrame, MOVIE_STOP_PREVIOUS);
+ }
+
+ return false;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/debugger.h b/engines/titanic/debugger.h
index 5edb7cb324..919d6c5358 100644
--- a/engines/titanic/debugger.h
+++ b/engines/titanic/debugger.h
@@ -44,27 +44,27 @@ private:
* Find a room by name or number
*/
CRoomItem *findRoom(const char *name);
-
+
/**
* Find a node within a room by name or number
*/
CNodeItem *findNode(CRoomItem *room, const char *name);
-
+
/**
* Find a view within a room node by name or number
*/
CViewItem *findView(CNodeItem *node, const char *name);
-
+
/**
* List all the rooms in the game
*/
void listRooms();
-
+
/**
* List the nodes within a room
*/
void listRoom(CRoomItem *room);
-
+
/**
* List the views within a room node
*/
@@ -89,6 +89,11 @@ private:
* Item handling
*/
bool cmdItem(int argc, const char **argv);
+
+ /**
+ * Shows a movie
+ */
+ bool cmdMovie(int argc, const char **argv);
protected:
TitanicEngine *_vm;
public:
diff --git a/engines/titanic/detection.cpp b/engines/titanic/detection.cpp
index 096cd4b618..33bae22312 100644
--- a/engines/titanic/detection.cpp
+++ b/engines/titanic/detection.cpp
@@ -128,7 +128,7 @@ SaveStateList TitanicMetaEngine::listSaves(const char *target) const {
if (in) {
Titanic::CompressedFile cf;
cf.open(in);
-
+
if (Titanic::CProjectItem::readSavegameHeader(&cf, header))
saveList.push_back(SaveStateDescriptor(slot, header._saveName));
diff --git a/engines/titanic/detection_tables.h b/engines/titanic/detection_tables.h
index ba67942dfe..5ff09cec16 100644
--- a/engines/titanic/detection_tables.h
+++ b/engines/titanic/detection_tables.h
@@ -21,7 +21,7 @@
*/
namespace Titanic {
-
+
static const TitanicGameDescription gameDescriptions[] = {
{
{
diff --git a/engines/titanic/events.h b/engines/titanic/events.h
index 68666c7c46..3ea9b63217 100644
--- a/engines/titanic/events.h
+++ b/engines/titanic/events.h
@@ -34,8 +34,8 @@ namespace Titanic {
#define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE)
#define DOUBLE_CLICK_TIME 100
-enum SpecialButtons {
- MK_LBUTTON = 1, MK_RBUTTON = 2, MK_SHIFT = 4, MK_CONTROL = 8,
+enum SpecialButtons {
+ MK_LBUTTON = 1, MK_RBUTTON = 2, MK_SHIFT = 4, MK_CONTROL = 8,
MK_MBUTTON = 0x10
};
diff --git a/engines/titanic/game/bar_menu.cpp b/engines/titanic/game/bar_menu.cpp
index 3812a8dab6..476e243fe9 100644
--- a/engines/titanic/game/bar_menu.cpp
+++ b/engines/titanic/game/bar_menu.cpp
@@ -40,7 +40,7 @@ void CBarMenu::save(SimpleFile *file, int indent) {
file->writeNumberLine(_barFrameNumber, indent);
file->writeNumberLine(_visibleFlag, indent);
file->writeNumberLine(_numFrames, indent);
-
+
CGameObject::save(file, indent);
}
@@ -67,7 +67,7 @@ bool CBarMenu::PETDownMsg(CPETDownMsg *msg) {
if (_visibleFlag) {
if (--_barFrameNumber < 0)
_barFrameNumber = _numFrames - 1;
-
+
loadFrame(_barFrameNumber);
}
diff --git a/engines/titanic/game/cdrom_computer.cpp b/engines/titanic/game/cdrom_computer.cpp
index ceb0595188..5fd8e16350 100644
--- a/engines/titanic/game/cdrom_computer.cpp
+++ b/engines/titanic/game/cdrom_computer.cpp
@@ -29,7 +29,7 @@ BEGIN_MESSAGE_MAP(CCDROMComputer, CGameObject)
ON_MESSAGE(MouseButtonDownMsg)
END_MESSAGE_MAP()
-CCDROMComputer::CCDROMComputer() : CGameObject(),
+CCDROMComputer::CCDROMComputer() : CGameObject(),
_clickRect(0, 3, 55, 32) {
}
@@ -58,7 +58,7 @@ bool CCDROMComputer::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
if (tray) {
CStatusChangeMsg statusMsg;
statusMsg.execute(tray);
-
+
if (!statusMsg._success) {
// Check if the mouse is within the clickable area
Rect tempRect = _clickRect;
diff --git a/engines/titanic/game/cdrom_tray.cpp b/engines/titanic/game/cdrom_tray.cpp
index 1e5b135d35..505bdad319 100644
--- a/engines/titanic/game/cdrom_tray.cpp
+++ b/engines/titanic/game/cdrom_tray.cpp
@@ -110,7 +110,7 @@ bool CCDROMTray::ActMsg(CActMsg *msg) {
bool CCDROMTray::MovieEndMsg(CMovieEndMsg *msg) {
CTreeItem *screen = getRoom()->findByName("newScreen");
-
+
if (screen) {
CActMsg actMsg(_insertedCD);
actMsg.execute(screen);
diff --git a/engines/titanic/game/chev_code.cpp b/engines/titanic/game/chev_code.cpp
index 0acdf575f4..9381e1563a 100644
--- a/engines/titanic/game/chev_code.cpp
+++ b/engines/titanic/game/chev_code.cpp
@@ -69,7 +69,7 @@ bool CChevCode::SetChevFloorBits(CSetChevFloorBits *msg) {
int section = (msg->_floorNum + 4) / 10;
int index = (msg->_floorNum + 4) % 10;
_chevCode &= ~0xFF00;
-
+
int val = 0;
switch (section) {
case 0:
@@ -87,7 +87,7 @@ bool CChevCode::SetChevFloorBits(CSetChevFloorBits *msg) {
default:
break;
}
-
+
_chevCode |= ((index + val) << 8);
return true;
}
diff --git a/engines/titanic/game/chev_panel.cpp b/engines/titanic/game/chev_panel.cpp
index ed730c9d61..5b58cbe594 100644
--- a/engines/titanic/game/chev_panel.cpp
+++ b/engines/titanic/game/chev_panel.cpp
@@ -41,7 +41,7 @@ void CChevPanel::save(SimpleFile *file, int indent) {
file->writeNumberLine(_startPos.x, indent);
file->writeNumberLine(_startPos.y, indent);
file->writeNumberLine(_chevCode, indent);
-
+
CGameObject::save(file, indent);
}
diff --git a/engines/titanic/game/chicken_dispensor.cpp b/engines/titanic/game/chicken_dispensor.cpp
index e1e07844e1..8e02a1ec5c 100644
--- a/engines/titanic/game/chicken_dispensor.cpp
+++ b/engines/titanic/game/chicken_dispensor.cpp
@@ -107,7 +107,7 @@ bool CChickenDispensor::StatusChangeMsg(CStatusChangeMsg *msg) {
_fieldE8 = 1;
}
break;
-
+
default:
break;
}
diff --git a/engines/titanic/game/code_wheel.cpp b/engines/titanic/game/code_wheel.cpp
index 71d59ff514..441fddec02 100644
--- a/engines/titanic/game/code_wheel.cpp
+++ b/engines/titanic/game/code_wheel.cpp
@@ -77,7 +77,7 @@ bool CodeWheel::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
_state = (_state + 1) % 15;
playMovie(START_FRAMES[_state], END_FRAMES[_state],
- MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT);
+ MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT);
} else {
if (_state == _field108)
_field110 = true;
@@ -112,7 +112,7 @@ bool CodeWheel::MovieEndMsg(CMovieEndMsg *msg) {
changeMsg._newStatus = 1;
changeMsg.execute("Bomb");
- return true;
+ return true;
}
} // End of namespace Titanic
diff --git a/engines/titanic/game/computer_screen.cpp b/engines/titanic/game/computer_screen.cpp
index 9a7ac4b34e..98bef6eb63 100644
--- a/engines/titanic/game/computer_screen.cpp
+++ b/engines/titanic/game/computer_screen.cpp
@@ -99,7 +99,7 @@ bool CComputerScreen::TimerMsg(CTimerMsg *msg) {
playClip(51, 150);
playSound("a#31.wav");
playClip(151, 200);
-
+
handle = playSound("a#27.wav");
playClip(200, 306);
playSound("a#30.wav");
@@ -116,7 +116,7 @@ bool CComputerScreen::TimerMsg(CTimerMsg *msg) {
playClip(392, 450);
startTalking("Doorbot", 0x3611A);
sleep(8000);
-
+
playClip(450, 492);
startTalking("Doorbot", 0x36121);
playClip(492, 522);
diff --git a/engines/titanic/game/credits.cpp b/engines/titanic/game/credits.cpp
index d9149f6dd2..e13a2ce6f4 100644
--- a/engines/titanic/game/credits.cpp
+++ b/engines/titanic/game/credits.cpp
@@ -36,7 +36,7 @@ void CCredits::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_fieldBC, indent);
file->writeNumberLine(_fieldC0, indent);
-
+
CGameObject::save(file, indent);
}
@@ -60,7 +60,7 @@ bool CCredits::TimerMsg(CTimerMsg *msg) {
setVisible(true);
loadSound("a#16.wav");
loadSound("a#24.wav");
-
+
playCutscene(0, 18);
playGlobalSound("a#16.wav", -1, false, false, 0);
playCutscene(19, 642);
diff --git a/engines/titanic/game/fan_control.cpp b/engines/titanic/game/fan_control.cpp
index ad3efc92fb..288fdb639f 100644
--- a/engines/titanic/game/fan_control.cpp
+++ b/engines/titanic/game/fan_control.cpp
@@ -128,7 +128,7 @@ bool CFanControl::StatusChangeMsg(CStatusChangeMsg *msg) {
}
}
break;
-
+
default:
break;
}
diff --git a/engines/titanic/game/fan_noises.cpp b/engines/titanic/game/fan_noises.cpp
index 9144f523f4..d285563de3 100644
--- a/engines/titanic/game/fan_noises.cpp
+++ b/engines/titanic/game/fan_noises.cpp
@@ -96,7 +96,7 @@ bool CFanNoises::LeaveRoomMsg(CLeaveRoomMsg *msg) {
if (getParent() == msg->_oldRoom && _soundHandle != -1) {
if (isSoundActive(_soundHandle))
stopSound(_soundHandle, _stopSeconds);
-
+
_soundHandle = -1;
_startFlag = false;
}
diff --git a/engines/titanic/game/gondolier/gondolier_mixer.cpp b/engines/titanic/game/gondolier/gondolier_mixer.cpp
index 26deda8bca..fc71ddd357 100644
--- a/engines/titanic/game/gondolier/gondolier_mixer.cpp
+++ b/engines/titanic/game/gondolier/gondolier_mixer.cpp
@@ -73,7 +73,7 @@ bool CGondolierMixer::EnterRoomMsg(CEnterRoomMsg *msg) {
CTurnOn onMsg;
onMsg.execute(this);
}
-
+
return true;
}
diff --git a/engines/titanic/game/gondolier/gondolier_slider.cpp b/engines/titanic/game/gondolier/gondolier_slider.cpp
index e7a46eb33d..e7ca61de9c 100644
--- a/engines/titanic/game/gondolier/gondolier_slider.cpp
+++ b/engines/titanic/game/gondolier/gondolier_slider.cpp
@@ -190,7 +190,7 @@ bool CGondolierSlider::FrameMsg(CFrameMsg *msg) {
int yp = 0;
if (_arrayIndex > 0)
yp = ARRAY[_arrayIndex] - ARRAY[_arrayIndex - 1];
-
+
if (!_string2.empty()) {
CTranslateObjectMsg transMsg;
transMsg._delta = Point(0, yp);
diff --git a/engines/titanic/game/head_slot.cpp b/engines/titanic/game/head_slot.cpp
index f7df02d364..06c366abd6 100644
--- a/engines/titanic/game/head_slot.cpp
+++ b/engines/titanic/game/head_slot.cpp
@@ -87,9 +87,9 @@ bool CHeadSlot::AddHeadPieceMsg(CAddHeadPieceMsg *msg) {
}
bool CHeadSlot::SenseWorkingMsg(CSenseWorkingMsg *msg) {
- if (_fieldEC)
+ if (_fieldEC)
playMovie(_fieldE4, _fieldE8, 0);
-
+
_string1 = msg->_value;
_fieldEC = false;
return true;
diff --git a/engines/titanic/game/idle_summoner.cpp b/engines/titanic/game/idle_summoner.cpp
index 5ca3209e28..0e3604a4a9 100644
--- a/engines/titanic/game/idle_summoner.cpp
+++ b/engines/titanic/game/idle_summoner.cpp
@@ -82,7 +82,7 @@ bool CIdleSummoner::TimerMsg(CTimerMsg *msg) {
int region = talkGetDialRegion("BellBot", 1);
uint delay = region == 1 ? 15000 : 12000;
uint enterTicks = MIN(getNodeEnterTicks(), _ticks);
-
+
CString name;
uint ticks = getTicksCount() - enterTicks;
if (ticks > delay) {
diff --git a/engines/titanic/game/light_switch.cpp b/engines/titanic/game/light_switch.cpp
index 188691033a..6badf63b5b 100644
--- a/engines/titanic/game/light_switch.cpp
+++ b/engines/titanic/game/light_switch.cpp
@@ -40,7 +40,7 @@ END_MESSAGE_MAP()
bool CLightSwitch::_flag;
-CLightSwitch::CLightSwitch() : CBackground(),
+CLightSwitch::CLightSwitch() : CBackground(),
_fieldE0(0), _fieldE4(0), _fieldE8(0) {
}
diff --git a/engines/titanic/game/missiveomat.cpp b/engines/titanic/game/missiveomat.cpp
index 6f47131716..8f7845bc3f 100644
--- a/engines/titanic/game/missiveomat.cpp
+++ b/engines/titanic/game/missiveomat.cpp
@@ -96,7 +96,7 @@ bool CMissiveOMat::KeyCharMsg(CKeyCharMsg *msg) {
if (editMsg._param == 1000) {
editMsg._mode = 3;
editMsg.execute(loginControl);
-
+
_string1 = editMsg._text;
if (!_string1.empty()) {
loadFrame(2);
@@ -222,7 +222,7 @@ bool CMissiveOMat::MissiveOMatActionMsg(CMissiveOMatActionMsg *msg) {
CString *strP = &_messages[_personIndex * 19];
for (_totalMessages = 0; !strP->empty(); ++strP, ++_totalMessages)
;
-
+
CMissiveOMatActionMsg actionMsg;
actionMsg._action = REDRAW_MESSAGE;
actionMsg.execute(this);
@@ -237,7 +237,7 @@ bool CMissiveOMat::MissiveOMatActionMsg(CMissiveOMatActionMsg *msg) {
actionMsg.execute(this);
}
break;
-
+
case PRIOR_MESSAGE:
if (_messageNum > 0) {
--_messageNum;
diff --git a/engines/titanic/game/movie_tester.h b/engines/titanic/game/movie_tester.h
index 17a7d489d8..60eacee7e9 100644
--- a/engines/titanic/game/movie_tester.h
+++ b/engines/titanic/game/movie_tester.h
@@ -45,6 +45,14 @@ public:
* Load the data for the class from file
*/
virtual void load(SimpleFile *file);
+
+ /**
+ * Loads a movie
+ */
+ void loadMovie(const CString &name, bool pendingFlag = true) {
+ CGameObject::loadMovie(name, pendingFlag);
+ _surface->flipVertically();
+ }
};
} // End of namespace Titanic
diff --git a/engines/titanic/game/music_console_button.cpp b/engines/titanic/game/music_console_button.cpp
index dc86765476..40492aafe4 100644
--- a/engines/titanic/game/music_console_button.cpp
+++ b/engines/titanic/game/music_console_button.cpp
@@ -56,7 +56,7 @@ bool CMusicConsoleButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
CMusicHasStartedMsg startedMsg;
startedMsg.execute("Music Room Phonograph");
-
+
if (CMusicRoom::_musicHandler->checkSound(1)
&& CMusicRoom::_musicHandler->checkSound(2)
&& CMusicRoom::_musicHandler->checkSound(3)) {
@@ -82,7 +82,7 @@ bool CMusicConsoleButton::LeaveViewMsg(CLeaveViewMsg *msg) {
bool CMusicConsoleButton::SetMusicControlsMsg(CSetMusicControlsMsg *msg) {
CMusicRoom *musicRoom = getMusicRoom();
CQueryMusicControlSettingMsg queryMsg;
-
+
queryMsg.execute("Bells Mute Control");
musicRoom->setMuteControl(BELLS, queryMsg._value == 1 ? 1 : 0);
queryMsg.execute("Bells Pitch Control");
diff --git a/engines/titanic/game/nav_helmet.cpp b/engines/titanic/game/nav_helmet.cpp
index 96411ad6b7..3e2a38486d 100644
--- a/engines/titanic/game/nav_helmet.cpp
+++ b/engines/titanic/game/nav_helmet.cpp
@@ -100,7 +100,7 @@ bool CNavHelmet::PETHelmetOnOffMsg(CPETHelmetOnOffMsg *msg) {
playSound("a#48.wav");
playSound("a#47.wav");
}
-
+
return true;
}
diff --git a/engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp b/engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp
index 2654042967..69fc629606 100644
--- a/engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp
+++ b/engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp
@@ -35,7 +35,7 @@ BEGIN_MESSAGE_MAP(CParrotNutBowlActor, CGameObject)
ON_MESSAGE(NutPuzzleMsg)
END_MESSAGE_MAP()
-CParrotNutBowlActor::CParrotNutBowlActor() : CGameObject(),
+CParrotNutBowlActor::CParrotNutBowlActor() : CGameObject(),
_puzzleDone(0), _state(0) {
}
@@ -43,7 +43,7 @@ void CParrotNutBowlActor::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_puzzleDone, indent);
file->writeNumberLine(_state, indent);
-
+
CGameObject::save(file, indent);
}
diff --git a/engines/titanic/game/parrot/parrot_nut_eater.cpp b/engines/titanic/game/parrot/parrot_nut_eater.cpp
index 751da931ac..49b8de509f 100644
--- a/engines/titanic/game/parrot/parrot_nut_eater.cpp
+++ b/engines/titanic/game/parrot/parrot_nut_eater.cpp
@@ -39,7 +39,7 @@ CParrotNutEater::CParrotNutEater() : CGameObject(), _fieldBC(0),
void CParrotNutEater::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_fieldBC, indent);
-
+
CGameObject::save(file, indent);
}
diff --git a/engines/titanic/game/place_holder_item.cpp b/engines/titanic/game/place_holder_item.cpp
index ecd9c9a10b..108c25ced8 100644
--- a/engines/titanic/game/place_holder_item.cpp
+++ b/engines/titanic/game/place_holder_item.cpp
@@ -44,7 +44,7 @@ void CPlaceHolderItem::save(SimpleFile *file, int indent) {
file->writePoint(_pos1, indent);
file->writePoint(_pos2, indent);
file->writeQuotedLine(_string1, indent);
-
+
CNamedItem::save(file, indent);
}
@@ -89,7 +89,7 @@ void CPlaceHolderItem::load(SimpleFile *file) {
default:
break;
}
-
+
CNamedItem::load(file);
}
diff --git a/engines/titanic/game/placeholder/bar_shelf_vis_centre.h b/engines/titanic/game/placeholder/bar_shelf_vis_centre.h
index 8ad3dcb8d1..25613643ea 100644
--- a/engines/titanic/game/placeholder/bar_shelf_vis_centre.h
+++ b/engines/titanic/game/placeholder/bar_shelf_vis_centre.h
@@ -37,7 +37,7 @@ private:
public:
CLASSDEF;
CBarShelfVisCentre() : CPlaceHolder(), _flag(false) {}
-
+
/**
* Save the data for the class to file
*/
diff --git a/engines/titanic/game/restaurant_cylinder_holder.cpp b/engines/titanic/game/restaurant_cylinder_holder.cpp
index 8726d1a925..adf029d8f7 100644
--- a/engines/titanic/game/restaurant_cylinder_holder.cpp
+++ b/engines/titanic/game/restaurant_cylinder_holder.cpp
@@ -121,7 +121,7 @@ bool CRestaurantCylinderHolder::MovieEndMsg(CMovieEndMsg *msg) {
bool CRestaurantCylinderHolder::QueryCylinderHolderMsg(CQueryCylinderHolderMsg *msg) {
CNamedItem *cylinder = findByName("Phonograph Cylinder", true);
- msg->_value1 = _field118;
+ msg->_value1 = _field118;
if (cylinder) {
msg->_value2 = 1;
msg->_target = cylinder;
diff --git a/engines/titanic/game/sauce_dispensor.cpp b/engines/titanic/game/sauce_dispensor.cpp
index 410d4a3153..7010d00be1 100644
--- a/engines/titanic/game/sauce_dispensor.cpp
+++ b/engines/titanic/game/sauce_dispensor.cpp
@@ -67,7 +67,7 @@ void CSauceDispensor::load(SimpleFile *file) {
bool CSauceDispensor::Use(CUse *msg) {
CVisibleMsg visibleMsg(true);
-
+
if (msg->_item->isEquals("Chicken")) {
CChicken *chicken = static_cast<CChicken *>(msg->_item);
_field104 = true;
@@ -113,7 +113,7 @@ bool CSauceDispensor::Use(CUse *msg) {
CActMsg actMsg(_string3);
actMsg.execute("BeerGlass");
- }
+ }
}
return true;
diff --git a/engines/titanic/game/service_elevator_window.cpp b/engines/titanic/game/service_elevator_window.cpp
index b0cc53abb4..13db7a26f8 100644
--- a/engines/titanic/game/service_elevator_window.cpp
+++ b/engines/titanic/game/service_elevator_window.cpp
@@ -69,7 +69,7 @@ bool CServiceElevatorWindow::ServiceElevatorFloorChangeMsg(CServiceElevatorFloor
int count = _endFrame - _startFrame;
setMovieFrameRate(1.0 * count / val);
-
+
int startFrame = clip->_startFrame + count * FACTORS[msg->_value1] / 100;
int endFrame = clip->_startFrame + count * FACTORS[msg->_value2] / 100;
@@ -107,7 +107,7 @@ bool CServiceElevatorWindow::EnterViewMsg(CEnterViewMsg *msg) {
loadFrame(0);
}
}
-
+
return true;
}
diff --git a/engines/titanic/game/sgt/chest_of_drawers.cpp b/engines/titanic/game/sgt/chest_of_drawers.cpp
index d9c72d3021..2db26addf5 100644
--- a/engines/titanic/game/sgt/chest_of_drawers.cpp
+++ b/engines/titanic/game/sgt/chest_of_drawers.cpp
@@ -58,7 +58,7 @@ bool CChestOfDrawers::TurnOff(CTurnOff *msg) {
visibleMsg.execute("Drawer");
_statics->_v6 = "Closed";
_fieldE0 = true;
-
+
_startFrame = 14;
_endFrame = 27;
playMovie(14, 27, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE);
diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp
index 780f92b5ad..571ebcd6fa 100644
--- a/engines/titanic/game/television.cpp
+++ b/engines/titanic/game/television.cpp
@@ -137,7 +137,7 @@ bool CTelevision::ChangeSeasonMsg(CChangeSeasonMsg *msg) {
_v3 = 0;
}
- return true;
+ return true;
}
bool CTelevision::EnterViewMsg(CEnterViewMsg *msg) {
@@ -219,7 +219,7 @@ bool CTelevision::PETActivateMsg(CPETActivateMsg *msg) {
stopMovie();
if (isSoundActive(_soundHandle))
stopSound(_soundHandle, 0);
-
+
setVisible(false);
}
diff --git a/engines/titanic/game/transport/lift_indicator.cpp b/engines/titanic/game/transport/lift_indicator.cpp
index 10d62a0775..a642451fe0 100644
--- a/engines/titanic/game/transport/lift_indicator.cpp
+++ b/engines/titanic/game/transport/lift_indicator.cpp
@@ -150,7 +150,7 @@ bool CLiftindicator::PETActivateMsg(CPETActivateMsg *msg) {
petDisplayMessage(1, BOT_BLOCKING_ELEVATOR);
} else {
_endFrame = pet->getRoomsFloorNum();
-
+
if (petGetRoomsWellEntry() == 4 && !CLift::_v6
&& pet->getRoomsFloorNum() != CLift::_elevator4Floor) {
petDisplayMessage(1, ELEVATOR_NON_FUNCTIONAL);
diff --git a/engines/titanic/game/transport/service_elevator.cpp b/engines/titanic/game/transport/service_elevator.cpp
index 1980825cb6..066a418dbb 100644
--- a/engines/titanic/game/transport/service_elevator.cpp
+++ b/engines/titanic/game/transport/service_elevator.cpp
@@ -24,7 +24,7 @@
#include "titanic/core/room_item.h"
#include "titanic/npcs/doorbot.h"
-namespace Titanic {
+namespace Titanic {
BEGIN_MESSAGE_MAP(CServiceElevator, CTransport)
ON_MESSAGE(BodyInBilgeRoomMsg)
@@ -182,7 +182,7 @@ bool CServiceElevator::TimerMsg(CTimerMsg *msg) {
else if (_v3 == 1)
actMsg._action = "DoorbotPlayerPressedMiddleButton";
- actMsg.execute(doorbot);
+ actMsg.execute(doorbot);
}
}
}
diff --git a/engines/titanic/game/variable_list.cpp b/engines/titanic/game/variable_list.cpp
index 1ddf1bc957..2a4a7df961 100644
--- a/engines/titanic/game/variable_list.cpp
+++ b/engines/titanic/game/variable_list.cpp
@@ -33,7 +33,7 @@ void CVariableListItem::save(SimpleFile *file, int indent) {
file->writeQuotedLine(_string2, indent);
file->writeQuotedLine(_string3, indent);
file->writeQuotedLine(_string4, indent);
-
+
ListItem::save(file, indent);
}
@@ -66,7 +66,7 @@ void CVariableListItem::load(SimpleFile *file) {
_field40 = field40;
_field44 = field44;
-
+
ListItem::load(file);
}
diff --git a/engines/titanic/game_location.cpp b/engines/titanic/game_location.cpp
index 3a1d0c9e48..1e4e067f70 100644
--- a/engines/titanic/game_location.cpp
+++ b/engines/titanic/game_location.cpp
@@ -52,7 +52,7 @@ void CGameLocation::load(SimpleFile *file) {
void CGameLocation::setView(CViewItem *view) {
if (_view) {
- for (CTreeItem *treeItem = _view; treeItem;
+ for (CTreeItem *treeItem = _view; treeItem;
treeItem = treeItem->scan(_view)) {
CGameObject *obj = dynamic_cast<CGameObject *>(treeItem);
if (obj)
diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp
index 7d9dc37a10..6023244325 100644
--- a/engines/titanic/game_manager.cpp
+++ b/engines/titanic/game_manager.cpp
@@ -32,11 +32,11 @@ namespace Titanic {
CGameManager::CGameManager(CProjectItem *project, CGameView *gameView, Audio::Mixer *mixer):
_project(project), _gameView(gameView), _trueTalkManager(this),
- _inputHandler(this), _inputTranslator(&_inputHandler),
+ _inputHandler(this), _inputTranslator(&_inputHandler),
_gameState(this), _sound(this, mixer), _musicRoom(this),
_treeItem(nullptr), _soundMaker(nullptr), _movieRoom(nullptr),
_dragItem(nullptr), _field54(0), _lastDiskTicksCount(0), _tickCount2(0) {
-
+
CTimeEventInfo::_nextId = 0;
_movie = nullptr;
_movieSurface = CScreenManager::_screenManagerPtr->createSurface(600, 340);
@@ -95,7 +95,7 @@ void CGameManager::postLoad(CProjectItem *project) {
_gameView->setView(view);
}
}
-
+
// Signal to anything interested that the game has been loaded
CLoadSuccessMsg msg(_lastDiskTicksCount - _tickCount2);
msg.execute(project, nullptr, MSGFLAG_SCAN);
@@ -188,7 +188,7 @@ void CGameManager::update() {
CTextCursor *textCursor = screenManager->_textCursor;
if (textCursor && textCursor->_active)
_bounds.extend(textCursor->getCursorBounds());
-
+
// Set the surface bounds
screenManager->setSurfaceBounds(SURFACE_BACKBUFFER, _bounds);
diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h
index 262ea0169b..1671517e07 100644
--- a/engines/titanic/game_manager.h
+++ b/engines/titanic/game_manager.h
@@ -196,7 +196,7 @@ public:
/**
* Flags whether the timer will be persisent across save & loads
*/
- void setTimerPersisent(uint id, bool flag) {
+ void setTimerPersisent(uint id, bool flag) {
_timers.setPersisent(id, flag);
}
diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp
index 8814dba831..ea94deec35 100644
--- a/engines/titanic/game_state.cpp
+++ b/engines/titanic/game_state.cpp
@@ -89,7 +89,7 @@ void CGameState::setMode(GameStateMode newMode) {
} else if (newMode != GSMODE_CUTSCENE && newMode != _mode) {
if (sm && sm->_mouseCursor)
sm->_mouseCursor->show();
-
+
if (_gameManager)
_gameManager->unlockInputHandler();
}
diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h
index 70d47b55c1..77b4ded79f 100644
--- a/engines/titanic/game_state.h
+++ b/engines/titanic/game_state.h
@@ -33,7 +33,7 @@ namespace Titanic {
class CGameManager;
-enum GameStateMode {
+enum GameStateMode {
GSMODE_NONE = 0, GSMODE_INTERACTIVE = 1, GSMODE_CUTSCENE = 2,
GSMODE_3 = 3, GSMODE_4 = 4, GSMODE_INSERT_CD = 5, GSMODE_PENDING_LOAD = 6
};
diff --git a/engines/titanic/game_view.cpp b/engines/titanic/game_view.cpp
index cb84b6a3b1..d155812390 100644
--- a/engines/titanic/game_view.cpp
+++ b/engines/titanic/game_view.cpp
@@ -58,7 +58,7 @@ void CGameView::createSurface(const CResourceKey &key) {
_gameManager->initBounds();
delete _surface;
_surface = nullptr;
-
+
// Create a fresh surface
CScreenManager::setCurrent();
_surface = CScreenManager::_currentScreenManagerPtr->createSurface(key);
diff --git a/engines/titanic/game_view.h b/engines/titanic/game_view.h
index 29e800bc7a..e17d72b472 100644
--- a/engines/titanic/game_view.h
+++ b/engines/titanic/game_view.h
@@ -57,7 +57,7 @@ public:
* Set the currently active view
*/
virtual void setView(CViewItem *item) = 0;
-
+
virtual void draw(const Rect &bounds) = 0;
/**
diff --git a/engines/titanic/gfx/send_to_succ.h b/engines/titanic/gfx/send_to_succ.h
index 734c4a7db3..201735385d 100644
--- a/engines/titanic/gfx/send_to_succ.h
+++ b/engines/titanic/gfx/send_to_succ.h
@@ -32,7 +32,7 @@ class CSendToSucc : public CToggleSwitch {
public:
CLASSDEF;
CSendToSucc();
-
+
/**
* Save the data for the class to file
*/
diff --git a/engines/titanic/input_handler.cpp b/engines/titanic/input_handler.cpp
index df09cf24fb..9fa2b0073c 100644
--- a/engines/titanic/input_handler.cpp
+++ b/engines/titanic/input_handler.cpp
@@ -164,7 +164,7 @@ CGameObject *CInputHandler::dragEnd(const Point &pt, CTreeItem *dragItem) {
if (target) {
// Check if the cursor is on the PET. If so, pass to the PET
// to see what specific element the drag ended on
- CProjectItem *project = view->getRoot();
+ CProjectItem *project = view->getRoot();
if (project) {
CPetControl *petControl = project->getPetControl();
if (petControl && petControl->contains(pt)) {
diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp
index 690acdc25f..80da792e4a 100644
--- a/engines/titanic/main_game_window.cpp
+++ b/engines/titanic/main_game_window.cpp
@@ -130,14 +130,14 @@ int CMainGameWindow::selectSavegame() {
void CMainGameWindow::setActiveView(CViewItem *viewItem) {
_gameManager->_gameState._gameLocation.setView(viewItem);
-
+
CResourceKey key;
if (viewItem->getResourceKey(&key)) {
// Create a surface based on the key
_gameView->createSurface(key);
}
}
-
+
void CMainGameWindow::draw() {
if (_gameManager) {
if (!_gameView->_surface) {
diff --git a/engines/titanic/messages/messages.cpp b/engines/titanic/messages/messages.cpp
index 5f587c975d..a8507063ff 100644
--- a/engines/titanic/messages/messages.cpp
+++ b/engines/titanic/messages/messages.cpp
@@ -91,7 +91,7 @@ const MSGMAP_ENTRY *CMessage::findMapEntry(const CTreeItem *treeItem, const Clas
for (const ClassDef *entryDef = entry->_class; entryDef; entryDef = entryDef->_parent) {
if (entryDef == classDef)
return entry;
- }
+ }
}
}
diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h
index 4fc4067a1a..b421e8ecb8 100644
--- a/engines/titanic/messages/messages.h
+++ b/engines/titanic/messages/messages.h
@@ -29,7 +29,7 @@
namespace Titanic {
-enum MessageFlag {
+enum MessageFlag {
MSGFLAG_SCAN = 1,
MSGFLAG_BREAK_IF_HANDLED = 2,
MSGFLAG_CLASS_DEF = 4
diff --git a/engines/titanic/messages/mouse_messages.cpp b/engines/titanic/messages/mouse_messages.cpp
index 18fa625c1c..888ca36187 100644
--- a/engines/titanic/messages/mouse_messages.cpp
+++ b/engines/titanic/messages/mouse_messages.cpp
@@ -29,7 +29,7 @@ namespace Titanic {
void CMouseButtonDownMsg::generate() {
CInputHandler &inputHandler = *CScreenManager::_screenManagerPtr->_inputHandler;
const Point &mousePos = inputHandler._mousePos;
-
+
CMouseButtonDownMsg msg(mousePos, MB_LEFT);
inputHandler.handleMessage(msg, false);
}
diff --git a/engines/titanic/messages/mouse_messages.h b/engines/titanic/messages/mouse_messages.h
index e7c419bbdc..a10f3b42a8 100644
--- a/engines/titanic/messages/mouse_messages.h
+++ b/engines/titanic/messages/mouse_messages.h
@@ -157,7 +157,7 @@ public:
public:
CLASSDEF;
CPassOnDragStartMsg() : CMessage() {}
- CPassOnDragStartMsg(const Point &pt, int v3 = 0, int v4 = 0) :
+ CPassOnDragStartMsg(const Point &pt, int v3 = 0, int v4 = 0) :
CMessage(), _mousePos(pt), _value3(v3), _value4(v4) {}
static bool isSupportedBy(const CTreeItem *item) {
diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk
index 377a22fbf8..e802456c5a 100644
--- a/engines/titanic/module.mk
+++ b/engines/titanic/module.mk
@@ -474,6 +474,7 @@ MODULE_OBJS := \
support/movie_range_info.o \
support/movie_manager.o \
support/credit_text.o \
+ support/transparency_surface.o \
support/rect.o \
support/screen_manager.o \
support/simple_file.o \
diff --git a/engines/titanic/moves/enter_exit_sec_class_mini_lift.cpp b/engines/titanic/moves/enter_exit_sec_class_mini_lift.cpp
index c7e16ef84e..6d1951b72b 100644
--- a/engines/titanic/moves/enter_exit_sec_class_mini_lift.cpp
+++ b/engines/titanic/moves/enter_exit_sec_class_mini_lift.cpp
@@ -63,7 +63,7 @@ bool CEnterExitSecClassMiniLift::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
_statics->_viewName = getRoomNodeName() + ".W";
changeView("SecClassLittleLift.Node 1.E");
_statics->_state = 1;
-
+
CPetControl *pet = getPetControl();
if (pet) {
pet->setRoomsRoomNum(_roomNum);
diff --git a/engines/titanic/moves/enter_exit_sec_class_mini_lift.h b/engines/titanic/moves/enter_exit_sec_class_mini_lift.h
index 839d2c04fa..a16122a591 100644
--- a/engines/titanic/moves/enter_exit_sec_class_mini_lift.h
+++ b/engines/titanic/moves/enter_exit_sec_class_mini_lift.h
@@ -46,7 +46,7 @@ public:
CEnterExitSecClassMiniLift() : CGameObject(), _roomNum(0) {}
static void init();
static void deinit();
-
+
/**
* Save the data for the class to file
*/
diff --git a/engines/titanic/moves/enter_exit_view.cpp b/engines/titanic/moves/enter_exit_view.cpp
index 6778ebb52a..a3f01f981a 100644
--- a/engines/titanic/moves/enter_exit_view.cpp
+++ b/engines/titanic/moves/enter_exit_view.cpp
@@ -31,7 +31,7 @@ BEGIN_MESSAGE_MAP(CEnterExitView, CGameObject)
END_MESSAGE_MAP()
CEnterExitView::CEnterExitView() : CGameObject(), _leaveEndFrame(0),
- _leaveStartFrame(0), _enterEndFrame(0), _enterStartFrame(0),
+ _leaveStartFrame(0), _enterEndFrame(0), _enterStartFrame(0),
_visibleAfterMovie(true) {
}
diff --git a/engines/titanic/moves/exit_arboretum.cpp b/engines/titanic/moves/exit_arboretum.cpp
index ba162843b5..3c1591c393 100644
--- a/engines/titanic/moves/exit_arboretum.cpp
+++ b/engines/titanic/moves/exit_arboretum.cpp
@@ -32,7 +32,7 @@ BEGIN_MESSAGE_MAP(CExitArboretum, CMovePlayerTo)
ON_MESSAGE(TurnOff)
END_MESSAGE_MAP()
-CExitArboretum::CExitArboretum() : CMovePlayerTo(),
+CExitArboretum::CExitArboretum() : CMovePlayerTo(),
_seasonNum(0), _fieldCC(0), _enabled(true) {
}
diff --git a/engines/titanic/moves/exit_pellerator.cpp b/engines/titanic/moves/exit_pellerator.cpp
index 3140d90b4c..3d1438a942 100644
--- a/engines/titanic/moves/exit_pellerator.cpp
+++ b/engines/titanic/moves/exit_pellerator.cpp
@@ -61,7 +61,7 @@ void CExitPellerator::load(SimpleFile *file) {
bool CExitPellerator::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
CString name = getName();
-
+
if (name == "ExitPellerator") {
if (_statics->_v2 != 2) {
switch (getRandomNumber(2)) {
diff --git a/engines/titanic/npcs/barbot.cpp b/engines/titanic/npcs/barbot.cpp
index 2524a835f8..791adaa05c 100644
--- a/engines/titanic/npcs/barbot.cpp
+++ b/engines/titanic/npcs/barbot.cpp
@@ -142,7 +142,7 @@ void CBarbot::load(SimpleFile *file) {
_field158 = file->readNumber();
_field15C = file->readNumber();
_field160 = file->readNumber();
-
+
CTrueTalkNPC::load(file);
}
@@ -179,7 +179,7 @@ bool CBarbot::ActMsg(CActMsg *msg) {
statusMsg._newStatus = 2;
statusMsg.execute("PickUpGlass");
_field158 = 3;
-
+
playRange(_frames[32], MOVIE_NOTIFY_OBJECT);
playRange(_frames[30], MOVIE_NOTIFY_OBJECT);
_frameNum = _frames[30]._endFrame;
@@ -317,7 +317,7 @@ bool CBarbot::TurnOn(CTurnOn *msg) {
playRange(_frames[23], MOVIE_NOTIFY_OBJECT);
playRange(_frames[21], MOVIE_NOTIFY_OBJECT);
_frameNum = _frames[21]._endFrame;
-
+
switch (g_vm->getRandomNumber(2)) {
case 0:
playRange(_frames[10], MOVIE_NOTIFY_OBJECT);
@@ -575,7 +575,7 @@ bool CBarbot::TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg) {
}
bool CBarbot::FrameMsg(CFrameMsg *msg) {
- if (!_fieldC4 || _frameNum != -1 || _field148 != -1
+ if (!_fieldC4 || _frameNum != -1 || _field148 != -1
|| (msg->_ticks - _field14C) <= 5000
|| (msg->_ticks - _field150) <= 1000)
return true;
@@ -611,7 +611,7 @@ bool CBarbot::FrameMsg(CFrameMsg *msg) {
playRange(_frames[1], MOVIE_NOTIFY_OBJECT);
_field148 = _frames[1]._endFrame;
break;
-
+
case 4:
playRange(_frames[3], MOVIE_NOTIFY_OBJECT);
_field148 = _frames[3]._endFrame;
diff --git a/engines/titanic/npcs/bellbot.cpp b/engines/titanic/npcs/bellbot.cpp
index 0170491270..7aa32eeef3 100644
--- a/engines/titanic/npcs/bellbot.cpp
+++ b/engines/titanic/npcs/bellbot.cpp
@@ -74,7 +74,7 @@ bool CBellBot::OnSummonBotMsg(COnSummonBotMsg *msg) {
{ "MusicRoomLobby", "z#192.wav" },
{ "1stClassRestaurant", "z#190.wav" }
};
-
+
int idx;
for (idx = 0; idx < 8; ++idx) {
if (compareRoomNameTo(ROOM_WAVES[idx][0])) {
diff --git a/engines/titanic/npcs/callbot.cpp b/engines/titanic/npcs/callbot.cpp
index 4af9876b35..0979fa46f6 100644
--- a/engines/titanic/npcs/callbot.cpp
+++ b/engines/titanic/npcs/callbot.cpp
@@ -57,7 +57,7 @@ bool CCallBot::TurnOn(CTurnOn *msg) {
bool CCallBot::EnterViewMsg(CEnterViewMsg *msg) {
if (_enabled) {
CRoomItem *room = getRoom();
-
+
if (room) {
CSummonBotQueryMsg queryMsg;
queryMsg._npcName = _npcName;
diff --git a/engines/titanic/npcs/deskbot.cpp b/engines/titanic/npcs/deskbot.cpp
index 8f1fc28e20..c5032f1674 100644
--- a/engines/titanic/npcs/deskbot.cpp
+++ b/engines/titanic/npcs/deskbot.cpp
@@ -94,7 +94,7 @@ bool CDeskbot::EnterViewMsg(CEnterViewMsg *msg) {
_deskbotActive = false;
_fieldC4 = 0;
loadFrame(625);
-
+
return true;
}
@@ -264,7 +264,7 @@ bool CDeskbot::TrueTalkNotifySpeechStartedMsg(CTrueTalkNotifySpeechStartedMsg *m
default:
break;
}
-
+
return true;
}
diff --git a/engines/titanic/npcs/maitre_d.cpp b/engines/titanic/npcs/maitre_d.cpp
index 09444f5611..658b7c7123 100644
--- a/engines/titanic/npcs/maitre_d.cpp
+++ b/engines/titanic/npcs/maitre_d.cpp
@@ -156,7 +156,7 @@ bool CMaitreD::NPCPlayTalkingAnimationMsg(CNPCPlayTalkingAnimationMsg *msg) {
if (msg->_value2 != 2) {
msg->_names = NAMES;
-
+
CAnimateMaitreDMsg animMsg;
if (_field12C)
animMsg._value = 0;
diff --git a/engines/titanic/npcs/parrot.cpp b/engines/titanic/npcs/parrot.cpp
index 6e7aa4ec57..358a86686f 100644
--- a/engines/titanic/npcs/parrot.cpp
+++ b/engines/titanic/npcs/parrot.cpp
@@ -116,13 +116,13 @@ CParrot::CParrot() : CTrueTalkNPC() {
void CParrot::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_assetNumber, indent);
-
+
file->writeQuotedLine(_assetName, indent);
file->writeNumberLine(_field108, indent);
file->writeNumberLine(_v1, indent);
file->writeNumberLine(_v2, indent);
file->writeNumberLine(_v3, indent);
-
+
file->writeQuotedLine(_string2, indent);
file->writeNumberLine(_field118, indent);
file->writeNumberLine(_field11C, indent);
@@ -581,7 +581,7 @@ bool CParrot::FrameMsg(CFrameMsg *msg) {
actMsg.execute(_field134);
}
- _npcFlags &= ~(NPCFLAG_10000 | NPCFLAG_20000 | NPCFLAG_40000
+ _npcFlags &= ~(NPCFLAG_10000 | NPCFLAG_20000 | NPCFLAG_40000
| NPCFLAG_80000 | NPCFLAG_100000 | NPCFLAG_200000 | NPCFLAG_400000);
return true;
}
diff --git a/engines/titanic/npcs/parrot_succubus.cpp b/engines/titanic/npcs/parrot_succubus.cpp
index d285c219b5..657bde5b66 100644
--- a/engines/titanic/npcs/parrot_succubus.cpp
+++ b/engines/titanic/npcs/parrot_succubus.cpp
@@ -34,7 +34,7 @@ BEGIN_MESSAGE_MAP(CParrotSuccUBus, CSuccUBus)
ON_MESSAGE(LeaveNodeMsg)
END_MESSAGE_MAP()
-CParrotSuccUBus::CParrotSuccUBus() : CSuccUBus(), _field1DC(0),
+CParrotSuccUBus::CParrotSuccUBus() : CSuccUBus(), _field1DC(0),
_field1EC(0), _field1F0(376), _field1F4(393) {
}
@@ -43,7 +43,7 @@ void CParrotSuccUBus::save(SimpleFile *file, int indent) {
file->writeNumberLine(_field1DC, indent);
file->writeQuotedLine(_string3, indent);
file->writeNumberLine(_field1EC, indent);
-
+
CSuccUBus::save(file, indent);
}
diff --git a/engines/titanic/npcs/succubus.cpp b/engines/titanic/npcs/succubus.cpp
index 453f016757..6db8c8d798 100644
--- a/engines/titanic/npcs/succubus.cpp
+++ b/engines/titanic/npcs/succubus.cpp
@@ -183,7 +183,7 @@ void CSuccUBus::load(SimpleFile *file) {
_startFrame2 = file->readNumber();
_endFrame2 = file->readNumber();
_field140 = file->readNumber();
-
+
_v2 = file->readNumber();
_startFrame5 = file->readNumber();
_endFrame5 = file->readNumber();
@@ -282,7 +282,7 @@ bool CSuccUBus::SubAcceptCCarryMsg(CSubAcceptCCarryMsg *msg) {
CChicken *chicken = dynamic_cast<CChicken *>(item);
bool chickenFlag = chicken ? chicken->_string6 != "None" : false;
-
+
item->setVisible(false);
if (_startFrame1 >= 0) {
playSound("z#23.wav");
@@ -353,7 +353,7 @@ bool CSuccUBus::LeaveViewMsg(CLeaveViewMsg *msg) {
_enabled = false;
if (_startFrame10 >= 0)
playSound("z#27.wav", 100);
-
+
if (_field15C)
setVisible(false);
}
@@ -397,7 +397,7 @@ bool CSuccUBus::PETDeliverMsg(CPETDeliverMsg *msg) {
petDisplayMessage(2, NOTHING_IN_SUCCUBUS_TRAY);
} else {
_field19C = 0;
-
+
CRoomFlags roomFlags = _roomFlags;
if (!pet->testRooms5(roomFlags) || getPassengerClass() > 0) {
roomFlags = pet->getSpecialRoomFlags("BilgeRoom");
@@ -512,7 +512,7 @@ bool CSuccUBus::MovieEndMsg(CMovieEndMsg *msg) {
if (msg->_endFrame == _endFrame10) {
if (_startFrame11 >= 0)
playSound("z#30.wav", 100);
-
+
if (_field15C) {
_field15C = false;
setVisible(false);
diff --git a/engines/titanic/npcs/titania.cpp b/engines/titanic/npcs/titania.cpp
index 000595f6b7..aa92ddd166 100644
--- a/engines/titanic/npcs/titania.cpp
+++ b/engines/titanic/npcs/titania.cpp
@@ -159,7 +159,7 @@ bool CTitania::ActMsg(CActMsg *msg) {
CSenseWorkingMsg workingMsg2("Not Working");
CSenseWorkingMsg workingMsg3("Not Working");
CSenseWorkingMsg workingMsg4("Not Working");
-
+
if (_eye1 && _eye2) {
workingMsg1._value = _visionCentre ? "Working" : "Random";
}
@@ -201,10 +201,10 @@ bool CTitania::EnterViewMsg(CEnterViewMsg *msg) {
_showIntro = false;
disableMouse();
petHide();
-
+
CSetFrameMsg frameMsg;
frameMsg._frameNumber = 25;
- frameMsg.execute("Bomb");
+ frameMsg.execute("Bomb");
playCutscene(0, 52);
setVisible(false);
diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp
index 95438ce81e..4cdab24f6d 100644
--- a/engines/titanic/pet_control/pet_control.cpp
+++ b/engines/titanic/pet_control/pet_control.cpp
@@ -42,7 +42,7 @@ BEGIN_MESSAGE_MAP(CPetControl, CGameObject)
ON_MESSAGE(TimerMsg)
END_MESSAGE_MAP()
-CPetControl::CPetControl() : CGameObject(),
+CPetControl::CPetControl() : CGameObject(),
_currentArea(PET_CONVERSATION), _inputLockCount(0), _areaLockCount(0),
_areaChangeType(-1), _activeNPC(nullptr), _remoteTarget(nullptr),
_hiddenRoom(nullptr), _drawBounds(20, 350, 620, 480) {
@@ -68,12 +68,12 @@ void CPetControl::save(SimpleFile *file, int indent) {
void CPetControl::load(SimpleFile *file) {
int val = file->readNumber();
isValid();
-
+
if (!val) {
_currentArea = (PetArea)file->readNumber();
_activeNPCName = file->readString();
_remoteTargetName = file->readString();
-
+
loadAreas(file, 0);
}
@@ -93,7 +93,7 @@ void CPetControl::setup() {
bool CPetControl::isValid() {
return _conversations.isValid(this) &&
- _rooms.isValid(this) &&
+ _rooms.isValid(this) &&
_remote.isValid(this) &&
_inventory.isValid(this) &&
_starfield.isValid(this) &&
@@ -427,7 +427,7 @@ void CPetControl::addToInventory(CGameObject *item) {
setArea(PET_INVENTORY);
if (_currentArea == PET_INVENTORY)
_inventory.highlightItem(item);
-
+
makeDirty();
CPETGainedObjectMsg msg;
msg.execute(item);
@@ -471,7 +471,7 @@ bool CPetControl::checkNode(const CString &name) {
return true;
if (name == "NULL")
return false;
-
+
CViewItem *view = gameManager->getView();
if (!view)
return true;
@@ -558,7 +558,7 @@ bool CPetControl::isBotInView(const CString &name) const {
CViewItem *view = gameManager->getView();
if (!view)
return false;
-
+
// Iterate to find NPC
for (CTreeItem *child = view->getFirstChild(); child; child = child->scan(view)) {
CGameObject *gameObject = dynamic_cast<CGameObject *>(child);
diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h
index 454fc0991b..d42dff598c 100644
--- a/engines/titanic/pet_control/pet_control.h
+++ b/engines/titanic/pet_control/pet_control.h
@@ -340,12 +340,12 @@ public:
* Returns true if all input is currently locked (disabled)
*/
bool isInputLocked() const { return _inputLockCount > 0; }
-
+
/**
* Increments the input locked count
*/
void incInputLocks() { ++_inputLockCount; }
-
+
/**
* Decremenst the input locked count
*/
@@ -364,7 +364,7 @@ public:
/**
* Decrement the number of PET area (tab) locks
*/
- void decAreaLocks() {
+ void decAreaLocks() {
_areaLockCount = MAX(_areaLockCount - 1, 0);
}
diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp
index 173c586fc1..58dcd57384 100644
--- a/engines/titanic/pet_control/pet_conversations.cpp
+++ b/engines/titanic/pet_control/pet_conversations.cpp
@@ -60,7 +60,7 @@ bool CPetConversations::reset() {
_dials[0].setup(MODE_UNSELECTED, "3PetDial1", _petControl);
_dials[1].setup(MODE_UNSELECTED, "3PetDial2", _petControl);
_dials[2].setup(MODE_UNSELECTED, "3PetDial3", _petControl);
-
+
_dialBackground.reset("PetDialBack", _petControl);
_scrollUp.reset("PetScrollUp", _petControl);
_scrollDown.reset("PetScrollDown", _petControl);
@@ -334,7 +334,7 @@ bool CPetConversations::setupControl(CPetControl *petControl) {
_dialBackground.setBounds(Rect(0, 0, 21, 130));
_dialBackground.translate(20, 350);
-
+
const Rect rect1(0, 0, 22, 36);
_dials[0].setBounds(rect1);
_dials[0].translate(20, 359);
diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h
index 3333bdc523..efb7db4277 100644
--- a/engines/titanic/pet_control/pet_conversations.h
+++ b/engines/titanic/pet_control/pet_conversations.h
@@ -136,7 +136,7 @@ public:
* Sets up the section
*/
virtual bool setup(CPetControl *petControl);
-
+
/**
* Reset the section
*/
@@ -146,12 +146,12 @@ public:
* Draw the section
*/
virtual void draw(CScreenManager *screenManager);
-
+
/**
* Get the bounds for the section
*/
virtual Rect getBounds() const;
-
+
/**
* Returns true if the object is in a valid state
*/
@@ -190,7 +190,7 @@ public:
* Called when a section is switched to
*/
virtual void enter(PetArea oldArea);
-
+
/**
* Called when a section is being left, to switch to another area
*/
@@ -220,7 +220,7 @@ public:
* Show the text cursor
*/
virtual void showCursor();
-
+
/**
* Hide the text cursor
*/
diff --git a/engines/titanic/pet_control/pet_frame.cpp b/engines/titanic/pet_control/pet_frame.cpp
index 7375c69436..e8244cf2d7 100644
--- a/engines/titanic/pet_control/pet_frame.cpp
+++ b/engines/titanic/pet_control/pet_frame.cpp
@@ -97,7 +97,7 @@ bool CPetFrame::setPetControl(CPetControl *petControl) {
// Set the bounds of the individual elements
_background.setBounds(Rect(20, 350, 620, 480));
_modeBackground.setBounds(Rect(590, 365, 611, 467));
-
+
// Squares used for holding glyphs in various tabs
Rect r(35, 373, 91, 429);
for (int idx = 0, xp = 0; idx < TOTAL_GLYPHS; ++idx, xp += 70) {
@@ -113,7 +113,7 @@ bool CPetFrame::setPetControl(CPetControl *petControl) {
_modeButtons[idx].translate(4, YLIST[idx]);
}
_modeButtons[PET_AREAS[0]].setMode(MODE_SELECTED);
-
+
const int XLIST[] = { 73, 54, 85, 109, 38, 71 };
for (int idx = 0; idx < 6; ++idx) {
_titles[idx].setBounds(Rect(0, 0, 110, 11));
diff --git a/engines/titanic/pet_control/pet_frame.h b/engines/titanic/pet_control/pet_frame.h
index d8924e83d3..720112c1c0 100644
--- a/engines/titanic/pet_control/pet_frame.h
+++ b/engines/titanic/pet_control/pet_frame.h
@@ -53,12 +53,12 @@ public:
* Sets up the section
*/
virtual bool setup(CPetControl *petControl);
-
+
/**
* Sets up the section
*/
virtual bool reset();
-
+
/**
* Handles mouse down messages
*/
diff --git a/engines/titanic/pet_control/pet_gfx_element.cpp b/engines/titanic/pet_control/pet_gfx_element.cpp
index 6022885770..e43c847bb1 100644
--- a/engines/titanic/pet_control/pet_gfx_element.cpp
+++ b/engines/titanic/pet_control/pet_gfx_element.cpp
@@ -48,7 +48,7 @@ void CPetGfxElement::reset(const CString &name, CPetControl *petControl, PetElem
if (!petControl)
return;
- CString numString(3);
+ CString numString(3);
int classNum = petControl->getPassengerClass();
if (classNum >= 1 && classNum <= 3) {
diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h
index c07cc5ed9a..79e032162c 100644
--- a/engines/titanic/pet_control/pet_glyphs.h
+++ b/engines/titanic/pet_control/pet_glyphs.h
@@ -77,7 +77,7 @@ public:
* Called when the PET area is entered
*/
virtual void enter() {}
-
+
/**
* Called when the PET area is left
*/
@@ -137,7 +137,7 @@ public:
* Handles keypresses
*/
virtual bool KeyCharMsg(int key) { return false; }
-
+
/**
* Handles keypresses
*/
@@ -162,7 +162,7 @@ public:
* Selects a glyph
*/
virtual void selectGlyph(const Point &topLeft, const Point &pt) {}
-
+
/**
* Called when a glyph drag starts
*/
@@ -195,7 +195,7 @@ public:
* Called on a highlighted item when PET area is entered
*/
virtual bool enterHighlighted() { return false; }
-
+
/**
* Called on a highlighted item when PET area is left
*/
@@ -241,7 +241,7 @@ public:
*/
bool isHighlighted() const;
};
-
+
class CPetGlyphs : public List<CPetGlyph> {
private:
/**
diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp
index 88310459c6..be01146398 100644
--- a/engines/titanic/pet_control/pet_inventory.cpp
+++ b/engines/titanic/pet_control/pet_inventory.cpp
@@ -53,7 +53,7 @@ void CPetInventory::draw(CScreenManager *screenManager) {
_text.draw(screenManager);
}
-Rect CPetInventory::getBounds() const {
+Rect CPetInventory::getBounds() const {
return _movie ? _movie->getBounds() : Rect();
}
@@ -231,7 +231,7 @@ CGameObject *CPetInventory::getImage(int index) {
return _itemGlyphs[index];
}
}
-
+
return nullptr;
}
diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h
index 184bb20385..5433feae95 100644
--- a/engines/titanic/pet_control/pet_inventory.h
+++ b/engines/titanic/pet_control/pet_inventory.h
@@ -64,7 +64,7 @@ public:
* Sets up the section
*/
virtual bool setup(CPetControl *petControl);
-
+
/**
* Sets up the section
*/
@@ -74,12 +74,12 @@ public:
* Draw the section
*/
virtual void draw(CScreenManager *screenManager);
-
+
/**
* Get the bounds for the section
*/
virtual Rect getBounds() const;
-
+
/**
* Called when a general change occurs
*/
@@ -141,7 +141,7 @@ public:
virtual CGameObject *getBackground(int index) const;
/**
- *
+ *
*/
void change(CGameObject *item);
diff --git a/engines/titanic/pet_control/pet_inventory_glyphs.h b/engines/titanic/pet_control/pet_inventory_glyphs.h
index 0d167c4c98..508db67f2d 100644
--- a/engines/titanic/pet_control/pet_inventory_glyphs.h
+++ b/engines/titanic/pet_control/pet_inventory_glyphs.h
@@ -63,7 +63,7 @@ public:
CGameObject *_background;
CGameObject *_image;
public:
- CPetInventoryGlyph() : _item(nullptr), _field34(1),
+ CPetInventoryGlyph() : _item(nullptr), _field34(1),
_background(nullptr), _image(nullptr) {}
CPetInventoryGlyph(CCarry *item, int val) : _item(item),
_field34(val), _background(nullptr), _image(nullptr) {}
@@ -72,7 +72,7 @@ public:
* Called when the PET area is entered
*/
virtual void enter();
-
+
/**
* Called when the PET area is left
*/
@@ -97,7 +97,7 @@ public:
* Glyph has been shifted to be first visible one
*/
virtual void glyphFocused(const Point &topLeft, bool flag);
-
+
/**
* Called when a glyph drag starts
*/
@@ -133,7 +133,7 @@ class CInventoryGlyphAction : public CGlyphAction {
public:
CGameObject *_item;
public:
- CInventoryGlyphAction(CGameObject *item, GlyphActionMode mode) :
+ CInventoryGlyphAction(CGameObject *item, GlyphActionMode mode) :
CGlyphAction(mode), _item(item) {}
};
diff --git a/engines/titanic/pet_control/pet_load.cpp b/engines/titanic/pet_control/pet_load.cpp
index 8e2afc727f..3d67cf6d71 100644
--- a/engines/titanic/pet_control/pet_load.cpp
+++ b/engines/titanic/pet_control/pet_load.cpp
@@ -30,7 +30,7 @@ namespace Titanic {
bool CPetLoad::reset() {
CPetLoadSave::reset();
-
+
CPetControl *pet = getPetControl();
if (pet) {
setName("PetLoad", pet);
diff --git a/engines/titanic/pet_control/pet_load.h b/engines/titanic/pet_control/pet_load.h
index 421531974d..5669991b59 100644
--- a/engines/titanic/pet_control/pet_load.h
+++ b/engines/titanic/pet_control/pet_load.h
@@ -33,7 +33,7 @@ public:
* Reset the glyph
*/
virtual bool reset();
-
+
/**
* Handles mouse button up messages
*/
diff --git a/engines/titanic/pet_control/pet_load_save.cpp b/engines/titanic/pet_control/pet_load_save.cpp
index aebe43551e..136953cab7 100644
--- a/engines/titanic/pet_control/pet_load_save.cpp
+++ b/engines/titanic/pet_control/pet_load_save.cpp
@@ -76,7 +76,7 @@ void CPetLoadSave::draw2(CScreenManager *screenManager) {
bool CPetLoadSave::MouseButtonDownMsg(const Point &pt) {
if (_btnLoadSave.MouseButtonDownMsg(pt))
return true;
-
+
checkSlotsHighlight(pt);
return false;
}
@@ -95,7 +95,7 @@ bool CPetLoadSave::KeyCharMsg(int key) {
case Common::KEYCODE_UP:
case Common::KEYCODE_KP8:
if (_savegameSlotNum != -1) {
- int slotNum = --_savegameSlotNum;
+ int slotNum = --_savegameSlotNum;
highlightSlot((slotNum == -1) ? SAVEGAME_SLOTS_COUNT - 1 : slotNum);
getPetControl()->makeDirty();
}
diff --git a/engines/titanic/pet_control/pet_quit.cpp b/engines/titanic/pet_control/pet_quit.cpp
index 218ed89812..a6fb22d7e1 100644
--- a/engines/titanic/pet_control/pet_quit.cpp
+++ b/engines/titanic/pet_control/pet_quit.cpp
@@ -41,7 +41,7 @@ bool CPetQuit::setup(CPetControl *petControl, CPetGlyphs *owner) {
Rect btnRect(0, 0, 68, 52);
btnRect.moveTo(496, 388);
_btnYes.setBounds(btnRect);
-
+
return true;
}
@@ -52,7 +52,7 @@ bool CPetQuit::reset() {
setName("PetExit", pet);
- uint col = getPetSection()->getColor(0);
+ uint col = getPetSection()->getColor(0);
_text.setText("Are you sure you want to quit?");
_text.setLineColor(0, col);
diff --git a/engines/titanic/pet_control/pet_quit.h b/engines/titanic/pet_control/pet_quit.h
index 87d8aefbbf..b775000933 100644
--- a/engines/titanic/pet_control/pet_quit.h
+++ b/engines/titanic/pet_control/pet_quit.h
@@ -58,7 +58,7 @@ public:
* Handles mouse button up messages
*/
virtual bool MouseButtonUpMsg(const Point &pt);
-
+
/**
* Returns the tooltip text for when the glyph is selected
*/
diff --git a/engines/titanic/pet_control/pet_real_life.h b/engines/titanic/pet_control/pet_real_life.h
index 40bc87d9b5..b359d285c8 100644
--- a/engines/titanic/pet_control/pet_real_life.h
+++ b/engines/titanic/pet_control/pet_real_life.h
@@ -53,7 +53,7 @@ public:
* Sets up the section
*/
virtual bool setup(CPetControl *petControl);
-
+
/**
* Reset the section
*/
@@ -63,12 +63,12 @@ public:
* Draw the section
*/
virtual void draw(CScreenManager *screenManager);
-
+
/**
* Get the bounds for the section
*/
virtual Rect getBounds() const { return Rect(); }
-
+
/**
* Following are handlers for the various messages that the PET can
* pass onto the currently active section/area
@@ -85,7 +85,7 @@ public:
* Returns item a drag-drop operation has dropped on, if any
*/
virtual CGameObject *dragEnd(const Point &pt) const { return nullptr; }
-
+
/**
* Display a message
*/
@@ -115,7 +115,7 @@ public:
* Called when a section is switched to
*/
virtual void enter(PetArea oldArea);
-
+
/**
* Called when a section is being left, to switch to another area
*/
diff --git a/engines/titanic/pet_control/pet_remote.cpp b/engines/titanic/pet_control/pet_remote.cpp
index 9b43b8dab9..7e98308114 100644
--- a/engines/titanic/pet_control/pet_remote.cpp
+++ b/engines/titanic/pet_control/pet_remote.cpp
@@ -30,7 +30,7 @@
namespace Titanic {
static const byte REMOTE_DATA[] = {
- 0x00, 0x02,
+ 0x00, 0x02,
GLYPH_SUMMON_ELEVATOR, GLYPH_SUCCUBUS_DELIVERY,
0x01, 0x02,
GLYPH_SUMMON_PELLERATOR, GLYPH_SUCCUBUS_DELIVERY,
@@ -83,7 +83,7 @@ static const byte REMOTE_DATA[] = {
GLYPH_SUMMON_ELEVATOR, GLYPH_SUCCUBUS_DELIVERY,
0x1E, 0x0C,
GLYPH_DEPLOY_FLORAL, GLYPH_DEPLOY_FULLY_RELAXATION, GLYPH_DEPLOY_COMFORT,
- GLYPH_DEPLOY_MINOR_STORAGE, GLYPH_ENTERTAINMENT_DEVICE,
+ GLYPH_DEPLOY_MINOR_STORAGE, GLYPH_ENTERTAINMENT_DEVICE,
GLYPH_DEPLOY_MAJOR_RELAXATION, GLYPH_INFLATE_RELAXATION,
GLYPH_DEPLOY_MAINTENANCE, GLYPH_DEPLOY_WORK_SURFACE,
GLYPH_DEPLOY_MINOR_RELAXATION, GLYPH_DEPLOY_SINK,
diff --git a/engines/titanic/pet_control/pet_remote_glyphs.cpp b/engines/titanic/pet_control/pet_remote_glyphs.cpp
index 953428ff0c..aa756bc941 100644
--- a/engines/titanic/pet_control/pet_remote_glyphs.cpp
+++ b/engines/titanic/pet_control/pet_remote_glyphs.cpp
@@ -68,7 +68,7 @@ void CBasicRemoteGlyph::draw2(CScreenManager *screenManager) {
}
bool CBasicRemoteGlyph::MouseButtonDownMsg(const Point &pt) {
- return _gfxElement && _gfxElement->MouseButtonDownMsg(pt);
+ return _gfxElement && _gfxElement->MouseButtonDownMsg(pt);
}
bool CBasicRemoteGlyph::MouseButtonUpMsg(const Point &pt) {
@@ -173,7 +173,7 @@ bool CTelevisionControlGlyph::setup(CPetControl *petControl, CPetGlyphs *owner)
_down = getElement(2);
_onOff = getElement(4);
}
-
+
return true;
}
diff --git a/engines/titanic/pet_control/pet_remote_glyphs.h b/engines/titanic/pet_control/pet_remote_glyphs.h
index d3541d6a94..6114c81a9f 100644
--- a/engines/titanic/pet_control/pet_remote_glyphs.h
+++ b/engines/titanic/pet_control/pet_remote_glyphs.h
@@ -90,7 +90,7 @@ private:
CString _gfxName, _tooltip, _msgString;
public:
CBasicRemoteGlyph(const CString &gfxName, const CString &tooltip,
- const CString &msgString) : CPetRemoteGlyph(),
+ const CString &msgString) : CPetRemoteGlyph(),
_gfxName(gfxName), _tooltip(tooltip), _msgString(msgString) {}
/**
@@ -112,7 +112,7 @@ public:
* Handles mouse button up messages
*/
virtual bool MouseButtonUpMsg(const Point &pt);
-
+
/**
* Returns the tooltip text for when the glyph is selected
*/
@@ -144,7 +144,7 @@ public:
/**
* Called for mouse button up messages to the default element
*/
- bool elementMouseButtonUpMsg(const Point &pt, int petNum);
+ bool elementMouseButtonUpMsg(const Point &pt, int petNum);
};
class CRemoteGotoGlyph : public CPetRemoteGlyph {
@@ -154,7 +154,7 @@ protected:
CString _gfxName, _tooltip;
public:
CRemoteGotoGlyph() : CPetRemoteGlyph(), _gfxElement(nullptr), _roomIndex(21) {}
- CRemoteGotoGlyph(const CString &gfxName, const CString &tooltip) :
+ CRemoteGotoGlyph(const CString &gfxName, const CString &tooltip) :
CPetRemoteGlyph(), _gfxElement(nullptr), _roomIndex(21),
_gfxName(gfxName), _tooltip(tooltip) {}
@@ -177,7 +177,7 @@ public:
* Handles mouse button up messages
*/
virtual bool MouseButtonUpMsg(const Point &pt);
-
+
/**
* Returns the tooltip text for when the glyph is selected
*/
@@ -223,7 +223,7 @@ public:
* Handles mouse button up messages
*/
virtual bool MouseButtonUpMsg(const Point &pt);
-
+
/**
* Returns the tooltip text for when the glyph is selected
*/
@@ -257,7 +257,7 @@ public:
* Handles mouse button up messages
*/
virtual bool MouseButtonUpMsg(const Point &pt);
-
+
/**
* Returns the tooltip text for when the glyph is selected
*/
@@ -318,7 +318,7 @@ public:
virtual bool MouseButtonUpMsg(const Point &pt) {
return elementMouseButtonUpMsg(pt, 0);
}
-
+
/**
* Returns the tooltip text for when the glyph is selected
*/
diff --git a/engines/titanic/pet_control/pet_rooms.h b/engines/titanic/pet_control/pet_rooms.h
index af1ea2ae4f..28d6553a33 100644
--- a/engines/titanic/pet_control/pet_rooms.h
+++ b/engines/titanic/pet_control/pet_rooms.h
@@ -76,7 +76,7 @@ public:
* Sets up the section
*/
virtual bool setup(CPetControl *petControl);
-
+
/**
* Reset the section
*/
@@ -86,7 +86,7 @@ public:
* Draw the section
*/
virtual void draw(CScreenManager *screenManager);
-
+
/**
* Following are handlers for the various messages that the PET can
* pass onto the currently active section/area
@@ -101,7 +101,7 @@ public:
* Check whether a drag drop can occur
*/
virtual bool checkDragEnd(CGameObject *item);
-
+
/**
* Display a message
*/
diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.h b/engines/titanic/pet_control/pet_rooms_glyphs.h
index 5d0fec84f8..11de6c4a8e 100644
--- a/engines/titanic/pet_control/pet_rooms_glyphs.h
+++ b/engines/titanic/pet_control/pet_rooms_glyphs.h
@@ -94,7 +94,7 @@ public:
* Saves the data for the glyph
*/
virtual void saveGlyph(SimpleFile *file, int indent);
-
+
virtual bool proc33(CPetGlyph *glyph);
/**
@@ -125,12 +125,12 @@ public:
* Returns true if the room is either currently or previously assigned
*/
bool isAssigned() const { return _mode != RGM_UNASSIGNED; }
-
+
/**
* Returns true if the room is the one currently assigned to the player
*/
bool isCurrentlyAssigned() const { return _mode == RGM_ASSIGNED_ROOM; }
-
+
/**
* Returns true if the room was previously assigned to the player
*/
diff --git a/engines/titanic/pet_control/pet_save.cpp b/engines/titanic/pet_control/pet_save.cpp
index 6d0733f534..d344c8cd14 100644
--- a/engines/titanic/pet_control/pet_save.cpp
+++ b/engines/titanic/pet_control/pet_save.cpp
@@ -28,7 +28,7 @@ namespace Titanic {
bool CPetSave::reset() {
CPetLoadSave::reset();
-
+
CPetControl *pet = getPetControl();
if (pet) {
setName("PetSave", pet);
diff --git a/engines/titanic/pet_control/pet_save.h b/engines/titanic/pet_control/pet_save.h
index 54e91e4c76..e5e956403f 100644
--- a/engines/titanic/pet_control/pet_save.h
+++ b/engines/titanic/pet_control/pet_save.h
@@ -57,11 +57,11 @@ public:
/**
* Called on a highlighted item when PET area is entered
*/
- virtual bool enterHighlighted() {
+ virtual bool enterHighlighted() {
highlightSave(_savegameSlotNum);
return true;
}
-
+
/**
* Called on a highlighted item when PET area is left
*/
diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h
index dc2f70b76f..9e9afe6c21 100644
--- a/engines/titanic/pet_control/pet_section.h
+++ b/engines/titanic/pet_control/pet_section.h
@@ -75,7 +75,7 @@ public:
* Sets up the section
*/
virtual bool setup(CPetControl *petControl) { return false; }
-
+
/**
* Reset the section
*/
@@ -85,17 +85,17 @@ public:
* Draw the section
*/
virtual void draw(CScreenManager *screenManager) {}
-
+
/**
* Get the bounds for the section
*/
virtual Rect getBounds() const { return Rect(); }
-
+
/**
* Called when a general change occurs
*/
virtual void changed(int changeType) {}
-
+
/**
* Following are handlers for the various messages that the PET can
* pass onto the currently active section/area
@@ -113,12 +113,12 @@ public:
* Check whether a drag drop can occur
*/
virtual bool checkDragEnd(CGameObject *item) { return false; }
-
+
/**
* Returns item a drag-drop operation has dropped on, if any
*/
virtual CGameObject *dragEnd(const Point &pt) const { return nullptr; }
-
+
/**
* Display a message
*/
@@ -148,12 +148,12 @@ public:
* Called when a section is switched to
*/
virtual void enter(PetArea oldArea) {}
-
+
/**
* Called when a section is being left, to switch to another area
*/
virtual void leave() {}
-
+
virtual void proc23() {}
/**
@@ -175,7 +175,7 @@ public:
* Removes text after a given duration
*/
virtual void removeText(int duration);
-
+
/**
* Removes text after a given duration
*/
@@ -217,7 +217,7 @@ public:
* Show the text cursor
*/
virtual void showCursor() {}
-
+
/**
* Hide the text cursor
*/
@@ -237,7 +237,7 @@ public:
* Get a specified color in the currently active UI color table
*/
uint getColor(uint index);
-
+
/**
* Get one of the game's three UI color tables. If the default
* tableNum of -1 is used, the table is taken from the game state
diff --git a/engines/titanic/pet_control/pet_slider.h b/engines/titanic/pet_control/pet_slider.h
index 0bc9e825cd..be8c846a20 100644
--- a/engines/titanic/pet_control/pet_slider.h
+++ b/engines/titanic/pet_control/pet_slider.h
@@ -106,7 +106,7 @@ public:
* Reset the slider
*/
virtual void reset(const CString &name) {}
-
+
/**
* Draw the slider
*/
@@ -116,7 +116,7 @@ public:
* Reset the dirty area
*/
virtual Rect clearDirtyArea();
-
+
/**
* Checks whether the slider is highlighted
*/
@@ -131,7 +131,7 @@ public:
* Handles dragging the slider
*/
virtual bool MouseDragMoveMsg(const Point &pt);
-
+
/**
* Called when a slider drag ends
*/
@@ -144,8 +144,8 @@ public:
virtual bool proc13() { return false; }
virtual bool proc14() { return false; }
-
-
+
+
virtual bool contains(const Point &pt) const;
/**
diff --git a/engines/titanic/pet_control/pet_sound.cpp b/engines/titanic/pet_control/pet_sound.cpp
index 7bfeb25722..e9958c67be 100644
--- a/engines/titanic/pet_control/pet_sound.cpp
+++ b/engines/titanic/pet_control/pet_sound.cpp
@@ -111,7 +111,7 @@ bool CPetSound::reset() {
void CPetSound::draw2(CScreenManager *screenManager) {
_element.draw(screenManager);
-
+
_musicVolume.draw(screenManager);
_masterVolume.draw(screenManager);
_parrotVolume.draw(screenManager);
@@ -173,7 +173,7 @@ void CPetSound::sliderChanged(double offset, int sliderNum) {
CPetControl *pet = getPetControl();
if (!pet)
return;
-
+
CGameManager *gameManager = pet->getGameManager();
if (!gameManager)
return;
diff --git a/engines/titanic/pet_control/pet_starfield.cpp b/engines/titanic/pet_control/pet_starfield.cpp
index 3287f98817..dd953b592d 100644
--- a/engines/titanic/pet_control/pet_starfield.cpp
+++ b/engines/titanic/pet_control/pet_starfield.cpp
@@ -45,7 +45,7 @@ bool CPetStarfield::reset() {
_btnSetDest.setup(MODE_UNSELECTED, "3PetSetDestin", _petControl);
_btnSetDest.setup(MODE_SELECTED, "3PetSetDestin1", _petControl);
_imgStarCtrl.setup(MODE_UNSELECTED, "3PetStarCtrl", _petControl);
-
+
_leds[0].setup(MODE_UNSELECTED, "LEDOff1", _petControl);
_leds[1].setup(MODE_UNSELECTED, "LEDOn1", _petControl);
_leds[2].setup(MODE_UNSELECTED, "LEDOff2", _petControl);
@@ -106,7 +106,7 @@ bool CPetStarfield::MouseButtonUpMsg(CMouseButtonUpMsg *msg) {
if (_petControl) {
CStarControl *starControl = _petControl->getStarControl();
-
+
if (starControl && starControl->canSetStarDestination()) {
CPETSetStarDestinationMsg starfieldMsg;
starfieldMsg.execute(_petControl->_remoteTarget);
diff --git a/engines/titanic/pet_control/pet_starfield.h b/engines/titanic/pet_control/pet_starfield.h
index 9550e0acf9..6c47f47d67 100644
--- a/engines/titanic/pet_control/pet_starfield.h
+++ b/engines/titanic/pet_control/pet_starfield.h
@@ -66,7 +66,7 @@ public:
* Sets up the section
*/
virtual bool setup(CPetControl *petControl);
-
+
/**
* Reset the section
*/
@@ -76,7 +76,7 @@ public:
* Draw the section
*/
virtual void draw(CScreenManager *screenManager);
-
+
/**
* Following are handlers for the various messages that the PET can
* pass onto the currently active section/area
diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp
index 2c20396cd9..1aa9b804ff 100644
--- a/engines/titanic/pet_control/pet_text.cpp
+++ b/engines/titanic/pet_control/pet_text.cpp
@@ -27,7 +27,7 @@ namespace Titanic {
CPetText::CPetText(uint count) :
_stringsMerged(false), _maxCharsPerLine(-1), _lineCount(0),
_linesStart(-1), _unused1(0), _unused2(0), _unused3(0),
- _backR(0xff), _backG(0xff), _backB(0xff),
+ _backR(0xff), _backG(0xff), _backB(0xff),
_textR(0), _textG(0), _textB(200),
_fontNumber(0), _npcFlag(0), _npcId(0), _hasBorder(true),
_scrollTop(0), _textCursor(nullptr) {
@@ -110,7 +110,7 @@ void CPetText::load(SimpleFile *file, int param) {
_array[idx]._line = file->readString();
_array[idx]._rgb = file->readString();
_array[idx]._string3 = file->readString();
- }
+ }
}
}
@@ -225,7 +225,7 @@ void CPetText::appendText(const CString &str) {
// Only add part of the str up to the maximum allowed limit for line
_array[_lineCount]._line += str.left(_maxCharsPerLine - lineSize);
}
-
+
updateStr3(_lineCount);
_stringsMerged = false;
}
@@ -260,7 +260,7 @@ void CPetText::remapColors(uint count, uint *srcColors, uint *destColors) {
}
}
}
-
+
_stringsMerged = false;
}
@@ -277,7 +277,7 @@ void CPetText::updateStr3(int lineNum) {
line[2] = _npcId;
line[4] = '\0';
_array[lineNum]._string3 = CString(line);
-
+
_stringsMerged = false;
_npcFlag = _npcId = 0;
}
@@ -470,7 +470,7 @@ int CPetText::getNPCNum(uint npcId, uint startIndex) {
strP += 4;
}
}
-
+
return - 1;
}
diff --git a/engines/titanic/pet_control/pet_translation.h b/engines/titanic/pet_control/pet_translation.h
index 2fcc758b44..26070d6e59 100644
--- a/engines/titanic/pet_control/pet_translation.h
+++ b/engines/titanic/pet_control/pet_translation.h
@@ -44,7 +44,7 @@ public:
* Sets up the section
*/
virtual bool setup(CPetControl *petControl);
-
+
/**
* Reset the section
*/
@@ -54,7 +54,7 @@ public:
* Draw the section
*/
virtual void draw(CScreenManager *screenManager);
-
+
/**
* Following are handlers for the various messages that the PET can
* pass onto the currently active section/area
diff --git a/engines/titanic/sound/auto_music_player_base.cpp b/engines/titanic/sound/auto_music_player_base.cpp
index ad8b848c03..49ae906e91 100644
--- a/engines/titanic/sound/auto_music_player_base.cpp
+++ b/engines/titanic/sound/auto_music_player_base.cpp
@@ -71,7 +71,7 @@ bool CAutoMusicPlayerBase::TimerMsg(CTimerMsg *msg) {
bool CAutoMusicPlayerBase::LoadSuccessMsg(CLoadSuccessMsg *msg) {
if (_isRepeated)
playGlobalSound(_filename, _volumeMode, _initialMute, true, 0);
-
+
return true;
}
diff --git a/engines/titanic/sound/enter_view_toggles_other_music.cpp b/engines/titanic/sound/enter_view_toggles_other_music.cpp
index 2f0091a0a3..2d23043d83 100644
--- a/engines/titanic/sound/enter_view_toggles_other_music.cpp
+++ b/engines/titanic/sound/enter_view_toggles_other_music.cpp
@@ -28,7 +28,7 @@ BEGIN_MESSAGE_MAP(CEnterViewTogglesOtherMusic, CTriggerAutoMusicPlayer)
ON_MESSAGE(EnterViewMsg)
END_MESSAGE_MAP()
-CEnterViewTogglesOtherMusic::CEnterViewTogglesOtherMusic() :
+CEnterViewTogglesOtherMusic::CEnterViewTogglesOtherMusic() :
CTriggerAutoMusicPlayer(), _value(2) {
}
diff --git a/engines/titanic/sound/proximity.cpp b/engines/titanic/sound/proximity.cpp
index ee1cd3e741..796e344ae2 100644
--- a/engines/titanic/sound/proximity.cpp
+++ b/engines/titanic/sound/proximity.cpp
@@ -27,8 +27,8 @@ namespace Titanic {
CProximity::CProximity() : _channelVolume(100), _balance(0),
_priorSoundHandle(-1), _frequencyMultiplier(0.0), _frequencyAdjust(1.875),
- _repeated(false), _channelMode(10), _positioningMode(POSMODE_NONE),
- _azimuth(0.0), _range(0.5), _elevation(0),
+ _repeated(false), _channelMode(10), _positioningMode(POSMODE_NONE),
+ _azimuth(0.0), _range(0.5), _elevation(0),
_posX(0.0), _posY(0.0), _posZ(0.0),
_hasVelocity(false), _velocityX(0), _velocityY(0), _velocityZ(0),
_disposeAfterUse(DisposeAfterUse::NO), _endTalkerFn(nullptr), _talker(nullptr),
diff --git a/engines/titanic/sound/qmixer.cpp b/engines/titanic/sound/qmixer.cpp
index c095b84e17..733164947e 100644
--- a/engines/titanic/sound/qmixer.cpp
+++ b/engines/titanic/sound/qmixer.cpp
@@ -31,7 +31,7 @@ QMixer::QMixer(Audio::Mixer *mixer) : _mixer(mixer) {
bool QMixer::qsWaveMixInitEx(const QMIXCONFIG &config) {
assert(_channels.empty());
assert(config.iChannels > 0 && config.iChannels < 256);
-
+
_channels.resize(config.iChannels);
return true;
}
@@ -71,7 +71,7 @@ void QMixer::qsWaveMixSetPanRate(int iChannel, uint flags, uint rate) {
void QMixer::qsWaveMixSetVolume(int iChannel, uint flags, uint volume) {
ChannelEntry &channel = _channels[iChannel];
-
+
// QMixer volumes go from 0-32767, but we need to convert to 0-255 for ScummVM
assert(volume <= 32767);
byte newVolume = (volume >= 32700) ? 255 : volume * 255 / 32767;
@@ -149,7 +149,7 @@ void QMixer::qsWaveMixPump() {
if (channel._volumeChangeEnd) {
byte oldVolume = channel._volume;
uint currentTicks = g_system->getMillis();
-
+
if (currentTicks >= channel._volumeChangeEnd) {
// Reached end of transition period
channel._volume = channel._volumeEnd;
diff --git a/engines/titanic/sound/qmixer.h b/engines/titanic/sound/qmixer.h
index 6a25484c29..9a0ea85ede 100644
--- a/engines/titanic/sound/qmixer.h
+++ b/engines/titanic/sound/qmixer.h
@@ -156,7 +156,7 @@ struct QMIXPLAYPARAMS {
Audio::Mixer::SoundType _soundType;
QMIXPLAYPARAMS() : dwSize(36), lpImage(nullptr), hwndNotify(0), callback(nullptr),
- dwUser(nullptr), lStart(0), lStartLoop(0), lEndLoop(0), lEnd(0),
+ dwUser(nullptr), lStart(0), lStartLoop(0), lEndLoop(0), lEnd(0),
lpChannelParams(nullptr), _soundType(Audio::Mixer::kPlainSoundType) {}
};
@@ -165,7 +165,7 @@ struct QMIXPLAYPARAMS {
* QSound Labs, Inc. Which itself is apparently based on Microsoft's
* WaveMix API.
*
- * It does not currently have any actual code from the library,
+ * It does not currently have any actual code from the library,
* and instead remaps calls to ScummVM's existing mixer where possible.
* This means that advanced features of the QMixer library, like being
* able to set up both the player and sounds at different positions are
@@ -189,7 +189,7 @@ class QMixer {
// Currently playing and any following queued sounds for the channel
Common::List<SoundEntry> _sounds;
// Current channel volume
- byte _volume;
+ byte _volume;
// Current time in milliseconds for paning (volume) changes
uint _panRate;
// Fields used to transition between volume levels
diff --git a/engines/titanic/sound/room_trigger_auto_music_player.h b/engines/titanic/sound/room_trigger_auto_music_player.h
index a57e133eb6..1c3394ce15 100644
--- a/engines/titanic/sound/room_trigger_auto_music_player.h
+++ b/engines/titanic/sound/room_trigger_auto_music_player.h
@@ -31,7 +31,7 @@ namespace Titanic {
class CRoomTriggerAutoMusicPlayer : public CTriggerAutoMusicPlayer {
DECLARE_MESSAGE_MAP;
bool LeaveRoomMsg(CLeaveRoomMsg *msg);
- bool EnterRoomMsg(CEnterRoomMsg *msg);
+ bool EnterRoomMsg(CEnterRoomMsg *msg);
public:
CLASSDEF;
diff --git a/engines/titanic/sound/season_noises.cpp b/engines/titanic/sound/season_noises.cpp
index ce045488ee..14689d5337 100644
--- a/engines/titanic/sound/season_noises.cpp
+++ b/engines/titanic/sound/season_noises.cpp
@@ -89,7 +89,7 @@ bool CSeasonNoises::ActMsg(CActMsg *msg) {
default:
break;
}
-
+
CSignalObject signalMsg;
signalMsg._numValue = 2;
signalMsg.execute(this);
diff --git a/engines/titanic/sound/sound.cpp b/engines/titanic/sound/sound.cpp
index 3288c4f4dd..a8c4849f2b 100644
--- a/engines/titanic/sound/sound.cpp
+++ b/engines/titanic/sound/sound.cpp
@@ -26,7 +26,7 @@
namespace Titanic {
-CSound::CSound(CGameManager *owner, Audio::Mixer *mixer) :
+CSound::CSound(CGameManager *owner, Audio::Mixer *mixer) :
_gameManager(owner), _soundManager(mixer) {
g_vm->_movieManager.setSoundManager(&_soundManager);
}
diff --git a/engines/titanic/sound/sound_manager.cpp b/engines/titanic/sound/sound_manager.cpp
index 1fb0c7341c..c1a46e5103 100644
--- a/engines/titanic/sound/sound_manager.cpp
+++ b/engines/titanic/sound/sound_manager.cpp
@@ -304,7 +304,7 @@ void QSoundManager::setPolarPosition(int handle, double range, double azimuth, d
Slot &slot = _slots[idx];
if (slot._handle == handle) {
qsWaveMixSetPanRate(slot._channel, QMIX_USEONCE, panRate);
- qsWaveMixSetPolarPosition(slot._channel, QMIX_USEONCE,
+ qsWaveMixSetPolarPosition(slot._channel, QMIX_USEONCE,
QSPOLAR(azimuth, range, elevation));
break;
}
@@ -452,7 +452,7 @@ void QSoundManager::updateVolume(int channel, uint panRate) {
default:
break;
}
-
+
volume = (_musicPercent * volume) / 100;
qsWaveMixSetPanRate(channel, 0, panRate);
qsWaveMixSetVolume(channel, 0, (uint)volume);
diff --git a/engines/titanic/sound/sound_manager.h b/engines/titanic/sound/sound_manager.h
index d1afdb4ad4..a3074a8e57 100644
--- a/engines/titanic/sound/sound_manager.h
+++ b/engines/titanic/sound/sound_manager.h
@@ -45,7 +45,7 @@ protected:
public:
CSoundManager();
virtual ~CSoundManager() {}
-
+
/**
* Loads a sound
* @param name Name of sound resource
@@ -189,7 +189,7 @@ public:
* Called after saving is complete
*/
virtual void postSave() {}
-
+
/**
* Sets the position and orientation for the listener (player)
*/
diff --git a/engines/titanic/sound/view_toggles_other_music.cpp b/engines/titanic/sound/view_toggles_other_music.cpp
index 731f59bd53..ffca1caea7 100644
--- a/engines/titanic/sound/view_toggles_other_music.cpp
+++ b/engines/titanic/sound/view_toggles_other_music.cpp
@@ -28,7 +28,7 @@ BEGIN_MESSAGE_MAP(CViewTogglesOtherMusic, CEnterViewTogglesOtherMusic)
ON_MESSAGE(LeaveViewMsg)
END_MESSAGE_MAP()
-CViewTogglesOtherMusic::CViewTogglesOtherMusic() :
+CViewTogglesOtherMusic::CViewTogglesOtherMusic() :
CEnterViewTogglesOtherMusic(), _value(1) {
}
diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp
index 7ba160cd37..01318db774 100644
--- a/engines/titanic/star_control/star_control.cpp
+++ b/engines/titanic/star_control/star_control.cpp
@@ -58,7 +58,7 @@ void CStarControl::save(SimpleFile *file, int indent) {
void CStarControl::load(SimpleFile *file) {
int val = file->readNumber();
-
+
if (!val) {
_starField.load(file);
if (!_starField.initDocument())
@@ -74,7 +74,7 @@ void CStarControl::load(SimpleFile *file) {
_fieldBC = 1;
}
-
+
CGameObject::load(file);
}
diff --git a/engines/titanic/star_control/star_control_sub12.cpp b/engines/titanic/star_control/star_control_sub12.cpp
index 5840495d34..e8d49992bb 100644
--- a/engines/titanic/star_control/star_control_sub12.cpp
+++ b/engines/titanic/star_control/star_control_sub12.cpp
@@ -29,7 +29,7 @@ namespace Titanic {
FMatrix *CStarControlSub12::_matrix1;
FMatrix *CStarControlSub12::_matrix2;
-CStarControlSub12::CStarControlSub12(void *val1, const CStar20Data *data) :
+CStarControlSub12::CStarControlSub12(void *val1, const CStar20Data *data) :
_currentIndex(-1), _handlerP(nullptr), _field108(0),
_sub13(val1) {
setupHandler(data);
@@ -56,7 +56,7 @@ CStarControlSub12::~CStarControlSub12() {
}
void CStarControlSub12::proc2(const void *src) {
- _sub13.copyFrom(src);
+ _sub13.copyFrom(src);
}
void CStarControlSub12::proc3(const CStar20Data *src) {
diff --git a/engines/titanic/star_control/star_control_sub13.cpp b/engines/titanic/star_control/star_control_sub13.cpp
index cc9e239194..490e6d0630 100644
--- a/engines/titanic/star_control/star_control_sub13.cpp
+++ b/engines/titanic/star_control/star_control_sub13.cpp
@@ -91,12 +91,12 @@ void CStarControlSub13::load(SimpleFile *file, int param) {
_field14 = file->readFloat();
_field18 = file->readFloat();
_field1C = file->readFloat();
-
+
int widthHeight = file->readNumber();
_width = widthHeight & 0xff;
_height = _width >> 16;
_field24 = file->readNumber();
-
+
for (int idx = 0; idx < 5; ++idx)
_valArray[idx] = file->readFloat();
diff --git a/engines/titanic/star_control/star_control_sub20.cpp b/engines/titanic/star_control/star_control_sub20.cpp
index 5c6c243eaa..cc1029896a 100644
--- a/engines/titanic/star_control/star_control_sub20.cpp
+++ b/engines/titanic/star_control/star_control_sub20.cpp
@@ -43,7 +43,7 @@ CStarControlSub20::CStarControlSub20(const CStar20Data *src) {
}
}
-CStarControlSub20::~CStarControlSub20() {
+CStarControlSub20::~CStarControlSub20() {
clear();
}
diff --git a/engines/titanic/star_control/star_control_sub25.h b/engines/titanic/star_control/star_control_sub25.h
index e943782e37..b61569c49d 100644
--- a/engines/titanic/star_control/star_control_sub25.h
+++ b/engines/titanic/star_control/star_control_sub25.h
@@ -35,7 +35,7 @@ public:
CStarControlSub26 _sub1;
CStarControlSub26 _sub2;
public:
-
+
};
} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_field.cpp b/engines/titanic/star_control/star_field.cpp
index c50e8466ec..0dbc5fd700 100644
--- a/engines/titanic/star_control/star_field.cpp
+++ b/engines/titanic/star_control/star_field.cpp
@@ -69,7 +69,7 @@ void CStarField::render(CVideoSurface *surface, CStarControlSub12 *sub12) {
// TODO
}
-int CStarField::get1() const {
+int CStarField::get1() const {
return _val1;
}
@@ -102,7 +102,7 @@ void CStarField::set3(int val) {
}
void CStarField::toggle4() {
- _val4 = !_val4;
+ _val4 = !_val4;
}
bool CStarField::set4(bool val) {
diff --git a/engines/titanic/star_control/star_field.h b/engines/titanic/star_control/star_field.h
index ef1ee29737..91cefbb457 100644
--- a/engines/titanic/star_control/star_field.h
+++ b/engines/titanic/star_control/star_field.h
@@ -73,12 +73,12 @@ public:
void set54(int val);
int get3() const;
void set3(int val);
- void toggle4();
+ void toggle4();
bool set4(bool val);
int get88() const;
int get5() const;
void update6();
- int get6() const;
+ int get6() const;
};
} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp
index f5d1d36c49..437c0f0e52 100644
--- a/engines/titanic/star_control/star_view.cpp
+++ b/engines/titanic/star_control/star_view.cpp
@@ -29,7 +29,7 @@
namespace Titanic {
CStarView::CStarView() : _sub12(nullptr, nullptr), _sub13((void *)nullptr),
- _owner(nullptr), _starField(nullptr), _videoSurface(nullptr), _field118(0),
+ _owner(nullptr), _starField(nullptr), _videoSurface(nullptr), _field118(0),
_videoSurface2(nullptr), _field210(0), _homePhotoMask(nullptr),
_field218(0), _field21C(0) {
CStar20Data data = { 0, 0, 0x47C35000, 0, 0x41A00000,
@@ -53,7 +53,7 @@ void CStarView::load(SimpleFile *file, int param) {
void CStarView::save(SimpleFile *file, int indent) {
_sub12.save(file, indent);
-
+
file->writeNumberLine(_field118, indent);
if (_field118)
_sub13.save(file, indent);
diff --git a/engines/titanic/star_control/surface_fader_base.cpp b/engines/titanic/star_control/surface_fader_base.cpp
index dfd7c4ab1d..fb17fb1f31 100644
--- a/engines/titanic/star_control/surface_fader_base.cpp
+++ b/engines/titanic/star_control/surface_fader_base.cpp
@@ -70,7 +70,7 @@ CVideoSurface *CSurfaceFaderBase::fade(CScreenManager *screenManager, CVideoSurf
srcSurface->unlock();
_videoSurface->unlock();
-
+
++_index;
return _videoSurface;
}
diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp
index 2cc32971ae..9e465c705f 100644
--- a/engines/titanic/support/avi_surface.cpp
+++ b/engines/titanic/support/avi_surface.cpp
@@ -30,73 +30,46 @@
namespace Titanic {
-Video::AVIDecoder::AVIVideoTrack &AVIDecoder::getVideoTrack() {
- for (TrackListIterator it = getTrackListBegin(); it != getTrackListEnd(); it++)
- if ((*it)->getTrackType() == Track::kTrackTypeVideo)
- return *dynamic_cast<AVIVideoTrack *>(*it);
-
- error("Could not find video track");
-}
-
-/**
- * Track filter for AVIDecoder that filters out any secondary
- * video track some videos have to hold transparency masks
- */
-static bool primaryTrackSelect(bool isVideo, int trackCounter) {
- return !isVideo || trackCounter == 0;
-}
-
-/**
- * Track filter for AVIDecoder that only accepts the secondary
- * transparency msak video track for a video, if present
- */
-static bool secondaryTrackSelect(bool isVideo, int trackCounter) {
- return isVideo && trackCounter > 0;
+Video::AVIDecoder::AVIVideoTrack &AVIDecoder::getVideoTrack(uint idx) {
+ assert(idx < _videoTracks.size());
+ AVIVideoTrack *track = static_cast<AVIVideoTrack *>(_videoTracks[idx].track);
+ return *track;
}
AVISurface::AVISurface(const CResourceKey &key) {
_videoSurface = nullptr;
_streamCount = 0;
_movieFrameSurface[0] = _movieFrameSurface[1] = nullptr;
+ _framePixels = nullptr;
- // Reset current frame. We need to keep track of frames separately from the decoders,
+ // Reset current frame. We need to keep track of frames separately from the decoder,
// since it needs to be able to go beyond the frame count or to negative to allow
// correct detection of when range playbacks have finished
_currentFrame = -1;
_isReversed = false;
- // Create a decoder for the audio (if any) and primary video track
- _decoders[0] = new AVIDecoder(Audio::Mixer::kPlainSoundType, primaryTrackSelect);
- if (!_decoders[0]->loadFile(key.getString()))
+ // Create a decoder
+ _decoder = new AVIDecoder(Audio::Mixer::kPlainSoundType);
+ if (!_decoder->loadFile(key.getString()))
error("Could not open video - %s", key.getString().c_str());
- _streamCount = 1;
-
- // Create a decoder for any secondary video track
- AVIDecoder *decoder2 = new AVIDecoder(Audio::Mixer::kPlainSoundType, secondaryTrackSelect);
- if (decoder2->loadFile(key.getString())) {
- _decoders[1] = decoder2;
- ++_streamCount;
- } else {
- delete decoder2;
- _decoders[1] = nullptr;
- }
+ _streamCount = _decoder->videoTrackCount();
}
AVISurface::~AVISurface() {
if (_videoSurface)
- _videoSurface->_transBlitFlag = false;
+ _videoSurface->_flipVertically = false;
+ delete _framePixels;
delete _movieFrameSurface[0];
delete _movieFrameSurface[1];
- delete _decoders[0];
- delete _decoders[1];
+ delete _decoder;
}
bool AVISurface::play(uint flags, CGameObject *obj) {
if (flags & MOVIE_REVERSE)
- return play(_decoders[0]->getFrameCount() - 1, 0, flags, obj);
+ return play(_decoder->getFrameCount() - 1, 0, flags, obj);
else
- return play(0, _decoders[0]->getFrameCount() - 1, flags, obj);
+ return play(0, _decoder->getFrameCount() - 1, flags, obj);
}
bool AVISurface::play(int startFrame, int endFrame, uint flags, CGameObject *obj) {
@@ -121,26 +94,23 @@ bool AVISurface::play(int startFrame, int endFrame, int initialFrame, uint flags
me->_endFrame = endFrame;
me->_initialFrame = 0;
me->_gameObject = obj;
-
+
info->addEvent(me);
}
_movieRangeInfo.push_back(info);
-
+
if (_movieRangeInfo.size() == 1) {
// First play call, so start the movie playing
setReversed(info->_isReversed);
return startAtFrame(initialFrame);
} else {
return true;
- }
+ }
}
void AVISurface::stop() {
- _decoders[0]->stop();
- if (_decoders[1])
- _decoders[1]->stop();
-
+ _decoder->stop();
_movieRangeInfo.destroyContents();
}
@@ -158,19 +128,14 @@ bool AVISurface::startAtFrame(int frameNumber) {
renderFrame();
// Start the playback
- _decoders[0]->start();
- if (_decoders[1])
- _decoders[1]->start();
-
+ _decoder->start();
+
return true;
}
void AVISurface::seekToFrame(uint frameNumber) {
if ((int)frameNumber != getFrame()) {
- _decoders[0]->seekToFrame(frameNumber);
- if (_decoders[1])
- _decoders[1]->seekToFrame(frameNumber);
-
+ _decoder->seekToFrame(frameNumber);
_currentFrame = (int)frameNumber;
}
@@ -178,10 +143,7 @@ void AVISurface::seekToFrame(uint frameNumber) {
}
void AVISurface::setReversed(bool isReversed) {
- _decoders[0]->setReverse(isReversed);
- if (_decoders[1])
- _decoders[1]->setReverse(isReversed);
-
+ _decoder->setReverse(isReversed);
_isReversed = isReversed;
}
@@ -219,7 +181,7 @@ bool AVISurface::handleEvents(CMovieEventList &events) {
setReversed(info->_isReversed);
seekToFrame(newFrame);
}
-
+
// Get any events for the given position
info->getMovieFrame(events, newFrame);
return renderFrame();
@@ -232,8 +194,8 @@ void AVISurface::setVideoSurface(CVideoSurface *surface) {
_videoSurface = surface;
// Handling for secondary video stream
- if (_decoders[1]) {
- const Common::String &streamName = _decoders[1]->getVideoTrack().getName();
+ if (_streamCount == 2) {
+ const Common::String &streamName = _decoder->getVideoTrack(1).getName();
if (streamName == "mask0") {
_videoSurface->_transparencyMode = TRANS_MASK0;
@@ -250,27 +212,56 @@ void AVISurface::setVideoSurface(CVideoSurface *surface) {
}
void AVISurface::setupDecompressor() {
- for (int idx = 0; idx < 2; ++idx) {
- if (!_decoders[idx])
- continue;
- AVIDecoder &decoder = *_decoders[idx];
+ if (!_decoder)
+ return;
+ for (int idx = 0; idx < _streamCount; ++idx) {
// Setup frame surface
- _movieFrameSurface[idx] = new Graphics::ManagedSurface(decoder.getWidth(), decoder.getHeight(),
- g_system->getScreenFormat());
+ _movieFrameSurface[idx] = new Graphics::ManagedSurface(_decoder->getWidth(), _decoder->getHeight(),
+ _decoder->getVideoTrack(idx).getPixelFormat());
+
+ bool flag = false;
+ if (idx == 0 && _videoSurface &&
+ _videoSurface->getPitch() == _movieFrameSurface[idx]->pitch) {
+ const uint bitCount = _decoder->getVideoTrack(0).getBitCount();
+ const int vDepth = _videoSurface->getPixelDepth();
+
+ switch (bitCount) {
+ case 15:
+ flag = vDepth == 1;
+ break;
+
+ case 16:
+ flag = vDepth == 1 || vDepth == 2;
+ break;
+
+ case 24:
+ flag = vDepth == 3;
+ break;
+
+ default:
+ break;
+ }
+ }
- // TODO: See whether this simplified form of original works
- if (idx == 1)
- _videoSurface->_transBlitFlag = true;
+ if (!flag) {
+ _framePixels = new Graphics::ManagedSurface(_decoder->getWidth(), _decoder->getHeight(),
+ _decoder->getVideoTrack(0).getPixelFormat());
+ } else if (idx == 0) {
+ // The original developers used a vertical flipped playback to indicate
+ // an incompatibility between source video and dest surface bit-depths,
+ // which would result in poor playback performance
+ _videoSurface->_flipVertically = true;
+ }
}
}
uint AVISurface::getWidth() const {
- return _decoders[0]->getWidth();
+ return _decoder->getWidth();
}
uint AVISurface::getHeight() const {
- return _decoders[0]->getHeight();
+ return _decoder->getHeight();
}
void AVISurface::setFrame(int frameNumber) {
@@ -279,42 +270,49 @@ void AVISurface::setFrame(int frameNumber) {
stop();
// Ensure the frame number is valid
- if (frameNumber >= (int)_decoders[0]->getFrameCount())
- frameNumber = _decoders[0]->getFrameCount() - 1;
+ if (frameNumber >= (int)_decoder->getFrameCount())
+ frameNumber = _decoder->getFrameCount() - 1;
seekToFrame(frameNumber);
renderFrame();
}
bool AVISurface::isNextFrame() const {
- return _decoders[0]->getTimeToNextFrame() == 0;
+ return _decoder->getTimeToNextFrame() == 0;
}
bool AVISurface::renderFrame() {
// Check there's a frame ready for display
- if (!_decoders[0]->needsUpdate())
+ if (!_decoder->needsUpdate())
return false;
- // Decode each decoder's video stream into the appropriate surface
+ // Make a copy of each decoder's video frame
for (int idx = 0; idx < _streamCount; ++idx) {
- const Graphics::Surface *frame = _decoders[idx]->decodeNextFrame();
-
- if (_movieFrameSurface[idx]->format == frame->format) {
- _movieFrameSurface[idx]->blitFrom(*frame);
- } else {
- // Format mis-match, so we need to convert the frame
- Graphics::Surface *s = frame->convertTo(_movieFrameSurface[idx]->format,
- _decoders[idx]->getPalette());
- _movieFrameSurface[idx]->blitFrom(*s);
- s->free();
- delete s;
- }
+ const Graphics::Surface *frame = (idx == 0) ?
+ _decoder->decodeNextFrame() : _decoder->decodeNextTransparency();
+
+ assert(_movieFrameSurface[idx]->format == frame->format);
+ _movieFrameSurface[idx]->blitFrom(*frame);
}
- // Blit the primary video frame onto the main overall surface
- _videoSurface->lock();
- _videoSurface->getRawSurface()->blitFrom(*_movieFrameSurface[0]);
- _videoSurface->unlock();
+ if (!_framePixels) {
+ if (_videoSurface->lock()) {
+ // Blit the frame directly to the video surface
+ assert(_streamCount == 1);
+ _videoSurface->blitFrom(Point(0, 0), &_movieFrameSurface[0]->rawSurface());
+
+ _videoSurface->unlock();
+ }
+ } else {
+ // Blit the primary video track's frame to the video surface
+ Graphics::Surface *s = _movieFrameSurface[0]->rawSurface().convertTo(
+ g_system->getScreenFormat(), _decoder->getPalette());
+ _videoSurface->lock();
+ _videoSurface->getRawSurface()->blitFrom(*s);
+ _videoSurface->unlock();
+ s->free();
+ delete s;
+ }
return false;
}
@@ -340,9 +338,7 @@ bool AVISurface::addEvent(int frameNumber, CGameObject *obj) {
}
void AVISurface::setFrameRate(double rate) {
- _decoders[0]->setRate(Common::Rational((int)rate));
- if (_decoders[1])
- _decoders[1]->setRate(Common::Rational((int)rate));
+ _decoder->setRate(Common::Rational((int)rate));
}
Graphics::ManagedSurface *AVISurface::getSecondarySurface() {
@@ -368,7 +364,7 @@ void AVISurface::playCutscene(const Rect &r, uint startFrame, uint endFrame) {
while (_currentFrame < (int)endFrame && !g_vm->shouldQuit()) {
if (isNextFrame()) {
renderFrame();
- _currentFrame = _decoders[0]->getCurFrame();
+ _currentFrame = _decoder->getCurFrame();
if (isDifferent) {
// Clear the destination area, and use the transBlitFrom method,
diff --git a/engines/titanic/support/avi_surface.h b/engines/titanic/support/avi_surface.h
index 0acf7ab23b..b6231a646f 100644
--- a/engines/titanic/support/avi_surface.h
+++ b/engines/titanic/support/avi_surface.h
@@ -40,21 +40,30 @@ enum MovieFlag {
class AVIDecoder : public Video::AVIDecoder {
public:
- AVIDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType, SelectTrackFn trackFn = nullptr) :
- Video::AVIDecoder(soundType, trackFn) {}
- AVIDecoder(const Common::Rational &frameRateOverride, Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType,
- SelectTrackFn trackFn = nullptr) : Video::AVIDecoder(frameRateOverride, soundType, trackFn) {}
-
- Video::AVIDecoder::AVIVideoTrack &getVideoTrack();
+ AVIDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType) :
+ Video::AVIDecoder(soundType) {}
+ AVIDecoder(const Common::Rational &frameRateOverride, Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType) :
+ Video::AVIDecoder(frameRateOverride, soundType) {}
+
+ /**
+ * Returns the number of video tracks the decoder has
+ */
+ uint videoTrackCount() const { return _videoTracks.size(); }
+
+ /**
+ * Returns the specified video track
+ */
+ Video::AVIDecoder::AVIVideoTrack &getVideoTrack(uint idx);
};
class AVISurface {
private:
- AVIDecoder *_decoders[2];
+ AVIDecoder *_decoder;
CVideoSurface *_videoSurface;
CMovieRangeInfoList _movieRangeInfo;
int _streamCount;
Graphics::ManagedSurface *_movieFrameSurface[2];
+ Graphics::ManagedSurface *_framePixels;
bool _isReversed;
int _currentFrame;
private:
@@ -113,7 +122,7 @@ public:
/**
* Return true if a video is currently playing
*/
- virtual bool isPlaying() const { return _decoders[0]->isPlaying(); }
+ virtual bool isPlaying() const { return _decoder->isPlaying(); }
/**
* Handle any movie events relevent for the frame
diff --git a/engines/titanic/support/credit_text.cpp b/engines/titanic/support/credit_text.cpp
index 009c3f4944..da6de6278e 100644
--- a/engines/titanic/support/credit_text.cpp
+++ b/engines/titanic/support/credit_text.cpp
@@ -67,7 +67,7 @@ void CCreditText::setup() {
// Create a new group and line within it
CCreditLineGroup *group = new CCreditLineGroup();
- CCreditLine *line = new CCreditLine(srcLine,
+ CCreditLine *line = new CCreditLine(srcLine,
_screenManagerP->stringWidth(srcLine));
group->_lines.push_back(line);
@@ -125,7 +125,7 @@ void CCreditText::handleDots(CCreditLineGroup *group) {
// Figure out the maximum width of secondary lines
for (CCreditLines::iterator i = second; i != group->_lines.end(); ++i)
maxWidth = MAX(maxWidth, (*i)->_lineWidth);
-
+
int charWidth = _screenManagerP->stringWidth(".");
// Process the secondary lines
diff --git a/engines/titanic/support/direct_draw.h b/engines/titanic/support/direct_draw.h
index a7e9cc8d93..08ead6d798 100644
--- a/engines/titanic/support/direct_draw.h
+++ b/engines/titanic/support/direct_draw.h
@@ -70,7 +70,7 @@ public:
* @param width Screen width
* @param height Screen height
* @param bpp Bits per pixel
- * @param numBackSurfaces Number of back surfaces
+ * @param numBackSurfaces Number of back surfaces
*/
void initVideo(int width, int height, int bpp, int numBackSurfaces);
diff --git a/engines/titanic/support/files_manager.cpp b/engines/titanic/support/files_manager.cpp
index 22bff275d2..2882b8da85 100644
--- a/engines/titanic/support/files_manager.cpp
+++ b/engines/titanic/support/files_manager.cpp
@@ -75,7 +75,7 @@ bool CFilesManager::scanForFile(const CString &name) {
CString filename = name;
filename.toLowercase();
-
+
if (filename[0] == 'y' || filename[0] == 'z')
return true;
else if (filename[0] < 'a' || filename[0] > 'c')
diff --git a/engines/titanic/support/files_manager.h b/engines/titanic/support/files_manager.h
index a980ef1b25..45b067e86e 100644
--- a/engines/titanic/support/files_manager.h
+++ b/engines/titanic/support/files_manager.h
@@ -39,7 +39,7 @@ class CFilesManager {
struct ResourceEntry {
uint _offset;
uint _size;
-
+
ResourceEntry() : _offset(0), _size(0) {}
ResourceEntry(uint offset, uint size) : _offset(offset), _size(size) {}
};
diff --git a/engines/titanic/support/font.cpp b/engines/titanic/support/font.cpp
index e519237c3b..625d03720b 100644
--- a/engines/titanic/support/font.cpp
+++ b/engines/titanic/support/font.cpp
@@ -80,7 +80,7 @@ int STFont::getTextBounds(const CString &str, int maxWidth, Point *sizeOut) cons
if (_fontHeight == 0 || !_dataPtr)
// No font, so return immediately
return 0;
-
+
// Loop through the characters of the string
if (!str.empty()) {
for (const char *strP = str.c_str(); *strP; ++strP) {
@@ -296,8 +296,9 @@ void STFont::copyRect(CVideoSurface *surface, const Point &pt, Rect &rect) {
for (int yp = rect.top; yp < rect.bottom; ++yp, lineP += surface->getWidth()) {
uint16 *destP = lineP;
for (int xp = rect.left; xp < rect.right; ++xp, ++destP) {
- const byte *srcP = _dataPtr + yp * _dataWidth + xp;
- surface->changePixel(destP, &color, *srcP >> 3, true);
+ const byte *transP = _dataPtr + yp * _dataWidth + xp;
+ surface->copyPixel(destP, &color, *transP >> 3,
+ surface->getRawSurface()->format, true);
}
}
@@ -330,7 +331,7 @@ void STFont::checkLineWrap(Point &textSize, int maxWidth, const char *&str) cons
flag = true;
}
}
-
+
if ((textSize.x + totalWidth) >= maxWidth && totalWidth < maxWidth) {
// Word wrap
textSize.x = 0;
diff --git a/engines/titanic/support/font.h b/engines/titanic/support/font.h
index 6c4fe8e9c3..685ab8ad73 100644
--- a/engines/titanic/support/font.h
+++ b/engines/titanic/support/font.h
@@ -50,13 +50,13 @@ private:
* Copys a rectangle representing a character in the font data to
* a given destination position in the surface
*/
- void copyRect(CVideoSurface *surface, const Common::Point &destPos,
+ void copyRect(CVideoSurface *surface, const Common::Point &destPos,
Rect &srcRect);
/**
* Write a character
*/
- WriteCharacterResult writeChar(CVideoSurface *surface, unsigned char c,
+ WriteCharacterResult writeChar(CVideoSurface *surface, unsigned char c,
const Common::Point &pt, const Rect &destRect, const Rect *srcRect);
/**
diff --git a/engines/titanic/support/image_decoders.cpp b/engines/titanic/support/image_decoders.cpp
index 495d1d0982..2dba66fbb3 100644
--- a/engines/titanic/support/image_decoders.cpp
+++ b/engines/titanic/support/image_decoders.cpp
@@ -32,9 +32,9 @@ void CJPEGDecode::decode(OSVideoSurface &surface, const CString &name) {
// Use the ScucmmVM deoder to decode it
loadStream(*file.readStream());
const Graphics::Surface *srcSurf = getSurface();
-
+
// Resize the surface if necessary
- if (!surface.hasSurface() || surface.getWidth() != srcSurf->w
+ if (!surface.hasSurface() || surface.getWidth() != srcSurf->w
|| surface.getHeight() != srcSurf->h)
surface.recreate(srcSurf->w, srcSurf->h);
diff --git a/engines/titanic/support/mouse_cursor.cpp b/engines/titanic/support/mouse_cursor.cpp
index 0cefc368fa..4dd1ab4366 100644
--- a/engines/titanic/support/mouse_cursor.cpp
+++ b/engines/titanic/support/mouse_cursor.cpp
@@ -20,18 +20,16 @@
*
*/
-#include "common/memstream.h"
-#include "common/textconsole.h"
#include "graphics/cursorman.h"
#include "titanic/support/mouse_cursor.h"
-#include "titanic/support/movie.h"
-#include "titanic/support/screen_manager.h"
+#include "titanic/support/transparency_surface.h"
#include "titanic/support/video_surface.h"
-#include "titanic/core/resource_key.h"
#include "titanic/titanic.h"
namespace Titanic {
+#define CURSOR_SIZE 64
+
static const int CURSOR_DATA[NUM_CURSORS][4] = {
{ 1, 136, 19, 18 },
{ 2, 139, 1, 1 },
@@ -52,10 +50,10 @@ static const int CURSOR_DATA[NUM_CURSORS][4] = {
CMouseCursor::CursorEntry::~CursorEntry() {
delete _videoSurface;
- delete _frameSurface;
+ delete _transSurface;
}
-CMouseCursor::CMouseCursor(CScreenManager *screenManager) :
+CMouseCursor::CMouseCursor(CScreenManager *screenManager) :
_screenManager(screenManager), _cursorId(CURSOR_HOURGLASS),
_setCursorCount(0), _fieldE4(0), _fieldE8(0) {
loadCursorImages();
@@ -75,16 +73,16 @@ void CMouseCursor::loadCursorImages() {
CURSOR_DATA[idx][3]);
// Create the surface
- CVideoSurface *surface = _screenManager->createSurface(64, 64);
+ CVideoSurface *surface = _screenManager->createSurface(CURSOR_SIZE, CURSOR_SIZE);
_cursors[idx]._videoSurface = surface;
// Open the cursors video and move to the given frame
OSMovie movie(key, surface);
movie.setFrame(idx);
-
- Graphics::ManagedSurface *frameSurface = movie.duplicateFrame();
- _cursors[idx]._frameSurface = frameSurface;
- surface->setTransparencySurface(frameSurface);
+
+ Graphics::ManagedSurface *transSurface = movie.duplicateTransparency();
+ _cursors[idx]._transSurface = transSurface;
+ surface->setTransparencySurface(transSurface);
}
}
@@ -100,15 +98,35 @@ void CMouseCursor::setCursor(CursorId cursorId) {
++_setCursorCount;
if (cursorId != _cursorId) {
+ // The original cursors supported partial alpha when rendering the cursor.
+ // Since we're using the ScummVM CursorMan, we can't do that, so we need
+ // to build up a surface of the cursor with even partially transparent
+ // pixels as wholy transparent
CursorEntry &ce = _cursors[cursorId - 1];
- CVideoSurface &surface = *ce._videoSurface;
- surface.lock();
+ CVideoSurface &srcSurface = *ce._videoSurface;
+ srcSurface.lock();
+
+ Graphics::ManagedSurface surface(CURSOR_SIZE, CURSOR_SIZE, g_system->getScreenFormat());
+ const uint16 *srcP = srcSurface.getPixels();
+ CTransparencySurface transSurface(&ce._transSurface->rawSurface(), TRANS_DEFAULT);
+ uint16 *destP = (uint16 *)surface.getPixels();
- CursorMan.replaceCursor(surface.getPixels(), surface.getWidth(), surface.getHeight(),
- ce._centroid.x, ce._centroid.y, 0, false, &g_vm->_screen->format);
- surface.unlock();
+ for (int y = 0; y < CURSOR_SIZE; ++y) {
+ transSurface.setRow(y);
+ transSurface.setCol(0);
+ for (int x = 0; x < CURSOR_SIZE; ++x, ++srcP, ++destP) {
+ *destP = transSurface.isPixelTransparent() ? srcSurface.getTransparencyColor() : *srcP;
+ transSurface.moveX();
+ }
+ }
+
+ srcSurface.unlock();
+
+ // Set the cursor
_cursorId = cursorId;
+ CursorMan.replaceCursor(surface.getPixels(), CURSOR_SIZE, CURSOR_SIZE,
+ ce._centroid.x, ce._centroid.y, srcSurface.getTransparencyColor(), false, &g_vm->_screen->format);
}
}
@@ -129,7 +147,7 @@ void CMouseCursor::unlockE4() {
void CMouseCursor::setPosition(const Point &pt, double rate) {
assert(rate >= 0.0 && rate <= 1.0);
-
+
// TODO: Figure out use of the rate parameter
g_system->warpMouse(pt.x, pt.y);
}
diff --git a/engines/titanic/support/mouse_cursor.h b/engines/titanic/support/mouse_cursor.h
index 74fb1f6113..08de28e29d 100644
--- a/engines/titanic/support/mouse_cursor.h
+++ b/engines/titanic/support/mouse_cursor.h
@@ -55,10 +55,10 @@ class CVideoSurface;
class CMouseCursor {
struct CursorEntry {
CVideoSurface *_videoSurface;
- Graphics::ManagedSurface *_frameSurface;
+ Graphics::ManagedSurface *_transSurface;
Common::Point _centroid;
- CursorEntry() : _videoSurface(nullptr), _frameSurface(nullptr) {}
+ CursorEntry() : _videoSurface(nullptr), _transSurface(nullptr) {}
~CursorEntry();
};
private:
@@ -86,12 +86,12 @@ public:
* Hide the mouse cursor
*/
void hide();
-
+
/**
* Set the cursor
*/
void setCursor(CursorId cursorId);
-
+
/**
* Updates the mouse cursor
*/
diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp
index a605cc3465..aea51e1a1e 100644
--- a/engines/titanic/support/movie.cpp
+++ b/engines/titanic/support/movie.cpp
@@ -125,7 +125,7 @@ void OSMovie::play(uint startFrame, uint endFrame, uint initialFrame, uint flags
void OSMovie::playCutscene(const Rect &drawRect, uint startFrame, uint endFrame) {
if (!_movieSurface)
_movieSurface = CScreenManager::_screenManagerPtr->createSurface(600, 340);
-
+
bool widthLess = _videoSurface->getWidth() < 600;
bool heightLess = _videoSurface->getHeight() < 340;
Rect r(drawRect.left, drawRect.top,
@@ -203,7 +203,7 @@ void OSMovie::setFrameRate(double rate) {
_aviSurface.setFrameRate(rate);
}
-Graphics::ManagedSurface *OSMovie::duplicateFrame() const {
+Graphics::ManagedSurface *OSMovie::duplicateTransparency() const {
return _aviSurface.duplicateTransparency();
}
diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h
index 8c89f9e6dd..acc647065f 100644
--- a/engines/titanic/support/movie.h
+++ b/engines/titanic/support/movie.h
@@ -72,7 +72,7 @@ public:
* Starts playing the movie
*/
virtual void play(uint flags, CGameObject *obj) = 0;
-
+
/**
* Starts playing the movie
*/
@@ -82,13 +82,13 @@ public:
* Starts playing the movie
*/
virtual void play(uint startFrame, uint endFrame, uint initialFrame, uint flags, CGameObject *obj) = 0;
-
+
/**
* Plays a sub-section of a movie, and doesn't return until either
* the playback ends or a key has been pressed
*/
virtual void playCutscene(const Rect &drawRect, uint startFrame, uint endFrame) = 0;
-
+
/**
* Stops the movie
*/
@@ -103,12 +103,12 @@ public:
* Set the current frame number
*/
virtual void setFrame(uint frameNumber) = 0;
-
+
/**
* Handle any pending movie events
*/
virtual bool handleEvents(CMovieEventList &events) = 0;
-
+
/**
* Return any movie range info associated with the movie
*/
@@ -130,9 +130,9 @@ public:
virtual void setFrameRate(double rate) = 0;
/**
- * Creates a duplicate of the movie's frame
- */
- virtual Graphics::ManagedSurface *duplicateFrame() const = 0;
+ * Creates a duplicate of the transparency surface
+ */
+ virtual Graphics::ManagedSurface *duplicateTransparency() const = 0;
/**
* Removes the movie from the list of currently playing movies
@@ -171,17 +171,17 @@ public:
* Starts playing the movie
*/
virtual void play(uint flags, CGameObject *obj);
-
+
/**
* Starts playing the movie
*/
virtual void play(uint startFrame, uint endFrame, uint flags, CGameObject *obj);
-
+
/**
* Starts playing the movie
*/
virtual void play(uint startFrame, uint endFrame, uint initialFrame, uint flags, CGameObject *obj);
-
+
/**
* Plays a sub-section of a movie, and doesn't return until either
* the playback ends or a key has been pressed
@@ -192,7 +192,7 @@ public:
* Stops the movie
*/
virtual void stop();
-
+
/**
* Add a playback event
*/
@@ -202,7 +202,7 @@ public:
* Set the current frame number
*/
virtual void setFrame(uint frameNumber);
-
+
/**
* Handle any pending movie events
*/
@@ -229,9 +229,9 @@ public:
virtual void setFrameRate(double rate);
/**
- * Creates a duplicate of the frame info
+ * Creates a duplicate of the transparency surface
*/
- virtual Graphics::ManagedSurface *duplicateFrame() const;
+ virtual Graphics::ManagedSurface *duplicateTransparency() const;
};
} // End of namespace Titanic
diff --git a/engines/titanic/support/movie_clip.h b/engines/titanic/support/movie_clip.h
index 513ed4a339..17c91b190c 100644
--- a/engines/titanic/support/movie_clip.h
+++ b/engines/titanic/support/movie_clip.h
@@ -27,7 +27,7 @@
namespace Titanic {
-enum ClipFlag {
+enum ClipFlag {
CLIPFLAG_HAS_END_FRAME = 1,
CLIPFLAG_4 = 4,
CLIPFLAG_HAS_START_FRAME = 8,
diff --git a/engines/titanic/support/movie_range_info.cpp b/engines/titanic/support/movie_range_info.cpp
index d4d9fc0e2a..018ffd63b5 100644
--- a/engines/titanic/support/movie_range_info.cpp
+++ b/engines/titanic/support/movie_range_info.cpp
@@ -91,7 +91,7 @@ void CMovieRangeInfo::process(CGameObject *owner) {
flags |= MOVIE_REPEAT;
if (_startFrame)
flags |= MOVIE_REVERSE;
-
+
for (CMovieEventList::iterator i = _events.begin(); i != _events.end(); ++i) {
CMovieEvent *movieEvent = *i;
if (movieEvent->_type == MET_MOVIE_END) {
diff --git a/engines/titanic/support/screen_manager.cpp b/engines/titanic/support/screen_manager.cpp
index bcf43fc8cb..2e9bbcb6de 100644
--- a/engines/titanic/support/screen_manager.cpp
+++ b/engines/titanic/support/screen_manager.cpp
@@ -178,7 +178,7 @@ void OSScreenManager::blitFrom(SurfaceNum surfaceNum, CVideoSurface *src,
destSurface = _backSurfaces[surfaceNum]._surface;
if (!destSurface->hasSurface())
return;
-
+
Point destPoint = destPos ? *destPos : Point(0, 0);
Rect srcBounds = srcRect ? *srcRect : Rect(0, 0, src->getWidth(), src->getHeight());
Rect *bounds = &srcBounds;
@@ -220,7 +220,7 @@ void OSScreenManager::blitFrom(SurfaceNum surfaceNum, const Rect *rect, CVideoSu
destSurface->blitFrom(Point(rect->left, rect->top), src, rect);
}
-int OSScreenManager::writeString(int surfaceNum, const Rect &destRect,
+int OSScreenManager::writeString(int surfaceNum, const Rect &destRect,
int yOffset, const CString &str, CTextCursor *textCursor) {
CVideoSurface *surface;
Rect bounds;
diff --git a/engines/titanic/support/screen_manager.h b/engines/titanic/support/screen_manager.h
index cad6901b02..f88928af8b 100644
--- a/engines/titanic/support/screen_manager.h
+++ b/engines/titanic/support/screen_manager.h
@@ -78,7 +78,7 @@ public:
virtual void setWindowHandle(int v);
virtual bool resetWindowHandle(int v);
-
+
/**
* Sets the video mode
*/
@@ -88,17 +88,17 @@ public:
* Handles drawing the cursors
*/
virtual void drawCursors() = 0;
-
+
/**
* Locks a specified surface number for access and returns a pointer to it
*/
virtual CVideoSurface *lockSurface(SurfaceNum surfaceNum) = 0;
-
+
/**
* Unlocks a previously locked surface
*/
virtual void unlockSurface(CVideoSurface *surface) = 0;
-
+
/**
* Gets a specified surface number
*/
@@ -108,7 +108,7 @@ public:
* Return the front render surface
*/
virtual CVideoSurface *getFrontRenderSurface() const = 0;
-
+
/**
* Fill an area with a specific color
*/
@@ -191,7 +191,7 @@ public:
* Creates a surface of a given size
*/
virtual CVideoSurface *createSurface(int w, int h) = 0;
-
+
/**
* Creates a surface from a specified resource
*/
@@ -213,7 +213,7 @@ public:
* Show the mouse cursor
*/
virtual void showCursor() = 0;
-
+
/**
* Hide the mouse cursor
*/
@@ -272,12 +272,12 @@ public:
* Locks a specified surface number for access and returns a pointer to it
*/
virtual CVideoSurface *lockSurface(SurfaceNum surfaceNum);
-
+
/**
* Unlocks a previously locked surface
*/
virtual void unlockSurface(CVideoSurface *surface);
-
+
/**
* Gets a specified surface number
*/
@@ -373,7 +373,7 @@ public:
* Creates a surface of a given size
*/
virtual CVideoSurface *createSurface(int w, int h);
-
+
/**
* Creates a surface from a specified resource
*/
@@ -383,7 +383,7 @@ public:
* Show the mouse cursor
*/
virtual void showCursor();
-
+
/**
* Hide the mouse cursor
*/
diff --git a/engines/titanic/support/simple_file.cpp b/engines/titanic/support/simple_file.cpp
index 35b2e28e4a..7e3cea35be 100644
--- a/engines/titanic/support/simple_file.cpp
+++ b/engines/titanic/support/simple_file.cpp
@@ -52,7 +52,7 @@ SimpleFile::~SimpleFile() {
}
void SimpleFile::open(Common::SeekableReadStream *stream) {
- close();
+ close();
_inStream = stream;
}
@@ -290,7 +290,7 @@ void SimpleFile::writeString(const CString &str) const {
const char *msgP = str.c_str();
char c;
-
+
while ((c = *msgP++) != '\0') {
switch (c) {
case '\r':
@@ -422,8 +422,8 @@ bool SimpleFile::scanf(const char *format, ...) {
while (!formatStr.empty()) {
if (formatStr.hasPrefix(" ")) {
formatStr.deleteChar(0);
-
- safeRead(&c, 1);
+
+ safeRead(&c, 1);
if (!Common::isSpace(c))
return false;
@@ -434,7 +434,7 @@ bool SimpleFile::scanf(const char *format, ...) {
formatStr = CString(formatStr.c_str() + 2);
int *param = (int *)va_arg(va, int *);
*param = readNumber();
-
+
if (!eos())
_inStream->seek(-1, SEEK_CUR);
} else if (formatStr.hasPrefix("%s")) {
@@ -488,7 +488,7 @@ bool StdCWadFile::open(const Common::String &filename) {
CString resStr = name.mid(idx + 1, extPos - idx - 1);
int resIndex = resStr.readInt();
- // Open up the index for access
+ // Open up the index for access
f.open(fname);
int indexSize = f.readUint32LE() / 4;
assert(resIndex < indexSize);
diff --git a/engines/titanic/support/string.cpp b/engines/titanic/support/string.cpp
index 9961cfce59..cf1b29b6ec 100644
--- a/engines/titanic/support/string.cpp
+++ b/engines/titanic/support/string.cpp
@@ -41,7 +41,7 @@ CString CString::left(uint count) const {
CString CString::right(uint count) const {
uint strSize = size();
- return (count > strSize) ? CString() :
+ return (count > strSize) ? CString() :
CString(c_str() + strSize - count, c_str() + strSize);
}
@@ -85,7 +85,7 @@ FileType CString::fileTypeSuffix() const {
return FILETYPE_WAV;
else if (ext == "2" || ext == "3")
return FILETYPE_MOVIE;
-
+
ext = right(3);
if (ext == "tga" || ext == "jpg")
return FILETYPE_IMAGE;
diff --git a/engines/titanic/support/text_cursor.cpp b/engines/titanic/support/text_cursor.cpp
index ad3fe4ed26..5c7593ba68 100644
--- a/engines/titanic/support/text_cursor.cpp
+++ b/engines/titanic/support/text_cursor.cpp
@@ -27,7 +27,7 @@
namespace Titanic {
-CTextCursor::CTextCursor(CScreenManager *screenManager) :
+CTextCursor::CTextCursor(CScreenManager *screenManager) :
_screenManager(screenManager), _active(false), _blinkVisible(false),
_backRenderSurface(nullptr), _frontRenderSurface(nullptr),
_blinkDelay(300), _size(2, 10), _priorBlinkTime(0),
@@ -70,7 +70,7 @@ void CTextCursor::draw() {
if (_blinkVisible) {
Rect cursorRect = getCursorBounds();
_surface->blitFrom(Common::Point(0, 0), _backRenderSurface, &cursorRect);
-
+
if (!_screenBounds.isEmpty())
// Limit the cursor rect to only within designated screen area
cursorRect.constrain(_screenBounds);
@@ -80,7 +80,7 @@ void CTextCursor::draw() {
_backRenderSurface->_ddSurface->fillRect(&cursorRect,
_cursorR, _cursorG, _cursorB);
}
-
+
//_screenManager->blitFrom(SURFACE_BACKBUFFER, _surface, &_pos);
}
}
diff --git a/engines/titanic/support/time_event_info.cpp b/engines/titanic/support/time_event_info.cpp
index 0226223f1a..e088a8e0c2 100644
--- a/engines/titanic/support/time_event_info.cpp
+++ b/engines/titanic/support/time_event_info.cpp
@@ -90,7 +90,7 @@ void CTimeEventInfoList::setPersisent(uint id, bool flag) {
uint CTimeEventInfo::_nextId;
-CTimeEventInfo::CTimeEventInfo() : ListItem(), _lockCounter(0),
+CTimeEventInfo::CTimeEventInfo() : ListItem(), _lockCounter(0),
_repeated(false), _firstDuration(0), _repeatDuration(0),
_target(nullptr), _actionVal(0), _timerCtr(0), _done(false),
_lastTimerTicks(0), _relativeTicks(0), _persisent(true) {
@@ -147,7 +147,7 @@ void CTimeEventInfo::load(SimpleFile *file) {
void CTimeEventInfo::postLoad(uint ticks, CProjectItem *project) {
if (!_persisent || _targetName.empty())
_done = true;
-
+
// Get the timer's target
if (project)
_target = project->findByName(_targetName);
diff --git a/engines/titanic/support/transparency_surface.cpp b/engines/titanic/support/transparency_surface.cpp
new file mode 100644
index 0000000000..5ffa8b99b1
--- /dev/null
+++ b/engines/titanic/support/transparency_surface.cpp
@@ -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.
+ *
+ */
+
+#include "titanic/support/transparency_surface.h"
+#include "common/algorithm.h"
+#include "common/textconsole.h"
+
+namespace Titanic {
+
+CTransparencySurface::CTransparencySurface(const Graphics::Surface *surface,
+ TransparencyMode transMode) : _surface(surface) {
+ _pitch = 0;
+ _runLength = 0;
+ _flag = false;
+ _flag1 = false;
+ _flag2 = true;
+
+ switch (transMode) {
+ case TRANS_MASK0:
+ case TRANS_ALPHA0:
+ _flag2 = false;
+ _flag1 = true;
+ break;
+ case TRANS_MASK255:
+ case TRANS_ALPHA255:
+ _flag2 = true;
+ _flag1 = false;
+ break;
+ case TRANS_DEFAULT:
+ if (*(byte *)surface->getPixels() < 0x80) {
+ _flag1 = true;
+ _flag2 = false;
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+int CTransparencySurface::moveX() {
+ if (++_pos.x >= _surface->w) {
+ _pos.x = 0;
+ ++_pos.y;
+ }
+
+ return 1;
+}
+
+uint CTransparencySurface::getPixel() const {
+ const byte *pixelP = (const byte *)_surface->getBasePtr(_pos.x, _pos.y);
+ return *pixelP;
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/support/transparency_surface.h b/engines/titanic/support/transparency_surface.h
new file mode 100644
index 0000000000..0391b6d5b7
--- /dev/null
+++ b/engines/titanic/support/transparency_surface.h
@@ -0,0 +1,84 @@
+/* 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 TITANIC_TRANSPARENCY_SURFACE_H
+#define TITANIC_TRANSPARENCY_SURFACE_H
+
+#include "common/rect.h"
+#include "graphics/surface.h"
+
+namespace Titanic {
+
+enum TransparencyMode {
+ TRANS_MASK0 = 0, TRANS_MASK255 = 1, TRANS_ALPHA0 = 2,
+ TRANS_ALPHA255 = 3, TRANS_DEFAULT = 4
+};
+
+class CTransparencySurface {
+private:
+ const Graphics::Surface *_surface;
+ Common::Point _pos;
+ int _pitch;
+ int _runLength;
+ bool _flag;
+ bool _flag1;
+ bool _flag2;
+public:
+ /**
+ * Constructor
+ */
+ CTransparencySurface(const Graphics::Surface *surface, TransparencyMode transMode);
+
+ /**
+ * Sets the row to get transparencies from
+ */
+ void setRow(int yp) { _pos.y = yp; }
+
+ /**
+ * Sets the column to get transparencies from
+ */
+ void setCol(int xp) { _pos.x = xp; }
+
+ /**
+ * Moves reading position horizontally by a single pixel
+ */
+ int moveX();
+
+ /**
+ * Returns a byte from the transparency surface
+ */
+ uint getPixel() const;
+
+ /**
+ * Returns the alpha value for the pixel (0-31)
+ */
+ uint getAlpha() const { return 31 - (getPixel() >> 3); }
+
+ /**
+ * Returns true if the pixel is completely transparent
+ */
+ bool isPixelTransparent() const { return getAlpha() == 31; }
+};
+
+} // End of namespace Titanic
+
+#endif /* TITANIC_TRANSPARENCY_SURFACE_H */
diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp
index 63ad782722..45813bb740 100644
--- a/engines/titanic/support/video_surface.cpp
+++ b/engines/titanic/support/video_surface.cpp
@@ -23,16 +23,19 @@
#include "titanic/support/video_surface.h"
#include "titanic/support/image_decoders.h"
#include "titanic/support/screen_manager.h"
+#include "titanic/support/transparency_surface.h"
#include "titanic/titanic.h"
namespace Titanic {
int CVideoSurface::_videoSurfaceCounter = 0;
+byte CVideoSurface::_palette1[32][32];
+byte CVideoSurface::_palette2[32][32];
CVideoSurface::CVideoSurface(CScreenManager *screenManager) :
_screenManager(screenManager), _rawSurface(nullptr), _movie(nullptr),
- _pendingLoad(false), _transBlitFlag(false), _fastBlitFlag(false),
- _transparencySurface(nullptr), _transparencyMode(TRANS_DEFAULT),
+ _pendingLoad(false), _flipVertically(false), _fastBlitFlag(false),
+ _transparencySurface(nullptr), _transparencyMode(TRANS_DEFAULT),
_freeTransparencySurface(DisposeAfterUse::NO), _hasFrame(true), _lockCount(0) {
_videoSurfaceNum = _videoSurfaceCounter++;
}
@@ -46,6 +49,19 @@ CVideoSurface::~CVideoSurface() {
delete _transparencySurface;
}
+void CVideoSurface::setupPalette(byte palette[32][32], byte val) {
+ for (uint idx1 = 0; idx1 < 32; ++idx1) {
+ for (uint idx2 = 0, base = 0; idx2 < 32; ++idx2, base += idx1) {
+ uint v = base / 31;
+ palette[idx1][idx2] = (byte)v;
+
+ if (val != 0xff && v != idx2) {
+ assert(0);
+ }
+ }
+ }
+}
+
void CVideoSurface::setSurface(CScreenManager *screenManager, DirectDrawSurface *surface) {
_screenManager = screenManager;
_ddSurface = surface;
@@ -56,10 +72,10 @@ void CVideoSurface::blitFrom(const Point &destPos, CVideoSurface *src, const Rec
Rect srcBounds, destBounds;
clipBounds(srcBounds, destBounds, src, srcRect, &destPos);
- if (src->_transBlitFlag)
- blitRect2(srcBounds, destBounds, src);
+ if (src->_flipVertically)
+ flippedBlitRect(srcBounds, destBounds, src);
else
- blitRect1(srcBounds, destBounds, src);
+ blitRect(srcBounds, destBounds, src);
}
}
@@ -132,44 +148,118 @@ void CVideoSurface::clipBounds(Rect &srcRect, Rect &destRect,
error("Invalid rect");
}
-void CVideoSurface::blitRect1(const Rect &srcRect, const Rect &destRect, CVideoSurface *src) {
+void CVideoSurface::blitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src) {
src->lock();
lock();
if (src->_fastBlitFlag) {
_rawSurface->blitFrom(*src->_rawSurface, srcRect, Point(destRect.left, destRect.top));
- } else if (getTransparencySurface()) {
- transBlitRect(srcRect, destRect, src);
- } else {
- _rawSurface->transBlitFrom(*src->_rawSurface, srcRect, destRect, src->getTransparencyColor());
- }
+ } else if (src->getTransparencySurface()) {
+ transBlitRect(srcRect, destRect, src, false);
+ } else if (lock()) {
+ if (src->lock()) {
+ const Graphics::ManagedSurface *srcSurface = src->_rawSurface;
+ Graphics::ManagedSurface *destSurface = _rawSurface;
+ Graphics::Surface destArea = destSurface->getSubArea(destRect);
+ const uint transColor = src->getTransparencyColor();
+
+ const uint16 *srcPtr = (const uint16 *)srcSurface->getBasePtr(
+ srcRect.left, srcRect.top);
+ uint16 *destPtr = (uint16 *)destArea.getBasePtr(0, 0);
+
+ for (int yCtr = 0; yCtr < srcRect.height(); ++yCtr,
+ srcPtr += src->getPitch() / 2,
+ destPtr += destArea.pitch / 2) {
+ // Prepare for copying the line
+ const uint16 *lineSrcP = srcPtr;
+ uint16 *lineDestP = destPtr;
+
+ for (int srcX = srcRect.left; srcX < srcRect.right; ++srcX, ++lineSrcP, ++lineDestP) {
+ if (*lineSrcP != transColor)
+ *lineDestP = *lineSrcP;
+ }
+ }
- src->unlock();
- unlock();
+ src->unlock();
+ }
+
+ unlock();
+ }
}
-void CVideoSurface::blitRect2(const Rect &srcRect, const Rect &destRect, CVideoSurface *src) {
- if (getTransparencySurface()) {
- transBlitRect(srcRect, destRect, src);
- } else {
- src->lock();
- lock();
+void CVideoSurface::flippedBlitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src) {
+ if (src->getTransparencySurface()) {
+ transBlitRect(srcRect, destRect, src, true);
+ } else if (lock()) {
+ if (src->lock()) {
+ const Graphics::ManagedSurface *srcSurface = src->_rawSurface;
+ Graphics::ManagedSurface *destSurface = _rawSurface;
+ Graphics::Surface destArea = destSurface->getSubArea(destRect);
+ const uint transColor = src->getTransparencyColor();
+
+ const uint16 *srcPtr = (const uint16 *)srcSurface->getBasePtr(
+ srcRect.left, srcRect.top);
+ uint16 *destPtr = (uint16 *)destArea.getBasePtr(0, destArea.h - 1);
+
+ for (int yCtr = 0; yCtr < srcRect.height(); ++yCtr,
+ srcPtr += src->getPitch() / 2,
+ destPtr -= destArea.pitch / 2) {
+ // Prepare for copying the line
+ const uint16 *lineSrcP = srcPtr;
+ uint16 *lineDestP = destPtr;
+
+ for (int srcX = srcRect.left; srcX < srcRect.right; ++srcX, ++lineSrcP, ++lineDestP) {
+ if (*lineSrcP != transColor)
+ *lineDestP = *lineSrcP;
+ }
+ }
- _rawSurface->blitFrom(*src->_rawSurface, srcRect, Point(destRect.left, destRect.top));
+ src->unlock();
+ }
- src->unlock();
unlock();
}
}
-void CVideoSurface::transBlitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src) {
+void CVideoSurface::transBlitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src, bool flipFlag) {
+ assert(srcRect.width() == destRect.width() && srcRect.height() == destRect.height());
+
if (lock()) {
if (src->lock()) {
Graphics::ManagedSurface *srcSurface = src->_rawSurface;
Graphics::ManagedSurface *destSurface = _rawSurface;
-
- // TODO: Handle the transparency mode correctly
- destSurface->blitFrom(*srcSurface, srcRect, Point(srcRect.left, srcRect.top));
+ Graphics::Surface destArea = destSurface->getSubArea(destRect);
+
+ const uint16 *srcPtr = (const uint16 *)srcSurface->getBasePtr(
+ srcRect.left, flipFlag ? srcRect.top : srcRect.bottom - 1);
+ uint16 *destPtr = (uint16 *)destArea.getBasePtr(0, destArea.h - 1);
+ bool isAlpha = src->_transparencyMode == TRANS_ALPHA0 ||
+ src->_transparencyMode == TRANS_ALPHA255;
+
+ CTransparencySurface transSurface(src->getTransparencySurface(), src->_transparencyMode);
+
+ for (int yCtr = 0; yCtr < srcRect.height(); ++yCtr) {
+ // Prepare for copying the line
+ const uint16 *lineSrcP = srcPtr;
+ uint16 *lineDestP = destPtr;
+ transSurface.setRow(flipFlag ? srcRect.top + yCtr : srcRect.bottom - yCtr - 1);
+ transSurface.setCol(srcRect.left);
+
+ for (int srcX = srcRect.left; srcX < srcRect.right; ++srcX) {
+ if (!transSurface.isPixelTransparent()) {
+ copyPixel(lineDestP, lineSrcP, transSurface.getAlpha(), srcSurface->format, isAlpha);
+ }
+
+ ++lineSrcP;
+ ++lineDestP;
+ transSurface.moveX();
+ }
+
+ // Move to next line
+ srcPtr = flipFlag ? srcPtr + (src->getPitch() / 2) :
+ srcPtr - (src->getPitch() / 2);
+ destPtr -= destArea.pitch / 2;
+ }
src->unlock();
}
@@ -196,10 +286,40 @@ bool CVideoSurface::hasFrame() {
}
}
-/*------------------------------------------------------------------------*/
+#define RGB_SHIFT 3
+void CVideoSurface::copyPixel(uint16 *destP, const uint16 *srcP, byte alpha,
+ const Graphics::PixelFormat &srcFormat, bool isAlpha) {
+ const Graphics::PixelFormat destFormat = _ddSurface->getFormat();
+ alpha &= 0xff;
+ assert(alpha < 32);
+
+ // Get the source color
+ byte r, g, b;
+ srcFormat.colorToRGB(*srcP, r, g, b);
+ r >>= RGB_SHIFT;
+ g >>= RGB_SHIFT;
+ b >>= RGB_SHIFT;
+
+ if (isAlpha) {
+ r = _palette1[31 - alpha][r];
+ g = _palette1[31 - alpha][g];
+ b = _palette1[31 - alpha][b];
+ }
-byte OSVideoSurface::_palette1[32][32];
-byte OSVideoSurface::_palette2[32][32];
+ byte r2, g2, b2;
+ destFormat.colorToRGB(*destP, r2, g2, b2);
+ r2 >>= RGB_SHIFT;
+ g2 >>= RGB_SHIFT;
+ b2 >>= RGB_SHIFT;
+ r2 = _palette1[alpha][r2];
+ g2 = _palette1[alpha][g2];
+ b2 = _palette1[alpha][b2];
+
+ *destP = destFormat.RGBToColor((r + r2) << RGB_SHIFT,
+ (g + g2) << RGB_SHIFT, (b + b2) << RGB_SHIFT);
+}
+
+/*------------------------------------------------------------------------*/
OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, DirectDrawSurface *surface) :
CVideoSurface(screenManager) {
@@ -210,7 +330,7 @@ OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, const CResourceKey
CVideoSurface(screenManager) {
_ddSurface = nullptr;
_pendingLoad = pendingLoad;
-
+
if (_pendingLoad) {
loadResource(key);
} else {
@@ -219,24 +339,6 @@ OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, const CResourceKey
}
}
-void OSVideoSurface::setupPalette(byte palette[32][32], byte val) {
- for (uint idx1 = 0; idx1 < 32; ++idx1) {
- for (uint idx2 = 0, base = 0; idx2 < 32; ++idx2, base += idx1) {
- int64 v = 0x84210843;
- v *= base;
- uint v2 = (v >> 36);
- v = ((v2 >> 31) + v2) & 0xff;
- palette[idx1][idx2] = v << 3;
-
- if (val != 0xff && v != idx2) {
- v = 0x80808081 * v * val;
- v2 = v >> 39;
- palette[idx1][idx2] = ((v2 >> 31) + v2) << 3;
- }
- }
- }
-}
-
void OSVideoSurface::loadResource(const CResourceKey &key) {
_resourceKey = key;
_pendingLoad = true;
@@ -351,7 +453,7 @@ void OSVideoSurface::recreate(int width, int height) {
}
void OSVideoSurface::resize(int width, int height) {
- if (!_ddSurface || _ddSurface->getWidth() != width ||
+ if (!_ddSurface || _ddSurface->getWidth() != width ||
_ddSurface->getHeight() != height)
recreate(width, height);
}
@@ -365,7 +467,7 @@ int OSVideoSurface::getPixelDepth() {
error("Could not load resource");
lock();
-
+
int result = _rawSurface->format.bytesPerPixel;
if (result == 1)
// Paletted 8-bit images don't store the color directly in the pixels
@@ -408,8 +510,13 @@ uint16 OSVideoSurface::getPixel(const Common::Point &pt) {
if (pt.x >= 0 && pt.y >= 0 && pt.x < getWidth() && pt.y < getHeight()) {
if (_transparencySurface) {
- const byte *pixelP = (const byte *)_transparencySurface->getBasePtr(pt.x, pt.y);
- if (*pixelP != 0xF0)
+ // WORKAROUND: Original had the setRow _flipVertically check in reverse.
+ // Pretty sure putting it the way is below is the correct way
+ CTransparencySurface transSurface(&_transparencySurface->rawSurface(), _transparencyMode);
+ transSurface.setRow(_flipVertically ? getHeight() - pt.y - 1 : pt.y);
+ transSurface.setCol(pt.x);
+
+ if (transSurface.isPixelTransparent())
return getTransparencyColor();
}
@@ -429,29 +536,6 @@ void OSVideoSurface::setPixel(const Point &pt, uint pixel) {
*pixelP = pixel;
}
-void OSVideoSurface::changePixel(uint16 *pixelP, uint16 *color, byte srcVal, bool remapFlag) {
- assert(getPixelDepth() == 2);
- const Graphics::PixelFormat &destFormat = _ddSurface->getFormat();
- const Graphics::PixelFormat srcFormat(2, 5, 5, 5, 0, 10, 5, 0, 0);
-
- // Get the color
- byte r, g, b;
- srcFormat.colorToRGB(*color, r, g, b);
- if (remapFlag) {
- r = _palette1[31 - srcVal][r >> 3];
- g = _palette1[31 - srcVal][g >> 3];
- b = _palette1[31 - srcVal][b >> 3];
- }
-
- byte r2, g2, b2;
- destFormat.colorToRGB(*pixelP, r2, g2, b2);
- r2 = _palette1[srcVal][r2 >> 3];
- g2 = _palette1[srcVal][g2 >> 3];
- b2 = _palette1[srcVal][b2 >> 3];
-
- *pixelP = destFormat.RGBToColor(r + r2, g + g2, b + b2);
-}
-
void OSVideoSurface::shiftColors() {
if (!loadIfReady())
return;
@@ -510,7 +594,7 @@ const CMovieRangeInfoList *OSVideoSurface::getMovieRangeInfo() const {
}
void OSVideoSurface::flipVertically(bool needsLock) {
- if (!loadIfReady() || !_transBlitFlag)
+ if (!loadIfReady() || !_flipVertically)
return;
if (needsLock)
@@ -529,7 +613,7 @@ void OSVideoSurface::flipVertically(bool needsLock) {
Common::copy(lineBuffer, lineBuffer + pitch, line1P);
}
- _transBlitFlag = false;
+ _flipVertically = false;
if (needsLock)
unlock();
}
@@ -576,8 +660,8 @@ void OSVideoSurface::transPixelate() {
unlock();
}
-Graphics::ManagedSurface *OSVideoSurface::dupMovieFrame() const {
- return _movie ? _movie->duplicateFrame() : nullptr;
+Graphics::ManagedSurface *OSVideoSurface::dupMovieTransparency() const {
+ return _movie ? _movie->duplicateTransparency() : nullptr;
}
int OSVideoSurface::freeSurface() {
diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h
index c21149333d..690669b79b 100644
--- a/engines/titanic/support/video_surface.h
+++ b/engines/titanic/support/video_surface.h
@@ -31,16 +31,12 @@
#include "titanic/support/movie.h"
#include "titanic/support/movie_range_info.h"
#include "titanic/support/rect.h"
+#include "titanic/support/transparency_surface.h"
#include "titanic/core/list.h"
#include "titanic/core/resource_key.h"
namespace Titanic {
-enum TransparencyMode {
- TRANS_MASK0 = 0, TRANS_MASK255 = 1, TRANS_ALPHA0 = 2,
- TRANS_ALPHA255 = 3, TRANS_DEFAULT = 4
-};
-
class CScreenManager;
class CJPEGDecode;
class CTargaDecode;
@@ -49,15 +45,38 @@ class CVideoSurface : public ListItem {
friend class CJPEGDecode;
friend class CTargaDecode;
private:
+ static byte _palette1[32][32];
+ static byte _palette2[32][32];
+
+ /**
+ * Setup the shading palettes
+ */
+ static void setupPalette(byte palette[32][32], byte val);
+public:
+ /**
+ * Setup statics
+ */
+ static void setup() {
+ setupPalette(_palette1, 0xff);
+ }
+private:
/**
* Calculates blitting bounds
*/
void clipBounds(Rect &srcRect, Rect &destRect, CVideoSurface *srcSurface,
const Rect *subRect = nullptr, const Point *destPos = nullptr);
- void blitRect1(const Rect &srcRect, const Rect &destRect, CVideoSurface *src);
- void blitRect2(const Rect &srcRect, const Rect &destRect, CVideoSurface *src);
- void transBlitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src);
+ /**
+ * Copies a rect from a given source surface
+ */
+ void blitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src);
+
+ /**
+ * Copies a rect from a given source surface and draws it vertically flipped
+ */
+ void flippedBlitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src);
+
+ void transBlitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src, bool flipFlag);
protected:
static int _videoSurfaceCounter;
protected:
@@ -73,7 +92,7 @@ public:
CMovie *_movie;
DirectDrawSurface *_ddSurface;
bool _fastBlitFlag;
- bool _transBlitFlag;
+ bool _flipVertically;
CResourceKey _resourceKey;
TransparencyMode _transparencyMode;
public:
@@ -186,11 +205,6 @@ public:
virtual void setPixel(const Point &pt, uint pixel) = 0;
/**
- * Change a pixel
- */
- virtual void changePixel(uint16 *pixelP, uint16 *color, byte srcVal, bool remapFlag = true) = 0;
-
- /**
* Shifts the colors of the surface.. maybe greys it out?
*/
virtual void shiftColors() = 0;
@@ -270,9 +284,9 @@ public:
virtual bool hasFrame();
/**
- * Duplicates movie frame surface
+ * Duplicates movie transparency surface
*/
- virtual Graphics::ManagedSurface *dupMovieFrame() const = 0;
+ virtual Graphics::ManagedSurface *dupMovieTransparency() const = 0;
/**
* Frees the underlying surface
@@ -302,7 +316,9 @@ public:
/**
* Get the previously set transparency mask surface
*/
- Graphics::ManagedSurface *getTransparencySurface() const { return _transparencySurface; }
+ const Graphics::Surface *getTransparencySurface() const {
+ return _transparencySurface ? &_transparencySurface->rawSurface() : nullptr;
+ }
/**
* Get the pixels associated with the surface. Only valid when the
@@ -320,26 +336,23 @@ public:
* Returns the transparent color
*/
uint getTransparencyColor();
+
+ /**
+ * Copies a pixel, handling transparency
+ * @param destP Dest pointer to 16-bit pixel
+ * @param srcP Source pointer to 16-bit pixel
+ * @param alpha Alpha (0-31). At 0, it's completely opaque,
+ * and overwrites the dest pixel. Through to 31, which is completely
+ * transparent, and ignores the source pixel.
+ * @param srcFormat The source surface format
+ * @param isAlpha If true, has alpha channel
+ */
+ void copyPixel(uint16 *destP, const uint16 *srcP, byte alpha,
+ const Graphics::PixelFormat &srcFormat, bool isAlpha);
};
class OSVideoSurface : public CVideoSurface {
friend class OSMovie;
-private:
- static byte _palette1[32][32];
- static byte _palette2[32][32];
-
- /**
- * Setup the shading palettes
- */
- static void setupPalette(byte palette[32][32], byte val);
-public:
- /**
- * Setup statics
- */
- static void setup() {
- setupPalette(_palette1, 0xff);
- setupPalette(_palette2, 0xe0);
- }
public:
OSVideoSurface(CScreenManager *screenManager, DirectDrawSurface *surface);
OSVideoSurface(CScreenManager *screenManager, const CResourceKey &key, bool flag = false);
@@ -437,11 +450,6 @@ public:
virtual void setPixel(const Point &pt, uint pixel);
/**
- * Change a pixel
- */
- virtual void changePixel(uint16 *pixelP, uint16 *color, byte srcVal, bool remapFlag = true);
-
- /**
* Shifts the colors of the surface.. maybe greys it out?
*/
virtual void shiftColors();
@@ -516,10 +524,9 @@ public:
virtual void transPixelate();
/**
- * Duplicates movie frame surface
+ * Duplicates movie transparency surface
*/
- virtual Graphics::ManagedSurface *dupMovieFrame() const;
-
+ virtual Graphics::ManagedSurface *dupMovieTransparency() const;
/**
* Frees the underlying surface
diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp
index 375908a814..2566a36d7c 100644
--- a/engines/titanic/titanic.cpp
+++ b/engines/titanic/titanic.cpp
@@ -100,8 +100,8 @@ void TitanicEngine::initialize() {
CExitPellerator::init();
CEnterExitSecClassMiniLift::init();
CTelevision::init();
+ CVideoSurface::setup();
TTnpcScript::init();
- OSVideoSurface::setup();
_events = new Events(this);
_screen = new Graphics::Screen(0, 0);
diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp
index b327c3647e..76f28540ea 100644
--- a/engines/titanic/true_talk/barbot_script.cpp
+++ b/engines/titanic/true_talk/barbot_script.cpp
@@ -107,7 +107,7 @@ int BarbotScript::chooseResponse(const TTroomScript *roomScript, const TTsentenc
applyResponse();
return 2;
-
+
} else if (tag == MKTAG('B', 'A', 'R', 'U') && getRandomNumber(100) > 50) {
selectResponse(250025);
switch (getDialsBitset()) {
@@ -120,7 +120,7 @@ int BarbotScript::chooseResponse(const TTroomScript *roomScript, const TTsentenc
}
applyResponse();
- return 2;
+ return 2;
}
if (tag == MKTAG('T', 'H', 'R', 'T') || tag == MKTAG('S', 'L', 'O', 'W') ||
@@ -165,7 +165,7 @@ int BarbotScript::process(const TTroomScript *roomScript, const TTsentence *sent
dialogueId = ARRAY2[_arrIndex++];
} else if (getRandomNumber(100) > 35) {
dialogueId = ARRAY2[0];
- _arrIndex = 1;
+ _arrIndex = 1;
} else if (getRandomNumber(100) > 60) {
switch (sentence->_field2C) {
case 2:
@@ -204,7 +204,7 @@ int BarbotScript::process(const TTroomScript *roomScript, const TTsentence *sent
CTrueTalkManager::setFlags(32, getValue(32) - 1);
CTrueTalkManager::setFlags(33, getValue(33) - 1);
CTrueTalkManager::setFlags(34, getValue(34) - 1);
-
+
TTtreeResult treeResult;
int val34 = getState();
setState(0);
@@ -314,7 +314,7 @@ int BarbotScript::process(const TTroomScript *roomScript, const TTsentence *sent
return applySentenceIds(50382);
} else if (flag2) {
return applySentenceIds(51423);
- }
+ }
// Deliberate fall-through
case 16:
@@ -523,7 +523,7 @@ int BarbotScript::process(const TTroomScript *roomScript, const TTsentence *sent
CTrueTalkManager::triggerAction(30, 0);
return 2;
}
-
+
return applySentenceIds(50320);
case 58:
if (val2C == 6 || val2C == 10)
@@ -935,7 +935,7 @@ int BarbotScript::handleQuote(const TTroomScript *roomScript, const TTsentence *
break;
case MKTAG('P', 'H', 'I', 'L'):
case MKTAG('R', 'C', 'K', 'T'):
- case MKTAG('S', 'C', 'I', 'E'):
+ case MKTAG('S', 'C', 'I', 'E'):
tagId = MKTAG('S', 'C', 'I', 'E');
break;
case MKTAG('T', 'R', 'A', '2'):
@@ -1011,7 +1011,7 @@ uint BarbotScript::getDialsBitset() const {
bits |= 2;
if (!getDialRegion(2))
bits |= 4;
-
+
return bits;
}
@@ -1098,7 +1098,7 @@ int BarbotScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScrip
}
break;
}
-
+
case 10: {
uint val = CTrueTalkManager::getStateValue(3);
bool bit0 = (val & 1) != 0;
diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h
index 1820d77216..a8c92b2927 100644
--- a/engines/titanic/true_talk/barbot_script.h
+++ b/engines/titanic/true_talk/barbot_script.h
@@ -74,7 +74,7 @@ public:
virtual int handleQuote(const TTroomScript *roomScript, const TTsentence *sentence,
uint val, uint tagId, uint remainder);
-
+
/**
* Handles updating NPC state based on specified dialogue Ids and dial positions
*/
diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp
index b773e8af30..038285ec8d 100644
--- a/engines/titanic/true_talk/bellbot_script.cpp
+++ b/engines/titanic/true_talk/bellbot_script.cpp
@@ -245,7 +245,7 @@ int BellbotScript::process(const TTroomScript *roomScript, const TTsentence *sen
&& sentence->localWord("we") && sentence->localWord("in"))
|| (sentence->_field2C == 3 && sentence->localWord("rom")
&& sentence->localWord("is") && sentence->localWord("this"))
- ) {
+ ) {
uint id = getRangeValue(getRoomDialogueId(roomScript));
addResponse(getDialogueId(id ? id : 201384));
applyResponse();
@@ -258,7 +258,7 @@ int BellbotScript::process(const TTroomScript *roomScript, const TTsentence *sen
result = processEntries(&_sentences[2], 0, roomScript, sentence);
} else if (getValue(1) == 1) {
result = processEntries(&_sentences[3], 0, roomScript, sentence);
-
+
if (sentence->contains("shrinkbot")) {
addResponse(getDialogueId(200583));
applyResponse();
@@ -521,7 +521,7 @@ int BellbotScript::handleQuote(const TTroomScript *roomScript, const TTsentence
default:
break;
}
-
+
return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder);
}
@@ -835,7 +835,7 @@ int BellbotScript::preprocess(const TTroomScript *roomScript, const TTsentence *
applyFlag = true;
}
break;
-
+
case 5:
if (sentence->_field2C == 11 || sentence->_field2C == 13) {
addResponse(getDialogueId(200492));
@@ -1497,7 +1497,7 @@ stateFlag = false;
case 84:
if (sentence->_field2C == 12) {
addResponse(getDialogueId(202119));
-
+
switch (getValue(1)) {
case 1:
addResponse(getDialogueId(202024));
@@ -1631,7 +1631,7 @@ bool BellbotScript::randomResponse1(const TTroomScript *roomScript, uint id) {
randomResponse3(roomScript, id);
applyResponse();
}
-
+
return false;
}
@@ -1729,7 +1729,7 @@ bool BellbotScript::checkCommonWords(const TTroomScript *roomScript, const TTsen
addResponse(getDialogueId(200847));
} else if (sentence->localWord("canal")) {
addResponse(getDialogueId(getValue(1) == 1 ? 200846 : 200847));
- } else if (sentence->localWord("firstclass") &&
+ } else if (sentence->localWord("firstclass") &&
(sentence->localWord("stateroom") || sentence->localWord("room"))) {
addResponse(getDialogueId(getValue(1) == 1 ? 200840 : 200306));
} else if (sentence->localWord("secondclass") && sentence->localWord("stateroom") && sentence->localWord("room")) {
@@ -1790,12 +1790,12 @@ bool BellbotScript::checkCommonWords(const TTroomScript *roomScript, const TTsen
} else {
addResponse(getDialogueId(200686));
}
- } else if (sentence->localWord("embarklobby")
+ } else if (sentence->localWord("embarklobby")
|| sentence->localWord("lobby")) {
addResponse(getDialogueId(200850));
} else if (sentence->localWord("pellerator")) {
addResponse(getDialogueId(200862));
- } else if (sentence->localWord("servicelift")
+ } else if (sentence->localWord("servicelift")
|| (sentence->localWord("service") && sentence->localWord("elevator"))) {
addResponse(getDialogueId(200855));
} else if (sentence->localWord("elevator")) {
diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h
index 6f57ee718f..7edb182301 100644
--- a/engines/titanic/true_talk/bellbot_script.h
+++ b/engines/titanic/true_talk/bellbot_script.h
@@ -78,7 +78,7 @@ private:
bool checkCommonWords(const TTroomScript *roomScript, const TTsentence *sentence);
uint getRoomDialogueId(const TTroomScript *roomScript);
-
+
/**
* Adds a description of the room to the conversation response
*/
diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp
index f3a997e218..4df47e0af1 100644
--- a/engines/titanic/true_talk/deskbot_script.cpp
+++ b/engines/titanic/true_talk/deskbot_script.cpp
@@ -276,7 +276,7 @@ int DeskbotScript::handleQuote(const TTroomScript *roomScript, const TTsentence
default:
break;
}
-
+
return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder);
}
@@ -324,7 +324,7 @@ int DeskbotScript::updateState(uint oldId, uint newId, int index) {
newId = getStateDialogueId();
if (newId == 240464 && getValue(1) != 1)
newId = 240462;
-
+
if (newId == 241635 && isDial1Medium()) {
addResponse(getDialogueId(241556));
newId = getRangeValue(241632);
@@ -408,7 +408,7 @@ int DeskbotScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScri
default:
break;
}
-
+
return 0;
}
@@ -480,7 +480,7 @@ uint DeskbotScript::addAssignedRoomDialogue2() {
void DeskbotScript::addAssignedRoomDialogue3() {
addResponse(getDialogueId(241513));
addResponse(getDialogueId(241510));
-
+
CTrueTalkManager::setFlags(1, 2);
setDialRegion(0, 0);
setDialRegion(1, 0);
@@ -618,7 +618,7 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence *
if (isDial1Low() && getValue(1) == 4) {
if (sentence->_field2C == 12 || sentence->_field2C == 13
|| sentence->contains("do not")) {
-
+
addResponse(getDialogueId(240447));
setDialRegion(0, 0);
setDialRegion(1, 0);
@@ -1148,7 +1148,7 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence *
addResponse(getDialogueId(241267));
break;
}
-
+
add241716();
applyFlag = true;
stateFlag = false;
@@ -1223,7 +1223,7 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence *
addResponse(getDialogueId(241711));
}
-
+
applyFlag = true;
stateFlag = false;
break;
@@ -1244,7 +1244,7 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence *
}
}
-
+
applyFlag = true;
stateFlag = false;
break;
@@ -1254,7 +1254,7 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence *
|| sentence->contains("balcony") || sentence->contains("neither")
|| sentence->contains("the 1") || sentence->contains("the 2")
|| sentence->contains("former") || sentence->contains("latter")
- || sentence->contains("either")) {
+ || sentence->contains("either")) {
addResponse(getDialogueId(241700));
addResponse(getDialogueId(241687));
} else {
@@ -1299,7 +1299,7 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence *
|| sentence->contains("princess") || sentence->contains("small")
|| sentence->contains("the 1") || sentence->contains("the 2")
|| sentence->contains("the 3") || sentence->contains("the 4")
- || sentence->contains("big") || sentence->contains("large")) {
+ || sentence->contains("big") || sentence->contains("large")) {
addResponse(getDialogueId(241700));
addResponse(getDialogueId(241739));
} else {
@@ -1317,7 +1317,7 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence *
if (sentence->contains("constitutional") || sentence->contains("const")
|| sentence->contains("absolute") || sentence->contains("small")
|| sentence->contains("the 1") || sentence->contains("the 2")
- || sentence->contains("big") || sentence->contains("large")) {
+ || sentence->contains("big") || sentence->contains("large")) {
addResponse(getDialogueId(241700));
addResponse(getDialogueId(241739));
} else {
@@ -1334,7 +1334,7 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence *
case 91:
if (sentence->contains("benev") || sentence->contains("dict")
|| sentence->contains("small") || sentence->contains("the 1")
- || sentence->contains("the 2") || sentence->contains("big")
+ || sentence->contains("the 2") || sentence->contains("big")
|| sentence->contains("large") || sentence->contains("former")
|| sentence->contains("latter")) {
addResponse(getDialogueId(241700));
@@ -1384,7 +1384,7 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence *
|| sentence->contains("suite") || sentence->contains("next door")
|| sentence->contains("the 1") || sentence->contains("the 2")
|| sentence->contains("former") || sentence->contains("latter")
- || sentence->contains("same room")) {
+ || sentence->contains("same room")) {
addAssignedRoom();
setState(0);
CTrueTalkManager::setFlags(17, 0);
@@ -1424,7 +1424,7 @@ int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence *
stateFlag = false;
}
break;
-
+
default:
break;
}
diff --git a/engines/titanic/true_talk/dialogue_file.cpp b/engines/titanic/true_talk/dialogue_file.cpp
index cbd3685315..e5438c5825 100644
--- a/engines/titanic/true_talk/dialogue_file.cpp
+++ b/engines/titanic/true_talk/dialogue_file.cpp
@@ -34,7 +34,7 @@ void DialogueIndexEntry::load(Common::SeekableReadStream &s) {
CDialogueFile::CDialogueFile(const CString &filename, uint count) {
if (!_file.open(filename))
error("Could not locate dialogue file - %s", filename.c_str());
-
+
_cache.resize(count);
_file.readUint32LE(); // Skip over file Id
diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp
index 1ca1ab13e5..5c7403f187 100644
--- a/engines/titanic/true_talk/doorbot_script.cpp
+++ b/engines/titanic/true_talk/doorbot_script.cpp
@@ -70,7 +70,7 @@ void DoorbotScript::setupSentences() {
_mappings.load("Mappings/Doorbot", 4);
_entries.load("Sentences/Doorbot");
-
+
static const int SENTENCE_NUMS[11] = {
2, 100, 101, 102, 107, 110, 111, 124, 129, 131, 132
};
@@ -364,7 +364,7 @@ int DoorbotScript::process(const TTroomScript *roomScript, const TTsentence *sen
case 32:
return setResponse(10110, 0);
-
+
case 33:
if (sentence->contains("sieve") || sentence->contains("colander")
|| sentence->contains("vegetable") || sentence->contains("ground")
@@ -497,7 +497,7 @@ int DoorbotScript::process(const TTroomScript *roomScript, const TTsentence *sen
return setResponse(getDialogueId(220000));
break;
}
-
+
return 2;
}
@@ -672,7 +672,7 @@ int DoorbotScript::updateState(uint oldId, uint newId, int index) {
bool flag39 = getValue(39) != 0;
CTrueTalkManager::setFlags(38, 0);
CTrueTalkManager::setFlags(39, 0);
-
+
if (newId > 220890) {
switch (newId) {
case 221064:
@@ -897,7 +897,7 @@ int DoorbotScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScri
case 29:
if (sentence->localWord("another") || sentence->localWord("more") ||
sentence->localWord("additional") || sentence->contains("another") ||
- sentence->contains("more") || sentence->contains("additional")) {
+ sentence->contains("more") || sentence->contains("additional")) {
addResponse(getDialogueId(220058));
applyResponse();
return 2;
diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp
index e0636d045f..e902169ed0 100644
--- a/engines/titanic/true_talk/maitred_script.cpp
+++ b/engines/titanic/true_talk/maitred_script.cpp
@@ -106,7 +106,7 @@ int MaitreDScript::process(const TTroomScript *roomScript, const TTsentence *sen
applyResponse();
}
- return 2;
+ return 2;
}
if (++_answerCtr > 50 || sentence->localWord("stop") || sentence->localWord("enough")
diff --git a/engines/titanic/true_talk/parrot_script.h b/engines/titanic/true_talk/parrot_script.h
index ec7bec7629..530eed09fd 100644
--- a/engines/titanic/true_talk/parrot_script.h
+++ b/engines/titanic/true_talk/parrot_script.h
@@ -32,7 +32,7 @@ private:
/**
* Setup sentence data
*/
- void setupSentences();
+ void setupSentences();
public:
ParrotScript(int val1, const char *charClass, int v2,
const char *charName, int v3, int val2, int v4, int v5, int v6, int v7);
diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp
index 2741e6b640..802e2b4ba6 100644
--- a/engines/titanic/true_talk/script_handler.cpp
+++ b/engines/titanic/true_talk/script_handler.cpp
@@ -78,7 +78,7 @@ int CScriptHandler::processInput(TTroomScript *roomScript, TTnpcScript *npcScrip
const TTstring &line) {
if (!roomScript || !line.isValid())
return SS_5;
-
+
TTsentence *sentence = new TTsentence(_inputCtr++, line, this, roomScript, npcScript);
int result = _parser.preprocess(sentence);
roomScript->scriptPreprocess(sentence);
diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h
index 01aa2ef1c5..e28eeed1ac 100644
--- a/engines/titanic/true_talk/script_handler.h
+++ b/engines/titanic/true_talk/script_handler.h
@@ -58,7 +58,7 @@ public:
/**
* Set the character and room
*/
- ScriptChangedResult scriptChanged(TTroomScript *roomScript,
+ ScriptChangedResult scriptChanged(TTroomScript *roomScript,
TTnpcScript *npcScript, uint dialogueId);
int processInput(TTroomScript *roomScript, TTnpcScript *npcScript,
diff --git a/engines/titanic/true_talk/script_support.cpp b/engines/titanic/true_talk/script_support.cpp
index c24e275827..14560e2d9f 100644
--- a/engines/titanic/true_talk/script_support.cpp
+++ b/engines/titanic/true_talk/script_support.cpp
@@ -36,7 +36,7 @@ int TTnpcScriptResponse::size() const {
/*------------------------------------------------------------------------*/
-TTscriptRange::TTscriptRange(uint id, const Common::Array<uint> &values,
+TTscriptRange::TTscriptRange(uint id, const Common::Array<uint> &values,
bool isRandom, bool isSequential) :
_id(id), _nextP(nullptr) {
_mode = SF_NONE;
diff --git a/engines/titanic/true_talk/script_support.h b/engines/titanic/true_talk/script_support.h
index a41673bd5c..bdaec6e7c9 100644
--- a/engines/titanic/true_talk/script_support.h
+++ b/engines/titanic/true_talk/script_support.h
@@ -55,7 +55,7 @@ struct TTscriptRange {
TTscriptRange() : _id(0), _nextP(nullptr),
_priorIndex(0), _mode(SF_NONE) {}
- TTscriptRange(uint id, const Common::Array<uint> &values, bool isRandom,
+ TTscriptRange(uint id, const Common::Array<uint> &values, bool isRandom,
bool isSequential);
};
diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h
index d5cea7e66f..782e3eeb04 100644
--- a/engines/titanic/true_talk/succubus_script.h
+++ b/engines/titanic/true_talk/succubus_script.h
@@ -34,7 +34,7 @@ private:
/**
* Setup sentence data
*/
- void setupSentences();
+ void setupSentences();
/**
* Add a response and optionally set the state
diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp
index be9ca667de..ed45ab26a0 100644
--- a/engines/titanic/true_talk/true_talk_manager.cpp
+++ b/engines/titanic/true_talk/true_talk_manager.cpp
@@ -45,7 +45,7 @@ CTrueTalkNPC *CTrueTalkManager::_currentNPC;
/*------------------------------------------------------------------------*/
-CTrueTalkManager::CTrueTalkManager(CGameManager *owner) :
+CTrueTalkManager::CTrueTalkManager(CGameManager *owner) :
_gameManager(owner), _scripts(&_titleEngine), _currentCharId(0),
_dialogueFile(nullptr), _dialogueId(0) {
_titleEngine.setup(3, 3);
@@ -209,7 +209,7 @@ void CTrueTalkManager::preLoad() {
void CTrueTalkManager::removeCompleted() {
for (TTtalkerList::iterator i = _talkers.begin(); i != _talkers.end(); ) {
TTtalker *talker = *i;
-
+
if (talker->_done) {
i = _talkers.erase(i);
delete talker;
@@ -222,7 +222,7 @@ void CTrueTalkManager::removeCompleted() {
void CTrueTalkManager::start(CTrueTalkNPC *npc, uint id, CViewItem *view) {
TTnpcScript *npcScript = getNpcScript(npc);
TTroomScript *roomScript = getRoomScript();
-
+
_titleEngine.reset();
uint charId = npcScript->charId();
loadAssets(npc, charId);
@@ -337,7 +337,7 @@ void CTrueTalkManager::processInput(CTrueTalkNPC *npc, CTextInputMsg *msg, CView
loadAssets(npc, npcScript->charId());
setDialogue(npc, roomScript, view);
}
-
+
_currentNPC = nullptr;
}
@@ -376,7 +376,7 @@ CString CTrueTalkManager::readDialogueString() {
size_t entrySize = textRes->size();
byte *tempBuffer = (entrySize < STRING_BUFFER_SIZE) ? buffer :
new byte[entrySize + 1];
-
+
_dialogueFile->read(textRes, tempBuffer, entrySize);
buffer[entrySize] = '\0';
@@ -406,7 +406,7 @@ uint CTrueTalkManager::readDialogueSpeech() {
for (uint idx = 0; idx < _titleEngine._indexes.size(); ++idx) {
CWaveFile *waveFile = _gameManager->_sound.getTrueTalkSound(
_dialogueFile, _titleEngine._indexes[idx] - _dialogueId);
- if (waveFile) {
+ if (waveFile) {
_speechDuration += waveFile->getDuration();
}
}
diff --git a/engines/titanic/true_talk/tt_action.h b/engines/titanic/true_talk/tt_action.h
index 29e2bc4e4a..c6f49af16d 100644
--- a/engines/titanic/true_talk/tt_action.h
+++ b/engines/titanic/true_talk/tt_action.h
@@ -29,7 +29,7 @@ namespace Titanic {
class TTaction : public TTmajorWord {
private:
- static bool _staticFlag;
+ static bool _staticFlag;
protected:
int _field30;
public:
diff --git a/engines/titanic/true_talk/tt_concept.cpp b/engines/titanic/true_talk/tt_concept.cpp
index c614e14dae..3c52c9f13b 100644
--- a/engines/titanic/true_talk/tt_concept.cpp
+++ b/engines/titanic/true_talk/tt_concept.cpp
@@ -27,7 +27,7 @@
namespace Titanic {
-TTconcept::TTconcept() : _string1(" "), _string2(" "),
+TTconcept::TTconcept() : _string1(" "), _string2(" "),
_scriptP(nullptr), _wordP(nullptr) {
if (setStatus())
setScriptType(ST_UNKNOWN_SCRIPT);
@@ -51,7 +51,7 @@ TTconcept::TTconcept(TTscriptBase *script, ScriptType scriptType) :
TTconcept::TTconcept(TTword *word, ScriptType scriptType) :
_string1(" "), _string2(" "), _wordP(nullptr), _scriptP(nullptr) {
-
+
if (!word || !setStatus() || word->getStatus()) {
_status = SS_5;
} else {
@@ -74,7 +74,7 @@ TTconcept::TTconcept(TTconcept &src) :
if (setStatus()) {
_status = SS_VALID;
_scriptP = src._scriptP;
-
+
if (src._wordP) {
_status = initializeWordRef(src._wordP);
initialize(src);
@@ -177,7 +177,7 @@ void TTconcept::initialize(TTconcept &src) {
_field30 = src._field30;
_field34 = src._field34;
-
+
if (src._flag) {
g_vm->_exeResources._owner->setParserConcept(this, &src);
src.setFlag(true);
@@ -225,7 +225,7 @@ int TTconcept::setOwner(TTconcept *src) {
int TTconcept::setOwner(TTword *src, bool dontDup) {
TTword *word = dontDup ? src : src->copy();
-
+
if (word) {
if (!_word2P) {
_word2P = word;
diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h
index 88afb6f28b..430b3b6a8c 100644
--- a/engines/titanic/true_talk/tt_concept.h
+++ b/engines/titanic/true_talk/tt_concept.h
@@ -125,8 +125,8 @@ public:
/**
* Returns true if the word is of the specified class
*/
- bool isWordClass(WordClass wordClass) const {
- return _wordP && _wordP->isClass(wordClass);
+ bool isWordClass(WordClass wordClass) const {
+ return _wordP && _wordP->isClass(wordClass);
}
void setFlag(bool val) { _flag = val; }
diff --git a/engines/titanic/true_talk/tt_node.cpp b/engines/titanic/true_talk/tt_node.cpp
index cbbb1dd756..fece3b8889 100644
--- a/engines/titanic/true_talk/tt_node.cpp
+++ b/engines/titanic/true_talk/tt_node.cpp
@@ -78,7 +78,7 @@ TTnode *TTnode::getHead() {
TTnode *TTnode::getTail() {
if (_nextP == nullptr)
return this;
-
+
TTnode *node = _nextP;
while (node->_nextP)
node = node->_nextP;
diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h
index b9afdfad8a..bdca568b09 100644
--- a/engines/titanic/true_talk/tt_npc_script.h
+++ b/engines/titanic/true_talk/tt_npc_script.h
@@ -259,7 +259,7 @@ public:
* and adds it to the response
*/
virtual void selectResponse(int id);
-
+
/**
* Handles scanning the word list for a given Id, and if
* found adds it to the sentence concept list
@@ -275,7 +275,7 @@ public:
* either a random value, or each value in turn
*/
virtual uint getRangeValue(uint id);
-
+
/**
* Resets the prior used index for the specified range
*/
@@ -295,7 +295,7 @@ public:
* Returns a bitset of the dials being off or not
*/
virtual uint getDialsBitset() const { return 0; }
-
+
virtual const TTscriptMapping *getMapping(int index);
virtual int doSentenceEntry(int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence);
@@ -303,7 +303,7 @@ public:
* Handles any post-response NPC processing
*/
virtual void postResponse(int v1, const TTsentenceEntry *entry, const TTroomScript *roomScript, const TTsentence *sentence) {}
-
+
virtual void save(SimpleFile *file);
virtual void load(SimpleFile *file);
virtual void saveBody(SimpleFile *file);
@@ -337,7 +337,7 @@ public:
* Handles a randomzied response
*/
virtual bool randomResponse(uint index);
-
+
virtual uint translateId(uint id) const;
void preLoad();
diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp
index 95a302d53c..d67f5235c4 100644
--- a/engines/titanic/true_talk/tt_parser.cpp
+++ b/engines/titanic/true_talk/tt_parser.cpp
@@ -147,16 +147,16 @@ int TTparser::normalize(TTsentence *sentence) {
case '!':
sentence->set38(3);
break;
-
+
case '\'':
if (!normalizeContraction(srcLine, index, *destLine))
flag = true;
break;
-
+
case '.':
sentence->set38(1);
break;
-
+
case ':':
commandVal = isEmoticon(srcLine, index);
if (commandVal) {
@@ -166,7 +166,7 @@ int TTparser::normalize(TTsentence *sentence) {
flag = true;
}
break;
-
+
case ';':
commandVal = isEmoticon(srcLine, index);
if (commandVal == 6) {
@@ -177,7 +177,7 @@ int TTparser::normalize(TTsentence *sentence) {
index += 2;
}
break;
-
+
case '<':
++index;
commandVal = isEmoticon(srcLine, index);
@@ -315,7 +315,7 @@ bool TTparser::normalizeContraction(const TTstring &srcLine, int srcIndex, TTstr
destLine.deleteLastChar();
destLine.deleteLastChar();
destLine += "m";
- } else if (srcLine.hasSuffix(" sha") ||
+ } else if (srcLine.hasSuffix(" sha") ||
(srcIndex == 4 && srcLine.hasSuffix("sha"))) {
// shan't -> shall not
destLine.deleteLastChar();
@@ -726,7 +726,7 @@ int TTparser::loadRequests(TTword *word) {
int TTparser::considerRequests(TTword *word) {
if (!_nodesP || !word)
return 0;
-
+
TTconcept *concept = nullptr;
int status = 0;
bool flag = false;
@@ -802,7 +802,7 @@ int TTparser::considerRequests(TTword *word) {
} else {
status = _sentenceConcept->createConcept(0, 2, word);
}
-
+
if (!status && !_sentenceConcept->_concept4P && _sentenceConcept->_concept0P) {
TTconcept *oldConcept = _sentenceConcept->_concept2P;
flag = filterConcepts(5, 2);
@@ -814,14 +814,14 @@ int TTparser::considerRequests(TTword *word) {
}
}
break;
-
+
case SEEK_OBJECT_OVERRIDE:
if ((word->_wordClass == WC_THING || word->_wordClass == WC_PRONOUN) &&
_sentence->fn2(2, TTstring("thePlayer"), _sentenceConcept) &&
!_sentenceConcept->_concept3P) {
_sentenceConcept->_concept3P = _sentenceConcept->_concept2P;
_sentenceConcept->_concept2P = nullptr;
-
+
flag = filterConcepts(5, 2);
if (!flag) {
status = _sentenceConcept->createConcept(0, 2, word);
@@ -893,7 +893,7 @@ int TTparser::considerRequests(TTword *word) {
if (word->_id == 601) {
if (_conceptP->findByWordClass(WC_THING))
status = _conceptP->setOwner(word, false);
-
+
flag = true;
}
break;
@@ -992,11 +992,11 @@ int TTparser::considerRequests(TTword *word) {
oldNode->_field1C = 2;
_sentenceConcept = oldNode->addSibling();
concept = nullptr;
-
+
_sentenceConcept->_concept1P = oldNode->_concept1P;
_sentenceConcept->_concept5P = oldNode->_concept5P;
_sentenceConcept->_concept2P = oldNode->_concept2P;
-
+
if (seekVal) {
seekVal = 0;
@@ -1107,7 +1107,7 @@ int TTparser::considerRequests(TTword *word) {
if (!_sentenceConcept->_concept0P) {
newPictP = new TTpicture(TTstring("?"), WC_THING, 0, 0, 0, 0, 0);
newConceptP = new TTconcept(newPictP);
-
+
_sentenceConcept->_concept0P = newConceptP;
delete newPictP;
addNode(4);
@@ -1195,7 +1195,7 @@ int TTparser::considerRequests(TTword *word) {
case MKTAG('H', 'E', 'L', 'P'):
if (_sentence->_field2C == 1)
_sentence->_field2C = 18;
-
+
flag = true;
break;
@@ -1273,7 +1273,7 @@ int TTparser::considerRequests(TTword *word) {
break;
}
- TTparserNode *nextP = dynamic_cast<TTparserNode *>(nodeP->_nextP);
+ TTparserNode *nextP = dynamic_cast<TTparserNode *>(nodeP->_nextP);
if (flag)
delete nodeP;
nodeP = nextP;
@@ -1288,7 +1288,7 @@ int TTparser::processRequests(TTword *word) {
switch (status) {
case 0:
status = considerRequests(word);
-
+
// Iterate through the words
while (_currentWordP) {
considerRequests(_currentWordP);
@@ -1388,7 +1388,7 @@ int TTparser::checkForAction() {
if (_conceptP && _currentWordP) {
// Firstly we need to get the next word to process, and remove it from
// the list pointed to by _currentWordP
- TTword *word = _currentWordP;
+ TTword *word = _currentWordP;
if (word->_nextP) {
// Chain of words, so we need to find the last word of the chain,
// and set the last-but-one's _nextP to nullptr to detach the last one
@@ -1410,7 +1410,7 @@ int TTparser::checkForAction() {
word->_text == "done") {
TTstring doStr("do");
TTaction *action = new TTaction(doStr, WC_ACTION, 112, 0, _sentenceConcept->get18());
-
+
if (!action->isValid()) {
status = SS_4;
} else {
diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h
index 201de7eb0e..5fd997a985 100644
--- a/engines/titanic/true_talk/tt_parser.h
+++ b/engines/titanic/true_talk/tt_parser.h
@@ -90,7 +90,7 @@ private:
* spaces and lowercasing everything
*/
int normalize(TTsentence *sentence);
-
+
/**
* Submethod called by normalize to handle expanding contacted word pairs
* like can't, should've, and so on.
@@ -118,7 +118,7 @@ private:
* @param startIndex Starting index in the start to check
* @param strings List of strings to check for. Strings come in pairs, with the
* first being the string to match, and the second the replacement
- * @returns Index of the start of the following word
+ * @returns Index of the start of the following word
*/
static int searchAndReplace(TTstring &line, int startIndex, const StringArray &strings);
diff --git a/engines/titanic/true_talk/tt_picture.h b/engines/titanic/true_talk/tt_picture.h
index 18cb88278f..988f2a7437 100644
--- a/engines/titanic/true_talk/tt_picture.h
+++ b/engines/titanic/true_talk/tt_picture.h
@@ -53,7 +53,7 @@ public:
* Checks whether the word's tag is a known type
*/
virtual bool checkTag() const;
-
+
/**
* Compare the word's tag to a given tag value
*/
@@ -63,7 +63,7 @@ public:
* Return the tag associated with the word
*/
virtual uint getTag() const;
-
+
virtual bool proc9(int val) const;
virtual int proc10() const;
diff --git a/engines/titanic/true_talk/tt_pronoun.h b/engines/titanic/true_talk/tt_pronoun.h
index ccc077152c..f7d61780fa 100644
--- a/engines/titanic/true_talk/tt_pronoun.h
+++ b/engines/titanic/true_talk/tt_pronoun.h
@@ -29,7 +29,7 @@ namespace Titanic {
class TTpronoun : public TTmajorWord {
private:
- static bool _staticFlag;
+ static bool _staticFlag;
protected:
int _field30;
public:
@@ -48,7 +48,7 @@ public:
*/
virtual TTword *copy() const;
- virtual bool comparePronounTo(int val) const {
+ virtual bool comparePronounTo(int val) const {
return _field30 == val;
}
diff --git a/engines/titanic/true_talk/tt_quotes_tree.cpp b/engines/titanic/true_talk/tt_quotes_tree.cpp
index 1f073b83f2..16453a10ae 100644
--- a/engines/titanic/true_talk/tt_quotes_tree.cpp
+++ b/engines/titanic/true_talk/tt_quotes_tree.cpp
@@ -33,12 +33,12 @@ static uint TABLE_INDEXES[3] = { 922, 1015, 1018 };
void TTquotesTree::load() {
Common::SeekableReadStream *r = g_vm->_filesManager->getResource("TEXT/TREE");
-
+
for (int idx = 0; idx < QUOTES_TREE_COUNT; ++idx) {
TTquotesTreeEntry &rec = _entries[idx];
assert(r->pos() < r->size());
-
- rec._id = r->readUint32LE();
+
+ rec._id = r->readUint32LE();
if (rec._id == 0) {
// Nothing needed
} else {
@@ -64,14 +64,14 @@ int TTquotesTree::search(const char *str, QuoteTreeNum treeNum,
const TTquotesTreeEntry *bTree = &_entries[TABLE_INDEXES[treeNum]];
if (!search1(&str, bTree, buffer, tagId) || !buffer->_treeItemP)
return -1;
-
+
if (remainder) {
while (*str) {
if (*str >= 'a' && *str != 's')
*remainder += *str;
}
}
-
+
return buffer->_treeItemP->_id & 0xffffff;
}
@@ -83,7 +83,7 @@ bool TTquotesTree::search1(const char **str, const TTquotesTreeEntry *bTree,
const char *strP = *str;
bool flag = false;
- for (uint mode = bTree->_id >> 24; mode != 0;
+ for (uint mode = bTree->_id >> 24; mode != 0;
++bTree, mode = bTree->_id >> 24) {
switch (mode) {
@@ -91,11 +91,11 @@ bool TTquotesTree::search1(const char **str, const TTquotesTreeEntry *bTree,
if (compareWord(str, bTree->_string.c_str()))
flag = true;
break;
-
+
case 2:
compareWord(str, bTree->_string.c_str());
break;
-
+
case 5:
if (READ_LE_UINT32(bTree->_string.c_str()) == tagId)
flag = true;
diff --git a/engines/titanic/true_talk/tt_response.cpp b/engines/titanic/true_talk/tt_response.cpp
index f007f98f97..1c784ad320 100644
--- a/engines/titanic/true_talk/tt_response.cpp
+++ b/engines/titanic/true_talk/tt_response.cpp
@@ -32,7 +32,7 @@ TTresponse::TTresponse(int dialogueId, int val2) : _field0(val2), _text(" "),
_dialogueId(dialogueId), _nextP(nullptr), _linkP(nullptr) {
}
-TTresponse::TTresponse(const TTresponse *src) : _field0(src->_field0),
+TTresponse::TTresponse(const TTresponse *src) : _field0(src->_field0),
_text(src->_text), _dialogueId(src->_dialogueId), _nextP(src->_nextP),
_linkP(src->_linkP) {
}
@@ -52,7 +52,7 @@ TTresponse::~TTresponse() {
TTresponse *TTresponse::copyChain() const {
TTresponse *returnResponseP = new TTresponse(this);
- for (TTresponse *srcP = _nextP, *destP = returnResponseP;
+ for (TTresponse *srcP = _nextP, *destP = returnResponseP;
srcP; srcP = srcP->_nextP, destP = destP->_nextP) {
destP->_nextP = new TTresponse(*srcP);
}
diff --git a/engines/titanic/true_talk/tt_room_script.cpp b/engines/titanic/true_talk/tt_room_script.cpp
index a49a5a5bd1..9b7be0a976 100644
--- a/engines/titanic/true_talk/tt_room_script.cpp
+++ b/engines/titanic/true_talk/tt_room_script.cpp
@@ -49,7 +49,7 @@ void TTroomScript::proc9(int v) {
ScriptChangedResult TTroomScript::scriptChanged(TTscriptBase *npcScript, int id) {
if (id == 1)
_field54 = 1;
-
+
return SCR_1;
}
diff --git a/engines/titanic/true_talk/tt_room_script.h b/engines/titanic/true_talk/tt_room_script.h
index 39a50ac30d..0f47830a12 100644
--- a/engines/titanic/true_talk/tt_room_script.h
+++ b/engines/titanic/true_talk/tt_room_script.h
@@ -49,12 +49,12 @@ public:
virtual bool proc8() const = 0;
virtual void proc9(int v) = 0;
-
+
/**
* Called when the script changes
*/
virtual ScriptChangedResult scriptChanged(TTscriptBase *npcScript, int id) = 0;
-
+
virtual bool proc11() const = 0;
};
diff --git a/engines/titanic/true_talk/tt_script_base.h b/engines/titanic/true_talk/tt_script_base.h
index 869b0beb64..30a296a444 100644
--- a/engines/titanic/true_talk/tt_script_base.h
+++ b/engines/titanic/true_talk/tt_script_base.h
@@ -60,7 +60,7 @@ protected:
* Delete any responses set up for the script
*/
void deleteResponses();
-
+
/**
* Creates and appends a new response fragment to the script specified by
* the given conversation Id
@@ -83,7 +83,7 @@ protected:
* Set the script state
*/
void setState(int state) { _state = state; }
-
+
/**
* Get the current state
*/
diff --git a/engines/titanic/true_talk/tt_scripts.cpp b/engines/titanic/true_talk/tt_scripts.cpp
index f8ea65a475..4c01fd1ead 100644
--- a/engines/titanic/true_talk/tt_scripts.cpp
+++ b/engines/titanic/true_talk/tt_scripts.cpp
@@ -32,7 +32,7 @@
#include "titanic/true_talk/succubus_script.h"
namespace Titanic {
-
+
TTnpcScript *TTnpcScriptList::findById(int charId) const {
for (TTnpcScriptList::const_iterator i = begin(); i != end(); ++i) {
const TTnpcScriptListItem *item = *i;
diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h
index 5b12d93418..69a94f6bf6 100644
--- a/engines/titanic/true_talk/tt_string.h
+++ b/engines/titanic/true_talk/tt_string.h
@@ -39,7 +39,7 @@ struct TTstringData {
};
enum TTstringStatus {
- SS_VALID = 0, SS_1 = 1, SS_2 = 2, SS_3 = 3, SS_4 = 4,
+ SS_VALID = 0, SS_1 = 1, SS_2 = 2, SS_3 = 3, SS_4 = 4,
SS_5 = 5, SS_7 = 7, SS_8 = 8, SS_11 = 11, SS_13 = 13
};
@@ -127,7 +127,7 @@ public:
* Get a char * pointer to the string data
*/
const char *c_str() const { return _data->_string.c_str(); }
-
+
/**
* Automatic operator to convert to a const char *
*/
diff --git a/engines/titanic/true_talk/tt_synonym.cpp b/engines/titanic/true_talk/tt_synonym.cpp
index b476efefcb..bb78e734ca 100644
--- a/engines/titanic/true_talk/tt_synonym.cpp
+++ b/engines/titanic/true_talk/tt_synonym.cpp
@@ -24,7 +24,7 @@
namespace Titanic {
-TTsynonym::TTsynonym() : TTstringNode(), _file(HANDLE_STDIN),
+TTsynonym::TTsynonym() : TTstringNode(), _file(HANDLE_STDIN),
_mode(0), _field1C(0) {
}
@@ -72,7 +72,7 @@ int TTsynonym::save(SimpleFile *file) {
}
file->writeFormat("%c", ' ');
-
+
if (synP->_file) {
file->writeFormat("%2.0d", synP->_file);
} else {
diff --git a/engines/titanic/true_talk/tt_title_script.cpp b/engines/titanic/true_talk/tt_title_script.cpp
index 85b56d0e1e..2effb96cc7 100644
--- a/engines/titanic/true_talk/tt_title_script.cpp
+++ b/engines/titanic/true_talk/tt_title_script.cpp
@@ -25,7 +25,7 @@
namespace Titanic {
TTTitleScript::TTTitleScript() : TTscriptBase(1, "", 0, "", 0, -1, -1, -1, 0),
- _field50(0), _field5C(-1), _field60(0) {
+ _field50(0), _field5C(-1), _field60(0) {
}
} // End of namespace Titanic
diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h
index 7fd61c38ac..7a42614f43 100644
--- a/engines/titanic/true_talk/tt_word.h
+++ b/engines/titanic/true_talk/tt_word.h
@@ -32,7 +32,7 @@ namespace Titanic {
/**
* Types of words
*/
-enum WordClass {
+enum WordClass {
WC_UNKNOWN = 0, WC_ACTION = 1, WC_THING = 2, WC_ABSTRACT = 3,
WC_ARTICLE = 4, WC_CONJUNCTION = 5, WC_PRONOUN = 6,
WC_PREPOSITION = 7, WC_ADJECTIVE = 8, WC_ADVERB = 9
@@ -155,7 +155,7 @@ public:
* Creates a copy of the word
*/
virtual TTword *copy() const;
-
+
virtual bool proc2(int val) const { return false; }
virtual int proc3() const { return -1; }
virtual void proc4() {}
@@ -165,7 +165,7 @@ public:
* Checks whether the word's tag is a known type
*/
virtual bool checkTag() const { return false; }
-
+
/**
* Compare the word's tag to a given tag value
*/
@@ -175,7 +175,7 @@ public:
* Return the tag associated with the word
*/
virtual uint getTag() const { return 0; }
-
+
virtual bool proc9(int val) const { return false; }
virtual int proc10() const { return 0; }
virtual void proc11() {}
diff --git a/engines/toon/anim.cpp b/engines/toon/anim.cpp
index 4788ba61a9..c0f0638740 100644
--- a/engines/toon/anim.cpp
+++ b/engines/toon/anim.cpp
@@ -218,7 +218,7 @@ void Animation::drawFrameWithMask(Graphics::Surface &surface, int32 frame, int16
void Animation::drawFrameWithMaskAndScale(Graphics::Surface &surface, int32 frame, int16 xx, int16 yy, int32 zz, Picture *mask, int32 scale) {
debugC(5, kDebugAnim, "drawFrameWithMaskAndScale(surface, %d, %d, %d, %d, mask, %d)", frame, xx, yy, zz, scale);
-
+
int16 dataFrame = frame;
if (_frames[frame]._ref != -1)
diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp
index 7b7b41f0aa..2dd03ab9c3 100644
--- a/engines/tsage/graphics.cpp
+++ b/engines/tsage/graphics.cpp
@@ -240,7 +240,7 @@ GfxSurface::GfxSurface() : Graphics::Screen(0, 0), _bounds(0, 0, SCREEN_WIDTH, S
GfxSurface::GfxSurface(const GfxSurface &s): Graphics::Screen(0, 0) {
free(); // Free the 0x0 surface allocated by Graphics::Screen
_lockSurfaceCtr = 0;
-
+
operator=(s);
}
diff --git a/engines/tsage/tsage.cpp b/engines/tsage/tsage.cpp
index b94b82f423..9b393132d9 100644
--- a/engines/tsage/tsage.cpp
+++ b/engines/tsage/tsage.cpp
@@ -115,7 +115,7 @@ void TSageEngine::initialize() {
#ifdef TSAGE_SHERLOCK_ENABLED
g_resourceManager->addLib("SF3.RLB");
g_globals = new Globals();
-
+
return;
#endif
}
diff --git a/engines/voyeur/configure.engine b/engines/voyeur/configure.engine
index c53530a9ed..647e20267f 100644
--- a/engines/voyeur/configure.engine
+++ b/engines/voyeur/configure.engine
@@ -1,4 +1,3 @@
-
# This file is included from the main "configure" script
# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
add_engine voyeur "Voyeur" yes
diff --git a/engines/voyeur/screen.cpp b/engines/voyeur/screen.cpp
index 62f609c5c7..ca9248398f 100644
--- a/engines/voyeur/screen.cpp
+++ b/engines/voyeur/screen.cpp
@@ -334,7 +334,7 @@ void Screen::sDrawPic(DisplayResource *srcDisplay, DisplayResource *destDisplay,
destP += width2 + widthDiff2;
}
- addDirtyRect(Common::Rect(offset.x, offset.y, offset.x + width2,
+ addDirtyRect(Common::Rect(offset.x, offset.y, offset.x + width2,
offset.y + height1));
}
}
diff --git a/engines/wage/dialog.cpp b/engines/wage/dialog.cpp
index ffb4f9c93d..a8500a7ebe 100644
--- a/engines/wage/dialog.cpp
+++ b/engines/wage/dialog.cpp
@@ -48,6 +48,7 @@
#include "common/system.h"
#include "common/events.h"
+#include "graphics/macgui/macfontmanager.h"
#include "graphics/macgui/macwindowmanager.h"
#include "wage/wage.h"
@@ -92,7 +93,7 @@ Dialog::~Dialog() {
}
const Graphics::Font *Dialog::getDialogFont() {
- return _gui->_wm.getFont(_gui->_wm.getFontName(0, 12), Graphics::FontManager::kBigGUIFont); // Default is Chicago
+ return _gui->_wm._fontMan->getFont(Graphics::MacFont(Graphics::kMacFontChicago, 12));
}
void Dialog::paint() {
diff --git a/engines/wage/entities.cpp b/engines/wage/entities.cpp
index 5ec54493a7..90247a5b21 100644
--- a/engines/wage/entities.cpp
+++ b/engines/wage/entities.cpp
@@ -54,6 +54,7 @@
#include "common/memstream.h"
#include "graphics/managed_surface.h"
+#include "graphics/macgui/macfontmanager.h"
namespace Wage {
@@ -86,8 +87,7 @@ Scene::Scene() {
_script = NULL;
_design = NULL;
_textBounds = NULL;
- _fontSize = 0;
- _fontType = 0;
+ _font = NULL;
for (int i = 0; i < 4; i++)
_blocked[i] = false;
@@ -111,8 +111,7 @@ Scene::Scene(Common::String name, Common::SeekableReadStream *data) {
_script = NULL;
_textBounds = NULL;
- _fontSize = 0;
- _fontType = 0;
+ _font = NULL;
setDesignBounds(readRect(data));
_worldY = data->readSint16BE();
@@ -138,6 +137,7 @@ Scene::Scene(Common::String name, Common::SeekableReadStream *data) {
Scene::~Scene() {
delete _script;
delete _textBounds;
+ delete _font;
}
void Scene::paint(Graphics::ManagedSurface *surface, int x, int y) {
@@ -157,15 +157,6 @@ void Scene::paint(Graphics::ManagedSurface *surface, int x, int y) {
}
}
-const char *Scene::getFontName() {
- const char *name = ((WageEngine *)g_engine)->_gui->_wm.getFontName(_fontType, _fontSize);
-
- if (!name)
- return "Unknown";
-
- return name;
-}
-
Designed *Scene::lookUpEntity(int x, int y) {
for (ObjList::const_iterator it = _objs.end(); it != _objs.begin(); ) {
it--;
diff --git a/engines/wage/entities.h b/engines/wage/entities.h
index b7cafb2294..a755af5360 100644
--- a/engines/wage/entities.h
+++ b/engines/wage/entities.h
@@ -50,6 +50,7 @@
namespace Graphics {
class ManagedSurface;
+ class MacFont;
}
namespace Wage {
@@ -308,8 +309,7 @@ public:
Script *_script;
Common::String _text;
Common::Rect *_textBounds;
- int _fontSize;
- int _fontType; // 3 => Geneva, 22 => Courier, param to TextFont() function
+ Graphics::MacFont *_font;
bool _blocked[4];
Common::String _messages[4];
int _soundFrequency; // times a minute, max 3600
@@ -334,7 +334,7 @@ public:
void paint(Graphics::ManagedSurface *screen, int x, int y);
- const char *getFontName();
+ const Graphics::MacFont *getFont() { return _font; }
};
} // End of namespace Wage
diff --git a/engines/wage/gui-console.cpp b/engines/wage/gui-console.cpp
index a5e71463f7..37031f0dd9 100644
--- a/engines/wage/gui-console.cpp
+++ b/engines/wage/gui-console.cpp
@@ -51,6 +51,7 @@
#include "graphics/cursorman.h"
#include "graphics/fonts/bdf.h"
#include "graphics/palette.h"
+#include "graphics/macgui/macfontmanager.h"
#include "graphics/macgui/macwindow.h"
#include "graphics/macgui/macmenu.h"
@@ -65,7 +66,7 @@ namespace Wage {
const Graphics::Font *Gui::getConsoleFont() {
Scene *scene = _engine->_world->_player->_currentScene;
- return _wm.getFont(scene->getFontName(), Graphics::FontManager::kConsoleFont);
+ return _wm._fontMan->getFont(*scene->getFont());
}
void Gui::clearOutput() {
diff --git a/engines/wage/world.cpp b/engines/wage/world.cpp
index 3e56c0daa7..90d689720e 100644
--- a/engines/wage/world.cpp
+++ b/engines/wage/world.cpp
@@ -46,6 +46,7 @@
*/
#include "common/file.h"
+#include "graphics/macgui/macfontmanager.h"
#include "wage/wage.h"
#include "wage/entities.h"
@@ -203,8 +204,9 @@ bool World::loadWorld(Common::MacResManager *resMan) {
res = resMan->getResource(MKTAG('A','T','X','T'), *iter);
if (res != NULL) {
scene->_textBounds = readRect(res);
- scene->_fontType = res->readUint16BE();
- scene->_fontSize = res->readUint16BE();
+ int fontType = res->readUint16BE();
+ int fontSize = res->readUint16BE();
+ scene->_font = new Graphics::MacFont(fontType, fontSize, Graphics::kMacFontRegular, Graphics::FontManager::kConsoleFont);
Common::String text;
while (res->pos() < res->size()) {
diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp
index 1af7e2b56d..ef3cc2d84f 100644
--- a/engines/wintermute/base/base_game.cpp
+++ b/engines/wintermute/base/base_game.cpp
@@ -70,6 +70,7 @@
#include "common/keyboard.h"
#include "common/system.h"
#include "common/file.h"
+#include "graphics/scaler.h"
#if EXTENDED_DEBUGGER_ENABLED
#include "engines/wintermute/base/scriptables/debuggable/debuggable_script_engine.h"
@@ -171,7 +172,12 @@ BaseGame::BaseGame(const Common::String &targetName) : BaseObject(this), _target
_forceNonStreamedSounds = false;
- _thumbnailWidth = _thumbnailHeight = 0;
+ // These are NOT the actual engine defaults (they are 0, 0),
+ // but we have a use for thumbnails even for games that don't
+ // use them in-game, hence we set a default that is suitably
+ // sized for the GMM (expecting 4:3 ratio)
+ _thumbnailWidth = kThumbnailWidth;
+ _thumbnailHeight = kThumbnailHeight2;
_localSaveDir = "saves";
diff --git a/engines/wintermute/detection_tables.h b/engines/wintermute/detection_tables.h
index ca30204462..68985d8d0c 100644
--- a/engines/wintermute/detection_tables.h
+++ b/engines/wintermute/detection_tables.h
@@ -138,114 +138,118 @@ static const PlainGameDescriptor wintermuteGames[] = {
static const WMEGameDescription gameDescriptions[] = {
// Five Lethal Demons
- WME_WINENTRY("5ld", "",
+ WME_WINENTRY("5ld", "",
WME_ENTRY1s("data.dcp", "1037a77cbd001e0644898addc022322c", 15407750), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Five Magical Amulets (Czech)
- WME_WINENTRY("5ma", "",
+ WME_WINENTRY("5ma", "",
WME_ENTRY2s("czech.dcp", "7b2515a8ceb955c72bc14f0f1fca869e", 184,
"data.dcp", "0134e92bcd5fd2837df3971087e96067", 163316498), Common::CZ_CZE, ADGF_UNSTABLE, WME_1_7_0),
// Five Magical Amulets (English)
WME_WINENTRY("5ma", "",
WME_ENTRY2s("english.dcp", "2f97bca09260ba23b645da9f0855ce7f", 893681,
"data.dcp", "0134e92bcd5fd2837df3971087e96067", 163316498), Common::EN_ANY, ADGF_UNSTABLE, WME_1_7_0),
+ // Five Magical Amulets (German)
+ WME_WINENTRY("5ma", "",
+ WME_ENTRY2s("german.dcp", "bfa74aae81672803d0d0748ac0a532b7", 885150,
+ "data.dcp", "0134e92bcd5fd2837df3971087e96067", 163316498), Common::DE_DEU, ADGF_UNSTABLE, WME_1_7_0),
// Five Magical Amulets (Polish)
WME_WINENTRY("5ma", "",
WME_ENTRY2s("polish.dcp", "bb877d48795471a17f25b0b5109100d1", 1132197,
"data.dcp", "0134e92bcd5fd2837df3971087e96067", 163316498), Common::PL_POL, ADGF_UNSTABLE, WME_1_7_0),
// Actual Destination
- WME_WINENTRY("actualdest", "",
+ WME_WINENTRY("actualdest", "",
WME_ENTRY1s("data.dcp", "6926f44b26f21ceb1d840eaab9aeb510", 9081740), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Boredom of Agustin Cordes
- WME_WINENTRY("agustin", "",
+ WME_WINENTRY("agustin", "",
WME_ENTRY1s("data.dcp", "abb79c16c9b92e9b06525a4c7c3f5861", 2461949), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Beyond the Threshold
- WME_WINENTRY("bthreshold", "",
+ WME_WINENTRY("bthreshold", "",
WME_ENTRY1s("data.dcp", "d49bf9ccb2e74507447c82d6ad3e2bc4", 12773712), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Bickadoodle
- WME_WINENTRY("bickadoodle", "",
+ WME_WINENTRY("bickadoodle", "",
WME_ENTRY1s("data.dcp", "84db4d1594cac95e25614985775d10a8", 35303844), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Bickadoodle (Ver 1.1)
- WME_WINENTRY("bickadoodle", "Version 1.1",
+ WME_WINENTRY("bickadoodle", "Version 1.1",
WME_ENTRY1s("data.dcp", "8bb52ac9a9ee129c5059e8e808b669d7", 35337760), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Bickadoodle (Ver 1.2)
WME_WINENTRY("bickadoodle", "Version 1.2",
WME_ENTRY1s("data.dcp", "1796a48f3ed72dd785ce93334ab883cc", 35337760), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Bickadoodle (download from http://aethericgames.com/games/bickadoodle/download-bickadoodle/)
- WME_WINENTRY("bickadoodle", "",
+ WME_WINENTRY("bickadoodle", "",
WME_ENTRY1s("data.dcp", "1584d83577c32add0fce27fae91141a2", 35337728), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Book of Gron Part One
- WME_WINENTRY("bookofgron", "",
+ WME_WINENTRY("bookofgron", "",
WME_ENTRY1s("data.dcp", "e61b2ebee044a82fa0f8ca0fce2c8946", 83129531), Common::RU_RUS, ADGF_UNSTABLE, LATEST_VERSION),
// Carol Reed 4 - East Side Story (Demo)
- WME_WINENTRY("carolreed4", "Demo",
+ WME_WINENTRY("carolreed4", "Demo",
WME_ENTRY1s("data.dcp", "b3f8b09bb4b05ee3e9d14697525257f9", 59296246), Common::EN_ANY, ADGF_UNSTABLE | ADGF_DEMO, LATEST_VERSION),
// Carol Reed 4 - East Side Story
- WME_WINENTRY("carolreed4", "",
+ WME_WINENTRY("carolreed4", "",
WME_ENTRY1s("data.dcp", "b26377797f060afc2d440d820100c1ce", 529320536), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Carol Reed 5 - The Colour of Murder
- WME_WINENTRY("carolreed5", "",
+ WME_WINENTRY("carolreed5", "",
WME_ENTRY1s("data.dcp", "3fcfca44209545d0e26774156427b494", 603660415), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Carol Reed 5 - The Colour of Murder (1.0 Demo)
WME_WINENTRY("carolreed5", "Demo",
WME_ENTRY1s("data.dcp", "27b3efc018ade5ee8f4adf08b4e3c0dd", 92019500), Common::EN_ANY, ADGF_UNSTABLE | ADGF_DEMO, LATEST_VERSION),
// Carol Reed 6 - Black Circle
- WME_WINENTRY("carolreed6", "",
+ WME_WINENTRY("carolreed6", "",
WME_ENTRY1s("data.dcp", "0e4c532beecf23d85012168753f41189", 456258147), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Carol Reed 7 - Blue Madonna (Demo)
- WME_WINENTRY("carolreed7", "Demo",
+ WME_WINENTRY("carolreed7", "Demo",
WME_ENTRY1s("data.dcp", "0372ad0c775266f6355e9e8ae397a2f1", 103719442), Common::EN_ANY, ADGF_UNSTABLE | ADGF_DEMO, LATEST_VERSION),
// Carol Reed 7 - Blue Madonna
- WME_WINENTRY("carolreed7", "",
+ WME_WINENTRY("carolreed7", "",
WME_ENTRY1s("data.dcp", "24e3db3e2fabfc956713796d87a3efb0", 495471147), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Carol Reed 8 - Amber's Blood
- WME_WINENTRY("carolreed8", "",
+ WME_WINENTRY("carolreed8", "",
WME_ENTRY1s("data.dcp", "859d16b0d5b9b255e470cbded2c6cedc", 502714557), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Carol Reed 9 - Cold Case Summer
- WME_WINENTRY("carolreed9", "",
+ WME_WINENTRY("carolreed9", "",
WME_ENTRY1s("data.dcp", "2b343b48a7aee508d728a546b414a255", 620005266), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Chivalry is Not Dead
- WME_WINENTRY("chivalry", "",
- WME_ENTRY1s("data.dcp", "ebd0915d9a12df5224be22f53bb23eb6", 7278306), Common::EN_ANY, ADGF_TESTING, LATEST_VERSION),
+ WME_WINENTRY("chivalry", "",
+ WME_ENTRY1s("data.dcp", "ebd0915d9a12df5224be22f53bb23eb6", 7278306), Common::EN_ANY, ADGF_NO_FLAGS, LATEST_VERSION),
// Chivalry is Not Dead (Version from deirdrakai.com)
- WME_WINENTRY("chivalry", "",
- WME_ENTRY1s("data.dcp", "ae6d91b9517f4d2851a8ad94c96951c8", 7278302), Common::EN_ANY, ADGF_TESTING, LATEST_VERSION),
+ WME_WINENTRY("chivalry", "",
+ WME_ENTRY1s("data.dcp", "ae6d91b9517f4d2851a8ad94c96951c8", 7278302), Common::EN_ANY, ADGF_NO_FLAGS, LATEST_VERSION),
// Conspiracao Dumont
- WME_WINENTRY("conspiracao", "",
+ WME_WINENTRY("conspiracao", "",
WME_ENTRY1s("ConspiracaoDumont.exe", "106f3f2c8f18bb5ffffeed634ace256c", 32908032), Common::EN_ANY, ADGF_UNSTABLE | ADGF_DEMO, LATEST_VERSION),
// Corrosion: Cold Winter Waiting
- WME_WINENTRY("corrosion", "",
- WME_ENTRY1s("data.dcp", "ae885b1a8faa0b27f43c0e8f0df02fc9", 525931618), Common::EN_ANY, ADGF_TESTING, LATEST_VERSION),
+ WME_WINENTRY("corrosion", "",
+ WME_ENTRY1s("data.dcp", "ae885b1a8faa0b27f43c0e8f0df02fc9", 525931618), Common::EN_ANY, ADGF_NO_FLAGS, LATEST_VERSION),
// Dead City (Czech)
// The Czech data are in data.dcp, so in this case we'll have to
// just detect the english version twice, to give the user a choice.
WME_WINENTRY("deadcity", "",
- WME_ENTRY2s("english.dcp", "c591046d6de7e381d76f70e0787b2b1f", 415935,
+ WME_ENTRY2s("english.dcp", "c591046d6de7e381d76f70e0787b2b1f", 415935,
"data.dcp", "7ebfd50d1a22370ed7b079bcaa631d62", 9070205), Common::CZ_CZE, ADGF_UNSTABLE, LATEST_VERSION),
// Dead City (English)
WME_WINENTRY("deadcity", "",
- WME_ENTRY2s("english.dcp", "c591046d6de7e381d76f70e0787b2b1f", 415935,
+ WME_ENTRY2s("english.dcp", "c591046d6de7e381d76f70e0787b2b1f", 415935,
"data.dcp", "7ebfd50d1a22370ed7b079bcaa631d62", 9070205), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Dead City (Italian)
WME_WINENTRY("deadcity", "",
- WME_ENTRY2s("italian.dcp", "92d8efb94436bec7bd1b7fe0b548192e", 454037,
+ WME_ENTRY2s("italian.dcp", "92d8efb94436bec7bd1b7fe0b548192e", 454037,
"data.dcp", "7ebfd50d1a22370ed7b079bcaa631d62", 9070205), Common::IT_ITA, ADGF_UNSTABLE, LATEST_VERSION),
// Dead City (Russian)
WME_WINENTRY("deadcity", "",
- WME_ENTRY2s("russian.dcp", "a0ae71e9e1185596fffb07ad2c951eb9", 653317,
+ WME_ENTRY2s("russian.dcp", "a0ae71e9e1185596fffb07ad2c951eb9", 653317,
"data.dcp", "7ebfd50d1a22370ed7b079bcaa631d62", 9070205), Common::RU_RUS, ADGF_UNSTABLE, LATEST_VERSION),
// Dirty Split (Czech)
WME_WINENTRY("dirtysplit", "",
- WME_ENTRY2s("czech.dcp", "08a71446467cf8f9444cfea446b46ad6", 127697934,
+ WME_ENTRY2s("czech.dcp", "08a71446467cf8f9444cfea446b46ad6", 127697934,
"data.dcp", "8b4b81b718bf65f30a67fc0b1e329eb5", 88577623), Common::CZ_CZE, ADGF_UNSTABLE, LATEST_VERSION),
// Dirty Split (English)
- WME_WINENTRY("dirtysplit", "",
+ WME_WINENTRY("dirtysplit", "",
WME_ENTRY1s("data.dcp", "8f3dae199361ece0f59fb20cfff6eed3", 88577621), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Dirty Split (French)
WME_WINENTRY("dirtysplit", "",
- WME_ENTRY2s("french.dcp", "a0508dedebd0fe478d0158fa4c2a1136", 125534323,
+ WME_ENTRY2s("french.dcp", "a0508dedebd0fe478d0158fa4c2a1136", 125534323,
"data.dcp", "e6d70c7f5d181b761cfcf974adf9186a", 88577623), Common::FR_FRA, ADGF_UNSTABLE, LATEST_VERSION),
// Dirty Split (German)
- WME_WINENTRY("dirtysplit", "",
+ WME_WINENTRY("dirtysplit", "",
WME_ENTRY1s("data.dcp", "139d8a25579e969f8b37d20e6e3de5f9", 92668291), Common::DE_DEU, ADGF_UNSTABLE, LATEST_VERSION),
// Dirty Split (Italian)
WME_WINENTRY("dirtysplit", "",
@@ -256,36 +260,36 @@ static const WMEGameDescription gameDescriptions[] = {
WME_ENTRY2s("spanish.dcp", "b3982c0a5e85b42e1e38240fef004aa4", 164428596,
"data.dcp", "63766d6c68b9f00b632ea1736fc8a95c", 88577621), Common::ES_ESP, ADGF_UNSTABLE, LATEST_VERSION),
// Des Reves Elastiques Avec Mille Insectes Nommes Georges
- WME_WINENTRY("dreaming", "",
+ WME_WINENTRY("dreaming", "",
WME_ENTRY1s("data.dcp", "4af26d97ea063fc1277ce30ae431de90", 8804073), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Dreamscape
- WME_WINENTRY("dreamscape", "",
+ WME_WINENTRY("dreamscape", "",
WME_ENTRY1s("data.dcp", "7a5752ed4446c862be9f02d7932acf54", 17034377), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Escape from the Mansion
- WME_WINENTRY("escapemansion", "Beta 1",
+ WME_WINENTRY("escapemansion", "Beta 1",
WME_ENTRY1s("data.dcp", "d8e348b2312cc36a929cad75f12e0b3a", 21452380), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Escape from the Mansion
- WME_WINENTRY("escapemansion", "Beta 2",
+ WME_WINENTRY("escapemansion", "Beta 2",
WME_ENTRY1s("data.dcp", "ded5fa6c5f2afdaf2cafb53e52cd3dd8", 21455763), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Escape from the Mansion
- WME_WINENTRY("escapemansion", "1.3",
+ WME_WINENTRY("escapemansion", "1.3",
WME_ENTRY1s("data.dcp", "1e5d231b56c8a228cd15cb690f50253e", 29261972), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Four
- WME_WINENTRY("four", "",
+ WME_WINENTRY("four", "",
WME_ENTRY1s("data.dcp", "ec05cd5e37c9a524053b8859635a4234", 62599855), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Framed
- WME_WINENTRY("framed", "",
+ WME_WINENTRY("framed", "",
WME_ENTRY1s("data.dcp", "e7259fb36f2c6f9f28242291e0c3de98", 34690568), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Ghost in the Sheet
WME_WINENTRY("ghostsheet", "",
WME_ENTRY2s("english.dcp", "e6d0aad2c89996bcabe416105a3d6d3a", 12221017,
"data.dcp", "b2f8b05328e4881e15e98e845b63f451", 168003), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Ghost in the Sheet (Demo)
- WME_WINENTRY("ghostsheet", "Demo",
+ WME_WINENTRY("ghostsheet", "Demo",
WME_ENTRY1s("data.dcp", "dc1f6595f412ac25a52eaf47dad4ab81", 169083), Common::EN_ANY, ADGF_UNSTABLE | ADGF_DEMO, LATEST_VERSION),
// Hamlet or the last game without MMORPS features, shaders and product placement
- WME_WINENTRY("hamlet", "",
-
+ WME_WINENTRY("hamlet", "",
+
WME_ENTRY1s("data.dcp", "f624add957a77c9930529fb28cc2450f", 88183022), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Helga Deep In Trouble (English)
WME_WINENTRY("helga", "",
@@ -296,37 +300,37 @@ static const WMEGameDescription gameDescriptions[] = {
WME_ENTRY2s("english.dcp", "b3a93e678f0ef97200f691cd1724643f", 135864,
"data.dcp", "45134ed93bc391edf148b79cdcbf2a09", 154266028), Common::EN_ANY, ADGF_UNSTABLE | ADGF_DEMO, LATEST_VERSION),
// James Peris: No License Nor Control (English)
- WME_WINENTRY("jamesperis", "",
+ WME_WINENTRY("jamesperis", "",
WME_ENTRY1s("data.dcp", "a420961e170cb7d168a0d2bae2fe5218", 225294032), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// James Peris: No License Nor Control (Spanish)
- WME_WINENTRY("jamesperis", "",
+ WME_WINENTRY("jamesperis", "",
WME_ENTRY1s("data.dcp", "a420961e170cb7d168a0d2bae2fe5218", 225294032), Common::ES_ESP, ADGF_UNSTABLE, LATEST_VERSION),
// James Peris: No License Nor Control (Demo) (English)
- WME_WINENTRY("jamesperis", "Demo",
+ WME_WINENTRY("jamesperis", "Demo",
WME_ENTRY1s("data.dcp", "edb9f9c7a08993c1e28f4e477b5f9830", 116113507), Common::EN_ANY, ADGF_UNSTABLE | ADGF_DEMO, LATEST_VERSION),
// James Peris: No License Nor Control (Demo) (Spanish)
- WME_WINENTRY("jamesperis", "Demo",
+ WME_WINENTRY("jamesperis", "Demo",
WME_ENTRY1s("data.dcp", "edb9f9c7a08993c1e28f4e477b5f9830", 116113507), Common::ES_ESP, ADGF_UNSTABLE | ADGF_DEMO, LATEST_VERSION),
// J.U.L.I.A. (English)
- WME_WINENTRY("julia", "",
+ WME_WINENTRY("julia", "",
WME_ENTRY1s("data.dcp", "c2264b4f8fcd132d2913ff5b6076a24f", 10109741), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// J.U.L.I.A. (English, Bundle in a box-version)
- WME_WINENTRY("julia", "Version 1.2",
+ WME_WINENTRY("julia", "Version 1.2",
WME_ENTRY1s("data.dcp", "fe90023ccc22f35185b40b910e0d03a2", 10101373), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// J.U.L.I.A. (English) (Demo)
- WME_WINENTRY("julia", "Demo",
+ WME_WINENTRY("julia", "Demo",
WME_ENTRY1s("data.dcp", "f0bbc3394555a9811f6050dae428cab6", 7655237), Common::EN_ANY, ADGF_UNSTABLE | ADGF_DEMO, LATEST_VERSION),
// J.U.L.I.A. (English) (Greenlight Demo)
- WME_WINENTRY("julia", "Greenlight Demo",
+ WME_WINENTRY("julia", "Greenlight Demo",
WME_ENTRY1s("data.dcp", "4befd448d36b0dae9c3ab1aa7cb8b78d", 7271886), Common::EN_ANY, ADGF_UNSTABLE | ADGF_DEMO, LATEST_VERSION),
// Kulivocko (Czech)
- WME_WINENTRY("kulivocko", "",
+ WME_WINENTRY("kulivocko", "",
WME_ENTRY1s("data.dcp", "44306dc470e9b27474043932eccee02f", 155106392), Common::CZ_CZE, ADGF_UNSTABLE, LATEST_VERSION),
// Kulivocko (Czech) (Demo)
- WME_WINENTRY("kulivocko", "Demo",
+ WME_WINENTRY("kulivocko", "Demo",
WME_ENTRY1s("data.dcp", "63b164bdfadecbb0deb5da691afb8154", 48362234), Common::CZ_CZE, ADGF_UNSTABLE | ADGF_DEMO, LATEST_VERSION),
// Life In 3 Minutes
- WME_WINENTRY("lifein3minutes", "",
+ WME_WINENTRY("lifein3minutes", "",
WME_ENTRY1s("data.dcp", "c6368950e37a95bf098b02b4eaa5b929", 141787214), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Looky Demo (English)
WME_WINENTRY("looky", "Demo",
@@ -341,10 +345,10 @@ static const WMEGameDescription gameDescriptions[] = {
WME_ENTRY2s("german.dcp", "bf4c2b8c26342342441a6d64934ab832", 107027865,
"data.dcp", "50de0beaa5ad621aa9f020df901d1e74", 1342214), Common::DE_DEU, ADGF_UNSTABLE, LATEST_VERSION),
// Mirage
- WME_WINENTRY("mirage", "",
+ WME_WINENTRY("mirage", "",
WME_ENTRY1s("data.dcp", "d230b0b99c0aa77b9ecd094d8ee5573b", 17844056), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Oknytt
- WME_WINENTRY("oknytt", "Version 1.0",
+ WME_WINENTRY("oknytt", "Version 1.0",
WME_ENTRY1s("data.dcp", "6456cf8f429905c83f07509f9da536dd", 109502959), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Oknytt (Version 1.13 English) (These are detected along with d_sounds.dcp to avoid mass-detecting in the languages-subfolder.)
WME_WINENTRY("oknytt", "Version 1.13",
@@ -363,25 +367,25 @@ static const WMEGameDescription gameDescriptions[] = {
WME_ENTRY2s("spanish.dcp", "10c46152cb29581671f3b6b7c229c957", 319406572,
"d_sounds.dcp", "7d04dff8ca11174486bd4b7a80fdcabb", 154943401), Common::ES_ESP, ADGF_UNSTABLE, LATEST_VERSION),
// Night Train Demo
- WME_WINENTRY("nighttrain", "",
+ WME_WINENTRY("nighttrain", "",
WME_ENTRY1s("data.dcp", "5a027ef84b083a730c9a4c85ec1d3a32", 131760816), Common::EN_ANY, ADGF_UNSTABLE | ADGF_DEMO, LATEST_VERSION),
// Paintaria
- WME_WINENTRY("paintaria", "",
+ WME_WINENTRY("paintaria", "",
WME_ENTRY1s("data.dcp", "354c08440c98150ff0d4008dd2865880", 48326040), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Pigeons in the Park
- WME_WINENTRY("pigeons", "",
+ WME_WINENTRY("pigeons", "",
WME_ENTRY1s("data.dcp", "9143a5b6ff8206aefe3c4c643add3ec7", 2611100), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Project: Doom
- WME_WINENTRY("projectdoom", "",
+ WME_WINENTRY("projectdoom", "",
WME_ENTRY1s("data.dcp", "d5894b65a40706845434b99870bcab92", 99223761), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Project Joe
- WME_WINENTRY("projectjoe", "",
+ WME_WINENTRY("projectjoe", "",
WME_ENTRY1s("data.dcp", "ada3c08542901295076b5349e655e73f", 160780037), Common::EN_ANY, ADGF_UNSTABLE | ADGF_DEMO, LATEST_VERSION),
// Project Lonely Robot
- WME_WINENTRY("lonelyrobot", "beta",
+ WME_WINENTRY("lonelyrobot", "beta",
WME_ENTRY1s("data.dcp", "a0cf7ad5bab957416dcda454e9f28ef0", 3420120), Common::EN_ANY, ADGF_UNSTABLE | ADGF_DEMO, LATEST_VERSION),
// Reversion: The Escape Version 1.0
- WME_WINENTRY("reversion1", "Version 1.0",
+ WME_WINENTRY("reversion1", "Version 1.0",
WME_ENTRY1s("data.dcp", "cd616f98ebfd047e0c540b50b4b70761", 254384531), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Reversion: The Escape Version 1.1 (Chinese)
WME_WINENTRY("reversion1", "Version 1.1",
@@ -472,7 +476,7 @@ static const WMEGameDescription gameDescriptions[] = {
WME_ENTRY2s("xlanguage_en.dcp", "ca357d86618d1ab76a21c913f4403cbd", 8414976,
"data.dcp", "f7938cbfdc48f07934550245a3286921", 255672016), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Reversion: The Meeting (Spanish)
- WME_WINENTRY("reversion2", "",
+ WME_WINENTRY("reversion2", "",
WME_ENTRY1s("data.dcp", "f7938cbfdc48f07934550245a3286921", 255672016), Common::ES_ESP, ADGF_UNSTABLE, LATEST_VERSION),
// Reversion: The Meeting Version 2.0.2412 (Chinese)
WME_PLATENTRY("reversion2", "Version 2.0.2412",
@@ -485,79 +489,79 @@ static const WMEGameDescription gameDescriptions[] = {
"xlanguage_en.dcp", "0598bf752ce93b42bcaf1094df537c7b", 8533057,
"Linux.dcp", "21858bd77dc86b03f701fd47900e2f51", 984535), Common::EN_ANY, Common::kPlatformLinux, ADGF_UNSTABLE, LATEST_VERSION),
// Rhiannon: Curse of the four Branches
- WME_WINENTRY("rhiannon", "",
+ WME_WINENTRY("rhiannon", "",
WME_ENTRY1s("data.dcp", "870f348900b735f1cc79c0608ce32b0e", 1046169851), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Rhiannon: Curse of the four Branches (English PC DVD)
- WME_WINENTRY("rhiannon", "DVD",
+ WME_WINENTRY("rhiannon", "DVD",
WME_ENTRY1s("data.dcp", "6736bbc921bb6ce5161b3ad095a97bd4", 1053441028), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// 1 1/2 Ritter: Auf der Suche nach der hinreissenden Herzelinde
- WME_WINENTRY("ritter", "",
+ WME_WINENTRY("ritter", "",
WME_ENTRY1s("data.dcp", "5ac416cee605d3a30f4d59687b1cdab2", 364260278), Common::DE_DEU, ADGF_UNSTABLE, LATEST_VERSION),
// Satan and Son
- WME_WINENTRY("satanandson", "",
+ WME_WINENTRY("satanandson", "",
WME_ENTRY1s("data.dcp", "16a6ba8174b697bbba9299619d1e20c4", 67539054), Common::EN_ANY, ADGF_UNSTABLE | ADGF_DEMO, LATEST_VERSION),
// Rosemary
- WME_WINENTRY("rosemary", "",
+ WME_WINENTRY("rosemary", "",
WME_ENTRY1s("data.dcp", "4f2631138bd4d27587d9043f8aeff3df", 29483643), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Securanote
- WME_PLATENTRY("securanote", "",
+ WME_PLATENTRY("securanote", "",
WME_ENTRY1s("data.dcp", "5213d3e59b9e95b7fbd5c56f7de5341a", 2625554), Common::EN_ANY, Common::kPlatformIOS, ADGF_UNSTABLE, LATEST_VERSION),
// Shaban
- WME_WINENTRY("shaban", "",
+ WME_WINENTRY("shaban", "",
WME_ENTRY1s("data.dcp", "35f702ca9baabc5c620e0be230195c8a", 755388466), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// The Shine of a Star
- WME_WINENTRY("shinestar", "",
+ WME_WINENTRY("shinestar", "",
WME_ENTRY1s("data.dcp", "f05abe9e2427a5e4f73648fa09c4ba8e", 94113060), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Sofia's Debt
- WME_WINENTRY("sofiasdebt", "",
+ WME_WINENTRY("sofiasdebt", "",
WME_ENTRY1s("SD.exe", "e9515f9ba1a2925bb6733476a826a650", 9915047), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Space Invaders (Demo)
- WME_WINENTRY("spaceinvaders", "Demo",
+ WME_WINENTRY("spaceinvaders", "Demo",
WME_ENTRY1s("data.dcp", "3f27adefdf72f2c1601cf555c80a509f", 1308361), Common::EN_ANY, ADGF_UNSTABLE | ADGF_DEMO, LATEST_VERSION),
// Space Madness
- WME_WINENTRY("spacemadness", "1.0.2",
+ WME_WINENTRY("spacemadness", "1.0.2",
WME_ENTRY1s("data.dcp", "b9b83135dc7a9e1b4b5f50195dbeb630", 39546622), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// The Ancient Mark - Episode 1
- WME_WINENTRY("theancientmark1", "",
+ WME_WINENTRY("theancientmark1", "",
WME_ENTRY1s("data.dcp", "ca04c26f03b2bd307368b306b297ddd7", 364664692), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// The Box
- WME_WINENTRY("thebox", "",
+ WME_WINENTRY("thebox", "",
WME_ENTRY1s("data.dcp", "ec5f0c7e8174e307701447b53afe7e2f", 108372483), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// The Kite (Version 1.1)
- WME_WINENTRY("thekite", "Version 1.1",
+ WME_WINENTRY("thekite", "Version 1.1",
WME_ENTRY1s("data.dcp", "92d29428f464469bda2d81b03d4d5c3e", 47332296), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// The Kite (Version 1.2.e)
- WME_WINENTRY("thekite", "Version 1.2.e",
+ WME_WINENTRY("thekite", "Version 1.2.e",
WME_ENTRY1s("data.dcp", "92451578b1bdd2b32a1db592a4f6d5fc", 47360539), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// The Kite (Version 1.2.i) (Italian)
- WME_WINENTRY("thekite", "Version 1.2.i",
+ WME_WINENTRY("thekite", "Version 1.2.i",
WME_ENTRY1s("data.dcp", "d3435b106a1b3b4c1df8ad596d271586", 47509274), Common::IT_ITA, ADGF_UNSTABLE, LATEST_VERSION),
// The Kite (Version 1.2.r) (Russian)
- WME_WINENTRY("thekite", "Version 1.2.r",
+ WME_WINENTRY("thekite", "Version 1.2.r",
WME_ENTRY1s("data.dcp", "d531e097dd884737469da014ed882cde", 47554582 ), Common::RU_RUS, ADGF_UNSTABLE, LATEST_VERSION),
// The Kite (Version 1.3.e)
- WME_WINENTRY("thekite", "Version 1.3.e",
+ WME_WINENTRY("thekite", "Version 1.3.e",
WME_ENTRY1s("data.dcp", "9761827b51370263b7623721545d7627", 47382987), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Fairy Tales About Toshechka and Boshechka
- WME_WINENTRY("tib", "",
+ WME_WINENTRY("tib", "",
WME_ENTRY1s("data.dcp", "87d296ef3f46570ed18f000d3885db77", 340264526), Common::RU_RUS, ADGF_UNSTABLE, LATEST_VERSION),
// The Trader of Stories
- WME_WINENTRY("tradestory", "Demo",
+ WME_WINENTRY("tradestory", "Demo",
WME_ENTRY1s("data.dcp", "0a0b51191636cc8ead89b905281c3218", 40401902), Common::EN_ANY, ADGF_UNSTABLE | ADGF_DEMO, LATEST_VERSION),
// the white chamber (multi-language)
- WME_WINENTRY("twc", "",
+ WME_WINENTRY("twc", "",
WME_ENTRY1s("data.dcp", "0011d01142547c61e51ba24dc42b579e", 186451273), Common::UNK_LANG, ADGF_UNSTABLE, LATEST_VERSION),
// Vsevolod Prologue (Demo)
- WME_WINENTRY("vsevolod", "Prologue",
+ WME_WINENTRY("vsevolod", "Prologue",
WME_ENTRY1s("data.dcp", "f2dcffd2692dbfcc9371fa1a87970fe7", 388669493), Common::EN_ANY, ADGF_UNSTABLE | ADGF_DEMO, LATEST_VERSION),
// War
- WME_WINENTRY("war", "",
+ WME_WINENTRY("war", "",
WME_ENTRY1s("data.dcp", "003e317cda6d0137bbd5e5d7f089ee4d", 32591890), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Wilma Tetris
- WME_WINENTRY("wtetris", "",
+ WME_WINENTRY("wtetris", "",
WME_ENTRY1s("data.dcp", "946e3a0496e6c12fb344c9ed861ff015", 2780093), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
// Zilm: A Game of Reflex 1.0
- WME_WINENTRY("Zilm", "1.0",
+ WME_WINENTRY("Zilm", "1.0",
WME_ENTRY1s("data.dcp", "098dffaf03d8adbb4cb5633e4733e63c", 351726), Common::EN_ANY, ADGF_UNSTABLE, LATEST_VERSION),
{
AD_TABLE_END_MARKER,
diff --git a/engines/wintermute/ui/ui_edit.cpp b/engines/wintermute/ui/ui_edit.cpp
index ffe8d66b4d..81030e09c3 100644
--- a/engines/wintermute/ui/ui_edit.cpp
+++ b/engines/wintermute/ui/ui_edit.cpp
@@ -899,7 +899,7 @@ int UIEdit::deleteChars(int start, int end) {
//////////////////////////////////////////////////////////////////////////
int UIEdit::insertChars(int pos, const byte *chars, int num) {
- if ((int)strlen(_text) + num > _maxLength) {
+ if ((_maxLength != -1) && (int)strlen(_text) + num > _maxLength) {
num -= (strlen(_text) + num - _maxLength);
}
diff --git a/engines/xeen/character.cpp b/engines/xeen/character.cpp
index 4d791b9c7b..dc2b65885e 100644
--- a/engines/xeen/character.cpp
+++ b/engines/xeen/character.cpp
@@ -149,7 +149,7 @@ bool InventoryItems::discardItem(int itemIndex) {
sort();
return true;
- }
+ }
}
return true;
@@ -277,7 +277,7 @@ Common::String WeaponItems::getFullDescription(int itemIndex, int displayNum) {
displayNum,
Res.WEAPON_NAMES[i._id],
!i._bonusFlags ? "" : Res.BONUS_NAMES[i._bonusFlags & ITEMFLAG_BONUS_MASK],
- (i._bonusFlags & (ITEMFLAG_BROKEN | ITEMFLAG_CURSED)) ||
+ (i._bonusFlags & (ITEMFLAG_BROKEN | ITEMFLAG_CURSED)) ||
!i._bonusFlags ? "\b " : ""
);
}
@@ -315,7 +315,7 @@ Common::String WeaponItems::getAttributes(XeenItem &item, const Common::String &
maxVal += Res.METAL_DAMAGE[item._material - 37];
toHit = Common::String::format("%+d", Res.METAL_DAMAGE_PERCENT[item._material - 37]);
}
-
+
physDamage = Common::String::format(Res.DAMAGE_X_TO_Y, minVal, maxVal);
// Next handle elemental/attribute damage
@@ -471,7 +471,7 @@ Common::String ArmorItems::getAttributes(XeenItem &item, const Common::String &c
int eCategory = ELEM_FIRE;
while (eCategory < ELEM_MAGIC && Res.ELEMENTAL_CATEGORIES[eCategory] < item._material)
++eCategory;
-
+
elemResist = Common::String::format(Res.ATTR_XY_BONUS, resistence,
Res.ELEMENTAL_NAMES[eCategory]);
}
@@ -617,7 +617,7 @@ Common::String MiscItems::getAttributes(XeenItem &item, const Common::String &cl
}
return Common::String::format(Res.ITEM_DETAILS, classes.c_str(),
- Res.FIELD_NONE, Res.FIELD_NONE, Res.FIELD_NONE, Res.FIELD_NONE, Res.FIELD_NONE,
+ Res.FIELD_NONE, Res.FIELD_NONE, Res.FIELD_NONE, Res.FIELD_NONE, Res.FIELD_NONE,
Res.FIELD_NONE, specialPower.c_str());
}
/*------------------------------------------------------------------------*/
@@ -743,7 +743,7 @@ void Character::synchronize(Common::Serializer &s) {
_level.synchronize(s);
s.syncAsByte(_birthDay);
s.syncAsByte(_tempAge);
-
+
// Synchronize the skill list
for (int idx = 0; idx < 18; ++idx)
s.syncAsByte(_skills[idx]);
@@ -760,7 +760,7 @@ void Character::synchronize(Common::Serializer &s) {
// Synchronize spell list
for (int i = 0; i < MAX_SPELLS_PER_CLASS - 1; ++i)
- s.syncAsByte(_spells[i]);
+ s.syncAsByte(_spells[i]);
s.syncAsByte(_lloydMap);
s.syncAsByte(_lloydPosition.x);
s.syncAsByte(_lloydPosition.y);
@@ -784,7 +784,7 @@ void Character::synchronize(Common::Serializer &s) {
_poisonResistence.synchronize(s);
_energyResistence.synchronize(s);
_magicResistence.synchronize(s);
-
+
for (int i = 0; i < 16; ++i)
s.syncAsByte(_conditions[i]);
@@ -1025,7 +1025,7 @@ bool Character::noActions() {
case IN_LOVE:
case DRUNK: {
Common::String msg = Common::String::format(Res.IN_NO_CONDITION, _name.c_str());
- ErrorScroll::show(Party::_vm, msg,
+ ErrorScroll::show(Party::_vm, msg,
Party::_vm->_mode == 17 ? WT_2 : WT_NONFREEZED_WAIT);
return true;
}
@@ -1170,7 +1170,7 @@ int Character::itemScan(int itemId) const {
if (itemId > 10 && item._material < 37) {
int mIndex = item.getElementalCategory() + 11;
-
+
if (mIndex == itemId)
result += Res.ELEMENTAL_RESISTENCES[item._material];
}
@@ -1754,7 +1754,7 @@ int Character::makeItem(int p1, int itemIndex, int p3) {
void Character::addHitPoints(int amount) {
Interface &intf = *Party::_vm->_interface;
Common::fill(&intf._charFX[0], &intf._charFX[MAX_ACTIVE_PARTY], 0);
-
+
if (!isDead()) {
int maxHp = getMaxHP();
if (_currentHp <= maxHp) {
@@ -1824,11 +1824,11 @@ int Character::getClassCategory() const {
case CLASS_ARCHER:
case CLASS_SORCERER:
return 1;
-
+
case CLASS_DRUID:
case CLASS_RANGER:
return 2;
-
+
default:
return 0;
}
diff --git a/engines/xeen/combat.cpp b/engines/xeen/combat.cpp
index 9282b4e75b..bc01e87618 100644
--- a/engines/xeen/combat.cpp
+++ b/engines/xeen/combat.cpp
@@ -139,7 +139,7 @@ void Combat::giveCharDamage(int damage, DamageType attackType, int charIndex) {
bool breakFlag = false;
screen.closeWindows();
-
+
int idx = (int)party._activeParty.size();
if (!scripts._v2) {
for (idx = 0; idx < (int)party._activeParty.size(); ++idx) {
@@ -611,7 +611,7 @@ void Combat::monstersAttack() {
intf.draw3d(true);
events.pollEventsAndWait();
} while (!_vm->shouldQuit() && intf._isAttacking);
-
+
endAttack();
if (_vm->_mode != MODE_COMBAT) {
@@ -645,7 +645,7 @@ void Combat::setupMonsterAttack(int monsterDataIndex, const Common::Point &pt) {
for (int idx = 0; idx < 36; ++idx) {
if (_gmonHit[idx] != -1) {
int result = stopAttack(pt - party._mazePosition);
- if (result) {
+ if (result) {
_monstersAttacking = true;
_gmonHit[idx] = monsterDataIndex;
@@ -877,7 +877,7 @@ void Combat::doMonsterTurn(int monsterId) {
if (cond >= PARALYZED && cond <= ERADICATED) {
Common::Array<int> ableChars;
bool skip = false;
-
+
for (uint idx = 0; idx < _combatParty.size() && !skip; ++idx) {
switch (_combatParty[idx]->worstCondition()) {
case PARALYZED:
@@ -976,7 +976,7 @@ int Combat::stopAttack(const Common::Point &diffPt) {
}
}
return dir == DIR_WEST ? diffPt.x * -1 + 1 : 1;
-
+
} else if (diffPt.y <= 0) {
for (int y = diffPt.y; y < 0; ++y) {
int v = map.mazeLookup(Common::Point(mazePos.x, mazePos.y + y), 4);
@@ -1032,7 +1032,7 @@ int Combat::stopAttack(const Common::Point &diffPt) {
return 0;
}
return dir == DIR_WEST ? diffPt.x * -1 + 1 : 1;
-
+
} else if (diffPt.y <= 0) {
for (int y = diffPt.y; y < 0; ++y) {
int v = map.mazeLookup(Common::Point(mazePos.x, mazePos.y + y), 0, 0x8000);
@@ -1256,7 +1256,7 @@ void Combat::attack(Character &c, RangeType rangeType) {
break;
}
}
- }
+ }
} else {
Common::fill(&_elemPow[0], &_elemPow[PARTY_AND_MONSTERS], ELEM_FIRE);
damage = 0;
@@ -1392,7 +1392,7 @@ void Combat::attack2(int damage, RangeType rangeType) {
damage += 100;
if (monster._damageType == DT_SLEEP || monster._damageType == DT_DRAGONSLEEP)
monster._damageType = DT_PHYSICAL;
-
+
if ((!rangeType || !_damageType) && _attackWeaponId != 34) {
if (monsterData._phsyicalResistence != 0) {
if (monsterData._phsyicalResistence == 100) {
@@ -1446,14 +1446,14 @@ void Combat::attack2(int damage, RangeType rangeType) {
break;
}
}
-
+
if (damage < 1) {
sound.playSound(_missVoc, 1);
sound.playFX(6);
} else {
_monsterScale[_monsterIndex] = getDamageScale(damage);
intf.draw3d(true);
-
+
sound.stopSound();
File powVoc(Common::String::format("pow%d.voc",
POW_WEAPON_VOCS[_attackWeaponId]));
@@ -1506,7 +1506,7 @@ void Combat::attack2(int damage, RangeType rangeType) {
if (MONSTER_ITEM_RANGES[itemDrop] >= _vm->getRandomNumber(1, 100)) {
Character tempChar;
int category = tempChar.makeItem(itemDrop, 0, 0);
-
+
switch (category) {
case CATEGORY_WEAPON:
for (int idx = 0; idx < MAX_TREASURE_ITEMS; ++idx) {
@@ -1609,7 +1609,7 @@ bool Combat::hitMonster(Character &c, RangeType rangeType) {
getWeaponDamage(c, rangeType);
int chance = c.statBonus(c.getStat(ACCURACY)) + _hitChanceBonus;
int divisor = 0;
-
+
switch (c._class) {
case CLASS_KNIGHT:
case CLASS_BARBARIAN:
@@ -1758,7 +1758,7 @@ int Combat::getMonsterResistence(RangeType rangeType) {
else if (material < 34)
resistence = monsterData._energyResistence;
else
- resistence = monsterData._magicResistence;
+ resistence = monsterData._magicResistence;
}
}
@@ -1767,7 +1767,7 @@ int Combat::getMonsterResistence(RangeType rangeType) {
return 0;
else
return ((100 - resistence) * damage) / 100;
- }
+ }
return damage;
}
@@ -1840,7 +1840,7 @@ void Combat::multiAttack(int powNum) {
int monsterIndex = _monsterIndex;
int monster2Attack = _monster2Attack;
bool attackedFlag = false;
-
+
Common::Array<int> attackMonsters;
for (int idx = 0; idx < 3; ++idx) {
if (_attackMonsters[idx] != -1)
diff --git a/engines/xeen/dialogs.cpp b/engines/xeen/dialogs.cpp
index 1924c69cf4..3304689416 100644
--- a/engines/xeen/dialogs.cpp
+++ b/engines/xeen/dialogs.cpp
@@ -45,7 +45,7 @@ void ButtonContainer::restoreButtons() {
_buttons = _savedButtons.pop();
}
-void ButtonContainer::addButton(const Common::Rect &bounds, int val,
+void ButtonContainer::addButton(const Common::Rect &bounds, int val,
SpriteResource *sprites) {
_buttons.push_back(UIButton(bounds, val, sprites, true));
}
@@ -80,7 +80,7 @@ bool ButtonContainer::checkEvents(XeenEngine *vm) {
} else if (events.isKeyPending()) {
Common::KeyState keyState;
events.getKey(keyState);
-
+
_buttonValue = keyState.keycode;
if (_buttonValue == Common::KEYCODE_KP8)
_buttonValue = Common::KEYCODE_UP;
@@ -137,7 +137,7 @@ void CreditsScreen::show(XeenEngine *vm) {
void CreditsScreen::execute() {
Screen &screen = *_vm->_screen;
EventsManager &events = *_vm->_events;
-
+
// Handle drawing the credits screen
doScroll(true, false);
screen._windows[GAME_WINDOW].close();
@@ -145,7 +145,7 @@ void CreditsScreen::execute() {
screen.loadBackground("marb.raw");
screen._windows[0].writeString(Res.CREDITS);
doScroll(false, false);
-
+
events.setCursor(0);
screen._windows[0].update();
clearButtons();
diff --git a/engines/xeen/dialogs_automap.cpp b/engines/xeen/dialogs_automap.cpp
index 652494742a..16ce225515 100644
--- a/engines/xeen/dialogs_automap.cpp
+++ b/engines/xeen/dialogs_automap.cpp
@@ -76,7 +76,7 @@ void AutoMapDialog::execute() {
// MazeData &mazeData = map.mazeDataCurrent();
bool drawFlag = true;
int v;
-
+
events.updateGameCounter();
do {
if (drawFlag)
@@ -106,7 +106,7 @@ void AutoMapDialog::execute() {
}
}
-
+
for (int yp = 38, yDiff = pt.y + 7; yp < 166; yp += 8, --yDiff) {
for (int xp = 80, xDiff = -7; xp < 240; xp += 10, ++xDiff) {
v = map.mazeLookup(Common::Point(xDiff, yDiff), 8);
@@ -128,7 +128,7 @@ void AutoMapDialog::execute() {
map._tileSprites.draw(screen, 0, Common::Point(xp, yp));
}
}
-
+
// Draw thinner ground tiles on the left edge of the map
for (int yp = 43, yDiff = pt.y + 7; yp < 171; yp += 8, --yDiff) {
v = map.mazeLookup(Common::Point(pt.x - 8, yDiff), 0, 0xffff);
@@ -137,13 +137,13 @@ void AutoMapDialog::execute() {
map._tileSprites.draw(screen, 36 + map.mazeData()._surfaceTypes[
map._currentSurfaceId], Common::Point(75, yp));
}
-
+
// Draw thin tile portion on top-left corner of map
v = map.mazeLookup(Common::Point(pt.x - 8, pt.y + 8), 0, 0xffff);
if (v != INVALID_CELL && map._currentSurfaceId != 0 && map._currentSteppedOn)
map._tileSprites.draw(screen, 36 + map.mazeData()._surfaceTypes[
map._currentSurfaceId], Common::Point(75, 35));
-
+
// Draw any thin tiles at the very top of the map
for (int xp = 85, xDiff = pt.x - 7; xp < 245; xp += 10, ++xDiff) {
v = map.mazeLookup(Common::Point(xDiff, pt.y + 8), 0, 0xffff);
@@ -165,7 +165,7 @@ void AutoMapDialog::execute() {
}
// Draw walls on left and top edges of map
- for (int xp = 80, yp = 158, xDiff = pt.x - 7, yDiff = pt.y - 8; xp < 250;
+ for (int xp = 80, yp = 158, xDiff = pt.x - 7, yDiff = pt.y - 8; xp < 250;
xp += 10, yp -= 8, ++xDiff, ++yDiff) {
// Draw walls on left edge of map
v = map.mazeLookup(Common::Point(pt.x - 8, yDiff), 12);
@@ -385,7 +385,7 @@ void AutoMapDialog::execute() {
map._tileSprites.draw(screen, frame, Common::Point(xp, yp));
}
}
-
+
// Draw overlay on cells that haven't been stepped on yet
for (int yDiff = pt.y + 7, yp = 38; yp < 166; --yDiff, yp += 8) {
for (int xp = 80, xDiff = pt.x - 7; xp < 240; xp += 10, ++xDiff) {
diff --git a/engines/xeen/dialogs_char_info.cpp b/engines/xeen/dialogs_char_info.cpp
index 6dd79618ed..23f089b93e 100644
--- a/engines/xeen/dialogs_char_info.cpp
+++ b/engines/xeen/dialogs_char_info.cpp
@@ -206,7 +206,7 @@ void CharacterInfo::execute(int charIndex) {
goto exit;
}
} while (!_vm->shouldQuit());
-exit:
+exit:
w.close();
intf.unhighlightChar();
_vm->_mode = oldMode;
@@ -400,7 +400,7 @@ bool CharacterInfo::expandStat(int attrib, const Character &c) {
stat1, stat2);
bounds.setHeight(42);
break;
-
+
case 11:
// Spell Points
stat1 = c._currentSp;
diff --git a/engines/xeen/dialogs_error.h b/engines/xeen/dialogs_error.h
index 56e30bc9de..3657cd01be 100644
--- a/engines/xeen/dialogs_error.h
+++ b/engines/xeen/dialogs_error.h
@@ -28,7 +28,7 @@
namespace Xeen {
-enum ErrorWaitType { WT_FREEZE_WAIT = 0, WT_NONFREEZED_WAIT = 1,
+enum ErrorWaitType { WT_FREEZE_WAIT = 0, WT_NONFREEZED_WAIT = 1,
WT_2 = 2, WT_3 = 3 };
class ErrorDialog : public ButtonContainer {
@@ -43,7 +43,7 @@ public:
class ErrorScroll {
public:
- static void show(XeenEngine *vm, const Common::String &msg,
+ static void show(XeenEngine *vm, const Common::String &msg,
ErrorWaitType waitType = WT_FREEZE_WAIT);
};
diff --git a/engines/xeen/dialogs_info.cpp b/engines/xeen/dialogs_info.cpp
index 945567c9b2..d0cd7c5243 100644
--- a/engines/xeen/dialogs_info.cpp
+++ b/engines/xeen/dialogs_info.cpp
@@ -37,7 +37,7 @@ void InfoDialog::execute() {
EventsManager &events = *_vm->_events;
Interface &intf = *_vm->_interface;
Party &party = *_vm->_party;
-
+
protectionText();
Common::String statusText = "";
for (uint idx = 0; idx < _lines.size(); ++idx)
diff --git a/engines/xeen/dialogs_input.cpp b/engines/xeen/dialogs_input.cpp
index 943b038d09..5376fb7c46 100644
--- a/engines/xeen/dialogs_input.cpp
+++ b/engines/xeen/dialogs_input.cpp
@@ -26,7 +26,7 @@
namespace Xeen {
-int Input::show(XeenEngine *vm, Window *window, Common::String &line,
+int Input::show(XeenEngine *vm, Window *window, Common::String &line,
uint maxLen, int maxWidth, bool isNumeric) {
Input *dlg = new Input(vm, window);
int result = dlg->getString(line, maxLen, maxWidth, isNumeric);
@@ -129,7 +129,7 @@ int StringInput::show(XeenEngine *vm, bool type, const Common::String &msg1,
return result;
}
-int StringInput::execute(bool type, const Common::String &expected,
+int StringInput::execute(bool type, const Common::String &expected,
const Common::String &title, int opcode) {
Interface &intf = *_vm->_interface;
Screen &screen = *_vm->_screen;
@@ -211,7 +211,7 @@ int Choose123::execute(int numOptions) {
Interface &intf = *_vm->_interface;
Screen &screen = *_vm->_screen;
Town &town = *_vm->_town;
-
+
Mode oldMode = _vm->_mode;
_vm->_mode = MODE_DIALOG_123;
diff --git a/engines/xeen/dialogs_input.h b/engines/xeen/dialogs_input.h
index ce159c77a3..8221320b22 100644
--- a/engines/xeen/dialogs_input.h
+++ b/engines/xeen/dialogs_input.h
@@ -45,7 +45,7 @@ protected:
Input(XeenEngine *vm, Window *window) : ButtonContainer(vm), _window(window) {}
public:
- static int show(XeenEngine *vm, Window *window, Common::String &line,
+ static int show(XeenEngine *vm, Window *window, Common::String &line,
uint maxLen, int maxWidth, bool isNumeric = false);
};
@@ -53,10 +53,10 @@ class StringInput : public Input {
protected:
StringInput(XeenEngine *vm);
- int execute(bool type, const Common::String &expected,
+ int execute(bool type, const Common::String &expected,
const Common::String &title, int opcode);
public:
- static int show(XeenEngine *vm, bool type, const Common::String &msg1,
+ static int show(XeenEngine *vm, bool type, const Common::String &msg1,
const Common::String &msg2, int opcode);
};
diff --git a/engines/xeen/dialogs_items.cpp b/engines/xeen/dialogs_items.cpp
index 56de6a5b17..227b5708e7 100644
--- a/engines/xeen/dialogs_items.cpp
+++ b/engines/xeen/dialogs_items.cpp
@@ -42,9 +42,9 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) {
Interface &intf = *_vm->_interface;
Party &party = *_vm->_party;
Screen &screen = *_vm->_screen;
-
+
Character *startingChar = c;
- ItemCategory category = mode == ITEMMODE_RECHARGE || mode == ITEMMODE_COMBAT ?
+ ItemCategory category = mode == ITEMMODE_RECHARGE || mode == ITEMMODE_COMBAT ?
CATEGORY_MISC : CATEGORY_WEAPON;
int varA = mode == ITEMMODE_COMBAT ? 1 : 0;
if (varA != 0)
@@ -88,7 +88,7 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) {
Res.BTN_SELL, Res.BTN_IDENTIFY, Res.BTN_FIX);
} else if (mode != ITEMMODE_ENCHANT && mode != ITEMMODE_RECHARGE && mode != ITEMMODE_TO_GOLD) {
msg = Common::String::format(Res.ITEMS_DIALOG_TEXT1,
- category == 3 ? Res.BTN_USE : Res.BTN_EQUIP,
+ category == 3 ? Res.BTN_USE : Res.BTN_EQUIP,
Res.BTN_REMOVE, Res.BTN_DISCARD, Res.BTN_QUEST);
} else if (mode == ITEMMODE_ENCHANT) {
msg = Common::String::format(Res.ITEMS_DIALOG_TEXT2, Res.BTN_ENCHANT);
@@ -138,7 +138,7 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) {
_itemsDrawList[idx]._y = 10 + idx * 9;
switch (category) {
- case CATEGORY_WEAPON:
+ case CATEGORY_WEAPON:
case CATEGORY_ARMOR:
case CATEGORY_ACCESSORY: {
XeenItem &i = (category == CATEGORY_WEAPON) ? c->_weapons[idx] :
@@ -147,7 +147,7 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) {
if (i._id) {
if (mode == ITEMMODE_CHAR_INFO || mode == ITEMMODE_8
|| mode == ITEMMODE_ENCHANT || mode == ITEMMODE_RECHARGE) {
- lines.push_back(Common::String::format(Res.ITEMS_DIALOG_LINE1,
+ lines.push_back(Common::String::format(Res.ITEMS_DIALOG_LINE1,
arr[idx], idx + 1,
c->_items[category].getFullDescription(idx, arr[idx]).c_str()));
} else {
@@ -225,7 +225,7 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) {
// Original uses var in this block that's never set?!
const int v1 = 0;
screen._windows[30].writeString(Common::String::format(Res.AVAILABLE_GOLD_COST,
- Res.CATEGORY_NAMES[category],
+ Res.CATEGORY_NAMES[category],
v1 ? "" : "s", party._gold,
lines[0].c_str(), lines[1].c_str(), lines[2].c_str(), lines[3].c_str(),
lines[4].c_str(), lines[5].c_str(), lines[6].c_str(), lines[7].c_str(),
@@ -287,8 +287,8 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) {
default:
break;
}
- }
-
+ }
+
// If it's time to do an item action, take care of it
if (actionIndex >= 0) {
int result = doItemOptions(*c, actionIndex, itemIndex, category, mode);
@@ -307,7 +307,7 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) {
// Otherwise, result and continue showing dialog
actionIndex = -1;
}
-
+
// Wait for a selection
_buttonValue = 0;
while (!_vm->shouldQuit() && !_buttonValue) {
@@ -332,11 +332,11 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) {
case Common::KEYCODE_F4:
case Common::KEYCODE_F5:
case Common::KEYCODE_F6:
- if (!varA && mode != ITEMMODE_3 && mode != ITEMMODE_ENCHANT
+ if (!varA && mode != ITEMMODE_3 && mode != ITEMMODE_ENCHANT
&& mode != ITEMMODE_RECHARGE && mode != ITEMMODE_TO_GOLD
&& party._mazeId != 0) {
_buttonValue -= Common::KEYCODE_F1;
-
+
if (_buttonValue < (int)(_vm->_mode == MODE_COMBAT ?
combat._combatParty.size() : party._activeParty.size())) {
// Character number is valid
@@ -391,7 +391,7 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) {
// Select an item
if (mode == ITEMMODE_3)
break;
-
+
_buttonValue -= Common::KEYCODE_1;
if (_buttonValue != itemIndex) {
// Check whether the new selection has an associated item
@@ -431,7 +431,7 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) {
if (mode == ITEMMODE_CHAR_INFO)
actionIndex = 3;
break;
-
+
case Common::KEYCODE_e:
if (mode == ITEMMODE_CHAR_INFO || mode == ITEMMODE_ENCHANT ||
mode == ITEMMODE_TO_GOLD) {
@@ -447,7 +447,7 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) {
mode = ITEMMODE_REPAIR;
c = startingChar;
redrawFlag = REDRAW_TEXT;
- }
+ }
break;
case Common::KEYCODE_g:
@@ -653,7 +653,7 @@ void ItemsDialog::setEquipmentIcons() {
i._frame = 11;
break;
}
-
+
default:
break;
}
@@ -684,7 +684,7 @@ int ItemsDialog::calcItemCost(Character *c, int itemIndex, ItemsMode mode,
default:
break;
}
-
+
switch (category) {
case CATEGORY_WEAPON:
case CATEGORY_ARMOR:
@@ -694,7 +694,7 @@ int ItemsDialog::calcItemCost(Character *c, int itemIndex, ItemsMode mode,
(mode == 1 ? c->_armor[itemIndex] : c->_accessories[itemIndex]);
amount1 = (mode == 0) ? Res.WEAPON_BASE_COSTS[i._id] :
(mode == 1 ? Res.ARMOR_BASE_COSTS[i._id] : Res.ACCESSORY_BASE_COSTS[i._id]);
-
+
if (i._material > 36 && i._material < 59) {
switch (i._material) {
case 37:
@@ -719,7 +719,7 @@ int ItemsDialog::calcItemCost(Character *c, int itemIndex, ItemsMode mode,
amount2 = Res.ELEMENTAL_DAMAGE[i._material] * 100;
else if (i._material > 58)
amount3 = Res.ELEMENTAL_DAMAGE[i._material - 59 + 7] * 100;
-
+
switch (mode) {
case ITEMMODE_BLACKSMITH:
case ITEMMODE_2:
@@ -741,7 +741,7 @@ int ItemsDialog::calcItemCost(Character *c, int itemIndex, ItemsMode mode,
XeenItem &i = c->_misc[itemIndex];
amount1 = Res.MISC_MATERIAL_COSTS[i._material];
amount4 = Res.MISC_BASE_COSTS[i._id];
-
+
switch (mode) {
case ITEMMODE_BLACKSMITH:
case ITEMMODE_2:
diff --git a/engines/xeen/dialogs_items.h b/engines/xeen/dialogs_items.h
index c161b0721b..cfa6818843 100644
--- a/engines/xeen/dialogs_items.h
+++ b/engines/xeen/dialogs_items.h
@@ -31,7 +31,7 @@ namespace Xeen {
enum ItemsMode {
ITEMMODE_CHAR_INFO = 0, ITEMMODE_BLACKSMITH = 1, ITEMMODE_2 = 2, ITEMMODE_3 = 3,
- ITEMMODE_RECHARGE = 4, ITEMMODE_5 = 5, ITEMMODE_ENCHANT = 6, ITEMMODE_COMBAT = 7, ITEMMODE_8 = 8,
+ ITEMMODE_RECHARGE = 4, ITEMMODE_5 = 5, ITEMMODE_ENCHANT = 6, ITEMMODE_COMBAT = 7, ITEMMODE_8 = 8,
ITEMMODE_REPAIR = 9, ITEMMODE_IDENTIFY = 10, ITEMMODE_TO_GOLD = 11
};
@@ -73,10 +73,10 @@ private:
/**
* Calculate the cost of an item
*/
- int calcItemCost(Character *c, int itemIndex, ItemsMode mode, int skillLevel,
+ int calcItemCost(Character *c, int itemIndex, ItemsMode mode, int skillLevel,
ItemCategory category);
- int doItemOptions(Character &c, int actionIndex, int itemIndex,
+ int doItemOptions(Character &c, int actionIndex, int itemIndex,
ItemCategory category, ItemsMode mode);
void itemToGold(Character &c, int itemIndex, ItemCategory category, ItemsMode mode);
diff --git a/engines/xeen/dialogs_party.cpp b/engines/xeen/dialogs_party.cpp
index 9457173e0e..3dc47d1e9b 100644
--- a/engines/xeen/dialogs_party.cpp
+++ b/engines/xeen/dialogs_party.cpp
@@ -32,7 +32,7 @@
namespace Xeen {
-PartyDialog::PartyDialog(XeenEngine *vm) : ButtonContainer(vm),
+PartyDialog::PartyDialog(XeenEngine *vm) : ButtonContainer(vm),
PartyDrawer(vm), _vm(vm) {
initDrawStructs();
}
@@ -264,7 +264,7 @@ void PartyDialog::execute() {
startingCharChanged(startingChar);
}
break;
-
+
default:
break;
}
@@ -579,11 +579,11 @@ void PartyDialog::createChar() {
_buttons[destAttrib + 10]._bounds.left,
_buttons[destAttrib + 10]._bounds.top));
w.update();
-
+
SWAP(attribs[srcAttrib], attribs[destAttrib]);
checkClass(attribs, allowedClasses);
classId = -1;
- selectedClass = newCharDetails(attribs, allowedClasses,
+ selectedClass = newCharDetails(attribs, allowedClasses,
race, sex, classId, selectedClass, msg);
} else {
icons.draw(w, srcAttrib * 2 + 10, Common::Point(
@@ -642,7 +642,7 @@ void PartyDialog::createChar() {
if (_buttonValue != Common::KEYCODE_PAGEDOWN) {
selectedClass = newCharDetails(attribs, allowedClasses,
race, sex, classId, selectedClass, msg);
-
+
for (int idx = 0; idx < 7; ++idx)
icons.draw(w, 10 + idx * 2, Common::Point(168, 19 + idx * 24));
for (int idx = 0; idx < 10; ++idx)
@@ -656,7 +656,7 @@ void PartyDialog::createChar() {
icons.draw(w, 61, Common::Point(220, 19));
icons.draw(w, 64, Common::Point(220, 155));
icons.draw(w, 65, Common::Point(220, 170));
-
+
party._roster[freeCharList[charIndex]]._faceSprites->draw(w, 0,
Common::Point(27, 102));
@@ -675,7 +675,7 @@ void PartyDialog::createChar() {
}
}
- // Move to next available class, or if the code block above resulted in
+ // Move to next available class, or if the code block above resulted in
// selectedClass being -1, move to select the first available class
for (int tempClass = selectedClass + 1; tempClass <= CLASS_RANGER; ++tempClass) {
if (allowedClasses[tempClass]) {
@@ -686,7 +686,7 @@ void PartyDialog::createChar() {
printSelectionArrow(icons, selectedClass);
} while (!_vm->shouldQuit() && _buttonValue != Common::KEYCODE_ESCAPE);
-
+
_vm->_mode = oldMode;
}
@@ -707,7 +707,7 @@ int PartyDialog::selectCharacter(bool isDelete, int firstDisplayChar) {
w.update();
saveButtons();
- addButton(Common::Rect(225, isDelete ? 120 : 84, 249, isDelete ? 140 : 104),
+ addButton(Common::Rect(225, isDelete ? 120 : 84, 249, isDelete ? 140 : 104),
Common::KEYCODE_ESCAPE, &iconSprites);
addButton(Common::Rect(16, 16, 48, 48), Common::KEYCODE_1);
addButton(Common::Rect(117, 16, 149, 48), Common::KEYCODE_2);
@@ -755,7 +755,7 @@ int PartyDialog::selectCharacter(bool isDelete, int firstDisplayChar) {
default:
break;
}
- }
+ }
w.close();
restoreButtons();
@@ -802,7 +802,7 @@ void PartyDialog::checkClass(const uint attribs[TOTAL_ATTRIBUTES], bool allowedC
}
int PartyDialog::newCharDetails(const uint attribs[TOTAL_ATTRIBUTES],
- bool allowedClasses[TOTAL_CLASSES], Race race, Sex sex, int classId,
+ bool allowedClasses[TOTAL_CLASSES], Race race, Sex sex, int classId,
int selectedClass, Common::String &msg) {
int foundClass = -1;
Common::String skillStr, classStr, raceSkillStr;
diff --git a/engines/xeen/dialogs_party.h b/engines/xeen/dialogs_party.h
index 17ec4fd300..84b98579e1 100644
--- a/engines/xeen/dialogs_party.h
+++ b/engines/xeen/dialogs_party.h
@@ -78,7 +78,7 @@ private:
/**
* Return details of the generated character
*/
- int newCharDetails(const uint attribs[TOTAL_ATTRIBUTES],
+ int newCharDetails(const uint attribs[TOTAL_ATTRIBUTES],
bool allowedClasses[TOTAL_CLASSES], Race race, Sex sex, int classId,
int selectedClass, Common::String &msg);
diff --git a/engines/xeen/dialogs_query.cpp b/engines/xeen/dialogs_query.cpp
index d8dfea116a..76083a8170 100644
--- a/engines/xeen/dialogs_query.cpp
+++ b/engines/xeen/dialogs_query.cpp
@@ -127,7 +127,7 @@ bool YesNo::execute(bool type, bool townFlag) {
while (!_vm->shouldQuit()) {
events.updateGameCounter();
-
+
if (town.isActive()) {
town.drawTownAnim(townFlag);
//numFrames = 3;
diff --git a/engines/xeen/dialogs_spells.cpp b/engines/xeen/dialogs_spells.cpp
index 47125c4fa7..f5dfe65b00 100644
--- a/engines/xeen/dialogs_spells.cpp
+++ b/engines/xeen/dialogs_spells.cpp
@@ -30,7 +30,7 @@
namespace Xeen {
-Character *SpellsDialog::show(XeenEngine *vm, ButtonContainer *priorDialog,
+Character *SpellsDialog::show(XeenEngine *vm, ButtonContainer *priorDialog,
Character *c, int isCasting) {
SpellsDialog *dlg = new SpellsDialog(vm);
Character *result = dlg->execute(priorDialog, c, isCasting);
@@ -228,7 +228,7 @@ Character *SpellsDialog::execute(ButtonContainer *priorDialog, Character *c, int
int spellCost = spells.calcSpellCost(spellId, expenseFactor);
if (isCasting) {
- selection = newSelection;
+ selection = newSelection;
} else {
Common::String spellName = _spells[newSelection]._name;
Common::String msg = (castingCopy & 0x80) ?
@@ -499,7 +499,7 @@ int CastSpell::execute(Character *&c) {
int spCost = spells.calcSpellPoints(spellId, c->getCurrentLevel());
w.writeString(Common::String::format(Res.CAST_SPELL_DETAILS,
- c->_name.c_str(), spells._spellNames[spellId].c_str(),
+ c->_name.c_str(), spells._spellNames[spellId].c_str(),
spCost, gemCost, c->_currentSp));
drawButtons(&screen);
w.update();
@@ -586,7 +586,7 @@ Character *SpellOnWho::show(XeenEngine *vm, int spellId) {
if (result == -1)
return nullptr;
-
+
Combat &combat = *vm->_combat;
Party &party = *vm->_party;
return combat._combatMode == 2 ? combat._combatParty[result] :
@@ -851,7 +851,7 @@ bool LloydsBeacon::execute() {
c._lloydMap = party._mazeId;
c._lloydPosition = party._mazePosition;
c._lloydSide = isDarkCc ? 1 : 0;
-
+
_buttonValue = Common::KEYCODE_ESCAPE;
break;
}
@@ -959,7 +959,7 @@ int TownPortal::execute() {
townNames[3].c_str(), townNames[4].c_str()
));
w.update();
-
+
// Get the town number
int townNumber;
Common::String num;
diff --git a/engines/xeen/dialogs_spells.h b/engines/xeen/dialogs_spells.h
index 3ccdb836a3..c1aeadc68d 100644
--- a/engines/xeen/dialogs_spells.h
+++ b/engines/xeen/dialogs_spells.h
@@ -53,7 +53,7 @@ private:
const char *setSpellText(Character *c, int isCasting);
public:
- static Character *show(XeenEngine *vm, ButtonContainer *priorDialog,
+ static Character *show(XeenEngine *vm, ButtonContainer *priorDialog,
Character *c, int isCasting);
};
diff --git a/engines/xeen/files.cpp b/engines/xeen/files.cpp
index ff4a56fcb0..06dd3d12a7 100644
--- a/engines/xeen/files.cpp
+++ b/engines/xeen/files.cpp
@@ -118,14 +118,14 @@ int BaseCCArchive::listMembers(Common::ArchiveMemberList &list) const {
/*------------------------------------------------------------------------*/
-CCArchive::CCArchive(const Common::String &filename, bool encoded):
+CCArchive::CCArchive(const Common::String &filename, bool encoded):
BaseCCArchive(), _filename(filename), _encoded(encoded) {
File f(filename);
loadIndex(&f);
}
-CCArchive::CCArchive(const Common::String &filename, const Common::String &prefix,
- bool encoded): BaseCCArchive(), _filename(filename),
+CCArchive::CCArchive(const Common::String &filename, const Common::String &prefix,
+ bool encoded): BaseCCArchive(), _filename(filename),
_prefix(prefix), _encoded(encoded) {
_prefix.toLowercase();
File f(filename);
diff --git a/engines/xeen/files.h b/engines/xeen/files.h
index d73eb281c6..ffb703374b 100644
--- a/engines/xeen/files.h
+++ b/engines/xeen/files.h
@@ -32,7 +32,7 @@
namespace Xeen {
-enum ArchiveType {
+enum ArchiveType {
ANY_ARCHIVE = -1, GAME_ARCHIVE = 0, ALTSIDE_ARCHIVE = 1,
INTRO_ARCHIVE = 2
};
diff --git a/engines/xeen/font.cpp b/engines/xeen/font.cpp
index 459a334da0..ae2f37fa2d 100644
--- a/engines/xeen/font.cpp
+++ b/engines/xeen/font.cpp
@@ -26,7 +26,7 @@
namespace Xeen {
-FontSurface::FontSurface() : XSurface(), _fontData(nullptr), _bgColor(DEFAULT_BG_COLOR),
+FontSurface::FontSurface() : XSurface(), _fontData(nullptr), _bgColor(DEFAULT_BG_COLOR),
_fontReduced(false),_fontJustify(JUSTIFY_NONE), _msgWraps(false) {
setTextColor(0);
}
@@ -60,7 +60,7 @@ const char *FontSurface::writeString(const Common::String &s, const Common::Rect
for (;;) {
const char *msgStartP = _displayString;
_msgWraps = false;
-
+
// Get the size of the string that can be displayed on the line
int xp = _fontJustify == JUSTIFY_CENTER ? bounds.left : _writePos.x;
while (!getNextCharWidth(xp)) {
@@ -94,7 +94,7 @@ const char *FontSurface::writeString(const Common::String &s, const Common::Rect
break;
}
} else {
- // Found word break, find end of previous word
+ // Found word break, find end of previous word
while (endP > _displayString && (*endP & 0x7f) == ' ')
--endP;
@@ -136,7 +136,7 @@ const char *FontSurface::writeString(const Common::String &s, const Common::Rect
// Main character display loop
while (_displayString <= displayEnd) {
char c = getNextChar();
-
+
if (c == ' ') {
_writePos.x += _fontReduced ? 3 : 4;
} else if (c == '\r') {
@@ -281,7 +281,7 @@ bool FontSurface::newLine(const Common::Rect &bounds) {
_msgWraps = false;
_writePos.x = bounds.left;
-
+
int hv = _fontReduced ? 9 : 10;
_writePos.y += hv;
diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp
index 3c3b572518..d95f613241 100644
--- a/engines/xeen/interface.cpp
+++ b/engines/xeen/interface.cpp
@@ -60,7 +60,7 @@ void PartyDrawer::drawParty(bool updateFlag) {
Character &ps = inCombat ? *combat._combatParty[idx] : party._activeParty[idx];
Condition charCondition = ps.worstCondition();
int charFrame = Res.FACE_CONDITION_FRAMES[charCondition];
-
+
SpriteResource *sprites = (charFrame > 4) ? &_dseFace : ps._faceSprites;
if (charFrame > 4)
charFrame -= 5;
@@ -130,7 +130,7 @@ void PartyDrawer::resetHighlight() {
}
/*------------------------------------------------------------------------*/
-Interface::Interface(XeenEngine *vm) : ButtonContainer(vm), InterfaceMap(vm),
+Interface::Interface(XeenEngine *vm) : ButtonContainer(vm), InterfaceMap(vm),
PartyDrawer(vm), _vm(vm) {
_buttonsLoaded = false;
_intrIndex1 = 0;
@@ -285,7 +285,7 @@ void Interface::perform() {
return;
if (_buttonValue == Common::KEYCODE_SPACE) {
- int lookupId = map.mazeLookup(party._mazePosition,
+ int lookupId = map.mazeLookup(party._mazePosition,
Res.WALL_SHIFTS[party._mazeDirection][2]);
bool eventsFlag = true;
@@ -497,7 +497,7 @@ void Interface::perform() {
case Common::KEYCODE_b:
chargeStep();
-
+
if (map.getCell(2) < map.mazeData()._difficulties._wallNoPass
&& !map._isOutdoors) {
switch (party._mazeDirection) {
@@ -623,7 +623,7 @@ void Interface::stepTime() {
Party &party = *_vm->_party;
Sound &sound = *_vm->_sound;
doStepCode();
-
+
if (++party._ctr24 == 24)
party._ctr24 = 0;
@@ -652,11 +652,11 @@ void Interface::doStepCode() {
switch (surfaceId) {
case SURFTYPE_SPACE:
- // Wheeze.. can't breathe in space! Explosive decompression, here we come
+ // Wheeze.. can't breathe in space! Explosive decompression, here we come
party._partyDead = true;
break;
case SURFTYPE_LAVA:
- // It burns, it burns!
+ // It burns, it burns!
damage = 100;
party._damageType = DT_FIRE;
break;
@@ -740,8 +740,8 @@ void Interface::startFalling(bool flag) {
map._isOutdoors) {
map.getNewMaze();
}
- }
-
+ }
+
if (isDarkCc) {
switch (party._mazeId - 25) {
case 0:
@@ -944,7 +944,7 @@ bool Interface::checkMoveDirection(int key) {
default:
break;
}
-
+
map.getCell(7);
int startSurfaceId = map._currentSurfaceId;
int surfaceId;
@@ -1064,7 +1064,7 @@ void Interface::rest() {
for (int idx = 0; idx < 10; ++idx) {
chargeStep();
draw3d(true);
-
+
if (_vm->_mode == MODE_1) {
_vm->_mode = oldMode;
return;
@@ -1178,7 +1178,7 @@ void Interface::bash(const Common::Point &pt, Direction direction) {
}
party._activeParty[charNum1 - 1].subtractHitPoints(2);
- _charPowSprites.draw(screen._windows[0], 0,
+ _charPowSprites.draw(screen._windows[0], 0,
Common::Point(Res.CHAR_FACES_X[charNum1 - 1], 150));
screen._windows[0].update();
@@ -1246,7 +1246,7 @@ void Interface::draw3d(bool updateFlag, bool skipDelay) {
Party &party = *_vm->_party;
Screen &screen = *_vm->_screen;
Scripts &scripts = *_vm->_scripts;
-
+
if (screen._windows[11]._enabled)
return;
@@ -1286,7 +1286,7 @@ void Interface::draw3d(bool updateFlag, bool skipDelay) {
if (combat._attackMonsters[0] != -1 || combat._attackMonsters[1] != -1
|| combat._attackMonsters[2] != -1) {
- if ((_vm->_mode == MODE_1 || _vm->_mode == MODE_SLEEPING) &&
+ if ((_vm->_mode == MODE_1 || _vm->_mode == MODE_SLEEPING) &&
!combat._monstersAttacking && !_charsShooting && combat._moveMonsters) {
doCombat();
if (scripts._eventSkipped)
@@ -1862,7 +1862,7 @@ void Interface::doCombat() {
Sound &sound = *_vm->_sound;
bool upDoorText = _upDoorText;
bool reloadMap = false;
-
+
_upDoorText = false;
combat._combatMode = COMBATMODE_2;
_vm->_mode = MODE_COMBAT;
@@ -1974,7 +1974,7 @@ void Interface::doCombat() {
combat.block();
nextChar();
break;
-
+
case Common::KEYCODE_c: {
// Cast spell
int spellId = CastSpell::show(_vm);
@@ -2005,7 +2005,7 @@ void Interface::doCombat() {
FightOptions::show(_vm);
highlightChar(combat._whosTurn);
break;
-
+
case Common::KEYCODE_q:
// Quick Reference dialog
QuickReferenceDialog::show(_vm);
@@ -2054,7 +2054,7 @@ void Interface::doCombat() {
case Common::KEYCODE_RIGHT:
// Rotate party direction left or right
if (_buttonValue == Common::KEYCODE_LEFT) {
- party._mazeDirection = (party._mazeDirection == DIR_NORTH) ?
+ party._mazeDirection = (party._mazeDirection == DIR_NORTH) ?
DIR_WEST : (Direction)((int)party._mazeDirection - 1);
} else {
party._mazeDirection = (party._mazeDirection == DIR_WEST) ?
diff --git a/engines/xeen/interface_map.cpp b/engines/xeen/interface_map.cpp
index 0244e3e081..1ada1c6e77 100644
--- a/engines/xeen/interface_map.cpp
+++ b/engines/xeen/interface_map.cpp
@@ -27,7 +27,7 @@
namespace Xeen {
-OutdoorDrawList::OutdoorDrawList() : _sky1(_data[0]), _sky2(_data[1]),
+OutdoorDrawList::OutdoorDrawList() : _sky1(_data[0]), _sky2(_data[1]),
_groundSprite(_data[2]), _attackImgs1(&_data[124]), _attackImgs2(&_data[95]),
_attackImgs3(&_data[76]), _attackImgs4(&_data[53]), _groundTiles(&_data[3]) {
_data[0] = DrawStruct(0, 8, 8);
@@ -166,21 +166,21 @@ OutdoorDrawList::OutdoorDrawList() : _sky1(_data[0]), _sky2(_data[1]),
/*------------------------------------------------------------------------*/
-IndoorDrawList::IndoorDrawList() :
+IndoorDrawList::IndoorDrawList() :
_sky1(_data[0]), _sky2(_data[1]), _ground(_data[2]), _horizon(_data[28]),
- _swl_0F1R(_data[146]), _swl_0F1L(_data[144]), _swl_1F1R(_data[134]),
- _swl_1F1L(_data[133]), _swl_2F2R(_data[110]), _swl_2F1R(_data[109]),
- _swl_2F1L(_data[108]), _swl_2F2L(_data[107]), _swl_3F1R(_data[ 78]),
+ _swl_0F1R(_data[146]), _swl_0F1L(_data[144]), _swl_1F1R(_data[134]),
+ _swl_1F1L(_data[133]), _swl_2F2R(_data[110]), _swl_2F1R(_data[109]),
+ _swl_2F1L(_data[108]), _swl_2F2L(_data[107]), _swl_3F1R(_data[ 78]),
_swl_3F2R(_data[ 77]), _swl_3F3R(_data[ 76]), _swl_3F4R(_data[ 75]),
- _swl_3F1L(_data[ 74]), _swl_3F2L(_data[ 73]), _swl_3F3L(_data[ 72]),
- _swl_3F4L(_data[ 71]), _swl_4F4R(_data[ 33]), _swl_4F3R(_data[ 34]),
+ _swl_3F1L(_data[ 74]), _swl_3F2L(_data[ 73]), _swl_3F3L(_data[ 72]),
+ _swl_3F4L(_data[ 71]), _swl_4F4R(_data[ 33]), _swl_4F3R(_data[ 34]),
_swl_4F2R(_data[ 35]), _swl_4F1R(_data[ 36]), _swl_4F1L(_data[ 32]),
_swl_4F2L(_data[ 31]), _swl_4F3L(_data[ 30]), _swl_4F4L(_data[ 29]),
- _fwl_4F4R(_data[ 45]), _fwl_4F3R(_data[ 44]), _fwl_4F2R(_data[ 43]),
- _fwl_4F1R(_data[ 42]), _fwl_4F( _data[ 41]), _fwl_4F1L(_data[ 40]),
+ _fwl_4F4R(_data[ 45]), _fwl_4F3R(_data[ 44]), _fwl_4F2R(_data[ 43]),
+ _fwl_4F1R(_data[ 42]), _fwl_4F( _data[ 41]), _fwl_4F1L(_data[ 40]),
_fwl_4F2L(_data[ 39]), _fwl_4F3L(_data[ 38]), _fwl_4F4L(_data[ 37]),
- _fwl_2F1R(_data[121]), _fwl_2F( _data[120]), _fwl_2F1L(_data[119]),
- _fwl_3F2R(_data[ 91]), _fwl_3F1R(_data[ 90]), _fwl_3F( _data[ 89]),
+ _fwl_2F1R(_data[121]), _fwl_2F( _data[120]), _fwl_2F1L(_data[119]),
+ _fwl_3F2R(_data[ 91]), _fwl_3F1R(_data[ 90]), _fwl_3F( _data[ 89]),
_fwl_3F1L(_data[ 88]), _fwl_3F2L(_data[ 87]), _fwl_1F( _data[147]),
_fwl_1F1R(_data[145]), _fwl_1F1L(_data[143]),
_groundTiles(&_data[3]),
@@ -2608,7 +2608,7 @@ void InterfaceMap::setIndoorsMonsters() {
}
}
-void InterfaceMap::setMonsterSprite(DrawStruct &drawStruct, MazeMonster &monster, SpriteResource *sprites,
+void InterfaceMap::setMonsterSprite(DrawStruct &drawStruct, MazeMonster &monster, SpriteResource *sprites,
int frame, int defaultY) {
MonsterStruct &monsterData = *monster._monsterData;
bool flying = monsterData._flying;
@@ -3533,7 +3533,7 @@ void InterfaceMap::drawIndoors() {
drawStruct._sprites = sprites.empty() ? (SpriteResource *)nullptr : &sprites;
surfaceId = map.mazeData()._surfaceTypes[map._currentSurfaceId];
- if (surfaceId == SURFTYPE_WATER || surfaceId == SURFTYPE_LAVA ||
+ if (surfaceId == SURFTYPE_WATER || surfaceId == SURFTYPE_LAVA ||
surfaceId == SURFTYPE_SEWER) {
drawStruct._frame = Res.DRAW_FRAMES[cellIndex][_flipWater ? 1 : 0];
drawStruct._flags = _flipWater ? SPRFLAG_HORIZ_FLIPPED : 0;
@@ -4343,7 +4343,7 @@ void InterfaceMap::drawIndoors() {
_vm->_party->_mazeDirection][_vm->_party->_mazePosition.y]
);
map.cellFlagLookup(pt);
-
+
_indoorList._sky2._sprites = &map._skySprites[0];
} else {
_indoorList._sky2._sprites = _indoorList[0]._sprites;
@@ -4362,7 +4362,7 @@ void InterfaceMap::drawIndoors() {
if (_vm->_combat->_shooting[idx])
_isAttacking = true;
}
-
+
_charsShooting = _isAttacking;
}
diff --git a/engines/xeen/interface_map.h b/engines/xeen/interface_map.h
index 2189aacec1..47a7bad963 100644
--- a/engines/xeen/interface_map.h
+++ b/engines/xeen/interface_map.h
@@ -44,9 +44,9 @@ public:
public:
OutdoorDrawList();
- DrawStruct &operator[](int idx) {
+ DrawStruct &operator[](int idx) {
assert(idx < size());
- return _data[idx];
+ return _data[idx];
}
int size() const { return 132; }
@@ -80,9 +80,9 @@ public:
public:
IndoorDrawList();
- DrawStruct &operator[](int idx) {
+ DrawStruct &operator[](int idx) {
assert(idx < size());
- return _data[idx];
+ return _data[idx];
}
int size() const { return 170; }
@@ -99,7 +99,7 @@ private:
* Helper method for setIndoorsMonsters to set a draw structure
* with the deatils for a given monster
*/
- void setMonsterSprite(DrawStruct &drawStruct, MazeMonster &monster,
+ void setMonsterSprite(DrawStruct &drawStruct, MazeMonster &monster,
SpriteResource *sprites, int frame, int defaultY);
protected:
int8 _wp[20];
diff --git a/engines/xeen/map.cpp b/engines/xeen/map.cpp
index a7be48af8f..f904344206 100644
--- a/engines/xeen/map.cpp
+++ b/engines/xeen/map.cpp
@@ -80,13 +80,13 @@ MonsterStruct::MonsterStruct(Common::String name, int experience, int hp, int ac
bool flying, int imageNumber, int loopAnimation, int animationEffect,
int fx, Common::String attackVoc):
_name(name), _experience(experience), _hp(hp), _accuracy(accuracy),
- _speed(speed), _numberOfAttacks(numberOfAttacks), _hatesClass(hatesClass),
- _strikes(strikes), _dmgPerStrike(dmgPerStrike), _attackType(attackType),
- _specialAttack(specialAttack), _hitChance(hitChance), _rangeAttack(rangeAttack),
- _monsterType(monsterType), _fireResistence(fireResistence),
+ _speed(speed), _numberOfAttacks(numberOfAttacks), _hatesClass(hatesClass),
+ _strikes(strikes), _dmgPerStrike(dmgPerStrike), _attackType(attackType),
+ _specialAttack(specialAttack), _hitChance(hitChance), _rangeAttack(rangeAttack),
+ _monsterType(monsterType), _fireResistence(fireResistence),
_electricityResistence(electricityResistence), _coldResistence(coldResistence),
_poisonResistence(poisonResistence), _energyResistence(energyResistence),
- _magicResistence(magicResistence), _phsyicalResistence(phsyicalResistence),
+ _magicResistence(magicResistence), _phsyicalResistence(phsyicalResistence),
_field29(field29), _gold(gold), _gems(gems), _itemDrop(itemDrop),
_flying(flying), _imageNumber(imageNumber), _loopAnimation(loopAnimation),
_animationEffect(animationEffect), _fx(fx), _attackVoc(attackVoc) {
@@ -127,7 +127,7 @@ void MonsterStruct::synchronize(Common::SeekableReadStream &s) {
_loopAnimation = s.readByte();
_animationEffect = s.readByte();
_fx = s.readByte();
-
+
char attackVoc[10];
s.read(attackVoc, 9);
attackVoc[9] = '\0';
@@ -640,7 +640,7 @@ MazeObject::MazeObject() {
_direction = DIR_NORTH;
_flipped = false;
_sprites = nullptr;
-}
+}
/*------------------------------------------------------------------------*/
@@ -1040,7 +1040,7 @@ void Map::load(int mapId) {
}
// TODO: Switch setting flags that don't seem to ever be used
-
+
// Reload the monster data for the main maze that we're loading
mapId = _vm->_party->_mazeId;
Common::String filename = Common::String::format("maze%c%03d.mob",
@@ -1062,7 +1062,7 @@ void Map::load(int mapId) {
filename = "085.obj";
_mobData._objectSprites[0]._spriteId = 85;
} else {
- filename = Common::String::format("%03d.%cbj",
+ filename = Common::String::format("%03d.%cbj",
_mobData._objectSprites[i]._spriteId,
_mobData._objectSprites[i]._spriteId >= 100 ? '0' : 'o');
}
@@ -1074,7 +1074,7 @@ void Map::load(int mapId) {
// Load sprites for the monsters
for (uint i = 0; i < _mobData._monsterSprites.size(); ++i) {
- ArchiveType archiveType =
+ ArchiveType archiveType =
_mobData._monsterSprites[i]._spriteId == 91 && _vm->getGameID() == GType_WorldOfXeen ?
ALTSIDE_ARCHIVE : GAME_ARCHIVE;
@@ -1101,7 +1101,7 @@ void Map::load(int mapId) {
outdoorList._sky1._sprites = &_skySprites[0];
outdoorList._sky2._sprites = &_skySprites[0];
outdoorList._groundSprite._sprites = &_groundSprites;
-
+
for (int i = 0; i < TOTAL_SURFACES; ++i) {
_wallSprites._surfaces[i].clear();
@@ -1195,7 +1195,7 @@ void Map::load(int mapId) {
indoorList._fwl_1F._sprites = &_wallSprites._fwl1;
indoorList._fwl_1F1R._sprites = &_wallSprites._fwl1;
- indoorList._fwl_1F1L._sprites = &_wallSprites._fwl1;
+ indoorList._fwl_1F1L._sprites = &_wallSprites._fwl1;
indoorList._horizon._sprites = &_wallSprites._fwl1;
indoorList._ground._sprites = &_groundSprites;
@@ -1384,7 +1384,7 @@ void Map::setCellSurfaceFlags(const Common::Point &pt, int bits) {
void Map::setWall(const Common::Point &pt, Direction dir, int v) {
const int XOR_MASKS[4] = { 0xFFF, 0xF0FF, 0xFF0F, 0xFFF0 };
mazeLookup(pt, 0, 0);
-
+
Common::Point mapPos(pt.x & 15, pt.y & 15);
MazeWallLayers &wallLayer = _mazeData[_mazeDataIndex]._wallData[mapPos.y][mapPos.x];
wallLayer._data &= XOR_MASKS[dir];
@@ -1412,7 +1412,7 @@ int Map::getCell(int idx) {
}
_currentWall = INVALID_CELL;
return INVALID_CELL;
- }
+ }
_mazeDataIndex = 0;
while (_mazeData[_mazeDataIndex]._mazeId != mapId)
@@ -1447,7 +1447,7 @@ int Map::getCell(int idx) {
_currentWall = INVALID_CELL;
return INVALID_CELL;
}
-
+
_mazeDataIndex = 0;
while (_mazeData[_mazeDataIndex]._mazeId != mapId)
++_mazeDataIndex;
@@ -1503,7 +1503,7 @@ int Map::getCell(int idx) {
_currentTile = 0;
}
} else {
- if (!mapId)
+ if (!mapId)
return 0;
if (pt.x > 31 || pt.y > 31)
@@ -1523,7 +1523,7 @@ void Map::loadSky() {
party._isNight = party._minutes < (5 * 60) || party._minutes >= (21 * 60);
_skySprites[0].load(((party._mazeId >= 89 && party._mazeId <= 112) ||
- party._mazeId == 128 || party._mazeId == 129) || !party._isNight
+ party._mazeId == 128 || party._mazeId == 129) || !party._isNight
? "sky.sky" : "night.sky");
}
diff --git a/engines/xeen/map.h b/engines/xeen/map.h
index 2c02e6ed2f..d0b63ec146 100644
--- a/engines/xeen/map.h
+++ b/engines/xeen/map.h
@@ -138,7 +138,7 @@ public:
enum MazeFlags {
OUTFLAG_GRATE = 0x80, OUTFLAG_DRAIN = 0x20, OUTFLAG_OBJECT_EXISTS = 0x08,
INFLAG_INSIDE = 0x08, FLAG_AUTOEXECUTE_EVENT = 0x10,
- RESTRICTION_ETHERIALIZE = 0x40, RESTRICTION_80 = 0x80,
+ RESTRICTION_ETHERIALIZE = 0x40, RESTRICTION_80 = 0x80,
RESTRICTION_TOWN_PORTAL = 0x100, RESTRICTION_SUPER_SHELTER = 0x200,
RESTRICTION_TIME_DISTORTION = 0x400, RESTRICTION_LLOYDS_BEACON = 0x800,
RESTRICTION_TELPORT = 0x1000, RESTRICTION_2000 = 0x2000,
@@ -150,7 +150,7 @@ enum MazeFlags {
enum MazeFlags2 { FLAG_IS_OUTDOORS = 0x8000, FLAG_IS_DARK = 0x4000 };
enum SurfaceType {
- SURFTYPE_DEFAULT = 0,
+ SURFTYPE_DEFAULT = 0,
SURFTYPE_WATER = 0, SURFTYPE_DIRT = 1, SURFTYPE_GRASS = 2,
SURFTYPE_SNOW = 3, SURFTYPE_SWAMP = 4, SURFTYPE_LAVA = 5,
SURFTYPE_DESERT = 6, SURFTYPE_ROAD = 7, SURFTYPE_DWATER = 8,
diff --git a/engines/xeen/music.h b/engines/xeen/music.h
index bf77398885..207ec991a3 100644
--- a/engines/xeen/music.h
+++ b/engines/xeen/music.h
@@ -361,7 +361,7 @@ public:
* Plays a song
*/
void playSong(const Common::String &name, int param = 0);
-
+
/**
* Plays a song
*/
diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp
index 292ac01d2c..abf2c5cfed 100644
--- a/engines/xeen/party.cpp
+++ b/engines/xeen/party.cpp
@@ -364,7 +364,7 @@ void Party::changeTime(int numMinutes) {
if (player._conditions[PARALYZED] && _vm->getRandomNumber(4) == 1)
player._conditions[PARALYZED]--;
}
-
+
if (killed)
_vm->_interface->drawParty(true);
@@ -375,7 +375,7 @@ void Party::changeTime(int numMinutes) {
void Party::addTime(int numMinutes) {
int day = _day;
_minutes += numMinutes;
-
+
// If the total minutes has exceeded a day, move to next one
while (_minutes >= (24 * 60)) {
_minutes -= 24 * 60;
@@ -464,7 +464,7 @@ void Party::handleLight() {
}
}
- _vm->_interface->_intrIndex1 = _lightCount ||
+ _vm->_interface->_intrIndex1 = _lightCount ||
(map.mazeData()._mazeFlags2 & FLAG_IS_DARK) == 0 ? 4 : 0;
}
@@ -599,7 +599,7 @@ void Party::giveTreasure() {
// Important item, so clear a slot for it
_activeParty[0]._weapons[INV_ITEMS_TOTAL - 1].clear();
} else {
- // Otherwise, clear all the remaining treasure items,
+ // Otherwise, clear all the remaining treasure items,
// since all the party's packs are full
for (int idx = 0; idx < MAX_TREASURE_ITEMS; ++idx) {
_treasure._weapons[idx].clear();
@@ -657,7 +657,7 @@ void Party::giveTreasure() {
while (!events.isKeyMousePressed() && events.timeElapsed() < 1)
events.pollEventsAndWait();
} while (!_vm->shouldQuit() && events.timeElapsed() == 1);
-
+
if (_vm->_mode != MODE_COMBAT)
_vm->_mode = MODE_1;
@@ -666,7 +666,7 @@ void Party::giveTreasure() {
_gems += _treasure._gems;
_treasure._gold = 0;
_treasure._gems = 0;
-
+
_treasure._hasItems = false;
for (int idx = 0; idx < MAX_TREASURE_ITEMS; ++idx) {
_treasure._weapons[idx].clear();
@@ -698,7 +698,7 @@ void Party::giveTreasureToCharacter(Character &c, ItemCategory category, int ite
Window &w = screen._windows[10];
XeenItem &treasureItem = _treasure._categories[category][itemIndex];
sound.playFX(20);
-
+
if (treasureItem._id < 82) {
// Copy item into the character's inventory
c._items[category][INV_ITEMS_TOTAL - 1] = treasureItem;
diff --git a/engines/xeen/party.h b/engines/xeen/party.h
index d753b75801..3febf5bfe1 100644
--- a/engines/xeen/party.h
+++ b/engines/xeen/party.h
@@ -34,7 +34,7 @@
namespace Xeen {
-enum Direction {
+enum Direction {
DIR_NORTH = 0, DIR_EAST = 1, DIR_SOUTH = 2, DIR_WEST = 3, DIR_ALL = 4
};
diff --git a/engines/xeen/resources.cpp b/engines/xeen/resources.cpp
index b2d8c6d495..4f576835f6 100644
--- a/engines/xeen/resources.cpp
+++ b/engines/xeen/resources.cpp
@@ -87,7 +87,7 @@ const char *const Resources::CREDITS =
"\t190Clayton Retzer\n"
"\t190David Vela\003""c";
-const char *const Resources::OPTIONS_TITLE =
+const char *const Resources::OPTIONS_TITLE =
"\x0D\x01\003""c\014""dMight and Magic Options\n"
"World of Xeen\x02\n"
"\v117Copyright (c) 1993 NWC, Inc.\n"
@@ -316,13 +316,13 @@ const char *const Resources::SEX_NAMES[2] = { "Male", "Female" };
const char *const Resources::SKILL_NAMES[18] = {
"Thievery", "Arms Master", "Astrologer", "Body Builder", "Cartographer",
- "Crusader", "Direction Sense", "Linguist", "Merchant", "Mountaineer",
+ "Crusader", "Direction Sense", "Linguist", "Merchant", "Mountaineer",
"Navigator", "Path Finder", "Prayer Master", "Prestidigitator",
"Swimmer", "Tracker", "Spot Secret Door", "Danger Sense"
};
const char *const Resources::CLASS_NAMES[11] = {
- "Knight", "Paladin", "Archer", "Cleric", "Sorcerer", "Robber",
+ "Knight", "Paladin", "Archer", "Cleric", "Sorcerer", "Robber",
"Ninja", "Barbarian", "Druid", "Ranger", nullptr
};
@@ -331,8 +331,8 @@ const uint Resources::CLASS_EXP_LEVELS[10] = {
};
const char *const Resources::CONDITION_NAMES[17] = {
- "Cursed", "Heart Broken", "Weak", "Poisoned", "Diseased",
- "Insane", "In Love", "Drunk", "Asleep", "Depressed", "Confused",
+ "Cursed", "Heart Broken", "Weak", "Poisoned", "Diseased",
+ "Insane", "In Love", "Drunk", "Asleep", "Depressed", "Confused",
"Paralyzed", "Unconscious", "Dead", "Stone", "Eradicated", "Good"
};
@@ -353,28 +353,28 @@ const char *const Resources::HEROISM = "\n\t020Heroism\t095%+d";
const char *const Resources::IN_PARTY = "\014""15In Party\014""d";
const char *const Resources::PARTY_DETAILS = "\015\003l\002\014""00"
- "\013""001""\011""035%s"
- "\013""009""\011""035%s"
- "\013""017""\011""035%s"
- "\013""025""\011""035%s"
- "\013""001""\011""136%s"
- "\013""009""\011""136%s"
- "\013""017""\011""136%s"
- "\013""025""\011""136%s"
- "\013""044""\011""035%s"
- "\013""052""\011""035%s"
- "\013""060""\011""035%s"
- "\013""068""\011""035%s"
- "\013""044""\011""136%s"
- "\013""052""\011""136%s"
- "\013""060""\011""136%s"
+ "\013""001""\011""035%s"
+ "\013""009""\011""035%s"
+ "\013""017""\011""035%s"
+ "\013""025""\011""035%s"
+ "\013""001""\011""136%s"
+ "\013""009""\011""136%s"
+ "\013""017""\011""136%s"
+ "\013""025""\011""136%s"
+ "\013""044""\011""035%s"
+ "\013""052""\011""035%s"
+ "\013""060""\011""035%s"
+ "\013""068""\011""035%s"
+ "\013""044""\011""136%s"
+ "\013""052""\011""136%s"
+ "\013""060""\011""136%s"
"\013""068""\011""136%s";
const char *const Resources::PARTY_DIALOG_TEXT =
"%s\x2\x3""c\v106\t013Up\t048Down\t083\f37D\fdel\t118\f37R\fdem"
"\t153\f37C\fdreate\t188E\f37x\fdit\x1";
-const int Resources::FACE_CONDITION_FRAMES[17] = {
- 2, 2, 2, 1, 1, 4, 4, 4, 3, 2, 4, 3, 3, 5, 6, 7, 0
+const int Resources::FACE_CONDITION_FRAMES[17] = {
+ 2, 2, 2, 1, 1, 4, 4, 4, 3, 2, 4, 3, 3, 5, 6, 7, 0
};
const int Resources::CHAR_FACES_X[6] = { 10, 45, 81, 117, 153, 189 };
@@ -386,7 +386,7 @@ const char *const Resources::NO_ONE_TO_ADVENTURE_WITH = "You have no one to adve
const char *const Resources::YOUR_ROSTER_IS_FULL = "Your Roster is full!";
const byte Resources::BACKGROUND_XLAT[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xF7, 0xFF, 0x09, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xF9, 0xFF, 0x07, 0x00, 0x00, 0x00,
@@ -409,7 +409,7 @@ const int8 Resources::SCREEN_POSITIONING_X[4][48] = {
{
-1, 0, 0, 0, 1, -1, 0, 0, 0, 1, -2, -1,
-1, 0, 0, 0, 1, 1, 2, -4, -3, -3, -2, -2,
- -1, -1, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4,
+ -1, -1, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4,
-3, -2, -1, 0, 0, 1, 2, 3, -4, 4, 0, 0
}, {
0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2,
@@ -422,7 +422,7 @@ const int8 Resources::SCREEN_POSITIONING_X[4][48] = {
1, 1, 0, 0, 0, -1, -1, -2, -2, -3, -3, -4,
3, 2, 1, 0, 0, -1, -2, -3, 4, -4, 0, 0
}, {
- 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -2, -2,
+ 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -3, -3, -3, -3, -3,
-3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
-4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 0, -1
@@ -513,9 +513,9 @@ const byte Resources::WALL_SHIFTS[4][48] = {
};
const int Resources::DRAW_NUMBERS[25] = {
- 36, 37, 38, 43, 42, 41,
- 39, 20, 22, 24, 33, 31,
- 29, 26, 10, 11, 18, 16,
+ 36, 37, 38, 43, 42, 41,
+ 39, 20, 22, 24, 33, 31,
+ 29, 26, 10, 11, 18, 16,
13, 5, 9, 6, 0, 4, 1
};
@@ -578,8 +578,8 @@ const int Resources::AGE_RANGES_ADJUST[2][10] = {
};
const uint Resources::STAT_VALUES[24] = {
- 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 25, 30, 35, 40,
- 50, 75, 100, 125, 150, 175, 200, 225, 250,
+ 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 25, 30, 35, 40,
+ 50, 75, 100, 125, 150, 175, 200, 225, 250,
};
const int Resources::STAT_BONUSES[24] = {
@@ -777,7 +777,7 @@ const char *const Resources::TEMPLE_TEXT =
"\x03l\x09""000\x0B""090Gold\x03r\x09""000%s"
"\x02\x03""c\x0B""122\x09""040ESC\x01";
-const char *const Resources::EXPERIENCE_FOR_LEVEL =
+const char *const Resources::EXPERIENCE_FOR_LEVEL =
"%s needs %lu experience for level %u.";
const char *const Resources::LEARNED_ALL = "%s has learned all we can teach!";
@@ -832,7 +832,7 @@ const char *const Resources::BUY_SPELLS =
"\x09""012\x0C""37B\x0C""duy Spells\n"
"\x09""012\x0C""37S\x0C""dpell Info";
-const char *const Resources::GUILD_OPTIONS =
+const char *const Resources::GUILD_OPTIONS =
"\x0D\x0C""00\x03""c\x0B""000\x09""000Guild Options for%s"
"\x03l\x09""000\x0B""090Gold"
"\x03r\x09""000%s\x02\x03""c\x0B""122\x09""040ESC\x01";
@@ -870,8 +870,8 @@ const int Resources::SPELL_COSTS[77] = {
};
const int Resources::DARK_SPELL_RANGES[12][2] = {
- { 0, 20 }, { 16, 35 }, { 27, 37 }, { 29, 39 },
- { 0, 17 }, { 14, 34 }, { 26, 37 }, { 29, 39 },
+ { 0, 20 }, { 16, 35 }, { 27, 37 }, { 29, 39 },
+ { 0, 17 }, { 14, 34 }, { 26, 37 }, { 29, 39 },
{ 0, 20 }, { 16, 35 }, { 27, 37 }, { 29, 39 }
};
@@ -948,7 +948,7 @@ const char *const Resources::SPELLS_PRESS_A_KEY =
const char *const Resources::SPELLS_PURCHASE =
"\x3l\xB""000\x9""000\xC""d%s Do you wish to purchase "
- "\xC""09%s\xC""d for %u?";
+ "\xC""09%s\xC""d for %u?";
const char *const Resources::MAP_TEXT =
"\x3""c\xB""000\x9""000%s\x3l\xB""139"
@@ -970,7 +970,7 @@ const char *const Resources::LEVITATE_TEXT = "%c%sLevitate%s";
const char *const Resources::WALK_ON_WATER_TEXT = "%c%sWalk on Water";
-const char *const Resources::GAME_INFORMATION =
+const char *const Resources::GAME_INFORMATION =
"\xD\x3""c\x9""000\xB""001\xC""37%s of Xeen\xC""d\n"
"Game Information\n"
"\n"
@@ -1043,7 +1043,7 @@ const char *const Resources::LEVEL_TEXT =
"\x3r\x9""054%u\x3l\x9""058/ %u\n"
"\x3""c%u Attack%s/Round\x1";
-const char *const Resources::RESISTENCES_TEXT =
+const char *const Resources::RESISTENCES_TEXT =
"\x2\x3""c%s\x3l\n"
"\x9""020Fire\x9""100%u\n"
"\x9""020Cold\x9""100%u\n"
@@ -1072,7 +1072,7 @@ const char *const Resources::FOOD_TEXT =
const char *const Resources::EXCHANGE_WITH_WHOM = "\t010\v005Exchange with whom?";
-const char *const Resources::QUICK_REF_LINE =
+const char *const Resources::QUICK_REF_LINE =
"\xB%3d\x9""007%u)\x9""027%s\x9""110%c%c%c\x3r\x9""160\xC%02u%u\xC""d"
"\x3l\x9""170\xC%02u%d\xC""d\x9""208\xC%02u%u\xC""d\x9""247\xC"
"%02u%u\xC""d\x9""270\xC%02u%c%c%c%c\xC""d";
@@ -1118,11 +1118,11 @@ const char *const Resources::BONUS_NAMES[7] = {
};
const char *const Resources::WEAPON_NAMES[35] = {
- nullptr, "long sword ", "short sword ", "broad sword ", "scimitar ",
- "cutlass ", "sabre ", "club ", "hand axe ", "katana ", "nunchakas ",
- "wakazashi ", "dagger ", "mace ", "flail ", "cudgel ", "maul ", "spear ",
+ nullptr, "long sword ", "short sword ", "broad sword ", "scimitar ",
+ "cutlass ", "sabre ", "club ", "hand axe ", "katana ", "nunchakas ",
+ "wakazashi ", "dagger ", "mace ", "flail ", "cudgel ", "maul ", "spear ",
"bardiche ", "glaive ", "halberd ", "pike ", "flamberge ", "trident ",
- "staff ", "hammer ", "naginata ", "battle axe ", "grand axe ", "great axe ",
+ "staff ", "hammer ", "naginata ", "battle axe ", "grand axe ", "great axe ",
"short bow ", "long bow ", "crossbow ", "sling ", "Xeen Slayer Sword"
};
@@ -1139,8 +1139,8 @@ const char *const Resources::ACCESSORY_NAMES[11] = {
const char *const Resources::MISC_NAMES[22] = {
nullptr, "rod ", "jewel ", "gem ", "box ", "orb ", "horn ", "coin ",
- "wand ", "whistle ", "potion ", "scroll ", "RogueVM",
- "bogusg", "bogus", "bogus", "bogus", "bogus",
+ "wand ", "whistle ", "potion ", "scroll ", "RogueVM",
+ "bogusg", "bogus", "bogus", "bogus", "bogus",
"bogus", "bogus", "bogus", "bogus"
};
@@ -1283,10 +1283,10 @@ const int Resources::ITEM_SKILL_DIVISORS[4] = { 1, 2, 100, 10 };
const int Resources::RESTRICTION_OFFSETS[4] = { 0, 35, 49, 60 };
const int Resources::ITEM_RESTRICTIONS[86] = {
- 0, 86, 86, 86, 86, 86, 86, 0, 6, 239, 239, 239, 2, 4, 4, 4, 4,
- 6, 70, 70, 70, 70, 94, 70, 0, 4, 239, 86, 86, 86, 70, 70, 70, 70,
- 0, 0, 0, 68, 100, 116, 125, 255, 255, 85, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 86, 86, 86, 86, 86, 86, 0, 6, 239, 239, 239, 2, 4, 4, 4, 4,
+ 6, 70, 70, 70, 70, 94, 70, 0, 4, 239, 86, 86, 86, 70, 70, 70, 70,
+ 0, 0, 0, 68, 100, 116, 125, 255, 255, 85, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
@@ -1326,7 +1326,7 @@ const char *const Resources::WHICH_ITEM = "\t010\v005%s which item?";
const char *const Resources::WHATS_YOUR_HURRY = "\v007What's your hurry?\n"
"Wait till you get out of here!";
-const char *const Resources::USE_ITEM_IN_COMBAT =
+const char *const Resources::USE_ITEM_IN_COMBAT =
"\v007To use an item in Combat, invoke the Use command on your turn!";
const char *const Resources::NO_SPECIAL_ABILITIES = "\v005\x3""c%s\fdhas no special abilities!";
@@ -1422,7 +1422,7 @@ const char *const Resources::QUEST_ITEMS_DATA =
"\f04 * \fd%s\n"
"\f04 * \fd%s\n"
"\f04 * \fd%s";
-const char *const Resources::CURRENT_QUESTS_DATA =
+const char *const Resources::CURRENT_QUESTS_DATA =
"\r\x1\fd\x3""c\t000\v000Current Quests\x3l\x2\n"
"%s\n"
"\n"
@@ -1441,7 +1441,7 @@ const char *const Resources::AUTO_NOTES_DATA =
"%s\x3l\n"
"%s\x3l";
-const char *const Resources::REST_COMPLETE =
+const char *const Resources::REST_COMPLETE =
"\v000\t0008 hours pass. Rest complete.\n"
"%s\n"
"%d food consumed.";
@@ -1460,10 +1460,10 @@ const char *const Resources::YOUR_PARTY_IS_FULL = "\v007Your party is full!";
const char *const Resources::HAS_SLAYER_SWORD =
"\v000\t000This character has the Xeen Slayer Sword and cannot be deleted!";
-const char *const Resources::SURE_TO_DELETE_CHAR =
+const char *const Resources::SURE_TO_DELETE_CHAR =
"Are you sure you want to delete %s the %s?";
-const char *const Resources::CREATE_CHAR_DETAILS =
+const char *const Resources::CREATE_CHAR_DETAILS =
"\f04\x3""c\x2\t144\v119\f37R\f04oll\t144\v149\f37C\f04reate"
"\t144\v179\f37ESC\f04\x3l\x1\t195\v021\f37M\f04gt"
"\t195\v045\f37I\f04nt\t195\v069\f37P\f04er\t195\v093\f37E\f04nd"
@@ -1514,7 +1514,7 @@ const char *const Resources::COMBAT_DETAILS = "\r\f00\x3""c\v000\t000\x2""Combat
const char *Resources::NOT_ENOUGH_TO_CAST = "\x3""c\v010Not enough %s to Cast %s";
const char *Resources::SPELL_CAST_COMPONENTS[2] = { "Spell Points", "Gems" };
-const char *const Resources::CAST_SPELL_DETAILS =
+const char *const Resources::CAST_SPELL_DETAILS =
"\r\x2\x3""c\v122\t013\f37C\fdast\t040\f37N\fdew"
"\t067ESC\x1\t000\v000\x3""cCast Spell\n"
"\n"
@@ -1586,7 +1586,7 @@ const int Resources::TOWN_MAP_NUMBERS[2][5] = {
{ 28, 29, 30, 31, 32 }, { 29, 31, 33, 35, 37 }
};
-const char *const Resources::MONSTER_DETAILS =
+const char *const Resources::MONSTER_DETAILS =
"\x3l\n"
"%s\x3""c\t100%s\t140%u\t180%u\x3r\t000%s";
diff --git a/engines/xeen/saves.cpp b/engines/xeen/saves.cpp
index 9fd2d19a9b..4df4b3727c 100644
--- a/engines/xeen/saves.cpp
+++ b/engines/xeen/saves.cpp
@@ -45,7 +45,7 @@ void OutFile::finalize() {
/*------------------------------------------------------------------------*/
-SavesManager::SavesManager(XeenEngine *vm, Party &party) :
+SavesManager::SavesManager(XeenEngine *vm, Party &party) :
BaseCCArchive(), _vm(vm), _party(party) {
SearchMan.add("saves", this, 0, false);
_data = nullptr;
@@ -82,7 +82,7 @@ void SavesManager::syncBitFlags(Common::Serializer &s, bool *startP, bool *endP)
Common::SeekableReadStream *SavesManager::createReadStreamForMember(const Common::String &name) const {
CCEntry ccEntry;
- // If the given resource has already been perviously "written" to the
+ // If the given resource has already been perviously "written" to the
// save manager, then return that new resource
uint16 id = BaseCCArchive::convertNameToId(name);
if (_newData.contains(id)) {
diff --git a/engines/xeen/screen.cpp b/engines/xeen/screen.cpp
index 32a08b24e5..85c4df5590 100644
--- a/engines/xeen/screen.cpp
+++ b/engines/xeen/screen.cpp
@@ -47,9 +47,9 @@ Window::Window(const Window &src) : XSurface(), _enabled(src._enabled),
create(*_vm->_screen, Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
}
-Window::Window(const Common::Rect &bounds, int a, int border,
+Window::Window(const Common::Rect &bounds, int a, int border,
int xLo, int ycL, int xHi, int ycH): XSurface(),
- _enabled(false), _a(a), _border(border),
+ _enabled(false), _a(a), _border(border),
_xLo(xLo), _ycL(ycL), _xHi(xHi), _ycH(ycH) {
setBounds(bounds);
create(*_vm->_screen, Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
@@ -196,7 +196,7 @@ void Window::drawList(DrawStruct *items, int count) {
for (int i = 0; i < count; ++i, ++items) {
if (items->_frame == -1 || items->_scale == -1 || items->_sprites == nullptr)
continue;
-
+
Common::Point pt(items->_x, items->_y);
pt.x += _innerBounds.left;
pt.y += _innerBounds.top;
@@ -296,7 +296,7 @@ void Screen::update() {
}
void Screen::addDirtyRect(const Common::Rect &r) {
- assert(r.isValidRect() && r.width() > 0 && r.height() > 0
+ assert(r.isValidRect() && r.width() > 0 && r.height() > 0
&& r.left >= 0 && r.top >= 0
&& r.right <= SCREEN_WIDTH && r.bottom <= SCREEN_HEIGHT);
_dirtyRects.push_back(r);
diff --git a/engines/xeen/screen.h b/engines/xeen/screen.h
index 8df15b22d6..338a231ce6 100644
--- a/engines/xeen/screen.h
+++ b/engines/xeen/screen.h
@@ -96,7 +96,7 @@ public:
void frame();
/**
- * Fill the content area of a window with the current background color
+ * Fill the content area of a window with the current background color
*/
void fill();
diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp
index 1393c6eccf..4e0363120c 100644
--- a/engines/xeen/scripts.cpp
+++ b/engines/xeen/scripts.cpp
@@ -126,7 +126,7 @@ int Scripts::checkEvents() {
Mode oldMode = _vm->_mode;
Common::fill(&intf._charFX[0], &intf._charFX[MAX_ACTIVE_PARTY], 0);
//int items = _treasureItems;
-
+
if (party._treasure._gold & party._treasure._gems) {
// Backup any current treasure data
party._savedTreasure = party._treasure;
@@ -162,7 +162,7 @@ int Scripts::checkEvents() {
for (eventIndex = 0; eventIndex < map._events.size(); ++eventIndex) {
MazeEvent &event = map._events[eventIndex];
- if (event._position == _currentPos && party._mazeDirection !=
+ if (event._position == _currentPos && party._mazeDirection !=
(_currentPos.x | _currentPos.y) && event._line == _lineNum) {
if (event._direction == party._mazeDirection || event._direction == DIR_ALL) {
_vm->_mode = MODE_9;
@@ -366,7 +366,7 @@ void Scripts::cmdDoorTextSml(Common::Array<byte> &params) {
Interface &intf = *_vm->_interface;
Common::String paramText = _vm->_map->_events._text[_event->_parameters[0]];
- intf._screenText = Common::String::format("\x02\f""08\x03""c\t116\v025%s\x03""l\fd""\x01",
+ intf._screenText = Common::String::format("\x02\f""08\x03""c\t116\v025%s\x03""l\fd""\x01",
paramText.c_str());
intf._upDoorText = true;
intf.draw3d(true);
@@ -523,7 +523,7 @@ void Scripts::cmdIf(Common::Array<byte> &params) {
cmdNoAction(params);
}
-void Scripts::cmdMoveObj(Common::Array<byte> &params) {
+void Scripts::cmdMoveObj(Common::Array<byte> &params) {
MazeObject &mazeObj = _vm->_map->_mobData._objects[params[0]];
if (mazeObj._position.x == params[1] && mazeObj._position.y == params[2]) {
@@ -662,7 +662,7 @@ void Scripts::cmdTakeOrGive(Common::Array<byte> &params) {
for (uint idx = 0; idx < party._activeParty.size(); ++idx) {
if (_charIndex == 0 || (_charIndex == 8 && (int)idx != _v2)) {
party.giveTake(mode1, mask1, mode1, mask2, idx);
-
+
switch (mode1) {
case 8:
mode1 = 0;
@@ -684,7 +684,7 @@ void Scripts::cmdTakeOrGive(Common::Array<byte> &params) {
case 106:
if (param2)
continue;
-
+
// Break out of character loop
idx = party._activeParty.size();
break;
@@ -748,7 +748,7 @@ void Scripts::cmdNoAction(Common::Array<byte> &params) {
_lineNum = _vm->_party->_partyDead ? -1 : _lineNum + 1;
}
-void Scripts::cmdRemove(Common::Array<byte> &params) {
+void Scripts::cmdRemove(Common::Array<byte> &params) {
Interface &intf = *_vm->_interface;
Map &map = *_vm->_map;
@@ -761,7 +761,7 @@ void Scripts::cmdRemove(Common::Array<byte> &params) {
cmdMakeNothingHere(params);
}
-void Scripts::cmdSetChar(Common::Array<byte> &params) {
+void Scripts::cmdSetChar(Common::Array<byte> &params) {
if (params[0] != 7) {
_charIndex = WhoWill::show(_vm, 22, 3, false);
if (_charIndex == 0) {
@@ -802,11 +802,11 @@ void Scripts::cmdDoTownEvent(Common::Array<byte> &params) {
cmdExit(params);
}
-void Scripts::cmdExit(Common::Array<byte> &params) {
+void Scripts::cmdExit(Common::Array<byte> &params) {
_lineNum = -1;
}
-void Scripts::cmdAlterMap(Common::Array<byte> &params) {
+void Scripts::cmdAlterMap(Common::Array<byte> &params) {
Map &map = *_vm->_map;
if (params[2] == DIR_ALL) {
@@ -819,7 +819,7 @@ void Scripts::cmdAlterMap(Common::Array<byte> &params) {
cmdNoAction(params);
}
-void Scripts::cmdGiveExtended(Common::Array<byte> &params) {
+void Scripts::cmdGiveExtended(Common::Array<byte> &params) {
Party &party = *_vm->_party;
uint32 mask;
int newLineNum;
@@ -862,7 +862,7 @@ void Scripts::cmdGiveExtended(Common::Array<byte> &params) {
cmdNoAction(params);
}
-void Scripts::cmdConfirmWord(Common::Array<byte> &params) {
+void Scripts::cmdConfirmWord(Common::Array<byte> &params) {
Map &map = *_vm->_map;
Party &party = *_vm->_party;
Common::String msg1 = params[2] ? map._events._text[params[2]] :
@@ -893,7 +893,7 @@ void Scripts::cmdConfirmWord(Common::Array<byte> &params) {
}
else if (result == 61 && !_vm->_files->_isDarkCc) {
doWorldEnd();
- } else {
+ } else {
if (result == 59 && !_vm->_files->_isDarkCc) {
for (int idx = 0; idx < MAX_TREASURE_ITEMS; ++idx) {
XeenItem &item = party._treasure._weapons[idx];
@@ -902,7 +902,7 @@ void Scripts::cmdConfirmWord(Common::Array<byte> &params) {
item._material = 0;
item._bonusFlags = 0;
party._treasure._hasItems = true;
-
+
cmdExit(params);
return;
}
@@ -910,7 +910,7 @@ void Scripts::cmdConfirmWord(Common::Array<byte> &params) {
}
_lineNum = result == -1 ? params[3] : params[1];
-
+
return;
}
}
@@ -957,7 +957,7 @@ void Scripts::cmdAlterEvent(Common::Array<byte> &params) {
cmdNoAction(params);
}
-void Scripts::cmdCallEvent(Common::Array<byte> &params) {
+void Scripts::cmdCallEvent(Common::Array<byte> &params) {
_stack.push(StackEntry(_currentPos, _lineNum));
_currentPos = Common::Point(params[0], params[1]);
_lineNum = params[2] - 1;
@@ -973,7 +973,7 @@ void Scripts::cmdReturn(Common::Array<byte> &params) {
cmdNoAction(params);
}
-void Scripts::cmdSetVar(Common::Array<byte> &params) {
+void Scripts::cmdSetVar(Common::Array<byte> &params) {
Party &party = *_vm->_party;
uint val;
_refreshIcons = true;
@@ -1011,7 +1011,7 @@ void Scripts::cmdSetVar(Common::Array<byte> &params) {
void Scripts::cmdCutsceneEndClouds(Common::Array<byte> &params) { error("TODO"); }
-void Scripts::cmdWhoWill(Common::Array<byte> &params) {
+void Scripts::cmdWhoWill(Common::Array<byte> &params) {
_charIndex = WhoWill::show(_vm, params[0], params[1], true);
if (_charIndex == 0)
@@ -1020,7 +1020,7 @@ void Scripts::cmdWhoWill(Common::Array<byte> &params) {
cmdNoAction(params);
}
-void Scripts::cmdRndDamage(Common::Array<byte> &params) {
+void Scripts::cmdRndDamage(Common::Array<byte> &params) {
Combat &combat = *_vm->_combat;
Interface &intf = *_vm->_interface;
@@ -1049,7 +1049,7 @@ void Scripts::cmdAlterCellFlag(Common::Array<byte> &params) {
MazeWallLayers &wallData = map.mazeDataCurrent()._wallData[pt.y][pt.x];
wallData._data = (wallData._data & 0xFFF0) | params[2];
} else {
- pt.x &= 0xF;
+ pt.x &= 0xF;
pt.y &= 0xF;
MazeCell &cell = map.mazeDataCurrent()._cells[pt.y][pt.x];
cell._surfaceId = params[2];
@@ -1082,7 +1082,7 @@ void Scripts::cmdDisplayStat(Common::Array<byte> &params) {
cmdNoAction(params);
}
-void Scripts::cmdSeatTextSml(Common::Array<byte> &params) {
+void Scripts::cmdSeatTextSml(Common::Array<byte> &params) {
Interface &intf = *_vm->_interface;
intf._screenText = Common::String::format("\x2\f08\x3""c\t116\v090%s\x3l\fd\x1",
@@ -1270,12 +1270,12 @@ void Scripts::cmdFallToMap(Common::Array<byte> &params) {
_lineNum = -1;
}
-void Scripts::cmdDisplayMain(Common::Array<byte> &params) {
+void Scripts::cmdDisplayMain(Common::Array<byte> &params) {
display(false, 0);
cmdNoAction(params);
}
-void Scripts::cmdGoto(Common::Array<byte> &params) {
+void Scripts::cmdGoto(Common::Array<byte> &params) {
Map &map = *_vm->_map;
map.getCell(1);
if (params[0] == map._currentSurfaceId)
@@ -1284,12 +1284,12 @@ void Scripts::cmdGoto(Common::Array<byte> &params) {
cmdNoAction(params);
}
-void Scripts::cmdGotoRandom(Common::Array<byte> &params) {
+void Scripts::cmdGotoRandom(Common::Array<byte> &params) {
_lineNum = params[_vm->getRandomNumber(1, params[0])] - 1;
cmdNoAction(params);
}
-void Scripts::cmdCutsceneEndDarkside(Common::Array<byte> &params) {
+void Scripts::cmdCutsceneEndDarkside(Common::Array<byte> &params) {
Party &party = *_vm->_party;
_vm->_saves->_wonDarkSide = true;
party._questItems[53] = 1;
@@ -1301,13 +1301,13 @@ void Scripts::cmdCutsceneEndDarkside(Common::Array<byte> &params) {
doEndGame2();
}
-void Scripts::cmdCutsceneEdWorld(Common::Array<byte> &params) {
+void Scripts::cmdCutsceneEdWorld(Common::Array<byte> &params) {
_vm->_saves->_wonWorld = true;
_vm->_party->_worldEnd = true;
doWorldEnd();
}
-void Scripts::cmdFlipWorld(Common::Array<byte> &params) {
+void Scripts::cmdFlipWorld(Common::Array<byte> &params) {
_vm->_map->_loadDarkSide = params[0] != 0;
}
@@ -1342,7 +1342,7 @@ void Scripts::doWorldEnd() {
void Scripts::doEnding(const Common::String &endStr, int v2) {
_vm->_saves->saveChars();
-
+
warning("TODO: doEnding");
}
diff --git a/engines/xeen/scripts.h b/engines/xeen/scripts.h
index f41be1b7c6..98f93e7e75 100644
--- a/engines/xeen/scripts.h
+++ b/engines/xeen/scripts.h
@@ -132,7 +132,7 @@ struct MirrorEntry {
int _direction;
MirrorEntry() : _mapId(0), _direction(DIR_ALL) {}
-
+
bool synchronize(Common::SeekableReadStream &s);
};
@@ -174,7 +174,7 @@ private:
* Displays a door text message using the large font
*/
void cmdDoorTextLrg(Common::Array<byte> &params);
-
+
/**
* Show a sign text on-screen
*/
diff --git a/engines/xeen/spells.cpp b/engines/xeen/spells.cpp
index 23fb947aef..b3471df96c 100644
--- a/engines/xeen/spells.cpp
+++ b/engines/xeen/spells.cpp
@@ -81,7 +81,7 @@ void Spells::executeSpell(MagicSpell spellId) {
&Spells::starBurst, &Spells::stoneToFlesh, &Spells::sunRay,
&Spells::superShelter, &Spells::suppressDisease, &Spells::suppressPoison,
&Spells::teleport, &Spells::timeDistortion, &Spells::townPortal,
- &Spells::toxicCloud, &Spells::turnUndead, &Spells::walkOnWater,
+ &Spells::toxicCloud, &Spells::turnUndead, &Spells::walkOnWater,
&Spells::wizardEye
};
@@ -170,7 +170,7 @@ int Spells::castSpell(Character *c, MagicSpell spellId) {
int oldTillMove = intf._tillMove;
int result = 1;
combat._oldCharacter = c;
-
+
// Try and subtract the SP and gem requirements for the spell
int resultError = subSpellCost(*c, spellId);
if (resultError) {
@@ -180,7 +180,7 @@ int Spells::castSpell(Character *c, MagicSpell spellId) {
// Some spells have special handling
switch (spellId) {
case MS_EnchantItem:
- case MS_Etheralize:
+ case MS_Etheralize:
case MS_Jump:
case MS_LloydsBeacon:
case MS_SuperShelter:
@@ -305,7 +305,7 @@ void Spells::coldRay() {
combat.multiAttack(8);
}
-void Spells::createFood() {
+void Spells::createFood() {
Party &party = *_vm->_party;
Sound &sound = *_vm->_sound;
@@ -451,7 +451,7 @@ void Spells::detectMonster() {
if (monster._position == pt) {
if (++grid[yDiff][xDiff] > 3)
grid[yDiff][xDiff] = 3;
-
+
sprites.draw(w, grid[yDiff][xDiff], Common::Point(xDiff * 9 + 244,
yDiff * 7 + 81));
}
@@ -806,7 +806,7 @@ void Spells::levitate() {
_vm->_sound->playFX(20);
}
-void Spells::light() {
+void Spells::light() {
Interface &intf = *_vm->_interface;
Party &party = *_vm->_party;
Sound &sound = *_vm->_sound;
@@ -837,7 +837,7 @@ void Spells::lloydsBeacon() {
}
}
-void Spells::magicArrow() {
+void Spells::magicArrow() {
Combat &combat = *_vm->_combat;
combat._monsterDamage = 0;
combat._damageType = DT_MAGIC_ARROW;
@@ -966,7 +966,7 @@ void Spells::protectionFromElements() {
Sound &sound = *_vm->_sound;
Character &c = *combat._oldCharacter;
int resist = MIN(c.getCurrentLevel() * 2 + 5, (uint)200);
-
+
int elementType = SelectElement::show(_vm, MS_ProtFromElements);
if (elementType != -1) {
switch (elementType) {
@@ -1040,7 +1040,7 @@ void Spells::resurrection() {
sound.playFX(30);
c->addHitPoints(0);
c->_conditions[ERADICATED] = 0;
-
+
if (--c->_endurance._permanent < 1)
c->_endurance._permanent = 1;
if ((c->_tempAge + 5) >= 250)
@@ -1235,12 +1235,12 @@ void Spells::townPortal() {
if (map.mazeData()._mazeFlags & RESTRICTION_TOWN_PORTAL) {
spellFailed();
return;
- }
+ }
int townNumber = TownPortal::show(_vm);
if (!townNumber)
return;
-
+
sound.playFX(51);
map._loadDarkSide = map._sideTownPortal;
_vm->_files->_isDarkCc = map._sideTownPortal > 0;
@@ -1318,7 +1318,7 @@ void Spells::wizardEye() {
void Spells::frostbite2() {
Combat &combat = *_vm->_combat;
Sound &sound = *_vm->_sound;
-
+
combat._monsterDamage = 35;
combat._damageType = DT_COLD;
combat._rangeType = RT_SINGLE;
diff --git a/engines/xeen/sprites.cpp b/engines/xeen/sprites.cpp
index 7327317156..68382abc67 100644
--- a/engines/xeen/sprites.cpp
+++ b/engines/xeen/sprites.cpp
@@ -54,7 +54,7 @@ SpriteResource::~SpriteResource() {
SpriteResource &SpriteResource::operator=(const SpriteResource &src) {
delete[] _data;
_index.clear();
-
+
_filesize = src._filesize;
_data = new byte[_filesize];
Common::copy(src._data, src._data + _filesize, _data);
@@ -100,9 +100,9 @@ void SpriteResource::clear() {
_filesize = 0;
}
-void SpriteResource::drawOffset(XSurface &dest, uint16 offset, const Common::Point &pt,
+void SpriteResource::drawOffset(XSurface &dest, uint16 offset, const Common::Point &pt,
const Common::Rect &clipRect, int flags, int scale) {
- static const uint SCALE_TABLE[] = {
+ static const uint SCALE_TABLE[] = {
0xFFFF, 0xFFEF, 0xEFEF, 0xEFEE, 0xEEEE, 0xEEAE, 0xAEAE, 0xAEAA,
0xAAAA, 0xAA8A, 0x8A8A, 0x8A88, 0x8888, 0x8880, 0x8080, 0x8000
};
@@ -126,9 +126,9 @@ void SpriteResource::drawOffset(XSurface &dest, uint16 offset, const Common::Poi
Common::Point destPos;
destPos.x = pt.x + getScaledVal(xOffset, scaleMaskX);
destPos.x += (width - getScaledVal(width, scaleMaskX)) / 2;
-
+
destPos.y = pt.y + getScaledVal(yOffset, scaleMaskY);
-
+
// If the flags allow the dest surface to be resized, ensure dest surface is big enough
Common::Rect bounds = clipRect;
if (flags & SPRFLAG_RESIZE) {
@@ -136,7 +136,7 @@ void SpriteResource::drawOffset(XSurface &dest, uint16 offset, const Common::Poi
dest.create(xOffset + width, yOffset + height);
bounds = Common::Rect(0, 0, dest.w, dest.h);
}
-
+
uint16 scaleMaskXCopy = scaleMaskX;
Common::Rect drawBounds;
drawBounds.left = SCREEN_WIDTH;
@@ -156,10 +156,10 @@ void SpriteResource::drawOffset(XSurface &dest, uint16 offset, const Common::Poi
continue;
}
- // Roll the scale mask
+ // Roll the scale mask
uint bit = (scaleMaskY >> 15) & 1;
scaleMaskY = ((scaleMaskY & 0x7fff) << 1) + bit;
-
+
if (!bit) {
// Not a line to be drawn due to scaling down
f.skip(lineLength);
@@ -170,7 +170,7 @@ void SpriteResource::drawOffset(XSurface &dest, uint16 offset, const Common::Poi
} else {
scaleMaskX = scaleMaskXCopy;
xOffset = f.readByte();
-
+
// Initialize the array to hold the temporary data for the line. We do this to make it simpler
// to handle both deciding which pixels to draw in a scaled image, as well as when images
// have been horizontally flipped. Note that we allocate an extra line for before and after our
@@ -308,7 +308,7 @@ void SpriteResource::draw(Window &dest, int frame, const Common::Point &destPos,
draw(dest, frame, destPos, dest.getBounds(), flags, scale);
}
-void SpriteResource::draw(XSurface &dest, int frame, const Common::Point &destPos,
+void SpriteResource::draw(XSurface &dest, int frame, const Common::Point &destPos,
const Common::Rect &bounds, int flags, int scale) {
drawOffset(dest, _index[frame]._offset1, destPos, bounds, flags, scale);
@@ -330,7 +330,7 @@ uint SpriteResource::getScaledVal(int xy, uint16 &scaleMask) {
scaleMask = ((scaleMask & 0x7fff) << 1) + bit;
result += bit;
}
-
+
return result;
}
diff --git a/engines/xeen/sprites.h b/engines/xeen/sprites.h
index 17c745f26e..b61ec83cd6 100644
--- a/engines/xeen/sprites.h
+++ b/engines/xeen/sprites.h
@@ -66,7 +66,7 @@ private:
/**
* Draw a sprite frame based on a passed offset into the data stream
*/
- void drawOffset(XSurface &dest, uint16 offset, const Common::Point &pt,
+ void drawOffset(XSurface &dest, uint16 offset, const Common::Point &pt,
const Common::Rect &clipRect, int flags, int scale);
/**
@@ -99,7 +99,7 @@ public:
*/
void clear();
- void draw(XSurface &dest, int frame, const Common::Point &destPos,
+ void draw(XSurface &dest, int frame, const Common::Point &destPos,
int flags = 0, int scale = 0);
void draw(Window &dest, int frame, const Common::Point &destPos,
diff --git a/engines/xeen/town.cpp b/engines/xeen/town.cpp
index c0ecf5cf6f..13a631aa47 100644
--- a/engines/xeen/town.cpp
+++ b/engines/xeen/town.cpp
@@ -104,7 +104,7 @@ int Town::townAction(int actionId) {
sound.stopSound();
vocName = isDarkCc ? "bank1.voc" : "banker.voc";
break;
-
+
case 1:
// Blacksmith
_icons1.load("esc.icn");
@@ -215,7 +215,7 @@ int Town::townAction(int actionId) {
Character *charP = &party._activeParty[0];
Common::String title = createTownText(*charP);
intf._face1UIFrame = intf._face2UIFrame = 0;
- intf._dangerSenseUIFrame = 0;
+ intf._dangerSenseUIFrame = 0;
intf._spotDoorsUIFrame = 0;
intf._levitateUIFrame = 0;
@@ -525,7 +525,7 @@ Character *Town::doBankOptions(Character *c) {
Character *Town::doBlacksmithOptions(Character *c) {
Interface &intf = *_vm->_interface;
Party &party = *_vm->_party;
-
+
if (_buttonValue >= Common::KEYCODE_F1 && _buttonValue <= Common::KEYCODE_F6) {
// Switch character
_buttonValue -= Common::KEYCODE_F1;
@@ -782,7 +782,7 @@ Character *Town::doTempleOptions(Character *c) {
Interface &intf = *_vm->_interface;
Party &party = *_vm->_party;
Sound &sound = *_vm->_sound;
-
+
switch (_buttonValue) {
case Common::KEYCODE_F1:
case Common::KEYCODE_F2:
@@ -808,7 +808,7 @@ Character *Town::doTempleOptions(Character *c) {
if (_dayOfWeek == (party._day / 10)) {
party._clairvoyanceActive = true;
party._lightCount = 1;
-
+
int amt = _dayOfWeek ? _dayOfWeek : 10;
party._heroism = amt;
party._holyBonus = amt;
@@ -916,7 +916,7 @@ Character *Town::doTrainingOptions(Character *c) {
sound.stopSound();
sound.playSound(isDarkCc ? "prtygd.voc" : "trainin2.voc", 1);
- c->_experience -= c->nextExperienceLevel() -
+ c->_experience -= c->nextExperienceLevel() -
(c->getCurrentExperience() - c->_experience);
c->_level._permanent++;
@@ -987,7 +987,7 @@ void Town::depositWithdrawl(int choice) {
default:
continue;
}
-
+
if ((choice && !party._bankGems && flag) ||
(choice && !party._bankGold && !flag) ||
(!choice && !party._gems && flag) ||
@@ -1261,7 +1261,7 @@ bool TownMessage::execute(int portrait, const Common::String &name, const Common
break;
if (!msgEnd) {
- if (confirm || _buttonValue == Common::KEYCODE_ESCAPE ||
+ if (confirm || _buttonValue == Common::KEYCODE_ESCAPE ||
_buttonValue == Common::KEYCODE_n)
result = 0;
else if (_buttonValue == Common::KEYCODE_y)
diff --git a/engines/xeen/town.h b/engines/xeen/town.h
index 0767638f8a..25faa38c76 100644
--- a/engines/xeen/town.h
+++ b/engines/xeen/town.h
@@ -117,7 +117,7 @@ private:
TownMessage(XeenEngine *vm) : ButtonContainer(vm) {}
- bool execute(int portrait, const Common::String &name,
+ bool execute(int portrait, const Common::String &name,
const Common::String &text, int confirm);
void loadButtons();
diff --git a/engines/xeen/worldofxeen/clouds_cutscenes.cpp b/engines/xeen/worldofxeen/clouds_cutscenes.cpp
index fc7c99d407..32209a766b 100644
--- a/engines/xeen/worldofxeen/clouds_cutscenes.cpp
+++ b/engines/xeen/worldofxeen/clouds_cutscenes.cpp
@@ -154,7 +154,7 @@ bool CloudsCutscenes::showCloudsIntro() {
lake3.draw(screen, lakeCtr, Common::Point(0, yCtr));
}
}
-
+
xeen.draw(screen, 0);
screen.update();
WAIT(1);
@@ -218,7 +218,7 @@ bool CloudsCutscenes::showCloudsIntro() {
groupo.draw(screen, 1, Common::Point(160, 0));
crodo.draw(screen, 0, Common::Point(0, -5));
screen._windows[0].writeString(Res.CLOUDS_INTRO1);
-
+
// Unroll a scroll
if (doScroll(false, true))
return false;
@@ -273,10 +273,10 @@ bool CloudsCutscenes::showCloudsIntro() {
}
group.draw(screen, ctr4 + 5, Common::Point(0, 99));
- group.draw(screen, ctr2 + 24, Common::Point(202, 12));
+ group.draw(screen, ctr2 + 24, Common::Point(202, 12));
if ((++totalCtr % 30) == 0)
group.draw(screen, 43, Common::Point(178, 134));
-
+
switch (lineCtr) {
case 2:
case 4:
diff --git a/engines/xeen/worldofxeen/darkside_cutscenes.cpp b/engines/xeen/worldofxeen/darkside_cutscenes.cpp
index e40fee680f..9aad9b1d18 100644
--- a/engines/xeen/worldofxeen/darkside_cutscenes.cpp
+++ b/engines/xeen/worldofxeen/darkside_cutscenes.cpp
@@ -135,7 +135,7 @@ bool DarkSideCutscenes::showDarkSideTitle() {
screen.loadBackground("jvc.raw");
screen.draw();
screen.fadeIn();
-
+
WAIT(60);
return true;
}
@@ -262,7 +262,7 @@ bool DarkSideCutscenes::showDarkSideIntro() {
title.clear();
pyraTop.clear();
pyramid.clear();
-
+
//
SpriteResource dragon("dragon.int");
const int XLIST3[10] = { 102, 103, 104, 104, 104, 103, 102, 101, 101, 101 };
@@ -574,7 +574,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
sc08.draw(screen, 0);
showSubtitles();
} while (_subtitleSize);
-
+
sc08.clear();
// Nowhere to run to
@@ -600,7 +600,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
screen.restoreBackground();
showSubtitles();
} while (_subtitleSize);
-
+
sc09.clear();
// Nor do you!
@@ -760,7 +760,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
screen.loadBackground("sc170001.raw");
screen.saveBackground();
screen.horizMerge(0);
- sc16.draw(screen, 0, Common::Point(7, 29));
+ sc16.draw(screen, 0, Common::Point(7, 29));
showSubtitles();
sound.playSound("fail1.voc");
@@ -834,7 +834,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
for (int idx = 0; idx < 4; ++idx)
sc18[idx].clear();
-
+
// Closeup of Corak bleeding
SpriteResource sc19("sc19.end");
screen.loadBackground("sc190001.raw");
@@ -1013,7 +1013,7 @@ bool DarkSideCutscenes::showDarkSideEnding() {
screen.saveBackground();
sc25.draw(screen, 0, Common::Point(27, 30));
screen.update();
-
+
for (int struggleNum = 0; struggleNum < 2; ++struggleNum) {
for (int idx = 0; idx < 9; ++idx) {
if (struggleNum == 0 && idx == 2)
@@ -1220,7 +1220,7 @@ void DarkSideCutscenes::showPharaohEndText(const char *msg1, const char *msg2, c
idx = (idx + 1) % 32;
screen.update();
-
+
events.pollEventsAndWait();
} while (!_vm->shouldQuit() && !events.isKeyMousePressed());
diff --git a/engines/xeen/worldofxeen/worldofxeen.cpp b/engines/xeen/worldofxeen/worldofxeen.cpp
index f4d8fdbc94..93a0005088 100644
--- a/engines/xeen/worldofxeen/worldofxeen.cpp
+++ b/engines/xeen/worldofxeen/worldofxeen.cpp
@@ -30,7 +30,7 @@ namespace Xeen {
namespace WorldOfXeen {
WorldOfXeenEngine::WorldOfXeenEngine(OSystem *syst, const XeenGameDescription *gameDesc)
- : XeenEngine(syst, gameDesc), CloudsCutscenes(this),
+ : XeenEngine(syst, gameDesc), CloudsCutscenes(this),
DarkSideCutscenes(this) {
_seenDarkSideIntro = false;
}
diff --git a/engines/xeen/worldofxeen/worldofxeen.h b/engines/xeen/worldofxeen/worldofxeen.h
index 41fe4b3b83..7dbb710430 100644
--- a/engines/xeen/worldofxeen/worldofxeen.h
+++ b/engines/xeen/worldofxeen/worldofxeen.h
@@ -36,11 +36,11 @@ enum WOXGameAction {
};
/**
- * Implements a descendant of the base Xeen engine to handle
+ * Implements a descendant of the base Xeen engine to handle
* Clouds of Xeen, Dark Side of Xeen, and Worlds of Xeen specific
* game code
*/
-class WorldOfXeenEngine: public XeenEngine, public CloudsCutscenes,
+class WorldOfXeenEngine: public XeenEngine, public CloudsCutscenes,
public DarkSideCutscenes {
protected:
/**
diff --git a/engines/xeen/worldofxeen/worldofxeen_menu.cpp b/engines/xeen/worldofxeen/worldofxeen_menu.cpp
index d3f273784b..ff73cab4bb 100644
--- a/engines/xeen/worldofxeen/worldofxeen_menu.cpp
+++ b/engines/xeen/worldofxeen/worldofxeen_menu.cpp
@@ -53,7 +53,7 @@ void WorldOfXeenMenu::execute() {
SpriteResource special("special.icn");
Screen &screen = *_vm->_screen;
EventsManager &events = *_vm->_events;
-
+
File newBright("newbrigh.m");
_vm->_sound->playSong(newBright);
@@ -210,7 +210,7 @@ void WorldOptionsMenu::showContents(SpriteResource &title1, bool waitFlag) {
Screen &screen = *_vm->_screen;
EventsManager &events = *_vm->_events;
events.updateGameCounter();
-
+
// Draw the background frame in a continous cycle
_bgFrame = (_bgFrame + 1) % 5;
title1.draw(screen._windows[0], _bgFrame);
diff --git a/engines/xeen/worldofxeen/worldofxeen_menu.h b/engines/xeen/worldofxeen/worldofxeen_menu.h
index 9b507b7ed1..49553dd10f 100644
--- a/engines/xeen/worldofxeen/worldofxeen_menu.h
+++ b/engines/xeen/worldofxeen/worldofxeen_menu.h
@@ -87,7 +87,7 @@ protected:
virtual void showContents(SpriteResource &title1, bool mode);
public:
WorldOptionsMenu(XeenEngine *vm) : DarkSideOptionsMenu(vm), _bgFrame(0) {}
-
+
virtual ~WorldOptionsMenu() {}
};
diff --git a/engines/zvision/video/zork_avi_decoder.cpp b/engines/zvision/video/zork_avi_decoder.cpp
index 1d23546551..412cd456ef 100644
--- a/engines/zvision/video/zork_avi_decoder.cpp
+++ b/engines/zvision/video/zork_avi_decoder.cpp
@@ -50,7 +50,7 @@ void ZorkAVIDecoder::ZorkAVIAudioTrack::createAudioStream() {
_audioStream = _queueStream;
}
-void ZorkAVIDecoder::ZorkAVIAudioTrack::queueSound(Common::SeekableReadStream *stream) {
+void ZorkAVIDecoder::ZorkAVIAudioTrack::queueSound(Common::SeekableReadStream *stream) {
RawChunkStream::RawChunk chunk = _decoder.readNextChunk(stream);
delete stream;