Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define fbc -s console Files\hq2x16.o
- '#inclib "hq2x"
- 'declare sub HQ2X_16 (INBUFFER as any ptr,OUTBUFFER as any ptr,XRES as uinteger,YRES as uinteger,PITCH as uinteger)
- #ifdef __FB_NDS__
- #include "Modules\fbLib.bas"
- #include "Modules\fbgfx.bas"
- #include "Modules/fmod.bas"
- #else
- #define SC2X_X 256
- #define SC2X_Y 192
- #include "MyTDT\Scale2x.bas"
- #ifdef __FB_WIN32__
- #include "Files\hq2x.bi"
- #endif
- #ifndef __FB_DOS__
- #include "fmod.bi"
- #endif
- #include "fbgfx.bi"
- #include "crt.bi"
- chdir exepath+"/NitroFiles/"
- 'chdir exepath+"/NitroF~1/"
- #endif
- #ifdef __FB_WIN32__
- #include "windows.bi"
- #define Render_OpenGL
- #include "MyTDT\OpenGL.bas"
- #endif
- #include "Files\Types.bas"
- #include "Files\Rounds.bas"
- declare function ConvertPassword(CP1,CP2,CP3,CP4,CP5,as integer) as uinteger
- declare function DrwTxt(as integer,as integer,as string,as uinteger=rgb(255,255,255)) as integer
- declare sub LoadMap(as integer, as integer=0)
- declare sub DrawMap()
- declare sub UpdatePowerUp()
- declare sub NewPowerUp(as integer,as integer)
- declare sub DrawBall(as integer)
- declare function BallCollision(as integer) as integer
- declare sub LaserUpdate(NUM as integer)
- declare sub DrawHud()
- declare sub DrawStars()
- declare function DrawSprites() as integer
- declare sub UpdateAndSync()
- declare sub ShipBreaks(as integer=0)
- declare sub Screenlock2()
- declare sub Screenunlock2()
- declare sub UpdateAliens()
- declare sub InGame()
- declare sub Intro(as integer=0)
- declare sub CreateStars()
- declare sub SaveCpu()
- declare sub LoadConfig()
- declare sub SaveConfig()
- declare sub VideoInit()
- #ifdef __FB_DOS__
- dim shared as integer xxx=0
- #define FSOUND_Init(p1,p2,p3) 0
- #define FSOUND_Sample_Load(p1,p2,p3,p4,p5) 0
- #define FSOUND_Sample_SetDefaults(p1,p2,p3,p4,p5) xxx=0
- #define FSOUND_PlaySound(p1,p2) xxx=0
- #define FSound_StopSound(p1) xxx=0
- #define FSOUND_Sample_Free(p1) xxx=0
- #define FSOUND_SetVolume(p1,p2) xxx=0
- #define FSOUND_SAMPLE any
- #endif
- '175
- dim shared as any ptr Grap,Back,Font,Buff,Scr,InTitle,Explode
- dim shared as any ptr Stars,Doh,Buff2,Scr2,Aliens
- dim shared as byte ScrDouble,NoSound,ScrRender,ScrFilter
- dim shared as byte sndVol,DSIsTop = 1
- dim shared as FSOUND_SAMPLE ptr sndSpark,sndBrick,sndHit,sndHit2
- dim shared as FSOUND_SAMPLE ptr sndLaser,sndBounce,sndWarp,sndDoh
- dim shared as FSOUND_SAMPLE ptr sndRound,sndGameOver,sndDohHit
- dim shared as FSOUND_SAMPLE ptr sndDohBreak,sndShipBrk,sndAlienBrk
- dim shared as FSOUND_SAMPLE ptr MusTheme,MusStory,sndVoice
- dim shared as FSOUND_SAMPLE ptr VocBeam,VocCatch,vocDup,vocExt
- dim shared as FSOUND_SAMPLE ptr vocPlus,vocLaser,vocSlow
- dim shared as string FileName
- scope 'Init
- printf(!"Starting...\n")
- LoadConfig()
- VideoInit()
- #ifdef __FB__LINUX__
- FSOUND_SetOutput(FSOUND_OUTPUT_ALSA)
- if FSOUND_Init(44100,16,0) = 0 then
- FSOUND_SetOutput(FSOUND_OUTPUT_OSS)
- if FSOUND_Init(44100,16,0) = 0 then
- NoSound = 1
- end if
- end if
- #else
- if FSOUND_Init(44100,16,0) = 0 then NoSound = 1
- #endif
- printf(!"Loading Sounds...\n")
- #macro LoadSound(sndTarget,sndName,sndFlags)
- sndTarget = FSOUND_Sample_Load(FSOUND_FREE,sndName,FSOUND_NORMAL or sndFlags,0,0)
- if sndTarget = 0 then Fail=1: printf "Failed to load: " sndName !"\n"
- #endmacro
- if NoSound = 0 then
- #ifdef __FB_NDS__
- dim as integer Snd = (*cptr(uinteger ptr,&h4000500)) and &h7F
- *cptr(uinteger ptr,&h4000500) = Snd or ((SndVol shl 5)-(sndVol shl 2))
- #else
- FSOUND_SetSFXMasterVolume((sndVol shl 6)-(sndVol shl 2))
- #endif
- dim as integer Fail
- LoadSound(sndSpark ,"Sounds/Eletric.wav" ,FSOUND_LOOP_OFF)
- LoadSound(sndBrick ,"Sounds/Brick.wav" ,FSOUND_LOOP_OFF)
- LoadSound(sndHit ,"Sounds/Hit3.wav" ,FSOUND_LOOP_OFF)
- LoadSound(sndHit2 ,"Sounds/Hit4.wav" ,FSOUND_LOOP_OFF)
- LoadSound(sndDoh ,"Sounds/Doh.wav" ,FSOUND_LOOP_OFF)
- LoadSound(sndDohHit ,"Sounds/DohHit.wav" ,FSOUND_LOOP_OFF)
- LoadSound(sndDohBreak,"Sounds/DohBreak.wav" ,FSOUND_LOOP_OFF)
- LoadSound(sndLaser ,"Sounds/Laser.wav" ,FSOUND_LOOP_OFF)
- LoadSound(sndBounce ,"Sounds/Bounce2.wav" ,FSOUND_LOOP_OFF)
- LoadSound(sndWarp ,"Sounds/Warp.wav" ,FSOUND_LOOP_BIDI)
- LoadSound(sndShipBrk ,"Sounds/ShipBreak.wav" ,FSOUND_LOOP_OFF)
- LoadSound(sndAlienBrk,"Sounds/AlienBreak.wav",FSOUND_LOOP_OFF)
- LoadSound(VocBeam ,"Voices/BeamUp.wav" ,FSOUND_LOOP_OFF)
- LoadSound(VocCatch ,"Voices/Catch.wav" ,FSOUND_LOOP_OFF)
- LoadSound(VocDup ,"Voices/Duplicate.wav" ,FSOUND_LOOP_OFF)
- LoadSound(VocExt ,"Voices/Extend.wav" ,FSOUND_LOOP_OFF)
- LoadSound(VocLaser ,"Voices/LaserGun.wav" ,FSOUND_LOOP_OFF)
- LoadSound(VocPlus ,"Voices/ExtraLife.wav" ,FSOUND_LOOP_OFF)
- LoadSound(VocSlow ,"Voices/SlowDown.wav" ,FSOUND_LOOP_OFF)
- LoadSound(sndRound ,"Music/105-Begin.wav" ,FSOUND_LOOP_OFF)
- LoadSound(sndGameOver,"Music/98-GameOver.wav",FSOUND_LOOP_OFF)
- if Fail then Sleep
- end if
- printf(!"Loading Graphics...\n")
- Font = ImageCreate(64,64): Explode = Font
- Grap = ImageCreate(64,64)
- Back = ImageCreate(256,192)
- Stars = ImageCreate(256,256,rgb(0,0,0))
- Doh = ImageCreate(128,128)
- Aliens = ImageCreate(128,64)
- FileName = "InTitle.bmp": printf FileName & !"\n"
- if InTitle then bload FileName,InTitle
- FileName = "Font.bmp": printf FileName & !"\n"
- bload FileName,Font
- FileName = "Aliens.bmp": printf FileName & !"\n"
- bload FileName,Aliens
- printf !"Game Start...\n"
- end scope
- const ShipY = 175
- dim shared as short CurrentLevel=1,RoundPieces=0
- dim shared as short MapStart,MapSize,RoundAlpha=0
- dim shared as double Sync
- dim shared LevelMap(15,10) as RoundData, MapAlpha(15,10) as single
- dim shared MapShake(15,10) as byte
- dim shared tBall(15) as BallData, tPowerUp(7) as PowerUpData
- dim shared as short ShipX=95,ShipSz=12,ShipLives=3
- dim shared as short SkipFrame,SkipFrame2,FrameWrap,Difficulty
- dim shared as short ShipBreak=-1,ShipOffX=0,IgnoreButton,xDIFF
- dim shared as short OldShipType, OldShipSz, ShipType, ShipFrames
- dim shared as short AutoCatch,ExitWarp,WarpOffset,GameOn
- dim shared as short DohX,DohY,DohFlash,DohLives,AlienCount
- dim shared as short NewAlienLeft,NewAlienRight,IsPause
- dim shared as single BallSpeed
- dim shared as short BallCount = 1, BallCatch = 0, BallSmooth = 1
- dim shared as short ShowRound=511,LockMouse=1,iButDown,UseMouse=1,OldMX
- dim shared as integer iMX,iMY,iMB,iNX,iNY,iNB
- dim shared as integer ShowScore,NewScore,ScoreBonus,LastScore
- dim shared as short PowerUpRate,PowerUpCheck,FirstCatch,CatchOffset
- dim shared as short LaserX(3),LaserY(3),LaserOffset(3),LastLaser
- dim shared as single WarpAngle(8) = {0.1,1.2,1.9,2.8,4,5.3,6.1,7}
- dim shared as string Key,sOldCode
- dim shared as single StarAng(15),StarSpd(15),StarOffX,StarOffY
- dim shared as Fragment tDohBlow(11,7),tDohShot(2)
- dim shared tAlien(7) as AlienStruct , AlienSz(3) as short = {6,7,5,7}
- dim shared as single MinSpeed=1.501,MouseAdjustX,MouseAdjustY
- dim shared as HighScoreStruct HighScore
- randomize()
- ConvertPassword(NewScore,Difficulty,CurrentLevel,ShipLives,sOldCode,0)
- #define FullFrames
- do
- CurrentLevel=1:RoundPieces=0:MapStart=0:MapSize=0:RoundAlpha=0
- ShipLives=3:ShipX=95:ShipSz=12:SkipFrame=0:SkipFrame2=0:Difficulty=0
- ShipBreak=-1:ShipOffX=0:IgnoreButton=0:xDIFF=0:OldShipType=0:OldShipSz=0
- ShipType=0:ShipFrames=0:AutoCatch=0:ExitWarp=0:WarpOffset=0:GameOn=0
- DohX=0:DohY=0:DohFlash=0:DohLives=0:AlienCount=0:IsPause=0:BallCatch=0
- NewAlienLeft=-1:NewAlienRight=0:BallSpeed=0:BallCount=1:BallSmooth=1
- ShowRound=511:LockMouse=1:iButDown=0:UseMouse=1:OldMX=0:LastScore=0
- iMX=0:iMY=0:iMB=0:iNX=0:iNY=0:iNB=0:ShowScore=0:NewScore=0:ScoreBOnus=0
- PowerUpRate=0:PowerUpCheck=0:FirstCatch=0:CatchOffset=0:StarOffY=0
- Intro()
- #ifdef __FB_NDS__
- lcdMainOnTop()
- #endif
- InGame()
- loop
- sub Intro(IntroMode as integer=0)
- dim as any ptr White
- White = ImageCreate(512,512,rgb(255,255,255))
- #ifdef __FB_NDS__
- put(0,0),Back,alpha,1
- put(0,0),Stars,alpha,1
- put(0,0),Font,alpha,1
- put(0,0),White,alpha,1
- line(0,0)-(255,191),0,bf
- White = reallocate(White,1024)
- flip: screensync
- lcdMainOnBottom()
- #endif
- AlienCount = 7: GameOn = 0
- for CNT as integer = 0 to AlienCount
- dim as integer AlienType = CNT and 3
- with tAlien(CNT)
- .iFrame = 0
- .iOldFrame = 0
- .fX = 16+rnd*224
- .fY = 16+rnd*160
- .iType = AlienType shl 3
- .iLast = AlienSz(AlienType)
- .iSpd = ((AlienType and 1) xor 1)
- .fAng = (rnd*360)*PI
- .fSX = sin(.fAng)/4
- .fSY -= cos(.fAng)/4
- end with
- next CNT
- while len(inkey)
- sleep 0,1
- wend
- dim as integer IntroFrames=0,MusChan(1),ChanNum '1024
- dim pMenu as zstring ptr ptr
- dim as short MenuCount,MenuSelect,MenuChoose
- dim as integer BlackFrame,KeyFrame
- dim as short StarX,StarY,NewHighScore
- dim as single MenuOffset,MenuTarget
- dim as zstring ptr MainMenu(...) = { _
- @"Main Menu",@"New Game",@"Continue",@"HighScores",@"Options",@"Quit"}
- dim as zstring ptr NewGameMenu(...) = { _
- @"Select Difficulty",@" Easy ",@"Medium",@" Hard "}
- dim as zstring ptr ContinueMenu(...) = { _
- @"Enter Continue Code",@"#3F7FFF|" }
- #ifndef __FB_NDS__
- dim as zstring ptr OptionsMenu(...) = { _
- @"Options",@"Video Scale",@"Video Render", _
- @"Video Filter", @"Volume Levels" }
- dim as zstring ptr VideoScaleMenu(...) = { _
- @"Video Scale",@"1x 256x192",@"2x 512x384",@"4x 1024x768" }
- dim as zstring ptr VideoRenderMenu(...) = { _
- @"Video Render", @"GDI Window", @"GDI Fullscreen", _
- @"OpenGL Window",@"OpenGL Maximum", _
- @"DDraw Window",@"DDraw Maximum" }
- dim as zstring ptr VideoFilterMenu(...) = { _
- @"Video Filter", @"Resize2x-4x", @"HQ2x-4x", @"Rgb2x-4x" }
- #else
- dim as zstring ptr OptionsMenu(...) = { _
- @"Options",@"Volume Levels",@"Screen Select" }
- dim as zstring ptr ScreenSelectMenu(...) = { _
- @"Screen Select",@"Top Screen",@"Bottom Screen" }
- #endif
- dim as zstring ptr VolumeLevelsMenu(...) = { _
- @"Volume Levels",@"Mute",@"Low",@"Medium",@"High",@"Full"}
- dim as string EpiText,TextTemp
- dim as string TextBuff,TextBuff2
- static as string*8 CurColor(7) = { _
- "#000000|","#00FF00|","#FFFF00|","#0000FF|", _
- "#FF0000|","#FFFFFF|","#00FFFF|","#FF7F3F|" }
- pMenu = @MainMenu(0): MenuCount = 4
- MenuTarget = 0: MenuSelect = 0: MenuOffset = -256
- #ifdef __FB_NDS__
- #define KeyUp() fb.SC_ButtonUP , fb.SC_ButtonL
- #define KeyDown() fb.SC_ButtonDown, fb.SC_ButtonR
- #define KeyChoose() Key[0] = 13 or Key[1] = fb.SC_ButtonStart or Key[1] = fb.SC_ButtonA
- #define KeyBack() Key[0] = 27 or Key[1] = fb.SC_ButtonSelect or Key[1] = fb.SC_ButtonB
- #define KeyBackSpace() 8,-fb.SC_ButtonX
- #else
- #define KeyUp() fb.SC_UP
- #define KeyDown() fb.SC_Down
- #define KeyChoose() Key[0] = 13
- #define KeyBack() Key[0] = 27
- #define KeyBackSpace() 8
- #endif
- do
- dim as string Key = inkey$
- if len(Key) andalso Key[1] = asc("k") then end
- screenlock2
- select case IntroMode
- case 0 'Intro/Menu
- select case IntroFrames
- case 0 to 255 'Background IN
- if IntroFrames = 0 then
- FileName = "Arcade.bmp": printf FileName & !"\n"
- bload FileName,Stars
- FileName = "Logo.bmp": printf FileName & !"\n"
- line Back,(0,0)-(255,191),rgb(255,255,255),bf
- bload FileName,Back
- end if
- dim as integer Temp = IntroFrames+(IntroFrames shr 1)
- if Temp > 253 then IntroFrames=384
- line Buff,(0,0)-(255,191),rgb(0,0,0),bf
- put Buff,(0,0),Stars,(0,0)-(255,191),alpha,Temp
- if len(Key) then IntroFrames=255
- case 256 to 511 'Background Wait
- put Buff,(0,0),Stars,(0,0)-(255,191),pset
- if len(Key) then IntroFrames=511
- case 512 to 639 'Mysoft Logo IN
- put Buff,(0,0),Stars,(0,0)-(255,191),pset
- put Buff,(0,49),Back,(0,0)-(255,92),alpha,(IntroFrames-512) shl 1
- if len(Key) then IntroFrames=639
- case 640 to 959 'Logo Wait
- put Buff,(0,0),Stars,(0,0)-(255,191),pset
- put Buff,(0,49),Back,(0,0)-(255,92),trans
- if len(Key) then IntroFrames=959
- case 960 to 1023 'Screen White IN
- put Buff,(0,0),Stars,(0,0)-(255,191),trans
- put Buff,(0,49),Back,(0,0)-(255,92),trans
- put Buff,(0,0),White,(0,0)-(255,191),Alpha,(IntroFrames-960) shl 2
- if len(Key) then IntroFrames=1023
- case 1024 to 1279 'Menu Appearing
- if IntroFrames = 1024 then
- CreateStars()
- FileName = "Title.bmp": printf FileName & !"\n"
- bload FileName,Back
- scope
- dim as integer Fail
- if NoSound=0 then
- MusTheme = FSOUND_Sample_Load(FSOUND_FREE,"Music/104-Theme.wav",FSOUND_NORMAL or FSOUND_LOOP_OFF,0,0)
- if MusTheme = 0 then Fail=1:print "Failed to load: " "Music/104-Theme.wav"
- end if
- if Fail then Sleep
- end scope
- end if
- if IntroFrames = 1136 then
- if MusTheme then
- FSOUND_Sample_SetDefaults(MusTheme,-1,255,128,-1)
- MusChan(0) = FSOUND_PlaySound(FSOUND_FREE,MusTheme)
- end if
- end if
- dim as integer OffX = -128+(sin(IntroFrames*(1/256)))*128
- dim as integer OffY = -128+(cos(IntroFrames*(1/220)))*128
- for Y as integer = OffY to 255 step 256
- for X as integer = OffX to 255 step 256
- put Buff,(X,Y),Stars,pset
- next X
- next Y
- UpdateAliens()
- dim as integer Temp = cos((IntroFrames-1024)*(PI*(90/256))+.5)*184
- if Temp < 0 then Temp = 0
- put Buff,(8,8+Temp),Back,(0,0)-(239,38),trans
- put Buff,(0,0),White,(0,0)-(255,191),Alpha,(1279-IntroFrames)
- if len(Key) then
- if IntroFrames < 1136 then IntroFrames = 1135 else IntroFrames=1279
- end if
- case else 'Menu Controls
- scope 'Menu Anim
- if IntroFrames=1280 then
- #ifndef __FB_NDS__
- line White,(0,0)-(255,191),rgb(0,0,0),bf
- #endif
- BlackFrame = 0
- end if
- if ((IntroFrames-1136) and 511)=0 andalso MusTheme then
- ChanNum xor= 1
- FSOUND_Sample_SetDefaults(MusTheme,-1,180,128,-1)
- MusChan(ChanNum) = FSOUND_PlaySound(FSOUND_FREE,MusTheme)
- end if
- dim as integer OffX = -128+(sin(IntroFrames*(1/256)))*128
- dim as integer OffY = -128+(cos(IntroFrames*(1/220)))*128
- for Y as integer = OffY to 255 step 256
- for X as integer = OffX to 255 step 256
- put Buff,(X,Y),Stars,pset
- next X
- next Y
- UpdateAliens()
- put Buff,(8,8),Back,(0,0)-(239,38),trans
- end scope
- scope 'Menu Draw
- dim as string TempMenu = **pMenu
- var X = (128-(len(TempMenu) shl 2))-MenuOffset
- DrwTxt(X,75,TempMenu,rgb(0,255,0))
- if iButDown = 1 and MenuChoose = 0 then
- if iMX >= X and iMY >= 75 then
- if iMY <= 82 and iMX <= X+(len(TempMenu) shl 3) then
- if sndHit then
- FSOUND_Sample_SetDefaults(sndHit,-1,64,128,-1)
- FSOUND_PlaySound(FSOUND_FREE,sndHit)
- end if
- MenuSelect = -1:MenuChoose = 1: MenuTarget = 256
- end if
- end if
- end if
- for CNT as integer = 0 to MenuCount
- dim as short X=90+MenuOffset,Y=100+CNT*15
- dim as uinteger iColor = rgb(255,255,255)
- if MenuSelect = CNT then
- iColor = rgb(63,127,255): X += sin(IntroFrames/8)*4
- end if
- if abs(MenuOffset-MenuTarget) > .1 then
- if CNT = 0 then
- dim as single NewOffset = ((MenuOffset*7)+MenuTarget)*(1/8)
- if abs(NewOffset-MenuOffset) < .1 then
- Menuoffset=MenuTarget
- else
- MenuOffset=NewOffset
- end if
- end if
- Y += sin(MenuOffset/(32+CNT))*12
- end if
- dim as string sTemp = *(pMenu[CNT+1])
- if MenuCount > 0 then
- if iButDown = 1 and MenuChoose = 0 then
- if iMX >= X and iMY >= Y then
- if iMY <= Y+7 then
- if iMX <= X+(len(sTemp) shl 3) then
- if MenuSelect = CNT then
- if sndBounce then
- FSOUND_Sample_SetDefaults(sndBounce,-1,64,128,-1)
- FSOUND_PlaySound(FSOUND_FREE,sndBounce)
- end if
- MenuChoose = 1: MenuTarget = 256
- else
- if sndBrick then
- FSOUND_Sample_SetDefaults(sndBrick,-1,64,128,-1)
- FSOUND_PlaySound(FSOUND_FREE,sndBrick)
- end if
- MenuSelect = CNT
- end if
- end if
- end if
- end if
- end if
- DrwTxt(X,Y,sTemp,iColor)
- else
- X = 128+MenuOffset-((len(sTemp)+2) shl 2)
- sTemp += CurColor((IntroFrames shr 2) and 7)
- DrwTxt(X,Y,sTemp,rgb(255,255,255))
- if len(TextBuff2) then
- dim as integer iSz = len(TextBuff2)
- for CNT as integer = 0 to iSz-1
- if TextBuff2[CNT] = asc("#") then iSz -= 7
- next CNT
- X = 128+MenuOffset-(Isz shl 2)
- Y = 100+(CNT+2)*15
- DrwTxt(X,Y,TextBuff2,rgb(255,255,255))
- end if
- end if
- next CNT
- end scope
- scope 'Menu Specials
- select case pMenu
- case @ContinueMenu(0)
- if len(Key) then
- dim as integer iKey
- if len(Key)=1 then iKey = Key[0] else iKey = -Key[1]
- select case iKey
- case KeyBackSpace()
- if len(TextBuff) then
- TextBuff2 = ""
- if len(TextBuff) <> 5 then
- TextBuff = left(TextBuff,len(TextBuff)-1)
- else
- TextBuff = left(TextBuff,len(TextBuff)-2)
- end if
- end if
- case asc("A") to asc("Z"), asc("0") to asc("9")
- if len(TextBuff) < 9 then TextBuff += Key
- if len(TextBuff) = 4 then TextBuff += "-"
- case asc("a") to asc("z")
- Key[0] xor= 32
- if len(TextBuff) < 9 then TextBuff += Key
- if len(TextBuff) = 4 then TextBuff += "-"
- end select
- ContinueMenu(1) = strptr(TextBuff)
- if len(TextBuff) = 9 then
- dim as integer iScore
- dim as short iDiff,iLevel,iLives
- if ConvertPassword(iScore,iDiff,iLevel,iLives,TextBuff,1) then
- TextBuff2 = "#FF0000Invalid Code"
- else
- TextBuff2 = "#3FFF7FLevel " & iLevel & " - " & trim$(*NewGameMenu(iDiff+1))
- end if
- end if
- end if
- end select
- end scope
- scope 'Menu Controls
- getmouse iNX,iNY,,iNB
- #ifndef __FB_NDS__
- if ScrRender=3 or ScrRender=5 then
- iNX *= MouseAdjustX: iNY *= MouseAdjustY
- end if
- #endif
- if iNB <> -1 then
- iMX = iNX shr ScrDouble
- iMY = iNY shr ScrDouble
- iMB = iNB
- end if
- if iButDown > 0 then iButDown = -1
- if (iMB and 1) then
- if iButDown = 0 then iButDown = 1
- else
- iButDown = 0
- end if
- if MenuChoose = 0 then
- if len(Key) then
- select case Key[1]
- case KeyUp()
- if sndBrick then
- FSOUND_Sample_SetDefaults(sndBrick,-1,64,128,-1)
- FSOUND_PlaySound(FSOUND_FREE,sndBrick)
- end if
- if MenuSelect = 0 then MenuSelect=MenuCount else MenuSelect -= 1
- case KeyDown()
- FSOUND_Sample_SetDefaults(sndBrick,-1,64,128,-1)
- FSOUND_PlaySound(FSOUND_FREE,sndBrick)
- if MenuSelect = MenuCount then MenuSelect=0 else MenuSelect += 1
- end select
- if KeyChoose() then
- if sndBounce then
- FSOUND_Sample_SetDefaults(sndBounce,-1,64,128,-1)
- FSOUND_PlaySound(FSOUND_FREE,sndBounce)
- end if
- MenuChoose = 1: MenuTarget = 256
- elseif KeyBack() then
- if sndHit then
- FSOUND_Sample_SetDefaults(sndHit,-1,64,128,-1)
- FSOUND_PlaySound(FSOUND_FREE,sndHit)
- end if
- MenuSelect = -1:MenuChoose = 1: MenuTarget = 256
- end if
- end if
- end if
- end scope
- scope 'Menu Selection
- if BlackFrame then
- #ifdef __FB_NDS__
- if len(Key)=0 andalso fb.KeyboardIsON then
- dim as integer CNT
- for CNT=-255 to 255
- if multikey(CNT) then exit for
- next CNT
- if CNT>255 then
- fb.KeyboardIsON = 0
- lcdMainOnBottom()
- end if
- end if
- #endif
- if (IntroFrames-BlackFrame) > 127 then
- if MusTheme then
- if MusChan(0) then FSound_StopSound(MusChan(0))
- if MusChan(1) then FSound_StopSound(MusChan(1))
- FSOUND_Sample_Free(MusTheme)
- end if
- if MenuChoose = -2 then
- IntroFrames = 0: IntroMode = 1: continue do
- elseif MenuChoose = -3 then
- IntroFrames = 0: IntroMode = 3: continue do
- else
- exit do
- end if
- end if
- #ifdef __FB_NDS__
- gfx.TextureColor = 0
- put Buff,(0,0),White,(0,0)-(255,191),alpha,(IntroFrames-BlackFrame) shl 1
- gfx.TextureColor = -1
- #else
- put Buff,(0,0),White,(0,0)-(255,191),alpha,(IntroFrames-BlackFrame) shl 1
- #endif
- else
- if abs(MenuOffset-256) < .1 then
- select case pMenu
- case @MainMenu(0) '------ Main Menu ------
- select case MenuSelect
- case 0 'New Game
- pMenu = @NewGameMenu(0): MenuCount = 2: MenuSelect = 1
- case 1 'Continue
- pMenu = @ContinueMenu(0)
- TextBuff = sOldCode : MenuCount = 0: MenuSelect = 0
- ContinueMenu(1) = strptr(TextBuff)
- if len(TextBuff) = 9 then
- dim as integer iScore
- dim as short iDiff,iLevel,iLives
- if ConvertPassword(iScore,iDiff,iLevel,iLives,TextBuff,1) then
- TextBuff2 = "#FF0000Invalid Code"
- else
- TextBuff2 = "#3FFF7FLevel " & iLevel & " - " & trim$(*NewGameMenu(iDiff+1))
- end if
- end if
- #ifdef __FB_NDS__
Add Comment
Please, Sign In to add comment