diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml index 6da199d37..3c603963d 100644 --- a/.github/workflows/continuous_integration.yml +++ b/.github/workflows/continuous_integration.yml @@ -39,7 +39,7 @@ jobs: name: "Linux GCC 7", os: ubuntu-20.04, extra_options: "-DCMAKE_C_COMPILER=/usr/bin/gcc-7 -DCMAKE_CXX_COMPILER=/usr/bin/g++-7", - deps_cmdline: "sudo apt update && sudo apt install libsdl2-dev libvpx-dev libgtk2.0-dev", + deps_cmdline: "sudo apt update && sudo apt install libsdl2-dev libvpx-dev libgtk2.0-dev gcc-7 g++-7", build_type: "RelWithDebInfo" } - { diff --git a/source/core/binaryangle.h b/source/core/binaryangle.h index e20999581..a34222d1d 100644 --- a/source/core/binaryangle.h +++ b/source/core/binaryangle.h @@ -60,6 +60,7 @@ enum constexpr double BAngRadian = pi::pi() * (1. / 1024.); constexpr double BRadAngScale = 1. / BAngRadian; +constexpr double BAngToDegree = 360. / 2048.; extern int16_t sintable[2048]; @@ -398,6 +399,7 @@ class fixedhoriz friend constexpr fixedhoriz q16horiz(fixed_t v); friend constexpr fixedhoriz buildhoriz(int v); + friend fixedhoriz buildfhoriz(double v); friend fixedhoriz pitchhoriz(double v); friend fixedhoriz bamhoriz(int32_t v); @@ -496,6 +498,7 @@ public: inline constexpr fixedhoriz q16horiz(fixed_t v) { return fixedhoriz(v); } inline constexpr fixedhoriz buildhoriz(int v) { return fixedhoriz(IntToFixed(v)); } +inline fixedhoriz buildfhoriz(double v) { return fixedhoriz(FloatToFixed(v)); } inline fixedhoriz pitchhoriz(double v) { return fixedhoriz(PitchToHoriz(v)); } inline fixedhoriz bamhoriz(int32_t v) { return pitchhoriz(BAMToPitch(v)); } diff --git a/source/core/gamecvars.cpp b/source/core/gamecvars.cpp index 2f974cdbc..7fea2c6f6 100644 --- a/source/core/gamecvars.cpp +++ b/source/core/gamecvars.cpp @@ -77,7 +77,6 @@ CVARD(Bool, cl_slopetilting, false, CVAR_ARCHIVE, "enable/disable slope tilting" CVARD(Int, cl_showweapon, 1, CVAR_ARCHIVE, "enable/disable show weapons") // only implemented in Blood CVARD(Bool, cl_sointerpolation, true, CVAR_ARCHIVE, "enable/disable sector object interpolation") // only implemented in SW CVARD(Bool, cl_syncinput, false, CVAR_ARCHIVE, "enable/disable synchronized input with game's ticrate") // only implemented in Duke -CVARD(Bool, cl_dukefixrpgrecoil, false, CVAR_ARCHIVE, "soften recoil of Duke 3D's RPG") CVARD(Bool, cl_smoothsway, false, CVAR_ARCHIVE, "move SW weapon left and right smoothly while bobbing") CVARD(Bool, cl_showmagamt, false, CVAR_ARCHIVE, "show the amount of rounds left in the magazine of your weapon on the modern HUD") CVARD(Bool, cl_nomeleeblur, false, CVAR_ARCHIVE, "enable/disable blur effect with melee weapons in SW") diff --git a/source/core/gamecvars.h b/source/core/gamecvars.h index 8c92f76c3..fa2115037 100644 --- a/source/core/gamecvars.h +++ b/source/core/gamecvars.h @@ -22,7 +22,6 @@ EXTERN_CVAR(Int, cl_weaponswitch) EXTERN_CVAR(Float, crosshairscale) EXTERN_CVAR(Bool, cl_sointerpolation) EXTERN_CVAR(Bool, cl_syncinput) -EXTERN_CVAR(Bool, cl_dukefixrpgrecoil) EXTERN_CVAR(Bool, cl_smoothsway) EXTERN_CVAR(Bool, cl_showmagamt) EXTERN_CVAR(Bool, cl_nomeleeblur) diff --git a/source/core/gameinput.cpp b/source/core/gameinput.cpp index ebc2e657e..3b61ee70d 100644 --- a/source/core/gameinput.cpp +++ b/source/core/gameinput.cpp @@ -155,8 +155,7 @@ void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlIn int const keymove = gi->playerKeyMove() << running; int const cntrlvelscale = g_gameType & GAMEFLAG_PSEXHUMED ? 8 : 1; float const mousevelscale = keymove / 160.f; - double const angtodegscale = 360. / 2048.; - double const hidspeed = ((running ? 1585. : 867.5) / GameTicRate) * angtodegscale; + double const hidspeed = ((running ? 1585. : 867.5) / GameTicRate) * BAngToDegree; // process mouse and initial controller input. if (buttonMap.ButtonDown(gamefunc_Strafe) && allowstrafe) @@ -200,7 +199,7 @@ void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlIn // allow Exhumed to use its legacy values given the drastic difference from the other games. if ((g_gameType & GAMEFLAG_PSEXHUMED) && cl_exhumedoldturn) { - preambleturn = turnamount = (running ? 12 : 8) * angtodegscale; + preambleturn = turnamount = (running ? 12 : 8) * BAngToDegree; } if (buttonMap.ButtonDown(gamefunc_Turn_Left) || (buttonMap.ButtonDown(gamefunc_Strafe_Left) && !allowstrafe)) diff --git a/source/core/gameinput.h b/source/core/gameinput.h index 357febc07..652cac326 100644 --- a/source/core/gameinput.h +++ b/source/core/gameinput.h @@ -12,8 +12,8 @@ lookangle getincanglebam(binangle a, binangle na); struct PlayerHorizon { - fixedhoriz horiz, ohoriz, horizoff, ohorizoff; - double adjustment, target; + fixedhoriz horiz, ohoriz, horizoff, ohorizoff, target; + double adjustment; void backup() { @@ -44,30 +44,58 @@ struct PlayerHorizon adjustment = 0; } + void settarget(int value, bool backup = false) + { + if (!SyncInput() && !backup) + { + target = buildhoriz(value); + if (target.asq16() == 0) target = q16horiz(1); + } + else + { + horiz = buildhoriz(value); + if (backup) ohoriz = horiz; + } + } + void settarget(double value, bool backup = false) { if (!SyncInput() && !backup) { - target = value * FRACUNIT; - if (target == 0) target += 1; + target = buildfhoriz(value); + if (target.asq16() == 0) target = q16horiz(1); } else { - horiz = q16horiz(FloatToFixed(value)); + horiz = buildfhoriz(value); + if (backup) ohoriz = horiz; + } + } + + void settarget(fixedhoriz value, bool backup = false) + { + if (!SyncInput() && !backup) + { + target = value; + if (target.asq16() == 0) target = q16horiz(1); + } + else + { + horiz = value; if (backup) ohoriz = horiz; } } void processhelpers(double const scaleAdjust) { - if (target) + if (target.asq16()) { - horiz += q16horiz(xs_CRoundToInt(scaleAdjust * (target - horiz.asq16()))); + horiz += q16horiz(xs_CRoundToInt(scaleAdjust * (target - horiz).asq16())); - if (abs(horiz.asq16() - target) < FRACUNIT) + if (abs((horiz - target).asq16()) < FRACUNIT) { - horiz = q16horiz(target); - target = 0; + horiz = target; + target = q16horiz(0); } } else if (adjustment) @@ -97,9 +125,9 @@ struct PlayerHorizon struct PlayerAngle { - binangle ang, oang; + binangle ang, oang, target; lookangle look_ang, olook_ang, rotscrnang, orotscrnang, spin; - double adjustment, target; + double adjustment; void backup() { @@ -172,12 +200,12 @@ struct PlayerAngle { if (!SyncInput() && !backup) { - target = (ang + getincanglebam(ang, buildang(value))).asbam(); - if (target == 0) target += 1; + target = buildang(value & 2047); + if (target.asbam() == 0) target = bamang(1); } else { - ang = buildang(value); + ang = buildang(value & 2047); if (backup) oang = ang; } } @@ -186,12 +214,12 @@ struct PlayerAngle { if (!SyncInput() && !backup) { - target = (ang + getincanglebam(ang, buildfang(value))).asbam(); - if (target == 0) target += 1; + target = buildfang(fmod(value, 2048)); + if (target.asbam() == 0) target = bamang(1); } else { - ang = buildfang(value); + ang = buildfang(fmod(value, 2048)); if (backup) oang = ang; } } @@ -200,8 +228,8 @@ struct PlayerAngle { if (!SyncInput() && !backup) { - target = (ang + getincanglebam(ang, value)).asbam(); - if (target == 0) target += 1; + target = value; + if (target.asbam() == 0) target = bamang(1); } else { @@ -212,14 +240,14 @@ struct PlayerAngle void processhelpers(double const scaleAdjust) { - if (target) + if (target.asbam()) { - ang += bamang(xs_CRoundToUInt(scaleAdjust * (target - ang.asbam()))); + ang += bamang(xs_CRoundToUInt(scaleAdjust * getincanglebam(ang, target).asbam())); - if (abs(ang.asbam() - target) < BAMUNIT) + if (getincanglebam(ang, target).asbam() < BAMUNIT) { - ang = bamang(target); - target = 0; + ang = target; + target = bamang(0); } } else if (adjustment) diff --git a/source/core/inputstate.cpp b/source/core/inputstate.cpp index 98500826a..a87a24219 100644 --- a/source/core/inputstate.cpp +++ b/source/core/inputstate.cpp @@ -119,13 +119,26 @@ void InputState::ClearAllInput() { memset(KeyStatus, 0, sizeof(KeyStatus)); AnyKeyStatus = false; - ActionsToSend = 0; WeaponToSend = 0; dpad_lock = 0; lastCheck = 0; - crouch_toggle = false; + + if (gamestate != GS_LEVEL) + { + ActionsToSend = 0; + crouch_toggle = false; + gi->clearlocalinputstate(); // also clear game local input state. + } + else if (gamestate == GS_LEVEL && crouch_toggle) + { + ActionsToSend |= SB_CROUCH; + } + else + { + ActionsToSend = 0; + } + buttonMap.ResetButtonStates(); // this is important. If all input is cleared, the buttons must be cleared as well. - gi->clearlocalinputstate(); // also clear game local input state. resetTurnHeldAmt(); } diff --git a/source/core/searchpaths.cpp b/source/core/searchpaths.cpp index 7306c734b..7f8c2c457 100644 --- a/source/core/searchpaths.cpp +++ b/source/core/searchpaths.cpp @@ -88,7 +88,7 @@ struct RegistryPathInfo }; static const char * gameroot[] = { "/gameroot", nullptr}; -static const char * swaddons[] = { "/gameroot", "/gameroot/addons", nullptr}; +static const char * swaddons[] = { "/gameroot/addons", "/gameroot", nullptr}; static const char * dukeaddons[] = { "/gameroot", "/gameroot/addons/dc", "/gameroot/addons/nw", "/gameroot/addons/vacation", nullptr}; static const char * dn3d[] = { "/Duke Nukem 3D", nullptr}; static const char * nam[] = { "/NAM", nullptr}; diff --git a/source/games/blood/src/qav.cpp b/source/games/blood/src/qav.cpp index 9fd8d3566..607a73d40 100644 --- a/source/games/blood/src/qav.cpp +++ b/source/games/blood/src/qav.cpp @@ -46,7 +46,7 @@ void DrawFrame(double x, double y, TILE_FRAME *pTile, int stat, int shade, int p { auto tex = tileGetTexture(pTile->picnum); double scale = pTile->z/65536.; - double angle = pTile->angle * (360./2048); + double angle = pTile->angle * BAngToDegree; int renderstyle = (stat & RS_NOMASK)? STYLE_Normal : STYLE_Translucent; double alpha = (stat & RS_TRANS1)? glblend[0].def[!!(stat & RS_TRANS2)].alpha : 1.; int pin = (stat & kQavOrientationLeft)? -1 : (stat & RS_ALIGN_R)? 1:0; diff --git a/source/games/blood/src/view.cpp b/source/games/blood/src/view.cpp index 91cae04e6..d07e2c9da 100644 --- a/source/games/blood/src/view.cpp +++ b/source/games/blood/src/view.cpp @@ -857,7 +857,7 @@ FString GameInterface::GetCoordString() FString out; out.Format("pos= %d, %d, %d - angle = %2.3f", - gMe->pSprite->x, gMe->pSprite->y, gMe->pSprite->z, gMe->pSprite->ang * (360./2048)); + gMe->pSprite->x, gMe->pSprite->y, gMe->pSprite->z, gMe->pSprite->ang * BAngToDegree); return out; } diff --git a/source/games/duke/src/game_misc.cpp b/source/games/duke/src/game_misc.cpp index 72532a3c1..14848af2d 100644 --- a/source/games/duke/src/game_misc.cpp +++ b/source/games/duke/src/game_misc.cpp @@ -575,7 +575,7 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang, else if (j > (65536 << 1)) j = (65536 << 1); DrawTexture(twod, tileGetTexture(i), xdim / 2. + spos.x / 4096., ydim / 2. + spos.y / 4096., DTA_TranslationIndex, TRANSLATION(Translation_Remap + setpal(&pp), pspr->pal), DTA_CenterOffset, true, - DTA_Rotate, daang * (-360./2048), DTA_Color, shadeToLight(pspr->shade), DTA_ScaleX, j / 65536., DTA_ScaleY, j / 65536., TAG_DONE); + DTA_Rotate, daang * -BAngToDegree, DTA_Color, shadeToLight(pspr->shade), DTA_ScaleX, j / 65536., DTA_ScaleY, j / 65536., TAG_DONE); } } return true; diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 0d6c6f540..733879e4b 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -99,7 +99,7 @@ static void DoUserDef(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* { int lValue; - lValue = GetGameVarID((int)lVar2, sActor, sPlayer); + lValue = GetGameVarID(lVar2, sActor, sPlayer); // most settings have been removed because they are either pointless, no longer existent or simply too dangerous to access. // Others have been made read-only. @@ -107,155 +107,155 @@ static void DoUserDef(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* { case USERDEFS_GOD: // redid this so that the script won't be able to disable user-set god mode. if (bSet) ud.god = (ud.god & ~2) | (lValue? 2:0); - else SetGameVarID((int)lVar2, !!ud.god, sActor, sPlayer); + else SetGameVarID(lVar2, !!ud.god, sActor, sPlayer); break; case USERDEFS_CASHMAN: if (bSet) ud.cashman = lValue; - else SetGameVarID((int)lVar2, ud.cashman, sActor, sPlayer); + else SetGameVarID(lVar2, ud.cashman, sActor, sPlayer); break; case USERDEFS_EOG: if (bSet) ud.eog = lValue; - else SetGameVarID((int)lVar2, ud.eog, sActor, sPlayer); + else SetGameVarID(lVar2, ud.eog, sActor, sPlayer); break; case USERDEFS_SHOWALLMAP: if (bSet) gFullMap = lValue; - else SetGameVarID((int)lVar2, gFullMap, sActor, sPlayer); + else SetGameVarID(lVar2, gFullMap, sActor, sPlayer); break; case USERDEFS_SHOWWEAPONS: // Read-only user state. - if (!bSet) SetGameVarID((int)lVar2, cl_showweapon, sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, cl_showweapon, sActor, sPlayer); break; case USERDEFS_FROM_BONUS: if (bSet) ud.from_bonus = lValue; - else SetGameVarID((int)lVar2, ud.from_bonus, sActor, sPlayer); + else SetGameVarID(lVar2, ud.from_bonus, sActor, sPlayer); break; case USERDEFS_CAMERASPRITE: if (bSet) ud.cameraactor = ScriptIndexToActor(lValue); - else SetGameVarID((int)lVar2, ActorToScriptIndex(ud.cameraactor), sActor, sPlayer); + else SetGameVarID(lVar2, ActorToScriptIndex(ud.cameraactor), sActor, sPlayer); break; case USERDEFS_LAST_CAMSPRITE: - if (!bSet) SetGameVarID((int)lVar2, -1, sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, -1, sActor, sPlayer); break; case USERDEFS_LAST_LEVEL: if (bSet) ud.last_level = lValue; - else SetGameVarID((int)lVar2, ud.last_level, sActor, sPlayer); + else SetGameVarID(lVar2, ud.last_level, sActor, sPlayer); break; case USERDEFS_SECRETLEVEL: if (bSet) ud.secretlevel = lValue; - else SetGameVarID((int)lVar2, ud.secretlevel, sActor, sPlayer); + else SetGameVarID(lVar2, ud.secretlevel, sActor, sPlayer); break; case USERDEFS_CONST_VISIBILITY: if (bSet) ud.const_visibility = lValue; - else SetGameVarID((int)lVar2, ud.const_visibility, sActor, sPlayer); + else SetGameVarID(lVar2, ud.const_visibility, sActor, sPlayer); break; case USERDEFS_SHADOWS: if (bSet) ud.shadows = lValue; - else SetGameVarID((int)lVar2, ud.shadows, sActor, sPlayer); + else SetGameVarID(lVar2, ud.shadows, sActor, sPlayer); break; case USERDEFS_M_COOP: - if (!bSet) SetGameVarID((int)lVar2, ud.m_coop, sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, ud.m_coop, sActor, sPlayer); break; case USERDEFS_COOP: - if (!bSet) SetGameVarID((int)lVar2, ud.coop, sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, ud.coop, sActor, sPlayer); break; case USERDEFS_RESPAWN_MONSTERS: if (bSet) ud.respawn_monsters = lValue; - else SetGameVarID((int)lVar2, ud.respawn_monsters, sActor, sPlayer); + else SetGameVarID(lVar2, ud.respawn_monsters, sActor, sPlayer); break; case USERDEFS_RESPAWN_ITEMS: if (bSet) ud.respawn_items = lValue; - else SetGameVarID((int)lVar2, ud.respawn_items, sActor, sPlayer); + else SetGameVarID(lVar2, ud.respawn_items, sActor, sPlayer); break; case USERDEFS_RESPAWN_INVENTORY: if (bSet) ud.respawn_inventory = lValue; - else SetGameVarID((int)lVar2, ud.respawn_inventory, sActor, sPlayer); + else SetGameVarID(lVar2, ud.respawn_inventory, sActor, sPlayer); break; case USERDEFS_RECSTAT: - if (!bSet) SetGameVarID((int)lVar2, ud.recstat, sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, ud.recstat, sActor, sPlayer); break; case USERDEFS_MONSTERS_OFF: if (bSet) ud.monsters_off = lValue; - else SetGameVarID((int)lVar2, ud.monsters_off, sActor, sPlayer); + else SetGameVarID(lVar2, ud.monsters_off, sActor, sPlayer); break; case USERDEFS_BRIGHTNESS: if (bSet) ud.brightness = lValue; - else SetGameVarID((int)lVar2, ud.brightness, sActor, sPlayer); + else SetGameVarID(lVar2, ud.brightness, sActor, sPlayer); break; case USERDEFS_M_RESPAWN_ITEMS: if (bSet) ud.m_respawn_items = lValue; - else SetGameVarID((int)lVar2, ud.m_respawn_items, sActor, sPlayer); + else SetGameVarID(lVar2, ud.m_respawn_items, sActor, sPlayer); break; case USERDEFS_M_RESPAWN_MONSTERS: if (bSet) ud.m_respawn_monsters = lValue; - else SetGameVarID((int)lVar2, ud.m_respawn_monsters, sActor, sPlayer); + else SetGameVarID(lVar2, ud.m_respawn_monsters, sActor, sPlayer); break; case USERDEFS_M_RESPAWN_INVENTORY: if (bSet) ud.m_respawn_inventory = lValue; - else SetGameVarID((int)lVar2, ud.m_respawn_inventory, sActor, sPlayer); + else SetGameVarID(lVar2, ud.m_respawn_inventory, sActor, sPlayer); break; case USERDEFS_M_MONSTERS_OFF: if (bSet) ud.m_monsters_off = lValue; - else SetGameVarID((int)lVar2, ud.m_monsters_off, sActor, sPlayer); + else SetGameVarID(lVar2, ud.m_monsters_off, sActor, sPlayer); break; case USERDEFS_M_FFIRE: if (bSet) ud.m_ffire = lValue; - else SetGameVarID((int)lVar2, ud.m_ffire, sActor, sPlayer); + else SetGameVarID(lVar2, ud.m_ffire, sActor, sPlayer); break; case USERDEFS_FFIRE: if (bSet) ud.ffire = lValue; - else SetGameVarID((int)lVar2, ud.ffire, sActor, sPlayer); + else SetGameVarID(lVar2, ud.ffire, sActor, sPlayer); break; case USERDEFS_MULTIMODE: - if (!bSet) SetGameVarID((int)lVar2, ud.multimode, sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, ud.multimode, sActor, sPlayer); break; case USERDEFS_PLAYER_SKILL: if (bSet) ud.player_skill = lValue; - else SetGameVarID((int)lVar2, ud.player_skill, sActor, sPlayer); + else SetGameVarID(lVar2, ud.player_skill, sActor, sPlayer); break; case USERDEFS_LEVEL_NUMBER: - if (!bSet) SetGameVarID((int)lVar2, mapfromlevelnum(currentLevel->levelNumber), sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, mapfromlevelnum(currentLevel->levelNumber), sActor, sPlayer); break; case USERDEFS_VOLUME_NUMBER: - if (!bSet) SetGameVarID((int)lVar2, volfromlevelnum(currentLevel->levelNumber), sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, volfromlevelnum(currentLevel->levelNumber), sActor, sPlayer); break; case USERDEFS_MARKER: if (bSet) ud.marker = lValue; - else SetGameVarID((int)lVar2, ud.marker, sActor, sPlayer); + else SetGameVarID(lVar2, ud.marker, sActor, sPlayer); break; default: // This will also catch all deleted cases. // make sure that the return value is always defined. - if (!bSet) SetGameVarID((int)lVar2, 0, sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, 0, sActor, sPlayer); break; } return; @@ -268,7 +268,7 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, int lValue; int lTemp; - lValue = GetGameVarID((int)lVar2, sActor, sPlayer); + lValue = GetGameVarID(lVar2, sActor, sPlayer); if (lVar1 == g_iThisActorID) { @@ -277,7 +277,7 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, } else { - iPlayer = GetGameVarID((int)lVar1, sActor, sPlayer); + iPlayer = GetGameVarID(lVar1, sActor, sPlayer); } if (iPlayer < 0 || iPlayer >= MAXPLAYERS) @@ -286,629 +286,636 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, switch (lLabelID) { case PLAYER_ZOOM: - SetGameVarID((int)lVar2, 768, sActor, sPlayer); //return default for AM zoom. + SetGameVarID(lVar2, 768, sActor, sPlayer); //return default for AM zoom. break; case PLAYER_EXITX: if (bSet) ps[iPlayer].exitx = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].exitx, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].exitx, sActor, sPlayer); break; case PLAYER_EXITY: if (bSet) ps[iPlayer].exity = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].exity, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].exity, sActor, sPlayer); break; case PLAYER_LOOGIEX: if (bSet) ps[iPlayer].loogiex[lParm2] = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].loogiex[lParm2], sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].loogiex[lParm2], sActor, sPlayer); break; case PLAYER_LOOGIEY: if (bSet) ps[iPlayer].loogiey[lParm2] = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].loogiey[lParm2], sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].loogiey[lParm2], sActor, sPlayer); break; case PLAYER_NUMLOOGS: if (bSet) ps[iPlayer].numloogs = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].numloogs, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].numloogs, sActor, sPlayer); break; case PLAYER_LOOGCNT: if (bSet) ps[iPlayer].loogcnt = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].loogcnt, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].loogcnt, sActor, sPlayer); break; case PLAYER_POSX: // oh, my... :( Writing to these has been disabled until I know how to do it without the engine shitting all over itself. - if (!bSet) SetGameVarID((int)lVar2, ps[iPlayer].posx, sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, ps[iPlayer].posx, sActor, sPlayer); break; case PLAYER_POSY: - if (!bSet) SetGameVarID((int)lVar2, ps[iPlayer].posy, sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, ps[iPlayer].posy, sActor, sPlayer); break; case PLAYER_POSZ: - if (!bSet) SetGameVarID((int)lVar2, ps[iPlayer].posz, sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, ps[iPlayer].posz, sActor, sPlayer); break; case PLAYER_HORIZ: - if (bSet) ps[iPlayer].horizon.settarget(lValue - 100); - else SetGameVarID((int)lVar2, ps[iPlayer].horizon.horiz.asbuild() + 100, sActor, sPlayer); + if (bSet) + { + if (ps[iPlayer].sync.actions & SB_CENTERVIEW) + { + ps[iPlayer].sync.actions &= ~SB_CENTERVIEW; + } + ps[iPlayer].horizon.settarget(lValue); + } + else SetGameVarID(lVar2, ps[iPlayer].horizon.horiz.asbuild(), sActor, sPlayer); break; case PLAYER_OHORIZ: - if (!bSet) SetGameVarID((int)lVar2, ps[iPlayer].horizon.ohoriz.asbuild() + 100, sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, ps[iPlayer].horizon.ohoriz.asbuild(), sActor, sPlayer); break; case PLAYER_HORIZOFF: if (bSet) ps[iPlayer].horizon.horizoff = buildhoriz(lValue); - else SetGameVarID((int)lVar2, ps[iPlayer].horizon.horizoff.asbuild(), sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].horizon.horizoff.asbuild(), sActor, sPlayer); break; case PLAYER_OHORIZOFF: - if (!bSet) SetGameVarID((int)lVar2, ps[iPlayer].horizon.ohorizoff.asbuild(), sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, ps[iPlayer].horizon.ohorizoff.asbuild(), sActor, sPlayer); break; case PLAYER_INVDISPTIME: if (bSet) ps[iPlayer].invdisptime = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].invdisptime, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].invdisptime, sActor, sPlayer); break; case PLAYER_BOBPOSX: if (bSet) ps[iPlayer].bobposx = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].bobposx, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].bobposx, sActor, sPlayer); break; case PLAYER_BOBPOSY: if (bSet) ps[iPlayer].bobposy = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].bobposy, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].bobposy, sActor, sPlayer); break; case PLAYER_OPOSX: if (bSet) ps[iPlayer].oposx = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].oposx, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].oposx, sActor, sPlayer); break; case PLAYER_OPOSY: if (bSet) ps[iPlayer].oposy = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].oposy, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].oposy, sActor, sPlayer); break; case PLAYER_OPOSZ: if (bSet) ps[iPlayer].oposz = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].oposz, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].oposz, sActor, sPlayer); break; case PLAYER_PYOFF: if (bSet) ps[iPlayer].pyoff = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].pyoff, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].pyoff, sActor, sPlayer); break; case PLAYER_OPYOFF: if (bSet) ps[iPlayer].opyoff = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].opyoff, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].opyoff, sActor, sPlayer); break; case PLAYER_POSXV: if (bSet) ps[iPlayer].posxv = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].posxv, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].posxv, sActor, sPlayer); break; case PLAYER_POSYV: if (bSet) ps[iPlayer].posyv = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].posyv, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].posyv, sActor, sPlayer); break; case PLAYER_POSZV: if (bSet) ps[iPlayer].poszv = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].poszv, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].poszv, sActor, sPlayer); break; case PLAYER_LAST_PISSED_TIME: if (bSet) ps[iPlayer].last_pissed_time = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].last_pissed_time, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].last_pissed_time, sActor, sPlayer); break; case PLAYER_TRUEFZ: if (bSet) ps[iPlayer].truefz = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].truefz, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].truefz, sActor, sPlayer); break; case PLAYER_TRUECZ: if (bSet) ps[iPlayer].truecz = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].truecz, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].truecz, sActor, sPlayer); break; case PLAYER_PLAYER_PAR: if (bSet) ps[iPlayer].player_par = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].player_par, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].player_par, sActor, sPlayer); break; case PLAYER_VISIBILITY: if (bSet) ps[iPlayer].visibility = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].visibility, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].visibility, sActor, sPlayer); break; case PLAYER_BOBCOUNTER: if (bSet) ps[iPlayer].bobcounter = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].bobcounter, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].bobcounter, sActor, sPlayer); break; case PLAYER_WEAPON_SWAY: if (bSet) ps[iPlayer].weapon_sway = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].weapon_sway, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].weapon_sway, sActor, sPlayer); break; case PLAYER_PALS_TIME: if (bSet) ps[iPlayer].pals.a = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].pals.a, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].pals.a, sActor, sPlayer); break; case PLAYER_RANDOMFLAMEX: if (bSet) ps[iPlayer].randomflamex = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].randomflamex, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].randomflamex, sActor, sPlayer); break; case PLAYER_CRACK_TIME: if (bSet) ps[iPlayer].crack_time = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].crack_time, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].crack_time, sActor, sPlayer); break; case PLAYER_AIM_MODE: // game has no business enforcing this in any way. - if (!bSet) SetGameVarID((int)lVar2, ps[iPlayer].aim_mode, sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, ps[iPlayer].aim_mode, sActor, sPlayer); break; case PLAYER_ANG: if (bSet) ps[iPlayer].angle.settarget(lValue); - else SetGameVarID((int)lVar2, ps[iPlayer].angle.ang.asbuild(), sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].angle.ang.asbuild(), sActor, sPlayer); break; case PLAYER_OANG: - if (!bSet) SetGameVarID((int)lVar2, ps[iPlayer].angle.oang.asbuild(), sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, ps[iPlayer].angle.oang.asbuild(), sActor, sPlayer); break; case PLAYER_ANGVEL: // This no longer exists. - if (!bSet) SetGameVarID((int)lVar2, 0, sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, 0, sActor, sPlayer); break; case PLAYER_CURSECTNUM: if (bSet) ps[iPlayer].cursectnum = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].cursectnum, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].cursectnum, sActor, sPlayer); break; case PLAYER_LOOK_ANG: if (bSet) ps[iPlayer].angle.look_ang = buildlook(lValue); - else SetGameVarID((int)lVar2, ps[iPlayer].angle.look_ang.asbuild(), sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].angle.look_ang.asbuild(), sActor, sPlayer); break; case PLAYER_LAST_EXTRA: if (bSet) ps[iPlayer].last_extra = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].last_extra, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].last_extra, sActor, sPlayer); break; case PLAYER_SUBWEAPON: if (bSet) ps[iPlayer].subweapon = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].subweapon, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].subweapon, sActor, sPlayer); break; case PLAYER_AMMO_AMOUNT: - lTemp = GetGameVarID((int)lParm2, sActor, sPlayer); + lTemp = GetGameVarID(lParm2, sActor, sPlayer); if (bSet) ps[iPlayer].ammo_amount[lTemp] = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].ammo_amount[lTemp], sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].ammo_amount[lTemp], sActor, sPlayer); break; case PLAYER_WACKEDBYACTOR: if (bSet) ps[iPlayer].wackedbyactor = ScriptIndexToActor(lValue); - else SetGameVarID((int)lVar2, ActorToScriptIndex(ps[iPlayer].wackedbyactor), sActor, sPlayer); + else SetGameVarID(lVar2, ActorToScriptIndex(ps[iPlayer].wackedbyactor), sActor, sPlayer); break; case PLAYER_FRAG: if (bSet) ps[iPlayer].frag = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].frag, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].frag, sActor, sPlayer); break; case PLAYER_FRAGGEDSELF: if (bSet) ps[iPlayer].fraggedself = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].fraggedself, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].fraggedself, sActor, sPlayer); break; case PLAYER_CURR_WEAPON: if (bSet) ps[iPlayer].curr_weapon = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].curr_weapon, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].curr_weapon, sActor, sPlayer); break; case PLAYER_LAST_WEAPON: if (bSet) ps[iPlayer].last_weapon = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].last_weapon, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].last_weapon, sActor, sPlayer); break; case PLAYER_TIPINCS: if (bSet) ps[iPlayer].tipincs = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].tipincs, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].tipincs, sActor, sPlayer); break; case PLAYER_WANTWEAPONFIRE: if (bSet) ps[iPlayer].wantweaponfire = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].wantweaponfire, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].wantweaponfire, sActor, sPlayer); break; case PLAYER_HOLODUKE_AMOUNT: if (bSet) ps[iPlayer].holoduke_amount = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].holoduke_amount, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].holoduke_amount, sActor, sPlayer); break; case PLAYER_NEWOWNER: if (bSet) ps[iPlayer].newOwner = ScriptIndexToActor(lValue); - else SetGameVarID((int)lVar2, ActorToScriptIndex(ps[iPlayer].newOwner), sActor, sPlayer); + else SetGameVarID(lVar2, ActorToScriptIndex(ps[iPlayer].newOwner), sActor, sPlayer); break; case PLAYER_HURT_DELAY: if (bSet) ps[iPlayer].hurt_delay = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].hurt_delay, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].hurt_delay, sActor, sPlayer); break; case PLAYER_HBOMB_HOLD_DELAY: if (bSet) ps[iPlayer].hbomb_hold_delay = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].hbomb_hold_delay, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].hbomb_hold_delay, sActor, sPlayer); break; case PLAYER_JUMPING_COUNTER: if (bSet) ps[iPlayer].jumping_counter = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].jumping_counter, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].jumping_counter, sActor, sPlayer); break; case PLAYER_AIRLEFT: if (bSet) ps[iPlayer].airleft = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].airleft, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].airleft, sActor, sPlayer); break; case PLAYER_KNEE_INCS: if (bSet) ps[iPlayer].knee_incs = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].knee_incs, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].knee_incs, sActor, sPlayer); break; case PLAYER_ACCESS_INCS: if (bSet) ps[iPlayer].access_incs = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].access_incs, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].access_incs, sActor, sPlayer); break; case PLAYER_ACCESS_WALLNUM: if (bSet) ps[iPlayer].access_wallnum = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].access_wallnum, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].access_wallnum, sActor, sPlayer); break; case PLAYER_ACCESS_SPRITENUM: if (bSet) ps[iPlayer].access_spritenum = ScriptIndexToActor(lValue); - else SetGameVarID((int)lVar2, ActorToScriptIndex(ps[iPlayer].access_spritenum), sActor, sPlayer); + else SetGameVarID(lVar2, ActorToScriptIndex(ps[iPlayer].access_spritenum), sActor, sPlayer); break; case PLAYER_KICKBACK_PIC: if (bSet) ps[iPlayer].kickback_pic = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].kickback_pic, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].kickback_pic, sActor, sPlayer); break; case PLAYER_GOT_ACCESS: if (bSet) ps[iPlayer].got_access = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].got_access, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].got_access, sActor, sPlayer); break; case PLAYER_WEAPON_ANG: if (bSet) ps[iPlayer].weapon_ang = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].weapon_ang, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].weapon_ang, sActor, sPlayer); break; case PLAYER_FIRSTAID_AMOUNT: if (bSet) ps[iPlayer].firstaid_amount = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].firstaid_amount, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].firstaid_amount, sActor, sPlayer); break; case PLAYER_SOMETHINGONPLAYER: if (bSet) ps[iPlayer].somethingonplayer = ScriptIndexToActor(lValue); - else SetGameVarID((int)lVar2, ActorToScriptIndex(ps[iPlayer].somethingonplayer), sActor, sPlayer); + else SetGameVarID(lVar2, ActorToScriptIndex(ps[iPlayer].somethingonplayer), sActor, sPlayer); break; case PLAYER_ON_CRANE: if (bSet) ps[iPlayer].on_crane = ScriptIndexToActor(lValue); - else SetGameVarID((int)lVar2, ActorToScriptIndex(ps[iPlayer].on_crane), sActor, sPlayer); + else SetGameVarID(lVar2, ActorToScriptIndex(ps[iPlayer].on_crane), sActor, sPlayer); break; case PLAYER_I: // This is dangerous!!! if (bSet) ps[iPlayer].i = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].i, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].i, sActor, sPlayer); break; case PLAYER_ONE_PARALLAX_SECTNUM: if (bSet) ps[iPlayer].one_parallax_sectnum = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].one_parallax_sectnum, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].one_parallax_sectnum, sActor, sPlayer); break; case PLAYER_OVER_SHOULDER_ON: if (bSet) ps[iPlayer].over_shoulder_on = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].over_shoulder_on, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].over_shoulder_on, sActor, sPlayer); break; case PLAYER_RANDOM_CLUB_FRAME: if (bSet) ps[iPlayer].random_club_frame = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].random_club_frame, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].random_club_frame, sActor, sPlayer); break; case PLAYER_FIST_INCS: if (bSet) ps[iPlayer].fist_incs = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].fist_incs, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].fist_incs, sActor, sPlayer); break; case PLAYER_ONE_EIGHTY_COUNT: if (bSet) ps[iPlayer].angle.spin = buildlook(lValue); - else SetGameVarID((int)lVar2, ps[iPlayer].angle.spin.asbuild(), sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].angle.spin.asbuild(), sActor, sPlayer); break; case PLAYER_CHEAT_PHASE: if (bSet) ps[iPlayer].cheat_phase = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].cheat_phase, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].cheat_phase, sActor, sPlayer); break; case PLAYER_DUMMYPLAYERSPRITE: if (bSet) ps[iPlayer].dummyplayersprite = ScriptIndexToActor(lValue); - else SetGameVarID((int)lVar2, ActorToScriptIndex(ps[iPlayer].dummyplayersprite), sActor, sPlayer); + else SetGameVarID(lVar2, ActorToScriptIndex(ps[iPlayer].dummyplayersprite), sActor, sPlayer); break; case PLAYER_EXTRA_EXTRA8: if (bSet) ps[iPlayer].extra_extra8 = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].extra_extra8, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].extra_extra8, sActor, sPlayer); break; case PLAYER_QUICK_KICK: if (bSet) ps[iPlayer].quick_kick = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].quick_kick, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].quick_kick, sActor, sPlayer); break; case PLAYER_HEAT_AMOUNT: if (bSet) ps[iPlayer].heat_amount = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].heat_amount, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].heat_amount, sActor, sPlayer); break; case PLAYER_ACTORSQU: if (bSet) ps[iPlayer].actorsqu = ScriptIndexToActor(lValue); - else SetGameVarID((int)lVar2, ActorToScriptIndex(ps[iPlayer].actorsqu), sActor, sPlayer); + else SetGameVarID(lVar2, ActorToScriptIndex(ps[iPlayer].actorsqu), sActor, sPlayer); break; case PLAYER_TIMEBEFOREEXIT: if (bSet) ps[iPlayer].timebeforeexit = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].timebeforeexit, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].timebeforeexit, sActor, sPlayer); break; case PLAYER_CUSTOMEXITSOUND: if (bSet) ps[iPlayer].customexitsound = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].customexitsound, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].customexitsound, sActor, sPlayer); break; case PLAYER_WEAPRECS: if (bSet) ps[iPlayer].weaprecs[lParm2] = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].weaprecs[lParm2], sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].weaprecs[lParm2], sActor, sPlayer); break; case PLAYER_WEAPRECCNT: if (bSet) ps[iPlayer].weapreccnt = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].weapreccnt, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].weapreccnt, sActor, sPlayer); break; case PLAYER_INTERFACE_TOGGLE_FLAG: if (bSet) ps[iPlayer].interface_toggle_flag = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].interface_toggle_flag, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].interface_toggle_flag, sActor, sPlayer); break; case PLAYER_ROTSCRNANG: if (bSet) ps[iPlayer].angle.rotscrnang = buildlook(lValue); - else SetGameVarID((int)lVar2, ps[iPlayer].angle.rotscrnang.asbuild(), sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].angle.rotscrnang.asbuild(), sActor, sPlayer); break; case PLAYER_DEAD_FLAG: if (bSet) ps[iPlayer].dead_flag = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].dead_flag, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].dead_flag, sActor, sPlayer); break; case PLAYER_SHOW_EMPTY_WEAPON: if (bSet) ps[iPlayer].show_empty_weapon = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].show_empty_weapon, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].show_empty_weapon, sActor, sPlayer); break; case PLAYER_SCUBA_AMOUNT: if (bSet) ps[iPlayer].scuba_amount = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].scuba_amount, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].scuba_amount, sActor, sPlayer); break; case PLAYER_JETPACK_AMOUNT: if (bSet) ps[iPlayer].jetpack_amount = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].jetpack_amount, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].jetpack_amount, sActor, sPlayer); break; case PLAYER_STEROIDS_AMOUNT: if (bSet) ps[iPlayer].steroids_amount = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].steroids_amount, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].steroids_amount, sActor, sPlayer); break; case PLAYER_SHIELD_AMOUNT: if (bSet) ps[iPlayer].shield_amount = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].shield_amount, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].shield_amount, sActor, sPlayer); break; case PLAYER_HOLODUKE_ON: if (bSet) ps[iPlayer].holoduke_on = ScriptIndexToActor(lValue); - else SetGameVarID((int)lVar2, ActorToScriptIndex(ps[iPlayer].holoduke_on), sActor, sPlayer); + else SetGameVarID(lVar2, ActorToScriptIndex(ps[iPlayer].holoduke_on), sActor, sPlayer); break; case PLAYER_PYCOUNT: if (bSet) ps[iPlayer].pycount = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].pycount, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].pycount, sActor, sPlayer); break; case PLAYER_WEAPON_POS: if (bSet) ps[iPlayer].weapon_pos = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].weapon_pos, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].weapon_pos, sActor, sPlayer); break; case PLAYER_FRAG_PS: if (bSet) ps[iPlayer].frag_ps = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].frag_ps, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].frag_ps, sActor, sPlayer); break; case PLAYER_TRANSPORTER_HOLD: if (bSet) ps[iPlayer].transporter_hold = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].transporter_hold, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].transporter_hold, sActor, sPlayer); break; case PLAYER_LAST_FULL_WEAPON: if (bSet) ps[iPlayer].last_full_weapon = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].last_full_weapon, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].last_full_weapon, sActor, sPlayer); break; case PLAYER_FOOTPRINTSHADE: if (bSet) ps[iPlayer].footprintshade = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].footprintshade, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].footprintshade, sActor, sPlayer); break; case PLAYER_BOOT_AMOUNT: if (bSet) ps[iPlayer].boot_amount = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].boot_amount, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].boot_amount, sActor, sPlayer); break; case PLAYER_GM: - if (!bSet) SetGameVarID((int)lVar2, MODE_GAME, sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, MODE_GAME, sActor, sPlayer); break; case PLAYER_ON_WARPING_SECTOR: if (bSet) ps[iPlayer].on_warping_sector = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].on_warping_sector, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].on_warping_sector, sActor, sPlayer); break; case PLAYER_FOOTPRINTCOUNT: if (bSet) ps[iPlayer].footprintcount = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].footprintcount, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].footprintcount, sActor, sPlayer); break; case PLAYER_HBOMB_ON: if (bSet) ps[iPlayer].hbomb_on = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].hbomb_on, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].hbomb_on, sActor, sPlayer); break; case PLAYER_JUMPING_TOGGLE: if (bSet) ps[iPlayer].jumping_toggle = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].jumping_toggle, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].jumping_toggle, sActor, sPlayer); break; case PLAYER_RAPID_FIRE_HOLD: if (bSet) ps[iPlayer].rapid_fire_hold = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].rapid_fire_hold, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].rapid_fire_hold, sActor, sPlayer); break; case PLAYER_ON_GROUND: if (bSet) ps[iPlayer].on_ground = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].on_ground, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].on_ground, sActor, sPlayer); break; case PLAYER_INVEN_ICON: if (bSet) ps[iPlayer].inven_icon = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].inven_icon, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].inven_icon, sActor, sPlayer); break; case PLAYER_BUTTONPALETTE: if (bSet) ps[iPlayer].buttonpalette = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].buttonpalette, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].buttonpalette, sActor, sPlayer); break; case PLAYER_JETPACK_ON: if (bSet) ps[iPlayer].jetpack_on = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].jetpack_on, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].jetpack_on, sActor, sPlayer); break; case PLAYER_SPRITEBRIDGE: if (bSet) ps[iPlayer].spritebridge = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].spritebridge, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].spritebridge, sActor, sPlayer); break; case PLAYER_LASTRANDOMSPOT: if (bSet) ps[iPlayer].lastrandomspot = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].lastrandomspot, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].lastrandomspot, sActor, sPlayer); break; case PLAYER_SCUBA_ON: if (bSet) ps[iPlayer].scuba_on = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].scuba_on, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].scuba_on, sActor, sPlayer); break; case PLAYER_FOOTPRINTPAL: if (bSet) ps[iPlayer].footprintpal = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].footprintpal, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].footprintpal, sActor, sPlayer); break; case PLAYER_HEAT_ON: if (bSet) ps[iPlayer].heat_on = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].heat_on, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].heat_on, sActor, sPlayer); break; case PLAYER_HOLSTER_WEAPON: if (bSet) ps[iPlayer].holster_weapon = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].holster_weapon, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].holster_weapon, sActor, sPlayer); break; case PLAYER_FALLING_COUNTER: if (bSet) ps[iPlayer].falling_counter = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].falling_counter, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].falling_counter, sActor, sPlayer); break; case PLAYER_GOTWEAPON: if (bSet) ps[iPlayer].gotweapon.Set(lParm2, lValue); - else SetGameVarID((int)lVar2, ps[iPlayer].gotweapon[lParm2], sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].gotweapon[lParm2], sActor, sPlayer); break; case PLAYER_REFRESH_INVENTORY: if (bSet) ps[iPlayer].refresh_inventory = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].refresh_inventory, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].refresh_inventory, sActor, sPlayer); break; case PLAYER_TOGGLE_KEY_FLAG: if (bSet) ps[iPlayer].toggle_key_flag = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].toggle_key_flag, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].toggle_key_flag, sActor, sPlayer); break; case PLAYER_KNUCKLE_INCS: if (bSet) ps[iPlayer].knuckle_incs = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].knuckle_incs, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].knuckle_incs, sActor, sPlayer); break; case PLAYER_WALKING_SND_TOGGLE: if (bSet) ps[iPlayer].walking_snd_toggle = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].walking_snd_toggle, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].walking_snd_toggle, sActor, sPlayer); break; case PLAYER_PALOOKUP: if (bSet) ps[iPlayer].palookup = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].palookup, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].palookup, sActor, sPlayer); break; case PLAYER_HARD_LANDING: if (bSet) ps[iPlayer].hard_landing = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].hard_landing, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].hard_landing, sActor, sPlayer); break; case PLAYER_MAX_SECRET_ROOMS: if (bSet) ps[iPlayer].max_secret_rooms = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].max_secret_rooms, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].max_secret_rooms, sActor, sPlayer); break; case PLAYER_SECRET_ROOMS: if (bSet) ps[iPlayer].secret_rooms = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].secret_rooms, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].secret_rooms, sActor, sPlayer); break; case PLAYER_MAX_ACTORS_KILLED: if (bSet) ps[iPlayer].max_actors_killed = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].max_actors_killed, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].max_actors_killed, sActor, sPlayer); break; case PLAYER_ACTORS_KILLED: if (bSet) ps[iPlayer].actors_killed = lValue; - else SetGameVarID((int)lVar2, ps[iPlayer].actors_killed, sActor, sPlayer); + else SetGameVarID(lVar2, ps[iPlayer].actors_killed, sActor, sPlayer); break; case PLAYER_RETURN_TO_CENTER: @@ -919,12 +926,12 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, else { auto center = ps[iPlayer].sync.actions & SB_CENTERVIEW ? xs_CRoundToInt(ps[iPlayer].horizon.horiz.asq16() * (9. / gi->playerHorizMax())) : 0; - SetGameVarID((int)lVar2, center, sActor, sPlayer); + SetGameVarID(lVar2, center, sActor, sPlayer); } break; default: - if (!bSet) SetGameVarID((int)lVar2, 0, sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, 0, sActor, sPlayer); break; } return; @@ -936,13 +943,13 @@ void DoWall(char bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, s int iWall; int lValue; - lValue = GetGameVarID((int)lVar2, sActor, sPlayer); + lValue = GetGameVarID(lVar2, sActor, sPlayer); - iWall = GetGameVarID((int)lVar1, sActor, sPlayer); + iWall = GetGameVarID(lVar1, sActor, sPlayer); if (iWall < 0 || iWall >= numwalls) { - if (!bSet) SetGameVarID((int)lVar2, 0, sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, 0, sActor, sPlayer); return; } @@ -950,67 +957,67 @@ void DoWall(char bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, s switch (lLabelID) { case WALL_X: - if (!bSet) SetGameVarID((int)lVar2, wall[iWall].x, sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, wall[iWall].x, sActor, sPlayer); break; case WALL_Y: - if (bSet) SetGameVarID((int)lVar2, wall[iWall].y, sActor, sPlayer); + if (bSet) SetGameVarID(lVar2, wall[iWall].y, sActor, sPlayer); break; case WALL_POINT2: - if (!bSet) SetGameVarID((int)lVar2, wall[iWall].point2, sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, wall[iWall].point2, sActor, sPlayer); break; case WALL_NEXTWALL: - if (!bSet) SetGameVarID((int)lVar2, wall[iWall].nextwall, sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, wall[iWall].nextwall, sActor, sPlayer); break; case WALL_NEXTSECTOR: - if (!bSet) SetGameVarID((int)lVar2, wall[iWall].nextsector, sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, wall[iWall].nextsector, sActor, sPlayer); break; case WALL_CSTAT: if (bSet) wall[iWall].cstat = lValue; - else SetGameVarID((int)lVar2, wall[iWall].cstat, sActor, sPlayer); + else SetGameVarID(lVar2, wall[iWall].cstat, sActor, sPlayer); break; case WALL_PICNUM: if (bSet) wall[iWall].picnum = lValue; - else SetGameVarID((int)lVar2, wall[iWall].picnum, sActor, sPlayer); + else SetGameVarID(lVar2, wall[iWall].picnum, sActor, sPlayer); break; case WALL_OVERPICNUM: if (bSet) wall[iWall].overpicnum = lValue; - else SetGameVarID((int)lVar2, wall[iWall].overpicnum, sActor, sPlayer); + else SetGameVarID(lVar2, wall[iWall].overpicnum, sActor, sPlayer); break; case WALL_SHADE: if (bSet) wall[iWall].shade = lValue; - else SetGameVarID((int)lVar2, wall[iWall].shade, sActor, sPlayer); + else SetGameVarID(lVar2, wall[iWall].shade, sActor, sPlayer); break; case WALL_PAL: if (bSet) wall[iWall].pal = lValue; - else SetGameVarID((int)lVar2, wall[iWall].pal, sActor, sPlayer); + else SetGameVarID(lVar2, wall[iWall].pal, sActor, sPlayer); break; case WALL_XREPEAT: if (bSet) wall[iWall].xrepeat = lValue; - else SetGameVarID((int)lVar2, wall[iWall].xrepeat, sActor, sPlayer); + else SetGameVarID(lVar2, wall[iWall].xrepeat, sActor, sPlayer); break; case WALL_YREPEAT: if (bSet) wall[iWall].yrepeat = lValue; - else SetGameVarID((int)lVar2, wall[iWall].yrepeat, sActor, sPlayer); + else SetGameVarID(lVar2, wall[iWall].yrepeat, sActor, sPlayer); break; case WALL_XPANNING: if (bSet) wall[iWall].xpan_ = lValue; - else SetGameVarID((int)lVar2, wall[iWall].xpan(), sActor, sPlayer); + else SetGameVarID(lVar2, wall[iWall].xpan(), sActor, sPlayer); break; case WALL_YPANNING: if (bSet) wall[iWall].ypan_ = lValue; - else SetGameVarID((int)lVar2, wall[iWall].ypan(), sActor, sPlayer); + else SetGameVarID(lVar2, wall[iWall].ypan(), sActor, sPlayer); break; case WALL_LOTAG: if (bSet) wall[iWall].lotag = lValue; - else SetGameVarID((int)lVar2, wall[iWall].lotag, sActor, sPlayer); + else SetGameVarID(lVar2, wall[iWall].lotag, sActor, sPlayer); break; case WALL_HITAG: if (bSet) wall[iWall].hitag = lValue; - else SetGameVarID((int)lVar2, wall[iWall].hitag, sActor, sPlayer); + else SetGameVarID(lVar2, wall[iWall].hitag, sActor, sPlayer); break; case WALL_EXTRA: if (bSet) wall[iWall].extra = lValue; - else SetGameVarID((int)lVar2, wall[iWall].extra, sActor, sPlayer); + else SetGameVarID(lVar2, wall[iWall].extra, sActor, sPlayer); break; default: break; @@ -1030,105 +1037,105 @@ void DoSector(char bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, } else { - iSector = GetGameVarID((int)lVar1, sActor, sPlayer); + iSector = GetGameVarID(lVar1, sActor, sPlayer); } if (iSector < 0 || iSector >= numsectors) { - if (!bSet) SetGameVarID((int)lVar2, 0, sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, 0, sActor, sPlayer); return; } - lValue = GetGameVarID((int)lVar2, sActor, sPlayer); + lValue = GetGameVarID(lVar2, sActor, sPlayer); // All fields affecting map geometry have been made read-only! switch (lLabelID) { case SECTOR_WALLPTR: - if (!bSet) SetGameVarID((int)lVar2, sector[iSector].wallptr, sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, sector[iSector].wallptr, sActor, sPlayer); break; case SECTOR_WALLNUM: - if (!bSet) SetGameVarID((int)lVar2, sector[iSector].wallnum, sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, sector[iSector].wallnum, sActor, sPlayer); break; case SECTOR_CEILINGZ: if (bSet) sector[iSector].ceilingz = lValue; - else SetGameVarID((int)lVar2, sector[iSector].ceilingz, sActor, sPlayer); + else SetGameVarID(lVar2, sector[iSector].ceilingz, sActor, sPlayer); break; case SECTOR_FLOORZ: if (bSet) sector[iSector].floorz = lValue; - else SetGameVarID((int)lVar2, sector[iSector].floorz, sActor, sPlayer); + else SetGameVarID(lVar2, sector[iSector].floorz, sActor, sPlayer); break; case SECTOR_CEILINGSTAT: if (bSet) sector[iSector].ceilingstat = lValue; - else SetGameVarID((int)lVar2, sector[iSector].ceilingstat, sActor, sPlayer); + else SetGameVarID(lVar2, sector[iSector].ceilingstat, sActor, sPlayer); break; case SECTOR_FLOORSTAT: if (bSet) sector[iSector].floorstat = lValue; - else SetGameVarID((int)lVar2, sector[iSector].floorstat, sActor, sPlayer); + else SetGameVarID(lVar2, sector[iSector].floorstat, sActor, sPlayer); break; case SECTOR_CEILINGPICNUM: if (bSet) sector[iSector].ceilingpicnum = lValue; - else SetGameVarID((int)lVar2, sector[iSector].ceilingpicnum, sActor, sPlayer); + else SetGameVarID(lVar2, sector[iSector].ceilingpicnum, sActor, sPlayer); break; case SECTOR_CEILINGSLOPE: if (bSet) sector[iSector].ceilingheinum = lValue; - else SetGameVarID((int)lVar2, sector[iSector].ceilingheinum, sActor, sPlayer); + else SetGameVarID(lVar2, sector[iSector].ceilingheinum, sActor, sPlayer); break; case SECTOR_CEILINGSHADE: if (bSet) sector[iSector].ceilingshade = lValue; - else SetGameVarID((int)lVar2, sector[iSector].ceilingshade, sActor, sPlayer); + else SetGameVarID(lVar2, sector[iSector].ceilingshade, sActor, sPlayer); break; case SECTOR_CEILINGPAL: if (bSet) sector[iSector].ceilingpal = lValue; - else SetGameVarID((int)lVar2, sector[iSector].ceilingpal, sActor, sPlayer); + else SetGameVarID(lVar2, sector[iSector].ceilingpal, sActor, sPlayer); break; case SECTOR_CEILINGXPANNING: if (bSet) sector[iSector].ceilingxpan_ = lValue; - else SetGameVarID((int)lVar2, sector[iSector].ceilingxpan(), sActor, sPlayer); + else SetGameVarID(lVar2, sector[iSector].ceilingxpan(), sActor, sPlayer); break; case SECTOR_CEILINGYPANNING: if (bSet) sector[iSector].ceilingypan_ = lValue; - else SetGameVarID((int)lVar2, sector[iSector].ceilingypan(), sActor, sPlayer); + else SetGameVarID(lVar2, sector[iSector].ceilingypan(), sActor, sPlayer); break; case SECTOR_FLOORPICNUM: if (bSet) sector[iSector].floorpicnum = lValue; - else SetGameVarID((int)lVar2, sector[iSector].floorpicnum, sActor, sPlayer); + else SetGameVarID(lVar2, sector[iSector].floorpicnum, sActor, sPlayer); break; case SECTOR_FLOORSLOPE: if (bSet) sector[iSector].floorheinum = lValue; - else SetGameVarID((int)lVar2, sector[iSector].floorheinum, sActor, sPlayer); + else SetGameVarID(lVar2, sector[iSector].floorheinum, sActor, sPlayer); break; case SECTOR_FLOORSHADE: if (bSet) sector[iSector].floorshade = lValue; - else SetGameVarID((int)lVar2, sector[iSector].floorshade, sActor, sPlayer); + else SetGameVarID(lVar2, sector[iSector].floorshade, sActor, sPlayer); break; case SECTOR_FLOORPAL: if (bSet) sector[iSector].floorpal = lValue; - else SetGameVarID((int)lVar2, sector[iSector].floorpal, sActor, sPlayer); + else SetGameVarID(lVar2, sector[iSector].floorpal, sActor, sPlayer); break; case SECTOR_FLOORXPANNING: if (bSet) sector[iSector].floorxpan_ = lValue; - else SetGameVarID((int)lVar2, sector[iSector].floorxpan(), sActor, sPlayer); + else SetGameVarID(lVar2, sector[iSector].floorxpan(), sActor, sPlayer); break; case SECTOR_FLOORYPANNING: if (bSet) sector[iSector].floorypan_ = lValue; - else SetGameVarID((int)lVar2, sector[iSector].floorypan(), sActor, sPlayer); + else SetGameVarID(lVar2, sector[iSector].floorypan(), sActor, sPlayer); break; case SECTOR_VISIBILITY: if (bSet) sector[iSector].visibility = lValue; - else SetGameVarID((int)lVar2, sector[iSector].visibility, sActor, sPlayer); + else SetGameVarID(lVar2, sector[iSector].visibility, sActor, sPlayer); break; case SECTOR_LOTAG: if (bSet) sector[iSector].lotag = lValue; - else SetGameVarID((int)lVar2, sector[iSector].lotag, sActor, sPlayer); + else SetGameVarID(lVar2, sector[iSector].lotag, sActor, sPlayer); break; case SECTOR_HITAG: if (bSet) sector[iSector].hitag = lValue; - else SetGameVarID((int)lVar2, sector[iSector].hitag, sActor, sPlayer); + else SetGameVarID(lVar2, sector[iSector].hitag, sActor, sPlayer); break; case SECTOR_EXTRA: if (bSet) sector[iSector].extra = lValue; - else SetGameVarID((int)lVar2, sector[iSector].extra, sActor, sPlayer); + else SetGameVarID(lVar2, sector[iSector].extra, sActor, sPlayer); break; default: break; @@ -1141,7 +1148,7 @@ void DoActor(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, int iActor; int lValue; - lValue = GetGameVarID((int)lVar2, sActor, sPlayer); + lValue = GetGameVarID(lVar2, sActor, sPlayer); DDukeActor* act; if (lVar1 == g_iThisActorID) @@ -1151,14 +1158,14 @@ void DoActor(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, } else { - iActor = GetGameVarID((int)lVar1, sActor, sPlayer); + iActor = GetGameVarID(lVar1, sActor, sPlayer); act = ScriptIndexToActor(iActor); } auto spr = &act->s; if (iActor < 0 || iActor >= MAXSPRITES || spr->statnum == MAXSTATUS) { - if (!bSet) SetGameVarID((int)lVar2, 0, sActor, sPlayer); + if (!bSet) SetGameVarID(lVar2, 0, sActor, sPlayer); return; } @@ -1166,188 +1173,188 @@ void DoActor(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, { case ACTOR_X: if (bSet) spr->x = lValue; - else SetGameVarID((int)lVar2, spr->x, sActor, sPlayer); + else SetGameVarID(lVar2, spr->x, sActor, sPlayer); break; case ACTOR_Y: if (bSet) spr->y = lValue; - else SetGameVarID((int)lVar2, spr->y, sActor, sPlayer); + else SetGameVarID(lVar2, spr->y, sActor, sPlayer); break; case ACTOR_Z: if (bSet) spr->z = lValue; - else SetGameVarID((int)lVar2, spr->z, sActor, sPlayer); + else SetGameVarID(lVar2, spr->z, sActor, sPlayer); break; case ACTOR_CSTAT: if (bSet) spr->cstat = lValue; - else SetGameVarID((int)lVar2, spr->cstat, sActor, sPlayer); + else SetGameVarID(lVar2, spr->cstat, sActor, sPlayer); break; case ACTOR_PICNUM: if (bSet) spr->picnum = lValue; - else SetGameVarID((int)lVar2, spr->picnum, sActor, sPlayer); + else SetGameVarID(lVar2, spr->picnum, sActor, sPlayer); break; case ACTOR_SHADE: if (bSet) spr->shade = lValue; - else SetGameVarID((int)lVar2, spr->shade, sActor, sPlayer); + else SetGameVarID(lVar2, spr->shade, sActor, sPlayer); break; case ACTOR_PAL: if (bSet) spr->pal = lValue; - else SetGameVarID((int)lVar2, spr->pal, sActor, sPlayer); + else SetGameVarID(lVar2, spr->pal, sActor, sPlayer); break; case ACTOR_CLIPDIST: if (bSet) spr->clipdist = lValue; - else SetGameVarID((int)lVar2, spr->clipdist, sActor, sPlayer); + else SetGameVarID(lVar2, spr->clipdist, sActor, sPlayer); break; case ACTOR_DETAIL: if (bSet) act->spriteextra = lValue; - else SetGameVarID((int)lVar2, act->spriteextra, sActor, sPlayer); + else SetGameVarID(lVar2, act->spriteextra, sActor, sPlayer); break; case ACTOR_XREPEAT: if (bSet) spr->xrepeat = lValue; - else SetGameVarID((int)lVar2, spr->xrepeat, sActor, sPlayer); + else SetGameVarID(lVar2, spr->xrepeat, sActor, sPlayer); break; case ACTOR_YREPEAT: if (bSet) spr->yrepeat = lValue; - else SetGameVarID((int)lVar2, spr->yrepeat, sActor, sPlayer); + else SetGameVarID(lVar2, spr->yrepeat, sActor, sPlayer); break; case ACTOR_XOFFSET: if (bSet) spr->xoffset = lValue; - else SetGameVarID((int)lVar2, spr->xoffset, sActor, sPlayer); + else SetGameVarID(lVar2, spr->xoffset, sActor, sPlayer); break; case ACTOR_YOFFSET: if (bSet) spr->yoffset = lValue; - else SetGameVarID((int)lVar2, spr->yoffset, sActor, sPlayer); + else SetGameVarID(lVar2, spr->yoffset, sActor, sPlayer); break; case ACTOR_SECTNUM: if (bSet) changespritesect(iActor, lValue); - else SetGameVarID((int)lVar2, spr->sectnum, sActor, sPlayer); + else SetGameVarID(lVar2, spr->sectnum, sActor, sPlayer); break; case ACTOR_STATNUM: if (bSet) changespritestat(iActor, lValue); - else SetGameVarID((int)lVar2, spr->statnum, sActor, sPlayer); + else SetGameVarID(lVar2, spr->statnum, sActor, sPlayer); break; case ACTOR_ANG: if (bSet) spr->ang = lValue; - else SetGameVarID((int)lVar2, spr->ang, sActor, sPlayer); + else SetGameVarID(lVar2, spr->ang, sActor, sPlayer); break; case ACTOR_OWNER: if (bSet) spr->owner = lValue; - else SetGameVarID((int)lVar2, spr->owner, sActor, sPlayer); + else SetGameVarID(lVar2, spr->owner, sActor, sPlayer); break; case ACTOR_XVEL: if (bSet) spr->xvel = lValue; - else SetGameVarID((int)lVar2, spr->xvel, sActor, sPlayer); + else SetGameVarID(lVar2, spr->xvel, sActor, sPlayer); break; case ACTOR_YVEL: if (bSet) spr->yvel = lValue; - else SetGameVarID((int)lVar2, spr->yvel, sActor, sPlayer); + else SetGameVarID(lVar2, spr->yvel, sActor, sPlayer); break; case ACTOR_ZVEL: if (bSet) spr->zvel = lValue; - else SetGameVarID((int)lVar2, spr->zvel, sActor, sPlayer); + else SetGameVarID(lVar2, spr->zvel, sActor, sPlayer); break; case ACTOR_LOTAG: if (bSet) spr->lotag = lValue; - else SetGameVarID((int)lVar2, spr->lotag, sActor, sPlayer); + else SetGameVarID(lVar2, spr->lotag, sActor, sPlayer); break; case ACTOR_HITAG: if (bSet) spr->hitag = lValue; - else SetGameVarID((int)lVar2, spr->hitag, sActor, sPlayer); + else SetGameVarID(lVar2, spr->hitag, sActor, sPlayer); break; case ACTOR_EXTRA: if (bSet) spr->extra = lValue; - else SetGameVarID((int)lVar2, spr->extra, sActor, sPlayer); + else SetGameVarID(lVar2, spr->extra, sActor, sPlayer); break; case ACTOR_HTCGG: if (bSet) act->cgg = lValue; - else SetGameVarID((int)lVar2, act->cgg, sActor, sPlayer); + else SetGameVarID(lVar2, act->cgg, sActor, sPlayer); break; case ACTOR_HTPICNUM: if (bSet) act->picnum = lValue; - else SetGameVarID((int)lVar2, act->picnum, sActor, sPlayer); + else SetGameVarID(lVar2, act->picnum, sActor, sPlayer); break; case ACTOR_HTANG: if (bSet) act->ang = lValue; - else SetGameVarID((int)lVar2, act->ang, sActor, sPlayer); + else SetGameVarID(lVar2, act->ang, sActor, sPlayer); break; case ACTOR_HTEXTRA: if (bSet) act->extra = lValue; - else SetGameVarID((int)lVar2, act->extra, sActor, sPlayer); + else SetGameVarID(lVar2, act->extra, sActor, sPlayer); break; case ACTOR_HTOWNER: if (bSet) act->owner = lValue; - else SetGameVarID((int)lVar2, act->owner, sActor, sPlayer); + else SetGameVarID(lVar2, act->owner, sActor, sPlayer); break; case ACTOR_HTMOVFLAG: if (bSet) act->movflag = lValue; - else SetGameVarID((int)lVar2, act->movflag, sActor, sPlayer); + else SetGameVarID(lVar2, act->movflag, sActor, sPlayer); break; case ACTOR_HTTEMPANG: if (bSet) act->tempang = lValue; - else SetGameVarID((int)lVar2, act->tempang, sActor, sPlayer); + else SetGameVarID(lVar2, act->tempang, sActor, sPlayer); break; case ACTOR_HTACTORSTAYPUT: if (bSet) act->actorstayput = lValue; - else SetGameVarID((int)lVar2, act->actorstayput, sActor, sPlayer); + else SetGameVarID(lVar2, act->actorstayput, sActor, sPlayer); break; case ACTOR_HTDISPICNUM: if (bSet) act->dispicnum = lValue; - else SetGameVarID((int)lVar2, act->dispicnum, sActor, sPlayer); + else SetGameVarID(lVar2, act->dispicnum, sActor, sPlayer); break; case ACTOR_HTTIMETOSLEEP: if (bSet) act->timetosleep = lValue; - else SetGameVarID((int)lVar2, act->timetosleep, sActor, sPlayer); + else SetGameVarID(lVar2, act->timetosleep, sActor, sPlayer); break; case ACTOR_HTFLOORZ: if (bSet) act->floorz = lValue; - else SetGameVarID((int)lVar2, act->floorz, sActor, sPlayer); + else SetGameVarID(lVar2, act->floorz, sActor, sPlayer); break; case ACTOR_HTCEILINGZ: if (bSet) act->ceilingz = lValue; - else SetGameVarID((int)lVar2, act->ceilingz, sActor, sPlayer); + else SetGameVarID(lVar2, act->ceilingz, sActor, sPlayer); break; case ACTOR_HTLASTVX: if (bSet) act->lastvx = lValue; - else SetGameVarID((int)lVar2, act->lastvx, sActor, sPlayer); + else SetGameVarID(lVar2, act->lastvx, sActor, sPlayer); break; case ACTOR_HTLASTVY: if (bSet) act->lastvy = lValue; - else SetGameVarID((int)lVar2, act->lastvy, sActor, sPlayer); + else SetGameVarID(lVar2, act->lastvy, sActor, sPlayer); break; case ACTOR_HTBPOSX: if (bSet) spr->ox = lValue; - else SetGameVarID((int)lVar2, spr->ox, sActor, sPlayer); + else SetGameVarID(lVar2, spr->ox, sActor, sPlayer); break; case ACTOR_HTBPOSY: if (bSet) spr->oy = lValue; - else SetGameVarID((int)lVar2, spr->oy, sActor, sPlayer); + else SetGameVarID(lVar2, spr->oy, sActor, sPlayer); break; case ACTOR_HTBPOSZ: if (bSet) spr->oz = lValue; - else SetGameVarID((int)lVar2, spr->oz, sActor, sPlayer); + else SetGameVarID(lVar2, spr->oz, sActor, sPlayer); break; case ACTOR_HTG_T0: if (bSet) act->temp_data[0] = lValue; - else SetGameVarID((int)lVar2, act->temp_data[0], sActor, sPlayer); + else SetGameVarID(lVar2, act->temp_data[0], sActor, sPlayer); break; case ACTOR_HTG_T1: if (bSet) act->temp_data[1] = lValue; - else SetGameVarID((int)lVar2, act->temp_data[1], sActor, sPlayer); + else SetGameVarID(lVar2, act->temp_data[1], sActor, sPlayer); break; case ACTOR_HTG_T2: if (bSet) act->temp_data[2] = lValue; - else SetGameVarID((int)lVar2, act->temp_data[2], sActor, sPlayer); + else SetGameVarID(lVar2, act->temp_data[2], sActor, sPlayer); break; case ACTOR_HTG_T3: if (bSet) act->temp_data[3] = lValue; - else SetGameVarID((int)lVar2, act->temp_data[3], sActor, sPlayer); + else SetGameVarID(lVar2, act->temp_data[3], sActor, sPlayer); break; case ACTOR_HTG_T4: if (bSet) act->temp_data[4] = lValue; - else SetGameVarID((int)lVar2, act->temp_data[4], sActor, sPlayer); + else SetGameVarID(lVar2, act->temp_data[4], sActor, sPlayer); break; case ACTOR_HTG_T5: if (bSet) act->temp_data[5] = lValue; - else SetGameVarID((int)lVar2, act->temp_data[5], sActor, sPlayer); + else SetGameVarID(lVar2, act->temp_data[5], sActor, sPlayer); break; default: @@ -1793,13 +1800,13 @@ int ParseState::parse(void) case concmd_stopsound: insptr++; if (S_CheckSoundPlaying(*insptr)) - S_StopSound((int)*insptr); + S_StopSound(*insptr); insptr++; break; case concmd_globalsound: insptr++; if (g_p == screenpeek || ud.coop == 1) - S_PlayActorSound((int)*insptr, ps[screenpeek].GetActor()); + S_PlayActorSound(*insptr, ps[screenpeek].GetActor()); insptr++; break; case concmd_smackbubba: @@ -2440,7 +2447,7 @@ int ParseState::parse(void) j = 0; } - parseifelse((int) j); + parseifelse( j); } break; diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp index 4bf022212..d8cbaa751 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -755,7 +755,7 @@ static void processVehicleInput(player_struct *p, ControlInfo* const hidInput, I } input.fvel = xs_CRoundToInt(p->MotoSpeed); - input.avel *= (45. / 256.); + input.avel *= BAngToDegree; loc.avel += input.avel; } diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 6f23e1250..16de421c8 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -2611,7 +2611,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) fi.shoot(pact, RPG); checkavailweapon(p); } - else if (p->kickback_pic == (cl_dukefixrpgrecoil ? 13 : 20)) + else if (p->kickback_pic == 20) p->okickback_pic = p->kickback_pic = 0; break; } diff --git a/source/games/duke/src/sbar_r.cpp b/source/games/duke/src/sbar_r.cpp index ee23a90a4..c6035b13a 100644 --- a/source/games/duke/src/sbar_r.cpp +++ b/source/games/duke/src/sbar_r.cpp @@ -413,8 +413,8 @@ public: p->drunkang = 400; } - DrawRotated(tileGetTexture(GUTMETER), 256, top + 15, DI_ITEM_RELCENTER, p->drunkang * (-360. / 2048), 1, scale, scale, 0xffffffff, 0); - DrawRotated(tileGetTexture(GUTMETER), 292, top + 15, DI_ITEM_RELCENTER, p->eatang * (-360. / 2048), 1, scale, scale, 0xffffffff, 0); + DrawRotated(tileGetTexture(GUTMETER), 256, top + 15, DI_ITEM_RELCENTER, p->drunkang * -BAngToDegree, 1, scale, scale, 0xffffffff, 0); + DrawRotated(tileGetTexture(GUTMETER), 292, top + 15, DI_ITEM_RELCENTER, p->eatang * -BAngToDegree, 1, scale, scale, 0xffffffff, 0); if (p->drink_amt >= 0 && p->drink_amt <= 30) { diff --git a/source/games/exhumed/src/movie.cpp b/source/games/exhumed/src/movie.cpp index bb18ea182..d26b9ce52 100644 --- a/source/games/exhumed/src/movie.cpp +++ b/source/games/exhumed/src/movie.cpp @@ -250,7 +250,7 @@ public: { twod->ClearScreen(); DrawTexture(twod, decoder.animTex().GetFrame(), 160, 100, DTA_FullscreenScale, FSMode_Fit320x200, - DTA_CenterOffset, true, DTA_FlipY, true, DTA_ScaleX, z / 65536., DTA_ScaleY, z / 65536., DTA_Rotate, (-angle - 512) * (360. / 2048.), TAG_DONE); + DTA_CenterOffset, true, DTA_FlipY, true, DTA_ScaleX, z / 65536., DTA_ScaleY, z / 65536., DTA_Rotate, (-angle - 512) * BAngToDegree, TAG_DONE); } lastclock = clock; diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index 2b4702f5c..b388afcdd 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -1814,7 +1814,7 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang, double sc = czoom * (spr->yrepeat) / 32768.; if (spnum >= 0) { - DrawTexture(twod, tileGetTexture(1196 + pspr_ndx[myconnectindex], true), xd, yd, DTA_ScaleX, sc, DTA_ScaleY, sc, DTA_Rotate, daang * (-360. / 2048), + DrawTexture(twod, tileGetTexture(1196 + pspr_ndx[myconnectindex], true), xd, yd, DTA_ScaleX, sc, DTA_ScaleY, sc, DTA_Rotate, daang * -BAngToDegree, DTA_CenterOffsetRel, true, DTA_TranslationIndex, TRANSLATION(Translation_Remap, spr->pal), DTA_Color, shadeToLight(spr->shade), DTA_Alpha, (spr->cstat & 2) ? 0.33 : 1., TAG_DONE); } diff --git a/source/glbackend/glbackend.cpp b/source/glbackend/glbackend.cpp index 6eed048ed..9625f2364 100644 --- a/source/glbackend/glbackend.cpp +++ b/source/glbackend/glbackend.cpp @@ -569,7 +569,7 @@ void hud_drawsprite(double sx, double sy, int z, double a, int picnum, int dasha DTA_FlipX, !!(dastat & RS_XFLIPHUD), DTA_FlipY, !!(dastat & RS_YFLIPHUD), DTA_Pin, (dastat & RS_ALIGN_R) ? 1 : (dastat & RS_ALIGN_L) ? -1 : 0, - DTA_Rotate, a * (-360./2048), + DTA_Rotate, a * -BAngToDegree, DTA_FlipOffsets, !(dastat & (/*RS_TOPLEFT |*/ RS_CENTER)), DTA_Alpha, alpha, TAG_DONE);