C-CON: add *actor[].blend as an alias to .detail, *tspr[].tsprblend analogously.

See lunatic/test/sprite_access.con for a LIZTROOP that periodically smoothly
alpha-fades in and out. (Assuming that the 128 alpha blending tables from
shadexfog.create_128_trans(1) are installed.)

BUILD_LUNATIC.

git-svn-id: https://svn.eduke32.com/eduke32@4313 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2014-02-09 19:22:36 +00:00
parent 846fcdf31c
commit 0aa7b11dca
2 changed files with 69 additions and 4 deletions

View file

@ -770,7 +770,7 @@ const memberlabel_t ActorLabels[]=
{ "pal", ACTOR_PAL, 0, 0 },
{ "clipdist", ACTOR_CLIPDIST, 0, 0 },
// { "filler", ACTOR_DETAIL, 0, 0 },
{ "detail", ACTOR_DETAIL, 0, 0 }, // aka filler, not used
{ "blend", ACTOR_DETAIL, 0, 0 },
{ "xrepeat", ACTOR_XREPEAT, 0, 0 },
{ "yrepeat", ACTOR_YREPEAT, 0, 0 },
{ "xoffset", ACTOR_XOFFSET, 0, 0 },
@ -826,6 +826,8 @@ const memberlabel_t ActorLabels[]=
{ "uhitag", ACTOR_UHITAG, 0, 0 },
{ "isvalid", ACTOR_ISVALID, 0, 0 },
// aliases:
{ "detail", ACTOR_DETAIL, 0, 0 }, // deprecated name for 'blend'
{ "", -1, 0, 0 } // END OF LIST
};
@ -843,7 +845,7 @@ const memberlabel_t TsprLabels[]=
{ "tsprpal", ACTOR_PAL, 0, 0 },
{ "tsprclipdist", ACTOR_CLIPDIST, 0, 0 },
// { "tsprfiller", ACTOR_DETAIL, 0, 0 },
{ "tsprdetail", ACTOR_DETAIL, 0, 0 }, // aka filler, not used
{ "tsprblend", ACTOR_DETAIL, 0, 0 },
{ "tsprxrepeat", ACTOR_XREPEAT, 0, 0 },
{ "tspryrepeat", ACTOR_YREPEAT, 0, 0 },
{ "tsprxoffset", ACTOR_XOFFSET, 0, 0 },
@ -860,6 +862,8 @@ const memberlabel_t TsprLabels[]=
{ "tsprhitag", ACTOR_HITAG, 0, 0 },
{ "tsprextra", ACTOR_EXTRA, 0, 0 },
#endif
// aliases:
{ "tsprdetail", ACTOR_DETAIL, 0, 0 }, // deprecated name for 'tsprblend'
{ "", -1, 0, 0 } // END OF LIST
};
@ -6532,7 +6536,7 @@ void C_ReportError(int32_t iError)
initprintf("%s:%d: error: square brackets for index of game array not opened, expected [ found %c\n",g_szScriptFileName,g_lineNumber,*textptr);
break;
case ERROR_INVALIDARRAYWRITE:
initprintf("%s:%d: error: arrays can only be written to using `setarray' %c\n",g_szScriptFileName,g_lineNumber,*textptr);
initprintf("%s:%d: error: arrays can only be written to using `setarray'.\n",g_szScriptFileName,g_lineNumber);
break;
case ERROR_OPENBRACKET:
initprintf("%s:%d: error: found more `{' than `}' before `%s'.\n",g_szScriptFileName,g_lineNumber,tempbuf);

View file

@ -20,7 +20,7 @@ onevent EVENT_ENTERLEVEL
setvar i 0
whilevarvarn i MAXSPRITES
{
setactor[i].detail 1
setactor[i].blend 1
addvar i 1
}
@ -60,3 +60,64 @@ onevent EVENT_ENTERLEVEL
echo 115
endevent
////////// Periodically alpha-faded liztroop //////////
gamevar alpha 0 0
gamevar tmp 0 0
onevent EVENT_GAME // XXX: better: on spawn + loadactor
ifactor LIZTROOP
{
getactor[THISACTOR].mdflags tmp
orvar tmp 16
setactor[THISACTOR].mdflags tmp
}
endevent
onevent EVENT_ANIMATESPRITES
setvarvar tmp totalclock
shiftvarl tmp 2
sin alpha tmp // alpha is now in [-2^14 .. 2^14]
shiftvarr alpha 7 // [-2^7 .. 2^7]
addvar alpha 128 // [0 .. 256]
ifvare alpha 0
{
// clear translucent bits, 0xfdfe == 0xffff-(1+512)
gettspr[THISACTOR].tsprcstat tmp
andvar tmp 0xfdfe
settspr[THISACTOR].tsprcstat tmp
}
else
{
gettspr[THISACTOR].tsprcstat tmp
orvar tmp 2
settspr[THISACTOR].tsprcstat tmp
// Assume blending tables [1 .. 128] are installed, like generated by
// shadexfog.lua:create_128_trans(1).
ifvarg alpha 128
{
setvarvar tmp 257
subvarvar tmp alpha
setvarvar alpha tmp
// Set "reverse translucent" cstat bit
gettspr[THISACTOR].tsprcstat tmp
orvar tmp 512
settspr[THISACTOR].tsprcstat tmp
}
else
{
// Clear cstat bit 512
gettspr[THISACTOR].tsprcstat tmp
andvar tmp 0xfdff
settspr[THISACTOR].tsprcstat tmp
}
settspr[THISACTOR].tsprblend alpha
}
endevent