Compare commits

...

5 Commits

Author SHA1 Message Date
Tristan 'Natrist' Cormier
86e5fb9181
Merge e391f966bb into d859670f7b 2026-02-14 12:08:30 -05:00
fallenoak
d859670f7b
feat(ui): set frame strata in CGWorldFrame ctor
Some checks are pending
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:cl compiler_name:MSVC cxx:cl os:windows-latest system_name:Windows test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:clang compiler_name:Clang cxx:clang++ os:macos-latest system_name:macOS test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:gcc compiler_name:GCC cxx:g++ os:ubuntu-latest system_name:Linux test_path:WhoaTest]) (push) Waiting to run
2026-02-14 08:23:58 -06:00
fallenoak
05d949523c
feat(ui): add CGWorldFrame::OnFrameRender
Some checks are pending
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:cl compiler_name:MSVC cxx:cl os:windows-latest system_name:Windows test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:clang compiler_name:Clang cxx:clang++ os:macos-latest system_name:macOS test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:gcc compiler_name:GCC cxx:g++ os:ubuntu-latest system_name:Linux test_path:WhoaTest]) (push) Waiting to run
2026-02-14 05:05:38 -06:00
fallenoak
04c3dac382
feat(object): handle creature geosets and skins in CGUnit_C::PostInit
Some checks are pending
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:cl compiler_name:MSVC cxx:cl os:windows-latest system_name:Windows test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:clang compiler_name:Clang cxx:clang++ os:macos-latest system_name:macOS test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:gcc compiler_name:GCC cxx:g++ os:ubuntu-latest system_name:Linux test_path:WhoaTest]) (push) Waiting to run
2026-02-13 21:10:02 -06:00
Tristan Cormier
e391f966bb feat(glue): implement Script_TerminationWithoutNoticeAccepted 2026-01-11 16:57:43 -05:00
10 changed files with 168 additions and 1 deletions

View File

