More cleanup

This commit is contained in:
engineer124
2022-04-23 16:01:21 +10:00
parent 353781bbe7
commit c8d1b5914e
14 changed files with 71 additions and 105 deletions
+2 -3
View File
@@ -405,7 +405,6 @@ void func_80151BB4(GlobalContext* globalCtx, u8 arg1) {
u32 func_80151C9C(GlobalContext* globalCtx) {
MessageContext* msgCtx = &globalCtx->msgCtx;
u8 flag;
while (true) {
if (msgCtx->unk120B1 == 0) {
@@ -415,9 +414,9 @@ u32 func_80151C9C(GlobalContext* globalCtx) {
if ((gSaveContext.save.weekEventReg[D_801C6B28[msgCtx->unk120B2[msgCtx->unk120B1]] >> 8] &
(u8)D_801C6B28[msgCtx->unk120B2[msgCtx->unk120B1]]) == 0) {
flag = gSaveContext.save.weekEventReg[D_801C6B28[msgCtx->unk120B2[msgCtx->unk120B1]] >> 8];
gSaveContext.save.weekEventReg[D_801C6B28[msgCtx->unk120B2[msgCtx->unk120B1]] >> 8] =
flag | (u8)D_801C6B28[msgCtx->unk120B2[msgCtx->unk120B1]];
((void)0, gSaveContext.save.weekEventReg[D_801C6B28[msgCtx->unk120B2[msgCtx->unk120B1]] >> 8]) |
(u8)D_801C6B28[msgCtx->unk120B2[msgCtx->unk120B1]];
if ((D_801C6AB8[msgCtx->unk120B2[msgCtx->unk120B1]] != 0) && CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) {
func_80151938(globalCtx, D_801C6AB8[msgCtx->unk120B2[msgCtx->unk120B1]]);
play_sound(NA_SE_SY_SCHEDULE_WRITE);
+2 -5
View File
@@ -1512,7 +1512,6 @@ void func_80AA27EC(DmStk* this, GlobalContext* globalCtx) {
void DmStk_Update(Actor* thisx, GlobalContext* globalCtx) {
DmStk* this = THIS;
u16 time;
if (this->actor.params != 1) {
if (this->unk_2E0 == 33) {
@@ -1569,11 +1568,9 @@ void DmStk_Update(Actor* thisx, GlobalContext* globalCtx) {
(globalCtx->msgCtx.currentTextId == 0x5E6) && !FrameAdvance_IsEnabled(&globalCtx->state) &&
(globalCtx->sceneLoadFlag == 0) && (ActorCutscene_GetCurrentIndex() == -1) &&
(globalCtx->csCtx.state == 0)) {
time = gSaveContext.save.time;
gSaveContext.save.time = (u16)REG(15) + time;
gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)REG(15);
if (REG(15) != 0) {
time = gSaveContext.save.time;
gSaveContext.save.time = (u16)gSaveContext.save.daySpeed + time;
gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)((void)0, gSaveContext.save.daySpeed);
}
}
}
@@ -100,11 +100,8 @@ void func_809C10B0(EnAob01* this, s32 arg1) {
}
void func_809C1124(void) {
u16 time = gSaveContext.save.time;
gSaveContext.save.time = (u16)REG(15) + time;
time = gSaveContext.save.time;
gSaveContext.save.time = (u16)gSaveContext.save.daySpeed + time;
gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)REG(15);
gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)((void)0, gSaveContext.save.daySpeed);
}
void func_809C1158(EnAob01* this, GlobalContext* globalCtx) {
@@ -872,9 +872,7 @@ s32 func_80B44234(EnInvadepoh* this, Vec3f* vec) {
}
void func_80B442E4(EnInvadepoh* this) {
s32 pad;
s32 sp18 = gSaveContext.save.time;
s32 temp_v1_2 = sp18 - func_80B43A24(this->actor.params & 7);
s32 temp_v1_2 = ((void)0, (s32)gSaveContext.save.time) - func_80B43A24(this->actor.params & 7);
if (D_80B4E940 == 1) {
this->clockTime = 0.0f;
@@ -999,6 +997,7 @@ void func_80B44700(EnInvadepoh* this) {
this->clockTime = 1.0f;
} else {
f32 new_var = 0.00153374229558f;
this->clockTime = (currentTime + new_var4) * new_var;
this->clockTime = CLAMP(this->clockTime, 0.0f, 1.0f);
}
+5 -10
View File
@@ -375,24 +375,19 @@ void func_80A6FBA0(EnMm3* this) {
void func_80A6FBFC(EnMm3* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
OSTime a;
OSTime b;
if (gSaveContext.unk_3DD0[0] == 0x10) {
player->stateFlags1 &= ~0x20;
this->actor.flags |= ACTOR_FLAG_10000;
if (gSaveContext.unk_3DE0[0] >= 0x5DD) {
if (gSaveContext.unk_3DE0[0] > 0x5DC) {
gSaveContext.unk_3DE0[0] = 0x5DC;
} else {
a = gSaveContext.unk_3DE0[0];
if (a >= (OSTime)(995 - XREG(16))) {
b = gSaveContext.unk_3DE0[0];
if ((OSTime)(XREG(17) + 1005) >= b) {
gSaveContext.unk_3DE0[0] = 1000;
}
if ((((void)0, gSaveContext.unk_3DE0[0]) >= (OSTime)(995 - XREG(16))) &&
(((void)0, gSaveContext.unk_3DE0[0]) <= (OSTime)(XREG(17) + 1005))) {
gSaveContext.unk_3DE0[0] = 1000;
}
}
} else if (gSaveContext.unk_3DE0[0] >= 0x5DD) {
} else if (gSaveContext.unk_3DE0[0] > 0x5DC) {
gSaveContext.unk_3DD0[0] = 15;
gSaveContext.unk_3DC8 = osGetTime();
}
+9 -6
View File
@@ -133,15 +133,18 @@ void EnMuto_Idle(EnMuto* this, GlobalContext* globalCtx) {
Player* player;
this->actor.textId = sTextIds[this->textIdIndex];
if (!this->isInMayorsRoom && (player = GET_PLAYER(globalCtx))->transformation == PLAYER_FORM_DEKU) {
if (!(gSaveContext.save.weekEventReg[88] & 8)) {
this->actor.textId = 0x62C;
} else {
this->actor.textId = 0x62B;
if (!this->isInMayorsRoom) {
player = GET_PLAYER(globalCtx);
if (player->transformation == PLAYER_FORM_DEKU) {
if (!(gSaveContext.save.weekEventReg[88] & 8)) {
this->actor.textId = 0x62C;
} else {
this->actor.textId = 0x62B;
}
}
}
if (1) {} // Needed to match
if (1) {} // Needed match
if (!this->isInMayorsRoom && Player_GetMask(globalCtx) == PLAYER_MASK_KAFEIS_MASK) {
this->actor.textId = 0x2363;
+8 -9
View File
@@ -807,14 +807,13 @@ void func_80AF8AC8(EnPm* this) {
}
}
u16 D_80AFB8D4[] = {
0x1B02, 0x1B04, 0x1B08, 0x1B10, 0x1B20, 0x0000,
};
u16 D_80AFB8E0[] = {
0x1B40, 0x1B80, 0x1C01, 0x1C02, 0x1C04, 0x0000,
};
void func_80AF8BA8(s32 arg0) {
static u16 D_80AFB8D4[] = {
0x1B02, 0x1B04, 0x1B08, 0x1B10, 0x1B20, 0x0000,
};
static u16 D_80AFB8E0[] = {
0x1B40, 0x1B80, 0x1C01, 0x1C02, 0x1C04, 0x0000,
};
s32 temp;
if (!(gSaveContext.save.weekEventReg[88] & 2)) {
if (gSaveContext.save.weekEventReg[D_80AFB8D4[arg0] >> 8] &
@@ -833,9 +832,9 @@ void func_80AF8BA8(s32 arg0) {
}
}
temp = gSaveContext.save.weekEventReg[D_80AFB8E0[arg0] >> 8];
gSaveContext.save.weekEventReg[D_80AFB8E0[arg0] >> 8] =
temp | (D_80AFB8E0[arg0] & (1 | 2 | 4 | 0x38 | 0x40 | 0x80));
((void)0, gSaveContext.save.weekEventReg[D_80AFB8E0[arg0] >> 8]) |
(D_80AFB8E0[arg0] & (1 | 2 | 4 | 0x38 | 0x40 | 0x80));
}
void func_80AF8C68(EnPm* this, GlobalContext* globalCtx) {
+2 -4
View File
@@ -314,7 +314,6 @@ void func_80A767A8(EnPrz* this, GlobalContext* globalCtx) {
EnPr* pr = (EnPr*)this->actor.parent;
f32 sqrt;
s32 pad[2];
u8 playerForm;
if (func_80A762C0(this, globalCtx)) {
func_80A75F18(this, 0);
@@ -354,9 +353,8 @@ void func_80A767A8(EnPrz* this, GlobalContext* globalCtx) {
this->unk_1C8 = 1;
}
playerForm = gSaveContext.save.playerForm;
this->unk_1D8.y =
(player->actor.world.pos.y + D_80A771E0[playerForm]) + randPlusMinusPoint5Scaled((2.0f * this->unk_1E6) + 1.0f);
this->unk_1D8.y = (player->actor.world.pos.y + D_80A771E0[((void)0, gSaveContext.save.playerForm)]) +
randPlusMinusPoint5Scaled((2.0f * this->unk_1E6) + 1.0f);
func_80A76070(this, Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_1D8), globalCtx);
}
@@ -186,12 +186,8 @@ void EnSuttari_SetNextEntrance(GlobalContext* globalCtx, u16 nextEntranceIndex)
}
void EnSuttari_UpdateTime(void) {
u32* unk_14 = &gSaveContext.save.daySpeed;
u16 time = gSaveContext.save.time;
gSaveContext.save.time = (u16)REG(15) + time;
time = gSaveContext.save.time;
gSaveContext.save.time = (u16)*unk_14 + time;
gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)REG(15);
gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)((void)0, gSaveContext.save.daySpeed);
}
s32 func_80BAA904(EnSuttari* this, GlobalContext* globalCtx) {
+24 -29
View File
@@ -885,38 +885,33 @@ void func_808DA89C(EnSw* this, GlobalContext* globalCtx) {
this->drawDmgEffType = ACTOR_DRAW_DMGEFF_BLUE_FIRE;
func_808D8ED0(this, globalCtx);
}
return;
if (1) {}
}
if (ENSW_GET_3(&this->actor)) {
} else if (ENSW_GET_3(&this->actor)) {
this->actionFunc = func_808DAEB4;
return;
}
if (this->actor.bgCheckFlags & 1) {
f32 temp_f2;
this->actor.shape.yOffset = 400.0f;
temp_f2 = fabsf(this->actor.velocity.y) * 0.6f;
this->actor.velocity.y = temp_f2;
this->unk_448 = temp_f2;
this->actor.speedXZ = 0.0f;
if ((s32)temp_f2 != 0) {
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALTURA_BOUND);
} else {
this->actionFunc = func_808DAEB4;
this->actor.velocity.y = 0.0f;
}
if ((s32)this->actor.velocity.y >= 2) {
func_808D8940(this, globalCtx);
}
} else {
Math_ApproachF(&this->actor.shape.yOffset, 400.0f, 0.3f, 1000.0f);
}
if (this->actor.bgCheckFlags & 1) {
f32 temp_f2;
Actor_MoveWithGravity(&this->actor);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4);
this->actor.shape.yOffset = 400.0f;
temp_f2 = fabsf(this->actor.velocity.y) * 0.6f;
this->actor.velocity.y = temp_f2;
this->unk_448 = temp_f2;
this->actor.speedXZ = 0.0f;
if ((s32)temp_f2 != 0) {
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_STALTURA_BOUND);
} else {
this->actionFunc = func_808DAEB4;
this->actor.velocity.y = 0.0f;
}
if ((s32)this->actor.velocity.y >= 2) {
func_808D8940(this, globalCtx);
}
} else {
Math_ApproachF(&this->actor.shape.yOffset, 400.0f, 0.3f, 1000.0f);
}
Actor_MoveWithGravity(&this->actor);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4);
}
}
void func_808DAA60(EnSw* this, GlobalContext* globalCtx) {
@@ -1098,23 +1098,16 @@ void func_809C898C(EnSyatekiMan* this, GlobalContext* globalCtx) {
};
static s32 D_809C94A8 = 0;
Player* player = GET_PLAYER(globalCtx);
s32 sp30;
s32 pad;
u64 sp20;
sp20 = gSaveContext.unk_3DE0[1];
sp30 = (sp20 * 0.1f) + 1.0f;
s32 sp30 = (((void)0, gSaveContext.unk_3DE0[1]) * 0.1f) + 1.0f;
if (sp30 < 0x2EF) {
s32 temp;
// clang-format off
if (D_809C94A8 == 0) {
sp20 = gSaveContext.unk_3DE0[1]; temp = sp20 % 0x1F4;
temp = ((void)0, gSaveContext.unk_3DE0[1]) % 0x1F4;
} else {
sp20 = gSaveContext.unk_3DE0[1]; temp = (sp20 + 250) % 0x1F4;
temp = (((void)0, gSaveContext.unk_3DE0[1]) + 250) % 0x1F4;
}
//clang-format on
if (temp < 100) {
this->unk_26C = 0x50;
@@ -1293,7 +1286,7 @@ void EnSyatekiMan_Draw(Actor* thisx, GlobalContext* globalCtx) {
gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_809C94B8[this->unk_264]));
SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
EnSyatekiMan_OverrideLimbDraw, EnSyatekiMan_PostLimbDraw, &this->actor);
EnSyatekiMan_OverrideLimbDraw, EnSyatekiMan_PostLimbDraw, &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
@@ -482,18 +482,15 @@ void func_80967608(EnWeatherTag* this, GlobalContext* globalCtx) {
void EnWeatherTag_Update(Actor* thisx, GlobalContext* globalCtx) {
EnWeatherTag* this = THIS;
u16 oldTime;
this->actionFunc(this, globalCtx);
if ((globalCtx->actorCtx.unk5 & 2) && (globalCtx->msgCtx.msgMode != 0) &&
(globalCtx->msgCtx.currentTextId == 0x5E6) && (!FrameAdvance_IsEnabled(&globalCtx->state)) &&
(globalCtx->sceneLoadFlag == 0) && (ActorCutscene_GetCurrentIndex() == -1) && (globalCtx->csCtx.state == 0)) {
oldTime = gSaveContext.save.time;
gSaveContext.save.time = (u16)REG(0xF) + oldTime; // cast req
gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)REG(0xF);
if (REG(0xF) != 0) {
oldTime = gSaveContext.save.time;
gSaveContext.save.time = (u16)gSaveContext.save.daySpeed + oldTime;
gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)((void)0, gSaveContext.save.daySpeed);
}
}
}
@@ -351,7 +351,7 @@ void MirRay3_Draw(Actor* thisx, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
s32 i;
f32 temp;
u16 phi_a0;
u16 time;
if (!(this->unk_210 & 1) && func_8012405C(globalCtx)) {
Matrix_InsertMatrix(&player->shieldMf, MTXMODE_NEW);
@@ -369,13 +369,13 @@ void MirRay3_Draw(Actor* thisx, GlobalContext* globalCtx) {
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if (MIRRAY3_GET_F(&this->actor) == MIRRAY3_F_1) {
phi_a0 = gSaveContext.save.time;
time = gSaveContext.save.time;
if (phi_a0 > CLOCK_TIME(12, 0)) {
phi_a0 = 0xFFFF - phi_a0;
if (time > CLOCK_TIME(12, 0)) {
time = 0xFFFF - time;
}
temp = (phi_a0 * (1.0f / 0x8000));
temp = (time * (1.0f / 0x8000));
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x78, 255, 255, 255, (u8)(s8)(100 * this->unk_214));
gDPSetEnvColor(POLY_XLU_DISP++, 218, 225, (u8)((100.0f * temp) + 105.0f), 255);
@@ -290,7 +290,6 @@ void ObjChan_InitPot(ObjChan* this, GlobalContext* globalCtx) {
void ObjChan_PotAction(ObjChan* this, GlobalContext* globalCtx) {
s32 potBreaks;
s16 temp_v0_2;
s32 phi_v1;
potBreaks = false;
@@ -311,9 +310,8 @@ void ObjChan_PotAction(ObjChan* this, GlobalContext* globalCtx) {
SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_CHANDELIER_BROKEN);
func_80BB9A1C((ObjChan*)this->actor.parent, 40.0f);
if (this->myPotIndex == 4) {
temp_v0_2 = gSaveContext.save.weekEventReg[0x25];
if (!(temp_v0_2 & 0x10)) {
gSaveContext.save.weekEventReg[0x25] = temp_v0_2 | 0x10;
if (!(((void)0, gSaveContext.save.weekEventReg[0x25]) & 0x10)) {
gSaveContext.save.weekEventReg[0x25] = ((void)0, gSaveContext.save.weekEventReg[0x25]) | 0x10;
Actor_SpawnAsChildAndCutscene(&globalCtx->actorCtx, globalCtx, ACTOR_EN_MM, this->actor.world.pos.x,
this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0x8000,
this->actor.cutscene, this->actor.unk20, NULL);