mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-20 18:42:26 +00:00
Merge branch 'back_to_basics2' into Input_UnifyProcessMovement
# Conflicts: # source/exhumed/src/input.cpp
This commit is contained in:
commit
9e0bd569f7
10 changed files with 58 additions and 57 deletions
|
@ -109,17 +109,18 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
|
|||
if (PlayerList[nLocalPlayer].nHealth == 0) localInput.actions &= SB_OPEN;
|
||||
}
|
||||
|
||||
double const scaleAdjust = InputScale();
|
||||
InputPacket input {};
|
||||
|
||||
if (PlayerList[nLocalPlayer].nHealth == 0)
|
||||
{
|
||||
lPlayerYVel = 0;
|
||||
lPlayerXVel = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
double const scaleAdjust = InputScale();
|
||||
InputPacket input {};
|
||||
|
||||
processMovement(&input, &localInput, hidInput, true, scaleAdjust);
|
||||
else
|
||||
{
|
||||
processMovement(&input, &localInput, hidInput, true, scaleAdjust);
|
||||
}
|
||||
|
||||
if (!cl_syncinput)
|
||||
{
|
||||
|
|
|
@ -725,6 +725,8 @@ void FuncPlayer(int a, int nDamage, int nRun)
|
|||
|
||||
short nSprite2;
|
||||
|
||||
PlayerList[nPlayer].angAdjust = 0;
|
||||
PlayerList[nPlayer].horizAdjust = 0;
|
||||
PlayerList[nPlayer].opos = sprite[nPlayerSprite].pos;
|
||||
PlayerList[nPlayer].oq16angle = PlayerList[nPlayer].q16angle;
|
||||
PlayerList[nPlayer].oq16horiz = PlayerList[nPlayer].q16horiz;
|
||||
|
@ -1065,15 +1067,13 @@ void FuncPlayer(int a, int nDamage, int nRun)
|
|||
StopLocalSound();
|
||||
InitSpiritHead();
|
||||
|
||||
playerSetHoriz(&PlayerList[nPlayer].q16horiz, &PlayerList[nPlayer].horizTarget, 100);
|
||||
|
||||
if (currentLevel->levelNumber == 11)
|
||||
{
|
||||
playerAddHoriz(&PlayerList[nPlayer].q16horiz, &PlayerList[nPlayer].horizAdjust, 46);
|
||||
playerSetHoriz(&PlayerList[nPlayer].q16horiz, &PlayerList[nPlayer].horizTarget, 146);
|
||||
}
|
||||
else
|
||||
{
|
||||
playerAddHoriz(&PlayerList[nPlayer].q16horiz, &PlayerList[nPlayer].horizAdjust, 11);
|
||||
playerSetHoriz(&PlayerList[nPlayer].q16horiz, &PlayerList[nPlayer].horizTarget, 111);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "aistuff.h"
|
||||
#include "player.h"
|
||||
#include "mapinfo.h"
|
||||
#include "ps_input.h"
|
||||
|
||||
|
||||
BEGIN_PS_NS
|
||||
|
@ -209,7 +210,7 @@ void DoSpiritHead()
|
|||
{
|
||||
static short dimSectCount = 0;
|
||||
|
||||
PlayerList[0].q16horiz += PlayerList[0].q16horiz / 4;
|
||||
sPlayerInput[0].actions |= SB_CENTERVIEW;
|
||||
TileFiles.InvalidateTile(kTileRamsesWorkTile);
|
||||
int totalclock = leveltime * 4;
|
||||
|
||||
|
|
|
@ -348,6 +348,8 @@ void DrawView(double smoothRatio, bool sceneonly)
|
|||
viewz = playerZ;
|
||||
}
|
||||
|
||||
pan = clamp(pan, gi->playerHorizMin(), gi->playerHorizMax());
|
||||
|
||||
nCamerax = playerX;
|
||||
nCameray = playerY;
|
||||
nCameraz = playerZ;
|
||||
|
|
|
@ -1999,42 +1999,39 @@ void camera(int i)
|
|||
|
||||
if (s->hitag > 0)
|
||||
{
|
||||
// alias our temp_data array indexes.
|
||||
auto& increment = t[1];
|
||||
auto& minimum = t[2];
|
||||
auto& maximum = t[3];
|
||||
auto& setupflag = t[4];
|
||||
|
||||
// set up camera if already not.
|
||||
if (t[4] != 1)
|
||||
if (setupflag != 1)
|
||||
{
|
||||
// set amount to adjust camera angle every tic.
|
||||
t[1] = 8;
|
||||
|
||||
// set min/max camera angles respectively. hitag is used as a viewing arc -/+ the initial camera angle.
|
||||
t[2] = s->ang - s->hitag - t[1];
|
||||
t[3] = s->ang + s->hitag - t[1];
|
||||
|
||||
// flag that we've set up the camera.
|
||||
t[4] = 1;
|
||||
increment = 8;
|
||||
minimum = s->ang - s->hitag - increment;
|
||||
maximum = s->ang + s->hitag - increment;
|
||||
setupflag = 1;
|
||||
}
|
||||
|
||||
// if already at min/max, invert the adjustment, add it and return.
|
||||
if (s->ang == t[2] || s->ang == t[3])
|
||||
// update angle accordingly.
|
||||
if (s->ang == minimum || s->ang == maximum)
|
||||
{
|
||||
t[1] = -t[1];
|
||||
s->ang += t[1];
|
||||
return;
|
||||
increment = -increment;
|
||||
s->ang += increment;
|
||||
}
|
||||
|
||||
// if we're below the min or above the max, just return either.
|
||||
if (s->ang + t[1] < t[2])
|
||||
else if (s->ang + increment < minimum)
|
||||
{
|
||||
s->ang = t[2];
|
||||
return;
|
||||
s->ang = minimum;
|
||||
}
|
||||
if (s->ang + t[1] > t[3])
|
||||
else if (s->ang + increment > maximum)
|
||||
{
|
||||
s->ang = t[3];
|
||||
return;
|
||||
s->ang = maximum;
|
||||
}
|
||||
else
|
||||
{
|
||||
s->ang += increment;
|
||||
}
|
||||
|
||||
// if we're within range, increment ang with adjustment.
|
||||
s->ang += t[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ void hud_input(int snum)
|
|||
i = p->aim_mode;
|
||||
p->aim_mode = !PlayerInput(snum, SB_AIMMODE);
|
||||
if (p->aim_mode < i)
|
||||
ps[snum].sync.actions |= SB_CENTERVIEW;
|
||||
p->sync.actions |= SB_CENTERVIEW;
|
||||
|
||||
// Backup weapon here as hud_input() is the first function where any one of the weapon variables can change.
|
||||
backupweapon(p);
|
||||
|
@ -483,7 +483,7 @@ void hud_input(int snum)
|
|||
OnEvent(EVENT_TURNAROUND, -1, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, -1, snum) != 0)
|
||||
{
|
||||
ps[snum].sync.actions &= ~SB_TURNAROUND;
|
||||
p->sync.actions &= ~SB_TURNAROUND;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -858,7 +858,7 @@ static void FinalizeInput(int playerNum, InputPacket& input, bool vehicle)
|
|||
loc.q16avel = input.q16avel = 0;
|
||||
}
|
||||
|
||||
if (p->newowner == -1 && !(ps[playerNum].sync.actions & SB_CENTERVIEW))
|
||||
if (p->newowner == -1 && !(p->sync.actions & SB_CENTERVIEW))
|
||||
{
|
||||
// input.q16horz already added to loc in processMovement()
|
||||
loc.q16horz = clamp(loc.q16horz, IntToFixed(-MAXHORIZVEL), IntToFixed(MAXHORIZVEL));
|
||||
|
@ -922,8 +922,8 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
|
|||
// Do these in the same order as the old code.
|
||||
calcviewpitch(p, scaleAdjust);
|
||||
processq16avel(p, &input.q16avel);
|
||||
applylook(&p->q16ang, &p->q16look_ang, &p->q16rotscrnang, &p->one_eighty_count, input.q16avel, &ps[myconnectindex].sync.actions, scaleAdjust, p->crouch_toggle || ps[myconnectindex].sync.actions & SB_CROUCH);
|
||||
sethorizon(&p->q16horiz, input.q16horz, &ps[myconnectindex].sync.actions, scaleAdjust);
|
||||
applylook(&p->q16ang, &p->q16look_ang, &p->q16rotscrnang, &p->one_eighty_count, input.q16avel, &p->sync.actions, scaleAdjust, p->crouch_toggle || p->sync.actions & SB_CROUCH);
|
||||
sethorizon(&p->q16horiz, input.q16horz, &p->sync.actions, scaleAdjust);
|
||||
}
|
||||
|
||||
playerProcessHelpers(&p->q16ang, &p->angAdjust, &p->angTarget, &p->q16horiz, &p->horizAdjust, &p->horizTarget, scaleAdjust);
|
||||
|
|
|
@ -165,7 +165,7 @@ void forceplayerangle(int snum)
|
|||
n = 128 - (krand() & 255);
|
||||
|
||||
playerAddHoriz(&p->q16horiz, &p->horizAdjust, 64);
|
||||
ps[snum].sync.actions |= SB_CENTERVIEW;
|
||||
p->sync.actions |= SB_CENTERVIEW;
|
||||
p->setlookang(n >> 1);
|
||||
p->setrotscrnang(n >> 1);
|
||||
}
|
||||
|
@ -407,7 +407,7 @@ void dokneeattack(int snum, int pi, const std::initializer_list<int> & respawnli
|
|||
{
|
||||
p->knee_incs++;
|
||||
playerAddHoriz(&p->q16horiz, &p->horizAdjust, -48);
|
||||
ps[snum].sync.actions |= SB_CENTERVIEW;
|
||||
p->sync.actions |= SB_CENTERVIEW;
|
||||
if (p->knee_incs > 15)
|
||||
{
|
||||
p->knee_incs = 0;
|
||||
|
@ -961,11 +961,11 @@ void playerCenterView(int snum)
|
|||
OnEvent(EVENT_RETURNTOCENTER, p->i, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->i, snum) == 0)
|
||||
{
|
||||
ps[snum].sync.actions |= SB_CENTERVIEW;
|
||||
p->sync.actions |= SB_CENTERVIEW;
|
||||
}
|
||||
else
|
||||
{
|
||||
ps[snum].sync.actions &= ~SB_CENTERVIEW;
|
||||
p->sync.actions &= ~SB_CENTERVIEW;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -976,11 +976,11 @@ void playerLookUp(int snum, ESyncBits actions)
|
|||
OnEvent(EVENT_LOOKUP, p->i, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->i, snum) == 0)
|
||||
{
|
||||
ps[snum].sync.actions |= SB_CENTERVIEW;
|
||||
p->sync.actions |= SB_CENTERVIEW;
|
||||
}
|
||||
else
|
||||
{
|
||||
ps[snum].sync.actions &= ~SB_LOOK_UP;
|
||||
p->sync.actions &= ~SB_LOOK_UP;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -991,11 +991,11 @@ void playerLookDown(int snum, ESyncBits actions)
|
|||
OnEvent(EVENT_LOOKDOWN, p->i, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->i, snum) == 0)
|
||||
{
|
||||
ps[snum].sync.actions |= SB_CENTERVIEW;
|
||||
p->sync.actions |= SB_CENTERVIEW;
|
||||
}
|
||||
else
|
||||
{
|
||||
ps[snum].sync.actions &= ~SB_LOOK_DOWN;
|
||||
p->sync.actions &= ~SB_LOOK_DOWN;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1006,7 +1006,7 @@ void playerAimUp(int snum, ESyncBits actions)
|
|||
OnEvent(EVENT_AIMUP, p->i, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->i, snum) != 0)
|
||||
{
|
||||
ps[snum].sync.actions &= ~SB_AIM_UP;
|
||||
p->sync.actions &= ~SB_AIM_UP;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1017,7 +1017,7 @@ void playerAimDown(int snum, ESyncBits actions)
|
|||
OnEvent(EVENT_AIMDOWN, p->i, snum, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->i, snum) != 0)
|
||||
{
|
||||
ps[snum].sync.actions &= ~SB_AIM_DOWN;
|
||||
p->sync.actions &= ~SB_AIM_DOWN;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2840,7 +2840,7 @@ void processinput_d(int snum)
|
|||
// may still be needed later for demo recording
|
||||
|
||||
processq16avel(p, &sb_avel);
|
||||
applylook(&p->q16ang, &p->q16look_ang, &p->q16rotscrnang, &p->one_eighty_count, sb_avel, &ps[snum].sync.actions, 1, p->crouch_toggle || actions & SB_CROUCH);
|
||||
applylook(&p->q16ang, &p->q16look_ang, &p->q16rotscrnang, &p->one_eighty_count, sb_avel, &p->sync.actions, 1, p->crouch_toggle || actions & SB_CROUCH);
|
||||
}
|
||||
|
||||
if (p->spritebridge == 0)
|
||||
|
@ -3072,7 +3072,7 @@ HORIZONLY:
|
|||
|
||||
if (cl_syncinput)
|
||||
{
|
||||
sethorizon(&p->q16horiz, PlayerHorizon(snum), &ps[snum].sync.actions, 1);
|
||||
sethorizon(&p->q16horiz, PlayerHorizon(snum), &p->sync.actions, 1);
|
||||
}
|
||||
|
||||
checkhardlanding(p);
|
||||
|
|
|
@ -3741,7 +3741,7 @@ void processinput_r(int snum)
|
|||
// may still be needed later for demo recording
|
||||
|
||||
processq16avel(p, &sb_avel);
|
||||
applylook(&p->q16ang, &p->q16look_ang, &p->q16rotscrnang, &p->one_eighty_count, sb_avel, &ps[snum].sync.actions, 1, p->crouch_toggle || actions & SB_CROUCH);
|
||||
applylook(&p->q16ang, &p->q16look_ang, &p->q16rotscrnang, &p->one_eighty_count, sb_avel, &p->sync.actions, 1, p->crouch_toggle || actions & SB_CROUCH);
|
||||
apply_seasick(p, 1);
|
||||
}
|
||||
|
||||
|
@ -4097,7 +4097,7 @@ HORIZONLY:
|
|||
|
||||
if (cl_syncinput)
|
||||
{
|
||||
sethorizon(&p->q16horiz, PlayerHorizon(snum), &ps[snum].sync.actions, 1);
|
||||
sethorizon(&p->q16horiz, PlayerHorizon(snum), &p->sync.actions, 1);
|
||||
}
|
||||
|
||||
checkhardlanding(p);
|
||||
|
|
|
@ -119,7 +119,7 @@ void resetplayerstats(int snum)
|
|||
p->bobcounter = 0;
|
||||
p->on_ground = 0;
|
||||
p->player_par = 0;
|
||||
ps[snum].sync.actions |= SB_CENTERVIEW;
|
||||
p->sync.actions |= SB_CENTERVIEW;
|
||||
p->airleft = 15*26;
|
||||
p->rapid_fire_hold = 0;
|
||||
p->toggle_key_flag = 0;
|
||||
|
|
Loading…
Reference in a new issue