; Hud script for Lo-Res Rain demo
; By S.J. Monks Mon 11-20-1995

Buffer 8000
Scale 1

; Declaration of hud modes - taken from C file, newpit.h

DEFINE NH_NONE	NH_TAKEOFF NH_LANDING NH_A2A NH_A2G NH_NAV NH_REFUEL


DefProc DrawTerprom
	Box WIDTH 17 HEIGHT 7
EndProc


DefProc DrawVVector
	MoveBy -5 1
	DrawBy 10 0
	DrawBy -5 -2
	DrawBy -5 2

	If abrk = 1
		If flash < 25
			MoveBy 0 -3
			DrawBy 5 -2
			DrawBy 5 2
		EndIf
	EndIf
EndProc

DefProc DrawLeftCaret
	MoveBy -3 -3
	DrawBy 3 3
	DrawBy -3 3
EndProc

DefProc DrawRightCaret
	MoveBy 3 -3
	DrawBy -3 3
	DrawBy 3 3
EndProc

DefProc DoAltimeter
	Draw 50 -25 0 50 Pattern 43690
	VBar At 50 0 \
		Width 5 Height 50 \
		Max 0 Min 80000 \
		Show alt Using DrawLeftCaret
	Unclip

	VBar At 50 0 \
		Width 5 Height 50 \
		Max 0 Min 1000 \
		Show alt Mod 1000
		DrawBy -5 0
	Unclip

	Box at 50 29 Width 28 Height 8
	Meter at 50 31 Align CENTRE Show alt Round 100 Fmt "05.0"

EndProc

DefProc DoAOA
	Draw -50 -25 0 50 Pattern 43690
	VBar At -50 0 \
		Width 5 Height 50 \
		Max 90 Min -90 \
		Show AOA Using DrawRightCaret
	Unclip
EndProc


DefProc DoSpeed
	Box at -51 29 Width 22 Height 8
	If machspd < 1.0
		Meter At -50 31 Align CENTRE Show spd Fmt "03.0"
	Endif
	If machspd >= 1.0
		Meter At -50 31 Align CENTRE Show machspd Prefix "M" Fmt "02.01"
	Endif
EndProc

DefProc DoWepRange
	DotClock at 0 0 \
		Show ERANGE \
		Count 60 \
		Radius 35 \
		Max WEPMAX \
		Start 0 Stop 65536

;	Hand at 0 0 \
;		Show ERANGE \
;		Count 60 \
;		Radius 45 \
;		IRad 40 \
;		Max 100 \
;		Start 0 Stop 65536

EndProc



DefProc RPMMeter
	DotClock at 120 60 \
		Show rpm \
		Count 20 \
		Radius 20 \
		Max 100 \
		Start 0 Stop 65536

	Hand at 120 60 \
		Show rpm \
		Count 20 \
		Radius 20 \
		Max 100 \
		Start 0 Stop 65536

	Draw 120 60 0 -20

	Draw 145 40 0 40 Pattern 43690

	VBar At 150 60 \
		Width 5 Height 40 \
		Max 0 Min 100 \
		Show FUEL

	DrawBy -3 0
	MoveBy 3 0
	DrawTo 150 80
	Unclip

	If flash < 25
		If FUEL <= 20
			If FUEL > 0
				Print "FUEL LOW" At 120 30 Align Centre
			EndIf
			If FUEL <= 0
				Print "OUT OF FUEL" At 120 30 Align Centre
			EndIf
		EndIf
	EndIf
EndProc


DefProc DoCompass
	Circle at -110 50 Radius 35 Count 20
	Circle at -110 50 Radius 25 Count 20
	Circle at -110 50 Radius 15 Count 20

	Hand at -110 50 \
		Show AY \
		Count 60 \
		Radius 40 \
		IRad 40 \
		Max 65354 \
		Start 0 Stop -65536

	MoveBy -1 2
	Print "N"

	Hand at -110 50 \
		Show AY \
		Count 60 \
		Radius 40 \
		IRad 40 \
		Max 65354 \
		Start -16384 Stop -81920

	MoveBy -1 2
	Print "W"

	Hand at -110 50 \
		Show AY \
		Count 60 \
		Radius 40 \
		IRad 40 \
		Max 65354 \
		Start -49152 Stop -114688

	MoveBy -1 2
	Print "E"

	Hand at -110 50 \
		Show AY \
		Count 60 \
		Radius 40 \
		IRad 40 \
		Max 65354 \
		Start 32768 Stop -32768

	MoveBy -1 2
	Print "S"

	Meter at -112 0 Align RIGHT Show PX Fmt "03.0"
	Meter at -108 0 Align LEFT Show PZ Fmt "03.0"
	Box at -111 -2 Width 36 Height 9

	Call DoRadar at -110 50 Radius 35
EndProc

DefProc DoArtiHori
	Hand at 0 0 \
		Show AZ \
		Count 200 \
		Radius 70 \
		IRad 40 \
		Max 65536 \
		Start 16384 Stop 81920

	Hand at 0 0 \
		Show AZ \
		Count 200 \
		Radius 70 \
		IRad 40 \
		Max 65536 \
		Start 49152 Stop 114688
EndProc




DefProc DoA2AHud
	Circle at 0 0 Width 40 Height 40
	Call DoTracking
	Proc DoWepRange
EndProc

DefProc DoA2GHud

	DotClock at 0 0 \
		Show AZ \
		Count 60 \
		Radius 40 \
		Max 65354 \
		Start 0 Stop 65536

EndProc



Hud at 160 100 Width 319 Height 199
Font "hudfont" 8
SetColour 15


If mode = NH_A2A
	Proc DoA2AHud
Endif
If mode = NH_A2G
	Proc DoA2GHud
Endif

Call DoTerprom
Proc DrawTerprom
Call DoVVector
Proc DrawVVector

Proc DoAltimeter
Proc DoAOA
Proc DoSpeed
Proc DoArtiHori
Proc DoCompass

;Heading at 0 60 Show hdg Width 100 Height 18 COUNT 9
;SetClip At 0 0 Width 100 Height 100
;Call DoLadders
Proc RPMMeter
End
