mirror of
https://github.com/HarbourMasters/SpaghettiKart
synced 2026-08-22 15:11:52 -04:00
de9c5d5101
* Impl SpawnParams * Added json submodule * Update json * Update * Works * Remove comment * Works refactor * Snowman and thwomp working * Impl hot air balloon * More progress * All OObjects are done * cleanup * Refactor 2Dpath to normal path * Update nlohmann json & fix compile * Rest of actors * MORE CHANGES * Finish actors * Done PR, some fix to collision viewer * Impl falling rocks * Add const * wip editor refactor * Property work * continue * Overridable editor properties * Actor saving/loading works now * Fix light alignment * Clarification * Impl penguin * params impl signs * properties impl falling rock * More property impls * impl air balloon * Add spawnParams to OObject Translate * Snowman translate better * impl hedgehog properly * properties impl trophy * thwomp progress * Finish impl properties * Fix compile * Fix cursor collisions * Move registered actors * Rename pathPoint XYZ to xyz * Fix editor pause bug * Clean up * Review comments * Remove SpawnParams struct from actor classes * Rename * Player Label First Iteration * Work now * Working 3d text * Fix boo bug * Finish AText actor * Fix spawnparams compile * Register AText * Finish Text Actor * Fix thwomp interpolation * Fix compile * Fix crab and hedgehog * Fix loading flagpole * Fix Hot Air Balloon * Turn zbuffer on for AText * Update --------- Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com>
137 lines
3.4 KiB
C++
137 lines
3.4 KiB
C++
#pragma once
|
|
|
|
#include <libultraship.h>
|
|
#include "CoreMath.h"
|
|
#include "engine/courses/Course.h"
|
|
#include "objects/Object.h"
|
|
#include "Cup.h"
|
|
#include "PlayerBombKart.h"
|
|
#include "TrainCrossing.h"
|
|
#include <memory>
|
|
#include <unordered_map>
|
|
#include "Actor.h"
|
|
#include "StaticMeshActor.h"
|
|
#include "particles/ParticleEmitter.h"
|
|
|
|
#include "editor/Editor.h"
|
|
#include "editor/GameObject.h"
|
|
|
|
extern "C" {
|
|
#include "camera.h"
|
|
#include "objects.h"
|
|
};
|
|
|
|
class Cup; // <-- Forward declaration
|
|
class OObject;
|
|
class Course;
|
|
class StaticMeshActor;
|
|
class OBombKart;
|
|
class TrainCrossing;
|
|
class OLakitu;
|
|
class GameObject; // <-- Editor
|
|
|
|
class World {
|
|
typedef struct Matrix {
|
|
Mtx Screen2D; // Orthogonal projection for UI, skybox, and such
|
|
Mtx Ortho;
|
|
std::array<Mtx,5> Persp;
|
|
std::array<Mtx,5> LookAt;
|
|
std::array<Mtx, 8 * 4> Karts; // Eight players * four screens
|
|
std::array<Mtx, 8 * 4> Shadows; // Eight players * four screens
|
|
std::deque<Mtx> Hud;
|
|
std::deque<Mtx> Objects;
|
|
|
|
Matrix()
|
|
: Hud(200), Objects(1000)
|
|
{}
|
|
};
|
|
|
|
public:
|
|
explicit World();
|
|
~World();
|
|
|
|
std::shared_ptr<Course> AddCourse(std::shared_ptr<Course> course);
|
|
|
|
AActor* AddActor(AActor* actor);
|
|
struct Actor* AddBaseActor();
|
|
void ActorBeginPlay(Actor* actor);
|
|
AActor* GetActor(size_t index);
|
|
|
|
void TickActors();
|
|
AActor* ConvertActorToAActor(Actor* actor);
|
|
Actor* ConvertAActorToActor(AActor* actor);
|
|
|
|
void DrawStaticMeshActors();
|
|
StaticMeshActor* AddStaticMeshActor(std::string name, FVector pos, IRotator rot, FVector scale, std::string model, int32_t* collision);
|
|
|
|
OObject* AddObject(OObject* object);
|
|
|
|
void TickObjects();
|
|
void TickObjects60fps();
|
|
void DrawObjects(s32 cameraId);
|
|
Object *GetObjectByIndex(size_t);
|
|
|
|
void TickParticles();
|
|
void DrawParticles(s32 cameraId);
|
|
ParticleEmitter* AddEmitter(ParticleEmitter* emitter);
|
|
void Reset(void); // Sets OObjects or AActors static member variables back to default values
|
|
|
|
void AddCup(Cup*);
|
|
void SetCup(Cup* cup);
|
|
void SetCupIndex(size_t index);
|
|
const char* GetCupName();
|
|
u32 GetCupIndex();
|
|
u32 NextCup();
|
|
u32 PreviousCup();
|
|
void SetCourseFromCup();
|
|
|
|
World* GetWorld(void);
|
|
void ClearWorld(void);
|
|
|
|
|
|
// These are only for browsing through the course list
|
|
void SetCourse(const char*);
|
|
template<typename T>
|
|
void SetCourseByType() {
|
|
for (const auto& course : Courses) {
|
|
if (dynamic_cast<T*>(course.get())) {
|
|
CurrentCourse = course;
|
|
return;
|
|
}
|
|
}
|
|
printf("World::SetCourseByType() No course by the type found");
|
|
}
|
|
void NextCourse(void);
|
|
void PreviousCourse(void);
|
|
|
|
Matrix Mtx;
|
|
|
|
|
|
std::shared_ptr<Course> CurrentCourse;
|
|
Cup* CurrentCup;
|
|
|
|
std::vector<Cup*> Cups;
|
|
size_t CupIndex = 1;
|
|
|
|
std::vector<StaticMeshActor*> StaticMeshActors;
|
|
std::vector<AActor*> Actors;
|
|
std::vector<OObject*> Objects;
|
|
std::vector<ParticleEmitter*> Emitters;
|
|
|
|
std::unordered_map<s32, OLakitu*> Lakitus;
|
|
|
|
/** Objects **/
|
|
PlayerBombKart playerBombKart[4]; // Used in battle mode
|
|
|
|
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<std::shared_ptr<Course>> Courses;
|
|
size_t CourseIndex = 0; // For browsing courses.
|
|
private:
|
|
|
|
};
|
|
|
|
extern World gWorldInstance;
|