Rev 5045 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3454 | helixhorne | 1 | -- CON language definitions |
2594 | helixhorne | 2 | |
3454 | helixhorne | 3 | local lpeg = require("lpeg") |
2762 | helixhorne | 4 | |
3454 | helixhorne | 5 | local pairs = pairs |
6 | local print = print |
||
3597 | helixhorne | 7 | local setmetatable = setmetatable |
3454 | helixhorne | 8 | local type = type |
2762 | helixhorne | 9 | |
3454 | helixhorne | 10 | |
2863 | helixhorne | 11 | module(...) |
2763 | helixhorne | 12 | |
2764 | helixhorne | 13 | |
2863 | helixhorne | 14 | MAXVOLUMES = 7 |
15 | MAXLEVELS = 64 |
||
3826 | helixhorne | 16 | MAXGAMETYPES = 16 |
2764 | helixhorne | 17 | |
2863 | helixhorne | 18 | MAXSKILLS = 7 |
2764 | helixhorne | 19 | |
2863 | helixhorne | 20 | MAXSOUNDS = 4096 |
21 | |||
4112 | helixhorne | 22 | MAXSESSIONVARS = 8 -- KEEPINSYNC lunatic_game.c |
23 | |||
3357 | helixhorne | 24 | -- KEEPINSYNC quotes.h |
3653 | helixhorne | 25 | |
26 | -- For Lunatic, MAXQUOTES is OBITQUOTEINDEX because starting from that index |
||
27 | -- are obituary and suicide quotes which are passed as *format strings* to |
||
28 | -- sprintf() in C. |
||
3656 | helixhorne | 29 | REALMAXQUOTES = 16384 |
30 | MAXQUOTES = REALMAXQUOTES-128 |
||
3357 | helixhorne | 31 | MAXQUOTELEN = 128 |
2863 | helixhorne | 32 | |
3366 | helixhorne | 33 | local STR = { |
34 | STR_MAPNAME = 0, |
||
35 | STR_MAPFILENAME = 1, |
||
36 | STR_PLAYERNAME = 2, |
||
37 | STR_VERSION = 3, |
||
38 | STR_GAMETYPE = 4, |
||
39 | STR_VOLUMENAME = 5, |
||
4969 | hendricks2 | 40 | STR_YOURTIME = 6, |
41 | STR_PARTIME = 7, |
||
42 | STR_DESIGNERTIME = 8, |
||
43 | STR_BESTTIME = 9, |
||
3366 | helixhorne | 44 | } |
3357 | helixhorne | 45 | |
3366 | helixhorne | 46 | PROJ = { |
47 | PROJ_WORKSLIKE = 0, |
||
48 | PROJ_SPAWNS = 1, |
||
49 | PROJ_SXREPEAT = 2, |
||
50 | PROJ_SYREPEAT = 3, |
||
51 | PROJ_SOUND = 4, |
||
52 | PROJ_ISOUND = 5, |
||
53 | PROJ_VEL = 6, |
||
54 | PROJ_EXTRA = 7, |
||
55 | PROJ_DECAL = 8, |
||
56 | PROJ_TRAIL = 9, |
||
57 | PROJ_TXREPEAT = 10, |
||
58 | PROJ_TYREPEAT = 11, |
||
59 | PROJ_TOFFSET = 12, |
||
60 | PROJ_TNUM = 13, |
||
61 | PROJ_DROP = 14, |
||
62 | PROJ_CSTAT = 15, |
||
63 | PROJ_CLIPDIST = 16, |
||
64 | PROJ_SHADE = 17, |
||
65 | PROJ_XREPEAT = 18, |
||
66 | PROJ_YREPEAT = 19, |
||
67 | PROJ_PAL = 20, |
||
68 | PROJ_EXTRA_RAND = 21, |
||
69 | PROJ_HITRADIUS = 22, |
||
3463 | helixhorne | 70 | PROJ_VEL_MULT = 23, -- NAME (PROJ_MOVECNT) |
3366 | helixhorne | 71 | PROJ_OFFSET = 24, |
72 | PROJ_BOUNCES = 25, |
||
73 | PROJ_BSOUND = 26, |
||
74 | PROJ_RANGE = 27, |
||
75 | PROJ_FLASH_COLOR = 28, |
||
3866 | helixhorne | 76 | PROJ_USERDATA = 29, |
3366 | helixhorne | 77 | } |
78 | |||
79 | EVENT = { |
||
80 | EVENT_INIT = 0, |
||
81 | EVENT_ENTERLEVEL = 1, |
||
82 | EVENT_RESETWEAPONS = 2, |
||
83 | EVENT_RESETINVENTORY = 3, |
||
84 | EVENT_HOLSTER = 4, |
||
85 | EVENT_LOOKLEFT = 5, |
||
86 | EVENT_LOOKRIGHT = 6, |
||
87 | EVENT_SOARUP = 7, |
||
88 | EVENT_SOARDOWN = 8, |
||
89 | EVENT_CROUCH = 9, |
||
90 | EVENT_JUMP = 10, |
||
91 | EVENT_RETURNTOCENTER = 11, |
||
92 | EVENT_LOOKUP = 12, |
||
93 | EVENT_LOOKDOWN = 13, |
||
94 | EVENT_AIMUP = 14, |
||
95 | EVENT_FIRE = 15, |
||
96 | EVENT_CHANGEWEAPON = 16, |
||
97 | EVENT_GETSHOTRANGE = 17, |
||
98 | EVENT_GETAUTOAIMANGLE = 18, |
||
99 | EVENT_GETLOADTILE = 19, |
||
100 | EVENT_CHEATGETSTEROIDS = 20, |
||
101 | EVENT_CHEATGETHEAT = 21, |
||
102 | EVENT_CHEATGETBOOT = 22, |
||
103 | EVENT_CHEATGETSHIELD = 23, |
||
104 | EVENT_CHEATGETSCUBA = 24, |
||
105 | EVENT_CHEATGETHOLODUKE = 25, |
||
106 | EVENT_CHEATGETJETPACK = 26, |
||
107 | EVENT_CHEATGETFIRSTAID = 27, |
||
108 | EVENT_QUICKKICK = 28, |
||
109 | EVENT_INVENTORY = 29, |
||
110 | EVENT_USENIGHTVISION = 30, |
||
111 | EVENT_USESTEROIDS = 31, |
||
112 | EVENT_INVENTORYLEFT = 32, |
||
113 | EVENT_INVENTORYRIGHT = 33, |
||
114 | EVENT_HOLODUKEON = 34, |
||
115 | EVENT_HOLODUKEOFF = 35, |
||
116 | EVENT_USEMEDKIT = 36, |
||
117 | EVENT_USEJETPACK = 37, |
||
118 | EVENT_TURNAROUND = 38, |
||
119 | EVENT_DISPLAYWEAPON = 39, |
||
120 | EVENT_FIREWEAPON = 40, |
||
121 | EVENT_SELECTWEAPON = 41, |
||
122 | EVENT_MOVEFORWARD = 42, |
||
123 | EVENT_MOVEBACKWARD = 43, |
||
124 | EVENT_TURNLEFT = 44, |
||
125 | EVENT_TURNRIGHT = 45, |
||
126 | EVENT_STRAFELEFT = 46, |
||
127 | EVENT_STRAFERIGHT = 47, |
||
128 | EVENT_WEAPKEY1 = 48, |
||
129 | EVENT_WEAPKEY2 = 49, |
||
130 | EVENT_WEAPKEY3 = 50, |
||
131 | EVENT_WEAPKEY4 = 51, |
||
132 | EVENT_WEAPKEY5 = 52, |
||
133 | EVENT_WEAPKEY6 = 53, |
||
134 | EVENT_WEAPKEY7 = 54, |
||
135 | EVENT_WEAPKEY8 = 55, |
||
136 | EVENT_WEAPKEY9 = 56, |
||
137 | EVENT_WEAPKEY10 = 57, |
||
138 | EVENT_DRAWWEAPON = 58, |
||
139 | EVENT_DISPLAYCROSSHAIR = 59, |
||
140 | EVENT_DISPLAYREST = 60, |
||
141 | EVENT_DISPLAYSBAR = 61, |
||
142 | EVENT_RESETPLAYER = 62, |
||
143 | EVENT_INCURDAMAGE = 63, |
||
144 | EVENT_AIMDOWN = 64, |
||
145 | EVENT_GAME = 65, |
||
146 | EVENT_PREVIOUSWEAPON = 66, |
||
147 | EVENT_NEXTWEAPON = 67, |
||
148 | EVENT_SWIMUP = 68, |
||
149 | EVENT_SWIMDOWN = 69, |
||
150 | EVENT_GETMENUTILE = 70, |
||
151 | EVENT_SPAWN = 71, |
||
152 | EVENT_LOGO = 72, |
||
153 | EVENT_EGS = 73, |
||
154 | EVENT_DOFIRE = 74, |
||
155 | EVENT_PRESSEDFIRE = 75, |
||
156 | EVENT_USE = 76, |
||
157 | EVENT_PROCESSINPUT = 77, |
||
158 | EVENT_FAKEDOMOVETHINGS = 78, |
||
159 | EVENT_DISPLAYROOMS = 79, |
||
160 | EVENT_KILLIT = 80, |
||
161 | EVENT_LOADACTOR = 81, |
||
162 | EVENT_DISPLAYBONUSSCREEN = 82, |
||
163 | EVENT_DISPLAYMENU = 83, |
||
164 | EVENT_DISPLAYMENUREST = 84, |
||
165 | EVENT_DISPLAYLOADINGSCREEN = 85, |
||
166 | EVENT_ANIMATESPRITES = 86, |
||
167 | EVENT_NEWGAME = 87, |
||
168 | EVENT_SOUND = 88, |
||
169 | EVENT_CHECKTOUCHDAMAGE = 89, |
||
170 | EVENT_CHECKFLOORDAMAGE = 90, |
||
171 | EVENT_LOADGAME = 91, |
||
172 | EVENT_SAVEGAME = 92, |
||
173 | EVENT_PREGAME = 93, |
||
174 | EVENT_CHANGEMENU = 94, |
||
4206 | helixhorne | 175 | EVENT_DAMAGEHPLANE = 95, |
4515 | hendricks2 | 176 | EVENT_ACTIVATECHEAT = 96, |
4945 | hendricks2 | 177 | EVENT_DISPLAYINACTIVEMENU = 97, |
178 | EVENT_DISPLAYINACTIVEMENUREST = 98, |
||
5003 | hendricks2 | 179 | EVENT_CUTSCENE = 99, |
180 | EVENT_DISPLAYCURSOR = 100, |
||
5045 | hendricks2 | 181 | EVENT_DISPLAYLEVELSTATS = 101, |
5046 | hendricks2 | 182 | EVENT_DISPLAYCAMERAOSD = 102, |
4945 | hendricks2 | 183 | -- EVENT_ANIMATEALLSPRITES = previous+1, -- internal |
184 | -- KEEPINSYNC with MAXEVENTS below |
||
3366 | helixhorne | 185 | } |
186 | |||
5046 | hendricks2 | 187 | MAXEVENTS = 103 -- KEEPINSYNC with above EVENT_* list |
4567 | helixhorne | 188 | |
3597 | helixhorne | 189 | -- NOTE: negated values are not exported to the ffi.C namespace or CON. |
190 | -- See TWEAK_SFLAG below. |
||
191 | SFLAG = { |
||
3366 | helixhorne | 192 | SFLAG_SHADOW = 0x00000001, |
193 | SFLAG_NVG = 0x00000002, |
||
194 | SFLAG_NOSHADE = 0x00000004, |
||
3597 | helixhorne | 195 | SFLAG_PROJECTILE = -0x00000008, |
196 | SFLAG_DECAL = -0x00000010, |
||
3366 | helixhorne | 197 | SFLAG_BADGUY = 0x00000020, |
198 | SFLAG_NOPAL = 0x00000040, |
||
3597 | helixhorne | 199 | SFLAG_NOEVENTS = 0x00000080, -- NAME |
3366 | helixhorne | 200 | SFLAG_NOLIGHT = 0x00000100, |
201 | SFLAG_USEACTIVATOR = 0x00000200, |
||
3597 | helixhorne | 202 | SFLAG_NULL = -0x00000400, |
3366 | helixhorne | 203 | SFLAG_NOCLIP = 0x00000800, |
3597 | helixhorne | 204 | SFLAG_NOFLOORSHADOW = -0x00001000, |
3366 | helixhorne | 205 | SFLAG_SMOOTHMOVE = 0x00002000, |
206 | SFLAG_NOTELEPORT = 0x00004000, |
||
3597 | helixhorne | 207 | SFLAG_BADGUYSTAYPUT = -0x00008000, |
208 | SFLAG_CACHE = -0x00010000, |
||
209 | SFLAG_ROTFIXED = -0x00020000, |
||
210 | SFLAG_HARDCODED_BADGUY = -0x00040000, |
||
3678 | helixhorne | 211 | SFLAG_DIDNOSE7WATER = -0x00080000, |
4371 | helixhorne | 212 | SFLAG_NODAMAGEPUSH = 0x00100000, |
4956 | helixhorne | 213 | SFLAG_NOWATERDIP = 0x00200000, |
3829 | helixhorne | 214 | -- RESERVED for actor.FLAGS.chain_*/replace_*: |
215 | -- 0x08000000, 0x10000000, 0x20000000, 0x40000000 |
||
3366 | helixhorne | 216 | } |
217 | |||
218 | STAT = { |
||
219 | STAT_DEFAULT = 0, |
||
220 | STAT_ACTOR = 1, |
||
221 | STAT_ZOMBIEACTOR = 2, |
||
222 | STAT_EFFECTOR = 3, |
||
223 | STAT_PROJECTILE = 4, |
||
224 | STAT_MISC = 5, |
||
225 | STAT_STANDABLE = 6, |
||
226 | STAT_LOCATOR = 7, |
||
227 | STAT_ACTIVATOR = 8, |
||
228 | STAT_TRANSPORT = 9, |
||
229 | STAT_PLAYER = 10, |
||
230 | STAT_FX = 11, |
||
231 | STAT_FALLER = 12, |
||
232 | STAT_DUMMYPLAYER = 13, |
||
233 | STAT_LIGHT = 14, |
||
3559 | helixhorne | 234 | -- STAT_NETALLOC = 1023, -- MAXSTATUS-1 |
3366 | helixhorne | 235 | } |
236 | |||
237 | local GAMEFUNC = { |
||
238 | GAMEFUNC_MOVE_FORWARD = 0, |
||
239 | GAMEFUNC_MOVE_BACKWARD = 1, |
||
240 | GAMEFUNC_TURN_LEFT = 2, |
||
241 | GAMEFUNC_TURN_RIGHT = 3, |
||
242 | GAMEFUNC_STRAFE = 4, |
||
243 | GAMEFUNC_FIRE = 5, |
||
244 | GAMEFUNC_OPEN = 6, |
||
245 | GAMEFUNC_RUN = 7, |
||
246 | GAMEFUNC_AUTORUN = 8, |
||
247 | GAMEFUNC_JUMP = 9, |
||
248 | GAMEFUNC_CROUCH = 10, |
||
249 | GAMEFUNC_LOOK_UP = 11, |
||
250 | GAMEFUNC_LOOK_DOWN = 12, |
||
251 | GAMEFUNC_LOOK_LEFT = 13, |
||
252 | GAMEFUNC_LOOK_RIGHT = 14, |
||
253 | GAMEFUNC_STRAFE_LEFT = 15, |
||
254 | GAMEFUNC_STRAFE_RIGHT = 16, |
||
255 | GAMEFUNC_AIM_UP = 17, |
||
256 | GAMEFUNC_AIM_DOWN = 18, |
||
257 | GAMEFUNC_WEAPON_1 = 19, |
||
258 | GAMEFUNC_WEAPON_2 = 20, |
||
259 | GAMEFUNC_WEAPON_3 = 21, |
||
260 | GAMEFUNC_WEAPON_4 = 22, |
||
261 | GAMEFUNC_WEAPON_5 = 23, |
||
262 | GAMEFUNC_WEAPON_6 = 24, |
||
263 | GAMEFUNC_WEAPON_7 = 25, |
||
264 | GAMEFUNC_WEAPON_8 = 26, |
||
265 | GAMEFUNC_WEAPON_9 = 27, |
||
266 | GAMEFUNC_WEAPON_10 = 28, |
||
267 | GAMEFUNC_INVENTORY = 29, |
||
268 | GAMEFUNC_INVENTORY_LEFT = 30, |
||
269 | GAMEFUNC_INVENTORY_RIGHT = 31, |
||
270 | GAMEFUNC_HOLO_DUKE = 32, |
||
271 | GAMEFUNC_JETPACK = 33, |
||
272 | GAMEFUNC_NIGHTVISION = 34, |
||
273 | GAMEFUNC_MEDKIT = 35, |
||
274 | GAMEFUNC_TURNAROUND = 36, |
||
275 | GAMEFUNC_SENDMESSAGE = 37, |
||
276 | GAMEFUNC_MAP = 38, |
||
277 | GAMEFUNC_SHRINK_SCREEN = 39, |
||
278 | GAMEFUNC_ENLARGE_SCREEN = 40, |
||
279 | GAMEFUNC_CENTER_VIEW = 41, |
||
280 | GAMEFUNC_HOLSTER_WEAPON = 42, |
||
281 | GAMEFUNC_SHOW_OPPONENTS_WEAPON = 43, |
||
282 | GAMEFUNC_MAP_FOLLOW_MODE = 44, |
||
283 | GAMEFUNC_SEE_COOP_VIEW = 45, |
||
284 | GAMEFUNC_MOUSE_AIMING = 46, |
||
285 | GAMEFUNC_TOGGLE_CROSSHAIR = 47, |
||
286 | GAMEFUNC_STEROIDS = 48, |
||
287 | GAMEFUNC_QUICK_KICK = 49, |
||
288 | GAMEFUNC_NEXT_WEAPON = 50, |
||
289 | GAMEFUNC_PREVIOUS_WEAPON = 51, |
||
290 | -- GAMEFUNC_SHOW_CONSOLE = 52, |
||
291 | GAMEFUNC_SHOW_DUKEMATCH_SCORES = 53, |
||
292 | GAMEFUNC_DPAD_SELECT = 54, |
||
293 | GAMEFUNC_DPAD_AIMING = 55, |
||
294 | } |
||
295 | |||
3597 | helixhorne | 296 | local function shallow_copy(tab) |
297 | local t = {} |
||
298 | for k,v in pairs(tab) do |
||
299 | t[k] = v |
||
300 | end |
||
301 | return t |
||
302 | end |
||
303 | |||
3225 | helixhorne | 304 | -- KEEPINSYNC with gamedef.c:C_AddDefaultDefinitions() and the respective |
3860 | helixhorne | 305 | -- defines. These are exported to the ffi.C namespace (except STAT) and as |
306 | -- literal defines in lunacon.lua. |
||
2762 | helixhorne | 307 | labels = |
308 | { |
||
3366 | helixhorne | 309 | STR, |
310 | PROJ, |
||
311 | EVENT, |
||
3860 | helixhorne | 312 | shallow_copy(SFLAG), |
313 | setmetatable(STAT, { __metatable="noffiC" }), |
||
3366 | helixhorne | 314 | GAMEFUNC, |
2863 | helixhorne | 315 | } |
2762 | helixhorne | 316 | |
4372 | helixhorne | 317 | user_sflags = 0 |
3597 | helixhorne | 318 | -- TWEAK_SFLAG |
319 | for name, flag in pairs(SFLAG) do |
||
4372 | helixhorne | 320 | if (flag > 0) then |
321 | user_sflags = user_sflags + flag |
||
322 | else |
||
3597 | helixhorne | 323 | SFLAG[name] = -flag |
324 | labels[4][name] = nil |
||
325 | end |
||
326 | end |
||
327 | |||
3392 | helixhorne | 328 | -- KEEPINSYNC player.h |
329 | wdata_members = |
||
330 | { |
||
331 | -- NOTE: they are lowercased for Lunatic |
||
3954 | helixhorne | 332 | -- NOTE: members _*sound*, _spawn and _shoots assume *zero* to mean "none" |
333 | -- (-1 would be more logical). |
||
3574 | helixhorne | 334 | "const int32_t _workslike", |
3392 | helixhorne | 335 | "int32_t clip", |
336 | "int32_t reload", |
||
337 | "int32_t firedelay", |
||
338 | "int32_t totaltime", |
||
339 | "int32_t holddelay", |
||
340 | "int32_t flags", |
||
3574 | helixhorne | 341 | "const int32_t _shoots", |
3392 | helixhorne | 342 | "int32_t spawntime", |
3574 | helixhorne | 343 | "const int32_t _spawn", |
3392 | helixhorne | 344 | "int32_t shotsperburst", |
3574 | helixhorne | 345 | "const int32_t _initialsound", |
346 | "const int32_t _firesound", |
||
347 | "int32_t sound2time", -- NOTE: this is a time number, not a sound |
||
348 | "const int32_t _sound2sound", |
||
349 | "const int32_t _reloadsound1", |
||
350 | "const int32_t _reloadsound2", |
||
351 | "const int32_t _selectsound", |
||
3392 | helixhorne | 352 | "int32_t flashcolor", |
353 | } |
||
2762 | helixhorne | 354 | |
3432 | helixhorne | 355 | |
3433 | helixhorne | 356 | local SP = function(memb) return "sprite[%s]"..memb end |
3937 | helixhorne | 357 | local ATSP = function(memb) return "_atsprite[%s]"..memb end |
3433 | helixhorne | 358 | local AC = function(memb) return "actor[%s]"..memb end |
359 | local SX = function(memb) return "spriteext[%s]"..memb end |
||
360 | |||
361 | -- Generate code to access a signed member as unsigned. |
||
362 | local function s2u(label) |
||
3646 | helixhorne | 363 | return "(_band("..label.."+65536,65535))" |
3433 | helixhorne | 364 | end |
365 | |||
366 | local function S2U(label) |
||
367 | return { s2u(label), label } |
||
368 | end |
||
369 | |||
4195 | helixhorne | 370 | -- Some literal checker functions (LITERAL_CHECKING). |
371 | -- KEEPINSYNC with the actual setter code. |
||
372 | local function litok_gem1(lit) |
||
373 | return (lit >= -1) |
||
374 | end |
||
375 | |||
376 | local function litok_ge0(lit) |
||
377 | return (lit >= 0) |
||
378 | end |
||
379 | |||
3433 | helixhorne | 380 | local ActorLabels = { |
381 | x = SP".x", |
||
382 | y = SP".y", |
||
383 | z = SP".z", |
||
384 | cstat = SP".cstat", |
||
4195 | helixhorne | 385 | picnum = { SP".picnum", SP":set_picnum(%%s)", litok_ge0 }, |
3433 | helixhorne | 386 | shade = SP".shade", |
387 | pal = SP".pal", |
||
388 | clipdist = SP".clipdist", |
||
389 | -- filler = SP".filler", |
||
4302 | helixhorne | 390 | -- detail = SP".filler", -- NAME |
391 | blend = SP".blend", |
||
3433 | helixhorne | 392 | xrepeat = SP".xrepeat", |
393 | yrepeat = SP".yrepeat", |
||
394 | xoffset = SP".xoffset", |
||
395 | yoffset = SP".yoffset", |
||
4195 | helixhorne | 396 | sectnum = { SP".sectnum", SP":changesect(%%s)", litok_ge0 }, -- set: for tsprite |
4150 | helixhorne | 397 | statnum = { SP".statnum" }, |
3433 | helixhorne | 398 | ang = SP".ang", |
4195 | helixhorne | 399 | owner = { SP".owner", SP":_set_owner(%%s)", litok_ge0 }, |
3433 | helixhorne | 400 | xvel = SP".xvel", |
4230 | helixhorne | 401 | yvel = { SP".yvel", SP":set_yvel(%%s)" }, |
3433 | helixhorne | 402 | zvel = SP".zvel", |
403 | lotag = SP".lotag", |
||
404 | hitag = SP".hitag", |
||
405 | extra = SP".extra", |
||
406 | |||
407 | ulotag = S2U(SP".lotag"), |
||
408 | uhitag = S2U(SP".hitag"), |
||
3432 | helixhorne | 409 | |
410 | -- ActorExtra labels... |
||
3433 | helixhorne | 411 | htcgg = AC".cgg", |
4195 | helixhorne | 412 | -- XXX: why <0 allowed? |
3454 | helixhorne | 413 | htpicnum = { AC".picnum", AC":set_picnum(%%s)" }, |
3433 | helixhorne | 414 | htang = AC".ang", |
415 | htextra = AC".extra", |
||
4195 | helixhorne | 416 | htowner = { AC".owner", AC":set_owner(%%s)", litok_ge0 }, |
3646 | helixhorne | 417 | htmovflag = AC"._movflag", |
3433 | helixhorne | 418 | httempang = AC".tempang", |
3874 | helixhorne | 419 | htactorstayput = AC".stayputsect", -- NAME |
3454 | helixhorne | 420 | htdispicnum = { AC".dispicnum" }, |
3465 | helixhorne | 421 | -- NOTE: no access for .shootzvel |
3433 | helixhorne | 422 | httimetosleep = AC".timetosleep", |
423 | htfloorz = AC".floorz", |
||
424 | htceilingz = AC".ceilingz", |
||
425 | htlastvx = AC".lastvx", |
||
426 | htlastvy = AC".lastvy", |
||
427 | htbposx = AC".bpos.x", |
||
428 | htbposy = AC".bpos.y", |
||
429 | htbposz = AC".bpos.z", |
||
3446 | helixhorne | 430 | -- Read access differs from write ({ get, set }): |
3920 | helixhorne | 431 | htg_t = { AC":_get_t_data(%s)", AC":_set_t_data(%s,%%s)" }, |
3433 | helixhorne | 432 | htflags = AC".flags", |
4448 | helixhorne | 433 | movflags = AC".movflags", |
3432 | helixhorne | 434 | |
3874 | helixhorne | 435 | -- (mostly) model-related flags |
3433 | helixhorne | 436 | angoff = SX".angoff", |
437 | pitch = SX".pitch", |
||
438 | roll = SX".roll", |
||
3874 | helixhorne | 439 | mdxoff = SX".mdoff.x", -- NAME |
440 | mdyoff = SX".mdoff.y", |
||
441 | mdzoff = SX".mdoff.z", |
||
3454 | helixhorne | 442 | mdflags = SX".flags", |
3433 | helixhorne | 443 | xpanning = SX".xpanning", |
444 | ypanning = SX".ypanning", |
||
3432 | helixhorne | 445 | |
3480 | helixhorne | 446 | alpha = { "_math.floor(spriteext[%s].alpha*255)", "spriteext[%s].alpha=(%%s)/255" }, |
4146 | helixhorne | 447 | |
448 | isvalid = { "_con._isvalid(%s)" }, |
||
3432 | helixhorne | 449 | } |
450 | |||
3454 | helixhorne | 451 | local function spr2tspr(code) |
452 | if (code and code:find(SP"", 1, true)==1) then |
||
453 | return ATSP(code:sub(#SP"" + 1)) |
||
454 | end |
||
455 | -- else return nothing |
||
456 | end |
||
457 | |||
458 | local TspriteLabels = {} |
||
459 | |||
460 | for member, code in pairs(ActorLabels) do |
||
461 | if (type(code)=="string") then |
||
462 | TspriteLabels["tspr"..member] = spr2tspr(code) |
||
463 | else |
||
3466 | helixhorne | 464 | TspriteLabels["tspr"..member] = { spr2tspr(code[1]), spr2tspr(code[2]) } |
3454 | helixhorne | 465 | end |
466 | end |
||
467 | |||
3475 | helixhorne | 468 | -- Sprites set stat- and sectnum via sprite.change{stat,sect} functions. |
3598 | helixhorne | 469 | ActorLabels.sectnum[2] = "sprite.changesect(%s,%%s,true)" |
470 | ActorLabels.statnum[2] = "sprite.changestat(%s,%%s,true)" |
||
3475 | helixhorne | 471 | |
3433 | helixhorne | 472 | local PL = function(memb) return "player[%s]"..memb end |
3537 | helixhorne | 473 | -- Access to DukePlayer_t's bool members: they must be read as numbers. |
474 | local PLBOOL = function(memb) return { "("..PL(memb).." and 1 or 0)", PL(memb) } end |
||
3432 | helixhorne | 475 | |
4179 | helixhorne | 476 | local empty_table = {} |
477 | local DISABLED_PL = function() return empty_table end |
||
478 | local DISABLED = DISABLED_PL |
||
479 | |||
3433 | helixhorne | 480 | local PlayerLabels = { |
481 | posx = PL".pos.x", |
||
482 | posy = PL".pos.y", |
||
483 | posz = PL".pos.z", |
||
484 | oposx = PL".opos.x", |
||
485 | oposy = PL".opos.y", |
||
486 | oposz = PL".opos.z", |
||
487 | posxv = PL".vel.x", -- NAME |
||
488 | posyv = PL".vel.y", |
||
489 | poszv = PL".vel.z", |
||
490 | -- NOTE: no access for .npos |
||
4179 | helixhorne | 491 | bobposx = DISABLED_PL".bobposx", |
492 | bobposy = DISABLED_PL".bobposy", |
||
3433 | helixhorne | 493 | |
4179 | helixhorne | 494 | truefz = DISABLED_PL".truefz", |
495 | truecz = DISABLED_PL".truecz", |
||
3433 | helixhorne | 496 | player_par = PL".player_par", |
497 | |||
4179 | helixhorne | 498 | randomflamex = DISABLED_PL".randomflamex", |
499 | exitx = DISABLED_PL".exitx", |
||
500 | exity = DISABLED_PL".exity", |
||
3433 | helixhorne | 501 | |
502 | runspeed = PL".runspeed", |
||
503 | max_player_health = PL".max_player_health", |
||
504 | max_shield_amount = PL".max_shield_amount", |
||
505 | |||
506 | autostep = PL".autostep", |
||
507 | autostep_sbw = PL".autostep_sbw", |
||
508 | |||
4179 | helixhorne | 509 | interface_toggle_flag = DISABLED_PL".interface_toggle_flag", |
3433 | helixhorne | 510 | |
511 | -- NOTE: *bombControl etc. are accessed by gamevars in CON |
||
512 | |||
513 | max_actors_killed = PL".max_actors_killed", |
||
514 | actors_killed = PL".actors_killed", |
||
515 | |||
3444 | helixhorne | 516 | -- NOTE the special case; "%%s" is used to mark settable members |
517 | -- with METHOD_MEMBER syntax, it's the value to be set. |
||
3928 | helixhorne | 518 | gotweapon = { "("..PL":has_weapon(%s) and 1 or 0)", PL":_gt_weapon(%s,%%s)" }, |
3433 | helixhorne | 519 | zoom = PL".zoom", |
520 | |||
521 | loogiex = {}, |
||
522 | loogiey = {}, |
||
523 | |||
524 | sbs = PL".sbs", |
||
525 | sound_pitch = PL".sound_pitch", |
||
526 | |||
527 | ang = PL".ang", |
||
528 | oang = PL".oang", |
||
529 | angvel = PL".angvel", |
||
530 | |||
3653 | helixhorne | 531 | cursectnum = PL".cursectnum", |
3433 | helixhorne | 532 | |
533 | look_ang = PL".look_ang", |
||
534 | last_extra = PL".last_extra", |
||
535 | subweapon = PL".subweapon", |
||
536 | |||
3653 | helixhorne | 537 | max_ammo_amount = PL".max_ammo_amount[%s]", |
538 | ammo_amount = PL".ammo_amount[%s]", |
||
3433 | helixhorne | 539 | -- NOTE: no direct access for .inv_amount (but see end) |
540 | |||
3653 | helixhorne | 541 | wackedbyactor = PL".wackedbyactor", |
3433 | helixhorne | 542 | pyoff = PL".pyoff", |
543 | opyoff = PL".opyoff", |
||
544 | |||
545 | horiz = PL".horiz", |
||
546 | horizoff = PL".horizoff", |
||
547 | ohoriz = PL".ohoriz", |
||
548 | ohorizoff = PL".ohorizoff", |
||
549 | |||
550 | newowner = { PL".newowner" }, |
||
551 | |||
552 | jumping_counter = PL".jumping_counter", |
||
553 | airleft = PL".airleft", |
||
554 | |||
555 | fta = PL".fta", |
||
3653 | helixhorne | 556 | ftq = PL".ftq", |
3498 | helixhorne | 557 | access_wallnum = { PL".access_wallnum" }, |
558 | access_spritenum = { PL".access_spritenum" }, |
||
3433 | helixhorne | 559 | |
560 | got_access = PL".got_access", |
||
561 | weapon_ang = PL".weapon_ang", |
||
562 | visibility = PL".visibility", |
||
563 | |||
564 | somethingonplayer = PL".somethingonplayer", |
||
565 | on_crane = PL".on_crane", |
||
566 | |||
567 | i = { PL".i" }, |
||
568 | |||
4179 | helixhorne | 569 | one_parallax_sectnum = DISABLED{ PL".one_parallax_sectnum" }, |
3433 | helixhorne | 570 | |
571 | random_club_frame = PL".random_club_frame", |
||
4814 | helixhorne | 572 | one_eighty_count = PL".one_eighty_count", |
3433 | helixhorne | 573 | |
4179 | helixhorne | 574 | dummyplayersprite = DISABLED_PL".dummyplayersprite", |
3433 | helixhorne | 575 | extra_extra8 = PL".extra_extra8", |
576 | |||
577 | actorsqu = PL".actorsqu", |
||
578 | timebeforeexit = PL".timebeforeexit", |
||
579 | customexitsound = { PL".customexitsound" }, |
||
580 | |||
581 | last_pissed_time = PL".last_pissed_time", |
||
582 | |||
3653 | helixhorne | 583 | weaprecs = PL".weaprecs[%s]", |
3433 | helixhorne | 584 | |
585 | weapon_sway = PL".weapon_sway", |
||
586 | crack_time = PL".crack_time", |
||
587 | bobcounter = PL".bobcounter", |
||
588 | |||
589 | -- NOTE: no access for .orotscrnang |
||
590 | rotscrnang = PL".rotscrnang", |
||
591 | dead_flag = PL".dead_flag", |
||
592 | |||
593 | holoduke_on = PL".holoduke_on", |
||
594 | pycount = PL".pycount", |
||
595 | transporter_hold = PL".transporter_hold", |
||
596 | |||
597 | max_secret_rooms = PL".max_secret_rooms", |
||
598 | secret_rooms = PL".secret_rooms", |
||
599 | |||
600 | frag = PL".frag", |
||
601 | fraggedself = PL".fraggedself", |
||
602 | quick_kick = PL".quick_kick", |
||
603 | last_quick_kick = PL".last_quick_kick", |
||
604 | |||
4179 | helixhorne | 605 | return_to_center = DISABLED_PL".return_to_center", |
3537 | helixhorne | 606 | reloading = PLBOOL".reloading", |
3444 | helixhorne | 607 | weapreccnt = { PL".weapreccnt" }, |
3433 | helixhorne | 608 | |
609 | aim_mode = PL".aim_mode", |
||
610 | auto_aim = PL".auto_aim", |
||
611 | weaponswitch = PL".weaponswitch", |
||
612 | movement_lock = PL".movement_lock", |
||
613 | team = PL".team", |
||
614 | |||
615 | tipincs = PL".tipincs", |
||
616 | hbomb_hold_delay = PL".hbomb_hold_delay", |
||
3656 | helixhorne | 617 | frag_ps = PL".frag_ps", |
3433 | helixhorne | 618 | kickback_pic = PL".kickback_pic", |
619 | |||
620 | gm = PL".gm", |
||
3537 | helixhorne | 621 | on_warping_sector = PLBOOL".on_warping_sector", |
3433 | helixhorne | 622 | footprintcount = PL".footprintcount", |
623 | hurt_delay = PL".hurt_delay", |
||
624 | |||
3537 | helixhorne | 625 | hbomb_on = PLBOOL".hbomb_on", |
626 | jumping_toggle = PLBOOL".jumping_toggle", |
||
627 | rapid_fire_hold = PLBOOL".rapid_fire_hold", |
||
628 | on_ground = PLBOOL".on_ground", |
||
3433 | helixhorne | 629 | |
630 | inven_icon = PL".inven_icon", |
||
631 | buttonpalette = PL".buttonpalette", |
||
3537 | helixhorne | 632 | over_shoulder_on = PLBOOL".over_shoulder_on", |
3433 | helixhorne | 633 | show_empty_weapon = PL".show_empty_weapon", |
634 | |||
3537 | helixhorne | 635 | jetpack_on = PLBOOL".jetpack_on", |
636 | spritebridge = PLBOOL".spritebridge", |
||
4179 | helixhorne | 637 | lastrandomspot = DISABLED_PL".lastrandomspot", |
3433 | helixhorne | 638 | |
3537 | helixhorne | 639 | scuba_on = PLBOOL".scuba_on", |
3433 | helixhorne | 640 | footprintpal = PL".footprintpal", |
3537 | helixhorne | 641 | heat_on = PLBOOL".heat_on", |
3433 | helixhorne | 642 | invdisptime = PL".invdisptime", |
3537 | helixhorne | 643 | holster_weapon = PLBOOL".holster_weapon", |
3433 | helixhorne | 644 | falling_counter = PL".falling_counter", |
645 | footprintshade = PL".footprintshade", |
||
646 | |||
647 | refresh_inventory = PL".refresh_inventory", |
||
3817 | helixhorne | 648 | last_full_weapon = PL".last_full_weapon", |
3433 | helixhorne | 649 | |
650 | walking_snd_toggle = PL".walking_snd_toggle", |
||
651 | palookup = PL".palookup", |
||
652 | hard_landing = PL".hard_landing", |
||
653 | fist_incs = PL".fist_incs", |
||
654 | |||
4179 | helixhorne | 655 | toggle_key_flag = { PL".toggle_key_flag" }, |
3433 | helixhorne | 656 | knuckle_incs = PL".knuckle_incs", |
657 | knee_incs = PL".knee_incs", |
||
658 | access_incs = PL".access_incs", |
||
659 | |||
4179 | helixhorne | 660 | numloogs = DISABLED_PL".numloogs", |
4732 | helixhorne | 661 | loogcnt = PL".loogcnt", |
4179 | helixhorne | 662 | scream_voice = { PL".scream_voice" }, |
3433 | helixhorne | 663 | |
3653 | helixhorne | 664 | last_weapon = PL".last_weapon", |
4179 | helixhorne | 665 | cheat_phase = { PL".cheat_phase" }, |
3433 | helixhorne | 666 | weapon_pos = PL".weapon_pos", |
3653 | helixhorne | 667 | wantweaponfire = PL".wantweaponfire", |
3433 | helixhorne | 668 | |
3653 | helixhorne | 669 | curr_weapon = PL".curr_weapon", |
3433 | helixhorne | 670 | |
4260 | helixhorne | 671 | palette = { PL".palette" }, |
3433 | helixhorne | 672 | |
673 | -- NOTE the special case: |
||
3641 | helixhorne | 674 | pals = PL"._pals[%s]", |
3444 | helixhorne | 675 | pals_time = PL"._pals.f", |
3433 | helixhorne | 676 | |
677 | name = {}, |
||
678 | |||
679 | -- Access to .inv_amount |
||
3435 | helixhorne | 680 | steroids_amount = PL".inv_amount[0]", |
681 | shield_amount = PL".inv_amount[1]", |
||
682 | scuba_amount = PL".inv_amount[2]", |
||
683 | holoduke_amount = PL".inv_amount[3]", |
||
684 | jetpack_amount = PL".inv_amount[4]", |
||
3433 | helixhorne | 685 | -- 5: dummy |
686 | -- 6: no "access_amount" |
||
3435 | helixhorne | 687 | heat_amount = PL".inv_amount[7]", |
3433 | helixhorne | 688 | -- 8: dummy |
3435 | helixhorne | 689 | firstaid_amount = PL".inv_amount[9]", |
690 | boot_amount = PL".inv_amount[10]", |
||
3433 | helixhorne | 691 | } |
692 | |||
693 | local SEC = function(memb) return "sector[%s]"..memb end |
||
694 | local SECRO = function(memb) return { "sector[%s]"..memb } end |
||
695 | |||
696 | local SectorLabels = { |
||
697 | wallptr = SECRO".wallptr", |
||
698 | wallnum = SECRO".wallnum", |
||
699 | |||
700 | ceilingz = SEC".ceilingz", |
||
701 | floorz = SEC".floorz", |
||
702 | |||
703 | ceilingstat = SEC".ceilingstat", |
||
704 | floorstat = SEC".floorstat", |
||
705 | |||
706 | -- CEILING |
||
4195 | helixhorne | 707 | ceilingpicnum = { SEC".ceilingpicnum", SEC":set_ceilingpicnum(%%s)", litok_ge0 }, |
3433 | helixhorne | 708 | |
709 | ceilingslope = SEC".ceilingheinum", -- NAME |
||
710 | ceilingshade = SEC".ceilingshade", |
||
711 | |||
712 | ceilingpal = SEC".ceilingpal", |
||
713 | ceilingxpanning = SEC".ceilingxpanning", |
||
714 | ceilingypanning = SEC".ceilingypanning", |
||
715 | |||
716 | -- FLOOR |
||
4195 | helixhorne | 717 | floorpicnum = { SEC".floorpicnum", SEC":set_floorpicnum(%%s)", litok_ge0 }, |
3433 | helixhorne | 718 | |
719 | floorslope = SEC".floorheinum", -- NAME |
||
720 | floorshade = SEC".floorshade", |
||
721 | |||
722 | floorpal = SEC".floorpal", |
||
723 | floorxpanning = SEC".floorxpanning", |
||
724 | floorypanning = SEC".floorypanning", |
||
725 | |||
726 | visibility = SEC".visibility", |
||
4416 | helixhorne | 727 | fogpal = SEC".fogpal", |
728 | alignto = SEC".fogpal", -- NAME |
||
3433 | helixhorne | 729 | |
730 | lotag = SEC".lotag", |
||
731 | hitag = SEC".hitag", |
||
732 | extra = SEC".extra", |
||
733 | |||
3804 | helixhorne | 734 | ceilingbunch = { SEC".ceilingbunch" }, |
735 | floorbunch = { SEC".floorbunch" }, |
||
3433 | helixhorne | 736 | |
737 | ulotag = S2U(SEC".lotag"), |
||
738 | uhitag = S2U(SEC".hitag"), |
||
739 | } |
||
740 | |||
741 | local WAL = function(memb) return "wall[%s]"..memb end |
||
742 | local WALRO = function(memb) return { "wall[%s]"..memb } end |
||
743 | |||
744 | local WallLabels = { |
||
745 | x = WAL".x", |
||
746 | y = WAL".y", |
||
747 | point2 = WALRO".point2", |
||
3446 | helixhorne | 748 | nextwall = { WAL".nextwall", WAL":_set_nextwall(%%s)" }, |
749 | nextsector = { WAL".nextsector", WAL":_set_nextsector(%%s)" }, |
||
3433 | helixhorne | 750 | cstat = WAL".cstat", |
4195 | helixhorne | 751 | picnum = { WAL".picnum", WAL":set_picnum(%%s)", litok_ge0 }, |
752 | overpicnum = { WAL".overpicnum", WAL":set_overpicnum(%%s)", litok_ge0 }, |
||
3433 | helixhorne | 753 | shade = WAL".shade", |
754 | pal = WAL".pal", |
||
755 | xrepeat = WAL".xrepeat", |
||
756 | yrepeat = WAL".yrepeat", |
||
757 | xpanning = WAL".xpanning", |
||
758 | ypanning = WAL".ypanning", |
||
759 | lotag = WAL".lotag", |
||
760 | hitag = WAL".hitag", |
||
761 | extra = WAL".extra", |
||
4396 | helixhorne | 762 | blend = WAL".blend", |
3433 | helixhorne | 763 | |
764 | ulotag = S2U(WAL".lotag"), |
||
765 | uhitag = S2U(WAL".hitag"), |
||
766 | } |
||
767 | |||
768 | StructAccessCode = |
||
769 | { |
||
770 | sector = SectorLabels, |
||
771 | wall = WallLabels, |
||
772 | sprite = ActorLabels, |
||
773 | player = PlayerLabels, |
||
774 | } |
||
775 | |||
4356 | helixhorne | 776 | local function tonegtag(LabelsTab, member, funcname) |
777 | local memb = LabelsTab[member] |
||
778 | LabelsTab[member] = { memb, memb.."="..funcname.."(%%s)" } |
||
779 | end |
||
780 | |||
781 | function setup_negative_tag_check(funcname) |
||
782 | tonegtag(TspriteLabels, "tsprlotag", funcname) |
||
783 | tonegtag(TspriteLabels, "tsprhitag", funcname) |
||
784 | tonegtag(ActorLabels, "lotag", funcname) |
||
785 | tonegtag(ActorLabels, "hitag", funcname) |
||
786 | tonegtag(WallLabels, "lotag", funcname) |
||
787 | tonegtag(WallLabels, "hitag", funcname) |
||
788 | tonegtag(SectorLabels, "lotag", funcname) |
||
789 | tonegtag(SectorLabels, "hitag", funcname) |
||
790 | end |
||
791 | |||
3463 | helixhorne | 792 | local PROJ = function(memb) return "projectile[%s]"..memb end |
3466 | helixhorne | 793 | local THISPROJ = function(memb) return "actor[%s].proj"..memb end |
3463 | helixhorne | 794 | |
795 | local ProjectileLabels = { |
||
3465 | helixhorne | 796 | workslike = PROJ".workslike", |
797 | cstat = PROJ".cstat", |
||
798 | hitradius = PROJ".hitradius", |
||
799 | range = PROJ".range", |
||
800 | flashcolor = PROJ".flashcolor", |
||
4195 | helixhorne | 801 | spawns = { PROJ".spawns", PROJ":set_spawns(%%s)", litok_gem1 }, |
802 | sound = { PROJ".sound", PROJ":set_sound(%%s)", litok_gem1 }, |
||
803 | isound = { PROJ".isound", PROJ":set_isound(%%s)", litok_gem1 }, |
||
3465 | helixhorne | 804 | vel = PROJ".vel", |
4195 | helixhorne | 805 | decal = { PROJ".decal", PROJ":set_decal(%%s)", litok_gem1 }, |
806 | trail = { PROJ".trail", PROJ":set_trail(%%s)", litok_gem1 }, |
||
3465 | helixhorne | 807 | tnum = PROJ".tnum", |
808 | drop = PROJ".drop", |
||
809 | offset = PROJ".offset", |
||
810 | bounces = PROJ".bounces", |
||
4195 | helixhorne | 811 | bsound = { PROJ".bsound", PROJ":set_bsound(%%s)", litok_gem1 }, |
3465 | helixhorne | 812 | toffset = PROJ".toffset", |
813 | extra = PROJ".extra", |
||
814 | extra_rand = PROJ".extra_rand", |
||
815 | sxrepeat = PROJ".sxrepeat", |
||
816 | syrepeat = PROJ".syrepeat", |
||
817 | txrepeat = PROJ".txrepeat", |
||
818 | tyrepeat = PROJ".tyrepeat", |
||
819 | shade = PROJ".shade", |
||
820 | xrepeat = PROJ".xrepeat", |
||
821 | yrepeat = PROJ".yrepeat", |
||
822 | pal = PROJ".pal", |
||
823 | velmult = PROJ".movecnt", -- NAME |
||
824 | clipdist = PROJ".clipdist", |
||
3866 | helixhorne | 825 | userdata = PROJ".userdata", |
3463 | helixhorne | 826 | } |
827 | |||
3870 | helixhorne | 828 | -- XXX: kind of CODEDUP form spr2tspr |
3466 | helixhorne | 829 | local function proj2thisproj(code) |
830 | if (code and code:find(PROJ"", 1, true)==1) then |
||
831 | return THISPROJ(code:sub(#PROJ"" + 1)) |
||
832 | end |
||
833 | -- else return nothing |
||
834 | end |
||
835 | |||
836 | local SpriteProjectileLabels = {} |
||
837 | |||
838 | for member, code in pairs(ProjectileLabels) do |
||
839 | if (type(code)=="string") then |
||
840 | SpriteProjectileLabels[member] = proj2thisproj(code) |
||
841 | else |
||
842 | SpriteProjectileLabels[member] = { proj2thisproj(code[1]), proj2thisproj(code[2]) } |
||
843 | end |
||
844 | end |
||
845 | |||
4285 | helixhorne | 846 | local UD = function(memb) return "_gud(_pli)"..memb end |
3473 | helixhorne | 847 | local UDRO = function(memb) return { UD(memb) } end |
848 | |||
849 | -- NOTE: Only members that actually encountered in existing mods are added here. |
||
850 | local UserdefLabels = { |
||
851 | althud = UD".althud", |
||
3732 | helixhorne | 852 | auto_run = UD".auto_run", |
3473 | helixhorne | 853 | camerasprite = UDRO".camerasprite", |
854 | cashman = UDRO".cashman", |
||
855 | clipping = UD".noclip", -- NAME |
||
4732 | helixhorne | 856 | color = UD".color", |
3473 | helixhorne | 857 | const_visibility = UD".const_visibility", |
858 | crosshair = UD".crosshair", |
||
859 | crosshairscale = UDRO".crosshairscale", |
||
860 | detail = { "1" }, |
||
861 | display_bonus_screen = UD".display_bonus_screen", |
||
862 | drawweapon = UDRO".drawweapon", |
||
3817 | helixhorne | 863 | eog = UD".eog", |
3473 | helixhorne | 864 | ffire = UDRO".ffire", |
865 | fta_on = UD".fta_on", |
||
866 | god = UDRO".god", |
||
3570 | helixhorne | 867 | idplayers = UDRO".idplayers", |
4972 | helixhorne | 868 | last_level = UDRO".last_level", |
4195 | helixhorne | 869 | level_number = { UD".level_number", UD":set_level_number(%%s)", {0, MAXLEVELS-1} }, |
4150 | helixhorne | 870 | levelstats = UD".levelstats", |
3473 | helixhorne | 871 | lockout = UDRO".lockout", |
4945 | hendricks2 | 872 | m_origin_x = UD".m_origin.x", |
873 | m_origin_y = UD".m_origin.y", |
||
3862 | helixhorne | 874 | m_player_skill = UDRO".m_player_skill", |
4567 | helixhorne | 875 | m_volume_number = { UD".m_volume_number", UD":set_m_volume_number(%%s)", {0, MAXVOLUMES} }, |
4475 | helixhorne | 876 | mouseaiming = UD".mouseaiming", |
3473 | helixhorne | 877 | pause_on = UDRO".pause_on", |
878 | player_skill = UD".player_skill", |
||
4968 | hendricks2 | 879 | playerbest = UDRO".playerbest", |
3473 | helixhorne | 880 | mouseflip = UDRO".mouseflip", |
881 | multimode = { "1" }, |
||
4970 | hendricks2 | 882 | musictoggle = UDRO".config.MusicToggle", |
3817 | helixhorne | 883 | noexits = UDRO".noexits", |
3473 | helixhorne | 884 | overhead_on = UD".overhead_on", |
4814 | helixhorne | 885 | recstat = UDRO".recstat", |
4150 | helixhorne | 886 | runkey_mode = UD".runkey_mode", |
3473 | helixhorne | 887 | show_level_text = UD".show_level_text", |
888 | screen_size = { UD".screen_size", UD":set_screen_size(%%s)" }, |
||
889 | screen_tilting = UD".screen_tilting", |
||
4150 | helixhorne | 890 | showallmap = UD".showallmap", |
3473 | helixhorne | 891 | showweapons = UDRO".showweapons", |
4814 | helixhorne | 892 | statusbarmode = UDRO".statusbarmode", |
3567 | helixhorne | 893 | statusbarscale = UDRO".statusbarscale", |
4195 | helixhorne | 894 | volume_number = { UD".volume_number", UD":set_volume_number(%%s)", {0, MAXVOLUMES} }, |
3567 | helixhorne | 895 | weaponscale = UDRO".weaponscale", |
3473 | helixhorne | 896 | weaponswitch = UD".weaponswitch", |
897 | } |
||
898 | |||
3477 | helixhorne | 899 | local INP = function(memb) return PL"._input"..memb end |
900 | |||
901 | local InputLabels = { |
||
902 | avel = INP".avel", |
||
903 | horz = INP".horz", |
||
904 | fvel = INP".fvel", |
||
905 | svel = INP".svel", |
||
906 | bits = INP".bits", |
||
907 | extbits = INP".extbits", |
||
908 | } |
||
909 | |||
3454 | helixhorne | 910 | -- These structs cannot be accessed by inline array exprs in CON: |
911 | StructAccessCode2 = |
||
912 | { |
||
913 | tspr = TspriteLabels, |
||
3466 | helixhorne | 914 | projectile = ProjectileLabels, |
915 | thisprojectile = SpriteProjectileLabels, |
||
3473 | helixhorne | 916 | userdef = UserdefLabels, |
3477 | helixhorne | 917 | input = InputLabels, |
3454 | helixhorne | 918 | } |
919 | |||
2612 | helixhorne | 920 | -- NOTE: These MUST be in reverse lexicographical order! |
4800 | helixhorne | 921 | -- Per CON syntax, valid identifiers names are disjoint from keywords, |
2612 | helixhorne | 922 | -- so that a rule like |
923 | -- t_identifier = -con_keyword * (sp1 + "[") * t_identifier_all |
||
924 | -- (from the final grammar in lunacon.lua) must match the longest |
||
925 | -- possible keyword name, else the negation might wrongly not fail. |
||
926 | |||
2762 | helixhorne | 927 | keyword = |
2594 | helixhorne | 928 | |
929 | lpeg.P(false) + |
||
2612 | helixhorne | 930 | "}" + |
2594 | helixhorne | 931 | "{" + |
2612 | helixhorne | 932 | "zshootvar" + |
933 | "zshoot" + |
||
934 | "xorvarvar" + |
||
935 | "xorvar" + |
||
936 | "writearraytofile" + |
||
937 | "whilevarvarn" + |
||
938 | "whilevarn" + |
||
939 | "wackplayer" + |
||
940 | "userquote" + |
||
941 | "useractor" + |
||
942 | "updatesectorz" + |
||
943 | "updatesector" + |
||
4977 | hendricks2 | 944 | "undefinevolume" + |
945 | "undefineskill" + |
||
946 | "undefinelevel" + |
||
2612 | helixhorne | 947 | "tossweapon" + |
948 | "tip" + |
||
949 | "time" + |
||
950 | "switch" + |
||
951 | "subvarvar" + |
||
952 | "subvar" + |
||
953 | "strength" + |
||
954 | "stopsoundvar" + |
||
955 | "stopsound" + |
||
956 | "stopallsounds" + |
||
957 | "stopactorsound" + |
||
958 | "state" + |
||
959 | "starttrackvar" + |
||
960 | "starttrack" + |
||
961 | "startlevel" + |
||
5031 | hendricks2 | 962 | "startcutscene" + |
2612 | helixhorne | 963 | "ssp" + |
964 | "sqrt" + |
||
965 | "spriteshadow" + |
||
966 | "spritepal" + |
||
967 | "spritenvg" + |
||
968 | "spritenoshade" + |
||
969 | "spritenopal" + |
||
970 | "spriteflags" + |
||
971 | "spgetlotag" + |
||
972 | "spgethitag" + |
||
973 | "spawn" + |
||
974 | "soundvar" + |
||
975 | "soundoncevar" + |
||
976 | "soundonce" + |
||
977 | "sound" + |
||
978 | "smaxammo" + |
||
979 | "sleeptime" + |
||
980 | "sizeto" + |
||
981 | "sizeat" + |
||
982 | "sin" + |
||
983 | "showviewunbiased" + |
||
984 | "showview" + |
||
985 | "shootvar" + |
||
986 | "shoot" + |
||
987 | "shiftvarr" + |
||
988 | "shiftvarl" + |
||
3845 | helixhorne | 989 | "shadeto" + |
2612 | helixhorne | 990 | "setwall" + |
991 | "setvarvar" + |
||
992 | "setvar" + |
||
993 | "setuserdef" + |
||
994 | "settspr" + |
||
995 | "setthisprojectile" + |
||
996 | "setsprite" + |
||
997 | "setsector" + |
||
998 | "setprojectile" + |
||
999 | "setplayervar" + |
||
1000 | "setplayerangle" + |
||
1001 | "setplayer" + |
||
4928 | hendricks2 | 1002 | "setmusicposition" + |
2612 | helixhorne | 1003 | "setinput" + |
1004 | "setgamepalette" + |
||
1005 | "setgamename" + |
||
1006 | "setdefname" + |
||
1007 | "setcfgname" + |
||
1008 | "setaspect" + |
||
1009 | "setarray" + |
||
1010 | "setactorvar" + |
||
1011 | "setactorsoundpitch" + |
||
1012 | "setactorangle" + |
||
1013 | "setactor" + |
||
1014 | "sectsetinterpolation" + |
||
1015 | "sectorofwall" + |
||
1016 | "sectgetlotag" + |
||
1017 | "sectgethitag" + |
||
1018 | "sectclearinterpolation" + |
||
1019 | "scriptsize" + |
||
3845 | helixhorne | 1020 | "screentext" + |
3945 | helixhorne | 1021 | "screensound" + |
2612 | helixhorne | 1022 | "savenn" + |
1023 | "savemapstate" + |
||
1024 | "savegamevar" + |
||
1025 | "save" + |
||
3610 | hendricks2 | 1026 | "rotatespritea" + |
2612 | helixhorne | 1027 | "rotatesprite16" + |
1028 | "rotatesprite" + |
||
1029 | "rotatepoint" + |
||
1030 | "return" + |
||
1031 | "respawnhitag" + |
||
1032 | "resizearray" + |
||
5039 | hendricks2 | 1033 | "resetplayerflags" + |
2612 | helixhorne | 1034 | "resetplayer" + |
1035 | "resetcount" + |
||
1036 | "resetactioncount" + |
||
1037 | "redefinequote" + |
||
1038 | "readgamevar" + |
||
1039 | "readarrayfromfile" + |
||
1040 | "rayintersect" + |
||
1041 | "randvarvar" + |
||
1042 | "randvar" + |
||
1043 | "quote" + |
||
1044 | "quake" + |
||
1045 | "qsubstr" + |
||
1046 | "qstrncat" + |
||
1047 | "qstrlen" + |
||
3845 | helixhorne | 1048 | "qstrdim" + |
2612 | helixhorne | 1049 | "qstrcpy" + |
1050 | "qstrcat" + |
||
1051 | "qsprintf" + |
||
1052 | "qspawnvar" + |
||
1053 | "qspawn" + |
||
1054 | "qgetsysstr" + |
||
1055 | "pstomp" + |
||
1056 | "prevspritestat" + |
||
1057 | "prevspritesect" + |
||
1058 | "precache" + |
||
1059 | "pkick" + |
||
1060 | "paper" + |
||
1061 | "palfrom" + |
||
1062 | "orvarvar" + |
||
1063 | "orvar" + |
||
1064 | "operatesectors" + |
||
1065 | "operaterespawns" + |
||
1066 | "operatemasterswitches" + |
||
1067 | "operateactivators" + |
||
1068 | "operate" + |
||
1069 | "onevent" + |
||
1070 | "nullop" + |
||
1071 | "nextspritestat" + |
||
1072 | "nextspritesect" + |
||
1073 | "neartag" + |
||
1074 | "myosx" + |
||
1075 | "myospalx" + |
||
1076 | "myospal" + |
||
1077 | "myos" + |
||
1078 | "music" + |
||
1079 | "mulvarvar" + |
||
1080 | "mulvar" + |
||
1081 | "mulscale" + |
||
1082 | "movesprite" + |
||
1083 | "move" + |
||
1084 | "money" + |
||
1085 | "modvarvar" + |
||
1086 | "modvar" + |
||
1087 | "minitext" + |
||
1088 | "mikesnd" + |
||
1089 | "mail" + |
||
1090 | "lotsofglass" + |
||
1091 | "lockplayer" + |
||
1092 | "loadmapstate" + |
||
1093 | "lineintersect" + |
||
1094 | "ldist" + |
||
1095 | "killit" + |
||
1096 | "jump" + |
||
1097 | "insertspriteq" + |
||
1098 | "inittimer" + |
||
1099 | "includedefault" + |
||
1100 | "include" + |
||
1101 | "ifwasweapon" + |
||
1102 | "ifvarxor" + |
||
1103 | "ifvarvarxor" + |
||
1104 | "ifvarvaror" + |
||
1105 | "ifvarvarn" + |
||
1106 | "ifvarvarl" + |
||
1107 | "ifvarvarg" + |
||
1108 | "ifvarvareither" + |
||
1109 | "ifvarvare" + |
||
1110 | "ifvarvarand" + |
||
1111 | "ifvaror" + |
||
1112 | "ifvarn" + |
||
1113 | "ifvarl" + |
||
1114 | "ifvarg" + |
||
1115 | "ifvareither" + |
||
1116 | "ifvare" + |
||
1117 | "ifvarand" + |
||
1118 | "ifstrength" + |
||
1119 | "ifsquished" + |
||
1120 | "ifspritepal" + |
||
1121 | "ifspawnedby" + |
||
1122 | "ifsound" + |
||
1123 | "ifserver" + |
||
1124 | "ifrnd" + |
||
1125 | "ifrespawn" + |
||
3845 | helixhorne | 1126 | "ifplayersl" + |
2612 | helixhorne | 1127 | "ifpinventory" + |
1128 | "ifphealthl" + |
||
1129 | "ifpdistl" + |
||
1130 | "ifpdistg" + |
||
1131 | "ifp" + |
||
1132 | "ifoutside" + |
||
1133 | "ifonwater" + |
||
1134 | "ifnotmoving" + |
||
1135 | "ifnosounds" + |
||
1136 | "ifmultiplayer" + |
||
1137 | "ifmove" + |
||
1138 | "ifinwater" + |
||
1139 | "ifinspace" + |
||
1140 | "ifinouterspace" + |
||
1141 | "ifhitweapon" + |
||
1142 | "ifhitspace" + |
||
1143 | "ifgotweaponce" + |
||
1144 | "ifgapzl" + |
||
1145 | "iffloordistl" + |
||
1146 | "ifdead" + |
||
5008 | helixhorne | 1147 | "ifcutscene" + |
2612 | helixhorne | 1148 | "ifcount" + |
1149 | "ifclient" + |
||
1150 | "ifceilingdistl" + |
||
1151 | "ifcanshoottarget" + |
||
1152 | "ifcanseetarget" + |
||
1153 | "ifcansee" + |
||
1154 | "ifbulletnear" + |
||
1155 | "ifawayfromwall" + |
||
1156 | "ifangdiffl" + |
||
1157 | "ifai" + |
||
1158 | "ifactorsound" + |
||
1159 | "ifactornotstayput" + |
||
1160 | "ifactor" + |
||
1161 | "ifactioncount" + |
||
1162 | "ifaction" + |
||
1163 | "hitscan" + |
||
1164 | "hitradiusvar" + |
||
1165 | "hitradius" + |
||
1166 | "headspritestat" + |
||
1167 | "headspritesect" + |
||
1168 | "guts" + |
||
1169 | "guniqhudid" + |
||
1170 | "gmaxammo" + |
||
1171 | "globalsoundvar" + |
||
1172 | "globalsound" + |
||
1173 | "getzrange" + |
||
1174 | "getwall" + |
||
1175 | "getuserdef" + |
||
1176 | "gettspr" + |
||
1177 | "gettimedate" + |
||
1178 | "getticks" + |
||
1179 | "getthisprojectile" + |
||
1180 | "gettexturefloor" + |
||
1181 | "gettextureceiling" + |
||
1182 | "getsector" + |
||
1183 | "getprojectile" + |
||
1184 | "getpname" + |
||
1185 | "getplayervar" + |
||
1186 | "getplayerangle" + |
||
1187 | "getplayer" + |
||
4928 | hendricks2 | 1188 | "getmusicposition" + |
2612 | helixhorne | 1189 | "getlastpal" + |
1190 | "getkeyname" + |
||
1191 | "getinput" + |
||
1192 | "getincangle" + |
||
1193 | "getflorzofslope" + |
||
1194 | "getcurraddress" + |
||
1195 | "getceilzofslope" + |
||
1196 | "getarraysize" + |
||
1197 | "getangletotarget" + |
||
1198 | "getangle" + |
||
1199 | "getactorvar" + |
||
1200 | "getactorangle" + |
||
1201 | "getactor" + |
||
1202 | "gamevar" + |
||
1203 | "gametextz" + |
||
1204 | "gametext" + |
||
1205 | "gamestartup" + |
||
1206 | "gamearray" + |
||
1207 | "flash" + |
||
1208 | "findplayer" + |
||
1209 | "findotherplayer" + |
||
1210 | "findnearspritezvar" + |
||
1211 | "findnearspritez" + |
||
1212 | "findnearspritevar" + |
||
1213 | "findnearsprite3dvar" + |
||
1214 | "findnearsprite3d" + |
||
1215 | "findnearsprite" + |
||
1216 | "findnearactorzvar" + |
||
1217 | "findnearactorz" + |
||
1218 | "findnearactorvar" + |
||
1219 | "findnearactor3dvar" + |
||
1220 | "findnearactor3d" + |
||
1221 | "findnearactor" + |
||
1222 | "fall" + |
||
1223 | "ezshootvar" + |
||
1224 | "ezshoot" + |
||
1225 | "eventloadactor" + |
||
1226 | "espawnvar" + |
||
1227 | "espawn" + |
||
1228 | "eshootvar" + |
||
1229 | "eshoot" + |
||
1230 | "eqspawnvar" + |
||
1231 | "eqspawn" + |
||
1232 | "enhanced" + |
||
1233 | "endswitch" + |
||
1234 | "ends" + |
||
3845 | helixhorne | 1235 | "endoflevel" + |
2612 | helixhorne | 1236 | "endofgame" + |
1237 | "endevent" + |
||
1238 | "enda" + |
||
1239 | "else" + |
||
1240 | "echo" + |
||
3845 | helixhorne | 1241 | "dynamicsoundremap" + |
2612 | helixhorne | 1242 | "dynamicremap" + |
1243 | "dragpoint" + |
||
1244 | "divvarvar" + |
||
1245 | "divvar" + |
||
1246 | "dist" + |
||
1247 | "displayrandvarvar" + |
||
1248 | "displayrandvar" + |
||
1249 | "displayrand" + |
||
1250 | "digitalnumberz" + |
||
1251 | "digitalnumber" + |
||
1252 | "definevolumename" + |
||
5036 | helixhorne | 1253 | "definevolumeflags" + |
2612 | helixhorne | 1254 | "definesound" + |
1255 | "defineskillname" + |
||
1256 | "definequote" + |
||
1257 | "defineprojectile" + |
||
1258 | "definelevelname" + |
||
1259 | "definegametype" + |
||
1260 | "definegamefuncname" + |
||
1261 | "definecheat" + |
||
1262 | "define" + |
||
1263 | "default" + |
||
1264 | "debug" + |
||
1265 | "debris" + |
||
1266 | "cstator" + |
||
1267 | "cstat" + |
||
1268 | "count" + |
||
1269 | "cos" + |
||
1270 | "copy" + |
||
1271 | "cmenu" + |
||
1272 | "clipmovenoslide" + |
||
1273 | "clipmove" + |
||
1274 | "clipdist" + |
||
1275 | "clearmapstate" + |
||
1276 | "checkavailweapon" + |
||
1277 | "checkavailinven" + |
||
1278 | "checkactivatormotion" + |
||
1279 | "cheatkeys" + |
||
1280 | "changespritestat" + |
||
1281 | "changespritesect" + |
||
1282 | "case" + |
||
1283 | "canseespr" + |
||
1284 | "cansee" + |
||
1285 | "calchypotenuse" + |
||
1286 | "cactor" + |
||
1287 | "break" + |
||
1288 | "betaname" + |
||
1289 | "angoffvar" + |
||
1290 | "angoff" + |
||
1291 | "andvarvar" + |
||
1292 | "andvar" + |
||
1293 | "ai" + |
||
1294 | "addweaponvar" + |
||
1295 | "addweapon" + |
||
1296 | "addvarvar" + |
||
1297 | "addvar" + |
||
1298 | "addstrength" + |
||
1299 | "addphealth" + |
||
1300 | "addlogvar" + |
||
1301 | "addlog" + |
||
1302 | "addkills" + |
||
1303 | "addinventory" + |
||
1304 | "addammo" + |
||
1305 | "actor" + |
||
1306 | "activatecheat" + |
||
1307 | "activatebysector" + |
||
3845 | helixhorne | 1308 | "activate" + |
2594 | helixhorne | 1309 | "action" + |
1310 | lpeg.P(false) |