mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 08:00:42 +00:00
feat: engine pieces for retail's ScrollBox
What the ScrollBox port needs from the DLL, and three engine bugs it hit. Fixes: - GetWidth / GetHeight answer a rect-derived size over the layout scale, as 4.3.4 does. 1.12's getters leave the division out, so an anchored region under a UI scale read scaled (a 160-high track at 0.91 answered 145.6, and the scroll bar thumb stopped short). GetRect and GetScaledRect use them. - A <Size>, <Anchor> or <Offset> with only `x` applies. The engine's dimension reader decides "no attributes" from `y` alone; a co-hook answers as 4.3.4 does. Xml::Anchors' "0" attribute workaround goes. - KeyValue type="global" walks a dotted path, as retail's own templates need (ScrollControllerMixin.Directions.Decrease). New: - <Texture atlas="..." useAtlasSize="...">, applied as SetAtlas. - securecall / securecallfunction / secureexecuterange, as probed on retail: results returned, errors to the error handler, the range walk goes on after one. - AddSourceLocationExclude(fileName): GetSourceLocation steps over that file's levels. - region:AdjustPointsOffset(x, y) / ClearPointsOffset(), re-setting each anchor through the engine's SetPoint. Retail, probed: Clear zeroes the offsets rather than undoing adjustments. - Enum.InputContext.
This commit is contained in:
+27
-4
@@ -23,7 +23,10 @@
|
||||
//
|
||||
// Each entry is `object[key] = value`. `type` and `keyType` (default
|
||||
// "string") are one of nil / boolean / number / string / global, the later
|
||||
// clients' KEYVALUETYPE; "global" is `_G[text]`. Booleans and numbers go
|
||||
// clients' KEYVALUETYPE; "global" is `_G[text]`, walking a dotted path a
|
||||
// field at a time: retail's own templates use
|
||||
// "ScrollControllerMixin.Directions.Decrease". A step that is not a table
|
||||
// gives nil. Booleans and numbers go
|
||||
// through the same loader helpers as `<Attributes>` (FUN_XML_ATTR_TO_BOOL,
|
||||
// FUN_SSTR_TO_FLOAT).
|
||||
//
|
||||
@@ -42,6 +45,8 @@
|
||||
#include "baselib/Ascii.h"
|
||||
#include "xml/FrameLoad.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
namespace Xml::KeyValues {
|
||||
|
||||
namespace {
|
||||
@@ -75,10 +80,28 @@ void Push(void *L, Kind kind, const char *text) {
|
||||
case Kind::String:
|
||||
Game::Lua::PushString(L, text);
|
||||
break;
|
||||
case Kind::Global:
|
||||
Game::Lua::PushString(L, text);
|
||||
Game::Lua::GetTable(L, Game::Lua::GLOBALS_INDEX);
|
||||
case Kind::Global: {
|
||||
Game::Lua::PushValue(L, Game::Lua::GLOBALS_INDEX);
|
||||
const char *start = text;
|
||||
for (;;) {
|
||||
const char *dot = std::strchr(start, '.');
|
||||
if (Game::Lua::Type(L, -1) != Game::Lua::TYPE_TABLE) {
|
||||
Game::Lua::SetTop(L, -2);
|
||||
Game::Lua::PushNil(L);
|
||||
break;
|
||||
}
|
||||
if (dot == nullptr)
|
||||
Game::Lua::PushString(L, start);
|
||||
else
|
||||
Game::Lua::PushLString(L, start, static_cast<unsigned>(dot - start));
|
||||
Game::Lua::GetTable(L, -2);
|
||||
Game::Lua::Remove(L, -2);
|
||||
if (dot == nullptr)
|
||||
break;
|
||||
start = dot + 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
Game::Lua::PushNil(L);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user