mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-18 05:31:07 +03:00
Compare commits
19 Commits
1347f509d4
...
9e28841cec
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e28841cec | ||
|
|
e5150d7d21 | ||
|
|
3a876398a7 | ||
|
|
1b90dcb09b | ||
|
|
c5bd63b79e | ||
|
|
5492b3f231 | ||
|
|
8851d2e5e1 | ||
|
|
0a91d44600 | ||
|
|
d19658185a | ||
|
|
abf2e2cde3 | ||
|
|
6b7abe3c03 | ||
|
|
fa98bbc1f0 | ||
|
|
af4b798942 | ||
|
|
9b18f2f3bd | ||
|
|
6cb5310430 | ||
|
|
cb8291af1a | ||
|
|
58c8975769 | ||
|
|
817cec99fe | ||
|
|
6675586a29 |
@ -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);
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -95,6 +95,10 @@ void CGObject_C::Disable() {
|
||||
this->m_disableTimeMs = CWorld::GetCurTimeMs();
|
||||
}
|
||||
|
||||
float CGObject_C::GetFacing() const {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
int32_t CGObject_C::GetModelFileName(const char*& name) const {
|
||||
return false;
|
||||
}
|
||||
@ -103,6 +107,10 @@ CM2Model* CGObject_C::GetObjectModel() {
|
||||
return this->m_model;
|
||||
}
|
||||
|
||||
C3Vector CGObject_C::GetPosition() const {
|
||||
return { 0.0f, 0.0f, 0.0f };
|
||||
}
|
||||
|
||||
int32_t CGObject_C::IsInReenable() {
|
||||
return this->m_inReenable;
|
||||
}
|
||||
|
||||
@ -36,6 +36,10 @@ class CGObject_C : public CGObject, public TSHashObject<CGObject_C, CHashKeyGUID
|
||||
virtual void HandleOutOfRange(OUT_OF_RANGE_TYPE type) {};
|
||||
virtual void UpdateWorldObject(int32_t a2);
|
||||
// TODO
|
||||
virtual C3Vector GetPosition() const;
|
||||
// TODO
|
||||
virtual float GetFacing() const;
|
||||
// TODO
|
||||
virtual int32_t GetModelFileName(const char*& name) const;
|
||||
// TODO
|
||||
virtual int32_t CanHighlight();
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
7
src/object/client/CMovementData_C.cpp
Normal file
7
src/object/client/CMovementData_C.cpp
Normal 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
|
||||
}
|
||||
14
src/object/client/CMovementData_C.hpp
Normal file
14
src/object/client/CMovementData_C.hpp
Normal 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
|
||||
15
src/object/client/CMovement_C.hpp
Normal file
15
src/object/client/CMovement_C.hpp
Normal 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
|
||||
15
src/object/movement/CMovementShared.cpp
Normal file
15
src/object/movement/CMovementShared.cpp
Normal 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;
|
||||
}
|
||||
31
src/object/movement/CMovementShared.hpp
Normal file
31
src/object/movement/CMovementShared.hpp
Normal 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
|
||||
@ -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) {
|
||||
|
||||
34
src/object/movement/CPassenger.cpp
Normal file
34
src/object/movement/CPassenger.cpp
Normal 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;
|
||||
}
|
||||
32
src/object/movement/CPassenger.hpp
Normal file
32
src/object/movement/CPassenger.hpp
Normal 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
|
||||
@ -38,6 +38,9 @@ bool ValidateCameraView(CVar* var, const char* oldValue, const char* value, void
|
||||
}
|
||||
|
||||
CGCamera::CGCamera() : CSimpleCamera(CWorld::GetNearClip(), CWorld::GetFarClip(), 90.0f * CMath::DEG2RAD) {
|
||||
this->m_model = nullptr;
|
||||
|
||||
this->m_target = 0;
|
||||
this->m_relativeTo = 0;
|
||||
|
||||
this->m_view = s_cameraView->GetInt();
|
||||
@ -63,6 +66,14 @@ C3Vector CGCamera::Forward() const {
|
||||
return this->CSimpleCamera::Forward();
|
||||
}
|
||||
|
||||
const WOWGUID& CGCamera::GetTarget() const {
|
||||
return this->m_target;
|
||||
}
|
||||
|
||||
int32_t CGCamera::HasModel() const {
|
||||
return this->m_model != nullptr;
|
||||
}
|
||||
|
||||
C33Matrix CGCamera::ParentToWorld() const {
|
||||
// TODO
|
||||
return {};
|
||||
@ -80,6 +91,10 @@ void CGCamera::SetupWorldProjection(const CRect& projRect) {
|
||||
this->SetGxProjectionAndView(projRect);
|
||||
}
|
||||
|
||||
C3Vector CGCamera::Target() const {
|
||||
return this->m_position + this->Forward();
|
||||
}
|
||||
|
||||
C3Vector CGCamera::Up() const {
|
||||
if (this->m_relativeTo) {
|
||||
return this->CSimpleCamera::Up() * this->ParentToWorld();
|
||||
|
||||
@ -4,6 +4,8 @@
|
||||
#include "ui/simple/CSimpleCamera.hpp"
|
||||
#include "util/GUID.hpp"
|
||||
|
||||
class CM2Model;
|
||||
|
||||
class CGCamera : public CSimpleCamera {
|
||||
public:
|
||||
// Public structs
|
||||
@ -25,11 +27,17 @@ class CGCamera : public CSimpleCamera {
|
||||
|
||||
// Public member functions
|
||||
CGCamera();
|
||||
const WOWGUID& GetTarget() const;
|
||||
int32_t HasModel() const;
|
||||
C33Matrix ParentToWorld() const;
|
||||
void SetupWorldProjection(const CRect& projRect);
|
||||
C3Vector Target() const;
|
||||
|
||||
private:
|
||||
// Private member variables
|
||||
CM2Model* m_model;
|
||||
// TODO
|
||||
WOWGUID m_target;
|
||||
// TODO
|
||||
WOWGUID m_relativeTo;
|
||||
// TODO
|
||||
|
||||
@ -2,8 +2,10 @@
|
||||
#include "gx/Coordinate.hpp"
|
||||
#include "gx/Shader.hpp"
|
||||
#include "gx/Transform.hpp"
|
||||
#include "object/Client.hpp"
|
||||
#include "ui/game/CGCamera.hpp"
|
||||
#include "ui/game/PlayerName.hpp"
|
||||
#include "world/World.hpp"
|
||||
#include <storm/Memory.hpp>
|
||||
#include <tempest/Matrix.hpp>
|
||||
|
||||
@ -92,7 +94,19 @@ void CGWorldFrame::OnWorldRender() {
|
||||
void CGWorldFrame::OnWorldUpdate() {
|
||||
// TODO
|
||||
|
||||
auto target = ClntObjMgrObjectPtr(this->m_camera->GetTarget(), TYPE_OBJECT, __FILE__, __LINE__);
|
||||
|
||||
// TODO
|
||||
|
||||
this->m_camera->SetupWorldProjection(this->m_screenRect);
|
||||
|
||||
// TODO
|
||||
|
||||
auto targetPos = target && !this->m_camera->HasModel()
|
||||
? target->GetPosition()
|
||||
: this->m_camera->Position();
|
||||
|
||||
CWorld::Update(this->m_camera->Position(), this->m_camera->Target(), targetPos);
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
@ -84,6 +84,10 @@ C3Vector CSimpleCamera::Right() const {
|
||||
return { this->m_facing.b0, this->m_facing.b1, this->m_facing.b2 };
|
||||
}
|
||||
|
||||
const C3Vector& CSimpleCamera::Position() const {
|
||||
return this->m_position;
|
||||
}
|
||||
|
||||
void CSimpleCamera::SetFacing(const C3Vector& forward) {
|
||||
BuildBillboardMatrix(forward, this->m_facing);
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@ class CSimpleCamera {
|
||||
// Public member functions
|
||||
CSimpleCamera(float nearZ, float farZ, float fov);
|
||||
CM2Scene* GetScene();
|
||||
const C3Vector& Position() const;
|
||||
void SetFacing(const C3Vector& forward);
|
||||
void SetFacing(const C3Vector& forward, const C3Vector& up);
|
||||
void SetFacing(float yaw, float pitch, float roll);
|
||||
|
||||
@ -213,3 +213,7 @@ void CWorld::SetUpdateTime(float tickTimeSec, uint32_t curTimeMs) {
|
||||
CWorld::s_tickTimeMs = static_cast<uint32_t>(tickTimeSec * 1000.0f);
|
||||
CWorld::s_tickTimeSec = tickTimeSec;
|
||||
}
|
||||
|
||||
void CWorld::Update(const C3Vector& cameraPos, const C3Vector& cameraTarget, const C3Vector& targetPos) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@ -70,6 +70,7 @@ class CWorld {
|
||||
static int32_t OnTick(const EVENT_DATA_TICK* data, void* param);
|
||||
static void SetFarClip(float farClip);
|
||||
static void SetUpdateTime(float tickTimeSec, uint32_t curTimeMs);
|
||||
static void Update(const C3Vector& cameraPos, const C3Vector& cameraTarget, const C3Vector& targetPos);
|
||||
|
||||
private:
|
||||
// Private static variables
|
||||
|
||||
Loading…
Reference in New Issue
Block a user