mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
293367e844
git-svn-id: https://svn.eduke32.com/eduke32@1500 1a8010ca-5511-0410-912e-c29ae57300e0
261 lines
5.3 KiB
Text
261 lines
5.3 KiB
Text
// m32 script test & show-off file
|
|
// do "include a" in the console
|
|
|
|
include names.h
|
|
|
|
gamevar i 0 1 // per-block (top-level, event, or state) variable
|
|
gamevar j 0 1
|
|
gamevar k 0 1
|
|
gamevar l 0 1
|
|
|
|
gamevar tmp 0 0
|
|
|
|
gamevar davr 65536 0
|
|
gamevar dayx 65536 0
|
|
|
|
gamevar drawcol 9 0
|
|
|
|
define TQUOTE 3
|
|
|
|
definequote 0 OK
|
|
definequote 1 DAMN
|
|
|
|
definequote 2 BU:%d ABS:%d
|
|
definequote TQUOTE write on me!
|
|
|
|
definequote 4 ASPECT: VR=%d, YX=%d
|
|
definequote 5 KEY:%d
|
|
|
|
definequote 6 time: %d ms
|
|
|
|
definequote 7 door sector not an island sector!
|
|
definequote 8 door sector has no SE sprite!
|
|
|
|
gamearray ar 128
|
|
gamearray parm 8
|
|
|
|
defstate artest
|
|
getarraysize ar tmp
|
|
resizearray ar 65536
|
|
getticks parm[2]
|
|
for j range 65536
|
|
set ar[j] j
|
|
set i 0
|
|
for j range 65536
|
|
add i ar[j]
|
|
getticks parm[3]
|
|
resizearray ar tmp
|
|
ife i 2147450880 quote 0 else quote 1
|
|
sub parm[3] parm[2]
|
|
qsprintf TQUOTE 6 parm[3]
|
|
quote TQUOTE
|
|
ends
|
|
|
|
defstate setas
|
|
set j dayx
|
|
mul j ydim mul j 8
|
|
div j xdim div j 5
|
|
setaspect davr j
|
|
ends
|
|
|
|
onevent EVENT_ENTER3DMODE
|
|
state setas
|
|
endevent
|
|
|
|
onevent EVENT_ANALYZESPRITES
|
|
|
|
for i drawnsprites
|
|
{
|
|
switch tsprite[i].picnum
|
|
case LIZTROOP spritepal 1 break
|
|
case PIGCOP spritepal 2 break
|
|
case BOSS1 spritepal 6 break
|
|
endswitch
|
|
}
|
|
/*
|
|
for i drawnsprites
|
|
{
|
|
ife tsprite[i].picnum LIZTROOP spritepal 1 else
|
|
ife tsprite[i].picnum PIGCOP spritepal 2 else
|
|
ife tsprite[i].picnum BOSS1 spritepal 6
|
|
}
|
|
*/
|
|
endevent
|
|
|
|
defstate cmp_by_lotag
|
|
set RETURN sprite[SV2].lotag
|
|
sub RETURN sprite[SV1].lotag
|
|
ends
|
|
|
|
onevent EVENT_DRAW2DSCREEN
|
|
ifl cursectnum 0 return
|
|
|
|
getarraysize ar tmp
|
|
set j 0
|
|
for i spritesofsector cursectnum
|
|
{
|
|
ifge j tmp nullop else
|
|
ifactor LOCATORS
|
|
{
|
|
set ar[j] i
|
|
add j 1
|
|
}
|
|
}
|
|
|
|
set tmp j
|
|
sort ar tmp cmp_by_lotag
|
|
|
|
sub tmp 1
|
|
for i range tmp
|
|
{
|
|
set j ar[i]
|
|
set k i, add k 1, set k ar[k]
|
|
drawline16b sprite[j].x sprite[j].y sprite[k].x sprite[k].y drawcol
|
|
}
|
|
/*
|
|
set drawlinepat -1
|
|
for i allsprites
|
|
ifactor LIZTROOP
|
|
drawcircle16b sprite[i].x sprite[i].y 256 9
|
|
*/
|
|
|
|
/*
|
|
set i totalclock
|
|
shiftr i 6
|
|
drawcircle16b posx posy 256 i
|
|
set j i
|
|
add j 8
|
|
drawcircle16 halfxdim16 midydim16 12 j
|
|
qsprintf 3 2 i j
|
|
printmessage16 3
|
|
*/
|
|
endevent
|
|
|
|
onevent EVENT_OVERHEADEDITOR
|
|
for i range 27
|
|
{
|
|
ifholdkey alphakeys[i]
|
|
{
|
|
qsprintf TQUOTE 5 i
|
|
quote TQUOTE
|
|
}
|
|
}
|
|
|
|
for i range 10
|
|
{
|
|
ifholdkey numberkeys[i]
|
|
{
|
|
qsprintf TQUOTE 5 i
|
|
quote TQUOTE
|
|
}
|
|
}
|
|
endevent
|
|
|
|
onevent EVENT_KEYS3D
|
|
for i range 10
|
|
// ife 0 1
|
|
{
|
|
ifholdkey numberkeys[i]
|
|
{
|
|
qsprintf TQUOTE 5 i
|
|
quote TQUOTE
|
|
}
|
|
}
|
|
|
|
ife searchstat 0
|
|
ifhitkey KEY_SPACE // SE11 ST23 up:ccw
|
|
{
|
|
set k wall[searchwall].nextsector
|
|
ifl k 0 return
|
|
ifn sector[k].lotag 23 return
|
|
set tmp 0
|
|
for i loopofwall searchwall
|
|
{
|
|
ifl wall[i].nextsector 0 set tmp 1 else
|
|
ifn wall[i].nextsector k set tmp 1
|
|
}
|
|
// a weaker condition
|
|
// for i loopofwall wall[searchwall].nextwall
|
|
// {
|
|
// ifl wall[i].nextsector 0 set tmp 1 else
|
|
// ifn wall[i].nextsector searchsector set tmp 1
|
|
// }
|
|
ifn tmp 0
|
|
{
|
|
quote 7
|
|
return
|
|
}
|
|
|
|
set l -1
|
|
for i spritesofsector k
|
|
{
|
|
ifactor SECTOREFFECTOR ife sprite[i].lotag 11
|
|
{
|
|
set l i
|
|
ifn sprite[i].ang 512 ifn sprite[i].ang 1024 ifn sprite[i].ang 1536 set l -1
|
|
}
|
|
}
|
|
ifl l 0
|
|
{
|
|
quote 8
|
|
return
|
|
}
|
|
|
|
for tmp wallsofsector k
|
|
{
|
|
rotatepoint (sprite[l].x sprite[l].y) (wall[tmp].x wall[tmp].y) sprite[l].ang (i j)
|
|
dragpoint tmp i j
|
|
}
|
|
for tmp spritesofsector k
|
|
{
|
|
ifn tmp l
|
|
{
|
|
rotatepoint (sprite[l].x sprite[l].y) (sprite[tmp].x sprite[tmp].y) sprite[l].ang (i j)
|
|
bsetsprite tmp i j sprite[tmp].z
|
|
}
|
|
}
|
|
inv sprite[l].ang
|
|
}
|
|
|
|
ife searchstat 3
|
|
ifhitkey KEY_SPACE
|
|
{
|
|
ifn sprite[searchwall].picnum SECTOREFFECTOR return
|
|
set tmp 0
|
|
ife sprite[searchwall].lotag 7 set tmp 1
|
|
ife sprite[searchwall].lotag 17 set tmp 1
|
|
ife tmp 0 return
|
|
|
|
for i allsprites
|
|
{
|
|
ifn i searchwall, ifactor SECTOREFFECTOR, ife sprite[i].lotag sprite[searchwall].lotag
|
|
ife sprite[i].hitag sprite[searchwall].hitag
|
|
{
|
|
add posx sprite[i].x, sub posx sprite[searchwall].x
|
|
add posy sprite[i].y, sub posy sprite[searchwall].y
|
|
add posz sprite[i].z, sub posz sprite[searchwall].z
|
|
|
|
updatecursectnum
|
|
|
|
return
|
|
}
|
|
}
|
|
}
|
|
|
|
ifholdkey KEY_0
|
|
// ife 0 1
|
|
{
|
|
ifeithershift sub davr 512 else add davr 512
|
|
ifl davr 32768 set davr 32768
|
|
ifg davr 256000 set davr 256000
|
|
setaspect davr yxaspect
|
|
qsprintf TQUOTE 4 davr yxaspect
|
|
quote TQUOTE
|
|
}
|
|
endevent
|
|
|
|
defstate replacestuff
|
|
for i spritesofsector searchsector
|
|
// ife sprite[i].picnum AMMO set sprite[i].picnum BATTERYAMMO
|
|
ifactor parm[0] cactor parm[1]
|
|
ends
|