From 4682da7a2276af14bb877c505d1449c5c2cc4974 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Wed, 25 Mar 2015 06:27:25 +0000 Subject: [PATCH] C-CON: Factor fast struct access and get out into single functions. git-svn-id: https://svn.eduke32.com/eduke32@5086 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/gameexec.c | 143 +- polymer/eduke32/source/gamestructures.c | 2475 ++++++++++------------- polymer/eduke32/source/gamevars.c | 16 +- 3 files changed, 1180 insertions(+), 1454 deletions(-) diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index e6654378e..b980b5125 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -1262,14 +1262,27 @@ skip_check: } case CON_GETTHISPROJECTILE: + insptr++; + { + tw = *insptr++; + int32_t lLabelID=*insptr++, lVar2=*insptr++; + + register int32_t const iActor = (tw != g_iThisActorID) ? Gv_GetVarX(tw) : vm.g_i; + + Gv_SetVarX(lVar2, VM_GetActiveProjectile(iActor, lLabelID)); + continue; + } + case CON_SETTHISPROJECTILE: insptr++; { - // syntax [gs]etplayer[].x - // - int32_t lVar1=*insptr++, lLabelID=*insptr++, lVar2=*insptr++; + tw = *insptr++; + int32_t lLabelID=*insptr++, lVar2=*insptr++; - VM_AccessActiveProjectile(tw==CON_SETTHISPROJECTILE,lVar1,lLabelID,lVar2); + register int32_t const iActor = (tw != g_iThisActorID) ? Gv_GetVarX(tw) : vm.g_i; + register int32_t const iSet = Gv_GetVarX(lVar2); + + VM_SetActiveProjectile(iActor, lLabelID, iSet); continue; } @@ -3971,14 +3984,27 @@ finish_qsprintf: } case CON_SETSECTOR: + insptr++; + { + tw = *insptr++; + int const lLabelID=*insptr++, lVar2=*insptr++; + + register int32_t const iSector = (tw != g_iThisActorID) ? Gv_GetVarX(tw) : sprite[vm.g_i].sectnum; + register int32_t const iSet = Gv_GetVarX(lVar2); + + VM_SetSector(iSector, lLabelID, iSet); + continue; + } + case CON_GETSECTOR: insptr++; { - // syntax [gs]etsector[].x - // - int const lVar1=*insptr++, lLabelID=*insptr++, lVar2=*insptr++; + tw = *insptr++; + int const lLabelID=*insptr++, lVar2=*insptr++; - VM_AccessSector(tw==CON_SETSECTOR, lVar1, lLabelID, lVar2); + register int32_t const iSector = (tw != g_iThisActorID) ? Gv_GetVarX(tw) : sprite[vm.g_i].sectnum; + + Gv_SetVarX(lVar2, VM_GetSector(iSector, lLabelID)); continue; } @@ -4219,9 +4245,13 @@ finish_qsprintf: insptr++; { tw=*insptr++; - int const lLabelID=*insptr++; + int const lLabelID=*insptr++, lVar2 = *insptr++; int const lParm2 = (PlayerLabels[lLabelID].flags & LABEL_HASPARM2) ? Gv_GetVarX(*insptr++) : 0; - VM_SetPlayer(tw, lLabelID, *insptr++, lParm2); + + register int32_t const iPlayer = (tw != g_iThisActorID) ? Gv_GetVarX(tw) : vm.g_p; + register int32_t const iSet = Gv_GetVarX(lVar2); + + VM_SetPlayer(iPlayer, lLabelID, lParm2, iSet); continue; } @@ -4231,7 +4261,11 @@ finish_qsprintf: tw=*insptr++; int const lLabelID=*insptr++; int const lParm2 = (PlayerLabels[lLabelID].flags & LABEL_HASPARM2) ? Gv_GetVarX(*insptr++) : 0; - VM_GetPlayer(tw, lLabelID, *insptr++, lParm2); + int const lVar2 = *insptr++; + + register int32_t const iPlayer = (tw != g_iThisActorID) ? Gv_GetVarX(tw) : vm.g_p; + + Gv_SetVarX(lVar2, VM_GetPlayer(iPlayer, lLabelID, lParm2)); continue; } @@ -4240,7 +4274,10 @@ finish_qsprintf: { tw=*insptr++; int const lLabelID=*insptr++, lVar2=*insptr++; - VM_AccessPlayerInput(0, tw, lLabelID, lVar2); + + register int32_t const iPlayer = (tw != g_iThisActorID) ? Gv_GetVarX(tw) : vm.g_p; + + Gv_SetVarX(lVar2, VM_GetPlayerInput(iPlayer, lLabelID)); continue; } @@ -4249,7 +4286,11 @@ finish_qsprintf: { tw=*insptr++; int const lLabelID=*insptr++, lVar2=*insptr++; - VM_AccessPlayerInput(1, tw, lLabelID, lVar2); + + register int32_t const iPlayer = (tw != g_iThisActorID) ? Gv_GetVarX(tw) : vm.g_p; + register int32_t const iSet = Gv_GetVarX(lVar2); + + VM_SetPlayerInput(iPlayer, lLabelID, iSet); continue; } @@ -4258,7 +4299,8 @@ finish_qsprintf: { tw=*insptr++; int const lVar2=*insptr++; - VM_AccessUserdef(0, tw, lVar2); + + Gv_SetVarX(lVar2, VM_GetUserdef(tw)); continue; } @@ -4267,7 +4309,10 @@ finish_qsprintf: { tw=*insptr++; int const lVar2=*insptr++; - VM_AccessUserdef(1, tw, lVar2); + + register int32_t const iSet = Gv_GetVarX(lVar2); + + VM_SetUserdef(tw, iSet); continue; } @@ -4276,7 +4321,10 @@ finish_qsprintf: { tw = Gv_GetVarX(*insptr++); int const lLabelID = *insptr++, lVar2 = *insptr++; - VM_AccessProjectile(0, tw, lLabelID, lVar2); + + register int32_t const iTile = Gv_GetVarX(tw); + + Gv_SetVarX(lVar2, VM_GetProjectile(iTile, lLabelID)); continue; } @@ -4285,7 +4333,11 @@ finish_qsprintf: { tw = Gv_GetVarX(*insptr++); int const lLabelID = *insptr++, lVar2 = *insptr++; - VM_AccessProjectile(1, tw, lLabelID, lVar2); + + register int32_t const iTile = Gv_GetVarX(tw); + register int32_t const iSet = Gv_GetVarX(lVar2); + + VM_SetProjectile(iTile, lLabelID, iSet); continue; } @@ -4294,7 +4346,11 @@ finish_qsprintf: { tw=*insptr++; int const lLabelID=*insptr++, lVar2=*insptr++; - VM_AccessWall(1, tw, lLabelID, lVar2); + + register int32_t const iWall = Gv_GetVarX(tw); + register int32_t const iSet = Gv_GetVarX(lVar2); + + VM_SetWall(iWall, lLabelID, iSet); continue; } @@ -4303,7 +4359,10 @@ finish_qsprintf: { tw=*insptr++; int const lLabelID=*insptr++, lVar2=*insptr++; - VM_AccessWall(0, tw, lLabelID, lVar2); + + register int32_t const iWall = Gv_GetVarX(tw); + + Gv_SetVarX(lVar2, VM_GetWall(iWall, lLabelID)); continue; } @@ -4311,9 +4370,6 @@ finish_qsprintf: case CON_GETACTORVAR: insptr++; { - // syntax [gs]etactorvar[]. - // gets the value of the per-actor variable varx into VAR - // int const lSprite=Gv_GetVarX(*insptr++), lVar1=*insptr++; int const lVar2=*insptr++; @@ -4368,39 +4424,54 @@ finish_qsprintf: case CON_SETACTOR: insptr++; { - // syntax [gs]etactor[].x - // - - int const lVar1 = *insptr++, lLabelID = *insptr++; + tw = *insptr++; + int const lLabelID = *insptr++; int const lParm2 = (ActorLabels[lLabelID].flags & LABEL_HASPARM2) ? Gv_GetVarX(*insptr++) : 0; + int const lVar2 = *insptr++; - VM_SetSprite(lVar1, lLabelID, *insptr++, lParm2); + register int32_t const iActor = (tw != g_iThisActorID) ? Gv_GetVarX(tw) : vm.g_i; + register int32_t const iSet = Gv_GetVarX(lVar2); + + VM_SetSprite(iActor, lLabelID, lParm2, iSet); continue; } case CON_GETACTOR: insptr++; { - // syntax [gs]etactor[].x - // - - int const lVar1=*insptr++, lLabelID=*insptr++; + tw = *insptr++; + int const lLabelID = *insptr++; int const lParm2 = (ActorLabels[lLabelID].flags & LABEL_HASPARM2) ? Gv_GetVarX(*insptr++) : 0; + int const lVar2 = *insptr++; - VM_GetSprite(lVar1, lLabelID, *insptr++, lParm2); + register int32_t const iActor = (tw != g_iThisActorID) ? Gv_GetVarX(tw) : vm.g_i; + + Gv_SetVarX(lVar2, VM_GetSprite(iActor, lLabelID, lParm2)); continue; } case CON_SETTSPR: + insptr++; + { + tw = *insptr++; + int const lLabelID=*insptr++, lVar2=*insptr++; + + register int32_t const iActor = (tw != g_iThisActorID) ? Gv_GetVarX(tw) : vm.g_i; + register int32_t const iSet = Gv_GetVarX(lVar2); + + VM_SetTsprite(iActor, lLabelID, iSet); + continue; + } + case CON_GETTSPR: insptr++; { - // syntax [gs]etactor[].x - // + tw = *insptr++; + int const lLabelID=*insptr++, lVar2=*insptr++; - int const lVar1=*insptr++, lLabelID=*insptr++, lVar2=*insptr++; + register int32_t const iActor = (tw != g_iThisActorID) ? Gv_GetVarX(tw) : vm.g_i; - VM_AccessTsprite(tw==CON_SETTSPR, lVar1, lLabelID, lVar2); + Gv_SetVarX(lVar2, VM_GetTsprite(iActor, lLabelID)); continue; } diff --git a/polymer/eduke32/source/gamestructures.c b/polymer/eduke32/source/gamestructures.c index 0764f2b35..e058781ec 100644 --- a/polymer/eduke32/source/gamestructures.c +++ b/polymer/eduke32/source/gamestructures.c @@ -29,1430 +29,377 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // I got a 3-4 fps gain by inlining these... #ifndef gamevars_c_ -static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t lVar2) +int32_t __fastcall VM_GetUserdef(register int32_t lLabelID); +void __fastcall VM_SetUserdef(register int32_t const lLabelID, register int32_t const iSet); +int32_t __fastcall VM_GetActiveProjectile(register int32_t const iActor, register int32_t lLabelID); +void __fastcall VM_SetActiveProjectile(register int32_t const iActor, register int32_t const lLabelID, register int32_t const iSet); +int32_t __fastcall VM_GetPlayer(register int32_t const iPlayer, register int32_t lLabelID, register int32_t const lParm2); +void __fastcall VM_SetPlayer(register int32_t const iPlayer, register int32_t const lLabelID, register int32_t const lParm2, register int32_t const iSet); +int32_t __fastcall VM_GetPlayerInput(register int32_t const iPlayer, register int32_t lLabelID); +void __fastcall VM_SetPlayerInput(register int32_t const iPlayer, register int32_t const lLabelID, register int32_t const iSet); +int32_t __fastcall VM_GetWall(register int32_t const iWall, register int32_t lLabelID); +void __fastcall VM_SetWall(register int32_t const iWall, register int32_t const lLabelID, register int32_t const iSet); +int32_t __fastcall VM_GetSector(register int32_t const iSector, register int32_t lLabelID); +void __fastcall VM_SetSector(register int32_t const iSector, register int32_t const lLabelID, register int32_t const iSet); +int32_t __fastcall VM_GetSprite(register int32_t const iActor, register int32_t lLabelID, register int32_t const lParm2); +void __fastcall VM_SetSprite(register int32_t const iActor, register int32_t const lLabelID, register int32_t const lParm2, register int32_t const iSet); +int32_t __fastcall VM_GetTsprite(register int32_t const iActor, register int32_t lLabelID); +void __fastcall VM_SetTsprite(register int32_t const iActor, register int32_t const lLabelID, register int32_t const iSet); +int32_t __fastcall VM_GetProjectile(register int32_t const iTile, register int32_t lLabelID); +void __fastcall VM_SetProjectile(register int32_t const iTile, register int32_t const lLabelID, register int32_t const iSet); +#else +int32_t __fastcall VM_GetUserdef(register int32_t lLabelID) { if (EDUKE32_PREDICT_FALSE(vm.g_p != myconnectindex)) - { - insptr += (lVar2 == MAXGAMEVARS); - return; - } + return -1; - if (iSet) + switch (lLabelID) { - iSet = Gv_GetVarX(lVar2); - - switch (lLabelID) - { - case USERDEFS_GOD: ud.god = iSet; break; - case USERDEFS_WARP_ON: ud.warp_on = iSet; break; - case USERDEFS_CASHMAN: ud.cashman = iSet; break; - case USERDEFS_EOG: ud.eog = iSet; break; - case USERDEFS_SHOWALLMAP: ud.showallmap = iSet; break; - case USERDEFS_SHOW_HELP: ud.show_help = iSet; break; - case USERDEFS_SCROLLMODE: ud.scrollmode = iSet; break; - case USERDEFS_CLIPPING: ud.noclip = iSet; break; - // case USERDEFS_USER_NAME: ud.user_name[MAXPLAYERS][32] = lValue; break; - // case USERDEFS_RIDECULE: ud.ridecule = lValue; break; - // case USERDEFS_SAVEGAME: ud.savegame = lValue; break; - // case USERDEFS_PWLOCKOUT: ud.pwlockout = lValue; break; - // case USERDEFS_RTSNAME: ud.rtsname = lValue; break; - case USERDEFS_OVERHEAD_ON: ud.overhead_on = iSet; break; - case USERDEFS_LAST_OVERHEAD: ud.last_overhead = iSet; break; - case USERDEFS_SHOWWEAPONS: ud.showweapons = iSet; break; - case USERDEFS_PAUSE_ON: ud.pause_on = iSet; break; - case USERDEFS_FROM_BONUS: ud.from_bonus = iSet; break; - case USERDEFS_CAMERASPRITE: ud.camerasprite = iSet; break; - case USERDEFS_LAST_CAMSPRITE: ud.last_camsprite = iSet; break; - case USERDEFS_LAST_LEVEL: ud.last_level = iSet; break; - case USERDEFS_SECRETLEVEL: ud.secretlevel = iSet; break; - case USERDEFS_CONST_VISIBILITY: ud.const_visibility = iSet; break; - case USERDEFS_UW_FRAMERATE: ud.uw_framerate = iSet; break; - case USERDEFS_CAMERA_TIME: ud.camera_time = iSet; break; - case USERDEFS_FOLFVEL: ud.folfvel = iSet; break; - case USERDEFS_FOLAVEL: ud.folavel = iSet; break; - case USERDEFS_FOLX: ud.folx = iSet; break; - case USERDEFS_FOLY: ud.foly = iSet; break; - case USERDEFS_FOLA: ud.fola = iSet; break; - case USERDEFS_RECCNT: ud.reccnt = iSet; break; - case USERDEFS_ENTERED_NAME: ud.entered_name = iSet; break; - case USERDEFS_SCREEN_TILTING: ud.screen_tilting = iSet; break; - case USERDEFS_SHADOWS: ud.shadows = iSet; break; - case USERDEFS_FTA_ON: ud.fta_on = iSet; break; - case USERDEFS_EXECUTIONS: ud.executions = iSet; break; - case USERDEFS_AUTO_RUN: ud.auto_run = iSet; break; - case USERDEFS_COORDS: ud.coords = iSet; break; - case USERDEFS_TICKRATE: ud.tickrate = iSet; break; - case USERDEFS_M_COOP: ud.m_coop = iSet; break; - case USERDEFS_COOP: ud.coop = iSet; break; - case USERDEFS_SCREEN_SIZE: - if (ud.screen_size != iSet) - { - ud.screen_size = iSet; - G_UpdateScreenArea(); - } - break; - case USERDEFS_LOCKOUT: ud.lockout = iSet; break; - case USERDEFS_CROSSHAIR: ud.crosshair = iSet; break; - case USERDEFS_PLAYERAI: ud.playerai = iSet; break; - case USERDEFS_RESPAWN_MONSTERS: ud.respawn_monsters = iSet; break; - case USERDEFS_RESPAWN_ITEMS: ud.respawn_items = iSet; break; - case USERDEFS_RESPAWN_INVENTORY: ud.respawn_inventory = iSet; break; - case USERDEFS_RECSTAT: ud.recstat = iSet; break; - case USERDEFS_MONSTERS_OFF: ud.monsters_off = iSet; break; - case USERDEFS_BRIGHTNESS: ud.brightness = iSet; break; - case USERDEFS_M_RESPAWN_ITEMS: ud.m_respawn_items = iSet; break; - case USERDEFS_M_RESPAWN_MONSTERS: ud.m_respawn_monsters = iSet; break; - case USERDEFS_M_RESPAWN_INVENTORY: ud.m_respawn_inventory = iSet; break; - case USERDEFS_M_RECSTAT: ud.m_recstat = iSet; break; - case USERDEFS_M_MONSTERS_OFF: ud.m_monsters_off = iSet; break; - // REMINDER: must implement "boolean" setters like this in Lunatic, too. - case USERDEFS_DETAIL: ud.detail = !!iSet; break; - case USERDEFS_M_FFIRE: ud.m_ffire = iSet; break; - case USERDEFS_FFIRE: ud.ffire = iSet; break; - case USERDEFS_M_PLAYER_SKILL: ud.m_player_skill = iSet; break; - case USERDEFS_M_LEVEL_NUMBER: ud.m_level_number = iSet; break; - case USERDEFS_M_VOLUME_NUMBER: ud.m_volume_number = iSet; break; - case USERDEFS_MULTIMODE: ud.multimode = iSet; break; - case USERDEFS_PLAYER_SKILL: ud.player_skill = iSet; break; - case USERDEFS_LEVEL_NUMBER: ud.level_number = iSet; break; - case USERDEFS_VOLUME_NUMBER: ud.volume_number = iSet; break; - case USERDEFS_M_MARKER: ud.m_marker = iSet; break; - case USERDEFS_MARKER: ud.marker = iSet; break; - case USERDEFS_MOUSEFLIP: ud.mouseflip = iSet; break; - case USERDEFS_STATUSBARSCALE: ud.statusbarscale = iSet; break; - case USERDEFS_DRAWWEAPON: ud.drawweapon = iSet; break; - case USERDEFS_MOUSEAIMING: ud.mouseaiming = iSet; break; - case USERDEFS_WEAPONSWITCH: ud.weaponswitch = iSet; break; - case USERDEFS_DEMOCAMS: ud.democams = iSet; break; - case USERDEFS_COLOR: ud.color = iSet; break; - case USERDEFS_MSGDISPTIME: ud.msgdisptime = iSet; break; - case USERDEFS_STATUSBARMODE: ud.statusbarmode = iSet; break; - case USERDEFS_M_NOEXITS: ud.m_noexits = iSet; break; - case USERDEFS_NOEXITS: ud.noexits = iSet; break; - case USERDEFS_AUTOVOTE: ud.autovote = iSet; break; - case USERDEFS_AUTOMSG: ud.automsg = iSet; break; - case USERDEFS_IDPLAYERS: ud.idplayers = iSet; break; - case USERDEFS_TEAM: ud.team = iSet; break; - case USERDEFS_VIEWBOB: ud.viewbob = iSet; break; - case USERDEFS_WEAPONSWAY: ud.weaponsway = iSet; break; - case USERDEFS_ANGLEINTERPOLATION: ud.angleinterpolation = iSet; break; - case USERDEFS_OBITUARIES: ud.obituaries = iSet; break; - case USERDEFS_LEVELSTATS: ud.levelstats = iSet; break; - case USERDEFS_CROSSHAIRSCALE: ud.crosshairscale = iSet; break; - case USERDEFS_ALTHUD: ud.althud = iSet; break; - case USERDEFS_DISPLAY_BONUS_SCREEN: ud.display_bonus_screen = iSet; break; - case USERDEFS_SHOW_LEVEL_TEXT: ud.show_level_text = iSet; break; - case USERDEFS_WEAPONSCALE: ud.weaponscale = iSet; break; - case USERDEFS_TEXTSCALE: ud.textscale = iSet; break; - case USERDEFS_RUNKEY_MODE: ud.runkey_mode = iSet; break; - case USERDEFS_M_ORIGIN_X: ud.m_origin.x = iSet; break; - case USERDEFS_M_ORIGIN_Y: ud.m_origin.y = iSet; break; - default: break; - } - } - else - { - switch (lLabelID) - { - case USERDEFS_GOD: lLabelID = ud.god; break; - case USERDEFS_WARP_ON: lLabelID = ud.warp_on; break; - case USERDEFS_CASHMAN: lLabelID = ud.cashman; break; - case USERDEFS_EOG: lLabelID = ud.eog; break; - case USERDEFS_SHOWALLMAP: lLabelID = ud.showallmap; break; - case USERDEFS_SHOW_HELP: lLabelID = ud.show_help; break; - case USERDEFS_SCROLLMODE: lLabelID = ud.scrollmode; break; - case USERDEFS_CLIPPING: lLabelID = ud.noclip; break; - // case USERDEFS_USER_NAME: lLabelID= ud.user_name[MAXPLAYERS][32]; break; - // case USERDEFS_RIDECULE: lLabelID= ud.ridecule; break; - // case USERDEFS_SAVEGAME: lLabelID= ud.savegame; break; - // case USERDEFS_PWLOCKOUT: lLabelID= ud.pwlockout; break; - // case USERDEFS_RTSNAME: lLabelID= ud.rtsname; break; - case USERDEFS_OVERHEAD_ON: lLabelID = ud.overhead_on; break; - case USERDEFS_LAST_OVERHEAD: lLabelID = ud.last_overhead; break; - case USERDEFS_SHOWWEAPONS: lLabelID = ud.showweapons; break; - case USERDEFS_PAUSE_ON: lLabelID = ud.pause_on; break; - case USERDEFS_FROM_BONUS: lLabelID = ud.from_bonus; break; - case USERDEFS_CAMERASPRITE: lLabelID = ud.camerasprite; break; - case USERDEFS_LAST_CAMSPRITE: lLabelID = ud.last_camsprite; break; - case USERDEFS_LAST_LEVEL: lLabelID = ud.last_level; break; - case USERDEFS_SECRETLEVEL: lLabelID = ud.secretlevel; break; - case USERDEFS_CONST_VISIBILITY: lLabelID = ud.const_visibility; break; - case USERDEFS_UW_FRAMERATE: lLabelID = ud.uw_framerate; break; - case USERDEFS_CAMERA_TIME: lLabelID = ud.camera_time; break; - case USERDEFS_FOLFVEL: lLabelID = ud.folfvel; break; - case USERDEFS_FOLAVEL: lLabelID = ud.folavel; break; - case USERDEFS_FOLX: lLabelID = ud.folx; break; - case USERDEFS_FOLY: lLabelID = ud.foly; break; - case USERDEFS_FOLA: lLabelID = ud.fola; break; - case USERDEFS_RECCNT: lLabelID = ud.reccnt; break; - case USERDEFS_ENTERED_NAME: lLabelID = ud.entered_name; break; - case USERDEFS_SCREEN_TILTING: lLabelID = ud.screen_tilting; break; - case USERDEFS_SHADOWS: lLabelID = ud.shadows; break; - case USERDEFS_FTA_ON: lLabelID = ud.fta_on; break; - case USERDEFS_EXECUTIONS: lLabelID = ud.executions; break; - case USERDEFS_AUTO_RUN: lLabelID = ud.auto_run; break; - case USERDEFS_COORDS: lLabelID = ud.coords; break; - case USERDEFS_TICKRATE: lLabelID = ud.tickrate; break; - case USERDEFS_M_COOP: lLabelID = ud.m_coop; break; - case USERDEFS_COOP: lLabelID = ud.coop; break; - case USERDEFS_SCREEN_SIZE: lLabelID = ud.screen_size; break; - case USERDEFS_LOCKOUT: lLabelID = ud.lockout; break; - case USERDEFS_CROSSHAIR: lLabelID = ud.crosshair; break; - case USERDEFS_PLAYERAI: lLabelID = ud.playerai; break; - case USERDEFS_RESPAWN_MONSTERS: lLabelID = ud.respawn_monsters; break; - case USERDEFS_RESPAWN_ITEMS: lLabelID = ud.respawn_items; break; - case USERDEFS_RESPAWN_INVENTORY: lLabelID = ud.respawn_inventory; break; - case USERDEFS_RECSTAT: lLabelID = ud.recstat; break; - case USERDEFS_MONSTERS_OFF: lLabelID = ud.monsters_off; break; - case USERDEFS_BRIGHTNESS: lLabelID = ud.brightness; break; - case USERDEFS_M_RESPAWN_ITEMS: lLabelID = ud.m_respawn_items; break; - case USERDEFS_M_RESPAWN_MONSTERS: lLabelID = ud.m_respawn_monsters; break; - case USERDEFS_M_RESPAWN_INVENTORY: lLabelID = ud.m_respawn_inventory; break; - case USERDEFS_M_RECSTAT: lLabelID = ud.m_recstat; break; - case USERDEFS_M_MONSTERS_OFF: lLabelID = ud.m_monsters_off; break; - case USERDEFS_DETAIL: lLabelID = ud.detail; break; - case USERDEFS_M_FFIRE: lLabelID = ud.m_ffire; break; - case USERDEFS_FFIRE: lLabelID = ud.ffire; break; - case USERDEFS_M_PLAYER_SKILL: lLabelID = ud.m_player_skill; break; - case USERDEFS_M_LEVEL_NUMBER: lLabelID = ud.m_level_number; break; - case USERDEFS_M_VOLUME_NUMBER: lLabelID = ud.m_volume_number; break; - case USERDEFS_MULTIMODE: lLabelID = ud.multimode; break; - case USERDEFS_PLAYER_SKILL: lLabelID = ud.player_skill; break; - case USERDEFS_LEVEL_NUMBER: lLabelID = ud.level_number; break; - case USERDEFS_VOLUME_NUMBER: lLabelID = ud.volume_number; break; - case USERDEFS_M_MARKER: lLabelID = ud.m_marker; break; - case USERDEFS_MARKER: lLabelID = ud.marker; break; - case USERDEFS_MOUSEFLIP: lLabelID = ud.mouseflip; break; - case USERDEFS_STATUSBARSCALE: lLabelID = ud.statusbarscale; break; - case USERDEFS_DRAWWEAPON: lLabelID = ud.drawweapon; break; - case USERDEFS_MOUSEAIMING: lLabelID = ud.mouseaiming; break; - case USERDEFS_WEAPONSWITCH: lLabelID = ud.weaponswitch; break; - case USERDEFS_DEMOCAMS: lLabelID = ud.democams; break; - case USERDEFS_COLOR: lLabelID = ud.color; break; - case USERDEFS_MSGDISPTIME: lLabelID = ud.msgdisptime; break; - case USERDEFS_STATUSBARMODE: lLabelID = ud.statusbarmode; break; - case USERDEFS_M_NOEXITS: lLabelID = ud.m_noexits; break; - case USERDEFS_NOEXITS: lLabelID = ud.noexits; break; - case USERDEFS_AUTOVOTE: lLabelID = ud.autovote; break; - case USERDEFS_AUTOMSG: lLabelID = ud.automsg; break; - case USERDEFS_IDPLAYERS: lLabelID = ud.idplayers; break; - case USERDEFS_TEAM: lLabelID = ud.team; break; - case USERDEFS_VIEWBOB: lLabelID = ud.viewbob; break; - case USERDEFS_WEAPONSWAY: lLabelID = ud.weaponsway; break; - case USERDEFS_ANGLEINTERPOLATION: lLabelID = ud.angleinterpolation; break; - case USERDEFS_OBITUARIES: lLabelID = ud.obituaries; break; - case USERDEFS_LEVELSTATS: lLabelID = ud.levelstats; break; - case USERDEFS_CROSSHAIRSCALE: lLabelID = ud.crosshairscale; break; - case USERDEFS_ALTHUD: lLabelID = ud.althud; break; - case USERDEFS_DISPLAY_BONUS_SCREEN: lLabelID = ud.display_bonus_screen; break; - case USERDEFS_SHOW_LEVEL_TEXT: lLabelID = ud.show_level_text; break; - case USERDEFS_WEAPONSCALE: lLabelID = ud.weaponscale; break; - case USERDEFS_TEXTSCALE: lLabelID = ud.textscale; break; - case USERDEFS_RUNKEY_MODE: lLabelID = ud.runkey_mode; break; - case USERDEFS_M_ORIGIN_X: lLabelID = ud.m_origin.x; break; - case USERDEFS_M_ORIGIN_Y: lLabelID = ud.m_origin.y; break; - case USERDEFS_PLAYERBEST: lLabelID = ud.playerbest; break; - case USERDEFS_MUSICTOGGLE: lLabelID = ud.config.MusicToggle; break; - case USERDEFS_USEVOXELS: lLabelID = usevoxels; break; - case USERDEFS_USEHIGHTILE: + case USERDEFS_GOD: lLabelID = ud.god; break; + case USERDEFS_WARP_ON: lLabelID = ud.warp_on; break; + case USERDEFS_CASHMAN: lLabelID = ud.cashman; break; + case USERDEFS_EOG: lLabelID = ud.eog; break; + case USERDEFS_SHOWALLMAP: lLabelID = ud.showallmap; break; + case USERDEFS_SHOW_HELP: lLabelID = ud.show_help; break; + case USERDEFS_SCROLLMODE: lLabelID = ud.scrollmode; break; + case USERDEFS_CLIPPING: lLabelID = ud.noclip; break; + // case USERDEFS_USER_NAME: lLabelID= ud.user_name[MAXPLAYERS][32]; break; + // case USERDEFS_RIDECULE: lLabelID= ud.ridecule; break; + // case USERDEFS_SAVEGAME: lLabelID= ud.savegame; break; + // case USERDEFS_PWLOCKOUT: lLabelID= ud.pwlockout; break; + // case USERDEFS_RTSNAME: lLabelID= ud.rtsname; break; + case USERDEFS_OVERHEAD_ON: lLabelID = ud.overhead_on; break; + case USERDEFS_LAST_OVERHEAD: lLabelID = ud.last_overhead; break; + case USERDEFS_SHOWWEAPONS: lLabelID = ud.showweapons; break; + case USERDEFS_PAUSE_ON: lLabelID = ud.pause_on; break; + case USERDEFS_FROM_BONUS: lLabelID = ud.from_bonus; break; + case USERDEFS_CAMERASPRITE: lLabelID = ud.camerasprite; break; + case USERDEFS_LAST_CAMSPRITE: lLabelID = ud.last_camsprite; break; + case USERDEFS_LAST_LEVEL: lLabelID = ud.last_level; break; + case USERDEFS_SECRETLEVEL: lLabelID = ud.secretlevel; break; + case USERDEFS_CONST_VISIBILITY: lLabelID = ud.const_visibility; break; + case USERDEFS_UW_FRAMERATE: lLabelID = ud.uw_framerate; break; + case USERDEFS_CAMERA_TIME: lLabelID = ud.camera_time; break; + case USERDEFS_FOLFVEL: lLabelID = ud.folfvel; break; + case USERDEFS_FOLAVEL: lLabelID = ud.folavel; break; + case USERDEFS_FOLX: lLabelID = ud.folx; break; + case USERDEFS_FOLY: lLabelID = ud.foly; break; + case USERDEFS_FOLA: lLabelID = ud.fola; break; + case USERDEFS_RECCNT: lLabelID = ud.reccnt; break; + case USERDEFS_ENTERED_NAME: lLabelID = ud.entered_name; break; + case USERDEFS_SCREEN_TILTING: lLabelID = ud.screen_tilting; break; + case USERDEFS_SHADOWS: lLabelID = ud.shadows; break; + case USERDEFS_FTA_ON: lLabelID = ud.fta_on; break; + case USERDEFS_EXECUTIONS: lLabelID = ud.executions; break; + case USERDEFS_AUTO_RUN: lLabelID = ud.auto_run; break; + case USERDEFS_COORDS: lLabelID = ud.coords; break; + case USERDEFS_TICKRATE: lLabelID = ud.tickrate; break; + case USERDEFS_M_COOP: lLabelID = ud.m_coop; break; + case USERDEFS_COOP: lLabelID = ud.coop; break; + case USERDEFS_SCREEN_SIZE: lLabelID = ud.screen_size; break; + case USERDEFS_LOCKOUT: lLabelID = ud.lockout; break; + case USERDEFS_CROSSHAIR: lLabelID = ud.crosshair; break; + case USERDEFS_PLAYERAI: lLabelID = ud.playerai; break; + case USERDEFS_RESPAWN_MONSTERS: lLabelID = ud.respawn_monsters; break; + case USERDEFS_RESPAWN_ITEMS: lLabelID = ud.respawn_items; break; + case USERDEFS_RESPAWN_INVENTORY: lLabelID = ud.respawn_inventory; break; + case USERDEFS_RECSTAT: lLabelID = ud.recstat; break; + case USERDEFS_MONSTERS_OFF: lLabelID = ud.monsters_off; break; + case USERDEFS_BRIGHTNESS: lLabelID = ud.brightness; break; + case USERDEFS_M_RESPAWN_ITEMS: lLabelID = ud.m_respawn_items; break; + case USERDEFS_M_RESPAWN_MONSTERS: lLabelID = ud.m_respawn_monsters; break; + case USERDEFS_M_RESPAWN_INVENTORY: lLabelID = ud.m_respawn_inventory; break; + case USERDEFS_M_RECSTAT: lLabelID = ud.m_recstat; break; + case USERDEFS_M_MONSTERS_OFF: lLabelID = ud.m_monsters_off; break; + case USERDEFS_DETAIL: lLabelID = ud.detail; break; + case USERDEFS_M_FFIRE: lLabelID = ud.m_ffire; break; + case USERDEFS_FFIRE: lLabelID = ud.ffire; break; + case USERDEFS_M_PLAYER_SKILL: lLabelID = ud.m_player_skill; break; + case USERDEFS_M_LEVEL_NUMBER: lLabelID = ud.m_level_number; break; + case USERDEFS_M_VOLUME_NUMBER: lLabelID = ud.m_volume_number; break; + case USERDEFS_MULTIMODE: lLabelID = ud.multimode; break; + case USERDEFS_PLAYER_SKILL: lLabelID = ud.player_skill; break; + case USERDEFS_LEVEL_NUMBER: lLabelID = ud.level_number; break; + case USERDEFS_VOLUME_NUMBER: lLabelID = ud.volume_number; break; + case USERDEFS_M_MARKER: lLabelID = ud.m_marker; break; + case USERDEFS_MARKER: lLabelID = ud.marker; break; + case USERDEFS_MOUSEFLIP: lLabelID = ud.mouseflip; break; + case USERDEFS_STATUSBARSCALE: lLabelID = ud.statusbarscale; break; + case USERDEFS_DRAWWEAPON: lLabelID = ud.drawweapon; break; + case USERDEFS_MOUSEAIMING: lLabelID = ud.mouseaiming; break; + case USERDEFS_WEAPONSWITCH: lLabelID = ud.weaponswitch; break; + case USERDEFS_DEMOCAMS: lLabelID = ud.democams; break; + case USERDEFS_COLOR: lLabelID = ud.color; break; + case USERDEFS_MSGDISPTIME: lLabelID = ud.msgdisptime; break; + case USERDEFS_STATUSBARMODE: lLabelID = ud.statusbarmode; break; + case USERDEFS_M_NOEXITS: lLabelID = ud.m_noexits; break; + case USERDEFS_NOEXITS: lLabelID = ud.noexits; break; + case USERDEFS_AUTOVOTE: lLabelID = ud.autovote; break; + case USERDEFS_AUTOMSG: lLabelID = ud.automsg; break; + case USERDEFS_IDPLAYERS: lLabelID = ud.idplayers; break; + case USERDEFS_TEAM: lLabelID = ud.team; break; + case USERDEFS_VIEWBOB: lLabelID = ud.viewbob; break; + case USERDEFS_WEAPONSWAY: lLabelID = ud.weaponsway; break; + case USERDEFS_ANGLEINTERPOLATION: lLabelID = ud.angleinterpolation; break; + case USERDEFS_OBITUARIES: lLabelID = ud.obituaries; break; + case USERDEFS_LEVELSTATS: lLabelID = ud.levelstats; break; + case USERDEFS_CROSSHAIRSCALE: lLabelID = ud.crosshairscale; break; + case USERDEFS_ALTHUD: lLabelID = ud.althud; break; + case USERDEFS_DISPLAY_BONUS_SCREEN: lLabelID = ud.display_bonus_screen; break; + case USERDEFS_SHOW_LEVEL_TEXT: lLabelID = ud.show_level_text; break; + case USERDEFS_WEAPONSCALE: lLabelID = ud.weaponscale; break; + case USERDEFS_TEXTSCALE: lLabelID = ud.textscale; break; + case USERDEFS_RUNKEY_MODE: lLabelID = ud.runkey_mode; break; + case USERDEFS_M_ORIGIN_X: lLabelID = ud.m_origin.x; break; + case USERDEFS_M_ORIGIN_Y: lLabelID = ud.m_origin.y; break; + case USERDEFS_PLAYERBEST: lLabelID = ud.playerbest; break; + case USERDEFS_MUSICTOGGLE: lLabelID = ud.config.MusicToggle; break; + case USERDEFS_USEVOXELS: lLabelID = usevoxels; break; + case USERDEFS_USEHIGHTILE: #ifdef USE_OPENGL - lLabelID = usehightile; - break; + lLabelID = usehightile; + break; #endif - case USERDEFS_USEMODELS: + case USERDEFS_USEMODELS: #ifdef USE_OPENGL - lLabelID = usemodels; + lLabelID = usemodels; #else - lLabelID = 0; -#endif - break; - case USERDEFS_GAMETYPEFLAGS: lLabelID = GametypeFlags[ud.coop]; break; - case USERDEFS_M_GAMETYPEFLAGS: lLabelID = GametypeFlags[ud.m_coop]; break; - default: lLabelID = -1; break; - } - Gv_SetVarX(lVar2, lLabelID); - } -} - -static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2) -{ - register int32_t const proj = (lVar1 != g_iThisActorID) ? Gv_GetVarX(lVar1) : vm.g_i; - - // http://forums.duke4.net/topic/775-eduke32-20-and-polymer/page__view__findpost__p__143260 - - if (EDUKE32_PREDICT_FALSE((unsigned)proj >= MAXSPRITES)) - { - // OSD_Printf("VM_AccessActiveProjectile(): invalid projectile (%d)\n",proj); - CON_ERRPRINTF("tried to %s %s on invalid target projectile (%d) %d %d from %s\n", - iSet?"set":"get",ProjectileLabels[lLabelID].name,proj,vm.g_i,TrackerCast(vm.g_sp->picnum), - (lVar1= (unsigned)playerswhenstarted)) - goto badplayer; - - if (EDUKE32_PREDICT_FALSE(PlayerLabels[lLabelID].flags & LABEL_HASPARM2 && - ((unsigned)lParm2 >= (unsigned)PlayerLabels[lLabelID].maxParm2))) - goto badpos; - - switch (lLabelID) - { - case PLAYER_ZOOM: lLabelID = ps->zoom; break; - case PLAYER_EXITX: lLabelID = ps->exitx; break; - case PLAYER_EXITY: lLabelID = ps->exity; break; - case PLAYER_LOOGIEX: lLabelID = ps->loogiex[lParm2]; break; - case PLAYER_LOOGIEY: lLabelID = ps->loogiey[lParm2]; break; - case PLAYER_NUMLOOGS: lLabelID = ps->numloogs; break; - case PLAYER_LOOGCNT: lLabelID = ps->loogcnt; break; - case PLAYER_POSX: lLabelID = ps->pos.x; break; - case PLAYER_POSY: lLabelID = ps->pos.y; break; - case PLAYER_POSZ: lLabelID = ps->pos.z; break; - case PLAYER_HORIZ: lLabelID = ps->horiz; break; - case PLAYER_OHORIZ: lLabelID = ps->ohoriz; break; - case PLAYER_OHORIZOFF: lLabelID = ps->ohorizoff; break; - case PLAYER_INVDISPTIME: lLabelID = ps->invdisptime; break; - case PLAYER_BOBPOSX: lLabelID = ps->bobpos.x; break; - case PLAYER_BOBPOSY: lLabelID = ps->bobpos.y; break; - case PLAYER_OPOSX: lLabelID = ps->opos.x; break; - case PLAYER_OPOSY: lLabelID = ps->opos.y; break; - case PLAYER_OPOSZ: lLabelID = ps->opos.z; break; - case PLAYER_PYOFF: lLabelID = ps->pyoff; break; - case PLAYER_OPYOFF: lLabelID = ps->opyoff; break; - case PLAYER_POSXV: lLabelID = ps->vel.x; break; - case PLAYER_POSYV: lLabelID = ps->vel.y; break; - case PLAYER_POSZV: lLabelID = ps->vel.z; break; - case PLAYER_LAST_PISSED_TIME: lLabelID = ps->last_pissed_time; break; - case PLAYER_TRUEFZ: lLabelID = ps->truefz; break; - case PLAYER_TRUECZ: lLabelID = ps->truecz; break; - case PLAYER_PLAYER_PAR: lLabelID = ps->player_par; break; - case PLAYER_VISIBILITY: lLabelID = ps->visibility; break; - case PLAYER_BOBCOUNTER: lLabelID = ps->bobcounter; break; - case PLAYER_WEAPON_SWAY: lLabelID = ps->weapon_sway; break; - case PLAYER_PALS_TIME: lLabelID = ps->pals.f; break; - case PLAYER_RANDOMFLAMEX: lLabelID = ps->randomflamex; break; - case PLAYER_CRACK_TIME: lLabelID = ps->crack_time; break; - case PLAYER_AIM_MODE: lLabelID = ps->aim_mode; break; - case PLAYER_ANG: lLabelID = ps->ang; break; - case PLAYER_OANG: lLabelID = ps->oang; break; - case PLAYER_ANGVEL: lLabelID = ps->angvel; break; - case PLAYER_CURSECTNUM: lLabelID = ps->cursectnum; break; - case PLAYER_LOOK_ANG: lLabelID = ps->look_ang; break; - case PLAYER_LAST_EXTRA: lLabelID = ps->last_extra; break; - case PLAYER_SUBWEAPON: lLabelID = ps->subweapon; break; - case PLAYER_AMMO_AMOUNT: lLabelID = ps->ammo_amount[lParm2]; break; - case PLAYER_WACKEDBYACTOR: lLabelID = ps->wackedbyactor; break; - case PLAYER_FRAG: lLabelID = ps->frag; break; - case PLAYER_FRAGGEDSELF: lLabelID = ps->fraggedself; break; - case PLAYER_CURR_WEAPON: lLabelID = ps->curr_weapon; break; - case PLAYER_LAST_WEAPON: lLabelID = ps->last_weapon; break; - case PLAYER_TIPINCS: lLabelID = ps->tipincs; break; - case PLAYER_HORIZOFF: lLabelID = ps->horizoff; break; - case PLAYER_WANTWEAPONFIRE: lLabelID = ps->wantweaponfire; break; - case PLAYER_HOLODUKE_AMOUNT: lLabelID = ps->inv_amount[GET_HOLODUKE]; break; - case PLAYER_NEWOWNER: lLabelID = ps->newowner; break; - case PLAYER_HURT_DELAY: lLabelID = ps->hurt_delay; break; - case PLAYER_HBOMB_HOLD_DELAY: lLabelID = ps->hbomb_hold_delay; break; - case PLAYER_JUMPING_COUNTER: lLabelID = ps->jumping_counter; break; - case PLAYER_AIRLEFT: lLabelID = ps->airleft; break; - case PLAYER_KNEE_INCS: lLabelID = ps->knee_incs; break; - case PLAYER_ACCESS_INCS: lLabelID = ps->access_incs; break; - case PLAYER_FTA: lLabelID = ps->fta; break; - case PLAYER_FTQ: lLabelID = ps->ftq; break; - case PLAYER_ACCESS_WALLNUM: lLabelID = ps->access_wallnum; break; - case PLAYER_ACCESS_SPRITENUM: lLabelID = ps->access_spritenum; break; - case PLAYER_KICKBACK_PIC: lLabelID = ps->kickback_pic; break; - case PLAYER_GOT_ACCESS: lLabelID = ps->got_access; break; - case PLAYER_WEAPON_ANG: lLabelID = ps->weapon_ang; break; - case PLAYER_FIRSTAID_AMOUNT: lLabelID = ps->inv_amount[GET_FIRSTAID]; break; - case PLAYER_SOMETHINGONPLAYER: lLabelID = ps->somethingonplayer; break; - case PLAYER_ON_CRANE: lLabelID = ps->on_crane; break; - case PLAYER_I: lLabelID = ps->i; break; - case PLAYER_ONE_PARALLAX_SECTNUM: lLabelID = ps->one_parallax_sectnum; break; - case PLAYER_OVER_SHOULDER_ON: lLabelID = ps->over_shoulder_on; break; - case PLAYER_RANDOM_CLUB_FRAME: lLabelID = ps->random_club_frame; break; - case PLAYER_FIST_INCS: lLabelID = ps->fist_incs; break; - case PLAYER_ONE_EIGHTY_COUNT: lLabelID = ps->one_eighty_count; break; - case PLAYER_CHEAT_PHASE: lLabelID = ps->cheat_phase; break; - case PLAYER_DUMMYPLAYERSPRITE: lLabelID = ps->dummyplayersprite; break; - case PLAYER_EXTRA_EXTRA8: lLabelID = ps->extra_extra8; break; - case PLAYER_QUICK_KICK: lLabelID = ps->quick_kick; break; - case PLAYER_HEAT_AMOUNT: lLabelID = ps->inv_amount[GET_HEATS]; break; - case PLAYER_ACTORSQU: lLabelID = ps->actorsqu; break; - case PLAYER_TIMEBEFOREEXIT: lLabelID = ps->timebeforeexit; break; - case PLAYER_CUSTOMEXITSOUND: lLabelID = ps->customexitsound; break; - case PLAYER_WEAPRECS: lLabelID = ps->weaprecs[lParm2]; break; - case PLAYER_WEAPRECCNT: lLabelID = ps->weapreccnt; break; - case PLAYER_INTERFACE_TOGGLE_FLAG: lLabelID = ps->interface_toggle_flag; break; - case PLAYER_ROTSCRNANG: lLabelID = ps->rotscrnang; break; - case PLAYER_DEAD_FLAG: lLabelID = ps->dead_flag; break; - case PLAYER_SHOW_EMPTY_WEAPON: lLabelID = ps->show_empty_weapon; break; - case PLAYER_SCUBA_AMOUNT: lLabelID = ps->inv_amount[GET_SCUBA]; break; - case PLAYER_JETPACK_AMOUNT: lLabelID = ps->inv_amount[GET_JETPACK]; break; - case PLAYER_STEROIDS_AMOUNT: lLabelID = ps->inv_amount[GET_STEROIDS]; break; - case PLAYER_SHIELD_AMOUNT: lLabelID = ps->inv_amount[GET_SHIELD]; break; - case PLAYER_HOLODUKE_ON: lLabelID = ps->holoduke_on; break; - case PLAYER_PYCOUNT: lLabelID = ps->pycount; break; - case PLAYER_WEAPON_POS: lLabelID = ps->weapon_pos; break; - case PLAYER_FRAG_PS: lLabelID = ps->frag_ps; break; - case PLAYER_TRANSPORTER_HOLD: lLabelID = ps->transporter_hold; break; - case PLAYER_LAST_FULL_WEAPON: lLabelID = ps->last_full_weapon; break; - case PLAYER_FOOTPRINTSHADE: lLabelID = ps->footprintshade; break; - case PLAYER_BOOT_AMOUNT: lLabelID = ps->inv_amount[GET_BOOTS]; break; - case PLAYER_SCREAM_VOICE: lLabelID = ps->scream_voice; break; - case PLAYER_GM: lLabelID = ps->gm; break; - case PLAYER_ON_WARPING_SECTOR: lLabelID = ps->on_warping_sector; break; - case PLAYER_FOOTPRINTCOUNT: lLabelID = ps->footprintcount; break; - case PLAYER_HBOMB_ON: lLabelID = ps->hbomb_on; break; - case PLAYER_JUMPING_TOGGLE: lLabelID = ps->jumping_toggle; break; - case PLAYER_RAPID_FIRE_HOLD: lLabelID = ps->rapid_fire_hold; break; - case PLAYER_ON_GROUND: lLabelID = ps->on_ground; break; - case PLAYER_INVEN_ICON: lLabelID = ps->inven_icon; break; - case PLAYER_BUTTONPALETTE: lLabelID = ps->buttonpalette; break; - case PLAYER_JETPACK_ON: lLabelID = ps->jetpack_on; break; - case PLAYER_SPRITEBRIDGE: lLabelID = ps->spritebridge; break; - case PLAYER_LASTRANDOMSPOT: lLabelID = ps->lastrandomspot; break; - case PLAYER_SCUBA_ON: lLabelID = ps->scuba_on; break; - case PLAYER_FOOTPRINTPAL: lLabelID = ps->footprintpal; break; - case PLAYER_HEAT_ON: lLabelID = ps->heat_on; break; - case PLAYER_HOLSTER_WEAPON: lLabelID = ps->holster_weapon; break; - case PLAYER_FALLING_COUNTER: lLabelID = ps->falling_counter; break; - case PLAYER_GOTWEAPON: lLabelID = (ps->gotweapon & (1 << lParm2)) != 0; break; - case PLAYER_REFRESH_INVENTORY: lLabelID = ps->refresh_inventory; break; - case PLAYER_PALETTE: lLabelID = ps->palette; break; - case PLAYER_TOGGLE_KEY_FLAG: lLabelID = ps->toggle_key_flag; break; - case PLAYER_KNUCKLE_INCS: lLabelID = ps->knuckle_incs; break; - case PLAYER_WALKING_SND_TOGGLE: lLabelID = ps->walking_snd_toggle; break; - case PLAYER_PALOOKUP: lLabelID = ps->palookup; break; - case PLAYER_HARD_LANDING: lLabelID = ps->hard_landing; break; - case PLAYER_MAX_SECRET_ROOMS: lLabelID = ps->max_secret_rooms; break; - case PLAYER_SECRET_ROOMS: lLabelID = ps->secret_rooms; break; - case PLAYER_PALS: - switch (lParm2) - { - case 0: lLabelID = ps->pals.r; break; - case 1: lLabelID = ps->pals.g; break; - case 2: lLabelID = ps->pals.b; break; - } - break; - case PLAYER_MAX_ACTORS_KILLED: lLabelID = ps->max_actors_killed; break; - case PLAYER_ACTORS_KILLED: lLabelID = ps->actors_killed; break; - case PLAYER_RETURN_TO_CENTER: lLabelID = ps->return_to_center; break; - case PLAYER_RUNSPEED: lLabelID = ps->runspeed; break; - case PLAYER_SBS: lLabelID = ps->sbs; break; - case PLAYER_RELOADING: lLabelID = ps->reloading; break; - case PLAYER_AUTO_AIM: lLabelID = ps->auto_aim; break; - case PLAYER_MOVEMENT_LOCK: lLabelID = ps->movement_lock; break; - case PLAYER_SOUND_PITCH: lLabelID = ps->sound_pitch; break; - case PLAYER_WEAPONSWITCH: lLabelID = ps->weaponswitch; break; - case PLAYER_TEAM: lLabelID = ps->team; break; - case PLAYER_MAX_PLAYER_HEALTH: lLabelID = ps->max_player_health; break; - case PLAYER_MAX_SHIELD_AMOUNT: lLabelID = ps->max_shield_amount; break; - case PLAYER_MAX_AMMO_AMOUNT: lLabelID = ps->max_ammo_amount[lParm2]; break; - case PLAYER_LAST_QUICK_KICK: lLabelID = ps->last_quick_kick; break; - case PLAYER_AUTOSTEP: lLabelID = ps->autostep; break; - case PLAYER_AUTOSTEP_SBW: lLabelID = ps->autostep_sbw; break; - default: lLabelID = -1; break; - } - - Gv_SetVarX(lVar2, lLabelID); - return; - -badplayer: - // OSD_Printf("VM_AccessPlayer(): invalid target player (%d) %d\n",iPlayer,vm.g_i); - CON_ERRPRINTF("tried to get %s on invalid target player (%d) from spr %d gv %s\n", - PlayerLabels[lLabelID].name,iPlayer,vm.g_i, - (lVar1= (unsigned)playerswhenstarted)) - goto badplayer; - - if (EDUKE32_PREDICT_FALSE(PlayerLabels[lLabelID].flags & LABEL_HASPARM2 && - (unsigned)lParm2 >= (unsigned)PlayerLabels[lLabelID].maxParm2)) - goto badpos; - - lVar1 = Gv_GetVarX(lVar2); - - switch (lLabelID) - { - case PLAYER_ZOOM: ps->zoom = lVar1; break; - case PLAYER_EXITX: ps->exitx = lVar1; break; - case PLAYER_EXITY: ps->exity = lVar1; break; - case PLAYER_LOOGIEX: ps->loogiex[lParm2] = lVar1; break; - case PLAYER_LOOGIEY: ps->loogiey[lParm2] = lVar1; break; - case PLAYER_NUMLOOGS: ps->numloogs = lVar1; break; - case PLAYER_LOOGCNT: ps->loogcnt = lVar1; break; - case PLAYER_POSX: ps->pos.x = lVar1; break; - case PLAYER_POSY: ps->pos.y = lVar1; break; - case PLAYER_POSZ: ps->pos.z = lVar1; break; - case PLAYER_HORIZ: ps->horiz = lVar1; break; - case PLAYER_OHORIZ: ps->ohoriz = lVar1; break; - case PLAYER_OHORIZOFF: ps->ohorizoff = lVar1; break; - case PLAYER_INVDISPTIME: ps->invdisptime = lVar1; break; - case PLAYER_BOBPOSX: ps->bobpos.x = lVar1; break; - case PLAYER_BOBPOSY: ps->bobpos.y = lVar1; break; - case PLAYER_OPOSX: ps->opos.x = lVar1; break; - case PLAYER_OPOSY: ps->opos.y = lVar1; break; - case PLAYER_OPOSZ: ps->opos.z = lVar1; break; - case PLAYER_PYOFF: ps->pyoff = lVar1; break; - case PLAYER_OPYOFF: ps->opyoff = lVar1; break; - case PLAYER_POSXV: ps->vel.x = lVar1; break; - case PLAYER_POSYV: ps->vel.y = lVar1; break; - case PLAYER_POSZV: ps->vel.z = lVar1; break; - case PLAYER_LAST_PISSED_TIME: ps->last_pissed_time = lVar1; break; - case PLAYER_TRUEFZ: ps->truefz = lVar1; break; - case PLAYER_TRUECZ: ps->truecz = lVar1; break; - case PLAYER_PLAYER_PAR: ps->player_par = lVar1; break; - case PLAYER_VISIBILITY: ps->visibility = lVar1; break; - case PLAYER_BOBCOUNTER: ps->bobcounter = lVar1; break; - case PLAYER_WEAPON_SWAY: ps->weapon_sway = lVar1; break; - case PLAYER_PALS_TIME: ps->pals.f = lVar1; break; - case PLAYER_RANDOMFLAMEX: ps->randomflamex = lVar1; break; - case PLAYER_CRACK_TIME: ps->crack_time = lVar1; break; - case PLAYER_AIM_MODE: ps->aim_mode = lVar1; break; - case PLAYER_ANG: ps->ang = lVar1; break; - case PLAYER_OANG: ps->oang = lVar1; break; - case PLAYER_ANGVEL: ps->angvel = lVar1; break; - case PLAYER_CURSECTNUM: ps->cursectnum = lVar1; break; - case PLAYER_LOOK_ANG: ps->look_ang = lVar1; break; - case PLAYER_LAST_EXTRA: ps->last_extra = lVar1; break; - case PLAYER_SUBWEAPON: ps->subweapon = lVar1; break; - case PLAYER_AMMO_AMOUNT: ps->ammo_amount[lParm2] = lVar1; break; - case PLAYER_WACKEDBYACTOR: ps->wackedbyactor = lVar1; break; - case PLAYER_FRAG: ps->frag = lVar1; break; - case PLAYER_FRAGGEDSELF: ps->fraggedself = lVar1; break; - case PLAYER_CURR_WEAPON: ps->curr_weapon = lVar1; break; - case PLAYER_LAST_WEAPON: ps->last_weapon = lVar1; break; - case PLAYER_TIPINCS: ps->tipincs = lVar1; break; - case PLAYER_HORIZOFF: ps->horizoff = lVar1; break; - case PLAYER_WANTWEAPONFIRE: ps->wantweaponfire = lVar1; break; - case PLAYER_HOLODUKE_AMOUNT: ps->inv_amount[GET_HOLODUKE] = lVar1; break; - case PLAYER_NEWOWNER: ps->newowner = lVar1; break; - case PLAYER_HURT_DELAY: ps->hurt_delay = lVar1; break; - case PLAYER_HBOMB_HOLD_DELAY: ps->hbomb_hold_delay = lVar1; break; - case PLAYER_JUMPING_COUNTER: ps->jumping_counter = lVar1; break; - case PLAYER_AIRLEFT: ps->airleft = lVar1; break; - case PLAYER_KNEE_INCS: ps->knee_incs = lVar1; break; - case PLAYER_ACCESS_INCS: ps->access_incs = lVar1; break; - case PLAYER_FTA: ps->fta = lVar1; break; - case PLAYER_FTQ: ps->ftq = lVar1; break; - case PLAYER_ACCESS_WALLNUM: ps->access_wallnum = lVar1; break; - case PLAYER_ACCESS_SPRITENUM: ps->access_spritenum = lVar1; break; - case PLAYER_KICKBACK_PIC: ps->kickback_pic = lVar1; break; - case PLAYER_GOT_ACCESS: ps->got_access = lVar1; break; - case PLAYER_WEAPON_ANG: ps->weapon_ang = lVar1; break; - case PLAYER_FIRSTAID_AMOUNT: ps->inv_amount[GET_FIRSTAID] = lVar1; break; - case PLAYER_SOMETHINGONPLAYER: ps->somethingonplayer = lVar1; break; - case PLAYER_ON_CRANE: ps->on_crane = lVar1; break; - case PLAYER_I: ps->i = lVar1; break; - case PLAYER_ONE_PARALLAX_SECTNUM: ps->one_parallax_sectnum = lVar1; break; - case PLAYER_OVER_SHOULDER_ON: ps->over_shoulder_on = lVar1; break; - case PLAYER_RANDOM_CLUB_FRAME: ps->random_club_frame = lVar1; break; - case PLAYER_FIST_INCS: ps->fist_incs = lVar1; break; - case PLAYER_ONE_EIGHTY_COUNT: ps->one_eighty_count = lVar1; break; - case PLAYER_CHEAT_PHASE: ps->cheat_phase = lVar1; break; - case PLAYER_DUMMYPLAYERSPRITE: ps->dummyplayersprite = lVar1; break; - case PLAYER_EXTRA_EXTRA8: ps->extra_extra8 = lVar1; break; - case PLAYER_QUICK_KICK: ps->quick_kick = lVar1; break; - case PLAYER_HEAT_AMOUNT: ps->inv_amount[GET_HEATS] = lVar1; break; - case PLAYER_ACTORSQU: ps->actorsqu = lVar1; break; - case PLAYER_TIMEBEFOREEXIT: ps->timebeforeexit = lVar1; break; - case PLAYER_CUSTOMEXITSOUND: ps->customexitsound = lVar1; break; - case PLAYER_WEAPRECS: ps->weaprecs[lParm2] = lVar1; break; - case PLAYER_WEAPRECCNT: ps->weapreccnt = lVar1; break; - case PLAYER_INTERFACE_TOGGLE_FLAG: ps->interface_toggle_flag = lVar1; break; - case PLAYER_ROTSCRNANG: ps->rotscrnang = lVar1; break; - case PLAYER_DEAD_FLAG: ps->dead_flag = lVar1; break; - case PLAYER_SHOW_EMPTY_WEAPON: ps->show_empty_weapon = lVar1; break; - case PLAYER_SCUBA_AMOUNT: ps->inv_amount[GET_SCUBA] = lVar1; break; - case PLAYER_JETPACK_AMOUNT: ps->inv_amount[GET_JETPACK] = lVar1; break; - case PLAYER_STEROIDS_AMOUNT: ps->inv_amount[GET_STEROIDS] = lVar1; break; - case PLAYER_SHIELD_AMOUNT: ps->inv_amount[GET_SHIELD] = lVar1; break; - case PLAYER_HOLODUKE_ON: ps->holoduke_on = lVar1; break; - case PLAYER_PYCOUNT: ps->pycount = lVar1; break; - case PLAYER_WEAPON_POS: ps->weapon_pos = lVar1; break; - case PLAYER_FRAG_PS: ps->frag_ps = lVar1; break; - case PLAYER_TRANSPORTER_HOLD: ps->transporter_hold = lVar1; break; - case PLAYER_LAST_FULL_WEAPON: ps->last_full_weapon = lVar1; break; - case PLAYER_FOOTPRINTSHADE: ps->footprintshade = lVar1; break; - case PLAYER_BOOT_AMOUNT: ps->inv_amount[GET_BOOTS] = lVar1; break; - case PLAYER_SCREAM_VOICE: ps->scream_voice = lVar1; break; - case PLAYER_GM: - if (!(ps->gm & MODE_MENU) && (lVar1 & MODE_MENU)) - M_OpenMenu(iPlayer); - else if ((ps->gm & MODE_MENU) && !(lVar1 & MODE_MENU)) - M_CloseMenu(iPlayer); - ps->gm = lVar1; - break; - case PLAYER_ON_WARPING_SECTOR: ps->on_warping_sector = lVar1; break; - case PLAYER_FOOTPRINTCOUNT: ps->footprintcount = lVar1; break; - case PLAYER_HBOMB_ON: ps->hbomb_on = lVar1; break; - case PLAYER_JUMPING_TOGGLE: ps->jumping_toggle = lVar1; break; - case PLAYER_RAPID_FIRE_HOLD: ps->rapid_fire_hold = lVar1; break; - case PLAYER_ON_GROUND: ps->on_ground = lVar1; break; - case PLAYER_INVEN_ICON: ps->inven_icon = lVar1; break; - case PLAYER_BUTTONPALETTE: ps->buttonpalette = lVar1; break; - case PLAYER_JETPACK_ON: ps->jetpack_on = lVar1; break; - case PLAYER_SPRITEBRIDGE: ps->spritebridge = lVar1; break; - case PLAYER_LASTRANDOMSPOT: ps->lastrandomspot = lVar1; break; - case PLAYER_SCUBA_ON: ps->scuba_on = lVar1; break; - case PLAYER_FOOTPRINTPAL: ps->footprintpal = lVar1; break; - case PLAYER_HEAT_ON: - if (ps->heat_on != lVar1) - { - ps->heat_on = lVar1; - P_UpdateScreenPal(ps); - } - break; - case PLAYER_HOLSTER_WEAPON: ps->holster_weapon = lVar1; break; - case PLAYER_FALLING_COUNTER: ps->falling_counter = lVar1; break; - case PLAYER_GOTWEAPON: - if (lVar1) ps->gotweapon |= (1 << lParm2); - else ps->gotweapon &= ~(1 << lParm2); - break; - case PLAYER_REFRESH_INVENTORY: ps->refresh_inventory = lVar1; break; - case PLAYER_PALETTE: P_SetGamePalette(ps, lVar1, 2+16); break; - case PLAYER_TOGGLE_KEY_FLAG: ps->toggle_key_flag = lVar1; break; - case PLAYER_KNUCKLE_INCS: ps->knuckle_incs = lVar1; break; - case PLAYER_WALKING_SND_TOGGLE: ps->walking_snd_toggle = lVar1; break; - case PLAYER_PALOOKUP: ps->palookup = lVar1; break; - case PLAYER_HARD_LANDING: ps->hard_landing = lVar1; break; - case PLAYER_MAX_SECRET_ROOMS: ps->max_secret_rooms = lVar1; break; - case PLAYER_SECRET_ROOMS: ps->secret_rooms = lVar1; break; - case PLAYER_PALS: - switch (lParm2) - { - case 0: ps->pals.r = lVar1; break; - case 1: ps->pals.g = lVar1; break; - case 2: ps->pals.b = lVar1; break; - } - break; - case PLAYER_MAX_ACTORS_KILLED: ps->max_actors_killed = lVar1; break; - case PLAYER_ACTORS_KILLED: ps->actors_killed = lVar1; break; - case PLAYER_RETURN_TO_CENTER: ps->return_to_center = lVar1; break; - case PLAYER_RUNSPEED: ps->runspeed = lVar1; break; - case PLAYER_SBS: ps->sbs = lVar1; break; - case PLAYER_RELOADING: ps->reloading = lVar1; break; - case PLAYER_AUTO_AIM: ps->auto_aim = lVar1; break; - case PLAYER_MOVEMENT_LOCK: ps->movement_lock = lVar1; break; - case PLAYER_SOUND_PITCH: ps->sound_pitch = lVar1; break; - case PLAYER_WEAPONSWITCH: ps->weaponswitch = lVar1; break; - case PLAYER_TEAM: ps->team = lVar1; break; - case PLAYER_MAX_PLAYER_HEALTH: ps->max_player_health = lVar1; break; - case PLAYER_MAX_SHIELD_AMOUNT: ps->max_shield_amount = lVar1; break; - case PLAYER_MAX_AMMO_AMOUNT: ps->max_ammo_amount[lParm2] = lVar1; break; - case PLAYER_LAST_QUICK_KICK: ps->last_quick_kick = lVar1; break; - case PLAYER_AUTOSTEP: ps->autostep = lVar1; break; - case PLAYER_AUTOSTEP_SBW: ps->autostep_sbw = lVar1; break; - default: break; - } - - return; - -badplayer: - // OSD_Printf("VM_AccessPlayer(): invalid target player (%d) %d\n",iPlayer,vm.g_i); - CON_ERRPRINTF("tried to set %s on invalid target player (%d) from spr %d gv %s\n", - PlayerLabels[lLabelID].name,iPlayer,vm.g_i, - (lVar1= (unsigned)playerswhenstarted)) - goto badplayer; - - if (iSet) - { - iSet=Gv_GetVarX(lVar2); - - switch (lLabelID) - { - case INPUT_AVEL: g_player[iPlayer].sync->avel = iSet; break; - case INPUT_HORZ: g_player[iPlayer].sync->horz = iSet; break; - case INPUT_FVEL: g_player[iPlayer].sync->fvel = iSet; break; - case INPUT_SVEL: g_player[iPlayer].sync->svel = iSet; break; - case INPUT_BITS: g_player[iPlayer].sync->bits = iSet; break; - case INPUT_EXTBITS: g_player[iPlayer].sync->extbits = iSet; break; - default: break; - } - } - else - { - switch (lLabelID) - { - case INPUT_AVEL: lLabelID = g_player[iPlayer].sync->avel; break; - case INPUT_HORZ: lLabelID = g_player[iPlayer].sync->horz; break; - case INPUT_FVEL: lLabelID = g_player[iPlayer].sync->fvel; break; - case INPUT_SVEL: lLabelID = g_player[iPlayer].sync->svel; break; - case INPUT_BITS: lLabelID = g_player[iPlayer].sync->bits; break; - case INPUT_EXTBITS: lLabelID = g_player[iPlayer].sync->extbits; break; - default: lLabelID = -1; break; - } - - Gv_SetVarX(lVar2, lLabelID); - } - - return; - -badplayer: - insptr += (lVar2 == MAXGAMEVARS); - CON_ERRPRINTF("invalid target player (%d) %d\n", iPlayer,vm.g_i); - return; -} - -static void __fastcall VM_AccessWall(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2) -{ - register int32_t const iWall = Gv_GetVarX(lVar1); - - if (EDUKE32_PREDICT_FALSE((unsigned)iWall >= (unsigned)numwalls)) - goto badwall; - - if (iSet) - { - iSet = Gv_GetVarX(lVar2); - - switch (lLabelID) - { - case WALL_X: wall[iWall].x = iSet; break; - case WALL_Y: wall[iWall].y = iSet; break; - case WALL_POINT2: wall[iWall].point2 = iSet; break; - case WALL_NEXTWALL: wall[iWall].nextwall = iSet; break; - case WALL_NEXTSECTOR: wall[iWall].nextsector = iSet; break; - case WALL_CSTAT: wall[iWall].cstat = iSet; break; - case WALL_PICNUM: wall[iWall].picnum = iSet; break; - case WALL_OVERPICNUM: wall[iWall].overpicnum = iSet; break; - case WALL_SHADE: wall[iWall].shade = iSet; break; - case WALL_PAL: wall[iWall].pal = iSet; break; - case WALL_XREPEAT: wall[iWall].xrepeat = iSet; break; - case WALL_YREPEAT: wall[iWall].yrepeat = iSet; break; - case WALL_XPANNING: wall[iWall].xpanning = iSet; break; - case WALL_YPANNING: wall[iWall].ypanning = iSet; break; - case WALL_LOTAG: wall[iWall].lotag = (int16_t)iSet; break; - case WALL_HITAG: wall[iWall].hitag = (int16_t)iSet; break; - case WALL_ULOTAG: wall[iWall].lotag = iSet; break; - case WALL_UHITAG: wall[iWall].hitag = iSet; break; - case WALL_EXTRA: wall[iWall].extra = iSet; break; - } - } - else - { - switch (lLabelID) - { - case WALL_X: lLabelID = wall[iWall].x; break; - case WALL_Y: lLabelID = wall[iWall].y; break; - case WALL_POINT2: lLabelID = wall[iWall].point2; break; - case WALL_NEXTWALL: lLabelID = wall[iWall].nextwall; break; - case WALL_NEXTSECTOR: lLabelID = wall[iWall].nextsector; break; - case WALL_CSTAT: lLabelID = wall[iWall].cstat; break; - case WALL_PICNUM: lLabelID = wall[iWall].picnum; break; - case WALL_OVERPICNUM: lLabelID = wall[iWall].overpicnum; break; - case WALL_SHADE: lLabelID = wall[iWall].shade; break; - case WALL_PAL: lLabelID = wall[iWall].pal; break; - case WALL_XREPEAT: lLabelID = wall[iWall].xrepeat; break; - case WALL_YREPEAT: lLabelID = wall[iWall].yrepeat; break; - case WALL_XPANNING: lLabelID = wall[iWall].xpanning; break; - case WALL_YPANNING: lLabelID = wall[iWall].ypanning; break; - case WALL_LOTAG: lLabelID = (int16_t) wall[iWall].lotag; break; - case WALL_HITAG: lLabelID = (int16_t) wall[iWall].hitag; break; - case WALL_ULOTAG: lLabelID = wall[iWall].lotag; break; - case WALL_UHITAG: lLabelID = wall[iWall].hitag; break; - case WALL_EXTRA: lLabelID = wall[iWall].extra; break; - } - - Gv_SetVarX(lVar2, lLabelID); - } - - return; - -badwall: - insptr += (lVar2 == MAXGAMEVARS); - CON_ERRPRINTF("Invalid wall %d\n", iWall); - return; -} - -static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2) -{ - register int32_t const iSector = (lVar1 != g_iThisActorID) ? Gv_GetVarX(lVar1) : sprite[vm.g_i].sectnum; - - if (EDUKE32_PREDICT_FALSE((unsigned)iSector >= (unsigned)numsectors)) - goto badsector; - - if (iSet) - { - iSet = Gv_GetVarX(lVar2); - - switch (lLabelID) - { - case SECTOR_WALLPTR: sector[iSector].wallptr = iSet; break; - case SECTOR_WALLNUM: sector[iSector].wallnum = iSet; break; - case SECTOR_CEILINGZ: sector[iSector].ceilingz = iSet; break; - case SECTOR_FLOORZ: sector[iSector].floorz = iSet; break; - case SECTOR_CEILINGSTAT: sector[iSector].ceilingstat = iSet; break; - case SECTOR_FLOORSTAT: sector[iSector].floorstat = iSet; break; - case SECTOR_CEILINGPICNUM: sector[iSector].ceilingpicnum = iSet; break; - case SECTOR_CEILINGSLOPE: sector[iSector].ceilingheinum = iSet; break; - case SECTOR_CEILINGSHADE: sector[iSector].ceilingshade = iSet; break; - case SECTOR_CEILINGPAL: sector[iSector].ceilingpal = iSet; break; - case SECTOR_CEILINGXPANNING: sector[iSector].ceilingxpanning = iSet; break; - case SECTOR_CEILINGYPANNING: sector[iSector].ceilingypanning = iSet; break; - case SECTOR_FLOORPICNUM: sector[iSector].floorpicnum = iSet; break; - case SECTOR_FLOORSLOPE: sector[iSector].floorheinum = iSet; break; - case SECTOR_FLOORSHADE: sector[iSector].floorshade = iSet; break; - case SECTOR_FLOORPAL: sector[iSector].floorpal = iSet; break; - case SECTOR_FLOORXPANNING: sector[iSector].floorxpanning = iSet; break; - case SECTOR_FLOORYPANNING: sector[iSector].floorypanning = iSet; break; - case SECTOR_VISIBILITY: sector[iSector].visibility = iSet; break; - case SECTOR_FOGPAL: sector[iSector].fogpal = iSet; break; - case SECTOR_LOTAG: sector[iSector].lotag = (int16_t)iSet; break; - case SECTOR_HITAG: sector[iSector].hitag = (int16_t)iSet; break; - case SECTOR_ULOTAG: sector[iSector].lotag = iSet; break; - case SECTOR_UHITAG: sector[iSector].hitag = iSet; break; - case SECTOR_EXTRA: sector[iSector].extra = iSet; break; - case SECTOR_CEILINGBUNCH: - case SECTOR_FLOORBUNCH: - default: break; - } - } - else - { - switch (lLabelID) - { - case SECTOR_WALLPTR: lLabelID = sector[iSector].wallptr; break; - case SECTOR_WALLNUM: lLabelID = sector[iSector].wallnum; break; - case SECTOR_CEILINGZ: lLabelID = sector[iSector].ceilingz; break; - case SECTOR_FLOORZ: lLabelID = sector[iSector].floorz; break; - case SECTOR_CEILINGSTAT: lLabelID = sector[iSector].ceilingstat; break; - case SECTOR_FLOORSTAT: lLabelID = sector[iSector].floorstat; break; - case SECTOR_CEILINGPICNUM: lLabelID = sector[iSector].ceilingpicnum; break; - case SECTOR_CEILINGSLOPE: lLabelID = sector[iSector].ceilingheinum; break; - case SECTOR_CEILINGSHADE: lLabelID = sector[iSector].ceilingshade; break; - case SECTOR_CEILINGPAL: lLabelID = sector[iSector].ceilingpal; break; - case SECTOR_CEILINGXPANNING: lLabelID = sector[iSector].ceilingxpanning; break; - case SECTOR_CEILINGYPANNING: lLabelID = sector[iSector].ceilingypanning; break; - case SECTOR_FLOORPICNUM: lLabelID = sector[iSector].floorpicnum; break; - case SECTOR_FLOORSLOPE: lLabelID = sector[iSector].floorheinum; break; - case SECTOR_FLOORSHADE: lLabelID = sector[iSector].floorshade; break; - case SECTOR_FLOORPAL: lLabelID = sector[iSector].floorpal; break; - case SECTOR_FLOORXPANNING: lLabelID = sector[iSector].floorxpanning; break; - case SECTOR_FLOORYPANNING: lLabelID = sector[iSector].floorypanning; break; - case SECTOR_VISIBILITY: lLabelID = sector[iSector].visibility; break; - case SECTOR_FOGPAL: lLabelID = sector[iSector].fogpal; break; - case SECTOR_LOTAG: lLabelID = (int16_t)sector[iSector].lotag; break; - case SECTOR_HITAG: lLabelID = (int16_t)sector[iSector].hitag; break; - case SECTOR_ULOTAG: lLabelID = sector[iSector].lotag; break; - case SECTOR_UHITAG: lLabelID = sector[iSector].hitag; break; - case SECTOR_EXTRA: lLabelID = sector[iSector].extra; break; - case SECTOR_CEILINGBUNCH: - case SECTOR_FLOORBUNCH: -#ifdef YAX_ENABLE - lLabelID = yax_getbunch(iSector, lLabelID == SECTOR_FLOORBUNCH); -#else - lLabelID = -1; -#endif - break; - default: lLabelID = -1; break; - } - - Gv_SetVarX(lVar2, lLabelID); - } - - return; - -badsector: - CON_ERRPRINTF("Invalid sector %d\n", iSector); - insptr += (lVar2 == MAXGAMEVARS); -} - -static void __fastcall VM_SetSprite(int32_t lVar1, int32_t lLabelID, int32_t lVar2, int32_t lParm2) -{ - register int32_t const iActor = (lVar1 != g_iThisActorID) ? Gv_GetVarX(lVar1) : vm.g_i; - - if (EDUKE32_PREDICT_FALSE((unsigned)iActor >= MAXSPRITES)) - goto badactor; - - if (EDUKE32_PREDICT_FALSE(ActorLabels[lLabelID].flags & LABEL_HASPARM2 && (unsigned)lParm2 >= (unsigned)ActorLabels[lLabelID].maxParm2)) - goto badpos; - - lVar1 = Gv_GetVarX(lVar2); - - switch (lLabelID) - { - case ACTOR_X: sprite[iActor].x = lVar1; break; - case ACTOR_Y: sprite[iActor].y = lVar1; break; - case ACTOR_Z: sprite[iActor].z = lVar1; break; - case ACTOR_CSTAT: sprite[iActor].cstat = lVar1; break; - case ACTOR_PICNUM: sprite[iActor].picnum = lVar1; break; - case ACTOR_SHADE: sprite[iActor].shade = lVar1; break; - case ACTOR_PAL: sprite[iActor].pal = lVar1; break; - case ACTOR_CLIPDIST: sprite[iActor].clipdist = lVar1; break; - case ACTOR_DETAIL: sprite[iActor].blend = lVar1; break; - case ACTOR_XREPEAT: sprite[iActor].xrepeat = lVar1; break; - case ACTOR_YREPEAT: sprite[iActor].yrepeat = lVar1; break; - case ACTOR_XOFFSET: sprite[iActor].xoffset = lVar1; break; - case ACTOR_YOFFSET: sprite[iActor].yoffset = lVar1; break; - case ACTOR_SECTNUM: changespritesect(iActor, lVar1); break; - case ACTOR_STATNUM: changespritestat(iActor, lVar1); break; - case ACTOR_ANG: sprite[iActor].ang = lVar1; break; - case ACTOR_OWNER: sprite[iActor].owner = lVar1; break; - case ACTOR_XVEL: sprite[iActor].xvel = lVar1; break; - case ACTOR_YVEL: sprite[iActor].yvel = lVar1; break; - case ACTOR_ZVEL: sprite[iActor].zvel = lVar1; break; - case ACTOR_LOTAG: sprite[iActor].lotag = (int16_t)lVar1; break; - case ACTOR_HITAG: sprite[iActor].hitag = (int16_t)lVar1; break; - case ACTOR_ULOTAG: sprite[iActor].lotag = lVar1; break; - case ACTOR_UHITAG: sprite[iActor].hitag = lVar1; break; - case ACTOR_EXTRA: sprite[iActor].extra = lVar1; break; - case ACTOR_HTCGG: actor[iActor].cgg = lVar1; break; - case ACTOR_HTPICNUM: actor[iActor].picnum = lVar1; break; - case ACTOR_HTANG: actor[iActor].ang = lVar1; break; - case ACTOR_HTEXTRA: actor[iActor].extra = lVar1; break; - case ACTOR_HTOWNER: actor[iActor].owner = lVar1; break; - case ACTOR_HTMOVFLAG: actor[iActor].movflag = lVar1; break; - case ACTOR_HTTEMPANG: actor[iActor].tempang = lVar1; break; - case ACTOR_HTACTORSTAYPUT: actor[iActor].actorstayput = lVar1; break; - case ACTOR_HTDISPICNUM: actor[iActor].dispicnum = lVar1; break; - case ACTOR_HTTIMETOSLEEP: actor[iActor].timetosleep = lVar1; break; - case ACTOR_HTFLOORZ: actor[iActor].floorz = lVar1; break; - case ACTOR_HTCEILINGZ: actor[iActor].ceilingz = lVar1; break; - case ACTOR_HTLASTVX: actor[iActor].lastvx = lVar1; break; - case ACTOR_HTLASTVY: actor[iActor].lastvy = lVar1; break; - case ACTOR_HTBPOSX: actor[iActor].bpos.x = lVar1; break; - case ACTOR_HTBPOSY: actor[iActor].bpos.y = lVar1; break; - case ACTOR_HTBPOSZ: actor[iActor].bpos.z = lVar1; break; - case ACTOR_HTG_T: actor[iActor].t_data[lParm2] = lVar1; break; - case ACTOR_ANGOFF: spriteext[iActor].angoff = lVar1; break; - case ACTOR_PITCH: spriteext[iActor].pitch = lVar1; break; - case ACTOR_ROLL: spriteext[iActor].roll = lVar1; break; - case ACTOR_MDXOFF: spriteext[iActor].offset.x = lVar1; break; - case ACTOR_MDYOFF: spriteext[iActor].offset.y = lVar1; break; - case ACTOR_MDZOFF: spriteext[iActor].offset.z = lVar1; break; - case ACTOR_MDFLAGS: spriteext[iActor].flags = lVar1; break; - case ACTOR_XPANNING: spriteext[iActor].xpanning = lVar1; break; - case ACTOR_YPANNING: spriteext[iActor].ypanning = lVar1; break; - case ACTOR_HTFLAGS: actor[iActor].flags = lVar1; break; - case ACTOR_ALPHA: spriteext[iActor].alpha = (float)lVar1 * (1.f / 255.0f); break; - default: break; - } - - return; - -badactor: - CON_ERRPRINTF("tried to set %s on invalid target sprite (%d) from spr %d pic %d gv %s\n", - ActorLabels[lLabelID].name,iActor,vm.g_i,TrackerCast(vm.g_sp->picnum), - (lVar1= MAXSPRITES)) - goto badactor; - - if (EDUKE32_PREDICT_FALSE(ActorLabels[lLabelID].flags & LABEL_HASPARM2 && - (unsigned)lParm2 >= (unsigned)ActorLabels[lLabelID].maxParm2)) - goto badpos; - - switch (lLabelID) - { - case ACTOR_X: lLabelID = sprite[iActor].x; break; - case ACTOR_Y: lLabelID = sprite[iActor].y; break; - case ACTOR_Z: lLabelID = sprite[iActor].z; break; - case ACTOR_CSTAT: lLabelID = sprite[iActor].cstat; break; - case ACTOR_PICNUM: lLabelID = sprite[iActor].picnum; break; - case ACTOR_SHADE: lLabelID = sprite[iActor].shade; break; - case ACTOR_PAL: lLabelID = sprite[iActor].pal; break; - case ACTOR_CLIPDIST: lLabelID = sprite[iActor].clipdist; break; - case ACTOR_DETAIL: lLabelID = sprite[iActor].blend; break; - case ACTOR_XREPEAT: lLabelID = sprite[iActor].xrepeat; break; - case ACTOR_YREPEAT: lLabelID = sprite[iActor].yrepeat; break; - case ACTOR_XOFFSET: lLabelID = sprite[iActor].xoffset; break; - case ACTOR_YOFFSET: lLabelID = sprite[iActor].yoffset; break; - case ACTOR_SECTNUM: lLabelID = sprite[iActor].sectnum; break; - case ACTOR_STATNUM: lLabelID = sprite[iActor].statnum; break; - case ACTOR_ANG: lLabelID = sprite[iActor].ang; break; - case ACTOR_OWNER: lLabelID = sprite[iActor].owner; break; - case ACTOR_XVEL: lLabelID = sprite[iActor].xvel; break; - case ACTOR_YVEL: lLabelID = sprite[iActor].yvel; break; - case ACTOR_ZVEL: lLabelID = sprite[iActor].zvel; break; - case ACTOR_LOTAG: lLabelID = (int16_t)sprite[iActor].lotag; break; - case ACTOR_HITAG: lLabelID = (int16_t)sprite[iActor].hitag; break; - case ACTOR_ULOTAG: lLabelID = sprite[iActor].lotag; break; - case ACTOR_UHITAG: lLabelID = sprite[iActor].hitag; break; - case ACTOR_EXTRA: lLabelID = sprite[iActor].extra; break; - case ACTOR_HTCGG: lLabelID = actor[iActor].cgg; break; - case ACTOR_HTPICNUM: lLabelID = actor[iActor].picnum; break; - case ACTOR_HTANG: lLabelID = actor[iActor].ang; break; - case ACTOR_HTEXTRA: lLabelID = actor[iActor].extra; break; - case ACTOR_HTOWNER: lLabelID = actor[iActor].owner; break; - case ACTOR_HTMOVFLAG: lLabelID = actor[iActor].movflag; break; - case ACTOR_HTTEMPANG: lLabelID = actor[iActor].tempang; break; - case ACTOR_HTACTORSTAYPUT: lLabelID = actor[iActor].actorstayput; break; - case ACTOR_HTDISPICNUM: lLabelID = actor[iActor].dispicnum; break; - case ACTOR_HTTIMETOSLEEP: lLabelID = actor[iActor].timetosleep; break; - case ACTOR_HTFLOORZ: lLabelID = actor[iActor].floorz; break; - case ACTOR_HTCEILINGZ: lLabelID = actor[iActor].ceilingz; break; - case ACTOR_HTLASTVX: lLabelID = actor[iActor].lastvx; break; - case ACTOR_HTLASTVY: lLabelID = actor[iActor].lastvy; break; - case ACTOR_HTBPOSX: lLabelID = actor[iActor].bpos.x; break; - case ACTOR_HTBPOSY: lLabelID = actor[iActor].bpos.y; break; - case ACTOR_HTBPOSZ: lLabelID = actor[iActor].bpos.z; break; - case ACTOR_HTG_T: lLabelID = actor[iActor].t_data[lParm2]; break; - case ACTOR_ANGOFF: lLabelID = spriteext[iActor].angoff; break; - case ACTOR_PITCH: lLabelID = spriteext[iActor].pitch; break; - case ACTOR_ROLL: lLabelID = spriteext[iActor].roll; break; - case ACTOR_MDXOFF: lLabelID = spriteext[iActor].offset.x; break; - case ACTOR_MDYOFF: lLabelID = spriteext[iActor].offset.y; break; - case ACTOR_MDZOFF: lLabelID = spriteext[iActor].offset.z; break; - case ACTOR_MDFLAGS: lLabelID = spriteext[iActor].flags; break; - case ACTOR_XPANNING: lLabelID = spriteext[iActor].xpanning; break; - case ACTOR_YPANNING: lLabelID = spriteext[iActor].ypanning; break; - case ACTOR_HTFLAGS: lLabelID = actor[iActor].flags; break; - case ACTOR_ALPHA: lLabelID = (uint8_t)(spriteext[iActor].alpha * 255.0f); break; - case ACTOR_ISVALID: lLabelID = sprite[iActor].statnum != MAXSTATUS; break; - default: return; - } - - Gv_SetVarX(lVar2, lLabelID); - return; - -badactor: - CON_ERRPRINTF("tried to get %s on invalid target sprite (%d) from spr %d pic %d gv %s\n", - ActorLabels[lLabelID].name,iActor,vm.g_i,TrackerCast(vm.g_sp->picnum), - (lVar1= MAXSPRITES)) - goto badsprite; - - if (EDUKE32_PREDICT_FALSE(!spriteext[lVar1].tspr)) - goto badtspr; - - if (iSet) - { - iSet = Gv_GetVarX(lVar2); - - switch (lLabelID) - { - case ACTOR_X: spriteext[lVar1].tspr->x = iSet; break; - case ACTOR_Y: spriteext[lVar1].tspr->y = iSet; break; - case ACTOR_Z: spriteext[lVar1].tspr->z = iSet; break; - case ACTOR_CSTAT: spriteext[lVar1].tspr->cstat = iSet; break; - case ACTOR_PICNUM: spriteext[lVar1].tspr->picnum = iSet; break; - case ACTOR_SHADE: spriteext[lVar1].tspr->shade = iSet; break; - case ACTOR_PAL: spriteext[lVar1].tspr->pal = iSet; break; - case ACTOR_CLIPDIST: spriteext[lVar1].tspr->clipdist = iSet; break; - case ACTOR_DETAIL: spriteext[lVar1].tspr->blend = iSet; break; - case ACTOR_XREPEAT: spriteext[lVar1].tspr->xrepeat = iSet; break; - case ACTOR_YREPEAT: spriteext[lVar1].tspr->yrepeat = iSet; break; - case ACTOR_XOFFSET: spriteext[lVar1].tspr->xoffset = iSet; break; - case ACTOR_YOFFSET: spriteext[lVar1].tspr->yoffset = iSet; break; - case ACTOR_SECTNUM: spriteext[lVar1].tspr->sectnum = iSet; break; - case ACTOR_STATNUM: spriteext[lVar1].tspr->statnum = iSet; break; - case ACTOR_ANG: spriteext[lVar1].tspr->ang = iSet; break; - case ACTOR_OWNER: spriteext[lVar1].tspr->owner = iSet; break; - case ACTOR_XVEL: spriteext[lVar1].tspr->xvel = iSet; break; - case ACTOR_YVEL: spriteext[lVar1].tspr->yvel = iSet; break; - case ACTOR_ZVEL: spriteext[lVar1].tspr->zvel = iSet; break; - case ACTOR_LOTAG: spriteext[lVar1].tspr->lotag = (int16_t) iSet; break; - case ACTOR_HITAG: spriteext[lVar1].tspr->hitag = (int16_t) iSet; break; - case ACTOR_ULOTAG: spriteext[lVar1].tspr->lotag = iSet; break; - case ACTOR_UHITAG: spriteext[lVar1].tspr->hitag = iSet; break; - case ACTOR_EXTRA: spriteext[lVar1].tspr->extra = iSet; break; - } - } - else - { - switch (lLabelID) - { - case ACTOR_X: iSet = spriteext[lVar1].tspr->x; break; - case ACTOR_Y: iSet = spriteext[lVar1].tspr->y; break; - case ACTOR_Z: iSet = spriteext[lVar1].tspr->z; break; - case ACTOR_CSTAT: iSet = spriteext[lVar1].tspr->cstat; break; - case ACTOR_PICNUM: iSet = spriteext[lVar1].tspr->picnum; break; - case ACTOR_SHADE: iSet = spriteext[lVar1].tspr->shade; break; - case ACTOR_PAL: iSet = spriteext[lVar1].tspr->pal; break; - case ACTOR_CLIPDIST: iSet = spriteext[lVar1].tspr->clipdist; break; - case ACTOR_DETAIL: iSet = spriteext[lVar1].tspr->blend; break; - case ACTOR_XREPEAT: iSet = spriteext[lVar1].tspr->xrepeat; break; - case ACTOR_YREPEAT: iSet = spriteext[lVar1].tspr->yrepeat; break; - case ACTOR_XOFFSET: iSet = spriteext[lVar1].tspr->xoffset; break; - case ACTOR_YOFFSET: iSet = spriteext[lVar1].tspr->yoffset; break; - case ACTOR_SECTNUM: iSet = spriteext[lVar1].tspr->sectnum; break; - case ACTOR_STATNUM: iSet = spriteext[lVar1].tspr->statnum; break; - case ACTOR_ANG: iSet = spriteext[lVar1].tspr->ang; break; - case ACTOR_OWNER: iSet = spriteext[lVar1].tspr->owner; break; - case ACTOR_XVEL: iSet = spriteext[lVar1].tspr->xvel; break; - case ACTOR_YVEL: iSet = spriteext[lVar1].tspr->yvel; break; - case ACTOR_ZVEL: iSet = spriteext[lVar1].tspr->zvel; break; - case ACTOR_LOTAG: iSet = (int16_t) spriteext[lVar1].tspr->lotag; break; - case ACTOR_HITAG: iSet = (int16_t) spriteext[lVar1].tspr->hitag; break; - case ACTOR_ULOTAG: iSet = spriteext[lVar1].tspr->lotag; break; - case ACTOR_UHITAG: iSet = spriteext[lVar1].tspr->hitag; break; - case ACTOR_EXTRA: iSet = spriteext[lVar1].tspr->extra; break; - default: return; - } - - Gv_SetVarX(lVar2, iSet); - } - - return; - -badsprite: - CON_ERRPRINTF("invalid target sprite (%d) %d %d\n", lVar1, vm.g_i, TrackerCast(vm.g_sp->picnum)); - insptr += (lVar2 == MAXGAMEVARS); - return; - -badtspr: - CON_ERRPRINTF("Internal bug, tsprite is unavailable\n"); - return; -} - -static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2) -{ - projectile_t * const proj = g_tile[lVar1].proj; - - if (EDUKE32_PREDICT_FALSE((unsigned)lVar1 >= MAXTILES)) - goto badtile; - - if (iSet) - { - iSet=Gv_GetVarX(lVar2); - - switch (lLabelID) - { - case PROJ_WORKSLIKE: proj->workslike = iSet; break; - case PROJ_SPAWNS: proj->spawns = iSet; break; - case PROJ_SXREPEAT: proj->sxrepeat = iSet; break; - case PROJ_SYREPEAT: proj->syrepeat = iSet; break; - case PROJ_SOUND: proj->sound = iSet; break; - case PROJ_ISOUND: proj->isound = iSet; break; - case PROJ_VEL: proj->vel = iSet; break; - case PROJ_EXTRA: proj->extra = iSet; break; - case PROJ_DECAL: proj->decal = iSet; break; - case PROJ_TRAIL: proj->trail = iSet; break; - case PROJ_TXREPEAT: proj->txrepeat = iSet; break; - case PROJ_TYREPEAT: proj->tyrepeat = iSet; break; - case PROJ_TOFFSET: proj->toffset = iSet; break; - case PROJ_TNUM: proj->tnum = iSet; break; - case PROJ_DROP: proj->drop = iSet; break; - case PROJ_CSTAT: proj->cstat = iSet; break; - case PROJ_CLIPDIST: proj->clipdist = iSet; break; - case PROJ_SHADE: proj->shade = iSet; break; - case PROJ_XREPEAT: proj->xrepeat = iSet; break; - case PROJ_YREPEAT: proj->yrepeat = iSet; break; - case PROJ_PAL: proj->pal = iSet; break; - case PROJ_EXTRA_RAND: proj->extra_rand = iSet; break; - case PROJ_HITRADIUS: proj->hitradius = iSet; break; - case PROJ_MOVECNT: proj->movecnt = iSet; break; - case PROJ_OFFSET: proj->offset = iSet; break; - case PROJ_BOUNCES: proj->bounces = iSet; break; - case PROJ_BSOUND: proj->bsound = iSet; break; - case PROJ_RANGE: proj->range = iSet; break; - case PROJ_FLASH_COLOR: proj->flashcolor = iSet; break; - case PROJ_USERDATA: proj->userdata = iSet; break; - } - } - else - { - switch (lLabelID) - { - case PROJ_WORKSLIKE: iSet = proj->workslike; break; - case PROJ_SPAWNS: iSet = proj->spawns; break; - case PROJ_SXREPEAT: iSet = proj->sxrepeat; break; - case PROJ_SYREPEAT: iSet = proj->syrepeat; break; - case PROJ_SOUND: iSet = proj->sound; break; - case PROJ_ISOUND: iSet = proj->isound; break; - case PROJ_VEL: iSet = proj->vel; break; - case PROJ_EXTRA: iSet = proj->extra; break; - case PROJ_DECAL: iSet = proj->decal; break; - case PROJ_TRAIL: iSet = proj->trail; break; - case PROJ_TXREPEAT: iSet = proj->txrepeat; break; - case PROJ_TYREPEAT: iSet = proj->tyrepeat; break; - case PROJ_TOFFSET: iSet = proj->toffset; break; - case PROJ_TNUM: iSet = proj->tnum; break; - case PROJ_DROP: iSet = proj->drop; break; - case PROJ_CSTAT: iSet = proj->cstat; break; - case PROJ_CLIPDIST: iSet = proj->clipdist; break; - case PROJ_SHADE: iSet = proj->shade; break; - case PROJ_XREPEAT: iSet = proj->xrepeat; break; - case PROJ_YREPEAT: iSet = proj->yrepeat; break; - case PROJ_PAL: iSet = proj->pal; break; - case PROJ_EXTRA_RAND: iSet = proj->extra_rand; break; - case PROJ_HITRADIUS: iSet = proj->hitradius; break; - case PROJ_MOVECNT: iSet = proj->movecnt; break; - case PROJ_OFFSET: iSet = proj->offset; break; - case PROJ_BOUNCES: iSet = proj->bounces; break; - case PROJ_BSOUND: iSet = proj->bsound; break; - case PROJ_RANGE: iSet = proj->range; break; - case PROJ_FLASH_COLOR: iSet = proj->flashcolor; break; - case PROJ_USERDATA: iSet = proj->userdata; break; - default: iSet = -1; break; - } - - Gv_SetVarX(lVar2, iSet); - } - - return; - -badtile: - CON_ERRPRINTF("invalid projectile (%d)\n", lVar1); - insptr += (lVar2 == MAXGAMEVARS); - return; -} -#else -static int32_t __fastcall VM_AccessSpriteX(int32_t iActor, int32_t lLabelID, int32_t lParm2) -{ - if (EDUKE32_PREDICT_FALSE(ActorLabels[lLabelID].flags & LABEL_HASPARM2 && - (unsigned)lParm2 >= (unsigned)ActorLabels[lLabelID].maxParm2)) - goto badpos; - - switch (lLabelID) - { - case ACTOR_X: lLabelID = sprite[iActor].x; break; - case ACTOR_Y: lLabelID = sprite[iActor].y; break; - case ACTOR_Z: lLabelID = sprite[iActor].z; break; - case ACTOR_CSTAT: lLabelID = sprite[iActor].cstat; break; - case ACTOR_PICNUM: lLabelID = sprite[iActor].picnum; break; - case ACTOR_SHADE: lLabelID = sprite[iActor].shade; break; - case ACTOR_PAL: lLabelID = sprite[iActor].pal; break; - case ACTOR_CLIPDIST: lLabelID = sprite[iActor].clipdist; break; - case ACTOR_DETAIL: lLabelID = sprite[iActor].blend; break; - case ACTOR_XREPEAT: lLabelID = sprite[iActor].xrepeat; break; - case ACTOR_YREPEAT: lLabelID = sprite[iActor].yrepeat; break; - case ACTOR_XOFFSET: lLabelID = sprite[iActor].xoffset; break; - case ACTOR_YOFFSET: lLabelID = sprite[iActor].yoffset; break; - case ACTOR_SECTNUM: lLabelID = sprite[iActor].sectnum; break; - case ACTOR_STATNUM: lLabelID = sprite[iActor].statnum; break; - case ACTOR_ANG: lLabelID = sprite[iActor].ang; break; - case ACTOR_OWNER: lLabelID = sprite[iActor].owner; break; - case ACTOR_XVEL: lLabelID = sprite[iActor].xvel; break; - case ACTOR_YVEL: lLabelID = sprite[iActor].yvel; break; - case ACTOR_ZVEL: lLabelID = sprite[iActor].zvel; break; - case ACTOR_LOTAG: lLabelID = (int16_t)sprite[iActor].lotag; break; - case ACTOR_HITAG: lLabelID = (int16_t)sprite[iActor].hitag; break; - case ACTOR_ULOTAG: lLabelID = sprite[iActor].lotag; break; - case ACTOR_UHITAG: lLabelID = sprite[iActor].hitag; break; - case ACTOR_EXTRA: lLabelID = sprite[iActor].extra; break; - case ACTOR_HTCGG: lLabelID = actor[iActor].cgg; break; - case ACTOR_HTPICNUM: lLabelID = actor[iActor].picnum; break; - case ACTOR_HTANG: lLabelID = actor[iActor].ang; break; - case ACTOR_HTEXTRA: lLabelID = actor[iActor].extra; break; - case ACTOR_HTOWNER: lLabelID = actor[iActor].owner; break; - case ACTOR_HTMOVFLAG: lLabelID = actor[iActor].movflag; break; - case ACTOR_HTTEMPANG: lLabelID = actor[iActor].tempang; break; - case ACTOR_HTACTORSTAYPUT: lLabelID = actor[iActor].actorstayput; break; - case ACTOR_HTDISPICNUM: lLabelID = actor[iActor].dispicnum; break; - case ACTOR_HTTIMETOSLEEP: lLabelID = actor[iActor].timetosleep; break; - case ACTOR_HTFLOORZ: lLabelID = actor[iActor].floorz; break; - case ACTOR_HTCEILINGZ: lLabelID = actor[iActor].ceilingz; break; - case ACTOR_HTLASTVX: lLabelID = actor[iActor].lastvx; break; - case ACTOR_HTLASTVY: lLabelID = actor[iActor].lastvy; break; - case ACTOR_HTBPOSX: lLabelID = actor[iActor].bpos.x; break; - case ACTOR_HTBPOSY: lLabelID = actor[iActor].bpos.y; break; - case ACTOR_HTBPOSZ: lLabelID = actor[iActor].bpos.z; break; - case ACTOR_HTG_T: lLabelID = actor[iActor].t_data[lParm2]; break; - case ACTOR_ANGOFF: lLabelID = spriteext[iActor].angoff; break; - case ACTOR_PITCH: lLabelID = spriteext[iActor].pitch; break; - case ACTOR_ROLL: lLabelID = spriteext[iActor].roll; break; - case ACTOR_MDXOFF: lLabelID = spriteext[iActor].offset.x; break; - case ACTOR_MDYOFF: lLabelID = spriteext[iActor].offset.y; break; - case ACTOR_MDZOFF: lLabelID = spriteext[iActor].offset.z; break; - case ACTOR_MDFLAGS: lLabelID = spriteext[iActor].flags; break; - case ACTOR_XPANNING: lLabelID = spriteext[iActor].xpanning; break; - case ACTOR_YPANNING: lLabelID = spriteext[iActor].ypanning; break; - case ACTOR_HTFLAGS: lLabelID = actor[iActor].flags; break; - case ACTOR_ALPHA: lLabelID = (uint8_t)(spriteext[iActor].alpha * 255.0f); break; - case ACTOR_ISVALID: lLabelID = (sprite[iActor].statnum != MAXSTATUS); break; - default: lLabelID = -1; break; - } - - return lLabelID; - -badpos: - CON_ERRPRINTF("tried to get invalid %s position %d on sprite (%d) from spr %d\n", - ActorLabels[lLabelID].name, lParm2, iActor, vm.g_i); - return -1; -} - -static int32_t __fastcall VM_AccessSectorX(int32_t iSector, int32_t lLabelID) -{ - switch (lLabelID) - { - case SECTOR_WALLPTR: lLabelID = sector[iSector].wallptr; break; - case SECTOR_WALLNUM: lLabelID = sector[iSector].wallnum; break; - case SECTOR_CEILINGZ: lLabelID = sector[iSector].ceilingz; break; - case SECTOR_FLOORZ: lLabelID = sector[iSector].floorz; break; - case SECTOR_CEILINGSTAT: lLabelID = sector[iSector].ceilingstat; break; - case SECTOR_FLOORSTAT: lLabelID = sector[iSector].floorstat; break; - case SECTOR_CEILINGPICNUM: lLabelID = sector[iSector].ceilingpicnum; break; - case SECTOR_CEILINGSLOPE: lLabelID = sector[iSector].ceilingheinum; break; - case SECTOR_CEILINGSHADE: lLabelID = sector[iSector].ceilingshade; break; - case SECTOR_CEILINGPAL: lLabelID = sector[iSector].ceilingpal; break; - case SECTOR_CEILINGXPANNING: lLabelID = sector[iSector].ceilingxpanning; break; - case SECTOR_CEILINGYPANNING: lLabelID = sector[iSector].ceilingypanning; break; - case SECTOR_FLOORPICNUM: lLabelID = sector[iSector].floorpicnum; break; - case SECTOR_FLOORSLOPE: lLabelID = sector[iSector].floorheinum; break; - case SECTOR_FLOORSHADE: lLabelID = sector[iSector].floorshade; break; - case SECTOR_FLOORPAL: lLabelID = sector[iSector].floorpal; break; - case SECTOR_FLOORXPANNING: lLabelID = sector[iSector].floorxpanning; break; - case SECTOR_FLOORYPANNING: lLabelID = sector[iSector].floorypanning; break; - case SECTOR_VISIBILITY: lLabelID = sector[iSector].visibility; break; - case SECTOR_FOGPAL: lLabelID = sector[iSector].fogpal; break; - case SECTOR_LOTAG: lLabelID = (int16_t)sector[iSector].lotag; break; - case SECTOR_HITAG: lLabelID = (int16_t)sector[iSector].hitag; break; - case SECTOR_ULOTAG: lLabelID = sector[iSector].lotag; break; - case SECTOR_UHITAG: lLabelID = sector[iSector].hitag; break; - case SECTOR_EXTRA: lLabelID = sector[iSector].extra; break; - case SECTOR_CEILINGBUNCH: - case SECTOR_FLOORBUNCH: -#ifdef YAX_ENABLE - lLabelID = yax_getbunch(iSector, lLabelID == SECTOR_FLOORBUNCH); -#else - lLabelID = -1; + lLabelID = 0; #endif break; + case USERDEFS_GAMETYPEFLAGS: lLabelID = GametypeFlags[ud.coop]; break; + case USERDEFS_M_GAMETYPEFLAGS: lLabelID = GametypeFlags[ud.m_coop]; break; default: lLabelID = -1; break; } return lLabelID; } -static int32_t __fastcall VM_AccessPlayerX(int32_t iPlayer, int32_t lLabelID, int32_t lParm2) +void __fastcall VM_SetUserdef(register int32_t const lLabelID, register int32_t const iSet) +{ + if (EDUKE32_PREDICT_FALSE(vm.g_p != myconnectindex)) + return; + + switch (lLabelID) + { + case USERDEFS_GOD: ud.god = iSet; break; + case USERDEFS_WARP_ON: ud.warp_on = iSet; break; + case USERDEFS_CASHMAN: ud.cashman = iSet; break; + case USERDEFS_EOG: ud.eog = iSet; break; + case USERDEFS_SHOWALLMAP: ud.showallmap = iSet; break; + case USERDEFS_SHOW_HELP: ud.show_help = iSet; break; + case USERDEFS_SCROLLMODE: ud.scrollmode = iSet; break; + case USERDEFS_CLIPPING: ud.noclip = iSet; break; + // case USERDEFS_USER_NAME: ud.user_name[MAXPLAYERS][32] = lValue; break; + // case USERDEFS_RIDECULE: ud.ridecule = lValue; break; + // case USERDEFS_SAVEGAME: ud.savegame = lValue; break; + // case USERDEFS_PWLOCKOUT: ud.pwlockout = lValue; break; + // case USERDEFS_RTSNAME: ud.rtsname = lValue; break; + case USERDEFS_OVERHEAD_ON: ud.overhead_on = iSet; break; + case USERDEFS_LAST_OVERHEAD: ud.last_overhead = iSet; break; + case USERDEFS_SHOWWEAPONS: ud.showweapons = iSet; break; + case USERDEFS_PAUSE_ON: ud.pause_on = iSet; break; + case USERDEFS_FROM_BONUS: ud.from_bonus = iSet; break; + case USERDEFS_CAMERASPRITE: ud.camerasprite = iSet; break; + case USERDEFS_LAST_CAMSPRITE: ud.last_camsprite = iSet; break; + case USERDEFS_LAST_LEVEL: ud.last_level = iSet; break; + case USERDEFS_SECRETLEVEL: ud.secretlevel = iSet; break; + case USERDEFS_CONST_VISIBILITY: ud.const_visibility = iSet; break; + case USERDEFS_UW_FRAMERATE: ud.uw_framerate = iSet; break; + case USERDEFS_CAMERA_TIME: ud.camera_time = iSet; break; + case USERDEFS_FOLFVEL: ud.folfvel = iSet; break; + case USERDEFS_FOLAVEL: ud.folavel = iSet; break; + case USERDEFS_FOLX: ud.folx = iSet; break; + case USERDEFS_FOLY: ud.foly = iSet; break; + case USERDEFS_FOLA: ud.fola = iSet; break; + case USERDEFS_RECCNT: ud.reccnt = iSet; break; + case USERDEFS_ENTERED_NAME: ud.entered_name = iSet; break; + case USERDEFS_SCREEN_TILTING: ud.screen_tilting = iSet; break; + case USERDEFS_SHADOWS: ud.shadows = iSet; break; + case USERDEFS_FTA_ON: ud.fta_on = iSet; break; + case USERDEFS_EXECUTIONS: ud.executions = iSet; break; + case USERDEFS_AUTO_RUN: ud.auto_run = iSet; break; + case USERDEFS_COORDS: ud.coords = iSet; break; + case USERDEFS_TICKRATE: ud.tickrate = iSet; break; + case USERDEFS_M_COOP: ud.m_coop = iSet; break; + case USERDEFS_COOP: ud.coop = iSet; break; + case USERDEFS_SCREEN_SIZE: + if (ud.screen_size != iSet) + { + ud.screen_size = iSet; + G_UpdateScreenArea(); + } + break; + case USERDEFS_LOCKOUT: ud.lockout = iSet; break; + case USERDEFS_CROSSHAIR: ud.crosshair = iSet; break; + case USERDEFS_PLAYERAI: ud.playerai = iSet; break; + case USERDEFS_RESPAWN_MONSTERS: ud.respawn_monsters = iSet; break; + case USERDEFS_RESPAWN_ITEMS: ud.respawn_items = iSet; break; + case USERDEFS_RESPAWN_INVENTORY: ud.respawn_inventory = iSet; break; + case USERDEFS_RECSTAT: ud.recstat = iSet; break; + case USERDEFS_MONSTERS_OFF: ud.monsters_off = iSet; break; + case USERDEFS_BRIGHTNESS: ud.brightness = iSet; break; + case USERDEFS_M_RESPAWN_ITEMS: ud.m_respawn_items = iSet; break; + case USERDEFS_M_RESPAWN_MONSTERS: ud.m_respawn_monsters = iSet; break; + case USERDEFS_M_RESPAWN_INVENTORY: ud.m_respawn_inventory = iSet; break; + case USERDEFS_M_RECSTAT: ud.m_recstat = iSet; break; + case USERDEFS_M_MONSTERS_OFF: ud.m_monsters_off = iSet; break; + // REMINDER: must implement "boolean" setters like this in Lunatic, too. + case USERDEFS_DETAIL: ud.detail = !!iSet; break; + case USERDEFS_M_FFIRE: ud.m_ffire = iSet; break; + case USERDEFS_FFIRE: ud.ffire = iSet; break; + case USERDEFS_M_PLAYER_SKILL: ud.m_player_skill = iSet; break; + case USERDEFS_M_LEVEL_NUMBER: ud.m_level_number = iSet; break; + case USERDEFS_M_VOLUME_NUMBER: ud.m_volume_number = iSet; break; + case USERDEFS_MULTIMODE: ud.multimode = iSet; break; + case USERDEFS_PLAYER_SKILL: ud.player_skill = iSet; break; + case USERDEFS_LEVEL_NUMBER: ud.level_number = iSet; break; + case USERDEFS_VOLUME_NUMBER: ud.volume_number = iSet; break; + case USERDEFS_M_MARKER: ud.m_marker = iSet; break; + case USERDEFS_MARKER: ud.marker = iSet; break; + case USERDEFS_MOUSEFLIP: ud.mouseflip = iSet; break; + case USERDEFS_STATUSBARSCALE: ud.statusbarscale = iSet; break; + case USERDEFS_DRAWWEAPON: ud.drawweapon = iSet; break; + case USERDEFS_MOUSEAIMING: ud.mouseaiming = iSet; break; + case USERDEFS_WEAPONSWITCH: ud.weaponswitch = iSet; break; + case USERDEFS_DEMOCAMS: ud.democams = iSet; break; + case USERDEFS_COLOR: ud.color = iSet; break; + case USERDEFS_MSGDISPTIME: ud.msgdisptime = iSet; break; + case USERDEFS_STATUSBARMODE: ud.statusbarmode = iSet; break; + case USERDEFS_M_NOEXITS: ud.m_noexits = iSet; break; + case USERDEFS_NOEXITS: ud.noexits = iSet; break; + case USERDEFS_AUTOVOTE: ud.autovote = iSet; break; + case USERDEFS_AUTOMSG: ud.automsg = iSet; break; + case USERDEFS_IDPLAYERS: ud.idplayers = iSet; break; + case USERDEFS_TEAM: ud.team = iSet; break; + case USERDEFS_VIEWBOB: ud.viewbob = iSet; break; + case USERDEFS_WEAPONSWAY: ud.weaponsway = iSet; break; + case USERDEFS_ANGLEINTERPOLATION: ud.angleinterpolation = iSet; break; + case USERDEFS_OBITUARIES: ud.obituaries = iSet; break; + case USERDEFS_LEVELSTATS: ud.levelstats = iSet; break; + case USERDEFS_CROSSHAIRSCALE: ud.crosshairscale = iSet; break; + case USERDEFS_ALTHUD: ud.althud = iSet; break; + case USERDEFS_DISPLAY_BONUS_SCREEN: ud.display_bonus_screen = iSet; break; + case USERDEFS_SHOW_LEVEL_TEXT: ud.show_level_text = iSet; break; + case USERDEFS_WEAPONSCALE: ud.weaponscale = iSet; break; + case USERDEFS_TEXTSCALE: ud.textscale = iSet; break; + case USERDEFS_RUNKEY_MODE: ud.runkey_mode = iSet; break; + case USERDEFS_M_ORIGIN_X: ud.m_origin.x = iSet; break; + case USERDEFS_M_ORIGIN_Y: ud.m_origin.y = iSet; break; + default: break; + } +} + +int32_t __fastcall VM_GetActiveProjectile(register int32_t const iActor, register int32_t lLabelID) +{ + if (EDUKE32_PREDICT_FALSE((unsigned)iActor >= MAXSPRITES)) + { + CON_ERRPRINTF("tried to get %s on invalid target projectile (%d) %d %d\n", + ProjectileLabels[lLabelID].name,iActor,vm.g_i,TrackerCast(vm.g_sp->picnum)); + return -1; + } + + switch (lLabelID) + { + case PROJ_WORKSLIKE: lLabelID = SpriteProjectile[iActor].workslike; break; + case PROJ_SPAWNS: lLabelID = SpriteProjectile[iActor].spawns; break; + case PROJ_SXREPEAT: lLabelID = SpriteProjectile[iActor].sxrepeat; break; + case PROJ_SYREPEAT: lLabelID = SpriteProjectile[iActor].syrepeat; break; + case PROJ_SOUND: lLabelID = SpriteProjectile[iActor].sound; break; + case PROJ_ISOUND: lLabelID = SpriteProjectile[iActor].isound; break; + case PROJ_VEL: lLabelID = SpriteProjectile[iActor].vel; break; + case PROJ_EXTRA: lLabelID = SpriteProjectile[iActor].extra; break; + case PROJ_DECAL: lLabelID = SpriteProjectile[iActor].decal; break; + case PROJ_TRAIL: lLabelID = SpriteProjectile[iActor].trail; break; + case PROJ_TXREPEAT: lLabelID = SpriteProjectile[iActor].txrepeat; break; + case PROJ_TYREPEAT: lLabelID = SpriteProjectile[iActor].tyrepeat; break; + case PROJ_TOFFSET: lLabelID = SpriteProjectile[iActor].toffset; break; + case PROJ_TNUM: lLabelID = SpriteProjectile[iActor].tnum; break; + case PROJ_DROP: lLabelID = SpriteProjectile[iActor].drop; break; + case PROJ_CSTAT: lLabelID = SpriteProjectile[iActor].cstat; break; + case PROJ_CLIPDIST: lLabelID = SpriteProjectile[iActor].clipdist; break; + case PROJ_SHADE: lLabelID = SpriteProjectile[iActor].shade; break; + case PROJ_XREPEAT: lLabelID = SpriteProjectile[iActor].xrepeat; break; + case PROJ_YREPEAT: lLabelID = SpriteProjectile[iActor].yrepeat; break; + case PROJ_PAL: lLabelID = SpriteProjectile[iActor].pal; break; + case PROJ_EXTRA_RAND: lLabelID = SpriteProjectile[iActor].extra_rand; break; + case PROJ_HITRADIUS: lLabelID = SpriteProjectile[iActor].hitradius; break; + case PROJ_MOVECNT: lLabelID = SpriteProjectile[iActor].movecnt; break; + case PROJ_OFFSET: lLabelID = SpriteProjectile[iActor].offset; break; + case PROJ_BOUNCES: lLabelID = SpriteProjectile[iActor].bounces; break; + case PROJ_BSOUND: lLabelID = SpriteProjectile[iActor].bsound; break; + case PROJ_RANGE: lLabelID = SpriteProjectile[iActor].range; break; + case PROJ_FLASH_COLOR: lLabelID = SpriteProjectile[iActor].flashcolor; break; + case PROJ_USERDATA: lLabelID = SpriteProjectile[iActor].userdata; break; + default: lLabelID = -1; break; + } + + return lLabelID; +} + +void __fastcall VM_SetActiveProjectile(register int32_t const iActor, register int32_t const lLabelID, register int32_t const iSet) +{ + if (EDUKE32_PREDICT_FALSE((unsigned)iActor >= MAXSPRITES)) + { + CON_ERRPRINTF("tried to set %s on invalid target projectile (%d) %d %d\n", + ProjectileLabels[lLabelID].name,iActor,vm.g_i,TrackerCast(vm.g_sp->picnum)); + return; + } + + switch (lLabelID) + { + case PROJ_WORKSLIKE: SpriteProjectile[iActor].workslike = iSet; break; + case PROJ_SPAWNS: SpriteProjectile[iActor].spawns = iSet; break; + case PROJ_SXREPEAT: SpriteProjectile[iActor].sxrepeat = iSet; break; + case PROJ_SYREPEAT: SpriteProjectile[iActor].syrepeat = iSet; break; + case PROJ_SOUND: SpriteProjectile[iActor].sound = iSet; break; + case PROJ_ISOUND: SpriteProjectile[iActor].isound = iSet; break; + case PROJ_VEL: SpriteProjectile[iActor].vel = iSet; break; + case PROJ_EXTRA: SpriteProjectile[iActor].extra = iSet; break; + case PROJ_DECAL: SpriteProjectile[iActor].decal = iSet; break; + case PROJ_TRAIL: SpriteProjectile[iActor].trail = iSet; break; + case PROJ_TXREPEAT: SpriteProjectile[iActor].txrepeat = iSet; break; + case PROJ_TYREPEAT: SpriteProjectile[iActor].tyrepeat = iSet; break; + case PROJ_TOFFSET: SpriteProjectile[iActor].toffset = iSet; break; + case PROJ_TNUM: SpriteProjectile[iActor].tnum = iSet; break; + case PROJ_DROP: SpriteProjectile[iActor].drop = iSet; break; + case PROJ_CSTAT: SpriteProjectile[iActor].cstat = iSet; break; + case PROJ_CLIPDIST: SpriteProjectile[iActor].clipdist = iSet; break; + case PROJ_SHADE: SpriteProjectile[iActor].shade = iSet; break; + case PROJ_XREPEAT: SpriteProjectile[iActor].xrepeat = iSet; break; + case PROJ_YREPEAT: SpriteProjectile[iActor].yrepeat = iSet; break; + case PROJ_PAL: SpriteProjectile[iActor].pal = iSet; break; + case PROJ_EXTRA_RAND: SpriteProjectile[iActor].extra_rand = iSet; break; + case PROJ_HITRADIUS: SpriteProjectile[iActor].hitradius = iSet; break; + case PROJ_MOVECNT: SpriteProjectile[iActor].movecnt = iSet; break; + case PROJ_OFFSET: SpriteProjectile[iActor].offset = iSet; break; + case PROJ_BOUNCES: SpriteProjectile[iActor].bounces = iSet; break; + case PROJ_BSOUND: SpriteProjectile[iActor].bsound = iSet; break; + case PROJ_RANGE: SpriteProjectile[iActor].range = iSet; break; + case PROJ_FLASH_COLOR: SpriteProjectile[iActor].flashcolor = iSet; break; + case PROJ_USERDATA: SpriteProjectile[iActor].userdata = iSet; break; + default: break; + } +} + +int32_t __fastcall VM_GetPlayer(register int32_t const iPlayer, register int32_t lLabelID, register int32_t const lParm2) { DukePlayer_t *const ps = g_player[iPlayer].ps; + if (EDUKE32_PREDICT_FALSE((unsigned)iPlayer >= (unsigned)playerswhenstarted)) + { + CON_ERRPRINTF("tried to get %s on invalid target player (%d) from spr %d\n", + PlayerLabels[lLabelID].name,iPlayer,vm.g_i); + return -1; + } + if (EDUKE32_PREDICT_FALSE(PlayerLabels[lLabelID].flags & LABEL_HASPARM2 && (unsigned)lParm2 >= (unsigned)PlayerLabels[lLabelID].maxParm2)) - goto badpos; + { + CON_ERRPRINTF("tried to get invalid %s position %d on player (%d) from spr %d\n", + PlayerLabels[lLabelID].name,lParm2,iPlayer,vm.g_i); + return -1; + } switch (lLabelID) { @@ -1615,15 +562,254 @@ static int32_t __fastcall VM_AccessPlayerX(int32_t iPlayer, int32_t lLabelID, in } return lLabelID; - -badpos: - CON_ERRPRINTF("tried to get invalid %s position %d on player (%d) from spr %d\n", - PlayerLabels[lLabelID].name,lParm2,iPlayer,vm.g_i); - return -1; } -static int32_t __fastcall VM_AccessWallX(int32_t iWall, int32_t lLabelID) +void __fastcall VM_SetPlayer(register int32_t const iPlayer, register int32_t const lLabelID, register int32_t const lParm2, register int32_t const iSet) { + DukePlayer_t * const ps = g_player[iPlayer].ps; + + if (EDUKE32_PREDICT_FALSE((unsigned)iPlayer >= (unsigned)playerswhenstarted)) + { + CON_ERRPRINTF("tried to set %s on invalid target player (%d) from spr %d\n", + PlayerLabels[lLabelID].name,iPlayer,vm.g_i); + return; + } + + if (EDUKE32_PREDICT_FALSE(PlayerLabels[lLabelID].flags & LABEL_HASPARM2 && + (unsigned)lParm2 >= (unsigned)PlayerLabels[lLabelID].maxParm2)) + { + CON_ERRPRINTF("tried to set invalid %s position %d on player (%d) from spr %d\n", + PlayerLabels[lLabelID].name,lParm2,iPlayer,vm.g_i); + return; + } + + switch (lLabelID) + { + case PLAYER_ZOOM: ps->zoom = iSet; break; + case PLAYER_EXITX: ps->exitx = iSet; break; + case PLAYER_EXITY: ps->exity = iSet; break; + case PLAYER_LOOGIEX: ps->loogiex[lParm2] = iSet; break; + case PLAYER_LOOGIEY: ps->loogiey[lParm2] = iSet; break; + case PLAYER_NUMLOOGS: ps->numloogs = iSet; break; + case PLAYER_LOOGCNT: ps->loogcnt = iSet; break; + case PLAYER_POSX: ps->pos.x = iSet; break; + case PLAYER_POSY: ps->pos.y = iSet; break; + case PLAYER_POSZ: ps->pos.z = iSet; break; + case PLAYER_HORIZ: ps->horiz = iSet; break; + case PLAYER_OHORIZ: ps->ohoriz = iSet; break; + case PLAYER_OHORIZOFF: ps->ohorizoff = iSet; break; + case PLAYER_INVDISPTIME: ps->invdisptime = iSet; break; + case PLAYER_BOBPOSX: ps->bobpos.x = iSet; break; + case PLAYER_BOBPOSY: ps->bobpos.y = iSet; break; + case PLAYER_OPOSX: ps->opos.x = iSet; break; + case PLAYER_OPOSY: ps->opos.y = iSet; break; + case PLAYER_OPOSZ: ps->opos.z = iSet; break; + case PLAYER_PYOFF: ps->pyoff = iSet; break; + case PLAYER_OPYOFF: ps->opyoff = iSet; break; + case PLAYER_POSXV: ps->vel.x = iSet; break; + case PLAYER_POSYV: ps->vel.y = iSet; break; + case PLAYER_POSZV: ps->vel.z = iSet; break; + case PLAYER_LAST_PISSED_TIME: ps->last_pissed_time = iSet; break; + case PLAYER_TRUEFZ: ps->truefz = iSet; break; + case PLAYER_TRUECZ: ps->truecz = iSet; break; + case PLAYER_PLAYER_PAR: ps->player_par = iSet; break; + case PLAYER_VISIBILITY: ps->visibility = iSet; break; + case PLAYER_BOBCOUNTER: ps->bobcounter = iSet; break; + case PLAYER_WEAPON_SWAY: ps->weapon_sway = iSet; break; + case PLAYER_PALS_TIME: ps->pals.f = iSet; break; + case PLAYER_RANDOMFLAMEX: ps->randomflamex = iSet; break; + case PLAYER_CRACK_TIME: ps->crack_time = iSet; break; + case PLAYER_AIM_MODE: ps->aim_mode = iSet; break; + case PLAYER_ANG: ps->ang = iSet; break; + case PLAYER_OANG: ps->oang = iSet; break; + case PLAYER_ANGVEL: ps->angvel = iSet; break; + case PLAYER_CURSECTNUM: ps->cursectnum = iSet; break; + case PLAYER_LOOK_ANG: ps->look_ang = iSet; break; + case PLAYER_LAST_EXTRA: ps->last_extra = iSet; break; + case PLAYER_SUBWEAPON: ps->subweapon = iSet; break; + case PLAYER_AMMO_AMOUNT: ps->ammo_amount[lParm2] = iSet; break; + case PLAYER_WACKEDBYACTOR: ps->wackedbyactor = iSet; break; + case PLAYER_FRAG: ps->frag = iSet; break; + case PLAYER_FRAGGEDSELF: ps->fraggedself = iSet; break; + case PLAYER_CURR_WEAPON: ps->curr_weapon = iSet; break; + case PLAYER_LAST_WEAPON: ps->last_weapon = iSet; break; + case PLAYER_TIPINCS: ps->tipincs = iSet; break; + case PLAYER_HORIZOFF: ps->horizoff = iSet; break; + case PLAYER_WANTWEAPONFIRE: ps->wantweaponfire = iSet; break; + case PLAYER_HOLODUKE_AMOUNT: ps->inv_amount[GET_HOLODUKE] = iSet; break; + case PLAYER_NEWOWNER: ps->newowner = iSet; break; + case PLAYER_HURT_DELAY: ps->hurt_delay = iSet; break; + case PLAYER_HBOMB_HOLD_DELAY: ps->hbomb_hold_delay = iSet; break; + case PLAYER_JUMPING_COUNTER: ps->jumping_counter = iSet; break; + case PLAYER_AIRLEFT: ps->airleft = iSet; break; + case PLAYER_KNEE_INCS: ps->knee_incs = iSet; break; + case PLAYER_ACCESS_INCS: ps->access_incs = iSet; break; + case PLAYER_FTA: ps->fta = iSet; break; + case PLAYER_FTQ: ps->ftq = iSet; break; + case PLAYER_ACCESS_WALLNUM: ps->access_wallnum = iSet; break; + case PLAYER_ACCESS_SPRITENUM: ps->access_spritenum = iSet; break; + case PLAYER_KICKBACK_PIC: ps->kickback_pic = iSet; break; + case PLAYER_GOT_ACCESS: ps->got_access = iSet; break; + case PLAYER_WEAPON_ANG: ps->weapon_ang = iSet; break; + case PLAYER_FIRSTAID_AMOUNT: ps->inv_amount[GET_FIRSTAID] = iSet; break; + case PLAYER_SOMETHINGONPLAYER: ps->somethingonplayer = iSet; break; + case PLAYER_ON_CRANE: ps->on_crane = iSet; break; + case PLAYER_I: ps->i = iSet; break; + case PLAYER_ONE_PARALLAX_SECTNUM: ps->one_parallax_sectnum = iSet; break; + case PLAYER_OVER_SHOULDER_ON: ps->over_shoulder_on = iSet; break; + case PLAYER_RANDOM_CLUB_FRAME: ps->random_club_frame = iSet; break; + case PLAYER_FIST_INCS: ps->fist_incs = iSet; break; + case PLAYER_ONE_EIGHTY_COUNT: ps->one_eighty_count = iSet; break; + case PLAYER_CHEAT_PHASE: ps->cheat_phase = iSet; break; + case PLAYER_DUMMYPLAYERSPRITE: ps->dummyplayersprite = iSet; break; + case PLAYER_EXTRA_EXTRA8: ps->extra_extra8 = iSet; break; + case PLAYER_QUICK_KICK: ps->quick_kick = iSet; break; + case PLAYER_HEAT_AMOUNT: ps->inv_amount[GET_HEATS] = iSet; break; + case PLAYER_ACTORSQU: ps->actorsqu = iSet; break; + case PLAYER_TIMEBEFOREEXIT: ps->timebeforeexit = iSet; break; + case PLAYER_CUSTOMEXITSOUND: ps->customexitsound = iSet; break; + case PLAYER_WEAPRECS: ps->weaprecs[lParm2] = iSet; break; + case PLAYER_WEAPRECCNT: ps->weapreccnt = iSet; break; + case PLAYER_INTERFACE_TOGGLE_FLAG: ps->interface_toggle_flag = iSet; break; + case PLAYER_ROTSCRNANG: ps->rotscrnang = iSet; break; + case PLAYER_DEAD_FLAG: ps->dead_flag = iSet; break; + case PLAYER_SHOW_EMPTY_WEAPON: ps->show_empty_weapon = iSet; break; + case PLAYER_SCUBA_AMOUNT: ps->inv_amount[GET_SCUBA] = iSet; break; + case PLAYER_JETPACK_AMOUNT: ps->inv_amount[GET_JETPACK] = iSet; break; + case PLAYER_STEROIDS_AMOUNT: ps->inv_amount[GET_STEROIDS] = iSet; break; + case PLAYER_SHIELD_AMOUNT: ps->inv_amount[GET_SHIELD] = iSet; break; + case PLAYER_HOLODUKE_ON: ps->holoduke_on = iSet; break; + case PLAYER_PYCOUNT: ps->pycount = iSet; break; + case PLAYER_WEAPON_POS: ps->weapon_pos = iSet; break; + case PLAYER_FRAG_PS: ps->frag_ps = iSet; break; + case PLAYER_TRANSPORTER_HOLD: ps->transporter_hold = iSet; break; + case PLAYER_LAST_FULL_WEAPON: ps->last_full_weapon = iSet; break; + case PLAYER_FOOTPRINTSHADE: ps->footprintshade = iSet; break; + case PLAYER_BOOT_AMOUNT: ps->inv_amount[GET_BOOTS] = iSet; break; + case PLAYER_SCREAM_VOICE: ps->scream_voice = iSet; break; + case PLAYER_GM: + if (!(ps->gm & MODE_MENU) && (iSet & MODE_MENU)) + M_OpenMenu(iPlayer); + else if ((ps->gm & MODE_MENU) && !(iSet & MODE_MENU)) + M_CloseMenu(iPlayer); + ps->gm = iSet; + break; + case PLAYER_ON_WARPING_SECTOR: ps->on_warping_sector = iSet; break; + case PLAYER_FOOTPRINTCOUNT: ps->footprintcount = iSet; break; + case PLAYER_HBOMB_ON: ps->hbomb_on = iSet; break; + case PLAYER_JUMPING_TOGGLE: ps->jumping_toggle = iSet; break; + case PLAYER_RAPID_FIRE_HOLD: ps->rapid_fire_hold = iSet; break; + case PLAYER_ON_GROUND: ps->on_ground = iSet; break; + case PLAYER_INVEN_ICON: ps->inven_icon = iSet; break; + case PLAYER_BUTTONPALETTE: ps->buttonpalette = iSet; break; + case PLAYER_JETPACK_ON: ps->jetpack_on = iSet; break; + case PLAYER_SPRITEBRIDGE: ps->spritebridge = iSet; break; + case PLAYER_LASTRANDOMSPOT: ps->lastrandomspot = iSet; break; + case PLAYER_SCUBA_ON: ps->scuba_on = iSet; break; + case PLAYER_FOOTPRINTPAL: ps->footprintpal = iSet; break; + case PLAYER_HEAT_ON: + if (ps->heat_on != iSet) + { + ps->heat_on = iSet; + P_UpdateScreenPal(ps); + } + break; + case PLAYER_HOLSTER_WEAPON: ps->holster_weapon = iSet; break; + case PLAYER_FALLING_COUNTER: ps->falling_counter = iSet; break; + case PLAYER_GOTWEAPON: + if (iSet) ps->gotweapon |= (1 << lParm2); + else ps->gotweapon &= ~(1 << lParm2); + break; + case PLAYER_REFRESH_INVENTORY: ps->refresh_inventory = iSet; break; + case PLAYER_PALETTE: P_SetGamePalette(ps, iSet, 2+16); break; + case PLAYER_TOGGLE_KEY_FLAG: ps->toggle_key_flag = iSet; break; + case PLAYER_KNUCKLE_INCS: ps->knuckle_incs = iSet; break; + case PLAYER_WALKING_SND_TOGGLE: ps->walking_snd_toggle = iSet; break; + case PLAYER_PALOOKUP: ps->palookup = iSet; break; + case PLAYER_HARD_LANDING: ps->hard_landing = iSet; break; + case PLAYER_MAX_SECRET_ROOMS: ps->max_secret_rooms = iSet; break; + case PLAYER_SECRET_ROOMS: ps->secret_rooms = iSet; break; + case PLAYER_PALS: + switch (lParm2) + { + case 0: ps->pals.r = iSet; break; + case 1: ps->pals.g = iSet; break; + case 2: ps->pals.b = iSet; break; + } + break; + case PLAYER_MAX_ACTORS_KILLED: ps->max_actors_killed = iSet; break; + case PLAYER_ACTORS_KILLED: ps->actors_killed = iSet; break; + case PLAYER_RETURN_TO_CENTER: ps->return_to_center = iSet; break; + case PLAYER_RUNSPEED: ps->runspeed = iSet; break; + case PLAYER_SBS: ps->sbs = iSet; break; + case PLAYER_RELOADING: ps->reloading = iSet; break; + case PLAYER_AUTO_AIM: ps->auto_aim = iSet; break; + case PLAYER_MOVEMENT_LOCK: ps->movement_lock = iSet; break; + case PLAYER_SOUND_PITCH: ps->sound_pitch = iSet; break; + case PLAYER_WEAPONSWITCH: ps->weaponswitch = iSet; break; + case PLAYER_TEAM: ps->team = iSet; break; + case PLAYER_MAX_PLAYER_HEALTH: ps->max_player_health = iSet; break; + case PLAYER_MAX_SHIELD_AMOUNT: ps->max_shield_amount = iSet; break; + case PLAYER_MAX_AMMO_AMOUNT: ps->max_ammo_amount[lParm2] = iSet; break; + case PLAYER_LAST_QUICK_KICK: ps->last_quick_kick = iSet; break; + case PLAYER_AUTOSTEP: ps->autostep = iSet; break; + case PLAYER_AUTOSTEP_SBW: ps->autostep_sbw = iSet; break; + default: break; + } +} + +int32_t __fastcall VM_GetPlayerInput(register int32_t const iPlayer, register int32_t lLabelID) +{ + if (EDUKE32_PREDICT_FALSE((unsigned)iPlayer >= (unsigned)playerswhenstarted)) + { + CON_ERRPRINTF("VM_GetPlayerInput: invalid target player (%d) %d\n", iPlayer,vm.g_i); + return -1; + } + + switch (lLabelID) + { + case INPUT_AVEL: lLabelID = g_player[iPlayer].sync->avel; break; + case INPUT_HORZ: lLabelID = g_player[iPlayer].sync->horz; break; + case INPUT_FVEL: lLabelID = g_player[iPlayer].sync->fvel; break; + case INPUT_SVEL: lLabelID = g_player[iPlayer].sync->svel; break; + case INPUT_BITS: lLabelID = g_player[iPlayer].sync->bits; break; + case INPUT_EXTBITS: lLabelID = g_player[iPlayer].sync->extbits; break; + default: lLabelID = -1; break; + } + + return lLabelID; +} + +void __fastcall VM_SetPlayerInput(register int32_t const iPlayer, register int32_t const lLabelID, register int32_t const iSet) +{ + if (EDUKE32_PREDICT_FALSE((unsigned)iPlayer >= (unsigned)playerswhenstarted)) + { + CON_ERRPRINTF("VM_SetPlayerInput: invalid target player (%d) %d\n", iPlayer,vm.g_i); + return; + } + + switch (lLabelID) + { + case INPUT_AVEL: g_player[iPlayer].sync->avel = iSet; break; + case INPUT_HORZ: g_player[iPlayer].sync->horz = iSet; break; + case INPUT_FVEL: g_player[iPlayer].sync->fvel = iSet; break; + case INPUT_SVEL: g_player[iPlayer].sync->svel = iSet; break; + case INPUT_BITS: g_player[iPlayer].sync->bits = iSet; break; + case INPUT_EXTBITS: g_player[iPlayer].sync->extbits = iSet; break; + default: break; + } +} + + + +int32_t __fastcall VM_GetWall(register int32_t const iWall, register int32_t lLabelID) +{ + if (EDUKE32_PREDICT_FALSE((unsigned)iWall >= (unsigned)numwalls)) + { + CON_ERRPRINTF("VM_GetWall: Invalid wall %d\n", iWall); + return -1; + } + switch (lLabelID) { case WALL_X: lLabelID = wall[iWall].x; break; @@ -1650,4 +836,473 @@ static int32_t __fastcall VM_AccessWallX(int32_t iWall, int32_t lLabelID) return lLabelID; } -#endif // gamevars_c_ + +void __fastcall VM_SetWall(register int32_t const iWall, register int32_t const lLabelID, register int32_t const iSet) +{ + if (EDUKE32_PREDICT_FALSE((unsigned)iWall >= (unsigned)numwalls)) + { + CON_ERRPRINTF("VM_SetWall: Invalid wall %d\n", iWall); + return; + } + + switch (lLabelID) + { + case WALL_X: wall[iWall].x = iSet; break; + case WALL_Y: wall[iWall].y = iSet; break; + case WALL_POINT2: wall[iWall].point2 = iSet; break; + case WALL_NEXTWALL: wall[iWall].nextwall = iSet; break; + case WALL_NEXTSECTOR: wall[iWall].nextsector = iSet; break; + case WALL_CSTAT: wall[iWall].cstat = iSet; break; + case WALL_PICNUM: wall[iWall].picnum = iSet; break; + case WALL_OVERPICNUM: wall[iWall].overpicnum = iSet; break; + case WALL_SHADE: wall[iWall].shade = iSet; break; + case WALL_PAL: wall[iWall].pal = iSet; break; + case WALL_XREPEAT: wall[iWall].xrepeat = iSet; break; + case WALL_YREPEAT: wall[iWall].yrepeat = iSet; break; + case WALL_XPANNING: wall[iWall].xpanning = iSet; break; + case WALL_YPANNING: wall[iWall].ypanning = iSet; break; + case WALL_LOTAG: wall[iWall].lotag = (int16_t)iSet; break; + case WALL_HITAG: wall[iWall].hitag = (int16_t)iSet; break; + case WALL_ULOTAG: wall[iWall].lotag = iSet; break; + case WALL_UHITAG: wall[iWall].hitag = iSet; break; + case WALL_EXTRA: wall[iWall].extra = iSet; break; + } + + return; +} + +int32_t __fastcall VM_GetSector(register int32_t const iSector, register int32_t lLabelID) +{ + if (EDUKE32_PREDICT_FALSE((unsigned)iSector >= (unsigned)numsectors)) + { + CON_ERRPRINTF("VM_GetSector: Invalid sector %d\n", iSector); + return -1; + } + + switch (lLabelID) + { + case SECTOR_WALLPTR: lLabelID = sector[iSector].wallptr; break; + case SECTOR_WALLNUM: lLabelID = sector[iSector].wallnum; break; + case SECTOR_CEILINGZ: lLabelID = sector[iSector].ceilingz; break; + case SECTOR_FLOORZ: lLabelID = sector[iSector].floorz; break; + case SECTOR_CEILINGSTAT: lLabelID = sector[iSector].ceilingstat; break; + case SECTOR_FLOORSTAT: lLabelID = sector[iSector].floorstat; break; + case SECTOR_CEILINGPICNUM: lLabelID = sector[iSector].ceilingpicnum; break; + case SECTOR_CEILINGSLOPE: lLabelID = sector[iSector].ceilingheinum; break; + case SECTOR_CEILINGSHADE: lLabelID = sector[iSector].ceilingshade; break; + case SECTOR_CEILINGPAL: lLabelID = sector[iSector].ceilingpal; break; + case SECTOR_CEILINGXPANNING: lLabelID = sector[iSector].ceilingxpanning; break; + case SECTOR_CEILINGYPANNING: lLabelID = sector[iSector].ceilingypanning; break; + case SECTOR_FLOORPICNUM: lLabelID = sector[iSector].floorpicnum; break; + case SECTOR_FLOORSLOPE: lLabelID = sector[iSector].floorheinum; break; + case SECTOR_FLOORSHADE: lLabelID = sector[iSector].floorshade; break; + case SECTOR_FLOORPAL: lLabelID = sector[iSector].floorpal; break; + case SECTOR_FLOORXPANNING: lLabelID = sector[iSector].floorxpanning; break; + case SECTOR_FLOORYPANNING: lLabelID = sector[iSector].floorypanning; break; + case SECTOR_VISIBILITY: lLabelID = sector[iSector].visibility; break; + case SECTOR_FOGPAL: lLabelID = sector[iSector].fogpal; break; + case SECTOR_LOTAG: lLabelID = (int16_t)sector[iSector].lotag; break; + case SECTOR_HITAG: lLabelID = (int16_t)sector[iSector].hitag; break; + case SECTOR_ULOTAG: lLabelID = sector[iSector].lotag; break; + case SECTOR_UHITAG: lLabelID = sector[iSector].hitag; break; + case SECTOR_EXTRA: lLabelID = sector[iSector].extra; break; + case SECTOR_CEILINGBUNCH: + case SECTOR_FLOORBUNCH: +#ifdef YAX_ENABLE + lLabelID = yax_getbunch(iSector, lLabelID == SECTOR_FLOORBUNCH); +#else + lLabelID = -1; +#endif + break; + default: lLabelID = -1; break; + } + + return lLabelID; +} + +void __fastcall VM_SetSector(register int32_t const iSector, register int32_t const lLabelID, register int32_t const iSet) +{ + if (EDUKE32_PREDICT_FALSE((unsigned)iSector >= (unsigned)numsectors)) + { + CON_ERRPRINTF("VM_SetSector: Invalid sector %d\n", iSector); + return; + } + + switch (lLabelID) + { + case SECTOR_WALLPTR: sector[iSector].wallptr = iSet; break; + case SECTOR_WALLNUM: sector[iSector].wallnum = iSet; break; + case SECTOR_CEILINGZ: sector[iSector].ceilingz = iSet; break; + case SECTOR_FLOORZ: sector[iSector].floorz = iSet; break; + case SECTOR_CEILINGSTAT: sector[iSector].ceilingstat = iSet; break; + case SECTOR_FLOORSTAT: sector[iSector].floorstat = iSet; break; + case SECTOR_CEILINGPICNUM: sector[iSector].ceilingpicnum = iSet; break; + case SECTOR_CEILINGSLOPE: sector[iSector].ceilingheinum = iSet; break; + case SECTOR_CEILINGSHADE: sector[iSector].ceilingshade = iSet; break; + case SECTOR_CEILINGPAL: sector[iSector].ceilingpal = iSet; break; + case SECTOR_CEILINGXPANNING: sector[iSector].ceilingxpanning = iSet; break; + case SECTOR_CEILINGYPANNING: sector[iSector].ceilingypanning = iSet; break; + case SECTOR_FLOORPICNUM: sector[iSector].floorpicnum = iSet; break; + case SECTOR_FLOORSLOPE: sector[iSector].floorheinum = iSet; break; + case SECTOR_FLOORSHADE: sector[iSector].floorshade = iSet; break; + case SECTOR_FLOORPAL: sector[iSector].floorpal = iSet; break; + case SECTOR_FLOORXPANNING: sector[iSector].floorxpanning = iSet; break; + case SECTOR_FLOORYPANNING: sector[iSector].floorypanning = iSet; break; + case SECTOR_VISIBILITY: sector[iSector].visibility = iSet; break; + case SECTOR_FOGPAL: sector[iSector].fogpal = iSet; break; + case SECTOR_LOTAG: sector[iSector].lotag = (int16_t)iSet; break; + case SECTOR_HITAG: sector[iSector].hitag = (int16_t)iSet; break; + case SECTOR_ULOTAG: sector[iSector].lotag = iSet; break; + case SECTOR_UHITAG: sector[iSector].hitag = iSet; break; + case SECTOR_EXTRA: sector[iSector].extra = iSet; break; + case SECTOR_CEILINGBUNCH: + case SECTOR_FLOORBUNCH: + default: break; + } +} + +void __fastcall VM_SetSprite(register int32_t const iActor, register int32_t const lLabelID, register int32_t const lParm2, register int32_t const iSet) +{ + if (EDUKE32_PREDICT_FALSE((unsigned)iActor >= MAXSPRITES)) + { + CON_ERRPRINTF("tried to set %s on invalid target sprite (%d) from spr %d pic %d\n", + ActorLabels[lLabelID].name,iActor,vm.g_i,TrackerCast(vm.g_sp->picnum)); + return; + } + + if (EDUKE32_PREDICT_FALSE(ActorLabels[lLabelID].flags & LABEL_HASPARM2 && (unsigned)lParm2 >= (unsigned)ActorLabels[lLabelID].maxParm2)) + { + CON_ERRPRINTF("tried to set invalid %s position %d on sprite (%d) from spr %d\n", + ActorLabels[lLabelID].name,lParm2,iActor,vm.g_i); + return; + } + + switch (lLabelID) + { + case ACTOR_X: sprite[iActor].x = iSet; break; + case ACTOR_Y: sprite[iActor].y = iSet; break; + case ACTOR_Z: sprite[iActor].z = iSet; break; + case ACTOR_CSTAT: sprite[iActor].cstat = iSet; break; + case ACTOR_PICNUM: sprite[iActor].picnum = iSet; break; + case ACTOR_SHADE: sprite[iActor].shade = iSet; break; + case ACTOR_PAL: sprite[iActor].pal = iSet; break; + case ACTOR_CLIPDIST: sprite[iActor].clipdist = iSet; break; + case ACTOR_DETAIL: sprite[iActor].blend = iSet; break; + case ACTOR_XREPEAT: sprite[iActor].xrepeat = iSet; break; + case ACTOR_YREPEAT: sprite[iActor].yrepeat = iSet; break; + case ACTOR_XOFFSET: sprite[iActor].xoffset = iSet; break; + case ACTOR_YOFFSET: sprite[iActor].yoffset = iSet; break; + case ACTOR_SECTNUM: changespritesect(iActor, iSet); break; + case ACTOR_STATNUM: changespritestat(iActor, iSet); break; + case ACTOR_ANG: sprite[iActor].ang = iSet; break; + case ACTOR_OWNER: sprite[iActor].owner = iSet; break; + case ACTOR_XVEL: sprite[iActor].xvel = iSet; break; + case ACTOR_YVEL: sprite[iActor].yvel = iSet; break; + case ACTOR_ZVEL: sprite[iActor].zvel = iSet; break; + case ACTOR_LOTAG: sprite[iActor].lotag = (int16_t)iSet; break; + case ACTOR_HITAG: sprite[iActor].hitag = (int16_t)iSet; break; + case ACTOR_ULOTAG: sprite[iActor].lotag = iSet; break; + case ACTOR_UHITAG: sprite[iActor].hitag = iSet; break; + case ACTOR_EXTRA: sprite[iActor].extra = iSet; break; + case ACTOR_HTCGG: actor[iActor].cgg = iSet; break; + case ACTOR_HTPICNUM: actor[iActor].picnum = iSet; break; + case ACTOR_HTANG: actor[iActor].ang = iSet; break; + case ACTOR_HTEXTRA: actor[iActor].extra = iSet; break; + case ACTOR_HTOWNER: actor[iActor].owner = iSet; break; + case ACTOR_HTMOVFLAG: actor[iActor].movflag = iSet; break; + case ACTOR_HTTEMPANG: actor[iActor].tempang = iSet; break; + case ACTOR_HTACTORSTAYPUT: actor[iActor].actorstayput = iSet; break; + case ACTOR_HTDISPICNUM: actor[iActor].dispicnum = iSet; break; + case ACTOR_HTTIMETOSLEEP: actor[iActor].timetosleep = iSet; break; + case ACTOR_HTFLOORZ: actor[iActor].floorz = iSet; break; + case ACTOR_HTCEILINGZ: actor[iActor].ceilingz = iSet; break; + case ACTOR_HTLASTVX: actor[iActor].lastvx = iSet; break; + case ACTOR_HTLASTVY: actor[iActor].lastvy = iSet; break; + case ACTOR_HTBPOSX: actor[iActor].bpos.x = iSet; break; + case ACTOR_HTBPOSY: actor[iActor].bpos.y = iSet; break; + case ACTOR_HTBPOSZ: actor[iActor].bpos.z = iSet; break; + case ACTOR_HTG_T: actor[iActor].t_data[lParm2] = iSet; break; + case ACTOR_ANGOFF: spriteext[iActor].angoff = iSet; break; + case ACTOR_PITCH: spriteext[iActor].pitch = iSet; break; + case ACTOR_ROLL: spriteext[iActor].roll = iSet; break; + case ACTOR_MDXOFF: spriteext[iActor].offset.x = iSet; break; + case ACTOR_MDYOFF: spriteext[iActor].offset.y = iSet; break; + case ACTOR_MDZOFF: spriteext[iActor].offset.z = iSet; break; + case ACTOR_MDFLAGS: spriteext[iActor].flags = iSet; break; + case ACTOR_XPANNING: spriteext[iActor].xpanning = iSet; break; + case ACTOR_YPANNING: spriteext[iActor].ypanning = iSet; break; + case ACTOR_HTFLAGS: actor[iActor].flags = iSet; break; + case ACTOR_ALPHA: spriteext[iActor].alpha = (float)iSet * (1.f / 255.0f); break; + default: break; + } +} + + +int32_t __fastcall VM_GetSprite(register int32_t const iActor, register int32_t lLabelID, register int32_t const lParm2) +{ + if (EDUKE32_PREDICT_FALSE((unsigned)iActor >= MAXSPRITES)) + { + CON_ERRPRINTF("tried to get %s on invalid target sprite (%d) from spr %d pic %d\n", + ActorLabels[lLabelID].name,iActor,vm.g_i,TrackerCast(vm.g_sp->picnum)); + return -1; + } + + if (EDUKE32_PREDICT_FALSE(ActorLabels[lLabelID].flags & LABEL_HASPARM2 && + (unsigned)lParm2 >= (unsigned)ActorLabels[lLabelID].maxParm2)) + { + CON_ERRPRINTF("tried to get invalid %s position %d on sprite (%d) from spr %d\n", + ActorLabels[lLabelID].name,lParm2,iActor,vm.g_i); + return -1; + } + + switch (lLabelID) + { + case ACTOR_X: lLabelID = sprite[iActor].x; break; + case ACTOR_Y: lLabelID = sprite[iActor].y; break; + case ACTOR_Z: lLabelID = sprite[iActor].z; break; + case ACTOR_CSTAT: lLabelID = sprite[iActor].cstat; break; + case ACTOR_PICNUM: lLabelID = sprite[iActor].picnum; break; + case ACTOR_SHADE: lLabelID = sprite[iActor].shade; break; + case ACTOR_PAL: lLabelID = sprite[iActor].pal; break; + case ACTOR_CLIPDIST: lLabelID = sprite[iActor].clipdist; break; + case ACTOR_DETAIL: lLabelID = sprite[iActor].blend; break; + case ACTOR_XREPEAT: lLabelID = sprite[iActor].xrepeat; break; + case ACTOR_YREPEAT: lLabelID = sprite[iActor].yrepeat; break; + case ACTOR_XOFFSET: lLabelID = sprite[iActor].xoffset; break; + case ACTOR_YOFFSET: lLabelID = sprite[iActor].yoffset; break; + case ACTOR_SECTNUM: lLabelID = sprite[iActor].sectnum; break; + case ACTOR_STATNUM: lLabelID = sprite[iActor].statnum; break; + case ACTOR_ANG: lLabelID = sprite[iActor].ang; break; + case ACTOR_OWNER: lLabelID = sprite[iActor].owner; break; + case ACTOR_XVEL: lLabelID = sprite[iActor].xvel; break; + case ACTOR_YVEL: lLabelID = sprite[iActor].yvel; break; + case ACTOR_ZVEL: lLabelID = sprite[iActor].zvel; break; + case ACTOR_LOTAG: lLabelID = (int16_t)sprite[iActor].lotag; break; + case ACTOR_HITAG: lLabelID = (int16_t)sprite[iActor].hitag; break; + case ACTOR_ULOTAG: lLabelID = sprite[iActor].lotag; break; + case ACTOR_UHITAG: lLabelID = sprite[iActor].hitag; break; + case ACTOR_EXTRA: lLabelID = sprite[iActor].extra; break; + case ACTOR_HTCGG: lLabelID = actor[iActor].cgg; break; + case ACTOR_HTPICNUM: lLabelID = actor[iActor].picnum; break; + case ACTOR_HTANG: lLabelID = actor[iActor].ang; break; + case ACTOR_HTEXTRA: lLabelID = actor[iActor].extra; break; + case ACTOR_HTOWNER: lLabelID = actor[iActor].owner; break; + case ACTOR_HTMOVFLAG: lLabelID = actor[iActor].movflag; break; + case ACTOR_HTTEMPANG: lLabelID = actor[iActor].tempang; break; + case ACTOR_HTACTORSTAYPUT: lLabelID = actor[iActor].actorstayput; break; + case ACTOR_HTDISPICNUM: lLabelID = actor[iActor].dispicnum; break; + case ACTOR_HTTIMETOSLEEP: lLabelID = actor[iActor].timetosleep; break; + case ACTOR_HTFLOORZ: lLabelID = actor[iActor].floorz; break; + case ACTOR_HTCEILINGZ: lLabelID = actor[iActor].ceilingz; break; + case ACTOR_HTLASTVX: lLabelID = actor[iActor].lastvx; break; + case ACTOR_HTLASTVY: lLabelID = actor[iActor].lastvy; break; + case ACTOR_HTBPOSX: lLabelID = actor[iActor].bpos.x; break; + case ACTOR_HTBPOSY: lLabelID = actor[iActor].bpos.y; break; + case ACTOR_HTBPOSZ: lLabelID = actor[iActor].bpos.z; break; + case ACTOR_HTG_T: lLabelID = actor[iActor].t_data[lParm2]; break; + case ACTOR_ANGOFF: lLabelID = spriteext[iActor].angoff; break; + case ACTOR_PITCH: lLabelID = spriteext[iActor].pitch; break; + case ACTOR_ROLL: lLabelID = spriteext[iActor].roll; break; + case ACTOR_MDXOFF: lLabelID = spriteext[iActor].offset.x; break; + case ACTOR_MDYOFF: lLabelID = spriteext[iActor].offset.y; break; + case ACTOR_MDZOFF: lLabelID = spriteext[iActor].offset.z; break; + case ACTOR_MDFLAGS: lLabelID = spriteext[iActor].flags; break; + case ACTOR_XPANNING: lLabelID = spriteext[iActor].xpanning; break; + case ACTOR_YPANNING: lLabelID = spriteext[iActor].ypanning; break; + case ACTOR_HTFLAGS: lLabelID = actor[iActor].flags; break; + case ACTOR_ALPHA: lLabelID = (uint8_t)(spriteext[iActor].alpha * 255.0f); break; + case ACTOR_ISVALID: lLabelID = (sprite[iActor].statnum != MAXSTATUS); break; + default: lLabelID = -1; break; + } + + return lLabelID; +} + +int32_t __fastcall VM_GetTsprite(register int32_t const iActor, register int32_t lLabelID) +{ + if (EDUKE32_PREDICT_FALSE((unsigned)iActor >= MAXSPRITES)) + { + CON_ERRPRINTF("VM_GetTsprite: invalid target sprite (%d) %d %d\n", iActor, vm.g_i, TrackerCast(vm.g_sp->picnum)); + return -1; + } + + tspritetype * const tspr = spriteext[iActor].tspr; + + if (EDUKE32_PREDICT_FALSE(!tspr)) + { + CON_ERRPRINTF("VM_GetTsprite: Internal bug, tsprite is unavailable\n"); + return -1; + } + + switch (lLabelID) + { + case ACTOR_X: lLabelID = tspr->x; break; + case ACTOR_Y: lLabelID = tspr->y; break; + case ACTOR_Z: lLabelID = tspr->z; break; + case ACTOR_CSTAT: lLabelID = tspr->cstat; break; + case ACTOR_PICNUM: lLabelID = tspr->picnum; break; + case ACTOR_SHADE: lLabelID = tspr->shade; break; + case ACTOR_PAL: lLabelID = tspr->pal; break; + case ACTOR_CLIPDIST: lLabelID = tspr->clipdist; break; + case ACTOR_DETAIL: lLabelID = tspr->blend; break; + case ACTOR_XREPEAT: lLabelID = tspr->xrepeat; break; + case ACTOR_YREPEAT: lLabelID = tspr->yrepeat; break; + case ACTOR_XOFFSET: lLabelID = tspr->xoffset; break; + case ACTOR_YOFFSET: lLabelID = tspr->yoffset; break; + case ACTOR_SECTNUM: lLabelID = tspr->sectnum; break; + case ACTOR_STATNUM: lLabelID = tspr->statnum; break; + case ACTOR_ANG: lLabelID = tspr->ang; break; + case ACTOR_OWNER: lLabelID = tspr->owner; break; + case ACTOR_XVEL: lLabelID = tspr->xvel; break; + case ACTOR_YVEL: lLabelID = tspr->yvel; break; + case ACTOR_ZVEL: lLabelID = tspr->zvel; break; + case ACTOR_LOTAG: lLabelID = (int16_t) tspr->lotag; break; + case ACTOR_HITAG: lLabelID = (int16_t) tspr->hitag; break; + case ACTOR_ULOTAG: lLabelID = tspr->lotag; break; + case ACTOR_UHITAG: lLabelID = tspr->hitag; break; + case ACTOR_EXTRA: lLabelID = tspr->extra; break; + default: lLabelID = -1; break; + } + + return lLabelID; +} + +void __fastcall VM_SetTsprite(register int32_t const iActor, register int32_t const lLabelID, register int32_t const iSet) +{ + if (EDUKE32_PREDICT_FALSE((unsigned)iActor >= MAXSPRITES)) + { + CON_ERRPRINTF("VM_SetTsprite: invalid target sprite (%d) %d %d\n", iActor, vm.g_i, TrackerCast(vm.g_sp->picnum)); + return; + } + + tspritetype * const tspr = spriteext[iActor].tspr; + + if (EDUKE32_PREDICT_FALSE(!tspr)) + { + CON_ERRPRINTF("VM_SetTsprite: Internal bug, tsprite is unavailable\n"); + return; + } + + switch (lLabelID) + { + case ACTOR_X: tspr->x = iSet; break; + case ACTOR_Y: tspr->y = iSet; break; + case ACTOR_Z: tspr->z = iSet; break; + case ACTOR_CSTAT: tspr->cstat = iSet; break; + case ACTOR_PICNUM: tspr->picnum = iSet; break; + case ACTOR_SHADE: tspr->shade = iSet; break; + case ACTOR_PAL: tspr->pal = iSet; break; + case ACTOR_CLIPDIST: tspr->clipdist = iSet; break; + case ACTOR_DETAIL: tspr->blend = iSet; break; + case ACTOR_XREPEAT: tspr->xrepeat = iSet; break; + case ACTOR_YREPEAT: tspr->yrepeat = iSet; break; + case ACTOR_XOFFSET: tspr->xoffset = iSet; break; + case ACTOR_YOFFSET: tspr->yoffset = iSet; break; + case ACTOR_SECTNUM: tspr->sectnum = iSet; break; + case ACTOR_STATNUM: tspr->statnum = iSet; break; + case ACTOR_ANG: tspr->ang = iSet; break; + case ACTOR_OWNER: tspr->owner = iSet; break; + case ACTOR_XVEL: tspr->xvel = iSet; break; + case ACTOR_YVEL: tspr->yvel = iSet; break; + case ACTOR_ZVEL: tspr->zvel = iSet; break; + case ACTOR_LOTAG: tspr->lotag = (int16_t) iSet; break; + case ACTOR_HITAG: tspr->hitag = (int16_t) iSet; break; + case ACTOR_ULOTAG: tspr->lotag = iSet; break; + case ACTOR_UHITAG: tspr->hitag = iSet; break; + case ACTOR_EXTRA: tspr->extra = iSet; break; + } +} + +int32_t __fastcall VM_GetProjectile(register int32_t const iTile, register int32_t lLabelID) +{ + if (EDUKE32_PREDICT_FALSE((unsigned)iTile >= MAXTILES)) + { + CON_ERRPRINTF("VM_GetProjectile: invalid projectile (%d)\n", iTile); + return -1; + } + + projectile_t * const proj = g_tile[iTile].proj; + + switch (lLabelID) + { + case PROJ_WORKSLIKE: lLabelID = proj->workslike; break; + case PROJ_SPAWNS: lLabelID = proj->spawns; break; + case PROJ_SXREPEAT: lLabelID = proj->sxrepeat; break; + case PROJ_SYREPEAT: lLabelID = proj->syrepeat; break; + case PROJ_SOUND: lLabelID = proj->sound; break; + case PROJ_ISOUND: lLabelID = proj->isound; break; + case PROJ_VEL: lLabelID = proj->vel; break; + case PROJ_EXTRA: lLabelID = proj->extra; break; + case PROJ_DECAL: lLabelID = proj->decal; break; + case PROJ_TRAIL: lLabelID = proj->trail; break; + case PROJ_TXREPEAT: lLabelID = proj->txrepeat; break; + case PROJ_TYREPEAT: lLabelID = proj->tyrepeat; break; + case PROJ_TOFFSET: lLabelID = proj->toffset; break; + case PROJ_TNUM: lLabelID = proj->tnum; break; + case PROJ_DROP: lLabelID = proj->drop; break; + case PROJ_CSTAT: lLabelID = proj->cstat; break; + case PROJ_CLIPDIST: lLabelID = proj->clipdist; break; + case PROJ_SHADE: lLabelID = proj->shade; break; + case PROJ_XREPEAT: lLabelID = proj->xrepeat; break; + case PROJ_YREPEAT: lLabelID = proj->yrepeat; break; + case PROJ_PAL: lLabelID = proj->pal; break; + case PROJ_EXTRA_RAND: lLabelID = proj->extra_rand; break; + case PROJ_HITRADIUS: lLabelID = proj->hitradius; break; + case PROJ_MOVECNT: lLabelID = proj->movecnt; break; + case PROJ_OFFSET: lLabelID = proj->offset; break; + case PROJ_BOUNCES: lLabelID = proj->bounces; break; + case PROJ_BSOUND: lLabelID = proj->bsound; break; + case PROJ_RANGE: lLabelID = proj->range; break; + case PROJ_FLASH_COLOR: lLabelID = proj->flashcolor; break; + case PROJ_USERDATA: lLabelID = proj->userdata; break; + default: lLabelID = -1; break; + } + + return lLabelID; +} + +void __fastcall VM_SetProjectile(register int32_t const iTile, register int32_t const lLabelID, register int32_t const iSet) +{ + if (EDUKE32_PREDICT_FALSE((unsigned)iTile >= MAXTILES)) + { + CON_ERRPRINTF("VM_SetProjectile: invalid projectile (%d)\n", iTile); + return; + } + + projectile_t * const proj = g_tile[iTile].proj; + + switch (lLabelID) + { + case PROJ_WORKSLIKE: proj->workslike = iSet; break; + case PROJ_SPAWNS: proj->spawns = iSet; break; + case PROJ_SXREPEAT: proj->sxrepeat = iSet; break; + case PROJ_SYREPEAT: proj->syrepeat = iSet; break; + case PROJ_SOUND: proj->sound = iSet; break; + case PROJ_ISOUND: proj->isound = iSet; break; + case PROJ_VEL: proj->vel = iSet; break; + case PROJ_EXTRA: proj->extra = iSet; break; + case PROJ_DECAL: proj->decal = iSet; break; + case PROJ_TRAIL: proj->trail = iSet; break; + case PROJ_TXREPEAT: proj->txrepeat = iSet; break; + case PROJ_TYREPEAT: proj->tyrepeat = iSet; break; + case PROJ_TOFFSET: proj->toffset = iSet; break; + case PROJ_TNUM: proj->tnum = iSet; break; + case PROJ_DROP: proj->drop = iSet; break; + case PROJ_CSTAT: proj->cstat = iSet; break; + case PROJ_CLIPDIST: proj->clipdist = iSet; break; + case PROJ_SHADE: proj->shade = iSet; break; + case PROJ_XREPEAT: proj->xrepeat = iSet; break; + case PROJ_YREPEAT: proj->yrepeat = iSet; break; + case PROJ_PAL: proj->pal = iSet; break; + case PROJ_EXTRA_RAND: proj->extra_rand = iSet; break; + case PROJ_HITRADIUS: proj->hitradius = iSet; break; + case PROJ_MOVECNT: proj->movecnt = iSet; break; + case PROJ_OFFSET: proj->offset = iSet; break; + case PROJ_BOUNCES: proj->bounces = iSet; break; + case PROJ_BSOUND: proj->bsound = iSet; break; + case PROJ_RANGE: proj->range = iSet; break; + case PROJ_FLASH_COLOR: proj->flashcolor = iSet; break; + case PROJ_USERDATA: proj->userdata = iSet; break; + } +} +#endif diff --git a/polymer/eduke32/source/gamevars.c b/polymer/eduke32/source/gamevars.c index 2333a9007..92df5bddb 100644 --- a/polymer/eduke32/source/gamevars.c +++ b/polymer/eduke32/source/gamevars.c @@ -669,7 +669,7 @@ nastyhacks: goto badsprite; } - rv = VM_AccessSpriteX(index, label, indexvar) ^ -negateResult; + rv = VM_GetSprite(index, label, indexvar) ^ -negateResult; break; } @@ -688,7 +688,7 @@ nastyhacks: goto badplayer; } - rv = VM_AccessPlayerX(index, label, indexvar); + rv = VM_GetPlayer(index, label, indexvar); break; } @@ -704,7 +704,7 @@ nastyhacks: insptr++; goto badsector; } - rv = VM_AccessSectorX(index, *insptr++); + rv = VM_GetSector(index, *insptr++); break; case 2: //else if (id == g_iWallVarID) @@ -714,7 +714,7 @@ nastyhacks: insptr++; goto badwall; } - rv = VM_AccessWallX(index, *insptr++); + rv = VM_GetWall(index, *insptr++); break; default: @@ -857,7 +857,7 @@ int32_t __fastcall Gv_GetSpecialVarX(int32_t id) return -1; } - rv = VM_AccessSpriteX(index, label, indexvar); + rv = VM_GetSprite(index, label, indexvar); break; } @@ -878,7 +878,7 @@ int32_t __fastcall Gv_GetSpecialVarX(int32_t id) return -1; } - rv = VM_AccessPlayerX(index, label, indexvar); + rv = VM_GetPlayer(index, label, indexvar); break; } @@ -897,7 +897,7 @@ int32_t __fastcall Gv_GetSpecialVarX(int32_t id) CON_ERRPRINTF("%s %d\n", gvxerrs[GVX_BADSECTOR], id); return -1; } - rv = VM_AccessSectorX(index, *insptr++); + rv = VM_GetSector(index, *insptr++); break; case 2: // else if (id == g_iWallVarID) @@ -908,7 +908,7 @@ int32_t __fastcall Gv_GetSpecialVarX(int32_t id) CON_ERRPRINTF("%s %d\n", gvxerrs[GVX_BADWALL], id); return -1; } - rv = VM_AccessWallX(index, *insptr++); + rv = VM_GetWall(index, *insptr++); break; default: EDUKE32_UNREACHABLE_SECTION(return -1);