2011-09-20 19:12:24 +00:00
|
|
|
/* The Lunatic Interpreter, part of EDuke32 */
|
|
|
|
|
|
|
|
#ifndef EDUKE32_LUNATIC_H_
|
|
|
|
#define EDUKE32_LUNATIC_H_
|
|
|
|
|
|
|
|
#include <lua.h>
|
|
|
|
|
2012-06-10 18:56:10 +00:00
|
|
|
#include "gamedef.h" // EventNames[], MAXEVENTS
|
|
|
|
|
|
|
|
|
2011-09-20 19:12:24 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2012-06-03 15:46:02 +00:00
|
|
|
char *name;
|
2011-09-20 19:12:24 +00:00
|
|
|
lua_State *L;
|
|
|
|
} El_State;
|
|
|
|
|
2012-06-10 18:56:10 +00:00
|
|
|
extern uint8_t g_elEvents[MAXEVENTS]; // shouldn't be used directly
|
2012-06-10 18:56:15 +00:00
|
|
|
extern uint8_t g_elActors[MAXTILES]; // shouldn't be used directly
|
2011-09-20 19:12:24 +00:00
|
|
|
|
2012-07-20 21:57:44 +00:00
|
|
|
extern uint32_t g_eventCalls[MAXEVENTS], g_actorCalls[MAXTILES];
|
|
|
|
extern double g_eventTotalMs[MAXEVENTS], g_actorTotalMs[MAXTILES];
|
|
|
|
|
2011-09-20 19:12:24 +00:00
|
|
|
// -- functions --
|
2012-07-20 21:57:44 +00:00
|
|
|
void El_PrintTimes(void);
|
|
|
|
|
2011-09-20 19:12:24 +00:00
|
|
|
int32_t El_CreateState(El_State *estate, const char *name);
|
|
|
|
void El_DestroyState(El_State *estate);
|
|
|
|
int32_t El_RunOnce(El_State *estate, const char *fn);
|
2012-06-10 18:56:10 +00:00
|
|
|
int32_t El_CallEvent(El_State *estate, int32_t eventidx, int32_t iActor, int32_t iPlayer, int32_t lDist);
|
2012-06-10 18:56:15 +00:00
|
|
|
int32_t El_CallActor(El_State *estate, int32_t actortile, int32_t iActor, int32_t iPlayer, int32_t lDist);
|
|
|
|
|
|
|
|
static inline int32_t El_IsInitialized(const El_State *estate) { return (estate->L != NULL); }
|
|
|
|
static inline int32_t El_HaveEvent(int32_t eventidx) { return g_elEvents[eventidx]!=0; }
|
|
|
|
static inline int32_t El_HaveActor(int32_t actortile) { return g_elActors[actortile]!=0; }
|
2011-09-20 19:12:24 +00:00
|
|
|
|
|
|
|
#endif
|