Skip to content

Commit

Permalink
beta 3
Browse files Browse the repository at this point in the history
  • Loading branch information
ZiLko committed Sep 29, 2024
1 parent b13c07b commit 3167f3e
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 36 deletions.
7 changes: 7 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# v2.0.0-beta.3

* Fixed rotation bug.
* Fixed crash on load macro if node ids wasnt installed.
* Fixed a few undisclosed bugs.
* Added Alt modifier to default keybinds.

# v2.0.0-beta.2

* A bunch of small changes that are not even worth putting here.
Expand Down
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"win": "2.206",
"android": "2.206"
},
"version": "v2.0.0-beta.2",
"version": "v2.0.0-beta.3",
"id": "zilko.xdbot",
"name": "xdBot",
"developer": "Zilko",
Expand Down
38 changes: 26 additions & 12 deletions src/gdr/gdr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ namespace gdr {
for (json const& frameFixJson : replayJson["frameFixes"]) {
FrameFix frameFix;

if (!frameFixJson.contains("frame")) break;
if (!frameFixJson.contains("frame")) continue;

frameFix.frame = frameFixJson["frame"];

Expand All @@ -189,14 +189,26 @@ namespace gdr {
frameFix.p2.rotate = false;

} else if (frameFixJson.contains("p1")) {
frameFix.p1.pos = ccp(frameFixJson["p1"]["x"], frameFixJson["p1"]["y"]);
frameFix.p1.rotation= frameFixJson["p1"]["r"];
if (frameFixJson["p1"].contains("x"))
frameFix.p1.pos.x = frameFixJson["p1"]["x"];

if (frameFixJson["p1"].contains("y"))
frameFix.p1.pos.y = frameFixJson["p1"]["y"];

if (frameFixJson["p1"].contains("r"))
frameFix.p1.rotation = frameFixJson["p1"]["r"];

if (frameFixJson.contains("p2")) {
frameFix.p2.pos = ccp(frameFixJson["p2"]["x"], frameFixJson["p2"]["y"]);
frameFix.p2.rotation= frameFixJson["p2"]["r"];
if (frameFixJson["p2"].contains("x"))
frameFix.p2.pos.x = frameFixJson["p2"]["x"];

if (frameFixJson["p2"].contains("y"))
frameFix.p2.pos.y = frameFixJson["p2"]["y"];

if (frameFixJson["p2"].contains("r"))
frameFix.p2.rotation= frameFixJson["p2"]["r"];
}
} else break;
} else continue;

replay.frameFixes.push_back(frameFix);
}
Expand Down Expand Up @@ -236,13 +248,15 @@ namespace gdr {
json p1Json;
json p2Json;

p1Json["x"] = frameFix.p1.pos.x;
p1Json["y"] = frameFix.p1.pos.y;
p1Json["r"] = frameFix.p1.rotation;
if (frameFix.p1.pos.x != 0.f) p1Json["x"] = frameFix.p1.pos.x;
if (frameFix.p1.pos.y != 0.f) p1Json["y"] = frameFix.p1.pos.y;
if (frameFix.p1.rotation != 0.f) p1Json["r"] = frameFix.p1.rotation;

if (frameFix.p2.pos.x != 0.f) p2Json["x"] = frameFix.p2.pos.x;
if (frameFix.p2.pos.y != 0.f) p2Json["y"] = frameFix.p2.pos.x;
if (frameFix.p2.rotation != 0.f) p2Json["r"] = frameFix.p2.rotation;

p2Json["x"] = frameFix.p2.pos.x;
p2Json["y"] = frameFix.p2.pos.y;
p2Json["r"] = frameFix.p2.rotation;
if (p1Json.empty() && p2Json.empty()) continue;

frameFixJson["frame"] = frameFix.frame;
frameFixJson["p1"] = p1Json;
Expand Down
2 changes: 1 addition & 1 deletion src/hacks/other.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class $modify(EndLevelLayer) {
lbl->setScale(0.55f);
lbl->setAnchorPoint({ 0, 0.5 });

this->getChildByID("main-layer")->addChild(lbl);
getChildOfType<CCLayer>(this, 0)->addChild(lbl);

}

Expand Down
14 changes: 7 additions & 7 deletions src/keybinds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void onKeybind(bool down, ActionID id) {
"toggle_recording"_spr,
"Record macro",
"Toggles recording.",
{ Keybind::create(KEY_G) },
{ Keybind::create(KEY_G, Modifier::Alt) },
"xdBot",
false
});
Expand All @@ -185,7 +185,7 @@ void onKeybind(bool down, ActionID id) {
"toggle_playing"_spr,
"Play macro",
"Toggles playing.",
{ Keybind::create(KEY_H) },
{ Keybind::create(KEY_H, Modifier::Alt) },
"xdBot",
false
});
Expand All @@ -194,7 +194,7 @@ void onKeybind(bool down, ActionID id) {
"toggle_speedhack"_spr,
"Speedhack",
"Toggles speedhack.",
{ Keybind::create(KEY_S) },
{ Keybind::create(KEY_S, Modifier::Alt) },
"xdBot",
false
});
Expand All @@ -203,7 +203,7 @@ void onKeybind(bool down, ActionID id) {
"toggle_noclip"_spr,
"NoClip",
"Toggles NoClip.",
{ Keybind::create(KEY_N) },
{ Keybind::create(KEY_N, Modifier::Alt) },
"xdBot",
false
});
Expand All @@ -212,7 +212,7 @@ void onKeybind(bool down, ActionID id) {
"toggle_frame_stepper"_spr,
"Toggle Frame Stepper",
"Toggles frame stepper..",
{ Keybind::create(KEY_C) },
{ Keybind::create(KEY_C, Modifier::Alt) },
"xdBot",
false
});
Expand All @@ -221,7 +221,7 @@ void onKeybind(bool down, ActionID id) {
"step_frame"_spr,
"Advance frame",
"Advances one frame if frame stepper is on.",
{ Keybind::create(KEY_V), Keybind::create(KEY_C, Modifier::Alt) },
{ Keybind::create(KEY_V) },
"xdBot"
});

