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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
#include "MarioSign.h"
#include <libultra/gbi.h>
#include <assets/models/tracks/mario_raceway/mario_raceway_data.h>
#include "port/interpolation/FrameInterpolation.h"
#include "engine/CoreMath.h"
extern "C" {
#include "common_structs.h"
#include "racing/math_util.h"
#include "main.h"
#include "actor_types.h"
#include "code_800029B0.h"
#include "racing/collision.h"
}
size_t AMarioSign::_count = 0;
AMarioSign::AMarioSign(const SpawnParams& params) : AActor(params) {
Name = "Mario Sign";
ResourceName = "mk:mario_sign";
Model = d_course_mario_raceway_dl_sign;
Speed = params.Speed.value_or(182);
_idx = _count;
FVector pos = params.Location.value_or(FVector(0, 0, 0));
Pos[0] = pos.x * gTrackDirection;
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));
func_802AAAAC(&Unk30);
Flags = -0x8000;
Flags |= 0x4000;
_count += 1;
}
bool AMarioSign::IsMod() {
return true;
}
void AMarioSign::SetSpawnParams(SpawnParams& params) {
AActor::SetSpawnParams(params);
}
void AMarioSign::Tick() {
if ((Flags & 0x800) == 0) {
if ((Flags & 0x400) != 0) {
Pos[1] += 4.0f;
if (Pos[1] > 800.0f) {
Flags |= 0x800;
Rot[1] += Speed * 10; // Originally 1820
}
} else {
Rot[1] += Speed; // Originally 182
}
}
}
void AMarioSign::Draw(Camera *camera) {
Mat4 sp40;
f32 unk;
if (Flags & 0x800) {
return;
}
unk = is_within_render_distance(camera->pos, Pos, camera->rot[1], 0, camera->fieldOfView, 16000000.0f);
if (CVarGetInteger("gNoCulling", 0) == 1) {
unk = MAX(unk, 0.0f);
}
if (!(unk < 0.0f)) {
FrameInterpolation_RecordOpenChild("mk:mario_sign", TAG_OBJECT((_idx << 4) | camera->cameraId));
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
mtxf_pos_rotation_xyz(sp40, Pos, Rot);
if (render_set_position(sp40, 0) != 0) {
gSPDisplayList(gDisplayListHead++, (Gfx*)d_course_mario_raceway_dl_sign);
}
FrameInterpolation_RecordCloseChild();
}
}
|