Frame: port Engine/Frame (waves 1-4), 1667 of 1669 functions
Core (CSimpleFrame + Lua, CSimpleTop/CFrameStrata/CSimpleRender/ CRenderBatch, CSimpleRegion/CBackdropGenerator/CScriptRegion), animation, text (FontString/Font/Fontable), texture and model, buttons, EditBox, MessageFrame/MessageScrollFrame, MovieFrame/ColorSelect/StatusBar, Slider/ScrollFrame/HTML/HyperlinkedFrame, all Lua method tables and RegisterScriptMethods. Layouts, vtables and sizes rebuilt from the 12340 ctors, vtables and allocator initializers; CScriptObject vtable slots 5/6 fixed; CSimpleFontedFrame is a real secondary base. Lua error paths return after luaL_error as in 12340 (209 sites; 5 fall through). Binary quirks kept and documented in docs/. Supporting additions: Event key/char/ime/focus/size event headers, Scrn/Scrn.h (ScrnLayerCreate), DivxDecoder import declarations, C2Vector/CRect helpers, CM2Light dtor, OsInputEnableSecureMode, stpl.h instance addresses, FrameXML LoadXML_AnimGroup/Create_SimpleMovieFrame. Engine->WoW includes where 12340 calls directly: CSimpleModelFFX, StringToMouseButton, GetDeclinedWord, EmblemTextureUpdate. Also drops stale VERIFY stamps found invalid by the harness recheck. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
@@ -1,11 +1,132 @@
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include "Engine/Source/Frame/CSimpleControlPoint.h"
|
||||
#include "Engine/Source/Base/Coordinate.h"
|
||||
#include "Engine/Source/Frame/CSimplePathAnim.h"
|
||||
#include "Engine/Source/Tempest/C2Vector.h"
|
||||
#include "Engine/Source/FrameScript/FrameScript.h"
|
||||
#include "Engine/Source/FrameScript/FrameScript_Object.h"
|
||||
#include "Engine/Source/lua-5.1/src/lauxlib.h"
|
||||
#include "Engine/Source/lua-5.1/src/lua.h"
|
||||
|
||||
// VERIFY: 0a8264fc auto
|
||||
// OFFSET: 0x004A6790
|
||||
static int32_t Script_SetParent(lua_State* L) {
|
||||
CSimpleControlPoint* point = static_cast<CSimpleControlPoint*>(FrameScript_GetObjectThis(L, CSimpleControlPoint::GetObjectType()));
|
||||
|
||||
if (lua_type(L, 2) == LUA_TNIL) {
|
||||
const char* name = point->GetName();
|
||||
luaL_error(L, "%s:SetParent(): Cannot set a 'nil' parent for control points", name ? name : "<unnamed>");
|
||||
return 0;
|
||||
}
|
||||
|
||||
CSimplePathAnim* path = nullptr;
|
||||
|
||||
if (lua_isstring(L, 2)) {
|
||||
path = static_cast<CSimplePathAnim*>(CScriptObject::GetScriptObjectByName(lua_tolstring(L, 2, nullptr), CSimplePathAnim::GetObjectType()));
|
||||
} else if (lua_type(L, 2) == LUA_TTABLE) {
|
||||
lua_rawgeti(L, 2, 0);
|
||||
path = static_cast<CSimplePathAnim*>(lua_touserdata(L, -1));
|
||||
lua_settop(L, -2);
|
||||
|
||||
if (!path) {
|
||||
const char* name = point->GetName();
|
||||
luaL_error(L, "%s:SetParent(): Couldn't find 'this' in parent object", name ? name : "<unnamed>");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!path->IsA(CSimplePathAnim::GetObjectType())) {
|
||||
luaL_error(L, "%s:SetParent(): Wrong parent object type, expected Path", point->GetDisplayName());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!path) {
|
||||
const char* name = point->GetName();
|
||||
luaL_error(L, "%s:SetParent(): Couldn't find Path named '%s'", name ? name : "<unnamed>", lua_tolstring(L, 2, nullptr));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t oldOrder = point->m_order;
|
||||
|
||||
if (lua_isnumber(L, 3)) {
|
||||
point->SetOrder(lua_tointeger(L, 3) - 1, false, false);
|
||||
} else {
|
||||
int32_t order = point->m_order;
|
||||
|
||||
if (order == -1) {
|
||||
order = path->GetMaxControlPointOrder() + 1;
|
||||
}
|
||||
|
||||
point->SetOrder(order, false, true);
|
||||
}
|
||||
|
||||
if (!point->ChangeParent(path) && oldOrder != point->m_order) {
|
||||
path->NotifyOrderChanged(point);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// VERIFY: a0fd78bf auto
|
||||
// OFFSET: 0x004A6980
|
||||
static int32_t Script_SetOffset(lua_State* L) {
|
||||
CSimpleControlPoint* point = static_cast<CSimpleControlPoint*>(FrameScript_GetObjectThis(L, CSimpleControlPoint::GetObjectType()));
|
||||
|
||||
if (!lua_isnumber(L, 2) || !lua_isnumber(L, 3)) {
|
||||
const char* name = point->GetName();
|
||||
luaL_error(L, "Usage: %s:SetOffset(x, y)", name ? name : "<unnamed>");
|
||||
return 0;
|
||||
}
|
||||
|
||||
C2Vector offset;
|
||||
float x = lua_tonumber(L, 2);
|
||||
offset.x = NDCToDDCWidth(x / (CoordinateGetAspectCompensation() * 1024.0f));
|
||||
float y = lua_tonumber(L, 3);
|
||||
offset.y = NDCToDDCWidth(y / (CoordinateGetAspectCompensation() * 1024.0f));
|
||||
point->SetOffset(offset);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// VERIFY: 66dd590a manual
|
||||
// OFFSET: 0x004A6A70
|
||||
static int32_t Script_GetOffset(lua_State* L) {
|
||||
CSimpleControlPoint* point = static_cast<CSimpleControlPoint*>(FrameScript_GetObjectThis(L, CSimpleControlPoint::GetObjectType()));
|
||||
|
||||
float x = point->m_offset.x;
|
||||
float y = point->m_offset.y;
|
||||
x = DDCToNDCWidth(CoordinateGetAspectCompensation() * 1024.0f * x);
|
||||
y = DDCToNDCWidth(CoordinateGetAspectCompensation() * 1024.0f * y);
|
||||
|
||||
lua_pushnumber(L, x);
|
||||
lua_pushnumber(L, y);
|
||||
return 2;
|
||||
}
|
||||
|
||||
// VERIFY: 6c29894d auto
|
||||
// OFFSET: 0x004A6B10
|
||||
static int32_t Script_SetOrder(lua_State* L) {
|
||||
CSimpleControlPoint* point = static_cast<CSimpleControlPoint*>(FrameScript_GetObjectThis(L, CSimpleControlPoint::GetObjectType()));
|
||||
|
||||
if (!lua_isnumber(L, 2)) {
|
||||
const char* name = point->GetName();
|
||||
luaL_error(L, "Usage: %s:SetOrder(order)", name ? name : "<unnamed>");
|
||||
return 0;
|
||||
}
|
||||
|
||||
point->SetOrder(lua_tointeger(L, 2) - 1, true, false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// VERIFY: 0848e1cc manual
|
||||
// OFFSET: 0x004A6BA0
|
||||
static int32_t Script_GetOrder(lua_State* L) {
|
||||
CSimpleControlPoint* point = static_cast<CSimpleControlPoint*>(FrameScript_GetObjectThis(L, CSimpleControlPoint::GetObjectType()));
|
||||
lua_pushinteger(L, point->m_order + 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// VERIFY: 02dfb2f9 auto
|
||||
// OFFSET: 0x004A6BF0
|
||||
void CSimpleControlPoint::CreateScriptMetaTable() {
|
||||
@@ -18,3 +139,19 @@ void CSimpleControlPoint::DestroyScriptMetaTable() {
|
||||
luaL_unref(FrameScript_GetContext(), LUA_REGISTRYINDEX, CSimpleControlPoint::s_metatable);
|
||||
CSimpleControlPoint::s_metatable = LUA_NOREF;
|
||||
}
|
||||
|
||||
// STATIC: 0x00AC1A48
|
||||
static FrameScript_Method s_ScriptMethods[] = {
|
||||
{ "SetParent", &Script_SetParent },
|
||||
{ "SetOffset", &Script_SetOffset },
|
||||
{ "GetOffset", &Script_GetOffset },
|
||||
{ "SetOrder", &Script_SetOrder },
|
||||
{ "GetOrder", &Script_GetOrder },
|
||||
};
|
||||
|
||||
// VERIFY: c332bef1 auto
|
||||
// OFFSET: 0x004A4DA0
|
||||
void CSimpleControlPoint::RegisterScriptMethods(lua_State* L) {
|
||||
CScriptObject::RegisterScriptMethods(L);
|
||||
FrameScript_Object::FillScriptMethodTable(L, s_ScriptMethods, sizeof(s_ScriptMethods) / sizeof(s_ScriptMethods[0]));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user