diff options
Diffstat (limited to 'src/engine/actors/Ship.cpp')
| -rw-r--r-- | src/engine/actors/Ship.cpp | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/src/engine/actors/Ship.cpp b/src/engine/actors/Ship.cpp index 148b883eb..5af3553e2 100644 --- a/src/engine/actors/Ship.cpp +++ b/src/engine/actors/Ship.cpp @@ -1,6 +1,8 @@ #include "Ship.h" #include <libultra/gbi.h> +#include "CoreMath.h" +#include "Matrix.h" extern "C" { #include "common_structs.h" @@ -14,48 +16,41 @@ extern "C" { AShip::AShip(FVector pos, AShip::Skin skin) { Spawn = pos; Spawn.y += 10; - + Pos[0] = pos.x; + Pos[1] = pos.y; + Pos[2] = pos.z; + Scale = FVector(0.4, 0.4, 0.4); + 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; } + Model = _skin; } 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 = Spawn.x + radius * cosf(angle); - Pos.z = Spawn.z + radius * sinf(angle); + // 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 - // Rotate to face forward along the circle - Rot.yaw = -static_cast<int16_t>(angle * (32768.0f / M_PI / 2.0f)); -} - -void AShip::Draw(Camera *camera) { - Mat4 shipMtx; - Vec3f hullPos = {Pos.x, Pos.y, Pos.z}; - Vec3s hullRot = {Rot.pitch, Rot.yaw, Rot.roll}; + // angle += speed; // Increment the angle to move in a circle - gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH); - gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING); + // // Update the position based on a circular path + // Pos.x = Spawn.x + radius * cosf(angle); + // Pos.z = Spawn.z + radius * sinf(angle); - mtxf_pos_rotation_xyz(shipMtx, hullPos, hullRot); - mtxf_scale(shipMtx, 0.4); - if (render_set_position(shipMtx, 0) != 0) { - gSPDisplayList(gDisplayListHead++, _skin); - } + // // Rotate to face forward along the circle + // Rot.yaw = -static_cast<int16_t>(angle * (32768.0f / M_PI / 2.0f)); } bool AShip::IsMod() { return true; } |
