Subversion Repositories eduke32

Rev

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