mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-19 06:01:07 +03:00
Compare commits
26 Commits
3c3e38b4ac
...
2685f75d30
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2685f75d30 | ||
|
|
91a4afd976 | ||
|
|
1cddac296c | ||
|
|
df177a40b0 | ||
|
|
f19894ef12 | ||
|
|
26522016e0 | ||
|
|
0bb3ac157f | ||
|
|
53b26169f3 | ||
|
|
6e7c267d3e | ||
|
|
50a24e8564 | ||
|
|
efd3f8e8f4 | ||
|
|
721ee527eb | ||
|
|
886ababae9 | ||
|
|
1d91a49462 | ||
|
|
aed2aebb66 | ||
|
|
661b77091f | ||
|
|
335bd21a26 | ||
|
|
bfcceed8fd | ||
|
|
8935c520c0 | ||
|
|
7cf7127810 | ||
|
|
8fb51991e0 | ||
|
|
7fdd22545f | ||
|
|
15eafe92d7 | ||
|
|
1ad3679f90 | ||
|
|
81970958a8 | ||
|
|
a9cad5238d |
@ -32,6 +32,8 @@ if(WHOA_SYSTEM_MAC)
|
|||||||
"-framework AppKit"
|
"-framework AppKit"
|
||||||
"-framework Carbon"
|
"-framework Carbon"
|
||||||
"-framework IOKit"
|
"-framework IOKit"
|
||||||
|
"-framework Metal"
|
||||||
|
"-framework QuartzCore"
|
||||||
)
|
)
|
||||||
|
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/mac/MainMenu.nib DESTINATION "bin")
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/mac/MainMenu.nib DESTINATION "bin")
|
||||||
|
|||||||
9
src/app/mac/EngineMTLLayerView.h
Normal file
9
src/app/mac/EngineMTLLayerView.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#ifndef APP_MAC_ENGINE_MTL_LAYER_VIEW_H
|
||||||
|
#define APP_MAC_ENGINE_MTL_LAYER_VIEW_H
|
||||||
|
|
||||||
|
#include "app/mac/EngineGLLayerView.h"
|
||||||
|
|
||||||
|
@interface EngineMTLLayerView : EngineGLLayerView
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif
|
||||||
36
src/app/mac/EngineMTLLayerView.mm
Normal file
36
src/app/mac/EngineMTLLayerView.mm
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#include "app/mac/EngineMTLLayerView.h"
|
||||||
|
#import <QuartzCore/CAMetalLayer.h>
|
||||||
|
|
||||||
|
@implementation EngineMTLLayerView
|
||||||
|
|
||||||
|
- (CALayer*)makeBackingLayer {
|
||||||
|
return [CAMetalLayer layer];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id)initWithFrame:(NSRect)frame glWindow:(GLWindow*)window {
|
||||||
|
self = [super initWithFrame:frame glWindow:window];
|
||||||
|
|
||||||
|
if (self) {
|
||||||
|
[self setWantsLayer:YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)drawRect:(NSRect)dirtyRect {
|
||||||
|
// Rendering is driven by CGxDeviceMTL.
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)update {
|
||||||
|
[super update];
|
||||||
|
|
||||||
|
if (![self.layer isKindOfClass:[CAMetalLayer class]]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CAMetalLayer* layer = (CAMetalLayer*)self.layer;
|
||||||
|
CGSize size = [self convertSizeToBacking:self.bounds.size];
|
||||||
|
layer.drawableSize = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@ -1,7 +1,9 @@
|
|||||||
#include "app/mac/View.h"
|
#include "app/mac/View.h"
|
||||||
#include "app/mac/EngineGLLayerView.h"
|
#include "app/mac/EngineGLLayerView.h"
|
||||||
|
#include "app/mac/EngineMTLLayerView.h"
|
||||||
#include "app/mac/WindowCallbacks.h"
|
#include "app/mac/WindowCallbacks.h"
|
||||||
#include "gx/gll/GLWindow.h"
|
#include "gx/gll/GLWindow.h"
|
||||||
|
#include "gx/Device.hpp"
|
||||||
|
|
||||||
GLWindowCallbacks EngineViewCallbacks = {
|
GLWindowCallbacks EngineViewCallbacks = {
|
||||||
&MacOnResized,
|
&MacOnResized,
|
||||||
@ -23,5 +25,9 @@ void AssignEngineViewCallbacks(GLWindowCallbacks* callbacks) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Class GetEngineViewClass() {
|
Class GetEngineViewClass() {
|
||||||
|
if (GxDevApi() == GxApi_Metal) {
|
||||||
|
return [EngineMTLLayerView class];
|
||||||
|
}
|
||||||
|
|
||||||
return [EngineGLLayerView class];
|
return [EngineGLLayerView class];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
#include "app/mac/MacClient.h"
|
#include "app/mac/MacClient.h"
|
||||||
#include "event/Input.hpp"
|
#include "event/Input.hpp"
|
||||||
#include "gx/gll/CGxDeviceGLL.hpp"
|
#include "gx/gll/CGxDeviceGLL.hpp"
|
||||||
|
#include "gx/mtl/CGxDeviceMTL.hpp"
|
||||||
#include "gx/Device.hpp"
|
#include "gx/Device.hpp"
|
||||||
#include "gx/Window.hpp"
|
#include "gx/Window.hpp"
|
||||||
#include <bc/Debug.hpp>
|
#include <bc/Debug.hpp>
|
||||||
@ -171,7 +172,11 @@ void MacOnResized(int32_t width, int32_t height, bool a3) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GxDevApi() == GxApi_GLL) {
|
||||||
static_cast<CGxDeviceGLL*>(g_theGxDevicePtr)->Resize(width, height);
|
static_cast<CGxDeviceGLL*>(g_theGxDevicePtr)->Resize(width, height);
|
||||||
|
} else if (GxDevApi() == GxApi_Metal) {
|
||||||
|
static_cast<CGxDeviceMTL*>(g_theGxDevicePtr)->Resize(width, height);
|
||||||
|
}
|
||||||
|
|
||||||
OsQueuePut(OS_INPUT_SIZE, width, height, 0, 0);
|
OsQueuePut(OS_INPUT_SIZE, width, height, 0, 0);
|
||||||
|
|
||||||
|
|||||||
@ -30,6 +30,8 @@ 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;
|
||||||
@ -70,10 +72,28 @@ 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) {
|
||||||
// TODO
|
ClientGameTimeTickHandler(data, nullptr);
|
||||||
// ClientGameTimeTickHandler(data, param);
|
|
||||||
// Player_C_ZoneUpdateHandler(data, param);
|
// TODO Player_C_ZoneUpdateHandler(data, nullptr);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -91,6 +111,7 @@ void ClientInitializeGame(uint32_t mapId, C3Vector position) {
|
|||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
EventRegister(EVENT_ID_IDLE, ClientIdle);
|
EventRegister(EVENT_ID_IDLE, ClientIdle);
|
||||||
|
ClientInitializeGameTime();
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
#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;
|
||||||
@ -12,6 +13,8 @@ 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,11 +1,14 @@
|
|||||||
#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 <tempest/Vector.hpp>
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <tempest/Vector.hpp>
|
||||||
|
|
||||||
static float s_newFacing;
|
static float s_newFacing;
|
||||||
static C3Vector s_newPosition;
|
static C3Vector s_newPosition;
|
||||||
@ -77,6 +80,56 @@ 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,6 +14,16 @@ 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);
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
#include "gx/Adapter.hpp"
|
#include "gx/Adapter.hpp"
|
||||||
#include "gx/Device.hpp"
|
#include "gx/Device.hpp"
|
||||||
#include <storm/Array.hpp>
|
#include <storm/Array.hpp>
|
||||||
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
static CGxDevice* s_device;
|
static CGxDevice* s_device;
|
||||||
@ -417,6 +418,13 @@ void ConsoleDeviceInitialize(const char* title) {
|
|||||||
api = GxApi_GLL;
|
api = GxApi_GLL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(WHOA_SYSTEM_MAC)
|
||||||
|
const char* apiOverride = getenv("WHOA_GX_API");
|
||||||
|
if (apiOverride && !strcmp(apiOverride, "metal")) {
|
||||||
|
api = GxApi_Metal;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
s_device = GxDevCreate(api, OsWindowProc, format);
|
s_device = GxDevCreate(api, OsWindowProc, format);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#if defined(WHOA_SYSTEM_MAC)
|
#if defined(WHOA_SYSTEM_MAC)
|
||||||
#include "gx/gll/CGxDeviceGLL.hpp"
|
#include "gx/gll/CGxDeviceGLL.hpp"
|
||||||
|
#include "gx/mtl/CGxDeviceMTL.hpp"
|
||||||
#include "gx/mac/Display.hpp"
|
#include "gx/mac/Display.hpp"
|
||||||
#include <ApplicationServices/ApplicationServices.h>
|
#include <ApplicationServices/ApplicationServices.h>
|
||||||
#include <OpenGL/OpenGL.h>
|
#include <OpenGL/OpenGL.h>
|
||||||
@ -117,6 +118,8 @@ int32_t CGxDevice::AdapterFormats(EGxApi api, TSGrowableArray<CGxFormat>& adapte
|
|||||||
CGxDevice::OpenGlAdapterFormats(adapterFormats);
|
CGxDevice::OpenGlAdapterFormats(adapterFormats);
|
||||||
} else if (api == GxApi_GLL) {
|
} else if (api == GxApi_GLL) {
|
||||||
CGxDevice::GLLAdapterFormats(adapterFormats);
|
CGxDevice::GLLAdapterFormats(adapterFormats);
|
||||||
|
} else if (api == GxApi_Metal) {
|
||||||
|
CGxDevice::OpenGlAdapterFormats(adapterFormats);
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(WHOA_SYSTEM_LINUX)
|
#elif defined(WHOA_SYSTEM_LINUX)
|
||||||
@ -228,6 +231,11 @@ CGxDevice* CGxDevice::NewGLL() {
|
|||||||
auto m = SMemAlloc(sizeof(CGxDeviceGLL), __FILE__, __LINE__, 0x0);
|
auto m = SMemAlloc(sizeof(CGxDeviceGLL), __FILE__, __LINE__, 0x0);
|
||||||
return new (m) CGxDeviceGLL();
|
return new (m) CGxDeviceGLL();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CGxDevice* CGxDevice::NewMTL() {
|
||||||
|
auto m = SMemAlloc(sizeof(CGxDeviceMTL), __FILE__, __LINE__, 0x0);
|
||||||
|
return new (m) CGxDeviceMTL();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CGxDevice* CGxDevice::NewOpenGl() {
|
CGxDevice* CGxDevice::NewOpenGl() {
|
||||||
|
|||||||
@ -70,6 +70,7 @@ class CGxDevice {
|
|||||||
#endif
|
#endif
|
||||||
#if defined(WHOA_SYSTEM_MAC)
|
#if defined(WHOA_SYSTEM_MAC)
|
||||||
static CGxDevice* NewGLL();
|
static CGxDevice* NewGLL();
|
||||||
|
static CGxDevice* NewMTL();
|
||||||
#endif
|
#endif
|
||||||
static CGxDevice* NewOpenGl();
|
static CGxDevice* NewOpenGl();
|
||||||
static void OpenGlAdapterFormats(TSGrowableArray<CGxFormat>& adapterFormats);
|
static void OpenGlAdapterFormats(TSGrowableArray<CGxFormat>& adapterFormats);
|
||||||
|
|||||||
@ -20,6 +20,7 @@ if(WHOA_SYSTEM_MAC)
|
|||||||
file(GLOB MAC_SOURCES
|
file(GLOB MAC_SOURCES
|
||||||
"gll/*.cpp"
|
"gll/*.cpp"
|
||||||
"gll/*.mm"
|
"gll/*.mm"
|
||||||
|
"mtl/*.mm"
|
||||||
"mac/*.cpp"
|
"mac/*.cpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -24,6 +24,8 @@ CGxDevice* GxDevCreate(EGxApi api, int32_t (*windowProc)(void* window, uint32_t
|
|||||||
device = CGxDevice::NewOpenGl();
|
device = CGxDevice::NewOpenGl();
|
||||||
} else if (api == GxApi_GLL) {
|
} else if (api == GxApi_GLL) {
|
||||||
device = CGxDevice::NewGLL();
|
device = CGxDevice::NewGLL();
|
||||||
|
} else if (api == GxApi_Metal) {
|
||||||
|
device = CGxDevice::NewMTL();
|
||||||
} else {
|
} else {
|
||||||
// Error
|
// Error
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,7 +35,8 @@ enum EGxApi {
|
|||||||
GxApi_D3d10 = 3,
|
GxApi_D3d10 = 3,
|
||||||
GxApi_D3d11 = 4,
|
GxApi_D3d11 = 4,
|
||||||
GxApi_GLL = 5,
|
GxApi_GLL = 5,
|
||||||
GxApis_Last = 6
|
GxApi_Metal = 6,
|
||||||
|
GxApis_Last = 7
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EGxBlend {
|
enum EGxBlend {
|
||||||
|
|||||||
81
src/gx/mtl/CGxDeviceMTL.hpp
Normal file
81
src/gx/mtl/CGxDeviceMTL.hpp
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
#ifndef GX_MTL_C_GX_DEVICE_MTL_HPP
|
||||||
|
#define GX_MTL_C_GX_DEVICE_MTL_HPP
|
||||||
|
|
||||||
|
#include "gx/CGxDevice.hpp"
|
||||||
|
#include "gx/gll/GLWindow.h"
|
||||||
|
|
||||||
|
class CGxBatch;
|
||||||
|
class CGxShader;
|
||||||
|
|
||||||
|
class CGxDeviceMTL : public CGxDevice {
|
||||||
|
public:
|
||||||
|
// Member variables
|
||||||
|
GLWindow m_window;
|
||||||
|
|
||||||
|
// Virtual member functions
|
||||||
|
void ITexMarkAsUpdated(CGxTex*) override;
|
||||||
|
void IRsSendToHw(EGxRenderState) override;
|
||||||
|
int32_t DeviceCreate(int32_t (*windowProc)(void* window, uint32_t message, uintptr_t wparam, intptr_t lparam), const CGxFormat&) override;
|
||||||
|
int32_t DeviceSetFormat(const CGxFormat&) override;
|
||||||
|
void* DeviceWindow() override;
|
||||||
|
void DeviceWM(EGxWM wm, uintptr_t param1, uintptr_t param2) override {};
|
||||||
|
void CapsWindowSize(CRect&) override;
|
||||||
|
void CapsWindowSizeInScreenCoords(CRect& dst) override;
|
||||||
|
void ScenePresent() override;
|
||||||
|
void SceneClear(uint32_t, CImVector) override;
|
||||||
|
void Draw(CGxBatch* batch, int32_t indexed) override;
|
||||||
|
void PoolSizeSet(CGxPool*, uint32_t) override;
|
||||||
|
char* BufLock(CGxBuf*) override;
|
||||||
|
int32_t BufUnlock(CGxBuf*, uint32_t) override;
|
||||||
|
void BufData(CGxBuf* buf, const void* data, size_t size, uintptr_t offset) override;
|
||||||
|
void TexDestroy(CGxTex* texId) override;
|
||||||
|
void IShaderCreate(CGxShader*) override;
|
||||||
|
void ShaderCreate(CGxShader*[], EGxShTarget, const char*, const char*, int32_t) override;
|
||||||
|
int32_t StereoEnabled(void) override;
|
||||||
|
void XformSetProjection(const C44Matrix& matrix) override;
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
CGxDeviceMTL();
|
||||||
|
void Resize(uint32_t width, uint32_t height);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void ISetCaps(const CGxFormat& format);
|
||||||
|
void EnsureLibrary();
|
||||||
|
void BeginFrame();
|
||||||
|
void* GetPipeline(EGxVertexBufferFormat format, bool useColor, bool useSkin, bool useTex, int32_t blendMode);
|
||||||
|
void* GetPoolBuffer(CGxPool* pool);
|
||||||
|
void ITexCreate(CGxTex* texId);
|
||||||
|
void ITexUpload(CGxTex* texId);
|
||||||
|
void* GetTexture(CGxTex* texId);
|
||||||
|
void* GetSampler(CGxTex* texId);
|
||||||
|
void EnsureFallbackTexture();
|
||||||
|
void EnsureDepthTexture(uint32_t width, uint32_t height);
|
||||||
|
void* GetDepthState(bool depthTest, bool depthWrite, uint32_t depthFunc);
|
||||||
|
void* m_device = nullptr;
|
||||||
|
void* m_commandQueue = nullptr;
|
||||||
|
void* m_layer = nullptr;
|
||||||
|
void* m_shaderLibrary = nullptr;
|
||||||
|
void* m_pipelineColor[GxVertexBufferFormats_Last][GxBlends_Last] = {};
|
||||||
|
void* m_pipelineSolid[GxVertexBufferFormats_Last][GxBlends_Last] = {};
|
||||||
|
void* m_pipelineSkin[GxVertexBufferFormats_Last][GxBlends_Last] = {};
|
||||||
|
void* m_pipelineColorTex[GxVertexBufferFormats_Last][GxBlends_Last] = {};
|
||||||
|
void* m_pipelineSolidTex[GxVertexBufferFormats_Last][GxBlends_Last] = {};
|
||||||
|
void* m_pipelineSkinTex[GxVertexBufferFormats_Last][GxBlends_Last] = {};
|
||||||
|
void* m_pipelineColorTex2[GxVertexBufferFormats_Last][GxBlends_Last] = {};
|
||||||
|
void* m_pipelineSolidTex2[GxVertexBufferFormats_Last][GxBlends_Last] = {};
|
||||||
|
void* m_pipelineSkinTex2[GxVertexBufferFormats_Last][GxBlends_Last] = {};
|
||||||
|
void* m_frameCommandBuffer = nullptr;
|
||||||
|
void* m_frameEncoder = nullptr;
|
||||||
|
void* m_frameDrawable = nullptr;
|
||||||
|
uint32_t m_frameHasDraw = 0;
|
||||||
|
uint32_t m_clearMask = 0;
|
||||||
|
uint32_t m_clearColor = 0;
|
||||||
|
void* m_fallbackTexture = nullptr;
|
||||||
|
void* m_fallbackSampler = nullptr;
|
||||||
|
void* m_depthTexture = nullptr;
|
||||||
|
uint32_t m_depthWidth = 0;
|
||||||
|
uint32_t m_depthHeight = 0;
|
||||||
|
void* m_depthStates[2][2][4] = {};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
1855
src/gx/mtl/CGxDeviceMTL.mm
Normal file
1855
src/gx/mtl/CGxDeviceMTL.mm
Normal file
File diff suppressed because it is too large
Load Diff
@ -8,6 +8,7 @@
|
|||||||
#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>
|
||||||
@ -96,9 +97,9 @@ CSimpleFrame* Create_SimpleHTML(CSimpleFrame* parent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CSimpleFrame* Create_SimpleStatusBar(CSimpleFrame* parent) {
|
CSimpleFrame* Create_SimpleStatusBar(CSimpleFrame* parent) {
|
||||||
// TODO
|
// TODO CDataAllocator
|
||||||
|
|
||||||
return nullptr;
|
return STORM_NEW(CSimpleStatusBar(parent));
|
||||||
}
|
}
|
||||||
|
|
||||||
CSimpleFrame* Create_SimpleColorSelect(CSimpleFrame* parent) {
|
CSimpleFrame* Create_SimpleColorSelect(CSimpleFrame* parent) {
|
||||||
@ -541,19 +542,19 @@ int32_t FrameXML_RegisterFactory(const char* type, CSimpleFrame* (*factory)(CSim
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FrameXML_RegisterDefault() {
|
void FrameXML_RegisterDefault() {
|
||||||
FrameXML_RegisterFactory("Button", &Create_SimpleButton, 0);
|
FrameXML_RegisterFactory("Button", &Create_SimpleButton, false);
|
||||||
FrameXML_RegisterFactory("CheckButton", &Create_SimpleCheckButton, 0);
|
FrameXML_RegisterFactory("CheckButton", &Create_SimpleCheckButton, false);
|
||||||
FrameXML_RegisterFactory("EditBox", &Create_SimpleEditBox, 0);
|
FrameXML_RegisterFactory("EditBox", &Create_SimpleEditBox, false);
|
||||||
FrameXML_RegisterFactory("Frame", &Create_SimpleFrame, 0);
|
FrameXML_RegisterFactory("Frame", &Create_SimpleFrame, false);
|
||||||
FrameXML_RegisterFactory("MessageFrame", &Create_SimpleMessageFrame, 0);
|
FrameXML_RegisterFactory("MessageFrame", &Create_SimpleMessageFrame, false);
|
||||||
FrameXML_RegisterFactory("Model", &Create_SimpleModel, 0);
|
FrameXML_RegisterFactory("Model", &Create_SimpleModel, false);
|
||||||
FrameXML_RegisterFactory("ScrollFrame", &Create_SimpleScrollFrame, 0);
|
FrameXML_RegisterFactory("ScrollFrame", &Create_SimpleScrollFrame, false);
|
||||||
FrameXML_RegisterFactory("ScrollingMessageFrame", &Create_SimpleScrollingMessageFrame, 0);
|
FrameXML_RegisterFactory("ScrollingMessageFrame", &Create_SimpleScrollingMessageFrame, false);
|
||||||
FrameXML_RegisterFactory("Slider", &Create_SimpleSlider, 0);
|
FrameXML_RegisterFactory("Slider", &Create_SimpleSlider, false);
|
||||||
FrameXML_RegisterFactory("SimpleHTML", &Create_SimpleHTML, 0);
|
FrameXML_RegisterFactory("SimpleHTML", &Create_SimpleHTML, false);
|
||||||
FrameXML_RegisterFactory("StatusBar", &Create_SimpleStatusBar, 0);
|
FrameXML_RegisterFactory("StatusBar", &Create_SimpleStatusBar, false);
|
||||||
FrameXML_RegisterFactory("ColorSelect", &Create_SimpleColorSelect, 0);
|
FrameXML_RegisterFactory("ColorSelect", &Create_SimpleColorSelect, false);
|
||||||
FrameXML_RegisterFactory("MovieFrame", &Create_SimpleMovieFrame, 0);
|
FrameXML_RegisterFactory("MovieFrame", &Create_SimpleMovieFrame, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameXML_ReleaseHashNode(const char* name) {
|
void FrameXML_ReleaseHashNode(const char* name) {
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
#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"
|
||||||
@ -14,10 +15,10 @@ int32_t Script_GetTime(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_GetGameTime(lua_State* L) {
|
int32_t Script_GetGameTime(lua_State* L) {
|
||||||
// TODO real implementation
|
lua_pushnumber(L, g_clientGameTime.m_hour);
|
||||||
lua_pushnumber(L, 1.0);
|
lua_pushnumber(L, g_clientGameTime.m_minute);
|
||||||
lua_pushnumber(L, 15.0);
|
|
||||||
WHOA_UNIMPLEMENTED(2);
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_ConsoleExec(lua_State* L) {
|
int32_t Script_ConsoleExec(lua_State* L) {
|
||||||
|
|||||||
37
src/ui/game/CGCharacterModelBase.cpp
Normal file
37
src/ui/game/CGCharacterModelBase.cpp
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#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;
|
||||||
|
}
|
||||||
28
src/ui/game/CGCharacterModelBase.hpp
Normal file
28
src/ui/game/CGCharacterModelBase.hpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#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
|
||||||
30
src/ui/game/CGCharacterModelBaseScript.cpp
Normal file
30
src/ui/game/CGCharacterModelBaseScript.cpp
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#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 },
|
||||||
|
};
|
||||||
10
src/ui/game/CGCharacterModelBaseScript.hpp
Normal file
10
src/ui/game/CGCharacterModelBaseScript.hpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#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
|
||||||
37
src/ui/game/CGCooldown.cpp
Normal file
37
src/ui/game/CGCooldown.cpp
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#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;
|
||||||
|
}
|
||||||
28
src/ui/game/CGCooldown.hpp
Normal file
28
src/ui/game/CGCooldown.hpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#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
|
||||||
35
src/ui/game/CGCooldownScript.cpp
Normal file
35
src/ui/game/CGCooldownScript.cpp
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#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 },
|
||||||
|
};
|
||||||
10
src/ui/game/CGCooldownScript.hpp
Normal file
10
src/ui/game/CGCooldownScript.hpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#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
|
||||||
37
src/ui/game/CGDressUpModelFrame.cpp
Normal file
37
src/ui/game/CGDressUpModelFrame.cpp
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#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;
|
||||||
|
}
|
||||||
28
src/ui/game/CGDressUpModelFrame.hpp
Normal file
28
src/ui/game/CGDressUpModelFrame.hpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#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
|
||||||
25
src/ui/game/CGDressUpModelFrameScript.cpp
Normal file
25
src/ui/game/CGDressUpModelFrameScript.cpp
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#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 },
|
||||||
|
};
|
||||||
10
src/ui/game/CGDressUpModelFrameScript.hpp
Normal file
10
src/ui/game/CGDressUpModelFrameScript.hpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#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,6 +4,12 @@
|
|||||||
#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"
|
||||||
@ -22,8 +28,12 @@ void LoadScriptFunctions() {
|
|||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
CGTooltip::CreateScriptMetaTable();
|
CGTooltip::CreateScriptMetaTable();
|
||||||
|
CGCooldown::CreateScriptMetaTable();
|
||||||
// TODO
|
CGMinimapFrame::CreateScriptMetaTable();
|
||||||
|
CGCharacterModelBase::CreateScriptMetaTable();
|
||||||
|
CGDressUpModelFrame::CreateScriptMetaTable();
|
||||||
|
CGTabardModelFrame::CreateScriptMetaTable();
|
||||||
|
CGQuestPOIFrame::CreateScriptMetaTable();
|
||||||
|
|
||||||
GameScriptRegisterFunctions();
|
GameScriptRegisterFunctions();
|
||||||
UIBindingsRegisterScriptFunctions();
|
UIBindingsRegisterScriptFunctions();
|
||||||
@ -137,6 +147,10 @@ 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);
|
||||||
// TODO register remaining factories
|
FrameXML_RegisterFactory("Minimap", &CGMinimapFrame::Create, false);
|
||||||
|
FrameXML_RegisterFactory("PlayerModel", &CGCharacterModelBase::Create, false);
|
||||||
|
FrameXML_RegisterFactory("DressUpModel", &CGDressUpModelFrame::Create, false);
|
||||||
|
FrameXML_RegisterFactory("TabardModel", &CGTabardModelFrame::Create, false);
|
||||||
|
FrameXML_RegisterFactory("QuestPOIFrame", &CGQuestPOIFrame::Create, false);
|
||||||
}
|
}
|
||||||
|
|||||||
37
src/ui/game/CGMinimapFrame.cpp
Normal file
37
src/ui/game/CGMinimapFrame.cpp
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#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;
|
||||||
|
}
|
||||||
28
src/ui/game/CGMinimapFrame.hpp
Normal file
28
src/ui/game/CGMinimapFrame.hpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#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
|
||||||
85
src/ui/game/CGMinimapFrameScript.cpp
Normal file
85
src/ui/game/CGMinimapFrameScript.cpp
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
#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 },
|
||||||
|
};
|
||||||
10
src/ui/game/CGMinimapFrameScript.hpp
Normal file
10
src/ui/game/CGMinimapFrameScript.hpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#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
|
||||||
38
src/ui/game/CGQuestPOIFrame.cpp
Normal file
38
src/ui/game/CGQuestPOIFrame.cpp
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#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;
|
||||||
|
}
|
||||||
|
|
||||||
28
src/ui/game/CGQuestPOIFrame.hpp
Normal file
28
src/ui/game/CGQuestPOIFrame.hpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#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
|
||||||
80
src/ui/game/CGQuestPOIFrameScript.cpp
Normal file
80
src/ui/game/CGQuestPOIFrameScript.cpp
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
#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 },
|
||||||
|
};
|
||||||
10
src/ui/game/CGQuestPOIFrameScript.hpp
Normal file
10
src/ui/game/CGQuestPOIFrameScript.hpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#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
|
||||||
37
src/ui/game/CGTabardModelFrame.cpp
Normal file
37
src/ui/game/CGTabardModelFrame.cpp
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#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;
|
||||||
|
}
|
||||||
28
src/ui/game/CGTabardModelFrame.hpp
Normal file
28
src/ui/game/CGTabardModelFrame.hpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#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
|
||||||
60
src/ui/game/CGTabardModelFrameScript.cpp
Normal file
60
src/ui/game/CGTabardModelFrameScript.cpp
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
#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 },
|
||||||
|
};
|
||||||
10
src/ui/game/CGTabardModelFrameScript.hpp
Normal file
10
src/ui/game/CGTabardModelFrameScript.hpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#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,6 +2,8 @@
|
|||||||
#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);
|
||||||
}
|
}
|
||||||
@ -62,6 +64,8 @@ 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,6 +8,7 @@
|
|||||||
#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);
|
||||||
}
|
}
|
||||||
@ -133,7 +134,21 @@ int32_t Script_SetCVar(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_GetCVar(lua_State* L) {
|
int32_t Script_GetCVar(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
if (!lua_isstring(L, 1)) {
|
||||||
|
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,6 +3,8 @@
|
|||||||
#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);
|
||||||
}
|
}
|
||||||
@ -679,6 +681,8 @@ 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 },
|
||||||
|
|||||||
31
src/ui/simple/CSimpleStatusBar.cpp
Normal file
31
src/ui/simple/CSimpleStatusBar.cpp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#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;
|
||||||
|
}
|
||||||
27
src/ui/simple/CSimpleStatusBar.hpp
Normal file
27
src/ui/simple/CSimpleStatusBar.hpp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#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
|
||||||
70
src/ui/simple/CSimpleStatusBarScript.cpp
Normal file
70
src/ui/simple/CSimpleStatusBarScript.cpp
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
#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 },
|
||||||
|
};
|
||||||
10
src/ui/simple/CSimpleStatusBarScript.hpp
Normal file
10
src/ui/simple/CSimpleStatusBarScript.hpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#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,6 +12,7 @@
|
|||||||
#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"
|
||||||
@ -190,9 +191,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,6 +1,7 @@
|
|||||||
file(GLOB PRIVATE_SOURCES
|
file(GLOB PRIVATE_SOURCES
|
||||||
"*.cpp"
|
"*.cpp"
|
||||||
"guid/*.cpp"
|
"guid/*.cpp"
|
||||||
|
"time/*.cpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
if(WHOA_SYSTEM_MAC)
|
if(WHOA_SYSTEM_MAC)
|
||||||
|
|||||||
7
src/util/Time.hpp
Normal file
7
src/util/Time.hpp
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#ifndef UTIL_TIME_HPP
|
||||||
|
#define UTIL_TIME_HPP
|
||||||
|
|
||||||
|
#include "util/time/CGameTime.hpp"
|
||||||
|
#include "util/time/WowTime.hpp"
|
||||||
|
|
||||||
|
#endif
|
||||||
106
src/util/time/CGameTime.cpp
Normal file
106
src/util/time/CGameTime.cpp
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
#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);
|
||||||
|
}
|
||||||
38
src/util/time/CGameTime.hpp
Normal file
38
src/util/time/CGameTime.hpp
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#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
|
||||||
236
src/util/time/WowTime.cpp
Normal file
236
src/util/time/WowTime.cpp
Normal file
@ -0,0 +1,236 @@
|
|||||||
|
#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;
|
||||||
|
}
|
||||||
32
src/util/time/WowTime.hpp
Normal file
32
src/util/time/WowTime.hpp
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#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,6 +5,7 @@ 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}
|
||||||
@ -22,6 +23,8 @@ if(WHOA_SYSTEM_MAC)
|
|||||||
"-framework AppKit"
|
"-framework AppKit"
|
||||||
"-framework Carbon"
|
"-framework Carbon"
|
||||||
"-framework IOKit"
|
"-framework IOKit"
|
||||||
|
"-framework Metal"
|
||||||
|
"-framework QuartzCore"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
59
test/util/time/CGameTime.cpp
Normal file
59
test/util/time/CGameTime.cpp
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
#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);
|
||||||
|
}
|
||||||
|
}
|
||||||
190
test/util/time/WowTime.cpp
Normal file
190
test/util/time/WowTime.cpp
Normal file
@ -0,0 +1,190 @@
|
|||||||
|
#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