'World of Palma; Exploration demo update
'6/26/2021
'Collision checking ON version
'Cobalt
REM'$include:'PS1_Types.bas' REM'$include:'PS1_Arrays.bas' REM'$include:'PS1_Const.bas'
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.
Combat
AS _BYTE 'Spells used in combat NonCombat
AS _BYTE 'Spells used out of combat Tx
AS _BYTE 'players pixel location when moving, also players dungeon cords Status
AS _BYTE 'stoned, tied up, dead
Trap
AS _BYTE ' is their treasure trapped (0-255 where 0 is good) Drop
AS _BYTE ' Item Dropped if any Talk
AS _BYTE ' can talk to normally Chat
AS _BYTE ' can talk to magically Rope
AS _BYTE ' can use rope against Prot
AS _BYTE ' can use protect against Special
AS _BYTE ' special attack(rope,cure,fire,ect)
Trap
AS _BYTE ' is their treasure trapped (0-255 where 0 is good) Drop
AS _BYTE ' Item Dropped if any Talk
AS _BYTE ' can talk to normally Chat
AS _BYTE ' can talk to magically Rope
AS _BYTE ' can use rope against Prot
AS _BYTE ' can use protect against Special
AS _BYTE ' special attack(rope,cure,fire,ect)
ColorShift
AS _BYTE 'Allows selection highlighting for Options menu Pack_Count
AS _BYTE 'how many items are in the pack Facing
AS _BYTE 'what direction is player facing CurrentFloor
AS _BYTE 'what dungeon floor is player on? Last_Church
AS _BYTE 'What was the last church visted by player
Encounter_Group
AS _BYTE 'what types of creature encounters possible Is_Cave
AS _BYTE 'Covers all Cave-like locations Search_Item
AS _BYTE 'is there something to find? Most of these require a Flag set too
Is_NPC_Location
AS _BYTE 'where the NPCs stand Search_Item
AS _BYTE 'is there something to find? Most of these require a Flag set too Dialogs
AS INTEGER 'used with NPCs in Building for conversations Setting
AS _BYTE 'building inside and npc image to use
Which
AS _BYTE 'kind and location of shop(town, village\armory,secondhand,firstfoods) Ilist
AS _BYTE 'array link listing items for sale Clist
AS _BYTE 'array link listing cost of items
DIM SHARED KeyCodes
(134) AS KeyCodeData
, DeviceData
(16) AS DEVICE_Info
DIM SHARED TownMap
(9, 54, 39) AS TownTiles
'_UNSIGNED _BYTE
DIM SHARED AnimationOrder
(3, 8) '8 frames for sync between Waves\marsh and Shore animations 'time for the layer system
Layer
(127) = _NEWIMAGE(640, 480, 32) 'temp junk layer
MFI_Loader "PhantasyStarI.MFI"
CONST Default_Key_Right
= 19712, Default_Key_Left
= 19200, Default_Key_Up
= 18432, Default_Key_Down
= 20480 CONST Default_A_Button
= 32, Default_B_Button
= 13, 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
= 3, UP
= 1, RIGHT
= 2, SELECT_BUTTON
= 4, START_BUTTON
= 5, BUTTON_B
= 6, BUTTON_A
= 7 CONST None
= 0, WoodCane
= 1, Short_Sword
= 2, Iron_Sword
= 3, Wand
= 4, Iron_Fang
= 5 CONST Iron_Axe
= 6, Titanium_Sword
= 7, Ceramic_Sword
= 8, Needle_Gun
= 9, Silver_Fang
= 10 CONST Heat_Gun
= 11, Light_Saber
= 12, Laser_Gun
= 13, Laconian_Sword
= 14, Laconian_Axe
= 15 CONST Leather_Armor
= 16, White_Mantle
= 17, Light_Suit
= 18, Iron_Armor
= 19, Thick_Fur
= 20 CONST Zirconium_Armor
= 21, Diamond_Armor
= 22, Laconian_Armor
= 23, Frad_Mantle
= 24, Leather_Shield
= 25 CONST Bronze_Shield
= 26, Iron_Shield
= 27, Ciramic_Shield
= 28, Glove
= 29, Laser_Shield
= 30 CONST Mirror_Shield
= 31, Laconian_Shield
= 32, LandRover
= 33, HoverCraft
= 34, Ice_Digger
= 35 CONST Cola
= 36, Burger
= 37, Flute
= 38, Flash
= 39, Escaper
= 40, Transer
= 41 CONST Magic_Hat
= 42, Alsulin
= 43, PolyMaterial
= 44, Dungeon_Key
= 45, Sphere
= 46 CONST Torch
= 47, Prism
= 48, Nuts
= 49, Hapsby
= 50, RoadPass
= 51 CONST PassPort
= 52, Compass
= 53, Cake
= 54, Letter
= 55, Laconian_Pot
= 56 CONST Magic_Lamp
= 57, Amber_Eye
= 58, Gas_Shield
= 59, Crystal
= 60, M_System
= 61 CONST Mirical_Key
= 62, Zillion
= 63, Secrets
= 64 CONST Weapon
= 1, Armor
= 2, Shield
= 3, Special
= 4, Consumeable
= 5 CONST NORTH
= 0, EAST
= 1, WEST
= 2, SOUTH
= 3 CONST Alive
= 0, Stoned
= 1, Tied_Up
= 2, Dead
= 3 'Dungeon Constants 0-NONE, 9-Unknown
CONST Wall
= 1, FloorUp
= 2, FloorDown
= 3, UnlockedDoor
= 4, D_KeyDoor
= 5, M_KeyDoor
= 6 CONST FakeWall
= 7, Object
= 8, ExitUP
= 10, ExitDown
= 11, ExitDoor
= 12, ExitDoorLocked
= 13 CONST ExitMagicDoor
= 14, OpenDoor
= UnlockedDoor
+ &H80 CONST Magic_Bye
= 1, Magic_Chat
= 2, Magic_Cure
= 3, Magic_Exit
= 4, Magic_Fire
= 5, Magic_Fly
= 6 CONST Magic_Heal
= 7, Magic_Help
= 8, Magic_Open
= 9, Magic_Prot
= 10, Magic_Rise
= 11 CONST Magic_Rope
= 12, Magic_Tele
= 13, Magic_Terr
= 14, Magic_Thun
= 15, Magic_Trap
= 16 CONST Magic_Wall
= 17, Magic_Wind
= 18 CONST Max_Pack_Count
= 24
'place the conveyor system in corect world location
CONST Conveyor_1_Pos_X
= 32 * 82 CONST Conveyor_1_Pos_Y
= 32 * 53 + 8 CONST Conveyor_2_Pos_X
= 32 * 79 + 8 CONST Conveyor_2_Pos_Y
= 32 * 56 CONST Conveyor_Frame_Speed
= 2 '--------------------------------------------------
'Eppi Cover location
CONST Eppi_Cover_Pos_X
= 32 * 94 CONST Eppi_Cover_Pos_Y
= 32 * 85 '--------------------------------------------------
DATA 0,1,2,3,4,4,1,0:
'shore animation order READ AnimationOrder
(1, i%%
) DATA 0,1,2,1:
'animation frame order DATA 36,18,0:
'Enter camineet DATA 22,28,2:
'Enter parolit DATA 11,19,3:
'Enter Scion DATA 22,24,7:
'Enter Eppi
DATA 85,47,-1:
'exit to camineet to overworld DATA 36,20,1:
'enter space port from camineet DATA 10,20,0:
'enter camineet from space port DATA 24,11,2:
'enter parolit from space port DATA 24,27,1:
'enter space port from parolit DATA 73,58,-1:
'exit parolit to overworld DATA 102,46,-1:
'exit Scion to overworld DATA 85,80,-1:
'Exit Eppi to Overworld READ Enter
(En%%
).X
, Enter
(En%%
).Y
, Enter
(En%%
).Map
READ Exits
(Ex%%
).X
, Exits
(Ex%%
).Y
, Exits
(Ex%%
).Map
'Enter Camineet from over world
Map(82, 46).Is_Village = 1
Map(83, 46).Is_Village = 1
Map(82, 47).Is_Village = 1
Map(83, 47).Is_Village = 1
'enter Parolit from Over world
Map(70, 58).Is_Village = 2
Map(71, 58).Is_Village = 2
Map(70, 57).Is_Village = 2
Map(71, 57).Is_Village = 2
'Enter Scion from Over world
Map(103, 46).Is_Village = 3
Map(104, 46).Is_Village = 3
Map(103, 45).Is_Village = 3
Map(104, 45).Is_Village = 3
'Enter Eppi from Over world(with compass only)
Map(85, 78).Is_Village = 4
Map(86, 78).Is_Village = 4
Map(85, 79).Is_Village = 4
Map(86, 79).Is_Village = 4
'------------------------------
'Exit Camineet to over world
TownMap(0, 37, 18).Is_Exit = 1
TownMap(0, 38, 18).Is_Exit = 1
TownMap(0, 19, 27).Is_Exit = 1
TownMap(0, 20, 27).Is_Exit = 1
'Exit Camineet to Space port(if player has roadpass
TownMap(0, 9, 19).Is_Exit = 2
TownMap(0, 9, 20).Is_Exit = 2
'------------------------------
'Exit Space Port to Camineet
TownMap(1, 38, 20).Is_Exit = 3
'Exit Space Port to Parolit
TownMap(1, 24, 29).Is_Exit = 4
TownMap(1, 25, 29).Is_Exit = 4
'------------------------------
'Exit Parolit to Space Port
TownMap(2, 24, 10).Is_Exit = 5
'Exit Parolit to Over World
TownMap(2, 22, 27).Is_Exit = 6
TownMap(2, 23, 27).Is_Exit = 6
'------------------------------
'Exit Scion to Overworld
TownMap(3, 10, 19).Is_Exit = 7
'------------------------------
'Exit Eppi to Overworld
TownMap(7, 22, 25).Is_Exit = 8
TownMap(7, 23, 25).Is_Exit = 8
TownMap(7, 22, 25).Is_Walkable = -1
TownMap(7, 23, 25).Is_Walkable = -1
'------------------------------
'NPC data fields
'Camineet
READ NPC
(i%%
).ID
, NPC
(i%%
).X
, NPC
(i%%
).Y
'----------------------------------------
'NPC Messages
DATA "You had better not leave the residential area"
INIT_Controls
Load_New_Game_Stats
IF CheckFlag%%
THEN Location_Checker P
(0).Is_Intown
, P
(0).Wx
, P
(0).Wy: CheckFlag%%
= FALSE
TownMap_Tile_loader P(0).Wx, P(0).Wy, P(0).Tx, P(0).Ty 'Mapx%, Mapy%, Playrx%, Playry%
Map_Loader_tiled_Base P(0).Wx, P(0).Wy, P(0).Tx, P(0).Ty 'Mapx%, Mapy%, Playrx%, Playry%
Debugging
Place_Alis
ClearLayerTrans Layer(2)
frame% = frame% + 1
'-----------------Controls------------------
IF Collision
(P
(0).Wx
, P
(0).Wy
- 1) THEN G.Moving
= FALSE
IF Collision
(P
(0).Wx
, P
(0).Wy
+ 1) THEN G.Moving
= FALSE
IF Collision
(P
(0).Wx
- 1, P
(0).Wy
) THEN G.Moving
= FALSE
IF Collision
(P
(0).Wx
+ 1, P
(0).Wy
) THEN G.Moving
= FALSE
'--------------------------------------------
'----------------Movement--------------------
P(0).Ty = P(0).Ty + 2
IF (ABS(P
(0).Ty
) MOD 32) = 0 THEN G.Moving
= FALSE: P
(0).Wy
= P
(0).Wy
- 1: P
(0).Ty
= 0: CheckFlag%%
= TRUE
P(0).Ty = P(0).Ty - 2
IF (P
(0).Ty
MOD 32) = 0 THEN G.Moving
= FALSE: P
(0).Wy
= P
(0).Wy
+ 1: P
(0).Ty
= 0: CheckFlag%%
= TRUE
P(0).Tx = P(0).Tx + 2
IF (ABS(P
(0).Tx
) MOD 32) = 0 THEN G.Moving
= FALSE: P
(0).Wx
= P
(0).Wx
- 1: P
(0).Tx
= 0: CheckFlag%%
= TRUE
P(0).Tx = P(0).Tx - 2
IF (P
(0).Tx
MOD 32) = 0 THEN G.Moving
= FALSE: P
(0).Wx
= P
(0).Wx
+ 1: P
(0).Tx
= 0: CheckFlag%%
= TRUE
IF G.Moving
THEN Ft%%
= Ft%%
+ 1 IF Ft%%
= 8 THEN P
(0).Fr
= P
(0).Fr
+ 1: Ft%%
= 0 IF P
(0).Fr
= 4 THEN P
(0).Fr
= 0 'Correct for map wrap
IF P
(0).Wx
= 128 THEN P
(0).Wx
= 0 IF P
(0).Wx
= -1 THEN P
(0).Wx
= 127 IF P
(0).Wy
= 96 THEN P
(0).Wy
= 0 IF P
(0).Wy
= -1 THEN P
(0).Wy
= 95 '--------------------
Result%% = TRUE 'always assume collision
IF TownMap
(P
(0).Is_Intown
, X1%
, Y1%
).Is_Walkable
THEN Result%%
= FALSE
IF Map
(X1%
, Y1%
).Is_Walkable
THEN Result%%
= FALSE
Collision = Result%%
SUB Map_Loader_tiled_Base
(X1%
, Y1%
, Sx%
, Sy%
) mx% = X1% + x% - 9 '-9 to center on player character
my% = Y1% + y% - 7 '-7 to center(ish) on player character
'------Adjust for map wrap around------
IF mx%
< 0 THEN mx%
= 128 + mx%
'use addition cause mx% is a negative IF mx%
> 127 THEN mx%
= mx%
- 128 IF my%
< 0 THEN my%
= 96 + my%
'use addition cause my% is a negative IF my%
> 95 THEN my%
= my%
- 96 '--------------------------------------
'main map tiles
_PUTIMAGE (Sx%
+ x%
* 32, Sy%
+ y%
* 32)-STEP(31, 31), Layer
(4), Layer
(Map
(mx%
, my%
).Display_Layer
), (0 + Map
(mx%
, my%
).Id
* 34, 0)-STEP(31, 31) 'animated map tiles
IF Map
(mx%
, my%
).Is_Animated
THEN _PUTIMAGE (Sx%
+ x%
* 32, Sy%
+ y%
* 32)-STEP(31, 31), Layer
(6), Layer
(1), (544 + MainFrame
(1) * 34, 0)-STEP(31, 31) _PUTIMAGE (Sx%
+ x%
* 32, Sy%
+ y%
* 32)-STEP(31, 31), Layer
(6), Layer
(1), (544 + (Map
(mx%
, my%
).Id
- 21) * 34, 34 + MainFrame
(1) * 34)-STEP(31, 31) _PUTIMAGE (Sx%
+ x%
* 32, Sy%
+ y%
* 32)-STEP(31, 31), Layer
(6), Layer
(1), ((Map
(mx%
, my%
).Id
- 5) * 34, AnimationOrder
(1, MainFrame
(2)) * 34)-STEP(31, 31) 'Horizontal conveyor
_PUTIMAGE (Sx%
+ Conveyor_1_Pos_X
- (X1%
* 32), Sy%
+ Conveyor_1_Pos_Y
- (Y1%
* 32)), Layer
(5), Layer
(2), (0, 0 + (MainFrame
(0) * 34))-STEP(255, 31) 'vertical conveyor
_PUTIMAGE (Sx%
+ Conveyor_2_Pos_X
- (X1%
* 32), Sy%
+ Conveyor_2_Pos_Y
- (Y1%
* 32)), Layer
(5), Layer
(2), (257 + (MainFrame
(0) * 34), 0)-STEP(31, 223) 'Unless Player has compass Hide the Village of Eppi
_PUTIMAGE (Sx%
+ Eppi_Cover_Pos_X
- (X1%
* 32), Sy%
+ Eppi_Cover_Pos_Y
- (Y1%
* 32)), Layer
(4), Layer
(1), (34 * 27, 0)-STEP(31, 31) _PUTIMAGE (32 + Sx%
+ Eppi_Cover_Pos_X
- (X1%
* 32), Sy%
+ Eppi_Cover_Pos_Y
- (Y1%
* 32)), Layer
(4), Layer
(1), (34 * 27, 0)-STEP(31, 31) _PUTIMAGE (Sx%
+ Eppi_Cover_Pos_X
- (X1%
* 32), 32 + Sy%
+ Eppi_Cover_Pos_Y
- (Y1%
* 32)), Layer
(4), Layer
(1), (34 * 27, 0)-STEP(31, 31) _PUTIMAGE (32 + Sx%
+ Eppi_Cover_Pos_X
- (X1%
* 32), 32 + Sy%
+ Eppi_Cover_Pos_Y
- (Y1%
* 32)), Layer
(4), Layer
(1), (34 * 27, 0)-STEP(31, 31) SubFrame(i%%) = SubFrame(i%%) + 1
IF SubFrame
(0) = 5 + Conveyor_Frame_Speed
THEN MainFrame
(0) = MainFrame
(0) + Conveyor_Frame_Speed: SubFrame
(0) = 0 IF SubFrame
(1) = 16 THEN MainFrame
(1) = MainFrame
(1) + 1: SubFrame
(1) = 0 IF SubFrame
(2) = 24 THEN MainFrame
(2) = MainFrame
(2) + 1: SubFrame
(2) = 0 IF MainFrame
(0) = 8 THEN MainFrame
(0) = 0 IF MainFrame
(1) = 4 THEN MainFrame
(1) = 0 IF MainFrame
(2) = 8 THEN MainFrame
(2) = 0
SUB TownMap_Tile_loader
(X1%
, Y1%
, Sx%
, Sy%
) mx% = X1% + x% - 9 '-9 to center on player character
my% = Y1% + y% - 7 '-7 to center(ish) on player character
'town map tiles
_PUTIMAGE (Sx%
+ x%
* 32, Sy%
+ y%
* 32)-STEP(31, 31), Layer
(3), Layer
(1), (0 + TownMap
(P
(0).Is_Intown
, mx%
, my%
).Id
* 34, 0)-STEP(31, 31)
' STATIC LastCount%
FPSC% = frame%
frame% = 0
_PUTIMAGE (290, 210)-STEP(31, 45), Layer
(7), Layer
(1), (0 + 17 * G.Facing
, 120)-STEP(15, 22) _PUTIMAGE (290, 210)-STEP(31, 45), Layer
(7), Layer
(1), (68 + 51 * G.Facing
+ AlisAnim
(P
(0).Fr
) * 17, 120)-STEP(15, 22)
SUB Location_Checker
(Map%%
, X%
, Y%
) OldX% = X%
OldY% = Y%
OldMap%% = Map%%
IF TownMap
(Map%%
, X%
, Y%
).Is_Building
THEN CASE &HFF 'flaged conversations Build_House_Setting TownMap(Map%%, X%, Y%).Setting
Flagged_Conversations TownMap(Map%%, X%, Y%).Dialogs
Back_Up_Player
CASE &H80 'Enter a Dungeon area ClearLayer Layer(1)
Shop TownMap(Map%%, X%, Y%).Dialogs
Back_Up_Player
Input_OR_Wait 128
'currently handled with IS_EXIT
CASE &H10 'interactive Conversation ' Build_House_Setting TownMap(Map%%, X%, Y%).Setting
Create_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 23, "THE DOOR IS LOCKED", 20 '
Input_OR_Wait 128
Back_Up_Player
ClearLayer Layer(1)
G.Last_Church = P(0).Is_Intown ' visited church so set this as the return point for FLY
Church TownMap(Map%%, X%, Y%).Setting 'carrys the church ID value for look
Back_Up_Player
Input_OR_Wait 128
CASE &H01 'standard dialog Build_House_Setting TownMap(Map%%, X%, Y%).Setting
Conversations TownMap(Map%%, X%, Y%).Dialogs
Back_Up_Player
IF TownMap
(Map%%
, X%
, Y%
).Is_Exit
THEN P(0).Is_Intown = Exits(TownMap(OldMap%%, OldX%, OldY%).Is_Exit).Map
P(0).Wx = Exits(TownMap(OldMap%%, OldX%, OldY%).Is_Exit).X
P(0).Wy = Exits(TownMap(OldMap%%, OldX%, OldY%).Is_Exit).Y
IF Map
(X%
, Y%
).Is_Village
THEN IF Map
(X%
, Y%
).Is_Village
= 4 THEN IF Has_Compass
THEN 'Can only enter Eppi when you have the compass P(0).Is_Intown = Enter(Map(OldX%, OldY%).Is_Village).Map
P(0).Wx = Enter(Map(OldX%, OldY%).Is_Village).X
P(0).Wy = Enter(Map(OldX%, OldY%).Is_Village).Y
P(0).Is_Intown = Enter(Map(OldX%, OldY%).Is_Village).Map
P(0).Wx = Enter(Map(OldX%, OldY%).Is_Village).X
P(0).Wy = Enter(Map(OldX%, OldY%).Is_Village).Y
REM '$include:'PS1_Conversation_subs.bas'
P(0).N = "ALIS"
P(0).Hp = 16
P(0).Mp = 0
P(0).MHp = 16
P(0).MMp = 0
P(0).Wepn = Short_Sword
P(0).Armr = Leather_Armor
P(0).Shld = None
P(0).Attk = 8
P(0).Defn = 8
'---------------
P(1).N = "MYAU"
P(1).Hp = 22
P(1).Mp = 0
P(1).MHp = 22
P(1).MMp = 0
P(1).Wepn = None
P(1).Armr = None
P(1).Shld = None
P(1).Attk = 18
P(1).Defn = 22
'---------------
P(2).N = "ODIN"
P(2).Hp = 42
P(2).Mp = 0
P(2).MHp = 42
P(2).MMp = 0
P(2).Wepn = Iron_Axe
P(2).Armr = Leather_Armor
P(2).Shld = None
P(2).Attk = 13
P(2).Defn = 13
'---------------
P(3).N = "LAIA" 'More feminine than Noah
P(3).Hp = 45
P(3).Mp = 12
P(3).MHp = 45
P(3).MMp = 12
P(3).Wepn = WoodCane
P(3).Armr = White_Mantle
P(3).Shld = None
P(3).Attk = 18
P(3).Defn = 30
'---------------
G.Meseta = 0
G.Party_Size = 0 'start with only Alis
Pack(i%%) = 0
P(i%%).Level = 1
P(i%%).Combat = -1
P(i%%).NonCombat = -1
P(0).Is_Intown = 0 'Town ID for Camineet (-1 if not in a town)
P(i%%).Wx = 33 'Start outside Alis's home
P(i%%).Wy = 13
P(i%%).Tx = 0
P(i%%).Ty = 0
P(i%%).Fr = 0
P(3).Combat = 0
P(3).NonCombat = 0
F(i%%) = FALSE
'Move player back to space where they enter building from
G.Moving = FALSE
P(0).Wy = P(0).Wy + 1
P(0).Wy = P(0).Wy - 1
P(0).Wx = P(0).Wx + 1
P(0).Wx = P(0).Wx - 1
FOR i%%
= 1 TO 3 'make sure whole party is in correct location P(i%%).Wx = P(0).Wx
P(i%%).Wy = P(0).Wy
G.Facing = DOWN
_PUTIMAGE (281, 200)-STEP(75, 183), Layer
(9), Layer
(1), (0 + Who%%
* 39, 450)-STEP(37, 92)
SUB Build_House_Setting
(id%%
) ClearLayer Layer(1)
'-----------------Setup screen--------------
'BGI -if bit 7 set then use alt scene layout
'Character - can be red, green or blue man
Char~%%
= _SHL(id%%
, 4) 'bump 4 high bits(4-7) Char~%%
= _SHR(Char~%%
, 4) 'reset to find what type of NPC IF Char~%%
> 0 THEN Place_NPC Char~%%
'no robo-gaurds in houses '---------------------------------------------
_PRINTSTRING (640, 45), "ID-" + STR$(TownMap
(P
(0).Is_Intown
, P
(0).Wx
, P
(0).Wy
).Id
), Layer
(0) _PRINTSTRING (640, 60), "UP-" + STR$(TownMap
(P
(0).Is_Intown
, P
(0).Wx
, P
(0).Wy
- 1).Id
) + " ", Layer
(0) _PRINTSTRING (640, 75), "DN-" + STR$(TownMap
(P
(0).Is_Intown
, P
(0).Wx
, P
(0).Wy
+ 1).Id
) + " ", Layer
(0) _PRINTSTRING (640, 90), "LT-" + STR$(TownMap
(P
(0).Is_Intown
, P
(0).Wx
- 1, P
(0).Wy
).Id
) + " ", Layer
(0) _PRINTSTRING (640, 105), "RT-" + STR$(TownMap
(P
(0).Is_Intown
, P
(0).Wx
+ 1, P
(0).Wy
).Id
) + " ", Layer
(0) _PRINTSTRING (640, 120), "XT-" + STR$(TownMap
(P
(0).Is_Intown
, P
(0).Wx
, P
(0).Wy
).Is_Exit
) + " ", Layer
(0) _PRINTSTRING (640, 150), "bd-&H" + HEX$(TownMap
(P
(0).Is_Intown
, P
(0).Wx
, P
(0).Wy
).Is_Building
) + " ", Layer
(0)
_PRINTSTRING (640, 60), "UP-" + STR$(Map
(P
(0).Wx
, P
(0).Wy
- 1).Id
) + " ", Layer
(0) _PRINTSTRING (640, 75), "DN-" + STR$(Map
(P
(0).Wx
, P
(0).Wy
+ 1).Id
) + " ", Layer
(0) _PRINTSTRING (640, 90), "LT-" + STR$(Map
(P
(0).Wx
- 1, P
(0).Wy
).Id
) + " ", Layer
(0) _PRINTSTRING (640, 105), "RT-" + STR$(Map
(P
(0).Wx
+ 1, P
(0).Wy
).Id
) + " ", Layer
(0)
GET #1, , c~%%
'retrieve number of files FOffset&(I~%%) = FOffset&(I~%%) + 1
Layer(3) = LoadGFX(FOffset(5), Size(5)) 'townmap tiles
Layer(4) = LoadGFX(FOffset(1), Size(1)) '_LOADIMAGE("gfx\maps\PalmaTiles2x2.bmp", 32) '_NEWIMAGE(640, 480, 32)
Layer(5) = LoadGFX(FOffset(2), Size(2)) '_LOADIMAGE("gfx\maps\conveyoranim.bmp", 32) 'Conveyor
Layer(6) = LoadGFX(FOffset(3), Size(3)) '_LOADIMAGE("gfx\maps\mapanimation.bmp", 32) 'Water, shore, and marsh frames
Layer(7) = LoadGFX(FOffset(4), Size(4)) '_LOADIMAGE("gfx\CharacterSheetC.png", 32) '
Layer(8) = LoadGFX(FOffset(6), Size(6)) 'backgrounds
Layer(9) = LoadGFX(FOffset(7), Size(7)) 'Cutscene_NPCsprites
Layer(10) = LoadGFX(FOffset(8), Size(8)) 'Font
LoadData FOffset(9), Size(9)
GET #F1
, , Lines_of_Dialog%
FOR i%
= 0 TO Lines_of_Dialog%
GET #F1
, , DungeonMaster
() ' END
SUB LoadData
(Foff&
, Size&
)
REM '$include:'MFI_Loader2.bi'
FUNCTION LoadFFX&
(Foff&
, Size&
, Fize%%
) LoadFFX&
= _LOADFONT("temp.dat", Fize%%
, "monospace")
REM'$include:'PS1_PrintSubs.bas' REM'$include:'PS1_Controls.bas' REM'$include:'PS1_Conversation_testing.bas' SUB PS_Print
(X%
, Y%
, TxT$
, L&
) By%% = 0
_PUTIMAGE (X%
+ i%%
* 16, Y%
- By%%
)-STEP(15, 15), Layer
(10), L&
, (1 + (10 * (ASC(MID$(TxT$
, i%%
, 1)) - 32)), 1 + G.ColorShift
)-STEP(7, 7)
SUB Scroll_Dialog_Box
(X%
, Y%
, H%
, W%
) X% = X% * 16 + 32
Y% = Y% * 16 + 16
H% = H% * 16
W% = W% * 16
Scrl%% = 32
_PUTIMAGE (X%
, Y%
)-STEP(W%
- 1, H%
+ 3), temp&
, Layer
(0), (X%
, Y%
+ 4)-STEP(W%
- 1, H%
+ 3)
SUB TimedPrint
(X%
, Y%
, Txt$
, LPS%
) Speed! = (100 / LPS%) / 100
By%% = 0
_PUTIMAGE (16 * X%
+ i%%
* 16, 16 * Y%
- By%%
)-STEP(15, 15), Layer
(10), Layer
(1), (1 + (10 * (ASC(MID$(Txt$
, i%%
, 1)) - 32)), 1)-STEP(7, 7)
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 X% * 16, Y% * 16, Top$, Layer(1)
PS_Print X% * 16, (Y% + i%%) * 16, sid$, Layer(1)
PS_Print X% * 16, (Y% + i%%) * 16, Bot$, Layer(1)
FUNCTION AxisPower%%
(CJR%%
, CJL%%
, CJU%%
, CJD%%
) CJR%%
= _AXIS(C.Joy_Right
) CJL%%
= _AXIS(C.Joy_Left
) CJD%%
= _AXIS(C.Joy_Down
) IF CJR%%
= C.Joy_Right_Val
THEN CJL%%
= 0: CJR%%
= TRUE
ELSE CJR%%
= 0 IF CJD%%
= C.Joy_Down_Val
THEN CJU%%
= 0: CJD%%
= TRUE
ELSE CJD%%
= 0 AxisPower = nul%%
Result%% = TRUE '-1 for no input
CASE TRUE
'Keyboard input
CASE FALSE
'joystick input 'IF NOT G.Flag THEN DO: LOOP WHILE _DEVICEINPUT(C.Control_Pad) 'has to do with moving
nul%% = AxisPower(CJR%%, CJL%%, CJU%%, CJD%%) 'read directional axis values
IF CJR%%
THEN Result%%
= RIGHT
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) 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
) Get_Input = Result%%
'load input device details Max:16
IF G.Device_Count
> 16 THEN G.Device_Count
= 16 'limit total devices to 16 FOR I%%
= 1 TO G.Device_Count
DeviceData
(I%%
).Buttons
= _LASTBUTTON(I%%
) ' number of buttons on the device DeviceData
(I%%
).Axis_p
= _LASTAXIS(I%%
) 'number of axis on the device
'Set Default controls
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
C.Joy_Up = -22 'Undefined Joy Pad Controls
C.Joy_Down = -22 'Undefined
C.Joy_Left = -22 'Undefined
C.Joy_Right = -22 'Undefined
C.Joy_Button_Up = -22 'Undefined Joy Pad Controls
C.Joy_Button_Down = -22 'Undefined
C.Joy_Button_Left = -22 'Undefined
C.Joy_Button_Right = -22 'Undefined
C.Joy_Select = -22 'Undefined
C.Joy_Start = -22 'Undefined
C.Joy_A_Button = -22 'Undefined
C.Joy_B_Button = -22 'Undefined
Get_JoyPads 'load posible controller inputs
G.ControlType = TRUE 'keyboard control
SUB Joy_Lock_Button
(ID%%
) ExitFlag%% = FALSE
IF Nul%%
= FALSE
THEN ExitFlag%%
= TRUE
ExitFlag%% = FALSE
IF Nul%%
= FALSE
THEN ExitFlag%%
= TRUE
SUB Input_OR_Wait
(clicks~%%
) pause%% = pause%% + 1
Result%% = TRUE
'make backup of area under window
_PUTIMAGE (0, 0), Layer
(0), Layer
(127), (X%
* 16, Y%
* 16)-STEP(95, 79) Create_Dialog_Box X%, Y%, 3, 3
PS_Print 16 * (X% + 1), 16 * (Y% + 1), "YES", Layer(1)
PS_Print 16 * (X% + 1), 16 * (Y% + 3), "NO", Layer(1)
C_Input%% = Get_Input
IF C_Input%%
= DOWN
OR C_Input%%
= UP
THEN KeyStop%% = TRUE
KeyStop%% = FALSE
IF Blinkon%%
THEN PS_Print
16 * (X%
), 16 * (Y%
+ 1), "k", Layer
(1) ELSE PS_Print
16 * (X%
), 16 * (Y%
+ 1), "d", Layer
(1) PS_Print 16 * X%, 16 * (Y% + 3), "d", Layer(1)
PS_Print 16 * X%, 16 * (Y% + 1), "d", Layer(1)
IF Blinkon%%
THEN PS_Print
16 * X%
, 16 * (Y%
+ 3), "k", Layer
(1) ELSE PS_Print
16 * X%
, 16 * (Y%
+ 3), "d", Layer
(1) blink%% = blink%% + 1
IF blink%%
= 10 THEN Blinkon%%
= NOT Blinkon%%: blink%%
= 0 IF C_Input%%
= BUTTON_B
THEN Result%%
= Opt%%: ExitFlag%%
= TRUE
'scroll backup area back in place
_PUTIMAGE (X%
* 16, Y%
* 16), Layer
(127), Layer
(0), (0, 0)-STEP(95, I%%
) Yes_No_Box = Result%%
Result%% = TRUE
'make backup of area under window
_PUTIMAGE (0, 0), Layer
(0), Layer
(127), (X%
* 16, Y%
* 16)-STEP(111, 95) Create_Dialog_Box X%, Y%, 3, 4
PS_Print 16 * (X% + 1), 16 * (Y% + 1), "BUY", Layer(1)
PS_Print 16 * (X% + 1), 16 * (Y% + 3), "SELL", Layer(1)
C_Input%% = Get_Input
IF C_Input%%
= DOWN
OR C_Input%%
= UP
THEN KeyStop%% = TRUE
KeyStop%% = FALSE
IF Blinkon%%
THEN PS_Print
16 * (X%
), 16 * (Y%
+ 1), "k", Layer
(1) ELSE PS_Print
16 * (X%
), 16 * (Y%
+ 1), "d", Layer
(1) PS_Print 16 * X%, 16 * (Y% + 3), "d", Layer(1)
PS_Print 16 * X%, 16 * (Y% + 1), "d", Layer(1)
IF Blinkon%%
THEN PS_Print
16 * X%
, 16 * (Y%
+ 3), "k", Layer
(1) ELSE PS_Print
16 * X%
, 16 * (Y%
+ 3), "d", Layer
(1) blink%% = blink%% + 1
IF blink%%
= 10 THEN Blinkon%%
= NOT Blinkon%%: blink%%
= 0 IF C_Input%%
= BUTTON_B
THEN ExitFlag%%
= TRUE
IF Opt%%
= 1 THEN Result%%
= Opt%%
+ 1 'return a 2 to trigger the selling menu _PUTIMAGE (X%
* 16, Y%
* 16), Layer
(127), Layer
(0), (0, 0)-STEP(111, I%%
) Buy_Sell_Box = Result%%
Result%% = 0 'Defualt to Alis
'setup the selection box for the number of party memebers
Create_Dialog_Box 5, 12, 1 + G.Party_Size * 2, 4
FOR i%%
= 0 TO G.Party_Size
PS_Print 16 * 6, 16 * (13 + (i%% * 2)), P(i%%).N, Layer(1)
Opt%% = Opt%% - 1
IF Opt%%
= -1 THEN Opt%%
= G.Party_Size
Opt%% = Opt%% + 1
IF Opt%%
= G.Party_Size
+ 1 THEN Opt%%
= 0 ExitFlag%% = TRUE
Result%% = Opt%%
ExitFlag%% = TRUE
IF blinkon%%
THEN PS_Print
16 * 5, 16 * (13 + (Opt%%
* 2)), "k", Layer
(1) ELSE PS_Print
16 * 5, 16 * (13 + (Opt%%
* 2)), "d", Layer
(1) 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 'if Party consists of only Alis don't bother!
Player_Select%% = Result%%
SUB Flagged_Conversations
(ID%%
) IF F
(0) THEN 'if flag is set then just short message and heal player Conversations 2
Heal_Party
ELSE 'first dialog with Suelo Conversations 1
F(0) = TRUE
Heal_Party
IF F
(1) THEN 'player already recieved Laconian Pot Conversations 4
ELSE 'player recives the Laconian Pot to get Mayu Conversations 3
F(1) = TRUE
Pack(G.Pack_Count) = Laconian_Pot
G.Pack_Count = G.Pack_Count + 1
CASE 2 'Camineet Road Guards
Create_Dialog_Box 9, 21, 4, 18
Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(Chat(id%, i%%)), 20 '
TimedPrint 10, 23, Dialog(Chat(id%, i%%)), 20 '
IF i%%
+ 1 < Chat
(id%
, 0) THEN IF Scroll%%
THEN Scroll_Dialog_Box
9, 21, 4, 18 TimedPrint 10, 25, Dialog(Chat(id%, i%% + 1)), 20 '
IF Scroll%%
THEN Scroll_Dialog_Box
9, 21, 4, 18 TimedPrint 10, 25, Dialog(Chat(id%, i%% + 1)), 20 '
Input_OR_Wait 128
Scroll%% = TRUE
SUB Interative_Conversations
(id%%
) 'conversations requiring YES\NO boxes or other input
Create_Dialog_Box 9, 21, 4, 18
FOR I%%
= 0 TO G.Party_Size
P(I%%).Hp = P(I%%).MHp
P(I%%).Mp = P(I%%).MMp
Result%% = FALSE
FOR i%%
= 0 TO G.Pack_Count
- 1 IF Pack
(i%%
) = id%%
THEN Result%%
= TRUE: i%%
= G.Pack_Count
In_Pack = Result%%
'------------Setup church screen--------------
'BGI
'Character
Place_Shop_NPC 13
'_PUTIMAGE (281, 200)-STEP(75, 183), NPC&, Temp&, (0 + 13 * 39, 450)-STEP(37, 92)
'BGI
'Character
'---------------------------------------------
Create_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 23, Dialog(1452), 20 'this is a church
TimedPrint 10, 25, Dialog(1453), 20 '
Input_OR_Wait 128
Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1454), 20 'anybody need brought back?
IF Yes_No_Box
(24, 16) = 0 THEN 'need somebody brought back Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1461), 20 'Who do you want
Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1462), 20 'to resurrect
Who%% = Player_Select 'which player
IF P
(Who%%
).Status
= Dead
THEN 'are they really dead? Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1464), 20 'That will require
Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint
10, 25, LTRIM$(STR$(P
(Who%%
).Level
* 20)) + Dialog
(1465), 20 'to resurrect IF NOT Yes_No_Box
(24, 16) THEN 'if player will pay G.Meseta = G.Meseta - (P(Who%%).Level * 20) 'take fee
Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1457), 20 'I will now cast
Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1458), 20 'a spell
Input_OR_Wait 30
Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1459), 20 'ahbra
Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1460), 20 'cadahbra
P(Who%%).Hp = P(Who%%).MHp
P(Who%%).Mp = P(Who%%).MMp
P(Who%%).Status = Alive
Input_OR_Wait 30
ELSE 'this person is not dead Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, P(Who%%).N + " " + Dialog(1472), 20 'is alive
Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1463), 20 'anyone else
IF Yes_No_Box
(24, 16) THEN ExitFlag%%
= TRUE
ELSE 'just checking stats Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1470), 20 'May the gods
Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1471), 20 'watch over you.
Input_OR_Wait 128
Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1466), 20 'To Advance to
Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1467), 20 'the next level,
Input_OR_Wait 128
FOR i%%
= 0 TO G.Party_Size
IF P
(i%%
).Status
= Alive
THEN 'only display players who are alive Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint
10, 25, P
(i%%
).N
+ " " + Dialog
(1468) + STR$(Pl
(i%%
, P
(i%%
).Level
+ 1).ExpPts
- P
(i%%
).
Exp), 20 'needs Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1469), 20 'the next level,
Input_OR_Wait 128
ELSE 'player is maxed out Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, P(i%%).N + " " + Dialog(1566), 20 'is strong
Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1567), 20 'enough already.
Input_OR_Wait 128
'------------Setup shop screen--------------
'BGI -if bit 7 set then use alt shop layout
BGI~%%
= _SHL(Shops
(ID%%
).Which
, 1) 'bump bit 7 then BGI~%%
= _SHR(BGI~%%
, 5) 'reset to find what type of shop(0-7 only 3 kinds though 0-2) _PUTIMAGE (64, 48)-STEP(511, 383), Layer
(8), Layer
(1), (256 * _READBIT(Shops
(ID%%
).Which
, 7), 384 + (192 * BGI~%%
))-STEP(255, 191) 'Character - can be red, green or blue man
Char~%%
= _SHL(Shops
(ID%%
).Which
, 4) 'bump 4 high bits(4-7) Char~%%
= _SHR(Char~%%
, 4) 'reset to find what type of shop owner Place_Shop_NPC Char~%%
'---------------------------------------------
Create_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 23, Dialog(1408), 20 'this is an armory
TimedPrint 10, 25, Dialog(1409), 20 'want to buy
Input_OR_Wait 128
Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1410), 20 'something
Result%% = Yes_No_Box(24, 16)
TimedPrint 10, 23, Dialog(1420), 20 'this is a
TimedPrint 10, 25, Dialog(1421), 20 'First foods shop
Input_OR_Wait 128
Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1422), 20 'like to
Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1423), 20 'buy something
Result%% = Yes_No_Box(24, 16)
TimedPrint 10, 23, Dialog(1420), 20 'this is a
TimedPrint 10, 25, Dialog(1425), 20 'this is second hand
Input_OR_Wait 128
Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1426), 20 'help you
Result%% = Buy_Sell_Box(9, 16)
IF Result%%
= 0 THEN 'wish to buy something? Yes Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1412), 20 'which do you
Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1413), 20 'want to buy
Display_Meseta_Box 25, 3
IF Select_Shop_Item
(ID%%
, Buy%%
) <> TRUE
THEN IF G.Meseta
>= ShopCost
(ID%%
, Buy%%
) THEN 'check players on hand cash IF G.Pack_Count
< Max_Pack_Count
THEN 'does player have room to carry more Scroll_Dialog_Box 9, 21, 4, 18
Pack(G.Pack_Count) = ShopItems(ID%%, Buy%%)
G.Pack_Count = G.Pack_Count + 1
G.Meseta = G.Meseta - ShopCost(ID%%, Buy%%)
TimedPrint 10, 25, Dialog(1414), 20 'Thank you
Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1415), 20 'anything else
Display_Meseta_Box 25, 3
IF Yes_No_Box
(24, 16) THEN ExitFlag%%
= TRUE
ELSE Buy%%
= -1 Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1416), 20 'dont have
Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1417), 20 'the space
Input_OR_Wait 30
Msg%% = 2 'display secondary leave message
ExitFlag%% = TRUE
ELSE 'player doesn't have the cash Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1550), 20 'dont have
Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1551), 20 'the money
Input_OR_Wait 30
Msg%% = 3 ' alt leave message
ExitFlag%% = TRUE
ExitFlag%% = TRUE
ELSEIF Result%%
= 2 THEN 'sell an item at the second hand store Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1427), 20 'what do you
Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1428), 20 'want to sell?
IF Run_Item_Selection_Menu
(ID%%
) >= 0 THEN Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint
10, 25, RTRIM$(I
(Pack
(ID%%
)).Nam
) + Dialog
(1429), 20 'this item Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1430), 20 'to sell....
Input_OR_Wait 128
Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint
10, 25, Dialog
(1431) + STR$(I
(Pack
(ID%%
)).Cost \
2), 20 'how about this Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1432), 20 'much
IF Yes_No_Box
(24, 16) = 0 THEN G.Meseta = G.Meseta + I(Pack(ID%%)).Cost \ 2
Reduce_Pack ID%%
Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1414), 20 'Thank you
Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1415), 20 'anything else?
IF Yes_No_Box
(24, 16) THEN ExitFlag%%
= TRUE
ELSE 'player either has nothing to sell or changed mind Msg%% = 0
ExitFlag%% = TRUE
Scroll_Dialog_Box 9, 21, 4, 18
Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1418), 20 '
Scroll_Dialog_Box 9, 21, 4, 18
TimedPrint 10, 25, Dialog(1419), 20 '
TimedPrint 10, 25, Dialog(1552), 20 'not enough cash leaving
TimedPrint 10, 25, Dialog(1411), 20 'normal leaving
SUB Display_Meseta_Box
(X%%
, Y%%
) Create_Dialog_Box X%%, Y%%, 1, 8
PS_Print 16 * (X%% + 1), 16 * (Y%% + 1), "MST", Layer(1)
FUNCTION Select_Shop_Item
(ID%%
, What%%
) Result%% = -1 'return this if player cancels
Create_Dialog_Box 9, 3, 6, 14
FOR i%%
= 0 TO Shops
(ID%%
).items
- 1 PS_Print 16 * 10, 16 * (5 + 2 * i%%), I(ShopItems(ID%%, i%%)).Nam, Layer(1)
Opt%% = Opt%% - 1
IF Opt%%
= -1 THEN Opt%%
= Shops
(ID%%
).items
- 1 Opt%% = Opt%% + 1
IF Opt%%
= Shops
(ID%%
).items
THEN Opt%%
= 0 ExitFlag%% = TRUE
What%% = Opt%%
Result%% = Opt%%
ExitFlag%% = TRUE
IF blinkon%%
THEN PS_Print
16 * 9, 16 * (5 + (Opt%%
* 2)), "k", Layer
(1) ELSE PS_Print
16 * 9, 16 * (5 + (Opt%%
* 2)), "d", Layer
(1)
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 Select_Shop_Item = Result%%
GET #1, , Lines_of_Dialog%
FOR i%
= 0 TO Lines_of_Dialog%
GET #1, , DungeonMaster
()
SUB Place_Shop_NPC
(Who%%
) _PUTIMAGE (281, 202)-STEP(75, 101), Layer
(9), Layer
(1), (0 + Who%%
* 39, 450)-STEP(37, 51)
FUNCTION Run_Item_Selection_Menu%%
(ID%%
) Result%% = -1
'create a backup of the area under window
_PUTIMAGE (0, 0), Layer
(0), Layer
(127), (16 * 26, 16 * 5)-STEP(159, 335) IF G.Pack_Count
THEN 'only run if player has an Item start%% = 1 'start printing items 1 space lower to allow for the NEXT option
Create_Dialog_Box 25, 5, 19, 8
PS_Print 16 * 26, 16 * 8, "NEXT", Layer(1)
First%% = 0 'start with the first item , incremented witht the NEXT option
Last%% = 7 'print up to 8(0-7) items per screen
start%% = 0 'start printing normally due to no NEXT option
First%% = 0
Last%% = G.Pack_Count - 1
Create_Dialog_Box 25, 5, 17, 8
PS_Print 16 * 26, 16 * 6, "MST", Layer(1)
_PUTIMAGE (0, 0), Layer
(1), Layer
(0) 'move our creation to display temp&
= _COPYIMAGE(Layer
(0)) 'create a temp layer of display to use as a base image Opt%% = Opt%% - 1
IF Opt%%
= -1 THEN Opt%%
= Last%%
+ start%%
Opt%% = Opt%% + 1
IF Opt%%
= Last%%
+ start%%
+ 1 THEN Opt%%
= 0 IF start%%
THEN 'if start is set then there is a next option that must be checked Offset%% = Offset%% + 8
IF Offset%%
> G.Pack_Count
THEN Offset%%
= 0 IF Offset%%
= 0 THEN Last%%
= 7 ELSE Last%%
= G.Pack_Count
- Offset%%
ExitFlag%% = TRUE
Result%% = Opt%% + Offset%%
ExitFlag%% = TRUE
Result%% = Opt%%
ExitFlag%% = TRUE
IF blinkon%%
THEN PS_Print
16 * 25, 16 * (8 + (Opt%%
* 2)), "k", Layer
(1) ELSE PS_Print
16 * 25, 16 * (8 + (Opt%%
* 2)), "d", Layer
(1) 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 FOR I%%
= First%%
TO Last%%
PS_Print 16 * 26, 16 * (8 + (I%% + start%%) * 2), I(Pack(I%% + Offset%%)).Nam, Layer(1)
ELSE 'Player has no items to use start%% = 0
Create_Dialog_Box 25, 5, 17, 8
PS_Print 16 * 26, 16 * 6, "MST", Layer(1)
ID%% = Result%%
_PUTIMAGE (26 * 16, 5 * 16), Layer
(127), Layer
(0), (0, 0)-STEP(159, I%
) Run_Item_Selection_Menu = Result%%
FOR i%%
= id%%
TO G.Pack_Count
- 1 SWAP Pack
(i%%
), Pack
(i%%
+ 1) Pack(G.Pack_Count - 1) = 0
G.Pack_Count = G.Pack_Count - 1