Skip to content

Commit

Permalink
Merge pull request #65 from ByteCorum/WIP
Browse files Browse the repository at this point in the history
Added HitMarkers and bugfix
  • Loading branch information
ByteCorum authored Jun 7, 2024
2 parents 70dce5a + abcabab commit 9b8836c
Show file tree
Hide file tree
Showing 13 changed files with 162 additions and 111 deletions.
2 changes: 1 addition & 1 deletion DragonBurn/Cheats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ void AIM(CEntity LocalEntity, std::vector<Vec3> AimPosList)

void MiscFuncs(CEntity LocalEntity)
{
Misc::HitSound(LocalEntity, PreviousTotalHits);
Misc::HitManager(LocalEntity, PreviousTotalHits);
Misc::FastStop();
}

Expand Down
1 change: 0 additions & 1 deletion DragonBurn/DragonBurn.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@
<ClInclude Include="Entity.h" />
<ClInclude Include="Features\Legitbot.hpp" />
<ClInclude Include="Features\BombTimer.h" />
<ClInclude Include="Features\Debugger.h" />
<ClInclude Include="Features\ESP.h" />
<ClInclude Include="Features\GetWeaponIcon.h" />
<ClInclude Include="Features\GUI.h" />
Expand Down
1 change: 0 additions & 1 deletion DragonBurn/DragonBurn.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@
<ClInclude Include="Font\IconsFontAwesome6.h" />
<ClInclude Include="Features\Mouse.h" />
<ClInclude Include="Features\ESP.h" />
<ClInclude Include="Features\Debugger.h" />
<ClInclude Include="Features\SpectatorList.h" />
<ClInclude Include="Features\GUI.h" />
<ClInclude Include="Features\GetWeaponIcon.h" />
Expand Down
19 changes: 0 additions & 19 deletions DragonBurn/Features/Debugger.h

This file was deleted.

3 changes: 2 additions & 1 deletion DragonBurn/Features/GUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,7 @@ namespace GUI
ImGui::SameLine();
ImGui::SetNextItemWidth(155.f);
ImGui::Combo("###HitSounds", &MiscCFG::HitSound, "None\0Neverlose\0Skeet\0");
PutSwitch(Lang::MiscText.HitMerker, 10.f, ImGui::GetFrameHeight() * 1.7, &MiscCFG::HitMarker);
PutSwitch(Lang::MiscText.SpecCheck, 10.f, ImGui::GetFrameHeight() * 1.7, &MiscCFG::WorkInSpec);
// PutSwitch(Lang::MiscText.SpecList, 10.f, ImGui::GetFrameHeight() * 1.7, &MiscCFG::SpecList);
PutSwitch(Lang::MiscText.TeamCheck, 10.f, ImGui::GetFrameHeight() * 1.7, &MenuConfig::TeamCheck);
Expand All @@ -606,7 +607,7 @@ namespace GUI
if (ImGui::Button("Contact Author", { 125.f, 25.f }))
Gui.OpenWebpage("https://discordapp.com/users/798503509522645012/");
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetColumnWidth() / 4);
if (ImGui::Button("Safe Exit", { 125.f, 25.f }))
if (ImGui::Button("Unhook", { 125.f, 25.f }))
Init::Client::Exit();


Expand Down
48 changes: 33 additions & 15 deletions DragonBurn/Features/Misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ namespace Misc
bool dKeyPressed = false;
bool wKeyPressed = false;
bool sKeyPressed = false;
HitMarker hitMarker(0, std::chrono::steady_clock::now());
const float HitMarker::SIZE = 30.f;
const float HitMarker::GAP = 10.f;

void Watermark(const CEntity& LocalPlayer) noexcept
{
Expand Down Expand Up @@ -50,10 +53,27 @@ namespace Misc
ImGui::End();
}

