X-Git-Url: https://deadsoftware.ru/gitweb?p=cavecraft.git;a=blobdiff_plain;f=src%2Fconsole.pas;h=c6c2f69dd056e7db6d8f3cdbcb8f94be8a5093d2;hp=49b9435b2a561e9b72e8bfd2a6b3fe1eb16d77bd;hb=9115be0a19d5716f33a2e2cba76f3447ce0f4c2f;hpb=3564ef6fb4685bbecd05d027d91a9f7d81385b07 diff --git a/src/console.pas b/src/console.pas index 49b9435..c6c2f69 100644 --- a/src/console.pas +++ b/src/console.pas @@ -8,7 +8,6 @@ interface osadki:boolean; bl_upd:integer; s_get_drp:boolean; - particle_upd:boolean; drw_back:boolean; drw_sm:boolean; s_max_fps:integer; @@ -17,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; @@ -39,31 +36,49 @@ 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, + items, + 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); @@ -152,7 +167,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); @@ -177,7 +192,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)); @@ -445,7 +460,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); @@ -474,13 +489,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); @@ -537,12 +545,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 @@ -579,7 +581,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); @@ -593,9 +595,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 @@ -620,16 +619,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); + exec(nextWord, tmp); end; else if com='RESET_ITEMS' then @@ -741,7 +734,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; @@ -885,15 +880,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 @@ -931,7 +923,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; @@ -946,8 +937,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