// seg002:1082 void __pascal far autocontrol_shadow_level12() { short opp_frame; short xdiff; if (Char.room == 15 && shadow_initialized == 0) { if (Opp.x >= 150) { do_init_shad(/*&*/init_shad_12, 7 /*fall*/); return; } shadow_initialized = 1; } if (Char.sword >= sword_2_drawn) { // if the Kid puts his sword away, the shadow does the same, // but only if the shadow was already hurt (?) if (offguard == 0 || guard_refrac == 0) { autocontrol_guard_active(); } else { move_4_down(); } return; } if (Opp.sword >= sword_2_drawn || offguard == 0) { xdiff = 0x7000; // bugfix/workaround // This behavior matches the DOS version but not the Apple II source. if (can_guard_see_kid < 2 || (xdiff = char_opp_dist()) >= 90) { if (xdiff < 0) { move_2_backward(); } return; } // Shadow draws his sword if (Char.frame == 15) { move_down_forw(); } return; } if (char_opp_dist() < 10) { // unite with the shadow flash_color = color_15_white; // white flash_time = 18; // get an extra HP for uniting the shadow add_life(); // time of Kid-shadow flash united_with_shadow = 42; // put the Kid where the shadow was Char.charid = charid_0_kid; savekid(); // remove the shadow clear_char(); return; } if (can_guard_see_kid == 2) { // If Kid runs to shadow, shadow runs to Kid. opp_frame = Opp.frame; // frames 1..14: running // frames 121..132: stepping if ((opp_frame >= frame_3_start_run && opp_frame < frame_15_stand) || (opp_frame >= frame_127_stepping_7 && opp_frame < 133) ) { move_1_forward(); } } }
// seg000:04CD int __pascal far process_key() { char sprintf_temp[80]; int key; const char* answer_text; word need_show_text; need_show_text = 0; key = key_test_quit(); if (start_level == 0) { if (key || control_shift) { #ifdef USE_QUICKSAVE if (key == SDL_SCANCODE_F9) need_quick_load = 1; #endif #ifdef USE_REPLAY if (key == SDL_SCANCODE_TAB) { start_replay(); } else #endif if (key == (SDL_SCANCODE_L | WITH_CTRL)) { // ctrl-L if (!load_game()) return 0; } else { start_level = 1; } 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 start_game(); } } // If the Kid died, enter or shift will restart the level. if (rem_min != 0 && Kid.alive > 6 && (control_shift || key == SDL_SCANCODE_RETURN)) { key = SDL_SCANCODE_A | WITH_CTRL; // ctrl-a } #ifdef USE_REPLAY if (recording) key_press_while_recording(&key); else if (replaying) key_press_while_replaying(&key); #endif if (key == 0) return 0; if (is_keyboard_mode) clear_kbd_buf(); switch(key) { case SDL_SCANCODE_ESCAPE: // esc case SDL_SCANCODE_ESCAPE | WITH_SHIFT: // allow pause while grabbing is_paused = 1; break; case SDL_SCANCODE_SPACE: // space is_show_time = 1; break; case SDL_SCANCODE_A | WITH_CTRL: // ctrl-a if (current_level != 15) { stop_sounds(); is_restart_level = 1; } break; case SDL_SCANCODE_G | WITH_CTRL: // ctrl-g // CusPoP: first and last level where saving is allowed // if (current_level > 2 && current_level < 14) { // original if (current_level >= saving_allowed_first_level && current_level <= saving_allowed_last_level) { save_game(); } break; case SDL_SCANCODE_J | WITH_CTRL: // ctrl-j if ((sound_flags & sfDigi) && sound_mode == smTandy) { answer_text = "JOYSTICK UNAVAILABLE"; } else { if (set_joy_mode()) { answer_text = "JOYSTICK MODE"; } else { answer_text = "JOYSTICK NOT FOUND"; } } need_show_text = 1; break; case SDL_SCANCODE_K | WITH_CTRL: // ctrl-k answer_text = "KEYBOARD MODE"; is_joyst_mode = 0; is_keyboard_mode = 1; need_show_text = 1; break; case SDL_SCANCODE_R | WITH_CTRL: // ctrl-r start_level = 0; start_game(); break; case SDL_SCANCODE_S | WITH_CTRL: // ctrl-s turn_sound_on_off((!is_sound_on) * 15); answer_text = "SOUND OFF"; if (is_sound_on) { answer_text = "SOUND ON"; } // need_show_text = 1; break; case SDL_SCANCODE_V | WITH_CTRL: // ctrl-v answer_text = "PRINCE OF PERSIA V1.0"; need_show_text = 1; break; case SDL_SCANCODE_L | WITH_SHIFT: // shift-l if (current_level <= 3 || cheats_enabled) { // if shift is not released within the delay, the cutscene is skipped Uint32 delay = 250; key_states[SDL_SCANCODE_LSHIFT] = 0; key_states[SDL_SCANCODE_RSHIFT] = 0; SDL_TimerID timer; timer = SDL_AddTimer(delay, temp_shift_release_callback, NULL); if (timer == 0) { sdlperror("SDL_AddTimer"); quit(1); } if (current_level == 14) { next_level = 1; } else { if (current_level == 15 && cheats_enabled) { #ifdef USE_COPYPROT if (options.enable_copyprot) { next_level = copyprot_level; copyprot_level = -1; } #endif } else { next_level = current_level + 1; if (!cheats_enabled && rem_min > 15) { rem_min = 15; rem_tick = 719; } } } stop_sounds(); } break; #ifdef USE_QUICKSAVE case SDL_SCANCODE_F6: case SDL_SCANCODE_F6 | WITH_SHIFT: if (Kid.alive < 0) need_quick_save = 1; break; case SDL_SCANCODE_F9: case SDL_SCANCODE_F9 | WITH_SHIFT: need_quick_load = 1; break; #ifdef USE_REPLAY case SDL_SCANCODE_TAB | WITH_CTRL: case SDL_SCANCODE_TAB | WITH_CTRL | WITH_SHIFT: if (recording) { // finished recording stop_recording(); } else { // should start recording start_recording(); } break; #endif // USE_RECORD_REPLAY #endif // USE_QUICKSAVE } if (cheats_enabled) { switch (key) { case SDL_SCANCODE_C: // c snprintf(sprintf_temp, sizeof(sprintf_temp), "S%d L%d R%d A%d B%d", drawn_room, room_L, room_R, room_A, room_B); answer_text = /*&*/sprintf_temp; need_show_text = 1; break; case SDL_SCANCODE_C | WITH_SHIFT: // shift-c snprintf(sprintf_temp, sizeof(sprintf_temp), "AL%d AR%d BL%d BR%d", room_AL, room_AR, room_BL, room_BR); answer_text = /*&*/sprintf_temp; need_show_text = 1; break; case SDL_SCANCODE_MINUS: case SDL_SCANCODE_KP_MINUS: // '-' --> subtract time cheat if (rem_min > 1) --rem_min; text_time_total = 0; text_time_remaining = 0; is_show_time = 1; break; case SDL_SCANCODE_EQUALS | WITH_SHIFT: // '+' case SDL_SCANCODE_KP_PLUS: // '+' --> add time cheat ++rem_min; text_time_total = 0; text_time_remaining = 0; is_show_time = 1; break; case SDL_SCANCODE_R: // R --> revive kid cheat if (Kid.alive > 0) { resurrect_time = 20; Kid.alive = -1; erase_bottom_text(1); } break; case SDL_SCANCODE_K: // K --> kill guard cheat guardhp_delta = -guardhp_curr; Guard.alive = 0; break; case SDL_SCANCODE_I | WITH_SHIFT: // shift+I --> invert cheat toggle_upside(); break; case SDL_SCANCODE_W | WITH_SHIFT: // shift+W --> feather fall cheat feather_fall(); break; case SDL_SCANCODE_H: // H --> view room to the left draw_guard_hp(0, 10); next_room = room_L; break; case SDL_SCANCODE_J: // J --> view room to the right draw_guard_hp(0, 10); next_room = room_R; break; case SDL_SCANCODE_U: // U --> view room above draw_guard_hp(0, 10); next_room = room_A; break; case SDL_SCANCODE_N: // N --> view room below draw_guard_hp(0, 10); next_room = room_B; break; case SDL_SCANCODE_B | WITH_SHIFT: // shift-b is_blind_mode = !is_blind_mode; if (is_blind_mode) { draw_rect(&rect_top, 0); } else { need_full_redraw = 1; } break; case SDL_SCANCODE_S | WITH_SHIFT: // shift-s if (hitp_curr != hitp_max) { play_sound(sound_33_small_potion); // small potion (cheat) hitp_delta = 1; flash_color = 4; // red flash_time = 2; } break; case SDL_SCANCODE_T | WITH_SHIFT: // shift-t play_sound(sound_30_big_potion); // big potion (cheat) flash_color = 4; // red flash_time = 4; add_life(); break; #ifdef USE_DEBUG_CHEATS case SDL_SCANCODE_T: printf("Remaining minutes: %d\tticks:%d\n", rem_min, rem_tick); snprintf(sprintf_temp, sizeof(sprintf_temp), "M:%d S:%d T:%d", rem_min, rem_tick / 12, rem_tick); answer_text = sprintf_temp; need_show_text = 1; break; #endif } } if (need_show_text) { display_text_bottom(answer_text); text_time_total = 24; text_time_remaining = 24; } return 1; }