X-Git-Url: https://deadsoftware.ru/gitweb?p=cavecraft.git;a=blobdiff_plain;f=src%2Fitems_logic.mpsrc;h=525f02dc3df91513b830952b08f65721292cc45b;hp=d4900720c14ff97e92740b4079910d991620deb5;hb=HEAD;hpb=1ef13d5bd0592dde48cc837e05b13e93e82db25b diff --git a/src/items_logic.mpsrc b/src/items_logic.mpsrc index d490072..525f02d 100644 --- a/src/items_logic.mpsrc +++ b/src/items_logic.mpsrc @@ -12,7 +12,8 @@ interface procedure updateBlock(x, y:integer); implementation - uses invui, maps, drop, console, furnace, png3, func, jpeg, mob, vars, bmp, items, chest, inv, player, items_store, particles, worldgen, phy, sign; + + uses invui, maps, drop, console, furnace, png3, func, jpeg, mobs, vars, bmp, chest, inv, player, items_store, particles, worldgen, phy, sign, Blocks; procedure usebonemeal(block:integer); var @@ -148,7 +149,7 @@ procedure boom(rr,mm,xx,yy:integer); begin if 30<=random(100) then destroy_block_1(getmap(ix,iy),ix,iy); setmap(0,ix,iy); - create_particle(7,(ix*16)+8-16,(iy*16)+8-16); + Particles.Create(Particles.explosion, (ix * 16) + 8 - 16, (iy * 16) + 8 - 16); end; end; minhp:=minhp/360; @@ -231,7 +232,7 @@ procedure destroy_block_cr(id, xx, yy:integer); setmap(0,xx,yy); destsign(getmapinfo(xx,yy)); end; else - if id=106 then + if (id = 106) or (id = 125) then begin setmap(0,xx,yy); DestroyFurnace(xx, yy); @@ -266,7 +267,7 @@ procedure destroy_block_cr(id, xx, yy:integer); begin if createsign(xx,yy)=-1 then set_block_code:=true; end; else - if it=106 then + if (it = 106) or (it = 125) then begin if CreateFurnace(xx, yy)=FURNACE_ERROR then set_block_code:=true; @@ -338,7 +339,7 @@ procedure destroy_block_cr(id, xx, yy:integer); begin destsign(getmapinfo(xx,yy)); end; else - if id=106 then + if (id = 106) or (id = 125) then begin DestroyFurnace(xx, yy); end; else @@ -578,7 +579,7 @@ procedure destroy_block_cr(id, xx, yy:integer); destsign(getmapinfo(xx,yy)); drop.create(104,1,xx*16+4,yy*16+4); end; else - if id=106 then + if (id = 106) or (id = 125) then begin setmap(0,xx,yy); DestroyFurnace(xx, yy); @@ -680,7 +681,7 @@ procedure destroy_block_cr(id, xx, yy:integer); if block=104 then keymode:=5;*/ else - if block=106 then + if (block = 106) or (block = 125) then OpenFurnaceWindow(info); else if block=107 then @@ -851,16 +852,16 @@ procedure destroy_block_cr(id, xx, yy:integer); else if item=180 then begin - if getBlockColl(block)=0 then + if Blocks.IsSolid(block) = false then begin - mob.create(M_ZOMBY, x*16, y*16); + Mobs.Create(Mobs.zomby, x * 16, y * 16); decItem(invcur); end; end; else if item=181 then begin - if getBlockColl(block)=0 then + if Blocks.IsSolid(block) = false then begin //create_mob(2, x*16, y*16); decItem(invcur); @@ -869,7 +870,7 @@ procedure destroy_block_cr(id, xx, yy:integer); else if item=182 then begin - if getBlockColl(block)=0 then + if Blocks.IsSolid(block) = false then begin //create_mob(3, x*16, y*16); decItem(invcur); @@ -1016,7 +1017,7 @@ procedure destroy_block_cr(id, xx, yy:integer); else if item=205 then begin - if getBlockColl(block)=0 then + if Blocks.IsSolid(block) = false then begin //create_mob(4, x*16, y*16); decItem(invcur); @@ -1025,7 +1026,7 @@ procedure destroy_block_cr(id, xx, yy:integer); else if item=206 then begin - if getBlockColl(block)=0 then + if Blocks.IsSolid(block) = false then begin //create_mob(5, x*16, y*16); decItem(invcur); @@ -1034,7 +1035,7 @@ procedure destroy_block_cr(id, xx, yy:integer); else if item=208 then begin - if getBlockColl(block)=0 then + if Blocks.IsSolid(block) = false then begin //create_mob(6, x*16, y*16); decItem(invcur); @@ -1043,7 +1044,7 @@ procedure destroy_block_cr(id, xx, yy:integer); else if item=209 then begin - if getBlockColl(block)=0 then + if Blocks.IsSolid(block) = false then begin //create_mob(7, x*16, y*16); decItem(invcur); @@ -1052,7 +1053,7 @@ procedure destroy_block_cr(id, xx, yy:integer); else if item=213 then begin - if getBlockColl(block)=0 then + if Blocks.IsSolid(block) = false then begin //create_mob(8, x*16, y*16); decItem(invcur); @@ -1061,7 +1062,7 @@ procedure destroy_block_cr(id, xx, yy:integer); else if item=212 then begin - if getBlockColl(block)=0 then + if Blocks.IsSolid(block) = false then begin //create_mob(10, x*16, y*16); decItem(invcur); @@ -1153,7 +1154,7 @@ procedure fluidLogic(x, y, ifbx, thenbx, ifby, thenby:integer); setMap(thenby, x, y+1); else //Если нижний блок можно уничтожить, то ставим туда копию - if getBlockSet(blockYp1) then + if Blocks.IsOverlapped(blockYp1) then begin destroy_block_0(blockYp1, x, y+1); setMap(block, x, y+1); @@ -1164,7 +1165,7 @@ procedure fluidLogic(x, y, ifbx, thenbx, ifby, thenby:integer); if blockXm1=ifbx then setMap(thenbx, x-1, y); else - if getBlockSet(blockXm1) then + if Blocks.IsOverlapped(blockXm1) then begin destroy_block_1(blockXm1, x-1, y); setMap(block, x-1, y); @@ -1173,7 +1174,7 @@ procedure fluidLogic(x, y, ifbx, thenbx, ifby, thenby:integer); if blockXp1=ifbx then setMap(thenbx, x+1, y); else - if getBlockSet(blockXp1) then + if Blocks.IsOverlapped(blockXp1) then begin destroy_block_1(blockXp1, x+1, y); setMap(block, x+1, y); @@ -1184,7 +1185,7 @@ procedure fluidLogic(x, y, ifbx, thenbx, ifby, thenby:integer); procedure updateBlock(x, y:integer); const GRASS_RND=128; - TORCH_RND=128; + TORCH_RND=10; SPAWN_RND=128; SPAWN_RAD=128; GENWOOD_RND=1024; @@ -1202,7 +1203,7 @@ procedure updateBlock(x, y:integer); if block=2 then begin //Трава разрастается при условии что освещение выше чем 3 - if (getBlockSet(getMap(x, y-1))=false) or (light=0) then + if (light = 0) or (Blocks.IsOverlapped(getMap(x, y - 1)) = false) then setMap(1, x, y); else if light>3 then @@ -1219,7 +1220,7 @@ procedure updateBlock(x, y:integer); else if block=7 then begin - if getBlockSet(getMap(x, y+1)) then + if Blocks.IsOverlapped(getMap(x, y+1)) then begin setMap(0, x, y); setMap(7, x, y+1); @@ -1228,7 +1229,7 @@ procedure updateBlock(x, y:integer); else if block=8 then begin - if getBlockSet(getMap(x, y+1)) then + if Blocks.IsOverlapped(getMap(x, y+1)) then begin setMap(0, x, y); setMap(8, x, y+1); @@ -1238,7 +1239,7 @@ procedure updateBlock(x, y:integer); if block=26 then begin if random(TORCH_RND)=random(TORCH_RND) then - create_particle(2, x*16+4, y*16+4); + Particles.Create(Particles.graySmoke, x * 16 + 4, y * 16 + 4); end; else if block=50 then @@ -1253,13 +1254,14 @@ procedure updateBlock(x, y:integer); else if block=63 then begin - if (light>7) or (getMap(x, y+1)=0) then - setmap(0, x, y); + // В зимнем биоме снег не растапливается при сильном свете + if ((light > 7) and (getBiomMap(x) <> 2)) or (getMap(x, y + 1) = 0) then + setmap(0, x, y); end; else if block=74 then begin - if getBlockSet(getMap(x, y-1))=false then + if Blocks.IsOverlapped(getMap(x, y-1))=false then setMap(1, x, y); else if light>3 then @@ -1345,7 +1347,15 @@ procedure updateBlock(x, y:integer); if block=105 then begin if random(TORCH_RND)=random(TORCH_RND) then - create_particle(4, x*16+4, y*16+4); + Particles.Create(Particles.redSmoke, x * 16 + 4, y * 16 + 4); + end; + else + if (block = 106) or (block = 125) then + begin + if furnaceBurn(getMapInfo(x, y)) then + setmap(125, x, y); + else + setmap(106, x, y); end; else if block=110 then @@ -1356,9 +1366,9 @@ procedure updateBlock(x, y:integer); else if block=30 then begin - if (random(GENWOOD_RND)=random(GENWOOD_RND)) and (getMap(x, y+2)<>30) then - setMap(30, x, y-1); - if (getMap(x, y+1)<>7) or (getMap(x, y+1)<>30) then + if (random(GENWOOD_RND) = random(GENWOOD_RND)) and (getMap(x, y + 2) <> 30) then + setMap(30, x, y - 1); + if (getMap(x, y + 1) <> 7) and (getMap(x, y + 1) <> 30) then begin setMap(0, x, y); destroy_block_1(block, x, y); @@ -1394,7 +1404,7 @@ procedure updateBlock(x, y:integer); if getmap(x, y+1)<>120 then setMap(0, x, y); - if (info=0) and (getMap(x-1, y)=0) and (getBlockColl(getMap(x-1, y+1))>0) then + if (info=0) and (getMap(x-1, y)=0) and Blocks.IsSolid(getMap(x-1, y+1)) then setmap(73, x-1, y); if (getMap(x-1, y)=73) and (getMapinfo(x, y)<>9) then @@ -1412,7 +1422,7 @@ procedure updateBlock(x, y:integer); if getmap(x, y+1)<>120 then setMap(0, x, y); - if (info=0) and (getMap(x-1, y)=0) and (getBlockColl(getMap(x-1, y+1))>0) then + if (info=0) and (getMap(x-1, y)=0) and Blocks.IsSolid(getMap(x-1, y+1)) then setmap(66, x-1, y); if (getMap(x-1, y)=66) and (getMapinfo(x, y)<>9) then