summaryrefslogtreecommitdiff
path: root/src/engine/PlayerBombKart.cpp
blob: cb448f3d1b623f29d84d45204ace0bb253d5df5a (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include "PlayerBombKart.h"
#include "Matrix.h"

extern "C" {
#include "common_structs.h"
#include "assets/common_data.h"
#include "camera.h"
#include "render_objects.h"
#include "math_util_2.h"
#include "code_80057C60.h"
#include "menus.h"
}

void PlayerBombKart::Draw(size_t playerId, s32 cameraId) { // render_player_bomb_kart
    Player* player = &gPlayerOne[playerId];
    if (state != PlayerBombKartState::DISABLED) {
        pos.x = player->pos.x;
        pos.y = player->pos.y - 2.0;
        pos.z = player->pos.z;
        surfaceHeight = player->unk_074;
        PlayerBombKart::func_800563DC(cameraId, _primAlpha);
        PlayerBombKart::func_8005669C(_primAlpha);
        PlayerBombKart::func_800568A0(cameraId);
    }
}

void PlayerBombKart::func_800563DC(s32 cameraId, s32 arg2) {
    s32 temp_s0;
    s32 temp_v0;
    s32 residue;
    Camera* camera = &camera1[cameraId];

    residue = D_801655CC % 4U;
    D_80183E40[0] = pos.x;
    D_80183E40[1] = pos.y + 1.0;
    D_80183E40[2] = pos.z;
    D_80183E80[0] = 0;
    D_80183E80[1] = func_800418AC(pos.x, pos.z, camera->pos);
    D_80183E80[2] = 0x8000;
    rsp_set_matrix_transformation(D_80183E40, D_80183E80, 0.2f);
    gSPDisplayList(gDisplayListHead++, (Gfx*)D_0D007E98);
    func_8004B310(arg2);
    draw_rectangle_texture_overlap((u8*) common_tlut_bomb, (u8*)common_texture_bomb[residue], (Vtx*)D_0D005AE0, 0x00000020,
                                   0x00000020, 0x00000020, 0x00000020);
    temp_s0 = D_8018D400;
    gSPDisplayList(gDisplayListHead++, (Gfx*)D_0D007B00);
    func_8004B414(0, 0, 0, arg2);
    D_80183E40[1] = D_80183E40[1] + 4.0;
    D_80183E80[2] = 0;
    func_800562E4(temp_s0 % 3, temp_s0 % 4, arg2);
    temp_v0 = temp_s0 + 1;
    D_80183E80[2] = 0x6000;
    func_800562E4(temp_v0 % 3, temp_v0 % 4, arg2);
    temp_v0 = temp_s0 + 2;
    D_80183E80[2] = 0xA000;
    func_800562E4(temp_v0 % 3, temp_v0 % 4, arg2);
    gSPTexture(gDisplayListHead++, 1, 1, 0, G_TX_RENDERTILE, G_OFF);
}

void PlayerBombKart::func_8005669C(s32 arg2) {
    gSPDisplayList(gDisplayListHead++, (Gfx*)D_0D0079E8);
    func_8004B310(arg2);
    load_texture_block_rgba16_mirror((u8*) D_0D02AA58, 0x00000010, 0x00000010);
    D_80183E40[1] = pos.y - 2.0;
    D_80183E40[0] = pos.x + 2.0;
    D_80183E40[2] = pos.z + 2.0;
    func_800431B0(D_80183E40, D_80183E80, 0.15f, (Vtx*)common_vtx_rectangle);
    D_80183E40[0] = pos.x + 2.0;
    D_80183E40[2] = pos.z - 2.0;
    func_800431B0(D_80183E40, D_80183E80, 0.15f, (Vtx*)common_vtx_rectangle);
    D_80183E40[0] = pos.x - 2.0;
    D_80183E40[2] = pos.z - 2.0;
    func_800431B0(D_80183E40, D_80183E80, 0.15f, (Vtx*)common_vtx_rectangle);
    D_80183E40[0] = pos.x - 2.0;
    D_80183E40[2] = pos.z + 2.0;
    func_800431B0(D_80183E40, D_80183E80, 0.15f, (Vtx*)common_vtx_rectangle);
    gSPTexture(gDisplayListHead++, 1, 1, 0, G_TX_RENDERTILE, G_OFF);
}

void PlayerBombKart::func_800568A0(s32 cameraId) {
    Mat4 mtx;
    Player* player;

    player = &gPlayerOne[cameraId];
    D_80183E50[0] = pos.x;
    D_80183E50[1] = surfaceHeight + 0.8;
    D_80183E50[2] = pos.z;
    set_transform_matrix(mtx, player->collision.orientationVector, D_80183E50, 0U, 0.5f);
    // convert_to_fixed_point_matrix(&gGfxPool->mtxHud[gMatrixHudCount], mtx);
    // gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxHud[gMatrixHudCount++]),
    //           G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);

    AddHudMatrix(mtx, G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW);
    gSPDisplayList(gDisplayListHead++, (Gfx*)D_0D007B98);
}