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>
3#include <PR/gbi.h>
6
15void render_actor_piranha_plant(Camera* arg0, Mat4 arg1, struct PiranhaPlant* arg2) {
16 UNUSED s32 pad;
17 u8* addr;
18 s16 temp_lo = arg0 - camera1;
19 s16 animationFrame; // unconfirmed
20 s16 temp = arg2->flags;
21 f32 temp_f0;
22 s32 maxObjectsReached;
23
24 if (temp & 0x800) {
25 return;
26 }
27
28 temp_f0 = is_within_render_distance(arg0->pos, arg2->pos, arg0->rot[1], 0, gCameraZoom[arg0 - camera1], 1000000.0f);
29
30 if (temp_f0 < 0.0f) {
31
32 switch (temp_lo) {
33 case 0:
34 arg2->visibilityStates[0] = -1;
35 break;
36 case 1:
37 arg2->visibilityStates[1] = -1;
38 break;
39 case 2:
40 arg2->visibilityStates[2] = -1;
41 break;
42 case 3:
43 arg2->visibilityStates[3] = -1;
44 break;
45 }
46 return;
47 }
48 arg1[3][0] = arg2->pos[0];
49 arg1[3][1] = arg2->pos[1];
50 arg1[3][2] = arg2->pos[2];
51 maxObjectsReached = render_set_position(arg1, 0) == 0;
52 if (maxObjectsReached) {
53 return;
54 }
55
56 if (90000.0f < temp_f0) {
57
58 switch (temp_lo) {
59 case 0:
60 arg2->visibilityStates[0] = 0;
61 break;
62 case 1:
63 arg2->visibilityStates[1] = 0;
64 break;
65 case 2:
66 arg2->visibilityStates[2] = 0;
67 break;
68 case 3:
69 arg2->visibilityStates[3] = 0;
70 break;
71 }
72 animationFrame = 0;
73
74 } else {
75 switch (temp_lo) {
76 case 0:
77 arg2->visibilityStates[0] = 1;
78 break;
79 case 1:
80 arg2->visibilityStates[1] = 1;
81 break;
82 case 2:
83 arg2->visibilityStates[2] = 1;
84 break;
85 case 3:
86 arg2->visibilityStates[3] = 1;
87 break;
88 }
89
90 switch (temp_lo) {
91 case 0:
92 animationFrame = arg2->timers[0];
93 break;
94 case 1:
95 animationFrame = arg2->timers[1];
96 break;
97 case 2:
98 animationFrame = arg2->timers[2];
99 break;
100 case 3:
101 animationFrame = arg2->timers[3];
102 break;
103 }
104 }
105 animationFrame /= 6;
106
107 if (animationFrame > 8) {
108 animationFrame = 8;
109 }
110 addr = D_802BA058 + (animationFrame << 0xB);
111 gDPLoadTextureBlock(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(addr), G_IM_FMT_CI, G_IM_SIZ_8b, 32, 64, 0,
112 G_TX_MIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
113 G_TX_NOLOD);
114
117 } else {
119 }
120}
u8 * D_802BA058
Definition actors.c:33
Camera * camera1
Definition camera.c:23
s16 gCurrentCourseId
Definition code_800029B0.c:29
f32 Mat4[4][4]
Definition common_structs.h:16
#define G_IM_SIZ_8b
Definition gbi.h:402
#define G_IM_FMT_CI
Definition gbi.h:394
#define UNUSED
Definition macros.h:23
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:87
Gfx * gDisplayListHead
Definition main.c:132
f32 gCameraZoom[4]
Definition main.c:122
Gfx d_course_mario_raceway_dl_piranha_plant[]
Definition course_data.c:3255
f32 is_within_render_distance(Vec3f cameraPos, Vec3f objectPos, u16 orientationY, f32 minDistance, f32 fov, f32 maxDistance)
Definition math_util.c:1114
s32 render_set_position(Mat4 arg0, s32 arg1)
Definition math_util.c:47
@ COURSE_MARIO_RACEWAY
Definition mk64.h:27
void render_actor_piranha_plant(Camera *arg0, Mat4 arg1, struct PiranhaPlant *arg2)
Renders the piranha plant actor. Actor used in Mario Raceway and Royal Raceway.
Definition render.inc.c:15
Gfx d_course_royal_raceway_dl_piranha_plant[]
Definition course_data.c:5297
Definition camera.h:26
Vec3s rot
Definition camera.h:33
Vec3f pos
Definition camera.h:27
Definition actor_types.h:262
Vec4s visibilityStates
Definition actor_types.h:265
Vec4s timers
Definition actor_types.h:269
s16 flags
Definition actor_types.h:264
Vec3f pos
Definition actor_types.h:268
signed int s32
Definition ultratypes.h:15
signed short int s16
Definition ultratypes.h:13
float f32
Definition ultratypes.h:34
unsigned char u8
Definition ultratypes.h:12