From 32a86d8fced9605a56fe77c006bfdeb5e9060750 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sun, 11 Apr 2010 13:04:53 +0000 Subject: [PATCH] m32: have default grid size in configuration git-svn-id: https://svn.eduke32.com/eduke32@1621 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/build.c | 2 +- polymer/eduke32/build/src/config.c | 14 ++++++++++++-- polymer/eduke32/source/astub.c | 15 ++------------- polymer/eduke32/source/mapster32.h | 2 +- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index f701b8f74..999fb60b8 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -112,7 +112,7 @@ extern int16_t searchsector, searchwall, searchstat; //search output int32_t osearchx, osearchy; //old search input extern int16_t pointhighlight, linehighlight, highlightcnt; -int32_t grid = 3, gridlock = 1, showtags = 1; +int32_t grid = 3, autogrid = 0, gridlock = 1, showtags = 1; int32_t zoom = 768, gettilezoom = 1; int32_t lastpm16time = 0; diff --git a/polymer/eduke32/build/src/config.c b/polymer/eduke32/build/src/config.c index be6ecdbdd..fd5e875e9 100644 --- a/polymer/eduke32/build/src/config.c +++ b/polymer/eduke32/build/src/config.c @@ -64,7 +64,8 @@ extern char keys[NUMBUILDKEYS]; extern char remap[256]; extern int32_t remapinit; extern double msens; -extern int32_t editorgridextent; +extern int32_t editorgridextent, grid, autogrid; +static int32_t default_grid=3; extern int32_t showheightindicators; extern int32_t graphicsmode; extern int32_t AmbienceToggle; @@ -139,6 +140,13 @@ int32_t loadsetup(const char *fn) if (readconfig(fp, "bpp", val, VL) > 0) bppgame = Batoi(val); if (readconfig(fp, "vsync", val, VL) > 0) vsync = Batoi(val)?1:0; if (readconfig(fp, "editorgridextent", val, VL) > 0) editorgridextent = max(min(524288,Batoi(val)),65536); + if (readconfig(fp, "grid", val, VL) > 0) + { + grid = Batoi(val); + default_grid = grid; + autogrid = (grid==9); + grid = min(max(0, grid), 8); + } #ifdef POLYMER if (readconfig(fp, "rendmode", val, VL) > 0) { i = Batoi(val); glrendmode = i; } #endif @@ -306,6 +314,8 @@ int32_t writesetup(const char *fn) #endif "; Grid limits\n" "editorgridextent = %d\n" + "; Startup grid size (0-8, 9 is automatic)\n" + "grid = %d\n" "\n" #if defined(POLYMOST) && defined(USE_OPENGL) "; OpenGL mode options\n" @@ -453,7 +463,7 @@ int32_t writesetup(const char *fn) #ifdef POLYMER glrendmode, #endif - editorgridextent, + editorgridextent, min(max(0, default_grid), 9), #if defined(POLYMOST) && defined(USE_OPENGL) usemodels, usehightile, glusetexcache, gltexfiltermode, glanisotropy, diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 1f083bf14..4bf7d7576 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -7733,8 +7733,6 @@ static void Keys2d(void) } { - static int32_t autogrid = 0; - if (keystatus[KEYSC_G]) // G (grid on/off) { if (autogrid) @@ -7749,17 +7747,8 @@ static void Keys2d(void) grid += eitherSHIFT?-1:1; if (grid == -1 || grid == 9) { - switch (grid) - { - case -1: - autogrid = 1; - grid = 8; - break; - case 9: - autogrid = 1; - grid = 0; - break; - } + autogrid = 1; + grid = 0; } } if (autogrid) Bsprintf(tempbuf,"Grid size: 9 (autosize)"); diff --git a/polymer/eduke32/source/mapster32.h b/polymer/eduke32/source/mapster32.h index e4819739a..510c06ce1 100644 --- a/polymer/eduke32/source/mapster32.h +++ b/polymer/eduke32/source/mapster32.h @@ -106,7 +106,7 @@ void SetSLIMEPalette(); void SetWATERPalette(); void SetGAMEPalette(); -extern int32_t grid; +extern int32_t grid, autogrid; static void EditSpriteData(int16_t spritenum); static void EditWallData(int16_t wallnum);