From 62c708e64a6ec889f8b0107dc0b07cd641ee14d3 Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 29 Jul 2019 20:29:02 +0100 Subject: [PATCH] Two one liners related to angles, so doin' em in a single branch. * If a spring has vertical speed AND horizontal speed, always set the player's angle when touching it. * If you have less than 32 rings and spill them, they now get launched away from the player's motion, rather than in the direction of the camera. --- src/p_inter.c | 9 +++++++-- src/p_map.c | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index abf33429f..5b52f2ffb 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -3652,7 +3652,7 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings) { INT32 i; mobj_t *mo; - angle_t fa; + angle_t fa, va; fixed_t ns; fixed_t z; boolean nightsreplace = ((maptol & TOL_NIGHTS) && !G_IsSpecialStage(gamemap)); @@ -3674,6 +3674,11 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings) // Spill weapons first P_PlayerWeaponPanelOrAmmoBurst(player); + if (abs(player->mo->momx) > player->mo->scale || abs(player->mo->momy) > player->mo->scale) + va = R_PointToAngle2(player->mo->momx, player->mo->momy, 0, 0)>>ANGLETOFINESHIFT; + else + va = player->mo->angle>>ANGLETOFINESHIFT; + for (i = 0; i < num_rings; i++) { INT32 objType = mobjinfo[MT_RING].reactiontime; @@ -3695,7 +3700,7 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings) P_SetScale(mo, player->mo->scale); // Angle offset by player angle, then slightly offset by amount of rings - fa = ((i*FINEANGLES/16) + (player->mo->angle>>ANGLETOFINESHIFT) - ((num_rings-1)*FINEANGLES/32)) & FINEMASK; + fa = ((i*FINEANGLES/16) + va - ((num_rings-1)*FINEANGLES/32)) & FINEMASK; // Make rings spill out around the player in 16 directions like SA, but spill like Sonic 2. // Technically a non-SA way of spilling rings. They just so happen to be a little similar. diff --git a/src/p_map.c b/src/p_map.c index e78dd1e84..8fe9fb4ae 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -342,7 +342,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object) if (horizspeed) { object->player->drawangle = spring->angle; - if (object->player->cmd.forwardmove == 0 && object->player->cmd.sidemove == 0) + if (vertispeed || (object->player->cmd.forwardmove == 0 && object->player->cmd.sidemove == 0)) { object->angle = spring->angle;