diff --git a/src/CAVE.mpsrc b/src/CAVE.mpsrc
index 6de766ba1a2b5bb5536d231afc86dd059fc144ec..af345fdff2db525c4e5ca5a5aa1f44efbd8c4ba7 100644 (file)
--- a/src/CAVE.mpsrc
+++ b/src/CAVE.mpsrc
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
+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 15 do light[ix]:=no;\r
+ for ix := 0 to 8 do\r
+ back[ix]:=no;\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
+ player.freeSkin;\r
\r
- for ix:=0 to 15 do\r
- pr_boom[ix]:=no;\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
- mob.freeSkin;\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
- sky:=no;\r
+ bubble := no;\r
+ for ix := 0 to 15 do\r
+ pr_boom[ix] := no;\r
\r
- sun:=no;\r
- moon:=no;\r
+ mob.freeSkin;\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
+ console.exec('textures.cfg', 'AUTO');\r
+\r
player.loadSkin('char_ani.png', path);\r
mob.loadSkin(path);\r
\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
{===================[draw_blocks]===================}\r
for ix:=minx to maxx do\r
for iy:=miny to maxy do\r
- begin\r
- if getBlockFore(getmap(ix,iy))=true then\r
- draw_block(ix,iy);\r
+ begin\r
+ if getBlockFore(getmap(ix, iy)) then\r
+ draw_block(ix, iy);\r
\r
- setcolor(0,0,0);\r
- if (light_type=1) then begin if getmaplight(ix,iy)=0 then fillrect((ix*16)-camx,(iy*16)-camy,16,16); end;\r
- else\r
- if light_type=2 then begin if getmaplight(ix,iy)<15 then begin if (ix*16-camx<getWidth) and (ix*16-camx>0-16) and (iy*16-camy<getHeight) and (iy*16-camy>0-16) then drawimage(light[getmaplight(ix,iy)],(ix*16)-camx,(iy*16)-camy); end; end;\r
- end;\r
- if (toolus>0) and (toolind<10) and (getmap(curx,cury)>0) then begin if toolind>9 then toolind:=9; drawimage(tue[toolind],curx*16-camx,cury*16-camy); end;\r
+ setcolor(0, 0, 0);\r
+ if light_type = 1 then\r
+ begin\r
+ if getmaplight(ix,iy) = 0 then\r
+ fillrect((ix * 16) - camx, (iy * 16) - camy, 16, 16);\r
+ end;\r
+ else if light_type = 2 then\r
+ begin \r
+ if getmaplight(ix, iy) < 15 then\r
+ drawimage(light[getmaplight(ix, iy)], (ix * 16) - camx, (iy * 16) - camy);\r
+ end;\r
+ end;\r
+\r
+ // debug\r
+ // drawimage(light[getmaplight(player.getX div 16, player.getY div 16)], 0, 0);\r
+\r
+ if (toolus > 0) and (toolind < 10) and (getmap(curx,cury) > 0) then\r
+ begin\r
+ if toolind > 9 then\r
+ toolind:=9;\r
+ drawimage(tue[toolind], curx * 16 - camx, cury * 16 - camy);\r
+ end;\r
{===================[gui]===================}\r
if drawgui then\r
begin\r
\r
game_time:=game_time+(600000 div (fps_t*1000));\r
\r
+// Ускорение игрового времени в 10 раз\r
+// game_time := game_time + (600000 div (fps_t*100));\r
+\r
if (game_time>600000) or (game_time<0) then\r
begin\r
game_time:=0;\r
load_moon('/'+sd+'/cavecraft/texturepacks/'+tex_pack+'/',moon_phase);\r
end;\r
\r
- tim:=10000*getimagewidth(sky)/600000*game_time/10000;\r
- global_light:=effects.get(sky,tim,1,1) {and $F};\r
+ tim := 10000 * getimagewidth(sky) / 600000 * game_time / 10000;\r
+ global_light := effects.get(sky, tim, 1, 1) div 16;\r
\r
if clock_stage<>game_time div 75000 then begin clock_stage:=clock_stage+1; if clock_stage>7 then clock_stage:=0; end;\r
\r
menu;\r
end;\r
\r
+procedure draw_debug;\r
+ var\r
+ i : Integer;\r
+ begin\r
+ //drawfonttext('X:'+(x div 16-128),0,0);\r
+ //drawfonttext('Y:'+integertostring(127-(y div 16)),0,8);\r
+ drawfonttext('CURX:'+(curx-128),0,16);\r
+ drawfonttext('CURY:'+cury,0,24);\r
+ drawfonttext('UPDX:'+updx,0,32);\r
+ drawfonttext('UPDY:'+updy,0,40);\r
+ drawfonttext('FPS:'+fps,0,56);\r
+ drawfonttext('Free RAM:'+free_ram/1024+' KB',0,64);\r
+ drawfonttext('Total RAM:'+memory.get_totalmemory div 1024+' KB',0,72);\r
+ drawfonttext('SEED:'+seed,0,88);\r
+ drawfonttext('Game time:'+game_time,0,96);\r
+ drawfonttext('Global light:' + global_light, 0, 104);\r
+\r
+ for i := 0 to 15 do\r
+ drawImage(light[i], getWidth - 16, 16 * i);\r
+ end;\r
+\r
begin\r
qt_start;\r
hung_time:=getrelativetimems;\r
draw;\r
drawfonttext(version,getWidth-(length(version)*8),getHeight-8);\r
if getrelativetimems-msg_time[4]>500 then begin free_ram:=memory.get_freememory; if free_ram<0 then free_ram:=-free_ram; msg_time[4]:=getrelativetimems; end;\r
- if deb=true then\r
- begin\r
- //drawfonttext('X:'+(x div 16-128),0,0);\r
- //drawfonttext('Y:'+integertostring(127-(y div 16)),0,8);\r
- drawfonttext('CURX:'+(curx-128),0,16);\r
- drawfonttext('CURY:'+cury,0,24);\r
- drawfonttext('UPDX:'+updx,0,32);\r
- drawfonttext('UPDY:'+updy,0,40);\r
- drawfonttext('FPS:'+fps,0,56);\r
- drawfonttext('Free RAM:'+free_ram/1024+' KB',0,64);\r
- drawfonttext('Total RAM:'+memory.get_totalmemory div 1024+' KB',0,72);\r
- drawfonttext('SEED:'+seed,0,88);\r
- drawfonttext('Game time:'+game_time,0,96);\r
- end;\r
+ if deb = true then\r
+ draw_debug;\r
\r
drawVideo;\r
maxfps;\r