'World Builder V1.0
'2021 Unikorn Produckions
'Cobalt
'with feature suggestions from Bplus
'Other reviews\suggestions welcome.
Is_Dialog
AS INTEGER 'Denotes any situation where dialog occurs; signs, graves, notes, NPCs Is_Chest
AS INTEGER 'Denotes any situation where player gains; money, items, ect Is_Door
AS INTEGER 'denotes a location where the map changes to the inside of a building or new location.
Current_Layer
AS _BYTE 'layer that tiles are being applied to Walk_Block
AS _BYTE 'toggles if the tile is walkable Mouse_over_R
AS _BYTE 'Red value mouse is over Mouse_over_G
AS _BYTE 'Green Value Mouse is over Mouse_over_B
AS _BYTE 'Blue Value Mouse is over World_X
AS INTEGER 'current top left pos of map displayed Last_File
AS STRING * 32 'last file name Saved or Loaded LCtrl_Down
AS _BYTE 'is control key held down? LShft_Down
AS _BYTE 'Is the Left Shift Key held down? used to select & copy map area RShft_Down
AS _BYTE 'Is the Right Shift Key held down? used to paste copied map area(if any) Special_Count
AS INTEGER 'number of dialogs, chests, and Doors on map Dialog_ID
AS INTEGER 'the current number of Dialog tiles Chest_ID
AS INTEGER 'the current number of Chest tiles Door_ID
AS INTEGER 'the current number of Door tiles Has_Selection
AS _BYTE 'triggers whether or not the selection box shows Selecting_Area
AS _BYTE 'Triggered when user begins to select area TmpStartX
AS _BYTE 'top left corner of selection TmpEndX
AS _BYTE 'Bottom right corner of selection Copied
AS _BYTE 'is there a valid map copy in memory? Copied_X
AS _BYTE 'X size of copied area Copied_Y
AS _BYTE 'Y size of copied area
CONST TRUE
= -1, FALSE
= NOT TRUE
, Max_Tile
= 960, MaxItems
= 35 CONST Key_Right
= 19712, Key_Left
= 19200, Key_Up
= 18432, Key_Down
= 20480 CONST LCtrl
= 100306, LShft
= 100304, Rshft
= 100303
CONST VerInfo
= &HC0BA1102 CONST OldVer
= &HC0BA1101
DIM SHARED Chests
(1024) AS Chest_Data
, DoorWays
(1024) AS Door_Data
DATA "Nothing","Coins","Gems","Dagger","Book","Scroll","Bag","Sack","Rope","Envolope","Sword","Knife","Package","Lore Stone" DATA "Health Potion","Cure Potion","Rotten Potato","Smelly Sock","Stained Paper","Seeds","Pumpkins","Apples","Beans","Rice" DATA "Darts","Water Skin","Barrel","Iron Ingot","Gold Ingot","Wheel","Board","Key Ring","Jar","Mug","Bottle"
Facing$(0) = "Down"
Facing$(1) = "Left"
Facing$(2) = "Right"
Facing$(3) = "Up"
Init_World_Maker
Check_Input
Mouse_Logic
'------------------Display Update--------------------------
Display_Tiles
Display_Map_Area 0, 0, Layer(1)
Display_Selected_Box
Place_Mini_Map_Area_box
Display_Tile_Selection_Arrows
Display_Mini_Map_Arrows
Display_Load_Save_Buttons
Place_Toggle_Xs
Place_Current_Layer
IF P.AutoSave_Notice
THEN AutoSave_Notice
'tell player map was autosaved
IF P.Mouse_over_R
> 0 AND P.Mouse_over_B
> 0 THEN Mouse_Over_Data
_MOUSEX, _MOUSEY, P.World_X
+ P.Mouse_over_R
- 1, P.World_Y
+ P.Mouse_over_B
- 1
IF P.Has_Selection
AND NOT _MOUSEBUTTON(1) THEN P.Has_Selection
= Check_Selection_Valid
'confirm the selection was valid ' unless mousebutton down
IF P.Has_Selection
THEN 'draw the selection box if valid selection area IF SBlink%%
THEN L1%
= 255: L2%
= 32767 - 255 ELSE L2%
= 255: L1%
= 32767 - 255 LINE ((P.TmpStartX
) * 33 + 31, (P.TmpStartY
) * 33 + 71)-STEP(33 + P.TmpEndX
* 33, 33 + P.TmpEndY
* 33), _RGB32(160, 0, 0), B
, L1%
'selection box start points LINE ((P.TmpStartX
) * 33 + 31, (P.TmpStartY
) * 33 + 71)-STEP(33 + P.TmpEndX
* 33, 33 + P.TmpEndY
* 33), _RGB32(224, 224, 0), B
, L2%
'selection box start points ClearLayer Layer(1)
'-----------------------------------------------------------
S%% = S%% + 1
IF S%%
= 8 THEN SBlink%%
= NOT SBlink%%: S%%
= 0 Mouse_Clear
IF P.Quit
THEN Exitflag%%
= TRUE
'_DELAY 1
'SYSTEM
'------------------------------Mouse Logic statements--------------------------------------
IF NOT P.LShft_Down
THEN 'if shift is down user is selecting an area to copy IF NOT P.RShft_Down
THEN 'if right shift is down user is placing a map copy P.Clicked_tile = P.List_Start + P.Mouse_over_R
TileLayer(P.World_X + P.Mouse_over_R - 1, P.World_Y + P.Mouse_over_B - 1, P.Current_Layer) = P.Selected_Deco 'base tile placement(0-7 are base tiles)
World(P.World_X + P.Mouse_over_R - 1, P.World_Y + P.Mouse_over_B - 1).Walkable = TRUE
ELSEIF P.Current_Layer
> 0 THEN 'can only place decorations on layers 1-8 TileLayer(P.World_X + P.Mouse_over_R - 1, P.World_Y + P.Mouse_over_B - 1, P.Current_Layer) = P.Selected_Deco
World(P.World_X + P.Mouse_over_R - 1, P.World_Y + P.Mouse_over_B - 1).Walkable = P.Toggle_Walk
Display_Layer0_Error
IF P.Mouse_over_R
= 23 AND ((P.List_Start
+ 20) < Max_Tile
) THEN P.List_Start
= P.List_Start
+ 1:
_DELAY .05 IF P.Mouse_over_R
= 24 AND P.List_Start
> 0 THEN P.List_Start
= P.List_Start
- 1:
_DELAY .05 IF P.Mouse_over_R
= 25 THEN Build_MAP: Place_Mini_Map:
_DELAY .15 IF P.Mouse_over_R
= 26 AND P.World_X
>= 8 THEN P.World_X
= P.World_X
- 8:
_DELAY .15: P.Has_Selection
= FALSE
IF P.Mouse_over_R
= 27 AND P.World_X
< 240 THEN P.World_X
= P.World_X
+ 8:
_DELAY .15: P.Has_Selection
= FALSE
IF P.Mouse_over_R
= 28 AND P.World_Y
>= 8 THEN P.World_Y
= P.World_Y
- 8:
_DELAY .15: P.Has_Selection
= FALSE
IF P.Mouse_over_R
= 29 AND P.World_Y
< 240 THEN P.World_Y
= P.World_Y
+ 8:
_DELAY .15: P.Has_Selection
= FALSE
IF P.Mouse_over_R
= 30 THEN New_Map
IF P.Mouse_over_R
= 31 THEN Save_Map
IF P.Mouse_over_R
= 32 THEN Load_Map
IF P.Mouse_over_R
= 33 THEN P.Quit
= TRUE
IF P.Mouse_over_R
= 34 THEN P.Toggle_Walk
= NOT P.Toggle_Walk:
_DELAY .15 'tile walkable or non walkable IF P.Mouse_over_R
= 35 AND P.Current_Layer
< 8 THEN P.Current_Layer
= P.Current_Layer
+ 1:
_DELAY .15 ' IF P.Mouse_over_R
= 36 AND P.Current_Layer
THEN P.Current_Layer
= P.Current_Layer
- 1:
_DELAY .15 ' 'make sure user clicks in the map area.
P.TmpStartX = P.Mouse_over_R - 1: P.TmpStartY = P.Mouse_over_B - 1: P.Selecting_Area = TRUE 'get the starting tile
P.TmpEndX = P.Mouse_over_R - 1 - P.TmpStartX: P.TmpEndY = P.Mouse_over_B - 1 - P.TmpStartY 'allows click and drag selection(I hope)
IF P.TmpEndX
>= 0 THEN P.Has_Selection
= TRUE
ELSE P.Has_Selection
= FALSE
'suggested Function by Bplus (a good idea for 1 off tile placement too! )
IF P.Current_Layer
THEN 'layer 2 toggle is marked TileLayer(P.World_X + P.Mouse_over_R - 1, P.World_Y + P.Mouse_over_B - 1, P.Current_Layer) = P.Clicked_tile - 1
World(P.World_X + P.Mouse_over_R - 1, P.World_Y + P.Mouse_over_B - 1).Walkable = P.Toggle_Walk
P.Clicked_tile = 0
Display_Layer0_Error
Place_Auto_Tile
P.Selected_Base = P.Clicked_tile - 1 'only first 8 tiles(0-7) can be base
Change_Map_Base
P.Clicked_tile = 0
IF P.Selected_Base
<> P.Clicked_tile
- 1 THEN P.Selected_Deco = P.Clicked_tile - 1 'deco can not be base
P.Clicked_tile = 0
P.Clicked_tile = 0
Erase_Auto_Build
IF P.LCtrl_Down
THEN 'unless user is holding Left ctrl key down Popup_Menu 1
TileLayer(P.World_X + P.Mouse_over_R - 1, P.World_Y + P.Mouse_over_B - 1, 0) = P.Selected_Base 'restore the base
TileLayer(P.World_X + P.Mouse_over_R - 1, P.World_Y + P.Mouse_over_B - 1, l%) = -1 'erase any DECOrations
Place_Auto_Build
ELSE 'Display error box, cannot place on layer 0 Display_Layer0_Error
'------------------------------------------------------------------------------------------
SUB Display_Map_Area
(x%
, y%
, L&
) 'display Map tile location numbers
'display base
Show_Tile 32 + 33 * Ix%, 72 + 33 * Iy%, TileLayer(x% + Ix% + P.World_X, y% + Iy% + P.World_Y, 0), 1, L&
'display Deco(ration)
IF TileLayer
(x%
+ Ix%
+ P.World_X
, y%
+ Iy%
+ P.World_Y
, Il%
) THEN Show_Tile
32 + 33 * Ix%
, 72 + 33 * Iy%
, TileLayer
(x%
+ Ix%
+ P.World_X
, y%
+ Iy%
+ P.World_Y
, Il%
), 1, L&
TileLayer(X%, Y%, 0) = P.Selected_Base
'tile selection area
LINE (661, 17)-STEP(15, 31), _RGB32(23, 0, 0), BF
'move tiles left(increase) LINE (0, 17)-STEP(15, 31), _RGB32(24, 0, 0), BF
'Move tiles Right(decrease) 'mini map arrows+refresh
'auto build area(Green denotes X cord, Blue denotes Y cord)
LINE (786 + Ax%
* 33, 17 + Ay%
* 33)-STEP(31, 31), _RGB32(1, 1 + Ax%
, 1 + Ay%
), BF
'main map area (red denotes X cord, Blue denotes Y cord)
LINE (32 + Ix%
* 33, 72 + Iy%
* 33)-STEP(31, 31), _RGB32(1 + Ix%
, 0, 1 + Iy%
), BF
Layer
(1) = _NEWIMAGE(900, 640, 32) 'composite layer ' Layer(2) = _LOADIMAGE("linear_tiles.bmp", 32) 'world tiles
Layer
(3) = _NEWIMAGE(900, 640, 32) 'window setup Layer
(4) = _NEWIMAGE(900, 640, 32) 'Click layer ' Layer(5) = _LOADIMAGE("arrows.bmp", 32) 'arrow tiles
Layer
(6) = _NEWIMAGE(8192, 8192, 32) 'temp map for Mini Map display Layer
(7) = _NEWIMAGE(900, 640, 32) 'save\load window
MFI_Loader "WorldBuilderBeta.MFI"
P.World_X = 0: P.World_Y = 0
New_Map
'Build Construction Screen
Display_Tile_list_Section
Display_Auto_Build_Deco
Display_Selected_Base
Display_Selected_Deco
Display_Toggles
Display_Current_layer
Display_Mini_Map
Build_MAP
Place_Mini_Map
'-------------------------
Build_Click_Layer
P.Last_File = ""
P.Toggle_Walk = TRUE
P.Current_Layer = 0
SUB Display_Tile_Selection_Arrows
_PUTIMAGE (0, 17), Layer
(5), Layer
(1), (0, 32)-STEP(15, 31) 'left arrow(decending) Unlit _PUTIMAGE (0, 17), Layer
(5), Layer
(1), (0, 0)-STEP(15, 31) 'left arrow(decending) Lit IF P.List_Start
< Max_Tile
- 20 AND P.Mouse_over_R
<> 23 THEN _PUTIMAGE (660, 17), Layer
(5), Layer
(1), (16, 32)-STEP(15, 31) 'right arrow(increasing) UnLit _PUTIMAGE (660, 17), Layer
(5), Layer
(1), (16, 0)-STEP(15, 31) 'right arrow(increasing) Lit
SUB Check_Mouse_Over
(X%
, Y%
) Test~&
= POINT(X%
, Y%
) 'save a few cycles by just doing this once IF _RED32(Test~&
) THEN 'only bother if there is a red value(click areas all include a red base value of atleast 1) P.Mouse_over_R
= _RED32(Test~&
) 'all click events P.Mouse_over_G
= _GREEN32(Test~&
) 'for the auto build area P.Mouse_over_B
= _BLUE32(Test~&
) 'for the map area P.Mouse_over_R = 0
P.Mouse_over_G = 0
P.Mouse_over_B = 0
Auto(P.Mouse_over_G - 1, P.Mouse_over_B - 1) = P.Clicked_tile - 1
P.Clicked_tile = 0
SUB Mouse_ButtonDown_Hold
' _LIMIT 60
Auto(Ax%, Ay%) = 0
IF Auto
(Ax%
, Ay%
) THEN 'dont place blank tiles IF P.Mouse_over_R
- 1 + Ax%
<= 15 AND P.Mouse_over_B
- 1 + Ay%
<= 15 THEN 'only place if tiles show in map area TileLayer(P.World_X + P.Mouse_over_R - 1 + Ax%, P.World_Y + P.Mouse_over_B - 1 + Ay%, P.Current_Layer) = Auto(Ax%, Ay%)
World(P.World_X + P.Mouse_over_R - 1 + Ax%, P.World_Y + P.Mouse_over_B - 1 + Ay%).Walkable = FALSE
IF TileLayer
(X%
, Y%
, L%
) >= 0 THEN Show_Tile X%
* 32, Y%
* 32, TileLayer
(X%
, Y%
, L%
), 1, Layer
(6)
SUB Place_Mini_Map_Area_box
_PUTIMAGE (602 + P.World_X
, 132 + P.World_Y
)-STEP(15, 15), Layer
(5), Layer
(1), (0, 64)-STEP(31, 31)
SUB Display_Mini_Map_Arrows
_PUTIMAGE (583, 244), Layer
(5), Layer
(1), (0, 32)-STEP(15, 31) 'left arrow Unlit _PUTIMAGE (583, 244), Layer
(5), Layer
(1), (0, 0)-STEP(15, 31) 'left arrow lit _PUTIMAGE (861, 244), Layer
(5), Layer
(1), (16, 32)-STEP(15, 31) 'right arrow UnLit _PUTIMAGE (861, 244), Layer
(5), Layer
(1), (16, 0)-STEP(15, 31) 'right arrow Lit _PUTIMAGE (714, 114), Layer
(5), Layer
(1), (32, 32)-STEP(31, 15) 'up arrow Unlit _PUTIMAGE (714, 114), Layer
(5), Layer
(1), (32, 0)-STEP(31, 15) 'up arrow lit _PUTIMAGE (714, 390), Layer
(5), Layer
(1), (32, 48)-STEP(31, 15) 'down arrow UnLit _PUTIMAGE (714, 390), Layer
(5), Layer
(1), (32, 16)-STEP(31, 15) 'down arrow Lit _PUTIMAGE (600, 392)-STEP(64, 18), Layer
(5), Layer
(1), (32, 64)-STEP(15, 15) 'unlit(orange) _PUTIMAGE (600, 392)-STEP(64, 18), Layer
(5), Layer
(1), (0, 64)-STEP(31, 31) 'lit(yellow)
_PUTIMAGE (580, 55), Layer
(5), Layer
(1), (48, 64)-STEP(15, 15) 'place X
P.Selected_Deco = 0
Erase_Auto_Build
Reset_Map
P.Last_File = ""
Build_MAP
Place_Mini_Map
Tim! = 0
P.AutoSave_Notice = FALSE
SUB Mouse_Over_Data
(Mx%
, My%
, Wx%
, Wy%
) IF World
(Wx%
, Wy%
).Has_Dialog
THEN Extra%%
= Extra%%
+ 1 IF World
(Wx%
, Wy%
).Has_Chest
THEN Extra%%
= Extra%%
+ 1 IF World
(Wx%
, Wy%
).Has_Door
THEN Extra%%
= Extra%%
+ 1
T$
= T$
+ STR$(TileLayer
(Wx%
, Wy%
, l%%
)) LINE (8 + Mx%
, 16 + My%
)-STEP(10 + 8 * LEN(T$
), 32 + 16 * Extra%%
), _RGBA32(80, 80, 80, 104), BF
IF World
(Wx%
, Wy%
).Walkable
THEN W$
= "Walkable: YES" ELSE W$
= "Walkable: NO" IF World
(Wx%
, Wy%
).Has_Dialog
THEN _PRINTSTRING (8 + Mx%
+ 5, 16 + My%
+ 34 + 16 * Ext%%
), "Dialog " + STR$(Return_Special
(0)): Ext%%
= Ext%%
+ 1 IF World
(Wx%
, Wy%
).Has_Chest
THEN _PRINTSTRING (8 + Mx%
+ 5, 16 + My%
+ 34 + 16 * Ext%%
), "Chest " + STR$(Return_Special
(1)): Ext%%
= Ext%%
+ 1 IF World
(Wx%
, Wy%
).Has_Door
THEN _PRINTSTRING (8 + Mx%
+ 5, 16 + My%
+ 34 + 16 * Ext%%
), "Doorway " + STR$(Return_Special
(2))
IF _KEYDOWN(LShft
) THEN P.LShft_Down
= TRUE: P.Copied
= FALSE
ELSE P.LShft_Down
= FALSE: P.Selecting_Area
= FALSE:
IF Check_Selection_Valid
AND (NOT P.Copied
) THEN Copy_Map_Area
Selection%% = 1
Selection%% = 2
Selection%% = 3
Selection%% = 4
Selection%% = 5
Selection%% = 0
Create_Dialog
ExitFlag%% = TRUE
Fill_Chest
ExitFlag%% = TRUE
Add_DoorWay
ExitFlag%% = TRUE
Change_Layers
ExitFlag%% = TRUE
ExitFlag%% = TRUE
Mouse_Clear
_PUTIMAGE , Layer
(0), Layer
(1) 'back up the screen then draw the window on top
'check for existing dialog in this location
IF World
(P.World_X
+ P.Mouse_over_R
- 1, P.World_Y
+ P.Mouse_over_B
- 1).Has_Dialog
THEN D$
= RTRIM$(Dialogs
(Specials
(Return_Special
(0)).Is_Dialog
))
Selection%% = 1
Selection%% = 2
Selection%% = 0
CASE 27 'esc (acts like cancel) ExitFlag%% = TRUE
CASE 13 'insert line break (chr(1)) adds 2 characters " "
P.Dialog_ID = P.Dialog_ID + 1
P.Special_Count = P.Special_Count + 1
Specials(P.Special_Count).Xloc = P.Mouse_over_R - 1
Specials(P.Special_Count).Yloc = P.Mouse_over_B - 1
Specials(P.Special_Count).Is_Dialog = P.Dialog_ID
Dialogs(P.Dialog_ID) = D$
World(P.World_X + P.Mouse_over_R - 1, P.World_Y + P.Mouse_over_B - 1).Has_Dialog = TRUE
ExitFlag%% = TRUE
ExitFlag%% = TRUE
Bt%% = Bt%% + 1 'blink timer
IF Bt%%
= 8 THEN Blink%%
= NOT Blink%%: Bt%%
= 0
IF D$
<> "" THEN L%%
= Display_Dialog_InBox
(36, D$
) Mouse_Clear
FUNCTION Display_Dialog_InBox%%
(MaxLen%%
, Txt$
) Temp$ = Txt$
IF LEN(Temp$
) > MaxLen%%
THEN 'only bother if line is too long T$
= MID$(Temp$
, 1, MaxLen%%
) 'get the starting text for a line FOR i%%
= MaxLen%%
TO 1 STEP -1 'lets find a space toward the end IF MID$(T$
, i%%
, 1) = " " THEN stp%%
= i%%: i%%
= 0 T$
= MID$(T$
, 1, stp%%
- 1) 'get the line minus the space Temp$
= LTRIM$(MID$(Temp$
, stp%%
+ 1)) 'reduce the text including the space Line$
(c%%
) = T$
'store the found line c%% = c%% + 1 'next line
Done%% = TRUE
Display_Dialog_InBox
= LEN(Line$
(c%%
))
_PUTIMAGE , Layer
(0), Layer
(1) 'back up the screen then draw the window on top '---------------------Setup PopUp Window------------------------
'up arrow
LINE (309, 200)-STEP(12, 0), _RGB32(224):
LINE -(315, 194), _RGB32(224):
LINE -(309, 200), _RGB32(224):
PAINT (315, 197), _RGB32(224), _RGB32(224) 'Down arrow
LINE (309, 410)-STEP(12, 0), _RGB32(224):
LINE -(315, 416), _RGB32(224):
LINE -(309, 410), _RGB32(224):
PAINT (315, 413), _RGB32(224), _RGB32(224) 'Column
LINE (307 + i%%
, 206)-(307 + i%%
, 403), _RGB32(160), , 43690 LINE (308 + i%%
, 206)-(308 + i%%
, 403), _RGB32(160), , 21845 LINE (307 + i%%
, 206)-(307 + i%%
, 403), _RGB32(160), , 43690
'up arrow
LINE (489, 197)-STEP(10, 0), _RGB32(224):
LINE -(494, 192), _RGB32(224):
LINE -(489, 197), _RGB32(224):
PAINT (495, 195), _RGB32(224), _RGB32(224) 'down arrow
LINE (489, 203)-STEP(10, 0), _RGB32(224):
LINE -(494, 208), _RGB32(224):
LINE -(489, 203), _RGB32(224):
PAINT (495, 205), _RGB32(224), _RGB32(224)
ItemLoc% = 1
Hilite%% = 0
Item%% = 1
'check for existing chest in this location
Tag% = Specials(Return_Special(1)).Is_Chest
Item%% = Chests(Tag%).Item_ID
Count% = Chests(Tag%).Count
Trapped%% = Chests(Tag%).Trapped
'----------------------------------------------------------------
Selection%% = 1
Selection%% = 2
Selection%% = 3
Selection%% = 4
LINE (489, 197)-STEP(10, 0), _RGB32(224, 224, 16):
LINE -(494, 192), _RGB32(224, 224, 16):
LINE -(489, 197), _RGB32(224, 224, 16):
PAINT (495, 195), _RGB32(224, 224, 16), _RGB32(224, 224, 16) Selection%% = 5
LINE (489, 203)-STEP(10, 0), _RGB32(224, 224, 16):
LINE -(494, 208), _RGB32(224, 224, 16):
LINE -(489, 203), _RGB32(224, 224, 16):
PAINT (495, 205), _RGB32(224, 224, 16), _RGB32(224, 224, 16) Selection%% = 6
LINE (309, 200)-STEP(12, 0), _RGB32(224, 224, 16):
LINE -(315, 194), _RGB32(224, 224, 16):
LINE -(309, 200), _RGB32(224, 224, 16):
PAINT (315, 197), _RGB32(224, 224, 16), _RGB32(224, 224, 16) Selection%% = 7
LINE (309, 410)-STEP(12, 0), _RGB32(224, 224, 16):
LINE -(315, 416), _RGB32(224, 224, 16):
LINE -(309, 410), _RGB32(224, 224, 16):
PAINT (315, 413), _RGB32(224, 224, 16), _RGB32(224, 224, 16) Selection%% = 8
Selection%% = 0
CASE 27 'esc (acts like cancel) ExitFlag%% = TRUE
CASE 8 'back space (only if user clicks in COUNT box) CASE 48 TO 57 '0-9 (only if user clicks in COUNT box) ItemLoc% = ItemLoc% - 1
Hilite%% = Hilite%% - 1
Item%% = Hilite%% + ItemLoc%
IF ItemLoc%
+ 14 < MaxItems
AND Linput%%
THEN ItemLoc% = ItemLoc% + 1
IF Item%%
THEN Hilite%%
= Hilite%%
+ 1 Item%% = Hilite%% + ItemLoc%
World(P.World_X + P.Mouse_over_R - 1, P.World_Y + P.Mouse_over_B - 1).Has_Chest = TRUE
P.Chest_ID = P.Chest_ID + 1
P.Special_Count = P.Special_Count + 1
Specials(P.Special_Count).Xloc = P.Mouse_over_R - 1
Specials(P.Special_Count).Yloc = P.Mouse_over_B - 1
Specials(P.Special_Count).Is_Chest = P.Chest_ID
Chests(P.Chest_ID).Item_ID = Item%%
Chests(P.Chest_ID).Count = Count%
Chests(P.Chest_ID).Trapped = Trapped%%
ExitFlag%% = TRUE
ExitFlag%% = TRUE
Trapped%%
= NOT Trapped%%
Cinput%% = FALSE
Linput%% = FALSE
IF Count%
< 9998 THEN Count%
= Count%
+ 1 Cinput%% = FALSE
Linput%% = FALSE
IF Count%
> 1 THEN Count%
= Count%
- 1 Cinput%% = FALSE
Linput%% = FALSE
ItemLoc% = ItemLoc% - 1
IF Item%%
THEN Hilite%%
= Hilite%%
+ 1 Cinput%% = FALSE
Linput%% = FALSE
IF ItemLoc%
+ 14 < MaxItems
THEN ItemLoc% = ItemLoc% + 1
IF Item%%
THEN Hilite%%
= Hilite%%
- 1 Cinput%% = FALSE
Linput%% = FALSE
Linput%% = FALSE
Item%% = Selection%% - 9 + ItemLoc%
Hilite%% = Selection%% - 9
Cinput%% = FALSE
Linput%% = TRUE
IF Hilite%%
>= 0 AND Hilite%%
< 15 THEN 'hilite selected item if in display _PRINTSTRING (128, 192 + 15 * i%%
), I
(i%%
+ ItemLoc%
).N
, Layer
(1) _PUTIMAGE (360, 280)-STEP(127, 127), Layer
(8), Layer
(1), (64 * (Item%%
- 1), 0)-STEP(63, 63)
Bt%% = Bt%% + 1 'blink timer
IF Bt%%
= 8 THEN Blink%%
= NOT Blink%%: Bt%%
= 0 Mouse_Clear
'Down arrow
LINE (339, 343)-STEP(12, 0), _RGB32(96):
LINE -(345, 349), _RGB32(96):
LINE -(339, 343), _RGB32(96):
PAINT (345, 345), _RGB32(64), _RGB32(96)
'check for existing Door in this location
IF World
(P.World_X
+ P.Mouse_over_R
- 1, P.World_Y
+ P.Mouse_over_B
- 1).Has_Door
THEN Tag% = Specials(Return_Special(2)).Is_Door
F$
= RTRIM$(DoorWays
(Tag%
).New_Map
) FI%% = DoorWays(Tag%).Facing
Selection%% = 2
Selection%% = 1
Selection%% = 3
Selection%% = 4
Selection%% = 5
LINE (339, 343)-STEP(12, 0), _RGB32(224, 224, 16):
LINE -(345, 349), _RGB32(224, 224, 16):
LINE -(339, 343), _RGB32(224, 224, 16):
PAINT (345, 345), _RGB32(224, 224, 16), _RGB32(224, 224, 16) Selection%% = 6
Selection%% = 0
Selection%% = 7 + i%%
HlF%% = i%%
i%% = 4
Selection%% = 0
HlF%% = -1
ExitFlag%% = TRUE
CASE 33 TO 127 'no spaces allowed
World(P.World_X + P.Mouse_over_R - 1, P.World_Y + P.Mouse_over_B - 1).Has_Door = TRUE
P.Door_ID = P.Door_ID + 1
P.Special_Count = P.Special_Count + 1
Specials(P.Special_Count).Xloc = P.Mouse_over_R - 1
Specials(P.Special_Count).Yloc = P.Mouse_over_B - 1
Specials(P.Special_Count).Is_Door = P.Door_ID
DoorWays
(P.Door_ID
).New_Loc_X
= VAL(XL$
) DoorWays
(P.Door_ID
).New_Loc_Y
= VAL(YL$
) DoorWays(P.Door_ID).New_Map = F$
DoorWays(P.Door_ID).Facing = FI%%
ExitFlag%% = TRUE
ExitFlag%% = TRUE
Finput%% = TRUE
CinputX%% = FALSE
CinputY%% = FALSE
DropList%% = FALSE
CASE 4 'Enter X starting location Finput%% = FALSE
CinputX%% = TRUE
CinputY%% = FALSE
DropList%% = FALSE
CASE 5 'Enter Y starting location Finput%% = FALSE
CinputX%% = FALSE
CinputY%% = TRUE
DropList%% = FALSE
CASE 6 'Enter Facing Direction Finput%% = FALSE
CinputX%% = FALSE
CinputY%% = FALSE
DropList%% = TRUE
CASE 7 TO 10 'Select facing direction DropList%% = FALSE
FI%% = HlF%% 'Facing Indicator = Hilited Facing direction
CASE ELSE 'Cancel Facing Drop down list. IF DropList%%
THEN DropList%%
= FALSE
IF VAL(XL$
) = 0 THEN Dx%
= 1 ELSE Dx%
= VAL(XL$
) 'value check on start locations, 0 is invalid so adjust to 1
LINE (274, 335)-STEP(83, 72), _RGBA32(80, 80, 80, 80), BF
'Facing Direction IF Selection%%
AND HlF%%
= i%%
THEN LINE (275, 336 + 17 * i%%
)-STEP(79, 16), _RGBA32(10, 10, 180, 80), BF
'Facing Direction hilite
Mouse_Clear
Bt%% = Bt%% + 1 'blink timer
IF Bt%%
= 8 THEN Blink%%
= NOT Blink%%: Bt%%
= 0
'Experimental: Copy a section of the map to be pasted else where
'Suggested by Bplus
'-------------Erase Temp Area---------------
TempLayerCopy(x%, y%, 0) = P.Selected_Base
TempLayerCopy(x%, y%, l%) = -1
TempWorldCopy(x%, y%).Walkable = 0
TempWorldCopy(x%, y%).Has_Dialog = 0
TempWorldCopy(x%, y%).Has_Chest = 0
TempWorldCopy(x%, y%).Has_Door = 0
'--------------------------------------------
FOR Iy%%
= 0 TO P.TmpStartY
+ P.TmpEndY
FOR Ix%%
= 0 TO P.TmpStartX
+ P.TmpEndX
TempWorldCopy(Ix%%, Iy%%) = World(P.World_X + P.TmpStartX + Ix%%, P.World_Y + P.TmpStartY + Iy%%) 'copy the extra data
TempLayerCopy(Ix%%, Iy%%, l%%) = TileLayer(P.World_X + P.TmpStartX + Ix%%, P.World_Y + P.TmpStartY + Iy%%, l%%) 'copy the tile data
P.Copied = TRUE
P.Copied_X = P.TmpEndX 'Size of the copied area
P.Copied_Y = P.TmpEndY
SUB Paste_Map_Area
(Start_X%%
, Start_Y%%
) 'Experimental: Paste a section of the map copied from else where
'Suggested by Bplus
FOR Iy%%
= 0 TO P.Copied_Y
FOR Ix%%
= 0 TO P.Copied_X
IF TempLayerCopy
(Ix%%
, Iy%%
, l%%
) <> 0 THEN 'paste if there is tiledata to paste(non-0) TileLayer(P.World_X + P.TmpStartX + Ix%%, P.World_Y + P.TmpStartY + Iy%%, l%%) = TempLayerCopy(Ix%%, Iy%%, l%%)
World(Start_X%% + P.World_X + Ix%%, Start_Y%% + P.World_Y + Iy%%) = TempWorldCopy(Ix%%, Iy%%)
Result%% = TRUE
'end x and y must be greater than start x and y for selection to be valid
IF P.TmpStartX
+ P.TmpEndX
<= P.TmpStartX
AND P.TmpStartY
+ P.TmpEndY
<= P.TmpStartY
THEN Result%%
= FALSE
Check_Selection_Valid = Result%%
'Erases all map related data
TileLayer(x%, y%, 0) = 0
World(x%, y%).Walkable = TRUE
World(x%, y%).Has_Dialog = FALSE
World(x%, y%).Has_Chest = FALSE
World(x%, y%).Has_Door = FALSE
TileLayer(x%, y%, l%) = -1
P.World_X = 0
P.World_Y = 0
P.List_Start = 0
P.Toggle_Walk = TRUE
P.Current_Layer = 0
P.Has_Selection = FALSE
P.Special_Count = FALSE
P.Selected_Base = 0
P.Selected_Deco = 0
P.Dialog_ID = 0
P.Chest_ID = 0
P.Door_ID = 0
FOR i%
= 1 TO 3072 'erase specials Specials(i%) = Specials(0)
FOR i%
= 1 TO 1024 'erase dialogs, chests, and doorways Dialogs(i%) = ""
Chests(i%) = Chests(0)
DoorWays(i%) = DoorWays(0)
Mouse_Clear
_PRINTSTRING (300 - 8 * 12.5, 202), "Manual Layer Manipulation", Layer
(1)
LINE (247, 231 + 20 * I%%
)-STEP(8, 0), _RGB32(224):
LINE -(251, 227 + 20 * I%%
), _RGB32(224):
LINE -(247, 231 + 20 * I%%
), _RGB32(224):
PAINT (251, 229 + 20 * I%%
), _RGB32(224), _RGB32(224) LINE (247, 235 + 20 * I%%
)-STEP(8, 0), _RGB32(224):
LINE -(251, 239 + 20 * I%%
), _RGB32(224):
LINE -(247, 235 + 20 * I%%
), _RGB32(224):
PAINT (251, 237 + 20 * I%%
), _RGB32(224), _RGB32(224) Layer_Values(I%%) = TileLayer(P.World_X + P.Mouse_over_R - 1, P.World_Y + P.Mouse_over_B - 1, I%%) 'go ahead and get the tile values here
Mouse_Clear
Selection%% = 1
Selection%% = 2
Selection%% = 0
FOR I%%
= 0 TO 8 'input boxes FOR I%%
= 0 TO 8 'up arrows FOR I%%
= 0 TO 8 'down arrows
TileLayer(P.World_X + P.Mouse_over_R - 1, P.World_Y + P.Mouse_over_B - 1, I%%) = Layer_Values(I%%)
ExitFlag%% = TRUE
ExitFlag%% = TRUE
CASE 3 TO 11 'manual input boxes ManualInput%% = Selection%% - 2 'set the flag to which box is being inputed into.
CASE 12 TO 20 'up arrow increase IF Layer_Values
(Selection%%
- 12) < Max_Tile
THEN Layer_Values
(Selection%%
- 12) = Layer_Values
(Selection%%
- 12) + 1 IF Layer_Values
(0) > 7 THEN Layer_Values
(0) = 7 ManualInput%% = FALSE
CASE 21 TO 29 'down arrow decrease IF Layer_Values
(Selection%%
- 21) >= 0 THEN Layer_Values
(Selection%%
- 21) = Layer_Values
(Selection%%
- 21) - 1 IF Layer_Values
(0) < 0 THEN Layer_Values
(0) = 0 ManualInput%% = FALSE
C$
= LTRIM$(STR$(Layer_Values
(ManualInput%%
- 1))) CASE 27 'esc (acts like cancel) ExitFlag%% = TRUE
Layer_Values
(ManualInput%%
- 1) = VAL(C$
)
FOR I%%
= 0 TO 8 'display tile data numbers, if any IF Layer_Values
(I%%
) >= 0 THEN
IF Layer_Values
(ManualInput%%
- 1) >= 0 THEN _PRINTSTRING (204, 226 + 20 * (ManualInput%%
- 1)), "_", Layer
(1) Show_Tile 291, 241, Layer_Values(0), .5, Layer(1) 'base preview
Show_Tile 371, 281, Layer_Values(0), .5, Layer(1) 'composite preview
FOR I%%
= 1 TO 8 'DECOration preview IF Layer_Values
(I%%
) >= 0 THEN Show_Tile
291, 331, Layer_Values
(I%%
), .5, Layer
(1) IF Layer_Values
(I%%
) >= 0 THEN Show_Tile
371, 281, Layer_Values
(I%%
), .5, Layer
(1) 'composite preview Bt%% = Bt%% + 1 'blink timer
IF Bt%%
= 8 THEN Blink%%
= NOT Blink%%: Bt%%
= 0 Mouse_Clear
Result% = FALSE
FOR i%
= 1 TO P.Special_Count
IF Specials
(i%
).Xloc
= P.Mouse_over_R
- 1 AND Specials
(i%
).Yloc
= P.Mouse_over_B
- 1 AND Specials
(i%
).Is_Dialog
THEN Result%
= i%
IF Specials
(i%
).Xloc
= P.Mouse_over_R
- 1 AND Specials
(i%
).Yloc
= P.Mouse_over_B
- 1 AND Specials
(i%
).Is_Chest
THEN Result%
= i%
IF Specials
(i%
).Xloc
= P.Mouse_over_R
- 1 AND Specials
(i%
).Yloc
= P.Mouse_over_B
- 1 AND Specials
(i%
).Is_Door
THEN Result%
= i%
IF Result%
THEN i%
= P.Special_Count
+ 1 'no need to check further so tell loop its done. Return_Special = Result%
REM'$include:'Displays.BI' SUB Show_Tile
(X%
, Y%
, ID%
, Scale!
, L&
) Sx% = 32 / Scale! - 1
Sy% = 32 / Scale! - 1
SUB Display_Tile_list_Section
'--------------Tile sheet selection display-------------------
'-------------------------------------------------------------
SUB Display_Auto_Build_Deco
'------------------Auto Placement of premade deco-------------
'--------------------------------------------------------------
SUB Display_Selected_Base
'---------------Selected Map Base Tile--------------------
'-------------------------------------------------------------
SUB Display_Selected_Deco
'---------------Selected Deco Tile----------------------------
'-------------------------------------------------------------
SUB Display_Current_layer
'up arrow
LINE (679, 80)-STEP(10, 0), _RGB32(224):
LINE -(684, 75), _RGB32(224):
LINE -(679, 80), _RGB32(224):
PAINT (685, 77), _RGB32(224), _RGB32(224) 'down arrow
LINE (679, 85)-STEP(10, 0), _RGB32(224):
LINE -(684, 90), _RGB32(224):
LINE -(679, 85), _RGB32(224):
PAINT (685, 87), _RGB32(224), _RGB32(224)
SUB Display_Load_Save_Buttons
_PUTIMAGE (660, 460)-STEP(127, 31), Layer
(5), Layer
(1), (0, 96)-STEP(63, 15) 'new map _PUTIMAGE (660, 460)-STEP(127, 31), Layer
(5), Layer
(1), (0, 112)-STEP(63, 15) 'new map
Show_Tile 689, 17, P.Selected_Base, 1, Layer(1)
IF (P.Selected_Deco
<> P.Selected_Base
) AND P.Selected_Deco
THEN Show_Tile
737, 17, P.Selected_Deco
, 1, Layer
(1) 'Deco can not match Base IF Auto
(Ax%
, Ay%
) THEN Show_Tile
786 + Ax%
* 33, 17 + Ay%
* 33, Auto
(Ax%
, Ay%
), 1, Layer
(1) '0 is not valid for deco _PUTIMAGE (17, 17)-STEP(639, 31), Layer
(2), Layer
(1), (0 + 32 * P.List_Start
, 0)-STEP(639, 31)
'---------------Selected Tile Box--------------------
IF (P.Mouse_over_R
< 21 AND P.Mouse_over_R
> 0) AND (P.Mouse_over_B
= 0 AND P.Mouse_over_G
= 0) THEN _PUTIMAGE (17 + (P.Mouse_over_R
- 1) * 32, 17), Layer
(5), Layer
(1), (0, 64)-STEP(31, 31) '-------------------------------------------------------------
'---------------Selected Auto Box--------------------
IF P.Mouse_over_G
THEN _PUTIMAGE (786 + (P.Mouse_over_G
- 1) * 33, 17 + (P.Mouse_over_B
- 1) * 33), Layer
(5), Layer
(1), (0, 64)-STEP(31, 31) '-------------------------------------------------------------
'---------------Selected Map Tile Box--------------------
IF P.Mouse_over_B
AND P.Mouse_over_G
= 0 THEN _PUTIMAGE (32 + (P.Mouse_over_R
- 1) * 33, 72 + (P.Mouse_over_B
- 1) * 33), Layer
(5), Layer
(1), (0, 64)-STEP(31, 31) '-------------------------------------------------------------
REM'$include:'SaveLoad.bi' IF LTRIM$(P.Last_File
) <> "" THEN f$
= RTRIM$(P.Last_File
) 'use what ever name was used last(if any) ExitFlag%% = TRUE
ExitFlag%% = TRUE
Save_it f$
CASE 33 TO 127 'no spaces allowed ExitFlag%% = TRUE
Save_it f$
Mouse_Clear
Bt%% = Bt%% + 1 'blink timer
IF Bt%%
= 8 THEN Blink%%
= NOT Blink%%: Bt%%
= 0 P.Last_File = f$
IF File$
= "" THEN File$
= "Defualt" P.Special_Count = 7
Ver~& = VerInfo
PUT #F
, , P.Special_Count
FOR i%
= 1 TO P.Dialog_ID
Save_it "AutoSave"
P.AutoSave_Notice = TRUE
IF LTRIM$(P.Last_File
) <> "" THEN f$
= RTRIM$(P.Last_File
) 'use what ever name was used last(if any) ExitFlag%% = TRUE
ExitFlag%% = TRUE
Load_it f$
Build_MAP
Place_Mini_Map
CASE 33 TO 127 'no spaces allowed ExitFlag%% = TRUE
Load_it f$
Build_MAP
Mouse_Clear
Bt%% = Bt%% + 1 'blink timer
IF Bt%%
= 8 THEN Blink%%
= NOT Blink%%: Bt%%
= 0 P.Last_File = f$
IF File$
= "" THEN File$
= "Defualt" Erase_Auto_Build
Reset_Map
IF VerCheck&
<> VerInfo
THEN 'Old style Map needs converted FOR Y~%%
= 0 TO 255 'load the second setup (ver0.9 with verification) GET #F
, , TileLayer
(X~%%
, Y~%%
, 0) GET #F
, , TileLayer
(X~%%
, Y~%%
, 1) GET #F
, , TileLayer
(X~%%
, Y~%%
, 2) GET #F
, , World
(X~%%
, Y~%%
).Walkable
GET #F
, , World
(X~%%
, Y~%%
).Has_Dialog
GET #F
, , World
(X~%%
, Y~%%
).Has_Chest
GET #F
, , World
(X~%%
, Y~%%
).Has_Door
IF TileLayer
(X~%%
, Y~%%
, 1) = 0 THEN TileLayer
(X~%%
, Y~%%
, 1) = -1 IF TileLayer
(X~%%
, Y~%%
, 2) = 0 THEN TileLayer
(X~%%
, Y~%%
, 2) = -1 GET #F
, , P.Special_Count
FOR i%
= 1 TO P.Dialog_ID
SEEK #F
, 1 'reset file location for conversion FOR Y~%%
= 0 TO 255 'load the first setup (V1.0Beta 11/30/21-NO VerID) GET #F
, , TileLayer
(X~%%
, Y~%%
, 0) GET #F
, , TileLayer
(X~%%
, Y~%%
, 1) GET #F
, , TileLayer
(X~%%
, Y~%%
, 2) GET #F
, , World
(X~%%
, Y~%%
).Walkable
ELSE 'No conversion needed GET #F
, , P.Special_Count
FOR i%
= 1 TO P.Dialog_ID
REM'$include:'MFILoader.bi' GET #1, , c~%%
'retrieve number of files FOffset&(I~%%) = FOffset&(I~%%) + 1
Layer(2) = LoadGFX(FOffset(1), Size(1)) 'tiles
Layer(5) = LoadGFX(FOffset(2), Size(2)) 'Buttons
Layer(8) = LoadGFX(FOffset(3), Size(3)) 'items
SUB LoadData
(Foff&
, Size&
)
REM '$include:'MFI_Loader2.bi'