- Exhumed: Hooked up tic-rate input helpers. Also removed nDestVertPan[].

This commit is contained in:
Mitchell Richters 2020-09-21 19:28:39 +10:00
parent 8a4d4b6905
commit fa1ce1c021
7 changed files with 31 additions and 44 deletions

View file

@ -421,19 +421,6 @@ void GameInterface::Ticker()
} }
} }
if (localInput.actions & SB_CENTERVIEW)
{
bLockPan = false;
bPlayerPan = false;
//PlayerList[nLocalPlayer].q16horiz = IntToFixed(100);
nDestVertPan[nLocalPlayer] = IntToFixed(100);
}
if (localInput.actions & SB_TURNAROUND)
{
// todo
}
sPlayerInput[nLocalPlayer].xVel = lPlayerXVel; sPlayerInput[nLocalPlayer].xVel = lPlayerXVel;
sPlayerInput[nLocalPlayer].yVel = lPlayerYVel; sPlayerInput[nLocalPlayer].yVel = lPlayerYVel;
// make weapon selection persist until it gets used up. // make weapon selection persist until it gets used up.
@ -446,6 +433,11 @@ void GameInterface::Ticker()
sPlayerInput[nLocalPlayer].actions = localInput.actions; sPlayerInput[nLocalPlayer].actions = localInput.actions;
if (oldactions & SB_CENTERVIEW) sPlayerInput[nLocalPlayer].actions |= SB_CENTERVIEW; if (oldactions & SB_CENTERVIEW) sPlayerInput[nLocalPlayer].actions |= SB_CENTERVIEW;
if (cl_syncinput)
{
;// To be completed...
}
Ra[nLocalPlayer].nTarget = besttarget; Ra[nLocalPlayer].nTarget = besttarget;
lLocalCodes = 0; lLocalCodes = 0;

View file

@ -193,12 +193,17 @@ static void processMovement(ControlInfo* const hidInput)
localInput.q16avel += tempinput.q16avel; localInput.q16avel += tempinput.q16avel;
localInput.q16horz += tempinput.q16horz; localInput.q16horz += tempinput.q16horz;
if (!cl_syncinput && !nFreeze) if (!cl_syncinput)
{ {
Player* pPlayer = &PlayerList[nLocalPlayer]; Player* pPlayer = &PlayerList[nLocalPlayer];
applylook(&pPlayer->q16angle, &pPlayer->q16look_ang, &pPlayer->q16rotscrnang, &pPlayer->spin, tempinput.q16avel, &sPlayerInput[nLocalPlayer].actions, scaleAdjust, false); if (!nFreeze)
sethorizon(&pPlayer->q16horiz, tempinput.q16horz, &sPlayerInput[nLocalPlayer].actions, scaleAdjust); {
applylook(&pPlayer->q16angle, &pPlayer->q16look_ang, &pPlayer->q16rotscrnang, &pPlayer->spin, tempinput.q16avel, &sPlayerInput[nLocalPlayer].actions, scaleAdjust, false);
sethorizon(&pPlayer->q16horiz, tempinput.q16horz, &sPlayerInput[nLocalPlayer].actions, scaleAdjust);
}
playerProcessHelpers(&pPlayer->q16angle, &pPlayer->angAdjust, &pPlayer->angTarget, &pPlayer->q16horiz, &pPlayer->horizAdjust, &pPlayer->horizTarget, scaleAdjust);
} }
} }

View file

