declare a%,b%,c%[5],d%[13],e%,f%,g%,h%,i%,j%,k%,l%,m%,n%,o%,p%,q%,r%,s%,t%,u%,v%,w%,x%,y&,z%
def t(0)&gettickcount
def i$(0)$appdatadir+"\CHAOS.INI"
def x(0)%umessage<>16
def k(1)iskey(&(1))
proc t
usefont "Arial",99,0,0,0,0:textcolor &(1),-1:drawtext &(2),&(3),$(4)
endproc
proc b
b%=d%[&(1)]:a%=rnd(2) & (b%<47) | (b%<9):copybmp 1,&(2)-639,48>0,&(2);0:setpixel 639,&(3)+&(4)*b%,a%*b%*if(e%<1536,($505-(-256 & e%)),0):b%=b%+a%*2-1:setpixel 639,&(3)+&(4)*b%,$CCFF-$3355*a%:d%[&(1)]=b%
endproc
proc e
play 0;0;0;39,0,0:k%=a%+20:l%=b%+50:m%=50:t%=t%-(1 << z%)
endproc
windowtitle "proXus":windowstyle 26:cls 0:window 1280-width(%hwnd),(960-height(%hwnd)):x%=val(readini$(i$(),"proXus","h"))
case readini$(i$(),"proXus","p")<>oct$(xor(x%,29^6)):x%=500
mcls 640,480:randomize:o%=5:q%=190:h%=-12:usermessages 16:set("ERRORLEVEL",0):play 45;38;63;16,-1,0
while x() and (o%+r%)
windowtitle "proXus - Highscore: "+st$(x%)+" - Score: "+st$(n%)+" - Lives: "+st$(o%)+" - Control with STRG and Pfeiltasten"
whileloop 2
whileloop 5
case t()-y&>500:y&=t()
y&=y&+12
while t()<y&
sleep 9
wend
m%=m%-(m%>0)*2:s%=(s%+(s%>0)*21)*((s%<640) | k(17))
if o%
p%=p%+(k(39) & (p%<541)-k(37) and p%)*2:q%=q%+(k(40) & (q%<317)-k(38) & (q%>64))*2
if (s%=0) & k(17)
play 0;0;0;28,0,0:s%=p%+61
endif
endif
whileloop 6
z%=&loop
if t% & (1 << z%)
a%=d%[z%]:b%=d%[z%+7]
select u%
caseof 0
if v%
a%=-98:b%=9+z%*54
endif
if (a%\9<>41) | (b%<64) | (b%>332)
a%=a%+1+e%\1792
case a%>640:a%=-99
elseif b%>198
inc b%
else
dec b%
endif
caseof 1
if v%
a%=640+abs(z%-3.5)*68:b%=9+z%*54
endif
a%=a%-3
caseof 2
if v%
a%=640+rnd(99):b%=63+rnd(270)
endif
a%=a%-z%
caseof 3
if v%
a%=640+((z%-1) mod 3)*68:b%=63+z%\4*269
endif
a%=a%-3
caseof 4
if v%
a%=640*z%:b%=63+rnd(270)
endif
a%=a%-7
caseof 5
case v%:a%=640
a%=a%-3:b%=sin((y&/999+z%/9)*pi()*2)*135+198
caseof 6
case v%:a%=572+z%*68
a%=a%-4:b%=sin((y&/2048+z%/9)*pi()*2)*135+198
caseof 7
case v%:a%=572+z%*68
a%=a%-5:b%=sin((y&/2048)*pi()*2)*135+198
caseof 8
case v%:a%=572+z%*68
a%=a%-7:b%=q%
endselect
case u%:a%=a%-e%\1792
if abs(b%-q%)<59
if (abs(a%-p%)<40) & (r%=0)
e:dec o%:p%=0:q%=190:r%=320
elseif s% and (abs(a%-s%)<49)
e:s%=9999:w%=w%-(1 << z%):n%=n%+if(w%,5,50)*(e%\1792+1)
case w%=0:j%=42
endif
endif
case a%<-98:t%=t%-(1 << z%)
d%[z%]=a%:d%[z%+7]=b%
endif
wend
v%=0:dec r%,r%>0
startpaint -1
case d%[0]=0:cls 0
rectangle 0,64-640,432
if e%<1792
b 0,0,0,1:b 7,432,479,-1
endif
usebrush 1,m%*2047:ellipsis k%-m%,(l%-m%)-k%+m%,l%+m%:usebrush 1,0
if o% and ((r%=0)+(&loop>3))
t $DDCCAA,p%,q%,"l=":t $99AACC,p%+2,q%,">"
endif
case s%:t $77FFFF,s%,q%,"="
whileloop 6
z%=&loop
if t% & (1 << z%)
b%=d%[z%+7]
t rnd(9999),d%[z%]+35-(u%=0)*22,b%-8,":"
t $FFFF-99*z%,d%[z%],b%,chr $(17)
endif
wend
case (o%=0) and r%:t 2^24-1,51,190,"GAME OVER"
endpaint
mcopybmp 0,0-640,480>0,0;0
wend
if j%
play 125-j%,0,0:j%=j%-7
endif
wend
play i%;0;0;45,0,0:i%=g%-ord(mid$(")35)8)35'35'8'57)78):)78'7:'85'7",e% & 7+f%+1,1))
case e% & 1=0:play 0;h%;h%+12;43,0,0
case e% & 7=0:h%=i%
case e% & 3=0:play 0;-h%;-h%-12;37+e% & 4,0,0
play -i%,0,0:e%=e%+if(e%<1792,1,8)
if e% & 31=0
f%=rnd(4)*8:g%=rnd(9)-5
endif
if e% & 15+t%=0
u%=rnd(9):t%=126:w%=t%:v%=1
endif
wend
play i%,h%;h%+12;43,0,0
case n%<x%:end
writeini i$(),"proXus","h"=st$(n%):writeini i$(),"proXus","p"=oct$(xor(n%,29^6)):e%=0:play 80,81,82;16;87,-1,0:t 2^24-1,225,240,st$(n%)
while x() & (e%<62)
clear d%[]:d%[9]=43
whileloop 5
z%=&loop
a%=ord(mid$(substr$("I P P u O R R W W|D M M P k O O R T|A I I M F k k O P|1 ; 3 ; 1 1 3 ;31 ; 3 ; 1 313 ; 1 ; 3 ;3143114333>|% 1 % 1 % 1 % 1 ' 3 ' 3 ' 3 ' 3 , 8 , 8 , 8 , 8 8",z%,"|"),e%+1,1))-12
if a%>20
d%[z%]=c%[z%]:d%[5+z%]=a%:c%[z%]=-a%:t 2^if(e% & 2,8,24)-1,52,140,"HIGHSCORE"
endif
wend
sleep 88:play d%[1];d%[2];d%[3];43;d%[5],0,0:play d%[6];d%[7];d%[8];d%[9];d%[10],0,0:inc e%
wend
play c%[1];c%[2];c%[3];43;c%[5],0,0