Add statue

This commit is contained in:
MegaMech 2025-12-12 14:05:58 -07:00
parent 6f93e82f61
commit 1035cb4633
5 changed files with 24 additions and 18 deletions

View File

@ -11,6 +11,7 @@
#include "actors/Ship.h"
#include "actors/Tree.h"
#include "actors/Text.h"
#include "actors/BowserStatue.h"
#include "vehicles/Train.h"
#include "vehicles/Boat.h"
#include "vehicles/Bus.h"

View File

@ -36,4 +36,4 @@ void AddKartMatrix(Mat4 mtx, s32 flags);
}
#endif
#endif // _MATRIX_HEADER_
#endif // _MATRIX_HEADER_

View File

@ -435,6 +435,13 @@ void RegisterActors(Registry<ActorInfo, const SpawnParams&>& r) {
GetWorld()->AddActor(new AText(params));
}
);
info = { .ResourceName = "mk:bowser_statue", .Name = "Bowser Statue" };
r.Add(info,
[](const SpawnParams& params) {
GetWorld()->AddActor(new ABowserStatue(params));
}
);
}
void RegisterTracks(Registry<TrackInfo>& r) {

View File

@ -1,26 +1,28 @@
#include "BowserStatue.h"
#include <libultra/gbi.h>
#include "engine/Matrix.h"
extern "C" {
#include "common_structs.h"
#include "math_util.h"
#include "main.h"
#include "assets/models/tracks/bowsers_castle/bowsers_castle_data.h"
#include "assets/models/tracks/bowsers_castle/bowsers_castle_displaylists.h"
}
Vtx gBowserStatueVtx[717];
Gfx gBowserStatueGfx[162];
ABowserStatue::ABowserStatue(FVector pos, ABowserStatue::Behaviour behaviour) {
ABowserStatue::ABowserStatue(const SpawnParams& params) {
Name = "Bowser Statue";
ResourceName = "mk:bowser_statue";
Pos = pos;
ABowserStatue::Behaviour _behaviour = behaviour;
Pos = params.Location.value_or(FVector(0, 0, 0));
ABowserStatue::Behaviour _behaviour = static_cast<ABowserStatue::Behaviour>(params.Behaviour.value_or(0));
}
void ABowserStatue::Tick() {
switch(_behaviour) {
switch(mBehaviour) {
case DEFAULT:
break;
case CRUSH:
@ -30,18 +32,15 @@ void ABowserStatue::Tick() {
void ABowserStatue::Draw(Camera *camera) {
Mat4 mtx;
Vec3f pos;
pos[0] = Pos.x + 76;
pos[1] = Pos.y;
pos[2] = Pos.z + 1846;
FVector pos = FVector(Pos.x + 76, Pos.y, Pos.z + 1846);
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
mtxf_pos_rotation_xyz(mtx, pos, Rot);
if (render_set_position(mtx, 0) != 0) {
gSPDisplayList(gDisplayListHead++, gBowserStatueGfx);
}
ApplyMatrixTransformations(mtx, pos, *(IRotator*)&Rot, Scale);
AddObjectMatrix(mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPSetCombineMode(gDisplayListHead++,G_CC_MODULATEIA, G_CC_MODULATEIA);
gDPSetRenderMode(gDisplayListHead++,G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2);
gSPDisplayList(gDisplayListHead++,(Gfx*) d_course_bowsers_castle_packed_dl_2BB8);
}
bool ABowserStatue::IsMod() { return true; }

View File

@ -17,13 +17,13 @@ extern Gfx gBowserStatueGfx[162];
// That generator is currently commented out. So this actor is not usable atm.
class ABowserStatue : public AActor {
public:
enum Behaviour {
enum Behaviour : int16_t {
DEFAULT,
CRUSH
};
virtual ~ABowserStatue() = default;
explicit ABowserStatue(FVector pos, ABowserStatue::Behaviour behaviour);
explicit ABowserStatue(const SpawnParams& params);
virtual void Tick() override;
virtual void Draw(Camera*) override;
@ -31,6 +31,5 @@ public:
FVector Pos;
private:
ABowserStatue::Behaviour _behaviour;
f32 scale;
ABowserStatue::Behaviour mBehaviour;
};