summaryrefslogtreecommitdiff
path: root/include/d/col/c/c_bg_w.h
blob: 54898265a7cb832a633ab729a2859ccee09e54ad (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
#ifndef C_BG_W_H
#define C_BG_W_H

#include "common.h"

enum {
    BG_ID_MAX = 600
};

class cBgW_BgId {
private:
    /* 0x0 */ s16 m_id;
    /* 0x4 vtable */

public:
    cBgW_BgId();
    void Ct() {
        m_id = BG_ID_MAX;
    };

    void Regist(int);
    void Release();
    bool ChkUsed() const;

    virtual ~cBgW_BgId();

    s16 GetId() const {
        return m_id;
    }
};

// Defines are required for these checks to not inline some float comp bool things
#if 1

#define cBgW_CheckBGround(f) (f > 0.5f)
#define cBgW_CheckBRoof(f) (f < (-4.0f / 5.0f))

inline bool cBgW_CheckBWall(f32 a1) {
    if (!cBgW_CheckBGround(a1) && !cBgW_CheckBRoof(a1)) {
        return true;
    }

    return false;
}

#else
inline bool cBgW_CheckBGround(f32 f) {
    return f > 0.5f;
}
inline bool cBgW_CheckBRoof(f32 a1) {
    return a1 <= (-4.0f / 5.0f);
}
inline bool cBgW_CheckBWall(f32 a1) {
    if (!cBgW_CheckBGround(a1) && !cBgW_CheckBRoof(a1)) {
        return true;
    }

    return false;
}
#endif

#endif