//Version

define FIRSTNUM 9617 //1
define SECONDNUM 9618 //2

define YEAR1xxxNUM 9618 //2
define YEARx1xxNUM 9616 //0
define YEARxx1xNUM 9617 //1
define YEARxxx1NUM 9622 //6


define ACTOR2 7439

actor ACTOR2 sizeat 64 64
ifcount 2 killit
enda

state armorline
  mulvar num 19
  divvar num 200
  setvar tmp 19
  subvarvar tmp num
  whilevarn tmp 0 { subvar tmp 1 rotatesprite x y 65536 0 9701 0 0 1050 0 0 xdim ydim addvar x -1 }
ends

state loadtitle_state
rotatesprite 0 0 65536 0 7169 0 0 1050 0 0 xdim ydim
rotatesprite 90 8 65536 0 7158 0 0 1050 0 0 xdim ydim

redefinequote TEMPQUOTE LOADING
gametext 2908 260 24 TEMPQUOTE 0 0 1024 0 0 xdim ydim

qgetsysstr TEMPQUOTE STR_MAPNAME
gametext  2908 320 47 TEMPQUOTE 120 4 1050 0 0 xdim ydim
gametext  2908 320 45 TEMPQUOTE 0 0 1050 0 0 xdim ydim

redefinequote TEMPQUOTE PLEASE WAIT
gametext 9505 275 135 TEMPQUOTE 0 0 1024 0 0 xdim ydim

//version
  rotatesprite 7 191 65536 0 9654 0 0 1050 0 0 xdim ydim //v
  rotatesprite 11 191 65536 0 FIRSTNUM 0 0 1050 0 0 xdim ydim //0
  rotatesprite 15 191 65536 0 SECONDNUM 0 0 1050 0 0 xdim ydim //8
  rotatesprite 19 191 65536 0 9614 0 0 1050 0 0 xdim ydim //.
  rotatesprite 21 191 65536 0 YEAR1xxxNUM 0 0 1050 0 0 xdim ydim //2
  rotatesprite 25 191 65536 0 YEARx1xxNUM 0 0 1050 0 0 xdim ydim //0
  rotatesprite 29 191 65536 0 YEARxx1xNUM 0 0 1050 0 0 xdim ydim //1
  rotatesprite 33 191 65536 0 YEARxxx1NUM 0 0 1050 0 0 xdim ydim //5
ends

state debugnum
   setvarvar tmp num
   modvar tmp 10
   addvar tmp 9520
   rotatesprite x y 65536 0  tmp numshade col 1050 0 0 xdim ydim
   addvar x -4
   ifvarl num 0 { mulvar num -1 setvar deb_minus 1 } else setvar deb_minus 0
    ifvarg num 9
    {
      setvarvar tmp num
      divvar tmp 10
      modvar tmp 10
      addvar tmp 9520
      rotatesprite x y 65536 0  tmp numshade col 1050 0 0 xdim ydim
      addvar x -4
    }
	ifvarg num 99
    {
      setvarvar tmp num
      divvar tmp 100
      modvar tmp 10
      addvar tmp 9520
      rotatesprite x y 65536 0  tmp numshade col 1050 0 0 xdim ydim
      addvar x -4
    }
	ifvarg num 999
    {
      setvarvar tmp num
      divvar tmp 1000
      modvar tmp 10
      addvar tmp 9520
      rotatesprite x y 65536 0  tmp numshade col 1050 0 0 xdim ydim
      addvar x -4
    }
    ifvarg num 9999
    {
      setvarvar tmp num
      divvar tmp 10000
	  modvar tmp 10
      addvar tmp 9520
      rotatesprite x y 65536 0  tmp numshade col 1050 0 0 xdim ydim
	  addvar x -4
    }
	ifvarg num 99999
    {
      setvarvar tmp num
      divvar tmp 100000
	  modvar tmp 10
      addvar tmp 9520
	  ifvare deb_minus 1 { addvar x -4 rotatesprite x y 65536 0  9517 numshade col 1050 0 0 xdim ydim }
      rotatesprite x y 65536 0  tmp numshade col 1050 0 0 xdim ydim
    }
setvar col 0
setvar numshade 0
ends

state drawinvmenunum
   setvarvar tmp num
   modvar tmp 10
   addvar tmp 7370
   rotatesprite x y 65536 0  tmp 0 col 1050 0 0 xdim ydim
   addvar x -5
    ifvarg num 9
   {
      setvarvar tmp num
      divvar tmp 10
      modvar tmp 10
      addvar tmp 7370
      rotatesprite x y 65536 0  tmp 0 col 1050 0 0 xdim ydim
      addvar x -5
    }
    ifvarg num 99
    {
      setvarvar tmp num
      divvar tmp 100
      addvar tmp 7370
      rotatesprite x y 65536 0  tmp 0 col 1050 0 0 xdim ydim
      
    }
ends

state drawinvnum
   setvarvar tmp num
   modvar tmp 10
   addvar tmp 7370
   rotatesprite x y 65536 0  tmp 0 col 26 0 0 xdim ydim
   addvar x -5
    ifvarg num 9
   {
      setvarvar tmp num
      divvar tmp 10
      modvar tmp 10
      addvar tmp 7370
      rotatesprite x y 65536 0  tmp 0 col 26 0 0 xdim ydim
      addvar x -5
    }
    ifvarg num 99
    {
      setvarvar tmp num
      divvar tmp 100
      addvar tmp 7370
      rotatesprite x y 65536 0  tmp 0 col 26 0 0 xdim ydim
      
    }
ends

state drawweapnum
   setvarvar tmp num
   modvar tmp 10
   addvar tmp 7350
   rotatesprite x y 65536 0  tmp numshade col 1050 0 0 xdim ydim
   addvar x -4
    ifvarg num 9
    {
      setvarvar tmp num
      divvar tmp 10
      modvar tmp 10
      addvar tmp 7350
      rotatesprite x y 65536 0  tmp numshade col 1050 0 0 xdim ydim
      addvar x -4
    }
    ifvarg num 99
    {
      setvarvar tmp num
      divvar tmp 100
      addvar tmp 7350
      rotatesprite x y 65536 0  tmp numshade col 1050 0 0 xdim ydim
      
    }
setvar col 0
setvar numshade 0
ends

state drawarmnum
   ifvare num 0 break
   setvarvar tmp num
   modvar tmp 10
   addvar tmp 7350
   rotatesprite x y 65536 0  tmp 0 col 1050 0 0 xdim ydim
   addvar x -4
    ifvarg num 9
    {
      setvarvar tmp num
      divvar tmp 10
      modvar tmp 10
      addvar tmp 7350
      rotatesprite x y 65536 0  tmp 0 col 1050 0 0 xdim ydim
      addvar x -4
    }
    ifvarg num 99
    {
      setvarvar tmp num
      divvar tmp 100
      addvar tmp 7350
      rotatesprite x y 65536 0  tmp 0 col 1050 0 0 xdim ydim
      
    }
ends

state drawnumR
   setvarvar tmp num
   modvar tmp 10
   addvar tmp 7310
   rotatesprite x y 65536 0  tmp 0 col 1050 0 0 xdim ydim
   addvar x -9
    ifvarg num 9
    {
      setvarvar tmp num
      divvar tmp 10
      modvar tmp 10
      addvar tmp 7310
      rotatesprite x y 65536 0  tmp 0 col 1050 0 0 xdim ydim
      addvar x -9
    }
    ifvarg num 99
    {
      setvarvar tmp num
      divvar tmp 100
      addvar tmp 7310
      rotatesprite x y 65536 0  tmp 0 col 1050 0 0 xdim ydim
      
    }
ends

state drawnumB
   setvarvar tmp num
   modvar tmp 10
   addvar tmp 7360
   rotatesprite x y 65536 0  tmp 0 col 1050 0 0 xdim ydim
   addvar x -9
    ifvarg num 9
    {
      setvarvar tmp num
      divvar tmp 10
      modvar tmp 10
      addvar tmp 7360
      rotatesprite x y 65536 0  tmp 0 col 1050 0 0 xdim ydim
      addvar x -9
    }
    ifvarg num 99
    {
      setvarvar tmp num
      divvar tmp 100
      addvar tmp 7360
      rotatesprite x y 65536 0  tmp 0 col 1050 0 0 xdim ydim
      
    }
ends

state widearmorline
  mulvar num 19
  divvar num 200
  setvar tmp 19
  subvarvar tmp num
  whilevarn tmp 0 { subvar tmp 1 rotatesprite x y 65536 0 9701 0 0 538 0 0 xdim ydim addvar x -1 }
ends

state widedrawinvnum
   setvarvar tmp num
   modvar tmp 10
   addvar tmp 7370
   rotatesprite x y 65536 0  tmp 0 col 538 0 0 xdim ydim
   addvar x -5
    ifvarg num 9
   {
      setvarvar tmp num
      divvar tmp 10
      modvar tmp 10
      addvar tmp 7370
      rotatesprite x y 65536 0  tmp 0 col 538 0 0 xdim ydim
      addvar x -5
    }
    ifvarg num 99
    {
      setvarvar tmp num
      divvar tmp 100
      addvar tmp 7370
      rotatesprite x y 65536 0  tmp 0 col 538 0 0 xdim ydim
      
    }
ends

state widedrawarmnum
   ifvare num 0 break
   setvarvar tmp num
   modvar tmp 10
   addvar tmp 7350
   rotatesprite x y 65536 0  tmp 0 col 538 0 0 xdim ydim
   addvar x -4
    ifvarg num 9
    {
      setvarvar tmp num
      divvar tmp 10
      modvar tmp 10
      addvar tmp 7350
      rotatesprite x y 65536 0  tmp 0 col 538 0 0 xdim ydim
      addvar x -4
    }
    ifvarg num 99
    {
      setvarvar tmp num
      divvar tmp 100
      addvar tmp 7350
      rotatesprite x y 65536 0  tmp 0 col 538 0 0 xdim ydim
      
    }
