diff --git a/src/GUI/gui.cpp b/src/GUI/gui.cpp index 323c2b3..2c8b502 100644 --- a/src/GUI/gui.cpp +++ b/src/GUI/gui.cpp @@ -1513,6 +1513,8 @@ static int selected_playback = 0; // Index of "Both" option (auto selected) static int selected_autoclicker_player = 2; // Index of "Both" option (auto selected) static int selected_inverse_click = 0; // Index of "Both" option (auto selected) +static int selected_hitbox_color = 0; + std::map> options = { {"TASBot", std::make_shared()}, {"Mega Hack Replay JSON", std::make_shared()}, @@ -1798,6 +1800,75 @@ void GUI::tools() { } CHECK_KEYBIND("noEsc"); + bool open_layout_modal = true; + + if (ImGui::Button("Layout Mode Settings###layout_settings", ImVec2(ImGui::GetContentRegionMax().x * 0.5, 0))) { + ImGui::OpenPopup("Layout Settings###layoutsettings2"); + } + + if (ImGui::BeginPopupModal("Layout Settings###layoutsettings2", &open_layout_modal, ImGuiWindowFlags_AlwaysAutoResize)) { + + ImGui::Checkbox("Layout Mode", &logic.hacks.layoutMode); + ImGui::ColorEdit3("Background Color", logic.hacks.backgroundColor, ImGuiColorEditFlags_NoInputs); + ImGui::ColorEdit3("Block Color", logic.hacks.blocksColor, ImGuiColorEditFlags_NoInputs); + ImGui::EndPopup(); + } + + ImGui::SameLine(); + + bool open_hitbox_modal = true; + if (ImGui::Button("Hitbox Settings###notboxsettings", ImVec2(ImGui::GetContentRegionAvail().x, 0))) { + ImGui::OpenPopup("Hitbox Settings###boxsettings"); + } + + if (ImGui::BeginPopupModal("Hitbox Settings###boxsettings", &open_hitbox_modal, ImGuiWindowFlags_AlwaysAutoResize)) { + + ImGui::Checkbox("Show Hitboxes", &logic.hacks.showHitboxes); ImGui::SameLine(); + ImGui::Checkbox("Show Modifiers", &logic.hacks.showDecorations); + ImGui::Checkbox("Hitbox Trail", &logic.hacks.hitboxTrail); ImGui::SameLine(); + ImGui::Checkbox("Fill Hitboxes", &logic.hacks.fillHitboxes); + ImGui::PushItemWidth(200); + ImGui::InputFloat("Hitbox Thickness", &logic.hacks.hitboxThickness); + ImGui::InputFloat("Trail Length", &logic.hacks.hitboxTrailLength); + + const char* colors[] = { "Solids", "Slopes", "Hazards", "Portals", "Pads", "Rings", "Collectibles", "Modifiers", "Rotated Hitbox", "Center Hitbox", "Player" }; + + if (ImGui::BeginCombo("##dropdown_hitbox_color", colors[selected_hitbox_color])) + { + for (int i = 0; i < IM_ARRAYSIZE(colors); i++) + { + const bool isSelected = (selected_hitbox_color == i); + if (ImGui::Selectable(colors[i], isSelected)) + selected_hitbox_color = i; + + if (isSelected) { + ImGui::SetItemDefaultFocus(); + } + } + ImGui::EndCombo(); + } ImGui::PopItemWidth(); + + ImGui::SameLine(); + + switch (selected_hitbox_color) + { + case 0: ImGui::ColorEdit4("###color1", logic.hacks.solidHitboxColor, ImGuiColorEditFlags_NoInputs); break; + case 1: ImGui::ColorEdit4("###color2", logic.hacks.slopeHitboxColor, ImGuiColorEditFlags_NoInputs); break; + case 2: ImGui::ColorEdit4("###color3", logic.hacks.hazardHitboxColor, ImGuiColorEditFlags_NoInputs); break; + case 3: ImGui::ColorEdit4("###color4", logic.hacks.portalHitboxColor, ImGuiColorEditFlags_NoInputs); break; + case 4: ImGui::ColorEdit4("###color5", logic.hacks.padHitboxColor, ImGuiColorEditFlags_NoInputs); break; + case 5: ImGui::ColorEdit4("###color6", logic.hacks.ringHitboxColor, ImGuiColorEditFlags_NoInputs); break; + case 6: ImGui::ColorEdit4("###color7", logic.hacks.collectibleHitboxColor, ImGuiColorEditFlags_NoInputs); break; + case 7: ImGui::ColorEdit4("###color8", logic.hacks.modifierHitboxColor, ImGuiColorEditFlags_NoInputs); break; + case 8: ImGui::ColorEdit4("###color9", logic.hacks.rotatedHitboxColor, ImGuiColorEditFlags_NoInputs); break; + case 9: ImGui::ColorEdit4("###color10", logic.hacks.centerHitboxColor, ImGuiColorEditFlags_NoInputs); break; + case 10: ImGui::ColorEdit4("###color11", logic.hacks.playerHitboxColor, ImGuiColorEditFlags_NoInputs); break; + default: break; + } + + ImGui::EndPopup(); + } + ImGui::Separator(); ImGui::Checkbox("Enable Autoclicker", &logic.autoclicker); @@ -2555,42 +2626,6 @@ void GUI::main() { ImGui::Text("Macro Size: %i", logic.get_inputs().size()); - ImGui::Checkbox("Layout Mode", &logic.hacks.layoutMode); ImGui::SameLine(); - ImGui::Checkbox("Show Hitboxes", &logic.hacks.showHitboxes); - - bool open_hitbox_modal = true; - if (ImGui::Button("Hitbox Settings###notboxsettings")) { - ImGui::OpenPopup("Hitbox Settings###boxsettings"); - } - - if (ImGui::BeginPopupModal("Hitbox Settings###boxsettings", &open_hitbox_modal, ImGuiWindowFlags_AlwaysAutoResize)) { - - ImGui::Checkbox("Show Trajectory", &logic.hacks.trajectory); - ImGui::InputInt("Trajectory Accuracy", &logic.hacks.trajectoryAccuracy); - - ImGui::Checkbox("Show Hitboxes", &logic.hacks.showHitboxes); - ImGui::InputFloat("Hitbox Thickness", &logic.hacks.hitboxThickness); - ImGui::Checkbox("Show Modifiers", &logic.hacks.showDecorations); - ImGui::Checkbox("Hitbox Trail", &logic.hacks.hitboxTrail); - ImGui::InputFloat("Trail Length", &logic.hacks.hitboxTrailLength); - ImGui::InputInt("Hitbox Opacity", &logic.hacks.hitboxOpacity); - ImGui::InputInt("Hitbox Border Opacity", &logic.hacks.borderOpacity); - - ImGui::Text("Color Settings"); - ImGui::ColorEdit3("Solids", logic.hacks.solidHitboxColor, ImGuiColorEditFlags_NoInputs); - ImGui::ColorEdit3("Slopes", logic.hacks.slopeHitboxColor, ImGuiColorEditFlags_NoInputs); - ImGui::ColorEdit3("Hazards", logic.hacks.hazardHitboxColor, ImGuiColorEditFlags_NoInputs); - ImGui::ColorEdit3("Portals", logic.hacks.portalHitboxColor, ImGuiColorEditFlags_NoInputs); - ImGui::ColorEdit3("Pads", logic.hacks.padHitboxColor, ImGuiColorEditFlags_NoInputs); - ImGui::ColorEdit3("Rings", logic.hacks.ringHitboxColor, ImGuiColorEditFlags_NoInputs); - ImGui::ColorEdit3("Collectibles", logic.hacks.collectibleHitboxColor, ImGuiColorEditFlags_NoInputs); - ImGui::ColorEdit3("Modifiers", logic.hacks.modifierHitboxColor, ImGuiColorEditFlags_NoInputs); - ImGui::ColorEdit3("Rotated Hitbox", logic.hacks.rotatedHitboxColor, ImGuiColorEditFlags_NoInputs); - ImGui::ColorEdit3("Center Hitbox", logic.hacks.centerHitboxColor, ImGuiColorEditFlags_NoInputs); - ImGui::ColorEdit3("Player", logic.hacks.playerHitboxColor, ImGuiColorEditFlags_NoInputs); - ImGui::EndPopup(); - } - ImGui::PushItemFlag(ImGuiItemFlags_NoTabStop, true); ImGui::SetNextItemWidth(150); if (ImGui::DragFloat("###fps", &input_fps, 0.1, 1.f)) diff --git a/src/Hack/hitboxnode.cpp b/src/Hack/hitboxnode.cpp index 6930950..39711f5 100644 --- a/src/Hack/hitboxnode.cpp +++ b/src/Hack/hitboxnode.cpp @@ -28,12 +28,13 @@ HitboxNode* HitboxNode::getInstance() void HitboxNode::drawPolygonHitbox(std::vector const& points, cocos2d::ccColor4B col) { - col.a = hacks.borderOpacity; - auto color1 = ccc4FFromccc4B(col); - auto colorA = (ccc4(col.r, col.g, col.b, hacks.hitboxOpacity)); + auto prev_a = col.a; + auto borderColor = ccc4FFromccc4B(col); + col.a = max(0, col.a - 150); + auto fillColor = (ccc4(col.r, col.g, col.b, Logic::get().hacks.fillHitboxes ? col.a : 0)); - this->drawPolygon(const_cast(points.data()), points.size(), ccc4FFromccc4B(colorA), - hacks.hitboxThickness, color1); + this->drawPolygon(const_cast(points.data()), points.size(), ccc4FFromccc4B(fillColor), + hacks.hitboxThickness, borderColor); } void HitboxNode::drawRectangleHitbox(cocos2d::CCRect const& rect, cocos2d::ccColor4B col) @@ -91,11 +92,11 @@ void HitboxNode::addToPlayer2Queue(CCRect const& rect) void HitboxNode::drawForPlayer1(gd::PlayerObject* obj) { const ccColor4B playersolid = { (GLubyte)(Logic::get().hacks.playerHitboxColor[0] * 255.f), (GLubyte)(Logic::get().hacks.playerHitboxColor[1] * 255.f), - (GLubyte)(Logic::get().hacks.playerHitboxColor[2] * 255.f) }; - const ccColor4B playerrotated = { (GLubyte)(Logic::get().hacks.rotatedHitboxColor[0] * 255.f), (GLubyte)(Logic::get().hacks.rotatedHitboxColor[1] * 255.f), - (GLubyte)(Logic::get().hacks.rotatedHitboxColor[2] * 255.f) }; - const ccColor4B playercenter = { (GLubyte)(Logic::get().hacks.centerHitboxColor[0] * 255.f), (GLubyte)(Logic::get().hacks.centerHitboxColor[1] * 255.f), - (GLubyte)(Logic::get().hacks.centerHitboxColor[2] * 255.f) }; + (GLubyte)(Logic::get().hacks.playerHitboxColor[2] * 255.f), (GLubyte)(Logic::get().hacks.playerHitboxColor[3] * 255.f) }; + const ccColor4B playerrotated = { (GLubyte)(hacks.rotatedHitboxColor[0] * 255.f), (GLubyte)(Logic::get().hacks.rotatedHitboxColor[1] * 255.f), + (GLubyte)(Logic::get().hacks.rotatedHitboxColor[2] * 255.f), (GLubyte)(Logic::get().hacks.rotatedHitboxColor[3] * 255.f) }; + const ccColor4B playercenter = { (GLubyte)(hacks.centerHitboxColor[0] * 255.f), (GLubyte)(Logic::get().hacks.centerHitboxColor[1] * 255.f), + (GLubyte)(Logic::get().hacks.centerHitboxColor[2] * 255.f), (GLubyte)(Logic::get().hacks.centerHitboxColor[3] * 255.f) }; if (boo1.size() <= 0) this->drawRectangleHitbox(obj->getObjectRect(), playersolid); else @@ -119,11 +120,11 @@ void HitboxNode::drawForPlayer1(gd::PlayerObject* obj) void HitboxNode::drawForPlayer2(gd::PlayerObject* obj) { const ccColor4B playersolid = { (GLubyte)(Logic::get().hacks.playerHitboxColor[0] * 255.f), (GLubyte)(Logic::get().hacks.playerHitboxColor[1] * 255.f), - (GLubyte)(Logic::get().hacks.playerHitboxColor[2] * 255.f) }; + (GLubyte)(Logic::get().hacks.playerHitboxColor[2] * 255.f), (GLubyte)(Logic::get().hacks.playerHitboxColor[3] * 255.f) }; const ccColor4B playerrotated = { (GLubyte)(hacks.rotatedHitboxColor[0] * 255.f), (GLubyte)(Logic::get().hacks.rotatedHitboxColor[1] * 255.f), - (GLubyte)(Logic::get().hacks.rotatedHitboxColor[2] * 255.f) }; + (GLubyte)(Logic::get().hacks.rotatedHitboxColor[2] * 255.f), (GLubyte)(Logic::get().hacks.rotatedHitboxColor[3] * 255.f) }; const ccColor4B playercenter = { (GLubyte)(hacks.centerHitboxColor[0] * 255.f), (GLubyte)(Logic::get().hacks.centerHitboxColor[1] * 255.f), - (GLubyte)(Logic::get().hacks.centerHitboxColor[2] * 255.f) }; + (GLubyte)(Logic::get().hacks.centerHitboxColor[2] * 255.f), (GLubyte)(Logic::get().hacks.centerHitboxColor[3] * 255.f) }; if (boo2.size() <= 0) this->drawRectangleHitbox(obj->getObjectRect(), playersolid); else @@ -224,15 +225,17 @@ void HitboxNode::drawForObject(gd::GameObject* obj) { case gd::GameObjectType::kGameObjectTypeSolid: color = { (GLubyte)(hacks.solidHitboxColor[0] * 255.f), (GLubyte)(hacks.solidHitboxColor[1] * 255.f), - (GLubyte)(hacks.solidHitboxColor[2] * 255.f) }; + (GLubyte)(hacks.solidHitboxColor[2] * 255.f), (GLubyte)(hacks.solidHitboxColor[3] * 255.f) }; break; case gd::GameObjectType::kGameObjectTypeDecoration: if (hacks.showDecorations) - color = ccc4(127, 127, 255, 255); + color = { (GLubyte)(hacks.modifierHitboxColor[0] * 255.f), (GLubyte)(hacks.modifierHitboxColor[1] * 255.f), + (GLubyte)(hacks.modifierHitboxColor[2] * 255.f), (GLubyte)(hacks.modifierHitboxColor[3] * 255.f) }; switch (obj->m_nObjectID) { case 749: - color = ccc4(255, 127, 0, 255); + color = { (GLubyte)(hacks.modifierHitboxColor[0] * 255.f), (GLubyte)(hacks.modifierHitboxColor[1] * 255.f), + (GLubyte)(hacks.modifierHitboxColor[2] * 255.f), (GLubyte)(hacks.modifierHitboxColor[3] * 255.f) }; break; default: if (!hacks.showDecorations) @@ -255,61 +258,49 @@ void HitboxNode::drawForObject(gd::GameObject* obj) case gd::GameObjectType::kGameObjectTypeRobotPortal: case gd::GameObjectType::kGameObjectTypeSpiderPortal: case gd::GameObjectType::kGameObjectTypeTeleportPortal: - color = { (GLubyte)(hacks.portalHitboxColor[0] * 255.f), (GLubyte)(hacks.portalHitboxColor[1] * 255.f),(GLubyte)(hacks.portalHitboxColor[2] * 255.f) }; + color = { (GLubyte)(hacks.portalHitboxColor[0] * 255.f), (GLubyte)(hacks.portalHitboxColor[1] * 255.f),(GLubyte)(hacks.portalHitboxColor[2] * 255.f),(GLubyte)(hacks.portalHitboxColor[3] * 255.f) }; break; case gd::GameObjectType::kGameObjectTypeModifier: - switch (obj->m_nObjectID) - { - case 200: - case 201: - case 202: - case 203: - case 1334: + if (hacks.showDecorations) { color = { (GLubyte)(hacks.modifierHitboxColor[0] * 255.f), (GLubyte)(hacks.modifierHitboxColor[1] * 255.f), - (GLubyte)(hacks.modifierHitboxColor[2] * 255.f) }; - break; - default: - if (!hacks.showDecorations) - return; + (GLubyte)(hacks.modifierHitboxColor[2] * 255.f), (GLubyte)(hacks.modifierHitboxColor[3] * 255.f) }; } break; case gd::GameObjectType::kGameObjectTypeSlope: color = { (GLubyte)(hacks.slopeHitboxColor[0] * 255.f), (GLubyte)(hacks.slopeHitboxColor[1] * 255.f), - (GLubyte)(hacks.slopeHitboxColor[2] * 255.f) }; + (GLubyte)(hacks.slopeHitboxColor[2] * 255.f), (GLubyte)(hacks.slopeHitboxColor[3] * 255.f) }; this->drawPolygonHitbox(this->triangleForObject(obj), color); return; case gd::GameObjectType::kGameObjectTypeHazard: color = { (GLubyte)(hacks.hazardHitboxColor[0] * 255.f), (GLubyte)(hacks.hazardHitboxColor[1] * 255.f), - (GLubyte)(hacks.hazardHitboxColor[2] * 255.f) }; + (GLubyte)(hacks.hazardHitboxColor[2] * 255.f), (GLubyte)(hacks.hazardHitboxColor[3] * 255.f) }; break; case gd::GameObjectType::kGameObjectTypeYellowJumpPad: case gd::GameObjectType::kGameObjectTypePinkJumpPad: case gd::GameObjectType::kGameObjectTypeGravityPad: case gd::GameObjectType::kGameObjectTypeRedJumpPad: - case gd::GameObjectType::kGameObjectTypeYellowJumpRing: color = { (GLubyte)(hacks.padHitboxColor[0] * 255.f), (GLubyte)(hacks.padHitboxColor[1] * 255.f), - (GLubyte)(hacks.padHitboxColor[2] * 255.f) }; + (GLubyte)(hacks.padHitboxColor[2] * 255.f), (GLubyte)(hacks.padHitboxColor[3] * 255.f) }; break; case gd::GameObjectType::kGameObjectTypePinkJumpRing: + case gd::GameObjectType::kGameObjectTypeYellowJumpRing: + case gd::GameObjectType::kGameObjectTypeDropRing: case gd::GameObjectType::kGameObjectTypeGravityRing: case gd::GameObjectType::kGameObjectTypeRedJumpRing: case gd::GameObjectType::kGameObjectTypeGreenRing: case gd::GameObjectType::kGameObjectTypeDashRing: case gd::GameObjectType::kGameObjectTypeGravityDashRing: color = { (GLubyte)(hacks.ringHitboxColor[0] * 255.f), (GLubyte)(hacks.ringHitboxColor[1] * 255.f), - (GLubyte)(hacks.ringHitboxColor[2] * 255.f) }; + (GLubyte)(hacks.ringHitboxColor[2] * 255.f), (GLubyte)(hacks.ringHitboxColor[3] * 255.f) }; break; case gd::GameObjectType::kGameObjectTypeSecretCoin: case gd::GameObjectType::kGameObjectTypeUserCoin: case gd::GameObjectType::kGameObjectTypeCustomRing: case gd::GameObjectType::kGameObjectTypeCollectible: color = { (GLubyte)(hacks.collectibleHitboxColor[0] * 255.f), (GLubyte)(hacks.collectibleHitboxColor[1] * 255.f), - (GLubyte)(hacks.collectibleHitboxColor[2] * 255.f) }; - break; - case gd::GameObjectType::kGameObjectTypeDropRing: - color = ccc4(31, 31, 31, 255); + (GLubyte)(hacks.collectibleHitboxColor[2] * 255.f), (GLubyte)(hacks.collectibleHitboxColor[3] * 255.f) }; break; default: if (!hacks.showDecorations) @@ -364,20 +355,12 @@ void HitboxNode::drawObjectWithRotation(gd::GameObject* obj) { case gd::GameObjectType::kGameObjectTypeSolid: color = { (GLubyte)(hacks.solidHitboxColor[0] * 255.f), (GLubyte)(hacks.solidHitboxColor[1] * 255.f), - (GLubyte)(hacks.solidHitboxColor[2] * 255.f) }; + (GLubyte)(hacks.solidHitboxColor[2] * 255.f), (GLubyte)(hacks.solidHitboxColor[3] * 255.f) }; break; case gd::GameObjectType::kGameObjectTypeDecoration: if (hacks.showDecorations) - color = ccc4(127, 127, 255, 255); - switch (obj->m_nObjectID) - { - case 749: - color = ccc4(255, 127, 0, 255); - break; - default: - if (!hacks.showDecorations) - return; - } + color = { (GLubyte)(hacks.modifierHitboxColor[0] * 255.f), (GLubyte)(hacks.modifierHitboxColor[1] * 255.f), + (GLubyte)(hacks.modifierHitboxColor[2] * 255.f), (GLubyte)(hacks.modifierHitboxColor[3] * 255.f) }; break; case gd::GameObjectType::kGameObjectTypeInverseGravityPortal: case gd::GameObjectType::kGameObjectTypeInverseMirrorPortal: @@ -395,7 +378,7 @@ void HitboxNode::drawObjectWithRotation(gd::GameObject* obj) case gd::GameObjectType::kGameObjectTypeRobotPortal: case gd::GameObjectType::kGameObjectTypeSpiderPortal: case gd::GameObjectType::kGameObjectTypeTeleportPortal:color = { (GLubyte)(hacks.portalHitboxColor[0] * 255.f), (GLubyte)(hacks.portalHitboxColor[1] * 255.f), - (GLubyte)(hacks.portalHitboxColor[2] * 255.f) }; + (GLubyte)(hacks.portalHitboxColor[2] * 255.f), (GLubyte)(hacks.portalHitboxColor[3] * 255.f) }; break; case gd::GameObjectType::kGameObjectTypeModifier: @@ -407,7 +390,7 @@ void HitboxNode::drawObjectWithRotation(gd::GameObject* obj) case 203: case 1334: color = { (GLubyte)(hacks.modifierHitboxColor[0] * 255.f), (GLubyte)(hacks.modifierHitboxColor[1] * 255.f), - (GLubyte)(hacks.modifierHitboxColor[2] * 255.f) }; + (GLubyte)(hacks.modifierHitboxColor[2] * 255.f), (GLubyte)(hacks.modifierHitboxColor[3] * 255.f) }; break; default: if (!hacks.showDecorations) @@ -416,41 +399,39 @@ void HitboxNode::drawObjectWithRotation(gd::GameObject* obj) break; case gd::GameObjectType::kGameObjectTypeSlope: color = { (GLubyte)(hacks.slopeHitboxColor[0] * 255.f), (GLubyte)(hacks.slopeHitboxColor[1] * 255.f), - (GLubyte)(hacks.slopeHitboxColor[2] * 255.f) }; + (GLubyte)(hacks.slopeHitboxColor[2] * 255.f), (GLubyte)(hacks.slopeHitboxColor[3] * 255.f) }; this->drawPolygonHitbox(this->triangleForObject(obj), color); return; case gd::GameObjectType::kGameObjectTypeHazard: color = { (GLubyte)(hacks.hazardHitboxColor[0] * 255.f), (GLubyte)(hacks.hazardHitboxColor[1] * 255.f), - (GLubyte)(hacks.hazardHitboxColor[2] * 255.f) }; + (GLubyte)(hacks.hazardHitboxColor[2] * 255.f), (GLubyte)(hacks.hazardHitboxColor[3] * 255.f) }; break; case gd::GameObjectType::kGameObjectTypeYellowJumpPad: case gd::GameObjectType::kGameObjectTypePinkJumpPad: case gd::GameObjectType::kGameObjectTypeGravityPad: case gd::GameObjectType::kGameObjectTypeRedJumpPad: - case gd::GameObjectType::kGameObjectTypeYellowJumpRing: color = { (GLubyte)(hacks.padHitboxColor[0] * 255.f), (GLubyte)(hacks.padHitboxColor[1] * 255.f), - (GLubyte)(hacks.padHitboxColor[2] * 255.f) }; + (GLubyte)(hacks.padHitboxColor[2] * 255.f), (GLubyte)(hacks.padHitboxColor[3] * 255.f) }; break; case gd::GameObjectType::kGameObjectTypePinkJumpRing: + case gd::GameObjectType::kGameObjectTypeYellowJumpRing: case gd::GameObjectType::kGameObjectTypeGravityRing: case gd::GameObjectType::kGameObjectTypeRedJumpRing: case gd::GameObjectType::kGameObjectTypeGreenRing: case gd::GameObjectType::kGameObjectTypeDashRing: case gd::GameObjectType::kGameObjectTypeGravityDashRing: + case gd::GameObjectType::kGameObjectTypeDropRing: color = { (GLubyte)(hacks.ringHitboxColor[0] * 255.f), (GLubyte)(hacks.ringHitboxColor[1] * 255.f), - (GLubyte)(hacks.ringHitboxColor[2] * 255.f) }; + (GLubyte)(hacks.ringHitboxColor[2] * 255.f), (GLubyte)(hacks.ringHitboxColor[3] * 255.f) }; break; case gd::GameObjectType::kGameObjectTypeSecretCoin: case gd::GameObjectType::kGameObjectTypeUserCoin: case gd::GameObjectType::kGameObjectTypeCustomRing: case gd::GameObjectType::kGameObjectTypeCollectible: color = { (GLubyte)(hacks.collectibleHitboxColor[0] * 255.f), (GLubyte)(hacks.collectibleHitboxColor[1] * 255.f), - (GLubyte)(hacks.collectibleHitboxColor[2] * 255.f) }; - break; - case gd::GameObjectType::kGameObjectTypeDropRing: - color = ccc4(31, 31, 31, 255); + (GLubyte)(hacks.collectibleHitboxColor[2] * 255.f), (GLubyte)(hacks.collectibleHitboxColor[3] * 255.f) }; break; default: if (!hacks.showDecorations) diff --git a/src/Hooks/hooks.cpp b/src/Hooks/hooks.cpp index bcc44e2..47d848d 100644 --- a/src/Hooks/hooks.cpp +++ b/src/Hooks/hooks.cpp @@ -42,17 +42,20 @@ void Hooks::init_hooks() { HOOK(0x20D3C0, PlayLayer::pauseGame); + MH_CreateHook(reinterpret_cast(gd::base + 0x253D60), PlayLayer::triggerObject_h, + reinterpret_cast(&PlayLayer::triggerObject)); + MH_CreateHook(reinterpret_cast(gd::base + 0x1FFD80), PlayLayer::lightningFlash_h, + reinterpret_cast(&PlayLayer::lightningFlash)); + MH_CreateHook(reinterpret_cast(gd::base + 0xe5d60), powerOffObject_h, reinterpret_cast(&powerOffObject)); MH_CreateHook(reinterpret_cast(gd::base + 0xeab20), playShineEffect_h, reinterpret_cast(&playShineEffect)); MH_CreateHook(reinterpret_cast(gd::base + 0x1e9a20), incrementJumps_h, reinterpret_cast(&incrementJumps)); HOOK(0x10ed50, bumpPlayer); //MH_CreateHook(reinterpret_cast(gd::base + 0x1f62c0), toggleDartMode_h, reinterpret_cast(&toggleDartMode)); - MH_CreateHook(reinterpret_cast(gd::base + 0x14ebc0), addPoint_h, reinterpret_cast(&addPoint)); + /* MH_CreateHook(reinterpret_cast(gd::base + 0x14ebc0), addPoint_h, reinterpret_cast(&addPoint)); MH_CreateHook(reinterpret_cast(gd::base + 0xd1790), triggerObject_h, reinterpret_cast(&triggerObject)); MH_CreateHook(reinterpret_cast(gd::base + 0xEF110), hasBeenActivatedByPlayer_h, reinterpret_cast(&hasBeenActivatedByPlayer)); - MH_CreateHook(reinterpret_cast(gd::base + 0x20d810), PlayLayer::onQuit_h, reinterpret_cast(&PlayLayer::onQuit)); - MH_CreateHook(reinterpret_cast(gd::base + 0x207d30), PlayLayer::flipGravity_h, reinterpret_cast(&PlayLayer::flipGravity)); - MH_CreateHook(reinterpret_cast(gd::base + 0x207e00), PlayLayer::playGravityEffect_h, reinterpret_cast(&PlayLayer::playGravityEffect)); + MH_CreateHook(reinterpret_cast(gd::base + 0x20d810), PlayLayer::onQuit_h, reinterpret_cast(&PlayLayer::onQuit));*/ MH_CreateHook(reinterpret_cast(gd::base + 0x1E4570), PauseLayer::init_h, reinterpret_cast(&PauseLayer::init)); MH_CreateHook(reinterpret_cast(gd::base + 0x20D810), PlayLayer::exitLevel_h, reinterpret_cast(&PlayLayer::exitLevel)); @@ -409,12 +412,33 @@ void __fastcall Hooks::LevelEditorLayer::onPlaytestHook(gd::LevelEditorLayer* se LevelEditorLayer::onPlaytest(self); } +void __fastcall Hooks::PlayLayer::lightningFlash_h(gd::PlayLayer* self, void* edx, CCPoint p, _ccColor3B c) +{ + auto& logic = Logic::get(); + + if (!logic.hacks.layoutMode) + PlayLayer::lightningFlash(self, p, c); +} + void __fastcall Hooks::LevelEditorLayer::exitHook(CCLayer* self, void*, CCObject* sender) { LevelEditorLayer::exit(self, sender); HitboxNode::getInstance()->clearQueue(); } +void __fastcall Hooks::PlayLayer::triggerObject_h(gd::EffectGameObject* self, void*, gd::GJBaseGameLayer* idk) +{ + auto& logic = Logic::get(); + if (logic.hacks.trajectory && TrajectorySimulation::getInstance()->shouldInterrumpHooks()) + return; + auto id = self->m_nObjectID; + if (logic.hacks.layoutMode && (id == 899 || id == 1006 || id == 1007 || id == 105 || id == 29 || id == 56 || id == 915 || + id == 30 || id == 58)) + return; + PlayLayer::triggerObject(self, idk); +} + + void __fastcall Hooks::PlayLayer::update_h(gd::PlayLayer* self, int, float dt) { auto& logic = Logic::get(); @@ -665,11 +689,11 @@ void __fastcall Hooks::PlayLayer::update_h(gd::PlayLayer* self, int, float dt) { sprite->setColor(color); } - /*if (logic.hacks.blocksColor[0] != logic.hacks.backgroundColor[0] || logic.hacks.blocksColor[1] != logic.hacks.backgroundColor[1] || + if (logic.hacks.blocksColor[0] != logic.hacks.backgroundColor[0] || logic.hacks.blocksColor[1] != logic.hacks.backgroundColor[1] || logic.hacks.blocksColor[2] != logic.hacks.backgroundColor[2]) { changeBlockColor = true; - }*/ + } self->m_currentShakeStrength = 0; self->m_currentShakeInterval = 0; @@ -688,11 +712,12 @@ void __fastcall Hooks::PlayLayer::update_h(gd::PlayLayer* self, int, float dt) { auto o = static_cast(section->objectAtIndex(i)); auto block = static_cast(o); - ccColor3B blockColor = { (GLubyte)(255), - (GLubyte)(255), - (GLubyte)(255) }; + ccColor3B blockColor = { (GLubyte)(logic.hacks.blocksColor[0] * 255), + (GLubyte)(logic.hacks.blocksColor[1] * 255), + (GLubyte)(logic.hacks.blocksColor[2] * 255) }; block->setColor(blockColor); + if (o->getType() == gd::GameObjectType::kGameObjectTypeDecoration && (o->m_nObjectID != 44 && o->m_nObjectID != 749 && o->m_nObjectID != 12 && o->m_nObjectID != 38 && o->m_nObjectID != 47 && o->m_nObjectID != 111 && o->m_nObjectID != 8 && o->m_nObjectID != 13 && @@ -701,11 +726,6 @@ void __fastcall Hooks::PlayLayer::update_h(gd::PlayLayer* self, int, float dt) { { o->setVisible(false); } - else { - o->setOpacity(255); - o->setChildOpacity(255); - o->setVisible(true); - } } } } diff --git a/src/Hooks/hooks.hpp b/src/Hooks/hooks.hpp index 05b089a..c965fb5 100644 --- a/src/Hooks/hooks.hpp +++ b/src/Hooks/hooks.hpp @@ -61,6 +61,12 @@ namespace Hooks { namespace PlayLayer { + inline void(__thiscall* lightningFlash)(gd::PlayLayer* self, CCPoint p, _ccColor3B c); + void __fastcall lightningFlash_h(gd::PlayLayer* self, void* edx, CCPoint p, _ccColor3B c); + + inline void(__thiscall* triggerObject)(gd::EffectGameObject* self, gd::GJBaseGameLayer* idk); + void __fastcall triggerObject_h(gd::EffectGameObject* self, void*, gd::GJBaseGameLayer* idk); + _THISCALL_HOOK(pauseGame, void, gd::PlayLayer, bool) inline bool(__thiscall* init)(gd::PlayLayer*, gd::GJGameLevel* level); bool __fastcall init_h(gd::PlayLayer* self, void* edx, gd::GJGameLevel* level); diff --git a/src/Logic/logic.hpp b/src/Logic/logic.hpp index 09be9ff..38763b5 100644 --- a/src/Logic/logic.hpp +++ b/src/Logic/logic.hpp @@ -51,20 +51,21 @@ struct FPSFrame { struct HacksStr { - bool layoutMode = true; - bool showHitboxes = true, showDecorations = true; + bool layoutMode = false; + bool showHitboxes = false, showDecorations = true; float hitboxThickness = 0.4; int hitboxOpacity = 0, borderOpacity = 255; + bool fillHitboxes = false; - float backgroundColor[3] = { 40.f / 255.f, 125.f / 255.f, 1 }, blocksColor[3] = { 0, 102.f / 255.f, 1 }; + float backgroundColor[3] = { 40.f / 255.f, 125.f / 255.f, 1 }, blocksColor[3] = { 1, 1, 1 }; - bool hitboxTrail = true, trajectory = true; - float hitboxTrailLength = 0.f; + bool hitboxTrail = false, trajectory = false; + float hitboxTrailLength = 50.f; int trajectoryAccuracy = 100; - float solidHitboxColor[3] = { 0, 0, 1 }, slopeHitboxColor[3] = { 0, 0, 1 }, hazardHitboxColor[3] = { 1, 0, 0 }, portalHitboxColor[3] = { 1, 0.498f, 1 }, padHitboxColor[3] = { 0, 1, 1 }, - ringHitboxColor[3] = { 0, 1, 1 }, collectibleHitboxColor[3] = { 0.87f, 0.87f, 0.87f }, modifierHitboxColor[3] = { 1, 1, 1 }, playerHitboxColor[3] = { 1, 0.247f, 0.247f }, - rotatedHitboxColor[3] = { 0.498f, 0, 0 }, centerHitboxColor[3] = { 0, 1, 0 }; + float solidHitboxColor[4] = { 0, 0, 1, 1 }, slopeHitboxColor[4] = { 0, 0, 1, 1 }, hazardHitboxColor[4] = { 1, 0, 0, 1 }, portalHitboxColor[4] = { 0, 1, 0, 1 }, padHitboxColor[4] = { 0, 1, 0, 1 }, + ringHitboxColor[4] = { 0, 1, 0, 1 }, collectibleHitboxColor[4] = { 0.88f, 1, 0, 1 }, modifierHitboxColor[4] = { 1, 1, 1, 1 }, playerHitboxColor[4] = { 1, 0.247f, 0.247f, 1 }, + rotatedHitboxColor[4] = { 0.498f, 0, 0, 1 }, centerHitboxColor[4] = { 0, 0, 1, 1 }; }; struct ObjectData { diff --git a/src/main.cpp b/src/main.cpp index 76d8c4b..c25a793 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -96,6 +96,26 @@ void writeConfig() { j["max_cps"] = logic.max_cps; + j["layout_mode"] = logic.hacks.layoutMode; + j["show_hitboxes"] = logic.hacks.showHitboxes; + j["show_modifiers"] = logic.hacks.showDecorations; + j["hitbox_thickness"] = logic.hacks.hitboxThickness; + j["fill_hitboxes"] = logic.hacks.fillHitboxes; + j["backgroundColor"] = { logic.hacks.backgroundColor[0], logic.hacks.backgroundColor[1], logic.hacks.backgroundColor[2] }; + j["blocksColor"] = { logic.hacks.blocksColor[0], logic.hacks.blocksColor[1], logic.hacks.blocksColor[2] }; + + j["solidHitboxColor"] = { logic.hacks.solidHitboxColor[0], logic.hacks.solidHitboxColor[1], logic.hacks.solidHitboxColor[2], logic.hacks.solidHitboxColor[3] }; + j["slopeHitboxColor"] = { logic.hacks.slopeHitboxColor[0], logic.hacks.slopeHitboxColor[1], logic.hacks.slopeHitboxColor[2], logic.hacks.slopeHitboxColor[3] }; + j["hazardHitboxColor"] = { logic.hacks.hazardHitboxColor[0], logic.hacks.hazardHitboxColor[1], logic.hacks.hazardHitboxColor[2], logic.hacks.hazardHitboxColor[3] }; + j["portalHitboxColor"] = { logic.hacks.portalHitboxColor[0], logic.hacks.portalHitboxColor[1], logic.hacks.portalHitboxColor[2], logic.hacks.portalHitboxColor[3] }; + j["padHitboxColor"] = { logic.hacks.padHitboxColor[0], logic.hacks.padHitboxColor[1], logic.hacks.padHitboxColor[2], logic.hacks.padHitboxColor[3] }; + j["ringHitboxColor"] = { logic.hacks.ringHitboxColor[0], logic.hacks.ringHitboxColor[1], logic.hacks.ringHitboxColor[2], logic.hacks.ringHitboxColor[3] }; + j["collectibleHitboxColor"] = { logic.hacks.collectibleHitboxColor[0], logic.hacks.collectibleHitboxColor[1], logic.hacks.collectibleHitboxColor[2], logic.hacks.collectibleHitboxColor[3] }; + j["modifierHitboxColor"] = { logic.hacks.modifierHitboxColor[0], logic.hacks.modifierHitboxColor[1], logic.hacks.modifierHitboxColor[2], logic.hacks.modifierHitboxColor[3] }; + j["playerHitboxColor"] = { logic.hacks.playerHitboxColor[0], logic.hacks.playerHitboxColor[1], logic.hacks.playerHitboxColor[2], logic.hacks.playerHitboxColor[3] }; + j["rotatedHitboxColor"] = { logic.hacks.rotatedHitboxColor[0], logic.hacks.rotatedHitboxColor[1], logic.hacks.rotatedHitboxColor[2], logic.hacks.rotatedHitboxColor[3] }; + j["centerHitboxColor"] = { logic.hacks.centerHitboxColor[0], logic.hacks.centerHitboxColor[1], logic.hacks.centerHitboxColor[2], logic.hacks.centerHitboxColor[3] }; + auto& audiospeedhack = AudiopitchHack::getInstance(); j["audio_speedhack"] = audiospeedhack.isEnabled(); @@ -259,6 +279,104 @@ void readConfig() { recorder.color_fix = getOrDefault(j, "video_color_fix", true); logic.max_cps = getOrDefault(j, "max_cps", 15); + + logic.hacks.layoutMode = getOrDefault(j, "layout_mode", false); + logic.hacks.showHitboxes = getOrDefault(j, "show_hitboxes", false); + logic.hacks.showDecorations = getOrDefault(j, "show_modifiers", true); + logic.hacks.hitboxThickness = getOrDefault(j, "hitbox_thickness", logic.hacks.hitboxThickness); + logic.hacks.fillHitboxes = getOrDefault(j, "fill_hitboxes", logic.hacks.fillHitboxes); + + if (j.contains("backgroundColor")) { + auto colorArray = j["backgroundColor"]; + for (int i = 0; i < 3; ++i) { + logic.hacks.backgroundColor[i] = colorArray[i]; + } + } + + if (j.contains("blocksColor")) { + auto colorArray = j["blocksColor"]; + for (int i = 0; i < 3; ++i) { + logic.hacks.blocksColor[i] = colorArray[i]; + } + } + + if (j.contains("solidHitboxColor")) { + auto colorArray = j["solidHitboxColor"]; + for (int i = 0; i < 4; i++) { + logic.hacks.solidHitboxColor[i] = colorArray[i]; + } + } + + if (j.contains("slopeHitboxColor")) { + auto colorArray = j["slopeHitboxColor"]; + for (int i = 0; i < 4; ++i) { + logic.hacks.slopeHitboxColor[i] = colorArray[i]; + } + } + + if (j.contains("hazardHitboxColor")) { + auto colorArray = j["hazardHitboxColor"]; + for (int i = 0; i < 4; ++i) { + logic.hacks.hazardHitboxColor[i] = colorArray[i]; + } + } + + if (j.contains("portalHitboxColor")) { + auto colorArray = j["portalHitboxColor"]; + for (int i = 0; i < 4; ++i) { + logic.hacks.portalHitboxColor[i] = colorArray[i]; + } + } + + if (j.contains("padHitboxColor")) { + auto colorArray = j["padHitboxColor"]; + for (int i = 0; i < 4; ++i) { + logic.hacks.padHitboxColor[i] = colorArray[i]; + } + } + + if (j.contains("ringHitboxColor")) { + auto colorArray = j["ringHitboxColor"]; + for (int i = 0; i < 4; ++i) { + logic.hacks.ringHitboxColor[i] = colorArray[i]; + } + } + + if (j.contains("collectibleHitboxColor")) { + auto colorArray = j["collectibleHitboxColor"]; + for (int i = 0; i < 4; ++i) { + logic.hacks.collectibleHitboxColor[i] = colorArray[i]; + } + } + + if (j.contains("modifierHitboxColor")) { + auto colorArray = j["modifierHitboxColor"]; + for (int i = 0; i < 4; ++i) { + logic.hacks.modifierHitboxColor[i] = colorArray[i]; + } + } + + if (j.contains("playerHitboxColor")) { + auto colorArray = j["playerHitboxColor"]; + for (int i = 0; i < 4; ++i) { + logic.hacks.playerHitboxColor[i] = colorArray[i]; + } + } + + if (j.contains("rotatedHitboxColor")) { + auto colorArray = j["rotatedHitboxColor"]; + for (int i = 0; i < 4; ++i) { + logic.hacks.rotatedHitboxColor[i] = colorArray[i]; + } + } + + if (j.contains("centerHitboxColor")) { + auto colorArray = j["centerHitboxColor"]; + for (int i = 0; i < 4; ++i) { + logic.hacks.centerHitboxColor[i] = colorArray[i]; + } + } + auto& audiospeedhack = AudiopitchHack::getInstance();