mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-19 14:11:06 +03:00
Compare commits
1 Commits
fd1f1eaf22
...
6076faf6be
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6076faf6be |
@ -30,8 +30,6 @@ CVar* Client::g_accountNameVar;
|
||||
CVar* Client::g_accountListVar;
|
||||
HEVENTCONTEXT Client::g_clientEventContext;
|
||||
|
||||
CGameTime g_clientGameTime;
|
||||
|
||||
static CVar* s_desktopGammaCvar;
|
||||
static CVar* s_gammaCvar;
|
||||
static CVar* s_textureCacheSizeCvar;
|
||||
@ -72,28 +70,10 @@ void BaseInitializeGlobal() {
|
||||
PropInitialize();
|
||||
}
|
||||
|
||||
int32_t ClientGameTimeTickHandler(const void* data, void* param) {
|
||||
STORM_ASSERT(data);
|
||||
|
||||
g_clientGameTime.GameTimeUpdate(static_cast<const EVENT_DATA_IDLE*>(data)->elapsedSec);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void ClientInitializeGameTime() {
|
||||
ClientServices::SetMessageHandler(SMSG_GAME_SPEED_SET, &ReceiveNewGameSpeed, nullptr);
|
||||
ClientServices::SetMessageHandler(SMSG_LOGIN_SET_TIME_SPEED, &ReceiveNewTimeSpeed, nullptr);
|
||||
ClientServices::SetMessageHandler(SMSG_GAME_TIME_UPDATE, &ReceiveGameTimeUpdate, nullptr);
|
||||
ClientServices::SetMessageHandler(SMSG_SERVERTIME, &ReceiveServerTime, nullptr);
|
||||
ClientServices::SetMessageHandler(SMSG_GAME_TIME_SET, &ReceiveNewGameTime, nullptr);
|
||||
|
||||
// TODO initialize s_forcedChangeCallbacks
|
||||
}
|
||||
|
||||
int32_t ClientIdle(const void* data, void* param) {
|
||||
ClientGameTimeTickHandler(data, nullptr);
|
||||
|
||||
// TODO Player_C_ZoneUpdateHandler(data, nullptr);
|
||||
// TODO
|
||||
// ClientGameTimeTickHandler(data, param);
|
||||
// Player_C_ZoneUpdateHandler(data, param);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -111,7 +91,6 @@ void ClientInitializeGame(uint32_t mapId, C3Vector position) {
|
||||
// TODO
|
||||
|
||||
EventRegister(EVENT_ID_IDLE, ClientIdle);
|
||||
ClientInitializeGameTime();
|
||||
|
||||
// TODO
|
||||
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
#define CLIENT_CLIENT_HPP
|
||||
|
||||
#include "event/Event.hpp"
|
||||
#include "util/Time.hpp"
|
||||
#include <tempest/Vector.hpp>
|
||||
|
||||
class CVar;
|
||||
@ -13,8 +12,6 @@ namespace Client {
|
||||
extern HEVENTCONTEXT g_clientEventContext;
|
||||
}
|
||||
|
||||
extern CGameTime g_clientGameTime;
|
||||
|
||||
void ClientInitializeGame(uint32_t mapId, C3Vector position);
|
||||
|
||||
void ClientPostClose(int32_t a1);
|
||||
|
||||
@ -1,14 +1,11 @@
|
||||
#include "client/ClientHandlers.hpp"
|
||||
#include "Client.hpp"
|
||||
#include "console/Console.hpp"
|
||||
#include "db/Db.hpp"
|
||||
#include "object/Client.hpp"
|
||||
#include "util/Time.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
#include "world/World.hpp"
|
||||
#include <common/DataStore.hpp>
|
||||
#include <cstdint>
|
||||
#include <tempest/Vector.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
static float s_newFacing;
|
||||
static C3Vector s_newPosition;
|
||||
@ -80,56 +77,6 @@ int32_t PlayedTimeHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataSto
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t ReceiveGameTimeUpdate(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t ReceiveNewGameSpeed(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t ReceiveNewGameTime(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t ReceiveNewTimeSpeed(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg) {
|
||||
uint32_t encodedTime;
|
||||
msg->Get(encodedTime);
|
||||
|
||||
float newSpeed;
|
||||
msg->Get(newSpeed);
|
||||
|
||||
uint32_t holidayOffset;
|
||||
msg->Get(holidayOffset);
|
||||
|
||||
if (!msg->IsRead()) {
|
||||
STORM_ASSERT(msg->IsFinal());
|
||||
// TODO ConsoleWriteA("Malformed message received: Id = %d, Len = %d, Read = %d\n", DEFAULT_COLOR, msgId, msg->Size(), msg->Tell());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
WowTime newTime;
|
||||
WowTime::WowDecodeTime(encodedTime, &newTime);
|
||||
newTime.m_holidayOffset = holidayOffset;
|
||||
|
||||
g_clientGameTime.GameTimeSetTime(newTime, true);
|
||||
|
||||
// TODO UpdateTime();
|
||||
|
||||
auto oldSpeed = g_clientGameTime.GameTimeSetMinutesPerSecond(newSpeed);
|
||||
|
||||
char logStr[256];
|
||||
SStrPrintf(logStr, sizeof(logStr), "Gamespeed set from %.03f to %.03f", oldSpeed, newSpeed);
|
||||
ConsoleWrite(logStr, DEFAULT_COLOR);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t ReceiveServerTime(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
int32_t TransferAbortedHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg) {
|
||||
// TODO
|
||||
|
||||
|
||||
@ -14,16 +14,6 @@ int32_t NotifyHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore*
|
||||
|
||||
int32_t PlayedTimeHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
|
||||
|
||||
int32_t ReceiveGameTimeUpdate(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
|
||||
|
||||
int32_t ReceiveNewGameSpeed(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
|
||||
|
||||
int32_t ReceiveNewGameTime(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
|
||||
|
||||
int32_t ReceiveNewTimeSpeed(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
|
||||
|
||||
int32_t ReceiveServerTime(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
|
||||
|
||||
int32_t TransferAbortedHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
|
||||
|
||||
int32_t TransferPendingHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
#include "ui/FrameScript.hpp"
|
||||
#include "client/Client.hpp"
|
||||
#include "ui/ScriptFunctionsShared.hpp"
|
||||
#include "ui/Types.hpp"
|
||||
#include "util/Lua.hpp"
|
||||
@ -15,10 +14,10 @@ int32_t Script_GetTime(lua_State* L) {
|
||||
}
|
||||
|
||||
int32_t Script_GetGameTime(lua_State* L) {
|
||||
lua_pushnumber(L, g_clientGameTime.m_hour);
|
||||
lua_pushnumber(L, g_clientGameTime.m_minute);
|
||||
|
||||
return 2;
|
||||
// TODO real implementation
|
||||
lua_pushnumber(L, 1.0);
|
||||
lua_pushnumber(L, 15.0);
|
||||
WHOA_UNIMPLEMENTED(2);
|
||||
}
|
||||
|
||||
int32_t Script_ConsoleExec(lua_State* L) {
|
||||
|
||||
@ -1,20 +1,6 @@
|
||||
#include "util/time/CGameTime.hpp"
|
||||
#include "common/Time.hpp"
|
||||
|
||||
float CGameTime::GameTimeSetMinutesPerSecond(float minutesPerSec) {
|
||||
float oldMinutesPerSec = this->m_gameMinutesPerRealSecond;
|
||||
|
||||
if (minutesPerSec > CGameTime::MAX_SPEED) {
|
||||
minutesPerSec = CGameTime::MAX_SPEED;
|
||||
} else if (minutesPerSec < CGameTime::MIN_SPEED) {
|
||||
minutesPerSec = CGameTime::MIN_SPEED;
|
||||
}
|
||||
|
||||
this->m_gameMinutesPerRealSecond = minutesPerSec;
|
||||
|
||||
return oldMinutesPerSec;
|
||||
}
|
||||
|
||||
void CGameTime::GameTimeSetTime(const WowTime& time, bool shouldTick) {
|
||||
WowTime biasTime = time;
|
||||
|
||||
|
||||
@ -5,12 +5,7 @@
|
||||
|
||||
class CGameTime : public WowTime {
|
||||
public:
|
||||
// Public static variables
|
||||
static constexpr float MIN_SPEED = 1.0f / 60.0f;
|
||||
static constexpr float MAX_SPEED = 60.0f;
|
||||
|
||||
// Public member functions
|
||||
float GameTimeSetMinutesPerSecond(float minutesPerSec);
|
||||
void GameTimeSetTime(const WowTime& time, bool shouldTick);
|
||||
void GameTimeUpdate(float elapsedSec);
|
||||
|
||||
@ -20,7 +15,7 @@ class CGameTime : public WowTime {
|
||||
int32_t m_timeBias = 0;
|
||||
int32_t m_dateBias = 0;
|
||||
uint32_t m_gameMinutesElapsed = 0;
|
||||
float m_gameMinutesPerRealSecond = MIN_SPEED;
|
||||
float m_gameMinutesPerRealSecond = 1.0f / 60.0f;
|
||||
float m_gameMinutesThisTick = 0.0f;
|
||||
uint32_t m_timeDifferential = 0;
|
||||
uint32_t m_lastTickMinute = 0;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user