diff --git a/config/defaults.cfg b/config/defaults.cfg index cb018121..2dd8765e 100644 --- a/config/defaults.cfg +++ b/config/defaults.cfg @@ -12,3 +12,23 @@ setfont default // Choose your font gfxqualityalias = 3 // Default GFX is medium. soundqualityalias = 3 // Default sound is best. menuBotGameLength = 15 + + +// executed at first run, don't change + +const delayed_firstrun [ + music "pingpong/Ping_Pong_-_Kamikadze.ogg" 89000 [ ] // 90 secs, fade + + new_gfx_quality 3 + echo Welcome to AssaultCube + echo Developed by'Rabid Viper Productions' + echo [] + echo Use the below menu to change some necessary settings... + echo [] + echo Further help & information can be found in your README which is inside your AssaultCube directory. + showmenu [QUICK setup] +] + +mapstartonce = [ sleep 1000 delayed_firstrun ] + + diff --git a/config/firstrun.cfg b/config/firstrun.cfg deleted file mode 100644 index 66d87aca..00000000 --- a/config/firstrun.cfg +++ /dev/null @@ -1,20 +0,0 @@ -// executed at first run, don't change - -persistidents 0 - -const delayed_firstrun [ - music "pingpong/Ping_Pong_-_Kamikadze.ogg" 89000 [ ] // 90 secs, fade - - new_gfx_quality 3 - echo Welcome to AssaultCube - echo Developed by'Rabid Viper Productions' - echo [] - echo Use the below menu to change some necessary settings... - echo [] - echo Further help & information can be found in your README which is inside your AssaultCube directory. - showmenu [QUICK setup] -] - -sleep 1000 delayed_firstrun - -persistidents 1 diff --git a/config/menus_edit.cfg b/config/menus_edit.cfg index f61a3e93..e555bc23 100644 --- a/config/menus_edit.cfg +++ b/config/menus_edit.cfg @@ -490,16 +490,12 @@ menuitemslider "Blue pigment: " 1 255 "$bluew" 5 [] [ bluew = $arg1 ] menuitem "" -1 menuitem "\f2\t\t [ OK ]" [ watercolour $redw $greenw $bluew ] -showedBAKinfo = 0 - newmenu [Editing settings] menuitemslider "Grid/Selection style: " 0 1 "$oldselstyle" 1 [triangles "squares (default)"] [ oldselstyle $arg1 ] menuitemcheckbox "Show mapmodel clippings: " "$showmodelclipping" [ showmodelclipping $arg1 ] menuitemcheckbox "Show all playerstarts: " "$showplayerstarts" [ showplayerstarts $arg1 ] menuitemslider "Fly speeds multiplier: " 1 5 "$flyspeed" 1 [] [ flyspeed $arg1 ] -menuitemcheckbox "Enable auto save map: " "$autosavemap" [ autosavemap = $arg1 ] -menuitemslider "Time between auto saves (in minutes): " 2 60 "(div $timeBetAutoSaves 60000)" 1 [] [ timeBetAutoSaves = (* $arg1 60000) ] -menuitemtextinput "Make a map backup (.BAK) every: " "$numAutoSaveBackups" [ numAutoSaveBackups = $arg1 ] [ if (! $showedBAKinfo) [ echo This setting effects the number of autosavemaps between making a map backup file. "(.BAK)"; showedBAKinfo = 1 ] ] 4 +// opt/autosave.cfg may add some entries // deleted entities newmenu "deleted entities" diff --git a/config/menus_settings.cfg b/config/menus_settings.cfg index cea48d0f..481cd47b 100644 --- a/config/menus_settings.cfg +++ b/config/menus_settings.cfg @@ -474,7 +474,6 @@ menuitemslider [Screenshot type: ] 0 5 __getscreenshottype 1 $__screenshottypes menuitemslider [Console size: ] 0 20 "$consize" 1 [] [ consize $arg1 ] menuitemslider [Font type: ] 0 2 "$__fontsetting" 1 [Default Serif Monospace] [ if (= $arg1 1) [ setfont serif ] [ if (= $arg1 2) [ setfont mono ] [ setfont default ] ] ] menuitemslider [Mini-map background style: ] 0 2 "$showmapbackdrop" 1 ["Fully Transparent" Black White/Transparent] [ showmapbackdrop $arg1 ] -menuitemcheckbox [Enable compatibility with older cubescripts: ] "$compatibilitymode" [ compatibilitymode $arg1; echo (c 3) This setting requires a restart to take effect. ] menuitemslider [Menu map file sort order: ] 0 (- (listlen (listoptions menufilesortorders)) 1) "$menufilesort_cgz" 1 (listoptions menufilesortorders) [menufilesort_cgz = $arg1] menuitemslider [Menu demo file sort order: ] 0 (- (listlen (listoptions menufilesortorders)) 1) "$menufilesort_dmo" 1 (listoptions menufilesortorders) [menufilesort_dmo = $arg1] diff --git a/config/autosave.cfg b/config/opt/autosave.cfg similarity index 63% rename from config/autosave.cfg rename to config/opt/autosave.cfg index ac048475..651d31fe 100644 --- a/config/autosave.cfg +++ b/config/opt/autosave.cfg @@ -1,3 +1,6 @@ +// old autosave system (superseded by autosaved xmaps) +// (write "load_autosave" into your autoexec.cfg to load) + persistidents 0 checkinit mapstartalways [numAutoSaves = 0; autoSaveCheck] @@ -29,4 +32,12 @@ const doAutoSave [ autoSaveCheck ] +showedBAKinfo = 0 + +// amend settings menu +newmenu [Editing settings] +menuitemcheckbox "Enable auto save map: " "$autosavemap" [ autosavemap = $arg1 ] +menuitemslider "Time between auto saves (in minutes): " 2 60 "(div $timeBetAutoSaves 60000)" 1 [] [ timeBetAutoSaves = (* $arg1 60000) ] +menuitemtextinput "Make a map backup (.BAK) every: " "$numAutoSaveBackups" [ numAutoSaveBackups = $arg1 ] [ if (! $showedBAKinfo) [ echo This setting effects the number of autosavemaps between making a map backup file. "(.BAK)"; showedBAKinfo = 1 ] ] 4 + persistidents 1 diff --git a/config/compatibility.cfg b/config/opt/compatibility.cfg similarity index 90% rename from config/compatibility.cfg rename to config/opt/compatibility.cfg index 6295ad2e..96cffb74 100644 --- a/config/compatibility.cfg +++ b/config/opt/compatibility.cfg @@ -1,41 +1,42 @@ -// Makes old cubescripts compatible with newer versions of the game - -persistidents 0 - -const alive [ if (&& $numargs (isclient $arg1)) [ result (player $arg1 alive) ] [ result (player1 alive) ] ] -const currole [ if (&& $numargs (isclient $arg1)) [ result (player $arg1 role) ] [ result (player1 role) ] ] -const curmode [ result $gamemode ] -const getclientmode [ result $gamemode ] -const curteam [ if (&& $numargs (isclient $arg1)) [ result (player $arg1 team) ] [ result (player1 team) ] ] -const findpn [ if (isclient $arg1) [ result (player $arg1 name) ] [ result [] ] ] -const isSpect [ if (&& $numargs (isclient $arg1)) [ result (player $arg1 spect) ] [ result (player1 spect) ] ] - -const pstat_score [ - if (isclient $arg1) [ - result (concat (player $arg1 flags) (player $arg1 frags) (player $arg1 deaths) (player $arg1 points) (player $arg1 team) (player $arg1 tks) (player $arg1 name)) - ] [ result (concat [0 0 0 0 -1 0] (addpunct)) ] -] - -const orderscorecolumns [ - if (= $arg1 1) [ - sc_clientnum 0; - sc_name 1; - sc_flags 2; - sc_frags 3; - sc_deaths 4; - sc_score 5; - sc_lag 6; - sc_ratio -1; - ] [ - sc_flags 0; - sc_frags 1; - sc_deaths 2; - sc_ratio -1; - sc_score 4; - sc_lag 5; - sc_clientnum 6; - sc_name 7; - ] -] - -persistidents 1 +// Makes very old cubescripts compatible with newer versions of the game +// (write "load_compatibility" into your autoexec.cfg to load) + +persistidents 0 + +const alive [ if (&& $numargs (isclient $arg1)) [ result (player $arg1 alive) ] [ result (player1 alive) ] ] +const currole [ if (&& $numargs (isclient $arg1)) [ result (player $arg1 role) ] [ result (player1 role) ] ] +const curmode [ result $gamemode ] +const getclientmode [ result $gamemode ] +const curteam [ if (&& $numargs (isclient $arg1)) [ result (player $arg1 team) ] [ result (player1 team) ] ] +const findpn [ if (isclient $arg1) [ result (player $arg1 name) ] [ result [] ] ] +const isSpect [ if (&& $numargs (isclient $arg1)) [ result (player $arg1 spect) ] [ result (player1 spect) ] ] + +const pstat_score [ + if (isclient $arg1) [ + result (concat (player $arg1 flags) (player $arg1 frags) (player $arg1 deaths) (player $arg1 points) (player $arg1 team) (player $arg1 tks) (player $arg1 name)) + ] [ result (concat [0 0 0 0 -1 0] (addpunct)) ] +] + +const orderscorecolumns [ + if (= $arg1 1) [ + sc_clientnum 0; + sc_name 1; + sc_flags 2; + sc_frags 3; + sc_deaths 4; + sc_score 5; + sc_lag 6; + sc_ratio -1; + ] [ + sc_flags 0; + sc_frags 1; + sc_deaths 2; + sc_ratio -1; + sc_score 4; + sc_lag 5; + sc_clientnum 6; + sc_name 7; + ] +] + +persistidents 1 diff --git a/config/scripts.cfg b/config/scripts.cfg index a3d5f26a..fd660b1d 100644 --- a/config/scripts.cfg +++ b/config/scripts.cfg @@ -504,11 +504,10 @@ const applygamma [ addOnLoadAlways applygamma // get optional scripts on demand -tempalias load_survival [ run opt/survival ; alias load_survival [] ] +tempalias load_autosave [ run opt/autosave ; alias load_autosave [] ] +tempalias load_compatibility [ run opt/compatibility ; alias load_compatibility [] ] +tempalias load_survival [ load_compatibility ; run opt/survival ; alias load_survival [] ] tempalias load_parsestring [ run opt/parsestring ; alias load_parsestring [] ] tempalias load_faq [ run opt/faq ; alias load_faq [] ] -// Execute other .cfgs/scripts. -run autosave - persistidents 1 diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index cb83be29..4a4927f1 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -1162,14 +1162,6 @@ void startmap(const char *name, bool reset, bool norespawn) // called just aft loopv(gmdescs) if(gmdescs[i].mode == gamemode) conoutf("\f1%s", gmdescs[i].desc); } - // run once - if(firstrun) - { - per_idents = false; - execfile("config/firstrun.cfg"); - per_idents = true; - firstrun = false; - } // execute mapstart event once const char *mapstartonce = getalias("mapstartonce"); if(mapstartonce && mapstartonce[0]) diff --git a/source/src/main.cpp b/source/src/main.cpp index 3306dd19..6d6f3bfa 100644 --- a/source/src/main.cpp +++ b/source/src/main.cpp @@ -897,7 +897,7 @@ void checkinput() VARF(gamespeed, 10, 100, 1000, if(multiplayer()) gamespeed = 100); VARF(paused, 0, 0, 1, if(multiplayer()) paused = 0); -bool firstrun = false, inmainloop = false; +bool inmainloop = false; static int clockrealbase = 0, clockvirtbase = 0; static void clockreset() { clockrealbase = SDL_GetTicks(); clockvirtbase = totalmillis; } VARFP(clockerror, 990000, 1000000, 1010000, clockreset()); @@ -1064,8 +1064,6 @@ void initclientlog() // rotate old logfiles and create new one DELETEP(bootclientlog); } -VARP(compatibilitymode, 0, 1, 1); // FIXME : find a better place to put this ? - int main(int argc, char **argv) { ASSERT((GMMASK__BOT ^ GMMASK__MP ^ GMMASK__TEAM ^ GMMASK__FFA ^ GMMASK__TEAMSPAWN ^ GMMASK__FFASPAWN) == GMMASK__ALL); @@ -1297,16 +1295,9 @@ int main(int argc, char **argv) if(!execfile("config/saved.cfg")) { exec("config/defaults.cfg"); - firstrun = true; } autostartscripts("_aftersaved_"); exechook(HOOK_SP_MP, "afterinit", ""); - if(compatibilitymode) - { - per_idents = false; - exec("config/compatibility.cfg"); // exec after saved.cfg to get "compatibilitymode", but before user scripts.. - per_idents = true; - } autostartscripts(""); // all remaining scripts execfile("config/autoexec.cfg"); execfile("config/auth.cfg"); diff --git a/source/src/protos.h b/source/src/protos.h index 109f1e9e..ccf8bf02 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -585,7 +585,7 @@ extern int colorbits, depthbits, stencilbits; extern void keyrepeat(bool on); extern bool interceptkey(int sym); -extern bool firstrun, inmainloop; +extern bool inmainloop; enum {