X-Git-Url: https://deadsoftware.ru/gitweb?p=cavecraft.git;a=blobdiff_plain;f=src%2Fconsole.pas;h=99c78d037d2ec3a05c2889f7469befe5d4d439f2;hp=d6fb2f37431ba2a338b4a21739727ee181e79929;hb=4983aa70fea163453968255c36b0689cfb412463;hpb=1ef13d5bd0592dde48cc837e05b13e93e82db25b diff --git a/src/console.pas b/src/console.pas index d6fb2f3..99c78d0 100644 --- a/src/console.pas +++ b/src/console.pas @@ -2,12 +2,12 @@ unit console; interface const - version='BETA 8 FIX'; + version = 'BETA 9 DEV B12'; + var osadki:boolean; bl_upd:integer; s_get_drp:boolean; - particle_upd:boolean; drw_back:boolean; drw_sm:boolean; s_max_fps:integer; @@ -16,13 +16,11 @@ interface light_type:integer; ifosad:boolean; - //s_particles:boolean; - module load_sm:integer; load_sky_siz:integer; load_back_tex:boolean; load_weather_tex:boolean; - load_particles_tex:boolean; load_light_tex:boolean; load_gui_tex:boolean; @@ -38,31 +36,48 @@ interface sd:string; - //max_particles:integer; - module + EOFstr, ENDstr:boolean; procedure save_settings; procedure load_settings; procedure call_console; - procedure exec(s, search:string; acces:boolean); + procedure exec(s, search:string); procedure addToLog(str:string); implementation -uses keyboard,particles_store,vars,maps,items,canvas,mob,worldgen,jsr75i,particles,func, player,sensor, drop, inv, furnace, items_store, video; + + uses + keyboard, + vars, + maps, + canvas, + mobs, + worldgen, + jsr75i, + particles, + func, + player, + sensor, + drop, + inv, + furnace, + items_store, + video; + const CON_LOG_SIZE=9; PARSER_MAX_STR=15; MAX_IMGREG=2; + var logSTR: array [0..CON_LOG_SIZE] of string; lastCommand:string; parseStr:string; - EOFstr, ENDstr:boolean; stack: array [0..0] of integer; stack_pointer:integer; - autoexec_acces:boolean; regimg:image; procedure resetStack(size:integer); @@ -151,7 +166,7 @@ procedure save_settings; t:=addRecordStoreEntry(rs,version); t:=addRecordStoreEntry(rs,''+light_type); t:=addRecordStoreEntry(rs,''+ifosad); - t:=addRecordStoreEntry(rs,''+s_particles); + t:=addRecordStoreEntry(rs, '' + Particles.enabled); t:=addRecordStoreEntry(rs,''+drawgui); t:=addRecordStoreEntry(rs,''+s_jpeg_quality); t:=addRecordStoreEntry(rs,''+load_key_tex); @@ -176,7 +191,7 @@ procedure load_settings; end; light_type:=stringtointeger(readRecordStoreEntry(rs,2)); ifosad:=sett_ld_bool(readRecordStoreEntry(rs,3)); - s_particles:=sett_ld_bool(readRecordStoreEntry(rs,4)); + Particles.enabled := sett_ld_bool(readRecordStoreEntry(rs, 4)); drawgui:=sett_ld_bool(readRecordStoreEntry(rs,5)); s_jpeg_quality:=stringtointeger(readRecordStoreEntry(rs,6)); load_key_tex:=stringtointeger(readRecordStoreEntry(rs,7)); @@ -444,7 +459,7 @@ procedure exeCommand(str:string); com:=UpCase(nextWord); - if (cheats) or (autoexec_acces) or (gamemode=1) then + if (cheats) or (gamemode=1) then begin if com='TIME' then game_time:=decodeInt(nextWord); @@ -473,13 +488,6 @@ procedure exeCommand(str:string); fly:=false; end; else - {if com='KILL_MOBS' then - for i:=0 to 31 do - begin - mob[i].m_type:=0; - mob[i].m_hp:=0; - end; - else} if com='SPAWN' then begin player.setX(get_spawn_x*16+4); @@ -536,12 +544,6 @@ procedure exeCommand(str:string); if com='GET_DRP' then s_get_drp:=strToBool(nextWord); else - {if com='AI_UPD' then - ai_upd:=strToBool(nextWord); - else} - if com='PRT_UPD' then - particle_upd:=strToBool(nextWord); - else if com='MAX_FPS' then s_max_fps:=decodeInt(nextWord); else if com='DRW_BACK' then @@ -578,7 +580,7 @@ procedure exeCommand(str:string); light_type:=decodeInt(nextWord); else if com='S_PARTICLES' then - s_particles:=strToBool(nextWord); + Particles.enabled := strToBool(nextWord); else if com='LOAD_SKY' then load_sky_siz:=decodeInt(nextWord); @@ -592,9 +594,6 @@ procedure exeCommand(str:string); if com='LOAD_WEATHER_TEX' then load_weather_tex:=strToBool(nextWord); else - if com='LOAD_PARTICLES_TEX' then - load_particles_tex:=strToBool(nextWord); - else if com='LOAD_LIGHT_TEX' then load_light_tex:=strToBool(nextWord); else @@ -619,66 +618,10 @@ procedure exeCommand(str:string); if com='LOAD_MINIMAP_TEX' then load_minimap_tex:=strToBool(nextWord); else - if com='MAX_PARTICLES' then - begin - max_particles:=decodeInt(nextWord); - reset_particles(max_particles+1); - end; - else if com='EXEC' then begin tmp:=nextWord; - exec(nextWord, tmp, autoexec_acces); - end; - else - if com='RESET_ITEMS' then - begin - resetItems(decodeInt(nextWord)+1); - //addToLog('Max items: '+decodeInt(parsed_str[1])); - end; - else - if com='SET_ITEM' then - begin - setItemData(decodeInt(nextWord), - decodeInt(nextWord), - decodeInt(nextWord), - decodeInt(nextWord), - decodeInt(nextWord), - decodeInt(nextWord)); - end; - else - if com='RESET_BLOCKS' then - begin - resetBlocks(decodeInt(nextWord)+1); - //addToLog('Max blocks: '+decodeInt(parsed_str[1])); - end; - else - if com='SET_BLOCK' then - begin - setBlockData(decodeInt(nextWord), - decodeInt(nextWord), - decodeInt(nextWord), - decodeInt(nextWord), - decodeInt(nextWord), - decodeInt(nextWord), - decodeInt(nextWord), - decodeInt(nextWord), - decodeInt(nextWord)); - end; - else - if com='RESET_TOOLS' then - begin - resetTools(decodeInt(nextWord)+1); - //addToLog('Max tools: '+decodeInt(parsed_str[1])); - end; - else - if com='SET_TOOL' then - begin - setToolData(decodeInt(nextWord), - decodeInt(nextWord), - decodeInt(nextWord), - decodeInt(nextWord), - decodeInt(nextWord)); + exec(nextWord, tmp); end; else if com='RESET_FUELS' then @@ -740,7 +683,9 @@ procedure exeCommand(str:string); end; else if com='LOAD_TEX' then - regimg:=ld_tex(nextWord, '/'+sd+'/cavecraft/', ''); + begin + regimg:=ld_tex(nextWord, '/'+sd+'/cavecraft/texturepacks/'+tex_pack+'/', ''); + end; else if com='RESET_TEX' then resetTmpImg; @@ -763,13 +708,6 @@ procedure exeCommand(str:string); decodeInt(tmp2)); end; else - if com='SET_MAX_ITEM_LIST' then - setMaxItemList(decodeInt(nextWord)); - else - if com='SET_ITEM_LIST' then - setItemList(decodeInt(nextWord), - decodeInt(nextWord)); - else if com='BIND_KEY' then begin tmp:=nextWord; @@ -884,15 +822,12 @@ procedure call_console; forever; end; -procedure exec(s, search:string; acces:boolean); +procedure exec(s, search:string); var res:resource; str:string; - tmp_acces, tmpEOF:boolean; + tmpEOF : Boolean; begin - tmp_acces:=autoexec_acces; - autoexec_acces:=acces; - search:=UpCase(search); if search='LOCAL' then @@ -930,7 +865,6 @@ procedure exec(s, search:string; acces:boolean); else begin addToLog('Unknown load type "'+search+'", file "'+s+'" not executed!'); - autoexec_acces:=tmp_acces; exit; end; @@ -945,8 +879,9 @@ procedure exec(s, search:string; acces:boolean); else addToLog('Execute file "'+s+'" not found!'); + EOFstr := false; + ENDstr := false; CloseResource(res); - autoexec_acces:=tmp_acces; end; initialization