mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-02 16:52:45 +03:00
Compare commits
3 Commits
c9aaa245c9
...
553a59c808
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
553a59c808 | ||
|
|
2efef87898 | ||
|
|
c92f1b8de8 |
@ -520,8 +520,9 @@ void WowClientDestroy() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WowClientInit() {
|
void WowClientInit() {
|
||||||
|
EventRegister(EVENT_ID_TICK, reinterpret_cast<EVENTHANDLERFUNC>(&CWorld::OnTick));
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
// EventRegister(EVENT_ID_5, (int)sub_4020E0);
|
|
||||||
// _cfltcvt_init_0();
|
// _cfltcvt_init_0();
|
||||||
|
|
||||||
ClientRegisterConsoleCommands();
|
ClientRegisterConsoleCommands();
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#include "object/client/CGObject_C.hpp"
|
#include "object/client/CGObject_C.hpp"
|
||||||
#include "object/client/ObjMgr.hpp"
|
#include "object/client/ObjMgr.hpp"
|
||||||
|
#include "world/World.hpp"
|
||||||
|
|
||||||
CGObject_C::CGObject_C(uint32_t time, CClientObjCreate& objCreate) {
|
CGObject_C::CGObject_C(uint32_t time, CClientObjCreate& objCreate) {
|
||||||
// TODO
|
// TODO
|
||||||
@ -23,10 +24,12 @@ void CGObject_C::AddWorldObject() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CGObject_C::Disable() {
|
void CGObject_C::Disable() {
|
||||||
|
// TODO
|
||||||
|
|
||||||
this->m_disabled = true;
|
this->m_disabled = true;
|
||||||
// TODO other flag manipulation
|
// TODO other flag manipulation
|
||||||
|
|
||||||
// TODO
|
this->m_disableTimeMs = CWorld::GetCurTimeMs();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CGObject_C::IsInReenable() {
|
int32_t CGObject_C::IsInReenable() {
|
||||||
|
|||||||
@ -12,6 +12,7 @@ class CGObject_C : public CGObject, public TSHashObject<CGObject_C, CHashKeyGUID
|
|||||||
public:
|
public:
|
||||||
// Public member variables
|
// Public member variables
|
||||||
TSLink<CGObject_C> m_link;
|
TSLink<CGObject_C> m_link;
|
||||||
|
uint32_t m_disableTimeMs;
|
||||||
// TODO
|
// TODO
|
||||||
uint32_t m_lockCount : 16;
|
uint32_t m_lockCount : 16;
|
||||||
uint32_t m_disabled : 1;
|
uint32_t m_disabled : 1;
|
||||||
|
|||||||
@ -236,7 +236,7 @@ int32_t CreateObject(CDataStore* msg, uint32_t time) {
|
|||||||
ClntObjMgrSetActivePlayer(guid);
|
ClntObjMgrSetActivePlayer(guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto newObject = static_cast<CGObject_C*>(ClntObjMgrAllocObject(typeID, guid));
|
auto newObject = ClntObjMgrAllocObject(typeID, guid);
|
||||||
|
|
||||||
SetupObjectStorage(typeID, newObject, guid);
|
SetupObjectStorage(typeID, newObject, guid);
|
||||||
|
|
||||||
|
|||||||
@ -67,12 +67,12 @@ void MirrorInitialize() {
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void* ClntObjMgrAllocObject(OBJECT_TYPE_ID typeID, WOWGUID guid) {
|
CGObject_C* ClntObjMgrAllocObject(OBJECT_TYPE_ID typeID, WOWGUID guid) {
|
||||||
auto playerGUID = ClntObjMgrGetActivePlayer();
|
auto playerGUID = ClntObjMgrGetActivePlayer();
|
||||||
|
|
||||||
// Heap allocate player object for current player
|
// Heap allocate player object for current player
|
||||||
if (guid == playerGUID) {
|
if (guid == playerGUID) {
|
||||||
return STORM_ALLOC(sizeof(CGPlayer_C) + CGPlayer::GetDataSize() + CGPlayer::GetDataSizeSaved());
|
return static_cast<CGObject_C*>(STORM_ALLOC(sizeof(CGPlayer_C) + CGPlayer::GetDataSize() + CGPlayer::GetDataSizeSaved()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO GarbageCollect(typeID, 10000);
|
// TODO GarbageCollect(typeID, 10000);
|
||||||
@ -85,9 +85,10 @@ void* ClntObjMgrAllocObject(OBJECT_TYPE_ID typeID, WOWGUID guid) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO pointer should be fetched via ObjectPtr
|
// TODO pointer should be fetched via ObjectPtr
|
||||||
static_cast<CGObject_C*>(mem)->m_memHandle = memHandle;
|
auto object = static_cast<CGObject_C*>(mem);
|
||||||
|
object->m_memHandle = memHandle;
|
||||||
|
|
||||||
return mem;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
WOWGUID ClntObjMgrGetActivePlayer() {
|
WOWGUID ClntObjMgrGetActivePlayer() {
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
#include "object/Types.hpp"
|
#include "object/Types.hpp"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
void* ClntObjMgrAllocObject(OBJECT_TYPE_ID typeID, WOWGUID guid);
|
CGObject_C* ClntObjMgrAllocObject(OBJECT_TYPE_ID typeID, WOWGUID guid);
|
||||||
|
|
||||||
WOWGUID ClntObjMgrGetActivePlayer();
|
WOWGUID ClntObjMgrGetActivePlayer();
|
||||||
|
|
||||||
|
|||||||
@ -6,10 +6,49 @@
|
|||||||
#include "world/Weather.hpp"
|
#include "world/Weather.hpp"
|
||||||
#include <storm/Memory.hpp>
|
#include <storm/Memory.hpp>
|
||||||
|
|
||||||
|
uint32_t CWorld::s_curTimeMs;
|
||||||
|
float CWorld::s_curTimeSec;
|
||||||
uint32_t CWorld::s_enables;
|
uint32_t CWorld::s_enables;
|
||||||
uint32_t CWorld::s_enables2;
|
uint32_t CWorld::s_enables2;
|
||||||
|
uint32_t CWorld::s_gameTimeFixed;
|
||||||
|
float CWorld::s_gameTimeSec;
|
||||||
|
uint32_t CWorld::s_tickTimeFixed;
|
||||||
|
uint32_t CWorld::s_tickTimeMs;
|
||||||
|
float CWorld::s_tickTimeSec;
|
||||||
Weather* CWorld::s_weather;
|
Weather* CWorld::s_weather;
|
||||||
|
|
||||||
|
uint32_t CWorld::GetCurTimeMs() {
|
||||||
|
return CWorld::s_curTimeMs;
|
||||||
|
}
|
||||||
|
|
||||||
|
float CWorld::GetCurTimeSec() {
|
||||||
|
return CWorld::s_curTimeSec;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t CWorld::GetFixedPrecisionTime(float timeSec) {
|
||||||
|
return static_cast<uint32_t>(timeSec * 1024.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t CWorld::GetGameTimeFixed() {
|
||||||
|
return CWorld::s_gameTimeFixed;
|
||||||
|
}
|
||||||
|
|
||||||
|
float CWorld::GetGameTimeSec() {
|
||||||
|
return CWorld::s_gameTimeSec;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t CWorld::GetTickTimeFixed() {
|
||||||
|
return CWorld::s_tickTimeFixed;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t CWorld::GetTickTimeMs() {
|
||||||
|
return CWorld::s_tickTimeMs;
|
||||||
|
}
|
||||||
|
|
||||||
|
float CWorld::GetTickTimeSec() {
|
||||||
|
return CWorld::s_tickTimeSec;
|
||||||
|
}
|
||||||
|
|
||||||
void CWorld::Initialize() {
|
void CWorld::Initialize() {
|
||||||
CWorld::s_enables |=
|
CWorld::s_enables |=
|
||||||
Enables::Enable_1
|
Enables::Enable_1
|
||||||
@ -26,6 +65,9 @@ void CWorld::Initialize() {
|
|||||||
| Enables::Enable_Particulates
|
| Enables::Enable_Particulates
|
||||||
| Enables::Enable_LowDetail;
|
| Enables::Enable_LowDetail;
|
||||||
|
|
||||||
|
CWorld::s_gameTimeFixed = 0;
|
||||||
|
CWorld::s_gameTimeSec = 0.0f;
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
if (GxCaps().m_shaderTargets[GxSh_Pixel] > GxShPS_none) {
|
if (GxCaps().m_shaderTargets[GxSh_Pixel] > GxShPS_none) {
|
||||||
@ -58,3 +100,23 @@ void CWorld::LoadMap(const char* mapName, const C3Vector& position, int32_t zone
|
|||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t CWorld::OnTick(const EVENT_DATA_TICK* data, void* param) {
|
||||||
|
CWorld::SetUpdateTime(data->tickTimeSec, data->curTimeMs);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CWorld::SetUpdateTime(float tickTimeSec, uint32_t curTimeMs) {
|
||||||
|
auto tickTimeFixed = CWorld::GetFixedPrecisionTime(tickTimeSec);
|
||||||
|
|
||||||
|
CWorld::s_curTimeMs = curTimeMs;
|
||||||
|
CWorld::s_curTimeSec = static_cast<float>(curTimeMs) * 0.001f;
|
||||||
|
|
||||||
|
CWorld::s_gameTimeFixed += tickTimeFixed;
|
||||||
|
CWorld::s_gameTimeSec += tickTimeSec;
|
||||||
|
|
||||||
|
CWorld::s_tickTimeFixed = tickTimeFixed;
|
||||||
|
CWorld::s_tickTimeMs = static_cast<uint32_t>(tickTimeSec * 1000.0f);
|
||||||
|
CWorld::s_tickTimeSec = tickTimeSec;
|
||||||
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
#ifndef WORLD_C_WORLD_HPP
|
#ifndef WORLD_C_WORLD_HPP
|
||||||
#define WORLD_C_WORLD_HPP
|
#define WORLD_C_WORLD_HPP
|
||||||
|
|
||||||
|
#include "event/Event.hpp"
|
||||||
#include <tempest/Vector.hpp>
|
#include <tempest/Vector.hpp>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
@ -44,14 +45,36 @@ class CWorld {
|
|||||||
Enable_HwPcf = 0x2
|
Enable_HwPcf = 0x2
|
||||||
};
|
};
|
||||||
|
|
||||||
// Static variables
|
// Public static variables
|
||||||
static uint32_t s_enables;
|
static uint32_t s_enables;
|
||||||
static uint32_t s_enables2;
|
static uint32_t s_enables2;
|
||||||
static Weather* s_weather;
|
static Weather* s_weather;
|
||||||
|
|
||||||
// Static functions
|
// Public static functions
|
||||||
static void Initialize(void);
|
static uint32_t GetCurTimeMs();
|
||||||
|
static float GetCurTimeSec();
|
||||||
|
static uint32_t GetGameTimeFixed();
|
||||||
|
static float GetGameTimeSec();
|
||||||
|
static uint32_t GetTickTimeFixed();
|
||||||
|
static uint32_t GetTickTimeMs();
|
||||||
|
static float GetTickTimeSec();
|
||||||
|
static void Initialize();
|
||||||
static void LoadMap(const char* mapName, const C3Vector& position, int32_t zoneID);
|
static void LoadMap(const char* mapName, const C3Vector& position, int32_t zoneID);
|
||||||
|
static int32_t OnTick(const EVENT_DATA_TICK* data, void* param);
|
||||||
|
static void SetUpdateTime(float tickTimeSec, uint32_t curTimeMs);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Private static variables
|
||||||
|
static uint32_t s_curTimeMs;
|
||||||
|
static float s_curTimeSec;
|
||||||
|
static uint32_t s_gameTimeFixed;
|
||||||
|
static float s_gameTimeSec;
|
||||||
|
static uint32_t s_tickTimeFixed;
|
||||||
|
static uint32_t s_tickTimeMs;
|
||||||
|
static float s_tickTimeSec;
|
||||||
|
|
||||||
|
// Private static functions
|
||||||
|
static uint32_t GetFixedPrecisionTime(float timeSec);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user