mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
Lunatic: begin fixing up the code because it's now actually live!
git-svn-id: https://svn.eduke32.com/eduke32@3519 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
f730e1242a
commit
b1320d0ab5
3 changed files with 31 additions and 19 deletions
|
@ -342,13 +342,15 @@ local abs = math.abs
|
|||
local dist, ldist = xmath.dist, xmath.ldist
|
||||
|
||||
local function A_FP_ManhattanDist(ps, spr)
|
||||
return (ps.pos - spr^(28*256)):blen1()
|
||||
local distvec = (geom.tovec3(ps.pos) - spr^(28*256))
|
||||
-- XXX
|
||||
return geom.ivec3(distvec.x, distvec.y, distvec.z):blen1()
|
||||
end
|
||||
|
||||
-- Returns: player index, distance
|
||||
-- TODO: MP case
|
||||
function _findplayer(ps, spritenum)
|
||||
return 0, A_FP_ManhattanDist(ps, sprite[spritenum])
|
||||
function _findplayer(pli, spritenum)
|
||||
return 0, A_FP_ManhattanDist(player[pli], sprite[spritenum])
|
||||
end
|
||||
|
||||
local FN_STATNUMS = {
|
||||
|
@ -380,7 +382,7 @@ function _findnear(spritenum, allspritesp, distkind, picnum, maxdist, maxzdist)
|
|||
local distfunc = FN_DISTFUNC[distkind]
|
||||
local spr = sprite[spritenum]
|
||||
|
||||
for st=1,#statnums do
|
||||
for _,st in ipairs(statnums) do
|
||||
for i in spritesofstat(st) do
|
||||
if (i ~= spritenum and sprite[i].picnum==picnum) then
|
||||
if (distfunc(spr, sprite[i], maxdist, maxzdist)) then
|
||||
|
@ -1738,7 +1740,7 @@ local peractorvar_mt = {
|
|||
|
||||
__newindex = function(acv, idx, val)
|
||||
check_sprite_idx(idx)
|
||||
acv[idx] = val
|
||||
rawset(acv, idx, val)
|
||||
end,
|
||||
|
||||
-- Calling a per-actor variable causes its cleanup:
|
||||
|
@ -1747,7 +1749,7 @@ local peractorvar_mt = {
|
|||
__call = function(acv)
|
||||
for i=0,ffiC.MAXSPRITES-1 do
|
||||
if (ffiC.sprite[i].statnum == ffiC.MAXSTATUS or acv[i]==acv._defval) then
|
||||
acv[i] = nil
|
||||
rawset(acv, i, nil)
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
|
|
@ -520,23 +520,26 @@ const int32_t g_currentMenu;
|
|||
uint16_t g_earthquakeTime;
|
||||
char CheatKeys[2];
|
||||
|
||||
// Functions marked with 'EVENT' may call events.
|
||||
// http://www.freelists.org/post/luajit/intermitten-lua-pcall-crash-on-x86-64-linux,1
|
||||
|
||||
int32_t A_IncurDamage(int32_t sn); // not bound-checked!
|
||||
void P_AddWeaponMaybeSwitch(DukePlayer_t *ps, int32_t weap);
|
||||
void P_CheckWeapon(DukePlayer_t *p);
|
||||
int32_t A_ShootWithZvel(int32_t i, int32_t atwith, int32_t override_zvel);
|
||||
int32_t A_IncurDamage(int32_t sn);
|
||||
int32_t A_Spawn(int32_t j, int32_t pn);
|
||||
void VM_FallSprite(int32_t i);
|
||||
int32_t VM_ResetPlayer2(int32_t snum);
|
||||
void A_RadiusDamage(int32_t i, int32_t r, int32_t, int32_t, int32_t, int32_t);
|
||||
void G_OperateSectors(int32_t sn, int32_t ii);
|
||||
void G_OperateActivators(int32_t low,int32_t snum);
|
||||
void P_AddWeaponMaybeSwitch(DukePlayer_t *ps, int32_t weap); // EVENT
|
||||
void P_CheckWeapon(DukePlayer_t *p); // EVENT
|
||||
int32_t A_ShootWithZvel(int32_t i, int32_t atwith, int32_t override_zvel); // EVENT
|
||||
int32_t A_Spawn(int32_t j, int32_t pn); // EVENT
|
||||
void VM_FallSprite(int32_t i); // EVENT
|
||||
int32_t VM_ResetPlayer2(int32_t snum); // EVENT
|
||||
void A_RadiusDamage(int32_t i, int32_t r, int32_t, int32_t, int32_t, int32_t); // EVENT
|
||||
void G_OperateSectors(int32_t sn, int32_t ii); // EVENT
|
||||
void G_OperateActivators(int32_t low,int32_t snum); // EVENT
|
||||
int32_t G_CheckActivatorMotion(int32_t lotag);
|
||||
int32_t A_Dodge(spritetype *s);
|
||||
// EVENT:
|
||||
int32_t A_InsertSprite(int32_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int32_t s_pn,int32_t s_s,
|
||||
int32_t s_xr,int32_t s_yr,int32_t s_a,int32_t s_ve,int32_t s_zv,int32_t s_ow,int32_t s_ss);
|
||||
int32_t A_Spawn(int32_t j, int32_t pn);
|
||||
void A_AddToDeleteQueue(int32_t i);
|
||||
int32_t A_Spawn(int32_t j, int32_t pn); // EVENT
|
||||
void A_AddToDeleteQueue(int32_t i); // EVENT
|
||||
int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype);
|
||||
void P_DoQuote(int32_t q, DukePlayer_t *p);
|
||||
void G_AddUserQuote(const char *daquote);
|
||||
|
@ -551,7 +554,7 @@ int32_t G_StartTrack(int32_t level);
|
|||
const char *KB_ScanCodeToString(uint8_t scancode);
|
||||
|
||||
int32_t A_CheckAnySoundPlaying(int32_t i);
|
||||
int32_t A_PlaySound(uint32_t num, int32_t i);
|
||||
int32_t A_PlaySound(uint32_t num, int32_t i); // EVENT
|
||||
int32_t S_CheckSoundPlaying(int32_t i, int32_t num);
|
||||
void S_StopEnvSound(int32_t num, int32_t i);
|
||||
int32_t FX_StopAllSounds(void);
|
||||
|
|
|
@ -7,8 +7,15 @@
|
|||
local ffi = require("ffi")
|
||||
local ffiC = ffi.C
|
||||
|
||||
-- Lunatic debugging:
|
||||
-- 1: pront diagnostic information
|
||||
-- 2: also disable JIT compilation
|
||||
ffi.cdef "enum { _DEBUG_LUNATIC=1 }"
|
||||
|
||||
if (ffiC._DEBUG_LUNATIC >= 2) then
|
||||
require("jit").off()
|
||||
end
|
||||
|
||||
local bit = require("bit")
|
||||
local math = require("math")
|
||||
local string = require("string")
|
||||
|
|
Loading…
Reference in a new issue