1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-14 20:05:02 +00:00

z_en_ko OK (#869)

* .data OK

* Progress

* push some old stuff

* Finish a chain

* Progress

* Progress

* Run mathfixer.py

* Progress

* match one more

* Up to date

* Match func_80A97610

* func_80A96FD0

* most of the way through the mega switch

* small formatting thing. still stuck on the switch

* start a big switch function

* a little closer

* done with matching for now starting objects

* func_80A97738 OK!

* func_80A995CC OK!

* func_80A99864 OK!

* en_ko OK!

* Code clean-up pass

* more EnKo cleanups, object_fa and object_kw1 textures documented

* complete object_km1, more EnKo documentation

* More documentation

* delete asm

* Clean-up rebase issues

* bleh

* Implement Dragorn's suggestions

* fix spec, implement fig's suggestions

* whoops (ill leave it for the docs tho lol)

* whoops again

* i made an ouchie

* smile

* last one for real

Co-authored-by: Louis <35883445+louist103@users.noreply.github.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
This commit is contained in:
mzxrules 2021-07-28 17:59:52 -04:00 committed by GitHub
parent 6f7312a348
commit df5e1c63c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
65 changed files with 1454 additions and 4168 deletions

View file

@ -801,20 +801,16 @@ void Audio_InitHeap(void) {
gAudioContext.audioBufferParameters.samplesPerFrameTarget + 0x10;
gAudioContext.audioBufferParameters.updatesPerFrame =
((gAudioContext.audioBufferParameters.samplesPerFrameTarget + 0x10) / 0xD0) + 1;
gAudioContext.audioBufferParameters.samplesPerUpdate =
(gAudioContext.audioBufferParameters.samplesPerFrameTarget /
gAudioContext.audioBufferParameters.updatesPerFrame) &
~7;
gAudioContext.audioBufferParameters.samplesPerUpdateMax =
gAudioContext.audioBufferParameters.samplesPerUpdate + 8;
gAudioContext.audioBufferParameters.samplesPerUpdateMin =
gAudioContext.audioBufferParameters.samplesPerUpdate - 8;
gAudioContext.audioBufferParameters.samplesPerUpdate = (gAudioContext.audioBufferParameters.samplesPerFrameTarget /
gAudioContext.audioBufferParameters.updatesPerFrame) &
~7;
gAudioContext.audioBufferParameters.samplesPerUpdateMax = gAudioContext.audioBufferParameters.samplesPerUpdate + 8;
gAudioContext.audioBufferParameters.samplesPerUpdateMin = gAudioContext.audioBufferParameters.samplesPerUpdate - 8;
gAudioContext.audioBufferParameters.resampleRate = 32000.0f / (s32)gAudioContext.audioBufferParameters.frequency;
gAudioContext.audioBufferParameters.unkUpdatesPerFrameScaled =
(1.0f / 256.0f) / gAudioContext.audioBufferParameters.updatesPerFrame;
gAudioContext.audioBufferParameters.unk_24 = gAudioContext.audioBufferParameters.updatesPerFrame * 0.25f;
gAudioContext.audioBufferParameters.updatesPerFrameInv =
1.0f / gAudioContext.audioBufferParameters.updatesPerFrame;
gAudioContext.audioBufferParameters.updatesPerFrameInv = 1.0f / gAudioContext.audioBufferParameters.updatesPerFrame;
gAudioContext.unk_2874 = preset->unk_10;
gAudioContext.unk_2878 = preset->unk_12;
@ -825,7 +821,7 @@ void Audio_InitHeap(void) {
}
gAudioContext.unk_2 = preset->unk_14;
gAudioContext.tempoInternalToExternal = (u32)(gAudioContext.audioBufferParameters.updatesPerFrame * 2880000.0f /
gTatumsPerBeat / gAudioContext.unk_2960);
gTatumsPerBeat / gAudioContext.unk_2960);
gAudioContext.unk_2870 = gAudioContext.refreshRate;
gAudioContext.unk_2870 *= gAudioContext.audioBufferParameters.updatesPerFrame;
@ -876,8 +872,8 @@ void Audio_InitHeap(void) {
Audio_NoteInitAll();
Audio_InitNoteFreeList();
gAudioContext.noteSubsEu = Audio_AllocZeroed(&gAudioContext.notesAndBuffersPool,
gAudioContext.audioBufferParameters.updatesPerFrame *
gAudioContext.maxSimultaneousNotes * sizeof(NoteSubEu));
gAudioContext.audioBufferParameters.updatesPerFrame *
gAudioContext.maxSimultaneousNotes * sizeof(NoteSubEu));
for (i = 0; i != 2; i++) {
gAudioContext.abiCmdBufs[i] =

View file

@ -584,8 +584,8 @@ Acmd* func_800DC384(s16* aiBuf, s32 aiBufLen, Acmd* cmd, s32 updateIdx) {
while (i < phi_s2) {
phi_v0 = &gAudioContext.noteSubsEu[sp9C[i] + t];
if (phi_v0->bitField1.s.reverbIndex == phi_s4) {
cmd = func_800DC910(sp9C[i], phi_v0, &gAudioContext.notes[sp9C[i]].synthesisState, aiBuf, aiBufLen,
cmd, updateIdx);
cmd = func_800DC910(sp9C[i], phi_v0, &gAudioContext.notes[sp9C[i]].synthesisState, aiBuf, aiBufLen, cmd,
updateIdx);
} else {
break;
}

View file

@ -165,13 +165,11 @@ AudioTask* func_800E5000(void) {
gAudioContext.curAbiCmdBuf = gAudioContext.abiCmdBufs[gAudioContext.rspTaskIdx];
gAudioContext.aiBufLengths[gAudioContext.curAIBufIdx] =
(s16)((((gAudioContext.audioBufferParameters.samplesPerFrameTarget - sp6C) + 0x80) & 0xFFF0) + 0x10);
if (gAudioContext.aiBufLengths[gAudioContext.curAIBufIdx] <
gAudioContext.audioBufferParameters.minAiBufferLength) {
if (gAudioContext.aiBufLengths[gAudioContext.curAIBufIdx] < gAudioContext.audioBufferParameters.minAiBufferLength) {
gAudioContext.aiBufLengths[gAudioContext.curAIBufIdx] = gAudioContext.audioBufferParameters.minAiBufferLength;
}
if (gAudioContext.audioBufferParameters.maxAiBufferLength <
gAudioContext.aiBufLengths[gAudioContext.curAIBufIdx]) {
if (gAudioContext.audioBufferParameters.maxAiBufferLength < gAudioContext.aiBufLengths[gAudioContext.curAIBufIdx]) {
gAudioContext.aiBufLengths[gAudioContext.curAIBufIdx] = gAudioContext.audioBufferParameters.maxAiBufferLength;
}
@ -192,7 +190,7 @@ AudioTask* func_800E5000(void) {
gAudioContext.aiBufLengths[gAudioContext.curAIBufIdx]);
gAudioContext.audioRandom = osGetCount() * (gAudioContext.audioRandom + gAudioContext.totalTaskCnt);
gAudioContext.audioRandom = gAudioContext.aiBuffers[gAudioContext.curAIBufIdx][gAudioContext.totalTaskCnt & 0xFF] +
gAudioContext.audioRandom;
gAudioContext.audioRandom;
;
gWaveSamples[8] = (s16*)((((u8*)func_800E4FE0)) + (gAudioContext.audioRandom & 0xFFF0));
gAudioContext.currTask->taskQueue = NULL;
@ -536,8 +534,10 @@ s32 func_800E5EDC(void) {
}
void func_800E5F34(void) {
// probably a macro of some type?
s32 chk = -1;s32 sp28;do { } while (osRecvMesg(gAudioContext.audioResetQueueP, &sp28, 0) != chk);
// macro?
// clang-format off
s32 chk = -1; s32 sp28; do { } while (osRecvMesg(gAudioContext.audioResetQueueP, &sp28, 0) != chk);
// clang-format on
}
s32 func_800E5F88(u32 resetPreloadID) {

View file

@ -812,8 +812,9 @@ void func_800EDD68(u8 arg0) {
for (j = 0; j < 9 - gOcarinaSongNotes[i].len; j++) {
for (k = 0; k < gOcarinaSongNotes[i].len && k + j < 8 &&
gOcarinaSongNotes[i].notesIdx[k] == gOcarinaSongNotes[0xC].notesIdx[k + j];
k++)
k++) {
;
}
if (k == gOcarinaSongNotes[i].len) {
D_80131858 = 0xFF;
@ -1445,8 +1446,9 @@ void func_800F2464(void) {
phi_v1 = 9;
}
D_8016E2E0[D_80131F04] = D_8016E2E0[phi_v1];
if (!D_80131F08)
if (!D_80131F08) {
;
}
D_8016E2F8[D_80131F04] = D_8016E2F8[phi_v1];
}
} else {

View file

@ -20,8 +20,7 @@ void func_800F9280(u8 seqIdx, u8 seqId, u8 arg2, u16 fadeTimer) {
arg2 &= 0x7F;
if (arg2 == 0x7F) {
Audio_QueueCmdS32(0x85000000 | ((u8)seqIdx << 16) | (seqId << 8),
((fadeTimer >> 3) * 0x3C * gAudioContext.audioBufferParameters.updatesPerFrame) &
0xFFFF);
((fadeTimer >> 3) * 0x3C * gAudioContext.audioBufferParameters.updatesPerFrame) & 0xFFFF);
} else {
Audio_QueueCmdS32(0x82000000 | ((u8)seqIdx << 16) | (seqId << 8),
(fadeTimer * (u16)gAudioContext.audioBufferParameters.updatesPerFrame) / 4);

View file

@ -36,8 +36,8 @@ s32 Math3D_PlaneVsLineSegClosestPoint(f32 planeAA, f32 planeAB, f32 planeAC, f32
planeIntersectSeg.b.z = (planeIntersectLine.dir.z * 100.0f) + planeIntersectLine.point.z;
// closestPoint is a point on planeIntersect, sp34 is a point on linePointA, linePointB
if (!Math3D_LineVsLineClosestTwoPoints(&planeIntersectSeg.a, &planeIntersectSeg.b, linePointA, linePointB, closestPoint,
&sp34)) {
if (!Math3D_LineVsLineClosestTwoPoints(&planeIntersectSeg.a, &planeIntersectSeg.b, linePointA, linePointB,
closestPoint, &sp34)) {
return false;
}
return true;
@ -80,9 +80,9 @@ s32 Math3D_LineVsLineClosestTwoPoints(Vec3f* lineAPointA, Vec3f* lineAPointB, Ve
compAAlongB = ((lineAx * lineBx) + (lineAy * lineBy) + (lineAz * lineBz)) * scaleB;
compBAAlongB = ((lineBx * (lineAPointA->x - lineBPointA->x)) +
(lineBy * (lineAPointA->y - lineBPointA->y)) +
(lineBz * (lineAPointA->z - lineBPointA->z))) * scaleB;
compBAAlongB = ((lineBx * (lineAPointA->x - lineBPointA->x)) + (lineBy * (lineAPointA->y - lineBPointA->y)) +
(lineBz * (lineAPointA->z - lineBPointA->z))) *
scaleB;
lineAPerpB.x = lineAx - (lineBx * compAAlongB);
lineAPerpB.y = lineAy - (lineBy * compAAlongB);

View file

@ -3268,13 +3268,11 @@ void Interface_Draw(GlobalContext* globalCtx) {
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATERGBA_PRIM, G_CC_MODULATERGBA_PRIM);
gSPMatrix(OVERLAY_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
pauseCtx->cursorVtx[svar3].v.ob[0] = pauseCtx->cursorVtx[18].v.ob[0] = svar2 =
pauseCtx->equipAnimX / 10;
pauseCtx->cursorVtx[17].v.ob[0] = pauseCtx->cursorVtx[19].v.ob[0] = svar2 =
pauseCtx->cursorVtx[svar3].v.ob[0] = pauseCtx->cursorVtx[18].v.ob[0] = svar2 = pauseCtx->equipAnimX / 10;
pauseCtx->cursorVtx[17].v.ob[0] = pauseCtx->cursorVtx[19].v.ob[0] = svar2 =
pauseCtx->cursorVtx[svar3].v.ob[0] + WREG(90) / 10;
pauseCtx->cursorVtx[svar3].v.ob[1] = pauseCtx->cursorVtx[17].v.ob[1] = svar2 =
pauseCtx->equipAnimY / 10;
pauseCtx->cursorVtx[18].v.ob[1] = pauseCtx->cursorVtx[19].v.ob[1] = svar2 =
pauseCtx->cursorVtx[svar3].v.ob[1] = pauseCtx->cursorVtx[17].v.ob[1] = svar2 = pauseCtx->equipAnimY / 10;
pauseCtx->cursorVtx[18].v.ob[1] = pauseCtx->cursorVtx[19].v.ob[1] = svar2 =
pauseCtx->cursorVtx[svar3].v.ob[1] - WREG(90) / 10;
if (pauseCtx->equipTargetItem < 0xBF) {
@ -3293,13 +3291,13 @@ void Interface_Draw(GlobalContext* globalCtx) {
if ((pauseCtx->equipAnimAlpha > 0) && (pauseCtx->equipAnimAlpha < 255)) {
svar1 = (pauseCtx->equipAnimAlpha / 8) / 2;
pauseCtx->cursorVtx[16].v.ob[0] = pauseCtx->cursorVtx[18].v.ob[0] = svar2 =
pauseCtx->cursorVtx[16].v.ob[0] = pauseCtx->cursorVtx[18].v.ob[0] = svar2 =
pauseCtx->cursorVtx[16].v.ob[0] - svar1;
pauseCtx->cursorVtx[17].v.ob[0] = pauseCtx->cursorVtx[19].v.ob[0] = svar2 =
pauseCtx->cursorVtx[17].v.ob[0] = pauseCtx->cursorVtx[19].v.ob[0] = svar2 =
pauseCtx->cursorVtx[16].v.ob[0] + svar1 * 2 + 32;
pauseCtx->cursorVtx[16].v.ob[1] = pauseCtx->cursorVtx[17].v.ob[1] = svar2 =
pauseCtx->cursorVtx[16].v.ob[1] = pauseCtx->cursorVtx[17].v.ob[1] = svar2 =
pauseCtx->cursorVtx[16].v.ob[1] + svar1;
pauseCtx->cursorVtx[18].v.ob[1] = pauseCtx->cursorVtx[19].v.ob[1] = svar2 =
pauseCtx->cursorVtx[18].v.ob[1] = pauseCtx->cursorVtx[19].v.ob[1] = svar2 =
pauseCtx->cursorVtx[16].v.ob[1] - svar1 * 2 - 32;
}
@ -3619,8 +3617,9 @@ void Interface_Draw(GlobalContext* globalCtx) {
break;
case 3:
case 9:
osSyncPrintf("event_xp[1]=%d, event_yp[1]=%d TOTAL_EVENT_TM=%d\n", svar5 = gSaveContext.timerX[1],
svar2 = gSaveContext.timerY[1], gSaveContext.timer2Value);
osSyncPrintf("event_xp[1]=%d, event_yp[1]=%d TOTAL_EVENT_TM=%d\n",
svar5 = gSaveContext.timerX[1], svar2 = gSaveContext.timerY[1],
gSaveContext.timer2Value);
svar1 = (gSaveContext.timerX[1] - 26) / D_8015FFE6;
gSaveContext.timerX[1] -= svar1;
if (gSaveContext.healthCapacity > 0xA0) {
@ -3754,12 +3753,12 @@ void Interface_Draw(GlobalContext* globalCtx) {
svar5 = gSaveContext.timerX[svar6];
svar2 = gSaveContext.timerY[svar6];
OVERLAY_DISP =
Gfx_TextureIA8(OVERLAY_DISP, gClockIconTex, 16, 16, svar5,
svar2 + 2, 16, 16, 1 << 10, 1 << 10);
Gfx_TextureIA8(OVERLAY_DISP, gClockIconTex, 16, 16, svar5, svar2 + 2, 16, 16, 1 << 10, 1 << 10);
// Timer Counter
gDPPipeSync(OVERLAY_DISP++);
gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0);
gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE,
TEXEL0, 0, PRIMITIVE, 0);
if (gSaveContext.timer1State != 0) {
if ((gSaveContext.timer1Value < 10) && (gSaveContext.timer1State < 11)) {

View file

@ -552,7 +552,7 @@ void EnBili_UpdateDamage(EnBili* this, GlobalContext* globalCtx) {
if ((this->actor.colChkInfo.health != 0) && (this->collider.base.acFlags & AC_HIT)) {
this->collider.base.acFlags &= ~AC_HIT;
Actor_SetDropFlag(&this->actor, &this->collider.info, 1);
if ((this->actor.colChkInfo.damageEffect != 0) || (this->actor.colChkInfo.damage != 0)) {
if (Actor_ApplyDamage(&this->actor) == 0) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_BIRI_DEAD);

View file

@ -364,8 +364,8 @@ void EnEiyer_WanderUnderground(EnEiyer* this, GlobalContext* globalCtx) {
if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > 100.0f) {
this->targetYaw = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos) + 0x8000;
} else if (this->targetYaw == this->actor.world.rot.y && Rand_ZeroOne() > 0.99f) {
this->targetYaw = this->actor.world.rot.y +
(Rand_ZeroOne() < 0.5f ? -1 : 1) * (Rand_ZeroOne() * 0x2000 + 0x2000);
this->targetYaw =
this->actor.world.rot.y + (Rand_ZeroOne() < 0.5f ? -1 : 1) * (Rand_ZeroOne() * 0x2000 + 0x2000);
}
Math_ScaledStepToS(&this->actor.world.rot.y, this->targetYaw, 0xB6);

File diff suppressed because it is too large Load diff

View file

@ -6,11 +6,57 @@
struct EnKo;
typedef void (*EnKoActionFunc)(struct EnKo*, GlobalContext*);
typedef struct EnKo {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x1D8];
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ EnKoActionFunc actionFunc;
/* 0x0194 */ s8 headObjectBankIdx;
/* 0x0195 */ s8 bodyObjectBankIdx;
/* 0x0196 */ s8 legsObjectBankIdx;
/* 0x0197 */ s8 osAnimeBankIndex;
/* 0x0198 */ ColliderCylinder collider;
/* 0x01E4 */ Path* path;
/* 0x01E8 */ struct_80034A14_arg1 unk_1E8;
/* 0X0210 */ u8 unk_210; // block trade quest sfx
/* 0x0212 */ s16 forestQuestState;
/* 0x0214 */ s16 blinkTimer;
/* 0x0216 */ s16 eyeTextureIndex;
/* 0x0218 */ f32 appearDist;
/* 0x021C */ f32 lookDist; // distance to start looking at player
/* 0x0220 */ f32 modelAlpha;
/* 0x0224 */ Vec3s jointTable[16];
/* 0x0284 */ Vec3s morphTable[16];
/* 0x02E4 */ s16 unk_2E4[16];
/* 0x0304 */ s16 unk_304[16];
} EnKo; // size = 0x0324
extern const ActorInit En_Ko_InitVars;
typedef enum {
ENKO_TYPE_CHILD_0,
ENKO_TYPE_CHILD_1,
ENKO_TYPE_CHILD_2,
ENKO_TYPE_CHILD_3,
ENKO_TYPE_CHILD_4,
ENKO_TYPE_CHILD_5, // Shop Awning
ENKO_TYPE_CHILD_6,
ENKO_TYPE_CHILD_7,
ENKO_TYPE_CHILD_8,
ENKO_TYPE_CHILD_9,
ENKO_TYPE_CHILD_10,
ENKO_TYPE_CHILD_11,
ENKO_TYPE_CHILD_FADO,
ENKO_TYPE_CHILD_MAX
} KokiriChildren;
typedef enum {
ENKO_FQS_CHILD_START,
ENKO_FQS_CHILD_STONE,
ENKO_FQS_CHILD_SARIA,
ENKO_FQS_ADULT_ENEMY,
ENKO_FQS_ADULT_SAVED
} KokiriForestQuestState;
#endif

View file

@ -228,7 +228,8 @@ void ObjBean_Move(ObjBean* this) {
}
void ObjBean_SetDrawMode(ObjBean* this, u8 drawFlag) {
this->stateFlags &= ~(BEAN_STATE_DRAW_LEAVES | BEAN_STATE_DRAW_PLANT | BEAN_STATE_DRAW_STALK | BEAN_STATE_DRAW_SOIL);
this->stateFlags &=
~(BEAN_STATE_DRAW_LEAVES | BEAN_STATE_DRAW_PLANT | BEAN_STATE_DRAW_STALK | BEAN_STATE_DRAW_SOIL);
this->stateFlags |= drawFlag;
}
@ -645,7 +646,7 @@ void ObjBean_SetupWaitForWater(ObjBean* this) {
}
#ifdef NON_MATCHING
//D_80B90E30 isn't being loaded properly
// D_80B90E30 isn't being loaded properly
void ObjBean_WaitForWater(ObjBean* this, GlobalContext* globalCtx) {
this->transformFunc(this);
if (!(this->stateFlags & BEAN_STATE_BEEN_WATERED) && Flags_GetEnv(globalCtx, 5) && (D_80B90E30 == NULL) &&