Mario Kart 64
Loading...
Searching...
No Matches
render.inc.c
Go to the documentation of this file.
1#include <actors.h>
2#include <main.h>
4
12void render_actor_falling_rock(Camera* camera, struct FallingRock* rock) {
13 Vec3s sp98;
14 Vec3f sp8C;
15 Mat4 sp4C;
16 f32 height;
17 UNUSED s32 pad[4];
18
19 if (rock->respawnTimer != 0) {
20 return;
21 }
22
23 height = is_within_render_distance(camera->pos, rock->pos, camera->rot[1], 400.0f, gCameraZoom[camera - camera1],
24 4000000.0f);
25
26 if (height < 0.0f) {
27 return;
28 }
29
30 if (height < 250000.0f) {
31
32 if (rock->unk30.unk34 == 1) {
33 sp8C[0] = rock->pos[0];
34 sp8C[2] = rock->pos[2];
35 height = calculate_surface_height(sp8C[0], rock->pos[1], sp8C[2], rock->unk30.meshIndexZX);
36 sp98[0] = 0;
37 sp98[1] = 0;
38 sp98[2] = 0;
39 sp8C[1] = height + 2.0f;
40 mtxf_pos_rotation_xyz(sp4C, sp8C, sp98);
41 if (render_set_position(sp4C, 0) == 0) {
42 return;
43 }
45 }
46 }
47 mtxf_pos_rotation_xyz(sp4C, rock->pos, rock->rot);
48 if (render_set_position(sp4C, 0) == 0) {
49 return;
50 }
52}
Camera * camera1
Definition camera.c:23
Gfx d_course_choco_mountain_dl_6F88[]
Definition course_data.c:3039
Gfx d_course_choco_mountain_dl_falling_rock[]
Definition course_data.c:3053
f32 calculate_surface_height(f32 x, f32 y, f32 z, u16 index)
Definition collision.c:527
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_falling_rock(Camera *camera, struct FallingRock *rock)
Renders the falling rock actor. Actor used in Choco Mountain.
Definition render.inc.c:12
#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
Definition camera.h:26
Vec3s rot
Definition camera.h:33
Vec3f pos
Definition camera.h:27
u16 unk34
Definition common_structs.h:135
u16 meshIndexZX
Definition common_structs.h:139
Definition actor_types.h:172
Collision unk30
Definition actor_types.h:183
s16 respawnTimer
Definition actor_types.h:175
Vec3s rot
Definition actor_types.h:179
Vec3f pos
Definition actor_types.h:181
signed int s32
Definition ultratypes.h:15
float f32
Definition ultratypes.h:34