@ -438,7 +438,6 @@ void RestartPlayer(short nPlayer)
nXDamage[nPlayer] = 0; nXDamage[nPlayer] = 0;
PlayerList[nPlayer].q16horiz = IntToFixed(100); PlayerList[nPlayer].q16horiz = IntToFixed(100);
nDestVertPan[nPlayer] = IntToFixed(100);
nBreathTimer[nPlayer] = 90; nBreathTimer[nPlayer] = 90;
nTauntTimer[nPlayer] = RandomSize(3) + 3; nTauntTimer[nPlayer] = RandomSize(3) + 3;
@ -1033,10 +1032,11 @@ void FuncPlayer(int a, int nDamage, int nRun)
{ {
if (nTotalPlayers <= 1) if (nTotalPlayers <= 1)
{ {
PlayerList[nPlayer].q16angle = IntToFixed(GetAngleToSprite(nPlayerSprite, nSpiritSprite) & kAngleMask); auto ang = GetAngleToSprite(nPlayerSprite, nSpiritSprite) & kAngleMask;
sprite[nPlayerSprite].ang = FixedToInt(PlayerList[nPlayer].q16angle); playerSetAngle(&PlayerList[nPlayer].q16angle, &PlayerList[nPlayer].angTarget, ang);
sprite[nPlayerSprite].ang = ang;
PlayerList[nPlayer].q16horiz = IntToFixed(100); playerSetHoriz(&PlayerList[nPlayer].q16horiz, &PlayerList[nPlayer].horizTarget, 100);
lPlayerXVel = 0; lPlayerXVel = 0;
lPlayerYVel = 0; lPlayerYVel = 0;
@ -1054,15 +1054,15 @@ void FuncPlayer(int a, int nDamage, int nRun)
StopLocalSound(); StopLocalSound();
InitSpiritHead(); InitSpiritHead();
nDestVertPan[nPlayer] = IntToFixed(100); playerSetHoriz(&PlayerList[nPlayer].q16horiz, &PlayerList[nPlayer].horizTarget, 100);
if (currentLevel->levelNumber == 11) if (currentLevel->levelNumber == 11)
{ {
nDestVertPan[nPlayer] += IntToFixed(46); playerAddHoriz(&PlayerList[nPlayer].q16horiz, &PlayerList[nPlayer].horizAdjust, 46);
} }
else else
{ {
nDestVertPan[nPlayer] += IntToFixed(11); playerAddHoriz(&PlayerList[nPlayer].q16horiz, &PlayerList[nPlayer].horizAdjust, 11);
} }
} }
} }
@ -1091,7 +1091,7 @@ void FuncPlayer(int a, int nDamage, int nRun)
} }
if (zVelB > 512 && !bLockPan) { if (zVelB > 512 && !bLockPan) {
nDestVertPan[nPlayer] = IntToFixed(100); playerSetHoriz(&PlayerList[nPlayer].q16horiz, &PlayerList[nPlayer].horizTarget, 100);
} }
} }
@ -1190,19 +1190,9 @@ void FuncPlayer(int a, int nDamage, int nRun)
} }
loc_1AB8E: loc_1AB8E:
if (!bPlayerPan && !bLockPan) if (cl_syncinput)
{ {
fixed_t nPanVal = IntToFixed(spr_z - sprite[nPlayerSprite].z) / 32 + IntToFixed(100); ;// To be completed.
if (nPanVal < 0) {
nPanVal = 0;
}
else if (nPanVal > IntToFixed(183))
{
nPanVal = IntToFixed(183);
}
nDestVertPan[nPlayer] = nPanVal;
} }
playerX -= sprite[nPlayerSprite].x; playerX -= sprite[nPlayerSprite].x;
@ -2793,15 +2783,16 @@ loc_1BD2E:
{ {
if (PlayerList[nPlayer].q16horiz < IntToFixed(100)) if (PlayerList[nPlayer].q16horiz < IntToFixed(100))
{ {
PlayerList[nPlayer].q16horiz = IntToFixed(91); playerSetHoriz(&PlayerList[nPlayer].q16horiz, &PlayerList[nPlayer].horizTarget, 100);
eyelevel[nPlayer] -= (dVertPan[nPlayer] << 8); eyelevel[nPlayer] -= (dVertPan[nPlayer] << 8);
} }
else else
{ {
PlayerList[nPlayer].q16horiz += IntToFixed(dVertPan[nPlayer]); playerAddHoriz(&PlayerList[nPlayer].q16horiz, &PlayerList[nPlayer].horizAdjust, dVertPan[nPlayer]);
if (PlayerList[nPlayer].q16horiz >= IntToFixed(200))
if (PlayerList[nPlayer].q16horiz > gi->playerHorizMax())
{ {
PlayerList[nPlayer].q16horiz = IntToFixed(199); playerSetHoriz(&PlayerList[nPlayer].q16horiz, &PlayerList[nPlayer].horizTarget, gi->playerHorizMax());
} }
else if (PlayerList[nPlayer].q16horiz <= IntToFixed(100)) else if (PlayerList[nPlayer].q16horiz <= IntToFixed(100))
{ {

View file

@ -75,6 +75,8 @@ struct Player
fixed_t oq16look_ang, q16look_ang; fixed_t oq16look_ang, q16look_ang;
fixed_t oq16rotscrnang, q16rotscrnang; fixed_t oq16rotscrnang, q16rotscrnang;
fixed_t spin; fixed_t spin;
fixed_t angTarget, horizTarget;
double angAdjust, horizAdjust;
vec3_t opos; vec3_t opos;
}; };

View file

@ -209,7 +209,7 @@ void DoSpiritHead()
{ {
static short dimSectCount = 0; static short dimSectCount = 0;
PlayerList[0].q16horiz += (nDestVertPan[0] - PlayerList[0].q16horiz) / 4; PlayerList[0].q16horiz += PlayerList[0].q16horiz / 4;
TileFiles.InvalidateTile(kTileRamsesWorkTile); TileFiles.InvalidateTile(kTileRamsesWorkTile);
int totalclock = leveltime * 4; int totalclock = leveltime * 4;

View file

@ -36,7 +36,6 @@ short bSubTitles = true;
int zbob; int zbob;
fixed_t nDestVertPan[kMaxPlayers] = { 0 };
short dVertPan[kMaxPlayers]; short dVertPan[kMaxPlayers];
int nCamerax; int nCamerax;
int nCameray; int nCameray;
@ -497,7 +496,6 @@ static SavegameHelper sgh("view",
SV(viewz), SV(viewz),
SV(enemy), SV(enemy),
SV(nEnemyPal), SV(nEnemyPal),
SA(nDestVertPan),
SA(dVertPan), SA(dVertPan),
SA(nQuake), SA(nQuake),
SV(g_interpolationCnt), SV(g_interpolationCnt),

View file

@ -39,7 +39,6 @@ void viewDoInterpolations(int smoothRatio);
void viewUpdateInterpolations(void); void viewUpdateInterpolations(void);
void viewRestoreInterpolations(void); void viewRestoreInterpolations(void);
extern fixed_t nDestVertPan[];
extern short dVertPan[]; extern short dVertPan[];
extern short nQuake[]; extern short nQuake[];
extern int nCamerax; extern int nCamerax;