}
}
+void ClearPlayerAction()
+{
+ int i;
+
+ /* simulate key release events for still pressed keys */
+ key_joystick_mapping = 0;
+ for (i=0; i<MAX_PLAYERS; i++)
+ stored_player[i].action = 0;
+}
+
void SleepWhileUnmapped()
{
boolean window_unmapped = TRUE;
if (event->type == EVENT_FOCUSOUT)
{
- int i;
-
KeyboardAutoRepeatOn();
old_joystick_status = joystick.status;
joystick.status = JOYSTICK_NOT_AVAILABLE;
- /* simulate key release events for still pressed keys */
- key_joystick_mapping = 0;
- for (i=0; i<MAX_PLAYERS; i++)
- stored_player[i].action = 0;
+ ClearPlayerAction();
}
else if (event->type == EVENT_FOCUSIN)
{
if (game_status == PLAYING)
{
+ /* only needed for single-step tape recording mode */
+ static boolean clear_button_2[MAX_PLAYERS] = { FALSE,FALSE,FALSE,FALSE };
+ static boolean bomb_placed[MAX_PLAYERS] = { FALSE,FALSE,FALSE,FALSE };
int pnr;
for (pnr=0; pnr<MAX_PLAYERS; pnr++)
if (key == *key_info[i].key_custom)
key_action |= key_info[i].action;
+ if (tape.single_step && clear_button_2[pnr])
+ {
+ stored_player[pnr].action &= ~KEY_BUTTON_2;
+ clear_button_2[pnr] = FALSE;
+ }
+
if (key_status == KEY_PRESSED)
stored_player[pnr].action |= key_action;
else
stored_player[pnr].action &= ~key_action;
+
+ if (tape.single_step && tape.recording && tape.pausing)
+ {
+ if (key_status == KEY_PRESSED &&
+ (key_action & (KEY_MOTION | KEY_BUTTON_1)))
+ {
+ TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
+
+ if (key_action & KEY_MOTION)
+ {
+ if (stored_player[pnr].action & KEY_BUTTON_2)
+ bomb_placed[pnr] = TRUE;
+ }
+ }
+ else if (key_status == KEY_RELEASED &&
+ (key_action & KEY_BUTTON_2))
+ {
+ if (!bomb_placed[pnr])
+ {
+ TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
+
+ stored_player[pnr].action |= KEY_BUTTON_2;
+ clear_button_2[pnr] = TRUE;
+ }
+
+ bomb_placed[pnr] = FALSE;
+ }
+ }
+ else if (tape.recording && tape.pausing && (key_action & KEY_ACTION))
+ TapeTogglePause(TAPE_TOGGLE_MANUAL);
}
}
else
if (key_status == KEY_RELEASED)
return;
- if ((key == KSYM_Return || key == KSYM_space) &&
+ if ((key == KSYM_Return || key == setup.shortcut.toggle_pause) &&
game_status == PLAYING && AllPlayersGone)
{
CloseDoor(DOOR_CLOSE_1);
return;
}
- /* special shortcuts for quick game tape saving and loading */
+ /* special key shortcuts */
if (game_status == MAINMENU || game_status == PLAYING)
{
if (key == setup.shortcut.save_game)
TapeQuickSave();
else if (key == setup.shortcut.load_game)
TapeQuickLoad();
+ else if (key == setup.shortcut.toggle_pause)
+ TapeTogglePause(TAPE_TOGGLE_MANUAL);
}
switch(key)
{
case KSYM_Return:
- case KSYM_space:
if (game_status == MAINMENU)
HandleMainMenu(0,0, 0,0, MB_MENU_CHOICE);
else if (game_status == CHOOSELEVEL)
switch(key)
{
case KSYM_Return:
- case KSYM_space:
game_status = MAINMENU;
DrawMainMenu();
BackToFront();
switch(key)
{
case KSYM_Escape:
- RequestQuitGame();
+ RequestQuitGame(setup.ask_on_escape);
break;
#ifdef DEBUG
joy_action = Joystick(i);
result |= joy_action;
-
if (!setup.input[i].use_joystick)
continue;
-
stored_player[i].action = joy_action;
}