mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-18 05:31:07 +03:00
Compare commits
7 Commits
145bd5e2e3
...
7c2e1e582c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c2e1e582c | ||
|
|
74bc963a1c | ||
|
|
c3b9256fc5 | ||
|
|
2034536620 | ||
|
|
abf9eb3b05 | ||
|
|
00d340c242 | ||
|
|
d3d4fa884f |
@ -1 +1 @@
|
||||
Subproject commit 489f2149b74b2ca8302ec1cbcec9c6250057f7a1
|
||||
Subproject commit c6ee931690f71362ab76602fb6f34a6cf23d12b8
|
||||
@ -111,6 +111,10 @@ C3Vector CGObject_C::GetPosition() const {
|
||||
return { 0.0f, 0.0f, 0.0f };
|
||||
}
|
||||
|
||||
float CGObject_C::GetRawFacing() const {
|
||||
return this->GetFacing();
|
||||
}
|
||||
|
||||
WOWGUID CGObject_C::GetTransportGUID() const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -39,6 +39,7 @@ class CGObject_C : public CGObject, public TSHashObject<CGObject_C, CHashKeyGUID
|
||||
virtual C3Vector GetPosition() const;
|
||||
// TODO
|
||||
virtual float GetFacing() const;
|
||||
virtual float GetRawFacing() const;
|
||||
// TODO
|
||||
virtual WOWGUID GetTransportGUID() const;
|
||||
// TODO
|
||||
|
||||
@ -42,6 +42,10 @@ C3Vector CGUnit::GetPosition() const {
|
||||
return this->m_move->GetPosition();
|
||||
}
|
||||
|
||||
float CGUnit::GetRawFacing() const {
|
||||
return this->m_move->GetRawFacing();
|
||||
}
|
||||
|
||||
CGUnitData* CGUnit::Unit() const {
|
||||
return this->m_unit;
|
||||
}
|
||||
|
||||
@ -92,6 +92,7 @@ class CGUnit {
|
||||
float GetFacing() const;
|
||||
int32_t GetNativeDisplayID() const;
|
||||
C3Vector GetPosition() const;
|
||||
float GetRawFacing() const;
|
||||
|
||||
protected:
|
||||
// Protected member variables
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
#include "object/client/CGUnit_C.hpp"
|
||||
#include "component/CCharacterComponent.hpp"
|
||||
#include "db/Db.hpp"
|
||||
#include "model/Model2.hpp"
|
||||
#include "object/client/ObjMgr.hpp"
|
||||
#include "db/Db.hpp"
|
||||
#include "ui/Game.hpp"
|
||||
#include <storm/Error.hpp>
|
||||
#include <tempest/Math.hpp>
|
||||
|
||||
WOWGUID CGUnit_C::s_activeMover;
|
||||
|
||||
@ -183,6 +184,10 @@ C3Vector CGUnit_C::GetPosition() const {
|
||||
return this->CGUnit::GetPosition();
|
||||
}
|
||||
|
||||
float CGUnit_C::GetRawFacing() const {
|
||||
return this->CGUnit::GetRawFacing();
|
||||
}
|
||||
|
||||
float CGUnit_C::GetRawSmoothFacing() const {
|
||||
return this->m_smoothFacing;
|
||||
}
|
||||
@ -208,6 +213,10 @@ void CGUnit_C::PostInit(uint32_t time, const CClientObjCreate& init, bool a4) {
|
||||
}
|
||||
|
||||
// TODO
|
||||
|
||||
this->m_smoothFacing = CMath::normalizeangle0to2pi(this->GetRawFacing());
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CGUnit_C::PostMovementUpdate(const CClientMoveUpdate& move, int32_t activeMover) {
|
||||
|
||||
@ -31,6 +31,7 @@ class CGUnit_C : public CGObject_C, public CGUnit {
|
||||
virtual C3Vector GetPosition() const;
|
||||
// TODO
|
||||
virtual float GetFacing() const;
|
||||
virtual float GetRawFacing() const;
|
||||
// TODO
|
||||
virtual WOWGUID GetTransportGUID() const;
|
||||
// TODO
|
||||
|
||||
@ -33,6 +33,10 @@ C3Vector CPassenger::GetPosition(const C3Vector& position) const {
|
||||
return position;
|
||||
}
|
||||
|
||||
float CPassenger::GetRawFacing() const {
|
||||
return this->m_facing;
|
||||
}
|
||||
|
||||
WOWGUID CPassenger::GetTransportGUID() const {
|
||||
return this->m_transportGUID;
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ class CPassenger {
|
||||
float GetFacing(float facing) const;
|
||||
C3Vector GetPosition() const;
|
||||
C3Vector GetPosition(const C3Vector& position) const;
|
||||
float GetRawFacing() const;
|
||||
WOWGUID GetTransportGUID() const;
|
||||
|
||||
protected:
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
#include "ui/game/CGCamera.hpp"
|
||||
#include "common/Time.hpp"
|
||||
#include "console/CVar.hpp"
|
||||
#include "object/Client.hpp"
|
||||
#include "object/client/CVehicleCamera_C.hpp"
|
||||
@ -39,10 +40,56 @@ bool ValidateCameraView(CVar* var, const char* oldValue, const char* value, void
|
||||
|
||||
}
|
||||
|
||||
int32_t CGCamera::UpdateCallback(const void*, void* param) {
|
||||
auto camera = static_cast<CGCamera*>(param);
|
||||
|
||||
if (!camera) {
|
||||
return true;
|
||||
}
|
||||
|
||||
auto timestamp = OsGetAsyncTimeMsPrecise();
|
||||
|
||||
camera->m_nearZ = CWorld::GetNearClip();
|
||||
camera->m_farZ = CWorld::GetFarClip();
|
||||
|
||||
// Model camera
|
||||
|
||||
if (camera->HasModel()) {
|
||||
camera->CalcModelCamera(timestamp);
|
||||
camera->CheckUnderwater();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Target camera
|
||||
|
||||
auto target = ClntObjMgrObjectPtr(camera->m_target, TYPE_OBJECT, __FILE__, __LINE__);
|
||||
|
||||
if (target) {
|
||||
camera->CalcTargetCamera(target, timestamp);
|
||||
camera->CheckUnderwater();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Unknown camera
|
||||
|
||||
auto object90 = ClntObjMgrObjectPtr(camera->guid90, TYPE_OBJECT, __FILE__, __LINE__);
|
||||
|
||||
if (object90) {
|
||||
// TODO
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
CGCamera::CGCamera() : CSimpleCamera(CWorld::GetNearClip(), CWorld::GetFarClip(), 90.0f * CMath::DEG2RAD) {
|
||||
this->m_model = nullptr;
|
||||
|
||||
this->m_target = 0;
|
||||
this->guid90 = 0;
|
||||
this->m_relativeTo = 0;
|
||||
|
||||
this->m_view = s_cameraView->GetInt();
|
||||
@ -55,6 +102,18 @@ CGCamera::CGCamera() : CSimpleCamera(CWorld::GetNearClip(), CWorld::GetFarClip()
|
||||
this->m_fovOffset = 0.0f;
|
||||
}
|
||||
|
||||
void CGCamera::CalcModelCamera(uint32_t timestamp) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CGCamera::CalcTargetCamera(CGObject_C* target, uint32_t timestamp) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CGCamera::CheckUnderwater() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
float CGCamera::FOV() const {
|
||||
// Clamp offset-adjusted FOV between 0pi and 1pi
|
||||
return std::min(std::max(this->m_fov + this->m_fovOffset, 0.0f), CMath::PI);
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
#include "ui/simple/CSimpleCamera.hpp"
|
||||
#include "util/GUID.hpp"
|
||||
|
||||
class CGObject_C;
|
||||
class CM2Model;
|
||||
|
||||
class CGCamera : public CSimpleCamera {
|
||||
@ -18,6 +19,9 @@ class CGCamera : public CSimpleCamera {
|
||||
// Public static variables
|
||||
static CameraViewData s_cameraViewDataDefault[];
|
||||
|
||||
// Public static functions
|
||||
static int32_t UpdateCallback(const void*, void* param);
|
||||
|
||||
// Virtual public member functions
|
||||
virtual ~CGCamera() = default;
|
||||
virtual float FOV() const;
|
||||
@ -27,6 +31,9 @@ class CGCamera : public CSimpleCamera {
|
||||
|
||||
// Public member functions
|
||||
CGCamera();
|
||||
void CalcModelCamera(uint32_t timestamp);
|
||||
void CalcTargetCamera(CGObject_C* target, uint32_t timestamp);
|
||||
void CheckUnderwater();
|
||||
const WOWGUID& GetTarget() const;
|
||||
int32_t HasModel() const;
|
||||
C33Matrix ParentToWorld() const;
|
||||
@ -38,6 +45,7 @@ class CGCamera : public CSimpleCamera {
|
||||
CM2Model* m_model;
|
||||
// TODO
|
||||
WOWGUID m_target;
|
||||
WOWGUID guid90;
|
||||
// TODO
|
||||
WOWGUID m_relativeTo;
|
||||
// TODO
|
||||
|
||||
@ -98,6 +98,10 @@ void CGWorldFrame::OnWorldUpdate() {
|
||||
|
||||
// TODO
|
||||
|
||||
CGCamera::UpdateCallback(nullptr, this->m_camera);
|
||||
|
||||
// TODO
|
||||
|
||||
this->m_camera->SetupWorldProjection(this->m_screenRect);
|
||||
|
||||
// TODO
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
#define UTIL_TIME_HPP
|
||||
|
||||
#include "util/time/CGameTime.hpp"
|
||||
#include "util/time/Types.hpp"
|
||||
#include "util/time/WowTime.hpp"
|
||||
|
||||
#endif
|
||||
|
||||
8
src/util/time/Types.hpp
Normal file
8
src/util/time/Types.hpp
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef UTIL_TIME_TYPES_HPP
|
||||
#define UTIL_TIME_TYPES_HPP
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
typedef uint64_t whoa_tick_t;
|
||||
|
||||
#endif
|
||||
Loading…
Reference in New Issue
Block a user