X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fevents.c;h=f67bc13ecac7dc8bb5d3aed4e151383cea5b7439;hb=69e8efac8d856859c55237e085ff8b514ae1aa3c;hp=ccab40eedbbd44190ca7d1e7d776238cb5a161b3;hpb=a7d7881a5abf250befa4c59e1c336e7b40f9b2fb;p=rocksndiamonds.git diff --git a/src/events.c b/src/events.c index ccab40ee..f67bc13e 100644 --- a/src/events.c +++ b/src/events.c @@ -176,6 +176,16 @@ void ClearEventQueue() } } +void ClearPlayerAction() +{ + int i; + + /* simulate key release events for still pressed keys */ + key_joystick_mapping = 0; + for (i=0; ix, y = event->y; - int width = event->width, height = event->height; - - if (setup.direct_draw && game_status==PLAYING) - { - int xx,yy; - int x1 = (x-SX)/TILEX, y1 = (y-SY)/TILEY; - int x2 = (x-SX+width)/TILEX, y2 = (y-SY+height)/TILEY; - - SetDrawtoField(DRAW_BACKBUFFER); - - for(xx=0; xx=x1 && xx<=x2 && yy>=y1 && yy<=y2) - DrawScreenField(xx,yy); - DrawAllPlayers(); - - SetDrawtoField(DRAW_DIRECT); - } - - if (setup.soft_scrolling && game_status == PLAYING) - { - int fx = FX, fy = FY; - - fx += (ScreenMovDir & (MV_LEFT|MV_RIGHT) ? ScreenGfxPos : 0); - fy += (ScreenMovDir & (MV_UP|MV_DOWN) ? ScreenGfxPos : 0); - - BlitBitmap(fieldbuffer, backbuffer, fx,fy, SXSIZE,SYSIZE, SX,SY); - } - - BlitBitmap(drawto, window, x,y, width,height, x,y); - + RedrawPlayfield(FALSE, event->x, event->y, event->width, event->height); FlushDisplay(); #endif } @@ -300,16 +279,11 @@ void HandleFocusEvent(FocusChangeEvent *event) 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; itype == EVENT_FOCUSIN) { @@ -508,6 +482,7 @@ void HandleKey(Key key, int key_status) /* allow quick escape to the main menu with the Escape key */ if (key == KSYM_Escape && game_status != MAINMENU && + game_status != PLAYING && game_status != LEVELED && game_status != CHOOSELEVEL && game_status != SETUP) @@ -517,6 +492,14 @@ void HandleKey(Key key, int key_status) return; } + /* special shortcuts for quick game tape saving and loading */ + if (game_status == MAINMENU || game_status == PLAYING) + { + if (key == setup.shortcut.save_game) + TapeQuickSave(); + else if (key == setup.shortcut.load_game) + TapeQuickLoad(); + } #ifndef DEBUG @@ -615,6 +598,9 @@ void HandleKey(Key key, int key_status) { switch(key) { + case KSYM_Escape: + RequestQuitGame(setup.ask_on_escape); + break; #ifdef DEBUG case KSYM_0: @@ -790,11 +776,9 @@ static int HandleJoystickForAllPlayers() joy_action = Joystick(i); result |= joy_action; - if (!setup.input[i].use_joystick) continue; - stored_player[i].action = joy_action; }