Subversion Repositories eduke32

Rev

Rev 4970 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1048 terminx 1
//-------------------------------------------------------------------------
2
/*
1652 terminx 3
Copyright (C) 2010 EDuke32 developers and contributors
1048 terminx 4
 
1652 terminx 5
This file is part of EDuke32.
1048 terminx 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.
1048 terminx 20
*/
21
//-------------------------------------------------------------------------
1652 terminx 22
 
1180 terminx 23
/*
1048 terminx 24
#include "duke3d.h"
25
#include "gamedef.h"
26
#include "osd.h"
1180 terminx 27
*/
1048 terminx 28
// this is all the crap for accessing the game's structs through the CON VM
1181 terminx 29
// I got a 3-4 fps gain by inlining these...
1048 terminx 30
 
4747 terminx 31
#ifndef gamevars_c_
1625 terminx 32
static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t lVar2)
1048 terminx 33
{
4680 terminx 34
    if (EDUKE32_PREDICT_FALSE(vm.g_p != myconnectindex))
1048 terminx 35
    {
36
        insptr += (lVar2 == MAXGAMEVARS);
37
        return;
38
    }
39
 
1180 terminx 40
    if (iSet)
1048 terminx 41
    {
4897 terminx 42
        iSet = Gv_GetVarX(lVar2);
1048 terminx 43
 
4897 terminx 44
        switch (lLabelID)
1048 terminx 45
        {
4897 terminx 46
            case USERDEFS_GOD: ud.god = iSet; break;
47
            case USERDEFS_WARP_ON: ud.warp_on = iSet; break;
48
            case USERDEFS_CASHMAN: ud.cashman = iSet; break;
49
            case USERDEFS_EOG: ud.eog = iSet; break;
50
            case USERDEFS_SHOWALLMAP: ud.showallmap = iSet; break;
51
            case USERDEFS_SHOW_HELP: ud.show_help = iSet; break;
52
            case USERDEFS_SCROLLMODE: ud.scrollmode = iSet; break;
53
            case USERDEFS_CLIPPING: ud.noclip = iSet; break;
54
            //  case USERDEFS_USER_NAME: ud.user_name[MAXPLAYERS][32] = lValue; break;
55
            //  case USERDEFS_RIDECULE: ud.ridecule = lValue; break;
56
            //  case USERDEFS_SAVEGAME: ud.savegame = lValue; break;
57
            //  case USERDEFS_PWLOCKOUT: ud.pwlockout = lValue; break;
58
            //  case USERDEFS_RTSNAME: ud.rtsname = lValue; break;
59
            case USERDEFS_OVERHEAD_ON: ud.overhead_on = iSet; break;
60
            case USERDEFS_LAST_OVERHEAD: ud.last_overhead = iSet; break;
61
            case USERDEFS_SHOWWEAPONS: ud.showweapons = iSet; break;
62
            case USERDEFS_PAUSE_ON: ud.pause_on = iSet; break;
63
            case USERDEFS_FROM_BONUS: ud.from_bonus = iSet; break;
64
            case USERDEFS_CAMERASPRITE: ud.camerasprite = iSet; break;
65
            case USERDEFS_LAST_CAMSPRITE: ud.last_camsprite = iSet; break;
66
            case USERDEFS_LAST_LEVEL: ud.last_level = iSet; break;
67
            case USERDEFS_SECRETLEVEL: ud.secretlevel = iSet; break;
68
            case USERDEFS_CONST_VISIBILITY: ud.const_visibility = iSet; break;
69
            case USERDEFS_UW_FRAMERATE: ud.uw_framerate = iSet; break;
70
            case USERDEFS_CAMERA_TIME: ud.camera_time = iSet; break;
71
            case USERDEFS_FOLFVEL: ud.folfvel = iSet; break;
72
            case USERDEFS_FOLAVEL: ud.folavel = iSet; break;
73
            case USERDEFS_FOLX: ud.folx = iSet; break;
74
            case USERDEFS_FOLY: ud.foly = iSet; break;
75
            case USERDEFS_FOLA: ud.fola = iSet; break;
76
            case USERDEFS_RECCNT: ud.reccnt = iSet; break;
77
            case USERDEFS_ENTERED_NAME: ud.entered_name = iSet; break;
78
            case USERDEFS_SCREEN_TILTING: ud.screen_tilting = iSet; break;
79
            case USERDEFS_SHADOWS: ud.shadows = iSet; break;
80
            case USERDEFS_FTA_ON: ud.fta_on = iSet; break;
81
            case USERDEFS_EXECUTIONS: ud.executions = iSet; break;
82
            case USERDEFS_AUTO_RUN: ud.auto_run = iSet; break;
83
            case USERDEFS_COORDS: ud.coords = iSet; break;
84
            case USERDEFS_TICKRATE: ud.tickrate = iSet; break;
85
            case USERDEFS_M_COOP: ud.m_coop = iSet; break;
86
            case USERDEFS_COOP: ud.coop = iSet; break;
87
            case USERDEFS_SCREEN_SIZE:
88
                if (ud.screen_size != iSet)
89
                {
90
                    ud.screen_size = iSet;
91
                    G_UpdateScreenArea();
92
                }
93
                break;
94
            case USERDEFS_LOCKOUT: ud.lockout = iSet; break;
95
            case USERDEFS_CROSSHAIR: ud.crosshair = iSet; break;
96
            case USERDEFS_PLAYERAI: ud.playerai = iSet; break;
97
            case USERDEFS_RESPAWN_MONSTERS: ud.respawn_monsters = iSet; break;
98
            case USERDEFS_RESPAWN_ITEMS: ud.respawn_items = iSet; break;
99
            case USERDEFS_RESPAWN_INVENTORY: ud.respawn_inventory = iSet; break;
100
            case USERDEFS_RECSTAT: ud.recstat = iSet; break;
101
            case USERDEFS_MONSTERS_OFF: ud.monsters_off = iSet; break;
102
            case USERDEFS_BRIGHTNESS: ud.brightness = iSet; break;
103
            case USERDEFS_M_RESPAWN_ITEMS: ud.m_respawn_items = iSet; break;
104
            case USERDEFS_M_RESPAWN_MONSTERS: ud.m_respawn_monsters = iSet; break;
105
            case USERDEFS_M_RESPAWN_INVENTORY: ud.m_respawn_inventory = iSet; break;
106
            case USERDEFS_M_RECSTAT: ud.m_recstat = iSet; break;
107
            case USERDEFS_M_MONSTERS_OFF: ud.m_monsters_off = iSet; break;
2709 helixhorne 108
            // REMINDER: must implement "boolean" setters like this in Lunatic, too.
4897 terminx 109
            case USERDEFS_DETAIL: ud.detail = !!iSet; break;
110
            case USERDEFS_M_FFIRE: ud.m_ffire = iSet; break;
111
            case USERDEFS_FFIRE: ud.ffire = iSet; break;
112
            case USERDEFS_M_PLAYER_SKILL: ud.m_player_skill = iSet; break;
113
            case USERDEFS_M_LEVEL_NUMBER: ud.m_level_number = iSet; break;
114
            case USERDEFS_M_VOLUME_NUMBER: ud.m_volume_number = iSet; break;
115
            case USERDEFS_MULTIMODE: ud.multimode = iSet; break;
116
            case USERDEFS_PLAYER_SKILL: ud.player_skill = iSet; break;
117
            case USERDEFS_LEVEL_NUMBER: ud.level_number = iSet; break;
118
            case USERDEFS_VOLUME_NUMBER: ud.volume_number = iSet; break;
119
            case USERDEFS_M_MARKER: ud.m_marker = iSet; break;
120
            case USERDEFS_MARKER: ud.marker = iSet; break;
121
            case USERDEFS_MOUSEFLIP: ud.mouseflip = iSet; break;
122
            case USERDEFS_STATUSBARSCALE: ud.statusbarscale = iSet; break;
123
            case USERDEFS_DRAWWEAPON: ud.drawweapon = iSet; break;
124
            case USERDEFS_MOUSEAIMING: ud.mouseaiming = iSet; break;
125
            case USERDEFS_WEAPONSWITCH: ud.weaponswitch = iSet; break;
126
            case USERDEFS_DEMOCAMS: ud.democams = iSet; break;
127
            case USERDEFS_COLOR: ud.color = iSet; break;
128
            case USERDEFS_MSGDISPTIME: ud.msgdisptime = iSet; break;
129
            case USERDEFS_STATUSBARMODE: ud.statusbarmode = iSet; break;
130
            case USERDEFS_M_NOEXITS: ud.m_noexits = iSet; break;
131
            case USERDEFS_NOEXITS: ud.noexits = iSet; break;
132
            case USERDEFS_AUTOVOTE: ud.autovote = iSet; break;
133
            case USERDEFS_AUTOMSG: ud.automsg = iSet; break;
134
            case USERDEFS_IDPLAYERS: ud.idplayers = iSet; break;
135
            case USERDEFS_TEAM: ud.team = iSet; break;
136
            case USERDEFS_VIEWBOB: ud.viewbob = iSet; break;
137
            case USERDEFS_WEAPONSWAY: ud.weaponsway = iSet; break;
138
            case USERDEFS_ANGLEINTERPOLATION: ud.angleinterpolation = iSet; break;
139
            case USERDEFS_OBITUARIES: ud.obituaries = iSet; break;
140
            case USERDEFS_LEVELSTATS: ud.levelstats = iSet; break;
141
            case USERDEFS_CROSSHAIRSCALE: ud.crosshairscale = iSet; break;
142
            case USERDEFS_ALTHUD: ud.althud = iSet; break;
143
            case USERDEFS_DISPLAY_BONUS_SCREEN: ud.display_bonus_screen = iSet; break;
144
            case USERDEFS_SHOW_LEVEL_TEXT: ud.show_level_text = iSet; break;
145
            case USERDEFS_WEAPONSCALE: ud.weaponscale = iSet; break;
146
            case USERDEFS_TEXTSCALE: ud.textscale = iSet; break;
147
            case USERDEFS_RUNKEY_MODE: ud.runkey_mode = iSet; break;
4945 hendricks2 148
            case USERDEFS_M_ORIGIN_X: ud.m_origin.x = iSet; break;
149
            case USERDEFS_M_ORIGIN_Y: ud.m_origin.y = iSet; break;
4897 terminx 150
            default: break;
1048 terminx 151
        }
4897 terminx 152
    }
153
    else
154
    {
155
        switch (lLabelID)
1048 terminx 156
        {
4897 terminx 157
            case USERDEFS_GOD: lLabelID = ud.god; break;
158
            case USERDEFS_WARP_ON: lLabelID = ud.warp_on; break;
159
            case USERDEFS_CASHMAN: lLabelID = ud.cashman; break;
160
            case USERDEFS_EOG: lLabelID = ud.eog; break;
161
            case USERDEFS_SHOWALLMAP: lLabelID = ud.showallmap; break;
162
            case USERDEFS_SHOW_HELP: lLabelID = ud.show_help; break;
163
            case USERDEFS_SCROLLMODE: lLabelID = ud.scrollmode; break;
164
            case USERDEFS_CLIPPING: lLabelID = ud.noclip; break;
165
            //  case USERDEFS_USER_NAME: lLabelID= ud.user_name[MAXPLAYERS][32]; break;
166
            //  case USERDEFS_RIDECULE: lLabelID= ud.ridecule; break;
167
            //  case USERDEFS_SAVEGAME: lLabelID= ud.savegame; break;
168
            //  case USERDEFS_PWLOCKOUT: lLabelID= ud.pwlockout; break;
169
            //  case USERDEFS_RTSNAME: lLabelID= ud.rtsname; break;
170
            case USERDEFS_OVERHEAD_ON: lLabelID = ud.overhead_on; break;
171
            case USERDEFS_LAST_OVERHEAD: lLabelID = ud.last_overhead; break;
172
            case USERDEFS_SHOWWEAPONS: lLabelID = ud.showweapons; break;
173
            case USERDEFS_PAUSE_ON: lLabelID = ud.pause_on; break;
174
            case USERDEFS_FROM_BONUS: lLabelID = ud.from_bonus; break;
175
            case USERDEFS_CAMERASPRITE: lLabelID = ud.camerasprite; break;
176
            case USERDEFS_LAST_CAMSPRITE: lLabelID = ud.last_camsprite; break;
177
            case USERDEFS_LAST_LEVEL: lLabelID = ud.last_level; break;
178
            case USERDEFS_SECRETLEVEL: lLabelID = ud.secretlevel; break;
179
            case USERDEFS_CONST_VISIBILITY: lLabelID = ud.const_visibility; break;
180
            case USERDEFS_UW_FRAMERATE: lLabelID = ud.uw_framerate; break;
181
            case USERDEFS_CAMERA_TIME: lLabelID = ud.camera_time; break;
182
            case USERDEFS_FOLFVEL: lLabelID = ud.folfvel; break;
183
            case USERDEFS_FOLAVEL: lLabelID = ud.folavel; break;
184
            case USERDEFS_FOLX: lLabelID = ud.folx; break;
185
            case USERDEFS_FOLY: lLabelID = ud.foly; break;
186
            case USERDEFS_FOLA: lLabelID = ud.fola; break;
187
            case USERDEFS_RECCNT: lLabelID = ud.reccnt; break;
188
            case USERDEFS_ENTERED_NAME: lLabelID = ud.entered_name; break;
189
            case USERDEFS_SCREEN_TILTING: lLabelID = ud.screen_tilting; break;
190
            case USERDEFS_SHADOWS: lLabelID = ud.shadows; break;
191
            case USERDEFS_FTA_ON: lLabelID = ud.fta_on; break;
192
            case USERDEFS_EXECUTIONS: lLabelID = ud.executions; break;
193
            case USERDEFS_AUTO_RUN: lLabelID = ud.auto_run; break;
194
            case USERDEFS_COORDS: lLabelID = ud.coords; break;
195
            case USERDEFS_TICKRATE: lLabelID = ud.tickrate; break;
196
            case USERDEFS_M_COOP: lLabelID = ud.m_coop; break;
197
            case USERDEFS_COOP: lLabelID = ud.coop; break;
198
            case USERDEFS_SCREEN_SIZE: lLabelID = ud.screen_size; break;
199
            case USERDEFS_LOCKOUT: lLabelID = ud.lockout; break;
200
            case USERDEFS_CROSSHAIR: lLabelID = ud.crosshair; break;
201
            case USERDEFS_PLAYERAI: lLabelID = ud.playerai; break;
202
            case USERDEFS_RESPAWN_MONSTERS: lLabelID = ud.respawn_monsters; break;
203
            case USERDEFS_RESPAWN_ITEMS: lLabelID = ud.respawn_items; break;
204
            case USERDEFS_RESPAWN_INVENTORY: lLabelID = ud.respawn_inventory; break;
205
            case USERDEFS_RECSTAT: lLabelID = ud.recstat; break;
206
            case USERDEFS_MONSTERS_OFF: lLabelID = ud.monsters_off; break;
207
            case USERDEFS_BRIGHTNESS: lLabelID = ud.brightness; break;
208
            case USERDEFS_M_RESPAWN_ITEMS: lLabelID = ud.m_respawn_items; break;
209
            case USERDEFS_M_RESPAWN_MONSTERS: lLabelID = ud.m_respawn_monsters; break;
210
            case USERDEFS_M_RESPAWN_INVENTORY: lLabelID = ud.m_respawn_inventory; break;
211
            case USERDEFS_M_RECSTAT: lLabelID = ud.m_recstat; break;
212
            case USERDEFS_M_MONSTERS_OFF: lLabelID = ud.m_monsters_off; break;
213
            case USERDEFS_DETAIL: lLabelID = ud.detail; break;
214
            case USERDEFS_M_FFIRE: lLabelID = ud.m_ffire; break;
215
            case USERDEFS_FFIRE: lLabelID = ud.ffire; break;
216
            case USERDEFS_M_PLAYER_SKILL: lLabelID = ud.m_player_skill; break;
217
            case USERDEFS_M_LEVEL_NUMBER: lLabelID = ud.m_level_number; break;
218
            case USERDEFS_M_VOLUME_NUMBER: lLabelID = ud.m_volume_number; break;
219
            case USERDEFS_MULTIMODE: lLabelID = ud.multimode; break;
220
            case USERDEFS_PLAYER_SKILL: lLabelID = ud.player_skill; break;
221
            case USERDEFS_LEVEL_NUMBER: lLabelID = ud.level_number; break;
222
            case USERDEFS_VOLUME_NUMBER: lLabelID = ud.volume_number; break;
223
            case USERDEFS_M_MARKER: lLabelID = ud.m_marker; break;
224
            case USERDEFS_MARKER: lLabelID = ud.marker; break;
225
            case USERDEFS_MOUSEFLIP: lLabelID = ud.mouseflip; break;
226
            case USERDEFS_STATUSBARSCALE: lLabelID = ud.statusbarscale; break;
227
            case USERDEFS_DRAWWEAPON: lLabelID = ud.drawweapon; break;
228
            case USERDEFS_MOUSEAIMING: lLabelID = ud.mouseaiming; break;
229
            case USERDEFS_WEAPONSWITCH: lLabelID = ud.weaponswitch; break;
230
            case USERDEFS_DEMOCAMS: lLabelID = ud.democams; break;
231
            case USERDEFS_COLOR: lLabelID = ud.color; break;
232
            case USERDEFS_MSGDISPTIME: lLabelID = ud.msgdisptime; break;
233
            case USERDEFS_STATUSBARMODE: lLabelID = ud.statusbarmode; break;
234
            case USERDEFS_M_NOEXITS: lLabelID = ud.m_noexits; break;
235
            case USERDEFS_NOEXITS: lLabelID = ud.noexits; break;
236
            case USERDEFS_AUTOVOTE: lLabelID = ud.autovote; break;
237
            case USERDEFS_AUTOMSG: lLabelID = ud.automsg; break;
238
            case USERDEFS_IDPLAYERS: lLabelID = ud.idplayers; break;
239
            case USERDEFS_TEAM: lLabelID = ud.team; break;
240
            case USERDEFS_VIEWBOB: lLabelID = ud.viewbob; break;
241
            case USERDEFS_WEAPONSWAY: lLabelID = ud.weaponsway; break;
242
            case USERDEFS_ANGLEINTERPOLATION: lLabelID = ud.angleinterpolation; break;
243
            case USERDEFS_OBITUARIES: lLabelID = ud.obituaries; break;
244
            case USERDEFS_LEVELSTATS: lLabelID = ud.levelstats; break;
245
            case USERDEFS_CROSSHAIRSCALE: lLabelID = ud.crosshairscale; break;
246
            case USERDEFS_ALTHUD: lLabelID = ud.althud; break;
247
            case USERDEFS_DISPLAY_BONUS_SCREEN: lLabelID = ud.display_bonus_screen; break;
248
            case USERDEFS_SHOW_LEVEL_TEXT: lLabelID = ud.show_level_text; break;
249
            case USERDEFS_WEAPONSCALE: lLabelID = ud.weaponscale; break;
250
            case USERDEFS_TEXTSCALE: lLabelID = ud.textscale; break;
251
            case USERDEFS_RUNKEY_MODE: lLabelID = ud.runkey_mode; break;
4945 hendricks2 252
            case USERDEFS_M_ORIGIN_X: lLabelID = ud.m_origin.x; break;
253
            case USERDEFS_M_ORIGIN_Y: lLabelID = ud.m_origin.y; break;
4968 hendricks2 254
            case USERDEFS_PLAYERBEST: lLabelID = ud.playerbest; break;
4970 hendricks2 255
            case USERDEFS_MUSICTOGGLE: lLabelID = ud.config.MusicToggle; break;
5043 hendricks2 256
            case USERDEFS_USEVOXELS: lLabelID = usevoxels; break;
257
            case USERDEFS_USEHIGHTILE:
258
#ifdef USE_OPENGL
259
                lLabelID = usehightile;
260
                break;
261
#endif
262
            case USERDEFS_USEMODELS:
263
#ifdef USE_OPENGL
264
                lLabelID = usemodels;
265
#else
266
                lLabelID = 0;
267
#endif
268
                break;
4897 terminx 269
            default: lLabelID = -1; break;
1048 terminx 270
        }
4897 terminx 271
        Gv_SetVarX(lVar2, lLabelID);
1048 terminx 272
    }
273
}
274
 
