summaryrefslogtreecommitdiff
path: root/src/actors/school_bus/render.inc.c
blob: 6530a0974c1629e5146044d6dac3eba60881fd12 (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
#include <racing/actors.h>
#include <libultra/gbi.h>
#include <main.h>
#include <defines.h>

/**
 * @brief Renders the school bus actor.
 * Actor used in Toad's Turnpike.
 * His update are made in vehicle.
 *
 * @param camera
 * @param arg1
 */
void render_actor_school_bus(Camera* camera, struct Actor* arg1) {
    UNUSED s32 pad[6];
    Mat4 spC8;
    UNUSED s32 pad2[32];
    f32 temp_f0;

    temp_f0 =
        is_within_render_distance(camera->pos, arg1->pos, camera->rot[1], 2500.0f, camera->fieldOfView, 9000000.0f);

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

    if (temp_f0 < 0.0f) {
        return;
    }

    if (CVarGetInteger("gDisableLod", 1) == 1) {
        temp_f0 = 0.0f;
    }

    gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
    gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);

    mtxf_pos_rotation_xyz(spC8, arg1->pos, arg1->rot);
    if (render_set_position(spC8, 0) != 0) {

        if (gActiveScreenMode == SCREEN_MODE_1P) {
            if (temp_f0 < 160000.0f) {
                gSPDisplayList(gDisplayListHead++, &toads_turnpike_dl_3);
            } else if (temp_f0 < 640000.0f) {
                gSPDisplayList(gDisplayListHead++, &toads_turnpike_dl_4);
            } else {
                gSPDisplayList(gDisplayListHead++, toads_turnpike_dl_5);
            }
        } else if (temp_f0 < 160000.0f) {
            gSPDisplayList(gDisplayListHead++, &toads_turnpike_dl_4);
        } else {
            gSPDisplayList(gDisplayListHead++, &toads_turnpike_dl_5);
        }
    }
}