mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
Fix water pvp
This commit is contained in:
parent
110d6ef32e
commit
95adc3206e
1 changed files with 7 additions and 7 deletions
|
|
@ -153,13 +153,13 @@ u32 determine_interaction(struct MarioState *m, struct Object *o) {
|
||||||
|
|
||||||
// hack: make water punch actually do something
|
// hack: make water punch actually do something
|
||||||
if (interaction == 0 && m->action == ACT_WATER_PUNCH && o->oInteractType & INTERACT_PLAYER) {
|
if (interaction == 0 && m->action == ACT_WATER_PUNCH && o->oInteractType & INTERACT_PLAYER) {
|
||||||
f32 cossFaceAngle0 = coss(m->faceAngle[0]);
|
s16 dYawToObject = mario_obj_angle_to_object(m, o) - m->faceAngle[1];
|
||||||
Vec3f facing = { coss(m->faceAngle[1])*cossFaceAngle0, sins(m->faceAngle[0]), sins(m->faceAngle[1])*cossFaceAngle0 };
|
f32 dPitchX = o->oPosX - m->pos[0];
|
||||||
Vec3f dif = { o->oPosX - m->pos[0], (o->oPosY + o->hitboxHeight * 0.5) - m->pos[1], o->oPosZ - m->pos[2] };
|
f32 dPitchY = (o->oPosY + o->hitboxHeight) - m->pos[1];
|
||||||
vec3f_normalize(dif);
|
f32 dPitchZ = o->oPosZ - m->pos[2];
|
||||||
f32 angle = vec3f_dot(facing, dif);
|
f32 dPitchXZ = sqrtf(dPitchX*dPitchX + dPitchZ*dPitchZ);
|
||||||
// Unknown angle (60 degrees in each direction?)
|
s16 dPitchToObject = atan2s(dPitchY, dPitchXZ) - m->faceAngle[0];
|
||||||
if (angle >= 0.5f) {
|
if ((-0x2AAA <= dYawToObject && dYawToObject <= 0x2AAA) && (-0x2AAA <= dPitchToObject && dPitchToObject <= 0x2AAA)) {
|
||||||
interaction = INT_PUNCH;
|
interaction = INT_PUNCH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue