raze/polymer/eduke32/source/lunatic/test/animatesprites.con
helixhorned fd978ced59 Classic: implement horiz. tex panning for sprites (spriteext[].xpanning).
Known as getactor/sprite[].xpanning from CON, values are 0-255. It should be
assumed that this is only valid for wall-aligned sprites (currently, face
sprites also pan).

A test is provided in lunatic/test/animatesprites.con. It should be run in E1L2
and only with the Lunatic build.

git-svn-id: https://svn.eduke32.com/eduke32@4170 1a8010ca-5511-0410-912e-c29ae57300e0
2013-11-22 19:26:21 +00:00

107 lines
2.6 KiB
Text

gamevar tmp 0 0
/*
actor LIZTROOP
getactor[THISACTOR].mdflags tmp
orvar tmp 16
setactor[THISACTOR].mdflags tmp
enda
*/
gamevar ceilz 0 0
gamevar ceilhit 0 0
gamevar florz 0 0
gamevar florhit 0 0
gamevar pi 0 0
gamevar doxp 0 0
gamevar xp 0 0
define Q 500
gamevar pdist 0 2
onevent EVENT_GAME
ifactor LIZTROOP
findplayer pdist
// Test both view/wall/floor sprites for
// spriteext[].xpanning (Polymost only)
setvar doxp 0
ifactor 937 // --- vvv --- E2L1
setvar doxp 1
else ifactor FEMMAG1
setvar doxp 1
else ifactor PIGCOP
setvar doxp 1
else ifactor 849 // 64x24: in classic, better than nonpow2-x tile 937
setvar doxp 1
ifvarn doxp 0
{
getactor[THISACTOR].xpanning xp
addvar xp 1
setactor[THISACTOR].xpanning xp
}
endevent
onevent EVENT_ANIMATESPRITES
ifactor LIZTROOP
{
setvarvar tmp totalclock
andvar tmp 255
settspr[THISACTOR].tsprshade tmp
}
endevent
gamevar lizi 0 0
onevent EVENT_DISPLAYREST
findnearactor LIZTROOP 4096 lizi
ifvarn lizi -1
{
redefinequote Q nearest LIZTROOP is %d units away (Manhattan dist.)
qsprintf Q Q /**/ actorvar[lizi].pdist
gametextz STARTALPHANUM 10 100 Q 2 0 16 /*bounds:*/ 0 0 xdim ydim 32768
}
getplayer[THISACTOR].i pi
// This blows up on C-CON:
getzrange sprite[pi].x sprite[pi].y sprite[pi].z player[THISACTOR].cursectnum
/*out:*/ ceilz ceilhit florz florhit
/*in:*/ 128 CLIPMASK0
redefinequote Q hit %d at %d, %d at %d
qsprintf Q Q /**/ ceilhit ceilz florhit florz
minitext 100 8 Q 0 0
gametext STARTALPHANUM 320 16 Q 0 0 16 /*bounds:*/ 0 0 xdim ydim
gametextz STARTALPHANUM 320 24 Q 0 0 16 /*bounds:*/ 0 0 xdim ydim 32768
endevent
// Following code by Fox, from
// http://forums.duke4.net/topic/955-eduke32-scripting/page__view__findpost__p__153176
gamevar SIN 0 0
gamevar COS 0 0
gamevar HORIZ 0 0
gamevar HITSECT 0 0
gamevar HITWALL 0 0
gamevar HITSPRITE 0 0
gamevar HITX 0 0
gamevar HITY 0 0
gamevar HITZ 0 0
onevent EVENT_DISPLAYREST
sin SIN player[THISACTOR].ang
cos COS player[THISACTOR].ang
setvar HORIZ 100
subvarvar HORIZ player[THISACTOR].horiz
subvarvar HORIZ player[THISACTOR].horizoff
mulvar HORIZ 32
hitscan player[THISACTOR].posx player[THISACTOR].posy player[THISACTOR].posz player[THISACTOR].cursectnum
COS SIN HORIZ HITSECT HITWALL HITSPRITE HITX HITY HITZ CLIPMASK1
redefinequote Q hitscan: hit sector %d, wall %d, sprite %d
qsprintf Q Q /**/ HITSECT HITWALL HITSPRITE
minitext 100 80 Q 0 0
endevent