void HitSound(const CEntity& aLocalPlayer, int& PreviousTotalHits) noexcept
void HitSound() noexcept
{
if (!MiscCFG::HitSound)
switch (MiscCFG::HitSound)
{
case 1:
PlaySoundA(reinterpret_cast<char*>(neverlose_sound), NULL, SND_ASYNC | SND_MEMORY);
break;
case 2:
PlaySoundA(reinterpret_cast<char*>(skeet_sound), NULL, SND_ASYNC | SND_MEMORY);
break;
default:
break;
}
}

void HitManager(const CEntity& aLocalPlayer, int& PreviousTotalHits) noexcept
{
if (!MiscCFG::HitSound && !MiscCFG::HitMarker)
{
return;
}

uintptr_t pBulletServices;
int totalHits;
Expand All @@ -63,29 +83,27 @@ namespace Misc
if (totalHits != PreviousTotalHits) {
if (totalHits == 0 && PreviousTotalHits != 0)
{
// `totalHits` changed from non-zero to zero, do not play hitsound
// `totalHits` changed from non-zero to zero, do nothing
}
else
{
// Play the HitSound
switch (MiscCFG::HitSound)
if (MiscCFG::HitSound)
{
HitSound();
}
if (MiscCFG::HitMarker)
{
case 1:
PlaySoundA(reinterpret_cast<char*>(neverlose_sound), NULL, SND_ASYNC | SND_MEMORY);
break;
case 2:
PlaySoundA(reinterpret_cast<char*>(skeet_sound), NULL, SND_ASYNC | SND_MEMORY);
break;
default:
break;
hitMarker = HitMarker(255.f, std::chrono::steady_clock::now());
hitMarker.Draw();
}

}
}

hitMarker.Update();
PreviousTotalHits = totalHits;
}

void FastStop() noexcept
void FastStop() noexcept// junk
{
if (!MiscCFG::FastStop)
return;
Expand Down
56 changes: 54 additions & 2 deletions DragonBurn/Features/Misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,59 @@ namespace Misc
return hasFlagDucking;
}

class HitMarker
{
public:
const static float SIZE;
const static float GAP;

HitMarker(float alpha, std::chrono::steady_clock::time_point startTime)
{
this->_alpha = alpha;
this->_startTime = startTime;
}

void Draw()
{
ImGuiIO& io = ImGui::GetIO();
ImVec2 center = ImVec2(Gui.Window.Size.x / 2, Gui.Window.Size.y / 2);

if (this->_alpha > 0.f)
{
ImColor col = ImColor(255.f, 255.f, 255.f, this->_alpha);

ImGui::GetBackgroundDrawList()->AddLine(ImVec2(center.x - SIZE, center.y - SIZE), ImVec2(center.x - GAP, center.y - GAP), col & IM_COL32_A_MASK, 2.4f);
ImGui::GetBackgroundDrawList()->AddLine(ImVec2(center.x - SIZE, center.y + SIZE), ImVec2(center.x - GAP, center.y + GAP), col & IM_COL32_A_MASK, 2.4f);
ImGui::GetBackgroundDrawList()->AddLine(ImVec2(center.x + SIZE, center.y - SIZE), ImVec2(center.x + GAP, center.y - GAP), col & IM_COL32_A_MASK, 2.4f);
ImGui::GetBackgroundDrawList()->AddLine(ImVec2(center.x + SIZE, center.y + SIZE), ImVec2(center.x + GAP, center.y + GAP), col & IM_COL32_A_MASK, 2.4f);
ImGui::GetBackgroundDrawList()->AddLine(ImVec2(center.x - SIZE, center.y - SIZE), ImVec2(center.x - GAP, center.y - GAP), col, 1.4f);
ImGui::GetBackgroundDrawList()->AddLine(ImVec2(center.x - SIZE, center.y + SIZE), ImVec2(center.x - GAP, center.y + GAP), col, 1.4f);
ImGui::GetBackgroundDrawList()->AddLine(ImVec2(center.x + SIZE, center.y - SIZE), ImVec2(center.x + GAP, center.y - GAP), col, 1.4f);
ImGui::GetBackgroundDrawList()->AddLine(ImVec2(center.x + SIZE, center.y + SIZE), ImVec2(center.x + GAP, center.y + GAP), col, 1.4f);
}
}

void Update()
{
if (this->_alpha > 0.f)
{
auto now = std::chrono::steady_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(now - this->_startTime).count();
if (duration >= 500.f)
this->_alpha = 0;
else
this->_alpha = 1.f - duration / 500.f;
Draw();
}
}

private:
float _alpha;
std::chrono::steady_clock::time_point _startTime;

};

