X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fevents.c;h=0852cd5529a5bd474a99cbf353adc39bd7d4449b;hb=ec36fe263402351ac67b70400f11096a044365fe;hp=366acd1a4fa83215d053491484e12c7006501020;hpb=9c285b0e8e4d81c5559815c5f7142685ce865206;p=rocksndiamonds.git diff --git a/src/events.c b/src/events.c index 366acd1a..0852cd55 100644 --- a/src/events.c +++ b/src/events.c @@ -85,7 +85,7 @@ void EventLoop(void) { Event event; - if (NextValidEvent(&event)) + while (NextValidEvent(&event)) { switch(event.type) { @@ -112,7 +112,7 @@ void EventLoop(void) else { /* when playing, display a special mouse pointer inside the playfield */ - if (game_status == GAME_MODE_PLAYING) + if (game_status == GAME_MODE_PLAYING && !tape.pausing) { if (!playfield_cursor_set && cursor_inside_playfield && DelayReached(&playfield_cursor_delay, 1000)) @@ -347,6 +347,7 @@ void HandleFocusEvent(FocusChangeEvent *event) Delay(100); KeyboardAutoRepeatOffUnlessAutoplay(); } + if (old_joystick_status != -1) joystick.status = old_joystick_status; } @@ -411,36 +412,8 @@ void HandleButton(int mx, int my, int button) case GAME_MODE_PLAYING: #ifdef DEBUG - if (button == MB_RELEASED) - { - if (IN_GFX_SCREEN(mx, my)) - { - int sx = (mx - SX) / TILEX; - int sy = (my - SY) / TILEY; - int x = LEVELX(sx); - int y = LEVELY(sy); - - printf("INFO: SCREEN(%d, %d), LEVEL(%d, %d)\n", sx, sy, x, y); - - if (!IN_LEV_FIELD(x, y)) - break; - - printf(" Feld[%d][%d] == %d ('%s')\n", x,y, Feld[x][y], - element_info[Feld[x][y]].token_name); - printf(" Back[%d][%d] == %d\n", x,y, Back[x][y]); - printf(" Store[%d][%d] == %d\n", x,y, Store[x][y]); - printf(" Store2[%d][%d] == %d\n", x,y, Store2[x][y]); - printf(" StorePlayer[%d][%d] == %d\n", x,y, StorePlayer[x][y]); - printf(" MovPos[%d][%d] == %d\n", x,y, MovPos[x][y]); - printf(" MovDir[%d][%d] == %d\n", x,y, MovDir[x][y]); - printf(" MovDelay[%d][%d] == %d\n", x,y, MovDelay[x][y]); - printf(" ChangeDelay[%d][%d] == %d\n", x,y, ChangeDelay[x][y]); - printf(" GfxElement[%d][%d] == %d\n", x,y, GfxElement[x][y]); - printf(" GfxAction[%d][%d] == %d\n", x,y, GfxAction[x][y]); - printf(" GfxFrame[%d][%d] == %d\n", x,y, GfxFrame[x][y]); - printf("\n"); - } - } + if (button == MB_PRESSED && !motion_status && IN_GFX_SCREEN(mx, my)) + DumpTile(LEVELX((mx - SX) / TILEX), LEVELY((my - SY) / TILEY)); #endif break; @@ -462,7 +435,7 @@ static boolean is_string_suffix(char *string, char *suffix) #define MAX_CHEAT_INPUT_LEN 32 -static void HandleKeysCheating(Key key) +static void HandleKeysSpecial(Key key) { static char cheat_input[2 * MAX_CHEAT_INPUT_LEN + 1] = ""; char letter = getCharFromKey(key); @@ -541,6 +514,14 @@ static void HandleKeysCheating(Key key) EL_DYNAMITE; #endif } + else if (game_status == GAME_MODE_EDITOR) + { + if (is_string_suffix(cheat_input, ":dump-brush") || + is_string_suffix(cheat_input, ":DB")) + { + DumpBrush(); + } + } } void HandleKey(Key key, int key_status) @@ -666,7 +647,7 @@ void HandleKey(Key key, int key_status) if (setup.autorecord) TapeStartRecording(); -#if defined(PLATFORM_UNIX) +#if defined(NETWORK_AVALIABLE) if (options.network) SendToServer_StartPlaying(); else @@ -688,10 +669,10 @@ void HandleKey(Key key, int key_status) TapeQuickLoad(); else if (key == setup.shortcut.toggle_pause) TapeTogglePause(TAPE_TOGGLE_MANUAL); - - HandleKeysCheating(key); } + HandleKeysSpecial(key); + if (HandleGadgetsKeyInput(key)) { if (key != KSYM_Escape) /* always allow ESC key to be handled */ @@ -710,6 +691,7 @@ void HandleKey(Key key, int key_status) case GAME_MODE_INFO: switch(key) { + case KSYM_space: case KSYM_Return: if (game_status == GAME_MODE_MAIN) HandleMainMenu(0,0, 0,0, MB_MENU_CHOICE); @@ -756,6 +738,7 @@ void HandleKey(Key key, int key_status) case GAME_MODE_SCORES: switch(key) { + case KSYM_space: case KSYM_Return: case KSYM_Escape: game_status = GAME_MODE_MAIN; @@ -891,6 +874,11 @@ void HandleKey(Key key, int key_status) printf("ScrollStepSize == %d (1/1)\n", ScrollStepSize); break; + case KSYM_v: + printf("::: currently using game engine version %d\n", + game.engine_version); + break; + #if 0 case KSYM_z: @@ -937,7 +925,7 @@ void HandleNoEvent() return; } -#if defined(PLATFORM_UNIX) +#if defined(NETWORK_AVALIABLE) if (options.network) HandleNetworking(); #endif