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) { return; }
25
26 temp_f0 = is_within_render_distance(arg0->pos, arg2->pos, arg0->rot[1], 0, gCameraZoom[arg0 - camera1], 1000000.0f);
27
28 if (temp_f0 < 0.0f) {
29
30 switch(temp_lo) {
31 case 0:
32 arg2->visibilityStates[0] = -1;
33 break;
34 case 1:
35 arg2->visibilityStates[1] = -1;
36 break;
37 case 2:
38 arg2->visibilityStates[2] = -1;
39 break;
40 case 3:
41 arg2->visibilityStates[3] = -1;
42 break;
43
44 }
45 return;
46 }
47 arg1[3][0] = arg2->pos[0];
48 arg1[3][1] = arg2->pos[1];
49 arg1[3][2] = arg2->pos[2];
50 maxObjectsReached = render_set_position(arg1, 0) == 0;
51 if (maxObjectsReached) { return; }
52
53 if (90000.0f < temp_f0) {
54
55 switch(temp_lo) {
56 case 0:
57 arg2->visibilityStates[0] = 0;
58 break;
59 case 1:
60 arg2->visibilityStates[1] = 0;
61 break;
62 case 2:
63 arg2->visibilityStates[2] = 0;
64 break;
65 case 3:
66 arg2->visibilityStates[3] = 0;
67 break;
68 }
69 animationFrame = 0;
70
71 } else {
72 switch(temp_lo) {
73 case 0:
74 arg2->visibilityStates[0] = 1;
75 break;
76 case 1:
77 arg2->visibilityStates[1] = 1;
78 break;
79 case 2:
80 arg2->visibilityStates[2] = 1;
81 break;
82 case 3:
83 arg2->visibilityStates[3] = 1;
84 break;
85 }
86
87 switch(temp_lo) {
88 case 0:
89 animationFrame = arg2->timers[0];
90 break;
91 case 1:
92 animationFrame = arg2->timers[1];
93 break;
94 case 2:
95 animationFrame = arg2->timers[2];
96 break;
97 case 3:
98 animationFrame = arg2->timers[3];
99 break;
100 }
101 }
102 animationFrame /= 6;
103
104 if (animationFrame > 8) {
105 animationFrame = 8;
106 }
107 addr = D_802BA058 + (animationFrame << 0xB);
108 gDPLoadTextureBlock(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(addr), G_IM_FMT_CI, G_IM_SIZ_8b, 32, 64, 0,
109 G_TX_MIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
110
111
114 } else {
116 }
117}
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:406
#define G_IM_FMT_CI
Definition gbi.h:398
#define UNUSED
Definition macros.h:24
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:73
Gfx * gDisplayListHead
Definition main.c:133
f32 gCameraZoom[4]
Definition main.c:123
Gfx d_course_mario_raceway_dl_piranha_plant[]
Definition course_data.c:3612
f32 is_within_render_distance(Vec3f cameraPos, Vec3f objectPos, u16 orientationY, f32 minDistance, f32 fov, f32 maxDistance)
Definition math_util.c:1092
s32 render_set_position(Mat4 arg0, s32 arg1)
Definition math_util.c:49
@ COURSE_MARIO_RACEWAY
Definition mk64.h:22
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:7405
Definition camera.h:26
Vec3s rot
Definition camera.h:33
Vec3f pos
Definition camera.h:27
Definition actor_types.h:260
Vec4s visibilityStates
Definition actor_types.h:263
Vec4s timers
Definition actor_types.h:267
s16 flags
Definition actor_types.h:262
Vec3f pos
Definition actor_types.h:266
signed int s32
Definition ultratypes.h:15
signed short int s16
Definition ultratypes.h:13
float f32
Definition ultratypes.h:33
unsigned char u8
Definition ultratypes.h:12