mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-19 06:01:07 +03:00
Compare commits
1 Commits
2685f75d30
...
3c3e38b4ac
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c3e38b4ac |
@ -30,8 +30,6 @@ CVar* Client::g_accountNameVar;
|
|||||||
CVar* Client::g_accountListVar;
|
CVar* Client::g_accountListVar;
|
||||||
HEVENTCONTEXT Client::g_clientEventContext;
|
HEVENTCONTEXT Client::g_clientEventContext;
|
||||||
|
|
||||||
CGameTime g_clientGameTime;
|
|
||||||
|
|
||||||
static CVar* s_desktopGammaCvar;
|
static CVar* s_desktopGammaCvar;
|
||||||
static CVar* s_gammaCvar;
|
static CVar* s_gammaCvar;
|
||||||
static CVar* s_textureCacheSizeCvar;
|
static CVar* s_textureCacheSizeCvar;
|
||||||
@ -72,28 +70,10 @@ void BaseInitializeGlobal() {
|
|||||||
PropInitialize();
|
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) {
|
int32_t ClientIdle(const void* data, void* param) {
|
||||||
ClientGameTimeTickHandler(data, nullptr);
|
// TODO
|
||||||
|
// ClientGameTimeTickHandler(data, param);
|
||||||
// TODO Player_C_ZoneUpdateHandler(data, nullptr);
|
// Player_C_ZoneUpdateHandler(data, param);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -111,7 +91,6 @@ void ClientInitializeGame(uint32_t mapId, C3Vector position) {
|
|||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
EventRegister(EVENT_ID_IDLE, ClientIdle);
|
EventRegister(EVENT_ID_IDLE, ClientIdle);
|
||||||
ClientInitializeGameTime();
|
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
#define CLIENT_CLIENT_HPP
|
#define CLIENT_CLIENT_HPP
|
||||||
|
|
||||||
#include "event/Event.hpp"
|
#include "event/Event.hpp"
|
||||||
#include "util/Time.hpp"
|
|
||||||
#include <tempest/Vector.hpp>
|
#include <tempest/Vector.hpp>
|
||||||
|
|
||||||
class CVar;
|
class CVar;
|
||||||
@ -13,8 +12,6 @@ namespace Client {
|
|||||||
extern HEVENTCONTEXT g_clientEventContext;
|
extern HEVENTCONTEXT g_clientEventContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern CGameTime g_clientGameTime;
|
|
||||||
|
|
||||||
void ClientInitializeGame(uint32_t mapId, C3Vector position);
|
void ClientInitializeGame(uint32_t mapId, C3Vector position);
|
||||||
|
|
||||||
void ClientPostClose(int32_t a1);
|
void ClientPostClose(int32_t a1);
|
||||||
|
|||||||
@ -1,14 +1,11 @@
|
|||||||
#include "client/ClientHandlers.hpp"
|
#include "client/ClientHandlers.hpp"
|
||||||
#include "Client.hpp"
|
|
||||||
#include "console/Console.hpp"
|
#include "console/Console.hpp"
|
||||||
#include "db/Db.hpp"
|
#include "db/Db.hpp"
|
||||||
#include "object/Client.hpp"
|
#include "object/Client.hpp"
|
||||||
#include "util/Time.hpp"
|
|
||||||
#include "util/Unimplemented.hpp"
|
|
||||||
#include "world/World.hpp"
|
#include "world/World.hpp"
|
||||||
#include <common/DataStore.hpp>
|
#include <common/DataStore.hpp>
|
||||||
#include <cstdint>
|
|
||||||
#include <tempest/Vector.hpp>
|
#include <tempest/Vector.hpp>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
static float s_newFacing;
|
static float s_newFacing;
|
||||||
static C3Vector s_newPosition;
|
static C3Vector s_newPosition;
|
||||||
@ -80,56 +77,6 @@ int32_t PlayedTimeHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataSto
|
|||||||
return 0;
|
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) {
|
int32_t TransferAbortedHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg) {
|
||||||
// TODO
|
// 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 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 TransferAbortedHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
|
||||||
|
|
||||||
int32_t TransferPendingHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
|
int32_t TransferPendingHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
|
||||||
|
|||||||
@ -8,7 +8,6 @@
|
|||||||
#include "ui/simple/CSimpleModel.hpp"
|
#include "ui/simple/CSimpleModel.hpp"
|
||||||
#include "ui/simple/CSimpleScrollFrame.hpp"
|
#include "ui/simple/CSimpleScrollFrame.hpp"
|
||||||
#include "ui/simple/CSimpleSlider.hpp"
|
#include "ui/simple/CSimpleSlider.hpp"
|
||||||
#include "ui/simple/CSimpleStatusBar.hpp"
|
|
||||||
#include "util/CStatus.hpp"
|
#include "util/CStatus.hpp"
|
||||||
#include "util/SFile.hpp"
|
#include "util/SFile.hpp"
|
||||||
#include <common/XML.hpp>
|
#include <common/XML.hpp>
|
||||||
@ -97,9 +96,9 @@ CSimpleFrame* Create_SimpleHTML(CSimpleFrame* parent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CSimpleFrame* Create_SimpleStatusBar(CSimpleFrame* parent) {
|
CSimpleFrame* Create_SimpleStatusBar(CSimpleFrame* parent) {
|
||||||
// TODO CDataAllocator
|
// TODO
|
||||||
|
|
||||||
return STORM_NEW(CSimpleStatusBar(parent));
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSimpleFrame* Create_SimpleColorSelect(CSimpleFrame* parent) {
|
CSimpleFrame* Create_SimpleColorSelect(CSimpleFrame* parent) {
|
||||||
@ -542,19 +541,19 @@ int32_t FrameXML_RegisterFactory(const char* type, CSimpleFrame* (*factory)(CSim
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FrameXML_RegisterDefault() {
|
void FrameXML_RegisterDefault() {
|
||||||
FrameXML_RegisterFactory("Button", &Create_SimpleButton, false);
|
FrameXML_RegisterFactory("Button", &Create_SimpleButton, 0);
|
||||||
FrameXML_RegisterFactory("CheckButton", &Create_SimpleCheckButton, false);
|
FrameXML_RegisterFactory("CheckButton", &Create_SimpleCheckButton, 0);
|
||||||
FrameXML_RegisterFactory("EditBox", &Create_SimpleEditBox, false);
|
FrameXML_RegisterFactory("EditBox", &Create_SimpleEditBox, 0);
|
||||||
FrameXML_RegisterFactory("Frame", &Create_SimpleFrame, false);
|
FrameXML_RegisterFactory("Frame", &Create_SimpleFrame, 0);
|
||||||
FrameXML_RegisterFactory("MessageFrame", &Create_SimpleMessageFrame, false);
|
FrameXML_RegisterFactory("MessageFrame", &Create_SimpleMessageFrame, 0);
|
||||||
FrameXML_RegisterFactory("Model", &Create_SimpleModel, false);
|
FrameXML_RegisterFactory("Model", &Create_SimpleModel, 0);
|
||||||
FrameXML_RegisterFactory("ScrollFrame", &Create_SimpleScrollFrame, false);
|
FrameXML_RegisterFactory("ScrollFrame", &Create_SimpleScrollFrame, 0);
|
||||||
FrameXML_RegisterFactory("ScrollingMessageFrame", &Create_SimpleScrollingMessageFrame, false);
|
FrameXML_RegisterFactory("ScrollingMessageFrame", &Create_SimpleScrollingMessageFrame, 0);
|
||||||
FrameXML_RegisterFactory("Slider", &Create_SimpleSlider, false);
|
FrameXML_RegisterFactory("Slider", &Create_SimpleSlider, 0);
|
||||||
FrameXML_RegisterFactory("SimpleHTML", &Create_SimpleHTML, false);
|
FrameXML_RegisterFactory("SimpleHTML", &Create_SimpleHTML, 0);
|
||||||
FrameXML_RegisterFactory("StatusBar", &Create_SimpleStatusBar, false);
|
FrameXML_RegisterFactory("StatusBar", &Create_SimpleStatusBar, 0);
|
||||||
FrameXML_RegisterFactory("ColorSelect", &Create_SimpleColorSelect, false);
|
FrameXML_RegisterFactory("ColorSelect", &Create_SimpleColorSelect, 0);
|
||||||
FrameXML_RegisterFactory("MovieFrame", &Create_SimpleMovieFrame, false);
|
FrameXML_RegisterFactory("MovieFrame", &Create_SimpleMovieFrame, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameXML_ReleaseHashNode(const char* name) {
|
void FrameXML_ReleaseHashNode(const char* name) {
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#include "ui/FrameScript.hpp"
|
#include "ui/FrameScript.hpp"
|
||||||
#include "client/Client.hpp"
|
|
||||||
#include "ui/ScriptFunctionsShared.hpp"
|
#include "ui/ScriptFunctionsShared.hpp"
|
||||||
#include "ui/Types.hpp"
|
#include "ui/Types.hpp"
|
||||||
#include "util/Lua.hpp"
|
#include "util/Lua.hpp"
|
||||||
@ -15,10 +14,10 @@ int32_t Script_GetTime(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_GetGameTime(lua_State* L) {
|
int32_t Script_GetGameTime(lua_State* L) {
|
||||||
lua_pushnumber(L, g_clientGameTime.m_hour);
|
// TODO real implementation
|
||||||
lua_pushnumber(L, g_clientGameTime.m_minute);
|
lua_pushnumber(L, 1.0);
|
||||||
|
lua_pushnumber(L, 15.0);
|
||||||
return 2;
|
WHOA_UNIMPLEMENTED(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_ConsoleExec(lua_State* L) {
|
int32_t Script_ConsoleExec(lua_State* L) {
|
||||||
|
|||||||
@ -1,37 +0,0 @@
|
|||||||
#include "ui/game/CGCharacterModelBase.hpp"
|
|
||||||
#include "ui/game/CGCharacterModelBaseScript.hpp"
|
|
||||||
|
|
||||||
int32_t CGCharacterModelBase::s_metatable;
|
|
||||||
int32_t CGCharacterModelBase::s_objectType;
|
|
||||||
|
|
||||||
CSimpleFrame* CGCharacterModelBase::Create(CSimpleFrame* parent) {
|
|
||||||
// TODO use CDataAllocator
|
|
||||||
|
|
||||||
return STORM_NEW(CGCharacterModelBase)(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGCharacterModelBase::CreateScriptMetaTable() {
|
|
||||||
auto L = FrameScript_GetContext();
|
|
||||||
CGCharacterModelBase::s_metatable = FrameScript_Object::CreateScriptMetaTable(L, &CGCharacterModelBase::RegisterScriptMethods);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGCharacterModelBase::GetObjectType() {
|
|
||||||
if (!CGCharacterModelBase::s_objectType) {
|
|
||||||
CGCharacterModelBase::s_objectType = ++FrameScript_Object::s_objectTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CGCharacterModelBase::s_objectType;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGCharacterModelBase::RegisterScriptMethods(lua_State* L) {
|
|
||||||
CSimpleModel::RegisterScriptMethods(L);
|
|
||||||
FrameScript_Object::FillScriptMethodTable(L, CGCharacterModelBaseMethods, NUM_CG_CHARACTER_MODEL_BASE_SCRIPT_METHODS);
|
|
||||||
}
|
|
||||||
|
|
||||||
CGCharacterModelBase::CGCharacterModelBase(CSimpleFrame* parent) : CSimpleModel(parent) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGCharacterModelBase::GetScriptMetaTable() {
|
|
||||||
return CGCharacterModelBase::s_metatable;
|
|
||||||
}
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
#ifndef UI_GAME_C_G_CHARACTER_MODEL_BASE_HPP
|
|
||||||
#define UI_GAME_C_G_CHARACTER_MODEL_BASE_HPP
|
|
||||||
|
|
||||||
#include "ui/simple/CSimpleModel.hpp"
|
|
||||||
|
|
||||||
class CGCharacterModelBase : public CSimpleModel {
|
|
||||||
public:
|
|
||||||
// Static variables
|
|
||||||
static int32_t s_metatable;
|
|
||||||
static int32_t s_objectType;
|
|
||||||
|
|
||||||
// Static functions
|
|
||||||
static CSimpleFrame* Create(CSimpleFrame* parent);
|
|
||||||
static void CreateScriptMetaTable();
|
|
||||||
static int32_t GetObjectType();
|
|
||||||
static void RegisterScriptMethods(lua_State* L);
|
|
||||||
|
|
||||||
// Member variables
|
|
||||||
// TODO
|
|
||||||
|
|
||||||
// Virtual member functions
|
|
||||||
virtual int32_t GetScriptMetaTable();
|
|
||||||
|
|
||||||
// Member functions
|
|
||||||
CGCharacterModelBase(CSimpleFrame* parent);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
#include "ui/game/CGCharacterModelBaseScript.hpp"
|
|
||||||
#include "ui/FrameScript.hpp"
|
|
||||||
#include "util/Unimplemented.hpp"
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
int32_t Script_SetUnit(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t Script_SetCreature(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t Script_RefreshUnit(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t Script_SetRotation(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
FrameScript_Method CGCharacterModelBaseMethods[] = {
|
|
||||||
{ "SetUnit", &Script_SetUnit },
|
|
||||||
{ "SetCreature", &Script_SetCreature },
|
|
||||||
{ "RefreshUnit", &Script_RefreshUnit },
|
|
||||||
{ "SetRotation", &Script_SetRotation },
|
|
||||||
};
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
#ifndef UI_GAME_C_G_CHARACTER_MODEL_BASE_SCRIPT_HPP
|
|
||||||
#define UI_GAME_C_G_CHARACTER_MODEL_BASE_SCRIPT_HPP
|
|
||||||
|
|
||||||
#include "ui/Types.hpp"
|
|
||||||
|
|
||||||
#define NUM_CG_CHARACTER_MODEL_BASE_SCRIPT_METHODS 4
|
|
||||||
|
|
||||||
extern FrameScript_Method CGCharacterModelBaseMethods[NUM_CG_CHARACTER_MODEL_BASE_SCRIPT_METHODS];
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -1,37 +0,0 @@
|
|||||||
#include "ui/game/CGCooldown.hpp"
|
|
||||||
#include "ui/game/CGCooldownScript.hpp"
|
|
||||||
|
|
||||||
int32_t CGCooldown::s_metatable;
|
|
||||||
int32_t CGCooldown::s_objectType;
|
|
||||||
|
|
||||||
CSimpleFrame* CGCooldown::Create(CSimpleFrame* parent) {
|
|
||||||
// TODO use CDataAllocator
|
|
||||||
|
|
||||||
return STORM_NEW(CGCooldown)(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGCooldown::CreateScriptMetaTable() {
|
|
||||||
auto L = FrameScript_GetContext();
|
|
||||||
CGCooldown::s_metatable = FrameScript_Object::CreateScriptMetaTable(L, &CGCooldown::RegisterScriptMethods);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGCooldown::GetObjectType() {
|
|
||||||
if (!CGCooldown::s_objectType) {
|
|
||||||
CGCooldown::s_objectType = ++FrameScript_Object::s_objectTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CGCooldown::s_objectType;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGCooldown::RegisterScriptMethods(lua_State* L) {
|
|
||||||
CSimpleFrame::RegisterScriptMethods(L);
|
|
||||||
FrameScript_Object::FillScriptMethodTable(L, CGCooldownMethods, NUM_CG_COOLDOWN_SCRIPT_METHODS);
|
|
||||||
}
|
|
||||||
|
|
||||||
CGCooldown::CGCooldown(CSimpleFrame* parent) : CSimpleFrame(parent) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGCooldown::GetScriptMetaTable() {
|
|
||||||
return CGCooldown::s_metatable;
|
|
||||||
}
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
#ifndef UI_GAME_C_G_COOLDOWN_HPP
|
|
||||||
#define UI_GAME_C_G_COOLDOWN_HPP
|
|
||||||
|
|
||||||
#include "ui/simple/CSimpleFrame.hpp"
|
|
||||||
|
|
||||||
class CGCooldown : public CSimpleFrame {
|
|
||||||
public:
|
|
||||||
// Static variables
|
|
||||||
static int32_t s_metatable;
|
|
||||||
static int32_t s_objectType;
|
|
||||||
|
|
||||||
// Static functions
|
|
||||||
static CSimpleFrame* Create(CSimpleFrame* parent);
|
|
||||||
static void CreateScriptMetaTable();
|
|
||||||
static int32_t GetObjectType();
|
|
||||||
static void RegisterScriptMethods(lua_State* L);
|
|
||||||
|
|
||||||
// Member variables
|
|
||||||
// TODO
|
|
||||||
|
|
||||||
// Virtual member functions
|
|
||||||
virtual int32_t GetScriptMetaTable();
|
|
||||||
|
|
||||||
// Member functions
|
|
||||||
CGCooldown(CSimpleFrame* parent);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
#include "ui/game/CGCooldownScript.hpp"
|
|
||||||
#include "ui/FrameScript.hpp"
|
|
||||||
#include "util/Unimplemented.hpp"
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
int32_t CGCooldown_SetCooldown(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGCooldown_SetReverse(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGCooldown_GetReverse(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGCooldown_SetDrawEdge(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGCooldown_GetDrawEdge(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
FrameScript_Method CGCooldownMethods[] = {
|
|
||||||
{ "SetCooldown", &CGCooldown_SetCooldown },
|
|
||||||
{ "SetReverse", &CGCooldown_SetReverse },
|
|
||||||
{ "GetReverse", &CGCooldown_GetReverse },
|
|
||||||
{ "SetDrawEdge", &CGCooldown_SetDrawEdge },
|
|
||||||
{ "GetDrawEdge", &CGCooldown_GetDrawEdge },
|
|
||||||
};
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
#ifndef UI_GAME_C_G_COOLDOWN_SCRIPT_HPP
|
|
||||||
#define UI_GAME_C_G_COOLDOWN_SCRIPT_HPP
|
|
||||||
|
|
||||||
#include "ui/Types.hpp"
|
|
||||||
|
|
||||||
#define NUM_CG_COOLDOWN_SCRIPT_METHODS 5
|
|
||||||
|
|
||||||
extern FrameScript_Method CGCooldownMethods[NUM_CG_COOLDOWN_SCRIPT_METHODS];
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -1,37 +0,0 @@
|
|||||||
#include "ui/game/CGDressUpModelFrame.hpp"
|
|
||||||
#include "ui/game/CGDressUpModelFrameScript.hpp"
|
|
||||||
|
|
||||||
int32_t CGDressUpModelFrame::s_metatable;
|
|
||||||
int32_t CGDressUpModelFrame::s_objectType;
|
|
||||||
|
|
||||||
CSimpleFrame* CGDressUpModelFrame::Create(CSimpleFrame* parent) {
|
|
||||||
// TODO use CDataAllocator
|
|
||||||
|
|
||||||
return STORM_NEW(CGDressUpModelFrame)(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGDressUpModelFrame::CreateScriptMetaTable() {
|
|
||||||
auto L = FrameScript_GetContext();
|
|
||||||
CGDressUpModelFrame::s_metatable = FrameScript_Object::CreateScriptMetaTable(L, &CGDressUpModelFrame::RegisterScriptMethods);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGDressUpModelFrame::GetObjectType() {
|
|
||||||
if (!CGDressUpModelFrame::s_objectType) {
|
|
||||||
CGDressUpModelFrame::s_objectType = ++FrameScript_Object::s_objectTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CGDressUpModelFrame::s_objectType;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGDressUpModelFrame::RegisterScriptMethods(lua_State* L) {
|
|
||||||
CGCharacterModelBase::RegisterScriptMethods(L);
|
|
||||||
FrameScript_Object::FillScriptMethodTable(L, CGDressUpModelFrameMethods, NUM_CG_DRESS_UP_MODEL_FRAME_SCRIPT_METHODS);
|
|
||||||
}
|
|
||||||
|
|
||||||
CGDressUpModelFrame::CGDressUpModelFrame(CSimpleFrame* parent) : CGCharacterModelBase(parent) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGDressUpModelFrame::GetScriptMetaTable() {
|
|
||||||
return CGDressUpModelFrame::s_metatable;
|
|
||||||
}
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
#ifndef UI_GAME_C_G_DRESS_UP_MODEL_FRAME_HPP
|
|
||||||
#define UI_GAME_C_G_DRESS_UP_MODEL_FRAME_HPP
|
|
||||||
|
|
||||||
#include "ui/game/CGCharacterModelBase.hpp"
|
|
||||||
|
|
||||||
class CGDressUpModelFrame : public CGCharacterModelBase {
|
|
||||||
public:
|
|
||||||
// Static variables
|
|
||||||
static int32_t s_metatable;
|
|
||||||
static int32_t s_objectType;
|
|
||||||
|
|
||||||
// Static functions
|
|
||||||
static CSimpleFrame* Create(CSimpleFrame* parent);
|
|
||||||
static void CreateScriptMetaTable();
|
|
||||||
static int32_t GetObjectType();
|
|
||||||
static void RegisterScriptMethods(lua_State* L);
|
|
||||||
|
|
||||||
// Member variables
|
|
||||||
// TODO
|
|
||||||
|
|
||||||
// Virtual member functions
|
|
||||||
virtual int32_t GetScriptMetaTable();
|
|
||||||
|
|
||||||
// Member functions
|
|
||||||
CGDressUpModelFrame(CSimpleFrame* parent);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
#include "ui/game/CGDressUpModelFrameScript.hpp"
|
|
||||||
#include "ui/FrameScript.hpp"
|
|
||||||
#include "util/Unimplemented.hpp"
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
int32_t Script_Undress(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t Script_Dress(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t Script_TryOn(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
FrameScript_Method CGDressUpModelFrameMethods[] = {
|
|
||||||
{ "Undress", &Script_Undress },
|
|
||||||
{ "Dress", &Script_Dress },
|
|
||||||
{ "TryOn", &Script_TryOn },
|
|
||||||
};
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
#ifndef UI_GAME_C_G_DRESS_UP_MODEL_FRAME_SCRIPT_HPP
|
|
||||||
#define UI_GAME_C_G_DRESS_UP_MODEL_FRAME_SCRIPT_HPP
|
|
||||||
|
|
||||||
#include "ui/Types.hpp"
|
|
||||||
|
|
||||||
#define NUM_CG_DRESS_UP_MODEL_FRAME_SCRIPT_METHODS 3
|
|
||||||
|
|
||||||
extern FrameScript_Method CGDressUpModelFrameMethods[NUM_CG_DRESS_UP_MODEL_FRAME_SCRIPT_METHODS];
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -4,12 +4,6 @@
|
|||||||
#include "ui/FrameXML.hpp"
|
#include "ui/FrameXML.hpp"
|
||||||
#include "ui/Key.hpp"
|
#include "ui/Key.hpp"
|
||||||
#include "ui/game/BattlefieldInfoScript.hpp"
|
#include "ui/game/BattlefieldInfoScript.hpp"
|
||||||
#include "ui/game/CGCharacterModelBase.hpp"
|
|
||||||
#include "ui/game/CGCooldown.hpp"
|
|
||||||
#include "ui/game/CGDressUpModelFrame.hpp"
|
|
||||||
#include "ui/game/CGMinimapFrame.hpp"
|
|
||||||
#include "ui/game/CGQuestPOIFrame.hpp"
|
|
||||||
#include "ui/game/CGTabardModelFrame.hpp"
|
|
||||||
#include "ui/game/CGTooltip.hpp"
|
#include "ui/game/CGTooltip.hpp"
|
||||||
#include "ui/game/CGWorldFrame.hpp"
|
#include "ui/game/CGWorldFrame.hpp"
|
||||||
#include "ui/game/CharacterInfoScript.hpp"
|
#include "ui/game/CharacterInfoScript.hpp"
|
||||||
@ -28,12 +22,8 @@ void LoadScriptFunctions() {
|
|||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
CGTooltip::CreateScriptMetaTable();
|
CGTooltip::CreateScriptMetaTable();
|
||||||
CGCooldown::CreateScriptMetaTable();
|
|
||||||
CGMinimapFrame::CreateScriptMetaTable();
|
// TODO
|
||||||
CGCharacterModelBase::CreateScriptMetaTable();
|
|
||||||
CGDressUpModelFrame::CreateScriptMetaTable();
|
|
||||||
CGTabardModelFrame::CreateScriptMetaTable();
|
|
||||||
CGQuestPOIFrame::CreateScriptMetaTable();
|
|
||||||
|
|
||||||
GameScriptRegisterFunctions();
|
GameScriptRegisterFunctions();
|
||||||
UIBindingsRegisterScriptFunctions();
|
UIBindingsRegisterScriptFunctions();
|
||||||
@ -147,10 +137,6 @@ void CGGameUI::InitializeGame() {
|
|||||||
void CGGameUI::RegisterFrameFactories() {
|
void CGGameUI::RegisterFrameFactories() {
|
||||||
FrameXML_RegisterFactory("WorldFrame", &CGWorldFrame::Create, true);
|
FrameXML_RegisterFactory("WorldFrame", &CGWorldFrame::Create, true);
|
||||||
FrameXML_RegisterFactory("GameTooltip", &CGTooltip::Create, false);
|
FrameXML_RegisterFactory("GameTooltip", &CGTooltip::Create, false);
|
||||||
FrameXML_RegisterFactory("Cooldown", &CGCooldown::Create, false);
|
|
||||||
FrameXML_RegisterFactory("Minimap", &CGMinimapFrame::Create, false);
|
// TODO register remaining factories
|
||||||
FrameXML_RegisterFactory("PlayerModel", &CGCharacterModelBase::Create, false);
|
|
||||||
FrameXML_RegisterFactory("DressUpModel", &CGDressUpModelFrame::Create, false);
|
|
||||||
FrameXML_RegisterFactory("TabardModel", &CGTabardModelFrame::Create, false);
|
|
||||||
FrameXML_RegisterFactory("QuestPOIFrame", &CGQuestPOIFrame::Create, false);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,37 +0,0 @@
|
|||||||
#include "ui/game/CGMinimapFrame.hpp"
|
|
||||||
#include "ui/game/CGMinimapFrameScript.hpp"
|
|
||||||
|
|
||||||
int32_t CGMinimapFrame::s_metatable;
|
|
||||||
int32_t CGMinimapFrame::s_objectType;
|
|
||||||
|
|
||||||
CSimpleFrame* CGMinimapFrame::Create(CSimpleFrame* parent) {
|
|
||||||
// TODO use CDataAllocator
|
|
||||||
|
|
||||||
return STORM_NEW(CGMinimapFrame)(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGMinimapFrame::CreateScriptMetaTable() {
|
|
||||||
auto L = FrameScript_GetContext();
|
|
||||||
CGMinimapFrame::s_metatable = FrameScript_Object::CreateScriptMetaTable(L, &CGMinimapFrame::RegisterScriptMethods);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGMinimapFrame::GetObjectType() {
|
|
||||||
if (!CGMinimapFrame::s_objectType) {
|
|
||||||
CGMinimapFrame::s_objectType = ++FrameScript_Object::s_objectTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CGMinimapFrame::s_objectType;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGMinimapFrame::RegisterScriptMethods(lua_State* L) {
|
|
||||||
CSimpleFrame::RegisterScriptMethods(L);
|
|
||||||
FrameScript_Object::FillScriptMethodTable(L, CGMinimapFrameMethods, NUM_CG_MINIMAP_FRAME_SCRIPT_METHODS);
|
|
||||||
}
|
|
||||||
|
|
||||||
CGMinimapFrame::CGMinimapFrame(CSimpleFrame* parent) : CSimpleFrame(parent) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGMinimapFrame::GetScriptMetaTable() {
|
|
||||||
return CGMinimapFrame::s_metatable;
|
|
||||||
}
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
#ifndef UI_GAME_C_G_MINIMAP_FRAME_HPP
|
|
||||||
#define UI_GAME_C_G_MINIMAP_FRAME_HPP
|
|
||||||
|
|
||||||
#include "ui/simple/CSimpleFrame.hpp"
|
|
||||||
|
|
||||||
class CGMinimapFrame : public CSimpleFrame {
|
|
||||||
public:
|
|
||||||
// Static variables
|
|
||||||
static int32_t s_metatable;
|
|
||||||
static int32_t s_objectType;
|
|
||||||
|
|
||||||
// Static functions
|
|
||||||
static CSimpleFrame* Create(CSimpleFrame* parent);
|
|
||||||
static void CreateScriptMetaTable();
|
|
||||||
static int32_t GetObjectType();
|
|
||||||
static void RegisterScriptMethods(lua_State* L);
|
|
||||||
|
|
||||||
// Member variables
|
|
||||||
// TODO
|
|
||||||
|
|
||||||
// Virtual member functions
|
|
||||||
virtual int32_t GetScriptMetaTable();
|
|
||||||
|
|
||||||
// Member functions
|
|
||||||
CGMinimapFrame(CSimpleFrame* parent);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -1,85 +0,0 @@
|
|||||||
#include "ui/game/CGMinimapFrameScript.hpp"
|
|
||||||
#include "ui/FrameScript.hpp"
|
|
||||||
#include "util/Unimplemented.hpp"
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
int32_t CGMinimapFrame_SetMaskTexture(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGMinimapFrame_SetIconTexture(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGMinimapFrame_SetBlipTexture(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGMinimapFrame_SetClassBlipTexture(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGMinimapFrame_SetPOIArrowTexture(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGMinimapFrame_SetStaticPOIArrowTexture(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGMinimapFrame_SetCorpsePOIArrowTexture(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGMinimapFrame_SetPlayerTexture(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGMinimapFrame_SetPlayerTextureHeight(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGMinimapFrame_SetPlayerTextureWidth(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGMinimapFrame_GetZoomLevels(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGMinimapFrame_GetZoom(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGMinimapFrame_SetZoom(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGMinimapFrame_PingLocation(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGMinimapFrame_GetPingPosition(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
FrameScript_Method CGMinimapFrameMethods[] = {
|
|
||||||
{ "SetMaskTexture", &CGMinimapFrame_SetMaskTexture },
|
|
||||||
{ "SetIconTexture", &CGMinimapFrame_SetIconTexture },
|
|
||||||
{ "SetBlipTexture", &CGMinimapFrame_SetBlipTexture },
|
|
||||||
{ "SetClassBlipTexture", &CGMinimapFrame_SetClassBlipTexture },
|
|
||||||
{ "SetPOIArrowTexture", &CGMinimapFrame_SetPOIArrowTexture },
|
|
||||||
{ "SetStaticPOIArrowTexture", &CGMinimapFrame_SetStaticPOIArrowTexture },
|
|
||||||
{ "SetCorpsePOIArrowTexture", &CGMinimapFrame_SetCorpsePOIArrowTexture },
|
|
||||||
{ "SetPlayerTexture", &CGMinimapFrame_SetPlayerTexture },
|
|
||||||
{ "SetPlayerTextureHeight", &CGMinimapFrame_SetPlayerTextureHeight },
|
|
||||||
{ "SetPlayerTextureWidth", &CGMinimapFrame_SetPlayerTextureWidth },
|
|
||||||
{ "GetZoomLevels", &CGMinimapFrame_GetZoomLevels },
|
|
||||||
{ "GetZoom", &CGMinimapFrame_GetZoom },
|
|
||||||
{ "SetZoom", &CGMinimapFrame_SetZoom },
|
|
||||||
{ "PingLocation", &CGMinimapFrame_PingLocation },
|
|
||||||
{ "GetPingPosition", &CGMinimapFrame_GetPingPosition },
|
|
||||||
};
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
#ifndef UI_GAME_C_G_MINIMAP_FRAME_SCRIPT_HPP
|
|
||||||
#define UI_GAME_C_G_MINIMAP_FRAME_SCRIPT_HPP
|
|
||||||
|
|
||||||
#include "ui/Types.hpp"
|
|
||||||
|
|
||||||
#define NUM_CG_MINIMAP_FRAME_SCRIPT_METHODS 15
|
|
||||||
|
|
||||||
extern FrameScript_Method CGMinimapFrameMethods[NUM_CG_MINIMAP_FRAME_SCRIPT_METHODS];
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -1,38 +0,0 @@
|
|||||||
#include "ui/game/CGQuestPOIFrame.hpp"
|
|
||||||
#include "ui/game/CGQuestPOIFrameScript.hpp"
|
|
||||||
|
|
||||||
int32_t CGQuestPOIFrame::s_metatable;
|
|
||||||
int32_t CGQuestPOIFrame::s_objectType;
|
|
||||||
|
|
||||||
CSimpleFrame* CGQuestPOIFrame::Create(CSimpleFrame* parent) {
|
|
||||||
// TODO use CDataAllocator
|
|
||||||
|
|
||||||
return STORM_NEW(CGQuestPOIFrame)(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGQuestPOIFrame::CreateScriptMetaTable() {
|
|
||||||
auto L = FrameScript_GetContext();
|
|
||||||
CGQuestPOIFrame::s_metatable = FrameScript_Object::CreateScriptMetaTable(L, &CGQuestPOIFrame::RegisterScriptMethods);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGQuestPOIFrame::GetObjectType() {
|
|
||||||
if (!CGQuestPOIFrame::s_objectType) {
|
|
||||||
CGQuestPOIFrame::s_objectType = ++FrameScript_Object::s_objectTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CGQuestPOIFrame::s_objectType;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGQuestPOIFrame::RegisterScriptMethods(lua_State* L) {
|
|
||||||
CSimpleFrame::RegisterScriptMethods(L);
|
|
||||||
FrameScript_Object::FillScriptMethodTable(L, CGQuestPOIFrameMethods, NUM_CG_QUEST_POI_FRAME_SCRIPT_METHODS);
|
|
||||||
}
|
|
||||||
|
|
||||||
CGQuestPOIFrame::CGQuestPOIFrame(CSimpleFrame* parent) : CSimpleFrame(parent) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGQuestPOIFrame::GetScriptMetaTable() {
|
|
||||||
return CGQuestPOIFrame::s_metatable;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
#ifndef UI_GAME_C_G_QUEST_POI_FRAME_HPP
|
|
||||||
#define UI_GAME_C_G_QUEST_POI_FRAME_HPP
|
|
||||||
|
|
||||||
#include "ui/simple/CSimpleFrame.hpp"
|
|
||||||
|
|
||||||
class CGQuestPOIFrame : public CSimpleFrame {
|
|
||||||
public:
|
|
||||||
// Static variables
|
|
||||||
static int32_t s_metatable;
|
|
||||||
static int32_t s_objectType;
|
|
||||||
|
|
||||||
// Static functions
|
|
||||||
static CSimpleFrame* Create(CSimpleFrame* parent);
|
|
||||||
static void CreateScriptMetaTable();
|
|
||||||
static int32_t GetObjectType();
|
|
||||||
static void RegisterScriptMethods(lua_State* L);
|
|
||||||
|
|
||||||
// Member variables
|
|
||||||
// TODO
|
|
||||||
|
|
||||||
// Virtual member functions
|
|
||||||
virtual int32_t GetScriptMetaTable();
|
|
||||||
|
|
||||||
// Member functions
|
|
||||||
CGQuestPOIFrame(CSimpleFrame* parent);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -1,80 +0,0 @@
|
|||||||
#include "ui/game/CGQuestPOIFrameScript.hpp"
|
|
||||||
#include "ui/FrameScript.hpp"
|
|
||||||
#include "util/Unimplemented.hpp"
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
int32_t CGQuestPOIFrame_SetFillTexture(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGQuestPOIFrame_SetFillAlpha(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGQuestPOIFrame_SetBorderTexture(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGQuestPOIFrame_SetBorderAlpha(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGQuestPOIFrame_SetBorderScalar(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGQuestPOIFrame_DrawQuestBlob(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGQuestPOIFrame_EnableSmoothing(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGQuestPOIFrame_EnableMerging(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGQuestPOIFrame_SetMergeThreshold(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGQuestPOIFrame_SetNumSplinePoints(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGQuestPOIFrame_UpdateQuestPOI(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGQuestPOIFrame_UpdateMouseOverTooltip(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGQuestPOIFrame_GetTooltipIndex(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGQuestPOIFrame_GetNumTooltips(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
FrameScript_Method CGQuestPOIFrameMethods[] = {
|
|
||||||
{ "SetFillTexture", &CGQuestPOIFrame_SetFillTexture },
|
|
||||||
{ "SetFillAlpha", &CGQuestPOIFrame_SetFillAlpha },
|
|
||||||
{ "SetBorderTexture", &CGQuestPOIFrame_SetBorderTexture },
|
|
||||||
{ "SetBorderAlpha", &CGQuestPOIFrame_SetBorderAlpha },
|
|
||||||
{ "SetBorderScalar", &CGQuestPOIFrame_SetBorderScalar },
|
|
||||||
{ "DrawQuestBlob", &CGQuestPOIFrame_DrawQuestBlob },
|
|
||||||
{ "EnableSmoothing", &CGQuestPOIFrame_EnableSmoothing },
|
|
||||||
{ "EnableMerging", &CGQuestPOIFrame_EnableMerging },
|
|
||||||
{ "SetMergeThreshold", &CGQuestPOIFrame_SetMergeThreshold },
|
|
||||||
{ "SetNumSplinePoints", &CGQuestPOIFrame_SetNumSplinePoints },
|
|
||||||
{ "UpdateQuestPOI", &CGQuestPOIFrame_UpdateQuestPOI },
|
|
||||||
{ "UpdateMouseOverTooltip", &CGQuestPOIFrame_UpdateMouseOverTooltip },
|
|
||||||
{ "GetTooltipIndex", &CGQuestPOIFrame_GetTooltipIndex },
|
|
||||||
{ "GetNumTooltips", &CGQuestPOIFrame_GetNumTooltips },
|
|
||||||
};
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
#ifndef UI_GAME_C_G_QUEST_POI_FRAME_SCRIPT_HPP
|
|
||||||
#define UI_GAME_C_G_QUEST_POI_FRAME_SCRIPT_HPP
|
|
||||||
|
|
||||||
#include "ui/Types.hpp"
|
|
||||||
|
|
||||||
#define NUM_CG_QUEST_POI_FRAME_SCRIPT_METHODS 14
|
|
||||||
|
|
||||||
extern FrameScript_Method CGQuestPOIFrameMethods[NUM_CG_QUEST_POI_FRAME_SCRIPT_METHODS];
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -1,37 +0,0 @@
|
|||||||
#include "ui/game/CGTabardModelFrame.hpp"
|
|
||||||
#include "ui/game/CGTabardModelFrameScript.hpp"
|
|
||||||
|
|
||||||
int32_t CGTabardModelFrame::s_metatable;
|
|
||||||
int32_t CGTabardModelFrame::s_objectType;
|
|
||||||
|
|
||||||
CSimpleFrame* CGTabardModelFrame::Create(CSimpleFrame* parent) {
|
|
||||||
// TODO use CDataAllocator
|
|
||||||
|
|
||||||
return STORM_NEW(CGTabardModelFrame)(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGTabardModelFrame::CreateScriptMetaTable() {
|
|
||||||
auto L = FrameScript_GetContext();
|
|
||||||
CGTabardModelFrame::s_metatable = FrameScript_Object::CreateScriptMetaTable(L, &CGTabardModelFrame::RegisterScriptMethods);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGTabardModelFrame::GetObjectType() {
|
|
||||||
if (!CGTabardModelFrame::s_objectType) {
|
|
||||||
CGTabardModelFrame::s_objectType = ++FrameScript_Object::s_objectTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CGTabardModelFrame::s_objectType;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGTabardModelFrame::RegisterScriptMethods(lua_State* L) {
|
|
||||||
CGCharacterModelBase::RegisterScriptMethods(L);
|
|
||||||
FrameScript_Object::FillScriptMethodTable(L, CGTabardModelFrameMethods, NUM_CG_TABARD_MODEL_FRAME_SCRIPT_METHODS);
|
|
||||||
}
|
|
||||||
|
|
||||||
CGTabardModelFrame::CGTabardModelFrame(CSimpleFrame* parent) : CGCharacterModelBase(parent) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGTabardModelFrame::GetScriptMetaTable() {
|
|
||||||
return CGTabardModelFrame::s_metatable;
|
|
||||||
}
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
#ifndef UI_GAME_C_G_TABARD_MODEL_FRAME_HPP
|
|
||||||
#define UI_GAME_C_G_TABARD_MODEL_FRAME_HPP
|
|
||||||
|
|
||||||
#include "ui/game/CGCharacterModelBase.hpp"
|
|
||||||
|
|
||||||
class CGTabardModelFrame : public CGCharacterModelBase {
|
|
||||||
public:
|
|
||||||
// Static variables
|
|
||||||
static int32_t s_metatable;
|
|
||||||
static int32_t s_objectType;
|
|
||||||
|
|
||||||
// Static functions
|
|
||||||
static CSimpleFrame* Create(CSimpleFrame* parent);
|
|
||||||
static void CreateScriptMetaTable();
|
|
||||||
static int32_t GetObjectType();
|
|
||||||
static void RegisterScriptMethods(lua_State* L);
|
|
||||||
|
|
||||||
// Member variables
|
|
||||||
// TODO
|
|
||||||
|
|
||||||
// Virtual member functions
|
|
||||||
virtual int32_t GetScriptMetaTable();
|
|
||||||
|
|
||||||
// Member functions
|
|
||||||
CGTabardModelFrame(CSimpleFrame* parent);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -1,60 +0,0 @@
|
|||||||
#include "ui/game/CGTabardModelFrameScript.hpp"
|
|
||||||
#include "ui/FrameScript.hpp"
|
|
||||||
#include "util/Unimplemented.hpp"
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
int32_t CGTabardModelFrame_InitializeTabardColors(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGTabardModelFrame_Save(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGTabardModelFrame_CycleVariation(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGTabardModelFrame_GetUpperBackgroundFileName(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGTabardModelFrame_GetLowerBackgroundFileName(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGTabardModelFrame_GetUpperEmblemFileName(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGTabardModelFrame_GetLowerEmblemFileName(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGTabardModelFrame_GetUpperEmblemTexture(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGTabardModelFrame_GetLowerEmblemTexture(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CGTabardModelFrame_CanSaveTabardNow(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
FrameScript_Method CGTabardModelFrameMethods[] = {
|
|
||||||
{ "InitializeTabardColors", &CGTabardModelFrame_InitializeTabardColors },
|
|
||||||
{ "Save", &CGTabardModelFrame_Save },
|
|
||||||
{ "CycleVariation", &CGTabardModelFrame_CycleVariation },
|
|
||||||
{ "GetUpperBackgroundFileName", &CGTabardModelFrame_GetUpperBackgroundFileName },
|
|
||||||
{ "GetLowerBackgroundFileName", &CGTabardModelFrame_GetLowerBackgroundFileName },
|
|
||||||
{ "GetUpperEmblemFileName", &CGTabardModelFrame_GetUpperEmblemFileName },
|
|
||||||
{ "GetLowerEmblemFileName", &CGTabardModelFrame_GetLowerEmblemFileName },
|
|
||||||
{ "GetUpperEmblemTexture", &CGTabardModelFrame_GetUpperEmblemTexture },
|
|
||||||
{ "GetLowerEmblemTexture", &CGTabardModelFrame_GetLowerEmblemTexture },
|
|
||||||
{ "CanSaveTabardNow", &CGTabardModelFrame_CanSaveTabardNow },
|
|
||||||
};
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
#ifndef UI_GAME_C_G_TABARD_MODEL_FRAME_SCRIPT_HPP
|
|
||||||
#define UI_GAME_C_G_TABARD_MODEL_FRAME_SCRIPT_HPP
|
|
||||||
|
|
||||||
#include "ui/Types.hpp"
|
|
||||||
|
|
||||||
#define NUM_CG_TABARD_MODEL_FRAME_SCRIPT_METHODS 10
|
|
||||||
|
|
||||||
extern FrameScript_Method CGTabardModelFrameMethods[NUM_CG_TABARD_MODEL_FRAME_SCRIPT_METHODS];
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -2,8 +2,6 @@
|
|||||||
#include "ui/FrameScript.hpp"
|
#include "ui/FrameScript.hpp"
|
||||||
#include "util/Unimplemented.hpp"
|
#include "util/Unimplemented.hpp"
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
int32_t Script_GetGMTicket(lua_State* L) {
|
int32_t Script_GetGMTicket(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
WHOA_UNIMPLEMENTED(0);
|
||||||
}
|
}
|
||||||
@ -64,8 +62,6 @@ int32_t Script_RegisterStaticConstants(lua_State* L) {
|
|||||||
WHOA_UNIMPLEMENTED(0);
|
WHOA_UNIMPLEMENTED(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static FrameScript_Method s_ScriptFunctions[] = {
|
static FrameScript_Method s_ScriptFunctions[] = {
|
||||||
{ "GetGMTicket", &Script_GetGMTicket },
|
{ "GetGMTicket", &Script_GetGMTicket },
|
||||||
{ "NewGMTicket", &Script_NewGMTicket },
|
{ "NewGMTicket", &Script_NewGMTicket },
|
||||||
|
|||||||
@ -8,7 +8,6 @@
|
|||||||
#include "util/Unimplemented.hpp"
|
#include "util/Unimplemented.hpp"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
int32_t Script_FrameXML_Debug(lua_State* L) {
|
int32_t Script_FrameXML_Debug(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
WHOA_UNIMPLEMENTED(0);
|
||||||
}
|
}
|
||||||
@ -134,21 +133,7 @@ int32_t Script_SetCVar(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_GetCVar(lua_State* L) {
|
int32_t Script_GetCVar(lua_State* L) {
|
||||||
if (!lua_isstring(L, 1)) {
|
WHOA_UNIMPLEMENTED(0);
|
||||||
luaL_error(L, "Usage: GetCVar(\"cvar\")");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto varName = lua_tostring(L, 1);
|
|
||||||
auto var = CVar::LookupRegistered(varName);
|
|
||||||
|
|
||||||
if (var && !(var->m_flags & 0x40)) {
|
|
||||||
lua_pushstring(L, var->GetString());
|
|
||||||
} else {
|
|
||||||
lua_pushnil(L);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_GetCVarBool(lua_State* L) {
|
int32_t Script_GetCVarBool(lua_State* L) {
|
||||||
|
|||||||
@ -3,8 +3,6 @@
|
|||||||
#include "ui/ScriptFunctionsSystem.hpp"
|
#include "ui/ScriptFunctionsSystem.hpp"
|
||||||
#include "util/Unimplemented.hpp"
|
#include "util/Unimplemented.hpp"
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
int32_t Script_UnitExists(lua_State* L) {
|
int32_t Script_UnitExists(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
WHOA_UNIMPLEMENTED(0);
|
||||||
}
|
}
|
||||||
@ -681,8 +679,6 @@ int32_t Script_FillLocalizedClassList(lua_State* L) {
|
|||||||
WHOA_UNIMPLEMENTED(0);
|
WHOA_UNIMPLEMENTED(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static FrameScript_Method s_UnitFunctions[] = {
|
static FrameScript_Method s_UnitFunctions[] = {
|
||||||
{ "UnitExists", &Script_UnitExists },
|
{ "UnitExists", &Script_UnitExists },
|
||||||
{ "UnitIsVisible", &Script_UnitIsVisible },
|
{ "UnitIsVisible", &Script_UnitIsVisible },
|
||||||
|
|||||||
@ -1,31 +0,0 @@
|
|||||||
#include "ui/simple/CSimpleStatusBar.hpp"
|
|
||||||
#include "ui/simple/CSimpleStatusBarScript.hpp"
|
|
||||||
|
|
||||||
int32_t CSimpleStatusBar::s_metatable;
|
|
||||||
int32_t CSimpleStatusBar::s_objectType;
|
|
||||||
|
|
||||||
void CSimpleStatusBar::CreateScriptMetaTable() {
|
|
||||||
auto L = FrameScript_GetContext();
|
|
||||||
CSimpleStatusBar::s_metatable = FrameScript_Object::CreateScriptMetaTable(L, &CSimpleStatusBar::RegisterScriptMethods);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CSimpleStatusBar::GetObjectType() {
|
|
||||||
if (!CSimpleStatusBar::s_objectType) {
|
|
||||||
CSimpleStatusBar::s_objectType = ++FrameScript_Object::s_objectTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CSimpleStatusBar::s_objectType;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSimpleStatusBar::RegisterScriptMethods(lua_State* L) {
|
|
||||||
CSimpleFrame::RegisterScriptMethods(L);
|
|
||||||
FrameScript_Object::FillScriptMethodTable(L, SimpleStatusBarMethods, NUM_SIMPLE_STATUS_BAR_SCRIPT_METHODS);
|
|
||||||
}
|
|
||||||
|
|
||||||
CSimpleStatusBar::CSimpleStatusBar(CSimpleFrame* parent) : CSimpleFrame(parent) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CSimpleStatusBar::GetScriptMetaTable() {
|
|
||||||
return CSimpleStatusBar::s_metatable;
|
|
||||||
}
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
#ifndef UI_SIMPLE_C_SIMPLE_STATUS_BAR_HPP
|
|
||||||
#define UI_SIMPLE_C_SIMPLE_STATUS_BAR_HPP
|
|
||||||
|
|
||||||
#include "ui/simple/CSimpleFrame.hpp"
|
|
||||||
|
|
||||||
class CSimpleStatusBar : public CSimpleFrame {
|
|
||||||
public:
|
|
||||||
// Static variables
|
|
||||||
static int32_t s_metatable;
|
|
||||||
static int32_t s_objectType;
|
|
||||||
|
|
||||||
// Static functions
|
|
||||||
static void CreateScriptMetaTable();
|
|
||||||
static int32_t GetObjectType();
|
|
||||||
static void RegisterScriptMethods(lua_State* L);
|
|
||||||
|
|
||||||
// Member variables
|
|
||||||
// TODO
|
|
||||||
|
|
||||||
// Virtual member functions
|
|
||||||
virtual int32_t GetScriptMetaTable();
|
|
||||||
|
|
||||||
// Member functions
|
|
||||||
CSimpleStatusBar(CSimpleFrame* parent);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -1,70 +0,0 @@
|
|||||||
#include "ui/simple/CSimpleStatusBarScript.hpp"
|
|
||||||
#include "ui/FrameScript.hpp"
|
|
||||||
#include "util/Unimplemented.hpp"
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
int32_t CSimpleStatusBar_GetOrientation(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CSimpleStatusBar_SetOrientation(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CSimpleStatusBar_GetMinMaxValues(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CSimpleStatusBar_SetMinMaxValues(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CSimpleStatusBar_GetValue(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CSimpleStatusBar_SetValue(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CSimpleStatusBar_GetStatusBarTexture(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CSimpleStatusBar_SetStatusBarTexture(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CSimpleStatusBar_GetStatusBarColor(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CSimpleStatusBar_SetStatusBarColor(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CSimpleStatusBar_GetRotatesTexture(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CSimpleStatusBar_SetRotatesTexture(lua_State* L) {
|
|
||||||
WHOA_UNIMPLEMENTED(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
FrameScript_Method SimpleStatusBarMethods[] = {
|
|
||||||
{ "GetOrientation", &CSimpleStatusBar_GetOrientation },
|
|
||||||
{ "SetOrientation", &CSimpleStatusBar_SetOrientation },
|
|
||||||
{ "GetMinMaxValues", &CSimpleStatusBar_GetMinMaxValues },
|
|
||||||
{ "SetMinMaxValues", &CSimpleStatusBar_SetMinMaxValues },
|
|
||||||
{ "GetValue", &CSimpleStatusBar_GetValue },
|
|
||||||
{ "SetValue", &CSimpleStatusBar_SetValue },
|
|
||||||
{ "GetStatusBarTexture", &CSimpleStatusBar_GetStatusBarTexture },
|
|
||||||
{ "SetStatusBarTexture", &CSimpleStatusBar_SetStatusBarTexture },
|
|
||||||
{ "GetStatusBarColor", &CSimpleStatusBar_GetStatusBarColor },
|
|
||||||
{ "SetStatusBarColor", &CSimpleStatusBar_SetStatusBarColor },
|
|
||||||
{ "GetRotatesTexture", &CSimpleStatusBar_GetRotatesTexture },
|
|
||||||
{ "SetRotatesTexture", &CSimpleStatusBar_SetRotatesTexture },
|
|
||||||
};
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
#ifndef UI_SIMPLE_C_SIMPLE_STATUS_BAR_SCRIPT_HPP
|
|
||||||
#define UI_SIMPLE_C_SIMPLE_STATUS_BAR_SCRIPT_HPP
|
|
||||||
|
|
||||||
#include "ui/Types.hpp"
|
|
||||||
|
|
||||||
#define NUM_SIMPLE_STATUS_BAR_SCRIPT_METHODS 12
|
|
||||||
|
|
||||||
extern FrameScript_Method SimpleStatusBarMethods[NUM_SIMPLE_STATUS_BAR_SCRIPT_METHODS];
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -12,7 +12,6 @@
|
|||||||
#include "ui/simple/CSimpleModelFFX.hpp"
|
#include "ui/simple/CSimpleModelFFX.hpp"
|
||||||
#include "ui/simple/CSimpleScrollFrame.hpp"
|
#include "ui/simple/CSimpleScrollFrame.hpp"
|
||||||
#include "ui/simple/CSimpleSlider.hpp"
|
#include "ui/simple/CSimpleSlider.hpp"
|
||||||
#include "ui/simple/CSimpleStatusBar.hpp"
|
|
||||||
#include "ui/simple/CSimpleTexture.hpp"
|
#include "ui/simple/CSimpleTexture.hpp"
|
||||||
#include "util/CStatus.hpp"
|
#include "util/CStatus.hpp"
|
||||||
#include "util/Lua.hpp"
|
#include "util/Lua.hpp"
|
||||||
@ -191,9 +190,9 @@ void RegisterSimpleFrameScriptMethods() {
|
|||||||
CSimpleModelFFX::CreateScriptMetaTable();
|
CSimpleModelFFX::CreateScriptMetaTable();
|
||||||
CSimpleScrollFrame::CreateScriptMetaTable();
|
CSimpleScrollFrame::CreateScriptMetaTable();
|
||||||
CSimpleSlider::CreateScriptMetaTable();
|
CSimpleSlider::CreateScriptMetaTable();
|
||||||
CSimpleStatusBar::CreateScriptMetaTable();
|
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
// CSimpleStatusBar::CreateScriptMetaTable();
|
||||||
// CSimpleColorSelect::CreateScriptMetaTable();
|
// CSimpleColorSelect::CreateScriptMetaTable();
|
||||||
// CSimpleMovieFrame::CreateScriptMetaTable();
|
// CSimpleMovieFrame::CreateScriptMetaTable();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
file(GLOB PRIVATE_SOURCES
|
file(GLOB PRIVATE_SOURCES
|
||||||
"*.cpp"
|
"*.cpp"
|
||||||
"guid/*.cpp"
|
"guid/*.cpp"
|
||||||
"time/*.cpp"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if(WHOA_SYSTEM_MAC)
|
if(WHOA_SYSTEM_MAC)
|
||||||
|
|||||||
@ -1,7 +0,0 @@
|
|||||||
#ifndef UTIL_TIME_HPP
|
|
||||||
#define UTIL_TIME_HPP
|
|
||||||
|
|
||||||
#include "util/time/CGameTime.hpp"
|
|
||||||
#include "util/time/WowTime.hpp"
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -1,106 +0,0 @@
|
|||||||
#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;
|
|
||||||
|
|
||||||
if (this->m_timeBias) {
|
|
||||||
auto minutes = biasTime.GetHourAndMinutes() + this->m_timeBias;
|
|
||||||
|
|
||||||
if (minutes < 0) {
|
|
||||||
minutes += 1440;
|
|
||||||
} else {
|
|
||||||
minutes %= 1440;
|
|
||||||
}
|
|
||||||
|
|
||||||
biasTime.SetHourAndMinutes(minutes);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->m_dateBias) {
|
|
||||||
biasTime.AddDays(this->m_dateBias, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
static_cast<WowTime&>(*this) = biasTime;
|
|
||||||
|
|
||||||
if (shouldTick) {
|
|
||||||
// Rewind time by exactly one minute
|
|
||||||
if (this->m_minute != 0) {
|
|
||||||
this->m_minute--;
|
|
||||||
} else {
|
|
||||||
this->m_minute = 59;
|
|
||||||
|
|
||||||
if (this->m_hour != 0) {
|
|
||||||
this->m_hour--;
|
|
||||||
} else {
|
|
||||||
this->m_hour = 23;
|
|
||||||
this->AddDays(-1, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tick ahead exactly one minute (ensures callbacks fire and various counters update)
|
|
||||||
this->TickMinute();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGameTime::GameTimeUpdate(float elapsedSec) {
|
|
||||||
this->m_gameMinutesThisTick += this->m_gameMinutesPerRealSecond * elapsedSec;
|
|
||||||
|
|
||||||
// Skip minute ticks for time differential
|
|
||||||
if (this->m_timeDifferential != 0 && this->m_gameMinutesThisTick >= 1.0f) {
|
|
||||||
auto minutesToConsume = static_cast<uint32_t>(this->m_gameMinutesThisTick);
|
|
||||||
|
|
||||||
// Clamp to differential
|
|
||||||
if (this->m_timeDifferential < minutesToConsume) {
|
|
||||||
minutesToConsume = this->m_timeDifferential;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->m_timeDifferential -= minutesToConsume;
|
|
||||||
this->m_gameMinutesThisTick -= static_cast<float>(minutesToConsume);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (this->m_gameMinutesThisTick >= 1.0f) {
|
|
||||||
this->m_gameMinutesThisTick -= 1.0f;
|
|
||||||
this->TickMinute();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGameTime::PerformCallbacks(int32_t minutes) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGameTime::TickMinute() {
|
|
||||||
// Increment minute
|
|
||||||
int32_t minutes = (this->GetHourAndMinutes() + 1) % 1440;
|
|
||||||
|
|
||||||
// Update hours and minutes
|
|
||||||
this->SetHourAndMinutes(minutes);
|
|
||||||
|
|
||||||
// Increment day if minute crossed day boundary
|
|
||||||
if (minutes == 0) {
|
|
||||||
this->AddDays(1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
this->m_gameMinutesElapsed++;
|
|
||||||
|
|
||||||
this->PerformCallbacks(minutes);
|
|
||||||
|
|
||||||
this->m_lastTickMinute = OsGetAsyncTimeMsPrecise();
|
|
||||||
|
|
||||||
this->uint40 = 1;
|
|
||||||
|
|
||||||
this->m_dayProgression = this->m_gameMinutesThisTick + static_cast<float>(minutes);
|
|
||||||
}
|
|
||||||
@ -1,38 +0,0 @@
|
|||||||
#ifndef UTIL_TIME_C_GAME_TIME_HPP
|
|
||||||
#define UTIL_TIME_C_GAME_TIME_HPP
|
|
||||||
|
|
||||||
#include "util/time/WowTime.hpp"
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
private:
|
|
||||||
// Private member variables
|
|
||||||
uint32_t m_lastTick = 0;
|
|
||||||
int32_t m_timeBias = 0;
|
|
||||||
int32_t m_dateBias = 0;
|
|
||||||
uint32_t m_gameMinutesElapsed = 0;
|
|
||||||
float m_gameMinutesPerRealSecond = MIN_SPEED;
|
|
||||||
float m_gameMinutesThisTick = 0.0f;
|
|
||||||
uint32_t m_timeDifferential = 0;
|
|
||||||
uint32_t m_lastTickMinute = 0;
|
|
||||||
uint8_t uint40 = 0;
|
|
||||||
float m_dayProgression = 0.0f;
|
|
||||||
float float48 = 0.0f;
|
|
||||||
float float4C = 0.0f;
|
|
||||||
// TODO m_callbackLists
|
|
||||||
|
|
||||||
// Private member functions
|
|
||||||
void PerformCallbacks(int32_t minutes);
|
|
||||||
void TickMinute();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -1,236 +0,0 @@
|
|||||||
#include "util/time/WowTime.hpp"
|
|
||||||
#include <storm/Error.hpp>
|
|
||||||
#include <storm/String.hpp>
|
|
||||||
#include <ctime>
|
|
||||||
|
|
||||||
static const char* s_weekdays[] = {
|
|
||||||
"Sun",
|
|
||||||
"Mon",
|
|
||||||
"Tue",
|
|
||||||
"Wed",
|
|
||||||
"Thu",
|
|
||||||
"Fri",
|
|
||||||
"Sat",
|
|
||||||
};
|
|
||||||
|
|
||||||
void WowTime::WowDecodeTime(uint32_t value, int32_t* minute, int32_t* hour, int32_t* weekday, int32_t* monthday, int32_t* month, int32_t* year, int32_t* flags) {
|
|
||||||
// Minute: bits 0-5 (6 bits, max 63)
|
|
||||||
if (minute) {
|
|
||||||
auto m = static_cast<int32_t>(value & 63);
|
|
||||||
*minute = (m == 63) ? -1 : m;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hour: bits 6-10 (5 bits, max 31)
|
|
||||||
if (hour) {
|
|
||||||
auto h = static_cast<int32_t>((value >> 6) & 31);
|
|
||||||
*hour = (h == 31) ? -1 : h;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Weekday: bits 11-13 (3 bits, max 7)
|
|
||||||
if (weekday) {
|
|
||||||
auto wd = static_cast<int32_t>((value >> 11) & 7);
|
|
||||||
*weekday = (wd == 7) ? -1 : wd;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Month day: bits 14-19 (6 bits, max 63)
|
|
||||||
if (monthday) {
|
|
||||||
auto md = static_cast<int32_t>((value >> 14) & 63);
|
|
||||||
*monthday = (md == 63) ? -1 : md;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Month: bits 20-23 (4 bits, max 15)
|
|
||||||
if (month) {
|
|
||||||
auto mo = static_cast<int32_t>((value >> 20) & 15);
|
|
||||||
*month = (mo == 15) ? -1 : mo;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Year: bits 24-28 (5 bits, max 31)
|
|
||||||
if (year) {
|
|
||||||
auto y = static_cast<int32_t>((value >> 24) & 31);
|
|
||||||
*year = (y == 31) ? -1 : y;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Flags: bits 29-30 (2 bits, max 3)
|
|
||||||
if (flags) {
|
|
||||||
auto f = static_cast<int32_t>((value >> 29) & 3);
|
|
||||||
*flags = (f == 3) ? -1 : f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void WowTime::WowDecodeTime(uint32_t value, WowTime* time) {
|
|
||||||
WowTime::WowDecodeTime(
|
|
||||||
value,
|
|
||||||
&time->m_minute,
|
|
||||||
&time->m_hour,
|
|
||||||
&time->m_weekday,
|
|
||||||
&time->m_monthday,
|
|
||||||
&time->m_month,
|
|
||||||
&time->m_year,
|
|
||||||
&time->m_flags
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WowTime::WowEncodeTime(uint32_t& value, int32_t minute, int32_t hour, int32_t weekday, int32_t monthday, int32_t month, int32_t year, int32_t flags) {
|
|
||||||
STORM_ASSERT(minute == -1 || (minute >= 0 && minute < 60));
|
|
||||||
STORM_ASSERT(hour == -1 || (hour >= 0 && hour < 24));
|
|
||||||
STORM_ASSERT(weekday == -1 || (weekday >= 0 && weekday < 7));
|
|
||||||
STORM_ASSERT(monthday == -1 || (monthday >= 0 && monthday < 32));
|
|
||||||
STORM_ASSERT(month == -1 || (month >= 0 && month < 12));
|
|
||||||
STORM_ASSERT(year == -1 || year >= 0 && year <= ((1 << 5) - 1));
|
|
||||||
STORM_ASSERT(flags >= 0 && flags <= ((1 << 2) - 1));
|
|
||||||
|
|
||||||
value = ((flags & 3) << 29) // Flags: bits 29-30 (2 bits, max 3)
|
|
||||||
| ((year & 31) << 24) // Year: bits 24-28 (5 bits, max 31)
|
|
||||||
| ((month & 15) << 20) // Month: bits 20-23 (4 bits, max 15)
|
|
||||||
| ((monthday & 63) << 14) // Month day: bits 14-19 (6 bits, max 63)
|
|
||||||
| ((weekday & 7) << 11) // Weekday: bits 11-13 (3 bits, max 7)
|
|
||||||
| ((hour & 31) << 6) // Hour: bits 6-10 (5 bits, max 31)
|
|
||||||
| (minute & 63); // Minute: bits 0-5 (6 bits, max 63)
|
|
||||||
}
|
|
||||||
|
|
||||||
void WowTime::WowEncodeTime(uint32_t& value, const WowTime* time) {
|
|
||||||
WowTime::WowEncodeTime(
|
|
||||||
value,
|
|
||||||
time->m_minute,
|
|
||||||
time->m_hour,
|
|
||||||
time->m_weekday,
|
|
||||||
time->m_monthday,
|
|
||||||
time->m_month,
|
|
||||||
time->m_year,
|
|
||||||
time->m_flags
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
char* WowTime::WowGetTimeString(WowTime* time, char* str, int32_t len) {
|
|
||||||
uint32_t encoded;
|
|
||||||
WowTime::WowEncodeTime(encoded, time);
|
|
||||||
|
|
||||||
if (encoded == 0) {
|
|
||||||
SStrPrintf(str, len, "Not Set");
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
char yearStr[8];
|
|
||||||
char monthStr[8];
|
|
||||||
char monthdayStr[8];
|
|
||||||
char weekdayStr[8];
|
|
||||||
char hourStr[8];
|
|
||||||
char minuteStr[8];
|
|
||||||
|
|
||||||
if (time->m_year >= 0) {
|
|
||||||
SStrPrintf(yearStr, sizeof(yearStr), "%i", time->m_year + 2000);
|
|
||||||
} else {
|
|
||||||
SStrPrintf(yearStr, sizeof(yearStr), "A");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time->m_month >= 0) {
|
|
||||||
SStrPrintf(monthStr, sizeof(monthStr), "%i", time->m_month + 1);
|
|
||||||
} else {
|
|
||||||
SStrPrintf(monthStr, sizeof(monthStr), "A");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time->m_monthday >= 0) {
|
|
||||||
SStrPrintf(monthdayStr, sizeof(monthdayStr), "%i", time->m_monthday + 1);
|
|
||||||
} else {
|
|
||||||
SStrPrintf(monthdayStr, sizeof(monthdayStr), "A");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time->m_weekday >= 0) {
|
|
||||||
SStrPrintf(weekdayStr, sizeof(weekdayStr), s_weekdays[time->m_weekday]);
|
|
||||||
} else {
|
|
||||||
SStrPrintf(weekdayStr, sizeof(weekdayStr), "Any");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time->m_hour >= 0) {
|
|
||||||
SStrPrintf(hourStr, sizeof(hourStr), "%i", time->m_hour);
|
|
||||||
} else {
|
|
||||||
SStrPrintf(hourStr, sizeof(hourStr), "A");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time->m_minute >= 0) {
|
|
||||||
SStrPrintf(minuteStr, sizeof(minuteStr), "%2.2i", time->m_minute);
|
|
||||||
} else {
|
|
||||||
SStrPrintf(minuteStr, sizeof(minuteStr), "A");
|
|
||||||
}
|
|
||||||
|
|
||||||
SStrPrintf(str, len, "%s/%s/%s (%s) %s:%s", monthStr, monthdayStr, yearStr, weekdayStr, hourStr, minuteStr);
|
|
||||||
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
void WowTime::AddDays(int32_t days, bool includeTime) {
|
|
||||||
// Validate date
|
|
||||||
|
|
||||||
if (this->m_year < 0 || this->m_month < 0 || this->m_monthday < 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert WowTime to tm
|
|
||||||
|
|
||||||
tm t = {};
|
|
||||||
|
|
||||||
t.tm_year = this->m_year + 100; // WowTime year is years since 2000; tm_year is years since 1900
|
|
||||||
t.tm_mon = this->m_month; // WowTime month and tm_mon are both 0-based
|
|
||||||
t.tm_mday = this->m_monthday + 1; // WowTime monthday is 0-based; tm_mday is 1-based
|
|
||||||
t.tm_isdst = -1; // Let mktime determine DST
|
|
||||||
|
|
||||||
if (includeTime) {
|
|
||||||
t.tm_hour = this->m_hour;
|
|
||||||
t.tm_min = this->m_minute;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert tm to time_t and add the specified days
|
|
||||||
|
|
||||||
auto time = mktime(&t);
|
|
||||||
time += days * 86400;
|
|
||||||
|
|
||||||
|
|
||||||
if (!includeTime) {
|
|
||||||
time += 3600; // Tack on hour to ensure DST boundaries don't muck with days added
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert adjusted time back to tm
|
|
||||||
|
|
||||||
auto t_ = localtime(&time);
|
|
||||||
if (t_) {
|
|
||||||
t = *t_;
|
|
||||||
} else {
|
|
||||||
t = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert adjusted tm back to WowTime
|
|
||||||
|
|
||||||
this->m_year = t.tm_year - 100;
|
|
||||||
this->m_month = t.tm_mon;
|
|
||||||
this->m_monthday = t.tm_mday - 1;
|
|
||||||
this->m_weekday = t.tm_wday;
|
|
||||||
|
|
||||||
if (includeTime) {
|
|
||||||
this->m_hour = t.tm_hour;
|
|
||||||
this->m_minute = t.tm_min;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t WowTime::GetHourAndMinutes() {
|
|
||||||
if (this->m_hour < 0 || this->m_minute < 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this->m_hour * 60 + this->m_minute;
|
|
||||||
}
|
|
||||||
|
|
||||||
void WowTime::SetHourAndMinutes(int32_t minutes) {
|
|
||||||
this->m_hour = minutes / 60;
|
|
||||||
this->m_minute = minutes % 60;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t WowTime::SetHourAndMinutes(uint32_t hour, uint32_t minutes) {
|
|
||||||
if (hour >= 24 || minutes >= 60) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->m_hour = hour;
|
|
||||||
this->m_minute = minutes;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
@ -1,32 +0,0 @@
|
|||||||
#ifndef UTIL_TIME_WOW_TIME_HPP
|
|
||||||
#define UTIL_TIME_WOW_TIME_HPP
|
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
class WowTime {
|
|
||||||
public:
|
|
||||||
// Static functions
|
|
||||||
static void WowDecodeTime(uint32_t value, int32_t* minute, int32_t* hour, int32_t* weekday, int32_t* monthday, int32_t* month, int32_t* year, int32_t* flags);
|
|
||||||
static void WowDecodeTime(uint32_t value, WowTime* time);
|
|
||||||
static void WowEncodeTime(uint32_t& value, int32_t minute, int32_t hour, int32_t weekday, int32_t monthday, int32_t month, int32_t year, int32_t flags);
|
|
||||||
static void WowEncodeTime(uint32_t& value, const WowTime* time);
|
|
||||||
static char* WowGetTimeString(WowTime* time, char* str, int32_t len);
|
|
||||||
|
|
||||||
// Member variables
|
|
||||||
int32_t m_minute = -1;
|
|
||||||
int32_t m_hour = -1;
|
|
||||||
int32_t m_weekday = -1;
|
|
||||||
int32_t m_monthday = -1;
|
|
||||||
int32_t m_month = -1;
|
|
||||||
int32_t m_year = -1;
|
|
||||||
int32_t m_flags = 0x0;
|
|
||||||
int32_t m_holidayOffset = 0;
|
|
||||||
|
|
||||||
// Member functions
|
|
||||||
void AddDays(int32_t days, bool includeTime);
|
|
||||||
int32_t GetHourAndMinutes();
|
|
||||||
void SetHourAndMinutes(int32_t minutes);
|
|
||||||
int32_t SetHourAndMinutes(uint32_t hour, uint32_t minutes);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -5,7 +5,6 @@ if(WHOA_SYSTEM_MAC)
|
|||||||
"gx/*.cpp"
|
"gx/*.cpp"
|
||||||
"gx/font/*.cpp"
|
"gx/font/*.cpp"
|
||||||
"util/*.cpp"
|
"util/*.cpp"
|
||||||
"util/time/*.cpp"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set_source_files_properties(${PRIVATE_SOURCES}
|
set_source_files_properties(${PRIVATE_SOURCES}
|
||||||
|
|||||||
@ -1,59 +0,0 @@
|
|||||||
#include "util/time/CGameTime.hpp"
|
|
||||||
#include "catch.hpp"
|
|
||||||
|
|
||||||
TEST_CASE("CGameTime::CGameTime", "[util]") {
|
|
||||||
SECTION("constructs correctly") {
|
|
||||||
CGameTime time;
|
|
||||||
|
|
||||||
CHECK(time.m_minute == -1);
|
|
||||||
CHECK(time.m_hour == -1);
|
|
||||||
CHECK(time.m_weekday == -1);
|
|
||||||
CHECK(time.m_monthday == -1);
|
|
||||||
CHECK(time.m_month == -1);
|
|
||||||
CHECK(time.m_year == -1);
|
|
||||||
CHECK(time.m_flags == 0x0);
|
|
||||||
CHECK(time.m_holidayOffset == 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("CGameTime::GameTimeSetTime", "[util]") {
|
|
||||||
SECTION("sets game time correctly") {
|
|
||||||
WowTime time;
|
|
||||||
time.m_minute = 18;
|
|
||||||
time.m_hour = 11;
|
|
||||||
time.m_weekday = 3;
|
|
||||||
time.m_monthday = 27;
|
|
||||||
time.m_month = 0;
|
|
||||||
time.m_year = 26;
|
|
||||||
|
|
||||||
CGameTime gameTime;
|
|
||||||
gameTime.GameTimeSetTime(time, true);
|
|
||||||
|
|
||||||
CHECK(gameTime.m_minute == 18);
|
|
||||||
CHECK(gameTime.m_hour == 11);
|
|
||||||
CHECK(gameTime.m_weekday == 3);
|
|
||||||
CHECK(gameTime.m_monthday == 27);
|
|
||||||
CHECK(gameTime.m_month == 0);
|
|
||||||
CHECK(gameTime.m_year == 26);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("CGameTime::GameTimeUpdate", "[util]") {
|
|
||||||
SECTION("updates game time correctly") {
|
|
||||||
WowTime time;
|
|
||||||
time.m_minute = 18;
|
|
||||||
time.m_hour = 11;
|
|
||||||
time.m_weekday = 3;
|
|
||||||
time.m_monthday = 27;
|
|
||||||
time.m_month = 0;
|
|
||||||
time.m_year = 26;
|
|
||||||
|
|
||||||
CGameTime gameTime;
|
|
||||||
gameTime.GameTimeSetTime(time, true);
|
|
||||||
|
|
||||||
gameTime.GameTimeUpdate(60.0f);
|
|
||||||
|
|
||||||
CHECK(gameTime.m_hour == 11);
|
|
||||||
CHECK(gameTime.m_minute == 19);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,190 +0,0 @@
|
|||||||
#include "util/time/WowTime.hpp"
|
|
||||||
#include "catch.hpp"
|
|
||||||
#include "storm/String.hpp"
|
|
||||||
|
|
||||||
TEST_CASE("WowTime::WowTime", "[util]") {
|
|
||||||
SECTION("constructs correctly") {
|
|
||||||
WowTime time;
|
|
||||||
|
|
||||||
CHECK(time.m_minute == -1);
|
|
||||||
CHECK(time.m_hour == -1);
|
|
||||||
CHECK(time.m_weekday == -1);
|
|
||||||
CHECK(time.m_monthday == -1);
|
|
||||||
CHECK(time.m_month == -1);
|
|
||||||
CHECK(time.m_year == -1);
|
|
||||||
CHECK(time.m_flags == 0x0);
|
|
||||||
CHECK(time.m_holidayOffset == 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("WowTime::WowDecodeTime", "[util]") {
|
|
||||||
SECTION("decodes 1234567890 as expected") {
|
|
||||||
uint32_t value = 1234567890;
|
|
||||||
WowTime time;
|
|
||||||
|
|
||||||
WowTime::WowDecodeTime(value, &time.m_minute, &time.m_hour, &time.m_weekday, &time.m_monthday, &time.m_month, &time.m_year, &time.m_flags);
|
|
||||||
|
|
||||||
CHECK(time.m_minute == 18);
|
|
||||||
CHECK(time.m_hour == 11);
|
|
||||||
CHECK(time.m_weekday == 0);
|
|
||||||
CHECK(time.m_monthday == 24);
|
|
||||||
CHECK(time.m_month == 9);
|
|
||||||
CHECK(time.m_year == 9);
|
|
||||||
CHECK(time.m_flags == 0x2);
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTION("decodes 0xFFFFFFFF as expected") {
|
|
||||||
uint32_t value = 0xFFFFFFFF;
|
|
||||||
WowTime time;
|
|
||||||
|
|
||||||
WowTime::WowDecodeTime(value, &time.m_minute, &time.m_hour, &time.m_weekday, &time.m_monthday, &time.m_month, &time.m_year, &time.m_flags);
|
|
||||||
|
|
||||||
CHECK(time.m_minute == -1);
|
|
||||||
CHECK(time.m_hour == -1);
|
|
||||||
CHECK(time.m_weekday == -1);
|
|
||||||
CHECK(time.m_monthday == -1);
|
|
||||||
CHECK(time.m_month == -1);
|
|
||||||
CHECK(time.m_year == -1);
|
|
||||||
CHECK(time.m_flags == -1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("WowTime::WowEncodeTime", "[util]") {
|
|
||||||
SECTION("encodes 10/25/2009 (Sun) 11:18 with flag 0x2 set as expected") {
|
|
||||||
uint32_t value = 0;
|
|
||||||
|
|
||||||
WowTime time;
|
|
||||||
time.m_minute = 18;
|
|
||||||
time.m_hour = 11;
|
|
||||||
time.m_weekday = 0;
|
|
||||||
time.m_monthday = 24;
|
|
||||||
time.m_month = 9;
|
|
||||||
time.m_year = 9;
|
|
||||||
time.m_flags = 0x2;
|
|
||||||
|
|
||||||
WowTime::WowEncodeTime(value, &time);
|
|
||||||
|
|
||||||
REQUIRE(value == 1234567890);
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTION("encodes empty time as expected") {
|
|
||||||
uint32_t value = 0;
|
|
||||||
WowTime time;
|
|
||||||
|
|
||||||
WowTime::WowEncodeTime(value, &time);
|
|
||||||
|
|
||||||
REQUIRE(value == 0x1FFFFFFF);
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTION("encodes, decodes, and reencodes as expected") {
|
|
||||||
uint32_t value = 0;
|
|
||||||
|
|
||||||
WowTime time1;
|
|
||||||
time1.m_minute = 18;
|
|
||||||
time1.m_hour = 11;
|
|
||||||
time1.m_weekday = 0;
|
|
||||||
time1.m_monthday = 24;
|
|
||||||
time1.m_month = 9;
|
|
||||||
time1.m_year = 9;
|
|
||||||
time1.m_flags = 0x2;
|
|
||||||
|
|
||||||
WowTime time2;
|
|
||||||
|
|
||||||
CHECK(time2.m_minute != time1.m_minute);
|
|
||||||
CHECK(time2.m_hour != time1.m_hour);
|
|
||||||
CHECK(time2.m_weekday != time1.m_weekday);
|
|
||||||
CHECK(time2.m_monthday != time1.m_monthday);
|
|
||||||
CHECK(time2.m_month != time1.m_month);
|
|
||||||
CHECK(time2.m_year != time1.m_year);
|
|
||||||
CHECK(time2.m_flags != time1.m_flags);
|
|
||||||
|
|
||||||
WowTime::WowEncodeTime(value, &time1);
|
|
||||||
WowTime::WowDecodeTime(value, &time2);
|
|
||||||
|
|
||||||
CHECK(time2.m_minute == time1.m_minute);
|
|
||||||
CHECK(time2.m_hour == time1.m_hour);
|
|
||||||
CHECK(time2.m_weekday == time1.m_weekday);
|
|
||||||
CHECK(time2.m_monthday == time1.m_monthday);
|
|
||||||
CHECK(time2.m_month == time1.m_month);
|
|
||||||
CHECK(time2.m_year == time1.m_year);
|
|
||||||
CHECK(time2.m_flags == time1.m_flags);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("WowTime::WowGetTimeString", "[util]") {
|
|
||||||
SECTION("gets expected string") {
|
|
||||||
WowTime time;
|
|
||||||
time.m_minute = 18;
|
|
||||||
time.m_hour = 11;
|
|
||||||
time.m_weekday = 0;
|
|
||||||
time.m_monthday = 24;
|
|
||||||
time.m_month = 9;
|
|
||||||
time.m_year = 9;
|
|
||||||
time.m_flags = 0x2;
|
|
||||||
|
|
||||||
char buf[128];
|
|
||||||
auto timeStr = WowTime::WowGetTimeString(&time, buf, sizeof(buf));
|
|
||||||
|
|
||||||
REQUIRE(!SStrCmp(timeStr, "10/25/2009 (Sun) 11:18"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("WowTime::AddDays", "[util]") {
|
|
||||||
SECTION("adds 1 day to 1/28/2026") {
|
|
||||||
WowTime time;
|
|
||||||
time.m_minute = 18;
|
|
||||||
time.m_hour = 11;
|
|
||||||
time.m_weekday = 3;
|
|
||||||
time.m_monthday = 27;
|
|
||||||
time.m_month = 0;
|
|
||||||
time.m_year = 26;
|
|
||||||
|
|
||||||
time.AddDays(1, false);
|
|
||||||
|
|
||||||
CHECK(time.m_minute == 18);
|
|
||||||
CHECK(time.m_hour == 11);
|
|
||||||
CHECK(time.m_weekday == 4);
|
|
||||||
CHECK(time.m_monthday == 28);
|
|
||||||
CHECK(time.m_month == 0);
|
|
||||||
CHECK(time.m_year == 26);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("WowTime::GetHourAndMinutes", "[util]") {
|
|
||||||
SECTION("gets expected hour and minutes for default constructed time") {
|
|
||||||
WowTime time;
|
|
||||||
|
|
||||||
REQUIRE(time.GetHourAndMinutes() == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTION("gets expected hour and minutes for 11:18") {
|
|
||||||
WowTime time;
|
|
||||||
time.m_minute = 18;
|
|
||||||
time.m_hour = 11;
|
|
||||||
|
|
||||||
REQUIRE(time.GetHourAndMinutes() == 11 * 60 + 18);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("WowTime::SetHourAndMinutes", "[util]") {
|
|
||||||
SECTION("sets expected hour and minutes for 11:18") {
|
|
||||||
WowTime time;
|
|
||||||
time.SetHourAndMinutes(11 * 60 + 18);
|
|
||||||
|
|
||||||
CHECK(time.m_hour == 11);
|
|
||||||
CHECK(time.m_minute == 18);
|
|
||||||
|
|
||||||
time.SetHourAndMinutes(11, 18);
|
|
||||||
|
|
||||||
CHECK(time.m_hour == 11);
|
|
||||||
CHECK(time.m_minute == 18);
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTION("does not set invalid hour and minutes") {
|
|
||||||
WowTime time;
|
|
||||||
|
|
||||||
CHECK(time.SetHourAndMinutes(25, 61) == 0);
|
|
||||||
CHECK(time.m_hour == -1);
|
|
||||||
CHECK(time.m_minute == -1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user