Mario Kart 64
Loading...
Searching...
No Matches
render.inc.c
Go to the documentation of this file.
1#include <actors.h>
2#include <libultra/gbi.h>
3#include <main.h>
8
16void render_actor_tree_mario_raceway(Camera* camera, Mat4 arg1, struct Actor* arg2) {
17 f32 temp_f0;
18 s16 temp_v0 = arg2->flags;
19
20 if ((temp_v0 & 0x800) != 0) {
21 return;
22 }
23
24 temp_f0 = is_within_render_distance(camera->pos, arg2->pos, camera->rot[1], 0, gCameraZoom[camera - camera1],
25 16000000.0f);
26
27 if (CVarGetInteger("gNoCulling", 0) == 1) {
28 temp_f0 = MAX(temp_f0, 0.0f);
29 }
30
31 if (temp_f0 < 0.0f) {
32 return;
33 }
34
35 if (((temp_v0 & 0x400) == 0) && (temp_f0 < 250000.0f)) {
36 func_8029794C(arg2->pos, arg2->rot, 3.0f);
37 }
38 arg1[3][0] = arg2->pos[0];
39 arg1[3][1] = arg2->pos[1];
40 arg1[3][2] = arg2->pos[2];
41
42 if (render_set_position(arg1, 0) != 0) {
43 gDPLoadTLUT_pal256(gDisplayListHead++, common_tlut_trees_import);
44 gSPDisplayList(gDisplayListHead++, d_course_mario_raceway_dl_tree);
45 }
46}
47
55void render_actor_tree_yoshi_valley(Camera* camera, Mat4 arg1, struct Actor* arg2) {
56 f32 temp_f0;
57 s16 temp_v0 = arg2->flags;
58
59 if ((temp_v0 & 0x800) != 0) {
60 return;
61 }
62
63 temp_f0 =
64 is_within_render_distance(camera->pos, arg2->pos, camera->rot[1], 0, gCameraZoom[camera - camera1], 4000000.0f);
65
66 if (CVarGetInteger("gNoCulling", 0) == 1) {
67 temp_f0 = MAX(temp_f0, 0.0f);
68 }
69
70 if (temp_f0 < 0.0f) {
71 return;
72 }
73
74 if (((temp_v0 & 0x400) == 0) && (temp_f0 < 250000.0f)) {
75 func_8029794C(arg2->pos, arg2->rot, 2.79999995f);
76 }
77 arg1[3][0] = arg2->pos[0];
78 arg1[3][1] = arg2->pos[1];
79 arg1[3][2] = arg2->pos[2];
80
81 if (render_set_position(arg1, 0) != 0) {
82 gDPLoadTLUT_pal256(gDisplayListHead++, common_tlut_trees_import);
83 gSPDisplayList(gDisplayListHead++, d_course_yoshi_valley_dl_tree);
84 }
85}
86
94void render_actor_tree_royal_raceway(Camera* camera, Mat4 arg1, struct Actor* arg2) {
95 f32 temp_f0;
96 s16 temp_v0 = arg2->flags;
97
98 if ((temp_v0 & 0x800) != 0) {
99 return;
100 }
101
102 temp_f0 =
103 is_within_render_distance(camera->pos, arg2->pos, camera->rot[1], 0, gCameraZoom[camera - camera1], 4000000.0f);
104
105 if (CVarGetInteger("gNoCulling", 0) == 1) {
106 temp_f0 = MAX(temp_f0, 0.0f);
107 }
108
109 if (temp_f0 < 0.0f) {
110 return;
111 }
112
113 if (((temp_v0 & 0x400) == 0) && (temp_f0 < 250000.0f)) {
114 func_8029794C(arg2->pos, arg2->rot, 2.79999995f);
115 }
116 arg1[3][0] = arg2->pos[0];
117 arg1[3][1] = arg2->pos[1];
118 arg1[3][2] = arg2->pos[2];
119
120 if (render_set_position(arg1, 0) != 0) {
121 gDPLoadTLUT_pal256(gDisplayListHead++, common_tlut_trees_import);
122 gSPDisplayList(gDisplayListHead++, d_course_royal_raceway_dl_tree);
123 }
124}
125
133void render_actor_tree_moo_moo_farm(Camera* camera, Mat4 arg1, struct Actor* arg2) {
134 f32 temp_f0;
135 s16 temp_v0 = arg2->flags;
136
137 if ((temp_v0 & 0x800) != 0) {
138 return;
139 }
140
141 temp_f0 =
142 is_within_render_distance(camera->pos, arg2->pos, camera->rot[1], 0, gCameraZoom[camera - camera1], 6250000.0f);
143
144 if (CVarGetInteger("gNoCulling", 0) == 1) {
145 temp_f0 = MAX(temp_f0, 0.0f);
146 }
147
148 if (temp_f0 < 0.0f) {
149 return;
150 }
151
152 if (((temp_v0 & 0x400) == 0) && (temp_f0 < 600.0f)) {
153 func_8029794C(arg2->pos, arg2->rot, 5.0f);
154 }
155 arg1[3][0] = arg2->pos[0];
156 arg1[3][1] = arg2->pos[1];
157 arg1[3][2] = arg2->pos[2];
158
159 if (render_set_position(arg1, 0) != 0) {
160 gDPLoadTLUT_pal256(gDisplayListHead++, common_tlut_trees_import);
161 gSPDisplayList(gDisplayListHead++, d_course_moo_moo_farm_dl_tree);
162 }
163}
164
165void render_actor_tree_luigi_raceway(Camera* camera, Mat4 arg1, struct Actor* arg2) {
166 f32 temp_f0;
167 s16 temp_v0 = arg2->flags;
168
169 if ((temp_v0 & 0x800) != 0) {
170 return;
171 }
172
173 temp_f0 =
174 is_within_render_distance(camera->pos, arg2->pos, camera->rot[1], 0, gCameraZoom[camera - camera1], 4000000.0f);
175
176 if (CVarGetInteger("gNoCulling", 0) == 1) {
177 temp_f0 = MAX(temp_f0, 0.0f);
178 }
179
180 if (temp_f0 < 0.0f) {
181 return;
182 }
183
184 if (((temp_v0 & 0x400) == 0) && (temp_f0 < 250000.0f)) {
185 func_8029794C(arg2->pos, arg2->rot, 2.79999995f);
186 }
187 arg1[3][0] = arg2->pos[0];
188 arg1[3][1] = arg2->pos[1];
189 arg1[3][2] = arg2->pos[2];
190
191 if (render_set_position(arg1, 0) != 0) {
192 gDPLoadTLUT_pal256(gDisplayListHead++, common_tlut_trees_import);
193 // Why is a TLUT being used a DL here? That makes no sense
194 // Based on the TLUT being loaded above, this ought to be be another
195 // tree related DL, presumably one found in a course other than Moo Moo farm
196 // 0x0600FC70
197 gSPDisplayList(gDisplayListHead++, d_course_luigi_raceway_dl_FC70);
198 }
199}
200
208void render_actor_tree_peach_castle(Camera* camera, Mat4 arg1, struct Actor* arg2) {
209 f32 temp_f0;
210 s16 temp_v0 = arg2->flags;
211
212 if ((temp_v0 & 0x800) != 0) {
213 return;
214 }
215
216 temp_f0 =
217 is_within_render_distance(camera->pos, arg2->pos, camera->rot[1], 0, gCameraZoom[camera - camera1], 4000000.0f);
218
219 if (CVarGetInteger("gNoCulling", 0) == 1) {
220 temp_f0 = MAX(temp_f0, 0.0f);
221 }
222
223 if (temp_f0 < 0.0f) {
224 return;
225 }
226
227 if (((temp_v0 & 0x400) == 0) && (temp_f0 < 250000.0f)) {
228 func_8029794C(arg2->pos, arg2->rot, 2.79999995f);
229 }
230 arg1[3][0] = arg2->pos[0];
231 arg1[3][1] = arg2->pos[1];
232 arg1[3][2] = arg2->pos[2];
233
234 if (render_set_position(arg1, 0) != 0) {
235 gDPLoadTLUT_pal256(gDisplayListHead++, common_tlut_trees_import);
236 gSPDisplayList(gDisplayListHead++, d_course_royal_raceway_dl_castle_tree);
237 }
238}
239
247void render_actor_bush_bowser_castle(Camera* camera, Mat4 arg1, struct Actor* arg2) {
248 f32 temp_f0;
249 s16 temp_v0 = arg2->flags;
250
251 if ((temp_v0 & 0x800) != 0) {
252 return;
253 }
254
255 temp_f0 =
256 is_within_render_distance(camera->pos, arg2->pos, camera->rot[1], 0, gCameraZoom[camera - camera1], 640000.0f);
257
258 if (CVarGetInteger("gNoCulling", 0) == 1) {
259 temp_f0 = MAX(temp_f0, 0.0f);
260 }
261
262 if (temp_f0 < 0.0f) {
263 return;
264 }
265
266 if (((temp_v0 & 0x400) == 0) && (temp_f0 < 250000.0f)) {
267 func_8029794C(arg2->pos, arg2->rot, 2.79999995f);
268 }
269 arg1[3][0] = arg2->pos[0];
270 arg1[3][1] = arg2->pos[1];
271 arg1[3][2] = arg2->pos[2];
272
273 if (render_set_position(arg1, 0) != 0) {
274 gDPLoadTLUT_pal256(gDisplayListHead++, common_tlut_trees_import);
275 gSPDisplayList(gDisplayListHead++, d_course_bowsers_castle_dl_bush);
276 }
277}
278
286void render_actor_tree_frappe_snowland(Camera* camera, Mat4 arg1, struct Actor* arg2) {
287 f32 temp_f0;
288 s16 temp_v0 = arg2->flags;
289
290 if ((temp_v0 & 0x800) != 0) {
291 return;
292 }
293
294 temp_f0 =
295 is_within_render_distance(camera->pos, arg2->pos, camera->rot[1], 0, gCameraZoom[camera - camera1], 4000000.0f);
296
297 if (CVarGetInteger("gNoCulling", 0) == 1) {
298 temp_f0 = MAX(temp_f0, 0.0f);
299 }
300
301 if (temp_f0 < 0.0f) {
302 return;
303 }
304
305 if (((temp_v0 & 0x400) == 0) && (temp_f0 < 250000.0f)) {
306 func_8029794C(arg2->pos, arg2->rot, 2.79999995f);
307 }
308 arg1[3][0] = arg2->pos[0];
309 arg1[3][1] = arg2->pos[1];
310 arg1[3][2] = arg2->pos[2];
311
312 if (render_set_position(arg1, 0) != 0) {
313 gSPDisplayList(gDisplayListHead++, d_course_frappe_snowland_dl_tree);
314 }
315}
316
325 f32 temp_f0;
326 s16 temp_v0 = arg2->flags;
327
328 if ((temp_v0 & 0x800) != 0) {
329 return;
330 }
331
332 temp_f0 =
333 is_within_render_distance(camera->pos, arg2->pos, camera->rot[1], 0, gCameraZoom[camera - camera1], 4000000.0f);
334
335 if (CVarGetInteger("gNoCulling", 0) == 1) {
336 temp_f0 = MAX(temp_f0, 0.0f);
337 }
338
339 if (temp_f0 < 0.0f) {
340 return;
341 }
342
343 if (((temp_v0 & 0x400) == 0) && (temp_f0 < 40000.0f)) {
344 func_8029794C(arg2->pos, arg2->rot, 1.0f);
345 }
346 arg1[3][0] = arg2->pos[0];
347 arg1[3][1] = arg2->pos[1];
348 arg1[3][2] = arg2->pos[2];
349
350 if (render_set_position(arg1, 0) != 0) {
351 gSPDisplayList(gDisplayListHead++, d_course_kalimari_desert_dl_cactus1);
352 }
353}
354
363 f32 temp_f0;
364 s16 temp_v0 = arg2->flags;
365
366 if ((temp_v0 & 0x800) != 0) {
367 return;
368 }
369
370 temp_f0 =
371 is_within_render_distance(camera->pos, arg2->pos, camera->rot[1], 0, gCameraZoom[camera - camera1], 4000000.0f);
372
373 if (CVarGetInteger("gNoCulling", 0) == 1) {
374 temp_f0 = MAX(temp_f0, 0.0f);
375 }
376
377 if (temp_f0 < 0.0f) {
378 return;
379 }
380
381 if (((temp_v0 & 0x400) == 0) && (temp_f0 < 40000.0f)) {
382 func_8029794C(arg2->pos, arg2->rot, 1.0f);
383 }
384 arg1[3][0] = arg2->pos[0];
385 arg1[3][1] = arg2->pos[1];
386 arg1[3][2] = arg2->pos[2];
387
388 if (render_set_position(arg1, 0) != 0) {
389 gSPDisplayList(gDisplayListHead++, d_course_kalimari_desert_dl_cactus2);
390 }
391}
392
401 f32 temp_f0;
402 s16 temp_v0 = arg2->flags;
403
404 if ((temp_v0 & 0x800) != 0) {
405 return;
406 }
407
408 temp_f0 =
409 is_within_render_distance(camera->pos, arg2->pos, camera->rot[1], 0, gCameraZoom[camera - camera1], 4000000.0f);
410
411 if (CVarGetInteger("gNoCulling", 0) == 1) {
412 temp_f0 = MAX(temp_f0, 0.0f);
413 }
414
415 if (temp_f0 < 0.0f) {
416 return;
417 }
418
419 if (((temp_v0 & 0x400) == 0) && (temp_f0 < 40000.0f)) {
420 func_8029794C(arg2->pos, arg2->rot, 0.80000001f);
421 }
422 arg1[3][0] = arg2->pos[0];
423 arg1[3][1] = arg2->pos[1];
424 arg1[3][2] = arg2->pos[2];
425
426 if (render_set_position(arg1, 0) != 0) {
427 gSPDisplayList(gDisplayListHead++, d_course_kalimari_desert_dl_cactus3);
428 }
429}
void gSPDisplayList(Gfx *pkt, Gfx *dl)
Definition GBIMiddleware.cpp:11
void func_8029794C(Vec3f pos, Vec3s rot, f32 scale)
Definition actors.c:466
Camera * camera1
Definition camera.c:29
f32 Mat4[4][4]
Definition common_structs.h:20
#define MAX(a, b)
Definition macros.h:130
Gfx * gDisplayListHead
Definition main.c:136
f32 gCameraZoom[4]
Definition main.c:126
s32 render_set_position(Mat4 mtx, s32 arg1)
Definition math_util.c:54
f32 is_within_render_distance(Vec3f cameraPos, Vec3f objectPos, u16 orientationY, f32 minDistance, f32 fov, f32 maxDistance)
Definition math_util.c:1100
Definition actor_types.h:124
Vec3s rot
Definition actor_types.h:131
s16 flags
Definition actor_types.h:126
Vec3f pos
Definition actor_types.h:133
Definition camera.h:27
Vec3s rot
Definition camera.h:34
Vec3f pos
Definition camera.h:28
void render_actor_tree_cactus2_kalimari_desert(Camera *camera, Mat4 arg1, struct Actor *arg2)
Renders the a second variant of cactus in Kalimari Desert.
Definition render.inc.c:362
void render_actor_tree_luigi_raceway(Camera *camera, Mat4 arg1, struct Actor *arg2)
Definition render.inc.c:165
void render_actor_tree_yoshi_valley(Camera *camera, Mat4 arg1, struct Actor *arg2)
Renders the tree actor in Yoshi Valley.
Definition render.inc.c:55
void render_actor_tree_mario_raceway(Camera *camera, Mat4 arg1, struct Actor *arg2)
Renders the tree actor in Mario rawceay.
Definition render.inc.c:16
void render_actor_tree_peach_castle(Camera *camera, Mat4 arg1, struct Actor *arg2)
Renders Peach's Castle trees in Royal Raceway.
Definition render.inc.c:208
void render_actor_tree_cactus1_kalimari_desert(Camera *camera, Mat4 arg1, struct Actor *arg2)
Renders the a first variant of cactus in Kalimari Desert.
Definition render.inc.c:324
void render_actor_tree_cactus3_kalimari_desert(Camera *camera, Mat4 arg1, struct Actor *arg2)
Renders the a third variant of cactus in Kalimari Desert.
Definition render.inc.c:400
void render_actor_tree_moo_moo_farm(Camera *camera, Mat4 arg1, struct Actor *arg2)
Renders the tree actor in Moo Moo Farm.
Definition render.inc.c:133
void render_actor_tree_frappe_snowland(Camera *camera, Mat4 arg1, struct Actor *arg2)
Renders the tree actor in Frappe Snowland.
Definition render.inc.c:286
void render_actor_bush_bowser_castle(Camera *camera, Mat4 arg1, struct Actor *arg2)
Renders the bush actor in Bowser's Castle.
Definition render.inc.c:247
void render_actor_tree_royal_raceway(Camera *camera, Mat4 arg1, struct Actor *arg2)
Renders the tree actor in Royal Raceway.
Definition render.inc.c:94