Skip to content

Commit

Permalink
Integrate Overclock
Browse files Browse the repository at this point in the history
  • Loading branch information
doyaGu committed Jun 16, 2024
1 parent fd48d40 commit c0dfc4b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/BMLMod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ void BMLMod::OnModifyConfig(const char *category, const char *key, IProperty *pr
int ref = 0;
mat->SetAlphaRef(ref);
}
} else if (prop == m_Overclock) {
for (int i = 0; i < 3; i++)
m_OverclockLinks[i]->SetOutBehaviorIO(m_OverclockLinkIO[i][m_Overclock->GetBoolean()]);
}
}

Expand Down Expand Up @@ -532,6 +535,10 @@ void BMLMod::InitConfigs() {
" Must be in the range of 1~13; 0 to randomly select one between 2 and 11");
m_CustomMapNumber->SetDefaultInteger(0);

m_Overclock = GetConfig()->GetProperty("Misc", "Overclock");
m_Overclock->SetComment("Remove delay of spawn / respawn");
m_Overclock->SetDefaultBoolean(false);

GetConfig()->SetCategoryComment("GUI", "Settings for the GUI created by BML");

m_FontFilename = GetConfig()->GetProperty("GUI", "FontFilename");
Expand Down Expand Up @@ -998,6 +1005,18 @@ void BMLMod::OnEditScript_Gameplay_Ingame(CKBehavior *script) {
}), 0, 0);

m_CurLevel = m_BML->GetArrayByName("CurrentLevel");

CKBehavior *ballMgr = FindFirstBB(script, "BallManager");
CKBehavior *deactBall = FindFirstBB(ballMgr, "Deactivate Ball");
CKBehavior *pieces = FindFirstBB(deactBall, "reset Ballpieces");
m_OverclockLinks[0] = FindNextLink(deactBall, pieces);
CKBehavior *unphy = FindNextBB(deactBall, FindNextBB(deactBall, m_OverclockLinks[0]->GetOutBehaviorIO()->GetOwner()));
m_OverclockLinkIO[0][1] = unphy->GetInput(1);

CKBehavior *newBall = FindFirstBB(ballMgr, "New Ball");
CKBehavior *physicsNewBall = FindFirstBB(newBall, "physicalize new Ball");
m_OverclockLinks[1] = FindPreviousLink(newBall, FindPreviousBB(newBall, FindPreviousBB(newBall, FindPreviousBB(newBall, physicsNewBall))));
m_OverclockLinkIO[1][1] = physicsNewBall->GetInput(0);
}

void BMLMod::OnEditScript_Gameplay_Energy(CKBehavior *script) {
Expand Down Expand Up @@ -1051,6 +1070,17 @@ void BMLMod::OnEditScript_Gameplay_Energy(CKBehavior *script) {
BML_GetModManager()->OnExtraPoint();
return CKBR_OK;
}));

CKBehavior *delay = FindFirstBB(script, "Delayer");
m_OverclockLinks[2] = FindPreviousLink(script, delay);
CKBehaviorLink *link = FindNextLink(script, delay);
m_OverclockLinkIO[2][1] = link->GetOutBehaviorIO();

for (int i = 0; i < 3; i++) {
m_OverclockLinkIO[i][0] = m_OverclockLinks[i]->GetOutBehaviorIO();
if (m_Overclock->GetBoolean())
m_OverclockLinks[i]->SetOutBehaviorIO(m_OverclockLinkIO[i][1]);
}
}

void BMLMod::OnEditScript_Gameplay_Events(CKBehavior *script) {
Expand Down
5 changes: 5 additions & 0 deletions src/BMLMod.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ class BMLMod : public IMod {
IProperty *m_FixLifeBall = nullptr;
IProperty* m_MsgDuration = nullptr;
IProperty* m_CustomMapNumber = nullptr;
IProperty *m_Overclock = nullptr;

IProperty *m_FontFilename = nullptr;
IProperty *m_FontSize = nullptr;
IProperty *m_FontGlyphRanges = nullptr;
Expand All @@ -197,6 +199,9 @@ class BMLMod : public IMod {
CKParameter *m_LevelRow = nullptr;
CKDataArray *m_CurLevel = nullptr;

CKBehaviorLink *m_OverclockLinks[3] = {};
CKBehaviorIO *m_OverclockLinkIO[3][2] = {};

char m_MapSearchBuf[65536] = {};
std::vector<size_t> m_MapSearchResult;
std::vector<MapInfo> m_Maps;
Expand Down

0 comments on commit c0dfc4b

Please sign in to comment.