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

#include <libultraship.h>
#include "engine/registry/RegisterContent.h"
#include "engine/World.h"
#include "engine/objects/Object.h"

class OPenguin : public OObject {
public:
    enum PenguinType : int16_t {
        CHICK,
        ADULT,
        CREDITS,
        EMPEROR
    };

    enum Behaviour : int16_t {
        DISABLED,
        STRUT, // Emperor penguin
        CIRCLE, // Waddle in a circle
        SLIDE3,
        SLIDE4,
        UNK, // unused
        SLIDE6,
    };

    explicit OPenguin(const SpawnParams& params);

    // This is simply a helper function to keep Spawning code clean
    static OPenguin* Spawn(FVector pos, u16 direction, u16 mirrorModeAngleOffset, f32 diameter, PenguinType type, Behaviour behaviour) {
        IRotator rot;
        rot.Set(0, direction, mirrorModeAngleOffset);
        SpawnParams params = {
            .Name = "mk:penguin",
            .Type = type,
            .Behaviour = behaviour,
            .Location = pos,
            .Rotation = rot,
            .Speed = diameter, // Diameter of the walking circle
        };
        return dynamic_cast<OPenguin*>(AddObjectToWorld<OPenguin>(params));
    }

    PenguinType Type = PenguinType::CHICK;
    Behaviour SpawnBhv = Behaviour::STRUT;

    virtual void Tick() override;
    virtual void Draw(s32 cameraId) override;
    virtual void Reset() override;
    virtual void DrawEditorProperties() override;
private:
    void Behaviours(s32 objectIndex);
    void EmperorPenguin(s32 objectIndex);
    void func_80085080(s32 objectIndex);
    void func_8008502C(s32 objectIndex);
    void func_80084D2C(s32 objectIndex, s32 arg1);

    void InitEmperorPenguin(s32 objectIndex);
    void OtherPenguin(s32 objectIndex);
    void InitOtherPenguin(s32 objectIndex);

    static bool _toggle;
};