diff options
author | Robert Göffringmann | 2003-06-27 02:54:05 +0000 |
---|---|---|
committer | Robert Göffringmann | 2003-06-27 02:54:05 +0000 |
commit | 1785e0e30504f4cdaf29a31eec0f58de700ab8b1 (patch) | |
tree | d6b77da3587d8e5b1f6578c34ef470e06cef9a55 | |
parent | c10905b975a2bf929b1e053525907663879fdb7f (diff) | |
download | scummvm-rg350-1785e0e30504f4cdaf29a31eec0f58de700ab8b1.tar.gz scummvm-rg350-1785e0e30504f4cdaf29a31eec0f58de700ab8b1.tar.bz2 scummvm-rg350-1785e0e30504f4cdaf29a31eec0f58de700ab8b1.zip |
some more loading & saving work (still unfinished)
svn-id: r8663
-rw-r--r-- | sky/compact.h | 18 | ||||
-rw-r--r-- | sky/compacts/savedata.cpp | 979 | ||||
-rw-r--r-- | sky/control.cpp | 312 | ||||
-rw-r--r-- | sky/control.h | 31 | ||||
-rw-r--r-- | sky/disk.cpp | 18 | ||||
-rw-r--r-- | sky/disk.h | 4 | ||||
-rw-r--r-- | sky/logic.cpp | 12 | ||||
-rw-r--r-- | sky/module.mk | 1 | ||||
-rw-r--r-- | sky/mouse.h | 1 | ||||
-rw-r--r-- | sky/music/musicbase.h | 1 | ||||
-rw-r--r-- | sky/sky.cpp | 46 | ||||
-rw-r--r-- | sky/sky.h | 9 | ||||
-rw-r--r-- | sky/sound.cpp | 2 | ||||
-rw-r--r-- | sky/text.h | 1 |
14 files changed, 1376 insertions, 59 deletions
diff --git a/sky/compact.h b/sky/compact.h index 2db3318380..52d24d1888 100644 --- a/sky/compact.h +++ b/sky/compact.h @@ -3214,6 +3214,24 @@ namespace SkyCompact { extern uint16 retina_scan_cdt[]; extern Compact forklift_cpt; extern void *data_0[]; + extern uint8 babs_auto[]; + extern uint8 burke_auto[]; + extern uint8 dan_auto[]; + extern uint8 foreman_auto[]; + extern uint8 full_ss_auto[]; + extern uint8 gal_auto[]; + extern uint8 jobs_auto[]; + extern uint8 joey_auto[]; + extern uint8 ken_auto[]; + extern uint8 lamb_auto[]; + extern uint8 loader_auto[]; + extern uint8 medi_auto[]; + extern uint8 monitor_auto[]; + extern uint8 radman_auto[]; + extern uint8 shades_auto[]; + extern uint8 spu_auto[]; + extern uint8 ss_auto[]; + extern uint8 wit_auto[]; }; #endif diff --git a/sky/compacts/savedata.cpp b/sky/compacts/savedata.cpp new file mode 100644 index 0000000000..47051e6f0a --- /dev/null +++ b/sky/compacts/savedata.cpp @@ -0,0 +1,979 @@ +#include "sky/control.h" + +Compact *SkyControl::_saveLoadCpts[833] = { + // 0compact.asm: + // Z_compac.inc: + &SkyCompact::forklift_cpt, + &SkyCompact::coordinate_test, + &SkyCompact::text_1, + &SkyCompact::text_2, + &SkyCompact::text_3, + &SkyCompact::text_4, + &SkyCompact::text_5, + &SkyCompact::text_6, + &SkyCompact::text_7, + &SkyCompact::text_8, + &SkyCompact::text_9, + &SkyCompact::text_10, + &SkyCompact::text_11, + &SkyCompact::joey, + // SkyCompact::joey_auto uint8* + &SkyCompact::joey_park, + //SkyCompact::park_table uint16* + // c68 dup 0 + &SkyCompact::foster, + &SkyCompact::floor, + //SkyCompact::high_floor_table uint16* + // l_talk_s2 dup 0 + &SkyCompact::r_talk_s2, + // talk 1 dup 0 + &SkyCompact::talk2, + &SkyCompact::low_floor, + &SkyCompact::stairs, + &SkyCompact::upstairs, + &SkyCompact::bar, + &SkyCompact::door, + &SkyCompact::small_door, + &SkyCompact::right_exit0, + &SkyCompact::outside_ledge, + &SkyCompact::r1_door, + &SkyCompact::s2_floor, + &SkyCompact::lamb, + //SkyCompact::lamb_auto uint8* + &SkyCompact::monitor, + //SkyCompact::monitor_auto uint8* + &SkyCompact::anita, + &SkyCompact::whole_screen, + // Objects.inc: + &SkyCompact::menu_bar, + &SkyCompact::left_arrow, + &SkyCompact::right_arrow, + &SkyCompact::blank1, + &SkyCompact::blank2, + &SkyCompact::blank3, + &SkyCompact::blank4, + &SkyCompact::blank5, + &SkyCompact::blank6, + &SkyCompact::blank7, + &SkyCompact::blank8, + &SkyCompact::blank9, + &SkyCompact::blank10, + &SkyCompact::blank11, + &SkyCompact::crow_bar_menu, + &SkyCompact::sarnie_menu, + &SkyCompact::spanner_menu, + &SkyCompact::joeyb_menu, + &SkyCompact::citycard_menu, + &SkyCompact::shades_menu, + &SkyCompact::putty_menu, + &SkyCompact::lightbulb_menu, + &SkyCompact::wd40_menu, + &SkyCompact::skey_menu, + &SkyCompact::anita_card_menu, + &SkyCompact::anchor_menu, + &SkyCompact::magazine_menu, + &SkyCompact::tape_menu, + &SkyCompact::glass_menu, + &SkyCompact::rope_menu, + &SkyCompact::ticket_menu, + &SkyCompact::new_cable_menu, + &SkyCompact::secateurs_menu, + &SkyCompact::plaster_menu, + &SkyCompact::brick_menu, + &SkyCompact::tongs_menu, + &SkyCompact::dog_food_menu, + &SkyCompact::gallcard_menu, + //101comp.inc: + &SkyCompact::full_screen, + &SkyCompact::cancel_button, + &SkyCompact::button_7, + &SkyCompact::button_8, + &SkyCompact::button_9, + &SkyCompact::button_4, + &SkyCompact::button_5, + &SkyCompact::button_6, + &SkyCompact::button_1, + &SkyCompact::button_2, + &SkyCompact::button_3, + &SkyCompact::button_0, + &SkyCompact::retina_scan, + //102comp.inc: + &SkyCompact::restart_butt, + &SkyCompact::restore_butt, + &SkyCompact::exit_butt, + //85comp.inc: + //1compact.asm: + //0compact.inc: + //c74 dup 0 + &SkyCompact::mini_so, + //SkyCompact::ss_auto uint8* + //c101 dup 0 + &SkyCompact::full_so, + //SkyCompact::full_ss_auto uint8* + &SkyCompact::load_point, + &SkyCompact::fire_notice, + //1compact.inc + &SkyCompact::fire_notice2, + &SkyCompact::ss_sign, + &SkyCompact::lfan1, + &SkyCompact::lfan2, + &SkyCompact::smoke1, + &SkyCompact::smoke2, + &SkyCompact::fire1, + &SkyCompact::fire2, + &SkyCompact::car_up, + &SkyCompact::car_down, + //2compact.inc + &SkyCompact::top_lift, + &SkyCompact::top_lift_2, + &SkyCompact::top_barrel, + &SkyCompact::light_one, + &SkyCompact::panel, + &SkyCompact::alarm_flash, + &SkyCompact::robot_shell, + &SkyCompact::dead_loader, + // exit_table dup 0 + // left_table2 dup 0 + &SkyCompact::junk1, + &SkyCompact::junk2, + // c4121 dup 0 + &SkyCompact::loader, + //SkyCompact::loader_auto uint8* + //3compact.inc: + &SkyCompact::steve_watch, + &SkyCompact::low_barrel, + &SkyCompact::convey, + &SkyCompact::joey_fly, + &SkyCompact::furnace, + &SkyCompact::lights1, + &SkyCompact::eye_ball, + &SkyCompact::furnace_door, + &SkyCompact::slot, + // sh dup 0 + &SkyCompact::shades, + //SkyCompact::shade_auto uint8* + &SkyCompact::eye_bolt, + &SkyCompact::smoulder, + &SkyCompact::low_lift, + &SkyCompact::low_lift_2, + &SkyCompact::low_lift_3, + //4compact.inc: + &SkyCompact::sc4_floor, + &SkyCompact::sc4_left_exit, + // l_talk_s4 dup 0 + &SkyCompact::r_talk_s4, + &SkyCompact::tv_screens_s4, + &SkyCompact::knob_s4, + &SkyCompact::chuck_s4, + &SkyCompact::lazer_s4, + &SkyCompact::cupboard_s4, + &SkyCompact::sarnie_s4, + &SkyCompact::spanner_s4, + &SkyCompact::monitors_s4, + &SkyCompact::buttons_s4, + &SkyCompact::postcard, + &SkyCompact::notice4, + // c43 dup 0 + &SkyCompact::jobsworth, + //&SkyCompact::jobs_script // ------ + //SkyCompact::jobs_auto uint8* + // 2compact.asm + //5compact.inc: + &SkyCompact::s6_floor, + &SkyCompact::stairs6, + &SkyCompact::joey_fly_6, + &SkyCompact::left_exit_s6, + &SkyCompact::s5_floor, + &SkyCompact::right_exit_s5, + &SkyCompact::right_exit_s6, + &SkyCompact::security_exit_s6, + &SkyCompact::s7_floor, + &SkyCompact::left_exit_s7, + &SkyCompact::left_exit_s5, + &SkyCompact::skorl_guard, + &SkyCompact::security_exit, + &SkyCompact::s8_floor, + &SkyCompact::right_exit_s7, + &SkyCompact::down_exit_s8, + &SkyCompact::wreck_guard, + // grid 5 + 6 + 7 + 8 + 9 + 18 => dup 0 + &SkyCompact::factory_entry, + &SkyCompact::s7_card_slot, + &SkyCompact::lift_notice, + &SkyCompact::lift_s7, + &SkyCompact::linc_s7, + &SkyCompact::lift7_light, + &SkyCompact::cable_7, + &SkyCompact::copter, + // 9compact.inc: + &SkyCompact::s9_floor, + &SkyCompact::left_exit_s9, + &SkyCompact::fans, + &SkyCompact::lobby_door, + &SkyCompact::scanner, + &SkyCompact::lobby_slot, + &SkyCompact::dad, + &SkyCompact::son, + &SkyCompact::fake_floor_9, + &SkyCompact::linc_s9, + // 12comp.inc: + &SkyCompact::s12_floor, + &SkyCompact::factory_exit, + &SkyCompact::fact1_right_exit, + &SkyCompact::topbelt, + &SkyCompact::botbelt, + &SkyCompact::pipes, + &SkyCompact::anita_spy, + &SkyCompact::welder, + &SkyCompact::stump, + &SkyCompact::console_12, + // 13comp.inc: + &SkyCompact::s13_floor, + &SkyCompact::fact2_exit_left, + &SkyCompact::fact2_exit_right, + &SkyCompact::fact2_store_exit, + &SkyCompact::cogs, + &SkyCompact::gears, + &SkyCompact::belts1, + &SkyCompact::belts2, + &SkyCompact::pipe1, + &SkyCompact::pipe2, + &SkyCompact::pipe3, + &SkyCompact::pipe4, + &SkyCompact::sensor, + &SkyCompact::lite1, + &SkyCompact::lite2, + &SkyCompact::fact2_spy_and_window, + &SkyCompact::fact_console, + &SkyCompact::sensors, + &SkyCompact::foreman, + //SkyCompact::foreman_auto uint8* + // 14comp.inc: + &SkyCompact::s14_floor, + &SkyCompact::fact3_exit_left, + &SkyCompact::fact3_exit_right, + &SkyCompact::locker3, + &SkyCompact::locker2, + &SkyCompact::locker1, + &SkyCompact::machine, + &SkyCompact::rad_screen, + &SkyCompact::console_14, + &SkyCompact::coat, + &SkyCompact::radman, + //SkyCompact::radman_auto uint8* + // 15comp.inc: + &SkyCompact::nu_floor, + &SkyCompact::s15_flooor, + &SkyCompact::store_exit, + &SkyCompact::junction_box, + &SkyCompact::whole_floor, + &SkyCompact::flap, + &SkyCompact::skey, + &SkyCompact::wd40, + &SkyCompact::floor_putty, + // 16comp.inc: + &SkyCompact::s16_floor, + &SkyCompact::entrance_exit, + &SkyCompact::reactor_console, + &SkyCompact::reactor_door, + &SkyCompact::reactor_lower, + // 17comp.inc: + &SkyCompact::s17_floor, + &SkyCompact::core_exit, + &SkyCompact::pulse, + &SkyCompact::pulseb, + &SkyCompact::anita_card, + &SkyCompact::s18_floor, + &SkyCompact::steam, + &SkyCompact::power_door, + &SkyCompact::power_motor, + &SkyCompact::socket, + &SkyCompact::power_switch, + &SkyCompact::power_chair, + &SkyCompact::left_skull, + &SkyCompact::right_skull, + &SkyCompact::power_bang, + &SkyCompact::left_lever, + &SkyCompact::right_lever, + //3compact.asm + // 10comp.inc: + &SkyCompact::s10_floor, + &SkyCompact::left_exit_10, + &SkyCompact::lift_10, + &SkyCompact::lift_slot_10, + &SkyCompact::scanner_10, + &SkyCompact::pod, + &SkyCompact::linc_10, + &SkyCompact::pod_light, + &SkyCompact::monitor_10, + &SkyCompact::liyt_1, + &SkyCompact::liyt_2, + &SkyCompact::liyt_3, + &SkyCompact::liyt_4, + &SkyCompact::litebank, + &SkyCompact::terminal_10, + &SkyCompact::fake_floor_10, + // 11comp.inc + &SkyCompact::s11_floor, + &SkyCompact::cable_fall, + &SkyCompact::cable_fall2, + &SkyCompact::smashed_window, + &SkyCompact::bits, + &SkyCompact::bits2, + &SkyCompact::spy_11, + &SkyCompact::locker_11, + &SkyCompact::slot_11, + &SkyCompact::soccer_1, + &SkyCompact::soccer_2, + &SkyCompact::soccer_3, + &SkyCompact::soccer_4, + &SkyCompact::soccer_5, + &SkyCompact::slat_1, + &SkyCompact::slat_2, + &SkyCompact::slat_3, + &SkyCompact::slat_4, + &SkyCompact::slat_5, + &SkyCompact::right_exit_11, + // 19comp.inc: + &SkyCompact::s19_floor, + &SkyCompact::right_exit_19, + &SkyCompact::left_exit_19, + &SkyCompact::top_right_19, + &SkyCompact::useless_char, + // 20comp.inc: + &SkyCompact::s20_floor, + &SkyCompact::down_exit_20, + &SkyCompact::reich_door_20, + &SkyCompact::reich_slot, + &SkyCompact::lamb_door_20, + &SkyCompact::lamb_slot, + &SkyCompact::shrub_1, + &SkyCompact::shrub_2, + &SkyCompact::shrub_3, + &SkyCompact::gallager_bel, + &SkyCompact::reich_window, + &SkyCompact::lamb_window, + // 21comp.inc: + &SkyCompact::s21_floor, + &SkyCompact::left_exit_21, + &SkyCompact::lambs_books, + &SkyCompact::lambs_chair, + &SkyCompact::dispensor, + &SkyCompact::cat_food, + &SkyCompact::video, + &SkyCompact::cassette, + &SkyCompact::big_pict1, + &SkyCompact::video_screen, + &SkyCompact::big_pict2, + &SkyCompact::big_pict3, + &SkyCompact::cat, + &SkyCompact::fake_floor_21, + &SkyCompact::inner_lamb_door, + // 22comp.inc: + &SkyCompact::s22_floor, + &SkyCompact::right_exit_22, + &SkyCompact::lamb_bed, + &SkyCompact::lamb_tv, + &SkyCompact::fish_tank, + &SkyCompact::fish_poster, + &SkyCompact::pillow, + &SkyCompact::magazine, + &SkyCompact::reich_chair, + &SkyCompact::cabinet, + &SkyCompact::cert, + &SkyCompact::reich_picture, + &SkyCompact::fish_food, + &SkyCompact::fake_floor_22, + &SkyCompact::inner_reich_door, + // 23comp.inc: + &SkyCompact::s23_floor, + &SkyCompact::left_exit_23, + &SkyCompact::anchor_exit_23, + &SkyCompact::travel_exit_23, + &SkyCompact::bin_23, + &SkyCompact::sculpture, + &SkyCompact::link_23, + &SkyCompact::wreck_23, + &SkyCompact::small_exit_23, + // 24comp.inc: + &SkyCompact::s24_floor, + &SkyCompact::left_exit_24, + &SkyCompact::london_poster, + &SkyCompact::new_york_poster, + &SkyCompact::mural, + &SkyCompact::pidgeons, + &SkyCompact::trevor, + &SkyCompact::ticket, + &SkyCompact::globe, + // 25comp.inc: + &SkyCompact::s25_floor, + &SkyCompact::anchor_exit_25, + &SkyCompact::anchor, + &SkyCompact::statue_25, + &SkyCompact::hook, + &SkyCompact::lazer_25, + &SkyCompact::spark_25, + &SkyCompact::sales_chart, + // 26comp.inc: + &SkyCompact::s26_floor, + &SkyCompact::right_exit_26, + &SkyCompact::poster1, + &SkyCompact::poster2, + &SkyCompact::poster3, + &SkyCompact::poster4, + &SkyCompact::plant_26, + &SkyCompact::holo, + &SkyCompact::left_exit_26, + &SkyCompact::bio_door, + &SkyCompact::leaflet, + // 27comp.inc: + &SkyCompact::s27_floor, + &SkyCompact::right_exit_27, + &SkyCompact::chart1, + &SkyCompact::chart2, + &SkyCompact::gas, + &SkyCompact::medi_comp, + &SkyCompact::scanner_27, + &SkyCompact::chair_27, + &SkyCompact::helmet_cole, + &SkyCompact::body, + &SkyCompact::glass_slot, + &SkyCompact::burke, + // SkyCompact::burke_auto uint8* + // 28comp.inc: + &SkyCompact::s28_floor, + &SkyCompact::right_exit_28, + &SkyCompact::left_exit_28, + &SkyCompact::dustbin_28, + &SkyCompact::up_exit_28, + &SkyCompact::s28_sml_floor, + &SkyCompact::small_r_28, + &SkyCompact::small_l_28, + &SkyCompact::lift_28, + &SkyCompact::slot_28, + // 29comp.inc + &SkyCompact::s29_floor, + &SkyCompact::lift_29, + &SkyCompact::s29_card_slot, + &SkyCompact::lift29_light, + &SkyCompact::right_exit_29, + &SkyCompact::left_exit_29, + &SkyCompact::cable_29, + &SkyCompact::s29_sml_floor, + &SkyCompact::small_r_29, + &SkyCompact::small_l_29, + // 4compact.asm + // 30comp.inc: + &SkyCompact::sc30_floor, + &SkyCompact::sc30_exit_31, + &SkyCompact::sc30_exit_33, + &SkyCompact::sc30_exit_36, + &SkyCompact::sc30_court_door, + &SkyCompact::sc30_notice, + &SkyCompact::sc30_statue_1, + &SkyCompact::sc30_statue_2, + &SkyCompact::sc30_henri, + // 31comp.inc: + &SkyCompact::sc31_floor, + &SkyCompact::sc31_exit_30, + &SkyCompact::sc31_exit_32, + &SkyCompact::sc31_exit_39, + &SkyCompact::sc31_lift, + &SkyCompact::sc31_lift_slot, + &SkyCompact::sc31_end_of_rope, + &SkyCompact::sc31_rope, + &SkyCompact::sc31_bricks, + &SkyCompact::sc31_plank, + &SkyCompact::sc31_biscuits, + &SkyCompact::sc31_guard, + &SkyCompact::sc31_joey, + &SkyCompact::sc31_at_watcher, + // 32comp.inc: + &SkyCompact::sc32_floor, + &SkyCompact::sc32_exit_31, + &SkyCompact::sc32_exit_33, + &SkyCompact::sc32_lift, + &SkyCompact::sc32_terminal, + &SkyCompact::sc32_buzzer, + &SkyCompact::sc32_plant_1, + &SkyCompact::sc32_plant_2, + &SkyCompact::sc32_plant_3, + &SkyCompact::sc32_vincent, + &SkyCompact::sc32_gardener, + // 33comp.inc: + &SkyCompact::sc33_floor, + &SkyCompact::sc33_exit_30, + &SkyCompact::sc33_exit_32, + &SkyCompact::sc33_shed_door, + &SkyCompact::sc33_lock, + // 34comp.inc: + &SkyCompact::sc34_floor, + &SkyCompact::sc34_door, + &SkyCompact::sc34_secateurs, + &SkyCompact::sc34_tkt_machine, + &SkyCompact::sc34_map, + &SkyCompact::sc34_bricks, + // 36comp.inc: + &SkyCompact::sc36_floor, + &SkyCompact::sc36_low_floor, + &SkyCompact::sc36_exit_30, + &SkyCompact::sc36_sensor, + &SkyCompact::sc36_door, + &SkyCompact::sc36_band, + &SkyCompact::sc36_jukebox, + &SkyCompact::sc36_juke_light, + &SkyCompact::sc36_barman, + &SkyCompact::sc36_colston, + &SkyCompact::sc36_col_feet, + &SkyCompact::sc36_gallagher, + &SkyCompact::sc36_gal_legs, + &SkyCompact::sc36_cards, + &SkyCompact::sc36_glass, + // babs dup 0 + &SkyCompact::sc36_babs, + //SkyCompact::babs_auto uint8* + // 37comp.inc: + &SkyCompact::sc37_floor, + &SkyCompact::sc37_holding_lid, + &SkyCompact::sc37_flimsy_box, + &SkyCompact::sc37_sensor, + &SkyCompact::sc37_door, + &SkyCompact::sc37_grill, + &SkyCompact::sc37_big_box, + &SkyCompact::sc37_lid, + &SkyCompact::sc37_wine_rack, + // 38comp.inc: + &SkyCompact::sc38_floor, + &SkyCompact::sc38_lift, + &SkyCompact::sc38_statue, + &SkyCompact::sc38_monitor, + &SkyCompact::sc38_video, + &SkyCompact::sc38_sofa, + &SkyCompact::sc38_dog_tray, + &SkyCompact::sc38_biscuits, + // dna dup 0 + &SkyCompact::danielle, + //SkyCompact::dan_auto uint8 * + // spu dup 0 + &SkyCompact::spunky, + //SkyCompact::spu_auto uint8 * + &SkyCompact::sc38_hand_set, + &SkyCompact::sc38_ringer, + &SkyCompact::dog_bark_thing, + // 39comp.inc: + &SkyCompact::sc39_floor, + &SkyCompact::sc39_exit_31, + &SkyCompact::sc39_exit_40, + &SkyCompact::sc39_exit_41, + &SkyCompact::sc39_walters, + // 40comp.inc: + &SkyCompact::sc40_floor, + &SkyCompact::sc40_exit_39, + &SkyCompact::sc40_cabinet, + &SkyCompact::sc40_trolley, + &SkyCompact::sc40_locker_1, + &SkyCompact::sc40_locker_2, + &SkyCompact::sc40_locker_3, + &SkyCompact::sc40_locker_4, + &SkyCompact::sc40_locker_5, + &SkyCompact::sc40_body_1, + &SkyCompact::sc40_body_2, + &SkyCompact::sc40_body_3, + &SkyCompact::sc40_body_4, + &SkyCompact::sc40_body_5, + // 41comp.inc: + &SkyCompact::sc41_floor, + &SkyCompact::sc41_exit_39, + &SkyCompact::sc41_heat_1, + &SkyCompact::sc41_heat_2, + &SkyCompact::sc41_heat_3, + // 42comp.inc + &SkyCompact::sc42_judge, + &SkyCompact::sc42_clerk, + &SkyCompact::sc42_prosecution, + &SkyCompact::sc42_jobsworth, + &SkyCompact::sc42_sign, + // 44comp.inc + &SkyCompact::sc44_floor, + &SkyCompact::sc44_exit_45, + &SkyCompact::sc44_grill, + &SkyCompact::sc44_rubble, + // 45comp.inc: + &SkyCompact::sc45_floor, + &SkyCompact::sc45_exit_44, + &SkyCompact::sc45_exit_46, + &SkyCompact::sc45_exit_47, + // 46comp.inc: + &SkyCompact::sc46_floor, + &SkyCompact::sc46_exit_45, + &SkyCompact::sc46_rubble, + // 47comp.inc: + &SkyCompact::sc47_floor, + &SkyCompact::sc47_exit_45, + &SkyCompact::sc47_exit_48, + // 48comp.inc: + &SkyCompact::sc48_floor, + &SkyCompact::sc48_exit_47, + &SkyCompact::sc48_exit_65, + &SkyCompact::sc48_socket, + &SkyCompact::sc48_hole, + &SkyCompact::sc48_eyes, + // 65comp.inc: + &SkyCompact::sc65_floor, + &SkyCompact::sc65_exit_48, + &SkyCompact::sc65_exit_66, + &SkyCompact::sc65_poster1, + &SkyCompact::sc65_poster2, + &SkyCompact::sc65_sign, + + // 5compact.asm + //66comp.inc: + &SkyCompact::sc66_hole, + &SkyCompact::sc66_door, + &SkyCompact::sc66_hi_beam, + &SkyCompact::sc66_lo_beam, + &SkyCompact::sc66_rock1, + &SkyCompact::sc66_rock2, + &SkyCompact::sc66_rock3, + &SkyCompact::sc66_stones, + //67comp.inc: + &SkyCompact::sc67_floor, + &SkyCompact::sc67_door, + &SkyCompact::sc67_brickwork, + &SkyCompact::sc67_plaster, + &SkyCompact::sc67_plaster, + &SkyCompact::sc67_brick, + &SkyCompact::sc67_clot, + &SkyCompact::sc67_vein, + &SkyCompact::sc67_rock, + &SkyCompact::sc67_pulse1, + &SkyCompact::sc67_pulse2, + &SkyCompact::sc67_pulse3, + &SkyCompact::sc67_pulse4, + &SkyCompact::sc67_crowbar, + &SkyCompact::sc67_mend, + //68comp.inc: + &SkyCompact::sc68_floor, + &SkyCompact::sc68_door, + &SkyCompact::sc68_grill, + &SkyCompact::sc68_sensor, + &SkyCompact::sc68_stairs, + &SkyCompact::sc68_exit, + &SkyCompact::sc68_pulse1, + &SkyCompact::sc68_pulse2, + &SkyCompact::sc68_pulse3, + &SkyCompact::sc68_pulse4, + &SkyCompact::sc68_pulse5, + &SkyCompact::sc68_pulse6, + //69comp.inc: + &SkyCompact::sc69_floor, + &SkyCompact::sc69_exit, + &SkyCompact::sc69_door, + &SkyCompact::sc69_grill, + &SkyCompact::sc69_pulse1, + &SkyCompact::sc69_pulse2, + &SkyCompact::sc69_pulse3, + &SkyCompact::sc69_pulse4, + &SkyCompact::sc69_pulse5, + &SkyCompact::sc69_pulse6, + //70comp.inc: + &SkyCompact::sc70_floor, + &SkyCompact::sc70_pit, + &SkyCompact::sc70_door, + &SkyCompact::sc70_iris, + &SkyCompact::sc70_bar, + &SkyCompact::sc70_grill, + &SkyCompact::sc70_control, + // 71comp.inc + &SkyCompact::sc71_fake_floor, + &SkyCompact::sc71_floor, + &SkyCompact::sc71_door69, + &SkyCompact::sc71_door72, + &SkyCompact::sc71_locked_door, + &SkyCompact::sc71_recharger, + &SkyCompact::sc71_panel2, + &SkyCompact::sc71_monitor, + &SkyCompact::sc71_controls, + &SkyCompact::sc71_light1, + &SkyCompact::sc71_chlite, + &SkyCompact::sc71_medi_slot, + &SkyCompact::medi, + //SkyCompact::medi_auto uint8* + // 72comp.inc + &SkyCompact::sc72_fake_floor, + &SkyCompact::sc72_floor, + &SkyCompact::sc72_door, + &SkyCompact::sc72_exit, + &SkyCompact::sc72_tank, + &SkyCompact::sc72_tap, + &SkyCompact::sc72_spill, + &SkyCompact::sc72_grill, + &SkyCompact::sc72_chamber1, + &SkyCompact::sc72_cham1_light, + &SkyCompact::sc72_chamber2, + &SkyCompact::sc72_cham2_light, + &SkyCompact::sc72_chamber3, + &SkyCompact::sc72_computer, + &SkyCompact::sc72_computer2, + &SkyCompact::sc72_rot_light, + //wit dup 0 + &SkyCompact::witness, + //SkyCompact::wit_auto uint8* + // 73comp.inc: + &SkyCompact::sc73_floor, + &SkyCompact::sc73_exit, + &SkyCompact::sc73_chamber3, + &SkyCompact::sc73_chamber4, + &SkyCompact::sc73_cham4_light, + &SkyCompact::sc73_chamber5, + &SkyCompact::sc73_cham5_light, + &SkyCompact::sc73_big_door, + &SkyCompact::sc73_sensor, + &SkyCompact::sc73_door, + &SkyCompact::sc73_locked_door, + &SkyCompact::sc73_bits, + &SkyCompact::sc73_bits2, + &SkyCompact::sc73_spray, + // gal dup 0 + &SkyCompact::gallagher, + //SkyCompact::gal_auto uint8* + // 74comp.inc: + &SkyCompact::sc74_floor, + &SkyCompact::sc74_interface, + &SkyCompact::sc74_int_slot, + &SkyCompact::sc74_door, + &SkyCompact::sc74_monitor1, + &SkyCompact::sc74_monitor2, + &SkyCompact::sc74_monitor3, + &SkyCompact::sc74_monitor4, + &SkyCompact::sc74_left_tv, + &SkyCompact::sc74_right_tv, + &SkyCompact::sc74_lights, + &SkyCompact::sc74_terminal, + &SkyCompact::sc74_pod, + // 75comp.inc: + &SkyCompact::sc75_floor, + &SkyCompact::sc75_big_door, + &SkyCompact::sc75_door, + &SkyCompact::sc75_nitro_tank, + &SkyCompact::sc75_live_tank, + &SkyCompact::sc75_console, + &SkyCompact::sc75_light1, + &SkyCompact::sc75_light2, + &SkyCompact::sc75_tongs, + // 76comp.inc + &SkyCompact::sc76_floor, + &SkyCompact::sc76_door75, + &SkyCompact::sc76_door77, + &SkyCompact::sc76_android_1, + &SkyCompact::sc76_android_2, + &SkyCompact::sc76_android_3, + &SkyCompact::sc76_console_1, + &SkyCompact::sc76_console_2, + &SkyCompact::sc76_console_3, + &SkyCompact::sc76_cabinet_1, + &SkyCompact::sc76_cabinet_2, + &SkyCompact::sc76_cabinet_3, + &SkyCompact::sc76_board_1, + &SkyCompact::sc76_board_2, + &SkyCompact::sc76_board_3, + &SkyCompact::sc76_light1, + &SkyCompact::sc76_light2, + &SkyCompact::sc76_light3, + &SkyCompact::sc76_light4, + &SkyCompact::sc76_light5, + &SkyCompact::sc76_light6, + &SkyCompact::sc76_light7, + &SkyCompact::sc76_light8, + &SkyCompact::sc76_light9, + &SkyCompact::ken, + //SkyCompact::ken_auto uint8* + // 77comp.inc: + &SkyCompact::sc77_floor, + &SkyCompact::sc77_door76, + &SkyCompact::sc77_big_door, + &SkyCompact::sc77_tank_1, + &SkyCompact::sc77_tank_2, + &SkyCompact::sc77_hand_1, + &SkyCompact::sc77_hand_2, + // 78comp.inc: + &SkyCompact::sc78_ledge, + &SkyCompact::sc78_pipe, + &SkyCompact::sc78_big_door, + &SkyCompact::sc78_exit, + &SkyCompact::sc78_support, + // 79comp.inc: + &SkyCompact::sc79_pipe, + &SkyCompact::sc79_exit, + &SkyCompact::sc79_support, + &SkyCompact::sc79_ladder, + &SkyCompact::sc79_knot, + &SkyCompact::sc79_rope, + // 80comp.inc: + &SkyCompact::sc80_spout, + &SkyCompact::sc80_ladder, + &SkyCompact::sc80_rope, + &SkyCompact::sc80_orifice, + &SkyCompact::sc80_exit, + &SkyCompact::sc80_sample, + &SkyCompact::sc80_goo, + &SkyCompact::sc80_bubble1, + &SkyCompact::sc80_bubble2, + &SkyCompact::sc80_bubble3, + &SkyCompact::sc80_bubble4, + &SkyCompact::sc80_bubble5, + &SkyCompact::sc80_bubble6, + &SkyCompact::sc80_bubble7, + &SkyCompact::sc80_bubble8, + &SkyCompact::sc80_bubble9, + &SkyCompact::sc80_bubble10, + &SkyCompact::sc80_bubble11, + &SkyCompact::sc80_bubble12, + // 81comp.inc: + &SkyCompact::sc81_father, + &SkyCompact::sc81_father_sat, + &SkyCompact::sc81_foster_sat, + &SkyCompact::sc81_ken_sat, + &SkyCompact::sc81_door, + &SkyCompact::sc81_chair, + &SkyCompact::sc81_helmet, + &SkyCompact::sc81_tent1, + &SkyCompact::sc81_tent2, + &SkyCompact::sc81_tent3, + &SkyCompact::sc81_tent4, + &SkyCompact::sc81_tent5, + &SkyCompact::sc81_tent6, + &SkyCompact::sc81_big_tent1, + &SkyCompact::sc81_big_tent2, + &SkyCompact::sc81_big_tent3, + // 82comp.inc: + &SkyCompact::sc82_jobsworth, + //6compact.asm + // 90comp.inc: + &SkyCompact::sc90_floor, + &SkyCompact::sc90_smfloor, + &SkyCompact::door_l90, + &SkyCompact::door_l90f, + &SkyCompact::door_r90, + &SkyCompact::door_r90f, + &SkyCompact::join_object, + &SkyCompact::oscillator, + &SkyCompact::eyeball_90, + // 91comp.inc: + &SkyCompact::sc91_floor, + &SkyCompact::door_l91, + &SkyCompact::door_l91f, + &SkyCompact::door_r91, + &SkyCompact::door_r91f, + &SkyCompact::door_t91, + &SkyCompact::door_t91r, + &SkyCompact::bag_91, + &SkyCompact::decomp_obj, + &SkyCompact::decrypt_obj, + &SkyCompact::report_book, + &SkyCompact::eyeball_91, + // 92comp.inc: + &SkyCompact::slab1, + &SkyCompact::slab2, + &SkyCompact::slab3, + &SkyCompact::slab4, + &SkyCompact::slab5, + &SkyCompact::slab6, + &SkyCompact::slab7, + &SkyCompact::slab8, + &SkyCompact::slab9, + &SkyCompact::bridge_a, + &SkyCompact::bridge_b, + &SkyCompact::bridge_c, + &SkyCompact::bridge_d, + &SkyCompact::bridge_e, + &SkyCompact::bridge_f, + &SkyCompact::bridge_g, + &SkyCompact::bridge_h, + &SkyCompact::door_l92, + &SkyCompact::door_l92f, + &SkyCompact::door_r92, + &SkyCompact::door_r92r, + &SkyCompact::green_circle, + &SkyCompact::red_circle, + // 93comp.inc: + &SkyCompact::sc93_floor, + &SkyCompact::door_l93, + &SkyCompact::door_l93f, + &SkyCompact::persona, + &SkyCompact::adjust_book, + // 94comp.inc: + &SkyCompact::sc94_floor, + &SkyCompact::door_l94, + &SkyCompact::door_l94r, + &SkyCompact::door_r94, + &SkyCompact::door_r94r, + &SkyCompact::hologram_pad, + &SkyCompact::hologram_a, + &SkyCompact::hologram_b, + // 95comp.inc: + &SkyCompact::sc95_floor, + &SkyCompact::door_l95, + &SkyCompact::door_l95f, + &SkyCompact::door_r95, + &SkyCompact::door_r95f, + &SkyCompact::door_t95, + &SkyCompact::door_t95r, + &SkyCompact::guardian, + &SkyCompact::weight, + // 96comp.inc: + &SkyCompact::sc96_floor, + &SkyCompact::door_l96, + &SkyCompact::door_l96f, + &SkyCompact::crystal, + &SkyCompact::virus, + // lincmenu.inc: + &SkyCompact::info_menu, + &SkyCompact::read_menu, + &SkyCompact::open_menu, + &SkyCompact::charon_menu, + &SkyCompact::orders_menu, + &SkyCompact::orders2_menu, + &SkyCompact::join_menu, + &SkyCompact::green_menu, + &SkyCompact::red_menu, + &SkyCompact::report_menu, + &SkyCompact::report2_menu, + &SkyCompact::decomp_menu, + &SkyCompact::decrypt_menu, + &SkyCompact::persona_menu, + &SkyCompact::adjust_menu, + &SkyCompact::adjust2_menu, + &SkyCompact::playbak_menu, + &SkyCompact::blind_menu, + &SkyCompact::oscill_menu, + &SkyCompact::kill_menu, + &SkyCompact::virus_menu, + // linc_gen.inc: + &SkyCompact::window_1, + &SkyCompact::window_2, + &SkyCompact::window_3, + &SkyCompact::window_4, + &SkyCompact::info_button +}; + +uint8 *SkyControl::_saveLoadARs[18] = { + SkyCompact::joey_auto, + SkyCompact::lamb_auto, + SkyCompact::monitor_auto, + SkyCompact::ss_auto, + SkyCompact::full_ss_auto, + SkyCompact::loader_auto, + SkyCompact::shades_auto, + SkyCompact::jobs_auto, + SkyCompact::foreman_auto, + SkyCompact::radman_auto, + SkyCompact::burke_auto, + SkyCompact::babs_auto, + SkyCompact::dan_auto, + SkyCompact::spu_auto, + SkyCompact::medi_auto, + SkyCompact::wit_auto, + SkyCompact::gal_auto, + SkyCompact::ken_auto +};
\ No newline at end of file diff --git a/sky/control.cpp b/sky/control.cpp index 940c109987..7a2e5cc9be 100644 --- a/sky/control.cpp +++ b/sky/control.cpp @@ -23,6 +23,7 @@ #include "sky/skydefs.h" #include "sky/sky.h" #include "common/file.h" +#include "common/gameDetector.h" SkyConResource::SkyConResource(void *pSpData, uint32 pNSprites, uint32 pCurSprite, uint16 pX, uint16 pY, uint32 pText, uint8 pOnClick, OSystem *system, uint8 *screen) { @@ -161,6 +162,8 @@ void SkyControl::initPanel(void) { memset(_screenBuf, 0, GAME_SCREEN_WIDTH * FULL_SCREEN_HEIGHT); uint16 volY = (127 - _skyMusic->giveVolume()) / 4 + 59 - MPNL_Y; // volume slider's Y coordinate + uint16 spdY = 12 - (SkyState::_systemVars.gameSpeed / SPEED_MULTIPLY); + spdY += MPNL_Y + 93; // speed slider's initial position _sprites.controlPanel = _skyDisk->loadFile(60500, NULL); _sprites.button = _skyDisk->loadFile(60501, NULL); @@ -176,7 +179,7 @@ void SkyControl::initPanel(void) { //Main control panel: X Y Text OnClick _controlPanel = createResource(_sprites.controlPanel, 1, 0, 0, 0, 0, DO_NOTHING, MAINPANEL); _exitButton = createResource( _sprites.button, 3, 0, 16, 125, 50, EXIT, MAINPANEL); - _slide = createResource( _sprites.slide2, 1, 0, 19, 99, 95, SPEED_SLIDE, MAINPANEL); + _slide = createResource( _sprites.slide2, 1, 0, 19,spdY, 95, SPEED_SLIDE, MAINPANEL); _slide2 = createResource( _sprites.slide2, 1, 0, 19,volY, 14, MUSIC_SLIDE, MAINPANEL); _slode = createResource( _sprites.slode2, 1, 0, 9, 49, 0, DO_NOTHING, MAINPANEL); _restorePanButton = createResource( _sprites.button, 3, 0, 58, 19, 51, REST_GAME_PANEL, MAINPANEL); @@ -187,7 +190,15 @@ void SkyControl::initPanel(void) { _fxPanButton = createResource( _sprites.button, 3, 0, 58, 99, 86, TOGGLE_FX, MAINPANEL); else _fxPanButton = createResource( _sprites.button, 3, 2, 58, 99, 87, TOGGLE_FX, MAINPANEL); - _musicPanButton = createResource( _sprites.button, 3, 0, 58, 119, 35, TOGGLE_MS, MAINPANEL); + + if (SkyState::isCDVersion()) { // CD Version: Toggle text/speech + if (SkyState::_systemVars.systemFlags & SF_ALLOW_TEXT) + _musicPanButton = createResource( _sprites.button, 3, 2, 58, 119, 21, TOGGLE_TEXT, MAINPANEL); + else + _musicPanButton = createResource( _sprites.button, 3, 0, 58, 119, 35, TOGGLE_TEXT, MAINPANEL); + } else { // disk version: toggle music on/off + _musicPanButton = createResource( _sprites.button, 3, 0, 58, 119, 91, TOGGLE_MS, MAINPANEL); + } _bodge = createResource( _sprites.musicBodge, 2, 1, 98, 115, 0, DO_NOTHING, MAINPANEL); _yesNo = createResource( _sprites.yesNo, 1, 0, -2, 40, 0, DO_NOTHING, MAINPANEL); @@ -287,6 +298,8 @@ void SkyControl::doControlPanel(void) { _skyScreen->setPalette(60510); drawMainPanel(); + + uint16 savedMouse = _skyMouse->giveCurrentMouseType(); _skyMouse->spriteMouse(MOUSE_NORMAL,0,0); bool quitPanel = false; @@ -328,6 +341,7 @@ void SkyControl::doControlPanel(void) { _skyScreen->forceRefresh(); _skyScreen->setPalette((uint8*)SkyState::fetchCompact(SkyState::_systemVars.currentPalette)); removePanel(); + _skyMouse->spriteMouse(savedMouse, 0, 0); } uint16 SkyControl::handleClick(SkyConResource *pButton) { @@ -373,7 +387,8 @@ uint16 SkyControl::handleClick(SkyConResource *pButton) { return shiftUp(SLOW); case SPEED_SLIDE: - return 0; + _mouseClicked = true; + return doSpeedSlide(); case MUSIC_SLIDE: _mouseClicked = true; @@ -385,6 +400,9 @@ uint16 SkyControl::handleClick(SkyConResource *pButton) { case TOGGLE_MS: return 0; + case TOGGLE_TEXT: + return toggleText(pButton); + case EXIT: animClick(pButton); return QUIT_PANEL; @@ -395,6 +413,11 @@ uint16 SkyControl::handleClick(SkyConResource *pButton) { case QUIT_TO_DOS: animClick(pButton); + if (getYesNo()) { + showGameQuitMsg(false); + delay(1500); + _system->quit(); + } return 0; default: @@ -402,6 +425,36 @@ uint16 SkyControl::handleClick(SkyConResource *pButton) { } } +bool SkyControl::getYesNo(void) { + + _yesNo->drawToScreen(WITH_MASK); + bool retVal; bool quitPanel = false; + uint8 mouseType = MOUSE_NORMAL; + uint8 wantMouse = MOUSE_NORMAL; + while (!quitPanel) { + if (mouseType != wantMouse) { + mouseType = wantMouse; + _skyMouse->spriteMouse(mouseType, 0, 0); + } + _system->update_screen(); + delay(50); + if ((_mouseY >= 83) && (_mouseY <= 110)) { + if ((_mouseX >= 77) && (_mouseX <= 114)) { // over 'yes' + wantMouse = MOUSE_CROSS; + if (_mouseClicked) { + quitPanel = true; retVal = true; + } + } else if ((_mouseX >= 156) && (_mouseX <= 193)) { // over 'no' + wantMouse = MOUSE_CROSS; + if (_mouseClicked) { + quitPanel = true; retVal = false; + } + } else wantMouse = MOUSE_NORMAL; + } else wantMouse = MOUSE_NORMAL; + } + return retVal; +} + uint16 SkyControl::doMusicSlide(void) { int ofsY = _slide2->_y - _mouseY; @@ -428,6 +481,33 @@ uint16 SkyControl::doMusicSlide(void) { return 0; } +uint16 SkyControl::doSpeedSlide(void) { + + /*int ofsY = _slide->_y - _mouseY; + uint16 speedDelay = 12 - (_slide->_y - (MPNL_Y + 93)); + speedDelay *= SPEED_MULTIPLY; + while (_mouseClicked) { + delay(50); + int newY = ofsY + _mouseY; + if (newY < MPNL_Y + 93) newY = MPNL_Y + 93; + if (newY > MPNL_Y + 104) newY = MPNL_Y + 104; + if (newY != _slide->_y) { + _slode->drawToScreen(NO_MASK); + _slide->setXY(_slide->_x, (uint16)newY); + _slide->drawToScreen(WITH_MASK); + _slide2->drawToScreen(WITH_MASK); + speedDelay = 12 - (newY - (MPNL_Y + 93)); + speedDelay *= SPEED_MULTIPLY; + } + buttonControl(_slide); + _text->drawToScreen(WITH_MASK); + _system->update_screen(); + } + SkyState::_systemVars.gameSpeed = speedDelay; + printf("New delay: %d\n",speedDelay);*/ + return SPEED_CHANGED; +} + uint16 SkyControl::toggleFx(SkyConResource *pButton) { SkyState::_systemVars.systemFlags ^= SF_FX_OFF; @@ -444,6 +524,24 @@ uint16 SkyControl::toggleFx(SkyConResource *pButton) { return TOGGLED; } +uint16 SkyControl::toggleText(SkyConResource *pButton) { + + SkyState::_systemVars.systemFlags ^= SF_ALLOW_SPEECH; + if (SkyState::_systemVars.systemFlags & SF_ALLOW_SPEECH) { + pButton->_curSprite = 0; + pButton->_text = 0x7000 + 35; + SkyState::_systemVars.systemFlags &= ~SF_ALLOW_TEXT; + } else { + pButton->_curSprite = 2; + pButton->_text = 0x7000 + 21; + SkyState::_systemVars.systemFlags |= SF_ALLOW_TEXT; + } + pButton->drawToScreen(WITH_MASK); + buttonControl(pButton); + _system->update_screen(); + return TOGGLED; +} + uint16 SkyControl::shiftDown(uint8 speed) { if (speed == SLOW) { @@ -490,8 +588,6 @@ uint16 SkyControl::saveRestorePanel(bool allowEdit) { _quitButton->drawToScreen(NO_MASK); loadSaveDescriptions(saveGameTexts); - setUpGameSprites(saveGameTexts, textSprites, _firstText); - uint16 selectedGame = 0; bool quitPanel = false; @@ -499,6 +595,7 @@ uint16 SkyControl::saveRestorePanel(bool allowEdit) { uint16 clickRes = 0; while (!quitPanel) { if (refreshNames) { + setUpGameSprites(saveGameTexts, textSprites, _firstText); showSprites(textSprites); refreshNames = false; } @@ -512,6 +609,7 @@ uint16 SkyControl::saveRestorePanel(bool allowEdit) { clickRes = CANCEL_PRESSED; quitPanel = true; } + bool haveButton = false; for (cnt = 0; cnt < 6; cnt++) if (lookList[cnt]->isMouseOver(_mouseX, _mouseY)) { @@ -522,15 +620,15 @@ uint16 SkyControl::saveRestorePanel(bool allowEdit) { _mouseClicked = false; clickRes = handleClick(lookList[cnt]); + if ((clickRes == CANCEL_PRESSED) || (clickRes == GAME_SAVED) || (clickRes == GAME_RESTORED) || (clickRes == NO_DISK_SPACE)) quitPanel = true; - if (clickRes == SHIFTED) { - setUpGameSprites(saveGameTexts, textSprites, _firstText); + if (clickRes == SHIFTED) refreshNames = true; - } } } + if (_mouseClicked) { if ((_mouseX >= GAME_NAME_X) && (_mouseX <= GAME_NAME_X + PAN_LINE_WIDTH) && (_mouseY >= GAME_NAME_Y) && (_mouseY <= GAME_NAME_Y + PAN_CHAR_HEIGHT * MAX_ON_SCREEN)) { @@ -539,7 +637,6 @@ uint16 SkyControl::saveRestorePanel(bool allowEdit) { } } if (!haveButton) buttonControl(NULL); - } for (cnt = 0; cnt < MAX_ON_SCREEN; cnt++) @@ -589,6 +686,7 @@ void SkyControl::loadSaveDescriptions(uint8 *destBuf) { while ((destPos[nameCnt + 5] = inPos[nameCnt])) nameCnt++; destPos += MAX_TEXT_LEN; + inPos += nameCnt + 1; } free(tmpBuf); inf->close(); @@ -601,6 +699,162 @@ void SkyControl::loadSaveDescriptions(uint8 *destBuf) { } } +uint16 SkyControl::saveGameToFile(char *fName) { + + File *outf = new File(); + if (!outf->open(fName, _savePath, File::kFileWriteMode)) { + delete outf; + return NO_DISK_SPACE; + } + + uint8 *saveData = (uint8*)malloc(0x20000); + uint32 fSize = prepareSaveData(saveData); + + if (outf->write(saveData, fSize) != fSize) { + free(saveData); + delete outf; + return NO_DISK_SPACE; + } + outf->close(); + delete outf; + free(saveData); + return GAME_SAVED; +} + +#define STOSD(ptr, val) { *(uint32*)(ptr) = TO_LE_32(val); (ptr) += 4; } +#define STOSW(ptr, val) { *(uint16*)(ptr) = TO_LE_16(val); (ptr) += 2; } + +void SkyControl::stosMegaSet(uint8 **destPos, MegaSet *mega) { + STOSW(*destPos, mega->gridWidth); + STOSW(*destPos, mega->colOffset); + STOSW(*destPos, mega->colWidth); + STOSW(*destPos, mega->lastChr); + // anims, stands, turnTable +} + +void SkyControl::stosCompact(uint8 **destPos, Compact *cpt) { + uint16 saveType = 0; + if (cpt->extCompact) { + saveType |= SAVE_EXT; + if (cpt->extCompact->megaSet0) saveType |= SAVE_MEGA0; + if (cpt->extCompact->megaSet1) saveType |= SAVE_MEGA1; + if (cpt->extCompact->megaSet2) saveType |= SAVE_MEGA2; + if (cpt->extCompact->megaSet3) saveType |= SAVE_MEGA3; + } + STOSW(*destPos, saveType); + STOSW(*destPos, cpt->logic); + STOSW(*destPos, cpt->status); + STOSW(*destPos, cpt->sync); + STOSW(*destPos, cpt->screen); + STOSW(*destPos, cpt->place); + // getToTable + STOSW(*destPos, cpt->xcood); + STOSW(*destPos, cpt->ycood); + STOSW(*destPos, cpt->frame); + STOSW(*destPos, cpt->cursorText); + STOSW(*destPos, cpt->mouseOn); + STOSW(*destPos, cpt->mouseOff); + STOSW(*destPos, cpt->mouseClick); + STOSW(*destPos, cpt->mouseRelX); + STOSW(*destPos, cpt->mouseRelY); + STOSW(*destPos, cpt->mouseSizeX); + STOSW(*destPos, cpt->mouseSizeY); + STOSW(*destPos, cpt->actionScript); + STOSW(*destPos, cpt->upFlag); + STOSW(*destPos, cpt->downFlag); + STOSW(*destPos, cpt->getToFlag); + STOSW(*destPos, cpt->flag); + STOSW(*destPos, cpt->mood); + // grafixProg + STOSW(*destPos, cpt->offset); + STOSW(*destPos, cpt->mode); + STOSW(*destPos, cpt->baseSub); + STOSW(*destPos, cpt->baseSub_off); + if (cpt->extCompact) { + STOSW(*destPos, cpt->extCompact->actionSub); + STOSW(*destPos, cpt->extCompact->actionSub_off); + STOSW(*destPos, cpt->extCompact->getToSub); + STOSW(*destPos, cpt->extCompact->getToSub_off); + STOSW(*destPos, cpt->extCompact->extraSub); + STOSW(*destPos, cpt->extCompact->extraSub_off); + STOSW(*destPos, cpt->extCompact->dir); + STOSW(*destPos, cpt->extCompact->stopScript); + STOSW(*destPos, cpt->extCompact->miniBump); + STOSW(*destPos, cpt->extCompact->leaving); + STOSW(*destPos, cpt->extCompact->atWatch); + STOSW(*destPos, cpt->extCompact->atWas); + STOSW(*destPos, cpt->extCompact->alt); + STOSW(*destPos, cpt->extCompact->request); + STOSW(*destPos, cpt->extCompact->spWidth_xx); + STOSW(*destPos, cpt->extCompact->spColour); + STOSW(*destPos, cpt->extCompact->spTextId); + STOSW(*destPos, cpt->extCompact->spTime); + STOSW(*destPos, cpt->extCompact->arAnimIndex); + // turnProg + STOSW(*destPos, cpt->extCompact->waitingFor); + STOSW(*destPos, cpt->extCompact->arTargetX); + STOSW(*destPos, cpt->extCompact->arTargetY); + // animScratch + STOSW(*destPos, cpt->extCompact->megaSet); + + if (cpt->extCompact->megaSet0) + stosMegaSet(destPos, cpt->extCompact->megaSet0); + if (cpt->extCompact->megaSet1) + stosMegaSet(destPos, cpt->extCompact->megaSet1); + if (cpt->extCompact->megaSet2) + stosMegaSet(destPos, cpt->extCompact->megaSet2); + if (cpt->extCompact->megaSet3) + stosMegaSet(destPos, cpt->extCompact->megaSet3); + } +} + +void SkyControl::stosAR(uint8 **destPos, uint8 *arData) { + + uint16 *data = (uint16*)arData; + for (uint8 cnt = 0; cnt < 32; cnt++) + STOSW(*destPos, TO_LE_16(data[cnt])); +} + +uint32 SkyControl::prepareSaveData(uint8 *destBuf) { + + uint32 cnt; + memset(destBuf, 0, 4); // space for data size + uint8 *destPos = destBuf + 4; + memcpy(destPos, SAVE_HEADER, sizeof(SAVE_HEADER)); + destPos += sizeof(SAVE_HEADER); + //STOSD(destPos, SkyLogic::_scriptVariables[CUR_SECTION]); + STOSD(destPos, _skyMusic->giveCurrentMusic()); + + //TODO: save queued sfx + STOSD(destPos, _skyText->giveCurrentCharSet()); + STOSD(destPos, _skyMouse->giveCurrentMouseType()); + STOSD(destPos, SkyState::_systemVars.currentPalette); + for (cnt = 0; cnt < 838; cnt++) + STOSD(destPos, SkyLogic::_scriptVariables[cnt]); + uint32 *loadedFilesList = _skyDisk->giveLoadedFilesList(); + + for (cnt = 0; cnt < 60; cnt++) + STOSD(destPos, loadedFilesList[cnt]); + + for (cnt = 0; cnt < ARRAYSIZE(_saveLoadCpts); cnt++) + stosCompact(&destPos, _saveLoadCpts[cnt]); + + for (cnt = 0; cnt < ARRAYSIZE(_saveLoadARs); cnt++) + stosAR(&destPos, _saveLoadARs[cnt]); + + for (cnt = 0; cnt < 3; cnt++) + STOSW(destPos, SkyCompact::park_table[cnt]); + + for (cnt = 0; cnt < 13; cnt++) + STOSW(destPos, SkyCompact::high_floor_table[cnt]); + + *(uint32*)destBuf = TO_LE_32(destPos - destBuf); // save size + return destPos - destBuf; +} + +#undef STOSD +#undef STOSW + void SkyControl::delay(unsigned int amount) { OSystem::Event event; @@ -642,6 +896,8 @@ void SkyControl::delay(unsigned int amount) { break; case OSystem::EVENT_QUIT: + showGameQuitMsg(false); + delay(1500); _system->quit(); break; @@ -659,3 +915,41 @@ void SkyControl::delay(unsigned int amount) { cur = _system->get_msecs(); } while (cur < start + amount); } + +void SkyControl::showGameQuitMsg(bool useScreen) { + + uint8 *textBuf1 = (uint8*)malloc(GAME_SCREEN_WIDTH * 14 + sizeof(dataFileHeader)); + uint8 *textBuf2 = (uint8*)malloc(GAME_SCREEN_WIDTH * 14 + sizeof(dataFileHeader)); + char *vText1, *vText2; + uint8 *screenData; + if (useScreen) + screenData = _skyScreen->giveCurrent(); + else + screenData = _screenBuf; + switch (SkyState::_systemVars.language) { + case DE_DEU: vText1 = VIG_DE1; vText2 = VIG_DE2; break; + case FR_FRA: vText1 = VIG_FR1; vText2 = VIG_FR2; break; + case IT_ITA: vText1 = VIG_IT1; vText2 = VIG_IT2; break; + case PT_BRA: vText1 = VIG_PT1; vText2 = VIG_PT2; break; + default: vText1 = VIG_EN1; vText2 = VIG_EN2; break; + } + _skyText->displayText(vText1, textBuf1, true, 320, 255); + _skyText->displayText(vText2, textBuf2, true, 320, 255); + uint8 *curLine1 = textBuf1 + sizeof(dataFileHeader); + uint8 *curLine2 = textBuf2 + sizeof(dataFileHeader); + uint8 *targetLine = screenData + GAME_SCREEN_WIDTH * 80; + for (uint8 cnty = 0; cnty < PAN_CHAR_HEIGHT; cnty++) { + for (uint16 cntx = 0; cntx < GAME_SCREEN_WIDTH; cntx++) { + if (curLine1[cntx]) + targetLine[cntx] = curLine1[cntx]; + if (curLine2[cntx]) + (targetLine + 24 * GAME_SCREEN_WIDTH)[cntx] = curLine2[cntx]; + } + curLine1 += GAME_SCREEN_WIDTH; + curLine2 += GAME_SCREEN_WIDTH; + targetLine += GAME_SCREEN_WIDTH; + } + _skyScreen->halvePalette(); + _skyScreen->showScreen(screenData); + free(textBuf1); free(textBuf2); +} diff --git a/sky/control.h b/sky/control.h index d8ef8d621f..62ccdc604d 100644 --- a/sky/control.h +++ b/sky/control.h @@ -71,9 +71,10 @@ #define MUSIC_SLIDE 11 #define TOGGLE_FX 12 #define TOGGLE_MS 13 -#define EXIT 14 -#define RESTART 15 -#define QUIT_TO_DOS 16 +#define TOGGLE_TEXT 14 +#define EXIT 15 +#define RESTART 16 +#define QUIT_TO_DOS 17 // onClick return codes #define CANCEL_PRESSED 100 @@ -91,6 +92,17 @@ #define SLOW 0 #define FAST 1 +#define SPEED_MULTIPLY 8 + +//- +#define SAVE_EXT 1 +#define SAVE_MEGA0 2 +#define SAVE_MEGA1 4 +#define SAVE_MEGA2 8 +#define SAVE_MEGA3 16 + +#define SAVE_HEADER "(C) Revolution Software Ltd 1993.\x00System 2 written by David Sykes and Tony Warriner\x0D\x0APortable implementation done by the ScummVM team\x0D\x0ASave File Revision 1\x00" + class SkyConResource { public: SkyConResource(void *pSpData, uint32 pNSprites, uint32 pCurSprite, uint16 pX, uint16 pY, uint32 pText, uint8 pOnClick, OSystem *system, uint8 *screen); @@ -125,6 +137,7 @@ class SkyControl { public: SkyControl(SkyScreen *screen, SkyDisk *disk, SkyMouse *mouse, SkyText *text, SkyMusicBase *music, OSystem *system, const char *savePath); void doControlPanel(void); + void showGameQuitMsg(bool useScreen = true); private: void initPanel(void); @@ -136,13 +149,25 @@ private: void setUpGameSprites(uint8 *nameBuf, dataFileHeader **nameSprites, uint16 firstNum); void showSprites(dataFileHeader **nameSprites); void animClick(SkyConResource *pButton); + bool getYesNo(void); uint16 doMusicSlide(void); + uint16 doSpeedSlide(void); uint16 handleClick(SkyConResource *pButton); uint16 toggleFx(SkyConResource *pButton); + uint16 toggleText(SkyConResource *pButton); uint16 shiftDown(uint8 speed); uint16 shiftUp(uint8 speed); const char *_savePath; + uint16 saveGameToFile(char *fName); + void stosMegaSet(uint8 **destPos, MegaSet *mega); + void stosCompact(uint8 **destPos, Compact *cpt); + void stosAR(uint8 **destPos, uint8 *arData); + uint32 prepareSaveData(uint8 *destBuf); + uint16 restoreGameFromFile(char *fName); + static Compact *_saveLoadCpts[833]; // \ moved to sky/compacts/savedata.cpp + static uint8 *_saveLoadARs[18]; // / + uint16 saveRestorePanel(bool allowEdit); SkyScreen *_skyScreen; diff --git a/sky/disk.cpp b/sky/disk.cpp index a7592f9a10..130154f609 100644 --- a/sky/disk.cpp +++ b/sky/disk.cpp @@ -340,6 +340,24 @@ void SkyDisk::fnCacheFiles(void) { _buildList[0] = 0; } +void SkyDisk::refreshFilesList(uint32 *list) { + + uint8 cnt = 0; + while (_loadedFilesList[cnt]) { + if (SkyState::_itemList[_loadedFilesList[cnt] & 2047]) + free(SkyState::_itemList[_loadedFilesList[cnt] & 2047]); + SkyState::_itemList[_loadedFilesList[cnt] & 2047] = NULL; + cnt++; + } + cnt = 0; + while (list[cnt]) { + _loadedFilesList[cnt] = list[cnt]; + SkyState::_itemList[_loadedFilesList[cnt] & 2047] = (void**)loadFile((uint16)(_loadedFilesList[cnt] & 0x7FFF), NULL); + cnt++; + } + _loadedFilesList[cnt] = 0; +} + void SkyDisk::fnMiniLoad(uint16 fileNum) { uint16 cnt = 0; diff --git a/sky/disk.h b/sky/disk.h index 4b561f0faa..5b1a7e45bd 100644 --- a/sky/disk.h +++ b/sky/disk.h @@ -24,7 +24,7 @@ #include "common/file.h" -#define MAX_FILES_IN_LIST 60 +#define MAX_FILES_IN_LIST 60 struct PrefFile { uint8 *data; @@ -51,6 +51,8 @@ public: void fnCacheChip(uint32 list); void fnCacheFiles(void); void fnFlushBuffers(void); + uint32 *giveLoadedFilesList(void) { return _loadedFilesList; }; + void refreshFilesList(uint32 *list); protected: diff --git a/sky/logic.cpp b/sky/logic.cpp index 5718aefa57..f59bd92166 100644 --- a/sky/logic.cpp +++ b/sky/logic.cpp @@ -25,6 +25,7 @@ #include "sky/compact.h" #include "sky/skydefs.h" #include "sky/talks.h" +#include "common/gameDetector.h" uint32 SkyLogic::_scriptVariables[838]; @@ -1398,13 +1399,11 @@ bool SkyLogic::fnGetTo(uint32 targetPlaceId, uint32 mode, uint32 c) { _compact->mode += 4; // next level up Compact *cpt = SkyState::fetchCompact(_compact->place); if (!cpt) { - // FIXME: This should never happen warning("can't find _compact's getToTable. Place compact is NULL"); return false; } uint16 *getToTable = cpt->getToTable; if (!getToTable) { - // FIXME: This should never happen warning("Place compact's getToTable is NULL!"); return false; } @@ -2339,6 +2338,15 @@ void SkyLogic::stdSpeak(Compact *target, uint32 textNum, uint32 animNum, uint32 if (SkyState::isCDVersion()) speechUsed = _skySound->startSpeech((uint16)textNum); + // if sky is configured to speech-only return now - except if we're running another + // language than english + if (speechUsed && (!(SkyState::_systemVars.systemFlags & SF_ALLOW_TEXT)) && + (SkyState::_systemVars.language == EN_USA)) { + target->extCompact->spTime = 10; + target->logic = L_TALK; + return ; + } + //now form the text sprite struct lowTextManager_t textInfo; textInfo = _skyText->lowTextManager(textNum, FIXED_TEXT_WIDTH, 0, (uint8)target->extCompact->spColour, true); diff --git a/sky/module.mk b/sky/module.mk index efb2a8d01d..b690e80bbe 100644 --- a/sky/module.mk +++ b/sky/module.mk @@ -23,6 +23,7 @@ MODULE_OBJS = \ sky/music/gmmusic.o \ sky/music/mt32music.o \ sky/music/musicbase.o \ + sky/compacts/savedata.o \ # Include common rules include common.rules diff --git a/sky/mouse.h b/sky/mouse.h index 9b67e861a7..35a733efa1 100644 --- a/sky/mouse.h +++ b/sky/mouse.h @@ -50,6 +50,7 @@ public: void waitMouseNotPressed(void); uint16 giveMouseX(void) { return _aMouseX; }; uint16 giveMouseY(void) { return _aMouseY; }; + uint16 giveCurrentMouseType(void) { return _mouseType2; }; protected: diff --git a/sky/music/musicbase.h b/sky/music/musicbase.h index e237da9e71..eec14b4a5b 100644 --- a/sky/music/musicbase.h +++ b/sky/music/musicbase.h @@ -50,6 +50,7 @@ public: void startMusic(uint16 param) { _onNextPoll.musicToProcess = param & 0xF; }; // 4 virtual void setVolume(uint8 volume) = 0; uint8 giveVolume(void) { return (uint8)_musicVolume; }; + uint8 giveCurrentMusic(void) { return _currentMusic; }; protected: diff --git a/sky/sky.cpp b/sky/sky.cpp index 666699f6f0..e4fd8a88cb 100644 --- a/sky/sky.cpp +++ b/sky/sky.cpp @@ -75,50 +75,14 @@ SkyState::SkyState(GameDetector *detector, OSystem *syst) _introTextSave = 0; } -void SkyState::showQuitMsg(void) { - - uint8 *textBuf1 = (uint8*)calloc(GAME_SCREEN_WIDTH * 14 + sizeof(struct dataFileHeader),1); - uint8 *textBuf2 = (uint8*)calloc(GAME_SCREEN_WIDTH * 14 + sizeof(struct dataFileHeader),1); - char *vText1, *vText2; - uint8 *screenData = _skyScreen->giveCurrent(); - switch (_systemVars.language) { - case DE_DEU: vText1 = VIG_DE1; vText2 = VIG_DE2; break; - case FR_FRA: vText1 = VIG_FR1; vText2 = VIG_FR2; break; - case IT_ITA: vText1 = VIG_IT1; vText2 = VIG_IT2; break; - case PT_BRA: vText1 = VIG_PT1; vText2 = VIG_PT2; break; - default: vText1 = VIG_EN1; vText2 = VIG_EN2; break; - } - _skyText->displayText(vText1, textBuf1, true, 320, 255); - _skyText->displayText(vText2, textBuf2, true, 320, 255); - uint8 *curLine1 = textBuf1 + sizeof(struct dataFileHeader); - uint8 *curLine2 = textBuf2 + sizeof(struct dataFileHeader); - uint8 *targetLine = screenData + GAME_SCREEN_WIDTH * 80; - for (uint8 cnty = 0; cnty < 14; cnty++) { - for (uint16 cntx = 0; cntx < GAME_SCREEN_WIDTH; cntx++) { - if (curLine1[cntx]) - targetLine[cntx] = curLine1[cntx]; - if (curLine2[cntx]) - (targetLine + 24 * GAME_SCREEN_WIDTH)[cntx] = curLine2[cntx]; - } - curLine1 += GAME_SCREEN_WIDTH; - curLine2 += GAME_SCREEN_WIDTH; - targetLine += GAME_SCREEN_WIDTH; - } - _skyScreen->halvePalette(); - _skyScreen->showScreen(screenData); - free(textBuf1); free(textBuf2); -} - SkyState::~SkyState() { delete _skyLogic; delete _skySound; delete _skyMusic; - showQuitMsg(); delete _skyText; delete _skyMouse; delete _skyScreen; - delay(1500); } void SkyState::errorString(const char *buf1, char *buf2) { @@ -140,7 +104,7 @@ void SkyState::go() { loadBase0(); while (1) { - delay(50); + delay(_systemVars.gameSpeed); if ((_key_pressed == 27) || (_key_pressed == 63)) { // 27 = escape, 63 = F5 _key_pressed = 0; _skyControl->doControlPanel(); @@ -171,7 +135,13 @@ void SkyState::initialise(void) { else _skyMusic = new SkyGmMusic(_detector->createMidi(), _skyDisk); } + if (isCDVersion()) + _systemVars.systemFlags |= SF_ALLOW_SPEECH; + else + _systemVars.systemFlags |= SF_ALLOW_TEXT; + _systemVars.systemFlags |= SF_PLAY_VOCS; + _systemVars.gameSpeed = 50; _skyText = new SkyText(_skyDisk); _skyMouse = new SkyMouse(_system, _skyDisk); @@ -302,6 +272,8 @@ void SkyState::delay(uint amount) { //copied and mutilated from Simon.cpp break; case OSystem::EVENT_QUIT: + _skyControl->showGameQuitMsg(); + delay(1500); _system->quit(); break; @@ -45,10 +45,8 @@ struct SystemVars { uint32 gameVersion; uint32 mouseFlag; uint16 language; - uint32 currentPalette; // I guess that's for saving. - /* uint16 sfxVolume; - uint16 musicVolume; - uint16 gameSpeed; */ + uint32 currentPalette; + uint16 gameSpeed; }; class SkyLogic; @@ -111,7 +109,6 @@ public: void introFx(uint32 *&cmdPtr); void introVol(uint32 *&cmdPtr); - protected: void logic_engine(); void delay(uint amount); @@ -140,8 +137,6 @@ protected: static int CDECL game_thread_proc(void *param); void shutdown(); - - void showQuitMsg(void); }; #endif diff --git a/sky/sound.cpp b/sky/sound.cpp index b44cbc2fa8..8eed6c863b 100644 --- a/sky/sound.cpp +++ b/sky/sound.cpp @@ -1148,6 +1148,8 @@ bool SkySound::fnStartFx(uint32 sound) { bool SkySound::startSpeech(uint16 textNum) { + if (!(SkyState::_systemVars.systemFlags & SF_ALLOW_SPEECH)) + return false; uint16 speechFileNum = _speechConvertTable[textNum >> 12] + (textNum & 0xFFF); uint8 *speechData = _skyDisk->loadFile(speechFileNum + 50000, NULL); diff --git a/sky/text.h b/sky/text.h index 581d1ce071..9213974596 100644 --- a/sky/text.h +++ b/sky/text.h @@ -45,6 +45,7 @@ public: void fnPointerText(uint32 pointedId, uint16 mouseX, uint16 mouseY); void logicCursor(Compact *textCompact, uint16 mouseX, uint16 mouseY); void changeTextSpriteColour(uint8 *sprData, uint8 newCol); + uint32 giveCurrentCharSet(void) { return _curCharSet; }; protected: bool getTBit(); |