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 <macros.h>
4
11void render_actor_item_box(Camera *camera, struct ItemBox *item_box) {
12 UNUSED s32 pad[2];
13 Vec3f someVec1;
14 Vec3f someVec2;
15 Vec3s someRot;
16 f32 thing;
17 UNUSED s32 pad2;
18 Mat4 someMatrix1;
19 Mat4 someMatrix2;
20 UNUSED s32 pad3[4];
21 f32 temp_f0;
22 f32 temp_f0_2;
23 f32 temp_f0_3;
24 f32 temp_f12;
25 f32 temp_f2;
26 f32 temp_f2_2;
27 f32 someMultiplier;
28
29 temp_f0 = is_within_render_distance(camera->pos, item_box->pos, camera->rot[1], 0.0f, gCameraZoom[camera - camera1], 4000000.0f);
30 if (!(temp_f0 < 0.0f) && !(600000.0f < temp_f0)) {
31 if ((item_box->state == 2) && (temp_f0 < 100000.0f)) {
32 someRot[0] = 0;
33 someRot[1] = item_box->rot[1];
34 someRot[2] = 0;
35 someVec2[0] = item_box->pos[0];
36 someVec2[1] = item_box->resetDistance + 2.0f;
37 someVec2[2] = item_box->pos[2];
38 mtxf_pos_rotation_xyz(someMatrix1, someVec2, someRot);
39
40 if (!render_set_position(someMatrix1, 0)) { return; }
41
42 gSPDisplayList(gDisplayListHead++, D_0D002EE8);
43 someRot[1] = item_box->rot[1] * 2;
44 someVec2[1] = item_box->pos[1];
45 mtxf_pos_rotation_xyz(someMatrix1, someVec2, someRot);
46
47 if (!render_set_position(someMatrix1, 0)) { return; }
48
50 }
51 if (item_box->state == 5) {
52 mtxf_pos_rotation_xyz(someMatrix1, item_box->pos, item_box->rot);
53
54 if (!render_set_position(someMatrix1, 0)) { return; }
55
57 }
58 if (item_box->state != 3) {
59 mtxf_pos_rotation_xyz(someMatrix1, item_box->pos, item_box->rot);
60
61 if (!render_set_position(someMatrix1, 0)) { return; }
62
63 gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
65 if ((item_box->rot[1] < 0xAA1) && (item_box->rot[1] > 0)) {
67 } else if ((item_box->rot[1] >= 0x6AA5) && (item_box->rot[1] < 0x754E)) {
69 } else if ((item_box->rot[1] >= 0x38E1) && (item_box->rot[1] < 0x438A)) {
71 } else if ((item_box->rot[1] >= 0xC711) && (item_box->rot[1] < 0xD1BA)) {
73 } else {
74 gDPSetBlendMask(gDisplayListHead++, 0xFF);
76 }
77 gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
78 gSPDisplayList(gDisplayListHead++, D_0D003090);
79 } else {
80 gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
81 gSPClearGeometryMode(gDisplayListHead++, G_CULL_BACK);
82 gDPSetBlendMask(gDisplayListHead++, 0xFF);
83 thing = item_box->someTimer;
84 mtxf_pos_rotation_xyz(someMatrix1, item_box->pos, item_box->rot);
85 if (thing < 10.0f) {
86 someMultiplier = 1.0f;
87 } else {
88 someMultiplier = 1.0f - ((thing - 10.0f) * 0.1f);
89 }
90 mtxf_scale(someMatrix1, someMultiplier);
91 if (item_box->someTimer & 1) {
93 } else {
95 }
96 temp_f2 = 2.0f * thing;
97 someVec1[0] = 0.0f;
98 someVec1[1] = temp_f2;
99 someVec1[2] = thing;
100 add_translate_mat4_vec3f(someMatrix1, someMatrix2, someVec1);
101
102 if (!render_set_position(someMatrix2, 0)) { return; }
103
104 gSPDisplayList(gDisplayListHead++, D_0D003158);
105 temp_f2_2 = 0.8f * thing;
106 temp_f12 = 0.5f * thing;
107 someVec1[0] = temp_f2_2;
108 someVec1[1] = 2.3f * thing;
109 someVec1[2] = temp_f12;
110 add_translate_mat4_vec3f(someMatrix1, someMatrix2, someVec1);
111
112 if (!render_set_position(someMatrix2, 0)) { return; }
113
114 gSPDisplayList(gDisplayListHead++, D_0D0031B8);
115 temp_f0_2 = -0.5f * thing;
116 someVec1[0] = temp_f2_2;
117 someVec1[1] = 1.2f * thing;
118 someVec1[2] = temp_f0_2;
119 add_translate_mat4_vec3f(someMatrix1, someMatrix2, someVec1);
120
121 if (!render_set_position(someMatrix2, 0)) { return; }
122
123 gSPDisplayList(gDisplayListHead++, D_0D003128);
124 if (!(item_box->someTimer & 1)) {
126 } else {
128 }
129 someVec1[0] = 0.0f;
130 someVec1[1] = 1.8f * thing;
131 someVec1[2] = -1.0f * thing;
132 add_translate_mat4_vec3f(someMatrix1, someMatrix2, someVec1);
133
134 if (!render_set_position(someMatrix2, 0)) { return; }
135
136 gSPDisplayList(gDisplayListHead++, D_0D0031E8);
137 temp_f0_3 = -0.8f * thing;
138 someVec1[0] = temp_f0_3;
139 someVec1[1] = 0.6f * thing;
140 someVec1[2] = temp_f0_2;
141 add_translate_mat4_vec3f(someMatrix1, someMatrix2, someVec1);
142
143 if (!render_set_position(someMatrix2, 0)) { return; }
144
145 gSPDisplayList(gDisplayListHead++, D_0D003188);
146 someVec1[0] = temp_f0_3;
147 someVec1[1] = temp_f2;
148 someVec1[2] = temp_f12;
149 add_translate_mat4_vec3f(someMatrix1, someMatrix2, someVec1);
150
151 if (!render_set_position(someMatrix2, 0)) { return; }
152
153 gSPDisplayList(gDisplayListHead++, D_0D0030F8);
154 gSPSetGeometryMode(gDisplayListHead++, G_CULL_BACK);
155 }
156 gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
157 }
158}
Camera * camera1
Definition camera.c:23
Gfx D_0D003090[]
Gfx itemBoxQuestionMarkModel[]
Gfx D_0D003188[]
Gfx D_0D0031E8[]
Gfx D_0D002EE8[]
Gfx D_0D003128[]
Gfx D_0D003158[]
Gfx D_0D0031B8[]
Gfx D_0D0030F8[]
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
#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_SHADING_SMOOTH
Definition gbi.h:353
#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
void render_actor_item_box(Camera *camera, struct ItemBox *item_box)
Renders the item box actor.
Definition render.inc.c:11
#define UNUSED
Definition macros.h:24
Gfx * gDisplayListHead
Definition main.c:134
f32 gCameraZoom[4]
Definition main.c:124
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
#define G_ON
Definition mbi.h:54
Definition camera.h:26
Vec3s rot
Definition camera.h:33
Vec3f pos
Definition camera.h:27
Definition actor_types.h:328
s16 someTimer
Definition actor_types.h:331
Vec3f pos
Definition actor_types.h:339
s16 state
Definition actor_types.h:332
f32 resetDistance
Definition actor_types.h:333
Vec3s rot
Definition actor_types.h:337
signed int s32
Definition ultratypes.h:15
float f32
Definition ultratypes.h:34