summaryrefslogtreecommitdiff
path: root/src/engine/actors/BowserStatue.cpp
blob: c850d17305eb83e9b84aee9547bef3cdcedcd3f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include "BowserStatue.h"

#include <libultra/gbi.h>
#include "engine/Matrix.h"
#include "port/interpolation/FrameInterpolation.h"
extern "C" {
#include "common_structs.h"
#include "racing/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];

size_t ABowserStatue::_count = 0;

ABowserStatue::ABowserStatue(const SpawnParams& params) {
    Name = "Bowser Statue";
    ResourceName = "mk:bowser_statue";
    FVector pos = params.Location.value_or(FVector(0, 0, 0));
    Pos[0] = pos.x; Pos[1] = pos.y; Pos[2] = pos.z;

    IRotator rot = params.Rotation.value_or(IRotator(0, 0, 0));
    Rot[0] = rot.pitch; Rot[1] = rot.yaw; Rot[2] = rot.roll;

    Scale = params.Scale.value_or(FVector(1.0f, 1.0f, 1.0f));

    mBehaviour = static_cast<ABowserStatue::Behaviour>(params.Behaviour.value_or(0));
    _idx = _count;
    _count += 1;
}

void ABowserStatue::Tick() {
    switch(mBehaviour) {
        case DEFAULT:
            break;
        case CRUSH:
            break;
    }
}

void ABowserStatue::Draw(Camera *camera) {
    Mat4 mtx;
    gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
    gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
    
    FVector pos = FVector(Pos[0] + 76, Pos[1], Pos[2] + 1846);

    FrameInterpolation_RecordOpenChild("mk:bowser_statue", TAG_OBJECT((_idx << 4) | camera->cameraId));
    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);
    FrameInterpolation_RecordCloseChild();
}

bool ABowserStatue::IsMod() { return true; }