mirror of
https://github.com/HarbourMasters/SpaghettiKart
synced 2026-09-05 11:07:30 -04:00
Added adjustable track properties to editor
This commit is contained in:
@@ -22,6 +22,8 @@ extern "C" {
|
||||
#include "camera.h"
|
||||
}
|
||||
|
||||
namespace EditorNamespace {
|
||||
|
||||
int gfx_create_framebuffer(uint32_t width, uint32_t height, uint32_t native_width, uint32_t native_height,
|
||||
uint8_t resize);
|
||||
|
||||
@@ -107,3 +109,14 @@ void Editor::SelectObjectFromSceneExplorer(GameObject* object) {
|
||||
eObjectPicker.eGizmo.Enabled = true;
|
||||
eObjectPicker.eGizmo.SetGizmoNoCursor(object);
|
||||
}
|
||||
|
||||
void Editor::SetLevelDimensions(s16 minX, s16 maxX, s16 minZ, s16 maxZ, s16 minY, s16 maxY) {
|
||||
eObjectPicker.eGizmo.dimensions.MinX = minX + -1000;
|
||||
eObjectPicker.eGizmo.dimensions.MaxX = maxX + 1000;
|
||||
eObjectPicker.eGizmo.dimensions.MinY = minY + -100;
|
||||
eObjectPicker.eGizmo.dimensions.MaxY = maxY + 500;
|
||||
eObjectPicker.eGizmo.dimensions.MinZ = minZ + -1000;
|
||||
eObjectPicker.eGizmo.dimensions.MaxZ = maxZ + 1000;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ extern "C" {
|
||||
#include "src/racing/collision.h"
|
||||
}
|
||||
|
||||
namespace EditorNamespace {
|
||||
|
||||
Gizmo::Gizmo() {
|
||||
}
|
||||
|
||||
@@ -109,6 +111,16 @@ void Gizmo::Translate() {
|
||||
break;
|
||||
}
|
||||
|
||||
if (CVarGetInteger("gEditorBoundary", 0) == true) {
|
||||
_selected->Pos->x = MAX(_selected->Pos->x, dimensions.MinX);
|
||||
_selected->Pos->x = MIN(_selected->Pos->x, dimensions.MaxX);
|
||||
|
||||
_selected->Pos->y = MAX(_selected->Pos->y, dimensions.MinY);
|
||||
_selected->Pos->y = MIN(_selected->Pos->y, dimensions.MaxY);
|
||||
|
||||
_selected->Pos->z = MAX(_selected->Pos->z, dimensions.MinZ);
|
||||
_selected->Pos->z = MIN(_selected->Pos->z, dimensions.MaxZ);
|
||||
}
|
||||
|
||||
Pos = FVector(
|
||||
_selected->Pos->x,
|
||||
@@ -195,3 +207,4 @@ void Gizmo::DrawHandles() {
|
||||
gSPDisplayList(gDisplayListHead++, handle_Cylinder_mesh);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include <libultra/gbi.h>
|
||||
#include "Collision.h"
|
||||
|
||||
namespace EditorNamespace {
|
||||
|
||||
class Gizmo {
|
||||
public:
|
||||
|
||||
@@ -27,6 +29,15 @@ public:
|
||||
void DrawHandles();
|
||||
f32 SnapToSurface(FVector* pos);
|
||||
|
||||
struct TrackDimensions {
|
||||
s16 MinX = -10000;
|
||||
s16 MaxX = 10000;
|
||||
s16 MinY = -3000;
|
||||
s16 MaxY = 3000;
|
||||
s16 MinZ = -10000;
|
||||
s16 MaxZ = 10000;
|
||||
};
|
||||
TrackDimensions dimensions;
|
||||
|
||||
bool Enabled;
|
||||
GizmoHandle SelectedHandle;
|
||||
@@ -542,3 +553,4 @@ Gfx handle_Cylinder_mesh[13] = {
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
@@ -23,6 +23,8 @@ extern "C" {
|
||||
#include "camera.h"
|
||||
}
|
||||
|
||||
namespace EditorNamespace {
|
||||
|
||||
ObjectPicker::ObjectPicker() {
|
||||
|
||||
}
|
||||
@@ -180,3 +182,4 @@ void ObjectPicker::FindObject(Ray ray, std::vector<GameObject>& objects) {
|
||||
_selected = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include "Collision.h"
|
||||
#include "Gizmo.h"
|
||||
|
||||
namespace EditorNamespace {
|
||||
|
||||
class ObjectPicker {
|
||||
public:
|
||||
ObjectPicker();
|
||||
@@ -25,3 +27,4 @@ class ObjectPicker {
|
||||
void Copy(MtxF* src, MtxF* dest);
|
||||
void Clear(MtxF* mf);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user