ends

state widedrawnumR
   setvarvar tmp num
   modvar tmp 10
   addvar tmp 7310
   rotatesprite x y 65536 0  tmp 0 col 282 0 0 xdim ydim
   addvar x -9
    ifvarg num 9
    {
      setvarvar tmp num
      divvar tmp 10
      modvar tmp 10
      addvar tmp 7310
      rotatesprite x y 65536 0  tmp 0 col 282 0 0 xdim ydim
      addvar x -9
    }
    ifvarg num 99
    {
      setvarvar tmp num
      divvar tmp 100
      addvar tmp 7310
      rotatesprite x y 65536 0  tmp 0 col 282 0 0 xdim ydim
      
    }
ends

state widedrawnumB
   setvarvar tmp num
   modvar tmp 10
   addvar tmp 7360
   rotatesprite x y 65536 0  tmp 0 col 282 0 0 xdim ydim
   addvar x -9
    ifvarg num 9
    {
      setvarvar tmp num
      divvar tmp 10
      modvar tmp 10
      addvar tmp 7360
      rotatesprite x y 65536 0  tmp 0 col 282 0 0 xdim ydim
      addvar x -9
    }
    ifvarg num 99
    {
      setvarvar tmp num
      divvar tmp 100
      addvar tmp 7360
      rotatesprite x y 65536 0  tmp 0 col 282 0 0 xdim ydim
      
    }
ends

state drawnumW
   setvarvar tmp num
   modvar tmp 10
   addvar tmp 2930
   rotatesprite x y 65536 0  tmp 0 col 0 0 0 xdim ydim
   addvar x -9
    ifvarg num 9
    {
      setvarvar tmp num
      divvar tmp 10
      modvar tmp 10
      addvar tmp 2930
      rotatesprite x y 65536 0  tmp 0 col 0 0 0 xdim ydim
      addvar x -9
    }
    ifvarg num 99
    {
      setvarvar tmp num
      divvar tmp 100
      addvar tmp 2930
      rotatesprite x y 65536 0  tmp 0 col 0 0 0 xdim ydim
    }
ends

// Quotes code

gamevar quotemem1 0 1
gamevar quotemem2 0 1
gamearray QUOTES 4

onevent EVENT_DISPLAYROOMS
	getplayer[THISACTOR].ftq ftq
	getplayer[THISACTOR].fta tmp
	ifvarg tmp 0 
	{ 
		ifvare ftq 9 { ifrnd 128 { qstrcpy 9 192 setvar ftq 192 } else { qstrcpy 9 191 setvar ftq 191 } }
		setvarvar quotemem1 QUOTES[0]
		setvarvar quotemem2 QUOTES[1]
		setarray QUOTES[1] quotemem1
		setvarvar quotemem1 QUOTES[2]
		setarray QUOTES[2] quotemem2
		setarray QUOTES[3] quotemem1
		setarray QUOTES[0] ftq
		
		setvarvar quotemem1 quotecount_1
		setvarvar quotemem2 quotecount_2
		setvarvar quotecount_2 quotemem1
		setvarvar quotemem1 quotecount_3
		setvarvar quotecount_3 quotemem2
		setvarvar quotecount_4 quotemem1
		setvarvar quotecount_1 150 
	}
	setplayer[THISACTOR].fta 0
endevent

// Start menu code

onevent EVENT_DISPLAYMENUREST

getticks a
divvar a 1 // SLOW MOTION
divvar a 150
modvar a 8
setvar picnum BLOODLINE
addvarvar picnum a
getticks b
divvar b 1 // SLOW MOTION
divvar b 3
addvar b 208 setvarvar coor b modvar coor 400 rotatesprite 12 coor 65536 0 7148 0 0 1024 0 0 xdim ydim
addvar b 82 setvarvar coor b modvar coor 400 rotatesprite 35 coor 40960 0 7148 0 0 1024 0 0 xdim ydim
addvar b 123 setvarvar coor b modvar coor 400 rotatesprite 61 coor 65536 0 7148 0 0 1024 0 0 xdim ydim
addvar b 98 setvarvar coor b modvar coor 400 rotatesprite 92 coor 49152 0 7148 0 0 1024 0 0 xdim ydim
addvar b -200 setvarvar coor b modvar coor 400 rotatesprite 123 coor 57344 0 7148 0 0 1024 0 0 xdim ydim
addvar b -199 setvarvar coor b modvar coor 400 rotatesprite 154 coor 57344 0 7148 0 0 1024 0 0 xdim ydim
addvar b -350 setvarvar coor b modvar coor 400 rotatesprite 183 coor 57344 0 7148 0 0 1024 0 0 xdim ydim
addvar b -100 setvarvar coor b modvar coor 400 rotatesprite 203 coor 57344 0 7148 0 0 1024 0 0 xdim ydim
addvar b -100 setvarvar coor b modvar coor 400 rotatesprite 222 coor 65536 0 7148 0 0 1024 0 0 xdim ydim
addvar b -160 setvarvar coor b modvar coor 400 rotatesprite 244 coor 49152 0 7148 0 0 1024 0 0 xdim ydim
addvar b -195 setvarvar coor b modvar coor 400 rotatesprite 281 coor 57344 0 7148 0 0 1024 0 0 xdim ydim
addvar b -200 setvarvar coor b modvar coor 400 rotatesprite 306 coor 57344 0 7148 0 0 1024 0 0 xdim ydim

rotatesprite 160 -2 65536 0 picnum 0 0 1024 0 0 xdim ydim
endevent

onevent EVENT_GETLOADTILE
state loadtitle_state
setvar RETURN -1
endevent

onevent EVENT_GETMENUTILE
setvar RETURN -1
rotatesprite 0 0 65536 0 7166 0 0 1050 0 0 xdim ydim
endevent

// Hud code

onevent EVENT_DISPLAYCROSSHAIR
setvar RETURN -1 
{
    setvar x 160
    setvar y 100
    getuserdef[THISACTOR].crosshairscale z
    mulvar z 65536
    divvar z 100
    setvar picnum 7439
    ifvarn EOG_VAR 1 ifvarn EOL_VAR 1 rotatesprite x y z 0 picnum 0 0 0
    windowx1 windowy1 windowx2 windowy2
}
endevent

gamevar m_fraggedself 0 1
gamevar m_frag 0 1
gamevar m_kills 0 1
gamevar m_playernumber 0 1

onevent EVENT_DISPLAYREST
//setvar tmp 2
//digitalnumber 9520 30 40 actorvar[tmp].enemy_ret 0 pal 1050 0 0 xdim ydim

// DEATHMATCH BAR
    
ifmultiplayer
{
	getuserdef[THISACTOR].multimode m_playernumber

	rotatesprite 0 0 37000 0 7158 0 0 18 0 0 xdim ydim
	rotatesprite 80 0 37000 0 7158 0 0 18 0 0 xdim ydim
	rotatesprite 160 0 37000 0 7158 0 0 18 0 0 xdim ydim
	rotatesprite 240 0 37000 0 7158 0 0 18 0 0 xdim ydim
	ifvarg m_playernumber 4
	{
		rotatesprite 0 12 37000 0 7158 0 0 18 0 0 xdim ydim
		rotatesprite 80 12 37000 0 7158 0 0 18 0 0 xdim ydim
		rotatesprite 160 12 37000 0 7158 0 0 18 0 0 xdim ydim
		rotatesprite 240 12 37000 0 7158 0 0 18 0 0 xdim ydim
	}

	setvar temp 0
	whilevarvarn temp m_playernumber
	{
		getplayer[temp].i pid
		getactor[pid].pal pal
		getplayer[temp].fraggedself m_fraggedself
		getplayer[temp].frag m_frag
		subvarvar m_frag m_fraggedself
		setvarvar m_kills m_frag
		ifvare temp 0
		{
			setvar x 4
			setvar x2 75
			setvar y 4
			setvar y2 3
			getpname 125 temp
			setvar perplayer 125
		}
		ifvare temp 1
		{
			setvar x 84
			setvar x2 155
			setvar y 4
			setvar y2 3
			getpname 125 temp
			setvar perplayer 125
		}
		ifvare temp 2
		{
			setvar x 164
			setvar x2 235
			setvar y 4
			setvar y2 3
			getpname 125 temp
			setvar perplayer 125
		}
		ifvare temp 3
		{
			setvar x 244
			setvar x2 315
			setvar y 4
			setvar y2 3
			getpname 125 temp
			setvar perplayer 125
		}
		ifvare temp 4
		{
			setvar x 4
			setvar x2 75
			setvar y 16
			setvar y2 15
			getpname 125 temp
			setvar perplayer 125
		}
		ifvare temp 5
		{
			setvar x 84
			setvar x2 155
			setvar y 16
			setvar y2 15
			getpname 125 temp
			setvar perplayer 125
		}
		ifvare temp 6
		{
			setvar x 164
			setvar x2 235
			setvar y 16
			setvar y2 15
			getpname 125 temp
			setvar perplayer 125
		}
		ifvare temp 7
		{
			setvar x 244
			setvar x2 315
			setvar y 16
			setvar y2 15
			getpname 125 temp
			setvar perplayer 125
		}
		minitext x y perplayer 0 pal
		digitalnumber 9520 x2 y2 m_kills 0 pal 1050 0 0 xdim ydim //7349
		addvar temp 1
	}
}

ifvare CRBALLON 1
{
	rotatesprite 293 63 65536 1024 7650 0 0 18 0 0 xdim ydim
	rotatesprite 229 69 65536 0 7650 0 0 18 0 0 xdim ydim
	rotatesprite 215 40 131072 0 7321 0 0 18 0 0 xdim ydim
	
	getplayer[THISACTOR].i r0
	setvar temp 0
	whilevarvarn temp m_playernumber
	{
		getplayer[temp].i spriteid
		ifvarvarn spriteid r0 { setvarvar peractor temp }
		addvar temp 1
	}
	getplayer[peractor].posx x
	getplayer[peractor].posy y
	getplayer[peractor].posz z
	getplayer[peractor].ang ang
	addvar ang 1024
	getplayer[peractor].cursectnum sect1
	updatesectorz x y z sect1
	getplayer[peractor].horiz phoriz
	subvar phoriz 100
	showview x y z ang phoriz sect1 218 42 305 88

}
/*
	setvarvar peractor 0
	getactorvar[peractor].enemy_hitx x
	getactorvar[peractor].enemy_hity y 
	getactorvar[peractor].enemy_hitz z
	getactorvar[peractor].enemy_hita ang
	subvar z 8192
	updatesectorz x y z sect1
	getactorvar[peractor].height phoriz
	showview x y z ang phoriz sect1 218 42 305 88
*/
ifvarn detonateplayer 0
{
switch detonateplayer
	case 1
	case 2
	case 3
		setvar xweapon 100
	    setvar yweapon 160
		ifvare hudtype 0 { subvarvar yweapon 22 }
	    setvar tilenumweapon DYNAMITE
	    addvar tilenumweapon 46
		rotatesprite xweapon yweapon 65536 128 tilenumweapon shade 0 0 0 0 xdim ydim
		
		setvar xweapon 210
	    setvar yweapon 165
		ifvare hudtype 0 { subvarvar yweapon 22 }
	    setvar tilenumweapon DYNAMITE
	    addvar tilenumweapon 47
		rotatesprite xweapon yweapon 65536 -128 tilenumweapon shade 0 0 0 0 xdim ydim
	break
	case 4
	case 5
	case 6
		setvar xweapon 80
	    setvar yweapon 160
		ifvare hudtype 0 { subvarvar yweapon 22 }
	    setvar tilenumweapon DYNAMITE
	    addvar tilenumweapon 46
		rotatesprite xweapon yweapon 65536 0 tilenumweapon shade 0 0 0 0 xdim ydim
		
		setvar xweapon 230
	    setvar yweapon 165
		ifvare hudtype 0 { subvarvar yweapon 22 }
	    setvar tilenumweapon DYNAMITE
	    addvar tilenumweapon 47
		rotatesprite xweapon yweapon 65536 0 tilenumweapon shade 0 0 0 0 xdim ydim
	break
	case 7
	case 8
	case 9
		setvar xweapon 60
	    setvar yweapon 180
		ifvare hudtype 0 { subvarvar yweapon 22 }
	    setvar tilenumweapon DYNAMITE
	    addvar tilenumweapon 46
		rotatesprite xweapon yweapon 65536 -128 tilenumweapon shade 0 0 0 0 xdim ydim
		
		setvar xweapon 250
	    setvar yweapon 185
		ifvare hudtype 0 { subvarvar yweapon 22 }
	    setvar tilenumweapon DYNAMITE
	    addvar tilenumweapon 47
		rotatesprite xweapon yweapon 65536 192 tilenumweapon shade 0 0 0 0 xdim ydim
	break
	case 10
	case 11
	case 12
		setvar xweapon 40
	    setvar yweapon 200
		ifvare hudtype 0 { subvarvar yweapon 22 }
	    setvar tilenumweapon DYNAMITE
	    addvar tilenumweapon 46
		rotatesprite xweapon yweapon 65536 -256 tilenumweapon shade 0 0 0 0 xdim ydim
		
		setvar xweapon 270
	    setvar yweapon 205
		ifvare hudtype 0 { subvarvar yweapon 22 }
	    setvar tilenumweapon DYNAMITE
	    addvar tilenumweapon 47
		rotatesprite xweapon yweapon 65536 384 tilenumweapon shade 0 0 0 0 xdim ydim
	break
endswitch
}

ifvarg flamedamage 0
{	
	addvar fdamage_count 1
	
	setvar x 10
	whilevarn x 352
	{
		getticks tmp
		divvar tmp 50
		setvarvar x2 x
		mulvarvar x2 4
		addvarvar tmp x2
		modvar tmp 13
		setvar picnum 7221
		addvarvar picnum tmp
		
		switch x
			case 86
			case 238
			ifvarl fdamage_count 5 { setvarvar SIZE fdamage_count mulvar SIZE 12800 } else {
			ifvarg flamedamage 20 setvar SIZE 65536 else { setvarvar SIZE flamedamage mulvar SIZE 3200 } }
			break
			case 124
			case 200
			ifvarl fdamage_count 5 { setvarvar SIZE fdamage_count mulvar SIZE 10624 } else {
			ifvarg flamedamage 20 setvar SIZE 54394 else { setvarvar SIZE flamedamage mulvar SIZE 2656 } }
			break
			case 162
			ifvarl fdamage_count 5 { setvarvar SIZE fdamage_count mulvar SIZE 9600 } else {
			ifvarg flamedamage 20 setvar SIZE 49152 else { setvarvar SIZE flamedamage mulvar SIZE 2400 } }
			break
			default 
			ifvarl fdamage_count 5 { setvarvar SIZE fdamage_count mulvar SIZE 18432 } else {
			ifvarg flamedamage 20 setvar SIZE 95027 else { setvarvar SIZE flamedamage mulvar SIZE 4608 } }	 		
			break
		endswitch
		
		ifvare hudtype 0 { setvar y 175 } else setvar y 195 
		rotatesprite x y SIZE 0 picnum -128 0 0 0 0 xdim ydim
		addvar x 38
	}
} else { 
	setvar fdamage_count 0
}

ifvarg pfire 0
{
	addvar pfire_count 1
	
	setvar x 10
	whilevarn x 352
	{
		getticks tmp
		divvar tmp 50
		setvarvar x2 x
		mulvarvar x2 4
		addvarvar tmp x2
		modvar tmp 13
		setvar picnum 7221
		addvarvar picnum tmp
		
		switch x
			case 86
			case 238
			ifvarl pfire_count 5 { setvarvar SIZE pfire_count mulvar SIZE 12800 } else {
			ifvarg pfire 20 setvar SIZE 65536 else { setvarvar SIZE pfire mulvar SIZE 3200 } }
			break
			case 124
			case 200
			ifvarl pfire_count 5 { setvarvar SIZE pfire_count mulvar SIZE 10624 } else {
			ifvarg pfire 20 setvar SIZE 54394 else { setvarvar SIZE pfire mulvar SIZE 2656 } }
			break
			case 162
			ifvarl pfire_count 5 { setvarvar SIZE pfire_count mulvar SIZE 9600 } else {
			ifvarg pfire 20 setvar SIZE 49152 else { setvarvar SIZE pfire mulvar SIZE 2400 } }
			break
			default 
			ifvarl pfire_count 5 { setvarvar SIZE pfire_count mulvar SIZE 18432 } else {
			ifvarg pfire 20 setvar SIZE 95027 else { setvarvar SIZE pfire mulvar SIZE 4608 } }	 		
			break
		endswitch
		
		ifvare hudtype 0 { setvar y 205 } else setvar y 230 
		rotatesprite x y SIZE 0 picnum -128 0 0 0 0 xdim ydim
		addvar x 38
	}
} else setvar pfire_count 0

getplayer[THISACTOR].scuba_on num 
ifvare num 1 
{  
  rotatesprite 0 44 65536 0 7464 shade pal 256 0 0 xdim ydim
  rotatesprite 319 44 65536 1024 7464 shade pal 516 0 0 xdim ydim
  rotatesprite 319 156 65536 1024 7464 shade pal 514 0 0 xdim ydim
  rotatesprite 0 156 65536 0 7464 shade pal 260 0 0 xdim ydim
  rotatesprite 60 95 65536 0 7466 shade pal 289 0 0 xdim ydim
  rotatesprite 260 130 65536 0 7467 shade pal 545 0 0 xdim ydim
  setvar RETURN 1
}

getuserdef[THISACTOR].screen_size num

ifvare num 0 setvar hudtype 2 else
ifvare num 4 setvar hudtype 1 else
ifvare num 8 setvar hudtype 0 else
ifvarg num 4 setuserdef[THISACTOR].screen_size 8

