Merge remote-tracking branch 'origin/master'

# Conflicts:
#	game/reconstructed/btl4gau2.cpp
This commit is contained in:
Cyd
2026-07-17 15:48:11 -05:00
17 changed files with 598 additions and 85 deletions
+33
View File
@@ -2631,6 +2631,39 @@ char*
return source;
}
//#############################################################################
// dpl material-name callback registry (FUN_0049664c / DAT_00527f24).
//-----------------------------------------------------------------------------
// The 1995 dpl board applied the installed callback to every material name as
// a model loaded (dpl_LoadObject). The port analogue: the BGF loader
// (bgfload.cpp MaterialResolver::resolve) runs every "lib:material" name
// through dpl_ApplyMaterialNameCallback before resolving it, so the per-pilot
// paint substitutions (skin: -> _<color><serno>:, skin:lgo -> emblem<serno>:)
// installed by SetupMaterialSubstitutionList take effect on the mech model
// loads that happen between the Setup/TearDown bracket.
//#############################################################################
static char *(*gMaterialNameCallback)(char *source) = NULL;
void dpl_SetMaterialNameCallback(char *(*callback)(char *source))
{
gMaterialNameCallback = callback;
}
// C++-friendly wrapper honouring the callback's legacy protocol (the callback
// may delete[] the input and return a new[] buffer). Returns the (possibly
// substituted) name.
std::string dpl_ApplyMaterialNameCallback(const std::string &name)
{
if (gMaterialNameCallback == NULL)
return name;
char *buf = new char[name.size() + 1];
strcpy(buf, name.c_str());
buf = gMaterialNameCallback(buf);
std::string result(buf);
delete [] buf;
return result;
}
vector<MONITORINFO> DPLRenderer::MonitorsCreateAll(int &monitorCount)
{
monitorCount = gD3D->GetAdapterCount();
+7
View File
@@ -40,6 +40,13 @@ class NotationFile;
char*
substituteMaterial(char *source);
// dpl material-name callback registry (FUN_0049664c): install/clear the
// per-load substitution hook; dpl_ApplyMaterialNameCallback runs the installed
// hook over a name (identity when none installed). Consumed by the BGF
// loader's material resolver.
void dpl_SetMaterialNameCallback(char *(*callback)(char *source));
std::string dpl_ApplyMaterialNameCallback(const std::string &name);
void loadTables();
const char* opMaterialName(const char *fileName, int opId);
+10 -1
View File
@@ -11,6 +11,11 @@
#include <set>
#include <array>
// L4VIDEO.cpp: the dpl material-name callback registry. While a mech loads
// (the SetupMaterialSubstitutionList / TearDown bracket) this rewrites
// "blhskin:..." -> "blh_wht0:..." / "emblem0:..." -- the per-pilot paint.
std::string dpl_ApplyMaterialNameCallback(const std::string &name);
namespace {
// ---- DIV-BIZ2 tag ids (PFBIZTAG.H), masked form (tagword & 0x2fff) ----
@@ -503,7 +508,11 @@ struct MaterialResolver {
return libs.emplace(lib, std::move(table)).first->second;
}
MatInfo resolve(const std::string& full) {
MatInfo resolve(const std::string& fullIn) {
// Per-pilot paint: run the name through the installed dpl material-name
// callback first (identity when none) -- the board rewrote names at
// load time, before any material lookup.
std::string full = dpl_ApplyMaterialNameCallback(fullIn);
auto cached = resolvedCache.find(full);
if (cached != resolvedCache.end()) return cached->second;
MatInfo info;