projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rnd-20060815-2-src
[rocksndiamonds.git]
/
src
/
events.c
diff --git
a/src/events.c
b/src/events.c
index 002e4fdff521dc77e50a4a95195379905bdc7ec3..3e159dc4740db50ef0a85b3f8ca317946233a52f 100644
(file)
--- a/
src/events.c
+++ b/
src/events.c
@@
-315,6
+315,11
@@
void HandleExposeEvent(ExposeEvent *event)
void HandleButtonEvent(ButtonEvent *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)
motion_status = FALSE;
if (event->type == EVENT_BUTTONPRESS)
@@
-322,7
+327,7
@@
void HandleButtonEvent(ButtonEvent *event)
else
button_status = MB_RELEASED;
else
button_status = MB_RELEASED;
- HandleButton(event->x, event->y, button_status);
+ HandleButton(event->x, event->y, button_status
, event->button
);
}
void HandleMotionEvent(MotionEvent *event)
}
void HandleMotionEvent(MotionEvent *event)
@@
-335,7
+340,7
@@
void HandleMotionEvent(MotionEvent *event)
motion_status = TRUE;
motion_status = TRUE;
- HandleButton(event->x, event->y, button_status);
+ HandleButton(event->x, event->y, button_status
, button_status
);
}
void HandleKeyEvent(KeyEvent *event)
}
void HandleKeyEvent(KeyEvent *event)
@@
-345,6
+350,11
@@
void HandleKeyEvent(KeyEvent *event)
Key key = GetEventKey(event, with_modifiers);
Key keymod = (with_modifiers ? GetEventKey(event, FALSE) : key);
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);
}
HandleKeyModState(keymod, key_status);
HandleKey(key, key_status);
}
@@
-396,7
+406,7
@@
void HandleClientMessageEvent(ClientMessageEvent *event)
CloseAllAndExit(0);
}
CloseAllAndExit(0);
}
-void HandleButton(int mx, int my, int button)
+void HandleButton(int mx, int my, int button
, int button_nr
)
{
static int old_mx = 0, old_my = 0;
{
static int old_mx = 0, old_my = 0;
@@
-418,14
+428,18
@@
void HandleButton(int mx, int my, int button)
mx = my = -32; /* force mouse event to be outside screen tiles */
}
mx = my = -32; /* force mouse event to be outside screen tiles */
}
- switch(game_status)
+ /* do not use scroll wheel button events for anything other than gadgets */
+ if (IS_WHEEL_BUTTON(button_nr))
+ return;
+
+ switch (game_status)
{
case GAME_MODE_TITLE:
{
case GAME_MODE_TITLE:
- HandleTitleScreen(mx,
my, 0,
0, button);
+ HandleTitleScreen(mx,
my, 0,
0, button);
break;
case GAME_MODE_MAIN:
break;
case GAME_MODE_MAIN:
- HandleMainMenu(mx,
my, 0,
0, button);
+ HandleMainMenu(mx,
my, 0,
0, button);
break;
case GAME_MODE_PSEUDO_TYPENAME:
break;
case GAME_MODE_PSEUDO_TYPENAME:
@@
-433,11
+447,11
@@
void HandleButton(int mx, int my, int button)
break;
case GAME_MODE_LEVELS:
break;
case GAME_MODE_LEVELS:
- HandleChooseLevel(mx,
my, 0,
0, button);
+ HandleChooseLevel(mx,
my, 0,
0, button);
break;
case GAME_MODE_SCORES:
break;
case GAME_MODE_SCORES:
- HandleHallOfFame(0,
0, 0,
0, button);
+ HandleHallOfFame(0,
0, 0,
0, button);
break;
case GAME_MODE_EDITOR:
break;
case GAME_MODE_EDITOR:
@@
-445,11
+459,11
@@
void HandleButton(int mx, int my, int button)
break;
case GAME_MODE_INFO:
break;
case GAME_MODE_INFO:
- HandleInfoScreen(mx,
my, 0,
0, button);
+ HandleInfoScreen(mx,
my, 0,
0, button);
break;
case GAME_MODE_SETUP:
break;
case GAME_MODE_SETUP:
- HandleSetupScreen(mx,
my, 0,
0, button);
+ HandleSetupScreen(mx,
my, 0,
0, button);
break;
case GAME_MODE_PLAYING:
break;
case GAME_MODE_PLAYING:
@@
-673,12
+687,26
@@
void HandleKey(Key key, int key_status)
if (key_status == KEY_RELEASED)
return;
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 (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();
CloseDoor(DOOR_CLOSE_1);
game_status = GAME_MODE_MAIN;
DrawMainMenu();
+#endif
return;
}
return;
}
@@
-947,7
+975,8
@@
void HandleNoEvent()
{
if (button_status && game_status != GAME_MODE_PLAYING)
{
{
if (button_status && game_status != GAME_MODE_PLAYING)
{
- HandleButton(0, 0, -button_status);
+ HandleButton(0, 0, -button_status, button_status);
+
return;
}
return;
}
@@
-1001,6
+1030,7
@@
void HandleJoystick()
switch(game_status)
{
switch(game_status)
{
+ case GAME_MODE_TITLE:
case GAME_MODE_MAIN:
case GAME_MODE_LEVELS:
case GAME_MODE_SETUP:
case GAME_MODE_MAIN:
case GAME_MODE_LEVELS:
case GAME_MODE_SETUP:
@@
-1039,9
+1069,14
@@
void HandleJoystick()
if (AllPlayersGone && newbutton)
{
if (AllPlayersGone && newbutton)
{
+#if 1
+ GameEnd();
+#else
CloseDoor(DOOR_CLOSE_1);
game_status = GAME_MODE_MAIN;
DrawMainMenu();
CloseDoor(DOOR_CLOSE_1);
game_status = GAME_MODE_MAIN;
DrawMainMenu();
+#endif
+
return;
}
return;
}