 
sub FORMSHOW_FORM_MULTIPLAYER
 
EndSub
 
 
sub BUTTONCLICK_BTN_MAIN_MULTIPLAYER
 
EndSub
 
 
sub BUTTONCLICK_BTN_FORM_OPTIONS_NICKNAME
    HideFOrm OPTIONS,1
    ShowForm FORM_OPTIONS_NICKNAME,1
EndSub
 
 
sub BUTTONCLICK_BTNBACK_FORMOPTIONS_NICKNAME
    HideForm FORM_OPTIONS_NICKNAME,1
    ShowForm OPTIONS,1
EndSub
 
 


sub Init
    TrackSelected = 0
 MaxTracks = 4
 VehicleSelected  = 0
 MaxVehicles = 5
 SkillLevel    = 0

 ShowForm FORM_GOTOMENU,0
EndSub


 

 
; reload menu forms at the 'in game' exit 
 
sub BUTTONCLICK_BTN_MBOX_EXITGAME_YES
  
    HideForm MESSAGEBOX_EXITGAME,0
 
    CloseForm FORM_INGAME
   
EndSub


sub FORMSHOW_FORM_GOTOMENU
 GotoMenuLoadingCounter = 0
EndSub

 
sub FORMTICK_FORM_GOTOMENU

 
 SetObjectValue PGB_GOTOMENU,GotoMenuLoadingCounter

    if GotoMenuLoadingCounter = 1
 endif

    if GotoMenuLoadingCounter = 2
  LoadForm OPTIONS
 endif
 
    if GotoMenuLoadingCounter = 3
  LoadForm SELECT_TRACK
 endif
 
    if GotoMenuLoadingCounter = 4
  LoadForm SELECT_VEHICLE
 endif
 
    if GotoMenuLoadingCounter = 5
  LoadForm MESSAGEBOX_NEWGAME
 endif
 
    if GotoMenuLoadingCounter = 6
  LoadForm FORM_CHOOSESECTOR
  LoadForm FORM_MULTIPLAYER
  
 endif
 
if GotoMenuLoadingCounter = 7
LoadForm FORM_CHOOSESERVER
endif

if GotoMenuLoadingCounter = 8
  LoadForm FORMMAIN
endif
 
  if GotoMenuLoadingCounter = 9
  HideForm FORM_GOTOMENU,1
  ShowForm FORMMAIN,1
 endif
   
   
   GotoMenuLoadingCounter = GotoMenuLoadingCounter + 1

 EndSub


 
sub FORMSHOW_SELECT_TRACK
    call ShowSelectedTrack
EndSub
 

 
sub FORMSHOW_SELECT_VEHICLE
    call ShowSelectedVehicle
EndSub 
 
sub FORMSHOW_INGAME
 
EndSub

sub FORMSHOW_FORM_CONGRATULATIONS
    SndFinal = LoadSound "final.wav"
 PlaySound SndFinal,0
endsub

 

 
sub BUTTONCLICK_BTN_RESET_GAME
    ShowForm MESSAGEBOX_NEWGAME,0
endsub



 
sub BUTTONCLICK_BTN_PREV_TRACK
    TrackSelected = TrackSelected - 1
 if TrackSelected < 0
     TrackSelected = 0
 endif
    call ShowSelectedTrack
EndSub
 
 
sub BUTTONCLICK_BTN_NEXT_TRACK
    TrackSelected = TrackSelected + 1
 if TrackSelected >= MaxTracks - 1
     TrackSelected = MaxTracks - 1
 endif
    call ShowSelectedTrack
EndSub


sub BUTTONCLICK_BTN_SELTRACK_BACK
    HideForm SELECT_TRACK,1
 ShowForm SELECT_VEHICLE,1
endSub

   
 
sub BUTTONCLICK_BTN_VEHICLE_PREV
    VehicleSelected = VehicleSelected - 1
 if VehicleSelected < 0
     VehicleSelected = 0
 endif
     call ShowSelectedVehicle
EndSub
 
 
sub BUTTONCLICK_BTN_VEHICLE_NEXT
 
    VehicleSelected = VehicleSelected + 1
 if VehicleSelected >= MaxVehicles
     VehicleSelected = MaxVehicles-1
 endif
     call ShowSelectedVehicle
 
EndSub

sub BUTTONCLICK_BTN_CONGRATULATIONS_BACK
    CloseForm FORM_CONGRATULATIONS
 ShowForm  FORM_GOTOMENU,0
endsub 
 
 
 
 

sub BUTTONCLICK_BTN_OPTIONS_BACK
  HideForm OPTIONS,1
  ShowForm FORMMAIN,1
