- Added: PlayerPawn property "Player.ViewBob" which acts as a MoveBob/StillBob multiplier.

This commit is contained in:
raa-eruanna 2016-09-26 07:24:37 -04:00 committed by Christoph Oelckers
parent 513f8312b3
commit e0efdd97b3
5 changed files with 32 additions and 5 deletions

View file

@ -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);

View file

@ -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:

View file

@ -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);
}

View file

@ -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;
}
//==========================================================================
//
//==========================================================================

View file

@ -33,6 +33,7 @@ Actor PlayerPawn : Actor native
Player.MugShotMaxHealth 0
Player.FlechetteType "ArtiPoisonBag3"
Player.AirCapacity 1
Player.ViewBob 1
Obituary "$OB_MPDEFAULT"
}