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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
#include "ChainChomp.h"
#include "World.h"
extern "C" {
#include "render_objects.h"
#include "update_objects.h"
#include "assets/rainbow_road_data.h"
#include "assets/common_data.h"
#include "math_util.h"
#include "math_util_2.h"
#include "code_80086E70.h"
#include "code_80057C60.h"
#include "code_80005FD0.h"
#include "external.h"
}
size_t OChainChomp::_count = 0;
OChainChomp::OChainChomp() {
_idx = _count;
init_object(indexObjectList2[_count], 0);
_count++;
}
void OChainChomp::Tick() {
s32 objectIndex;
Object* object;
objectIndex = indexObjectList2[_idx];
object = &gObjectList[objectIndex];
if (object->state != 0) {
OChainChomp::func_800859C8(objectIndex, _idx);
vec3f_copy(object->unk_01C, object->offset);
// This should be spawn pos or follow path
func_8000D940(object->offset, &object->unk_084[8], object->unk_034, object->surfaceHeight, 0);
object->direction_angle[1] = get_angle_between_two_vectors(object->unk_01C, object->offset);
object_calculate_new_pos_offset(objectIndex);
func_80089CBC(objectIndex, 30.0f);
}
}
void OChainChomp::Draw(s32 cameraId) {
s32 objectIndex;
objectIndex = indexObjectList2[_idx];
func_8008A1D0(objectIndex, cameraId, 0x000005DC, 0x000009C4);
if (is_obj_flag_status_active(objectIndex, VISIBLE) != 0) {
func_80055AB8(objectIndex, cameraId);
}
}
void OChainChomp::func_80055AB8(s32 objectIndex, s32 cameraId) {
Camera* camera;
camera = &camera1[cameraId];
if (gObjectList[objectIndex].state >= 2) {
if (is_obj_flag_status_active(objectIndex, 0x00100000) != 0) {
D_80183E40[0] = gObjectList[objectIndex].pos[0];
D_80183E40[1] = gObjectList[objectIndex].pos[1] + 16.0;
D_80183E40[2] = gObjectList[objectIndex].pos[2];
D_80183E80[0] = 0;
D_80183E80[1] =
func_800418AC(gObjectList[objectIndex].pos[0], gObjectList[objectIndex].pos[2], camera->pos);
D_80183E80[2] = 0x8000;
func_800468E0(D_80183E40, D_80183E80, 0.54f, (u8*)d_course_rainbow_road_sphere, (Vtx*)D_0D0062B0, 0x00000020,
0x00000040, 0x00000020, 0x00000040, 5);
} else {
rsp_set_matrix_transformation(gObjectList[objectIndex].pos, gObjectList[objectIndex].direction_angle,
gObjectList[objectIndex].sizeScaling);
gSPDisplayList(gDisplayListHead++, (Gfx*)D_0D0077D0);
render_animated_model((Armature*) gObjectList[objectIndex].model,
(Animation**) gObjectList[objectIndex].vertex, 0,
(s16) gObjectList[objectIndex].textureListIndex);
}
}
}
void OChainChomp::func_80085878(s32 objectIndex, s32 arg1) {
TrackWaypoint* temp_v0;
Object* object;
object = &gObjectList[objectIndex];
object->unk_0D8 = 1;
object->model = (Gfx*) d_rainbow_road_unk4;
object->vertex = (Vtx*) d_rainbow_road_unk3;
object->sizeScaling = 0.03f;
object->boundingBoxSize = 0x000A;
set_object_flag(objectIndex, 0x04000200);
object->unk_084[8] = (arg1 * 0x12C) + 0x1F4;
set_obj_origin_pos(objectIndex, 0.0f, -15.0f, 0.0f);
temp_v0 = &D_80164490[(u16) object->unk_084[8]];
set_obj_origin_offset(objectIndex, temp_v0->posX, temp_v0->posY, temp_v0->posZ);
set_obj_direction_angle(objectIndex, 0U, 0U, 0U);
object->unk_034 = 4.0f;
object->type = get_animation_length(d_rainbow_road_unk3, 0);
object_next_state(objectIndex);
}
void OChainChomp::func_800859C8(s32 objectIndex, s32 arg1) {
Object* object;
object = &gObjectList[objectIndex];
switch (object->state) { /* irregular */
case 0:
break;
case 1:
OChainChomp::func_80085878(objectIndex, arg1);
break;
case 2:
func_80072E54(objectIndex, 0, (s32) object->type, 1, 0, -1);
break;
}
if (D_8018D40C == 0) {
func_800C98B8(object->pos, object->velocity, SOUND_ARG_LOAD(0x19, 0x01, 0x80, 0x57));
}
func_80074344(objectIndex, &object->surfaceHeight, -0.8f, 0.8f, 0.03f, 0, -1);
}
|