X-Git-Url: https://deadsoftware.ru/gitweb?p=cavecraft.git;a=blobdiff_plain;f=src%2FCAVE.mpsrc;h=e23b86557999db0064020d785f14b54745bd2a30;hp=6de766ba1a2b5bb5536d231afc86dd059fc144ec;hb=3564ef6fb4685bbecd05d027d91a9f7d81385b07;hpb=13a872abec65a21544bfa928624c6bf3975fd50f diff --git a/src/CAVE.mpsrc b/src/CAVE.mpsrc index 6de766b..e23b865 100644 --- a/src/CAVE.mpsrc +++ b/src/CAVE.mpsrc @@ -32,8 +32,7 @@ uses video; const - version = 'BETA 9'; - version_map = 9; + version_map = 9; var keymode,updx,updy:integer; @@ -2042,16 +2041,32 @@ procedure draw; {===================[draw_blocks]===================} for ix:=minx to maxx do for iy:=miny to maxy do - begin - if getBlockFore(getmap(ix,iy))=true then - draw_block(ix,iy); + begin + if getBlockFore(getmap(ix, iy)) then + draw_block(ix, iy); - setcolor(0,0,0); - if (light_type=1) then begin if getmaplight(ix,iy)=0 then fillrect((ix*16)-camx,(iy*16)-camy,16,16); end; - else - if light_type=2 then begin if getmaplight(ix,iy)<15 then begin if (ix*16-camx0-16) and (iy*16-camy0-16) then drawimage(light[getmaplight(ix,iy)],(ix*16)-camx,(iy*16)-camy); end; end; - end; - 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; + setcolor(0, 0, 0); + if light_type = 1 then + begin + if getmaplight(ix,iy) = 0 then + fillrect((ix * 16) - camx, (iy * 16) - camy, 16, 16); + end; + else if light_type = 2 then + begin + if getmaplight(ix, iy) < 15 then + drawimage(light[getmaplight(ix, iy)], (ix * 16) - camx, (iy * 16) - camy); + end; + end; + + // debug + // drawimage(light[getmaplight(player.getX div 16, player.getY div 16)], 0, 0); + + 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; {===================[gui]===================} if drawgui then begin @@ -2875,6 +2890,9 @@ procedure game; game_time:=game_time+(600000 div (fps_t*1000)); +// Ускорение игрового времени в 10 раз +// game_time := game_time + (600000 div (fps_t*100)); + if (game_time>600000) or (game_time<0) then begin game_time:=0; @@ -2883,8 +2901,8 @@ procedure game; load_moon('/'+sd+'/cavecraft/texturepacks/'+tex_pack+'/',moon_phase); end; - tim:=10000*getimagewidth(sky)/600000*game_time/10000; - global_light:=effects.get(sky,tim,1,1) {and $F}; + tim := 10000 * getimagewidth(sky) / 600000 * game_time / 10000; + global_light := effects.get(sky, tim, 1, 1) div 16; if clock_stage<>game_time div 75000 then begin clock_stage:=clock_stage+1; if clock_stage>7 then clock_stage:=0; end; @@ -3024,6 +3042,27 @@ procedure qt_start; menu; end; +procedure draw_debug; + var + i : Integer; + begin + //drawfonttext('X:'+(x div 16-128),0,0); + //drawfonttext('Y:'+integertostring(127-(y div 16)),0,8); + drawfonttext('CURX:'+(curx-128),0,16); + drawfonttext('CURY:'+cury,0,24); + drawfonttext('UPDX:'+updx,0,32); + drawfonttext('UPDY:'+updy,0,40); + drawfonttext('FPS:'+fps,0,56); + drawfonttext('Free RAM:'+free_ram/1024+' KB',0,64); + drawfonttext('Total RAM:'+memory.get_totalmemory div 1024+' KB',0,72); + drawfonttext('SEED:'+seed,0,88); + drawfonttext('Game time:'+game_time,0,96); + drawfonttext('Global light:' + global_light, 0, 104); + + for i := 0 to 15 do + drawImage(light[i], getWidth - 16, 16 * i); + end; + begin qt_start; hung_time:=getrelativetimems; @@ -3038,20 +3077,8 @@ begin draw; drawfonttext(version,getWidth-(length(version)*8),getHeight-8); 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; - if deb=true then - begin - //drawfonttext('X:'+(x div 16-128),0,0); - //drawfonttext('Y:'+integertostring(127-(y div 16)),0,8); - drawfonttext('CURX:'+(curx-128),0,16); - drawfonttext('CURY:'+cury,0,24); - drawfonttext('UPDX:'+updx,0,32); - drawfonttext('UPDY:'+updy,0,40); - drawfonttext('FPS:'+fps,0,56); - drawfonttext('Free RAM:'+free_ram/1024+' KB',0,64); - drawfonttext('Total RAM:'+memory.get_totalmemory div 1024+' KB',0,72); - drawfonttext('SEED:'+seed,0,88); - drawfonttext('Game time:'+game_time,0,96); - end; + if deb = true then + draw_debug; drawVideo; maxfps;