From be3967ab4ecbbe63d03e86464da24f7c880713b2 Mon Sep 17 00:00:00 2001 From: Agent X <44549182+Agent-11@users.noreply.github.com> Date: Wed, 6 Dec 2023 18:50:50 -0500 Subject: [PATCH] Shrink PVP hitboxes and re-add angle checks --- src/game/interaction.c | 5 +++++ src/game/object_collision.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/game/interaction.c b/src/game/interaction.c index 63a40bc32..62e791a99 100644 --- a/src/game/interaction.c +++ b/src/game/interaction.c @@ -31,6 +31,7 @@ #include "pc/network/network.h" #include "pc/network/lag_compensation.h" #include "pc/lua/smlua_hooks.h" +#include "pc/pc_main.h" u8 sDelayInvincTimer; s16 gInteractionInvulnerable; @@ -177,6 +178,10 @@ s16 mario_obj_angle_to_object(struct MarioState *m, struct Object *o) { static u32 determine_interaction_internal(struct MarioState *m, struct Object *o, u8 isPVP) { if (!m || !o) { return 0; } + // when set to false, angle checks apply again. I would just restore the original + // determine_interaction function but this is easier with keeping compatibility + if (!gCoopCompatibility) { isPVP = FALSE; } + u32 interaction = 0; u32 action = m->action; diff --git a/src/game/object_collision.c b/src/game/object_collision.c index 14501ee70..b6e480331 100644 --- a/src/game/object_collision.c +++ b/src/game/object_collision.c @@ -7,6 +7,7 @@ #include "object_list_processor.h" #include "spawn_object.h" #include "pc/network/network_player.h" +#include "pc/pc_main.h" struct Object *debug_print_obj_collision(struct Object *a) { if (!a) { return NULL; } @@ -38,7 +39,7 @@ int detect_player_hitbox_overlap(struct MarioState* local, struct MarioState* re f32 dx = aTorso[0] - bTorso[0]; UNUSED f32 sp30 = sp3C - sp38; f32 dz = aTorso[2] - bTorso[2]; - f32 collisionRadius = (a->hitboxRadius + b->hitboxRadius) * 2.25f; + f32 collisionRadius = (a->hitboxRadius + b->hitboxRadius) * (gCoopCompatibility ? 2.25f : 1.5f); f32 distance = sqrtf(dx * dx + dz * dz); if (collisionRadius * scale > distance) {