From 3ec41e776c7f0f1e89757e828e49dc8ff2ca40cc Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Fri, 1 Jan 2021 22:37:40 +1100 Subject: [PATCH] - SW: Clean up old auto aim/mouse aim bits. --- source/sw/src/game.cpp | 33 --------------------------------- source/sw/src/game.h | 2 -- source/sw/src/input.cpp | 29 +---------------------------- source/sw/src/player.cpp | 2 +- source/sw/src/weapon.cpp | 6 +++--- 5 files changed, 5 insertions(+), 67 deletions(-) diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index cfb523677..d20b6dee6 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -415,45 +415,12 @@ void InitLevel(MapRecord *maprec) // //--------------------------------------------------------------------------- -void InitPlayerGameSettings(void) -{ - int pnum; - - if (CommEnabled) - { - // everyone gets the same Auto Aim - TRAVERSE_CONNECT(pnum) - { - if (Autoaim(pnum)) - SET(Player[pnum].Flags, PF_AUTO_AIM); - else - RESET(Player[pnum].Flags, PF_AUTO_AIM); - } - } - else - { - if (Autoaim(myconnectindex)) - SET(Player[myconnectindex].Flags, PF_AUTO_AIM); - else - RESET(Player[myconnectindex].Flags, PF_AUTO_AIM); - } -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - void InitRunLevel(void) { Mus_Stop(); DoTheCache(); - // auto aim / auto run / etc - InitPlayerGameSettings(); - // send packets with player info InitNetPlayerOptions(); diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 8d6d17532..355827b71 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -1013,7 +1013,6 @@ enum PF_LOCK_CRAWL = (BIT(4)), PF_PLAYER_MOVED = (BIT(7)), PF_PLAYER_RIDING = (BIT(8)), - PF_AUTO_AIM = (BIT(9)), PF_RECOIL = (BIT(10)), PF_FLYING = (BIT(11)), PF_WEAPON_RETRACT = (BIT(12)), @@ -1032,7 +1031,6 @@ enum PF_VIEW_OUTSIDE_WEAPON = (BIT(27)), PF_VIEW_FROM_CAMERA = (BIT(28)), PF_TANK = (BIT(29)), // Doin the tank thang - PF_MOUSE_AIMING_ON = (BIT(30)), PF_WEAPON_DOWN = (BIT(31)), PF2_TELEPORTED = (BIT(0)), PF2_INPUT_CAN_AIM = (BIT(1)), // Allow calling DoPlayerHorizon() from processMovement() diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index c60be4e2e..f02f31e4e 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -73,33 +73,6 @@ enum }; #endif -//--------------------------------------------------------------------------- -// -// handles the input bits -// -//--------------------------------------------------------------------------- - -static void processInputBits(PLAYERp const pp, ControlInfo* const hidInput) -{ - ApplyGlobalInput(loc, hidInput); - - if (!CommEnabled) - { - // Go back to the source to set this - the old code here was catastrophically bad. - // this needs to be fixed properly - as it is this can never be compatible with demo playback. - - if (!(loc.actions & SB_AIMMODE)) - SET(Player[myconnectindex].Flags, PF_MOUSE_AIMING_ON); - else - RESET(Player[myconnectindex].Flags, PF_MOUSE_AIMING_ON); - - if (Autoaim(myconnectindex)) - SET(Player[myconnectindex].Flags, PF_AUTO_AIM); - else - RESET(Player[myconnectindex].Flags, PF_AUTO_AIM); - } -} - //--------------------------------------------------------------------------- // // handles movement @@ -199,7 +172,7 @@ void GameInterface::GetInput(InputPacket *packet, ControlInfo* const hidInput) InputPacket input {}; PLAYERp pp = &Player[myconnectindex]; - processInputBits(pp, hidInput); + ApplyGlobalInput(loc, hidInput); processMovement(&input, &loc, hidInput, scaleAdjust, 0, !pp->sop, pp->sop_control ? 3. / 1.40625 : 1.); processWeapon(pp); diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index 4cf8f5ac8..d8e5c25c4 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -1672,7 +1672,7 @@ PlayerAutoLook(PLAYERp pp, double const scaleAdjust) if (!TEST(pp->Flags, PF_FLYING|PF_SWIMMING|PF_DIVING|PF_CLIMBING|PF_JUMPING|PF_FALLING)) { - if (!TEST(pp->Flags, PF_MOUSE_AIMING_ON) && TEST(sector[pp->cursectnum].floorstat, FLOOR_STAT_SLOPE)) // If the floor is sloped + if ((pp->input.actions & SB_AIMMODE) && TEST(sector[pp->cursectnum].floorstat, FLOOR_STAT_SLOPE)) // If the floor is sloped { // Get a point, 512 units ahead of player's position x = pp->posx + pp->angle.ang.bcos(-5); diff --git a/source/sw/src/weapon.cpp b/source/sw/src/weapon.cpp index 6524454f2..53b719db9 100644 --- a/source/sw/src/weapon.cpp +++ b/source/sw/src/weapon.cpp @@ -14306,7 +14306,7 @@ WeaponAutoAim(SPRITEp sp, short Missile, short ang, bool test) if (u && u->PlayerP) { - if (!TEST(u->PlayerP->Flags, PF_AUTO_AIM)) + if (!Autoaim(u->PlayerP->pnum)) { return -1; } @@ -14376,7 +14376,7 @@ WeaponAutoAimZvel(SPRITEp sp, short Missile, int *zvel, short ang, bool test) if (u && u->PlayerP) { - if (!TEST(u->PlayerP->Flags, PF_AUTO_AIM)) + if (!Autoaim(u->PlayerP->pnum)) { return -1; } @@ -14495,7 +14495,7 @@ WeaponAutoAimHitscan(SPRITEp sp, int *z, short *ang, bool test) if (u && u->PlayerP) { - if (!TEST(u->PlayerP->Flags, PF_AUTO_AIM)) + if (!Autoaim(u->PlayerP->pnum)) { return -1; }