-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
executable file
·71 lines (56 loc) · 2.18 KB
/
main.cpp
File metadata and controls
executable file
·71 lines (56 loc) · 2.18 KB
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
#pragma once
#include "../bml_includes.hpp"
extern "C" {
__declspec(dllexport) IMod* BMLEntry(IBML* bml);
}
class RotationIndicator : public IMod {
bool init = false;
CKDataArray *current_level_array{};
CK3dObject *indicator{};
CK3dObject* get_current_ball() {
return static_cast<CK3dObject*>(current_level_array->GetElementObject(0, 1));
}
public:
RotationIndicator(IBML* bml) : IMod(bml) {}
virtual iCKSTRING GetID() override { return "RotationIndicator"; }
virtual iCKSTRING GetVersion() override { return "0.0.1"; }
virtual iCKSTRING GetName() override { return "Rotation Indicator"; }
virtual iCKSTRING GetAuthor() override { return "BallanceBug"; }
virtual iCKSTRING GetDescription() override { return "Indicates your ball's rotation."; }
DECLARE_BML_VERSION;
void OnPostStartMenu() override {
if (init) return;
current_level_array = m_bml->GetArrayByName("CurrentLevel");
auto pm = m_bml->GetPathManager();
/*for (int i = 0; i < pm->GetCategoryCount(); ++i) {
XString name;
pm->GetCategoryName(i, name);
m_bml->SendIngameMessage(name.CStr());
}*/
XString data_path_index_name = "Data Paths";
int data_path_index = pm->GetCategoryIndex(data_path_index_name);
/*for (int i = 0; i < pm->GetPathCount(data_path_index); ++i) {
XString name;
pm->GetPathName(data_path_index, i, name);
m_bml->SendIngameMessage(name.CStr());
}*/
XString indicator_file("Rotation_Indicator.nmo");
pm->ResolveFileName(indicator_file, data_path_index);
//m_bml->SendIngameMessage(indicator_file.CStr());
ExecuteBB::ObjectLoad(indicator_file.CStr(), false);
indicator = static_cast<CK3dObject*>(m_bml->GetCKContext()->GetObjectByName("___Rotation_Indicator"));
init = true;
}
void OnProcess() override {
if (!m_bml->IsPlaying()) return;
auto current_ball = get_current_ball();
VxVector pos; VxQuaternion rot;
current_ball->GetPosition(&pos);
current_ball->GetQuaternion(&rot);
indicator->SetPosition(pos);
indicator->SetQuaternion(rot);
}
};
IMod* BMLEntry(IBML* bml) {
return new RotationIndicator(bml);
}