diff --git a/src/code_80057C60.c b/src/code_80057C60.c index a17b52bf5..c69c2e3a5 100644 --- a/src/code_80057C60.c +++ b/src/code_80057C60.c @@ -577,7 +577,7 @@ void render_object_p2(void) { gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxLookAt[1]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION); CourseManager_DrawBombKarts(PLAYER_TWO); - //render_bomb_karts_wrap(PLAYER_TWO); + // render_bomb_karts_wrap(PLAYER_TWO); render_object_for_player(PLAYER_TWO); } @@ -588,7 +588,7 @@ void render_object_p3(void) { gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxLookAt[2]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION); CourseManager_DrawBombKarts(PLAYER_THREE); - //render_bomb_karts_wrap(PLAYER_THREE); + // render_bomb_karts_wrap(PLAYER_THREE); render_object_for_player(PLAYER_THREE); } @@ -600,9 +600,9 @@ void render_object_p4(void) { gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxLookAt[3]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION); CourseManager_DrawBombKarts(PLAYER_FOUR); - //render_bomb_karts_wrap(PLAYER_FOUR); + // render_bomb_karts_wrap(PLAYER_FOUR); if ((!gDemoMode) && (gPlayerCountSelection1 == 4)) { - //render_lakitu(PLAYER_FOUR); + // render_lakitu(PLAYER_FOUR); } render_object_for_player(PLAYER_FOUR); } @@ -785,7 +785,7 @@ void render_object_for_player(s32 cameraId) { } if (gModeSelection == BATTLE) { CourseManager_DrawBattleBombKarts(cameraId); - //render_battle_bomb_karts(cameraId); + // render_battle_bomb_karts(cameraId); } } @@ -1122,7 +1122,8 @@ void render_hud_2p_vertical_player_two(void) { void render_hud_lap_3p_4p(s32 playerId) { if (gModeSelection != BATTLE) { if (D_801657F8 && gIsHUDVisible) { - //draw_hud_2d_texture_32x8(playerHUD[playerId].lapX, playerHUD[playerId].lapY, (u8*) common_texture_hud_lap); + // draw_hud_2d_texture_32x8(playerHUD[playerId].lapX, playerHUD[playerId].lapY, (u8*) + // common_texture_hud_lap); draw_hud_2d_texture(playerHUD[playerId].lapX, playerHUD[playerId].lapY, 32, 8, common_texture_hud_lap); draw_lap_count(playerHUD[playerId].lapX - 12, playerHUD[playerId].lapY + 4, playerHUD[playerId].alsoLapCount); @@ -1239,7 +1240,7 @@ void func_8005995C(void) { void func_80059A88(s32 playerId) { func_80059820(playerId); if (!gDemoMode) { - //update_object_lakitu(playerId); // Moved to CourseManager_TickObjects60fps + // update_object_lakitu(playerId); // Moved to CourseManager_TickObjects60fps func_8007BB9C(playerId); } } @@ -1314,7 +1315,7 @@ void func_80059D00(void) { func_80059820(PLAYER_ONE); func_8005B914(); if (!gDemoMode) { - //func_8007AA44(0); + // func_8007AA44(0); } func_80078C70(0); if (playerHUD[PLAYER_ONE].raceCompleteBool == 0) { @@ -1334,14 +1335,14 @@ void func_80059D00(void) { func_80059820(PLAYER_ONE); func_8005D0FC(PLAYER_ONE); if (!gDemoMode) { - //func_8007AA44(0); + // func_8007AA44(0); } func_80078C70(1); func_8005D1F4(0); func_80059820(PLAYER_TWO); func_8005D0FC(PLAYER_TWO); if (!gDemoMode) { - //func_8007AA44(1); + // func_8007AA44(1); } func_80078C70(2); func_8005D1F4(1); @@ -1352,14 +1353,14 @@ void func_80059D00(void) { func_80059820(PLAYER_ONE); func_8005D0FC(PLAYER_ONE); if (!gDemoMode) { - //func_8007AA44(0); + // func_8007AA44(0); } func_80078C70(3); func_8005D1F4(0); func_80059820(PLAYER_TWO); func_8005D0FC(PLAYER_TWO); if (!gDemoMode) { - //func_8007AA44(1); + // func_8007AA44(1); } func_80078C70(4); func_8005D1F4(1); @@ -1372,26 +1373,26 @@ void func_80059D00(void) { func_80059820(PLAYER_ONE); func_8005D0FC(PLAYER_ONE); if (!gDemoMode) { - //func_8007AA44(0); + // func_8007AA44(0); } func_8005D1F4(0); func_80059820(PLAYER_TWO); func_8005D0FC(PLAYER_TWO); if (!gDemoMode) { - //func_8007AA44(1); + // func_8007AA44(1); } func_8005D1F4(1); func_80059820(PLAYER_THREE); func_8005D0FC(PLAYER_THREE); if (!gDemoMode) { - //func_8007AA44(2); + // func_8007AA44(2); } func_8005D1F4(2); if (gPlayerCountSelection1 == 4) { func_80059820(PLAYER_FOUR); func_8005D0FC(PLAYER_FOUR); if ((!gDemoMode) && (gPlayerCountSelection1 == 4)) { - //func_8007AA44(3); + // func_8007AA44(3); } func_8005D1F4(3); } @@ -1412,10 +1413,10 @@ void func_8005A070(void) { if (gIsGamePaused == false) { func_8005C728(); if (gGamestate == ENDING) { - //func_80086604(); - //func_80086D80(); - //update_cheep_cheep(1); - //func_80077640(); + // func_80086604(); + // func_80086D80(); + // update_cheep_cheep(1); + // func_80077640(); CourseManager_TickObjects(); CM_TickParticles(); } else if (gGamestate == CREDITS_SEQUENCE) { @@ -1563,8 +1564,8 @@ void func_8005A3C0(void) { } void func_8005A71C(void) { - //if (GetCourse() == GetBowsersCastle()) { - //func_80081210(); + // if (GetCourse() == GetBowsersCastle()) { + // func_80081210(); //} } @@ -2591,7 +2592,7 @@ void func_8005CB60(s32 playerId, s32 lapCount) { switch (*huhthedeuce) { /* switch 1; irregular */ case 0: /* switch 1 */ break; - case 1: /* switch 1 */ + case 1: /* switch 1 */ CM_ActivateSecondLapLakitu(playerId); // func_80079084(playerId); func_800C9060(playerId, SOUND_ARG_LOAD(0x19, 0x00, 0xF0, 0x15)); if ((GetCourse() == GetLuigiRaceway()) && (D_80165898 == 0) && @@ -2599,7 +2600,7 @@ void func_8005CB60(s32 playerId, s32 lapCount) { D_80165898 = 1; } break; - case 2: /* switch 1 */ + case 2: /* switch 1 */ CM_ActivateFinalLapLakitu(playerId); // func_800790B4(playerId); break; case 3: /* switch 1 */ @@ -5603,16 +5604,16 @@ void func_80068AA4(Player* player, UNUSED s8 arg1, UNUSED f32 arg2, s8 arg3, s8 Vec3f sp64; Vec3s sp5C; - sp64[1] = player->pos[1]; - sp64[2] = player->pos[2]; - sp64[0] = player->pos[0]; + sp64[1] = player->pos[1]; + sp64[2] = player->pos[2]; + sp64[0] = player->pos[0]; if ((player->unk_258[20 + arg4].unk_01C == 1) && (player->animFrameSelector[arg3] < 0xD)) { -if (gTickVisuals) { - sp64[1] = player->pos[1] - 3.0f; - sp64[2] = player->pos[2] + ((-2.5 * player->unk_258[20 + arg4].unk_01E) * coss(player->unk_048[arg3])); - sp64[0] = player->pos[0] + ((-2.5 * player->unk_258[20 + arg4].unk_01E) * sins(player->unk_048[arg3])); -} + if (gTickVisuals) { + sp64[1] = player->pos[1] - 3.0f; + sp64[2] = player->pos[2] + ((-2.5 * player->unk_258[20 + arg4].unk_01E) * coss(player->unk_048[arg3])); + sp64[0] = player->pos[0] + ((-2.5 * player->unk_258[20 + arg4].unk_01E) * sins(player->unk_048[arg3])); + } sp5C[0] = 0; sp5C[1] = player->unk_048[arg3]; sp5C[2] = 0; @@ -6077,13 +6078,14 @@ void render_battle_balloon(Player* player, s8 arg1, s16 arg2, s8 arg3) { func_8004B614(primRed, primGreen, primBlue, envRed, envGreen, envBlue, 0x000000D8); gDPSetRenderMode(gDisplayListHead++, - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_WRAP | ZMODE_XLU | CVG_X_ALPHA | FORCE_BL | - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA), - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_WRAP | ZMODE_XLU | CVG_X_ALPHA | FORCE_BL | - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)); + AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_WRAP | ZMODE_XLU | CVG_X_ALPHA | FORCE_BL | + GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA), + AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_WRAP | ZMODE_XLU | CVG_X_ALPHA | FORCE_BL | + GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)); - gDPLoadTextureBlock(gDisplayListHead++, gTextureBalloon1, G_IM_FMT_CI, G_IM_SIZ_8b, 64, 32, 0, G_TX_NOMIRROR | G_TX_CLAMP, - G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + gDPLoadTextureBlock(gDisplayListHead++, gTextureBalloon1, G_IM_FMT_CI, G_IM_SIZ_8b, 64, 32, 0, + G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, + G_TX_NOLOD); gSPVertex(gDisplayListHead++, gBalloonVertexPlane1, 4, 0); gSPDisplayList(gDisplayListHead++, common_square_plain_render); gDPLoadTextureBlock(gDisplayListHead++, gTextureBalloon2, G_IM_FMT_CI, G_IM_SIZ_8b, 64, 32, 0, @@ -6199,13 +6201,14 @@ void render_balloon(Vec3f arg0, f32 arg1, s16 arg2, s16 arg3) { gDPSetTextureLUT(gDisplayListHead++, G_TT_RGBA16); func_8004B614(primRed, primGreen, primBlue, envRed, envGreen, envBlue, 0x000000D8); gDPSetRenderMode(gDisplayListHead++, - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_WRAP | ZMODE_XLU | CVG_X_ALPHA | FORCE_BL | - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA), - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_WRAP | ZMODE_XLU | CVG_X_ALPHA | FORCE_BL | - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)); + AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_WRAP | ZMODE_XLU | CVG_X_ALPHA | FORCE_BL | + GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA), + AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_WRAP | ZMODE_XLU | CVG_X_ALPHA | FORCE_BL | + GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)); - gDPLoadTextureBlock(gDisplayListHead++, gTextureBalloon1, G_IM_FMT_CI, G_IM_SIZ_8b, 64, 32, 0, G_TX_NOMIRROR | G_TX_CLAMP, - G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + gDPLoadTextureBlock(gDisplayListHead++, gTextureBalloon1, G_IM_FMT_CI, G_IM_SIZ_8b, 64, 32, 0, + G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, + G_TX_NOLOD); gSPVertex(gDisplayListHead++, gBalloonVertexPlane1, 4, 0); gSPDisplayList(gDisplayListHead++, common_square_plain_render); // D_8018D4C0 is correct. But interestingly, IDO seems to set "-0x40" to a different register so the texture still diff --git a/src/port/Engine.h b/src/port/Engine.h index 94f0e4d33..f1166d89e 100644 --- a/src/port/Engine.h +++ b/src/port/Engine.h @@ -81,4 +81,6 @@ uint32_t OTRGetGameRenderWidth(void); uint32_t OTRGetGameRenderHeight(void); uint32_t OTRCalculateCenterOfAreaFromRightEdge(int32_t center); uint32_t OTRCalculateCenterOfAreaFromLeftEdge(int32_t center); +#ifdef __cplusplus +} #endif diff --git a/src/render_objects.c b/src/render_objects.c index d6d6b6a27..a701abd7d 100644 --- a/src/render_objects.c +++ b/src/render_objects.c @@ -511,7 +511,7 @@ void func_800462A8(u8* texture, Vtx* arg1, s32 width, s32 arg3, s32 height) { void func_800463B0(s32 arg0, s32 arg1, u16 arg2, f32 arg3, u8* texture, Vtx* arg5, s32 arg6, s32 arg7, UNUSED s32 arg8, s32 arg9) { - switch(gScreenModeSelection) { + switch (gScreenModeSelection) { case SCREEN_MODE_1P: case SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL: case SCREEN_MODE_2P_SPLITSCREEN_VERTICAL: @@ -528,7 +528,7 @@ void func_800463B0(s32 arg0, s32 arg1, u16 arg2, f32 arg3, u8* texture, Vtx* arg void func_80046424(s32 arg0, s32 arg1, u16 arg2, f32 arg3, u8* texture, Vtx* arg5, s32 arg6, s32 arg7, UNUSED s32 arg8, s32 arg9) { - switch(gScreenModeSelection) { + switch (gScreenModeSelection) { case SCREEN_MODE_1P: case SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL: case SCREEN_MODE_2P_SPLITSCREEN_VERTICAL: @@ -1558,12 +1558,12 @@ void func_8004B72C(s32 primRed, s32 primGreen, s32 primBlue, s32 envRed, s32 env /** * Renders - * + * * Menus: Mario Kart 64 Logo, Debug text - * + * * 1P: Coloured square in third hud mode that players go around. - * - * + * + * */ void render_texture_rectangle(s32 x, s32 y, s32 width, s32 height, s32 s, s32 w, s32 mode) { @@ -1578,23 +1578,21 @@ void render_texture_rectangle(s32 x, s32 y, s32 width, s32 height, s32 s, s32 w, // If no cycle mode is set, render texture rectangle in copy mode if (mode == 0) { //! @todo Update to F3DEX. Uses OLD definition for gspTextureRectangle. - gSPTextureRectangle(gDisplayListHead++, xl, yl, xh, yh, G_TX_RENDERTILE, s << 5, (w << 5), 4 << 10, - 1 << 10); + gSPTextureRectangle(gDisplayListHead++, xl, yl, xh, yh, G_TX_RENDERTILE, s << 5, (w << 5), 4 << 10, 1 << 10); return; } // Render texture rectangle in default cycle mode (1 cycle or 2 cycle) - gSPTextureRectangle(gDisplayListHead++, xl, yl, xh2, yh2, G_TX_RENDERTILE, s << 5, (w << 5), 1 << 10, - 1 << 10); + gSPTextureRectangle(gDisplayListHead++, xl, yl, xh2, yh2, G_TX_RENDERTILE, s << 5, (w << 5), 1 << 10, 1 << 10); } /** * Renders - * + * * For all game modes - * + * * Minimap, CurrLap, Lap time - * - * + * + * */ void render_texture_rectangle_wide(s32 x, s32 y, s32 width, s32 height, s32 arg4, s32 arg5, s32 arg6) { @@ -1613,66 +1611,64 @@ void render_texture_rectangle_wide(s32 x, s32 y, s32 width, s32 height, s32 arg4 s32 coordX2 = 0; if (arg6 == 0) { - switch(gScreenModeSelection) { + switch (gScreenModeSelection) { case SCREEN_MODE_1P: case SCREEN_MODE_3P_4P_SPLITSCREEN: case SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL: if ((xl - (width / 2)) < (SCREEN_WIDTH / 2)) { - coordX = (s32)OTRGetDimensionFromLeftEdge(xl) << 2; - coordX2 = (s32)(xh) << 2; + coordX = (s32) OTRGetDimensionFromLeftEdge(xl) << 2; + coordX2 = (s32) (xh) << 2; } else { - coordX = (s32)OTRGetDimensionFromRightEdge(xl) << 2; - coordX2 = (s32)OTRGetDimensionFromRightEdge(xh) << 2; + coordX = (s32) OTRGetDimensionFromRightEdge(xl) << 2; + coordX2 = (s32) OTRGetDimensionFromRightEdge(xh) << 2; } //! @todo Update to F3DEX. Uses OLD definition for gspTextureRectangle. - gSPWideTextureRectangle(gDisplayListHead++, coordX, yl, coordX2, yh, G_TX_RENDERTILE, arg4 << 5, (arg5 << 5), 4 << 10, - 1 << 10); + gSPWideTextureRectangle(gDisplayListHead++, coordX, yl, coordX2, yh, G_TX_RENDERTILE, arg4 << 5, + (arg5 << 5), 4 << 10, 1 << 10); break; case SCREEN_MODE_2P_SPLITSCREEN_VERTICAL: - gSPTextureRectangle(gDisplayListHead++, xl << 2, yl, xh << 2, yh2, G_TX_RENDERTILE, arg4 << 5, (arg5 << 5), 1 << 10, - 1 << 10); + gSPTextureRectangle(gDisplayListHead++, xl << 2, yl, xh << 2, yh2, G_TX_RENDERTILE, arg4 << 5, + (arg5 << 5), 1 << 10, 1 << 10); break; } -//OTRGetDimensionFromLeftEdge - //gSPTextureRectangle(gDisplayListHead++, xl, yl, xh, yh, G_TX_RENDERTILE, arg4 << 5, (arg5 << 5), 4 << 10, - // 1 << 10); + // OTRGetDimensionFromLeftEdge + // gSPTextureRectangle(gDisplayListHead++, xl, yl, xh, yh, G_TX_RENDERTILE, arg4 << 5, (arg5 << 5), 4 << 10, + // 1 << 10); } else { // minimap - switch(gScreenModeSelection) { + switch (gScreenModeSelection) { case SCREEN_MODE_3P_4P_SPLITSCREEN: if (gPlayerCount == 3) { // Center item in area of screen - s32 center = (s32)((OTRGetDimensionFromRightEdge(SCREEN_WIDTH) - SCREEN_WIDTH) / 2) + ((SCREEN_WIDTH / 4) + (SCREEN_WIDTH / 2)); - s32 coordX = (s32)(center - (width / 2)) << 2; - s32 coordX2 = (s32)(center + (width / 2)) << 2; - gSPWideTextureRectangle(gDisplayListHead++, coordX, yl, - coordX2, yh2, G_TX_RENDERTILE, arg4 << 5, (arg5 << 5), 1 << 10, - 1 << 10); + s32 center = (s32) ((OTRGetDimensionFromRightEdge(SCREEN_WIDTH) - SCREEN_WIDTH) / 2) + + ((SCREEN_WIDTH / 4) + (SCREEN_WIDTH / 2)); + s32 coordX = (s32) (center - (width / 2)) << 2; + s32 coordX2 = (s32) (center + (width / 2)) << 2; + gSPWideTextureRectangle(gDisplayListHead++, coordX, yl, coordX2, yh2, G_TX_RENDERTILE, arg4 << 5, + (arg5 << 5), 1 << 10, 1 << 10); } else { // 4 players s32 renderWidth = SCREEN_WIDTH; s32 center = (renderWidth / 2); - coordX = (s32)(center - (width / 2)) << 2; - coordX2 = (s32)(center + (width / 2)) << 2; - gSPWideTextureRectangle(gDisplayListHead++, coordX, yl, - coordX2, yh2, G_TX_RENDERTILE, arg4 << 5, (arg5 << 5), 1 << 10, - 1 << 10); + coordX = (s32) (center - (width / 2)) << 2; + coordX2 = (s32) (center + (width / 2)) << 2; + gSPWideTextureRectangle(gDisplayListHead++, coordX, yl, coordX2, yh2, G_TX_RENDERTILE, arg4 << 5, + (arg5 << 5), 1 << 10, 1 << 10); } break; default: if ((xl - (width / 2)) < (SCREEN_WIDTH / 2)) { - coordX = (s32)OTRGetDimensionFromLeftEdge(xl) << 2; - coordX2 = (s32)(xh2) << 2; + coordX = (s32) OTRGetDimensionFromLeftEdge(xl) << 2; + coordX2 = (s32) (xh2) << 2; } else { - coordX = (s32)OTRGetDimensionFromRightEdge(xl) << 2; - coordX2 = (s32)OTRGetDimensionFromRightEdge(xh2) << 2; + coordX = (s32) OTRGetDimensionFromRightEdge(xl) << 2; + coordX2 = (s32) OTRGetDimensionFromRightEdge(xh2) << 2; } - gSPWideTextureRectangle(gDisplayListHead++, coordX, yl, - coordX2, yh2, G_TX_RENDERTILE, arg4 << 5, (arg5 << 5), 1 << 10, - 1 << 10); + gSPWideTextureRectangle(gDisplayListHead++, coordX, yl, coordX2, yh2, G_TX_RENDERTILE, arg4 << 5, + (arg5 << 5), 1 << 10, 1 << 10); break; } } - //gSPTextureRectangle(gDisplayListHead++, xl, yl, xh2, yh2, G_TX_RENDERTILE, arg4 << 5, (arg5 << 5), 1 << 10, - // 1 << 10); + // gSPTextureRectangle(gDisplayListHead++, xl, yl, xh2, yh2, G_TX_RENDERTILE, arg4 << 5, (arg5 << 5), 1 << 10, + // 1 << 10); } void render_texture_rectangle_wrap(s32 x, s32 y, s32 width, s32 height, s32 mode) { @@ -1813,7 +1809,7 @@ void func_8004BA98_wide(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 ar phi_a3 = arg3 + arg1; } - switch(gScreenModeSelection) { + switch (gScreenModeSelection) { case SCREEN_MODE_1P: case SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL: render_texture_rectangle_wide(sp34, sp30, sp2C, phi_a3, phi_v0, phi_v1, arg6); @@ -1986,20 +1982,20 @@ void render_texture_tile_rgba32_block(s16 x, s16 y, u8* texture, u32 width, u32 gSPDisplayList(gDisplayListHead++, D_0D007EF8); gDPSetRenderMode(gDisplayListHead++, G_RM_XLU_SURF, G_RM_XLU_SURF2); - + size = width * height * 4; numTiles = size / 4096; if (size % 4096) { numTiles++; } - + tileHeight = height / numTiles; - + numTilesDup = numTiles; for (size_t i = 0; i < numTilesDup; i++) { load_texture_tile_rgba32_nomirror(texture, width, tileHeight); render_texture_rectangle_wrap(currX, currY, width, tileHeight, 1); - + texture += (width * tileHeight * 4); remainingSize = size - (width * tileHeight * 4); if (remainingSize < 0) { @@ -2016,7 +2012,9 @@ void render_texture_tile_rgba32_block(s16 x, s16 y, u8* texture, u32 width, u32 } void render_game_logo(s16 x, s16 y) { - render_texture_tile_rgba32_block(x, y, LOAD_ASSET(gTextureLogoMarioKart64), ResourceGetTexWidthByName(gTextureLogoMarioKart64), ResourceGetTexHeightByName(gTextureLogoMarioKart64)); + render_texture_tile_rgba32_block(x, y, LOAD_ASSET(gTextureLogoMarioKart64), + ResourceGetTexWidthByName(gTextureLogoMarioKart64), + ResourceGetTexHeightByName(gTextureLogoMarioKart64)); } UNUSED void func_8004C91C(s32 arg0, s32 arg1, u8* texture, s32 arg3, s32 arg4, s32 arg5) { @@ -2040,7 +2038,7 @@ void func_8004CA58(s32 arg0, s32 arg1, f32 arg2, u8* texture, s32 arg4, s32 arg5 } void draw_hud_2d_texture_8x8(s32 x, s32 y, u8* texture) { - switch(gScreenModeSelection) { + switch (gScreenModeSelection) { case SCREEN_MODE_1P: case SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL: case SCREEN_MODE_2P_SPLITSCREEN_VERTICAL: @@ -2558,8 +2556,7 @@ void draw_simplified_lap_count(s32 playerId) { draw_hud_2d_texture_32x8((s32) playerHUD[playerId].lapX, playerHUD[playerId].lapY + 3, (u8*) common_texture_hud_lap); draw_hud_2d_texture_32x16(playerHUD[playerId].lapX + 0x1C, (s32) playerHUD[playerId].lapY, - (u8*) gHudLapTextures[playerHUD[playerId].alsoLapCount]); - + (u8*) gHudLapTextures[playerHUD[playerId].alsoLapCount]); } void func_8004E800(s32 playerId) { @@ -2639,13 +2636,13 @@ void func_8004ED40(s32 arg0) { void func_8004EE54(s32 arg0) { if (gIsMirrorMode != 0) { - func_8004D4E8(D_8018D2C0[arg0], D_8018D2D8[arg0], (u8*) D_8018D240, (s32) D_8018D300, - (s32) D_8018D308, (s32) D_8018D310, 0x000000FF, (s32) gMinimapWidth, (s32) gMinimapHeight, - (s32) gMinimapWidth, (s32) gMinimapHeight); + func_8004D4E8(D_8018D2C0[arg0], D_8018D2D8[arg0], (u8*) D_8018D240, (s32) D_8018D300, (s32) D_8018D308, + (s32) D_8018D310, 0x000000FF, (s32) gMinimapWidth, (s32) gMinimapHeight, (s32) gMinimapWidth, + (s32) gMinimapHeight); } else { - func_8004D37C(D_8018D2C0[arg0], D_8018D2D8[arg0], (u8*) D_8018D240, (s32) D_8018D300, - (s32) D_8018D308, (s32) D_8018D310, 0x000000FF, (s32) gMinimapWidth, (s32) gMinimapHeight, - (s32) gMinimapWidth, (s32) gMinimapHeight); + func_8004D37C(D_8018D2C0[arg0], D_8018D2D8[arg0], (u8*) D_8018D240, (s32) D_8018D300, (s32) D_8018D308, + (s32) D_8018D310, 0x000000FF, (s32) gMinimapWidth, (s32) gMinimapHeight, (s32) gMinimapWidth, + (s32) gMinimapHeight); } } @@ -2655,8 +2652,8 @@ void func_8004EF9C(s32 arg0) { temp_v0 = CourseManager_GetProps()->MinimapDimensions.X; temp_t0 = CourseManager_GetProps()->MinimapDimensions.Z; - func_8004D37C(0x00000104, 0x0000003C, CourseManager_GetProps()->MinimapTexture, 0x000000FF, 0x000000FF, 0x000000FF, 0x000000FF, temp_v0, - temp_t0, temp_v0, temp_t0); + func_8004D37C(0x00000104, 0x0000003C, CourseManager_GetProps()->MinimapTexture, 0x000000FF, 0x000000FF, 0x000000FF, + 0x000000FF, temp_v0, temp_t0, temp_v0, temp_t0); } void set_minimap_finishline_position(s32 arg0) { @@ -2664,15 +2661,16 @@ void set_minimap_finishline_position(s32 arg0) { f32 var_f2; s32 center = 0; -//! @todo: Hardcode these x and y values. Because why not? + //! @todo: Hardcode these x and y values. Because why not? if (gPlayerCount == 3) { - center = ((OTRGetDimensionFromRightEdge(SCREEN_WIDTH) - SCREEN_WIDTH) / 2) + ((SCREEN_WIDTH / 4) + (SCREEN_WIDTH / 2)); + center = ((OTRGetDimensionFromRightEdge(SCREEN_WIDTH) - SCREEN_WIDTH) / 2) + + ((SCREEN_WIDTH / 4) + (SCREEN_WIDTH / 2)); } else { center = D_8018D2C0[arg0]; } -//minimap center pos - minimap left edge + offset + // minimap center pos - minimap left edge + offset var_f2 = (center - (gMinimapWidth / 2)) + D_8018D2E0; var_f0 = (D_8018D2D8[arg0] - (gMinimapHeight / 2)) + D_8018D2E8; if (GetCourse() == GetMarioRaceway()) { @@ -2706,11 +2704,12 @@ void func_8004F168(s32 arg0, s32 playerId, s32 characterId) { thing0 = player->pos[0] * D_8018D2A0; thing1 = player->pos[2] * D_8018D2A0; - if (gPlayerCount == 3) { - center = ((OTRGetDimensionFromRightEdge(SCREEN_WIDTH) - SCREEN_WIDTH) / 2) + ((SCREEN_WIDTH / 4) + (SCREEN_WIDTH / 2)); - } else { - center = D_8018D2C0[arg0]; - } + if (gPlayerCount == 3) { + center = ((OTRGetDimensionFromRightEdge(SCREEN_WIDTH) - SCREEN_WIDTH) / 2) + + ((SCREEN_WIDTH / 4) + (SCREEN_WIDTH / 2)); + } else { + center = D_8018D2C0[arg0]; + } temp_a0 = (center - (gMinimapWidth / 2)) + D_8018D2E0 + (s16) (thing0); temp_a1 = (D_8018D2D8[arg0] - (gMinimapHeight / 2)) + D_8018D2E8 + (s16) (thing1); @@ -3265,9 +3264,9 @@ void func_80050E34(s32 playerId, s32 arg1) { gDPLoadTLUT_pal256(gDisplayListHead++, common_tlut_hud_type_C_rank_tiny_font); rsp_load_texture(common_texture_hud_type_C_rank_tiny_font[arg1 + 1], 8, 8); if (spB8 != 0) { - func_80042330_unchanged(spD0 + 0x26, (spC4 + spCC) + 4, 0U, 1.0f, lapCount); + func_80042330_unchanged(spD0 + 0x26, (spC4 + spCC) + 4, 0U, 1.0f); } else { - func_80042330_unchanged(spD0 + 0x1B, (spC4 + spCC) + 4, 0U, 1.0f, lapCount); + func_80042330_unchanged(spD0 + 0x1B, (spC4 + spCC) + 4, 0U, 1.0f); } gSPDisplayList(gDisplayListHead++, D_0D006950); if ((player == gPlayerOne) && (gScreenModeSelection == SCREEN_MODE_1P)) { @@ -3630,7 +3629,8 @@ void func_800528EC(s32 playerId) { objectIndex = gObjectParticle2[var_s3]; if (objectIndex != NULL_OBJECT_ID) { object = &gObjectList[objectIndex]; - if ((object->state > 0) && (playerId == object->unk_084[7]) && (gMatrixHudCount <= MTX_HUD_POOL_SIZE_MAX)) { + if ((object->state > 0) && (playerId == object->unk_084[7]) && + (gMatrixHudCount <= MTX_HUD_POOL_SIZE_MAX)) { rsp_set_matrix_transformation(object->pos, D_80183E80, object->sizeScaling); gSPVertex(gDisplayListHead++, D_0D005BD0, 3, 0); gSPDisplayList(gDisplayListHead++, D_0D006930); @@ -3718,10 +3718,11 @@ void render_balloons_grand_prix(s32 arg0) { gDPLoadTLUT_pal256(gDisplayListHead++, gTLUTOnomatopoeia); func_8004B614(0, 0, 0, 0, 0, 0, 0); gDPSetAlphaCompare(gDisplayListHead++, G_AC_THRESHOLD); - gDPSetRenderMode(gDisplayListHead++, AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL | - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA), - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL | - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)); + gDPSetRenderMode(gDisplayListHead++, + AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL | + GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA), + AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL | + GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)); D_80183E80[0] = 0; D_80183E80[1] = 0x8000; rsp_load_texture(gTextureBalloon1, 64, 32); @@ -4275,9 +4276,9 @@ void func_80056FCC(s32 bombIndex) { D_80183E50[1] = temp_v0->yPos + 1.0; D_80183E50[2] = temp_v0->bombPos[2]; set_transform_matrix(mat, gBombKartCollision[bombIndex].orientationVector, D_80183E50, 0U, 0.5f); - //convert_to_fixed_point_matrix(&gGfxPool->mtxHud[gMatrixHudCount], mat); - //gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxHud[gMatrixHudCount++]), - // G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW); + // convert_to_fixed_point_matrix(&gGfxPool->mtxHud[gMatrixHudCount], mat); + // gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxHud[gMatrixHudCount++]), + // G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW); AddHudMatrix(mat, G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW); gSPDisplayList(gDisplayListHead++, D_0D007B98); } @@ -4357,7 +4358,8 @@ UNUSED void func_800573DC(void) { } void func_800573E4(s32 x, s32 y, s8 str) { - render_texture_rectangle(x, y, 8, 8, (((str % 16) * 8) << 16) >> 16, (((unsigned short) (str / 16)) << 19) >> 16, 0); + render_texture_rectangle(x, y, 8, 8, (((str % 16) * 8) << 16) >> 16, (((unsigned short) (str / 16)) << 19) >> 16, + 0); } void debug_wrap_text(s32* x, s32* y) { diff --git a/src/render_objects.h b/src/render_objects.h index f27730b6e..a4de1b5e7 100644 --- a/src/render_objects.h +++ b/src/render_objects.h @@ -217,6 +217,7 @@ void func_8004C024(s16, s16, s16, u16, u16, u16, u16); void func_8004C148(s16, s16, s16, u16, u16, u16, u16); void func_8004C354(void); void func_8004C35C(void); +void draw_hud_2d_texture(s32, s32, u32, u32, u8*); void draw_hud_2d_texture_wide(s32, s32, u32, u32, u8*); void func_8004C450(s32, s32, u32, u32, u8*); void func_8004C53C(s32, s32, u32, u32, u8*);