summaryrefslogtreecommitdiff
path: root/src/engine/objects/BombKart.h
blob: 86c2c0ef3744e115678349294652eb969fc99ba9 (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
#pragma once

#include <libultraship.h>
#include "engine/objects/Object.h"
#include <vector>
#include "engine/Matrix.h"

#include "World.h"

extern "C" {
#include "macros.h"
#include "main.h"
#include "vehicles.h"
#include "waypoints.h"
#include "common_structs.h"
#include "objects.h"
}

/**
 * Used in VS mode
 *
 * This differs from the other vehicle classes in that it does not get added to the standard actor list
 * So this is sort of its own thing. Draw call in different place too.
 */
class OBombKart : public OObject {
  public:
    enum States : uint16_t { // 0,1,3,5
        DISABLED,
        CCW,
        CW,
        STATIONARY,
        CHASE,
        EXPLODE,
        PODIUM_CEREMONY,
    };

    const char* Type;

    Vec3f Pos;
    Vec3f WheelPos[4]; //! @todo Turn WheelPos into a struct
    f32 Unk_3C;
    u16 SomeRot;       // Some angle
    u16 WaypointIndex; // The waypoint the kart circles
    States State = States::DISABLED;
    u16 BounceTimer = 0;
    u16 CircleTimer = 0;
    u16 Unk_4A = 0;
    s16 Unk_4C = 1;
    f32 CenterY; // Center of the circle
    Collision _Collision;

    // Set waypoint to NULL if using a spawn position and not a waypoint.
    explicit OBombKart(FVector pos, TrackPathPoint* waypoint, uint16_t waypointIndex, uint16_t state, f32 unk_3C);

    ~OBombKart() {
        _count--;
    }

    static size_t GetCount() {
        return _count;
    }

    virtual void Tick() override;
    virtual void Draw(s32 cameraId) override;
    void DrawBattle(s32 cameraId);
    void SomeRender(Vec3f arg1);
    void LoadMtx();
    void Waypoint(s32 screenId);

  private:
    static size_t _count;
    s32 _idx;
    Player* FindTarget();
    void Chase(Player*, Vec3f pos);

    Vec3f _spawnPos;
    Player* _target = NULL;
};