Lunatic: update DukePlayer_t, fix build.

git-svn-id: https://svn.eduke32.com/eduke32@2854 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-08-02 10:52:17 +00:00
parent f1ffd6d90a
commit defe79216d
2 changed files with 45 additions and 38 deletions

View file

@ -23,6 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef __actors_h__ #ifndef __actors_h__
#define __actors_h__ #define __actors_h__
#include "player.h"
#define MAXSLEEPDIST 16384 #define MAXSLEEPDIST 16384
#define SLEEPTIME 1536 #define SLEEPTIME 1536
#define ZOFFSET (1<<8) #define ZOFFSET (1<<8)

View file

@ -302,6 +302,7 @@ typedef struct {
int16_t orotscrnang, rotscrnang, dead_flag; // JBF 20031220: added orotscrnang int16_t orotscrnang, rotscrnang, dead_flag; // JBF 20031220: added orotscrnang
int16_t holoduke_on, pycount; int16_t holoduke_on, pycount;
int16_t transporter_hold;
uint8_t max_secret_rooms, secret_rooms; uint8_t max_secret_rooms, secret_rooms;
uint8_t frag, fraggedself, quick_kick, last_quick_kick; uint8_t frag, fraggedself, quick_kick, last_quick_kick;
@ -322,7 +323,7 @@ typedef struct {
uint8_t toggle_key_flag, knuckle_incs, knee_incs, access_incs; uint8_t toggle_key_flag, knuckle_incs, knee_incs, access_incs;
uint8_t walking_snd_toggle, palookup, hard_landing, fist_incs; uint8_t walking_snd_toggle, palookup, hard_landing, fist_incs;
int8_t numloogs, loogcnt, scream_voice, transporter_hold; int8_t numloogs, loogcnt, scream_voice;
int8_t last_weapon, cheat_phase, weapon_pos, wantweaponfire, curr_weapon; int8_t last_weapon, cheat_phase, weapon_pos, wantweaponfire, curr_weapon;
palette_t pals; palette_t pals;
@ -330,6 +331,8 @@ typedef struct {
..repeat_n_elts("char", "_n", 32).. ..repeat_n_elts("char", "_n", 32)..
[[ [[
// char name[32]; // char name[32];
int8_t padding_;
} DukePlayer_t; } DukePlayer_t;
typedef struct { typedef struct {
@ -514,6 +517,12 @@ end
local string = string local string = string
local table = table local table = table
-- http://lua-users.org/wiki/SandBoxes says "potentially unsafe"
-- as it allows to see implementations of functions.
local string_dump = string.dump
string.dump = nil
local allowed_modules = { local allowed_modules = {
coroutine=coroutine, bit=bit, table=table, math=math, string=string, coroutine=coroutine, bit=bit, table=table, math=math, string=string,
} }
@ -548,25 +557,6 @@ end
local ERRLEV = 5 local ERRLEV = 5
-- The "require" function accessible to Lunatic code.
-- Base modules in allowed_modules are wrapped so that they cannot be
-- modified, user modules are searched in the EDuke32 search
-- path. Also, our require never messes with the global environment,
-- it only returns the module.
local function our_require(modname)
check_valid_modname(modname)
-- see whether it's a base module name first
if (allowed_modules[modname] ~= nil) then
return allowed_modules[modname]
end
--- search user modules
if (package_loaded[modname] ~= nil) then
-- already loaded
return package_loaded[modname]
end
local function readintostr(fn) local function readintostr(fn)
-- XXX: this is pretty much the same as the code in El_RunOnce() -- XXX: this is pretty much the same as the code in El_RunOnce()
@ -599,7 +589,27 @@ local function our_require(modname)
return ffi.string(str, sz) return ffi.string(str, sz)
end end
-- TODO: better pattern-matching (permit "", .lua, .elua ?) -- The "require" function accessible to Lunatic code.
-- Base modules in allowed_modules are wrapped so that they cannot be
-- modified, user modules are searched in the EDuke32 search
-- path. Also, our require never messes with the global environment,
-- it only returns the module.
local function our_require(modname)
check_valid_modname(modname)
-- see whether it's a base module name first
if (allowed_modules[modname] ~= nil) then
return allowed_modules[modname]
end
--- search user modules
if (package_loaded[modname] ~= nil) then
-- already loaded
return package_loaded[modname]
end
-- TODO: better pattern-matching (permit "", ".lua", ".elua" ?)
local str = readintostr(modname .. ".lua") local str = readintostr(modname .. ".lua")
local modfunc, errmsg = loadstring(str) local modfunc, errmsg = loadstring(str)
@ -722,11 +732,6 @@ G_.type = type
G_._G = G_ G_._G = G_
-- http://lua-users.org/wiki/SandBoxes says "potentially unsafe"
-- as it allows to see implementations of functions.
local string_dump = string.dump
string.dump = nil
--- non-default data and functions --- non-default data and functions
G_._EDUKE32_LUNATIC = _EDUKE32_LUNATIC G_._EDUKE32_LUNATIC = _EDUKE32_LUNATIC
G_.gameevent = gameevent -- included in lunatic.c G_.gameevent = gameevent -- included in lunatic.c