Compare commits

..

11 Commits

Author SHA1 Message Date
Alex Tiernan-Berry
9ce41b2da0
Merge 0573235a70 into e5150d7d21 2026-03-02 22:16:41 +00:00
fallenoak
e5150d7d21
feat(object): add CGUnit_C::GetFacing
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-27 20:35:12 -06:00
fallenoak
3a876398a7
feat(object): add CGUnit_C::GetPosition 2026-02-27 20:25:16 -06:00
fallenoak
1b90dcb09b
fix(object): move CMovement_C pointer to proper location in CGUnit 2026-02-27 20:12:08 -06:00
fallenoak
c5bd63b79e
feat(object): add missing CGUnit_C in-class initializers 2026-02-26 07:16:16 -06:00
fallenoak
5492b3f231
feat(object): set position and facing in CGUnit_C ctor
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-25 22:11:31 -06:00
Tristan 'Natrist' Cormier
8851d2e5e1
feat(glue): implement Script_ScanningAccepted (#160)
Co-authored-by: fallenoak <git@fallenoak.me>
2026-02-25 21:28:59 -06:00
Tristan 'Natrist' Cormier
0a91d44600
feat(glue): implement Script_ContestAccepted (#161)
Co-authored-by: fallenoak <git@fallenoak.me>
2026-02-25 20:36:05 -06:00
Tristan 'Natrist' Cormier
d19658185a
feat(glue): implement Script_TerminationWithoutNoticeAccepted (#159)
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
Co-authored-by: fallenoak <git@fallenoak.me>
2026-02-24 21:00:27 -06:00
Tristan 'Natrist' Cormier
abf2e2cde3
feat(glue): add CGlueMgr::PollCreateCharacter (#167)
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
Co-authored-by: fallenoak <git@fallenoak.me>
2026-02-23 22:30:49 -06:00
Tristan 'Natrist' Cormier
6b7abe3c03
feat(connection): implement character creation message handlers (#166)
Co-authored-by: fallenoak <git@fallenoak.me>
2026-02-23 21:31:12 -06:00
19 changed files with 270 additions and 11 deletions

View File

@ -38,7 +38,9 @@
#include <common/MD5.hpp>
#include <cstdio>
int32_t CGlueMgr::m_acceptedContest = 1; // TODO
int32_t CGlueMgr::m_acceptedEULA = 1; // TODO
int32_t CGlueMgr::m_acceptedScanning = 1; // TODO
int32_t CGlueMgr::m_acceptedTerminationWithoutNotice;
int32_t CGlueMgr::m_acceptedTOS = 1; // TODO
int32_t CGlueMgr::m_accountMsgAvailable;
@ -393,6 +395,11 @@ int32_t CGlueMgr::Idle(const void* a1, void* a2) {
break;
}
case IDLE_CREATE_CHARACTER: {
CGlueMgr::PollCreateCharacter(msg, complete, result);
break;
}
case IDLE_DELETE_CHARACTER: {
CGlueMgr::PollDeleteCharacter(msg, complete, result);
break;
@ -763,6 +770,37 @@ void CGlueMgr::PollCharacterList(const char* msg, int32_t complete, int32_t resu
}
}
void CGlueMgr::PollCreateCharacter(const char* msg, int32_t complete, int32_t result) {
FrameScript_SignalEvent(UPDATE_STATUS_DIALOG, "%s", msg);
if (CGlueMgr::HandleBattlenetDisconnect()) {
CGlueMgr::SetIdleState(IDLE_NONE);
}
if (!complete) {
return;
}
// Error
if (result == 0) {
FrameScript_SignalEvent(OPEN_STATUS_DIALOG, "%s%s", "OKAY", msg);
CGlueMgr::SetIdleState(IDLE_NONE);
return;
}
// Success
CGlueMgr::SetIdleState(IDLE_NONE);
FrameScript_SignalEvent(CLOSE_STATUS_DIALOG, nullptr);
FrameScript_SignalEvent(SELECT_LAST_CHARACTER, nullptr);
CGlueMgr::SetScreen("charselect");
}
void CGlueMgr::PollDeleteCharacter(const char* msg, int32_t complete, int32_t result) {
FrameScript_SignalEvent(UPDATE_STATUS_DIALOG, "%s", msg);

View File

@ -32,7 +32,9 @@ class CGlueMgr {
};
// Static variables
static int32_t m_acceptedContest;
static int32_t m_acceptedEULA;
static int32_t m_acceptedScanning;
static int32_t m_acceptedTerminationWithoutNotice;
static int32_t m_acceptedTOS;
static int32_t m_accountMsgAvailable;
@ -80,6 +82,7 @@ class CGlueMgr {
static int32_t OnKickReasonMsg(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
static void PollAccountLogin(int32_t errorCode, const char* msg, int32_t complete, int32_t result, WOWCS_OPS op);
static void PollCharacterList(const char* msg, int32_t complete, int32_t result, int32_t errorCode);
static void PollCreateCharacter(const char* msg, int32_t complete, int32_t result);
static void PollDeleteCharacter(const char* msg, int32_t complete, int32_t result);
static void PollEnterWorld();
static void PollLoginServerLogin();

View File

@ -204,7 +204,13 @@ int32_t Script_ShowTerminationWithoutNoticeNotice(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) {
@ -216,7 +222,13 @@ int32_t Script_ShowScanningNotice(lua_State* L) {
}
int32_t Script_ScanningAccepted(lua_State* L) {
WHOA_UNIMPLEMENTED(0);
if (CGlueMgr::m_acceptedScanning) {
lua_pushnumber(L, 1.0);
} else {
lua_pushnil(L);
}
return 1;
}
int32_t Script_AcceptScanning(lua_State* L) {
@ -228,7 +240,13 @@ int32_t Script_ShowContestNotice(lua_State* L) {
}
int32_t Script_ContestAccepted(lua_State* L) {
WHOA_UNIMPLEMENTED(0);
if (CGlueMgr::m_acceptedContest) {
lua_pushnumber(L, 1.0);
} else {
lua_pushnil(L);
}
return 1;
}
int32_t Script_AcceptContest(lua_State* L) {

View File

@ -104,6 +104,10 @@ void ClientConnection::GetRealmList() {
}
}
void ClientConnection::HandleCharacterCreate(uint8_t result) {
this->Complete(result == 47, result);
}
void ClientConnection::HandleCharacterDelete(uint8_t result) {
this->Complete(result == 71, result);
}

View File

@ -22,6 +22,7 @@ class ClientConnection : public RealmConnection {
// Virtual member functions
virtual int32_t HandleConnect();
virtual void HandleCharacterCreate(uint8_t result);
virtual void HandleCharacterDelete(uint8_t result);
// Member functions

View File

@ -20,7 +20,7 @@ int32_t RealmConnection::MessageHandler(void* param, NETMESSAGE msgId, uint32_t
}
case SMSG_CHAR_CREATE: {
// TODO
result = connection->CreateCharHandler(msgId, time, msg);
break;
}
@ -294,6 +294,15 @@ int32_t RealmConnection::HandleCharEnum(uint32_t msgId, uint32_t time, CDataStor
return 1;
}
int32_t RealmConnection::CreateCharHandler(uint32_t msgId, uint32_t time, CDataStore* msg) {
uint8_t result;
msg->Get(result);
this->HandleCharacterCreate(result);
return 1;
}
int32_t RealmConnection::DeleteCharHandler(uint32_t msgId, uint32_t time, CDataStore* msg) {
uint8_t result;
msg->Get(result);

View File

@ -46,12 +46,14 @@ class RealmConnection : public NetClient {
// Virtual member functions
virtual int32_t HandleAuthChallenge(AuthenticationChallenge* challenge);
virtual void HandleCharacterCreate(uint8_t result) = 0;
virtual void HandleCharacterDelete(uint8_t result) = 0;
// Member functions
RealmConnection(RealmResponse* realmResponse);
int32_t HandleAuthResponse(uint32_t msgId, uint32_t time, CDataStore* msg);
int32_t HandleCharEnum(uint32_t msgId, uint32_t time, CDataStore* msg);
int32_t CreateCharHandler(uint32_t msgId, uint32_t time, CDataStore* msg);
int32_t DeleteCharHandler(uint32_t msgId, uint32_t time, CDataStore* msg);
void RequestCharacterEnum();
void RequestCharacterLogin(uint64_t guid, int32_t a2);

View File

@ -1,5 +1,6 @@
#include "object/client/CGUnit.hpp"
#include "object/client/CGObject.hpp"
#include "object/client/CMovement_C.hpp"
uint32_t CGUnit::GetBaseOffset() {
return CGObject::TotalFields();
@ -29,10 +30,18 @@ int32_t CGUnit::GetDisplayID() const {
return this->Unit()->displayID;
}
float CGUnit::GetFacing() const {
return this->m_move->GetFacing();
}
int32_t CGUnit::GetNativeDisplayID() const {
return this->Unit()->nativeDisplayID;
}
C3Vector CGUnit::GetPosition() const {
return this->m_move->GetPosition();
}
CGUnitData* CGUnit::Unit() const {
return this->m_unit;
}

View File

@ -2,8 +2,11 @@
#define OBJECT_CLIENT_CG_UNIT_HPP
#include "util/GUID.hpp"
#include <tempest/Vector.hpp>
#include <cstdint>
class CMovement_C;
struct CGUnitData {
WOWGUID charm;
WOWGUID summon;
@ -83,13 +86,18 @@ class CGUnit {
static uint32_t TotalFieldsSaved();
// Public member functions
CGUnit(CMovement_C& move)
: m_move(&move) {};
int32_t GetDisplayID() const;
float GetFacing() const;
int32_t GetNativeDisplayID() const;
C3Vector GetPosition() const;
protected:
// Protected member variables
CGUnitData* m_unit;
uint32_t* m_unitSaved;
CMovement_C* m_move;
// Protected member functions
CGUnitData* Unit() const;

View File

@ -96,7 +96,11 @@ const char* CGUnit_C::GetDisplayRaceNameFromRecord(const ChrRacesRec* raceRec, U
return raceRec->m_name;
}
CGUnit_C::CGUnit_C(uint32_t time, CClientObjCreate& objCreate) : CGObject_C(time, objCreate) {
CGUnit_C::CGUnit_C(uint32_t time, CClientObjCreate& objCreate)
: CGObject_C(time, objCreate)
, CGUnit(this->m_localMove)
, m_localMove(objCreate.move.status.position28, objCreate.move.status.facing34, this->GetGUID(), this)
{
// TODO
this->RefreshDataPointers();
@ -132,6 +136,10 @@ int32_t CGUnit_C::GetDisplayID() const {
return this->CGUnit::GetDisplayID();
}
float CGUnit_C::GetFacing() const {
return this->CGUnit::GetFacing();
}
int32_t CGUnit_C::GetLocalDisplayID() const {
return this->m_localDisplayID;
}
@ -171,6 +179,10 @@ int32_t CGUnit_C::GetModelFileName(const char*& name) const {
return modelDataRec->m_modelName ? true : false;
}
C3Vector CGUnit_C::GetPosition() const {
return this->CGUnit::GetPosition();
}
void CGUnit_C::PostInit(uint32_t time, const CClientObjCreate& init, bool a4) {
// TODO

View File

@ -4,6 +4,7 @@
#include "object/client/CClientObjCreate.hpp"
#include "object/client/CGObject_C.hpp"
#include "object/client/CGUnit.hpp"
#include "object/client/CMovement_C.hpp"
#include "object/Types.hpp"
#include "util/GUID.hpp"
@ -27,6 +28,10 @@ class CGUnit_C : public CGObject_C, public CGUnit {
// Virtual public member functions
virtual ~CGUnit_C();
// TODO
virtual C3Vector GetPosition() const;
// TODO
virtual float GetFacing() const;
// TODO
virtual int32_t GetModelFileName(const char*& name) const;
// TODO
virtual int32_t CanHighlight();
@ -49,12 +54,14 @@ class CGUnit_C : public CGObject_C, public CGUnit {
private:
// Private member variables
// TODO
CreatureDisplayInfoRec* m_displayInfo;
CreatureDisplayInfoExtraRec* m_displayInfoExtra;
CreatureModelDataRec* m_modelData;
CreatureSoundDataRec* m_soundData;
CMovement_C m_localMove;
// TODO
UnitBloodLevelsRec* m_bloodRec;
CreatureDisplayInfoRec* m_displayInfo = nullptr;
CreatureDisplayInfoExtraRec* m_displayInfoExtra = nullptr;
CreatureModelDataRec* m_modelData = nullptr;
CreatureSoundDataRec* m_soundData = nullptr;
// TODO
UnitBloodLevelsRec* m_bloodRec = nullptr;
// TODO
int32_t m_localDisplayID = 0;
// TODO

View File

@ -0,0 +1,7 @@
#include "object/client/CMovementData_C.hpp"
CMovementData_C::CMovementData_C(const C3Vector& position, float facing, const WOWGUID& guid, CGUnit_C* unit)
: CMovementShared(0, position, facing, guid)
{
// TODO
}

View File

@ -0,0 +1,14 @@
#ifndef OBJECT_CLIENT_C_MOVEMENT_DATA_C_HPP
#define OBJECT_CLIENT_C_MOVEMENT_DATA_C_HPP
#include "object/movement/CMovementShared.hpp"
class CGUnit_C;
class CMovementData_C : public CMovementShared {
public:
// Public member functions
CMovementData_C(const C3Vector& position, float facing, const WOWGUID& guid, CGUnit_C* unit);
};
#endif

View File

@ -0,0 +1,15 @@
#ifndef OBJECT_CLIENT_C_MOVEMENT_C_HPP
#define OBJECT_CLIENT_C_MOVEMENT_C_HPP
#include "object/client/CMovementData_C.hpp"
#include "util/GUID.hpp"
#include <tempest/Vector.hpp>
class CMovement_C : public CMovementData_C {
public:
// Public member functions
CMovement_C(const C3Vector& position, float facing, const WOWGUID& guid, CGUnit_C* unit)
: CMovementData_C(position, facing, guid, unit) {};
};
#endif

View File

@ -0,0 +1,15 @@
#include "object/movement/CMovementShared.hpp"
CMovementShared::CMovementShared(const WOWGUID& transportGUID, const C3Vector& position, float facing, const WOWGUID& guid)
: CPassenger(transportGUID, position, guid)
{
this->m_facing = facing;
this->m_anchorPosition = position;
this->m_anchorFacing = facing;
this->m_anchorPitch = 0.0f;
this->m_cosAnchorPitch = 1.0f;
this->m_sinAnchorPitch = 0.0f;
this->m_spline = nullptr;
}

View File

@ -0,0 +1,31 @@
#ifndef OBJECT_MOVEMENT_C_MOVEMENT_SHARED_HPP
#define OBJECT_MOVEMENT_C_MOVEMENT_SHARED_HPP
#include "object/movement/CPassenger.hpp"
#include "util/GUID.hpp"
#include <tempest/Vector.hpp>
struct CMoveSpline;
class CMovementShared : public CPassenger {
public:
// Public member functions
CMovementShared(const WOWGUID& transportGUID, const C3Vector& position, float facing, const WOWGUID& guid);
protected:
// Protected member variables
// TODO
C3Vector m_anchorPosition;
float m_anchorFacing;
float m_anchorPitch;
// TODO
C3Vector m_direction;
C2Vector m_direction2d;
float m_cosAnchorPitch;
float m_sinAnchorPitch;
// TODO
CMoveSpline* m_spline;
// TODO
};
#endif

View File

@ -48,7 +48,7 @@ CDataStore& operator>>(CDataStore& msg, CMovementStatus& move) {
msg.Get(move.uint14);
msg.Get(move.uint0);
msg >> move.position18;
msg >> move.position28;
msg.Get(move.facing34);
if (move.moveFlags & 0x200) {

View File

@ -0,0 +1,34 @@
#include "object/movement/CPassenger.hpp"
#include <tempest/Matrix.hpp>
float CPassenger::GetFacing() const {
return this->GetFacing(this->m_facing);
}
float CPassenger::GetFacing(float facing) const {
// If on transport, transform facing by transport facing
if (this->m_transportGUID) {
float transportFacing = 0.0f;
// TODO MovementGetTransportFacing(this->m_transportGUID);
return facing + transportFacing;
}
return facing;
}
C3Vector CPassenger::GetPosition() const {
return this->GetPosition(this->m_position);
}
C3Vector CPassenger::GetPosition(const C3Vector& position) const {
// If on transport, transform position by transport matrix
if (this->m_transportGUID) {
C44Matrix transportMatrix;
// TODO MovementGetTransportMtxX(this->m_transportGUID, &transportMatrix);
return position * transportMatrix;
}
return position;
}

View File

@ -0,0 +1,32 @@
#ifndef OBJECT_MOVEMENT_C_PASSENGER_HPP
#define OBJECT_MOVEMENT_C_PASSENGER_HPP
#include "util/GUID.hpp"
#include <tempest/Vector.hpp>
class CPassenger {
public:
// Public member functions
CPassenger(const WOWGUID& transportGUID, const C3Vector& position, const WOWGUID& guid)
: m_transportGUID(transportGUID)
, m_position(position)
, m_facing(0.0f)
, m_guid(guid) {};
float GetFacing() const;
float GetFacing(float facing) const;
C3Vector GetPosition() const;
C3Vector GetPosition(const C3Vector& position) const;
protected:
// Protected member variables
// TODO
WOWGUID m_transportGUID;
C3Vector m_position;
// TODO
float m_facing;
// TODO
const WOWGUID& m_guid;
// TODO
};
#endif