X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fevents.c;h=4cb4b1098cf4986948122441f566b1f508cb25cd;hb=f7704e2d22e9499efe6380e0c916c2bd4918e4be;hp=d78ff4a9439738cbed3df5234bb28c7d33085765;hpb=d109a83b1b41088e536efa0788d5cb33382bbe18;p=rocksndiamonds.git diff --git a/src/events.c b/src/events.c index d78ff4a9..4cb4b109 100644 --- a/src/events.c +++ b/src/events.c @@ -315,6 +315,11 @@ void HandleExposeEvent(ExposeEvent *event) void HandleButtonEvent(ButtonEvent *event) { +#if 0 + printf("::: BUTTON EVENT: button %d %s\n", event->button, + event->type == EVENT_BUTTONPRESS ? "pressed" : "released"); +#endif + motion_status = FALSE; if (event->type == EVENT_BUTTONPRESS) @@ -345,6 +350,11 @@ void HandleKeyEvent(KeyEvent *event) Key key = GetEventKey(event, with_modifiers); Key keymod = (with_modifiers ? GetEventKey(event, FALSE) : key); +#if 0 + printf("::: KEY EVENT: %d %s\n", GetEventKey(event, TRUE), + event->type == EVENT_KEYPRESS ? "pressed" : "released"); +#endif + HandleKeyModState(keymod, key_status); HandleKey(key, key_status); } @@ -419,7 +429,7 @@ void HandleButton(int mx, int my, int button, int button_nr) } /* do not use scroll wheel button events for anything other than gadgets */ - if (button_nr > 3) + if (IS_WHEEL_BUTTON(button_nr)) return; switch (game_status) @@ -677,12 +687,26 @@ void HandleKey(Key key, int key_status) if (key_status == KEY_RELEASED) return; + if ((key == KSYM_Return || key == KSYM_KP_Enter) && + (GetKeyModState() & KMOD_Alt) && video.fullscreen_available) + { + setup.fullscreen = !setup.fullscreen; + + ToggleFullscreenIfNeeded(); + + return; + } + if (game_status == GAME_MODE_PLAYING && AllPlayersGone && (key == KSYM_Return || key == setup.shortcut.toggle_pause)) { +#if 1 + GameEnd(); +#else CloseDoor(DOOR_CLOSE_1); game_status = GAME_MODE_MAIN; DrawMainMenu(); +#endif return; } @@ -748,54 +772,58 @@ void HandleKey(Key key, int key_status) case GAME_MODE_LEVELS: case GAME_MODE_SETUP: case GAME_MODE_INFO: + case GAME_MODE_SCORES: switch(key) { -#if 1 - case KSYM_space: -#else - /* !!! only use "space" key to start game from main menu !!! */ case KSYM_space: -#endif case KSYM_Return: if (game_status == GAME_MODE_TITLE) - HandleTitleScreen(0,0, 0,0, MB_MENU_CHOICE); + HandleTitleScreen(0, 0, 0, 0, MB_MENU_CHOICE); else if (game_status == GAME_MODE_MAIN) - HandleMainMenu(0,0, 0,0, MB_MENU_CHOICE); + HandleMainMenu(0, 0, 0, 0, MB_MENU_CHOICE); else if (game_status == GAME_MODE_LEVELS) - HandleChooseLevel(0,0, 0,0, MB_MENU_CHOICE); + HandleChooseLevel(0, 0, 0, 0, MB_MENU_CHOICE); else if (game_status == GAME_MODE_SETUP) - HandleSetupScreen(0,0, 0,0, MB_MENU_CHOICE); + HandleSetupScreen(0, 0, 0, 0, MB_MENU_CHOICE); else if (game_status == GAME_MODE_INFO) - HandleInfoScreen(0,0, 0,0, MB_MENU_CHOICE); + HandleInfoScreen(0, 0, 0, 0, MB_MENU_CHOICE); + else if (game_status == GAME_MODE_SCORES) + HandleHallOfFame(0, 0, 0, 0, MB_MENU_CHOICE); break; case KSYM_Escape: if (game_status == GAME_MODE_TITLE) - HandleTitleScreen(0,0, 0,0, MB_MENU_LEAVE); + HandleTitleScreen(0, 0, 0, 0, MB_MENU_LEAVE); else if (game_status == GAME_MODE_LEVELS) - HandleChooseLevel(0,0, 0,0, MB_MENU_LEAVE); + HandleChooseLevel(0, 0, 0, 0, MB_MENU_LEAVE); else if (game_status == GAME_MODE_SETUP) - HandleSetupScreen(0,0, 0,0, MB_MENU_LEAVE); + HandleSetupScreen(0, 0, 0, 0, MB_MENU_LEAVE); else if (game_status == GAME_MODE_INFO) - HandleInfoScreen(0,0, 0,0, MB_MENU_LEAVE); + HandleInfoScreen(0, 0, 0, 0, MB_MENU_LEAVE); + else if (game_status == GAME_MODE_SCORES) + HandleHallOfFame(0, 0, 0, 0, MB_MENU_LEAVE); break; case KSYM_Page_Up: if (game_status == GAME_MODE_LEVELS) - HandleChooseLevel(0,0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK); + HandleChooseLevel(0, 0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK); else if (game_status == GAME_MODE_SETUP) - HandleSetupScreen(0,0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK); + HandleSetupScreen(0, 0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK); else if (game_status == GAME_MODE_INFO) - HandleInfoScreen(0,0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK); + HandleInfoScreen(0, 0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK); + else if (game_status == GAME_MODE_SCORES) + HandleHallOfFame(0, 0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK); break; case KSYM_Page_Down: if (game_status == GAME_MODE_LEVELS) - HandleChooseLevel(0,0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK); + HandleChooseLevel(0, 0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK); else if (game_status == GAME_MODE_SETUP) - HandleSetupScreen(0,0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK); + HandleSetupScreen(0, 0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK); else if (game_status == GAME_MODE_INFO) - HandleInfoScreen(0,0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK); + HandleInfoScreen(0, 0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK); + else if (game_status == GAME_MODE_SCORES) + HandleHallOfFame(0, 0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK); break; #ifdef DEBUG @@ -809,28 +837,37 @@ void HandleKey(Key key, int key_status) } break; +#if 0 case GAME_MODE_SCORES: switch(key) { case KSYM_space: case KSYM_Return: + HandleHallOfFame(0, 0, 0, 0, MB_MENU_CHOICE); + break; + case KSYM_Escape: +#if 1 + HandleHallOfFame(0, 0, 0, 0, MB_MENU_LEAVE); +#else game_status = GAME_MODE_MAIN; DrawMainMenu(); +#endif break; case KSYM_Page_Up: - HandleHallOfFame(0,0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK); + HandleHallOfFame(0, 0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK); break; case KSYM_Page_Down: - HandleHallOfFame(0,0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK); + HandleHallOfFame(0, 0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK); break; default: break; } break; +#endif case GAME_MODE_EDITOR: if (!anyTextGadgetActiveOrJustFinished || key == KSYM_Escape) @@ -1019,20 +1056,20 @@ void HandleJoystick() newbutton = dx = dy = 0; if (game_status == GAME_MODE_TITLE) - HandleTitleScreen(0,0,dx,dy,newbutton ? MB_MENU_CHOICE : MB_MENU_MARK); + HandleTitleScreen(0,0,dx,dy, newbutton ? MB_MENU_CHOICE : MB_MENU_MARK); else if (game_status == GAME_MODE_MAIN) - HandleMainMenu(0,0,dx,dy,newbutton ? MB_MENU_CHOICE : MB_MENU_MARK); + HandleMainMenu(0,0,dx,dy, newbutton ? MB_MENU_CHOICE : MB_MENU_MARK); else if (game_status == GAME_MODE_LEVELS) - HandleChooseLevel(0,0,dx,dy,newbutton ? MB_MENU_CHOICE : MB_MENU_MARK); + HandleChooseLevel(0,0,dx,dy, newbutton ? MB_MENU_CHOICE : MB_MENU_MARK); else if (game_status == GAME_MODE_SETUP) - HandleSetupScreen(0,0,dx,dy,newbutton ? MB_MENU_CHOICE : MB_MENU_MARK); + HandleSetupScreen(0,0,dx,dy, newbutton ? MB_MENU_CHOICE : MB_MENU_MARK); else if (game_status == GAME_MODE_INFO) - HandleInfoScreen(0,0,dx,dy,newbutton ? MB_MENU_CHOICE : MB_MENU_MARK); + HandleInfoScreen(0,0,dx,dy, newbutton ? MB_MENU_CHOICE : MB_MENU_MARK); break; } case GAME_MODE_SCORES: - HandleHallOfFame(0,0, dx,dy, !newbutton); + HandleHallOfFame(0, 0, dx, dy, !newbutton); break; case GAME_MODE_EDITOR: @@ -1045,9 +1082,14 @@ void HandleJoystick() if (AllPlayersGone && newbutton) { +#if 1 + GameEnd(); +#else CloseDoor(DOOR_CLOSE_1); game_status = GAME_MODE_MAIN; DrawMainMenu(); +#endif + return; }