mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-19 06:01:07 +03:00
Compare commits
8 Commits
8536130f8c
...
b5a12b972d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b5a12b972d | ||
|
|
7d911e453d | ||
|
|
d34336cd7e | ||
|
|
3bf95af10c | ||
|
|
0681e432e2 | ||
|
|
66fd4a6564 | ||
|
|
c201da76cd | ||
|
|
4a102c6ace |
@ -47,6 +47,7 @@ float CGlueMgr::m_aspect;
|
|||||||
bool CGlueMgr::m_authenticated;
|
bool CGlueMgr::m_authenticated;
|
||||||
const CharacterSelectionDisplay* CGlueMgr::m_characterInfo;
|
const CharacterSelectionDisplay* CGlueMgr::m_characterInfo;
|
||||||
int32_t CGlueMgr::m_clientKickReason;
|
int32_t CGlueMgr::m_clientKickReason;
|
||||||
|
int32_t CGlueMgr::m_contestAccepted = 1; // TODO
|
||||||
char CGlueMgr::m_currentScreen[64];
|
char CGlueMgr::m_currentScreen[64];
|
||||||
EffectDeath* CGlueMgr::m_deathEffect;
|
EffectDeath* CGlueMgr::m_deathEffect;
|
||||||
int32_t CGlueMgr::m_disconnectPending;
|
int32_t CGlueMgr::m_disconnectPending;
|
||||||
|
|||||||
@ -41,6 +41,7 @@ class CGlueMgr {
|
|||||||
static bool m_authenticated;
|
static bool m_authenticated;
|
||||||
static const CharacterSelectionDisplay* m_characterInfo;
|
static const CharacterSelectionDisplay* m_characterInfo;
|
||||||
static int32_t m_clientKickReason;
|
static int32_t m_clientKickReason;
|
||||||
|
static int32_t m_contestAccepted;
|
||||||
static char m_currentScreen[];
|
static char m_currentScreen[];
|
||||||
static EffectDeath* m_deathEffect;
|
static EffectDeath* m_deathEffect;
|
||||||
static int32_t m_disconnectPending;
|
static int32_t m_disconnectPending;
|
||||||
|
|||||||
@ -222,7 +222,14 @@ int32_t Script_ShowContestNotice(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_ContestAccepted(lua_State* L) {
|
int32_t Script_ContestAccepted(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
if (CGlueMgr::m_contestAccepted) {
|
||||||
|
lua_pushnumber(L, 1.0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lua_pushnil(L);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_AcceptContest(lua_State* L) {
|
int32_t Script_AcceptContest(lua_State* L) {
|
||||||
|
|||||||
164
src/ui/game/ActionBarScript.cpp
Normal file
164
src/ui/game/ActionBarScript.cpp
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
#include "ui/game/ActionBarScript.hpp"
|
||||||
|
#include "ui/FrameScript.hpp"
|
||||||
|
#include "ui/game/CGActionBar.hpp"
|
||||||
|
#include "util/Lua.hpp"
|
||||||
|
#include "util/Unimplemented.hpp"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
int32_t Script_GetActionInfo(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Script_GetActionTexture(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Script_GetActionCount(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Script_GetActionCooldown(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Script_GetActionAutocast(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Script_GetActionText(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Script_HasAction(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Script_UseAction(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Script_PickupAction(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Script_PlaceAction(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Script_IsAttackAction(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Script_IsCurrentAction(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Script_IsAutoRepeatAction(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Script_IsUsableAction(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Script_IsConsumableAction(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Script_IsStackableAction(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Script_IsEquippedAction(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Script_ActionHasRange(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Script_IsActionInRange(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Script_GetBonusBarOffset(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Script_GetMultiCastBarOffset(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Script_ChangeActionBarPage(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Script_GetActionBarPage(lua_State* L) {
|
||||||
|
if (CGActionBar::s_tempPageActiveFlags) {
|
||||||
|
lua_pushinteger(L, 1);
|
||||||
|
} else {
|
||||||
|
lua_pushinteger(L, CGActionBar::s_currentPage + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Script_GetActionBarToggles(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Script_SetActionBarToggles(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Script_IsPossessBarVisible(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Script_GetMultiCastTotemSpells(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Script_SetMultiCastSpell(lua_State* L) {
|
||||||
|
WHOA_UNIMPLEMENTED(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static FrameScript_Method s_ScriptFunctions[] = {
|
||||||
|
{ "GetActionInfo", &Script_GetActionInfo },
|
||||||
|
{ "GetActionTexture", &Script_GetActionTexture },
|
||||||
|
{ "GetActionCount", &Script_GetActionCount },
|
||||||
|
{ "GetActionCooldown", &Script_GetActionCooldown },
|
||||||
|
{ "GetActionAutocast", &Script_GetActionAutocast },
|
||||||
|
{ "GetActionText", &Script_GetActionText },
|
||||||
|
{ "HasAction", &Script_HasAction },
|
||||||
|
{ "UseAction", &Script_UseAction },
|
||||||
|
{ "PickupAction", &Script_PickupAction },
|
||||||
|
{ "PlaceAction", &Script_PlaceAction },
|
||||||
|
{ "IsAttackAction", &Script_IsAttackAction },
|
||||||
|
{ "IsCurrentAction", &Script_IsCurrentAction },
|
||||||
|
{ "IsAutoRepeatAction", &Script_IsAutoRepeatAction },
|
||||||
|
{ "IsUsableAction", &Script_IsUsableAction },
|
||||||
|
{ "IsConsumableAction", &Script_IsConsumableAction },
|
||||||
|
{ "IsStackableAction", &Script_IsStackableAction },
|
||||||
|
{ "IsEquippedAction", &Script_IsEquippedAction },
|
||||||
|
{ "ActionHasRange", &Script_ActionHasRange },
|
||||||
|
{ "IsActionInRange", &Script_IsActionInRange },
|
||||||
|
{ "GetBonusBarOffset", &Script_GetBonusBarOffset },
|
||||||
|
{ "GetMultiCastBarOffset", &Script_GetMultiCastBarOffset },
|
||||||
|
{ "ChangeActionBarPage", &Script_ChangeActionBarPage },
|
||||||
|
{ "GetActionBarPage", &Script_GetActionBarPage },
|
||||||
|
{ "GetActionBarToggles", &Script_GetActionBarToggles },
|
||||||
|
{ "SetActionBarToggles", &Script_SetActionBarToggles },
|
||||||
|
{ "IsPossessBarVisible", &Script_IsPossessBarVisible },
|
||||||
|
{ "GetMultiCastTotemSpells", &Script_GetMultiCastTotemSpells },
|
||||||
|
{ "SetMultiCastSpell", &Script_SetMultiCastSpell },
|
||||||
|
};
|
||||||
|
|
||||||
|
void ActionBarRegisterScriptFunctions() {
|
||||||
|
for (auto& func : s_ScriptFunctions) {
|
||||||
|
FrameScript_RegisterFunction(func.name, func.method);
|
||||||
|
}
|
||||||
|
}
|
||||||
6
src/ui/game/ActionBarScript.hpp
Normal file
6
src/ui/game/ActionBarScript.hpp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#ifndef UI_GAME_ACTION_BAR_SCRIPT_HPP
|
||||||
|
#define UI_GAME_ACTION_BAR_SCRIPT_HPP
|
||||||
|
|
||||||
|
void ActionBarRegisterScriptFunctions();
|
||||||
|
|
||||||
|
#endif
|
||||||
4
src/ui/game/CGActionBar.cpp
Normal file
4
src/ui/game/CGActionBar.cpp
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#include "ui/game/CGActionBar.hpp"
|
||||||
|
|
||||||
|
uint32_t CGActionBar::s_currentPage;
|
||||||
|
uint32_t CGActionBar::s_tempPageActiveFlags;
|
||||||
13
src/ui/game/CGActionBar.hpp
Normal file
13
src/ui/game/CGActionBar.hpp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#ifndef UI_GAME_C_G_ACTION_BAR_HPP
|
||||||
|
#define UI_GAME_C_G_ACTION_BAR_HPP
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
class CGActionBar {
|
||||||
|
public:
|
||||||
|
// Static variables
|
||||||
|
static uint32_t s_currentPage;
|
||||||
|
static uint32_t s_tempPageActiveFlags;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -3,6 +3,7 @@
|
|||||||
#include "ui/CScriptObject.hpp"
|
#include "ui/CScriptObject.hpp"
|
||||||
#include "ui/FrameXML.hpp"
|
#include "ui/FrameXML.hpp"
|
||||||
#include "ui/Key.hpp"
|
#include "ui/Key.hpp"
|
||||||
|
#include "ui/game/ActionBarScript.hpp"
|
||||||
#include "ui/game/BattlefieldInfoScript.hpp"
|
#include "ui/game/BattlefieldInfoScript.hpp"
|
||||||
#include "ui/game/CGCharacterModelBase.hpp"
|
#include "ui/game/CGCharacterModelBase.hpp"
|
||||||
#include "ui/game/CGCooldown.hpp"
|
#include "ui/game/CGCooldown.hpp"
|
||||||
@ -46,6 +47,10 @@ void LoadScriptFunctions() {
|
|||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
|
ActionBarRegisterScriptFunctions();
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
|
||||||
CharacterInfoRegisterScriptFunctions();
|
CharacterInfoRegisterScriptFunctions();
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|||||||
@ -95,6 +95,10 @@ void CSimpleFrame::AddFrameRegion(CSimpleRegion* region, uint32_t drawlayer) {
|
|||||||
this->NotifyDrawLayerChanged(drawlayer);
|
this->NotifyDrawLayerChanged(drawlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t CSimpleFrame::AttributeChangesAllowed() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void CSimpleFrame::DisableDrawLayer(uint32_t drawlayer) {
|
void CSimpleFrame::DisableDrawLayer(uint32_t drawlayer) {
|
||||||
this->m_drawenabled[drawlayer] = 0;
|
this->m_drawenabled[drawlayer] = 0;
|
||||||
this->NotifyDrawLayerChanged(drawlayer);
|
this->NotifyDrawLayerChanged(drawlayer);
|
||||||
|
|||||||
@ -128,6 +128,7 @@ class CSimpleFrame : public CScriptRegion {
|
|||||||
// Member functions
|
// Member functions
|
||||||
CSimpleFrame(CSimpleFrame* parent);
|
CSimpleFrame(CSimpleFrame* parent);
|
||||||
void AddFrameRegion(CSimpleRegion* region, uint32_t drawlayer);
|
void AddFrameRegion(CSimpleRegion* region, uint32_t drawlayer);
|
||||||
|
int32_t AttributeChangesAllowed();
|
||||||
void DisableDrawLayer(uint32_t drawlayer);
|
void DisableDrawLayer(uint32_t drawlayer);
|
||||||
void DisableEvent(CSimpleEventType eventType);
|
void DisableEvent(CSimpleEventType eventType);
|
||||||
void EnableDrawLayer(uint32_t drawlayer);
|
void EnableDrawLayer(uint32_t drawlayer);
|
||||||
|
|||||||
@ -180,11 +180,197 @@ 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));
|
||||||
|
|
||||||
|
// 3 argument form
|
||||||
|
|
||||||
|
if (lua_gettop(L) == 4 && lua_isstring(L, 3)) {
|
||||||
|
size_t prefixLen, nameLen, suffixLen;
|
||||||
|
auto prefix = lua_tolstring(L, 2, &prefixLen);
|
||||||
|
auto name = lua_tolstring(L, 3, &nameLen);
|
||||||
|
auto suffix = lua_tolstring(L, 4, &suffixLen);
|
||||||
|
|
||||||
|
char buffer[256];
|
||||||
|
char* write;
|
||||||
|
size_t remaining;
|
||||||
|
size_t copyLen;
|
||||||
|
|
||||||
|
int32_t luaRef;
|
||||||
|
|
||||||
|
// Attempt 1: prefix + name + suffix
|
||||||
|
|
||||||
|
write = buffer;
|
||||||
|
remaining = 255;
|
||||||
|
|
||||||
|
if (prefixLen > 0) {
|
||||||
|
copyLen = (prefixLen < remaining) ? prefixLen : remaining;
|
||||||
|
memcpy(write, prefix, copyLen);
|
||||||
|
write += copyLen;
|
||||||
|
remaining -= copyLen;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nameLen > 0) {
|
||||||
|
copyLen = (nameLen < remaining) ? nameLen : remaining;
|
||||||
|
memcpy(write, name, copyLen);
|
||||||
|
write += copyLen;
|
||||||
|
remaining -= copyLen;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (suffixLen > 0) {
|
||||||
|
copyLen = (suffixLen < remaining) ? suffixLen : remaining;
|
||||||
|
memcpy(write, suffix, copyLen);
|
||||||
|
write += copyLen;
|
||||||
|
}
|
||||||
|
|
||||||
|
*write = '\0';
|
||||||
|
|
||||||
|
if (frame->GetAttribute(buffer, luaRef)) {
|
||||||
|
lua_rawgeti(L, LUA_REGISTRYINDEX, luaRef);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attempt 2: "*" + name + suffix
|
||||||
|
|
||||||
|
write = buffer;
|
||||||
|
*write++ = '*';
|
||||||
|
remaining = 254;
|
||||||
|
|
||||||
|
if (nameLen > 0) {
|
||||||
|
copyLen = (nameLen < remaining) ? nameLen : remaining;
|
||||||
|
memcpy(write, name, copyLen);
|
||||||
|
write += copyLen;
|
||||||
|
remaining -= copyLen;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (suffixLen > 0) {
|
||||||
|
copyLen = (suffixLen < remaining) ? suffixLen : remaining;
|
||||||
|
memcpy(write, suffix, copyLen);
|
||||||
|
write += copyLen;
|
||||||
|
}
|
||||||
|
|
||||||
|
*write = '\0';
|
||||||
|
|
||||||
|
if (frame->GetAttribute(buffer, luaRef)) {
|
||||||
|
lua_rawgeti(L, LUA_REGISTRYINDEX, luaRef);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attempt 3: prefix + name + "*"
|
||||||
|
|
||||||
|
write = buffer;
|
||||||
|
remaining = 254;
|
||||||
|
|
||||||
|
if (prefixLen > 0) {
|
||||||
|
copyLen = (prefixLen < remaining) ? prefixLen : remaining;
|
||||||
|
memcpy(write, prefix, copyLen);
|
||||||
|
write += copyLen;
|
||||||
|
remaining -= copyLen;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nameLen > 0) {
|
||||||
|
copyLen = (nameLen < remaining) ? nameLen : remaining;
|
||||||
|
memcpy(write, name, copyLen);
|
||||||
|
write += copyLen;
|
||||||
|
}
|
||||||
|
|
||||||
|
*write++ = '*';
|
||||||
|
*write = '\0';
|
||||||
|
|
||||||
|
if (frame->GetAttribute(buffer, luaRef)) {
|
||||||
|
lua_rawgeti(L, LUA_REGISTRYINDEX, luaRef);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attempt 4: "*" + name + "*"
|
||||||
|
|
||||||
|
write = buffer;
|
||||||
|
*write++ = '*';
|
||||||
|
remaining = 253;
|
||||||
|
|
||||||
|
if (nameLen > 0) {
|
||||||
|
copyLen = (nameLen < remaining) ? nameLen : remaining;
|
||||||
|
memcpy(write, name, copyLen);
|
||||||
|
write += copyLen;
|
||||||
|
}
|
||||||
|
|
||||||
|
*write++ = '*';
|
||||||
|
*write = '\0';
|
||||||
|
|
||||||
|
if (frame->GetAttribute(buffer, luaRef)) {
|
||||||
|
lua_rawgeti(L, LUA_REGISTRYINDEX, luaRef);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attempt 5: name
|
||||||
|
|
||||||
|
if (frame->GetAttribute(name, luaRef)) {
|
||||||
|
lua_rawgeti(L, LUA_REGISTRYINDEX, luaRef);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not found
|
||||||
|
|
||||||
|
lua_pushnil(L);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1 argument form
|
||||||
|
|
||||||
|
if (lua_isstring(L, 2)) {
|
||||||
|
auto attrName = lua_tostring(L, 2);
|
||||||
|
int32_t luaRef;
|
||||||
|
|
||||||
|
if (frame->GetAttribute(attrName, luaRef)) {
|
||||||
|
lua_rawgeti(L, LUA_REGISTRYINDEX, luaRef);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not found
|
||||||
|
|
||||||
|
lua_pushnil(L);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Invalid call
|
||||||
|
|
||||||
|
luaL_error(L, "Usage: %s:GetAttribute(\"name\")", frame->GetDisplayName());
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 disallowed logic
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
lua_settop(L, 3);
|
||||||
|
|
||||||
|
if (!lua_isstring(L, 2) || lua_type(L, 3) == LUA_TNONE) {
|
||||||
|
luaL_error(L, "Usage: %s:SetAttribute(\"name\", value)", frame->GetDisplayName());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto attrName = lua_tostring(L, 2);
|
||||||
|
int32_t luaRef;
|
||||||
|
|
||||||
|
if (frame->GetAttribute(attrName, luaRef)) {
|
||||||
|
luaL_unref(L, LUA_REGISTRYINDEX, luaRef);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO taint management
|
||||||
|
|
||||||
|
luaRef = luaL_ref(L, LUA_REGISTRYINDEX);
|
||||||
|
|
||||||
|
// TODO taint management
|
||||||
|
|
||||||
|
frame->SetAttribute(attrName, luaRef);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleFrame_GetEffectiveScale(lua_State* L) {
|
int32_t CSimpleFrame_GetEffectiveScale(lua_State* L) {
|
||||||
|
|||||||
@ -19,7 +19,25 @@ int32_t CSimpleTexture_GetDrawLayer(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleTexture_SetDrawLayer(lua_State* L) {
|
int32_t CSimpleTexture_SetDrawLayer(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
auto type = CSimpleTexture::GetObjectType();
|
||||||
|
auto texture = static_cast<CSimpleTexture*>(FrameScript_GetObjectThis(L, type));
|
||||||
|
|
||||||
|
if (!lua_isstring(L, 2)) {
|
||||||
|
luaL_error(L, "Usage: %s:SetDrawLayer(\"layer\")", texture->GetDisplayName());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto drawlayerStr = lua_tostring(L, 2);
|
||||||
|
int32_t drawlayer = texture->m_drawlayer;
|
||||||
|
|
||||||
|
if (!StringToDrawLayer(drawlayerStr, drawlayer)) {
|
||||||
|
luaL_error(L, "Usage: %s:SetDrawLayer(\"layer\")", texture->GetDisplayName());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
texture->SetFrame(texture->m_parent, drawlayer, texture->m_shown);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleTexture_GetBlendMode(lua_State* L) {
|
int32_t CSimpleTexture_GetBlendMode(lua_State* L) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user