r10106 - packages/trunk/asylum/debian/patches
Peter De Wachter
pdewacht-guest at alioth.debian.org
Fri Jul 31 19:19:52 UTC 2009
Author: pdewacht-guest
Date: 2009-07-31 19:19:52 +0000 (Fri, 31 Jul 2009)
New Revision: 10106
Added:
packages/trunk/asylum/debian/patches/number-input.patch
Removed:
packages/trunk/asylum/debian/patches/numeric-keypad.patch
Modified:
packages/trunk/asylum/debian/patches/series
Log:
asylum: alternative patch for #538772.
Added: packages/trunk/asylum/debian/patches/number-input.patch
===================================================================
--- packages/trunk/asylum/debian/patches/number-input.patch (rev 0)
+++ packages/trunk/asylum/debian/patches/number-input.patch 2009-07-31 19:19:52 UTC (rev 10106)
@@ -0,0 +1,154 @@
+Use SDL's unicode layer for menu input. This way we can support all keyboard
+variations (numeric keypad, numbers on a shifted position, whatever else).
+Debian bug #538772.
+
+Also allow Alt-Gr as an alternative for right alt.
+
+--- a/asylum.c
++++ b/asylum.c
+@@ -480,6 +480,7 @@
+
+ SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO);
+ SDL_WM_SetCaption("Asylum", "Asylum");
++ SDL_EnableUNICODE(1);
+ #ifndef _NO_SOUND
+ init_audio();
+ #endif
+--- a/asylum.h
++++ b/asylum.h
+@@ -495,6 +495,7 @@
+ void swi_stasis_volslide(int a, int b, int c);
+ void swi_removecursors();
+ int osbyte_79(int c);
++int osbyte_79_unicode(int c);
+ int osbyte_7a();
+ void osbyte_7c();
+ int osbyte_81(int c);
+--- a/keyboard.c
++++ b/keyboard.c
+@@ -19,9 +19,10 @@
+
+ extern asylum_options options;
+
+-char keyboard[512];
+-int keybuf;
+-int mouse;
++static char keyboard[512];
++static int keybuf;
++static int unibuf;
++static int mouse;
+
+ #define ESC_VALUE 27
+
+@@ -54,6 +55,14 @@
+ return -1;
+ }
+
++int osbyte_79_unicode(int c)
++{
++ update_keyboard();
++ int uni = unibuf;
++ unibuf = -1;
++ return uni;
++}
++
+ int osbyte_7a()
+ {
+ update_keyboard(); for (int i = 0; i < 512; i++) if (keyboard[i]) return i;return -1;
+@@ -96,6 +105,10 @@
+ ke = (SDL_KeyboardEvent*)&e;
+ keyboard[ke->keysym.sym] = 0xff;
+ keybuf = ke->keysym.sym;
++ if (ke->keysym.unicode)
++ unibuf = ke->keysym.unicode;
++ else
++ unibuf = -1;
+ break;
+ case SDL_KEYUP:
+ ke = (SDL_KeyboardEvent*)&e;
+@@ -128,7 +141,7 @@
+
+ void zonecheatread(int* zone)
+ {
+- char r1 = osbyte_7a(); // was _81(0)
++ char r1 = osbyte_79_unicode(0); // was _81(0)
+
+ if ((r1 < 48) || (r1 > 56)) return;
+ *zone = r1-48;
+--- a/menus.c
++++ b/menus.c
+@@ -54,18 +54,17 @@
+ swi_fastspr_clearwindow();
+ texthandler();
+ }
+- esctextstop:
+- if (osbyte_81(-113))
++ switch (osbyte_79_unicode(1))
+ {
+- loselife(); return 0;
+- }
+- if (osbyte_81(-111))
+- {
+- adjustopt(); return 0;
+- }
+- if (osbyte_81(-114))
+- {
+- rejoin(); return 0;
++ case 'q': case 'Q':
++ loselife();
++ return 0;
++ case 'o': case 'O':
++ adjustopt();
++ return 0;
++ case 'r': case 'R':
++ rejoin();
++ return 0;
+ }
+ }
+ osbyte_7c();
+@@ -478,7 +477,7 @@
+ {
+ int r1;
+
+- do
++ for (;;)
+ {
+ keyloop:
+ if (options.joyno != 0)
+@@ -488,20 +487,18 @@
+ //if (r0&(1<<16)) {/*optfire:*/ return 0;}
+ }
+ nooptstick:
+- r1 = osbyte_81(1); // read key in time limit
+-// if (r1!=0xff) printf("%i\n",r1);
++ r1 = osbyte_79_unicode(1); // read key in time limit
+ if (swi_readescapestate())
+ {
+ optescape:
+ osbyte_7c(); // clear escape
+ return -1;
+ }
+- if (r1 == 0) continue;
+- if (osbyte_81(options.firekey) == 0xff) optfire: return 0;r1 -= 48; // '1' key returns value 49
++ if (r1 >= '0' && r1 <= '0' + maxopt)
++ return r1 - '0';
++ if (osbyte_81(options.firekey) == 0xff)
++ return 0;
+ }
+- while (!((r1 >= 0) && (r1 <= maxopt)));
+- optexit:
+- return r1;
+ }
+
+ const int _x = 250;
+@@ -552,8 +549,8 @@
+ if (readmousestate()&2)
+ {
+ gocheat:
+- if (osbyte_81(-307) != 0xff) return cheatpermit;
+- if (osbyte_81(-308) != 0xff) return cheatpermit;
++ if (osbyte_81(-SDLK_LALT) != 0xff) return cheatpermit;
++ if (osbyte_81(-SDLK_RALT) != 0xff && osbyte_81(-SDLK_MODE) != 0xff) return cheatpermit;
+ cheatpermit = 1;
+ scroll = 1024;
+ }
Deleted: packages/trunk/asylum/debian/patches/numeric-keypad.patch
===================================================================
--- packages/trunk/asylum/debian/patches/numeric-keypad.patch 2009-07-31 15:50:35 UTC (rev 10105)
+++ packages/trunk/asylum/debian/patches/numeric-keypad.patch 2009-07-31 19:19:52 UTC (rev 10106)
@@ -1,20 +0,0 @@
-Allows input using the numeric keypad. Debian bug #538772.
-
---- a/menus.c
-+++ b/menus.c
-@@ -497,7 +497,14 @@
- return -1;
- }
- if (r1 == 0) continue;
-- if (osbyte_81(options.firekey) == 0xff) optfire: return 0;r1 -= 48; // '1' key returns value 49
-+ if (osbyte_81(options.firekey) == 0xff)
-+ return 0;
-+ if (r1 >= SDLK_0 && r1 <= SDLK_9)
-+ r1 -= SDLK_0;
-+ else if (r1 >= SDLK_KP0 && r1 <= SDLK_KP9)
-+ r1 -= SDLK_KP0;
-+ else
-+ continue;
- }
- while (!((r1 >= 0) && (r1 <= maxopt)));
- optexit:
Modified: packages/trunk/asylum/debian/patches/series
===================================================================
--- packages/trunk/asylum/debian/patches/series 2009-07-31 15:50:35 UTC (rev 10105)
+++ packages/trunk/asylum/debian/patches/series 2009-07-31 19:19:52 UTC (rev 10106)
@@ -1,2 +1,2 @@
opengl-endianness.patch
-numeric-keypad.patch
+numer-input.patch
More information about the Pkg-games-commits
mailing list