DEADSOFTWARE

Remove ascii crap
[cavecraft.git] / src / ItemsLogic.pas
1 unit ItemsLogic;
3 interface
5 procedure DrawSmall(id, x, y : integer);
6 procedure Draw(id, sum, x, y : integer; drawIndicator : boolean);
8 implementation
10 uses Items, Vars, Func;
12 procedure DrawSmall(id, x, y : integer);
13 var
14 texid, source : integer;
15 begin
16 texid := Items.GetTexture(id);
17 source := Items.GetTextureSource(id);
18 if source = 0 then DrawImage(Vars.tex8[texid], x, y)
19 else if source = 1 then DrawImage(Vars.item8[texid], x, y)
20 end;
22 procedure Draw(id, sum, x, y : integer; drawIndicator : boolean);
23 const
24 maxLength = 15;
25 maxHeight = 14;
26 redLength = 3;
27 var
28 texid, source, class, max, len : integer;
29 begin
30 if sum <= 0 then exit;
32 texid := Items.GetTexture(id);
33 source := Items.GetTextureSource(id);
34 if source = 0 then DrawImage(Vars.tex[texid], x, y)
35 else if source = 1 then DrawImage(Vars.item[texid], x, y)
37 if drawIndicator and (sum > 1) then begin
38 class := Items.GetIndicatorType(id);
39 if class = numeric then begin
40 Func.DrawFontText('' + sum, x, y + 8)
41 end else if class = line then begin
42 max := Items.GetMaximum(id);
43 len := sum * maxLength / max;
44 if len <= redLength then SetColor(255, 0, 0) else SetColor(0, 255, 0);
45 DrawLine(x, y + maxHeight, x + len, y + maxHeight);
46 end;
47 end;
48 end;
50 initialization
52 end.