DEADSOFTWARE

Fix sunshine
[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;
12 var
13 compas:image;
14 clock:array[0..7] of image;
15 none0:image;
16 clock_stage:integer;
18 function getBlockTrans(id:integer;):boolean;
19 function getBlockFore(id:integer;):boolean;
20 function getBlockSet(id:integer;):boolean;
22 function getItemIndNum(id:integer):boolean;
23 function getItemIndLine(id:integer):boolean;
24 function getItemDiv(id:integer):boolean;
25 function getItemTexType(id:integer):integer;
27 procedure setMaxItemList(i:integer);
28 procedure setItemList(item, i:integer);
29 function getItemList(i:integer):integer;
31 implementation
32 uses items_store;
33 const
34 BLOCK_FLAG_Trans=1;
35 BLOCK_FLAG_FORE=2;
36 BLOCK_FLAG_SET=4;
38 var
39 itemListSize:integer;
40 itemList: array [0..0] of integer;
42 function getBlockTrans(id:integer;):boolean;
43 begin
44 getBlockTrans:=(getBlockFlags(id) and BLOCK_FLAG_Trans)>0;
45 end;
47 function getBlockFore(id:integer;):boolean;
48 begin
49 getBlockFore:=(getBlockFlags(id) and BLOCK_FLAG_FORE)>0;
50 end;
52 function getBlockSet(id:integer;):boolean;
53 begin
54 getBlockSet:=(getBlockFlags(id) and BLOCK_FLAG_SET)>0;
55 end;
57 function getItemIndNum(id:integer):boolean;
58 begin
59 getItemIndNum:=(getItemFlags(id) and ITEM_FLAG_IND1)>0;
60 end;
62 function getItemIndLine(id:integer):boolean;
63 begin
64 getItemIndLine:=(getItemFlags(id) and ITEM_FLAG_IND2)>0;
65 end;
67 function getItemDiv(id:integer):boolean;
68 begin
69 getItemDiv:=(getItemFlags(id) and ITEM_FLAG_DIV)>0;
70 end;
72 function getItemTexType(id:integer):integer;
73 begin
74 getItemTexType:=(getItemFlags(id) and ITEM_FLAG_TEX)>>3;
75 end;
77 procedure setMaxItemList(i:integer);
78 begin
79 itemListSize:=i;
80 i:=i+1;
81 bytecode
82 iload 0;
83 newarray 10;
84 putstatic field 'items', 'itemlist', '[I';
85 end;
86 end;
88 procedure setItemList(i, item:integer);
89 begin
90 itemList[i]:=item;
91 end;
93 function getItemList(i:integer):integer;
94 begin
95 if (i>=0) and (i<=itemListSize) then
96 getItemList:=itemList[i];
97 end;
98 end.