make some texture more flexible and editable + port documentation from the decomp + fix some bug (#309)

* support a more flexible background

* remove useless function

* rename of some font

* experimental png

* migrate to the new initdata

* fix skybox and adjust minimap

* format in audio

* simplify player render

* simplify shell render and support custom texture of shell

* clean redshell texture

* format and multiple fix

* some update of name

* allow change icon of character

* more rename

* continue rename

* more documentation and simplification

* change lus and continue rename

* continue rename

* few fix for asan

* fix ghost

* Update menu_items.c

* fix mac error

* some test of tweak for texture

* some tweak

* some button constant

* finish fix ghost

* Update menu_items.c

* Update render_objects.c

* Update menu_items.c

* Update libultraship

* Update libultraship

* Delete valgrind.report

* Update libultraship

* callgrind benchmark

* Update valgrind_callgrind.sh

* fix animation

* some rename

* remove useless submodule

* Update libultraship

* fix assets

* fix mistake

* fix more mistake

* Update menu_items.c

* sync more rename with the decom + fix review

* fix a mistake

* fix more mistake

* re add the limit of fps

* fix some hd texture and minimap

* fix a name

* Update menu_items.c

* fix a regression

* fix some segment 5 texture (not all)

* Update camera.c

* improve performance of custom sprite

* fix flatten bug and add documentation on player vertex

* Update render_player.c

* fix data menu

* fix trophy for 50 and 150

* Update memory.c

* Update code_80057C60.c

* fix ghost

* fix boo tlut

* fix a mistake in yaml

* fix yaml

* Update common_data.yml

* add comment for segment 3

* allow even more change in texture

* Update common_data.yml

* Update update.inc.c

* Update camera.c

* Update some_data.c

* wip changes

* Update other_textures.yml

* More changes

* Update update_objects.c

* Fix compile

* Update memory.c

* Update memory.c

---------

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>
This commit is contained in:
coco875
2025-07-01 23:42:14 +00:00
committed by GitHub
parent b57afa83b4
commit 7937896598
117 changed files with 5726 additions and 5481 deletions
+10 -9
View File
@@ -42,7 +42,8 @@ void World::SetCourseFromCup() {
CurrentCourse = CurrentCup->GetCourse();
}
TrainCrossing* World::AddCrossing(Vec3f position, u32 waypointMin, u32 waypointMax, f32 approachRadius, f32 exitRadius) {
TrainCrossing* World::AddCrossing(Vec3f position, u32 waypointMin, u32 waypointMax, f32 approachRadius,
f32 exitRadius) {
auto crossing = std::make_shared<TrainCrossing>(position, waypointMin, waypointMax, approachRadius, exitRadius);
Crossings.push_back(crossing);
return crossing.get();
@@ -160,7 +161,7 @@ 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*));
return reinterpret_cast<AActor*>((char*) actor - sizeof(void*));
}
/**
@@ -169,7 +170,7 @@ AActor* World::ConvertActorToAActor(Actor* actor) {
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*));
return reinterpret_cast<Actor*>((char*) actor + sizeof(void*));
}
AActor* World::GetActor(size_t index) {
@@ -236,7 +237,7 @@ void World::TickObjects() {
// This is a fallback to support those objects. Probably don't use this.
void World::TickObjects60fps() {
for (const auto& object : Objects) {
object->Tick60fps();
object->Tick60fps();
}
}
@@ -247,19 +248,19 @@ ParticleEmitter* World::AddEmitter(ParticleEmitter* emitter) {
void World::DrawObjects(s32 cameraId) {
for (const auto& object : Objects) {
object->Draw(cameraId);
object->Draw(cameraId);
}
}
void World::TickParticles() {
for (const auto& emitter : Emitters) {
emitter->Tick();
emitter->Tick();
}
}
void World::DrawParticles(s32 cameraId) {
for (const auto& emitter : Emitters) {
emitter->Draw(cameraId);
emitter->Draw(cameraId);
}
}
@@ -271,8 +272,8 @@ void World::Reset() {
}
Object* World::GetObjectByIndex(size_t index) {
//if (index < this->Objects.size()) {
// Assuming GameActor::a is accessible, use reinterpret_cast if needed
// if (index < this->Objects.size()) {
// Assuming GameActor::a is accessible, use reinterpret_cast if needed
// return reinterpret_cast<Object*>(&this->Objects[index]->o);
//}
return nullptr; // Or handle the error as needed
+51 -47
View File
@@ -23,7 +23,7 @@ ACloud::ACloud(FVector pos) {
Rot[1] = 0;
Rot[2] = 0;
//Flags = -0x8000 | 0x4000;
// Flags = -0x8000 | 0x4000;
BoundingBoxSize = 2.0f;
}
@@ -48,7 +48,7 @@ void ACloud::Tick() {
extern Gfx cloud_mesh[];
void ACloud::Draw(Camera *camera) {
void ACloud::Draw(Camera* camera) {
Mat4 mtx;
if (PickedUp) {
@@ -58,14 +58,14 @@ void ACloud::Draw(Camera *camera) {
mtxf_pos_rotation_xyz(mtx, Pos, Rot);
if (render_set_position(mtx, 0) != 0) {
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
gSPDisplayList(gDisplayListHead++, (Gfx*)cloud_mesh);
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 has picked up the actor, activate the cloud effect
_player = player;
PickedUp = true;
@@ -77,61 +77,65 @@ void ACloud::Collision(Player* player, AActor* actor) {
}
}
bool ACloud::IsMod() { return true; }
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} }},
{ { { 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} }},
{ { { 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(),
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(),
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, gGroundDust),
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(),
// 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(),
};
+5 -1
View File
@@ -69,7 +69,7 @@ BansheeBoardwalk::BansheeBoardwalk() {
this->gfx = d_course_banshee_boardwalk_packed_dls;
this->gfxSize = 3689;
Props.textures = banshee_boardwalk_textures;
Props.Minimap.Texture = gTextureCourseOutlineBansheeBoardwalk;
Props.Minimap.Texture = minimap_banshee_boardwalk;
Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture);
Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture);
Props.Minimap.Pos[0].X = 262;
@@ -79,6 +79,7 @@ BansheeBoardwalk::BansheeBoardwalk() {
Props.Minimap.PlayerScaleFactor = 0.016f;
Props.Minimap.FinishlineX = 0;
Props.Minimap.FinishlineY = 0;
ResizeMinimap(&Props.Minimap);
Id = "mk:banshee_boardwalk";
@@ -140,6 +141,9 @@ BansheeBoardwalk::BansheeBoardwalk() {
Props.Sequence = MusicSeq::MUSIC_SEQ_BANSHEE_BOARDWALK;
Props.WaterLevel = -80.0f;
for (size_t i = 0; i < 100; i++) {
replace_segmented_textures_with_o2r_textures((Gfx*) banshee_boardwalk_dls[i], Props.textures);
}
}
void BansheeBoardwalk::Load() {
+2 -1
View File
@@ -43,7 +43,7 @@ BigDonut::BigDonut() {
this->gfx = d_course_big_donut_packed_dls;
this->gfxSize = 528;
Props.textures = big_donut_textures;
Props.Minimap.Texture = gTextureCourseOutlineBigDonut;
Props.Minimap.Texture = minimap_big_donut;
Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture);
Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture);
Props.Minimap.Pos[0].X = 257;
@@ -53,6 +53,7 @@ BigDonut::BigDonut() {
Props.Minimap.PlayerScaleFactor = 0.0257f;
Props.Minimap.FinishlineX = 0;
Props.Minimap.FinishlineY = 0;
ResizeMinimap(&Props.Minimap);
Props.SetText(Props.Name, "big donut", sizeof(Props.Name));
Props.SetText(Props.DebugName, "doughnut", sizeof(Props.DebugName));
+2 -1
View File
@@ -45,7 +45,7 @@ BlockFort::BlockFort() {
this->gfx = d_course_block_fort_packed_dls;
this->gfxSize = 699;
Props.textures = block_fort_textures;
Props.Minimap.Texture = gTextureCourseOutlineBlockFort;
Props.Minimap.Texture = minimap_block_fort;
Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture);
Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture);
Props.Minimap.Pos[0].X = 257;
@@ -55,6 +55,7 @@ BlockFort::BlockFort() {
Props.Minimap.PlayerScaleFactor = 0.0335f;
Props.Minimap.FinishlineX = 0;
Props.Minimap.FinishlineY = 0;
ResizeMinimap(&Props.Minimap);
Props.SetText(Props.Name, "block fort", sizeof(Props.Name));
Props.SetText(Props.DebugName, "block", sizeof(Props.DebugName));
+6 -2
View File
@@ -72,7 +72,7 @@ BowsersCastle::BowsersCastle() {
this->gfx = d_course_bowsers_castle_packed_dls;
this->gfxSize = 4900;
Props.textures = bowsers_castle_textures;
Props.Minimap.Texture = gTextureCourseOutlineBowsersCastle;
Props.Minimap.Texture = minimap_bowsers_castle;
Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture);
Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture);
Props.Minimap.Pos[0].X = 265;
@@ -82,6 +82,7 @@ BowsersCastle::BowsersCastle() {
Props.Minimap.PlayerScaleFactor = 0.0174f;
Props.Minimap.FinishlineX = 0;
Props.Minimap.FinishlineY = 0;
ResizeMinimap(&Props.Minimap);
Id = "mk:bowsers_castle";
@@ -144,6 +145,9 @@ BowsersCastle::BowsersCastle() {
Props.WaterLevel = -50.0f;
WaterVolumes.push_back({20.0f, 1549.0f, 1859.0f, -1402.0f, -1102.0f});
for (size_t i = 0; i < 108; i++) {
replace_segmented_textures_with_o2r_textures((Gfx*) bowsers_castle_dls[i], Props.textures);
}
}
void BowsersCastle::Load() {
@@ -155,7 +159,7 @@ void BowsersCastle::Load() {
}
void BowsersCastle::LoadTextures() {
dma_textures(gTextureShrub, 0x000003FFU, 0x00000800U);
dma_textures(gTextureShrub, 0x000003FFU, 0x00000800U); // 0x03009000
}
// Required for the 2 thwomps that go far
+5 -1
View File
@@ -64,7 +64,7 @@ ChocoMountain::ChocoMountain() {
this->gfx = d_course_choco_mountain_packed_dls;
this->gfxSize = 2910;
Props.textures = choco_mountain_textures;
Props.Minimap.Texture = gTextureCourseOutlineChocoMountain;
Props.Minimap.Texture = minimap_choco_mountain;
Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture);
Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture);
Props.Minimap.Pos[0].X = 265;
@@ -74,6 +74,7 @@ ChocoMountain::ChocoMountain() {
Props.Minimap.PlayerScaleFactor = 0.022f;
Props.Minimap.FinishlineX = 0;
Props.Minimap.FinishlineY = -16.0;
ResizeMinimap(&Props.Minimap);
Id = "mk:choco_mountain";
Props.SetText(Props.Name, "choco mountain", sizeof(Props.Name));
@@ -134,6 +135,9 @@ ChocoMountain::ChocoMountain() {
Props.Sequence = MusicSeq::MUSIC_SEQ_CHOCO_MOUNTAIN;
Props.WaterLevel = -80.0f;
for (size_t i = 0; i < 96; i++) {
replace_segmented_textures_with_o2r_textures((Gfx*) choco_mountain_dls[i], Props.textures);
}
}
void ChocoMountain::Load() {
+25 -14
View File
@@ -27,6 +27,16 @@ extern "C" {
extern StaffGhost* d_mario_raceway_staff_ghost;
}
void ResizeMinimap(MinimapProps* minimap) {
if (minimap->Height < minimap->Width) {
minimap->Width = (minimap->Width * 64) / minimap->Height;
minimap->Height = 64;
} else {
minimap->Height = (minimap->Height * 64) / minimap->Width;
minimap->Width = 64;
}
}
Course::Course() {
Props.SetText(Props.Name, "Blank Track", sizeof(Props.Name));
Props.SetText(Props.DebugName, "blnktrck", sizeof(Props.DebugName));
@@ -34,7 +44,7 @@ Course::Course() {
// Props.Cup = FLOWER_CUP;
// Props.CupIndex = 3;
Id = "";
Props.Minimap.Texture = gTextureCourseOutlineMarioRaceway;
Props.Minimap.Texture = minimap_mario_raceway;
Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture);
Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture);
Props.Minimap.Pos[0].X = 257;
@@ -44,7 +54,8 @@ Course::Course() {
Props.Minimap.PlayerScaleFactor = 0.22f;
Props.Minimap.FinishlineX = 0;
Props.Minimap.FinishlineY = 0;
Props.Minimap.Colour = {255, 255, 255};
Props.Minimap.Colour = { 255, 255, 255 };
Props.WaterLevel = FLT_MAX;
Props.LakituTowType = (s32) OLakitu::LakituTowType::NORMAL;
@@ -117,11 +128,11 @@ void Course::LoadO2R(std::string trackPath) {
for (auto& path : paths) {
if (i == 0) {
Props.PathSizes.unk0 = path.size();
Props.PathTable[0] = (TrackPathPoint*)path.data();
Props.PathTable[0] = (TrackPathPoint*) path.data();
Props.PathTable[1] = NULL;
Props.PathTable[2] = NULL;
Props.PathTable[3] = NULL;
Props.PathTable2[0] = (TrackPathPoint*)path.data();
Props.PathTable2[0] = (TrackPathPoint*) path.data();
Props.PathTable2[1] = NULL;
Props.PathTable2[2] = NULL;
Props.PathTable2[3] = NULL;
@@ -142,7 +153,7 @@ void Course::Load() {
// Load from O2R
if (!TrackSectionsPtr.empty()) {
bIsMod = true;
//auto res = std::dynamic_pointer_cast<MK64::TrackSectionsO2RClass>(ResourceLoad(TrackSectionsPtr.c_str()));
// auto res = std::dynamic_pointer_cast<MK64::TrackSectionsO2RClass>(ResourceLoad(TrackSectionsPtr.c_str()));
TrackSectionsO2R* sections = (TrackSectionsO2R*) LOAD_ASSET_RAW(TrackSectionsPtr.c_str());
size_t size = ResourceGetSizeByName(TrackSectionsPtr.c_str());
@@ -224,8 +235,9 @@ void Course::ParseCourseSections(TrackSectionsO2R* sections, size_t size) {
} else {
D_8015F5A4 = 0;
}
printf("LOADING DL %s\n", sections[i].addr.c_str());
generate_collision_mesh((Gfx*)LOAD_ASSET_RAW(sections[i].addr.c_str()), sections[i].surfaceType, sections[i].sectionId);
printf("LOADING DL %s\n", sections[i].addr.c_str());
generate_collision_mesh((Gfx*) LOAD_ASSET_RAW(sections[i].addr.c_str()), sections[i].surfaceType,
sections[i].sectionId);
}
}
@@ -235,8 +247,8 @@ void Course::TestPath() {
s16 x;
s16 y;
s16 z;
Vec3s rot = {0, 0, 0};
Vec3f vel = {0, 0, 0};
Vec3s rot = { 0, 0, 0 };
Vec3f vel = { 0, 0, 0 };
for (size_t i = 0; i < gPathCountByPathIndex[0]; i++) {
x = gTrackPaths[0][i].posX;
@@ -248,7 +260,7 @@ void Course::TestPath() {
}
f32 height = spawn_actor_on_surface(x, 2000.0f, z);
Vec3f itemPos = {x, height, z};
Vec3f itemPos = { x, height, z };
add_actor_to_empty_slot(itemPos, rot, vel, ACTOR_ITEM_BOX);
}
}
@@ -354,10 +366,10 @@ void Course::Render(struct UnkStruct_800DC5EC* arg0) {
// d_course_big_donut_packed_dl_DE8
}
TrackSectionsO2R* sections = (TrackSectionsO2R*)LOAD_ASSET_RAW(TrackSectionsPtr.c_str());
TrackSectionsO2R* sections = (TrackSectionsO2R*) LOAD_ASSET_RAW(TrackSectionsPtr.c_str());
size_t size = ResourceGetSizeByName(TrackSectionsPtr.c_str());
for (size_t i = 0; i < (size / sizeof(TrackSectionsO2R)); i++) {
gSPDisplayList(gDisplayListHead++, (Gfx*)LOAD_ASSET_RAW(sections[i].addr.c_str()));
gSPDisplayList(gDisplayListHead++, (Gfx*) LOAD_ASSET_RAW(sections[i].addr.c_str()));
}
}
}
@@ -370,8 +382,7 @@ f32 Course::GetWaterLevel(FVector pos, Collision* collision) {
bool found = false;
for (const auto& volume : gWorldInstance.CurrentCourse->WaterVolumes) {
if (pos.x >= volume.MinX && pos.x <= volume.MaxX &&
pos.z >= volume.MinZ && pos.z <= volume.MaxZ) {
if (pos.x >= volume.MinX && pos.x <= volume.MaxX && pos.z >= volume.MinZ && pos.z <= volume.MaxZ) {
// Choose the highest water volume the player is over
if (!found || volume.Height > highestWater) {
highestWater = volume.Height;
+2
View File
@@ -61,6 +61,8 @@ typedef struct MinimapProps {
RGB8 Colour; // Colour of the visible pixels (the track path)
} MinimapProps;
void ResizeMinimap(MinimapProps* minimap);
typedef struct Properties {
char Name[128];
char DebugName[128];
+8 -4
View File
@@ -73,7 +73,7 @@ DKJungle::DKJungle() {
this->gfx = d_course_dks_jungle_parkway_packed_dls;
this->gfxSize = 4997;
Props.textures = dks_jungle_parkway_textures;
Props.Minimap.Texture = gTextureCourseOutlineDksJungleParkway;
Props.Minimap.Texture = minimap_dks_jungle_parkway;
Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture);
Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture);
Props.Minimap.Pos[0].X = 255;
@@ -83,6 +83,7 @@ DKJungle::DKJungle() {
Props.Minimap.PlayerScaleFactor = 0.0155f;
Props.Minimap.FinishlineX = 0;
Props.Minimap.FinishlineY = 0;
ResizeMinimap(&Props.Minimap);
Props.SetText(Props.Name, "d.k.'s jungle parkway", sizeof(Props.Name));
Props.SetText(Props.DebugName, "jungle", sizeof(Props.DebugName));
@@ -142,6 +143,9 @@ DKJungle::DKJungle() {
Props.Sequence = MusicSeq::MUSIC_SEQ_DK_JUNGLE;
Props.WaterLevel = -475.0f;
for (size_t i = 0; i < 104; i++) {
replace_segmented_textures_with_o2r_textures((Gfx*) d_course_dks_jungle_parkway_unknown_dl_list[i], Props.textures);
}
}
void DKJungle::Load() {
@@ -185,9 +189,9 @@ f32 DKJungle::GetWaterLevel(FVector pos, Collision* collision) {
}
void DKJungle::LoadTextures() {
dma_textures(gTextureDksJungleParkwayKiwanoFruit1, 0x0000032FU, 0x00000400U);
dma_textures(gTextureDksJungleParkwayKiwanoFruit2, 0x00000369U, 0x00000400U);
dma_textures(gTextureDksJungleParkwayKiwanoFruit3, 0x00000364U, 0x00000400U);
dma_textures(gTextureDksJungleParkwayKiwanoFruit1, 0x0000032FU, 0x00000400U); // 0x03009000
dma_textures(gTextureDksJungleParkwayKiwanoFruit2, 0x00000369U, 0x00000400U); // 0x03009800
dma_textures(gTextureDksJungleParkwayKiwanoFruit3, 0x00000364U, 0x00000400U); // 0x0300A000
}
void DKJungle::BeginPlay() {
+2 -1
View File
@@ -43,7 +43,7 @@ DoubleDeck::DoubleDeck() {
this->gfx = d_course_double_deck_packed_dls;
this->gfxSize = 699;
Props.textures = double_deck_textures;
Props.Minimap.Texture = gTextureCourseOutlineDoubleDeck;
Props.Minimap.Texture = minimap_double_deck;
Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture);
Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture);
Props.Minimap.Pos[0].X = 257;
@@ -53,6 +53,7 @@ DoubleDeck::DoubleDeck() {
Props.Minimap.PlayerScaleFactor = 0.0285f;
Props.Minimap.FinishlineX = 0;
Props.Minimap.FinishlineY = 0;
ResizeMinimap(&Props.Minimap);
Props.SetText(Props.Name, "double deck", sizeof(Props.Name));
Props.SetText(Props.DebugName, "deck", sizeof(Props.DebugName));
+7 -3
View File
@@ -52,7 +52,7 @@ FrappeSnowland::FrappeSnowland() {
this->gfx = d_course_frappe_snowland_packed_dls;
this->gfxSize = 4140;
Props.textures = frappe_snowland_textures;
Props.Minimap.Texture = gTextureCourseOutlineFrappeSnowland;
Props.Minimap.Texture = minimap_frappe_snowland;
Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture);
Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture);
Props.Minimap.Pos[0].X = 262;
@@ -63,6 +63,7 @@ FrappeSnowland::FrappeSnowland() {
Props.Minimap.FinishlineX = 0;
Props.Minimap.FinishlineY = 0;
Props.Minimap.Colour = {72, 100, 255};
ResizeMinimap(&Props.Minimap);
Props.SetText(Props.Name, "frappe snowland", sizeof(Props.Name));
Props.SetText(Props.DebugName, "snow", sizeof(Props.DebugName));
@@ -122,6 +123,9 @@ FrappeSnowland::FrappeSnowland() {
Props.Sequence = MusicSeq::MUSIC_SEQ_FRAPPE_SNOWLAND;
Props.WaterLevel = -50.0f;
for (size_t i = 0; i < 68; i++) {
replace_segmented_textures_with_o2r_textures((Gfx*) d_course_frappe_snowland_dl_list[i], Props.textures);
}
}
void FrappeSnowland::Load() {
@@ -132,8 +136,8 @@ void FrappeSnowland::Load() {
}
void FrappeSnowland::LoadTextures() {
dma_textures(gTextureFrappeSnowlandTreeLeft, 0x00000454U, 0x00000800U);
dma_textures(gTextureFrappeSnowlandTreeRight, 0x00000432U, 0x00000800U);
dma_textures(gTextureFrappeSnowlandTreeLeft, 0x00000454U, 0x00000800U); // 0x03009000
dma_textures(gTextureFrappeSnowlandTreeRight, 0x00000432U, 0x00000800U); // 0x03009800
}
void FrappeSnowland::BeginPlay() {
+12 -11
View File
@@ -519,7 +519,7 @@ TrackPathPoint harbour_path[] = {
Harbour::Harbour() {
this->gfxSize = 100;
this->textures = NULL;
Props.Minimap.Texture = gTextureCourseOutlineMarioRaceway;
Props.Minimap.Texture = minimap_mario_raceway;
Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture);
Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture);
Props.Minimap.Pos[0].X = 260;
@@ -527,6 +527,7 @@ Harbour::Harbour() {
Props.Minimap.PlayerX = 6;
Props.Minimap.PlayerY = 28;
Props.Minimap.PlayerScaleFactor = 0.022f;
ResizeMinimap(&Props.Minimap);
Id = "mk:harbour";
Props.SetText(Props.Name, "Harbour", sizeof(Props.Name));
@@ -618,16 +619,16 @@ void Harbour::Load() {
}
void Harbour::LoadTextures() {
dma_textures(gTextureTrees1, 0x0000035BU, 0x00000800U);
D_802BA058 = dma_textures(gTexturePiranhaPlant1, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant2, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant3, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant4, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant5, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant6, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant7, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant8, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant9, 0x000003E8U, 0x00000800U);
dma_textures(gTextureTrees1, 0x0000035BU, 0x00000800U); // 0x03009000
D_802BA058 = dma_textures(gTexturePiranhaPlant1, 0x000003E8U, 0x00000800U); // 0x03009800
dma_textures(gTexturePiranhaPlant2, 0x000003E8U, 0x00000800U); // 0x0300A000
dma_textures(gTexturePiranhaPlant3, 0x000003E8U, 0x00000800U); // 0x0300A800
dma_textures(gTexturePiranhaPlant4, 0x000003E8U, 0x00000800U); // 0x0300B000
dma_textures(gTexturePiranhaPlant5, 0x000003E8U, 0x00000800U); // 0x0300B800
dma_textures(gTexturePiranhaPlant6, 0x000003E8U, 0x00000800U); // 0x0300C000
dma_textures(gTexturePiranhaPlant7, 0x000003E8U, 0x00000800U); // 0x0300C800
dma_textures(gTexturePiranhaPlant8, 0x000003E8U, 0x00000800U); // 0x0300D000
dma_textures(gTexturePiranhaPlant9, 0x000003E8U, 0x00000800U); // 0x0300D800
}
Path2D harbour_path2D[] = {
+10 -6
View File
@@ -57,7 +57,7 @@ KalimariDesert::KalimariDesert() {
this->gfx = d_course_kalimari_desert_packed_dls;
this->gfxSize = 5328;
Props.textures = kalimari_desert_textures;
Props.Minimap.Texture = gTextureCourseOutlineKalimariDesert;
Props.Minimap.Texture = minimap_kalimari_desert;
Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture);
Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture);
Props.Minimap.Pos[0].X = 263;
@@ -67,6 +67,7 @@ KalimariDesert::KalimariDesert() {
Props.Minimap.PlayerScaleFactor = 0.015f;
Props.Minimap.FinishlineX = 0;
Props.Minimap.FinishlineY = 4.0;
ResizeMinimap(&Props.Minimap);
Props.SetText(Props.Name, "kalimari desert", sizeof(Props.Name));
Props.SetText(Props.DebugName, "desert", sizeof(Props.DebugName));
@@ -125,6 +126,9 @@ KalimariDesert::KalimariDesert() {
Props.Skybox.FloorBottomLeft = {0, 0, 0};
Props.Skybox.FloorTopLeft = {255, 192, 0};
Props.Sequence = MusicSeq::MUSIC_SEQ_KALIMARI_DESERT;
for (size_t i = 0; i < 80; i++) {
replace_segmented_textures_with_o2r_textures((Gfx*) kalimari_desert_dls[i], Props.textures);
}
}
void KalimariDesert::Load() {
@@ -136,11 +140,11 @@ void KalimariDesert::Load() {
}
void KalimariDesert::LoadTextures() {
dma_textures(gTextureCactus1Left, 0x0000033EU, 0x00000800U);
dma_textures(gTextureCactus1Right, 0x000002FBU, 0x00000800U);
dma_textures(gTextureCactus2Left, 0x000002A8U, 0x00000800U);
dma_textures(gTextureCactus2Right, 0x00000374U, 0x00000800U);
dma_textures(gTextureCactus3, 0x000003AFU, 0x00000800U);
dma_textures(gTextureCactus1Left, 0x0000033EU, 0x00000800U); // 0x03009000
dma_textures(gTextureCactus1Right, 0x000002FBU, 0x00000800U); // 0x03009800
dma_textures(gTextureCactus2Left, 0x000002A8U, 0x00000800U); // 0x0300A000
dma_textures(gTextureCactus2Right, 0x00000374U, 0x00000800U); // 0x0300A800
dma_textures(gTextureCactus3, 0x000003AFU, 0x00000800U); // 0x0300B000
}
void KalimariDesert::BeginPlay() {
+8 -1
View File
@@ -62,7 +62,7 @@ KoopaTroopaBeach::KoopaTroopaBeach() {
this->gfx = d_course_koopa_troopa_beach_packed_dls;
this->gfxSize = 5720;
Props.textures = koopa_troopa_beach_textures;
Props.Minimap.Texture = gTextureCourseOutlineKoopaTroopaBeach;
Props.Minimap.Texture = minimap_koopa_troopa_beach;
Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture);
Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture);
Props.Minimap.Pos[0].X = 268;
@@ -72,6 +72,7 @@ KoopaTroopaBeach::KoopaTroopaBeach() {
Props.Minimap.PlayerScaleFactor = 0.014f;
Props.Minimap.FinishlineX = 0;
Props.Minimap.FinishlineY = 0;
ResizeMinimap(&Props.Minimap);
Id = "mk:koopa_beach";
Props.SetText(Props.Name, "koopa troopa beach", sizeof(Props.Name));
@@ -135,6 +136,12 @@ KoopaTroopaBeach::KoopaTroopaBeach() {
Props.WaterLevel = 0.0f;
gWaterVelocity = -0.1f;
WaterVolumes.push_back({0.8f, 67.0f, 239.0f, 2233.0f, 2405.0f});
for (size_t i = 0; i < 148; i++) {
replace_segmented_textures_with_o2r_textures((Gfx*) d_course_koopa_troopa_beach_dl_list1[i], Props.textures);
}
for (size_t i = 0; i < 148; i++) {
replace_segmented_textures_with_o2r_textures((Gfx*) koopa_troopa_beach_dls2[i], Props.textures);
}
}
void KoopaTroopaBeach::Load() {
+7 -3
View File
@@ -89,7 +89,7 @@ LuigiRaceway::LuigiRaceway() {
this->gfx = d_course_luigi_raceway_packed_dls;
this->gfxSize = 6377;
Props.textures = luigi_raceway_textures;
Props.Minimap.Texture = gTextureCourseOutlineLuigiRaceway;
Props.Minimap.Texture = minimap_luigi_raceway;
Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture);
Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture);
Props.Minimap.Pos[0].X = 271;
@@ -99,6 +99,7 @@ LuigiRaceway::LuigiRaceway() {
Props.Minimap.PlayerScaleFactor = 0.0155f;
Props.Minimap.FinishlineX = 0;
Props.Minimap.FinishlineY = 0;
ResizeMinimap(&Props.Minimap);
Id = "mk:luigi_raceway";
Props.SetText(Props.Name, "luigi raceway", sizeof(Props.Name));
@@ -158,6 +159,9 @@ LuigiRaceway::LuigiRaceway() {
Props.Skybox.FloorBottomLeft = { 0, 0, 0 };
Props.Skybox.FloorTopLeft = { 216, 232, 248 };
Props.Sequence = MusicSeq::MUSIC_SEQ_RACEWAYS_WARIO_STADIUM;
for (size_t i = 0; i < 120; i++) {
replace_segmented_textures_with_o2r_textures((Gfx*) luigi_raceway_dls[i], Props.textures);
}
}
void LuigiRaceway::Load() {
@@ -169,8 +173,8 @@ void LuigiRaceway::Load() {
}
void LuigiRaceway::LoadTextures() {
dma_textures(gTextureTrees5Left, 0x000003E8U, 0x00000800U);
dma_textures(gTextureTrees5Right, 0x000003E8U, 0x00000800U);
dma_textures(gTextureTrees5Left, 0x000003E8U, 0x00000800U); // 0x03009000
dma_textures(gTextureTrees5Right, 0x000003E8U, 0x00000800U); // 0x03009800
}
void LuigiRaceway::BeginPlay() {
+15 -11
View File
@@ -76,7 +76,7 @@ MarioRaceway::MarioRaceway() {
this->gfxSize = 3367;
Props.textures = mario_raceway_textures;
Props.Minimap.Texture = gTextureCourseOutlineMarioRaceway;
Props.Minimap.Texture = minimap_mario_raceway;
Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture);
Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture);
Props.Minimap.Pos[0].X = 260;
@@ -86,6 +86,7 @@ MarioRaceway::MarioRaceway() {
Props.Minimap.PlayerScaleFactor = 0.022f;
Props.Minimap.FinishlineX = 0;
Props.Minimap.FinishlineY = -2.0;
ResizeMinimap(&Props.Minimap);
Id = "mk:mario_raceway";
Props.SetText(Props.Name, "mario raceway", sizeof(Props.Name));
@@ -146,6 +147,9 @@ MarioRaceway::MarioRaceway() {
Props.Skybox.FloorBottomLeft = {0, 0, 0};
Props.Skybox.FloorTopLeft = {0, 0, 0};
Props.Sequence = MusicSeq::MUSIC_SEQ_RACEWAYS_WARIO_STADIUM;
for (size_t i = 0; i < 68; i++) {
replace_segmented_textures_with_o2r_textures((Gfx*) mario_raceway_dls[i], Props.textures);
}
}
void MarioRaceway::Load() {
@@ -172,16 +176,16 @@ void MarioRaceway::Load() {
}
void MarioRaceway::LoadTextures() {
dma_textures(gTextureTrees1, 0x0000035BU, 0x00000800U);
D_802BA058 = dma_textures(gTexturePiranhaPlant1, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant2, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant3, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant4, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant5, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant6, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant7, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant8, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant9, 0x000003E8U, 0x00000800U);
dma_textures(gTextureTrees1, 0x0000035BU, 0x00000800U); // 0x03009000
D_802BA058 = dma_textures(gTexturePiranhaPlant1, 0x000003E8U, 0x00000800U); // 0x03009800
dma_textures(gTexturePiranhaPlant2, 0x000003E8U, 0x00000800U); // 0x0300A000
dma_textures(gTexturePiranhaPlant3, 0x000003E8U, 0x00000800U); // 0x0300A800
dma_textures(gTexturePiranhaPlant4, 0x000003E8U, 0x00000800U); // 0x0300B000
dma_textures(gTexturePiranhaPlant5, 0x000003E8U, 0x00000800U); // 0x0300B800
dma_textures(gTexturePiranhaPlant6, 0x000003E8U, 0x00000800U); // 0x0300C000
dma_textures(gTexturePiranhaPlant7, 0x000003E8U, 0x00000800U); // 0x0300C800
dma_textures(gTexturePiranhaPlant8, 0x000003E8U, 0x00000800U); // 0x0300D000
dma_textures(gTexturePiranhaPlant9, 0x000003E8U, 0x00000800U); // 0x0300D800
}
void MarioRaceway::BeginPlay() {
+17 -13
View File
@@ -75,7 +75,7 @@ MooMooFarm::MooMooFarm() {
this->gfx = d_course_moo_moo_farm_packed_dls;
this->gfxSize = 3304;
Props.textures = moo_moo_farm_textures;
Props.Minimap.Texture = gTextureCourseOutlineMooMooFarm;
Props.Minimap.Texture = minimap_moo_moo_farm;
Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture);
Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture);
Props.Minimap.Pos[0].X = 271;
@@ -85,6 +85,7 @@ MooMooFarm::MooMooFarm() {
Props.Minimap.PlayerScaleFactor = 0.0155f;
Props.Minimap.FinishlineX = 0;
Props.Minimap.FinishlineY = 0;
ResizeMinimap(&Props.Minimap);
Props.SetText(Props.Name, "moo moo farm", sizeof(Props.Name));
Props.SetText(Props.DebugName, "farm", sizeof(Props.DebugName));
@@ -143,6 +144,9 @@ MooMooFarm::MooMooFarm() {
Props.Skybox.FloorBottomLeft = {0, 0, 0};
Props.Skybox.FloorTopLeft = {255, 184, 99};
Props.Sequence = MusicSeq::MUSIC_SEQ_MOO_MOO_FARM_YOSHI_VALLEY;
for (size_t i = 0; i < 92; i++) {
replace_segmented_textures_with_o2r_textures((Gfx*) moo_moo_farm_dls[i], Props.textures);
}
}
void MooMooFarm::Load() {
@@ -154,18 +158,18 @@ void MooMooFarm::Load() {
}
void MooMooFarm::LoadTextures() {
dma_textures(gTextureTrees4Left, 0x000003E8U, 0x00000800U);
dma_textures(gTextureTrees4Right, 0x000003E8U, 0x00000800U);
dma_textures(gTextureCow01Left, 0x00000400U, 0x00000800U);
dma_textures(gTextureCow01Right, 0x00000400U, 0x00000800U);
dma_textures(gTextureCow02Left, 0x00000400U, 0x00000800U);
dma_textures(gTextureCow02Right, 0x00000400U, 0x00000800U);
dma_textures(gTextureCow03Left, 0x00000400U, 0x00000800U);
dma_textures(gTextureCow03Right, 0x00000400U, 0x00000800U);
dma_textures(gTextureCow04Left, 0x00000400U, 0x00000800U);
dma_textures(gTextureCow04Right, 0x00000400U, 0x00000800U);
dma_textures(gTextureCow05Left, 0x00000400U, 0x00000800U);
dma_textures(gTextureCow05Right, 0x00000400U, 0x00000800U);
dma_textures(gTextureTrees4Left, 0x000003E8U, 0x00000800U); // 0x03009000
dma_textures(gTextureTrees4Right, 0x000003E8U, 0x00000800U); // 0x03009800
dma_textures(gTextureCow01Left, 0x00000400U, 0x00000800U); // 0x0300A000
dma_textures(gTextureCow01Right, 0x00000400U, 0x00000800U); // 0x0300A800
dma_textures(gTextureCow02Left, 0x00000400U, 0x00000800U); // 0x0300B000
dma_textures(gTextureCow02Right, 0x00000400U, 0x00000800U); // 0x0300B800
dma_textures(gTextureCow03Left, 0x00000400U, 0x00000800U); // 0x0300C000
dma_textures(gTextureCow03Right, 0x00000400U, 0x00000800U); // 0x0300C800
dma_textures(gTextureCow04Left, 0x00000400U, 0x00000800U); // 0x0300D000
dma_textures(gTextureCow04Right, 0x00000400U, 0x00000800U); // 0x0300D800
dma_textures(gTextureCow05Left, 0x00000400U, 0x00000800U); // 0x0300E000
dma_textures(gTextureCow05Right, 0x00000400U, 0x00000800U); // 0x0300E800
}
// These are full arrays that are not used in the original game
+2 -1
View File
@@ -49,7 +49,7 @@ RainbowRoad::RainbowRoad() {
this->gfx = d_course_rainbow_road_packed_dls;
this->gfxSize = 5670;
Props.textures = rainbow_road_textures;
Props.Minimap.Texture = gTextureCourseOutlineRainbowRoad;
Props.Minimap.Texture = minimap_rainbow_road;
Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture);
Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture);
Props.Minimap.Pos[0].X = 261;
@@ -59,6 +59,7 @@ RainbowRoad::RainbowRoad() {
Props.Minimap.PlayerScaleFactor = 0.0103f;
Props.Minimap.FinishlineX = 0;
Props.Minimap.FinishlineY = 0;
ResizeMinimap(&Props.Minimap);
Props.SetText(Props.Name, "rainbow road", sizeof(Props.Name));
Props.SetText(Props.DebugName, "rainbow", sizeof(Props.DebugName));
+16 -12
View File
@@ -87,7 +87,7 @@ RoyalRaceway::RoyalRaceway() {
this->gfx = d_course_royal_raceway_packed_dls;
this->gfxSize = 5670;
Props.textures = royal_raceway_textures;
Props.Minimap.Texture = gTextureCourseOutlineRoyalRaceway;
Props.Minimap.Texture = minimap_royal_raceway;
Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture);
Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture);
Props.Minimap.Pos[0].X = 262;
@@ -97,6 +97,7 @@ RoyalRaceway::RoyalRaceway() {
Props.Minimap.PlayerScaleFactor = 0.014f;
Props.Minimap.FinishlineX = 0;
Props.Minimap.FinishlineY = 0;
ResizeMinimap(&Props.Minimap);
Props.SetText(Props.Name, "royal raceway", sizeof(Props.Name));
Props.SetText(Props.DebugName, "p circuit", sizeof(Props.DebugName));
@@ -157,6 +158,9 @@ RoyalRaceway::RoyalRaceway() {
Props.Sequence = MusicSeq::MUSIC_SEQ_RACEWAYS_WARIO_STADIUM;
Props.WaterLevel = -60.0f;
for (size_t i = 0; i < 132; i++) {
replace_segmented_textures_with_o2r_textures((Gfx*) royal_raceway_dls[i], Props.textures);
}
}
void RoyalRaceway::Load() {
@@ -167,17 +171,17 @@ void RoyalRaceway::Load() {
}
void RoyalRaceway::LoadTextures() {
dma_textures(gTextureTrees3, 0x000003E8U, 0x00000800U);
dma_textures(gTextureTrees7, 0x000003E8U, 0x00000800U);
D_802BA058 = dma_textures(gTexturePiranhaPlant1, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant2, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant3, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant4, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant5, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant6, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant7, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant8, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant9, 0x000003E8U, 0x00000800U);
dma_textures(gTextureTrees3, 0x000003E8U, 0x00000800U); // 0x03009000
dma_textures(gTextureTrees7, 0x000003E8U, 0x00000800U); // 0x03009800
D_802BA058 = dma_textures(gTexturePiranhaPlant1, 0x000003E8U, 0x00000800U); // 0x0300A000
dma_textures(gTexturePiranhaPlant2, 0x000003E8U, 0x00000800U); // 0x0300A800
dma_textures(gTexturePiranhaPlant3, 0x000003E8U, 0x00000800U); // 0x0300B000
dma_textures(gTexturePiranhaPlant4, 0x000003E8U, 0x00000800U); // 0x0300B800
dma_textures(gTexturePiranhaPlant5, 0x000003E8U, 0x00000800U); // 0x0300C000
dma_textures(gTexturePiranhaPlant6, 0x000003E8U, 0x00000800U); // 0x0300C800
dma_textures(gTexturePiranhaPlant7, 0x000003E8U, 0x00000800U); // 0x0300D000
dma_textures(gTexturePiranhaPlant8, 0x000003E8U, 0x00000800U); // 0x0300D800
dma_textures(gTexturePiranhaPlant9, 0x000003E8U, 0x00000800U); // 0x0300E000
}
void RoyalRaceway::BeginPlay() {
+8 -1
View File
@@ -49,7 +49,7 @@ SherbetLand::SherbetLand() {
this->gfx = d_course_sherbet_land_packed_dls;
this->gfxSize = 1803;
Props.textures = sherbet_land_textures;
Props.Minimap.Texture = gTextureCourseOutlineSherbetLand;
Props.Minimap.Texture = minimap_sherbet_land;
Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture);
Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture);
Props.Minimap.Pos[0].X = 262;
@@ -60,6 +60,7 @@ SherbetLand::SherbetLand() {
Props.Minimap.FinishlineX = 0;
Props.Minimap.FinishlineY = 0;
Props.Minimap.Colour = {72, 100, 255};
ResizeMinimap(&Props.Minimap);
Props.SetText(Props.Name, "sherbet land", sizeof(Props.Name));
Props.SetText(Props.DebugName, "sherbet", sizeof(Props.DebugName));
@@ -122,6 +123,12 @@ SherbetLand::SherbetLand() {
Props.Sequence = MusicSeq::MUSIC_SEQ_FRAPPE_SNOWLAND;
Props.WaterLevel = -18.0f;
for (size_t i = 0; i < 72; i++) {
replace_segmented_textures_with_o2r_textures((Gfx*) sherbet_land_dls[i], Props.textures);
}
for (size_t i = 0; i < 72; i++) {
replace_segmented_textures_with_o2r_textures((Gfx*) sherbet_land_dls_2[i], Props.textures);
}
}
void SherbetLand::Load() {
+2 -1
View File
@@ -64,7 +64,7 @@ Skyscraper::Skyscraper() {
this->gfx = d_course_skyscraper_packed_dls;
this->gfxSize = 548;
Props.textures = skyscraper_textures;
Props.Minimap.Texture = gTextureCourseOutlineSkyscraper;
Props.Minimap.Texture = minimap_skyscraper;
Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture);
Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture);
Props.Minimap.Pos[0].X = 257;
@@ -74,6 +74,7 @@ Skyscraper::Skyscraper() {
Props.Minimap.PlayerScaleFactor = 0.0445f;
Props.Minimap.FinishlineX = 0;
Props.Minimap.FinishlineY = 0;
ResizeMinimap(&Props.Minimap);
Props.SetText(Props.Name, "skyscraper", sizeof(Props.Name));
Props.SetText(Props.DebugName, "skyscraper", sizeof(Props.DebugName));
+12 -11
View File
@@ -61,7 +61,7 @@ extern "C" {
TestCourse::TestCourse() {
this->gfxSize = 100;
this->textures = NULL;
Props.Minimap.Texture = gTextureCourseOutlineMarioRaceway;
Props.Minimap.Texture = minimap_mario_raceway;
Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture);
Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture);
Props.Minimap.Pos[0].X = 260;
@@ -72,6 +72,7 @@ TestCourse::TestCourse() {
Props.Minimap.FinishlineX = 0;
Props.Minimap.FinishlineY = 0;
Props.Minimap.Colour = {255, 255, 255};
ResizeMinimap(&Props.Minimap);
Id = "mk:test_course";
@@ -145,16 +146,16 @@ void TestCourse::Load() {
}
void TestCourse::LoadTextures() {
dma_textures(gTextureTrees1, 0x0000035BU, 0x00000800U);
D_802BA058 = dma_textures(gTexturePiranhaPlant1, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant2, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant3, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant4, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant5, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant6, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant7, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant8, 0x000003E8U, 0x00000800U);
dma_textures(gTexturePiranhaPlant9, 0x000003E8U, 0x00000800U);
dma_textures(gTextureTrees1, 0x0000035BU, 0x00000800U); // 0x03009000
D_802BA058 = dma_textures(gTexturePiranhaPlant1, 0x000003E8U, 0x00000800U); // 0x03009800
dma_textures(gTexturePiranhaPlant2, 0x000003E8U, 0x00000800U); // 0x0300A000
dma_textures(gTexturePiranhaPlant3, 0x000003E8U, 0x00000800U); // 0x0300A800
dma_textures(gTexturePiranhaPlant4, 0x000003E8U, 0x00000800U); // 0x0300B000
dma_textures(gTexturePiranhaPlant5, 0x000003E8U, 0x00000800U); // 0x0300B800
dma_textures(gTexturePiranhaPlant6, 0x000003E8U, 0x00000800U); // 0x0300C000
dma_textures(gTexturePiranhaPlant7, 0x000003E8U, 0x00000800U); // 0x0300C800
dma_textures(gTexturePiranhaPlant8, 0x000003E8U, 0x00000800U); // 0x0300D000
dma_textures(gTexturePiranhaPlant9, 0x000003E8U, 0x00000800U); // 0x0300D800
}
Path2D test_course_path2D[] = {
+5 -1
View File
@@ -70,7 +70,7 @@ ToadsTurnpike::ToadsTurnpike() {
this->gfx = d_course_toads_turnpike_packed_dls;
this->gfxSize = 3427;
Props.textures = toads_turnpike_textures;
Props.Minimap.Texture = gTextureCourseOutlineToadsTurnpike;
Props.Minimap.Texture = minimap_toads_turnpike;
Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture);
Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture);
Props.Minimap.Pos[0].X = 252;
@@ -80,6 +80,7 @@ ToadsTurnpike::ToadsTurnpike() {
Props.Minimap.PlayerScaleFactor = 0.013f;
Props.Minimap.FinishlineX = 0;
Props.Minimap.FinishlineY = 0;
ResizeMinimap(&Props.Minimap);
Props.SetText(Props.Name, "toad's turnpike", sizeof(Props.Name));
Props.SetText(Props.DebugName, "highway", sizeof(Props.DebugName));
@@ -144,6 +145,9 @@ ToadsTurnpike::ToadsTurnpike() {
Props.Skybox.FloorBottomLeft = {0, 0, 0};
Props.Skybox.FloorTopLeft = {209, 65, 23};
Props.Sequence = MusicSeq::MUSIC_SEQ_TOADS_TURNPIKE;
for (size_t i = 0; i < 80; i++) {
replace_segmented_textures_with_o2r_textures((Gfx*) d_course_toads_turnpike_dl_list[i], Props.textures);
}
}
void ToadsTurnpike::Load() {
+5 -1
View File
@@ -66,7 +66,7 @@ WarioStadium::WarioStadium() {
this->gfx = d_course_wario_stadium_packed_dls;
this->gfxSize = 5272;
Props.textures = wario_stadium_textures;
Props.Minimap.Texture = gTextureCourseOutlineWarioStadium;
Props.Minimap.Texture = minimap_wario_stadium;
Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture);
Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture);
Props.Minimap.Pos[0].X = 262;
@@ -76,6 +76,7 @@ WarioStadium::WarioStadium() {
Props.Minimap.PlayerScaleFactor = 0.0155f;
Props.Minimap.FinishlineX = 0;
Props.Minimap.FinishlineY = 0;
ResizeMinimap(&Props.Minimap);
Props.SetText(Props.Name, "wario stadium", sizeof(Props.Name));
Props.SetText(Props.DebugName, "stadium", sizeof(Props.DebugName));
@@ -140,6 +141,9 @@ WarioStadium::WarioStadium() {
Props.Skybox.FloorBottomLeft = { 0, 0, 0 };
Props.Skybox.FloorTopLeft = { 0, 0, 0 };
Props.Sequence = MusicSeq::MUSIC_SEQ_RACEWAYS_WARIO_STADIUM;
for (size_t i = 0; i < 108; i++) {
replace_segmented_textures_with_o2r_textures((Gfx*) wario_stadium_dls[i], Props.textures);
}
}
void WarioStadium::Load() {
+6 -2
View File
@@ -61,7 +61,7 @@ YoshiValley::YoshiValley() {
this->gfxSize = 4140;
Props.textures = yoshi_valley_textures;
Props.Minimap.Texture = gTextureCourseOutlineYoshiValley;
Props.Minimap.Texture = minimap_yoshi_valley;
Props.Minimap.Width = ResourceGetTexWidthByName(Props.Minimap.Texture);
Props.Minimap.Height = ResourceGetTexHeightByName(Props.Minimap.Texture);
Props.Minimap.PlayerX = 61;
@@ -69,6 +69,7 @@ YoshiValley::YoshiValley() {
Props.Minimap.PlayerScaleFactor = 0.018f;
Props.Minimap.FinishlineX = 0;
Props.Minimap.FinishlineY = 0;
ResizeMinimap(&Props.Minimap);
Props.SetText(Props.Name, "yoshi valley", sizeof(Props.Name));
Props.SetText(Props.DebugName, "maze", sizeof(Props.DebugName));
@@ -127,6 +128,9 @@ YoshiValley::YoshiValley() {
Props.Skybox.FloorBottomLeft = {0, 0, 0};
Props.Skybox.FloorTopLeft = {95, 40, 15};
Props.Sequence = MusicSeq::MUSIC_SEQ_MOO_MOO_FARM_YOSHI_VALLEY;
for (size_t i = 0; i < 124; i++) {
replace_segmented_textures_with_o2r_textures((Gfx*) d_course_yoshi_valley_dl_list[i], Props.textures);
}
}
void YoshiValley::Load() {
@@ -140,7 +144,7 @@ void YoshiValley::Load() {
}
void YoshiValley::LoadTextures() {
dma_textures(gTextureTrees2, 0x000003E8U, 0x00000800U);
dma_textures(gTextureTrees2, 0x000003E8U, 0x00000800U); // 0x03009000
}
void YoshiValley::BeginPlay() {
+3 -3
View File
@@ -86,7 +86,7 @@ FVector ScreenRayTrace() {
bool QueryCollisionRayActor(Vec3f rayOrigin, Vec3f rayDir, Vec3f actorMin, Vec3f actorMax, float* t) {
float tmin = -FLT_MAX, tmax = FLT_MAX;
for (int i = 0; i < 3; i++) {
for (size_t i = 0; i < 3; i++) {
if (fabs(rayDir[i]) > 1e-6f) { // Avoid division by zero
float t1 = (actorMin[i] - rayOrigin[i]) / rayDir[i];
float t2 = (actorMax[i] - rayOrigin[i]) / rayDir[i];
@@ -109,9 +109,9 @@ bool QueryCollisionRayActor(Vec3f rayOrigin, Vec3f rayDir, Vec3f actorMin, Vec3f
FVector4 MultiplyMatrixVector(float matrix[4][4], float vector[4]) {
FVector4 result;
float* resultPtr = &result.x;
for (int i = 0; i < 4; i++) {
for (size_t i = 0; i < 4; i++) {
resultPtr[i] = 0;
for (int j = 0; j < 4; j++) {
for (size_t j = 0; j < 4; j++) {
resultPtr[i] += matrix[j][i] * vector[j]; // Swap [i][j] → [j][i] for column order
}
}
+1 -1
View File
@@ -147,7 +147,7 @@ namespace Editor {
course->Props.Minimap.Width = texture.Width;
course->Props.Minimap.Height = texture.Height;
} else { // Fallback
course->Props.Minimap.Texture = gTextureCourseOutlineMarioRaceway;
course->Props.Minimap.Texture = minimap_mario_raceway;
course->Props.Minimap.Width = ResourceGetTexWidthByName(course->Props.Minimap.Texture);
course->Props.Minimap.Height = ResourceGetTexHeightByName(course->Props.Minimap.Texture);
}
+4 -4
View File
@@ -102,8 +102,8 @@ void StarEmitter::Draw(s32 cameraId) { // func_80054BE8
Camera* camera;
camera = &camera1[cameraId];
gSPDisplayList(gDisplayListHead++, (Gfx*)D_0D007AE0);
load_texture_block_ia8_nomirror(D_8018D488, 0x00000020, 0x00000020);
gSPDisplayList(gDisplayListHead++, (Gfx*) D_0D007AE0);
load_texture_block_ia8_nomirror((u8*) gTexture69C80C, 0x00000020, 0x00000020);
func_8004B35C(0x000000FF, 0x000000FF, 0, 0x000000FF);
D_80183E80[0] = 0;
for (var_s0 = 0; var_s0 < gObjectParticle3_SIZE; var_s0++) {
@@ -126,8 +126,8 @@ void StarEmitter::func_80054AFC(s32 objectIndex, Vec3f arg1) {
(s32) gObjectList[objectIndex].unk_084[2], (s32) gObjectList[objectIndex].primAlpha);
rsp_set_matrix_transformation(gObjectList[objectIndex].pos, (u16*) D_80183E80,
gObjectList[objectIndex].sizeScaling);
gSPVertex(gDisplayListHead++, (uintptr_t)D_0D005AE0, 4, 0);
gSPDisplayList(gDisplayListHead++, (Gfx*)common_rectangle_display);
gSPVertex(gDisplayListHead++, (uintptr_t) D_0D005AE0, 4, 0);
gSPDisplayList(gDisplayListHead++, (Gfx*) common_rectangle_display);
}
void StarEmitter::func_80077428(s32 objectIndex) {