From b405e88ec33caa16fc6e6868669f59bc003b147a Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 12 Mar 2023 23:42:14 -0700 Subject: [PATCH] Non-damaging UFO-player collision - UFO is always solid. - Adds a height check if the player is no boosting. - Stumbles if the player is within a 60 degree cone of the direction the UFO is moving. (Only applies if not boosting.) --- src/objects/ufo.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/objects/ufo.c b/src/objects/ufo.c index a4c46d58c..42607dcd9 100644 --- a/src/objects/ufo.c +++ b/src/objects/ufo.c @@ -728,9 +728,31 @@ void Obj_PlayerUFOCollide(mobj_t *ufo, mobj_t *other) { // Bump and deal damage. Obj_SpecialUFODamage(ufo, other, other, DMG_STEAL); - K_KartBouncing(other, ufo); other->player->sneakertimer = 0; } + else + { + const angle_t moveAngle = K_MomentumAngle(ufo); + const angle_t clipAngle = R_PointToAngle2(ufo->x, ufo->y, other->x, other->y); + + if (other->z > ufo->z + ufo->height) + { + return; // overhead + } + + if (other->z + other->height < ufo->z) + { + return; // underneath + } + + if (AngleDelta(moveAngle, clipAngle) < ANG60) + { + // in front + K_StumblePlayer(other->player); + } + } + + K_KartBouncing(other, ufo); } void Obj_UFOPieceThink(mobj_t *piece) @@ -950,4 +972,4 @@ UINT32 K_GetSpecialUFODistance(void) } return UINT32_MAX; -} \ No newline at end of file +}