New M32Script command "getspritelinktype" <spritenum> <<linktypevar>>.

This get into the writable variable the "linking type" of the sprite with index
<spritenum>.  The result is a bit field of ORed values:
 1: lotag has linking semantics
 2: hitag
 4: extra, 8: xvel, 16: yvel, 32: zvel, 64: owner  (custom only)

Custom setting about which sprites have what kind of linking can be programmed
via EVENT_LINKTAGS: it receives a sprite index as the 'current sprite' and is
supposed to return the bit field in RETURN.

An example which lists sprites and their linking hi- and lotags is provided in
the state 'listusedtags' in a.m32.

git-svn-id: https://svn.eduke32.com/eduke32@2590 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-04-05 19:49:12 +00:00
parent b85d40ea63
commit 607774a982
4 changed files with 30 additions and 1 deletions

View file

@ -1268,6 +1268,22 @@ defstate chselshade
}
ends
defstate listusedtags
for i allsprites
{
getspritelinktype i k
ifn k 0
{
ife k 1
qsprintf TQUOTE "sprite %d lotag %d" i sprite[i].lotag
else ife k 2
qsprintf TQUOTE "sprite %d hitag %d" i sprite[i].hitag
quote TQUOTE
}
}
ends
////////// USER AREA //////////
// key settings

View file

@ -303,13 +303,14 @@ const char *keyw[] =
"ifaimingsector",
"ifinteractive",
// BUILD functions
// Mostly BUILD functions
"resetkey",
"setkey",
"insertsprite",
"dupsprite",
"tdupsprite",
"deletesprite",
"getspritelinktype", // not BUILD
"lastwall",
"updatecursectnum",
"updatesector",
@ -2845,6 +2846,7 @@ repeatcase:
return 0;
case CON_SQRT:
case CON_GETSPRITELINKTYPE:
{
// syntax sqrt <invar> <outvar>
// gets the sqrt of invar into outvar

View file

@ -458,6 +458,7 @@ enum ScriptKeywords_t
CON_DUPSPRITE,
CON_TDUPSPRITE,
CON_DELETESPRITE,
CON_GETSPRITELINKTYPE,
CON_LASTWALL,
CON_UPDATECURSECTNUM,
CON_UPDATESECTOR,

View file

@ -1733,6 +1733,16 @@ badindex:
}
continue;
case CON_GETSPRITELINKTYPE:
insptr++;
{
int32_t spritenum=Gv_GetVarX(*insptr++), resvar = *insptr++;
X_ERROR_INVALIDSPRI(spritenum);
Gv_SetVarX(resvar, taglab_linktags(1, spritenum));
}
continue;
case CON_LASTWALL:
insptr++;
{