diff --git a/assets/xml/scenes/overworld/spot02.xml b/assets/xml/scenes/overworld/spot02.xml index 3d1049b4ee..334d0e5991 100644 --- a/assets/xml/scenes/overworld/spot02.xml +++ b/assets/xml/scenes/overworld/spot02.xml @@ -2,8 +2,7 @@ - - + diff --git a/assets/xml/scenes/overworld/spot05.xml b/assets/xml/scenes/overworld/spot05.xml index 77d323989d..b34df91e91 100644 --- a/assets/xml/scenes/overworld/spot05.xml +++ b/assets/xml/scenes/overworld/spot05.xml @@ -2,8 +2,7 @@ - - + diff --git a/assets/xml/textures/place_title_cards.xml b/assets/xml/textures/place_title_cards.xml index 13bd2da90d..c1771d4c8e 100644 --- a/assets/xml/textures/place_title_cards.xml +++ b/assets/xml/textures/place_title_cards.xml @@ -1,5 +1,5 @@ - + @@ -64,7 +64,7 @@ - + diff --git a/docs/tutorial/other_functions.md b/docs/tutorial/other_functions.md index e07b603c27..1ee495748c 100644 --- a/docs/tutorial/other_functions.md +++ b/docs/tutorial/other_functions.md @@ -154,7 +154,7 @@ typedef struct EnJj { } EnJj; // size = 0x0314 ``` -We can eliminate the temp since it's use in a simple way one after the other. `this->unk308 = (s16) (this->unk308 - 0x66);` can be written as `this->unk308 -= 0x66;`. +We can eliminate the temp since it's used in a simple way one after the other. `this->unk308 = (s16) (this->unk308 - 0x66);` can be written as `this->unk308 -= 0x66;`. In the `func_8003EBF8` we see that we should have at least made `this->childActor` a `DynaPolyActor*`, so that the last argument is its `bgId`. To avoid compiler warnings, we also need to cast the `Actor_SpawnAsChild` as such in Init, ```C diff --git a/include/command_macros_base.h b/include/command_macros_base.h index 3f1a1a0d0f..6fa0e86385 100644 --- a/include/command_macros_base.h +++ b/include/command_macros_base.h @@ -3,7 +3,7 @@ /** * Command Base macros intended for use in designing of more specific command macros - * Each macro packs bytes (B), halfowrds (H) and words (W, for consistency) into a single word + * Each macro packs bytes (B), halfwords (H) and words (W, for consistency) into a single word */ #define CMD_BBBB(a, b, c, d) (_SHIFTL(a, 24, 8) | _SHIFTL(b, 16, 8) | _SHIFTL(c, 8, 8) | _SHIFTL(d, 0, 8)) diff --git a/include/macros.h b/include/macros.h index 013a820ade..4173fdee7d 100644 --- a/include/macros.h +++ b/include/macros.h @@ -21,9 +21,11 @@ #define CLAMP(x, min, max) ((x) < (min) ? (min) : (x) > (max) ? (max) : (x)) #define CLAMP_MAX(x, max) ((x) > (max) ? (max) : (x)) #define CLAMP_MIN(x, min) ((x) < (min) ? (min) : (x)) -#define MEDIAN3(a1, a2, a3) ((a2 >= a1) ? ((a3 >= a2) ? a2 : ((a1 >= a3) ? a1 : a3)) : ((a2 >= a3) ? a2 : ((a3 >= a1) ? a1 : a3))) +#define MEDIAN3(a1, a2, a3) \ + (((a2) >= (a1)) ? (((a3) >= (a2)) ? (a2) : (((a1) >= (a3)) ? (a1) : (a3))) \ + : (((a2) >= (a3)) ? (a2) : (((a3) >= (a1)) ? (a1) : (a3)))) -#define RGBA8(r, g, b, a) (((r & 0xFF) << 24) | ((g & 0xFF) << 16) | ((b & 0xFF) << 8) | ((a & 0xFF) << 0)) +#define RGBA8(r, g, b, a) ((((r) & 0xFF) << 24) | (((g) & 0xFF) << 16) | (((b) & 0xFF) << 8) | (((a) & 0xFF) << 0)) #define GET_PLAYER(globalCtx) ((Player*)(globalCtx)->actorCtx.actorLists[ACTORCAT_PLAYER].head) @@ -68,8 +70,8 @@ ? ITEM_SWORD_BGS \ : gSaveContext.equips.buttonItems[0]) -#define C_BTN_ITEM(button) ((gSaveContext.buttonStatus[button + 1] != BTN_DISABLED) \ - ? gSaveContext.equips.buttonItems[button + 1] \ +#define C_BTN_ITEM(button) ((gSaveContext.buttonStatus[(button) + 1] != BTN_DISABLED) \ + ? gSaveContext.equips.buttonItems[(button) + 1] \ : ITEM_NONE) #define CHECK_BTN_ALL(state, combo) (~((state) | ~(combo)) == 0) diff --git a/include/z64.h b/include/z64.h index 14bb67b80e..0357e0d2b2 100644 --- a/include/z64.h +++ b/include/z64.h @@ -1337,24 +1337,24 @@ typedef struct { } EntranceInfo; // size = 0x4 typedef struct { - /* 0x00 */ void* loadedRamAddr; - /* 0x04 */ u32 vromStart; // if applicable - /* 0x08 */ u32 vromEnd; // if applicable - /* 0x0C */ void* vramStart; // if applicable - /* 0x10 */ void* vramEnd; // if applicable - /* 0x14 */ UNK_PTR unk_14; - /* 0x18 */ void* init; // initializes and executes the given context - /* 0x1C */ void* destroy; // deconstructs the context, and sets the next context to load - /* 0x20 */ UNK_PTR unk_20; - /* 0x24 */ UNK_PTR unk_24; - /* 0x28 */ UNK_TYPE unk_28; - /* 0x2C */ u32 instanceSize; + /* 0x00 */ void* loadedRamAddr; + /* 0x04 */ u32 vromStart; // if applicable + /* 0x08 */ u32 vromEnd; // if applicable + /* 0x0C */ void* vramStart; // if applicable + /* 0x10 */ void* vramEnd; // if applicable + /* 0x14 */ UNK_PTR unk_14; + /* 0x18 */ void* init; // initializes and executes the given context + /* 0x1C */ void* destroy; // deconstructs the context, and sets the next context to load + /* 0x20 */ UNK_PTR unk_20; + /* 0x24 */ UNK_PTR unk_24; + /* 0x28 */ UNK_TYPE4 unk_28; + /* 0x2C */ u32 instanceSize; } GameStateOverlay; // size = 0x30 typedef struct PreNMIContext { /* 0x00 */ GameState state; - /* 0xA4 */ u32 timer; - /* 0xA8 */ UNK_TYPE unk_A8; + /* 0xA4 */ u32 timer; + /* 0xA8 */ UNK_TYPE4 unk_A8; } PreNMIContext; // size = 0xAC typedef enum { @@ -1669,11 +1669,11 @@ typedef struct { /* 0x0234 */ OSScTask* curRDPTask; /* 0x0238 */ s32 retraceCnt; /* 0x023C */ s32 doAudio; - /* 0x0240 */ CfbInfo* curBuf; - /* 0x0244 */ CfbInfo* pendingSwapBuf1; - /* 0x0220 */ CfbInfo* pendingSwapBuf2; - /* 0x0220 */ UNK_TYPE unk_24C; - /* 0x0250 */ IrqMgrClient irqClient; + /* 0x0240 */ CfbInfo* curBuf; + /* 0x0244 */ CfbInfo* pendingSwapBuf1; + /* 0x0220 */ CfbInfo* pendingSwapBuf2; + /* 0x0220 */ UNK_TYPE4 unk_24C; + /* 0x0250 */ IrqMgrClient irqClient; } SchedContext; // size = 0x258 // ======================== @@ -1833,7 +1833,7 @@ typedef struct { /* 0x50 */ u8* symbols; } JpegHuffmanTable; // size = 0x54 -// this struct might be unaccurate but it's not used outside jpegutils.c anyways +// this struct might be inaccurate but it's not used outside jpegutils.c anyways typedef struct { /* 0x000 */ u8 codeOffs[16]; /* 0x010 */ u16 dcCodes[120]; diff --git a/include/z64animation.h b/include/z64animation.h index 25363a5034..ceb2dfcdaf 100755 --- a/include/z64animation.h +++ b/include/z64animation.h @@ -91,7 +91,7 @@ typedef struct { typedef struct { /* 0x00 */ AnimationHeaderCommon common; - /* 0x04 */ s16* frameData; // "tbl" + /* 0x04 */ s16* frameData; // "tbl" /* 0x08 */ JointIndex* jointIndices; // "ref_tbl" /* 0x0C */ u16 staticIndexMax; } AnimationHeader; // size = 0x10 @@ -265,7 +265,7 @@ typedef struct SkelAnime { /* 0x2C */ f32 morphRate; // Reciprocal of the number of frames in the morph /* 0x30 */ s32 (*update)(); // Can be Loop, Partial loop, Play once, Morph, or Tapered morph. Link only has Loop, Play once, and Morph /* 0x34 */ s8 initFlags; // Flags used when initializing Link's skeleton - /* 0x35 */ u8 moveFlags; // Flags used for animations that move the actor in worldspace. + /* 0x35 */ u8 moveFlags; // Flags used for animations that move the actor in worldspace. /* 0x36 */ s16 prevRot; // Previous rotation in worldspace. /* 0x38 */ Vec3s prevTransl; // Previous modelspace translation. /* 0x3E */ Vec3s baseTransl; // Base modelspace translation. diff --git a/src/boot/logutils.c b/src/boot/logutils.c index 27aafa1df7..c272d808c9 100644 --- a/src/boot/logutils.c +++ b/src/boot/logutils.c @@ -54,6 +54,7 @@ void LogUtils_LogHexDump(void* ptr, s32 size0) { while (true) { if (i < rest) { u8 a = *(addr + i); + osSyncPrintf("%c", (a >= 0x20 && a < 0x7F) ? a : '.'); } else { osSyncPrintf(" "); @@ -77,6 +78,7 @@ void LogUtils_LogPointer(s32 value, u32 max, void* ptr, const char* name, const void LogUtils_CheckBoundary(const char* name, s32 value, s32 unk, const char* file, s32 line) { u32 mask = (unk - 1); + if (value & mask) { osSyncPrintf(VT_COL(RED, WHITE) "%s %d:%s(%08x) は バウンダリ(%d)違反です\n" VT_RST, file, line, name, value, unk); diff --git a/src/boot/stackcheck.c b/src/boot/stackcheck.c index 51cbfd1e73..8451566787 100644 --- a/src/boot/stackcheck.c +++ b/src/boot/stackcheck.c @@ -115,6 +115,7 @@ u32 StackCheck_CheckAll(void) { while (iter) { u32 state = StackCheck_GetState(iter); + if (state != STACK_STATUS_OK) { ret = 1; } diff --git a/src/code/PreRender.c b/src/code/PreRender.c index 74a95e4e83..8491904431 100644 --- a/src/code/PreRender.c +++ b/src/code/PreRender.c @@ -548,6 +548,7 @@ void PreRender_Calc(PreRender* this) { for (y = 0; y < this->height; y++) { for (x = 0; x < this->width; x++) { s32 a = this->cvgSave[x + y * this->width]; + a >>= 5; a++; if (a != 8) { diff --git a/src/code/audio_heap.c b/src/code/audio_heap.c index 1ed73c81bf..d5f3fc1674 100644 --- a/src/code/audio_heap.c +++ b/src/code/audio_heap.c @@ -1276,6 +1276,7 @@ void AudioHeap_ChangeStorage(StorageChange* change, SoundFontSample* sample) { if (sample != NULL) { u32 start = change->oldAddr; u32 end = change->oldAddr + change->size; + if (start <= (u32)sample->sampleAddr && (u32)sample->sampleAddr < end) { sample->sampleAddr = sample->sampleAddr - start + change->newAddr; sample->medium = change->newMedium; diff --git a/src/code/audio_seqplayer.c b/src/code/audio_seqplayer.c index 547a957a9d..091cd97248 100644 --- a/src/code/audio_seqplayer.c +++ b/src/code/audio_seqplayer.c @@ -360,12 +360,14 @@ u8 AudioSeq_ScriptReadU8(SeqScriptState* state) { s16 AudioSeq_ScriptReadS16(SeqScriptState* state) { s16 ret = *(state->pc++) << 8; + ret = *(state->pc++) | ret; return ret; } u16 AudioSeq_ScriptReadCompressedU16(SeqScriptState* state) { u16 ret = *(state->pc++); + if (ret & 0x80) { ret = (ret << 8) & 0x7F00; ret = *(state->pc++) | ret; @@ -477,6 +479,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) { } if (cmd >= 0xF2) { u16 arg = AudioSeq_GetScriptControlFlowArgument(state, cmd); + if (AudioSeq_HandleScriptFlowControl(seqPlayer, state, cmd, arg) == 0) { continue; } @@ -489,6 +492,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) { case 0xCA: // layer_setpan { u8 tempByte = *(state->pc++); + if (cmd == 0xC1) { layer->velocitySquare = (f32)(tempByte * tempByte) / 16129.0f; } else { @@ -501,6 +505,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) { case 0xC2: // layer_transpose; set transposition in semitones { u8 tempByte = *(state->pc++); + if (cmd == 0xC9) { layer->gateTime = tempByte; } else { diff --git a/src/code/code_800EC960.c b/src/code/code_800EC960.c index 2088716d64..18c23f141d 100644 --- a/src/code/code_800EC960.c +++ b/src/code/code_800EC960.c @@ -1100,6 +1100,7 @@ void Audio_OcaPlayback(void) { if (sDisplayedNoteValue != sPlaybackSong[sPlaybackNotePos].noteIdx) { u8 tmp = sPlaybackSong[sPlaybackNotePos].noteIdx; + if (tmp == 0xA) { sDisplayedNoteValue = tmp + sPlaybackSong[sPlaybackNotePos].semitone; } else { diff --git a/src/code/code_800FCE80.c b/src/code/code_800FCE80.c index d81d4f91b9..500e2c01d5 100644 --- a/src/code/code_800FCE80.c +++ b/src/code/code_800FCE80.c @@ -6,6 +6,7 @@ s32 gUseAtanContFrac; f32 Math_FTanF(f32 x) { f32 sin = sinf(x); f32 cos = cosf(x); + return sin / cos; } diff --git a/src/code/code_800FD970.c b/src/code/code_800FD970.c index c89a086544..d1efcdc3aa 100644 --- a/src/code/code_800FD970.c +++ b/src/code/code_800FD970.c @@ -61,6 +61,7 @@ u32 Rand_Next_Variable(u32* rndNum) { */ f32 Rand_ZeroOne_Variable(u32* rndNum) { u32 next = (*rndNum * 1664525) + 1013904223; + // clang-format off *rndNum = next; sRandFloat = (next >> 9) | 0x3F800000; // clang-format on @@ -73,6 +74,7 @@ f32 Rand_ZeroOne_Variable(u32* rndNum) { */ f32 Rand_Centered_Variable(u32* rndNum) { u32 next = (*rndNum * 1664525) + 1013904223; + // clang-format off *rndNum = next; sRandFloat = (next >> 9) | 0x3F800000; // clang-format on diff --git a/src/code/db_camera.c b/src/code/db_camera.c index 51112b7817..f7e565af24 100644 --- a/src/code/db_camera.c +++ b/src/code/db_camera.c @@ -429,6 +429,7 @@ void DbCamera_PrintPoints(const char* name, s16 count, CutsceneCameraPoint* poin void DbCamera_PrintF32Bytes(f32 value) { f32 b = value; char* a = (char*)&b; + osSyncPrintf("\n@@@%d,%d,%d,%d,", a[0], a[1], a[2], a[3]); } @@ -436,6 +437,7 @@ void DbCamera_PrintU16Bytes(u16 value) { u16 pad; u16 b = value; char* a = (char*)&b; + osSyncPrintf("\n@@@%d,%d,", a[0], a[1]); } @@ -443,6 +445,7 @@ void DbCamera_PrintS16Bytes(s16 value) { u16 pad; s16 b = value; char* a = (char*)&b; + osSyncPrintf("\n@@@%d,%d,", a[0], a[1]); } diff --git a/src/code/fault_drawer.c b/src/code/fault_drawer.c index fd0bf02d3d..229200b15f 100644 --- a/src/code/fault_drawer.c +++ b/src/code/fault_drawer.c @@ -124,6 +124,7 @@ void FaultDrawer_DrawChar(char c) { ((sFaultDrawerStruct.charH + cursorY - 1) <= sFaultDrawerStruct.yEnd)) { for (y = 0; y < sFaultDrawerStruct.charH; y++) { u32 mask = 0x10000000 << shift; + data = *dataPtr; for (x = 0; x < sFaultDrawerStruct.charW; x++) { if (mask & data) { @@ -151,6 +152,7 @@ s32 FaultDrawer_ColorToPrintColor(u16 color) { void FaultDrawer_UpdatePrintColor() { s32 idx; + if (sFaultDrawerStruct.osSyncPrintfEnabled) { osSyncPrintf(VT_RST); idx = FaultDrawer_ColorToPrintColor(sFaultDrawerStruct.foreColor); diff --git a/src/code/graph.c b/src/code/graph.c index 80d6714af0..017d68fc04 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -170,7 +170,7 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx) { LogUtils_LogHexDump(gGfxSPTaskYieldBuffer, sizeof(gGfxSPTaskYieldBuffer)); SREG(6) = -1; - if (D_8012D260 != 0) { + if (D_8012D260 != NULL) { HREG(80) = 7; HREG(81) = 1; HREG(83) = 2; diff --git a/src/code/jpegdecoder.c b/src/code/jpegdecoder.c index 908fc675b8..5261264c7c 100644 --- a/src/code/jpegdecoder.c +++ b/src/code/jpegdecoder.c @@ -166,6 +166,7 @@ u16 JpegDecoder_ReadBits(u8 len) { u8 data; s32 ret; u32 temp; + ret = 0; // this is required for some reason for (byteCount = sJpegBitStreamBitIdx >> 3; byteCount > 0; byteCount--) { diff --git a/src/code/jpegutils.c b/src/code/jpegutils.c index e0c128cc10..00c0406096 100644 --- a/src/code/jpegutils.c +++ b/src/code/jpegutils.c @@ -5,6 +5,7 @@ void JpegUtils_ProcessQuantizationTable(u8* dqt, JpegQuantizationTable* qt, u8 c for (i = 0; i < count; i++) { u8 j; + dqt++; for (j = 0; j < 64; j++) { qt[i].table[j] = *dqt++; @@ -102,6 +103,7 @@ u32 JpegUtils_ProcessHuffmanTable(u8* dht, JpegHuffmanTable* ht, u8* codesLength for (idx = 0; idx < count; idx++) { u32 ac = (*dht++ >> 4); + codeCount = JpegUtils_ProcessHuffmanTableImpl(dht, &ht[idx], codesLengths, codes, ac); if (codeCount == 0) { return 1; diff --git a/src/code/mtxuty-cvt.c b/src/code/mtxuty-cvt.c index 78926efd06..18c7a36f3a 100644 --- a/src/code/mtxuty-cvt.c +++ b/src/code/mtxuty-cvt.c @@ -10,6 +10,7 @@ void MtxConv_F2L(Mtx* m1, MtxF* m2) { for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { s32 value = (m2->mf[i][j] * 0x10000); + m1->intPart[i][j] = value >> 16; m1->fracPart[i][j] = value; } diff --git a/src/code/ucode_disas.c b/src/code/ucode_disas.c index 9d5278f30e..aa0b7cf985 100644 --- a/src/code/ucode_disas.c +++ b/src/code/ucode_disas.c @@ -19,6 +19,7 @@ u32 UCodeDisas_TranslateAddr(UCodeDisas* this, u32 addr) { u32 physical = this->segments[SEGMENT_NUMBER(addr)] + SEGMENT_OFFSET(addr); + return PHYSICAL_TO_VIRTUAL(physical); } @@ -136,6 +137,7 @@ const char* UCodeDisas_ParseCombineAlpha(u32 value, u32 idx) { void UCodeDisas_Init(UCodeDisas* this) { u32 i; + bzero(this, sizeof(UCodeDisas)); for (i = 0; i < NUM_SEGMENTS; i++) { this->segments[i] = gSegments[i]; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index bca45d428c..81c973182a 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -1438,6 +1438,7 @@ f32 func_8002EFC0(Actor* actor, Player* player, s16 arg2) { } else { f32 ret = actor->xyzDistToPlayerSq - actor->xyzDistToPlayerSq * 0.8f * ((0x4000 - yawTempAbs) * (1.0f / 0x8000)); + return ret; } } @@ -2879,7 +2880,7 @@ void func_800328D4(GlobalContext* globalCtx, ActorContext* actorCtx, Player* pla Actor* actor; Actor* sp84; CollisionPoly* sp80; - UNK_TYPE sp7C; + s32 sp7C; Vec3f sp70; actor = actorCtx->actorLists[actorCategory].head; @@ -3236,7 +3237,7 @@ Actor* Actor_GetProjectileActor(GlobalContext* globalCtx, Actor* refActor, f32 r //! @bug The projectile actor gets unsafely casted to a hookshot to check its timer, even though // it can also be an arrow. // Luckily, the field at the same offset in the arrow actor is the x component of a vector - // which will rarely ever be 0. So its very unlikely for this bug to cause an issue. + // which will rarely ever be 0. So it's very unlikely for this bug to cause an issue. if ((Math_Vec3f_DistXYZ(&refActor->world.pos, &actor->world.pos) > radius) || (((ArmsHook*)actor)->timer == 0)) { actor = actor->next; @@ -3454,6 +3455,7 @@ void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, GlobalContext* globalCtx) void func_80033DB8(GlobalContext* globalCtx, s16 arg1, s16 arg2) { s16 var = Quake_Add(&globalCtx->mainCamera, 3); + Quake_SetSpeed(var, 20000); Quake_SetQuakeValues(var, arg1, 0, 0, 0); Quake_SetCountdown(var, arg2); @@ -3461,6 +3463,7 @@ void func_80033DB8(GlobalContext* globalCtx, s16 arg1, s16 arg2) { void func_80033E1C(GlobalContext* globalCtx, s16 arg1, s16 arg2, s16 arg3) { s16 var = Quake_Add(&globalCtx->mainCamera, 3); + Quake_SetSpeed(var, arg3); Quake_SetQuakeValues(var, arg1, 0, 0, 0); Quake_SetCountdown(var, arg2); diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 902abe956f..c2c4e2d4aa 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -1139,6 +1139,7 @@ void BgCheck_GetSubdivisionMinBounds(CollisionContext* colCtx, Vec3f* pos, s32* f32 dx = pos->x - colCtx->minBounds.x; f32 dy = pos->y - colCtx->minBounds.y; f32 dz = pos->z - colCtx->minBounds.z; + *sx = dx * colCtx->subdivLengthInv.x; *sy = dy * colCtx->subdivLengthInv.y; *sz = dz * colCtx->subdivLengthInv.z; @@ -1165,6 +1166,7 @@ void BgCheck_GetSubdivisionMaxBounds(CollisionContext* colCtx, Vec3f* pos, s32* f32 dx = pos->x - colCtx->minBounds.x; f32 dy = pos->y - colCtx->minBounds.y; f32 dz = pos->z - colCtx->minBounds.z; + *sx = dx * colCtx->subdivLengthInv.x; *sy = dy * colCtx->subdivLengthInv.y; *sz = dz * colCtx->subdivLengthInv.z; @@ -2848,6 +2850,7 @@ void DynaPoly_ExpandSRT(GlobalContext* globalCtx, DynaCollisionContext* dyna, s3 for (i = 0; i < pbgdata->numVertices; i++) { f32 radiusSq; + newVtx.x = dyna->vtxList[*vtxStartIndex + i].x; newVtx.y = dyna->vtxList[*vtxStartIndex + i].y; newVtx.z = dyna->vtxList[*vtxStartIndex + i].z; @@ -2862,6 +2865,7 @@ void DynaPoly_ExpandSRT(GlobalContext* globalCtx, DynaCollisionContext* dyna, s3 for (i = 0; i < pbgdata->numPolygons; i++) { CollisionPoly* newPoly = &dyna->polyList[*polyStartIndex + i]; f32 newNormMagnitude; + *newPoly = pbgdata->polyList[i]; // Yeah, this is all kinds of fake, but my God, it matches. @@ -4282,6 +4286,7 @@ u16 WaterBox_GetCameraSType(CollisionContext* colCtx, WaterBox* waterBox) { */ u32 WaterBox_GetLightSettingIndex(CollisionContext* colCtx, WaterBox* waterBox) { u32 prop = waterBox->properties >> 8; + return prop & 0x1F; } diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 1e33d1918e..5904c47339 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -1973,6 +1973,7 @@ s32 Camera_Parallel1(Camera* camera) { if (RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; f32 yNormal = (1.0f + PCT(OREG(46))) - (PCT(OREG(46)) * (68.0f / playerHeight)); + para1->unk_00 = NEXTPCT * playerHeight * yNormal; ; para1->distTarget = NEXTPCT * playerHeight * yNormal; @@ -2181,6 +2182,7 @@ s32 Camera_Jump1(Camera* camera) { if (RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; f32 yNormal = (1.0f + PCT(R_CAM_YOFFSET_NORM)) - (PCT(R_CAM_YOFFSET_NORM) * (68.0f / playerHeight)); + jump1->atYOffset = PCT(NEXTSETTING) * playerHeight * yNormal; jump1->distMin = PCT(NEXTSETTING) * playerHeight * yNormal; jump1->distMax = PCT(NEXTSETTING) * playerHeight * yNormal; @@ -2721,6 +2723,7 @@ s32 Camera_Battle1(Camera* camera) { if (RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; f32 yNormal = (1.0f + PCT(OREG(46))) - (PCT(OREG(46)) * (68.0f / playerHeight)); + batt1->yOffset = NEXTPCT * playerHeight * yNormal; batt1->distance = NEXTSETTING; batt1->swingYawInitial = NEXTSETTING; @@ -2954,6 +2957,7 @@ s32 Camera_Battle4(Camera* camera) { if (RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; f32 yNormal = (1.0f + PCT(R_CAM_YOFFSET_NORM)) - (PCT(R_CAM_YOFFSET_NORM) * (68.0f / playerHeight)); + batt4->yOffset = NEXTPCT * playerHeight * yNormal; batt4->rTarget = NEXTPCT * playerHeight * yNormal; batt4->pitchTarget = DEGF_TO_BINANG(NEXTSETTING); @@ -3062,6 +3066,7 @@ s32 Camera_KeepOn1(Camera* camera) { if (RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; f32 yNormal = (1.0f + PCT(OREG(46))) - (PCT(OREG(46)) * (68.0f / playerHeight)); + keep1->unk_00 = NEXTPCT * playerHeight * yNormal; keep1->unk_04 = NEXTSETTING; keep1->unk_08 = NEXTSETTING; @@ -3302,6 +3307,7 @@ s32 Camera_KeepOn3(Camera* camera) { if (RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; f32 yNormal = (1.0f + PCT(OREG(46))) - (PCT(OREG(46)) * (68.0f / playerHeight)); + keep3->yOffset = NEXTPCT * playerHeight * yNormal; keep3->minDist = NEXTSETTING; keep3->maxDist = NEXTSETTING; @@ -3494,6 +3500,7 @@ s32 Camera_KeepOn4(Camera* camera) { if (RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; f32 yNormal = (1.0f + t) - ((68.0f / playerHeight) * t); + keep4->unk_00 = NEXTPCT * playerHeight * yNormal; keep4->unk_04 = NEXTPCT * playerHeight * yNormal; keep4->unk_08 = NEXTSETTING; @@ -4652,6 +4659,7 @@ s32 Camera_Unique3(Camera* camera) { if (RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; f32 yNormal = (1.0f + PCT(R_CAM_YOFFSET_NORM)) - (PCT(R_CAM_YOFFSET_NORM) * (68.0f / playerHeight)); + params->yOffset = NEXTPCT * playerHeight * yNormal; params->fov = NEXTSETTING; params->interfaceFlags = NEXTSETTING; @@ -6670,6 +6678,7 @@ s32 Camera_Special9(Camera* camera) { spAC = *eye = *eyeNext; } else { s16 yaw; + // 0xE38 ~ 20 degrees eyeAdjustment.pitch = 0xE38; // 0xAAA ~ 15 degrees. @@ -7535,7 +7544,7 @@ Vec3s Camera_Update(Camera* camera) { } /** - * When the camera's timer is 0, change the camera to it's parent + * When the camera's timer is 0, change the camera to its parent */ void Camera_Finish(Camera* camera) { Camera* mainCam = camera->globalCtx->cameraPtrs[MAIN_CAM]; @@ -7992,6 +8001,7 @@ s32 Camera_ChangeDoorCam(Camera* camera, Actor* doorActor, s16 camDataIdx, f32 a osSyncPrintf(".... change default door camera (set %d)\n", CAM_SET_DOORC); } else { s32 setting = Camera_GetCamDataSetting(camera, camDataIdx); + camera->unk_14A |= 0x40; if (Camera_ChangeSetting(camera, setting) >= 0) { diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c index 274a93e3ff..a51d3ea071 100644 --- a/src/code/z_effect_soft_sprite.c +++ b/src/code/z_effect_soft_sprite.c @@ -325,6 +325,7 @@ void EffectSs_DrawAll(GlobalContext* globalCtx) { s16 func_80027DD4(s16 arg0, s16 arg1, s32 arg2) { s16 ret = (arg2 == 0) ? arg1 : (arg0 + (s32)((arg1 - arg0) / (f32)arg2)); + return ret; } diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index 49459fd368..3a9be44cb4 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -955,6 +955,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { if (this->unk_15A < 0) { if (this->unk_15A == -1) { s8 bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_HEART); + if (Object_IsLoaded(&globalCtx->objectCtx, bankIndex)) { this->actor.objBankIndex = bankIndex; Actor_SetObjectDependency(globalCtx, &this->actor); diff --git a/src/code/z_face_reaction.c b/src/code/z_face_reaction.c index 56e40fd822..d463da4f7f 100644 --- a/src/code/z_face_reaction.c +++ b/src/code/z_face_reaction.c @@ -65,5 +65,6 @@ u16 sReactionTextIds[][PLAYER_MASK_MAX] = { u16 Text_GetFaceReaction(GlobalContext* globalCtx, u32 reactionSet) { u8 currentMask = Player_GetMask(globalCtx); + return sReactionTextIds[reactionSet][currentMask]; } diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index ea09e2c0cd..121833d274 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -844,7 +844,7 @@ void Environment_Update(GlobalContext* globalCtx, EnvironmentContext* envCtx, Li u16 i; u16 j; u16 time; - EnvLightSettings* lightSettingsList = globalCtx->envCtx.lightSettingsList; // 7C + EnvLightSettings* lightSettingsList = globalCtx->envCtx.lightSettingsList; s32 adjustment; if ((((void)0, gSaveContext.gameMode) != 0) && (((void)0, gSaveContext.gameMode) != 3)) { @@ -1027,7 +1027,6 @@ void Environment_Update(GlobalContext* globalCtx, EnvironmentContext* envCtx, Li } } } else { - // 3200 (l 1608) if (!envCtx->blendIndoorLights) { for (i = 0; i < 3; i++) { envCtx->lightSettings.ambientColor[i] = lightSettingsList[envCtx->unk_BD].ambientColor[i]; @@ -1042,7 +1041,6 @@ void Environment_Update(GlobalContext* globalCtx, EnvironmentContext* envCtx, Li envCtx->lightSettings.fogFar = lightSettingsList[envCtx->unk_BD].fogFar; envCtx->unk_D8 = 1.0f; } else { - // 3344 (l 1689) u8 blendRate = (lightSettingsList[envCtx->unk_BD].fogNear >> 0xA) * 4; if (blendRate == 0) { diff --git a/src/code/z_play.c b/src/code/z_play.c index 3a168f0b4a..8997fba8d5 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -426,6 +426,7 @@ void Gameplay_Update(GlobalContext* globalCtx) { osSyncPrintf("RomStart RomEnd Size\n"); for (i = 0; i < gObjectTableSize; i++) { s32 size = gObjectTable[i].vromEnd - gObjectTable[i].vromStart; + osSyncPrintf("%08x-%08x %08x(%8.3fKB)\n", gObjectTable[i].vromStart, gObjectTable[i].vromEnd, size, size / 1024.0f); } @@ -1627,6 +1628,7 @@ s32 Gameplay_CameraSetAtEyeUp(GlobalContext* globalCtx, s16 camId, Vec3f* at, Ve s32 Gameplay_CameraSetFov(GlobalContext* globalCtx, s16 camId, f32 fov) { s32 ret = Camera_SetParam(globalCtx->cameraPtrs[camId], 0x20, &fov) & 1; + if (1) {} return ret; } diff --git a/src/code/z_quake.c b/src/code/z_quake.c index d3f16f025f..cd1fac1d1d 100644 --- a/src/code/z_quake.c +++ b/src/code/z_quake.c @@ -66,6 +66,7 @@ s16 Quake_Callback1(QuakeRequest* req, ShakeInfo* shake) { if (req->countdown > 0) { f32 a = Math_SinS(req->speed * req->countdown); + Quake_UpdateShakeInfo(req, shake, a, Rand_ZeroOne() * a); req->countdown--; } @@ -75,6 +76,7 @@ s16 Quake_Callback1(QuakeRequest* req, ShakeInfo* shake) { s16 Quake_Callback5(QuakeRequest* req, ShakeInfo* shake) { if (req->countdown > 0) { f32 a = Math_SinS(req->speed * req->countdown); + Quake_UpdateShakeInfo(req, shake, a, a); req->countdown--; } @@ -94,6 +96,7 @@ s16 Quake_Callback6(QuakeRequest* req, ShakeInfo* shake) { s16 Quake_Callback3(QuakeRequest* req, ShakeInfo* shake) { if (req->countdown > 0) { f32 a = Math_SinS(req->speed * req->countdown) * ((f32)req->countdown / (f32)req->countdownMax); + Quake_UpdateShakeInfo(req, shake, a, a); req->countdown--; } @@ -103,6 +106,7 @@ s16 Quake_Callback3(QuakeRequest* req, ShakeInfo* shake) { s16 Quake_Callback2(QuakeRequest* req, ShakeInfo* shake) { if (req->countdown > 0) { f32 a = Rand_ZeroOne(); + Quake_UpdateShakeInfo(req, shake, a, Rand_ZeroOne() * a); req->countdown--; } @@ -112,6 +116,7 @@ s16 Quake_Callback2(QuakeRequest* req, ShakeInfo* shake) { s16 Quake_Callback4(QuakeRequest* req, ShakeInfo* shake) { if (req->countdown > 0) { f32 a = Rand_ZeroOne() * ((f32)req->countdown / (f32)req->countdownMax); + Quake_UpdateShakeInfo(req, shake, a, Rand_ZeroOne() * a); req->countdown--; } diff --git a/src/code/z_sample.c b/src/code/z_sample.c index a287a9c080..6e999787cd 100644 --- a/src/code/z_sample.c +++ b/src/code/z_sample.c @@ -23,6 +23,7 @@ void Sample_Draw(SampleContext* this) { { Mtx* mtx = Graph_Alloc(gfxCtx, sizeof(Mtx)); + guPosition(mtx, SREG(37), SREG(38), SREG(39), 1.0f, SREG(40), SREG(41), SREG(42)); gSPMatrix(POLY_OPA_DISP++, mtx, G_MTX_LOAD); } diff --git a/src/code/z_skin.c b/src/code/z_skin.c index b340aec641..fb89f819c1 100644 --- a/src/code/z_skin.c +++ b/src/code/z_skin.c @@ -144,6 +144,7 @@ void func_800A5F60(GraphicsContext* gfxCtx, PSkinAwb* skin, s32 limbIndex, Gfx* } if (gfx != NULL) { Mtx* mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &D_801600C0[limbIndex]); + if (mtx != NULL) { gSPMatrix(POLY_OPA_DISP++, mtx, G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gfx); diff --git a/src/code/z_vimode.c b/src/code/z_vimode.c index cf432503b6..d0987ea24c 100644 --- a/src/code/z_vimode.c +++ b/src/code/z_vimode.c @@ -207,6 +207,7 @@ void ViMode_Destroy(ViMode* viMode) { void ViMode_ConfigureFeatures(ViMode* viMode, s32 viFeatures) { u32 ctrl = viMode->customViMode.comRegs.ctrl; + if (viFeatures & OS_VI_GAMMA_ON) { ctrl |= OS_VI_GAMMA; } diff --git a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c index cd6a6eefc3..dce70fb537 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c +++ b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c @@ -355,7 +355,7 @@ void func_808806BC(BgHakaTrap* this, GlobalContext* globalCtx) { f32 tempf20; f32 temp; s32 i; - UNK_TYPE sp64; + s32 sp64; this->dyna.actor.velocity.y *= 1.6f; diff --git a/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c b/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c index e83c32b4fd..f9de888fa1 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c @@ -214,6 +214,7 @@ void BgHidanSima_Update(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc(this, globalCtx); if (this->dyna.actor.params != 0) { s32 temp = (this->dyna.actor.world.rot.y == this->dyna.actor.shape.rot.y) ? this->timer : (this->timer + 80); + if (this->actionFunc == func_8088E7A8) { temp += 20; } diff --git a/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c b/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c index 5295e92aea..d4dedaf561 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c +++ b/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c @@ -127,6 +127,7 @@ void func_80891DD4(BgIceShutter* this, GlobalContext* globalCtx) { void BgIceShutter_Update(Actor* thisx, GlobalContext* globalCtx) { BgIceShutter* this = THIS; + this->actionFunc(this, globalCtx); } diff --git a/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c b/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c index 43de77e3f6..370f65a3dc 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c +++ b/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c @@ -133,6 +133,7 @@ void BgJyaIronobj_SpawnPillarParticles(BgJyaIronobj* this, GlobalContext* global coss = Math_CosS(rotY); for (j = 0; j < 32; j++) { f32 rand = Rand_ZeroOne(); + if (rand < 0.1f) { unkArg5 = 0x60; } else if (rand < 0.8f) { @@ -191,6 +192,7 @@ void BgJyaIronobj_SpawnThoneParticles(BgJyaIronobj* this, GlobalContext* arg1, E for (j = 0; j < 32; j++) { f32 rand = Rand_ZeroOne(); + if (rand < 0.1f) { unkArg5 = 0x60; } else if (rand < 0.8f) { diff --git a/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c b/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c index b36fc620b8..a9613a0fb6 100644 --- a/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c +++ b/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c @@ -110,6 +110,7 @@ void BgMjin_Draw(Actor* thisx, GlobalContext* globalCtx) { if (thisx->params != 0) { // thisx is required s32 objBankIndex = Object_GetIndex(&globalCtx->objectCtx, sObjectIDs[thisx->params - 1]); + if (objBankIndex >= 0) { gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[objBankIndex].segment); } diff --git a/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c b/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c index 95ae4f1081..61cc0b72fc 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c +++ b/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c @@ -66,6 +66,7 @@ void BgTokiHikari_DoNothing(BgTokiHikari* this, GlobalContext* globalCtx) { void BgTokiHikari_Update(Actor* thisx, GlobalContext* globalCtx) { BgTokiHikari* this = THIS; + this->actionFunc(this, globalCtx); } diff --git a/src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.c b/src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.c index bff752460b..b7fa1fe32a 100644 --- a/src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.c +++ b/src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.c @@ -109,7 +109,6 @@ void BgVbSima_Update(Actor* thisx, GlobalContext* globalCtx) { } else { edgeZ = 80.0f; if (Rand_ZeroOne() < 0.5f) { - // minus1 = -1.0f; // Not a fake match; the game really does this. edgeZ = 80.0f * minus1; } edgeX = Rand_CenteredFloat(160.0f); diff --git a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c index 123365c081..0f9d56d77b 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c +++ b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c @@ -416,6 +416,7 @@ void BgYdanSp_WallWebIdle(BgYdanSp* this, GlobalContext* globalCtx) { void BgYdanSp_Update(Actor* thisx, GlobalContext* globalCtx) { BgYdanSp* this = THIS; + this->actionFunc(this, globalCtx); } diff --git a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c index d1bd94d549..ea230958cc 100644 --- a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c +++ b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c @@ -1053,6 +1053,7 @@ s32 BossDodongo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** f32 mtxScaleY; f32 mtxScaleZ; BossDodongo* this = THIS; + // required for matching if ((limbIndex == 6) || (limbIndex == 7)) { if (this->unk_25C) {} diff --git a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c index 0124ff89ab..0005a75795 100644 --- a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c +++ b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c @@ -912,6 +912,7 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { if (this->framesUntilNextAction != 0) { f32 s = sinf(this->framesUntilNextAction * 3.1415f * 0.5f); + this->subCameraAt.y = this->framesUntilNextAction * s * 0.7f + this->actor.world.pos.y; } else { Math_ApproachF(&this->subCameraAt.y, this->actor.focus.pos.y, 0.1f, 10.0f); diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c index a9e5f094ea..4c8085646b 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -407,27 +407,26 @@ void BossMo_SetupTentacle(BossMo* this, GlobalContext* globalCtx) { } void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { - // variables marked real are put on the stack and cannot be reordered s16 tentXrot; - s16 sp1B4 = 0; // real + s16 sp1B4 = 0; s32 buttons; Player* player = GET_PLAYER(globalCtx); s16 indS0; s16 indS1; Camera* camera1; Camera* camera2; - BossMo* otherTent = (BossMo*)this->otherTent; // real - f32 maxSwingRateX; // real - f32 maxSwingLagX; // real - f32 maxSwingSizeX; // real - f32 maxSwingRateZ; // real - f32 maxSwingLagZ; // real - f32 maxSwingSizeZ; // real - f32 swingRateAccel; // real - f32 swingSizeAccel; // real - s16 rippleCount; // real + BossMo* otherTent = (BossMo*)this->otherTent; + f32 maxSwingRateX; + f32 maxSwingLagX; + f32 maxSwingSizeX; + f32 maxSwingRateZ; + f32 maxSwingLagZ; + f32 maxSwingSizeZ; + f32 swingRateAccel; + f32 swingSizeAccel; + s16 rippleCount; s16 indT5; - Vec3f ripplePos; // real + Vec3f ripplePos; f32 randAngle; f32 randFloat; f32 tempf1; @@ -438,21 +437,21 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { f32 dx; f32 dy; f32 dz; - Vec3f sp138; // real - Vec3f sp12C; // real - Vec3f sp120; // real + Vec3f sp138; + Vec3f sp12C; + Vec3f sp120; s32 pad11C; s32 pad118; s32 pad114; s32 pad110; s32 pad10C; s32 pad108; - Vec3f spFC; // real - Vec3f spF0; // real + Vec3f spFC; + Vec3f spF0; f32 padEC; - Vec3f spE0; // real - Vec3f spD4; // real - Vec3f spC8; // real + Vec3f spE0; + Vec3f spD4; + Vec3f spC8; if (this->work[MO_TENT_ACTION_STATE] <= MO_TENT_DEATH_3) { this->actor.world.pos.y = MO_WATER_LEVEL(globalCtx); @@ -1117,8 +1116,8 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { (this->work[MO_TENT_ACTION_STATE] == MO_TENT_DEATH_2) || (this->work[MO_TENT_ACTION_STATE] == MO_TENT_CURL) || (this->work[MO_TENT_ACTION_STATE] == MO_TENT_GRAB)) && (Rand_ZeroOne() < 0.8f) && (this->actor.scale.x > 0.001f)) { - Vec3f pos; // real - Vec3f velocity = { 0.0f, 0.0f, 0.0f }; // real + Vec3f pos; + Vec3f velocity = { 0.0f, 0.0f, 0.0f }; f32 scale; f32 temp; diff --git a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c index 0b01c16d96..7fc75f5395 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -1093,6 +1093,7 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { case 0: if (this->timers[0] != 0) { s32 beamReflection = BossTw_CheckBeamReflection(this, globalCtx); + if (beamReflection == 1) { Vec3f pos; Vec3f velocity; diff --git a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c index 0574f4e537..a70252612e 100644 --- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -3594,6 +3594,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { for (i = 0, flag = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) { if (effect->type == VA_TUMOR) { BossVa* parent = effect->parent; + if (!flag) { func_80093D18(globalCtx->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, effect->envColor[3]); diff --git a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c index 6c1f959558..030abcf2f1 100644 --- a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c +++ b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c @@ -886,6 +886,7 @@ void func_8096F544(DemoEc* this, s32 changeAnim) { void func_8096F578(DemoEc* this, GlobalContext* globalCtx, s32 arg2) { CsCmdActorAction* npcAction; s32 sp18; + npcAction = DemoEc_GetNpcAction(globalCtx, arg2); if (npcAction != NULL) { sp18 = npcAction->action; diff --git a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c index 07dbbca9d8..dbb9481c00 100644 --- a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c +++ b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c @@ -1134,7 +1134,7 @@ void DemoEffect_UpdateLgtShower(DemoEffect* this, GlobalContext* globalCtx) { * Update action for the God Lgt Din Actor. * This is the Goddess Din. * This function moves God Lgt Din based on the current cutscene command. - * This function also spawns a Fireball Actor and sets it's update function to the special InitCreationFireball. + * This function also spawns a Fireball Actor and sets its update function to the special InitCreationFireball. * The spawned Fireball Actor is also scaled to be smaller than regular by this function. */ void DemoEffect_UpdateGodLgtDin(DemoEffect* this, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c index e20d57f2b4..acf847b7f8 100644 --- a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c +++ b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c @@ -157,6 +157,7 @@ void func_809781FC(DemoGeff* this, GlobalContext* globalCtx) { void func_809782A0(DemoGeff* this, GlobalContext* globalCtx) { DemoGt* demoGt = this->demoGt; s16 params = this->actor.params; + if (demoGt != NULL && (params != 6) && (params != 7) && (params != 8)) { this->actor.world.pos.x = demoGt->dyna.actor.world.pos.x + this->deltaPosX; this->actor.world.pos.y = demoGt->dyna.actor.world.pos.y + this->deltaPosY; diff --git a/src/overlays/actors/ovl_Demo_Go/z_demo_go.c b/src/overlays/actors/ovl_Demo_Go/z_demo_go.c index d00284742f..1031e51a05 100644 --- a/src/overlays/actors/ovl_Demo_Go/z_demo_go.c +++ b/src/overlays/actors/ovl_Demo_Go/z_demo_go.c @@ -107,6 +107,7 @@ void func_8097C9B8(DemoGo* this) { void func_8097C9DC(DemoGo* this) { s32 pad[2]; + if (Animation_OnFrame(&this->skelAnime, 12.0f) || Animation_OnFrame(&this->skelAnime, 25.0f)) { func_80078914(&this->actor.projectedPos, NA_SE_EN_MORIBLIN_WALK); } diff --git a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c index 4c7eae054e..7b30a42c97 100644 --- a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c +++ b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c @@ -648,6 +648,7 @@ void func_809862E0(DemoIm* this, GlobalContext* globalCtx) { if (npcAction != NULL) { u32 action = npcAction->action; u32 unk_274 = this->unk_274; + if (action != unk_274) { switch (action) { case 1: diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c index 381f677c9c..2698de8286 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -873,6 +873,7 @@ void DemoKankyo_DrawWarpSparkles(Actor* thisx, GlobalContext* globalCtx) { sWarpSparkleEnvColors[globalCtx->msgCtx.lastPlayedSong].b, 255); } else { s8 respawnData = gSaveContext.respawn[1].data; + gDPSetEnvColor(POLY_XLU_DISP++, sWarpSparkleEnvColors[respawnData].r, sWarpSparkleEnvColors[respawnData].g, sWarpSparkleEnvColors[respawnData].b, 255); } 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 2ad226fd5e..dc3459e2bc 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -96,6 +96,7 @@ void DoorAna_Destroy(Actor* thisx, GlobalContext* globalCtx) { // update routine for grottos that are currently "hidden"/unopened void DoorAna_WaitClosed(DoorAna* this, GlobalContext* globalCtx) { u32 openGrotto = false; + if (!(this->actor.params & 0x200)) { // opening with song of storms if (this->actor.xyzDistToPlayerSq < 40000.0f && Flags_GetEnv(globalCtx, 5)) { diff --git a/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c b/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c index afe136d569..f3d569d4aa 100644 --- a/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c +++ b/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c @@ -37,8 +37,6 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F(scale, 1, ICHAIN_STOP), }; -extern UNK_TYPE D_80994B70; - void DoorGerudo_Init(Actor* thisx, GlobalContext* globalCtx) { s32 pad; DoorGerudo* this = THIS; diff --git a/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c b/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c index e46570c08f..ff4e588691 100644 --- a/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c +++ b/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c @@ -234,6 +234,7 @@ void EnAnubiceFire_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Push(); for (i = this->unk_15E; i < 6; ++i) { f32 scale = this->actor.scale.x - (i * 0.2f); + if (scale < 0.0f) { scale = 0.0f; } diff --git a/src/overlays/actors/ovl_En_Bird/z_en_bird.c b/src/overlays/actors/ovl_En_Bird/z_en_bird.c index e7eac98a79..3066bafa1f 100644 --- a/src/overlays/actors/ovl_En_Bird/z_en_bird.c +++ b/src/overlays/actors/ovl_En_Bird/z_en_bird.c @@ -100,6 +100,7 @@ void func_809C1E00(EnBird* this, s16 params) { void func_809C1E40(EnBird* this, GlobalContext* globalCtx) { f32 fVar4 = sinf(this->unk_1B4); + this->actor.shape.yOffset += fVar4 * this->unk_1A0; Math_SmoothStepToF(&this->actor.speedXZ, this->unk_1A8, 0.1f, this->unk_1AC, 0.0f); diff --git a/src/overlays/actors/ovl_En_Boom/z_en_boom.c b/src/overlays/actors/ovl_En_Boom/z_en_boom.c index 3f43c72ddb..b382329c67 100644 --- a/src/overlays/actors/ovl_En_Boom/z_en_boom.c +++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.c @@ -166,7 +166,7 @@ void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) { } } - // Decrement the return timer and check if its 0. If it is, check if Link can catch it and handle accordingly. + // Decrement the return timer and check if it's 0. If it is, check if Link can catch it and handle accordingly. // Otherwise handle grabbing and colliding. if (DECR(this->returnTimer) == 0) { distFromLink = Math_Vec3f_DistXYZ(&this->actor.world.pos, &player->actor.focus.pos); @@ -179,7 +179,7 @@ void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) { Math_Vec3f_Copy(&target->world.pos, &player->actor.world.pos); // If the grabbed actor is EnItem00 (HP/Key etc) set gravity and flags so it falls in front of Link. - // Otherwise if its a Skulltula Token, just set flags so he collides with it to collect it. + // Otherwise if it's a Skulltula Token, just set flags so he collides with it to collect it. if (target->id == ACTOR_EN_ITEM00) { target->gravity = -0.9f; target->bgCheckFlags &= ~0x03; @@ -202,7 +202,7 @@ void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) { &hitPoint, &this->actor.wallPoly, true, true, true, true, &hitDynaID); if (collided) { - // If the boomerang collides with something and its is a Jabu Object actor with params equal to 0, then + // If the boomerang collides with something and it's is a Jabu Object actor with params equal to 0, then // set collided to 0 so that the boomerang will go through the wall. // Otherwise play a clank sound and keep collided set to bounce back. if (func_8002F9EC(globalCtx, &this->actor, this->actor.wallPoly, hitDynaID, &hitPoint) != 0 || diff --git a/src/overlays/actors/ovl_En_Bx/z_en_bx.c b/src/overlays/actors/ovl_En_Bx/z_en_bx.c index f8fd77032a..c8c24da4a0 100644 --- a/src/overlays/actors/ovl_En_Bx/z_en_bx.c +++ b/src/overlays/actors/ovl_En_Bx/z_en_bx.c @@ -224,6 +224,7 @@ void EnBx_Draw(Actor* thisx, GlobalContext* globalCtx) { for (i = 3; i >= 0; i--) { s16 off = (0x2000 * i); + this->unk_184[i].z = this->unk_184[i].x = (Math_CosS(this->unk_14E + off) * 0.0075f) + 0.015f; this->unk_1B4[i].x = thisx->shape.rot.x; this->unk_1B4[i].y = thisx->shape.rot.y; diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index 814c1fcda9..06c7900be2 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -293,6 +293,7 @@ void EnDoor_Open(EnDoor* this, GlobalContext* globalCtx) { void EnDoor_Update(Actor* thisx, GlobalContext* globalCtx) { EnDoor* this = THIS; + this->actionFunc(this, globalCtx); } 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 26fa50fde9..52253fd635 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -76,6 +76,7 @@ void EnEncount2_Wait(EnEncount2* this, GlobalContext* globalCtx) { } } else if ((this->actor.xzDistToPlayer < 700.0f) && (Flags_GetSwitch(globalCtx, 0x37))) { s16 scene = globalCtx->sceneNum; + if (((scene == SCENE_GANON_DEMO) || (scene == SCENE_GANON_FINAL) || (scene == SCENE_GANON_SONOGO) || (scene == SCENE_GANONTIKA_SONOGO)) && (!this->collapseSpawnerInactive)) { diff --git a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c index 7057cdb7b3..ed146a7d36 100644 --- a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c +++ b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c @@ -318,6 +318,7 @@ void EnFireRock_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->type != FIRE_ROCK_CEILING_SPOT_SPAWNER) { f32 temp; + this->rockRotation.x += this->angularVelocity.x; this->rockRotation.y += this->angularVelocity.y; this->rockRotation.z += this->angularVelocity.z; diff --git a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c index 7344a449a1..ce375822ca 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -232,6 +232,7 @@ void EnFloormas_SetupRun(EnFloormas* this) { void EnFloormas_SetupTurn(EnFloormas* this) { s16 rotDelta = this->actionTarget - this->actor.shape.rot.y; + this->actor.speedXZ = 0.0f; if (rotDelta > 0) { Animation_MorphToPlayOnce(&this->skelAnime, &gFloormasterTurnAnim, -3.0f); @@ -470,6 +471,7 @@ void EnFloormas_Stand(EnFloormas* this, GlobalContext* globalCtx) { void EnFloormas_BigWalk(EnFloormas* this, GlobalContext* globalCtx) { s32 animPastFrame; + SkelAnime_Update(&this->skelAnime); animPastFrame = Animation_OnFrame(&this->skelAnime, 0.0f); if (animPastFrame) { @@ -1082,6 +1084,7 @@ void EnFloormas_Update(Actor* thisx, GlobalContext* globalCtx) { s32 EnFloormas_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnFloormas* this = THIS; + if (limbIndex == 1) { pos->z += this->zOffset; } diff --git a/src/overlays/actors/ovl_En_Fr/z_en_fr.c b/src/overlays/actors/ovl_En_Fr/z_en_fr.c index 9893ecd77c..710a16736c 100644 --- a/src/overlays/actors/ovl_En_Fr/z_en_fr.c +++ b/src/overlays/actors/ovl_En_Fr/z_en_fr.c @@ -746,6 +746,7 @@ void EnFr_ChildSong(EnFr* this, GlobalContext* globalCtx) { void EnFr_ChildSongFirstTime(EnFr* this, GlobalContext* globalCtx) { EnFr* frog = sEnFrPointers.frogs[sSongToFrog[this->songIndex]]; + if (frog->isActive == false) { this->actor.textId = 0x40A9; EnFr_SetupReward(this, globalCtx, true); diff --git a/src/overlays/actors/ovl_En_Goma/z_en_goma.c b/src/overlays/actors/ovl_En_Goma/z_en_goma.c index 869104100f..849bdcbfc4 100644 --- a/src/overlays/actors/ovl_En_Goma/z_en_goma.c +++ b/src/overlays/actors/ovl_En_Goma/z_en_goma.c @@ -417,6 +417,7 @@ void EnGoma_Dead(EnGoma* this, GlobalContext* globalCtx) { if (this->actionTimer == 0 && Math_SmoothStepToF(&this->actor.scale.y, 0.0f, 0.5f, 0.00225f, 0.00001f) <= 0.001f) { if (this->actor.params < 6) { BossGoma* parent = (BossGoma*)this->actor.parent; + parent->childrenGohmaState[this->actor.params] = -1; } Audio_PlaySoundGeneral(NA_SE_EN_EXTINCT, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); @@ -659,6 +660,7 @@ void EnGoma_UpdateHit(EnGoma* this, GlobalContext* globalCtx) { // die if still an egg if (this->actor.params <= 5) { //! BossGoma only has 3 children BossGoma* parent = (BossGoma*)this->actor.parent; + parent->childrenGohmaState[this->actor.params] = -1; } diff --git a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c index a9cac60a70..4b4d698ba6 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -725,7 +725,7 @@ void EnGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx) { EnGoroiwa* this = THIS; Player* player = GET_PLAYER(globalCtx); s32 pad; - UNK_TYPE sp30; + s32 sp30; if (!(player->stateFlags1 & 0x300000C0)) { if (this->collisionDisabledTimer > 0) { diff --git a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c index 791693c732..af7df9dd03 100644 --- a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c +++ b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c @@ -275,6 +275,7 @@ void func_80A56994(EnHeishi4* this, GlobalContext* globalCtx) { void func_80A56A50(EnHeishi4* this, GlobalContext* globalCtx) { f32 frames = Animation_GetLastFrame(&gEnHeishiDyingGuardDieAnim); + this->unk_288 = frames; Animation_Change(&this->skelAnime, &gEnHeishiDyingGuardDieAnim, 1.0f, 0.0f, frames, ANIMMODE_ONCE, -10.0f); this->actionFunc = func_80A56ACC; diff --git a/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c b/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c index 7cefd762a1..e08907a8b8 100644 --- a/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c +++ b/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c @@ -103,6 +103,7 @@ void EnHintnuts_Init(Actor* thisx, GlobalContext* globalCtx) { void EnHintnuts_Destroy(Actor* thisx, GlobalContext* globalCtx) { EnHintnuts* this = THIS; + if (this->actor.params != 0xA) { Collider_DestroyCylinder(globalCtx, &this->collider); } diff --git a/src/overlays/actors/ovl_En_Holl/z_en_holl.c b/src/overlays/actors/ovl_En_Holl/z_en_holl.c index 11844f5691..54a7156678 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.c +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.c @@ -317,6 +317,7 @@ void EnHoll_NextAction(EnHoll* this, GlobalContext* globalCtx) { void EnHoll_Update(Actor* thisx, GlobalContext* globalCtx) { EnHoll* this = THIS; + this->actionFunc(this, globalCtx); } diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 5e227a7ac9..42dd1ed1c1 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -472,6 +472,7 @@ s32 EnHorse_BgCheckBridgeJumpPoint(EnHorse* this, GlobalContext* globalCtx) { xMax = (xMin + sBridgeJumps[i].xMax) + sBridgeJumps[i].xOffset; if (xMax < xMin) { f32 temp = xMin; + xMin = xMax; xMax = temp; } @@ -504,6 +505,7 @@ s32 EnHorse_CheckBridgeJumps(EnHorse* this, GlobalContext* globalCtx) { if (xMax < xMin) { f32 temp = xMin; + xMin = xMax; xMax = temp; } @@ -987,6 +989,7 @@ void EnHorse_UpdateSpeed(EnHorse* this, GlobalContext* globalCtx, f32 brakeDecel f32 temp_f12; f32 traction; s16 turn; + if (!EnHorse_PlayerCanMove(this, globalCtx)) { if (this->actor.speedXZ > 8) { this->actor.speedXZ -= decel; diff --git a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c index 3ea315bb99..d6abca36ed 100644 --- a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c +++ b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c @@ -609,6 +609,7 @@ s32 func_80A6AD84(Actor* thisx, GlobalContext* globalCtx, s32 arg2, PSkinAwb* ar if (arg2 == 0xD) { u8 index = sEyeIndexOrder[this->eyeTexIndex]; + gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[index])); } diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index 2b8901faca..c8575e199c 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -1171,6 +1171,7 @@ void EnIk_PostLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve switch (limbIndex) { case 13: { EnIk* this = THIS; + if (EnIk_curFrame(&this->actor) < 30.0f) { gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_en_ik_inAwake.c", 267), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -1189,9 +1190,8 @@ void EnIk_PostLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve break; case 26: { EnIk* this = THIS; - if (EnIk_curFrame(&this->actor) < 30.0f) { - // s32 pad; + if (EnIk_curFrame(&this->actor) < 30.0f) { gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_en_ik_inAwake.c", 288), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_ik_DL_016BE0); @@ -1199,9 +1199,8 @@ void EnIk_PostLimbDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } break; case 27: { EnIk* this = THIS; - if (EnIk_curFrame(&this->actor) < 30.0f) { - // s32 pad; + if (EnIk_curFrame(&this->actor) < 30.0f) { gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_en_ik_inAwake.c", 297), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_ik_DL_016CD8); diff --git a/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c b/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c index d24f766edc..a252297e4a 100644 --- a/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c +++ b/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c @@ -324,6 +324,7 @@ void func_80A89A6C(EnJsjutan* this, GlobalContext* globalCtx) { f32 rotX; f32 rotZ; s32 pad; + // Carpet size is 12x12. if ((i % 12) == 11) { // Last column. j = i - 1; diff --git a/src/overlays/actors/ovl_En_Ko/z_en_ko.c b/src/overlays/actors/ovl_En_Ko/z_en_ko.c index 59bf7e9303..2bc0f39be0 100644 --- a/src/overlays/actors/ovl_En_Ko/z_en_ko.c +++ b/src/overlays/actors/ovl_En_Ko/z_en_ko.c @@ -544,6 +544,7 @@ s16 func_80A97738(GlobalContext* globalCtx, Actor* thisx) { s32 EnKo_GetForestQuestState(EnKo* this) { s32 result; + if (!LINK_IS_ADULT) { // Obtained Zelda's Letter if (gSaveContext.eventChkInf[4] & 1) { diff --git a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c index f0cc1ebfb4..d4b8ba6ca7 100644 --- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c +++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c @@ -85,6 +85,7 @@ static void* sEyeTextures[] = { u16 EnMa1_GetText(GlobalContext* globalCtx, Actor* thisx) { u16 faceReaction = Text_GetFaceReaction(globalCtx, 0x17); + if (faceReaction != 0) { return faceReaction; } diff --git a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c index b25f880e2d..3cb00fd5af 100644 --- a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c +++ b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c @@ -64,6 +64,7 @@ static struct_D_80AA1678 sAnimationInfo[] = { u16 func_80AA19A0(GlobalContext* globalCtx, Actor* thisx) { u16 faceReaction = Text_GetFaceReaction(globalCtx, 23); + if (faceReaction != 0) { return faceReaction; } diff --git a/src/overlays/actors/ovl_En_Nb/z_en_nb.c b/src/overlays/actors/ovl_En_Nb/z_en_nb.c index 5034f24899..f5b1876c42 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -1166,11 +1166,13 @@ void func_80AB36DC(EnNb* this, GlobalContext* globalCtx) { if ((((u16)((u16)(kREG(17) + 25) - 4))) > moveTime) { s16 invScale = 4 - moveTime; + if (invScale > 0) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->pathYaw, invScale, 6200, 100); } } else { s16 invScale = (u16)(kREG(17) + 25) - moveTime; + if (invScale > 0) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, invScale, 6200, 100); } diff --git a/src/overlays/actors/ovl_En_Ny/z_en_ny.c b/src/overlays/actors/ovl_En_Ny/z_en_ny.c index d579984af7..93d2605505 100644 --- a/src/overlays/actors/ovl_En_Ny/z_en_ny.c +++ b/src/overlays/actors/ovl_En_Ny/z_en_ny.c @@ -552,6 +552,7 @@ void EnNy_Draw(Actor* thisx, GlobalContext* globalCtx) { Vec3f tempVec; Vec3f* fireOffset; s16 temp; + temp = this->unk_1CA - 1; this->actor.colorFilterTimer++; if (temp == 0) { diff --git a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c index fc1e7cfc44..6204b81d7d 100644 --- a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c +++ b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c @@ -254,7 +254,7 @@ void func_80ABF4C8(EnOkarinaTag* this, GlobalContext* globalCtx) { gSaveContext.cutsceneTrigger = 1; break; case 6: - globalCtx->csCtx.segment = LINK_IS_ADULT ? SEGMENTED_TO_VIRTUAL(&spot02_sceneCutsceneData0x003C80) + globalCtx->csCtx.segment = LINK_IS_ADULT ? SEGMENTED_TO_VIRTUAL(&spot02_scene_Cs_003C80) : SEGMENTED_TO_VIRTUAL(&spot02_scene_Cs_005020); gSaveContext.cutsceneTrigger = 1; gSaveContext.eventChkInf[1] |= 0x2000; diff --git a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c index 5780cb2dad..d15cc75a04 100644 --- a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c +++ b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c @@ -120,7 +120,7 @@ void EnOkuta_Init(Actor* thisx, GlobalContext* globalCtx) { s32 pad; WaterBox* outWaterBox; f32 ySurface; - UNK_TYPE sp30; + s32 sp30; Actor_ProcessInitChain(thisx, sInitChain); this->numShots = (thisx->params >> 8) & 0xFF; diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index d61c548d32..bc26cbbe2b 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -455,6 +455,7 @@ void EnOssan_UpdateShopOfferings(EnOssan* this, GlobalContext* globalCtx) { shopItem = &storeItems[i]; if (shopItem->shopItemIndex >= 0 && this->shelfSlots[i] == NULL) { s16 params = sShopItemReplaceFunc[shopItem->shopItemIndex](shopItem->shopItemIndex); + if (params >= 0) { this->shelfSlots[i] = (EnGirlA*)Actor_Spawn( &globalCtx->actorCtx, globalCtx, ACTOR_EN_GIRLA, diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/src/overlays/actors/ovl_En_Owl/z_en_owl.c index 381bb0774a..c06fc9469b 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -591,6 +591,7 @@ void func_80ACB148(EnOwl* this, GlobalContext* globalCtx) { void EnOwl_WaitHyliaShortcut(EnOwl* this, GlobalContext* globalCtx) { u16 textId = (gSaveContext.infTable[25] & 0x20) ? 0x4004 : 0x4003; + // Spoke to Owl in Lake Hylia EnOwl_LookAtLink(this, globalCtx); if (func_80ACA558(this, globalCtx, textId)) { diff --git a/src/overlays/actors/ovl_En_Part/z_en_part.c b/src/overlays/actors/ovl_En_Part/z_en_part.c index dfb954cb08..7477c78c22 100644 --- a/src/overlays/actors/ovl_En_Part/z_en_part.c +++ b/src/overlays/actors/ovl_En_Part/z_en_part.c @@ -183,6 +183,7 @@ void func_80ACE5C8(EnPart* this, GlobalContext* globalCtx) { if (sqrt(this->actor.xyzDistToPlayerSq) <= 40.0f) { u8 prevInvincibilityTimer = player->invincibilityTimer; + if (player->invincibilityTimer <= 0) { if (player->invincibilityTimer <= -40) { player->invincibilityTimer = 0; @@ -217,6 +218,7 @@ void func_80ACE7E8(EnPart* this, GlobalContext* globalCtx) { if (this->timer == 0) { f32 diffsSum = Math_SmoothStepToF(&this->actor.world.pos.x, this->actor.home.pos.x, 1.0f, 5.0f, 0.0f); + diffsSum += Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 1.0f, 5.0f, 0.0f); diffsSum += Math_SmoothStepToF(&this->actor.world.pos.z, this->actor.home.pos.z, 1.0f, 5.0f, 0.0f); diffsSum += Math_SmoothStepToF(&this->rotZ, 0.0f, 1.0f, 0.25f, 0.0f); diff --git a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c index 918605f5d9..8e9a73e04d 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c @@ -284,6 +284,7 @@ void EnPeehat_HitWhenGrounded(EnPeehat* this, GlobalContext* globalCtx) { this->colCylinder.base.acFlags &= ~AC_HIT; if ((globalCtx->gameplayFrames & 0xF) == 0) { Vec3f itemDropPos = this->actor.world.pos; + itemDropPos.y += 70.0f; Item_DropCollectibleRandom(globalCtx, &this->actor, &itemDropPos, 0x40); Item_DropCollectibleRandom(globalCtx, &this->actor, &itemDropPos, 0x40); @@ -291,6 +292,7 @@ void EnPeehat_HitWhenGrounded(EnPeehat* this, GlobalContext* globalCtx) { this->unk2D4 = 240; } else { s32 i; + this->colCylinder.base.acFlags &= ~AC_HIT; for (i = MAX_LARVA - this->unk2FA; i > 0; i--) { Actor* larva = @@ -298,6 +300,7 @@ void EnPeehat_HitWhenGrounded(EnPeehat* this, GlobalContext* globalCtx) { Rand_CenteredFloat(25.0f) + this->actor.world.pos.x, Rand_CenteredFloat(25.0f) + (this->actor.world.pos.y + 50.0f), Rand_CenteredFloat(25.0f) + this->actor.world.pos.z, 0, 0, 0, PEAHAT_TYPE_LARVA); + if (larva != NULL) { larva->velocity.y = 6.0f; larva->shape.rot.y = larva->world.rot.y = Rand_CenteredFloat(0xFFFF); diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index 06eeb3e7f2..46840b8fc3 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -977,6 +977,7 @@ void func_80ADB770(EnPoSisters* this, GlobalContext* globalCtx) { } } else if (this->unk_195 != 0) { EnPoSisters* realMeg = (EnPoSisters*)this->actor.parent; + if (realMeg->actionFunc == func_80ADAAA4) { func_80AD95D8(this); } @@ -1195,7 +1196,7 @@ void EnPoSisters_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 0.0f, 5); } else { Vec3f vec; - UNK_TYPE sp34; + s32 sp34; vec.x = this->actor.world.pos.x; vec.y = this->actor.world.pos.y + 10.0f; diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.c b/src/overlays/actors/ovl_En_Poh/z_en_poh.c index 61716b3660..42c8aadfc1 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.c +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.c @@ -990,7 +990,7 @@ void EnPoh_UpdateLiving(Actor* thisx, GlobalContext* globalCtx) { EnPoh* this = THIS; s32 pad; Vec3f vec; - UNK_TYPE sp38; + s32 sp38; if (this->colliderSph.base.atFlags & AT_HIT) { this->colliderSph.base.atFlags &= ~AT_HIT; @@ -1180,6 +1180,7 @@ void EnPoh_DrawSoul(Actor* thisx, GlobalContext* globalCtx) { if (this->infoIdx == EN_POH_INFO_COMPOSER) { Color_RGBA8* envColor = (this->actor.params == EN_POH_SHARP) ? &D_80AE1B4C : &D_80AE1B50; s32 pad; + gSPDisplayList(POLY_OPA_DISP++, gPoeComposerLanternBottomDL); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, envColor->r, envColor->g, envColor->b, 255); diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c index 94b5bb73e8..d59e6a3aa3 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -482,6 +482,7 @@ void func_80AEB7D0(EnRu1* this) { f32 func_80AEB7E0(CsCmdActorAction* csCmdNPCAction, GlobalContext* globalCtx) { s32 csCtxFrames = globalCtx->csCtx.frames; + if ((csCtxFrames < csCmdNPCAction->endFrame) && (csCmdNPCAction->endFrame - csCmdNPCAction->startFrame > 0)) { return (Math_CosS(((csCtxFrames - csCmdNPCAction->startFrame) / (f32)(csCmdNPCAction->endFrame - csCmdNPCAction->startFrame)) * @@ -548,6 +549,7 @@ void func_80AEBA2C(EnRu1* this, GlobalContext* globalCtx) { f32 temp_ret_2; CsCmdActorAction* csCmdNPCAction = func_80AEB438(globalCtx); s32 pad2; + if (csCmdNPCAction != NULL) { temp_ret_2 = func_80AEB7E0(csCmdNPCAction, globalCtx); thisPos = &this->actor.world.pos; @@ -1513,6 +1515,7 @@ s32 func_80AEE264(EnRu1* this, GlobalContext* globalCtx) { void func_80AEE2F8(EnRu1* this, GlobalContext* globalCtx) { DynaPolyActor* dynaPolyActor; s32 floorBgId; + if ((this->actor.bgCheckFlags & 1) && (this->actor.floorBgId != BGCHECK_SCENE)) { floorBgId = this->actor.floorBgId; dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, floorBgId); diff --git a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c index 134f4681d5..e71470b6b7 100644 --- a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c +++ b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c @@ -314,7 +314,7 @@ void func_80AF2BC0(EnRu2* this, GlobalContext* globalCtx) { } } -void func_80AF2C54(EnRu2* this, UNK_TYPE arg1) { +void func_80AF2C54(EnRu2* this, s32 arg1) { if (arg1 != 0) { this->action = 5; } @@ -355,7 +355,7 @@ void func_80AF2D2C(EnRu2* this, GlobalContext* globalCtx) { } void func_80AF2D6C(EnRu2* this, GlobalContext* globalCtx) { - UNK_TYPE something; + s32 something; func_80AF2744(this, globalCtx); something = EnRu2_UpdateSkelAnime(this); @@ -531,7 +531,7 @@ void func_80AF34F0(EnRu2* this) { this->action = 13; } -void func_80AF3530(EnRu2* this, UNK_TYPE arg1) { +void func_80AF3530(EnRu2* this, s32 arg1) { if (arg1 != 0) { func_80AF28E8(this, &gAdultRutoLookingDownLeftAnim, 0, 0.0f, 0); } @@ -583,7 +583,7 @@ void func_80AF366C(EnRu2* this, GlobalContext* globalCtx) { } void func_80AF36AC(EnRu2* this, GlobalContext* globalCtx) { - UNK_TYPE something; + s32 something; func_80AF2744(this, globalCtx); something = EnRu2_UpdateSkelAnime(this); diff --git a/src/overlays/actors/ovl_En_Sa/z_en_sa.c b/src/overlays/actors/ovl_En_Sa/z_en_sa.c index 1c881ba5d7..991d71c6ab 100644 --- a/src/overlays/actors/ovl_En_Sa/z_en_sa.c +++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.c @@ -591,7 +591,7 @@ void func_80AF683C(EnSa* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); if (!(player->actor.world.pos.z >= -2220.0f) && !Gameplay_InCsMode(globalCtx)) { - globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(spot05_sceneCutsceneData0x005730); + globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(spot05_scene_Cs_005730); gSaveContext.cutsceneTrigger = 1; this->actionFunc = func_80AF68E4; } diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.c b/src/overlays/actors/ovl_En_Skb/z_en_skb.c index 6cac84a15a..75d68d78d9 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -176,6 +176,7 @@ void EnSkb_Init(Actor* thisx, GlobalContext* globalCtx) { void EnSkb_Destroy(Actor* thisx, GlobalContext* globalCtx) { EnSkb* this = THIS; + if (this->actor.parent != NULL) { EnEncount1* spawner = (EnEncount1*)this->actor.parent; @@ -378,6 +379,7 @@ void func_80AFD644(EnSkb* this) { void func_80AFD6CC(EnSkb* this, GlobalContext* globalCtx) { // this cast is likely not real, but allows for a match u8* new_var; + new_var = &this->unk_283; if ((this->unk_283 != 1) || BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, globalCtx, 1)) { if ((*new_var) != 0) { diff --git a/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/src/overlays/actors/ovl_En_Skj/z_en_skj.c index 91350fd622..9fc3577c65 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -1113,6 +1113,7 @@ void EnSkj_SetupWaitForLandAnimFinish(EnSkj* this) { void EnSkj_WaitForLandAnimFinish(EnSkj* this, GlobalContext* globalCtx) { s16 lastFrame = Animation_GetLastFrame(&gSkullKidLandAnim); + if (this->skelAnime.curFrame == lastFrame) { EnSkj_SetupWalkToPlayer(this); } diff --git a/src/overlays/actors/ovl_En_Ta/z_en_ta.c b/src/overlays/actors/ovl_En_Ta/z_en_ta.c index fca2cf0517..fd1fe9eb65 100644 --- a/src/overlays/actors/ovl_En_Ta/z_en_ta.c +++ b/src/overlays/actors/ovl_En_Ta/z_en_ta.c @@ -774,6 +774,7 @@ void func_80B1585C(EnTa* this, GlobalContext* globalCtx) { if (this->superCuccos[i] != NULL) { EnNiw* niw = this->superCuccos[i]; + niw->unk_308 = 1; niw->actor.gravity = 0.0f; } @@ -1181,6 +1182,7 @@ s32 EnTa_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, this->unk_2E0 &= ~0x8; } else if ((limbIndex == 8) || (limbIndex == 10) || (limbIndex == 13)) { s32 limbIdx50 = limbIndex * 50; + rot->y += Math_SinS(globalCtx->state.frames * (limbIdx50 + 0x814)) * 200.0f; rot->z += Math_CosS(globalCtx->state.frames * (limbIdx50 + 0x940)) * 200.0f; } diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.c b/src/overlays/actors/ovl_En_Tite/z_en_tite.c index 25a0769d36..5e0d78cc9a 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -1004,6 +1004,7 @@ void EnTite_Draw(Actor* thisx, GlobalContext* globalCtx) { if ((this->spawnIceTimer & 3) == 0) { Vec3f iceChunk; s32 idx = this->spawnIceTimer >> 2; + iceChunk.x = thisx->world.pos.x + sIceChunks[idx].x; iceChunk.y = thisx->world.pos.y + sIceChunks[idx].y; iceChunk.z = thisx->world.pos.z + sIceChunks[idx].z; diff --git a/src/overlays/actors/ovl_En_Xc/z_en_xc.c b/src/overlays/actors/ovl_En_Xc/z_en_xc.c index 37a6d41e06..f364b580b0 100644 --- a/src/overlays/actors/ovl_En_Xc/z_en_xc.c +++ b/src/overlays/actors/ovl_En_Xc/z_en_xc.c @@ -288,6 +288,7 @@ s32 EnXc_MinuetCS(EnXc* this, GlobalContext* globalCtx) { if (this->actor.params == SHEIK_TYPE_MINUET) { Player* player = GET_PLAYER(globalCtx); f32 z = player->actor.world.pos.z; + if (z < -2225.0f) { if (!Gameplay_InCsMode(globalCtx)) { globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(&gMinuetCs); @@ -347,6 +348,7 @@ s32 EnXc_SerenadeCS(EnXc* this, GlobalContext* globalCtx) { if (this->actor.params == SHEIK_TYPE_SERENADE) { Player* player = GET_PLAYER(globalCtx); s32 stateFlags = player->stateFlags1; + if (CHECK_OWNED_EQUIP(EQUIP_BOOTS, 1) && !(gSaveContext.eventChkInf[5] & 4) && !(stateFlags & 0x20000000) && !Gameplay_InCsMode(globalCtx)) { Cutscene_SetSegment(globalCtx, &gIceCavernSerenadeCs); @@ -491,6 +493,7 @@ void EnXc_SpawnFlame(EnXc* this, GlobalContext* globalCtx) { f32 xPos = npcAction->startPos.x; f32 yPos = npcAction->startPos.y; f32 zPos = npcAction->startPos.z; + this->flameActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_LIGHT, xPos, yPos, zPos, 0, 0, 0, 5); sFlameSpawned = true; } @@ -526,6 +529,7 @@ void EnXc_InitFlame(EnXc* this, GlobalContext* globalCtx) { CsCmdActorAction* npcAction = EnXc_GetCsCmd(globalCtx, 0); if (npcAction != NULL) { s32 action = npcAction->action; + if (D_80B41DA8 != action) { if (action != 1) { EnXc_SpawnFlame(this, globalCtx); @@ -564,6 +568,7 @@ AnimationHeader* EnXc_GetCurrentHarpAnim(GlobalContext* globalCtx, s32 index) { if (npcAction != NULL) { u16 action = npcAction->action; + if (action == 11) { animation = &gSheikPlayingHarp3Anim; } else if (action == 12) { @@ -1570,6 +1575,7 @@ void EnXc_CalcTriforce(Actor* thisx, GlobalContext* globalCtx) { if (this->unk_274 == 1) { if (*timer < kREG(25) + 40.0f) { f32 div = *timer / (kREG(25) + 40.0f); + prim[2] = -85.0f * div + 255; prim[3] = 255.0f * div; env[1] = 100.0f * div + 100; @@ -1584,6 +1590,7 @@ void EnXc_CalcTriforce(Actor* thisx, GlobalContext* globalCtx) { scale[2] = kREG(21) * 0.1f + 40.0f; } else if (this->unk_274 == 2) { f32 maxTime = (kREG(25) + 40.0f) + (kREG(27) + 90.0f); + if (*timer < maxTime) { f32 div = (*timer - (kREG(25) + 40.0f)) / (kREG(27) + 90.0f); scale[0] = (kREG(19) * 0.1f + 40.0f) + div * ((kREG(26) + 50.0f) * (kREG(19) * 0.1f + 40.0f)); diff --git a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.h b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.h index cfbbefc8b2..59ca2fd9e4 100644 --- a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.h +++ b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.h @@ -19,11 +19,11 @@ typedef struct EnZl1 { /* 0x01E6 */ s16 unk_1E6; /* 0x01E8 */ s16 unk_1E8; /* 0x01EA */ char unk_1EA[0x2]; - /* 0x01EC */ UNK_PTR unk_1EC; + /* 0x01EC */ void* unk_1EC; /* 0x01F0 */ char unk_1F0[0x2]; /* 0x01F2 */ s16 unk_1F2; - /* 0x01F4 */ UNK_PTR unk_1F4; - /* 0x01F8 */ UNK_PTR unk_1F8; + /* 0x01F4 */ void* unk_1F4; + /* 0x01F8 */ void* unk_1F8; /* 0x01FC */ s16 unk_1FC; /* 0x01FE */ s16 unk_1FE; /* 0x0200 */ Vec3s unk_200; diff --git a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c index fb59ee0f14..3bf542ca9f 100644 --- a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c +++ b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c @@ -2491,6 +2491,7 @@ s32 func_80B59698(EnZl3* this, GlobalContext* globalCtx) { if (cond) { u8 curSpawn = globalCtx->curSpawn; + if ((func_80B54DB4(this) == 0x20) && (curSpawn == 0) && ((gSaveContext.timer2Value <= 0) || (gSaveContext.timer2State == 0))) { return 1; diff --git a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c index e6d4eb6a82..c3729545dc 100644 --- a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c +++ b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c @@ -82,6 +82,7 @@ void ObjBombiwa_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionCheck_SetInfo(&thisx->colChkInfo, NULL, &sColChkInfoInit); if (thisx->shape.rot.y == 0) { s16 rand = (s16)Rand_ZeroFloat(65536.0f); + thisx->world.rot.y = rand; thisx->shape.rot.y = rand; } diff --git a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c index 5de3e77a9e..4778c0becd 100644 --- a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c +++ b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c @@ -70,10 +70,12 @@ u32 ObjTimeblock_CalculateIsVisible(ObjTimeblock* this) { return this->unk_175; } else { u8 temp = ((this->dyna.actor.params >> 15) & 1) ? true : false; + if (this->unk_177 == 1) { return this->unk_174 ^ temp; } else { u8 linkIsYoung = (LINK_AGE_IN_YEARS == YEARS_CHILD) ? true : false; + return this->unk_174 ^ temp ^ linkIsYoung; } } @@ -254,6 +256,7 @@ void ObjTimeblock_Normal(ObjTimeblock* this, GlobalContext* globalCtx) { void func_80BA06AC(ObjTimeblock* this, GlobalContext* globalCtx) { s32 switchFlag = this->dyna.actor.params & 0x3F; + this->unk_172 = globalCtx->msgCtx.lastPlayedSong; if (this->demoEffectFirstPartTimer > 0 && --this->demoEffectFirstPartTimer == 0) { diff --git a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c index 64830c0a42..93ffcd7fce 100644 --- a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c +++ b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c @@ -191,6 +191,7 @@ s32 func_80BA228C(ObjWarp2block* this, GlobalContext* globalCtx) { s32 func_80BA2304(ObjWarp2block* this, GlobalContext* globalCtx) { s32 ret = this->func_168(this, globalCtx); + this->unk_172 = globalCtx->msgCtx.lastPlayedSong; return ret; diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index a26570d52f..0680070604 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -7418,6 +7418,7 @@ s32 func_80842964(Player* this, GlobalContext* globalCtx) { void func_808429B4(GlobalContext* globalCtx, s32 speed, s32 y, s32 countdown) { s32 quakeIdx = Quake_Add(Gameplay_GetCamera(globalCtx, 0), 3); + Quake_SetSpeed(quakeIdx, speed); Quake_SetQuakeValues(quakeIdx, y, 0, 0, 0); Quake_SetCountdown(quakeIdx, countdown); @@ -11579,6 +11580,7 @@ void func_8084D610(Player* this, GlobalContext* globalCtx) { if (sp34 != 0.0f) { s16 temp = this->actor.shape.rot.y - sp32; + if ((ABS(temp) > 0x6000) && !Math_StepToF(&this->linearVelocity, 0.0f, 1.0f)) { return; } diff --git a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c index 8d31531e40..47610698a2 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c +++ b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c @@ -63,7 +63,7 @@ void EffectSsBubble_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) waterSurfaceY = this->pos.y; - // kill bubble if its out of range of a water box + // kill bubble if it's out of range of a water box if (!WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->pos.x, this->pos.z, &waterSurfaceY, &waterBox)) { this->life = -1; return; diff --git a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c index 92fc8f9e05..ab345ae314 100644 --- a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c @@ -16,7 +16,7 @@ #define rFadeDelay regs[6] #define rScaleStep regs[9] #define rObjBankIdx regs[10] -#define rYAccelStep regs[11] // has no effect due to how its implemented +#define rYAccelStep regs[11] // has no effect due to how it's implemented u32 EffectSsDFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); void EffectSsDFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c b/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c index 7aeda5a1cf..cb9bba2c3c 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c @@ -59,7 +59,7 @@ u32 EffectSsGRipple_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, vo return 1; } -void EffectSsGRipple_DrawRipple(GlobalContext* globalCtx, EffectSs* this, UNK_PTR segment) { +void EffectSsGRipple_DrawRipple(GlobalContext* globalCtx, EffectSs* this, void* segment) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; f32 radius; s32 pad;