projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added dedicated setter function for setting game status
[rocksndiamonds.git]
/
src
/
events.c
diff --git
a/src/events.c
b/src/events.c
index 041c49b4e13b54d0314a111cf00773e817b95800..1afc85d65810bad65fe4cc07c31d36f648438b40 100644
(file)
--- a/
src/events.c
+++ b/
src/events.c
@@
-19,6
+19,7
@@
#include "editor.h"
#include "files.h"
#include "tape.h"
#include "editor.h"
#include "files.h"
#include "tape.h"
+#include "cartoons.h"
#include "network.h"
#include "network.h"
@@
-66,7
+67,7
@@
static int FilterEventsExt(const Event *event)
/* do no reset mouse cursor before all pending events have been processed */
if (gfx.cursor_mode == cursor_mode_last &&
/* do no reset mouse cursor before all pending events have been processed */
if (gfx.cursor_mode == cursor_mode_last &&
- ((
effectiveGameStatus()
== GAME_MODE_TITLE &&
+ ((
game_status
== GAME_MODE_TITLE &&
gfx.cursor_mode == CURSOR_NONE) ||
(game_status == GAME_MODE_PLAYING &&
gfx.cursor_mode == CURSOR_PLAYFIELD)))
gfx.cursor_mode == CURSOR_NONE) ||
(game_status == GAME_MODE_PLAYING &&
gfx.cursor_mode == CURSOR_PLAYFIELD)))
@@
-153,6
+154,9
@@
boolean NextValidEvent(Event *event)
void EventLoop(void)
{
void EventLoop(void)
{
+ static unsigned int sync_frame_delay = 0;
+ unsigned int sync_frame_delay_value = GAME_FRAME_DELAY;
+
while (1)
{
if (PendingEvent()) /* got event */
while (1)
{
if (PendingEvent()) /* got event */
@@
-208,7
+212,7
@@
void EventLoop(void)
}
else
{
}
else
{
- if (
effectiveGameStatus()
== GAME_MODE_TITLE)
+ if (
game_status
== GAME_MODE_TITLE)
{
/* when showing title screens, hide mouse pointer (if not moved) */
{
/* when showing title screens, hide mouse pointer (if not moved) */
@@
-218,7
+222,8
@@
void EventLoop(void)
SetMouseCursor(CURSOR_NONE);
}
}
SetMouseCursor(CURSOR_NONE);
}
}
- else if (game_status == GAME_MODE_PLAYING && !tape.pausing)
+ else if (game_status == GAME_MODE_PLAYING && (!tape.pausing ||
+ tape.single_step))
{
/* when playing, display a special mouse pointer inside the playfield */
{
/* when playing, display a special mouse pointer inside the playfield */
@@
-245,18
+250,14
@@
void EventLoop(void)
has its own synchronization and is CPU friendly, too */
if (game_status == GAME_MODE_PLAYING)
has its own synchronization and is CPU friendly, too */
if (game_status == GAME_MODE_PLAYING)
- {
HandleGameActions();
HandleGameActions();
- }
- else
- {
- if (!PendingEvent()) /* delay only if no pending events */
- Delay(10);
- }
/* refresh window contents from drawing buffer, if needed */
BackToFront();
/* refresh window contents from drawing buffer, if needed */
BackToFront();
+ if (game_status != GAME_MODE_PLAYING)
+ WaitUntilDelayReached(&sync_frame_delay, sync_frame_delay_value);
+
if (game_status == GAME_MODE_QUIT)
return;
}
if (game_status == GAME_MODE_QUIT)
return;
}
@@
-1566,7
+1567,8
@@
void HandleKey(Key key, int key_status)
default:
if (key == KSYM_Escape)
{
default:
if (key == KSYM_Escape)
{
- game_status = GAME_MODE_MAIN;
+ SetGameStatus(GAME_MODE_MAIN);
+
DrawMainMenu();
return;
DrawMainMenu();
return;