mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-05 15:42:17 +03:00
feat(ui): add ScriptEventsRegisterEvents
This commit is contained in:
parent
19f51db2e2
commit
f08cbc0795
@ -11,8 +11,6 @@
|
||||
#include <storm/String.hpp>
|
||||
#include <tempest/Vector.hpp>
|
||||
|
||||
const char* g_scriptEvents[722];
|
||||
|
||||
int32_t g_glueFrameScriptGenders[] = {
|
||||
2, // UNIT_SEX_MALE
|
||||
3, // UNIT_SEX_FEMALE
|
||||
@ -154,9 +152,11 @@ void FrameScript_CreateEvents(const char* names[], uint32_t count) {
|
||||
FrameScript::s_scriptEvents.SetCount(count);
|
||||
|
||||
for (int32_t i = 0; i < count; i++) {
|
||||
if (names[i]) {
|
||||
auto event = FrameScript::s_scriptEventsHash.New(names[i], 0, 0);
|
||||
FrameScript::s_scriptEvents[i] = event;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FrameScript_Destroy() {
|
||||
|
||||
@ -40,7 +40,6 @@ class FrameScript_EventObject : public TSHashObject<FrameScript_EventObject, HAS
|
||||
};
|
||||
|
||||
extern int32_t g_glueFrameScriptGenders[UNITSEX_LAST];
|
||||
extern const char* g_scriptEvents[722];
|
||||
|
||||
namespace FrameScript {
|
||||
extern void* s_mempool;
|
||||
|
||||
@ -80,6 +80,7 @@ void CGGameUI::Initialize() {
|
||||
// TODO
|
||||
|
||||
LoadScriptFunctions();
|
||||
ScriptEventsRegisterEvents();
|
||||
|
||||
// TODO
|
||||
|
||||
|
||||
@ -10,6 +10,10 @@
|
||||
#include "util/StringTo.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
|
||||
#define NUM_SCRIPT_EVENTS 722
|
||||
|
||||
const char* g_scriptEvents[NUM_SCRIPT_EVENTS];
|
||||
|
||||
namespace {
|
||||
|
||||
int32_t Script_UnitExists(lua_State* L) {
|
||||
@ -1597,3 +1601,7 @@ void ScriptEventsInitialize() {
|
||||
g_scriptEvents[720] = "CHAT_MSG_BN_INLINE_TOAST_BROADCAST_INFORM";
|
||||
g_scriptEvents[721] = "CHAT_MSG_BN_INLINE_TOAST_CONVERSATION";
|
||||
}
|
||||
|
||||
void ScriptEventsRegisterEvents() {
|
||||
FrameScript_CreateEvents(g_scriptEvents, NUM_SCRIPT_EVENTS);
|
||||
}
|
||||
|
||||
@ -1,8 +1,12 @@
|
||||
#ifndef UI_GAME_SCRIPT_EVENTS_HPP
|
||||
#define UI_GAME_SCRIPT_EVENTS_HPP
|
||||
|
||||
extern const char* g_scriptEvents[];
|
||||
|
||||
void ScriptEventsInitialize();
|
||||
|
||||
void ScriptEventsRegisterEvents();
|
||||
|
||||
void ScriptEventsRegisterFunctions();
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
Reference in New Issue
Block a user