]> 4ch.mooo.com Git - 16.git/blob - 16/cawat/16_us.c
modified: 16.LIB
[16.git] / 16 / cawat / 16_us.c
1 /* Catacomb Armageddon Source Code\r
2  * Copyright (C) 1993-2014 Flat Rock Software\r
3  *\r
4  * This program is free software; you can redistribute it and/or modify\r
5  * it under the terms of the GNU General Public License as published by\r
6  * the Free Software Foundation; either version 2 of the License, or\r
7  * (at your option) any later version.\r
8  *\r
9  * This program is distributed in the hope that it will be useful,\r
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
12  * GNU General Public License for more details.\r
13  *\r
14  * You should have received a copy of the GNU General Public License along\r
15  * with this program; if not, write to the Free Software Foundation, Inc.,\r
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
17  */\r
18 \r
19 //\r
20 //      ID Engine\r
21 //      ID_US.c - User Manager\r
22 //      v1.0d1\r
23 //      By Jason Blochowiak\r
24 //\r
25 \r
26 //\r
27 //      This module handles dealing with user input & feedback\r
28 //\r
29 //      Depends on: Input Mgr, View Mgr, some variables from the Sound, Caching,\r
30 //              and Refresh Mgrs, Memory Mgr for background save/restore\r
31 //\r
32 //      Globals:\r
33 //              ingame - Flag set by game indicating if a game is in progress\r
34 //      abortgame - Flag set if the current game should be aborted (if a load\r
35 //                      game fails)\r
36 //              loadedgame - Flag set if a game was loaded\r
37 //              abortprogram - Normally nil, this points to a terminal error message\r
38 //                      if the program needs to abort\r
39 //              restartgame - Normally set to gd_Continue, this is set to one of the\r
40 //                      difficulty levels if a new game should be started\r
41 //              PrintX, PrintY - Where the User Mgr will print (global coords)\r
42 //              WindowX,WindowY,WindowW,WindowH - The dimensions of the current\r
43 //                      window\r
44 //\r
45 \r
46 // DEBUG - handle LPT3 for Sound Source\r
47 \r
48 #include "16_us.h"\r
49 \r
50 ///////////////////////////////////////////////////////////////////////////\r
51 //\r
52 //      US_CheckParm() - checks to see if a string matches one of a set of\r
53 //              strings. The check is case insensitive. The routine returns the\r
54 //              index of the string that matched, or -1 if no matches were found\r
55 //\r
56 ///////////////////////////////////////////////////////////////////////////\r
57 int\r
58 US_CheckParm(char *parm,char **strings)\r
59 {\r
60         char    cp,cs,\r
61                         *p,*s;\r
62         int             i;\r
63 \r
64         while (!isalpha(*parm)) // Skip non-alphas\r
65                 parm++;\r
66 \r
67         for (i = 0;*strings && **strings;i++)\r
68         {\r
69                 for (s = *strings++,p = parm,cs = cp = 0;cs == cp;)\r
70                 {\r
71                         cs = *s++;\r
72                         if (!cs)\r
73                                 return(i);\r
74                         cp = *p++;\r
75 \r
76                         if (isupper(cs))\r
77                                 cs = tolower(cs);\r
78                         if (isupper(cp))\r
79                                 cp = tolower(cp);\r
80                 }\r
81         }\r
82         return(-1);\r
83 }\r