From 32632cacdb316d7f2d3b6ecdb634f0ef9aebadf0 Mon Sep 17 00:00:00 2001 From: MegaMech Date: Wed, 14 May 2025 18:30:32 -0600 Subject: Impl new intro (#193) * Update menus * Update CMakeLists.txt * Add Ship * Impl hm ship actors * Update HM course * Impl new intro * Finish intro scene * Rename * Start Editor Work * raycast works * Fix ScreenRayTrace in widescreen * Basic Actor Picking * wip * Editor use vtx collision * gizmo work * otr works for object picking * Impl objects for editor * actor init * Update * Add all axis move (freemove) * Docking Windows works here * Setup imgui layout for editor * Editor Snap to Ground works * Basic Scene Explorer Works * Editor get actor names * Impl editor object names * impl Editor Play and Pause buttons * Editor translate works while paused * Fix freecam lighting * Added adjustable track properties to editor * Editor matrix, icons, rotation, impl light * Setup Track Properties 1 * Editor tooling wip * Load modded o2rs * Don't enable hud if editor is enabled * Updates * SceneManager nearly working * Fix mario kart 64 intro logo sizing * Fix Rotator * Finish new matrix translation code * Cleanup headers * Cleanup * Cleanup 2 * Cleanup 3 * Prevent divize by zero crash * Add visible circle for translate in all axis * Editor scaling/rot works properly now * Scale All_Axis evenly * Fixes to includes to work on Linux. * Removed overfilled arguments in gfx_create_framebuffer() * Added missing function definitions to Game.h * Editor sun face the camera * Add rotation model to gizmo * Add new handles * Failed attempt at transforming collision * Impl water volume * Import fast64 paths * water surface * Scene Setup 1 * Custom Track O2R almost working needs testing * Custom Track Load path O2r * Render custom track. Wip collision * Add missing function * Debug Spawning Custom O2R Track * Import courses working now * Fix memory leak * Remove New Track Button * Engine.cpp more consistent with sf64 * Fix Editor Enable Button * Editor Accurate mouse click drag objects * Editor selects closest object and cleanup * Gizmo rot and scale collision working * Remove constexpr from IRotator * Impl properties for location/rot/scale * Better Properties display, swap rot handles * Fix content browser dock and editor now disabled by default * Remove GameInfoWindow, Multiplayer Button, and FPS Slider * Disable Editor when its disabled * Add new logo to hm intro * Fix pause menu item box cursor * Remove minimap from Course::from_json and to_json * Impl Import Minimap * Fix custom minimap rendering * minimap uses extension .png * Refactor minimap * Freecam only for player 1 * GrandPrix Balloons work in custom track * Track Id is now std::string and outside of Props * Moved editor assets to be included in ship.o2r * Fixed GenerateO2R to package the correct folder and save to the correct filename * Linux specific changes. * Added "#include " that required them * Changed how the "ship.o2r" file is loaded to allow it to load the file from within appimages. * Changed the Linuxdeploy version to avoid errors later when the Github Actions creates appimages(same fix applied to other ports.) * Revert "Moved editor assets to be included in ship.o2r" This reverts commit 05704c01f761baa67a83e357d9765f5c6b5e3fdb. * Added back files(this time without LUS changes) * Changed workflow file to use correct filename for assets file. * Missed a few spots in the workflow file. * Added .desktop file and made corrections to the main workflow. * Added the rest of upstream CMakeLists.txt * disabled USE_NETWORKING * New InverseMatrix * Renamed both .o2r files to be more accurate to its contents. * Reverted CmakeList.txt --------- Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com> Co-authored-by: sitton76 <58642183+sitton76@users.noreply.github.com> --- src/render_objects.c | 111 +++++++++++++++------------------------------------ 1 file changed, 32 insertions(+), 79 deletions(-) (limited to 'src/render_objects.c') diff --git a/src/render_objects.c b/src/render_objects.c index d3fcaaa64..cd9d8bf76 100644 --- a/src/render_objects.c +++ b/src/render_objects.c @@ -2063,7 +2063,7 @@ 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); - gMKLoadTextureTile(gDisplayListHead++, texture, G_IM_FMT_RGBA, G_IM_SIZ_32b, width, height, 0, 0, width - 1, + gDPLoadTextureTile(gDisplayListHead++, texture, G_IM_FMT_RGBA, G_IM_SIZ_32b, width, height, 0, 0, width - 1, height - 1, 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); gSPWideTextureRectangle(gDisplayListHead++, currX * 4, currY * 4, ((x + width) << 2), ((y + height) << 2), @@ -2695,21 +2695,28 @@ void func_8004EB38(s32 playerId) { } void func_8004ED40(s32 arg0) { - func_8004A2F4(playerHUD[arg0].speedometerX, playerHUD[arg0].speedometerY, 0U, 1.0f, D_8018D300, D_8018D308, - D_8018D310, 0xFF, LOAD_ASSET(common_texture_speedometer), LOAD_ASSET(D_0D0064B0), 64, 96, 64, 48); + func_8004A2F4(playerHUD[arg0].speedometerX, playerHUD[arg0].speedometerY, 0U, 1.0f, + // RGBA + CM_GetProps()->Minimap.Colour.r, CM_GetProps()->Minimap.Colour.g, CM_GetProps()->Minimap.Colour.b, 0xFF, + LOAD_ASSET(common_texture_speedometer), LOAD_ASSET(D_0D0064B0), 64, 96, 64, 48); func_8004A258(D_8018CFEC, D_8018CFF4, D_8016579E, 1.0f, common_texture_speedometer_needle, D_0D005FF0, 0x40, 0x20, 0x40, 0x20); } -void func_8004EE54(s32 arg0) { +// player is only 0 or 1 +void func_8004EE54(s32 playerId) { 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(CM_GetProps()->Minimap.Pos[playerId].X, CM_GetProps()->Minimap.Pos[playerId].Y, (u8*) D_8018D240, + // RGBA + CM_GetProps()->Minimap.Colour.r, CM_GetProps()->Minimap.Colour.g, CM_GetProps()->Minimap.Colour.b, 0xFF, + CM_GetProps()->Minimap.Width, CM_GetProps()->Minimap.Height, CM_GetProps()->Minimap.Width, + CM_GetProps()->Minimap.Height); } 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(CM_GetProps()->Minimap.Pos[playerId].X, CM_GetProps()->Minimap.Pos[playerId].Y, (u8*) D_8018D240, + // RGBA + CM_GetProps()->Minimap.Colour.r, CM_GetProps()->Minimap.Colour.g, CM_GetProps()->Minimap.Colour.b, 0xFF, + CM_GetProps()->Minimap.Width, CM_GetProps()->Minimap.Height, CM_GetProps()->Minimap.Width, + CM_GetProps()->Minimap.Height); } } @@ -2717,13 +2724,13 @@ void func_8004EF9C(s32 arg0) { s16 temp_t0; s16 temp_v0; - temp_v0 = CM_GetProps()->MinimapDimensions.X; - temp_t0 = CM_GetProps()->MinimapDimensions.Z; - func_8004D37C(0x00000104, 0x0000003C, CM_GetProps()->MinimapTexture, 0x000000FF, 0x000000FF, 0x000000FF, + temp_v0 = CM_GetProps()->Minimap.Width; + temp_t0 = CM_GetProps()->Minimap.Height; + func_8004D37C(0x00000104, 0x0000003C, CM_GetProps()->Minimap.Texture, 0x000000FF, 0x000000FF, 0x000000FF, 0x000000FF, temp_v0, temp_t0, temp_v0, temp_t0); } -void set_minimap_finishline_position(s32 arg0) { +void set_minimap_finishline_position(s32 playerId) { f32 var_f0; f32 var_f2; s32 center = 0; @@ -2734,22 +2741,16 @@ void set_minimap_finishline_position(s32 arg0) { center = ((OTRGetDimensionFromRightEdge(SCREEN_WIDTH) - SCREEN_WIDTH) / 2) + ((SCREEN_WIDTH / 4) + (SCREEN_WIDTH / 2)); } else { - center = D_8018D2C0[arg0]; + center = CM_GetProps()->Minimap.Pos[playerId].X; } // 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()) { - var_f0 = var_f0 - 2.0; - } else if (GetCourse() == GetChocoMountain()) { - var_f0 = var_f0 - 16.0; - } else if (GetCourse() == GetKalimariDesert()) { - var_f0 = var_f0 + 4.0; - } + var_f2 = (center - (CM_GetProps()->Minimap.Width / 2)) + CM_GetProps()->Minimap.PlayerX; // (center - (gMinimapWidth / 2)) + gMinimapPlayerX; + var_f0 = (CM_GetProps()->Minimap.Pos[playerId].Y - (CM_GetProps()->Minimap.Height / 2)) + CM_GetProps()->Minimap.PlayerY; // (gMinimapY[arg0] - (gMinimapHeight / 2)) + gMinimapPlayerY + + var_f2 += CM_GetProps()->Minimap.FinishlineX; + var_f0 += CM_GetProps()->Minimap.FinishlineY; - //! @todo Get course minimap props from course. - CM_MinimapFinishlinePosition(); draw_hud_2d_texture_8x8(var_f2, var_f0, (u8*) common_texture_minimap_finish_line); } @@ -2768,18 +2769,18 @@ void func_8004F168(s32 arg0, s32 playerId, s32 characterId) { Player* player = &gPlayerOne[playerId]; if (player->type & (1 << 15)) { - thing0 = player->pos[0] * D_8018D2A0; - thing1 = player->pos[2] * D_8018D2A0; + thing0 = player->pos[0] * CM_GetProps()->Minimap.PlayerScaleFactor; // gMinimapPlayerScale; + thing1 = player->pos[2] * CM_GetProps()->Minimap.PlayerScaleFactor; // gMinimapPlayerScale; if (gPlayerCount == 3) { center = ((OTRGetDimensionFromRightEdge(SCREEN_WIDTH) - SCREEN_WIDTH) / 2) + ((SCREEN_WIDTH / 4) + (SCREEN_WIDTH / 2)); } else { - center = D_8018D2C0[arg0]; + center = CM_GetProps()->Minimap.Pos[arg0].X; } - temp_a0 = (center - (gMinimapWidth / 2)) + D_8018D2E0 + (s16) (thing0); - temp_a1 = (D_8018D2D8[arg0] - (gMinimapHeight / 2)) + D_8018D2E8 + (s16) (thing1); + temp_a0 = (center - (CM_GetProps()->Minimap.Width / 2)) + CM_GetProps()->Minimap.PlayerX + (s16) (thing0); + temp_a1 = (CM_GetProps()->Minimap.Pos[arg0].Y - (CM_GetProps()->Minimap.Height / 2)) + CM_GetProps()->Minimap.PlayerY + (s16) (thing1); if (characterId != 8) { if ((gGPCurrentRaceRankByPlayerId[playerId] == 0) && (gModeSelection != 3) && (gModeSelection != 1)) { #if EXPLICIT_AND == 1 @@ -3685,54 +3686,6 @@ void func_80052E30(UNUSED s32 arg0) { } } -void func_80053D74(s32 objectIndex, UNUSED s32 arg1, s32 vertexIndex) { - Object* object; - - Vtx* vtx = (Vtx*) LOAD_ASSET(common_vtx_hedgehog); - - if (gMatrixHudCount <= MTX_HUD_POOL_SIZE_MAX) { - object = &gObjectList[objectIndex]; - D_80183E80[2] = (s16) (object->unk_084[6] + 0x8000); - rsp_set_matrix_transformation(object->pos, (u16*) D_80183E80, object->sizeScaling); - set_color_render((s32) object->unk_084[0], (s32) object->unk_084[1], (s32) object->unk_084[2], - (s32) object->unk_084[3], (s32) object->unk_084[4], (s32) object->unk_084[5], - (s32) object->primAlpha); - gSPVertex(gDisplayListHead++, &vtx[vertexIndex], 4, 0); - gSPDisplayList(gDisplayListHead++, common_rectangle_display); - } -} - -void render_balloons_grand_prix(s32 arg0) { - s32 var_s1; - s32 objectIndex; - - gSPDisplayList(gDisplayListHead++, D_0D007E98); - 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)); - D_80183E80[0] = 0; - D_80183E80[1] = 0x8000; - rsp_load_texture(gTextureBalloon1, 64, 32); - for (var_s1 = 0; var_s1 < D_80165738; var_s1++) { - objectIndex = gObjectParticle3[var_s1]; - if ((objectIndex != NULL_OBJECT_ID) && (gObjectList[objectIndex].state >= 2)) { - func_80053D74(objectIndex, arg0, 0); - } - } - rsp_load_texture(gTextureBalloon2, 64, 32); - for (var_s1 = 0; var_s1 < D_80165738; var_s1++) { - objectIndex = gObjectParticle3[var_s1]; - if ((objectIndex != NULL_OBJECT_ID) && (gObjectList[objectIndex].state >= 2)) { - func_80053D74(objectIndex, arg0, 4); - } - } -} - void render_object_train_smoke_particle(s32 objectIndex, s32 cameraId) { Camera* camera; -- cgit v1.2.3