1625 terminx 275
static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2)
1048 terminx 276
{
4897 terminx 277
    register int32_t const proj = (lVar1 != g_iThisActorID) ? Gv_GetVarX(lVar1) : vm.g_i;
1048 terminx 278
 
3429 helixhorne 279
    // http://forums.duke4.net/topic/775-eduke32-20-and-polymer/page__view__findpost__p__143260
280
 
4680 terminx 281
    if (EDUKE32_PREDICT_FALSE((unsigned)proj >= MAXSPRITES))
1048 terminx 282
    {
1625 terminx 283
        //        OSD_Printf("VM_AccessActiveProjectile(): invalid projectile (%d)\n",proj);
3000 helixhorne 284
        CON_ERRPRINTF("tried to %s %s on invalid target projectile (%d) %d %d from %s\n",
3238 hendricks2 285
                      iSet?"set":"get",ProjectileLabels[lLabelID].name,proj,vm.g_i,TrackerCast(vm.g_sp->picnum),
3000 helixhorne 286
                      (lVar1<MAXGAMEVARS)?aGameVars[lVar1].szLabel:"extended");
1048 terminx 287
        insptr += (lVar2 == MAXGAMEVARS);
288
        return;
289
    }
290
 
1180 terminx 291
    if (iSet)
1048 terminx 292
    {
4897 terminx 293
        iSet=Gv_GetVarX(lVar2);
1048 terminx 294
 
4897 terminx 295
        switch (lLabelID)
1048 terminx 296
        {
4897 terminx 297
            case PROJ_WORKSLIKE: SpriteProjectile[proj].workslike = iSet; break;
298
            case PROJ_SPAWNS: SpriteProjectile[proj].spawns = iSet; break;
299
            case PROJ_SXREPEAT: SpriteProjectile[proj].sxrepeat = iSet; break;
300
            case PROJ_SYREPEAT: SpriteProjectile[proj].syrepeat = iSet; break;
301
            case PROJ_SOUND: SpriteProjectile[proj].sound = iSet; break;
302
            case PROJ_ISOUND: SpriteProjectile[proj].isound = iSet; break;
303
            case PROJ_VEL: SpriteProjectile[proj].vel = iSet; break;
304
            case PROJ_EXTRA: SpriteProjectile[proj].extra = iSet; break;
305
            case PROJ_DECAL: SpriteProjectile[proj].decal = iSet; break;
306
            case PROJ_TRAIL: SpriteProjectile[proj].trail = iSet; break;
307
            case PROJ_TXREPEAT: SpriteProjectile[proj].txrepeat = iSet; break;
308
            case PROJ_TYREPEAT: SpriteProjectile[proj].tyrepeat = iSet; break;
309
            case PROJ_TOFFSET: SpriteProjectile[proj].toffset = iSet; break;
310
            case PROJ_TNUM: SpriteProjectile[proj].tnum = iSet; break;
311
            case PROJ_DROP: SpriteProjectile[proj].drop = iSet; break;
312
            case PROJ_CSTAT: SpriteProjectile[proj].cstat = iSet; break;
313
            case PROJ_CLIPDIST: SpriteProjectile[proj].clipdist = iSet; break;
314
            case PROJ_SHADE: SpriteProjectile[proj].shade = iSet; break;
315
            case PROJ_XREPEAT: SpriteProjectile[proj].xrepeat = iSet; break;
316
            case PROJ_YREPEAT: SpriteProjectile[proj].yrepeat = iSet; break;
317
            case PROJ_PAL: SpriteProjectile[proj].pal = iSet; break;
318
            case PROJ_EXTRA_RAND: SpriteProjectile[proj].extra_rand = iSet; break;
319
            case PROJ_HITRADIUS: SpriteProjectile[proj].hitradius = iSet; break;
320
            case PROJ_MOVECNT: SpriteProjectile[proj].movecnt = iSet; break;
321
            case PROJ_OFFSET: SpriteProjectile[proj].offset = iSet; break;
322
            case PROJ_BOUNCES: SpriteProjectile[proj].bounces = iSet; break;
323
            case PROJ_BSOUND: SpriteProjectile[proj].bsound = iSet; break;
324
            case PROJ_RANGE: SpriteProjectile[proj].range = iSet; break;
325
            case PROJ_FLASH_COLOR: SpriteProjectile[proj].flashcolor = iSet; break;
326
            case PROJ_USERDATA: SpriteProjectile[proj].userdata = iSet; break;
327
            default: break;
1048 terminx 328
        }
4897 terminx 329
    }
330
    else
331
    {
332
        switch (lLabelID)
1048 terminx 333
        {
4897 terminx 334
            case PROJ_WORKSLIKE: lLabelID = SpriteProjectile[proj].workslike; break;
335
            case PROJ_SPAWNS: lLabelID = SpriteProjectile[proj].spawns; break;
336
            case PROJ_SXREPEAT: lLabelID = SpriteProjectile[proj].sxrepeat; break;
337
            case PROJ_SYREPEAT: lLabelID = SpriteProjectile[proj].syrepeat; break;
338
            case PROJ_SOUND: lLabelID = SpriteProjectile[proj].sound; break;
339
            case PROJ_ISOUND: lLabelID = SpriteProjectile[proj].isound; break;
340
            case PROJ_VEL: lLabelID = SpriteProjectile[proj].vel; break;
341
            case PROJ_EXTRA: lLabelID = SpriteProjectile[proj].extra; break;
342
            case PROJ_DECAL: lLabelID = SpriteProjectile[proj].decal; break;
343
            case PROJ_TRAIL: lLabelID = SpriteProjectile[proj].trail; break;
344
            case PROJ_TXREPEAT: lLabelID = SpriteProjectile[proj].txrepeat; break;
345
            case PROJ_TYREPEAT: lLabelID = SpriteProjectile[proj].tyrepeat; break;
346
            case PROJ_TOFFSET: lLabelID = SpriteProjectile[proj].toffset; break;
347
            case PROJ_TNUM: lLabelID = SpriteProjectile[proj].tnum; break;
348
            case PROJ_DROP: lLabelID = SpriteProjectile[proj].drop; break;
349
            case PROJ_CSTAT: lLabelID = SpriteProjectile[proj].cstat; break;
350
            case PROJ_CLIPDIST: lLabelID = SpriteProjectile[proj].clipdist; break;
351
            case PROJ_SHADE: lLabelID = SpriteProjectile[proj].shade; break;
352
            case PROJ_XREPEAT: lLabelID = SpriteProjectile[proj].xrepeat; break;
353
            case PROJ_YREPEAT: lLabelID = SpriteProjectile[proj].yrepeat; break;
354
            case PROJ_PAL: lLabelID = SpriteProjectile[proj].pal; break;
355
            case PROJ_EXTRA_RAND: lLabelID = SpriteProjectile[proj].extra_rand; break;
356
            case PROJ_HITRADIUS: lLabelID = SpriteProjectile[proj].hitradius; break;
357
            case PROJ_MOVECNT: lLabelID = SpriteProjectile[proj].movecnt; break;
358
            case PROJ_OFFSET: lLabelID = SpriteProjectile[proj].offset; break;
359
            case PROJ_BOUNCES: lLabelID = SpriteProjectile[proj].bounces; break;
360
            case PROJ_BSOUND: lLabelID = SpriteProjectile[proj].bsound; break;
361
            case PROJ_RANGE: lLabelID = SpriteProjectile[proj].range; break;
362
            case PROJ_FLASH_COLOR: lLabelID = SpriteProjectile[proj].flashcolor; break;
363
            case PROJ_USERDATA: lLabelID = SpriteProjectile[proj].userdata; break;
364
            default: lLabelID = -1; break;
1048 terminx 365
        }
366
 
4897 terminx 367
        Gv_SetVarX(lVar2, lLabelID);
1048 terminx 368
    }
369
}
370
 
