]> git.jsancho.org Git - lugaru.git/blob - Source/SDLInput.cpp
26bf03f96e3ae6e0aff0cff5629ba40d18bc9cdb
[lugaru.git] / Source / SDLInput.cpp
1 #if USE_SDL
2
3 /**> HEADER FILES <**/
4 #include "SDLInput.h"
5 #include "String.h"
6
7 extern bool keyboardfrozen;
8 extern bool buttons[3];
9 /********************> IsKeyDown() <*****/
10 Boolean IsKeyDown( unsigned char *keyMap, unsigned short theKey )
11 {
12         if(keyboardfrozen)return 0;
13         if(theKey< 0x80 /*1000*/){
14                 static long     keyMapIndex;
15                 static Boolean  isKeyDown;
16                 static short    bitToCheck;
17
18                 // Calculate the key map index
19                 keyMapIndex = keyMap[theKey/8];
20
21                 // Calculate the individual bit to check
22                 bitToCheck = theKey%8;
23
24                 // Check the status of the key
25                 isKeyDown = ( keyMapIndex >> bitToCheck ) & 0x01;
26
27                 // Return the status of the key
28                 return isKeyDown;
29         }
30         else if(theKey==MAC_MOUSEBUTTON1)
31                 return buttons[0];
32         else if(theKey==MAC_MOUSEBUTTON2)
33                 return buttons[1];
34
35         return 0;
36 }
37
38 unsigned short  CharToKey(char* which)
39 {
40         // alphabetic keys
41         if(!stricmp(which,"a")){
42                 return MAC_A_KEY;
43         }
44         if(!stricmp(which,"b")){
45                 return MAC_B_KEY;
46         }
47         if(!stricmp(which,"c")){
48                 return MAC_C_KEY;
49         }
50         if(!stricmp(which,"d")){
51                 return MAC_D_KEY;
52         }
53         if(!stricmp(which,"e")){
54                 return MAC_E_KEY;
55         }
56         if(!stricmp(which,"f")){
57                 return MAC_F_KEY;
58         }
59         if(!stricmp(which,"g")){
60                 return MAC_G_KEY;
61         }
62         if(!stricmp(which,"h")){
63                 return MAC_H_KEY;
64         }
65         if(!stricmp(which,"i")){
66                 return MAC_I_KEY;
67         }
68         if(!stricmp(which,"j")){
69                 return MAC_J_KEY;
70         }
71         if(!stricmp(which,"k")){
72                 return MAC_K_KEY;
73         }
74         if(!stricmp(which,"l")){
75                 return MAC_L_KEY;
76         }
77         if(!stricmp(which,"m")){
78                 return MAC_M_KEY;
79         }
80         if(!stricmp(which,"n")){
81                 return MAC_N_KEY;
82         }
83         if(!stricmp(which,"o")){
84                 return MAC_O_KEY;
85         }
86         if(!stricmp(which,"p")){
87                 return MAC_P_KEY;
88         }
89         if(!stricmp(which,"q")){
90                 return MAC_Q_KEY;
91         }
92         if(!stricmp(which,"r")){
93                 return MAC_R_KEY;
94         }
95         if(!stricmp(which,"s")){
96                 return MAC_S_KEY;
97         }
98         if(!stricmp(which,"t")){
99                 return MAC_T_KEY;
100         }
101         if(!stricmp(which,"u")){
102                 return MAC_U_KEY;
103         }
104         if(!stricmp(which,"v")){
105                 return MAC_V_KEY;
106         }
107         if(!stricmp(which,"w")){
108                 return MAC_W_KEY;
109         }
110         if(!stricmp(which,"x")){
111                 return MAC_X_KEY;
112         }
113         if(!stricmp(which,"y")){
114                 return MAC_Y_KEY;
115         }
116         if(!stricmp(which,"z")){
117                 return MAC_Z_KEY;
118         }
119
120         // keypad keys
121         if(!stricmp(which,"KP0")){
122                 return MAC_NUMPAD_0_KEY;
123         }
124         if(!stricmp(which,"KP1")){
125                 return MAC_NUMPAD_1_KEY;
126         }
127         if(!stricmp(which,"KP2")){
128                 return MAC_NUMPAD_2_KEY;
129         }
130         if(!stricmp(which,"KP3")){
131                 return MAC_NUMPAD_3_KEY;
132         }
133         if(!stricmp(which,"KP4")){
134                 return MAC_NUMPAD_4_KEY;
135         }
136         if(!stricmp(which,"KP5")){
137                 return MAC_NUMPAD_5_KEY;
138         }
139         if(!stricmp(which,"KP6")){
140                 return MAC_NUMPAD_6_KEY;
141         }
142         if(!stricmp(which,"KP7")){
143                 return MAC_NUMPAD_7_KEY;
144         }
145         if(!stricmp(which,"KP8")){
146                 return MAC_NUMPAD_8_KEY;
147         }
148         if(!stricmp(which,"KP9")){
149                 return MAC_NUMPAD_9_KEY;
150         }
151
152         // enter
153         if(!stricmp(which,"enter")){
154                 return MAC_ENTER_KEY;
155         }
156
157         // number keys
158         if(!stricmp(which,"0")){
159                 return MAC_0_KEY;
160         }
161         if(!stricmp(which,"1")){
162                 return MAC_1_KEY;
163         }
164         if(!stricmp(which,"2")){
165                 return MAC_2_KEY;
166         }
167         if(!stricmp(which,"3")){
168                 return MAC_3_KEY;
169         }
170         if(!stricmp(which,"4")){
171                 return MAC_4_KEY;
172         }
173         if(!stricmp(which,"5")){
174                 return MAC_5_KEY;
175         }
176         if(!stricmp(which,"6")){
177                 return MAC_6_KEY;
178         }
179         if(!stricmp(which,"7")){
180                 return MAC_7_KEY;
181         }
182         if(!stricmp(which,"8")){
183                 return MAC_8_KEY;
184         }
185         if(!stricmp(which,"9")){
186                 return MAC_9_KEY;
187         }
188
189         // function keys
190         if(!stricmp(which,"F1")){
191                 return MAC_F1_KEY;
192         }
193         if(!stricmp(which,"F2")){
194                 return MAC_F2_KEY;
195         }
196         if(!stricmp(which,"F3")){
197                 return MAC_F3_KEY;
198         }
199         if(!stricmp(which,"F4")){
200                 return MAC_F4_KEY;
201         }
202         if(!stricmp(which,"F5")){
203                 return MAC_F5_KEY;
204         }
205         if(!stricmp(which,"F6")){
206                 return MAC_F6_KEY;
207         }
208         if(!stricmp(which,"F7")){
209                 return MAC_F7_KEY;
210         }
211         if(!stricmp(which,"F8")){
212                 return MAC_F8_KEY;
213         }
214         if(!stricmp(which,"F9")){
215                 return MAC_F9_KEY;
216         }
217         if(!stricmp(which,"F10")){
218                 return MAC_F10_KEY;
219         }
220         if(!stricmp(which,"F11")){
221                 return MAC_F11_KEY;
222         }
223         if(!stricmp(which,"F12")){
224                 return MAC_F12_KEY;
225         }
226
227         // escape
228         if(!stricmp(which,"escape")){
229                 return MAC_ESCAPE_KEY;
230         }
231         if(!stricmp(which,"backspace")){
232                 return MAC_DELETE_KEY;
233         }
234         if(!stricmp(which,"tab")){
235                 return MAC_TAB_KEY;
236         }
237         if(!stricmp(which,"`")){
238                 return MAC_TILDE_KEY;
239         }
240         if(!stricmp(which,"caps_lock")){
241                 return MAC_CAPS_LOCK_KEY;
242         }
243 //      if(which==){
244 //              return "";
245 //      }
246         if(!stricmp(which,"command")){
247                 return MAC_COMMAND_KEY;
248         }
249         if(!stricmp(which,"option")){
250                 return MAC_OPTION_KEY;
251         }
252         if(!stricmp(which,"delete")){
253                 return MAC_DEL_KEY;
254         }
255         if(!stricmp(which,"insert")){
256                 return MAC_INSERT_KEY;
257         }
258         if(!stricmp(which,"home")){
259                 return MAC_HOME_KEY;
260         }
261         if(!stricmp(which,"end")){
262                 return MAC_END_KEY;
263         }
264         if(!stricmp(which,"page_up")){
265                 return MAC_PAGE_UP_KEY;
266         }
267         if(!stricmp(which,"page_down")){
268                 return MAC_PAGE_DOWN_KEY;
269         }
270         if(!stricmp(which,"clear")){
271                 return MAC_NUMPAD_CLEAR_KEY;
272         }
273
274         if(!stricmp(which,"control")){
275                 return MAC_CONTROL_KEY;
276         }
277         if(!stricmp(which,"return")){
278                 return MAC_RETURN_KEY;
279         }
280         if(!stricmp(which,"space")){
281                 return MAC_SPACE_KEY;
282         }
283         if(!stricmp(which,"shift")){
284                 return MAC_SHIFT_KEY;
285         }
286         if(!stricmp(which,"uparrow")){
287                 return MAC_ARROW_UP_KEY;
288         }
289         if(!stricmp(which,"downarrow")){
290                 return MAC_ARROW_DOWN_KEY;
291         }
292         if(!stricmp(which,"leftarrow")){
293                 return MAC_ARROW_LEFT_KEY;
294         }
295         if(!stricmp(which,"rightarrow")){
296                 return MAC_ARROW_RIGHT_KEY;
297         }
298         if(!stricmp(which,"mouse1")){
299                 return MAC_MOUSEBUTTON1;
300         }
301         if(!stricmp(which,"mouse2")){
302                 return MAC_MOUSEBUTTON2;
303         }
304         if(!stricmp(which,"+")){
305                 return MAC_NUMPAD_PLUS_KEY;
306         }
307         if(!stricmp(which,"*")){
308                 return MAC_NUMPAD_ASTERISK_KEY;
309         }
310         if(!stricmp(which,"/")){
311                 return MAC_SLASH_KEY;
312         }
313         if(!stricmp(which,"\\")){
314                 return MAC_BACKSLASH_KEY;
315         }
316         if(!stricmp(which,"[")){
317                 return MAC_LEFTBRACKET_KEY;
318         }
319         if(!stricmp(which,"]")){
320                 return MAC_RIGHTBRACKET_KEY;
321         }
322         if(!stricmp(which,".")){
323                 return MAC_PERIOD_KEY;
324         }
325         if(!stricmp(which,",")){
326                 return MAC_COMMA_KEY;
327         }
328         if(!stricmp(which,"\"")){
329                 return MAC_APOSTROPHE_KEY;
330         }
331         if(!stricmp(which,";")){
332                 return MAC_SEMICOLON_KEY;
333         }
334         return UNKNOWN_KEY;
335 }
336
337 char*   KeyToChar(unsigned short which)
338 {
339         static int i;
340
341         // alphabetic keys
342         if(which==MAC_A_KEY){
343                 return "a";
344         }
345         if(which==MAC_B_KEY){
346                 return "b";
347         }
348         if(which==MAC_C_KEY){
349                 return "c";
350         }
351         if(which==MAC_D_KEY){
352                 return "d";
353         }
354         if(which==MAC_E_KEY){
355                 return "e";
356         }
357         if(which==MAC_F_KEY){
358                 return "f";
359         }
360         if(which==MAC_G_KEY){
361                 return "g";
362         }
363         if(which==MAC_H_KEY){
364                 return "h";
365         }
366         if(which==MAC_I_KEY){
367                 return "i";
368         }
369         if(which==MAC_J_KEY){
370                 return "j";
371         }
372         if(which==MAC_K_KEY){
373                 return "k";
374         }
375         if(which==MAC_L_KEY){
376                 return "l";
377         }
378         if(which==MAC_M_KEY){
379                 return "m";
380         }
381         if(which==MAC_N_KEY){
382                 return "n";
383         }
384         if(which==MAC_O_KEY){
385                 return "o";
386         }
387         if(which==MAC_P_KEY){
388                 return "p";
389         }
390         if(which==MAC_Q_KEY){
391                 return "q";
392         }
393         if(which==MAC_R_KEY){
394                 return "r";
395         }
396         if(which==MAC_S_KEY){
397                 return "s";
398         }
399         if(which==MAC_T_KEY){
400                 return "t";
401         }
402         if(which==MAC_U_KEY){
403                 return "u";
404         }
405         if(which==MAC_V_KEY){
406                 return "v";
407         }
408         if(which==MAC_W_KEY){
409                 return "w";
410         }
411         if(which==MAC_X_KEY){
412                 return "x";
413         }
414         if(which==MAC_Y_KEY){
415                 return "y";
416         }
417         if(which==MAC_Z_KEY){
418                 return "z";
419         }
420
421         // keypad keys
422         if(which==MAC_NUMPAD_1_KEY){
423                 return "KP1";
424         }
425         if(which==MAC_NUMPAD_2_KEY){
426                 return "KP2";
427         }
428         if(which==MAC_NUMPAD_3_KEY){
429                 return "KP3";
430         }
431         if(which==MAC_NUMPAD_4_KEY){
432                 return "KP4";
433         }
434         if(which==MAC_NUMPAD_5_KEY){
435                 return "KP5";
436         }
437         if(which==MAC_NUMPAD_6_KEY){
438                 return "KP6";
439         }
440         if(which==MAC_NUMPAD_7_KEY){
441                 return "KP7";
442         }
443         if(which==MAC_NUMPAD_8_KEY){
444                 return "KP8";
445         }
446         if(which==MAC_NUMPAD_9_KEY){
447                 return "KP9";
448         }
449         if(which==MAC_NUMPAD_0_KEY){
450                 return "KP0";
451         }
452
453         // enter
454         if(which==MAC_ENTER_KEY){
455                 return "enter";
456         }
457
458         // number keys
459         if(which==MAC_1_KEY){
460                 return "1";
461         }
462         if(which==MAC_2_KEY){
463                 return "2";
464         }
465         if(which==MAC_3_KEY){
466                 return "3";
467         }
468         if(which==MAC_4_KEY){
469                 return "4";
470         }
471         if(which==MAC_5_KEY){
472                 return "5";
473         }
474         if(which==MAC_6_KEY){
475                 return "6";
476         }
477         if(which==MAC_7_KEY){
478                 return "7";
479         }
480         if(which==MAC_8_KEY){
481                 return "8";
482         }
483         if(which==MAC_9_KEY){
484                 return "9";
485         }
486         if(which==MAC_0_KEY){
487                 return "0";
488         }
489
490         // function keys
491         if(which==MAC_F1_KEY){
492                 return "F1";
493         }
494         if(which==MAC_F2_KEY){
495                 return "F2";
496         }
497         if(which==MAC_F3_KEY){
498                 return "F3";
499         }
500         if(which==MAC_F4_KEY){
501                 return "F4";
502         }
503         if(which==MAC_F5_KEY){
504                 return "F5";
505         }
506         if(which==MAC_F6_KEY){
507                 return "F6";
508         }
509         if(which==MAC_F7_KEY){
510                 return "F7";
511         }
512         if(which==MAC_F8_KEY){
513                 return "F8";
514         }
515         if(which==MAC_F9_KEY){
516                 return "F9";
517         }
518         if(which==MAC_F10_KEY){
519                 return "F10";
520         }
521         if(which==MAC_F11_KEY){
522                 return "F11";
523         }
524         if(which==MAC_F12_KEY){
525                 return "F12";
526         }
527
528         // escape
529         if(which==MAC_ESCAPE_KEY){
530                 return "escape";
531         }
532         if(which==MAC_DELETE_KEY){
533                 return "backspace";
534         }
535         if(which==MAC_TAB_KEY){
536                 return "tab";
537         }
538         if(which==MAC_TILDE_KEY){
539                 return "`";
540         }
541         if(which==MAC_CAPS_LOCK_KEY){
542                 return "caps_lock";
543         }
544         if(which==MAC_COMMAND_KEY){
545                 return "command";
546         }
547         if(which==MAC_OPTION_KEY){
548                 return "option";
549         }
550         if(which==MAC_DEL_KEY){
551                 return "delete";
552         }
553         if(which==MAC_INSERT_KEY){
554                 return "insert";
555         }
556         if(which==MAC_HOME_KEY){
557                 return "home";
558         }
559         if(which==MAC_END_KEY){
560                 return "end";
561         }
562         if(which==MAC_PAGE_UP_KEY){
563                 return "page_up";
564         }
565         if(which==MAC_PAGE_DOWN_KEY){
566                 return "page_down";
567         }
568         if(which==MAC_NUMPAD_CLEAR_KEY){
569                 return "clear";
570         }
571         if(which==MAC_CONTROL_KEY){
572                 return "control";
573         }
574         if(which==MAC_SPACE_KEY){
575                 return "space";
576         }
577         if(which==MAC_RETURN_KEY){
578                 return "return";
579         }
580         if(which==MAC_SHIFT_KEY){
581                 return "shift";
582         }
583         if(which==MAC_ARROW_UP_KEY){
584                 return "uparrow";
585         }
586         if(which==MAC_ARROW_DOWN_KEY){
587                 return "downarrow";
588         }
589         if(which==MAC_ARROW_LEFT_KEY){
590                 return "leftarrow";
591         }
592         if(which==MAC_ARROW_RIGHT_KEY){
593                 return "rightarrow";
594         }
595         if(which==MAC_MOUSEBUTTON1){
596                 return "mouse1";
597         }
598         if(which==MAC_MOUSEBUTTON2){
599                 return "mouse2";
600         }
601         if(which==MAC_ARROW_RIGHT_KEY){
602                 return "rightarrow";
603         }
604         if(which==MAC_MINUS_KEY||which==MAC_NUMPAD_MINUS_KEY){
605                 return "-";
606         }
607         if(which==MAC_PLUS_KEY||which==MAC_NUMPAD_EQUALS_KEY){
608                 return "=";
609         }
610         if(which==MAC_NUMPAD_PLUS_KEY){
611                 return "+";
612         }
613         if(which==MAC_NUMPAD_ASTERISK_KEY){
614                 return "*";
615         }
616         if(which==MAC_SLASH_KEY||which==MAC_NUMPAD_SLASH_KEY){
617                 return "/";
618         }
619         if(which==MAC_BACKSLASH_KEY){
620                 return "\\";
621         }
622         if(which==MAC_LEFTBRACKET_KEY){
623                 return "[";
624         }
625         if(which==MAC_RIGHTBRACKET_KEY){
626                 return "]";
627         }
628         if(which==MAC_PERIOD_KEY||which==MAC_NUMPAD_PERIOD_KEY){
629                 return ".";
630         }
631         if(which==MAC_COMMA_KEY){
632                 return ",";
633         }
634         if(which==MAC_APOSTROPHE_KEY){
635                 return "\"";
636         }
637         if(which==MAC_SEMICOLON_KEY){
638                 return ";";
639         }
640         return "unknown";
641 }
642
643 char    KeyToSingleChar(unsigned short which)
644 {
645         static int i;
646
647         if(which==MAC_A_KEY){
648                 return 'a';
649         }
650         if(which==MAC_B_KEY){
651                 return 'b';
652         }
653         if(which==MAC_C_KEY){
654                 return 'c';
655         }
656         if(which==MAC_D_KEY){
657                 return 'd';
658         }
659         if(which==MAC_E_KEY){
660                 return 'e';
661         }
662         if(which==MAC_F_KEY){
663                 return 'f';
664         }
665         if(which==MAC_G_KEY){
666                 return 'g';
667         }
668         if(which==MAC_H_KEY){
669                 return 'h';
670         }
671         if(which==MAC_I_KEY){
672                 return 'i';
673         }
674         if(which==MAC_J_KEY){
675                 return 'j';
676         }
677         if(which==MAC_K_KEY){
678                 return 'k';
679         }
680         if(which==MAC_L_KEY){
681                 return 'l';
682         }
683         if(which==MAC_M_KEY){
684                 return 'm';
685         }
686         if(which==MAC_N_KEY){
687                 return 'n';
688         }
689         if(which==MAC_O_KEY){
690                 return 'o';
691         }
692         if(which==MAC_P_KEY){
693                 return 'p';
694         }
695         if(which==MAC_Q_KEY){
696                 return 'q';
697         }
698         if(which==MAC_R_KEY){
699                 return 'r';
700         }
701         if(which==MAC_S_KEY){
702                 return 's';
703         }
704         if(which==MAC_T_KEY){
705                 return 't';
706         }
707         if(which==MAC_U_KEY){
708                 return 'u';
709         }
710         if(which==MAC_V_KEY){
711                 return 'v';
712         }
713         if(which==MAC_W_KEY){
714                 return 'w';
715         }
716         if(which==MAC_X_KEY){
717                 return 'x';
718         }
719         if(which==MAC_Y_KEY){
720                 return 'y';
721         }
722         if(which==MAC_Z_KEY){
723                 return 'z';
724         }
725         if(which==MAC_NUMPAD_1_KEY){
726                 return '1';
727         }
728         if(which==MAC_NUMPAD_2_KEY){
729                 return '2';
730         }
731         if(which==MAC_NUMPAD_3_KEY){
732                 return '3';
733         }
734         if(which==MAC_NUMPAD_4_KEY){
735                 return '4';
736         }
737         if(which==MAC_NUMPAD_5_KEY){
738                 return '5';
739         }
740         if(which==MAC_NUMPAD_6_KEY){
741                 return '6';
742         }
743         if(which==MAC_NUMPAD_7_KEY){
744                 return '7';
745         }
746         if(which==MAC_NUMPAD_8_KEY){
747                 return '8';
748         }
749         if(which==MAC_NUMPAD_9_KEY){
750                 return '9';
751         }
752         if(which==MAC_NUMPAD_0_KEY){
753                 return '0';
754         }
755         if(which==MAC_1_KEY){
756                 return '1';
757         }
758         if(which==MAC_2_KEY){
759                 return '2';
760         }
761         if(which==MAC_3_KEY){
762                 return '3';
763         }
764         if(which==MAC_4_KEY){
765                 return '4';
766         }
767         if(which==MAC_5_KEY){
768                 return '5';
769         }
770         if(which==MAC_6_KEY){
771                 return '6';
772         }
773         if(which==MAC_7_KEY){
774                 return '7';
775         }
776         if(which==MAC_8_KEY){
777                 return '8';
778         }
779         if(which==MAC_9_KEY){
780                 return '9';
781         }
782         if(which==MAC_0_KEY){
783                 return '0';
784         }
785         if(which==MAC_SPACE_KEY){
786                 return ' ';
787         }
788         if(which==MAC_MINUS_KEY||which==MAC_NUMPAD_MINUS_KEY){
789                 return '-';
790         }
791         if(which==MAC_PLUS_KEY||which==MAC_NUMPAD_EQUALS_KEY){
792                 return '=';
793         }
794         if(which==MAC_NUMPAD_PLUS_KEY){
795                 return '+';
796         }
797         if(which==MAC_NUMPAD_ASTERISK_KEY){
798                 return '*';
799         }
800         if(which==MAC_SLASH_KEY||which==MAC_NUMPAD_SLASH_KEY){
801                 return '/';
802         }
803         if(which==MAC_BACKSLASH_KEY){
804                 return '\\';
805         }
806         if(which==MAC_LEFTBRACKET_KEY){
807                 return '[';
808         }
809         if(which==MAC_RIGHTBRACKET_KEY){
810                 return ']';
811         }
812         if(which==MAC_PERIOD_KEY||which==MAC_NUMPAD_PERIOD_KEY){
813                 return '.';
814         }
815         if(which==MAC_COMMA_KEY){
816                 return ',';
817         }
818         if(which==MAC_APOSTROPHE_KEY){
819                 return '\'';
820         }
821         if(which==MAC_SEMICOLON_KEY){
822                 return ';';
823         }
824         return '\0';
825 }
826
827 char    Shift(char which)
828 {
829         static int i;
830
831         if(which=='a'){
832                 return 'A';
833         }
834         if(which=='b'){
835                 return 'B';
836         }
837         if(which=='c'){
838                 return 'C';
839         }
840         if(which=='d'){
841                 return 'D';
842         }
843         if(which=='e'){
844                 return 'E';
845         }
846         if(which=='f'){
847                 return 'F';
848         }
849         if(which=='g'){
850                 return 'G';
851         }
852         if(which=='h'){
853                 return 'H';
854         }
855         if(which=='e'){
856                 return 'E';
857         }
858         if(which=='f'){
859                 return 'F';
860         }
861         if(which=='g'){
862                 return 'G';
863         }
864         if(which=='h'){
865                 return 'H';
866         }
867         if(which=='i'){
868                 return 'I';
869         }
870         if(which=='j'){
871                 return 'J';
872         }
873         if(which=='k'){
874                 return 'K';
875         }
876         if(which=='l'){
877                 return 'L';
878         }
879         if(which=='m'){
880                 return 'M';
881         }
882         if(which=='n'){
883                 return 'N';
884         }
885         if(which=='o'){
886                 return 'O';
887         }
888         if(which=='p'){
889                 return 'P';
890         }
891         if(which=='q'){
892                 return 'Q';
893         }
894         if(which=='r'){
895                 return 'R';
896         }
897         if(which=='s'){
898                 return 'S';
899         }
900         if(which=='t'){
901                 return 'T';
902         }
903         if(which=='u'){
904                 return 'U';
905         }
906         if(which=='v'){
907                 return 'V';
908         }
909         if(which=='w'){
910                 return 'W';
911         }
912         if(which=='x'){
913                 return 'X';
914         }
915         if(which=='y'){
916                 return 'Y';
917         }
918         if(which=='z'){
919                 return 'Z';
920         }
921         if(which=='1'){
922                 return '!';
923         }
924         if(which=='2'){
925                 return '@';
926         }
927         if(which=='3'){
928                 return '#';
929         }
930         if(which=='4'){
931                 return '$';
932         }
933         if(which=='5'){
934                 return '%';
935         }
936         if(which=='6'){
937                 return '^';
938         }
939         if(which=='7'){
940                 return '&';
941         }
942         if(which=='8'){
943                 return '*';
944         }
945         if(which=='9'){
946                 return '(';
947         }
948         if(which=='0'){
949                 return ')';
950         }
951         if(which=='-'){
952                 return '_';
953         }
954         if(which=='='){
955                 return '+';
956         }
957         if(which=='['){
958                 return '{';
959         }
960         if(which==']'){
961                 return '}';
962         }
963         if(which=='\\'){
964                 return '|';
965         }
966         if(which=='.'){
967                 return '>';
968         }
969         if(which==','){
970                 return '<';
971         }
972         if(which=='/'){
973                 return '?';
974         }
975         if(which==';'){
976                 return ':';
977         }
978         if(which=='\''){
979                 return '\"';
980         }
981         return which;
982 }
983
984 bool    Compare(char *thestring, char *tocompare, int start, int end)
985 {
986         static int i;
987         for(i=start;i<=end;i++){
988                 if(thestring[i]!=tocompare[i-start]&&thestring[i]!=tocompare[i-start]+'A'-'a')return 0;
989         }
990         return 1;
991 }
992
993 #endif
994
995