X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fevents.c;h=088650b17f2242a38244c4ccd944c74ebd6f46d3;hb=59c2e609872b70cb4c458004cd9e2fe22c86a54b;hp=71d03604c22eb6081e1632232d3ffb852a5c9e41;hpb=2fe0fbc2a34fd4b50081f1829931dea3ca2c4c1c;p=rocksndiamonds.git diff --git a/src/events.c b/src/events.c index 71d03604..088650b1 100644 --- a/src/events.c +++ b/src/events.c @@ -62,6 +62,21 @@ void EventLoop(void) break; } } + + HandleNoXEvent(); + + /* don't use all CPU time when idle; the main loop while playing + has its own synchronization and is CPU friendly, too */ + + if (game_status != PLAYING) + { + XSync(display, FALSE); + Delay(10); + } + + + +#if 0 else /* got no event, but don't be lazy... */ { HandleNoXEvent(); @@ -75,6 +90,9 @@ void EventLoop(void) Delay(10); } } +#endif + + if (game_status == EXITGAME) return; @@ -314,7 +332,13 @@ void HandleButton(int mx, int my, int button) HandleSetupScreen(mx,my,0,0,button); break; case PLAYING: + + /* --> NoXEvent() will follow */ + + /* HandleGameActions(0); + */ + break; default: break; @@ -702,7 +726,8 @@ void HandleNoXEvent() return; } - HandleNetworking(); + if (network) + HandleNetworking(); switch(game_status) { @@ -730,11 +755,6 @@ void HandleJoystick() { int joystick = Joystick(); int keyboard = key_joystick_mapping; - - /* - int joy = (tape.playing ? TapePlayAction() : (joystick | keyboard)); - */ - int joy = (joystick | keyboard); int left = joy & JOY_LEFT; int right = joy & JOY_RIGHT; @@ -788,11 +808,6 @@ void HandleJoystick() if (tape.pausing || AllPlayersGone) joy = 0; - /* - if (!network_player_action_stored) - SendToServer_MovePlayer(joy, 0); - */ - HandleGameActions((byte)joy); break;