1625 terminx 371
static void __fastcall VM_GetPlayer(register int32_t lVar1, register int32_t lLabelID, register int32_t lVar2, int32_t lParm2)
1048 terminx 372
{
4897 terminx 373
    register int32_t const iPlayer = (lVar1 != g_iThisActorID) ? Gv_GetVarX(lVar1) : vm.g_p;
374
    DukePlayer_t *const ps = g_player[iPlayer].ps;
1048 terminx 375
 
4680 terminx 376
    if (EDUKE32_PREDICT_FALSE((unsigned)iPlayer >= (unsigned)playerswhenstarted))
1440 terminx 377
        goto badplayer;
378
 
4897 terminx 379
    if (EDUKE32_PREDICT_FALSE(PlayerLabels[lLabelID].flags & LABEL_HASPARM2 &&
380
       ((unsigned)lParm2 >= (unsigned)PlayerLabels[lLabelID].maxParm2)))
1440 terminx 381
        goto badpos;
382
 
383
    switch (lLabelID)
1048 terminx 384
    {
4897 terminx 385
        case PLAYER_ZOOM: lLabelID = ps->zoom; break;
386
        case PLAYER_EXITX: lLabelID = ps->exitx; break;
387
        case PLAYER_EXITY: lLabelID = ps->exity; break;
388
        case PLAYER_LOOGIEX: lLabelID = ps->loogiex[lParm2]; break;
389
        case PLAYER_LOOGIEY: lLabelID = ps->loogiey[lParm2]; break;
390
        case PLAYER_NUMLOOGS: lLabelID = ps->numloogs; break;
391
        case PLAYER_LOOGCNT: lLabelID = ps->loogcnt; break;
392
        case PLAYER_POSX: lLabelID = ps->pos.x; break;
393
        case PLAYER_POSY: lLabelID = ps->pos.y; break;
394
        case PLAYER_POSZ: lLabelID = ps->pos.z; break;
395
        case PLAYER_HORIZ: lLabelID = ps->horiz; break;
396
        case PLAYER_OHORIZ: lLabelID = ps->ohoriz; break;
397
        case PLAYER_OHORIZOFF: lLabelID = ps->ohorizoff; break;
398
        case PLAYER_INVDISPTIME: lLabelID = ps->invdisptime; break;
399
        case PLAYER_BOBPOSX: lLabelID = ps->bobpos.x; break;
400
        case PLAYER_BOBPOSY: lLabelID = ps->bobpos.y; break;
401
        case PLAYER_OPOSX: lLabelID = ps->opos.x; break;
402
        case PLAYER_OPOSY: lLabelID = ps->opos.y; break;
403
        case PLAYER_OPOSZ: lLabelID = ps->opos.z; break;
404
        case PLAYER_PYOFF: lLabelID = ps->pyoff; break;
405
        case PLAYER_OPYOFF: lLabelID = ps->opyoff; break;
406
        case PLAYER_POSXV: lLabelID = ps->vel.x; break;
407
        case PLAYER_POSYV: lLabelID = ps->vel.y; break;
408
        case PLAYER_POSZV: lLabelID = ps->vel.z; break;
409
        case PLAYER_LAST_PISSED_TIME: lLabelID = ps->last_pissed_time; break;
410
        case PLAYER_TRUEFZ: lLabelID = ps->truefz; break;
411
        case PLAYER_TRUECZ: lLabelID = ps->truecz; break;
412
        case PLAYER_PLAYER_PAR: lLabelID = ps->player_par; break;
413
        case PLAYER_VISIBILITY: lLabelID = ps->visibility; break;
414
        case PLAYER_BOBCOUNTER: lLabelID = ps->bobcounter; break;
415
        case PLAYER_WEAPON_SWAY: lLabelID = ps->weapon_sway; break;
416
        case PLAYER_PALS_TIME: lLabelID = ps->pals.f; break;
417
        case PLAYER_RANDOMFLAMEX: lLabelID = ps->randomflamex; break;
418
        case PLAYER_CRACK_TIME: lLabelID = ps->crack_time; break;
419
        case PLAYER_AIM_MODE: lLabelID = ps->aim_mode; break;
420
        case PLAYER_ANG: lLabelID = ps->ang; break;
421
        case PLAYER_OANG: lLabelID = ps->oang; break;
422
        case PLAYER_ANGVEL: lLabelID = ps->angvel; break;
423
        case PLAYER_CURSECTNUM: lLabelID = ps->cursectnum; break;
424
        case PLAYER_LOOK_ANG: lLabelID = ps->look_ang; break;
425
        case PLAYER_LAST_EXTRA: lLabelID = ps->last_extra; break;
426
        case PLAYER_SUBWEAPON: lLabelID = ps->subweapon; break;
427
        case PLAYER_AMMO_AMOUNT: lLabelID = ps->ammo_amount[lParm2]; break;
428
        case PLAYER_WACKEDBYACTOR: lLabelID = ps->wackedbyactor; break;
429
        case PLAYER_FRAG: lLabelID = ps->frag; break;
430
        case PLAYER_FRAGGEDSELF: lLabelID = ps->fraggedself; break;
431
        case PLAYER_CURR_WEAPON: lLabelID = ps->curr_weapon; break;
432
        case PLAYER_LAST_WEAPON: lLabelID = ps->last_weapon; break;
433
        case PLAYER_TIPINCS: lLabelID = ps->tipincs; break;
434
        case PLAYER_HORIZOFF: lLabelID = ps->horizoff; break;
435
        case PLAYER_WANTWEAPONFIRE: lLabelID = ps->wantweaponfire; break;
436
        case PLAYER_HOLODUKE_AMOUNT: lLabelID = ps->inv_amount[GET_HOLODUKE]; break;
437
        case PLAYER_NEWOWNER: lLabelID = ps->newowner; break;
438
        case PLAYER_HURT_DELAY: lLabelID = ps->hurt_delay; break;
439
        case PLAYER_HBOMB_HOLD_DELAY: lLabelID = ps->hbomb_hold_delay; break;
440
        case PLAYER_JUMPING_COUNTER: lLabelID = ps->jumping_counter; break;
441
        case PLAYER_AIRLEFT: lLabelID = ps->airleft; break;
442
        case PLAYER_KNEE_INCS: lLabelID = ps->knee_incs; break;
443
        case PLAYER_ACCESS_INCS: lLabelID = ps->access_incs; break;
444
        case PLAYER_FTA: lLabelID = ps->fta; break;
445
        case PLAYER_FTQ: lLabelID = ps->ftq; break;
446
        case PLAYER_ACCESS_WALLNUM: lLabelID = ps->access_wallnum; break;
447
        case PLAYER_ACCESS_SPRITENUM: lLabelID = ps->access_spritenum; break;
448
        case PLAYER_KICKBACK_PIC: lLabelID = ps->kickback_pic; break;
449
        case PLAYER_GOT_ACCESS: lLabelID = ps->got_access; break;
450
        case PLAYER_WEAPON_ANG: lLabelID = ps->weapon_ang; break;
451
        case PLAYER_FIRSTAID_AMOUNT: lLabelID = ps->inv_amount[GET_FIRSTAID]; break;
452
        case PLAYER_SOMETHINGONPLAYER: lLabelID = ps->somethingonplayer; break;
453
        case PLAYER_ON_CRANE: lLabelID = ps->on_crane; break;
454
        case PLAYER_I: lLabelID = ps->i; break;
455
        case PLAYER_ONE_PARALLAX_SECTNUM: lLabelID = ps->one_parallax_sectnum; break;
456
        case PLAYER_OVER_SHOULDER_ON: lLabelID = ps->over_shoulder_on; break;
457
        case PLAYER_RANDOM_CLUB_FRAME: lLabelID = ps->random_club_frame; break;
458
        case PLAYER_FIST_INCS: lLabelID = ps->fist_incs; break;
459
        case PLAYER_ONE_EIGHTY_COUNT: lLabelID = ps->one_eighty_count; break;
460
        case PLAYER_CHEAT_PHASE: lLabelID = ps->cheat_phase; break;
461
        case PLAYER_DUMMYPLAYERSPRITE: lLabelID = ps->dummyplayersprite; break;
462
        case PLAYER_EXTRA_EXTRA8: lLabelID = ps->extra_extra8; break;
463
        case PLAYER_QUICK_KICK: lLabelID = ps->quick_kick; break;
464
        case PLAYER_HEAT_AMOUNT: lLabelID = ps->inv_amount[GET_HEATS]; break;
465
        case PLAYER_ACTORSQU: lLabelID = ps->actorsqu; break;
466
        case PLAYER_TIMEBEFOREEXIT: lLabelID = ps->timebeforeexit; break;
467
        case PLAYER_CUSTOMEXITSOUND: lLabelID = ps->customexitsound; break;
468
        case PLAYER_WEAPRECS: lLabelID = ps->weaprecs[lParm2]; break;
469
        case PLAYER_WEAPRECCNT: lLabelID = ps->weapreccnt; break;
470
        case PLAYER_INTERFACE_TOGGLE_FLAG: lLabelID = ps->interface_toggle_flag; break;
471
        case PLAYER_ROTSCRNANG: lLabelID = ps->rotscrnang; break;
472
        case PLAYER_DEAD_FLAG: lLabelID = ps->dead_flag; break;
473
        case PLAYER_SHOW_EMPTY_WEAPON: lLabelID = ps->show_empty_weapon; break;
474
        case PLAYER_SCUBA_AMOUNT: lLabelID = ps->inv_amount[GET_SCUBA]; break;
475
        case PLAYER_JETPACK_AMOUNT: lLabelID = ps->inv_amount[GET_JETPACK]; break;
476
        case PLAYER_STEROIDS_AMOUNT: lLabelID = ps->inv_amount[GET_STEROIDS]; break;
477
        case PLAYER_SHIELD_AMOUNT: lLabelID = ps->inv_amount[GET_SHIELD]; break;
478
        case PLAYER_HOLODUKE_ON: lLabelID = ps->holoduke_on; break;
479
        case PLAYER_PYCOUNT: lLabelID = ps->pycount; break;
480
        case PLAYER_WEAPON_POS: lLabelID = ps->weapon_pos; break;
481
        case PLAYER_FRAG_PS: lLabelID = ps->frag_ps; break;
482
        case PLAYER_TRANSPORTER_HOLD: lLabelID = ps->transporter_hold; break;
483
        case PLAYER_LAST_FULL_WEAPON: lLabelID = ps->last_full_weapon; break;
484
        case PLAYER_FOOTPRINTSHADE: lLabelID = ps->footprintshade; break;
485
        case PLAYER_BOOT_AMOUNT: lLabelID = ps->inv_amount[GET_BOOTS]; break;
486
        case PLAYER_SCREAM_VOICE: lLabelID = ps->scream_voice; break;
487
        case PLAYER_GM: lLabelID = ps->gm; break;
488
        case PLAYER_ON_WARPING_SECTOR: lLabelID = ps->on_warping_sector; break;
489
        case PLAYER_FOOTPRINTCOUNT: lLabelID = ps->footprintcount; break;
490
        case PLAYER_HBOMB_ON: lLabelID = ps->hbomb_on; break;
491
        case PLAYER_JUMPING_TOGGLE: lLabelID = ps->jumping_toggle; break;
492
        case PLAYER_RAPID_FIRE_HOLD: lLabelID = ps->rapid_fire_hold; break;
493
        case PLAYER_ON_GROUND: lLabelID = ps->on_ground; break;
494
        case PLAYER_INVEN_ICON: lLabelID = ps->inven_icon; break;
495
        case PLAYER_BUTTONPALETTE: lLabelID = ps->buttonpalette; break;
496
        case PLAYER_JETPACK_ON: lLabelID = ps->jetpack_on; break;
497
        case PLAYER_SPRITEBRIDGE: lLabelID = ps->spritebridge; break;
498
        case PLAYER_LASTRANDOMSPOT: lLabelID = ps->lastrandomspot; break;
499
        case PLAYER_SCUBA_ON: lLabelID = ps->scuba_on; break;
500
        case PLAYER_FOOTPRINTPAL: lLabelID = ps->footprintpal; break;
501
        case PLAYER_HEAT_ON: lLabelID = ps->heat_on; break;
502
        case PLAYER_HOLSTER_WEAPON: lLabelID = ps->holster_weapon; break;
503
        case PLAYER_FALLING_COUNTER: lLabelID = ps->falling_counter; break;
504
        case PLAYER_GOTWEAPON: lLabelID = (ps->gotweapon & (1 << lParm2)) != 0; break;
505
        case PLAYER_REFRESH_INVENTORY: lLabelID = ps->refresh_inventory; break;
506
        case PLAYER_PALETTE:  // no set
507
            lLabelID = ps->palette;
508
            break;
509
        case PLAYER_TOGGLE_KEY_FLAG: lLabelID = ps->toggle_key_flag; break;
510
        case PLAYER_KNUCKLE_INCS: lLabelID = ps->knuckle_incs; break;
511
        case PLAYER_WALKING_SND_TOGGLE: lLabelID = ps->walking_snd_toggle; break;
512
        case PLAYER_PALOOKUP: lLabelID = ps->palookup; break;
513
        case PLAYER_HARD_LANDING: lLabelID = ps->hard_landing; break;
514
        case PLAYER_MAX_SECRET_ROOMS: lLabelID = ps->max_secret_rooms; break;
515
        case PLAYER_SECRET_ROOMS: lLabelID = ps->secret_rooms; break;
516
        case PLAYER_PALS:
517
            switch (lParm2)
518
            {
519
                case 0: lLabelID = ps->pals.r; break;
520
                case 1: lLabelID = ps->pals.g; break;
521
                case 2: lLabelID = ps->pals.b; break;
522
            }
523
            break;
524
        case PLAYER_MAX_ACTORS_KILLED: lLabelID = ps->max_actors_killed; break;
525
        case PLAYER_ACTORS_KILLED: lLabelID = ps->actors_killed; break;
526
        case PLAYER_RETURN_TO_CENTER: lLabelID = ps->return_to_center; break;
527
        case PLAYER_RUNSPEED: lLabelID = ps->runspeed; break;
528
        case PLAYER_SBS: lLabelID = ps->sbs; break;
529
        case PLAYER_RELOADING: lLabelID = ps->reloading; break;
530
        case PLAYER_AUTO_AIM: lLabelID = ps->auto_aim; break;
531
        case PLAYER_MOVEMENT_LOCK: lLabelID = ps->movement_lock; break;
532
        case PLAYER_SOUND_PITCH: lLabelID = ps->sound_pitch; break;
533
        case PLAYER_WEAPONSWITCH: lLabelID = ps->weaponswitch; break;
534
        case PLAYER_TEAM: lLabelID = ps->team; break;
535
        case PLAYER_MAX_PLAYER_HEALTH: lLabelID = ps->max_player_health; break;
536
        case PLAYER_MAX_SHIELD_AMOUNT: lLabelID = ps->max_shield_amount; break;
537
        case PLAYER_MAX_AMMO_AMOUNT: lLabelID = ps->max_ammo_amount[lParm2]; break;
538
        case PLAYER_LAST_QUICK_KICK: lLabelID = ps->last_quick_kick; break;
539
        case PLAYER_AUTOSTEP: lLabelID = ps->autostep; break;
540
        case PLAYER_AUTOSTEP_SBW: lLabelID = ps->autostep_sbw; break;
541
        default: lLabelID = -1; break;
1048 terminx 542
    }
543
 
4897 terminx 544
    Gv_SetVarX(lVar2, lLabelID);
545
    return;
546
 
1440 terminx 547
badplayer:
1625 terminx 548
    //        OSD_Printf("VM_AccessPlayer(): invalid target player (%d) %d\n",iPlayer,vm.g_i);
3000 helixhorne 549
    CON_ERRPRINTF("tried to get %s on invalid target player (%d) from spr %d gv %s\n",
550
                  PlayerLabels[lLabelID].name,iPlayer,vm.g_i,
551
                  (lVar1<MAXGAMEVARS)?aGameVars[lVar1].szLabel:"extended");
1440 terminx 552
    return;
1180 terminx 553
 
1440 terminx 554
badpos:
3000 helixhorne 555
    CON_ERRPRINTF("tried to get invalid %s position %d on player (%d) from spr %d\n",
556
                  PlayerLabels[lLabelID].name,lParm2,iPlayer,vm.g_i);
1440 terminx 557
    return;
558
}
559
 
