projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed bug which could cause a crash due to an array index overflow
[rocksndiamonds.git]
/
src
/
events.c
diff --git
a/src/events.c
b/src/events.c
index e2d5ab9bdb47ef3fb81caed64112dd411b9e6a63..6dbb1e7154fd6823a9e5d7ebcfaebbfb9c0830d4 100644
(file)
--- a/
src/events.c
+++ b/
src/events.c
@@
-532,8
+532,8
@@
void HandleWindowEvent(WindowEvent *event)
if (new_window_width != video.window_width ||
new_window_height != video.window_height)
{
if (new_window_width != video.window_width ||
new_window_height != video.window_height)
{
- int new_xpercent =
(100 * new_window_width / video.screen_width)
;
- int new_ypercent =
(100 * new_window_height / video.screen_height)
;
+ int new_xpercent =
100.0 * new_window_width / video.screen_width + .5
;
+ int new_ypercent =
100.0 * new_window_height / video.screen_height + .5
;
// (extreme window scaling allowed, but cannot be saved permanently)
video.window_scaling_percent = MIN(new_xpercent, new_ypercent);
// (extreme window scaling allowed, but cannot be saved permanently)
video.window_scaling_percent = MIN(new_xpercent, new_ypercent);
@@
-1233,6
+1233,12
@@
void HandleButton(int mx, int my, int button, int button_nr)
}
#endif
}
#endif
+ if (HandleGlobalAnimClicks(mx, my, button))
+ {
+ /* do not handle this button event anymore */
+ mx = my = -32; /* force mouse event to be outside screen tiles */
+ }
+
if (button_hold && game_status == GAME_MODE_PLAYING && tape.pausing)
return;
if (button_hold && game_status == GAME_MODE_PLAYING && tape.pausing)
return;
@@
-1697,6
+1703,15
@@
void HandleKey(Key key, int key_status)
return;
}
return;
}
+ if (HandleGlobalAnimClicks(-1, -1, (key == KSYM_space ||
+ key == KSYM_Return ||
+ key == KSYM_Escape)))
+ {
+ /* do not handle this key event anymore */
+ if (key != KSYM_Escape) /* always allow ESC key to be handled */
+ 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))
{
@@
-1951,6
+1966,12
@@
void HandleJoystick()
int dx = (left ? -1 : right ? 1 : 0);
int dy = (up ? -1 : down ? 1 : 0);
int dx = (left ? -1 : right ? 1 : 0);
int dy = (up ? -1 : down ? 1 : 0);
+ if (HandleGlobalAnimClicks(-1, -1, newbutton))
+ {
+ /* do not handle this button event anymore */
+ return;
+ }
+
switch (game_status)
{
case GAME_MODE_TITLE:
switch (game_status)
{
case GAME_MODE_TITLE: