
// HUD CODE FOR BLACK SHADOW 2


state shadepulse
setvarvar temp timer
shiftvarl temp 7
sin tempb temp
shiftvarr tempb 10
setvarvar shade tempb
ends


onevent EVENT_DISPLAYREST

ifvarn player[THISACTOR].newowner -1 break

getplayer[THISACTOR].airleft tempb
getplayer[THISACTOR].scuba_on tempc
ifvarl tempb 390 ifvarg tempb 0 ifvare tempc 0
{
	setvar digy 10
	setvar digx 30
	setvar digz 16384
	setvar orientation 256
	setvar pal 1
	
	
	divvar tempb 4
	setvarvar tempc digx
	addvarvar tempc tempb
	setvar temp 0
	whilevarn temp 1
	{
		  ifvarvarg digx tempc setvar temp 1
		  rotatesprite digx digy digz 0 199 0 pal orientation 0 0 xdim ydim
		  addvar digx 1
		  break
	}
	setvar pal 0
	setvar digz 32768
	setvar digx 20
	setvar picnum 2868
    rotatesprite digx digy digz 0 picnum 0 pal orientation 0 0 xdim ydim
    setvar picnum 2839
    setvar digx 24
    setvar digz 20480
    rotatesprite digx digy digz 0 picnum 0 pal orientation 0 0 xdim ydim
}



setuserdef[THISACTOR].screen_size 0
// HEALTH DISPLAY

rotatesprite 11 186 49152 0 COLA 0 4 289 0 0 xdim ydim
rotatesprite 10 185 49152 0 COLA 0 0 256 0 0 xdim ydim

getplayer[screenpeek].i temp
getactor[temp].extra tempb
digitalnumber 2930 46 191 tempb 0 4 289 0 0 xdim ydim
digitalnumber 2930 45 190 tempb 0 2 256 0 0 xdim ydim

rotatesprite 60 188 32768 0 3008 0 2 256 0 0 xdim ydim

getplayer[screenpeek].max_player_health tempb
digitalnumberz 2930 74 191 tempb 0 2 256 0 0 xdim ydim 32768


// ARMOR DISPLAY
getplayer[screenpeek].shield_amount temp
ifvarg temp 0
{
	ifvarg helmflash 0 ifvarand timer 1 setvar pal 6
	else setvar pal 0
	rotatesprite 91 184 32768 0 SHIELD 0 4 289 0 0 xdim ydim
	rotatesprite 90 183 32768 0 SHIELD 0 pal 256 0 0 xdim ydim
	
	digitalnumber 2930 125 191 temp 0 4 289 0 0 xdim ydim
	digitalnumber 2930 124 190 temp 0 pal 256 0 0 xdim ydim
}

// AMMO DISPLAY FOR CURRENT WEAPON

setvar pal 23
getplayer[screenpeek].curr_weapon temp
ifvare temp 10 setvar temp 5
ifvarg temp 0
{
	setvar x 241
	setvar z 24576
	switch temp
	case 1 
	getplayer[screenpeek].ammo_amount 1 tempb
	addvar x 5
	subvar z 8192
	setvar picnum AMMO
	break
	
	case 2
	getplayer[screenpeek].ammo_amount 2 tempb
	setvar picnum SHOTGUNAMMO
	addvar x 10
	break
	
	case 3 	
	getplayer[screenpeek].ammo_amount 3 tempb
	setvar picnum BATTERYAMMO
	subvar z 4096
	addvar x 5
	break
	
	case 4 
	getplayer[screenpeek].ammo_amount 4 tempb
	setvar picnum RPGAMMO
	subvar z 8192
	addvar x 10
	break
	
	case 5
	setvar picnum HBOMBAMMO
	getplayer[screenpeek].ammo_amount 5 tempb
	subvar z 4096
	addvar x 10
	break
	
	case 6
	getplayer[screenpeek].ammo_amount 6 tempb
	setvar picnum CRYSTALAMMO
	addvar x 10
	break
	
	case 7 setvar picnum DEVISTATORAMMO
	getplayer[screenpeek].ammo_amount 7 tempb
	addvar x 5
	break
	
	case 8 setvar picnum TRIPBOMBSPRITE
	getplayer[screenpeek].ammo_amount 8 tempb
	addvar z 8192
	addvar x 10
	break
	
	case 9 setvar picnum FREEZEAMMO
	getplayer[screenpeek].ammo_amount 9 tempb
	addvar x 5
	addvar z 8192
	break
	
	case 11 setvar picnum GROWAMMO
	getplayer[screenpeek].ammo_amount 11 tempb
	addvar x 5
	break
	default break
	endswitch
	
	rotatesprite x 186 z 0 picnum 0 4 545 0 0 xdim ydim
	subvar x 1
	rotatesprite x 185 z 0 picnum 0 0 512 0 0 xdim ydim
	
	digitalnumber 2930 281 191 tempb 0 4 545 0 0 xdim ydim
	digitalnumber 2930 280 190 tempb 0 pal 512 0 0 xdim ydim
	
	rotatesprite 295 188 32768 0 3008 0 pal 512 0 0 xdim ydim
	getplayer[screenpeek].max_ammo_amount temp tempc
	digitalnumberz 2930 310 191 tempc 0 pal 512 0 0 xdim ydim 32768	
}

// MINI AMMO DISPLAY FOR ALL WEAPONS

ifvare player[screenpeek].gotweapon 1 YES
{
	getplayer[THISACTOR].ammo_amount 1 temp
	ifvare temp 0 setvar orientation 289 else setvar orientation 256
	ifvare CURRWEAP 1 setvar pal 6 else setvar pal 0
	rotatesprite 18 195 12288 0 FIRSTGUNSPRITE 0 pal orientation 0 0 xdim ydim
	digitalnumberz 2837 26 196 temp 0 7 orientation 0 0 xdim ydim 24576
}
ifvare player[screenpeek].gotweapon 2 YES
{
	getplayer[THISACTOR].ammo_amount 2 temp
	ifvare temp 0 setvar orientation 289 else setvar orientation 256
	ifvare CURRWEAP 2 setvar pal 6 else setvar pal 0
	rotatesprite 37 196 8192 0 SHOTGUNSPRITE 0 pal orientation 0 0 xdim ydim
	digitalnumberz 2837 46 196 temp 0 7 orientation 0 0 xdim ydim 24576
}
ifvare player[screenpeek].gotweapon 3 YES
{
	getplayer[screenpeek].ammo_amount 3 temp
	ifvarl temp 1 setvar orientation 289 else setvar orientation 256
	ifvare CURRWEAP 3 setvar pal 6 else setvar pal 0
	rotatesprite 57 195 9216 0 CHAINGUNSPRITE 0 pal orientation 0 0 xdim ydim
	digitalnumberz 2837 66 196 temp 0 7 orientation 0 0 xdim ydim 24576
}
ifvare player[THISACTOR].gotweapon 4 YES
{
	getplayer[screenpeek].ammo_amount 4 temp
	ifvare temp 0 setvar orientation 289 else setvar orientation 256
	ifvare CURRWEAP 4 setvar pal 6 else setvar pal 0
	rotatesprite 78 195 10240 0 RPGSPRITE 0 pal orientation 0 0 xdim ydim
	digitalnumberz 2837 86 196 temp 0 7 orientation 0 0 xdim ydim 24576
}
ifvare player[screenpeek].gotweapon 5 YES
{
	getplayer[THISACTOR].ammo_amount 5 temp
	ifvare temp 0 setvar orientation 289 else setvar orientation 256
	ifvare CURRWEAP 5 setvar pal 6 else setvar pal 0
	rotatesprite 95 195 5120 0 HEAVYHBOMB 0 pal orientation 0 0 xdim ydim
	digitalnumberz 2837 102 196 temp 0 7 orientation 0 0 xdim ydim 24576
}
ifvare player[screenpeek].gotweapon 6 YES
{
	getplayer[THISACTOR].ammo_amount 6 temp
	ifvare temp 0 setvar orientation 289 else setvar orientation 256
	ifvare CURRWEAP 6 setvar pal 6 else setvar pal 0
	rotatesprite 114 195 9216 0 SHRINKERSPRITE 0 pal orientation 0 0 xdim ydim
	digitalnumberz 2837 124 196 temp 0 7 orientation 0 0 xdim ydim 24576
}
ifvare player[screenpeek].gotweapon 7 YES
{
	getplayer[screenpeek].ammo_amount 7 temp
	ifvare temp 0 setvar orientation 289 else setvar orientation 256
	ifvare CURRWEAP 7 setvar pal 6 else setvar pal 0
	rotatesprite 134 196 10240 0 DEVISTATORSPRITE 0 pal orientation 0 0 xdim ydim
	digitalnumberz 2837 142 196 temp 0 7 orientation 0 0 xdim ydim 24576
}
ifvare player[screenpeek].gotweapon 8 YES
{
	getplayer[screenpeek].ammo_amount 8 temp
	ifvare temp 0 setvar orientation 289 else setvar orientation 256
	ifvare CURRWEAP 8 setvar pal 6 else setvar pal 0
	rotatesprite 150 196 12288 0 TRIPBOMBSPRITE 0 pal orientation 0 0 xdim ydim
	digitalnumberz 2837 157 196 temp 0 7 orientation 0 0 xdim ydim 24576
}
ifvare player[screenpeek].gotweapon 9 YES
{
	getplayer[screenpeek].ammo_amount 9 temp
	ifvare temp 0 setvar orientation 289 else setvar orientation 256
	ifvare CURRWEAP 9 setvar pal 6 else setvar pal 0
	rotatesprite 166 195 8192 0 FREEZESPRITE 0 pal orientation 0 0 xdim ydim
	digitalnumberz 2837 174 196 temp 0 7 orientation 0 0 xdim ydim 24576
}

ifvare player[screenpeek].gotweapon 11 YES
{
	getplayer[screenpeek].ammo_amount 11 temp
	ifvare temp 0 setvar orientation 289 else setvar orientation 256
	ifvare CURRWEAP 11 setvar pal 6 else setvar pal 0
	rotatesprite 183 196 8192 0 GROWSPRITEICON 0 pal orientation 0 0 xdim ydim
	digitalnumberz 2837 192 196 temp 0 7 orientation 0 0 xdim ydim 24576
}


// INVENTORY DISPLAY


// getplayer[screenpeek].firstaid_amount temp
// ifvarg temp 0
// {
// 	ifvare invicon 1 setvar orientation 256 else setvar orientation 257
// 	rotatesprite 12 50 10240 0 FIRSTAID 0 4 289 0 0 xdim ydim
// 	ifvare invicon 1
// 	rotatesprite 12 50 49152 0 20 0 0 256 0 0 xdim ydim
// 	rotatesprite 11 49 10240 0 FIRSTAID 0 0 orientation 0 0 xdim ydim
// 	digitalnumberz 2837 13 56 player[THISACTOR].firstaid_amount 0 0 orientation 0 0 xdim ydim 32768
// 	ifvare invicon 1 ifvarg invmsg 0 
// 	gametextz 2822 40 50 3 0 0 orientation 0 0 xdim ydim 32768
// }

// getplayer[THISACTOR].steroids_amount temp
// ifvarg temp 0
// {
// 	ifvare invicon 2 setvar orientation 256 else setvar orientation 257
// 	rotatesprite 12 66 16384 0 STEROIDS 0 4 289 0 0 xdim ydim
// 	ifvare invicon 2 
// 	rotatesprite 12 65 49152 0 20 0 0 256 0 0 xdim ydim
// 	rotatesprite 11 65 16384 0 STEROIDS 0 0 orientation 0 0 xdim ydim
// 	shiftvarr temp 2
// 	digitalnumberz 2837 13 71 temp 0 0 orientation 0 0 xdim ydim 32768
// 	ifvare invicon 2 ifvarg invmsg 0 
// 	gametextz 2822 40 65 37 0 0 orientation 0 0 xdim ydim 32768
// 	
// }
// getplayer[screenpeek].holoduke_amount temp
// ifvarg temp 0
// {
// 	ifvare invicon 3 setvar orientation 256 else setvar orientation 257
// 	rotatesprite 12 80 10240 0 HOLODUKE 0 4 289 0 0 xdim ydim
// 	ifvare invicon 3 
// 	rotatesprite 12 80 49152 0 20 0 0 256 0 0 xdim ydim
// 	rotatesprite 11 79 10240 0 HOLODUKE 0 0 orientation 0 0 xdim ydim
// 	divvar temp 24
// 	digitalnumberz 2837 13 86 temp 0 0 orientation 0 0 xdim ydim 32768
// 	ifvare invicon 3 ifvarg invmsg 0 
// 	gametextz 2822 40 80 91 0 0 orientation 0 0 xdim ydim 32768	
// }
// getplayer[screenpeek].jetpack_amount temp
// ifvarg temp 0
// {
// 	ifvare invicon 4 setvar orientation 256 else setvar orientation 257
// 	rotatesprite 12 95 16384 0 JETPACK 0 4 289 0 0 xdim ydim
// 	ifvare invicon 4 
// 	rotatesprite 12 95 49152 0 20 0 0 256 0 0 xdim ydim
// 	rotatesprite 11 94 24576 0 JETPACK 0 0 orientation 0 0 xdim ydim
// 	shiftvarr temp 4
// 	digitalnumberz 2837 13 101 temp 0 0 orientation 0 0 xdim ydim 32768
// 	ifvare invicon 4 ifvarg invmsg 0 
// 	gametextz 2822 40 95 88 0 0 orientation 0 0 xdim ydim 32768
// }
// getplayer[screenpeek].heat_amount temp
// ifvarg temp 0
// {
// 	ifvare invicon 5 setvar orientation 256 else setvar orientation 257
// 	rotatesprite 12 110 24576 0 HEATSENSOR 0 4 289 0 0 xdim ydim
// 	ifvare invicon 5 
// 	rotatesprite 12 110 49152 0 20 0 0 256 0 0 xdim ydim
// 	rotatesprite 11 109 24576 0 HEATSENSOR 0 0 orientation 0 0 xdim ydim
// 	divvar temp 12
// 	digitalnumberz 2837 13 116 temp 0 0 orientation 0 0 xdim ydim 32768
// 	ifvare invicon 5 ifvarg invmsg 0 
// 	gametextz 2822 40 110 101 0 0 orientation 0 0 xdim ydim 32768
// }
// getplayer[screenpeek].scuba_amount temp
// ifinwater
// ifvarg temp 0
// {
// 	ifvare invicon 6 setvar orientation 256 else setvar orientation 257
// 	rotatesprite 12 125 12288 0 AIRTANK 0 4 289 0 0 xdim ydim
// 	ifvare invicon 6 
// 	rotatesprite 12 125 49152 0 20 0 0 256 0 0 xdim ydim
// 	rotatesprite 11 124 12288 0 AIRTANK 0 0 orientation 0 0 xdim ydim
// 	shiftvarr temp 6
// 	digitalnumberz 2837 13 131 temp 0 0 orientation 0 0 xdim ydim 32768
// 	ifvare invicon 6 ifvarg invmsg 0 
// 	gametextz 2822 40 125 39 0 0 orientation 0 0 xdim ydim 32768
// }
// getplayer[screenpeek].boot_amount temp
// ifvarg temp 0
// ifvarg bootsinuse 0
// {
// 	ifvare invicon 7 setvar orientation 256 else setvar orientation 257
// 	rotatesprite 12 140 20480 0 BOOTS 0 4 289 0 0 xdim ydim
// 	ifvare invicon 7 
// 	rotatesprite 12 140 49152 0 20 0 0 256 0 0 xdim ydim
// 	ifvarand timer 1
// 	ifvarg bootsinuse 20
// 	setvar pal 6 else setvar pal 0
// 	rotatesprite 11 139 20480 0 BOOTS 0 pal orientation 0 0 xdim ydim
// 	shiftvarr temp 1
// 	digitalnumberz 2837 13 146 temp 0 0 orientation 0 0 xdim ydim 32768
// 	ifvare invicon 7 ifvarg invmsg 0 
// 	gametextz 2822 40 140 6 0 0 orientation 0 0 xdim ydim 32768
// }
// ifvarn player[THISACTOR].got_access 0
// {
// 	ifvarand player[THISACTOR].got_access 1 rotatesprite 150 182 20480 0 ACCESSCARD 0 0 256 0 0 xdim ydim
// 	ifvarand player[THISACTOR].got_access 2 rotatesprite 153 184 20480 0 ACCESSCARD 0 21 256 0 0 xdim ydim
// 	ifvarand player[THISACTOR].got_access 4 rotatesprite 156 186 20480 0 ACCESSCARD 0 23 256 0 0 xdim ydim
// }

ifvarn scannedsprite -1
{
	ifvare actorvar[scannedsprite].monstatus 1
	{
		setvar temp 114 setvar pal 0
		getactor[scannedsprite].picnum picnum
		switch picnum
		case PIGCOP setvar temp 126 setvar pal 2 break // DEAD HENCHMAN
		case OCTABRAIN setvar temp 127 setvar pal 2 break // GUARDIAN
		case SHARK setvar temp 128 setvar pal 7 break // SHADEMER
                case FORMLESS setvar temp 99 setvar pal 2 break // FORMLESS
		case BOWMAN setvar temp 130 setvar pal 2 break // BOWMAN
		endswitch
		
		// name of character
		gametext 2908 320 170 temp 0 pal 0 0 0 xdim ydim
		
		// life bar
		getactor[scannedsprite].extra tempb
		getactorvar[scannedsprite].inithp inithp
		ifvarg inithp 2999 shiftvarr tempb 4 else
		ifvarg inithp 999 shiftvarr tempb 3 else
		ifvarg inithp 499 shiftvarr tempb 2 else
		ifvarg inithp 49 shiftvarr tempb 1
		setvar x 160
		setvarvar temp tempb
		shiftvarr temp 1
		subvarvar x temp
		setvar z 32768
		
		
		setvarvar tempc x
		addvarvar tempc tempb
		setvar temp 0
		setvarvar digx x
		subvar x 2
		rotatesprite x 178 z 0 3330 0 pal 0 0 0 xdim ydim
		addvar x 2
		whilevarn temp 1
		{
			 ifvarvarg x tempc setvar temp 1
			 else
			 rotatesprite x 178 z 0 3331 0 pal 0 0 0 xdim ydim
			 addvar x 2
			 break
		}
		subvar x 2
		rotatesprite x 178 z 0 3332 0 pal 0 0 0 xdim ydim
	}
}

//GOLD DISPLAY...
gametextz 2908 10 10 102 0 7 256 0 0 xdim ydim 32768
digitalnumberz 2930 80 10 pgold 0 7 256 0 0 xdim ydim 32768


gametextz 2908 10 20 105 0 1 256 0 0 xdim ydim 32768
// temp is the starting xp for current level
// tempb is the ending xp for current level

ifvare plevel 0 setvar temp 0 else
{
	setvarvar tempb plevel
	subvar tempb 1
	setvarvar temp xpcaps[tempb]
}
setvarvar tempb xpcaps[plevel]
setvarvar tempc xp

subvarvar tempb temp // xp range
subvarvar tempc temp // distance from start xp
mulvar tempc 50
divvarvar tempc tempb // percentage of range completed divided by two

setvar z 16384
// bar is 50 pixels across
setvar x 15
setvar mx 65
addvarvar tempc x

setvar flag 0
ifvarvarg tempc x setvar orientation 256 else setvar orientation 289
setvar pal 1
rotatesprite 14 25 z 0 3330 0 pal orientation 0 0 xdim ydim
whilevarn flag 1
{
	ifvarvarg x tempc setvar orientation 289
	ifvarvarg x mx setvar flag 1
	else
	rotatesprite x 25 z 0 3331 0 pal orientation 0 0 xdim ydim
	addvar x 1
	break
}
subvar x 1
rotatesprite x 25 z 0 3332 0 pal orientation 0 0 xdim ydim
digitalnumberz 2930 10 27 plevel 0 pal 256 0 0 xdim ydim 32768 // 24576

	
endevent

onevent EVENT_DISPLAYCROSSHAIR
ifvarg shieldup 0 setvar RETURN -1
endevent

onevent EVENT_DRAWWEAPON

ifvarl CURRWEAP 2
{
	setvar RETURN -1
	
	rotatesprite weapx weapy weapzoom weapang weapframe weapshade weapal weaporient 0 0 xdim ydim
	
	ifvare CURRWEAP 0
	{
		setvar x 200
		setvar y 315
		subvarvar x looking_angSR1
		addvarvar y looking_arc
		subvarvar y gun_pos
		addvarvar x weapon_xoffset
		
		ifvare leftpunch 0 // draw left fist in idle position
		{
			subvar x 200
			rotatesprite x y weapzoom 768 weapframe weapshade weapal 4 0 0 xdim ydim
		}
		else // draw right fist in idle position
		{
			addvar x 120
			rotatesprite x y weapzoom 256 weapframe weapshade weapal 0 0 0 xdim ydim
		}
	}
	
// 	ifvare CURRWEAP 1 // display shield
// 	ifvare gotshield YES
// 	{
// 		setvar x 50
// 		setvar y 300
// 		setvar z 65536
// 		setvar temp 0
// 		setvar angvar 1920
// 		subvarvar x looking_angSR1
// 		addvarvar y looking_arc
// 		subvarvar y gun_pos
// 		addvarvar x weapon_xoffset
// 		switch shieldup
// 		case 1 setvar angvar 0 addvar x 15 subvar y 15 break
// 		case 2 setvar angvar 0 addvar x 30 subvar y 30 break
// 		case 3 setvar angvar 0 addvar x 45 subvar y 45 break
// 		case 4 setvar angvar 0 addvar x 60 subvar y 60 break
// 		case 5 setvar angvar 0 addvar x 75 subvar y 75 break
// 		case 6 setvar angvar 0 addvar x 90 subvar y 90 break
// 		endswitch
// 		rotatesprite x y z angvar SHIELD_BLOCKER weapshade weapal temp 0 0 xdim ydim
// 	}
}

endevent