1625 terminx 560
static void __fastcall VM_SetPlayer(int32_t lVar1, int32_t lLabelID, int32_t lVar2, int32_t lParm2)
1440 terminx 561
{
4897 terminx 562
    register int32_t const iPlayer = (lVar1 != g_iThisActorID) ? Gv_GetVarX(lVar1) : vm.g_p;
563
    DukePlayer_t * const ps = g_player[iPlayer].ps;
1440 terminx 564
 
4680 terminx 565
    if (EDUKE32_PREDICT_FALSE((unsigned)iPlayer >= (unsigned)playerswhenstarted))
1440 terminx 566
        goto badplayer;
567
 
4897 terminx 568
    if (EDUKE32_PREDICT_FALSE(PlayerLabels[lLabelID].flags & LABEL_HASPARM2 &&
569
                              (unsigned)lParm2 >= (unsigned)PlayerLabels[lLabelID].maxParm2))
1440 terminx 570
        goto badpos;
571
 
4897 terminx 572
    lVar1 = Gv_GetVarX(lVar2);
1440 terminx 573
 
1048 terminx 574
    switch (lLabelID)
575
    {
4897 terminx 576
        case PLAYER_ZOOM: ps->zoom = lVar1; break;
577
        case PLAYER_EXITX: ps->exitx = lVar1; break;
578
        case PLAYER_EXITY: ps->exity = lVar1; break;
579
        case PLAYER_LOOGIEX: ps->loogiex[lParm2] = lVar1; break;
580
        case PLAYER_LOOGIEY: ps->loogiey[lParm2] = lVar1; break;
581
        case PLAYER_NUMLOOGS: ps->numloogs = lVar1; break;
582
        case PLAYER_LOOGCNT: ps->loogcnt = lVar1; break;
583
        case PLAYER_POSX: ps->pos.x = lVar1; break;
584
        case PLAYER_POSY: ps->pos.y = lVar1; break;
585
        case PLAYER_POSZ: ps->pos.z = lVar1; break;
586
        case PLAYER_HORIZ: ps->horiz = lVar1; break;
587
        case PLAYER_OHORIZ: ps->ohoriz = lVar1; break;
588
        case PLAYER_OHORIZOFF: ps->ohorizoff = lVar1; break;
589
        case PLAYER_INVDISPTIME: ps->invdisptime = lVar1; break;
590
        case PLAYER_BOBPOSX: ps->bobpos.x = lVar1; break;
591
        case PLAYER_BOBPOSY: ps->bobpos.y = lVar1; break;
592
        case PLAYER_OPOSX: ps->opos.x = lVar1; break;
593
        case PLAYER_OPOSY: ps->opos.y = lVar1; break;
594
        case PLAYER_OPOSZ: ps->opos.z = lVar1; break;
595
        case PLAYER_PYOFF: ps->pyoff = lVar1; break;
596
        case PLAYER_OPYOFF: ps->opyoff = lVar1; break;
597
        case PLAYER_POSXV: ps->vel.x = lVar1; break;
598
        case PLAYER_POSYV: ps->vel.y = lVar1; break;
599
        case PLAYER_POSZV: ps->vel.z = lVar1; break;
600
        case PLAYER_LAST_PISSED_TIME: ps->last_pissed_time = lVar1; break;
601
        case PLAYER_TRUEFZ: ps->truefz = lVar1; break;
602
        case PLAYER_TRUECZ: ps->truecz = lVar1; break;
603
        case PLAYER_PLAYER_PAR: ps->player_par = lVar1; break;
604
        case PLAYER_VISIBILITY: ps->visibility = lVar1; break;
605
        case PLAYER_BOBCOUNTER: ps->bobcounter = lVar1; break;
606
        case PLAYER_WEAPON_SWAY: ps->weapon_sway = lVar1; break;
607
        case PLAYER_PALS_TIME: ps->pals.f = lVar1; break;
608
        case PLAYER_RANDOMFLAMEX: ps->randomflamex = lVar1; break;
609
        case PLAYER_CRACK_TIME: ps->crack_time = lVar1; break;
610
        case PLAYER_AIM_MODE: ps->aim_mode = lVar1; break;
611
        case PLAYER_ANG: ps->ang = lVar1; break;
612
        case PLAYER_OANG: ps->oang = lVar1; break;
613
        case PLAYER_ANGVEL: ps->angvel = lVar1; break;
614
        case PLAYER_CURSECTNUM: ps->cursectnum = lVar1; break;
615
        case PLAYER_LOOK_ANG: ps->look_ang = lVar1; break;
616
        case PLAYER_LAST_EXTRA: ps->last_extra = lVar1; break;
617
        case PLAYER_SUBWEAPON: ps->subweapon = lVar1; break;
618
        case PLAYER_AMMO_AMOUNT: ps->ammo_amount[lParm2] = lVar1; break;
619
        case PLAYER_WACKEDBYACTOR: ps->wackedbyactor = lVar1; break;
620
        case PLAYER_FRAG: ps->frag = lVar1; break;
621
        case PLAYER_FRAGGEDSELF: ps->fraggedself = lVar1; break;
622
        case PLAYER_CURR_WEAPON: ps->curr_weapon = lVar1; break;
623
        case PLAYER_LAST_WEAPON: ps->last_weapon = lVar1; break;
624
        case PLAYER_TIPINCS: ps->tipincs = lVar1; break;
625
        case PLAYER_HORIZOFF: ps->horizoff = lVar1; break;
626
        case PLAYER_WANTWEAPONFIRE: ps->wantweaponfire = lVar1; break;
627
        case PLAYER_HOLODUKE_AMOUNT: ps->inv_amount[GET_HOLODUKE] = lVar1; break;
628
        case PLAYER_NEWOWNER: ps->newowner = lVar1; break;
629
        case PLAYER_HURT_DELAY: ps->hurt_delay = lVar1; break;
630
        case PLAYER_HBOMB_HOLD_DELAY: ps->hbomb_hold_delay = lVar1; break;
631
        case PLAYER_JUMPING_COUNTER: ps->jumping_counter = lVar1; break;
632
        case PLAYER_AIRLEFT: ps->airleft = lVar1; break;
633
        case PLAYER_KNEE_INCS: ps->knee_incs = lVar1; break;
634
        case PLAYER_ACCESS_INCS: ps->access_incs = lVar1; break;
635
        case PLAYER_FTA: ps->fta = lVar1; break;
636
        case PLAYER_FTQ: ps->ftq = lVar1; break;
637
        case PLAYER_ACCESS_WALLNUM: ps->access_wallnum = lVar1; break;
638
        case PLAYER_ACCESS_SPRITENUM: ps->access_spritenum = lVar1; break;
639
        case PLAYER_KICKBACK_PIC: ps->kickback_pic = lVar1; break;
640
        case PLAYER_GOT_ACCESS: ps->got_access = lVar1; break;
641
        case PLAYER_WEAPON_ANG: ps->weapon_ang = lVar1; break;
642
        case PLAYER_FIRSTAID_AMOUNT: ps->inv_amount[GET_FIRSTAID] = lVar1; break;
643
        case PLAYER_SOMETHINGONPLAYER: ps->somethingonplayer = lVar1; break;
644
        case PLAYER_ON_CRANE: ps->on_crane = lVar1; break;
645
        case PLAYER_I: ps->i = lVar1; break;
646
        case PLAYER_ONE_PARALLAX_SECTNUM: ps->one_parallax_sectnum = lVar1; break;
647
        case PLAYER_OVER_SHOULDER_ON: ps->over_shoulder_on = lVar1; break;
648
        case PLAYER_RANDOM_CLUB_FRAME: ps->random_club_frame = lVar1; break;
649
        case PLAYER_FIST_INCS: ps->fist_incs = lVar1; break;
650
        case PLAYER_ONE_EIGHTY_COUNT: ps->one_eighty_count = lVar1; break;
651
        case PLAYER_CHEAT_PHASE: ps->cheat_phase = lVar1; break;
652
        case PLAYER_DUMMYPLAYERSPRITE: ps->dummyplayersprite = lVar1; break;
653
        case PLAYER_EXTRA_EXTRA8: ps->extra_extra8 = lVar1; break;
654
        case PLAYER_QUICK_KICK: ps->quick_kick = lVar1; break;
655
        case PLAYER_HEAT_AMOUNT: ps->inv_amount[GET_HEATS] = lVar1; break;
656
        case PLAYER_ACTORSQU: ps->actorsqu = lVar1; break;
657
        case PLAYER_TIMEBEFOREEXIT: ps->timebeforeexit = lVar1; break;
658
        case PLAYER_CUSTOMEXITSOUND: ps->customexitsound = lVar1; break;
659
        case PLAYER_WEAPRECS: ps->weaprecs[lParm2] = lVar1; break;
660
        case PLAYER_WEAPRECCNT: ps->weapreccnt = lVar1; break;
661
        case PLAYER_INTERFACE_TOGGLE_FLAG: ps->interface_toggle_flag = lVar1; break;
662
        case PLAYER_ROTSCRNANG: ps->rotscrnang = lVar1; break;
663
        case PLAYER_DEAD_FLAG: ps->dead_flag = lVar1; break;
664
        case PLAYER_SHOW_EMPTY_WEAPON: ps->show_empty_weapon = lVar1; break;
665
        case PLAYER_SCUBA_AMOUNT: ps->inv_amount[GET_SCUBA] = lVar1; break;
666
        case PLAYER_JETPACK_AMOUNT: ps->inv_amount[GET_JETPACK] = lVar1; break;
667
        case PLAYER_STEROIDS_AMOUNT: ps->inv_amount[GET_STEROIDS] = lVar1; break;
668
        case PLAYER_SHIELD_AMOUNT: ps->inv_amount[GET_SHIELD] = lVar1; break;
669
        case PLAYER_HOLODUKE_ON: ps->holoduke_on = lVar1; break;
670
        case PLAYER_PYCOUNT: ps->pycount = lVar1; break;
671
        case PLAYER_WEAPON_POS: ps->weapon_pos = lVar1; break;
672
        case PLAYER_FRAG_PS: ps->frag_ps = lVar1; break;
673
        case PLAYER_TRANSPORTER_HOLD: ps->transporter_hold = lVar1; break;
674
        case PLAYER_LAST_FULL_WEAPON: ps->last_full_weapon = lVar1; break;
675
        case PLAYER_FOOTPRINTSHADE: ps->footprintshade = lVar1; break;
676
        case PLAYER_BOOT_AMOUNT: ps->inv_amount[GET_BOOTS] = lVar1; break;
677
        case PLAYER_SCREAM_VOICE: ps->scream_voice = lVar1; break;
678
        case PLAYER_GM:
679
            if (!(ps->gm & MODE_MENU) && (lVar1 & MODE_MENU))
680
                M_OpenMenu(iPlayer);
681
            else if ((ps->gm & MODE_MENU) && !(lVar1 & MODE_MENU))
682
                M_CloseMenu(iPlayer);
683
            ps->gm = lVar1;
684
            break;
685
        case PLAYER_ON_WARPING_SECTOR: ps->on_warping_sector = lVar1; break;
686
        case PLAYER_FOOTPRINTCOUNT: ps->footprintcount = lVar1; break;
687
        case PLAYER_HBOMB_ON: ps->hbomb_on = lVar1; break;
688
        case PLAYER_JUMPING_TOGGLE: ps->jumping_toggle = lVar1; break;
689
        case PLAYER_RAPID_FIRE_HOLD: ps->rapid_fire_hold = lVar1; break;
690
        case PLAYER_ON_GROUND: ps->on_ground = lVar1; break;
691
        case PLAYER_INVEN_ICON: ps->inven_icon = lVar1; break;
692
        case PLAYER_BUTTONPALETTE: ps->buttonpalette = lVar1; break;
693
        case PLAYER_JETPACK_ON: ps->jetpack_on = lVar1; break;
694
        case PLAYER_SPRITEBRIDGE: ps->spritebridge = lVar1; break;
695
        case PLAYER_LASTRANDOMSPOT: ps->lastrandomspot = lVar1; break;
696
        case PLAYER_SCUBA_ON: ps->scuba_on = lVar1; break;
697
        case PLAYER_FOOTPRINTPAL: ps->footprintpal = lVar1; break;
698
        case PLAYER_HEAT_ON:
699
            if (ps->heat_on != lVar1)
700
            {
701
                ps->heat_on = lVar1;
702
                P_UpdateScreenPal(ps);
703
            }
704
            break;
705
        case PLAYER_HOLSTER_WEAPON: ps->holster_weapon = lVar1; break;
706
        case PLAYER_FALLING_COUNTER: ps->falling_counter = lVar1; break;
707
        case PLAYER_GOTWEAPON:
708
            if (lVar1) ps->gotweapon |= (1 << lParm2);
709
            else ps->gotweapon &= ~(1 << lParm2);
710
            break;
711
        case PLAYER_REFRESH_INVENTORY: ps->refresh_inventory = lVar1; break;
712
        case PLAYER_TOGGLE_KEY_FLAG: ps->toggle_key_flag = lVar1; break;
713
        case PLAYER_KNUCKLE_INCS: ps->knuckle_incs = lVar1; break;
714
        case PLAYER_WALKING_SND_TOGGLE: ps->walking_snd_toggle = lVar1; break;
715
        case PLAYER_PALOOKUP: ps->palookup = lVar1; break;
716
        case PLAYER_HARD_LANDING: ps->hard_landing = lVar1; break;
717
        case PLAYER_MAX_SECRET_ROOMS: ps->max_secret_rooms = lVar1; break;
718
        case PLAYER_SECRET_ROOMS: ps->secret_rooms = lVar1; break;
719
        case PLAYER_PALS:
720
            switch (lParm2)
721
            {
722
                case 0: ps->pals.r = lVar1; break;
723
                case 1: ps->pals.g = lVar1; break;
724
                case 2: ps->pals.b = lVar1; break;
725
            }
726
            break;
727
        case PLAYER_MAX_ACTORS_KILLED: ps->max_actors_killed = lVar1; break;
728
        case PLAYER_ACTORS_KILLED: ps->actors_killed = lVar1; break;
729
        case PLAYER_RETURN_TO_CENTER: ps->return_to_center = lVar1; break;
730
        case PLAYER_RUNSPEED: ps->runspeed = lVar1; break;
731
        case PLAYER_SBS: ps->sbs = lVar1; break;
732
        case PLAYER_RELOADING: ps->reloading = lVar1; break;
733
        case PLAYER_AUTO_AIM: ps->auto_aim = lVar1; break;
734
        case PLAYER_MOVEMENT_LOCK: ps->movement_lock = lVar1; break;
735
        case PLAYER_SOUND_PITCH: ps->sound_pitch = lVar1; break;
736
        case PLAYER_WEAPONSWITCH: ps->weaponswitch = lVar1; break;
737
        case PLAYER_TEAM: ps->team = lVar1; break;
738
        case PLAYER_MAX_PLAYER_HEALTH: ps->max_player_health = lVar1; break;
739
        case PLAYER_MAX_SHIELD_AMOUNT: ps->max_shield_amount = lVar1; break;
740
        case PLAYER_MAX_AMMO_AMOUNT: ps->max_ammo_amount[lParm2] = lVar1; break;
741
        case PLAYER_LAST_QUICK_KICK: ps->last_quick_kick = lVar1; break;
742
        case PLAYER_AUTOSTEP: ps->autostep = lVar1; break;
743
        case PLAYER_AUTOSTEP_SBW: ps->autostep_sbw = lVar1; break;
744
        default: break;
745
    }
1625 terminx 746
 
4897 terminx 747
    return;
1062 terminx 748
 
1440 terminx 749
badplayer:
1625 terminx 750
    //        OSD_Printf("VM_AccessPlayer(): invalid target player (%d) %d\n",iPlayer,vm.g_i);
3000 helixhorne 751
    CON_ERRPRINTF("tried to set %s on invalid target player (%d) from spr %d gv %s\n",
752
                  PlayerLabels[lLabelID].name,iPlayer,vm.g_i,
753
                  (lVar1<MAXGAMEVARS)?aGameVars[lVar1].szLabel:"extended");
1440 terminx 754
    insptr += (lVar2 == MAXGAMEVARS);
755
    return;
756
 
757
badpos:
3000 helixhorne 758
    CON_ERRPRINTF("tried to set invalid %s position %d on player (%d) from spr %d\n",
759
                  PlayerLabels[lLabelID].name,lParm2,iPlayer,vm.g_i);
1440 terminx 760
    insptr += (lVar2 == MAXGAMEVARS);
761
    return;
1048 terminx 762
}
763
 
1625 terminx 764
static void __fastcall VM_AccessPlayerInput(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2)
1048 terminx 765
{
4897 terminx 766
    register int32_t const iPlayer = (lVar1 != g_iThisActorID) ? Gv_GetVarX(lVar1) : vm.g_p;
1048 terminx 767
 
4680 terminx 768
    if (EDUKE32_PREDICT_FALSE((unsigned)iPlayer >= (unsigned)playerswhenstarted))
1440 terminx 769
        goto badplayer;
1048 terminx 770
 
1180 terminx 771
    if (iSet)
1048 terminx 772
    {
4897 terminx 773
        iSet=Gv_GetVarX(lVar2);
1048 terminx 774
 
4897 terminx 775
        switch (lLabelID)
1048 terminx 776
        {
4897 terminx 777
            case INPUT_AVEL: g_player[iPlayer].sync->avel = iSet; break;
778
            case INPUT_HORZ: g_player[iPlayer].sync->horz = iSet; break;
779
            case INPUT_FVEL: g_player[iPlayer].sync->fvel = iSet; break;
780
            case INPUT_SVEL: g_player[iPlayer].sync->svel = iSet; break;
781
            case INPUT_BITS: g_player[iPlayer].sync->bits = iSet; break;
782
            case INPUT_EXTBITS: g_player[iPlayer].sync->extbits = iSet; break;
783
            default: break;
1048 terminx 784
        }
4897 terminx 785
    }
786
    else
787
    {
788
        switch (lLabelID)
1048 terminx 789
        {
4897 terminx 790
            case INPUT_AVEL: lLabelID = g_player[iPlayer].sync->avel; break;
791
            case INPUT_HORZ: lLabelID = g_player[iPlayer].sync->horz; break;
792
            case INPUT_FVEL: lLabelID = g_player[iPlayer].sync->fvel; break;
793
            case INPUT_SVEL: lLabelID = g_player[iPlayer].sync->svel; break;
794
            case INPUT_BITS: lLabelID = g_player[iPlayer].sync->bits; break;
795
            case INPUT_EXTBITS: lLabelID = g_player[iPlayer].sync->extbits; break;
796
            default: lLabelID = -1; break;
1048 terminx 797
        }
798
 
4897 terminx 799
        Gv_SetVarX(lVar2, lLabelID);
800
    }
1048 terminx 801
 
4897 terminx 802
    return;
1048 terminx 803
 
1440 terminx 804
badplayer:
805
    insptr += (lVar2 == MAXGAMEVARS);
3000 helixhorne 806
    CON_ERRPRINTF("invalid target player (%d) %d\n", iPlayer,vm.g_i);
1440 terminx 807
    return;
1048 terminx 808
}
809
 
1625 terminx 810
static void __fastcall VM_AccessWall(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2)
1048 terminx 811
{
4897 terminx 812
    register int32_t const iWall = Gv_GetVarX(lVar1);
1048 terminx 813
 
4680 terminx 814
    if (EDUKE32_PREDICT_FALSE((unsigned)iWall >= (unsigned)numwalls))
1440 terminx 815
        goto badwall;
1048 terminx 816
 
1180 terminx 817
    if (iSet)
1048 terminx 818
    {
4897 terminx 819
        iSet = Gv_GetVarX(lVar2);
1048 terminx 820
 
4897 terminx 821
        switch (lLabelID)
1048 terminx 822
        {
4897 terminx 823
            case WALL_X: wall[iWall].x = iSet; break;
824
            case WALL_Y: wall[iWall].y = iSet; break;
825
            case WALL_POINT2: wall[iWall].point2 = iSet; break;
826
            case WALL_NEXTWALL: wall[iWall].nextwall = iSet; break;
827
            case WALL_NEXTSECTOR: wall[iWall].nextsector = iSet; break;
828
            case WALL_CSTAT: wall[iWall].cstat = iSet; break;
829
            case WALL_PICNUM: wall[iWall].picnum = iSet; break;
830
            case WALL_OVERPICNUM: wall[iWall].overpicnum = iSet; break;
831
            case WALL_SHADE: wall[iWall].shade = iSet; break;
832
            case WALL_PAL: wall[iWall].pal = iSet; break;
833
            case WALL_XREPEAT: wall[iWall].xrepeat = iSet; break;
834
            case WALL_YREPEAT: wall[iWall].yrepeat = iSet; break;
835
            case WALL_XPANNING: wall[iWall].xpanning = iSet; break;
836
            case WALL_YPANNING: wall[iWall].ypanning = iSet; break;
837
            case WALL_LOTAG: wall[iWall].lotag = (int16_t)iSet; break;
838
            case WALL_HITAG: wall[iWall].hitag = (int16_t)iSet; break;
839
            case WALL_ULOTAG: wall[iWall].lotag = iSet; break;
840
            case WALL_UHITAG: wall[iWall].hitag = iSet; break;
841
            case WALL_EXTRA: wall[iWall].extra = iSet; break;
1048 terminx 842
        }
4897 terminx 843
    }
844
    else
845
    {
846
        switch (lLabelID)
1048 terminx 847
        {
4897 terminx 848
            case WALL_X: lLabelID = wall[iWall].x; break;
849
            case WALL_Y: lLabelID = wall[iWall].y; break;
850
            case WALL_POINT2: lLabelID = wall[iWall].point2; break;
851
            case WALL_NEXTWALL: lLabelID = wall[iWall].nextwall; break;
852
            case WALL_NEXTSECTOR: lLabelID = wall[iWall].nextsector; break;
853
            case WALL_CSTAT: lLabelID = wall[iWall].cstat; break;
854
            case WALL_PICNUM: lLabelID = wall[iWall].picnum; break;
855
            case WALL_OVERPICNUM: lLabelID = wall[iWall].overpicnum; break;
856
            case WALL_SHADE: lLabelID = wall[iWall].shade; break;
857
            case WALL_PAL: lLabelID = wall[iWall].pal; break;
858
            case WALL_XREPEAT: lLabelID = wall[iWall].xrepeat; break;
859
            case WALL_YREPEAT: lLabelID = wall[iWall].yrepeat; break;
860
            case WALL_XPANNING: lLabelID = wall[iWall].xpanning; break;
861
            case WALL_YPANNING: lLabelID = wall[iWall].ypanning; break;
862
            case WALL_LOTAG: lLabelID = (int16_t) wall[iWall].lotag; break;
863
            case WALL_HITAG: lLabelID = (int16_t) wall[iWall].hitag; break;
864
            case WALL_ULOTAG: lLabelID = wall[iWall].lotag; break;
865
            case WALL_UHITAG: lLabelID = wall[iWall].hitag; break;
866
            case WALL_EXTRA: lLabelID = wall[iWall].extra; break;
1048 terminx 867
        }
868
 
4897 terminx 869
        Gv_SetVarX(lVar2, lLabelID);
870
    }
1048 terminx 871
 
4897 terminx 872
    return;
1048 terminx 873
 
1440 terminx 874
badwall:
875
    insptr += (lVar2 == MAXGAMEVARS);
3000 helixhorne 876
    CON_ERRPRINTF("Invalid wall %d\n", iWall);
1440 terminx 877
    return;
1048 terminx 878
}
879
 
1625 terminx 880
static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2)
1048 terminx 881
{
4897 terminx 882
    register int32_t const iSector = (lVar1 != g_iThisActorID) ? Gv_GetVarX(lVar1) : sprite[vm.g_i].sectnum;
1048 terminx 883
 
4680 terminx 884
    if (EDUKE32_PREDICT_FALSE((unsigned)iSector >= (unsigned)numsectors))
1440 terminx 885
        goto badsector;
1048 terminx 886
 
1180 terminx 887
    if (iSet)
1048 terminx 888
    {
4897 terminx 889
        iSet = Gv_GetVarX(lVar2);
1048 terminx 890
 
4897 terminx 891
        switch (lLabelID)
1048 terminx 892
        {
4897 terminx 893
            case SECTOR_WALLPTR: sector[iSector].wallptr = iSet; break;
894
            case SECTOR_WALLNUM: sector[iSector].wallnum = iSet; break;
895
            case SECTOR_CEILINGZ: sector[iSector].ceilingz = iSet; break;
896
            case SECTOR_FLOORZ: sector[iSector].floorz = iSet; break;
897
            case SECTOR_CEILINGSTAT: sector[iSector].ceilingstat = iSet; break;
898
            case SECTOR_FLOORSTAT: sector[iSector].floorstat = iSet; break;
899
            case SECTOR_CEILINGPICNUM: sector[iSector].ceilingpicnum = iSet; break;
900
            case SECTOR_CEILINGSLOPE: sector[iSector].ceilingheinum = iSet; break;
901
            case SECTOR_CEILINGSHADE: sector[iSector].ceilingshade = iSet; break;
902
            case SECTOR_CEILINGPAL: sector[iSector].ceilingpal = iSet; break;
903
            case SECTOR_CEILINGXPANNING: sector[iSector].ceilingxpanning = iSet; break;
904
            case SECTOR_CEILINGYPANNING: sector[iSector].ceilingypanning = iSet; break;
905
            case SECTOR_FLOORPICNUM: sector[iSector].floorpicnum = iSet; break;
906
            case SECTOR_FLOORSLOPE: sector[iSector].floorheinum = iSet; break;
907
            case SECTOR_FLOORSHADE: sector[iSector].floorshade = iSet; break;
908
            case SECTOR_FLOORPAL: sector[iSector].floorpal = iSet; break;
909
            case SECTOR_FLOORXPANNING: sector[iSector].floorxpanning = iSet; break;
910
            case SECTOR_FLOORYPANNING: sector[iSector].floorypanning = iSet; break;
911
            case SECTOR_VISIBILITY: sector[iSector].visibility = iSet; break;
912
            case SECTOR_FOGPAL: sector[iSector].fogpal = iSet; break;
913
            case SECTOR_LOTAG: sector[iSector].lotag = (int16_t)iSet; break;
914
            case SECTOR_HITAG: sector[iSector].hitag = (int16_t)iSet; break;
915
            case SECTOR_ULOTAG: sector[iSector].lotag = iSet; break;
916
            case SECTOR_UHITAG: sector[iSector].hitag = iSet; break;
917
            case SECTOR_EXTRA: sector[iSector].extra = iSet; break;
918
            case SECTOR_CEILINGBUNCH:
919
            case SECTOR_FLOORBUNCH:
920
            default: break;
1048 terminx 921
        }
4897 terminx 922
    }
923
    else
924
    {
925
        switch (lLabelID)
1048 terminx 926
        {
4897 terminx 927
            case SECTOR_WALLPTR: lLabelID = sector[iSector].wallptr; break;
928
            case SECTOR_WALLNUM: lLabelID = sector[iSector].wallnum; break;
929
            case SECTOR_CEILINGZ: lLabelID = sector[iSector].ceilingz; break;
930
            case SECTOR_FLOORZ: lLabelID = sector[iSector].floorz; break;
931
            case SECTOR_CEILINGSTAT: lLabelID = sector[iSector].ceilingstat; break;
932
            case SECTOR_FLOORSTAT: lLabelID = sector[iSector].floorstat; break;
933
            case SECTOR_CEILINGPICNUM: lLabelID = sector[iSector].ceilingpicnum; break;
934
            case SECTOR_CEILINGSLOPE: lLabelID = sector[iSector].ceilingheinum; break;
935
            case SECTOR_CEILINGSHADE: lLabelID = sector[iSector].ceilingshade; break;
936
            case SECTOR_CEILINGPAL: lLabelID = sector[iSector].ceilingpal; break;
937
            case SECTOR_CEILINGXPANNING: lLabelID = sector[iSector].ceilingxpanning; break;
938
            case SECTOR_CEILINGYPANNING: lLabelID = sector[iSector].ceilingypanning; break;
939
            case SECTOR_FLOORPICNUM: lLabelID = sector[iSector].floorpicnum; break;
940
            case SECTOR_FLOORSLOPE: lLabelID = sector[iSector].floorheinum; break;
941
            case SECTOR_FLOORSHADE: lLabelID = sector[iSector].floorshade; break;
942
            case SECTOR_FLOORPAL: lLabelID = sector[iSector].floorpal; break;
943
            case SECTOR_FLOORXPANNING: lLabelID = sector[iSector].floorxpanning; break;
944
            case SECTOR_FLOORYPANNING: lLabelID = sector[iSector].floorypanning; break;
945
            case SECTOR_VISIBILITY: lLabelID = sector[iSector].visibility; break;
946
            case SECTOR_FOGPAL: lLabelID = sector[iSector].fogpal; break;
947
            case SECTOR_LOTAG: lLabelID = (int16_t)sector[iSector].lotag; break;
948
            case SECTOR_HITAG: lLabelID = (int16_t)sector[iSector].hitag; break;
949
            case SECTOR_ULOTAG: lLabelID = sector[iSector].lotag; break;
950
            case SECTOR_UHITAG: lLabelID = sector[iSector].hitag; break;
951
            case SECTOR_EXTRA: lLabelID = sector[iSector].extra; break;
952
            case SECTOR_CEILINGBUNCH:
953
            case SECTOR_FLOORBUNCH:
1931 helixhorne 954
#ifdef YAX_ENABLE
4897 terminx 955
                lLabelID = yax_getbunch(iSector, lLabelID == SECTOR_FLOORBUNCH);
1931 helixhorne 956
#else
4897 terminx 957
                lLabelID = -1;
1931 helixhorne 958
#endif
4897 terminx 959
                break;
960
            default: lLabelID = -1; break;
1931 helixhorne 961
        }
962
 
4897 terminx 963
        Gv_SetVarX(lVar2, lLabelID);
1048 terminx 964
    }
1440 terminx 965
 
4897 terminx 966
    return;
967
 
1440 terminx 968
badsector:
3000 helixhorne 969
    CON_ERRPRINTF("Invalid sector %d\n", iSector);
1440 terminx 970
    insptr += (lVar2 == MAXGAMEVARS);
1048 terminx 971
}
972
 
1625 terminx 973
static void __fastcall VM_SetSprite(int32_t lVar1, int32_t lLabelID, int32_t lVar2, int32_t lParm2)
1048 terminx 974
{
4897 terminx 975
    register int32_t const iActor = (lVar1 != g_iThisActorID) ? Gv_GetVarX(lVar1) : vm.g_i;
1048 terminx 976
 
4680 terminx 977
    if (EDUKE32_PREDICT_FALSE((unsigned)iActor >= MAXSPRITES))
1440 terminx 978
        goto badactor;
979
 
4680 terminx 980
    if (EDUKE32_PREDICT_FALSE(ActorLabels[lLabelID].flags & LABEL_HASPARM2 && (unsigned)lParm2 >= (unsigned)ActorLabels[lLabelID].maxParm2))
1440 terminx 981
        goto badpos;
982
 
4897 terminx 983
    lVar1 = Gv_GetVarX(lVar2);
1440 terminx 984
 
985
    switch (lLabelID)
1048 terminx 986
    {
4897 terminx 987
        case ACTOR_X: sprite[iActor].x = lVar1; break;
988
        case ACTOR_Y: sprite[iActor].y = lVar1; break;
989
        case ACTOR_Z: sprite[iActor].z = lVar1; break;
990
        case ACTOR_CSTAT: sprite[iActor].cstat = lVar1; break;
991
        case ACTOR_PICNUM: sprite[iActor].picnum = lVar1; break;
992
        case ACTOR_SHADE: sprite[iActor].shade = lVar1; break;
993
        case ACTOR_PAL: sprite[iActor].pal = lVar1; break;
994
        case ACTOR_CLIPDIST: sprite[iActor].clipdist = lVar1; break;
995
        case ACTOR_DETAIL: sprite[iActor].blend = lVar1; break;
996
        case ACTOR_XREPEAT: sprite[iActor].xrepeat = lVar1; break;
997
        case ACTOR_YREPEAT: sprite[iActor].yrepeat = lVar1; break;
998
        case ACTOR_XOFFSET: sprite[iActor].xoffset = lVar1; break;
999
        case ACTOR_YOFFSET: sprite[iActor].yoffset = lVar1; break;
1000
        case ACTOR_SECTNUM: changespritesect(iActor, lVar1); break;
1001
        case ACTOR_STATNUM: changespritestat(iActor, lVar1); break;
1002
        case ACTOR_ANG: sprite[iActor].ang = lVar1; break;
1003
        case ACTOR_OWNER: sprite[iActor].owner = lVar1; break;
1004
        case ACTOR_XVEL: sprite[iActor].xvel = lVar1; break;
1005
        case ACTOR_YVEL: sprite[iActor].yvel = lVar1; break;
1006
        case ACTOR_ZVEL: sprite[iActor].zvel = lVar1; break;
1007
        case ACTOR_LOTAG: sprite[iActor].lotag = (int16_t)lVar1; break;
1008
        case ACTOR_HITAG: sprite[iActor].hitag = (int16_t)lVar1; break;
1009
        case ACTOR_ULOTAG: sprite[iActor].lotag = lVar1; break;
1010
        case ACTOR_UHITAG: sprite[iActor].hitag = lVar1; break;
1011
        case ACTOR_EXTRA: sprite[iActor].extra = lVar1; break;
1012
        case ACTOR_HTCGG: actor[iActor].cgg = lVar1; break;
1013
        case ACTOR_HTPICNUM: actor[iActor].picnum = lVar1; break;
1014
        case ACTOR_HTANG: actor[iActor].ang = lVar1; break;
1015
        case ACTOR_HTEXTRA: actor[iActor].extra = lVar1; break;
1016
        case ACTOR_HTOWNER: actor[iActor].owner = lVar1; break;
1017
        case ACTOR_HTMOVFLAG: actor[iActor].movflag = lVar1; break;
1018
        case ACTOR_HTTEMPANG: actor[iActor].tempang = lVar1; break;
1019
        case ACTOR_HTACTORSTAYPUT: actor[iActor].actorstayput = lVar1; break;
1020
        case ACTOR_HTDISPICNUM: actor[iActor].dispicnum = lVar1; break;
1021
        case ACTOR_HTTIMETOSLEEP: actor[iActor].timetosleep = lVar1; break;
1022
        case ACTOR_HTFLOORZ: actor[iActor].floorz = lVar1; break;
1023
        case ACTOR_HTCEILINGZ: actor[iActor].ceilingz = lVar1; break;
1024
        case ACTOR_HTLASTVX: actor[iActor].lastvx = lVar1; break;
1025
        case ACTOR_HTLASTVY: actor[iActor].lastvy = lVar1; break;
1026
        case ACTOR_HTBPOSX: actor[iActor].bpos.x = lVar1; break;
1027
        case ACTOR_HTBPOSY: actor[iActor].bpos.y = lVar1; break;
1028
        case ACTOR_HTBPOSZ: actor[iActor].bpos.z = lVar1; break;
1029
        case ACTOR_HTG_T: actor[iActor].t_data[lParm2] = lVar1; break;
1030
        case ACTOR_ANGOFF: spriteext[iActor].angoff = lVar1; break;
1031
        case ACTOR_PITCH: spriteext[iActor].pitch = lVar1; break;
1032
        case ACTOR_ROLL: spriteext[iActor].roll = lVar1; break;
1033
        case ACTOR_MDXOFF: spriteext[iActor].offset.x = lVar1; break;
1034
        case ACTOR_MDYOFF: spriteext[iActor].offset.y = lVar1; break;
1035
        case ACTOR_MDZOFF: spriteext[iActor].offset.z = lVar1; break;
1036
        case ACTOR_MDFLAGS: spriteext[iActor].flags = lVar1; break;
1037
        case ACTOR_XPANNING: spriteext[iActor].xpanning = lVar1; break;
1038
        case ACTOR_YPANNING: spriteext[iActor].ypanning = lVar1; break;
1039
        case ACTOR_HTFLAGS: actor[iActor].flags = lVar1; break;
1040
        case ACTOR_ALPHA: spriteext[iActor].alpha = (float)lVar1 * (1.f / 255.0f); break;
1041
        default: break;
1042
    }
1048 terminx 1043
 
4897 terminx 1044
    return;
1440 terminx 1045
 
1046
badactor:
3000 helixhorne 1047
    CON_ERRPRINTF("tried to set %s on invalid target sprite (%d) from spr %d pic %d gv %s\n",
3238 hendricks2 1048
                  ActorLabels[lLabelID].name,iActor,vm.g_i,TrackerCast(vm.g_sp->picnum),
3000 helixhorne 1049
                  (lVar1<MAXGAMEVARS)?aGameVars[lVar1].szLabel:"extended");
1440 terminx 1050
    insptr += (lVar2 == MAXGAMEVARS);
1051
    return;
1180 terminx 1052
 
1440 terminx 1053
badpos:
3000 helixhorne 1054
    CON_ERRPRINTF("tried to set invalid %s position %d on sprite (%d) from spr %d\n",
1055
                  ActorLabels[lLabelID].name,lParm2,iActor,vm.g_i);
1440 terminx 1056
    insptr += (lVar2 == MAXGAMEVARS);
1057
}
1058
 
1059
 
1625 terminx 1060
static void __fastcall VM_GetSprite(int32_t lVar1, int32_t lLabelID, int32_t lVar2, int32_t lParm2)
1440 terminx 1061
{
4897 terminx 1062
    register int32_t const iActor = (lVar1 != g_iThisActorID) ? Gv_GetVarX(lVar1) : vm.g_i;
1440 terminx 1063
 
4680 terminx 1064
    if (EDUKE32_PREDICT_FALSE((unsigned)iActor >= MAXSPRITES))
1440 terminx 1065
        goto badactor;
1066
 
4680 terminx 1067
    if (EDUKE32_PREDICT_FALSE(ActorLabels[lLabelID].flags & LABEL_HASPARM2 &&
1068
        (unsigned)lParm2 >= (unsigned)ActorLabels[lLabelID].maxParm2))
1440 terminx 1069
        goto badpos;
1070
 
1048 terminx 1071
    switch (lLabelID)
1072
    {
4897 terminx 1073
        case ACTOR_X: lLabelID = sprite[iActor].x; break;
1074
        case ACTOR_Y: lLabelID = sprite[iActor].y; break;
1075
        case ACTOR_Z: lLabelID = sprite[iActor].z; break;
1076
        case ACTOR_CSTAT: lLabelID = sprite[iActor].cstat; break;
1077
        case ACTOR_PICNUM: lLabelID = sprite[iActor].picnum; break;
1078
        case ACTOR_SHADE: lLabelID = sprite[iActor].shade; break;
1079
        case ACTOR_PAL: lLabelID = sprite[iActor].pal; break;
1080
        case ACTOR_CLIPDIST: lLabelID = sprite[iActor].clipdist; break;
1081
        case ACTOR_DETAIL: lLabelID = sprite[iActor].blend; break;
1082
        case ACTOR_XREPEAT: lLabelID = sprite[iActor].xrepeat; break;
1083
        case ACTOR_YREPEAT: lLabelID = sprite[iActor].yrepeat; break;
1084
        case ACTOR_XOFFSET: lLabelID = sprite[iActor].xoffset; break;
1085
        case ACTOR_YOFFSET: lLabelID = sprite[iActor].yoffset; break;
1086
        case ACTOR_SECTNUM: lLabelID = sprite[iActor].sectnum; break;
1087
        case ACTOR_STATNUM: lLabelID = sprite[iActor].statnum; break;
1088
        case ACTOR_ANG: lLabelID = sprite[iActor].ang; break;
1089
        case ACTOR_OWNER: lLabelID = sprite[iActor].owner; break;
1090
        case ACTOR_XVEL: lLabelID = sprite[iActor].xvel; break;
1091
        case ACTOR_YVEL: lLabelID = sprite[iActor].yvel; break;
1092
        case ACTOR_ZVEL: lLabelID = sprite[iActor].zvel; break;
1093
        case ACTOR_LOTAG: lLabelID = (int16_t)sprite[iActor].lotag; break;
1094
        case ACTOR_HITAG: lLabelID = (int16_t)sprite[iActor].hitag; break;
1095
        case ACTOR_ULOTAG: lLabelID = sprite[iActor].lotag; break;
1096
        case ACTOR_UHITAG: lLabelID = sprite[iActor].hitag; break;
1097
        case ACTOR_EXTRA: lLabelID = sprite[iActor].extra; break;
1098
        case ACTOR_HTCGG: lLabelID = actor[iActor].cgg; break;
1099
        case ACTOR_HTPICNUM: lLabelID = actor[iActor].picnum; break;
1100
        case ACTOR_HTANG: lLabelID = actor[iActor].ang; break;
1101
        case ACTOR_HTEXTRA: lLabelID = actor[iActor].extra; break;
1102
        case ACTOR_HTOWNER: lLabelID = actor[iActor].owner; break;
1103
        case ACTOR_HTMOVFLAG: lLabelID = actor[iActor].movflag; break;
1104
        case ACTOR_HTTEMPANG: lLabelID = actor[iActor].tempang; break;
1105
        case ACTOR_HTACTORSTAYPUT: lLabelID = actor[iActor].actorstayput; break;
1106
        case ACTOR_HTDISPICNUM: lLabelID = actor[iActor].dispicnum; break;
1107
        case ACTOR_HTTIMETOSLEEP: lLabelID = actor[iActor].timetosleep; break;
1108
        case ACTOR_HTFLOORZ: lLabelID = actor[iActor].floorz; break;
1109
        case ACTOR_HTCEILINGZ: lLabelID = actor[iActor].ceilingz; break;
1110
        case ACTOR_HTLASTVX: lLabelID = actor[iActor].lastvx; break;
1111
        case ACTOR_HTLASTVY: lLabelID = actor[iActor].lastvy; break;
1112
        case ACTOR_HTBPOSX: lLabelID = actor[iActor].bpos.x; break;
1113
        case ACTOR_HTBPOSY: lLabelID = actor[iActor].bpos.y; break;
1114
        case ACTOR_HTBPOSZ: lLabelID = actor[iActor].bpos.z; break;
1115
        case ACTOR_HTG_T: lLabelID = actor[iActor].t_data[lParm2]; break;
1116
        case ACTOR_ANGOFF: lLabelID = spriteext[iActor].angoff; break;
1117
        case ACTOR_PITCH: lLabelID = spriteext[iActor].pitch; break;
1118
        case ACTOR_ROLL: lLabelID = spriteext[iActor].roll; break;
1119
        case ACTOR_MDXOFF: lLabelID = spriteext[iActor].offset.x; break;
1120
        case ACTOR_MDYOFF: lLabelID = spriteext[iActor].offset.y; break;
1121
        case ACTOR_MDZOFF: lLabelID = spriteext[iActor].offset.z; break;
1122
        case ACTOR_MDFLAGS: lLabelID = spriteext[iActor].flags; break;
1123
        case ACTOR_XPANNING: lLabelID = spriteext[iActor].xpanning; break;
1124
        case ACTOR_YPANNING: lLabelID = spriteext[iActor].ypanning; break;
1125
        case ACTOR_HTFLAGS: lLabelID = actor[iActor].flags; break;
1126
        case ACTOR_ALPHA: lLabelID = (uint8_t)(spriteext[iActor].alpha * 255.0f); break;
1127
        case ACTOR_ISVALID: lLabelID = sprite[iActor].statnum != MAXSTATUS; break;
1128
        default: return;
1129
    }
1048 terminx 1130
 
4897 terminx 1131
    Gv_SetVarX(lVar2, lLabelID);
1132
    return;
1048 terminx 1133
 
1440 terminx 1134
badactor:
3000 helixhorne 1135
    CON_ERRPRINTF("tried to get %s on invalid target sprite (%d) from spr %d pic %d gv %s\n",
3238 hendricks2 1136
                  ActorLabels[lLabelID].name,iActor,vm.g_i,TrackerCast(vm.g_sp->picnum),
3000 helixhorne 1137
                  (lVar1<MAXGAMEVARS)?aGameVars[lVar1].szLabel:"extended");
1440 terminx 1138
    insptr += (lVar2 == MAXGAMEVARS);
1139
    return;
1140
 
1141
badpos:
3000 helixhorne 1142
    CON_ERRPRINTF("tried to get invalid %s position %d on sprite (%d) from spr %d\n",
1143
                  ActorLabels[lLabelID].name,lParm2,iActor,vm.g_i);
1440 terminx 1144
    insptr += (lVar2 == MAXGAMEVARS);
1145
    return;
1048 terminx 1146
}
1147
 
1625 terminx 1148
static void __fastcall VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2)
1048 terminx 1149
{
4897 terminx 1150
    lVar1 = (lVar1 != g_iThisActorID) ? Gv_GetVarX(lVar1) : vm.g_i;
1048 terminx 1151
 
4897 terminx 1152
    if (EDUKE32_PREDICT_FALSE((unsigned)lVar1 >= MAXSPRITES))
1440 terminx 1153
        goto badsprite;
1048 terminx 1154
 
4897 terminx 1155
    if (EDUKE32_PREDICT_FALSE(!spriteext[lVar1].tspr))
1440 terminx 1156
        goto badtspr;
1048 terminx 1157
 
4897 terminx 1158
    if (iSet)
1048 terminx 1159
    {
4897 terminx 1160
        iSet = Gv_GetVarX(lVar2);
1048 terminx 1161
 
4897 terminx 1162
        switch (lLabelID)
1048 terminx 1163
        {
4897 terminx 1164
            case ACTOR_X: spriteext[lVar1].tspr->x = iSet; break;
1165
            case ACTOR_Y: spriteext[lVar1].tspr->y = iSet; break;
1166
            case ACTOR_Z: spriteext[lVar1].tspr->z = iSet; break;
1167
            case ACTOR_CSTAT: spriteext[lVar1].tspr->cstat = iSet; break;
1168
            case ACTOR_PICNUM: spriteext[lVar1].tspr->picnum = iSet; break;
1169
            case ACTOR_SHADE: spriteext[lVar1].tspr->shade = iSet; break;
1170
            case ACTOR_PAL: spriteext[lVar1].tspr->pal = iSet; break;
1171
            case ACTOR_CLIPDIST: spriteext[lVar1].tspr->clipdist = iSet; break;
1172
            case ACTOR_DETAIL: spriteext[lVar1].tspr->blend = iSet; break;
1173
            case ACTOR_XREPEAT: spriteext[lVar1].tspr->xrepeat = iSet; break;
1174
            case ACTOR_YREPEAT: spriteext[lVar1].tspr->yrepeat = iSet; break;
1175
            case ACTOR_XOFFSET: spriteext[lVar1].tspr->xoffset = iSet; break;
1176
            case ACTOR_YOFFSET: spriteext[lVar1].tspr->yoffset = iSet; break;
1177
            case ACTOR_SECTNUM: spriteext[lVar1].tspr->sectnum = iSet; break;
1178
            case ACTOR_STATNUM: spriteext[lVar1].tspr->statnum = iSet; break;
1179
            case ACTOR_ANG: spriteext[lVar1].tspr->ang = iSet; break;
1180
            case ACTOR_OWNER: spriteext[lVar1].tspr->owner = iSet; break;
1181
            case ACTOR_XVEL: spriteext[lVar1].tspr->xvel = iSet; break;
1182
            case ACTOR_YVEL: spriteext[lVar1].tspr->yvel = iSet; break;
1183
            case ACTOR_ZVEL: spriteext[lVar1].tspr->zvel = iSet; break;
1184
            case ACTOR_LOTAG: spriteext[lVar1].tspr->lotag = (int16_t) iSet; break;
1185
            case ACTOR_HITAG: spriteext[lVar1].tspr->hitag = (int16_t) iSet; break;
1186
            case ACTOR_ULOTAG: spriteext[lVar1].tspr->lotag = iSet; break;
1187
            case ACTOR_UHITAG: spriteext[lVar1].tspr->hitag = iSet; break;
1188
            case ACTOR_EXTRA: spriteext[lVar1].tspr->extra = iSet; break;
1048 terminx 1189
        }
4897 terminx 1190
    }
1191
    else
1192
    {
1193
        switch (lLabelID)
1048 terminx 1194
        {
4897 terminx 1195
            case ACTOR_X: iSet = spriteext[lVar1].tspr->x; break;
1196
            case ACTOR_Y: iSet = spriteext[lVar1].tspr->y; break;
1197
            case ACTOR_Z: iSet = spriteext[lVar1].tspr->z; break;
1198
            case ACTOR_CSTAT: iSet = spriteext[lVar1].tspr->cstat; break;
1199
            case ACTOR_PICNUM: iSet = spriteext[lVar1].tspr->picnum; break;
1200
            case ACTOR_SHADE: iSet = spriteext[lVar1].tspr->shade; break;
1201
            case ACTOR_PAL: iSet = spriteext[lVar1].tspr->pal; break;
1202
            case ACTOR_CLIPDIST: iSet = spriteext[lVar1].tspr->clipdist; break;
1203
            case ACTOR_DETAIL: iSet = spriteext[lVar1].tspr->blend; break;
1204
            case ACTOR_XREPEAT: iSet = spriteext[lVar1].tspr->xrepeat; break;
1205
            case ACTOR_YREPEAT: iSet = spriteext[lVar1].tspr->yrepeat; break;
1206
            case ACTOR_XOFFSET: iSet = spriteext[lVar1].tspr->xoffset; break;
1207
            case ACTOR_YOFFSET: iSet = spriteext[lVar1].tspr->yoffset; break;
1208
            case ACTOR_SECTNUM: iSet = spriteext[lVar1].tspr->sectnum; break;
1209
            case ACTOR_STATNUM: iSet = spriteext[lVar1].tspr->statnum; break;
1210
            case ACTOR_ANG: iSet = spriteext[lVar1].tspr->ang; break;
1211
            case ACTOR_OWNER: iSet = spriteext[lVar1].tspr->owner; break;
1212
            case ACTOR_XVEL: iSet = spriteext[lVar1].tspr->xvel; break;
1213
            case ACTOR_YVEL: iSet = spriteext[lVar1].tspr->yvel; break;
1214
            case ACTOR_ZVEL: iSet = spriteext[lVar1].tspr->zvel; break;
1215
            case ACTOR_LOTAG: iSet = (int16_t) spriteext[lVar1].tspr->lotag; break;
1216
            case ACTOR_HITAG: iSet = (int16_t) spriteext[lVar1].tspr->hitag; break;
1217
            case ACTOR_ULOTAG: iSet = spriteext[lVar1].tspr->lotag; break;
1218
            case ACTOR_UHITAG: iSet = spriteext[lVar1].tspr->hitag; break;
1219
            case ACTOR_EXTRA: iSet = spriteext[lVar1].tspr->extra; break;
1220
            default: return;
1048 terminx 1221
        }
1222
 
4897 terminx 1223
        Gv_SetVarX(lVar2, iSet);
1224
    }
1048 terminx 1225
 
4897 terminx 1226
    return;
1048 terminx 1227
 
1440 terminx 1228
badsprite:
4897 terminx 1229
    CON_ERRPRINTF("invalid target sprite (%d) %d %d\n", lVar1, vm.g_i, TrackerCast(vm.g_sp->picnum));
1440 terminx 1230
    insptr += (lVar2 == MAXGAMEVARS);
1231
    return;
1232
 
1233
badtspr:
3000 helixhorne 1234
    CON_ERRPRINTF("Internal bug, tsprite is unavailable\n");
1440 terminx 1235
    return;
1048 terminx 1236
}
1237
 
