X-Git-Url: https://deadsoftware.ru/gitweb?p=cavecraft.git;a=blobdiff_plain;f=src%2FCAVE.mpsrc;h=af345fdff2db525c4e5ca5a5aa1f44efbd8c4ba7;hp=6de766ba1a2b5bb5536d231afc86dd059fc144ec;hb=e1395893ec7223a8a86c66cdc49e4a9fb48b15c2;hpb=13a872abec65a21544bfa928624c6bf3975fd50f diff --git a/src/CAVE.mpsrc b/src/CAVE.mpsrc index 6de766b..af345fd 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; @@ -54,7 +53,7 @@ var moon_phase:integer; toolus,toolind:integer; osadki_ani:integer; - sd,sav_fl:string; + sav_fl:string; global_light:integer; world_typ:integer; float:image; @@ -108,68 +107,70 @@ procedure maxfps; delay(del); end; -procedure cleartextures; - var - no:image; - ix,iy,iz:integer; - begin - bg[0]:=no; - bg[1]:=no; - float:=no; - compas:=no; - for ix:=0 to 7 do clock[ix]:=no; - - {for ix:=0 to maxBlockTex do - begin - tex[ix]:=no; - tex8[ix]:=no; - end; - for ix:=0 to maxItemTex do - begin - item[ix]:=no; - item8[ix]:=no; - end;} - for ix:=0 to 8 do back[ix]:=no; - - player.freeSkin; - - for ix:=0 to 34 do - gui[ix]:=no; - - for ix:=0 to 9 do tue[ix]:=no; - - for ix:=0 to 7 do osad[0,ix]:=no; - for ix:=0 to 7 do osad[1,ix]:=no; +procedure ClearTextures; + var + no : image; + ix, iy, iz : integer; + begin + bg[0] := no; + bg[1] := no; + float := no; + compas := no; + for ix := 0 to 7 do + clock[ix] := no; + + for ix := 0 to maxBlockTex do + begin + tex[ix] := no; + tex8[ix] := no; + end; + for ix := 0 to maxItemTex do + begin + item[ix] := no; + item8[ix] := no; + end; - for ix:=0 to 15 do light[ix]:=no; + for ix := 0 to 8 do + back[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; + player.freeSkin; - for ix:=0 to 15 do - pr_boom[ix]:=no; + for ix := 0 to 34 do + gui[ix] := no; + for ix := 0 to 9 do + tue[ix] := no; + for ix := 0 to 7 do + osad[0, ix] := no; + for ix := 0 to 7 do + osad[1, ix] := no; - mob.freeSkin; + 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; - sky:=no; + bubble := no; + for ix := 0 to 15 do + pr_boom[ix] := no; - sun:=no; - moon:=no; + mob.freeSkin; - sign_im:=no; + sky := no; + sun := no; + moon := no; + sign_im := no; - for ix:=0 to CONST_MAX_CURS do - LoadCurImg(no, ix); + for ix := 0 to CONST_MAX_CURS do + LoadCurImg(no, ix); - //resetVirtualKeyboard(-1); - end; + //resetVirtualKeyboard(-1); + end; procedure create_msg(s:string); var @@ -205,6 +206,8 @@ procedure loadtexture(path:string); for ix:=0 to 8 do back[ix]:=rotate_image_from_image(im,ix*16,0,16,16,0); end; + console.exec('textures.cfg', 'AUTO'); + player.loadSkin('char_ani.png', path); mob.loadSkin(path); @@ -1039,7 +1042,7 @@ procedure start_uu; rs:=openRecordStore('SD'); sd:=readRecordStoreEntry(rs,1); closeRecordStore(rs); - console.exec('autoexec.cfg', 'AUTO', true); + console.exec('autoexec.cfg', 'AUTO'); if sd='' then begin init_touch; @@ -1395,6 +1398,7 @@ procedure menu_tex; if m_cur=0 then begin if cur_name>0 then begin + debug("Select TexturePack @ /" + sd + "/cavecraft/texturepacks/" + names[cur_name]); tex_pack:=names[cur_name]; LoadDrawFont('/'+sd+'/cavecraft/texturepacks/'+tex_pack+'/'); loadtexture('/'+sd+'/cavecraft/texturepacks/'+tex_pack+'/'); @@ -1402,9 +1406,13 @@ procedure menu_tex; rs:=openRecordStore('TX'); t:=addRecordStoreEntry(rs,tex_pack); closeRecordStore(rs); + + LoadDrawFont('/'+sd+'/cavecraft/texturepacks/'+tex_pack+'/'); + loadtexture('/'+sd+'/cavecraft/texturepacks/'+tex_pack+'/'); end; else begin + debug("Cancel Select TecturePack"); tex_pack:=''; loadtexture('/'); deleteRecordStore('TX'); @@ -2042,16 +2050,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 +2899,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 +2910,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 +3051,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 +3086,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;