mirror of
https://github.com/HarbourMasters/SpaghettiKart
synced 2026-09-01 10:13:03 -04:00
Refactor yaml and remove segment (#531)
* move yaml (still need to fix header path) * fix header * change kart to karts and add migration * fix include * Update migration.py * fix common_texture_debug_font extraction * Update torch * update torch and header * unduplicate texture for tumble * Update torch * Update migration.py * put the sort by default * fix replace_segmented_textures_with_o2r_textures * Update torch * fix yamls * add manual_segments in data of course * comment out replace_segmented_textures_with_o2r_textures and segment 3 * remove segment 5 * (wip) remove segment 6 still plenty of thing to do * more vtx * more change * Update torch * small fix * Update BansheeBoardwalk.cpp * fix blockFort * Delete test.yaml * fix bowser castle and simplify track sections * fix choco mountain * clean banshee * fix dk jungle * fix double deck * fix macos * fix error * fix macos ci * Update torch * Update torch * fix frappe snowland * fix kalimari desert * fix koopa troopa beach * fix luigi raceway * fix mario raceway and simplify thing * fix moo moo farm * fix rainbow road * Update torch * Update torch * hopefully fix windows error * fix a small error * fix royal raceway (and podium in theory) * fix sherbet_land * fix skyscraper * fix toads turnpike * fix wario stadium * fix yoshi valley * update torch * more clang tidy rules * REMOVE totally SEGMENT (sorry for the PR) * remove unused field in course and props and unused packed asset * fix kart texture * fix particle * fix track section and transparency * try fix mode extra * fix macos build and render * fix collision in extra * small change and try fix windows error * a little of clean * more cleanup * forget header and more clean up * Update Makefile * fix credits * fix kart texture offset * remove LoadTextures and add Unload * fix definitevely mirror mode * add unload but it's not perfect * revert a bad fix * clean no longer used python script * fix crash with player * being able to load the same course twice * add a comment on DrawWater * fix render of transparent object * better hack * add a proper migration instruction * fix number * add basic modsmanager * add meta/mods.toml * Update EditorMath.h * Update ModsManager.cpp * basic modManager (maybe I should rename it ModLoader) * use range on dependencies * add information about mods.toml * fix coment * some rename around * Delete beta-to-v1.md * Update migrations.md * Update textures-pack.md * Update modding.md * Update modding.md * clean yamls_old * move to mods in engine * rename ModsManger to ModManager * move init and unload at the top * rename ModsMetadata to ModMetadata * fix header * Update ModManager.cpp * put core mods at top
This commit is contained in:
@@ -13,9 +13,54 @@ extern "C" {
|
||||
RaceManager::RaceManager(World& world) : WorldContext(world) {
|
||||
}
|
||||
|
||||
std::unordered_map<uintptr_t, std::shared_ptr<Vtx>> mirroredVtxCache;
|
||||
|
||||
// Populates a collision mesh for mirror mode
|
||||
extern "C" void add_triangle_to_collision_mesh(Vtx* vtx1, Vtx* vtx2, Vtx* vtx3, Vtx** outVtx1, Vtx** outVtx2, Vtx** outVtx3) {
|
||||
if (gIsMirrorMode != 0) {
|
||||
auto getOrCreateMirrored = [](Vtx* original) -> Vtx* {
|
||||
uintptr_t key = reinterpret_cast<uintptr_t>(original);
|
||||
|
||||
auto it = mirroredVtxCache.find(key);
|
||||
if (it != mirroredVtxCache.end()) {
|
||||
return it->second.get();
|
||||
}
|
||||
|
||||
auto newVtx = std::make_shared<Vtx>(*original);
|
||||
newVtx->v.ob[0] = -newVtx->v.ob[0];
|
||||
|
||||
mirroredVtxCache[key] = newVtx;
|
||||
|
||||
return newVtx.get();
|
||||
};
|
||||
|
||||
Vtx* m1 = getOrCreateMirrored(vtx1);
|
||||
Vtx* m2 = getOrCreateMirrored(vtx2);
|
||||
Vtx* m3 = getOrCreateMirrored(vtx3);
|
||||
|
||||
// don't invert winding here, already done in the gfx
|
||||
*outVtx1 = m1;
|
||||
*outVtx2 = m2;
|
||||
*outVtx3 = m3;
|
||||
|
||||
} else {
|
||||
// Pas de miroir, on passe les originaux
|
||||
*outVtx1 = vtx1;
|
||||
*outVtx2 = vtx2;
|
||||
*outVtx3 = vtx3;
|
||||
}
|
||||
}
|
||||
|
||||
void RaceManager::Load() {
|
||||
if (WorldContext.CurrentCourse) {
|
||||
WorldContext.CurrentCourse->Load();
|
||||
if (WorldContext.GetCurrentCourse()) {
|
||||
mirroredVtxCache.clear();
|
||||
WorldContext.GetCurrentCourse()->Load();
|
||||
}
|
||||
}
|
||||
|
||||
void RaceManager::UnLoad() {
|
||||
if (WorldContext.GetCurrentCourse()) {
|
||||
WorldContext.GetCurrentCourse()->UnLoad();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +74,7 @@ void RaceManager::PreInit() {
|
||||
}
|
||||
|
||||
void RaceManager::BeginPlay() {
|
||||
auto course = WorldContext.CurrentCourse;
|
||||
auto course = WorldContext.GetCurrentCourse();
|
||||
|
||||
if (course) {
|
||||
// Do not spawn finishline in credits or battle mode. And if bSpawnFinishline.
|
||||
|
||||
Reference in New Issue
Block a user