ifvare hudtype 0
{
  //Bar
  rotatesprite 0 144 65536 0 7320 0 0 1050 0 0 xdim ydim //1050
  rotatesprite 114 184 65536 0 7322 0 0 1050 0 0 xdim ydim
  rotatesprite 197 184 65536 0 7322 0 0 1050 0 0 xdim ydim
  
  //Version
  
  rotatesprite 7 191 65536 0 9654 0 0 1050 0 0 xdim ydim //v
  rotatesprite 11 191 65536 0 FIRSTNUM 0 0 1050 0 0 xdim ydim //0
  rotatesprite 15 191 65536 0 SECONDNUM 0 0 1050 0 0 xdim ydim //8
  rotatesprite 19 191 65536 0 9614 0 0 1050 0 0 xdim ydim //.
  rotatesprite 21 191 65536 0 YEAR1xxxNUM 0 0 1050 0 0 xdim ydim //2
  rotatesprite 25 191 65536 0 YEARx1xxNUM 0 0 1050 0 0 xdim ydim //0
  rotatesprite 29 191 65536 0 YEARxx1xNUM 0 0 1050 0 0 xdim ydim //1
  rotatesprite 33 191 65536 0 YEARxxx1NUM 0 0 1050 0 0 xdim ydim //5
  
  /*
  rotatesprite 10 191 65536 0 9654 0 0 1050 0 0 xdim ydim //v
  rotatesprite 15 191 65536 0 9616 0 0 1050 0 0 xdim ydim //0
  rotatesprite 20 191 65536 0 9614 0 0 1050 0 0 xdim ydim //.
  rotatesprite 23 191 65536 0 9616 0 0 1050 0 0 xdim ydim //0
  rotatesprite 28 191 65536 0 9617 0 0 1050 0 0 xdim ydim //1
  */
  //TNTCOUNT
  setvarvar num TNTCOUNT
  setvar x 124 setvar y 175
  mulvar num 71
  divvar num 64
  setvar tmp 71
  subvarvar tmp num
  whilevarn tmp 71 { addvar tmp 1 rotatesprite x y 65536 0 9702 0 0 1050 0 0 xdim ydim addvar x 1 }
  //Health
  ifvare fatalvar 0 { getplayer[THISACTOR].last_extra num } else { setvar num 0 }
  setvar x 100 setvar y 178 state drawnumR
  //Ammo
  getplayer[THISACTOR].curr_weapon tmp
  getplayer[THISACTOR].ammo_amount tmp num
  ifvare tmp 8 ifvare num 1 { setvar num 0 }
  ifvarn tmp 0 { setvar x 230 setvar y 178 state drawnumB }
  
  //Keys
  rotatesprite 69 167 65536 0 9695 0 0 1050 0 0 xdim ydim
  rotatesprite 242 167 65536 0 9696 0 0 1050 0 0 xdim ydim
  rotatesprite 69 178 65536 0 9697 0 0 1050 0 0 xdim ydim
  rotatesprite 242 178 65536 0 9698 0 0 1050 0 0 xdim ydim
  rotatesprite 69 189 65536 0 9699 0 0 1050 0 0 xdim ydim
  rotatesprite 242 189 65536 0 9700 0 0 1050 0 0 xdim ydim

  ifvare VAR_SKULLKEY 1 rotatesprite 69 167 65536 0 7340 0 0 1050 0 0 xdim ydim
  ifvare VAR_EYEKEY 1 rotatesprite 242 167 65536 0 7341 0 0 1050 0 0 xdim ydim
  ifvare VAR_FIREKEY 1 rotatesprite 69 178 65536 0 7342 0 0 1050 0 0 xdim ydim
  ifvare VAR_DAGGERKEY 1 rotatesprite 242 178 65536 0 7343 0 0 1050 0 0 xdim ydim
  ifvare VAR_SPIDERKEY 1 rotatesprite 69 189 65536 0 7344 0 0 1050 0 0 xdim ydim
  ifvare VAR_MOONKEY 1 rotatesprite 242 189 65536 0 7345 0 0 1050 0 0 xdim ydim
  
  //Weapons
  getplayer[THISACTOR].ammo_amount 1 num
  setvar x 142 setvar y 180 setvar col 1 ifvarn CURRWEAP 1 setvar numshade 32 state drawweapnum
  getplayer[THISACTOR].ammo_amount 2 num
  setvar x 142 setvar y 186 setvar col 1 ifvarn CURRWEAP 2 setvar numshade 32 state drawweapnum
  getplayer[THISACTOR].ammo_amount 3 num
  setvar x 142 setvar y 192 setvar col 1 ifvarn CURRWEAP 3 setvar numshade 32 state drawweapnum
  getplayer[THISACTOR].ammo_amount 4 num
  setvar x 165 setvar y 180 setvar col 1 ifvarn CURRWEAP 4 setvar numshade 32 state drawweapnum
  setvarvar num TNT_AMMOAMOUNT
  setvar x 165 setvar y 186 setvar col 1 ifvarn currdinamite 1 setvar numshade 32 state drawweapnum
  getplayer[THISACTOR].ammo_amount 6 num
  setvar x 165 setvar y 192 setvar col 1 ifvarn CURRWEAP 6 setvar numshade 32 state drawweapnum
  getplayer[THISACTOR].ammo_amount 7 num
  setvar x 188 setvar y 180 setvar col 1 ifvarn CURRWEAP 7 setvar numshade 32 state drawweapnum
  getplayer[THISACTOR].ammo_amount 8 num
  ifvare num 1 { setvar num 0 }
  setvar x 188 setvar y 186 setvar col 1 ifvarn CURRWEAP 8 setvar numshade 32 state drawweapnum
  getplayer[THISACTOR].ammo_amount 9 num
  setvar x 188 setvar y 192 setvar col 1 ifvarn CURRWEAP 9 setvar numshade 32 state drawweapnum
  setvarvar num REMOTETNT_AMMOAMOUNT
  setvar x 312 setvar y 192 setvar col 1 ifvarn currdinamite 3 setvar numshade 32 state drawweapnum
  setvarvar num PROXIMITYMINE_AMMOAMOUNT
  setvar x 294 setvar y 192 setvar col 1 ifvarn currdinamite 2 setvar numshade 32 state drawweapnum

  //INV

  ifvare DISPLAYINVENTORY 1
  {
		setarray INVARRAY[0] DOCTORSBAGAM
		setarray INVARRAY[1] DIVINGSUITAM
		setarray INVARRAY[2] CRYSTALLBALLAM
		setarray INVARRAY[3] BEASTVISIONAM
		setarray INVARRAY[4] BOOTSOFJUMPINGAM
	  
		setvar tmp2 0 // Thanks to TheLezing for this code
		setvar x2 170
		whilevarn tmp2 5
		{
			ifvarg INVARRAY[tmp2] 0 subvar x2 10
			addvar tmp2 1
		}
		setvar tmp2 0
	    whilevarn tmp2 5
	    {
			ifvarg INVARRAY[tmp2] 0 
			{ 
				switch tmp2
					case 0 setvar picnum 7689 break
					case 1 setvar picnum 7684 break
					case 2 setvar picnum 7686 break
					case 3 setvar picnum 7688 break
					case 4 setvar picnum 7680 break
				endswitch
				rotatesprite x2 147 NORMALSIZE 0 picnum 0 0 0 0 0 xdim ydim
				rotatesprite x2 133 NORMALSIZE 0 9726 0 0 0 0 0 xdim ydim
				ifvarvare ICPOSITION tmp2 { rotatesprite x2 147 NORMALSIZE 0 7679 0 0 0 0 0 xdim ydim }
				setvarvar num INVARRAY[tmp2]
				ifvarg tmp2 0 divvar num 12
				setvarvar x x2
				addvar x 3
				setvar y 130 state drawinvnum
				addvar x2 19
			}
		    addvar tmp2 1
	    }
  }  

  getplayer[THISACTOR].inven_icon tmp
  ifvarn tmp 0
  {
  ifvare tmp 8 // DOCTORSBAGAM
	{
	rotatesprite 265 186 65536 0 7689 0 0 1024 0 0 xdim ydim
	setvarvar num DOCTORSBAGAM
	setvar x 268 setvar y 169 state drawinvmenunum
	} 
  ifvare tmp 9 // DIVINGSUITAM
	{
	rotatesprite 265 186 65536 0 7684 0 0 1024 0 0 xdim ydim
	setvarvar num DIVINGSUITAM
        divvar num 12
	setvar x 268 setvar y 169 state drawinvmenunum
	}  
  ifvare tmp 10 // CRYSTALLBALLAM
	{
	rotatesprite 265 186 65536 0 7686 0 0 1024 0 0 xdim ydim
	setvarvar num CRYSTALLBALLAM
        divvar num 12
	setvar x 268 setvar y 169 state drawinvmenunum
	}  
  ifvare tmp 11 // BEASTVISIONAM 
	{
	rotatesprite 265 186 65536 0 7688 0 0 1024 0 0 xdim ydim
	setvarvar num BEASTVISIONAM 
        divvar num 12
	setvar x 268 setvar y 169 state drawinvmenunum
	}  
  ifvare tmp 12 // BOOTSOFJUMPINGAM
	{
	rotatesprite 265 186 65536 0 7680 0 0 1024 0 0 xdim ydim
	setvarvar num BOOTSOFJUMPINGAM
        divvar num 12
	setvar x 268 setvar y 169 state drawinvmenunum
	}              
  }

 //Armors
  setvarvar num FIRESHIELD_AMOUNT
  ifvarn num 0 { rotatesprite 44 174 65536 0 7327 0 0 1050 0 0 xdim ydim }
  setvar x 62 setvar y 174
  state armorline
  setvarvar num FIRESHIELD_AMOUNT
  setvar x 57 setvar y 175 state drawarmnum
  
  setvarvar num BODYSHIELD_AMOUNT 
  ifvarn num 0 { rotatesprite 44 182 65536 0 7329 0 0 1050 0 0 xdim ydim }
  setvar x 62 setvar y 182
  state armorline
  setvarvar num BODYSHIELD_AMOUNT 
  setvar x 57 setvar y 183 state drawarmnum
  
  setvarvar num SPIRITSHIELD_AMOUNT
  ifvarn num 0 { rotatesprite 44 190 65536 0 7328 0 0 1050 0 0 xdim ydim }
  setvar x 62 setvar y 190
  state armorline
  setvarvar num SPIRITSHIELD_AMOUNT
  setvar x 57 setvar y 191 state drawarmnum
  
  setvar RETURN 1
}
ifvare hudtype 1
{
  //Bar
  rotatesprite 0 175 65536 0 7321 0 0 282 0 0 xdim ydim //26
  rotatesprite 248 175 65536 0 7293 0 0 538 0 0 xdim ydim //26
  
  ifvare VAR_SKULLKEY 1 rotatesprite 69 189 65536 0 7340 0 0 1050 0 0 xdim ydim
  ifvare VAR_EYEKEY 1 rotatesprite 80 189 65536 0 7341 0 0 1050 0 0 xdim ydim
  ifvare VAR_FIREKEY 1 rotatesprite 91 189 65536 0 7342 0 0 1050 0 0 xdim ydim
  ifvare VAR_DAGGERKEY 1 rotatesprite 215 189 65536 0 7343 0 0 1050 0 0 xdim ydim
  ifvare VAR_SPIDERKEY 1 rotatesprite 226 189 65536 0 7344 0 0 1050 0 0 xdim ydim
  ifvare VAR_MOONKEY 1 rotatesprite 237 189 65536 0 7345 0 0 1050 0 0 xdim ydim
  
  //TNTCOUNT
  setvarvar num TNTCOUNT
  setvar x 124 setvar y 175
  mulvar num 71
  divvar num 64
  setvar tmp 71
  subvarvar tmp num
  whilevarn tmp 71 { addvar tmp 1 rotatesprite x y 65536 0 9702 0 0 1050 0 0 xdim ydim addvar x 1 }
  
  //Health
  ifvare fatalvar 0 { getplayer[THISACTOR].last_extra num } else { setvar num 0 }
  setvar x 22 setvar y 179 state widedrawnumR
  //Ammo
  getplayer[THISACTOR].curr_weapon tmp
  getplayer[THISACTOR].ammo_amount tmp num
  ifvare tmp 8 ifvare num 1 { setvar num 0 }
  ifvarn tmp 0 { setvar x 56 setvar y 179 state widedrawnumB }
  //INV

  ifvare DISPLAYINVENTORY 1
  {
  
  		setarray INVARRAY[0] DOCTORSBAGAM
		setarray INVARRAY[1] DIVINGSUITAM
		setarray INVARRAY[2] CRYSTALLBALLAM
		setarray INVARRAY[3] BEASTVISIONAM
		setarray INVARRAY[4] BOOTSOFJUMPINGAM
	  
		setvar tmp2 0 // Thanks to TheLezing for this code
		setvar x2 170
		whilevarn tmp2 5
		{
			ifvarg INVARRAY[tmp2] 0 subvar x2 10
			addvar tmp2 1
		}
		setvar tmp2 0
	    whilevarn tmp2 5
	    {
			ifvarg INVARRAY[tmp2] 0 
			{ 
				switch tmp2
					case 0 setvar picnum 7689 break
					case 1 setvar picnum 7684 break
					case 2 setvar picnum 7686 break
					case 3 setvar picnum 7688 break
					case 4 setvar picnum 7680 break
				endswitch
				rotatesprite x2 187 NORMALSIZE 0 picnum 0 0 0 0 0 xdim ydim
				rotatesprite x2 173 NORMALSIZE 0 9726 0 0 0 0 0 xdim ydim
				ifvarvare ICPOSITION tmp2 { rotatesprite x2 187 NORMALSIZE 0 7679 0 0 0 0 0 xdim ydim }
				setvarvar num INVARRAY[tmp2]
				ifvarg tmp2 0 divvar num 12
				setvarvar x x2
				addvar x 3
				setvar y 170 state drawinvnum
				addvar x2 19
			}
		    addvar tmp2 1
	    }

  }

  getplayer[THISACTOR].inven_icon tmp
  ifvarn tmp 0
  {
  ifvare tmp 8 // DOCTORSBAGAM
	{
	rotatesprite 286 187 65536 0 7689 0 0 512 0 0 xdim ydim
	setvarvar num DOCTORSBAGAM
	setvar x 310 setvar y 181 state widedrawinvnum
	} 
  ifvare tmp 9 // DIVINGSUITAM
	{
	rotatesprite 286 187 65536 0 7684 0 0 512 0 0 xdim ydim
	setvarvar num DIVINGSUITAM
        divvar num 12
	setvar x 310 setvar y 181 state widedrawinvnum
	}  
  ifvare tmp 10 // CRYSTALLBALLAM
	{
	rotatesprite 286 187 65536 0 7686 0 0 512 0 0 xdim ydim
	setvarvar num CRYSTALLBALLAM
        divvar num 12
	setvar x 310 setvar y 181 state widedrawinvnum
	}  
  ifvare tmp 11 // BEASTVISIONAM 
	{
	rotatesprite 286 187 65536 0 7688 0 0 512 0 0 xdim ydim
	setvarvar num BEASTVISIONAM 
        divvar num 12
	setvar x 310 setvar y 181 state widedrawinvnum
	}  
  ifvare tmp 12 // BOOTSOFJUMPINGAM
	{
	rotatesprite 286 187 65536 0 7680 0 0 512 0 0 xdim ydim
	setvarvar num BOOTSOFJUMPINGAM
        divvar num 12
	setvar x 310 setvar y 181 state widedrawinvnum
	}              

  }
  //Armors
  
  setvarvar num FIRESHIELD_AMOUNT
  ifvarn num 0 { rotatesprite 250 176 65536 0 7327 0 0 538 0 0 xdim ydim }
  setvar x 268 setvar y 176
  state widearmorline
  setvarvar num FIRESHIELD_AMOUNT
  setvar x 263 setvar y 177 state widedrawarmnum
  
  setvarvar num BODYSHIELD_AMOUNT 
  ifvarn num 0 { rotatesprite 250 184 65536 0 7329 0 0 538 0 0 xdim ydim }
  setvar x 268 setvar y 184
  state widearmorline
  setvarvar num BODYSHIELD_AMOUNT
  setvar x 263 setvar y 185 state widedrawarmnum
  
  setvarvar num SPIRITSHIELD_AMOUNT
  ifvarn num 0 { rotatesprite 250 192 65536 0 7328 0 0 538 0 0 xdim ydim }
  setvar x 268 setvar y 192
  state widearmorline
  setvarvar num SPIRITSHIELD_AMOUNT
  setvar x 263 setvar y 193 state widedrawarmnum
}
ifvare hudtype 2
{
  //TNTCOUNT
  setvarvar num TNTCOUNT
  setvar x 124 setvar y 175
  mulvar num 71
  divvar num 64
  setvar tmp 71
  subvarvar tmp num
  whilevarn tmp 71 { addvar tmp 1 rotatesprite x y 65536 0 9702 0 0 1050 0 0 xdim ydim addvar x 1 }
  
  ifvare DISPLAYINVENTORY 1
  {
  
  		setarray INVARRAY[0] DOCTORSBAGAM
		setarray INVARRAY[1] DIVINGSUITAM
		setarray INVARRAY[2] CRYSTALLBALLAM
		setarray INVARRAY[3] BEASTVISIONAM
		setarray INVARRAY[4] BOOTSOFJUMPINGAM
	  
		setvar tmp2 0 // Thanks to TheLezing for this code
		setvar x2 170
		whilevarn tmp2 5
		{
			ifvarg INVARRAY[tmp2] 0 subvar x2 10
			addvar tmp2 1
		}
		setvar tmp2 0
	    whilevarn tmp2 5
	    {
			ifvarg INVARRAY[tmp2] 0 
			{ 
				switch tmp2
					case 0 setvar picnum 7689 break
					case 1 setvar picnum 7684 break
					case 2 setvar picnum 7686 break
					case 3 setvar picnum 7688 break
					case 4 setvar picnum 7680 break
				endswitch
				rotatesprite x2 187 NORMALSIZE 0 picnum 0 0 0 0 0 xdim ydim
				rotatesprite x2 173 NORMALSIZE 0 9726 0 0 0 0 0 xdim ydim
				ifvarvare ICPOSITION tmp2 { rotatesprite x2 187 NORMALSIZE 0 7679 0 0 0 0 0 xdim ydim }
				setvarvar num INVARRAY[tmp2]
				ifvarg tmp2 0 divvar num 12
				setvarvar x x2
				addvar x 3
				setvar y 170 state drawinvnum
				addvar x2 19
			}
		    addvar tmp2 1
	    }

  }
}

