diff options
Diffstat (limited to 'src/code_800029B0.c')
| -rw-r--r-- | src/code_800029B0.c | 127 |
1 files changed, 29 insertions, 98 deletions
diff --git a/src/code_800029B0.c b/src/code_800029B0.c index aa00b5ca1..b6f5b1820 100644 --- a/src/code_800029B0.c +++ b/src/code_800029B0.c @@ -124,7 +124,7 @@ Vec3f D_8015F768; Vec3f D_8015F778; f32 gCourseDirection; // Extra mode, flips vertices. -s32 D_8015F788; +s32 gNumScreens; // Set to zero in single player mode s32 D_8015F790[64]; // Unknown data, potentially not used. u16 D_8015F890; u16 D_8015F892; @@ -149,7 +149,7 @@ s16 gPlayerPositionLUT[8]; // Player index at each position u16 gNumPermanentActors; s32 code_800029B0_bss_pad2[44]; -struct Actor gActorList[ACTOR_LIST_SIZE]; +struct Actor gActorList[100]; //! @warning todo: Is this apart of the actor array? UNUSED u8 D_80162578[sizeof(struct Actor)]; @@ -179,6 +179,8 @@ void setup_race(void) { struct Controller* controller; int i; + printf("Setup Race!\n"); + gPlayerCountSelection1 = gPlayerCount; if (gGamestate != RACING) { gIsMirrorMode = 0; @@ -191,7 +193,7 @@ void setup_race(void) { if (gModeSelection == GRAND_PRIX) { gCurrentCourseId = gCupCourseOrder[gCupSelection][gCourseIndexInCup]; // Skip for debug menu - if (gDebugMenuSelection < DEBUG_MENU) { + if (gMenuSelection != START_MENU) { SetCourseFromCup(); } } @@ -201,7 +203,7 @@ void setup_race(void) { gCurrentlyLoadedCourseId = gCurrentCourseId; gNextFreeMemoryAddress = gFreeMemoryResetAnchor; load_course(gCurrentCourseId); - func_80295D88(); + course_init(); D_8015F730 = gNextFreeMemoryAddress; } else { gNextFreeMemoryAddress = D_8015F730; @@ -221,18 +223,19 @@ void setup_race(void) { func_80091FA4(); init_actors_and_load_textures(); - if (gModeSelection != BATTLE) { - D_8015F8D0[1] = (f32) (D_80164490->posY - 15); - ; - D_8015F8D0[2] = D_80164490->posZ; - if (GetCourse() == GetToadsTurnpike()) { - D_8015F8D0[0] = (gIsMirrorMode != 0) ? D_80164490->posX + 138.0f : D_80164490->posX - 138.0f; - } else if (GetCourse() == GetWarioStadium()) { - D_8015F8D0[0] = (gIsMirrorMode != 0) ? D_80164490->posX + 12.0f : D_80164490->posX - 12.0f; - } else { - D_8015F8D0[0] = D_80164490->posX; - } - } + // Set finishline position. This is now done in files in src/engine/courses/* + // if (gModeSelection != BATTLE) { + // D_8015F8D0[1] = (f32) (D_80164490->posY - 15); + // D_8015F8D0[2] = D_80164490->posZ; + + // if (GetCourse() == GetToadsTurnpike()) { + // D_8015F8D0[0] = (gIsMirrorMode != 0) ? D_80164490->posX + 138.0f : D_80164490->posX - 138.0f; + // } else if (GetCourse() == GetWarioStadium()) { + // D_8015F8D0[0] = (gIsMirrorMode != 0) ? D_80164490->posX + 12.0f : D_80164490->posX - 12.0f; + // } else { + // D_8015F8D0[0] = D_80164490->posX; + // } + // } if (!gDemoMode) { func_800CA008(gPlayerCountSelection1 - 1, gCurrentCourseId + 4); func_800CB2C4(); @@ -299,7 +302,10 @@ void clear_nmi_buffer(void) { } } -void func_80003040(void) { +/** + * Also spawns water features + */ +void credits_spawn_actors(void) { Vec3f position; Vec3f velocity = { 0, 0, 0 }; Vec3s rotation = { 0, 0, 0 }; @@ -311,89 +317,14 @@ void func_80003040(void) { gCourseDirection = 1.0f; gPlayerCountSelection1 = 1; - set_segment_base_addr(0x3, (void*) (gNextFreeMemoryAddress + 0xFFFF7000)); + set_segment_base_addr_x64(3, (void*) gNextFreeMemoryAddress); + + // Stupid hack to sync segment 3 memory allocations with hard-coded address in data. + gNextFreeMemoryAddress += 0x9000; destroy_all_actors(); + m_ClearActors(); - CourseManager_SetCourseVtxColours(); + CourseManager_CreditsSpawnActors(); - // switch (gCurrentCourseId) { - // case COURSE_MARIO_RACEWAY: { - // dma_textures(gTextureTrees1, 0x35B, 0x800); - // spawn_foliage(d_course_mario_raceway_tree_spawns); - // break; - // } - // case COURSE_BOWSER_CASTLE: - // // d_course_bowsers_castle_packed_dl_1350 - // find_vtx_and_set_colours(segmented_gfx_to_virtual(0x07001350), 0x32, 0, 0, 0); - // break; - // case COURSE_BANSHEE_BOARDWALK: - // // d_course_banshee_boardwalk_packed_dl_878 - // find_vtx_and_set_colours(segmented_gfx_to_virtual(0x07000878), -0x80, 0, 0, 0); - // break; - // case COURSE_YOSHI_VALLEY: - // vec3f_set(position, -2300.0f, 0.0f, 634.0f); - // position[0] *= gCourseDirection; - // add_actor_to_empty_slot(position, rotation, velocity, ACTOR_YOSHI_EGG); - // break; - // case COURSE_MOO_MOO_FARM: - // dma_textures(gTextureTrees4Left, 0x3E8, 0x800); - // dma_textures(gTextureTrees4Right, 0x3E8, 0x800); - // dma_textures(gTextureCow01Left, 0x400, 0x800); - // dma_textures(gTextureCow01Right, 0x400, 0x800); - // dma_textures(gTextureCow02Left, 0x400, 0x800); - // dma_textures(gTextureCow02Right, 0x400, 0x800); - // dma_textures(gTextureCow03Left, 0x400, 0x800); - // dma_textures(gTextureCow03Right, 0x400, 0x800); - // dma_textures(gTextureCow04Left, 0x400, 0x800); - // dma_textures(gTextureCow04Right, 0x400, 0x800); - // dma_textures(gTextureCow05Left, 0x400, 0x800); - // dma_textures(gTextureCow05Right, 0x400, 0x800); - // spawn_foliage(d_course_moo_moo_farm_tree_spawn); - // break; - // case COURSE_SHERBET_LAND: - // // d_course_sherbet_land_packed_dl_1EB8 - // find_vtx_and_set_colours(segmented_gfx_to_virtual(0x07001EB8), -0x4C, 0xFF, 0xFF, 0xFF); - // // d_course_sherbet_land_packed_dl_2308 - // find_vtx_and_set_colours(segmented_gfx_to_virtual(0x07002308), -0x6A, 0xFF, 0xFF, 0xFF); - // break; - // case COURSE_RAINBOW_ROAD: - // // d_course_rainbow_road_packed_dl_2068 - // find_vtx_and_set_colours(segmented_gfx_to_virtual(0x07002068), -0x6A, 0xFF, 0xFF, 0xFF); - // // d_course_rainbow_road_packed_dl_1E18 - // find_vtx_and_set_colours(segmented_gfx_to_virtual(0x07001E18), -0x6A, 0xFF, 0xFF, 0xFF); - // // d_course_rainbow_road_packed_dl_1318 - // find_vtx_and_set_colours(segmented_gfx_to_virtual(0x07001318), -1, 0xFF, 0xFF, 0); - // break; - // case COURSE_WARIO_STADIUM: - // vec3f_set(position, -131.0f, 83.0f, 286.0f); - // add_actor_to_empty_slot(position, rotation, velocity, ACTOR_WARIO_SIGN); - // vec3f_set(position, -2353.0f, 72.0f, -1608.0f); - // add_actor_to_empty_slot(position, rotation, velocity, ACTOR_WARIO_SIGN); - // vec3f_set(position, -2622.0f, 79.0f, 739.0f); - // add_actor_to_empty_slot(position, rotation, velocity, ACTOR_WARIO_SIGN); - // // d_course_wario_stadium_packed_dl_C50 - // find_vtx_and_set_colours(segmented_gfx_to_virtual(0x07000C50), 0x64, 0xFF, 0xFF, 0xFF); - // // d_course_wario_stadium_packed_dl_BD8 - // find_vtx_and_set_colours(segmented_gfx_to_virtual(0x07000BD8), 0x64, 0xFF, 0xFF, 0xFF); - // // d_course_wario_stadium_packed_dl_B60 - // find_vtx_and_set_colours(segmented_gfx_to_virtual(0x07000B60), 0x64, 0xFF, 0xFF, 0xFF); - // // d_course_wario_stadium_packed_dl_AE8 - // find_vtx_and_set_colours(segmented_gfx_to_virtual(0x07000AE8), 0x64, 0xFF, 0xFF, 0xFF); - // // d_course_wario_stadium_packed_dl_CC8 - // find_vtx_and_set_colours(segmented_gfx_to_virtual(0x07000CC8), 0x64, 0xFF, 0xFF, 0xFF); - // // d_course_wario_stadium_packed_dl_D50 - // find_vtx_and_set_colours(segmented_gfx_to_virtual(0x07000D50), 0x64, 0xFF, 0xFF, 0xFF); - // // d_course_wario_stadium_packed_dl_DD0 - // find_vtx_and_set_colours(segmented_gfx_to_virtual(0x07000DD0), 0x64, 0xFF, 0xFF, 0xFF); - // // d_course_wario_stadium_packed_dl_E48 - // find_vtx_and_set_colours(segmented_gfx_to_virtual(0x07000E48), 0x64, 0xFF, 0xFF, 0xFF); - // break; - // case COURSE_DK_JUNGLE: - // // d_course_dks_jungle_parkway_packed_dl_3FA8 - // find_vtx_and_set_colours(segmented_gfx_to_virtual(0x07003FA8), 0x78, 0xFF, 0xFF, 0xFF); - // break; - // default: - // break; - // } gNumPermanentActors = gNumActors; } |
