'Zelda peliminary R&D
HeartContainers
AS _BYTE 'players max health Hit_level
AS _BYTE 'number of hits before losing heart(1-normal, 2-B_Ring, 4-R_Ring) Sword
AS _BYTE 'which sword does player have Sheild
AS _BYTE 'does player have magical shield Items
AS LONG 'Arrow,S_Arrow,B_Candle,R_Candle,B_Ring,R_Ring,Bracelet,Recorder,Raft,Ladder ' Rod,Book,M_Key,Letter,B_Potion,R_Potion,Food,Boomerang,M_Boomerang
Face
AS _BYTE 'which direction is player facing up,down,left,right Level
AS _BYTE 'is player on 2nd quest Dungeon
AS _BYTE 'is player in dungeon\which dungeon
Enter
AS _BYTE 'player is entering a cave or dungeon level Just_Left
AS _BYTE 'did player just leave cave or dungeon level State
AS _BYTE 'old mans image, if hit Text_Done
AS _BYTE 'has message been displayed
CONST DOWN
= 1, UP
= 2, RIGHT
= 3, LEFT
= 4, TOINVENTORY
= 1, TOMAP
= 2, NORMAL
= 0, ANGRY
= 1 CONST Key_Up
= 18432, Key_Left
= 19200, Key_Down
= 20480, Key_Right
= 19712, Start_Button
= 13
'Layer(2) = _LOADIMAGE("GFX\119176.bmp", 32)
'Layer(3) = _LOADIMAGE("GFX\8366.bmp", 32)
'Layer(4) = _LOADIMAGE("GFX\119278.bmp", 32)
'Layer(5) = _LOADIMAGE("GFX\Map_Maskb.bmp", 32)
'Layer(6) = _LOADIMAGE("GFX\21189.bmp", 32) 'npc sheet
MFI_Loader "Zelda1.MFI"
Layer
(8) = _NEWIMAGE(640, 480, 32) 'scrolling overworld item temp layerLayer
(9) = _NEWIMAGE(640, 480, 32) 'scrolling map layerLayer
(10) = _NEWIMAGE(640, 480, 32) 'collision layerLayer
(11) = _NEWIMAGE(640, 480, 32) 'temp inventory layer/map movement layerLayer
(12) = _NEWIMAGE(640, 480, 32) 'text message layer
'FFX& = _LOADFONT("NESfont.otf", 20, "monospace")
_SOURCE Layer
(10) 'collision detection map MSG$(1) = "it's dangerous to go alone! Take this."
L.X = 7: L.Y = 7: L.Sx = 304: L.Sy = 288: L.Face = UP: L.Hearts = 6: L.HeartContainers = 3
L.Hand_A = 0: L.Hand_B = 1: L.TriForce = 0: L.Items = 75 '767 '2097151
Build_Main_Display
Display_B_Hand L.Hand_B
Display_A_Hand L.Hand_A
Place_Link L.Sx, L.Sy, L.Frame
IF _KEYDOWN(Key_Up
) AND Movement_Collision
(L.Sx
, L.Sy
- 2) = FALSE
THEN L.Sy
= L.Sy
- 2: L.Face
= UP: L.Frame
= Animate_Link
IF _KEYDOWN(Key_Down
) AND Movement_Collision
(L.Sx
, L.Sy
+ 2) = FALSE
THEN L.Sy
= L.Sy
+ 2: L.Face
= DOWN: L.Frame
= Animate_Link
IF _KEYDOWN(Key_Left
) AND Movement_Collision
(L.Sx
- 2, L.Sy
) = FALSE
THEN L.Sx
= L.Sx
- 2: L.Face
= LEFT: L.Frame
= Animate_Link
IF _KEYDOWN(Key_Right
) AND Movement_Collision
(L.Sx
+ 2, L.Sy
) = FALSE
THEN L.Sx
= L.Sx
+ 2: L.Face
= RIGHT: L.Frame
= Animate_Link
IF _KEYDOWN(Start_Button
) THEN Scroll_Overworld_Inventory TOINVENTORY: Run_Overworld_Inventory: Scroll_Overworld_Inventory TOMAP
IF G.Enter
> 0 THEN Play_Entering_Animation L.Sx
, L.Sy: Enter_Cave
1 IF L.Sy
= 114 THEN Scroll_Map L.X
, L.Y
, L.Face
Scroll_Map L.X, L.Y, L.Face
Exit_Cave 1
IF L.Sx
= 60 THEN Scroll_Map L.X
, L.Y
, L.Face
IF L.Sx
= 546 THEN Scroll_Map L.X
, L.Y
, L.Face
'_PUTIMAGE , Layer(10), Layer(0)
REM'$include:'DisplayFunctions.BAS' REM'$include:'OverworldInventory.BAS' REM'$include:'Core_Function.BAS' REM'$include:'MFI_Functions.BAS'
GET #1, , c~%%
'retrieve number of files FOffset&(I~%%) = FOffset&(I~%%) + 1
'load the files where they go here----------
Layer(2) = LoadGFX(FOffset(3), Size(3)) '
Layer(3) = LoadGFX(FOffset(1), Size(1)) '
Layer(4) = LoadGFX(FOffset(4), Size(4)) '
Layer(5) = LoadGFX(FOffset(5), Size(5)) '
Layer(6) = LoadGFX(FOffset(2), Size(2)) '
FFX& = LoadFFX(FOffset(6), Size(6), 20) '_LOADFONT("NESfont.otf", 20, "monospace")
'-------------------------------------------
SUB Place_Link
(X%
, Y%
, F%%
) _PUTIMAGE (X%
, Y%
)-STEP(31, 31), Layer
(3), Layer
(1), (69 + F%%
* 17, 11)-STEP(15, 15) _PUTIMAGE (X%
+ 32, Y%
)-STEP(-31, 31), Layer
(3), Layer
(1), (35 + F%%
* 17, 11)-STEP(15, 15) _PUTIMAGE (X%
, Y%
)-STEP(31, 31), Layer
(3), Layer
(1), (35 + F%%
* 17, 11)-STEP(15, 15)
Place_Flame 5, 4
Place_Flame 11, 4
Place_Man 8, 4
Place_Pickup_Item 31, 22, 1
_PUTIMAGE (48 + 32 * X%%
, 128 + 32 * Y%%
)-STEP(31, 31), Layer
(6), Layer
(1), (1, 11)-STEP(15, 15) _PUTIMAGE (48 + 32 * X%%
, 128 + 32 * Y%%
)-STEP(31, 31), Layer
(6), Layer
(1), (18, 11)-STEP(15, 15)
SUB Place_Pickup_Item
(X%%
, Y%%
, I%%
) _PUTIMAGE (64 + 8 * X%%
, 128 + 8 * Y%%
)-STEP(15, 31), Layer
(4), Layer
(1), (555, 137)-STEP(7, 15)
SUB Write_Text
(X%%
, Y%%
, T%%
) ClearLayer Layer(11)
ClearLayer Layer(12)
D%% = D%% + 1
_PRINTSTRING (64 + 8 * X%%
+ 16 * D%%
, 128 + 8 * Y%%
+ 17 * Z%%
), MID$(MSG$
(T%%
), D%%
+ 20 * Z%%
, 1), Layer
(12) Place_Link L.Sx, L.Sy, L.Frame
IF D%%
= 20 THEN Z%%
= Z%%
+ 1: D%%
= 0 IF D%%
+ 20 * Z%%
= L%%
THEN ExitFlag%%
= TRUE
G.Text_Done = TRUE
Result%% = FALSE 'there is no collision by defult
'get all test points
Test
(1) = POINT(X%
+ 4, Y%
+ 15) 'upper left test point Test
(2) = POINT(X%
+ 16, Y%
+ 15) 'upper center test point Test
(3) = POINT(X%
+ 28, Y%
+ 15) 'upper right test point Test
(4) = POINT(X%
+ 4, Y%
+ 32) 'lower left test point Test
(5) = POINT(X%
+ 16, Y%
+ 32) 'lower center test point Test
(6) = POINT(X%
+ 28, Y%
+ 32) 'lower right test point IF Test
(i%%
) <> Black
THEN Result%%
= TRUE
Result%% = FALSE 'player can walk into door way
IF Test
(5) <> Black
THEN Result%%
= TRUE
G.Just_Left = FALSE
Movement_Collision = Result%%
L.Sx = 284: L.Sy = 440
G.Mx = L.X
G.My = L.Y
L.X = 0
L.Y = 8
G.Enter = FALSE
G.In_Cave = TRUE
L.X = G.Mx
L.Y = G.My
G.In_Cave = FALSE
Play_Exiting_Animation G.Ox, G.Oy
G.Text_Done = FALSE
SUB Build_Cave_Collision_Screen
SUB Display_Map_Screen
(X%%
, Y%%
) _PUTIMAGE (64, 128)-STEP(511, 351), Layer
(2), Layer
(1), (1 + 257 * X%%
, 1 + 177 * Y%%
)-STEP(255, 175)
SUB Display_Ruby_Count
(X~%%
) C$ = "X" + C$
SUB Display_Key_Count
(X%%
)
SUB Display_Bomb_Count
(X%%
)
_PUTIMAGE (416 + (i%%
- 1) * 16, 96)-STEP(15, 15), Layer
(4), Layer
(1), (645, 117)-STEP(7, 7) _PUTIMAGE (416 + (i%%
- 1) * 16, 96)-STEP(15, 15), Layer
(4), Layer
(1), (636, 117)-STEP(7, 7)
SUB Display_Heart_Containers
(X%%
) _PUTIMAGE (416 + (i%%
- 1) * 16, 96)-STEP(15, 15), Layer
(4), Layer
(1), (627, 117)-STEP(7, 7)
SUB Display_B_Hand
(ID%%
) _PUTIMAGE (320, 64)-STEP(15, 31), Layer
(4), Layer
(1), (500, 32)-STEP(7, 15) 'blank it _PUTIMAGE (320, 64)-STEP(15, 31), Layer
(4), Layer
(1), (584, 137)-STEP(7, 15) 'boomerang
SUB Display_A_Hand
(ID%%
) _PUTIMAGE (368, 64)-STEP(15, 31), Layer
(4), Layer
(1), (500, 32)-STEP(7, 15) 'blank it
SUB Display_Map_Position
(X%%
, Y%%
) _PUTIMAGE (96 + X%%
* 8, 48 + Y%%
* 8)-STEP(5, 5), Layer
(4), Layer
(1), (519, 126)-STEP(2, 2) 'over world pos.
Display_Map_Screen L.X, L.Y
Place_Collision_map L.X, L.Y
Place_Header
Place_Map_Grid
Display_Ruby_Count L.Rupies
Display_Key_Count L.Keys
Display_Bomb_Count L.Bombs
Display_Heart_Containers L.HeartContainers
Display_Hearts L.Hearts
Display_Map_Position L.X, L.Y
Count%% = Count%% + 1
IF Count%%
= 10 THEN Result%%
= 1 IF Count%%
= 20 THEN Result%%
= 0: Count%%
= 0 Animate_Link = Result%%
SUB Place_Collision_map
(X%%
, Y%%
) _PUTIMAGE (64, 128)-STEP(511, 351), Layer
(5), Layer
(10), (1 + 257 * X%%
, 1 + 177 * Y%%
)-STEP(255, 175)
SUB Play_Entering_Animation
(X%
, Y%
) G.Ox = X%
G.Oy = Y%
F%% = 0
Build_Main_Display
_PUTIMAGE (X%
, Y%
+ (i%%
* 2) + 2)-STEP(31, 31 - (i%%
* 2)), Layer
(3), Layer
(1), (69 + F%%
* 17, 11)-STEP(15, 15 - i%%
) Build_Main_Display
SUB Play_Exiting_Animation
(X%
, Y%
) F%% = 0
Build_Main_Display
_PUTIMAGE (X%
, Y%
+ (i%%
* 2) + 2)-STEP(31, 31 - (i%%
* 2)), Layer
(3), Layer
(1), (1 + F%%
* 17, 11)-STEP(15, 15 - i%%
) Build_Main_Display
L.Sx = X%
L.Sy = Y% + (i%% * 2) + 4
L.Face = DOWN
G.Enter = FALSE
G.Just_Left = TRUE
SUB Scroll_Map
(X%%
, Y%%
, D%%
) '---------------setup----------------
Build_Main_Display
Display_Map_Screen X%%, Y%% - 1
Display_Map_Screen X%%, Y%% + 1
Display_Map_Screen X%% - 1, Y%%
Display_Map_Screen X%% + 1, Y%%
'------------------------------------
_PUTIMAGE (64, 128)-STEP(511, 351), Layer
(2), Layer
(1), (1 + 257 * X%%
, 1 + 177 * Y%%
- i%
)-STEP(255, 175) Place_Link L.Sx, L.Sy, L.Frame
L.Sy = L.Sy + 2
L.Frame = Animate_Link
L.Y = L.Y - 1
_PUTIMAGE (64, 128)-STEP(511, 351), Layer
(2), Layer
(1), (1 + 257 * X%%
, 1 + 177 * Y%%
+ i%
)-STEP(255, 175) Place_Link L.Sx, L.Sy, L.Frame
L.Sy = L.Sy - 2
L.Frame = Animate_Link
L.Y = L.Y + 1
_PUTIMAGE (64, 128)-STEP(511, 351), Layer
(2), Layer
(1), (1 + 257 * X%%
- i%
, 1 + 177 * Y%%
)-STEP(255, 175) Place_Link L.Sx, L.Sy, L.Frame
L.Sx = L.Sx + 2
L.Frame = Animate_Link
L.X = L.X - 1
_PUTIMAGE (64, 128)-STEP(511, 351), Layer
(2), Layer
(1), (1 + 257 * X%%
+ i%
, 1 + 177 * Y%%
)-STEP(255, 175) Place_Link L.Sx, L.Sy, L.Frame
L.Sx = L.Sx - 2
L.Frame = Animate_Link
L.X = L.X + 1
SUB Place_Flame
(X%%
, Y%%
) _PUTIMAGE (48 + 32 * X%%
, 128 + 32 * Y%%
)-STEP(31, 31), Layer
(3), Layer
(1), (191, 185)-STEP(15, 15) _PUTIMAGE (80 + 32 * X%%
, 128 + 32 * Y%%
)-STEP(-31, 31), Layer
(3), Layer
(1), (191, 185)-STEP(15, 15) Frame%% = Frame%% + 1
IF Frame%%
= 20 THEN Frame%%
= 0
SUB Display_Triforce_Container
SUB Place_Invenorty_Container
'Upper Items(non selectable)
' Raft,Book,B_Ring,R_Ring,Ladder,M_Key,Bracelet
IF _READBIT(L.Items
, 14) THEN _PUTIMAGE (320, 80)-STEP(31, 31), Layer
(4), Layer
(1), (519, 156)-STEP(15, 15) ELSE _PUTIMAGE (320, 80)-STEP(31, 31), Layer
(4), Layer
(1), (500, 32)-STEP(7, 15) 'blank it IF _READBIT(L.Items
, 15) THEN _PUTIMAGE (368, 80)-STEP(15, 31), Layer
(4), Layer
(1), (538, 156)-STEP(7, 15) ELSE _PUTIMAGE (368, 80)-STEP(15, 31), Layer
(4), Layer
(1), (500, 32)-STEP(7, 15) 'blank it IF _READBIT(L.Items
, 16) THEN _PUTIMAGE (392, 80)-STEP(15, 31), Layer
(4), Layer
(1), (549, 156)-STEP(7, 15) ELSE _PUTIMAGE (392, 80)-STEP(15, 31), Layer
(4), Layer
(1), (500, 32)-STEP(7, 15) 'blank it IF _READBIT(L.Items
, 17) THEN _PUTIMAGE (392, 80)-STEP(15, 31), Layer
(4), Layer
(1), (560, 156)-STEP(7, 15) ELSE _PUTIMAGE (392, 80)-STEP(15, 31), Layer
(4), Layer
(1), (500, 32)-STEP(7, 15) 'blank it IF _READBIT(L.Items
, 18) THEN _PUTIMAGE (416, 80)-STEP(31, 31), Layer
(4), Layer
(1), (571, 156)-STEP(15, 15) ELSE _PUTIMAGE (416, 80)-STEP(31, 31), Layer
(4), Layer
(1), (500, 32)-STEP(7, 15) 'blank it IF _READBIT(L.Items
, 19) THEN _PUTIMAGE (456, 80)-STEP(15, 31), Layer
(4), Layer
(1), (590, 156)-STEP(7, 15) ELSE _PUTIMAGE (456, 80)-STEP(15, 31), Layer
(4), Layer
(1), (500, 32)-STEP(7, 15) 'blank it IF _READBIT(L.Items
, 20) THEN _PUTIMAGE (480, 80)-STEP(15, 31), Layer
(4), Layer
(1), (601, 156)-STEP(7, 15) ELSE _PUTIMAGE (480, 80)-STEP(15, 31), Layer
(4), Layer
(1), (500, 32)-STEP(7, 15) 'blank it 'lower items(selectable)
'Boomerang,bomb,bow,B_Candle,Recorder,meat,letter,rod,M_Boomerang,R_Candle,B_Potion,R_potion,Arrow,S_Arrow
IF _READBIT(L.Items
, 0) THEN _PUTIMAGE (328, 128)-STEP(15, 31), Layer
(4), Layer
(1), (584, 137)-STEP(7, 15) ELSE _PUTIMAGE (328, 128)-STEP(15, 31), Layer
(4), Layer
(1), (500, 32)-STEP(7, 15) 'blank it IF _READBIT(L.Items
, 1) THEN _PUTIMAGE (376, 128)-STEP(15, 31), Layer
(4), Layer
(1), (604, 137)-STEP(7, 15) ELSE _PUTIMAGE (376, 128)-STEP(15, 31), Layer
(4), Layer
(1), (500, 32)-STEP(7, 15) 'blank it IF _READBIT(L.Items
, 2) THEN _PUTIMAGE (432, 128)-STEP(15, 31), Layer
(4), Layer
(1), (633, 137)-STEP(7, 15) ELSE _PUTIMAGE (432, 128)-STEP(15, 31), Layer
(4), Layer
(1), (500, 32)-STEP(7, 15) 'blank it IF _READBIT(L.Items
, 3) THEN _PUTIMAGE (472, 128)-STEP(15, 31), Layer
(4), Layer
(1), (644, 137)-STEP(7, 15) ELSE _PUTIMAGE (472, 128)-STEP(15, 31), Layer
(4), Layer
(1), (500, 32)-STEP(7, 15) 'blank it IF _READBIT(L.Items
, 4) THEN _PUTIMAGE (328, 160)-STEP(15, 31), Layer
(4), Layer
(1), (664, 137)-STEP(7, 15) ELSE _PUTIMAGE (328, 160)-STEP(15, 31), Layer
(4), Layer
(1), (500, 32)-STEP(7, 15) 'blank it IF _READBIT(L.Items
, 5) THEN _PUTIMAGE (376, 160)-STEP(15, 31), Layer
(4), Layer
(1), (675, 137)-STEP(7, 15) ELSE _PUTIMAGE (376, 160)-STEP(15, 31), Layer
(4), Layer
(1), (500, 32)-STEP(7, 15) 'blank it IF _READBIT(L.Items
, 6) THEN _PUTIMAGE (424, 160)-STEP(15, 31), Layer
(4), Layer
(1), (686, 137)-STEP(7, 15) ELSE _PUTIMAGE (424, 160)-STEP(15, 31), Layer
(4), Layer
(1), (500, 32)-STEP(7, 15) 'blank it IF _READBIT(L.Items
, 7) THEN _PUTIMAGE (472, 160)-STEP(15, 31), Layer
(4), Layer
(1), (715, 137)-STEP(7, 15) ELSE _PUTIMAGE (472, 160)-STEP(15, 31), Layer
(4), Layer
(1), (500, 32)-STEP(7, 15) 'blank it IF _READBIT(L.Items
, 12) THEN _PUTIMAGE (416, 128)-STEP(15, 31), Layer
(4), Layer
(1), (615, 137)-STEP(7, 15) ELSE _PUTIMAGE (416, 128)-STEP(15, 31), Layer
(4), Layer
(1), (500, 32)-STEP(7, 15) 'blank it
SUB Display_Selected_Item
(ID%%
) _PUTIMAGE (200, 128)-STEP(15, 31), Layer
(4), Layer
(1), (500, 32)-STEP(7, 15) 'blank it _PUTIMAGE (200, 128)-STEP(15, 31), Layer
(4), Layer
(1), (584, 137)-STEP(7, 15) 'boomerang
SUB Scroll_Overworld_Inventory
(Dir%%
) Build_Overworld_Inventory_Display
Build_Main_Display
Place_Link L.Sx, L.Sy, L.Frame
ClearLayer Layer(1)
_PUTIMAGE (0, 0 - 366 + i%
), Layer
(8), Layer
(1) _PUTIMAGE (0, 0 - 366 + i%
), Layer
(8), Layer
(1) Display_Inventory
_PUTIMAGE (0, 0 - 366 + i%
), Layer
(8), Layer
(1)
SUB Build_Overworld_Inventory_Display
ClearLayer Layer(1)
Display_Triforce_Container
Place_Triforce
Place_Invenorty_Container
ClearLayer Layer(1)
SUB Run_Overworld_Inventory
IF L.Items
THEN Selection%%
= L.Hand_B
ELSE Selection%%
= 0 Display_Inventory_Selection_Box Selection%%
Display_Selected_Item Selection%%
Selection%% = Selection%% + 1: Key_Lock%% = TRUE
IF Selection%%
= 9 THEN Selection%%
= 1 Good%% = TRUE 'if player has item then allow selection
Selection%% = Selection%% + 1 'otherwise move to next item
IF Selection%%
= 9 THEN Selection%%
= 1 Good%% = FALSE
Selection%% = Selection%% - 1: Key_Lock%% = TRUE
IF Selection%%
= 0 THEN Selection%%
= 8 Good%% = TRUE 'if player has item then allow selection
Selection%% = Selection%% - 1 'otherwise move to next item
IF Selection%%
= 0 THEN Selection%%
= 8 Good%% = FALSE
L.Hand_B = Selection%%
ClearLayer Layer(11)
SUB Display_Inventory_Selection_Box
(ID%%
) SX% = 519
SX% = 536
YO%% = (ID%% - 1) \ 4
_PUTIMAGE (320 + (XO%%
* 48), 128 + (YO%%
* 32))-STEP(31, 31), Layer
(4), Layer
(1), (SX%
, 137)-STEP(15, 15) 'blue Frame%% = Frame%% + 1
IF Frame%%
= 16 THEN Frame%%
= 0
FUNCTION LoadFFX&
(Foff&
, Size&
, Fize%%
) LoadFFX&
= _LOADFONT("temp.dat", Fize%%
, "monospace")
SUB LoadData
(Foff&
, Size&
)