Declare Function Menu() as Integer Declare Sub Ev(ID as String) Declare Sub TimerEvent(TimerName as String) Dim Shared as Byte Sound = 1 Dim Shared as Byte Music = 1 #Include "LoadImgFile.bi" #Include "DeGUI.bi" #Include "TiSound.bi" #Include "LoadSounds.bi" #Include "LevelCodes.bi" #Include "Player.bi" #Include "Score.bi" #Include "FlameAnim.bi" #Include "WorldManager.bi" #Include "TimerUDT.bi" DEGUIErrOut() ScreenRes 1024, 768, 32 Randomize Timer Dim Shared as Byte MenuRet Dim Shared as Byte Respawn Dim Shared as CheckBox PTR SoundBox Dim Shared as CheckBox PTR MusicBox Dim as WorldManager WMgr Dim as GUI G Dim as TimerUDT AmbienceTimer = TimerUDT("", 80, Timer_Loop, @TimerEvent) Dim as TimeControlUDT FPS = TimeControlUDT(60) If Sound = 1 then TiPlaySample("ambience") WMgr.CurrentWorld = Menu() WMgr.LoadWorld() WMgr.SetSpawn() CLS G.NewLabel(10, 10, "Sound ON/OFF ") G.NewLabel(10, 25, "Music ON/OFF ") SoundBox = G.GetCheckBoxPTR(G.NewCheckBox(115, 9, "sound", @Ev)) SoundBox->Checked = Sound MusicBox = G.GetCheckBoxPTR(G.NewCheckBox(115, 24, "music", @Ev)) MusicBox->Checked = Music While(NOT Multikey(&h01)) WMgr.Control() G.Control() AmbienceTimer.Update() If Respawn = 1 then Respawn = 0 WMgr.Respawn() Endif ScreenLock WMgr.G() G.G() ScreenUnlock FPS.ControlTime() Wend Function Menu() as Integer Dim as GUI G Dim as TimeControlUDT FPS = TimeControlUDT(60) Dim as WorldManager WMgr = WorldManager() WMgr.CurrentWorld = 1 WMgr.LoadWorld() WMgr.SetSpawn() Dim as TextField PTR TF Dim as LevelCodes C = LevelCodes() MenuRet = 0 G.NewButton(416, 286, "res\menu\playgame up.bmp", "res\menu\playgame down.bmp", "menu-play", @Ev) G.NewButton(416, 482, "res\menu\back up.bmp", "res\menu\back down.bmp", "menu-back", @Ev) G.NewLabel(400 + 40, 350, "Levelcode: ") TF = G.GetTextFieldPTR(G.NewTextField(495 + 40, 350, 6)) G.NewLabel(10, 10, "Sound ON/OFF ") G.NewLabel(10, 25, "Music ON/OFF ") SoundBox = G.GetCheckBoxPTR(G.NewCheckBox(115, 9, "sound", @Ev)) SoundBox->Checked = 1 MusicBox = G.GetCheckBoxPTR(G.NewCheckBox(115, 24, "music", @Ev)) MusicBox->Checked = Music While(MenuRet = 0) G.Control ScreenLock WMgr.G() G.G() ScreenUnlock If Multikey(&h01) then End 0 FPS.ControlTime() Wend Return C.CheckCode(TF->Text) End Function Sub Ev(ID as String) If Sound = 1 then TiPlaySample("buttonclick") If ID = "menu-play" then MenuRet = 1 If ID = "menu-back" then End 0 If ID = "respawn" then Respawn = 1 If ID = "nextlvl" then NextLevel = 1 If ID = "sound" then TiPlaySample("buttonclick") If SoundBox->Checked = 0 then Sound = 0 If SoundBox->Checked = 1 then Sound = 1 Endif If ID = "music" then TiPlaySample("buttonclick") If MusicBox->Checked = 0 then Music = 0 : TiStopSample("ambience") If MusicBox->Checked = 1 then Music = 1 : TiPlaySample("ambience") Endif End Sub Sub TimerEvent(TimerName as String) If Music = 1 then TiPlaySample("ambience") End Sub