SpaghettiKart
Loading...
Searching...
No Matches
render.inc.c
Go to the documentation of this file.
1#include <actors.h>
2#include <main.h>
5
13void render_actor_falling_rock(Camera* camera, struct FallingRock* rock) {
14 Vec3s sp98;
15 Vec3f sp8C;
16 Mat4 mtx;
17 f32 height;
18 UNUSED s32 pad[4];
19
20 return; // No longer used. Use the C++ actor!
21
22 if (rock->respawnTimer != 0) {
23 return;
24 }
25
26 height = is_within_render_distance(camera->pos, rock->pos, camera->rot[1], 400.0f, camera->fieldOfView,
27 4000000.0f);
28
29 if (CVarGetInteger("gNoCulling", 0) == 1) {
30 height = CLAMP(height, 0.0f, 250000.0f);
31 }
32
33 if (height < 0.0f) {
34 return;
35 }
36
37 if (height < 250000.0f) {
38
39 if (rock->unk30.unk34 == 1) {
40 sp8C[0] = rock->pos[0];
41 sp8C[2] = rock->pos[2];
42 height = calculate_surface_height(sp8C[0], rock->pos[1], sp8C[2], rock->unk30.meshIndexZX);
43 sp98[0] = 0;
44 sp98[1] = 0;
45 sp98[2] = 0;
46 sp8C[1] = height + 2.0f;
47
48 FrameInterpolation_RecordOpenChild("rock_shadow", (uintptr_t) rock);
49 mtxf_pos_rotation_xyz(mtx, sp8C, sp98);
50 if (render_set_position(mtx, 0) == 0) {
52 return;
53 }
54 gSPDisplayList(gDisplayListHead++, d_course_choco_mountain_dl_6F88);
56 }
57 }
58
59 // @port: Tag the transform.
60 FrameInterpolation_RecordOpenChild("rock", (uintptr_t) rock);
61
62 mtxf_pos_rotation_xyz(mtx, rock->pos, rock->rot);
63 if (render_set_position(mtx, 0) == 0) {
64 // @port Pop the transform id.
66 return;
67 }
68 gSPDisplayList(gDisplayListHead++, d_course_choco_mountain_dl_falling_rock);
69
70 // @port Pop the transform id.
72}
void FrameInterpolation_RecordOpenChild(const void *a, uintptr_t b)
Definition FrameInterpolation.cpp:640
void FrameInterpolation_RecordCloseChild(void)
Definition FrameInterpolation.cpp:650
void gSPDisplayList(Gfx *pkt, Gfx *dl)
Definition GBIMiddleware.cpp:12
f32 calculate_surface_height(f32 x, f32 y, f32 z, u16 index)
Definition collision.c:466
f32 Vec3f[3]
Definition common_structs.h:10
s16 Vec3s[3]
Definition common_structs.h:15
f32 Mat4[4][4]
Definition common_structs.h:20
void render_actor_falling_rock(Camera *camera, struct FallingRock *rock)
Renders the falling rock actor. Actor used in Choco Mountain.
Definition render.inc.c:13
#define CLAMP(var, min, max)
Definition macros.h:152
#define UNUSED
Definition macros.h:40
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
void mtxf_pos_rotation_xyz(Mat4 out, Vec3f pos, Vec3s orientation)
Definition math_util.c:449
Definition camera.h:35
Vec3s rot
Definition camera.h:42
f32 fieldOfView
Definition camera.h:43
Vec3f pos
Definition camera.h:36
u16 unk34
Definition common_structs.h:150
u16 meshIndexZX
Definition common_structs.h:154
Definition actor_types.h:181
Collision unk30
Definition actor_types.h:192
s16 respawnTimer
Definition actor_types.h:184
Vec3s rot
Definition actor_types.h:188
Vec3f pos
Definition actor_types.h:190