]> 4ch.mooo.com Git - 16.git/blob - 16/WOLFSRC/ID_US_1.C
added a simpler mmtest.c
[16.git] / 16 / WOLFSRC / ID_US_1.C
1 //\r
2 //      ID Engine\r
3 //      ID_US_1.c - User Manager - General routines\r
4 //      v1.1d1\r
5 //      By Jason Blochowiak\r
6 //      Hacked up for Catacomb 3D\r
7 //\r
8 \r
9 //\r
10 //      This module handles dealing with user input & feedback\r
11 //\r
12 //      Depends on: Input Mgr, View Mgr, some variables from the Sound, Caching,\r
13 //              and Refresh Mgrs, Memory Mgr for background save/restore\r
14 //\r
15 //      Globals:\r
16 //              ingame - Flag set by game indicating if a game is in progress\r
17 //      abortgame - Flag set if the current game should be aborted (if a load\r
18 //                      game fails)\r
19 //              loadedgame - Flag set if a game was loaded\r
20 //              abortprogram - Normally nil, this points to a terminal error message\r
21 //                      if the program needs to abort\r
22 //              restartgame - Normally set to gd_Continue, this is set to one of the\r
23 //                      difficulty levels if a new game should be started\r
24 //              PrintX, PrintY - Where the User Mgr will print (global coords)\r
25 //              WindowX,WindowY,WindowW,WindowH - The dimensions of the current\r
26 //                      window\r
27 //\r
28 \r
29 #include "ID_HEADS.H"\r
30 \r
31 #pragma hdrstop\r
32 \r
33 #pragma warn    -pia\r
34 \r
35 \r
36 //      Global variables\r
37                 char            *abortprogram;\r
38                 boolean         NoWait;\r
39                 word            PrintX,PrintY;\r
40                 word            WindowX,WindowY,WindowW,WindowH;\r
41 \r
42 //      Internal variables\r
43 #define ConfigVersion   1\r
44 \r
45 static  char            *ParmStrings[] = {"TEDLEVEL","NOWAIT"},\r
46                                         *ParmStrings2[] = {"COMP","NOCOMP"};\r
47 static  boolean         US_Started;\r
48 \r
49                 boolean         Button0,Button1,\r
50                                         CursorBad;\r
51                 int                     CursorX,CursorY;\r
52 \r
53                 void            (*USL_MeasureString)(char far *,word *,word *) = VW_MeasurePropString,\r
54                                         (*USL_DrawString)(char far *) = VWB_DrawPropString;\r
55 \r
56                 SaveGame        Games[MaxSaveGames];\r
57                 HighScore       Scores[MaxScores] =\r
58                                         {\r
59                                                 {"id software-'92",10000,1},\r
60                                                 {"Adrian Carmack",10000,1},\r
61                                                 {"John Carmack",10000,1},\r
62                                                 {"Kevin Cloud",10000,1},\r
63                                                 {"Tom Hall",10000,1},\r
64                                                 {"John Romero",10000,1},\r
65                                                 {"Jay Wilbur",10000,1},\r
66                                         };\r
67 \r
68 //      Internal routines\r
69 \r
70 //      Public routines\r
71 \r
72 ///////////////////////////////////////////////////////////////////////////\r
73 //\r
74 //      USL_HardError() - Handles the Abort/Retry/Fail sort of errors passed\r
75 //                      from DOS.\r
76 //\r
77 ///////////////////////////////////////////////////////////////////////////\r
78 #pragma warn    -par\r
79 #pragma warn    -rch\r
80 int\r
81 USL_HardError(word errval,int ax,int bp,int si)\r
82 {\r
83 #define IGNORE  0\r
84 #define RETRY   1\r
85 #define ABORT   2\r
86 extern  void    ShutdownId(void);\r
87 \r
88 static  char            buf[32];\r
89 static  WindowRec       wr;\r
90                 int                     di;\r
91                 char            c,*s,*t;\r
92 \r
93 \r
94         di = _DI;\r
95 \r
96         if (ax < 0)\r
97                 s = "Device Error";\r
98         else\r
99         {\r
100                 if ((di & 0x00ff) == 0)\r
101                         s = "Drive ~ is Write Protected";\r
102                 else\r
103                         s = "Error on Drive ~";\r
104                 for (t = buf;*s;s++,t++)        // Can't use sprintf()\r
105                         if ((*t = *s) == '~')\r
106                                 *t = (ax & 0x00ff) + 'A';\r
107                 *t = '\0';\r
108                 s = buf;\r
109         }\r
110 \r
111         c = peekb(0x40,0x49);   // Get the current screen mode\r
112         if ((c < 4) || (c == 7))\r
113                 goto oh_kill_me;\r
114 \r
115         // DEBUG - handle screen cleanup\r
116 \r
117         US_SaveWindow(&wr);\r
118         US_CenterWindow(30,3);\r
119         US_CPrint(s);\r
120         US_CPrint("(R)etry or (A)bort?");\r
121         VW_UpdateScreen();\r
122         IN_ClearKeysDown();\r
123 \r
124 asm     sti     // Let the keyboard interrupts come through\r
125 \r
126         while (true)\r
127         {\r
128                 switch (IN_WaitForASCII())\r
129                 {\r
130                 case key_Escape:\r
131                 case 'a':\r
132                 case 'A':\r
133                         goto oh_kill_me;\r
134                         break;\r
135                 case key_Return:\r
136                 case key_Space:\r
137                 case 'r':\r
138                 case 'R':\r
139                         US_ClearWindow();\r
140                         VW_UpdateScreen();\r
141                         US_RestoreWindow(&wr);\r
142                         return(RETRY);\r
143                         break;\r
144                 }\r
145         }\r
146 \r
147 oh_kill_me:\r
148         abortprogram = s;\r
149         ShutdownId();\r
150         fprintf(stderr,"Terminal Error: %s\n",s);\r
151         if (tedlevel)\r
152                 fprintf(stderr,"You launched from TED. I suggest that you reboot...\n");\r
153 \r
154         return(ABORT);\r
155 #undef  IGNORE\r
156 #undef  RETRY\r
157 #undef  ABORT\r
158 }\r
159 #pragma warn    +par\r
160 #pragma warn    +rch\r
161 \r
162 \r
163 ///////////////////////////////////////////////////////////////////////////\r
164 //\r
165 //      US_Startup() - Starts the User Mgr\r
166 //\r
167 ///////////////////////////////////////////////////////////////////////////\r
168 void\r
169 US_Startup(void)\r
170 {\r
171         int     i,n;\r
172 \r
173         if (US_Started)\r
174                 return;\r
175 \r
176         harderr(USL_HardError); // Install the fatal error handler\r
177 \r
178         US_InitRndT(true);              // Initialize the random number generator\r
179 \r
180         for (i = 1;i < _argc;i++)\r
181         {\r
182                 switch (US_CheckParm(_argv[i],ParmStrings2))\r
183                 {\r
184                 case 0:\r
185                         compatability = true;\r
186                         break;\r
187                 case 1:\r
188                         compatability = false;\r
189                         break;\r
190                 }\r
191         }\r
192 \r
193         // Check for TED launching here\r
194         for (i = 1;i < _argc;i++)\r
195         {\r
196                 n = US_CheckParm(_argv[i],ParmStrings);\r
197                 switch(n)\r
198                 {\r
199                  case 0:\r
200                    tedlevelnum = atoi(_argv[i + 1]);\r
201                    if (tedlevelnum >= 0)\r
202                      tedlevel = true;\r
203                    break;\r
204 \r
205                  case 1:\r
206                    NoWait = true;\r
207                    break;\r
208                 }\r
209         }\r
210 \r
211         US_Started = true;\r
212 }\r
213 \r
214 \r
215 ///////////////////////////////////////////////////////////////////////////\r
216 //\r
217 //      US_Shutdown() - Shuts down the User Mgr\r
218 //\r
219 ///////////////////////////////////////////////////////////////////////////\r
220 void\r
221 US_Shutdown(void)\r
222 {\r
223         if (!US_Started)\r
224                 return;\r
225 \r
226         US_Started = false;\r
227 }\r
228 \r
229 ///////////////////////////////////////////////////////////////////////////\r
230 //\r
231 //      US_CheckParm() - checks to see if a string matches one of a set of\r
232 //              strings. The check is case insensitive. The routine returns the\r
233 //              index of the string that matched, or -1 if no matches were found\r
234 //\r
235 ///////////////////////////////////////////////////////////////////////////\r
236 int\r
237 US_CheckParm(char *parm,char **strings)\r
238 {\r
239         char    cp,cs,\r
240                         *p,*s;\r
241         int             i;\r
242 \r
243         while (!isalpha(*parm)) // Skip non-alphas\r
244                 parm++;\r
245 \r
246         for (i = 0;*strings && **strings;i++)\r
247         {\r
248                 for (s = *strings++,p = parm,cs = cp = 0;cs == cp;)\r
249                 {\r
250                         cs = *s++;\r
251                         if (!cs)\r
252                                 return(i);\r
253                         cp = *p++;\r
254 \r
255                         if (isupper(cs))\r
256                                 cs = tolower(cs);\r
257                         if (isupper(cp))\r
258                                 cp = tolower(cp);\r
259                 }\r
260         }\r
261         return(-1);\r
262 }\r
263 \r
264 \r
265 //      Window/Printing routines\r
266 \r
267 ///////////////////////////////////////////////////////////////////////////\r
268 //\r
269 //      US_SetPrintRoutines() - Sets the routines used to measure and print\r
270 //              from within the User Mgr. Primarily provided to allow switching\r
271 //              between masked and non-masked fonts\r
272 //\r
273 ///////////////////////////////////////////////////////////////////////////\r
274 void\r
275 US_SetPrintRoutines(void (*measure)(char far *,word *,word *),void (*print)(char far *))\r
276 {\r
277         USL_MeasureString = measure;\r
278         USL_DrawString = print;\r
279 }\r
280 \r
281 ///////////////////////////////////////////////////////////////////////////\r
282 //\r
283 //      US_Print() - Prints a string in the current window. Newlines are\r
284 //              supported.\r
285 //\r
286 ///////////////////////////////////////////////////////////////////////////\r
287 void\r
288 US_Print(char far *s)\r
289 {\r
290         char    c,far *se;\r
291         word    w,h;\r
292 \r
293         while (*s)\r
294         {\r
295                 se = s;\r
296                 while ((c = *se) && (c != '\n'))\r
297                         se++;\r
298                 *se = '\0';\r
299 \r
300                 USL_MeasureString(s,&w,&h);\r
301                 px = PrintX;\r
302                 py = PrintY;\r
303                 USL_DrawString(s);\r
304 \r
305                 s = se;\r
306                 if (c)\r
307                 {\r
308                         *se = c;\r
309                         s++;\r
310 \r
311                         PrintX = WindowX;\r
312                         PrintY += h;\r
313                 }\r
314                 else\r
315                         PrintX += w;\r
316         }\r
317 }\r
318 \r
319 ///////////////////////////////////////////////////////////////////////////\r
320 //\r
321 //      US_PrintUnsigned() - Prints an unsigned long\r
322 //\r
323 ///////////////////////////////////////////////////////////////////////////\r
324 void\r
325 US_PrintUnsigned(longword n)\r
326 {\r
327         char    buffer[32];\r
328 \r
329         US_Print(ultoa(n,buffer,10));\r
330 }\r
331 \r
332 ///////////////////////////////////////////////////////////////////////////\r
333 //\r
334 //      US_PrintSigned() - Prints a signed long\r
335 //\r
336 ///////////////////////////////////////////////////////////////////////////\r
337 void\r
338 US_PrintSigned(long n)\r
339 {\r
340         char    buffer[32];\r
341 \r
342         US_Print(ltoa(n,buffer,10));\r
343 }\r
344 \r
345 ///////////////////////////////////////////////////////////////////////////\r
346 //\r
347 //      USL_PrintInCenter() - Prints a string in the center of the given rect\r
348 //\r
349 ///////////////////////////////////////////////////////////////////////////\r
350 void\r
351 USL_PrintInCenter(char far *s,Rect r)\r
352 {\r
353         word    w,h,\r
354                         rw,rh;\r
355 \r
356         USL_MeasureString(s,&w,&h);\r
357         rw = r.lr.x - r.ul.x;\r
358         rh = r.lr.y - r.ul.y;\r
359 \r
360         px = r.ul.x + ((rw - w) / 2);\r
361         py = r.ul.y + ((rh - h) / 2);\r
362         USL_DrawString(s);\r
363 }\r
364 \r
365 ///////////////////////////////////////////////////////////////////////////\r
366 //\r
367 //      US_PrintCentered() - Prints a string centered in the current window.\r
368 //\r
369 ///////////////////////////////////////////////////////////////////////////\r
370 void\r
371 US_PrintCentered(char far *s)\r
372 {\r
373         Rect    r;\r
374 \r
375         r.ul.x = WindowX;\r
376         r.ul.y = WindowY;\r
377         r.lr.x = r.ul.x + WindowW;\r
378         r.lr.y = r.ul.y + WindowH;\r
379 \r
380         USL_PrintInCenter(s,r);\r
381 }\r
382 \r
383 ///////////////////////////////////////////////////////////////////////////\r
384 //\r
385 //      US_CPrintLine() - Prints a string centered on the current line and\r
386 //              advances to the next line. Newlines are not supported.\r
387 //\r
388 ///////////////////////////////////////////////////////////////////////////\r
389 void\r
390 US_CPrintLine(char far *s)\r
391 {\r
392         word    w,h;\r
393 \r
394         USL_MeasureString(s,&w,&h);\r
395 \r
396         if (w > WindowW)\r
397                 Quit("US_CPrintLine() - String exceeds width");\r
398         px = WindowX + ((WindowW - w) / 2);\r
399         py = PrintY;\r
400         USL_DrawString(s);\r
401         PrintY += h;\r
402 }\r
403 \r
404 ///////////////////////////////////////////////////////////////////////////\r
405 //\r
406 //      US_CPrint() - Prints a string in the current window. Newlines are\r
407 //              supported.\r
408 //\r
409 ///////////////////////////////////////////////////////////////////////////\r
410 void\r
411 US_CPrint(char far *s)\r
412 {\r
413         char    c,far *se;\r
414 \r
415         while (*s)\r
416         {\r
417                 se = s;\r
418                 while ((c = *se) && (c != '\n'))\r
419                         se++;\r
420                 *se = '\0';\r
421 \r
422                 US_CPrintLine(s);\r
423 \r
424                 s = se;\r
425                 if (c)\r
426                 {\r
427                         *se = c;\r
428                         s++;\r
429                 }\r
430         }\r
431 }\r
432 \r
433 ///////////////////////////////////////////////////////////////////////////\r
434 //\r
435 //      US_ClearWindow() - Clears the current window to white and homes the\r
436 //              cursor\r
437 //\r
438 ///////////////////////////////////////////////////////////////////////////\r
439 void\r
440 US_ClearWindow(void)\r
441 {\r
442         VWB_Bar(WindowX,WindowY,WindowW,WindowH,WHITE);\r
443         PrintX = WindowX;\r
444         PrintY = WindowY;\r
445 }\r
446 \r
447 ///////////////////////////////////////////////////////////////////////////\r
448 //\r
449 //      US_DrawWindow() - Draws a frame and sets the current window parms\r
450 //\r
451 ///////////////////////////////////////////////////////////////////////////\r
452 void\r
453 US_DrawWindow(word x,word y,word w,word h)\r
454 {\r
455         word    i,\r
456                         sx,sy,sw,sh;\r
457 \r
458         WindowX = x * 8;\r
459         WindowY = y * 8;\r
460         WindowW = w * 8;\r
461         WindowH = h * 8;\r
462 \r
463         PrintX = WindowX;\r
464         PrintY = WindowY;\r
465 \r
466         sx = (x - 1) * 8;\r
467         sy = (y - 1) * 8;\r
468         sw = (w + 1) * 8;\r
469         sh = (h + 1) * 8;\r
470 \r
471         US_ClearWindow();\r
472 \r
473         VWB_DrawTile8(sx,sy,0),VWB_DrawTile8(sx,sy + sh,5);\r
474         for (i = sx + 8;i <= sx + sw - 8;i += 8)\r
475                 VWB_DrawTile8(i,sy,1),VWB_DrawTile8(i,sy + sh,6);\r
476         VWB_DrawTile8(i,sy,2),VWB_DrawTile8(i,sy + sh,7);\r
477 \r
478         for (i = sy + 8;i <= sy + sh - 8;i += 8)\r
479                 VWB_DrawTile8(sx,i,3),VWB_DrawTile8(sx + sw,i,4);\r
480 }\r
481 \r
482 ///////////////////////////////////////////////////////////////////////////\r
483 //\r
484 //      US_CenterWindow() - Generates a window of a given width & height in the\r
485 //              middle of the screen\r
486 //\r
487 ///////////////////////////////////////////////////////////////////////////\r
488 void\r
489 US_CenterWindow(word w,word h)\r
490 {\r
491         US_DrawWindow(((MaxX / 8) - w) / 2,((MaxY / 8) - h) / 2,w,h);\r
492 }\r
493 \r
494 ///////////////////////////////////////////////////////////////////////////\r
495 //\r
496 //      US_SaveWindow() - Saves the current window parms into a record for\r
497 //              later restoration\r
498 //\r
499 ///////////////////////////////////////////////////////////////////////////\r
500 void\r
501 US_SaveWindow(WindowRec *win)\r
502 {\r
503         win->x = WindowX;\r
504         win->y = WindowY;\r
505         win->w = WindowW;\r
506         win->h = WindowH;\r
507 \r
508         win->px = PrintX;\r
509         win->py = PrintY;\r
510 }\r
511 \r
512 ///////////////////////////////////////////////////////////////////////////\r
513 //\r
514 //      US_RestoreWindow() - Sets the current window parms to those held in the\r
515 //              record\r
516 //\r
517 ///////////////////////////////////////////////////////////////////////////\r
518 void\r
519 US_RestoreWindow(WindowRec *win)\r
520 {\r
521         WindowX = win->x;\r
522         WindowY = win->y;\r
523         WindowW = win->w;\r
524         WindowH = win->h;\r
525 \r
526         PrintX = win->px;\r
527         PrintY = win->py;\r
528 }\r
529 \r
530 //      Input routines\r
531 \r
532 ///////////////////////////////////////////////////////////////////////////\r
533 //\r
534 //      USL_XORICursor() - XORs the I-bar text cursor. Used by US_LineInput()\r
535 //\r
536 ///////////////////////////////////////////////////////////////////////////\r
537 static void\r
538 USL_XORICursor(int x,int y,char *s,word cursor)\r
539 {\r
540         static  boolean status;         // VGA doesn't XOR...\r
541         char    buf[MaxString];\r
542         int             temp;\r
543         word    w,h;\r
544 \r
545         strcpy(buf,s);\r
546         buf[cursor] = '\0';\r
547         USL_MeasureString(buf,&w,&h);\r
548 \r
549         px = x + w - 1;\r
550         py = y;\r
551         if (status^=1)\r
552                 USL_DrawString("\x80");\r
553         else\r
554         {\r
555                 temp = fontcolor;\r
556                 fontcolor = backcolor;\r
557                 USL_DrawString("\x80");\r
558                 fontcolor = temp;\r
559         }\r
560 \r
561 }\r
562 \r
563 ///////////////////////////////////////////////////////////////////////////\r
564 //\r
565 //      US_LineInput() - Gets a line of user input at (x,y), the string defaults\r
566 //              to whatever is pointed at by def. Input is restricted to maxchars\r
567 //              chars or maxwidth pixels wide. If the user hits escape (and escok is\r
568 //              true), nothing is copied into buf, and false is returned. If the\r
569 //              user hits return, the current string is copied into buf, and true is\r
570 //              returned\r
571 //\r
572 ///////////////////////////////////////////////////////////////////////////\r
573 boolean\r
574 US_LineInput(int x,int y,char *buf,char *def,boolean escok,\r
575                                 int maxchars,int maxwidth)\r
576 {\r
577         boolean         redraw,\r
578                                 cursorvis,cursormoved,\r
579                                 done,result;\r
580         ScanCode        sc;\r
581         char            c,\r
582                                 s[MaxString],olds[MaxString];\r
583         word            i,\r
584                                 cursor,\r
585                                 w,h,\r
586                                 len,temp;\r
587         longword        lasttime;\r
588 \r
589         if (def)\r
590                 strcpy(s,def);\r
591         else\r
592                 *s = '\0';\r
593         *olds = '\0';\r
594         cursor = strlen(s);\r
595         cursormoved = redraw = true;\r
596 \r
597         cursorvis = done = false;\r
598         lasttime = TimeCount;\r
599         LastASCII = key_None;\r
600         LastScan = sc_None;\r
601 \r
602         while (!done)\r
603         {\r
604                 if (cursorvis)\r
605                         USL_XORICursor(x,y,s,cursor);\r
606 \r
607         asm     pushf\r
608         asm     cli\r
609 \r
610                 sc = LastScan;\r
611                 LastScan = sc_None;\r
612                 c = LastASCII;\r
613                 LastASCII = key_None;\r
614 \r
615         asm     popf\r
616 \r
617                 switch (sc)\r
618                 {\r
619                 case sc_LeftArrow:\r
620                         if (cursor)\r
621                                 cursor--;\r
622                         c = key_None;\r
623                         cursormoved = true;\r
624                         break;\r
625                 case sc_RightArrow:\r
626                         if (s[cursor])\r
627                                 cursor++;\r
628                         c = key_None;\r
629                         cursormoved = true;\r
630                         break;\r
631                 case sc_Home:\r
632                         cursor = 0;\r
633                         c = key_None;\r
634                         cursormoved = true;\r
635                         break;\r
636                 case sc_End:\r
637                         cursor = strlen(s);\r
638                         c = key_None;\r
639                         cursormoved = true;\r
640                         break;\r
641 \r
642                 case sc_Return:\r
643                         strcpy(buf,s);\r
644                         done = true;\r
645                         result = true;\r
646                         c = key_None;\r
647                         break;\r
648                 case sc_Escape:\r
649                         if (escok)\r
650                         {\r
651                                 done = true;\r
652                                 result = false;\r
653                         }\r
654                         c = key_None;\r
655                         break;\r
656 \r
657                 case sc_BackSpace:\r
658                         if (cursor)\r
659                         {\r
660                                 strcpy(s + cursor - 1,s + cursor);\r
661                                 cursor--;\r
662                                 redraw = true;\r
663                         }\r
664                         c = key_None;\r
665                         cursormoved = true;\r
666                         break;\r
667                 case sc_Delete:\r
668                         if (s[cursor])\r
669                         {\r
670                                 strcpy(s + cursor,s + cursor + 1);\r
671                                 redraw = true;\r
672                         }\r
673                         c = key_None;\r
674                         cursormoved = true;\r
675                         break;\r
676 \r
677                 case 0x4c:      // Keypad 5\r
678                 case sc_UpArrow:\r
679                 case sc_DownArrow:\r
680                 case sc_PgUp:\r
681                 case sc_PgDn:\r
682                 case sc_Insert:\r
683                         c = key_None;\r
684                         break;\r
685                 }\r
686 \r
687                 if (c)\r
688                 {\r
689                         len = strlen(s);\r
690                         USL_MeasureString(s,&w,&h);\r
691 \r
692                         if\r
693                         (\r
694                                 isprint(c)\r
695                         &&      (len < MaxString - 1)\r
696                         &&      ((!maxchars) || (len < maxchars))\r
697                         &&      ((!maxwidth) || (w < maxwidth))\r
698                         )\r
699                         {\r
700                                 for (i = len + 1;i > cursor;i--)\r
701                                         s[i] = s[i - 1];\r
702                                 s[cursor++] = c;\r
703                                 redraw = true;\r
704                         }\r
705                 }\r
706 \r
707                 if (redraw)\r
708                 {\r
709                         px = x;\r
710                         py = y;\r
711                         temp = fontcolor;\r
712                         fontcolor = backcolor;\r
713                         USL_DrawString(olds);\r
714                         fontcolor = temp;\r
715                         strcpy(olds,s);\r
716 \r
717                         px = x;\r
718                         py = y;\r
719                         USL_DrawString(s);\r
720 \r
721                         redraw = false;\r
722                 }\r
723 \r
724                 if (cursormoved)\r
725                 {\r
726                         cursorvis = false;\r
727                         lasttime = TimeCount - TickBase;\r
728 \r
729                         cursormoved = false;\r
730                 }\r
731                 if (TimeCount - lasttime > TickBase / 2)\r
732                 {\r
733                         lasttime = TimeCount;\r
734 \r
735                         cursorvis ^= true;\r
736                 }\r
737                 if (cursorvis)\r
738                         USL_XORICursor(x,y,s,cursor);\r
739 \r
740                 VW_UpdateScreen();\r
741         }\r
742 \r
743         if (cursorvis)\r
744                 USL_XORICursor(x,y,s,cursor);\r
745         if (!result)\r
746         {\r
747                 px = x;\r
748                 py = y;\r
749                 USL_DrawString(olds);\r
750         }\r
751         VW_UpdateScreen();\r
752 \r
753         IN_ClearKeysDown();\r
754         return(result);\r
755 }\r