X-Git-Url: https://deadsoftware.ru/gitweb?p=cavecraft.git;a=blobdiff_plain;f=src%2FCAVE.mpsrc;h=0d305849e358ef1108de30fb24a68376cf90e8e9;hp=4f61a7db150db7a01614a4bdc5f285d6244b66b3;hb=9115be0a19d5716f33a2e2cba76f3447ce0f4c2f;hpb=f69f36f1ce7426048c8ddfef03f7b237164403ad diff --git a/src/CAVE.mpsrc b/src/CAVE.mpsrc index 4f61a7d..0d30584 100644 --- a/src/CAVE.mpsrc +++ b/src/CAVE.mpsrc @@ -6,7 +6,6 @@ uses drop, invui, vars, - particles_store, randoms, memory, worldgen, @@ -146,19 +145,8 @@ procedure ClearTextures; for ix := 0 to 15 do light[ix] := no; - for ix := 0 to 7 do - begin - pr_1[ix] := no; - pr_2[ix] := no; - pr_3[ix] := no; - pr_4[ix] := no; - pr_5[ix] := no; - end; - - bubble := no; - for ix := 0 to 15 do - pr_boom[ix] := no; + Particles.FreeTextures; Mobs.FreeTextures; sky := no; @@ -208,7 +196,7 @@ procedure loadtexture(path:string); console.exec('textures.cfg', 'AUTO'); - player.loadSkin('char_ani.png', path); + Player.LoadSkin('char_ani.png', path); Mobs.LoadTextures(path); im:=ld_tex('gui.png',path,'gui/'); @@ -258,22 +246,7 @@ procedure loadtexture(path:string); for ix:=0 to 15 do light[ix]:=rotate_image_from_image(im,16*ix,0,16,16,0); end; - if load_particles_tex then - begin - im:=ld_tex('particles.png',path,'terrain/'); - for ix:=0 to 7 do - begin - pr_1[ix]:=rotate_image_from_image(im,8*ix,0,8,8,0); - pr_2[ix]:=rotate_image_from_image(im,8*ix,8,8,8,0); - pr_3[ix]:=rotate_image_from_image(im,8*ix,16,8,8,0); - pr_4[ix]:=rotate_image_from_image(im,8*ix,24,8,8,0); - pr_5[ix]:=rotate_image_from_image(im,8*ix,32,8,8,0); - end; - bubble:=rotate_image_from_image(im,0,40,8,8,0); - im:=ld_tex('explosion.png',path,'terrain/'); - for ix:=0 to 15 do - pr_boom[ix]:=rotate_image_from_image(im,32*ix,0,32,32,0); - end; + Particles.LoadTextures(path); im:=ld_tex('partition.png',path,'gui/'); gui[18]:=rotate_image_from_image(im,0,0,84,42,0); @@ -338,18 +311,12 @@ procedure cleargame; //anim_del2:=0; - inv.resetData; - - chest.resetData; - - furnace.resetData; - - drop.resetData; - + Inv.ResetData; + Chest.ResetData; + Furnace.ResetData; + Drop.ResetData; Mobs.ResetData; - - //gb_up_pa:=0; - reset_particles(max_particles+1); + Particles.ResetData; for ix:=0 to 255 do begin @@ -516,31 +483,19 @@ procedure saveworld(path:string); write_byte(getBackMap(ix)); write_byte(getBiomMap(ix)); end; - drw_load_line('Chests',55); - //Chests - chest.saveData; - drw_load_line('Furnaces',60); - //Furnaces - furnace.saveData; - drw_load_line('Mobs',70); - //Mobs + + drw_load_line('Chests', 55); + Chest.SaveData; + drw_load_line('Furnaces', 60); + Furnace.SaveData; + drw_load_line('Mobs', 70); Mobs.SaveData; - drw_load_line('Drop',80); - //Drop - drop.saveData; - drw_load_line('Particles',85); - //Particles - writeint(max_particles); - write_byte(gb_up_pa); - for ix:=0 to max_particles do - begin - write_byte(get_particle_type(ix)); - write_byte(get_particle_ani(ix)); - writeint(get_particle_x(ix)); - writeint(get_particle_y(ix)); - end; - drw_load_line('Other',90); - //Other + drw_load_line('Drop', 80); + Drop.SaveData; + drw_load_line('Particles', 85); + Particles.SaveData; + + drw_load_line('Other', 90); write_byte(updx); write_byte(updy); writebool(osadki); @@ -648,31 +603,17 @@ function loadworld(path:string):boolean; setBackMap(read_byte, ix); setBiomMap(read_byte, ix); end; - drw_load_line('Chests',55); - //Chests - chest.loadData; - drw_load_line('Furnaces',60); - //Furnaces - furnace.loadData; - //Mobs + drw_load_line('Chests', 55); + Chest.LoadData; + drw_load_line('Furnaces', 60); + Furnace.LoadData; Mobs.LoadData; - drw_load_line('Drop',80); - //Drop - drop.loadData; - drw_load_line('Particles',85); - //Particles - max_particles:=readint; - reset_particles(max_particles+1); - gb_up_pa:=read_byte; - for ix:=0 to max_particles do - begin - set_particle_type(ix,read_byte); - set_particle_ani(ix,read_byte); - set_particle_x(ix,readint); - set_particle_y(ix,readint); - end; - drw_load_line('Other',90); - //Other + drw_load_line('Drop', 80); + Drop.LoadData; + drw_load_line('Particles', 85); + Particles.LoadData; + + drw_load_line('Other',90); updx:=read_byte; updy:=read_byte; osadki:=readbool; @@ -1486,7 +1427,7 @@ var end; else if m_cur=-1 then begin - s_particles:=not s_particles; + Particles.enabled := not Particles.enabled; end; else if m_cur=0 then begin @@ -1540,7 +1481,7 @@ var drw_btn('Light:'+light_type,-3,m_cur,0,1); drw_btn('Weather:'+ifosad,-2,m_cur,0,1); - drw_btn('Particles:'+s_particles,-1,m_cur,0,1); + drw_btn('Particles:' + Particles.enabled, -1, m_cur, 0, 1); drw_btn('Hide GUI:'+not drawgui,0,m_cur,0,1); drw_btn('Touch:'+(load_key_tex>0),1,m_cur,0,1); drw_btn('JPEG:'+s_jpeg_quality,2,m_cur,0,1); @@ -2036,15 +1977,11 @@ procedure draw; draw_block(ix,iy); end; {===================[drop]===================} - drop.draw(camx, camy); + Drop.Draw(camx, camy); {===================[particles]===================} - if s_particles then draw_particle; + Particles.Draw(camx, camy); {===================[player]===================} - if hp>0 then - begin - player.draw(camx, camy); - end; - + Player.Draw(camx, camy); {===================[mobs]===================} Mobs.Draw(camx, camy); {===================[draw_blocks]===================} @@ -2922,7 +2859,7 @@ procedure game; osadki_ani:=osadki_ani+1; if osadki_ani>7 then osadki_ani:=0; - if random(20)=random(20) then create_particle(6,x,y); + if Random(20) = Random(20) then Particles.Create(Particles.bubble, x, y); if gamemode=1 then begin hp:=666; hunger:=666; end; @@ -2934,8 +2871,7 @@ procedure game; //if s_spawn_mob then if random(4096)=1547 then megaspawn; Mobs.Update; - - if particle_upd then update_particle; + Particles.Update; if light_type>0 then begin