1 influence: proc (inf, suminf, new_x, new_y, color, adding);
2
3
4
5
6
7
8
9 dcl (inf (19, 19), suminf (19, 19)) fixed bin;
10 dcl (new_x, new_y) fixed bin;
11 dcl (color, adding) fixed bin;
12 dcl (lim, lim1, lim2, lim3, lim4) fixed bin;
13 dcl (i, i2, j, j2, k1, k2) fixed bin;
14
15
16 dcl deltainf (-7:7, -7:7) fixed bin static options (constant) init
17 (0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
18 0, 0, 0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0,
19 0, 0, 0, 0, 0, 1, 2, 3, 2, 1, 0, 0, 0, 0, 0,
20 0, 0, 0, 0, 1, 2, 3, 4, 3, 2, 1, 0, 0, 0, 0,
21 0, 0, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 0, 0,
22 0, 0, 1, 2, 3, 4, 6, 7, 6, 4, 3, 2, 1, 0, 0,
23 0, 1, 2, 3, 4, 6, 8, 10, 8, 6, 4, 3, 2, 1, 0,
24 1, 2, 3, 4, 5, 7, 10, 14, 10, 7, 5, 4, 3, 2, 1,
25 0, 1, 2, 3, 4, 6, 8, 10, 8, 6, 4, 3, 2, 1, 0,
26 0, 0, 1, 2, 3, 4, 6, 7, 6, 4, 3, 2, 1, 0, 0,
27 0, 0, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 0, 0,
28 0, 0, 0, 0, 1, 2, 3, 4, 3, 2, 1, 0, 0, 0, 0,
29 0, 0, 0, 0, 0, 1, 2, 3, 2, 1, 0, 0, 0, 0, 0,
30 0, 0, 0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0,
31 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0);
32
33
34
35 if new_x < 8 then lim1 = 1-new_x;else lim1 = -7;
36 if new_x >12 then lim2 = 19-new_x; else lim2 = 7;
37 k1 = 1-new_y;
38 k2 = 19-new_y;
39 do i = lim1 to lim2;
40 lim = 7-abs (i);
41 i2 = i+new_x;
42
43 lim3 = -lim; if k1>lim3 then lim3 = k1;
44 lim4 = lim; if k2<lim4 then lim4 = k2;
45 do j = lim3 to lim4;
46
47 j2 = j+new_y;
48 inf (i2, j2) = inf (i2, j2) + deltainf (i, j) * color * adding;
49 suminf (i2, j2) = suminf (i2, j2) + deltainf (i, j) * adding;
50 end;
51 end;
52 end influence;