X-Git-Url: https://deadsoftware.ru/gitweb?p=cavecraft.git;a=blobdiff_plain;f=src%2FCAVE.mpsrc;h=a43998d85f579e1be265f6d7b286907bd3f7f7a5;hp=830a6abac54eaeb688b7640322757eff3c4e9781;hb=bddd811f24b5890310e09e93a33600a58db39ec9;hpb=4d7cf2ab1e10d9926d03afb5a3f883bcf5312469 diff --git a/src/CAVE.mpsrc b/src/CAVE.mpsrc index 830a6ab..a43998d 100644 --- a/src/CAVE.mpsrc +++ b/src/CAVE.mpsrc @@ -1,7 +1,6 @@ program CAVE; uses - Items, sign, jsr75i, drop, @@ -29,7 +28,10 @@ uses inv, items_store, video, - Blocks; + Blocks, + BlocksLogic, + Items, + ItemsLogic; const version_map = 9; @@ -1967,7 +1969,7 @@ procedure draw; else if getBiomMap(ix) = 3 then drawimage(osad[0, osadki_ani], (ix * 16) - camx, (iy * 16) - camy) end; if drw_back and Blocks.IsTransporent(getmap(ix, iy)) then draw_back(ix, iy); - if Blocks.IsForeground(getmap(ix,iy)) = false then draw_block(ix,iy); + if Blocks.IsForeground(getmap(ix,iy)) = false then BlocksLogic.Draw(ix, iy, camx, camy); end; {===================[drop]===================} Drop.Draw(camx, camy); @@ -1981,7 +1983,7 @@ procedure draw; for ix:=minx to maxx do for iy:=miny to maxy do begin - if Blocks.IsForeground(getmap(ix, iy)) then draw_block(ix, iy); + if Blocks.IsForeground(getmap(ix, iy)) then BlocksLogic.Draw(ix, iy, camx, camy); setcolor(0, 0, 0); if light_type = 1 then @@ -2028,7 +2030,7 @@ procedure draw; drawimage(gui[1],tmp_ax,0); for ix:=0 to 8 do begin - Items.Draw(inv.getItem(ix), inv.getSum(ix), (ix*16)+tmp_ax+ix*2+4, 1, true); + ItemsLogic.Draw(inv.getItem(ix), inv.getSum(ix), (ix*16)+tmp_ax+ix*2+4, 1, true); end; drawimage(gui[17],(invslot*16)+tmp_ax+invslot*2+2,0); @@ -2169,14 +2171,14 @@ procedure usetools(invcur, x, y:integer); else if (block>0) then begin - if (Items.GetType(item) = Items.tool) and (getBlockTool(block)=getToolType(item)) then + if (Items.GetType(item) = Items.tool) and (Blocks.GetTool(block) = getToolType(item)) then toolus:=toolus+getToolSpeed(item); else toolus:=toolus+1; - if toolus>=getBlockHP(block) then + if toolus >= Blocks.GetResistant(block) then begin - if ((Items.GetType(item) = Items.tool) and (getBlockTool(block)=getToolType(item)) and (getToolLvl(item)>=getBlockLvl(block))) or (getBlockLvl(block)<=0) then + if ((Items.GetType(item) = Items.tool) and (Blocks.GetTool(block) = getToolType(item)) and (getToolLvl(item) >= Blocks.GetLevel(block))) or (Blocks.GetLevel(block) <= 0) then begin setMap(0, x, y); destroy_block_1(block, x, y); @@ -2200,8 +2202,9 @@ procedure usetools(invcur, x, y:integer); end; end; - if (toolus>0) and (toolus<=getBlockHP(block)) then - toolind:=((toolus*100) div getBlockHP(block)) div 10; + if (toolus > 0) and (toolus <= Blocks.GetResistant(block)) then begin + toolind := ((toolus * 100) div Blocks.GetResistant(block)) div 10; + end; end; function rt_useweap:boolean; @@ -2717,7 +2720,7 @@ procedure calc_sun(ix,m:integer); begin setmaplight(ss,ix,iy); if ss=0 then break; - ss:=ss-getBlockTr(getmap(ix,iy)); + ss := ss - Blocks.GetLightAbsorbtion(getmap(ix, iy)); if ss<0 then ss:=0; end; for iy:=iy+1 to 127 do @@ -2844,9 +2847,10 @@ procedure game; if clock_stage<>game_time div 75000 then begin clock_stage:=clock_stage+1; if clock_stage>7 then clock_stage:=0; end; - if x<0 then x:=0; - if x+8>4094 then x:=4086; - if getBlockColl(getmap(x div 16, y div 16))>0 then hp:=hp-1; + if x < 0 then x := 0; + else if x + 8 > 4094 then x := 4086; + if Blocks.IsSolid(getmap(x div 16, y div 16)) then hp := hp - 1; + if random(4096)=random(4096) then begin osadki:=not osadki; end; osadki_ani:=osadki_ani+1; if osadki_ani>7 then osadki_ani:=0; @@ -2885,9 +2889,11 @@ procedure game; for ix:=minx to maxx do for iy:=miny to maxy do begin - if light_type=0 then setmaplight(15,ix,iy); - else - if light_type>0 then if getBlockLi(getmap(ix,iy))>0 then calc_light(getBlockLi(getmap(ix,iy)),ix,iy); + if light_type = 0 then begin + SetMapLight(15, ix, iy); + end else if (light_type > 0) and (Blocks.GetLightEmission(getmap(ix, iy)) > 0) then begin + calc_light(Blocks.GetLightEmission(GetMap(ix, iy)), ix, iy); + end; end; minx:=(camx/16)-((getwidth/2)/16); @@ -3106,7 +3112,7 @@ procedure draw_debug; else if id = Items.painting5 then name := 'painting5' else if id = Items.painting6 then name := 'painting6' else if id = Items.painting7 then name := 'painting7' - else if id = Items.reservedBlockItem1 then name := 'reservedBlockItem1' + else if id = Items.giftChest then name := 'giftChest' else if id = Items.vines then name := 'vines' else if id = Items.sign then name := 'sign' else if id = Items.redstoneTorch then name := 'redstoneTorch' @@ -3126,11 +3132,11 @@ procedure draw_debug; else if id = Items.glassPlane then name := 'glassPlane' else if id = Items.farmland then name := 'farmland' else if id = Items.cake then name := 'cake' - else if id = Items.reservedBlockItem2 then name := 'reservedBlockItem2' - else if id = Items.reservedBlockItem3 then name := 'reservedBlockItem3' - else if id = Items.reservedBlockItem4 then name := 'reservedBlockItem4' - else if id = Items.reservedBlockItem5 then name := 'reservedBlockItem5' - else if id = Items.reservedBlockItem6 then name := 'reservedBlockItem6' + else if id = Items.wheatBlock then name := 'wheatBlock' + else if id = Items.melonStem then name := 'melonStem' + else if id = Items.pumpkinStem then name := 'pumpkinStem' + else if id = Items.burningFurnace then name := 'burningFurnace' + else if id = Items.reservedBlockItem then name := 'reservedBlockItem' else if id = Items.stick then name := 'stick' else if id = Items.dandelionYellow then name := 'dandelionYellow' else if id = Items.roseRed then name := 'roseRed' @@ -3271,6 +3277,21 @@ procedure draw_debug; for id := 0 to 194 do begin Debug(' InitOrdItem(' + ItemToString(Items.GetOrdinary(id)) + ');'); end; + + for id := 0 to 125 do begin + Debug(' InitBlock(' + ItemToString(id) + ', ' + + Blocks.GetTexture(id) + ', ' + + Blocks.GetResistant(id) + ', ' + + Blocks.GetTool(id) + ', ' + + Blocks.GetLevel(id) + ', ' + + Blocks.GetLightAbsorbtion(id) + ', ' + + Blocks.GetLightEmission(id) + ', ' + + Blocks.IsSolid(id) + ', ' + + Blocks.IsTransporent(id) + ', ' + + Blocks.IsForeground(id) + ', ' + + Blocks.IsOverlapped(id) + ');' + ); + end; end; begin