diff --git a/src/CAVE.mpsrc b/src/CAVE.mpsrc
index 04446b3bf80dc50ba51180b00352480d03a26965..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
canvas,\r
items,\r
safeload,\r
- mob,\r
+ mobs,\r
console,\r
effects,\r
particles,\r
video;\r
\r
const\r
- version = 'BETA 9';\r
- version_map = 9;\r
+ version_map = 9;\r
\r
var\r
keymode,updx,updy:integer;\r
moon_phase:integer;\r
toolus,toolind:integer;\r
osadki_ani:integer;\r
- sd,sav_fl:string;\r
+ sav_fl:string;\r
global_light:integer;\r
world_typ:integer;\r
float:image;\r
delay(del);\r
end;\r
\r
-procedure cleartextures;\r
- var\r
- no:image;\r
- ix,iy,iz:integer;\r
- begin\r
- bg[0]:=no;\r
- bg[1]:=no;\r
- float:=no;\r
- compas:=no;\r
- for ix:=0 to 7 do clock[ix]:=no;\r
-\r
- {for ix:=0 to maxBlockTex do\r
- begin\r
- tex[ix]:=no;\r
- tex8[ix]:=no;\r
- end;\r
- for ix:=0 to maxItemTex do\r
- begin\r
- item[ix]:=no;\r
- item8[ix]:=no;\r
- end;}\r
- for ix:=0 to 8 do back[ix]:=no;\r
-\r
- player.freeSkin;\r
-\r
- for ix:=0 to 34 do\r
- gui[ix]:=no;\r
-\r
- for ix:=0 to 9 do tue[ix]:=no;\r
-\r
- for ix:=0 to 7 do osad[0,ix]:=no;\r
- for ix:=0 to 7 do osad[1,ix]:=no;\r
-\r
- for ix:=0 to 15 do light[ix]:=no;\r
+procedure ClearTextures;\r
+ var\r
+ no : image;\r
+ ix, iy, iz : integer;\r
+ begin\r
+ bg[0] := no;\r
+ bg[1] := no;\r
+ float := no;\r
+ compas := no;\r
+ for ix := 0 to 7 do\r
+ clock[ix] := no;\r
+\r
+ for ix := 0 to maxBlockTex do\r
+ begin\r
+ tex[ix] := no;\r
+ tex8[ix] := no;\r
+ end;\r
+ for ix := 0 to maxItemTex do\r
+ begin\r
+ item[ix] := no;\r
+ item8[ix] := no;\r
+ end;\r
\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
- bubble:=no;\r
+ for ix := 0 to 8 do\r
+ back[ix]:=no;\r
\r
- for ix:=0 to 15 do\r
- pr_boom[ix]:=no;\r
+ player.freeSkin;\r
\r
- mob.freeSkin;\r
+ for ix := 0 to 34 do\r
+ gui[ix] := no;\r
+ for ix := 0 to 9 do\r
+ tue[ix] := no;\r
+ for ix := 0 to 7 do\r
+ osad[0, ix] := no;\r
+ for ix := 0 to 7 do\r
+ osad[1, ix] := no;\r
\r
- sky:=no;\r
+ for ix := 0 to 15 do\r
+ light[ix] := no;\r
\r
- sun:=no;\r
- moon:=no;\r
+ Particles.FreeTextures;\r
+ Mobs.FreeTextures;\r
\r
- sign_im:=no;\r
+ sky := no;\r
+ sun := no;\r
+ moon := no;\r
+ sign_im := no;\r
\r
- for ix:=0 to CONST_MAX_CURS do\r
- LoadCurImg(no, ix);\r
+ for ix := 0 to CONST_MAX_CURS do\r
+ LoadCurImg(no, ix);\r
\r
- //resetVirtualKeyboard(-1);\r
- end;\r
+ //resetVirtualKeyboard(-1);\r
+ end;\r
\r
procedure create_msg(s:string);\r
var\r
for ix:=0 to 8 do back[ix]:=rotate_image_from_image(im,ix*16,0,16,16,0);\r
end;\r
\r
- player.loadSkin('char_ani.png', path);\r
- mob.loadSkin(path);\r
+ console.exec('textures.cfg', 'AUTO');\r
+\r
+ Player.LoadSkin('char_ani.png', path);\r
+ Mobs.LoadTextures(path);\r
\r
im:=ld_tex('gui.png',path,'gui/');\r
gui[0]:=rotate_image_from_image(im,0,0,16,16,0);\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
- mob.resetData;\r
-\r
- //gb_up_pa:=0;\r
- reset_particles(max_particles+1);\r
+ Inv.ResetData;\r
+ Chest.ResetData;\r
+ Furnace.ResetData;\r
+ Drop.ResetData;\r
+ Mobs.ResetData;\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
- mob.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
+\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.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
- mob.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('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.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
rs:=openRecordStore('SD');\r
sd:=readRecordStoreEntry(rs,1);\r
closeRecordStore(rs);\r
- console.exec('autoexec.cfg', 'AUTO', true);\r
+ console.exec('autoexec.cfg', 'AUTO');\r
if sd='' then\r
begin\r
init_touch;\r
if m_cur=0 then begin\r
if cur_name>0 then\r
begin\r
+ debug("Select TexturePack @ /" + sd + "/cavecraft/texturepacks/" + names[cur_name]);\r
tex_pack:=names[cur_name];\r
LoadDrawFont('/'+sd+'/cavecraft/texturepacks/'+tex_pack+'/');\r
loadtexture('/'+sd+'/cavecraft/texturepacks/'+tex_pack+'/');\r
rs:=openRecordStore('TX');\r
t:=addRecordStoreEntry(rs,tex_pack);\r
closeRecordStore(rs);\r
+\r
+ LoadDrawFont('/'+sd+'/cavecraft/texturepacks/'+tex_pack+'/');\r
+ loadtexture('/'+sd+'/cavecraft/texturepacks/'+tex_pack+'/');\r
end;\r
else\r
begin\r
+ debug("Cancel Select TecturePack");\r
tex_pack:='';\r
loadtexture('/');\r
deleteRecordStore('TX');\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
- mob.draw(camx, camy);\r
+ Mobs.Draw(camx, camy);\r
{===================[draw_blocks]===================}\r
for ix:=minx to maxx do\r
for iy:=miny to maxy do\r
damg:=1;\r
\r
if posi=0 then\r
- i:=mob.findAndHit(damg, x-TILE_SIZE, y, TILE_SIZE+(w/2), h, -2, -3);\r
+ i:=Mobs.findAndHit(damg, x-TILE_SIZE, y, TILE_SIZE+(w/2), h, -2, -3);\r
else\r
- i:=mob.findAndHit(damg, x+(w/2), y, TILE_SIZE+(w/2), h, 2, -3);\r
+ i:=Mobs.findAndHit(damg, x+(w/2), y, TILE_SIZE+(w/2), h, 2, -3);\r
\r
if i<>-1 then\r
begin\r
var\r
i:integer;\r
begin\r
- player.calcPhysics;\r
- mob.updatePhy;\r
- drop.calcPhy;\r
+ Player.CalcPhysics;\r
+ Mobs.UpdatePhy;\r
+ Drop.CalcPhy;\r
end;\r
\r
procedure light_fillrect(l,x,y,r:integer);\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
\r
//if s_spawn_mob then if random(4096)=1547 then megaspawn;\r
\r
- mob.update;\r
-\r
- if particle_upd then update_particle;\r
+ Mobs.Update;\r
+ Particles.Update;\r
\r
if light_type>0 then\r
begin\r