Mario Kart 64
Loading...
Searching...
No Matches
render.inc.c
Go to the documentation of this file.
1#include <actors.h>
2#include <code_800029B0.h>
3#include <PR/gbi.h>
4#include <main.h>
5
12void render_actor_fake_item_box(Camera* camera, struct FakeItemBox* fakeItemBox) {
13 Vec3s someRot;
14 UNUSED s32 pad[3];
15 Vec3f someVec;
16 Mat4 someMatrix2;
17 Mat4 someMatrix3;
18 UNUSED s32 pad2[12];
19 f32 temp_f0_2;
20 f32 temp_f0_3;
21 f32 temp_f12;
22 f32 temp_f2;
23 f32 thing;
24 f32 temp_f2_2;
25 f32 someMultiplier;
26
27 if (is_within_render_distance(camera->pos, fakeItemBox->pos, camera->rot[1], 2500.0f, gCameraZoom[camera - camera1],
28 1000000.0f) < 0) {
29 actor_not_rendered(camera, (struct Actor*) fakeItemBox);
30 return;
31 }
32 if (((f32) gCourseMaxY + 800.0f) < fakeItemBox->pos[1]) {
33 actor_not_rendered(camera, (struct Actor*) fakeItemBox);
34 return;
35 }
36 if (fakeItemBox->pos[1] < ((f32) gCourseMinY - 800.0f)) {
37 actor_not_rendered(camera, (struct Actor*) fakeItemBox);
38 return;
39 }
40
41 actor_rendered(camera, (struct Actor*) fakeItemBox);
42 someRot[0] = 0;
43 someRot[1] = fakeItemBox->rot[1];
44 someRot[2] = 0;
45 mtxf_pos_rotation_xyz(someMatrix2, fakeItemBox->pos, someRot);
46 mtxf_scale(someMatrix2, fakeItemBox->sizeScaling);
47 if (fakeItemBox->state != 2) {
48
49 if (!render_set_position(someMatrix2, 0)) {
50 return;
51 }
52
54 mtxf_pos_rotation_xyz(someMatrix2, fakeItemBox->pos, fakeItemBox->rot);
55 mtxf_scale(someMatrix2, fakeItemBox->sizeScaling);
56
57 if (!render_set_position(someMatrix2, 0)) {
58 return;
59 }
60
61 gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
63 if ((fakeItemBox->rot[1] < 0xAA1) && (fakeItemBox->rot[1] > 0)) {
65 } else if ((fakeItemBox->rot[1] >= 0x6AA5) && (fakeItemBox->rot[1] < 0x754E)) {
67 } else if ((fakeItemBox->rot[1] >= 0x38E1) && (fakeItemBox->rot[1] < 0x438A)) {
69 } else if ((fakeItemBox->rot[1] >= 0xC711) && (fakeItemBox->rot[1] < 0xD1BA)) {
71 } else {
72 gDPSetBlendMask(gDisplayListHead++, 0xFF);
74 }
75 gSPDisplayList(gDisplayListHead++, D_0D003090);
76 } else {
77 gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
78 gSPClearGeometryMode(gDisplayListHead++, G_CULL_BACK);
79 gDPSetBlendMask(gDisplayListHead++, 0xFF);
80 thing = fakeItemBox->someTimer;
81 mtxf_pos_rotation_xyz(someMatrix2, fakeItemBox->pos, fakeItemBox->rot);
82 if (thing < 10.0f) {
83 someMultiplier = 1.0f;
84 } else {
85 someMultiplier = 1.0f - ((thing - 10.0f) * 0.1f);
86 }
87 mtxf_scale(someMatrix2, someMultiplier);
88 if (fakeItemBox->someTimer & 1) {
90 } else {
92 }
93 temp_f2 = 2.0f * thing;
94 someVec[0] = 0.0f;
95 someVec[1] = temp_f2;
96 someVec[2] = thing;
97 add_translate_mat4_vec3f(someMatrix2, someMatrix3, someVec);
98
99 if (!render_set_position(someMatrix3, 0)) {
100 return;
101 }
102
103 gSPDisplayList(gDisplayListHead++, D_0D003158);
104 temp_f2_2 = 0.8f * thing;
105 temp_f12 = 0.5f * thing;
106 someVec[0] = temp_f2_2;
107 someVec[1] = 2.3f * thing;
108 someVec[2] = temp_f12;
109 add_translate_mat4_vec3f(someMatrix2, someMatrix3, someVec);
110
111 if (!render_set_position(someMatrix3, 0)) {
112 return;
113 }
114
115 gSPDisplayList(gDisplayListHead++, D_0D0031B8);
116 temp_f0_2 = -0.5f * thing;
117 someVec[0] = temp_f2_2;
118 someVec[1] = 1.2f * thing;
119 someVec[2] = temp_f0_2;
120 add_translate_mat4_vec3f(someMatrix2, someMatrix3, someVec);
121
122 if (!render_set_position(someMatrix3, 0)) {
123 return;
124 }
125
126 gSPDisplayList(gDisplayListHead++, D_0D003128);
127 if (!(fakeItemBox->someTimer & 1)) {
129 } else {
131 }
132 someVec[0] = 0.0f;
133 someVec[1] = 1.8f * thing;
134 someVec[2] = -1.0f * thing;
135 add_translate_mat4_vec3f(someMatrix2, someMatrix3, someVec);
136
137 if (!render_set_position(someMatrix3, 0)) {
138 return;
139 }
140
141 gSPDisplayList(gDisplayListHead++, D_0D0031E8);
142 temp_f0_3 = -0.8f * thing;
143 someVec[0] = temp_f0_3;
144 someVec[1] = 0.6f * thing;
145 someVec[2] = temp_f0_2;
146 add_translate_mat4_vec3f(someMatrix2, someMatrix3, someVec);
147
148 if (!render_set_position(someMatrix3, 0)) {
149 return;
150 }
151
152 gSPDisplayList(gDisplayListHead++, D_0D003188);
153 someVec[0] = temp_f0_3;
154 someVec[1] = temp_f2;
155 someVec[2] = temp_f12;
156 add_translate_mat4_vec3f(someMatrix2, someMatrix3, someVec);
157
158 if (!render_set_position(someMatrix3, 0)) {
159 return;
160 }
161
162 gSPDisplayList(gDisplayListHead++, D_0D0030F8);
163 gSPSetGeometryMode(gDisplayListHead++, G_CULL_BACK);
164 }
165}
void actor_not_rendered(Camera *arg0, struct Actor *arg1)
Definition actors.c:283
void actor_rendered(Camera *arg0, struct Actor *arg1)
Definition actors.c:300
Camera * camera1
Definition camera.c:23
s16 gCourseMaxY
Definition code_800029B0.c:89
s16 gCourseMinY
Definition code_800029B0.c:90
Gfx D_0D003090[]
Gfx D_0D003188[]
Gfx D_0D0031E8[]
Gfx D_0D003128[]
Gfx D_0D003158[]
Gfx D_0D0031B8[]
Gfx D_0D0030F8[]
Gfx common_model_fake_itembox[]
f32 Vec3f[3]
Definition common_structs.h:6
s16 Vec3s[3]
Definition common_structs.h:11
f32 Mat4[4][4]
Definition common_structs.h:16
void render_actor_fake_item_box(Camera *camera, struct FakeItemBox *fakeItemBox)
Renders the fake item box actor.
Definition render.inc.c:12
#define G_CULL_BACK
Definition gbi.h:351
#define G_RM_NOOP2
Definition gbi.h:968
#define G_RM_ZB_CLD_SURF2
Definition gbi.h:949
#define G_RM_ZB_CLD_SURF
Definition gbi.h:948
#define G_RM_AA_ZB_OPA_SURF
Definition gbi.h:878
#define G_RM_AA_ZB_OPA_SURF2
Definition gbi.h:879
#define G_RM_AA_ZB_XLU_INTER
Definition gbi.h:888
#define G_LIGHTING
Definition gbi.h:355
#define G_CC_MODULATEIA
Definition gbi.h:488
#define UNUSED
Definition macros.h:23
Gfx * gDisplayListHead
Definition main.c:132
f32 gCameraZoom[4]
Definition main.c:122
f32 is_within_render_distance(Vec3f cameraPos, Vec3f objectPos, u16 orientationY, f32 minDistance, f32 fov, f32 maxDistance)
Definition math_util.c:1114
void mtxf_pos_rotation_xyz(Mat4 out, Vec3f pos, Vec3s orientation)
Definition math_util.c:468
s32 render_set_position(Mat4 arg0, s32 arg1)
Definition math_util.c:47
void add_translate_mat4_vec3f(Mat4 mat, Mat4 dest, Vec3f pos)
Definition math_util.c:181
void mtxf_scale(Mat4 mat, f32 coef)
Definition math_util.c:455
Definition actor_types.h:120
Definition camera.h:26
Vec3s rot
Definition camera.h:33
Vec3f pos
Definition camera.h:27
Definition actor_types.h:349
Vec3s rot
Definition actor_types.h:356
s16 someTimer
Definition actor_types.h:352
f32 sizeScaling
Definition actor_types.h:354
s16 state
Definition actor_types.h:353
Vec3f pos
Definition actor_types.h:358
signed int s32
Definition ultratypes.h:15
float f32
Definition ultratypes.h:34