From 1940c26bce9a78bcdbe08117049b9e3a1e970805 Mon Sep 17 00:00:00 2001 From: KiritoDv Date: Mon, 8 Apr 2024 20:54:05 -0600 Subject: [PATCH] Fixed vs --- src/engine/fox_hud.c | 11 +++---- src/engine/fox_radio.c | 6 ++-- src/engine/fox_versus.c | 57 +++++++------------------------------ src/engine/guPerspectiveF.c | 6 ++-- src/libultra/gu/mtxutil.c | 10 +++---- src/sys/sys_main.c | 16 +++++------ src/sys/sys_matrix.c | 2 +- 7 files changed, 34 insertions(+), 74 deletions(-) diff --git a/src/engine/fox_hud.c b/src/engine/fox_hud.c index 1b51f4aa..ae3245a4 100644 --- a/src/engine/fox_hud.c +++ b/src/engine/fox_hud.c @@ -586,7 +586,8 @@ void HUD_VenomTitleCard_Draw(void) { RCP_SetupDL(&gMasterDisp, SETUPDL_76); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255); - Lib_TextureRect_IA8(&gMasterDisp, D_800D1C9C[i], D_800D1CA4[i], 19, D_800D1CB4[i], D_800D1CBC[i] - 28.0f, 1.0f, 1.0f); + Lib_TextureRect_IA8(&gMasterDisp, D_800D1C9C[i], D_800D1CA4[i], 19, D_800D1CB4[i], D_800D1CBC[i] - 28.0f, 1.0f, + 1.0f); } } @@ -663,9 +664,8 @@ void HUD_TitleCard_Draw(f32 x, f32 y) { HUD_VenomTitleCard_Draw(); } - Lib_TextureRect_IA8(&gMasterDisp, - sLevelTitleCard[levelIdx].titleCardTex, - sLevelTitleCard[levelIdx].titleCardWidth, sLevelTitleCard[levelIdx].titleCardHeight, x2, y2, 1.0f, 1.0f); + Lib_TextureRect_IA8(&gMasterDisp, sLevelTitleCard[j].titleCardTex, sLevelTitleCard[j].titleCardWidth, sLevelTitleCard[j].titleCardHeight, x2, y2, 1.0f, + 1.0f); if ((gSavedObjectLoadIndex == 0) && (gAllRangeCheckpoint == 0) && (gCurrentLevel != LEVEL_VENOM_ANDROSS) && (gCurrentLevel != LEVEL_TRAINING)) { @@ -1614,7 +1614,8 @@ void HUD_PauseScreen_Update(void) { RCP_SetupDL(&gMasterDisp, SETUPDL_76); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255); - Lib_TextureRect_IA8(&gMasterDisp, sLevelTitleCard[j].titleCardTex, sLevelTitleCard[j].titleCardWidth, sLevelTitleCard[j].titleCardHeight, x2, y2 + i, 1.0f, 1.0f); + Lib_TextureRect_IA8(&gMasterDisp, sLevelTitleCard[j].titleCardTex, sLevelTitleCard[j].titleCardWidth, sLevelTitleCard[j].titleCardHeight, x2, + y2 + i, 1.0f, 1.0f); HUD_MsgWindowBg_Draw2(x1 - 10.0f, y0 - 4.0f, 4.7f, 2.8f); diff --git a/src/engine/fox_radio.c b/src/engine/fox_radio.c index 881dee6d..48ddb59e 100644 --- a/src/engine/fox_radio.c +++ b/src/engine/fox_radio.c @@ -428,12 +428,10 @@ void func_radio_800BAAE8(void) { if (mirror) { Lib_TextureRect_RGBA16_MirX(&gMasterDisp, radioPortraitTex, 44, 44, gRadioPortraitPosX, - gRadioPortraitPosY + 20.0f + sp38 + gRadioPortraitScaleY, 1.0f, - gRadioPortraitScaleY); + gRadioPortraitPosY + 20.0f + sp38 + gRadioPortraitScaleY, 1.0f, gRadioPortraitScaleY); } else { Lib_TextureRect_RGBA16(&gMasterDisp, radioPortraitTex, 44, 44, gRadioPortraitPosX, - gRadioPortraitPosY + 20.0f + sp38 + gRadioPortraitScaleY, 1.0f, - gRadioPortraitScaleY); + gRadioPortraitPosY + 20.0f + sp38 + gRadioPortraitScaleY, 1.0f, gRadioPortraitScaleY); } } } diff --git a/src/engine/fox_versus.c b/src/engine/fox_versus.c index 9b39e5ea..8ad870d2 100644 --- a/src/engine/fox_versus.c +++ b/src/engine/fox_versus.c @@ -88,72 +88,39 @@ void func_versus_800BC88C(f32 xPos, f32 yPos, f32 scale) { } void func_versus_800BC8D8(f32 xPos, f32 yPos, f32 scale) { - s32 i; - - for (i = 0; i < 2; i++) { - Lib_TextureRect_CI8(&gMasterDisp, D_versus_300A470 + (152 * 8 * i), D_versus_300B218, 152, 8, xPos, - yPos + (8 * i * scale), scale, scale); - } - - Lib_TextureRect_CI8(&gMasterDisp, D_versus_300A470 + (152 * 8 * i), D_versus_300B218, 152, 7, xPos, - yPos + (8 * i * scale), scale, scale); + Lib_TextureRect_CI8(&gMasterDisp, D_versus_300A470, D_versus_300B218, 152, 23, xPos, yPos, scale, scale); } void func_versus_800BC9DC(f32 xPos, f32 yPos, f32 scale, s32 yScale) { u16* D_800D4AA4[] = { D_versus_3008DE0, D_versus_30098C0, D_versus_300A390 }; u8* D_800D4ABC[] = { D_versus_30087A0, D_versus_3008EC0, D_versus_3009990 }; s32 D_800D4AB0[] = { 40, 64, 64 }; - s32 i; - for (i = 0; i < 5; i++) { - Lib_TextureRect_CI8(&gMasterDisp, D_800D4ABC[yScale] + (D_800D4AB0[yScale] * 8 * i), D_800D4AA4[yScale], - D_800D4AB0[yScale], 8, xPos, yPos + (8 * i * scale), scale, scale); - } + Lib_TextureRect_CI8(&gMasterDisp, D_800D4ABC[yScale], D_800D4AA4[yScale], D_800D4AB0[yScale], 40, xPos, yPos, scale, + scale); } void func_versus_800BCB44(f32 xPos, f32 yPos, f32 scale) { - s32 i; - - for (i = 0; i < 2; i++) { - Lib_TextureRect_CI8(&gMasterDisp, D_versus_3006C60 + (96 * 8 * i), D_versus_3007500, 96, 8, xPos, - yPos + (8 * i * scale), scale, scale); - } - Lib_TextureRect_CI8(&gMasterDisp, D_versus_3006C60 + (96 * 8 * i), D_versus_3007500, 96, 7, xPos, - yPos + (8 * i * scale), scale, scale); + Lib_TextureRect_CI8(&gMasterDisp, D_versus_3006C60, D_versus_3007500, 96, 23, xPos, yPos, scale, scale); } void func_versus_800BCC48(f32 xPos, f32 yPos, f32 xScale, f32 yScale, s32 arg4) { u16* D_800D4AC8[] = { D_versus_3006A68, D_versus_3008598, D_versus_300C458, D_versus_3005E38 }; u8* D_800D4AD8[] = { D_versus_3006040, D_versus_30076C0, D_versus_300B3F0, D_versus_3004F60 }; s32 D_800D4AE8[] = { 104, 152, 168, 152 }; - s32 i; - for (i = 0; i < 3; i++) { - Lib_TextureRect_CI8(&gMasterDisp, D_800D4AD8[arg4] + (D_800D4AE8[arg4] * 8 * i), D_800D4AC8[arg4], - D_800D4AE8[arg4], 8, xPos, yPos + (8 * i * yScale), xScale, yScale); - } - Lib_TextureRect_CI8(&gMasterDisp, D_800D4AD8[arg4] + (D_800D4AE8[arg4] * 8 * i), D_800D4AC8[arg4], D_800D4AE8[arg4], - 1, xPos, yPos + (8 * i * yScale), xScale, yScale); + Lib_TextureRect_CI8(&gMasterDisp, D_800D4AD8[arg4], D_800D4AC8[arg4], D_800D4AE8[arg4], 25, xPos, yPos, xScale, + yScale); } void func_versus_800BCE24(f32 xPos, f32 yPos, f32 xScale, f32 yScale) { - s32 i; - - for (i = 0; i < 6; i++) { - Lib_TextureRect_CI8(&gMasterDisp, D_versus_3001420 + (256 * 7 * i), D_versus_3003E20, 256, 7, xPos, - yPos + (7 * i * yScale), xScale, yScale); - } + Lib_TextureRect_CI8(&gMasterDisp, D_versus_3001420, D_versus_3003E20, 256, 42, xPos, yPos, xScale, yScale); } void func_versus_800BCEF8(f32 xPos, f32 yPos, f32 scale) { s32 i; - for (i = 0; i < 12; i++) { - Lib_TextureRect_CI8(&gMasterDisp, D_versus_3004010 + (136 * 2 * i), D_versus_3004D58, 136, 2, xPos, - yPos + (2 * i * scale), scale, scale); - } - Lib_TextureRect_CI8(&gMasterDisp, D_versus_3004010 + (136 * 2 * i), D_versus_3004D58, 136, 1, xPos, - yPos + (2 * i * scale), scale, scale); + Lib_TextureRect_CI8(&gMasterDisp, D_versus_3004010, D_versus_3004D58, 136, 25, xPos, yPos, scale, scale); } void func_versus_800BCFFC(f32 xPos, f32 yPos, f32 xScale, f32 yScale) { @@ -203,12 +170,8 @@ void func_versus_800BD350(f32 xPos, f32 yPos) { void func_versus_800BD3A8(f32 xPos, f32 yPos) { s32 i; - for (i = 0; i < 8; i++) { - Lib_TextureRect_CI4(&gMasterDisp, aVsHandicapFrameTex + ((80 * 8 * i) / 2), aVsHandicapFrameTLUT, 80, 8, xPos, - yPos + (i * 8), 1.0f, 1.0f); - } - Lib_TextureRect_CI4(&gMasterDisp, aVsHandicapFrameTex + ((80 * 8 * i) / 2), aVsHandicapFrameTLUT, 80, 7, xPos, - yPos + (i * 8), 1.0f, 1.0f); + Lib_TextureRect_CI4(&gMasterDisp, aVsHandicapFrameTex + ((80 * 8 * i) / 2), aVsHandicapFrameTLUT, 80, 71, xPos, yPos, 1.0f, + 1.0f); } void func_versus_800BD4D4(f32 xPos, f32 yPos, s32 arg2) { diff --git a/src/engine/guPerspectiveF.c b/src/engine/guPerspectiveF.c index c567194d..83fd923d 100644 --- a/src/engine/guPerspectiveF.c +++ b/src/engine/guPerspectiveF.c @@ -2,8 +2,7 @@ #include #include "libc/math.h" -void guPerspectiveF(float mf[4][4], u16 *perspNorm, float fovy, float aspect, float near, float far, - float scale) { +void guPerspectiveF(float mf[4][4], u16* perspNorm, float fovy, float aspect, float near, float far, float scale) { float yscale; int row; int col; @@ -33,8 +32,7 @@ void guPerspectiveF(float mf[4][4], u16 *perspNorm, float fovy, float aspect, fl } } -void guPerspective(Mtx *m, u16 *perspNorm, float fovy, float aspect, float near, float far, - float scale) { +void guPerspective(Mtx* m, u16* perspNorm, float fovy, float aspect, float near, float far, float scale) { float mat[4][4]; guPerspectiveF(mat, perspNorm, fovy, aspect, near, far, scale); guMtxF2L(mat, m); diff --git a/src/libultra/gu/mtxutil.c b/src/libultra/gu/mtxutil.c index a89c46ec..e2da48e8 100644 --- a/src/libultra/gu/mtxutil.c +++ b/src/libultra/gu/mtxutil.c @@ -35,14 +35,14 @@ void guMtxL2F(float mf[4][4], Mtx* m) { u32* m1; u32* m2; s32 stmp1, stmp2; - m1 = (u32*)&m->m[0][0]; - m2 = (u32*)&m->m[2][0]; + m1 = (u32*) &m->m[0][0]; + m2 = (u32*) &m->m[2][0]; for (r = 0; r < 4; r++) { for (c = 0; c < 2; c++) { tmp1 = (*m1 & 0xffff0000) | ((*m2 >> 0x10) & 0xffff); tmp2 = ((*m1++ << 0x10) & 0xffff0000) | (*m2++ & 0xffff); - stmp1 = *(s32*)&tmp1; - stmp2 = *(s32*)&tmp2; + stmp1 = *(s32*) &tmp1; + stmp2 = *(s32*) &tmp2; mf[r][c * 2 + 0] = stmp1 / 65536.0f; mf[r][c * 2 + 1] = stmp2 / 65536.0f; } @@ -68,4 +68,4 @@ void guMtxIdent(Mtx* m) { guMtxIdentF(mf); guMtxF2L(mf, m); -} \ No newline at end of file +} diff --git a/src/sys/sys_main.c b/src/sys/sys_main.c index 31ca2913..ae3fcd75 100644 --- a/src/sys/sys_main.c +++ b/src/sys/sys_main.c @@ -247,7 +247,7 @@ void Graphics_ThreadEntry(void* arg0) { // } } -void Graphics_ThreadUpdate(){ +void Graphics_ThreadUpdate() { if (GfxDebuggerIsDebugging()) { Graphics_PushFrame(gGfxPool->masterDL); @@ -279,7 +279,7 @@ void Graphics_ThreadUpdate(){ osRecvMesg(&gGfxTaskMsgQueue, NULL, OS_MESG_BLOCK); Graphics_SetTask(); - if(GfxDebuggerIsDebuggingRequested()) { + if (GfxDebuggerIsDebuggingRequested()) { GfxDebuggerDebugDisplayList(gGfxPool->masterDL); } @@ -289,7 +289,6 @@ void Graphics_ThreadUpdate(){ osViSwapBuffer(&gFrameBuffers[(gSysFrameCount - 1) % 3]); } - // LTODO: FAULT_CRASH // func_80007FE4(&gFrameBuffers[(gSysFrameCount - 1) % 3], SCREEN_WIDTH, 16); @@ -450,7 +449,6 @@ void Main_ThreadEntry(void* arg0) { // LTODO: Implement timers // Timer_ThreadEntry(NULL); - // N64 Stuff should not be needed // Main_InitMesgQueues(); // while (true) { @@ -485,20 +483,22 @@ void Idle_ThreadEntry(void* arg0) { // Main_SetVIMode(); // Lib_FillScreen(1); // osCreatePiManager(OS_PRIORITY_PIMGR, &gPiMgrCmdQueue, sPiMgrCmdBuff, ARRAY_COUNT(sPiMgrCmdBuff)); - // osCreateThread(&gMainThread, THREAD_ID_MAIN, &Main_ThreadEntry, arg0, sMainThreadStack + sizeof(sMainThreadStack), + // osCreateThread(&gMainThread, THREAD_ID_MAIN, &Main_ThreadEntry, arg0, sMainThreadStack + + // sizeof(sMainThreadStack), // 100); // osStartThread(&gMainThread); // Fault_Init(); // osSetThreadPri(NULL, OS_PRIORITY_IDLE); -// loop_1: -// goto loop_1; + // loop_1: + // goto loop_1; } void bootproc(void) { // RdRam_CheckIPL3(); // osInitialize(); Main_Initialize(); - // osCreateThread(&sIdleThread, THREAD_ID_IDLE, &Idle_ThreadEntry, NULL, sIdleThreadStack + sizeof(sIdleThreadStack), + // osCreateThread(&sIdleThread, THREAD_ID_IDLE, &Idle_ThreadEntry, NULL, sIdleThreadStack + + // sizeof(sIdleThreadStack), // 255); // osStartThread(&sIdleThread); } diff --git a/src/sys/sys_matrix.c b/src/sys/sys_matrix.c index 5426b040..7fbd89ca 100644 --- a/src/sys/sys_matrix.c +++ b/src/sys/sys_matrix.c @@ -1,6 +1,6 @@ #include "sys.h" -#define qs1616(e) ((s32)((e)*0x00010000)) +#define qs1616(e) ((s32) ((e) * 0x00010000)) #define IPART(x) ((qs1616(x) >> 16) & 0xFFFF) #define FPART(x) (qs1616(x) & 0xFFFF)