mirror of
https://github.com/zeldaret/oot
synced 2026-05-24 15:21:04 -04:00
ed0ab877c9
* Add `BG_DYNA_ACTOR_FLAG_` for `DynaCollisionContext.bgActorFlags` * Document 3/4 bgActor flags * `func_8003EE6C` -> `DynaPoly_InvalidateLookup` * `DynaPoly_ExpandSRT` -> `DynaPoly_AddBgActorToLookup` * Add `DYNAPOLYACTOR_UNK160_` for `DynaPolyActor.unk_160` * More dynapoly docs * One comment * Some `DynaPoly_` -> `DynaPolyActor_` * run formatter * . * `BG_DYNA_ACTOR_FLAG_IS_USED` -> `BG_DYNA_ACTOR_FLAG_IN_USE` * `BG_DYNA_ACTOR_FLAG_` -> `BGACTOR_` * `DYNAPOLYACTOR_INTERACT_FLAG_` -> `DYNA_INTERACT_` * `ResetInteractFlags` -> `ClearInteractFlags` * Remove Has/Is prefix on dyna interact flags getters * format * remove now useless comments * Remove `!= 0` on interact flags getter usage * ceilings collision -> ceiling collision * `ClearInteractFlags` -> `UnsetInteractFlags` (pepega) * `UnsetInteractFlags` -> `UnsetAllInteractFlags` (pepega x2) * Add back `Is` prefix (no `Has` this time) to dyna interact flags getters
115 lines
3.2 KiB
C
115 lines
3.2 KiB
C
#include "global.h"
|
|
|
|
void DynaPolyActor_Init(DynaPolyActor* dynaActor, s32 flags) {
|
|
dynaActor->bgId = -1;
|
|
dynaActor->unk_15C = flags;
|
|
dynaActor->interactFlags = 0;
|
|
dynaActor->unk_150 = 0.0f;
|
|
dynaActor->unk_154 = 0.0f;
|
|
}
|
|
|
|
void DynaPolyActor_UnsetAllInteractFlags(DynaPolyActor* dynaActor) {
|
|
dynaActor->interactFlags = 0;
|
|
}
|
|
|
|
void DynaPolyActor_SetActorOnTop(DynaPolyActor* dynaActor) {
|
|
dynaActor->interactFlags |= DYNA_INTERACT_ACTOR_ON_TOP;
|
|
}
|
|
|
|
void DynaPolyActor_SetPlayerOnTop(DynaPolyActor* dynaActor) {
|
|
dynaActor->interactFlags |= DYNA_INTERACT_PLAYER_ON_TOP;
|
|
}
|
|
|
|
void DynaPoly_SetPlayerOnTop(CollisionContext* colCtx, s32 floorBgId) {
|
|
DynaPolyActor* dynaActor = DynaPoly_GetActor(colCtx, floorBgId);
|
|
|
|
if (dynaActor != NULL) {
|
|
DynaPolyActor_SetPlayerOnTop(dynaActor);
|
|
}
|
|
}
|
|
|
|
void DynaPolyActor_SetPlayerAbove(DynaPolyActor* dynaActor) {
|
|
dynaActor->interactFlags |= DYNA_INTERACT_PLAYER_ABOVE;
|
|
}
|
|
|
|
void DynaPoly_SetPlayerAbove(CollisionContext* colCtx, s32 floorBgId) {
|
|
DynaPolyActor* dynaActor = DynaPoly_GetActor(colCtx, floorBgId);
|
|
|
|
if (dynaActor != NULL) {
|
|
DynaPolyActor_SetPlayerAbove(dynaActor);
|
|
}
|
|
}
|
|
|
|
void func_80043538(DynaPolyActor* dynaActor) {
|
|
dynaActor->interactFlags |= DYNA_INTERACT_3;
|
|
}
|
|
|
|
s32 DynaPolyActor_IsActorOnTop(DynaPolyActor* dynaActor) {
|
|
if (dynaActor->interactFlags & DYNA_INTERACT_ACTOR_ON_TOP) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
s32 DynaPolyActor_IsPlayerOnTop(DynaPolyActor* dynaActor) {
|
|
if (dynaActor->interactFlags & DYNA_INTERACT_PLAYER_ON_TOP) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
s32 DynaPolyActor_IsPlayerAbove(DynaPolyActor* dynaActor) {
|
|
if (dynaActor->interactFlags & DYNA_INTERACT_PLAYER_ABOVE) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
s32 func_800435B4(DynaPolyActor* dynaActor) {
|
|
if (dynaActor->interactFlags & DYNA_INTERACT_3) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
s32 func_800435D8(PlayState* play, DynaPolyActor* dynaActor, s16 arg2, s16 arg3, s16 arg4) {
|
|
Vec3f posA;
|
|
Vec3f posB;
|
|
Vec3f posResult;
|
|
f32 sin = Math_SinS(dynaActor->unk_158);
|
|
f32 cos = Math_CosS(dynaActor->unk_158);
|
|
s32 bgId;
|
|
CollisionPoly* poly;
|
|
f32 a2;
|
|
f32 a3;
|
|
f32 sign = (0.0f <= dynaActor->unk_150) ? 1.0f : -1.0f;
|
|
|
|
a2 = (f32)arg2 - 0.1f;
|
|
posA.x = dynaActor->actor.world.pos.x + (a2 * cos);
|
|
posA.y = dynaActor->actor.world.pos.y + arg4;
|
|
posA.z = dynaActor->actor.world.pos.z - (a2 * sin);
|
|
|
|
a3 = (f32)arg3 - 0.1f;
|
|
posB.x = sign * a3 * sin + posA.x;
|
|
posB.y = posA.y;
|
|
posB.z = sign * a3 * cos + posA.z;
|
|
|
|
if (BgCheck_EntityLineTest3(&play->colCtx, &posA, &posB, &posResult, &poly, true, false, false, true, &bgId,
|
|
&dynaActor->actor, 0.0f)) {
|
|
return false;
|
|
}
|
|
posA.x = (dynaActor->actor.world.pos.x * 2) - posA.x;
|
|
posA.z = (dynaActor->actor.world.pos.z * 2) - posA.z;
|
|
posB.x = sign * a3 * sin + posA.x;
|
|
posB.z = sign * a3 * cos + posA.z;
|
|
if (BgCheck_EntityLineTest3(&play->colCtx, &posA, &posB, &posResult, &poly, true, false, false, true, &bgId,
|
|
&dynaActor->actor, 0.0f)) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|