mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
Lunatic: add actor.move() static function and documentation stub.
git-svn-id: https://svn.eduke32.com/eduke32@4590 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
32e1e362c9
commit
40c2fc7d07
8 changed files with 49 additions and 19 deletions
|
@ -409,7 +409,7 @@ static int32_t A_CheckNeedZUpdate(int32_t spritenum, int32_t changez, int32_t *d
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype)
|
int32_t A_MoveSpriteClipdist(int32_t spritenum, const vec3_t *change, uint32_t cliptype, int32_t clipdist)
|
||||||
{
|
{
|
||||||
spritetype *const spr = &sprite[spritenum];
|
spritetype *const spr = &sprite[spritenum];
|
||||||
int32_t retval, daz, dozupdate;
|
int32_t retval, daz, dozupdate;
|
||||||
|
@ -435,9 +435,12 @@ int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype)
|
||||||
|
|
||||||
{
|
{
|
||||||
const int32_t oldz=spr->z;
|
const int32_t oldz=spr->z;
|
||||||
int32_t clipdist;
|
|
||||||
|
|
||||||
if (bg)
|
if (clipdist >= 0)
|
||||||
|
{
|
||||||
|
// use that value
|
||||||
|
}
|
||||||
|
else if (bg)
|
||||||
{
|
{
|
||||||
if (spr->xrepeat > 60)
|
if (spr->xrepeat > 60)
|
||||||
clipdist = 1024;
|
clipdist = 1024;
|
||||||
|
|
|
@ -314,7 +314,6 @@ void A_DoGutsDir(int32_t sp,int32_t gtype,int32_t n);
|
||||||
int32_t A_IncurDamage(int32_t sn);
|
int32_t A_IncurDamage(int32_t sn);
|
||||||
void A_MoveCyclers(void);
|
void A_MoveCyclers(void);
|
||||||
void A_MoveDummyPlayers(void);
|
void A_MoveDummyPlayers(void);
|
||||||
int32_t A_MoveSprite(int32_t spritenum,const vec3_t *change,uint32_t cliptype);
|
|
||||||
void A_PlayAlertSound(int32_t i);
|
void A_PlayAlertSound(int32_t i);
|
||||||
void A_RadiusDamage(int32_t i,int32_t r,int32_t hp1,int32_t hp2,int32_t hp3,int32_t hp4);
|
void A_RadiusDamage(int32_t i,int32_t r,int32_t hp1,int32_t hp2,int32_t hp3,int32_t hp4);
|
||||||
void A_SpawnMultiple(int32_t sp,int32_t pic,int32_t n);
|
void A_SpawnMultiple(int32_t sp,int32_t pic,int32_t n);
|
||||||
|
|
|
@ -38,6 +38,10 @@ ACTOR_INLINE int32_t A_SetSprite(int32_t i,uint32_t cliptype)
|
||||||
return (A_MoveSprite(i,&davect,cliptype)==0);
|
return (A_MoveSprite(i,&davect,cliptype)==0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ACTOR_INLINE int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype)
|
||||||
|
{
|
||||||
|
return A_MoveSpriteClipdist(spritenum, change, cliptype, -1);
|
||||||
|
}
|
||||||
|
|
||||||
EXTERN_INLINE void G_UpdateInterpolations(void) //Stick at beginning of G_DoMoveThings
|
EXTERN_INLINE void G_UpdateInterpolations(void) //Stick at beginning of G_DoMoveThings
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,7 +31,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
# define ACTOR_INLINE_HEADER EXTERN_INLINE_HEADER
|
# define ACTOR_INLINE_HEADER EXTERN_INLINE_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern int32_t A_MoveSpriteClipdist(int32_t spritenum, const vec3_t *change, uint32_t cliptype, int32_t clipdist);
|
||||||
|
|
||||||
ACTOR_INLINE_HEADER int32_t A_SetSprite(int32_t i,uint32_t cliptype);
|
ACTOR_INLINE_HEADER int32_t A_SetSprite(int32_t i,uint32_t cliptype);
|
||||||
|
ACTOR_INLINE_HEADER int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype);
|
||||||
|
|
||||||
EXTERN_INLINE_HEADER void G_UpdateInterpolations(void);
|
EXTERN_INLINE_HEADER void G_UpdateInterpolations(void);
|
||||||
EXTERN_INLINE_HEADER void G_RestoreInterpolations(void);
|
EXTERN_INLINE_HEADER void G_RestoreInterpolations(void);
|
||||||
|
|
|
@ -1552,7 +1552,7 @@ end
|
||||||
function _movesprite(spritenum, x, y, z, cliptype)
|
function _movesprite(spritenum, x, y, z, cliptype)
|
||||||
check_sprite_idx(spritenum)
|
check_sprite_idx(spritenum)
|
||||||
local vel = ivec3(x, y, z)
|
local vel = ivec3(x, y, z)
|
||||||
return ffiC.A_MoveSprite(spritenum, vel, cliptype)
|
return ffiC.A_MoveSpriteClipdist(spritenum, vel, cliptype, -1)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Also known as A_SetSprite().
|
-- Also known as A_SetSprite().
|
||||||
|
@ -1563,7 +1563,7 @@ function _ssp(i, cliptype)
|
||||||
local ivec = vec:toivec3()
|
local ivec = vec:toivec3()
|
||||||
ivec.z = spr.zvel
|
ivec.z = spr.zvel
|
||||||
|
|
||||||
return (ffiC.A_MoveSprite(i, ivec, cliptype)==0)
|
return (ffiC.A_MoveSpriteClipdist(i, ivec, cliptype, -1)==0)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- CON's 'setsprite' function on top of the Lunatic-provided ones.
|
-- CON's 'setsprite' function on top of the Lunatic-provided ones.
|
||||||
|
|
|
@ -413,6 +413,7 @@ end
|
||||||
|
|
||||||
--- default defines etc.
|
--- default defines etc.
|
||||||
local con_lang = require("con_lang")
|
local con_lang = require("con_lang")
|
||||||
|
local xmath = require("xmath")
|
||||||
|
|
||||||
ffi.cdef([[
|
ffi.cdef([[
|
||||||
typedef struct { int32_t _p; } weaponaccess_t;
|
typedef struct { int32_t _p; } weaponaccess_t;
|
||||||
|
@ -672,7 +673,7 @@ char CheatKeys[2];
|
||||||
int32_t A_IncurDamage(int32_t sn); // not bound-checked!
|
int32_t A_IncurDamage(int32_t sn); // not bound-checked!
|
||||||
int32_t G_CheckActivatorMotion(int32_t lotag);
|
int32_t G_CheckActivatorMotion(int32_t lotag);
|
||||||
int32_t A_Dodge(spritetype *s);
|
int32_t A_Dodge(spritetype *s);
|
||||||
int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype);
|
int32_t A_MoveSpriteClipdist(int32_t spritenum, const vec3_t *change, uint32_t cliptype, int32_t clipdist);
|
||||||
void P_DoQuote(int32_t q, DukePlayer_t *p);
|
void P_DoQuote(int32_t q, DukePlayer_t *p);
|
||||||
void P_SetGamePalette(DukePlayer_t *player, uint8_t palid, int32_t set);
|
void P_SetGamePalette(DukePlayer_t *player, uint8_t palid, int32_t set);
|
||||||
void G_AddUserQuote(const char *daquote);
|
void G_AddUserQuote(const char *daquote);
|
||||||
|
@ -823,6 +824,7 @@ player_static_members._INPUT_EXT_BITS = defs_c.conststruct
|
||||||
|
|
||||||
local band = bit.band
|
local band = bit.band
|
||||||
local lsh = bit.lshift
|
local lsh = bit.lshift
|
||||||
|
local ivec3 = xmath.ivec3
|
||||||
|
|
||||||
do
|
do
|
||||||
-- player.all() iterator
|
-- player.all() iterator
|
||||||
|
@ -924,6 +926,13 @@ function actor_static_members.fall(i)
|
||||||
CF.VM_FallSprite(i)
|
CF.VM_FallSprite(i)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- actor.move(i, vec, cliptype [, clipdist])
|
||||||
|
function actor_static_members.move(i, vec, cliptype, clipdist)
|
||||||
|
check_sprite_idx(i)
|
||||||
|
local vel = ivec3(vec.x, vec.y, vec.z)
|
||||||
|
return ffiC.A_MoveSpriteClipdist(spritenum, vel, cliptype, clipdist or -1)
|
||||||
|
end
|
||||||
|
|
||||||
-- Delete sprite with index <i>.
|
-- Delete sprite with index <i>.
|
||||||
function actor_static_members.delete(i)
|
function actor_static_members.delete(i)
|
||||||
check_sprite_idx(i)
|
check_sprite_idx(i)
|
||||||
|
@ -969,15 +978,19 @@ local g_tile = setmtonce({}, defs_c.GenStructMetatable("g_tile", "MAXTILES", til
|
||||||
-- Among other things, declares struct action and struct move, and their
|
-- Among other things, declares struct action and struct move, and their
|
||||||
-- ID-wrapped types con_action_t and con_move_t
|
-- ID-wrapped types con_action_t and con_move_t
|
||||||
local con = require("control")
|
local con = require("control")
|
||||||
local isenemytile = con.isenemytile
|
|
||||||
|
|
||||||
-- Add game-side metamethods to "spritetype" and register it with "metatype"
|
do
|
||||||
local spr_mt_index_add = {
|
local isenemytile = con.isenemytile
|
||||||
isenemy = function(s)
|
|
||||||
return isenemytile(s.picnum)
|
-- Add game-side metamethods to "spritetype" and register it with "metatype"
|
||||||
end,
|
local spr_mt_index_add = {
|
||||||
}
|
isenemy = function(s)
|
||||||
defs_c.finish_spritetype(spr_mt_index_add)
|
return isenemytile(s.picnum)
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
defs_c.finish_spritetype(spr_mt_index_add)
|
||||||
|
end
|
||||||
|
|
||||||
-- Check a literal numeric action or move value.
|
-- Check a literal numeric action or move value.
|
||||||
local function check_literal_am(am, typename)
|
local function check_literal_am(am, typename)
|
||||||
|
@ -1600,7 +1613,7 @@ local allowed_modules = {
|
||||||
engine = require("engine"),
|
engine = require("engine"),
|
||||||
stat = require("stat"),
|
stat = require("stat"),
|
||||||
bitar = require("bitar"),
|
bitar = require("bitar"),
|
||||||
xmath = require("xmath"),
|
xmath = xmath,
|
||||||
fs = require("fs"),
|
fs = require("fs"),
|
||||||
|
|
||||||
con = con,
|
con = con,
|
||||||
|
@ -1623,8 +1636,8 @@ do
|
||||||
return type(v)=="cdata" and ctype_cansave[tonumber(ffi.typeof(v))]
|
return type(v)=="cdata" and ctype_cansave[tonumber(ffi.typeof(v))]
|
||||||
end
|
end
|
||||||
|
|
||||||
reg_serializable_cv(allowed_modules.xmath.vec3())
|
reg_serializable_cv(xmath.vec3())
|
||||||
reg_serializable_cv(allowed_modules.xmath.ivec3())
|
reg_serializable_cv(ivec3())
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Protect base modules.
|
-- Protect base modules.
|
||||||
|
|
|
@ -790,6 +790,8 @@ claiming them for oneself.
|
||||||
`wal:set_picnum(tilenum)`, `wal:set_overpicnum(tilenum)`::
|
`wal:set_picnum(tilenum)`, `wal:set_overpicnum(tilenum)`::
|
||||||
Set the tile number of the wall or its masked portion.
|
Set the tile number of the wall or its masked portion.
|
||||||
|
|
||||||
|
// TODO: the predicates
|
||||||
|
|
||||||
===== `wall` static functions
|
===== `wall` static functions
|
||||||
|
|
||||||
`wall.dragto(i, pos)`::
|
`wall.dragto(i, pos)`::
|
||||||
|
@ -947,6 +949,9 @@ _`index_of_spr`_ is the sprite index corresponding to `spr`. This method is
|
||||||
provided for convenience, but may be slower than the static function
|
provided for convenience, but may be slower than the static function
|
||||||
`updatesect`.
|
`updatesect`.
|
||||||
|
|
||||||
|
`spr:isenemy()`::
|
||||||
|
*TODO*
|
||||||
|
|
||||||
===== `sprite` iterators
|
===== `sprite` iterators
|
||||||
|
|
||||||
+*for* i *in* sprite.all()+::
|
+*for* i *in* sprite.all()+::
|
||||||
|
@ -1122,6 +1127,9 @@ index. Otherwise, returns *nil*.
|
||||||
Causes the actor with index `i` to fall in a ``hard-coded'', not further
|
Causes the actor with index `i` to fall in a ``hard-coded'', not further
|
||||||
specified fashion.
|
specified fashion.
|
||||||
|
|
||||||
|
`actor.move(i, vec, cliptype [, clipdist])`::
|
||||||
|
*TODO*
|
||||||
|
|
||||||
[[actor_static_data]]
|
[[actor_static_data]]
|
||||||
===== `actor` static data
|
===== `actor` static data
|
||||||
|
|
||||||
|
|
|
@ -211,7 +211,7 @@ rand_jkiss_dbl;
|
||||||
A_IncurDamage;
|
A_IncurDamage;
|
||||||
G_CheckActivatorMotion;
|
G_CheckActivatorMotion;
|
||||||
A_Dodge;
|
A_Dodge;
|
||||||
A_MoveSprite;
|
A_MoveSpriteClipdist;
|
||||||
P_DoQuote;
|
P_DoQuote;
|
||||||
P_SetGamePalette;
|
P_SetGamePalette;
|
||||||
G_AddUserQuote;
|
G_AddUserQuote;
|
||||||
|
|
Loading…
Reference in a new issue