File tree Expand file tree Collapse file tree 4 files changed +35
-30
lines changed
Expand file tree Collapse file tree 4 files changed +35
-30
lines changed Original file line number Diff line number Diff line change @@ -480,6 +480,7 @@ int main(int argc, char** argv)
480480
481481 SDL_Init (SDL_INIT_VIDEO |SDL_INIT_AUDIO );
482482 SDL_WM_SetCaption ("Asylum" , "Asylum" );
483+ SDL_EnableUNICODE (1 );
483484#ifndef _NO_SOUND
484485 init_audio ();
485486#endif
Original file line number Diff line number Diff line change @@ -495,6 +495,7 @@ void swi_stasis_control(int a, int b);
495495void swi_stasis_volslide (int a , int b , int c );
496496void swi_removecursors ();
497497int osbyte_79 (int c );
498+ int osbyte_79_unicode (int c );
498499int osbyte_7a ();
499500void osbyte_7c ();
500501int osbyte_81 (int c );
Original file line number Diff line number Diff line change 1919
2020extern asylum_options options ;
2121
22- char keyboard [512 ];
23- int keybuf ;
24- int mouse ;
22+ static char keyboard [512 ];
23+ static int keybuf ;
24+ static int unibuf ;
25+ static int mouse ;
2526
2627#define ESC_VALUE 27
2728
@@ -54,6 +55,14 @@ int osbyte_79(int c)
5455 return -1 ;
5556}
5657
58+ int osbyte_79_unicode (int c )
59+ {
60+ update_keyboard ();
61+ int uni = unibuf ;
62+ unibuf = -1 ;
63+ return uni ;
64+ }
65+
5766int osbyte_7a ()
5867{
5968 update_keyboard (); for (int i = 0 ; i < 512 ; i ++ ) if (keyboard [i ]) return i ;return -1 ;
@@ -96,6 +105,10 @@ void update_keyboard()
96105 ke = (SDL_KeyboardEvent * )& e ;
97106 keyboard [ke -> keysym .sym ] = 0xff ;
98107 keybuf = ke -> keysym .sym ;
108+ if (ke -> keysym .unicode )
109+ unibuf = ke -> keysym .unicode ;
110+ else
111+ unibuf = -1 ;
99112 break ;
100113 case SDL_KEYUP :
101114 ke = (SDL_KeyboardEvent * )& e ;
@@ -128,7 +141,7 @@ void update_keyboard()
128141
129142void zonecheatread (int * zone )
130143{
131- char r1 = osbyte_7a ( ); // was _81(0)
144+ char r1 = osbyte_79_unicode ( 0 ); // was _81(0)
132145
133146 if ((r1 < 48 ) || (r1 > 56 )) return ;
134147 * zone = r1 - 48 ;
Original file line number Diff line number Diff line change @@ -54,18 +54,17 @@ int escapehandler()
5454 swi_fastspr_clearwindow ();
5555 texthandler ();
5656 }
57- esctextstop :
58- if (osbyte_81 (-113 ))
57+ switch (osbyte_79_unicode (1 ))
5958 {
60- loselife (); return 0 ;
61- }
62- if ( osbyte_81 ( -111 ))
63- {
64- adjustopt (); return 0 ;
65- }
66- if ( osbyte_81 ( -114 ))
67- {
68- rejoin (); return 0 ;
59+ case 'q' : case 'Q' :
60+ loselife ();
61+ return 0 ;
62+ case 'o' : case 'O' :
63+ adjustopt ();
64+ return 0 ;
65+ case 'r' : case 'R' :
66+ rejoin ();
67+ return 0 ;
6968 }
7069 }
7170 osbyte_7c ();
@@ -478,7 +477,7 @@ int readopt(int maxopt)
478477{
479478 int r1 ;
480479
481- do
480+ for (;;)
482481 {
483482 keyloop :
484483 if (options .joyno != 0 )
@@ -488,27 +487,18 @@ int readopt(int maxopt)
488487//if (r0&(1<<16)) {/*optfire:*/ return 0;}
489488 }
490489 nooptstick :
491- r1 = osbyte_81 (1 ); // read key in time limit
492- // if (r1!=0xff) printf("%i\n",r1);
490+ r1 = osbyte_79_unicode (1 ); // read key in time limit
493491 if (swi_readescapestate ())
494492 {
495493 optescape :
496494 osbyte_7c (); // clear escape
497495 return -1 ;
498496 }
499- if (r1 == 0 ) continue ;
497+ if (r1 >= '0' && r1 <= '0' + maxopt )
498+ return r1 - '0' ;
500499 if (osbyte_81 (options .firekey ) == 0xff )
501500 return 0 ;
502- if (r1 >= SDLK_0 && r1 <= SDLK_9 )
503- r1 -= SDLK_0 ;
504- else if (r1 >= SDLK_KP0 && r1 <= SDLK_KP9 )
505- r1 -= SDLK_KP0 ;
506- else
507- continue ;
508501 }
509- while (!((r1 >= 0 ) && (r1 <= maxopt )));
510- optexit :
511- return r1 ;
512502}
513503
514504const int _x = 250 ;
@@ -559,8 +549,8 @@ int prelude()
559549 if (readmousestate ()& 2 )
560550 {
561551 gocheat :
562- if (osbyte_81 (-307 ) != 0xff ) return cheatpermit ;
563- if (osbyte_81 (-308 ) != 0xff ) return cheatpermit ;
552+ if (osbyte_81 (- SDLK_LALT ) != 0xff ) return cheatpermit ;
553+ if (osbyte_81 (- SDLK_RALT ) != 0xff && osbyte_81 ( - SDLK_MODE ) != 0xff ) return cheatpermit ;
564554 cheatpermit = 1 ;
565555 scroll = 1024 ;
566556 }
You can’t perform that action at this time.
0 commit comments