mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-01 08:31:14 +00:00
Add CF_INTERPVIEW for players.
- Added CF_INTERPVIEW flag for players. A_SetPitch/A_SetAngle and the similar ACS APROPs set this when changing an angle. This forces the renderer to interpolate the view angles instead of updating with the latest mouse positions. The effect lasts one tick.
This commit is contained in:
parent
03f19a12fa
commit
1f723c10ae
7 changed files with 43 additions and 7 deletions
|
@ -764,6 +764,10 @@ public:
|
||||||
return (PalEntry)GetClass()->Meta.GetMetaInt(AMETA_BloodColor);
|
return (PalEntry)GetClass()->Meta.GetMetaInt(AMETA_BloodColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// These also set CF_INTERPVIEW for players.
|
||||||
|
void SetPitch(int p);
|
||||||
|
void SetAngle(angle_t ang);
|
||||||
|
|
||||||
const PClass *GetBloodType(int type = 0) const
|
const PClass *GetBloodType(int type = 0) const
|
||||||
{
|
{
|
||||||
const PClass *bloodcls;
|
const PClass *bloodcls;
|
||||||
|
|
|
@ -198,6 +198,7 @@ typedef enum
|
||||||
CF_INSTANTWEAPSWITCH= 1 << 11, // [RH] Switch weapons instantly
|
CF_INSTANTWEAPSWITCH= 1 << 11, // [RH] Switch weapons instantly
|
||||||
CF_TOTALLYFROZEN = 1 << 12, // [RH] All players can do is press +use
|
CF_TOTALLYFROZEN = 1 << 12, // [RH] All players can do is press +use
|
||||||
CF_PREDICTING = 1 << 13, // [RH] Player movement is being predicted
|
CF_PREDICTING = 1 << 13, // [RH] Player movement is being predicted
|
||||||
|
CF_INTERPVIEW = 1 << 14, // [RH] view was changed outside of input, so interpolate one frame
|
||||||
CF_DRAIN = 1 << 16, // Player owns a drain powerup
|
CF_DRAIN = 1 << 16, // Player owns a drain powerup
|
||||||
CF_HIGHJUMP = 1 << 18, // more Skulltag flags. Implementation not guaranteed though. ;)
|
CF_HIGHJUMP = 1 << 18, // more Skulltag flags. Implementation not guaranteed though. ;)
|
||||||
CF_REFLECTION = 1 << 19,
|
CF_REFLECTION = 1 << 19,
|
||||||
|
|
|
@ -8250,7 +8250,9 @@ scriptwait:
|
||||||
if (STACK(2) == 0)
|
if (STACK(2) == 0)
|
||||||
{
|
{
|
||||||
if (activator != NULL)
|
if (activator != NULL)
|
||||||
activator->angle = STACK(1) << 16;
|
{
|
||||||
|
activator->SetAngle(STACK(1) << 16);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -8259,7 +8261,7 @@ scriptwait:
|
||||||
|
|
||||||
while ( (actor = iterator.Next ()) )
|
while ( (actor = iterator.Next ()) )
|
||||||
{
|
{
|
||||||
actor->angle = STACK(1) << 16;
|
actor->SetAngle(STACK(1) << 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sp -= 2;
|
sp -= 2;
|
||||||
|
@ -8269,7 +8271,9 @@ scriptwait:
|
||||||
if (STACK(2) == 0)
|
if (STACK(2) == 0)
|
||||||
{
|
{
|
||||||
if (activator != NULL)
|
if (activator != NULL)
|
||||||
activator->pitch = STACK(1) << 16;
|
{
|
||||||
|
activator->SetPitch(STACK(1) << 16);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -8278,7 +8282,7 @@ scriptwait:
|
||||||
|
|
||||||
while ( (actor = iterator.Next ()) )
|
while ( (actor = iterator.Next ()) )
|
||||||
{
|
{
|
||||||
actor->pitch = STACK(1) << 16;
|
actor->SetPitch(STACK(1) << 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sp -= 2;
|
sp -= 2;
|
||||||
|
|
|
@ -2962,6 +2962,30 @@ void AActor::SetShade (int r, int g, int b)
|
||||||
fillcolor = MAKEARGB(ColorMatcher.Pick (r, g, b), r, g, b);
|
fillcolor = MAKEARGB(ColorMatcher.Pick (r, g, b), r, g, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AActor::SetPitch(int p)
|
||||||
|
{
|
||||||
|
if (p != pitch)
|
||||||
|
{
|
||||||
|
pitch = p;
|
||||||
|
if (player != NULL)
|
||||||
|
{
|
||||||
|
player->cheats |= CF_INTERPVIEW;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AActor::SetAngle(angle_t ang)
|
||||||
|
{
|
||||||
|
if (ang != angle)
|
||||||
|
{
|
||||||
|
angle = ang;
|
||||||
|
if (player != NULL)
|
||||||
|
{
|
||||||
|
player->cheats |= CF_INTERPVIEW;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// P_MobjThinker
|
// P_MobjThinker
|
||||||
//
|
//
|
||||||
|
|
|
@ -2252,6 +2252,9 @@ void P_PlayerThink (player_t *player)
|
||||||
{
|
{
|
||||||
player->inventorytics--;
|
player->inventorytics--;
|
||||||
}
|
}
|
||||||
|
// Don't interpolate the view for more than one tic
|
||||||
|
player->cheats &= ~CF_INTERPVIEW;
|
||||||
|
|
||||||
// No-clip cheat
|
// No-clip cheat
|
||||||
if ((player->cheats & (CF_NOCLIP | CF_NOCLIP2)) == CF_NOCLIP2)
|
if ((player->cheats & (CF_NOCLIP | CF_NOCLIP2)) == CF_NOCLIP2)
|
||||||
{ // No noclip2 without noclip
|
{ // No noclip2 without noclip
|
||||||
|
|
|
@ -581,6 +581,7 @@ void R_InterpolateView (player_t *player, fixed_t frac, InterpolationViewer *ivi
|
||||||
viewy = iview->oviewy + FixedMul (frac, iview->nviewy - iview->oviewy);
|
viewy = iview->oviewy + FixedMul (frac, iview->nviewy - iview->oviewy);
|
||||||
viewz = iview->oviewz + FixedMul (frac, iview->nviewz - iview->oviewz);
|
viewz = iview->oviewz + FixedMul (frac, iview->nviewz - iview->oviewz);
|
||||||
if (player != NULL &&
|
if (player != NULL &&
|
||||||
|
!(player->cheats & CF_INTERPVIEW) &&
|
||||||
player - players == consoleplayer &&
|
player - players == consoleplayer &&
|
||||||
camera == player->mo &&
|
camera == player->mo &&
|
||||||
!demoplayback &&
|
!demoplayback &&
|
||||||
|
|
|
@ -3935,7 +3935,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetAngle)
|
||||||
{
|
{
|
||||||
ACTION_PARAM_START(1);
|
ACTION_PARAM_START(1);
|
||||||
ACTION_PARAM_ANGLE(angle, 0);
|
ACTION_PARAM_ANGLE(angle, 0);
|
||||||
self->angle = angle;
|
self->SetAngle(angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
@ -3973,8 +3973,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetPitch)
|
||||||
}
|
}
|
||||||
pitch = clamp<int>(pitch, min, max);
|
pitch = clamp<int>(pitch, min, max);
|
||||||
}
|
}
|
||||||
|
self->SetPitch(pitch);
|
||||||
self->pitch = pitch;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
Loading…
Reference in a new issue