From cdc7a88b04566eae275e43b4ea5b06430c4f15de Mon Sep 17 00:00:00 2001
From: lachwright <lachlanwright17@gmail.com>
Date: Wed, 20 Nov 2019 23:45:34 +0800
Subject: [PATCH] Add bump sounds to rollout rock & add Newton's third law to
 jumping off them

---
 src/info.c    | 2 +-
 src/p_enemy.c | 3 +++
 src/p_map.c   | 4 +++-
 src/p_user.c  | 2 ++
 4 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/info.c b/src/info.c
index 50da228e59..4049580583 100644
--- a/src/info.c
+++ b/src/info.c
@@ -13448,7 +13448,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
 		sfx_None,       // attacksound
 		S_NULL,         // painstate
 		12*TICRATE,     // painchance (sets how long an unridden rock should last before disappearing - set to 0 to disable)
-		sfx_None,       // painsound
+		sfx_s3k49,      // painsound
 		S_NULL,         // meleestate
 		S_NULL,         // missilestate
 		S_NULL,         // deathstate
diff --git a/src/p_enemy.c b/src/p_enemy.c
index ea09533dfd..26d079cb41 100644
--- a/src/p_enemy.c
+++ b/src/p_enemy.c
@@ -14534,6 +14534,9 @@ void A_RolloutRock(mobj_t *actor)
 
 	actor->friction = FRACUNIT; // turns out riding on solids sucks, so let's just make it easier on ourselves
 
+	if (actor->eflags & MFE_JUSTHITFLOOR)
+		S_StartSound(actor, actor->info->painsound);
+
 	if (actor->threshold)
 		actor->threshold--;
 
diff --git a/src/p_map.c b/src/p_map.c
index 28c5ac9553..97bff81569 100644
--- a/src/p_map.c
+++ b/src/p_map.c
@@ -1032,7 +1032,8 @@ static boolean PIT_CheckThing(mobj_t *thing)
 			P_SetPlayerMobjState(tmthing, S_PLAY_WALK);
 			tmthing->player->powers[pw_carry] = CR_ROLLOUT;
 			P_SetTarget(&tmthing->tracer, thing);
-			P_SetObjectMomZ(thing, tmthing->momz, true);
+			if (!P_IsObjectOnGround(thing))
+				thing->momz += tmthing->momz;
 			return true;
 		}
 	}
@@ -1063,6 +1064,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
 			thing->momy = tmthing->momy;
 			tmthing->momx = tempmomx;
 			tmthing->momy = tempmomy;
+			S_StartSound(thing, thing->info->painsound);
 		}
 	}
 
diff --git a/src/p_user.c b/src/p_user.c
index 47812744e8..f79e510806 100644
--- a/src/p_user.c
+++ b/src/p_user.c
@@ -4428,6 +4428,8 @@ void P_DoJump(player_t *player, boolean soundandstate)
 			player->mo->momz = 9*FRACUNIT;
 			if (P_MobjFlip(player->mo->tracer)*player->mo->tracer->momz > 0)
 				player->mo->momz += player->mo->tracer->momz;
+			if (!P_IsObjectOnGround(player->mo->tracer))
+				P_SetObjectMomZ(player->mo->tracer, -9*FRACUNIT, true);
 			player->powers[pw_carry] = CR_NONE;
 			player->mo->tracer->flags |= MF_PUSHABLE;
 			P_SetTarget(&player->mo->tracer->tracer, NULL);
-- 
GitLab