18 procedure Create(typ
, x
, y
: integer);
20 procedure Draw(camx
, camy
: integer);
22 procedure LoadTextures(path
: string);
23 procedure FreeTextures
;
31 uses vars
, maps
, func
, canvas
, jsr75i
;
38 ptype
, px
, py
, pa
: array [0..lastParticle
] of integer;
39 smokeSprites
: array [0..4, 0..7] of image
;
40 explosionSprites
: array [0..15] of image
;
43 procedure Create(typ
, x
, y
: integer);
45 if not enabled
then exit
;
50 tail
:= (tail
+ 1) mod lastParticle
;
57 if not enabled
then exit
;
58 for i
:= 0 to lastParticle
do if ptype
[i
] <> none
then begin
60 if (typ
>= whiteSmoke
) and (typ
<= pinkSmoke
) then begin
63 if pa
[i
] > 14 then ptype
[i
] := none
;
64 end else if typ
= bubble
then begin
66 if GetMap(px
[i
] / 16, py
[i
] / 16) <> 50 then ptype
[i
] := none
;
67 end else if typ
= explosion
then begin
69 if pa
[i
] > 15 then ptype
[i
] := none
;
74 procedure Draw(camx
, camy
: integer);
78 if not enabled
then exit
;
79 for i
:= 0 to lastParticle
do if ptype
[i
] <> none
then begin
81 if (typ
>= whiteSmoke
) and (typ
<= pinkSmoke
) then begin
82 DrawImage(smokeSprites
[typ
- 1, pa
[i
] / 2], px
[i
] - camx
, py
[i
] - camy
);
83 end else if typ
= bubble
then begin
84 DrawImage(bubbleSprite
, px
[i
] - camx
, py
[i
] - camy
)
85 end else if typ
= explosion
then begin
86 DrawImage(explosionSprites
[pa
[i
]], px
[i
] - camx
, py
[i
] - camy
);
91 procedure LoadTextures(path
: string);
96 if not enabled
then exit
;
97 im
:= ld_tex('particles.png', path
, 'terrain/');
98 for i
:= 0 to 4 do begin
99 for j
:= 0 to 7 do begin
100 smokeSprites
[i
, j
] := rotate_image_from_image(im
, 8 * j
, 8 * i
, 8, 8, 0);
104 bubbleSprite
:= rotate_image_from_image(im
, 0, 40, 8, 8, 0);
106 im
:= ld_tex('explosion.png', path
, 'terrain/');
107 for i
:= 0 to 15 do begin
108 explosionSprites
[i
] := rotate_image_from_image(im
, 32 * i
, 0, 32, 32, 0);
112 procedure FreeTextures
;
117 for i
:= 0 to 4 do begin
118 for j
:= 0 to 7 do begin
119 smokeSprites
[i
, j
] := nullimg
;
123 bubbleSprite
:= nullimg
;
125 for i
:= 0 to 15 do begin
126 explosionSprites
[i
] := nullimg
;
134 for i
:= 0 to lastParticle
do begin
135 write_byte(ptype
[i
]);
146 for i
:= 0 to lastParticle
do begin
147 ptype
[i
] := read_byte
;
158 for i
:= 0 to lastParticle
do begin