getactorvar[THISACTOR].handattack temp
ifvare temp 1
{

getticks picnum
divvar picnum 65
modvar picnum 39
	
switch picnum
case 0
rotatesprite 160 190 65536 32 7131 shade 0 0 0 0 xdim ydim
rotatesprite 105 135 65536 32 5854 shade 0 0 0 0 xdim ydim
break
case 1
rotatesprite 160 190 65536 0 7131 shade 0 0 0 0 xdim ydim
rotatesprite 95 130 65536 32 5856 shade 0 0 0 0 xdim ydim
rotatesprite 140 145 65536 -128 5855 shade 0 0 0 0 xdim ydim
break
case 2
rotatesprite 155 185 65536 -32 7131 shade 0 0 0 0 xdim ydim
rotatesprite 85 130 65536 32 5855 shade 0 0 0 0 xdim ydim
rotatesprite 140 135 65536 64 5856 shade 0 0 0 0 xdim ydim
break
case 3
rotatesprite 155 185 65536 -64 7131 shade 0 0 0 0 xdim ydim
rotatesprite 50 150 65536 32 5857 shade 0 0 0 0 xdim ydim
rotatesprite 140 120 65536 92 5857 shade 0 0 0 0 xdim ydim
break
case 4
rotatesprite 155 185 65536 -64 7131 shade 0 0 0 0 xdim ydim
rotatesprite 30 165 65536 -256 5854 shade 0 0 0 0 xdim ydim
rotatesprite 135 125 65536 92 5855 shade 0 0 0 0 xdim ydim
break
case 5
rotatesprite 155 185 65536 -32 7131 shade 0 0 0 0 xdim ydim
rotatesprite 19 195 65536 0 5855 shade 0 0 0 0 xdim ydim
rotatesprite 135 130 65536 0 5856 shade 0 0 0 0 xdim ydim
break
case 6
rotatesprite 155 185 65536 0 7131 shade 0 0 0 0 xdim ydim
rotatesprite 135 140 92000 0 5857 shade 0 0 0 0 xdim ydim
break
case 7
rotatesprite 142 158 92000 512 5857 shade 0 0 0 0 xdim ydim
rotatesprite 155 185 65536 16 7131 shade 0 0 0 0 xdim ydim
break
case 8
rotatesprite 155 185 65536 0 7131 shade 0 0 0 0 xdim ydim
break
case 9
rotatesprite 155 185 65536 -16 7131 shade 0 0 0 0 xdim ydim
rotatesprite 105 140 65536 1056 5854 shade 0 0 0 0 xdim ydim
break
case 10
rotatesprite 155 185 65536 -32 7131 shade 0 0 0 0 xdim ydim
rotatesprite 100 130 65536 1056 5855 shade 0 0 0 0 xdim ydim
break
case 11
rotatesprite 155 185 65536 -64 7131 shade 0 0 0 0 xdim ydim
rotatesprite 95 125 65536 1056 5856 shade 0 0 0 0 xdim ydim
break
case 12
rotatesprite 155 185 65536 -96 7131 shade 0 0 0 0 xdim ydim
rotatesprite 93 128 65536 1056 5857 shade 0 0 0 0 xdim ydim
break
case 13
rotatesprite 155 185 65536 -96 7131 shade 0 0 0 0 xdim ydim
rotatesprite 90 134 65536 1056 5854 shade 0 0 0 0 xdim ydim
break
case 14
rotatesprite 155 185 65536 -64 7131 shade 0 0 0 0 xdim ydim
rotatesprite 90 140 65536 1056 5855 shade 0 0 0 0 xdim ydim
break
case 15
rotatesprite 155 185 65536 -32 7131 shade 0 0 0 0 xdim ydim
break
case 16
rotatesprite 155 185 65536 0 7131 shade 0 0 0 0 xdim ydim
break
case 17
rotatesprite 155 185 65536 16 7131 shade 0 0 0 0 xdim ydim
rotatesprite 90 140 65536 1056 5855 shade 0 0 0 0 xdim ydim
break
case 18
rotatesprite 155 185 65536 32 7131 shade 0 0 0 0 xdim ydim
rotatesprite 85 147 65536 1056 5856 shade 0 0 0 0 xdim ydim
break
case 19
rotatesprite 155 185 65536 48 7131 shade 0 0 0 0 xdim ydim
rotatesprite 82 152 65536 1056 5857 shade 0 0 0 0 xdim ydim
break
case 20
rotatesprite 155 185 65536 48 7131 shade 0 0 0 0 xdim ydim
rotatesprite 80 155 65536 1056 5855 shade 0 0 0 0 xdim ydim
break
case 21
rotatesprite 155 185 65536 32 7131 shade 0 0 0 0 xdim ydim
rotatesprite 77 160 65536 1056 5856 shade 0 0 0 0 xdim ydim
break
case 22
rotatesprite 155 185 65536 16 7131 shade 0 0 0 0 xdim ydim
break
case 23
rotatesprite 155 185 65536 -16 7131 shade 0 0 0 0 xdim ydim
break
case 24
rotatesprite 155 190 65536 -16 7131 shade 0 0 0 0 xdim ydim
break
case 25
rotatesprite 155 190 65536 -32 7131 shade 0 0 0 0 xdim ydim
rotatesprite 133 147 65536 1664 5854 shade 0 0 0 0 xdim ydim
break
case 26
rotatesprite 155 193 65536 -32 7131 shade 0 0 0 0 xdim ydim
rotatesprite 133 150 65536 1664 5854 shade 0 0 0 0 xdim ydim
break
case 27
rotatesprite 155 193 65536 -32 7131 shade 0 0 0 0 xdim ydim
rotatesprite 133 150 65536 1664 5854 shade 0 0 0 0 xdim ydim
break
case 28
rotatesprite 155 193 65536 -48 7131 shade 0 0 0 0 xdim ydim
rotatesprite 155 150 65536 1664 5855 shade 0 0 0 0 xdim ydim
break
case 29
rotatesprite 155 193 65536 -48 7131 shade 0 0 0 0 xdim ydim
rotatesprite 155 151 65536 1664 5855 shade 0 0 0 0 xdim ydim
break
case 30
rotatesprite 155 193 65536 -64 7131 shade 0 0 0 0 xdim ydim
rotatesprite 165 151 65536 1664 5856 shade 0 0 0 0 xdim ydim
break
case 31
rotatesprite 155 193 65536 -64 7131 shade 0 0 0 0 xdim ydim
rotatesprite 165 150 65536 1664 5856 shade 0 0 0 0 xdim ydim
break
case 32
rotatesprite 155 193 65536 -96 7131 shade 0 0 0 0 xdim ydim
rotatesprite 179 154 65536 1664 5857 shade 0 0 0 0 xdim ydim
break
case 33
rotatesprite 205 174 65536 1664 5854 shade 0 0 0 0 xdim ydim
rotatesprite 155 193 65536 -96 7131 shade 0 0 0 0 xdim ydim
break
case 34
rotatesprite 155 193 65536 -64 7131 shade 0 0 0 0 xdim ydim
break
case 35
rotatesprite 155 193 65536 -32 7131 shade 0 0 0 0 xdim ydim
break
case 36
rotatesprite 155 193 65536 -16 7131 shade 0 0 0 0 xdim ydim
break
case 37
rotatesprite 157 192 65536 0 7131 shade 0 0 0 0 xdim ydim
break
case 38
rotatesprite 160 190 65536 16 7131 shade 0 0 0 0 xdim ydim
break
endswitch
}
/*
ifinwater //затемнение под водой
{
	rotatesprite 0 0 327680 0 5375 60 4 1051 0 0 xdim ydim
}
*/


