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