DEADSOFTWARE

Rewrited module for particles
[cavecraft.git] / src / items.mpsrc
1 unit items;
3 interface
4 const
5 ITEM_TYPE_BLOCK=0;
6 ITEM_TYPE_TOOL=1;
8 ITEM_FLAG_IND1=1;
9 ITEM_FLAG_IND2=2;
10 ITEM_FLAG_DIV=4;
11 ITEM_FLAG_TEX=8;
13 rottenMeat = 190;
15 var
16 compas:image;
17 clock:array[0..7] of image;
18 none0:image;
19 clock_stage:integer;
21 function getBlockTrans(id:integer;):boolean;
22 function getBlockFore(id:integer;):boolean;
23 function getBlockSet(id:integer;):boolean;
25 function getItemIndNum(id:integer):boolean;
26 function getItemIndLine(id:integer):boolean;
27 function getItemDiv(id:integer):boolean;
28 function getItemTexType(id:integer):integer;
30 procedure setMaxItemList(i:integer);
31 procedure setItemList(item, i:integer);
32 function getItemList(i:integer):integer;
34 implementation
35 uses items_store;
36 const
37 BLOCK_FLAG_Trans=1;
38 BLOCK_FLAG_FORE=2;
39 BLOCK_FLAG_SET=4;
41 var
42 itemListSize:integer;
43 itemList: array [0..0] of integer;
45 function getBlockTrans(id:integer;):boolean;
46 begin
47 getBlockTrans:=(getBlockFlags(id) and BLOCK_FLAG_Trans)>0;
48 end;
50 function getBlockFore(id:integer;):boolean;
51 begin
52 getBlockFore:=(getBlockFlags(id) and BLOCK_FLAG_FORE)>0;
53 end;
55 function getBlockSet(id:integer;):boolean;
56 begin
57 getBlockSet:=(getBlockFlags(id) and BLOCK_FLAG_SET)>0;
58 end;
60 function getItemIndNum(id:integer):boolean;
61 begin
62 getItemIndNum:=(getItemFlags(id) and ITEM_FLAG_IND1)>0;
63 end;
65 function getItemIndLine(id:integer):boolean;
66 begin
67 getItemIndLine:=(getItemFlags(id) and ITEM_FLAG_IND2)>0;
68 end;
70 function getItemDiv(id:integer):boolean;
71 begin
72 getItemDiv:=(getItemFlags(id) and ITEM_FLAG_DIV)>0;
73 end;
75 function getItemTexType(id:integer):integer;
76 begin
77 getItemTexType:=(getItemFlags(id) and ITEM_FLAG_TEX)>>3;
78 end;
80 procedure setMaxItemList(i:integer);
81 begin
82 itemListSize:=i;
83 i:=i+1;
84 bytecode
85 iload 0;
86 newarray 10;
87 putstatic field 'items', 'itemlist', '[I';
88 end;
89 end;
91 procedure setItemList(i, item:integer);
92 begin
93 itemList[i]:=item;
94 end;
96 function getItemList(i:integer):integer;
97 begin
98 if (i>=0) and (i<=itemListSize) then
99 getItemList:=itemList[i];
100 end;
101 end.