Control_Pad
AS _BYTE 'which Gamepad\Joystick Device Is player Using? BAD_Pad
AS _BYTE 'option for Buttons As Directions Joy_Up_Val
AS _BYTE 'axis value for up Joy_Down_Val
AS _BYTE 'axis value for down Joy_Left_Val
AS _BYTE 'axis value for left Joy_Right_Val
AS _BYTE 'axis value for right Joy_Button_Up
AS _BYTE 'for people whos controllers give BUTTON states for direction keys Joy_Button_Down
AS _BYTE 'or just want to use buttons for the direction keys. Joy_Button_Right
AS _BYTE 'however this fails to work so may not be implemented.
CONST Default_Key_Right
= 19712, Default_Key_Left
= 19200, Default_Key_Up
= 18432, Default_Key_Down
= 20480 CONST Default_A_Button
= 13, Default_B_Button
= 32, Default_Start_Button
= 65, Default_Select_Button
= 66 CONST ESC_Key
= 27, ESC
= 99 CONST New_Game
= 101, Loaded_Game
= 102 CONST DOWN
= 0, LEFT
= 1, UP
= 2, RIGHT
= 3, SELECT_BUTTON
= 4, START_BUTTON
= 5, BUTTON_B
= 6, BUTTON_A
= 7
'------dummy data-------
C.KBCon_Up = Default_Key_Up
C.KBCon_Down = Default_Key_Down
C.KBCon_Left = Default_Key_Left
C.KBCon_Right = Default_Key_Right
C.KBCon_Select = Default_Select_Button
C.KBCon_Start = Default_Start_Button
C.KBCon_A_Button = Default_A_Button
C.KBCon_B_Button = Default_B_Button
SavedNames(1) = "ALIS"
SavedNames(2) = "FELLI"
SavedNames(3) = "STEVE"
SavedNames(4) = "BPLUS"
SavedNames(5) = "DAVID"
G.SavedGames = 5
'-----------------------
MFI_Loader "PS_Opening_Demo.MFI"
'Layer(33) = _LOADIMAGE("GFX\SMS_Console_SM.bmp", 32)
'Layer(34) = _LOADIMAGE("GFX\SMS_Console_Overlay.bmp", 32)
'Layer(35) = _LOADIMAGE("GFX\SMS_Console_Overlay2.bmp", 32)
'Layer(36) = _LOADIMAGE("GFX\CartridgeInserted.bmp", 32)
'Layer(37) = _LOADIMAGE("GFX\Controller_Plug.bmp", 32)
'Layer(38) = _LOADIMAGE("GFX\Controller.bmp", 32)
'Layer(39) = _LOADIMAGE("GFX\PowerButton_ON.bmp", 32)
'Layer(40) = _LOADIMAGE("GFX\PowerLED_ON.bmp", 32)
'Layer(41) = _LOADIMAGE("GFX\FingerPressPower.bmp", 32)
'Layer(42) = _LOADIMAGE("GFX\SMS_BIOS_UP.bmp", 32)
'Layer(43) = _LOADIMAGE("GFX\MainMenuScreen.bmp", 32)
'Layer(44) = _LOADIMAGE("GFX\BackGroundsMaster.bmp", 32)
'Layer(45) = _LOADIMAGE("GFX\CutScenes_NPC_Sprites.bmp", 32)
'Layer(46) = _LOADIMAGE("GFX\StarSkyLoop.bmp", 32)
'Layer(47) = _LOADIMAGE("GFX\FontMasterLinear.bmp", 32)
'SFX(0) = _SNDOPEN("Audio\MasterSystem_StartUp.ogg")
'SFX(1) = _SNDOPEN("Audio\InsertCart_SLOW.ogg")
'SFX(2) = _SNDOPEN("Audio\Power_Button.ogg")
'SFX(3) = _SNDOPEN("Audio\MainMenuLoop.ogg")
'SFX(4) = _SNDOPEN("Audio\IntroLoop.ogg")
'
'OPEN "dialog_dump.txt" FOR BINARY AS #1
'DO
' LINE INPUT #1, Line$(i%)
' Line$(i%) = RTRIM$(LTRIM$(Line$(i%)))
' i% = i% + 1
'LOOP UNTIL EOF(1)
'CLOSE #1
Elaborate_Loading
Startup_Menu
New_Game_Sequence
SUB TimedPrint
(X%
, Y%
, Txt$
, LPS%
) Speed! = (100 / LPS%) / 100
SUB PS_Print
(X%
, Y%
, TxT$
)
SUB Create_Dialog_Box
(X%
, Y%
, H%
, W%
) Top$ = "a"
Bot$ = "g"
Top$ = Top$ + "b"
Bot$ = Bot$ + "h"
Top$ = Top$ + "c"
Bot$ = Bot$ + "i"
' PS_Print 144, 336, "abbbbbbbbbbbbbbbbbbc"
' PS_Print 144, 352, "d f"
' PS_Print 144, 368, "d f"
' PS_Print 144, 384, "d f"
' PS_Print 144, 400, "d f"
' PS_Print 144, 416, "ghhhhhhhhhhhhhhhhhhi"
PS_Print X% * 16, Y% * 16, Top$
PS_Print X% * 16, (Y% + i%%) * 16, sid$
PS_Print X% * 16, (Y% + i%%) * 16, Bot$
gx% = gx% + 1
DarkenImage i2&, n!
DarkenImage i2&, n!
DIM Frac_Value
AS LONG: Frac_Value
= Value_From_0_To_1
* 65536 'Used to avoid slow floating point calculations O = Buffer.OFFSET 'We start at this offset
O_Last
= Buffer.OFFSET
+ _WIDTH(Image
) * _HEIGHT(Image
) * 4 'We stop when we get to this offset 'use on error free code ONLY!
O = O + 4
'turn checking back on when done!
_PUTIMAGE (64, 48)-STEP(512, 383), Layer
(43), Temp&
'place start menu into temp to fade in Fade_In Temp&
Inputs%% = Get_Input
TimedPrint 192, 304 + (32 * Opt%%), " ", 100
Opt%% = Opt%% - 1
TimedPrint 192, 304 + (32 * Opt%%), " ", 100
Opt%% = Opt%% + 1
ExitFlag%% = TRUE
Result%% = New_Game
IF G.SavedGames
THEN Result%%
= Continue
ELSE ExitFlag%%
= TRUE: Result%%
= New_Game
ExitFlag%% = TRUE: Result%% = Loaded_Game
_PUTIMAGE (64, 48)-STEP(512, 383), Layer
(43), Temp&
'place start menu into temp to fade in Fade_In Temp&
Run_Options
IF blinkon%%
THEN TimedPrint
192, 304 + (32 * Opt%%
), "j", 100 ELSE TimedPrint
192, 304 + (32 * Opt%%
), " ", 100 blink%% = blink%% + 1
IF blink%%
= 8 AND blinkon%%
= 0 THEN blinkon%%
= -1: blink%%
= 0 IF blink%%
= 8 AND blinkon%%
= -1 THEN blinkon%%
= 0: blink%%
= 0
Create_Dialog_Box 9, 21, 4, 18
TimedPrint 16 * 10, 16 * 23, "CONTINUE GAME- YES", 100
TimedPrint 16 * 10, 16 * 25, "DELETE GAME- NO ", 100
Result%% = Yes_No_Box(24, 16)
Load_Game
Result%% = TRUE
Delete_Game
Result%% = FALSE
Continue%% = Result%%
Result%% = TRUE
Create_Dialog_Box X%, Y%, 3, 3
TimedPrint 16 * (X% + 1), 16 * (Y% + 1), "YES", 100
TimedPrint 16 * (X% + 1), 16 * (Y% + 3), "NO", 100
KeyStop%% = TRUE
KeyStop%% = FALSE
IF Blinkon%%
THEN PS_Print
16 * (X%
), 16 * (Y%
+ 1), "k" ELSE PS_Print
16 * (X%
), 16 * (Y%
+ 1), "d" PS_Print 16 * X%, 16 * (Y% + 3), "d"
PS_Print 16 * X%, 16 * (Y% + 1), "d"
IF Blinkon%%
THEN PS_Print
16 * X%
, 16 * (Y%
+ 3), "k" ELSE PS_Print
16 * X%
, 16 * (Y%
+ 3), "d" blink%% = blink%% + 1
IF blink%%
= 10 THEN Blinkon%%
= NOT Blinkon%%: blink%%
= 0 IF _KEYDOWN(Default_A_Button
) THEN Result%%
= Opt%%: ExitFlag%%
= TRUE
Yes_No_Box = Result%%
Create_Dialog_Box 9, 21, 4, 18
TimedPrint 16 * 10, 16 * 23, "CONTINUE A GAME.", 100
TimedPrint 16 * 10, 16 * 25, "SELECT A NUMBER. ", 100
Result%% = Select_Game
Create_Dialog_Box 9, 21, 4, 18
TimedPrint 16 * 10, 16 * 23, "WILL DELETE A", 100
TimedPrint 16 * 10, 16 * 25, "SAVED GAME O.K.? ", 100
Result%% = Yes_No_Box(24, 16)
Create_Dialog_Box 9, 21, 4, 18
TimedPrint 16 * 10, 16 * 23, "DELETE A GAME", 100
TimedPrint 16 * 10, 16 * 25, "SELECT A NUMBER. ", 100
Result%% = Select_Game
Create_Dialog_Box 26, 1, 10, 7
TimedPrint 16 * 27, 16 * 3, "1", 100
TimedPrint 16 * 27, 16 * 5, "2 ", 100
TimedPrint 16 * 27, 16 * 7, "3", 100
TimedPrint 16 * 27, 16 * 9, "4 ", 100
TimedPrint 16 * 27, 16 * 11, "5", 100
TimedPrint 16 * 29, 16 * (1 + i%% * 2), SavedNames(i%%), 100
Opt%% = 1
Inputs%% = Get_Input
Opt%% = Opt%% - 1
Opt%% = Opt%% + 1
SavedNames(Opt%%) = ""
G.SavedGames = G.SavedGames - 1
ExitFlag%% = TRUE
Opt%% = 1
IF Blinkon%%
THEN PS_Print
16 * (26), 16 * (1 + Opt%%
* 2), "k" blink%% = blink%% + 1
IF blink%%
= 10 THEN Blinkon%%
= NOT Blinkon%%: blink%%
= 0
Result%% = TRUE '-1 for no input
' SELECT CASE G.ControlType
' CASE TRUE 'Keyboard input
' CASE FALSE 'joystick input
' IF C.Control_Pad THEN
' IF NOT G.Flag THEN DO: LOOP WHILE _DEVICEINPUT(C.Control_Pad)
' IF NOT C.BAD_Pad THEN
' nul%% = AxisPower(CJR%%, CJL%%, CJU%%, CJD%%) 'read directional axis values
' IF CJU%% THEN Result%% = UP
' IF CJD%% THEN Result%% = DOWN
' IF CJL%% THEN Result%% = LEFT
' IF CJR%% THEN Result%% = RIGHT
' ELSE
' IF _BUTTON(C.Joy_Button_Up) THEN Result%% = UP ': Joy_Lock_Button (C.Joy_Button_Up)
' IF _BUTTON(C.Joy_Button_Down) THEN Result%% = DOWN ': Joy_Lock_Button (C.Joy_Button_Down)
' IF _BUTTON(C.Joy_Button_Left) THEN Result%% = LEFT ': Joy_Lock_Button (C.Joy_Button_Left)
' IF _BUTTON(C.Joy_Button_Right) THEN Result%% = RIGHT ': Joy_Lock_Button (C.Joy_Button_Right)
' END IF
' IF _BUTTON(C.Joy_Select) THEN Result%% = SELECT_BUTTON: Joy_Lock_Button (C.Joy_Select)
' IF _BUTTON(C.Joy_Start) THEN Result%% = START_BUTTON: Joy_Lock_Button (C.Joy_Start)
' IF _BUTTON(C.Joy_A_Button) THEN Result%% = BUTTON_A: Joy_Lock_Button (C.Joy_A_Button)
' IF _BUTTON(C.Joy_B_Button) THEN Result%% = BUTTON_B: Joy_Lock_Button (C.Joy_B_Button)
' END IF
' END SELECT
Get_Input = Result%%
Fade_SFX_Out SFX(3)
ClearLayer Temp&
Fade_In Temp&
StarScroll
ClearLayer Temp&
Fade_In Temp&
Create_Dialog_Box 6, 5, 3, 18
TimedPrint 16 * 7, 16 * 6, "SPACE CENTURY 324,", 20
TimedPrint 16 * 7, 16 * 8, "CAMINEET ON PALMA", 20
ClearLayer Temp&
Fade_In Temp&
TimedPrint
144, 320 + 30 * i%%
, Line$
(1083 + i%%
), 24 KeyPressWait
Fade_In Temp&
TimedPrint
144, 320 + 30 * i%%
, Line$
(1087 + i%%
), 24 KeyPressWait
Fade_In Temp&
TimedPrint
144, 320 + 30 * i%%
, Line$
(1089 + i%%
), 24 KeyPressWait
ClearTextRegion
TimedPrint
144, 320 + 30 * i%%
, Line$
(1093 + i%%
), 24 KeyPressWait
ClearTextRegion
TimedPrint
144, 320 + 30 * i%%
, Line$
(1097 + i%%
), 24 KeyPressWait
ClearTextRegion
TimedPrint
144, 320 + 30 * i%%
, Line$
(1101 + i%%
), 24 KeyPressWait
Fade_In Temp&
TimedPrint
144, 320 + 30 * i%%
, Line$
(1105 + i%%
), 24 KeyPressWait
ClearTextRegion
TimedPrint
144, 320, Line$
(1105 + i%%
), 24 KeyPressWait
Fade_SFX_Out SFX(4)
Fade_In Layer(32)
'insert Cart
'insert Controller
_PUTIMAGE (0 - i%
, 194 + i%
), Layer
(37), Temp&
'Press Power Button
_PUTIMAGE (-184 - i%
, 160 + i%
), Layer
(41), Temp&
'Depress button
_PUTIMAGE (-184 - i%
, 160 + i%
), Layer
(41), Temp&
Fade_In Temp&
GET #1, , c~%%
'retrieve number of files FOffset&(I~%%) = FOffset&(I~%%) + 1
Layer(32 + i%%) = LoadGFX(FOffset(i%%), Size(i%%))
SFX(i%%) = LoadSFX(FOffset(16 + i%%), Size(16 + i%%))
LoadData FOffset(21), Size(21)
i% = i% + 1
SUB LoadData
(Foff&
, Size&
)
REM '$include:'MFI_Loader2.bi'
FUNCTION LoadFFX&
(Foff&
, Size&
, Fize%%
) LoadFFX&
= _LOADFONT("temp.dat", Fize%%
, "monospace")