begin A1_DAT_SRT_CoE_Gen

Float PosX
Float PosY
Float DXY
Short 	Q

Set PosX to "A1_DAT_SRT_RecPosX"
Set PosY to "A1_DAT_SRT_RecPosY"

If ( PosY < 0.1 )
	If ( PosY > -0.1 )
	Set DXY to ( PosX * 100 ) 
Else
	Set DXY to ( PosX / PosY )
	Endif
Else
	Set DXY to ( PosX / PosY )
Endif

If ( PosY >= 0 )
	If ( DXY < -2 )
		Set Q to 7
ElseIf ( DXY < -0.5 )
	Set Q to 8
ElseIf ( DXY < 0.5 )
	Set Q to 1
ElseIf ( DXY < 2 )
	Set Q to 2
Else
	Set Q to 3
	Endif
Endif

If ( PosY < 0 )
	If ( DXY < -2 )
		Set Q to 3
ElseIf ( DXY < -0.5 )
	Set Q to 4
ElseIf ( DXY < 0.5 )
	Set Q to 5
ElseIf ( DXY < 2 )
	Set Q to 6
Else
	Set Q to 7
	Endif
Endif


MessageBox "Loading: 0 percent done"

ToggleGodMode	; make sure the player survives
ToggleMenus  		; hide menu flicker

If ( Q == 1 )
	CoE 0 27
ElseIf ( Q == 2 )
	CoE 16 16
ElseIf ( Q == 3 )
	CoE 23 0
ElseIf ( Q == 4 )
	CoE 16 -16
ElseIf ( Q == 5 )
	CoE 0 -17
ElseIf ( Q == 6 )
	CoE -9 9
ElseIf ( Q == 7 )
	CoE -11 0
ElseIf ( Q == 8 )
	CoE -27 27
Endif

ToggleMenus
MessageBox "Loading: 20 percent done"
ToggleMenus

StartScript "A1_DAT_SRT_CoE_App"

StopScript  "A1_DAT_SRT_CoE_Gen"

End