diff --git a/src/boot_O2/gfxprint.c b/src/boot_O2/gfxprint.c index 557887abd4..b526758294 100644 --- a/src/boot_O2/gfxprint.c +++ b/src/boot_O2/gfxprint.c @@ -83,7 +83,7 @@ void GfxPrint_PrintCharImpl(GfxPrint* this, u8 c) { if (this->flags & GFXP_FLAG_RAINBOW) { gDPSetTextureLUT(this->dList++, G_TT_RGBA16); gDPSetCycleType(this->dList++, G_CYC_2CYCLE); - gDPSetRenderMode(this->dList++, G_RM_OPA_CI, G_RM_XLU_SURF2); + gDPSetRenderMode(this->dList++, G_RM_PASS, G_RM_XLU_SURF2); gDPSetCombineMode(this->dList++, G_CC_INTERFERENCE, G_CC_PASS2); } else { gDPSetTextureLUT(this->dList++, G_TT_IA16); diff --git a/src/code/z_fireobj.c b/src/code/z_fireobj.c index e1fb63fa10..f77fc5158d 100644 --- a/src/code/z_fireobj.c +++ b/src/code/z_fireobj.c @@ -187,7 +187,7 @@ void FireObj_UpdateLight(PlayState* play, FireObjLight* light, FireObj* fire) { if (fire->state == FIRE_STATE_3) { Lights_PointSetColorAndRadius(&light->lightInfo, 0, 0, 0, -1); } else { - radius = ((fire->yScale * 140.0f * fire->sizeInv) + 60.0f); + radius = (fire->yScale * 140.0f * fire->sizeInv) + 60.0f; Lights_PointGlowSetInfo(&light->lightInfo, fire->position.x, (fire->position.y + (fire->yScale * 6500.0f)), fire->position.z, diff --git a/src/code/z_sram_NES.c b/src/code/z_sram_NES.c index 10ce64f47b..b5491e33bb 100644 --- a/src/code/z_sram_NES.c +++ b/src/code/z_sram_NES.c @@ -808,8 +808,8 @@ void Sram_InitDebugSave(void) { Lib_MemCpy(&gSaveContext.save.checksum, &sSaveDebugChecksum, sizeof(gSaveContext.save.checksum)); if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { - BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = D_801C6A48[((void)0, gSaveContext.save.playerForm & 0xFF)]; - C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN) = D_801C6A50[((void)0, gSaveContext.save.playerForm & 0xFF)]; + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = D_801C6A48[((void)0, gSaveContext.save.playerForm)]; + C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN) = D_801C6A50[((void)0, gSaveContext.save.playerForm)]; } gSaveContext.save.hasTatl = true; diff --git a/src/libultra/gu/rotate.c b/src/libultra/gu/rotate.c index 11d00ff739..46dd605d49 100644 --- a/src/libultra/gu/rotate.c +++ b/src/libultra/gu/rotate.c @@ -1,7 +1,7 @@ #include "global.h" void guRotateF(float m[4][4], float a, float x, float y, float z) { - static float D_80097F90 = 0.017453292; // TODO this is PI / 180.0, we should define pi somewhere + static float D_80097F90 = M_PI / 180.0f; float sine; float cosine; float ab; diff --git a/src/libultra/rmon/xprintf.c b/src/libultra/rmon/xprintf.c index 6c538a2a8d..ddb83652d0 100644 --- a/src/libultra/rmon/xprintf.c +++ b/src/libultra/rmon/xprintf.c @@ -51,8 +51,7 @@ int _Printf(PrintCallback pfn, void* arg, const char* fmt, va_list ap) { } 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++) { + for (; (t = strchr(fchar, *s)) != NULL; s++) { x.flags |= fbit[t - fchar]; } if (*s == '*') { diff --git a/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.h b/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.h index 729dfcea9a..c39994d779 100644 --- a/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.h +++ b/src/overlays/actors/ovl_Bg_Keikoku_Saku/z_bg_keikoku_saku.h @@ -15,6 +15,7 @@ typedef struct BgKeikokuSaku { /* 0x160 */ s16 switchFlag; /* 0x162 */ s16 timer; } BgKeikokuSaku; // Size = 0x164 + extern const ActorInit Bg_Keikoku_Saku_InitVars; #endif // Z_BG_KEIKOKU_SAKU_H diff --git a/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c b/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c index 524414e1ce..57a6f33127 100644 --- a/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c +++ b/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c @@ -74,7 +74,7 @@ void DemoSyoten_Init(Actor* thisx, PlayState* play) { switch (DEMOSYOTEN_GET_F(&this->actor)) { case DEMOSYOTEN_F_0: func_80183430(&this->unk_144, &object_syoten_Blob_001328, &object_syoten_Blob_00023C, this->unk_174, - this->unk_2A6, 0); + this->unk_2A6, NULL); func_801835EC(&this->unk_144, &object_syoten_Blob_00023C); this->actor.draw = NULL; this->actionFunc = func_80C16A74; diff --git a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c index 44905d8003..5efd088ae8 100644 --- a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c +++ b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c @@ -120,13 +120,13 @@ static AnimationInfo sAnimations[] = { { &object_delf_Anim_000E44, 1.0f, 0.0f, -1.0f, 0, 0.0f }, }; -DmChar00Struct D_80AA77A8[] = { +Color_RGBAf D_80AA77A8[] = { { 250.0f, 255.0f, 230.0f, 255.0f }, { 63.0f, 18.0f, 93.0f, 255.0f }, { 255.0f, 235.0f, 220.0f, 255.0f }, }; -DmChar00Struct D_80AA77D8[] = { +Color_RGBAf D_80AA77D8[] = { { 220.0f, 160.0f, 80.0f, 255.0f }, { 250.0f, 40.0f, 10.0f, 255.0f }, { 255.0f, 235.0f, 220.0f, 255.0f }, @@ -934,13 +934,13 @@ void DmChar00_Draw(Actor* thisx, PlayState* play2) { gSPSegment(POLY_XLU_DISP++, 0x08, &gfx[0]); gDPPipeSync(gfx++); - gDPSetPrimColor(gfx++, 0, 0x01, (u8)this->unk_240.unk_00, (u8)this->unk_240.unk_04, (u8)this->unk_240.unk_08, - (u8)(this->unk_240.unk_0C * 1)); + gDPSetPrimColor(gfx++, 0, 0x01, (u8)this->unk_240.r, (u8)this->unk_240.g, (u8)this->unk_240.b, + (u8)(this->unk_240.a * 1)); gDPSetRenderMode(gfx++, G_RM_PASS, G_RM_ZB_CLD_SURF2); gSPEndDisplayList(gfx); - gDPSetEnvColor(POLY_XLU_DISP++, (u8)(s8)this->unk_250.unk_00, (u8)(s8)this->unk_250.unk_04, - (u8)(s8)this->unk_250.unk_08, (u8)(s8)((f32)phi_a0 * 1)); + gDPSetEnvColor(POLY_XLU_DISP++, (u8)(s8)this->unk_250.r, (u8)(s8)this->unk_250.g, (u8)(s8)this->unk_250.b, + (u8)(s8)((f32)phi_a0 * 1)); gDPSetDither(POLY_XLU_DISP++, G_CD_BAYER); POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, diff --git a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.h b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.h index 0a7f2410c6..1df0df06db 100644 --- a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.h +++ b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.h @@ -13,13 +13,6 @@ typedef void (*DmChar00ActionFunc)(struct DmChar00*, PlayState*); #define DMCHAR00_0 0 #define DMCHAR00_1 1 -typedef struct { - /* 0x00 */ f32 unk_00; - /* 0x04 */ f32 unk_04; - /* 0x08 */ f32 unk_08; - /* 0x0C */ f32 unk_0C; -} DmChar00Struct; // size = 0x10 - typedef struct DmChar00 { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -28,8 +21,8 @@ typedef struct DmChar00 { /* 0x1E2 */ Vec3s morphTable[7]; /* 0x20C */ UNK_TYPE1 unk_20C[0x30]; /* 0x23C */ DmChar00ActionFunc actionFunc; - /* 0x240 */ DmChar00Struct unk_240; - /* 0x250 */ DmChar00Struct unk_250; + /* 0x240 */ Color_RGBAf unk_240; + /* 0x250 */ Color_RGBAf unk_250; /* 0x260 */ u8 unk_260; /* 0x261 */ u8 unk_261; /* 0x262 */ u16 unk_262; diff --git a/src/overlays/actors/ovl_Dm_Char07/z_dm_char07.h b/src/overlays/actors/ovl_Dm_Char07/z_dm_char07.h index 5ea5fa36c5..39f09856a7 100644 --- a/src/overlays/actors/ovl_Dm_Char07/z_dm_char07.h +++ b/src/overlays/actors/ovl_Dm_Char07/z_dm_char07.h @@ -10,11 +10,11 @@ typedef void (*DmChar07ActionFunc)(struct DmChar07*, PlayState*); #define DMCHAR07_GET_SPOTLIGHTFLAGS(thisx) (((thisx)->params >> 8) & 0x1F) #define DMCHAR07_GET_TYPE(thisx) ((thisx)->params & 0xFF) -#define DMCHAR07_STAGE_RIGHT_SPOTLIGHT 1 // Deku spotlight -#define DMCHAR07_UPSTAGE_RIGHT_SPOTLIGHT 2 // Goron spotlight -#define DMCHAR07_STAGE_CENTER_SPOTLIGHT 4 // Human spotlight -#define DMCHAR07_UPSTAGE_LEFT_SPOTLIGHT 8 // Zora spotlight -#define DMCHAR07_DOWNSTAGE_CENTER_SPOTLIGHT 16 +#define DMCHAR07_STAGE_RIGHT_SPOTLIGHT (1 << 0) // Deku spotlight +#define DMCHAR07_UPSTAGE_RIGHT_SPOTLIGHT (1 << 1) // Goron spotlight +#define DMCHAR07_STAGE_CENTER_SPOTLIGHT (1 << 2) // Human spotlight +#define DMCHAR07_UPSTAGE_LEFT_SPOTLIGHT (1 << 3) // Zora spotlight +#define DMCHAR07_DOWNSTAGE_CENTER_SPOTLIGHT (1 << 4) typedef enum { /* 0 */ DMCHAR07_STAGE, diff --git a/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c b/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c index 57f1fb0e07..30cf308b62 100644 --- a/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c +++ b/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c @@ -42,8 +42,8 @@ s32 func_80C1DED0(DmNb* this, s32 arg1) { void func_80C1DF18(DmNb* this, PlayState* play) { s32 sp2C[] = { 0, 0, 0, 0, 0 }; - u16 actionUnk0; - s32 actionIndex; + u16 csAction; + s32 csActionIndex; if (play->csCtx.state != 0) { if (this->unk1F8 == 0) { @@ -51,14 +51,14 @@ void func_80C1DF18(DmNb* this, PlayState* play) { this->unk1F8 = 1; this->unk1F4 = this->unk1F0; } - if (Cutscene_CheckActorAction(play, 562)) { - actionIndex = Cutscene_GetActorActionIndex(play, 562); - actionUnk0 = play->csCtx.actorActions[actionIndex]->action; - if (this->unk1EC != (actionUnk0 & 0xFF)) { - this->unk1EC = actionUnk0; - func_80C1DED0(this, sp2C[actionUnk0]); + if (Cutscene_CheckActorAction(play, 0x232)) { + csActionIndex = Cutscene_GetActorActionIndex(play, 0x232); + csAction = play->csCtx.actorActions[csActionIndex]->action; + if (this->unk1EC != (u8)csAction) { + this->unk1EC = csAction; + func_80C1DED0(this, sp2C[csAction]); } - Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex); + Cutscene_ActorTranslateAndYaw(&this->actor, play, csActionIndex); } } else if (this->unk1F8 != 0) { this->unk1F8 = 0; diff --git a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c index 725b740f07..a84e9e4308 100644 --- a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c +++ b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c @@ -373,7 +373,7 @@ void EnBji01_Update(Actor* thisx, PlayState* play) { s32 pad; this->actionFunc(this, play); - Actor_UpdateBgCheckInfo(play, (Actor*)this, 0.0f, 0.0f, 0.0f, 4); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); SkelAnime_Update(&this->skelAnime); if (this->blinkTimer-- <= 0) { diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index db3639c278..7f9485d370 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -657,7 +657,7 @@ s32 func_80998F9C(EnGs* this, PlayState* play) { if (this->unk_19D == 2) { this->unk_19E[0].y += (s32)(this->unk_1DC * (0x10000 / 360.0f)); - if ((this->unk_1D4++ <= 40) ^ 1) { + if (this->unk_1D4++ > 40) { this->unk_1DC = this->unk_1B0[0].y - 1.0f; this->unk_1E0 = 1.5f; this->unk_1E4 = this->unk_1B0[1].y - 1.0f; @@ -825,7 +825,7 @@ s32 func_809995A4(EnGs* this, PlayState* play) { func_800B9010(&this->actor, NA_SE_EV_FIRE_PILLAR - SFX_FLAG); - if ((this->unk_1D4++ < 40) ^ 1) { + if (this->unk_1D4++ >= 40) { this->unk_19A |= 0x10; this->actor.uncullZoneForward = 12000.0f; diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c index 7c98aa84e2..0ea6d71dda 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c @@ -3692,17 +3692,14 @@ void func_80B4BA84(Actor* thisx, PlayState* play) { sp2C = this->unk3BC; this->unk3BC = func_80B44234(this, &D_80B5040C->actor.world.pos); if (sp2C != this->unk3BC) { - phi_v0 = this->pathIndex; phi_v0 = this->unk3BC - this->pathIndex; - temp_v0_3 = phi_v0; - if (temp_v0_3 < 0) { + if (phi_v0 < 0) { phi_v0 += this->endPoint; } - temp_v0_3 = this->endPoint >> 1; - if (temp_v0_3 < phi_v0) { + if ((this->endPoint >> 1) < phi_v0) { this->direction = DIRECTION_BACKWARD; - } else if (phi_v0 < temp_v0_3) { + } else if (phi_v0 < (this->endPoint >> 1)) { this->direction = DIRECTION_FORWARD; } } diff --git a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c index 73cf73c361..435d319727 100644 --- a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c +++ b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c @@ -209,7 +209,7 @@ void func_80A5B508(void) { sp74[7] = (spAC - temp_f20) * temp_f22 * temp_f24 * temp_f2; for (i = 0; i < ARRAY_COUNT(D_80A60908); i++) { - ptr = (f32*)&D_80A60908[i].mf[0]; + ptr = &D_80A60908[i].xx; tempf1 = sp74[(i + 0) & 7]; tempf2 = sp74[(i + 1) & 7]; @@ -242,8 +242,8 @@ void func_80A5B508(void) { void func_80A5B954(MtxF* matrix, f32 arg1) { s32 i; MtxF* temp = Matrix_GetCurrent(); - f32* tmp = (f32*)&temp->mf[0]; - f32* tmp2 = (f32*)&matrix->mf[0]; + f32* tmp = &temp->xx; + f32* tmp2 = &matrix->xx; for (i = 0; i < 16; i++) { *tmp++ += *tmp2++ * arg1; diff --git a/src/overlays/actors/ovl_En_Shn/z_en_shn.c b/src/overlays/actors/ovl_En_Shn/z_en_shn.c index 51faf709c4..817648daa5 100644 --- a/src/overlays/actors/ovl_En_Shn/z_en_shn.c +++ b/src/overlays/actors/ovl_En_Shn/z_en_shn.c @@ -17,7 +17,6 @@ void EnShn_Update(Actor* thisx, PlayState* play); void EnShn_Draw(Actor* thisx, PlayState* play); void func_80AE69E8(EnShn* this, PlayState* play); void func_80AE6A64(EnShn* this, PlayState* play); -s32 func_80AE6704(EnShn* this, PlayState* play); // Could be something related to text/dialogue? static UNK_TYPE D_80AE6F00[] = { @@ -228,7 +227,7 @@ s32 func_80AE65F4(EnShn* this, PlayState* play) { return false; } -s32 func_80AE6704(EnShn* thisx, PlayState* play) { +s32 func_80AE6704(Actor* thisx, PlayState* play) { EnShn* this = THIS; s32 ret = 0; diff --git a/src/overlays/actors/ovl_En_Shn/z_en_shn.h b/src/overlays/actors/ovl_En_Shn/z_en_shn.h index cc7c37ac44..e373abde2a 100644 --- a/src/overlays/actors/ovl_En_Shn/z_en_shn.h +++ b/src/overlays/actors/ovl_En_Shn/z_en_shn.h @@ -7,6 +7,7 @@ struct EnShn; typedef void (*EnShnActionFunc)(struct EnShn*, PlayState*); +typedef s32 (*MsgEventFunc)(Actor*, PlayState*); typedef struct EnShn { /* 0x000 */ Actor actor; @@ -34,7 +35,7 @@ typedef struct EnShn { /* 0x2CC */ f32 playSpeed; /* 0x2D0 */ f32 unk_2D0; /* 0x2D4 */ f32 unk_2D4; - /* 0x2D8 */ s32 unk_2D8; + /* 0x2D8 */ MsgEventFunc unk_2D8; /* 0x2DC */ s32 prevTalkState; /* 0x2E0 */ s32 unk_2E0; /* 0x2E4 */ s32 unk_2E4; diff --git a/src/overlays/actors/ovl_En_Test7/z_en_test7.c b/src/overlays/actors/ovl_En_Test7/z_en_test7.c index c0953a1172..b9b62e9f79 100644 --- a/src/overlays/actors/ovl_En_Test7/z_en_test7.c +++ b/src/overlays/actors/ovl_En_Test7/z_en_test7.c @@ -398,7 +398,7 @@ void EnTest7_Init(Actor* thisx, PlayState* play2) { this->unk_1E94 = player->actor.scale.z; func_80183430(&this->unk_18CC, &gameplay_keep_Blob_085640, &gameplay_keep_Blob_083534, this->unk_18FC, - this->unk_1BA8, 0); + this->unk_1BA8, NULL); func_801834A8(&this->unk_18CC, &gameplay_keep_Blob_083534); func_80AF0838(this->unk_15C); func_80AF1730(&this->unk_148); diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h index 3f1b80c0ea..fe18c8e1ba 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h @@ -10,7 +10,7 @@ typedef void (*EnWeatherTagActionFunc)(struct EnWeatherTag*, PlayState*); typedef struct EnWeatherTag { /* 0x000 */ Actor actor; /* 0x144 */ EnWeatherTagActionFunc actionFunc; - /* 0x148 */ u8 pad148[0x4]; // todo attempt remove + /* 0x148 */ UNK_TYPE1 pad148[0x4]; /* 0x14C */ u8 pathCount; /* 0x150 */ Vec3s* pathPoints; // 154: the code avoids what would be a negative value if signed, but signed wont match diff --git a/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c b/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c index 87433b9888..73c5e32c6e 100644 --- a/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c +++ b/src/overlays/actors/ovl_Obj_Flowerpot/z_obj_flowerpot.c @@ -146,7 +146,7 @@ void func_80A1B3D0(void) { sp74[7] = (spAC - temp_f20) * temp_f22 * temp_f24 * temp_f0 * 0.0013f; for (i = 0; i < ARRAY_COUNT(D_80A1D838); i++) { - ptr = (f32*)&D_80A1D838[i].mf[0]; + ptr = &D_80A1D838[i].xx; tempf1 = sp74[(i + 0) & 7]; tempf2 = sp74[(i + 1) & 7]; diff --git a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c index 40fd2682bf..fcbdfbad49 100644 --- a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c +++ b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c @@ -134,7 +134,7 @@ void ObjKibako2_SpawnSkulltula(ObjKibako2* this, PlayState* play) { } void ObjKibako2_SpawnContents(ObjKibako2* this, PlayState* play) { - if (KIBAKO2_CONTENTS(&this->dyna.actor) == CONTENTS_COLLECTIBLE) { + if (KIBAKO2_CONTENTS(&this->dyna.actor) == OBJKIBAKO2_CONTENTS_COLLECTIBLE) { ObjKibako2_SpawnCollectible(this, play); } else { ObjKibako2_SpawnSkulltula(this, play); @@ -157,14 +157,14 @@ void ObjKibako2_Init(Actor* thisx, PlayState* play) { this->dyna.actor.shape.rot.z = 0; this->dyna.actor.world.rot.x = 0; this->dyna.actor.shape.rot.x = 0; - if (contents == CONTENTS_COLLECTIBLE) { + if (contents == OBJKIBAKO2_CONTENTS_COLLECTIBLE) { if (Item_CanDropBigFairy(play, KIBAKO2_COLLECTIBLE_ID(&this->dyna.actor), KIBAKO2_COLLECTIBLE_FLAG(&this->dyna.actor))) { this->unk_1AC = 1; this->dyna.actor.flags |= ACTOR_FLAG_10; } } - if ((contents != CONTENTS_SKULLTULA) || !ObjKibako2_ContainsSkulltula(this, play)) { + if ((contents != OBJKIBAKO2_CONTENTS_SKULLTULA) || !ObjKibako2_ContainsSkulltula(this, play)) { this->skulltulaNoiseTimer = -1; } this->actionFunc = ObjKibako2_Idle; diff --git a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.h b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.h index 5f319558e1..f1816ab4d9 100644 --- a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.h +++ b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.h @@ -9,8 +9,8 @@ #define KIBAKO2_CONTENTS(thisx) (((thisx)->params >> 0xF) & 1) typedef enum { - /* 0 */ CONTENTS_COLLECTIBLE, - /* 1 */ CONTENTS_SKULLTULA + /* 0 */ OBJKIBAKO2_CONTENTS_COLLECTIBLE, + /* 1 */ OBJKIBAKO2_CONTENTS_SKULLTULA } ObjKibako2Contents; struct ObjKibako2; diff --git a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c index 616fb341c6..23ca0872d1 100644 --- a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c +++ b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c @@ -110,30 +110,29 @@ void ObjRaillift_DoNothing(ObjRaillift* this, PlayState* play) { } void ObjRaillift_Move(ObjRaillift* this, PlayState* play) { - s32 isTeleporting; + Actor* thisx = &this->dyna.actor; Vec3f nextPoint; f32 speed; f32 target; f32 step; + s32 isTeleporting; s32 isPosUpdated; - Vec3s* initialPoint; Vec3s* endPoint; - s32 pad; - if (OBJRAILLIFT_HAS_FLAG(&this->dyna.actor)) { - if (!Flags_GetSwitch(play, OBJRAILLIFT_GET_FLAG(&this->dyna.actor))) { + if (OBJRAILLIFT_HAS_FLAG(thisx)) { + if (!Flags_GetSwitch(play, OBJRAILLIFT_GET_FLAG(thisx))) { this->actionFunc = ObjRaillift_Idle; return; } - if (OBJRAILLIFT_GET_TYPE(&this->dyna.actor) == DEKU_FLOWER_PLATFORM) { - func_800B9010(&this->dyna.actor, NA_SE_EV_PLATE_LIFT_LEVEL - SFX_FLAG); + if (OBJRAILLIFT_GET_TYPE(thisx) == DEKU_FLOWER_PLATFORM) { + func_800B9010(thisx, NA_SE_EV_PLATE_LIFT_LEVEL - SFX_FLAG); } } - Math_Vec3s_ToVec3f(&nextPoint, &(&this->points[this->curPoint])[this->direction]); - Math_Vec3f_Diff(&nextPoint, &this->dyna.actor.world.pos, &this->dyna.actor.velocity); - speed = Math3D_Vec3fMagnitude(&this->dyna.actor.velocity); + Math_Vec3s_ToVec3f(&nextPoint, this->points + this->curPoint + this->direction); + Math_Vec3f_Diff(&nextPoint, &thisx->world.pos, &thisx->velocity); + speed = Math3D_Vec3fMagnitude(&thisx->velocity); if ((speed < (this->speed * 8.0f)) && (this->speed > 2.0f)) { target = ((this->speed - 2.0f) * 0.1f) + 2.0f; step = this->speed * 0.03f; @@ -142,17 +141,16 @@ void ObjRaillift_Move(ObjRaillift* this, PlayState* play) { step = this->speed * 0.16f; } - Math_StepToF(&this->dyna.actor.speedXZ, target, step); - if ((this->dyna.actor.speedXZ + 0.05f) < speed) { - Math_Vec3f_Scale(&this->dyna.actor.velocity, this->dyna.actor.speedXZ / speed); - this->dyna.actor.world.pos.x += this->dyna.actor.velocity.x; - this->dyna.actor.world.pos.y += this->dyna.actor.velocity.y; - this->dyna.actor.world.pos.z += this->dyna.actor.velocity.z; + Math_StepToF(&thisx->speedXZ, target, step); + if ((thisx->speedXZ + 0.05f) < speed) { + Math_Vec3f_Scale(&thisx->velocity, thisx->speedXZ / speed); + thisx->world.pos.x += thisx->velocity.x; + thisx->world.pos.y += thisx->velocity.y; + thisx->world.pos.z += thisx->velocity.z; } else { this->curPoint += this->direction; - if (1) {} - this->dyna.actor.speedXZ *= 0.4f; - isTeleporting = OBJRAILLIFT_SHOULD_TELEPORT(&this->dyna.actor); + thisx->speedXZ *= 0.4f; + isTeleporting = OBJRAILLIFT_SHOULD_TELEPORT(thisx); isPosUpdated = true; if (((this->curPoint >= this->endPoint) && (this->direction > 0)) || ((this->curPoint <= 0) && (this->direction < 0))) { @@ -163,9 +161,8 @@ void ObjRaillift_Move(ObjRaillift* this, PlayState* play) { } else { endPoint = &this->points[this->endPoint]; this->curPoint = this->direction > 0 ? 0 : this->endPoint; - initialPoint = &this->points[0]; - if ((initialPoint->x != endPoint->x) || (initialPoint->y != endPoint->y) || - (initialPoint->z != endPoint->z)) { + if ((this->points[0].x != endPoint->x) || (this->points[0].y != endPoint->y) || + (this->points[0].z != endPoint->z)) { this->actionFunc = ObjRaillift_Teleport; func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId); isPosUpdated = false; @@ -222,7 +219,7 @@ void ObjRaillift_Update(Actor* thisx, PlayState* play) { f32 step; this->actionFunc(this, play); - Actor_SetFocus(&this->dyna.actor, 10.0f); + Actor_SetFocus(thisx, 10.0f); if (this->cutsceneTimer > 0) { this->cutsceneTimer--; if (this->cutsceneTimer == 0) { diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index 1c32f64906..68488b336b 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -91,7 +91,7 @@ void Title_Draw(GameState* thisx) { gDPPipeSync(POLY_OPA_DISP++); gDPSetCycleType(POLY_OPA_DISP++, G_CYC_2CYCLE); - gDPSetRenderMode(POLY_OPA_DISP++, G_RM_XLU_SURF2, G_RM_OPA_CI | CVG_DST_WRAP); + gDPSetRenderMode(POLY_OPA_DISP++, G_RM_PASS, G_RM_CLD_SURF2); gDPSetCombineLERP(POLY_OPA_DISP++, TEXEL1, PRIMITIVE, ENV_ALPHA, TEXEL0, 0, 0, 0, TEXEL0, PRIMITIVE, ENVIRONMENT, COMBINED, ENVIRONMENT, COMBINED, 0, PRIMITIVE, 0); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 170, 255, 255, 255);