setvar y 7
setvar quotes 0
whilevarn quotes 4
{
	setvarvar tmp QUOTES[quotes]
	ifvarg tmp 0 { ifvare quotes 0 { gametext 9505 7 y QUOTES[quotes] 0 0 256 0 0 xdim ydim } else gametext 9505 7 y QUOTES[quotes] 0 0 257 0 0 xdim ydim addvar y 10 }
	addvar quotes 1
}

ifvare EOG_VAR 1
{
	setplayer[THISACTOR].movement_lock 15
	setplayer[THISACTOR].jumping_counter 0 
	setplayer[THISACTOR].kickback_pic 0
	setplayer[THISACTOR].crack_time 0
	setactor[THISACTOR].htextra -1
	setactorvar[THISACTOR].flamedamage 0
	setactorvar[THISACTOR].invisible 1
	setplayer[THISACTOR].airleft 390
	setvar INVISTIME 0
	palfrom 0

rotatesprite 157 106 65540 0 7693 0 0 1026 0 0 xdim ydim

setvarvar EOG_COUNT EOG_TMP
divvar EOG_COUNT 2 // SLOW MOTION
modvar EOG_COUNT 1200
subvarvar EOG_COUNT 200
mulvar EOG_COUNT -1

myos 91 EOG_COUNT 7695 0 1043
addvar EOG_COUNT 395
myos 102 EOG_COUNT 7696 0 1043
addvar EOG_COUNT 370
myos 91 EOG_COUNT 7697 0 1043

rotatesprite 0 0 65536 0 7694 0 0 1042 0 0 xdim ydim
}

