diff --git a/src/d_player.h b/src/d_player.h index e944d67348..7f57837c70 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -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); diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp index fab7e38d8d..e97d2c0208 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -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: diff --git a/src/p_user.cpp b/src/p_user.cpp index 0f3b6a516d..845cf9a5f4 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -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); } diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index d60cda823b..5b014bf28b 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -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; +} + //========================================================================== // //========================================================================== diff --git a/wadsrc/static/actors/shared/player.txt b/wadsrc/static/actors/shared/player.txt index ac5ceb0a7a..08d9a252ac 100644 --- a/wadsrc/static/actors/shared/player.txt +++ b/wadsrc/static/actors/shared/player.txt @@ -33,6 +33,7 @@ Actor PlayerPawn : Actor native Player.MugShotMaxHealth 0 Player.FlechetteType "ArtiPoisonBag3" Player.AirCapacity 1 + Player.ViewBob 1 Obituary "$OB_MPDEFAULT" }