diff --git a/asm/non_matchings/render_objects/func_8004F168.s b/asm/non_matchings/render_objects/func_8004F168.s index 8f51fc84e..c3a234557 100644 --- a/asm/non_matchings/render_objects/func_8004F168.s +++ b/asm/non_matchings/render_objects/func_8004F168.s @@ -15,13 +15,13 @@ glabel func_8004F168 /* 04FD9C 8004F19C 01CF1821 */ addu $v1, $t6, $t7 /* 04FDA0 8004F1A0 94780000 */ lhu $t8, ($v1) /* 04FDA4 8004F1A4 00A03825 */ move $a3, $a1 -/* 04FDA8 8004F1A8 3C018019 */ lui $at, %hi(D_8018D2A0) # $at, 0x8019 +/* 04FDA8 8004F1A8 3C018019 */ lui $at, %hi(gMinimapPlayerScale) # $at, 0x8019 /* 04FDAC 8004F1AC 33198000 */ andi $t9, $t8, 0x8000 /* 04FDB0 8004F1B0 13200088 */ beqz $t9, .L8004F3D4 /* 04FDB4 8004F1B4 00044040 */ sll $t0, $a0, 1 -/* 04FDB8 8004F1B8 C420D2A0 */ lwc1 $f0, %lo(D_8018D2A0)($at) +/* 04FDB8 8004F1B8 C420D2A0 */ lwc1 $f0, %lo(gMinimapPlayerScale)($at) /* 04FDBC 8004F1BC C4640014 */ lwc1 $f4, 0x14($v1) -/* 04FDC0 8004F1C0 3C098019 */ lui $t1, %hi(D_8018D2C0) # 0x8019 +/* 04FDC0 8004F1C0 3C098019 */ lui $t1, %hi(gMinimapX) # 0x8019 /* 04FDC4 8004F1C4 C466001C */ lwc1 $f6, 0x1c($v1) /* 04FDC8 8004F1C8 46002082 */ mul.s $f2, $f4, $f0 /* 04FDCC 8004F1CC 01284821 */ addu $t1, $t1, $t0 @@ -29,11 +29,11 @@ glabel func_8004F168 /* 04FDD4 8004F1D4 3C0C8019 */ lui $t4, %hi(gMinimapWidth) # $t4, 0x8019 /* 04FDD8 8004F1D8 858CD2B0 */ lh $t4, %lo(gMinimapWidth)($t4) /* 04FDDC 8004F1DC 854AD2F0 */ lh $t2, %lo(D_8018D2F0)($t2) -/* 04FDE0 8004F1E0 8529D2C0 */ lh $t1, %lo(D_8018D2C0)($t1) # -0x2d40($t1) +/* 04FDE0 8004F1E0 8529D2C0 */ lh $t1, %lo(gMinimapX)($t1) # -0x2d40($t1) /* 04FDE4 8004F1E4 4600120D */ trunc.w.s $f8, $f2 /* 04FDE8 8004F1E8 46003302 */ mul.s $f12, $f6, $f0 -/* 04FDEC 8004F1EC 3C0F8019 */ lui $t7, %hi(D_8018D2E0) # $t7, 0x8019 -/* 04FDF0 8004F1F0 85EFD2E0 */ lh $t7, %lo(D_8018D2E0)($t7) +/* 04FDEC 8004F1EC 3C0F8019 */ lui $t7, %hi(gMinimapPlayerX) # $t7, 0x8019 +/* 04FDF0 8004F1F0 85EFD2E0 */ lh $t7, %lo(gMinimapPlayerX)($t7) /* 04FDF4 8004F1F4 01001025 */ move $v0, $t0 /* 04FDF8 8004F1F8 012A5821 */ addu $t3, $t1, $t2 /* 04FDFC 8004F1FC 05810003 */ bgez $t4, .L8004F20C @@ -43,21 +43,21 @@ glabel func_8004F168 .L8004F20C: /* 04FE0C 8004F20C 44084000 */ mfc1 $t0, $f8 /* 04FE10 8004F210 016D7023 */ subu $t6, $t3, $t5 -/* 04FE14 8004F214 3C0D8019 */ lui $t5, %hi(D_8018D2D8) # 0x8019 +/* 04FE14 8004F214 3C0D8019 */ lui $t5, %hi(gMinimapY) # 0x8019 /* 04FE18 8004F218 01CFC021 */ addu $t8, $t6, $t7 /* 04FE1C 8004F21C 3C0E8019 */ lui $t6, %hi(D_8018D2F8) # $t6, 0x8019 /* 04FE20 8004F220 01A26821 */ addu $t5, $t5, $v0 /* 04FE24 8004F224 00084C00 */ sll $t1, $t0, 0x10 -/* 04FE28 8004F228 85ADD2D8 */ lh $t5, %lo(D_8018D2D8)($t5) # -0x2d28($t5) +/* 04FE28 8004F228 85ADD2D8 */ lh $t5, %lo(gMinimapY)($t5) # -0x2d28($t5) /* 04FE2C 8004F22C 85CED2F8 */ lh $t6, %lo(D_8018D2F8)($t6) /* 04FE30 8004F230 3C198019 */ lui $t9, %hi(gMinimapHeight) # $t9, 0x8019 /* 04FE34 8004F234 4600628D */ trunc.w.s $f10, $f12 /* 04FE38 8004F238 8739D2B8 */ lh $t9, %lo(gMinimapHeight)($t9) /* 04FE3C 8004F23C 00095403 */ sra $t2, $t1, 0x10 /* 04FE40 8004F240 030A2021 */ addu $a0, $t8, $t2 -/* 04FE44 8004F244 3C188019 */ lui $t8, %hi(D_8018D2E8) # $t8, 0x8019 +/* 04FE44 8004F244 3C188019 */ lui $t8, %hi(gMinimapPlayerY) # $t8, 0x8019 /* 04FE48 8004F248 01AE7821 */ addu $t7, $t5, $t6 -/* 04FE4C 8004F24C 8718D2E8 */ lh $t8, %lo(D_8018D2E8)($t8) +/* 04FE4C 8004F24C 8718D2E8 */ lh $t8, %lo(gMinimapPlayerY)($t8) /* 04FE50 8004F250 440E5000 */ mfc1 $t6, $f10 /* 04FE54 8004F254 00046400 */ sll $t4, $a0, 0x10 /* 04FE58 8004F258 000C5C03 */ sra $t3, $t4, 0x10 diff --git a/src/code_80057C60.c b/src/code_80057C60.c index 932550206..24ce0abe7 100644 --- a/src/code_80057C60.c +++ b/src/code_80057C60.c @@ -57,7 +57,6 @@ UNUSED s32 D_801655B8; s32 D_801655BC; s32 D_801655C0; s32 D_801655C4; -s32 D_801655C8; s32 D_801655CC; UNUSED s32 D_801655D0[2]; s32 D_801655D8; @@ -94,13 +93,6 @@ UNUSED s32 D_801656F8[4]; s16 D_80165708; UNUSED s32 D_8016570C; s16 D_80165710; -UNUSED s32 D_80165714; -s16 D_80165718; -UNUSED s32 D_8016571C; -s16 D_80165720; -UNUSED s32 D_80165724; -s16 D_80165728; -UNUSED s32 D_8016572C; s16 D_80165730; UNUSED s32 D_80165734; //! Tracking a count of some object type, don't know what object type yet @@ -186,7 +178,6 @@ s32 D_8016586C; UNUSED s32 D_80165870[2]; s32 D_80165878; s32 D_8016587C; -u8* D_80165880; UNUSED s32 D_80165884; s8 D_80165888; UNUSED s32 D_8016588C; @@ -778,7 +769,7 @@ void render_object_for_player(s32 cameraId) { render_object_leaf_particle(cameraId); if (D_80165730 != 0) { - render_balloons_grand_prix(cameraId); + //render_balloons_grand_prix(cameraId); } if (gModeSelection == BATTLE) { CM_DrawBattleBombKarts(cameraId); @@ -1641,9 +1632,9 @@ void update_object(void) { // update_ferries_smoke_particle(); // break; // } - if (D_80165730 != 0) { - func_80074EE8(); - } + //if (D_80165730 != 0) { + // func_80074EE8(); // Grand prix balloons + //} func_80076F2C(); if ((s16) GetCourse() != GetFrappeSnowland()) { update_leaf(); diff --git a/src/code_80057C60.h b/src/code_80057C60.h index 483d7cbb2..515378aa1 100644 --- a/src/code_80057C60.h +++ b/src/code_80057C60.h @@ -274,7 +274,6 @@ extern s32 D_801655B4; extern s32 D_801655BC; extern s32 D_801655C0; extern s32 D_801655C4; -extern s32 D_801655C8; extern s32 D_801655CC; extern s32 D_801655D8; extern s32 D_801655E8; @@ -300,9 +299,6 @@ extern s16 D_80165710; extern s16 D_80165740; extern s16 D_80165748; -extern s16 D_80165718; -extern s16 D_80165720; -extern s16 D_80165728; // extern s16 gNumActiveThwomps; -> objects.h @@ -358,7 +354,6 @@ extern s32 D_80165860; extern s32 D_8016586C; extern s32 D_80165878; extern s32 D_8016587C; -extern u8* D_80165880; extern s8 D_80165888; extern s8 D_80165890; extern s8 D_80165898; @@ -535,7 +530,7 @@ extern s16 D_8018D210; extern bool D_8018D214; extern s16 D_8018D218; extern s32 D_8018D21C; -extern u8 (*D_8018D220)[1024]; +extern u8 (*gCloudTexture)[1024]; extern s32 D_8018D224; extern u8 D_8018D228; extern s32 D_8018D22C; @@ -543,23 +538,19 @@ extern s32 D_8018D22C; extern uintptr_t D_8018D240; extern u8* D_8018D248[]; -extern f32 D_8018D2A0; +extern f32 gMinimapPlayerScale; extern s32 D_8018D2A4; extern s32 D_8018D2AC; extern s16 gMinimapWidth; extern s32 D_8018D2B4; extern s16 gMinimapHeight; extern s32 D_8018D2BC; -extern s16 D_8018D2C0[]; +extern s16 gMinimapX[]; extern s32 D_8018D2C8[]; -extern s16 D_8018D2D8[]; -extern s16 D_8018D2E0; -extern s16 D_8018D2E8; -extern u16 D_8018D300; -extern u16 D_8018D308; -extern u16 D_8018D310; +extern s16 gMinimapY[]; +extern s16 gMinimapPlayerX; +extern s16 gMinimapPlayerY; extern s32 D_8018D314; -extern u16 D_8018D318; extern s32 D_8018D320; extern s32 D_8018D380; extern s32 D_8018D384; diff --git a/src/code_80057C60_var.c b/src/code_80057C60_var.c index 43340892c..5007e9f48 100644 --- a/src/code_80057C60_var.c +++ b/src/code_80057C60_var.c @@ -98,7 +98,7 @@ s32 D_8018D21C; * Destination for decompressed exhaust textures (I think) * I'm not how much I like this "pointer to an array" setup, but if it matches it matches */ -u8 (*D_8018D220)[1024]; +u8 (*gCloudTexture)[1024]; s32 D_8018D224; u8 D_8018D228; s32 D_8018D22C; @@ -107,7 +107,7 @@ s8 D_8018D230; UNUSED s32 D_8018D238[2]; uintptr_t D_8018D240; u8* D_8018D248[22]; -f32 D_8018D2A0; +f32 gMinimapPlayerScale; s32 D_8018D2A4; UNUSED s32 D_8018D2A8; s32 D_8018D2AC; @@ -115,22 +115,16 @@ s16 gMinimapWidth; s32 D_8018D2B4; s16 gMinimapHeight; s32 D_8018D2BC; -s16 D_8018D2C0[4]; +s16 gMinimapX[4]; s32 D_8018D2C8[4]; -s16 D_8018D2D8[4]; -s16 D_8018D2E0; +s16 gMinimapY[4]; +s16 gMinimapPlayerX; UNUSED s32 D_8018D2E4; -s16 D_8018D2E8; +s16 gMinimapPlayerY; UNUSED s32 D_8018D2EC; UNUSED s32 D_8018D2F4; UNUSED s32 D_8018D2FC; -u16 D_8018D300; -UNUSED s32 D_8018D304; -u16 D_8018D308; -UNUSED s32 D_8018D30C; -u16 D_8018D310; s32 D_8018D314; -u16 D_8018D318; UNUSED s32 D_8018D31C; s32 D_8018D320; UNUSED s32 D_8018D328[22]; diff --git a/src/code_8006E9C0.c b/src/code_8006E9C0.c index e499f3779..d74346d00 100644 --- a/src/code_8006E9C0.c +++ b/src/code_8006E9C0.c @@ -163,11 +163,11 @@ void init_item_window(s32 objectIndex) { } void func_8006EEE8(s32 courseId) { - D_8018D240 = (uintptr_t) CM_GetProps()->MinimapTexture; + D_8018D240 = (uintptr_t) CM_GetProps()->Minimap.Texture; // This is incredibly dumb. MinimapDimensions ought to be something more like // `u16 MinimapDimensions[][2]` but that doesn't match for some insane reason - gMinimapWidth = CM_GetProps()->MinimapDimensions.X; // MinimapDimensions[courseId * 2]; - gMinimapHeight = CM_GetProps()->MinimapDimensions.Z; // MinimapDimensions[courseId * 2 + 1]; + gMinimapWidth = CM_GetProps()->Minimap.Width; // MinimapDimensions[courseId * 2]; + gMinimapHeight = CM_GetProps()->Minimap.Height; // MinimapDimensions[courseId * 2 + 1]; } void func_8006EF60(void) { @@ -186,188 +186,42 @@ void func_8006EF60(void) { } void func_8006F008(void) { - D_801655C8 = 0; xOrientation = 1.0f; if (gIsMirrorMode != 0) { xOrientation = -1.0f; } - D_8018D2C0[0] = 257; - D_8018D2D8[0] = 170; - D_8018D300 = 255; - D_8018D308 = 255; - D_8018D310 = 255; - D_8018D318 = 255; + if (GetCourse() != GetPodiumCeremony()) { func_8006EEE8((s32) gCurrentCourseId); } - CM_MinimapSettings(); - switch (gCurrentCourseId) { - case COURSE_MARIO_RACEWAY: - // D_8018D220 = (void*) dma_textures(gTextureExhaust5, 0x443, 0x1000); - // D_8018D2A0 = 0.022f; - // D_8018D2E0 = 6; - // D_8018D2E8 = 28; - // D_8018D2C0[0] = 260; - // D_8018D2D8[0] = 170; - // D_80165718 = 0; - // D_80165720 = 5; - // D_80165728 = -240; - break; - // case COURSE_CHOCO_MOUNTAIN: - // D_8018D2A0 = 0.022f; - // D_8018D2C0[0] = 265; - // D_8018D2E0 = 19; - // D_8018D2E8 = 37; - // break; - // case COURSE_BOWSER_CASTLE: - // D_8018D2C0[0] = 265; - // D_8018D2A0 = 0.0174f; - // D_8018D2E0 = 12; - // D_8018D2E8 = 48; - // break; - // case COURSE_BANSHEE_BOARDWALK: - // D_80165880 = (void*) dma_textures(gTextureGhosts, 0x4CC2, 0xD980); - // D_8018D2A0 = 0.016f; - // D_8018D2C0[0] = 0x0106; - // D_8018D2E0 = 55; - // D_8018D2E8 = 39; - // break; - // case COURSE_YOSHI_VALLEY: - // D_8018D220 = (void*) dma_textures(gTextureExhaust0, 0x479, 0xC00); - // D_8018D2A0 = 0.018f; - // D_8018D2E0 = 61; - // D_8018D2E8 = 38; - // break; - // case COURSE_FRAPPE_SNOWLAND: - // D_8018D2C0[0] = 262; - // D_8018D2A0 = 0.016f; - // D_8018D2E0 = 36; - // D_8018D2E8 = 40; - // D_8018D300 = 72; - // D_8018D308 = 100; - // D_8018D310 = 255; - // break; - // case COURSE_KOOPA_BEACH: - // D_8018D220 = (void*) dma_textures(gTextureExhaust3, 0x3C8U, 0x1000); - // D_8018D2A0 = 0.014f; - // D_8018D2C0[0] = 268; - // D_8018D2E0 = 40; - // D_8018D2E8 = 21; - // break; - // case COURSE_ROYAL_RACEWAY: - // D_8018D220 = (void*) dma_textures(gTextureExhaust4, 0x3F8, 0x1000); - // D_8018D2C0[0] = 262; - // D_8018D2A0 = 0.014f; - // D_8018D2E0 = 37; - // D_8018D2E8 = 50; - // D_80165718 = -64; - // D_80165720 = 5; - // D_80165728 = -330; - // break; - // case COURSE_LUIGI_RACEWAY: - // D_8018D220 = (void*) dma_textures(gTextureExhaust2, 0x4F4U, 0xC00); - // D_8018D2A0 = 0.0155f; - // D_8018D2C0[0] = 271; - // D_8018D2E0 = 45; - // D_8018D2E8 = 60; - // D_80165718 = -140; - // D_80165720 = -44; - // D_80165728 = -215; - // break; - // case COURSE_MOO_MOO_FARM: - // D_8018D220 = (void*) dma_textures(gTextureExhaust0, 0x479, 0xC00); - // D_8018D2A0 = 0.0155f; - // D_8018D2C0[0] = 271; - // D_8018D2E0 = 18; - // D_8018D2E8 = 36; - // break; - // case COURSE_TOADS_TURNPIKE: - // D_8018D2A0 = 0.013f; - // D_8018D2C0[0] = 252; - // D_8018D2E0 = 57; - // D_8018D2E8 = 44; - // break; - // case COURSE_KALIMARI_DESERT: - // D_8018D2C0[0] = 263; - // D_8018D2D8[0] = 165; - // D_8018D220 = (void*) dma_textures(gTextureExhaust5, 0x443, 0x1000); - // D_8018D2A0 = 0.015f; - // D_8018D2E0 = 55; - // D_8018D2E8 = 27; - // break; - // case COURSE_SHERBET_LAND: - // D_8018D220 = (void*) dma_textures(gTextureExhaust1, 0x485, 0xC00); - // D_8018D2A0 = 0.015f; - // D_8018D2C0[0] = 262; - // D_8018D2E0 = 52; - // D_8018D2E8 = 33; - // D_8018D300 = 72; - // D_8018D308 = 100; - // D_8018D310 = 255; - // break; - // case COURSE_RAINBOW_ROAD: - // D_8018D2A0 = 0.0103f; - // D_8018D2C0[0] = 261; - // D_8018D2D8[0] = 166; - // D_8018D2E0 = 39; - // D_8018D2E8 = 55; - // break; - // case COURSE_WARIO_STADIUM: - // D_8018D2A0 = 0.0155f; - // D_8018D2C0[0] = 0x0106; - // D_8018D2E0 = 53; - // D_8018D2E8 = 35; - // break; - // case COURSE_BLOCK_FORT: - // D_8018D2A0 = 0.0335f; - // D_8018D2E0 = 32; - // D_8018D2E8 = 32; - // break; - // case COURSE_SKYSCRAPER: - // D_8018D2A0 = 0.0445f; - // D_8018D2E0 = 32; - // D_8018D2E8 = 32; - // break; - // case COURSE_DOUBLE_DECK: - // D_8018D2A0 = 0.0285f; - // D_8018D2E0 = 32; - // D_8018D2E8 = 32; - // break; - // case COURSE_DK_JUNGLE: - // D_8018D2A0 = 0.0155f; - // D_8018D2C0[0] = 255; - // D_8018D2E0 = 29; - // D_8018D2E8 = 47; - // break; - // case COURSE_BIG_DONUT: - // D_8018D2A0 = 0.0257f; - // D_8018D2E0 = 32; - // D_8018D2E8 = 31; - } + // Flip the minimap player markers if (gIsMirrorMode != 0) { - D_8018D2E0 = gMinimapWidth - D_8018D2E0; + CM_GetProps()->Minimap.PlayerX = CM_GetProps()->Minimap.Width - CM_GetProps()->Minimap.PlayerX; // gMinimapPlayerX = gMinimapWidth - gMinimapPlayerX } - if (gPlayerCount == 4) { - D_8018D2C0[0] = 160; - D_8018D2D8[0] = 120; - return; - } - if (gPlayerCount == 3) { - D_8018D2C0[0] = 235; - D_8018D2D8[0] = 175; - return; - } - if (gPlayerCount == 2) { - if (GetCourse() != GetToadsTurnpike()) { - D_8018D2C0[1] = 265; - D_8018D2C0[0] = D_8018D2C0[1]; - } else { - D_8018D2C0[1] = 255; - D_8018D2C0[0] = D_8018D2C0[1]; - } - D_8018D2D8[0] = 65; - D_8018D2D8[1] = 180; + + switch(gPlayerCount) { + case 2: + // Set X coord + if (GetCourse() != GetToadsTurnpike()) { + CM_GetProps()->Minimap.Pos[PLAYER_ONE].X = 265; + CM_GetProps()->Minimap.Pos[PLAYER_TWO].X = 265; + } else { + CM_GetProps()->Minimap.Pos[PLAYER_ONE].X = 255; + CM_GetProps()->Minimap.Pos[PLAYER_TWO].X = 255; + } + // Set Y coord + CM_GetProps()->Minimap.Pos[PLAYER_ONE].Y = 65; + CM_GetProps()->Minimap.Pos[PLAYER_TWO].Y = 180; + break; + case 3: + CM_GetProps()->Minimap.Pos[PLAYER_ONE].X = 235; + CM_GetProps()->Minimap.Pos[PLAYER_ONE].Y = 175; + break; + case 4: + CM_GetProps()->Minimap.Pos[PLAYER_ONE].X = 160; + CM_GetProps()->Minimap.Pos[PLAYER_ONE].Y = 120; + break; } } @@ -411,8 +265,9 @@ void func_8006F8CC(void) { D_801657F0 = 1; D_80165800[0] = D_80165800[1] = 0; } - D_8018D2D8[0] = 0x0041; - D_8018D2D8[1] = 0x00B4; + + CM_GetProps()->Minimap.Pos[0].Y = 65; + CM_GetProps()->Minimap.Pos[1].Y = 180; } func_8006F824(0); } else { @@ -639,7 +494,7 @@ void init_cloud_object(s32 objectIndex, s32 arg1, CloudData* arg2) { temp_v0->direction_angle[1] = arg2->rotY; temp_v0->unk_09E = arg2->posY; temp_v0->sizeScaling = (f32) arg2->scalePercent / 100.0; - temp_v0->activeTexture = (u8*) &D_8018D220[arg2->subType]; + temp_v0->activeTexture = ((u8(*)[1024])CM_GetProps()->CloudTexture)[arg2->subType]; func_80073404(objectIndex, 0x40U, 0x20U, D_0D005FB0); temp_v0->primAlpha = 0x00FF; } @@ -757,17 +612,18 @@ void func_8007055C(void) { func_8008C23C(); } +// GrandPrixBalloons related. Spawn location and some sort of bool check void func_80070714(void) { D_80165730 = 1; - if (gPlayerCount == ONE_PLAYERS_SELECTED) { - D_80165738 = 0x64; - D_80165740 = 0x3C; - D_80165748 = 0x1E; - return; - } - D_80165738 = 0x32; - D_80165740 = 0x1E; - D_80165748 = 0xA; + // if (gPlayerCount == ONE_PLAYERS_SELECTED) { + // D_80165738 = 0x64; + // D_80165740 = 0x3C; + // D_80165748 = 0x1E; + // } else { + // D_80165738 = 0x32; + // D_80165740 = 0x1E; + // D_80165748 = 0xA; + // } } void init_course_object(void) { diff --git a/src/engine/AllActors.h b/src/engine/AllActors.h index f6e753761..f2b228b57 100644 --- a/src/engine/AllActors.h +++ b/src/engine/AllActors.h @@ -35,3 +35,5 @@ #include "objects/Trophy.h" #include "objects/Snowman.h" #include "objects/Podium.h" +#include "objects/GrandPrixBalloons.h" + diff --git a/src/engine/CoreMath.h b/src/engine/CoreMath.h index 4ad1f0bd9..2c232aab9 100644 --- a/src/engine/CoreMath.h +++ b/src/engine/CoreMath.h @@ -99,17 +99,17 @@ struct FVector2D { // Sets integer X Z coordinates typedef struct IVector2D { - int32_t X, Z; + int32_t X, Y; #ifdef __cplusplus - IVector2D() : X(0), Z(0) {} // Default constructor + IVector2D() : X(0), Y(0) {} // Default constructor - IVector2D(int32_t x, int32_t z) : X(x), Z(z) {} // Constructor to initialize with values + IVector2D(int32_t x, int32_t y) : X(x), Y(y) {} // Constructor to initialize with values IVector2D& operator=(const IVector2D& other) { X = other.X; - Z = other.Z; + Y = other.Y; return *this; } #endif // __cplusplus diff --git a/src/engine/courses/BansheeBoardwalk.cpp b/src/engine/courses/BansheeBoardwalk.cpp index 0d53c29a3..db8113ba6 100644 --- a/src/engine/courses/BansheeBoardwalk.cpp +++ b/src/engine/courses/BansheeBoardwalk.cpp @@ -70,8 +70,16 @@ BansheeBoardwalk::BansheeBoardwalk() { this->gfx = d_course_banshee_boardwalk_packed_dls; this->gfxSize = 3689; Props.textures = banshee_boardwalk_textures; - Props.MinimapTexture = gTextureCourseOutlineBansheeBoardwalk; - Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); + Props.Minimap.Texture = gTextureCourseOutlineBansheeBoardwalk; + Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture); + Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture); + Props.Minimap.Pos[0].X = 262; + Props.Minimap.Pos[0].Y = 170; + Props.Minimap.PlayerX = 55; + Props.Minimap.PlayerY = 39; + Props.Minimap.PlayerScaleFactor = 0.016f; + Props.Minimap.FinishlineX = 0; + Props.Minimap.FinishlineY = 0; Props.Id = "mk:banshee_boardwalk"; @@ -121,8 +129,6 @@ BansheeBoardwalk::BansheeBoardwalk() { Props.Clouds = NULL; // no clouds Props.CloudList = NULL; - Props.MinimapFinishlineX = 0; - Props.MinimapFinishlineY = 0; Props.Skybox.TopRight = {0, 0, 0}; Props.Skybox.BottomRight = {0, 0, 0}; @@ -190,15 +196,6 @@ void BansheeBoardwalk::BeginPlay() { } } -// Likely sets minimap boundaries -void BansheeBoardwalk::MinimapSettings() { - D_80165880 = dma_textures((const char*)gTextureGhosts, 0x4CC2, 0xD980); - D_8018D2A0 = 0.016f; - D_8018D2C0[0] = 0x0106; - D_8018D2E0 = 55; - D_8018D2E8 = 39; -} - void BansheeBoardwalk::InitCourseObjects() { size_t objectId = 0; if (gGamestate != CREDITS_SEQUENCE) { @@ -256,12 +253,6 @@ void BansheeBoardwalk::WhatDoesThisDoAI(Player* player, int8_t playerId) { } } -// Positions the finishline on the minimap -void BansheeBoardwalk::MinimapFinishlinePosition() { - //! todo: Place hard-coded values here. - draw_hud_2d_texture_8x8(this->Props.MinimapFinishlineX, this->Props.MinimapFinishlineY, (u8*) common_texture_minimap_finish_line); -} - void BansheeBoardwalk::Render(struct UnkStruct_800DC5EC* arg0) { Camera* camera = arg0->camera; Mat4 spCC; diff --git a/src/engine/courses/BansheeBoardwalk.h b/src/engine/courses/BansheeBoardwalk.h index 4d5fc60cc..cc5b72213 100644 --- a/src/engine/courses/BansheeBoardwalk.h +++ b/src/engine/courses/BansheeBoardwalk.h @@ -28,14 +28,12 @@ public: virtual void LoadTextures() override; virtual void BeginPlay() override; //virtual void InitClouds() override; - virtual void MinimapSettings() override; virtual void InitCourseObjects() override; virtual void UpdateCourseObjects() override; virtual void RenderCourseObjects(s32 cameraId) override; virtual void SomeSounds() override; virtual void WhatDoesThisDo(Player* player, int8_t playerId) override; virtual void WhatDoesThisDoAI(Player* player, int8_t playerId) override; - virtual void MinimapFinishlinePosition() override; virtual void Render(struct UnkStruct_800DC5EC*) override; virtual void RenderCredits() override; virtual void ScrollingTextures() override; diff --git a/src/engine/courses/BigDonut.cpp b/src/engine/courses/BigDonut.cpp index bb4300399..4e99828eb 100644 --- a/src/engine/courses/BigDonut.cpp +++ b/src/engine/courses/BigDonut.cpp @@ -43,8 +43,16 @@ BigDonut::BigDonut() { this->gfx = d_course_big_donut_packed_dls; this->gfxSize = 528; Props.textures = big_donut_textures; - Props.MinimapTexture = gTextureCourseOutlineBigDonut; - Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); + Props.Minimap.Texture = gTextureCourseOutlineBigDonut; + Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture); + Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture); + Props.Minimap.Pos[0].X = 257; + Props.Minimap.Pos[0].Y = 170; + Props.Minimap.PlayerX = 32; + Props.Minimap.PlayerY = 31; + Props.Minimap.PlayerScaleFactor = 0.0257f; + Props.Minimap.FinishlineX = 0; + Props.Minimap.FinishlineY = 0; Props.SetText(Props.Name, "big donut", sizeof(Props.Name)); Props.SetText(Props.DebugName, "doughnut", sizeof(Props.DebugName)); @@ -89,8 +97,6 @@ BigDonut::BigDonut() { Props.Clouds = NULL; // no clouds Props.CloudList = NULL; - Props.MinimapFinishlineX = 0; - Props.MinimapFinishlineY = 0; Props.Skybox.TopRight = {0, 0, 0}; Props.Skybox.BottomRight = {0, 0, 0}; @@ -121,9 +127,6 @@ void BigDonut::Load() { func_80295C6C(); } -void BigDonut::LoadTextures() { -} - void BigDonut::BeginPlay() { spawn_all_item_boxes((ActorSpawnData*)LOAD_ASSET_RAW(d_course_big_donut_item_box_spawns)); @@ -140,27 +143,6 @@ void BigDonut::BeginPlay() { } } -// Likely sets minimap boundaries -void BigDonut::MinimapSettings() { - D_8018D2A0 = 0.0257f; - D_8018D2E0 = 32; - D_8018D2E8 = 31; -} - -void BigDonut::InitCourseObjects() {} - -void BigDonut::SomeSounds() {} - -void BigDonut::WhatDoesThisDo(Player* player, int8_t playerId) {} - -void BigDonut::WhatDoesThisDoAI(Player* player, int8_t playerId) {} - -// Positions the finishline on the minimap -void BigDonut::MinimapFinishlinePosition() { - //! todo: Place hard-coded values here. - draw_hud_2d_texture_8x8(this->Props.MinimapFinishlineX, this->Props.MinimapFinishlineY, (u8*) common_texture_minimap_finish_line); -} - void BigDonut::Render(struct UnkStruct_800DC5EC* arg0) { gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH); gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING); diff --git a/src/engine/courses/BigDonut.h b/src/engine/courses/BigDonut.h index 23c1497eb..bc10105e1 100644 --- a/src/engine/courses/BigDonut.h +++ b/src/engine/courses/BigDonut.h @@ -17,23 +17,12 @@ extern "C" { class BigDonut : public Course { public: - virtual ~BigDonut() = default; // Virtual destructor for proper cleanup in derived classes + virtual ~BigDonut() = default; - // Constructor explicit BigDonut(); -// virtual void Load(const char* courseVtx, -// course_texture* textures, const char* displaylists, size_t dlSize); virtual void Load() override; - virtual void LoadTextures() override; virtual void BeginPlay() override; - //virtual void InitClouds() override; - virtual void MinimapSettings() override; - virtual void InitCourseObjects() override; - virtual void SomeSounds() override; - virtual void WhatDoesThisDo(Player* player, int8_t playerId) override; - virtual void WhatDoesThisDoAI(Player* player, int8_t playerId) override; - virtual void MinimapFinishlinePosition() override; virtual void Render(struct UnkStruct_800DC5EC*) override; virtual void RenderCredits() override; virtual void Waypoints(Player* player, int8_t playerId) override; diff --git a/src/engine/courses/BlockFort.cpp b/src/engine/courses/BlockFort.cpp index 08cf02e6a..cf246220e 100644 --- a/src/engine/courses/BlockFort.cpp +++ b/src/engine/courses/BlockFort.cpp @@ -45,8 +45,16 @@ BlockFort::BlockFort() { this->gfx = d_course_block_fort_packed_dls; this->gfxSize = 699; Props.textures = block_fort_textures; - Props.MinimapTexture = gTextureCourseOutlineBlockFort; - Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); + Props.Minimap.Texture = gTextureCourseOutlineBlockFort; + Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture); + Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture); + Props.Minimap.Pos[0].X = 257; + Props.Minimap.Pos[0].Y = 170; + Props.Minimap.PlayerX = 32; + Props.Minimap.PlayerY = 32; + Props.Minimap.PlayerScaleFactor = 0.0335f; + Props.Minimap.FinishlineX = 0; + Props.Minimap.FinishlineY = 0; Props.SetText(Props.Name, "block fort", sizeof(Props.Name)); Props.SetText(Props.DebugName, "block", sizeof(Props.DebugName)); @@ -94,8 +102,6 @@ BlockFort::BlockFort() { Props.Clouds = NULL; // no clouds Props.CloudList = NULL; - Props.MinimapFinishlineX = 0; - Props.MinimapFinishlineY = 0; Props.Skybox.TopRight = {128, 184, 248}; Props.Skybox.BottomRight = {216, 232, 248}; @@ -116,9 +122,6 @@ void BlockFort::Load() { Props.WaterLevel = gCourseMinY - 10.0f; } -void BlockFort::LoadTextures() { -} - void BlockFort::BeginPlay() { spawn_all_item_boxes((ActorSpawnData*)LOAD_ASSET_RAW(d_course_block_fort_item_box_spawns)); @@ -135,27 +138,6 @@ void BlockFort::BeginPlay() { } } -// Likely sets minimap boundaries -void BlockFort::MinimapSettings() { - D_8018D2A0 = 0.0335f; - D_8018D2E0 = 32; - D_8018D2E8 = 32; -} - -void BlockFort::InitCourseObjects() {} - -void BlockFort::SomeSounds() {} - -void BlockFort::WhatDoesThisDo(Player* player, int8_t playerId) {} - -void BlockFort::WhatDoesThisDoAI(Player* player, int8_t playerId) {} - -// Positions the finishline on the minimap -void BlockFort::MinimapFinishlinePosition() { - //! todo: Place hard-coded values here. - draw_hud_2d_texture_8x8(this->Props.MinimapFinishlineX, this->Props.MinimapFinishlineY, (u8*) common_texture_minimap_finish_line); -} - void BlockFort::Render(struct UnkStruct_800DC5EC* arg0) { set_track_light_direction(D_800DC610, D_802B87D4, 0, 1); gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); @@ -165,10 +147,6 @@ void BlockFort::Render(struct UnkStruct_800DC5EC* arg0) { gSPDisplayList(gDisplayListHead++, (segmented_gfx_to_virtual((void*)0x070015C0))); } -void BlockFort::RenderCredits() {} - void BlockFort::Waypoints(Player* player, int8_t playerId) { player->nearestWaypointId = 0; } - -void BlockFort::Destroy() { } diff --git a/src/engine/courses/BlockFort.h b/src/engine/courses/BlockFort.h index 092e325a3..f0e4c6aa6 100644 --- a/src/engine/courses/BlockFort.h +++ b/src/engine/courses/BlockFort.h @@ -25,17 +25,7 @@ public: // virtual void Load(const char* courseVtx, // course_texture* textures, const char* displaylists, size_t dlSize); virtual void Load() override; - virtual void LoadTextures() override; virtual void BeginPlay() override; - //virtual void InitClouds() override; - virtual void MinimapSettings() override; - virtual void InitCourseObjects() override; - virtual void SomeSounds() override; - virtual void WhatDoesThisDo(Player* player, int8_t playerId) override; - virtual void WhatDoesThisDoAI(Player* player, int8_t playerId) override; - virtual void MinimapFinishlinePosition() override; virtual void Render(struct UnkStruct_800DC5EC*) override; - virtual void RenderCredits() override; virtual void Waypoints(Player*, int8_t) override; - virtual void Destroy() override; }; diff --git a/src/engine/courses/BowsersCastle.cpp b/src/engine/courses/BowsersCastle.cpp index 7d5dedc8c..545f643d7 100644 --- a/src/engine/courses/BowsersCastle.cpp +++ b/src/engine/courses/BowsersCastle.cpp @@ -72,8 +72,16 @@ BowsersCastle::BowsersCastle() { this->gfx = d_course_bowsers_castle_packed_dls; this->gfxSize = 4900; Props.textures = bowsers_castle_textures; - Props.MinimapTexture = gTextureCourseOutlineBowsersCastle; - Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); + Props.Minimap.Texture = gTextureCourseOutlineBowsersCastle; + Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture); + Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture); + Props.Minimap.Pos[0].X = 265; + Props.Minimap.Pos[0].Y = 170; + Props.Minimap.PlayerX = 12; + Props.Minimap.PlayerY = 48; + Props.Minimap.PlayerScaleFactor = 0.0174f; + Props.Minimap.FinishlineX = 0; + Props.Minimap.FinishlineY = 0; Props.Id = "mk:bowsers_castle"; @@ -123,8 +131,6 @@ BowsersCastle::BowsersCastle() { Props.Clouds = NULL; // no clouds Props.CloudList = NULL; - Props.MinimapFinishlineX = 0; - Props.MinimapFinishlineY = 0; Props.Skybox.TopRight = {48, 8, 120}; Props.Skybox.BottomRight = {0, 0, 0}; @@ -152,6 +158,23 @@ void BowsersCastle::LoadTextures() { dma_textures(gTextureShrub, 0x000003FFU, 0x00000800U); } +// Required for the 2 thwomps that go far +void BowsersCastle::SpawnStockThwomp() { + s32 objectId = indexObjectList1[0]; + init_object(objectId, 0); + gObjectList[objectId].origin_pos[0] = 0x04b0 * xOrientation; + gObjectList[objectId].origin_pos[2] = 0xf5ba; + gObjectList[objectId].unk_0D5 = 3; + gObjectList[objectId].primAlpha = 0; + + objectId = indexObjectList1[1]; + init_object(objectId, 0); + gObjectList[objectId].origin_pos[0] = 0x04b0 * xOrientation; + gObjectList[objectId].origin_pos[2] = 0xf592; + gObjectList[objectId].unk_0D5 = 3; + gObjectList[objectId].primAlpha = 1; +} + void BowsersCastle::BeginPlay() { spawn_foliage((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_bowsers_castle_tree_spawn)); spawn_all_item_boxes((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_bowsers_castle_item_box_spawns)); @@ -163,6 +186,7 @@ void BowsersCastle::BeginPlay() { gWorldInstance.AddObject(new OThwomp(0x044c, 0xf92a, 0xC000, 1.0f, 1, 1)); gWorldInstance.AddObject(new OThwomp(0x02bc, 0xf95c, 0xC000, 1.0f, 2, 0)); gWorldInstance.AddObject(new OThwomp(0x04b0, 0xf8f8, 0xC000, 1.0f, 2, 1)); + BowsersCastle::SpawnStockThwomp(); gWorldInstance.AddObject(new OThwomp(0x04b0, 0xf5ba, 0xC000, 1.0f, 3, 0)); gWorldInstance.AddObject(new OThwomp(0x04b0, 0xf592, 0xC000, 1.0f, 3, 1)); gWorldInstance.AddObject(new OThwomp(0x091a, 0xf5bf, 0xC000, 1.0f, 4, 0)); @@ -174,6 +198,7 @@ void BowsersCastle::BeginPlay() { case CC_50: gWorldInstance.AddObject(new OThwomp(0x3B6, 0xF92A, 0xC000, 1.0f, 1, 0)); gWorldInstance.AddObject(new OThwomp(0x0352, 0xf95c, 0xC000, 1.0f, 2, 0)); + BowsersCastle::SpawnStockThwomp(); gWorldInstance.AddObject(new OThwomp(0x04b0, 0xf5ba, 0xC000, 1.0f, 3, 0)); gWorldInstance.AddObject(new OThwomp(0x04b0, 0xf592, 0xC000, 1.0f, 3, 1)); gWorldInstance.AddObject(new OThwomp(0x091a, 0xf5b0, 0xC000, 1.0f, 4, 0)); @@ -186,6 +211,7 @@ void BowsersCastle::BeginPlay() { gWorldInstance.AddObject(new OThwomp(0x044c, 0xf92a, 0xC000, 1.0f, 1, 1)); gWorldInstance.AddObject(new OThwomp(0x02bc, 0xf95c, 0xC000, 1.0f, 2, 0)); gWorldInstance.AddObject(new OThwomp(0x04b0, 0xf8f8, 0xC000, 1.0f, 2, 1)); + BowsersCastle::SpawnStockThwomp(); gWorldInstance.AddObject(new OThwomp(0x04b0, 0xf5ba, 0xC000, 1.0f, 3, 0)); gWorldInstance.AddObject(new OThwomp(0x04b0, 0xf592, 0xC000, 1.0f, 3, 1)); gWorldInstance.AddObject(new OThwomp(0x091a, 0xf5c9, 0xC000, 1.0f, 4, 0)); @@ -210,14 +236,6 @@ void BowsersCastle::BeginPlay() { } } -// Likely sets minimap boundaries -void BowsersCastle::MinimapSettings() { - D_8018D2C0[0] = 265; - D_8018D2A0 = 0.0174f; - D_8018D2E0 = 12; - D_8018D2E8 = 48; -} - void BowsersCastle::InitCourseObjects() { size_t objectId; size_t i; @@ -287,12 +305,6 @@ void BowsersCastle::WhatDoesThisDoAI(Player* player, int8_t playerId) { } } -// Positions the finishline on the minimap -void BowsersCastle::MinimapFinishlinePosition() { - //! todo: Place hard-coded values here. - draw_hud_2d_texture_8x8(this->Props.MinimapFinishlineX, this->Props.MinimapFinishlineY, (u8*) common_texture_minimap_finish_line); -} - void BowsersCastle::Render(struct UnkStruct_800DC5EC* arg0) { gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH); diff --git a/src/engine/courses/BowsersCastle.h b/src/engine/courses/BowsersCastle.h index a8f6b95c8..b52af2a26 100644 --- a/src/engine/courses/BowsersCastle.h +++ b/src/engine/courses/BowsersCastle.h @@ -26,16 +26,15 @@ public: // course_texture* textures, const char* displaylists, size_t dlSize); virtual void Load() override; virtual void LoadTextures() override; + void SpawnStockThwomp(); virtual void BeginPlay() override; //virtual void InitClouds() override; - virtual void MinimapSettings() override; virtual void InitCourseObjects() override; virtual void UpdateCourseObjects() override; virtual void RenderCourseObjects(s32 cameraId) override; virtual void SomeSounds() override; virtual void WhatDoesThisDo(Player* player, int8_t playerId) override; virtual void WhatDoesThisDoAI(Player* player, int8_t playerId) override; - virtual void MinimapFinishlinePosition() override; virtual void Render(struct UnkStruct_800DC5EC*) override; virtual void RenderCredits() override; virtual void SomeCollisionThing(Player *player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32* arg4, f32* arg5, f32* arg6, f32* arg7) override; diff --git a/src/engine/courses/ChocoMountain.cpp b/src/engine/courses/ChocoMountain.cpp index 471a07809..df4a89649 100644 --- a/src/engine/courses/ChocoMountain.cpp +++ b/src/engine/courses/ChocoMountain.cpp @@ -64,8 +64,16 @@ ChocoMountain::ChocoMountain() { this->gfx = d_course_choco_mountain_packed_dls; this->gfxSize = 2910; Props.textures = choco_mountain_textures; - Props.MinimapTexture = gTextureCourseOutlineChocoMountain; - Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); + Props.Minimap.Texture = gTextureCourseOutlineChocoMountain; + Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture); + Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture); + Props.Minimap.Pos[0].X = 265; + Props.Minimap.Pos[0].Y = 170; + Props.Minimap.PlayerX = 19; + Props.Minimap.PlayerY = 37; + Props.Minimap.PlayerScaleFactor = 0.022f; + Props.Minimap.FinishlineX = 0; + Props.Minimap.FinishlineY = -16.0; Props.Id = "mk:choco_mountain"; Props.SetText(Props.Name, "choco mountain", sizeof(Props.Name)); @@ -114,8 +122,6 @@ ChocoMountain::ChocoMountain() { Props.Clouds = NULL; // no clouds Props.CloudList = NULL; - Props.MinimapFinishlineX = 0; - Props.MinimapFinishlineY = -16.0; Props.Skybox.TopRight = {255, 255, 255}; Props.Skybox.BottomRight = {255, 255, 255}; @@ -182,14 +188,6 @@ void ChocoMountain::BeginPlay() { } } -// Likely sets minimap boundaries -void ChocoMountain::MinimapSettings() { - D_8018D2A0 = 0.022f; - D_8018D2C0[0] = 265; - D_8018D2E0 = 19; - D_8018D2E8 = 37; -} - void ChocoMountain::InitCourseObjects() { if (gGamestate != CREDITS_SEQUENCE) { if (gModeSelection == GRAND_PRIX) { @@ -237,12 +235,6 @@ void ChocoMountain::WhatDoesThisDoAI(Player* player, int8_t playerId) { } } -// Positions the finishline on the minimap -void ChocoMountain::MinimapFinishlinePosition() { - //! todo: Place hard-coded values here. - draw_hud_2d_texture_8x8(this->Props.MinimapFinishlineX, this->Props.MinimapFinishlineY, (u8*) common_texture_minimap_finish_line); -} - void ChocoMountain::Render(struct UnkStruct_800DC5EC* arg0) { gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH); gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING); diff --git a/src/engine/courses/ChocoMountain.h b/src/engine/courses/ChocoMountain.h index 8fd6f6f04..b592ba9df 100644 --- a/src/engine/courses/ChocoMountain.h +++ b/src/engine/courses/ChocoMountain.h @@ -27,12 +27,10 @@ public: virtual void Load() override; virtual void LoadTextures() override; virtual void BeginPlay() override; - virtual void MinimapSettings() override; virtual void InitCourseObjects() override; virtual void SomeSounds() override; virtual void WhatDoesThisDo(Player* player, int8_t playerId) override; virtual void WhatDoesThisDoAI(Player* player, int8_t playerId) override; - virtual void MinimapFinishlinePosition() override; virtual void Render(struct UnkStruct_800DC5EC*) override; virtual void RenderCredits() override; virtual void SomeCollisionThing(Player *player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32* arg4, f32* arg5, f32* arg6, f32* arg7) override; diff --git a/src/engine/courses/Course.cpp b/src/engine/courses/Course.cpp index 4418e757c..5feef4158 100644 --- a/src/engine/courses/Course.cpp +++ b/src/engine/courses/Course.cpp @@ -33,8 +33,18 @@ Course::Course() { // Props.Cup = FLOWER_CUP; // Props.CupIndex = 3; Props.Id = ""; - Props.MinimapTexture = gTextureCourseOutlineMarioRaceway; - Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); + Props.Minimap.Texture = gTextureCourseOutlineMarioRaceway; + Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture); + Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture); + Props.Minimap.Pos[0].X = 257; + Props.Minimap.Pos[0].Y = 170; + Props.Minimap.PlayerX = 0; + Props.Minimap.PlayerY = 0; + Props.Minimap.PlayerScaleFactor = 0.22f; + Props.Minimap.FinishlineX = 0; + Props.Minimap.FinishlineY = 0; + Props.Minimap.Colour = {255, 255, 255}; + Props.WaterLevel = -10.0f; Props.LakituTowType = (s32) OLakitu::LakituTowType::NORMAL; Props.AIBehaviour = D_0D008F28; @@ -80,8 +90,6 @@ Course::Course() { Props.Clouds = NULL; Props.CloudList = NULL; - Props.MinimapFinishlineX = 0; - Props.MinimapFinishlineY = 0; Props.Sequence = MusicSeq::MUSIC_SEQ_UNKNOWN; } @@ -290,9 +298,6 @@ void Course::SomeCollisionThing(Player* player, Vec3f arg1, Vec3f arg2, Vec3f ar func_8003E048(player, arg1, arg2, arg3, arg4, arg5, arg6, arg7); } -void Course::MinimapSettings() { -} - void Course::InitCourseObjects() { } @@ -315,13 +320,6 @@ void Course::WhatDoesThisDo(Player* player, int8_t playerId) { void Course::WhatDoesThisDoAI(Player* player, int8_t playerId) { } -// Positions the finishline on the minimap -void Course::MinimapFinishlinePosition() { - //! todo: Place hard-coded values here. - draw_hud_2d_texture_8x8(this->Props.MinimapFinishlineX, this->Props.MinimapFinishlineY, - (u8*) common_texture_minimap_finish_line); -} - void Course::SetStaffGhost() { D_80162DD6 = 1; D_80162DF4 = 1; diff --git a/src/engine/courses/Course.h b/src/engine/courses/Course.h index b1f88d217..45b37cce5 100644 --- a/src/engine/courses/Course.h +++ b/src/engine/courses/Course.h @@ -48,15 +48,27 @@ struct WaterVolume { float MaxZ; }; +typedef struct MinimapProps { + const char* Texture; + int16_t Width; + int16_t Height; + IVector2D Pos[2]; // Minimap position for players 1 and 2. 3/4 player mode is hard-coded to the center. + int32_t PlayerX; // The offset to place the player markers + int32_t PlayerY; + float PlayerScaleFactor; // Scale factor of the player markers + float FinishlineX; // The offset to place the finishline texture on the minimap + float FinishlineY; + RGB8 Colour; // Colour of the visible pixels (the track path) +} MinimapProps; + typedef struct Properties { const char* Id; char Name[128]; char DebugName[128]; char CourseLength[128]; - const char* AIBehaviour; - const char* MinimapTexture; int32_t LakituTowType; - IVector2D MinimapDimensions; + MinimapProps Minimap; + const char* AIBehaviour; float AIMaximumSeparation; float AIMinimumSeparation; float NearPersp; @@ -70,10 +82,9 @@ typedef struct Properties { Vec4f D_0D009808; TrackWaypoint* PathTable[4]; TrackWaypoint* PathTable2[4]; + uint8_t* CloudTexture; CloudData *Clouds; CloudData *CloudList; - float MinimapFinishlineX; - float MinimapFinishlineY; SkyboxColours Skybox; const course_texture *textures; enum MusicSeq Sequence; @@ -114,8 +125,14 @@ typedef struct Properties { //j["Clouds"] = Clouds ? nlohmann::json{{"x", Clouds->x, "y", Clouds->y, "z", Clouds->z}} : nullptr; //j["CloudList"] = CloudList ? nlohmann::json{{"x", CloudList->x, "y", CloudList->y, "z", CloudList->z}} : nullptr; - j["MinimapFinishlineX"] = MinimapFinishlineX; - j["MinimapFinishlineY"] = MinimapFinishlineY; + j["MinimapPosition"] = {Minimap.Pos[0].X, Minimap.Pos[0].Y}; + j["MinimapPosition2P"] = {Minimap.Pos[1].X, Minimap.Pos[1].Y}; + j["MinimapPlayerX"] = Minimap.PlayerX; + j["MinimapPlayerY"] = Minimap.PlayerY; + j["MinimapPlayerScaleFactor"] = Minimap.PlayerScaleFactor; + j["MinimapFinishlineX"] = Minimap.FinishlineX; + j["MinimapFinishlineY"] = Minimap.FinishlineY; + j["MinimapColour"] = {static_cast(Minimap.Colour.r), static_cast(Minimap.Colour.g), static_cast(Minimap.Colour.b)}; // SkyboxColors - assuming SkyboxColors can be serialized similarly // j["Skybox"] = Skybox; // Implement your serialization logic here j["Sequence"] = static_cast(Sequence); @@ -186,9 +203,18 @@ typedef struct Properties { //Clouds = nullptr; // Deserialize if data is present //CloudList = nullptr; // Deserialize if data is present - - MinimapFinishlineX = j.at("MinimapFinishlineX").get(); - MinimapFinishlineY = j.at("MinimapFinishlineY").get(); + Minimap.Pos[0].X = j.at("MinimapPosition")[0].get(); + Minimap.Pos[0].Y = j.at("MinimapPosition")[1].get(); + Minimap.Pos[1].X = j.at("MinimapPosition2P")[0].get(); + Minimap.Pos[1].Y = j.at("MinimapPosition2P")[1].get(); + Minimap.PlayerX = j.at("MinimapPlayerX").get(); + Minimap.PlayerY = j.at("MinimapPlayerY").get(); + Minimap.PlayerScaleFactor = j.at("MinimapPlayerScaleFactor").get(); + Minimap.FinishlineX = j.at("MinimapFinishlineX").get(); + Minimap.FinishlineY = j.at("MinimapFinishlineY").get(); + Minimap.Colour.r = j.at("MinimapColour")[0].get(); + Minimap.Colour.g = j.at("MinimapColour")[1].get(); + Minimap.Colour.b = j.at("MinimapColour")[2].get(); //textures = nullptr; // Deserialize textures if present Sequence = static_cast(j.at("Sequence").get()); WaterLevel = j.at("WaterLevel").get(); @@ -253,7 +279,6 @@ public: virtual void InitClouds(); virtual void UpdateClouds(s32, Camera*); virtual void SomeCollisionThing(Player *player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32* arg4, f32* arg5, f32* arg6, f32* arg7); - virtual void MinimapSettings(); virtual void InitCourseObjects(); virtual void UpdateCourseObjects(); virtual void RenderCourseObjects(s32 cameraId); @@ -261,7 +286,6 @@ public: virtual void CreditsSpawnActors(); virtual void WhatDoesThisDo(Player*, int8_t); virtual void WhatDoesThisDoAI(Player*, int8_t); - virtual void MinimapFinishlinePosition(); virtual void SetStaffGhost(); virtual void Render(struct UnkStruct_800DC5EC*); virtual void RenderCredits(); diff --git a/src/engine/courses/DKJungle.cpp b/src/engine/courses/DKJungle.cpp index db2e9e7c5..bbb602584 100644 --- a/src/engine/courses/DKJungle.cpp +++ b/src/engine/courses/DKJungle.cpp @@ -73,8 +73,16 @@ DKJungle::DKJungle() { this->gfx = d_course_dks_jungle_parkway_packed_dls; this->gfxSize = 4997; Props.textures = dks_jungle_parkway_textures; - Props.MinimapTexture = gTextureCourseOutlineDksJungleParkway; - Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); + Props.Minimap.Texture = gTextureCourseOutlineDksJungleParkway; + Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture); + Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture); + Props.Minimap.Pos[0].X = 255; + Props.Minimap.Pos[0].Y = 170; + Props.Minimap.PlayerX = 29; + Props.Minimap.PlayerY = 47; + Props.Minimap.PlayerScaleFactor = 0.0155f; + Props.Minimap.FinishlineX = 0; + Props.Minimap.FinishlineY = 0; Props.SetText(Props.Name, "d.k.'s jungle parkway", sizeof(Props.Name)); Props.SetText(Props.DebugName, "jungle", sizeof(Props.DebugName)); @@ -122,8 +130,6 @@ DKJungle::DKJungle() { Props.Clouds = NULL; // no clouds Props.CloudList = NULL; - Props.MinimapFinishlineX = 0; - Props.MinimapFinishlineY = 0; Props.Skybox.TopRight = {255, 174, 0}; Props.Skybox.BottomRight = {255, 229, 124}; @@ -211,14 +217,6 @@ void DKJungle::BeginPlay() { } } -// Likely sets minimap boundaries -void DKJungle::MinimapSettings() { - D_8018D2A0 = 0.0155f; - D_8018D2C0[0] = 255; - D_8018D2E0 = 29; - D_8018D2E8 = 47; -} - void DKJungle::InitCourseObjects() { for (size_t i = 0; i < NUM_TORCHES; i++) { init_smoke_particles(i); @@ -287,12 +285,6 @@ void DKJungle::WhatDoesThisDoAI(Player* player, int8_t playerId) { } } -// Positions the finishline on the minimap -void DKJungle::MinimapFinishlinePosition() { - //! todo: Place hard-coded values here. - draw_hud_2d_texture_8x8(this->Props.MinimapFinishlineX, this->Props.MinimapFinishlineY, (u8*) common_texture_minimap_finish_line); -} - void DKJungle::Render(struct UnkStruct_800DC5EC* arg0) { set_track_light_direction(D_800DC610, D_802B87D4, 0, 1); set_track_light_direction(&D_800DC610[1], D_802B87D4, D_802B87D0, 1); diff --git a/src/engine/courses/DKJungle.h b/src/engine/courses/DKJungle.h index 158be2185..84767a94a 100644 --- a/src/engine/courses/DKJungle.h +++ b/src/engine/courses/DKJungle.h @@ -29,14 +29,12 @@ public: virtual f32 GetWaterLevel(FVector pos, Collision* collision) override; virtual void BeginPlay() override; //virtual void InitClouds() override; - virtual void MinimapSettings() override; virtual void InitCourseObjects() override; virtual void UpdateCourseObjects() override; virtual void RenderCourseObjects(s32 cameraId) override; virtual void SomeSounds() override; virtual void WhatDoesThisDo(Player* player, int8_t playerId) override; virtual void WhatDoesThisDoAI(Player* player, int8_t playerId) override; - virtual void MinimapFinishlinePosition() override; virtual void Render(struct UnkStruct_800DC5EC*) override; virtual void RenderCredits() override; virtual void SomeCollisionThing(Player *player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32* arg4, f32* arg5, f32* arg6, f32* arg7) override; diff --git a/src/engine/courses/DoubleDeck.cpp b/src/engine/courses/DoubleDeck.cpp index 788ae80cf..ecadf9d48 100644 --- a/src/engine/courses/DoubleDeck.cpp +++ b/src/engine/courses/DoubleDeck.cpp @@ -43,8 +43,16 @@ DoubleDeck::DoubleDeck() { this->gfx = d_course_double_deck_packed_dls; this->gfxSize = 699; Props.textures = double_deck_textures; - Props.MinimapTexture = gTextureCourseOutlineDoubleDeck; - Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); + Props.Minimap.Texture = gTextureCourseOutlineDoubleDeck; + Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture); + Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture); + Props.Minimap.Pos[0].X = 257; + Props.Minimap.Pos[0].Y = 170; + Props.Minimap.PlayerX = 32; + Props.Minimap.PlayerY = 32; + Props.Minimap.PlayerScaleFactor = 0.0285f; + Props.Minimap.FinishlineX = 0; + Props.Minimap.FinishlineY = 0; Props.SetText(Props.Name, "double deck", sizeof(Props.Name)); Props.SetText(Props.DebugName, "deck", sizeof(Props.DebugName)); @@ -93,8 +101,6 @@ DoubleDeck::DoubleDeck() { Props.Clouds = NULL; // no clouds Props.CloudList = NULL; - Props.MinimapFinishlineX = 0; - Props.MinimapFinishlineY = 0; Props.Skybox.TopRight = {113, 70, 255}; Props.Skybox.BottomRight = {255, 184, 99}; @@ -134,13 +140,6 @@ void DoubleDeck::BeginPlay() { } } -// Likely sets minimap boundaries -void DoubleDeck::MinimapSettings() { - D_8018D2A0 = 0.0285f; - D_8018D2E0 = 32; - D_8018D2E8 = 32; -} - void DoubleDeck::InitCourseObjects() {} void DoubleDeck::SomeSounds() {} @@ -149,12 +148,6 @@ void DoubleDeck::WhatDoesThisDo(Player* player, int8_t playerId) {} void DoubleDeck::WhatDoesThisDoAI(Player* player, int8_t playerId) {} -// Positions the finishline on the minimap -void DoubleDeck::MinimapFinishlinePosition() { - //! todo: Place hard-coded values here. - draw_hud_2d_texture_8x8(this->Props.MinimapFinishlineX, this->Props.MinimapFinishlineY, (u8*) common_texture_minimap_finish_line); -} - void DoubleDeck::Render(struct UnkStruct_800DC5EC* arg0) { set_track_light_direction(D_800DC610, D_802B87D4, 0, 1); gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); diff --git a/src/engine/courses/DoubleDeck.h b/src/engine/courses/DoubleDeck.h index 5d2787a56..2ebb5d9c3 100644 --- a/src/engine/courses/DoubleDeck.h +++ b/src/engine/courses/DoubleDeck.h @@ -27,13 +27,10 @@ public: virtual void Load() override; virtual void LoadTextures() override; virtual void BeginPlay() override; - //virtual void InitClouds() override; - virtual void MinimapSettings() override; virtual void InitCourseObjects() override; virtual void SomeSounds() override; virtual void WhatDoesThisDo(Player* player, int8_t playerId) override; virtual void WhatDoesThisDoAI(Player* player, int8_t playerId) override; - virtual void MinimapFinishlinePosition() override; virtual void Render(struct UnkStruct_800DC5EC*) override; virtual void RenderCredits() override; virtual void Waypoints(Player* player, int8_t playerId) override; diff --git a/src/engine/courses/FrappeSnowland.cpp b/src/engine/courses/FrappeSnowland.cpp index 5bbf1b001..16b9b7380 100644 --- a/src/engine/courses/FrappeSnowland.cpp +++ b/src/engine/courses/FrappeSnowland.cpp @@ -52,8 +52,17 @@ FrappeSnowland::FrappeSnowland() { this->gfx = d_course_frappe_snowland_packed_dls; this->gfxSize = 4140; Props.textures = frappe_snowland_textures; - Props.MinimapTexture = gTextureCourseOutlineFrappeSnowland; - Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); + Props.Minimap.Texture = gTextureCourseOutlineFrappeSnowland; + Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture); + Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture); + Props.Minimap.Pos[0].X = 262; + Props.Minimap.Pos[0].Y = 170; + Props.Minimap.PlayerX = 36; + Props.Minimap.PlayerY = 40; + Props.Minimap.PlayerScaleFactor = 0.016f; + Props.Minimap.FinishlineX = 0; + Props.Minimap.FinishlineY = 0; + Props.Minimap.Colour = {72, 100, 255}; Props.SetText(Props.Name, "frappe snowland", sizeof(Props.Name)); Props.SetText(Props.DebugName, "snow", sizeof(Props.DebugName)); @@ -101,8 +110,6 @@ FrappeSnowland::FrappeSnowland() { Props.Clouds = NULL; // not used for frappe Props.CloudList = NULL; - Props.MinimapFinishlineX = 0; - Props.MinimapFinishlineY = 0; Props.Skybox.TopRight = {28, 11, 90}; Props.Skybox.BottomRight = {0, 99, 164}; @@ -188,17 +195,6 @@ void FrappeSnowland::UpdateClouds(s32 sp1C, Camera* camera) { func_80078170(sp1C, camera); } -// Likely sets minimap boundaries -void FrappeSnowland::MinimapSettings() { - D_8018D2C0[0] = 262; - D_8018D2A0 = 0.016f; - D_8018D2E0 = 36; - D_8018D2E8 = 40; - D_8018D300 = 72; - D_8018D308 = 100; - D_8018D310 = 255; -} - void FrappeSnowland::InitCourseObjects() { size_t objectId; size_t i; @@ -211,22 +207,6 @@ void FrappeSnowland::UpdateCourseObjects() { update_snowflakes(); } -void FrappeSnowland::RenderCourseObjects(s32 cameraId) { -} - -void FrappeSnowland::SomeSounds() { -} - -void FrappeSnowland::WhatDoesThisDo(Player* player, int8_t playerId) {} - -void FrappeSnowland::WhatDoesThisDoAI(Player* player, int8_t playerId) {} - -// Positions the finishline on the minimap -void FrappeSnowland::MinimapFinishlinePosition() { - //! todo: Place hard-coded values here. - draw_hud_2d_texture_8x8(this->Props.MinimapFinishlineX, this->Props.MinimapFinishlineY, (u8*) common_texture_minimap_finish_line); -} - void FrappeSnowland::Render(struct UnkStruct_800DC5EC* arg0) { gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH); @@ -260,7 +240,3 @@ void FrappeSnowland::Waypoints(Player* player, int8_t playerId) { } } } - -void FrappeSnowland::ScrollingTextures() {} - -void FrappeSnowland::Destroy() {} diff --git a/src/engine/courses/FrappeSnowland.h b/src/engine/courses/FrappeSnowland.h index 0611bf5a5..8f01559a9 100644 --- a/src/engine/courses/FrappeSnowland.h +++ b/src/engine/courses/FrappeSnowland.h @@ -17,29 +17,18 @@ extern "C" { class FrappeSnowland : public Course { public: - virtual ~FrappeSnowland() = default; // Virtual destructor for proper cleanup in derived classes + virtual ~FrappeSnowland() = default; - // Constructor explicit FrappeSnowland(); -// virtual void Load(const char* courseVtx, -// course_texture* textures, const char* displaylists, size_t dlSize); virtual void Load() override; virtual void LoadTextures() override; virtual void BeginPlay() override; virtual void InitClouds() override; virtual void UpdateClouds(s32 sp1C, Camera* camera) override; - virtual void MinimapSettings() override; virtual void InitCourseObjects() override; virtual void UpdateCourseObjects() override; - virtual void RenderCourseObjects(s32 cameraId) override; - virtual void SomeSounds() override; - virtual void WhatDoesThisDo(Player* player, int8_t playerId) override; - virtual void WhatDoesThisDoAI(Player* player, int8_t playerId) override; - virtual void MinimapFinishlinePosition() override; virtual void Render(struct UnkStruct_800DC5EC*) override; virtual void RenderCredits() override; - virtual void ScrollingTextures() override; virtual void Waypoints(Player* player, int8_t playerId) override; - virtual void Destroy() override; }; diff --git a/src/engine/courses/Harbour.cpp b/src/engine/courses/Harbour.cpp index 2da03f938..3f0eaa0a5 100644 --- a/src/engine/courses/Harbour.cpp +++ b/src/engine/courses/Harbour.cpp @@ -28,6 +28,7 @@ #include "engine/objects/HotAirBalloon.h" #include "engine/objects/Crab.h" #include "engine/objects/Boos.h" +#include "engine/objects/GrandPrixBalloons.h" extern "C" { #include "main.h" @@ -518,8 +519,14 @@ TrackWaypoint harbour_path[] = { Harbour::Harbour() { this->gfxSize = 100; this->textures = NULL; - Props.MinimapTexture = gTextureCourseOutlineMarioRaceway; - Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); + Props.Minimap.Texture = gTextureCourseOutlineMarioRaceway; + Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture); + Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture); + Props.Minimap.Pos[0].X = 260; + Props.Minimap.Pos[0].Y = 170; + Props.Minimap.PlayerX = 6; + Props.Minimap.PlayerY = 28; + Props.Minimap.PlayerScaleFactor = 0.022f; Props.Id = "mk:harbour"; Props.SetText(Props.Name, "Harbour", sizeof(Props.Name)); @@ -566,10 +573,11 @@ Harbour::Harbour() { Props.PathTable2[2] = NULL; Props.PathTable2[3] = NULL; + Props.CloudTexture = (u8*) LOAD_ASSET_RAW(gTextureExhaust5); Props.Clouds = gKalimariDesertClouds; Props.CloudList = gLuigiRacewayClouds; - Props.MinimapFinishlineX = 0; - Props.MinimapFinishlineY = 0; + Props.Minimap.FinishlineX = 0; + Props.Minimap.FinishlineY = 0; Props.Skybox.TopRight = {120, 140, 188}; Props.Skybox.BottomRight = {216, 232, 248}; @@ -746,34 +754,11 @@ void Harbour::BeginPlay() { // add_actor_to_empty_slot(itemPos, rot, vel, ACTOR_ITEM_BOX); // } // } - gWorldInstance.AddActor(new AShip(FVector(-1694, -111, 1451), AShip::Skin::GHOSTSHIP)); - gWorldInstance.AddActor(new AShip(FVector(2811, -83, 966), AShip::Skin::SHIP2)); - gWorldInstance.AddActor(new AShip(FVector(1526, -36, -2228), AShip::Skin::SHIP3)); - - - gWorldInstance.AddActor(new ASpaghettiShip(FVector(582, -70, -650))); - //gWorldInstance.AddActor(new ASpaghettiShip(FVector(2811, -83, 966 ))); - gWorldInstance.AddActor(new AStarship(FVector(1019, 160, 1987))); - + //gWorldInstance.AddActor(new AShip(FVector(-1694, -111, 1451), AShip::Skin::GHOSTSHIP)); + //gWorldInstance.AddActor(new AShip(FVector(2811, -83, 966), AShip::Skin::SHIP2)); + //gWorldInstance.AddObject(new OGrandPrixBalloons(FVector(16, -106, -34))); } -// Likely sets minimap boundaries -void Harbour::MinimapSettings() { - D_8018D220 = reinterpret_cast(dma_textures(gTextureExhaust5, 0x443, 0x1000)); - D_8018D2A0 = 0.022f; - D_8018D2E0 = 6; - D_8018D2E8 = 28; - D_8018D2C0[0] = 260; - D_8018D2D8[0] = 170; - D_80165718 = 0; - D_80165720 = 5; - D_80165728 = -240; -} - -void Harbour::InitCourseObjects() {} - -void Harbour::SomeSounds() {} - void Harbour::WhatDoesThisDo(Player* player, int8_t playerId) { if (((s16) gNearestWaypointByPlayerId[playerId] >= 0x19B) && ((s16) gNearestWaypointByPlayerId[playerId] < 0x1B9)) { @@ -804,12 +789,6 @@ void Harbour::WhatDoesThisDoAI(Player* player, int8_t playerId) { } } -// Positions the finishline on the minimap -void Harbour::MinimapFinishlinePosition() { - //! todo: Place hard-coded values here. - draw_hud_2d_texture_8x8(this->Props.MinimapFinishlineX, this->Props.MinimapFinishlineY, (u8*) common_texture_minimap_finish_line); -} - void Harbour::Render(struct UnkStruct_800DC5EC* arg0) { gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH); gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING); @@ -832,11 +811,6 @@ void Harbour::Render(struct UnkStruct_800DC5EC* arg0) { gSPDisplayList(gDisplayListHead++, moon_moon_mesh); } -void Harbour::RenderCredits() { -} - -void Harbour::Destroy() { } - bool Harbour::IsMod() { return true; } \ No newline at end of file diff --git a/src/engine/courses/Harbour.h b/src/engine/courses/Harbour.h index 54e39084b..834154f84 100644 --- a/src/engine/courses/Harbour.h +++ b/src/engine/courses/Harbour.h @@ -27,14 +27,8 @@ public: virtual void Load() override; virtual void LoadTextures() override; virtual void BeginPlay() override; - virtual void MinimapSettings() override; - virtual void InitCourseObjects() override; - virtual void SomeSounds() override; virtual void WhatDoesThisDo(Player* player, int8_t playerId) override; virtual void WhatDoesThisDoAI(Player* player, int8_t playerId) override; - virtual void MinimapFinishlinePosition() override; virtual void Render(struct UnkStruct_800DC5EC*) override; - virtual void RenderCredits() override; - virtual void Destroy() override; virtual bool IsMod() override; }; diff --git a/src/engine/courses/KalimariDesert.cpp b/src/engine/courses/KalimariDesert.cpp index 27599cce1..8f4c3e893 100644 --- a/src/engine/courses/KalimariDesert.cpp +++ b/src/engine/courses/KalimariDesert.cpp @@ -57,8 +57,16 @@ KalimariDesert::KalimariDesert() { this->gfx = d_course_kalimari_desert_packed_dls; this->gfxSize = 5328; Props.textures = kalimari_desert_textures; - Props.MinimapTexture = gTextureCourseOutlineKalimariDesert; - Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); + Props.Minimap.Texture = gTextureCourseOutlineKalimariDesert; + Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture); + Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture); + Props.Minimap.Pos[0].X = 263; + Props.Minimap.Pos[0].Y = 165; + Props.Minimap.PlayerX = 55; + Props.Minimap.PlayerY = 27; + Props.Minimap.PlayerScaleFactor = 0.015f; + Props.Minimap.FinishlineX = 0; + Props.Minimap.FinishlineY = 4.0; Props.SetText(Props.Name, "kalimari desert", sizeof(Props.Name)); Props.SetText(Props.DebugName, "desert", sizeof(Props.DebugName)); @@ -104,10 +112,9 @@ KalimariDesert::KalimariDesert() { Props.PathTable2[2] = NULL; Props.PathTable2[3] = NULL; + Props.CloudTexture = (u8*) LOAD_ASSET_RAW(gTextureExhaust5); Props.Clouds = gKalimariDesertClouds; Props.CloudList = gKalimariDesertClouds; - Props.MinimapFinishlineX = 0; - Props.MinimapFinishlineY = 4.0; Props.Skybox.TopRight = {195, 231, 255}; Props.Skybox.BottomRight = {255, 192, 0}; @@ -216,16 +223,6 @@ void KalimariDesert::BeginPlay() { } } -// Likely sets minimap boundaries -void KalimariDesert::MinimapSettings() { - D_8018D2C0[0] = 263; - D_8018D2D8[0] = 165; - D_8018D220 = reinterpret_cast(dma_textures(gTextureExhaust5, 0x443, 0x1000)); - D_8018D2A0 = 0.015f; - D_8018D2E0 = 55; - D_8018D2E8 = 27; -} - void KalimariDesert::InitCourseObjects() { size_t i; if (gGamestate != CREDITS_SEQUENCE) { @@ -249,12 +246,6 @@ void KalimariDesert::WhatDoesThisDo(Player* player, int8_t playerId) {} void KalimariDesert::WhatDoesThisDoAI(Player* player, int8_t playerId) {} -// Positions the finishline on the minimap -void KalimariDesert::MinimapFinishlinePosition() { - //! todo: Place hard-coded values here. - draw_hud_2d_texture_8x8(this->Props.MinimapFinishlineX, this->Props.MinimapFinishlineY, (u8*) common_texture_minimap_finish_line); -} - void KalimariDesert::Render(struct UnkStruct_800DC5EC* arg0) { set_track_light_direction(D_800DC610, D_802B87D4, 0, 1); diff --git a/src/engine/courses/KalimariDesert.h b/src/engine/courses/KalimariDesert.h index 61d717231..fe8b21f23 100644 --- a/src/engine/courses/KalimariDesert.h +++ b/src/engine/courses/KalimariDesert.h @@ -29,12 +29,10 @@ public: virtual void Load() override; virtual void LoadTextures() override; virtual void BeginPlay() override; - virtual void MinimapSettings() override; virtual void InitCourseObjects() override; virtual void SomeSounds() override; virtual void WhatDoesThisDo(Player* player, int8_t playerId) override; virtual void WhatDoesThisDoAI(Player* player, int8_t playerId) override; - virtual void MinimapFinishlinePosition() override; virtual void Render(struct UnkStruct_800DC5EC*) override; virtual void RenderCredits() override; virtual void Destroy() override; diff --git a/src/engine/courses/KoopaTroopaBeach.cpp b/src/engine/courses/KoopaTroopaBeach.cpp index 828fcf5ac..49e9ef3ac 100644 --- a/src/engine/courses/KoopaTroopaBeach.cpp +++ b/src/engine/courses/KoopaTroopaBeach.cpp @@ -62,8 +62,16 @@ KoopaTroopaBeach::KoopaTroopaBeach() { this->gfx = d_course_koopa_troopa_beach_packed_dls; this->gfxSize = 5720; Props.textures = koopa_troopa_beach_textures; - Props.MinimapTexture = gTextureCourseOutlineKoopaTroopaBeach; - Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); + Props.Minimap.Texture = gTextureCourseOutlineKoopaTroopaBeach; + Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture); + Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture); + Props.Minimap.Pos[0].X = 268; + Props.Minimap.Pos[0].Y = 170; + Props.Minimap.PlayerX = 40; + Props.Minimap.PlayerY = 21; + Props.Minimap.PlayerScaleFactor = 0.014f; + Props.Minimap.FinishlineX = 0; + Props.Minimap.FinishlineY = 0; Props.Id = "mk:koopa_beach"; Props.SetText(Props.Name, "koopa troopa beach", sizeof(Props.Name)); @@ -110,10 +118,9 @@ KoopaTroopaBeach::KoopaTroopaBeach() { Props.PathTable2[2] = NULL; Props.PathTable2[3] = NULL; + Props.CloudTexture = (u8*) LOAD_ASSET_RAW(gTextureExhaust3); Props.Clouds = gKoopaTroopaBeachClouds; Props.CloudList = gKoopaTroopaBeachClouds; - Props.MinimapFinishlineX = 0; - Props.MinimapFinishlineY = 0; Props.Skybox.TopRight = {48, 152, 120}; Props.Skybox.BottomRight = {216, 232, 248}; @@ -189,15 +196,6 @@ void KoopaTroopaBeach::BeginPlay() { } } -// Likely sets minimap boundaries -void KoopaTroopaBeach::MinimapSettings() { - D_8018D220 = reinterpret_cast(dma_textures(gTextureExhaust3, 0x3C8U, 0x1000)); - D_8018D2A0 = 0.014f; - D_8018D2C0[0] = 268; - D_8018D2E0 = 40; - D_8018D2E8 = 21; -} - void KoopaTroopaBeach::InitCourseObjects() { } @@ -233,12 +231,6 @@ void KoopaTroopaBeach::WhatDoesThisDo(Player* player, int8_t playerId) {} void KoopaTroopaBeach::WhatDoesThisDoAI(Player* player, int8_t playerId) {} -// Positions the finishline on the minimap -void KoopaTroopaBeach::MinimapFinishlinePosition() { - //! todo: Place hard-coded values here. - draw_hud_2d_texture_8x8(this->Props.MinimapFinishlineX, this->Props.MinimapFinishlineY, (u8*) common_texture_minimap_finish_line); -} - void KoopaTroopaBeach::Render(struct UnkStruct_800DC5EC* arg0) { gDPPipeSync(gDisplayListHead++); gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); diff --git a/src/engine/courses/KoopaTroopaBeach.h b/src/engine/courses/KoopaTroopaBeach.h index cff01b2a2..7ebd8bac8 100644 --- a/src/engine/courses/KoopaTroopaBeach.h +++ b/src/engine/courses/KoopaTroopaBeach.h @@ -30,14 +30,12 @@ public: virtual void Load() override; virtual void LoadTextures() override; virtual void BeginPlay() override; - virtual void MinimapSettings() override; virtual void InitCourseObjects() override; virtual void UpdateCourseObjects() override; virtual void RenderCourseObjects(s32 cameraId) override; virtual void SomeSounds() override; virtual void WhatDoesThisDo(Player* player, int8_t playerId) override; virtual void WhatDoesThisDoAI(Player* player, int8_t playerId) override; - virtual void MinimapFinishlinePosition() override; virtual void Render(struct UnkStruct_800DC5EC*) override; virtual void RenderCredits() override; virtual void SomeCollisionThing(Player *player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32* arg4, f32* arg5, f32* arg6, f32* arg7) override; diff --git a/src/engine/courses/LuigiRaceway.cpp b/src/engine/courses/LuigiRaceway.cpp index 787cef62c..b0bd2cf93 100644 --- a/src/engine/courses/LuigiRaceway.cpp +++ b/src/engine/courses/LuigiRaceway.cpp @@ -9,6 +9,7 @@ #include "assets/luigi_raceway_data.h" #include "engine/objects/HotAirBalloon.h" #include "engine/actors/Finishline.h" +#include "engine/objects/GrandPrixBalloons.h" extern "C" { #include "main.h" @@ -88,8 +89,16 @@ LuigiRaceway::LuigiRaceway() { this->gfx = d_course_luigi_raceway_packed_dls; this->gfxSize = 6377; Props.textures = luigi_raceway_textures; - Props.MinimapTexture = gTextureCourseOutlineLuigiRaceway; - Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); + Props.Minimap.Texture = gTextureCourseOutlineLuigiRaceway; + Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture); + Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture); + Props.Minimap.Pos[0].X = 271; + Props.Minimap.Pos[0].Y = 170; + Props.Minimap.PlayerX = 45; + Props.Minimap.PlayerY = 60; + Props.Minimap.PlayerScaleFactor = 0.0155f; + Props.Minimap.FinishlineX = 0; + Props.Minimap.FinishlineY = 0; Props.Id = "mk:luigi_raceway"; Props.SetText(Props.Name, "luigi raceway", sizeof(Props.Name)); @@ -136,10 +145,9 @@ LuigiRaceway::LuigiRaceway() { Props.PathTable2[2] = NULL; Props.PathTable2[3] = NULL; + Props.CloudTexture = (u8*)LOAD_ASSET_RAW(gTextureExhaust2); Props.Clouds = gLuigiRacewayClouds; Props.CloudList = gLuigiRacewayClouds; - Props.MinimapFinishlineX = 0; - Props.MinimapFinishlineY = 0; Props.Skybox.TopRight = { 128, 184, 248 }; Props.Skybox.BottomRight = { 216, 232, 248 }; @@ -173,6 +181,7 @@ void LuigiRaceway::BeginPlay() { gWorldInstance.AddObject(new OHotAirBalloon(FVector(-1250.0f, 0.0f, 1110.0f))); } else { // Normal gameplay gWorldInstance.AddObject(new OHotAirBalloon(FVector(-176.0, 0.0f, -2323.0f))); + gWorldInstance.AddObject(new OGrandPrixBalloons(FVector(-140, -44, -215))); } if (gModeSelection == VERSUS) { @@ -188,38 +197,15 @@ void LuigiRaceway::BeginPlay() { } } -// Likely sets minimap boundaries -void LuigiRaceway::MinimapSettings() { - D_8018D220 = reinterpret_cast(dma_textures(gTextureExhaust2, 0x4F4U, 0xC00)); - D_8018D2A0 = 0.0155f; - D_8018D2C0[0] = 271; - D_8018D2E0 = 45; - D_8018D2E8 = 60; - D_80165718 = -140; - D_80165720 = -44; - D_80165728 = -215; -} - void LuigiRaceway::InitCourseObjects() { size_t i; if (gGamestate != CREDITS_SEQUENCE) { if (gModeSelection == GRAND_PRIX) { func_80070714(); } - - for (i = 0; i < D_80165738; i++) { - find_unused_obj_index(&gObjectParticle3[i]); - init_object(gObjectParticle3[i], 0); - } } } -void LuigiRaceway::UpdateCourseObjects() { -} - -void LuigiRaceway::RenderCourseObjects(s32 cameraId) { -} - void LuigiRaceway::SomeSounds() { vec3f_set(D_8015F748, 85.0f, 21.0f, -219.0f); func_800C9D80(D_8015F748, D_802B91C8, 0x5103700B); @@ -253,13 +239,6 @@ void LuigiRaceway::WhatDoesThisDoAI(Player* player, int8_t playerId) { } } -// Positions the finishline on the minimap -void LuigiRaceway::MinimapFinishlinePosition() { - //! todo: Place hard-coded values here. - draw_hud_2d_texture_8x8(this->Props.MinimapFinishlineX, this->Props.MinimapFinishlineY, - (u8*) common_texture_minimap_finish_line); -} - void LuigiRaceway::SetStaffGhost() { u32 temp_v0 = func_800B4E24(0) & 0xfffff; if (temp_v0 <= 11200) { @@ -449,6 +428,3 @@ void LuigiRaceway::SomeCollisionThing(Player* player, Vec3f arg1, Vec3f arg2, Ve f32* arg6, f32* arg7) { func_8003E9EC(player, arg1, arg2, arg3, arg4, arg5, arg6, arg7); } - -void LuigiRaceway::Destroy() { -} diff --git a/src/engine/courses/LuigiRaceway.h b/src/engine/courses/LuigiRaceway.h index 7ba5d2d7e..48a7d8c08 100644 --- a/src/engine/courses/LuigiRaceway.h +++ b/src/engine/courses/LuigiRaceway.h @@ -29,18 +29,13 @@ class LuigiRaceway : public Course { virtual void Load() override; virtual void LoadTextures() override; virtual void BeginPlay() override; - virtual void MinimapSettings() override; virtual void InitCourseObjects() override; - virtual void UpdateCourseObjects() override; - virtual void RenderCourseObjects(s32 cameraId) override; virtual void SomeSounds() override; virtual void WhatDoesThisDo(Player* player, int8_t playerId) override; virtual void WhatDoesThisDoAI(Player* player, int8_t playerId) override; - virtual void MinimapFinishlinePosition() override; virtual void SetStaffGhost() override; virtual void Render(struct UnkStruct_800DC5EC*) override; virtual void RenderCredits() override; virtual void SomeCollisionThing(Player* player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32* arg4, f32* arg5, f32* arg6, f32* arg7) override; - virtual void Destroy() override; }; diff --git a/src/engine/courses/MarioRaceway.cpp b/src/engine/courses/MarioRaceway.cpp index 910f5a342..a9ddb6733 100644 --- a/src/engine/courses/MarioRaceway.cpp +++ b/src/engine/courses/MarioRaceway.cpp @@ -8,6 +8,7 @@ #include "engine/actors/Finishline.h" #include "engine/objects/Object.h" #include "engine/objects/BombKart.h" +#include "engine/objects/GrandPrixBalloons.h" extern "C" { #include "main.h" @@ -73,9 +74,18 @@ MarioRaceway::MarioRaceway() { this->vtx = d_course_mario_raceway_vertex; this->gfx = d_course_mario_raceway_packed_dls; this->gfxSize = 3367; + Props.textures = mario_raceway_textures; - Props.MinimapTexture = gTextureCourseOutlineMarioRaceway; - Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); + Props.Minimap.Texture = gTextureCourseOutlineMarioRaceway; + Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture); + Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture); + Props.Minimap.Pos[0].X = 260; + Props.Minimap.Pos[0].Y = 170; + Props.Minimap.PlayerX = 6; + Props.Minimap.PlayerY = 28; + Props.Minimap.PlayerScaleFactor = 0.022f; + Props.Minimap.FinishlineX = 0; + Props.Minimap.FinishlineY = -2.0; Props.Id = "mk:mario_raceway"; Props.SetText(Props.Name, "mario raceway", sizeof(Props.Name)); @@ -123,10 +133,9 @@ MarioRaceway::MarioRaceway() { Props.PathTable2[2] = NULL; Props.PathTable2[3] = NULL; + Props.CloudTexture = (uint8_t*) LOAD_ASSET_RAW(gTextureExhaust5); Props.Clouds = gKalimariDesertClouds; Props.CloudList = gLuigiRacewayClouds; - Props.MinimapFinishlineX = 0; - Props.MinimapFinishlineY = -2.0; Props.Skybox.TopRight = {0, 184, 248}; Props.Skybox.BottomRight = {216, 232, 248}; @@ -201,19 +210,10 @@ void MarioRaceway::BeginPlay() { gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f)); gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f)); } -} -// Likely sets minimap boundaries -void MarioRaceway::MinimapSettings() { - D_8018D220 = reinterpret_cast(dma_textures(gTextureExhaust5, 0x443, 0x1000)); - D_8018D2A0 = 0.022f; - D_8018D2E0 = 6; - D_8018D2E8 = 28; - D_8018D2C0[0] = 260; - D_8018D2D8[0] = 170; - D_80165718 = 0; - D_80165720 = 5; - D_80165728 = -240; + if (gGamestate != CREDITS_SEQUENCE) { + gWorldInstance.AddObject(new OGrandPrixBalloons(FVector(0, 5, -240))); + } } void MarioRaceway::InitCourseObjects() { @@ -221,10 +221,6 @@ void MarioRaceway::InitCourseObjects() { if (gModeSelection == GRAND_PRIX) { func_80070714(); } - for (size_t i = 0; i < D_80165738; i++) { - find_unused_obj_index(&gObjectParticle3[i]); - init_object(gObjectParticle3[i], 0); - } } } @@ -263,12 +259,6 @@ void MarioRaceway::WhatDoesThisDoAI(Player* player, int8_t playerId) { } } -// Positions the finishline on the minimap -void MarioRaceway::MinimapFinishlinePosition() { - //! todo: Place hard-coded values here. - draw_hud_2d_texture_8x8(this->Props.MinimapFinishlineX, this->Props.MinimapFinishlineY, (u8*) common_texture_minimap_finish_line); -} - void MarioRaceway::SetStaffGhost() { u32 temp_v0 = func_800B4E24(0) & 0xfffff; if (temp_v0 <= 9000) { diff --git a/src/engine/courses/MarioRaceway.h b/src/engine/courses/MarioRaceway.h index f03d18667..e237f1538 100644 --- a/src/engine/courses/MarioRaceway.h +++ b/src/engine/courses/MarioRaceway.h @@ -27,12 +27,10 @@ public: virtual void Load() override; virtual void LoadTextures() override; virtual void BeginPlay() override; - virtual void MinimapSettings() override; virtual void InitCourseObjects() override; virtual void SomeSounds() override; virtual void WhatDoesThisDo(Player* player, int8_t playerId) override; virtual void WhatDoesThisDoAI(Player* player, int8_t playerId) override; - virtual void MinimapFinishlinePosition() override; virtual void SetStaffGhost() override; virtual void Render(struct UnkStruct_800DC5EC*) override; virtual void RenderCredits() override; diff --git a/src/engine/courses/MooMooFarm.cpp b/src/engine/courses/MooMooFarm.cpp index 485604c9f..304ad2210 100644 --- a/src/engine/courses/MooMooFarm.cpp +++ b/src/engine/courses/MooMooFarm.cpp @@ -75,8 +75,16 @@ MooMooFarm::MooMooFarm() { this->gfx = d_course_moo_moo_farm_packed_dls; this->gfxSize = 3304; Props.textures = moo_moo_farm_textures; - Props.MinimapTexture = gTextureCourseOutlineMooMooFarm; - Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); + Props.Minimap.Texture = gTextureCourseOutlineMooMooFarm; + Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture); + Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture); + Props.Minimap.Pos[0].X = 271; + Props.Minimap.Pos[0].Y = 170; + Props.Minimap.PlayerX = 18; + Props.Minimap.PlayerY = 36; + Props.Minimap.PlayerScaleFactor = 0.0155f; + Props.Minimap.FinishlineX = 0; + Props.Minimap.FinishlineY = 0; Props.SetText(Props.Name, "moo moo farm", sizeof(Props.Name)); Props.SetText(Props.DebugName, "farm", sizeof(Props.DebugName)); @@ -122,10 +130,9 @@ MooMooFarm::MooMooFarm() { Props.PathTable2[2] = NULL; Props.PathTable2[3] = NULL; + Props.CloudTexture = (u8*) LOAD_ASSET_RAW(gTextureExhaust0); Props.Clouds = gYoshiValleyMooMooFarmClouds; Props.CloudList = gYoshiValleyMooMooFarmClouds; - Props.MinimapFinishlineX = 0; - Props.MinimapFinishlineY = 0; Props.Skybox.TopRight = {0, 18, 255}; Props.Skybox.BottomRight = {197, 211, 255}; @@ -324,15 +331,6 @@ void MooMooFarm::BeginPlay() { } } -// Likely sets minimap boundaries -void MooMooFarm::MinimapSettings() { - D_8018D220 = reinterpret_cast(dma_textures(gTextureExhaust0, 0x479, 0xC00)); - D_8018D2A0 = 0.0155f; - D_8018D2C0[0] = 271; - D_8018D2E0 = 18; - D_8018D2E8 = 36; -} - void MooMooFarm::WhatDoesThisDo(Player* player, int8_t playerId) { if (((s16) gNearestWaypointByPlayerId[playerId] >= 0x145) && ((s16) gNearestWaypointByPlayerId[playerId] < 0x18B)) { @@ -363,12 +361,6 @@ void MooMooFarm::WhatDoesThisDoAI(Player* player, int8_t playerId) { } } -// Positions the finishline on the minimap -void MooMooFarm::MinimapFinishlinePosition() { - //! todo: Place hard-coded values here. - draw_hud_2d_texture_8x8(this->Props.MinimapFinishlineX, this->Props.MinimapFinishlineY, (u8*) common_texture_minimap_finish_line); -} - void MooMooFarm::Render(struct UnkStruct_800DC5EC* arg0) { s16 temp_s0 = arg0->pathCounter; s16 temp_s1 = arg0->playerDirection; diff --git a/src/engine/courses/MooMooFarm.h b/src/engine/courses/MooMooFarm.h index ec69f47dc..3c18e5024 100644 --- a/src/engine/courses/MooMooFarm.h +++ b/src/engine/courses/MooMooFarm.h @@ -30,10 +30,8 @@ public: virtual void Load() override; virtual void LoadTextures() override; virtual void BeginPlay() override; - virtual void MinimapSettings() override; virtual void WhatDoesThisDo(Player* player, int8_t playerId) override; virtual void WhatDoesThisDoAI(Player* player, int8_t playerId) override; - virtual void MinimapFinishlinePosition() override; virtual void Render(struct UnkStruct_800DC5EC*) override; virtual void RenderCredits() override; virtual void CreditsSpawnActors() override; diff --git a/src/engine/courses/PodiumCeremony.cpp b/src/engine/courses/PodiumCeremony.cpp index 61f1525d7..a4c01f588 100644 --- a/src/engine/courses/PodiumCeremony.cpp +++ b/src/engine/courses/PodiumCeremony.cpp @@ -12,6 +12,7 @@ #include "engine/objects/Podium.h" #include "engine/objects/CheepCheep.h" #include "engine/particles/StarEmitter.h" +#include "engine/objects/GrandPrixBalloons.h" extern "C" { #include "main.h" @@ -91,7 +92,15 @@ PodiumCeremony::PodiumCeremony() { this->gfx = d_course_royal_raceway_packed_dls; this->gfxSize = 5670; Props.textures = podium_ceremony_textures; - Props.MinimapDimensions = IVector2D(0, 0); + Props.Minimap.Width = 0; + Props.Minimap.Height = 0; + Props.Minimap.Pos[0].X = 262; + Props.Minimap.Pos[0].Y = 170; + Props.Minimap.PlayerX = 37; + Props.Minimap.PlayerY = 50; + Props.Minimap.PlayerScaleFactor = 0.014f; + Props.Minimap.FinishlineX = 0; + Props.Minimap.FinishlineY = 0; Props.SetText(Props.Name, "royal raceway", sizeof(Props.Name)); Props.SetText(Props.DebugName, "p circuit", sizeof(Props.DebugName)); @@ -134,10 +143,9 @@ PodiumCeremony::PodiumCeremony() { Props.PathTable2[2] = NULL; Props.PathTable2[3] = NULL; + Props.CloudTexture = (u8*) LOAD_ASSET_RAW(gTextureExhaust4); Props.Clouds = NULL; // no clouds Props.CloudList = NULL; - Props.MinimapFinishlineX = 0; - Props.MinimapFinishlineY = 0; Props.Skybox.TopRight = {238, 144, 255}; Props.Skybox.BottomRight = {255, 224, 240}; @@ -199,18 +207,10 @@ void PodiumCeremony::BeginPlay() { gWorldInstance.AddObject(new OBombKart(kart, &D_80164550[3][100], 100, 0, 1.0f)); gWorldInstance.AddObject(new OBombKart(kart, &D_80164550[3][120], 120, 0, 1.0f)); gWorldInstance.AddObject(new OBombKart(kart, &D_80164550[3][140], 140, 0, 1.0f)); -} -// Likely sets minimap boundaries -void PodiumCeremony::MinimapSettings() { - D_8018D220 = reinterpret_cast(dma_textures(gTextureExhaust4, 0x3F8, 0x1000)); - D_8018D2C0[0] = 262; - D_8018D2A0 = 0.014f; - D_8018D2E0 = 37; - D_8018D2E8 = 50; - D_80165718 = -64; - D_80165720 = 5; - D_80165728 = -330; + if (gGamestate != CREDITS_SEQUENCE) { + gWorldInstance.AddObject(new OGrandPrixBalloons(FVector(-64, 5, -330))); + } } void PodiumCeremony::InitCourseObjects() { @@ -219,10 +219,6 @@ void PodiumCeremony::InitCourseObjects() { if (gModeSelection == GRAND_PRIX) { func_80070714(); } - for (i = 0; i < D_80165738; i++) { - find_unused_obj_index(&gObjectParticle3[i]); - init_object(gObjectParticle3[i], 0); - } } } @@ -259,12 +255,6 @@ void PodiumCeremony::WhatDoesThisDoAI(Player* player, int8_t playerId) { } } -// Positions the finishline on the minimap -void PodiumCeremony::MinimapFinishlinePosition() { - //! todo: Place hard-coded values here. - draw_hud_2d_texture_8x8(this->Props.MinimapFinishlineX, this->Props.MinimapFinishlineY, (u8*) common_texture_minimap_finish_line); -} - void PodiumCeremony::Render(struct UnkStruct_800DC5EC* arg0) { gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH); diff --git a/src/engine/courses/PodiumCeremony.h b/src/engine/courses/PodiumCeremony.h index cbafffec7..6026d7f9f 100644 --- a/src/engine/courses/PodiumCeremony.h +++ b/src/engine/courses/PodiumCeremony.h @@ -29,12 +29,10 @@ public: virtual void LoadTextures() override; virtual void BeginPlay() override; //virtual void InitClouds() override; - virtual void MinimapSettings() override; virtual void InitCourseObjects() override; virtual void SomeSounds() override; virtual void WhatDoesThisDo(Player* player, int8_t playerId) override; virtual void WhatDoesThisDoAI(Player* player, int8_t playerId) override; - virtual void MinimapFinishlinePosition() override; virtual void Render(struct UnkStruct_800DC5EC*) override; virtual void RenderCredits() override; virtual void Destroy() override; diff --git a/src/engine/courses/RainbowRoad.cpp b/src/engine/courses/RainbowRoad.cpp index 573853e16..7c60d3af3 100644 --- a/src/engine/courses/RainbowRoad.cpp +++ b/src/engine/courses/RainbowRoad.cpp @@ -49,8 +49,16 @@ RainbowRoad::RainbowRoad() { this->gfx = d_course_rainbow_road_packed_dls; this->gfxSize = 5670; Props.textures = rainbow_road_textures; - Props.MinimapTexture = gTextureCourseOutlineRainbowRoad; - Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); + Props.Minimap.Texture = gTextureCourseOutlineRainbowRoad; + Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture); + Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture); + Props.Minimap.Pos[0].X = 261; + Props.Minimap.Pos[0].Y = 166; + Props.Minimap.PlayerX = 39; + Props.Minimap.PlayerY = 55; + Props.Minimap.PlayerScaleFactor = 0.0103f; + Props.Minimap.FinishlineX = 0; + Props.Minimap.FinishlineY = 0; Props.SetText(Props.Name, "rainbow road", sizeof(Props.Name)); Props.SetText(Props.DebugName, "rainbow", sizeof(Props.DebugName)); @@ -98,8 +106,6 @@ RainbowRoad::RainbowRoad() { Props.Clouds = gToadsTurnpikeRainbowRoadStars; Props.CloudList = gToadsTurnpikeRainbowRoadStars; - Props.MinimapFinishlineX = 0; - Props.MinimapFinishlineY = 0; Props.Skybox.TopRight = {0, 0, 0}; Props.Skybox.BottomRight = {0, 0, 0}; @@ -169,15 +175,6 @@ void RainbowRoad::UpdateClouds(s32 sp1C, Camera* camera) { update_stars(sp1C, camera, this->Props.CloudList); } -// Likely sets minimap boundaries -void RainbowRoad::MinimapSettings() { - D_8018D2A0 = 0.0103f; - D_8018D2C0[0] = 261; - D_8018D2D8[0] = 166; - D_8018D2E0 = 39; - D_8018D2E8 = 55; -} - void RainbowRoad::InitCourseObjects() { if (gGamestate != CREDITS_SEQUENCE) { size_t i; @@ -208,12 +205,6 @@ void RainbowRoad::WhatDoesThisDo(Player* player, int8_t playerId) {} void RainbowRoad::WhatDoesThisDoAI(Player* player, int8_t playerId) {} -// Positions the finishline on the minimap -void RainbowRoad::MinimapFinishlinePosition() { - //! todo: Place hard-coded values here. - draw_hud_2d_texture_8x8(this->Props.MinimapFinishlineX, this->Props.MinimapFinishlineY, (u8*) common_texture_minimap_finish_line); -} - void RainbowRoad::Render(struct UnkStruct_800DC5EC* arg0) { gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH); diff --git a/src/engine/courses/RainbowRoad.h b/src/engine/courses/RainbowRoad.h index ed467a6a1..282655ace 100644 --- a/src/engine/courses/RainbowRoad.h +++ b/src/engine/courses/RainbowRoad.h @@ -29,14 +29,12 @@ public: virtual void BeginPlay() override; virtual void InitClouds() override; virtual void UpdateClouds(s32, Camera*) override; - virtual void MinimapSettings() override; virtual void InitCourseObjects() override; virtual void UpdateCourseObjects() override; virtual void RenderCourseObjects(s32 cameraId) override; virtual void SomeSounds() override; virtual void WhatDoesThisDo(Player* player, int8_t playerId) override; virtual void WhatDoesThisDoAI(Player* player, int8_t playerId) override; - virtual void MinimapFinishlinePosition() override; virtual void Render(struct UnkStruct_800DC5EC*) override; virtual void RenderCredits() override; virtual void Waypoints(Player* player, int8_t playerId) override; diff --git a/src/engine/courses/RoyalRaceway.cpp b/src/engine/courses/RoyalRaceway.cpp index e6fba3a73..849087c3f 100644 --- a/src/engine/courses/RoyalRaceway.cpp +++ b/src/engine/courses/RoyalRaceway.cpp @@ -8,6 +8,7 @@ #include "engine/actors/Finishline.h" #include "engine/objects/BombKart.h" #include "assets/royal_raceway_data.h" +#include "engine/objects/GrandPrixBalloons.h" extern "C" { #include "main.h" @@ -86,8 +87,16 @@ RoyalRaceway::RoyalRaceway() { this->gfx = d_course_royal_raceway_packed_dls; this->gfxSize = 5670; Props.textures = royal_raceway_textures; - Props.MinimapTexture = gTextureCourseOutlineRoyalRaceway; - Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); + Props.Minimap.Texture = gTextureCourseOutlineRoyalRaceway; + Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture); + Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture); + Props.Minimap.Pos[0].X = 262; + Props.Minimap.Pos[0].Y = 170; + Props.Minimap.PlayerX = 37; + Props.Minimap.PlayerY = 50; + Props.Minimap.PlayerScaleFactor = 0.014f; + Props.Minimap.FinishlineX = 0; + Props.Minimap.FinishlineY = 0; Props.SetText(Props.Name, "royal raceway", sizeof(Props.Name)); Props.SetText(Props.DebugName, "p circuit", sizeof(Props.DebugName)); @@ -133,10 +142,9 @@ RoyalRaceway::RoyalRaceway() { Props.PathTable2[2] = NULL; Props.PathTable2[3] = NULL; + Props.CloudTexture = (u8*) LOAD_ASSET_RAW(gTextureExhaust4); Props.Clouds = gRoyalRacewayClouds; Props.CloudList = gRoyalRacewayClouds; - Props.MinimapFinishlineX = 0; - Props.MinimapFinishlineY = 0; Props.Skybox.TopRight = {238, 144, 255}; Props.Skybox.BottomRight = {255, 224, 240}; @@ -188,18 +196,9 @@ void RoyalRaceway::BeginPlay() { gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f)); gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f)); } -} - -// Likely sets minimap boundaries -void RoyalRaceway::MinimapSettings() { - D_8018D220 = reinterpret_cast(dma_textures(gTextureExhaust4, 0x3F8, 0x1000)); - D_8018D2C0[0] = 262; - D_8018D2A0 = 0.014f; - D_8018D2E0 = 37; - D_8018D2E8 = 50; - D_80165718 = -64; - D_80165720 = 5; - D_80165728 = -330; + if (gGamestate != CREDITS_SEQUENCE) { + gWorldInstance.AddObject(new OGrandPrixBalloons(FVector(-64, 5, -330))); + } } void RoyalRaceway::InitCourseObjects() { @@ -208,16 +207,9 @@ void RoyalRaceway::InitCourseObjects() { if (gModeSelection == GRAND_PRIX) { func_80070714(); } - for (i = 0; i < D_80165738; i++) { - find_unused_obj_index(&gObjectParticle3[i]); - init_object(gObjectParticle3[i], 0); - } } } -void RoyalRaceway::SomeSounds() { -} - void RoyalRaceway::WhatDoesThisDo(Player* player, int8_t playerId) { if (((s16) gNearestWaypointByPlayerId[playerId] >= 0x180) && ((s16) gNearestWaypointByPlayerId[playerId] < 0x1E1)) { @@ -248,12 +240,6 @@ void RoyalRaceway::WhatDoesThisDoAI(Player* player, int8_t playerId) { } } -// Positions the finishline on the minimap -void RoyalRaceway::MinimapFinishlinePosition() { - //! todo: Place hard-coded values here. - draw_hud_2d_texture_8x8(this->Props.MinimapFinishlineX, this->Props.MinimapFinishlineY, (u8*) common_texture_minimap_finish_line); -} - void RoyalRaceway::SetStaffGhost() { u32 temp_v0 = func_800B4E24(0) & 0xfffff; if (temp_v0 <= 16000) { @@ -322,5 +308,3 @@ void RoyalRaceway::ScrollingTextures() { // d_course_royal_raceway_packed_dl_A648 find_and_set_tile_size((uintptr_t) segmented_gfx_to_virtual((void*)0x0700A648), 0, D_802B87BC); } - -void RoyalRaceway::Destroy() { } diff --git a/src/engine/courses/RoyalRaceway.h b/src/engine/courses/RoyalRaceway.h index 9419bc891..7fe973edd 100644 --- a/src/engine/courses/RoyalRaceway.h +++ b/src/engine/courses/RoyalRaceway.h @@ -27,16 +27,12 @@ public: virtual void Load() override; virtual void LoadTextures() override; virtual void BeginPlay() override; - virtual void MinimapSettings() override; virtual void InitCourseObjects() override; - virtual void SomeSounds() override; virtual void WhatDoesThisDo(Player* player, int8_t playerId) override; virtual void WhatDoesThisDoAI(Player* player, int8_t playerId) override; - virtual void MinimapFinishlinePosition() override; virtual void SetStaffGhost() override; virtual void Render(struct UnkStruct_800DC5EC*) override; virtual void RenderCredits() override; virtual void ScrollingTextures() override; virtual void Waypoints(Player* player, int8_t playerId) override; - virtual void Destroy() override; }; diff --git a/src/engine/courses/SherbetLand.cpp b/src/engine/courses/SherbetLand.cpp index e15d1dcca..7eb7e958c 100644 --- a/src/engine/courses/SherbetLand.cpp +++ b/src/engine/courses/SherbetLand.cpp @@ -49,8 +49,17 @@ SherbetLand::SherbetLand() { this->gfx = d_course_sherbet_land_packed_dls; this->gfxSize = 1803; Props.textures = sherbet_land_textures; - Props.MinimapTexture = gTextureCourseOutlineSherbetLand; - Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); + Props.Minimap.Texture = gTextureCourseOutlineSherbetLand; + Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture); + Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture); + Props.Minimap.Pos[0].X = 262; + Props.Minimap.Pos[0].Y = 170; + Props.Minimap.PlayerX = 52; + Props.Minimap.PlayerY = 33; + Props.Minimap.PlayerScaleFactor = 0.015f; + Props.Minimap.FinishlineX = 0; + Props.Minimap.FinishlineY = 0; + Props.Minimap.Colour = {72, 100, 255}; Props.SetText(Props.Name, "sherbet land", sizeof(Props.Name)); Props.SetText(Props.DebugName, "sherbet", sizeof(Props.DebugName)); @@ -98,10 +107,9 @@ SherbetLand::SherbetLand() { Props.PathTable2[2] = NULL; Props.PathTable2[3] = NULL; + Props.CloudTexture = (u8*) LOAD_ASSET_RAW(gTextureExhaust1); Props.Clouds = gSherbetLandClouds; Props.CloudList = gSherbetLandClouds; - Props.MinimapFinishlineX = 0; - Props.MinimapFinishlineY = 0; Props.Skybox.TopRight = {128, 184, 248}; Props.Skybox.BottomRight = {216, 232, 248}; @@ -134,9 +142,6 @@ f32 SherbetLand::GetWaterLevel(FVector pos, Collision* collision) { return Props.WaterLevel; } -void SherbetLand::LoadTextures() { -} - void SherbetLand::BeginPlay() { spawn_all_item_boxes((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_sherbet_land_item_box_spawns)); @@ -212,21 +217,6 @@ void SherbetLand::BeginPlay() { } } -// Likely sets minimap boundaries -void SherbetLand::MinimapSettings() { - D_8018D220 = reinterpret_cast(dma_textures(gTextureExhaust1, 0x485, 0xC00)); - D_8018D2A0 = 0.015f; - D_8018D2C0[0] = 262; - D_8018D2E0 = 52; - D_8018D2E8 = 33; - D_8018D300 = 72; - D_8018D308 = 100; - D_8018D310 = 255; -} - -void SherbetLand::InitCourseObjects() { -} - void SherbetLand::UpdateCourseObjects() { if (gGamestate != CREDITS_SEQUENCE) { func_800842C8(); @@ -239,19 +229,6 @@ void SherbetLand::RenderCourseObjects(s32 cameraId) { } } -void SherbetLand::SomeSounds() { -} - -void SherbetLand::WhatDoesThisDo(Player* player, int8_t playerId) {} - -void SherbetLand::WhatDoesThisDoAI(Player* player, int8_t playerId) {} - -// Positions the finishline on the minimap -void SherbetLand::MinimapFinishlinePosition() { - //! todo: Place hard-coded values here. - draw_hud_2d_texture_8x8(this->Props.MinimapFinishlineX, this->Props.MinimapFinishlineY, (u8*) common_texture_minimap_finish_line); -} - void SherbetLand::Render(struct UnkStruct_800DC5EC* arg0) { gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING); @@ -297,5 +274,3 @@ void SherbetLand::CreditsSpawnActors() { // d_course_sherbet_land_packed_dl_2308 find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07002308), -0x6A, 0xFF, 0xFF, 0xFF); } - -void SherbetLand::Destroy() { } diff --git a/src/engine/courses/SherbetLand.h b/src/engine/courses/SherbetLand.h index e6c25df1b..eb62e2807 100644 --- a/src/engine/courses/SherbetLand.h +++ b/src/engine/courses/SherbetLand.h @@ -26,19 +26,11 @@ public: // course_texture* textures, const char* displaylists, size_t dlSize); virtual void Load() override; virtual f32 GetWaterLevel(FVector pos, Collision* collision) override; - virtual void LoadTextures() override; virtual void BeginPlay() override; - virtual void MinimapSettings() override; - virtual void InitCourseObjects() override; virtual void UpdateCourseObjects() override; virtual void RenderCourseObjects(s32 cameraId) override; - virtual void SomeSounds() override; - virtual void WhatDoesThisDo(Player* player, int8_t playerId) override; - virtual void WhatDoesThisDoAI(Player* player, int8_t playerId) override; - virtual void MinimapFinishlinePosition() override; virtual void Render(struct UnkStruct_800DC5EC*) override; virtual void RenderCredits() override; virtual void DrawWater(struct UnkStruct_800DC5EC* screen, uint16_t pathCounter, uint16_t cameraRot, uint16_t playerDirection) override; virtual void CreditsSpawnActors() override; - virtual void Destroy() override; }; diff --git a/src/engine/courses/Skyscraper.cpp b/src/engine/courses/Skyscraper.cpp index 9f3af6746..4c165a787 100644 --- a/src/engine/courses/Skyscraper.cpp +++ b/src/engine/courses/Skyscraper.cpp @@ -64,8 +64,16 @@ Skyscraper::Skyscraper() { this->gfx = d_course_skyscraper_packed_dls; this->gfxSize = 548; Props.textures = skyscraper_textures; - Props.MinimapTexture = gTextureCourseOutlineSkyscraper; - Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); + Props.Minimap.Texture = gTextureCourseOutlineSkyscraper; + Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture); + Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture); + Props.Minimap.Pos[0].X = 257; + Props.Minimap.Pos[0].Y = 170; + Props.Minimap.PlayerX = 32; + Props.Minimap.PlayerY = 32; + Props.Minimap.PlayerScaleFactor = 0.0445f; + Props.Minimap.FinishlineX = 0; + Props.Minimap.FinishlineY = 0; Props.SetText(Props.Name, "skyscraper", sizeof(Props.Name)); Props.SetText(Props.DebugName, "skyscraper", sizeof(Props.DebugName)); @@ -113,8 +121,6 @@ Skyscraper::Skyscraper() { Props.Clouds = NULL; // no clouds Props.CloudList = NULL; - Props.MinimapFinishlineX = 0; - Props.MinimapFinishlineY = 0; Props.Skybox.TopRight = {0, 0, 0}; Props.Skybox.BottomRight = {0, 0, 0}; @@ -158,13 +164,6 @@ void Skyscraper::BeginPlay() { } } -// Likely sets minimap boundaries -void Skyscraper::MinimapSettings() { - D_8018D2A0 = 0.0445f; - D_8018D2E0 = 32; - D_8018D2E8 = 32; -} - void Skyscraper::InitCourseObjects() {} void Skyscraper::SomeSounds() {} @@ -173,12 +172,6 @@ void Skyscraper::WhatDoesThisDo(Player* player, int8_t playerId) {} void Skyscraper::WhatDoesThisDoAI(Player* player, int8_t playerId) {} -// Positions the finishline on the minimap -void Skyscraper::MinimapFinishlinePosition() { - //! todo: Place hard-coded values here. - draw_hud_2d_texture_8x8(this->Props.MinimapFinishlineX, this->Props.MinimapFinishlineY, (u8*) common_texture_minimap_finish_line); -} - void Skyscraper::Render(struct UnkStruct_800DC5EC* arg0) { set_track_light_direction(D_800DC610, D_802B87D4, 0, 1); gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); diff --git a/src/engine/courses/Skyscraper.h b/src/engine/courses/Skyscraper.h index 774603c0e..ed6592121 100644 --- a/src/engine/courses/Skyscraper.h +++ b/src/engine/courses/Skyscraper.h @@ -28,12 +28,10 @@ public: virtual void LoadTextures() override; virtual void BeginPlay() override; //virtual void InitClouds() override; - virtual void MinimapSettings() override; virtual void InitCourseObjects() override; virtual void SomeSounds() override; virtual void WhatDoesThisDo(Player* player, int8_t playerId) override; virtual void WhatDoesThisDoAI(Player* player, int8_t playerId) override; - virtual void MinimapFinishlinePosition() override; virtual void Render(struct UnkStruct_800DC5EC*) override; virtual void RenderCredits() override; virtual void Waypoints(Player* player, int8_t playerId) override; diff --git a/src/engine/courses/TestCourse.cpp b/src/engine/courses/TestCourse.cpp index 1ad4cefbb..ea1e7a909 100644 --- a/src/engine/courses/TestCourse.cpp +++ b/src/engine/courses/TestCourse.cpp @@ -28,6 +28,7 @@ #include "engine/objects/HotAirBalloon.h" #include "engine/objects/Crab.h" #include "engine/objects/Boos.h" +#include "engine/objects/GrandPrixBalloons.h" extern "C" { #include "main.h" @@ -60,8 +61,17 @@ extern "C" { TestCourse::TestCourse() { this->gfxSize = 100; this->textures = NULL; - Props.MinimapTexture = gTextureCourseOutlineMarioRaceway; - Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); + Props.Minimap.Texture = gTextureCourseOutlineMarioRaceway; + Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture); + Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture); + Props.Minimap.Pos[0].X = 260; + Props.Minimap.Pos[0].Y = 170; + Props.Minimap.PlayerX = 6; + Props.Minimap.PlayerY = 28; + Props.Minimap.PlayerScaleFactor = 0.022f; + Props.Minimap.FinishlineX = 0; + Props.Minimap.FinishlineY = 0; + Props.Minimap.Colour = {255, 255, 255}; Props.Id = "mk:test_course"; @@ -109,10 +119,9 @@ TestCourse::TestCourse() { Props.PathTable2[2] = NULL; Props.PathTable2[3] = NULL; + Props.CloudTexture = (u8*) LOAD_ASSET_RAW(gTextureExhaust5); Props.Clouds = gKalimariDesertClouds; Props.CloudList = gLuigiRacewayClouds; - Props.MinimapFinishlineX = 0; - Props.MinimapFinishlineY = 0; Props.Skybox.TopRight = {120, 140, 188}; Props.Skybox.BottomRight = {216, 232, 248}; @@ -287,25 +296,9 @@ void TestCourse::BeginPlay() { gWorldInstance.AddActor(new AShip(FVector(0, 0, 0), AShip::Skin::SHIP3)); + gWorldInstance.AddObject(new OGrandPrixBalloons(FVector(0, 0, 0))); } -// Likely sets minimap boundaries -void TestCourse::MinimapSettings() { - D_8018D220 = reinterpret_cast(dma_textures(gTextureExhaust5, 0x443, 0x1000)); - D_8018D2A0 = 0.022f; - D_8018D2E0 = 6; - D_8018D2E8 = 28; - D_8018D2C0[0] = 260; - D_8018D2D8[0] = 170; - D_80165718 = 0; - D_80165720 = 5; - D_80165728 = -240; -} - -void TestCourse::InitCourseObjects() {} - -void TestCourse::SomeSounds() {} - void TestCourse::WhatDoesThisDo(Player* player, int8_t playerId) { if (((s16) gNearestWaypointByPlayerId[playerId] >= 0x19B) && ((s16) gNearestWaypointByPlayerId[playerId] < 0x1B9)) { @@ -336,12 +329,6 @@ void TestCourse::WhatDoesThisDoAI(Player* player, int8_t playerId) { } } -// Positions the finishline on the minimap -void TestCourse::MinimapFinishlinePosition() { - //! todo: Place hard-coded values here. - draw_hud_2d_texture_8x8(this->Props.MinimapFinishlineX, this->Props.MinimapFinishlineY, (u8*) common_texture_minimap_finish_line); -} - void TestCourse::Render(struct UnkStruct_800DC5EC* arg0) { gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH); gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING); @@ -357,11 +344,6 @@ void TestCourse::Render(struct UnkStruct_800DC5EC* arg0) { gSPDisplayList(gDisplayListHead++, mario_Plane_001_mesh); } -void TestCourse::RenderCredits() { -} - -void TestCourse::Destroy() { } - bool TestCourse::IsMod() { return true; } \ No newline at end of file diff --git a/src/engine/courses/TestCourse.h b/src/engine/courses/TestCourse.h index 192400252..d44e0a266 100644 --- a/src/engine/courses/TestCourse.h +++ b/src/engine/courses/TestCourse.h @@ -27,14 +27,8 @@ public: virtual void Load() override; virtual void LoadTextures() override; virtual void BeginPlay() override; - virtual void MinimapSettings() override; - virtual void InitCourseObjects() override; - virtual void SomeSounds() override; virtual void WhatDoesThisDo(Player* player, int8_t playerId) override; virtual void WhatDoesThisDoAI(Player* player, int8_t playerId) override; - virtual void MinimapFinishlinePosition() override; virtual void Render(struct UnkStruct_800DC5EC*) override; - virtual void RenderCredits() override; - virtual void Destroy() override; virtual bool IsMod() override; }; diff --git a/src/engine/courses/ToadsTurnpike.cpp b/src/engine/courses/ToadsTurnpike.cpp index d6b4f14c3..867fedf25 100644 --- a/src/engine/courses/ToadsTurnpike.cpp +++ b/src/engine/courses/ToadsTurnpike.cpp @@ -70,8 +70,16 @@ ToadsTurnpike::ToadsTurnpike() { this->gfx = d_course_toads_turnpike_packed_dls; this->gfxSize = 3427; Props.textures = toads_turnpike_textures; - Props.MinimapTexture = gTextureCourseOutlineToadsTurnpike; - Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); + Props.Minimap.Texture = gTextureCourseOutlineToadsTurnpike; + Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture); + Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture); + Props.Minimap.Pos[0].X = 252; + Props.Minimap.Pos[0].Y = 170; + Props.Minimap.PlayerX = 57; + Props.Minimap.PlayerY = 44; + Props.Minimap.PlayerScaleFactor = 0.013f; + Props.Minimap.FinishlineX = 0; + Props.Minimap.FinishlineY = 0; Props.SetText(Props.Name, "toad's turnpike", sizeof(Props.Name)); Props.SetText(Props.DebugName, "highway", sizeof(Props.DebugName)); @@ -127,9 +135,6 @@ ToadsTurnpike::ToadsTurnpike() { this->FinishlineSpawnPoint = finish; - Props.MinimapFinishlineX = 0; - Props.MinimapFinishlineY = 0; - Props.Skybox.TopRight = {0, 2, 94}; Props.Skybox.BottomRight = {209, 65, 23}; Props.Skybox.BottomLeft = {209, 65, 23}; @@ -216,14 +221,6 @@ void ToadsTurnpike::UpdateClouds(s32 sp1C, Camera* camera) { update_stars(sp1C, camera, this->Props.CloudList); } -// Likely sets minimap boundaries -void ToadsTurnpike::MinimapSettings() { - D_8018D2A0 = 0.013f; - D_8018D2C0[0] = 252; - D_8018D2E0 = 57; - D_8018D2E8 = 44; -} - void ToadsTurnpike::SomeSounds() {} void ToadsTurnpike::WhatDoesThisDo(Player* player, int8_t playerId) { @@ -254,12 +251,6 @@ void ToadsTurnpike::WhatDoesThisDoAI(Player* player, int8_t playerId) { } } -// Positions the finishline on the minimap -void ToadsTurnpike::MinimapFinishlinePosition() { - //! todo: Place hard-coded values here. - draw_hud_2d_texture_8x8(this->Props.MinimapFinishlineX, this->Props.MinimapFinishlineY, (u8*) common_texture_minimap_finish_line); -} - void ToadsTurnpike::Render(struct UnkStruct_800DC5EC* arg0) { set_track_light_direction(D_800DC610, D_802B87D4, 0, 1); gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); diff --git a/src/engine/courses/ToadsTurnpike.h b/src/engine/courses/ToadsTurnpike.h index 310fe0d17..de145849d 100644 --- a/src/engine/courses/ToadsTurnpike.h +++ b/src/engine/courses/ToadsTurnpike.h @@ -29,11 +29,9 @@ public: virtual void BeginPlay() override; virtual void InitClouds() override; virtual void UpdateClouds(s32, Camera*) override; - virtual void MinimapSettings() override; virtual void SomeSounds() override; virtual void WhatDoesThisDo(Player* player, int8_t playerId) override; virtual void WhatDoesThisDoAI(Player* player, int8_t playerId) override; - virtual void MinimapFinishlinePosition() override; virtual void Render(struct UnkStruct_800DC5EC*) override; virtual void RenderCredits() override; virtual void Destroy() override; diff --git a/src/engine/courses/WarioStadium.cpp b/src/engine/courses/WarioStadium.cpp index 5bb37c924..b703323f4 100644 --- a/src/engine/courses/WarioStadium.cpp +++ b/src/engine/courses/WarioStadium.cpp @@ -66,8 +66,16 @@ WarioStadium::WarioStadium() { this->gfx = d_course_wario_stadium_packed_dls; this->gfxSize = 5272; Props.textures = wario_stadium_textures; - Props.MinimapTexture = gTextureCourseOutlineWarioStadium; - Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); + Props.Minimap.Texture = gTextureCourseOutlineWarioStadium; + Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture); + Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture); + Props.Minimap.Pos[0].X = 262; + Props.Minimap.Pos[0].Y = 170; + Props.Minimap.PlayerX = 53; + Props.Minimap.PlayerY = 35; + Props.Minimap.PlayerScaleFactor = 0.0155f; + Props.Minimap.FinishlineX = 0; + Props.Minimap.FinishlineY = 0; Props.SetText(Props.Name, "wario stadium", sizeof(Props.Name)); Props.SetText(Props.DebugName, "stadium", sizeof(Props.DebugName)); @@ -123,9 +131,6 @@ WarioStadium::WarioStadium() { this->FinishlineSpawnPoint = finish; - Props.MinimapFinishlineX = 0; - Props.MinimapFinishlineY = 0; - Props.Skybox.TopRight = { 20, 30, 56 }; Props.Skybox.BottomRight = { 40, 60, 110 }; Props.Skybox.BottomLeft = { 40, 60, 110 }; @@ -200,14 +205,6 @@ void WarioStadium::UpdateClouds(s32 sp1C, Camera* camera) { update_stars(sp1C, camera, this->Props.CloudList); } -// Likely sets minimap boundaries -void WarioStadium::MinimapSettings() { - D_8018D2A0 = 0.0155f; - D_8018D2C0[0] = 0x0106; - D_8018D2E0 = 53; - D_8018D2E8 = 35; -} - void WarioStadium::InitCourseObjects() { } @@ -228,13 +225,6 @@ void WarioStadium::WhatDoesThisDo(Player* player, int8_t playerId) { void WarioStadium::WhatDoesThisDoAI(Player* player, int8_t playerId) { } -// Positions the finishline on the minimap -void WarioStadium::MinimapFinishlinePosition() { - //! todo: Place hard-coded values here. - draw_hud_2d_texture_8x8(this->Props.MinimapFinishlineX, this->Props.MinimapFinishlineY, - (u8*) common_texture_minimap_finish_line); -} - void WarioStadium::Jumbotron() { gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); gDPTileSync(gDisplayListHead++); diff --git a/src/engine/courses/WarioStadium.h b/src/engine/courses/WarioStadium.h index 1cc62433d..91f613c1b 100644 --- a/src/engine/courses/WarioStadium.h +++ b/src/engine/courses/WarioStadium.h @@ -31,12 +31,10 @@ class WarioStadium : public Course { virtual void BeginPlay() override; virtual void InitClouds() override; virtual void UpdateClouds(s32, Camera*) override; - virtual void MinimapSettings() override; virtual void InitCourseObjects() override; virtual void SomeSounds() override; virtual void WhatDoesThisDo(Player* player, int8_t playerId) override; virtual void WhatDoesThisDoAI(Player* player, int8_t playerId) override; - virtual void MinimapFinishlinePosition() override; virtual void Render(struct UnkStruct_800DC5EC*) override; virtual void RenderCredits() override; virtual void SomeCollisionThing(Player* player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32* arg4, f32* arg5, f32* arg6, diff --git a/src/engine/courses/YoshiValley.cpp b/src/engine/courses/YoshiValley.cpp index 75ea1a6a6..5fbcbea69 100644 --- a/src/engine/courses/YoshiValley.cpp +++ b/src/engine/courses/YoshiValley.cpp @@ -61,8 +61,14 @@ YoshiValley::YoshiValley() { this->gfxSize = 4140; Props.textures = yoshi_valley_textures; - Props.MinimapTexture = gTextureCourseOutlineYoshiValley; - Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(Props.MinimapTexture), ResourceGetTexHeightByName(Props.MinimapTexture)); + Props.Minimap.Texture = gTextureCourseOutlineYoshiValley; + Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture); + Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture); + Props.Minimap.PlayerX = 61; + Props.Minimap.PlayerY = 38; + Props.Minimap.PlayerScaleFactor = 0.018f; + Props.Minimap.FinishlineX = 0; + Props.Minimap.FinishlineY = 0; Props.SetText(Props.Name, "yoshi valley", sizeof(Props.Name)); Props.SetText(Props.DebugName, "maze", sizeof(Props.DebugName)); @@ -108,10 +114,9 @@ YoshiValley::YoshiValley() { Props.PathTable2[2] = (TrackWaypoint*)LOAD_ASSET_RAW(d_course_yoshi_valley_track_waypoints_3); Props.PathTable2[3] = (TrackWaypoint*)LOAD_ASSET_RAW(d_course_yoshi_valley_track_waypoints_4); + Props.CloudTexture = (u8*) LOAD_ASSET_RAW(gTextureExhaust0); Props.Clouds = gYoshiValleyMooMooFarmClouds; Props.CloudList = gYoshiValleyMooMooFarmClouds; - Props.MinimapFinishlineX = 0; - Props.MinimapFinishlineY = 0; Props.Skybox.TopRight = {113, 70, 255}; Props.Skybox.BottomRight = {255, 184, 99}; @@ -195,14 +200,6 @@ void YoshiValley::BeginPlay() { } } -// Likely sets minimap boundaries -void YoshiValley::MinimapSettings() { - D_8018D220 = reinterpret_cast(dma_textures(gTextureExhaust0, 0x479, 0xC00)); - D_8018D2A0 = 0.018f; - D_8018D2E0 = 61; - D_8018D2E8 = 38; -} - void YoshiValley::InitCourseObjects() { } @@ -219,12 +216,6 @@ void YoshiValley::WhatDoesThisDo(Player* player, int8_t playerId) {} void YoshiValley::WhatDoesThisDoAI(Player* player, int8_t playerId) {} -// Positions the finishline on the minimap -void YoshiValley::MinimapFinishlinePosition() { - //! todo: Place hard-coded values here. - draw_hud_2d_texture_8x8(this->Props.MinimapFinishlineX, this->Props.MinimapFinishlineY, (u8*) common_texture_minimap_finish_line); -} - void YoshiValley::Render(struct UnkStruct_800DC5EC* arg0) { gDPPipeSync(gDisplayListHead++); gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEI, G_CC_MODULATEI); diff --git a/src/engine/courses/YoshiValley.h b/src/engine/courses/YoshiValley.h index fcad27672..b4ec8d442 100644 --- a/src/engine/courses/YoshiValley.h +++ b/src/engine/courses/YoshiValley.h @@ -27,14 +27,12 @@ public: virtual void Load() override; virtual void LoadTextures() override; virtual void BeginPlay() override; - virtual void MinimapSettings() override; virtual void InitCourseObjects() override; virtual void UpdateCourseObjects() override; virtual void RenderCourseObjects(s32 cameraId) override; virtual void SomeSounds() override; virtual void WhatDoesThisDo(Player* player, int8_t playerId) override; virtual void WhatDoesThisDoAI(Player* player, int8_t playerId) override; - virtual void MinimapFinishlinePosition() override; virtual void Render(struct UnkStruct_800DC5EC*) override; virtual void RenderCredits() override; virtual void ScrollingTextures() override; diff --git a/src/engine/editor/SceneManager.cpp b/src/engine/editor/SceneManager.cpp index 1040bd16f..bd288af69 100644 --- a/src/engine/editor/SceneManager.cpp +++ b/src/engine/editor/SceneManager.cpp @@ -47,15 +47,19 @@ namespace Editor { // } // data["Objects"] = objects; - auto dat = data.dump(); - std::vector stringify; - stringify.assign(dat.begin(), dat.end()); + try { + auto dat = data.dump(); + std::vector stringify; + stringify.assign(dat.begin(), dat.end()); - bool wrote = GameEngine::Instance->context->GetResourceManager()->GetArchiveManager()->WriteFile(CurrentArchive, SceneFile, stringify); - if (wrote) { - printf("Successfully wrote scene file!\n Wrote: %s\n", SceneFile.c_str()); - } else { - printf("Failed to write scene file!\n"); + bool wrote = GameEngine::Instance->context->GetResourceManager()->GetArchiveManager()->WriteFile(CurrentArchive, SceneFile, stringify); + if (wrote) { + printf("Successfully wrote scene file!\n Wrote: %s\n", SceneFile.c_str()); + } else { + printf("Failed to write scene file!\n"); + } + } catch (const nlohmann::json::exception& e) { + printf("SceneManager::SaveLevel():\n JSON error during dump: %s\n", e.what()); } } else { printf("Could not save scene file, SceneFile or CurrentArchive not set\n"); @@ -63,8 +67,6 @@ namespace Editor { } void LoadLevel(std::shared_ptr archive, Course* course, std::string sceneFile) { - nlohmann::json data; - SceneFile = sceneFile; if (archive) { @@ -78,7 +80,7 @@ namespace Editor { nlohmann::json data = std::static_pointer_cast( GameEngine::Instance->context->GetResourceManager()->LoadResource(sceneFile, true, initData))->Data; - if (data == nullptr) { + if (data.is_null() || data.empty()) { return; } @@ -134,13 +136,15 @@ namespace Editor { GameEngine::Instance->context->GetResourceManager()->LoadResource(filePath, true, initData)); if (ptr) { - MK64::MinimapTexture texture = ptr->Texture; printf("LOADED MINIMAP!\n"); - course->Props.MinimapTexture = (const char*)texture.Data; - course->Props.MinimapDimensions = IVector2D(texture.Width, texture.Height); - } else { - course->Props.MinimapTexture = gTextureCourseOutlineMarioRaceway; - course->Props.MinimapDimensions = IVector2D(ResourceGetTexWidthByName(course->Props.MinimapTexture), ResourceGetTexHeightByName(course->Props.MinimapTexture)); + MK64::MinimapTexture texture = ptr->Texture; + course->Props.Minimap.Texture = (const char*)texture.Data; + course->Props.Minimap.Width = texture.Width; + course->Props.Minimap.Height = texture.Height; + } else { // Fallback + course->Props.Minimap.Texture = gTextureCourseOutlineMarioRaceway; + course->Props.Minimap.Width = ResourceGetTexWidthByName(course->Props.Minimap.Texture); + course->Props.Minimap.Height = ResourceGetTexHeightByName(course->Props.Minimap.Texture); } } } diff --git a/src/engine/objects/GrandPrixBalloons.cpp b/src/engine/objects/GrandPrixBalloons.cpp new file mode 100644 index 000000000..de279a128 --- /dev/null +++ b/src/engine/objects/GrandPrixBalloons.cpp @@ -0,0 +1,222 @@ +#include "GrandPrixBalloons.h" + +#include "port/Game.h" +#include "assets/other_textures.h" +#include "assets/common_data.h" + +extern "C" { +#include "update_objects.h" +#include "render_objects.h" +#include "code_80057C60.h" +#include "code_80086E70.h" +#include "math_util.h" +#include "math_util_2.h" +#include "menus.h" +} + +size_t OGrandPrixBalloons::_count = 0; + +OGrandPrixBalloons::OGrandPrixBalloons(const FVector& pos) { + Pos = pos; + +// D_80165730 = 1; + if (gPlayerCount == 1) { + D_80165738 = 0x64; + D_80165740 = 0x3C; + D_80165748 = 0x1E; + } else { + D_80165738 = 0x32; + D_80165740 = 0x1E; + D_80165748 = 0xA; + } + + for (size_t i = 0; i < D_80165738; i++) { + find_unused_obj_index(&gObjectParticle3[i]); + init_object(gObjectParticle3[i], 0); + } +} + +void OGrandPrixBalloons::Tick() { + s32 someIndex; + s32 objectIndex; + s32 someCount; + Object* object; + + if (!D_80165730) { + return; + } + someCount = 0; + for (someIndex = 0; someIndex < D_80165738; someIndex++) { + objectIndex = gObjectParticle3[someIndex]; + if (objectIndex != DELETED_OBJECT_ID) { + object = &gObjectList[objectIndex]; + if (object->state != 0) { + OGrandPrixBalloons::func_80074E28(objectIndex); + OGrandPrixBalloons::func_80074D94(objectIndex); + if (object->state == 0) { + delete_object_wrapper(&gObjectParticle3[someIndex]); + } + someCount += 1; + } + } + } + if (someCount == 0) { + D_80165730 = 0; + } +} + +void OGrandPrixBalloons::Draw(s32 cameraId) { + s32 var_s1; + s32 objectIndex; + if (!D_80165730) { + return; + } + + gSPDisplayList(gDisplayListHead++, (Gfx*)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((uint8_t*)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)) { + OGrandPrixBalloons::func_80053D74(objectIndex, cameraId, 0); + } + } + rsp_load_texture((uint8_t*)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)) { + OGrandPrixBalloons::func_80053D74(objectIndex, cameraId, 4); + } + } +} + +void OGrandPrixBalloons::func_80053D74(s32 objectIndex, UNUSED s32 arg1, s32 vertexIndex) { + Object* object; + + Vtx* vtx = (Vtx*) LOAD_ASSET_RAW(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++, (uintptr_t)&vtx[vertexIndex], 4, 0); + gSPDisplayList(gDisplayListHead++, (Gfx*)common_rectangle_display); + } +} + +void OGrandPrixBalloons::func_80074924(s32 objectIndex) { + s32 sp2C = 0; + s32 sp28; + s32 sp24; + s32 sp20 = 0; + s32 temp_a0; + Object* object; + + object = &gObjectList[objectIndex]; + object->sizeScaling = 0.15f; + + if (GetCourse() == GetMarioRaceway()) { + sp2C = random_int(0x00C8U); + sp28 = random_int(D_80165748); + sp24 = random_int(0x0096U); + sp20 = random_int(0x2000U); + object->origin_pos[0] = (f32) ((((f64) Pos.x + 100.0) - (f64) sp2C) * (f64) xOrientation); + object->origin_pos[1] = (f32) (Pos.y + sp28); + object->origin_pos[2] = (f32) (((f64) Pos.z + 200.0) - (f64) sp24); + } else if (GetCourse() == GetRoyalRaceway()) { + sp2C = random_int(0x0168U); + sp28 = random_int(D_80165748); + sp24 = random_int(0x00B4U); + sp20 = random_int(0x2000U); + object->origin_pos[0] = (f32) ((((f64) Pos.x + 180.0) - (f64) sp2C) * (f64) xOrientation); + object->origin_pos[1] = (f32) (Pos.y + sp28); + object->origin_pos[2] = (f32) (((f64) Pos.z + 200.0) - (f64) sp24); + } else if (GetCourse() == GetLuigiRaceway()) { + sp2C = random_int(0x012CU); + sp28 = random_int(D_80165748); + sp24 = random_int(0x0096U); + sp20 = random_int(0x2000U); + object->origin_pos[0] = (f32) ((((f64) Pos.x + 150.0) - (f64) sp2C) * (f64) xOrientation); + object->origin_pos[1] = (f32) (Pos.y + sp28); + object->origin_pos[2] = (f32) (((f64) Pos.z + 200.0) - (f64) sp24); + } + + set_obj_origin_offset(objectIndex, 0, 0, 0); + if (gPlayerCount == 1) { + object->velocity[1] = (f32) (((f64) (f32) (sp2C % 4) * 0.25) + 0.8); + } else { + object->velocity[1] = (f32) (((f64) (f32) (sp2C % 3) * 0.2) + 0.4); + } + temp_a0 = sp2C % 8; + object->unk_084[0] = D_800E6F30[temp_a0][0]; + object->unk_084[1] = D_800E6F30[temp_a0][1]; + object->unk_084[2] = D_800E6F30[temp_a0][2]; + object->unk_084[3] = D_800E6F48[temp_a0][0]; + object->unk_084[4] = D_800E6F48[temp_a0][1]; + object->unk_084[5] = D_800E6F48[temp_a0][2]; + object->unk_084[6] = sp20 - 0x1000; + if (sp2C & 1) { + object->unk_084[7] = (sp20 / 32) + 0x100; + } else { + object->unk_084[7] = -0x100 - (sp20 / 32); + } + object->primAlpha = 0x00E6; + object_next_state(objectIndex); +} + +void OGrandPrixBalloons::func_80074D94(s32 objectIndex) { + if (gObjectList[objectIndex].unk_0AE == 1) { + if ((D_80165740 <= gObjectList[objectIndex].offset[1]) && + (s16_step_down_towards(&gObjectList[objectIndex].primAlpha, 0, 8) != 0)) { + func_80086F60(objectIndex); + } + object_add_velocity_offset_y(objectIndex); + } + object_calculate_new_pos_offset(objectIndex); +} + +void OGrandPrixBalloons::func_80074E28(s32 objectIndex) { + switch (gObjectList[objectIndex].state) { + case 1: + OGrandPrixBalloons::func_80074924(objectIndex); + break; + case 2: + if (set_and_run_timer_object(objectIndex, 1) != false) { + func_80086E70(objectIndex); + break; + } + case 0: + break; + case 3: + OGrandPrixBalloons::func_80041480(&gObjectList[objectIndex].unk_084[6], -0x1000, 0x1000, &gObjectList[objectIndex].unk_084[7]); + if (gObjectList[objectIndex].unk_0AE == 0) { + func_80072428(objectIndex); + } + break; + } +} + +void OGrandPrixBalloons::func_80041480(s16* arg0, s16 arg1, s16 arg2, s16* arg3) { + *arg0 += *arg3; + if (*arg3 >= 0) { + if (*arg0 >= arg2) { + *arg0 = arg2; + *arg3 = -*arg3; + } + } else if (arg1 >= *arg0) { + *arg0 = arg1; + *arg3 = -*arg3; + } +} \ No newline at end of file diff --git a/src/engine/objects/GrandPrixBalloons.h b/src/engine/objects/GrandPrixBalloons.h new file mode 100644 index 000000000..6d62366f6 --- /dev/null +++ b/src/engine/objects/GrandPrixBalloons.h @@ -0,0 +1,51 @@ +#pragma once + +#include +#include + +#include "engine/World.h" +#include "engine/objects/Object.h" + +extern "C" { +#include "macros.h" +#include "main.h" +#include "vehicles.h" +#include "waypoints.h" +#include "common_structs.h" +#include "objects.h" +#include "camera.h" +#include "some_data.h" +} + + + +/** + * Grand Prix Balloons OObject + */ +class OGrandPrixBalloons : public OObject { +public: + + explicit OGrandPrixBalloons(const FVector& pos); + + ~OGrandPrixBalloons() { + _count--; + } + + static size_t GetCount() { + return _count; + } + + virtual void Tick() override; + virtual void Draw(s32 cameraId) override; + void func_80053D74(s32 objectIndex, UNUSED s32 arg1, s32 vertexIndex); + + void func_80074924(s32 objectIndex); + void func_80074D94(s32 objectIndex); + void func_80074E28(s32 objectIndex); + void func_80041480(s16* arg0, s16 arg1, s16 arg2, s16* arg3); // Some weird math function + +private: + static size_t _count; + s32 _idx; + FVector Pos; +}; diff --git a/src/math_util_2.c b/src/math_util_2.c index 7cb396242..444f3e4c6 100644 --- a/src/math_util_2.c +++ b/src/math_util_2.c @@ -328,19 +328,6 @@ s32 f32_step_towards(f32* value, f32 target, f32 step) { return targetReached; } -void func_80041480(s16* arg0, s16 arg1, s16 arg2, s16* arg3) { - *arg0 += *arg3; - if (*arg3 >= 0) { - if (*arg0 >= arg2) { - *arg0 = arg2; - *arg3 = -*arg3; - } - } else if (arg1 >= *arg0) { - *arg0 = arg1; - *arg3 = -*arg3; - } -} - Vec3f* vec3f_set_xyz(Vec3f arg0, f32 arg1, f32 arg2, f32 arg3) { arg0[0] = arg1; arg0[1] = arg2; diff --git a/src/math_util_2.h b/src/math_util_2.h index de82c003c..75ad8e247 100644 --- a/src/math_util_2.h +++ b/src/math_util_2.h @@ -47,7 +47,6 @@ s32 s16_step_down_towards(s16*, s16, s16); s32 u16_step_down_towards(u16*, s32, s32); s32 s16_step_towards(s16*, s16, s16); s32 f32_step_towards(f32*, f32, f32); -void func_80041480(s16*, s16, s16, s16*); Vec3f* vec3f_set_xyz(Vec3f, f32, f32, f32); Vec3f* vec3f_normalize(Vec3f dest); Vec3f* vec3f_cross_product(Vec3f, Vec3f, Vec3f); diff --git a/src/port/Game.cpp b/src/port/Game.cpp index 5ac117364..483971a48 100644 --- a/src/port/Game.cpp +++ b/src/port/Game.cpp @@ -483,12 +483,6 @@ void CM_SomeCollisionThing(Player* player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f } } -void CM_MinimapSettings() { - if (gWorldInstance.CurrentCourse) { - gWorldInstance.CurrentCourse->MinimapSettings(); - } -} - void CM_InitCourseObjects() { if (gWorldInstance.CurrentCourse) { gWorldInstance.CurrentCourse->InitCourseObjects(); @@ -534,12 +528,6 @@ void CM_WhatDoesThisDoAI(Player* player, int8_t playerId) { } } -void CM_MinimapFinishlinePosition() { - if (gWorldInstance.CurrentCourse) { - gWorldInstance.CurrentCourse->MinimapFinishlinePosition(); - } -} - void CM_SetStaffGhost() { if (gWorldInstance.CurrentCourse) { gWorldInstance.CurrentCourse->SetStaffGhost(); diff --git a/src/port/Game.h b/src/port/Game.h index c21cb0326..2102cb7ea 100644 --- a/src/port/Game.h +++ b/src/port/Game.h @@ -90,8 +90,6 @@ void CM_Waypoints(Player* player, int8_t playerId); void CM_SomeCollisionThing(Player* player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32* arg4, f32* arg5, f32* arg6, f32* arg7); -void CM_MinimapSettings(); - void CM_InitCourseObjects(); void CM_UpdateCourseObjects(); @@ -106,8 +104,6 @@ void CM_WhatDoesThisDo(Player* player, int8_t playerId); void CM_WhatDoesThisDoAI(Player* player, int8_t playerId); -void CM_MinimapFinishlinePosition(); - void CM_SetStaffGhost(); void CM_BombKartsWaypoint(s32 cameraId); diff --git a/src/port/ui/ContentBrowser.cpp b/src/port/ui/ContentBrowser.cpp index fccc325b3..1682e01e6 100644 --- a/src/port/ui/ContentBrowser.cpp +++ b/src/port/ui/ContentBrowser.cpp @@ -118,6 +118,7 @@ namespace Editor { { "Trophy", [](const FVector& pos) { return new OTrophy(pos, OTrophy::TrophyType::GOLD_150, OTrophy::Behaviour::ROTATE2); } }, { "Snowman", [](const FVector& pos) { return new OSnowman(pos); } }, { "Podium", [](const FVector& pos) { return new OPodium(pos); } }, + { "Balloons", [](const FVector& pos) { return new OGrandPrixBalloons(pos); } }, }; void ContentBrowserWindow::AddTrackContent() { diff --git a/src/port/ui/TrackProperties.cpp b/src/port/ui/TrackProperties.cpp index 0d5a78ae4..9f1f45198 100644 --- a/src/port/ui/TrackProperties.cpp +++ b/src/port/ui/TrackProperties.cpp @@ -37,8 +37,6 @@ namespace Editor { ImGui::InputText("Name", gWorldInstance.CurrentCourse->Props.Name, IM_ARRAYSIZE(nameBuffer)); ImGui::InputText("Debug Name", gWorldInstance.CurrentCourse->Props.DebugName, IM_ARRAYSIZE(debugNameBuffer)); ImGui::InputText("Course Length", gWorldInstance.CurrentCourse->Props.CourseLength, IM_ARRAYSIZE(lengthBuffer)); - ImGui::InputFloat("Minimap Finishline X Offset", &gWorldInstance.CurrentCourse->Props.MinimapFinishlineX); - ImGui::InputFloat("Minimap Finishline Y Offset", &gWorldInstance.CurrentCourse->Props.MinimapFinishlineY); ImGui::InputFloat("Water Level", &gWorldInstance.CurrentCourse->Props.WaterLevel); if (ImGui::CollapsingHeader("Camera")) { @@ -95,6 +93,42 @@ namespace Editor { } } + float minimapColour[3]; + RGB8ToFloat((u8*)&gWorldInstance.CurrentCourse->Props.Minimap.Colour, minimapColour); + + if (ImGui::CollapsingHeader("Minimap")) { + ImGui::Text("Position"); + ImGui::SameLine(); + + + if (ImGui::DragInt2("##MinimapPosition", &gWorldInstance.CurrentCourse->Props.Minimap.Pos[0].X, 1.0f)) { + } + ImGui::Text("P2 Position"); + ImGui::SameLine(); + if (ImGui::DragInt2("##MinimapPosition2p", &gWorldInstance.CurrentCourse->Props.Minimap.Pos[1].X, 1.0f)) { + } + + ImGui::Text("Player Markers"); + ImGui::SameLine(); + if (ImGui::DragInt2("##MinimapPlayers", &gWorldInstance.CurrentCourse->Props.Minimap.PlayerX, 1.0f)) { + } + + ImGui::Text("Player Scale Factor"); + ImGui::SameLine(); + if (ImGui::DragFloat("##MinimapScaleFactor", &gWorldInstance.CurrentCourse->Props.Minimap.PlayerScaleFactor, 0.0001f)) { + } + + ImGui::Text("Finishline"); + ImGui::SameLine(); + ImGui::DragFloat2("##MinimapFinishlineX", &gWorldInstance.CurrentCourse->Props.Minimap.FinishlineX, 1.0f); + + ImGui::Text("Colour"); + ImGui::SameLine(); + ImGui::ColorEdit3("##MinimapColour", minimapColour, 1.0f); + } + + FloatToRGB8(minimapColour, (u8*)&gWorldInstance.CurrentCourse->Props.Minimap.Colour); + // Convert and pass to ImGui ColorEdit3 float topRight[3], bottomRight[3], bottomLeft[3], topLeft[3]; float floorTopRight[3], floorBottomRight[3], floorBottomLeft[3], floorTopLeft[3]; diff --git a/src/render_objects.c b/src/render_objects.c index 83ab348db..cd9d8bf76 100644 --- a/src/render_objects.c +++ b/src/render_objects.c @@ -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,18 +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; + 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()->MinimapFinishlineX; - var_f0 += CM_GetProps()->MinimapFinishlineY; + 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); } @@ -2764,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 @@ -3681,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; diff --git a/src/render_objects.h b/src/render_objects.h index d4c45eed7..e914de5d9 100644 --- a/src/render_objects.h +++ b/src/render_objects.h @@ -341,8 +341,6 @@ void translate_thwomp_lights(s32); void thwomp_lights(s32); void render_object_thwomps_model(s32); void render_object_thwomps(s32); -void func_80053D74(s32, s32, s32); -void render_balloons_grand_prix(s32); void render_object_train_smoke_particle(s32, s32); void render_object_trains_smoke_particles(s32); @@ -429,8 +427,8 @@ extern Vec3su D_80183E80; extern f32 D_8018CFEC; extern f32 D_8018CFF4; -extern s16 D_8018D2E0; -extern s16 D_8018D2E8; +extern s16 gMinimapPlayerX; +extern s16 gMinimapPlayerY; extern u8* D_8018D4BC; extern u8* D_8018D4C0; diff --git a/src/update_objects.c b/src/update_objects.c index 55ae23246..73d0dcfdc 100644 --- a/src/update_objects.c +++ b/src/update_objects.c @@ -1305,124 +1305,6 @@ void func_800748F4(s32 objectIndex, const char** lakituTexturePtr) { func_80074704(objectIndex, lakituTexturePtr); } -void func_80074924(s32 objectIndex) { - s32 sp2C = 0; - s32 sp28; - s32 sp24; - s32 sp20 = 0; - s32 temp_a0; - Object* object; - - object = &gObjectList[objectIndex]; - object->sizeScaling = 0.15f; - - if (GetCourse() == GetMarioRaceway()) { - sp2C = random_int(0x00C8U); - sp28 = random_int(D_80165748); - sp24 = random_int(0x0096U); - sp20 = random_int(0x2000U); - object->origin_pos[0] = (f32) ((((f64) D_80165718 + 100.0) - (f64) sp2C) * (f64) xOrientation); - object->origin_pos[1] = (f32) (D_80165720 + sp28); - object->origin_pos[2] = (f32) (((f64) D_80165728 + 200.0) - (f64) sp24); - } else if (GetCourse() == GetRoyalRaceway()) { - sp2C = random_int(0x0168U); - sp28 = random_int(D_80165748); - sp24 = random_int(0x00B4U); - sp20 = random_int(0x2000U); - object->origin_pos[0] = (f32) ((((f64) D_80165718 + 180.0) - (f64) sp2C) * (f64) xOrientation); - object->origin_pos[1] = (f32) (D_80165720 + sp28); - object->origin_pos[2] = (f32) (((f64) D_80165728 + 200.0) - (f64) sp24); - } else if (GetCourse() == GetLuigiRaceway()) { - sp2C = random_int(0x012CU); - sp28 = random_int(D_80165748); - sp24 = random_int(0x0096U); - sp20 = random_int(0x2000U); - object->origin_pos[0] = (f32) ((((f64) D_80165718 + 150.0) - (f64) sp2C) * (f64) xOrientation); - object->origin_pos[1] = (f32) (D_80165720 + sp28); - object->origin_pos[2] = (f32) (((f64) D_80165728 + 200.0) - (f64) sp24); - } - - set_obj_origin_offset(objectIndex, 0, 0, 0); - if (gPlayerCount == 1) { - object->velocity[1] = (f32) (((f64) (f32) (sp2C % 4) * 0.25) + 0.8); - } else { - object->velocity[1] = (f32) (((f64) (f32) (sp2C % 3) * 0.2) + 0.4); - } - temp_a0 = sp2C % 8; - object->unk_084[0] = D_800E6F30[temp_a0][0]; - object->unk_084[1] = D_800E6F30[temp_a0][1]; - object->unk_084[2] = D_800E6F30[temp_a0][2]; - object->unk_084[3] = D_800E6F48[temp_a0][0]; - object->unk_084[4] = D_800E6F48[temp_a0][1]; - object->unk_084[5] = D_800E6F48[temp_a0][2]; - object->unk_084[6] = sp20 - 0x1000; - if (sp2C & 1) { - object->unk_084[7] = (sp20 / 32) + 0x100; - } else { - object->unk_084[7] = -0x100 - (sp20 / 32); - } - object->primAlpha = 0x00E6; - object_next_state(objectIndex); -} - -void func_80074D94(s32 objectIndex) { - if (gObjectList[objectIndex].unk_0AE == 1) { - if ((D_80165740 <= gObjectList[objectIndex].offset[1]) && - (s16_step_down_towards(&gObjectList[objectIndex].primAlpha, 0, 8) != 0)) { - func_80086F60(objectIndex); - } - object_add_velocity_offset_y(objectIndex); - } - object_calculate_new_pos_offset(objectIndex); -} - -void func_80074E28(s32 objectIndex) { - switch (gObjectList[objectIndex].state) { - case 1: - func_80074924(objectIndex); - break; - case 2: - if (set_and_run_timer_object(objectIndex, 1) != false) { - func_80086E70(objectIndex); - break; - } - case 0: - break; - case 3: - func_80041480(&gObjectList[objectIndex].unk_084[6], -0x1000, 0x1000, &gObjectList[objectIndex].unk_084[7]); - if (gObjectList[objectIndex].unk_0AE == 0) { - func_80072428(objectIndex); - } - break; - } -} - -void func_80074EE8(void) { - s32 someIndex; - s32 objectIndex; - s32 someCount; - Object* object; - - someCount = 0; - for (someIndex = 0; someIndex < D_80165738; someIndex++) { - objectIndex = gObjectParticle3[someIndex]; - if (objectIndex != DELETED_OBJECT_ID) { - object = &gObjectList[objectIndex]; - if (object->state != 0) { - func_80074E28(objectIndex); - func_80074D94(objectIndex); - if (object->state == 0) { - delete_object_wrapper(&gObjectParticle3[someIndex]); - } - someCount += 1; - } - } - } - if (someCount == 0) { - D_80165730 = 0; - } -} - void func_800750D8(s32 objectIndex, s32 arg1, Vec3f arg2, s32 arg3, s32 arg4) { s32 sp24; s32 temp_v0;