From 4983aa70fea163453968255c36b0689cfb412463 Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Sun, 10 Sep 2017 23:53:49 +0300 Subject: [PATCH] tools.cfg -> Tools.pas --- libs/Lib_items_store.class | Bin 2739 -> 1899 bytes libs/Lib_items_store.java | 71 ------- src/CAVE.mpsrc | 424 ++++++------------------------------- src/Items.pas | 70 +++--- src/Tools.pas | 115 ++++++++++ src/console.pas | 31 --- 6 files changed, 212 insertions(+), 499 deletions(-) create mode 100644 src/Tools.pas diff --git a/libs/Lib_items_store.class b/libs/Lib_items_store.class index f07d13faac9ba7bb9d70eac5488eff9b240bc130..d9575b8eef94977cfc2a54c2615d5351c6d90b18 100644 GIT binary patch literal 1899 zcmah~ZBrX%6g`{lOLntKfHt*kT52m*S_oJ|(IWbxRA*v&v2EJw;K+oq;8sXF$)b+V z_#gT!_`;XMjLtY6{nRi1DD~WDUy=+RrNcgV?{n_C=bqLSi^}~a0zuRbT?=zF{ z`aM5XU3!E~)dihPQmmM&5B$iclWYcU4VK!LbUsOU4nqyatw}y8i65=J!n(=TUayqTr$^j}k^)jAG2iIgDsHC!o3gW_xe$(;r*@^DyYN zEiAeC2xWCBLzEgu`uL6QXMT%@4p20{?RI{MPOtR58??hmVYBsJquXrxc$@bu55Pc9 zVJ)FtW~VS`ajFq))w zGgM~7LnUtcCqFcqrE`L8cHXPJXq-T2a7lu!KJQ&t83tutr3^-f%1LCZoXN;iIf-%- z8D80z)%42F#tAI1oPW_cg0tj~yQ%0M?4_a?m5gyEZjACOxPC@eX!4PMZjuII&p#yT@S+t`{l263?JB;0#AFmh{M~F&<4~)fjZ*Z<1x22F>tf zs*ER6#``g2MJ7__m|WCA!=z=poRD5nBIbDtHJ-u(+uf$)izL3nAtI@ZB$n32RO%7* z^+=%2dzNq&i32aSjb$42G1sea;*cqMWdFr+m$fV8xX1Mx4UBXwkY75u@qlDli&R*= z_rogcoal3Y3-`$|nKIO3hP)hhWus4E5;jcm1#kTW(mv$Q^^{;hf+ZgJ8O}<0N(o<5 z!dGN?msdU-qQdiRvK(9Kyv=l~i1=EQeh3qmq36-pmLB6`**pU%&3JzwVyb{Pp+aUr~h~%vh+y zNHuD4%|wIj*JZgO%S~Bs$uerT1+!Y9`~`XcsxF>&WcrPMf8CcA0U!VlhAGy}jxh zNGLh~FmJ$8VtLhd7XzEc>Ql zAXPEa<%)};*ws{SR8eY!GySw_jHY54V(?~*(WMBk*+9TsdD8)y9Vblij;(g zAwn2rhougpD=Gb8X{3ZA>Jlb&byWWJlMCHR%Ri}J+Wx`sX3{_Eep=JTwbFunBPUI3 z7|+eCZ>Kz0_KGF9_d)hy)wWuUHtF*X0dU0@$~z-C@A72nj~R_$sjSMa92 z?7|zFQg*?`QNEly02UI$lTt#cs-0}rPQq#@XSI{I+R07rq^EW=R69v>Z{i=*hrt*i zaf81=?9|UN9#JrGjB8ve`9HLYR$Tp&Z5K~d(&J%0fXOP%HV*K<^upTK| zoj6G-O}_&sL5?dn_2kpc5FNblL>JDWoBETKbXvcWWeu&1TZmQ-IIZiMEyO6ai4ctr zIPFS9K~kV9Mk%IrBE^+1PRUd{krE=soyKa}O{dYC+Csu zi~@7mKx`J?_2xVMvy2 z+5cg@MBkT*@e21o7FhE*OMHo7`w0?ZLbEXW`hqfP7Oyg+IVABK_5C42+DAxAvs%YCfXwLg*^F%gkWzi6Aob*SYVF{V`*ILV%%g=*%z$ z0XU{cOj513T5Hsr+C6BR`7#4ejv8>Ea{Y`I`J6B43qFG{IWNDW&GWeESLZ&vBcrfu z3rYQoY&~FV^ms|B;Ud!^))EV+LpyPHNBWxG|AtTMTRy4pI6J@RAp3zfFND?TXCz66 zec<;Pank9qn0ssSBWtlq_e=Y^^FbWozD4(Kx?kSUodgbW|Ap?4>3(HDcaDVv+<&M0 MAFS_HW*foqzks#1=l}o! diff --git a/libs/Lib_items_store.java b/libs/Lib_items_store.java index 75245bb..b1e4eca 100644 --- a/libs/Lib_items_store.java +++ b/libs/Lib_items_store.java @@ -1,8 +1,5 @@ class Lib_items_store { - /*Items*/ - static byte[] item_info; - /*Craft*/ static byte[] [] craftIN_item; static byte[] [] craftIN_sum; @@ -10,24 +7,6 @@ class Lib_items_store static int[] craftOUT_sum; static byte[] craftOUT_flag; - /*Tools*/ - static byte[] tool_type; - static byte[] tool_lvl; - static byte[] tool_speed; - static byte[] tool_damg; - - /* Items */ - - public static void resetitems(int len) - { - item_info = new byte[len]; - } - - public static void setitemdata(int id, int type, int tex, int max, int info, int flags) - { - item_info[id] = (byte) info; - } - /*Craft*/ public static void resetcrafts(int len) { @@ -143,54 +122,4 @@ class Lib_items_store return craftOUT_flag[id] & 0xFF; } catch(Exception e) { return 0xFF;} } - -/*Tools*/ - public static void resettools(int len) - { - try { - tool_type = new byte[len]; - tool_lvl = new byte[len]; - tool_speed = new byte[len]; - tool_damg = new byte[len]; - } catch(Exception e) {e.printStackTrace();} - } - - public static void settooldata(int id, int tool, int lvl, int speed, int damg) - { - try { - tool_type[id] = (byte) tool; - tool_lvl[id] = (byte) lvl; - tool_speed[id] = (byte) speed; - tool_damg[id] = (byte) damg; - } catch(Exception e) {e.printStackTrace();} - } - - public static int gettooltype(int id) - { - try { - return tool_type[item_info[id]]; - } catch(Exception e) { return 0;} - } - - public static int gettoollvl(int id) - { - try { - return tool_lvl[item_info[id]]; - } catch(Exception e) { return 0;} - } - - public static int gettoolspeed(int id) - { - try { - return tool_speed[item_info[id]]; - } catch(Exception e) { return 0;} - } - - public static int gettooldamg(int id) - { - try { - return tool_damg[item_info[id]]; - } catch(Exception e) { return 0;} - } - } diff --git a/src/CAVE.mpsrc b/src/CAVE.mpsrc index a43998d..db30c2d 100644 --- a/src/CAVE.mpsrc +++ b/src/CAVE.mpsrc @@ -31,7 +31,8 @@ uses Blocks, BlocksLogic, Items, - ItemsLogic; + ItemsLogic, + Tools; const version_map = 9; @@ -2158,83 +2159,72 @@ procedure resetToolProgerss; toolind:=0; end; -procedure usetools(invcur, x, y:integer); - var - item, sum, block:integer; - begin - block:=getmap(x, y); - item:=inv.getItem(invcur); - sum:=inv.getSum(invcur); - - if gamemode=1 then - destroy_block_cr(block, x, y); - else - if (block>0) then - begin - if (Items.GetType(item) = Items.tool) and (Blocks.GetTool(block) = getToolType(item)) then - toolus:=toolus+getToolSpeed(item); - else - toolus:=toolus+1; + procedure usetools(invcur, x, y : integer); + var + item, sum, block, tool : integer; + begin + block := GetMap(x, y); + item := Inv.GetItem(invcur); + sum := Inv.GetSum(invcur); + tool := Items.GetData(item); + + if gamemode = 1 then begin + destroy_block_cr(block, x, y); + end else if block <> 0 then begin + if (Items.GetType(item) = Items.tool) and (Blocks.GetTool(block) = Tools.GetType(tool)) then begin + toolus := toolus + Tools.GetSpeed(tool); + end else begin + toolus := toolus + 1; + end; - if toolus >= Blocks.GetResistant(block) then - begin - 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); - setMapInfo(0, x, y); - end; - else - begin - setMap(0, x, y); - destroy_block_0(block, x, y); - setMapInfo(0, x, y); - end; + if toolus >= Blocks.GetResistant(block) then begin + Debug('usetools: tool = ' + tool); + if ((Items.GetType(item) = Items.tool) and (Blocks.GetTool(block) = Tools.GetType(tool)) and (Tools.GetLevel(tool) >= Blocks.GetLevel(block))) or (Blocks.GetLevel(block) <= 0) then begin + SetMap(0, x, y); + destroy_block_1(block, x, y); + SetMapInfo(0, x, y); + end else begin + SetMap(0, x, y); + destroy_block_0(block, x, y); + SetMapInfo(0, x, y); + end; - if Items.GetType(item) = Items.tool then - begin - inv.setSum(inv.getSum(invcur)-1, invcur); - inv.fixNull(invcur); - end; + if Items.GetType(item) = Items.tool then begin + Inv.SetSum(Inv.GetSum(invcur) - 1, invcur); + Inv.FixNull(invcur); + end; - toolus:=0; - toolind:=0; - end; - end; + toolus:=0; + toolind:=0; + end; + end; - if (toolus > 0) and (toolus <= Blocks.GetResistant(block)) then begin - toolind := ((toolus * 100) div Blocks.GetResistant(block)) div 10; + if (toolus > 0) and (toolus <= Blocks.GetResistant(block)) then begin + toolind := ((toolus * 100) div Blocks.GetResistant(block)) div 10; + end; end; - end; - -function rt_useweap:boolean; - var - x, y, w, h, i, damg:integer; - item:integer; - begin - x:=player.getX; - y:=player.getY; - w:=player.getW; - h:=player.getH; - item:=inv.getItem(invslot); - if Items.GetType(item) = Items.tool then - damg:=getToolDamg(item); - else - damg:=1; - - if posi=0 then - i:=Mobs.findAndHit(damg, x-TILE_SIZE, y, TILE_SIZE+(w/2), h, -2, -3); - else - i:=Mobs.findAndHit(damg, x+(w/2), y, TILE_SIZE+(w/2), h, 2, -3); - - if i<>-1 then - begin - inv.setSum(inv.getSum(invslot)-1, invslot); - inv.fixNull(invslot); - rt_useweap:=true; - end; - end; + function rt_useweap:boolean; + var + item : integer; + x, y, w, h, i, damg : integer; + begin + x := Player.GetX; + y := Player.GetY; + w := Player.GetW; + h := Player.GetH; + item := Inv.GetItem(invslot); + if Items.GetType(item) = Items.tool then damg := Tools.GetDamage(item) else damg := 1; + + if posi=0 then i := Mobs.FindAndHit(damg, x - TILE_SIZE, y, TILE_SIZE + (w / 2), h, -2, -3); + else i := Mobs.FindAndHit(damg, x + (w / 2), y, TILE_SIZE + (w / 2), h, 2, -3); + + if i >= 0 then begin + Inv.SetSum(Inv.GetSum(invslot) - 1, invslot); + Inv.FixNull(invslot); + rt_useweap := true; + end; + end; procedure rt_usetools; var @@ -3006,294 +2996,6 @@ procedure draw_debug; drawImage(light[i], getWidth - 16, 16 * i); end; - function ItemToString(id : integer) : string; - var - name : string; - begin - if id = Items.none then name := 'none' - else if id = Items.dirt then name := 'dirt' - else if id = Items.grass then name := 'grass' - else if id = Items.stone then name := 'stone' - else if id = Items.oakWoodPlanks then name := 'oakWoodPlanks' - else if id = Items.cobblestone then name := 'cobblestone' - else if id = Items.bedrock then name := 'bedrock' - else if id = Items.sand then name := 'sand' - else if id = Items.gravel then name := 'gravel' - else if id = Items.oakWood then name := 'oakWood' - else if id = Items.obsidian then name := 'obsidian' - else if id = Items.bookshelf then name := 'bookshelf' - else if id = Items.mossStone then name := 'mossStone' - else if id = Items.blockOfIron then name := 'blockOfIron' - else if id = Items.blockOfGold then name := 'blockOfGold' - else if id = Items.blockOfDiamond then name := 'blockOfDiamond' - else if id = Items.goldOre then name := 'goldOre' - else if id = Items.ironOre then name := 'ironOre' - else if id = Items.coalOre then name := 'coalOre' - else if id = Items.diamondOre then name := 'diamondOre' - else if id = Items.redstoneOre then name := 'redstoneOre' - else if id = Items.oakLeaves then name := 'oakLeaves' - else if id = Items.redFlower then name := 'redFlower' - else if id = Items.yellowFlower then name := 'yellowFlower' - else if id = Items.redMooshroom then name := 'redMooshroom' - else if id = Items.brownMooshroom then name := 'brownMooshroom' - else if id = Items.torch then name := 'torch' - else if id = Items.tnt then name := 'tnt' - else if id = Items.chest then name := 'chest' - else if id = Items.craftingTable then name := 'craftingTable' - else if id = Items.cactus then name := 'cactus' - else if id = Items.glass then name := 'glass' - else if id = Items.wool1 then name := 'wool1' - else if id = Items.wool2 then name := 'wool2' - else if id = Items.wool3 then name := 'wool3' - else if id = Items.wool4 then name := 'wool4' - else if id = Items.wool5 then name := 'wool5' - else if id = Items.wool6 then name := 'wool6' - else if id = Items.wool7 then name := 'wool7' - else if id = Items.wool8 then name := 'wool8' - else if id = Items.wool9 then name := 'wool9' - else if id = Items.wool10 then name := 'wool10' - else if id = Items.wool11 then name := 'wool11' - else if id = Items.wool12 then name := 'wool12' - else if id = Items.wool13 then name := 'wool13' - else if id = Items.wool14 then name := 'wool14' - else if id = Items.wool15 then name := 'wool15' - else if id = Items.wool16 then name := 'wool16' - else if id = Items.snow then name := 'snow' - else if id = Items.ladder then name := 'ladder' - else if id = Items.water then name := 'water' - else if id = Items.lava then name := 'lava' - else if id = Items.oakSapling then name := 'oakSapling' - else if id = Items.sponge then name := 'sponge' - else if id = Items.lapisLazuliOre then name := 'lapisLazuliOre' - else if id = Items.lapisLazuliBlock then name := 'lapisLazuliBlock' - else if id = Items.sandstone then name := 'sandstone' - else if id = Items.tallGrass then name := 'tallGrass' - else if id = Items.deadBush then name := 'deadBush' - else if id = Items.cobweb then name := 'cobweb' - else if id = Items.bricks then name := 'bricks' - else if id = Items.snowBlock then name := 'snowBlock' - else if id = Items.ice then name := 'ice' - else if id = Items.snowLayer then name := 'snowLayer' - else if id = Items.clayBlock then name := 'clayBlock' - else if id = Items.sugarCane then name := 'sugarCane' - else if id = Items.pumpkin then name := 'pumpkin' - else if id = Items.jackLantern then name := 'jackLantern' - else if id = Items.stoneBricks then name := 'stoneBricks' - else if id = Items.mossyStoneBricks then name := 'mossyStoneBricks' - else if id = Items.crackedStoneBricks then name := 'crackedStoneBricks' - else if id = Items.chiseledStokeBricks then name := 'chiseledStokeBricks' - else if id = Items.ironBras then name := 'ironBras' - else if id = Items.melonBlock then name := 'melonBlock' - else if id = Items.mycelium then name := 'mycelium' - else if id = Items.backgroundOakWood then name := 'backgroundOakWood' - else if id = Items.spawner then name := 'spawner' - else if id = Items.bed1 then name := 'bed1' - else if id = Items.bed2 then name := 'bed2' - else if id = Items.openWoodenDoor1 then name := 'openWoodenDoor1' - else if id = Items.openWoodenDoor2 then name := 'openWoodenDoor2' - else if id = Items.closedWoodenDoor1 then name := 'closedWoodenDoor1' - else if id = Items.closedWoodenDoor2 then name := 'closedWoodenDoor2' - else if id = Items.birchWood then name := 'birchWood' - else if id = Items.backgroundBirchWood then name := 'backgroundBirchWood' - else if id = Items.spruceWood then name := 'spruceWood' - else if id = Items.backgroundSpruceWood then name := 'backgroundSpruceWood' - else if id = Items.spruceLeaves then name := 'spruceLeaves' - else if id = Items.redMushroomBlock1 then name := 'redMushroomBlock1' - else if id = Items.redMushroomBlock2 then name := 'redMushroomBlock2' - else if id = Items.brownMushroomBlock1 then name := 'brownMushroomBlock1' - else if id = Items.brownMushroomBlock2 then name := 'brownMushroomBlock2' - else if id = Items.oakFence then name := 'oakFence' - else if id = Items.backgroundOakFence then name := 'backgroundOakFence' - else if id = Items.backgroundOakWoodPlanks then name := 'backgroundOakWoodPlanks' - else if id = Items.painting1 then name := 'painting1' - else if id = Items.painting2 then name := 'painting2' - else if id = Items.painting3 then name := 'painting3' - else if id = Items.painting4 then name := 'painting4' - 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.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' - else if id = Items.furnace then name := 'furnace' - else if id = Items.closedWoodenTrapdoor then name := 'closedWoodenTrapdoor' - else if id = Items.openWoodenTrapdoor then name := 'openWoodenTrapdoor' - else if id = Items.netherrack then name := 'netherrack' - else if id = Items.netherPortal then name := 'netherPortal' - else if id = Items.glowstone then name := 'glowstone' - else if id = Items.birchLeaves then name := 'birchLeaves' - else if id = Items.soulSand then name := 'soulSand' - else if id = Items.birchSapling then name := 'birchSapling' - else if id = Items.spruceSapling then name := 'spruceSapling' - else if id = Items.redstoneLampOff then name := 'redstoneLampOff' - else if id = Items.redstoneLampOn then name := 'redstoneLampOn' - else if id = Items.backgroundObsidian then name := 'backgroundObsidian' - 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.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' - else if id = Items.superSpecialUnneededTool then name := 'superSpecialUnneededTool' - else if id = Items.pickaxe1 then name := 'pickaxe1' - else if id = Items.pickaxe2 then name := 'pickaxe2' - else if id = Items.pickaxe3 then name := 'pickaxe3' - else if id = Items.pickaxe4 then name := 'pickaxe4' - else if id = Items.pickaxe5 then name := 'pickaxe5' - else if id = Items.shovel1 then name := 'shovel1' - else if id = Items.shovel2 then name := 'shovel2' - else if id = Items.shovel3 then name := 'shovel3' - else if id = Items.shovel4 then name := 'shovel4' - else if id = Items.shovel5 then name := 'shovel5' - else if id = Items.axe1 then name := 'axe1' - else if id = Items.axe2 then name := 'axe2' - else if id = Items.axe3 then name := 'axe3' - else if id = Items.axe4 then name := 'axe4' - else if id = Items.axe5 then name := 'axe5' - else if id = Items.shears then name := 'shears' - else if id = Items.sword1 then name := 'sword1' - else if id = Items.sword2 then name := 'sword2' - else if id = Items.sword3 then name := 'sword3' - else if id = Items.sword4 then name := 'sword4' - else if id = Items.sword5 then name := 'sword5' - else if id = Items.fishingRod then name := 'fishingRod' - else if id = Items.lighter then name := 'lighter' - else if id = Items.hoe1 then name := 'hoe1' - else if id = Items.hoe2 then name := 'hoe2' - else if id = Items.hoe3 then name := 'hoe3' - else if id = Items.hoe4 then name := 'hoe4' - else if id = Items.hoe5 then name := 'hoe5' - else if id = Items.reservedToolItem then name := 'reservedToolItem' - else if id = Items.coal then name := 'coal' - else if id = Items.redstone then name := 'redstone' - else if id = Items.diamond then name := 'diamond' - else if id = Items.brick then name := 'brick' - else if id = Items.ironIngot then name := 'ironIngot' - else if id = Items.goldIngot then name := 'goldIngot' - else if id = Items.lapisLazuli then name := 'lapisLazuli' - else if id = Items.strand then name := 'strand' - else if id = Items.snowball then name := 'snowball' - else if id = Items.clay then name := 'clay' - else if id = Items.book then name := 'book' - else if id = Items.bucket then name := 'bucket' - else if id = Items.waterBucket then name := 'waterBucket' - else if id = Items.lavaBucket then name := 'lavaBucket' - else if id = Items.milkBucket then name := 'milkBucket' - else if id = Items.paper then name := 'paper' - else if id = Items.melon then name := 'melon' - else if id = Items.egg then name := 'egg' - else if id = Items.door then name := 'door' - else if id = Items.bed then name := 'bed' - else if id = Items.spawnEggZombie then name := 'spawnEggZombie' - else if id = Items.spawnEggSheep then name := 'spawnEggSheep' - else if id = Items.spawnEggPig then name := 'spawnEggPig' - else if id = Items.gunpowder then name := 'gunpowder' - else if id = Items.bowl then name := 'bowl' - else if id = Items.mushroomStew then name := 'mushroomStew' - else if id = Items.map then name := 'map' - else if id = Items.painting then name := 'painting' - else if id = Items.rawPorkchop then name := 'rawPorkchop' - else if id = Items.cookedPorkchop then name := 'cookedPorkchop' - else if id = Items.rottenFlesh then name := 'rottenFlesh' - else if id = Items.camera1 then name := 'camera1' - else if id = Items.camera2 then name := 'camera2' - else if id = Items.camera3 then name := 'camera3' - else if id = Items.goldNugget then name := 'goldNugget' - else if id = Items.sugar then name := 'sugar' - else if id = Items.spiderEye then name := 'spiderEye' - else if id = Items.feather then name := 'feather' - else if id = Items.leather then name := 'leather' - else if id = Items.rawBeef then name := 'rawBeef' - else if id = Items.steak then name := 'steak' - else if id = Items.apple then name := 'apple' - else if id = Items.goldenApple then name := 'goldenApple' - else if id = Items.rawChicken then name := 'rawChicken' - else if id = Items.cookedChicken then name := 'cookedChicken' - else if id = Items.spawnEggChicken then name := 'spawnEggChicken' - else if id = Items.spawnEggCreeper then name := 'spawnEggCreeper' - else if id = Items.flint then name := 'flint' - else if id = Items.spawnEggCow then name := 'spawnEggCow' - else if id = Items.spawnEggMooshroom then name := 'spawnEggMooshroom' - else if id = Items.rawFish then name := 'rawFish' - else if id = Items.cookedFish then name := 'cookedFish' - else if id = Items.spawnEggPigman then name := 'spawnEggPigman' - else if id = Items.spawnEggSpider then name := 'spawnEggSpider' - else if id = Items.glowstoneDust then name := 'glowstoneDust' - else if id = Items.clock then name := 'clock' - else if id = Items.compass then name := 'compass' - else if id = Items.seeds then name := 'seeds' - else if id = Items.wheat then name := 'wheat' - else if id = Items.bread then name := 'bread' - else if id = Items.boneMeal then name := 'boneMeal' - else if id = Items.melonSeeds then name := 'melonSeeds' - else if id = Items.pumpkinSeeds then name := 'pumpkinSeeds' - else name := '' + id; - result := name; - end; - - procedure PrintItem(id, typ, tex, max, info, texsource, indicator : integer; dividable : boolean); - var - name, tname, indname : string; - begin - name := ItemToString(id); - - if typ = Items.block then tname := 'block' - else if typ = Items.tool then tname := 'tool' - else if typ = Items.reserved then tname := 'reserved' - else if typ = Items.orditem then tname := 'orditem' - else tname := '' + typ; - - if indicator = Items.noindicator then indname := 'noindicator' - else if indicator = Items.numeric then indname := 'numeric' - else if indicator = Items.line then indname := 'line' - else indname := '' + indicator; - - Debug(' InitItem(' + name + ', ' + tname + ', ' + tex + ', ' + max + ', ' + info + ', ' + texsource + ', ' + indname + ', ' + dividable + ');'); - end; - - procedure PrintItemTable; - var - id : integer; - begin - for id := 0 to 222 do begin - PrintItem( - id, - Items.GetType(id), - Items.GetTexture(id), - Items.GetMaximum(id), - Items.GetData(id), - Items.GetTextureSource(id), - Items.GetIndicatorType(id), - Items.IsDividable(id) - ); - end; - - 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 qt_start; hung_time:=getrelativetimems; @@ -3301,8 +3003,6 @@ begin air_time:=getrelativetimems; portal_time:=getrelativetimems; - PrintItemTable; - repeat proc_fps; keyhandler; diff --git a/src/Items.pas b/src/Items.pas index 48475d5..9f35b1b 100644 --- a/src/Items.pas +++ b/src/Items.pas @@ -136,7 +136,7 @@ interface stick = 127; dandelionYellow = 128; roseRed = 129; - superSpecialUnneededTool = 130; + reservedToolItem1 = 130; pickaxe1 = 131; pickaxe2 = 132; pickaxe3 = 133; @@ -158,14 +158,14 @@ interface sword3 = 149; sword4 = 150; sword5 = 151; - fishingRod = 152; + rod = 152; lighter = 153; hoe1 = 154; hoe2 = 155; hoe3 = 156; hoe4 = 157; hoe5 = 158; - reservedToolItem = 159; + reservedToolItem2 = 159; coal = 160; redstone = 161; diamond = 162; @@ -253,7 +253,7 @@ interface implementation - uses Vars, Func; + uses Vars, Func, Tools; const lastItem = 222; @@ -468,36 +468,36 @@ initialization InitItem(stick, orditem, 0, 64, 0, 1, numeric, true); InitItem(dandelionYellow, orditem, 8, 64, 0, 1, numeric, true); InitItem(roseRed, orditem, 9, 64, 0, 1, numeric, true); - InitItem(superSpecialUnneededTool, tool, 0, 0, 0, 1, line, false); - InitItem(pickaxe1, tool, 48, 60, 1, 1, line, false); - InitItem(pickaxe2, tool, 49, 132, 2, 1, line, false); - InitItem(pickaxe3, tool, 50, 251, 3, 1, line, false); - InitItem(pickaxe4, tool, 51, 1562, 4, 1, line, false); - InitItem(pickaxe5, tool, 52, 33, 5, 1, line, false); - InitItem(shovel1, tool, 32, 60, 6, 1, line, false); - InitItem(shovel2, tool, 33, 132, 7, 1, line, false); - InitItem(shovel3, tool, 34, 251, 8, 1, line, false); - InitItem(shovel4, tool, 35, 1562, 9, 1, line, false); - InitItem(shovel5, tool, 36, 33, 10, 1, line, false); - InitItem(axe1, tool, 64, 60, 11, 1, line, false); - InitItem(axe2, tool, 65, 132, 12, 1, line, false); - InitItem(axe3, tool, 66, 251, 13, 1, line, false); - InitItem(axe4, tool, 67, 1562, 14, 1, line, false); - InitItem(axe5, tool, 68, 33, 15, 1, line, false); - InitItem(shears, tool, 10, 239, 16, 1, line, false); - InitItem(sword1, tool, 16, 60, 17, 1, line, false); - InitItem(sword2, tool, 17, 132, 18, 1, line, false); - InitItem(sword3, tool, 18, 251, 19, 1, line, false); - InitItem(sword4, tool, 19, 1562, 20, 1, line, false); - InitItem(sword5, tool, 20, 33, 21, 1, line, false); - InitItem(fishingRod, tool, 101, 65, 22, 1, line, false); - InitItem(lighter, tool, 106, 65, 23, 1, line, false); - InitItem(hoe1, tool, 80, 60, 24, 1, line, false); - InitItem(hoe2, tool, 81, 132, 25, 1, line, false); - InitItem(hoe3, tool, 82, 251, 26, 1, line, false); - InitItem(hoe4, tool, 83, 1562, 27, 1, line, false); - InitItem(hoe5, tool, 84, 33, 28, 1, line, false); - InitItem(reservedToolItem, block, 0, 0, 0, 0, noindicator, false); + InitItem(reservedToolItem1, tool, 0, 0, 0, 1, line, false); + InitItem(pickaxe1, tool, 48, 60, Tools.pickaxe1, 1, line, false); + InitItem(pickaxe2, tool, 49, 132, Tools.pickaxe2, 1, line, false); + InitItem(pickaxe3, tool, 50, 251, Tools.pickaxe3, 1, line, false); + InitItem(pickaxe4, tool, 51, 1562, Tools.pickaxe4, 1, line, false); + InitItem(pickaxe5, tool, 52, 33, Tools.pickaxe5, 1, line, false); + InitItem(shovel1, tool, 32, 60, Tools.shovel1, 1, line, false); + InitItem(shovel2, tool, 33, 132, Tools.shovel3, 1, line, false); + InitItem(shovel3, tool, 34, 251, Tools.shovel2, 1, line, false); + InitItem(shovel4, tool, 35, 1562, Tools.shovel4, 1, line, false); + InitItem(shovel5, tool, 36, 33, Tools.shovel5, 1, line, false); + InitItem(axe1, tool, 64, 60, Tools.axe1, 1, line, false); + InitItem(axe2, tool, 65, 132, Tools.axe2, 1, line, false); + InitItem(axe3, tool, 66, 251, Tools.axe3, 1, line, false); + InitItem(axe4, tool, 67, 1562, Tools.axe4, 1, line, false); + InitItem(axe5, tool, 68, 33, Tools.axe5, 1, line, false); + InitItem(shears, tool, 10, 239, Tools.shears, 1, line, false); + InitItem(sword1, tool, 16, 60, Tools.sword1, 1, line, false); + InitItem(sword2, tool, 17, 132, Tools.sword2, 1, line, false); + InitItem(sword3, tool, 18, 251, Tools.sword3, 1, line, false); + InitItem(sword4, tool, 19, 1562, Tools.sword4, 1, line, false); + InitItem(sword5, tool, 20, 33, Tools.sword5, 1, line, false); + InitItem(rod, tool, 101, 65, Tools.rod1, 1, line, false); + InitItem(lighter, tool, 106, 65, Tools.lighter1, 1, line, false); + InitItem(hoe1, tool, 80, 60, Tools.hoe1, 1, line, false); + InitItem(hoe2, tool, 81, 132, Tools.hoe2, 1, line, false); + InitItem(hoe3, tool, 82, 251, Tools.hoe3, 1, line, false); + InitItem(hoe4, tool, 83, 1562, Tools.hoe4, 1, line, false); + InitItem(hoe5, tool, 84, 33, Tools.hoe5, 1, line, false); + InitItem(reservedToolItem2, block, 0, 0, 0, 0, noindicator, false); InitItem(coal, orditem, 2, 64, 0, 1, numeric, true); InitItem(redstone, orditem, 7, 64, 0, 1, numeric, true); InitItem(diamond, orditem, 6, 64, 0, 1, numeric, true); @@ -687,7 +687,7 @@ initialization InitOrdItem(sword3); InitOrdItem(sword4); InitOrdItem(sword5); - InitOrdItem(fishingRod); + InitOrdItem(rod); InitOrdItem(lighter); InitOrdItem(hoe1); InitOrdItem(hoe2); diff --git a/src/Tools.pas b/src/Tools.pas new file mode 100644 index 0000000..1a644d0 --- /dev/null +++ b/src/Tools.pas @@ -0,0 +1,115 @@ +unit Tools; + +interface + + const + pickaxe1 = 0; + pickaxe2 = 1; + pickaxe3 = 2; + pickaxe4 = 3; + pickaxe5 = 4; + shovel1 = 5; + shovel2 = 6; + shovel3 = 7; + shovel4 = 8; + shovel5 = 9; + axe1 = 10; + axe2 = 11; + axe3 = 12; + axe4 = 13; + axe5 = 14; + shears1 = 15; + sword1 = 16; + sword2 = 17; + sword3 = 18; + sword4 = 19; + sword5 = 20; + rod1 = 21; + lighter1 = 22; + hoe1 = 23; + hoe2 = 24; + hoe3 = 25; + hoe4 = 26; + hoe5 = 27; + + const + pickaxe = 0; + shovel = 1; + axe = 2; + shears = 3; + sword = 4; + rod = 5; + lighter = 6; + hoe = 7; + + function GetType(id : integer) : integer; + function GetLevel(id : integer) : integer; + function GetSpeed(id : integer) : integer; + function GetDamage(id : integer) : integer; + +implementation + + const + lastTool = 27; + + var + typ, lvl, speed, damage : array [0..lastTool] of integer; + + function GetType(id : integer) : integer; + begin + result := typ[id]; + end; + + function GetLevel(id : integer) : integer; + begin + result := lvl[id]; + end; + + function GetSpeed(id : integer) : integer; + begin + result := speed[id]; + end; + + function GetDamage(id : integer) : integer; + begin + result := damage[id]; + end; + + procedure InitTool(id, xtyp, level, xspeed, xdamage : integer); + begin + typ[id] := xtyp; + lvl[id] := level; + speed[id] := xspeed; + damage[id] := xdamage; + end; + +initialization + InitTool(pickaxe1, pickaxe, 1, 2, 1); + InitTool(pickaxe2, pickaxe, 2, 3, 1); + InitTool(pickaxe3, pickaxe, 3, 4, 1); + InitTool(pickaxe4, pickaxe, 4, 6, 1); + InitTool(pickaxe5, pickaxe, 5, 6, 1); + InitTool(shovel1, shovel, 1, 2, 1); + InitTool(shovel2, shovel, 2, 3, 1); + InitTool(shovel3, shovel, 3, 4, 1); + InitTool(shovel4, shovel, 4, 6, 1); + InitTool(shovel5, shovel, 5, 6, 1); + InitTool(axe1, axe, 1, 2, 1); + InitTool(axe2, axe, 2, 3, 1); + InitTool(axe3, axe, 3, 4, 1); + InitTool(axe4, axe, 4, 6, 1); + InitTool(axe5, axe, 5, 6, 1); + InitTool(shears1, shears, 1, 5, 1); + InitTool(sword1, sword, 1, 2, 4); + InitTool(sword2, sword, 2, 3, 5); + InitTool(sword3, sword, 3, 4, 6); + InitTool(sword4, sword, 4, 6, 7); + InitTool(sword5, sword, 5, 6, 7); + InitTool(rod1, rod, 1, 1, 1); + InitTool(lighter1, lighter, 1, 1, 1); + InitTool(hoe1, hoe, 1, 2, 1); + InitTool(hoe2, hoe, 2, 3, 1); + InitTool(hoe3, hoe, 3, 4, 1); + InitTool(hoe4, hoe, 4, 6, 1); + InitTool(hoe5, hoe, 5, 6, 1); +end. diff --git a/src/console.pas b/src/console.pas index 378769b..99c78d0 100644 --- a/src/console.pas +++ b/src/console.pas @@ -624,37 +624,6 @@ procedure exeCommand(str:string); exec(nextWord, tmp); end; else - if com='RESET_ITEMS' then - begin - resetItems(decodeInt(nextWord)+1); - //addToLog('Max items: '+decodeInt(parsed_str[1])); - end; - else - if com='SET_ITEM' then - begin - setItemData(decodeInt(nextWord), - decodeInt(nextWord), - decodeInt(nextWord), - decodeInt(nextWord), - decodeInt(nextWord), - decodeInt(nextWord)); - end; - else - if com='RESET_TOOLS' then - begin - resetTools(decodeInt(nextWord)+1); - //addToLog('Max tools: '+decodeInt(parsed_str[1])); - end; - else - if com='SET_TOOL' then - begin - setToolData(decodeInt(nextWord), - decodeInt(nextWord), - decodeInt(nextWord), - decodeInt(nextWord), - decodeInt(nextWord)); - end; - else if com='RESET_FUELS' then begin furnace.setMaxFuel(decodeInt(nextWord)); -- 2.29.2