Skip to content

Commit

Permalink
Fix gravity for blood, corpses etc. being incorrectly halved when the…
Browse files Browse the repository at this point in the history
… 'Gravity Fix' gameplay setting is enabled (#104).
  • Loading branch information
BodbDearg committed May 25, 2024
1 parent f34ef0f commit 3394048
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion game/Doom/Base/i_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ texture_t gTex_CONNECT;

// The current network protocol version.
// Should be incremented whenever the data format being transmitted changes, or when updates might cause differences in game behavior.
static constexpr int32_t NET_PROTOCOL_VERSION = 32;
static constexpr int32_t NET_PROTOCOL_VERSION = 33;

// Previous game error checking value when we last sent to the other player.
// Have to store this because we always send 1 packet ahead for the next frame.
Expand Down
4 changes: 2 additions & 2 deletions game/Doom/Game/p_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@ static void P_ZMovement(mobj_t& mobj) noexcept {
else if ((mobj.flags & MF_NOGRAVITY) == 0) {
// Not hitting the floor and gravity is enabled, so apply it:
if (mobj.momz == 0) {
mobj.momz = -P_GetGravity();
mobj.momz = -GRAVITY;
} else {
mobj.momz -= P_GetGravity() / 2;
mobj.momz -= GRAVITY / 2;
}
}

Expand Down
4 changes: 2 additions & 2 deletions game/Doom/Game/p_tick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -985,9 +985,9 @@ void P_Stop([[maybe_unused]] const gameaction_t exitAction) noexcept {
}

//------------------------------------------------------------------------------------------------------------------------------------------
// Helper added for PsyDoom: returns the current gravity strength, adjusted for the game's current framerate (if that fix is enabled)
// Helper added for PsyDoom: returns the player gravity strength, adjusted for the game's current framerate (if that fix is enabled)
//------------------------------------------------------------------------------------------------------------------------------------------
fixed_t P_GetGravity() noexcept {
fixed_t P_GetPlayerGravity() noexcept {
fixed_t gravity = GRAVITY;

#if PSYDOOM_MODS
Expand Down
2 changes: 1 addition & 1 deletion game/Doom/Game/p_tick.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ gameaction_t P_Ticker() noexcept;
void P_Drawer() noexcept;
void P_Start() noexcept;
void P_Stop(const gameaction_t exitAction) noexcept;
fixed_t P_GetGravity() noexcept;
fixed_t P_GetPlayerGravity() noexcept;

#if PSYDOOM_MODS
void P_GatherTickInputs(TickInputs& inputs) noexcept;
Expand Down
2 changes: 1 addition & 1 deletion game/Doom/Game/p_user.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ static void P_PlayerZMovement(mobj_t& mobj) noexcept {
else {
// Not hitting the floor: do acceleration due to gravity.
// Gravity is doubled on the first falling tic to account for the fact that it was always being applied, even on the floor:
const fixed_t gravity = P_GetGravity();
const fixed_t gravity = P_GetPlayerGravity();
mobj.momz -= (mobj.momz == 0) ? gravity : gravity / 2;
}

Expand Down
2 changes: 1 addition & 1 deletion game/PsyDoom/DemoCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ BEGIN_NAMESPACE(DemoCommon)
// The current demo file format version.
// This should be incremented whenever the contents of or expected behavior of the demo file changes.
//------------------------------------------------------------------------------------------------------------------------------------------
static constexpr uint32_t DEMO_FILE_VERSION = 14;
static constexpr uint32_t DEMO_FILE_VERSION = 15;

//------------------------------------------------------------------------------------------------------------------------------------------
// Helper: calls 'byteSwap()' on the specified type if the host architecture is big endian.
Expand Down

0 comments on commit 3394048

Please sign in to comment.