Mario Kart 64
Loading...
Searching...
No Matches
render.inc.c
Go to the documentation of this file.
1#include <actors.h>
2#include <code_800029B0.h>
3#include <PR/gbi.h>
4#include <main.h>
5
12void render_actor_fake_item_box(Camera *camera, struct FakeItemBox *fakeItemBox) {
13 Vec3s someRot;
14 UNUSED s32 pad[3];
15 Vec3f someVec;
16 Mat4 someMatrix2;
17 Mat4 someMatrix3;
18 UNUSED s32 pad2[12];
19 f32 temp_f0_2;
20 f32 temp_f0_3;
21 f32 temp_f12;
22 f32 temp_f2;
23 f32 thing;
24 f32 temp_f2_2;
25 f32 someMultiplier;
26
27 if (is_within_render_distance(camera->pos, fakeItemBox->pos, camera->rot[1], 2500.0f, gCameraZoom[camera - camera1], 1000000.0f) < 0) {
28 actor_not_rendered(camera, (struct Actor *) fakeItemBox);
29 return;
30 }
31 if (((f32) gCourseMaxY + 800.0f) < fakeItemBox->pos[1]) {
32 actor_not_rendered(camera, (struct Actor *) fakeItemBox);
33 return;
34 }
35 if (fakeItemBox->pos[1] < ((f32) gCourseMinY - 800.0f)) {
36 actor_not_rendered(camera, (struct Actor *) fakeItemBox);
37 return;
38 }
39
40 actor_rendered(camera, (struct Actor *) fakeItemBox);
41 someRot[0] = 0;
42 someRot[1] = fakeItemBox->rot[1];
43 someRot[2] = 0;
44 mtxf_pos_rotation_xyz(someMatrix2, fakeItemBox->pos, someRot);
45 mtxf_scale(someMatrix2, fakeItemBox->sizeScaling);
46 if (fakeItemBox->state != 2) {
47
48 if (!render_set_position(someMatrix2, 0)) { return; }
49
51 mtxf_pos_rotation_xyz(someMatrix2, fakeItemBox->pos, fakeItemBox->rot);
52 mtxf_scale(someMatrix2, fakeItemBox->sizeScaling);
53
54 if (!render_set_position(someMatrix2, 0)) { return; }
55
56 gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
58 if ((fakeItemBox->rot[1] < 0xAA1) && (fakeItemBox->rot[1] > 0)) {
60 } else if ((fakeItemBox->rot[1] >= 0x6AA5) && (fakeItemBox->rot[1] < 0x754E)) {
62 } else if ((fakeItemBox->rot[1] >= 0x38E1) && (fakeItemBox->rot[1] < 0x438A)) {
64 } else if ((fakeItemBox->rot[1] >= 0xC711) && (fakeItemBox->rot[1] < 0xD1BA)) {
66 } else {
67 gDPSetBlendMask(gDisplayListHead++, 0xFF);
69 }
70 gSPDisplayList(gDisplayListHead++, D_0D003090);
71 } else {
72 gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
73 gSPClearGeometryMode(gDisplayListHead++, G_CULL_BACK);
74 gDPSetBlendMask(gDisplayListHead++, 0xFF);
75 thing = fakeItemBox->someTimer;
76 mtxf_pos_rotation_xyz(someMatrix2, fakeItemBox->pos, fakeItemBox->rot);
77 if (thing < 10.0f) {
78 someMultiplier = 1.0f;
79 } else {
80 someMultiplier = 1.0f - ((thing - 10.0f) * 0.1f);
81 }
82 mtxf_scale(someMatrix2, someMultiplier);
83 if (fakeItemBox->someTimer & 1) {
85 } else {
87 }
88 temp_f2 = 2.0f * thing;
89 someVec[0] = 0.0f;
90 someVec[1] = temp_f2;
91 someVec[2] = thing;
92 add_translate_mat4_vec3f(someMatrix2, someMatrix3, someVec);
93
94 if (!render_set_position(someMatrix3, 0)) { return; }
95
96 gSPDisplayList(gDisplayListHead++, D_0D003158);
97 temp_f2_2 = 0.8f * thing;
98 temp_f12 = 0.5f * thing;
99 someVec[0] = temp_f2_2;
100 someVec[1] = 2.3f * thing;
101 someVec[2] = temp_f12;
102 add_translate_mat4_vec3f(someMatrix2, someMatrix3, someVec);
103
104 if (!render_set_position(someMatrix3, 0)) { return; }
105
106 gSPDisplayList(gDisplayListHead++, D_0D0031B8);
107 temp_f0_2 = -0.5f * thing;
108 someVec[0] = temp_f2_2;
109 someVec[1] = 1.2f * thing;
110 someVec[2] = temp_f0_2;
111 add_translate_mat4_vec3f(someMatrix2, someMatrix3, someVec);
112
113 if (!render_set_position(someMatrix3, 0)) { return; }
114
115 gSPDisplayList(gDisplayListHead++, D_0D003128);
116 if (!(fakeItemBox->someTimer & 1)) {
118 } else {
120 }
121 someVec[0] = 0.0f;
122 someVec[1] = 1.8f * thing;
123 someVec[2] = -1.0f * thing;
124 add_translate_mat4_vec3f(someMatrix2, someMatrix3, someVec);
125
126 if (!render_set_position(someMatrix3, 0)) { return; }
127
128 gSPDisplayList(gDisplayListHead++, D_0D0031E8);
129 temp_f0_3 = -0.8f * thing;
130 someVec[0] = temp_f0_3;
131 someVec[1] = 0.6f * thing;
132 someVec[2] = temp_f0_2;
133 add_translate_mat4_vec3f(someMatrix2, someMatrix3, someVec);
134
135 if (!render_set_position(someMatrix3, 0)) { return; }
136
137 gSPDisplayList(gDisplayListHead++, D_0D003188);
138 someVec[0] = temp_f0_3;
139 someVec[1] = temp_f2;
140 someVec[2] = temp_f12;
141 add_translate_mat4_vec3f(someMatrix2, someMatrix3, someVec);
142
143 if (!render_set_position(someMatrix3, 0)) { return; }
144
145 gSPDisplayList(gDisplayListHead++, D_0D0030F8);
146 gSPSetGeometryMode(gDisplayListHead++, G_CULL_BACK);
147 }
148}
void actor_not_rendered(Camera *arg0, struct Actor *arg1)
Definition actors.c:284
void actor_rendered(Camera *arg0, struct Actor *arg1)
Definition actors.c:301
Camera * camera1
Definition camera.c:23
s16 gCourseMaxY
Definition code_800029B0.c:89
s16 gCourseMinY
Definition code_800029B0.c:90
Gfx D_0D003090[]
Gfx D_0D003188[]
Gfx D_0D0031E8[]
Gfx D_0D003128[]
Gfx D_0D003158[]
Gfx D_0D0031B8[]
Gfx D_0D0030F8[]
Gfx common_model_fake_itembox[]
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_fake_item_box(Camera *camera, struct FakeItemBox *fakeItemBox)
Renders the fake item box actor.
Definition render.inc.c:12
#define G_CULL_BACK
Definition gbi.h:355
#define G_RM_NOOP2
Definition gbi.h:1031
#define G_RM_ZB_CLD_SURF2
Definition gbi.h:1012
#define G_RM_ZB_CLD_SURF
Definition gbi.h:1011
#define G_RM_AA_ZB_OPA_SURF
Definition gbi.h:941
#define G_RM_AA_ZB_OPA_SURF2
Definition gbi.h:942
#define G_RM_AA_ZB_XLU_INTER
Definition gbi.h:951
#define G_LIGHTING
Definition gbi.h:359
#define G_CC_MODULATEIA
Definition gbi.h:492
#define UNUSED
Definition macros.h:24
Gfx * gDisplayListHead
Definition main.c:133
f32 gCameraZoom[4]
Definition main.c:123
f32 is_within_render_distance(Vec3f cameraPos, Vec3f objectPos, u16 orientationY, f32 minDistance, f32 fov, f32 maxDistance)
Definition math_util.c:1092
void mtxf_pos_rotation_xyz(Mat4 out, Vec3f pos, Vec3s orientation)
Definition math_util.c:466
s32 render_set_position(Mat4 arg0, s32 arg1)
Definition math_util.c:49
void add_translate_mat4_vec3f(Mat4 mat, Mat4 dest, Vec3f pos)
Definition math_util.c:178
void mtxf_scale(Mat4 mat, f32 coef)
Definition math_util.c:453
Definition actor_types.h:120
Definition camera.h:26
Vec3s rot
Definition camera.h:33
Vec3f pos
Definition camera.h:27
Definition actor_types.h:346
Vec3s rot
Definition actor_types.h:353
s16 someTimer
Definition actor_types.h:349
f32 sizeScaling
Definition actor_types.h:351
s16 state
Definition actor_types.h:350
Vec3f pos
Definition actor_types.h:355
signed int s32
Definition ultratypes.h:15
float f32
Definition ultratypes.h:33