ifvare EOL_VAR 1
{
	addvar EOL_COUNT 1
	ifvarg EOL_COUNT 100 setvar EOL_COUNT 101
	setplayer[THISACTOR].movement_lock 15
	setplayer[THISACTOR].jumping_counter 0 
	setplayer[THISACTOR].kickback_pic 0
	setplayer[THISACTOR].crack_time 0
	setactor[THISACTOR].htextra -1
	setactorvar[THISACTOR].flamedamage 0
	setactorvar[THISACTOR].invisible 1
	setplayer[THISACTOR].airleft 390
	setvar INVISTIME 0
	palfrom 0
	
	/*
	setvar peractor 580
	getactor[peractor].x x
	getactor[peractor].y y
	getactor[peractor].z z
	getactor[peractor].ang ang
	getactor[peractor].sectnum sect1
	//addvar ang 1024
	showview x y z ang 50 sect1 0 0 319 199
	*/
	
	rotatesprite 0 0 65536 0 7169 0 0 1048 0 0 xdim ydim
	rotatesprite 160 20 65536 0 7158 0 0 1024 0 0 xdim ydim
	
	// LEVEL STATS
	rotatesprite 110 25 65536 0 2951 0 0 0 0 0 xdim ydim
	rotatesprite 120 25 65536 0 2944 0 0 0 0 0 xdim ydim
	rotatesprite 130 25 65536 0 2961 0 0 0 0 0 xdim ydim
	rotatesprite 140 25 65536 0 2944 0 0 0 0 0 xdim ydim
	rotatesprite 150 25 65536 0 2951 0 0 0 0 0 xdim ydim
	
	rotatesprite 165 25 65536 0 2958 0 0 0 0 0 xdim ydim
	rotatesprite 175 25 65536 0 2959 0 0 0 0 0 xdim ydim
	rotatesprite 185 25 65536 0 2940 0 0 0 0 0 xdim ydim
	rotatesprite 195 25 65536 0 2959 0 0 0 0 0 xdim ydim
	rotatesprite 205 25 65536 0 2958 0 0 0 0 0 xdim ydim
	
	//KILLS
	rotatesprite 71 61 65536 0 2950 120 4 0 0 0 xdim ydim
	rotatesprite 81 61 65536 0 2948 120 4 0 0 0 xdim ydim
	rotatesprite 86 61 65536 0 2951 120 4 0 0 0 xdim ydim
	rotatesprite 96 61 65536 0 2951 120 4 0 0 0 xdim ydim
	rotatesprite 106 61 65536 0 2958 120 4 0 0 0 xdim ydim
	rotatesprite 116 56 65536 0 9338 120 4 0 0 0 xdim ydim
	
	rotatesprite 70 60 65536 0 2950 0 0 0 0 0 xdim ydim
	rotatesprite 80 60 65536 0 2948 0 0 0 0 0 xdim ydim
	rotatesprite 85 60 65536 0 2951 0 0 0 0 0 xdim ydim
	rotatesprite 95 60 65536 0 2951 0 0 0 0 0 xdim ydim
	rotatesprite 105 60 65536 0 2958 0 0 0 0 0 xdim ydim
	rotatesprite 115 55 65536 0 9338 0 0 0 0 0 xdim ydim
	
	//OF
	rotatesprite 201 61 65536 0 2954 120 4 0 0 0 xdim ydim
	rotatesprite 211 61 65536 0 2945 120 4 0 0 0 xdim ydim
	rotatesprite 200 60 65536 0 2954 0 0 0 0 0 xdim ydim
	rotatesprite 210 60 65536 0 2945 0 0 0 0 0 xdim ydim
	
	rotatesprite 201 81 65536 0 2954 120 4 0 0 0 xdim ydim
	rotatesprite 211 81 65536 0 2945 120 4 0 0 0 xdim ydim
	rotatesprite 200 80 65536 0 2954 0 0 0 0 0 xdim ydim
	rotatesprite 210 80 65536 0 2945 0 0 0 0 0 xdim ydim
	
	setvar col 4
	getplayer[THISACTOR].actors_killed num
	setvar x 171 setvar y 61 setvarvar tmp num
    modvar tmp 10
    addvar tmp 2930
    rotatesprite x y 65536 0  tmp 120 col 0 0 0 xdim ydim
    addvar x -9
    ifvarg num 9
    {
      setvarvar tmp num
      divvar tmp 10
      modvar tmp 10
      addvar tmp 2930
      rotatesprite x y 65536 0  tmp 120 col 0 0 0 xdim ydim
      addvar x -9
    }
    ifvarg num 99
    {
      setvarvar tmp num
      divvar tmp 100
      addvar tmp 2930
      rotatesprite x y 65536 0  tmp 120 col 0 0 0 xdim ydim
    }
	getplayer[THISACTOR].max_actors_killed num
    setvar x 246 setvar y 61 setvarvar tmp num
    modvar tmp 10
    addvar tmp 2930
    rotatesprite x y 65536 0  tmp 120 col 0 0 0 xdim ydim
    addvar x -9
    ifvarg num 9
    {
      setvarvar tmp num
      divvar tmp 10
      modvar tmp 10
      addvar tmp 2930
      rotatesprite x y 65536 0  tmp 120 col 0 0 0 xdim ydim
      addvar x -9
    }
    ifvarg num 99
    {
      setvarvar tmp num
      divvar tmp 100
      addvar tmp 2930
      rotatesprite x y 65536 0  tmp 120 col 0 0 0 xdim ydim
    }
	
	setvar col 0
	getplayer[THISACTOR].actors_killed num
	setvar x 170 setvar y 60 state drawnumW
	getplayer[THISACTOR].max_actors_killed num
    setvar x 245 setvar y 60 state drawnumW
	
	//SECRETS
	rotatesprite 71 81 65536 0 2958 120 4 0 0 0 xdim ydim
	rotatesprite 81 81 65536 0 2944 120 4 0 0 0 xdim ydim
	rotatesprite 91 81 65536 0 2942 120 4 0 0 0 xdim ydim
	rotatesprite 101 81 65536 0 2957 120 4 0 0 0 xdim ydim
	rotatesprite 111 81 65536 0 2944 120 4 0 0 0 xdim ydim
	rotatesprite 121 81 65536 0 2959 120 4 0 0 0 xdim ydim
	rotatesprite 131 81 65536 0 2958 120 4 0 0 0 xdim ydim
	rotatesprite 141 76 65536 0 9338 120 4 0 0 0 xdim ydim
	
	rotatesprite 70 80 65536 0 2958 0 0 0 0 0 xdim ydim
	rotatesprite 80 80 65536 0 2944 0 0 0 0 0 xdim ydim
	rotatesprite 90 80 65536 0 2942 0 0 0 0 0 xdim ydim
	rotatesprite 100 80 65536 0 2957 0 0 0 0 0 xdim ydim
	rotatesprite 110 80 65536 0 2944 0 0 0 0 0 xdim ydim
	rotatesprite 120 80 65536 0 2959 0 0 0 0 0 xdim ydim
	rotatesprite 130 80 65536 0 2958 0 0 0 0 0 xdim ydim
	rotatesprite 140 75 65536 0 9338 0 0 0 0 0 xdim ydim
	
	setvar col 4
	getplayer[THISACTOR].secret_rooms num
	setvar x 171 setvar y 81 setvarvar tmp num
    modvar tmp 10
    addvar tmp 2930
    rotatesprite x y 65536 0  tmp 120 col 0 0 0 xdim ydim
    addvar x -9
    ifvarg num 9
    {
      setvarvar tmp num
      divvar tmp 10
      modvar tmp 10
      addvar tmp 2930
      rotatesprite x y 65536 0  tmp 120 col 0 0 0 xdim ydim
      addvar x -9
    }
    ifvarg num 99
    {
      setvarvar tmp num
      divvar tmp 100
      addvar tmp 2930
      rotatesprite x y 65536 0  tmp 120 col 0 0 0 xdim ydim
    }
    getplayer[THISACTOR].max_secret_rooms num
    setvar x 246 setvar y 81 setvarvar tmp num
    modvar tmp 10
    addvar tmp 2930
    rotatesprite x y 65536 0  tmp 120 col 0 0 0 xdim ydim
    addvar x -9
    ifvarg num 9
    {
      setvarvar tmp num
      divvar tmp 10
      modvar tmp 10
      addvar tmp 2930
      rotatesprite x y 65536 0  tmp 120 col 0 0 0 xdim ydim
      addvar x -9
    }
    ifvarg num 99
    {
      setvarvar tmp num
      divvar tmp 100
      addvar tmp 2930
      rotatesprite x y 65536 0  tmp 120 col 0 0 0 xdim ydim
    }

	setvar col 0
	getplayer[THISACTOR].secret_rooms num
	setvar x 170 setvar y 80 state drawnumW
    getplayer[THISACTOR].max_secret_rooms num
    setvar x 245 setvar y 80 state drawnumW
	soundonce MOANS
	
	ifvare supersecavaible 1
	{
	//YOU
	rotatesprite 51 111 65536 0 2964 120 4 0 0 0 xdim ydim
	rotatesprite 61 111 65536 0 2954 120 4 0 0 0 xdim ydim
	rotatesprite 71 111 65536 0 2960 120 4 0 0 0 xdim ydim	
	
	rotatesprite 50 110 65536 0 2964 0 2 0 0 0 xdim ydim
	rotatesprite 60 110 65536 0 2954 0 2 0 0 0 xdim ydim
	rotatesprite 70 110 65536 0 2960 0 2 0 0 0 xdim ydim
	
	//FOUND
	rotatesprite 86 111 65536 0 2945 120 4 0 0 0 xdim ydim
	rotatesprite 96 111 65536 0 2954 120 4 0 0 0 xdim ydim
	rotatesprite 106 111 65536 0 2960 120 4 0 0 0 xdim ydim	
	rotatesprite 116 111 65536 0 2953 120 4 0 0 0 xdim ydim	
	rotatesprite 126 111 65536 0 2943 120 4 0 0 0 xdim ydim	
	
	rotatesprite 85 110 65536 0 2945 0 2 0 0 0 xdim ydim
	rotatesprite 95 110 65536 0 2954 0 2 0 0 0 xdim ydim
	rotatesprite 105 110 65536 0 2960 0 2 0 0 0 xdim ydim
	rotatesprite 115 110 65536 0 2953 0 2 0 0 0 xdim ydim
	rotatesprite 125 110 65536 0 2943 0 2 0 0 0 xdim ydim
	
	//A
	rotatesprite 141 111 65536 0 2940 120 4 0 0 0 xdim ydim
	rotatesprite 140 110 65536 0 2940 0 2 0 0 0 xdim ydim
	
	//SUPER
	rotatesprite 156 111 65536 0 2958 120 4 0 0 0 xdim ydim
	rotatesprite 166 111 65536 0 2960 120 4 0 0 0 xdim ydim
	rotatesprite 176 111 65536 0 2955 120 4 0 0 0 xdim ydim
	rotatesprite 186 111 65536 0 2944 120 4 0 0 0 xdim ydim
	rotatesprite 196 111 65536 0 2957 120 4 0 0 0 xdim ydim

	rotatesprite 155 110 65536 0 2958 0 2 0 0 0 xdim ydim
	rotatesprite 165 110 65536 0 2960 0 2 0 0 0 xdim ydim
	rotatesprite 175 110 65536 0 2955 0 2 0 0 0 xdim ydim
	rotatesprite 185 110 65536 0 2944 0 2 0 0 0 xdim ydim
	rotatesprite 195 110 65536 0 2957 0 2 0 0 0 xdim ydim
	
	//SECRET!
	rotatesprite 211 111 65536 0 2958 120 4 0 0 0 xdim ydim
	rotatesprite 221 111 65536 0 2944 120 4 0 0 0 xdim ydim
	rotatesprite 231 111 65536 0 2942 120 4 0 0 0 xdim ydim
	rotatesprite 241 111 65536 0 2957 120 4 0 0 0 xdim ydim
	rotatesprite 251 111 65536 0 2944 120 4 0 0 0 xdim ydim
	rotatesprite 261 111 65536 0 2959 120 4 0 0 0 xdim ydim
	rotatesprite 271 111 65536 0 3004 120 4 0 0 0 xdim ydim
	
	rotatesprite 210 110 65536 0 2958 0 2 0 0 0 xdim ydim
	rotatesprite 220 110 65536 0 2944 0 2 0 0 0 xdim ydim
	rotatesprite 230 110 65536 0 2942 0 2 0 0 0 xdim ydim
	rotatesprite 240 110 65536 0 2957 0 2 0 0 0 xdim ydim
	rotatesprite 250 110 65536 0 2944 0 2 0 0 0 xdim ydim
	rotatesprite 260 110 65536 0 2959 0 2 0 0 0 xdim ydim
	rotatesprite 270 110 65536 0 3004 0 2 0 0 0 xdim ydim
	}
	
	getactorvar[THISACTOR].bodyshield BODYSHIELD_AMOUNT
	getactorvar[THISACTOR].fireshield FIRESHIELD_AMOUNT
	getactorvar[THISACTOR].spiritshield SPIRITSHIELD_AMOUNT
	setvarvar SAVED_BODYSHIELD BODYSHIELD_AMOUNT
	setvarvar SAVED_FIRESHIELD FIRESHIELD_AMOUNT
	setvarvar SAVED_SPIRITSHIELD SPIRITSHIELD_AMOUNT
	
	setarray QUOTES[1] 0
	setarray QUOTES[2] 0
	setarray QUOTES[3] 0
	setarray QUOTES[0] 0 
	
	getinput[THISACTOR].bits tmp
	ifvarg EOL_COUNT 56
	{
		ifvarand tmp 536870916
		{
			setvar EOL_COUNT 0
			setvar EOL_VAR 0
			setvar supersecavaible 0
			setvar TOTALKILLS 0

			ifvare EOL_LEVEL 0
			{
			setvarvar LEVEL_TEMP LEVEL
			addvar LEVEL_TEMP 1 
			} else setvarvar LEVEL_TEMP EOL_LEVEL
			startlevel VOLUME LEVEL_TEMP
		}
	}
}
setvar RETURN 1



