mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-14 08:30:58 +00:00
LunaCON: implement dragpoint, clipmove*; fix gamearray serialization.
git-svn-id: https://svn.eduke32.com/eduke32@3812 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
d0f538b283
commit
6f94af7399
5 changed files with 46 additions and 7 deletions
|
@ -39,6 +39,7 @@ local cansee, hitscan, neartag = dc.cansee, dc.hitscan, dc.neartag
|
||||||
local inside = dc.inside
|
local inside = dc.inside
|
||||||
|
|
||||||
local sector, wall, sprite = dc.sector, dc.wall, dc.sprite
|
local sector, wall, sprite = dc.sector, dc.wall, dc.sprite
|
||||||
|
local wallsofsect = dc.wallsofsect
|
||||||
local spritesofsect, spritesofstat = dc.spritesofsect, dc.spritesofstat
|
local spritesofsect, spritesofstat = dc.spritesofsect, dc.spritesofstat
|
||||||
|
|
||||||
local OUR_NAME = "_con"
|
local OUR_NAME = "_con"
|
||||||
|
@ -1284,6 +1285,16 @@ function _getzrange(x, y, z, sectnum, walldist, clipmask)
|
||||||
hit.f.z, hit.f.num + (hit.f.spritep and 49152 or 16384)
|
hit.f.z, hit.f.num + (hit.f.spritep and 49152 or 16384)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- CON "clipmove" and "clipmovenoslide" commands
|
||||||
|
function _clipmovex(x, y, z, sectnum, xv, yv, wd, cd, fd, clipmask, noslidep)
|
||||||
|
check_sector_idx(sectnum)
|
||||||
|
local ipos = geom.ivec3(x, y, z)
|
||||||
|
local sect = ffi.new("int16_t [1]")
|
||||||
|
local ret = ffiC.clipmovex(ipos, sect, xv, yv, wd, cd, fd, clipmask, noslidep)
|
||||||
|
-- Return: clipmovex() return value; updated x, y, sectnum
|
||||||
|
return ret, ipos.x, ipos.y, sect[0]
|
||||||
|
end
|
||||||
|
|
||||||
function _sleepcheck(aci, dist)
|
function _sleepcheck(aci, dist)
|
||||||
local acs = actor[aci]
|
local acs = actor[aci]
|
||||||
if (dist > MAXSLEEPDIST and acs.timetosleep == 0) then
|
if (dist > MAXSLEEPDIST and acs.timetosleep == 0) then
|
||||||
|
@ -1960,7 +1971,7 @@ local gamearray_methods = {
|
||||||
end,
|
end,
|
||||||
|
|
||||||
_serialize = function(gar)
|
_serialize = function(gar)
|
||||||
local strtab = { OUR_NAME..".actorvar(", tostring(gar._size), ",{" }
|
local strtab = { OUR_NAME.."._gamearray(", tostring(gar._size), ",{" }
|
||||||
gar:_cleanup()
|
gar:_cleanup()
|
||||||
return serialize_array(gar, strtab, gar._size)
|
return serialize_array(gar, strtab, gar._size)
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -408,9 +408,13 @@ int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1,
|
||||||
void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, int16_t *neartagsector, int16_t *neartagwall,
|
void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, int16_t *neartagsector, int16_t *neartagwall,
|
||||||
int16_t *neartagsprite, int32_t *neartaghitdist, int32_t neartagrange, uint8_t tagsearch,
|
int16_t *neartagsprite, int32_t *neartaghitdist, int32_t neartagrange, uint8_t tagsearch,
|
||||||
int32_t (*blacklist_sprite_func)(int32_t));
|
int32_t (*blacklist_sprite_func)(int32_t));
|
||||||
|
void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day, uint8_t flags);
|
||||||
void getzrange(const vec3_t *pos, int16_t sectnum,
|
void getzrange(const vec3_t *pos, int16_t sectnum,
|
||||||
int32_t *ceilz, int32_t *ceilhit, int32_t *florz, int32_t *florhit,
|
int32_t *ceilz, int32_t *ceilhit, int32_t *florz, int32_t *florhit,
|
||||||
int32_t walldist, uint32_t cliptype);
|
int32_t walldist, uint32_t cliptype);
|
||||||
|
int32_t clipmovex(vec3_t *pos, int16_t *sectnum, int32_t xvect, int32_t yvect,
|
||||||
|
int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype,
|
||||||
|
uint8_t noslidep);
|
||||||
|
|
||||||
int32_t ldist(const spritetype *s1, const spritetype *s2);
|
int32_t ldist(const spritetype *s1, const spritetype *s2);
|
||||||
int32_t dist(const spritetype *s1, const spritetype *s2);
|
int32_t dist(const spritetype *s1, const spritetype *s2);
|
||||||
|
@ -440,6 +444,7 @@ int32_t Mulscale(int32_t a, int32_t b, int32_t sh);
|
||||||
|
|
||||||
local bcheck = require("bcheck")
|
local bcheck = require("bcheck")
|
||||||
local check_sector_idx = bcheck.sector_idx
|
local check_sector_idx = bcheck.sector_idx
|
||||||
|
local check_wall_idx = bcheck.wall_idx
|
||||||
local check_sprite_idx = bcheck.sprite_idx
|
local check_sprite_idx = bcheck.sprite_idx
|
||||||
local check_tile_idx = bcheck.tile_idx
|
local check_tile_idx = bcheck.tile_idx
|
||||||
|
|
||||||
|
@ -544,7 +549,7 @@ local walltype_mt = {
|
||||||
-- NOTE: Allow setting a wall to white too, but no checking of the
|
-- NOTE: Allow setting a wall to white too, but no checking of the
|
||||||
-- consistency invariant ".nextwall>=0 iff .nextsector>=0".
|
-- consistency invariant ".nextwall>=0 iff .nextsector>=0".
|
||||||
if (not (nextwall < 0)) then
|
if (not (nextwall < 0)) then
|
||||||
bcheck.wall_idx(nextwall)
|
check_wall_idx(nextwall)
|
||||||
end
|
end
|
||||||
ffi.cast(walltype_ptr_ct, w).nextwall = nextwall
|
ffi.cast(walltype_ptr_ct, w).nextwall = nextwall
|
||||||
end,
|
end,
|
||||||
|
@ -793,6 +798,13 @@ sms._nextspritestat = creategtab(ffiC.nextspritestat, ffiC.MAXSPRITES, 'nextspri
|
||||||
sms._prevspritesect = creategtab(ffiC.prevspritesect, ffiC.MAXSPRITES, 'prevspritesect[]')
|
sms._prevspritesect = creategtab(ffiC.prevspritesect, ffiC.MAXSPRITES, 'prevspritesect[]')
|
||||||
sms._prevspritestat = creategtab(ffiC.prevspritestat, ffiC.MAXSPRITES, 'prevspritestat[]')
|
sms._prevspritestat = creategtab(ffiC.prevspritestat, ffiC.MAXSPRITES, 'prevspritestat[]')
|
||||||
|
|
||||||
|
function static_members.wall.dragto(wallnum, pos)
|
||||||
|
check_wall_idx(wallnum)
|
||||||
|
|
||||||
|
-- TODO: some kind of validation of the position?
|
||||||
|
ffiC.dragpoint(wallnum, pos.x, pos.y, 0)
|
||||||
|
end
|
||||||
|
|
||||||
function static_members.sprite.changesect(spritenum, sectnum, noerr)
|
function static_members.sprite.changesect(spritenum, sectnum, noerr)
|
||||||
check_sprite_idx(spritenum)
|
check_sprite_idx(spritenum)
|
||||||
check_sector_idx(sectnum)
|
check_sector_idx(sectnum)
|
||||||
|
|
|
@ -59,8 +59,10 @@ getangle;
|
||||||
Mulscale;
|
Mulscale;
|
||||||
cansee;
|
cansee;
|
||||||
hitscan;
|
hitscan;
|
||||||
|
dragpoint;
|
||||||
neartag;
|
neartag;
|
||||||
getzrange;
|
getzrange;
|
||||||
|
clipmovex;
|
||||||
rotatesprite_;
|
rotatesprite_;
|
||||||
setaspect;
|
setaspect;
|
||||||
|
|
||||||
|
|
|
@ -59,8 +59,10 @@ getangle;
|
||||||
Mulscale;
|
Mulscale;
|
||||||
cansee;
|
cansee;
|
||||||
hitscan;
|
hitscan;
|
||||||
|
dragpoint;
|
||||||
neartag;
|
neartag;
|
||||||
getzrange;
|
getzrange;
|
||||||
|
clipmovex;
|
||||||
rotatesprite_;
|
rotatesprite_;
|
||||||
setaspect;
|
setaspect;
|
||||||
|
|
||||||
|
|
|
@ -1743,6 +1743,18 @@ local handle =
|
||||||
unpack(vals))
|
unpack(vals))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
clipmove = function(noslidep, ...)
|
||||||
|
local v = {...}
|
||||||
|
assert(#v == 11) -- 3W 1R 1W 6R
|
||||||
|
local vals = {
|
||||||
|
v[1], v[2], v[3], v[5], -- outargs
|
||||||
|
v[2], v[3], v[4], v[5], v[6], v[7], v[8], v[9], v[10], v[11], -- inargs
|
||||||
|
noslidep
|
||||||
|
}
|
||||||
|
return format("%s,%s,%s,%s=_con._clipmovex("..n_s_fmt(11)..")",
|
||||||
|
unpack(vals))
|
||||||
|
end,
|
||||||
|
|
||||||
palfrom = function(...)
|
palfrom = function(...)
|
||||||
local v = {...}
|
local v = {...}
|
||||||
return format(PLS":_palfrom(%d,%d,%d,%d)",
|
return format(PLS":_palfrom(%d,%d,%d,%d)",
|
||||||
|
@ -2228,17 +2240,17 @@ local Cinner = {
|
||||||
ldist = cmd(W,R,R)
|
ldist = cmd(W,R,R)
|
||||||
/ "%1=_xmath.ldist(sprite[%2],sprite[%3])",
|
/ "%1=_xmath.ldist(sprite[%2],sprite[%3])",
|
||||||
dragpoint = cmd(R,R,R)
|
dragpoint = cmd(R,R,R)
|
||||||
/ handle.NYI,
|
/ "wall.dragto(%1,_IV(1,%2,%3,0))",
|
||||||
rotatepoint = cmd(R,R,R,R,R,W,W)
|
rotatepoint = cmd(R,R,R,R,R,W,W)
|
||||||
/ "%6,%7=_con._rotatepoint(%1,%2,%3,%4,%5)",
|
/ "%6,%7=_con._rotatepoint(%1,%2,%3,%4,%5)",
|
||||||
|
|
||||||
-- collision detection etc.
|
-- collision detection etc.
|
||||||
hitscan = cmd(R,R,R,R,R,R,R,W,W,W,W,W,W,R) -- 7R 6W 1R
|
hitscan = cmd(R,R,R,R,R,R,R,W,W,W,W,W,W,R) -- 7R 6W 1R
|
||||||
/ handle.hitscan,
|
/ handle.hitscan,
|
||||||
clipmove = cmd(W,W,W,R,W,R,R,R,R,R,R)
|
clipmove = cmd(W,W,W,R,W,R,R,R,R,R,R) -- 3W 1R 1W 6R
|
||||||
/ handle.NYI,
|
/ function(...) return handle.clipmove(0, ...) end,
|
||||||
clipmovenoslide = cmd(W,W,W,R,W,R,R,R,R,R,R)
|
clipmovenoslide = cmd(W,W,W,R,W,R,R,R,R,R,R) -- 3W 1R 1W 6R
|
||||||
/ handle.NYI,
|
/ function(...) return handle.clipmove(1, ...) end,
|
||||||
lineintersect = cmd(R,R,R,R,R,R,R,R,R,R,W,W,W,W) -- 10R 4W
|
lineintersect = cmd(R,R,R,R,R,R,R,R,R,R,W,W,W,W) -- 10R 4W
|
||||||
/ handle.NYI,
|
/ handle.NYI,
|
||||||
rayintersect = cmd(R,R,R,R,R,R,R,R,R,R,W,W,W,W) -- 10R 4W
|
rayintersect = cmd(R,R,R,R,R,R,R,R,R,R,W,W,W,W) -- 10R 4W
|
||||||
|
|
Loading…
Reference in a new issue