2012-11-10 20:59:00 +00:00
|
|
|
/* The Lunatic Interpreter, part of EDuke32. Game-side stuff. */
|
2011-09-20 19:12:24 +00:00
|
|
|
|
|
|
|
#ifndef EDUKE32_LUNATIC_H_
|
|
|
|
#define EDUKE32_LUNATIC_H_
|
|
|
|
|
2012-11-10 20:59:00 +00:00
|
|
|
#include "lunatic.h"
|
2014-10-30 21:44:22 +00:00
|
|
|
#include "events_defs.h" // MAXEVENTS
|
|
|
|
#include "actors.h" // con_move_t, con_action_t
|
2011-09-20 19:12:24 +00:00
|
|
|
|
2014-11-26 04:39:23 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2012-06-10 18:56:10 +00:00
|
|
|
|
2012-11-10 20:59:00 +00:00
|
|
|
extern L_State g_ElState;
|
2012-06-10 18:56:10 +00:00
|
|
|
|
2012-12-23 19:24:16 +00:00
|
|
|
// actor initialization data
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
con_move_t mov;
|
|
|
|
int16_t movflags;
|
|
|
|
int16_t strength;
|
|
|
|
con_action_t act;
|
|
|
|
uint8_t haveit; // shouldn't be used directly
|
|
|
|
} el_actor_t;
|
2011-09-20 19:12:24 +00:00
|
|
|
|
2012-06-10 18:56:10 +00:00
|
|
|
extern uint8_t g_elEvents[MAXEVENTS]; // shouldn't be used directly
|
2012-12-23 19:24:16 +00:00
|
|
|
extern el_actor_t g_elActors[MAXTILES];
|
2011-09-20 19:12:24 +00:00
|
|
|
|
2013-03-24 18:52:41 +00:00
|
|
|
extern int32_t g_elEventError;
|
|
|
|
|
2012-07-20 21:57:44 +00:00
|
|
|
extern uint32_t g_eventCalls[MAXEVENTS], g_actorCalls[MAXTILES];
|
2013-03-13 10:48:19 +00:00
|
|
|
extern double g_eventTotalMs[MAXEVENTS], g_actorTotalMs[MAXTILES], g_actorMinMs[MAXTILES], g_actorMaxMs[MAXTILES];
|
2012-07-20 21:57:44 +00:00
|
|
|
|
2011-09-20 19:12:24 +00:00
|
|
|
// -- functions --
|
2012-07-20 21:57:44 +00:00
|
|
|
void El_PrintTimes(void);
|
|
|
|
|
2012-12-25 16:13:41 +00:00
|
|
|
void El_ClearErrors(void);
|
|
|
|
void El_DisplayErrors(void);
|
|
|
|
|
2012-11-10 20:59:00 +00:00
|
|
|
int32_t El_CreateState(L_State *estate, const char *name);
|
|
|
|
void El_DestroyState(L_State *estate);
|
|
|
|
|
2013-02-25 15:31:19 +00:00
|
|
|
int32_t El_CallEvent(L_State *estate, int32_t eventidx, int32_t iActor, int32_t iPlayer, int32_t lDist, int32_t *iReturn);
|
2012-11-10 20:59:00 +00:00
|
|
|
int32_t El_CallActor(L_State *estate, int32_t actortile, int32_t iActor, int32_t iPlayer, int32_t lDist);
|
2012-06-10 18:56:15 +00:00
|
|
|
|
2013-11-04 22:56:03 +00:00
|
|
|
extern int8_t el_addNewErrors; // add new errors to display?
|
2013-10-27 21:12:22 +00:00
|
|
|
void El_OnError(const char *str);
|
|
|
|
|
2014-01-31 21:13:03 +00:00
|
|
|
extern int32_t (*El_RestoreGamevars)(const char *savecode);
|
2013-10-27 21:12:22 +00:00
|
|
|
|
2012-06-10 18:56:15 +00:00
|
|
|
static inline int32_t El_HaveEvent(int32_t eventidx) { return g_elEvents[eventidx]!=0; }
|
2012-12-23 19:24:16 +00:00
|
|
|
static inline int32_t El_HaveActor(int32_t actortile) { return g_elActors[actortile].haveit!=0; }
|
2011-09-20 19:12:24 +00:00
|
|
|
|
2014-11-26 04:39:23 +00:00
|
|
|
typedef struct {
|
|
|
|
uint32_t x, y, z, c;
|
|
|
|
} rng_jkiss_t;
|
|
|
|
|
|
|
|
uint32_t rand_jkiss_u32(rng_jkiss_t *s);
|
|
|
|
double rand_jkiss_dbl(rng_jkiss_t *s);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2011-09-20 19:12:24 +00:00
|
|
|
#endif
|