feat(model): backport 4.3.4's PlayerModel and DressUpModel methods

SetDisplayInfo and SetCreature move from Model to PlayerModel, where
4.3.4 registers them, and now ride vanilla's own pane path: SetDisplay
(0x505CB0) stores the record and AttachDisplayModel (0x505A70) builds the
model with the engine's skins (ApplyCreatureDisplay), Stand, the pane
camera and light, and rebuilds it on every show. A co-hook on
AttachDisplayModel adds 4.3.4's SetUpModel step: a display with an Extra
record is dressed through the character compositor. SetCreature passes
the creature-cache record itself; SetDisplayInfo passes a per-pane record
holding the display ID, the only field the pane reads. The hand-built
ApplySkins is removed.

SetPortraitZoom, SetCamDistanceScale and RefreshCamera apply 4.3.4's
ConfigureCamera steps after vanilla's (0x505890); the defaults leave the
camera untouched. The portrait camera id is bounds-checked, since
GetCameraById indexes unchecked.

DressUpModel gains UndressSlot (one step of vanilla's Undress) and a
TryOn that takes item links, recipe links and carried item names in
front of vanilla's worker. PlayerModel:SetRotation takes 4.3.4's animate
flag, and Model:SetGlow exists as the no-op it is on a 4.3.4 Model.
This commit is contained in:
Brues
2026-10-19 12:11:21 -05:00
parent d5c6530b80
commit bbd78b437f
10 changed files with 959 additions and 218 deletions
+57
View File
@@ -0,0 +1,57 @@
// This file is part of ClassicAPI.
//
// ClassicAPI is free software: you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software Foundation, either
// version 3 of the License, or (at your option) any later version.
//
// ClassicAPI is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with
// ClassicAPI. If not, see <https://www.gnu.org/licenses/>.
// `Model:SetGlow(value)` — 4.3.4's Model method (CSimpleModel_Scripts.cpp).
//
// In 4.3.4 it calls the virtual CSimpleModel::SetGlow, which does nothing on a
// Model; only the glue screen's ModelFFX overrides it, to set the strength of
// its glow effect. In the game every Model is a plain Model, so the method
// checks its arguments the way 4.3.4 does and changes nothing.
#include "Game.h"
#include "Offsets.h"
namespace Model::Glow {
namespace {
int __fastcall Script_SetGlow(void *L) {
void *model = Game::Lua::ResolveModel(L);
if (model == nullptr)
return 0;
if (!Game::Lua::IsNumber(L, 2))
Game::Lua::Error(L, "Usage: %s:SetGlow(value)", Game::Lua::ObjectDisplayName(model));
return 0;
}
const Game::Lua::FrameMethodEntry g_methods[] = {
{"SetGlow", &Script_SetGlow},
};
const Game::Doc::Field kArgs[] = {
Game::Doc::Req("value", "number", "The glow strength."),
};
const Game::Doc::Function kSetGlow{"Sets the glow strength of the model. It has no effect in the game.",
kArgs, {}};
const Game::Doc::Method g_methodDocs[] = {
{"SetGlow", &kSetGlow},
};
void RegisterLuaFunctions() {
Game::Lua::RegisterFrameMethods(reinterpret_cast<void *>(Offsets::VAR_MODEL_METHOD_REGISTRY),
g_methods, 1, g_methodDocs, 1);
}
const Game::ModuleAutoRegister _autoreg{&RegisterLuaFunctions};
} // namespace
} // namespace Model::Glow