ifvare deb_menu 1
{
	redefinequote TEMPQUOTE id
	gametext 9505 10 20 TEMPQUOTE 0 0 1050 0 0 xdim ydim
	digitalnumber 9520 40 20 HITSPRITE 0 pal 1050 0 0 xdim ydim
	ifvarn HITSPRITE -1 getactor[HITSPRITE].xrepeat tmp
	redefinequote TEMPQUOTE pic
	gametext 9505 10 30 TEMPQUOTE 0 0 1050 0 0 xdim ydim
	digitalnumber 9520 40 30 debug_picnum 0 pal 1050 0 0 xdim ydim
	redefinequote TEMPQUOTE cst
	gametext 9505 10 40 TEMPQUOTE 0 0 1050 0 0 xdim ydim
	digitalnumber 9520 40 40 debug_cstat 0 pal 1050 0 0 xdim ydim
	redefinequote TEMPQUOTE ext
	gametext 9505 10 50 TEMPQUOTE 0 0 1050 0 0 xdim ydim
	digitalnumber 9520 40 50 debug_extra 0 pal 1050 0 0 xdim ydim
	redefinequote TEMPQUOTE act
	gametext 9505 10 60 TEMPQUOTE 0 0 1050 0 0 xdim ydim
	digitalnumber 9520 40 60 debug_active 0 pal 1050 0 0 xdim ydim
	redefinequote TEMPQUOTE rx
	gametext 9505 10 70 TEMPQUOTE 0 0 1050 0 0 xdim ydim
	digitalnumber 9520 40 70 debug_rx 0 pal 1050 0 0 xdim ydim
	redefinequote TEMPQUOTE tx
	gametext 9505 10 80 TEMPQUOTE 0 0 1050 0 0 xdim ydim
	digitalnumber 9520 40 80 debug_tx 0 pal 1050 0 0 xdim ydim
	redefinequote TEMPQUOTE s_rx
	gametext 9505 10 90 TEMPQUOTE 0 0 1050 0 0 xdim ydim
	digitalnumber 9520 40 90 deb_se_x 0 pal 1050 0 0 xdim ydim
	redefinequote TEMPQUOTE htex
	gametext 9505 10 100 TEMPQUOTE 0 0 1050 0 0 xdim ydim
	digitalnumber 9520 40 100 deb_htextra 0 pal 1050 0 0 xdim ydim
	redefinequote TEMPQUOTE hit
	gametext 9505 10 110 TEMPQUOTE 0 0 1050 0 0 xdim ydim
	digitalnumber 9520 40 110 deb_hitag 0 pal 1050 0 0 xdim ydim
	redefinequote TEMPQUOTE lot
	gametext 9505 10 120 TEMPQUOTE 0 0 1050 0 0 xdim ydim
	digitalnumber 9520 40 120 deb_lotag 0 pal 1050 0 0 xdim ydim
	redefinequote TEMPQUOTE stn
	gametext 9505 10 130 TEMPQUOTE 0 0 1050 0 0 xdim ydim
	digitalnumber 9520 40 130 deb_statnum 0 pal 1050 0 0 xdim ydim
	redefinequote TEMPQUOTE cstat14
	gametext 9505 10 140 TEMPQUOTE 0 0 1050 0 0 xdim ydim
	digitalnumber 9520 40 140 debug_cs14 0 pal 1050 0 0 xdim ydim
	redefinequote TEMPQUOTE activatedby
	gametext 9505 10 150 TEMPQUOTE 0 0 1050 0 0 xdim ydim
	digitalnumber 9520 60 150 debug_actby 0 pal 1050 0 0 xdim ydim
	digitalnumber 9520 80 20 HUDvx 0 pal 1050 0 0 xdim ydim
	digitalnumber 9520 80 30 deb_y 0 pal 1050 0 0 xdim ydim
	digitalnumber 9520 80 40 deb_z 0 pal 1050 0 0 xdim ydim
	digitalnumber 9520 80 50 pjumphit 0 pal 1050 0 0 xdim ydim
}

ifvare deb_menu 2
{
	redefinequote TEMPQUOTE id
	gametext 9505 10 20 TEMPQUOTE 0 0 1050 0 0 xdim ydim
	digitalnumber 9520 70 20 deb_getid 0 pal 1050 0 0 xdim ydim
	
	redefinequote TEMPQUOTE aistate
	gametext 9505 10 30 TEMPQUOTE 0 0 1050 0 0 xdim ydim
	digitalnumber 9520 70 30 deb_enemytype 0 pal 1050 0 0 xdim ydim
	
	redefinequote TEMPQUOTE aitarget
	gametext 9505 10 40 TEMPQUOTE 0 0 1050 0 0 xdim ydim
	digitalnumber 9520 70 40 deb_targetid 0 pal 1050 0 0 xdim ydim
	
	redefinequote TEMPQUOTE ai_goalang
	gametext 9505 10 50 TEMPQUOTE 0 0 1050 0 0 xdim ydim
	digitalnumber 9520 70 50 deb_movtype 0 pal 1050 0 0 xdim ydim
	ifvarg deb_getid 0 {	
	redefinequote TEMPQUOTE angle
	gametext 9505 10 60 TEMPQUOTE 0 0 1050 0 0 xdim ydim
	digitalnumber 9520 70 60 sprite[deb_getid].ang 0 pal 1050 0 0 xdim ydim
	}
	redefinequote TEMPQUOTE canmove
	gametext 9505 10 70 TEMPQUOTE 0 0 1050 0 0 xdim ydim
	digitalnumber 9520 70 70 deb_hitid 0 pal 1050 0 0 xdim ydim
	
	ifvarg deb_getid 0 {	
	redefinequote TEMPQUOTE extra
	gametext 9505 10 80 TEMPQUOTE 0 0 1050 0 0 xdim ydim
	digitalnumber 9520 70 80 sprite[deb_getid].extra 0 pal 1050 0 0 xdim ydim
	}
	redefinequote TEMPQUOTE ai_losang
	gametext 9505 10 90 TEMPQUOTE 0 0 1050 0 0 xdim ydim
	digitalnumber 9520 70 90 deb_savey 0 pal 1050 0 0 xdim ydim
	
	redefinequote TEMPQUOTE avoiddist
	gametext 9505 10 100 TEMPQUOTE 0 0 1050 0 0 xdim ydim
	digitalnumber 9520 70 100 deb_savex 0 pal 1050 0 0 xdim ydim
	
	redefinequote TEMPQUOTE xvel
	gametext 9505 10 110 TEMPQUOTE 0 0 1050 0 0 xdim ydim
	digitalnumber 9520 70 110 deb_evx 0 pal 1050 0 0 xdim ydim
	
	redefinequote TEMPQUOTE yvel
	gametext 9505 10 120 TEMPQUOTE 0 0 1050 0 0 xdim ydim
	digitalnumber 9520 70 120 deb_evy 0 pal 1050 0 0 xdim ydim
	

	ifvarg deb_getid 0 {	
		showview sprite[deb_getid].x sprite[deb_getid].y sprite[deb_getid].z sprite[deb_getid].ang 100 sprite[deb_getid].sectnum 198 42 285 100
		rotatesprite 240 72 32768 0 7439 0 0 1050 0 0 xdim ydim
	}
		
		
	
}
endevent

onevent EVENT_DISPLAYSBAR
setvar RETURN 1
endevent

onevent EVENT_INVENTORYRIGHT
setvar DISPLAYINVENTORY 1
setvar INVENTORYCHECK 130
ifvare DISPLAYINVENTORY 1
{
  setplayer[THISACTOR].inven_icon 0

  setarray INVARRAY[0] DOCTORSBAGAM
  setarray INVARRAY[1] DIVINGSUITAM
  setarray INVARRAY[2] CRYSTALLBALLAM
  setarray INVARRAY[3] BEASTVISIONAM
  setarray INVARRAY[4] BOOTSOFJUMPINGAM

  setvar temp 0
  whilevarn temp 5
  {
	addvar ICPOSITION 1
	ifvarg ICPOSITION 4 setvar ICPOSITION 0
	ifvarg INVARRAY[ICPOSITION] 0 setvar temp 4
	addvar temp 1
  }
}
setvar RETURN -1
endevent

onevent EVENT_INVENTORYLEFT
setvar DISPLAYINVENTORY 1
setvar INVENTORYCHECK 130
ifvare DISPLAYINVENTORY 1
{
  setplayer[THISACTOR].inven_icon 0

  setarray INVARRAY[0] DOCTORSBAGAM
  setarray INVARRAY[1] DIVINGSUITAM
  setarray INVARRAY[2] CRYSTALLBALLAM
  setarray INVARRAY[3] BEASTVISIONAM
  setarray INVARRAY[4] BOOTSOFJUMPINGAM

  setvar temp 0
  whilevarn temp 5
  {
	subvar ICPOSITION 1
	ifvarl ICPOSITION 0 setvar ICPOSITION 4
	ifvarg INVARRAY[ICPOSITION] 0 setvar temp 4
	addvar temp 1
  }

}
setvar RETURN -1
endevent