From 607774a982900f3793e0deec01a4fec9fba6f3ef Mon Sep 17 00:00:00 2001 From: helixhorned Date: Thu, 5 Apr 2012 19:49:12 +0000 Subject: [PATCH] New M32Script command "getspritelinktype" <>. This get into the writable variable the "linking type" of the sprite with index . 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 --- polymer/eduke32/samples/a.m32 | 16 ++++++++++++++++ polymer/eduke32/source/m32def.c | 4 +++- polymer/eduke32/source/m32def.h | 1 + polymer/eduke32/source/m32exec.c | 10 ++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/polymer/eduke32/samples/a.m32 b/polymer/eduke32/samples/a.m32 index f6281787c..82c6a7e0f 100644 --- a/polymer/eduke32/samples/a.m32 +++ b/polymer/eduke32/samples/a.m32 @@ -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 diff --git a/polymer/eduke32/source/m32def.c b/polymer/eduke32/source/m32def.c index 705fe1147..3553b3f82 100644 --- a/polymer/eduke32/source/m32def.c +++ b/polymer/eduke32/source/m32def.c @@ -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 // gets the sqrt of invar into outvar diff --git a/polymer/eduke32/source/m32def.h b/polymer/eduke32/source/m32def.h index 676716311..15ac98f7b 100644 --- a/polymer/eduke32/source/m32def.h +++ b/polymer/eduke32/source/m32def.h @@ -458,6 +458,7 @@ enum ScriptKeywords_t CON_DUPSPRITE, CON_TDUPSPRITE, CON_DELETESPRITE, + CON_GETSPRITELINKTYPE, CON_LASTWALL, CON_UPDATECURSECTNUM, CON_UPDATESECTOR, diff --git a/polymer/eduke32/source/m32exec.c b/polymer/eduke32/source/m32exec.c index ef8bf7b92..9ee563bfe 100644 --- a/polymer/eduke32/source/m32exec.c +++ b/polymer/eduke32/source/m32exec.c @@ -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++; {