SpaghettiKart
Loading...
Searching...
No Matches
render.inc.c
Go to the documentation of this file.
1#include <libultraship.h>
2#include <macros.h>
3#include <actor_types.h>
4#include "camera.h"
5#include "main.h"
6#include "actors.h"
9#include <libultra/gbi.h>
10
20void render_actor_paddle_boat(Camera* camera, struct PaddleWheelBoat* boat, UNUSED Mat4 arg2, u16 pathCounter) {
21 UNUSED s32 pad[3];
22 Vec3f sp120;
23 Mat4 spE0;
24 Mat4 spA0;
25 Mat4 sp60;
26 f32 temp;
27
28 if ((pathCounter > 20) && (pathCounter < 25)) {
29 return;
30 }
31
32 temp = is_within_render_distance(camera->pos, boat->pos, camera->rot[1], 90000.0f, camera->fieldOfView,
33 9000000.0f);
34
35 if (CVarGetInteger("gNoCulling", 0) == 1) {
36 temp = MAX(temp, 0.0f);
37 }
38
39 if (temp < 0.0f) {
40 return;
41 }
42
43 gSPSetLights1(gDisplayListHead++, D_800DC610[1]);
44 gSPSetGeometryMode(gDisplayListHead++, G_SHADE | G_LIGHTING | G_SHADING_SMOOTH);
45
46 mtxf_pos_rotation_xyz(spE0, boat->pos, boat->boatRot);
47 if (render_set_position(spE0, 1) != 0) {
48
49 // Render the boat
50 gSPDisplayList(gDisplayListHead++, &d_course_dks_jungle_parkway_boat_dl);
51 gSPDisplayList(gDisplayListHead++, &d_course_dks_jungle_parkway_railings_dl);
52
53 mtxf_rotate_x(spE0, boat->wheelRot);
54 vec3f_set(sp120, 0, 16.0f, -255.0f);
55 mtxf_translate(spA0, sp120);
56 mtxf_multiplication(sp60, spE0, spA0);
57 if (render_set_position(sp60, 3) != 0) {
58 // Render the paddle wheel
59 gSPClearGeometryMode(gDisplayListHead++, G_CULL_BACK);
60 gSPDisplayList(gDisplayListHead++, &d_course_dks_jungle_parkway_paddle_wheel_dl);
61 gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);
62 gSPSetGeometryMode(gDisplayListHead++, G_CULL_BACK);
63 }
64 }
65}
void mtxf_translate(Mat4, Vec3f)
Definition math_util.c:226
void gSPDisplayList(Gfx *pkt, Gfx *dl)
Definition GBIMiddleware.cpp:12
Lights1 D_800DC610[]
Definition code_800029B0.c:73
f32 Vec3f[3]
Definition common_structs.h:10
f32 Mat4[4][4]
Definition common_structs.h:20
#define UNUSED
Definition macros.h:40
#define MAX(a, b)
Definition macros.h:144
Gfx * gDisplayListHead
Definition main.c:129
s32 render_set_position(Mat4 mtx, s32 arg1)
Definition math_util.c:53
void mtxf_rotate_x(Mat4 mat, s16 angle)
Definition math_util.c:334
f32 is_within_render_distance(Vec3f cameraPos, Vec3f objectPos, u16 orientationY, f32 minDistance, f32 fov, f32 maxDistance)
Definition math_util.c:1099
void mtxf_multiplication(Mat4 dest, Mat4 mat1, Mat4 mat2)
Definition math_util.c:803
void mtxf_pos_rotation_xyz(Mat4 out, Vec3f pos, Vec3s orientation)
Definition math_util.c:449
void vec3f_set(Vec3f arg0, f32 arg1, f32 arg2, f32 arg3)
Definition math_util.c:113
void render_actor_paddle_boat(Camera *camera, struct PaddleWheelBoat *boat, UNUSED Mat4 arg2, u16 pathCounter)
Renders the paddle boat actor. Actor used in DK's Jungle Parkway.
Definition render.inc.c:20
Definition camera.h:35
Vec3s rot
Definition camera.h:42
f32 fieldOfView
Definition camera.h:43
Vec3f pos
Definition camera.h:36
Definition actor_types.h:260
Vec3f pos
Definition actor_types.h:269
Vec3s boatRot
Definition actor_types.h:267
s16 wheelRot
Definition actor_types.h:264