SpaghettiKart
Loading...
Searching...
No Matches
render.inc.c
Go to the documentation of this file.
1#include <camera.h>
2#include <actors.h>
3#include <defines.h>
4#include <main.h>
6
16void render_actor_yoshi_egg(Camera* camera, Mat4 arg1, struct YoshiValleyEgg* egg, u16 arg3) {
17 Mat4 sp60;
18 Vec3s sp5C;
19 Vec3f sp54;
20 f32 temp_f0;
21
22 size_t actorIdx = CM_FindActorIndex((struct Actor*) egg);
23 if (-1 == actorIdx) {
24 printf("[render_actor_yoshi_egg] Could not find actor for FI, skipping\n");
25 return;
26 }
27
29 temp_f0 = is_within_render_distance(camera->pos, egg->pos, camera->rot[1], 200.0f, camera->fieldOfView,
30 16000000.0f);
31
32 if (CVarGetInteger("gNoCulling", 0) == 1) {
33 temp_f0 = MAX(temp_f0, 0.0f);
34 }
35
36 if (temp_f0 < 0.0f) {
37 return;
38 }
39 } else {
40 arg3 = 15;
41 temp_f0 = 0.0f;
42 }
43
44 if (CVarGetInteger("gDisableLod", 1) == 1) {
45 arg3 = 15;
46 temp_f0 = 0.0f;
47 }
48
49 gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
50 if ((arg3 > 12) && (arg3 < 20)) {
51 if (temp_f0 < 640000.0f) {
52 sp54[0] = egg->pos[0];
53 sp54[1] = 3.0f;
54 sp54[2] = egg->pos[2];
55 func_802976D8(sp5C);
56 func_8029794C(sp54, sp5C, 10.0f);
57 }
58 sp5C[0] = 0;
59 sp5C[1] = egg->eggRot;
60 sp5C[2] = 0;
61
62 FrameInterpolation_RecordOpenChild("yoshi_egg", TAG_OBJECT((actorIdx << 4) | camera->cameraId));
63
64 mtxf_pos_rotation_xyz(sp60, egg->pos, sp5C);
65 if (render_set_position(sp60, 0) == 0) {
66 return;
67 }
68
69 gSPSetGeometryMode(gDisplayListHead++, G_LIGHTING);
70 gSPDisplayList(gDisplayListHead++, d_course_yoshi_valley_dl_16D70);
72 } else {
73 arg1[3][0] = egg->pos[0];
74 arg1[3][1] = egg->pos[1];
75 arg1[3][2] = egg->pos[2];
76
77 FrameInterpolation_RecordOpenChild("yoshi_egg2", TAG_OBJECT((actorIdx << 4) | camera->cameraId));
78
79 if (render_set_position(arg1, 0) != 0) {
80 gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
81 gSPDisplayList(gDisplayListHead++, d_course_yoshi_valley_dl_egg_lod0);
82 }
84 }
85}
void FrameInterpolation_RecordOpenChild(const void *a, uintptr_t b)
Definition FrameInterpolation.cpp:640
void FrameInterpolation_RecordCloseChild(void)
Definition FrameInterpolation.cpp:650
#define TAG_OBJECT(x)
Definition FrameInterpolation.h:24
void gSPDisplayList(Gfx *pkt, Gfx *dl)
Definition GBIMiddleware.cpp:12
size_t CM_FindActorIndex(Actor *actor)
Definition Game.cpp:742
void func_802976D8(Vec3s arg0)
Definition actors.c:402
void func_8029794C(Vec3f pos, Vec3s rot, f32 scale)
Definition actors.c:470
f32 Vec3f[3]
Definition common_structs.h:10
s16 Vec3s[3]
Definition common_structs.h:15
f32 Mat4[4][4]
Definition common_structs.h:20
#define CREDITS_SEQUENCE
Definition defines.h:229
#define MAX(a, b)
Definition macros.h:144
Gfx * gDisplayListHead
Definition main.c:129
s32 gGamestate
Definition main.c:164
s32 render_set_position(Mat4 mtx, s32 arg1)
Definition math_util.c:53
f32 is_within_render_distance(Vec3f cameraPos, Vec3f objectPos, u16 orientationY, f32 minDistance, f32 fov, f32 maxDistance)
Definition math_util.c:1099
void mtxf_pos_rotation_xyz(Mat4 out, Vec3f pos, Vec3s orientation)
Definition math_util.c:449
Definition actor_types.h:124
Definition camera.h:35
Vec3s rot
Definition camera.h:42
size_t cameraId
Definition camera.h:67
f32 fieldOfView
Definition camera.h:43
Vec3f pos
Definition camera.h:36
Definition actor_types.h:222
s16 eggRot
Definition actor_types.h:230
Vec3f pos
Definition actor_types.h:233
void render_actor_yoshi_egg(Camera *camera, Mat4 arg1, struct YoshiValleyEgg *egg, u16 arg3)
Renders the Yoshi egg actor. Actor used in Yoshi Valley.
Definition render.inc.c:16