mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 15:22:16 +00:00
- Added: PlayerPawn property "Player.ViewBob" which acts as a MoveBob/StillBob multiplier.
This commit is contained in:
parent
d819aafcf3
commit
1fab0cc514
5 changed files with 32 additions and 5 deletions
|
@ -168,6 +168,9 @@ public:
|
|||
// [CW] Fades for when you are being damaged.
|
||||
PalEntry DamageFade;
|
||||
|
||||
// [SP] ViewBob Multiplier
|
||||
double ViewBob;
|
||||
|
||||
bool UpdateWaterLevel (bool splash);
|
||||
bool ResetAirSupply (bool playgasp = true);
|
||||
|
||||
|
|
|
@ -582,8 +582,9 @@ void P_BobWeapon (player_t *player, float *x, float *y, double ticfrac)
|
|||
|
||||
if (curbob != 0)
|
||||
{
|
||||
float bobx = float(player->bob * Rangex);
|
||||
float boby = float(player->bob * Rangey);
|
||||
//[SP] Added in decorate player.viewbob checks
|
||||
float bobx = float(player->bob * Rangex * (float)player->mo->ViewBob);
|
||||
float boby = float(player->bob * Rangey * (float)player->mo->ViewBob);
|
||||
switch (bobstyle)
|
||||
{
|
||||
case AWeapon::BobNormal:
|
||||
|
|
|
@ -651,7 +651,8 @@ void APlayerPawn::Serialize(FSerializer &arc)
|
|||
("fallingscreammaxn", FallingScreamMaxSpeed, def->FallingScreamMaxSpeed)
|
||||
("userange", UseRange, def->UseRange)
|
||||
("aircapacity", AirCapacity, def->AirCapacity)
|
||||
("viewheight", ViewHeight, def->ViewHeight);
|
||||
("viewheight", ViewHeight, def->ViewHeight)
|
||||
("viewbob", ViewBob, def->ViewBob);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -1844,11 +1845,12 @@ void P_CalcHeight (player_t *player)
|
|||
return;
|
||||
}
|
||||
|
||||
//[SP] Added (x*player->mo->ViewBob) to allow DECORATE changes to view bobbing speed.
|
||||
if (still)
|
||||
{
|
||||
if (player->health > 0)
|
||||
{
|
||||
angle = level.time / (120 * TICRATE / 35.) * 360.;
|
||||
angle = level.time / (120 * TICRATE / 35.) * 360. * player->mo->ViewBob;
|
||||
bob = player->userinfo.GetStillBob() * angle.Sin();
|
||||
}
|
||||
else
|
||||
|
@ -1858,7 +1860,7 @@ void P_CalcHeight (player_t *player)
|
|||
}
|
||||
else
|
||||
{
|
||||
angle = level.time / (20 * TICRATE / 35.) * 360.;
|
||||
angle = level.time / (20 * TICRATE / 35.) * 360. * player->mo->ViewBob;
|
||||
bob = player->bob * angle.Sin() * (player->mo->waterlevel > 1 ? 0.25f : 0.5f);
|
||||
}
|
||||
|
||||
|
|
|
@ -2945,6 +2945,26 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, weaponslot, ISsssssssssssssssssssssssssssss
|
|||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// [SP] Player.Viewbob
|
||||
//
|
||||
//==========================================================================
|
||||
DEFINE_CLASS_PROPERTY_PREFIX(player, viewbob, F, PlayerPawn)
|
||||
{
|
||||
PROP_DOUBLE_PARM(z, 0);
|
||||
// [SP] Hard limits. This is to prevent terrywads from making players sick.
|
||||
// Remember - this messes with a user option who probably has it set a
|
||||
// certain way for a reason. I think a 1.5 limit is pretty generous, but
|
||||
// it may be safe to increase it. I really need opinions from people who
|
||||
// could be affected by this.
|
||||
if (z < 0.0 || z > 1.5)
|
||||
{
|
||||
I_Error("ViewBob must be between 0.0 and 1.5.");
|
||||
}
|
||||
defaults->ViewBob = z;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//==========================================================================
|
||||
|
|
|
@ -33,6 +33,7 @@ Actor PlayerPawn : Actor native
|
|||
Player.MugShotMaxHealth 0
|
||||
Player.FlechetteType "ArtiPoisonBag3"
|
||||
Player.AirCapacity 1
|
||||
Player.ViewBob 1
|
||||
Obituary "$OB_MPDEFAULT"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue