mirror of
https://github.com/HarbourMasters/SpaghettiKart
synced 2026-07-10 07:07:17 -04:00
Scene Setup 1
This commit is contained in:
+1
-1
@@ -97,7 +97,6 @@ public:
|
||||
|
||||
Matrix Mtx;
|
||||
|
||||
// Holds all available courses
|
||||
|
||||
Course* CurrentCourse;
|
||||
Cup* CurrentCup;
|
||||
@@ -118,6 +117,7 @@ public:
|
||||
TrainCrossing* AddCrossing(Vec3f position, u32 waypointMin, u32 waypointMax, f32 approachRadius, f32 exitRadius);
|
||||
std::vector<std::shared_ptr<TrainCrossing>> Crossings;
|
||||
|
||||
// Holds all available courses
|
||||
std::vector<Course*> Courses;
|
||||
size_t CourseIndex = 0; // For browsing courses.
|
||||
private:
|
||||
|
||||
@@ -79,6 +79,7 @@ Course::Course() {
|
||||
Props.Sequence = MusicSeq::MUSIC_SEQ_UNKNOWN;
|
||||
}
|
||||
|
||||
// Load custom track from code
|
||||
void Course::Load(Vtx* vtx, Gfx* gfx) {
|
||||
gSegmentTable[4] = reinterpret_cast<uintptr_t>(&vtx[0]);
|
||||
gSegmentTable[7] = reinterpret_cast<uintptr_t>(&gfx[0]);
|
||||
@@ -86,13 +87,18 @@ void Course::Load(Vtx* vtx, Gfx* gfx) {
|
||||
Course::Init();
|
||||
}
|
||||
|
||||
void Course::Load() {
|
||||
// Load custom track from o2r
|
||||
void Course::Load(std::string dls) {
|
||||
std::vector<TrackSectionsO2R> sections = LOAD_ASSET_RAW(dls);
|
||||
|
||||
if (Props.TrackModel) {
|
||||
generate_collision_mesh_with_defaults((Gfx*)LOAD_ASSET_RAW(Props.TrackModel));
|
||||
return;
|
||||
for (auto& section : sections) {
|
||||
generate_collision_mesh((Gfx*)LOAD_ASSET_RAW(section.addr), section.surfaceType, section.sectionId);
|
||||
}
|
||||
Course::Init();
|
||||
}
|
||||
|
||||
// Load stock track
|
||||
void Course::Load() {
|
||||
size_t vtxSize = (ResourceGetSizeByName(this->vtx) / sizeof(CourseVtx)) * sizeof(Vtx);
|
||||
size_t texSegSize;
|
||||
|
||||
|
||||
@@ -238,8 +238,9 @@ public:
|
||||
|
||||
explicit Course();
|
||||
|
||||
virtual void Load(); // Decompress and load stock courses. Must be overridden for custom courses
|
||||
virtual void Load(Vtx* vtx, Gfx *gfx); // Load custom course
|
||||
virtual void Load(); // Decompress and load stock courses
|
||||
virtual void Load(Vtx* vtx, Gfx *gfx); // Load custom track from code
|
||||
virtual void Load(std::string dls); // Load custom track from o2r
|
||||
virtual void LoadTextures();
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Editor {
|
||||
|
||||
bool wrote = GameEngine::Instance->context->GetResourceManager()->GetArchiveManager()->WriteFile(CurrentArchive, SceneFile, stringify);
|
||||
if (wrote) {
|
||||
printf("Successfully wrote scene file!\n");
|
||||
printf("Successfully wrote scene file!\n Wrote: %s\n", SceneFile.c_str());
|
||||
} else {
|
||||
printf("Failed to write scene file!\n");
|
||||
}
|
||||
@@ -102,7 +102,8 @@ namespace Editor {
|
||||
GameObject::CollisionType::BOUNDING_BOX, 20.0f, (int32_t*) &actor->bPendingDestroy, (int32_t) 1);
|
||||
}
|
||||
|
||||
void SetSceneFile(std::string sceneFile) {
|
||||
SceneFile = sceneFile;
|
||||
void SetSceneFile(std::string archive, std::string sceneFile) {
|
||||
CurrentArchive = GameEngine::Instance->context->GetResourceManager()->GetArchiveManager()->GetArchiveFromFile(archive);
|
||||
SceneFile = sceneFile+"/scene.json";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Editor {
|
||||
void SaveLevel();
|
||||
void LoadLevel(std::string sceneFile);
|
||||
void Load_AddStaticMeshActor(const nlohmann::json& actorJson);
|
||||
void SetSceneFile(std::string sceneFile);
|
||||
void SetSceneFile(std::string archive, std::string sceneFile);
|
||||
|
||||
extern std::shared_ptr<Ship::Archive> CurrentArchive; // This is used to retrieve and write the scene data file
|
||||
extern std::string SceneFile;
|
||||
|
||||
Reference in New Issue
Block a user