mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
- Exhumed: Restore synchronised input, hook up rest of backend input functions and get rid of nPlayerDAng
.
This commit is contained in:
parent
5324d9680b
commit
d46787cd96
11 changed files with 82 additions and 33 deletions
|
@ -339,7 +339,6 @@ void GameInterface::Ticker()
|
|||
}
|
||||
else if (EndLevel == 0)
|
||||
{
|
||||
nPlayerDAng += localInput.q16avel;
|
||||
inita &= kAngleMask;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
|
@ -433,17 +432,12 @@ void GameInterface::Ticker()
|
|||
sPlayerInput[nLocalPlayer].actions = localInput.actions;
|
||||
if (oldactions & SB_CENTERVIEW) sPlayerInput[nLocalPlayer].actions |= SB_CENTERVIEW;
|
||||
|
||||
if (cl_syncinput)
|
||||
{
|
||||
;// To be completed...
|
||||
}
|
||||
sPlayerInput[nLocalPlayer].nAngle = localInput.q16avel;
|
||||
sPlayerInput[nLocalPlayer].pan = localInput.q16horz;
|
||||
|
||||
Ra[nLocalPlayer].nTarget = besttarget;
|
||||
|
||||
lLocalCodes = 0;
|
||||
nPlayerDAng = 0;
|
||||
|
||||
sPlayerInput[nLocalPlayer].horizon = PlayerList[nLocalPlayer].q16horiz;
|
||||
|
||||
leveltime++;
|
||||
if (leveltime == 2) gameaction = ga_autosave; // let the game run for 1 frame before saving.
|
||||
|
|
|
@ -102,8 +102,13 @@ void GameInterface::Render()
|
|||
DrawClock();
|
||||
}
|
||||
|
||||
DrawView(calc_smoothratio());
|
||||
double const smoothratio = calc_smoothratio();
|
||||
double const look_anghalf = getHalfLookAng(PlayerList[nLocalPlayer].oq16look_ang, PlayerList[nLocalPlayer].q16look_ang, cl_syncinput, smoothratio);
|
||||
|
||||
DrawView(smoothratio);
|
||||
DrawStatusBar();
|
||||
DrawCrosshair(MAXTILES, PlayerList[nLocalPlayer].nHealth >> 3, -look_anghalf, 1);
|
||||
|
||||
if (paused && !M_Active())
|
||||
{
|
||||
auto tex = GStrings("TXTB_PAUSED");
|
||||
|
|
|
@ -739,7 +739,7 @@ loc_flag:
|
|||
// loc_27266:
|
||||
case kWeaponSword:
|
||||
{
|
||||
nHeight += (100 - FixedToInt(sPlayerInput[nPlayer].horizon)) << 6;
|
||||
nHeight += (100 - FixedToInt(PlayerList[nLocalPlayer].q16horiz)) << 6;
|
||||
|
||||
theZ += nHeight;
|
||||
|
||||
|
@ -844,7 +844,7 @@ loc_flag:
|
|||
}
|
||||
case kWeaponPistol:
|
||||
{
|
||||
int var_50 = (FixedToInt(sPlayerInput[nPlayer].horizon) - 100) << 2;
|
||||
int var_50 = (FixedToInt(PlayerList[nLocalPlayer].q16horiz) - 100) << 2;
|
||||
nHeight -= var_50;
|
||||
|
||||
if (sPlayerInput[nPlayer].nTarget >= 0 && cl_autoaim)
|
||||
|
@ -859,7 +859,7 @@ loc_flag:
|
|||
|
||||
case kWeaponGrenade:
|
||||
{
|
||||
ThrowGrenade(nPlayer, ebp, ebx, nHeight - 2560, FixedToInt(sPlayerInput[nPlayer].horizon) - 100);
|
||||
ThrowGrenade(nPlayer, ebp, ebx, nHeight - 2560, FixedToInt(PlayerList[nLocalPlayer].q16horiz) - 100);
|
||||
break;
|
||||
}
|
||||
case kWeaponStaff:
|
||||
|
@ -985,6 +985,12 @@ void DrawWeapons(double smooth)
|
|||
nShade = sprite[PlayerList[nLocalPlayer].nSprite].shade;
|
||||
}
|
||||
|
||||
double const look_anghalf = getHalfLookAng(PlayerList[nLocalPlayer].oq16look_ang, PlayerList[nLocalPlayer].q16look_ang, cl_syncinput, smooth);
|
||||
double const looking_arc = fabs(look_anghalf) / 4.5;
|
||||
|
||||
xOffset -= look_anghalf;
|
||||
yOffset += looking_arc;
|
||||
|
||||
seq_DrawGunSequence(var_28, PlayerList[nLocalPlayer].field_3FOUR, xOffset, yOffset, nShade, nPal);
|
||||
|
||||
if (nWeapon != kWeaponM60)
|
||||
|
|
|
@ -196,7 +196,6 @@ void InitLevel(int level) // todo: use a map record
|
|||
totalmoves = 0;
|
||||
GrabPalette();
|
||||
ResetMoveFifo();
|
||||
nPlayerDAng = 0;
|
||||
lPlayerXVel = 0;
|
||||
lPlayerYVel = 0;
|
||||
movefifopos = movefifoend;
|
||||
|
|
|
@ -201,6 +201,7 @@ static void processMovement(ControlInfo* const hidInput)
|
|||
{
|
||||
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);
|
||||
UpdatePlayerSpriteAngle(pPlayer);
|
||||
}
|
||||
|
||||
playerProcessHelpers(&pPlayer->q16angle, &pPlayer->angAdjust, &pPlayer->angTarget, &pPlayer->q16horiz, &pPlayer->horizAdjust, &pPlayer->horizTarget, scaleAdjust);
|
||||
|
@ -220,7 +221,6 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
|
|||
{
|
||||
lPlayerYVel = 0;
|
||||
lPlayerXVel = 0;
|
||||
nPlayerDAng = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,6 @@ struct PlayerSave
|
|||
|
||||
int lPlayerXVel = 0;
|
||||
int lPlayerYVel = 0;
|
||||
fixed_t nPlayerDAng = 0;
|
||||
short obobangle = 0, bobangle = 0;
|
||||
short bPlayerPan = 0;
|
||||
short bLockPan = 0;
|
||||
|
@ -338,6 +337,10 @@ void RestartPlayer(short nPlayer)
|
|||
}
|
||||
|
||||
PlayerList[nPlayer].opos = sprite[nSprite].pos;
|
||||
PlayerList[nPlayer].oq16angle = PlayerList[nPlayer].q16angle;
|
||||
PlayerList[nPlayer].oq16horiz = PlayerList[nPlayer].q16horiz;
|
||||
PlayerList[nPlayer].oq16look_ang = PlayerList[nPlayer].q16look_ang = 0;
|
||||
PlayerList[nPlayer].oq16rotscrnang = PlayerList[nPlayer].q16rotscrnang = 0;
|
||||
|
||||
nPlayerFloorSprite[nPlayer] = floorspr;
|
||||
|
||||
|
@ -437,7 +440,7 @@ void RestartPlayer(short nPlayer)
|
|||
nYDamage[nPlayer] = 0;
|
||||
nXDamage[nPlayer] = 0;
|
||||
|
||||
PlayerList[nPlayer].q16horiz = IntToFixed(100);
|
||||
PlayerList[nPlayer].oq16horiz = PlayerList[nPlayer].q16horiz = IntToFixed(100);
|
||||
nBreathTimer[nPlayer] = 90;
|
||||
|
||||
nTauntTimer[nPlayer] = RandomSize(3) + 3;
|
||||
|
@ -454,7 +457,6 @@ void RestartPlayer(short nPlayer)
|
|||
if (nPlayer == nLocalPlayer)
|
||||
{
|
||||
nLocalSpr = nSprite;
|
||||
nPlayerDAng = 0;
|
||||
|
||||
SetMagicFrame();
|
||||
RestoreGreenPal();
|
||||
|
@ -538,7 +540,7 @@ void StartDeathSeq(int nPlayer, int nVal)
|
|||
|
||||
StopFiringWeapon(nPlayer);
|
||||
|
||||
PlayerList[nPlayer].q16horiz = IntToFixed(100);
|
||||
PlayerList[nPlayer].oq16horiz = PlayerList[nPlayer].q16horiz = IntToFixed(100);
|
||||
oeyelevel[nPlayer] = eyelevel[nPlayer] = -14080;
|
||||
nPlayerInvisible[nPlayer] = 0;
|
||||
dVertPan[nPlayer] = 15;
|
||||
|
@ -703,6 +705,11 @@ static void pickupMessage(int no)
|
|||
}
|
||||
}
|
||||
|
||||
void UpdatePlayerSpriteAngle(Player* pPlayer)
|
||||
{
|
||||
sprite[pPlayer->nSprite].ang = FixedToInt(pPlayer->q16angle);
|
||||
}
|
||||
|
||||
void FuncPlayer(int a, int nDamage, int nRun)
|
||||
{
|
||||
int var_48 = 0;
|
||||
|
@ -724,6 +731,10 @@ void FuncPlayer(int a, int nDamage, int nRun)
|
|||
short nSprite2;
|
||||
|
||||
PlayerList[nPlayer].opos = sprite[nPlayerSprite].pos;
|
||||
PlayerList[nPlayer].oq16angle = PlayerList[nPlayer].q16angle;
|
||||
PlayerList[nPlayer].oq16horiz = PlayerList[nPlayer].q16horiz;
|
||||
PlayerList[nPlayer].oq16look_ang = PlayerList[nPlayer].q16look_ang;
|
||||
PlayerList[nPlayer].oq16rotscrnang = PlayerList[nPlayer].q16rotscrnang;
|
||||
oeyelevel[nPlayer] = eyelevel[nPlayer];
|
||||
|
||||
switch (nMessage)
|
||||
|
@ -937,7 +948,12 @@ void FuncPlayer(int a, int nDamage, int nRun)
|
|||
}
|
||||
|
||||
// loc_1A494:
|
||||
sprite[nPlayerSprite].ang = FixedToInt(PlayerList[nPlayer].q16angle);
|
||||
if (cl_syncinput)
|
||||
{
|
||||
Player* pPlayer = &PlayerList[nPlayer];
|
||||
applylook(&pPlayer->q16angle, &pPlayer->q16look_ang, &pPlayer->q16rotscrnang, &pPlayer->spin, sPlayerInput[nPlayer].nAngle, &sPlayerInput[nLocalPlayer].actions, 1, false);
|
||||
UpdatePlayerSpriteAngle(pPlayer);
|
||||
}
|
||||
|
||||
// sprite[nPlayerSprite].zvel is modified within Gravity()
|
||||
short zVel = sprite[nPlayerSprite].zvel;
|
||||
|
@ -1034,9 +1050,11 @@ void FuncPlayer(int a, int nDamage, int nRun)
|
|||
{
|
||||
auto ang = GetAngleToSprite(nPlayerSprite, nSpiritSprite) & kAngleMask;
|
||||
playerSetAngle(&PlayerList[nPlayer].q16angle, &PlayerList[nPlayer].angTarget, ang);
|
||||
PlayerList[nPlayer].oq16angle = PlayerList[nPlayer].q16angle;
|
||||
sprite[nPlayerSprite].ang = ang;
|
||||
|
||||
playerSetHoriz(&PlayerList[nPlayer].q16horiz, &PlayerList[nPlayer].horizTarget, 100);
|
||||
PlayerList[nPlayer].oq16horiz = PlayerList[nPlayer].q16horiz;
|
||||
|
||||
lPlayerXVel = 0;
|
||||
lPlayerYVel = 0;
|
||||
|
@ -1045,8 +1063,6 @@ void FuncPlayer(int a, int nDamage, int nRun)
|
|||
sprite[nPlayerSprite].yvel = 0;
|
||||
sprite[nPlayerSprite].zvel = 0;
|
||||
|
||||
nPlayerDAng = 0;
|
||||
|
||||
if (nFreeze < 1)
|
||||
{
|
||||
nFreeze = 1;
|
||||
|
@ -1190,11 +1206,6 @@ void FuncPlayer(int a, int nDamage, int nRun)
|
|||
}
|
||||
|
||||
loc_1AB8E:
|
||||
if (cl_syncinput)
|
||||
{
|
||||
;// To be completed.
|
||||
}
|
||||
|
||||
playerX -= sprite[nPlayerSprite].x;
|
||||
playerY -= sprite[nPlayerSprite].y;
|
||||
|
||||
|
@ -2663,6 +2674,12 @@ loc_1BD2E:
|
|||
PlayerList[nPlayer].nAction = nActionB;
|
||||
PlayerList[nPlayer].field_2 = 0;
|
||||
}
|
||||
|
||||
if (cl_syncinput)
|
||||
{
|
||||
Player* pPlayer = &PlayerList[nPlayer];
|
||||
sethorizon(&pPlayer->q16horiz, sPlayerInput[nPlayer].pan, &sPlayerInput[nLocalPlayer].actions, 1);
|
||||
}
|
||||
}
|
||||
else // else, player's health is less than 0
|
||||
{
|
||||
|
@ -2833,7 +2850,6 @@ loc_1BD2E:
|
|||
static SavegameHelper sgh("player",
|
||||
SV(lPlayerXVel),
|
||||
SV(lPlayerYVel),
|
||||
SV(nPlayerDAng),
|
||||
SV(obobangle),
|
||||
SV(bobangle),
|
||||
SV(bPlayerPan),
|
||||
|
|
|
@ -43,7 +43,6 @@ extern int nLocalPlayer;
|
|||
|
||||
extern int lPlayerXVel;
|
||||
extern int lPlayerYVel;
|
||||
extern fixed_t nPlayerDAng;
|
||||
|
||||
struct Player
|
||||
{
|
||||
|
@ -127,6 +126,7 @@ short GetPlayerFromSprite(short nSprite);
|
|||
void SetPlayerMummified(int nPlayer, int bIsMummified);
|
||||
int AddAmmo(int nPlayer, int nWeapon, int nAmmoAmount);
|
||||
void ShootStaff(int nPlayer);
|
||||
void UpdatePlayerSpriteAngle(Player* pPlayer);
|
||||
|
||||
END_PS_NS
|
||||
|
||||
|
|
|
@ -38,7 +38,8 @@ struct PlayerInput
|
|||
int yVel;
|
||||
uint16_t buttons;
|
||||
short nTarget;
|
||||
fixed_t horizon;
|
||||
fixed_t nAngle;
|
||||
fixed_t pan;
|
||||
int8_t nItem;
|
||||
ESyncBits actions;
|
||||
|
||||
|
|
|
@ -376,7 +376,7 @@ void seq_DrawPilotLightSeq(double xOffset, double yOffset)
|
|||
double x = ChunkXpos[nFrameBase] + (160 + xOffset);
|
||||
double y = ChunkYpos[nFrameBase] + (100 + yOffset);
|
||||
|
||||
hud_drawsprite(x, y, 65536, fmod(-2 * FixedToFloat(nPlayerDAng), kAngleMask + 1), nTile, 0, 0, 1);
|
||||
hud_drawsprite(x, y, 65536, fmod(-2 * FixedToFloat(PlayerList[nLocalPlayer].q16angle), kAngleMask + 1), nTile, 0, 0, 1);
|
||||
nFrameBase++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1002,7 +1002,6 @@ void DrawStatusBar()
|
|||
}
|
||||
DExhumedStatusBar sbar;
|
||||
sbar.Draw();
|
||||
DrawCrosshair(MAXTILES, PlayerList[nLocalPlayer].nHealth >> 3, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -237,6 +237,9 @@ void DrawView(double smoothRatio, bool sceneonly)
|
|||
short nSector;
|
||||
fixed_t nAngle;
|
||||
fixed_t pan;
|
||||
fixed_t q16rotscrnang;
|
||||
|
||||
fixed_t dang = IntToFixed(1024);
|
||||
|
||||
zbob = Sin(2 * bobangle) >> 3;
|
||||
|
||||
|
@ -276,13 +279,32 @@ void DrawView(double smoothRatio, bool sceneonly)
|
|||
+ interpolate16(oeyelevel[nLocalPlayer], eyelevel[nLocalPlayer], smoothRatio);
|
||||
nSector = nPlayerViewSect[nLocalPlayer];
|
||||
updatesector(playerX, playerY, &nSector);
|
||||
nAngle = PlayerList[nLocalPlayer].q16angle;
|
||||
|
||||
if (!cl_syncinput)
|
||||
{
|
||||
nAngle = PlayerList[nLocalPlayer].q16angle + PlayerList[nLocalPlayer].q16look_ang;
|
||||
q16rotscrnang = PlayerList[nLocalPlayer].q16rotscrnang;
|
||||
}
|
||||
else
|
||||
{
|
||||
fixed_t oang, ang;
|
||||
|
||||
oang = PlayerList[nLocalPlayer].oq16angle + PlayerList[nLocalPlayer].oq16look_ang;
|
||||
ang = PlayerList[nLocalPlayer].q16angle + PlayerList[nLocalPlayer].q16look_ang;
|
||||
nAngle = oang + xs_CRoundToInt(fmulscale16(((ang + dang - oang) & 0x7FFFFFF) - dang, smoothRatio));
|
||||
|
||||
oang = PlayerList[nLocalPlayer].oq16rotscrnang + PlayerList[nLocalPlayer].oq16rotscrnang;
|
||||
ang = PlayerList[nLocalPlayer].q16rotscrnang + PlayerList[nLocalPlayer].q16rotscrnang;
|
||||
q16rotscrnang = oang + xs_CRoundToInt(fmulscale16(((ang + dang - oang) & 0x7FFFFFF) - dang, smoothRatio));
|
||||
}
|
||||
|
||||
if (!bCamera)
|
||||
{
|
||||
sprite[nPlayerSprite].cstat |= CSTAT_SPRITE_INVISIBLE;
|
||||
sprite[nDoppleSprite[nLocalPlayer]].cstat |= CSTAT_SPRITE_INVISIBLE;
|
||||
}
|
||||
|
||||
renderSetRollAngle(FixedToFloat(q16rotscrnang));
|
||||
}
|
||||
|
||||
nCameraa = nAngle;
|
||||
|
@ -299,7 +321,14 @@ void DrawView(double smoothRatio, bool sceneonly)
|
|||
viewz = playerZ + nQuake[nLocalPlayer];
|
||||
int floorZ = sector[sprite[nPlayerSprite].sectnum].floorz;
|
||||
|
||||
pan = PlayerList[nLocalPlayer].q16horiz;
|
||||
if (!cl_syncinput)
|
||||
{
|
||||
pan = PlayerList[nLocalPlayer].q16horiz;
|
||||
}
|
||||
else
|
||||
{
|
||||
pan = PlayerList[nLocalPlayer].oq16horiz + xs_CRoundToInt(fmulscale16(PlayerList[nLocalPlayer].q16horiz - PlayerList[nLocalPlayer].oq16horiz, smoothRatio));
|
||||
}
|
||||
|
||||
if (viewz > floorZ)
|
||||
viewz = floorZ;
|
||||
|
|
Loading…
Reference in a new issue