// seg001:05EC void __pascal far pv_scene() { init_princess(); saveshad(); if (fade_in_1()) return; init_vizier(); savekid(); if (proc_cutscene_frame(2)) return; play_sound(sound_50_story_2_princess); // story 2: princess waiting do { if (proc_cutscene_frame(1)) return; //idle(); } while(check_sound_playing()); cutscene_frame_time = 8; if (proc_cutscene_frame(5)) return; play_sound(sound_4_gate_closing); // gate closing do { if (proc_cutscene_frame(1)) return; } while(check_sound_playing()); play_sound(sound_51_princess_door_opening); // princess door opening if (proc_cutscene_frame(3)) return; seqtbl_offset_shad_char(98); // princess turn around [PV1] if (proc_cutscene_frame(5)) return; seqtbl_offset_kid_char(96); // Jaffar walk [PV1] if (proc_cutscene_frame(6)) return; play_sound(sound_53_story_3_Jaffar_comes); // story 3: Jaffar comes seqtbl_offset_kid_char(97); // Jaffar stop [PV1] if (proc_cutscene_frame(4)) return; if (proc_cutscene_frame(18)) return; seqtbl_offset_kid_char(96); // Jaffar walk [PV1] if (proc_cutscene_frame(30)) return; seqtbl_offset_kid_char(97); // Jaffar stop [PV1] if (proc_cutscene_frame(35)) return; seqtbl_offset_kid_char(102); // Jaffar conjuring [PV1] cutscene_frame_time = 7; if (proc_cutscene_frame(1)) return; seqtbl_offset_shad_char(99); // princess step back [PV1] if (proc_cutscene_frame(17)) return; hourglass_state = 1; flash_time = 5; flash_color = 15; // white do { if (proc_cutscene_frame(1)) return; //idle(); } while(check_sound_playing()); seqtbl_offset_kid_char(100); // Jaffar end conjuring and walk [PV1] hourglass_sandflow = 0; if (proc_cutscene_frame(6)) return; play_sound(sound_52_story_4_Jaffar_leaves); // story 4: Jaffar leaves if (proc_cutscene_frame(24)) return; hourglass_state = 2; if (proc_cutscene_frame(9)) return; seqtbl_offset_shad_char(113); // princess look down [PV1] if (proc_cutscene_frame(28)) return; fade_out_1(); }
// seg001:041C void __pascal far end_sequence_anim() { disable_keys = 1; if (!is_sound_on) { turn_sound_on_off(0x0F); } copy_screen_rect(&screen_rect); play_sound(sound_26_embrace); // arrived to princess init_ending_princess(); saveshad(); init_ending_kid(); savekid(); if (proc_cutscene_frame(8)) return; seqtbl_offset_shad_char(seq_108_princess_turn_and_hug); // princess turn and hug [PV2] if (proc_cutscene_frame(5)) return; seqtbl_offset_kid_char(seq_13_stop_run); // stop run if (proc_cutscene_frame(2)) return; Kid.frame = 0; if (proc_cutscene_frame(39)) return; init_mouse_1(); savekid(); if (proc_cutscene_frame(9)) return; seqtbl_offset_kid_char(seq_101_mouse_stands_up); // mouse stands up if (proc_cutscene_frame(41)) return; fade_out_1(); while (check_sound_playing()) idle(); }
// seg000:1304 void __pascal far play_next_sound() { if (next_sound >= 0) { if (!check_sound_playing() || (sound_interruptible[current_sound] != 0 && sound_prio_table[next_sound] <= sound_prio_table[current_sound]) ) { current_sound = next_sound; play_sound_from_buffer(sound_pointers[current_sound]); } } next_sound = -1; }
// seg001:04D3 void __pascal far time_expired() { disable_keys = 1; set_hourglass_state(7); hourglass_sandflow = -1; play_sound(sound_36_out_of_time); // time over if (fade_in_1()) return; if (proc_cutscene_frame(2)) return; if (proc_cutscene_frame(100)) return; fade_out_1(); while (check_sound_playing()) { idle(); do_paused(); } }
// seg001:0004 int __pascal far proc_cutscene_frame(int wait_frames) { cutscene_wait_frames = wait_frames; reset_timer(timer_0); do { set_timer_length(timer_0, cutscene_frame_time); play_both_seq(); draw_proom_drects(); // changed order of drects and flash if (flash_time) { do_flash(flash_color); } if (flash_time) { --flash_time; remove_flash(); } if (!check_sound_playing()) { play_next_sound(); } do { if (!disable_keys && do_paused()) { stop_sounds(); draw_rect(&screen_rect, 0); #ifdef USE_FADE if (is_global_fading) { fade_palette_buffer->proc_restore_free(fade_palette_buffer); is_global_fading = 0; } #endif return 1; } #ifdef USE_FADE if (is_global_fading) { if (fade_palette_buffer->proc_fade_frame(fade_palette_buffer)) { fade_palette_buffer->proc_restore_free(fade_palette_buffer); is_global_fading = 0; return 2; } } else { idle(); delay_ticks(1); } #else idle(); #endif } while(!has_timer_stopped(timer_0)); // busy waiting? } while(--cutscene_wait_frames); return 0; }
// seg001:0CCD void __pascal far load_intro(int which_imgs,cutscene_ptr_type func,int free_sounds) { short current_star; draw_rect(&screen_rect, 0); if (free_sounds) { free_optional_sounds(); } free_all_chtabs_from(id_chtab_3_princessinstory); load_chtab_from_file(id_chtab_8_princessroom, 950, "PV.DAT", 1<<13); load_chtab_from_file(id_chtab_9_princessbed, 980, "PV.DAT", 1<<14); current_target_surface = offscreen_surface; method_6_blit_img_to_scr(get_image(id_chtab_8_princessroom, 0), 0, 0, 0); method_6_blit_img_to_scr(get_image(id_chtab_9_princessbed, 0), 0, 142, blitters_2_or); // Free the images that are not needed anymore. free_all_chtabs_from(id_chtab_9_princessbed); SDL_FreeSurface(get_image(id_chtab_8_princessroom, 0)); if (NULL != chtab_addrs[id_chtab_8_princessroom]) chtab_addrs[id_chtab_8_princessroom]->images[0] = NULL; load_chtab_from_file(id_chtab_3_princessinstory, 800, "PV.DAT", 1<<9); load_chtab_from_file(id_chtab_4_jaffarinstory_princessincutscenes, 50*which_imgs + 850, "PV.DAT", 1<<10); for (current_star = 0; current_star < N_STARS; ++current_star) { draw_star(current_star, 0); } current_target_surface = onscreen_surface_; while (check_sound_playing()) { idle(); do_paused(); delay_ticks(1); } need_drects = 1; reset_cutscene(); is_cutscene = 1; func(); is_cutscene = 0; free_all_chtabs_from(3); draw_rect(&screen_rect, 0); }
// seg001:09D7 void __pascal far end_sequence() { peel_type* peel; short bgcolor; short color; rect_type rect; short hof_index; short i; color = 0; bgcolor = 15; load_intro(1, &end_sequence_anim, 1); clear_screen_and_sounds(); load_opt_sounds(sound_56_ending_music, sound_56_ending_music); // winning theme play_sound_from_buffer(sound_pointers[sound_56_ending_music]); // winning theme if(offscreen_surface) free_surface(offscreen_surface); // missing in original offscreen_surface = make_offscreen_buffer(&screen_rect); load_title_images(0); current_target_surface = offscreen_surface; draw_image_2(0 /*story frame*/, chtab_title40, 0, 0, 0); draw_image_2(3 /*The tyrant Jaffar*/, chtab_title40, 24, 25, get_text_color(15, color_15_brightwhite, 0x800)); fade_in_2(offscreen_surface, 0x800); pop_wait(timer_0, 900); start_timer(timer_0, 240); draw_image_2(0 /*main title image*/, chtab_title50, 0, 0, 0); transition_ltr(); do_wait(timer_0); for (hof_index = 0; hof_index < hof_count; ++hof_index) { if (hof[hof_index].min < rem_min || (hof[hof_index].min == rem_min && hof[hof_index].tick < rem_tick) ) break; } if (hof_index < MAX_HOF_COUNT && hof_index <= hof_count) { fade_out_2(0x1000); for (i = 5; hof_index + 1 <= i; --i) { hof[i] = hof[i - 1]; } hof[i].name[0] = 0; hof[i].min = rem_min; hof[i].tick = rem_tick; if (hof_count < MAX_HOF_COUNT) { ++hof_count; } draw_image_2(0 /*story frame*/, chtab_title40, 0, 0, 0); draw_image_2(3 /*Prince Of Persia*/, chtab_title50, 24, 24, blitters_10h_transp); show_hof(); offset4_rect_add(&rect, &hof_rects[hof_index], -4, -1, -40, -1); peel = read_peel_from_screen(&rect); if (graphics_mode == gmMcgaVga) { color = 0xBE; bgcolor = 0xB7; } draw_rect(&rect, bgcolor); fade_in_2(offscreen_surface, 0x1800); current_target_surface = onscreen_surface_; while(input_str(&rect, hof[hof_index].name, 24, "", 0, 4, color, bgcolor) <= 0); restore_peel(peel); show_hof_text(&hof_rects[hof_index], -1, 0, hof[hof_index].name); hof_write(); pop_wait(timer_0, 120); current_target_surface = offscreen_surface; draw_image_2(0 /*main title image*/, chtab_title50, 0, 0, blitters_0_no_transp); transition_ltr(); } while (check_sound_playing() && !key_test_quit()) idle(); fade_out_2(0x1000); start_level = 0; start_game(); }
// seg000:17E6 void __pascal far show_title() { word textcolor; load_opt_sounds(sound_50_story_2_princess, sound_55_story_1_absence); // main theme, story, princess door textcolor = get_text_color(15, color_15_white, 0x800); dont_reset_time = 0; if(offscreen_surface) free_surface(offscreen_surface); // missing in original offscreen_surface = make_offscreen_buffer(&screen_rect); load_title_images(1); current_target_surface = offscreen_surface; do_wait(timer_0); draw_image_2(0 /*main title image*/, chtab_title50, 0, 0, blitters_0_no_transp); fade_in_2(offscreen_surface, 0x1000); //STUB method_1_blit_rect(onscreen_surface_, offscreen_surface, &screen_rect, &screen_rect, blitters_0_no_transp); play_sound_from_buffer(sound_pointers[54]); // main theme start_timer(timer_0, 0x82); draw_image_2(1 /*Broderbund Software presents*/, chtab_title50, 96, 106, blitters_0_no_transp); do_wait(timer_0); start_timer(timer_0,0xCD); method_1_blit_rect(onscreen_surface_, offscreen_surface, &rect_titles, &rect_titles, blitters_0_no_transp); draw_image_2(0 /*main title image*/, chtab_title50, 0, 0, blitters_0_no_transp); do_wait(timer_0); start_timer(timer_0,0x41); method_1_blit_rect(onscreen_surface_, offscreen_surface, &rect_titles, &rect_titles, blitters_0_no_transp); draw_image_2(0 /*main title image*/, chtab_title50, 0, 0, blitters_0_no_transp); draw_image_2(2 /*a game by Jordan Mechner*/, chtab_title50, 96, 122, blitters_0_no_transp); do_wait(timer_0); start_timer(timer_0,0x10E); method_1_blit_rect(onscreen_surface_, offscreen_surface, &rect_titles, &rect_titles, blitters_0_no_transp); draw_image_2(0 /*main title image*/, chtab_title50, 0, 0, blitters_0_no_transp); do_wait(timer_0); start_timer(timer_0,0xEB); method_1_blit_rect(onscreen_surface_, offscreen_surface, &rect_titles, &rect_titles, blitters_0_no_transp); draw_image_2(0 /*main title image*/, chtab_title50, 0, 0, blitters_0_no_transp); draw_image_2(3 /*Prince Of Persia*/, chtab_title50, 24, 107, blitters_10h_transp); draw_image_2(4 /*Copyright 1990 Jordan Mechner*/, chtab_title50, 48, 184, blitters_0_no_transp); do_wait(timer_0); method_1_blit_rect(onscreen_surface_, offscreen_surface, &rect_titles, &rect_titles, blitters_0_no_transp); draw_image_2(0 /*story frame*/, chtab_title40, 0, 0, blitters_0_no_transp); draw_image_2(1 /*In the Sultan's absence*/, chtab_title40, 24, 25, textcolor); current_target_surface = onscreen_surface_; while (check_sound_playing()) { idle(); do_paused(); } // method_1_blit_rect(onscreen_surface_, offscreen_surface, &screen_rect, &screen_rect, blitters_0_no_transp); play_sound_from_buffer(sound_pointers[sound_55_story_1_absence]); // story 1: In the absence transition_ltr(); pop_wait(timer_0, 0x258); fade_out_2(0x800); release_title_images(); load_intro(0, &pv_scene, 0); load_title_images(1); current_target_surface = offscreen_surface; draw_image_2(0 /*story frame*/, chtab_title40, 0, 0, blitters_0_no_transp); draw_image_2(2 /*Marry Jaffar*/, chtab_title40, 24, 25, textcolor); fade_in_2(offscreen_surface, 0x800); draw_image_2(0 /*main title image*/, chtab_title50, 0, 0, blitters_0_no_transp); draw_image_2(3 /*Prince Of Persia*/, chtab_title50, 24, 107, blitters_10h_transp); draw_image_2(4 /*Copyright 1990 Jordan Mechner*/, chtab_title50, 48, 184, blitters_0_no_transp); while (check_sound_playing()) { idle(); do_paused(); } transition_ltr(); pop_wait(timer_0, 0x78); draw_image_2(0 /*story frame*/, chtab_title40, 0, 0, blitters_0_no_transp); draw_image_2(4 /*credits*/, chtab_title40, 24, 26, textcolor); transition_ltr(); pop_wait(timer_0, 0x168); if (hof_count) { draw_image_2(0 /*story frame*/, chtab_title40, 0, 0, blitters_0_no_transp); draw_image_2(3 /*Prince Of Persia*/, chtab_title50, 24, 24, blitters_10h_transp); show_hof(); transition_ltr(); pop_wait(timer_0, 0xF0); } current_target_surface = onscreen_surface_; while (check_sound_playing()) { idle(); do_paused(); } fade_out_2(0x1800); free_surface(offscreen_surface); offscreen_surface = NULL; // added release_title_images(); init_game(0); }