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
165// have all the properties of the tree
166void func_80299864(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, gCameraZoom[camera - camera1], 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 course other than Moo Moo farm
197 // 0x0600FC70
198
200 // Previous incorrectly set to:
201 // d_course_moo_moo_farm_mole_tlut
202 // Unless both courses use this actor and use the same addr for the texture.
203 // Just in-case changed the code into a switch to prevent future crashes.
204 // This comment can be removed when this is confirmed to work.
205 if (IsLuigiRaceway()) {
206 gSPDisplayList(gDisplayListHead++, d_course_luigi_raceway_dl_FC70);
207 }
208 }
209}
210
218void render_actor_tree_bowser_castle(Camera* camera, Mat4 arg1, struct Actor* arg2) {
219 f32 temp_f0;
220 s16 temp_v0 = arg2->flags;
221
222 if ((temp_v0 & 0x800) != 0) {
223 return;
224 }
225
226 temp_f0 =
227 is_within_render_distance(camera->pos, arg2->pos, camera->rot[1], 0, gCameraZoom[camera - camera1], 4000000.0f);
228
229 if (CVarGetInteger("gNoCulling", 0) == 1) {
230 temp_f0 = MAX(temp_f0, 0.0f);
231 }
232
233 if (temp_f0 < 0.0f) {
234 return;
235 }
236
237 if (((temp_v0 & 0x400) == 0) && (temp_f0 < 250000.0f)) {
238 func_8029794C(arg2->pos, arg2->rot, 2.79999995f);
239 }
240 arg1[3][0] = arg2->pos[0];
241 arg1[3][1] = arg2->pos[1];
242 arg1[3][2] = arg2->pos[2];
243
244 if (render_set_position(arg1, 0) != 0) {
245 gDPLoadTLUT_pal256(gDisplayListHead++, common_tlut_trees_import);
246 gSPDisplayList(gDisplayListHead++, d_course_royal_raceway_dl_castle_tree);
247 }
248}
249
257void render_actor_bush_bowser_castle(Camera* camera, Mat4 arg1, struct Actor* arg2) {
258 f32 temp_f0;
259 s16 temp_v0 = arg2->flags;
260
261 if ((temp_v0 & 0x800) != 0) {
262 return;
263 }
264
265 temp_f0 =
266 is_within_render_distance(camera->pos, arg2->pos, camera->rot[1], 0, gCameraZoom[camera - camera1], 640000.0f);
267
268 if (CVarGetInteger("gNoCulling", 0) == 1) {
269 temp_f0 = MAX(temp_f0, 0.0f);
270 }
271
272 if (temp_f0 < 0.0f) {
273 return;
274 }
275
276 if (((temp_v0 & 0x400) == 0) && (temp_f0 < 250000.0f)) {
277 func_8029794C(arg2->pos, arg2->rot, 2.79999995f);
278 }
279 arg1[3][0] = arg2->pos[0];
280 arg1[3][1] = arg2->pos[1];
281 arg1[3][2] = arg2->pos[2];
282
283 if (render_set_position(arg1, 0) != 0) {
284 gDPLoadTLUT_pal256(gDisplayListHead++, common_tlut_trees_import);
285 gSPDisplayList(gDisplayListHead++, d_course_bowsers_castle_dl_bush);
286 }
287}
288
296void render_actor_tree_frappe_snowland(Camera* camera, Mat4 arg1, struct Actor* arg2) {
297 f32 temp_f0;
298 s16 temp_v0 = arg2->flags;
299
300 if ((temp_v0 & 0x800) != 0) {
301 return;
302 }
303
304 temp_f0 =
305 is_within_render_distance(camera->pos, arg2->pos, camera->rot[1], 0, gCameraZoom[camera - camera1], 4000000.0f);
306
307 if (CVarGetInteger("gNoCulling", 0) == 1) {
308 temp_f0 = MAX(temp_f0, 0.0f);
309 }
310
311 if (temp_f0 < 0.0f) {
312 return;
313 }
314
315 if (((temp_v0 & 0x400) == 0) && (temp_f0 < 250000.0f)) {
316 func_8029794C(arg2->pos, arg2->rot, 2.79999995f);
317 }
318 arg1[3][0] = arg2->pos[0];
319 arg1[3][1] = arg2->pos[1];
320 arg1[3][2] = arg2->pos[2];
321
322 if (render_set_position(arg1, 0) != 0) {
323 gSPDisplayList(gDisplayListHead++, d_course_frappe_snowland_dl_tree);
324 }
325}
326
335 f32 temp_f0;
336 s16 temp_v0 = arg2->flags;
337
338 if ((temp_v0 & 0x800) != 0) {
339 return;
340 }
341
342 temp_f0 =
343 is_within_render_distance(camera->pos, arg2->pos, camera->rot[1], 0, gCameraZoom[camera - camera1], 4000000.0f);
344
345 if (CVarGetInteger("gNoCulling", 0) == 1) {
346 temp_f0 = MAX(temp_f0, 0.0f);
347 }
348
349 if (temp_f0 < 0.0f) {
350 return;
351 }
352
353 if (((temp_v0 & 0x400) == 0) && (temp_f0 < 40000.0f)) {
354 func_8029794C(arg2->pos, arg2->rot, 1.0f);
355 }
356 arg1[3][0] = arg2->pos[0];
357 arg1[3][1] = arg2->pos[1];
358 arg1[3][2] = arg2->pos[2];
359
360 if (render_set_position(arg1, 0) != 0) {
361 gSPDisplayList(gDisplayListHead++, d_course_kalimari_desert_dl_cactus1);
362 }
363}
364
373 f32 temp_f0;
374 s16 temp_v0 = arg2->flags;
375
376 if ((temp_v0 & 0x800) != 0) {
377 return;
378 }
379
380 temp_f0 =
381 is_within_render_distance(camera->pos, arg2->pos, camera->rot[1], 0, gCameraZoom[camera - camera1], 4000000.0f);
382
383 if (CVarGetInteger("gNoCulling", 0) == 1) {
384 temp_f0 = MAX(temp_f0, 0.0f);
385 }
386
387 if (temp_f0 < 0.0f) {
388 return;
389 }
390
391 if (((temp_v0 & 0x400) == 0) && (temp_f0 < 40000.0f)) {
392 func_8029794C(arg2->pos, arg2->rot, 1.0f);
393 }
394 arg1[3][0] = arg2->pos[0];
395 arg1[3][1] = arg2->pos[1];
396 arg1[3][2] = arg2->pos[2];
397
398 if (render_set_position(arg1, 0) != 0) {
399 gSPDisplayList(gDisplayListHead++, d_course_kalimari_desert_dl_cactus2);
400 }
401}
402
411 f32 temp_f0;
412 s16 temp_v0 = arg2->flags;
413
414 if ((temp_v0 & 0x800) != 0) {
415 return;
416 }
417
418 temp_f0 =
419 is_within_render_distance(camera->pos, arg2->pos, camera->rot[1], 0, gCameraZoom[camera - camera1], 4000000.0f);
420
421 if (CVarGetInteger("gNoCulling", 0) == 1) {
422 temp_f0 = MAX(temp_f0, 0.0f);
423 }
424
425 if (temp_f0 < 0.0f) {
426 return;
427 }
428
429 if (((temp_v0 & 0x400) == 0) && (temp_f0 < 40000.0f)) {
430 func_8029794C(arg2->pos, arg2->rot, 0.80000001f);
431 }
432 arg1[3][0] = arg2->pos[0];
433 arg1[3][1] = arg2->pos[1];
434 arg1[3][2] = arg2->pos[2];
435
436 if (render_set_position(arg1, 0) != 0) {
437 gSPDisplayList(gDisplayListHead++, d_course_kalimari_desert_dl_cactus3);
438 }
439}
void gSPDisplayList(Gfx *pkt, Gfx *dl)
Definition GBIMiddleware.cpp:11
bool IsLuigiRaceway()
Definition Game.cpp:721
void func_8029794C(Vec3f pos, Vec3s rot, f32 scale)
Definition actors.c:460
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 func_80299864(Camera *camera, Mat4 arg1, struct Actor *arg2)
Definition render.inc.c:166
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:372
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_cactus1_kalimari_desert(Camera *camera, Mat4 arg1, struct Actor *arg2)
Renders the a first variant of cactus in Kalimari Desert.
Definition render.inc.c:334
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:410
void render_actor_tree_bowser_castle(Camera *camera, Mat4 arg1, struct Actor *arg2)
Renders the tree actor in Bowser's Castle.
Definition render.inc.c:218
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:296
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:257
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