diff --git a/src/gameui/CGTooltip.hpp b/src/gameui/CGTooltip.hpp index dd64fca..4c175da 100644 --- a/src/gameui/CGTooltip.hpp +++ b/src/gameui/CGTooltip.hpp @@ -24,7 +24,7 @@ class CGTooltip : public CSimpleFrame { virtual int32_t GetScriptMetaTable(); virtual ScriptIx* GetScriptByName(const char* name, ScriptData& data); - // Member variables + // Members ScriptIx m_onTooltipSetDefaultAnchor; ScriptIx m_onTooltipCleared; ScriptIx m_onTooltipAddMoney; diff --git a/src/gameui/GameScriptFunctions.cpp b/src/gameui/GameScriptFunctions.cpp index 2480b7f..c674e1a 100644 --- a/src/gameui/GameScriptFunctions.cpp +++ b/src/gameui/GameScriptFunctions.cpp @@ -8,7 +8,6 @@ #include "gameui/CGTabardModelFrame.hpp" #include "gameui/CGQuestPOIFrame.hpp" #include "console/Console.hpp" -#include "gx/CGVideoOptions.hpp" #include "ui/FrameXML.hpp" #include "ui/FrameScript.hpp" #include "util/Lua.hpp" @@ -1691,7 +1690,6 @@ void LoadScriptFunctions() { GlyphInfoRegisterScriptFunctions(); AchievementInfoRegisterScriptFunctions(); CurrencyTypesRegisterScriptFunctions(); - CGVideoOptions::RegisterScriptFunctions(); EquipmentManagerRegisterScriptFunctions(); GMTicketInfoRegisterScriptFunctions(); BattlenetUIRegisterScriptFunctions(); diff --git a/src/gameui/scripts/GameScriptFunctionsActionBar.cpp b/src/gameui/scripts/GameScriptFunctionsActionBar.cpp index 8a398b2..bc3edef 100644 --- a/src/gameui/scripts/GameScriptFunctionsActionBar.cpp +++ b/src/gameui/scripts/GameScriptFunctionsActionBar.cpp @@ -13,9 +13,7 @@ static int32_t Script_GetActionTexture(lua_State* L) { } static int32_t Script_GetActionCount(lua_State* L) { - // TODO - lua_pushnumber(L, 0.0); - return 1; + WHOA_UNIMPLEMENTED(0); } static int32_t Script_GetActionCooldown(lua_State* L) { @@ -31,9 +29,7 @@ static int32_t Script_GetActionText(lua_State* L) { } static int32_t Script_HasAction(lua_State* L) { - // TODO - lua_pushnil(L); - return 1; + WHOA_UNIMPLEMENTED(0); } static int32_t Script_UseAction(lua_State* L) { @@ -85,14 +81,11 @@ static int32_t Script_IsActionInRange(lua_State* L) { } static int32_t Script_GetBonusBarOffset(lua_State* L) { - // TODO - lua_pushnumber(L, 0.0); - return 1; + WHOA_UNIMPLEMENTED(0); } static int32_t Script_GetMultiCastBarOffset(lua_State* L) { - lua_pushnumber(L, 6.0); - return 1; + WHOA_UNIMPLEMENTED(0); } static int32_t Script_ChangeActionBarPage(lua_State* L) { diff --git a/src/gameui/scripts/GameScriptFunctionsCharacterInfo.cpp b/src/gameui/scripts/GameScriptFunctionsCharacterInfo.cpp index 5110dd3..9ff1b34 100644 --- a/src/gameui/scripts/GameScriptFunctionsCharacterInfo.cpp +++ b/src/gameui/scripts/GameScriptFunctionsCharacterInfo.cpp @@ -1,43 +1,11 @@ #include "gameui/GameScriptFunctions.hpp" #include "ui/FrameScript.hpp" -#include "db/Db.hpp" #include "util/Lua.hpp" #include "util/Unimplemented.hpp" static int32_t Script_GetInventorySlotInfo(lua_State* L) { - const char* buttonName = nullptr; - - if (lua_isstring(L, 1)) { - buttonName = lua_tolstring(L, 1, nullptr); - } - - if (!buttonName || g_paperDollItemFrameDB.GetNumRecords() < 1) { - return luaL_error(L, "Invalid inventory slot in GetInventorySlotInfo"); - } - - PaperDollItemFrameRec* record = nullptr; - bool found = false; - for (int32_t i = 0; i < g_paperDollItemFrameDB.GetNumRecords(); ++i) { - record = g_paperDollItemFrameDB.GetRecordByIndex(i); - if (!SStrCmpI(record->m_itemButtonName, buttonName, STORM_MAX_STR)) { - found = true; - break; - } - } - - if (!found) { - return luaL_error(L, "Invalid inventory slot in GetInventorySlotInfo"); - } - - lua_pushnumber(L, record->m_slotNumber); - lua_pushstring(L, record->m_slotIcon); - if (record->m_slotNumber == 18) { - lua_pushnumber(L, 1.0); - } else { - lua_pushnil(L); - } - return 3; + WHOA_UNIMPLEMENTED(0); } static int32_t Script_GetInventoryItemsForSlot(lua_State* L) { diff --git a/src/gameui/scripts/GameScriptFunctionsPartyInfo.cpp b/src/gameui/scripts/GameScriptFunctionsPartyInfo.cpp index 0c33c4f..1a7f8fe 100644 --- a/src/gameui/scripts/GameScriptFunctionsPartyInfo.cpp +++ b/src/gameui/scripts/GameScriptFunctionsPartyInfo.cpp @@ -5,15 +5,11 @@ static int32_t Script_GetNumPartyMembers(lua_State* L) { - // TODO - lua_pushnumber(L, 0.0); - return 1; + WHOA_UNIMPLEMENTED(0); } static int32_t Script_GetRealNumPartyMembers(lua_State* L) { - // TODO - lua_pushnumber(L, 0.0); - return 1; + WHOA_UNIMPLEMENTED(0); } static int32_t Script_GetPartyMember(lua_State* L) { diff --git a/src/gameui/scripts/GameScriptFunctionsRaidInfo.cpp b/src/gameui/scripts/GameScriptFunctionsRaidInfo.cpp index ff27784..d69ebda 100644 --- a/src/gameui/scripts/GameScriptFunctionsRaidInfo.cpp +++ b/src/gameui/scripts/GameScriptFunctionsRaidInfo.cpp @@ -5,15 +5,11 @@ static int32_t Script_GetNumRaidMembers(lua_State* L) { - // TODO - lua_pushnumber(L, 0.0); - return 1; + WHOA_UNIMPLEMENTED(0); } static int32_t Script_GetRealNumRaidMembers(lua_State* L) { - // TODO - lua_pushnumber(L, 0.0); - return 1; + WHOA_UNIMPLEMENTED(0); } static int32_t Script_GetRaidRosterInfo(lua_State* L) { diff --git a/src/gameui/scripts/GameScriptFunctionsScriptEvents.cpp b/src/gameui/scripts/GameScriptFunctionsScriptEvents.cpp index 7174dd2..e92432e 100644 --- a/src/gameui/scripts/GameScriptFunctionsScriptEvents.cpp +++ b/src/gameui/scripts/GameScriptFunctionsScriptEvents.cpp @@ -52,6 +52,7 @@ static int32_t Script_UnitIsUnit(lua_State* L) { static int32_t Script_UnitIsPlayer(lua_State* L) { // TODO + __debugbreak(); lua_pushnil(L); return 1; } @@ -177,57 +178,39 @@ static int32_t Script_UnitPVPName(lua_State* L) { } static int32_t Script_UnitXP(lua_State* L) { - // TODO - lua_pushnumber(L, 50.0); - return 1; + WHOA_UNIMPLEMENTED(0); } static int32_t Script_UnitXPMax(lua_State* L) { - // TODO - lua_pushnumber(L, 100.0); - return 1; + WHOA_UNIMPLEMENTED(0); } static int32_t Script_UnitHealth(lua_State* L) { - // TODO - lua_pushnumber(L, 50.0); - return 1; + WHOA_UNIMPLEMENTED(0); } static int32_t Script_UnitHealthMax(lua_State* L) { - // TODO - lua_pushnumber(L, 100.0); - return 1; + WHOA_UNIMPLEMENTED(0); } static int32_t Script_UnitMana(lua_State* L) { - // TODO - lua_pushnumber(L, 50.0); - return 1; + WHOA_UNIMPLEMENTED(0); } static int32_t Script_UnitManaMax(lua_State* L) { - // TODO - lua_pushnumber(L, 100.0); - return 1; + WHOA_UNIMPLEMENTED(0); } static int32_t Script_UnitPower(lua_State* L) { - // TODO - lua_pushnumber(L, 50.0); - return 1; + WHOA_UNIMPLEMENTED(0); } static int32_t Script_UnitPowerMax(lua_State* L) { - // TODO - lua_pushnumber(L, 100.0); - return 1; + WHOA_UNIMPLEMENTED(0); } static int32_t Script_UnitPowerType(lua_State* L) { - // TODO - lua_pushnumber(L, 0.0); - return 1; + WHOA_UNIMPLEMENTED(0); } static int32_t Script_UnitOnTaxi(lua_State* L) { @@ -239,21 +222,15 @@ static int32_t Script_UnitIsFeignDeath(lua_State* L) { } static int32_t Script_UnitIsDead(lua_State* L) { - // TODO - lua_pushboolean(L, 0); - return 1; + WHOA_UNIMPLEMENTED(0); } static int32_t Script_UnitIsGhost(lua_State* L) { - // TODO - lua_pushboolean(L, 0); - return 1; + WHOA_UNIMPLEMENTED(0); } static int32_t Script_UnitIsDeadOrGhost(lua_State* L) { - // TODO - lua_pushboolean(L, 0); - return 1; + WHOA_UNIMPLEMENTED(0); } static int32_t Script_UnitIsConnected(lua_State* L) { diff --git a/src/gameui/scripts/GameScriptFunctionsSound.cpp b/src/gameui/scripts/GameScriptFunctionsSound.cpp index 6ce97e0..7c16fea 100644 --- a/src/gameui/scripts/GameScriptFunctionsSound.cpp +++ b/src/gameui/scripts/GameScriptFunctionsSound.cpp @@ -21,9 +21,7 @@ static int32_t Script_StopMusic(lua_State* L) { } static int32_t Script_Sound_GameSystem_GetNumInputDrivers(lua_State* L) { - // TODO - lua_pushnumber(L, 0.0); - return 1; + WHOA_UNIMPLEMENTED(0); } static int32_t Script_Sound_GameSystem_GetInputDriverNameByIndex(lua_State* L) { @@ -31,9 +29,7 @@ static int32_t Script_Sound_GameSystem_GetInputDriverNameByIndex(lua_State* L) { } static int32_t Script_Sound_GameSystem_GetNumOutputDrivers(lua_State* L) { - // TODO - lua_pushnumber(L, 0.0); - return 1; + WHOA_UNIMPLEMENTED(0); } static int32_t Script_Sound_GameSystem_GetOutputDriverNameByIndex(lua_State* L) { @@ -45,9 +41,7 @@ static int32_t Script_Sound_GameSystem_RestartSoundSystem(lua_State* L) { } static int32_t Script_Sound_ChatSystem_GetNumInputDrivers(lua_State* L) { - // TODO - lua_pushnumber(L, 0.0); - return 1; + WHOA_UNIMPLEMENTED(0); } static int32_t Script_Sound_ChatSystem_GetInputDriverNameByIndex(lua_State* L) { @@ -55,9 +49,7 @@ static int32_t Script_Sound_ChatSystem_GetInputDriverNameByIndex(lua_State* L) { } static int32_t Script_Sound_ChatSystem_GetNumOutputDrivers(lua_State* L) { - // TODO - lua_pushnumber(L, 0.0); - return 1; + WHOA_UNIMPLEMENTED(0); } static int32_t Script_Sound_ChatSystem_GetOutputDriverNameByIndex(lua_State* L) { diff --git a/src/ui/CSimpleButtonScript.cpp b/src/ui/CSimpleButtonScript.cpp index 8010475..46a2420 100644 --- a/src/ui/CSimpleButtonScript.cpp +++ b/src/ui/CSimpleButtonScript.cpp @@ -128,18 +128,7 @@ int32_t CSimpleButton_SetFontString(lua_State* L) { } int32_t CSimpleButton_GetFontString(lua_State* L) { - auto type = CSimpleButton::GetObjectType(); - auto button = static_cast(FrameScript_GetObjectThis(L, type)); - auto fontString = button->m_text; - if (fontString) { - if (!fontString->lua_registered) { - fontString->RegisterScriptObject(nullptr); - } - lua_rawgeti(L, LUA_REGISTRYINDEX, fontString->lua_objectRef); - } else { - lua_pushnil(L); - } - return 1; + WHOA_UNIMPLEMENTED(0); } int32_t CSimpleButton_SetText(lua_State* L) { diff --git a/src/ui/CSimpleFrame.cpp b/src/ui/CSimpleFrame.cpp index 6859567..e610bca 100644 --- a/src/ui/CSimpleFrame.cpp +++ b/src/ui/CSimpleFrame.cpp @@ -450,19 +450,6 @@ void CSimpleFrame::RunOnUpdateScript(float elapsedSec) { } } -void CSimpleFrame::RunOnAttributeChangedScript(const char* name, int32_t luaRef) { - if (this->m_onAttributeChange.luaRef) { - auto L = FrameScript_GetContext(); - // TODO: LUA Tainted - auto loweredName = static_cast(alloca(SStrLen(name) + 1)); - SStrCopy(loweredName, name, STORM_MAX_STR); - SStrLower(loweredName); - lua_pushstring(L, loweredName); - lua_rawgeti(L, LUA_REGISTRYINDEX, luaRef); - this->RunScript(this->m_onAttributeChange, 2, nullptr); - } -} - void CSimpleFrame::PreLoadXML(XMLNode* node, CStatus* status) { const char* name = node->GetAttributeByName("name"); @@ -713,58 +700,7 @@ int32_t CSimpleFrame::HideThis() { } void CSimpleFrame::LoadXML_Attributes(XMLNode* node, CStatus* status) { - auto L = FrameScript_GetContext(); - - auto child = node->m_child; - while (child) { - auto childName = child->m_name.GetString(); - if (SStrCmpI(childName, "Attribute", STORM_MAX_STR)) { - status->Add(STATUS_WARNING, "Frame %s: Unknown attributes element %s", this->GetDisplayName(), childName); - child = child->m_next; - continue; - } - - auto name = child->GetAttributeByName("name"); - if (!name) { - status->Add(STATUS_WARNING, "Frame %s: unnamed attribute element", this->GetDisplayName()); - child = child->m_next; - continue; - } - - auto type = child->GetAttributeByName("type"); - if (!type) { - type = "string"; - } - - auto value = child->GetAttributeByName("value"); - if (!value || !SStrCmpI(value, "nil", STORM_MAX_STR)) { - status->Add(STATUS_WARNING, "Frame %s: attribute element named %s missing value", this->GetDisplayName(), name); - child = child->m_next; - continue; - } - - if (!SStrCmpI(type, "nil", STORM_MAX_STR)) { - lua_pushnil(L); - } else if (!SStrCmpI(type, "boolean", STORM_MAX_STR)) { - lua_pushboolean(L, StringToBOOL(value)); - } else if (!SStrCmpI(type, "number", STORM_MAX_STR)) { - lua_pushnumber(L, SStrToFloat(value)); - } else { - lua_pushstring(L, value); - } - - auto attribute = this->m_attributes.Ptr(name); - if (attribute) { - luaL_unref(L, LUA_REGISTRYINDEX, attribute->luaRef); - } else { - attribute = this->m_attributes.New(name, 0, 0); - } - - // TODO: LUA Tainted Logic - attribute->luaRef = luaL_ref(L, LUA_REGISTRYINDEX); - - child = child->m_next; - } + // TODO } void CSimpleFrame::LoadXML_Backdrop(XMLNode* node, CStatus* status) { @@ -1652,26 +1588,3 @@ void CSimpleFrame::UnregisterRegion(CSimpleRegion* region) { this->m_regions.UnlinkNode(region); } - -bool CSimpleFrame::GetAttribute(const char* name, int32_t& luaRef) { - auto attribute = this->m_attributes.Ptr(name); - if (!attribute || attribute->luaRef == -1) { - return false; - } - luaRef = attribute->luaRef; - return true; -} - -void CSimpleFrame::SetAttribute(const char* name, int32_t luaRef) { - auto attribute = this->m_attributes.Ptr(name); - if (!attribute) { - attribute = this->m_attributes.New(name, 0, 0); - } - attribute->luaRef = luaRef; - this->RunOnAttributeChangedScript(name, luaRef); -} - -bool CSimpleFrame::AttributeChangesAllowed() const { - // TODO - return true; -} diff --git a/src/ui/CSimpleFrame.hpp b/src/ui/CSimpleFrame.hpp index fcc9d55..40abe7d 100644 --- a/src/ui/CSimpleFrame.hpp +++ b/src/ui/CSimpleFrame.hpp @@ -7,7 +7,6 @@ #include "ui/Types.hpp" #include #include -#include class CBackdropGenerator; class CCharEvent; @@ -17,11 +16,6 @@ class CSimpleTitleRegion; class CSimpleTop; struct lua_State; -class FRAMEATTR : public TSHashObject { - public: - int32_t luaRef = -1; -}; - class CSimpleFrame : public CScriptRegion { public: // Static members @@ -85,7 +79,6 @@ class CSimpleFrame : public CScriptRegion { TSLink m_framesLink; TSLink m_destroyedLink; TSLink m_strataLink; - TSHashTable m_attributes; // Virtual member functions virtual ~CSimpleFrame(); @@ -153,7 +146,6 @@ class CSimpleFrame : public CScriptRegion { void RunOnShowScript(); void RunOnSizeChangedScript(float width, float height); void RunOnUpdateScript(float elapsedSec); - void RunOnAttributeChangedScript(const char* name, int32_t luaRef); void SetBackdrop(CBackdropGenerator* backdrop); void SetBeingScrolled(int32_t a2, int32_t a3); void SetFrameAlpha(uint8_t alpha); @@ -166,9 +158,6 @@ class CSimpleFrame : public CScriptRegion { void Show(); int32_t TestHitRect(const C2Vector& pt); void UnregisterForEvents(int32_t a2); - bool GetAttribute(const char* name, int32_t& luaRef); - void SetAttribute(const char* name, int32_t luaRef); - bool AttributeChangesAllowed() const; }; #endif diff --git a/src/ui/CSimpleFrameScript.cpp b/src/ui/CSimpleFrameScript.cpp index 2b68e78..739e317 100644 --- a/src/ui/CSimpleFrameScript.cpp +++ b/src/ui/CSimpleFrameScript.cpp @@ -231,95 +231,11 @@ int32_t CSimpleFrame_CanChangeAttributes(lua_State* L) { } int32_t CSimpleFrame_GetAttribute(lua_State* L) { - auto type = CSimpleFrame::GetObjectType(); - auto frame = static_cast(FrameScript_GetObjectThis(L, type)); - - if (lua_gettop(L) == 4 && lua_isstring(L, 3)) { - size_t prefixLength; - size_t nameLength; - size_t suffixLength; - auto prefix = lua_tolstring(L, 2, &prefixLength); - auto name = lua_tolstring(L, 3, &nameLength); - auto suffix = lua_tolstring(L, 4, &suffixLength); - - int32_t luaRef = -1; - char fullName[256]; - - size_t offset = 0; - offset += SStrNCopy(&fullName[offset], prefix, prefixLength, sizeof(fullName) - offset); - offset += SStrNCopy(&fullName[offset], name, nameLength, sizeof(fullName) - offset); - offset += SStrNCopy(&fullName[offset], suffix, suffixLength, sizeof(fullName) - offset); - - if (frame->GetAttribute(fullName, luaRef)) { - lua_rawgeti(L, LUA_REGISTRYINDEX, luaRef); - return 1; - } - - offset = 0; - offset += SStrNCopy(&fullName[offset], prefix, prefixLength, sizeof(fullName) - offset - 1); - offset += SStrNCopy(&fullName[offset], name, nameLength, sizeof(fullName) - offset - 1); - fullName[offset++] = '*'; - fullName[offset++] = '\0'; - - if (frame->GetAttribute(fullName, luaRef)) { - lua_rawgeti(L, LUA_REGISTRYINDEX, luaRef); - return 1; - } - - offset = 0; - fullName[offset++] = '*'; - offset += SStrNCopy(&fullName[offset], name, nameLength, sizeof(fullName) - offset - 1); - fullName[offset++] = '*'; - fullName[offset++] = '\0'; - - if (frame->GetAttribute(fullName, luaRef) || frame->GetAttribute(name, luaRef)) { - lua_rawgeti(L, LUA_REGISTRYINDEX, luaRef); - return 1; - } - - lua_pushnil(L); - } else { - if (!lua_isstring(L, 2)) { - return luaL_error(L, "Usage: %s:GetAttribute(\"name\")", frame->GetDisplayName()); - } - - auto name = lua_tolstring(L, 2, nullptr); - int32_t luaRef = -1; - if (frame->GetAttribute(name, luaRef)) { - lua_rawgeti(L, LUA_REGISTRYINDEX, luaRef); - } else { - lua_pushnil(L); - } - } - return 1; + WHOA_UNIMPLEMENTED(0); } int32_t CSimpleFrame_SetAttribute(lua_State* L) { - auto type = CSimpleFrame::GetObjectType(); - auto frame = static_cast(FrameScript_GetObjectThis(L, type)); - - if (!frame->ProtectedFunctionsAllowed() && !frame->AttributeChangesAllowed()) { - // TODO: CSimpleTop::s_instance->dword1254(); // fptr call - return 0; - } - - lua_settop(L, 3); - if (!lua_isstring(L, 2) || lua_type(L, 3) == LUA_TNONE) { - return luaL_error(L, "Usage: %s:SetAttribute(\"name\", value)", frame->GetDisplayName()); - } - - int32_t luaRef = -1; - - auto name = lua_tolstring(L, 2, nullptr); - if (frame->GetAttribute(name, luaRef)) { - luaL_unref(L, LUA_REGISTRYINDEX, luaRef); - } - - // TODO: LUA Tainted - luaRef = luaL_ref(L, LUA_REGISTRYINDEX); - frame->SetAttribute(name, luaRef); - - return 0; + WHOA_UNIMPLEMENTED(0); } int32_t CSimpleFrame_GetEffectiveScale(lua_State* L) { diff --git a/src/ui/CSimpleMessageFrame.cpp b/src/ui/CSimpleMessageFrame.cpp deleted file mode 100644 index ea4e0a3..0000000 --- a/src/ui/CSimpleMessageFrame.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include "ui/CSimpleMessageFrame.hpp" -#include "ui/CSimpleMessageFrameScript.hpp" - -int32_t CSimpleMessageFrame::s_metatable = 0; -int32_t CSimpleMessageFrame::s_objectType = 0; - -void CSimpleMessageFrame::CreateScriptMetaTable() { - lua_State* L = FrameScript_GetContext(); - int32_t ref = FrameScript_Object::CreateScriptMetaTable(L, &CSimpleMessageFrame::RegisterScriptMethods); - CSimpleMessageFrame::s_metatable = ref; -} - -int32_t CSimpleMessageFrame::GetObjectType() { - if (!CSimpleMessageFrame::s_objectType) { - CSimpleMessageFrame::s_objectType = ++FrameScript_Object::s_objectTypes; - } - - return CSimpleMessageFrame::s_objectType; -} - -void CSimpleMessageFrame::RegisterScriptMethods(lua_State* L) { - CSimpleFrame::RegisterScriptMethods(L); - FrameScript_Object::FillScriptMethodTable(L, SimpleMessageFrameMethods, NUM_SIMPLE_MESSAGE_FRAME_SCRIPT_METHODS); -} - -CSimpleMessageFrame::CSimpleMessageFrame(CSimpleFrame* parent) - : CSimpleFrame(parent) { -} - -bool CSimpleMessageFrame::IsA(int32_t type) { - return type == CSimpleMessageFrame::s_objectType - || type == CSimpleFrame::s_objectType - || type == CScriptRegion::s_objectType - || type == CScriptObject::s_objectType; -} - -int32_t CSimpleMessageFrame::GetScriptMetaTable() { - return CSimpleMessageFrame::s_metatable; -} diff --git a/src/ui/CSimpleMessageFrame.hpp b/src/ui/CSimpleMessageFrame.hpp deleted file mode 100644 index 2029db0..0000000 --- a/src/ui/CSimpleMessageFrame.hpp +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef UI_C_SIMPLE_MESSAGE_FRAME_HPP -#define UI_C_SIMPLE_MESSAGE_FRAME_HPP - -#include "ui/CSimpleFrame.hpp" - -class CSimpleMessageFrame : public CSimpleFrame { - public: - // Static variables - static int32_t s_metatable; - static int32_t s_objectType; - - // Static functions - static void CreateScriptMetaTable(); - static int32_t GetObjectType(); - static void RegisterScriptMethods(lua_State* L); - - // Member functions - CSimpleMessageFrame(CSimpleFrame* parent); - - // Virtual member functions - virtual bool IsA(int32_t type); - virtual int32_t GetScriptMetaTable(); -}; - -#endif diff --git a/src/ui/CSimpleMessageFrameScript.cpp b/src/ui/CSimpleMessageFrameScript.cpp deleted file mode 100644 index 8ca78d7..0000000 --- a/src/ui/CSimpleMessageFrameScript.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#include "ui/CSimpleMessageFrameScript.hpp" -#include "ui/CSimpleMessageFrame.hpp" -#include "util/Lua.hpp" -#include "util/Unimplemented.hpp" - -static int32_t Script_GetOrientation(lua_State* L) { - WHOA_UNIMPLEMENTED(0); -} - -static int32_t Script_SetOrientation(lua_State* L) { - WHOA_UNIMPLEMENTED(0); -} - -static int32_t Script_GetMinMaxValues(lua_State* L) { - WHOA_UNIMPLEMENTED(0); -} - -static int32_t Script_SetMinMaxValues(lua_State* L) { - WHOA_UNIMPLEMENTED(0); -} - -static int32_t Script_GetValue(lua_State* L) { - WHOA_UNIMPLEMENTED(0); -} - -static int32_t Script_SetValue(lua_State* L) { - WHOA_UNIMPLEMENTED(0); -} - -static int32_t Script_GetStatusBarTexture(lua_State* L) { - WHOA_UNIMPLEMENTED(0); -} - -static int32_t Script_SetStatusBarTexture(lua_State* L) { - WHOA_UNIMPLEMENTED(0); -} - -static int32_t Script_GetStatusBarColor(lua_State* L) { - WHOA_UNIMPLEMENTED(0); -} - -static int32_t Script_SetStatusBarColor(lua_State* L) { - WHOA_UNIMPLEMENTED(0); -} - -static int32_t Script_GetRotatesTexture(lua_State* L) { - WHOA_UNIMPLEMENTED(0); -} - -static int32_t Script_SetRotatesTexture(lua_State* L) { - WHOA_UNIMPLEMENTED(0); -} - - -FrameScript_Method SimpleMessageFrameMethods[NUM_SIMPLE_MESSAGE_FRAME_SCRIPT_METHODS] = { - { "GetOrientation", &Script_GetOrientation }, - { "SetOrientation", &Script_SetOrientation }, - { "GetMinMaxValues", &Script_GetMinMaxValues }, - { "SetMinMaxValues", &Script_SetMinMaxValues }, - { "GetValue", &Script_GetValue }, - { "SetValue", &Script_SetValue }, - { "GetStatusBarTexture", &Script_GetStatusBarTexture }, - { "SetStatusBarTexture", &Script_SetStatusBarTexture }, - { "GetStatusBarColor", &Script_GetStatusBarColor }, - { "SetStatusBarColor", &Script_SetStatusBarColor }, - { "GetRotatesTexture", &Script_GetRotatesTexture }, - { "SetRotatesTexture", &Script_SetRotatesTexture } -}; diff --git a/src/ui/CSimpleMessageFrameScript.hpp b/src/ui/CSimpleMessageFrameScript.hpp deleted file mode 100644 index bf01acd..0000000 --- a/src/ui/CSimpleMessageFrameScript.hpp +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef UI_C_SIMPLE_MESSAGE_FRAME_SCRIPT_HPP -#define UI_C_SIMPLE_MESSAGE_FRAME_SCRIPT_HPP - -#include "ui/FrameScript.hpp" - -#define NUM_SIMPLE_MESSAGE_FRAME_SCRIPT_METHODS 12 - -extern FrameScript_Method SimpleMessageFrameMethods[NUM_SIMPLE_MESSAGE_FRAME_SCRIPT_METHODS]; - -#endif diff --git a/src/ui/CSimpleStatusBar.cpp b/src/ui/CSimpleStatusBar.cpp deleted file mode 100644 index b07e28d..0000000 --- a/src/ui/CSimpleStatusBar.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include "ui/CSimpleStatusBar.hpp" -#include "ui/CSimpleStatusBarScript.hpp" - -int32_t CSimpleStatusBar::s_metatable = 0; -int32_t CSimpleStatusBar::s_objectType = 0; - -void CSimpleStatusBar::CreateScriptMetaTable() { - lua_State* L = FrameScript_GetContext(); - int32_t ref = FrameScript_Object::CreateScriptMetaTable(L, &CSimpleStatusBar::RegisterScriptMethods); - CSimpleStatusBar::s_metatable = ref; -} - -int32_t CSimpleStatusBar::GetObjectType() { - if (!CSimpleStatusBar::s_objectType) { - CSimpleStatusBar::s_objectType = ++FrameScript_Object::s_objectTypes; - } - - return CSimpleStatusBar::s_objectType; -} - -void CSimpleStatusBar::RegisterScriptMethods(lua_State* L) { - CSimpleFrame::RegisterScriptMethods(L); - FrameScript_Object::FillScriptMethodTable(L, SimpleStatusBarMethods, NUM_SIMPLE_STATUS_BAR_SCRIPT_METHODS); -} - -CSimpleStatusBar::CSimpleStatusBar(CSimpleFrame* parent) - : CSimpleFrame(parent) { -} - -bool CSimpleStatusBar::IsA(int32_t type) { - return type == CSimpleStatusBar::s_objectType - || type == CSimpleFrame::s_objectType - || type == CScriptRegion::s_objectType - || type == CScriptObject::s_objectType; -} - -int32_t CSimpleStatusBar::GetScriptMetaTable() { - return CSimpleStatusBar::s_metatable; -} - -FrameScript_Object::ScriptIx* CSimpleStatusBar::GetScriptByName(const char* name, ScriptData& data) { - auto parentScript = CSimpleFrame::GetScriptByName(name, data); - - if (parentScript) { - return parentScript; - } - - if (!SStrCmpI(name, "OnValueChanged", STORM_MAX_STR)) { - data.wrapper = "return function(self,value) %s end"; - return &this->m_onValueChanged; - } - - if (!SStrCmpI(name, "OnMinMaxChanged", STORM_MAX_STR)) { - data.wrapper = "return function(self,min,max) %s end"; - return &this->m_onMinMaxChanged; - } - - return nullptr; -} diff --git a/src/ui/CSimpleStatusBar.hpp b/src/ui/CSimpleStatusBar.hpp deleted file mode 100644 index e7973b3..0000000 --- a/src/ui/CSimpleStatusBar.hpp +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef UI_C_SIMPLE_STATUS_BAR_HPP -#define UI_C_SIMPLE_STATUS_BAR_HPP - -#include "ui/CSimpleFrame.hpp" - -class CSimpleStatusBar : public CSimpleFrame { - public: - // Static variables - static int32_t s_metatable; - static int32_t s_objectType; - - // Static functions - static void CreateScriptMetaTable(); - static int32_t GetObjectType(); - static void RegisterScriptMethods(lua_State* L); - - // Member functions - CSimpleStatusBar(CSimpleFrame* parent); - - // Virtual member functions - virtual bool IsA(int32_t type); - virtual int32_t GetScriptMetaTable(); - virtual ScriptIx* GetScriptByName(const char* name, ScriptData& data); - - // Member variables - ScriptIx m_onValueChanged; - ScriptIx m_onMinMaxChanged; -}; - -#endif diff --git a/src/ui/CSimpleStatusBarScript.cpp b/src/ui/CSimpleStatusBarScript.cpp deleted file mode 100644 index 1172af4..0000000 --- a/src/ui/CSimpleStatusBarScript.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#include "ui/CSimpleStatusBarScript.hpp" -#include "ui/CSimpleStatusBar.hpp" -#include "util/Lua.hpp" -#include "util/Unimplemented.hpp" - -static int32_t Script_GetOrientation(lua_State* L) { - WHOA_UNIMPLEMENTED(0); -} - -static int32_t Script_SetOrientation(lua_State* L) { - WHOA_UNIMPLEMENTED(0); -} - -static int32_t Script_GetMinMaxValues(lua_State* L) { - WHOA_UNIMPLEMENTED(0); -} - -static int32_t Script_SetMinMaxValues(lua_State* L) { - WHOA_UNIMPLEMENTED(0); -} - -static int32_t Script_GetValue(lua_State* L) { - WHOA_UNIMPLEMENTED(0); -} - -static int32_t Script_SetValue(lua_State* L) { - WHOA_UNIMPLEMENTED(0); -} - -static int32_t Script_GetStatusBarTexture(lua_State* L) { - WHOA_UNIMPLEMENTED(0); -} - -static int32_t Script_SetStatusBarTexture(lua_State* L) { - WHOA_UNIMPLEMENTED(0); -} - -static int32_t Script_GetStatusBarColor(lua_State* L) { - WHOA_UNIMPLEMENTED(0); -} - -static int32_t Script_SetStatusBarColor(lua_State* L) { - WHOA_UNIMPLEMENTED(0); -} - -static int32_t Script_GetRotatesTexture(lua_State* L) { - WHOA_UNIMPLEMENTED(0); -} - -static int32_t Script_SetRotatesTexture(lua_State* L) { - WHOA_UNIMPLEMENTED(0); -} - - -FrameScript_Method SimpleStatusBarMethods[NUM_SIMPLE_STATUS_BAR_SCRIPT_METHODS] = { - { "GetOrientation", &Script_GetOrientation }, - { "SetOrientation", &Script_SetOrientation }, - { "GetMinMaxValues", &Script_GetMinMaxValues }, - { "SetMinMaxValues", &Script_SetMinMaxValues }, - { "GetValue", &Script_GetValue }, - { "SetValue", &Script_SetValue }, - { "GetStatusBarTexture", &Script_GetStatusBarTexture }, - { "SetStatusBarTexture", &Script_SetStatusBarTexture }, - { "GetStatusBarColor", &Script_GetStatusBarColor }, - { "SetStatusBarColor", &Script_SetStatusBarColor }, - { "GetRotatesTexture", &Script_GetRotatesTexture }, - { "SetRotatesTexture", &Script_SetRotatesTexture } -}; diff --git a/src/ui/CSimpleStatusBarScript.hpp b/src/ui/CSimpleStatusBarScript.hpp deleted file mode 100644 index f440cc2..0000000 --- a/src/ui/CSimpleStatusBarScript.hpp +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef UI_C_SIMPLE_STATUS_BAR_SCRIPT_HPP -#define UI_C_SIMPLE_STATUS_BAR_SCRIPT_HPP - -#include "ui/FrameScript.hpp" - -#define NUM_SIMPLE_STATUS_BAR_SCRIPT_METHODS 12 - -extern FrameScript_Method SimpleStatusBarMethods[NUM_SIMPLE_STATUS_BAR_SCRIPT_METHODS]; - -#endif diff --git a/src/ui/FrameXML.cpp b/src/ui/FrameXML.cpp index 763e60a..30b6d54 100644 --- a/src/ui/FrameXML.cpp +++ b/src/ui/FrameXML.cpp @@ -8,10 +8,8 @@ #include "ui/CSimpleModel.hpp" #include "ui/CSimpleMovieFrame.hpp" #include "ui/CSimpleScrollFrame.hpp" -#include "ui/CSimpleMessageFrame.hpp" #include "ui/CSimpleMessageScrollFrame.hpp" #include "ui/CSimpleSlider.hpp" -#include "ui/CSimpleStatusBar.hpp" #include "util/CStatus.hpp" #include "util/SFile.hpp" #include @@ -58,8 +56,7 @@ CSimpleFrame* Create_SimpleFrame(CSimpleFrame* parent) { CSimpleFrame* Create_SimpleMessageFrame(CSimpleFrame* parent) { // TODO - auto m = SMemAlloc(sizeof(CSimpleMessageFrame), __FILE__, __LINE__, 0x0); - return new (m) CSimpleMessageFrame(parent); + return nullptr; } CSimpleFrame* Create_SimpleModel(CSimpleFrame* parent) { @@ -104,8 +101,7 @@ CSimpleFrame* Create_SimpleHTML(CSimpleFrame* parent) { CSimpleFrame* Create_SimpleStatusBar(CSimpleFrame* parent) { // TODO - auto m = SMemAlloc(sizeof(CSimpleStatusBar), __FILE__, __LINE__, 0x0); - return new (m) CSimpleStatusBar(parent); + return nullptr; } CSimpleFrame* Create_SimpleColorSelect(CSimpleFrame* parent) { diff --git a/src/ui/ScriptFunctions.cpp b/src/ui/ScriptFunctions.cpp index 466d271..56fda65 100644 --- a/src/ui/ScriptFunctions.cpp +++ b/src/ui/ScriptFunctions.cpp @@ -12,9 +12,7 @@ #include "ui/CSimpleScrollFrame.hpp" #include "ui/CSimpleSlider.hpp" #include "ui/CSimpleTexture.hpp" -#include "ui/CSimpleMessageFrame.hpp" #include "ui/CSimpleMessageScrollFrame.hpp" -#include "ui/CSimpleStatusBar.hpp" #include "ui/FrameScript.hpp" void CharacterCreateRegisterScriptFunctions() { @@ -80,7 +78,8 @@ void RegisterSimpleFrameScriptMethods() { CSimpleEditBox::CreateScriptMetaTable(); CSimpleHTML::CreateScriptMetaTable(); - CSimpleMessageFrame::CreateScriptMetaTable(); + // TODO + // CSimpleMessageFrame::CreateScriptMetaTable(); CSimpleMessageScrollFrame::CreateScriptMetaTable(); CSimpleModel::CreateScriptMetaTable(); @@ -89,7 +88,7 @@ void RegisterSimpleFrameScriptMethods() { CSimpleSlider::CreateScriptMetaTable(); // TODO - CSimpleStatusBar::CreateScriptMetaTable(); + // CSimpleStatusBar::CreateScriptMetaTable(); // CSimpleColorSelect::CreateScriptMetaTable(); CSimpleMovieFrame::CreateScriptMetaTable(); }