mirror of
https://github.com/HarbourMasters/SpaghettiKart
synced 2026-07-08 06:30:56 -04:00
Impl hm ship actors
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,48 @@
|
||||
#include <libultraship.h>
|
||||
|
||||
extern u8 ghostship_woodmoldy1_rgba16[];
|
||||
extern u8 ghostship_wood3_ci8[];
|
||||
extern u8 ghostship_wood3_pal_rgba16[];
|
||||
extern u8 ghostship_burntfabricHoles_rgba16[];
|
||||
extern u8 ghostship_flag1_ci4[];
|
||||
extern u8 ghostship_flag1_pal_rgba16[];
|
||||
extern u8 ghostship_metallight_ci4[];
|
||||
extern u8 ghostship_metallight_pal_rgba16[];
|
||||
extern u8 ghostship_metal2_i8[];
|
||||
extern u8 ghostship_window_i8[];
|
||||
extern u8 ghostship_woodmoldy2_ci8[];
|
||||
extern u8 ghostship_woodmoldy2_pal_rgba16[];
|
||||
extern Vtx ghostship_Plane_mesh_vtx_cull[8];
|
||||
extern Vtx ghostship_Plane_mesh_vtx_0[174];
|
||||
extern Gfx ghostship_Plane_mesh_tri_0[];
|
||||
extern Vtx ghostship_Plane_mesh_vtx_1[61];
|
||||
extern Gfx ghostship_Plane_mesh_tri_1[];
|
||||
extern Vtx ghostship_Plane_mesh_vtx_2[16];
|
||||
extern Gfx ghostship_Plane_mesh_tri_2[];
|
||||
extern Vtx ghostship_Plane_mesh_vtx_3[10];
|
||||
extern Gfx ghostship_Plane_mesh_tri_3[];
|
||||
extern Vtx ghostship_Plane_mesh_vtx_4[61];
|
||||
extern Gfx ghostship_Plane_mesh_tri_4[];
|
||||
extern Vtx ghostship_Plane_mesh_vtx_5[16];
|
||||
extern Gfx ghostship_Plane_mesh_tri_5[];
|
||||
extern Vtx ghostship_Plane_mesh_vtx_6[60];
|
||||
extern Gfx ghostship_Plane_mesh_tri_6[];
|
||||
extern Vtx ghostship_Plane_mesh_vtx_7[23];
|
||||
extern Gfx ghostship_Plane_mesh_tri_7[];
|
||||
extern Gfx mat_ghostship_boat1[];
|
||||
extern Gfx mat_revert_ghostship_boat1[];
|
||||
extern Gfx mat_ghostship_boat2[];
|
||||
extern Gfx mat_revert_ghostship_boat2[];
|
||||
extern Gfx mat_ghostship_sail[];
|
||||
extern Gfx mat_revert_ghostship_sail[];
|
||||
extern Gfx mat_ghostship_flag[];
|
||||
extern Gfx mat_revert_ghostship_flag[];
|
||||
extern Gfx mat_ghostship_metal1[];
|
||||
extern Gfx mat_revert_ghostship_metal1[];
|
||||
extern Gfx mat_ghostship_glass1[];
|
||||
extern Gfx mat_revert_ghostship_glass1[];
|
||||
extern Gfx mat_ghostship_dark[];
|
||||
extern Gfx mat_revert_ghostship_dark[];
|
||||
extern Gfx mat_ghostship_boat3[];
|
||||
extern Gfx mat_revert_ghostship_boat3[];
|
||||
extern Gfx ghostship_Plane_mesh[];
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,31 @@
|
||||
#include <libultraship.h>
|
||||
|
||||
extern u8 ship2_flag_rgba16[];
|
||||
extern u8 ship2_window_i8[];
|
||||
extern u8 ship2_wood1_ci8[];
|
||||
extern u8 ship2_wood1_pal_rgba16[];
|
||||
extern u8 ship2_wood2_ci4[];
|
||||
extern u8 ship2_wood2_pal_rgba16[];
|
||||
extern u8 ship2_sail2_rgba16[];
|
||||
extern Vtx ship2_SoH_mesh_vtx_cull[8];
|
||||
extern Vtx ship2_SoH_mesh_vtx_0[95];
|
||||
extern Gfx ship2_SoH_mesh_tri_0[];
|
||||
extern Vtx ship2_SoH_mesh_vtx_1[16];
|
||||
extern Gfx ship2_SoH_mesh_tri_1[];
|
||||
extern Vtx ship2_SoH_mesh_vtx_2[236];
|
||||
extern Gfx ship2_SoH_mesh_tri_2[];
|
||||
extern Vtx ship2_SoH_mesh_vtx_3[455];
|
||||
extern Gfx ship2_SoH_mesh_tri_3[];
|
||||
extern Vtx ship2_SoH_mesh_vtx_4[64];
|
||||
extern Gfx ship2_SoH_mesh_tri_4[];
|
||||
extern Gfx mat_ship2_f3d_material_002[];
|
||||
extern Gfx mat_revert_ship2_f3d_material_002[];
|
||||
extern Gfx mat_ship2_f3d_material_003[];
|
||||
extern Gfx mat_revert_ship2_f3d_material_003[];
|
||||
extern Gfx mat_ship2_wood1_001[];
|
||||
extern Gfx mat_revert_ship2_wood1_001[];
|
||||
extern Gfx mat_ship2_wood2[];
|
||||
extern Gfx mat_revert_ship2_wood2[];
|
||||
extern Gfx mat_ship2_sohSail[];
|
||||
extern Gfx mat_revert_ship2_sohSail[];
|
||||
extern Gfx ship2_SoH_mesh[];
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,36 @@
|
||||
#include <libultraship.h>
|
||||
|
||||
extern u8 ship3_wood2_ci8[];
|
||||
extern u8 ship3_wood2_pal_rgba16[];
|
||||
extern u8 ship3_flag_rgba16[];
|
||||
extern u8 ship3_window_i8[];
|
||||
extern u8 ship3_wood1_ci4[];
|
||||
extern u8 ship3_wood1_pal_rgba16[];
|
||||
extern u8 ship3__2shipBetaLogo_rgba32[];
|
||||
extern u8 ship3_sail1_rgba16[];
|
||||
extern Vtx ship3_2Ship_mesh_vtx_cull[8];
|
||||
extern Vtx ship3_2Ship_mesh_vtx_0[1147];
|
||||
extern Gfx ship3_2Ship_mesh_tri_0[];
|
||||
extern Vtx ship3_2Ship_mesh_vtx_1[92];
|
||||
extern Gfx ship3_2Ship_mesh_tri_1[];
|
||||
extern Vtx ship3_2Ship_mesh_vtx_2[16];
|
||||
extern Gfx ship3_2Ship_mesh_tri_2[];
|
||||
extern Vtx ship3_2Ship_mesh_vtx_3[237];
|
||||
extern Gfx ship3_2Ship_mesh_tri_3[];
|
||||
extern Vtx ship3_2Ship_mesh_vtx_4[199];
|
||||
extern Gfx ship3_2Ship_mesh_tri_4[];
|
||||
extern Vtx ship3_2Ship_mesh_vtx_5[199];
|
||||
extern Gfx ship3_2Ship_mesh_tri_5[];
|
||||
extern Gfx mat_ship3_f3d_material_008[];
|
||||
extern Gfx mat_revert_ship3_f3d_material_008[];
|
||||
extern Gfx mat_ship3_flag1[];
|
||||
extern Gfx mat_revert_ship3_flag1[];
|
||||
extern Gfx mat_ship3_f3dlite_material_003[];
|
||||
extern Gfx mat_revert_ship3_f3dlite_material_003[];
|
||||
extern Gfx mat_ship3_wood2_001[];
|
||||
extern Gfx mat_revert_ship3_wood2_001[];
|
||||
extern Gfx mat_ship3__2shipLogo[];
|
||||
extern Gfx mat_revert_ship3__2shipLogo[];
|
||||
extern Gfx mat_ship3_sail2[];
|
||||
extern Gfx mat_revert_ship3_sail2[];
|
||||
extern Gfx ship3_2Ship_mesh[];
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,33 @@
|
||||
#include <libultraship.h>
|
||||
|
||||
extern u8 starship_SoHShinyBlueish_rgba16[];
|
||||
extern u8 starship_tire_i8[];
|
||||
extern u8 starship_superFXBlue_rgba32[];
|
||||
extern u8 starship_SoHShiny_rgba16[];
|
||||
extern u8 starship_superFXBlue_rgba16[];
|
||||
extern u8 starship_shiplogov2_rgba32[];
|
||||
extern u8 starship_flare1_ci8[];
|
||||
extern u8 starship_flare1_pal_rgba16[];
|
||||
extern Vtx starship_Cube_mesh_vtx_cull[8];
|
||||
extern Vtx starship_Cube_mesh_vtx_0[56];
|
||||
extern Gfx starship_Cube_mesh_tri_0[];
|
||||
extern Vtx starship_Cube_mesh_vtx_1[18];
|
||||
extern Gfx starship_Cube_mesh_tri_1[];
|
||||
extern Vtx starship_Cube_mesh_vtx_2[21];
|
||||
extern Gfx starship_Cube_mesh_tri_2[];
|
||||
extern Vtx starship_Cube_mesh_vtx_3[210];
|
||||
extern Gfx starship_Cube_mesh_tri_3[];
|
||||
extern Vtx starship_Cube_mesh_vtx_4[9];
|
||||
extern Gfx starship_Cube_mesh_tri_4[];
|
||||
extern Vtx starship_Cube_mesh_vtx_5[8];
|
||||
extern Gfx starship_Cube_mesh_tri_5[];
|
||||
extern Vtx starship_Cube_mesh_vtx_6[60];
|
||||
extern Gfx starship_Cube_mesh_tri_6[];
|
||||
extern Gfx mat_starship_starship1[];
|
||||
extern Gfx mat_starship_black[];
|
||||
extern Gfx mat_starship_starship2[];
|
||||
extern Gfx mat_starship_starship3[];
|
||||
extern Gfx mat_starship_glass[];
|
||||
extern Gfx mat_starship_f3dlite_material_008[];
|
||||
extern Gfx mat_starship_flare[];
|
||||
extern Gfx starship_Cube_mesh[];
|
||||
+18
-38
@@ -6,12 +6,26 @@ extern "C" {
|
||||
#include "common_structs.h"
|
||||
#include "math_util.h"
|
||||
#include "main.h"
|
||||
#include "courses/ship_model.h"
|
||||
#include "courses/hm64/ghostship_model.h"
|
||||
#include "courses/hm64/ship2_model.h"
|
||||
#include "courses/hm64/ship3_model.h"
|
||||
}
|
||||
|
||||
AShip::AShip(FVector pos) {
|
||||
AShip::AShip(FVector pos, AShip::Skin skin) {
|
||||
Pos = pos;
|
||||
Pos.y += 10;
|
||||
|
||||
switch(skin) {
|
||||
case GHOSTSHIP:
|
||||
_skin = ghostship_Plane_mesh;
|
||||
break;
|
||||
case SHIP2:
|
||||
_skin = ship2_SoH_mesh;
|
||||
break;
|
||||
case SHIP3:
|
||||
_skin = ship3_2Ship_mesh;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void AShip::Tick() {
|
||||
@@ -27,55 +41,21 @@ void AShip::Tick() {
|
||||
|
||||
// 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);
|
||||
if (render_set_position(shipMtx, 0) != 0) {
|
||||
gSPDisplayList(gDisplayListHead++, _skin);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool AShip::IsMod() { return true; }
|
||||
|
||||
@@ -12,7 +12,14 @@ extern "C" {
|
||||
|
||||
class AShip : public AActor {
|
||||
public:
|
||||
explicit AShip(FVector pos);
|
||||
|
||||
enum Skin {
|
||||
GHOSTSHIP,
|
||||
SHIP2,
|
||||
SHIP3,
|
||||
};
|
||||
|
||||
explicit AShip(FVector pos, AShip::Skin);
|
||||
virtual ~AShip() = default;
|
||||
|
||||
virtual void Tick() override;
|
||||
@@ -21,7 +28,6 @@ public:
|
||||
|
||||
FVector Pos;
|
||||
FRotation Rot = {0, 0, 0};
|
||||
FRotation WheelRot = {0, 0, 0};
|
||||
private:
|
||||
f32 scale;
|
||||
Gfx* _skin;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
#include "SpaghettiShip.h"
|
||||
|
||||
#include <libultra/gbi.h>
|
||||
|
||||
extern "C" {
|
||||
#include "common_structs.h"
|
||||
#include "math_util.h"
|
||||
#include "main.h"
|
||||
#include "courses/hm64/ship_model.h"
|
||||
}
|
||||
|
||||
ASpaghettiShip::ASpaghettiShip(FVector pos) {
|
||||
Pos = pos;
|
||||
Pos.y += 10;
|
||||
}
|
||||
|
||||
void ASpaghettiShip::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 ASpaghettiShip::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 ASpaghettiShip::IsMod() { return true; }
|
||||
@@ -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 ASpaghettiShip : public AActor {
|
||||
public:
|
||||
explicit ASpaghettiShip(FVector pos);
|
||||
virtual ~ASpaghettiShip() = 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;
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
#include "Starship.h"
|
||||
|
||||
#include <libultra/gbi.h>
|
||||
|
||||
extern "C" {
|
||||
#include "common_structs.h"
|
||||
#include "math_util.h"
|
||||
#include "main.h"
|
||||
#include "courses/hm64/starship_model.h"
|
||||
}
|
||||
|
||||
AStarship::AStarship(FVector pos) {
|
||||
Pos = pos;
|
||||
}
|
||||
|
||||
void AStarship::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 = angle * (180.0f / M_PI) + 90.0f; // Add 90° offset
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void AStarship::Draw(Camera *camera) {
|
||||
Mat4 shipMtx;
|
||||
Vec3f hullPos = {Pos.x, Pos.y, Pos.z};
|
||||
Vec3s hullRot = {Rot.pitch, Rot.yaw, Rot.roll};
|
||||
|
||||
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
|
||||
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
|
||||
|
||||
mtxf_pos_rotation_xyz(shipMtx, hullPos, hullRot);
|
||||
mtxf_scale(shipMtx, 0.4);
|
||||
if (render_set_position(shipMtx, 0) != 0) {
|
||||
gSPDisplayList(gDisplayListHead++, starship_Cube_mesh);
|
||||
}
|
||||
}
|
||||
|
||||
bool AStarship::IsMod() { return true; }
|
||||
@@ -0,0 +1,24 @@
|
||||
#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 AStarship : public AActor {
|
||||
public:
|
||||
explicit AStarship(FVector pos);
|
||||
virtual ~AStarship() = default;
|
||||
|
||||
virtual void Tick() override;
|
||||
virtual void Draw(Camera*) override;
|
||||
virtual bool IsMod() override;
|
||||
|
||||
FVector Pos;
|
||||
FRotation Rot = {0, 0, 0};
|
||||
};
|
||||
@@ -9,6 +9,8 @@
|
||||
#include "engine/actors/AFinishline.h"
|
||||
#include "engine/actors/BowserStatue.h"
|
||||
#include "engine/actors/Ship.h"
|
||||
#include "engine/actors/SpaghettiShip.h"
|
||||
#include "engine/actors/Starship.h"
|
||||
#include "engine/objects/Object.h"
|
||||
#include "engine/objects/BombKart.h"
|
||||
#include "assets/mario_raceway_data.h"
|
||||
@@ -288,7 +290,7 @@ 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)));
|
||||
gWorldInstance.AddActor(new AShip(FVector(0, 0, 0), AShip::Skin::SHIP3));
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user