/*Dragonian Engine- */
/*Sierr Castle- First Floor*/
global.Map = "Maps/SierrMap.txt"

RoomA = "Lands/SierrCastleB.txt"
RoomB = "Lands/SierrTown.txt"
RoomC = 0
RoomD = 0
RoomE = 0
RoomF = 0
RoomG = 0
RoomH = 0
  
if sound_isplaying(CastleBGM) = 0 {
sound_loop(CastleBGM)
}
d3d_set_fog(true,c_white,128,5000)

CornerAX = 656
CornerAY = 160
CornerBX = 712
CornerBY = 1368 
z = 0
zHeight = 8
TexNo = 32
Switch = 0
instance_create(656,160,SuperBlock)
CornerAX = 864
CornerAY = 776
CornerBX = 1208
CornerBY = 1088 
z = 0
zHeight = 8
TexNo = 0
Switch = 0
instance_create(864,776,SuperBlock)
CornerAX = 512
CornerAY = 776
CornerBX = 648
CornerBY = 1088 
z = 0
zHeight = 8
TexNo = 28
Switch = 0
instance_create(512,776,SuperBlock)
CornerAX = 720
CornerAY = 776
CornerBX = 856
CornerBY = 1088 
z = 0
zHeight = 8
TexNo = 28
Switch = 0
instance_create(720,776,SuperBlock)
CornerAX = 720
CornerAY = 1096
CornerBX = 1208
CornerBY = 1368 
z = 0
zHeight = 8
TexNo = 28
Switch = 0
instance_create(720,1096,SuperBlock)
CornerAX = 160
CornerAY = 152
CornerBX = 648
CornerBY = 768 
z = 0
zHeight = 8
TexNo = 28
Switch = 0
instance_create(160,152,SuperBlock)
CornerAX = 720
CornerAY = 152
CornerBX = 1208
CornerBY = 768 
z = 0
zHeight = 8
TexNo = 28
Switch = 0
instance_create(720,152,SuperBlock)
CornerAX = 160
CornerAY = 776
CornerBX = 504
CornerBY = 1088 
z = 0
zHeight = 8
TexNo = 0
Switch = 0
instance_create(160,776,SuperBlock)
CornerAX = 160
CornerAY = 1096
CornerBX = 648
CornerBY = 1368 
z = 0
zHeight = 8
TexNo = 28
Switch = 0
instance_create(160,1096,SuperBlock)
CornerAX = 256
CornerAY = 160
CornerBX = 312
CornerBY = 384 
z = 0
zHeight = 16
TexNo = 28
Switch = 0
instance_create(256,160,SuperBlock)
CornerAX = 672
CornerAY = 160
CornerBX = 696
CornerBY = 184 
z = 0
zHeight = 16
TexNo = 16
Switch = 0
instance_create(672,160,SuperBlock)
CornerAX = 920
CornerAY = 160
CornerBX = 1208
CornerBY = 184 
z = 0
zHeight = 16
TexNo = 16
Switch = 0
instance_create(920,160,SuperBlock)
CornerAX = 1032
CornerAY = 296
CornerBX = 1088
CornerBY = 512 
z = 0
zHeight = 16
TexNo = 12
Switch = 0
instance_create(1032,296,SuperBlock)
CornerAX = 1184
CornerAY = 192
CornerBX = 1216
CornerBY = 312 
z = 0
zHeight = 16
TexNo = 12
Switch = 0
instance_create(1184,192,SuperBlock)
CornerAX = 256
CornerAY = 160
CornerBX = 312
CornerBY = 352 
z = 0
zHeight = 24
TexNo = 28
Switch = 0
instance_create(256,160,SuperBlock)
CornerAX = 656
CornerAY = 160
CornerBX = 664
CornerBY = 184 
z = 0
zHeight = 24
TexNo = 12
Switch = 0
instance_create(656,160,SuperBlock)
CornerAX = 704
CornerAY = 160
CornerBX = 712
CornerBY = 184 
z = 0
zHeight = 24
TexNo = 12
Switch = 0
instance_create(704,160,SuperBlock)
CornerAX = 256
CornerAY = 160
CornerBX = 312
CornerBY = 320 
z = 0
zHeight = 32
TexNo = 28
Switch = 0
instance_create(256,160,SuperBlock)
CornerAX = 976
CornerAY = 808
CornerBX = 1064
CornerBY = 832 
z = 0
zHeight = 32
TexNo = 28
Switch = 0
instance_create(976,808,SuperBlock)
CornerAX = 1040
CornerAY = 840
CornerBX = 1064
CornerBY = 896 
z = 0
zHeight = 32
TexNo = 28
Switch = 0
instance_create(1040,840,SuperBlock)
CornerAX = 976
CornerAY = 872
CornerBX = 1032
CornerBY = 896 
z = 0
zHeight = 32
TexNo = 28
Switch = 0
instance_create(976,872,SuperBlock)
CornerAX = 976
CornerAY = 840
CornerBX = 1000
CornerBY = 864 
z = 0
zHeight = 32
TexNo = 28
Switch = 0
instance_create(976,840,SuperBlock)
CornerAX = 256
CornerAY = 160
CornerBX = 312
CornerBY = 288 
z = 0
zHeight = 40
TexNo = 28
Switch = 0
instance_create(256,160,SuperBlock)
CornerAX = 256
CornerAY = 160
CornerBX = 312
CornerBY = 256 
z = 0
zHeight = 48
TexNo = 28
Switch = 0
instance_create(256,160,SuperBlock)
CornerAX = 256
CornerAY = 160
CornerBX = 312
CornerBY = 224 
z = 0
zHeight = 56
TexNo = 28
Switch = 0
instance_create(256,160,SuperBlock)
CornerAX = 256
CornerAY = 160
CornerBX = 312
CornerBY = 192 
z = 0
zHeight = 64
TexNo = 28
Switch = 0
instance_create(256,160,SuperBlock)
CornerAX = 0
CornerAY = 832
CornerBX = 216
CornerBY = 1048 
z = 0
zHeight = 64
TexNo = 28
Switch = 0
instance_create(0,832,SuperBlock)
CornerAX = 648
CornerAY = 160
CornerBX = 720
CornerBY = 160 
z = 0
zHeight = 64
TexNo = 16
Switch = 0
instance_create(648,160,SuperBlock)
CornerAX = 920
CornerAY = 160
CornerBX = 1216
CornerBY = 184 
z = 40
zHeight = 64
TexNo = 16
Switch = 0
instance_create(920,160,SuperBlock)
CornerAX = 672
CornerAY = 1368
CornerBX = 696
CornerBY = 1368 
z = 0
zHeight = 80
TexNo = 24
Switch = 0
instance_create(672,1368,SuperBlock)
CornerAX = 640
CornerAY = 1312
CornerBX = 664
CornerBY = 1368 
z = 0
zHeight = 80
TexNo = 28
Switch = 0
instance_create(640,1312,SuperBlock)
CornerAX = 704
CornerAY = 1312
CornerBX = 728
CornerBY = 1368 
z = 0
zHeight = 80
TexNo = 28
Switch = 0
instance_create(704,1312,SuperBlock)
CornerAX = 976
CornerAY = 808
CornerBX = 984
CornerBY = 816 
z = 24
zHeight = 96
TexNo = 28
Switch = 0
instance_create(976,808,SuperBlock)
CornerAX = 1056
CornerAY = 808
CornerBX = 1064
CornerBY = 816 
z = 24
zHeight = 96
TexNo = 28
Switch = 0
instance_create(1056,808,SuperBlock)
CornerAX = 1056
CornerAY = 888
CornerBX = 1064
CornerBY = 896 
z = 24
zHeight = 96
TexNo = 28
Switch = 0
instance_create(1056,888,SuperBlock)
CornerAX = 976
CornerAY = 888
CornerBX = 984
CornerBY = 896 
z = 24
zHeight = 96
TexNo = 28
Switch = 0
instance_create(976,888,SuperBlock)
CornerAX = 976
CornerAY = 808
CornerBX = 1064
CornerBY = 816 
z = 96
zHeight = 112
TexNo = 28
Switch = 0
instance_create(976,808,SuperBlock)
CornerAX = 1056
CornerAY = 824
CornerBX = 1064
CornerBY = 896 
z = 96
zHeight = 112
TexNo = 28
Switch = 0
instance_create(1056,824,SuperBlock)
CornerAX = 976
CornerAY = 888
CornerBX = 1048
CornerBY = 896 
z = 96
zHeight = 112
TexNo = 28
Switch = 0
instance_create(976,888,SuperBlock)
CornerAX = 976
CornerAY = 824
CornerBX = 984
CornerBY = 880 
z = 96
zHeight = 112
TexNo = 28
Switch = 0
instance_create(976,824,SuperBlock)
CornerAX = 608
CornerAY = 1312
CornerBX = 760
CornerBY = 1368 
z = 80
zHeight = 120
TexNo = 28
Switch = 0
instance_create(608,1312,SuperBlock)
CornerAX = 976
CornerAY = 848
CornerBX = 1064
CornerBY = 856 
z = 112
zHeight = 128
TexNo = 16
Switch = 0
instance_create(976,848,SuperBlock)
CornerAX = 256
CornerAY = 160
CornerBX = 312
CornerBY = 160 
z = 0
zHeight = 152
TexNo = 24
Switch = 0
instance_create(256,160,SuperBlock)
CornerAX = 1216
CornerAY = 160
CornerBX = 1368
CornerBY = 1528 
z = 0
zHeight = 192
TexNo = 28
Switch = 0
instance_create(1216,160,SuperBlock)
CornerAX = 160
CornerAY = 1376
CornerBX = 1208
CornerBY = 1528 
z = 0
zHeight = 192
TexNo = 28
Switch = 0
instance_create(160,1376,SuperBlock)
CornerAX = 0
CornerAY = 0
CornerBX = 1368
CornerBY = 152 
z = 0
zHeight = 192
TexNo = 28
Switch = 0
instance_create(0,0,SuperBlock)
CornerAX = 752
CornerAY = 1184
CornerBX = 776
CornerBY = 1208 
z = 0
zHeight = 192
TexNo = 28
Switch = 0
instance_create(752,1184,SuperBlock)
CornerAX = 320
CornerAY = 160
CornerBX = 440
CornerBY = 408 
z = 0
zHeight = 192
TexNo = 28
Switch = 0
instance_create(320,160,SuperBlock)
CornerAX = 592
CornerAY = 1184
CornerBX = 616
CornerBY = 1208 
z = 0
zHeight = 192
TexNo = 28
Switch = 0
instance_create(592,1184,SuperBlock)
CornerAX = 0
CornerAY = 0
CornerBX = 248
CornerBY = 408 
z = 0
zHeight = 192
TexNo = 28
Switch = 0
instance_create(0,0,SuperBlock)
CornerAX = 0
CornerAY = 416
CornerBX = 152
CornerBY = 824 
z = 0
zHeight = 192
TexNo = 28
Switch = 0
instance_create(0,416,SuperBlock)
CornerAX = 0
CornerAY = 928
CornerBX = 216
CornerBY = 952 
z = 0
zHeight = 192
TexNo = 28
Switch = 0
instance_create(0,928,SuperBlock)
CornerAX = 0
CornerAY = 864
CornerBX = 216
CornerBY = 888 
z = 0
zHeight = 192
TexNo = 28
Switch = 0
instance_create(0,864,SuperBlock)
CornerAX = 160
CornerAY = 800
CornerBX = 216
CornerBY = 824 
z = 0
zHeight = 192
TexNo = 28
Switch = 0
instance_create(160,800,SuperBlock)
CornerAX = 0
CornerAY = 1056
CornerBX = 152
CornerBY = 1528 
z = 0
zHeight = 192
TexNo = 28
Switch = 0
instance_create(0,1056,SuperBlock)
CornerAX = 0
CornerAY = 992
CornerBX = 216
CornerBY = 1016 
z = 0
zHeight = 192
TexNo = 28
Switch = 0
instance_create(0,992,SuperBlock)
CornerAX = 160
CornerAY = 1056
CornerBX = 216
CornerBY = 1080 
z = 0
zHeight = 192
TexNo = 28
Switch = 0
instance_create(160,1056,SuperBlock)
CornerAX = 0
CornerAY = 832
CornerBX = 216
CornerBY = 1048 
z = 128
zHeight = 192
TexNo = 28
Switch = 0
instance_create(0,832,SuperBlock)
CornerAX = 160
CornerAY = 640
CornerBX = 632
CornerBY = 792 
z = 0
zHeight = 192
TexNo = 28
Switch = 0
instance_create(160,640,SuperBlock)
CornerAX = 736
CornerAY = 640
CornerBX = 1208
CornerBY = 792 
z = 0
zHeight = 192
TexNo = 28
Switch = 0
instance_create(736,640,SuperBlock)
CornerAX = 592
CornerAY = 1032
CornerBX = 616
CornerBY = 1056 
z = 0
zHeight = 192
TexNo = 28
Switch = 0
instance_create(592,1032,SuperBlock)
CornerAX = 752
CornerAY = 1032
CornerBX = 776
CornerBY = 1056 
z = 0
zHeight = 192
TexNo = 28
Switch = 0
instance_create(752,1032,SuperBlock)
CornerAX = 592
CornerAY = 856
CornerBX = 616
CornerBY = 880 
z = 0
zHeight = 192
TexNo = 28
Switch = 0
instance_create(592,856,SuperBlock)
CornerAX = 752
CornerAY = 856
CornerBX = 776
CornerBY = 880 
z = 0
zHeight = 192
TexNo = 28
Switch = 0
instance_create(752,856,SuperBlock)
CornerAX = 640
CornerAY = 640
CornerBX = 728
CornerBY = 792 
z = 144
zHeight = 192
TexNo = 28
Switch = 0
instance_create(640,640,SuperBlock)
CornerAX = 760
CornerAY = 160
CornerBX = 912
CornerBY = 440 
z = 0
zHeight = 192
TexNo = 28
Switch = 0
instance_create(760,160,SuperBlock)
CornerAX = 760
CornerAY = 528
CornerBX = 912
CornerBY = 632 
z = 0
zHeight = 192
TexNo = 28
Switch = 0
instance_create(760,528,SuperBlock)
CornerAX = 160
CornerAY = 160
CornerBX = 1208
CornerBY = 632 
z = 152
zHeight = 192
TexNo = 28
Switch = 0
instance_create(160,160,SuperBlock)
CornerAX = 584
CornerAY = 800
CornerBX = 624
CornerBY = 1368 
z = 160
zHeight = 192
TexNo = 28
Switch = 0
instance_create(584,800,SuperBlock)
CornerAX = 744
CornerAY = 800
CornerBX = 784
CornerBY = 1368 
z = 160
zHeight = 192
TexNo = 28
Switch = 0
instance_create(744,800,SuperBlock)
CornerAX = 256
CornerAY = 160
CornerBX = 312
CornerBY = 192 
z = 8
zHeight = 192
TexNo = 28
instance_create(256,160,DoorBlock)
CornerAX = 672
CornerAY = 1320
CornerBX = 696
CornerBY = 1368 
z = 0
zHeight = 192
TexNo = 28
instance_create(672,1320,DoorBlock)
CornerAX = 1008
CornerAY = 840
CornerBX = 1032
CornerBY = 864 
z = 0
zHeight = 24
TexNo = 0
instance_create(1008,840,Water)

 
z = 8
instance_create(324,884,Flower)
z = 8
instance_create(372,948,Flower)
z = 8
instance_create(316,1004,Flower)
z = 8
instance_create(284,924,Flower)
z = 8
instance_create(364,860,Flower)
z = 8
instance_create(412,1004,Flower)
z = 8
instance_create(460,868,Flower)
z = 8
instance_create(1140,884,Flower)
z = 8
instance_create(1108,1020,Flower)
z = 8
instance_create(996,1052,Flower)
z = 8
instance_create(932,900,Flower)
z = 8
instance_create(932,1028,Flower)
z = 8
instance_create(1036,964,Flower)
z = 8
instance_create(1060,1044,Flower)
z = 8
instance_create(1156,988,Flower)
z = 8
instance_create(284,1044,Flower)
z = 8
instance_create(460,980,Flower)
z = 56
CreateDir = 270
instance_create(292,212,PointA)
z = 8
CreateDir = 90
instance_create(692,1300,PointB)
z = 192
instance_create(292,180,DoorA)
z = 192
instance_create(692,1340,DoorB)
z = 16
if global.Story < 4 Text = "Scripts/King1.txt" else Text = "Scripts/King2.txt"
instance_create(692,180,MapKing)
z = 8
Text = "Scripts/CasOM.txt"
instance_create(468,508,MapOldMan)
z = 8
Text = "Scripts/CasGuyA.txt"
instance_create(372,1060,MapGuyA)
z = 8
Text = "Scripts/CasGuyB.txt"
instance_create(1164,484,MapGuyB)
z = 8
Text = "Scripts/CasGirlA.txt"
instance_create(380,996,MapGirlA)
z = 8
Text = "Scripts/CasGirlB.txt"
instance_create(372,556,MapGirlB)
z = 8
Text = "Scripts/CasNun.txt"
instance_create(1020,260,MapNun)
z = 8
Text = "Scripts/GuardACastle.txt"
instance_create(324,428,MapGuardA)
z = 8
Text = "Scripts/GuardBCastle.txt"
instance_create(644,812,MapGuardB)
if global.Story = 2{
z = 8
Text = "Scripts/SabrinaB.txt"
if global.SabLove >=20 and global.SQItemD=0 Text="Scripts/SabQuest1.txt"
if ds_list_find_index(global.KHDB,"SPEAR") !=-1 and global.SQItemD=0 Text="Scripts/SabQuest2.txt"
if ds_list_find_index(global.KHDB,"DRESS") !=-1 and global.SQItemD=0 Text="Scripts/SabQuest3.txt"
if global.SQItemD =9 Text="Scripts/SabQuest1End.txt"
if global.SQItemD =11 Text="Scripts/SabQuest2End.txt"
if ds_list_find_index(global.KHDB,"BOOK") !=-1 Text="Scripts/SabrinaB.txt"
if global.SQItemA = 1 Text = "Scripts/SabTwelkin.txt"
if global.SabHeart=4 Text="Scripts/SabrinaWholeHearted.txt"
instance_create(964,972,MapSabrinaA)
}

if global.Story > 3{
z = 8
Text = "Scripts/SabrinaC.txt"
if global.SabLove >=20 and global.SQItemD=0 Text="Scripts/HMQuest1.txt"
if ds_list_find_index(global.KHDB,"SPEAR") !=-1 and global.SQItemD=0 Text="Scripts/HMQuest2.txt"
if ds_list_find_index(global.KHDB,"DRESS") !=-1 and global.SQItemD=0 Text="Scripts/HMQuest3.txt"
if global.SQItemD =9 Text="Scripts/HMQuest1End.txt"
if global.SQItemD=12 Text="Scripts/HMQuest3.txt"
if global.SQItemD =11 Text="Scripts/HMQuest2End.txt"
if ds_list_find_index(global.KHDB,"BOOK") !=-1 Text="Scripts/SabrinaC.txt"
if global.SQItemA = 1 Text = "Scripts/HMTwelkin.txt"
if global.SabHeart=4 Text="Scripts/HMWholeHearted.txt"
instance_create(964,972,MapMaid)
}