EndSub
 
 
 
sub BUTTONCLICK_BTN_CENTER_OK
 
EndSub
 
sub BUTTONCLICK_BTN_CENTER_BACK
  HideForm FORMMAIN,1
  ShowForm OPTIONS,1
EndSub
 
 
 
sub BUTTONCLICK_BTN_MAIN_OPTIONS
  HideForm FORMMAIN,1
  ShowForm OPTIONS,1
EndSub
 
 
sub BUTTONCLICK_BTN_MAIN_PRACTICE
  HideForm FORMMAIN,1
  ShowForm SELECT_VEHICLE,1
EndSub

sub BUTTONCLICK_BTN_MAIN_CAREER
   HideForm FORMMAIN,1
   ShowForm SELECT_VEHICLE,1
EndSub
 
 
 
sub BUTTONCLICK_BTN_MAIN_CONGAME
 
EndSub
  
 
 
  
sub BUTTONCLICK_BTN_MENU
    ShowForm MESSAGEBOX_EXITGAME,0
EndSub



sub BUTTONCLICK_BTN_MBOX_EXITGAME_NO
    HideForm MESSAGEBOX_EXITGAME,0
EndSub

sub BUTTONCLICK_BTN_MBOX_NEWGAME_NO
    HideForm MESSAGEBOX_NEWGAME,0
EndSub

sub BUTTONCLICK_BTN_MBOX_NEWGAME_YES
; I file li cancello in menuevent
    HideForm MESSAGEBOX_NEWGAME,0
EndSub


sub ShowSelectedTrack
  NX=0
  TX=0
  TY=0
  TW=0
  

    if TrackSelected = 0
     SetVisible "IMG_TRACK1",1
     SetVisible "IMG_TRACK2",0
     SetVisible "IMG_TRACK3",0
     SetVisible "IMG_TRACK4",0
     SetVisible "IMG_TRACK5",0
 endif
    if TrackSelected = 1
     SetVisible "IMG_TRACK1",0
     SetVisible "IMG_TRACK2",1
     SetVisible "IMG_TRACK3",0
     SetVisible "IMG_TRACK4",0
     SetVisible "IMG_TRACK5",0
 endif
    if TrackSelected = 2
     SetVisible "IMG_TRACK1",0
     SetVisible "IMG_TRACK2",0
     SetVisible "IMG_TRACK3",1
     SetVisible "IMG_TRACK4",0
     SetVisible "IMG_TRACK5",0
 endif
    if TrackSelected = 3
     SetVisible "IMG_TRACK1",0
     SetVisible "IMG_TRACK2",0
     SetVisible "IMG_TRACK3",0
     SetVisible "IMG_TRACK4",1
     SetVisible "IMG_TRACK5",0
 endif
    if TrackSelected = 4
     SetVisible "IMG_TRACK1",0
     SetVisible "IMG_TRACK2",0
     SetVisible "IMG_TRACK3",0
     SetVisible "IMG_TRACK4",0
     SetVisible "IMG_TRACK5",1
 endif



endsub
 
 
sub ShowSelectedVehicle

    if VehicleSelected = 0
     SetVisible "CAR_LOGO1",1
     SetVisible "CAR_LOGO2",0
     SetVisible "CAR_LOGO3",0
     SetVisible "CAR_LOGO4",0
     SetVisible "CAR_LOGO5",0
	 
 endif
    if VehicleSelected = 1
     SetVisible "CAR_LOGO1",0
     SetVisible "CAR_LOGO2",1
     SetVisible "CAR_LOGO3",0
     SetVisible "CAR_LOGO4",0
     SetVisible "CAR_LOGO5",0
 endif
    if VehicleSelected = 2
     SetVisible "CAR_LOGO1",0
     SetVisible "CAR_LOGO2",0
     SetVisible "CAR_LOGO3",1
     SetVisible "CAR_LOGO4",0
     SetVisible "CAR_LOGO5",0
 endif
    if VehicleSelected = 3
	 SetVisible "CAR_LOGO1",0
     SetVisible "CAR_LOGO2",0
     SetVisible "CAR_LOGO3",0
     SetVisible "CAR_LOGO4",1
     SetVisible "CAR_LOGO5",0
 endif
    if VehicleSelected = 4
	 SetVisible "CAR_LOGO1",0
     SetVisible "CAR_LOGO2",0
     SetVisible "CAR_LOGO3",0
     SetVisible "CAR_LOGO4",0
     SetVisible "CAR_LOGO5",1
 endif



endsub
