[modding] Big Update PR (#118)

* Implement kart vehicle

* Fix menu CC

* Actors

* variable framerate

* Implement Actors vector

* Fix water & scrolling textures

* Finish ACoin

* Refactor finishline

* Refactor mtx to vector

* Fix refactored screen code bugs

* Fix playlist bug

* Switching courses working now

* Fix podium ceremony

* Mostly Fix Demo and Credits

* Credits Load Actors and Textures

* Fix credits

* Formatting

* Update lus and torch

* Fix water features

* Fix crabs

* Combine function

* Fix wheels

* Add Moon Jump Cheat

* Wheel Change

* Fix smoke due to wheel change

* Fix screens for wheels

* Fix transparency

* Fix staff ghost

* Fix lakitu transition widescreen

* Rename and export credits text

* Fixes

---------

Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com>
This commit is contained in:
MegaMech
2024-11-14 23:32:55 -07:00
committed by GitHub
parent 4fbb031dd9
commit 475f167bb2
137 changed files with 4173 additions and 2961 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
#include <libultraship.h>
#include <macros.h>
#include <common_structs.h>
#include "staff_ghost_data.h"
/*
* This file is required for data alignment
@@ -11,7 +12,7 @@ StaffGhost d_mario_raceway_staff_ghost[] = {
#include "courses/mario_raceway/staff_ghost.inc.c"
};
StaffGhost d_luigi_raceway_staff_ghost[1046] = {
StaffGhost d_luigi_raceway_staff_ghost[] = {
#include "courses/luigi_raceway/staff_ghost.inc.c"
};
+14
View File
@@ -0,0 +1,14 @@
#ifndef _STAFF_GHOST_DATA
#define _STAFF_GHOST_DATA
#include <libultraship.h>
#include <macros.h>
#include <common_structs.h>
extern StaffGhost d_mario_raceway_staff_ghost[];
extern StaffGhost d_royal_raceway_staff_ghost[];
extern StaffGhost d_luigi_raceway_staff_ghost[];
#endif // _STAFF_GHOST_DATA
+2 -2
View File
@@ -411,11 +411,11 @@ index 7c90951..135e98c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -578,6 +578,7 @@ void race_logic_loop(void) {
gTickSpeed = 2;
gTickLogic = 2;
staff_ghosts_loop();
if (gIsGamePaused == 0) {
+ func_8001EE98(gPlayerOneCopy, camera1, 0);
for (i = 0; i < gTickSpeed; i++) {
for (i = 0; i < gTickLogic; i++) {
if (D_8015011E) {
gCourseTimer += 0.01666666; // 1 / 60
@@ -585,7 +586,6 @@ void race_logic_loop(void) {
+5 -2
View File
@@ -83,8 +83,11 @@ enum ActorType {
ACTOR_CAR,
ACTOR_KIWANO_FRUIT
};
size_t m_GetActorSize(void);
#define ACTOR_LIST_SIZE m_GetActorSize()
#define ACTOR_LIST_SIZE 100
struct Actor* m_GetActor(size_t);
#define GET_ACTOR(index) m_GetActor(index)
// Actor flags
#define ACTOR_IS_NOT_EXPIRED 0xF // The actor possesses some kind of collision and can be removed
@@ -133,7 +136,7 @@ struct Actor {
}; // size = 0x70
// Duplicate declare for simplicity when externing actors & packed files.
extern struct Actor gActorList[ACTOR_LIST_SIZE]; // D_8015F9B8
extern struct Actor gActorList[100]; // D_8015F9B8
/*
Specialized actor types
+1 -4
View File
@@ -56,9 +56,6 @@ typedef struct {
extern s32 gIndexObjectBombKart[NUM_BOMB_KARTS_MAX];
extern BombKart gBombKarts[NUM_BOMB_KARTS_MAX];
extern Collision D_80164038[NUM_BOMB_KARTS_MAX];
// data/data_0DD0A0_1.s
extern BombKartSpawn gBombKartSpawns[NUM_COURSES][NUM_BOMB_KARTS_MAX];
extern Collision gBombKartCollision[NUM_BOMB_KARTS_MAX];
#endif
+1 -1
View File
@@ -43,7 +43,7 @@ typedef enum {
/* 0x08 */ COURSE_LUIGI_RACEWAY,
/* 0x09 */ COURSE_MOO_MOO_FARM,
/* 0x0A */ COURSE_TOADS_TURNPIKE,
/* 0x0B */ COURSE_KALAMARI_DESERT,
/* 0x0B */ COURSE_KALIMARI_DESERT,
/* 0x0C */ COURSE_SHERBET_LAND,
/* 0x0D */ COURSE_RAINBOW_ROAD,
/* 0x0E */ COURSE_WARIO_STADIUM,
+1 -1
View File
@@ -146,7 +146,7 @@ void update_actor_banana(struct BananaActor* banana) {
func_802B4E30((struct Actor*) banana);
break;
case BANANA_BUNCH_BANANA:
elderBanana = (struct BananaActor*) &gActorList[banana->elderIndex];
elderBanana = (struct BananaActor*) GET_ACTOR(banana->elderIndex);
temp_f2 = elderBanana->pos[0] - banana->pos[0];
temp_f14 = elderBanana->pos[1] - banana->pos[1];
temp_f16 = elderBanana->pos[2] - banana->pos[2];
+5 -5
View File
@@ -293,9 +293,9 @@ void update_actor_red_blue_shell(struct ShellActor* shell) {
func_800C90F4(shell->playerId,
(player->characterId * 0x10) + SOUND_ARG_LOAD(0x29, 0x00, 0x80, 0x00));
if (pad13 == ACTOR_RED_SHELL) {
add_red_shell_in_unexpired_actor_list((struct Actor*) shell - gActorList);
add_red_shell_in_unexpired_actor_list(m_FindActorIndex(shell));
} else {
add_blue_shell_in_unexpired_actor_list((struct Actor*) shell - gActorList);
add_blue_shell_in_unexpired_actor_list(m_FindActorIndex(shell));
func_800C9D80(shell->pos, shell->velocity, SOUND_ARG_LOAD(0x51, 0x01, 0x80, 0x08));
}
}
@@ -307,9 +307,9 @@ void update_actor_red_blue_shell(struct ShellActor* shell) {
func_800C90F4(shell->playerId,
(player->characterId * 0x10) + SOUND_ARG_LOAD(0x29, 0x00, 0x80, 0x00));
if (pad13 == ACTOR_RED_SHELL) {
add_red_shell_in_unexpired_actor_list((struct Actor*) shell - gActorList);
add_red_shell_in_unexpired_actor_list(m_FindActorIndex(shell));
} else {
add_blue_shell_in_unexpired_actor_list((struct Actor*) shell - gActorList);
add_blue_shell_in_unexpired_actor_list(m_FindActorIndex(shell));
func_800C9D80(shell->pos, shell->velocity, SOUND_ARG_LOAD(0x51, 0x01, 0x80, 0x08));
}
}
@@ -429,7 +429,7 @@ void update_actor_red_blue_shell(struct ShellActor* shell) {
break;
case TRIPLE_RED_SHELL:
player = &gPlayers[shell->playerId];
parent = (TripleShellParent*) &gActorList[shell->parentIndex];
parent = (TripleShellParent*) GET_ACTOR(shell->parentIndex);
if (parent->type != ACTOR_TRIPLE_RED_SHELL) {
destroy_destructable_actor((struct Actor*) shell);
} else {
+1 -1
View File
@@ -53,7 +53,7 @@ void spawn_falling_rocks(struct ActorSpawnData* spawnData) {
vec3f_set(startingVelocity, 0, 0, 0);
vec3s_set(startingRot, 0, 0, 0);
temp = add_actor_to_empty_slot(startingPos, startingRot, startingVelocity, ACTOR_FALLING_ROCK);
temp_v1 = (struct FallingRock*) &gActorList[temp];
temp_v1 = (struct FallingRock*) GET_ACTOR(temp);
temp_v1->unk_06 = temp_s0->someId;
func_802AAAAC((Collision*) &temp_v1->unk30);
+4 -4
View File
@@ -74,7 +74,7 @@ void update_actor_green_shell(struct ShellActor* shell) {
func_800C9060(shell->playerId, SOUND_ARG_LOAD(0x19, 0x00, 0x80, 0x04));
func_800C90F4(shell->playerId,
(player->characterId * 0x10) + SOUND_ARG_LOAD(0x29, 0x00, 0x80, 0x00));
add_green_shell_in_unexpired_actor_list((struct Actor*) shell - gActorList);
add_green_shell_in_unexpired_actor_list(m_FindActorIndex(shell));
return;
} else {
shell->state = 1;
@@ -97,7 +97,7 @@ void update_actor_green_shell(struct ShellActor* shell) {
func_800C9060(shell->playerId, SOUND_ARG_LOAD(0x19, 0x00, 0x80, 0x04));
func_800C90F4(shell->playerId,
(player->characterId * 0x10) + SOUND_ARG_LOAD(0x29, 0x00, 0x80, 0x00));
add_green_shell_in_unexpired_actor_list((struct Actor*) shell - gActorList);
add_green_shell_in_unexpired_actor_list(m_FindActorIndex(shell));
}
} else {
shell->rotAngle += 0xE38;
@@ -107,7 +107,7 @@ void update_actor_green_shell(struct ShellActor* shell) {
func_800C9060(shell->playerId, SOUND_ARG_LOAD(0x19, 0x00, 0x80, 0x04));
func_800C90F4(shell->playerId,
(player->characterId * 0x10) + SOUND_ARG_LOAD(0x29, 0x00, 0x80, 0x00));
add_green_shell_in_unexpired_actor_list((struct Actor*) shell - gActorList);
add_green_shell_in_unexpired_actor_list(m_FindActorIndex(shell));
}
}
if (shell->state == 2) {
@@ -160,7 +160,7 @@ void update_actor_green_shell(struct ShellActor* shell) {
break;
case TRIPLE_GREEN_SHELL:
player = &gPlayers[shell->playerId];
parent = (TripleShellParent*) &gActorList[shell->parentIndex];
parent = (TripleShellParent*) GET_ACTOR(shell->parentIndex);
if (parent->type != ACTOR_TRIPLE_GREEN_SHELL) {
destroy_destructable_actor((struct Actor*) shell);
} else {
-2
View File
@@ -204,8 +204,6 @@ void func_80299864(Camera* camera, Mat4 arg1, struct Actor* arg2) {
// This comment can be removed when this is confirmed to work.
if (GetCourse() == GetLuigiRaceway()) {
gSPDisplayList(gDisplayListHead++, d_course_luigi_raceway_dl_FC70);
} else if (GetCourse() == GetMooMooFarm()) {
gSPDisplayList(gDisplayListHead++, d_course_moo_moo_farm_mole_tlut);
}
}
}
+5 -5
View File
@@ -93,10 +93,12 @@ void render_limb_or_add_mtx(Armature* arg0, s16* arg1, AnimationLimbVector arg2,
}
mtxf_translate_rotate2(modelMatrix, pos, angle);
convert_to_fixed_point_matrix_animation(&gGfxPool->mtxHud[gMatrixHudCount], modelMatrix);
//convert_to_fixed_point_matrix_animation(&gGfxPool->mtxHud[gMatrixHudCount], modelMatrix);
sMatrixStackSize += 1;
gSPMatrix(gDisplayListHead++, (&gGfxPool->mtxHud[gMatrixHudCount++]),
G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
// gSPMatrix(gDisplayListHead++, (&gGfxPool->mtxHud[gMatrixHudCount++]),
// G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
AddHudMatrix(modelMatrix, G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
if (virtualModel != NULL) {
model = (virtualModel);
gSPDisplayList(gDisplayListHead++, model);
@@ -111,8 +113,6 @@ void render_armature(Armature* animation, Animation* arg1, s16 timeCycle) {
s32 animation_type;
s32 someIndex;
printf("model: %d %d %d\n", animation->pos[0], animation->pos[1], animation->pos[2]);
angle_array = (arg1->angle_array);
animation_cycle_list = (arg1->animation_cycle_spec_vector);
sMatrixStackSize = 0;
+29 -98
View File
@@ -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;
}
+2 -2
View File
@@ -32,7 +32,7 @@ void func_800029B0(void);
void setup_race(void);
void func_80002DAC(void);
void clear_nmi_buffer(void);
void func_80003040(void);
void credits_spawn_actors(void);
extern s16 gCurrentCourseId; // D_800DC5A0
extern s16 gCurrentlyLoadedCourseId;
@@ -111,7 +111,7 @@ extern Vec3f D_8015F768;
extern Vec3f D_8015F778;
extern f32 gCourseDirection;
extern s32 D_8015F788;
extern s32 gNumScreens;
extern s32 D_8015F790[];
extern u16 D_8015F890;
+42 -58
View File
@@ -156,7 +156,7 @@ VehicleStuff gTankerTruckList[NUM_RACE_TANKER_TRUCKS];
VehicleStuff gCarList[NUM_RACE_CARS];
s32 D_80163DD8[4];
BombKart gBombKarts[NUM_BOMB_KARTS_MAX];
Collision D_80164038[NUM_BOMB_KARTS_MAX];
Collision gBombKartCollision[NUM_BOMB_KARTS_MAX];
struct unexpiredActors gUnexpiredActorsList[8];
D_801642D8_entry D_801642D8[8];
s16 D_80164358;
@@ -1539,22 +1539,8 @@ void update_vehicles(void) {
generate_player_smoke();
D_8016337C++;
if (GetCourse() == GetPodiumCeremony()) {
for (i = 0; i < 7; i++) {
func_8000DF8C(i);
}
return;
}
if (D_8016337C & 1) {
if (gModeSelection == VERSUS) {
for (i = 0; i < 7; i++) {
func_8000DF8C(i);
}
}
CourseManager_VehiclesTick();
}
CourseManager_TickBombKarts();
CourseManager_VehiclesTick();
}
void func_800098FC(s32 arg0, Player* player) {
@@ -1743,7 +1729,7 @@ void func_80009B60(s32 playerId) {
}
D_801631F8[playerId] = D_801631E0[playerId];
CourseManager_RenderTrucks(playerId);
CourseManager_DrawVehicles(playerId);
if ((GetCourse() == GetYoshiValley()) || (GetCourse() == GetPodiumCeremony())) {
D_801634F8[playerId].unk4 = 0.0f;
@@ -1926,7 +1912,6 @@ void func_80009B60(s32 playerId) {
}
var_v1 = CourseManager_GetProps()->AISteeringSensitivity;
// var_v1 = gKartAISteeringSensitivity[gCurrentCourseId];
switch (D_801631D8[playerId]) { /* switch 4; irregular */
case 2: /* switch 4 */
@@ -2922,7 +2907,7 @@ void set_bomb_kart_spawn_positions(void) {
BombKartSpawn* bombKartSpawn;
for (var_s3 = 0; var_s3 < NUM_BOMB_KARTS_VERSUS; var_s3++) {
bombKartSpawn = &gBombKartSpawns[gCurrentCourseId][var_s3];
//bombKartSpawn = &gBombKartSpawns[gCurrentCourseId][var_s3];
if (GetCourse() == GetYoshiValley()) {
startingXPos = bombKartSpawn->startingXPos;
startingZPos = bombKartSpawn->startingZPos;
@@ -2962,7 +2947,7 @@ void set_bomb_kart_spawn_positions(void) {
gBombKarts[var_s3].unk_4A = 0;
gBombKarts[var_s3].unk_4C = 1;
gBombKarts[var_s3].yPos = startingYPos;
check_bounding_collision(&D_80164038[var_s3], 2.0f, startingXPos, startingYPos, startingZPos);
check_bounding_collision(&gBombKartCollision[var_s3], 2.0f, startingXPos, startingYPos, startingZPos);
}
}
@@ -3157,7 +3142,7 @@ void func_8000DF8C(s32 bombKartId) {
var_f22 += temp_f14 / 5.0f;
var_f24 += temp_f16 / 5.0f;
}
temp_a0_4 = &D_80164038[bombKartId];
temp_a0_4 = &gBombKartCollision[bombKartId];
var_f20 = calculate_surface_height(var_f22, 2000.0f, var_f24, temp_a0_4->meshIndexZX) + 3.5f;
if (var_f20 < (-1000.0)) {
var_f20 = bombKart->bombPos[1];
@@ -3255,7 +3240,7 @@ s32 add_actor_in_unexpired_actor_list(s32 actorIndex, s16 arg1) {
}
s32 add_red_shell_in_unexpired_actor_list(s32 actorIndex) {
struct Actor* actor = &gActorList[actorIndex];
struct Actor* actor = m_GetActor(actorIndex);
if (actor->type != ACTOR_RED_SHELL) {
return -1;
}
@@ -3263,7 +3248,7 @@ s32 add_red_shell_in_unexpired_actor_list(s32 actorIndex) {
}
s32 add_green_shell_in_unexpired_actor_list(s32 actorIndex) {
struct Actor* actor = &gActorList[actorIndex];
struct Actor* actor = m_GetActor(actorIndex);
if (actor->type != ACTOR_GREEN_SHELL) {
return -1;
}
@@ -3271,7 +3256,7 @@ s32 add_green_shell_in_unexpired_actor_list(s32 actorIndex) {
}
s32 add_blue_shell_in_unexpired_actor_list(s32 arg0) {
struct Actor* actor = &gActorList[arg0];
struct Actor* actor = m_GetActor(arg0);
if (actor->type != ACTOR_BLUE_SPINY_SHELL) {
return -1;
}
@@ -3311,7 +3296,7 @@ void generate_player_smoke(void) {
for (someIndex = 0; someIndex < NUM_PLAYERS; someIndex++) {
var_s0 = &gUnexpiredActorsList[someIndex];
if (var_s0->unkC == 1) {
temp_s1 = &gActorList[var_s0->actorIndex];
temp_s1 = GET_ACTOR(var_s0->actorIndex);
var_s0->unk14++;
switch (var_s0->unk10) {
case 0:
@@ -3460,12 +3445,11 @@ void func_8000F2DC(void) {
D_80164430 = *gWaypointCountByPathIndex;
CourseManager_ResetVehicles();
CourseManager_ClearVehicles();
CourseManager_SpawnVehicles();
CourseManager_SpawnBombKarts();
set_bomb_kart_spawn_positions();
//set_bomb_kart_spawn_positions();
func_8000EEDC();
}
@@ -4506,7 +4490,7 @@ void init_vehicles_trains(size_t i, size_t numCarriages, f32 speed) {
void sync_train_components(TrainCarStuff* trainCar, s16 orientationY) {
struct TrainCar* trainCarActor;
trainCarActor = (struct TrainCar*) &gActorList[trainCar->actorIndex];
trainCarActor = (struct TrainCar*) GET_ACTOR(trainCar->actorIndex);
trainCarActor->pos[0] = trainCar->position[0];
trainCarActor->pos[1] = trainCar->position[1];
trainCarActor->pos[2] = trainCar->position[2];
@@ -4823,7 +4807,7 @@ void update_vehicle_paddle_boats(void) {
paddleBoat->velocity[0] = paddleBoat->position[0] - temp_f26;
paddleBoat->velocity[1] = paddleBoat->position[1] - temp_f28;
paddleBoat->velocity[2] = paddleBoat->position[2] - temp_f30;
paddleBoatActor = &gActorList[paddleBoat->actorIndex];
paddleBoatActor = GET_ACTOR(paddleBoat->actorIndex);
paddleBoatActor->pos[0] = paddleBoat->position[0];
paddleBoatActor->pos[1] = paddleBoat->position[1];
paddleBoatActor->pos[2] = paddleBoat->position[2];
@@ -5003,7 +4987,7 @@ void update_vehicle_follow_waypoint(VehicleStuff* vehicle) {
vehicle->velocity[0] = vehicle->position[0] - sp5C;
vehicle->velocity[1] = vehicle->position[1] - sp58;
vehicle->velocity[2] = vehicle->position[2] - sp54;
vehicleActor = &gActorList[vehicle->actorIndex];
vehicleActor = GET_ACTOR(vehicle->actorIndex);
vehicleActor->pos[0] = vehicle->position[0];
vehicleActor->pos[1] = vehicle->position[1];
vehicleActor->pos[2] = vehicle->position[2];
@@ -7106,7 +7090,7 @@ void kart_ai_use_item_strategy(s32 playerId) {
break;
case 2:
banana = (struct BananaActor*) &gActorList[temp_s0->actorIndex];
banana = (struct BananaActor*) GET_ACTOR(temp_s0->actorIndex);
if ((!(banana->flags & 0x8000)) || (banana->type != 6) || (banana->state != 0) ||
(playerId != banana->playerId)) {
temp_s0->unk_00 = 0;
@@ -7118,7 +7102,7 @@ void kart_ai_use_item_strategy(s32 playerId) {
break;
case 3:
banana = (struct BananaActor*) &gActorList[temp_s0->actorIndex];
banana = (struct BananaActor*) GET_ACTOR(temp_s0->actorIndex);
if ((((!(banana->flags & 0x8000)) || (banana->type != 6)) || (banana->state != 0)) ||
(playerId != banana->playerId)) {
if (playerId != banana->playerId) {}
@@ -7141,7 +7125,7 @@ void kart_ai_use_item_strategy(s32 playerId) {
case 34:
temp_s0->actorIndex = use_banana_item(player);
if ((temp_s0->actorIndex >= 0) && (temp_s0->actorIndex < 0x64)) {
banana = (struct BananaActor*) &gActorList[temp_s0->actorIndex];
banana = (struct BananaActor*) GET_ACTOR(temp_s0->actorIndex);
banana->state = 4;
player->soundEffects |= HOLD_BANANA_SOUND_EFFECT;
temp_s0->unk_00 = 0x0023;
@@ -7163,7 +7147,7 @@ void kart_ai_use_item_strategy(s32 playerId) {
break;
case 35:
banana = (struct BananaActor*) &gActorList[temp_s0->actorIndex];
banana = (struct BananaActor*) GET_ACTOR(temp_s0->actorIndex);
if ((((!(banana->flags & 0x8000)) || (banana->type != 6)) || (banana->state != 4)) ||
(playerId != banana->playerId)) {
temp_s0->unk_00 = 0;
@@ -7181,7 +7165,7 @@ void kart_ai_use_item_strategy(s32 playerId) {
break;
case 36:
banana = (struct BananaActor*) &gActorList[temp_s0->actorIndex];
banana = (struct BananaActor*) GET_ACTOR(temp_s0->actorIndex);
if ((((!(banana->flags & 0x8000)) || (banana->type != 6)) || (banana->state != 4)) ||
(playerId != banana->playerId)) {
if (playerId != banana->playerId) {}
@@ -7216,7 +7200,7 @@ void kart_ai_use_item_strategy(s32 playerId) {
break;
case 5:
actor = &gActorList[temp_s0->actorIndex];
actor = GET_ACTOR(temp_s0->actorIndex);
if ((((!(actor->flags & 0x8000)) || (actor->type != 7)) || (actor->state != 0)) ||
(playerId != actor->rot[2])) {
temp_s0->unk_00 = 0;
@@ -7228,7 +7212,7 @@ void kart_ai_use_item_strategy(s32 playerId) {
break;
case 6:
actor = &gActorList[temp_s0->actorIndex];
actor = GET_ACTOR(temp_s0->actorIndex);
if ((((!(actor->flags & 0x8000)) || (actor->type != 7)) || (actor->state != 0)) ||
(playerId != actor->rot[2])) {
temp_s0->unk_00 = 0;
@@ -7257,7 +7241,7 @@ void kart_ai_use_item_strategy(s32 playerId) {
break;
case 8:
shell = (struct ShellActor*) &gActorList[temp_s0->actorIndex];
shell = (struct ShellActor*) GET_ACTOR(temp_s0->actorIndex);
if ((((!(shell->flags & 0x8000)) || (shell->type != 8)) || (shell->state != 0)) ||
(playerId != shell->playerId)) {
temp_s0->unk_00 = 0;
@@ -7269,7 +7253,7 @@ void kart_ai_use_item_strategy(s32 playerId) {
case 9:
func_8001ABEC((struct struct_801642D8*) temp_s0);
shell = (struct ShellActor*) &gActorList[temp_s0->actorIndex];
shell = (struct ShellActor*) GET_ACTOR(temp_s0->actorIndex);
if ((((!(shell->flags & 0x8000)) || (shell->type != 8)) || (shell->state != 0)) ||
(playerId != shell->playerId)) {
temp_s0->unk_00 = 0;
@@ -7298,7 +7282,7 @@ void kart_ai_use_item_strategy(s32 playerId) {
break;
case 11:
bananaBunchParent = (struct BananaBunchParent*) &gActorList[temp_s0->actorIndex];
bananaBunchParent = (struct BananaBunchParent*) GET_ACTOR(temp_s0->actorIndex);
if (bananaBunchParent->state == 6) {
var_v0 = 0;
if (bananaBunchParent->bananaIndices[4] != (-1)) {
@@ -7330,7 +7314,7 @@ void kart_ai_use_item_strategy(s32 playerId) {
case 12:
if ((((s16) temp_s0->unk_04) % 10) == 0) {
if (temp_s0->unk_08 < 5) {
bananaBunchParent = (struct BananaBunchParent*) &gActorList[temp_s0->actorIndex];
bananaBunchParent = (struct BananaBunchParent*) GET_ACTOR(temp_s0->actorIndex);
var_v0 = 0;
switch (temp_s0->unk_08) {
case 0:
@@ -7388,7 +7372,7 @@ void kart_ai_use_item_strategy(s32 playerId) {
break;
case 14:
fakeItemBox = (struct FakeItemBox*) &gActorList[temp_s0->actorIndex];
fakeItemBox = (struct FakeItemBox*) GET_ACTOR(temp_s0->actorIndex);
if ((((!(fakeItemBox->flags & 0x8000)) || (fakeItemBox->type != 0x000D)) ||
(fakeItemBox->state != 0)) ||
(playerId != ((s32) fakeItemBox->playerId))) {
@@ -7400,7 +7384,7 @@ void kart_ai_use_item_strategy(s32 playerId) {
break;
case 15:
fakeItemBox = (struct FakeItemBox*) &gActorList[temp_s0->actorIndex];
fakeItemBox = (struct FakeItemBox*) GET_ACTOR(temp_s0->actorIndex);
if ((((!(fakeItemBox->flags & 0x8000)) || (fakeItemBox->type != 0x000D)) ||
(fakeItemBox->state != 0)) ||
(playerId != ((s32) fakeItemBox->playerId))) {
@@ -7585,7 +7569,7 @@ void func_8001C14C(void) {
f32 temp_f0;
f32 temp_f2;
s32 var_s1;
Player* temp_s0;
Player* player;
if (D_8016347C == 1) {
D_80163480 += 1;
@@ -7603,42 +7587,42 @@ void func_8001C14C(void) {
break;
}
temp_s0 = &gPlayerOne[var_s1];
player = &gPlayerOne[var_s1];
func_80009B60(var_s1);
if (!(temp_s0->type & 0x2000)) {
temp_f0 = D_80163418[var_s1] - temp_s0->pos[0];
temp_f2 = D_80163438[var_s1] - temp_s0->pos[2];
if (!(player->type & 0x2000)) {
temp_f0 = D_80163418[var_s1] - player->pos[0];
temp_f2 = D_80163438[var_s1] - player->pos[2];
if ((f64) ((temp_f0 * temp_f0) + (temp_f2 * temp_f2)) < 1.0) {
if (var_s1 != 3) {
if (1) {}
// Why oh why is a ternary required here? Who does that?
(D_8016347C == 0) ? (temp_s0->type |= 0x2000) : (temp_s0->type &= ~0x2000);
(D_8016347C == 0) ? (player->type |= 0x2000) : (player->type &= ~0x2000);
if ((gPlayerOne->type & 0x2000) && (gPlayerTwo->type & 0x2000) && (gPlayerThree->type & 0x2000)) {
D_8016347C = 1;
D_80163480 = 0;
}
} else if (D_8016347E == 0) {
if (!(temp_s0->effects & 0x01000000)) {
temp_s0->type |= 0x2000;
if (!(player->effects & 0x01000000)) {
player->type |= 0x2000;
}
D_8016347E = 1;
D_80163484 = 0;
} else if (!(temp_s0->effects & 0x01000000)) {
temp_s0->type |= 0x2000;
} else if (!(player->effects & 0x01000000)) {
player->type |= 0x2000;
}
}
}
}
}
void func_8001C3C4(s32 cameraId) {
void render_bomb_karts_wrap(s32 cameraId) {
if (GetCourse() == GetPodiumCeremony()) {
if (gBombKarts[0].waypointIndex >= 16) {
func_80057114(PLAYER_FOUR);
render_bomb_karts(PLAYER_FOUR);
}
} else {
if (gModeSelection == VERSUS) {
func_80057114(cameraId);
render_bomb_karts(cameraId);
}
}
}
+1 -1
View File
@@ -250,7 +250,7 @@ void func_8001BE78(void);
void func_8001C05C(void);
void func_8001C14C(void);
void func_8001C3C4(s32);
void render_bomb_karts_wrap(s32);
void func_8001C42C(void);
/* This is where I'd put my static data, if I had any */
+75 -57
View File
@@ -557,7 +557,8 @@ void render_object_p1(void) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxLookAt[0]),
G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
func_8001C3C4(PLAYER_ONE);
CourseManager_DrawBombKarts(PLAYER_ONE);
//render_bomb_karts_wrap(PLAYER_ONE);
if (gGamestate == ENDING) {
func_80055F48(PLAYER_ONE);
func_80056160(PLAYER_ONE);
@@ -578,7 +579,8 @@ void render_object_p2(void) {
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxLookAt[1]),
G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
func_8001C3C4(PLAYER_TWO);
CourseManager_DrawBombKarts(PLAYER_TWO);
//render_bomb_karts_wrap(PLAYER_TWO);
if (!gDemoMode) {
render_lakitu(PLAYER_TWO);
}
@@ -591,7 +593,8 @@ void render_object_p3(void) {
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxLookAt[2]),
G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
func_8001C3C4(PLAYER_THREE);
CourseManager_DrawBombKarts(PLAYER_THREE);
//render_bomb_karts_wrap(PLAYER_THREE);
if (!gDemoMode) {
render_lakitu(PLAYER_THREE);
}
@@ -605,7 +608,8 @@ void render_object_p4(void) {
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxLookAt[3]),
G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
func_8001C3C4(PLAYER_FOUR);
CourseManager_DrawBombKarts(PLAYER_FOUR);
//render_bomb_karts_wrap(PLAYER_FOUR);
if ((!gDemoMode) && (gPlayerCountSelection1 == 4)) {
render_lakitu(PLAYER_FOUR);
}
@@ -753,7 +757,7 @@ void render_object_for_player(s32 cameraId) {
// break;
// case COURSE_TOADS_TURNPIKE:
// break;
// case COURSE_KALAMARI_DESERT:
// case COURSE_KALIMARI_DESERT:
// render_object_trains_smoke_particles(cameraId);
// break;
// case COURSE_SHERBET_LAND:
@@ -787,10 +791,11 @@ void render_object_for_player(s32 cameraId) {
render_object_leaf_particle(cameraId);
if (D_80165730 != 0) {
func_80053E6C(cameraId);
render_balloons_grand_prix(cameraId);
}
if (gModeSelection == BATTLE) {
render_object_bomb_kart(cameraId);
CourseManager_DrawBattleBombKarts(cameraId);
//render_battle_bomb_karts(cameraId);
}
}
@@ -1622,7 +1627,7 @@ void update_object(void) {
// update_moles();
// }
// break;
// case COURSE_KALAMARI_DESERT:
// case COURSE_KALIMARI_DESERT:
// update_train_smoke();
// break;
// case COURSE_SHERBET_LAND:
@@ -2715,29 +2720,31 @@ void func_8005D18C(void) {
}
}
void func_8005D1F4(s32 arg0) {
s32 playerWaypoint;
s32 bombWaypoint;
s32 var_a2;
s32 waypointDiff;
void func_8005D1F4(s32 cameraId) {
if (gModeSelection == 2) {
playerWaypoint = gNearestWaypointByPlayerId[arg0];
playerHUD[arg0].unk_74 = 0;
for (var_a2 = 0; var_a2 < NUM_BOMB_KARTS_VERSUS; var_a2++) {
if ((gBombKarts[var_a2].state == BOMB_STATE_EXPLODED) ||
(gBombKarts[var_a2].state == BOMB_STATE_INACTIVE)) {
continue;
}
bombWaypoint = gBombKarts[var_a2].waypointIndex;
waypointDiff = bombWaypoint - playerWaypoint;
if ((waypointDiff < -5) || (waypointDiff > 0x1E)) {
continue;
}
playerHUD[arg0].unk_74 = 1;
break;
}
}
CourseManager_BombKartsWaypoint(cameraId);
// s32 playerWaypoint;
// s32 bombWaypoint;
// s32 var_a2;
// s32 waypointDiff;
// if (gModeSelection == 2) {
// playerWaypoint = gNearestWaypointByPlayerId[cameraId];
// playerHUD[cameraId].unk_74 = 0;
// for (var_a2 = 0; var_a2 < NUM_BOMB_KARTS_VERSUS; var_a2++) {
// if ((gBombKarts[var_a2].state == BOMB_STATE_EXPLODED) ||
// (gBombKarts[var_a2].state == BOMB_STATE_INACTIVE)) {
// continue;
// }
// bombWaypoint = gBombKarts[var_a2].waypointIndex;
// waypointDiff = bombWaypoint - playerWaypoint;
// if ((waypointDiff < -5) || (waypointDiff > 0x1E)) {
// continue;
// }
// playerHUD[cameraId].unk_74 = 1;
// break;
// }
// }
}
// Appears to load GP Mode race staging balloons and kart shadows.
@@ -4972,13 +4979,15 @@ void func_800651F4(Player* player, UNUSED s8 arg1, UNUSED s8 arg2, s8 arg3) {
}
void func_800652D4(Vec3f arg0, Vec3s arg1, f32 arg2) {
Mat4 sp20;
Mat4 mtx;
mtxf_translate_rotate(sp20, arg0, arg1);
mtxf_scale2(sp20, arg2);
convert_to_fixed_point_matrix(&gGfxPool->mtxEffect[gMatrixEffectCount], sp20);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxEffect[gMatrixEffectCount]),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
mtxf_translate_rotate(mtx, arg0, arg1);
mtxf_scale2(mtx, arg2);
// convert_to_fixed_point_matrix(&gGfxPool->mtxEffect[gMatrixEffectCount], mtx);
// gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxEffect[gMatrixEffectCount]),
// G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
AddEffectMatrix(mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
}
void func_8006538C(Player* player, s8 arg1, s16 arg2, s8 arg3) {
@@ -5600,10 +5609,16 @@ void func_80068AA4(Player* player, UNUSED s8 arg1, UNUSED f32 arg2, s8 arg3, s8
Vec3f sp64;
Vec3s sp5C;
sp64[1] = player->pos[1];
sp64[2] = player->pos[2];
sp64[0] = player->pos[0];
if ((player->unk_258[20 + arg4].unk_01C == 1) && (player->animFrameSelector[arg3] < 0xD)) {
if (gTickVisuals) {
sp64[1] = player->pos[1] - 3.0f;
sp64[2] = player->pos[2] + ((-2.5 * player->unk_258[20 + arg4].unk_01E) * coss(player->unk_048[arg3]));
sp64[0] = player->pos[0] + ((-2.5 * player->unk_258[20 + arg4].unk_01E) * sins(player->unk_048[arg3]));
}
sp5C[0] = 0;
sp5C[1] = player->unk_048[arg3];
sp5C[2] = 0;
@@ -5999,7 +6014,7 @@ void func_8006A7C0(Player* player, f32 arg1, f32 arg2, s8 arg3, s8 arg4) {
}
void render_battle_balloon(Player* player, s8 arg1, s16 arg2, s8 arg3) {
Mat4 sp140;
Mat4 mtx;
Vec3f sp134;
Vec3s sp12C;
UNUSED s16 stackPadding;
@@ -6055,23 +6070,24 @@ void render_battle_balloon(Player* player, s8 arg1, s16 arg2, s8 arg3) {
sp12C[1] = player->unk_048[arg3];
sp12C[2] = D_8018D7D0[arg1][arg2] - (D_8018D860[arg1][arg2] * coss(temp_t1)) -
((D_8018D890[arg1][arg2] * 8) * sins(temp_t1));
mtxf_translate_rotate(sp140, sp134, sp12C);
mtxf_scale2(sp140, var_f20);
convert_to_fixed_point_matrix(&gGfxPool->mtxEffect[gMatrixEffectCount], sp140);
mtxf_translate_rotate(mtx, sp134, sp12C);
mtxf_scale2(mtx, var_f20);
// convert_to_fixed_point_matrix(&gGfxPool->mtxEffect[gMatrixEffectCount], sp140);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxEffect[gMatrixEffectCount]),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
// gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxEffect[gMatrixEffectCount]),
// G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
AddEffectMatrix(mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(gDisplayListHead++, D_0D008DB8);
gDPLoadTLUT_pal256(gDisplayListHead++, gTLUTOnomatopoeia);
gDPSetTextureLUT(gDisplayListHead++, G_TT_RGBA16);
func_8004B614(primRed, primGreen, primBlue, envRed, envGreen, envBlue, 0x000000D8);
gDPSetRenderMode(gDisplayListHead++,
AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_WRAP | ZMODE_XLU | CVG_X_ALPHA | FORCE_BL |
GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA),
AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_WRAP | ZMODE_XLU | CVG_X_ALPHA | FORCE_BL |
GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA));
AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_WRAP | ZMODE_XLU | CVG_X_ALPHA | FORCE_BL |
GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA),
AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_WRAP | ZMODE_XLU | CVG_X_ALPHA | FORCE_BL |
GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA));
gDPLoadTextureBlock(gDisplayListHead++, D_8018D4BC, G_IM_FMT_CI, G_IM_SIZ_8b, 64, 32, 0, G_TX_NOMIRROR | G_TX_CLAMP,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSPVertex(gDisplayListHead++, gBalloonVertexPlane1, 4, 0);
@@ -6147,7 +6163,7 @@ void func_8006BA94(Player* player, s8 playerIndex, s8 arg2) {
* Used in podium ceremony.
*/
void render_balloon(Vec3f arg0, f32 arg1, s16 arg2, s16 arg3) {
Mat4 sp108;
Mat4 mtx;
Vec3f spFC;
Vec3s spF4;
UNUSED s16 stackPadding;
@@ -6178,20 +6194,22 @@ void render_balloon(Vec3f arg0, f32 arg1, s16 arg2, s16 arg3) {
spF4[0] = 0;
spF4[1] = camera1->rot[1];
spF4[2] = arg2;
mtxf_translate_rotate(sp108, spFC, spF4);
mtxf_scale2(sp108, arg1);
convert_to_fixed_point_matrix(&gGfxPool->mtxEffect[gMatrixEffectCount], sp108);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxEffect[gMatrixEffectCount]),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
mtxf_translate_rotate(mtx, spFC, spF4);
mtxf_scale2(mtx, arg1);
// convert_to_fixed_point_matrix(&gGfxPool->mtxEffect[gMatrixEffectCount], sp108);
// gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxEffect[gMatrixEffectCount]),
// G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
AddEffectMatrix(mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(gDisplayListHead++, D_0D008DB8);
gDPLoadTLUT_pal256(gDisplayListHead++, gTLUTOnomatopoeia);
gDPSetTextureLUT(gDisplayListHead++, G_TT_RGBA16);
func_8004B614(primRed, primGreen, primBlue, envRed, envGreen, envBlue, 0x000000D8);
gDPSetRenderMode(gDisplayListHead++,
AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_WRAP | ZMODE_XLU | CVG_X_ALPHA | FORCE_BL |
GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA),
AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_WRAP | ZMODE_XLU | CVG_X_ALPHA | FORCE_BL |
GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA));
AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_WRAP | ZMODE_XLU | CVG_X_ALPHA | FORCE_BL |
GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA),
AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_WRAP | ZMODE_XLU | CVG_X_ALPHA | FORCE_BL |
GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA));
gDPLoadTextureBlock(gDisplayListHead++, D_8018D4BC, G_IM_FMT_CI, G_IM_SIZ_8b, 64, 32, 0, G_TX_NOMIRROR | G_TX_CLAMP,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSPVertex(gDisplayListHead++, gBalloonVertexPlane1, 4, 0);
+8 -6
View File
@@ -286,7 +286,7 @@ void func_8006F008(void) {
// D_8018D2E0 = 57;
// D_8018D2E8 = 44;
// break;
// case COURSE_KALAMARI_DESERT:
// case COURSE_KALIMARI_DESERT:
// D_8018D2C0[0] = 263;
// D_8018D2D8[0] = 165;
// D_8018D220 = (void*) dma_textures(gTextureExhaust5, 0x443, 0x1000);
@@ -624,9 +624,11 @@ void init_object_list_index(void) {
find_unused_obj_index(&indexObjectList4[loopIndex]);
}
for (loopIndex = 0; loopIndex < NUM_BOMB_KARTS_VERSUS; loopIndex++) {
find_unused_obj_index(&gIndexObjectBombKart[loopIndex]);
}
CourseManager_SpawnBombKarts();
// for (loopIndex = 0; loopIndex < NUM_BOMB_KARTS_VERSUS; loopIndex++) {
// find_unused_obj_index(&gIndexObjectBombKart[loopIndex]);
// }
}
void init_cloud_object(s32 objectIndex, s32 arg1, CloudData* arg2) {
@@ -741,7 +743,7 @@ void func_8007055C(void) {
// case COURSE_TOADS_TURNPIKE:
// init_stars(gToadsTurnpikeRainbowRoadStars);
// break;
// case COURSE_KALAMARI_DESERT:
// case COURSE_KALIMARI_DESERT:
// init_clouds(gKalimariDesertClouds);
// break;
// case COURSE_SHERBET_LAND:
@@ -990,7 +992,7 @@ void init_course_object(void) {
// }
// }
// break;
// case COURSE_KALAMARI_DESERT:
// case COURSE_KALIMARI_DESERT:
// if (gGamestate != CREDITS_SEQUENCE) {
// find_unused_obj_index(&D_8018CF10);
// init_object(D_8018CF10, 0);
+66 -86
View File
@@ -46,6 +46,7 @@
#include "engine/Engine.h"
#include "engine/courses/Course.h"
#include "engine/Matrix.h"
const char* GetCupName(void);
@@ -323,36 +324,9 @@ char* gCupNames[] = {
"special cup",
};
// Displays at beginning of course
char* gCourseNames[] = {
#include "assets/course_metadata/gCourseNames.inc.c"
};
char* gCourseNamesDup[] = {
#include "assets/course_metadata/gCourseNames.inc.c"
};
char* gCourseNamesDup2[] = {
#include "assets/course_metadata/gCourseNames.inc.c"
};
// Used in debug menu at splash screen
char* gDebugCourseNames[] = {
#include "assets/course_metadata/gCourseDebugNames.inc.c"
};
const s8 gPerCupIndexByCourseId[] = {
#include "assets/course_metadata/gPerCupIndexByCourseId.inc.c"
};
// @todo Increase this array for more than eight players
const s8 D_800EFD64[] = { 0, 1, 4, 3, 5, 6, 2, 7 };
// Maps course IDs (as defined in the COURSES enum) to the cup they belong to
s8 gCupSelectionByCourseId[] = {
#include "assets/course_metadata/gCupSelectionByCourseId.inc.c"
};
char* D_800E7678[] = {
"none",
"bronze",
@@ -448,10 +422,6 @@ char D_800E77B4[] = "a BUTTON*SEE DATA B BUTTON*EXIT";
// This is plain data, it should not end up in rodata
char D_800E77D8[] = "distance";
char* sCourseLengths[] = {
#include "assets/course_metadata/sCourseLengths.inc.c"
};
char* D_800E7834[] = {
"return to menu",
"erase records for this course",
@@ -1987,7 +1957,7 @@ void func_80093A30(s32 arg0) {
}
void func_80093A5C(u32 arg0) {
if (D_8015F788 == 0) {
if (gNumScreens == 0) {
func_8009C918();
}
switch (arg0) {
@@ -1998,7 +1968,7 @@ void func_80093A5C(u32 arg0) {
case RENDER_SCREEN_MODE_2P_HORIZONTAL_PLAYER_TWO:
case RENDER_SCREEN_MODE_2P_VERTICAL_PLAYER_ONE:
case RENDER_SCREEN_MODE_2P_VERTICAL_PLAYER_TWO:
if (D_8015F788 == 0) {
if (gNumScreens == 0) {
func_80093C1C((s32) D_800F0B1C[arg0]);
} else {
func_800940EC((s32) D_800F0B1C[arg0]);
@@ -2008,7 +1978,7 @@ void func_80093A5C(u32 arg0) {
case RENDER_SCREEN_MODE_3P_4P_PLAYER_TWO:
case RENDER_SCREEN_MODE_3P_4P_PLAYER_THREE:
case RENDER_SCREEN_MODE_3P_4P_PLAYER_FOUR:
if (D_8015F788 == 3) {
if (gNumScreens == 3) {
func_800940EC((s32) D_800F0B1C[arg0]);
} else {
func_80093C1C((s32) D_800F0B1C[arg0]);
@@ -2063,9 +2033,10 @@ UNUSED void func_80093C90(void) {
void func_80093C98(s32 arg0) {
gSPViewport(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(D_802B8880));
guOrtho(&gGfxPool->mtxEffect[gMatrixEffectCount], 0.0f, 319.0f, 239.0f, 0.0f, -100.0f, 100.0f, 1.0f);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxEffect[gMatrixEffectCount++]),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
// guOrtho(&gGfxPool->mtxEffect[gMatrixEffectCount], 0.0f, 319.0f, 239.0f, 0.0f, -100.0f, 100.0f, 1.0f);
// gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxEffect[gMatrixEffectCount++]),
// G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
AddEffectMatrixOrtho();
gSPDisplayList(gDisplayListHead++, D_02007F18);
gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
func_800A8250();
@@ -2074,6 +2045,7 @@ void func_80093C98(s32 arg0) {
func_8009CA6C(4);
D_80165754 = gMatrixEffectCount;
gMatrixEffectCount = 0;
ClearEffectsMatrixPool();
}
}
@@ -2110,9 +2082,10 @@ void func_80093E60(void) {
void func_80093F10(void) {
gSPViewport(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(D_802B8880));
guOrtho(&gGfxPool->mtxEffect[gMatrixEffectCount], 0.0f, 319.0f, 239.0f, 0.0f, -100.0f, 100.0f, 1.0f);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxEffect[gMatrixEffectCount++]),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
// guOrtho(&gGfxPool->mtxEffect[gMatrixEffectCount], 0.0f, 319.0f, 239.0f, 0.0f, -100.0f, 100.0f, 1.0f);
// gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxEffect[gMatrixEffectCount++]),
// G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
AddEffectMatrixOrtho();
gSPDisplayList(gDisplayListHead++, D_02007F18);
gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
func_80092290(4, D_8018E850, D_8018E858);
@@ -2126,14 +2099,16 @@ void func_80093F10(void) {
func_8009CA2C();
gSPDisplayList(gDisplayListHead++, D_02007F48);
gMatrixEffectCount = 0;
ClearEffectsMatrixPool();
}
void func_800940EC(s32 arg0) {
gSPViewport(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(D_802B8880));
gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
guOrtho(&gGfxPool->mtxEffect[gMatrixEffectCount], 0.0f, 319.0f, 239.0f, 0.0f, -100.0f, 100.0f, 1.0f);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxEffect[gMatrixEffectCount++]),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
// guOrtho(&gGfxPool->mtxEffect[gMatrixEffectCount], 0.0f, 319.0f, 239.0f, 0.0f, -100.0f, 100.0f, 1.0f);
// gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxEffect[gMatrixEffectCount++]),
// G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
AddEffectMatrixOrtho();
gSPDisplayList(gDisplayListHead++, D_02007F18);
func_80092290(4, D_8018E850, D_8018E858);
func_80092290(5, (s32*) &D_8018E850[1], (s32*) &D_8018E858[1]);
@@ -2223,6 +2198,8 @@ void render_checkered_flag(struct GfxPool* arg0, UNUSED s32 arg1) {
}
void func_80094A64(struct GfxPool* pool) {
ClearHudMatrixPool();
ClearEffectsMatrixPool();
gMatrixHudCount = 0;
gMatrixEffectCount = 0;
gSPViewport(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(D_802B8880));
@@ -2625,13 +2602,10 @@ void func_80095AE0(MTX_TYPE* arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4) {
Gfx* func_80095BD0(Gfx* displayListHead, u8* arg1, f32 arg2, f32 arg3, u32 arg4, u32 arg5, f32 arg6, f32 arg7) {
Vtx* var_a1;
Mtx* sp28;
// A match is a match, but why are goto's required here?
if (gMatrixEffectCount >= 0x2F7) {
goto func_80095BD0_label1;
}
sp28 = &gGfxPool->mtxEffect[gMatrixEffectCount];
if (gMatrixEffectCount < 0) {
rmonPrintf("effectcount < 0 !!!!!!(kawano)\n");
}
@@ -2640,10 +2614,9 @@ func_80095BD0_label1:
rmonPrintf("MAX effectcount(760) over!!!!(kawano)\n");
return displayListHead;
func_80095BD0_label2:
func_80095AE0(sp28, arg2, arg3, arg6, arg7);
gSPMatrix(displayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxEffect[gMatrixEffectCount]),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gMatrixEffectCount += 1;
func_80095AE0(&gGfxPool->mtxEffect[gMatrixEffectCount], arg2, arg3, arg6, arg7);
gSPMatrix(displayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxEffect[gMatrixEffectCount++]),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPLoadTextureTile_4b(displayListHead++, arg1, G_IM_FMT_I, arg4, 0, 0, 0, arg4, arg5, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
switch (arg4) {
@@ -3341,9 +3314,9 @@ Gfx* draw_box(Gfx* displayListHead, s32 ulx, s32 uly, s32 lrx, s32 lry, u32 red,
}
gSPDisplayList(displayListHead++, D_02008008);
gDPSetPrimColor(displayListHead++, 0, 0, red, green, blue, alpha);
// gDPFillWideRectangle(displayListHead++, OTRGetRectDimensionFromLeftEdge(0), uly,
// OTRGetRectDimensionFromRightEdge(SCREEN_WIDTH), lry);
gDPFillRectangle(displayListHead++, ulx, uly, lrx, lry);
gDPFillWideRectangle(displayListHead++, OTRGetRectDimensionFromLeftEdge(ulx), uly,
OTRGetRectDimensionFromRightEdge(lrx), lry);
//gDPFillRectangle(displayListHead++, ulx, uly, lrx, lry);
gDPPipeSync(displayListHead++);
return displayListHead;
}
@@ -4805,7 +4778,7 @@ void func_8009CE64(s32 arg0) {
func_8009CE64_label1:
if (var_a1) {
gGotoMenu = 9;
gCreditsCourseId = 8;
gCreditsCourseId = COURSE_LUIGI_RACEWAY;
} else {
gGotoMenu = 1;
gMenuSelection = 0x0000000B;
@@ -4945,6 +4918,7 @@ void func_8009CE64(s32 arg0) {
case 0: /* switch 4 */
SetCourseByClass(GetMarioRaceway());
CourseManager_SetCup(GetFlowerCup());
SetCupCursorPosition(COURSE_FOUR);
gCurrentCourseId = 0;
gScreenModeSelection = 0;
gPlayerCountSelection1 = 1;
@@ -4955,6 +4929,7 @@ void func_8009CE64(s32 arg0) {
case 1: /* switch 4 */
SetCourseByClass(GetLuigiRaceway());
CourseManager_SetCup(GetMushroomCup());
SetCupCursorPosition(COURSE_ONE);
gCurrentCourseId = (s16) 1;
gScreenModeSelection = (s32) 1;
gPlayerCountSelection1 = 2;
@@ -4966,7 +4941,8 @@ void func_8009CE64(s32 arg0) {
case 2: /* switch 4 */
SetCourseByClass(GetKalimariDesert());
CourseManager_SetCup(GetMushroomCup());
gCurrentCourseId = COURSE_KALAMARI_DESERT;
SetCupCursorPosition(COURSE_FOUR);
gCurrentCourseId = COURSE_KALIMARI_DESERT;
gScreenModeSelection = 0;
gPlayerCountSelection1 = (s32) 1;
gPlayerCount = 1;
@@ -4976,6 +4952,7 @@ void func_8009CE64(s32 arg0) {
case 3: /* switch 4 */
SetCourseByClass(GetWarioStadium());
CourseManager_SetCup(GetStarCup());
SetCupCursorPosition(COURSE_ONE);
gCurrentCourseId = 0x000E;
gScreenModeSelection = 3;
gPlayerCountSelection1 = 3;
@@ -4988,6 +4965,7 @@ void func_8009CE64(s32 arg0) {
case 4: /* switch 4 */
SetCourseByClass(GetBowsersCastle());
CourseManager_SetCup(GetStarCup());
SetCupCursorPosition(COURSE_FOUR);
gCurrentCourseId = 2;
gScreenModeSelection = 0;
gPlayerCountSelection1 = (s32) 1;
@@ -4998,6 +4976,7 @@ void func_8009CE64(s32 arg0) {
case 5: /* switch 4 */
SetCourseByClass(GetSherbetLand());
CourseManager_SetCup(GetFlowerCup());
SetCupCursorPosition(COURSE_TWO);
gCurrentCourseId = 0x000C;
gScreenModeSelection = 3;
gPlayerCountSelection1 = 4;
@@ -5011,6 +4990,7 @@ void func_8009CE64(s32 arg0) {
default:
break;
}
SetCourseFromCup();
gNextDemoId += 1;
if (gNextDemoId >= 6) {
gNextDemoId = 0;
@@ -5063,7 +5043,7 @@ void func_8009CE64(s32 arg0) {
case 2: /* switch 5 */
case 3: /* switch 5 */
gGamestateNext = 9;
gCreditsCourseId = 8;
gCreditsCourseId = COURSE_LUIGI_RACEWAY;
break;
default: /* switch 5 */
gGamestateNext = 4;
@@ -5100,9 +5080,9 @@ void func_8009CE64(s32 arg0) {
}
}
gCupSelection = gCupSelectionByCourseId[gCurrentCourseId];
//gCupSelection = gCupSelectionByCourseId[gCurrentCourseId];
D_800DC540 = GetCupIndex();
gCourseIndexInCup = gPerCupIndexByCourseId[gCurrentCourseId];
gCourseIndexInCup = GetCupCursorPosition();;
switch (gDebugGotoScene) { /* switch 6; irregular */
case 1: /* switch 6 */
@@ -5453,12 +5433,12 @@ void func_8009E2F0(s32 arg0) {
temp_t0 = &D_8018E810[arg0];
temp_v0 = &D_800E7AC8[temp_t7];
if ((u32) D_8018E840[arg0] < 0x1BU) {
gDisplayListHead = draw_box(gDisplayListHead, temp_t1->x - (temp_t0->x / 2), temp_t1->y - (temp_t0->y / 2),
gDisplayListHead = draw_box_fill_wide(gDisplayListHead, temp_t1->x - (temp_t0->x / 2), temp_t1->y - (temp_t0->y / 2),
temp_t1->x + (temp_t0->x / 2), temp_t1->y + (temp_t0->y / 2), temp_v0->red,
temp_v0->green, temp_v0->blue, temp_v0->alpha);
} else {
temp_t7_2 = ((u32) (38 - D_8018E840[arg0])) / 11.0;
gDisplayListHead = draw_box(gDisplayListHead, temp_t1->x - (temp_t0->x / 2), temp_t1->y - (temp_t0->y / 2),
gDisplayListHead = draw_box_fill_wide(gDisplayListHead, temp_t1->x - (temp_t0->x / 2), temp_t1->y - (temp_t0->y / 2),
temp_t1->x + (temp_t0->x / 2), temp_t1->y + (temp_t0->y / 2), temp_v0->red,
temp_v0->green, temp_v0->blue, (u32) (temp_v0->alpha * temp_t7_2));
}
@@ -6011,11 +5991,11 @@ void func_8009F5E0(struct_8018D9E0_entry* arg0) {
}
break;
case 0x5: /* switch 6 */
var_t0 = (s32) ((f32) (get_string_width(gCourseNamesDup[0]) + 5) * 0.9f) / 2;
var_t0 = (s32) ((f32) (get_string_width(CourseManager_GetProps()->Name) + 5) * 0.9f) / 2;
gDisplayListHead = draw_box(gDisplayListHead, 0xA0 - var_t0, 0x0000007B, var_t0 + 0xA0, 0x000000A4, 0,
0, 0, 0x00000096);
set_text_color(1);
draw_text(0x0000009B, 0x0000008C, gCourseNamesDup[0], 0, 0.9f, 0.9f);
draw_text(0x0000009B, 0x0000008C, CourseManager_GetProps()->Name, 0, 0.9f, 0.9f);
temp_v1 = func_800B4EB4(0, 7) & 0xFFFFF;
if (temp_v1 < 0x1EAA) {
set_text_color((s32) gGlobalTimer % 2);
@@ -6813,10 +6793,10 @@ void func_800A1A20(struct_8018D9E0_entry* arg0) {
courseId = gCupCourseOrder[gTimeTrialDataCourseIndex / 4][gTimeTrialDataCourseIndex % 4];
arg0->column = 0x14;
set_text_color(TEXT_BLUE_GREEN_RED_CYCLE_1);
draw_text(0x69, arg0->row + 0x19, gCourseNamesDup[courseId], 0, 0.75f, 0.75f);
draw_text(0x69, arg0->row + 0x19, CourseManager_GetProps()->Name, 0, 0.75f, 0.75f);
set_text_color(TEXT_RED);
func_80093324(0x2D, arg0->row + 0x28, (char*) &D_800E77D8, 0, 0.75f, 0.75f);
func_800936B8(0xA5, arg0->row + 0x28, sCourseLengths[courseId], 1, 0.75f, 0.75f);
func_800936B8(0xA5, arg0->row + 0x28, CourseManager_GetProps()->CourseLength, 1, 0.75f, 0.75f);
set_text_color(TEXT_YELLOW);
func_80093324(0xA0, arg0->row + 0x86, D_800E7728[0], 0, 0.75f, 0.75f);
// Print the 3 Lap Time Trial records
@@ -7072,7 +7052,7 @@ void func_800A1FB0(struct_8018D9E0_entry* arg0) {
} else {
func_80093324(
0x2A + (var_s1 * 0x89), 0x96 + (0x1E * var_s2),
gCourseNamesDup2[gCupCourseOrder[var_v1->courseIndex / 4][var_v1->courseIndex % 4]], 0,
CourseManager_GetProps()->Name, 0,
0.5f, 0.5f);
}
}
@@ -7111,7 +7091,7 @@ void func_800A1FB0(struct_8018D9E0_entry* arg0) {
} else {
func_80093324(
0x2A + (var_s1 * 0x89), 0x96 + (0x1E * var_s2),
gCourseNamesDup2[gCupCourseOrder[var_v1->courseIndex / 4][var_v1->courseIndex % 4]], 0,
CourseManager_GetProps()->Name, 0,
0.5f, 0.5f);
}
}
@@ -7163,7 +7143,7 @@ void func_800A1FB0(struct_8018D9E0_entry* arg0) {
} else {
func_80093324(
0x2A + (var_s1 * 0x89), 0x96 + (0x1E * var_s2),
gCourseNamesDup2[gCupCourseOrder[var_v1->courseIndex / 4][var_v1->courseIndex % 4]], 0,
CourseManager_GetProps()->Name, 0,
0.5f, 0.5f);
}
}
@@ -7491,7 +7471,7 @@ void func_800A3E60(struct_8018D9E0_entry* arg0) {
set_text_color(4);
draw_text(arg0->column + 0x55, 0x19 - arg0->row,
gCourseNamesDup[gCupCourseOrder[GetCupIndex()][GetCupCursorPosition()]], 0, 0.6f, 0.6f);
CourseManager_GetProps()->Name, 0, 0.6f, 0.6f);
set_text_color(3);
draw_text(arg0->column + 0x55, 0x28 - arg0->row, D_800E7730, 0, 0.75f, 0.75f);
for (var_s1 = 0; var_s1 < 4; var_s1++) {
@@ -7558,8 +7538,7 @@ void func_800A3E60(struct_8018D9E0_entry* arg0) {
func_80093324(0xBB - arg0->column, 0xAA + (0x1E * var_s1), D_800E7A44, 0, 0.45f, 0.45f);
} else {
func_80093324(0xBB - arg0->column, 0xAA + (0x1E * var_s1),
gCourseNamesDup2[gCupCourseOrder[D_8018EE10[var_s1].courseIndex / 4]
[D_8018EE10[var_s1].courseIndex % 4]],
CourseManager_GetProps()->Name,
0, 0.45f, 0.45f);
}
}
@@ -7788,7 +7767,7 @@ void render_pause_menu_time_trials(struct_8018D9E0_entry* arg0) {
gDisplayListHead = draw_box(gDisplayListHead, 0, 0, 0x0000013F, 0x000000EF, 0, 0, 0, 0x0000008C);
set_text_color(TEXT_YELLOW);
draw_text(0x000000A0, 0x00000050, gCourseNamesDup[gCupCourseOrder[GetCupIndex()][GetCupCursorPosition()]], 0, 1.0f,
draw_text(0x000000A0, 0x00000050, CourseManager_GetProps()->Name, 0, 1.0f,
1.0f);
set_text_color(TEXT_RED);
draw_text(0x0000009D, 0x00000060, D_800E7728[0], 0, 0.8f, 0.8f);
@@ -7876,7 +7855,7 @@ void render_pause_grand_prix(struct_8018D9E0_entry* arg0) {
set_text_color(TEXT_YELLOW);
draw_text(160 + temp_s0, temp_s3->row - 50, D_800E76CC[gCCSelection], 0, 1.0f, 1.0f);
set_text_color(TEXT_YELLOW);
draw_text(160, temp_s3->row - 30, gCourseNamesDup[gCupCourseOrder[GetCupIndex()][GetCupCursorPosition()]], 0, 1.0f,
draw_text(160, temp_s3->row - 30, CourseManager_GetProps()->Name, 0, 1.0f,
1.0f);
for (var_s0 = 0; var_s0 < 2; var_s0++) {
text_rainbow_effect(arg0->cursor - 31, var_s0, TEXT_YELLOW);
@@ -7929,9 +7908,10 @@ void func_800A54EC(void) {
sp48 = find_8018D9E0_entry(0x000000C7);
if (why) {} // ?????
gSPViewport(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(D_802B8880));
guOrtho(&gGfxPool->mtxEffect[gMatrixEffectCount], 0.0f, 319.0f, 239.0f, 0.0f, -100.0f, 100.0f, 1.0f);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxEffect[gMatrixEffectCount++]),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
// guOrtho(&gGfxPool->mtxEffect[gMatrixEffectCount], 0.0f, 319.0f, 239.0f, 0.0f, -100.0f, 100.0f, 1.0f);
// gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxEffect[gMatrixEffectCount++]),
// G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
AddEffectMatrixOrtho();
switch (why) { /* irregular */
default:
break;
@@ -7991,7 +7971,7 @@ void func_800A5738(struct_8018D9E0_entry* arg0) {
gDisplayListHead = draw_box(gDisplayListHead, 0, 0, 0x0000013F, 0x000000EF, 0, 0, 0, var_s1);
gDPSetPrimColor(gDisplayListHead++, 0, 0, 0x00, 0x00, 0x00, var_s2);
set_text_color(3);
func_80093754(0x000000A0, 0x00000050, gCourseNamesDup[gCupCourseOrder[GetCupIndex()][GetCupCursorPosition()]],
func_80093754(0x000000A0, 0x00000050, CourseManager_GetProps()->Name,
0, 1.0f, 1.0f);
switch (arg0->cursor) { /* switch 1 */
case 1: /* switch 1 */
@@ -8056,8 +8036,7 @@ void func_800A5738(struct_8018D9E0_entry* arg0) {
func_80093324(0x69 - arg0->column, (0x96 + (0x14 * var_s1)), D_800E7A44, 0, 0.75f, 0.75f);
} else {
func_80093324(0x69 - arg0->column, (0x96 + (0x14 * var_s1)),
gCourseNamesDup2[gCupCourseOrder[D_8018EE10[var_s1].courseIndex / 4]
[D_8018EE10[var_s1].courseIndex % 4]],
CourseManager_GetProps()->Name,
0, 0.75f, 0.75f);
}
}
@@ -8220,12 +8199,12 @@ void func_800A638C(struct_8018D9E0_entry* arg0) {
}
void func_800A66A8(struct_8018D9E0_entry* arg0, Unk_D_800E70A0* arg1) {
Mtx* mtx;
Mtx *mtx;
f32 tmp;
static float x2, y2, z2;
static float x1, y1, z1;
mtx = &gGfxPool->mtxEffect[gMatrixEffectCount];
mtx = GetEffectMatrix(); // &gGfxPool->mtxEffect[gMatrixEffectCount];
if (arg0->unk24 > 1.5) {
arg0->unk24 *= 0.95;
} else {
@@ -8256,8 +8235,9 @@ void func_800A66A8(struct_8018D9E0_entry* arg0, Unk_D_800E70A0* arg1) {
guMtxCatL(mtx, mtx + 1, mtx);
guTranslate(mtx + 1, arg1->column, arg1->row, 0.0f);
guMtxCatL(mtx, mtx + 1, mtx);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxEffect[gMatrixEffectCount++]),
(G_MTX_NOPUSH | G_MTX_LOAD) | G_MTX_MODELVIEW);
//gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxEffect[gMatrixEffectCount++]),
// (G_MTX_NOPUSH | G_MTX_LOAD) | G_MTX_MODELVIEW);
AddEffectMatrixFixed(G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIA, G_CC_MODULATEIA);
gDPNoOp(gDisplayListHead++);
@@ -8511,11 +8491,11 @@ void func_800A7790(struct_8018D9E0_entry* arg0) {
slideDirection = D_802850C0[creditIndex].slideDirection;
if ((slideDirection == SLIDE_RIGHT) || (slideDirection != SLIDE_LEFT)) {
someScaling = D_802850C0[creditIndex].textScaling;
func_800936B8(arg0->column, arg0->row, D_802854B0[creditIndex], arg0->unk1C * someScaling,
func_800936B8(arg0->column, arg0->row, gCreditsText[creditIndex], arg0->unk1C * someScaling,
arg0->unk24 * someScaling, someScaling);
} else {
someScaling = D_802850C0[creditIndex].textScaling;
func_80093324(arg0->column, arg0->row, D_802854B0[creditIndex], arg0->unk1C * someScaling,
func_80093324(arg0->column, arg0->row, gCreditsText[creditIndex], arg0->unk1C * someScaling,
arg0->unk24 * someScaling, someScaling);
}
}
@@ -12208,7 +12188,7 @@ void func_800AF4DC(struct_8018D9E0_entry* arg0) {
case 0:
arg0->column = temp_v1->startingColumn;
arg0->cursor = 1;
arg0->unk20 = temp_v1->columnExtra + (get_string_width(D_802854B0[temp_v0]) * temp_v1->textScaling / 2);
arg0->unk20 = temp_v1->columnExtra + (get_string_width(gCreditsText[temp_v0]) * temp_v1->textScaling / 2);
/* fallthrough */
case 1:
func_800A9208(arg0, arg0->unk20);
@@ -12260,7 +12240,7 @@ void func_800AF740(struct_8018D9E0_entry* arg0) {
case 0:
arg0->column = temp_v1->startingColumn;
arg0->cursor = 1;
arg0->unk20 = temp_v1->columnExtra - (get_string_width(D_802854B0[temp_v0]) * temp_v1->textScaling / 2);
arg0->unk20 = temp_v1->columnExtra - (get_string_width(gCreditsText[temp_v0]) * temp_v1->textScaling / 2);
/* fallthrough */
case 1:
func_800A9208(arg0, arg0->unk20);
-8
View File
@@ -489,14 +489,7 @@ extern RGBA16 D_800E74D0[];
extern RGBA16 D_800E74E8[];
extern const s16 gGlyphDisplayWidth[];
extern char* gCupNames[];
extern char* gCourseNames[];
extern char* gCourseNamesDup[];
extern char* gCourseNamesDup2[];
extern char* gDebugCourseNames[];
// Maps course IDs (as defined in the COURSES enum) to an index in a given cup's track order
extern const s8 gPerCupIndexByCourseId[]; // D_800EFD50
extern const s8 D_800EFD64[];
extern s8 gCupSelectionByCourseId[];
extern char* D_800E7678[];
extern char* gDebugCharacterNames[];
extern char* D_800E76A8[];
@@ -517,7 +510,6 @@ extern char* D_800E77A0[];
extern char* D_800E77A8[];
extern char D_800E77B4[];
extern char D_800E77D8[];
extern char* sCourseLengths[];
extern char* D_800E7834[];
extern char* D_800E7840[];
extern char* D_800E7848[];
+4 -2
View File
@@ -197,8 +197,10 @@ void func_800B0004(void) {
}
}
func_800AFF58(vtxs);
D_8018EDB0 += D_8018EDB2;
++D_8018EDB4;
if (gTickVisuals) {
D_8018EDB0 += D_8018EDB2;
++D_8018EDB4;
}
gSPSetGeometryMode(gDisplayListHead++, G_CULL_BACK);
gSPNumLights(gDisplayListHead++, NUMLIGHTS_1);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
-41
View File
@@ -12,37 +12,8 @@
#include <assets/frappe_snowland_data.h>
#include <assets/dks_jungle_parkway_data.h>
// @warning Array contains an extra zero element at the end.
KartAIBehaviour* gKartAIBehaviourLUT[] = {
#include "assets/course_metadata/gKartAIBehaviourLUT.inc.c"
};
TrackWaypoint nullPath = { 0x8000, 0x0000, 0x0000, 0x0000 };
TrackWaypoint* gCoursePathTable[][4] = {
#include "assets/course_metadata/gCoursePathTableUnknown.inc.c"
};
TrackWaypoint* gCoursePathTable2[][4] = {
#include "assets/course_metadata/gCoursePathTable.inc.c"
};
// @warning Array contains an extra zero element at the end.
s16 gKartAISteeringSensitivity[] = {
#include "assets/course_metadata/gCPUSteeringSensitivity.inc.c"
};
// Possibly maximum cpu separation
f32 gKartAICourseMaximumSeparation[] = {
#include "assets/course_metadata/gKartAICourseMaximumSeparation.inc.c"
};
// Possibly minimum cpu separation
f32 gKartAICourseMinimumSeparation[] = {
#include "assets/course_metadata/gKartAICourseMinimumSeparation.inc.c"
};
// I think the types for D_800DCAF4, D_800DCB34, and D_800DCBB4 are all
// wrong in some way based on their usage in func_800088D8
// But I cannot be bothered to figure it out
@@ -62,18 +33,6 @@ s16 D_800DCB34[] = {
0x0005, 0x0005, 0x0005, 0x0005, 0x000a, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005, 0x0005,
};
s16* D_800DCBB4[] = {
#include "assets/course_metadata/D_800DCBB4.inc.c"
};
BombKartSpawn gBombKartSpawns[][NUM_BOMB_KARTS_MAX] = {
#include "assets/course_metadata/gBombKartSpawns.inc.c"
};
_struct_gCoursePathSizes_0x10 gCoursePathSizes[] = {
#include "assets/course_metadata/gCoursePathSizes.inc.c"
};
s32 D_800DDB20 = 0x00000000;
s32 D_800DDB24 = 0x00000001;
-9
View File
@@ -15,18 +15,9 @@ typedef struct {
/* 0x0A */ char padA[6];
} _struct_gCoursePathSizes_0x10; // size 0x10
extern KartAIBehaviour* gKartAIBehaviourLUT[];
extern TrackWaypoint nullPath;
extern TrackWaypoint* gCoursePathTable[][4];
extern TrackWaypoint* gCoursePathTable2[][4];
extern s16 gKartAISteeringSensitivity[];
extern f32 gKartAICourseMaximumSeparation[];
extern f32 gKartAICourseMinimumSeparation[];
extern s16 D_800DCAF4[];
extern s16 D_800DCB34[];
extern s16* D_800DCBB4[];
extern BombKartSpawn gBombKartSpawns[][NUM_BOMB_KARTS_MAX];
extern _struct_gCoursePathSizes_0x10 gCoursePathSizes[];
extern s32 D_800DDB20;
extern s32 D_800DDB24;
+1 -1
View File
@@ -1482,7 +1482,7 @@ void func_802847CC(CinematicCamera* camera) {
if (gCutsceneShotTimer == sp2C) {
if (D_80286A04[D_800DC5E4].unk0 != 2) {
func_80280268(D_80286A04[D_800DC5E4 + 1].unk1);
func_80280268(D_80286A04[D_800DC5E4 + 1].courseId);
}
}
}
+1 -1
View File
@@ -86,7 +86,7 @@ struct struct_80285D80 {
struct struct_80286A04 {
u8 unk0;
u8 unk1;
u8 courseId;
struct struct_80285D80* unk4;
struct struct_80285D80* unk8;
u16 unkC;
+10 -5
View File
@@ -27,6 +27,7 @@
#include "engine/Engine.h"
#include "engine/courses/Course.h"
#include "engine/Matrix.h"
s32 D_802874A0;
// s32 D_802874A4[5];
@@ -44,6 +45,8 @@ void func_80280038(void) {
UNUSED s32 pad;
Mat4 matrix;
ClearMatrixPools();
gMatrixObjectCount = 0;
gMatrixEffectCount = 0;
gMatrixHudCount = 0;
@@ -62,6 +65,7 @@ void func_80280038(void) {
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxLookAt[0]),
G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
gCurrentCourseId = gCreditsCourseId;
SetCourseById(gCreditsCourseId);
mtxf_identity(matrix);
render_set_position(matrix, 0);
render_course(D_800DC5EC);
@@ -75,14 +79,14 @@ void func_80280038(void) {
init_rdp();
}
void func_80280268(s32 arg0) {
void func_80280268(s32 courseId) {
gIsInQuitToMenuTransition = 1;
gQuitToMenuTransitionCounter = 5;
D_802874A0 = 1;
if ((arg0 < 0) || ((arg0 >= 20))) {
arg0 = 0;
if ((courseId < 0) || ((courseId >= NUM_COURSES - 1))) {
courseId = 0;
}
gCreditsCourseId = arg0;
gCreditsCourseId = courseId;
}
void credits_loop(void) {
@@ -128,6 +132,7 @@ void load_credits(void) {
Camera* camera = &cameras[0];
gCurrentCourseId = gCreditsCourseId;
SetCourseById(gCreditsCourseId);
D_800DC5B4 = 1;
creditsRenderMode = 1;
func_802A4D18();
@@ -171,7 +176,7 @@ void load_credits(void) {
camera->up[1] = 1.0f;
camera->up[2] = 0.0f;
init_cinematic_camera();
func_80003040();
credits_spawn_actors();
init_hud();
func_80093E60();
func_80092688();
+1 -1
View File
@@ -67,7 +67,7 @@ struct_802850C0_entry D_802850C0[] = {
{ 0.90f, 520, 130, 160, 130, SLIDE_LEFT, TEXT_YELLOW, 0 },
};
char* D_802854B0[] = {
char* gCreditsText[] = {
// English Credits
"executive producer", "hiroshi yamauchi", "producer", "shigeru miyamoto", "director", "hideki konno",
"assistant director", "yasuyuki oyagi", "programmer", "masato kimura", "kenji yamamoto", "yasuhiro kawaguchi",
+1 -1
View File
@@ -22,6 +22,6 @@ typedef struct {
} struct_802850C0_entry; // size = 0x10
extern struct_802850C0_entry D_802850C0[]; // D_802850C0
extern char* D_802854B0[];
extern char* gCreditsText[];
#endif
+7 -3
View File
@@ -19,6 +19,8 @@
#include "math_util.h"
#include <string.h>
#include "engine/Matrix.h"
s32 fireworkConeColour[] = {
0x00FF4080, // pink
0x008040FF, // purple
@@ -223,9 +225,10 @@ void func_80280A28(Vec3f arg0, Vec3s arg1, f32 arg2) {
mtx[2][0] = D_80287500[0][2] * arg2;
mtx[2][1] = D_80287500[1][2] * arg2;
mtx[2][2] = D_80287500[2][2] * arg2;
convert_to_fixed_point_matrix(&gGfxPool->mtxEffect[gMatrixEffectCount], mtx);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxEffect[gMatrixEffectCount]),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
// convert_to_fixed_point_matrix(&gGfxPool->mtxEffect[gMatrixEffectCount], mtx);
// gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxEffect[gMatrixEffectCount]),
// G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
AddEffectMatrix(mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
}
void render_fireworks(Vec3f arg0, f32 arg1, s32 rgb, s16 alpha) {
@@ -448,6 +451,7 @@ void func_80281540(void) {
}
void podium_ceremony_loop(void) {
ClearMatrixPools();
gMatrixObjectCount = 0;
D_802874FC = 0;
update_camera_podium_ceremony();
+6 -2
View File
@@ -9,5 +9,9 @@ AActor::AActor() {}
// Virtual functions to be overridden by derived classes
void AActor::Tick() { }
void AActor::Draw(Camera *camera) { }
void AActor::Collision() {}
void AActor::Destroy() { }
void AActor::Collision(Player* player, AActor* actor) {}
void AActor::Destroy() {
// Set uuid to zero.
memset(uuid, 0, sizeof(uuid));
}
bool AActor::IsMod() { return false; }
+7 -4
View File
@@ -7,13 +7,12 @@ extern "C" {
#include "main.h"
#include "camera.h"
#include "common_structs.h"
}
class AActor {
public:
uint8_t uuid[16];
/* 0x00 */ s16 Type;
/* 0x00 */ s16 Type = 0;
/* 0x02 */ s16 Flags;
/* 0x04 */ s16 Unk_04;
/* 0x06 */ s16 State;
@@ -24,6 +23,7 @@ public:
/* 0x18 */ Vec3f Pos;
/* 0x24 */ Vec3f Velocity = {0, 0, 0};
/* 0x30 */ Collision Unk30;
uint8_t uuid[16];
virtual ~AActor() = default; // Virtual destructor for proper cleanup in derived classes
@@ -31,6 +31,9 @@ public:
virtual void Tick();
virtual void Draw(Camera*);
virtual void Collision();
virtual void Collision(Player* player, AActor* actor);
virtual void Destroy();
virtual bool IsMod();
};
}
+123
View File
@@ -0,0 +1,123 @@
#include <libultraship.h>
#include <libultra/gbi.h>
#include "engine/World.h"
extern "C" {
#include "common_structs.h"
}
void AddMatrix(std::vector<Mtx>& stack, Mat4 mtx, s32 flags) {
// Reserve space if needed to avoid reallocation overhead
stack.reserve(1000);
// Push a new matrix to the stack
stack.emplace_back();
// Convert to a fixed-point matrix
guMtxF2L(mtx, &stack.back());
// Load the matrix
gSPMatrix(gDisplayListHead++, &stack.back(), flags);
}
Mtx* GetMatrix(std::vector<Mtx>& stack) {
stack.emplace_back();
return &stack.back();
}
/**
* Use GetMatrix first
*/
void AddMatrixFixed(std::vector<Mtx>& stack, s32 flags) {
// Load the matrix
gSPMatrix(gDisplayListHead++, &stack.back(), flags);
}
// Used in func_80095BD0
void SetTextMatrix(f32 arg1, f32 arg2, f32 arg3, f32 arg4) {
Mat4 mtx;
mtx[0][0] = arg3;
mtx[0][1] = 0.0f;
mtx[0][2] = 0.0f;
mtx[0][3] = 0.0f;
mtx[1][0] = 0.0f;
mtx[1][1] = arg4;
mtx[1][2] = 0.0f;
mtx[1][3] = 0.0f;
mtx[2][0] = 0.0f;
mtx[2][1] = 0.0f;
mtx[2][2] = 1.0f;
mtx[2][3] = 0.0f;
mtx[3][0] = arg1;
mtx[3][1] = arg2;
mtx[3][2] = 0.0f;
mtx[3][3] = 1.0f;
AddMatrix(gWorldInstance.Mtx.Effects, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
}
// API
extern "C" {
void AddHudMatrix(Mat4 mtx, s32 flags) {
AddMatrix(gWorldInstance.Mtx.Hud, mtx, flags);
}
void AddObjectMatrix(Mat4 mtx, s32 flags) {
AddMatrix(gWorldInstance.Mtx.Objects, mtx, flags);
}
void AddShadowMatrix(Mat4 mtx, s32 flags) {
AddMatrix(gWorldInstance.Mtx.Shadows, mtx, flags);
}
void AddKartMatrix(Mat4 mtx, s32 flags) {
AddMatrix(gWorldInstance.Mtx.Karts, mtx, flags);
}
void AddEffectMatrix(Mat4 mtx, s32 flags) {
AddMatrix(gWorldInstance.Mtx.Effects, mtx, flags);
}
void AddEffectMatrixFixed(s32 flags) {
AddMatrixFixed(gWorldInstance.Mtx.Effects, flags);
}
void AddEffectMatrixOrtho(void) {
auto& stack = gWorldInstance.Mtx.Effects;
stack.emplace_back();
guOrtho(&stack.back(), 0.0f, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1, 0.0f, -100.0f, 100.0f, 1.0f);
gSPMatrix(gDisplayListHead++, &stack.back(), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
}
Mtx* GetEffectMatrix(void) {
return GetMatrix(gWorldInstance.Mtx.Effects);
}
/**
* Note that the game doesn't seem to clear all of these at the beginning of a new frame.
* We might need to adjust which ones we clear.
*/
void ClearMatrixPools(void) {
gWorldInstance.Mtx.Hud.clear();
gWorldInstance.Mtx.Objects.clear();
gWorldInstance.Mtx.Shadows.clear();
gWorldInstance.Mtx.Karts.clear();
gWorldInstance.Mtx.Effects.clear();
}
void ClearHudMatrixPool(void) {
gWorldInstance.Mtx.Hud.clear();
}
void ClearEffectsMatrixPool(void) {
gWorldInstance.Mtx.Effects.clear();
}
void ClearObjectsMatrixPool(void) {
gWorldInstance.Mtx.Objects.clear();
}
}
+27
View File
@@ -0,0 +1,27 @@
#ifndef _MATRIX_HEADER_
#define _MATRIX_HEADER_
#include <libultraship.h>
#include "common_structs.h"
#ifdef __cplusplus
extern "C" {
#endif
void ClearMatrixPools(void);
void AddHudMatrix(Mat4 mtx, s32 flags);
void AddObjectMatrix(Mat4 mtx, s32 flags);
void AddEffectMatrix(Mat4 mtx, s32 flags);
void AddEffectMatrixOrtho(void);
void AddEffectMatrixFixed(s32 flags);
void SetTextMatrix(f32 arg1, f32 arg2, f32 arg3, f32 arg4);
Mtx* GetEffectMatrix(void);
void ClearHudMatrixPool(void);
void ClearEffectsMatrixPool(void);
void ClearObjectsMatrixPool(void);
#ifdef __cplusplus
}
#endif
#endif // _MATRIX_HEADER_
+44 -15
View File
@@ -9,6 +9,7 @@
#include "vehicles/Bus.h"
#include "vehicles/TankerTruck.h"
#include "vehicles/Car.h"
#include "vehicles/OBombKart.h"
#include "TrainCrossing.h"
#include <memory>
@@ -75,7 +76,7 @@ void World::AddCar(f32 speedA, f32 speedB, TrackWaypoint* path, uint32_t waypoin
cars++;
}
void World::ResetVehicles(void) {
void World::ClearVehicles(void) {
trains = trucks = busses = tankerTrucks = cars = boats = 0;
Vehicles.clear();
}
@@ -86,6 +87,10 @@ TrainCrossing* World::AddCrossing(Vec3f position, u32 waypointMin, u32 waypointM
return crossing.get();
}
void World::AddBombKart(Vec3f pos, TrackWaypoint* waypoint, uint16_t waypointIndex, uint16_t state, f32 unk_3C) {
BombKarts.push_back(std::make_unique<OBombKart>(pos, waypoint, waypointIndex, state, unk_3C));
}
u32 World::GetCupIndex() {
return this->CupIndex;
}
@@ -164,28 +169,52 @@ Object* World::AddObject(std::unique_ptr<GameObject> object) {
return &rawPtr->o;
}
AActor* World::AddActor(std::unique_ptr<AActor> actor) {
AActor* rawPtr = actor.get();
Actors.push_back(std::move(actor));
return rawPtr;
AActor* World::AddActor(AActor* actor) {
Actors.push_back(actor);
return Actors.back();
}
struct Actor* World::AddBaseActor() {
Actors.push_back(new AActor());
// Skip C++ vtable to access variables in C
return reinterpret_cast<struct Actor*>(reinterpret_cast<char*>(Actors.back()) + sizeof(void*));
}
/**
* Converts a C struct Actor* to its C++ AActor class
*/
AActor* World::ConvertActorToAActor(Actor* actor) {
// Move the ptr back so that it points at the vtable.
// Which is the initial item in the class, or in other words
// Point to the class.
return reinterpret_cast<AActor*>((char*)actor - sizeof(void*));
}
/**
* Converts a C++ AActor class to a C Actor* struct.
*/
Actor* World::ConvertAActorToActor(AActor* actor) {
// Move the ptr forward past the vtable.
// This allows C to access the class variables like a normal Actor* struct.
return reinterpret_cast<Actor*>((char*)actor + sizeof(void*));
}
AActor* World::GetActor(size_t index) {
return Actors[index];
}
void World::TickActors() {
for (auto& actor : Actors) {
actor->Tick();
}
}
void World::DrawActors(Camera* camera) {
for (auto& actor : Actors) {
actor->Draw(camera);
for (AActor* actor : Actors) {
if (actor->IsMod()) {
actor->Tick();
}
}
}
void RemoveExpiredActors() {
//Actors.erase(
// Actors.erase(
// std::remove_if(Actors.begin(), Actors.end(),
// [](const std::unique_ptr<AActor>& actor) { return actor->uuid == 0; }), // Example condition
// [](const std::unique_ptr<AActor>& actor) { return actor->uuid == 0; }),
// Actors.end());
}
+24 -4
View File
@@ -6,6 +6,7 @@
#include "vehicles/Vehicle.h"
#include "vehicles/Train.h"
#include "vehicles/Car.h"
#include "vehicles/OBombKart.h"
#include "TrainCrossing.h"
#include <memory>
#include "Actor.h"
@@ -64,15 +65,27 @@ class World {
SkyboxColours Skybox;
} Properties;
typedef struct {
std::vector<Mtx> Hud;
std::vector<Mtx> Objects;
std::vector<Mtx> Shadows;
std::vector<Mtx> Karts;
std::vector<Mtx> Effects;
} Matrix;
public:
explicit World();
void AddCourse(Course* course);
AActor* AddActor(std::unique_ptr<AActor> actor);
AActor* AddActor(AActor* actor);
struct Actor* AddBaseActor();
AActor* GetActor(size_t index);
void TickActors();
void DrawActors(Camera* camera);
void RemoveExpiredActors();
AActor* ConvertActorToAActor(Actor* actor);
Actor* ConvertAActorToActor(AActor* actor);
Object* AddObject(std::unique_ptr<GameObject> object);
@@ -99,6 +112,8 @@ public:
void NextCourse(void);
void PreviousCourse(void);
Matrix Mtx;
// Holds all available courses
Course* CurrentCourse;
@@ -108,8 +123,9 @@ public:
size_t CupIndex = 1;
std::vector<std::unique_ptr<GameObject>> GameObjects;
std::vector<std::unique_ptr<AActor>> Actors;
std::vector<AActor*> Actors;
/** Actors */
void AddBoat(f32 speed, uint32_t waypoint);
void AddTrain(size_t numCarriages, f32 speed, uint32_t waypoint);
void AddTruck(f32 speedA, f32 speedB, TrackWaypoint* path, uint32_t waypoint);
@@ -117,7 +133,11 @@ public:
void AddTankerTruck(f32 speedA, f32 speedB, TrackWaypoint* path, uint32_t waypoint);
void AddCar(f32 speedA, f32 speedB, TrackWaypoint* path, uint32_t waypoint);
std::vector<std::unique_ptr<AVehicle>> Vehicles;
void ResetVehicles(void);
void ClearVehicles(void);
/** Objects **/
void AddBombKart(Vec3f pos, TrackWaypoint* waypoint, uint16_t waypointIndex, uint16_t state, f32 unk_3C);
std::vector<std::unique_ptr<OBombKart>> BombKarts;
TrainCrossing* AddCrossing(Vec3f position, u32 waypointMin, u32 waypointMax, f32 approachRadius, f32 exitRadius);
std::vector<std::shared_ptr<TrainCrossing>> Crossings;
+1 -1
View File
@@ -54,7 +54,7 @@ void ABanana::Tick() {
void ABanana::Draw(Camera *camera) {
render_actor_banana(camera, NULL, (BananaActor*)this);
}
void ABanana::Collision() { }
void ABanana::Collision(Player* player, AActor*) { }
void ABanana::Destroy() { }
//void ABanana::Held() {}
+1 -1
View File
@@ -16,6 +16,6 @@ public:
// Virtual functions to be overridden by derived classes
virtual void Tick() override;
virtual void Draw(Camera*) override;
virtual void Collision() override;
virtual void Collision(Player*, AActor*) override;
virtual void Destroy() override;
};
+136
View File
@@ -0,0 +1,136 @@
#include <libultraship.h>
#include "ACloud.h"
#include "engine/Actor.h"
#include "World.h"
extern "C" {
#include "macros.h"
#include "common_structs.h"
#include "math_util.h"
#include "actor_types.h"
#include "actors.h"
extern f32 gKartHopInitialVelocityTable[];
extern f32 gKartGravityTable[];
}
ACloud::ACloud(Vec3f pos) {
Pos[0] = pos[0];
Pos[1] = pos[1];
Pos[2] = pos[2];
Rot[0] = 0;
Rot[1] = 0;
Rot[2] = 0;
//Flags = -0x8000 | 0x4000;
BoundingBoxSize = 2.0f;
}
void ACloud::Tick() {
Rot[1] += 0x200;
if (PickedUp) {
Timer++; // Increment timer
}
if (Timer > 500) { // Time has expired, reset the actor and player
PickedUp = false;
if (_player) {
gKartHopInitialVelocityTable[_player->characterId] = OldHop; // reset back to normal
gKartGravityTable[_player->characterId] = OldGravity;
_player = NULL; // Reset
}
Timer = 0;
}
}
extern Gfx cloud_mesh[];
void ACloud::Draw(Camera *camera) {
Mat4 mtx;
if (PickedUp) {
return; // Skip drawing if the actor has been picked up
}
mtxf_pos_rotation_xyz(mtx, Pos, Rot);
if (render_set_position(mtx, 0) != 0) {
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
gSPDisplayList(gDisplayListHead++, (Gfx*)cloud_mesh);
}
}
void ACloud::Collision(Player* player, AActor* actor) {
if (!PickedUp) {
if (query_collision_player_vs_actor_item(player, gWorldInstance.ConvertAActorToActor(actor))) {
// Player has picked up the actor, activate the cloud effect
_player = player;
PickedUp = true;
OldHop = gKartHopInitialVelocityTable[player->characterId];
OldGravity = gKartGravityTable[player->characterId];
gKartHopInitialVelocityTable[player->characterId] = Hop;
gKartGravityTable[player->characterId] = Gravity;
}
}
}
bool ACloud::IsMod() { return true; }
Vtx cloud_mesh_vtx_cull[8] = {
{{ {0, -4, -4}, 0, {0, 0}, {0, 0, 0, 0} }},
{{ {0, -4, 4}, 0, {0, 0}, {0, 0, 0, 0} }},
{{ {0, 4, 4}, 0, {0, 0}, {0, 0, 0, 0} }},
{{ {0, 4, -4}, 0, {0, 0}, {0, 0, 0, 0} }},
{{ {0, -4, -4}, 0, {0, 0}, {0, 0, 0, 0} }},
{{ {0, -4, 4}, 0, {0, 0}, {0, 0, 0, 0} }},
{{ {0, 4, 4}, 0, {0, 0}, {0, 0, 0, 0} }},
{{ {0, 4, -4}, 0, {0, 0}, {0, 0, 0, 0} }},
};
Vtx cloud_mesh_vtx_0[4] = {
{{ {0, 4, 4}, 0, {-524, -530}, {255, 255, 255, 166} }},
{{ {0, -4, 4}, 0, {-530, 1516}, {255, 255, 255, 201} }},
{{ {0, -4, -4}, 0, {1516, 1522}, {255, 255, 255, 188} }},
{{ {0, 4, -4}, 0, {1522, -524}, {255, 255, 255, 154} }},
};
Gfx cloud_mesh_tri_0[] = {
gsSPVertex(cloud_mesh_vtx_0 + 0, 4, 0),
gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0),
gsSPEndDisplayList(),
};
Gfx mat_cloud_cutout[] = {
gsSPSetGeometryMode(G_ZBUFFER | G_SHADE | G_FOG | G_SHADING_SMOOTH),
gsSPClearGeometryMode(G_CULL_FRONT | G_CULL_BACK | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_CLIPPING),
gsDPPipeSync(),
gsDPSetCombineLERP(TEXEL0, PRIMITIVE, PRIMITIVE, TEXEL1, 0, 0, 0, TEXEL0, COMBINED, 0, PRIMITIVE, 0, 0, 0, 0, COMBINED),
gsSPSetOtherMode(G_SETOTHERMODE_H, 4, 20, G_AD_NOISE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_PERSP | G_CYC_2CYCLE | G_PM_NPRIMITIVE),
gsSPSetOtherMode(G_SETOTHERMODE_L, 0, 32, G_AC_NONE | G_ZS_PIXEL | G_RM_FOG_SHADE_A | G_RM_AA_ZB_TEX_EDGE2),
gsSPTexture(65535, 65535, 0, 0, 1),
gsDPSetPrimColor(0, 0, 255, 220, 203, 255),
gsDPSetTextureImage(G_IM_FMT_I, G_IM_SIZ_8b_LOAD_BLOCK, 1, gTexture69C4E4),
gsDPSetTile(G_IM_FMT_I, G_IM_SIZ_8b_LOAD_BLOCK, 0, 0, 7, 0, G_TX_WRAP | G_TX_NOMIRROR, 0, 0, G_TX_WRAP | G_TX_NOMIRROR, 0, 0),
gsDPLoadBlock(7, 0, 0, 511, 512),
gsDPSetTile(G_IM_FMT_I, G_IM_SIZ_8b, 4, 0, 0, 0, G_TX_WRAP | G_TX_NOMIRROR, 5, 1, G_TX_WRAP | G_TX_NOMIRROR, 5, 1),
gsDPSetTileSize(0, 98, 100, 124, 124),
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b_LOAD_BLOCK, 1, gTexture66C8F4),
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b_LOAD_BLOCK, 0, 128, 6, 0, G_TX_WRAP | G_TX_NOMIRROR, 0, 0, G_TX_WRAP | G_TX_NOMIRROR, 0, 0),
gsDPLoadBlock(6, 0, 0, 1023, 256),
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 128, 1, 0, G_TX_CLAMP | G_TX_NOMIRROR, 5, 0, G_TX_CLAMP | G_TX_NOMIRROR, 5, 0),
gsDPSetTileSize(1, 0, 0, 124, 124),
gsSPEndDisplayList(),
};
Gfx cloud_mesh[] = {
//gsSPClearGeometryMode(G_LIGHTING),
//gsSPVertex(cloud_mesh_vtx_cull + 0, 8, 0),
gsSPSetGeometryMode(G_LIGHTING),
//gsSPCullDisplayList(0, 7),
gsSPDisplayList(mat_cloud_cutout),
gsSPDisplayList(cloud_mesh_tri_0),
gsSPEndDisplayList(),
};
+39
View File
@@ -0,0 +1,39 @@
#pragma once
#include <libultraship.h>
#include "engine/Actor.h"
extern "C" {
#include "macros.h"
#include "main.h"
#include "camera.h"
#include "common_structs.h"
}
class ACloud : public AActor {
public:
// Constructor
ACloud(Vec3f pos);
virtual ~ACloud() override = default;
// Virtual functions to be overridden by derived classes
virtual void Tick() override;
virtual void Draw(Camera*) override;
virtual void Collision(Player* player, AActor* actor) override;
virtual bool IsMod() override;
bool PickedUp = false;
uint32_t Timer = 0;
Player* _player = NULL;
f32 Hop = 3.0f;
f32 Gravity = 200.0f;
f32 OldHop = 0;
f32 OldGravity = 0;
};
+80
View File
@@ -0,0 +1,80 @@
#include <libultraship.h>
#include <libultra/gbi.h>
#include "AFinishline.h"
#include "engine/Actor.h"
#include "World.h"
#include "assets/common_data.h"
extern "C" {
#include "macros.h"
#include "common_structs.h"
#include "math_util.h"
#include "actor_types.h"
#include "actors.h"
extern f32 gKartHopInitialVelocityTable[];
extern f32 gKartGravityTable[];
}
AFinishline::AFinishline(Vec3f pos) {
if (pos != nullptr) { // Allow user to set their own values
Pos[0] = pos[0];
Pos[1] = pos[1] - 15;
Pos[2] = pos[2];
} else { // Default to first waypoint position
Pos[0] = D_80164490->posX;
Pos[1] = (f32) (D_80164490->posY - 15);
Pos[2] = D_80164490->posZ;
}
Rot[0] = 0;
Rot[1] = 0;
Rot[2] = 0;
Flags = -0x8000 | 0x4000;
BoundingBoxSize = 0.0f;
}
void AFinishline::Tick() {}
extern Gfx cloud_mesh[];
void AFinishline::Draw(Camera *camera) {
Mat4 mtx;
s16 temp = Pos[2];
s32 maxObjectsReached;
if (gGamestate == CREDITS_SEQUENCE) {
return;
}
mtxf_pos_rotation_xyz(mtx, Pos, Rot);
maxObjectsReached = render_set_position(mtx, 0) == 0;
if (maxObjectsReached) {
return;
}
if (temp < camera->pos[2]) {
if (D_800DC5BC != 0) {
gDPSetFogColor(gDisplayListHead++, D_801625EC, D_801625F4, D_801625F0, 0xFF);
gSPDisplayList(gDisplayListHead++, (Gfx*)D_0D001C20);
} else {
gSPDisplayList(gDisplayListHead++, (Gfx*)D_0D001B90);
}
} else if (D_800DC5BC != 0) {
gDPSetFogColor(gDisplayListHead++, D_801625EC, D_801625F4, D_801625F0, 0xFF);
gSPDisplayList(gDisplayListHead++, (Gfx*)D_0D001C88);
} else {
gSPDisplayList(gDisplayListHead++, (Gfx*)D_0D001BD8);
}
}
void AFinishline::Collision(Player* player, AActor* actor) {}
bool AFinishline::IsMod() { return true; }
+40
View File
@@ -0,0 +1,40 @@
#pragma once
#include <libultraship.h>
#include "engine/Actor.h"
extern "C" {
#include "macros.h"
#include "main.h"
#include "camera.h"
#include "common_structs.h"
}
class AFinishline : public AActor {
public:
/**
* Default behaviour places the finishline at the first waypoint.
* @arg pos, optional. Sets a custom position
*/
AFinishline(Vec3f pos = nullptr);
virtual ~AFinishline() override = default;
// Virtual functions to be overridden by derived classes
virtual void Tick() override;
virtual void Draw(Camera*) override;
virtual void Collision(Player* player, AActor* actor) override;
virtual bool IsMod() override;
bool PickedUp = false;
uint32_t Timer = 0;
Player* _player = NULL;
f32 Hop = 3.0f;
f32 Gravity = 200.0f;
f32 OldHop = 0;
f32 OldGravity = 0;
};
+66
View File
@@ -0,0 +1,66 @@
#include "ATree.h"
#include <libultra/gbi.h>
extern "C" {
#include "common_structs.h"
#include "math_util.h"
#include "main.h"
#include "actors.h"
}
ATree::ATree(Vec3f pos, Gfx* displaylist, f32 drawDistance, f32 minDrawDistance, const char* tlut = nullptr) {
Pos[0] = pos[0];
Pos[1] = pos[1];
Pos[2] = pos[2];
Displaylist = displaylist;
Tlut = tlut;
DrawDistance = drawDistance;
MinDrawDistance = minDrawDistance;
}
void ATree::Tick() {
if (((Flags & 0x800) == 0) && ((Flags & 0x400) != 0)) {
Pos[1] = Pos[1] + 4.0f;
if (Pos[1] > 800.0f) {
Flags |= 0x800;
}
}
}
void ATree::Draw(Camera* camera) {
f32 dist;
if ((Flags & 0x800) != 0) {
return;
}
dist = is_within_render_distance(camera->pos, Pos, camera->rot[1], 0, gCameraZoom[camera - camera1],
DrawDistance);
if (CVarGetInteger("gNoCulling", 0) == 1) {
dist = MAX(dist, 0.0f);
}
if (dist < 0.0f) {
return;
}
if (((Flags & 0x400) == 0) && (dist < MinDrawDistance)) {
func_8029794C(Pos, Rot, 3.0f);
}
sBillBoardMtx[3][0] = Pos[0];
sBillBoardMtx[3][1] = Pos[1];
sBillBoardMtx[3][2] = Pos[2];
if (render_set_position(sBillBoardMtx, 0) != 0) {
if (Tlut) {
gDPLoadTLUT_pal256(gDisplayListHead++, Tlut);
}
gSPDisplayList(gDisplayListHead++, Displaylist);
}
}
void ATree::Collision(Player* player, AActor*) { }
void ATree::Destroy() { }
+35
View File
@@ -0,0 +1,35 @@
#pragma once
#include <libultraship.h>
#include "engine/Actor.h"
extern "C" {
#include "common_structs.h"
}
// Note that this doesn't seem to work right
// Use add_actor_to_empty_slot(test, rot, vel, ACTOR_TREE_MARIO_RACEWAY);
// to spawn stock actors
class ATree : public AActor {
public:
Gfx* Displaylist;
const char* Tlut;
f32 DrawDistance;
f32 MinDrawDistance;
s16 Flags = -0x8000 | 0x4000;
s16 State = 0x43;
f32 BoundingBoxSize = 3.0f;
f32 Unk_08 = 20.0f;
virtual ~ATree() = default;
// Set tlut to NULL if not using a tlut
explicit ATree(Vec3f pos, Gfx* displaylist, f32 drawDistance, f32 minDrawDistance, const char* tlut);
virtual void Tick() override;
virtual void Draw(Camera* camera) override;
virtual void Collision(Player*, AActor*) override;
virtual void Destroy() override;
};
-1
View File
@@ -15,7 +15,6 @@ AWarioSign::AWarioSign(Vec3f pos) {
Pos[2] = pos[2];
}
// Virtual functions to be overridden by derived classes
void AWarioSign::Tick() {
Rot[1] += 0xB6;
}
+49 -28
View File
@@ -6,7 +6,8 @@
#include "BansheeBoardwalk.h"
#include "GameObject.h"
#include "World.h"
#include "BombKart.h"
#include "engine/actors/AFinishline.h"
#include "engine/vehicles/OBombKart.h"
#include "assets/banshee_boardwalk_data.h"
#include "assets/boo_frames.h"
@@ -102,13 +103,42 @@ BansheeBoardwalk::BansheeBoardwalk() {
Props.Skybox.FloorTopLeft = {0, 0, 0};
}
void BansheeBoardwalk::Load() {
Course::Load();
D_800DC5BC = 1;
D_801625EC = 0;
D_801625F4 = 0;
D_801625F0 = 0;
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_banshee_boardwalk_track_sections));
func_80295C6C();
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07000878), 128, 0, 0, 0);
D_8015F8E4 = -80.0f;
}
void BansheeBoardwalk::LoadTextures() {
}
void BansheeBoardwalk::SpawnActors() {
gWorldInstance.AddActor(new AFinishline());
spawn_all_item_boxes((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_banshee_boardwalk_item_box_spawns));
}
void BansheeBoardwalk::SpawnVehicles() {
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
gWorldInstance.AddBombKart(pos, &D_80164550[0][110], 110, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][190], 190, 1, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][250], 250, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][475], 475, 1, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][610], 610, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
}
}
// Likely sets minimap boundaries
void BansheeBoardwalk::MinimapSettings() {
D_80165880 = dma_textures((const char*)gTextureGhosts, 0x4CC2, 0xD980);
@@ -188,27 +218,12 @@ void BansheeBoardwalk::WhatDoesThisDoAI(Player* player, int8_t playerId) {
}
}
void BansheeBoardwalk::SpawnBombKarts() {
gWorldInstance.AddObject(std::make_unique<OBombKart>(140, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(165, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(330, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(550, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(595, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
}
// 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::SetStaffGhost() {
}
void BansheeBoardwalk::BeginPlay() { }
void BansheeBoardwalk::Render(struct UnkStruct_800DC5EC* arg0) {
Camera* camera = arg0->camera;
Mat4 spCC;
@@ -274,18 +289,7 @@ void BansheeBoardwalk::RenderCredits() {
void BansheeBoardwalk::Collision() {}
void BansheeBoardwalk::GenerateCollision() {
D_800DC5BC = 1;
D_801625EC = 0;
D_801625F4 = 0;
D_801625F0 = 0;
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_banshee_boardwalk_track_sections));
func_80295C6C();
find_vtx_and_set_colours(segmented_gfx_to_virtual(reinterpret_cast<void*>(0x07000878)), 128, 0, 0, 0);
D_8015F8E4 = -80.0f;
}
void BansheeBoardwalk::Water() {
void BansheeBoardwalk::ScrollingTextures() {
D_802B87BC++;
if (D_802B87BC >= 0x100) {
@@ -306,4 +310,21 @@ void BansheeBoardwalk::Waypoints(Player* player, int8_t playerId) {
}
}
void BansheeBoardwalk::DrawWater(struct UnkStruct_800DC5EC* screen, uint16_t pathCounter, uint16_t cameraRot, uint16_t playerDirection) {
gDPPipeSync(gDisplayListHead++);
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_XLU_INTER, G_RM_NOOP2);
gDPSetBlendMask(gDisplayListHead++, 0xFF);
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIA, G_CC_MODULATEIA);
// d_course_banshee_boardwalk_packed_dl_878
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07000878));
gDPSetAlphaCompare(gDisplayListHead++, G_AC_NONE);
gDPPipeSync(gDisplayListHead++);
}
void BansheeBoardwalk::CreditsSpawnActors() {
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07000878), 0x32, 0, 0, 0);
}
void BansheeBoardwalk::Destroy() { }
+5 -5
View File
@@ -24,8 +24,10 @@ 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 SpawnActors() override;
virtual void SpawnVehicles() override;
//virtual void InitClouds() override;
virtual void MinimapSettings() override;
virtual void InitCourseObjects() override;
@@ -35,14 +37,12 @@ public:
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 BeginPlay() override;
virtual void Render(struct UnkStruct_800DC5EC*) override;
virtual void RenderCredits() override;
virtual void Collision() override;
virtual void SpawnBombKarts() override;
virtual void GenerateCollision() override;
virtual void Water() override;
virtual void ScrollingTextures() override;
virtual void Waypoints(Player*, int8_t) 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;
};
+32 -21
View File
@@ -6,7 +6,7 @@
#include "BigDonut.h"
#include "GameObject.h"
#include "World.h"
#include "BombKart.h"
#include "engine/vehicles/OBombKart.h"
#include "assets/big_donut_data.h"
extern "C" {
@@ -98,11 +98,42 @@ BigDonut::BigDonut() {
Props.Skybox.FloorTopLeft = {0, 0, 0};
}
void BigDonut::Load() {
Course::Load();
// d_course_big_donut_packed_dl_1018
generate_collision_mesh_with_default_section_id((Gfx*) segmented_gfx_to_virtual((void*)0x07001018), 6);
// d_course_big_donut_packed_dl_450
generate_collision_mesh_with_default_section_id((Gfx*) segmented_gfx_to_virtual((void*)0x07000450), 6);
// d_course_big_donut_packed_dl_AC0
generate_collision_mesh_with_default_section_id((Gfx*) segmented_gfx_to_virtual((void*)0x07000AC0), 6);
// d_course_big_donut_packed_dl_B58
generate_collision_mesh_with_default_section_id((Gfx*) segmented_gfx_to_virtual((void*)0x07000B58), 6);
// d_course_big_donut_packed_dl_230
generate_collision_mesh_with_default_section_id((Gfx*) segmented_gfx_to_virtual((void*)0x07000230), 6);
func_80295C6C();
D_8015F8E4 = 100.0f;
}
void BigDonut::LoadTextures() {
}
void BigDonut::SpawnActors() {}
void BigDonut::SpawnVehicles() {
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
gWorldInstance.AddBombKart(pos, &D_80164550[0][20], 20, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][40], 40, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][60], 60, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][80], 80, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][100], 100, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][120], 120, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][140], 140, 0, 1.0f);
}
}
// Likely sets minimap boundaries
void BigDonut::MinimapSettings() {
D_8018D2A0 = 0.0257f;
@@ -118,17 +149,12 @@ void BigDonut::WhatDoesThisDo(Player* player, int8_t playerId) {}
void BigDonut::WhatDoesThisDoAI(Player* player, int8_t playerId) {}
void BigDonut::SpawnBombKarts() {}
// 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::SetStaffGhost() {}
void BigDonut::BeginPlay() {}
void BigDonut::Render(struct UnkStruct_800DC5EC* arg0) {
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
@@ -156,21 +182,6 @@ void BigDonut::RenderCredits() {}
void BigDonut::Collision() {}
void BigDonut::GenerateCollision() {
// d_course_big_donut_packed_dl_1018
generate_collision_mesh_with_default_section_id((Gfx*) segmented_gfx_to_virtual((void*)0x07001018), 6);
// d_course_big_donut_packed_dl_450
generate_collision_mesh_with_default_section_id((Gfx*) segmented_gfx_to_virtual((void*)0x07000450), 6);
// d_course_big_donut_packed_dl_AC0
generate_collision_mesh_with_default_section_id((Gfx*) segmented_gfx_to_virtual((void*)0x07000AC0), 6);
// d_course_big_donut_packed_dl_B58
generate_collision_mesh_with_default_section_id((Gfx*) segmented_gfx_to_virtual((void*)0x07000B58), 6);
// d_course_big_donut_packed_dl_230
generate_collision_mesh_with_default_section_id((Gfx*) segmented_gfx_to_virtual((void*)0x07000230), 6);
func_80295C6C();
D_8015F8E4 = 100.0f;
}
void BigDonut::Waypoints(Player* player, int8_t playerId) {
player->nearestWaypointId = 0;
}
+2 -4
View File
@@ -24,8 +24,10 @@ 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 SpawnActors() override;
virtual void SpawnVehicles() override;
//virtual void InitClouds() override;
virtual void MinimapSettings() override;
virtual void InitCourseObjects() override;
@@ -33,13 +35,9 @@ public:
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 BeginPlay() override;
virtual void Render(struct UnkStruct_800DC5EC*) override;
virtual void RenderCredits() override;
virtual void Collision() override;
virtual void SpawnBombKarts() override;
virtual void GenerateCollision() override;
virtual void Waypoints(Player* player, int8_t playerId) override;
virtual void Destroy() override;
};
+26 -13
View File
@@ -6,7 +6,7 @@
#include "BlockFort.h"
#include "GameObject.h"
#include "World.h"
#include "BombKart.h"
#include "engine/vehicles/OBombKart.h"
#include "assets/block_fort_data.h"
extern "C" {
@@ -101,10 +101,34 @@ BlockFort::BlockFort() {
Props.Skybox.FloorTopLeft = {216, 232, 248};
}
void BlockFort::Load() {
Course::Load();
generate_collision_mesh_with_default_section_id((Gfx*) segmented_gfx_to_virtual((void*)0x070015C0), 1);
func_80295C6C();
D_8015F8E4 = gCourseMinY - 10.0f;
}
void BlockFort::LoadTextures() {
}
void BlockFort::SpawnActors() {}
void BlockFort::SpawnActors() {
spawn_all_item_boxes((ActorSpawnData*)LOAD_ASSET_RAW(d_course_block_fort_item_box_spawns));
}
void BlockFort::SpawnVehicles() {
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
gWorldInstance.AddBombKart(pos, &D_80164550[0][20], 20, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][40], 40, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][60], 60, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][80], 80, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][100], 100, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][120], 120, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][140], 140, 0, 1.0f);
}
}
// Likely sets minimap boundaries
void BlockFort::MinimapSettings() {
@@ -121,17 +145,12 @@ void BlockFort::WhatDoesThisDo(Player* player, int8_t playerId) {}
void BlockFort::WhatDoesThisDoAI(Player* player, int8_t playerId) {}
void BlockFort::SpawnBombKarts() {}
// 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::SetStaffGhost() {}
void BlockFort::BeginPlay() { }
void BlockFort::Render(struct UnkStruct_800DC5EC* arg0) {
func_802B5D64(D_800DC610, D_802B87D4, 0, 1);
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
@@ -145,12 +164,6 @@ void BlockFort::RenderCredits() {}
void BlockFort::Collision() {}
void BlockFort::GenerateCollision() {
generate_collision_mesh_with_default_section_id((Gfx*) segmented_gfx_to_virtual((void*)0x070015C0), 1);
func_80295C6C();
D_8015F8E4 = gCourseMinY - 10.0f;
}
void BlockFort::Waypoints(Player* player, int8_t playerId) {
player->nearestWaypointId = 0;
}
+2 -4
View File
@@ -24,8 +24,10 @@ 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 SpawnActors() override;
virtual void SpawnVehicles() override;
//virtual void InitClouds() override;
virtual void MinimapSettings() override;
virtual void InitCourseObjects() override;
@@ -33,13 +35,9 @@ public:
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 BeginPlay() override;
virtual void Render(struct UnkStruct_800DC5EC*) override;
virtual void RenderCredits() override;
virtual void Collision() override;
virtual void SpawnBombKarts() override;
virtual void GenerateCollision() override;
virtual void Waypoints(Player*, int8_t) override;
virtual void Destroy() override;
};
-28
View File
@@ -1,28 +0,0 @@
#include "BombKart.h"
extern "C" {
#include "bomb_kart.h"
}
/**
* BombKarts derive their Y position from the waypoint Y value or 'spawn_actor_on_surface' function
*/
OBombKart::OBombKart(uint16_t waypoint, uint16_t state, float unk_04, float x, float z, float unk_10, float unk_14) {}
void OBombKart::Init() {
// BombKarts.emplace_back(this);
//BombKarts.push_back(BombKarts(waypoint, state, unk_04, x, z, unk_10, unk_14));
}
void OBombKart::Update() {
}
void OBombKart::Render() {
}
void OBombKart::Explode() {
}
-38
View File
@@ -1,38 +0,0 @@
#ifndef BOMBKART_H
#define BOMBKART_H
#include <libultraship.h>
#ifdef __cplusplus
#include "GameObject.h"
extern "C" {
#endif
#include "bomb_kart.h"
#include "Engine.h"
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
class OBombKart : public GameObject {
public:
virtual ~OBombKart() = default;
// Constructor
explicit OBombKart(uint16_t waypoint, uint16_t state, float unk_04, float x, float z, float unk_10, float unk_14);
BombKart vehicle;
virtual void Init();
virtual void Update();
virtual void Render();
virtual void Explode();
};
#endif
#endif // BOMBKART_H
+52 -22
View File
@@ -6,7 +6,8 @@
#include "BowsersCastle.h"
#include "GameObject.h"
#include "World.h"
#include "BombKart.h"
#include "engine/actors/AFinishline.h"
#include "engine/vehicles/OBombKart.h"
#include "bowsers_castle_data.h"
extern "C" {
@@ -102,15 +103,40 @@ BowsersCastle::BowsersCastle() {
Props.Skybox.FloorTopLeft = {0, 0, 0};
}
void BowsersCastle::Load() {
Course::Load();
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_bowsers_castle_addr));
func_80295C6C();
find_vtx_and_set_colours(segmented_gfx_to_virtual(reinterpret_cast<void*>(0x07001350)), 0x32, 0, 0, 0);
D_8015F8E4 = -50.0f;
}
void BowsersCastle::LoadTextures() {
dma_textures(gTextureShrub, 0x000003FFU, 0x00000800U);
}
void BowsersCastle::SpawnActors() {
gWorldInstance.AddActor(new AFinishline());
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));
}
void BowsersCastle::SpawnVehicles() {
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
gWorldInstance.AddBombKart(pos, &D_80164550[0][50], 50, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][150], 150, 1, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][200], 200, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][260], 260, 1, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][435], 435, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
}
}
// Likely sets minimap boundaries
void BowsersCastle::MinimapSettings() {
D_8018D2C0[0] = 265;
@@ -212,26 +238,12 @@ void BowsersCastle::WhatDoesThisDoAI(Player* player, int8_t playerId) {
}
}
void BowsersCastle::SpawnBombKarts() {
gWorldInstance.AddObject(std::make_unique<OBombKart>(140, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(165, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(330, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(550, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(595, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
}
// 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::SetStaffGhost() {
}
void BowsersCastle::BeginPlay() { }
void BowsersCastle::Render(struct UnkStruct_800DC5EC* arg0) {
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
@@ -269,13 +281,6 @@ void BowsersCastle::SomeCollisionThing(Player *player, Vec3f arg1, Vec3f arg2, V
func_8003E6EC(player, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
}
void BowsersCastle::GenerateCollision() {
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_bowsers_castle_addr));
func_80295C6C();
find_vtx_and_set_colours(segmented_gfx_to_virtual(reinterpret_cast<void*>(0x07001350)), 0x32, 0, 0, 0);
D_8015F8E4 = -50.0f;
}
void BowsersCastle::Waypoints(Player* player, int8_t playerId) {
s16 waypoint = gNearestWaypointByPlayerId[playerId];
if ((waypoint >= 0x235) && (waypoint < 0x247)) {
@@ -290,4 +295,29 @@ void BowsersCastle::Waypoints(Player* player, int8_t playerId) {
}
}
void BowsersCastle::DrawWater(struct UnkStruct_800DC5EC* screen, uint16_t pathCounter, uint16_t cameraRot, uint16_t playerDirection) {
if (gActiveScreenMode != SCREEN_MODE_1P) {
return;
}
if (pathCounter < 6) {
return;
}
if (pathCounter > 9) {
return;
}
if (pathCounter == 9) {
if (cameraRot < 0xA000) {
return;
}
if (cameraRot > 0xE000) {
return;
}
}
gSPDisplayList(gDisplayListHead++, (Gfx*)d_course_bowsers_castle_dl_9228);
}
void BowsersCastle::CreditsSpawnActors() {
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07001350), 0x32, 0, 0, 0);
}
void BowsersCastle::Destroy() { }
+4 -4
View File
@@ -24,8 +24,10 @@ 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 SpawnActors() override;
virtual void SpawnVehicles() override;
//virtual void InitClouds() override;
virtual void MinimapSettings() override;
virtual void InitCourseObjects() override;
@@ -35,14 +37,12 @@ public:
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 BeginPlay() override;
virtual void Render(struct UnkStruct_800DC5EC*) override;
virtual void RenderCredits() override;
virtual void Collision() override;
virtual void SomeCollisionThing(Player *player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32* arg4, f32* arg5, f32* arg6, f32* arg7) override;
virtual void SpawnBombKarts() override;
virtual void GenerateCollision() override;
virtual void Waypoints(Player*, int8_t) override;
virtual void DrawWater(struct UnkStruct_800DC5EC* screen, uint16_t pathCounter, uint16_t cameraRot, uint16_t playerDirection);
virtual void CreditsSpawnActors() override;
virtual void Destroy() override;
};
+50 -47
View File
@@ -6,8 +6,9 @@
#include "ChocoMountain.h"
#include "GameObject.h"
#include "World.h"
#include "BombKart.h"
#include "engine/vehicles/OBombKart.h"
#include "choco_mountain_data.h"
#include "engine/actors/AFinishline.h"
extern "C" {
#include "main.h"
@@ -102,14 +103,62 @@ ChocoMountain::ChocoMountain() {
Props.Skybox.FloorTopLeft = {255, 255, 255};
}
void ChocoMountain::Load() {
Course::Load();
D_800DC5BC = 1;
D_801625EC = 255;
D_801625F4 = 255;
D_801625F0 = 255;
D_802B87B0 = 0x3E3;
D_802B87B4 = 0x3E8;
D_802B87D4 = 0x71C;
D_802B87D0 = 0xE38;
// Spawn guardrail only for CC_50 and time trials.
if ((gCCSelection != CC_50) && (gModeSelection != TIME_TRIALS)) {
// d_course_choco_mountain_packed_dl_0
nullify_displaylist((uintptr_t) segmented_gfx_to_virtual(reinterpret_cast<void*>(0x07000000)));
// d_course_choco_mountain_packed_dl_98
nullify_displaylist((uintptr_t) segmented_gfx_to_virtual(reinterpret_cast<void*>(0x07000098)));
// d_course_choco_mountain_packed_dl_178
nullify_displaylist((uintptr_t) segmented_gfx_to_virtual(reinterpret_cast<void*>(0x07000178)));
// d_course_choco_mountain_packed_dl_280
nullify_displaylist((uintptr_t) segmented_gfx_to_virtual(reinterpret_cast<void*>(0x07000280)));
// d_course_choco_mountain_packed_dl_340
nullify_displaylist((uintptr_t) segmented_gfx_to_virtual(reinterpret_cast<void*>(0x07000340)));
// d_course_choco_mountain_packed_dl_3C8
nullify_displaylist((uintptr_t) segmented_gfx_to_virtual(reinterpret_cast<void*>(0x070003C8)));
}
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_choco_mountain_addr));
func_802B5CAC(0x238E, 0x31C7, D_8015F590);
func_80295C6C();
D_8015F8E4 = -80.0f;
}
void ChocoMountain::LoadTextures() {
}
void ChocoMountain::SpawnActors() {
gWorldInstance.AddActor(new AFinishline());
spawn_all_item_boxes((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_choco_mountain_item_box_spawns));
spawn_falling_rocks((struct ActorSpawnData*)LOAD_ASSET_RAW((const char*)d_course_choco_mountain_falling_rock_spawns));
}
void ChocoMountain::SpawnVehicles() {
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
gWorldInstance.AddBombKart(pos, &D_80164550[0][140], 140, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][165], 165, 1, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][330], 330, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][550], 550, 1, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][595], 595, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
}
}
// Likely sets minimap boundaries
void ChocoMountain::MinimapSettings() {
D_8018D2A0 = 0.022f;
@@ -165,26 +214,12 @@ void ChocoMountain::WhatDoesThisDoAI(Player* player, int8_t playerId) {
}
}
void ChocoMountain::SpawnBombKarts() {
gWorldInstance.AddObject(std::make_unique<OBombKart>(140, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(165, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(330, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(550, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(595, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
}
// 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::SetStaffGhost() {
}
void ChocoMountain::BeginPlay() { }
void ChocoMountain::Render(struct UnkStruct_800DC5EC* arg0) {
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
@@ -242,36 +277,4 @@ void ChocoMountain::SomeCollisionThing(Player *player, Vec3f arg1, Vec3f arg2, V
func_8003E37C(player, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
}
void ChocoMountain::GenerateCollision() {
D_800DC5BC = 1;
D_801625EC = 255;
D_801625F4 = 255;
D_801625F0 = 255;
D_802B87B0 = 0x3E3;
D_802B87B4 = 0x3E8;
D_802B87D4 = 0x71C;
D_802B87D0 = 0xE38;
// Spawn guardrail only for CC_50 and time trials.
if ((gCCSelection != CC_50) && (gModeSelection != TIME_TRIALS)) {
// d_course_choco_mountain_packed_dl_0
nullify_displaylist((uintptr_t) segmented_gfx_to_virtual(reinterpret_cast<void*>(0x07000000)));
// d_course_choco_mountain_packed_dl_98
nullify_displaylist((uintptr_t) segmented_gfx_to_virtual(reinterpret_cast<void*>(0x07000098)));
// d_course_choco_mountain_packed_dl_178
nullify_displaylist((uintptr_t) segmented_gfx_to_virtual(reinterpret_cast<void*>(0x07000178)));
// d_course_choco_mountain_packed_dl_280
nullify_displaylist((uintptr_t) segmented_gfx_to_virtual(reinterpret_cast<void*>(0x07000280)));
// d_course_choco_mountain_packed_dl_340
nullify_displaylist((uintptr_t) segmented_gfx_to_virtual(reinterpret_cast<void*>(0x07000340)));
// d_course_choco_mountain_packed_dl_3C8
nullify_displaylist((uintptr_t) segmented_gfx_to_virtual(reinterpret_cast<void*>(0x070003C8)));
}
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_choco_mountain_addr));
func_802B5CAC(0x238E, 0x31C7, D_8015F590);
func_80295C6C();
D_8015F8E4 = -80.0f;
}
void ChocoMountain::Destroy() { }
+2 -5
View File
@@ -24,22 +24,19 @@ 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 SpawnActors() override;
//virtual void InitClouds() override;
virtual void SpawnVehicles() 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 BeginPlay() override;
virtual void Render(struct UnkStruct_800DC5EC*) override;
virtual void RenderCredits() override;
virtual void Collision() override;
virtual void SomeCollisionThing(Player *player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32* arg4, f32* arg5, f32* arg6, f32* arg7) override;
virtual void SpawnBombKarts() override;
virtual void GenerateCollision() override;
virtual void Destroy() override;
};
+29 -8
View File
@@ -17,6 +17,8 @@ extern "C" {
#include "save.h"
#include "staff_ghosts.h"
#include "Engine.h"
#include "code_800029B0.h"
#include "render_courses.h"
extern StaffGhost* d_mario_raceway_staff_ghost;
}
@@ -76,6 +78,8 @@ Course::Course() {
void Course::Load(Vtx* vtx, Gfx* gfx) {
gSegmentTable[4] = reinterpret_cast<uintptr_t>(&vtx[0]);
gSegmentTable[7] = reinterpret_cast<uintptr_t>(&gfx[0]);
Course::Init();
}
void Course::Load() {
@@ -86,7 +90,6 @@ void Course::Load() {
// Convert course vtx to vtx
Vtx* vtx = reinterpret_cast<Vtx*>(allocate_memory(vtxSize));
gSegmentTable[4] = reinterpret_cast<uintptr_t>(&vtx[0]);
printf("\nVtxsize: 0x%X\n\n",vtxSize);
func_802A86A8(reinterpret_cast<CourseVtx*>(LOAD_ASSET_RAW(this->vtx)), vtx, vtxSize / sizeof(Vtx));
// Load and allocate memory for course textures
@@ -117,6 +120,28 @@ void Course::Load() {
assert(gfx != NULL);
gSegmentTable[7] = reinterpret_cast<uintptr_t>(&gfx[0]);
displaylist_unpack(reinterpret_cast<uintptr_t *>(gfx), reinterpret_cast<uintptr_t>(packed), 0);
Course::Init();
}
void Course::Init() {
gNumActors = 0;
gCourseMinX = 0;
gCourseMinY = 0;
gCourseMinZ = 0;
gCourseMaxX = 0;
gCourseMaxY = 0;
gCourseMaxZ = 0;
D_8015F59C = 0;
D_8015F5A0 = 0;
func_80295D6C();
D_8015F58C = 0;
gCollisionMeshCount = 0;
gCollisionMesh = (CollisionTriangle*) gNextFreeMemoryAddress;
D_800DC5BC = 0;
D_800DC5C8 = 0;
}
void Course::LoadTextures() { }
@@ -172,7 +197,7 @@ void Course::SomeSounds() {
}
void Course::SetCourseVtxColours() {
void Course::CreditsSpawnActors() {
}
@@ -195,9 +220,6 @@ void Course::SetStaffGhost() {
D_80162DF4 = 1;
}
void Course::SpawnBombKarts() {
}
void Course::Waypoints(Player* player, int8_t playerId) {
player->nearestWaypointId = gNearestWaypointByPlayerId[playerId];
if (player->nearestWaypointId < 0) {
@@ -208,12 +230,11 @@ void Course::Waypoints(Player* player, int8_t playerId) {
void Course::SpawnVehicles() {}
void Course::UpdateVehicles() {}
void Course::BeginPlay() {}
void Course::Render(struct UnkStruct_800DC5EC* arg0) {}
void Course::RenderCredits() {}
void Course::Collision() {}
void Course::GenerateCollision() {}
void Course::Water() {}
void Course::ScrollingTextures() {}
void Course::DrawWater(struct UnkStruct_800DC5EC* screen, uint16_t pathCounter, uint16_t cameraRot, uint16_t playerDirection) {}
void Course::Destroy() { }
+5 -5
View File
@@ -100,22 +100,22 @@ public:
virtual void UpdateCourseObjects();
virtual void RenderCourseObjects(s32 cameraId);
virtual void SomeSounds();
virtual void SetCourseVtxColours();
virtual void CreditsSpawnActors();
virtual void WhatDoesThisDo(Player*, int8_t);
virtual void WhatDoesThisDoAI(Player*, int8_t);
virtual void MinimapFinishlinePosition();
virtual void SetStaffGhost();
virtual void SpawnBombKarts();
virtual void BeginPlay();
virtual void Render(struct UnkStruct_800DC5EC*);
virtual void RenderCredits();
virtual void SpawnVehicles();
virtual void UpdateVehicles();
virtual void Waypoints(Player* player, int8_t playerId);
virtual void Collision();
virtual void GenerateCollision();
virtual void Water();
virtual void ScrollingTextures();
virtual void DrawWater(struct UnkStruct_800DC5EC* screen, uint16_t pathCounter, uint16_t cameraRot, uint16_t playerDirection);
virtual void Destroy();
private:
void Init();
};
#endif
+212 -22
View File
@@ -6,7 +6,8 @@
#include "DKJungle.h"
#include "GameObject.h"
#include "World.h"
#include "BombKart.h"
#include "engine/actors/AFinishline.h"
#include "engine/vehicles/OBombKart.h"
#include "assets/dks_jungle_parkway_data.h"
#include "engine/vehicles/Utils.h"
@@ -105,6 +106,16 @@ DKJungle::DKJungle() {
Props.Skybox.FloorTopLeft = {22, 145, 22};
}
void DKJungle::Load() {
Course::Load();
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_dks_jungle_parkway_addr));
func_80295C6C();
D_8015F8E4 = -475.0f;
// d_course_dks_jungle_parkway_packed_dl_3FA8
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07003FA8), 120, 255, 255, 255);
}
void DKJungle::LoadTextures() {
dma_textures(gTextureDksJungleParkwayKiwanoFruit1, 0x0000032FU, 0x00000400U);
dma_textures(gTextureDksJungleParkwayKiwanoFruit2, 0x00000369U, 0x00000400U);
@@ -112,6 +123,8 @@ void DKJungle::LoadTextures() {
}
void DKJungle::SpawnActors() {
gWorldInstance.AddActor(new AFinishline());
spawn_all_item_boxes((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_dks_jungle_parkway_item_box_spawns));
init_kiwano_fruit();
func_80298D10();
@@ -193,25 +206,12 @@ void DKJungle::WhatDoesThisDoAI(Player* player, int8_t playerId) {
}
}
void DKJungle::SpawnBombKarts() {
gWorldInstance.AddObject(std::make_unique<OBombKart>(40, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(100, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(265, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(285, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(420, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
}
// 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::SetStaffGhost() {}
void DKJungle::BeginPlay() { }
void DKJungle::Render(struct UnkStruct_800DC5EC* arg0) {
func_802B5D64(D_800DC610, D_802B87D4, 0, 1);
func_802B5D64(&D_800DC610[1], D_802B87D4, D_802B87D0, 1);
@@ -248,15 +248,21 @@ void DKJungle::SomeCollisionThing(Player *player, Vec3f arg1, Vec3f arg2, Vec3f
void DKJungle::SpawnVehicles() {
generate_ferry_waypoints();
gWorldInstance.AddBoat(1.6666666f, 0);
}
// The original game only ran vehicle logic every second frame.
// Thus the speed gets divided by two to set speed to match properly
gWorldInstance.AddBoat((0.6666666f)/4, 0);
void DKJungle::GenerateCollision() {
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_dks_jungle_parkway_addr));
func_80295C6C();
D_8015F8E4 = -475.0f;
// d_course_dks_jungle_parkway_packed_dl_3FA8
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07003FA8), 120, 255, 255, 255);
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
gWorldInstance.AddBombKart(pos, &D_80164550[0][50], 50, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][100], 100, 1, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][150], 150, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][190], 190, 1, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][250], 250, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
}
}
void DKJungle::Waypoints(Player* player, int8_t playerId) {
@@ -271,4 +277,188 @@ void DKJungle::Waypoints(Player* player, int8_t playerId) {
}
}
void DKJungle::ScrollingTextures() {
D_802B87BC += 2;
if (D_802B87BC > 255) {
D_802B87BC = 0;
}
// d_course_dks_jungle_parkway_packed_dl_3DD0
find_and_set_tile_size((uintptr_t) segmented_gfx_to_virtual((void*)0x07003DD0), 0, D_802B87BC);
// d_course_dks_jungle_parkway_packed_dl_3E40
find_and_set_tile_size((uintptr_t) segmented_gfx_to_virtual((void*)0x07003E40), 0, D_802B87BC);
// d_course_dks_jungle_parkway_packed_dl_3EB0
find_and_set_tile_size((uintptr_t) segmented_gfx_to_virtual((void*)0x07003EB0), 0, D_802B87BC);
// d_course_dks_jungle_parkway_packed_dl_3F30
find_and_set_tile_size((uintptr_t) segmented_gfx_to_virtual((void*)0x07003F30), 0, D_802B87BC);
// d_course_dks_jungle_parkway_packed_dl_36A8
find_and_set_tile_size((uintptr_t) segmented_gfx_to_virtual((void*)0x070036A8), 0, D_802B87BC);
D_802B87C4 -= 20;
if (D_802B87C4 < 0) {
D_802B87C4 = 0xFF;
}
// d_course_dks_jungle_parkway_packed_dl_9880
find_and_set_tile_size((uintptr_t) segmented_gfx_to_virtual((void*)0x07009880), 0, D_802B87C4);
evaluate_collision_players_palm_trees();
}
void DKJungle::DrawWater(struct UnkStruct_800DC5EC* screen, uint16_t pathCounter, uint16_t cameraRot, uint16_t playerDirection) {
Mat4 matrix;
gDPPipeSync(gDisplayListHead++);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
gDPSetBlendMask(gDisplayListHead++, 0xFF);
gDPSetTextureFilter(gDisplayListHead++, G_TF_BILERP);
gDPSetTexturePersp(gDisplayListHead++, G_TP_PERSP);
mtxf_identity(matrix);
render_set_position(matrix, 0);
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIA, G_CC_MODULATEIA);
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_XLU_INTER, G_RM_NOOP2);
if (pathCounter < 17) {
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIA, G_CC_MODULATEIA);
// d_course_dks_jungle_parkway_packed_dl_3E40
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07003E40));
// d_course_dks_jungle_parkway_packed_dl_3EB0
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07003EB0));
if ((pathCounter >= 6) && (pathCounter < 13)) {
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIA, G_CC_MODULATEIA);
// d_course_dks_jungle_parkway_packed_dl_3DD0
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07003DD0));
}
} else if ((pathCounter == 21) || (pathCounter == 22)) {
if (playerDirection == 3) {
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA);
// d_course_dks_jungle_parkway_packed_dl_36A8
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x070036A8));
}
if ((playerDirection == 1) || (playerDirection == 0)) {
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA);
// d_course_dks_jungle_parkway_packed_dl_36A8
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x070036A8));
} else {
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIA, G_CC_MODULATEIA);
// d_course_dks_jungle_parkway_packed_dl_3F30
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07003F30));
// d_course_dks_jungle_parkway_packed_dl_36A8
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x070036A8));
}
} else if (pathCounter == 24) {
if ((playerDirection == 0) || (playerDirection == 3)) {
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA);
// d_course_dks_jungle_parkway_packed_dl_36A8
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x070036A8));
}
} else if (pathCounter == 23) {
if (playerDirection == 3) {
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA);
// d_course_dks_jungle_parkway_packed_dl_36A8
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x070036A8));
} else if (playerDirection == 0) {
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA);
// d_course_dks_jungle_parkway_packed_dl_36A8
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x070036A8));
}
}
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIA, G_CC_MODULATEIA);
switch (pathCounter) {
case 5:
if (playerDirection != 3) {
// d_course_dks_jungle_parkway_packed_dl_3DD0
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07003DD0));
}
break;
case 17:
switch (playerDirection) {
case 0:
// d_course_dks_jungle_parkway_packed_dl_3E40
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07003E40));
// d_course_dks_jungle_parkway_packed_dl_3EB0
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07003EB0));
break;
case 1:
// d_course_dks_jungle_parkway_packed_dl_3DD0
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07003DD0));
// d_course_dks_jungle_parkway_packed_dl_3E40
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07003E40));
// d_course_dks_jungle_parkway_packed_dl_3EB0
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07003EB0));
break;
case 2:
// d_course_dks_jungle_parkway_packed_dl_
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07003E40));
// d_course_dks_jungle_parkway_packed_dl_3EB0
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07003EB0));
// d_course_dks_jungle_parkway_packed_dl_3F30
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07003F30));
break;
case 3:
// d_course_dks_jungle_parkway_packed_dl_3EB0
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07003EB0));
// d_course_dks_jungle_parkway_packed_dl_3F30
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07003F30));
break;
}
break;
case 18:
switch (playerDirection) {
case 0:
// d_course_dks_jungle_parkway_packed_dl_3E40
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07003E40));
// d_course_dks_jungle_parkway_packed_dl_3EB0
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07003EB0));
break;
case 1:
// d_course_dks_jungle_parkway_packed_dl_3DD0
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07003DD0));
// d_course_dks_jungle_parkway_packed_dl_3E40
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07003E40));
// d_course_dks_jungle_parkway_packed_dl_3EB0
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07003EB0));
break;
case 2:
// d_course_dks_jungle_parkway_packed_dl_3E40
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07003E40));
// d_course_dks_jungle_parkway_packed_dl_3EB0
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07003EB0));
break;
}
break;
case 21:
if ((playerDirection == 0) || (playerDirection == 1)) {
// d_course_dks_jungle_parkway_packed_dl_3E40
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07003E40));
// d_course_dks_jungle_parkway_packed_dl_3EB0
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07003EB0));
// d_course_dks_jungle_parkway_packed_dl_3F30
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07003F30));
} else {
// d_course_dks_jungle_parkway_packed_dl_3EB0
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07003EB0));
}
break;
case 22:
if (playerDirection == 0) {
// d_course_dks_jungle_parkway_packed_dl_3F30
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07003F30));
}
break;
case 23:
if (playerDirection != 1) {
// d_course_dks_jungle_parkway_packed_dl_3F30
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07003F30));
}
break;
}
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 1, 1, G_OFF);
gDPSetAlphaCompare(gDisplayListHead++, G_AC_NONE);
gDPPipeSync(gDisplayListHead++);
}
void DKJungle::CreditsSpawnActors() {
// d_course_dks_jungle_parkway_packed_dl_3FA8
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07003FA8), 0x78, 0xFF, 0xFF, 0xFF);
}
void DKJungle::Destroy() { }
+4 -4
View File
@@ -24,6 +24,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 SpawnActors() override;
//virtual void InitClouds() override;
@@ -35,15 +36,14 @@ public:
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 BeginPlay() override;
virtual void Render(struct UnkStruct_800DC5EC*) override;
virtual void RenderCredits() override;
virtual void SpawnVehicles() override;
virtual void Collision() override;
virtual void SomeCollisionThing(Player *player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32* arg4, f32* arg5, f32* arg6, f32* arg7) override;
virtual void SpawnBombKarts() override;
virtual void GenerateCollision() override;
virtual void Waypoints(Player* player, int8_t playerId) override;
virtual void ScrollingTextures() 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;
};
+26 -13
View File
@@ -6,7 +6,7 @@
#include "DoubleDeck.h"
#include "GameObject.h"
#include "World.h"
#include "BombKart.h"
#include "engine/vehicles/OBombKart.h"
#include "assets/double_deck_data.h"
extern "C" {
@@ -101,10 +101,34 @@ DoubleDeck::DoubleDeck() {
Props.Skybox.FloorTopLeft = {255, 224, 240};
}
void DoubleDeck::Load() {
Course::Load();
generate_collision_mesh_with_default_section_id((Gfx*) segmented_gfx_to_virtual((void*)0x07000738), 1);
func_80295C6C();
D_8015F8E4 = gCourseMinY - 10.0f;
}
void DoubleDeck::LoadTextures() {
}
void DoubleDeck::SpawnActors() {}
void DoubleDeck::SpawnActors() {
spawn_all_item_boxes((ActorSpawnData*)LOAD_ASSET_RAW(d_course_double_deck_item_box_spawns));
}
void DoubleDeck::SpawnVehicles() {
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
gWorldInstance.AddBombKart(pos, &D_80164550[0][20], 20, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][40], 40, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][60], 60, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][80], 80, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][100], 100, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][120], 120, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][140], 140, 0, 1.0f);
}
}
// Likely sets minimap boundaries
void DoubleDeck::MinimapSettings() {
@@ -121,17 +145,12 @@ void DoubleDeck::WhatDoesThisDo(Player* player, int8_t playerId) {}
void DoubleDeck::WhatDoesThisDoAI(Player* player, int8_t playerId) {}
void DoubleDeck::SpawnBombKarts() {}
// 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::SetStaffGhost() {}
void DoubleDeck::BeginPlay() { }
void DoubleDeck::Render(struct UnkStruct_800DC5EC* arg0) {
func_802B5D64(D_800DC610, D_802B87D4, 0, 1);
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
@@ -147,12 +166,6 @@ void DoubleDeck::RenderCredits() {}
void DoubleDeck::Collision() {}
void DoubleDeck::GenerateCollision() {
generate_collision_mesh_with_default_section_id((Gfx*) segmented_gfx_to_virtual((void*)0x07000738), 1);
func_80295C6C();
D_8015F8E4 = gCourseMinY - 10.0f;
}
void DoubleDeck::Waypoints(Player* player, int8_t playerId) {
player->nearestWaypointId = 0;
}
+2 -4
View File
@@ -24,8 +24,10 @@ 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 SpawnActors() override;
virtual void SpawnVehicles() override;
//virtual void InitClouds() override;
virtual void MinimapSettings() override;
virtual void InitCourseObjects() override;
@@ -33,13 +35,9 @@ public:
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 BeginPlay() override;
virtual void Render(struct UnkStruct_800DC5EC*) override;
virtual void RenderCredits() override;
virtual void Collision() override;
virtual void SpawnBombKarts() override;
virtual void GenerateCollision() override;
virtual void Waypoints(Player* player, int8_t playerId) override;
virtual void Destroy() override;
};
+27 -23
View File
@@ -6,7 +6,8 @@
#include "FrappeSnowland.h"
#include "GameObject.h"
#include "World.h"
#include "BombKart.h"
#include "engine/actors/AFinishline.h"
#include "engine/vehicles/OBombKart.h"
#include "assets/frappe_snowland_data.h"
#include "assets/boo_frames.h"
@@ -103,16 +104,40 @@ FrappeSnowland::FrappeSnowland() {
Props.Skybox.FloorTopLeft = {0, 99, 164};
}
void FrappeSnowland::Load() {
Course::Load();
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_frappe_snowland_addr));
func_80295C6C();
D_8015F8E4 = -50.0f;
}
void FrappeSnowland::LoadTextures() {
dma_textures(gTextureFrappeSnowlandTreeLeft, 0x00000454U, 0x00000800U);
dma_textures(gTextureFrappeSnowlandTreeRight, 0x00000432U, 0x00000800U);
}
void FrappeSnowland::SpawnActors() {
gWorldInstance.AddActor(new AFinishline());
spawn_foliage((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_frappe_snowland_tree_spawns));
spawn_all_item_boxes((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_frappe_snowland_item_box_spawns));
}
void FrappeSnowland::SpawnVehicles() {
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
gWorldInstance.AddBombKart(pos, &D_80164550[0][50], 50, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][100], 100, 1, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][150], 150, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][290], 290, 1, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][350], 350, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
}
}
void FrappeSnowland::InitClouds() {
s32 var_s0;
s32 var_s4;
@@ -187,27 +212,12 @@ void FrappeSnowland::WhatDoesThisDo(Player* player, int8_t playerId) {}
void FrappeSnowland::WhatDoesThisDoAI(Player* player, int8_t playerId) {}
void FrappeSnowland::SpawnBombKarts() {
gWorldInstance.AddObject(std::make_unique<OBombKart>(140, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(165, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(330, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(550, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(595, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
}
// 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::SetStaffGhost() {
}
void FrappeSnowland::BeginPlay() { }
void FrappeSnowland::Render(struct UnkStruct_800DC5EC* arg0) {
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
@@ -231,12 +241,6 @@ void FrappeSnowland::RenderCredits() {
void FrappeSnowland::Collision() {}
void FrappeSnowland::GenerateCollision() {
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_frappe_snowland_addr));
func_80295C6C();
D_8015F8E4 = -50.0f;
}
void FrappeSnowland::Waypoints(Player* player, int8_t playerId) {
s16 waypoint = gNearestWaypointByPlayerId[playerId];
@@ -250,6 +254,6 @@ void FrappeSnowland::Waypoints(Player* player, int8_t playerId) {
}
}
void FrappeSnowland::Water() {}
void FrappeSnowland::ScrollingTextures() {}
void FrappeSnowland::Destroy() {}
+3 -5
View File
@@ -24,8 +24,10 @@ 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 SpawnActors() override;
virtual void SpawnVehicles() override;
virtual void InitClouds() override;
virtual void UpdateClouds(s32 sp1C, Camera* camera) override;
virtual void MinimapSettings() override;
@@ -36,14 +38,10 @@ public:
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 BeginPlay() override;
virtual void Render(struct UnkStruct_800DC5EC*) override;
virtual void RenderCredits() override;
virtual void Collision() override;
virtual void SpawnBombKarts() override;
virtual void GenerateCollision() override;
virtual void Water() override;
virtual void ScrollingTextures() override;
virtual void Waypoints(Player* player, int8_t playerId) override;
virtual void Destroy() override;
};
+33 -29
View File
@@ -6,7 +6,8 @@
#include "KalimariDesert.h"
#include "GameObject.h"
#include "World.h"
#include "BombKart.h"
#include "engine/actors/AFinishline.h"
#include "engine/vehicles/OBombKart.h"
#include "kalimari_desert_data.h"
#include "engine/vehicles/Utils.h"
@@ -103,6 +104,14 @@ KalimariDesert::KalimariDesert() {
Props.Skybox.FloorTopLeft = {255, 192, 0};
}
void KalimariDesert::Load() {
Course::Load();
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_kalimari_desert_addr));
func_80295C6C();
D_8015F8E4 = gCourseMinY - 10.0f;
}
void KalimariDesert::LoadTextures() {
dma_textures(gTextureCactus1Left, 0x0000033EU, 0x00000800U);
dma_textures(gTextureCactus1Right, 0x000002FBU, 0x00000800U);
@@ -117,6 +126,8 @@ void KalimariDesert::SpawnActors() {
Vec3f velocity = { 0.0f, 0.0f, 0.0f };
Vec3s rotation = { 0, 0, 0 };
gWorldInstance.AddActor(new AFinishline());
spawn_foliage((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_kalimari_desert_cactus_spawn));
spawn_all_item_boxes((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_kalimari_desert_item_box_spawns));
@@ -127,24 +138,24 @@ void KalimariDesert::SpawnActors() {
vec3f_set(position, -1680.0f, 2.0f, 35.0f);
position[0] *= gCourseDirection;
rrxing = (struct RailroadCrossing*) &gActorList[add_actor_to_empty_slot(position, rotation, velocity,
ACTOR_RAILROAD_CROSSING)];
rrxing = (struct RailroadCrossing*) GET_ACTOR(add_actor_to_empty_slot(position, rotation, velocity,
ACTOR_RAILROAD_CROSSING));
rrxing->crossingTrigger = crossing2;
vec3f_set(position, -1600.0f, 2.0f, 35.0f);
position[0] *= gCourseDirection;
rrxing = (struct RailroadCrossing*) &gActorList[add_actor_to_empty_slot(position, rotation, velocity,
ACTOR_RAILROAD_CROSSING)];
rrxing = (struct RailroadCrossing*) GET_ACTOR(add_actor_to_empty_slot(position, rotation, velocity,
ACTOR_RAILROAD_CROSSING));
rrxing->crossingTrigger = crossing2;
vec3s_set(rotation, 0, -0x2000, 0);
vec3f_set(position, -2459.0f, 2.0f, 2263.0f);
position[0] *= gCourseDirection;
rrxing = (struct RailroadCrossing*) &gActorList[add_actor_to_empty_slot(position, rotation, velocity,
ACTOR_RAILROAD_CROSSING)];
rrxing = (struct RailroadCrossing*) GET_ACTOR(add_actor_to_empty_slot(position, rotation, velocity,
ACTOR_RAILROAD_CROSSING));
rrxing->crossingTrigger = crossing1;
vec3f_set(position, -2467.0f, 2.0f, 2375.0f);
position[0] *= gCourseDirection;
rrxing = (struct RailroadCrossing*) &gActorList[add_actor_to_empty_slot(position, rotation, velocity,
ACTOR_RAILROAD_CROSSING)];
rrxing = (struct RailroadCrossing*) GET_ACTOR(add_actor_to_empty_slot(position, rotation, velocity,
ACTOR_RAILROAD_CROSSING));
rrxing->crossingTrigger = crossing1;
}
@@ -181,24 +192,12 @@ void KalimariDesert::WhatDoesThisDo(Player* player, int8_t playerId) {}
void KalimariDesert::WhatDoesThisDoAI(Player* player, int8_t playerId) {}
void KalimariDesert::SpawnBombKarts() {
gWorldInstance.AddObject(std::make_unique<OBombKart>(140, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(165, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(330, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(550, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(595, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
}
// 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::SetStaffGhost() {}
void KalimariDesert::SpawnVehicles() {
generate_train_waypoints();
@@ -209,11 +208,22 @@ void KalimariDesert::SpawnVehicles() {
for (size_t i = 0; i < numTrains; ++i) {
uint32_t waypoint = CalculateWaypointDistribution(i, numTrains, gVehicle2DWaypointLength, centerWaypoint);
gWorldInstance.AddTrain(5, 5.0f, waypoint);
gWorldInstance.AddTrain(5, 2.5f, waypoint);
}
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
gWorldInstance.AddBombKart(pos, &D_80164550[0][50], 50, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][138], 138, 1, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][280], 280, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][404], 404, 1, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][510], 510, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
}
}
void KalimariDesert::BeginPlay() { }
void KalimariDesert::Render(struct UnkStruct_800DC5EC* arg0) {
func_802B5D64(D_800DC610, D_802B87D4, 0, 1);
@@ -253,10 +263,4 @@ void KalimariDesert::RenderCredits() {
void KalimariDesert::Collision() {}
void KalimariDesert::GenerateCollision() {
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_kalimari_desert_addr));
func_80295C6C();
D_8015F8E4 = gCourseMinY - 10.0f;
}
void KalimariDesert::Destroy() { }
+1 -4
View File
@@ -24,6 +24,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 SpawnActors() override;
virtual void MinimapSettings() override;
@@ -32,13 +33,9 @@ public:
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 BeginPlay() override;
virtual void Render(struct UnkStruct_800DC5EC*) override;
virtual void RenderCredits() override;
virtual void SpawnVehicles() override;
virtual void Collision() override;
virtual void SpawnBombKarts() override;
virtual void GenerateCollision() override;
virtual void Destroy() override;
};
+71 -26
View File
@@ -6,7 +6,8 @@
#include "KoopaTroopaBeach.h"
#include "GameObject.h"
#include "World.h"
#include "BombKart.h"
#include "engine/actors/AFinishline.h"
#include "engine/vehicles/OBombKart.h"
#include "assets/koopa_troopa_beach_data.h"
extern "C" {
@@ -103,15 +104,42 @@ KoopaTroopaBeach::KoopaTroopaBeach() {
Props.Skybox.FloorTopLeft = {48, 152, 120};
}
void KoopaTroopaBeach::Load() {
Course::Load();
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_koopa_troopa_beach_addr));
func_80295C6C();
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x0700ADE0), -0x6A, 255, 255, 255);
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x0700A540), -0x6A, 255, 255, 255);
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07009E70), -0x6A, 255, 255, 255);
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07000358), -0x6A, 255, 255, 255);
}
void KoopaTroopaBeach::LoadTextures() {
}
void KoopaTroopaBeach::SpawnActors() {
gWorldInstance.AddActor(new AFinishline());
init_actor_hot_air_balloon_item_box(328.0f * gCourseDirection, 70.0f, 2541.0f);
spawn_all_item_boxes((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_koopa_troopa_beach_item_box_spawns));
spawn_palm_trees((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_koopa_troopa_beach_tree_spawn));
}
void KoopaTroopaBeach::SpawnVehicles() {
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
gWorldInstance.AddBombKart(pos, &D_80164550[0][60], 60, 1, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][120], 120, 1, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][200], 200, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][280], 280, 1, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][435], 435, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
}
}
// Likely sets minimap boundaries
void KoopaTroopaBeach::MinimapSettings() {
D_8018D220 = reinterpret_cast<uint8_t (*)[1024]>(dma_textures(gTextureExhaust3, 0x3C8U, 0x1000));
@@ -180,27 +208,12 @@ void KoopaTroopaBeach::WhatDoesThisDo(Player* player, int8_t playerId) {}
void KoopaTroopaBeach::WhatDoesThisDoAI(Player* player, int8_t playerId) {}
void KoopaTroopaBeach::SpawnBombKarts() {
gWorldInstance.AddObject(std::make_unique<OBombKart>(140, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(165, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(330, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(550, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(595, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
}
// 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::SetStaffGhost() {
}
void KoopaTroopaBeach::BeginPlay() { }
void KoopaTroopaBeach::Render(struct UnkStruct_800DC5EC* arg0) {
gDPPipeSync(gDisplayListHead++);
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
@@ -237,16 +250,7 @@ void KoopaTroopaBeach::SomeCollisionThing(Player *player, Vec3f arg1, Vec3f arg2
func_8003E37C(player, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
}
void KoopaTroopaBeach::GenerateCollision() {
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_koopa_troopa_beach_addr));
func_80295C6C();
find_vtx_and_set_colours(segmented_gfx_to_virtual(reinterpret_cast<void*>(0x0700ADE0)), -0x6A, 255, 255, 255);
find_vtx_and_set_colours(segmented_gfx_to_virtual(reinterpret_cast<void*>(0x0700A540)), -0x6A, 255, 255, 255);
find_vtx_and_set_colours(segmented_gfx_to_virtual(reinterpret_cast<void*>(0x07009E70)), -0x6A, 255, 255, 255);
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07000358), -0x6A, 255, 255, 255);
}
void KoopaTroopaBeach::Water() {
void KoopaTroopaBeach::ScrollingTextures() {
// clang-format off
if (D_8015F8E8 < 0.0f) {
if (D_8015F8E4 < -20.0f) { D_8015F8E8 *= -1.0f; }
@@ -281,4 +285,45 @@ void KoopaTroopaBeach::Water() {
}
void KoopaTroopaBeach::DrawWater(struct UnkStruct_800DC5EC* screen, uint16_t pathCounter, uint16_t cameraRot, uint16_t playerDirection) {
Mat4 matrix;
Vec3f vector;
gDPPipeSync(gDisplayListHead++);
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_XLU_INTER, G_RM_NOOP2);
gDPSetBlendMask(gDisplayListHead++, 0xFF);
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIA, G_CC_MODULATEIA);
switch (pathCounter) {
case 22:
case 23:
case 29:
case 30:
case 31:
case 37:
gSPClearGeometryMode(gDisplayListHead++, G_CULL_BACK);
// d_course_koopa_troopa_beach_packed_dl_9E70
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07009E70));
gSPSetGeometryMode(gDisplayListHead++, G_CULL_BACK);
break;
}
vector[0] = 0.0f;
vector[1] = D_8015F8E4;
vector[2] = 0.0f;
mtxf_translate(matrix, vector);
render_set_position(matrix, 0);
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_XLU_INTER, G_RM_NOOP2);
gDPSetBlendMask(gDisplayListHead++, 0xFF);
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIA, G_CC_MODULATEIA);
gSPClearGeometryMode(gDisplayListHead++, G_CULL_BACK);
render_course_segments((const char**)koopa_troopa_beach_dls2, screen);
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 1, 1, G_OFF);
gSPSetGeometryMode(gDisplayListHead++, G_CULL_BACK);
gDPSetAlphaCompare(gDisplayListHead++, G_AC_NONE);
gDPPipeSync(gDisplayListHead++);
}
void KoopaTroopaBeach::Destroy() {}
+4 -5
View File
@@ -24,8 +24,10 @@ 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 SpawnActors() override;
virtual void SpawnVehicles() override;
virtual void MinimapSettings() override;
virtual void InitCourseObjects() override;
virtual void UpdateCourseObjects() override;
@@ -34,14 +36,11 @@ public:
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 BeginPlay() override;
virtual void Render(struct UnkStruct_800DC5EC*) override;
virtual void RenderCredits() override;
virtual void Collision() override;
virtual void SomeCollisionThing(Player *player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32* arg4, f32* arg5, f32* arg6, f32* arg7) override;
virtual void SpawnBombKarts() override;
virtual void GenerateCollision() override;
virtual void Water() override;
virtual void ScrollingTextures() override;
virtual void DrawWater(struct UnkStruct_800DC5EC* screen, uint16_t pathCounter, uint16_t cameraRot, uint16_t playerDirection) override;
virtual void Destroy() override;
};
+29 -22
View File
@@ -6,8 +6,9 @@
#include "LuigiRaceway.h"
#include "GameObject.h"
#include "World.h"
#include "BombKart.h"
#include "engine/vehicles/OBombKart.h"
#include "assets/luigi_raceway_data.h"
#include "engine/actors/AFinishline.h"
extern "C" {
#include "main.h"
@@ -30,6 +31,8 @@ extern "C" {
#include "collision.h"
#include "code_8003DC40.h"
#include "memory.h"
#include "courses/staff_ghost_data.h"
#include "framebuffer_effects.h"
extern const char *luigi_raceway_dls[];
extern s16 currentScreenSection;
}
@@ -103,16 +106,39 @@ LuigiRaceway::LuigiRaceway() {
Props.Skybox.FloorTopLeft = {216, 232, 248};
}
void LuigiRaceway::Load() {
Course::Load();
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_luigi_raceway_addr));
func_80295C6C();
D_8015F8E4 = gCourseMinY - 10.0f;
}
void LuigiRaceway::LoadTextures() {
dma_textures(gTextureTrees5Left, 0x000003E8U, 0x00000800U);
dma_textures(gTextureTrees5Right, 0x000003E8U, 0x00000800U);
}
void LuigiRaceway::SpawnActors() {
gWorldInstance.AddActor(new AFinishline());
spawn_foliage((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_luigi_raceway_tree_spawn));
spawn_all_item_boxes((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_luigi_raceway_item_box_spawns));
}
void LuigiRaceway::SpawnVehicles() {
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
gWorldInstance.AddBombKart(pos, &D_80164550[0][50], 50, 1, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][200], 200, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][305], 305, 1, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][440], 440, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][515], 515, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
}
}
// Likely sets minimap boundaries
void LuigiRaceway::MinimapSettings() {
D_8018D220 = reinterpret_cast<uint8_t (*)[1024]>(dma_textures(gTextureExhaust2, 0x4F4U, 0xC00));
@@ -187,16 +213,6 @@ void LuigiRaceway::WhatDoesThisDoAI(Player* player, int8_t playerId) {
}
}
void LuigiRaceway::SpawnBombKarts() {
gWorldInstance.AddObject(std::make_unique<OBombKart>(40, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(100, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(265, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(285, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(420, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
}
// Positions the finishline on the minimap
void LuigiRaceway::MinimapFinishlinePosition() {
//! todo: Place hard-coded values here.
@@ -216,8 +232,6 @@ void LuigiRaceway::SetStaffGhost() {
D_80162DE4 = 1;
}
void LuigiRaceway::BeginPlay() {}
void LuigiRaceway::Render(struct UnkStruct_800DC5EC* arg0) {
UNUSED s32 pad;
u16 sp22 = (u16) arg0->pathCounter;
@@ -264,9 +278,8 @@ void LuigiRaceway::Render(struct UnkStruct_800DC5EC* arg0) {
currentScreenSection = 0;
}
u16* fb = (u16*) gSegmentTable[5] + 0xF800;
// FB_WriteFramebufferSliceToCPU(gDisplayListHead, fb, true);
uintptr_t fb = (uintptr_t) gSegmentTable[5] + 0xF800;
FB_WriteFramebufferSliceToCPU(gDisplayListHead, (void*)fb, true);
// FB_DrawFromFramebuffer(gDisplayListHead, 0, fb, true);
// FB_CopyToFramebuffer(gDisplayListHead, 0, fb, false, NULL);
/**
@@ -330,10 +343,4 @@ void LuigiRaceway::SomeCollisionThing(Player *player, Vec3f arg1, Vec3f arg2, Ve
func_8003E9EC(player, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
}
void LuigiRaceway::GenerateCollision() {
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_luigi_raceway_addr));
func_80295C6C();
D_8015F8E4 = gCourseMinY - 10.0f;
}
void LuigiRaceway::Destroy() { }
+2 -3
View File
@@ -24,8 +24,10 @@ 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 SpawnActors() override;
virtual void SpawnVehicles() override;
virtual void MinimapSettings() override;
virtual void InitCourseObjects() override;
virtual void UpdateCourseObjects() override;
@@ -35,12 +37,9 @@ public:
virtual void WhatDoesThisDoAI(Player* player, int8_t playerId) override;
virtual void MinimapFinishlinePosition() override;
virtual void SetStaffGhost() override;
virtual void BeginPlay() override;
virtual void Render(struct UnkStruct_800DC5EC*) override;
virtual void RenderCredits() override;
virtual void Collision() override;
virtual void SomeCollisionThing(Player *player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32* arg4, f32* arg5, f32* arg6, f32* arg7) override;
virtual void SpawnBombKarts() override;
virtual void GenerateCollision() override;
virtual void Destroy() override;
};
+41 -27
View File
@@ -6,7 +6,8 @@
#include "MarioRaceway.h"
#include "GameObject.h"
#include "World.h"
#include "BombKart.h"
#include "engine/actors/AFinishline.h"
#include "engine/vehicles/OBombKart.h"
extern "C" {
#include "main.h"
@@ -29,6 +30,7 @@ extern "C" {
#include "mario_raceway_data.h"
#include "collision.h"
#include "memory.h"
#include "courses/staff_ghost_data.h"
extern const char *mario_raceway_dls[];
}
@@ -102,6 +104,23 @@ MarioRaceway::MarioRaceway() {
Props.Skybox.FloorTopLeft = {0, 0, 0};
}
void MarioRaceway::Load() {
Course::Load();
generate_collision_mesh_with_defaults(segmented_gfx_to_virtual(reinterpret_cast<void*>(0x07001140)));
if (gScreenModeSelection == SCREEN_MODE_1P) {
// d_course_mario_raceway_packed_dl_8E8
generate_collision_mesh_with_defaults(segmented_gfx_to_virtual(reinterpret_cast<void*>(0x070008E8)));
} else {
// d_course_mario_raceway_packed_dl_2D68
generate_collision_mesh_with_defaults(segmented_gfx_to_virtual(reinterpret_cast<void*>(0x07002D68)));
}
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_mario_raceway_addr));
func_80295C6C();
D_8015F8E4 = gCourseMinY - 10.0f;
}
void MarioRaceway::LoadTextures() {
dma_textures(gTextureTrees1, 0x0000035BU, 0x00000800U);
D_802BA058 = dma_textures(gTexturePiranhaPlant1, 0x000003E8U, 0x00000800U);
@@ -120,6 +139,9 @@ void MarioRaceway::SpawnActors() {
Vec3f position;
Vec3f velocity = { 0.0f, 0.0f, 0.0f };
Vec3s rotation = { 0, 0, 0 };
gWorldInstance.AddActor(new AFinishline());
spawn_foliage((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_mario_raceway_tree_spawns));
spawn_piranha_plants((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_mario_raceway_piranha_plant_spawns));
spawn_all_item_boxes((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_mario_raceway_item_box_spawns));
@@ -128,8 +150,21 @@ void MarioRaceway::SpawnActors() {
add_actor_to_empty_slot(position, rotation, velocity, ACTOR_MARIO_SIGN);
vec3f_set(position, 2520.0f, 0.0f, 1240.0f);
position[0] *= gCourseDirection;
actor = &gActorList[add_actor_to_empty_slot(position, rotation, velocity, ACTOR_MARIO_SIGN)];
actor->flags |= 0x4000;
add_actor_to_empty_slot(position, rotation, velocity, ACTOR_MARIO_SIGN);
}
void MarioRaceway::SpawnVehicles() {
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
gWorldInstance.AddBombKart(pos, &D_80164550[0][40], 40, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][100], 100, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][265], 265, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][285], 285, 1, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][420], 420, 1, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
}
}
// Likely sets minimap boundaries
@@ -192,16 +227,6 @@ void MarioRaceway::WhatDoesThisDoAI(Player* player, int8_t playerId) {
}
}
void MarioRaceway::SpawnBombKarts() {
gWorldInstance.AddObject(std::make_unique<OBombKart>(40, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(100, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(265, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(285, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(420, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
}
// Positions the finishline on the minimap
void MarioRaceway::MinimapFinishlinePosition() {
//! todo: Place hard-coded values here.
@@ -221,7 +246,6 @@ void MarioRaceway::SetStaffGhost() {
D_80162DE4 = 0;
}
void MarioRaceway::BeginPlay() { }
void MarioRaceway::Render(struct UnkStruct_800DC5EC* arg0) {
u16 sp22 = arg0->pathCounter;
u16 temp_t0 = arg0->playerDirection;
@@ -333,19 +357,9 @@ void MarioRaceway::RenderCredits() {
void MarioRaceway::Collision() {}
void MarioRaceway::GenerateCollision() {
generate_collision_mesh_with_defaults(segmented_gfx_to_virtual(reinterpret_cast<void*>(0x07001140)));
if (gScreenModeSelection == SCREEN_MODE_1P) {
// d_course_mario_raceway_packed_dl_8E8
generate_collision_mesh_with_defaults(segmented_gfx_to_virtual(reinterpret_cast<void*>(0x070008E8)));
} else {
// d_course_mario_raceway_packed_dl_2D68
generate_collision_mesh_with_defaults(segmented_gfx_to_virtual(reinterpret_cast<void*>(0x07002D68)));
}
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_mario_raceway_addr));
func_80295C6C();
D_8015F8E4 = gCourseMinY - 10.0f;
void MarioRaceway::CreditsSpawnActors() {
dma_textures(gTextureTrees1, 0x35B, 0x800);
spawn_foliage((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_mario_raceway_tree_spawns));
}
void MarioRaceway::Destroy() { }
+3 -3
View File
@@ -24,8 +24,10 @@ 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 SpawnActors() override;
virtual void SpawnVehicles() override;
virtual void MinimapSettings() override;
virtual void InitCourseObjects() override;
virtual void SomeSounds() override;
@@ -33,11 +35,9 @@ public:
virtual void WhatDoesThisDoAI(Player* player, int8_t playerId) override;
virtual void MinimapFinishlinePosition() override;
virtual void SetStaffGhost() override;
virtual void BeginPlay() override;
virtual void Render(struct UnkStruct_800DC5EC*) override;
virtual void RenderCredits() override;
virtual void Collision() override;
virtual void SpawnBombKarts() override;
virtual void GenerateCollision() override;
virtual void CreditsSpawnActors() override;
virtual void Destroy() override;
};
+40 -19
View File
@@ -6,7 +6,8 @@
#include "MooMooFarm.h"
#include "GameObject.h"
#include "World.h"
#include "BombKart.h"
#include "engine/actors/AFinishline.h"
#include "engine/vehicles/OBombKart.h"
#include "assets/moo_moo_farm_data.h"
extern "C" {
@@ -103,6 +104,14 @@ MooMooFarm::MooMooFarm() {
Props.Skybox.FloorTopLeft = {255, 184, 99};
}
void MooMooFarm::Load() {
Course::Load();
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_moo_moo_farm_addr));
func_80295C6C();
D_8015F8E4 = gCourseMinY - 10.0f;
}
void MooMooFarm::LoadTextures() {
dma_textures(gTextureTrees4Left, 0x000003E8U, 0x00000800U);
dma_textures(gTextureTrees4Right, 0x000003E8U, 0x00000800U);
@@ -119,12 +128,28 @@ void MooMooFarm::LoadTextures() {
}
void MooMooFarm::SpawnActors() {
gWorldInstance.AddActor(new AFinishline());
if (gPlayerCountSelection1 != 4) {
spawn_foliage((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_moo_moo_farm_tree_spawn));
}
spawn_all_item_boxes((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_moo_moo_farm_item_box_spawns));
}
void MooMooFarm::SpawnVehicles() {
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
gWorldInstance.AddBombKart(pos, &D_80164550[0][50], 50, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][140], 140, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][225], 225, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][316], 316, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][434], 434, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
}
}
// Likely sets minimap boundaries
void MooMooFarm::MinimapSettings() {
D_8018D220 = reinterpret_cast<uint8_t (*)[1024]>(dma_textures(gTextureExhaust0, 0x479, 0xC00));
@@ -237,26 +262,12 @@ void MooMooFarm::WhatDoesThisDoAI(Player* player, int8_t playerId) {
}
}
void MooMooFarm::SpawnBombKarts() {
gWorldInstance.AddObject(std::make_unique<OBombKart>(40, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(100, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(265, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(285, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(420, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
}
// 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::SetStaffGhost() {}
void MooMooFarm::BeginPlay() {}
void MooMooFarm::Render(struct UnkStruct_800DC5EC* arg0) {
s16 temp_s0 = arg0->pathCounter;
s16 temp_s1 = arg0->playerDirection;
@@ -336,10 +347,20 @@ void MooMooFarm::RenderCredits() {
void MooMooFarm::Collision() {}
void MooMooFarm::GenerateCollision() {
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_moo_moo_farm_addr));
func_80295C6C();
D_8015F8E4 = gCourseMinY - 10.0f;
void MooMooFarm::CreditsSpawnActors() {
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((struct ActorSpawnData*) LOAD_ASSET_RAW(d_course_moo_moo_farm_tree_spawn));
}
void MooMooFarm::Destroy() { }
+3 -4
View File
@@ -24,8 +24,10 @@ 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 SpawnActors() override;
virtual void SpawnVehicles() override;
virtual void MinimapSettings() override;
virtual void InitCourseObjects() override;
virtual void UpdateCourseObjects() override;
@@ -34,12 +36,9 @@ public:
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 BeginPlay() override;
virtual void Render(struct UnkStruct_800DC5EC*) override;
virtual void RenderCredits() override;
virtual void Collision() override;
virtual void SpawnBombKarts() override;
virtual void GenerateCollision() override;
virtual void CreditsSpawnActors() override;
virtual void Destroy() override;
};
+29 -37
View File
@@ -6,8 +6,9 @@
#include "PodiumCeremony.h"
#include "GameObject.h"
#include "World.h"
#include "BombKart.h"
#include "engine/vehicles/OBombKart.h"
#include "assets/royal_raceway_data.h"
#include "assets/ceremony_data.h"
extern "C" {
#include "main.h"
@@ -29,6 +30,7 @@ extern "C" {
#include "actors.h"
#include "collision.h"
#include "memory.h"
#include "courses/staff_ghost_data.h"
extern const char *royal_raceway_dls[];
}
@@ -49,7 +51,7 @@ PodiumCeremony::PodiumCeremony() {
Props.SomePtr = D_800DCAF4;
Props.AISteeringSensitivity = 53;
Props.PathSizes = {0x3E8, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0};
Props.PathSizes = {500, 500, 500, 500, 1, 0, 0, 0, 0, 0, 0};
Props.D_0D009418[0] = 4.1666665f;
Props.D_0D009418[1] = 5.5833334f;
@@ -71,12 +73,12 @@ PodiumCeremony::PodiumCeremony() {
Props.D_0D009808[2] = 5.75f;
Props.D_0D009808[3] = 6.3333334f;
Props.PathTable[0] = (TrackWaypoint*)LOAD_ASSET_RAW(d_course_royal_raceway_unknown_waypoints);
Props.PathTable[1] = NULL;
Props.PathTable[2] = NULL;
Props.PathTable[3] = NULL;
Props.PathTable[0] = (TrackWaypoint*)LOAD_ASSET_RAW(podium_ceremony_path);
Props.PathTable[1] = (TrackWaypoint*)LOAD_ASSET_RAW(podium_ceremony_path_2);
Props.PathTable[2] = (TrackWaypoint*)LOAD_ASSET_RAW(podium_ceremony_path_3);
Props.PathTable[3] = (TrackWaypoint*)LOAD_ASSET_RAW(podium_ceremony_path_4);
Props.PathTable2[0] = (TrackWaypoint*)LOAD_ASSET_RAW(d_course_royal_raceway_track_waypoints);
Props.PathTable2[0] = NULL;
Props.PathTable2[1] = NULL;
Props.PathTable2[2] = NULL;
Props.PathTable2[3] = NULL;
@@ -96,6 +98,14 @@ PodiumCeremony::PodiumCeremony() {
Props.Skybox.FloorTopLeft = {255, 224, 240};
}
void PodiumCeremony::Load() {
Course::Load();
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_royal_raceway_addr));
func_80295C6C();
D_8015F8E4 = -60.0f;
}
void PodiumCeremony::LoadTextures() {
}
@@ -105,6 +115,18 @@ void PodiumCeremony::SpawnActors() {
spawn_piranha_plants((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_royal_raceway_piranha_plant_spawn));
}
void PodiumCeremony::SpawnVehicles() {
Vec3f pos = {0, 0, 0};
gWorldInstance.AddBombKart(pos, &D_80164550[3][3], 3, 5, 1.25f);
gWorldInstance.AddBombKart(pos, &D_80164550[3][40], 40, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[3][60], 60, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[3][80], 80, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[3][100], 100, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[3][120], 120, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[3][140], 140, 0, 1.0f);
}
// Likely sets minimap boundaries
void PodiumCeremony::MinimapSettings() {
D_8018D220 = reinterpret_cast<uint8_t (*)[1024]>(dma_textures(gTextureExhaust4, 0x3F8, 0x1000));
@@ -163,36 +185,12 @@ void PodiumCeremony::WhatDoesThisDoAI(Player* player, int8_t playerId) {
}
}
void PodiumCeremony::SpawnBombKarts() {
gWorldInstance.AddObject(std::make_unique<OBombKart>(40, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(100, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(265, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(285, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(420, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
}
// 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::SetStaffGhost() {
u32 temp_v0 = func_800B4E24(0) & 0xfffff;
if (temp_v0 <= 16000) {
D_80162DD6 = 0;
D_80162DF4 = 0;
} else {
D_80162DD6 = 1;
D_80162DF4 = 1;
}
D_80162DC4 = d_royal_raceway_staff_ghost;
D_80162DE4 = 6;
}
void PodiumCeremony::BeginPlay() { }
void PodiumCeremony::Render(struct UnkStruct_800DC5EC* arg0) {
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
@@ -228,10 +226,4 @@ void PodiumCeremony::RenderCredits() {
void PodiumCeremony::Collision() {}
void PodiumCeremony::GenerateCollision() {
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_royal_raceway_addr));
func_80295C6C();
D_8015F8E4 = -60.0f;
}
void PodiumCeremony::Destroy() { }
+2 -4
View File
@@ -24,8 +24,10 @@ 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 SpawnActors() override;
virtual void SpawnVehicles() override;
//virtual void InitClouds() override;
virtual void MinimapSettings() override;
virtual void InitCourseObjects() override;
@@ -33,12 +35,8 @@ public:
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 BeginPlay() override;
virtual void Render(struct UnkStruct_800DC5EC*) override;
virtual void RenderCredits() override;
virtual void Collision() override;
virtual void SpawnBombKarts() override;
virtual void GenerateCollision() override;
virtual void Destroy() override;
};
+59 -31
View File
@@ -6,7 +6,8 @@
#include "RainbowRoad.h"
#include "GameObject.h"
#include "World.h"
#include "BombKart.h"
#include "engine/actors/AFinishline.h"
#include "engine/vehicles/OBombKart.h"
#include "assets/rainbow_road_data.h"
extern "C" {
@@ -100,13 +101,48 @@ RainbowRoad::RainbowRoad() {
Props.Skybox.FloorTopLeft = {0, 0, 0};
}
void RainbowRoad::Load() {
Course::Load();
D_800DC5C8 = 1;
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_rainbow_road_addr));
func_80295C6C();
D_8015F8E4 = 0.0f;
// d_course_rainbow_road_packed_dl_2068
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07002068), -0x6A, 255, 255, 255);
// d_course_rainbow_road_packed_dl_1E18
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07001E18), -0x6A, 255, 255, 255);
// d_course_rainbow_road_packed_dl_1318
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07001318), 255, 255, 255, 0);
if (gGamestate != CREDITS_SEQUENCE) {
// d_course_rainbow_road_packed_dl_1FB8
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07001FB8), -0x6A, 255, 255, 255);
}
}
void RainbowRoad::LoadTextures() {
}
void RainbowRoad::SpawnActors() {
gWorldInstance.AddActor(new AFinishline());
spawn_all_item_boxes((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_rainbow_road_item_box_spawns));
}
void RainbowRoad::SpawnVehicles() {
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
gWorldInstance.AddBombKart(pos, &D_80164550[0][50], 50, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][100], 100, 1, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][150], 150, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][200], 200, 1, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][250], 250, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
}
}
void RainbowRoad::InitClouds() {
init_stars(this->Props.Clouds);
}
@@ -157,25 +193,12 @@ void RainbowRoad::WhatDoesThisDo(Player* player, int8_t playerId) {}
void RainbowRoad::WhatDoesThisDoAI(Player* player, int8_t playerId) {}
void RainbowRoad::SpawnBombKarts() {
gWorldInstance.AddObject(std::make_unique<OBombKart>(40, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(100, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(265, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(285, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(420, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
}
// 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::SetStaffGhost() {}
void RainbowRoad::BeginPlay() {}
void RainbowRoad::Render(struct UnkStruct_800DC5EC* arg0) {
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
@@ -190,25 +213,30 @@ void RainbowRoad::RenderCredits() {
void RainbowRoad::Collision() {}
void RainbowRoad::GenerateCollision() {
D_800DC5C8 = 1;
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_rainbow_road_addr));
func_80295C6C();
D_8015F8E4 = 0.0f;
// d_course_rainbow_road_packed_dl_2068
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07002068), -0x6A, 255, 255, 255);
// d_course_rainbow_road_packed_dl_1E18
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07001E18), -0x6A, 255, 255, 255);
// d_course_rainbow_road_packed_dl_1318
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07001318), 255, 255, 255, 0);
if (gGamestate != CREDITS_SEQUENCE) {
// d_course_rainbow_road_packed_dl_1FB8
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07001FB8), -0x6A, 255, 255, 255);
}
}
void RainbowRoad::Waypoints(Player* player, int8_t playerId) {
player->nearestWaypointId = gCopyNearestWaypointByPlayerId[playerId];
}
void RainbowRoad::DrawWater(struct UnkStruct_800DC5EC* screen, uint16_t pathCounter, uint16_t cameraRot, uint16_t playerDirection) {
Mat4 matrix;
gDPPipeSync(gDisplayListHead++);
mtxf_identity(matrix);
render_set_position(matrix, 0);
gSPClearGeometryMode(gDisplayListHead++, G_CULL_BACK);
render_course_segments(rainbow_road_dls, screen);
gSPSetGeometryMode(gDisplayListHead++, G_CULL_BACK);
gDPSetAlphaCompare(gDisplayListHead++, G_AC_NONE);
gDPPipeSync(gDisplayListHead++);
}
void RainbowRoad::CreditsSpawnActors() {
// d_course_rainbow_road_packed_dl_2068
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07002068), -0x6A, 0xFF, 0xFF, 0xFF);
// d_course_rainbow_road_packed_dl_1E18
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07001E18), -0x6A, 0xFF, 0xFF, 0xFF);
// d_course_rainbow_road_packed_dl_1318
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07001318), -1, 0xFF, 0xFF, 0);
}
void RainbowRoad::Destroy() {}
+4 -4
View File
@@ -24,8 +24,10 @@ 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 SpawnActors() override;
virtual void SpawnVehicles() override;
virtual void InitClouds() override;
virtual void UpdateClouds(s32, Camera*) override;
virtual void MinimapSettings() override;
@@ -36,13 +38,11 @@ public:
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 BeginPlay() override;
virtual void Render(struct UnkStruct_800DC5EC*) override;
virtual void RenderCredits() override;
virtual void Collision() override;
virtual void SpawnBombKarts() override;
virtual void GenerateCollision() override;
virtual void Waypoints(Player* player, int8_t playerId) 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;
};
+38 -18
View File
@@ -6,7 +6,8 @@
#include "RoyalRaceway.h"
#include "GameObject.h"
#include "World.h"
#include "BombKart.h"
#include "engine/actors/AFinishline.h"
#include "engine/vehicles/OBombKart.h"
#include "assets/royal_raceway_data.h"
extern "C" {
@@ -29,6 +30,7 @@ extern "C" {
#include "actors.h"
#include "collision.h"
#include "memory.h"
#include "courses/staff_ghost_data.h"
extern const char *royal_raceway_dls[];
}
@@ -100,6 +102,14 @@ RoyalRaceway::RoyalRaceway() {
Props.Skybox.FloorTopLeft = {255, 224, 240};
}
void RoyalRaceway::Load() {
Course::Load();
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_royal_raceway_addr));
func_80295C6C();
D_8015F8E4 = -60.0f;
}
void RoyalRaceway::LoadTextures() {
dma_textures(gTextureTrees3, 0x000003E8U, 0x00000800U);
dma_textures(gTextureTrees7, 0x000003E8U, 0x00000800U);
@@ -115,11 +125,27 @@ void RoyalRaceway::LoadTextures() {
}
void RoyalRaceway::SpawnActors() {
gWorldInstance.AddActor(new AFinishline());
spawn_foliage((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_royal_raceway_tree_spawn));
spawn_all_item_boxes((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_royal_raceway_item_box_spawns));
spawn_piranha_plants((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_royal_raceway_piranha_plant_spawn));
}
void RoyalRaceway::SpawnVehicles() {
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
gWorldInstance.AddBombKart(pos, &D_80164550[0][50], 50, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][100], 100, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][296], 296, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][400], 400, 1, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][746], 746, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
}
}
// Likely sets minimap boundaries
void RoyalRaceway::MinimapSettings() {
D_8018D220 = reinterpret_cast<uint8_t (*)[1024]>(dma_textures(gTextureExhaust4, 0x3F8, 0x1000));
@@ -178,16 +204,6 @@ void RoyalRaceway::WhatDoesThisDoAI(Player* player, int8_t playerId) {
}
}
void RoyalRaceway::SpawnBombKarts() {
gWorldInstance.AddObject(std::make_unique<OBombKart>(40, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(100, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(265, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(285, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(420, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
}
// Positions the finishline on the minimap
void RoyalRaceway::MinimapFinishlinePosition() {
//! todo: Place hard-coded values here.
@@ -207,7 +223,6 @@ void RoyalRaceway::SetStaffGhost() {
D_80162DE4 = 6;
}
void RoyalRaceway::BeginPlay() { }
void RoyalRaceway::Render(struct UnkStruct_800DC5EC* arg0) {
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
@@ -243,12 +258,6 @@ void RoyalRaceway::RenderCredits() {
void RoyalRaceway::Collision() {}
void RoyalRaceway::GenerateCollision() {
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_royal_raceway_addr));
func_80295C6C();
D_8015F8E4 = -60.0f;
}
void RoyalRaceway::Waypoints(Player* player, int8_t playerId) {
s16 waypoint = gNearestWaypointByPlayerId[playerId];
if ((waypoint >= 0x258) && (waypoint < 0x2A4)) {
@@ -261,4 +270,15 @@ void RoyalRaceway::Waypoints(Player* player, int8_t playerId) {
}
}
void RoyalRaceway::ScrollingTextures() {
D_802B87BC -= 20;
if (D_802B87BC < 0) {
D_802B87BC = 0xFF;
}
// d_course_royal_raceway_packed_dl_A6A8
find_and_set_tile_size((uintptr_t) segmented_gfx_to_virtual((void*)0x0700A6A8), 0, D_802B87BC);
// 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() { }
+3 -3
View File
@@ -24,8 +24,10 @@ 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 SpawnActors() override;
virtual void SpawnVehicles() override;
virtual void MinimapSettings() override;
virtual void InitCourseObjects() override;
virtual void SomeSounds() override;
@@ -33,12 +35,10 @@ public:
virtual void WhatDoesThisDoAI(Player* player, int8_t playerId) override;
virtual void MinimapFinishlinePosition() override;
virtual void SetStaffGhost() override;
virtual void BeginPlay() override;
virtual void Render(struct UnkStruct_800DC5EC*) override;
virtual void RenderCredits() override;
virtual void Collision() override;
virtual void SpawnBombKarts() override;
virtual void GenerateCollision() override;
virtual void ScrollingTextures() override;
virtual void Waypoints(Player* player, int8_t playerId) override;
virtual void Destroy() override;
};
+60 -20
View File
@@ -6,7 +6,8 @@
#include "SherbetLand.h"
#include "GameObject.h"
#include "World.h"
#include "BombKart.h"
#include "engine/actors/AFinishline.h"
#include "engine/vehicles/OBombKart.h"
#include "assets/sherbet_land_data.h"
extern "C" {
@@ -30,6 +31,7 @@ extern "C" {
#include "collision.h"
#include "memory.h"
extern const char *sherbet_land_dls[];
extern const char *sherbet_land_dls_2[];
}
SherbetLand::SherbetLand() {
@@ -100,13 +102,41 @@ SherbetLand::SherbetLand() {
Props.Skybox.FloorTopLeft = {216, 232, 248};
}
void SherbetLand::Load() {
Course::Load();
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_sherbet_land_addr));
func_80295C6C();
D_8015F8E4 = -18.0f;
// d_course_sherbet_land_packed_dl_1EB8
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07001EB8), -0x4C, 255, 255, 255);
// d_course_sherbet_land_packed_dl_2308
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07002308), -0x6A, 255, 255, 255);
}
void SherbetLand::LoadTextures() {
}
void SherbetLand::SpawnActors() {
gWorldInstance.AddActor(new AFinishline());
spawn_all_item_boxes((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_sherbet_land_item_box_spawns));
}
void SherbetLand::SpawnVehicles() {
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
gWorldInstance.AddBombKart(pos, &D_80164550[0][50], 50, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][100], 100, 1, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][150], 150, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][200], 200, 1, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][250], 250, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
}
}
// Likely sets minimap boundaries
void SherbetLand::MinimapSettings() {
D_8018D220 = reinterpret_cast<uint8_t (*)[1024]>(dma_textures(gTextureExhaust1, 0x485, 0xC00));
@@ -146,25 +176,12 @@ void SherbetLand::WhatDoesThisDo(Player* player, int8_t playerId) {}
void SherbetLand::WhatDoesThisDoAI(Player* player, int8_t playerId) {}
void SherbetLand::SpawnBombKarts() {
gWorldInstance.AddObject(std::make_unique<OBombKart>(40, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(100, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(265, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(285, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(420, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
}
// 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::SetStaffGhost() {}
void SherbetLand::BeginPlay() { }
void SherbetLand::Render(struct UnkStruct_800DC5EC* arg0) {
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
@@ -180,14 +197,37 @@ void SherbetLand::RenderCredits() {
void SherbetLand::Collision() {}
void SherbetLand::GenerateCollision() {
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_sherbet_land_addr));
func_80295C6C();
D_8015F8E4 = -18.0f;
void SherbetLand::DrawWater(struct UnkStruct_800DC5EC* screen, uint16_t pathCounter, uint16_t cameraRot, uint16_t playerDirection) {
Mat4 matrix;
gDPPipeSync(gDisplayListHead++);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
gDPSetBlendMask(gDisplayListHead++, 0xFF);
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIA, G_CC_MODULATEIA);
gDPSetTextureFilter(gDisplayListHead++, G_TF_BILERP);
gDPSetTexturePersp(gDisplayListHead++, G_TP_PERSP);
mtxf_identity(matrix);
render_set_position(matrix, 0);
render_course_segments(sherbet_land_dls_2, screen);
gDPSetAlphaCompare(gDisplayListHead++, G_AC_NONE);
if ((func_80290C20(screen->camera) == 1) && (func_802AAB4C(screen->player) < screen->player->pos[1])) {
gSPSetGeometryMode(gDisplayListHead++, G_ZBUFFER);
gDPSetCombineMode(gDisplayListHead++, G_CC_SHADE, G_CC_SHADE);
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2);
// d_course_sherbet_land_packed_dl_2B48
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07002B48));
}
gDPPipeSync(gDisplayListHead++);
}
void SherbetLand::CreditsSpawnActors() {
// d_course_sherbet_land_packed_dl_1EB8
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07001EB8), -0x4C, 255, 255, 255);
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07001EB8), -0x4C, 0xFF, 0xFF, 0xFF);
// d_course_sherbet_land_packed_dl_2308
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07002308), -0x6A, 255, 255, 255);
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07002308), -0x6A, 0xFF, 0xFF, 0xFF);
}
void SherbetLand::Destroy() { }
+4 -4
View File
@@ -24,8 +24,10 @@ 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 SpawnActors() override;
virtual void SpawnVehicles() override;
virtual void MinimapSettings() override;
virtual void InitCourseObjects() override;
virtual void UpdateCourseObjects() override;
@@ -34,12 +36,10 @@ public:
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 BeginPlay() override;
virtual void Render(struct UnkStruct_800DC5EC*) override;
virtual void RenderCredits() override;
virtual void Collision() override;
virtual void SpawnBombKarts() override;
virtual void GenerateCollision() 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;
};
+30 -17
View File
@@ -6,7 +6,7 @@
#include "Skyscraper.h"
#include "GameObject.h"
#include "World.h"
#include "BombKart.h"
#include "engine/vehicles/OBombKart.h"
#include "assets/skyscraper_data.h"
extern "C" {
@@ -101,10 +101,38 @@ Skyscraper::Skyscraper() {
Props.Skybox.FloorTopLeft = {0, 0, 0};
}
void Skyscraper::Load() {
Course::Load();
// d_course_skyscraper_packed_dl_1110
generate_collision_mesh_with_default_section_id((Gfx*) segmented_gfx_to_virtual((void*)0x07001110), 1);
// d_course_skyscraper_packed_dl_258
generate_collision_mesh_with_default_section_id((Gfx*) segmented_gfx_to_virtual((void*)0x07000258), 1);
func_80295C6C();
D_8015F8E4 = -480.0f;
}
void Skyscraper::LoadTextures() {
}
void Skyscraper::SpawnActors() {}
void Skyscraper::SpawnActors() {
spawn_all_item_boxes((ActorSpawnData*)LOAD_ASSET_RAW(d_course_skyscraper_item_box_spawns));
}
void Skyscraper::SpawnVehicles() {
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
gWorldInstance.AddBombKart(pos, &D_80164550[0][20], 20, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][40], 40, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][60], 60, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][80], 80, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][100], 100, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][120], 120, 0, 1.0f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][140], 140, 0, 1.0f);
}
}
// Likely sets minimap boundaries
void Skyscraper::MinimapSettings() {
@@ -121,17 +149,12 @@ void Skyscraper::WhatDoesThisDo(Player* player, int8_t playerId) {}
void Skyscraper::WhatDoesThisDoAI(Player* player, int8_t playerId) {}
void Skyscraper::SpawnBombKarts() {}
// 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::SetStaffGhost() {}
void Skyscraper::BeginPlay() { }
void Skyscraper::Render(struct UnkStruct_800DC5EC* arg0) {
func_802B5D64(D_800DC610, D_802B87D4, 0, 1);
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
@@ -159,16 +182,6 @@ void Skyscraper::RenderCredits() {}
void Skyscraper::Collision() {}
void Skyscraper::GenerateCollision() {
// d_course_skyscraper_packed_dl_1110
generate_collision_mesh_with_default_section_id((Gfx*) segmented_gfx_to_virtual((void*)0x07001110), 1);
// d_course_skyscraper_packed_dl_258
generate_collision_mesh_with_default_section_id((Gfx*) segmented_gfx_to_virtual((void*)0x07000258), 1);
func_80295C6C();
D_8015F8E4 = -480.0f;
}
void Skyscraper::Waypoints(Player* player, int8_t playerId) {
player->nearestWaypointId = 0;
}
+2 -4
View File
@@ -24,8 +24,10 @@ 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 SpawnActors() override;
virtual void SpawnVehicles() override;
//virtual void InitClouds() override;
virtual void MinimapSettings() override;
virtual void InitCourseObjects() override;
@@ -33,13 +35,9 @@ public:
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 BeginPlay() override;
virtual void Render(struct UnkStruct_800DC5EC*) override;
virtual void RenderCredits() override;
virtual void Collision() override;
virtual void SpawnBombKarts() override;
virtual void GenerateCollision() override;
virtual void Waypoints(Player* player, int8_t playerId) override;
virtual void Destroy() override;
};
+61 -52
View File
@@ -6,7 +6,14 @@
#include "TestCourse.h"
#include "GameObject.h"
#include "World.h"
#include "BombKart.h"
#include "engine/actors/AFinishline.h"
#include "engine/vehicles/OBombKart.h"
#include "assets/mario_raceway_data.h"
#include "assets/bowsers_castle_data.h"
#include "assets/bowsers_castle_displaylists.h"
#include "engine/actors/ATree.h"
#include "engine/actors/ACloud.h"
extern "C" {
#include "main.h"
@@ -29,10 +36,10 @@ extern "C" {
#include "collision.h"
#include "memory.h"
typedef struct {
Gfx* addr;
u8 surfaceType;
u8 sectionId;
u16 flags;
Gfx* addr;
u8 surfaceType;
u8 sectionId;
u16 flags;
} TrackSections;
extern Gfx test_course_dls[];
extern Vtx mario_Plane_001_mesh_vtx_1[];
@@ -108,8 +115,13 @@ TestCourse::TestCourse() {
}
void TestCourse::Load() {
gSegmentTable[4] = reinterpret_cast<uintptr_t>(&mario_Plane_001_mesh_vtx_1[0]);
//gSegmentTable[7] = reinterpret_cast<uintptr_t>(&gfx[0]);
Course::Load(mario_Plane_001_mesh_vtx_1, NULL);
generate_collision_mesh_with_defaults(mario_Plane_001_mesh);
parse_course_displaylists((TrackSectionsI*)test_course_addr);
func_80295C6C();
D_8015F8E4 = gCourseMinY - 10.0f;
}
void TestCourse::LoadTextures() {
@@ -126,30 +138,39 @@ void TestCourse::LoadTextures() {
}
void TestCourse::SpawnActors() {
struct ActorSpawnData itemboxes[] = {
{ 200, 1500, 200 , 0},
{ 350, 2500, 300 , 1},
{ 400, 2000, 350 , 2},
{ 40, 0, -800, 0},
{ -40, 0, -800, 0},
{ 0, 0, -800, 0},
{ 999, 6, 482, 0},
{ 1064, 8, 275, {0}},
{ 1028, 5, -39 , {0}},
{ 320, 0, 1020, {0}},
{ 293, 0, 950, {0}},
{{ -32768, 0, 0 }, {0}},
};
struct ActorSpawnData itemboxes[] = {
{ 200, 1500, 200 , 0},
{ 350, 2500, 300 , 1},
{ 400, 2000, 350 , 2},
{ 40, 0, -800, 0},
{ -40, 0, -800, 0},
{ 0, 0, -800, 0},
{ 999, 6, 482, 0},
{ 1064, 8, 275, {0}},
{ 1028, 5, -39 , {0}},
{ 320, 0, 1020, {0}},
{ 293, 0, 950, {0}},
{{ -32768, 0, 0 }, {0}},
};
struct ActorSpawnData rocks[] = {
{{ 200, 1500, 200 }, {0}},
{{ 350, 2500, 300 }, {1}},
{{ 400, 2000, 350 }, {2}},
{{ -32768, 0, 0 }, {0}},
};
gWorldInstance.AddActor(new AFinishline());
struct ActorSpawnData rocks[] = {
{{ 200, 1500, 200 }, {0}},
{{ 350, 2500, 300 }, {1}},
{{ 400, 2000, 350 }, {2}},
{{ -32768, 0, 0 }, {0}},
};
spawn_all_item_boxes(itemboxes);
spawn_falling_rocks(rocks);
Vec3f test = {-100, 0, -150};
Vec3s rot = {0, 0, 0};
Vec3f vel = {0, 0, 0};
add_actor_to_empty_slot(test, rot, vel, ACTOR_TREE_MARIO_RACEWAY);
struct RailroadCrossing* rrxing;
Vec3f position;
Vec3f velocity = { 0.0f, 0.0f, 0.0f };
@@ -160,9 +181,12 @@ struct ActorSpawnData rocks[] = {
uintptr_t* crossing1 = (uintptr_t*) gWorldInstance.AddCrossing(crossingPos, 0, 2, 900.0f, 650.0f);
position[0] *= gCourseDirection;
rrxing = (struct RailroadCrossing*) &gActorList[add_actor_to_empty_slot(position, rotation, velocity,
ACTOR_RAILROAD_CROSSING)];
rrxing = (struct RailroadCrossing*) GET_ACTOR(add_actor_to_empty_slot(position, rotation, velocity,
ACTOR_RAILROAD_CROSSING));
rrxing->crossingTrigger = crossing1;
Vec3f pos = {-80, 7, -20};
gWorldInstance.AddActor(new ACloud(pos));
}
// Likely sets minimap boundaries
@@ -241,8 +265,14 @@ void TestCourse::SpawnVehicles() {
gVehicle2DWaypointLength = 53;
D_80162EB0 = spawn_actor_on_surface(test_course_path2D[0].x, 2000.0f, test_course_path2D[0].z);
gWorldInstance.AddTrain(5, 5.0f, 0);
gWorldInstance.AddTrain(5, 5.0f, 8);
gWorldInstance.AddTrain(5, 2.5f, 0);
gWorldInstance.AddTrain(5, 2.5f, 8);
Vec3f pos = {0, 0, 0};
gWorldInstance.AddBombKart(pos, &D_80164550[0][25], 25, 2, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][45], 45, 3, 0.8333333f);
}
void TestCourse::UpdateVehicles() {
@@ -283,25 +313,12 @@ void TestCourse::WhatDoesThisDoAI(Player* player, int8_t playerId) {
}
}
void TestCourse::SpawnBombKarts() {
gWorldInstance.AddObject(std::make_unique<OBombKart>(40, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(100, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(265, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(285, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(420, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
}
// 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::SetStaffGhost() {}
void TestCourse::BeginPlay() { }
void TestCourse::Render(struct UnkStruct_800DC5EC* arg0) {
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
@@ -322,12 +339,4 @@ void TestCourse::RenderCredits() {
void TestCourse::Collision() {}
void TestCourse::GenerateCollision() {
generate_collision_mesh_with_defaults(mario_Plane_001_mesh);
parse_course_displaylists((TrackSectionsI*)test_course_addr);
func_80295C6C();
D_8015F8E4 = gCourseMinY - 10.0f;
}
void TestCourse::Destroy() { }
-4
View File
@@ -33,14 +33,10 @@ public:
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 BeginPlay() override;
virtual void Render(struct UnkStruct_800DC5EC*) override;
virtual void RenderCredits() override;
virtual void Collision() override;
virtual void SpawnVehicles() override;
virtual void UpdateVehicles() override;
virtual void SpawnBombKarts() override;
virtual void GenerateCollision() override;
virtual void Destroy() override;
};
+35 -25
View File
@@ -6,8 +6,9 @@
#include "ToadsTurnpike.h"
#include "GameObject.h"
#include "World.h"
#include "BombKart.h"
#include "engine/vehicles/OBombKart.h"
#include "assets/toads_turnpike_data.h"
#include "engine/actors/AFinishline.h"
#include "engine/vehicles/Utils.h"
@@ -105,10 +106,30 @@ ToadsTurnpike::ToadsTurnpike() {
Props.Skybox.FloorTopLeft = {209, 65, 23};
}
void ToadsTurnpike::Load() {
Course::Load();
D_801625EC = 43;
D_801625F4 = 13;
D_801625F0 = 4;
D_802B87B0 = 993;
D_802B87B4 = 1000;
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_toads_turnpike_addr));
func_80295C6C();
D_8015F8E4 = gCourseMinY - 10.0f;
}
void ToadsTurnpike::LoadTextures() {
}
void ToadsTurnpike::SpawnActors() {
Vec3f pos;
pos[0] = (gIsMirrorMode != 0) ? D_80164490->posX + 138.0f : D_80164490->posX - 138.0f;
pos[1] = (f32) (D_80164490->posY - 15);
pos[2] = D_80164490->posZ;
gWorldInstance.AddActor(new AFinishline(pos));
spawn_all_item_boxes((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_toads_turnpike_item_box_spawns));
}
@@ -158,26 +179,12 @@ void ToadsTurnpike::WhatDoesThisDoAI(Player* player, int8_t playerId) {
}
}
void ToadsTurnpike::SpawnBombKarts() {
gWorldInstance.AddObject(std::make_unique<OBombKart>(40, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(100, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(265, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(285, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(420, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
}
// 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::SetStaffGhost() {}
void ToadsTurnpike::BeginPlay() {}
void ToadsTurnpike::Render(struct UnkStruct_800DC5EC* arg0) {
func_802B5D64(D_800DC610, D_802B87D4, 0, 1);
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
@@ -213,6 +220,8 @@ void ToadsTurnpike::Collision() {}
void ToadsTurnpike::SpawnVehicles() {
f32 a = ((gCCSelection * 90.0) / 216.0f) + 4.583333333333333;
f32 b = ((gCCSelection * 90.0) / 216.0f) + 2.9166666666666665;
a /= 2; // Normally vehicle logic is only ran every 2 frames. This slows the vehicles down to match.
b /= 2;
uint32_t waypoint;
if (gModeSelection == TIME_TRIALS) {
@@ -256,17 +265,18 @@ void ToadsTurnpike::SpawnVehicles() {
gWorldInstance.AddCar(a, b, &D_80164550[0][0], waypoint);
}
}
}
void ToadsTurnpike::GenerateCollision() {
D_801625EC = 43;
D_801625F4 = 13;
D_801625F0 = 4;
D_802B87B0 = 993;
D_802B87B4 = 1000;
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_toads_turnpike_addr));
func_80295C6C();
D_8015F8E4 = gCourseMinY - 10.0f;
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
gWorldInstance.AddBombKart(pos, &D_80164550[0][50], 50, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][100], 100, 1, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][150], 150, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][200], 200, 1, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][250], 250, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
}
}
void ToadsTurnpike::Destroy() { }
+1 -4
View File
@@ -24,6 +24,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 SpawnActors() override;
virtual void InitClouds() override;
@@ -33,13 +34,9 @@ public:
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 BeginPlay() override;
virtual void Render(struct UnkStruct_800DC5EC*) override;
virtual void RenderCredits() override;
virtual void Collision() override;
virtual void SpawnVehicles() override;
virtual void SpawnBombKarts() override;
virtual void GenerateCollision() override;
virtual void Destroy() override;
};
+96 -29
View File
@@ -6,9 +6,10 @@
#include "WarioStadium.h"
#include "GameObject.h"
#include "World.h"
#include "BombKart.h"
#include "engine/vehicles/OBombKart.h"
#include "assets/wario_stadium_data.h"
#include "engine/actors/AWarioSign.h"
#include "engine/actors/AFinishline.h"
extern "C" {
#include "main.h"
@@ -103,23 +104,68 @@ WarioStadium::WarioStadium() {
Props.Skybox.FloorTopLeft = {0, 0, 0};
}
void WarioStadium::Load() {
Course::Load();
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_wario_stadium_addr));
func_80295C6C();
D_8015F8E4 = gCourseMinY - 10.0f;
// d_course_wario_stadium_packed_dl_C50
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07000C50), 100, 255, 255, 255);
// d_course_wario_stadium_packed_dl_BD8
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07000BD8), 100, 255, 255, 255);
// d_course_wario_stadium_packed_dl_B60
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07000B60), 100, 255, 255, 255);
// d_course_wario_stadium_packed_dl_AE8
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07000AE8), 100, 255, 255, 255);
// d_course_wario_stadium_packed_dl_CC8
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07000CC8), 100, 255, 255, 255);
// d_course_wario_stadium_packed_dl_D50
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07000D50), 100, 255, 255, 255);
// d_course_wario_stadium_packed_dl_DD0
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07000DD0), 100, 255, 255, 255);
// d_course_wario_stadium_packed_dl_E48
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07000E48), 100, 255, 255, 255);
}
void WarioStadium::LoadTextures() {
}
void WarioStadium::SpawnActors() {
Vec3f finish;
finish[0] = (gIsMirrorMode != 0) ? D_80164490->posX + 12.0f : D_80164490->posX - 12.0f;(gIsMirrorMode != 0) ? D_80164490->posX + 12.0f : D_80164490->posX - 12.0f;
finish[1] = D_8015F8D0[1] = (f32) (D_80164490->posY - 15);
finish[2] = D_8015F8D0[2] = D_80164490->posZ;
gWorldInstance.AddActor(new AFinishline(finish));
spawn_all_item_boxes((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_wario_stadium_item_box_spawns));
Vec3f pos = {-131.0f, 83.0f, 286.0f};
pos[0] *= gCourseDirection;
gWorldInstance.AddActor(std::make_unique<AWarioSign>(pos));
gWorldInstance.AddActor(new AWarioSign(pos));
Vec3f pos2 = {-2353.0f, 72.0f, -1608.0f};
pos2[0] *= gCourseDirection;
gWorldInstance.AddActor(std::make_unique<AWarioSign>(pos2));
gWorldInstance.AddActor(new AWarioSign(pos2));
Vec3f pos3 = {-2622.0f, 79.0f, 739.0f};
pos3[0] *= gCourseDirection;
gWorldInstance.AddActor(std::make_unique<AWarioSign>(pos3));
gWorldInstance.AddActor(new AWarioSign(pos3));
}
void WarioStadium::SpawnVehicles() {
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
gWorldInstance.AddBombKart(pos, &D_80164550[0][50], 50, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][100], 100, 1, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][150], 150, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][200], 200, 1, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][250], 250, 3, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
gWorldInstance.AddBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f);
}
}
void WarioStadium::InitClouds() {
@@ -155,25 +201,12 @@ void WarioStadium::WhatDoesThisDo(Player* player, int8_t playerId) {}
void WarioStadium::WhatDoesThisDoAI(Player* player, int8_t playerId) {}
void WarioStadium::SpawnBombKarts() {
gWorldInstance.AddObject(std::make_unique<OBombKart>(40, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(100, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(265, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(285, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(420, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
}
// 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::SetStaffGhost() {}
void WarioStadium::BeginPlay() { }
void WarioStadium::Render(struct UnkStruct_800DC5EC* arg0) {
s16 prevFrame;
@@ -272,26 +305,60 @@ void WarioStadium::SomeCollisionThing(Player *player, Vec3f arg1, Vec3f arg2, Ve
func_8003EE2C(player, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
}
void WarioStadium::GenerateCollision() {
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_wario_stadium_addr));
func_80295C6C();
D_8015F8E4 = gCourseMinY - 10.0f;
void WarioStadium::DrawWater(struct UnkStruct_800DC5EC* screen, uint16_t pathCounter, uint16_t cameraRot, uint16_t playerDirection) {
Mat4 matrix;
gDPPipeSync(gDisplayListHead++);
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_XLU_INTER, G_RM_NOOP2);
gDPSetBlendMask(gDisplayListHead++, 0xFF);
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIA, G_CC_MODULATEIA);
gDPSetTextureFilter(gDisplayListHead++, G_TF_BILERP);
gDPSetTexturePersp(gDisplayListHead++, G_TP_PERSP);
mtxf_identity(matrix);
render_set_position(matrix, 0);
gSPClearGeometryMode(gDisplayListHead++, G_CULL_BACK);
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA);
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_XLU_SURF, G_RM_AA_ZB_XLU_SURF2);
gDPSetPrimColor(gDisplayListHead++, 0, 0, 0xFF, 0xFF, 0x00, 0xFF);
// d_course_wario_stadium_packed_dl_EC0
gSPDisplayList(gDisplayListHead++, segmented_gfx_to_virtual((void*)0x07000EC0));
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 1, 1, G_OFF);
gSPSetGeometryMode(gDisplayListHead++, G_CULL_BACK);
gDPSetAlphaCompare(gDisplayListHead++, G_AC_NONE);
gDPPipeSync(gDisplayListHead++);
}
void WarioStadium::CreditsSpawnActors() {
Vec3f position;
Vec3f velocity = { 0, 0, 0 };
Vec3s rotation = { 0, 0, 0 };
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((void*)0x07000C50), 100, 255, 255, 255);
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07000C50), 0x64, 0xFF, 0xFF, 0xFF);
// d_course_wario_stadium_packed_dl_BD8
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07000BD8), 100, 255, 255, 255);
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07000BD8), 0x64, 0xFF, 0xFF, 0xFF);
// d_course_wario_stadium_packed_dl_B60
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07000B60), 100, 255, 255, 255);
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07000B60), 0x64, 0xFF, 0xFF, 0xFF);
// d_course_wario_stadium_packed_dl_AE8
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07000AE8), 100, 255, 255, 255);
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07000AE8), 0x64, 0xFF, 0xFF, 0xFF);
// d_course_wario_stadium_packed_dl_CC8
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07000CC8), 100, 255, 255, 255);
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07000CC8), 0x64, 0xFF, 0xFF, 0xFF);
// d_course_wario_stadium_packed_dl_D50
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07000D50), 100, 255, 255, 255);
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07000D50), 0x64, 0xFF, 0xFF, 0xFF);
// d_course_wario_stadium_packed_dl_DD0
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07000DD0), 100, 255, 255, 255);
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07000DD0), 0x64, 0xFF, 0xFF, 0xFF);
// d_course_wario_stadium_packed_dl_E48
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07000E48), 100, 255, 255, 255);
find_vtx_and_set_colours(segmented_gfx_to_virtual((void*)0x07000E48), 0x64, 0xFF, 0xFF, 0xFF);
}
void WarioStadium::Destroy() { }
+4 -4
View File
@@ -24,8 +24,10 @@ 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 SpawnActors() override;
virtual void SpawnVehicles() override;
virtual void InitClouds() override;
virtual void UpdateClouds(s32,Camera*) override;
virtual void MinimapSettings() override;
@@ -34,13 +36,11 @@ public:
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 BeginPlay() override;
virtual void Render(struct UnkStruct_800DC5EC*) override;
virtual void RenderCredits() override;
virtual void Collision() override;
virtual void SomeCollisionThing(Player *player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32* arg4, f32* arg5, f32* arg6, f32* arg7) override;
virtual void SpawnBombKarts() override;
virtual void GenerateCollision() 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;
};
+49 -25
View File
@@ -6,7 +6,8 @@
#include "YoshiValley.h"
#include "GameObject.h"
#include "World.h"
#include "BombKart.h"
#include "engine/actors/AFinishline.h"
#include "engine/vehicles/OBombKart.h"
#include "assets/yoshi_valley_data.h"
#include "assets/boo_frames.h"
@@ -101,6 +102,16 @@ YoshiValley::YoshiValley() {
Props.Skybox.FloorTopLeft = {95, 40, 15};
}
void YoshiValley::Load() {
Course::Load();
Lights1 lights4 = gdSPDefLights1(100, 100, 100, 255, 254, 254, 0, 0, 120);
func_802B5D64(&lights4, -0x38F0, 0x1C70, 1);
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_yoshi_valley_addr));
func_80295C6C();
D_8015F8E4 = gCourseMinY - 10.0f;
}
void YoshiValley::LoadTextures() {
dma_textures(gTextureTrees2, 0x000003E8U, 0x00000800U);
}
@@ -110,6 +121,8 @@ void YoshiValley::SpawnActors() {
Vec3f velocity = { 0.0f, 0.0f, 0.0f };
Vec3s rotation = { 0, 0, 0 };
gWorldInstance.AddActor(new AFinishline());
spawn_foliage((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_yoshi_valley_tree_spawn));
spawn_all_item_boxes((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_yoshi_valley_item_box_spawns));
vec3f_set(position, -2300.0f, 0.0f, 634.0f);
@@ -147,6 +160,30 @@ void YoshiValley::InitCourseObjects() {
}
}
void YoshiValley::SpawnVehicles() {
if (gModeSelection == VERSUS) {
// Note that the waypoint values might be unused for Yoshi's Valley. Entered them because
// the original data has values here.
// Note that the Y height is calculated automatically to place the kart on the surface
Vec3f pos = {-1533, 0, -682};
gWorldInstance.AddBombKart(pos, NULL, 0, 0, 0.8333333f);
Vec3f pos2 = {-1565, 0, -619};
gWorldInstance.AddBombKart(pos2, NULL, 10, 0, 0.8333333f);
Vec3f pos3 = {-1529, 0, -579};
gWorldInstance.AddBombKart(pos3, NULL, 20, 0, 0.8333333f);
Vec3f pos4 = {-1588, 0, -534};
gWorldInstance.AddBombKart(pos4, NULL, 30, 0, 0.8333333f);
Vec3f pos5 = {-1598, 0, -207};
gWorldInstance.AddBombKart(pos5, NULL, 40, 0, 0.8333333f);
Vec3f pos6 = {-1646, 0, -147};
gWorldInstance.AddBombKart(pos6, NULL, 50, 0, 0.8333333f);
Vec3f pos7 = {-2532, 0, -445};
gWorldInstance.AddBombKart(pos7, NULL, 60, 0, 0.8333333f);
}
}
void YoshiValley::UpdateCourseObjects() {
func_80083080();
if (gGamestate != CREDITS_SEQUENCE) {
@@ -168,27 +205,12 @@ void YoshiValley::WhatDoesThisDo(Player* player, int8_t playerId) {}
void YoshiValley::WhatDoesThisDoAI(Player* player, int8_t playerId) {}
void YoshiValley::SpawnBombKarts() {
gWorldInstance.AddObject(std::make_unique<OBombKart>(140, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(165, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(330, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(550, 1, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(595, 3, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
gWorldInstance.AddObject(std::make_unique<OBombKart>(0, 0, 0.8333333, 0, 0, 0, 0));
}
// 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::SetStaffGhost() {
}
void YoshiValley::BeginPlay() { }
void YoshiValley::Render(struct UnkStruct_800DC5EC* arg0) {
gDPPipeSync(gDisplayListHead++);
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEI, G_CC_MODULATEI);
@@ -204,18 +226,20 @@ void YoshiValley::RenderCredits() {
void YoshiValley::Collision() {}
void YoshiValley::GenerateCollision() {
Lights1 lights4 = gdSPDefLights1(100, 100, 100, 255, 254, 254, 0, 0, 120);
func_802B5D64(&lights4, -0x38F0, 0x1C70, 1);
parse_course_displaylists((TrackSectionsI*)LOAD_ASSET_RAW(d_course_yoshi_valley_addr));
func_80295C6C();
D_8015F8E4 = gCourseMinY - 10.0f;
}
void YoshiValley::Waypoints(Player* player, int8_t playerId) {
player->nearestWaypointId = gCopyNearestWaypointByPlayerId[playerId];
}
void YoshiValley::Water() {}
void YoshiValley::ScrollingTextures() {}
void YoshiValley::CreditsSpawnActors() {
Vec3f position;
Vec3f velocity = { 0, 0, 0 };
Vec3s rotation = { 0, 0, 0 };
vec3f_set(position, -2300.0f, 0.0f, 634.0f);
position[0] *= gCourseDirection;
add_actor_to_empty_slot(position, rotation, velocity, ACTOR_YOSHI_EGG);
}
void YoshiValley::Destroy() {}
+4 -5
View File
@@ -24,8 +24,10 @@ 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 SpawnActors() override;
virtual void SpawnVehicles() override;
virtual void MinimapSettings() override;
virtual void InitCourseObjects() override;
virtual void UpdateCourseObjects() override;
@@ -34,14 +36,11 @@ public:
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 BeginPlay() override;
virtual void Render(struct UnkStruct_800DC5EC*) override;
virtual void RenderCredits() override;
virtual void Collision() override;
virtual void SpawnBombKarts() override;
virtual void GenerateCollision() override;
virtual void Water() override;
virtual void ScrollingTextures() override;
virtual void Waypoints(Player* player, int8_t playerId) override;
virtual void CreditsSpawnActors() override;
virtual void Destroy() override;
};
+3
View File
@@ -0,0 +1,3 @@
# Engine
The replacement C++ engine which contains many code refactors for flexibility.
+1 -1
View File
@@ -143,7 +143,7 @@ void ABoat::Tick() {
Velocity[0] = Position[0] - temp_f26;
Velocity[1] = Position[1] - temp_f28;
Velocity[2] = Position[2] - temp_f30;
paddleBoatActor = &gActorList[ActorIndex];
paddleBoatActor = GET_ACTOR(ActorIndex);
paddleBoatActor->pos[0] = Position[0];
paddleBoatActor->pos[1] = Position[1];
paddleBoatActor->pos[2] = Position[2];
+1 -1
View File
@@ -133,7 +133,7 @@ void ABus::Tick() {
Velocity[0] = Position[0] - sp5C;
Velocity[1] = Position[1] - sp58;
Velocity[2] = Position[2] - sp54;
struct Actor* vehicleActor = &gActorList[ActorIndex];
struct Actor* vehicleActor = GET_ACTOR(ActorIndex);
vehicleActor->pos[0] = Position[0];
vehicleActor->pos[1] = Position[1];
vehicleActor->pos[2] = Position[2];
+1 -1
View File
@@ -115,7 +115,7 @@ void ACar::Tick() {
Velocity[0] = Position[0] - sp5C;
Velocity[1] = Position[1] - sp58;
Velocity[2] = Position[2] - sp54;
struct Actor* vehicleActor = &gActorList[ActorIndex];
struct Actor* vehicleActor = GET_ACTOR(ActorIndex);
vehicleActor->pos[0] = Position[0];
vehicleActor->pos[1] = Position[1];
vehicleActor->pos[2] = Position[2];
+449
View File
@@ -0,0 +1,449 @@
#include <libultraship.h>
#include "engine/vehicles/OBombKart.h"
#include <vector>
#include "port/Game.h"
#include "engine/Matrix.h"
extern "C" {
#include "macros.h"
#include "main.h"
#include "actors.h"
#include "math_util.h"
#include "sounds.h"
#include "update_objects.h"
#include "render_player.h"
#include "external.h"
#include "bomb_kart.h"
#include "collision.h"
#include "code_80086E70.h"
#include "render_objects.h"
#include "code_80057C60.h"
#include "defines.h"
#include "code_80005FD0.h"
#include "math_util_2.h"
extern s8 gPlayerCount;
}
OBombKart::OBombKart(Vec3f pos, TrackWaypoint* waypoint, uint16_t waypointIndex, uint16_t state, f32 unk_3C) {
Vec3f _pos = {0, 0, 0};
if (waypoint) { // Spawn kart on waypoint
_pos[0] = waypoint->posX;
_pos[1] = waypoint->posY;
_pos[2] = waypoint->posZ;
} else { // Spawn kart on a surface with the provided position
// Set height to the default value of 2000.0f unless Pos[1] is higher.
// This allows placing these on very high surfaces.
f32 height = (pos[1] > 2000.0f) ? pos[1] : 2000.0f;
_pos[0] = pos[0];
_pos[1] = spawn_actor_on_surface(pos[0], height, pos[2]);
_pos[2] = pos[2];
}
WaypointIndex = waypointIndex;
Unk_3C = unk_3C;
State = static_cast<States>(state);
Pos[0] = _pos[0];
Pos[1] = _pos[1];
Pos[2] = _pos[2];
CenterY = _pos[1];
WheelPos[0][0] = _pos[0];
WheelPos[0][1] = _pos[1];
WheelPos[0][2] = _pos[2];
WheelPos[1][0] = _pos[0];
WheelPos[1][1] = _pos[1];
WheelPos[1][2] = _pos[2];
WheelPos[2][0] = _pos[0];
WheelPos[2][1] = _pos[1];
WheelPos[2][2] = _pos[2];
WheelPos[3][0] = _pos[0];
WheelPos[3][1] = _pos[1];
WheelPos[3][2] = _pos[2];
check_bounding_collision(&_Collision, 2.0f, _pos[0], _pos[1], _pos[2]);
}
void OBombKart::Spawn() {
find_unused_obj_index(&ObjectIndex);
}
void OBombKart::BeginPlay() {
}
void OBombKart::Tick() {
f32 sp118;
f32 var_f18;
TrackWaypoint* temp_v0_2;
f32 temp_f0_3;
f32 sp108;
f32 temp_f14;
f32 temp_f16;
f32 temp_f0;
f32 temp_f0_4;
u16 waypoint;
f32 unk_3C;
u16 someRot;
f32 temp_f12;
f32 temp_f12_3;
f32 temp_f12_4;
f32 temp_f14_2;
f32 spAC;
f32 temp_f16_2;
f32 spA0;
f32 temp_f2;
f32 temp_f2_4;
f32 sp94;
f32 var_f20;
f32 sp88;
f32 var_f22;
f32 var_f24;
States state;
u16 bounceTimer;
UNUSED u16 sp4C;
u16 temp_t6;
u16 temp_t7;
u16 circleTimer;
TrackWaypoint* temp_v0_4;
Player* player;
state = State;
if (state == States::DISABLED) {
return;
}
if (((Unk_4A != 1) || (GetCourse() == GetPodiumCeremony()))) {
var_f22 = Pos[0];
var_f20 = Pos[1];
var_f24 = Pos[2];
waypoint = WaypointIndex;
unk_3C = Unk_3C;
someRot = SomeRot;
bounceTimer = BounceTimer;
circleTimer = CircleTimer;
if ((state != States::DISABLED) && (state != States::EXPLODE)) {
if (GetCourse() == GetPodiumCeremony()) {
if (D_8016347E == 1) {
player = gPlayerFour;
temp_f0 = var_f22 - player->pos[0];
temp_f2 = var_f20 - player->pos[1];
temp_f12 = var_f24 - player->pos[2];
if ((((temp_f0 * temp_f0) + (temp_f2 * temp_f2)) + (temp_f12 * temp_f12)) < 25.0f) {
circleTimer = 0;
state = States::EXPLODE;
player->soundEffects |= 0x400000;
player->type &= ~0x2000;
}
}
} else {
for (size_t i = 0; i < gPlayerCount; i++) {
player = &gPlayers[i];
if (!(player->effects & 0x80000000)) {
temp_f0 = var_f22 - player->pos[0];
temp_f2 = var_f20 - player->pos[1];
temp_f12 = var_f24 - player->pos[2];
if ((((temp_f0 * temp_f0) + (temp_f2 * temp_f2)) + (temp_f12 * temp_f12)) < 25.0f) {
state = States::EXPLODE;
circleTimer = 0;
if (GetCourse() == GetFrappeSnowland()) {
player->soundEffects |= 0x01000000;
} else {
player->soundEffects |= 0x400000;
}
}
}
}
}
}
switch(state) {
case States::CCW:
circleTimer = (circleTimer + 356) % 360;
temp_t6 = (circleTimer * 0xFFFF) / 360;
sp118 = coss(temp_t6) * 25.0;
temp_f0_3 = sins(temp_t6) * 25.0;
temp_v0_2 = &D_80164550[0][waypoint];
var_f22 = temp_v0_2->posX + sp118;
var_f20 = CenterY + 3.5f;
var_f24 = temp_v0_2->posZ + temp_f0_3;
D_80162FB0[0] = var_f22;
D_80162FB0[1] = var_f20;
D_80162FB0[2] = var_f24;
temp_t7 = (((circleTimer + 1) % 360) * 0xFFFF) / 360;
sp118 = coss(temp_t7) * 25.0;
temp_f0_3 = sins(temp_t7) * 25.0;
D_80162FC0[0] = temp_v0_2->posX + sp118;
D_80162FC0[1] = temp_v0_2->posY;
D_80162FC0[2] = temp_v0_2->posZ + temp_f0_3;
someRot = (get_angle_between_two_vectors(D_80162FB0, D_80162FC0) * 0xFFFF) / 65520;
break;
case States::CW:
circleTimer = (circleTimer + 4) % 360;
temp_t6 = (circleTimer * 0xFFFF) / 360;
sp118 = coss(temp_t6) * 25.0;
temp_f0_3 = sins(temp_t6) * 25.0;
temp_v0_2 = &D_80164550[0][waypoint];
var_f22 = temp_v0_2->posX + sp118;
var_f20 = CenterY + 3.5f;
var_f24 = temp_v0_2->posZ + temp_f0_3;
D_80162FB0[0] = var_f22;
D_80162FB0[1] = var_f20;
D_80162FB0[2] = var_f24;
temp_t7 = (((circleTimer + 1) % 360) * 0xFFFF) / 360;
sp118 = coss(temp_t7) * 25.0;
temp_f0_3 = sins(temp_t7) * 25.0;
D_80162FC0[0] = temp_v0_2->posX + sp118;
D_80162FC0[1] = temp_v0_2->posY;
D_80162FC0[2] = temp_v0_2->posZ + temp_f0_3;
someRot = (get_angle_between_two_vectors(D_80162FB0, D_80162FC0) * 0xFFFF) / 65520;
break;
case States::STATIONARY:
var_f20 = CenterY + 3.5f;
someRot = 0;
break;
case States::PODIUM_CEREMONY:
if ((D_8016347C == 0) || (gNearestWaypointByPlayerId[3] < 5)) {
break;
} else {
waypoint = func_8000D2B4(var_f22, var_f20, var_f24, waypoint, 3);
if ((waypoint < 0) || (gWaypointCountByPathIndex[3] < waypoint)) {
waypoint = 0;
}
if (((s32) waypoint) < 0x1A) {
temp_v0_2 = &D_80164550[3][(waypoint + 1) % gWaypointCountByPathIndex[3]];
D_80162FB0[0] = temp_v0_2->posX;
D_80162FB0[1] = temp_v0_2->posY;
D_80162FB0[2] = temp_v0_2->posZ;
temp_v0_4 = &D_80164550[3][(waypoint + 2) % gWaypointCountByPathIndex[3]];
D_80162FC0[0] = temp_v0_4->posX;
D_80162FC0[1] = temp_v0_4->posY;
D_80162FC0[2] = temp_v0_4->posZ;
someRot = (get_angle_between_two_vectors(D_80162FB0, D_80162FC0) * 0xFFFF) / 65520;
} else {
D_80162FB0[0] = var_f22;
D_80162FB0[1] = var_f20;
D_80162FB0[2] = var_f24;
D_80162FC0[0] = -2409.197f;
D_80162FC0[1] = 0.0f;
D_80162FC0[2] = -355.254f;
someRot = (get_angle_between_two_vectors(D_80162FB0, D_80162FC0) * 0xFFFF) / 65520;
}
temp_f14 = ((D_80162FB0[0] + D_80162FC0[0]) * 0.5f) - var_f22;
temp_f16 = ((D_80162FB0[2] + D_80162FC0[2]) * 0.5f) - var_f24;
temp_f0_4 = sqrtf((temp_f14 * temp_f14) + (temp_f16 * temp_f16));
if (temp_f0_4 > 0.01f) {
var_f22 += (Unk_3C * temp_f14) / temp_f0_4;
var_f24 += (Unk_3C * temp_f16) / temp_f0_4;
} else {
var_f22 += temp_f14 / 5.0f;
var_f24 += temp_f16 / 5.0f;
}
var_f20 = calculate_surface_height(var_f22, 2000.0f, var_f24, _Collision.meshIndexZX) + 3.5f;
if (var_f20 < (-1000.0)) {
var_f20 = Pos[1];
}
check_bounding_collision(&_Collision, 10.0f, var_f22, var_f20, var_f24);
}
break;
case States::EXPLODE:
temp_v0_2 = &D_80164550[0][waypoint];
D_80162FB0[0] = temp_v0_2->posX;
D_80162FB0[1] = temp_v0_2->posY;
D_80162FB0[2] = temp_v0_2->posZ;
temp_v0_4 = &D_80164550[0][(waypoint + 1) % gWaypointCountByPathIndex[0]];
D_80162FC0[0] = temp_v0_4->posX;
D_80162FC0[1] = temp_v0_4->posY;
D_80162FC0[2] = temp_v0_4->posZ;
var_f20 += 3.0f - (circleTimer * 0.3f);
someRot = (get_angle_between_two_vectors(D_80162FB0, D_80162FC0) * 0xFFFF) / 65520;
break;
default:
break;
}
if (state == States::EXPLODE) {
sp108 = 2.0f * circleTimer;
sp118 = coss(0xFFFF - someRot) * circleTimer;
var_f18 = sins(0xFFFF - someRot) * circleTimer;
circleTimer++;
temp_f2_4 = (var_f20 - 2.3f) + (sp108 / 3.0f);
spAC = temp_f2_4;
spA0 = temp_f2_4;
sp94 = temp_f2_4;
sp88 = temp_f2_4;
if (circleTimer >= 31) {
state = States::DISABLED;
}
} else {
sp118 = coss(0xFFFF - someRot) * 1.5f;
var_f18 = sins(0xFFFF - someRot) * 1.5f;
temp_f16_2 = var_f20 - 2.3f;
temp_f12_3 = (bounceTimer % 3) * 0.15f;
temp_f14_2 = temp_f16_2 - temp_f12_3;
temp_f12_4 = temp_f16_2 + temp_f12_3;
spAC = temp_f14_2;
sp94 = temp_f14_2;
spA0 = temp_f12_4;
sp88 = temp_f12_4;
var_f20 += sins((bounceTimer * 0x13FFEC) / 360);
bounceTimer = (bounceTimer + 1) % 18;
}
WheelPos[0][0] = (sp118 - var_f18) + var_f22;
WheelPos[0][1] = spAC;
WheelPos[0][2] = (var_f18 + sp118) + var_f24;
WheelPos[1][0] = (var_f18 + sp118) + var_f22;
WheelPos[1][1] = spA0;
WheelPos[1][2] = (var_f18 - sp118) + var_f24;
WheelPos[2][0] = ((-sp118) - var_f18) + var_f22;
WheelPos[2][1] = sp94;
WheelPos[2][2] = ((-var_f18) + sp118) + var_f24;
WheelPos[3][0] = ((-sp118) + var_f18) + var_f22;
WheelPos[3][1] = sp88;
WheelPos[3][2] = ((-var_f18) - sp118) + var_f24;
Pos[0] = var_f22;
Pos[1] = var_f20;
Pos[2] = var_f24;
WaypointIndex = waypoint;
Unk_3C = unk_3C;
SomeRot = someRot;
State = state;
BounceTimer = bounceTimer;
CircleTimer = circleTimer;
}
}
void OBombKart::Draw(s32 cameraId) {
if (gModeSelection == BATTLE) {
return;
}
if (GetCourse() == GetPodiumCeremony()) {
// This isn't functionally equivallent.
// Technicaly it should be if (kart[0].WaypointIndex < 16)
if (WaypointIndex < 16) {
return;
} else {
cameraId = PLAYER_FOUR;
}
}
Camera* camera;
s32 temp_s4;
s32 i;
s32 state;
if (gGamestate == ENDING) {
cameraId = 0;
}
camera = &camera1[cameraId];
if (cameraId == PLAYER_ONE) {
if (is_obj_flag_status_active(ObjectIndex, 0x00200000) != 0) {
Unk_4A = 0;
} else if (gGamestate != ENDING) {
Unk_4A = 1;
}
set_object_flag_status_false(ObjectIndex, 0x00200000);
}
// huh???
state = State;
if (State != States::DISABLED) {
gObjectList[ObjectIndex].pos[0] = Pos[0];
gObjectList[ObjectIndex].pos[1] = Pos[1];
gObjectList[ObjectIndex].pos[2] = Pos[2];
temp_s4 = func_8008A364(ObjectIndex, cameraId, 0x31C4U, 0x000001F4);
if (is_obj_flag_status_active(ObjectIndex, VISIBLE) != 0) {
set_object_flag_status_true(ObjectIndex, 0x00200000);
D_80183E80[0] = 0;
D_80183E80[1] = func_800418AC(Pos[0], Pos[2], camera->pos);
D_80183E80[2] = 0x8000;
func_800563DC(ObjectIndex, cameraId, 0x000000FF);
OBombKart::SomeRender(camera->pos);
if (((u32) temp_s4 < 0x4E21U) && (state != BOMB_STATE_EXPLODED)) {
OBombKart::LoadMtx();
}
}
}
}
void OBombKart::DrawBattle(s32 cameraId) {
if (gModeSelection != BATTLE) {
return;
}
Player* temp_v0;
s32 temp_s1;
s32 playerId;
Object* object;
for (playerId = 0; playerId < gPlayerCount; playerId++) {
object = &gObjectList[ObjectIndex];
if (object->state != 0) {
temp_s1 = object->primAlpha;
temp_v0 = &gPlayerOne[playerId];
object->pos[0] = temp_v0->pos[0];
object->pos[1] = temp_v0->pos[1] - 2.0;
object->pos[2] = temp_v0->pos[2];
object->surfaceHeight = temp_v0->unk_074;
func_800563DC(ObjectIndex, cameraId, temp_s1);
func_8005669C(ObjectIndex, cameraId, temp_s1);
func_800568A0(ObjectIndex, cameraId);
}
}
}
void OBombKart::SomeRender(Vec3f arg1) {
D_80183E80[0] = 0;
D_80183E80[2] = 0x8000;
gSPDisplayList(gDisplayListHead++, (Gfx*)D_0D0079C8);
load_texture_block_rgba16_mirror((u8*) D_0D02AA58, 0x00000010, 0x00000010);
D_80183E80[1] = func_800418AC(WheelPos[0][0], WheelPos[0][2], arg1);
func_800431B0(WheelPos[0], D_80183E80, 0.15f, (Vtx*)common_vtx_rectangle);
D_80183E80[1] = func_800418AC(WheelPos[1][0], WheelPos[1][2], arg1);
func_800431B0(WheelPos[1], D_80183E80, 0.15f, (Vtx*)common_vtx_rectangle);
D_80183E80[1] = func_800418AC(WheelPos[2][0], WheelPos[2][2], arg1);
func_800431B0(WheelPos[2], D_80183E80, 0.15f, (Vtx*)common_vtx_rectangle);
D_80183E80[1] = func_800418AC(WheelPos[3][0], WheelPos[3][2], arg1);
func_800431B0(WheelPos[3], D_80183E80, 0.15f, (Vtx*)common_vtx_rectangle);
gSPTexture(gDisplayListHead++, 1, 1, 0, G_TX_RENDERTILE, G_OFF);
}
void OBombKart::LoadMtx() {
Mat4 mat;
D_80183E50[0] = Pos[0];
D_80183E50[1] = CenterY + 1.0;
D_80183E50[2] = Pos[2];
set_transform_matrix(mat, _Collision.orientationVector, D_80183E50, 0U, 0.5f);
//convert_to_fixed_point_matrix(&gGfxPool->mtxHud[gMatrixHudCount], mat);
AddHudMatrix(mat, G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW);
// gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxHud[gMatrixHudCount++]),
// G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW);
gSPDisplayList(gDisplayListHead++, (Gfx*)D_0D007B98);
}
void OBombKart::Waypoint(s32 screenId) {
s32 playerWaypoint;
s32 bombWaypoint;
s32 waypointDiff;
playerWaypoint = gNearestWaypointByPlayerId[screenId];
playerHUD[screenId].unk_74 = 0;
if ((State == States::EXPLODE) || (State == States::DISABLED)) { return; };
bombWaypoint = WaypointIndex;
waypointDiff = bombWaypoint - playerWaypoint;
if ((waypointDiff < -5) || (waypointDiff > 0x1E)) { return; };
playerHUD[screenId].unk_74 = 1;
}
void OBombKart::Collision(s32 playerId, Player* player) {
}
+64
View File
@@ -0,0 +1,64 @@
#pragma once
#include <libultraship.h>
#include "Vehicle.h"
#include <vector>
#include "engine/Matrix.h"
extern "C" {
#include "macros.h"
#include "main.h"
#include "vehicles.h"
#include "waypoints.h"
#include "common_structs.h"
#include "objects.h"
}
/**
* Used in VS mode
*
* This differs from the other vehicle classes in that it does not get added to the standard actor list
* So this is sort of its own thing. Draw call in different place too.
*/
class OBombKart {
private:
enum States : uint16_t { // 0,1,3,5
DISABLED,
CCW,
CW,
STATIONARY,
EXPLODE,
PODIUM_CEREMONY,
};
public:
const char* Type;
Vec3f Pos;
Vec3f WheelPos[4]; //! @todo Turn WheelPos into a struct
f32 Unk_3C;
u16 SomeRot; // Some angle
u16 WaypointIndex; // The waypoint the kart circles
States State = States::DISABLED;
u16 BounceTimer = 0;
u16 CircleTimer = 0;
u16 Unk_4A = 0;
s16 Unk_4C = 1;
f32 CenterY; // Center of the circle
s32 ObjectIndex = 0; // Index into gObjectList
Collision _Collision;
// Set waypoint to NULL if using a spawn position and not a waypoint.
explicit OBombKart(Vec3f pos, TrackWaypoint* waypoint, uint16_t waypointIndex, uint16_t state, f32 unk_3C);
void Spawn();
void BeginPlay();
void Tick();
void Draw(s32 playerId);
void DrawBattle(s32 cameraId);
void Collision(s32 playerId, Player* player);
void SomeRender(Vec3f arg1);
void LoadMtx();
void Waypoint(s32 screenId);
};
+1 -1
View File
@@ -133,7 +133,7 @@ void ATankerTruck::Tick() {
Velocity[0] = Position[0] - sp5C;
Velocity[1] = Position[1] - sp58;
Velocity[2] = Position[2] - sp54;
struct Actor* vehicleActor = &gActorList[ActorIndex];
struct Actor* vehicleActor = GET_ACTOR(ActorIndex);
vehicleActor->pos[0] = Position[0];
vehicleActor->pos[1] = Position[1];
vehicleActor->pos[2] = Position[2];

Some files were not shown because too many files have changed in this diff Show More