MORE MACROS

This commit is contained in:
Alug committed 2024-11-21 20:33:58 +01:00
1 parent 802979b81d
commit 11992d2e08
2 files changed
+15 -8

No files matched your search

+8 -3
View File
@@ -82,9 +82,14 @@ X (LinedefExecute),\
#define HOOK(name) hook_ ## name
#define STRING_HOOK(name) stringhook_ ## name
enum { MOBJ_HOOK_LIST (MOBJ_HOOK) MOBJ_HOOK(MAX) };
enum { HOOK_LIST (HOOK) HOOK(MAX) };
enum { STRING_HOOK_LIST (STRING_HOOK) STRING_HOOK(MAX) };
#define ENUM(X) enum { X ## _LIST (X) X(MAX) }
ENUM (MOBJ_HOOK);
ENUM (HOOK);
ENUM (STRING_HOOK);
#undef ENUM
/* dead simple, LUA_HOOK(GameQuit) */
#define LUA_HOOK(type) LUA_HookVoid(HOOK(type))
+7 -5
View File
@@ -30,12 +30,14 @@
ABSTRACTION
========================================================================= */
static const char * const mobjHookNames[] = { MOBJ_HOOK_LIST (TOSTR) NULL };
static const char * const hookNames[] = { HOOK_LIST (TOSTR) NULL };
#define LIST(id, M) \
static const char * const id [] = { M (TOSTR) NULL }
static const char * const stringHookNames[] = {
STRING_HOOK_LIST (TOSTR) NULL
};
LIST (mobjHookNames, MOBJ_HOOK_LIST);
LIST (hookNames, HOOK_LIST);
LIST (stringHookNames, STRING_HOOK_LIST);
#undef LIST
typedef struct {
int numHooks;