void Watermark(const CEntity& aLocalPlayer) noexcept;
void HitSound(const CEntity& aLocalPlayer, int& PreviousTotalHits) noexcept;
void FastStop() noexcept;
void HitManager(const CEntity& aLocalPlayer, int& PreviousTotalHits) noexcept;
void FastStop() noexcept;// junk
}
2 changes: 1 addition & 1 deletion DragonBurn/Features/TriggerBot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ void TriggerBot::Run(const CEntity& LocalEntity)
DWORD64 ListEntry;
DWORD64 PawnAddress;

if (!ProcessMgr.ReadMemory<DWORD>(LocalEntity.Pawn.Address + Offset::Pawn.iIDEntIndex, uHandle) || uHandle == -1)// can have bug
if (!ProcessMgr.ReadMemory<DWORD>(LocalEntity.Pawn.Address + Offset::Pawn.iIDEntIndex, uHandle) || uHandle == -1)// https://github.com/ByteCorum/DragonBurn/issues/60
return;

ListEntry = ProcessMgr.TraceAddress(gGame.GetEntityListAddress(), { 0x8 * (uHandle >> 9) + 0x10, 0x0 });
Expand Down
6 changes: 1 addition & 5 deletions DragonBurn/MenuConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,6 @@ namespace ESPConfig
inline ImColor FilledColor2 = ImColor(0, 255, 102, 255);
}

namespace DebuggerConfig
{
inline bool Debug = false;
}

namespace CrosshairsCFG
{
inline float CrossHairSize = 75;
Expand Down Expand Up @@ -162,6 +157,7 @@ namespace MiscCFG
inline bool WorkInSpec = true;
inline bool WaterMark = false;
inline int HitSound = 0;
inline bool HitMarker = false;
inline bool bmbTimer = false;
inline bool FastStop = false;
//inline bool SpecList = false;
Expand Down
9 changes: 2 additions & 7 deletions DragonBurn/Resources/Language.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ namespace Lang
inline static const char* NoFlash;
inline static const char* FastStop;
inline static const char* HitSound;
inline static const char* HitMerker;
inline static const char* bmbTimer;
//inline static const char* SpecList;
inline static const char* Watermark;
Expand Down Expand Up @@ -295,6 +296,7 @@ namespace Lang
MiscText.NoFlash = u8"No Flash";
MiscText.FastStop = u8"Fast Stop";
MiscText.HitSound = u8"Hit Sound ";
MiscText.HitMerker = u8"Hit Markers";
MiscText.bmbTimer = u8"Bomb Timer";
//MiscText.SpecList = u8"Spec List";
MiscText.Watermark = u8"Watermark";
Expand All @@ -318,12 +320,5 @@ namespace Lang
ConfigText.ConfigName = u8"Config Name";

ConfigText.fpsCap = u8"Frame Limit: ";

//// Readme Menu
//ReadMeText.FeatureName = u8" README";
//ReadMeText.LastUpdate = u8"Last update: ";
//ReadMeText.SourceButton = u8"Source Code";
//ReadMeText.DiscordButton = u8"Join Discord";
//ReadMeText.OffsetsTitle = u8"Offsets:";
}
}
1 change: 1 addition & 0 deletions DragonBurn/Utils/ConfigMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ namespace ConfigMenu {
MiscCFG::WorkInSpec = true;
MiscCFG::WaterMark = false;
MiscCFG::HitSound = 0;
MiscCFG::HitMarker = false;
MiscCFG::FastStop = false;

ESPConfig::ESPenabled = false;
Expand Down
Loading

0 comments on commit 9b8836c

Please sign in to comment.