Rev 5046 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5 | Plagman | 1 | //------------------------------------------------------------------------- |
2 | /* |
||
1652 | terminx | 3 | Copyright (C) 2010 EDuke32 developers and contributors |
5 | Plagman | 4 | |
1652 | terminx | 5 | This file is part of EDuke32. |
5 | Plagman | 6 | |
7 | EDuke32 is free software; you can redistribute it and/or |
||
8 | modify it under the terms of the GNU General Public License version 2 |
||
9 | as published by the Free Software Foundation. |
||
10 | |||
11 | This program is distributed in the hope that it will be useful, |
||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
14 | |||
15 | See the GNU General Public License for more details. |
||
16 | |||
17 | You should have received a copy of the GNU General Public License |
||
18 | along with this program; if not, write to the Free Software |
||
4541 | hendricks2 | 19 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
5 | Plagman | 20 | */ |
21 | //------------------------------------------------------------------------- |
||
22 | |||
23 | #include "duke3d.h" |
||
2296 | helixhorne | 24 | #include "namesdyn.h" |
5 | Plagman | 25 | #include "gamedef.h" |
1677 | terminx | 26 | #include "gameexec.h" |
1950 | helixhorne | 27 | #include "savegame.h" |
2561 | helixhorne | 28 | #include "common.h" |
2726 | hendricks2 | 29 | #include "common_game.h" |
5 | Plagman | 30 | |
31 | #include "osd.h" |
||
32 | |||
1492 | terminx | 33 | #ifdef _WIN32 |
34 | #define WIN32_LEAN_AND_MEAN |
||
35 | #include <windows.h> |
||
36 | #include <shellapi.h> |
||
37 | #endif |
||
38 | |||
4385 | terminx | 39 | #define NUMKEYWORDS (int32_t)ARRAY_SIZE(keyw) |
1708 | helixhorne | 40 | |
1205 | terminx | 41 | int32_t g_scriptVersion = 13; // 13 = 1.3D-style CON files, 14 = 1.4/1.5 style CON files |
1708 | helixhorne | 42 | uint32_t g_scriptDateVersion = 99999999; // YYYYMMDD |
3415 | helixhorne | 43 | #if !defined LUNATIC |
1708 | helixhorne | 44 | static uint32_t g_scriptLastKeyword; // = NUMKEYWORDS-1; |
5 | Plagman | 45 | |
4385 | terminx | 46 | #define NUMKEYWDATES (int32_t)ARRAY_SIZE(g_keywdate) |
1708 | helixhorne | 47 | // { keyw, date } means that at the date, all keywords up to keyw inclusive are available |
48 | static struct { uint32_t keyw; uint32_t date; } g_keywdate[] = |
||
49 | { |
||
50 | // beginning of eduke32 svn |
||
51 | { CON_CANSEE, 20060423 }, |
||
52 | { CON_CANSEESPR, 20060424 }, |
||
53 | // some stuff here not representable this way |
||
54 | { CON_FINDNEARSPRITEZVAR, 20060516 }, |
||
55 | { CON_EZSHOOT, 20060701 }, |
||
56 | { CON_EZSHOOTVAR, 20060822 }, |
||
57 | { CON_JUMP, 20060828 }, |
||
58 | { CON_QSTRLEN, 20060930 }, |
||
59 | { CON_QUAKE, 20070105 }, |
||
60 | { CON_SHOWVIEW, 20070208 }, |
||
61 | { CON_NEXTSPRITESECT, 20070819 }, |
||
62 | { CON_GETKEYNAME, 20071024 }, // keyw numbers have been |
||
63 | { CON_SPRITENOPAL, 20071220 }, // shuffled around here |
||
64 | { CON_HITRADIUSVAR, 20080216 }, |
||
65 | { CON_ROTATESPRITE16, 20080314 }, |
||
66 | { CON_SETARRAY, 20080401 }, |
||
67 | { CON_READARRAYFROMFILE, 20080405 }, |
||
68 | { CON_STARTTRACKVAR, 20080510 }, |
||
69 | { CON_QGETSYSSTR, 20080709 }, |
||
70 | { CON_GETTICKS, 20080711 }, |
||
71 | { CON_SETTSPR, 20080713 }, |
||
72 | { CON_CLEARMAPSTATE, 20080716 }, |
||
73 | { CON_SCRIPTSIZE, 20080720 }, |
||
74 | { CON_SETGAMENAME, 20080722 }, |
||
75 | { CON_CMENU, 20080725 }, |
||
76 | { CON_GETTIMEDATE, 20080809 }, |
||
77 | { CON_ACTIVATECHEAT, 20080810 }, |
||
78 | { CON_SETGAMEPALETTE, 20080816 }, |
||
79 | { CON_SETCFGNAME, 20080817 }, |
||
80 | { CON_IFVARVAREITHER, 20080907 }, |
||
81 | { CON_SAVENN, 20080915 }, |
||
82 | { CON_COPY, 20090219 }, |
||
83 | // { CON_INV, 20090619 }, |
||
84 | { CON_QSTRNCAT, 20090712 }, |
||
85 | { CON_STOPACTORSOUND, 20090715 }, |
||
86 | { CON_IFSERVER, 20100722 }, |
||
87 | { CON_CALCHYPOTENUSE, 20100927 }, |
||
1712 | helixhorne | 88 | { CON_CLIPMOVENOSLIDE, 20101009 }, |
1909 | terminx | 89 | { CON_INCLUDEDEFAULT, 20110615 }, |
2104 | helixhorne | 90 | { CON_SETACTORSOUNDPITCH, 20111102 }, |
2419 | hendricks2 | 91 | { CON_ECHO, 20120304 }, |
2573 | helixhorne | 92 | { CON_SHOWVIEWUNBIASED, 20120331 }, |
3610 | hendricks2 | 93 | { CON_ROTATESPRITEA, 20130324 }, |
3803 | terminx | 94 | { CON_ACTIVATE, 20130522 }, |
3833 | hendricks2 | 95 | { CON_SCREENTEXT, 20130529 }, |
3834 | hendricks2 | 96 | { CON_DYNAMICSOUNDREMAP, 20130530 }, |
3912 | helixhorne | 97 | { CON_SCREENSOUND, 20130628 }, |
5022 | helixhorne | 98 | { CON_SETMUSICPOSITION, 20150116 }, |
99 | { CON_UNDEFINELEVEL, 20150208 }, |
||
100 | { CON_IFCUTSCENE, 20150210 }, |
||
5033 | hendricks2 | 101 | { CON_DEFINEVOLUMEFLAGS, 20150222 }, |
5039 | hendricks2 | 102 | { CON_RESETPLAYERFLAGS, 20150303 }, |
1708 | helixhorne | 103 | }; |
3415 | helixhorne | 104 | #endif |
1708 | helixhorne | 105 | |
1143 | terminx | 106 | char g_szScriptFileName[BMAX_PATH] = "(none)"; // file we're currently compiling |
107 | |||
1205 | terminx | 108 | int32_t g_totalLines,g_lineNumber; |
5 | Plagman | 109 | char g_szBuf[1024]; |
110 | |||
3410 | helixhorne | 111 | #if !defined LUNATIC |
3826 | helixhorne | 112 | static char g_szCurrentBlockName[256] = "(none)", g_szLastBlockName[256] = "NULL"; |
113 | static int32_t g_checkingIfElse, g_processingState, g_lastKeyword = -1; |
||
114 | |||
3373 | helixhorne | 115 | // The pointer to the start of the case table in a switch statement. |
116 | // First entry is 'default' code. |
||
117 | static intptr_t *g_caseScriptPtr=NULL; |
||
1228 | terminx | 118 | static intptr_t *previous_event=NULL; |
1205 | terminx | 119 | static int32_t g_numCases = 0; |
120 | static int32_t g_checkingSwitch = 0, g_currentEvent = -1; |
||
3834 | hendricks2 | 121 | static int32_t g_labelsOnly = 0, g_skipKeywordCheck = 0, g_dynamicTileMapping = 0, g_dynamicSoundMapping = 0; |
1205 | terminx | 122 | static int32_t g_numBraces = 0; |
5 | Plagman | 123 | |
1857 | terminx | 124 | static int32_t C_ParseCommand(int32_t loop); |
1361 | terminx | 125 | static int32_t C_SetScriptSize(int32_t size); |
3373 | helixhorne | 126 | #endif |
874 | terminx | 127 | |
1205 | terminx | 128 | int32_t g_numQuoteRedefinitions = 0; |
5 | Plagman | 129 | |
3328 | helixhorne | 130 | #ifdef LUNATIC |
131 | weapondata_t g_playerWeapon[MAXPLAYERS][MAX_WEAPONS]; |
||
132 | #endif |
||
5 | Plagman | 133 | |
3826 | helixhorne | 134 | #if !defined LUNATIC |
1200 | terminx | 135 | static intptr_t *g_parsingEventPtr=NULL; |
3826 | helixhorne | 136 | static char *textptr; |
3415 | helixhorne | 137 | #endif |
5 | Plagman | 138 | |
1205 | terminx | 139 | int32_t g_numCompilerErrors,g_numCompilerWarnings; |
432 | terminx | 140 | |
1465 | terminx | 141 | extern int32_t g_maxSoundPos; |
142 | |||
1857 | terminx | 143 | enum |
335 | terminx | 144 | { |
255 | terminx | 145 | LABEL_ANY = -1, |
146 | LABEL_DEFINE = 1, |
||
147 | LABEL_STATE = 2, |
||
148 | LABEL_ACTOR = 4, |
||
149 | LABEL_ACTION = 8, |
||
150 | LABEL_AI = 16, |
||
151 | LABEL_MOVE = 32, |
||
5 | Plagman | 152 | }; |
153 | |||
3410 | helixhorne | 154 | #if !defined LUNATIC |
1205 | terminx | 155 | static const char *C_GetLabelType(int32_t type) |
5 | Plagman | 156 | { |
1205 | terminx | 157 | int32_t i; |
5 | Plagman | 158 | char x[64]; |
159 | |||
1857 | terminx | 160 | const char *LabelTypeText[] = |
161 | { |
||
162 | "define", |
||
163 | "state", |
||
164 | "actor", |
||
165 | "action", |
||
166 | "ai", |
||
167 | "move" |
||
168 | }; |
||
169 | |||
5 | Plagman | 170 | x[0] = 0; |
1229 | terminx | 171 | for (i=0; i<6; i++) |
335 | terminx | 172 | { |
5 | Plagman | 173 | if (!(type & (1<<i))) continue; |
174 | if (x[0]) Bstrcat(x, " or "); |
||
1143 | terminx | 175 | Bstrcat(x, LabelTypeText[i]); |
5 | Plagman | 176 | } |
4491 | helixhorne | 177 | |
178 | return Xstrdup(x); |
||
5 | Plagman | 179 | } |
180 | |||
181 | |||
967 | terminx | 182 | const char *keyw[] = |
559 | terminx | 183 | { |
184 | "definelevelname", // 0 defines level name |
||
185 | "actor", // 1 defines an actor |
||
186 | "addammo", // 2 adds ammo to a weapon |
||
187 | "ifrnd", // 3 checks against a randomizer |
||
188 | "enda", // 4 ends an actor definition |
||
189 | "ifcansee", // 5 checks if the player can see an object |
||
190 | "ifhitweapon", // 6 checks if an object was hit by a weapon |
||
191 | "action", // 7 defines an action if used outside a state or actor, otherwise triggers actor to perform action |
||
192 | "ifpdistl", // 8 checks if player distance is less than value |
||
193 | "ifpdistg", // 9 checks if player distance is more than value |
||
194 | "else", // 10 used with if checks |
||
195 | "strength", // 11 sets health |
||
196 | "break", // 12 stops processing |
||
197 | "shoot", // 13 shoots a projectile |
||
1625 | terminx | 198 | "palfrom", // 14 used for player screen shading effect, sets p->pals |
559 | terminx | 199 | "sound", // 15 plays a sound that was defined with definesound |
200 | "fall", // 16 causes actor to fall to sector floor height |
||
201 | "state", // 17 begins defining a state if used outside a state or actor, otherwise calls a state |
||
202 | "ends", // 18 ends defining a state |
||
203 | "define", // 19 defines a value |
||
1203 | terminx | 204 | "return", // 20 |
559 | terminx | 205 | "ifai", // 21 checks if actor is currently performing a specific ai function |
206 | "killit", // 22 kills an actor |
||
207 | "addweapon", // 23 adds a weapon to the closest player |
||
208 | "ai", // 24 sets an ai function to be used by an actor |
||
209 | "addphealth", // 25 adds health to the player |
||
210 | "ifdead", // 26 checks if actor is dead |
||
211 | "ifsquished", // 27 checks if actor has been squished |
||
212 | "sizeto", // 28 gradually increases actor size until it matches parameters given |
||
213 | "{", // 29 used to indicate segments of code |
||
214 | "}", // 30 used to indicate segments of code |
||
215 | "spawn", // 31 spawns an actor |
||
216 | "move", // 32 |
||
217 | "ifwasweapon", // 33 |
||
218 | "ifaction", // 34 |
||
219 | "ifactioncount", // 35 |
||
220 | "resetactioncount", // 36 |
||
221 | "debris", // 37 |
||
222 | "pstomp", // 38 |
||
223 | "<null>", // 39 was previously used to define the start of a comment block |
||
224 | "cstat", // 40 |
||
225 | "ifmove", // 41 |
||
226 | "resetplayer", // 42 |
||
227 | "ifonwater", // 43 |
||
228 | "ifinwater", // 44 |
||
229 | "ifcanshoottarget", // 45 |
||
230 | "ifcount", // 46 |
||
231 | "resetcount", // 47 |
||
232 | "addinventory", // 48 |
||
233 | "ifactornotstayput", // 49 |
||
234 | "hitradius", // 50 |
||
235 | "ifp", // 51 |
||
236 | "count", // 52 |
||
237 | "ifactor", // 53 |
||
238 | "music", // 54 |
||
239 | "include", // 55 |
||
240 | "ifstrength", // 56 |
||
241 | "definesound", // 57 |
||
242 | "guts", // 58 |
||
243 | "ifspawnedby", // 59 |
||
244 | "gamestartup", // 60 |
||
245 | "wackplayer", // 61 |
||
246 | "ifgapzl", // 62 |
||
247 | "ifhitspace", // 63 |
||
248 | "ifoutside", // 64 |
||
249 | "ifmultiplayer", // 65 |
||
250 | "operate", // 66 |
||
251 | "ifinspace", // 67 |
||
252 | "debug", // 68 |
||
253 | "endofgame", // 69 |
||
254 | "ifbulletnear", // 70 |
||
255 | "ifrespawn", // 71 |
||
256 | "iffloordistl", // 72 |
||
257 | "ifceilingdistl", // 73 |
||
258 | "spritepal", // 74 |
||
259 | "ifpinventory", // 75 |
||
260 | "betaname", // 76 |
||
261 | "cactor", // 77 |
||
262 | "ifphealthl", // 78 |
||
263 | "definequote", // 79 |
||
264 | "quote", // 80 |
||
265 | "ifinouterspace", // 81 |
||
266 | "ifnotmoving", // 82 |
||
267 | "respawnhitag", // 83 |
||
268 | "tip", // 84 |
||
269 | "ifspritepal", // 85 |
||
270 | "money", // 86 |
||
271 | "soundonce", // 87 |
||
272 | "addkills", // 88 |
||
273 | "stopsound", // 89 |
||
274 | "ifawayfromwall", // 90 |
||
275 | "ifcanseetarget", // 91 |
||
276 | "globalsound", // 92 |
||
277 | "lotsofglass", // 93 |
||
278 | "ifgotweaponce", // 94 |
||
279 | "getlastpal", // 95 |
||
280 | "pkick", // 96 |
||
281 | "mikesnd", // 97 |
||
282 | "useractor", // 98 |
||
283 | "sizeat", // 99 |
||
284 | "addstrength", // 100 [#] |
||
285 | "cstator", // 101 |
||
286 | "mail", // 102 |
||
287 | "paper", // 103 |
||
288 | "tossweapon", // 104 |
||
289 | "sleeptime", // 105 |
||
290 | "nullop", // 106 |
||
291 | "definevolumename", // 107 |
||
292 | "defineskillname", // 108 |
||
293 | "ifnosounds", // 109 |
||
294 | "clipdist", // 110 |
||
2695 | helixhorne | 295 | "ifangdiffl", // 111 Last Duke3D 1.5 CON command |
559 | terminx | 296 | "gamevar", // 112 |
297 | "ifvarl", // 113 |
||
298 | "ifvarg", // 114 |
||
299 | "setvarvar", // 115 |
||
300 | "setvar", // 116 |
||
301 | "addvarvar", // 117 |
||
302 | "addvar", // 118 |
||
303 | "ifvarvarl", // 119 |
||
304 | "ifvarvarg", // 120 |
||
305 | "addlogvar", // 121 |
||
306 | "addlog", // 122 |
||
307 | "onevent", // 123 |
||
308 | "endevent", // 124 |
||
309 | "ifvare", // 125 |
||
310 | "ifvarvare", // 126 |
||
311 | "spgetlotag", // 127 |
||
312 | "spgethitag", // 128 |
||
313 | "sectgetlotag", // 129 |
||
314 | "sectgethitag", // 130 |
||
315 | "ifsound", // 131 |
||
316 | "gettexturefloor", // 132 |
||
317 | "gettextureceiling", // 133 |
||
318 | "inittimer", // 134 |
||
319 | "starttrack", // 135 |
||
320 | "randvar", // 136 |
||
321 | "enhanced", // 137 |
||
322 | "getangletotarget", // 138 |
||
323 | "getactorangle", // 139 |
||
324 | "setactorangle", // 140 |
||
325 | "mulvar", // 141 |
||
326 | "mulvarvar", // 142 |
||
327 | "divvar", // 143 |
||
328 | "divvarvar", // 144 |
||
329 | "modvar", // 145 |
||
330 | "modvarvar", // 146 |
||
331 | "andvar", // 147 |
||
332 | "andvarvar", // 148 |
||
333 | "orvar", // 149 |
||
334 | "orvarvar", // 150 |
||
335 | "getplayerangle", // 151 |
||
336 | "setplayerangle", // 152 |
||
337 | "lockplayer", // 153 |
||
338 | "setsector", // 154 |
||
339 | "getsector", // 155 |
||
340 | "setactor", // 156 |
||
341 | "getactor", // 157 |
||
342 | "setwall", // 158 |
||
343 | "getwall", // 159 |
||
344 | "findnearactor", // 160 |
||
345 | "findnearactorvar", // 161 |
||
346 | "setactorvar", // 162 |
||
347 | "getactorvar", // 163 |
||
348 | "espawn", // 164 |
||
349 | "getplayer", // 165 |
||
350 | "setplayer", // 166 |
||
351 | "sqrt", // 167 |
||
352 | "eventloadactor", // 168 |
||
353 | "espawnvar", // 169 |
||
354 | "getuserdef", // 170 |
||
355 | "setuserdef", // 171 |
||
356 | "subvarvar", // 172 |
||
357 | "subvar", // 173 |
||
358 | "ifvarn", // 174 |
||
359 | "ifvarvarn", // 175 |
||
360 | "ifvarand", // 176 |
||
361 | "ifvarvarand", // 177 |
||
362 | "myos", // 178 |
||
363 | "myospal", // 179 |
||
364 | "displayrand", // 180 |
||
365 | "sin", // 181 |
||
366 | "xorvarvar", // 182 |
||
367 | "xorvar", // 183 |
||
368 | "randvarvar", // 184 |
||
369 | "myosx", // 185 |
||
370 | "myospalx", // 186 |
||
371 | "gmaxammo", // 187 |
||
372 | "smaxammo", // 188 |
||
373 | "startlevel", // 189 |
||
374 | "eshoot", // 190 |
||
375 | "qspawn", // 191 |
||
376 | "rotatesprite", // 192 |
||
377 | "defineprojectile", // 193 |
||
378 | "spriteshadow", // 194 |
||
379 | "cos", // 195 |
||
380 | "eshootvar", // 196 |
||
381 | "findnearactor3d", // 197 |
||
382 | "findnearactor3dvar", // 198 |
||
383 | "flash", // 199 |
||
384 | "qspawnvar", // 200 |
||
385 | "eqspawn", // 201 |
||
386 | "eqspawnvar", // 202 |
||
387 | "minitext", // 203 |
||
388 | "gametext", // 204 |
||
389 | "digitalnumber", // 205 |
||
390 | "addweaponvar", // 206 |
||
391 | "setprojectile", // 207 |
||
392 | "angoff", // 208 |
||
393 | "updatesector", // 209 |
||
394 | "insertspriteq", // 210 |
||
395 | "angoffvar", // 211 |
||
396 | "whilevarn", // 212 |
||
397 | "switch", // 213 |
||
398 | "case", // 214 |
||
399 | "default", // 215 |
||
400 | "endswitch", // 216 |
||
401 | "shootvar", // 217 |
||
402 | "soundvar", // 218 |
||
403 | "findplayer", // 219 |
||
404 | "findotherplayer", // 220 |
||
405 | "activatebysector", // 221 sectnum, spriteid |
||
406 | "operatesectors", // 222 sectnum, spriteid |
||
407 | "operaterespawns", // 223 lotag |
||
408 | "operateactivators", // 224 lotag, player index |
||
409 | "operatemasterswitches", // 225 lotag |
||
410 | "checkactivatormotion", // 226 lotag |
||
411 | "zshoot", // 227 zvar projnum |
||
412 | "dist", // 228 sprite1 sprite2 |
||
413 | "ldist", // 229 sprite1 sprite2 |
||
414 | "shiftvarl", // 230 |
||
415 | "shiftvarr", // 231 |
||
416 | "spritenvg", // 232 |
||
417 | "getangle", // 233 |
||
418 | "whilevarvarn", // 234 |
||
419 | "hitscan", // 235 |
||
420 | "time", // 236 |
||
421 | "getplayervar", // 237 |
||
422 | "setplayervar", // 238 |
||
423 | "mulscale", // 239 |
||
424 | "setaspect", // 240 |
||
425 | "ezshoot", // 241 |
||
426 | "spritenoshade", // 242 |
||
427 | "movesprite", // 243 |
||
428 | "checkavailweapon", // 244 |
||
429 | "soundoncevar", // 245 |
||
430 | "updatesectorz", // 246 |
||
431 | "stopallsounds", // 247 |
||
432 | "ssp", // 248 |
||
433 | "stopsoundvar", // 249 |
||
434 | "displayrandvar", // 250 |
||
435 | "displayrandvarvar", // 251 |
||
436 | "checkavailinven", // 252 |
||
437 | "globalsoundvar", // 253 |
||
438 | "guniqhudid", // 254 |
||
439 | "getprojectile", // 255 |
||
440 | "getthisprojectile", // 256 |
||
441 | "setthisprojectile", // 257 |
||
442 | "definecheat", // 258 |
||
443 | "cheatkeys", // 259 |
||
444 | "userquote", // 260 |
||
445 | "precache", // 261 |
||
446 | "definegamefuncname", // 262 |
||
447 | "redefinequote", // 263 |
||
448 | "qsprintf", // 264 |
||
449 | "getpname", // 265 |
||
450 | "qstrcat", // 266 |
||
451 | "qstrcpy", // 267 |
||
452 | "setsprite", // 268 |
||
453 | "rotatepoint", // 269 |
||
454 | "dragpoint", // 270 |
||
455 | "getzrange", // 271 |
||
456 | "changespritestat", // 272 |
||
457 | "getceilzofslope", // 273 |
||
458 | "getflorzofslope", // 274 |
||
459 | "neartag", // 275 |
||
460 | "definegametype", // 276 |
||
461 | "changespritesect", // 277 |
||
462 | "spriteflags", // 278 |
||
463 | "savegamevar", // 279 |
||
464 | "readgamevar", // 280 |
||
465 | "findnearsprite", // 281 |
||
466 | "findnearspritevar", // 282 |
||
467 | "findnearsprite3d", // 283 |
||
468 | "findnearsprite3dvar", // 284 |
||
469 | "dynamicremap", // 285 |
||
470 | "setinput", // 286 |
||
471 | "getinput", // 287 |
||
955 | hnt_ts | 472 | "save", // 288 |
2695 | helixhorne | 473 | "cansee", // 289 Beginning EDuke32 SVN |
559 | terminx | 474 | "canseespr", // 290 |
475 | "findnearactorz", // 291 |
||
476 | "findnearactorzvar", // 292 |
||
477 | "findnearspritez", // 293 |
||
478 | "findnearspritezvar", // 294 |
||
955 | hnt_ts | 479 | "zshootvar", // 295 |
480 | "ezshootvar", // 296 |
||
481 | "getcurraddress", // 297 |
||
482 | "jump", // 298 |
||
483 | "qstrlen", // 299 |
||
559 | terminx | 484 | "getincangle", // 300 |
485 | "quake", // 301 |
||
486 | "showview", // 302 |
||
487 | "headspritestat", // 303 |
||
488 | "prevspritestat", // 304 |
||
489 | "nextspritestat", // 305 |
||
490 | "headspritesect", // 306 |
||
491 | "prevspritesect", // 307 |
||
492 | "nextspritesect", // 308 |
||
587 | terminx | 493 | "getkeyname", // 309 |
494 | "qsubstr", // 310 |
||
495 | "gametextz", // 311 |
||
496 | "digitalnumberz", // 312 |
||
497 | "spritenopal", // 313 |
||
617 | terminx | 498 | "hitradiusvar", // 314 |
642 | terminx | 499 | "rotatesprite16", // 315 |
676 | terminx | 500 | "gamearray", // 316 |
501 | "setarray", // 317 |
||
693 | terminx | 502 | "resizearray", // 318 |
503 | "writearraytofile", // 319 |
||
504 | "readarrayfromfile", // 320 |
||
955 | hnt_ts | 505 | "starttrackvar", // 321 |
506 | "qgetsysstr", // 322 |
||
507 | "getticks", // 323 |
||
856 | terminx | 508 | "gettspr", // 324 |
509 | "settspr", // 325 |
||
859 | terminx | 510 | "savemapstate", // 326 |
511 | "loadmapstate", // 327 |
||
512 | "clearmapstate", // 328 |
||
874 | terminx | 513 | "scriptsize", // 329 |
987 | terminx | 514 | "setgamename", // 330 |
903 | hnt_ts | 515 | "cmenu", // 331 |
958 | hnt_ts | 516 | "gettimedate", // 332 |
964 | hnt_ts | 517 | "activatecheat", // 333 |
980 | hnt_ts | 518 | "setgamepalette", // 334 |
984 | terminx | 519 | "setdefname", // 335 |
986 | terminx | 520 | "setcfgname", // 336 |
1060 | hnt_ts | 521 | "ifvaror", // 337 |
522 | "ifvarvaror", // 338 |
||
523 | "ifvarxor", // 339 |
||
524 | "ifvarvarxor", // 340 |
||
525 | "ifvareither", // 341 |
||
526 | "ifvarvareither", // 342 |
||
1068 | terminx | 527 | "getarraysize", // 343 |
528 | "savenn", // 344 |
||
1228 | terminx | 529 | "copy", // 345 |
1436 | terminx | 530 | "<null>", // 346 internal inversion function |
1457 | terminx | 531 | "sectorofwall", // 347 |
532 | "qstrncat", // 348 |
||
1461 | terminx | 533 | "ifactorsound", // 349 |
534 | "stopactorsound", // 350 |
||
1673 | terminx | 535 | "ifclient", // 351 |
536 | "ifserver", // 352 |
||
1708 | helixhorne | 537 | "sectsetinterpolation", // 353 |
538 | "sectclearinterpolation", // 354 |
||
1857 | terminx | 539 | "clipmove", // 355 |
540 | "lineintersect", // 356 |
||
541 | "rayintersect", // 357 |
||
542 | "calchypotenuse", // 358 |
||
543 | "clipmovenoslide", // 359 |
||
1909 | terminx | 544 | "includedefault", // 360 |
2104 | helixhorne | 545 | "setactorsoundpitch", // 361 |
2419 | hendricks2 | 546 | "echo", // 362 |
2573 | helixhorne | 547 | "showviewunbiased", // 363 |
3610 | hendricks2 | 548 | "rotatespritea", // 364 |
3803 | terminx | 549 | "shadeto", // 365 |
550 | "endoflevel", // 366 |
||
551 | "ifplayersl", // 367 |
||
552 | "activate", // 368 |
||
3833 | hendricks2 | 553 | "qstrdim", // 369 |
554 | "screentext", // 370 |
||
3834 | hendricks2 | 555 | "dynamicsoundremap", // 371 |
3912 | helixhorne | 556 | "screensound", // 372 |
4928 | hendricks2 | 557 | "getmusicposition", // 373 |
558 | "setmusicposition", // 374 |
||
4977 | hendricks2 | 559 | "undefinevolume", // 375 |
560 | "undefineskill", // 376 |
||
561 | "undefinelevel", // 377 |
||
5031 | hendricks2 | 562 | "startcutscene", // 378 |
4987 | terminx | 563 | "ifcutscene", // 379 |
5033 | hendricks2 | 564 | "definevolumeflags", // 380 |
5039 | hendricks2 | 565 | "resetplayerflags", // 381 |
559 | terminx | 566 | "<null>" |
567 | }; |
||
3354 | helixhorne | 568 | #endif |
5 | Plagman | 569 | |
3258 | helixhorne | 570 | // KEEPINSYNC with enum GameEvent_t and lunatic/con_lang.lua |
571 | const char *EventNames[MAXEVENTS] = |
||
2327 | helixhorne | 572 | { |
3258 | helixhorne | 573 | "EVENT_INIT", |
574 | "EVENT_ENTERLEVEL", |
||
575 | "EVENT_RESETWEAPONS", |
||
576 | "EVENT_RESETINVENTORY", |
||
577 | "EVENT_HOLSTER", |
||
578 | "EVENT_LOOKLEFT", |
||
579 | "EVENT_LOOKRIGHT", |
||
580 | "EVENT_SOARUP", |
||
581 | "EVENT_SOARDOWN", |
||
582 | "EVENT_CROUCH", |
||
583 | "EVENT_JUMP", |
||
584 | "EVENT_RETURNTOCENTER", |
||
585 | "EVENT_LOOKUP", |
||
586 | "EVENT_LOOKDOWN", |
||
587 | "EVENT_AIMUP", |
||
588 | "EVENT_FIRE", |
||
589 | "EVENT_CHANGEWEAPON", |
||
590 | "EVENT_GETSHOTRANGE", |
||
591 | "EVENT_GETAUTOAIMANGLE", |
||
592 | "EVENT_GETLOADTILE", |
||
593 | "EVENT_CHEATGETSTEROIDS", |
||
594 | "EVENT_CHEATGETHEAT", |
||
595 | "EVENT_CHEATGETBOOT", |
||
596 | "EVENT_CHEATGETSHIELD", |
||
597 | "EVENT_CHEATGETSCUBA", |
||
598 | "EVENT_CHEATGETHOLODUKE", |
||
599 | "EVENT_CHEATGETJETPACK", |
||
600 | "EVENT_CHEATGETFIRSTAID", |
||
601 | "EVENT_QUICKKICK", |
||
602 | "EVENT_INVENTORY", |
||
603 | "EVENT_USENIGHTVISION", |
||
604 | "EVENT_USESTEROIDS", |
||
605 | "EVENT_INVENTORYLEFT", |
||
606 | "EVENT_INVENTORYRIGHT", |
||
607 | "EVENT_HOLODUKEON", |
||
608 | "EVENT_HOLODUKEOFF", |
||
609 | "EVENT_USEMEDKIT", |
||
610 | "EVENT_USEJETPACK", |
||
611 | "EVENT_TURNAROUND", |
||
612 | "EVENT_DISPLAYWEAPON", |
||
613 | "EVENT_FIREWEAPON", |
||
614 | "EVENT_SELECTWEAPON", |
||
615 | "EVENT_MOVEFORWARD", |
||
616 | "EVENT_MOVEBACKWARD", |
||
617 | "EVENT_TURNLEFT", |
||
618 | "EVENT_TURNRIGHT", |
||
619 | "EVENT_STRAFELEFT", |
||
620 | "EVENT_STRAFERIGHT", |
||
621 | "EVENT_WEAPKEY1", |
||
622 | "EVENT_WEAPKEY2", |
||
623 | "EVENT_WEAPKEY3", |
||
624 | "EVENT_WEAPKEY4", |
||
625 | "EVENT_WEAPKEY5", |
||
626 | "EVENT_WEAPKEY6", |
||
627 | "EVENT_WEAPKEY7", |
||
628 | "EVENT_WEAPKEY8", |
||
629 | "EVENT_WEAPKEY9", |
||
630 | "EVENT_WEAPKEY10", |
||
631 | "EVENT_DRAWWEAPON", |
||
632 | "EVENT_DISPLAYCROSSHAIR", |
||
633 | "EVENT_DISPLAYREST", |
||
634 | "EVENT_DISPLAYSBAR", |
||
635 | "EVENT_RESETPLAYER", |
||
636 | "EVENT_INCURDAMAGE", |
||
637 | "EVENT_AIMDOWN", |
||
638 | "EVENT_GAME", |
||
639 | "EVENT_PREVIOUSWEAPON", |
||
640 | "EVENT_NEXTWEAPON", |
||
641 | "EVENT_SWIMUP", |
||
642 | "EVENT_SWIMDOWN", |
||
643 | "EVENT_GETMENUTILE", |
||
644 | "EVENT_SPAWN", |
||
645 | "EVENT_LOGO", |
||
646 | "EVENT_EGS", |
||
647 | "EVENT_DOFIRE", |
||
648 | "EVENT_PRESSEDFIRE", |
||
649 | "EVENT_USE", |
||
650 | "EVENT_PROCESSINPUT", |
||
651 | "EVENT_FAKEDOMOVETHINGS", |
||
652 | "EVENT_DISPLAYROOMS", |
||
653 | "EVENT_KILLIT", |
||
654 | "EVENT_LOADACTOR", |
||
655 | "EVENT_DISPLAYBONUSSCREEN", |
||
656 | "EVENT_DISPLAYMENU", |
||
657 | "EVENT_DISPLAYMENUREST", |
||
658 | "EVENT_DISPLAYLOADINGSCREEN", |
||
659 | "EVENT_ANIMATESPRITES", |
||
660 | "EVENT_NEWGAME", |
||
661 | "EVENT_SOUND", |
||
662 | "EVENT_CHECKTOUCHDAMAGE", |
||
663 | "EVENT_CHECKFLOORDAMAGE", |
||
664 | "EVENT_LOADGAME", |
||
665 | "EVENT_SAVEGAME", |
||
666 | "EVENT_PREGAME", |
||
3937 | helixhorne | 667 | "EVENT_CHANGEMENU", |
4206 | helixhorne | 668 | "EVENT_DAMAGEHPLANE", |
4515 | hendricks2 | 669 | "EVENT_ACTIVATECHEAT", |
4945 | hendricks2 | 670 | "EVENT_DISPLAYINACTIVEMENU", |
671 | "EVENT_DISPLAYINACTIVEMENUREST", |
||
4987 | terminx | 672 | "EVENT_CUTSCENE", |
5003 | hendricks2 | 673 | "EVENT_DISPLAYCURSOR", |
5045 | hendricks2 | 674 | "EVENT_DISPLAYLEVELSTATS", |
5046 | hendricks2 | 675 | "EVENT_DISPLAYCAMERAOSD", |
5047 | hendricks2 | 676 | "EVENT_DISPLAYROOMSCAMERA", |
677 | "EVENT_DISPLAYSTART", |
||
3937 | helixhorne | 678 | #ifdef LUNATIC |
679 | "EVENT_ANIMATEALLSPRITES", |
||
680 | #endif |
||
2327 | helixhorne | 681 | }; |
682 | |||
3410 | helixhorne | 683 | #if !defined LUNATIC |
1143 | terminx | 684 | const memberlabel_t SectorLabels[]= |
559 | terminx | 685 | { |
686 | { "wallptr", SECTOR_WALLPTR, 0, 0 }, |
||
687 | { "wallnum", SECTOR_WALLNUM, 0, 0 }, |
||
688 | { "ceilingz", SECTOR_CEILINGZ, 0, 0 }, |
||
689 | { "floorz", SECTOR_FLOORZ, 0, 0 }, |
||
690 | { "ceilingstat", SECTOR_CEILINGSTAT, 0, 0 }, |
||
691 | { "floorstat", SECTOR_FLOORSTAT, 0, 0 }, |
||
692 | { "ceilingpicnum", SECTOR_CEILINGPICNUM, 0, 0 }, |
||
693 | { "ceilingslope", SECTOR_CEILINGSLOPE, 0, 0 }, |
||
694 | { "ceilingshade", SECTOR_CEILINGSHADE, 0, 0 }, |
||
695 | { "ceilingpal", SECTOR_CEILINGPAL, 0, 0 }, |
||
696 | { "ceilingxpanning", SECTOR_CEILINGXPANNING, 0, 0 }, |
||
697 | { "ceilingypanning", SECTOR_CEILINGYPANNING, 0, 0 }, |
||
698 | { "floorpicnum", SECTOR_FLOORPICNUM, 0, 0 }, |
||
699 | { "floorslope", SECTOR_FLOORSLOPE, 0, 0 }, |
||
700 | { "floorshade", SECTOR_FLOORSHADE, 0, 0 }, |
||
701 | { "floorpal", SECTOR_FLOORPAL, 0, 0 }, |
||
702 | { "floorxpanning", SECTOR_FLOORXPANNING, 0, 0 }, |
||
703 | { "floorypanning", SECTOR_FLOORYPANNING, 0, 0 }, |
||
704 | { "visibility", SECTOR_VISIBILITY, 0, 0 }, |
||
4416 | helixhorne | 705 | { "fogpal", SECTOR_FOGPAL, 0, 0 }, // formerly filler |
706 | { "alignto", SECTOR_FOGPAL, 0, 0 }, // formerly filler |
||
559 | terminx | 707 | { "lotag", SECTOR_LOTAG, 0, 0 }, |
708 | { "hitag", SECTOR_HITAG, 0, 0 }, |
||
709 | { "extra", SECTOR_EXTRA, 0, 0 }, |
||
2050 | helixhorne | 710 | { "ceilingbunch", SECTOR_CEILINGBUNCH, 0, 0 }, |
711 | { "floorbunch", SECTOR_FLOORBUNCH, 0, 0 }, |
||
3192 | terminx | 712 | { "ulotag", SECTOR_ULOTAG, 0, 0 }, |
713 | { "uhitag", SECTOR_UHITAG, 0, 0 }, |
||
559 | terminx | 714 | { "", -1, 0, 0 } // END OF LIST |
715 | }; |
||
5 | Plagman | 716 | |
1143 | terminx | 717 | const memberlabel_t WallLabels[]= |
559 | terminx | 718 | { |
719 | { "x", WALL_X, 0, 0 }, |
||
720 | { "y", WALL_Y, 0, 0 }, |
||
721 | { "point2", WALL_POINT2, 0, 0 }, |
||
722 | { "nextwall", WALL_NEXTWALL, 0, 0 }, |
||
723 | { "nextsector", WALL_NEXTSECTOR, 0, 0 }, |
||
724 | { "cstat", WALL_CSTAT, 0, 0 }, |
||
725 | { "picnum", WALL_PICNUM, 0, 0 }, |
||
726 | { "overpicnum", WALL_OVERPICNUM, 0, 0 }, |
||
727 | { "shade", WALL_SHADE, 0, 0 }, |
||
728 | { "pal", WALL_PAL, 0, 0 }, |
||
729 | { "xrepeat", WALL_XREPEAT, 0, 0 }, |
||
730 | { "yrepeat", WALL_YREPEAT, 0, 0 }, |
||
731 | { "xpanning", WALL_XPANNING, 0, 0 }, |
||
732 | { "ypanning", WALL_YPANNING, 0, 0 }, |
||
733 | { "lotag", WALL_LOTAG, 0, 0 }, |
||
734 | { "hitag", WALL_HITAG, 0, 0 }, |
||
735 | { "extra", WALL_EXTRA, 0, 0 }, |
||
3192 | terminx | 736 | { "ulotag", WALL_ULOTAG, 0, 0 }, |
737 | { "uhitag", WALL_UHITAG, 0, 0 }, |
||
559 | terminx | 738 | { "", -1, 0, 0 } // END OF LIST |
739 | }; |
||
5 | Plagman | 740 | |
1143 | terminx | 741 | const memberlabel_t ActorLabels[]= |
559 | terminx | 742 | { |
743 | { "x", ACTOR_X, 0, 0 }, |
||
744 | { "y", ACTOR_Y, 0, 0 }, |
||
745 | { "z", ACTOR_Z, 0, 0 }, |
||
746 | { "cstat", ACTOR_CSTAT, 0, 0 }, |
||
747 | { "picnum", ACTOR_PICNUM, 0, 0 }, |
||
748 | { "shade", ACTOR_SHADE, 0, 0 }, |
||
749 | { "pal", ACTOR_PAL, 0, 0 }, |
||
750 | { "clipdist", ACTOR_CLIPDIST, 0, 0 }, |
||
1011 | terminx | 751 | // { "filler", ACTOR_DETAIL, 0, 0 }, |
4313 | helixhorne | 752 | { "blend", ACTOR_DETAIL, 0, 0 }, |
559 | terminx | 753 | { "xrepeat", ACTOR_XREPEAT, 0, 0 }, |
754 | { "yrepeat", ACTOR_YREPEAT, 0, 0 }, |
||
755 | { "xoffset", ACTOR_XOFFSET, 0, 0 }, |
||
756 | { "yoffset", ACTOR_YOFFSET, 0, 0 }, |
||
757 | { "sectnum", ACTOR_SECTNUM, 0, 0 }, |
||
758 | { "statnum", ACTOR_STATNUM, 0, 0 }, |
||
759 | { "ang", ACTOR_ANG, 0, 0 }, |
||
760 | { "owner", ACTOR_OWNER, 0, 0 }, |
||
761 | { "xvel", ACTOR_XVEL, 0, 0 }, |
||
762 | { "yvel", ACTOR_YVEL, 0, 0 }, |
||
763 | { "zvel", ACTOR_ZVEL, 0, 0 }, |
||
764 | { "lotag", ACTOR_LOTAG, 0, 0 }, |
||
765 | { "hitag", ACTOR_HITAG, 0, 0 }, |
||
766 | { "extra", ACTOR_EXTRA, 0, 0 }, |
||
5 | Plagman | 767 | |
1143 | terminx | 768 | // ActorExtra labels... |
559 | terminx | 769 | { "htcgg", ACTOR_HTCGG, 0, 0 }, |
770 | { "htpicnum", ACTOR_HTPICNUM, 0, 0 }, |
||
771 | { "htang", ACTOR_HTANG, 0, 0 }, |
||
772 | { "htextra", ACTOR_HTEXTRA, 0, 0 }, |
||
773 | { "htowner", ACTOR_HTOWNER, 0, 0 }, |
||
774 | { "htmovflag", ACTOR_HTMOVFLAG, 0, 0 }, |
||
775 | { "httempang", ACTOR_HTTEMPANG, 0, 0 }, |
||
776 | { "htactorstayput", ACTOR_HTACTORSTAYPUT, 0, 0 }, |
||
777 | { "htdispicnum", ACTOR_HTDISPICNUM, 0, 0 }, |
||
778 | { "httimetosleep", ACTOR_HTTIMETOSLEEP, 0, 0 }, |
||
779 | { "htfloorz", ACTOR_HTFLOORZ, 0, 0 }, |
||
780 | { "htceilingz", ACTOR_HTCEILINGZ, 0, 0 }, |
||
781 | { "htlastvx", ACTOR_HTLASTVX, 0, 0 }, |
||
782 | { "htlastvy", ACTOR_HTLASTVY, 0, 0 }, |
||
783 | { "htbposx", ACTOR_HTBPOSX, 0, 0 }, |
||
784 | { "htbposy", ACTOR_HTBPOSY, 0, 0 }, |
||
785 | { "htbposz", ACTOR_HTBPOSZ, 0, 0 }, |
||
870 | terminx | 786 | { "htg_t", ACTOR_HTG_T, LABEL_HASPARM2, 10 }, |
5 | Plagman | 787 | |
559 | terminx | 788 | // model flags |
5 | Plagman | 789 | |
559 | terminx | 790 | { "angoff", ACTOR_ANGOFF, 0, 0 }, |
791 | { "pitch", ACTOR_PITCH, 0, 0 }, |
||
792 | { "roll", ACTOR_ROLL, 0, 0 }, |
||
793 | { "mdxoff", ACTOR_MDXOFF, 0, 0 }, |
||
794 | { "mdyoff", ACTOR_MDYOFF, 0, 0 }, |
||
795 | { "mdzoff", ACTOR_MDZOFF, 0, 0 }, |
||
796 | { "mdflags", ACTOR_MDFLAGS, 0, 0 }, |
||
590 | plagman | 797 | { "xpanning", ACTOR_XPANNING, 0, 0 }, |
798 | { "ypanning", ACTOR_YPANNING, 0, 0 }, |
||
853 | terminx | 799 | |
939 | terminx | 800 | { "htflags", ACTOR_HTFLAGS, 0, 0 }, |
801 | |||
1344 | terminx | 802 | { "alpha", ACTOR_ALPHA, 0, 0 }, |
1341 | terminx | 803 | |
3192 | terminx | 804 | { "ulotag", ACTOR_ULOTAG, 0, 0 }, |
805 | { "uhitag", ACTOR_UHITAG, 0, 0 }, |
||
806 | |||
4146 | helixhorne | 807 | { "isvalid", ACTOR_ISVALID, 0, 0 }, |
4313 | helixhorne | 808 | // aliases: |
4448 | helixhorne | 809 | { "movflags", ACTOR_HITAG, 0, 0 }, |
4313 | helixhorne | 810 | { "detail", ACTOR_DETAIL, 0, 0 }, // deprecated name for 'blend' |
4146 | helixhorne | 811 | |
856 | terminx | 812 | { "", -1, 0, 0 } // END OF LIST |
813 | }; |
||
814 | |||
1143 | terminx | 815 | const memberlabel_t TsprLabels[]= |
856 | terminx | 816 | { |
853 | terminx | 817 | // tsprite access |
818 | |||
1007 | hnt_ts | 819 | { "tsprx", ACTOR_X, 0, 0 }, |
820 | { "tspry", ACTOR_Y, 0, 0 }, |
||
821 | { "tsprz", ACTOR_Z, 0, 0 }, |
||
822 | { "tsprcstat", ACTOR_CSTAT, 0, 0 }, |
||
823 | { "tsprpicnum", ACTOR_PICNUM, 0, 0 }, |
||
824 | { "tsprshade", ACTOR_SHADE, 0, 0 }, |
||
825 | { "tsprpal", ACTOR_PAL, 0, 0 }, |
||
826 | { "tsprclipdist", ACTOR_CLIPDIST, 0, 0 }, |
||
1011 | terminx | 827 | // { "tsprfiller", ACTOR_DETAIL, 0, 0 }, |
4313 | helixhorne | 828 | { "tsprblend", ACTOR_DETAIL, 0, 0 }, |
1007 | hnt_ts | 829 | { "tsprxrepeat", ACTOR_XREPEAT, 0, 0 }, |
830 | { "tspryrepeat", ACTOR_YREPEAT, 0, 0 }, |
||
831 | { "tsprxoffset", ACTOR_XOFFSET, 0, 0 }, |
||
832 | { "tspryoffset", ACTOR_YOFFSET, 0, 0 }, |
||
833 | { "tsprsectnum", ACTOR_SECTNUM, 0, 0 }, |
||
834 | { "tsprstatnum", ACTOR_STATNUM, 0, 0 }, |
||
835 | { "tsprang", ACTOR_ANG, 0, 0 }, |
||
836 | { "tsprowner", ACTOR_OWNER, 0, 0 }, |
||
837 | #if 1 |
||
838 | { "tsprxvel", ACTOR_XVEL, 0, 0 }, |
||
839 | { "tspryvel", ACTOR_YVEL, 0, 0 }, |
||
840 | { "tsprzvel", ACTOR_ZVEL, 0, 0 }, |
||
841 | { "tsprlotag", ACTOR_LOTAG, 0, 0 }, |
||
842 | { "tsprhitag", ACTOR_HITAG, 0, 0 }, |
||
843 | { "tsprextra", ACTOR_EXTRA, 0, 0 }, |
||
844 | #endif |
||
4313 | helixhorne | 845 | // aliases: |
846 | { "tsprdetail", ACTOR_DETAIL, 0, 0 }, // deprecated name for 'tsprblend' |
||
853 | terminx | 847 | |
559 | terminx | 848 | { "", -1, 0, 0 } // END OF LIST |
849 | }; |
||
5 | Plagman | 850 | |
1143 | terminx | 851 | const memberlabel_t PlayerLabels[]= |
559 | terminx | 852 | { |
853 | { "zoom", PLAYER_ZOOM, 0, 0 }, |
||
854 | { "exitx", PLAYER_EXITX, 0, 0 }, |
||
855 | { "exity", PLAYER_EXITY, 0, 0 }, |
||
870 | terminx | 856 | { "loogiex", PLAYER_LOOGIEX, LABEL_HASPARM2, 64 }, |
857 | { "loogiey", PLAYER_LOOGIEY, LABEL_HASPARM2, 64 }, |
||
559 | terminx | 858 | { "numloogs", PLAYER_NUMLOOGS, 0, 0 }, |
859 | { "loogcnt", PLAYER_LOOGCNT, 0, 0 }, |
||
860 | { "posx", PLAYER_POSX, 0, 0 }, |
||
861 | { "posy", PLAYER_POSY, 0, 0 }, |
||
862 | { "posz", PLAYER_POSZ, 0, 0 }, |
||
863 | { "horiz", PLAYER_HORIZ, 0, 0 }, |
||
864 | { "ohoriz", PLAYER_OHORIZ, 0, 0 }, |
||
865 | { "ohorizoff", PLAYER_OHORIZOFF, 0, 0 }, |
||
866 | { "invdisptime", PLAYER_INVDISPTIME, 0, 0 }, |
||
867 | { "bobposx", PLAYER_BOBPOSX, 0, 0 }, |
||
868 | { "bobposy", PLAYER_BOBPOSY, 0, 0 }, |
||
869 | { "oposx", PLAYER_OPOSX, 0, 0 }, |
||
870 | { "oposy", PLAYER_OPOSY, 0, 0 }, |
||
871 | { "oposz", PLAYER_OPOSZ, 0, 0 }, |
||
872 | { "pyoff", PLAYER_PYOFF, 0, 0 }, |
||
873 | { "opyoff", PLAYER_OPYOFF, 0, 0 }, |
||
874 | { "posxv", PLAYER_POSXV, 0, 0 }, |
||
875 | { "posyv", PLAYER_POSYV, 0, 0 }, |
||
876 | { "poszv", PLAYER_POSZV, 0, 0 }, |
||
877 | { "last_pissed_time", PLAYER_LAST_PISSED_TIME, 0, 0 }, |
||
878 | { "truefz", PLAYER_TRUEFZ, 0, 0 }, |
||
879 | { "truecz", PLAYER_TRUECZ, 0, 0 }, |
||
880 | { "player_par", PLAYER_PLAYER_PAR, 0, 0 }, |
||
881 | { "visibility", PLAYER_VISIBILITY, 0, 0 }, |
||
882 | { "bobcounter", PLAYER_BOBCOUNTER, 0, 0 }, |
||
883 | { "weapon_sway", PLAYER_WEAPON_SWAY, 0, 0 }, |
||
884 | { "pals_time", PLAYER_PALS_TIME, 0, 0 }, |
||
885 | { "randomflamex", PLAYER_RANDOMFLAMEX, 0, 0 }, |
||
886 | { "crack_time", PLAYER_CRACK_TIME, 0, 0 }, |
||
887 | { "aim_mode", PLAYER_AIM_MODE, 0, 0 }, |
||
888 | { "ang", PLAYER_ANG, 0, 0 }, |
||
889 | { "oang", PLAYER_OANG, 0, 0 }, |
||
890 | { "angvel", PLAYER_ANGVEL, 0, 0 }, |
||
891 | { "cursectnum", PLAYER_CURSECTNUM, 0, 0 }, |
||
892 | { "look_ang", PLAYER_LOOK_ANG, 0, 0 }, |
||
893 | { "last_extra", PLAYER_LAST_EXTRA, 0, 0 }, |
||
894 | { "subweapon", PLAYER_SUBWEAPON, 0, 0 }, |
||
895 | { "ammo_amount", PLAYER_AMMO_AMOUNT, LABEL_HASPARM2, MAX_WEAPONS }, |
||
896 | { "wackedbyactor", PLAYER_WACKEDBYACTOR, 0, 0 }, |
||
897 | { "frag", PLAYER_FRAG, 0, 0 }, |
||
898 | { "fraggedself", PLAYER_FRAGGEDSELF, 0, 0 }, |
||
899 | { "curr_weapon", PLAYER_CURR_WEAPON, 0, 0 }, |
||
900 | { "last_weapon", PLAYER_LAST_WEAPON, 0, 0 }, |
||
901 | { "tipincs", PLAYER_TIPINCS, 0, 0 }, |
||
902 | { "horizoff", PLAYER_HORIZOFF, 0, 0 }, |
||
903 | { "wantweaponfire", PLAYER_WANTWEAPONFIRE, 0, 0 }, |
||
904 | { "holoduke_amount", PLAYER_HOLODUKE_AMOUNT, 0, 0 }, |
||
905 | { "newowner", PLAYER_NEWOWNER, 0, 0 }, |
||
906 | { "hurt_delay", PLAYER_HURT_DELAY, 0, 0 }, |
||
907 | { "hbomb_hold_delay", PLAYER_HBOMB_HOLD_DELAY, 0, 0 }, |
||
908 | { "jumping_counter", PLAYER_JUMPING_COUNTER, 0, 0 }, |
||
909 | { "airleft", PLAYER_AIRLEFT, 0, 0 }, |
||
910 | { "knee_incs", PLAYER_KNEE_INCS, 0, 0 }, |
||
911 | { "access_incs", PLAYER_ACCESS_INCS, 0, 0 }, |
||
912 | { "fta", PLAYER_FTA, 0, 0 }, |
||
913 | { "ftq", PLAYER_FTQ, 0, 0 }, |
||
914 | { "access_wallnum", PLAYER_ACCESS_WALLNUM, 0, 0 }, |
||
915 | { "access_spritenum", PLAYER_ACCESS_SPRITENUM, 0, 0 }, |
||
916 | { "kickback_pic", PLAYER_KICKBACK_PIC, 0, 0 }, |
||
917 | { "got_access", PLAYER_GOT_ACCESS, 0, 0 }, |
||
918 | { "weapon_ang", PLAYER_WEAPON_ANG, 0, 0 }, |
||
919 | { "firstaid_amount", PLAYER_FIRSTAID_AMOUNT, 0, 0 }, |
||
920 | { "somethingonplayer", PLAYER_SOMETHINGONPLAYER, 0, 0 }, |
||
921 | { "on_crane", PLAYER_ON_CRANE, 0, 0 }, |
||
922 | { "i", PLAYER_I, 0, 0 }, |
||
923 | { "one_parallax_sectnum", PLAYER_ONE_PARALLAX_SECTNUM, 0, 0 }, |
||
924 | { "over_shoulder_on", PLAYER_OVER_SHOULDER_ON, 0, 0 }, |
||
925 | { "random_club_frame", PLAYER_RANDOM_CLUB_FRAME, 0, 0 }, |
||
926 | { "fist_incs", PLAYER_FIST_INCS, 0, 0 }, |
||
927 | { "one_eighty_count", PLAYER_ONE_EIGHTY_COUNT, 0, 0 }, |
||
928 | { "cheat_phase", PLAYER_CHEAT_PHASE, 0, 0 }, |
||
929 | { "dummyplayersprite", PLAYER_DUMMYPLAYERSPRITE, 0, 0 }, |
||
930 | { "extra_extra8", PLAYER_EXTRA_EXTRA8, 0, 0 }, |
||
931 | { "quick_kick", PLAYER_QUICK_KICK, 0, 0 }, |
||
932 | { "heat_amount", PLAYER_HEAT_AMOUNT, 0, 0 }, |
||
933 | { "actorsqu", PLAYER_ACTORSQU, 0, 0 }, |
||
934 | { "timebeforeexit", PLAYER_TIMEBEFOREEXIT, 0, 0 }, |
||
935 | { "customexitsound", PLAYER_CUSTOMEXITSOUND, 0, 0 }, |
||
1625 | terminx | 936 | { "weaprecs", PLAYER_WEAPRECS, LABEL_HASPARM2, MAX_WEAPONS }, |
559 | terminx | 937 | { "weapreccnt", PLAYER_WEAPRECCNT, 0, 0 }, |
938 | { "interface_toggle_flag", PLAYER_INTERFACE_TOGGLE_FLAG, 0, 0 }, |
||
939 | { "rotscrnang", PLAYER_ROTSCRNANG, 0, 0 }, |
||
940 | { "dead_flag", PLAYER_DEAD_FLAG, 0, 0 }, |
||
941 | { "show_empty_weapon", PLAYER_SHOW_EMPTY_WEAPON, 0, 0 }, |
||
942 | { "scuba_amount", PLAYER_SCUBA_AMOUNT, 0, 0 }, |
||
943 | { "jetpack_amount", PLAYER_JETPACK_AMOUNT, 0, 0 }, |
||
944 | { "steroids_amount", PLAYER_STEROIDS_AMOUNT, 0, 0 }, |
||
945 | { "shield_amount", PLAYER_SHIELD_AMOUNT, 0, 0 }, |
||
946 | { "holoduke_on", PLAYER_HOLODUKE_ON, 0, 0 }, |
||
947 | { "pycount", PLAYER_PYCOUNT, 0, 0 }, |
||
948 | { "weapon_pos", PLAYER_WEAPON_POS, 0, 0 }, |
||
949 | { "frag_ps", PLAYER_FRAG_PS, 0, 0 }, |
||
950 | { "transporter_hold", PLAYER_TRANSPORTER_HOLD, 0, 0 }, |
||
951 | { "last_full_weapon", PLAYER_LAST_FULL_WEAPON, 0, 0 }, |
||
952 | { "footprintshade", PLAYER_FOOTPRINTSHADE, 0, 0 }, |
||
953 | { "boot_amount", PLAYER_BOOT_AMOUNT, 0, 0 }, |
||
954 | { "scream_voice", PLAYER_SCREAM_VOICE, 0, 0 }, |
||
955 | { "gm", PLAYER_GM, 0, 0 }, |
||
956 | { "on_warping_sector", PLAYER_ON_WARPING_SECTOR, 0, 0 }, |
||
957 | { "footprintcount", PLAYER_FOOTPRINTCOUNT, 0, 0 }, |
||
958 | { "hbomb_on", PLAYER_HBOMB_ON, 0, 0 }, |
||
959 | { "jumping_toggle", PLAYER_JUMPING_TOGGLE, 0, 0 }, |
||
960 | { "rapid_fire_hold", PLAYER_RAPID_FIRE_HOLD, 0, 0 }, |
||
961 | { "on_ground", PLAYER_ON_GROUND, 0, 0 }, |
||
962 | { "name", PLAYER_NAME, LABEL_ISSTRING, 32 }, |
||
963 | { "inven_icon", PLAYER_INVEN_ICON, 0, 0 }, |
||
964 | { "buttonpalette", PLAYER_BUTTONPALETTE, 0, 0 }, |
||
965 | { "jetpack_on", PLAYER_JETPACK_ON, 0, 0 }, |
||
966 | { "spritebridge", PLAYER_SPRITEBRIDGE, 0, 0 }, |
||
967 | { "lastrandomspot", PLAYER_LASTRANDOMSPOT, 0, 0 }, |
||
968 | { "scuba_on", PLAYER_SCUBA_ON, 0, 0 }, |
||
969 | { "footprintpal", PLAYER_FOOTPRINTPAL, 0, 0 }, |
||
970 | { "heat_on", PLAYER_HEAT_ON, 0, 0 }, |
||
971 | { "holster_weapon", PLAYER_HOLSTER_WEAPON, 0, 0 }, |
||
972 | { "falling_counter", PLAYER_FALLING_COUNTER, 0, 0 }, |
||
973 | { "gotweapon", PLAYER_GOTWEAPON, LABEL_HASPARM2, MAX_WEAPONS }, |
||
974 | { "refresh_inventory", PLAYER_REFRESH_INVENTORY, 0, 0 }, |
||
975 | { "palette", PLAYER_PALETTE, 0, 0 }, |
||
976 | { "toggle_key_flag", PLAYER_TOGGLE_KEY_FLAG, 0, 0 }, |
||
977 | { "knuckle_incs", PLAYER_KNUCKLE_INCS, 0, 0 }, |
||
978 | { "walking_snd_toggle", PLAYER_WALKING_SND_TOGGLE, 0, 0 }, |
||
979 | { "palookup", PLAYER_PALOOKUP, 0, 0 }, |
||
980 | { "hard_landing", PLAYER_HARD_LANDING, 0, 0 }, |
||
981 | { "max_secret_rooms", PLAYER_MAX_SECRET_ROOMS, 0, 0 }, |
||
982 | { "secret_rooms", PLAYER_SECRET_ROOMS, 0, 0 }, |
||
869 | terminx | 983 | { "pals", PLAYER_PALS, LABEL_HASPARM2, 3 }, |
559 | terminx | 984 | { "max_actors_killed", PLAYER_MAX_ACTORS_KILLED, 0, 0 }, |
985 | { "actors_killed", PLAYER_ACTORS_KILLED, 0, 0 }, |
||
986 | { "return_to_center", PLAYER_RETURN_TO_CENTER, 0, 0 }, |
||
987 | { "runspeed", PLAYER_RUNSPEED, 0, 0 }, |
||
988 | { "sbs", PLAYER_SBS, 0, 0 }, |
||
989 | { "reloading", PLAYER_RELOADING, 0, 0 }, |
||
990 | { "auto_aim", PLAYER_AUTO_AIM, 0, 0 }, |
||
991 | { "movement_lock", PLAYER_MOVEMENT_LOCK, 0, 0 }, |
||
992 | { "sound_pitch", PLAYER_SOUND_PITCH, 0, 0 }, |
||
993 | { "weaponswitch", PLAYER_WEAPONSWITCH, 0, 0 }, |
||
994 | { "team", PLAYER_TEAM, 0, 0 }, |
||
566 | terminx | 995 | { "max_player_health", PLAYER_MAX_PLAYER_HEALTH, 0, 0 }, |
996 | { "max_shield_amount", PLAYER_MAX_SHIELD_AMOUNT, 0, 0 }, |
||
997 | { "max_ammo_amount", PLAYER_MAX_AMMO_AMOUNT, LABEL_HASPARM2, MAX_WEAPONS }, |
||
1062 | terminx | 998 | { "last_quick_kick", PLAYER_LAST_QUICK_KICK, 0, 0 }, |
3100 | hendricks2 | 999 | { "autostep", PLAYER_AUTOSTEP, 0, 0 }, |
1000 | { "autostep_sbw", PLAYER_AUTOSTEP_SBW, 0, 0 }, |
||
559 | terminx | 1001 | { "", -1, 0, 0 } // END OF LIST |
1002 | }; |
||
5 | Plagman | 1003 | |
1143 | terminx | 1004 | const memberlabel_t ProjectileLabels[]= |
559 | terminx | 1005 | { |
1006 | { "workslike", PROJ_WORKSLIKE, 0, 0 }, |
||
1007 | { "spawns", PROJ_SPAWNS, 0, 0 }, |
||
1008 | { "sxrepeat", PROJ_SXREPEAT, 0, 0 }, |
||
1009 | { "syrepeat", PROJ_SYREPEAT, 0, 0 }, |
||
1010 | { "sound", PROJ_SOUND, 0, 0 }, |
||
1011 | { "isound", PROJ_ISOUND, 0, 0 }, |
||
1012 | { "vel", PROJ_VEL, 0, 0 }, |
||
1013 | { "extra", PROJ_EXTRA, 0, 0 }, |
||
1014 | { "decal", PROJ_DECAL, 0, 0 }, |
||
1015 | { "trail", PROJ_TRAIL, 0, 0 }, |
||
1016 | { "txrepeat", PROJ_TXREPEAT, 0, 0 }, |
||
1017 | { "tyrepeat", PROJ_TYREPEAT, 0, 0 }, |
||
1018 | { "toffset", PROJ_TOFFSET, 0, 0 }, |
||
1019 | { "tnum", PROJ_TNUM, 0, 0 }, |
||
1020 | { "drop", PROJ_DROP, 0, 0 }, |
||
1021 | { "cstat", PROJ_CSTAT, 0, 0 }, |
||
1022 | { "clipdist", PROJ_CLIPDIST, 0, 0 }, |
||
1023 | { "shade", PROJ_SHADE, 0, 0 }, |
||
1024 | { "xrepeat", PROJ_XREPEAT, 0, 0 }, |
||
1025 | { "yrepeat", PROJ_YREPEAT, 0, 0 }, |
||
1026 | { "pal", PROJ_PAL, 0, 0 }, |
||
1027 | { "extra_rand", PROJ_EXTRA_RAND, 0, 0 }, |
||
1028 | { "hitradius", PROJ_HITRADIUS, 0, 0 }, |
||
3053 | terminx | 1029 | { "velmult", PROJ_MOVECNT, 0, 0 }, |
559 | terminx | 1030 | { "offset", PROJ_OFFSET, 0, 0 }, |
1031 | { "bounces", PROJ_BOUNCES, 0, 0 }, |
||
1032 | { "bsound", PROJ_BSOUND, 0, 0 }, |
||
1033 | { "range", PROJ_RANGE, 0, 0 }, |
||
1315 | terminx | 1034 | { "flashcolor", PROJ_FLASH_COLOR, 0, 0 }, |
3866 | helixhorne | 1035 | { "userdata", PROJ_USERDATA, 0, 0 }, |
559 | terminx | 1036 | { "", -1, 0, 0 } // END OF LIST |
1037 | }; |
||
5 | Plagman | 1038 | |
1143 | terminx | 1039 | const memberlabel_t UserdefsLabels[]= |
559 | terminx | 1040 | { |
1041 | // { "<null>", 1, 0, 0 }, |
||
1042 | { "god", USERDEFS_GOD, 0, 0 }, |
||
1043 | { "warp_on", USERDEFS_WARP_ON, 0, 0 }, |
||
1044 | { "cashman", USERDEFS_CASHMAN, 0, 0 }, |
||
1045 | { "eog", USERDEFS_EOG, 0, 0 }, |
||
1046 | { "showallmap", USERDEFS_SHOWALLMAP, 0, 0 }, |
||
1047 | { "show_help", USERDEFS_SHOW_HELP, 0, 0 }, |
||
1048 | { "scrollmode", USERDEFS_SCROLLMODE, 0, 0 }, |
||
1049 | { "clipping", USERDEFS_CLIPPING, 0, 0 }, |
||
1050 | { "user_name", USERDEFS_USER_NAME, LABEL_HASPARM2, MAXPLAYERS }, |
||
1051 | { "ridecule", USERDEFS_RIDECULE, LABEL_HASPARM2 | LABEL_ISSTRING, 10 }, |
||
1052 | { "savegame", USERDEFS_SAVEGAME, LABEL_HASPARM2 | LABEL_ISSTRING, 10 }, |
||
1053 | { "pwlockout", USERDEFS_PWLOCKOUT, LABEL_ISSTRING, 128 }, |
||
1054 | { "rtsname;", USERDEFS_RTSNAME, LABEL_ISSTRING, 128 }, |
||
1055 | { "overhead_on", USERDEFS_OVERHEAD_ON, 0, 0 }, |
||
1056 | { "last_overhead", USERDEFS_LAST_OVERHEAD, 0, 0 }, |
||
1057 | { "showweapons", USERDEFS_SHOWWEAPONS, 0, 0 }, |
||
5 | Plagman | 1058 | |
559 | terminx | 1059 | { "pause_on", USERDEFS_PAUSE_ON, 0, 0 }, |
1060 | { "from_bonus", USERDEFS_FROM_BONUS, 0, 0 }, |
||
1061 | { "camerasprite", USERDEFS_CAMERASPRITE, 0, 0 }, |
||
1062 | { "last_camsprite", USERDEFS_LAST_CAMSPRITE, 0, 0 }, |
||
1063 | { "last_level", USERDEFS_LAST_LEVEL, 0, 0 }, |
||
1064 | { "secretlevel", USERDEFS_SECRETLEVEL, 0, 0 }, |
||
4968 | hendricks2 | 1065 | { "playerbest", USERDEFS_PLAYERBEST, 0, 0 }, |
5 | Plagman | 1066 | |
559 | terminx | 1067 | { "const_visibility", USERDEFS_CONST_VISIBILITY, 0, 0 }, |
1068 | { "uw_framerate", USERDEFS_UW_FRAMERATE, 0, 0 }, |
||
1069 | { "camera_time", USERDEFS_CAMERA_TIME, 0, 0 }, |
||
1070 | { "folfvel", USERDEFS_FOLFVEL, 0, 0 }, |
||
1071 | { "folavel", USERDEFS_FOLAVEL, 0, 0 }, |
||
1072 | { "folx", USERDEFS_FOLX, 0, 0 }, |
||
1073 | { "foly", USERDEFS_FOLY, 0, 0 }, |
||
1074 | { "fola", USERDEFS_FOLA, 0, 0 }, |
||
1075 | { "reccnt", USERDEFS_RECCNT, 0, 0 }, |
||
5 | Plagman | 1076 | |
4945 | hendricks2 | 1077 | { "m_origin_x", USERDEFS_M_ORIGIN_X, 0, 0 }, |
1078 | { "m_origin_y", USERDEFS_M_ORIGIN_Y, 0, 0 }, |
||
1079 | |||
5043 | hendricks2 | 1080 | { "usevoxels", USERDEFS_USEVOXELS, 0, 0 }, |
1081 | { "usehightile", USERDEFS_USEHIGHTILE, 0, 0 }, |
||
1082 | { "usemodels", USERDEFS_USEMODELS, 0, 0 }, |
||
1083 | |||
559 | terminx | 1084 | { "entered_name", USERDEFS_ENTERED_NAME, 0, 0 }, |
1085 | { "screen_tilting", USERDEFS_SCREEN_TILTING, 0, 0 }, |
||
1086 | { "shadows", USERDEFS_SHADOWS, 0, 0 }, |
||
1087 | { "fta_on", USERDEFS_FTA_ON, 0, 0 }, |
||
1088 | { "executions", USERDEFS_EXECUTIONS, 0, 0 }, |
||
1089 | { "auto_run", USERDEFS_AUTO_RUN, 0, 0 }, |
||
1090 | { "coords", USERDEFS_COORDS, 0, 0 }, |
||
1091 | { "tickrate", USERDEFS_TICKRATE, 0, 0 }, |
||
1092 | { "m_coop", USERDEFS_M_COOP, 0, 0 }, |
||
1093 | { "coop", USERDEFS_COOP, 0, 0 }, |
||
1094 | { "screen_size", USERDEFS_SCREEN_SIZE, 0, 0 }, |
||
1095 | { "lockout", USERDEFS_LOCKOUT, 0, 0 }, |
||
1096 | { "crosshair", USERDEFS_CROSSHAIR, 0, 0 }, |
||
4215 | helixhorne | 1097 | // { "wchoice[MAXPLAYERS][MAX_WEAPONS]", USERDEFS_WCHOICE, 0, 0 }, |
559 | terminx | 1098 | { "playerai", USERDEFS_PLAYERAI, 0, 0 }, |
1099 | { "respawn_monsters", USERDEFS_RESPAWN_MONSTERS, 0, 0 }, |
||
1100 | { "respawn_items", USERDEFS_RESPAWN_ITEMS, 0, 0 }, |
||
1101 | { "respawn_inventory", USERDEFS_RESPAWN_INVENTORY, 0, 0 }, |
||
1102 | { "recstat", USERDEFS_RECSTAT, 0, 0 }, |
||
1103 | { "monsters_off", USERDEFS_MONSTERS_OFF, 0, 0 }, |
||
1104 | { "brightness", USERDEFS_BRIGHTNESS, 0, 0 }, |
||
1105 | { "m_respawn_items", USERDEFS_M_RESPAWN_ITEMS, 0, 0 }, |
||
1106 | { "m_respawn_monsters", USERDEFS_M_RESPAWN_MONSTERS, 0, 0 }, |
||
1107 | { "m_respawn_inventory", USERDEFS_M_RESPAWN_INVENTORY, 0, 0 }, |
||
1108 | { "m_recstat", USERDEFS_M_RECSTAT, 0, 0 }, |
||
1109 | { "m_monsters_off", USERDEFS_M_MONSTERS_OFF, 0, 0 }, |
||
1110 | { "detail", USERDEFS_DETAIL, 0, 0 }, |
||
1111 | { "m_ffire", USERDEFS_M_FFIRE, 0, 0 }, |
||
1112 | { "ffire", USERDEFS_FFIRE, 0, 0 }, |
||
1113 | { "m_player_skill", USERDEFS_M_PLAYER_SKILL, 0, 0 }, |
||
1114 | { "m_level_number", USERDEFS_M_LEVEL_NUMBER, 0, 0 }, |
||
1115 | { "m_volume_number", USERDEFS_M_VOLUME_NUMBER, 0, 0 }, |
||
1116 | { "multimode", USERDEFS_MULTIMODE, 0, 0 }, |
||
1117 | { "player_skill", USERDEFS_PLAYER_SKILL, 0, 0 }, |
||
1118 | { "level_number", USERDEFS_LEVEL_NUMBER, 0, 0 }, |
||
1119 | { "volume_number", USERDEFS_VOLUME_NUMBER, 0, 0 }, |
||
1120 | { "m_marker", USERDEFS_M_MARKER, 0, 0 }, |
||
1121 | { "marker", USERDEFS_MARKER, 0, 0 }, |
||
1122 | { "mouseflip", USERDEFS_MOUSEFLIP, 0, 0 }, |
||
1123 | { "statusbarscale", USERDEFS_STATUSBARSCALE, 0, 0 }, |
||
1124 | { "drawweapon", USERDEFS_DRAWWEAPON, 0, 0 }, |
||
1125 | { "mouseaiming", USERDEFS_MOUSEAIMING, 0, 0 }, |
||
1126 | { "weaponswitch", USERDEFS_WEAPONSWITCH, 0, 0 }, |
||
1127 | { "democams", USERDEFS_DEMOCAMS, 0, 0 }, |
||
1128 | { "color", USERDEFS_COLOR, 0, 0 }, |
||
1129 | { "msgdisptime", USERDEFS_MSGDISPTIME, 0, 0 }, |
||
1130 | { "statusbarmode", USERDEFS_STATUSBARMODE, 0, 0 }, |
||
1131 | { "m_noexits", USERDEFS_M_NOEXITS, 0, 0 }, |
||
1132 | { "noexits", USERDEFS_NOEXITS, 0, 0 }, |
||
1133 | { "autovote", USERDEFS_AUTOVOTE, 0, 0 }, |
||
1134 | { "automsg", USERDEFS_AUTOMSG, 0, 0 }, |
||
1135 | { "idplayers", USERDEFS_IDPLAYERS, 0, 0 }, |
||
1136 | { "team", USERDEFS_TEAM, 0, 0 }, |
||
1137 | { "viewbob", USERDEFS_VIEWBOB, 0, 0 }, |
||
1138 | { "weaponsway", USERDEFS_WEAPONSWAY, 0, 0 }, |
||
1139 | { "angleinterpolation", USERDEFS_ANGLEINTERPOLATION, 0, 0 }, |
||
926 | terminx | 1140 | { "obituaries", USERDEFS_OBITUARIES, 0, 0 }, |
674 | terminx | 1141 | { "levelstats", USERDEFS_LEVELSTATS, 0, 0 }, |
881 | terminx | 1142 | { "crosshairscale", USERDEFS_CROSSHAIRSCALE, 0, 0 }, |
934 | terminx | 1143 | { "althud", USERDEFS_ALTHUD, 0, 0 }, |
990 | terminx | 1144 | { "display_bonus_screen", USERDEFS_DISPLAY_BONUS_SCREEN, 0, 0 }, |
1082 | terminx | 1145 | { "show_level_text", USERDEFS_SHOW_LEVEL_TEXT, 0, 0 }, |
1090 | terminx | 1146 | { "weaponscale", USERDEFS_WEAPONSCALE, 0, 0 }, |
1095 | terminx | 1147 | { "textscale", USERDEFS_TEXTSCALE, 0, 0 }, |
3071 | terminx | 1148 | { "runkey_mode", USERDEFS_RUNKEY_MODE, 0, 0 }, |
4970 | hendricks2 | 1149 | { "musictoggle", USERDEFS_MUSICTOGGLE, 0, 0 }, |
5044 | hendricks2 | 1150 | { "gametypeflags", USERDEFS_GAMETYPEFLAGS, 0, 0 }, |
1151 | { "m_gametypeflags", USERDEFS_M_GAMETYPEFLAGS, 0, 0 }, |
||
559 | terminx | 1152 | { "", -1, 0, 0 } // END OF LIST |
1153 | }; |
||
5 | Plagman | 1154 | |
1143 | terminx | 1155 | const memberlabel_t InputLabels[]= |
559 | terminx | 1156 | { |
1157 | { "avel", INPUT_AVEL, 0, 0 }, |
||
1158 | { "horz", INPUT_HORZ, 0, 0 }, |
||
1159 | { "fvel", INPUT_FVEL, 0, 0 }, |
||
1160 | { "svel", INPUT_SVEL, 0, 0 }, |
||
1161 | { "bits", INPUT_BITS, 0, 0 }, |
||
1162 | { "extbits", INPUT_EXTBITS, 0, 0 }, |
||
1163 | { "", -1, 0, 0 } // END OF LIST |
||
1164 | }; |
||
5 | Plagman | 1165 | |
3354 | helixhorne | 1166 | #endif |
1167 | |||
1064 | terminx | 1168 | char *bitptr; // pointer to bitmap of which bytecode positions contain pointers |
978 | terminx | 1169 | #define BITPTR_POINTER 1 |
1170 | |||
3415 | helixhorne | 1171 | #if !defined LUNATIC |
1625 | terminx | 1172 | hashtable_t h_gamevars = { MAXGAMEVARS>>1, NULL }; |
1173 | hashtable_t h_arrays = { MAXGAMEARRAYS>>1, NULL }; |
||
1174 | hashtable_t h_labels = { 11264>>1, NULL }; |
||
3354 | helixhorne | 1175 | |
2262 | helixhorne | 1176 | static hashtable_t h_keywords = { CON_END>>1, NULL }; |
1024 | terminx | 1177 | |
2262 | helixhorne | 1178 | static hashtable_t sectorH = { SECTOR_END>>1, NULL }; |
1179 | static hashtable_t wallH = { WALL_END>>1, NULL }; |
||
1180 | static hashtable_t userdefH = { USERDEFS_END>>1, NULL }; |
||
1024 | terminx | 1181 | |
2262 | helixhorne | 1182 | static hashtable_t projectileH = { PROJ_END>>1, NULL }; |
1183 | static hashtable_t playerH = { PLAYER_END>>1, NULL }; |
||
1184 | static hashtable_t inputH = { INPUT_END>>1, NULL }; |
||
1185 | static hashtable_t actorH = { ACTOR_END>>1, NULL }; |
||
1186 | static hashtable_t tspriteH = { ACTOR_END>>1, NULL }; |
||
1024 | terminx | 1187 | |
1201 | terminx | 1188 | void C_InitHashes() |
1024 | terminx | 1189 | { |
1205 | terminx | 1190 | int32_t i; |
1024 | terminx | 1191 | |
1625 | terminx | 1192 | hash_init(&h_gamevars); |
1193 | hash_init(&h_arrays); |
||
1194 | hash_init(&h_labels); |
||
1031 | hnt_ts | 1195 | inithashnames(); |
3834 | hendricks2 | 1196 | initsoundhashnames(); |
1024 | terminx | 1197 | |
1625 | terminx | 1198 | hash_init(&h_keywords); |
1206 | terminx | 1199 | hash_init(§orH); |
1200 | hash_init(&wallH); |
||
1201 | hash_init(&userdefH); |
||
1202 | hash_init(&projectileH); |
||
1203 | hash_init(&playerH); |
||
1204 | hash_init(&inputH); |
||
1205 | hash_init(&actorH); |
||
1206 | hash_init(&tspriteH); |
||
1544 | terminx | 1207 | |
1708 | helixhorne | 1208 | g_scriptLastKeyword = NUMKEYWORDS-1; |
1209 | // determine last CON keyword for backward compatibility with older mods |
||
1210 | if (g_scriptDateVersion < g_keywdate[NUMKEYWDATES-1].date) |
||
1211 | { |
||
1212 | for (i=NUMKEYWDATES-1; i>=0; i--) |
||
1213 | { |
||
1214 | if (g_scriptDateVersion >= g_keywdate[i].date) |
||
1215 | { |
||
1216 | g_scriptLastKeyword = g_keywdate[i].keyw; |
||
1217 | break; |
||
1218 | } |
||
1219 | } |
||
1220 | |||
1221 | if (i<0) |
||
1222 | g_scriptLastKeyword = g_keywdate[0].keyw-1; // may be slightly imprecise |
||
1223 | } |
||
1224 | |||
1225 | for (i=g_scriptLastKeyword; i>=0; i--) hash_add(&h_keywords,keyw[i],i,0); |
||
1677 | terminx | 1226 | for (i=0; SectorLabels[i].lId >= 0; i++) hash_add(§orH,SectorLabels[i].name,i,0); |
1227 | for (i=0; WallLabels[i].lId >= 0; i++) hash_add(&wallH,WallLabels[i].name,i,0); |
||
1228 | for (i=0; UserdefsLabels[i].lId >= 0; i++) hash_add(&userdefH,UserdefsLabels[i].name,i,0); |
||
1229 | for (i=0; ProjectileLabels[i].lId >= 0; i++) hash_add(&projectileH,ProjectileLabels[i].name,i,0); |
||
1230 | for (i=0; PlayerLabels[i].lId >= 0; i++) hash_add(&playerH,PlayerLabels[i].name,i,0); |
||
1231 | for (i=0; InputLabels[i].lId >= 0; i++) hash_add(&inputH,InputLabels[i].name,i,0); |
||
1232 | for (i=0; ActorLabels[i].lId >= 0; i++) hash_add(&actorH,ActorLabels[i].name,i,0); |
||
1233 | for (i=0; TsprLabels[i].lId >= 0; i++) hash_add(&tspriteH,TsprLabels[i].name,i,0); |
||
1024 | terminx | 1234 | } |
1025 | terminx | 1235 | |
1390 | terminx | 1236 | // "magic" number for { and }, overrides line number in compiled code for later detection |
1201 | terminx | 1237 | #define IFELSE_MAGIC 31337 |
1205 | terminx | 1238 | static int32_t g_ifElseAborted; |
1200 | terminx | 1239 | |
1820 | terminx | 1240 | static int32_t C_SetScriptSize(int32_t newsize) |
874 | terminx | 1241 | { |
1143 | terminx | 1242 | intptr_t oscriptPtr = (unsigned)(g_scriptPtr-script); |
1243 | intptr_t ocaseScriptPtr = (unsigned)(g_caseScriptPtr-script); |
||
1244 | intptr_t oparsingEventPtr = (unsigned)(g_parsingEventPtr-script); |
||
1245 | intptr_t oparsingActorPtr = (unsigned)(g_parsingActorPtr-script); |
||
874 | terminx | 1246 | intptr_t *newscript; |
1247 | intptr_t i, j; |
||
1205 | terminx | 1248 | int32_t osize = g_scriptSize; |
1820 | terminx | 1249 | char *scriptptrs; |
1064 | terminx | 1250 | char *newbitptr; |
2262 | helixhorne | 1251 | |
4491 | helixhorne | 1252 | scriptptrs = (char *)Xcalloc(1, g_scriptSize * sizeof(uint8_t)); |
1820 | terminx | 1253 | |
1229 | terminx | 1254 | for (i=g_scriptSize-1; i>=0; i--) |
874 | terminx | 1255 | { |
1206 | terminx | 1256 | if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7))) |
874 | terminx | 1257 | { |
4680 | terminx | 1258 | if (EDUKE32_PREDICT_FALSE((intptr_t)script[i] < (intptr_t)&script[0] || (intptr_t)script[i] >= (intptr_t)&script[g_scriptSize])) |
1820 | terminx | 1259 | { |
1260 | g_numCompilerErrors++; |
||
1909 | terminx | 1261 | initprintf("Internal compiler error at %" PRIdPTR " (0x%" PRIxPTR ")\n",i,i); |
1820 | terminx | 1262 | } |
1263 | |||
874 | terminx | 1264 | scriptptrs[i] = 1; |
976 | terminx | 1265 | script[i] -= (intptr_t)&script[0]; |
874 | terminx | 1266 | } |
1267 | else scriptptrs[i] = 0; |
||
1268 | } |
||
1269 | |||
3102 | terminx | 1270 | G_Util_PtrToIdx2(&g_tile[0].execPtr, MAXTILES, sizeof(tiledata_t), script, P2I_FWD_NON0); |
1271 | G_Util_PtrToIdx2(&g_tile[0].loadPtr, MAXTILES, sizeof(tiledata_t), script, P2I_FWD_NON0); |
||
1950 | helixhorne | 1272 | G_Util_PtrToIdx(apScriptGameEvent, MAXGAMEEVENTS, script, P2I_FWD_NON0); |
1820 | terminx | 1273 | |
1274 | initprintf("Resizing code buffer to %d*%d bytes\n",newsize, (int32_t)sizeof(intptr_t)); |
||
1029 | terminx | 1275 | |
4491 | helixhorne | 1276 | newscript = (intptr_t *)Xrealloc(script, newsize * sizeof(intptr_t)); |
1277 | newbitptr = (char *)Xcalloc(1,(((newsize+7)>>3)+1) * sizeof(uint8_t)); |
||
874 | terminx | 1278 | |
1820 | terminx | 1279 | if (newsize >= osize) |
1029 | terminx | 1280 | { |
1820 | terminx | 1281 | Bmemset(&newscript[0]+osize,0,(newsize-osize) * sizeof(uint8_t)); |
1229 | terminx | 1282 | Bmemcpy(newbitptr,bitptr,sizeof(uint8_t) *((osize+7)>>3)); |
1029 | terminx | 1283 | } |
1390 | terminx | 1284 | else |
1820 | terminx | 1285 | Bmemcpy(newbitptr,bitptr,sizeof(uint8_t) *((newsize+7)>>3)); |
1029 | terminx | 1286 | |
1064 | terminx | 1287 | Bfree(bitptr); |
1288 | bitptr = newbitptr; |
||
1390 | terminx | 1289 | if (script != newscript) |
1290 | { |
||
3278 | hendricks2 | 1291 | initprintf("Relocating compiled code from to 0x%" PRIxPTR " to 0x%" PRIxPTR "\n", (intptr_t)script, (intptr_t)newscript); |
1390 | terminx | 1292 | script = newscript; |
1293 | } |
||
1294 | |||
1820 | terminx | 1295 | g_scriptSize = newsize; |
1143 | terminx | 1296 | g_scriptPtr = (intptr_t *)(script+oscriptPtr); |
976 | terminx | 1297 | |
1544 | terminx | 1298 | if (g_caseScriptPtr) |
1143 | terminx | 1299 | g_caseScriptPtr = (intptr_t *)(script+ocaseScriptPtr); |
1544 | terminx | 1300 | |
1301 | if (g_parsingEventPtr) |
||
1143 | terminx | 1302 | g_parsingEventPtr = (intptr_t *)(script+oparsingEventPtr); |
1544 | terminx | 1303 | |
1304 | if (g_parsingActorPtr) |
||
1143 | terminx | 1305 | g_parsingActorPtr = (intptr_t *)(script+oparsingActorPtr); |
2262 | helixhorne | 1306 | |
1820 | terminx | 1307 | for (i=(((newsize>=osize)?osize:newsize))-1; i>=0; i--) |
1308 | if (scriptptrs[i]) |
||
1309 | { |
||
1950 | helixhorne | 1310 | j = (intptr_t)script[i]+(intptr_t)&script[0]; |
1820 | terminx | 1311 | script[i] = j; |
1312 | } |
||
874 | terminx | 1313 | |
3102 | terminx | 1314 | G_Util_PtrToIdx2(&g_tile[0].execPtr, MAXTILES, sizeof(tiledata_t), script, P2I_BACK_NON0); |
1315 | G_Util_PtrToIdx2(&g_tile[0].loadPtr, MAXTILES, sizeof(tiledata_t), script, P2I_BACK_NON0); |
||
1950 | helixhorne | 1316 | G_Util_PtrToIdx(apScriptGameEvent, MAXGAMEEVENTS, script, P2I_BACK_NON0); |
874 | terminx | 1317 | |
1318 | Bfree(scriptptrs); |
||
1319 | return 0; |
||
1320 | } |
||
1321 | |||
2640 | helixhorne | 1322 | static int32_t ispecial(const char c) |
1593 | terminx | 1323 | { |
1324 | if (c == ' ' || c == 0x0d || c == '(' || c == ')' || |
||
1616 | helixhorne | 1325 | c == ',' || c == ';' || (c == 0x0a /*&& ++g_lineNumber*/)) |
1593 | terminx | 1326 | return 1; |
1545 | terminx | 1327 | |
1593 | terminx | 1328 | return 0; |
1329 | } |
||
1330 | |||
1545 | terminx | 1331 | #define C_NextLine() while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++ |
1332 | |||
1205 | terminx | 1333 | static int32_t C_SkipComments(void) |
5 | Plagman | 1334 | { |
1040 | terminx | 1335 | do |
5 | Plagman | 1336 | { |
1544 | terminx | 1337 | switch (*textptr) |
335 | terminx | 1338 | { |
1544 | terminx | 1339 | case '\n': |
1143 | terminx | 1340 | g_lineNumber++; |
1544 | terminx | 1341 | case ' ': |
1342 | case '\t': |
||
1343 | case '\r': |
||
1665 | terminx | 1344 | case 0x1a: |
5 | Plagman | 1345 | textptr++; |
1544 | terminx | 1346 | break; |
1347 | case '/': |
||
1348 | switch (textptr[1]) |
||
5 | Plagman | 1349 | { |
1544 | terminx | 1350 | case '/': // C++ style comment |
1351 | if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1) |
||
1352 | initprintf("%s:%d: debug: got comment.\n",g_szScriptFileName,g_lineNumber); |
||
1545 | terminx | 1353 | C_NextLine(); |
1665 | terminx | 1354 | continue; |
1544 | terminx | 1355 | case '*': // beginning of a C style comment |
1356 | if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1) |
||
1357 | initprintf("%s:%d: debug: got start of comment block.\n",g_szScriptFileName,g_lineNumber); |
||
1358 | do |
||
1359 | { |
||
1360 | if (*textptr == '\n') |
||
1361 | g_lineNumber++; |
||
1362 | textptr++; |
||
1363 | } |
||
1364 | while (*textptr && (textptr[0] != '*' || textptr[1] != '/')); |
||
1365 | |||
4680 | terminx | 1366 | if (EDUKE32_PREDICT_FALSE(!*textptr)) |
1544 | terminx | 1367 | { |
1368 | if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug) |
||
1369 | initprintf("%s:%d: debug: EOF in comment!\n",g_szScriptFileName,g_lineNumber); |
||
1370 | C_ReportError(-1); |
||
1371 | initprintf("%s:%d: error: found `/*' with no `*/'.\n",g_szScriptFileName,g_lineNumber); |
||
1857 | terminx | 1372 | g_parsingActorPtr = NULL; g_processingState = g_numBraces = 0; |
1544 | terminx | 1373 | g_numCompilerErrors++; |
1665 | terminx | 1374 | continue; |
1544 | terminx | 1375 | } |
1376 | |||
1377 | if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1) |
||
1378 | initprintf("%s:%d: debug: got end of comment block.\n",g_szScriptFileName,g_lineNumber); |
||
1379 | |||
1380 | textptr+=2; |
||
1665 | terminx | 1381 | continue; |
5 | Plagman | 1382 | } |
1665 | terminx | 1383 | continue; |
1544 | terminx | 1384 | |
1545 | terminx | 1385 | default: |
1386 | if (ispecial(*textptr)) |
||
1387 | { |
||
1388 | textptr++; |
||
1665 | terminx | 1389 | continue; |
1545 | terminx | 1390 | } |
1544 | terminx | 1391 | case 0: // EOF |
1392 | return ((g_scriptPtr-script) > (g_scriptSize-32)) ? C_SetScriptSize(g_scriptSize<<1) : 0; |
||
5 | Plagman | 1393 | } |
1046 | terminx | 1394 | } |
1544 | terminx | 1395 | while (1); |
5 | Plagman | 1396 | } |
1397 | |||
1625 | terminx | 1398 | #define GetDefID(szGameLabel) hash_find(&h_gamevars,szGameLabel) |
1399 | #define GetADefID(szGameLabel) hash_find(&h_arrays,szGameLabel) |
||
1189 | terminx | 1400 | |
2640 | helixhorne | 1401 | static int32_t isaltok(const char c) |
5 | Plagman | 1402 | { |
1213 | terminx | 1403 | return (isalnum(c) || c == '{' || c == '}' || c == '/' || c == '\\' || |
1215 | terminx | 1404 | c == '*' || c == '-' || c == '_' || c == '.'); |
5 | Plagman | 1405 | } |
1406 | |||
4474 | helixhorne | 1407 | static int32_t C_IsLabelChar(const char c, int32_t i) |
1408 | { |
||
1409 | return (isalnum(c) || c=='_' || c=='*' || c=='?' || |
||
1410 | (i > 0 && (c=='+' || c=='-' || c=='.'))); |
||
1411 | } |
||
1412 | |||
1206 | terminx | 1413 | static inline int32_t C_GetLabelNameID(const memberlabel_t *pLabel, hashtable_t *tH, const char *psz) |
5 | Plagman | 1414 | { |
1415 | // find the label psz in the table pLabel. |
||
1416 | // returns the ID for the label, or -1 |
||
1417 | |||
1857 | terminx | 1418 | int32_t l = hash_findcase(tH,psz); |
1419 | return (l >= 0) ? pLabel[l].lId : -1; |
||
5 | Plagman | 1420 | } |
1421 | |||
1206 | terminx | 1422 | static inline int32_t C_GetLabelNameOffset(hashtable_t *tH, const char *psz) |
5 | Plagman | 1423 | { |
1424 | // find the label psz in the table pLabel. |
||
1425 | // returns the offset in the array for the label, or -1 |
||
1426 | |||
1206 | terminx | 1427 | return hash_findcase(tH,psz); |
5 | Plagman | 1428 | } |
1429 | |||
1143 | terminx | 1430 | static void C_GetNextLabelName(void) |
5 | Plagman | 1431 | { |
1857 | terminx | 1432 | int32_t i = 0; |
5 | Plagman | 1433 | |
1143 | terminx | 1434 | C_SkipComments(); |
5 | Plagman | 1435 | |
4474 | helixhorne | 1436 | // while (ispecial(*textptr) == 0 && *textptr!='['&& *textptr!=']' && *textptr!='\t' && *textptr!='\n' && *textptr!='\r') |
1437 | while (C_IsLabelChar(*textptr, i)) |
||
1143 | terminx | 1438 | label[(g_numLabels<<6)+(i++)] = *(textptr++); |
1857 | terminx | 1439 | label[(g_numLabels<<6)+i] = 0; |
5 | Plagman | 1440 | |
1857 | terminx | 1441 | if (!(g_numCompilerErrors|g_numCompilerWarnings) && g_scriptDebug > 1) |
1143 | terminx | 1442 | initprintf("%s:%d: debug: got label `%s'.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); |
5 | Plagman | 1443 | } |
1444 | |||
1205 | terminx | 1445 | static int32_t C_GetKeyword(void) |
5 | Plagman | 1446 | { |
1205 | terminx | 1447 | int32_t i; |
5 | Plagman | 1448 | char *temptextptr; |
1449 | |||
1143 | terminx | 1450 | C_SkipComments(); |
5 | Plagman | 1451 | |
1452 | temptextptr = textptr; |
||
1453 | |||
1857 | terminx | 1454 | if (*temptextptr == 0) // EOF |
1455 | return -2; |
||
1456 | |||
333 | terminx | 1457 | while (isaltok(*temptextptr) == 0) |
5 | Plagman | 1458 | { |
1459 | temptextptr++; |
||
333 | terminx | 1460 | if (*temptextptr == 0) |
5 | Plagman | 1461 | return 0; |
1462 | } |
||
1463 | |||
1464 | i = 0; |
||
333 | terminx | 1465 | while (isaltok(*temptextptr)) |
1034 | terminx | 1466 | tempbuf[i++] = *(temptextptr++); |
5 | Plagman | 1467 | tempbuf[i] = 0; |
1857 | terminx | 1468 | |
1625 | terminx | 1469 | return hash_find(&h_keywords,tempbuf); |
5 | Plagman | 1470 | } |
1471 | |||
1205 | terminx | 1472 | static int32_t C_GetNextKeyword(void) //Returns its code # |
5 | Plagman | 1473 | { |
1205 | terminx | 1474 | int32_t i, l; |
5 | Plagman | 1475 | |
1143 | terminx | 1476 | C_SkipComments(); |
5 | Plagman | 1477 | |
1544 | terminx | 1478 | if (*textptr == 0) // EOF |
1857 | terminx | 1479 | return -2; |
5 | Plagman | 1480 | |
1481 | l = 0; |
||
333 | terminx | 1482 | while (isaltok(*(textptr+l))) |
5 | Plagman | 1483 | { |
1484 | tempbuf[l] = textptr[l]; |
||
1485 | l++; |
||
1486 | } |
||
1487 | tempbuf[l] = 0; |
||
1488 | |||
4680 | terminx | 1489 | if (EDUKE32_PREDICT_TRUE((i = hash_find(&h_keywords,tempbuf)) >= 0)) |
5 | Plagman | 1490 | { |
1200 | terminx | 1491 | if (i == CON_LEFTBRACE || i == CON_RIGHTBRACE || i == CON_NULLOP) |
1201 | terminx | 1492 | *g_scriptPtr = i + (IFELSE_MAGIC<<12); |
1200 | terminx | 1493 | else *g_scriptPtr = i + (g_lineNumber<<12); |
1393 | terminx | 1494 | |
1450 | terminx | 1495 | bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); |
1024 | terminx | 1496 | textptr += l; |
1143 | terminx | 1497 | g_scriptPtr++; |
1393 | terminx | 1498 | |
1143 | terminx | 1499 | if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug) |
1500 | initprintf("%s:%d: debug: translating keyword `%s'.\n",g_szScriptFileName,g_lineNumber,keyw[i]); |
||
1024 | terminx | 1501 | return i; |
5 | Plagman | 1502 | } |
1503 | |||
1504 | textptr += l; |
||
1857 | terminx | 1505 | g_numCompilerErrors++; |
5 | Plagman | 1506 | |
4680 | terminx | 1507 | if (EDUKE32_PREDICT_FALSE((tempbuf[0] == '{' || tempbuf[0] == '}') && tempbuf[1] != 0)) |
5 | Plagman | 1508 | { |
1143 | terminx | 1509 | C_ReportError(-1); |
1857 | terminx | 1510 | initprintf("%s:%d: error: expected whitespace between `%c' and `%s'.\n",g_szScriptFileName,g_lineNumber,tempbuf[0],tempbuf+1); |
5 | Plagman | 1511 | } |
1143 | terminx | 1512 | else C_ReportError(ERROR_EXPECTEDKEYWORD); |
1857 | terminx | 1513 | |
5 | Plagman | 1514 | return -1; |
1515 | } |
||
1516 | |||
2392 | helixhorne | 1517 | static int32_t parse_decimal_number(void) // (textptr) |
1518 | { |
||
1519 | // decimal constants -- this is finicky business |
||
1520 | int64_t num = strtoll(textptr, NULL, 10); // assume long long to be int64_t |
||
1521 | |||
4680 | terminx | 1522 | if (EDUKE32_PREDICT_TRUE(num >= INT32_MIN && num <= INT32_MAX)) |
2392 | helixhorne | 1523 | { |
1524 | // all OK |
||
1525 | } |
||
4680 | terminx | 1526 | else if (EDUKE32_PREDICT_FALSE(num > INT32_MAX && num <= UINT32_MAX)) |
2392 | helixhorne | 1527 | { |
1528 | // Number interpreted as uint32, but packed as int32 (on 32-bit archs) |
||
1529 | // (CON code in the wild exists that does this). Note that such conversion |
||
1530 | // is implementation-defined (C99 6.3.1.3) but GCC does the 'expected' thing. |
||
2742 | helixhorne | 1531 | #if 0 |
2392 | helixhorne | 1532 | initprintf("%s:%d: warning: number greater than INT32_MAX converted to a negative one.\n", |
1533 | g_szScriptFileName,g_lineNumber); |
||
1534 | g_numCompilerWarnings++; |
||
2742 | helixhorne | 1535 | #endif |
2392 | helixhorne | 1536 | } |
1537 | else |
||
1538 | { |
||
1539 | // out of range, this is arguably worse |
||
1540 | |||
1541 | initprintf("%s:%d: warning: number out of the range of a 32-bit integer encountered.\n", |
||
1542 | g_szScriptFileName,g_lineNumber); |
||
1543 | g_numCompilerWarnings++; |
||
1544 | } |
||
1545 | |||
1546 | return (int32_t)num; |
||
1547 | } |
||
1548 | |||
2751 | helixhorne | 1549 | static int32_t parse_hex_constant(const char *hexnum) |
1550 | { |
||
1551 | int64_t x; |
||
1552 | sscanf(hexnum, "%" PRIx64 "", &x); |
||
1553 | |||
4680 | terminx | 1554 | if (EDUKE32_PREDICT_FALSE(x > UINT32_MAX)) |
2751 | helixhorne | 1555 | { |
1556 | initprintf("%s:%d: warning: number 0x%" PRIx64 " truncated to 32 bits.\n", |
||
1557 | g_szScriptFileName,g_lineNumber, x); |
||
1558 | g_numCompilerWarnings++; |
||
1559 | } |
||
1560 | |||
1561 | return x; |
||
1562 | } |
||
1563 | |||
1205 | terminx | 1564 | static void C_GetNextVarType(int32_t type) |
5 | Plagman | 1565 | { |
1205 | terminx | 1566 | int32_t i=0,f=0; |
5 | Plagman | 1567 | |
1143 | terminx | 1568 | C_SkipComments(); |
1605 | terminx | 1569 | |
1143 | terminx | 1570 | if (!type && !g_labelsOnly && (isdigit(*textptr) || ((*textptr == '-') && (isdigit(*(textptr+1)))))) |
5 | Plagman | 1571 | { |
1450 | terminx | 1572 | bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); |
2392 | helixhorne | 1573 | |
1574 | *g_scriptPtr++ = MAXGAMEVARS; |
||
1575 | |||
1576 | if (tolower(textptr[1])=='x') // hex constants |
||
2751 | helixhorne | 1577 | *g_scriptPtr = parse_hex_constant(textptr+2); |
622 | terminx | 1578 | else |
2392 | helixhorne | 1579 | *g_scriptPtr = parse_decimal_number(); |
1580 | |||
1581 | if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug) |
||
1582 | initprintf("%s:%d: debug: accepted constant %ld in place of gamevar.\n", |
||
1583 | g_szScriptFileName,g_lineNumber,(long)*g_scriptPtr); |
||
1584 | |||
1450 | terminx | 1585 | bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); |
1143 | terminx | 1586 | g_scriptPtr++; |
1213 | terminx | 1587 | #if 1 |
1588 | while (!ispecial(*textptr) && *textptr != ']') textptr++; |
||
1589 | #else |
||
1143 | terminx | 1590 | C_GetNextLabelName(); |
1213 | terminx | 1591 | #endif |
5 | Plagman | 1592 | return; |
1593 | } |
||
1034 | terminx | 1594 | else if ((*textptr == '-')/* && !isdigit(*(textptr+1))*/) |
5 | Plagman | 1595 | { |
4680 | terminx | 1596 | if (EDUKE32_PREDICT_FALSE(type)) |
5 | Plagman | 1597 | { |
1143 | terminx | 1598 | g_numCompilerErrors++; |
1599 | C_ReportError(ERROR_SYNTAXERROR); |
||
1600 | C_GetNextLabelName(); |
||
5 | Plagman | 1601 | return; |
1602 | } |
||
1605 | terminx | 1603 | |
4680 | terminx | 1604 | if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug) |
1605 | initprintf("%s:%d: debug: flagging gamevar as negative.\n", g_szScriptFileName, g_lineNumber); //,Batol(textptr)); |
||
1606 | f = (MAXGAMEVARS<<1); |
||
1607 | |||
1605 | terminx | 1608 | textptr++; |
5 | Plagman | 1609 | } |
2392 | helixhorne | 1610 | |
1143 | terminx | 1611 | C_GetNextLabelName(); |
676 | terminx | 1612 | |
4680 | terminx | 1613 | if (EDUKE32_PREDICT_FALSE(!g_skipKeywordCheck && hash_find(&h_keywords,label+(g_numLabels<<6))>=0)) |
1024 | terminx | 1614 | { |
1143 | terminx | 1615 | g_numCompilerErrors++; |
1616 | C_ReportError(ERROR_ISAKEYWORD); |
||
1024 | terminx | 1617 | return; |
1618 | } |
||
676 | terminx | 1619 | |
1143 | terminx | 1620 | C_SkipComments(); //skip comments and whitespace |
676 | terminx | 1621 | if ((*textptr == '[')) //read of array as a gamevar |
1622 | { |
||
1205 | terminx | 1623 | int32_t lLabelID = -1; |
1204 | terminx | 1624 | |
715 | terminx | 1625 | f |= (MAXGAMEVARS<<2); |
676 | terminx | 1626 | textptr++; |
1143 | terminx | 1627 | i=GetADefID(label+(g_numLabels<<6)); |
715 | terminx | 1628 | if (i < 0) |
676 | terminx | 1629 | { |
1204 | terminx | 1630 | i=GetDefID(label+(g_numLabels<<6)); |
1213 | terminx | 1631 | if (i < g_iSpriteVarID || i > g_iActorVarID) |
1204 | terminx | 1632 | i = -1; |
1633 | |||
4680 | terminx | 1634 | if (EDUKE32_PREDICT_FALSE(i < 0)) |
1204 | terminx | 1635 | { |
1636 | g_numCompilerErrors++; |
||
1637 | C_ReportError(ERROR_NOTAGAMEARRAY); |
||
1638 | return; |
||
1639 | } |
||
1640 | f &= ~(MAXGAMEVARS<<2); // not an array |
||
1641 | f |= (MAXGAMEVARS<<3); |
||
676 | terminx | 1642 | } |
1643 | |||
1450 | terminx | 1644 | bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); |
1143 | terminx | 1645 | *g_scriptPtr++=(i|f); |
1646 | C_GetNextVarType(0); |
||
1213 | terminx | 1647 | C_SkipComments(); |
715 | terminx | 1648 | |
4680 | terminx | 1649 | if (EDUKE32_PREDICT_FALSE(*textptr != ']')) |
676 | terminx | 1650 | { |
1143 | terminx | 1651 | g_numCompilerErrors++; |
1652 | C_ReportError(ERROR_GAMEARRAYBNC); |
||
676 | terminx | 1653 | return; |
1654 | } |
||
1655 | textptr++; |
||
1213 | terminx | 1656 | |
1657 | //writing arrays in this way is not supported because it would require too many changes to other code |
||
1658 | |||
4680 | terminx | 1659 | if (EDUKE32_PREDICT_FALSE(type)) |
676 | terminx | 1660 | { |
1143 | terminx | 1661 | g_numCompilerErrors++; |
1662 | C_ReportError(ERROR_INVALIDARRAYWRITE); |
||
676 | terminx | 1663 | return; |
1664 | } |
||
1204 | terminx | 1665 | |
1666 | if (f & (MAXGAMEVARS<<3)) |
||
1667 | { |
||
1668 | while (*textptr != '.') |
||
1669 | { |
||
1670 | if (*textptr == 0xa) |
||
1671 | break; |
||
1672 | if (!*textptr) |
||
1673 | break; |
||
1674 | |||
1675 | textptr++; |
||
1676 | } |
||
1677 | |||
4680 | terminx | 1678 | if (EDUKE32_PREDICT_FALSE(*textptr != '.')) |
1204 | terminx | 1679 | { |
1680 | g_numCompilerErrors++; |
||
1681 | C_ReportError(ERROR_SYNTAXERROR); |
||
1682 | return; |
||
1683 | } |
||
1684 | textptr++; |
||
1685 | /// now pointing at 'xxx' |
||
1686 | C_GetNextLabelName(); |
||
2538 | hendricks2 | 1687 | /*initprintf("found xxx label of \"%s\"\n", label+(g_numLabels<<6));*/ |
1204 | terminx | 1688 | |
1689 | if (i == g_iSpriteVarID) |
||
1642 | terminx | 1690 | lLabelID=C_GetLabelNameOffset(&actorH,Bstrtolower(label+(g_numLabels<<6))); |
1204 | terminx | 1691 | else if (i == g_iSectorVarID) |
1642 | terminx | 1692 | lLabelID=C_GetLabelNameOffset(§orH,Bstrtolower(label+(g_numLabels<<6))); |
1204 | terminx | 1693 | else if (i == g_iWallVarID) |
1642 | terminx | 1694 | lLabelID=C_GetLabelNameOffset(&wallH,Bstrtolower(label+(g_numLabels<<6))); |
1204 | terminx | 1695 | else if (i == g_iPlayerVarID) |
1642 | terminx | 1696 | lLabelID=C_GetLabelNameOffset(&playerH,Bstrtolower(label+(g_numLabels<<6))); |
1213 | terminx | 1697 | else if (i == g_iActorVarID) |
1698 | lLabelID=GetDefID(label+(g_numLabels<<6)); |
||
1207 | terminx | 1699 | |
1204 | terminx | 1700 | //printf("LabelID is %d\n",lLabelID); |
4680 | terminx | 1701 | if (EDUKE32_PREDICT_FALSE(lLabelID == -1)) |
1204 | terminx | 1702 | { |
1703 | g_numCompilerErrors++; |
||
1704 | C_ReportError(ERROR_SYMBOLNOTRECOGNIZED); |
||
1705 | return; |
||
1706 | } |
||
1707 | |||
1450 | terminx | 1708 | bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); |
1204 | terminx | 1709 | |
1710 | if (i == g_iSpriteVarID) |
||
1711 | { |
||
1712 | *g_scriptPtr++=ActorLabels[lLabelID].lId; |
||
1713 | |||
1714 | //printf("member's flags are: %02Xh\n",ActorLabels[lLabelID].flags); |
||
1715 | if (ActorLabels[lLabelID].flags & LABEL_HASPARM2) |
||
1716 | { |
||
1717 | //printf("Member has PARM2\n"); |
||
1718 | // get parm2 |
||
1719 | // get the ID of the DEF |
||
1720 | C_GetNextVarType(0); |
||
1721 | } |
||
1722 | } |
||
1213 | terminx | 1723 | else if (i == g_iSectorVarID) |
1724 | *g_scriptPtr++=SectorLabels[lLabelID].lId; |
||
1725 | else if (i == g_iWallVarID) |
||
1726 | *g_scriptPtr++=SectorLabels[lLabelID].lId; |
||
1204 | terminx | 1727 | else if (i == g_iPlayerVarID) |
1728 | { |
||
1729 | *g_scriptPtr++=PlayerLabels[lLabelID].lId; |
||
1730 | |||
1731 | //printf("member's flags are: %02Xh\n",ActorLabels[lLabelID].flags); |
||
1732 | if (PlayerLabels[lLabelID].flags & LABEL_HASPARM2) |
||
1733 | { |
||
1734 | //printf("Member has PARM2\n"); |
||
1735 | // get parm2 |
||
1736 | // get the ID of the DEF |
||
1737 | C_GetNextVarType(0); |
||
1738 | } |
||
1739 | } |
||
1213 | terminx | 1740 | else if (i == g_iActorVarID) |
1741 | *g_scriptPtr++=lLabelID; |
||
1204 | terminx | 1742 | } |
676 | terminx | 1743 | return; |
1744 | } |
||
1745 | // initprintf("not an array"); |
||
1143 | terminx | 1746 | i=GetDefID(label+(g_numLabels<<6)); |
676 | terminx | 1747 | if (i<0) //gamevar not found |
5 | Plagman | 1748 | { |
1143 | terminx | 1749 | if (!type && !g_labelsOnly) |
5 | Plagman | 1750 | { |
676 | terminx | 1751 | //try looking for a define instead |
1143 | terminx | 1752 | Bstrcpy(tempbuf,label+(g_numLabels<<6)); |
1625 | terminx | 1753 | i = hash_find(&h_labels,tempbuf); |
4680 | terminx | 1754 | if (EDUKE32_PREDICT_TRUE(i>=0)) |
5 | Plagman | 1755 | { |
4680 | terminx | 1756 | if (EDUKE32_PREDICT_TRUE(labeltype[i] & LABEL_DEFINE)) |
5 | Plagman | 1757 | { |
1143 | terminx | 1758 | if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug) |
1759 | initprintf("%s:%d: debug: accepted defined label `%s' instead of gamevar.\n",g_szScriptFileName,g_lineNumber,label+(i<<6)); |
||
1450 | terminx | 1760 | bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); |
2185 | helixhorne | 1761 | *g_scriptPtr++ = MAXGAMEVARS; |
1450 | terminx | 1762 | bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); |
2185 | helixhorne | 1763 | *g_scriptPtr++ = labelcode[i]; |
5 | Plagman | 1764 | return; |
1765 | } |
||
1766 | } |
||
1143 | terminx | 1767 | g_numCompilerErrors++; |
1768 | C_ReportError(ERROR_NOTAGAMEVAR); |
||
5 | Plagman | 1769 | return; |
1770 | } |
||
1143 | terminx | 1771 | g_numCompilerErrors++; |
1772 | C_ReportError(ERROR_NOTAGAMEVAR); |
||
437 | terminx | 1773 | textptr++; |
1774 | return; |
||
676 | terminx | 1775 | |
5 | Plagman | 1776 | } |
4680 | terminx | 1777 | if (EDUKE32_PREDICT_FALSE(type == GAMEVAR_READONLY && aGameVars[i].dwFlags & GAMEVAR_READONLY)) |
5 | Plagman | 1778 | { |
1143 | terminx | 1779 | g_numCompilerErrors++; |
1780 | C_ReportError(ERROR_VARREADONLY); |
||
5 | Plagman | 1781 | return; |
1782 | } |
||
4680 | terminx | 1783 | else if (EDUKE32_PREDICT_FALSE(aGameVars[i].dwFlags & type)) |
5 | Plagman | 1784 | { |
1143 | terminx | 1785 | g_numCompilerErrors++; |
1786 | C_ReportError(ERROR_VARTYPEMISMATCH); |
||
5 | Plagman | 1787 | return; |
1788 | } |
||
1857 | terminx | 1789 | |
1143 | terminx | 1790 | if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1) |
1791 | initprintf("%s:%d: debug: accepted gamevar `%s'.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); |
||
715 | terminx | 1792 | |
1450 | terminx | 1793 | bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); |
1143 | terminx | 1794 | *g_scriptPtr++=(i|f); |
5 | Plagman | 1795 | } |
1796 | |||
1206 | terminx | 1797 | #define C_GetNextVar() C_GetNextVarType(0) |
5 | Plagman | 1798 | |
1205 | terminx | 1799 | static inline void C_GetManyVarsType(int32_t type, int32_t num) |
5 | Plagman | 1800 | { |
1205 | terminx | 1801 | int32_t i; |
1229 | terminx | 1802 | for (i=num-1; i>=0; i--) |
1143 | terminx | 1803 | C_GetNextVarType(type); |
5 | Plagman | 1804 | } |
1805 | |||
1206 | terminx | 1806 | #define C_GetManyVars(num) C_GetManyVarsType(0,num) |
5 | Plagman | 1807 | |
2766 | helixhorne | 1808 | // returns: |
1809 | // -1 on EOF or wrong type or error |
||
1810 | // 0 if literal value |
||
1811 | // LABEL_* (>0) if that type and matched |
||
1812 | // |
||
1813 | // *g_scriptPtr will contain the value OR 0 if wrong type or error |
||
1205 | terminx | 1814 | static int32_t C_GetNextValue(int32_t type) |
5 | Plagman | 1815 | { |
1205 | terminx | 1816 | int32_t i, l; |
5 | Plagman | 1817 | |
1143 | terminx | 1818 | C_SkipComments(); |
5 | Plagman | 1819 | |
1544 | terminx | 1820 | if (*textptr == 0) // EOF |
1821 | return -1; |
||
5 | Plagman | 1822 | |
1823 | l = 0; |
||
333 | terminx | 1824 | while (isaltok(*(textptr+l))) |
5 | Plagman | 1825 | { |
1826 | tempbuf[l] = textptr[l]; |
||
1827 | l++; |
||
1828 | } |
||
1829 | tempbuf[l] = 0; |
||
1830 | |||
4680 | terminx | 1831 | if (EDUKE32_PREDICT_FALSE(!g_skipKeywordCheck && hash_find(&h_keywords,tempbuf /*label+(g_numLabels<<6)*/)>=0)) |
1024 | terminx | 1832 | { |
1143 | terminx | 1833 | g_numCompilerErrors++; |
1834 | C_ReportError(ERROR_ISAKEYWORD); |
||
1024 | terminx | 1835 | textptr+=l; |
1836 | } |
||
121 | terminx | 1837 | |
1625 | terminx | 1838 | i = hash_find(&h_labels,tempbuf); |
1024 | terminx | 1839 | if (i>=0) |
5 | Plagman | 1840 | { |
1024 | terminx | 1841 | char *el,*gl; |
1842 | |||
4680 | terminx | 1843 | if (EDUKE32_PREDICT_TRUE(labeltype[i] & type)) |
5 | Plagman | 1844 | { |
1143 | terminx | 1845 | if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1) |
5 | Plagman | 1846 | { |
1143 | terminx | 1847 | gl = (char *)C_GetLabelType(labeltype[i]); |
1848 | initprintf("%s:%d: debug: accepted %s label `%s'.\n",g_szScriptFileName,g_lineNumber,gl,label+(i<<6)); |
||
1024 | terminx | 1849 | Bfree(gl); |
5 | Plagman | 1850 | } |
2150 | helixhorne | 1851 | |
2185 | helixhorne | 1852 | bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); |
1853 | *(g_scriptPtr++) = labelcode[i]; |
||
2451 | helixhorne | 1854 | |
5 | Plagman | 1855 | textptr += l; |
1024 | terminx | 1856 | return labeltype[i]; |
5 | Plagman | 1857 | } |
4680 | terminx | 1858 | |
1450 | terminx | 1859 | bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); |
1143 | terminx | 1860 | *(g_scriptPtr++) = 0; |
1024 | terminx | 1861 | textptr += l; |
1143 | terminx | 1862 | el = (char *)C_GetLabelType(type); |
1863 | gl = (char *)C_GetLabelType(labeltype[i]); |
||
1864 | C_ReportError(-1); |
||
1206 | terminx | 1865 | initprintf("%s:%d: warning: expected %s, found %s.\n",g_szScriptFileName,g_lineNumber,el,gl); |
1143 | terminx | 1866 | g_numCompilerWarnings++; |
1024 | terminx | 1867 | Bfree(el); |
1868 | Bfree(gl); |
||
1869 | return -1; // valid label name, but wrong type |
||
5 | Plagman | 1870 | } |
1871 | |||
4680 | terminx | 1872 | if (EDUKE32_PREDICT_FALSE(isdigit(*textptr) == 0 && *textptr != '-')) |
5 | Plagman | 1873 | { |
1143 | terminx | 1874 | C_ReportError(ERROR_PARAMUNDEFINED); |
1875 | g_numCompilerErrors++; |
||
1450 | terminx | 1876 | bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); |
1143 | terminx | 1877 | *g_scriptPtr = 0; |
1878 | g_scriptPtr++; |
||
5 | Plagman | 1879 | textptr+=l; |
1880 | return -1; // error! |
||
1881 | } |
||
1882 | |||
4680 | terminx | 1883 | if (EDUKE32_PREDICT_FALSE(isdigit(*textptr) && g_labelsOnly)) |
5 | Plagman | 1884 | { |
1143 | terminx | 1885 | C_ReportError(WARNING_LABELSONLY); |
1886 | g_numCompilerWarnings++; |
||
5 | Plagman | 1887 | } |
1189 | terminx | 1888 | |
1889 | i = l-1; |
||
1890 | do |
||
1891 | { |
||
1207 | terminx | 1892 | // FIXME: check for 0-9 A-F for hex |
1198 | terminx | 1893 | if (textptr[0] == '0' && textptr[1] == 'x') break; // kill the warning for hex |
4680 | terminx | 1894 | if (EDUKE32_PREDICT_FALSE(!isdigit(textptr[i--]))) |
1189 | terminx | 1895 | { |
1896 | C_ReportError(-1); |
||
1206 | terminx | 1897 | initprintf("%s:%d: warning: invalid character `%c' in definition!\n",g_szScriptFileName,g_lineNumber,textptr[i+1]); |
1189 | terminx | 1898 | g_numCompilerWarnings++; |
1899 | break; |
||
1900 | } |
||
1901 | } |
||
1902 | while (i > 0); |
||
1903 | |||
1450 | terminx | 1904 | bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); |
1189 | terminx | 1905 | |
1906 | if (tolower(textptr[1])=='x') |
||
2751 | helixhorne | 1907 | *g_scriptPtr = parse_hex_constant(textptr+2); |
622 | terminx | 1908 | else |
2392 | helixhorne | 1909 | *g_scriptPtr = parse_decimal_number(); |
1189 | terminx | 1910 | |
2392 | helixhorne | 1911 | if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1) |
1912 | initprintf("%s:%d: debug: accepted constant %ld.\n", |
||
1913 | g_szScriptFileName,g_lineNumber,(long)*g_scriptPtr); |
||
1914 | |||
1143 | terminx | 1915 | g_scriptPtr++; |
5 | Plagman | 1916 | |
1917 | textptr += l; |
||
1918 | |||
1919 | return 0; // literal value |
||
1920 | } |
||
1921 | |||
1436 | terminx | 1922 | static inline int32_t C_IntPow2(int32_t v) |
1923 | { |
||
1440 | terminx | 1924 | return ((v!=0) && (v&(v-1))==0); |
1436 | terminx | 1925 | } |
1926 | |||
1927 | static inline uint32_t C_Pow2IntLogBase2(int32_t v) |
||
1928 | { |
||
1440 | terminx | 1929 | static const uint32_t b[] = {0xAAAAAAAA, 0xCCCCCCCC, 0xF0F0F0F0, |
1930 | 0xFF00FF00, 0xFFFF0000 |
||
1931 | }; |
||
1932 | register uint32_t r = (v & b[0]) != 0; |
||
1933 | int32_t i = 4; |
||
1934 | |||
1935 | for (; i > 0; i--) |
||
1936 | r |= ((v & b[i]) != 0) << i; |
||
1937 | |||
1938 | return r; |
||
1436 | terminx | 1939 | } |
1940 | |||
1435 | terminx | 1941 | static int32_t C_CheckMalformedBranch(intptr_t lastScriptPtr) |
1942 | { |
||
1943 | switch (C_GetKeyword()) |
||
1944 | { |
||
1945 | case CON_RIGHTBRACE: |
||
1946 | case CON_ENDA: |
||
1947 | case CON_ENDEVENT: |
||
1948 | case CON_ENDS: |
||
1436 | terminx | 1949 | case CON_ELSE: |
1435 | terminx | 1950 | g_scriptPtr = lastScriptPtr + &script[0]; |
1951 | g_ifElseAborted = 1; |
||
1952 | C_ReportError(-1); |
||
1953 | g_numCompilerWarnings++; |
||
1954 | initprintf("%s:%d: warning: malformed `%s' branch\n",g_szScriptFileName,g_lineNumber, |
||
1440 | terminx | 1955 | keyw[*(g_scriptPtr) & 0xFFF]); |
1435 | terminx | 1956 | return 1; |
1957 | } |
||
1958 | return 0; |
||
1959 | } |
||
1960 | |||
1205 | terminx | 1961 | static int32_t C_CheckEmptyBranch(int32_t tw, intptr_t lastScriptPtr) |
1200 | terminx | 1962 | { |
2149 | helixhorne | 1963 | // ifrnd and the others actually do something when the condition is executed |
1202 | terminx | 1964 | if ((Bstrncmp(keyw[tw], "if", 2) && tw != CON_ELSE) || |
2149 | helixhorne | 1965 | tw == CON_IFRND || tw == CON_IFHITWEAPON || tw == CON_IFCANSEE || tw == CON_IFCANSEETARGET || |
1966 | tw == CON_IFPDISTL || tw == CON_IFPDISTG || tw == CON_IFGOTWEAPONCE) |
||
1200 | terminx | 1967 | { |
1968 | g_ifElseAborted = 0; |
||
1969 | return 0; |
||
1970 | } |
||
1971 | |||
1201 | terminx | 1972 | if ((*(g_scriptPtr) & 0xFFF) != CON_NULLOP || *(g_scriptPtr)>>12 != IFELSE_MAGIC) |
1200 | terminx | 1973 | g_ifElseAborted = 0; |
1974 | |||
4680 | terminx | 1975 | if (EDUKE32_PREDICT_FALSE(g_ifElseAborted)) |
1200 | terminx | 1976 | { |
1201 | terminx | 1977 | C_ReportError(-1); |
1978 | g_numCompilerWarnings++; |
||
1200 | terminx | 1979 | g_scriptPtr = lastScriptPtr + &script[0]; |
1201 | terminx | 1980 | initprintf("%s:%d: warning: empty `%s' branch\n",g_szScriptFileName,g_lineNumber, |
1200 | terminx | 1981 | keyw[*(g_scriptPtr) & 0xFFF]); |
1435 | terminx | 1982 | *(g_scriptPtr) = (CON_NULLOP + (IFELSE_MAGIC<<12)); |
1200 | terminx | 1983 | return 1; |
1984 | } |
||
1985 | return 0; |
||
1986 | } |
||
1987 | |||
1205 | terminx | 1988 | static int32_t C_CountCaseStatements() |
5 | Plagman | 1989 | { |
1205 | terminx | 1990 | int32_t lCount; |
437 | terminx | 1991 | char *temptextptr = textptr; |
1205 | terminx | 1992 | int32_t temp_ScriptLineNumber = g_lineNumber; |
1143 | terminx | 1993 | intptr_t scriptoffset = (unsigned)(g_scriptPtr-script); |
1994 | intptr_t caseoffset = (unsigned)(g_caseScriptPtr-script); |
||
1205 | terminx | 1995 | // int32_t i; |
5 | Plagman | 1996 | |
1143 | terminx | 1997 | g_numCases=0; |
1998 | g_caseScriptPtr=NULL; |
||
5 | Plagman | 1999 | //Bsprintf(g_szBuf,"CSS: %.12s",textptr); |
2000 | //AddLog(g_szBuf); |
||
1891 | terminx | 2001 | C_ParseCommand(1); |
1143 | terminx | 2002 | // since we processed the endswitch, we need to re-increment g_checkingSwitch |
2003 | g_checkingSwitch++; |
||
5 | Plagman | 2004 | |
2005 | textptr=temptextptr; |
||
1143 | terminx | 2006 | g_scriptPtr = (intptr_t *)(script+scriptoffset); |
5 | Plagman | 2007 | |
1143 | terminx | 2008 | g_lineNumber = temp_ScriptLineNumber; |
5 | Plagman | 2009 | |
1143 | terminx | 2010 | lCount=g_numCases; |
2011 | g_numCases=0; |
||
2012 | g_caseScriptPtr = (intptr_t *)(script+caseoffset); |
||
2013 | g_numCases = 0; |
||
5 | Plagman | 2014 | return lCount; |
2015 | } |
||
2016 | |||
1937 | hendricks2 | 2017 | static void C_Include(const char *confile) |
2018 | { |
||
2019 | int32_t temp_ScriptLineNumber; |
||
2020 | int32_t temp_ifelse_check; |
||
2021 | int32_t j; |
||
2022 | char *origtptr, *mptr; |
||
2023 | char parentScriptFileName[255]; |
||
2024 | int32_t fp; |
||
2025 | |||
2026 | fp = kopen4loadfrommod(confile,g_loadFromGroupOnly); |
||
4680 | terminx | 2027 | if (EDUKE32_PREDICT_FALSE(fp < 0)) |
1937 | hendricks2 | 2028 | { |
2029 | g_numCompilerErrors++; |
||
2030 | initprintf("%s:%d: error: could not find file `%s'.\n",g_szScriptFileName,g_lineNumber,confile); |
||
2031 | return; |
||
2032 | } |
||
2033 | |||
2034 | j = kfilelength(fp); |
||
2035 | |||
4491 | helixhorne | 2036 | mptr = (char *)Xmalloc(j+1); |
1937 | hendricks2 | 2037 | |
2038 | initprintf("Including: %s (%d bytes)\n",confile, j); |
||
2039 | kread(fp, mptr, j); |
||
2040 | kclose(fp); |
||
2041 | mptr[j] = 0; |
||
2042 | |||
2043 | if (*textptr == '"') // skip past the closing quote if it's there so we don't screw up the next line |
||
2044 | textptr++; |
||
2045 | origtptr = textptr; |
||
2046 | |||
2047 | Bstrcpy(parentScriptFileName, g_szScriptFileName); |
||
2048 | Bstrcpy(g_szScriptFileName, confile); |
||
2049 | temp_ScriptLineNumber = g_lineNumber; |
||
2050 | g_lineNumber = 1; |
||
2051 | temp_ifelse_check = g_checkingIfElse; |
||
2052 | g_checkingIfElse = 0; |
||
2053 | |||
2054 | textptr = mptr; |
||
2055 | |||
2056 | C_SkipComments(); |
||
2057 | |||
2058 | C_ParseCommand(1); |
||
2059 | |||
2060 | Bstrcpy(g_szScriptFileName, parentScriptFileName); |
||
2061 | g_totalLines += g_lineNumber; |
||
2062 | g_lineNumber = temp_ScriptLineNumber; |
||
2063 | g_checkingIfElse = temp_ifelse_check; |
||
2064 | |||
2065 | textptr = origtptr; |
||
2066 | |||
2067 | Bfree(mptr); |
||
2068 | } |
||
3410 | helixhorne | 2069 | #endif // !defined LUNATIC |
1937 | hendricks2 | 2070 | |
2704 | helixhorne | 2071 | #ifdef _WIN32 |
2072 | static void check_filename_case(const char *fn) |
||
2073 | { |
||
2074 | int32_t fp; |
||
2075 | if ((fp = kopen4loadfrommod(fn, g_loadFromGroupOnly)) >= 0) |
||
2076 | kclose(fp); |
||
2077 | } |
||
2078 | #else |
||
2079 | static void check_filename_case(const char *fn) { UNREFERENCED_PARAMETER(fn); } |
||
2080 | #endif |
||
2081 | |||
3343 | helixhorne | 2082 | void G_DoGameStartup(const int32_t *params) |
2083 | { |
||
2084 | int32_t j = 0; |
||
2085 | |||
2086 | ud.const_visibility = params[j++]; |
||
2087 | g_impactDamage = params[j++]; |
||
2088 | g_maxPlayerHealth = g_player[0].ps->max_player_health = g_player[0].ps->max_shield_amount = params[j++]; |
||
2089 | g_startArmorAmount = params[j++]; |
||
2090 | g_actorRespawnTime = params[j++]; |
||
3803 | terminx | 2091 | |
2092 | if (g_scriptVersion >= 11) |
||
2093 | g_itemRespawnTime = params[j++]; |
||
2094 | else |
||
2095 | g_itemRespawnTime = g_actorRespawnTime; |
||
2096 | |||
2097 | if (g_scriptVersion >= 11) |
||
2098 | g_playerFriction = params[j++]; |
||
2099 | |||
2100 | if (g_scriptVersion == 14) |
||
2101 | g_spriteGravity = params[j++]; |
||
2102 | |||
2103 | if (g_scriptVersion >= 11) |
||
2104 | { |
||
2105 | g_rpgBlastRadius = params[j++]; |
||
2106 | g_pipebombBlastRadius = params[j++]; |
||
2107 | g_shrinkerBlastRadius = params[j++]; |
||
2108 | g_tripbombBlastRadius = params[j++]; |
||
2109 | g_morterBlastRadius = params[j++]; |
||
2110 | g_bouncemineBlastRadius = params[j++]; |
||
2111 | g_seenineBlastRadius = params[j++]; |
||
2112 | } |
||
2113 | |||
3343 | helixhorne | 2114 | g_player[0].ps->max_ammo_amount[PISTOL_WEAPON] = params[j++]; |
2115 | g_player[0].ps->max_ammo_amount[SHOTGUN_WEAPON] = params[j++]; |
||
2116 | g_player[0].ps->max_ammo_amount[CHAINGUN_WEAPON] = params[j++]; |
||
2117 | g_player[0].ps->max_ammo_amount[RPG_WEAPON] = params[j++]; |
||
2118 | g_player[0].ps->max_ammo_amount[HANDBOMB_WEAPON] = params[j++]; |
||
2119 | g_player[0].ps->max_ammo_amount[SHRINKER_WEAPON] = params[j++]; |
||
2120 | g_player[0].ps->max_ammo_amount[DEVISTATOR_WEAPON] = params[j++]; |
||
2121 | g_player[0].ps->max_ammo_amount[TRIPBOMB_WEAPON] = params[j++]; |
||
3803 | terminx | 2122 | |
2123 | if (g_scriptVersion >= 13) |
||
3343 | helixhorne | 2124 | { |
3803 | terminx | 2125 | g_player[0].ps->max_ammo_amount[FREEZE_WEAPON] = params[j++]; |
3343 | helixhorne | 2126 | |
3803 | terminx | 2127 | if (g_scriptVersion == 14) |
2128 | g_player[0].ps->max_ammo_amount[GROW_WEAPON] = params[j++]; |
||
2129 | |||
2130 | g_damageCameras = params[j++]; |
||
2131 | g_numFreezeBounces = params[j++]; |
||
2132 | g_freezerSelfDamage = params[j++]; |
||
2133 | |||
2134 | if (g_scriptVersion == 14) |
||
2135 | { |
||
2136 | g_spriteDeleteQueueSize = params[j++]; |
||
2137 | g_spriteDeleteQueueSize = clamp(g_spriteDeleteQueueSize, 0, 1024); |
||
2138 | |||
2139 | g_tripbombLaserMode = params[j++]; |
||
2140 | } |
||
3343 | helixhorne | 2141 | } |
2142 | } |
||
2143 | |||
4586 | helixhorne | 2144 | void C_DefineMusic(int32_t vol, int32_t lev, const char *fn) |
2145 | { |
||
4588 | helixhorne | 2146 | Bassert((unsigned)vol < MAXVOLUMES+1); |
2147 | Bassert((unsigned)lev < MAXLEVELS); |
||
4586 | helixhorne | 2148 | |
2149 | { |
||
4588 | helixhorne | 2150 | map_t *const map = &MapInfo[(MAXLEVELS*vol)+lev]; |
4586 | helixhorne | 2151 | |
4588 | helixhorne | 2152 | Bfree(map->musicfn); |
2153 | map->musicfn = dup_filename(fn); |
||
2154 | check_filename_case(map->musicfn); |
||
4586 | helixhorne | 2155 | } |
2156 | } |
||
2157 | |||
3355 | helixhorne | 2158 | #ifdef LUNATIC |
2159 | void C_DefineSound(int32_t sndidx, const char *fn, int32_t args[5]) |
||
2160 | { |
||
2161 | Bassert((unsigned)sndidx < MAXSOUNDS); |
||
2162 | |||
2163 | { |
||
2164 | sound_t *const snd = &g_sounds[sndidx]; |
||
2165 | |||
2166 | Bfree(snd->filename); |
||
2167 | snd->filename = dup_filename(fn); |
||
2168 | check_filename_case(snd->filename); |
||
2169 | |||
2170 | snd->ps = args[0]; |
||
2171 | snd->pe = args[1]; |
||
2172 | snd->pr = args[2]; |
||
4067 | helixhorne | 2173 | snd->m = args[3] & ~SF_ONEINST_INTERNAL; |
2174 | if (args[3] & SF_LOOP) |
||
2175 | snd->m |= SF_ONEINST_INTERNAL; |
||
3355 | helixhorne | 2176 | snd->vo = args[4]; |
2177 | |||
2178 | if (sndidx > g_maxSoundPos) |
||
2179 | g_maxSoundPos = sndidx; |
||
2180 | } |
||
2181 | } |
||
3357 | helixhorne | 2182 | |
2183 | void C_DefineQuote(int32_t qnum, const char *qstr) |
||
2184 | { |
||
2185 | C_AllocQuote(qnum); |
||
2186 | Bstrncpyz(ScriptQuotes[qnum], qstr, MAXQUOTELEN); |
||
2187 | } |
||
3373 | helixhorne | 2188 | |
2189 | void C_DefineVolumeName(int32_t vol, const char *name) |
||
2190 | { |
||
2191 | Bassert((unsigned)vol < MAXVOLUMES); |
||
2192 | Bstrncpyz(EpisodeNames[vol], name, sizeof(EpisodeNames[vol])); |
||
2193 | g_numVolumes = max(g_numVolumes, vol+1); |
||
2194 | } |
||
2195 | |||
3375 | helixhorne | 2196 | void C_DefineSkillName(int32_t skill, const char *name) |
2197 | { |
||
2198 | Bassert((unsigned)skill < MAXSKILLS); |
||
2199 | Bstrncpyz(SkillNames[skill], name, sizeof(SkillNames[skill])); |
||
2200 | g_numSkills = max(g_numSkills, skill+1); |
||
2201 | } |
||
2202 | |||
3373 | helixhorne | 2203 | void C_DefineLevelName(int32_t vol, int32_t lev, const char *fn, |
2204 | int32_t partime, int32_t designertime, |
||
2205 | const char *levelname) |
||
2206 | { |
||
2207 | Bassert((unsigned)vol < MAXVOLUMES); |
||
2208 | Bassert((unsigned)lev < MAXLEVELS); |
||
2209 | |||
2210 | { |
||
2211 | map_t *const map = &MapInfo[(MAXLEVELS*vol)+lev]; |
||
2212 | |||
2213 | Bfree(map->filename); |
||
2214 | map->filename = dup_filename(fn); |
||
2215 | |||
2216 | // TODO: truncate to 32 chars? |
||
2217 | Bfree(map->name); |
||
4491 | helixhorne | 2218 | map->name = Xstrdup(levelname); |
3373 | helixhorne | 2219 | |
2220 | map->partime = REALGAMETICSPERSEC * partime; |
||
2221 | map->designertime = REALGAMETICSPERSEC * designertime; |
||
2222 | } |
||
2223 | } |
||
3516 | helixhorne | 2224 | |
2225 | void C_DefineGameFuncName(int32_t idx, const char *name) |
||
2226 | { |
||
3826 | helixhorne | 2227 | assert((unsigned)idx < NUMGAMEFUNCTIONS); |
3516 | helixhorne | 2228 | |
2229 | Bstrncpyz(gamefunctions[idx], name, MAXGAMEFUNCLEN); |
||
2230 | Bstrncpyz(keydefaults[3*idx], name, MAXGAMEFUNCLEN); |
||
3530 | helixhorne | 2231 | |
2232 | hash_add(&h_gamefuncs, gamefunctions[idx], idx, 0); |
||
3516 | helixhorne | 2233 | } |
< |