This commit is contained in:
MegaMech
2025-02-09 00:58:42 -07:00
parent 322ace4d7d
commit b91f552d76
5 changed files with 6425 additions and 0 deletions
+6240
View File
File diff suppressed because it is too large Load Diff
+74
View File
@@ -0,0 +1,74 @@
#include <libultraship.h>
extern u8 ship1_wood_rgba16[];
extern u8 ship1_metal1_i8[];
extern u8 ship1__32wood_ci8[];
extern u8 ship1__32wood_pal_rgba16[];
extern u8 ship1_sail2_ci8[];
extern u8 ship1_sail2_pal_rgba16[];
extern u8 ship1_hmpainted_rgba32[];
extern u8 ship1_spag1_rgba32[];
extern u8 ship1_sauce_ci4[];
extern u8 ship1_sauce_pal_rgba16[];
extern u8 ship1__32wood_rgba32[];
extern u8 ship1_flag_rgba16[];
extern u8 ship1_wood2_rgba16[];
extern Vtx ship1_Spaghetti_mesh_vtx_cull[8];
extern Vtx ship1_Spaghetti_mesh_vtx_0[108];
extern Gfx ship1_Spaghetti_mesh_tri_0[];
extern Vtx ship1_Spaghetti_mesh_vtx_1[58];
extern Gfx ship1_Spaghetti_mesh_tri_1[];
extern Vtx ship1_Spaghetti_mesh_vtx_2[357];
extern Gfx ship1_Spaghetti_mesh_tri_2[];
extern Vtx ship1_Spaghetti_mesh_vtx_3[15];
extern Gfx ship1_Spaghetti_mesh_tri_3[];
extern Vtx ship1_Spaghetti_mesh_vtx_4[12];
extern Gfx ship1_Spaghetti_mesh_tri_4[];
extern Vtx ship1_Spaghetti_mesh_vtx_5[43];
extern Gfx ship1_Spaghetti_mesh_tri_5[];
extern Vtx ship1_Spaghetti_mesh_vtx_6[43];
extern Gfx ship1_Spaghetti_mesh_tri_6[];
extern Vtx ship1_Spaghetti_mesh_vtx_7[79];
extern Gfx ship1_Spaghetti_mesh_tri_7[];
extern Vtx ship1_Spaghetti_mesh_vtx_8[12];
extern Gfx ship1_Spaghetti_mesh_tri_8[];
extern Vtx ship1_Spaghetti_mesh_vtx_9[3];
extern Gfx ship1_Spaghetti_mesh_tri_9[];
extern Vtx ship1_Spaghetti_mesh_vtx_10[17];
extern Gfx ship1_Spaghetti_mesh_tri_10[];
extern Gfx mat_ship1_boat1[];
extern Gfx mat_revert_ship1_boat1[];
extern Gfx mat_ship1_metal1[];
extern Gfx mat_revert_ship1_metal1[];
extern Gfx mat_ship1_wood1[];
extern Gfx mat_revert_ship1_wood1[];
extern Gfx mat_ship1_sail[];
extern Gfx mat_revert_ship1_sail[];
extern Gfx mat_ship1_logo[];
extern Gfx mat_revert_ship1_logo[];
extern Gfx mat_ship1_spag1[];
extern Gfx mat_revert_ship1_spag1[];
extern Gfx mat_ship1_sauce1[];
extern Gfx mat_revert_ship1_sauce1[];
extern Gfx mat_ship1_meat1[];
extern Gfx mat_revert_ship1_meat1[];
extern Gfx mat_ship1_fork1[];
extern Gfx mat_revert_ship1_fork1[];
extern Gfx mat_ship1_flag[];
extern Gfx mat_revert_ship1_flag[];
extern Gfx mat_ship1_wood2[];
extern Gfx mat_revert_ship1_wood2[];
extern Gfx ship1_Spaghetti_mesh[];
extern u8 wheels_metal1_i8[];
extern u8 wheels_tire_i8[];
extern Vtx wheels_Spaghetti_002_mesh_vtx_cull[8];
extern Vtx wheels_Spaghetti_002_mesh_vtx_0[111];
extern Gfx wheels_Spaghetti_002_mesh_tri_0[];
extern Vtx wheels_Spaghetti_002_mesh_vtx_1[55];
extern Gfx wheels_Spaghetti_002_mesh_tri_1[];
extern Gfx mat_wheels_metal1_002[];
extern Gfx mat_revert_wheels_metal1_002[];
extern Gfx mat_wheels_tire1_002[];
extern Gfx mat_revert_wheels_tire1_002[];
extern Gfx wheels_Spaghetti_002_mesh[];
+81
View File
@@ -0,0 +1,81 @@
#include "Ship.h"
#include <libultra/gbi.h>
extern "C" {
#include "common_structs.h"
#include "math_util.h"
#include "main.h"
#include "courses/ship_model.h"
}
AShip::AShip(FVector pos) {
Pos = pos;
Pos.y += 10;
}
void AShip::Tick() {
static float angle = 0.0f; // Keeps track of the ship's rotation around the circle
float radius = 150.0f; // The radius of the circular path
float speed = 0.01f; // Speed of rotation
angle += speed; // Increment the angle to move in a circle
// Update the position based on a circular path
Pos.x = radius * cosf(angle);
Pos.z = radius * sinf(angle);
// Rotate to face forward along the circle
Rot.yaw = -static_cast<int16_t>(angle * (32768.0f / M_PI / 2.0f));
WheelRot.pitch += 500;
}
void AShip::Draw(Camera *camera) {
Mat4 shipMtx;
Mat4 objectMtx;
Mat4 resultMtx;
Vec3f hullPos = {Pos.x, Pos.y, Pos.z};
Vec3s hullRot = {Rot.pitch, Rot.yaw, Rot.roll};
Vec3s rot = {WheelRot.pitch, WheelRot.yaw, WheelRot.roll};
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
// empty/null mtx as a base
mtxf_pos_rotation_xyz(shipMtx, hullPos, hullRot);
mtxf_scale(shipMtx, 0.4);
if (render_set_position(shipMtx, 0) != 0) {}
// Render the ships hull
Vec3f hullPos2 = {0, 0, 0};
mtxf_translate(objectMtx, hullPos2);
mtxf_multiplication(resultMtx, shipMtx, objectMtx);
if (render_set_position(resultMtx, 3) != 0) {
gSPDisplayList(gDisplayListHead++, ship1_Spaghetti_mesh);
}
// Front tyre
Vec3f pos = {0, 0, 110};
mtxf_rotate_x(shipMtx, WheelRot.pitch);
mtxf_translate(objectMtx, pos);
mtxf_multiplication(resultMtx, shipMtx, objectMtx);
if (render_set_position(resultMtx, 3) != 0) {
gSPDisplayList(gDisplayListHead++, wheels_Spaghetti_002_mesh);
gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);
}
// Back tyre
Vec3f pos2 = {0, 0, -165};
mtxf_rotate_x(shipMtx, WheelRot.pitch);
mtxf_translate(objectMtx, pos2);
mtxf_multiplication(resultMtx, shipMtx, objectMtx);
if (render_set_position(resultMtx, 3) != 0) {
gSPDisplayList(gDisplayListHead++, wheels_Spaghetti_002_mesh);
gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);
}
}
bool AShip::IsMod() { return true; }
+27
View File
@@ -0,0 +1,27 @@
#pragma once
#include <libultraship.h>
#include <libultra/gbi.h>
#include "engine/Actor.h"
#include "CoreMath.h"
extern "C" {
#include "common_structs.h"
#include "assets/other_textures.h"
}
class AShip : public AActor {
public:
explicit AShip(FVector pos);
virtual ~AShip() = default;
virtual void Tick() override;
virtual void Draw(Camera*) override;
virtual bool IsMod() override;
FVector Pos;
FRotation Rot = {0, 0, 0};
FRotation WheelRot = {0, 0, 0};
private:
f32 scale;
};
+3
View File
@@ -8,6 +8,7 @@
#include "World.h"
#include "engine/actors/AFinishline.h"
#include "engine/actors/BowserStatue.h"
#include "engine/actors/Ship.h"
#include "engine/objects/Object.h"
#include "engine/objects/BombKart.h"
#include "assets/mario_raceway_data.h"
@@ -287,6 +288,8 @@ void TestCourse::BeginPlay() {
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));
gWorldInstance.AddActor(new AShip(FVector(0, 0, 0)));
}
// Likely sets minimap boundaries