Compare commits

...

3 Commits

Author SHA1 Message Date
fallenoak
66df4c55da
feat(ui): implement CScriptRegion_SetSize
Some checks are pending
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:cl compiler_name:MSVC cxx:cl os:windows-latest system_name:Windows test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:clang compiler_name:Clang cxx:clang++ os:macos-latest system_name:macOS test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:gcc compiler_name:GCC cxx:g++ os:ubuntu-latest system_name:Linux test_path:WhoaTest]) (push) Waiting to run
2026-02-08 21:45:58 -06:00
fallenoak
91da4e9680
feat(ui): add CLayoutFrame::SetSize 2026-02-08 21:45:31 -06:00
fallenoak
fabd5888a9
feat(ui): add CGGameUI::RegisterGameCVars 2026-02-08 20:37:45 -06:00
5 changed files with 77 additions and 1 deletions

View File

@ -862,6 +862,13 @@ void CLayoutFrame::SetProtectFlag(uint32_t flag) {
this->m_flags &= ~0x800;
}
void CLayoutFrame::SetSize(float width, float height) {
this->m_flags &= ~0x8;
this->m_width = width;
this->m_height = height;
this->Resize(0);
}
void CLayoutFrame::SetWidth(float width) {
this->m_flags &= ~0x8;
this->m_width = width;

View File

@ -49,6 +49,7 @@ class CLayoutFrame {
virtual bool SetLayoutScale(float scale, bool force);
virtual void SetWidth(float width);
virtual void SetHeight(float height);
virtual void SetSize(float width, float height);
virtual float GetWidth();
virtual float GetHeight();
virtual void GetSize(float& width, float& height, int32_t a4);

View File

@ -219,7 +219,28 @@ int32_t CScriptRegion_SetHeight(lua_State* L) {
}
int32_t CScriptRegion_SetSize(lua_State* L) {
WHOA_UNIMPLEMENTED(0);
auto type = CScriptRegion::GetObjectType();
auto region = static_cast<CScriptRegion*>(FrameScript_GetObjectThis(L, type));
if (!region->ProtectedFunctionsAllowed()) {
// TODO disallowed logic
return 0;
}
if (!lua_isnumber(L, 2) || !lua_isnumber(L, 3)) {
luaL_error(L, "Usage: %s:SetSize(width, height)", region->GetDisplayName());
return 0;
}
auto ndcWidth = static_cast<float>(lua_tonumber(L, 2)) / (CoordinateGetAspectCompensation() * 1024.0f);
auto ddcWidth = NDCToDDCWidth(ndcWidth);
auto ndcHeight = static_cast<float>(lua_tonumber(L, 3)) / (CoordinateGetAspectCompensation() * 1024.0f);
auto ddcHeight = NDCToDDCWidth(ndcHeight);
region->SetSize(ddcWidth, ddcHeight);
return 0;
}
int32_t CScriptRegion_GetSize(lua_State* L) {

View File

@ -1,5 +1,6 @@
#include "ui/game/CGGameUI.hpp"
#include "client/Client.hpp"
#include "console/CVar.hpp"
#include "object/Client.hpp"
#include "ui/CScriptObject.hpp"
#include "ui/FrameXML.hpp"
@ -121,6 +122,7 @@ void CGGameUI::Initialize() {
LoadScriptFunctions();
ScriptEventsRegisterEvents();
CGGameUI::RegisterGameCVars();
// TODO
@ -232,3 +234,47 @@ void CGGameUI::RegisterFrameFactories() {
FrameXML_RegisterFactory("TabardModel", &CGTabardModelFrame::Create, false);
FrameXML_RegisterFactory("QuestPOIFrame", &CGQuestPOIFrame::Create, false);
}
void CGGameUI::RegisterGameCVars() {
// TODO
CVar::Register("enableCombatText", "Whether to show floating combat text", 0x10, "1", nullptr, GAME);
CVar::Register("combatTextFloatMode", "The combat text float mode", 0x10, "1", nullptr, GAME);
CVar::Register("fctCombatState", nullptr, 0x10, "0", nullptr, GAME);
CVar::Register("fctDodgeParryMiss", nullptr, 0x10, "0", nullptr, GAME);
CVar::Register("fctDamageReduction", nullptr, 0x10, "0", nullptr, GAME);
CVar::Register("fctRepChanges", nullptr, 0x10, "0", nullptr, GAME);
CVar::Register("fctReactives", nullptr, 0x10, "0", nullptr, GAME);
CVar::Register("fctFriendlyHealers", nullptr, 0x10, "0", nullptr, GAME);
CVar::Register("fctComboPoints", nullptr, 0x10, "0", nullptr, GAME);
CVar::Register("fctLowManaHealth", nullptr, 0x10, "1", nullptr, GAME);
CVar::Register("fctEnergyGains", nullptr, 0x10, "0", nullptr, GAME);
CVar::Register("fctPeriodicEnergyGains", nullptr, 0x10, "0", nullptr, GAME);
CVar::Register("fctHonorGains", nullptr, 0x10, "0", nullptr, GAME);
CVar::Register("fctAuras", nullptr, 0x10, "0", nullptr, GAME);
CVar::Register("fctAllSpellMechanics", nullptr, 0x10, "0", nullptr, GAME);
CVar::Register("fctSpellMechanics", nullptr, 0x10, "0", nullptr, GAME);
CVar::Register("fctSpellMechanicsOther", nullptr, 0x10, "0", nullptr, GAME);
CVar::Register("xpBarText", "Whether the XP bar shows the numeric experience value", 0x10, "0", nullptr, GAME);
CVar::Register("playerStatusText", "Whether the player portrait shows numeric health/mana values", 0x10, "0", nullptr, GAME);
CVar::Register("petStatusText", "Whether the pet portrait shows numeric health/mana values", 0x10, "0", nullptr, GAME);
CVar::Register("partyStatusText", "Whether the party portraits shows numeric health/mana values", 0x10, "0", nullptr, GAME);
CVar::Register("targetStatusText", "Whether the target portrait shows numeric health/mana values", 0x10, "0", nullptr, GAME);
CVar::Register("statusTextPercentage", "Whether numeric health/mana values are shown as raw values or percentages", 0x10, "0", nullptr, GAME);
CVar::Register("showPartyBackground", "Show a background behind party members", 0x10, "0", nullptr, GAME);
CVar::Register("partyBackgroundOpacity", "The opacity of the party background", 0x10, "0.5", nullptr, GAME);
CVar::Register("hidePartyInRaid", "Whether to hide the party UI while in a raid", 0x10, "0", nullptr, GAME);
CVar::Register("showPartyPets", "Whether to show pets in the party UI", 0x20, "1", nullptr, GAME);
CVar::Register("showRaidRange", "Show range indicator in raid UI", 0x20, "0", nullptr, GAME);
CVar::Register("showArenaEnemyFrames", "Show arena enemy frames while in an Arena", 0x20, "1", nullptr, GAME);
CVar::Register("showArenaEnemyCastbar", "Show the spell enemies are casting on the Arena Enemy frames", 0x20, "1", nullptr, GAME);
CVar::Register("showArenaEnemyPets", "Show the enemy team's pets on the ArenaEnemy frames", 0x20, "1", nullptr, GAME);
CVar::Register("fullSizeFocusFrame", "Increases the size of the focus frame to that of the target frame", 0x20, "0", nullptr, GAME);
// TODO
}

View File

@ -23,6 +23,7 @@ class CGGameUI {
static int32_t IsRaidMember(const WOWGUID& guid);
static int32_t IsRaidMemberOrPet(const WOWGUID& guid);
static void RegisterFrameFactories();
static void RegisterGameCVars();
private:
static WOWGUID s_currentObjectTrack;