summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 90bc20f)
raw | patch | inline | side by side (parent: 90bc20f)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Fri, 8 Sep 2017 18:20:19 +0000 (21:20 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Fri, 8 Sep 2017 18:20:19 +0000 (21:20 +0300) |
BUGS | patch | blob | history | |
libs/Lib_particles_store.class | [deleted file] | patch | blob | history |
libs/Lib_particles_store.java | [deleted file] | patch | blob | history |
src/CAVE.mpsrc | patch | blob | history | |
src/Mobs.pas | [moved from src/mobs.pas with 100% similarity] | patch | blob | history |
src/Particles.mpsrc | [new file with mode: 0644] | patch | blob |
src/Phy.pas | [moved from src/phy.pas with 100% similarity] | patch | blob | history |
src/Player.mpsrc | [moved from src/player.mpsrc with 95% similarity] | patch | blob | history |
src/console.pas | patch | blob | history | |
src/items_logic.mpsrc | patch | blob | history | |
src/particles.mpsrc | [deleted file] | patch | blob | history |
index d57ab45883f859ba3a04f41ac81ddda75ef85f37..cd5974ed4ef73cd5832d78c1d2d36c57a3a7099f 100644 (file)
--- a/BUGS
+++ b/BUGS
- Предметы не сгорают в лаве (и никогда не сгорали, но всё же)
- Не сбрасывается анимация игрока при старте новой игры
- Кактусы не убивают
+- Динамит не взравется - просто мигает
- Запилить блочный формат сохранений с переменным числом записей и версионированием блоков.
- Перепроверить генерацию предметов в cокровищницах
-- Перепроверить рост деревьев
+- Перепроверить рост деревьев -- cм items_logic.updateBlock -> *_RND
- Курсор на ремне должен быть чётче
- В бете 8 была поддержка звука, надо вернуть.
diff --git a/libs/Lib_particles_store.class b/libs/Lib_particles_store.class
deleted file mode 100644 (file)
index 53fce20..0000000
Binary files a/libs/Lib_particles_store.class and /dev/null differ
index 53fce20..0000000
Binary files a/libs/Lib_particles_store.class and /dev/null differ
diff --git a/libs/Lib_particles_store.java b/libs/Lib_particles_store.java
+++ /dev/null
@@ -1,63 +0,0 @@
-class Lib_particles_store\r
- {\r
- static byte[] particle_type;\r
- static byte[] particle_ani;\r
- static short[] particle_x;\r
- static short[] particle_y;\r
-\r
- public static void reset_particles(int len)\r
- {\r
- particle_type = new byte[len];\r
- particle_ani = new byte[len];\r
- particle_x = new short[len];\r
- particle_y = new short[len];\r
- }\r
-\r
- public static void set_particle(int id, int type, int ani, int x, int y)\r
- {\r
- particle_type[id] = (byte) type;\r
- particle_ani[id] = (byte) ani;\r
- particle_x[id] = (short) x;\r
- particle_y[id] = (short) y;\r
- }\r
-\r
- public static void set_particle_type(int id, int type)\r
- {\r
- particle_type[id] = (byte) type;\r
- }\r
-\r
- public static void set_particle_ani(int id, int ani)\r
- {\r
- particle_ani[id] = (byte) ani;\r
- }\r
-\r
- public static void set_particle_x(int id, int x)\r
- {\r
- particle_x[id] = (short) x;\r
- }\r
-\r
- public static void set_particle_y(int id, int y)\r
- {\r
- particle_y[id] = (short) y;\r
- }\r
-\r
- public static int get_particle_type(int id)\r
- {\r
- return particle_type[id] & 0xFF;\r
- }\r
-\r
- public static int get_particle_ani(int id)\r
- {\r
- return particle_ani[id] & 0xFF;\r
- }\r
-\r
- public static int get_particle_x(int id)\r
- {\r
- return particle_x[id];\r
- }\r
-\r
- public static int get_particle_y(int id)\r
- {\r
- return particle_y[id];\r
- }\r
-}
\ No newline at end of file
diff --git a/src/CAVE.mpsrc b/src/CAVE.mpsrc
index 4f61a7db150db7a01614a4bdc5f285d6244b66b3..0d305849e358ef1108de30fb24a68376cf90e8e9 100644 (file)
--- a/src/CAVE.mpsrc
+++ b/src/CAVE.mpsrc
drop,\r
invui,\r
vars,\r
- particles_store,\r
randoms,\r
memory,\r
worldgen,\r
\r
for ix := 0 to 15 do\r
light[ix] := no;\r
- for ix := 0 to 7 do\r
- begin\r
- pr_1[ix] := no;\r
- pr_2[ix] := no;\r
- pr_3[ix] := no;\r
- pr_4[ix] := no;\r
- pr_5[ix] := no;\r
- end;\r
-\r
- bubble := no;\r
- for ix := 0 to 15 do\r
- pr_boom[ix] := no;\r
\r
+ Particles.FreeTextures;\r
Mobs.FreeTextures;\r
\r
sky := no;\r
\r
console.exec('textures.cfg', 'AUTO');\r
\r
- player.loadSkin('char_ani.png', path);\r
+ Player.LoadSkin('char_ani.png', path);\r
Mobs.LoadTextures(path);\r
\r
im:=ld_tex('gui.png',path,'gui/');\r
for ix:=0 to 15 do light[ix]:=rotate_image_from_image(im,16*ix,0,16,16,0);\r
end;\r
\r
- if load_particles_tex then\r
- begin\r
- im:=ld_tex('particles.png',path,'terrain/');\r
- for ix:=0 to 7 do\r
- begin\r
- pr_1[ix]:=rotate_image_from_image(im,8*ix,0,8,8,0);\r
- pr_2[ix]:=rotate_image_from_image(im,8*ix,8,8,8,0);\r
- pr_3[ix]:=rotate_image_from_image(im,8*ix,16,8,8,0);\r
- pr_4[ix]:=rotate_image_from_image(im,8*ix,24,8,8,0);\r
- pr_5[ix]:=rotate_image_from_image(im,8*ix,32,8,8,0);\r
- end;\r
- bubble:=rotate_image_from_image(im,0,40,8,8,0);\r
- im:=ld_tex('explosion.png',path,'terrain/');\r
- for ix:=0 to 15 do\r
- pr_boom[ix]:=rotate_image_from_image(im,32*ix,0,32,32,0);\r
- end;\r
+ Particles.LoadTextures(path);\r
\r
im:=ld_tex('partition.png',path,'gui/');\r
gui[18]:=rotate_image_from_image(im,0,0,84,42,0);\r
\r
//anim_del2:=0;\r
\r
- inv.resetData;\r
-\r
- chest.resetData;\r
-\r
- furnace.resetData;\r
-\r
- drop.resetData;\r
-\r
+ Inv.ResetData;\r
+ Chest.ResetData;\r
+ Furnace.ResetData;\r
+ Drop.ResetData;\r
Mobs.ResetData;\r
-\r
- //gb_up_pa:=0;\r
- reset_particles(max_particles+1);\r
+ Particles.ResetData;\r
\r
for ix:=0 to 255 do\r
begin\r
write_byte(getBackMap(ix));\r
write_byte(getBiomMap(ix));\r
end;\r
- drw_load_line('Chests',55);\r
- //Chests\r
- chest.saveData;\r
- drw_load_line('Furnaces',60);\r
- //Furnaces\r
- furnace.saveData;\r
- drw_load_line('Mobs',70);\r
- //Mobs\r
+\r
+ drw_load_line('Chests', 55);\r
+ Chest.SaveData;\r
+ drw_load_line('Furnaces', 60);\r
+ Furnace.SaveData;\r
+ drw_load_line('Mobs', 70);\r
Mobs.SaveData;\r
- drw_load_line('Drop',80);\r
- //Drop\r
- drop.saveData;\r
- drw_load_line('Particles',85);\r
- //Particles\r
- writeint(max_particles);\r
- write_byte(gb_up_pa);\r
- for ix:=0 to max_particles do\r
- begin\r
- write_byte(get_particle_type(ix));\r
- write_byte(get_particle_ani(ix));\r
- writeint(get_particle_x(ix));\r
- writeint(get_particle_y(ix));\r
- end;\r
- drw_load_line('Other',90);\r
- //Other\r
+ drw_load_line('Drop', 80);\r
+ Drop.SaveData;\r
+ drw_load_line('Particles', 85);\r
+ Particles.SaveData;\r
+\r
+ drw_load_line('Other', 90);\r
write_byte(updx);\r
write_byte(updy);\r
writebool(osadki);\r
setBackMap(read_byte, ix);\r
setBiomMap(read_byte, ix);\r
end;\r
- drw_load_line('Chests',55);\r
- //Chests\r
- chest.loadData;\r
- drw_load_line('Furnaces',60);\r
- //Furnaces\r
- furnace.loadData;\r
- //Mobs\r
+ drw_load_line('Chests', 55);\r
+ Chest.LoadData;\r
+ drw_load_line('Furnaces', 60);\r
+ Furnace.LoadData;\r
Mobs.LoadData;\r
- drw_load_line('Drop',80);\r
- //Drop\r
- drop.loadData;\r
- drw_load_line('Particles',85);\r
- //Particles\r
- max_particles:=readint;\r
- reset_particles(max_particles+1);\r
- gb_up_pa:=read_byte;\r
- for ix:=0 to max_particles do\r
- begin\r
- set_particle_type(ix,read_byte);\r
- set_particle_ani(ix,read_byte);\r
- set_particle_x(ix,readint);\r
- set_particle_y(ix,readint);\r
- end;\r
- drw_load_line('Other',90);\r
- //Other\r
+ drw_load_line('Drop', 80);\r
+ Drop.LoadData;\r
+ drw_load_line('Particles', 85);\r
+ Particles.LoadData;\r
+\r
+ drw_load_line('Other',90);\r
updx:=read_byte;\r
updy:=read_byte;\r
osadki:=readbool;\r
end; else\r
if m_cur=-1 then\r
begin\r
- s_particles:=not s_particles;\r
+ Particles.enabled := not Particles.enabled;\r
end; else\r
if m_cur=0 then\r
begin\r
\r
drw_btn('Light:'+light_type,-3,m_cur,0,1);\r
drw_btn('Weather:'+ifosad,-2,m_cur,0,1);\r
- drw_btn('Particles:'+s_particles,-1,m_cur,0,1);\r
+ drw_btn('Particles:' + Particles.enabled, -1, m_cur, 0, 1);\r
drw_btn('Hide GUI:'+not drawgui,0,m_cur,0,1);\r
drw_btn('Touch:'+(load_key_tex>0),1,m_cur,0,1);\r
drw_btn('JPEG:'+s_jpeg_quality,2,m_cur,0,1);\r
draw_block(ix,iy);\r
end;\r
{===================[drop]===================}\r
- drop.draw(camx, camy);\r
+ Drop.Draw(camx, camy);\r
{===================[particles]===================}\r
- if s_particles then draw_particle;\r
+ Particles.Draw(camx, camy);\r
{===================[player]===================}\r
- if hp>0 then\r
- begin\r
- player.draw(camx, camy);\r
- end;\r
-\r
+ Player.Draw(camx, camy);\r
{===================[mobs]===================}\r
Mobs.Draw(camx, camy);\r
{===================[draw_blocks]===================}\r
osadki_ani:=osadki_ani+1;\r
if osadki_ani>7 then osadki_ani:=0;\r
\r
- if random(20)=random(20) then create_particle(6,x,y);\r
+ if Random(20) = Random(20) then Particles.Create(Particles.bubble, x, y);\r
\r
if gamemode=1 then begin hp:=666; hunger:=666; end;\r
\r
//if s_spawn_mob then if random(4096)=1547 then megaspawn;\r
\r
Mobs.Update;\r
-\r
- if particle_upd then update_particle;\r
+ Particles.Update;\r
\r
if light_type>0 then\r
begin\r
diff --git a/src/mobs.pas b/src/Mobs.pas
diff --git a/src/Particles.mpsrc b/src/Particles.mpsrc
--- /dev/null
+++ b/src/Particles.mpsrc
@@ -0,0 +1,166 @@
+unit Particles;\r
+\r
+interface\r
+\r
+ const\r
+ none = 0;\r
+ whiteSmoke = 1;\r
+ graySmoke = 2;\r
+ blackSmoke = 3;\r
+ redSmoke = 4;\r
+ pinkSmoke = 5;\r
+ bubble = 6;\r
+ explosion = 7;\r
+\r
+ var\r
+ enabled : boolean;\r
+\r
+ procedure Create(typ, x, y : integer);\r
+ procedure Update;\r
+ procedure Draw(camx, camy : integer);\r
+\r
+ procedure LoadTextures(path : string);\r
+ procedure FreeTextures;\r
+\r
+ procedure SaveData;\r
+ procedure LoadData;\r
+ procedure ResetData;\r
+\r
+implementation\r
+\r
+ uses vars, maps, func, canvas, jsr75i;\r
+\r
+ const\r
+ lastParticle = 64;\r
+\r
+ var\r
+ tail : integer;\r
+ ptype, px, py, pa : array [0..lastParticle] of integer;\r
+ smokeSprites : array [0..4, 0..7] of image;\r
+ explosionSprites : array [0..15] of image;\r
+ bubbleSprite : image;\r
+\r
+ procedure Create(typ, x, y : integer);\r
+ begin\r
+ if not enabled then exit;\r
+ ptype[tail] := typ;\r
+ px[tail] := x;\r
+ py[tail] := y;\r
+ pa[tail] := 0;\r
+ tail := (tail + 1) mod lastParticle;\r
+ end;\r
+\r
+ procedure Update;\r
+ var\r
+ typ, i : integer;\r
+ begin\r
+ if not enabled then exit;\r
+ for i := 0 to lastParticle do if ptype[i] <> none then begin\r
+ typ := ptype[i];\r
+ if (typ >= whiteSmoke) and (typ <= pinkSmoke) then begin\r
+ py[i] := py[i] - 1;\r
+ pa[i] := pa[i] + 1;\r
+ if pa[i] > 14 then ptype[i] := none;\r
+ end else if typ = bubble then begin\r
+ py[i] := py[i] - 1;\r
+ if GetMap(px[i] / 16, py[i] / 16) <> 50 then ptype[i] := none;\r
+ end else if typ = explosion then begin\r
+ pa[i] := pa[i] + 1;\r
+ if pa[i] > 15 then ptype[i] := none;\r
+ end;\r
+ end;\r
+ end;\r
+\r
+ procedure Draw(camx, camy : integer);\r
+ var\r
+ typ, i : integer;\r
+ begin\r
+ if not enabled then exit;\r
+ for i := 0 to lastParticle do if ptype[i] <> none then begin\r
+ typ := ptype[i];\r
+ if (typ >= whiteSmoke) and (typ <= pinkSmoke) then begin\r
+ DrawImage(smokeSprites[typ - 1, pa[i] / 2], px[i] - camx, py[i] - camy);\r
+ end else if typ = bubble then begin\r
+ DrawImage(bubbleSprite, px[i] - camx, py[i] - camy)\r
+ end else if typ = explosion then begin\r
+ DrawImage(explosionSprites[pa[i]], px[i] - camx, py[i] - camy);\r
+ end;\r
+ end;\r
+ end;\r
+\r
+ procedure LoadTextures(path : string);\r
+ var\r
+ im : image;\r
+ i, j : integer;\r
+ begin\r
+ if not enabled then exit;\r
+ im := ld_tex('particles.png', path, 'terrain/');\r
+ for i := 0 to 4 do begin\r
+ for j := 0 to 7 do begin\r
+ smokeSprites[i, j] := rotate_image_from_image(im, 8 * j, 8 * i, 8, 8, 0);\r
+ end;\r
+ end;\r
+\r
+ bubbleSprite := rotate_image_from_image(im, 0, 40, 8, 8, 0);\r
+\r
+ im := ld_tex('explosion.png', path, 'terrain/');\r
+ for i := 0 to 15 do begin\r
+ explosionSprites[i] := rotate_image_from_image(im, 32 * i, 0, 32, 32, 0); \r
+ end;\r
+ end;\r
+\r
+ procedure FreeTextures;\r
+ var\r
+ nullimg : image;\r
+ i, j : integer;\r
+ begin\r
+ for i := 0 to 4 do begin\r
+ for j := 0 to 7 do begin\r
+ smokeSprites[i, j] := nullimg;\r
+ end;\r
+ end;\r
+\r
+ bubbleSprite := nullimg;\r
+\r
+ for i := 0 to 15 do begin\r
+ explosionSprites[i] := nullimg;\r
+ end;\r
+ end;\r
+\r
+ procedure SaveData;\r
+ var\r
+ i : integer;\r
+ begin\r
+ for i := 0 to lastParticle do begin\r
+ write_byte(ptype[i]);\r
+ WriteInt(px[i]);\r
+ WriteInt(py[i]);\r
+ WriteInt(pa[i]);\r
+ end;\r
+ end;\r
+\r
+ procedure LoadData;\r
+ var\r
+ i : integer;\r
+ begin\r
+ for i := 0 to lastParticle do begin\r
+ ptype[i] := read_byte;\r
+ px[i] := ReadInt;\r
+ py[i] := ReadInt;\r
+ pa[i] := ReadInt;\r
+ end;\r
+ end;\r
+\r
+ procedure ResetData;\r
+ var\r
+ i : integer;\r
+ begin\r
+ for i := 0 to lastParticle do begin\r
+ ptype[i] := none;\r
+ px[i] := 0;\r
+ py[i] := 0;\r
+ pa[i] := 0;\r
+ end;\r
+ end;\r
+\r
+end.\r
diff --git a/src/phy.pas b/src/Phy.pas
diff --git a/src/player.mpsrc b/src/Player.mpsrc
similarity index 95%
rename from src/player.mpsrc
rename to src/Player.mpsrc
index 812a2b46829db0f2f7569a59afe7fb310bb5b3c5..b41c8e3b7ff82cfcc4eda09aa5e8cbb6f7f2895b 100644 (file)
rename from src/player.mpsrc
rename to src/Player.mpsrc
index 812a2b46829db0f2f7569a59afe7fb310bb5b3c5..b41c8e3b7ff82cfcc4eda09aa5e8cbb6f7f2895b 100644 (file)
--- a/src/player.mpsrc
+++ b/src/Player.mpsrc
-unit player;\r
+unit Player;\r
\r
interface\r
\r
diff --git a/src/console.pas b/src/console.pas
index 309fc28ad37eced65ea48ae0f7e353669f33f07a..c6c2f69dd056e7db6d8f3cdbcb8f94be8a5093d2 100644 (file)
--- a/src/console.pas
+++ b/src/console.pas
osadki:boolean;\r
bl_upd:integer;\r
s_get_drp:boolean;\r
- particle_upd:boolean;\r
drw_back:boolean;\r
drw_sm:boolean;\r
s_max_fps:integer;\r
light_type:integer;\r
\r
ifosad:boolean;\r
- //s_particles:boolean; - module\r
\r
load_sm:integer;\r
load_sky_siz:integer;\r
load_back_tex:boolean;\r
load_weather_tex:boolean;\r
- load_particles_tex:boolean;\r
load_light_tex:boolean;\r
load_gui_tex:boolean;\r
\r
sd:string;\r
\r
EOFstr, ENDstr:boolean;\r
- //max_particles:integer; - module\r
\r
procedure save_settings;\r
procedure load_settings;\r
procedure addToLog(str:string);\r
\r
implementation\r
-uses keyboard,particles_store,vars,maps,items,canvas,mobs,worldgen,jsr75i,particles,func, player,sensor, drop, inv, furnace, items_store, video;\r
+\r
+ uses\r
+ keyboard,\r
+ vars,\r
+ maps,\r
+ items,\r
+ canvas,\r
+ mobs,\r
+ worldgen,\r
+ jsr75i,\r
+ particles,\r
+ func,\r
+ player,\r
+ sensor,\r
+ drop,\r
+ inv,\r
+ furnace,\r
+ items_store,\r
+ video;\r
+\r
const\r
CON_LOG_SIZE=9;\r
PARSER_MAX_STR=15;\r
MAX_IMGREG=2;\r
+\r
var\r
logSTR: array [0..CON_LOG_SIZE] of string;\r
lastCommand:string;\r
t:=addRecordStoreEntry(rs,version);\r
t:=addRecordStoreEntry(rs,''+light_type);\r
t:=addRecordStoreEntry(rs,''+ifosad);\r
- t:=addRecordStoreEntry(rs,''+s_particles);\r
+ t:=addRecordStoreEntry(rs, '' + Particles.enabled);\r
t:=addRecordStoreEntry(rs,''+drawgui);\r
t:=addRecordStoreEntry(rs,''+s_jpeg_quality);\r
t:=addRecordStoreEntry(rs,''+load_key_tex);\r
end;\r
light_type:=stringtointeger(readRecordStoreEntry(rs,2));\r
ifosad:=sett_ld_bool(readRecordStoreEntry(rs,3));\r
- s_particles:=sett_ld_bool(readRecordStoreEntry(rs,4));\r
+ Particles.enabled := sett_ld_bool(readRecordStoreEntry(rs, 4));\r
drawgui:=sett_ld_bool(readRecordStoreEntry(rs,5));\r
s_jpeg_quality:=stringtointeger(readRecordStoreEntry(rs,6));\r
load_key_tex:=stringtointeger(readRecordStoreEntry(rs,7));\r
if com='GET_DRP' then\r
s_get_drp:=strToBool(nextWord);\r
else\r
- {if com='AI_UPD' then\r
- ai_upd:=strToBool(nextWord);\r
- else}\r
- if com='PRT_UPD' then\r
- particle_upd:=strToBool(nextWord);\r
- else\r
if com='MAX_FPS' then\r
s_max_fps:=decodeInt(nextWord); else\r
if com='DRW_BACK' then\r
light_type:=decodeInt(nextWord);\r
else\r
if com='S_PARTICLES' then\r
- s_particles:=strToBool(nextWord);\r
+ Particles.enabled := strToBool(nextWord);\r
else\r
if com='LOAD_SKY' then\r
load_sky_siz:=decodeInt(nextWord);\r
if com='LOAD_WEATHER_TEX' then\r
load_weather_tex:=strToBool(nextWord);\r
else\r
- if com='LOAD_PARTICLES_TEX' then\r
- load_particles_tex:=strToBool(nextWord);\r
- else\r
if com='LOAD_LIGHT_TEX' then\r
load_light_tex:=strToBool(nextWord);\r
else\r
if com='LOAD_MINIMAP_TEX' then\r
load_minimap_tex:=strToBool(nextWord);\r
else\r
- if com='MAX_PARTICLES' then\r
- begin\r
- max_particles:=decodeInt(nextWord);\r
- reset_particles(max_particles+1);\r
- end;\r
- else\r
if com='EXEC' then\r
begin\r
tmp:=nextWord;\r
diff --git a/src/items_logic.mpsrc b/src/items_logic.mpsrc
index efcee9fb5ecb4034a8e3c47b848166b25fd43625..a3d41c04f757880049a1db63f27694ee9ad375bb 100644 (file)
--- a/src/items_logic.mpsrc
+++ b/src/items_logic.mpsrc
begin\r
if 30<=random(100) then destroy_block_1(getmap(ix,iy),ix,iy);\r
setmap(0,ix,iy);\r
- create_particle(7,(ix*16)+8-16,(iy*16)+8-16);\r
+ Particles.Create(Particles.explosion, (ix * 16) + 8 - 16, (iy * 16) + 8 - 16);\r
end;\r
end;\r
minhp:=minhp/360;\r
procedure updateBlock(x, y:integer);\r
const\r
GRASS_RND=128;\r
- TORCH_RND=128;\r
+ TORCH_RND=10;\r
SPAWN_RND=128;\r
SPAWN_RAD=128;\r
GENWOOD_RND=1024;\r
if block=26 then\r
begin\r
if random(TORCH_RND)=random(TORCH_RND) then\r
- create_particle(2, x*16+4, y*16+4);\r
+ Particles.Create(Particles.graySmoke, x * 16 + 4, y * 16 + 4);\r
end;\r
else\r
if block=50 then\r
if block=105 then\r
begin\r
if random(TORCH_RND)=random(TORCH_RND) then\r
- create_particle(4, x*16+4, y*16+4);\r
+ Particles.Create(Particles.redSmoke, x * 16 + 4, y * 16 + 4);\r
end;\r
else\r
if (block = 106) or (block = 125) then\r
diff --git a/src/particles.mpsrc b/src/particles.mpsrc
--- a/src/particles.mpsrc
+++ /dev/null
@@ -1,139 +0,0 @@
-unit particles;\r
-\r
-interface\r
- var\r
- bubble:image;\r
- pr_1:array [0..7] of image;\r
- none1:image;\r
- pr_2:array [0..7] of image;\r
- none2:image;\r
- pr_3:array [0..7] of image;\r
- none3:image;\r
- pr_4:array [0..7] of image;\r
- none4:image;\r
- pr_5:array [0..7] of image;\r
- none5:image;\r
- pr_boom:array [0..15] of image;\r
- none6:image;\r
- \r
- max_particles:integer;\r
- s_particles:boolean;\r
- gb_up_pa:integer;\r
-\r
- procedure create_particle(tp,ix,iy:integer);\r
- procedure update_particle;\r
- procedure draw_particle;\r
-\r
-implementation\r
- uses vars,maps,particles_store;\r
-\r
-procedure create_particle(tp,ix,iy:integer);\r
- var\r
- i:integer;\r
- begin\r
- if s_particles=true then\r
- for i:=0 to max_particles do\r
- if get_particle_type(i)=0 then\r
- begin\r
- set_particle(i,tp,0,ix,iy);\r
- exit;\r
- end;\r
- end;\r
-\r
-procedure null_particle(i:integer);\r
- begin\r
- set_particle(i,0,0,0,0);\r
- end;\r
-\r
-procedure pr_ai_1(i,maxani:integer);\r
- begin\r
- set_particle_y(i,get_particle_y(i)-1);\r
- set_particle_ani(i,get_particle_ani(i)+1);\r
- if get_particle_ani(i)>maxani then null_particle(i);\r
- end;\r
-\r
-procedure pr_ai_bubble(i:integer);\r
- var\r
- xx,yy:integer;\r
- begin\r
- set_particle_y(i,get_particle_y(i)-1);\r
- xx:=get_particle_x(i) div 16;\r
- yy:=get_particle_y(i) div 16;\r
- if getmap(xx,yy)<>50 then null_particle(i);\r
- end;\r
-\r
-procedure pr_ai_boom(i:integer);\r
- begin\r
- set_particle_ani(i,get_particle_ani(i)+1);\r
- if get_particle_ani(i)>15 then null_particle(i);\r
- end;\r
-\r
-procedure update_particle;\r
- var\r
- i:integer;\r
- begin\r
- if s_particles=true then\r
- begin\r
- for i:=0 to max_particles do\r
- if get_particle_type(i)>0 then\r
- begin\r
- if get_particle_type(i)=1 then pr_ai_1(i,5); else\r
- if get_particle_type(i)=2 then pr_ai_1(i,5); else\r
- if get_particle_type(i)=3 then pr_ai_1(i,5); else\r
- if get_particle_type(i)=4 then pr_ai_1(i,5); else\r
- if get_particle_type(i)=5 then pr_ai_1(i,5); else\r
- if get_particle_type(i)=6 then pr_ai_bubble(i); else\r
- if get_particle_type(i)=7 then pr_ai_boom(i); else\r
- null_particle(i);\r
- end;\r
- gb_up_pa:=gb_up_pa+1;\r
- if gb_up_pa>=2 then gb_up_pa:=0;\r
- end;\r
- end;\r
-\r
-procedure draw_particle;\r
- var\r
- i:integer;\r
- begin\r
- for i:=0 to max_particles do\r
- if get_particle_type(i)>0 then\r
- begin\r
- if get_particle_type(i)=1 then\r
- begin\r
- if (get_particle_x(i)-camx>-8) and (get_particle_x(i)-camx<getwidth) and (get_particle_y(i)-camy>-8) and (get_particle_y(i)-camy<getheight) then\r
- drawimage(pr_1[get_particle_ani(i)],get_particle_x(i)-camx,get_particle_y(i)-camy);\r
- end; else\r
- if get_particle_type(i)=2 then\r
- begin\r
- if (get_particle_x(i)-camx>-8) and (get_particle_x(i)-camx<getwidth) and (get_particle_y(i)-camy>-8) and (get_particle_y(i)-camy<getheight) then\r
- drawimage(pr_2[get_particle_ani(i)],get_particle_x(i)-camx,get_particle_y(i)-camy);\r
- end; else\r
- if get_particle_type(i)=3 then\r
- begin\r
- if (get_particle_x(i)-camx>-8) and (get_particle_x(i)-camx<getwidth) and (get_particle_y(i)-camy>-8) and (get_particle_y(i)-camy<getheight) then\r
- drawimage(pr_3[get_particle_ani(i)],get_particle_x(i)-camx,get_particle_y(i)-camy);\r
- end; else\r
- if get_particle_type(i)=4 then\r
- begin\r
- if (get_particle_x(i)-camx>-8) and (get_particle_x(i)-camx<getwidth) and (get_particle_y(i)-camy>-8) and (get_particle_y(i)-camy<getheight) then\r
- drawimage(pr_4[get_particle_ani(i)],get_particle_x(i)-camx,get_particle_y(i)-camy);\r
- end; else\r
- if get_particle_type(i)=5 then\r
- begin\r
- if (get_particle_x(i)-camx>-8) and (get_particle_x(i)-camx<getwidth) and (get_particle_y(i)-camy>-8) and (get_particle_y(i)-camy<getheight) then\r
- drawimage(pr_4[get_particle_ani(i)],get_particle_x(i)-camx,get_particle_y(i)-camy);\r
- end; else\r
- if get_particle_type(i)=6 then\r
- begin\r
- if (get_particle_x(i)-camx>-8) and (get_particle_x(i)-camx<getwidth) and (get_particle_y(i)-camy>-8) and (get_particle_y(i)-camy<getheight) then\r
- drawimage(bubble,get_particle_x(i)-camx,get_particle_y(i)-camy);\r
- end; else\r
- if get_particle_type(i)=7 then\r
- begin\r
- if (get_particle_x(i)-camx>-32) and (get_particle_x(i)-camx<getwidth) and (get_particle_y(i)-camy>-32) and (get_particle_y(i)-camy<getheight) then\r
- drawimage(pr_boom[get_particle_ani(i)],get_particle_x(i)-camx,get_particle_y(i)-camy);\r
- end;\r
- end;\r
- end;\r
-\r
-end.\r