-
Notifications
You must be signed in to change notification settings - Fork 6
/
IMod.h
70 lines (56 loc) · 2.17 KB
/
IMod.h
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
#pragma once
#include "virtools/CKAll.h"
#include "IBML.h"
#include "IConfig.h"
#include "BuildVer.h"
#define DECLARE_BML_VERSION \
virtual BMLVersion GetBMLVersion() override { return { BML_MAJOR_VER, BML_MINOR_VER, BML_BUILD_VER }; }
struct BMLVersion {
BMLVersion() : major(BML_MAJOR_VER), minor(BML_MINOR_VER), build(BML_BUILD_VER) {}
BMLVersion(int mj, int mn, int bd) : major(mj), minor(mn), build(bd) {}
int major, minor, build;
bool operator <(const BMLVersion& o) {
if (major == o.major) {
if (minor == o.minor)
return build < o.build;
return minor < o.minor;
}
return major < o.major;
}
bool operator >=(const BMLVersion& o) {
return !(*this < o);
}
};
class BML_EXPORT IMod : public IMessageReceiver {
public:
IMod(IBML* bml) : m_bml(bml) {};
virtual ~IMod();
virtual CKSTRING GetID() = 0;
virtual CKSTRING GetVersion() = 0;
virtual CKSTRING GetName() = 0;
virtual CKSTRING GetAuthor() = 0;
virtual CKSTRING GetDescription() = 0;
virtual BMLVersion GetBMLVersion() = 0;
virtual void OnLoad() {};
virtual void OnUnload() {};
virtual void OnModifyConfig(CKSTRING category, CKSTRING key, IProperty* prop) {};
virtual void OnLoadObject(CKSTRING filename, BOOL isMap, CKSTRING masterName,
CK_CLASSID filterClass, BOOL addtoscene, BOOL reuseMeshes, BOOL reuseMaterials,
BOOL dynamic, XObjectArray* objArray, CKObject* masterObj) {};
virtual void OnLoadScript(CKSTRING filename, CKBehavior* script) {};
virtual void OnProcess() {};
virtual void OnRender(CK_RENDER_FLAGS flags) {};
virtual void OnCheatEnabled(bool enable) {};
virtual void OnPhysicalize(CK3dEntity* target, CKBOOL fixed, float friction, float elasticity, float mass,
CKSTRING collGroup, CKBOOL startFrozen, CKBOOL enableColl, CKBOOL calcMassCenter, float linearDamp,
float rotDamp, CKSTRING collSurface, VxVector massCenter, int convexCnt, CKMesh** convexMesh,
int ballCnt, VxVector* ballCenter, float* ballRadius, int concaveCnt, CKMesh** concaveMesh) {};
virtual void OnUnphysicalize(CK3dEntity* target) {};
protected:
virtual ILogger* GetLogger() final;
virtual IConfig* GetConfig() final;
IBML* m_bml;
private:
ILogger* m_logger = nullptr;
IConfig* m_config = nullptr;
};