mirror of
https://github.com/zeldaret/mm.git
synced 2026-06-08 12:17:05 -04:00
6069a1585f
* Match Player_GetHeight * Another bunch * Fix merge conflict * rename Gfx_DrawDListXlu * add WEEROR * Actor_Spawn * almost Actor_SpawnTransitionActors and Actor_Delete * A bunch of small actors * More renames * format * Some Player renames * a few more * import data * run formatter * func_800B7170 * whoops * Fix merge issues * Whoops 2 * func_800B83BC and func_800B83F8 * Actor_IsActorFacingPlayerAndWithinRange * add some prototypes * match Actor_UpdateBgCheckInfo * func_800B7678 * mark Actor_SpawnAsChildAndCutscene as non_matching * Actor_Draw * Update is chaotic * 2 new matches * func_800BC8B8 * Another bunch * function renames * run formatter * cleanup * remove unnecesary casts * add missing sfx * Fix renames * fix merge * func_800BF7CC * small bunch * another bunch * func_800BE184 non_matching * two more * split z_cheap_proc * Another bunch * another bunch * a few and a non matching * yeee * a * Actor_DrawAll non_equivalent * Actor_RecordUndrawnActor * i don't know what to put in this commit message * func_800B4B50 non matching * func_800B42F8 non matching * func_800B5040 * func_800B5814 non_equiv * func_800B6584 * func_800B6608 * func_800B6680 * func_800B7E04 * func_800B8118 * func_800b9170 * , * func_800BC4EC * func_800BA6FC * func_800BA798 * func_800BA8B8 * Actor_LoadOverlay * small cleanup * func_800BB2D0 * meh * func_800BBAC0 * func_800BC270 * func_800B5208 non matching * Fix warnings * meh * rename some ActorShadow_ functions * fairy * Flags_ * fix warnings * format * Actor_PickUp and family * func_800B8E58 * match Actor_RemoveFromCategory * another bit of docs * Match func_800B86C8 * And another bit * rename Player_GetRunSpeedLimit * func_800B9E84 * func_800BE63C * func_800BB8EC * match func_800B5814 * match func_800B9334 * cleanup * fix conflicts: first pass * another fix * actorfixer fix * fix conflicts * func_800BE680 non_equivalent * Improve func_800BE680 a bit * func_800BE680 equivalent (?) * func_800BE680 equivalent * Actor_UpdateActor equivalent * format * use some ExchangeItemID enum values * Some more cleaning * more cleanup * More name stealing from OoT * match func_800B82EC * match func_800B9D1C and a bit of cleanup * Add ACTOR_FLAGS placeholders * Renames and match func_800BE184 * last pass of name stealing * format * fix conflicts * more cleanup * more cleanup * cleanup and OVERLAY_RELOCATION_OFFSET macro * Remove prototypes of obviously internal-only functions, update variable names, forward declare where necessary, remove all `param_\d`s * remove newlines * minor rename * Use ACTOR_FLAGS in z_actor * Match func_800BE3D0 * Rename movement functions * Document Actor_CalcOffsetOrientedToDrawRotation * velX -> horizontalSpeed * A bit of documentation for actor movement functions * format * Fix merge issues * format * Format * Fix renames * fix warnings * fix conflicts * review :D * Update src/overlays/actors/ovl_En_Ma4/z_en_ma4.c Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * Fix * format * Actor_SpawnSetupActors * engineer review * Update src/code/z_actor.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * A bunch of Engineer's reviews * more Engineer's review * a * whoops * run actorfixer * c'mon * 😮💨 * whoops * warning * More engineer's review * run format * I'm dumb * a * match func_800BE680 * Match Actor_DrawZTarget * Match Actor_SpawnAsChildAndCutscene, fix non-equivalent in Actor_UpdateActor * Fix merge issue * format * update actor * Steal a bit of @Thar0 documentation from OoT's z_message * Run actorfixer * Fix renames * Match func_800B4B50 thanks to @hensldm * Improve ActorShadow_DrawFeet thanks to @hensldm * whoops * Actor_PlaySfxAtProjectedPos * Actor_UpdateActor matched by @hensldm * Match func_800BA2FC by @hensldm * Match Actor_SpawnTransitionActors by @hensldm * Match func_800BB604 by @hensldm * Match Actor_DrawAll by @hensldm * ActorShadow_DrawFeet by @hensldm * Actor_UpdateAll by @hensldm * Match func_800BCCDC by @engineer124 * Small Actor_PlaySfxAtPos by @engineer124 * ACTOR_FLAGS_ALL and a bit of cleanup * Add invisible comment * Small docs pass * Fix merge * Engineer's review * format lol * Actor_DrawDoorLock docs * Actor_SpawnShieldParticlesMetal * fix merge issues * sActorFaultClient * fix * commit message * Run actorfixer.py && format.sh * Fix warnings * fixes * format * bss * Update include/functions.h Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> * Address review * Fix merge issues, format and such * fix merge issues * Add ACTORCAT_MAX * actorList -> actorLists * Fix merge issues * format * Enable WERROR on jenkinsfile * Fix merge * Use object symbols * address review * format * review * fix merge issues * fix * VRAM_PTR_SIZE, small cleanup and format * review Co-authored-by: Elliptic Ellipsis <elliptic.ellipsis@gmail.com> Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> Co-authored-by: engineer124 <engineer124engineer124@gmail.com>
164 lines
4.4 KiB
C
164 lines
4.4 KiB
C
#include "global.h"
|
|
|
|
typedef struct {
|
|
Actor actor;
|
|
s32 (*pictoFunc)(GlobalContext* globalCtx, Actor* actor);
|
|
} PictoActor;
|
|
|
|
s32 func_8013A240(GlobalContext* globalCtx) {
|
|
PictoActor* pictoActor;
|
|
Actor* actor;
|
|
s32 type = 0;
|
|
s32 seen;
|
|
s32 count = 0;
|
|
|
|
gSaveContext.roomInf[123][3] = 0;
|
|
gSaveContext.roomInf[123][4] = 0;
|
|
|
|
if (globalCtx->sceneNum == SCENE_20SICHITAI) {
|
|
func_8013A41C(1);
|
|
}
|
|
|
|
for (; type < 12; type++) {
|
|
for (actor = globalCtx->actorCtx.actorLists[type].first; actor != NULL; actor = actor->next) {
|
|
seen = 0;
|
|
|
|
switch (globalCtx->sceneNum) {
|
|
case SCENE_20SICHITAI:
|
|
if ((actor->id == ACTOR_EN_MNK) || (actor->id == ACTOR_EN_BIGOKUTA)) {
|
|
seen = 1;
|
|
}
|
|
break;
|
|
default:
|
|
seen = 0;
|
|
}
|
|
|
|
if (actor->id) {
|
|
; // Needed to match
|
|
}
|
|
|
|
switch (actor->id) {
|
|
case ACTOR_EN_KAKASI:
|
|
if ((actor->params & 1) == 1) {
|
|
seen |= 2;
|
|
break; //! @bug break is inside conditional, meaning it falls through if it is false
|
|
}
|
|
case ACTOR_EN_ZOV:
|
|
seen |= 2;
|
|
break;
|
|
case ACTOR_EN_BAL:
|
|
seen |= 2;
|
|
break;
|
|
case ACTOR_EN_DNQ:
|
|
seen |= 2;
|
|
break;
|
|
case ACTOR_EN_GE1:
|
|
case ACTOR_EN_GE3:
|
|
case ACTOR_EN_KAIZOKU:
|
|
case ACTOR_EN_GE2:
|
|
seen |= 2;
|
|
break;
|
|
}
|
|
|
|
if (seen != 0) {
|
|
pictoActor = (PictoActor*)actor;
|
|
if (pictoActor->pictoFunc != NULL) {
|
|
if ((pictoActor->pictoFunc)(globalCtx, actor) == 0) {
|
|
count++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return count;
|
|
}
|
|
|
|
void func_8013A41C(s32 flag) {
|
|
if (flag < 0x20) {
|
|
gSaveContext.roomInf[123][3] |= (1 << flag);
|
|
} else {
|
|
flag &= 0x1F;
|
|
gSaveContext.roomInf[123][4] |= (1 << flag);
|
|
}
|
|
}
|
|
|
|
void func_8013A46C(s32 flag) {
|
|
if (flag < 0x20) {
|
|
gSaveContext.roomInf[123][3] &= ~(1 << flag);
|
|
} else {
|
|
flag &= 0x1F;
|
|
gSaveContext.roomInf[123][4] &= ~(1 << flag);
|
|
}
|
|
}
|
|
|
|
u32 func_8013A4C4(s32 flag) {
|
|
SaveContext* saveCtx = &gSaveContext;
|
|
|
|
if (flag < 0x20) {
|
|
return saveCtx->roomInf[123][3] & (1 << flag);
|
|
} else {
|
|
flag &= 0x1F;
|
|
return saveCtx->roomInf[123][4] & (1 << flag);
|
|
}
|
|
}
|
|
|
|
s16 func_8013A504(s16 val) {
|
|
return (val >= 0) ? val : -val;
|
|
}
|
|
|
|
s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos, Vec3s* rot, f32 distanceMin,
|
|
f32 distanceMax, s16 angleError) {
|
|
Vec3f screenSpace;
|
|
s16 x;
|
|
s16 y;
|
|
f32 distance;
|
|
CollisionPoly* poly;
|
|
Camera* camera;
|
|
Actor* actors[2];
|
|
s32 ret = 0;
|
|
s32 bgId;
|
|
|
|
camera = GET_ACTIVE_CAM(globalCtx);
|
|
|
|
distance = OLib_Vec3fDist(pos, &camera->eye);
|
|
if ((distance < distanceMin) || (distanceMax < distance)) {
|
|
func_8013A41C(0x3f);
|
|
ret = 0x3f;
|
|
}
|
|
|
|
x = func_8013A504(func_800DFCB4(camera) + rot->x);
|
|
y = func_8013A504(func_800DFCDC(camera) - (s16)(rot->y - 0x7FFF));
|
|
if ((0 < angleError) && ((angleError < x) || (angleError < y))) {
|
|
func_8013A41C(0x3e);
|
|
ret |= 0x3e;
|
|
}
|
|
|
|
Actor_GetProjectedPos(globalCtx, pos, &screenSpace, &distance);
|
|
x = (s16)(screenSpace.x * distance * 160.0f + 160.0f) - 85;
|
|
y = (s16)(screenSpace.y * distance * -120.0f + 120.0f) - 67;
|
|
if ((x < 0) || (0x96 < x) || (y < 0) || (0x69 < y)) {
|
|
func_8013A41C(0x3d);
|
|
ret |= 0x3d;
|
|
}
|
|
|
|
if (BgCheck_ProjectileLineTest(&globalCtx->colCtx, pos, &camera->eye, &screenSpace, &poly, true, true, true, true,
|
|
&bgId)) {
|
|
func_8013A41C(0x3c);
|
|
ret |= 0x3c;
|
|
}
|
|
|
|
actors[0] = actor;
|
|
actors[1] = &GET_PLAYER(globalCtx)->actor;
|
|
if (CollisionCheck_LineOCCheck(globalCtx, &globalCtx->colChkCtx, pos, &camera->eye, actors, 2) != 0) {
|
|
func_8013A41C(0x3b);
|
|
ret |= 0x3b;
|
|
}
|
|
|
|
if (ret == 0) {
|
|
func_8013A41C(flag);
|
|
}
|
|
|
|
return ret;
|
|
}
|