Lunatic: fix building and startup up to tilesizx[] failure. DONT_BUILD.

- Needed to rip out enum GameEvent_t into own header file to prevent what
  would be a circular #include otherwise
- Added some forgotten #ifdef LUNATIC
- updated structure and function declarations on the Lua FFI side

git-svn-id: https://svn.eduke32.com/eduke32@4710 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2014-10-30 21:44:22 +00:00
parent ae63745eb3
commit 96541f3521
8 changed files with 18 additions and 116 deletions

View file

@ -26,112 +26,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "build.h" #include "build.h"
#include "sector.h" // mapstate_t #include "sector.h" // mapstate_t
#include "gamedef.h" // vmstate_t #include "gamedef.h" // vmstate_t
#include "events_defs.h"
// the order of these can't be changed or else compatibility with EDuke 2.0 mods will break
// KEEPINSYNC with EventNames[] and lunatic/con_lang.lua
enum GameEvent_t {
EVENT_INIT, // 0
EVENT_ENTERLEVEL,
EVENT_RESETWEAPONS,
EVENT_RESETINVENTORY,
EVENT_HOLSTER,
EVENT_LOOKLEFT, // 5
EVENT_LOOKRIGHT,
EVENT_SOARUP,
EVENT_SOARDOWN,
EVENT_CROUCH,
EVENT_JUMP, // 10
EVENT_RETURNTOCENTER,
EVENT_LOOKUP,
EVENT_LOOKDOWN,
EVENT_AIMUP,
EVENT_FIRE, // 15
EVENT_CHANGEWEAPON,
EVENT_GETSHOTRANGE,
EVENT_GETAUTOAIMANGLE,
EVENT_GETLOADTILE,
EVENT_CHEATGETSTEROIDS, // 20
EVENT_CHEATGETHEAT,
EVENT_CHEATGETBOOT,
EVENT_CHEATGETSHIELD,
EVENT_CHEATGETSCUBA,
EVENT_CHEATGETHOLODUKE, // 25
EVENT_CHEATGETJETPACK,
EVENT_CHEATGETFIRSTAID,
EVENT_QUICKKICK,
EVENT_INVENTORY,
EVENT_USENIGHTVISION, // 30
EVENT_USESTEROIDS,
EVENT_INVENTORYLEFT,
EVENT_INVENTORYRIGHT,
EVENT_HOLODUKEON,
EVENT_HOLODUKEOFF, // 35
EVENT_USEMEDKIT,
EVENT_USEJETPACK,
EVENT_TURNAROUND,
EVENT_DISPLAYWEAPON,
EVENT_FIREWEAPON, // 40
EVENT_SELECTWEAPON,
EVENT_MOVEFORWARD,
EVENT_MOVEBACKWARD,
EVENT_TURNLEFT,
EVENT_TURNRIGHT, // 45
EVENT_STRAFELEFT,
EVENT_STRAFERIGHT,
EVENT_WEAPKEY1,
EVENT_WEAPKEY2,
EVENT_WEAPKEY3, // 50
EVENT_WEAPKEY4,
EVENT_WEAPKEY5,
EVENT_WEAPKEY6,
EVENT_WEAPKEY7,
EVENT_WEAPKEY8, // 55
EVENT_WEAPKEY9,
EVENT_WEAPKEY10,
EVENT_DRAWWEAPON,
EVENT_DISPLAYCROSSHAIR,
EVENT_DISPLAYREST, // 60
EVENT_DISPLAYSBAR,
EVENT_RESETPLAYER,
EVENT_INCURDAMAGE,
EVENT_AIMDOWN,
EVENT_GAME, // 65
EVENT_PREVIOUSWEAPON,
EVENT_NEXTWEAPON,
EVENT_SWIMUP,
EVENT_SWIMDOWN,
EVENT_GETMENUTILE, // 70
EVENT_SPAWN,
EVENT_LOGO,
EVENT_EGS,
EVENT_DOFIRE,
EVENT_PRESSEDFIRE, // 75
EVENT_USE,
EVENT_PROCESSINPUT,
EVENT_FAKEDOMOVETHINGS,
EVENT_DISPLAYROOMS,
EVENT_KILLIT, // 80
EVENT_LOADACTOR,
EVENT_DISPLAYBONUSSCREEN,
EVENT_DISPLAYMENU,
EVENT_DISPLAYMENUREST,
EVENT_DISPLAYLOADINGSCREEN, // 85
EVENT_ANIMATESPRITES,
EVENT_NEWGAME,
EVENT_SOUND,
EVENT_CHECKTOUCHDAMAGE,
EVENT_CHECKFLOORDAMAGE, // 90
EVENT_LOADGAME,
EVENT_SAVEGAME,
EVENT_PREGAME,
EVENT_CHANGEMENU,
EVENT_DAMAGEHPLANE, // 95
EVENT_ACTIVATECHEAT,
#ifdef LUNATIC #ifdef LUNATIC
EVENT_ANIMATEALLSPRITES, # include "lunatic_game.h"
#endif #endif
MAXEVENTS
};
extern int32_t ticrandomseed; extern int32_t ticrandomseed;
@ -158,7 +57,7 @@ int32_t VM_OnEvent_(int32_t iEventID,int32_t iActor,int32_t iPlayer,int32_t lDis
static inline int32_t VM_HaveEvent(int32_t iEventID) static inline int32_t VM_HaveEvent(int32_t iEventID)
{ {
#ifdef LUNATIC #ifdef LUNATIC
return L_IsInitialized(&g_ElState) && El_HaveEvent(iEventID) return L_IsInitialized(&g_ElState) && El_HaveEvent(iEventID);
#else #else
return apScriptGameEvent[iEventID]!=NULL; return apScriptGameEvent[iEventID]!=NULL;
#endif #endif

View file

@ -1039,6 +1039,7 @@ void Gv_ResetSystemDefaults(void)
#endif #endif
G_InitProjectileData(); G_InitProjectileData();
#ifndef LUNATIC
// hackhackhackhackhack // hackhackhackhackhack
i = hash_find(&h_arrays, "tilesizx"); i = hash_find(&h_arrays, "tilesizx");
if (i >= 0) if (i >= 0)
@ -1057,6 +1058,7 @@ void Gv_ResetSystemDefaults(void)
for (; j<MAXTILES; j++) for (; j<MAXTILES; j++)
aGameArrays[i].plValues[j] = tilesiz[j].y; aGameArrays[i].plValues[j] = tilesiz[j].y;
} }
#endif
//AddLog("EOF:ResetWeaponDefaults"); //AddLog("EOF:ResetWeaponDefaults");
} }

