Skip to content

Commit

Permalink
Span battle HUD.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyall committed Nov 29, 2024
1 parent d8b7391 commit f7c199d
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

#include "SDK/Engine_classes.hpp"
#include "SDK/UMG_classes.hpp"
#include "SDK/WB_BattlePlayerStatus_Root_classes.hpp"
#include "SDK/WB_Battle_MonsterDamage2_classes.hpp"
#include "SDK/WB_BattleMonsterName_classes.hpp"

#include <spdlog/spdlog.h>
#include <spdlog/sinks/basic_file_sink.h>
Expand Down Expand Up @@ -328,6 +331,40 @@ void HUD()
if (bSpanHUD) {
if (obj->GetName().contains("WB_BattleUnit_Root_C") || obj->GetName().contains("WB_Field_Top_Root_C") || obj->GetName().contains("WB_MiniMapMenu_Root_C") || obj->GetName().contains("WB_TownName_Root_C") || obj->GetName().contains("WB_FacilityShop_Root_C"))
return;

if (obj->GetName().contains("WB_BattlePlayerStatus_Root_C")) {
SDK::UWB_BattlePlayerStatus_Root_C* bpStatus = (SDK::UWB_BattlePlayerStatus_Root_C*)obj;
SDK::UCanvasPanelSlot* dmgSlot = (SDK::UCanvasPanelSlot*)bpStatus->M_Damage->Slot;
SDK::UCanvasPanelSlot* nameSlot = (SDK::UCanvasPanelSlot*)bpStatus->M_NAME->Slot;

SDK::FMargin dmgOffsets = dmgSlot->GetOffsets();
SDK::FMargin nameOffsets = nameSlot->GetOffsets();

if (fAspectRatio > fNativeAspect) {
float widthOffset = ((1080.00f * fAspectRatio) - 1920.00f) / 2.00f;
if (dmgOffsets.Left != widthOffset) {
dmgOffsets.Left = widthOffset;
dmgSlot->SetOffsets(dmgOffsets);
}
if (nameOffsets.Left != widthOffset) {
nameOffsets.Left = widthOffset;
nameSlot->SetOffsets(nameOffsets);
}
}
else if (fAspectRatio < fNativeAspect) {
float heightOffset = ((1920.00f / fAspectRatio) - 1080.00f) / 2.00f;
if (dmgOffsets.Top != heightOffset) {
dmgOffsets.Top = heightOffset;
dmgSlot->SetOffsets(dmgOffsets);
}
if (nameOffsets.Top != heightOffset) {
nameOffsets.Top = heightOffset;
nameSlot->SetOffsets(nameOffsets);
}
}

return;
}
}


Expand Down

0 comments on commit f7c199d

Please sign in to comment.