diff options
author | edwin <edwin@FreeBSD.org> | 2005-06-12 11:41:48 +0800 |
---|---|---|
committer | edwin <edwin@FreeBSD.org> | 2005-06-12 11:41:48 +0800 |
commit | 181c25d7615dfe8a4166978e641a04d07f715279 (patch) | |
tree | 6f829d03223d7a018570bcbbba95f4cc7915063b /games/xrally/files | |
parent | 627d885583bf113a0ffd9c4798ef02e690569a4a (diff) | |
download | freebsd-ports-gnome-181c25d7615dfe8a4166978e641a04d07f715279.tar.gz freebsd-ports-gnome-181c25d7615dfe8a4166978e641a04d07f715279.tar.zst freebsd-ports-gnome-181c25d7615dfe8a4166978e641a04d07f715279.zip |
Upgrade to version 1.1.1
01/12/2001
There was a bug on XRally 1.1, that made the game use lots of
CPU. If you were having this problem, just download this patch
and apply it to the source.
Diffstat (limited to 'games/xrally/files')
-rw-r--r-- | games/xrally/files/patch-xrally-1.1.1 | 146 |
1 files changed, 146 insertions, 0 deletions
diff --git a/games/xrally/files/patch-xrally-1.1.1 b/games/xrally/files/patch-xrally-1.1.1 new file mode 100644 index 000000000000..c313fd2e70f0 --- /dev/null +++ b/games/xrally/files/patch-xrally-1.1.1 @@ -0,0 +1,146 @@ +--- menu.c 2001/01/01 18:49:16 1.22 XRALLY_1_1 ++++ menu.c 2001/01/11 15:28:03 1.23 HEAD +@@ -5,7 +5,7 @@ + copyright : (C) 2000 by Perdig + email : perdig@linuxbr.com.br + +- $Id: menu.c,v 1.22 2001/01/01 18:49:16 perdig Exp $ ++ $Id: menu.c,v 1.23 2001/01/11 15:28:03 perdig Exp $ + ***************************************************************************/ + + /*************************************************************************** +@@ -25,7 +25,9 @@ + #include "level.h" + #include "score.h" + #include "dirent.h" ++#ifdef USE_SOUND + #include "sound.h" ++#endif + #include "limits.h" + #include <stdio.h> + #include <string.h> +--- graphics.c 2000/12/07 12:44:10 1.15 XRALLY_1_1 ++++ graphics.c 2001/01/11 15:28:03 1.16 HEAD +@@ -5,7 +5,7 @@ + copyright : (C) 2000 by Perdig + email : perdig@linuxbr.com.br + +- $Id: graphics.c,v 1.15 2000/12/07 12:44:10 perdig Exp $ ++ $Id: graphics.c,v 1.16 2001/01/11 15:28:03 perdig Exp $ + ***************************************************************************/ + + /*************************************************************************** +@@ -18,12 +18,13 @@ + ***************************************************************************/ + #include "graphics.h" + #include "global.h" ++#include <unistd.h> + #include <sys/time.h> + + // Internal functions + + static char ** _split_text(const char *_txt); +-static int _check_event(XEvent *xev); ++static int _check_event(XEvent *xev, int blocking); + long time_diff(struct timeval *rt); + + // Basic X11 variables +@@ -401,10 +402,15 @@ + return double_buffer; + } + +-static int _check_event(XEvent *xev) { ++static int _check_event(XEvent *xev, int blocking) { + XEvent *last = NULL; ++ int a = 0; + +- while (XCheckMaskEvent(dpy, KeyPressMask | ExposureMask, xev)) { ++ do { ++ if (blocking) ++ XWindowEvent(dpy, win, KeyPressMask | ExposureMask, xev); ++ else ++ a = XCheckMaskEvent(dpy, KeyPressMask | ExposureMask, xev); + switch (xev->type) { + case KeyPress: + last = xev; +@@ -417,7 +423,7 @@ + default: + break; + } +- } ++ } while ((blocking && !last) || (!blocking && a)); + // No events + xev = last; + return (last) ? true : false; +@@ -426,32 +432,35 @@ + + KeySym check_key() { + XEvent xev; +- if (_check_event(&xev) && xev.type == KeyPress) ++ if (_check_event(&xev, 0) && xev.type == KeyPress) + return XLookupKeysym(&xev.xkey, 0); + // No events + return XK_VoidSymbol; + } + + KeySym wait_key() { +- KeySym key = XK_VoidSymbol; +- while (key == XK_VoidSymbol) { +- key = check_key(); +- } +- return key; ++ XEvent xev; ++ _check_event(&xev, 1); ++ return XLookupKeysym(&xev.xkey, 0); + } + + void wait_time(long time_wait) { +- struct timeval it; ++ struct timeval it, tmp; + XEvent xev; + gettimeofday(&it, NULL); +- while (time_diff(&it) < time_wait) +- _check_event(&xev); ++ while (time_diff(&it) < time_wait) { ++ /* Reduce system load, sleeping for a while */ ++ tmp.tv_sec = 0; ++ tmp.tv_usec = 1000; ++ select(0, NULL, NULL, NULL, &tmp); ++ _check_event(&xev, 0); ++ } + } + + KeySym wait_char(char *str) { + KeySym key = XK_VoidSymbol; + XEvent xev; +- while (!_check_event(&xev) || xev.type != KeyPress); ++ _check_event(&xev, 1); + XLookupString(&xev.xkey, str, 3, &key, NULL); + return key; + } +--- global.h 2001/01/01 18:49:16 1.9 XRALLY_1_1 ++++ global.h 2001/01/11 15:28:03 1.10 +@@ -5,7 +5,7 @@ + copyright : (C) 2000 by Perdig + email : perdig@linuxbr.com.br + +- $Id: global.h,v 1.9 2001/01/01 18:49:16 perdig Exp $ ++ $Id: global.h,v 1.10 2001/01/11 15:28:03 perdig Exp $ + ***************************************************************************/ + + /*************************************************************************** +@@ -212,5 +212,14 @@ + + + #define PLAYABLE ++ ++#ifndef USE_SOUND ++#define sound_switch() ++#define sound_stop() ++#define sound_volume(a) ++#define sound_start() ++#define sound_select(a) ++#define sound_load(a) ++#endif + + #endif |