Expand All @@ -231,7 +231,7 @@ void onKeybind(bool down, ActionID id) {
"show_trajectory"_spr,
"Show Trajectory",
"Toggles Show Trajectory.",
{ Keybind::create(KEY_T) },
{ Keybind::create(KEY_T, Modifier::Alt) },
"xdBot"
});

Expand Down
2 changes: 1 addition & 1 deletion src/macro.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct input : gdr::Input {

struct Macro : gdr::Replay<Macro, input> {

Macro() : Replay("xdBot", "v2.0.0-beta.2") {}
Macro() : Replay("xdBot", "v2.0.0-beta.3") {}

public:

Expand Down
15 changes: 8 additions & 7 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,17 +394,18 @@ class $modify(BGLHook, GJBaseGameLayer) {
cocos2d::CCPoint pos1 = p1->getPosition();
cocos2d::CCPoint pos2 = p2->getPosition();

// if (DIF(pos1.x, fix.p1.pos.x) || DIF(pos1.y, fix.p1.pos.y)) {
if (fix.p1.pos.x != 0.f && fix.p1.pos.y != 0.f)
p1->setPosition(fix.p1.pos);

if (fix.p1.rotate)
p1->setRotation(fix.p1.rotation);
// }
if (fix.p1.rotate && fix.p1.rotation != 0.f)
p1->setRotation(fix.p1.rotation);

if (m_gameState.m_isDualMode) {

if (m_gameState.m_isDualMode/* && pos2.y != 0.f && (DIF(pos2.x, fix.p2.pos.x) || DIF(pos2.y, fix.p2.pos.y))*/) {
p2->setPosition(fix.p2.pos);
if (fix.p2.pos.x != 0.f && fix.p2.pos.y != 0.f)
p2->setPosition(fix.p2.pos);

if (fix.p2.rotate)
if (fix.p2.rotate && fix.p2.rotation != 0.f)
p2->setRotation(fix.p2.rotation);
}

Expand Down
2 changes: 1 addition & 1 deletion src/renderer/renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ void Renderer::handleRecording(PlayLayer* pl, int frame) {
}

void Renderer::startAudio(PlayLayer* pl) {
bool endLevelLayer = pl->getChildByID("EndLevelLayer") != nullptr;
bool endLevelLayer = getChildOfType<EndLevelLayer>(pl, 0) != nullptr;
if (dontRecordAudio) return;

if (pl->m_levelEndAnimationStarted && endLevelLayer) {
Expand Down
10 changes: 5 additions & 5 deletions src/ui/load_macro_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void LoadMacroLayer::reloadList(int amount) {
lbl->removeFromParentAndCleanup(true);

CCNode* listLayer = m_mainLayer->getChildByID("list-layer");
ListView* listView = static_cast<ListView*>(listLayer->getChildByID("list-view"));
ListView* listView = getChildOfType<ListView>(listLayer, 0);

CCLayer* contentLayer = nullptr;
contentLayer = typeinfo_cast<CCLayer*>(listView->m_tableView->getChildren()->objectAtIndex(0));
Expand Down Expand Up @@ -467,10 +467,10 @@ void LoadMacroLayer::addList(bool refresh, float prevScroll) {

listLayer->setUserObject("dont-correct-borders", cocos2d::CCBool::create(true));

CCSprite* topBorder = static_cast<CCSprite*>(listLayer->getChildByID("top-border"));
CCSprite* bottomBorder = static_cast<CCSprite*>(listLayer->getChildByID("bottom-border"));
CCSprite* rightBorder = static_cast<CCSprite*>(listLayer->getChildByID("right-border"));
CCSprite* leftBorder = static_cast<CCSprite*>(listLayer->getChildByID("left-border"));
CCSprite* topBorder = getChildOfType<CCSprite>(listLayer, 1);
CCSprite* bottomBorder = getChildOfType<CCSprite>(listLayer, 0);
CCSprite* rightBorder = getChildOfType<CCSprite>(listLayer, 3);
CCSprite* leftBorder = getChildOfType<CCSprite>(listLayer, 2);

if (color != ccc3(51, 68, 153)) {
CCSprite* topSprite = CCSprite::create("GJ_commentTop2_001_White.png"_spr);
Expand Down
2 changes: 1 addition & 1 deletion src/ui/record_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ bool RecordLayer::setup() {
CCSprite* spriteOn = CCSprite::createWithSpriteFrameName("GJ_checkOn_001.png");
CCSprite* spriteOff = CCSprite::createWithSpriteFrameName("GJ_checkOff_001.png");

CCLabelBMFont* versionLabel = CCLabelBMFont::create("xdBot v2.0.0-beta.2", "chatFont.fnt");
CCLabelBMFont* versionLabel = CCLabelBMFont::create("xdBot v2.0.0-beta.3", "chatFont.fnt");
versionLabel->setOpacity(63);
versionLabel->setPosition(ccp(-217, -125));
versionLabel->setAnchorPoint({ 0, 0.5 });
Expand Down

0 comments on commit 3167f3e

Please sign in to comment.