summaryrefslogtreecommitdiff
path: root/src/engine/courses/Course.cpp
diff options
context:
space:
mode:
authorcoco875 <59367621+coco875@users.noreply.github.com>2025-07-01 23:42:14 +0000
committerGitHub <noreply@github.com>2025-07-01 17:42:14 -0600
commit7937896598f3df46eb78c158bde787bc4f12ad7f (patch)
tree876548daaec2f8a5bb284374d834abcf9aad15b9 /src/engine/courses/Course.cpp
parentb57afa83b42bb14e526043be4ca9f6e322788edb (diff)
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>
Diffstat (limited to 'src/engine/courses/Course.cpp')
-rw-r--r--src/engine/courses/Course.cpp39
1 files changed, 25 insertions, 14 deletions
diff --git a/src/engine/courses/Course.cpp b/src/engine/courses/Course.cpp
index 6049d8c69..7fb775ac9 100644
--- a/src/engine/courses/Course.cpp
+++ b/src/engine/courses/Course.cpp
@@ -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;