View file

@ -215,7 +215,7 @@ bcarray.new("int16_t", ffiC.GET_MAX, "inventory", "int16_x_GET_MAX", INV_NAMES)
local DUKEPLAYER_STRUCT = [[ local DUKEPLAYER_STRUCT = [[
__attribute__((packed)) struct { __attribute__((packed)) struct {
vec3_t pos, opos, vel, npos; vec3_t pos, opos, vel, npos;
int32_t bobposx, bobposy; vec2_t bobpos, fric;
int32_t truefz, truecz, player_par; int32_t truefz, truecz, player_par;
int32_t randomflamex, exitx, exity; int32_t randomflamex, exitx, exity;
int32_t runspeed, max_player_health, max_shield_amount; int32_t runspeed, max_player_health, max_shield_amount;
@ -420,9 +420,8 @@ typedef struct { int32_t _p; } weaponaccess_t;
typedef struct { typedef struct {
]]..defs_c.bitint_member("UBit32", "bits")..[[ ]]..defs_c.bitint_member("UBit32", "bits")..[[
int16_t fvel, svel; // 4b int16_t fvel, svel, avel;
int8_t avel, horz; // 2b int8_t horz, extbits;
int8_t extbits, filler; // 2b
} input_t; } input_t;
typedef typedef
@ -701,9 +700,6 @@ void G_DrawTXDigiNumZ(int32_t starttile, int32_t x,int32_t y,int32_t n,int32_t s
int32_t G_PrintGameText(int32_t f, int32_t tile, int32_t x, int32_t y, const char *t, int32_t G_PrintGameText(int32_t f, int32_t tile, int32_t x, int32_t y, const char *t,
int32_t s, int32_t p, int32_t o, int32_t s, int32_t p, int32_t o,
int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t z); int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t z);
typedef struct {
int32_t x, y;
} vec2_t;
vec2_t G_ScreenText(const int32_t font, vec2_t G_ScreenText(const int32_t font,
int32_t x, int32_t y, const int32_t z, const int32_t blockangle, const int32_t charangle, int32_t x, int32_t y, const int32_t z, const int32_t blockangle, const int32_t charangle,
const char *str, const int32_t shade, int32_t pal, int32_t o, int32_t alpha, const char *str, const int32_t shade, int32_t pal, int32_t o, int32_t alpha,

View file

@ -258,6 +258,10 @@ typedef $ walltype;
typedef $ spritetype; typedef $ spritetype;
typedef struct { spritetype; } tspritetype; typedef struct { spritetype; } tspritetype;
typedef struct {
int32_t x, y;
} vec2_t;
typedef struct { typedef struct {
int32_t x, y, z; int32_t x, y, z;
} vec3_t; } vec3_t;

View file

@ -96,7 +96,7 @@ getticks;
gethiticks; gethiticks;
OSD_Printf; OSD_Printf;
crc32once; Bcrc32;
luaJIT_BC_defs_common; luaJIT_BC_defs_common;
luaJIT_BC_engine_maptext; luaJIT_BC_engine_maptext;

View file

@ -92,7 +92,7 @@ getticks;
gethiticks; gethiticks;
OSD_Printf; OSD_Printf;
crc32once; Bcrc32;
luaJIT_BC_defs_m32; luaJIT_BC_defs_m32;
luaJIT_BC_defs_common; luaJIT_BC_defs_common;

View file

@ -4,7 +4,8 @@
#define EDUKE32_LUNATIC_H_ #define EDUKE32_LUNATIC_H_
#include "lunatic.h" #include "lunatic.h"
#include "gameexec.h" // MAXEVENTS #include "events_defs.h" // MAXEVENTS
#include "actors.h" // con_move_t, con_action_t
extern L_State g_ElState; extern L_State g_ElState;

View file

@ -28,13 +28,13 @@ decl[[
uint32_t rand_jkiss_u32(rng_jkiss_t *s); uint32_t rand_jkiss_u32(rng_jkiss_t *s);
double rand_jkiss_dbl(rng_jkiss_t *s); double rand_jkiss_dbl(rng_jkiss_t *s);
uint32_t crc32once(uint8_t *blk, uint32_t len); uint32_t Bcrc32(const void* data, size_t length, uint32_t crc);
]] ]]
local function get_rand_u32(tin) local function get_rand_u32(tin)
tin.d[0] = ffiC.gethiticks() % 1 tin.d[0] = ffiC.gethiticks() % 1
tin.d[1] = ffiC.gethiticks() % 1 tin.d[1] = ffiC.gethiticks() % 1
return ffiC.crc32once(tin.u, 16) return ffiC.Bcrc32(tin.u, 16, 0)
end end
local mt = { local mt = {