summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bddd811)
raw | patch | inline | side by side (parent: bddd811)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sun, 10 Sep 2017 20:53:49 +0000 (23:53 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sun, 10 Sep 2017 20:53:49 +0000 (23:53 +0300) |
libs/Lib_items_store.class | patch | blob | history | |
libs/Lib_items_store.java | patch | blob | history | |
src/CAVE.mpsrc | patch | blob | history | |
src/Items.pas | patch | blob | history | |
src/Tools.pas | [new file with mode: 0644] | patch | blob |
src/console.pas | patch | blob | history |
index f07d13faac9ba7bb9d70eac5488eff9b240bc130..d9575b8eef94977cfc2a54c2615d5351c6d90b18 100644 (file)
Binary files a/libs/Lib_items_store.class and b/libs/Lib_items_store.class differ
Binary files a/libs/Lib_items_store.class and b/libs/Lib_items_store.class differ
index 75245bb80c3390126c3419b6b400113c87673ab5..b1e4eca7199598c6c92be2fb40e2a5570292b5ff 100644 (file)
class Lib_items_store\r
{\r
- /*Items*/\r
- static byte[] item_info;\r
-\r
/*Craft*/\r
static byte[] [] craftIN_item;\r
static byte[] [] craftIN_sum;\r
static int[] craftOUT_sum;\r
static byte[] craftOUT_flag;\r
\r
- /*Tools*/\r
- static byte[] tool_type;\r
- static byte[] tool_lvl;\r
- static byte[] tool_speed;\r
- static byte[] tool_damg;\r
-\r
- /* Items */\r
-\r
- public static void resetitems(int len)\r
- {\r
- item_info = new byte[len];\r
- }\r
-\r
- public static void setitemdata(int id, int type, int tex, int max, int info, int flags)\r
- {\r
- item_info[id] = (byte) info;\r
- }\r
-\r
/*Craft*/\r
public static void resetcrafts(int len)\r
{\r
return craftOUT_flag[id] & 0xFF;\r
} catch(Exception e) { return 0xFF;}\r
}\r
-\r
-/*Tools*/\r
- public static void resettools(int len)\r
- {\r
- try {\r
- tool_type = new byte[len];\r
- tool_lvl = new byte[len];\r
- tool_speed = new byte[len];\r
- tool_damg = new byte[len];\r
- } catch(Exception e) {e.printStackTrace();}\r
- }\r
-\r
- public static void settooldata(int id, int tool, int lvl, int speed, int damg)\r
- {\r
- try {\r
- tool_type[id] = (byte) tool;\r
- tool_lvl[id] = (byte) lvl;\r
- tool_speed[id] = (byte) speed;\r
- tool_damg[id] = (byte) damg;\r
- } catch(Exception e) {e.printStackTrace();}\r
- }\r
-\r
- public static int gettooltype(int id)\r
- {\r
- try {\r
- return tool_type[item_info[id]];\r
- } catch(Exception e) { return 0;}\r
- }\r
-\r
- public static int gettoollvl(int id)\r
- {\r
- try {\r
- return tool_lvl[item_info[id]];\r
- } catch(Exception e) { return 0;}\r
- }\r
-\r
- public static int gettoolspeed(int id)\r
- {\r
- try {\r
- return tool_speed[item_info[id]];\r
- } catch(Exception e) { return 0;}\r
- }\r
-\r
- public static int gettooldamg(int id)\r
- {\r
- try {\r
- return tool_damg[item_info[id]];\r
- } catch(Exception e) { return 0;}\r
- }\r
-\r
}\r
diff --git a/src/CAVE.mpsrc b/src/CAVE.mpsrc
index a43998d85f579e1be265f6d7b286907bd3f7f7a5..db30c2db4d50e259f41ad8ed712db6320f5094ab 100644 (file)
--- a/src/CAVE.mpsrc
+++ b/src/CAVE.mpsrc
Blocks,\r
BlocksLogic,\r
Items,\r
- ItemsLogic;\r
+ ItemsLogic,\r
+ Tools;\r
\r
const\r
version_map = 9;\r
toolind:=0;\r
end;\r
\r
-procedure usetools(invcur, x, y:integer);\r
- var\r
- item, sum, block:integer;\r
- begin\r
- block:=getmap(x, y);\r
- item:=inv.getItem(invcur);\r
- sum:=inv.getSum(invcur);\r
-\r
- if gamemode=1 then\r
- destroy_block_cr(block, x, y);\r
- else\r
- if (block>0) then\r
- begin\r
- if (Items.GetType(item) = Items.tool) and (Blocks.GetTool(block) = getToolType(item)) then\r
- toolus:=toolus+getToolSpeed(item);\r
- else\r
- toolus:=toolus+1;\r
+ procedure usetools(invcur, x, y : integer);\r
+ var\r
+ item, sum, block, tool : integer;\r
+ begin\r
+ block := GetMap(x, y);\r
+ item := Inv.GetItem(invcur);\r
+ sum := Inv.GetSum(invcur);\r
+ tool := Items.GetData(item);\r
+\r
+ if gamemode = 1 then begin\r
+ destroy_block_cr(block, x, y);\r
+ end else if block <> 0 then begin\r
+ if (Items.GetType(item) = Items.tool) and (Blocks.GetTool(block) = Tools.GetType(tool)) then begin\r
+ toolus := toolus + Tools.GetSpeed(tool);\r
+ end else begin\r
+ toolus := toolus + 1;\r
+ end;\r
\r
- if toolus >= Blocks.GetResistant(block) then\r
- begin\r
- if ((Items.GetType(item) = Items.tool) and (Blocks.GetTool(block) = getToolType(item)) and (getToolLvl(item) >= Blocks.GetLevel(block))) or (Blocks.GetLevel(block) <= 0) then\r
- begin\r
- setMap(0, x, y);\r
- destroy_block_1(block, x, y);\r
- setMapInfo(0, x, y);\r
- end;\r
- else\r
- begin\r
- setMap(0, x, y);\r
- destroy_block_0(block, x, y);\r
- setMapInfo(0, x, y);\r
- end;\r
+ if toolus >= Blocks.GetResistant(block) then begin\r
+ Debug('usetools: tool = ' + tool);\r
+ 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\r
+ SetMap(0, x, y);\r
+ destroy_block_1(block, x, y);\r
+ SetMapInfo(0, x, y);\r
+ end else begin\r
+ SetMap(0, x, y);\r
+ destroy_block_0(block, x, y);\r
+ SetMapInfo(0, x, y);\r
+ end;\r
\r
- if Items.GetType(item) = Items.tool then\r
- begin\r
- inv.setSum(inv.getSum(invcur)-1, invcur);\r
- inv.fixNull(invcur);\r
- end;\r
+ if Items.GetType(item) = Items.tool then begin\r
+ Inv.SetSum(Inv.GetSum(invcur) - 1, invcur);\r
+ Inv.FixNull(invcur);\r
+ end;\r
\r
- toolus:=0;\r
- toolind:=0;\r
- end;\r
- end;\r
+ toolus:=0;\r
+ toolind:=0;\r
+ end;\r
+ end;\r
\r
- if (toolus > 0) and (toolus <= Blocks.GetResistant(block)) then begin\r
- toolind := ((toolus * 100) div Blocks.GetResistant(block)) div 10;\r
+ if (toolus > 0) and (toolus <= Blocks.GetResistant(block)) then begin\r
+ toolind := ((toolus * 100) div Blocks.GetResistant(block)) div 10;\r
+ end;\r
end;\r
- end;\r
-\r
-function rt_useweap:boolean;\r
- var\r
- x, y, w, h, i, damg:integer;\r
- item:integer;\r
- begin\r
- x:=player.getX;\r
- y:=player.getY;\r
- w:=player.getW;\r
- h:=player.getH;\r
- item:=inv.getItem(invslot);\r
\r
- if Items.GetType(item) = Items.tool then\r
- damg:=getToolDamg(item);\r
- else\r
- damg:=1;\r
-\r
- if posi=0 then\r
- i:=Mobs.findAndHit(damg, x-TILE_SIZE, y, TILE_SIZE+(w/2), h, -2, -3);\r
- else\r
- i:=Mobs.findAndHit(damg, x+(w/2), y, TILE_SIZE+(w/2), h, 2, -3);\r
-\r
- if i<>-1 then\r
- begin\r
- inv.setSum(inv.getSum(invslot)-1, invslot);\r
- inv.fixNull(invslot);\r
- rt_useweap:=true;\r
- end;\r
- end;\r
+ function rt_useweap:boolean;\r
+ var\r
+ item : integer;\r
+ x, y, w, h, i, damg : integer;\r
+ begin\r
+ x := Player.GetX;\r
+ y := Player.GetY;\r
+ w := Player.GetW;\r
+ h := Player.GetH;\r
+ item := Inv.GetItem(invslot);\r
+ if Items.GetType(item) = Items.tool then damg := Tools.GetDamage(item) else damg := 1;\r
+\r
+ if posi=0 then i := Mobs.FindAndHit(damg, x - TILE_SIZE, y, TILE_SIZE + (w / 2), h, -2, -3);\r
+ else i := Mobs.FindAndHit(damg, x + (w / 2), y, TILE_SIZE + (w / 2), h, 2, -3);\r
+\r
+ if i >= 0 then begin\r
+ Inv.SetSum(Inv.GetSum(invslot) - 1, invslot);\r
+ Inv.FixNull(invslot);\r
+ rt_useweap := true;\r
+ end;\r
+ end;\r
\r
procedure rt_usetools;\r
var\r
drawImage(light[i], getWidth - 16, 16 * i);\r
end;\r
\r
- function ItemToString(id : integer) : string;\r
- var\r
- name : string;\r
- begin\r
- if id = Items.none then name := 'none'\r
- else if id = Items.dirt then name := 'dirt'\r
- else if id = Items.grass then name := 'grass'\r
- else if id = Items.stone then name := 'stone'\r
- else if id = Items.oakWoodPlanks then name := 'oakWoodPlanks'\r
- else if id = Items.cobblestone then name := 'cobblestone'\r
- else if id = Items.bedrock then name := 'bedrock'\r
- else if id = Items.sand then name := 'sand'\r
- else if id = Items.gravel then name := 'gravel'\r
- else if id = Items.oakWood then name := 'oakWood'\r
- else if id = Items.obsidian then name := 'obsidian'\r
- else if id = Items.bookshelf then name := 'bookshelf'\r
- else if id = Items.mossStone then name := 'mossStone'\r
- else if id = Items.blockOfIron then name := 'blockOfIron'\r
- else if id = Items.blockOfGold then name := 'blockOfGold'\r
- else if id = Items.blockOfDiamond then name := 'blockOfDiamond'\r
- else if id = Items.goldOre then name := 'goldOre'\r
- else if id = Items.ironOre then name := 'ironOre'\r
- else if id = Items.coalOre then name := 'coalOre'\r
- else if id = Items.diamondOre then name := 'diamondOre'\r
- else if id = Items.redstoneOre then name := 'redstoneOre'\r
- else if id = Items.oakLeaves then name := 'oakLeaves'\r
- else if id = Items.redFlower then name := 'redFlower'\r
- else if id = Items.yellowFlower then name := 'yellowFlower'\r
- else if id = Items.redMooshroom then name := 'redMooshroom'\r
- else if id = Items.brownMooshroom then name := 'brownMooshroom'\r
- else if id = Items.torch then name := 'torch'\r
- else if id = Items.tnt then name := 'tnt'\r
- else if id = Items.chest then name := 'chest'\r
- else if id = Items.craftingTable then name := 'craftingTable'\r
- else if id = Items.cactus then name := 'cactus'\r
- else if id = Items.glass then name := 'glass'\r
- else if id = Items.wool1 then name := 'wool1'\r
- else if id = Items.wool2 then name := 'wool2'\r
- else if id = Items.wool3 then name := 'wool3'\r
- else if id = Items.wool4 then name := 'wool4'\r
- else if id = Items.wool5 then name := 'wool5'\r
- else if id = Items.wool6 then name := 'wool6'\r
- else if id = Items.wool7 then name := 'wool7'\r
- else if id = Items.wool8 then name := 'wool8'\r
- else if id = Items.wool9 then name := 'wool9'\r
- else if id = Items.wool10 then name := 'wool10'\r
- else if id = Items.wool11 then name := 'wool11'\r
- else if id = Items.wool12 then name := 'wool12'\r
- else if id = Items.wool13 then name := 'wool13'\r
- else if id = Items.wool14 then name := 'wool14'\r
- else if id = Items.wool15 then name := 'wool15'\r
- else if id = Items.wool16 then name := 'wool16'\r
- else if id = Items.snow then name := 'snow'\r
- else if id = Items.ladder then name := 'ladder'\r
- else if id = Items.water then name := 'water'\r
- else if id = Items.lava then name := 'lava'\r
- else if id = Items.oakSapling then name := 'oakSapling'\r
- else if id = Items.sponge then name := 'sponge'\r
- else if id = Items.lapisLazuliOre then name := 'lapisLazuliOre'\r
- else if id = Items.lapisLazuliBlock then name := 'lapisLazuliBlock'\r
- else if id = Items.sandstone then name := 'sandstone'\r
- else if id = Items.tallGrass then name := 'tallGrass'\r
- else if id = Items.deadBush then name := 'deadBush'\r
- else if id = Items.cobweb then name := 'cobweb'\r
- else if id = Items.bricks then name := 'bricks'\r
- else if id = Items.snowBlock then name := 'snowBlock'\r
- else if id = Items.ice then name := 'ice'\r
- else if id = Items.snowLayer then name := 'snowLayer'\r
- else if id = Items.clayBlock then name := 'clayBlock'\r
- else if id = Items.sugarCane then name := 'sugarCane'\r
- else if id = Items.pumpkin then name := 'pumpkin'\r
- else if id = Items.jackLantern then name := 'jackLantern'\r
- else if id = Items.stoneBricks then name := 'stoneBricks'\r
- else if id = Items.mossyStoneBricks then name := 'mossyStoneBricks'\r
- else if id = Items.crackedStoneBricks then name := 'crackedStoneBricks'\r
- else if id = Items.chiseledStokeBricks then name := 'chiseledStokeBricks'\r
- else if id = Items.ironBras then name := 'ironBras'\r
- else if id = Items.melonBlock then name := 'melonBlock'\r
- else if id = Items.mycelium then name := 'mycelium'\r
- else if id = Items.backgroundOakWood then name := 'backgroundOakWood'\r
- else if id = Items.spawner then name := 'spawner'\r
- else if id = Items.bed1 then name := 'bed1'\r
- else if id = Items.bed2 then name := 'bed2'\r
- else if id = Items.openWoodenDoor1 then name := 'openWoodenDoor1'\r
- else if id = Items.openWoodenDoor2 then name := 'openWoodenDoor2'\r
- else if id = Items.closedWoodenDoor1 then name := 'closedWoodenDoor1'\r
- else if id = Items.closedWoodenDoor2 then name := 'closedWoodenDoor2'\r
- else if id = Items.birchWood then name := 'birchWood'\r
- else if id = Items.backgroundBirchWood then name := 'backgroundBirchWood'\r
- else if id = Items.spruceWood then name := 'spruceWood'\r
- else if id = Items.backgroundSpruceWood then name := 'backgroundSpruceWood'\r
- else if id = Items.spruceLeaves then name := 'spruceLeaves'\r
- else if id = Items.redMushroomBlock1 then name := 'redMushroomBlock1'\r
- else if id = Items.redMushroomBlock2 then name := 'redMushroomBlock2'\r
- else if id = Items.brownMushroomBlock1 then name := 'brownMushroomBlock1'\r
- else if id = Items.brownMushroomBlock2 then name := 'brownMushroomBlock2'\r
- else if id = Items.oakFence then name := 'oakFence'\r
- else if id = Items.backgroundOakFence then name := 'backgroundOakFence'\r
- else if id = Items.backgroundOakWoodPlanks then name := 'backgroundOakWoodPlanks'\r
- else if id = Items.painting1 then name := 'painting1'\r
- else if id = Items.painting2 then name := 'painting2'\r
- else if id = Items.painting3 then name := 'painting3'\r
- else if id = Items.painting4 then name := 'painting4'\r
- else if id = Items.painting5 then name := 'painting5'\r
- else if id = Items.painting6 then name := 'painting6'\r
- else if id = Items.painting7 then name := 'painting7'\r
- else if id = Items.giftChest then name := 'giftChest'\r
- else if id = Items.vines then name := 'vines'\r
- else if id = Items.sign then name := 'sign'\r
- else if id = Items.redstoneTorch then name := 'redstoneTorch'\r
- else if id = Items.furnace then name := 'furnace'\r
- else if id = Items.closedWoodenTrapdoor then name := 'closedWoodenTrapdoor'\r
- else if id = Items.openWoodenTrapdoor then name := 'openWoodenTrapdoor'\r
- else if id = Items.netherrack then name := 'netherrack'\r
- else if id = Items.netherPortal then name := 'netherPortal'\r
- else if id = Items.glowstone then name := 'glowstone'\r
- else if id = Items.birchLeaves then name := 'birchLeaves'\r
- else if id = Items.soulSand then name := 'soulSand'\r
- else if id = Items.birchSapling then name := 'birchSapling'\r
- else if id = Items.spruceSapling then name := 'spruceSapling'\r
- else if id = Items.redstoneLampOff then name := 'redstoneLampOff'\r
- else if id = Items.redstoneLampOn then name := 'redstoneLampOn'\r
- else if id = Items.backgroundObsidian then name := 'backgroundObsidian'\r
- else if id = Items.glassPlane then name := 'glassPlane'\r
- else if id = Items.farmland then name := 'farmland'\r
- else if id = Items.cake then name := 'cake'\r
- else if id = Items.wheatBlock then name := 'wheatBlock'\r
- else if id = Items.melonStem then name := 'melonStem'\r
- else if id = Items.pumpkinStem then name := 'pumpkinStem'\r
- else if id = Items.burningFurnace then name := 'burningFurnace'\r
- else if id = Items.reservedBlockItem then name := 'reservedBlockItem'\r
- else if id = Items.stick then name := 'stick'\r
- else if id = Items.dandelionYellow then name := 'dandelionYellow'\r
- else if id = Items.roseRed then name := 'roseRed'\r
- else if id = Items.superSpecialUnneededTool then name := 'superSpecialUnneededTool'\r
- else if id = Items.pickaxe1 then name := 'pickaxe1'\r
- else if id = Items.pickaxe2 then name := 'pickaxe2'\r
- else if id = Items.pickaxe3 then name := 'pickaxe3'\r
- else if id = Items.pickaxe4 then name := 'pickaxe4'\r
- else if id = Items.pickaxe5 then name := 'pickaxe5'\r
- else if id = Items.shovel1 then name := 'shovel1'\r
- else if id = Items.shovel2 then name := 'shovel2'\r
- else if id = Items.shovel3 then name := 'shovel3'\r
- else if id = Items.shovel4 then name := 'shovel4'\r
- else if id = Items.shovel5 then name := 'shovel5'\r
- else if id = Items.axe1 then name := 'axe1'\r
- else if id = Items.axe2 then name := 'axe2'\r
- else if id = Items.axe3 then name := 'axe3'\r
- else if id = Items.axe4 then name := 'axe4'\r
- else if id = Items.axe5 then name := 'axe5'\r
- else if id = Items.shears then name := 'shears'\r
- else if id = Items.sword1 then name := 'sword1'\r
- else if id = Items.sword2 then name := 'sword2'\r
- else if id = Items.sword3 then name := 'sword3'\r
- else if id = Items.sword4 then name := 'sword4'\r
- else if id = Items.sword5 then name := 'sword5'\r
- else if id = Items.fishingRod then name := 'fishingRod'\r
- else if id = Items.lighter then name := 'lighter'\r
- else if id = Items.hoe1 then name := 'hoe1'\r
- else if id = Items.hoe2 then name := 'hoe2'\r
- else if id = Items.hoe3 then name := 'hoe3'\r
- else if id = Items.hoe4 then name := 'hoe4'\r
- else if id = Items.hoe5 then name := 'hoe5'\r
- else if id = Items.reservedToolItem then name := 'reservedToolItem'\r
- else if id = Items.coal then name := 'coal'\r
- else if id = Items.redstone then name := 'redstone'\r
- else if id = Items.diamond then name := 'diamond'\r
- else if id = Items.brick then name := 'brick'\r
- else if id = Items.ironIngot then name := 'ironIngot'\r
- else if id = Items.goldIngot then name := 'goldIngot'\r
- else if id = Items.lapisLazuli then name := 'lapisLazuli'\r
- else if id = Items.strand then name := 'strand'\r
- else if id = Items.snowball then name := 'snowball'\r
- else if id = Items.clay then name := 'clay'\r
- else if id = Items.book then name := 'book'\r
- else if id = Items.bucket then name := 'bucket'\r
- else if id = Items.waterBucket then name := 'waterBucket'\r
- else if id = Items.lavaBucket then name := 'lavaBucket'\r
- else if id = Items.milkBucket then name := 'milkBucket'\r
- else if id = Items.paper then name := 'paper'\r
- else if id = Items.melon then name := 'melon'\r
- else if id = Items.egg then name := 'egg'\r
- else if id = Items.door then name := 'door'\r
- else if id = Items.bed then name := 'bed'\r
- else if id = Items.spawnEggZombie then name := 'spawnEggZombie'\r
- else if id = Items.spawnEggSheep then name := 'spawnEggSheep'\r
- else if id = Items.spawnEggPig then name := 'spawnEggPig'\r
- else if id = Items.gunpowder then name := 'gunpowder'\r
- else if id = Items.bowl then name := 'bowl'\r
- else if id = Items.mushroomStew then name := 'mushroomStew'\r
- else if id = Items.map then name := 'map'\r
- else if id = Items.painting then name := 'painting'\r
- else if id = Items.rawPorkchop then name := 'rawPorkchop'\r
- else if id = Items.cookedPorkchop then name := 'cookedPorkchop'\r
- else if id = Items.rottenFlesh then name := 'rottenFlesh'\r
- else if id = Items.camera1 then name := 'camera1'\r
- else if id = Items.camera2 then name := 'camera2'\r
- else if id = Items.camera3 then name := 'camera3'\r
- else if id = Items.goldNugget then name := 'goldNugget'\r
- else if id = Items.sugar then name := 'sugar'\r
- else if id = Items.spiderEye then name := 'spiderEye'\r
- else if id = Items.feather then name := 'feather'\r
- else if id = Items.leather then name := 'leather'\r
- else if id = Items.rawBeef then name := 'rawBeef'\r
- else if id = Items.steak then name := 'steak'\r
- else if id = Items.apple then name := 'apple'\r
- else if id = Items.goldenApple then name := 'goldenApple'\r
- else if id = Items.rawChicken then name := 'rawChicken'\r
- else if id = Items.cookedChicken then name := 'cookedChicken'\r
- else if id = Items.spawnEggChicken then name := 'spawnEggChicken'\r
- else if id = Items.spawnEggCreeper then name := 'spawnEggCreeper'\r
- else if id = Items.flint then name := 'flint'\r
- else if id = Items.spawnEggCow then name := 'spawnEggCow'\r
- else if id = Items.spawnEggMooshroom then name := 'spawnEggMooshroom'\r
- else if id = Items.rawFish then name := 'rawFish'\r
- else if id = Items.cookedFish then name := 'cookedFish'\r
- else if id = Items.spawnEggPigman then name := 'spawnEggPigman'\r
- else if id = Items.spawnEggSpider then name := 'spawnEggSpider'\r
- else if id = Items.glowstoneDust then name := 'glowstoneDust'\r
- else if id = Items.clock then name := 'clock'\r
- else if id = Items.compass then name := 'compass'\r
- else if id = Items.seeds then name := 'seeds'\r
- else if id = Items.wheat then name := 'wheat'\r
- else if id = Items.bread then name := 'bread'\r
- else if id = Items.boneMeal then name := 'boneMeal'\r
- else if id = Items.melonSeeds then name := 'melonSeeds'\r
- else if id = Items.pumpkinSeeds then name := 'pumpkinSeeds'\r
- else name := '' + id;\r
- result := name;\r
- end;\r
-\r
- procedure PrintItem(id, typ, tex, max, info, texsource, indicator : integer; dividable : boolean);\r
- var\r
- name, tname, indname : string;\r
- begin\r
- name := ItemToString(id);\r
-\r
- if typ = Items.block then tname := 'block'\r
- else if typ = Items.tool then tname := 'tool'\r
- else if typ = Items.reserved then tname := 'reserved'\r
- else if typ = Items.orditem then tname := 'orditem'\r
- else tname := '' + typ;\r
-\r
- if indicator = Items.noindicator then indname := 'noindicator'\r
- else if indicator = Items.numeric then indname := 'numeric'\r
- else if indicator = Items.line then indname := 'line'\r
- else indname := '' + indicator;\r
-\r
- Debug(' InitItem(' + name + ', ' + tname + ', ' + tex + ', ' + max + ', ' + info + ', ' + texsource + ', ' + indname + ', ' + dividable + ');');\r
- end;\r
-\r
- procedure PrintItemTable;\r
- var\r
- id : integer;\r
- begin\r
- for id := 0 to 222 do begin\r
- PrintItem(\r
- id,\r
- Items.GetType(id),\r
- Items.GetTexture(id),\r
- Items.GetMaximum(id),\r
- Items.GetData(id),\r
- Items.GetTextureSource(id),\r
- Items.GetIndicatorType(id),\r
- Items.IsDividable(id)\r
- );\r
- end;\r
-\r
- for id := 0 to 194 do begin\r
- Debug(' InitOrdItem(' + ItemToString(Items.GetOrdinary(id)) + ');');\r
- end;\r
-\r
- for id := 0 to 125 do begin\r
- Debug(' InitBlock(' + ItemToString(id) + ', ' +\r
- Blocks.GetTexture(id) + ', ' +\r
- Blocks.GetResistant(id) + ', ' +\r
- Blocks.GetTool(id) + ', ' +\r
- Blocks.GetLevel(id) + ', ' +\r
- Blocks.GetLightAbsorbtion(id) + ', ' +\r
- Blocks.GetLightEmission(id) + ', ' +\r
- Blocks.IsSolid(id) + ', ' +\r
- Blocks.IsTransporent(id) + ', ' +\r
- Blocks.IsForeground(id) + ', ' +\r
- Blocks.IsOverlapped(id) + ');'\r
- );\r
- end;\r
- end;\r
-\r
begin\r
qt_start;\r
hung_time:=getrelativetimems;\r
air_time:=getrelativetimems;\r
portal_time:=getrelativetimems;\r
\r
- PrintItemTable;\r
-\r
repeat\r
proc_fps;\r
keyhandler;\r
diff --git a/src/Items.pas b/src/Items.pas
index 48475d5f61fe3eb4179e54ba1b8a24161d4dfa60..9f35b1bfa037dd911e58c0722026549999d7185c 100644 (file)
--- a/src/Items.pas
+++ b/src/Items.pas
stick = 127;
dandelionYellow = 128;
roseRed = 129;
- superSpecialUnneededTool = 130;
+ reservedToolItem1 = 130;
pickaxe1 = 131;
pickaxe2 = 132;
pickaxe3 = 133;
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;
implementation
- uses Vars, Func;
+ uses Vars, Func, Tools;
const
lastItem = 222;
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);
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
--- /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 378769bcab756989361e1a03a7c03f11001d6c65..99c78d037d2ec3a05c2889f7469befe5d4d439f2 100644 (file)
--- a/src/console.pas
+++ b/src/console.pas
exec(nextWord, tmp);\r
end;\r
else\r
- if com='RESET_ITEMS' then\r
- begin\r
- resetItems(decodeInt(nextWord)+1);\r
- //addToLog('Max items: '+decodeInt(parsed_str[1]));\r
- end;\r
- else\r
- if com='SET_ITEM' then\r
- begin\r
- setItemData(decodeInt(nextWord),\r
- decodeInt(nextWord),\r
- decodeInt(nextWord),\r
- decodeInt(nextWord),\r
- decodeInt(nextWord),\r
- decodeInt(nextWord));\r
- end;\r
- else\r
- if com='RESET_TOOLS' then\r
- begin\r
- resetTools(decodeInt(nextWord)+1);\r
- //addToLog('Max tools: '+decodeInt(parsed_str[1]));\r
- end;\r
- else\r
- if com='SET_TOOL' then\r
- begin\r
- setToolData(decodeInt(nextWord),\r
- decodeInt(nextWord),\r
- decodeInt(nextWord),\r
- decodeInt(nextWord),\r
- decodeInt(nextWord));\r
- end;\r
- else\r
if com='RESET_FUELS' then\r
begin\r
furnace.setMaxFuel(decodeInt(nextWord));\r