This commit is contained in:
MegaMech
2025-03-21 20:38:02 -06:00
parent 4f0014bfd3
commit 1dee7001f6
58 changed files with 610 additions and 123 deletions
+1 -1
View File
@@ -9,4 +9,4 @@ run `make model_extract -j` to extract assets in multithreaded. And waits (for m
you can run `make fast64_blender` to run blender with fast64 enable without downloading it.
## Organisation
In Tracks there is all track json and folder (once extracted). In each track folder you can find three folder objects, sections, preview, collision_sections. Objects are all assets who are use for object/actor. Sections are all sections reference in a Gfx list who are use with render_course_segments. And preview are the version of the track who are use in func_8029569C who the complete track or a big part (some are broken). Collision sections are just collision who are use in mk64.
In Tracks there is all track json and folder (once extracted). In each track folder you can find three folder objects, sections, preview, collision_sections. Objects are all assets who are use for object/actor. Sections are all sections reference in a Gfx list who are use with render_course_segments. And preview are the version of the track who are use in render_credits who the complete track or a big part (some are broken). Collision sections are just collision who are use in mk64.
+37
View File
@@ -0,0 +1,37 @@
#pragma once
#include "actors/MarioSign.h"
#include "actors/WarioSign.h"
#include "actors/Cloud.h"
#include "actors/Finishline.h"
#include "actors/SpaghettiShip.h"
#include "actors/Starship.h"
#include "actors/Ship.h"
#include "actors/Tree.h"
#include "vehicles/Train.h"
#include "vehicles/Boat.h"
#include "vehicles/Bus.h"
#include "vehicles/Truck.h"
#include "vehicles/Car.h"
#include "vehicles/Truck.h"
#include "vehicles/TankerTruck.h"
#include "objects/Bat.h"
#include "objects/BombKart.h"
#include "objects/Boos.h"
#include "objects/CheepCheep.h"
#include "objects/Crab.h"
#include "objects/ChainChomp.h"
#include "objects/Flagpole.h"
#include "objects/Hedgehog.h"
#include "objects/HotAirBalloon.h"
#include "objects/Lakitu.h"
#include "objects/Mole.h"
#include "objects/Penguin.h"
#include "objects/Seagull.h"
#include "objects/Thwomp.h"
#include "objects/Seagull.h"
#include "objects/Trashbin.h"
#include "objects/Trophy.h"
#include "objects/Snowman.h"
#include "objects/Podium.h"
@@ -1,6 +1,6 @@
#include <libultraship.h>
#include "ABanana.h"
#include "Banana.h"
#include "engine/Actor.h"
extern "C" {
@@ -1,6 +1,6 @@
#include <libultraship.h>
#include "ACloud.h"
#include "Cloud.h"
#include "engine/Actor.h"
#include "World.h"
@@ -14,11 +14,11 @@ extern f32 gKartHopInitialVelocityTable[];
extern f32 gKartGravityTable[];
}
ACloud::ACloud(Vec3f pos) {
ACloud::ACloud(FVector pos) {
Name = "Cloud";
Pos[0] = pos[0];
Pos[1] = pos[1];
Pos[2] = pos[2];
Pos[0] = pos.x;
Pos[1] = pos.y;
Pos[2] = pos.z;
Rot[0] = 0;
Rot[1] = 0;
Rot[2] = 0;
@@ -2,6 +2,7 @@
#include <libultraship.h>
#include "engine/Actor.h"
#include "CoreMath.h"
extern "C" {
#include "macros.h"
@@ -15,7 +16,7 @@ public:
// Constructor
ACloud(Vec3f pos);
ACloud(FVector pos);
virtual ~ACloud() override = default;
@@ -2,7 +2,7 @@
#include <libultra/gbi.h>
#include "CoreMath.h"
#include "AFinishline.h"
#include "Finishline.h"
#include "engine/Actor.h"
#include "World.h"
#include "assets/common_data.h"
+56
View File
@@ -0,0 +1,56 @@
#include "MarioSign.h"
#include <libultra/gbi.h>
#include <assets/mario_raceway_data.h>
extern "C" {
#include "common_structs.h"
#include "math_util.h"
#include "main.h"
#include "actor_types.h"
}
AMarioSign::AMarioSign(FVector pos) {
Type = ACTOR_MARIO_SIGN;
Name = "Mario Sign";
Pos[0] = pos.x;
Pos[1] = pos.y;
Pos[2] = pos.z;
Flags |= 0x4000;
}
void AMarioSign::Tick() {
if ((Flags & 0x800) == 0) {
if ((Flags & 0x400) != 0) {
Pos[1] += 4.0f;
if (Pos[1] > 800.0f) {
Flags |= 0x800;
Rot[1] += 1820;
}
} else {
Rot[1] += 182;
}
}
}
void AMarioSign::Draw(Camera *camera) {
Mat4 sp40;
f32 unk;
if (Flags & 0x800) {
return;
}
unk = is_within_render_distance(camera->pos, Pos, camera->rot[1], 0, gCameraZoom[camera - camera1], 16000000.0f);
if (CVarGetInteger("gNoCulling", 0) == 1) {
unk = MAX(unk, 0.0f);
}
if (!(unk < 0.0f)) {
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
mtxf_pos_rotation_xyz(sp40, Pos, Rot);
if (render_set_position(sp40, 0) != 0) {
gSPDisplayList(gDisplayListHead++, (Gfx*)d_course_mario_raceway_dl_sign);
}
}
}
+19
View File
@@ -0,0 +1,19 @@
#pragma once
#include <libultraship.h>
#include "engine/Actor.h"
#include "CoreMath.h"
extern "C" {
#include "common_structs.h"
}
class AMarioSign : public AActor {
public:
virtual ~AMarioSign() = default;
explicit AMarioSign(FVector pos);
virtual void Tick() override;
virtual void Draw(Camera*) override;
};
+4 -2
View File
@@ -13,18 +13,20 @@ extern "C" {
}
AShip::AShip(FVector pos, AShip::Skin skin) {
Name = "Ship";
Spawn = pos;
Spawn.y += 10;
switch(skin) {
case GHOSTSHIP:
Name = "Ghostship";
_skin = ghostship_Plane_mesh;
break;
case SHIP2:
Name = "Ship_1";
_skin = ship2_SoH_mesh;
break;
case SHIP3:
Name = "Ship_2";
_skin = ship3_2Ship_mesh;
break;
}
@@ -1,4 +1,4 @@
#include "ATree.h"
#include "Tree.h"
#include <libultra/gbi.h>
@@ -1,4 +1,4 @@
#include "AWarioSign.h"
#include "WarioSign.h"
#include <libultra/gbi.h>
#include <assets/wario_stadium_data.h>
@@ -7,13 +7,15 @@ extern "C" {
#include "common_structs.h"
#include "math_util.h"
#include "main.h"
#include "actor_types.h"
}
AWarioSign::AWarioSign(Vec3f pos) {
AWarioSign::AWarioSign(FVector pos) {
Type = ACTOR_WARIO_SIGN;
Name = "Wario Sign";
Pos[0] = pos[0];
Pos[1] = pos[1];
Pos[2] = pos[2];
Pos[0] = pos.x;
Pos[1] = pos.y;
Pos[2] = pos.z;
}
void AWarioSign::Tick() {
@@ -28,7 +30,6 @@ void AWarioSign::Draw(Camera *camera) {
if (CVarGetInteger("gNoCulling", 0) == 1) {
unk = MAX(unk, 0.0f);
}
if (!(unk < 0.0f)) {
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
@@ -2,6 +2,7 @@
#include <libultraship.h>
#include "engine/Actor.h"
#include "CoreMath.h"
extern "C" {
#include "common_structs.h"
@@ -10,9 +11,8 @@ extern "C" {
class AWarioSign : public AActor {
public:
virtual ~AWarioSign() = default;
explicit AWarioSign(Vec3f pos);
explicit AWarioSign(FVector pos);
virtual void Tick() override;
virtual void Draw(Camera*) override;
+2 -2
View File
@@ -5,7 +5,7 @@
#include "BansheeBoardwalk.h"
#include "World.h"
#include "engine/actors/AFinishline.h"
#include "engine/actors/Finishline.h"
#include "engine/objects/BombKart.h"
#include "engine/objects/CheepCheep.h"
#include "engine/objects/TrashBin.h"
@@ -176,7 +176,7 @@ void BansheeBoardwalk::BeginPlay() {
}
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
FVector pos = { 0, 0, 0 };
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][110], 110, 3, 0.8333333f));
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][190], 190, 1, 0.8333333f));
+1 -1
View File
@@ -127,7 +127,7 @@ void BigDonut::BeginPlay() {
spawn_all_item_boxes((ActorSpawnData*)LOAD_ASSET_RAW(d_course_big_donut_item_box_spawns));
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
FVector pos = {0, 0, 0};
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][20], 20, 0, 1.0f));
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][40], 40, 0, 1.0f));
+1 -1
View File
@@ -123,7 +123,7 @@ void BlockFort::BeginPlay() {
spawn_all_item_boxes((ActorSpawnData*)LOAD_ASSET_RAW(d_course_block_fort_item_box_spawns));
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
FVector pos = { 0, 0, 0 };
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][20], 20, 0, 1.0f));
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][40], 40, 0, 1.0f));
+2 -2
View File
@@ -5,7 +5,7 @@
#include "BowsersCastle.h"
#include "World.h"
#include "engine/actors/AFinishline.h"
#include "engine/actors/Finishline.h"
#include "engine/objects/BombKart.h"
#include "engine/objects/Thwomp.h"
#include "bowsers_castle_data.h"
@@ -195,7 +195,7 @@ void BowsersCastle::BeginPlay() {
}
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
FVector pos = { 0, 0, 0 };
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][50], 50, 3, 0.8333333f));
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][150], 150, 1, 0.8333333f));
+2 -2
View File
@@ -7,7 +7,7 @@
#include "World.h"
#include "engine/objects/BombKart.h"
#include "choco_mountain_data.h"
#include "engine/actors/AFinishline.h"
#include "engine/actors/Finishline.h"
extern "C" {
#include "main.h"
@@ -168,7 +168,7 @@ void ChocoMountain::BeginPlay() {
spawn_falling_rocks((struct ActorSpawnData*)LOAD_ASSET_RAW((const char*)d_course_choco_mountain_falling_rock_spawns));
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
FVector pos = { 0, 0, 0 };
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][140], 140, 3, 0.8333333f));
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][165], 165, 1, 0.8333333f));
+2 -2
View File
@@ -5,7 +5,7 @@
#include "DKJungle.h"
#include "World.h"
#include "engine/actors/AFinishline.h"
#include "engine/actors/Finishline.h"
#include "engine/objects/BombKart.h"
#include "assets/dks_jungle_parkway_data.h"
@@ -164,7 +164,7 @@ void DKJungle::BeginPlay() {
gWorldInstance.AddActor(new ABoat((0.6666666f)/4, 0));
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
FVector pos = { 0, 0, 0 };
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][50], 50, 3, 0.8333333f));
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][100], 100, 1, 0.8333333f));
+1 -1
View File
@@ -122,7 +122,7 @@ void DoubleDeck::BeginPlay() {
spawn_all_item_boxes((ActorSpawnData*)LOAD_ASSET_RAW(d_course_double_deck_item_box_spawns));
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
FVector pos = { 0, 0, 0 };
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][20], 20, 0, 1.0f));
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][40], 40, 0, 1.0f));
+2 -2
View File
@@ -6,7 +6,7 @@
#include "FrappeSnowland.h"
#include "World.h"
#include "CoreMath.h"
#include "engine/actors/AFinishline.h"
#include "engine/actors/Finishline.h"
#include "engine/objects/BombKart.h"
#include "engine/objects/Snowman.h"
#include "assets/frappe_snowland_data.h"
@@ -154,7 +154,7 @@ void FrappeSnowland::BeginPlay() {
}
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
FVector pos = { 0, 0, 0 };
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][50], 50, 3, 0.8333333f));
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][100], 100, 1, 0.8333333f));
+3 -3
View File
@@ -6,7 +6,7 @@
#include "Harbour.h"
#include "World.h"
#include "engine/actors/AFinishline.h"
#include "engine/actors/Finishline.h"
#include "engine/actors/BowserStatue.h"
#include "engine/actors/Ship.h"
#include "engine/actors/SpaghettiShip.h"
@@ -16,8 +16,8 @@
#include "assets/mario_raceway_data.h"
#include "assets/bowsers_castle_data.h"
#include "assets/bowsers_castle_displaylists.h"
#include "engine/actors/ATree.h"
#include "engine/actors/ACloud.h"
#include "engine/actors/Tree.h"
#include "engine/actors/Cloud.h"
#include "engine/vehicles/Train.h"
#include "engine/objects/Trophy.h"
#include "engine/objects/CheepCheep.h"
+2 -2
View File
@@ -5,7 +5,7 @@
#include "KalimariDesert.h"
#include "World.h"
#include "engine/actors/AFinishline.h"
#include "engine/actors/Finishline.h"
#include "engine/objects/BombKart.h"
#include "kalimari_desert_data.h"
#include "engine/vehicles/Utils.h"
@@ -202,7 +202,7 @@ void KalimariDesert::BeginPlay() {
}
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
FVector pos = { 0, 0, 0 };
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][50], 50, 3, 0.8333333f));
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][138], 138, 1, 0.8333333f));
+2 -2
View File
@@ -6,7 +6,7 @@
#include "KoopaTroopaBeach.h"
#include "World.h"
#include "engine/actors/AFinishline.h"
#include "engine/actors/Finishline.h"
#include "engine/objects/BombKart.h"
#include "engine/objects/Crab.h"
#include "assets/koopa_troopa_beach_data.h"
@@ -172,7 +172,7 @@ void KoopaTroopaBeach::BeginPlay() {
}
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
FVector pos = { 0, 0, 0 };
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][60], 60, 1, 0.8333333f));
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][120], 120, 1, 0.8333333f));
+2 -2
View File
@@ -8,7 +8,7 @@
#include "engine/objects/BombKart.h"
#include "assets/luigi_raceway_data.h"
#include "engine/objects/HotAirBalloon.h"
#include "engine/actors/AFinishline.h"
#include "engine/actors/Finishline.h"
extern "C" {
#include "main.h"
@@ -175,7 +175,7 @@ void LuigiRaceway::BeginPlay() {
}
if (gModeSelection == VERSUS) {
Vec3f pos = { 0, 0, 0 };
FVector pos = { 0, 0, 0 };
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][50], 50, 1, 0.8333333f));
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][200], 200, 3, 0.8333333f));
+2 -2
View File
@@ -5,7 +5,7 @@
#include "MarioRaceway.h"
#include "World.h"
#include "engine/actors/AFinishline.h"
#include "engine/actors/Finishline.h"
#include "engine/objects/Object.h"
#include "engine/objects/BombKart.h"
@@ -191,7 +191,7 @@ void MarioRaceway::BeginPlay() {
add_actor_to_empty_slot(position, rotation, velocity, ACTOR_MARIO_SIGN);
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
FVector pos = { 0, 0, 0 };
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][40], 40, 3, 0.8333333f));
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][100], 100, 3, 0.8333333f));
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][265], 265, 3, 0.8333333f));
+2 -2
View File
@@ -5,7 +5,7 @@
#include "MooMooFarm.h"
#include "World.h"
#include "engine/actors/AFinishline.h"
#include "engine/actors/Finishline.h"
#include "engine/objects/BombKart.h"
#include "assets/moo_moo_farm_data.h"
#include "engine/objects/MoleGroup.h"
@@ -311,7 +311,7 @@ void MooMooFarm::BeginPlay() {
}
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
FVector pos = { 0, 0, 0 };
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][50], 50, 3, 0.8333333f));
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][140], 140, 3, 0.8333333f));
+1 -1
View File
@@ -189,7 +189,7 @@ void PodiumCeremony::BeginPlay() {
OTrophy* trophy = reinterpret_cast<OTrophy*>(gWorldInstance.AddObject(new OTrophy(pos, type, OTrophy::Behaviour::PODIUM_CEREMONY)));
Vec3f kart = {0, 0, 0};
FVector kart = { 0, 0, 0 };
gWorldInstance.AddObject(new OBombKart(kart, &D_80164550[3][3], 3, 5, 1.25f));
gWorldInstance.AddObject(new OBombKart(kart, &D_80164550[3][40], 40, 0, 1.0f));
gWorldInstance.AddObject(new OBombKart(kart, &D_80164550[3][60], 60, 0, 1.0f));
+2 -2
View File
@@ -5,7 +5,7 @@
#include "RainbowRoad.h"
#include "World.h"
#include "engine/actors/AFinishline.h"
#include "engine/actors/Finishline.h"
#include "engine/objects/ChainChomp.h"
#include "engine/objects/BombKart.h"
#include "assets/rainbow_road_data.h"
@@ -147,7 +147,7 @@ void RainbowRoad::BeginPlay() {
}
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
FVector pos = { 0, 0, 0 };
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][50], 50, 3, 0.8333333f));
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][100], 100, 1, 0.8333333f));
+2 -2
View File
@@ -5,7 +5,7 @@
#include "RoyalRaceway.h"
#include "World.h"
#include "engine/actors/AFinishline.h"
#include "engine/actors/Finishline.h"
#include "engine/objects/BombKart.h"
#include "assets/royal_raceway_data.h"
@@ -176,7 +176,7 @@ void RoyalRaceway::BeginPlay() {
spawn_piranha_plants((struct ActorSpawnData*)LOAD_ASSET_RAW(d_course_royal_raceway_piranha_plant_spawn));
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
FVector pos = { 0, 0, 0 };
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][50], 50, 3, 0.8333333f));
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][100], 100, 3, 0.8333333f));
+14 -14
View File
@@ -5,7 +5,7 @@
#include "SherbetLand.h"
#include "World.h"
#include "engine/actors/AFinishline.h"
#include "engine/actors/Finishline.h"
#include "engine/objects/BombKart.h"
#include "assets/sherbet_land_data.h"
#include "engine/objects/Penguin.h"
@@ -133,65 +133,65 @@ void SherbetLand::BeginPlay() {
// Multiplayer does not spawn the big penguin
// if (gPlayerCountSelection1 == 1) {
Vec3f pos = {-383.0f, 2.0f, -690.0f};
FVector pos = {-383.0f, 2.0f, -690.0f};
gWorldInstance.AddObject(new OPenguin(pos, 0, OPenguin::PenguinType::EMPEROR, OPenguin::Behaviour::STRUT));
// }
Vec3f pos2 = {-2960.0f, -80.0f, 1521.0f};
FVector pos2 = { -2960.0f, -80.0f, 1521.0f };
auto penguin = reinterpret_cast<OPenguin*>(gWorldInstance.AddObject(new OPenguin(pos2, 0x150, OPenguin::PenguinType::ADULT, OPenguin::Behaviour::CIRCLE)));
auto penguin2 = reinterpret_cast<OPenguin*>(gWorldInstance.AddObject(new OPenguin(pos2, 0x150, OPenguin::PenguinType::ADULT, OPenguin::Behaviour::CIRCLE)));
penguin->Diameter = penguin2->Diameter = 100.0f;
Vec3f pos3 = {-2490.0f, -80.0f, 1612.0f};
FVector pos3 = { -2490.0f, -80.0f, 1612.0f };
auto penguin3 = reinterpret_cast<OPenguin*>(gWorldInstance.AddObject(new OPenguin(pos3, 0x100, OPenguin::PenguinType::ADULT, OPenguin::Behaviour::CIRCLE)));
auto penguin4 = reinterpret_cast<OPenguin*>(gWorldInstance.AddObject(new OPenguin(pos3, 0x100, OPenguin::PenguinType::ADULT, OPenguin::Behaviour::CIRCLE)));
penguin3->Diameter = penguin4->Diameter = 80.0f;
Vec3f pos4 = {-2098.0f, -80.0f, 1624.0f};
FVector pos4 = { -2098.0f, -80.0f, 1624.0f };
auto penguin5 = reinterpret_cast<OPenguin*>(gWorldInstance.AddObject(new OPenguin(pos4, 0xFF00, OPenguin::PenguinType::ADULT, OPenguin::Behaviour::CIRCLE)));
auto penguin6 = reinterpret_cast<OPenguin*>(gWorldInstance.AddObject(new OPenguin(pos4, 0xFF00, OPenguin::PenguinType::ADULT, OPenguin::Behaviour::CIRCLE)));
penguin5->Diameter = penguin6->Diameter = 80.0f;
Vec3f pos5 = {-2080.0f, -80.0f, 1171.0f};
FVector pos5 = { -2080.0f, -80.0f, 1171.0f };
auto penguin7 = reinterpret_cast<OPenguin*>(gWorldInstance.AddObject(new OPenguin(pos5, 0x150, OPenguin::PenguinType::ADULT, OPenguin::Behaviour::CIRCLE)));
auto penguin8 = reinterpret_cast<OPenguin*>(gWorldInstance.AddObject(new OPenguin(pos5, 0x150, OPenguin::PenguinType::ADULT, OPenguin::Behaviour::CIRCLE)));
penguin7->Diameter = penguin8->Diameter = 80.0f;
if (gGamestate == CREDITS_SEQUENCE) {
Vec3f pos6 = {380.0, 0.0f, -535.0f};
FVector pos6 = { 380.0, 0.0f, -535.0f };
auto penguin9 = reinterpret_cast<OPenguin*>(gWorldInstance.AddObject(new OPenguin(pos6, 0x9000, OPenguin::PenguinType::CREDITS, OPenguin::Behaviour::SLIDE3)));
penguin9->MirrorModeAngleOffset = -0x4000;
} else {
Vec3f pos6 = {146.0f, 0.0f, -380.0f};
FVector pos6 = { 146.0f, 0.0f, -380.0f };
auto penguin9 = reinterpret_cast<OPenguin*>(gWorldInstance.AddObject(new OPenguin(pos6, 0x9000, OPenguin::PenguinType::CHICK, OPenguin::Behaviour::SLIDE3)));
penguin9->MirrorModeAngleOffset = -0x4000;
}
Vec3f pos7 = {380.0f, 0.0f, -766.0f};
FVector pos7 = { 380.0f, 0.0f, -766.0f };
auto penguin10 = reinterpret_cast<OPenguin*>(gWorldInstance.AddObject(new OPenguin(pos7, 0x5000, OPenguin::PenguinType::CHICK, OPenguin::Behaviour::SLIDE4)));
penguin10->MirrorModeAngleOffset = 0x8000;
Vec3f pos8 = {-2300.0f, 0.0f, -210.0f};
FVector pos8 = { -2300.0f, 0.0f, -210.0f };
auto penguin11 = reinterpret_cast<OPenguin*>(gWorldInstance.AddObject(new OPenguin(pos8, 0xC000, OPenguin::PenguinType::CHICK, OPenguin::Behaviour::SLIDE6)));
penguin11->MirrorModeAngleOffset = 0x8000;
Vec3f pos9 = {-2500.0f, 0.0f, -250.0f};
FVector pos9 = { -2500.0f, 0.0f, -250.0f };
auto penguin12 = reinterpret_cast<OPenguin*>(gWorldInstance.AddObject(new OPenguin(pos9, 0x4000, OPenguin::PenguinType::CHICK, OPenguin::Behaviour::SLIDE6)));
penguin12->MirrorModeAngleOffset = 0x8000;
Vec3f pos10 = {-535.0f, 0.0f, 875.0f};
FVector pos10 = { -535.0f, 0.0f, 875.0f };
auto penguin13 = reinterpret_cast<OPenguin*>(gWorldInstance.AddObject(new OPenguin(pos10, 0x8000, OPenguin::PenguinType::CHICK, OPenguin::Behaviour::SLIDE6)));
penguin13->MirrorModeAngleOffset = -0x4000;
Vec3f pos11 = {-250.0f, 0.0f, 953.0f};
FVector pos11 = { -250.0f, 0.0f, 953.0f };
auto penguin14 = reinterpret_cast<OPenguin*>(gWorldInstance.AddObject(new OPenguin(pos11, 0x9000, OPenguin::PenguinType::CHICK, OPenguin::Behaviour::SLIDE6)));
penguin14->MirrorModeAngleOffset = -0x4000;
if (gGamestate != CREDITS_SEQUENCE) {
if (gModeSelection == VERSUS) {
Vec3f kart = {0, 0, 0};
FVector kart = { 0, 0, 0 };
gWorldInstance.AddObject(new OBombKart(kart, &D_80164550[0][50], 50, 3, 0.8333333f));
gWorldInstance.AddObject(new OBombKart(kart, &D_80164550[0][100], 100, 1, 0.8333333f));
gWorldInstance.AddObject(new OBombKart(kart, &D_80164550[0][150], 150, 3, 0.8333333f));
+1 -1
View File
@@ -146,7 +146,7 @@ void Skyscraper::BeginPlay() {
spawn_all_item_boxes((ActorSpawnData*)LOAD_ASSET_RAW(d_course_skyscraper_item_box_spawns));
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
FVector pos = { 0, 0, 0 };
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][20], 20, 0, 1.0f));
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][40], 40, 0, 1.0f));
+4 -4
View File
@@ -6,7 +6,7 @@
#include "TestCourse.h"
#include "World.h"
#include "engine/actors/AFinishline.h"
#include "engine/actors/Finishline.h"
#include "engine/actors/BowserStatue.h"
#include "engine/actors/Ship.h"
#include "engine/actors/SpaghettiShip.h"
@@ -16,8 +16,8 @@
#include "assets/mario_raceway_data.h"
#include "assets/bowsers_castle_data.h"
#include "assets/bowsers_castle_displaylists.h"
#include "engine/actors/ATree.h"
#include "engine/actors/ACloud.h"
#include "engine/actors/Tree.h"
#include "engine/actors/Cloud.h"
#include "engine/vehicles/Train.h"
#include "engine/objects/Trophy.h"
#include "engine/objects/CheepCheep.h"
@@ -285,7 +285,7 @@ void TestCourse::BeginPlay() {
//gWorldInstance.AddTrain(ATrain::TenderStatus::HAS_TENDER, 5, 2.5f, 0);
//gWorldInstance.AddTrain(ATrain::TenderStatus::HAS_TENDER, 5, 2.5f, 8);
Vec3f pos2 = {0, 0, 0};
FVector pos2 = { 0, 0, 0 };
gWorldInstance.AddObject(new OBombKart(pos2, &D_80164550[0][25], 25, 4, 0.8333333f));
gWorldInstance.AddObject(new OBombKart(pos2, &D_80164550[0][45], 45, 4, 0.8333333f));
+2 -2
View File
@@ -7,7 +7,7 @@
#include "World.h"
#include "engine/objects/BombKart.h"
#include "assets/toads_turnpike_data.h"
#include "engine/actors/AFinishline.h"
#include "engine/actors/Finishline.h"
#include "engine/vehicles/Bus.h"
#include "engine/vehicles/Car.h"
#include "engine/vehicles/Truck.h"
@@ -195,7 +195,7 @@ void ToadsTurnpike::BeginPlay() {
}
if (gModeSelection == VERSUS) {
Vec3f pos = {0, 0, 0};
FVector pos = { 0, 0, 0 };
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][50], 50, 3, 0.8333333f));
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][100], 100, 1, 0.8333333f));
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][150], 150, 3, 0.8333333f));
+9 -9
View File
@@ -7,8 +7,8 @@
#include "World.h"
#include "engine/objects/BombKart.h"
#include "assets/wario_stadium_data.h"
#include "engine/actors/AWarioSign.h"
#include "engine/actors/AFinishline.h"
#include "engine/actors/WarioSign.h"
#include "engine/actors/Finishline.h"
extern "C" {
#include "main.h"
@@ -166,20 +166,20 @@ void WarioStadium::LoadTextures() {
void WarioStadium::BeginPlay() {
spawn_all_item_boxes((struct ActorSpawnData*) LOAD_ASSET_RAW(d_course_wario_stadium_item_box_spawns));
Vec3f pos = { -131.0f, 83.0f, 286.0f };
pos[0] *= gCourseDirection;
FVector pos = { -131.0f, 83.0f, 286.0f };
pos.x *= gCourseDirection;
gWorldInstance.AddActor(new AWarioSign(pos));
Vec3f pos2 = { -2353.0f, 72.0f, -1608.0f };
pos2[0] *= gCourseDirection;
FVector pos2 = { -2353.0f, 72.0f, -1608.0f };
pos2.x *= gCourseDirection;
gWorldInstance.AddActor(new AWarioSign(pos2));
Vec3f pos3 = { -2622.0f, 79.0f, 739.0f };
pos3[0] *= gCourseDirection;
FVector pos3 = { -2622.0f, 79.0f, 739.0f };
pos3.x *= gCourseDirection;
gWorldInstance.AddActor(new AWarioSign(pos3));
if (gModeSelection == VERSUS) {
Vec3f pos = { 0, 0, 0 };
FVector pos = { 0, 0, 0 };
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][50], 50, 3, 0.8333333f));
gWorldInstance.AddObject(new OBombKart(pos, &D_80164550[0][100], 100, 1, 0.8333333f));
+8 -8
View File
@@ -6,7 +6,7 @@
#include "YoshiValley.h"
#include "World.h"
#include "engine/actors/AFinishline.h"
#include "engine/actors/Finishline.h"
#include "engine/objects/BombKart.h"
#include "engine/objects/Hedgehog.h"
#include "engine/objects/Flagpole.h"
@@ -177,19 +177,19 @@ void YoshiValley::BeginPlay() {
// the original data has values here.
// Note that the Y height is calculated automatically to place the kart on the surface
Vec3f pos = {-1533, 0, -682};
FVector pos = { -1533, 0, -682 };
gWorldInstance.AddObject(new OBombKart(pos, NULL, 0, 0, 0.8333333f));
Vec3f pos2 = {-1565, 0, -619};
FVector pos2 = { -1565, 0, -619 };
gWorldInstance.AddObject(new OBombKart(pos2, NULL, 10, 0, 0.8333333f));
Vec3f pos3 = {-1529, 0, -579};
FVector pos3 = { -1529, 0, -579 };
gWorldInstance.AddObject(new OBombKart(pos3, NULL, 20, 0, 0.8333333f));
Vec3f pos4 = {-1588, 0, -534};
FVector pos4 = { -1588, 0, -534 };
gWorldInstance.AddObject(new OBombKart(pos4, NULL, 30, 0, 0.8333333f));
Vec3f pos5 = {-1598, 0, -207};
FVector pos5 = { -1598, 0, -207 };
gWorldInstance.AddObject(new OBombKart(pos5, NULL, 40, 0, 0.8333333f));
Vec3f pos6 = {-1646, 0, -147};
FVector pos6 = { -1646, 0, -147 };
gWorldInstance.AddObject(new OBombKart(pos6, NULL, 50, 0, 0.8333333f));
Vec3f pos7 = {-2532, 0, -445};
FVector pos7 = { -2532, 0, -445 };
gWorldInstance.AddObject(new OBombKart(pos7, NULL, 60, 0, 0.8333333f));
}
}
-1
View File
@@ -20,7 +20,6 @@ public:
void Tick();
void Draw();
void MouseClick();
void Load();
void AddObject(const char* name, FVector* pos, Vec3s* rot, FVector* scale, Gfx* model, float collScale, GameObject::CollisionType collision, float boundingBoxSize, int32_t* despawnFlag, int32_t despawnValue);
void AddLight(const char* name, FVector* pos, s8* rot);
+21
View File
@@ -339,3 +339,24 @@ void SetDirectionFromRotator(s16 rotator[3], s8 direction[3]) {
//printf("Light dir %d %d %d (from rot 0x%X 0x%X 0x%X)\n", direction[0], direction[1], direction[2], rotator[0], rotator[1], rotator[2]);
}
FVector GetPositionAheadOfCamera(f32 dist) {
FVector pos = FVector(cameras[0].pos[0], cameras[0].pos[1], cameras[0].pos[2]);
f32 pitch = (cameras[0].rot[2] / 65535.0f) * 360.0f;
f32 yaw = (cameras[0].rot[1] / 65535.0f) * 360.0f;
// Convert degrees to radians
pitch = pitch * M_PI / 180.0f;
yaw = yaw * M_PI / 180.0f;
// Compute forward vector
FVector forward(
-sinf(yaw), // X
-sinf(pitch), // Y
cosf(yaw) // Z (vertical component)
);
// Move 1000 units forward from the camera position
return pos + (forward * dist);
}
+1
View File
@@ -45,3 +45,4 @@ bool IntersectRaySphere(const Ray& ray, const FVector& sphereCenter, float radiu
void Editor_AddMatrix(Mat4 mtx, int32_t flags);
float CalculateAngle(const FVector& start, const FVector& end);
void SetDirectionFromRotator(s16 rotator[3], s8 direction[3]);
FVector GetPositionAheadOfCamera(f32 dist);
+5 -5
View File
@@ -29,7 +29,7 @@ extern s8 gPlayerCount;
size_t OBombKart::_count = 0;
OBombKart::OBombKart(Vec3f pos, TrackWaypoint* waypoint, uint16_t waypointIndex, uint16_t state, f32 unk_3C) {
OBombKart::OBombKart(FVector pos, TrackWaypoint* waypoint, uint16_t waypointIndex, uint16_t state, f32 unk_3C) {
Name = "Bomb Kart";
_idx = _count;
Vec3f _pos = {0, 0, 0};
@@ -42,10 +42,10 @@ OBombKart::OBombKart(Vec3f pos, TrackWaypoint* waypoint, uint16_t waypointIndex,
// Set height to the default value of 2000.0f unless Pos[1] is higher.
// This allows placing these on very high surfaces.
f32 height = (pos[1] > 2000.0f) ? pos[1] : 2000.0f;
_pos[0] = pos[0];
_pos[1] = spawn_actor_on_surface(pos[0], height, pos[2]);
_pos[2] = pos[2];
f32 height = (pos.y > 2000.0f) ? pos.y : 2000.0f;
_pos[0] = pos.x;
_pos[1] = spawn_actor_on_surface(pos.x, height, pos.z);
_pos[2] = pos.z;
}
WaypointIndex = waypointIndex;
+1 -1
View File
@@ -50,7 +50,7 @@ public:
Collision _Collision;
// Set waypoint to NULL if using a spawn position and not a waypoint.
explicit OBombKart(Vec3f pos, TrackWaypoint* waypoint, uint16_t waypointIndex, uint16_t state, f32 unk_3C);
explicit OBombKart(FVector pos, TrackWaypoint* waypoint, uint16_t waypointIndex, uint16_t state, f32 unk_3C);
~OBombKart() {
_count--;
+4 -4
View File
@@ -34,7 +34,7 @@ extern s8 gPlayerCount;
}
OPenguin::OPenguin(Vec3f pos, u16 direction, PenguinType type, Behaviour behaviour) {
OPenguin::OPenguin(FVector pos, u16 direction, PenguinType type, Behaviour behaviour) {
Name = "Penguin";
_type = type;
_bhv = behaviour;
@@ -44,9 +44,9 @@ OPenguin::OPenguin(Vec3f pos, u16 direction, PenguinType type, Behaviour behavio
init_object(_objectIndex, 0);
Object *object = &gObjectList[_objectIndex];
object->origin_pos[0] = pos[0] * xOrientation;
object->origin_pos[1] = pos[1];
object->origin_pos[2] = pos[2];
object->origin_pos[0] = pos.x * xOrientation;
object->origin_pos[1] = pos.y;
object->origin_pos[2] = pos.z;
object->unk_0C6 = direction;
switch(type) {
+1 -1
View File
@@ -38,7 +38,7 @@ public:
f32 Diameter = 0.0f; // Waddle in a circle around the spawn point at this diameter.
uint16_t MirrorModeAngleOffset;
explicit OPenguin(Vec3f pos, u16 direction, PenguinType type, Behaviour behaviour);
explicit OPenguin(FVector pos, u16 direction, PenguinType type, Behaviour behaviour);
virtual void Tick() override;
virtual void Draw(s32 cameraId) override;
+1
View File
@@ -125,6 +125,7 @@ void freecam_loop(Camera* camera, Player* player, s8 index) {
void freecam_mouse_manager(Camera* camera, Vec3f forwardVector) {
auto wnd = GameEngine::Instance->context->GetWindow();
Ship::Coords mouse = wnd->GetMouseDelta();
wnd->SetMouseCapture(false);
f32 yawChange = 0.0f;
f32 pitchChange = 0.0f;
+5 -1
View File
@@ -22,6 +22,7 @@
#include <Fonts.h>
#include "window/gui/resource/Font.h"
#include "window/gui/resource/FontFactory.h"
#include "SpaghettiGui.h"
#include <Fast3D/gfx_pc.h>
#include <Fast3D/gfx_rendering_api.h>
@@ -94,7 +95,10 @@ GameEngine::GameEngine() {
this->context->InitResourceManager(archiveFiles, {}, 3); // without this line InitWindow fails in Gui::Init()
this->context->InitConsole(); // without this line the GuiWindow constructor fails in ConsoleWindow::InitElement()
auto wnd = std::make_shared<Fast::Fast3dWindow>(std::vector<std::shared_ptr<Ship::GuiWindow>>({}));
auto gui = std::make_shared<Ship::SpaghettiGui>(std::vector<std::shared_ptr<Ship::GuiWindow>>({}));
auto wnd = std::make_shared<Fast::Fast3dWindow>(gui);
//auto wnd = std::make_shared<Fast::Fast3dWindow>(std::vector<std::shared_ptr<Ship::GuiWindow>>({}));
//auto wnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow());
this->context->Init(archiveFiles, {}, 3, { 26800, 512, 1100 }, wnd, controlDeck);
+1 -1
View File
@@ -28,7 +28,7 @@
#include "engine/courses/BigDonut.h"
#include "engine/courses/Harbour.h"
#include "engine/courses/TestCourse.h"
#include "engine/actors/AFinishline.h"
#include "engine/actors/Finishline.h"
#include "engine/courses/PodiumCeremony.h"
+156
View File
@@ -0,0 +1,156 @@
#include <libultraship.h>
#include "SpaghettiGui.h"
#include <libultraship/src/window/gui/Gui.h>
#include <libultraship/src/window/Window.h>
#include "Config.h"
#ifdef __APPLE__
#include <SDL_hints.h>
#include <SDL_video.h>
#include "graphic/Fast3D/gfx_metal.h"
#include <imgui_impl_metal.h>
#include <imgui_impl_sdl2.h>
#else
#include <SDL2/SDL_hints.h>
#include <SDL2/SDL_video.h>
#endif
#if defined(__ANDROID__) || defined(__IOS__)
#include "port/mobile/MobileImpl.h"
#endif
#ifdef ENABLE_OPENGL
#include <imgui_impl_opengl3.h>
#include <imgui_impl_sdl2.h>
#endif
#if defined(ENABLE_DX11) || defined(ENABLE_DX12)
#include <graphic/Fast3D/gfx_direct3d11.h>
#include <imgui_impl_dx11.h>
#include <imgui_impl_win32.h>
// NOLINTNEXTLINE
IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
#endif
namespace Ship {
#define TOGGLE_BTN ImGuiKey_F1
#define TOGGLE_PAD_BTN ImGuiKey_GamepadBack
void SpaghettiGui::DrawMenu() {
const std::shared_ptr<Window> wnd = Context::GetInstance()->GetWindow();
const std::shared_ptr<Config> conf = Context::GetInstance()->GetConfig();
ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoBackground |
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove |
ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus |
ImGuiWindowFlags_NoResize;
if (GetMenuBar() && GetMenuBar()->IsVisible()) {
windowFlags |= ImGuiWindowFlags_MenuBar;
}
const ImGuiViewport* viewport = ImGui::GetMainViewport();
ImGui::SetNextWindowPos(viewport->WorkPos);
ImGui::SetNextWindowSize(ImVec2((int)wnd->GetWidth(), (int)wnd->GetHeight()));
ImGui::SetNextWindowViewport(viewport->ID);
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
ImGui::PushStyleVar(ImGuiStyleVar_ChildBorderSize, 0.0f);
ImGui::Begin("Main - Deck", nullptr, windowFlags);
ImGui::PopStyleVar(3);
mTemporaryWindowPos = ImGui::GetWindowPos();
const ImGuiID dockId = ImGui::GetID("main_dock");
if (!ImGui::DockBuilderGetNode(dockId)) {
ImGui::DockBuilderRemoveNode(dockId);
ImGui::DockBuilderAddNode(dockId, ImGuiDockNodeFlags_NoTabBar);
ImGui::DockBuilderSetNodeSize(dockId, ImVec2(viewport->Size.x, viewport->Size.y));
ImGui::DockBuilderDockWindow("Main Game", dockId);
const ImGuiViewport* viewport = ImGui::GetMainViewport();
const ImGuiID dockId = ImGui::GetID("main_dock");
ImGuiID topId = ImGui::DockBuilderSplitNode(dockId, ImGuiDir_Up, 0.15f, nullptr, nullptr);
ImGui::DockBuilderSetNodeSize(topId, ImVec2(viewport->Size.x, 40));
ImGuiID bottomId = ImGui::DockBuilderSplitNode(dockId, ImGuiDir_Down, 0.25f, nullptr, nullptr);
ImGui::DockBuilderSetNodeSize(bottomId, ImVec2(viewport->Size.x, viewport->Size.y * 0.1f));
ImGuiID rightId = ImGui::DockBuilderSplitNode(dockId, ImGuiDir_Right, 0.25f, nullptr, nullptr);
ImGui::DockBuilderSetNodeSize(rightId, ImVec2(viewport->Size.x * 0.15f, viewport->Size.y));
// Order of operations matters here for the properties window to be in the right spot
ImGui::DockBuilderDockWindow("Scene Explorer", rightId);
ImGui::DockBuilderDockWindow("Track Properties", rightId); // Attach as second tab
ImGuiID rightBottomId = ImGui::DockBuilderSplitNode(rightId, ImGuiDir_Down, 0.25f, nullptr, nullptr);
ImGui::DockBuilderSetNodeSize(rightBottomId, ImVec2(viewport->Size.x, viewport->Size.y * 0.25));
ImGui::DockBuilderDockWindow("Properties", rightBottomId);
ImGui::DockBuilderDockWindow("Tools", topId);
ImGui::DockBuilderDockWindow("Content Browser", bottomId);
ImGui::DockBuilderFinish(dockId);
}
ImGui::DockSpace(dockId, ImVec2(0.0f, 0.0f), ImGuiDockNodeFlags_None | ImGuiDockNodeFlags_NoDockingInCentralNode);
if (ImGui::IsKeyPressed(TOGGLE_BTN) || ImGui::IsKeyPressed(ImGuiKey_Escape) ||
(ImGui::IsKeyPressed(TOGGLE_PAD_BTN) && CVarGetInteger(CVAR_IMGUI_CONTROLLER_NAV, 0))) {
if ((ImGui::IsKeyPressed(ImGuiKey_Escape) || ImGui::IsKeyPressed(TOGGLE_PAD_BTN)) && GetMenu()) {
GetMenu()->ToggleVisibility();
} else if ((ImGui::IsKeyPressed(TOGGLE_BTN) || ImGui::IsKeyPressed(TOGGLE_PAD_BTN)) && GetMenuBar()) {
Gui::GetMenuBar()->ToggleVisibility();
}
if (wnd->IsFullscreen()) {
Context::GetInstance()->GetWindow()->SetMouseCapture(
!(GetMenuOrMenubarVisible() || wnd->ShouldForceCursorVisibility()));
}
if (CVarGetInteger(CVAR_IMGUI_CONTROLLER_NAV, 0) && GetMenuOrMenubarVisible()) {
mImGuiIo->ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;
} else {
mImGuiIo->ConfigFlags &= ~ImGuiConfigFlags_NavEnableGamepad;
}
}
#if __APPLE__
if ((ImGui::IsKeyDown(ImGuiKey_LeftSuper) || ImGui::IsKeyDown(ImGuiKey_RightSuper)) &&
ImGui::IsKeyPressed(ImGuiKey_R, false)) {
std::reinterpret_pointer_cast<ConsoleWindow>(
Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))
->Dispatch("reset");
}
#else
if ((ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || ImGui::IsKeyDown(ImGuiKey_RightCtrl)) &&
ImGui::IsKeyPressed(ImGuiKey_R, false)) {
std::reinterpret_pointer_cast<ConsoleWindow>(
Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))
->Dispatch("reset");
}
#endif
if (GetMenuBar()) {
GetMenuBar()->Update();
GetMenuBar()->Draw();
}
if (GetMenu()) {
GetMenu()->Update();
GetMenu()->Draw();
}
for (auto& windowIter : mGuiWindows) {
windowIter.second->Update();
windowIter.second->Draw();
}
ImGui::End();
}
}
+19
View File
@@ -0,0 +1,19 @@
#pragma once
#include <libultraship.h>
#include "libultraship/src/window/gui/Gui.h"
#include "libultraship/src/window/Window.h"
class Gui; // <-- forward declare
//class Window;
namespace Ship {
class SpaghettiGui : public Gui {
public:
SpaghettiGui() : Gui() {}
SpaghettiGui(std::vector<std::shared_ptr<GuiWindow>> guiWindows) : Gui(guiWindows) {}
protected:
virtual void DrawMenu() override;
};
}
+127 -10
View File
@@ -15,7 +15,7 @@
#include <defines.h>
#include "CoreMath.h"
#include "World.h"
#include "Crab.h"
#include "AllActors.h"
namespace Editor {
@@ -25,6 +25,10 @@ namespace Editor {
void ContentBrowserWindow::DrawElement() {
static bool refresh = true;
static bool actorContent = false;
static bool objectContent = false;
static bool customContent = false;
// List the available mods/o2r files
// for (size_t i = 0; i < GameEngine::Instance->archiveFiles.size(); i++) {
// auto str = GameEngine::Instance->archiveFiles[i];
@@ -45,10 +49,128 @@ namespace Editor {
return;
}
AddStockContent();
// Display entries in Content
std::string actorText = fmt::format("{0} {1}", actorContent ? ICON_FA_FOLDER_OPEN_O : ICON_FA_FOLDER_O, "Actors");
if (ImGui::Button(actorText.c_str(), ImVec2(80, 32))) {
actorContent = !actorContent;
objectContent = false;
customContent = false;
}
std::string objectText = fmt::format("{0} {1}", objectContent ? ICON_FA_FOLDER_OPEN_O : ICON_FA_FOLDER_O, "Objects");
if (ImGui::Button(objectText.c_str(), ImVec2(80, 32))) {
objectContent = !objectContent;
actorContent = false;
customContent = false;
}
std::string customText = fmt::format("{0} {1}", customContent ? ICON_FA_FOLDER_OPEN_O : ICON_FA_FOLDER_O, "Custom");
if (ImGui::Button(customText.c_str(), ImVec2(80, 32))) {
customContent = !customContent;
actorContent = false;
objectContent = false;
}
if (actorContent) {
AddActorContent();
}
if (objectContent) {
AddObjectContent();
}
if (customContent) {
AddCustomContent();
}
}
std::unordered_map<std::string, std::function<AActor*(const FVector&)>> ActorList = {
{ "Mario Sign", [](const FVector& pos) { return new AMarioSign(pos); } },
{ "Wario Sign", [](const FVector& pos) { return new AWarioSign(pos); } },
{ "Cloud", [](const FVector& pos) { return new ACloud(pos); } },
{ "Finishline", [](const FVector& pos) { return new AFinishline(pos); } },
{ "Ghostship", [](const FVector& pos) { return new AShip(pos, AShip::Skin::GHOSTSHIP); } },
{ "Ship_1", [](const FVector& pos) { return new AShip(pos, AShip::Skin::SHIP2); } },
{ "Ship_2", [](const FVector& pos) { return new AShip(pos, AShip::Skin::SHIP3); } },
{ "SpaghettiShip", [](const FVector& pos) { return new ASpaghettiShip(pos); } },
{ "Starship", [](const FVector& pos) { return new AStarship(pos); } },
{ "Train", [](const FVector& pos) { return new ATrain(ATrain::TenderStatus::HAS_TENDER, 4, 2.5f, 0); } },
{ "Boat", [](const FVector& pos) { return new ABoat((0.6666666f)/4, 0); } },
{ "Bus", [](const FVector& pos) { return new ABus(2.0f, 2.5f, &D_80164550[0][0], 0); } },
{ "Car", [](const FVector& pos) { return new ACar(2.0f, 2.5f, &D_80164550[0][0], 0); } },
{ "Truck", [](const FVector& pos) { return new ATruck(2.0f, 2.5f, &D_80164550[0][0], 0); } },
{ "Tanker Truck", [](const FVector& pos) { return new ATankerTruck(2.0f, 2.5f, &D_80164550[0][0], 0); } },
};
std::unordered_map<std::string, std::function<OObject*(const FVector&)>> ObjectList = {
{ "Bat", [](const FVector& pos) { return new OBat(pos, IRotator(0, 0, 0)); } },
{ "Bomb Kart", [](const FVector& pos) { return new OBombKart(pos, &D_80164550[0][0], 0, 0, 0.8333333f); } },
// { "Boos", [](const FVector& pos) { return new OBoos(pos, &D_80164550[0][0], 0, 0, 0.8333333f); } },
{ "CheepCheep", [](const FVector& pos) { return new OCheepCheep(pos, OCheepCheep::CheepType::RACE, IPathSpan(0, 10)); } },
{ "Crab", [](const FVector& pos) { return new OCrab(FVector2D(0, 10), FVector2D(20, 10)); } },
{ "ChainChomp", [](const FVector& pos) { return new OChainChomp(); } },
{ "Flagpole", [](const FVector& pos) { return new OFlagpole(pos, 0); } },
{ "Hedgehog", [](const FVector& pos) { return new OHedgehog(pos, FVector2D(0, 10), 0); } },
{ "HotAirBalloon", [](const FVector& pos) { return new OHotAirBalloon(pos); } },
{ "Lakitu", [](const FVector& pos) { return new OLakitu(0, OLakitu::LakituType::STARTER); } },
// { "Mole", [](const FVector& pos) { return new OMole(pos, ); } }, // <-- Needs a group
{ "Chick Penguin", [](const FVector& pos) { return new OPenguin(pos, 0, OPenguin::PenguinType::CHICK, OPenguin::Behaviour::SLIDE3); } },
{ "Penguin", [](const FVector& pos) { return new OPenguin(pos, 0, OPenguin::PenguinType::ADULT, OPenguin::Behaviour::CIRCLE); } },
{ "Emperor Penguin", [](const FVector& pos) { return new OPenguin(pos, 0, OPenguin::PenguinType::EMPEROR, OPenguin::Behaviour::STRUT); } },
{ "Seagull", [](const FVector& pos) { return new OSeagull(pos); } },
{ "Thwomp", [](const FVector& pos) { return new OThwomp(pos.x, pos.z, 0, 1.0f, 0, 0, 2.0f); } },
{ "Trashbin", [](const FVector& pos) { return new OTrashBin(pos, IRotator(0, 0, 0), 1.0f, OTrashBin::Behaviour::MUNCHING); } },
{ "Trophy", [](const FVector& pos) { return new OTrophy(pos, OTrophy::TrophyType::GOLD_150, OTrophy::Behaviour::ROTATE2); } },
{ "Snowman", [](const FVector& pos) { return new OSnowman(pos); } },
{ "Podium", [](const FVector& pos) { return new OPodium(pos); } },
};
void ContentBrowserWindow::AddActorContent() {
FVector pos = GetPositionAheadOfCamera(300.0f);
size_t i_actor = 0;
for (const auto& actor : ActorList) {
if ((i_actor != 0) && (i_actor % 10 == 0)) {
} else {
ImGui::SameLine();
}
std::string label = fmt::format("{}##{}", actor.first, i_actor);
if (ImGui::Button(label.c_str())) {
gWorldInstance.AddActor(actor.second(pos)); // Pass pos to the lambda
}
i_actor += 1;
}
}
void ContentBrowserWindow::AddObjectContent() {
FVector pos = GetPositionAheadOfCamera(300.0f);
size_t i_object = 0;
for (auto& object : ObjectList) {
if ((i_object != 0) && (i_object % 10 == 0)) {
} else {
ImGui::SameLine();
}
std::string label = fmt::format("{}##{}", object.first, i_object);
if (ImGui::Button(label.c_str())) {
gWorldInstance.AddObject(object.second(pos)); // Pass pos to the lambda
}
i_object += 1;
}
}
void ContentBrowserWindow::AddCustomContent() {
size_t i_custom = 0;
for (const auto& file : Content) {
if (ImGui::Button(file.c_str())) {
if ((i_custom != 0) && (i_custom % 10 == 0)) {
} else {
ImGui::SameLine();
}
std::string label = fmt::format("{}##{}", file, i_custom);
if (ImGui::Button(label.c_str())) {
int coll;
//printf("ContentBrowser.cpp: name: %s\n", test.c_str());
std::string name = file.substr(file.find_last_of('/') + 1);
@@ -57,12 +179,7 @@ namespace Editor {
actor->Model = "__OTR__" + file;
}
}
}
void ContentBrowserWindow::AddStockContent() {
if (ImGui::Button("Crab")) {
gWorldInstance.AddObject(new OCrab(FVector2D(0, 0), FVector2D(0, 100)));
i_custom += 1;
}
}
+3 -1
View File
@@ -13,7 +13,9 @@ protected:
void InitElement() override {};
void DrawElement() override;
void UpdateElement() override {};
void AddStockContent();
void AddActorContent();
void AddObjectContent();
void AddCustomContent();
void FindContent();
};
}
+6
View File
@@ -6,6 +6,7 @@
#include "FreecamWindow.h"
#include "Tools.h"
#include "SceneExplorer.h"
#include "Properties.h"
#include "TrackProperties.h"
#include "ContentBrowser.h"
@@ -38,6 +39,7 @@ std::shared_ptr<Ship::GuiWindow> mGameInfoWindow;
std::shared_ptr<Ship::GuiWindow> mMultiplayerWindow;
std::shared_ptr<Ship::GuiWindow> mToolsWindow;
std::shared_ptr<Ship::GuiWindow> mSceneExplorerWindow;
std::shared_ptr<Ship::GuiWindow> mPropertiesWindow;
std::shared_ptr<Ship::GuiWindow> mTrackPropertiesWindow;
std::shared_ptr<Ship::GuiWindow> mContentBrowserWindow;
@@ -88,6 +90,9 @@ void SetupGuiElements() {
mSceneExplorerWindow = std::make_shared<Editor::SceneExplorerWindow>("gEditorEnabled", "Scene Explorer");
gui->AddGuiWindow(mSceneExplorerWindow);
mPropertiesWindow = std::make_shared<Editor::PropertiesWindow>("gEditorEnabled", "Properties");
gui->AddGuiWindow(mPropertiesWindow);
mTrackPropertiesWindow = std::make_shared<Editor::TrackPropertiesWindow>("gEditorEnabled", "Track Properties");
gui->AddGuiWindow(mTrackPropertiesWindow);
@@ -106,6 +111,7 @@ void Destroy() {
mInputEditorWindow = nullptr;
mToolsWindow = nullptr;
mSceneExplorerWindow = nullptr;
mPropertiesWindow = nullptr;
mTrackPropertiesWindow = nullptr;
mContentBrowserWindow = nullptr;
}
+10 -7
View File
@@ -87,6 +87,14 @@ void PortMenu::AddSettings() {
// General Settings
AddSidebarEntry("Settings", "General", 3);
WidgetPath path = { "Settings", "General", SECTION_COLUMN_1 };
static bool isFullscreen = false;
AddWidget(path, "Toggle Fullscreen", WIDGET_CHECKBOX)
.ValuePointer(&isFullscreen)
.PreFunc([](WidgetInfo& info) { isFullscreen = Ship::Context::GetInstance()->GetWindow()->IsFullscreen(); })
.Callback([](WidgetInfo& info) { Ship::Context::GetInstance()->GetWindow()->ToggleFullscreen(); })
.Options(CheckboxOptions().Tooltip("Toggles Fullscreen On/Off."));
AddWidget(path, "Menu Theme", WIDGET_CVAR_COMBOBOX)
.CVar("gSettings.Menu.Theme")
.Options(ComboboxOptions()
@@ -175,7 +183,6 @@ void PortMenu::AddSettings() {
// Graphics Settings
static int32_t maxFps;
static bool isFullscreen = false;
const char* tooltip = "";
if (Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == Ship::WindowBackend::FAST3D_DXGI_DX11) {
maxFps = 360;
@@ -189,11 +196,8 @@ void PortMenu::AddSettings() {
}
path.sidebarName = "Graphics";
AddSidebarEntry("Settings", "Graphics", 3);
AddWidget(path, "Toggle Fullscreen", WIDGET_CHECKBOX)
.ValuePointer(&isFullscreen)
.PreFunc([](WidgetInfo& info) { isFullscreen = Ship::Context::GetInstance()->GetWindow()->IsFullscreen(); })
.Callback([](WidgetInfo& info) { Ship::Context::GetInstance()->GetWindow()->ToggleFullscreen(); })
.Options(CheckboxOptions().Tooltip("Toggles Fullscreen On/Off."));
AddWidget(path, "Renderer API (Needs reload)", WIDGET_VIDEO_BACKEND);
#ifndef __APPLE__
AddWidget(path, "Internal Resolution: %.0f%%", WIDGET_CVAR_SLIDER_FLOAT)
.CVar(CVAR_INTERNAL_RESOLUTION)
@@ -276,7 +280,6 @@ void PortMenu::AddSettings() {
.Min(0)
.Max(360)
.DefaultValue(80));
AddWidget(path, "Renderer API (Needs reload)", WIDGET_VIDEO_BACKEND);
AddWidget(path, "Enable Vsync", WIDGET_CVAR_CHECKBOX)
.CVar(CVAR_VSYNC_ENABLED)
.PreFunc([](WidgetInfo& info) { info.isHidden = mPortMenu->disabledMap.at(DISABLE_FOR_NO_VSYNC).active; })
+25
View File
@@ -0,0 +1,25 @@
#include "Properties.h"
#include "port/ui/PortMenu.h"
#include "UIWidgets.h"
#include "libultraship/src/Context.h"
#include <imgui.h>
#include <map>
#include <libultraship/libultraship.h>
#include <spdlog/fmt/fmt.h>
#include "spdlog/formatter.h"
#include <common_structs.h>
#include <defines.h>
#include "engine/editor/Editor.h"
#include "port/Game.h"
namespace Editor {
PropertiesWindow::~PropertiesWindow() {
SPDLOG_TRACE("destruct scene explorer window");
}
void PropertiesWindow::DrawElement() {
}
}
+17
View File
@@ -0,0 +1,17 @@
#pragma once
#include <libultraship/libultraship.h>
#include "port/Game.h"
namespace Editor {
class PropertiesWindow : public Ship::GuiWindow {
public:
using Ship::GuiWindow::GuiWindow;
~PropertiesWindow();
protected:
void InitElement() override {};
void DrawElement() override;
void UpdateElement() override {};
};
}
+1 -1
View File
@@ -14,4 +14,4 @@ protected:
void DrawElement() override;
void UpdateElement() override {};
};
}
}
+1 -1
View File
@@ -882,7 +882,7 @@ void func_8003BE30(void) {
void func_8003C0F0(void) {
s16 sp5E;
s16 sp5C;
s16 sp5A;
s16 sp5A = 0;
s32 temp;
UNUSED s32 pad[4];