Compare commits

...

6 Commits

Author SHA1 Message Date
Tristan 'Natrist' Cormier
4b76e73577
Merge c12a79d6e6 into b69a992141 2026-02-12 13:58:48 -05:00
fallenoak
b69a992141
feat(object): implement CGUnit_C::GetModelData
Some checks failed
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) Has been cancelled
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) Has been cancelled
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) Has been cancelled
2026-02-11 22:54:36 -06:00
fallenoak
afb329c42d
feat(object): add CGUnit_C::GetLocalDisplayID 2026-02-11 22:39:24 -06:00
fallenoak
d253417233
feat(object): add CGUnit::GetNativeDisplayID 2026-02-11 22:33:39 -06:00
fallenoak
0f7f0207ee
feat(object): add CGUnit::GetDisplayID 2026-02-11 22:21:17 -06:00
Tristan Cormier
c12a79d6e6 feat(console): add CONSOLELINE::Backspace 2025-12-08 09:17:54 -05:00
6 changed files with 65 additions and 2 deletions

View File

@ -84,6 +84,26 @@ CONSOLELINE::~CONSOLELINE() {
} }
} }
void CONSOLELINE::Backspace() {
if (this->inputpos > this->inputstart) {
if (this->chars <= this->inputpos) {
this->buffer[this->inputpos - 1] = '\0';
}
else {
memcpy(
&this->buffer[this->inputpos - 1],
&this->buffer[this->inputpos],
this->chars - this->inputpos + 1
);
}
this->inputpos--;
this->chars--;
SetInputString(this->buffer);
}
}
void DrawBackground() { void DrawBackground() {
uint16_t indices[] = { uint16_t indices[] = {
0, 1, 2, 3 0, 1, 2, 3

View File

@ -19,6 +19,7 @@ class CONSOLELINE : public TSLinkedNode<CONSOLELINE> {
// Member functions // Member functions
~CONSOLELINE(); ~CONSOLELINE();
void Backspace();
}; };
void ConsoleScreenAnimate(float elapsedSec); void ConsoleScreenAnimate(float elapsedSec);

View File

@ -25,6 +25,14 @@ uint32_t CGUnit::TotalFieldsSaved() {
return CGUnit::GetBaseOffsetSaved() + 123; return CGUnit::GetBaseOffsetSaved() + 123;
} }
int32_t CGUnit::GetDisplayID() const {
return this->Unit()->displayID;
}
int32_t CGUnit::GetNativeDisplayID() const {
return this->Unit()->nativeDisplayID;
}
CGUnitData* CGUnit::Unit() const { CGUnitData* CGUnit::Unit() const {
return this->m_unit; return this->m_unit;
} }

View File

@ -82,6 +82,10 @@ class CGUnit {
static uint32_t TotalFields(); static uint32_t TotalFields();
static uint32_t TotalFieldsSaved(); static uint32_t TotalFieldsSaved();
// Public member functions
int32_t GetDisplayID() const;
int32_t GetNativeDisplayID() const;
protected: protected:
// Protected member variables // Protected member variables
CGUnitData* m_unit; CGUnitData* m_unit;

View File

@ -115,11 +115,34 @@ int32_t CGUnit_C::CanBeTargetted() {
return this->CanHighlight(); return this->CanHighlight();
} }
int32_t CGUnit_C::GetLocalDisplayID() const {
return this->m_localDisplayID;
}
CreatureModelDataRec* CGUnit_C::GetModelData() const { CreatureModelDataRec* CGUnit_C::GetModelData() const {
// TODO // Prefer local display ID if set and unit's display ID hasn't been overridden from unit's
// native display ID; otherwise prefer overridden display ID.
auto displayID = this->GetLocalDisplayID() && this->GetDisplayID() == this->GetNativeDisplayID()
? this->GetLocalDisplayID()
: this->GetDisplayID();
auto creatureDisplayInfoRec = g_creatureDisplayInfoDB.GetRecord(displayID);
if (!creatureDisplayInfoRec) {
// TODO SysMsgPrintf(1, 2, "NOCREATUREDISPLAYIDFOUND|%d", displayID);
return nullptr; return nullptr;
} }
auto creatureModelDataRec = g_creatureModelDataDB.GetRecord(creatureDisplayInfoRec->m_modelID);
if (!creatureModelDataRec) {
// TODO SysMsgPrintf(1, 16, "INVALIDDISPLAYMODELRECORD|%d|%d", creatureDisplayInfoRec->m_modelID, creatureDisplayInfoRec->m_ID);
return nullptr;
}
return creatureModelDataRec;
}
int32_t CGUnit_C::GetModelFileName(const char*& name) const { int32_t CGUnit_C::GetModelFileName(const char*& name) const {
auto modelDataRec = this->GetModelData(); auto modelDataRec = this->GetModelData();

View File

@ -31,10 +31,17 @@ class CGUnit_C : public CGObject_C, public CGUnit {
// Public member functions // Public member functions
CGUnit_C(uint32_t time, CClientObjCreate& objCreate); CGUnit_C(uint32_t time, CClientObjCreate& objCreate);
int32_t GetLocalDisplayID() const;
CreatureModelDataRec* GetModelData() const; CreatureModelDataRec* GetModelData() const;
void PostInit(uint32_t time, const CClientObjCreate& init, bool a4); void PostInit(uint32_t time, const CClientObjCreate& init, bool a4);
void PostMovementUpdate(const CClientMoveUpdate& move, int32_t activeMover); void PostMovementUpdate(const CClientMoveUpdate& move, int32_t activeMover);
void SetStorage(uint32_t* storage, uint32_t* saved); void SetStorage(uint32_t* storage, uint32_t* saved);
private:
// Private member variables
// TODO
int32_t m_localDisplayID = 0;
// TODO
}; };
#endif #endif