summaryrefslogtreecommitdiff
path: root/src/actors/paddle_boat/render.inc.c
blob: a85b582940aca3a58c2c506e2a1bc5cfd6a7a4d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <libultraship.h>
#include <macros.h>
#include <actor_types.h>
#include "camera.h"
#include "main.h"
#include "racing/actors.h"
#include "courses/all_course_data.h"
#include <assets/models/tracks/dks_jungle_parkway/dks_jungle_parkway_data.h>
#include <libultra/gbi.h>

/**
 * @brief Renders the paddle boat actor.
 * Actor used in DK's Jungle Parkway.
 *
 * @param camera
 * @param boat
 * @param arg2
 * @param pathCounter
 */
void render_actor_paddle_boat(Camera* camera, struct PaddleWheelBoat* boat, UNUSED Mat4 arg2, u16 pathCounter) {
    UNUSED s32 pad[3];
    Vec3f sp120;
    Mat4 spE0;
    Mat4 spA0;
    Mat4 sp60;
    f32 temp;

    if ((pathCounter > 20) && (pathCounter < 25)) {
        return;
    }

    temp = is_within_render_distance(camera->pos, boat->pos, camera->rot[1], 90000.0f, camera->fieldOfView,
                                     9000000.0f);

    if (CVarGetInteger("gNoCulling", 0) == 1) {
        temp = MAX(temp, 0.0f);
    }

    if (temp < 0.0f) {
        return;
    }

    gSPSetLights1(gDisplayListHead++, D_800DC610[1]);
    gSPSetGeometryMode(gDisplayListHead++, G_SHADE | G_LIGHTING | G_SHADING_SMOOTH);

    mtxf_pos_rotation_xyz(spE0, boat->pos, boat->boatRot);
    if (render_set_position(spE0, 1) != 0) {

        // Render the boat
        gSPDisplayList(gDisplayListHead++, &d_course_dks_jungle_parkway_boat_dl);
        gSPDisplayList(gDisplayListHead++, &d_course_dks_jungle_parkway_railings_dl);

        mtxf_rotate_x(spE0, boat->wheelRot);
        vec3f_set(sp120, 0, 16.0f, -255.0f);
        mtxf_translate(spA0, sp120);
        mtxf_multiplication(sp60, spE0, spA0);
        if (render_set_position(sp60, 3) != 0) {
            // Render the paddle wheel
            gSPClearGeometryMode(gDisplayListHead++, G_CULL_BACK);
            gSPDisplayList(gDisplayListHead++, &d_course_dks_jungle_parkway_paddle_wheel_dl);
            gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);
            gSPSetGeometryMode(gDisplayListHead++, G_CULL_BACK);
        }
    }
}