mirror of
https://github.com/izzy2lost/2ship2harkinian-Android.git
synced 2026-06-19 01:20:08 -07:00
Improve Various Matchings and Cleanup (#809)
* Improve various matchings and cleanup * Fix warnings * Missed 2 * Few hex to dec * PR Suggestions * More PR Suggestions * Document time calculation * Improved use of macros * DAY_LENGTH macro * More cleanup of functions Co-authored-by: hensldm <https://github.com/hensldm> * Missing a space * PR Suggestions * Use DAY_LENGTH more
This commit is contained in:
@@ -51,6 +51,7 @@
|
||||
|
||||
#define CLOCK_TIME(hr, min) (s32)(((hr) * 60 + (min)) * 0x10000 / (24 * 60))
|
||||
#define CLOCK_TIME_MINUTE (CLOCK_TIME(0, 1))
|
||||
#define DAY_LENGTH (CLOCK_TIME(24, 0))
|
||||
|
||||
#define TIME_TO_MINUTES_F(time) ((time) * ((24.0f * 60.0f) / 0x10000)) // 0.021972656f
|
||||
#define CLOCK_TIME_F(hr, min) (((hr) * 60.0f + (min)) * (0x10000 / (24.0f * 60.0f)))
|
||||
|
||||
+2
-2
@@ -129,9 +129,9 @@ typedef struct Save {
|
||||
/* 0x000C */ u16 time; // "zelda_time"
|
||||
/* 0x000E */ u16 owlSaveLocation;
|
||||
/* 0x0010 */ s32 isNight; // "asahiru_fg"
|
||||
/* 0x0014 */ u32 daySpeed; // "change_zelda_time"
|
||||
/* 0x0014 */ s32 daySpeed; // "change_zelda_time"
|
||||
/* 0x0018 */ s32 day; // "totalday"
|
||||
/* 0x001C */ u32 daysElapsed; // "eventday"
|
||||
/* 0x001C */ s32 daysElapsed; // "eventday"
|
||||
/* 0x0020 */ u8 playerForm; // "player_character"
|
||||
/* 0x0021 */ u8 snowheadCleared; // "spring_flag"
|
||||
/* 0x0022 */ u8 hasTatl; // "bell_flag"
|
||||
|
||||
+6
-5
@@ -195,7 +195,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* mapper, GlobalContext* globalCtx
|
||||
CollisionPoly* spF8;
|
||||
s32 bgId;
|
||||
f32 floorHeight[2];
|
||||
f32 pad;
|
||||
Light* firstLight = &mapper->l.l[0];
|
||||
f32 shadowAlpha;
|
||||
f32 shadowScaleX;
|
||||
f32 shadowScaleZ;
|
||||
@@ -239,8 +239,6 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* mapper, GlobalContext* globalCtx
|
||||
IREG(88) + 80, IREG(89) + 60, IREG(90) + 40, 30000, 200, 60);
|
||||
}
|
||||
actor->shape.unk_17 &= ~spB8;
|
||||
|
||||
if ((uintptr_t)mapper->l.l) {} // POSSIBLE FAKE MATCH
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,7 +250,8 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* mapper, GlobalContext* globalCtx
|
||||
shadowScaleZ = 1.0f - (distToFloor * (1.0f / 70.0f));
|
||||
shadowScaleX = actor->shape.shadowScale * shadowScaleZ * actor->scale.x;
|
||||
|
||||
for (lightPtr = mapper->l.l, j = 0; j < numLights; lightPtr++, j++) {
|
||||
lightPtr = firstLight;
|
||||
for (j = 0; j < numLights; j++) {
|
||||
if (lightPtr->l.dir[1] > 0) {
|
||||
lightNum = (lightPtr->l.col[0] + lightPtr->l.col[1] + lightPtr->l.col[2]) *
|
||||
ABS_ALT(lightPtr->l.dir[1]);
|
||||
@@ -263,9 +262,10 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* mapper, GlobalContext* globalCtx
|
||||
shadowScaleZ);
|
||||
}
|
||||
}
|
||||
lightPtr++;
|
||||
}
|
||||
|
||||
for (j = 0; j < 2; lightPtr++, j++) {
|
||||
for (j = 0; j < 2; j++) {
|
||||
if (lightPtr->l.dir[1] > 0) {
|
||||
lightNum = ((lightPtr->l.col[0] + lightPtr->l.col[1] + lightPtr->l.col[2]) *
|
||||
ABS_ALT(lightPtr->l.dir[1])) -
|
||||
@@ -275,6 +275,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* mapper, GlobalContext* globalCtx
|
||||
shadowScaleZ);
|
||||
}
|
||||
}
|
||||
lightPtr++;
|
||||
}
|
||||
}
|
||||
feetPosPtr++;
|
||||
|
||||
+5
-9
@@ -132,7 +132,6 @@ void Cutscene_Command_Misc(GlobalContext* globalCtx2, CutsceneContext* csCtx, Cs
|
||||
u8 isStartFrame = false;
|
||||
f32 progress;
|
||||
SceneTableEntry* loadedScene;
|
||||
u16 time;
|
||||
|
||||
if ((csCtx->frames < cmd->startFrame) || ((csCtx->frames >= cmd->endFrame) && (cmd->endFrame != cmd->startFrame))) {
|
||||
return;
|
||||
@@ -250,11 +249,9 @@ void Cutscene_Command_Misc(GlobalContext* globalCtx2, CutsceneContext* csCtx, Cs
|
||||
break;
|
||||
case 0x12:
|
||||
if (!gSaveContext.save.isNight) {
|
||||
time = gSaveContext.save.time;
|
||||
gSaveContext.save.time = time - (u16)REG(15);
|
||||
gSaveContext.save.time = ((void)0, gSaveContext.save.time) - (u16)REG(15);
|
||||
} else {
|
||||
time = gSaveContext.save.time;
|
||||
gSaveContext.save.time = time - (u16)(2 * REG(15));
|
||||
gSaveContext.save.time = ((void)0, gSaveContext.save.time) - (u16)(2 * REG(15));
|
||||
}
|
||||
break;
|
||||
case 0x13:
|
||||
@@ -328,10 +325,9 @@ void Cutscene_Command_Misc(GlobalContext* globalCtx2, CutsceneContext* csCtx, Cs
|
||||
D_801BB15C = csCtx->frames;
|
||||
|
||||
if (REG(15) != 0) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -815,8 +815,6 @@ void EnItem00_DrawHeartPiece(EnItem00* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
s16 func_800A7650(s16 dropId) {
|
||||
s16 healthCapacity;
|
||||
|
||||
if ((((dropId == ITEM00_BOMBS_A) || (dropId == ITEM00_BOMBS_0) || (dropId == ITEM00_BOMBS_B)) &&
|
||||
(INV_CONTENT(ITEM_BOMB) == ITEM_NONE)) ||
|
||||
(((dropId == ITEM00_ARROWS_10) || (dropId == ITEM00_ARROWS_30) || (dropId == ITEM00_ARROWS_40) ||
|
||||
@@ -828,8 +826,7 @@ s16 func_800A7650(s16 dropId) {
|
||||
}
|
||||
|
||||
if (dropId == ITEM00_HEART) {
|
||||
healthCapacity = gSaveContext.save.playerData.healthCapacity;
|
||||
if (healthCapacity == gSaveContext.save.playerData.health) {
|
||||
if (((void)0, gSaveContext.save.playerData.healthCapacity) == ((void)0, gSaveContext.save.playerData.health)) {
|
||||
return ITEM00_RUPEE_GREEN;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -405,23 +405,23 @@ void func_80151BB4(GlobalContext* globalCtx, u8 arg1) {
|
||||
|
||||
u32 func_80151C9C(GlobalContext* globalCtx) {
|
||||
MessageContext* msgCtx = &globalCtx->msgCtx;
|
||||
u8 flag;
|
||||
|
||||
while (true) {
|
||||
if (msgCtx->unk120B1 == 0) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
msgCtx->unk120B1--;
|
||||
|
||||
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);
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,29 +193,32 @@ void Message_LoadTimeNES(GlobalContext* globalCtx, u8 arg1, s32* offset, f32* ar
|
||||
s16 p = *decodedBufPos;
|
||||
s32 o = *offset;
|
||||
f32 f = *arg3;
|
||||
u32 dayTime;
|
||||
u32 timeLeft;
|
||||
s16 digits[4];
|
||||
f32 timeInMinutes;
|
||||
s32 day;
|
||||
f32 timeLeftInMinutes;
|
||||
s16 i;
|
||||
|
||||
if (arg1 == 0xCF) {
|
||||
day = gSaveContext.save.day;
|
||||
dayTime = 0x40000 - ((day % 5) << 16) - (u16)(-0x4000 + gSaveContext.save.time);
|
||||
// Calculates the time left before the moon crashes.
|
||||
// The day begins at CLOCK_TIME(6, 0) so it must be offset.
|
||||
timeLeft = (4 - CURRENT_DAY) * DAY_LENGTH - (u16)(((void)0, gSaveContext.save.time) - CLOCK_TIME(6, 0));
|
||||
} else {
|
||||
dayTime = 0x10000 - (u16)(-0x4000 + gSaveContext.save.time);
|
||||
// Calculates the time left before a new day.
|
||||
// The day begins at CLOCK_TIME(6, 0) so it must be offset.
|
||||
timeLeft = DAY_LENGTH - (u16)(((void)0, gSaveContext.save.time) - CLOCK_TIME(6, 0));
|
||||
}
|
||||
timeInMinutes = TIME_TO_MINUTES_F(dayTime);
|
||||
|
||||
timeLeftInMinutes = TIME_TO_MINUTES_F(timeLeft);
|
||||
|
||||
digits[0] = 0;
|
||||
digits[1] = (timeInMinutes / 60.0f);
|
||||
digits[1] = (timeLeftInMinutes / 60.0f);
|
||||
while (digits[1] >= 10) {
|
||||
digits[0]++;
|
||||
digits[1] -= 10;
|
||||
}
|
||||
|
||||
digits[2] = 0;
|
||||
digits[3] = (s32)timeInMinutes % 60;
|
||||
digits[3] = (s32)timeLeftInMinutes % 60;
|
||||
while (digits[3] >= 10) {
|
||||
digits[2]++;
|
||||
digits[3] -= 10;
|
||||
|
||||
+6
-14
@@ -142,11 +142,9 @@ void* func_8012F73C(ObjectContext* objectCtx, s32 iParm2, s16 id) {
|
||||
|
||||
// SceneTableEntry Header Command 0x00: Spawn List
|
||||
void Scene_HeaderCmdSpawnList(GlobalContext* globalCtx, SceneCmd* cmd) {
|
||||
GlobalContext* globalCtx2 = globalCtx;
|
||||
s32 loadedCount;
|
||||
void* nextObject;
|
||||
s16 playerObjectId;
|
||||
u8 playerForm;
|
||||
void* nextObject;
|
||||
|
||||
globalCtx->linkActorEntry = (ActorEntry*)Lib_SegmentedToVirtual(cmd->spawnList.segment) +
|
||||
globalCtx->setupEntranceList[globalCtx->curSpawn].spawn;
|
||||
@@ -158,11 +156,10 @@ void Scene_HeaderCmdSpawnList(GlobalContext* globalCtx, SceneCmd* cmd) {
|
||||
}
|
||||
|
||||
loadedCount = Object_Spawn(&globalCtx->objectCtx, OBJECT_LINK_CHILD);
|
||||
nextObject = globalCtx2->objectCtx.status[globalCtx2->objectCtx.num].segment;
|
||||
nextObject = globalCtx->objectCtx.status[globalCtx->objectCtx.num].segment;
|
||||
globalCtx->objectCtx.num = loadedCount;
|
||||
globalCtx->objectCtx.spawnedObjectCount = loadedCount;
|
||||
playerForm = gSaveContext.save.playerForm;
|
||||
playerObjectId = gLinkFormObjectIndexes[playerForm];
|
||||
playerObjectId = gLinkFormObjectIndexes[(void)0, gSaveContext.save.playerForm];
|
||||
gActorOverlayTable[0].initInfo->objectId = playerObjectId;
|
||||
Object_Spawn(&globalCtx->objectCtx, playerObjectId);
|
||||
|
||||
@@ -378,8 +375,6 @@ void Scene_HeaderCmdSkyboxDisables(GlobalContext* globalCtx, SceneCmd* cmd) {
|
||||
|
||||
// SceneTableEntry Header Command 0x10: Time Settings
|
||||
void Scene_HeaderCmdTimeSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
|
||||
u32 dayTime;
|
||||
|
||||
if (cmd->timeSettings.hour != 0xFF && cmd->timeSettings.min != 0xFF) {
|
||||
gSaveContext.environmentTime = gSaveContext.save.time =
|
||||
(u16)(((cmd->timeSettings.hour + (cmd->timeSettings.min / 60.0f)) * 60.0f) / 0.021972656f);
|
||||
@@ -399,12 +394,9 @@ void Scene_HeaderCmdTimeSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
|
||||
REG(15) = globalCtx->envCtx.timeIncrement;
|
||||
}
|
||||
|
||||
dayTime = gSaveContext.save.time;
|
||||
globalCtx->envCtx.unk_4 = -(Math_SinS(dayTime - 0x8000) * 120.0f) * 25.0f;
|
||||
dayTime = gSaveContext.save.time;
|
||||
globalCtx->envCtx.unk_8 = (Math_CosS(dayTime - 0x8000) * 120.0f) * 25.0f;
|
||||
dayTime = gSaveContext.save.time;
|
||||
globalCtx->envCtx.unk_C = (Math_CosS(dayTime - 0x8000) * 20.0f) * 25.0f;
|
||||
globalCtx->envCtx.unk_4 = -(Math_SinS(((void)0, gSaveContext.save.time) - 0x8000) * 120.0f) * 25.0f;
|
||||
globalCtx->envCtx.unk_8 = (Math_CosS(((void)0, gSaveContext.save.time) - 0x8000) * 120.0f) * 25.0f;
|
||||
globalCtx->envCtx.unk_C = (Math_CosS(((void)0, gSaveContext.save.time) - 0x8000) * 20.0f) * 25.0f;
|
||||
|
||||
if (globalCtx->envCtx.timeIncrement == 0 && gSaveContext.save.cutscene < 0xFFF0) {
|
||||
gSaveContext.environmentTime = gSaveContext.save.time;
|
||||
|
||||
@@ -82,17 +82,12 @@ void BgCtowerRot_CorridorRotate(BgCtowerRot* this, GlobalContext* globalCtx) {
|
||||
Player* player = GET_PLAYER(globalCtx);
|
||||
Vec3f offset;
|
||||
f32 rotZ;
|
||||
f32 rotZtmp;
|
||||
|
||||
Actor_OffsetOfPointInActorCoords(&this->dyna.actor, &offset, &player->actor.world.pos);
|
||||
if (offset.z > 1100.0f) {
|
||||
rotZ = 0.0f;
|
||||
} else {
|
||||
rotZtmp = CLAMP_MAX(1100.0f - offset.z, 1000.0f);
|
||||
rotZ = rotZtmp;
|
||||
}
|
||||
rotZ = CLAMP(1100.0f - offset.z, 0.0f, 1000.0f);
|
||||
func_800DFAC8(globalCtx->cameraPtrs[CAM_ID_MAIN], 17);
|
||||
this->dyna.actor.shape.rot.z = rotZ * 16.384f;
|
||||
|
||||
if (globalCtx->csCtx.frames == 132) {
|
||||
play_sound(NA_SE_SY_SPIRAL_DASH);
|
||||
}
|
||||
|
||||
@@ -522,7 +522,7 @@ void Boss06_Draw(Actor* thisx, GlobalContext* globalCtx2) {
|
||||
|
||||
temp_v0 = gSaveContext.save.time;
|
||||
if (temp_v0 > CLOCK_TIME(12, 0)) {
|
||||
temp_v0 = 0xFFFF - temp_v0;
|
||||
temp_v0 = (DAY_LENGTH - 1) - temp_v0;
|
||||
}
|
||||
sp68 = (f32)temp_v0 / 0x8000;
|
||||
spD3 = ((10.0f * sp68) + 105.0f) * this->unk_19C;
|
||||
|
||||
@@ -29,9 +29,10 @@ const ActorInit Dm_Ravine_InitVars = {
|
||||
};
|
||||
|
||||
void DmRavine_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
DmRavine* this = THIS;
|
||||
u8 flag = gSaveContext.save.weekEventReg[0];
|
||||
if (((flag & 0x10) | cREG(0)) != 0) {
|
||||
|
||||
if (((((void)0, gSaveContext.save.weekEventReg[0]) & 0x10) | cREG(0)) != 0) {
|
||||
Actor_MarkForDeath(&this->actor);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -570,9 +570,7 @@ void func_808A1884(DoorShutter* this, GlobalContext* globalCtx) {
|
||||
if (DoorShutter_SetupDoor(this, globalCtx) && !(player->stateFlags1 & 0x800)) {
|
||||
DoorShutter_SetupAction(this, func_808A1C50);
|
||||
if (ActorCutscene_GetCurrentIndex() == 0x7D) {
|
||||
s8 data = gSaveContext.respawn[RESTART_MODE_DOWN].data;
|
||||
|
||||
func_801226E0(globalCtx, data);
|
||||
func_801226E0(globalCtx, ((void)0, gSaveContext.respawn[RESTART_MODE_DOWN].data));
|
||||
player->unk_A86 = -1;
|
||||
func_800B7298(globalCtx, NULL, 0x73);
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
@@ -882,8 +879,8 @@ void func_809C2F34(EnAob01* this, GlobalContext* globalCtx) {
|
||||
|
||||
void func_809C2FA0(void) {
|
||||
u8 i;
|
||||
u8 idx;
|
||||
u8 idx2;
|
||||
u8 rand;
|
||||
u8 index;
|
||||
u8 orig;
|
||||
u8 orig2;
|
||||
u8 sp44[7];
|
||||
@@ -892,11 +889,11 @@ void func_809C2FA0(void) {
|
||||
};
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sp34); i++) {
|
||||
idx = Rand_ZeroFloat(14.0f);
|
||||
rand = Rand_ZeroFloat(14.0f);
|
||||
orig = sp34[i];
|
||||
|
||||
sp34[i] = sp34[idx];
|
||||
sp34[idx] = orig;
|
||||
sp34[i] = sp34[rand];
|
||||
sp34[rand] = orig;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sp44); i++) {
|
||||
@@ -906,14 +903,14 @@ void func_809C2FA0(void) {
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sp34); i++) {
|
||||
orig2 = sp34[i];
|
||||
idx2 = i / 2;
|
||||
index = i / 2;
|
||||
|
||||
if (i % 2) {
|
||||
sp44[idx2] |= orig2 << 0x4;
|
||||
idx = gSaveContext.save.weekEventReg[42 + idx2];
|
||||
gSaveContext.save.weekEventReg[42 + idx2] = idx | sp44[idx2];
|
||||
sp44[index] |= orig2 << 0x4;
|
||||
gSaveContext.save.weekEventReg[42 + index] =
|
||||
((void)0, gSaveContext.save.weekEventReg[42 + index]) | sp44[index];
|
||||
} else {
|
||||
sp44[idx2] |= orig2;
|
||||
sp44[index] |= orig2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,8 +116,7 @@ void func_809CCEE8(EnBji01* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void func_809CD028(EnBji01* this, GlobalContext* globalCtx) {
|
||||
s32 tempDay;
|
||||
f32 tempTimeBeforeMoonCrash;
|
||||
f32 timeBeforeMoonCrash;
|
||||
|
||||
switch (this->actor.params) {
|
||||
case ENBJI01_PARAMS_DEFAULT:
|
||||
@@ -180,10 +179,11 @@ void func_809CD028(EnBji01* this, GlobalContext* globalCtx) {
|
||||
this->textId = 0x5EA;
|
||||
break;
|
||||
case 3:
|
||||
tempDay = gSaveContext.save.day;
|
||||
tempTimeBeforeMoonCrash =
|
||||
((-(tempDay % 5 << 0x10) - ((u16)(gSaveContext.save.time - 0x4000))) + 0x40000);
|
||||
if (tempTimeBeforeMoonCrash < CLOCK_TIME_F(1, 0)) { /* 1 hr */
|
||||
// Calculates the time left before the moon crashes.
|
||||
// The day begins at CLOCK_TIME(6, 0) so it must be offset.
|
||||
timeBeforeMoonCrash = (4 - CURRENT_DAY) * DAY_LENGTH -
|
||||
(u16)(((void)0, gSaveContext.save.time) - CLOCK_TIME(6, 0));
|
||||
if (timeBeforeMoonCrash < CLOCK_TIME_F(1, 0)) {
|
||||
this->textId = 0x5E8;
|
||||
} else {
|
||||
this->textId = 0x5EB;
|
||||
@@ -207,7 +207,7 @@ void EnBji01_DialogueHandler(EnBji01* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (Message_ShouldAdvance(globalCtx) != 0) {
|
||||
if (Message_ShouldAdvance(globalCtx)) {
|
||||
this->actor.flags &= ~ACTOR_FLAG_10000;
|
||||
this->actor.params = ENBJI01_PARAMS_FINISHED_CONVERSATION;
|
||||
switch (globalCtx->msgCtx.choiceIndex) {
|
||||
@@ -235,7 +235,7 @@ void EnBji01_DialogueHandler(EnBji01* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if (Message_ShouldAdvance(globalCtx) != 0) {
|
||||
if (Message_ShouldAdvance(globalCtx)) {
|
||||
this->actor.flags &= ~ACTOR_FLAG_10000;
|
||||
switch (globalCtx->msgCtx.currentTextId) {
|
||||
case 0x5DE:
|
||||
|
||||
@@ -675,14 +675,14 @@ void func_808726DC(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, Vec3f* ar
|
||||
f32 temp_f26 = Math_Vec3f_DistXYZ(arg3, arg1);
|
||||
s32 spB0;
|
||||
f32 temp_f2;
|
||||
f32 sqrt;
|
||||
f32 distXZ;
|
||||
|
||||
Math_Vec3f_Copy(&ptr->unk_00, arg1);
|
||||
Math_Vec3f_Diff(arg2, arg1, &spCC);
|
||||
|
||||
ptr->unk_18 = Math_FAtan2F(spCC.z, spCC.x);
|
||||
sqrt = sqrtf(SQ(spCC.x) + SQ(spCC.z));
|
||||
ptr->unk_1A = Math_FAtan2F(sqrt, spCC.y);
|
||||
distXZ = sqrtf(SQXZ(spCC));
|
||||
ptr->unk_1A = Math_FAtan2F(distXZ, spCC.y);
|
||||
|
||||
spB0 = (arg4 / 240) + 1;
|
||||
|
||||
@@ -721,8 +721,8 @@ void func_808726DC(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, Vec3f* ar
|
||||
}
|
||||
|
||||
ptr2->unk_18 = Math_FAtan2F(spCC.z, spCC.x);
|
||||
sqrt = sqrtf(SQ(spCC.x) + SQ(spCC.z));
|
||||
ptr2->unk_1A = Math_FAtan2F(sqrt, spCC.y);
|
||||
distXZ = sqrtf(SQXZ(spCC));
|
||||
ptr2->unk_1A = Math_FAtan2F(distXZ, spCC.y);
|
||||
|
||||
ptr2->unk_18 = (s16)CLAMP(BINANG_SUB(ptr2->unk_18, ptr->unk_18), -8000, 8000) + ptr->unk_18;
|
||||
ptr2->unk_1A = (s16)CLAMP(BINANG_SUB(ptr2->unk_1A, ptr->unk_1A), -8000, 8000) + ptr->unk_1A;
|
||||
|
||||
@@ -656,7 +656,6 @@ void func_80C02740(EnBomjimb* this, GlobalContext* globalCtx) {
|
||||
0x0721, 0x0722, 0x0723, 0x0724, 0x072C,
|
||||
};
|
||||
Player* player = GET_PLAYER(globalCtx);
|
||||
s16 idx;
|
||||
|
||||
func_80C012E0(this);
|
||||
func_80C0113C(this, 21, 1.0f);
|
||||
@@ -683,10 +682,8 @@ void func_80C02740(EnBomjimb* this, GlobalContext* globalCtx) {
|
||||
return;
|
||||
}
|
||||
|
||||
idx = gSaveContext.save.bombersCaughtNum;
|
||||
Message_StartTextbox(globalCtx, D_80C03230[idx], &this->actor);
|
||||
idx = gSaveContext.save.bombersCaughtNum;
|
||||
gSaveContext.save.bombersCaughtOrder[idx] = this->unk_2C8 + 1;
|
||||
Message_StartTextbox(globalCtx, D_80C03230[((void)0, gSaveContext.save.bombersCaughtNum)], &this->actor);
|
||||
gSaveContext.save.bombersCaughtOrder[((void)0, gSaveContext.save.bombersCaughtNum)] = this->unk_2C8 + 1;
|
||||
gSaveContext.save.bombersCaughtNum++;
|
||||
|
||||
if (gSaveContext.save.bombersCaughtNum > 4) {
|
||||
|
||||
@@ -177,14 +177,11 @@ void EnElfgrp_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
s32 func_80A39BD0(GlobalContext* globalCtx, s32 arg2) {
|
||||
s8 sp1F;
|
||||
|
||||
if ((arg2 < 1) || (arg2 >= 5)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
sp1F = gSaveContext.save.inventory.strayFairies[arg2 - 1];
|
||||
return (sp1F - func_80A39C1C(globalCtx, arg2)) + 10;
|
||||
return (((void)0, gSaveContext.save.inventory.strayFairies[arg2 - 1]) - func_80A39C1C(globalCtx, arg2)) + 10;
|
||||
}
|
||||
|
||||
s32 func_80A39C1C(GlobalContext* globalCtx, s32 arg1) {
|
||||
|
||||
@@ -1069,7 +1069,7 @@ void EnFishing_UpdateEffects(FishingEffect* effect, GlobalContext* globalCtx) {
|
||||
}
|
||||
} else if (effect->type == FS_EFF_RAIN_DROP) {
|
||||
if (effect->pos.y < WATER_SURFACE_Y(globalCtx)) {
|
||||
f32 sqDistXZ = SQ(effect->pos.x) + SQ(effect->pos.z);
|
||||
f32 sqDistXZ = SQXZ(effect->pos);
|
||||
|
||||
if (sqDistXZ > SQ(920.0f)) {
|
||||
effect->pos.y = WATER_SURFACE_Y(globalCtx) + ((sqrtf(sqDistXZ) - 920.0f) * 0.11f);
|
||||
@@ -1106,7 +1106,7 @@ void EnFishing_UpdateEffects(FishingEffect* effect, GlobalContext* globalCtx) {
|
||||
Math_ApproachS(&sEffOwnerHatRot.x, 0, 20, 100);
|
||||
Math_ApproachS(&sEffOwnerHatRot.z, -0x4000, 20, 100);
|
||||
|
||||
sqDistXZ = SQ(effect->pos.x) + SQ(effect->pos.z);
|
||||
sqDistXZ = SQXZ(effect->pos);
|
||||
bottomY = WATER_SURFACE_Y(globalCtx) + ((sqrtf(sqDistXZ) - 920.0f) * 0.147f);
|
||||
|
||||
if (effect->pos.y > (bottomY - 10.0f)) {
|
||||
@@ -5188,7 +5188,7 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) {
|
||||
|
||||
spFC.x = sLurePos.x - player->actor.world.pos.x;
|
||||
spFC.z = sLurePos.z - player->actor.world.pos.z;
|
||||
lureDistXZ = sqrtf(SQ(spFC.x) + SQ(spFC.z));
|
||||
lureDistXZ = sqrtf(SQXZ(spFC));
|
||||
Matrix_InsertYRotation_f(Math_Acot2F(spFC.z, spFC.x), MTXMODE_NEW);
|
||||
|
||||
sp114.x = 0.0f;
|
||||
|
||||
@@ -713,15 +713,13 @@ void func_808D2040(EnFloormas* this, GlobalContext* globalCtx) {
|
||||
|
||||
void func_808D217C(EnFloormas* this, Player* player) {
|
||||
Vec3f* ptr;
|
||||
u8 playerForm;
|
||||
|
||||
Animation_Change(&this->skelAnime, &gWallmasterJumpAnim, 1.0f, 36.0f, 45.0f, ANIMMODE_ONCE, -3.0f);
|
||||
this->actor.flags &= ~ACTOR_FLAG_1;
|
||||
this->actor.speedXZ = 0.0f;
|
||||
this->actor.velocity.y = 0.0f;
|
||||
func_808D08D0(this);
|
||||
playerForm = gSaveContext.save.playerForm;
|
||||
ptr = &D_808D3900[playerForm];
|
||||
ptr = &D_808D3900[(void)0, gSaveContext.save.playerForm];
|
||||
this->actor.home.pos.x = ptr->z * Math_SinS(this->actor.shape.rot.y);
|
||||
this->actor.home.pos.y = CLAMP(-this->actor.playerHeightRel, ptr->x, ptr->y);
|
||||
this->actor.home.pos.z = ptr->z * Math_CosS(this->actor.shape.rot.y);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user