From: DeaDDooMER Date: Wed, 8 Mar 2017 18:16:33 +0000 (+0300) Subject: Fix sunshine X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=813fcf6956eb4e583f687aa77eba1ef4a9b4a1f1;p=cavecraft.git Fix sunshine --- diff --git a/BUGS b/BUGS index e563f53..932bedc 100644 --- a/BUGS +++ b/BUGS @@ -6,7 +6,7 @@ Мобы не дохнут от солнечного света Убогая текстура дождя Медленное обновление падающих блоков -Какая-то фигня со светом на старте игры ++ Какая-то фигня со светом на старте игры + У кого-то почему-то не масштабируется экран От падения с высоты нет урона Под водой скорость разлома блоков не уменьшается diff --git a/res/terrain/sky.png b/res/terrain/sky.png index 885e4e2..9b2cc13 100644 Binary files a/res/terrain/sky.png and b/res/terrain/sky.png differ diff --git a/src/CAVE.mpsrc b/src/CAVE.mpsrc index 6de766b..cbaf096 100644 --- a/src/CAVE.mpsrc +++ b/src/CAVE.mpsrc @@ -2042,16 +2042,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 @@ -2873,7 +2889,10 @@ procedure game; drop.reflux; player.getDrop; - game_time:=game_time+(600000 div (fps_t*1000)); +// 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 @@ -2883,8 +2902,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 +3043,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 +3078,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;