mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +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;
|
||||
}
|
||||
|
||||
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];
|
||||
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;
|
||||
int32_t clipdist;
|
||||
|
||||
if (bg)
|
||||
if (clipdist >= 0)
|
||||
{
|
||||
// use that value
|
||||
}
|
||||
else if (bg)
|
||||
{
|
||||
if (spr->xrepeat > 60)
|
||||
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);
|
||||
void A_MoveCyclers(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_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);
|
||||
|
|
|
@ -38,6 +38,10 @@ ACTOR_INLINE int32_t A_SetSprite(int32_t i,uint32_t cliptype)
|
|||
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
|
||||
{
|
||||
|
|
|
@ -31,7 +31,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
# define ACTOR_INLINE_HEADER EXTERN_INLINE_HEADER
|
||||
#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_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype);
|
||||
|
||||
EXTERN_INLINE_HEADER void G_UpdateInterpolations(void);
|
||||
EXTERN_INLINE_HEADER void G_RestoreInterpolations(void);
|
||||
|
|
|
@ -1552,7 +1552,7 @@ end
|
|||
function _movesprite(spritenum, x, y, z, cliptype)
|
||||
check_sprite_idx(spritenum)
|
||||
local vel = ivec3(x, y, z)
|
||||
return ffiC.A_MoveSprite(spritenum, vel, cliptype)
|
||||
return ffiC.A_MoveSpriteClipdist(spritenum, vel, cliptype, -1)
|
||||
end
|
||||
|
||||
-- Also known as A_SetSprite().
|
||||
|
@ -1563,7 +1563,7 @@ function _ssp(i, cliptype)
|
|||
local ivec = vec:toivec3()
|
||||
ivec.z = spr.zvel
|
||||
|
||||
return (ffiC.A_MoveSprite(i, ivec, cliptype)==0)
|
||||
return (ffiC.A_MoveSpriteClipdist(i, ivec, cliptype, -1)==0)
|
||||
end
|
||||
|
||||
-- CON's 'setsprite' function on top of the Lunatic-provided ones.
|
||||
|
|
|
@ -413,6 +413,7 @@ end
|
|||
|
||||
--- default defines etc.
|
||||
local con_lang = require("con_lang")
|
||||
local xmath = require("xmath")
|
||||
|
||||
ffi.cdef([[
|
||||
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 G_CheckActivatorMotion(int32_t lotag);
|
||||
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_SetGamePalette(DukePlayer_t *player, uint8_t palid, int32_t set);
|
||||
void G_AddUserQuote(const char *daquote);
|
||||
|
@ -823,6 +824,7 @@ player_static_members._INPUT_EXT_BITS = defs_c.conststruct
|
|||
|
||||
local band = bit.band
|
||||
local lsh = bit.lshift
|
||||
local ivec3 = xmath.ivec3
|
||||
|
||||
do
|
||||
-- player.all() iterator
|
||||
|
@ -924,6 +926,13 @@ function actor_static_members.fall(i)
|
|||
CF.VM_FallSprite(i)
|
||||
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>.
|
||||
function actor_static_members.delete(i)
|
||||
check_sprite_idx(i)
|
||||
|
@ -969,6 +978,8 @@ local g_tile = setmtonce({}, defs_c.GenStructMetatable("g_tile", "MAXTILES", til
|
|||
-- Among other things, declares struct action and struct move, and their
|
||||
-- ID-wrapped types con_action_t and con_move_t
|
||||
local con = require("control")
|
||||
|
||||
do
|
||||
local isenemytile = con.isenemytile
|
||||
|
||||
-- Add game-side metamethods to "spritetype" and register it with "metatype"
|
||||
|
@ -977,7 +988,9 @@ local 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.
|
||||
local function check_literal_am(am, typename)
|
||||
|
@ -1600,7 +1613,7 @@ local allowed_modules = {
|
|||
engine = require("engine"),
|
||||
stat = require("stat"),
|
||||
bitar = require("bitar"),
|
||||
xmath = require("xmath"),
|
||||
xmath = xmath,
|
||||
fs = require("fs"),
|
||||
|
||||
con = con,
|
||||
|
@ -1623,8 +1636,8 @@ do
|
|||
return type(v)=="cdata" and ctype_cansave[tonumber(ffi.typeof(v))]
|
||||
end
|
||||
|
||||
reg_serializable_cv(allowed_modules.xmath.vec3())
|
||||
reg_serializable_cv(allowed_modules.xmath.ivec3())
|
||||
reg_serializable_cv(xmath.vec3())
|
||||
reg_serializable_cv(ivec3())
|
||||
end
|
||||
|
||||
-- Protect base modules.
|
||||
|
|
|
@ -790,6 +790,8 @@ claiming them for oneself.
|
|||
`wal:set_picnum(tilenum)`, `wal:set_overpicnum(tilenum)`::
|
||||
Set the tile number of the wall or its masked portion.
|
||||
|
||||
// TODO: the predicates
|
||||
|
||||
===== `wall` static functions
|
||||
|
||||
`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
|
||||
`updatesect`.
|
||||
|
||||
`spr:isenemy()`::
|
||||
*TODO*
|
||||
|
||||
===== `sprite` iterators
|
||||
|
||||
+*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
|
||||
specified fashion.
|
||||
|
||||
`actor.move(i, vec, cliptype [, clipdist])`::
|
||||
*TODO*
|
||||
|
||||
[[actor_static_data]]
|
||||
===== `actor` static data
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ rand_jkiss_dbl;
|
|||
A_IncurDamage;
|
||||
G_CheckActivatorMotion;
|
||||
A_Dodge;
|
||||
A_MoveSprite;
|
||||
A_MoveSpriteClipdist;
|
||||
P_DoQuote;
|
||||
P_SetGamePalette;
|
||||
G_AddUserQuote;
|
||||
|
|
Loading…
Reference in a new issue