diff --git a/Makefile b/Makefile index cdb2997f92..64707e34a4 100644 --- a/Makefile +++ b/Makefile @@ -63,7 +63,7 @@ ASFLAGS := -march=vr4300 -32 MIPS_VERSION := -mips2 # we support Microsoft extensions such as anonymous structs, which the compiler does support but warns for their usage. Surpress the warnings with -woff. -CFLAGS += -G 0 -non_shared -Xfullwarn -Xcpluscomm -Iinclude -I./ -Isrc -Wab,-r4300_mul -woff 649,838,712 +CFLAGS += -G 0 -non_shared -Xfullwarn -Xcpluscomm -Iinclude -I./ -Isrc -Wab,-r4300_mul -woff 624,649,838,712 #### Files #### diff --git a/include/functions.h b/include/functions.h index 4843c0fa64..642c8547c4 100644 --- a/include/functions.h +++ b/include/functions.h @@ -11,7 +11,7 @@ double sqrt(double d); #pragma intrinsic(sqrt) void bootproc(void); -void Idle_ClearMemory(const void* begin, const void* end); +void Idle_ClearMemory(void* begin, void* end); void Idle_InitFramebuffer(u32* ptr, u32 numBytes, u32 value); void Idle_InitScreen(void); void Idle_InitMemory(void); @@ -110,7 +110,7 @@ void FaultDrawer_SetCharPad(s8 padW, s8 padH); void FaultDrawer_SetCursor(s32 x, s32 y); void FaultDrawer_FillScreen(void); FaultDrawer* FaultDrawer_FormatStringFunc(FaultDrawer* arg, const char* str, s32 count); -void FaultDrawer_VPrintf(char* str, char* args); +void FaultDrawer_VPrintf(const char* str, char* args); void FaultDrawer_Printf(const char* fmt, ...); void FaultDrawer_DrawText(s32 x, s32 y, const char* fmt, ...); void FaultDrawer_SetDrawerFB(void* fb, u16 w, u16 h); @@ -369,7 +369,7 @@ s32 osContStartQuery(OSMesgQueue* mq); void osContGetQuery(OSContStatus* data); void guLookAtHiliteF(float mf[4][4], LookAt* l, Hilite* h, f32 xEye, f32 yEye, f32 zEye, f32 xAt, f32 yAt, f32 zAt, f32 xUp, f32 yUp, f32 zUp, f32 xl1, f32 yl1, f32 zl1, f32 xl2, f32 yl2, f32 zl2, s32 twidth, s32 theight); void guLookAtHilite(Mtx* m, LookAt* l, Hilite* h, f32 xEye, f32 yEye, f32 zEye, f32 xAt, f32 yAt, f32 zAt, f32 xUp, f32 yUp, f32 zUp, f32 xl1, f32 yl1, f32 zl1, f32 xl2, f32 yl2, f32 zl2, s32 twidth, s32 theight); -s32 _Printf(printf_func pfn, void* arg, char* fmt, va_list ap); +s32 _Printf(printf_func pfn, void* arg, const char* fmt, va_list ap); void _Putfld(_Pft* px, va_list* pap, u8 code, u8* ac); // void func_8008ED30(void); void osUnmapTLBAll(void); @@ -972,13 +972,13 @@ void func_800C3C00(CollisionContext* bgCtxt, u32 param_2); void func_800C3C14(CollisionContext* bgCtxt, u32 param_2); CollisionHeader* BgCheck_GetActorMeshHeader(CollisionContext* bgCtxt, s32 index); // void func_800C3C94(void); -f32 func_800C3D50(s32 arg0, CollisionContext* bgCtxt, s32 arg2, CollisionPoly* arg3, s32* arg4, Vec3f* pos, Actor* actor, s32 arg7, f32 arg8, s32 arg9); +f32 func_800C3D50(s32 arg0, CollisionContext* bgCtxt, s32 arg2, CollisionPoly** arg3, s32* arg4, Vec3f* pos, Actor* actor, s32 arg7, f32 arg8, s32 arg9); // void func_800C3F40(void); // void func_800C3FA0(void); // void func_800C4000(void); // void func_800C4058(void); // void func_800C40B4(void); -f32 func_800C411C(CollisionContext* bgCtxt, CollisionPoly* arg1, s32* arg2, Actor* actor, Vec3f* pos); +f32 func_800C411C(CollisionContext* bgCtxt, CollisionPoly** arg1, s32* arg2, Actor* actor, Vec3f* pos); // void func_800C4188(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); // void func_800C41E4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); // void func_800C4240(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); diff --git a/include/z64bgcheck.h b/include/z64bgcheck.h index 06c0ecd7c4..6a5e791ad1 100644 --- a/include/z64bgcheck.h +++ b/include/z64bgcheck.h @@ -34,7 +34,7 @@ typedef struct { Vec3f pos; } ScaleRotPos; -typedef struct { +typedef struct CollisionPoly { /* 0x00 */ u16 type; union { u16 vtxData[3]; diff --git a/include/z64effect.h b/include/z64effect.h index ed81fbfabd..a1420ea9dc 100644 --- a/include/z64effect.h +++ b/include/z64effect.h @@ -9,6 +9,7 @@ struct GraphicsContext; struct GlobalContext; +struct EffectSs; typedef void(*eff_destroy_func)(void* params); diff --git a/include/z64light.h b/include/z64light.h index cbfe663518..6f78a5757a 100644 --- a/include/z64light.h +++ b/include/z64light.h @@ -21,23 +21,23 @@ typedef struct { /* 0x3 */ u8 color[3]; } LightDirectional; // size = 0x6 -typedef union { +typedef union LightParams { LightPoint point; LightDirectional dir; } LightParams; // size = 0xC -typedef struct { +typedef struct LightInfo { /* 0x0 */ u8 type; /* 0x2 */ LightParams params; } LightInfo; // size = 0xE -typedef struct { +typedef struct Lights { /* 0x00 */ u8 enablePosLights; /* 0x01 */ u8 numLights; /* 0x08 */ Lightsn l; } Lights; // size = 0x80 -typedef struct { +typedef struct LightInfoPositional { /* 0x0 */ u8 type; /* 0x2 */ LightPoint params; } LightInfoPositional; // size = 0xE @@ -51,13 +51,13 @@ typedef struct LightNode { // TODO move LightsBuffer to .c file once .bss has been split #define LIGHTS_BUFFER_SIZE 32 -typedef struct { +typedef struct LightsBuffer { /* 0x000 */ s32 numOccupied; /* 0x004 */ s32 searchIndex; /* 0x008 */ LightNode lights[LIGHTS_BUFFER_SIZE]; } LightsBuffer; // size = 0x188 -typedef struct { +typedef struct LightContext { /* 0x0 */ LightNode* listHead; /* 0x4 */ Color_RGB8 ambient; /* 0x7 */ u8 unk7; @@ -67,7 +67,7 @@ typedef struct { /* 0xC */ s16 unkC; } LightContext; // size = 0x10 -typedef enum { +typedef enum LightType { /* 0x00 */ LIGHT_POINT_NOGLOW, /* 0x01 */ LIGHT_DIRECTIONAL, /* 0x02 */ LIGHT_POINT_GLOW diff --git a/src/boot_O2_g3/idle.c b/src/boot_O2_g3/idle.c index 051f7b3367..53a3c49ef0 100644 --- a/src/boot_O2_g3/idle.c +++ b/src/boot_O2_g3/idle.c @@ -8,7 +8,7 @@ u32 gViConfigFeatures = 0x42; f32 gViConfigXScale = 1.0f; f32 gViConfigYScale = 1.0f; -void Idle_ClearMemory(const void* begin, const void* end) { +void Idle_ClearMemory(void* begin, void* end) { if (begin < end) { bzero(begin, (s32)(int)end - (int)begin); } diff --git a/src/boot_O2_g3/irqmgr.c b/src/boot_O2_g3/irqmgr.c index 766533fb39..3d592e210d 100644 --- a/src/boot_O2_g3/irqmgr.c +++ b/src/boot_O2_g3/irqmgr.c @@ -1,11 +1,6 @@ #include #include -// TODO move out -#define OS_CLOCK_RATE 62500000LL -#define OS_CPU_COUNTER (OS_CLOCK_RATE * 3 / 4) -#define OS_USEC_TO_CYCLES(n) (((u64)(n) * (OS_CPU_COUNTER / 15625LL)) / (1000000LL / 15625LL)) - vs32 gIrqMgrResetStatus = 0; volatile OSTime sIrqMgrResetTime = 0; volatile OSTime sIrqMgrRetraceTime = 0; diff --git a/src/boot_O2_g3_trapuv/fault.c b/src/boot_O2_g3_trapuv/fault.c index e3061a8cf1..100e224b1c 100644 --- a/src/boot_O2_g3_trapuv/fault.c +++ b/src/boot_O2_g3_trapuv/fault.c @@ -883,7 +883,7 @@ void Fault_HangupFaultClient(const char* arg0, char* arg1) { void Fault_AddHungupAndCrashImpl(const char* arg0, char* arg1) { FaultClient client; char padd[4]; - Fault_AddClient(&client, (fault_client_func)Fault_HangupFaultClient, arg0, arg1); + Fault_AddClient(&client, (fault_client_func)Fault_HangupFaultClient, (void*)arg0, arg1); *(u32*)0x11111111 = 0; // trigger an exception } diff --git a/src/boot_O2_g3_trapuv/fault_drawer.c b/src/boot_O2_g3_trapuv/fault_drawer.c index 5a69f61875..83792c0839 100644 --- a/src/boot_O2_g3_trapuv/fault_drawer.c +++ b/src/boot_O2_g3_trapuv/fault_drawer.c @@ -140,7 +140,7 @@ void FaultDrawer_FillScreen() { #pragma GLOBAL_ASM("./asm/non_matchings/boot/fault_drawer/FaultDrawer_FormatStringFunc.asm") -void FaultDrawer_VPrintf(char* str, char* args) { // va_list +void FaultDrawer_VPrintf(const char* str, char* args) { // va_list _Printf((printf_func)FaultDrawer_FormatStringFunc, sFaultDrawContext, str, args); } diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 1049911a97..a7578a4dfe 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -1,10 +1,6 @@ #include #include -// From OOT -#define ABS(x) ((x) < 0 ? -(x) : (x)) -#define DECR(x) ((x) == 0 ? 0 : ((x) -= 1)) - void Actor_PrintLists(ActorContext* actorCtx) { ActorListEntry* actorList = &actorCtx->actorList[0]; Actor* actor; @@ -526,7 +522,7 @@ s32 Actor_IsActorFacedByActor(Actor* actor, Actor* other, s16 tolerance) { angle = Actor_YawBetweenActors(actor, other) + 0x8000; dist = angle - other->shape.rot.y; - if (ABS(dist) < tolerance) { + if (ABS_ALT(dist) < tolerance) { return 1; } return 0; @@ -536,7 +532,7 @@ s32 Actor_IsActorFacingLink(Actor* actor, s16 angle) { s16 dist; dist = actor->yawTowardsPlayer - actor->shape.rot.y; - if (ABS(dist) < angle) { + if (ABS_ALT(dist) < angle) { return 1; } return 0; @@ -546,7 +542,7 @@ s32 Actor_IsActorFacingActor(Actor* actor, Actor* other, s16 tolerance) { s16 dist; dist = Actor_YawBetweenActors(actor, other) - actor->shape.rot.y; - if (ABS(dist) < tolerance) { + if (ABS_ALT(dist) < tolerance) { return 1; } return 0; @@ -559,7 +555,7 @@ s32 Actor_IsActorFacingActorAndWithinRange(Actor* actor, Actor* other, f32 range if (Actor_DistanceBetweenActors(actor, other) < range) { dist = Actor_YawBetweenActors(actor, other) - actor->shape.rot.y; - if (ABS(dist) < tolerance) { + if (ABS_ALT(dist) < tolerance) { return 1; } } diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 3e72440e50..e877a26896 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -162,7 +162,7 @@ void BgCheck_CreateVertexFromVec3f(Vec3s* vertex, Vec3f* vector) { #pragma GLOBAL_ASM("./asm/non_matchings/code/z_bgcheck/func_800C40B4.asm") -f32 func_800C411C(CollisionContext* bgCtxt, CollisionPoly* arg1, s32* arg2, Actor* actor, Vec3f* pos) { +f32 func_800C411C(CollisionContext* bgCtxt, CollisionPoly** arg1, s32* arg2, Actor* actor, Vec3f* pos) { return func_800C3D50(0, bgCtxt, 2, arg1, arg2, pos, actor, 28, 1.0f, 0); } diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c index 802ac59f2d..50b4921288 100644 --- a/src/code/z_effect_soft_sprite.c +++ b/src/code/z_effect_soft_sprite.c @@ -225,7 +225,7 @@ void EffectSS_UpdateParticle(GlobalContext* ctxt, s32 index) { particle->pos.y += particle->velocity.y; particle->pos.z += particle->velocity.z; - (*particle->update)(ctxt, index, particle); + particle->update(ctxt, index, particle); } } @@ -250,7 +250,7 @@ void EffectSS_UpdateAllParticles(GlobalContext* ctxt) { void EffectSS_DrawParticle(GlobalContext* ctxt, s32 index) { EffectSs* entry = &EffectSS2Info.data_table[index]; if (entry->draw != 0) { - (*entry->draw)(ctxt, index, entry); + entry->draw(ctxt, index, entry); } } diff --git a/src/code/z_lights.c b/src/code/z_lights.c index da3b79ae23..161eff7242 100644 --- a/src/code/z_lights.c +++ b/src/code/z_lights.c @@ -187,9 +187,16 @@ void Lights_BindDirectional(Lights* lights, LightParams* params, void* unused) { * available in the Lights group. This is at most 7 slots for a new group, but could be less. */ void Lights_BindAll(Lights* lights, LightNode* listHead, Vec3f* refPos, GlobalContext* globalCtx) { - static LightsPosBindFunc posBindFuncs[] = { Lights_BindPoint, Lights_BindDirectional, Lights_BindPoint }; - static LightsBindFunc dirBindFuncs[] = { Lights_BindPointWithReference, Lights_BindDirectional, - Lights_BindPointWithReference }; + static LightsPosBindFunc posBindFuncs[] = { + Lights_BindPoint, + (LightsPosBindFunc)Lights_BindDirectional, + Lights_BindPoint, + }; + static LightsBindFunc dirBindFuncs[] = { + Lights_BindPointWithReference, + (LightsBindFunc)Lights_BindDirectional, + Lights_BindPointWithReference, + }; if (listHead != NULL) { if ((refPos == NULL) && (lights->enablePosLights == 1)) { diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index 16e1f3b11f..a22306dbcf 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -19,8 +19,9 @@ void SkelAnime_AnimationType4Loaded(GlobalContext* globalCtx, AnimationEntryType void SkelAnime_AnimationType5Loaded(GlobalContext* globalCtx, AnimationEntryType5* entry); static AnimationEntryCallback sAnimationLoadDone[] = { - SkelAnime_LinkAnimetionLoaded, SkelAnime_AnimationType1Loaded, SkelAnime_AnimationType2Loaded, - SkelAnime_AnimationType3Loaded, SkelAnime_AnimationType4Loaded, SkelAnime_AnimationType5Loaded, + (AnimationEntryCallback)SkelAnime_LinkAnimetionLoaded, (AnimationEntryCallback)SkelAnime_AnimationType1Loaded, + (AnimationEntryCallback)SkelAnime_AnimationType2Loaded, (AnimationEntryCallback)SkelAnime_AnimationType3Loaded, + (AnimationEntryCallback)SkelAnime_AnimationType4Loaded, (AnimationEntryCallback)SkelAnime_AnimationType5Loaded, }; s32 D_801F5AB0; @@ -1240,7 +1241,7 @@ void SkelAnime_ChangeLinkAnim(GlobalContext* globalCtx, SkelAnime* skelAnime, Li skelAnime->initialFrame = frame; skelAnime->animCurrentFrame = frame; skelAnime->animFrameCount = frameCount; - skelAnime->totalFrames = SkelAnime_GetTotalFrames(linkAnimetionEntrySeg); + skelAnime->totalFrames = SkelAnime_GetTotalFrames(&linkAnimetionEntrySeg->genericHeader); skelAnime->animPlaybackSpeed = playbackSpeed; } diff --git a/src/code/z_snap.c b/src/code/z_snap.c index aa2f7439f3..972f359f0e 100644 --- a/src/code/z_snap.c +++ b/src/code/z_snap.c @@ -113,11 +113,11 @@ s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos, s16 x; s16 y; f32 distance; - UNK_TYPE unk1; + CollisionPoly* unk1; Camera* camera; Actor* actors[2]; s32 ret = 0; - UNK_TYPE unk2; + u32 unk2; camera = ACTIVE_CAM; diff --git a/src/libultra/gu/lookat.c b/src/libultra/gu/lookat.c index 18b5e23bab..8fcfffbc84 100644 --- a/src/libultra/gu/lookat.c +++ b/src/libultra/gu/lookat.c @@ -62,5 +62,5 @@ void guLookAt(Mtx* m, f32 xEye, f32 yEye, f32 zEye, f32 xAt, f32 yAt, f32 zAt, f guLookAtF(mf, xEye, yEye, zEye, xAt, yAt, zAt, xUp, yUp, zUp); - guMtxF2L((MtxF*)mf, m); + guMtxF2L(mf, m); } diff --git a/src/libultra/gu/lookathil.c b/src/libultra/gu/lookathil.c index ff2e1861a8..4da66757d4 100644 --- a/src/libultra/gu/lookathil.c +++ b/src/libultra/gu/lookathil.c @@ -154,5 +154,5 @@ void guLookAtHilite(Mtx* m, LookAt* l, Hilite* h, f32 xEye, f32 yEye, f32 zEye, guLookAtHiliteF(mf, l, h, xEye, yEye, zEye, xAt, yAt, zAt, xUp, yUp, zUp, xl1, yl1, zl1, xl2, yl2, zl2, hiliteWidth, hiliteHeight); - guMtxF2L((MtxF*)mf, m); + guMtxF2L(mf, m); } diff --git a/src/libultra/rmon/xprintf.c b/src/libultra/rmon/xprintf.c index 4be2e5a171..e87e4624b9 100644 --- a/src/libultra/rmon/xprintf.c +++ b/src/libultra/rmon/xprintf.c @@ -35,11 +35,11 @@ char spaces[] = " "; char zeroes[] = "00000000000000000000000000000000"; -int _Printf(printf_func pfn, void* arg, char* fmt, va_list ap) { +int _Printf(printf_func pfn, void* arg, const char* fmt, va_list ap) { _Pft x; x.nchar = 0; while (1) { - unsigned char* s; + const char* s; unsigned char c; unsigned char* t; @@ -52,11 +52,11 @@ int _Printf(printf_func pfn, void* arg, char* fmt, va_list ap) { while ((c = *s) != 0 && c != '%') { s++; } - _PROUT(fmt, s - fmt); + _PROUT((char*)fmt, s - fmt); if (c == 0) { return x.nchar; } - fmt = (char*)++s; + fmt = ++s; x.flags = 0; // TODO the cast isn't necessary because strchr should take it in as const, but it currently doesn't for (; (t = strchr((char*)fchar, *s)) != NULL; s++) { diff --git a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c index 4786dd686b..baf0252c14 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c @@ -170,7 +170,7 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) { this->grabbed = NULL; } else { if (this->actor.child != NULL) { - f32 sp94 = Actor_DistanceBetweenActors(this, grabbed); + f32 sp94 = Actor_DistanceBetweenActors(&this->actor, grabbed); f32 sp90 = sqrtf(SQ(this->unk1FC.x) + SQ(this->unk1FC.y) + SQ(this->unk1FC.z)); Math_Vec3f_Diff(&grabbed->world.pos, &this->unk1FC, &this->actor.world.pos); if (50.0f < (sp94 - sp90)) { diff --git a/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c b/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c index 95cc46d864..c59ca0f0c3 100644 --- a/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c +++ b/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c @@ -111,7 +111,7 @@ static InitChainEntry sInitChain[] = { }; extern Gfx D_06000828[]; -extern CollisionHeader* D_06000908; +extern CollisionHeader D_06000908; s32 BgKin2Fence_CheckHitMask(BgKin2Fence* this) { ColliderJntSphElement* elements = this->collider.elements; @@ -149,13 +149,13 @@ void BgKin2Fence_Init(Actor* thisx, GlobalContext* globalCtx) { BgKin2Fence* this = THIS; s32 i = 0; - Actor_ProcessInitChain(&this->dyna.actor, &sInitChain); + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); BcCheck3_BgActorInit(&this->dyna, 0); BgCheck3_LoadMesh(globalCtx, &this->dyna, &D_06000908); Collider_InitJntSph(globalCtx, &this->collider); - Collider_SetJntSph(globalCtx, &this->collider, &this->dyna.actor, &sJntSphInit, &this->colliderElements); + Collider_SetJntSph(globalCtx, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderElements); SysMatrix_SetStateRotationAndTranslation(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, - this->dyna.actor.world.pos.z, &this->dyna.actor.shape); + this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot); Matrix_Scale(this->dyna.actor.scale.x, this->dyna.actor.scale.y, this->dyna.actor.scale.z, 1); for (i = 0; i < 4; i++) { @@ -209,7 +209,7 @@ void BgKin2Fence_HandleMaskCode(BgKin2Fence* this, GlobalContext* globalCtx) { this->cooldownTimer -= 1; return; } - CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider); + CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); } } diff --git a/src/overlays/actors/ovl_Dm_Sa/z_dm_sa.c b/src/overlays/actors/ovl_Dm_Sa/z_dm_sa.c index e659b0bab6..644e57119f 100644 --- a/src/overlays/actors/ovl_Dm_Sa/z_dm_sa.c +++ b/src/overlays/actors/ovl_Dm_Sa/z_dm_sa.c @@ -33,7 +33,7 @@ void func_80A2E960(SkelAnime* arg0, ActorAnimationEntry* animations, u16 index) animations += index; if (animations->frameCount < 0.0f) { - frameCount = SkelAnime_GetFrameCount(animations->animation); + frameCount = SkelAnime_GetFrameCount(&animations->animation->genericHeader); } else { frameCount = animations->frameCount; } @@ -49,7 +49,7 @@ void DmSa_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetArrowOffset = 3000.0f; ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 24.0f); SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06013328, NULL, 0, 0, 0); - func_80A2E960(&this->skelAnime, &D_80A2ED00, 0); + func_80A2E960(&this->skelAnime, D_80A2ED00, 0); Actor_SetScale(&this->actor, 0.01f); this->actionFunc = DmSa_DoNothing; } @@ -68,14 +68,14 @@ void DmSa_Update(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc(this, globalCtx); } -s32 func_80A2EB10(s32 arg0, s32 arg1, s32 arg2, s32 arg3) { +s32 func_80A2EB10(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* actor) { return 0; } -void func_80A2EB2C(s32 arg0, s32 arg1, s32 arg2, s32 arg3) { +void func_80A2EB2C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* actor) { } -void func_80A2EB44(s32 arg0, s32 arg1, s32 arg2) { +void func_80A2EB44(GlobalContext* globalCtx, s32 limbIndex, Actor* actor) { } Gfx* func_80A2EB58(GraphicsContext* gfxCtx, u32 alpha) { @@ -115,7 +115,7 @@ void DmSa_Draw(Actor* thisx, GlobalContext* globalCtx) { } func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, - func_80A2EB10, func_80A2EB2C, func_80A2EB44, this); + func_80A2EB10, func_80A2EB2C, func_80A2EB44, &this->actor); CLOSE_DISPS(globalCtx->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index 6bb828acbd..d7b08b6357 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -124,7 +124,7 @@ void DoorAna_WaitOpen(DoorAna* this, GlobalContext* globalCtx) { s32 entranceIndex; f32 yDist; - if (Math_StepToF(&this->actor.scale, 0.01f, 0.001f) != 0) { + if (Math_StepToF(&this->actor.scale.x, 0.01f, 0.001f) != 0) { if ((this->actor.targetMode != 0) && (globalCtx->unk18875 == 0) && (globalCtx->unk18B4A == 0) && (player->stateFlags1 & 0x80000000) && (player->unkAE7 == 0)) { @@ -175,7 +175,7 @@ void DoorAna_WaitOpen(DoorAna* this, GlobalContext* globalCtx) { } void DoorAna_GrabLink(DoorAna* this, GlobalContext* globalCtx) { - Actor* player; + ActorPlayer* player; s8 pad[2]; if (ActorCutscene_GetCurrentIndex() != this->actor.cutscene) { @@ -188,8 +188,8 @@ void DoorAna_GrabLink(DoorAna* this, GlobalContext* globalCtx) { if ((this->actor.yDistToPlayer <= 0.0f) && (this->actor.xzDistToPlayer > 20.0f)) { player = PLAYER; - player->world.pos.x = (Math_SinS(this->actor.yawTowardsPlayer) * 20.0f) + this->actor.world.pos.x; - player->world.pos.z = (Math_CosS(this->actor.yawTowardsPlayer) * 20.0f) + this->actor.world.pos.z; + player->base.world.pos.x = (Math_SinS(this->actor.yawTowardsPlayer) * 20.0f) + this->actor.world.pos.x; + player->base.world.pos.z = (Math_CosS(this->actor.yawTowardsPlayer) * 20.0f) + this->actor.world.pos.z; } } diff --git a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c index 216443acbf..498f2cf2a9 100644 --- a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c +++ b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c @@ -234,7 +234,7 @@ f32 DoorSpiral_GetDistFromPlayer(GlobalContext* globalCtx, DoorSpiral* this, f32 Actor_CalcOffsetOrientedToDrawRotation(&this->actor, &offset, &target); if ((spiralWidth < fabsf(offset.x)) || (spiralHeight < fabsf(offset.y))) { - return 3.4028235e38f; // TODO FLT_MAX + return FLT_MAX; } return offset.z; diff --git a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c index 17fd0345f3..d1ddfbc87a 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -71,7 +71,7 @@ void EnEncount2_Init(Actor* thisx, GlobalContext* globalCtx) { this->dynaActor.bgId = BgCheck_AddActorMesh(globalCtx, &globalCtx->colCtx.dyna, &this->dynaActor, colHeader); ActorShape_Init(&this->dynaActor.actor.shape, 0.0f, func_800B3FC0, 25.0f); this->dynaActor.actor.colChkInfo.mass = 0xFF; - Collider_InitAndSetJntSph(globalCtx, &this->collider, &this->dynaActor, &sJntSphInit, &this->colElement); + Collider_InitAndSetJntSph(globalCtx, &this->collider, &this->dynaActor.actor, &sJntSphInit, &this->colElement); this->dynaActor.actor.targetMode = 6; this->dynaActor.actor.colChkInfo.health = 1; @@ -93,7 +93,7 @@ void EnEncount2_Init(Actor* thisx, GlobalContext* globalCtx) { this->collider.elements->dim.modelSphere.center.y = -4; this->collider.elements->dim.modelSphere.center.z = 0; - this->dynaActor.actor.colChkInfo.damageTable = &damageTable; + this->dynaActor.actor.colChkInfo.damageTable = damageTable; EnEncount2_SetIdle(this); } @@ -105,7 +105,7 @@ void EnEncount2_Destroy(Actor* thisx, GlobalContext* globalCtx) { void EnEncount2_SetIdle(EnEncount2* this) { this->isPopped = 0; - this->actionFunc = &EnEncount2_Idle; + this->actionFunc = EnEncount2_Idle; } void EnEncount2_Idle(EnEncount2* this, GlobalContext* globalCtx) { @@ -161,8 +161,8 @@ void EnEncount2_Update(Actor* thisx, GlobalContext* globalCtx) { if (!this->isPopped) { Collider_UpdateSpheresElement(&this->collider, 0, &this->dynaActor.actor); - CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider); + CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); } } @@ -177,7 +177,7 @@ void EnEncount2_Draw(Actor* thisx, GlobalContext* globalCtx) { void EnEncount2_InitParticles(EnEncount2* this, Vec3f* vec, s16 fadeDelay) { s16 i; - EnEncount2Particle* sPtr = &this->particles; + EnEncount2Particle* sPtr = this->particles; for (i = 0; i < 200; ++i) { if (!sPtr->enabled) { @@ -203,7 +203,7 @@ void EnEncount2_InitParticles(EnEncount2* this, Vec3f* vec, s16 fadeDelay) { void EnEncount2_UpdateParticles(EnEncount2* this, GlobalContext* globalCtx) { s32 i; - EnEncount2Particle* sPtr = &this->particles; + EnEncount2Particle* sPtr = this->particles; for (i = 0; i < 200; i += 2) { if (sPtr->enabled) { diff --git a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h index f2157aa105..ca63135b3a 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h @@ -3,6 +3,8 @@ #include +struct EnEncount2; + typedef void (*EnEncount2ActionFunc)(struct EnEncount2*, GlobalContext*); typedef struct EnEncount2Particle{ @@ -17,8 +19,6 @@ typedef struct EnEncount2Particle{ } EnEncount2Particle; // size = 0x34 -struct EnEncount2; - typedef struct EnEncount2 { /* 0x0000 */ DynaPolyActor dynaActor; /* 0x015C */ EnEncount2ActionFunc actionFunc; diff --git a/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.c b/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.c index 78f1ad5986..85ac83519f 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.c +++ b/src/overlays/actors/ovl_En_Ending_Hero3/z_en_ending_hero3.c @@ -37,7 +37,7 @@ void EnEndingHero3_Init(Actor* thisx, GlobalContext* globalCtx) { SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06007150, &D_06000E50, this->limbDrawTable, this->transitionDrawTable, 17); ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 25.0f); - func_80C23518(&this->actor); + func_80C23518(this); } void EnEndingHero3_Destroy(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c index 40d753d858..99e5e1da08 100644 --- a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c +++ b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c @@ -89,8 +89,8 @@ void EnGinkoMan_Init(Actor* thisx, GlobalContext* globalCtx) { this->stampChecked = 0; this->choiceDepositWithdrawl = GINKOMAN_CHOICE_RESET; this->serviceFee = 0; - SkelAnime_InitSV(globalCtx, &this->skelAnime, object_ginko_skeleton, object_ginko_sitting_anim, &this->limbDrawTbl, - &this->transitionDrawTbl, 0x10); + SkelAnime_InitSV(globalCtx, &this->skelAnime, object_ginko_skeleton, object_ginko_sitting_anim, this->limbDrawTbl, + this->transitionDrawTbl, 0x10); EnGinkoMan_SetupIdle(this); } @@ -741,7 +741,7 @@ void EnGinkoMan_Update(Actor* thisx, GlobalContext* globalCtx) { s32 EnGinkoMan_LimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* actor) { EnGinkoMan* this = (EnGinkoMan*)actor; if (limbIndex == 15) { - *dList = &object_ginko_limb15_dlist; + *dList = object_ginko_limb15_dlist; } if (limbIndex == 15) { SysMatrix_InsertTranslation(1500.0f, 0.0f, 0.0f, 1); diff --git a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.h b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.h index b220a9dee4..fe6c4814bc 100644 --- a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.h +++ b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.h @@ -3,10 +3,10 @@ #include - typedef void (*EnGinkoManActionFunc)(struct EnGinkoMan*, GlobalContext*); - struct EnGinkoMan; + typedef void (*EnGinkoManActionFunc)(struct EnGinkoMan*, GlobalContext*); + typedef struct EnGinkoMan { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; diff --git a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c index 2329403526..595703486a 100644 --- a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c +++ b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c @@ -24,7 +24,7 @@ const ActorInit En_Okarina_Effect_InitVars = { (ActorFunc)NULL, }; -void EnOkarinaEffect_SetupAction(EnOkarinaEffect* this, EnOkarinaEffectActionFunc* actionFunc) { +void EnOkarinaEffect_SetupAction(EnOkarinaEffect* this, EnOkarinaEffectActionFunc actionFunc) { this->actionFunc = actionFunc; } @@ -37,7 +37,7 @@ void EnOkarinaEffect_Init(Actor* thisx, GlobalContext* globalCtx) { if (globalCtx->kankyoContext.unkF2[1]) { Actor_MarkForDeath(&this->actor); } - EnOkarinaEffect_SetupAction(&this->actor, func_8096B104); + EnOkarinaEffect_SetupAction(this, func_8096B104); } void func_8096B104(EnOkarinaEffect* this, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c index 48e9c60f7e..81cadc260a 100644 --- a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c +++ b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c @@ -22,6 +22,9 @@ void EnPoFusen_IdleFuse(EnPoFusen* this, GlobalContext* gCtx); s32 EnPoFusen_OverrideLimbDraw(GlobalContext* gCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, struct Actor* actor); +extern AnimationHeader D_06000040; +extern SkeletonHeader D_060024F0; + const ActorInit En_Po_Fusen_InitVars = { ACTOR_EN_PO_FUSEN, ACTORCAT_PROP, @@ -72,10 +75,10 @@ void EnPoFusen_Init(Actor* thisx, GlobalContext* globalCtx) { if (0) {} this->collider.dim.worldSphere.radius = 40; - SkelAnime_InitSV(globalCtx, &this->anime, &D_060024F0, &D_06000040, &this->limbDrawTbl, &this->transitionDrawTbl, - 10); + SkelAnime_InitSV(globalCtx, &this->anime, &D_060024F0, &D_06000040, + this->limbDrawTbl, this->transitionDrawTbl, 10); ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 25.0f); - func_800B78B8(globalCtx, this, 0.0f, 0.0f, 0.0f, 4); + func_800B78B8(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); if (EnPoFusen_CheckParent(this, globalCtx) == 0) { Actor_MarkForDeath(&this->actor); @@ -144,8 +147,8 @@ u16 EnPoFusen_CheckCollision(EnPoFusen* this, GlobalContext* gCtx) { return 1; } - CollisionCheck_SetOC(gCtx, &gCtx->colCheckCtx, &this->collider); - CollisionCheck_SetAC(gCtx, &gCtx->colCheckCtx, &this->collider); + CollisionCheck_SetOC(gCtx, &gCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetAC(gCtx, &gCtx->colCheckCtx, &this->collider.base); return 0; } @@ -272,10 +275,10 @@ s32 EnPoFusen_OverrideLimbDraw(GlobalContext* gCtx, s32 limbIndex, Gfx** dList, return 0; } -void EnPoFusen_PostLimbDraw(s32 arg0, s32 arg1, s32 arg2, s32 arg3) { +void EnPoFusen_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* actor) { } -void EnPoFusen_UnkActorDraw(s32 arg0, s32 arg1, s32 arg2) { +void EnPoFusen_UnkActorDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* actor) { } void EnPoFusen_Draw(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.h b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.h index 7c2da63d4b..9c0b1d21e1 100644 --- a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.h +++ b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.h @@ -27,9 +27,6 @@ typedef struct EnPoFusen { /* 0x270 */ s16 fuse; } EnPoFusen; // size = 0x274 -extern SkeletonHeader D_06000040; -extern AnimationHeader D_060024F0; - extern const ActorInit En_Po_Fusen_InitVars; #endif // Z_EN_PO_FUSEN_H diff --git a/src/overlays/actors/ovl_En_Rsn/z_en_rsn.c b/src/overlays/actors/ovl_En_Rsn/z_en_rsn.c index 130ec1cd0f..f1eff940ce 100644 --- a/src/overlays/actors/ovl_En_Rsn/z_en_rsn.c +++ b/src/overlays/actors/ovl_En_Rsn/z_en_rsn.c @@ -31,7 +31,7 @@ extern Gfx D_06005458[]; static ActorAnimationEntry animations[] = { { &D_0600788C, 1.0f, 0.0f, 0.0f, 0x00, 0.0f } }; void func_80C25D40(EnRsn* this) { - func_800BDC5C(&this->skelAnime, &animations, 0); + func_800BDC5C(&this->skelAnime, animations, 0); this->actionFunc = func_80C25D84; } @@ -78,7 +78,7 @@ void EnRsn_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve Vec3f sp18 = D_80C26028; if (limbIndex == 14) { - SysMatrix_MultiplyVector3fByState(&sp18, &this->actor.focus); + SysMatrix_MultiplyVector3fByState(&sp18, &this->actor.focus.pos); } } diff --git a/src/overlays/actors/ovl_En_Scopecoin/z_en_scopecoin.c b/src/overlays/actors/ovl_En_Scopecoin/z_en_scopecoin.c index 3a2dc63fd2..f14dabc209 100644 --- a/src/overlays/actors/ovl_En_Scopecoin/z_en_scopecoin.c +++ b/src/overlays/actors/ovl_En_Scopecoin/z_en_scopecoin.c @@ -30,7 +30,7 @@ void func_80BFCFA0(EnScopecoin* this, GlobalContext* globalCtx) { void func_80BFCFB8(EnScopecoin* this, GlobalContext* globalCtx) { if (Actor_GetCollectibleFlag(globalCtx, (this->actor.params & 0x7F0) >> 4)) { - Item_DropCollectible(globalCtx, &this->actor.world, 2); + Item_DropCollectible(globalCtx, &this->actor.world.pos, 2); Actor_MarkForDeath(&this->actor); } } diff --git a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c index bd1b29e28a..5e019757d2 100644 --- a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c +++ b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c @@ -81,7 +81,7 @@ void func_8093089C(EnTuboTrap* this, GlobalContext* globalCtx) { s32 dropCount = func_800A8150(itemParam); if (dropCount >= 0) { - Item_DropCollectible(globalCtx, &this->actor.world, ((this->actor.params & 0x7F) << 8) | dropCount); + Item_DropCollectible(globalCtx, &this->actor.world.pos, ((this->actor.params & 0x7F) << 8) | dropCount); } } @@ -124,7 +124,7 @@ void func_809308F4(EnTuboTrap* this, GlobalContext* globalCtx) { arg5 = 0x20; } EffectSsKakera_Spawn(globalCtx, &pos, &vel, actorPos, -0xF0, arg5, 0x14, 0, 0, - ((Rand_ZeroOne() * 85.0f) + 15.0f), 0, 0, 0x3C, -1, GAMEPLAY_DANGEON_KEEP, &D_05018090); + ((Rand_ZeroOne() * 85.0f) + 15.0f), 0, 0, 0x3C, -1, GAMEPLAY_DANGEON_KEEP, D_05018090); } func_800BBFB0(globalCtx, actorPos, 30.0f, 4, 0x14, 0x32, 0); @@ -172,20 +172,20 @@ void func_80930B60(EnTuboTrap* this, GlobalContext* globalCtx) { } EffectSsKakera_Spawn(globalCtx, &pos, &vel, actorPos, -0xAA, arg5, 0x32, 5, 0, - ((Rand_ZeroOne() * 85.0f) + 15.0f), 0, 0, 0x46, -1, GAMEPLAY_DANGEON_KEEP, &D_05018090); + ((Rand_ZeroOne() * 85.0f) + 15.0f), 0, 0, 0x46, -1, GAMEPLAY_DANGEON_KEEP, D_05018090); } } // EnTuboTrap_HandleImpact void func_80930DDC(EnTuboTrap* this, GlobalContext* globalCtx) { - Actor* player = PLAYER; - Actor* player2 = PLAYER; + ActorPlayer* player = PLAYER; + ActorPlayer* player2 = PLAYER; // in oot func_800F0568 is Audio_PlaySoundAtPosition if (((this->actor.bgCheckFlags & 0x20) != 0) && (this->actor.yDistToWater > 15.0f)) { func_80930B60(this, globalCtx); - func_800F0568(globalCtx, &this->actor.world, 0x28, 0x2817); + func_800F0568(globalCtx, &this->actor.world.pos, 0x28, 0x2817); func_8093089C(this, globalCtx); Actor_MarkForDeath(&this->actor); return; @@ -193,8 +193,8 @@ void func_80930DDC(EnTuboTrap* this, GlobalContext* globalCtx) { if ((this->collider.base.atFlags & AT_BOUNCED) != 0) { this->collider.base.atFlags &= ~AT_BOUNCED; func_809308F4(this, globalCtx); - func_800F0568(globalCtx, &this->actor.world, 0x28, 0x1808); - func_800F0568(globalCtx, &this->actor.world, 0x28, 0x2887); + func_800F0568(globalCtx, &this->actor.world.pos, 0x28, 0x1808); + func_800F0568(globalCtx, &this->actor.world.pos, 0x28, 0x2887); func_8093089C(this, globalCtx); Actor_MarkForDeath(&this->actor); return; @@ -202,18 +202,18 @@ void func_80930DDC(EnTuboTrap* this, GlobalContext* globalCtx) { if ((this->collider.base.acFlags & AC_HIT) != 0) { this->collider.base.acFlags &= ~AC_HIT; func_809308F4(this, globalCtx); - func_800F0568(globalCtx, &this->actor.world, 0x28, 0x2802); - func_800F0568(globalCtx, &this->actor.world, 0x28, 0x2887); + func_800F0568(globalCtx, &this->actor.world.pos, 0x28, 0x2802); + func_800F0568(globalCtx, &this->actor.world.pos, 0x28, 0x2887); func_8093089C(this, globalCtx); Actor_MarkForDeath(&this->actor); return; } if ((this->collider.base.atFlags & AT_HIT) != 0) { this->collider.base.atFlags &= ~AT_HIT; - if (player == this->collider.base.at) { + if (&player->base == this->collider.base.at) { func_809308F4(this, globalCtx); - func_800F0568(globalCtx, &this->actor.world, 0x28, 0x2887); - func_800F0568(globalCtx, &player2->world, 0x28, 0x83E); + func_800F0568(globalCtx, &this->actor.world.pos, 0x28, 0x2887); + func_800F0568(globalCtx, &player2->base.world.pos, 0x28, 0x83E); func_8093089C(this, globalCtx); Actor_MarkForDeath(&this->actor); return; @@ -221,7 +221,7 @@ void func_80930DDC(EnTuboTrap* this, GlobalContext* globalCtx) { } if (((this->actor.bgCheckFlags & 8) != 0) || ((this->actor.bgCheckFlags & 1) != 0)) { func_809308F4(this, globalCtx); - func_800F0568(globalCtx, &this->actor.world, 0x28, 0x2887); + func_800F0568(globalCtx, &this->actor.world.pos, 0x28, 0x2887); func_8093089C(this, globalCtx); Actor_MarkForDeath(&this->actor); } diff --git a/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c b/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c index b014b20a5b..d0d0d8f89d 100644 --- a/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c +++ b/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c @@ -64,10 +64,10 @@ extern UNK_TYPE D_06000EC0; void EnWarpUzu_Init(Actor* thisx, GlobalContext* globalCtx) { EnWarpUzu* this = THIS; - Actor_ProcessInitChain(&this->actor, &D_80A664EC); + Actor_ProcessInitChain(&this->actor, D_80A664EC); Collider_InitAndSetCylinder(globalCtx, &this->collider, thisx, &D_80A664C0); thisx->targetMode = 0; - func_80A66208(thisx, globalCtx); + func_80A66208(this, globalCtx); } void EnWarpUzu_Destroy(Actor* thisx, GlobalContext* globalCtx) { @@ -83,8 +83,8 @@ void func_80A66208(EnWarpUzu* this, GlobalContext* globalCtx) { this->actor.textId = 0; Matrix_RotateY(this->actor.shape.rot.y, 0); SysMatrix_MultiplyVector3fByState(&D_80A664FC, &sp24); - Math_Vec3f_Sum(&this->actor.world, &sp24, &this->actor.focus); - Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.shape); + Math_Vec3f_Sum(&this->actor.world.pos, &sp24, &this->actor.focus.pos); + Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.shape.rot); this->actionFunc = func_80A66278; } @@ -129,7 +129,7 @@ void EnWarpUzu_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.uncullZoneForward = 1000.0f; this->actionFunc(this, globalCtx); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); } void EnWarpUzu_Draw(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c b/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c index 90b88bcc05..c2fe08d6e6 100644 --- a/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c +++ b/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c @@ -62,10 +62,10 @@ extern AnimatedMaterial D_06000E88; void ObjBoyo_Init(Actor* thisx, GlobalContext* globalCtx) { ObjBoyo* this = THIS; - Actor_ProcessInitChain(&this->actor, &sInitChain); + Actor_ProcessInitChain(&this->actor, sInitChain); Collider_InitCylinder(globalCtx, &this->collider); Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); - Collider_UpdateCylinder(this, &this->collider); + Collider_UpdateCylinder(&this->actor, &this->collider); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->unk_190 = Lib_SegmentedToVirtual(&D_06000E88); } @@ -84,7 +84,7 @@ void ObjBoyo_UpdatePlayerBumpValues(ObjBoyo* this, ActorPlayer* target) { void ObjBoyo_UpdatePirateBumpValues(ObjBoyo* src, EnKaizoku* target) { target->unk_2F0 = 30.0f; - target->unk_2F4 = Actor_YawBetweenActors(src, target); + target->unk_2F4 = Actor_YawBetweenActors(&src->actor, &target->actor); } void ObjBoyo_UpdateBombBumpValues(ObjBoyo* src, EnBom* target) { @@ -92,9 +92,9 @@ void ObjBoyo_UpdateBombBumpValues(ObjBoyo* src, EnBom* target) { } BumperCollideInfo sBumperCollideInfo[] = { - { ACTOR_PLAYER, ObjBoyo_UpdatePlayerBumpValues }, - { ACTOR_EN_KAIZOKU, ObjBoyo_UpdatePirateBumpValues }, - { ACTOR_EN_BOM, ObjBoyo_UpdateBombBumpValues }, + { ACTOR_PLAYER, (BumperCollideActorFunc)ObjBoyo_UpdatePlayerBumpValues }, + { ACTOR_EN_KAIZOKU, (BumperCollideActorFunc)ObjBoyo_UpdatePirateBumpValues }, + { ACTOR_EN_BOM, (BumperCollideActorFunc)ObjBoyo_UpdateBombBumpValues }, }; Actor* ObjBoyo_GetCollidedActor(ObjBoyo* this, GlobalContext* globalCtx, s32* num) { @@ -126,7 +126,7 @@ void ObjBoyo_Update(Actor* thisx, GlobalContext* globalCtx2) { Actor* target; s32 num; - target = ObjBoyo_GetCollidedActor(thisx, globalCtx, &num); + target = ObjBoyo_GetCollidedActor(this, globalCtx, &num); if (target != NULL) { sBumperCollideInfo[num].actorCollideFunc(this, (void*)target); diff --git a/src/overlays/actors/ovl_Obj_Kepn_Koya/z_obj_kepn_koya.c b/src/overlays/actors/ovl_Obj_Kepn_Koya/z_obj_kepn_koya.c index a4d3098cf7..ca940bb888 100644 --- a/src/overlays/actors/ovl_Obj_Kepn_Koya/z_obj_kepn_koya.c +++ b/src/overlays/actors/ovl_Obj_Kepn_Koya/z_obj_kepn_koya.c @@ -32,7 +32,7 @@ extern UNK_TYPE D_06003478; void ObjKepnKoya_Init(Actor* thisx, GlobalContext* globalCtx) { ObjKepnKoya* this = THIS; - Actor_ProcessInitChain(&this->dyna.actor, &D_80C07C40); + Actor_ProcessInitChain(&this->dyna.actor, D_80C07C40); Actor_SetScale(&this->dyna.actor, 0.1f); BcCheck3_BgActorInit(&this->dyna, 0); BgCheck3_LoadMesh(globalCtx, &this->dyna, &D_0600805C); diff --git a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c index 88483dc310..01fc4b8c09 100644 --- a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c +++ b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c @@ -94,7 +94,7 @@ void ObjLightswitch_InitCollider(ObjLightswitch* this, GlobalContext* globalCtx) this->actor.colChkInfo.mass = 0xFF; SysMatrix_SetStateRotationAndTranslation( this->actor.world.pos.x, this->actor.world.pos.y + (this->actor.shape.yOffset * this->actor.scale.y), - this->actor.world.pos.z, &this->actor.shape); + this->actor.world.pos.z, &this->actor.shape.rot); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, 1); Collider_UpdateSpheres(0, &this->collider); } @@ -185,7 +185,7 @@ void ObjLightswitch_Init(Actor* thisx, GlobalContext* globalCtx) { switchFlagResult = Flags_GetSwitch(globalCtx, GET_LIGHTSWITCH_SWITCHFLAG(this)); isTriggered = 0; - Actor_ProcessInitChain(&this->actor, &sInitChain); + Actor_ProcessInitChain(&this->actor, sInitChain); Actor_SetHeight(&this->actor, 0.0f); if (switchFlagResult != 0) { @@ -390,8 +390,8 @@ void ObjLightswitch_Update(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc(this, globalCtx); if (this->actor.update != 0) { this->previousACFlags = this->collider.base.acFlags; - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); } } diff --git a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h index a46710fd50..1b5e1f1e34 100644 --- a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h +++ b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h @@ -3,11 +3,11 @@ #include +struct ObjLightswitch; + typedef void (*ObjLightswitchActionFunc)(struct ObjLightswitch*, GlobalContext*); typedef void (*ObjLightswitchSetupFunc)(struct ObjLightswitch*); -struct ObjLightswitch; - typedef struct ObjLightswitch { /* 0x000 */ Actor actor; /* 0x144 */ ColliderJntSph collider; diff --git a/src/overlays/actors/ovl_Obj_Visiblock/z_obj_visiblock.c b/src/overlays/actors/ovl_Obj_Visiblock/z_obj_visiblock.c index b2fd09eece..400221ddf3 100644 --- a/src/overlays/actors/ovl_Obj_Visiblock/z_obj_visiblock.c +++ b/src/overlays/actors/ovl_Obj_Visiblock/z_obj_visiblock.c @@ -28,12 +28,12 @@ static InitChainEntry D_80ADEB50[] = { }; extern CollisionHeader D_06000AD0; -extern UNK_TYPE D_06000140; +extern Gfx D_06000140[]; void ObjVisiblock_Init(Actor* thisx, GlobalContext* globalCtx) { ObjVisiblock* this = THIS; - Actor_ProcessInitChain(this, D_80ADEB50); + Actor_ProcessInitChain(&this->dyna.actor, D_80ADEB50); BcCheck3_BgActorInit(&this->dyna, 0); BgCheck3_LoadMesh(globalCtx, &this->dyna, &D_06000AD0); } @@ -45,5 +45,5 @@ void ObjVisiblock_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void ObjVisiblock_Draw(Actor* thisx, GlobalContext* globalCtx) { - func_800BE03C(globalCtx, &D_06000140); + func_800BE03C(globalCtx, D_06000140); }