1625 terminx 1238
static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2)
1048 terminx 1239
{
4680 terminx 1240
    if (EDUKE32_PREDICT_FALSE((unsigned)lVar1 >= MAXTILES))
1440 terminx 1241
        goto badtile;
1048 terminx 1242
 
1180 terminx 1243
    if (iSet)
1048 terminx 1244
    {
4897 terminx 1245
        iSet=Gv_GetVarX(lVar2);
1048 terminx 1246
 
4897 terminx 1247
        switch (lLabelID)
1048 terminx 1248
        {
4897 terminx 1249
            case PROJ_WORKSLIKE: ProjectileData[lVar1].workslike = iSet; break;
1250
            case PROJ_SPAWNS: ProjectileData[lVar1].spawns = iSet; break;
1251
            case PROJ_SXREPEAT: ProjectileData[lVar1].sxrepeat = iSet; break;
1252
            case PROJ_SYREPEAT: ProjectileData[lVar1].syrepeat = iSet; break;
1253
            case PROJ_SOUND: ProjectileData[lVar1].sound = iSet; break;
1254
            case PROJ_ISOUND: ProjectileData[lVar1].isound = iSet; break;
1255
            case PROJ_VEL: ProjectileData[lVar1].vel = iSet; break;
1256
            case PROJ_EXTRA: ProjectileData[lVar1].extra = iSet; break;
1257
            case PROJ_DECAL: ProjectileData[lVar1].decal = iSet; break;
1258
            case PROJ_TRAIL: ProjectileData[lVar1].trail = iSet; break;
1259
            case PROJ_TXREPEAT: ProjectileData[lVar1].txrepeat = iSet; break;
1260
            case PROJ_TYREPEAT: ProjectileData[lVar1].tyrepeat = iSet; break;
1261
            case PROJ_TOFFSET: ProjectileData[lVar1].toffset = iSet; break;
1262
            case PROJ_TNUM: ProjectileData[lVar1].tnum = iSet; break;
1263
            case PROJ_DROP: ProjectileData[lVar1].drop = iSet; break;
1264
            case PROJ_CSTAT: ProjectileData[lVar1].cstat = iSet; break;
1265
            case PROJ_CLIPDIST: ProjectileData[lVar1].clipdist = iSet; break;
1266
            case PROJ_SHADE: ProjectileData[lVar1].shade = iSet; break;
1267
            case PROJ_XREPEAT: ProjectileData[lVar1].xrepeat = iSet; break;
1268
            case PROJ_YREPEAT: ProjectileData[lVar1].yrepeat = iSet; break;
1269
            case PROJ_PAL: ProjectileData[lVar1].pal = iSet; break;
1270
            case PROJ_EXTRA_RAND: ProjectileData[lVar1].extra_rand = iSet; break;
1271
            case PROJ_HITRADIUS: ProjectileData[lVar1].hitradius = iSet; break;
1272
            case PROJ_MOVECNT: ProjectileData[lVar1].movecnt = iSet; break;
1273
            case PROJ_OFFSET: ProjectileData[lVar1].offset = iSet; break;
1274
            case PROJ_BOUNCES: ProjectileData[lVar1].bounces = iSet; break;
1275
            case PROJ_BSOUND: ProjectileData[lVar1].bsound = iSet; break;
1276
            case PROJ_RANGE: ProjectileData[lVar1].range = iSet; break;
1277
            case PROJ_FLASH_COLOR: ProjectileData[lVar1].flashcolor = iSet; break;
1278
            case PROJ_USERDATA: ProjectileData[lVar1].userdata = iSet; break;
1048 terminx 1279
        }
4897 terminx 1280
    }
1281
    else
1282
    {
1283
        switch (lLabelID)
1048 terminx 1284
        {
4897 terminx 1285
            case PROJ_WORKSLIKE: iSet = ProjectileData[lVar1].workslike; break;
1286
            case PROJ_SPAWNS: iSet = ProjectileData[lVar1].spawns; break;
1287
            case PROJ_SXREPEAT: iSet = ProjectileData[lVar1].sxrepeat; break;
1288
            case PROJ_SYREPEAT: iSet = ProjectileData[lVar1].syrepeat; break;
1289
            case PROJ_SOUND: iSet = ProjectileData[lVar1].sound; break;
1290
            case PROJ_ISOUND: iSet = ProjectileData[lVar1].isound; break;
1291
            case PROJ_VEL: iSet = ProjectileData[lVar1].vel; break;
1292
            case PROJ_EXTRA: iSet = ProjectileData[lVar1].extra; break;
1293
            case PROJ_DECAL: iSet = ProjectileData[lVar1].decal; break;
1294
            case PROJ_TRAIL: iSet = ProjectileData[lVar1].trail; break;
1295
            case PROJ_TXREPEAT: iSet = ProjectileData[lVar1].txrepeat; break;
1296
            case PROJ_TYREPEAT: iSet = ProjectileData[lVar1].tyrepeat; break;
1297
            case PROJ_TOFFSET: iSet = ProjectileData[lVar1].toffset; break;
1298
            case PROJ_TNUM: iSet = ProjectileData[lVar1].tnum; break;
1299
            case PROJ_DROP: iSet = ProjectileData[lVar1].drop; break;
1300
            case PROJ_CSTAT: iSet = ProjectileData[lVar1].cstat; break;
1301
            case PROJ_CLIPDIST: iSet = ProjectileData[lVar1].clipdist; break;
1302
            case PROJ_SHADE: iSet = ProjectileData[lVar1].shade; break;
1303
            case PROJ_XREPEAT: iSet = ProjectileData[lVar1].xrepeat; break;
1304
            case PROJ_YREPEAT: iSet = ProjectileData[lVar1].yrepeat; break;
1305
            case PROJ_PAL: iSet = ProjectileData[lVar1].pal; break;
1306
            case PROJ_EXTRA_RAND: iSet = ProjectileData[lVar1].extra_rand; break;
1307
            case PROJ_HITRADIUS: iSet = ProjectileData[lVar1].hitradius; break;
1308
            case PROJ_MOVECNT: iSet = ProjectileData[lVar1].movecnt; break;
1309
            case PROJ_OFFSET: iSet = ProjectileData[lVar1].offset; break;
1310
            case PROJ_BOUNCES: iSet = ProjectileData[lVar1].bounces; break;
1311
            case PROJ_BSOUND: iSet = ProjectileData[lVar1].bsound; break;
1312
            case PROJ_RANGE: iSet = ProjectileData[lVar1].range; break;
1313
            case PROJ_FLASH_COLOR: iSet = ProjectileData[lVar1].flashcolor; break;
1314
            case PROJ_USERDATA: iSet = ProjectileData[lVar1].userdata; break;
1315
            default: iSet = -1; break;
1048 terminx 1316
        }
1317
 
4897 terminx 1318
        Gv_SetVarX(lVar2, iSet);
1319
    }
1048 terminx 1320
 
4897 terminx 1321
    return;
1048 terminx 1322
 
1440 terminx 1323
badtile:
3000 helixhorne 1324
    CON_ERRPRINTF("invalid tile (%d)\n", lVar1);
1440 terminx 1325
    insptr += (lVar2 == MAXGAMEVARS);
1326
    return;
1048 terminx 1327
}
1204 terminx 1328
#else
1625 terminx 1329
static int32_t __fastcall VM_AccessSpriteX(int32_t iActor, int32_t lLabelID, int32_t lParm2)
1204 terminx 1330
{
4680 terminx 1331
    if (EDUKE32_PREDICT_FALSE(ActorLabels[lLabelID].flags & LABEL_HASPARM2 &&
1332
        (unsigned)lParm2 >= (unsigned)ActorLabels[lLabelID].maxParm2))
1440 terminx 1333
        goto badpos;
1204 terminx 1334
 
1335
    switch (lLabelID)
1336
    {
4897 terminx 1337
        case ACTOR_X: lLabelID = sprite[iActor].x; break;
1338
        case ACTOR_Y: lLabelID = sprite[iActor].y; break;
1339
        case ACTOR_Z: lLabelID = sprite[iActor].z; break;
1340
        case ACTOR_CSTAT: lLabelID = sprite[iActor].cstat; break;
1341
        case ACTOR_PICNUM: lLabelID = sprite[iActor].picnum; break;
1342
        case ACTOR_SHADE: lLabelID = sprite[iActor].shade; break;
1343
        case ACTOR_PAL: lLabelID = sprite[iActor].pal; break;
1344
        case ACTOR_CLIPDIST: lLabelID = sprite[iActor].clipdist; break;
1345
        case ACTOR_DETAIL: lLabelID = sprite[iActor].blend; break;
1346
        case ACTOR_XREPEAT: lLabelID = sprite[iActor].xrepeat; break;
1347
        case ACTOR_YREPEAT: lLabelID = sprite[iActor].yrepeat; break;
1348
        case ACTOR_XOFFSET: lLabelID = sprite[iActor].xoffset; break;
1349
        case ACTOR_YOFFSET: lLabelID = sprite[iActor].yoffset; break;
1350
        case ACTOR_SECTNUM: lLabelID = sprite[iActor].sectnum; break;
1351
        case ACTOR_STATNUM: lLabelID = sprite[iActor].statnum; break;
1352
        case ACTOR_ANG: lLabelID = sprite[iActor].ang; break;
1353
        case ACTOR_OWNER: lLabelID = sprite[iActor].owner; break;
1354
        case ACTOR_XVEL: lLabelID = sprite[iActor].xvel; break;
1355
        case ACTOR_YVEL: lLabelID = sprite[iActor].yvel; break;
1356
        case ACTOR_ZVEL: lLabelID = sprite[iActor].zvel; break;
1357
        case ACTOR_LOTAG: lLabelID = (int16_t)sprite[iActor].lotag; break;
1358
        case ACTOR_HITAG: lLabelID = (int16_t)sprite[iActor].hitag; break;
1359
        case ACTOR_ULOTAG: lLabelID = sprite[iActor].lotag; break;
1360
        case ACTOR_UHITAG: lLabelID = sprite[iActor].hitag; break;
1361
        case ACTOR_EXTRA: lLabelID = sprite[iActor].extra; break;
1362
        case ACTOR_HTCGG: lLabelID = actor[iActor].cgg; break;
1363
        case ACTOR_HTPICNUM: lLabelID = actor[iActor].picnum; break;
1364
        case ACTOR_HTANG: lLabelID = actor[iActor].ang; break;
1365
        case ACTOR_HTEXTRA: lLabelID = actor[iActor].extra; break;
1366
        case ACTOR_HTOWNER: lLabelID = actor[iActor].owner; break;
1367
        case ACTOR_HTMOVFLAG: lLabelID = actor[iActor].movflag; break;
1368
        case ACTOR_HTTEMPANG: lLabelID = actor[iActor].tempang; break;
1369
        case ACTOR_HTACTORSTAYPUT: lLabelID = actor[iActor].actorstayput; break;
1370
        case ACTOR_HTDISPICNUM: lLabelID = actor[iActor].dispicnum; break;
1371
        case ACTOR_HTTIMETOSLEEP: lLabelID = actor[iActor].timetosleep; break;
1372
        case ACTOR_HTFLOORZ: lLabelID = actor[iActor].floorz; break;
1373
        case ACTOR_HTCEILINGZ: lLabelID = actor[iActor].ceilingz; break;
1374
        case ACTOR_HTLASTVX: lLabelID = actor[iActor].lastvx; break;
1375
        case ACTOR_HTLASTVY: lLabelID = actor[iActor].lastvy; break;
1376
        case ACTOR_HTBPOSX: lLabelID = actor[iActor].bpos.x; break;
1377
        case ACTOR_HTBPOSY: lLabelID = actor[iActor].bpos.y; break;
1378
        case ACTOR_HTBPOSZ: lLabelID = actor[iActor].bpos.z; break;
1379
        case ACTOR_HTG_T: lLabelID = actor[iActor].t_data[lParm2]; break;
1380
        case ACTOR_ANGOFF: lLabelID = spriteext[iActor].angoff; break;
1381
        case ACTOR_PITCH: lLabelID = spriteext[iActor].pitch; break;
1382
        case ACTOR_ROLL: lLabelID = spriteext[iActor].roll; break;
1383
        case ACTOR_MDXOFF: lLabelID = spriteext[iActor].offset.x; break;
1384
        case ACTOR_MDYOFF: lLabelID = spriteext[iActor].offset.y; break;
1385
        case ACTOR_MDZOFF: lLabelID = spriteext[iActor].offset.z; break;
1386
        case ACTOR_MDFLAGS: lLabelID = spriteext[iActor].flags; break;
1387
        case ACTOR_XPANNING: lLabelID = spriteext[iActor].xpanning; break;
1388
        case ACTOR_YPANNING: lLabelID = spriteext[iActor].ypanning; break;
1389
        case ACTOR_HTFLAGS: lLabelID = actor[iActor].flags; break;
1390
        case ACTOR_ALPHA: lLabelID = (uint8_t)(spriteext[iActor].alpha * 255.0f); break;
1391
        case ACTOR_ISVALID: lLabelID = (sprite[iActor].statnum != MAXSTATUS); break;
1392
        default: lLabelID = -1; break;
1204 terminx 1393
    }
1440 terminx 1394
 
4897 terminx 1395
    return lLabelID;
1396
 
1440 terminx 1397
badpos:
3000 helixhorne 1398
    CON_ERRPRINTF("tried to get invalid %s position %d on sprite (%d) from spr %d\n",
4897 terminx 1399
                  ActorLabels[lLabelID].name, lParm2, iActor, vm.g_i);
1440 terminx 1400
    return -1;
1204 terminx 1401
}
1402
 
1625 terminx 1403
static int32_t __fastcall VM_AccessSectorX(int32_t iSector, int32_t lLabelID)
1204 terminx 1404
{
1405
    switch (lLabelID)
1406
    {
4897 terminx 1407
        case SECTOR_WALLPTR: lLabelID = sector[iSector].wallptr; break;
1408
        case SECTOR_WALLNUM: lLabelID = sector[iSector].wallnum; break;
1409
        case SECTOR_CEILINGZ: lLabelID = sector[iSector].ceilingz; break;
1410
        case SECTOR_FLOORZ: lLabelID = sector[iSector].floorz; break;
1411
        case SECTOR_CEILINGSTAT: lLabelID = sector[iSector].ceilingstat; break;
1412
        case SECTOR_FLOORSTAT: lLabelID = sector[iSector].floorstat; break;
1413
        case SECTOR_CEILINGPICNUM: lLabelID = sector[iSector].ceilingpicnum; break;
1414
        case SECTOR_CEILINGSLOPE: lLabelID = sector[iSector].ceilingheinum; break;
1415
        case SECTOR_CEILINGSHADE: lLabelID = sector[iSector].ceilingshade; break;
1416
        case SECTOR_CEILINGPAL: lLabelID = sector[iSector].ceilingpal; break;
1417
        case SECTOR_CEILINGXPANNING: lLabelID = sector[iSector].ceilingxpanning; break;
1418
        case SECTOR_CEILINGYPANNING: lLabelID = sector[iSector].ceilingypanning; break;
1419
        case SECTOR_FLOORPICNUM: lLabelID = sector[iSector].floorpicnum; break;
1420
        case SECTOR_FLOORSLOPE: lLabelID = sector[iSector].floorheinum; break;
1421
        case SECTOR_FLOORSHADE: lLabelID = sector[iSector].floorshade; break;
1422
        case SECTOR_FLOORPAL: lLabelID = sector[iSector].floorpal; break;
1423
        case SECTOR_FLOORXPANNING: lLabelID = sector[iSector].floorxpanning; break;
1424
        case SECTOR_FLOORYPANNING: lLabelID = sector[iSector].floorypanning; break;
1425
        case SECTOR_VISIBILITY: lLabelID = sector[iSector].visibility; break;
1426
        case SECTOR_FOGPAL: lLabelID = sector[iSector].fogpal; break;
1427
        case SECTOR_LOTAG: lLabelID = (int16_t)sector[iSector].lotag; break;
1428
        case SECTOR_HITAG: lLabelID = (int16_t)sector[iSector].hitag; break;
1429
        case SECTOR_ULOTAG: lLabelID = sector[iSector].lotag; break;
1430
        case SECTOR_UHITAG: lLabelID = sector[iSector].hitag; break;
1431
        case SECTOR_EXTRA: lLabelID = sector[iSector].extra; break;
1432
        case SECTOR_CEILINGBUNCH:
1433
        case SECTOR_FLOORBUNCH:
1931 helixhorne 1434
#ifdef YAX_ENABLE
4897 terminx 1435
            lLabelID = yax_getbunch(iSector, lLabelID == SECTOR_FLOORBUNCH);
1931 helixhorne 1436
#else
4897 terminx 1437
            lLabelID = -1;
1931 helixhorne 1438
#endif
4897 terminx 1439
            break;
1440
        default: lLabelID = -1; break;
1204 terminx 1441
    }
4897 terminx 1442
 
1443
    return lLabelID;
1204 terminx 1444
}
1445
 
1625 terminx 1446
static int32_t __fastcall VM_AccessPlayerX(int32_t iPlayer, int32_t lLabelID, int32_t lParm2)
1204 terminx 1447
{
2875 helixhorne 1448
    DukePlayer_t *const ps = g_player[iPlayer].ps;
1449
 
4680 terminx 1450
    if (EDUKE32_PREDICT_FALSE(PlayerLabels[lLabelID].flags & LABEL_HASPARM2 &&
1451
        (unsigned)lParm2 >= (unsigned)PlayerLabels[lLabelID].maxParm2))
1440 terminx 1452
        goto badpos;
1204 terminx 1453
 
1454
    switch (lLabelID)
1455
    {
4897 terminx 1456
        case PLAYER_ZOOM: lLabelID = ps->zoom; break;
1457
        case PLAYER_EXITX: lLabelID = ps->exitx; break;
1458
        case PLAYER_EXITY: lLabelID = ps->exity; break;
1459
        case PLAYER_LOOGIEX: lLabelID = ps->loogiex[lParm2]; break;
1460
        case PLAYER_LOOGIEY: lLabelID = ps->loogiey[lParm2]; break;
1461
        case PLAYER_NUMLOOGS: lLabelID = ps->numloogs; break;
1462
        case PLAYER_LOOGCNT: lLabelID = ps->loogcnt; break;
1463
        case PLAYER_POSX: lLabelID = ps->pos.x; break;
1464
        case PLAYER_POSY: lLabelID = ps->pos.y; break;
1465
        case PLAYER_POSZ: lLabelID = ps->pos.z; break;
1466
        case PLAYER_HORIZ: lLabelID = ps->horiz; break;
1467
        case PLAYER_OHORIZ: lLabelID = ps->ohoriz; break;
1468
        case PLAYER_OHORIZOFF: lLabelID = ps->ohorizoff; break;
1469
        case PLAYER_INVDISPTIME: lLabelID = ps->invdisptime; break;
1470
        case PLAYER_BOBPOSX: lLabelID = ps->bobpos.x; break;
1471
        case PLAYER_BOBPOSY: lLabelID = ps->bobpos.y; break;
1472
        case PLAYER_OPOSX: lLabelID = ps->opos.x; break;
1473
        case PLAYER_OPOSY: lLabelID = ps->opos.y; break;
1474
        case PLAYER_OPOSZ: lLabelID = ps->opos.z; break;
1475
        case PLAYER_PYOFF: lLabelID = ps->pyoff; break;
1476
        case PLAYER_OPYOFF: lLabelID = ps->opyoff; break;
1477
        case PLAYER_POSXV: lLabelID = ps->vel.x; break;
1478
        case PLAYER_POSYV: lLabelID = ps->vel.y; break;
1479
        case PLAYER_POSZV: lLabelID = ps->vel.z; break;
1480
        case PLAYER_LAST_PISSED_TIME: lLabelID = ps->last_pissed_time; break;
1481
        case PLAYER_TRUEFZ: lLabelID = ps->truefz; break;
1482
        case PLAYER_TRUECZ: lLabelID = ps->truecz; break;
1483
        case PLAYER_PLAYER_PAR: lLabelID = ps->player_par; break;
1484
        case PLAYER_VISIBILITY: lLabelID = ps->visibility; break;
1485
        case PLAYER_BOBCOUNTER: lLabelID = ps->bobcounter; break;
1486
        case PLAYER_WEAPON_SWAY: lLabelID = ps->weapon_sway; break;
1487
        case PLAYER_PALS_TIME: lLabelID = ps->pals.f; break;
1488
        case PLAYER_RANDOMFLAMEX: lLabelID = ps->randomflamex; break;
1489
        case PLAYER_CRACK_TIME: lLabelID = ps->crack_time; break;
1490
        case PLAYER_AIM_MODE: lLabelID = ps->aim_mode; break;
1491
        case PLAYER_ANG: lLabelID = ps->ang; break;
1492
        case PLAYER_OANG: lLabelID = ps->oang; break;
1493
        case PLAYER_ANGVEL: lLabelID = ps->angvel; break;
1494
        case PLAYER_CURSECTNUM: lLabelID = ps->cursectnum; break;
1495
        case PLAYER_LOOK_ANG: lLabelID = ps->look_ang; break;
1496
        case PLAYER_LAST_EXTRA: lLabelID = ps->last_extra; break;
1497
        case PLAYER_SUBWEAPON: lLabelID = ps->subweapon; break;
1498
        case PLAYER_AMMO_AMOUNT: lLabelID = ps->ammo_amount[lParm2]; break;
1499
        case PLAYER_WACKEDBYACTOR: lLabelID = ps->wackedbyactor; break;
1500
        case PLAYER_FRAG: lLabelID = ps->frag; break;
1501
        case PLAYER_FRAGGEDSELF: lLabelID = ps->fraggedself; break;
1502
        case PLAYER_CURR_WEAPON: lLabelID = ps->curr_weapon; break;
1503
        case PLAYER_LAST_WEAPON: lLabelID = ps->last_weapon; break;
1504
        case PLAYER_TIPINCS: lLabelID = ps->tipincs; break;
1505
        case PLAYER_HORIZOFF: lLabelID = ps->horizoff; break;
1506
        case PLAYER_WANTWEAPONFIRE: lLabelID = ps->wantweaponfire; break;
1507
        case PLAYER_HOLODUKE_AMOUNT: lLabelID = ps->inv_amount[GET_HOLODUKE]; break;
1508
        case PLAYER_NEWOWNER: lLabelID = ps->newowner; break;
1509
        case PLAYER_HURT_DELAY: lLabelID = ps->hurt_delay; break;
1510
        case PLAYER_HBOMB_HOLD_DELAY: lLabelID = ps->hbomb_hold_delay; break;
1511
        case PLAYER_JUMPING_COUNTER: lLabelID = ps->jumping_counter; break;
1512
        case PLAYER_AIRLEFT: lLabelID = ps->airleft; break;
1513
        case PLAYER_KNEE_INCS: lLabelID = ps->knee_incs; break;
1514
        case PLAYER_ACCESS_INCS: lLabelID = ps->access_incs; break;
1515
        case PLAYER_FTA: lLabelID = ps->fta; break;
1516
        case PLAYER_FTQ: lLabelID = ps->ftq; break;
1517
        case PLAYER_ACCESS_WALLNUM: lLabelID = ps->access_wallnum; break;
1518
        case PLAYER_ACCESS_SPRITENUM: lLabelID = ps->access_spritenum; break;
1519
        case PLAYER_KICKBACK_PIC: lLabelID = ps->kickback_pic; break;
1520
        case PLAYER_GOT_ACCESS: lLabelID = ps->got_access; break;
1521
        case PLAYER_WEAPON_ANG: lLabelID = ps->weapon_ang; break;
1522
        case PLAYER_FIRSTAID_AMOUNT: lLabelID = ps->inv_amount[GET_FIRSTAID]; break;
1523
        case PLAYER_SOMETHINGONPLAYER: lLabelID = ps->somethingonplayer; break;
1524
        case PLAYER_ON_CRANE: lLabelID = ps->on_crane; break;
1525
        case PLAYER_I: lLabelID = ps->i; break;
1526
        case PLAYER_ONE_PARALLAX_SECTNUM: lLabelID = ps->one_parallax_sectnum; break;
1527
        case PLAYER_OVER_SHOULDER_ON: lLabelID = ps->over_shoulder_on; break;
1528
        case PLAYER_RANDOM_CLUB_FRAME: lLabelID = ps->random_club_frame; break;
1529
        case PLAYER_FIST_INCS: lLabelID = ps->fist_incs; break;
1530
        case PLAYER_ONE_EIGHTY_COUNT: lLabelID = ps->one_eighty_count; break;
1531
        case PLAYER_CHEAT_PHASE: lLabelID = ps->cheat_phase; break;
1532
        case PLAYER_DUMMYPLAYERSPRITE: lLabelID = ps->dummyplayersprite; break;
1533
        case PLAYER_EXTRA_EXTRA8: lLabelID = ps->extra_extra8; break;
1534
        case PLAYER_QUICK_KICK: lLabelID = ps->quick_kick; break;
1535
        case PLAYER_HEAT_AMOUNT: lLabelID = ps->inv_amount[GET_HEATS]; break;
1536
        case PLAYER_ACTORSQU: lLabelID = ps->actorsqu; break;
1537
        case PLAYER_TIMEBEFOREEXIT: lLabelID = ps->timebeforeexit; break;
1538
        case PLAYER_CUSTOMEXITSOUND: lLabelID = ps->customexitsound; break;
1539
        case PLAYER_WEAPRECS: lLabelID = ps->weaprecs[lParm2]; break;
1540
        case PLAYER_WEAPRECCNT: lLabelID = ps->weapreccnt; break;
1541
        case PLAYER_INTERFACE_TOGGLE_FLAG: lLabelID = ps->interface_toggle_flag; break;
1542
        case PLAYER_ROTSCRNANG: lLabelID = ps->rotscrnang; break;
1543
        case PLAYER_DEAD_FLAG: lLabelID = ps->dead_flag; break;
1544
        case PLAYER_SHOW_EMPTY_WEAPON: lLabelID = ps->show_empty_weapon; break;
1545
        case PLAYER_SCUBA_AMOUNT: lLabelID = ps->inv_amount[GET_SCUBA]; break;
1546
        case PLAYER_JETPACK_AMOUNT: lLabelID = ps->inv_amount[GET_JETPACK]; break;
1547
        case PLAYER_STEROIDS_AMOUNT: lLabelID = ps->inv_amount[GET_STEROIDS]; break;
1548
        case PLAYER_SHIELD_AMOUNT: lLabelID = ps->inv_amount[GET_SHIELD]; break;
1549
        case PLAYER_HOLODUKE_ON: lLabelID = ps->holoduke_on; break;
1550
        case PLAYER_PYCOUNT: lLabelID = ps->pycount; break;
1551
        case PLAYER_WEAPON_POS: lLabelID = ps->weapon_pos; break;
1552
        case PLAYER_FRAG_PS: lLabelID = ps->frag_ps; break;
1553
        case PLAYER_TRANSPORTER_HOLD: lLabelID = ps->transporter_hold; break;
1554
        case PLAYER_LAST_FULL_WEAPON: lLabelID = ps->last_full_weapon; break;
1555
        case PLAYER_FOOTPRINTSHADE: lLabelID = ps->footprintshade; break;
1556
        case PLAYER_BOOT_AMOUNT: lLabelID = ps->inv_amount[GET_BOOTS]; break;
1557
        case PLAYER_SCREAM_VOICE: lLabelID = ps->scream_voice; break;
1558
        case PLAYER_GM: lLabelID = ps->gm; break;
1559
        case PLAYER_ON_WARPING_SECTOR: lLabelID = ps->on_warping_sector; break;
1560
        case PLAYER_FOOTPRINTCOUNT: lLabelID = ps->footprintcount; break;
1561
        case PLAYER_HBOMB_ON: lLabelID = ps->hbomb_on; break;
1562
        case PLAYER_JUMPING_TOGGLE: lLabelID = ps->jumping_toggle; break;
1563
        case PLAYER_RAPID_FIRE_HOLD: lLabelID = ps->rapid_fire_hold; break;
1564
        case PLAYER_ON_GROUND: lLabelID = ps->on_ground; break;
1565
        case PLAYER_INVEN_ICON: lLabelID = ps->inven_icon; break;
1566
        case PLAYER_BUTTONPALETTE: lLabelID = ps->buttonpalette; break;
1567
        case PLAYER_JETPACK_ON: lLabelID = ps->jetpack_on; break;
1568
        case PLAYER_SPRITEBRIDGE: lLabelID = ps->spritebridge; break;
1569
        case PLAYER_LASTRANDOMSPOT: lLabelID = ps->lastrandomspot; break;
1570
        case PLAYER_SCUBA_ON: lLabelID = ps->scuba_on; break;
1571
        case PLAYER_FOOTPRINTPAL: lLabelID = ps->footprintpal; break;
1572
        case PLAYER_HEAT_ON: lLabelID = ps->heat_on; break;
1573
        case PLAYER_HOLSTER_WEAPON: lLabelID = ps->holster_weapon; break;
1574
        case PLAYER_FALLING_COUNTER: lLabelID = ps->falling_counter; break;
1575
        case PLAYER_GOTWEAPON: lLabelID = (ps->gotweapon & (1 << lParm2)) != 0; break;
1576
        case PLAYER_REFRESH_INVENTORY: lLabelID = ps->refresh_inventory; break;
1577
        case PLAYER_TOGGLE_KEY_FLAG: lLabelID = ps->toggle_key_flag; break;
1578
        case PLAYER_KNUCKLE_INCS: lLabelID = ps->knuckle_incs; break;
1579
        case PLAYER_WALKING_SND_TOGGLE: lLabelID = ps->walking_snd_toggle; break;
1580
        case PLAYER_PALOOKUP: lLabelID = ps->palookup; break;
1581
        case PLAYER_HARD_LANDING: lLabelID = ps->hard_landing; break;
1582
        case PLAYER_MAX_SECRET_ROOMS: lLabelID = ps->max_secret_rooms; break;
1583
        case PLAYER_SECRET_ROOMS: lLabelID = ps->secret_rooms; break;
1584
        case PLAYER_PALS:
1585
            switch (lParm2)
1586
            {
1587
                case 0: lLabelID = ps->pals.r; break;
1588
                case 1: lLabelID = ps->pals.g; break;
1589
                case 2: lLabelID = ps->pals.b; break;
1590
                default: lLabelID = -1; break;
1591
            }
1592
            break;
1593
        case PLAYER_MAX_ACTORS_KILLED: lLabelID = ps->max_actors_killed; break;
1594
        case PLAYER_ACTORS_KILLED: lLabelID = ps->actors_killed; break;
1595
        case PLAYER_RETURN_TO_CENTER: lLabelID = ps->return_to_center; break;
1596
        case PLAYER_RUNSPEED: lLabelID = ps->runspeed; break;
1597
        case PLAYER_SBS: lLabelID = ps->sbs; break;
1598
        case PLAYER_RELOADING: lLabelID = ps->reloading; break;
1599
        case PLAYER_AUTO_AIM: lLabelID = ps->auto_aim; break;
1600
        case PLAYER_MOVEMENT_LOCK: lLabelID = ps->movement_lock; break;
1601
        case PLAYER_SOUND_PITCH: lLabelID = ps->sound_pitch; break;
1602
        case PLAYER_WEAPONSWITCH: lLabelID = ps->weaponswitch; break;
1603
        case PLAYER_TEAM: lLabelID = ps->team; break;
1604
        case PLAYER_MAX_PLAYER_HEALTH: lLabelID = ps->max_player_health; break;
1605
        case PLAYER_MAX_SHIELD_AMOUNT: lLabelID = ps->max_shield_amount; break;
1606
        case PLAYER_MAX_AMMO_AMOUNT: lLabelID = ps->max_ammo_amount[lParm2]; break;
1607
        case PLAYER_LAST_QUICK_KICK: lLabelID = ps->last_quick_kick; break;
1608
        case PLAYER_AUTOSTEP: lLabelID = ps->autostep; break;
1609
        case PLAYER_AUTOSTEP_SBW: lLabelID = ps->autostep_sbw; break;
1610
        default: lLabelID = -1; break;
1204 terminx 1611
    }
1440 terminx 1612
 
4897 terminx 1613
    return lLabelID;
1614
 
1440 terminx 1615
badpos:
3000 helixhorne 1616
    CON_ERRPRINTF("tried to get invalid %s position %d on player (%d) from spr %d\n",
1617
                  PlayerLabels[lLabelID].name,lParm2,iPlayer,vm.g_i);
1440 terminx 1618
    return -1;
1204 terminx 1619
}
1620
 
1625 terminx 1621
static int32_t __fastcall VM_AccessWallX(int32_t iWall, int32_t lLabelID)
1205 terminx 1622
{
1623
    switch (lLabelID)
1624
    {
4897 terminx 1625
        case WALL_X: lLabelID = wall[iWall].x; break;
1626
        case WALL_Y: lLabelID = wall[iWall].y; break;
1627
        case WALL_POINT2: lLabelID = wall[iWall].point2; break;
1628
        case WALL_NEXTWALL: lLabelID = wall[iWall].nextwall; break;
1629
        case WALL_NEXTSECTOR: lLabelID = wall[iWall].nextsector; break;
1630
        case WALL_CSTAT: lLabelID = wall[iWall].cstat; break;
1631
        case WALL_PICNUM: lLabelID = wall[iWall].picnum; break;
1632
        case WALL_OVERPICNUM: lLabelID = wall[iWall].overpicnum; break;
1633
        case WALL_SHADE: lLabelID = wall[iWall].shade; break;
1634
        case WALL_PAL: lLabelID = wall[iWall].pal; break;
1635
        case WALL_XREPEAT: lLabelID = wall[iWall].xrepeat; break;
1636
        case WALL_YREPEAT: lLabelID = wall[iWall].yrepeat; break;
1637
        case WALL_XPANNING: lLabelID = wall[iWall].xpanning; break;
1638
        case WALL_YPANNING: lLabelID = wall[iWall].ypanning; break;
1639
        case WALL_LOTAG: lLabelID = (int16_t)wall[iWall].lotag; break;
1640
        case WALL_HITAG: lLabelID = (int16_t)wall[iWall].hitag; break;
1641
        case WALL_ULOTAG: lLabelID = wall[iWall].lotag; break;
1642
        case WALL_UHITAG: lLabelID = wall[iWall].hitag; break;
1643
        case WALL_EXTRA: lLabelID = wall[iWall].extra; break;
1644
        default: lLabelID = -1;
1205 terminx 1645
    }
4897 terminx 1646
 
1647
    return lLabelID;
1205 terminx 1648
}
4747 terminx 1649
#endif // gamevars_c_