@ -121,6 +121,10 @@ bool ComponentCompressCallback(CVar* var, const char* oldValue, const char* valu
return true; return true;
} }
void ReplaceParticleColor(CM2Model* model, int32_t particleColorID) {
// TODO
}
int32_t CCharacterComponent::AddHandItem(CM2Model* model, const ItemDisplayInfoRec* displayRec, INVENTORY_SLOTS invSlot, SHEATHE_TYPE sheatheType, bool sheathed, bool shield, bool a7, int32_t visualID) { int32_t CCharacterComponent::AddHandItem(CM2Model* model, const ItemDisplayInfoRec* displayRec, INVENTORY_SLOTS invSlot, SHEATHE_TYPE sheatheType, bool sheathed, bool shield, bool a7, int32_t visualID) {
if (!model || !displayRec || invSlot > INVSLOT_TABARD) { if (!model || !displayRec || invSlot > INVSLOT_TABARD) {
return -1; return -1;
@ -247,6 +251,26 @@ CCharacterComponent* CCharacterComponent::AllocComponent() {
return component; return component;
} }
void CCharacterComponent::ApplyMonsterGeosets(CM2Model* model, const CreatureDisplayInfoRec* displayInfoRec) {
if (!model || !displayInfoRec || !displayInfoRec->m_creatureGeosetData) {
return;
}
for (int32_t group = 100, dataOfs = 0; group < 900; group += 100, dataOfs += 4) {
auto section = (displayInfoRec->m_creatureGeosetData >> dataOfs) & 0xF;
if (section) {
// Hide all sections in group
model->SetGeometryVisible(group, group + 99, false);
// Show matching section
model->SetGeometryVisible(group + section, group + section, true);
}
}
model->OptimizeVisibleGeometry();
}
void CCharacterComponent::ComponentCloseFingers(CM2Model* model, COMP_HAND_SLOT handSlot) { void CCharacterComponent::ComponentCloseFingers(CM2Model* model, COMP_HAND_SLOT handSlot) {
uint32_t firstBone; uint32_t firstBone;
uint32_t lastBone; uint32_t lastBone;
@ -789,6 +813,54 @@ void CCharacterComponent::RemoveLinkpt(CM2Model* model, GEOCOMPONENTLINKS link)
} }
} }
void CCharacterComponent::ReplaceMonsterSkin(CM2Model* model, const CreatureDisplayInfoRec* displayInfoRec, const CreatureModelDataRec* modelDataRec) {
if (!model || !displayInfoRec || !modelDataRec) {
return;
}
CStatus status;
char texturePath[STORM_MAX_PATH];
// Copy model path to use as base path for texture
auto src = modelDataRec->m_modelName;
auto dst = texturePath;
while (*src) {
*dst++ = *src++;
}
*dst = '\0';
// Locate start of model file name
auto lastSlash = strrchr(texturePath, '\\');
auto modelFileName = lastSlash ? lastSlash + 1 : texturePath;
auto textureFlags = CGxTexFlags(GxTex_LinearMipLinear, 1, 1, 0, 0, 0, 1);
for (uint32_t i = 0; i < 3; i++) {
auto textureName = displayInfoRec->m_textureVariation[i];
if (textureName[0] == '\0') {
continue;
}
// Replace model file name with texture name
src = textureName;
dst = modelFileName;
while (*src) {
*dst++ = *src++;
}
*dst = '\0';
auto texture = TextureCreate(texturePath, textureFlags, &status, 0);
if (texture) {
model->ReplaceTexture(11 + i, texture);
HandleClose(texture);
}
}
ReplaceParticleColor(model, displayInfoRec->m_particleColorID);
}
void CCharacterComponent::UpdateBaseTexture(EGxTexCommand cmd, uint32_t width, uint32_t height, uint32_t depth, uint32_t mipLevel, void* userArg, uint32_t& texelStrideInBytes, const void*& texels) { void CCharacterComponent::UpdateBaseTexture(EGxTexCommand cmd, uint32_t width, uint32_t height, uint32_t depth, uint32_t mipLevel, void* userArg, uint32_t& texelStrideInBytes, const void*& texels) {
auto component = static_cast<CCharacterComponent*>(userArg); auto component = static_cast<CCharacterComponent*>(userArg);

View File

@ -10,6 +10,8 @@
class CACHEENTRY; class CACHEENTRY;
class CCharacterComponent; class CCharacterComponent;
class CharSectionsRec; class CharSectionsRec;
class CreatureDisplayInfoRec;
class CreatureModelDataRec;
class ItemDisplayInfoRec; class ItemDisplayInfoRec;
struct BlpPalPixel; struct BlpPalPixel;
@ -51,6 +53,7 @@ class CCharacterComponent {
static int32_t AddHandItem(CM2Model* model, const ItemDisplayInfoRec* displayRec, INVENTORY_SLOTS invSlot, SHEATHE_TYPE sheatheType, bool sheathed, bool shield, bool a7, int32_t a8); static int32_t AddHandItem(CM2Model* model, const ItemDisplayInfoRec* displayRec, INVENTORY_SLOTS invSlot, SHEATHE_TYPE sheatheType, bool sheathed, bool shield, bool a7, int32_t a8);
static void AddLink(CM2Model* parent, GEOCOMPONENTLINKS link, char const* modelPath, char const* texturePath, int32_t visualID, const ItemDisplayInfoRec* displayRec); static void AddLink(CM2Model* parent, GEOCOMPONENTLINKS link, char const* modelPath, char const* texturePath, int32_t visualID, const ItemDisplayInfoRec* displayRec);
static CCharacterComponent* AllocComponent(); static CCharacterComponent* AllocComponent();
static void ApplyMonsterGeosets(CM2Model* model, const CreatureDisplayInfoRec* displayInfoRec);
static void ComponentCloseFingers(CM2Model* model, COMP_HAND_SLOT handSlot); static void ComponentCloseFingers(CM2Model* model, COMP_HAND_SLOT handSlot);
static void ComponentOpenFingers(CM2Model* model, COMP_HAND_SLOT handSlot); static void ComponentOpenFingers(CM2Model* model, COMP_HAND_SLOT handSlot);
static HTEXTURE CreateTexture(const char* fileName, CStatus* status); static HTEXTURE CreateTexture(const char* fileName, CStatus* status);
@ -68,6 +71,7 @@ class CCharacterComponent {
static void PasteTransparent4Bit(void* srcTexture, const BlpPalPixel* srcPal, MipBits* dstMips, const C2iVector& dstPos, uint32_t dstWidth, const C2iVector& srcPos, const C2iVector& srcSize, TCTEXTUREINFO& srcInfo, int32_t srcMipLevel, int32_t dstMipLevelOfs); static void PasteTransparent4Bit(void* srcTexture, const BlpPalPixel* srcPal, MipBits* dstMips, const C2iVector& dstPos, uint32_t dstWidth, const C2iVector& srcPos, const C2iVector& srcSize, TCTEXTUREINFO& srcInfo, int32_t srcMipLevel, int32_t dstMipLevelOfs);
static void PasteTransparent8Bit(void* srcTexture, const BlpPalPixel* srcPal, MipBits* dstMips, const C2iVector& dstPos, uint32_t dstWidth, const C2iVector& srcPos, const C2iVector& srcSize, TCTEXTUREINFO& srcInfo, int32_t srcMipLevel, int32_t dstMipLevelOfs); static void PasteTransparent8Bit(void* srcTexture, const BlpPalPixel* srcPal, MipBits* dstMips, const C2iVector& dstPos, uint32_t dstWidth, const C2iVector& srcPos, const C2iVector& srcSize, TCTEXTUREINFO& srcInfo, int32_t srcMipLevel, int32_t dstMipLevelOfs);
static void RemoveLinkpt(CM2Model* model, GEOCOMPONENTLINKS link); static void RemoveLinkpt(CM2Model* model, GEOCOMPONENTLINKS link);
static void ReplaceMonsterSkin(CM2Model* model, const CreatureDisplayInfoRec* displayInfoRec, const CreatureModelDataRec* modelDataRec);
static void UpdateBaseTexture(EGxTexCommand cmd, uint32_t width, uint32_t height, uint32_t depth, uint32_t mipLevel, void* userArg, uint32_t& texelStrideInBytes, const void*& texels); static void UpdateBaseTexture(EGxTexCommand cmd, uint32_t width, uint32_t height, uint32_t depth, uint32_t mipLevel, void* userArg, uint32_t& texelStrideInBytes, const void*& texels);
// Member variables // Member variables

View File

@ -204,7 +204,14 @@ int32_t Script_ShowTerminationWithoutNoticeNotice(lua_State* L) {
} }
int32_t Script_TerminationWithoutNoticeAccepted(lua_State* L) { int32_t Script_TerminationWithoutNoticeAccepted(lua_State* L) {
WHOA_UNIMPLEMENTED(0); if (CGlueMgr::m_acceptedTerminationWithoutNotice) {
lua_pushnumber(L, 1.0);
}
else {
lua_pushnil(L);
}
return 1;
} }
int32_t Script_AcceptTerminationWithoutNotice(lua_State* L) { int32_t Script_AcceptTerminationWithoutNotice(lua_State* L) {

View File

@ -1604,6 +1604,10 @@ void CM2Model::LinkToCallbackListTail() {
this->m_shared->m_callbackListTail = &this->m_callbackNext; this->m_shared->m_callbackListTail = &this->m_callbackNext;
} }
void CM2Model::OptimizeVisibleGeometry() {
// TODO
}
int32_t CM2Model::ProcessCallbacks() { int32_t CM2Model::ProcessCallbacks() {
// TODO // TODO
return 1; return 1;

View File

@ -178,6 +178,7 @@ class CM2Model {
int32_t IsDrawable(int32_t a2, int32_t a3); int32_t IsDrawable(int32_t a2, int32_t a3);
int32_t IsLoaded(int32_t a2, int32_t attachments); int32_t IsLoaded(int32_t a2, int32_t attachments);
void LinkToCallbackListTail(); void LinkToCallbackListTail();
void OptimizeVisibleGeometry();
int32_t ProcessCallbacks(); int32_t ProcessCallbacks();
void ProcessCallbacksRecursive(); void ProcessCallbacksRecursive();
uint32_t Release(); uint32_t Release();

View File

@ -1,4 +1,6 @@
#include "object/client/CGUnit_C.hpp" #include "object/client/CGUnit_C.hpp"
#include "component/CCharacterComponent.hpp"
#include "model/Model2.hpp"
#include "object/client/ObjMgr.hpp" #include "object/client/ObjMgr.hpp"
#include "db/Db.hpp" #include "db/Db.hpp"
#include "ui/Game.hpp" #include "ui/Game.hpp"
@ -175,6 +177,17 @@ void CGUnit_C::PostInit(uint32_t time, const CClientObjCreate& init, bool a4) {
this->CGObject_C::PostInit(time, init, a4); this->CGObject_C::PostInit(time, init, a4);
// TODO // TODO
if (this->m_displayInfo) {
CCharacterComponent::ApplyMonsterGeosets(this->m_model, this->m_displayInfo);
CCharacterComponent::ReplaceMonsterSkin(this->m_model, this->m_displayInfo, this->m_modelData);
if (this->m_modelData) {
this->m_model->m_flag4 = (this->m_modelData->m_flags & 0x200) ? true : false;
}
}
// TODO
} }
void CGUnit_C::PostMovementUpdate(const CClientMoveUpdate& move, int32_t activeMover) { void CGUnit_C::PostMovementUpdate(const CClientMoveUpdate& move, int32_t activeMover) {

View File

@ -1,5 +1,9 @@
#include "ui/game/CGWorldFrame.hpp" #include "ui/game/CGWorldFrame.hpp"
#include "gx/Shader.hpp"
#include "gx/Transform.hpp"
#include "ui/game/PlayerName.hpp"
#include <storm/Memory.hpp> #include <storm/Memory.hpp>
#include <tempest/Matrix.hpp>
CSimpleFrame* CGWorldFrame::Create(CSimpleFrame* parent) { CSimpleFrame* CGWorldFrame::Create(CSimpleFrame* parent) {
// TODO use CDataAllocator // TODO use CDataAllocator
@ -7,6 +11,27 @@ CSimpleFrame* CGWorldFrame::Create(CSimpleFrame* parent) {
return STORM_NEW(CGWorldFrame)(parent); return STORM_NEW(CGWorldFrame)(parent);
} }
void CGWorldFrame::RenderWorld(void* param) {
auto frame = reinterpret_cast<CGWorldFrame*>(param);
C44Matrix savedProj;
GxXformProjection(savedProj);
C44Matrix savedView;
GxXformView(savedView);
frame->OnWorldUpdate();
PlayerNameUpdateWorldText();
frame->OnWorldRender();
PlayerNameRenderWorldText();
GxXformSetProjection(savedProj);
GxXformSetView(savedView);
CShaderEffect::UpdateProjMatrix();
}
CGWorldFrame::CGWorldFrame(CSimpleFrame* parent) : CSimpleFrame(parent) { CGWorldFrame::CGWorldFrame(CSimpleFrame* parent) : CSimpleFrame(parent) {
// TODO // TODO
@ -14,9 +39,27 @@ CGWorldFrame::CGWorldFrame(CSimpleFrame* parent) : CSimpleFrame(parent) {
// TODO // TODO
this->SetFrameStrata(FRAME_STRATA_WORLD);
this->EnableEvent(SIMPLE_EVENT_KEY, -1); this->EnableEvent(SIMPLE_EVENT_KEY, -1);
this->EnableEvent(SIMPLE_EVENT_MOUSE, -1); this->EnableEvent(SIMPLE_EVENT_MOUSE, -1);
this->EnableEvent(SIMPLE_EVENT_MOUSEWHEEL, -1); this->EnableEvent(SIMPLE_EVENT_MOUSEWHEEL, -1);
// TODO // TODO
} }
void CGWorldFrame::OnFrameRender(CRenderBatch* batch, uint32_t layer) {
this->CSimpleFrame::OnFrameRender(batch, layer);
if (layer == DRAWLAYER_BACKGROUND) {
batch->QueueCallback(&CGWorldFrame::RenderWorld, this);
}
}
void CGWorldFrame::OnWorldRender() {
// TODO
}
void CGWorldFrame::OnWorldUpdate() {
// TODO
}

View File

@ -11,9 +11,15 @@ class CGWorldFrame : public CSimpleFrame {
// Static functions // Static functions
static CSimpleFrame* Create(CSimpleFrame* parent); static CSimpleFrame* Create(CSimpleFrame* parent);
static void RenderWorld(void* param);
// Virtual member functions
virtual void OnFrameRender(CRenderBatch* batch, uint32_t layer);
// Member functions // Member functions
CGWorldFrame(CSimpleFrame* parent); CGWorldFrame(CSimpleFrame* parent);
void OnWorldRender();
void OnWorldUpdate();
}; };
#endif #endif

View File

@ -0,0 +1,9 @@
#include "ui/game/PlayerName.hpp"
void PlayerNameRenderWorldText() {
// TODO
}
void PlayerNameUpdateWorldText() {
// TODO
}

View File

@ -0,0 +1,8 @@
#ifndef UI_GAME_PLAYER_NAME_HPP
#define UI_GAME_PLAYER_NAME_HPP
void PlayerNameRenderWorldText();
void PlayerNameUpdateWorldText();
#endif