mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-08 10:25:59 +03:00
Compare commits
8 Commits
102fc51aef
...
9d88498809
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d88498809 | ||
|
|
b554cf9d9e | ||
|
|
28e931928a | ||
|
|
19feaf57d3 | ||
|
|
88f2cb7e5f | ||
|
|
b76a9fed82 | ||
|
|
568afa1c1b | ||
|
|
9d82727c9b |
@ -1,8 +1,10 @@
|
|||||||
#include "gameui/CGTooltip.hpp"
|
#include "gameui/CGTooltip.hpp"
|
||||||
#include "gameui/CGTooltipScript.hpp"
|
#include "gameui/CGTooltipScript.hpp"
|
||||||
|
#include "util/Lua.hpp"
|
||||||
#include <bc/Memory.hpp>
|
#include <bc/Memory.hpp>
|
||||||
|
|
||||||
int32_t CGTooltip::s_metatable;
|
int32_t CGTooltip::s_metatable;
|
||||||
|
int32_t CGTooltip::s_objectType;
|
||||||
|
|
||||||
CSimpleFrame* CGTooltip::Create(CSimpleFrame* parent) {
|
CSimpleFrame* CGTooltip::Create(CSimpleFrame* parent) {
|
||||||
// TODO: Data = CDataAllocator__GetData(0, ".?AVCGTooltip@@", -2);
|
// TODO: Data = CDataAllocator__GetData(0, ".?AVCGTooltip@@", -2);
|
||||||
@ -15,15 +17,79 @@ void CGTooltip::CreateScriptMetaTable() {
|
|||||||
CGTooltip::s_metatable = ref;
|
CGTooltip::s_metatable = ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t CGTooltip::GetObjectType() {
|
||||||
|
if (!CGTooltip::s_objectType) {
|
||||||
|
CGTooltip::s_objectType = ++FrameScript_Object::s_objectTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
return CGTooltip::s_objectType;
|
||||||
|
}
|
||||||
|
|
||||||
void CGTooltip::RegisterScriptMethods(lua_State* L) {
|
void CGTooltip::RegisterScriptMethods(lua_State* L) {
|
||||||
CSimpleFrame::RegisterScriptMethods(L);
|
CSimpleFrame::RegisterScriptMethods(L);
|
||||||
FrameScript_Object::FillScriptMethodTable(L, CGTooltipMethods, NUM_CGTOOLTIP_SCRIPT_METHODS);
|
FrameScript_Object::FillScriptMethodTable(L, CGTooltipMethods, NUM_CGTOOLTIP_SCRIPT_METHODS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CGTooltip::CGTooltip(CSimpleFrame* parent)
|
||||||
|
: CSimpleFrame(parent) {
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CGTooltip::IsA(int32_t type) {
|
||||||
|
return type == CGTooltip::s_objectType
|
||||||
|
|| type == CSimpleFrame::s_objectType
|
||||||
|
|| type == CScriptRegion::s_objectType
|
||||||
|
|| type == CScriptObject::s_objectType;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t CGTooltip::GetScriptMetaTable() {
|
int32_t CGTooltip::GetScriptMetaTable() {
|
||||||
return CGTooltip::s_metatable;
|
return CGTooltip::s_metatable;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGTooltip::CGTooltip(CSimpleFrame* parent)
|
FrameScript_Object::ScriptIx* CGTooltip::GetScriptByName(const char* name, ScriptData& data) {
|
||||||
: CSimpleFrame(parent) {
|
auto result = this->CSimpleFrame::GetScriptByName(name, data);
|
||||||
|
if (result)
|
||||||
|
return result;
|
||||||
|
|
||||||
|
if (!SStrCmpI(name, "OnTooltipSetDefaultAnchor", STORM_MAX_STR)) {
|
||||||
|
return &this->m_onTooltipSetDefaultAnchor;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SStrCmpI(name, "OnTooltipCleared", STORM_MAX_STR)) {
|
||||||
|
return &this->m_onTooltipCleared;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SStrCmpI(name, "OnTooltipAddMoney", STORM_MAX_STR)) {
|
||||||
|
data.wrapper = "return function(self,cost,maxcost) %s end";
|
||||||
|
return &this->m_onTooltipAddMoney;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SStrCmpI(name, "OnTooltipSetUnit", STORM_MAX_STR)) {
|
||||||
|
return &this->m_onTooltipSetUnit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SStrCmpI(name, "OnTooltipSetItem", STORM_MAX_STR)) {
|
||||||
|
return &this->m_onTooltipSetItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SStrCmpI(name, "OnTooltipSetSpell", STORM_MAX_STR)) {
|
||||||
|
return &this->m_onTooltipSetSpell;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SStrCmpI(name, "OnTooltipSetQuest", STORM_MAX_STR)) {
|
||||||
|
return &this->m_onTooltipSetQuest;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SStrCmpI(name, "OnTooltipSetAchievement", STORM_MAX_STR)) {
|
||||||
|
return &this->m_onTooltipSetAchievement;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SStrCmpI(name, "OnTooltipSetEquipmentSet", STORM_MAX_STR)) {
|
||||||
|
return &this->m_onTooltipSetEquipmentSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SStrCmpI(name, "OnTooltipSetFrameStack", STORM_MAX_STR)) {
|
||||||
|
return &this->m_onTooltipSetFrameStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,17 +8,33 @@ class CGTooltip : public CSimpleFrame {
|
|||||||
public:
|
public:
|
||||||
// Static variables
|
// Static variables
|
||||||
static int32_t s_metatable;
|
static int32_t s_metatable;
|
||||||
|
static int32_t s_objectType;
|
||||||
|
|
||||||
// Static functions
|
// Static functions
|
||||||
static CSimpleFrame* Create(CSimpleFrame* parent);
|
static CSimpleFrame* Create(CSimpleFrame* parent);
|
||||||
static void CreateScriptMetaTable();
|
static void CreateScriptMetaTable();
|
||||||
|
static int32_t GetObjectType();
|
||||||
static void RegisterScriptMethods(lua_State* L);
|
static void RegisterScriptMethods(lua_State* L);
|
||||||
|
|
||||||
// Virtual member functions
|
|
||||||
virtual int32_t GetScriptMetaTable();
|
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
CGTooltip(CSimpleFrame* parent);
|
CGTooltip(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_onTooltipSetDefaultAnchor;
|
||||||
|
ScriptIx m_onTooltipCleared;
|
||||||
|
ScriptIx m_onTooltipAddMoney;
|
||||||
|
ScriptIx m_onTooltipSetUnit;
|
||||||
|
ScriptIx m_onTooltipSetItem;
|
||||||
|
ScriptIx m_onTooltipSetSpell;
|
||||||
|
ScriptIx m_onTooltipSetQuest;
|
||||||
|
ScriptIx m_onTooltipSetAchievement;
|
||||||
|
ScriptIx m_onTooltipSetEquipmentSet;
|
||||||
|
ScriptIx m_onTooltipSetFrameStack;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GAME_UI_CGTOOLTIP_HPP
|
#endif // GAME_UI_CGTOOLTIP_HPP
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
#include "gameui/CGTabardModelFrame.hpp"
|
#include "gameui/CGTabardModelFrame.hpp"
|
||||||
#include "gameui/CGQuestPOIFrame.hpp"
|
#include "gameui/CGQuestPOIFrame.hpp"
|
||||||
#include "console/Console.hpp"
|
#include "console/Console.hpp"
|
||||||
|
#include "gx/CGVideoOptions.hpp"
|
||||||
#include "ui/FrameXML.hpp"
|
#include "ui/FrameXML.hpp"
|
||||||
#include "ui/FrameScript.hpp"
|
#include "ui/FrameScript.hpp"
|
||||||
#include "util/Lua.hpp"
|
#include "util/Lua.hpp"
|
||||||
@ -1690,6 +1691,7 @@ void LoadScriptFunctions() {
|
|||||||
GlyphInfoRegisterScriptFunctions();
|
GlyphInfoRegisterScriptFunctions();
|
||||||
AchievementInfoRegisterScriptFunctions();
|
AchievementInfoRegisterScriptFunctions();
|
||||||
CurrencyTypesRegisterScriptFunctions();
|
CurrencyTypesRegisterScriptFunctions();
|
||||||
|
CGVideoOptions::RegisterScriptFunctions();
|
||||||
EquipmentManagerRegisterScriptFunctions();
|
EquipmentManagerRegisterScriptFunctions();
|
||||||
GMTicketInfoRegisterScriptFunctions();
|
GMTicketInfoRegisterScriptFunctions();
|
||||||
BattlenetUIRegisterScriptFunctions();
|
BattlenetUIRegisterScriptFunctions();
|
||||||
|
|||||||
@ -13,7 +13,9 @@ static int32_t Script_GetActionTexture(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_GetActionCount(lua_State* L) {
|
static int32_t Script_GetActionCount(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushnumber(L, 0.0);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_GetActionCooldown(lua_State* L) {
|
static int32_t Script_GetActionCooldown(lua_State* L) {
|
||||||
@ -29,7 +31,9 @@ static int32_t Script_GetActionText(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_HasAction(lua_State* L) {
|
static int32_t Script_HasAction(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushnil(L);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_UseAction(lua_State* L) {
|
static int32_t Script_UseAction(lua_State* L) {
|
||||||
@ -81,11 +85,14 @@ static int32_t Script_IsActionInRange(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_GetBonusBarOffset(lua_State* L) {
|
static int32_t Script_GetBonusBarOffset(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushnumber(L, 0.0);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_GetMultiCastBarOffset(lua_State* L) {
|
static int32_t Script_GetMultiCastBarOffset(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
lua_pushnumber(L, 6.0);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_ChangeActionBarPage(lua_State* L) {
|
static int32_t Script_ChangeActionBarPage(lua_State* L) {
|
||||||
|
|||||||
@ -1,11 +1,43 @@
|
|||||||
#include "gameui/GameScriptFunctions.hpp"
|
#include "gameui/GameScriptFunctions.hpp"
|
||||||
#include "ui/FrameScript.hpp"
|
#include "ui/FrameScript.hpp"
|
||||||
|
#include "db/Db.hpp"
|
||||||
#include "util/Lua.hpp"
|
#include "util/Lua.hpp"
|
||||||
#include "util/Unimplemented.hpp"
|
#include "util/Unimplemented.hpp"
|
||||||
|
|
||||||
|
|
||||||
static int32_t Script_GetInventorySlotInfo(lua_State* L) {
|
static int32_t Script_GetInventorySlotInfo(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_GetInventoryItemsForSlot(lua_State* L) {
|
static int32_t Script_GetInventoryItemsForSlot(lua_State* L) {
|
||||||
|
|||||||
@ -5,11 +5,15 @@
|
|||||||
|
|
||||||
|
|
||||||
static int32_t Script_GetNumPartyMembers(lua_State* L) {
|
static int32_t Script_GetNumPartyMembers(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushnumber(L, 0.0);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_GetRealNumPartyMembers(lua_State* L) {
|
static int32_t Script_GetRealNumPartyMembers(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushnumber(L, 0.0);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_GetPartyMember(lua_State* L) {
|
static int32_t Script_GetPartyMember(lua_State* L) {
|
||||||
|
|||||||
@ -5,11 +5,15 @@
|
|||||||
|
|
||||||
|
|
||||||
static int32_t Script_GetNumRaidMembers(lua_State* L) {
|
static int32_t Script_GetNumRaidMembers(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushnumber(L, 0.0);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_GetRealNumRaidMembers(lua_State* L) {
|
static int32_t Script_GetRealNumRaidMembers(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushnumber(L, 0.0);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_GetRaidRosterInfo(lua_State* L) {
|
static int32_t Script_GetRaidRosterInfo(lua_State* L) {
|
||||||
|
|||||||
@ -52,7 +52,6 @@ static int32_t Script_UnitIsUnit(lua_State* L) {
|
|||||||
|
|
||||||
static int32_t Script_UnitIsPlayer(lua_State* L) {
|
static int32_t Script_UnitIsPlayer(lua_State* L) {
|
||||||
// TODO
|
// TODO
|
||||||
__debugbreak();
|
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -178,39 +177,57 @@ static int32_t Script_UnitPVPName(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_UnitXP(lua_State* L) {
|
static int32_t Script_UnitXP(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushnumber(L, 50.0);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_UnitXPMax(lua_State* L) {
|
static int32_t Script_UnitXPMax(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushnumber(L, 100.0);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_UnitHealth(lua_State* L) {
|
static int32_t Script_UnitHealth(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushnumber(L, 50.0);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_UnitHealthMax(lua_State* L) {
|
static int32_t Script_UnitHealthMax(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushnumber(L, 100.0);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_UnitMana(lua_State* L) {
|
static int32_t Script_UnitMana(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushnumber(L, 50.0);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_UnitManaMax(lua_State* L) {
|
static int32_t Script_UnitManaMax(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushnumber(L, 100.0);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_UnitPower(lua_State* L) {
|
static int32_t Script_UnitPower(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushnumber(L, 50.0);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_UnitPowerMax(lua_State* L) {
|
static int32_t Script_UnitPowerMax(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushnumber(L, 100.0);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_UnitPowerType(lua_State* L) {
|
static int32_t Script_UnitPowerType(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushnumber(L, 0.0);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_UnitOnTaxi(lua_State* L) {
|
static int32_t Script_UnitOnTaxi(lua_State* L) {
|
||||||
@ -222,15 +239,21 @@ static int32_t Script_UnitIsFeignDeath(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_UnitIsDead(lua_State* L) {
|
static int32_t Script_UnitIsDead(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushboolean(L, 0);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_UnitIsGhost(lua_State* L) {
|
static int32_t Script_UnitIsGhost(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushboolean(L, 0);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_UnitIsDeadOrGhost(lua_State* L) {
|
static int32_t Script_UnitIsDeadOrGhost(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushboolean(L, 0);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_UnitIsConnected(lua_State* L) {
|
static int32_t Script_UnitIsConnected(lua_State* L) {
|
||||||
|
|||||||
@ -21,7 +21,9 @@ static int32_t Script_StopMusic(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_Sound_GameSystem_GetNumInputDrivers(lua_State* L) {
|
static int32_t Script_Sound_GameSystem_GetNumInputDrivers(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushnumber(L, 0.0);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_Sound_GameSystem_GetInputDriverNameByIndex(lua_State* L) {
|
static int32_t Script_Sound_GameSystem_GetInputDriverNameByIndex(lua_State* L) {
|
||||||
@ -29,7 +31,9 @@ static int32_t Script_Sound_GameSystem_GetInputDriverNameByIndex(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_Sound_GameSystem_GetNumOutputDrivers(lua_State* L) {
|
static int32_t Script_Sound_GameSystem_GetNumOutputDrivers(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushnumber(L, 0.0);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_Sound_GameSystem_GetOutputDriverNameByIndex(lua_State* L) {
|
static int32_t Script_Sound_GameSystem_GetOutputDriverNameByIndex(lua_State* L) {
|
||||||
@ -41,7 +45,9 @@ static int32_t Script_Sound_GameSystem_RestartSoundSystem(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_Sound_ChatSystem_GetNumInputDrivers(lua_State* L) {
|
static int32_t Script_Sound_ChatSystem_GetNumInputDrivers(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushnumber(L, 0.0);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_Sound_ChatSystem_GetInputDriverNameByIndex(lua_State* L) {
|
static int32_t Script_Sound_ChatSystem_GetInputDriverNameByIndex(lua_State* L) {
|
||||||
@ -49,7 +55,9 @@ static int32_t Script_Sound_ChatSystem_GetInputDriverNameByIndex(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_Sound_ChatSystem_GetNumOutputDrivers(lua_State* L) {
|
static int32_t Script_Sound_ChatSystem_GetNumOutputDrivers(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO
|
||||||
|
lua_pushnumber(L, 0.0);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Script_Sound_ChatSystem_GetOutputDriverNameByIndex(lua_State* L) {
|
static int32_t Script_Sound_ChatSystem_GetOutputDriverNameByIndex(lua_State* L) {
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
void OsOutputDebugString(const char* format, ...) {
|
void OsOutputDebugString(const char* format, ...) {
|
||||||
char buffer[256];
|
char buffer[512];
|
||||||
|
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
|
|||||||
@ -128,7 +128,18 @@ int32_t CSimpleButton_SetFontString(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleButton_GetFontString(lua_State* L) {
|
int32_t CSimpleButton_GetFontString(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
auto type = CSimpleButton::GetObjectType();
|
||||||
|
auto button = static_cast<CSimpleButton*>(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;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleButton_SetText(lua_State* L) {
|
int32_t CSimpleButton_SetText(lua_State* L) {
|
||||||
|
|||||||
@ -450,6 +450,19 @@ 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<char*>(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) {
|
void CSimpleFrame::PreLoadXML(XMLNode* node, CStatus* status) {
|
||||||
const char* name = node->GetAttributeByName("name");
|
const char* name = node->GetAttributeByName("name");
|
||||||
|
|
||||||
@ -700,7 +713,58 @@ int32_t CSimpleFrame::HideThis() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CSimpleFrame::LoadXML_Attributes(XMLNode* node, CStatus* status) {
|
void CSimpleFrame::LoadXML_Attributes(XMLNode* node, CStatus* status) {
|
||||||
// TODO
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSimpleFrame::LoadXML_Backdrop(XMLNode* node, CStatus* status) {
|
void CSimpleFrame::LoadXML_Backdrop(XMLNode* node, CStatus* status) {
|
||||||
@ -1588,3 +1652,26 @@ void CSimpleFrame::UnregisterRegion(CSimpleRegion* region) {
|
|||||||
|
|
||||||
this->m_regions.UnlinkNode(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;
|
||||||
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
#include "ui/Types.hpp"
|
#include "ui/Types.hpp"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <storm/List.hpp>
|
#include <storm/List.hpp>
|
||||||
|
#include <storm/Hash.hpp>
|
||||||
|
|
||||||
class CBackdropGenerator;
|
class CBackdropGenerator;
|
||||||
class CCharEvent;
|
class CCharEvent;
|
||||||
@ -16,6 +17,11 @@ class CSimpleTitleRegion;
|
|||||||
class CSimpleTop;
|
class CSimpleTop;
|
||||||
struct lua_State;
|
struct lua_State;
|
||||||
|
|
||||||
|
class FRAMEATTR : public TSHashObject<FRAMEATTR, HASHKEY_STRI> {
|
||||||
|
public:
|
||||||
|
int32_t luaRef = -1;
|
||||||
|
};
|
||||||
|
|
||||||
class CSimpleFrame : public CScriptRegion {
|
class CSimpleFrame : public CScriptRegion {
|
||||||
public:
|
public:
|
||||||
// Static members
|
// Static members
|
||||||
@ -79,6 +85,7 @@ class CSimpleFrame : public CScriptRegion {
|
|||||||
TSLink<CSimpleFrame> m_framesLink;
|
TSLink<CSimpleFrame> m_framesLink;
|
||||||
TSLink<CSimpleFrame> m_destroyedLink;
|
TSLink<CSimpleFrame> m_destroyedLink;
|
||||||
TSLink<CSimpleFrame> m_strataLink;
|
TSLink<CSimpleFrame> m_strataLink;
|
||||||
|
TSHashTable<FRAMEATTR, HASHKEY_STRI> m_attributes;
|
||||||
|
|
||||||
// Virtual member functions
|
// Virtual member functions
|
||||||
virtual ~CSimpleFrame();
|
virtual ~CSimpleFrame();
|
||||||
@ -146,6 +153,7 @@ class CSimpleFrame : public CScriptRegion {
|
|||||||
void RunOnShowScript();
|
void RunOnShowScript();
|
||||||
void RunOnSizeChangedScript(float width, float height);
|
void RunOnSizeChangedScript(float width, float height);
|
||||||
void RunOnUpdateScript(float elapsedSec);
|
void RunOnUpdateScript(float elapsedSec);
|
||||||
|
void RunOnAttributeChangedScript(const char* name, int32_t luaRef);
|
||||||
void SetBackdrop(CBackdropGenerator* backdrop);
|
void SetBackdrop(CBackdropGenerator* backdrop);
|
||||||
void SetBeingScrolled(int32_t a2, int32_t a3);
|
void SetBeingScrolled(int32_t a2, int32_t a3);
|
||||||
void SetFrameAlpha(uint8_t alpha);
|
void SetFrameAlpha(uint8_t alpha);
|
||||||
@ -158,6 +166,9 @@ class CSimpleFrame : public CScriptRegion {
|
|||||||
void Show();
|
void Show();
|
||||||
int32_t TestHitRect(const C2Vector& pt);
|
int32_t TestHitRect(const C2Vector& pt);
|
||||||
void UnregisterForEvents(int32_t a2);
|
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
|
#endif
|
||||||
|
|||||||
@ -231,11 +231,95 @@ int32_t CSimpleFrame_CanChangeAttributes(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleFrame_GetAttribute(lua_State* L) {
|
int32_t CSimpleFrame_GetAttribute(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
auto type = CSimpleFrame::GetObjectType();
|
||||||
|
auto frame = static_cast<CSimpleFrame*>(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;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleFrame_SetAttribute(lua_State* L) {
|
int32_t CSimpleFrame_SetAttribute(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
auto type = CSimpleFrame::GetObjectType();
|
||||||
|
auto frame = static_cast<CSimpleFrame*>(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;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleFrame_GetEffectiveScale(lua_State* L) {
|
int32_t CSimpleFrame_GetEffectiveScale(lua_State* L) {
|
||||||
|
|||||||
39
src/ui/CSimpleMessageFrame.cpp
Normal file
39
src/ui/CSimpleMessageFrame.cpp
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#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;
|
||||||
|
}
|
||||||
25
src/ui/CSimpleMessageFrame.hpp
Normal file
25
src/ui/CSimpleMessageFrame.hpp
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#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
|
||||||
68
src/ui/CSimpleMessageFrameScript.cpp
Normal file
68
src/ui/CSimpleMessageFrameScript.cpp
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
#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 }
|
||||||
|
};
|
||||||
10
src/ui/CSimpleMessageFrameScript.hpp
Normal file
10
src/ui/CSimpleMessageFrameScript.hpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#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
|
||||||
59
src/ui/CSimpleStatusBar.cpp
Normal file
59
src/ui/CSimpleStatusBar.cpp
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
#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;
|
||||||
|
}
|
||||||
30
src/ui/CSimpleStatusBar.hpp
Normal file
30
src/ui/CSimpleStatusBar.hpp
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#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
|
||||||
68
src/ui/CSimpleStatusBarScript.cpp
Normal file
68
src/ui/CSimpleStatusBarScript.cpp
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
#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 }
|
||||||
|
};
|
||||||
10
src/ui/CSimpleStatusBarScript.hpp
Normal file
10
src/ui/CSimpleStatusBarScript.hpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#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
|
||||||
@ -8,8 +8,10 @@
|
|||||||
#include "ui/CSimpleModel.hpp"
|
#include "ui/CSimpleModel.hpp"
|
||||||
#include "ui/CSimpleMovieFrame.hpp"
|
#include "ui/CSimpleMovieFrame.hpp"
|
||||||
#include "ui/CSimpleScrollFrame.hpp"
|
#include "ui/CSimpleScrollFrame.hpp"
|
||||||
|
#include "ui/CSimpleMessageFrame.hpp"
|
||||||
#include "ui/CSimpleMessageScrollFrame.hpp"
|
#include "ui/CSimpleMessageScrollFrame.hpp"
|
||||||
#include "ui/CSimpleSlider.hpp"
|
#include "ui/CSimpleSlider.hpp"
|
||||||
|
#include "ui/CSimpleStatusBar.hpp"
|
||||||
#include "util/CStatus.hpp"
|
#include "util/CStatus.hpp"
|
||||||
#include "util/SFile.hpp"
|
#include "util/SFile.hpp"
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
@ -56,7 +58,8 @@ CSimpleFrame* Create_SimpleFrame(CSimpleFrame* parent) {
|
|||||||
CSimpleFrame* Create_SimpleMessageFrame(CSimpleFrame* parent) {
|
CSimpleFrame* Create_SimpleMessageFrame(CSimpleFrame* parent) {
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
return nullptr;
|
auto m = SMemAlloc(sizeof(CSimpleMessageFrame), __FILE__, __LINE__, 0x0);
|
||||||
|
return new (m) CSimpleMessageFrame(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
CSimpleFrame* Create_SimpleModel(CSimpleFrame* parent) {
|
CSimpleFrame* Create_SimpleModel(CSimpleFrame* parent) {
|
||||||
@ -101,7 +104,8 @@ CSimpleFrame* Create_SimpleHTML(CSimpleFrame* parent) {
|
|||||||
CSimpleFrame* Create_SimpleStatusBar(CSimpleFrame* parent) {
|
CSimpleFrame* Create_SimpleStatusBar(CSimpleFrame* parent) {
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
return nullptr;
|
auto m = SMemAlloc(sizeof(CSimpleStatusBar), __FILE__, __LINE__, 0x0);
|
||||||
|
return new (m) CSimpleStatusBar(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
CSimpleFrame* Create_SimpleColorSelect(CSimpleFrame* parent) {
|
CSimpleFrame* Create_SimpleColorSelect(CSimpleFrame* parent) {
|
||||||
|
|||||||
@ -12,7 +12,9 @@
|
|||||||
#include "ui/CSimpleScrollFrame.hpp"
|
#include "ui/CSimpleScrollFrame.hpp"
|
||||||
#include "ui/CSimpleSlider.hpp"
|
#include "ui/CSimpleSlider.hpp"
|
||||||
#include "ui/CSimpleTexture.hpp"
|
#include "ui/CSimpleTexture.hpp"
|
||||||
|
#include "ui/CSimpleMessageFrame.hpp"
|
||||||
#include "ui/CSimpleMessageScrollFrame.hpp"
|
#include "ui/CSimpleMessageScrollFrame.hpp"
|
||||||
|
#include "ui/CSimpleStatusBar.hpp"
|
||||||
#include "ui/FrameScript.hpp"
|
#include "ui/FrameScript.hpp"
|
||||||
|
|
||||||
void CharacterCreateRegisterScriptFunctions() {
|
void CharacterCreateRegisterScriptFunctions() {
|
||||||
@ -78,8 +80,7 @@ void RegisterSimpleFrameScriptMethods() {
|
|||||||
CSimpleEditBox::CreateScriptMetaTable();
|
CSimpleEditBox::CreateScriptMetaTable();
|
||||||
CSimpleHTML::CreateScriptMetaTable();
|
CSimpleHTML::CreateScriptMetaTable();
|
||||||
|
|
||||||
// TODO
|
CSimpleMessageFrame::CreateScriptMetaTable();
|
||||||
// CSimpleMessageFrame::CreateScriptMetaTable();
|
|
||||||
CSimpleMessageScrollFrame::CreateScriptMetaTable();
|
CSimpleMessageScrollFrame::CreateScriptMetaTable();
|
||||||
|
|
||||||
CSimpleModel::CreateScriptMetaTable();
|
CSimpleModel::CreateScriptMetaTable();
|
||||||
@ -88,7 +89,7 @@ void RegisterSimpleFrameScriptMethods() {
|
|||||||
CSimpleSlider::CreateScriptMetaTable();
|
CSimpleSlider::CreateScriptMetaTable();
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
// CSimpleStatusBar::CreateScriptMetaTable();
|
CSimpleStatusBar::CreateScriptMetaTable();
|
||||||
// CSimpleColorSelect::CreateScriptMetaTable();
|
// CSimpleColorSelect::CreateScriptMetaTable();
|
||||||
CSimpleMovieFrame::CreateScriptMetaTable();
|
CSimpleMovieFrame::CreateScriptMetaTable();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
#include "util/CStatus.hpp"
|
#include "util/CStatus.hpp"
|
||||||
|
#include "os/Debug.hpp"
|
||||||
#include <cstdarg>
|
#include <cstdarg>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
@ -19,9 +20,15 @@ void CStatus::Add(STATUS_TYPE severity, const char* format, ...) {
|
|||||||
// Remove temporary console debug logging
|
// Remove temporary console debug logging
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
vprintf(format, args);
|
|
||||||
printf("\n");
|
char output[490];
|
||||||
|
auto length = vsnprintf(output, sizeof(output), format, args);
|
||||||
|
if (length >= sizeof(output)) {
|
||||||
|
output[sizeof(output) - 1] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
OsOutputDebugString("CStatus: %s\n", output);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CStatus::Prepend(STATUS_TYPE severity, const char* format, ...) {
|
void CStatus::Prepend(STATUS_TYPE severity, const char* format, ...) {
|
||||||
@ -29,9 +36,15 @@ void CStatus::Prepend(STATUS_TYPE severity, const char* format, ...) {
|
|||||||
// Remove temporary console debug logging
|
// Remove temporary console debug logging
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
vprintf(format, args);
|
|
||||||
printf("\n");
|
char output[490];
|
||||||
|
auto length = vsnprintf(output, sizeof(output), format, args);
|
||||||
|
if (length >= sizeof(output)) {
|
||||||
|
output[sizeof(output) - 1] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
OsOutputDebugString("CStatus: %s\n", output);
|
||||||
}
|
}
|
||||||
|
|
||||||
CStatus& GetGlobalStatusObj() {
|
CStatus& GetGlobalStatusObj() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user