1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-04 06:54:33 +00:00

Decompile a bunch of small files (#160)

* Decompile a bunch of small files

* Rename dacrate to dacRate

* Run format.sh

* Minor fixes in PR #160
This commit is contained in:
Random 2020-05-25 23:18:14 +02:00 committed by GitHub
parent 13b1dc03bb
commit 3d050f2861
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 412 additions and 1029 deletions

23
src/code/mtxuty-cvt.c Normal file
View file

@ -0,0 +1,23 @@
#include <global.h>
void MtxConv_F2L(MatrixInternal* m1, MtxF* m2) {
s32 i;
s32 j;
LogUtils_CheckNullPointer("m1", m1, "../mtxuty-cvt.c", 31);
LogUtils_CheckNullPointer("m2", m2, "../mtxuty-cvt.c", 32);
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;
}
}
}
void MtxConv_L2F(MtxF* m1, Mtx* m2) {
LogUtils_CheckNullPointer("m1", m1, "../mtxuty-cvt.c", 55);
LogUtils_CheckNullPointer("m2", m2, "../mtxuty-cvt.c", 56);
func_80102FA0(m1, m2); // guMtxL2F ?
}

View file

@ -272,7 +272,7 @@ void PadMgr_ProcessInputs(PadMgr* padmgr) {
}
input->press.in.button = input->cur.in.button & (input->prev.in.button ^ input->cur.in.button);
input->rel.in.button = input->prev.in.button & (input->prev.in.button ^ input->cur.in.button);
func_800FCC6C(input);
PadUtils_UpdateRelXY(input);
input->press.in.x = (input->cur.in.x - input->prev.in.x) + input->press.in.x;
input->press.in.y = (input->cur.in.y - input->prev.in.y) + input->press.in.y;
}
@ -360,7 +360,7 @@ void PadMgr_RequestPadData(PadMgr* padmgr, Input* inputs, s32 mode) {
newin->cur = pmInputs->cur;
newin->press.in.button = newin->cur.in.button & (newin->prev.in.button ^ newin->cur.in.button);
newin->rel.in.button = newin->prev.in.button & (newin->prev.in.button ^ newin->cur.in.button);
func_800FCC6C(newin);
PadUtils_UpdateRelXY(newin);
newin->press.in.x = (newin->cur.in.x - newin->prev.in.x) + newin->press.in.x;
newin->press.in.y = (newin->cur.in.y - newin->prev.in.y) + newin->press.in.y;
}

93
src/code/padutils.c Normal file
View file

@ -0,0 +1,93 @@
#include <global.h>
void PadUtils_Init(Input* input) {
bzero(input, sizeof(Input));
}
void func_800FCB70() {
}
void PadUtils_ResetPressRel(Input* input) {
input->press.in.button = 0;
input->rel.in.button = 0;
}
u32 PadUtils_CheckCurExact(Input* input, u16 value) {
return value == input->cur.in.button;
}
u32 PadUtils_CheckCur(Input* input, u16 key) {
return key == (input->cur.in.button & key);
}
u32 PadUtils_CheckPressed(Input* input, u16 key) {
return key == (input->press.in.button & key);
}
u32 PadUtils_CheckReleased(Input* input, u16 key) {
return key == (input->rel.in.button & key);
}
u16 PadUtils_GetCurButton(Input* input) {
return input->cur.in.button;
}
u16 PadUtils_GetPressButton(Input* input) {
return input->press.in.button;
}
s8 PadUtils_GetCurX(Input* input) {
return input->cur.in.x;
}
s8 PadUtils_GetCurY(Input* input) {
return input->cur.in.y;
}
void PadUtils_SetRelXY(Input* input, s32 x, s32 y) {
input->rel.in.x = x;
input->rel.in.y = y;
}
s8 PadUtils_GetRelXImpl(Input* input) {
return input->rel.in.x;
}
s8 PadUtils_GetRelYImpl(Input* input) {
return input->rel.in.y;
}
s8 PadUtils_GetRelX(Input* input) {
return PadUtils_GetRelXImpl(input);
}
s8 PadUtils_GetRelY(Input* input) {
return PadUtils_GetRelYImpl(input);
}
void PadUtils_UpdateRelXY(Input* input) {
s32 curX, curY;
s32 relX, relY;
curX = PadUtils_GetCurX(input);
curY = PadUtils_GetCurY(input);
if (curX > 7) {
relX = (curX < 0x43) ? curX - 7 : 0x43 - 7;
} else if (curX < -7) {
relX = (curX > -0x43) ? curX + 7 : -0x43 + 7;
} else {
relX = 0;
}
if (curY > 7) {
relY = (curY < 0x43) ? curY - 7 : 0x43 - 7;
} else if (curY < -7) {
relY = (curY > -0x43) ? curY + 7 : -0x43 + 7;
} else {
relY = 0;
}
PadUtils_SetRelXY(input, relX, relY);
}

View file

@ -935,7 +935,7 @@ void func_800D2A98(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4) {
MtxF mf;
func_800D2A34(&mf, arg1, arg2, arg3, arg4);
func_801064E0(&mf, mtx);
guMtxF2L(&mf, mtx);
}
void func_800D2AE4(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4) {

View file

@ -299,7 +299,7 @@ void func_8009638C(Gfx** displayList, u32 source, u32 tlut, u16 width, u16 heigh
if ((fmt == G_IM_FMT_RGBA) && (SREG(26) == 0)) {
bg->b.frameW = width * 4;
bg->b.frameH = height * 4;
func_80104B00(bg);
guS2DInitBg(bg);
gDPSetOtherMode(displayListHead++, mode0 | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_COPY | G_PM_NPRIMITIVE,
G_AC_THRESHOLD | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2);
gSPBgRectCopy(displayListHead++, bg);