mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-02 16:52:45 +03:00
Compare commits
10 Commits
2a8c79915d
...
39e8b26cab
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39e8b26cab | ||
|
|
1589466076 | ||
|
|
8d1316b163 | ||
|
|
bdf0bd27a1 | ||
|
|
1f7aa984b0 | ||
|
|
c5c2998efc | ||
|
|
948da084b0 | ||
|
|
fe06d5e820 | ||
|
|
ba6f00d96c | ||
|
|
4a102c6ace |
@ -18,6 +18,7 @@
|
||||
#include "sound/Interface.hpp"
|
||||
#include "ui/FrameScript.hpp"
|
||||
#include "ui/FrameXML.hpp"
|
||||
#include "ui/Game.hpp"
|
||||
#include "util/Random.hpp"
|
||||
#include "world/World.hpp"
|
||||
#include <bc/Debug.hpp>
|
||||
@ -85,6 +86,10 @@ void ClientInitializeGame(uint32_t mapId, C3Vector position) {
|
||||
|
||||
// TODO
|
||||
|
||||
CGGameUI::InitializeGame();
|
||||
|
||||
// TODO
|
||||
|
||||
EventRegister(EVENT_ID_IDLE, ClientIdle);
|
||||
|
||||
// TODO
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include "ui/FrameScript.hpp"
|
||||
#include "ui/FrameXML.hpp"
|
||||
#include "ui/Interface.hpp"
|
||||
#include "ui/Key.hpp"
|
||||
#include "ui/ScriptFunctions.hpp"
|
||||
#include "ui/game/CGVideoOptions.hpp"
|
||||
#include "ui/simple/CSimpleModelFFX.hpp"
|
||||
@ -36,25 +37,6 @@
|
||||
#include <common/MD5.hpp>
|
||||
#include <cstdio>
|
||||
|
||||
unsigned char InterfaceKey[256] = {
|
||||
0xC3, 0x5B, 0x50, 0x84, 0xB9, 0x3E, 0x32, 0x42, 0x8C, 0xD0, 0xC7, 0x48, 0xFA, 0x0E, 0x5D, 0x54,
|
||||
0x5A, 0xA3, 0x0E, 0x14, 0xBA, 0x9E, 0x0D, 0xB9, 0x5D, 0x8B, 0xEE, 0xB6, 0x84, 0x93, 0x45, 0x75,
|
||||
0xFF, 0x31, 0xFE, 0x2F, 0x64, 0x3F, 0x3D, 0x6D, 0x07, 0xD9, 0x44, 0x9B, 0x40, 0x85, 0x59, 0x34,
|
||||
0x4E, 0x10, 0xE1, 0xE7, 0x43, 0x69, 0xEF, 0x7C, 0x16, 0xFC, 0xB4, 0xED, 0x1B, 0x95, 0x28, 0xA8,
|
||||
0x23, 0x76, 0x51, 0x31, 0x57, 0x30, 0x2B, 0x79, 0x08, 0x50, 0x10, 0x1C, 0x4A, 0x1A, 0x2C, 0xC8,
|
||||
0x8B, 0x8F, 0x05, 0x2D, 0x22, 0x3D, 0xDB, 0x5A, 0x24, 0x7A, 0x0F, 0x13, 0x50, 0x37, 0x8F, 0x5A,
|
||||
0xCC, 0x9E, 0x04, 0x44, 0x0E, 0x87, 0x01, 0xD4, 0xA3, 0x15, 0x94, 0x16, 0x34, 0xC6, 0xC2, 0xC3,
|
||||
0xFB, 0x49, 0xFE, 0xE1, 0xF9, 0xDA, 0x8C, 0x50, 0x3C, 0xBE, 0x2C, 0xBB, 0x57, 0xED, 0x46, 0xB9,
|
||||
0xAD, 0x8B, 0xC6, 0xDF, 0x0E, 0xD6, 0x0F, 0xBE, 0x80, 0xB3, 0x8B, 0x1E, 0x77, 0xCF, 0xAD, 0x22,
|
||||
0xCF, 0xB7, 0x4B, 0xCF, 0xFB, 0xF0, 0x6B, 0x11, 0x45, 0x2D, 0x7A, 0x81, 0x18, 0xF2, 0x92, 0x7E,
|
||||
0x98, 0x56, 0x5D, 0x5E, 0x69, 0x72, 0x0A, 0x0D, 0x03, 0x0A, 0x85, 0xA2, 0x85, 0x9C, 0xCB, 0xFB,
|
||||
0x56, 0x6E, 0x8F, 0x44, 0xBB, 0x8F, 0x02, 0x22, 0x68, 0x63, 0x97, 0xBC, 0x85, 0xBA, 0xA8, 0xF7,
|
||||
0xB5, 0x40, 0x68, 0x3C, 0x77, 0x86, 0x6F, 0x4B, 0xD7, 0x88, 0xCA, 0x8A, 0xD7, 0xCE, 0x36, 0xF0,
|
||||
0x45, 0x6E, 0xD5, 0x64, 0x79, 0x0F, 0x17, 0xFC, 0x64, 0xDD, 0x10, 0x6F, 0xF3, 0xF5, 0xE0, 0xA6,
|
||||
0xC3, 0xFB, 0x1B, 0x8C, 0x29, 0xEF, 0x8E, 0xE5, 0x34, 0xCB, 0xD1, 0x2A, 0xCE, 0x79, 0xC3, 0x9A,
|
||||
0x0D, 0x36, 0xEA, 0x01, 0xE0, 0xAA, 0x91, 0x20, 0x54, 0xF0, 0x72, 0xD8, 0x1E, 0xC7, 0x89, 0xD2
|
||||
};
|
||||
|
||||
int32_t CGlueMgr::m_acceptedEULA = 1; // TODO
|
||||
int32_t CGlueMgr::m_acceptedTerminationWithoutNotice;
|
||||
int32_t CGlueMgr::m_acceptedTOS = 1; // TODO
|
||||
@ -64,6 +46,7 @@ float CGlueMgr::m_aspect;
|
||||
bool CGlueMgr::m_authenticated;
|
||||
const CharacterSelectionDisplay* CGlueMgr::m_characterInfo;
|
||||
int32_t CGlueMgr::m_clientKickReason;
|
||||
int32_t CGlueMgr::m_contestAccepted = 1; // TODO
|
||||
char CGlueMgr::m_currentScreen[64];
|
||||
EffectDeath* CGlueMgr::m_deathEffect;
|
||||
int32_t CGlueMgr::m_disconnectPending;
|
||||
@ -1005,51 +988,53 @@ void CGlueMgr::Resume() {
|
||||
|
||||
DeleteInterfaceFiles();
|
||||
|
||||
MD5_CTX md5;
|
||||
unsigned char digest1[16];
|
||||
unsigned char digest2[16];
|
||||
uint8_t digest1[16];
|
||||
|
||||
int32_t v8;
|
||||
unsigned char* v9;
|
||||
unsigned char* v10;
|
||||
|
||||
MD5Init(&md5);
|
||||
|
||||
switch (FrameXML_CheckSignature("Interface\\GlueXML\\GlueXML.toc", 0, InterfaceKey, digest1)) {
|
||||
case 0:
|
||||
switch (FrameXML_CheckSignature("Interface\\GlueXML\\GlueXML.toc", nullptr, InterfaceKey, digest1)) {
|
||||
case 0: {
|
||||
status.Add(STATUS_WARNING, "GlueXML missing signature");
|
||||
ClientPostClose(9);
|
||||
return;
|
||||
|
||||
case 1:
|
||||
status.Add(STATUS_WARNING, "GlueXML has corrupt signature");
|
||||
ClientPostClose(9);
|
||||
return;
|
||||
|
||||
case 2:
|
||||
status.Add(STATUS_WARNING, "GlueXML is modified or corrupt");
|
||||
ClientPostClose(9);
|
||||
return;
|
||||
|
||||
case 3:
|
||||
FrameXML_FreeHashNodes();
|
||||
FrameXML_CreateFrames("Interface\\GlueXML\\GlueXML.toc", 0, &md5, &status);
|
||||
|
||||
MD5Final(digest2, &md5);
|
||||
|
||||
v8 = 16;
|
||||
v9 = digest2;
|
||||
v10 = digest1;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
ClientPostClose(9);
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO
|
||||
// - some kind of digest validation?
|
||||
case 1: {
|
||||
status.Add(STATUS_WARNING, "GlueXML has corrupt signature");
|
||||
ClientPostClose(9);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
case 2: {
|
||||
status.Add(STATUS_WARNING, "GlueXML is modified or corrupt");
|
||||
ClientPostClose(9);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
case 3: {
|
||||
// Success
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
ClientPostClose(9);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
MD5_CTX md5;
|
||||
MD5Init(&md5);
|
||||
|
||||
FrameXML_FreeHashNodes();
|
||||
|
||||
FrameXML_CreateFrames("Interface\\GlueXML\\GlueXML.toc", nullptr, &md5, &status);
|
||||
|
||||
uint8_t digest2[16];
|
||||
MD5Final(digest2, &md5);
|
||||
|
||||
// TODO digest validation
|
||||
|
||||
FrameScript_SignalEvent(22, nullptr);
|
||||
|
||||
|
||||
@ -41,6 +41,7 @@ class CGlueMgr {
|
||||
static bool m_authenticated;
|
||||
static const CharacterSelectionDisplay* m_characterInfo;
|
||||
static int32_t m_clientKickReason;
|
||||
static int32_t m_contestAccepted;
|
||||
static char m_currentScreen[];
|
||||
static EffectDeath* m_deathEffect;
|
||||
static int32_t m_disconnectPending;
|
||||
|
||||
@ -222,7 +222,14 @@ int32_t Script_ShowContestNotice(lua_State* L) {
|
||||
}
|
||||
|
||||
int32_t Script_ContestAccepted(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
if (CGlueMgr::m_contestAccepted) {
|
||||
lua_pushnumber(L, 1.0);
|
||||
}
|
||||
else {
|
||||
lua_pushnil(L);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t Script_AcceptContest(lua_State* L) {
|
||||
|
||||
@ -5,6 +5,12 @@
|
||||
|
||||
int32_t FrameScript_Object::s_objectTypes = 0;
|
||||
|
||||
FrameScript_Object::ScriptIx::~ScriptIx() {
|
||||
if (this->luaRef) {
|
||||
luaL_unref(FrameScript_GetContext(), LUA_REGISTRYINDEX, this->luaRef);
|
||||
}
|
||||
}
|
||||
|
||||
int32_t FrameScript_Object::CreateScriptMetaTable(lua_State* L, void (*a2)(lua_State* L)) {
|
||||
lua_createtable(L, 0, 0);
|
||||
lua_pushstring(L, "__index");
|
||||
@ -24,12 +30,6 @@ void FrameScript_Object::FillScriptMethodTable(lua_State *L, FrameScript_Method
|
||||
}
|
||||
}
|
||||
|
||||
FrameScript_Object::~FrameScript_Object() {
|
||||
if (this->m_onEvent.luaRef) {
|
||||
luaL_unref(FrameScript_GetContext(), LUA_REGISTRYINDEX, this->m_onEvent.luaRef);
|
||||
}
|
||||
}
|
||||
|
||||
const char* FrameScript_Object::GetDisplayName() {
|
||||
const char* name = this->GetName();
|
||||
return name ? name : "<unnamed>";
|
||||
|
||||
@ -14,6 +14,7 @@ class FrameScript_Object {
|
||||
struct ScriptIx {
|
||||
int32_t luaRef = 0;
|
||||
const char* unk = nullptr;
|
||||
~ScriptIx();
|
||||
};
|
||||
|
||||
class ScriptFunction {
|
||||
@ -34,7 +35,7 @@ class FrameScript_Object {
|
||||
ScriptIx m_onEvent;
|
||||
|
||||
// Virtual member functions
|
||||
virtual ~FrameScript_Object();
|
||||
virtual ~FrameScript_Object() = default;
|
||||
virtual char* GetName() = 0;
|
||||
virtual int32_t GetScriptMetaTable() = 0;
|
||||
virtual ScriptIx* GetScriptByName(const char* name, ScriptData& data);
|
||||
|
||||
6
src/ui/Game.hpp
Normal file
6
src/ui/Game.hpp
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef UI_GAME_HPP
|
||||
#define UI_GAME_HPP
|
||||
|
||||
#include "ui/game/CGGameUI.hpp"
|
||||
|
||||
#endif
|
||||
20
src/ui/Key.cpp
Normal file
20
src/ui/Key.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
#include "ui/Key.hpp"
|
||||
|
||||
uint8_t InterfaceKey[256] = {
|
||||
0xC3, 0x5B, 0x50, 0x84, 0xB9, 0x3E, 0x32, 0x42, 0x8C, 0xD0, 0xC7, 0x48, 0xFA, 0x0E, 0x5D, 0x54,
|
||||
0x5A, 0xA3, 0x0E, 0x14, 0xBA, 0x9E, 0x0D, 0xB9, 0x5D, 0x8B, 0xEE, 0xB6, 0x84, 0x93, 0x45, 0x75,
|
||||
0xFF, 0x31, 0xFE, 0x2F, 0x64, 0x3F, 0x3D, 0x6D, 0x07, 0xD9, 0x44, 0x9B, 0x40, 0x85, 0x59, 0x34,
|
||||
0x4E, 0x10, 0xE1, 0xE7, 0x43, 0x69, 0xEF, 0x7C, 0x16, 0xFC, 0xB4, 0xED, 0x1B, 0x95, 0x28, 0xA8,
|
||||
0x23, 0x76, 0x51, 0x31, 0x57, 0x30, 0x2B, 0x79, 0x08, 0x50, 0x10, 0x1C, 0x4A, 0x1A, 0x2C, 0xC8,
|
||||
0x8B, 0x8F, 0x05, 0x2D, 0x22, 0x3D, 0xDB, 0x5A, 0x24, 0x7A, 0x0F, 0x13, 0x50, 0x37, 0x8F, 0x5A,
|
||||
0xCC, 0x9E, 0x04, 0x44, 0x0E, 0x87, 0x01, 0xD4, 0xA3, 0x15, 0x94, 0x16, 0x34, 0xC6, 0xC2, 0xC3,
|
||||
0xFB, 0x49, 0xFE, 0xE1, 0xF9, 0xDA, 0x8C, 0x50, 0x3C, 0xBE, 0x2C, 0xBB, 0x57, 0xED, 0x46, 0xB9,
|
||||
0xAD, 0x8B, 0xC6, 0xDF, 0x0E, 0xD6, 0x0F, 0xBE, 0x80, 0xB3, 0x8B, 0x1E, 0x77, 0xCF, 0xAD, 0x22,
|
||||
0xCF, 0xB7, 0x4B, 0xCF, 0xFB, 0xF0, 0x6B, 0x11, 0x45, 0x2D, 0x7A, 0x81, 0x18, 0xF2, 0x92, 0x7E,
|
||||
0x98, 0x56, 0x5D, 0x5E, 0x69, 0x72, 0x0A, 0x0D, 0x03, 0x0A, 0x85, 0xA2, 0x85, 0x9C, 0xCB, 0xFB,
|
||||
0x56, 0x6E, 0x8F, 0x44, 0xBB, 0x8F, 0x02, 0x22, 0x68, 0x63, 0x97, 0xBC, 0x85, 0xBA, 0xA8, 0xF7,
|
||||
0xB5, 0x40, 0x68, 0x3C, 0x77, 0x86, 0x6F, 0x4B, 0xD7, 0x88, 0xCA, 0x8A, 0xD7, 0xCE, 0x36, 0xF0,
|
||||
0x45, 0x6E, 0xD5, 0x64, 0x79, 0x0F, 0x17, 0xFC, 0x64, 0xDD, 0x10, 0x6F, 0xF3, 0xF5, 0xE0, 0xA6,
|
||||
0xC3, 0xFB, 0x1B, 0x8C, 0x29, 0xEF, 0x8E, 0xE5, 0x34, 0xCB, 0xD1, 0x2A, 0xCE, 0x79, 0xC3, 0x9A,
|
||||
0x0D, 0x36, 0xEA, 0x01, 0xE0, 0xAA, 0x91, 0x20, 0x54, 0xF0, 0x72, 0xD8, 0x1E, 0xC7, 0x89, 0xD2
|
||||
};
|
||||
8
src/ui/Key.hpp
Normal file
8
src/ui/Key.hpp
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef UI_KEY_HPP
|
||||
#define UI_KEY_HPP
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
extern uint8_t InterfaceKey[256];
|
||||
|
||||
#endif
|
||||
94
src/ui/game/CGGameUI.cpp
Normal file
94
src/ui/game/CGGameUI.cpp
Normal file
@ -0,0 +1,94 @@
|
||||
#include "ui/game/CGGameUI.hpp"
|
||||
#include "client/Client.hpp"
|
||||
#include "ui/FrameXML.hpp"
|
||||
#include "ui/Key.hpp"
|
||||
#include "ui/game/CGWorldFrame.hpp"
|
||||
#include "ui/simple/CSimpleTop.hpp"
|
||||
#include "util/CStatus.hpp"
|
||||
#include <common/MD5.hpp>
|
||||
|
||||
CSimpleTop* CGGameUI::s_simpleTop;
|
||||
|
||||
void CGGameUI::Initialize() {
|
||||
// TODO
|
||||
|
||||
CGGameUI::s_simpleTop = STORM_NEW(CSimpleTop);
|
||||
|
||||
// TODO
|
||||
|
||||
CGGameUI::RegisterFrameFactories();
|
||||
|
||||
// TODO
|
||||
|
||||
CStatus status;
|
||||
|
||||
// TODO
|
||||
|
||||
uint8_t digest1[16];
|
||||
|
||||
switch (FrameXML_CheckSignature("Interface\\FrameXML\\FrameXML.toc", "Interface\\FrameXML\\Bindings.xml", InterfaceKey, digest1)) {
|
||||
case 0: {
|
||||
status.Add(STATUS_WARNING, "FrameXML missing signature");
|
||||
ClientPostClose(10);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 1: {
|
||||
status.Add(STATUS_WARNING, "FrameXML has corrupt signature");
|
||||
ClientPostClose(10);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 2: {
|
||||
status.Add(STATUS_WARNING, "FrameXML is modified or corrupt");
|
||||
ClientPostClose(10);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 3: {
|
||||
// Success
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
ClientPostClose(10);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
MD5_CTX md5;
|
||||
MD5Init(&md5);
|
||||
|
||||
// TODO file count and progress bar logic
|
||||
|
||||
FrameXML_FreeHashNodes();
|
||||
|
||||
FrameXML_CreateFrames("Interface\\FrameXML\\FrameXML.toc", nullptr, &md5, &status);
|
||||
|
||||
// TODO CGUIBindings::s_bindings->Load("Interface\\FrameXML\\Bindings.xml", &md5, &status);
|
||||
|
||||
uint8_t digest2[16];
|
||||
MD5Final(digest2, &md5);
|
||||
|
||||
// TODO digest validation
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CGGameUI::InitializeGame() {
|
||||
// TODO
|
||||
|
||||
CGGameUI::Initialize();
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CGGameUI::RegisterFrameFactories() {
|
||||
FrameXML_RegisterFactory("WorldFrame", &CGWorldFrame::Create, true);
|
||||
|
||||
// TODO register remaining factories
|
||||
}
|
||||
17
src/ui/game/CGGameUI.hpp
Normal file
17
src/ui/game/CGGameUI.hpp
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef UI_GAME_C_G_GAME_UI_HPP
|
||||
#define UI_GAME_C_G_GAME_UI_HPP
|
||||
|
||||
class CSimpleTop;
|
||||
|
||||
class CGGameUI {
|
||||
public:
|
||||
// Static variables
|
||||
static CSimpleTop* s_simpleTop;
|
||||
|
||||
// Static functions
|
||||
static void Initialize();
|
||||
static void InitializeGame();
|
||||
static void RegisterFrameFactories();
|
||||
};
|
||||
|
||||
#endif
|
||||
22
src/ui/game/CGWorldFrame.cpp
Normal file
22
src/ui/game/CGWorldFrame.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include "ui/game/CGWorldFrame.hpp"
|
||||
#include <storm/Memory.hpp>
|
||||
|
||||
CSimpleFrame* CGWorldFrame::Create(CSimpleFrame* parent) {
|
||||
// TODO use CDataAllocator
|
||||
|
||||
return STORM_NEW(CGWorldFrame)(parent);
|
||||
}
|
||||
|
||||
CGWorldFrame::CGWorldFrame(CSimpleFrame* parent) : CSimpleFrame(parent) {
|
||||
// TODO
|
||||
|
||||
CGWorldFrame::s_currentWorldFrame = this;
|
||||
|
||||
// TODO
|
||||
|
||||
this->EnableEvent(SIMPLE_EVENT_KEY, -1);
|
||||
this->EnableEvent(SIMPLE_EVENT_MOUSE, -1);
|
||||
this->EnableEvent(SIMPLE_EVENT_MOUSEWHEEL, -1);
|
||||
|
||||
// TODO
|
||||
}
|
||||
19
src/ui/game/CGWorldFrame.hpp
Normal file
19
src/ui/game/CGWorldFrame.hpp
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef UI_GAME_C_G_WORLD_FRAME_HPP
|
||||
#define UI_GAME_C_G_WORLD_FRAME_HPP
|
||||
|
||||
#include "ui/simple/CSimpleFrame.hpp"
|
||||
#include <cstdint>
|
||||
|
||||
class CGWorldFrame : public CSimpleFrame {
|
||||
public:
|
||||
// Static variables
|
||||
CGWorldFrame* s_currentWorldFrame;
|
||||
|
||||
// Static functions
|
||||
static CSimpleFrame* Create(CSimpleFrame* parent);
|
||||
|
||||
// Member functions
|
||||
CGWorldFrame(CSimpleFrame* parent);
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -17,6 +17,35 @@ uint32_t CWorld::s_tickTimeMs;
|
||||
float CWorld::s_tickTimeSec;
|
||||
Weather* CWorld::s_weather;
|
||||
|
||||
HWORLDOBJECT CWorld::AddObject(CM2Model* model, void* handler, void* handlerParam, uint64_t param64, uint32_t param32, uint32_t objFlags) {
|
||||
auto entity = CMap::AllocEntity(objFlags & 0x8 ? true : false);
|
||||
|
||||
entity->m_model = model;
|
||||
entity->m_param64 = param64;
|
||||
entity->m_param32 = param32;
|
||||
|
||||
// TODO
|
||||
|
||||
entity->m_dirLightScale = 1.0f;
|
||||
entity->m_dirLightScaleTarget = 1.0f;
|
||||
|
||||
// TODO
|
||||
|
||||
entity->m_type |= CMapBaseObj::Type_200;
|
||||
|
||||
// TODO
|
||||
|
||||
entity->m_flags = 0x0;
|
||||
|
||||
if (objFlags & 0x20) {
|
||||
entity->m_flags = 0x20000;
|
||||
}
|
||||
|
||||
// TODO
|
||||
|
||||
return reinterpret_cast<HWORLDOBJECT>(entity);
|
||||
}
|
||||
|
||||
uint32_t CWorld::GetCurTimeMs() {
|
||||
return CWorld::s_curTimeMs;
|
||||
}
|
||||
@ -88,6 +117,10 @@ void CWorld::Initialize() {
|
||||
|
||||
// TODO
|
||||
|
||||
CMap::Initialize();
|
||||
|
||||
// TODO
|
||||
|
||||
CWorld::s_weather = STORM_NEW(Weather);
|
||||
|
||||
// TODO
|
||||
|
||||
@ -2,9 +2,11 @@
|
||||
#define WORLD_C_WORLD_HPP
|
||||
|
||||
#include "event/Event.hpp"
|
||||
#include "world/Types.hpp"
|
||||
#include <tempest/Vector.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
class CM2Model;
|
||||
class Weather;
|
||||
|
||||
class CWorld {
|
||||
@ -51,6 +53,7 @@ class CWorld {
|
||||
static Weather* s_weather;
|
||||
|
||||
// Public static functions
|
||||
static HWORLDOBJECT AddObject(CM2Model* model, void* handler, void* handlerParam, uint64_t param64, uint32_t param32, uint32_t objFlags);
|
||||
static uint32_t GetCurTimeMs();
|
||||
static float GetCurTimeSec();
|
||||
static uint32_t GetGameTimeFixed();
|
||||
|
||||
9
src/world/map/CChunkLiquid.hpp
Normal file
9
src/world/map/CChunkLiquid.hpp
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef WORLD_MAP_C_CHUNK_LIQUID_HPP
|
||||
#define WORLD_MAP_C_CHUNK_LIQUID_HPP
|
||||
|
||||
class CChunkLiquid {
|
||||
public:
|
||||
// TODO
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -1,11 +1,66 @@
|
||||
#include "world/map/CMap.hpp"
|
||||
#include "world/map/CChunkLiquid.hpp"
|
||||
#include "world/map/CMapArea.hpp"
|
||||
#include "world/map/CMapAreaLow.hpp"
|
||||
#include "world/map/CMapCacheLight.hpp"
|
||||
#include "world/map/CMapChunk.hpp"
|
||||
#include "world/map/CMapDoodadDef.hpp"
|
||||
#include "world/map/CMapEntity.hpp"
|
||||
#include "world/map/CMapLight.hpp"
|
||||
#include "world/map/CMapObj.hpp"
|
||||
#include "world/map/CMapObjDef.hpp"
|
||||
#include "world/map/CMapObjDefGroup.hpp"
|
||||
#include "world/map/CMapObjGroup.hpp"
|
||||
#include <common/ObjectAlloc.hpp>
|
||||
#include <storm/String.hpp>
|
||||
|
||||
uint32_t* CMap::s_areaHeap;
|
||||
uint32_t* CMap::s_areaLowHeap;
|
||||
uint32_t* CMap::s_baseObjLinkHeap;
|
||||
uint32_t* CMap::s_cacheLightHeap;
|
||||
uint32_t* CMap::s_chunkHeap;
|
||||
uint32_t* CMap::s_chunkLiquidHeap;
|
||||
uint32_t* CMap::s_doodadDefHeap;
|
||||
uint32_t* CMap::s_entityHeap;
|
||||
STORM_EXPLICIT_LIST(CMapBaseObj, m_lameAssLink) CMap::s_entityList;
|
||||
uint32_t* CMap::s_lightHeap;
|
||||
uint32_t* CMap::s_mapObjDefGroupHeap;
|
||||
uint32_t* CMap::s_mapObjDefHeap;
|
||||
uint32_t* CMap::s_mapObjGroupHeap;
|
||||
uint32_t* CMap::s_mapObjHeap;
|
||||
char CMap::s_mapName[256];
|
||||
char CMap::s_mapPath[256];
|
||||
char CMap::s_wdtFilename[256];
|
||||
|
||||
CMapEntity* CMap::AllocEntity(int32_t a1) {
|
||||
CMapEntity* entity;
|
||||
uint32_t memHandle;
|
||||
void* mem = nullptr;
|
||||
|
||||
if (ObjectAlloc(*CMap::s_entityHeap, &memHandle, &mem, false)) {
|
||||
entity = new (mem) CMapEntity();
|
||||
entity->m_memHandle = memHandle;
|
||||
} else {
|
||||
entity = nullptr;
|
||||
}
|
||||
|
||||
if (a1) {
|
||||
CMap::s_entityList.LinkToHead(entity);
|
||||
} else {
|
||||
CMap::s_entityList.LinkToTail(entity);
|
||||
}
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
void CMap::Initialize() {
|
||||
// TODO
|
||||
|
||||
CMap::MapMemInitialize();
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CMap::Load(const char* mapName, int32_t zoneID) {
|
||||
// TODO
|
||||
|
||||
@ -18,3 +73,20 @@ void CMap::Load(const char* mapName, int32_t zoneID) {
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CMap::MapMemInitialize() {
|
||||
CMap::s_lightHeap = STORM_NEW(uint32_t)(ObjectAllocAddHeap(sizeof(CMapLight), 128, "WLIGHT", true));
|
||||
CMap::s_cacheLightHeap = STORM_NEW(uint32_t)(ObjectAllocAddHeap(sizeof(CMapCacheLight), 256, "WCACHELIGHT", true));
|
||||
CMap::s_mapObjGroupHeap = STORM_NEW(uint32_t)(ObjectAllocAddHeap(sizeof(CMapObjGroup), 128, "WMAPOBJGROUP", true));
|
||||
CMap::s_mapObjHeap = STORM_NEW(uint32_t)(ObjectAllocAddHeap(sizeof(CMapObj), 32, "WMAPOBJ", true));
|
||||
CMap::s_baseObjLinkHeap = STORM_NEW(uint32_t)(ObjectAllocAddHeap(sizeof(CMapBaseObjLink), 10000, "WBASEOBJLINK", true));
|
||||
CMap::s_areaHeap = STORM_NEW(uint32_t)(ObjectAllocAddHeap(sizeof(CMapArea), 16, "WAREA", true));
|
||||
// CMap::s_areaMedHeap = STORM_NEW(uint32_t)(ObjectAllocAddHeap(sizeof(CMapAreaMed), 16, "WAREAMED", true)); ??
|
||||
CMap::s_areaLowHeap = STORM_NEW(uint32_t)(ObjectAllocAddHeap(sizeof(CMapAreaLow), 16, "WAREALOW", true));
|
||||
CMap::s_chunkHeap = STORM_NEW(uint32_t)(ObjectAllocAddHeap(sizeof(CMapChunk), 256, "WCHUNK", true));
|
||||
CMap::s_doodadDefHeap = STORM_NEW(uint32_t)(ObjectAllocAddHeap(sizeof(CMapDoodadDef), 5000, "WDOODADDEF", true));
|
||||
CMap::s_entityHeap = STORM_NEW(uint32_t)(ObjectAllocAddHeap(sizeof(CMapEntity), 128, "WENTITY", true));
|
||||
CMap::s_mapObjDefGroupHeap = STORM_NEW(uint32_t)(ObjectAllocAddHeap(sizeof(CMapObjDefGroup), 128, "WMAPOBJDEFGROUP", true));
|
||||
CMap::s_mapObjDefHeap = STORM_NEW(uint32_t)(ObjectAllocAddHeap(sizeof(CMapObjDef), 64, "WMAPOBJDEF", true));
|
||||
CMap::s_chunkLiquidHeap = STORM_NEW(uint32_t)(ObjectAllocAddHeap(sizeof(CChunkLiquid), 64, "WCHUNKLIQUID", true));
|
||||
}
|
||||
|
||||
@ -2,19 +2,36 @@
|
||||
#define WORLD_MAP_C_MAP_HPP
|
||||
|
||||
#include "world/map/CMapBaseObj.hpp"
|
||||
#include "world/map/CMapEntity.hpp"
|
||||
#include <storm/List.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
class CMap {
|
||||
public:
|
||||
// Static variables
|
||||
static uint32_t* s_areaHeap;
|
||||
static uint32_t* s_areaLowHeap;
|
||||
static uint32_t* s_baseObjLinkHeap;
|
||||
static uint32_t* s_cacheLightHeap;
|
||||
static uint32_t* s_chunkHeap;
|
||||
static uint32_t* s_chunkLiquidHeap;
|
||||
static uint32_t* s_doodadDefHeap;
|
||||
static uint32_t* s_entityHeap;
|
||||
static STORM_EXPLICIT_LIST(CMapBaseObj, m_lameAssLink) s_entityList;
|
||||
static uint32_t* s_lightHeap;
|
||||
static uint32_t* s_mapObjDefGroupHeap;
|
||||
static uint32_t* s_mapObjDefHeap;
|
||||
static uint32_t* s_mapObjGroupHeap;
|
||||
static uint32_t* s_mapObjHeap;
|
||||
static char s_mapName[];
|
||||
static char s_mapPath[];
|
||||
static char s_wdtFilename[];
|
||||
|
||||
// Static functions
|
||||
static CMapEntity* AllocEntity(int32_t a1);
|
||||
static void Initialize();
|
||||
static void Load(const char* mapName, int32_t zoneID);
|
||||
static void MapMemInitialize();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
11
src/world/map/CMapArea.hpp
Normal file
11
src/world/map/CMapArea.hpp
Normal file
@ -0,0 +1,11 @@
|
||||
#ifndef WORLD_MAP_C_MAP_AREA_HPP
|
||||
#define WORLD_MAP_C_MAP_AREA_HPP
|
||||
|
||||
#include "world/map/CMapBaseObj.hpp"
|
||||
|
||||
class CMapArea : public CMapBaseObj {
|
||||
public:
|
||||
// TODO
|
||||
};
|
||||
|
||||
#endif
|
||||
9
src/world/map/CMapAreaLow.hpp
Normal file
9
src/world/map/CMapAreaLow.hpp
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef WORLD_MAP_C_MAP_AREA_LOW_HPP
|
||||
#define WORLD_MAP_C_MAP_AREA_LOW_HPP
|
||||
|
||||
class CMapAreaLow {
|
||||
public:
|
||||
// TODO
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -18,6 +18,9 @@ class CMapBaseObjLink {
|
||||
};
|
||||
|
||||
class CMapBaseObj {
|
||||
friend class CMap;
|
||||
friend class CWorld;
|
||||
|
||||
public:
|
||||
// Enums
|
||||
enum {
|
||||
@ -29,10 +32,13 @@ class CMapBaseObj {
|
||||
Type_Entity = 0x20,
|
||||
Type_DoodadDef = 0x40,
|
||||
Type_Light = 0x80,
|
||||
Type_100 = 0x100,
|
||||
Type_200 = 0x200,
|
||||
};
|
||||
|
||||
// Public member variables
|
||||
uint32_t m_memHandle;
|
||||
uint32_t m_flags = 0x0;
|
||||
TSLink<CMapBaseObj> m_lameAssLink;
|
||||
STORM_EXPLICIT_LIST(CMapBaseObjLink, ownerLink) m_parentLinkList;
|
||||
|
||||
|
||||
9
src/world/map/CMapCacheLight.hpp
Normal file
9
src/world/map/CMapCacheLight.hpp
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef WORLD_MAP_C_MAP_CACHE_LIGHT_HPP
|
||||
#define WORLD_MAP_C_MAP_CACHE_LIGHT_HPP
|
||||
|
||||
class CMapCacheLight {
|
||||
public:
|
||||
// TODO
|
||||
};
|
||||
|
||||
#endif
|
||||
11
src/world/map/CMapChunk.hpp
Normal file
11
src/world/map/CMapChunk.hpp
Normal file
@ -0,0 +1,11 @@
|
||||
#ifndef WORLD_MAP_C_MAP_CHUNK_HPP
|
||||
#define WORLD_MAP_C_MAP_CHUNK_HPP
|
||||
|
||||
#include "world/map/CMapBaseObj.hpp"
|
||||
|
||||
class CMapChunk : public CMapBaseObj {
|
||||
public:
|
||||
// TODO
|
||||
};
|
||||
|
||||
#endif
|
||||
11
src/world/map/CMapDoodadDef.hpp
Normal file
11
src/world/map/CMapDoodadDef.hpp
Normal file
@ -0,0 +1,11 @@
|
||||
#ifndef WORLD_MAP_C_MAP_DOODAD_DEF_HPP
|
||||
#define WORLD_MAP_C_MAP_DOODAD_DEF_HPP
|
||||
|
||||
#include "world/map/CMapStaticEntity.hpp"
|
||||
|
||||
class CMapDoodadDef : public CMapStaticEntity {
|
||||
public:
|
||||
// TODO
|
||||
};
|
||||
|
||||
#endif
|
||||
5
src/world/map/CMapEntity.cpp
Normal file
5
src/world/map/CMapEntity.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
#include "world/map/CMapEntity.hpp"
|
||||
|
||||
CMapEntity::CMapEntity() {
|
||||
this->m_type |= CMapBaseObj::Type_Entity;
|
||||
}
|
||||
@ -2,10 +2,22 @@
|
||||
#define WORLD_MAP_C_MAP_ENTITY_HPP
|
||||
|
||||
#include "world/map/CMapStaticEntity.hpp"
|
||||
#include <tempest/Vector.hpp>
|
||||
|
||||
class CMapEntity : public CMapStaticEntity {
|
||||
public:
|
||||
// Member variables
|
||||
void* m_handler = nullptr;
|
||||
void* m_handlerParam = nullptr;
|
||||
uint64_t m_param64 = 0;
|
||||
uint32_t m_param32 = 0;
|
||||
// TODO
|
||||
CImVector m_ambientTarget = { 0xFF, 0x00, 0x00, 0x00 };
|
||||
float m_dirLightScaleTarget = 0.0f;
|
||||
// TODO
|
||||
|
||||
// Member functions
|
||||
CMapEntity();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
11
src/world/map/CMapLight.hpp
Normal file
11
src/world/map/CMapLight.hpp
Normal file
@ -0,0 +1,11 @@
|
||||
#ifndef WORLD_MAP_C_MAP_LIGHT_HPP
|
||||
#define WORLD_MAP_C_MAP_LIGHT_HPP
|
||||
|
||||
#include "world/map/CMapBaseObj.hpp"
|
||||
|
||||
class CMapLight : public CMapBaseObj {
|
||||
public:
|
||||
// TODO
|
||||
};
|
||||
|
||||
#endif
|
||||
9
src/world/map/CMapObj.hpp
Normal file
9
src/world/map/CMapObj.hpp
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef WORLD_MAP_C_MAP_OBJ_HPP
|
||||
#define WORLD_MAP_C_MAP_OBJ_HPP
|
||||
|
||||
class CMapObj {
|
||||
public:
|
||||
// TODO
|
||||
};
|
||||
|
||||
#endif
|
||||
11
src/world/map/CMapObjDef.hpp
Normal file
11
src/world/map/CMapObjDef.hpp
Normal file
@ -0,0 +1,11 @@
|
||||
#ifndef WORLD_MAP_C_MAP_OBJ_DEF_HPP
|
||||
#define WORLD_MAP_C_MAP_OBJ_DEF_HPP
|
||||
|
||||
#include "world/map/CMapBaseObj.hpp"
|
||||
|
||||
class CMapObjDef : public CMapBaseObj {
|
||||
public:
|
||||
// TODO
|
||||
};
|
||||
|
||||
#endif
|
||||
9
src/world/map/CMapObjDefGroup.hpp
Normal file
9
src/world/map/CMapObjDefGroup.hpp
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef WORLD_MAP_C_MAP_OBJ_DEF_GROUP_HPP
|
||||
#define WORLD_MAP_C_MAP_OBJ_DEF_GROUP_HPP
|
||||
|
||||
class CMapObjDefGroup : public CMapBaseObj {
|
||||
public:
|
||||
// TODO
|
||||
};
|
||||
|
||||
#endif
|
||||
9
src/world/map/CMapObjGroup.hpp
Normal file
9
src/world/map/CMapObjGroup.hpp
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef WORLD_MAP_C_MAP_OBJ_GROUP_HPP
|
||||
#define WORLD_MAP_C_MAP_OBJ_GROUP_HPP
|
||||
|
||||
class CMapObjGroup {
|
||||
public:
|
||||
// TODO
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -2,10 +2,19 @@
|
||||
#define WORLD_MAP_C_MAP_STATIC_ENTITY_HPP
|
||||
|
||||
#include "world/map/CMapBaseObj.hpp"
|
||||
#include <tempest/Vector.hpp>
|
||||
|
||||
class CM2Model;
|
||||
|
||||
class CMapStaticEntity : public CMapBaseObj {
|
||||
public:
|
||||
// Member variables
|
||||
// TODO
|
||||
CM2Model* m_model = nullptr;
|
||||
// TODO
|
||||
CImVector m_ambient = {};
|
||||
CImVector m_interiorDirColor = {};
|
||||
float m_dirLightScale = 0.0f;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
Reference in New Issue
Block a user