44 lines
984 B
C
44 lines
984 B
C
/**
|
|
* Copyright (c) 2026 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#pragma once
|
|
#include "error/error.h"
|
|
#include "rpg/overworld/worldpos.h"
|
|
#include "rpg/entity/entity.h"
|
|
|
|
typedef struct entity_s entity_t;
|
|
|
|
typedef struct {
|
|
entity_t *entity;
|
|
worldpos_t position;
|
|
} entityglobalcreate_t;
|
|
|
|
/**
|
|
* Callback invoked to initialize a global entity.
|
|
*
|
|
* @param create Pointer to the entity/position being initialized.
|
|
* @returns An error code.
|
|
*/
|
|
typedef void (*entityglobalinitcallback_t)(
|
|
entityglobalcreate_t *create
|
|
);
|
|
|
|
typedef struct {
|
|
entitytype_t type;
|
|
entityglobalinitcallback_t callback;
|
|
} entityglobaldef_t;
|
|
|
|
#define ENTITY_GLOBAL(id, entType, callbackFn) \
|
|
[id] = { .type = entType, .callback = callbackFn }
|
|
|
|
#define ENTITY_GLOBAL_CALLBACK(id) \
|
|
static void ENTTIYT_GLOBAL_CALLBACK_##id(entityglobalcreate_t *create)
|
|
|
|
#define ENTITY_GLOBAL_REF(id) \
|
|
ENTTIYT_GLOBAL_CALLBACK_##id
|
|
|
|
//EOF
|