LunaCON: ifsquished.

git-svn-id: https://svn.eduke32.com/eduke32@3640 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-04-05 17:52:59 +00:00
parent 1e21ea3aae
commit 512b9286fe
6 changed files with 33 additions and 8 deletions

View file

@ -119,7 +119,6 @@ static void VM_KillIt(int32_t iActor, int32_t iPlayer)
int32_t VM_OnEvent(int32_t iEventID, int32_t iActor, int32_t iPlayer, int32_t lDist, int32_t iReturn)
{
#ifdef LUNATIC
int32_t killit;
const double t = gethitickms();
// TODO: handling of RETURN gamevar / iReturn / this function's return value
@ -170,7 +169,7 @@ int32_t VM_OnEvent(int32_t iEventID, int32_t iActor, int32_t iPlayer, int32_t lD
static inline int32_t VM_CheckSquished(void)
{
sectortype *sc = &sector[vm.g_sp->sectnum];
const sectortype *sc = &sector[vm.g_sp->sectnum];
if ((vm.g_sp->picnum == APLAYER && ud.noclip) || sc->lotag == ST_23_SWINGING_DOOR)
return 0;
@ -182,7 +181,7 @@ static inline int32_t VM_CheckSquished(void)
yax_getbunches(vm.g_sp->sectnum, &cb, &fb);
if (cb >= 0 && (sc->ceilingstat&512)==0) // if ceiling non-blocking...
cz -= (32<<8); // don't squish unconditionally... yax_getneighborsect is slowish :/
cz -= (32<<8); // unconditionally don't squish... yax_getneighborsect is slowish :/
if (fb >= 0 && (sc->floorstat&512)==0)
fz += (32<<8);
#endif
@ -195,7 +194,8 @@ static inline int32_t VM_CheckSquished(void)
P_DoQuote(QUOTE_SQUISHED, g_player[vm.g_p].ps);
if (A_CheckEnemySprite(vm.g_sp)) vm.g_sp->xvel = 0;
if (A_CheckEnemySprite(vm.g_sp))
vm.g_sp->xvel = 0;
if (vm.g_sp->pal == 1) // frozen
{
@ -5568,4 +5568,13 @@ int32_t VM_ResetPlayer2(int32_t snum)
{
return VM_ResetPlayer(snum, 0);
}
int32_t VM_CheckSquished2(int32_t i, int32_t snum)
{
vm.g_i = i;
vm.g_sp = &sprite[i];
vm.g_p = snum;
return VM_CheckSquished();
}
#endif

View file

@ -1431,6 +1431,14 @@ function _ifp(flags, pli, aci)
return false
end
function _squished(aci, pli)
check_sprite_idx(aci)
check_player_idx(pli)
check_sector_idx(sprite[aci].sectnum)
return (ffiC.VM_CheckSquished2(aci, pli)~=0)
end
function _checkspace(sectnum, floorp)
local sect = sector[sectnum]
local picnum = floorp and sect.floorpicnum or sect.ceilingpicnum

View file

@ -578,6 +578,7 @@ void G_InitTimer(int32_t ticspersec);
void G_GetTimeDate(int32_t *vals);
int32_t G_ToggleWallInterpolation(int32_t w, int32_t doset);
int32_t G_StartTrack(int32_t level);
int32_t VM_CheckSquished2(int32_t i, int32_t snum);
const char *KB_ScanCodeToString(uint8_t scancode);

View file

@ -169,6 +169,7 @@ G_InitTimer;
G_GetTimeDate;
G_ToggleWallInterpolation;
G_StartTrack;
VM_CheckSquished2;
KB_ScanCodeToString;

View file

@ -772,7 +772,8 @@ local function do_include_file(dirname, filename)
if (fd==nil and g_defaultDir) then
-- strip up to and including last slash (if any):
filename = filename:gsub("^.*/", "")
fd, msg = io.open(g_defaultDir.."/"..filename)
dirname = g_defaultDir.."/"
fd, msg = io.open(dirname..filename)
end
if (fd == nil) then
@ -795,8 +796,6 @@ local function do_include_file(dirname, filename)
return
end
-- XXX: File name that's displayed here may not be the actual opened one
-- (esp. for stand-alone version).
printf("%s[%d] Translating file \"%s\"", (g_recurslevel==-1 and "\n---- ") or "",
g_recurslevel+1, dirname..filename);
@ -2437,7 +2436,7 @@ local Cif = {
ifp = (sp1 * tok.define)^1
/ function (...) return format("_con._ifp(%d,_pli,_aci)", bit.bor(...)) end,
ifsquished = cmd()
/ "false", -- TODO
/ "_con._squished(_aci,_pli)",
ifserver = cmd()
/ "false", -- TODO_MP
ifrespawn = cmd()

View file

@ -424,6 +424,13 @@ gameevent("DISPLAYREST", function()
end
end)
-- APLAYER
gameactor(1405, actor.FLAGS.chain_beg, function(aci, pli)
if (con._squished(aci, pli)) then
printf("Squished LunaCON test")
end
end)
local CS = sprite.CSTAT
gameevent("ANIMATESPRITES",