Esempio n. 1
0
void show_use_fixes_and_enhancements_prompt() {
    if (options.use_fixes_and_enhancements != 2) return;
    draw_rect(&screen_rect, 0);
    show_text(&screen_rect, 0, 0,
		"\n"
		"Enable bug fixes and\n"
		"gameplay enhancements?\n"
		"\n"
		"NOTE:\n"
		"This option disables some game quirks.\n"
		"Certain tricks will no longer work by default.\n"
		"\n"
		"\n"
		"Y:  enhanced behavior \n"
		"N:  original behavior    \n"
		"\n"
		"Y / N ?\n"
		"\n"
		"\n"
		"\n"
		"You can fine-tune your preferences\n"
		"and/or bypass this screen by editing the file\n"
		"'SDLPoP.ini'"
	);
    while (options.use_fixes_and_enhancements == 2 ) {
		idle();
        switch (key_test_quit()) {
            case SDL_SCANCODE_Y:
                options.use_fixes_and_enhancements = 1;
                printf("Enabling game fixes and enhancements.\n");
                break;
            case SDL_SCANCODE_N:
                options.use_fixes_and_enhancements = 0;
                printf("Disabling game fixes and enhancements.\n");
                break;
		}
    }
    if (!options.use_fixes_and_enhancements) disable_fixes_and_enhancements();
}
Esempio n. 2
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();
}
Esempio n. 3
0
// 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;
}