summaryrefslogtreecommitdiff
path: root/include/d/d_magma.h
blob: d2fef1eb9c8b64e727312f0964f51e4d23493540 (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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#ifndef D_MAGMA_H
#define D_MAGMA_H

#include "SSystem/SComponent/c_xyz.h"
#include "dolphin/mtx/mtx.h"
#include "JSystem/J3DGraphBase/J3DPacket.h"

class dMagma_ball_c {
public:
    dMagma_ball_c() {}
    virtual ~dMagma_ball_c() {}
    virtual void calc(f32, u8, int) = 0;
    virtual void update() = 0;
    virtual void setup(f32, u8, int) = 0;

    void draw();
    BOOL rangeCheck(cXyz&, f32*);

protected:
    /* 0x04 */ cXyz mPos;
    /* 0x10 */ f32 mScale;
    /* 0x14 */ f32 mBaseY;
    /* 0x18 */ s16 mWave;
    /* 0x1A */ u8 mTimer;
    /* 0x1C */ Mtx mPosMtx;
    /* 0x4C */ Mtx mTexProjMtx;
};

class dMagma_ballPath_c : public dMagma_ball_c {
public:
    dMagma_ballPath_c() {}
    virtual ~dMagma_ballPath_c() {}
    virtual void calc(f32, u8, int);
    virtual void update();
    virtual void setup(f32, u8, int);

private:
    /* 0x7C */ u8 mWaveTimer;
};

class dMagma_ballBoss_c : public dMagma_ball_c {
public:
    dMagma_ballBoss_c() {}
    virtual ~dMagma_ballBoss_c() {}
    virtual void calc(f32, u8, int);
    virtual void update();
    virtual void setup(f32, u8, int);

private:
    /* 0x7C */ s16 field_0x7C;
};

class dMagma_floor_c {
public:
    ~dMagma_floor_c();
    dMagma_floor_c();

    void draw();
    void calc(int);
    void update();
    dMagma_ball_c** create(cXyz&, cXyz&, s16, u8, int);
    void remove();

    dMagma_floor_c* getNext() { return mpNext; }
    void setNext(dMagma_floor_c* v) { mpNext = v; }
    dMagma_ball_c** getBall() { return mpBalls; }
    int getBallNum() { return mBallNum; }
    cXyz* getPos() { return &mPos; }
    f32 getScaleX() { return mScaleX; }
    f32 getScaleZ() { return mScaleZ; }
    void setYpos(f32 y) { mPos.y = y; }

private:
    /* 0x00 */ dMagma_ball_c** mpBalls;
    /* 0x04 */ u8 mBallNum;
    /* 0x05 */ u8 mPathNo;
    /* 0x06 */ u8 field_0x06[0x08 - 0x06];
    /* 0x08 */ cXyz mPos;
    /* 0x14 */ f32 mScaleX;
    /* 0x18 */ f32 mScaleZ;
    /* 0x1C */ Mtx mPosMtx;
    /* 0x4C */ Mtx mTexMtx0;
    /* 0x7C */ Mtx mPostMtx0;
    /* 0xAC */ dMagma_floor_c* mpNext;
};

class dMagma_room_c {
public:
    void newFloor(dMagma_floor_c*);
    dMagma_floor_c* getFloor() { return mpFirst; }
    void deleteFloor();

    dMagma_room_c();

private:
    /* 0x0 */ dMagma_floor_c* mpFirst;
};

class dMagma_packet_c : public J3DPacket {
public:
    dMagma_packet_c();
    void calc();
    void update();
    f32 checkYpos(cXyz&);
    dMagma_floor_c* newFloor(cXyz&, cXyz&, int, s16);
    void deleteRoom(int roomNo) { mRoom[roomNo].deleteFloor(); }

    virtual void draw();
    virtual ~dMagma_packet_c();

    static GXTexObj* getKuroTexObj() { return &mKuroTexObj; }
    static GXTexObj* getColTexObj() { return &mColTexObj; }
    static MtxP getKuroMtx() { return mKuroMtx; }

    static GXTexObj mKuroTexObj;
    static Mtx mKuroMtx;
    static GXTexObj mColTexObj;
    static Mtx mBallMtx;
    static Mtx mFloorMtx;

private:
    /* 0x010 */ dMagma_floor_c mFloor[8];
    /* 0x590 */ dMagma_room_c mRoom[64];
    /* 0x690 */ GXColor mColor1;
    /* 0x694 */ f32 mTimer;
};

#endif /* D_MAGMA_H */