From aae60f64c24a298330ca4948b420e6e4fbe7ab06 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Mon, 17 Oct 2011 18:42:10 +0000 Subject: [PATCH] Eliminate all 'variable ... set but not used [-Wunused-but-set-variable]' warnings with GCC 4.6 except one in kplib.c git-svn-id: https://svn.eduke32.com/eduke32@2079 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/build.c | 33 ++++++++++++++++--------- polymer/eduke32/build/src/defs.c | 5 +++- polymer/eduke32/build/src/engine.c | 28 +++++++++++----------- polymer/eduke32/build/src/polymost.c | 36 +++++++++++++--------------- polymer/eduke32/source/astub.c | 4 ++-- polymer/eduke32/source/game.c | 8 +++---- polymer/eduke32/source/gamedef.c | 6 ++--- polymer/eduke32/source/m32def.c | 4 ++-- polymer/eduke32/source/premap.c | 4 ++-- polymer/eduke32/source/sdlmusic.c | 6 ++--- polymer/eduke32/source/sector.c | 4 +++- 11 files changed, 76 insertions(+), 62 deletions(-) diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index e4b185a4e..e597a2ac0 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -433,9 +433,17 @@ static void reset_default_mapstate(void) #endif } +#undef STARTUP_SETUP_WINDOW +#if defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2) +# define STARTUP_SETUP_WINDOW +#endif + int32_t app_main(int32_t argc, const char **argv) { - char quitflag, cmdsetup = 0; +#ifdef STARTUP_SETUP_WINDOW + char cmdsetup = 0; +#endif + char quitflag; int32_t i, j, k; pathsearchmode = 1; // unrestrict findfrompath so that full access to the filesystem can be had @@ -461,8 +469,11 @@ int32_t app_main(int32_t argc, const char **argv) { if (argv[i][0] == '-') { +#ifdef STARTUP_SETUP_WINDOW if (!Bstrcmp(argv[i], "-setup")) cmdsetup = 1; - else if (!Bstrcmp(argv[i], "-help") || !Bstrcmp(argv[i], "--help") || !Bstrcmp(argv[i], "-?")) + else +#endif + if (!Bstrcmp(argv[i], "-help") || !Bstrcmp(argv[i], "--help") || !Bstrcmp(argv[i], "-?")) { char *s = "Mapster32\n" @@ -470,11 +481,11 @@ int32_t app_main(int32_t argc, const char **argv) "Options:\n" "\t-grp\tUse an extra GRP or ZIP file.\n" "\t-g\tSame as above.\n" -#if defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2) +#ifdef STARTUP_SETUP_WINDOW "\t-setup\tDisplays the configuration dialogue box before entering the editor.\n" #endif ; -#if defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2) +#ifdef STARTUP_SETUP_WINDOW wm_msgbox("Mapster32","%s",s); #else puts(s); @@ -500,7 +511,7 @@ int32_t app_main(int32_t argc, const char **argv) //Bcanonicalisefilename(boardfilename,0); if ((i = ExtInit()) < 0) return -1; -#if defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2) +#ifdef STARTUP_SETUP_WINDOW if (i || forcesetup || cmdsetup) { extern int32_t startwin_run(void); @@ -2529,14 +2540,14 @@ void overheadeditor(void) const char *dabuffer; int32_t i, j, k, m=0, mousxplc, mousyplc, firstx=0, firsty=0, oposz, col; int32_t tempint, tempint1, tempint2; - int32_t startwall=0, endwall, dax, day, x1, y1, x2, y2, x3, y3, x4, y4; + int32_t startwall=0, endwall, dax, day, x1, y1, x2, y2, x3, y3; //, x4, y4; int32_t highlightx1, highlighty1, highlightx2, highlighty2; int16_t suckwall=0, sucksect, split=0, bad; int16_t splitsect=0, joinsector[2]; int16_t splitstartwall=0; int32_t mousx, mousy, bstatus; int32_t centerx, centery, circlerad; - int16_t circlepoints, circleang1, circleang2, circleangdir; + int16_t circlepoints, circleang1, circleang2; //, circleangdir; int32_t sectorhighlightx=0, sectorhighlighty=0; int16_t cursectorhighlight, sectorhighlightstat; walltype *wal; @@ -2745,8 +2756,8 @@ void overheadeditor(void) x3 = pos.x + divscale14(-halfxdim16,zoom); y3 = pos.y + divscale14(-(midydim16-4),zoom); - x4 = pos.x + divscale14(halfxdim16,zoom); - y4 = pos.y + divscale14(ydim16-(midydim16-4),zoom); +// x4 = pos.x + divscale14(halfxdim16,zoom); +// y4 = pos.y + divscale14(ydim16-(midydim16-4),zoom); if (newnumwalls >= 0) { @@ -5492,11 +5503,11 @@ end_join_sectors: circleang1 = getangle(x1-centerx,y1-centery); circleang2 = getangle(x2-centerx,y2-centery); - circleangdir = 1; +// circleangdir = 1; k = ((circleang2-circleang1)&2047); if (mulscale4(x3-x1,y2-y1) < mulscale4(x2-x1,y3-y1)) { - circleangdir = -1; +// circleangdir = -1; k = -((circleang1-circleang2)&2047); } diff --git a/polymer/eduke32/build/src/defs.c b/polymer/eduke32/build/src/defs.c index 2e6c8aa4e..7648015fb 100644 --- a/polymer/eduke32/build/src/defs.c +++ b/polymer/eduke32/build/src/defs.c @@ -1319,10 +1319,13 @@ static int32_t defsparser(scriptfile *script) // thin out the loaded model by throwing away unused frames if (models[lastmodelid]->mdnum==3 && ((md3model_t *)models[lastmodelid])->numframes <= 1024) { +#ifdef DEBUG_MODEL_MEM md3model_t *m = (md3model_t *)models[lastmodelid]; int32_t i, onumframes; onumframes = m->numframes; - i = md_thinoutmodel(lastmodelid, usedframebitmap); + i = +#endif + md_thinoutmodel(lastmodelid, usedframebitmap); #ifdef DEBUG_MODEL_MEM if (i>=0 && i=MAXTILES) { initprintf(OSD_ERROR "Map error: sprite #%d(%d,%d) with illegal picnum(%d). Map is corrupt!\n",i,sprite[i].x,sprite[i].y,sprite[i].picnum); - dq[dnum++] = i; +// dq[dnum++] = i; sprite[i].picnum = 0; } } @@ -8929,14 +8929,14 @@ int32_t loadboard(char *filename, char flags, int32_t *daposx, int32_t *daposy, #endif for (i=0; i>16); +// dasprclipmask = (cliptype>>16); k = 32; dir = 1; @@ -13206,7 +13206,7 @@ void setbasepaltable(uint8_t **thebasepaltable, uint8_t thebasepalcount) // void setbrightness(char dabrightness, uint8_t dapalid, char noapply) { - int32_t i, k, j, paldidchange=0; + int32_t i, j, paldidchange=0; uint8_t *dapal; // uint32_t lastbright = curbrightness; @@ -13226,7 +13226,7 @@ void setbrightness(char dabrightness, uint8_t dapalid, char noapply) if (setgamma()) j = curbrightness; else j = 0; - for (k=i=0; i<256; i++) + for (i=0; i<256; i++) { // save palette without any brightness adjustment curpalette[i].r = dapal[i*3+0] << 2; diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index 5cb2582ef..ea970c863 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -1341,7 +1341,6 @@ int32_t trytexcache(char *fn, int32_t len, int32_t dameth, char effect, texcache { int32_t offset = 0; - int32_t len = 0; int32_t i; i = hash_find(&h_texcache,cachefn); @@ -1351,10 +1350,7 @@ int32_t trytexcache(char *fn, int32_t len, int32_t dameth, char effect, texcache if (!t) i = -1; else - { - len = t->len; offset = t->offset; - } /*initprintf("%s %d got a match for %s offset %d\n",__FILE__, __LINE__, cachefn,offset);*/ } @@ -1953,13 +1949,13 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method) int32_t x, y, z, mini, maxi, tsizxm1 = 0, tsizym1 = 0, ltsizy = 0; int32_t xi, d0, u0, v0, d1, u1, v1, xmodnice = 0, ymulnice = 0; char dacol = 0, *palptr = NULL, *vidp, *vide; + char *walptr; #endif double ngdx = 0.0, ngdy = 0.0, ngdo = 0.0, ngux = 0.0, nguy = 0.0, nguo = 0.0; double ngvx = 0.0, ngvy = 0.0, ngvo = 0.0, dp, up, vp, du0 = 0.0, du1 = 0.0, dui, duj; double f, r, ox, oy, oz, ox2, oy2, oz2, dd[16], uu[16], vv[16], px[16], py[16], uoffs; int32_t i, j, k, nn, ix0, ix1, tsizx, tsizy; int32_t xx, yy, dorot; - char *walptr; #ifdef USE_OPENGL pthtyp *pth, *detailpth, *glowpth; int32_t texunits = GL_TEXTURE0_ARB; @@ -1999,7 +1995,9 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method) tsizx = tsizy = 1; method = 1; //Hack to update Z-buffer for invalid mirror textures } } +#ifdef OBSOLETE_RENDMODES walptr = (char *)waloff[globalpicnum]; +#endif j = 0; dorot = ((gchang != 1.0) || (gctang != 1.0)); if (dorot) @@ -3448,7 +3446,7 @@ static void polymost_drawalls(int32_t bunch) else //NOTE: code copied from ceiling code... lots of duplicated stuff :/ { //Skybox code for parallax ceiling! - double _xp0, _yp0, _xp1, _yp1, _oxp0, _oyp0, _t0, _t1, _nx0, _ny0, _nx1, _ny1; + double _xp0, _yp0, _xp1, _yp1, _oxp0, _oyp0, _t0, _t1; // _nx0, _ny0, _nx1, _ny1; double _ryp0, _ryp1, _x0, _x1, _cy0, _fy0, _cy1, _fy1, _ox0, _ox1; double nfy0, nfy1; int32_t skywalx[4] = {-512,512,512,-512}, skywaly[4] = {-512,-512,512,512}; @@ -3472,17 +3470,17 @@ static void polymost_drawalls(int32_t bunch) { if (_yp1 < SCISDIST) continue; _t0 = (SCISDIST-_yp0)/(_yp1-_yp0); _xp0 = (_xp1-_xp0)*_t0+_xp0; _yp0 = SCISDIST; - _nx0 = (skywalx[(i+1)&3]-skywalx[i&3])*_t0+skywalx[i&3]; - _ny0 = (skywaly[(i+1)&3]-skywaly[i&3])*_t0+skywaly[i&3]; +// _nx0 = (skywalx[(i+1)&3]-skywalx[i&3])*_t0+skywalx[i&3]; +// _ny0 = (skywaly[(i+1)&3]-skywaly[i&3])*_t0+skywaly[i&3]; } - else { _t0 = 0.f; _nx0 = skywalx[i&3]; _ny0 = skywaly[i&3]; } + else { _t0 = 0.f; /*_nx0 = skywalx[i&3]; _ny0 = skywaly[i&3];*/ } if (_yp1 < SCISDIST) { _t1 = (SCISDIST-_oyp0)/(_yp1-_oyp0); _xp1 = (_xp1-_oxp0)*_t1+_oxp0; _yp1 = SCISDIST; - _nx1 = (skywalx[(i+1)&3]-skywalx[i&3])*_t1+skywalx[i&3]; - _ny1 = (skywaly[(i+1)&3]-skywaly[i&3])*_t1+skywaly[i&3]; +// _nx1 = (skywalx[(i+1)&3]-skywalx[i&3])*_t1+skywalx[i&3]; +// _ny1 = (skywaly[(i+1)&3]-skywaly[i&3])*_t1+skywaly[i&3]; } - else { _t1 = 1.f; _nx1 = skywalx[(i+1)&3]; _ny1 = skywaly[(i+1)&3]; } + else { _t1 = 1.f; /*_nx1 = skywalx[(i+1)&3]; _ny1 = skywaly[(i+1)&3];*/ } _ryp0 = 1.f/_yp0; _ryp1 = 1.f/_yp1; @@ -3738,7 +3736,7 @@ static void polymost_drawalls(int32_t bunch) else { //Skybox code for parallax ceiling! - double _xp0, _yp0, _xp1, _yp1, _oxp0, _oyp0, _t0, _t1, _nx0, _ny0, _nx1, _ny1; + double _xp0, _yp0, _xp1, _yp1, _oxp0, _oyp0, _t0, _t1; // _nx0, _ny0, _nx1, _ny1; double _ryp0, _ryp1, _x0, _x1, _cy0, _fy0, _cy1, _fy1, _ox0, _ox1; double ncy0, ncy1; int32_t skywalx[4] = {-512,512,512,-512}, skywaly[4] = {-512,-512,512,512}; @@ -3762,17 +3760,17 @@ static void polymost_drawalls(int32_t bunch) { if (_yp1 < SCISDIST) continue; _t0 = (SCISDIST-_yp0)/(_yp1-_yp0); _xp0 = (_xp1-_xp0)*_t0+_xp0; _yp0 = SCISDIST; - _nx0 = (skywalx[(i+1)&3]-skywalx[i&3])*_t0+skywalx[i&3]; - _ny0 = (skywaly[(i+1)&3]-skywaly[i&3])*_t0+skywaly[i&3]; +// _nx0 = (skywalx[(i+1)&3]-skywalx[i&3])*_t0+skywalx[i&3]; +// _ny0 = (skywaly[(i+1)&3]-skywaly[i&3])*_t0+skywaly[i&3]; } - else { _t0 = 0.f; _nx0 = skywalx[i&3]; _ny0 = skywaly[i&3]; } + else { _t0 = 0.f; /*_nx0 = skywalx[i&3]; _ny0 = skywaly[i&3];*/ } if (_yp1 < SCISDIST) { _t1 = (SCISDIST-_oyp0)/(_yp1-_oyp0); _xp1 = (_xp1-_oxp0)*_t1+_oxp0; _yp1 = SCISDIST; - _nx1 = (skywalx[(i+1)&3]-skywalx[i&3])*_t1+skywalx[i&3]; - _ny1 = (skywaly[(i+1)&3]-skywaly[i&3])*_t1+skywaly[i&3]; +// _nx1 = (skywalx[(i+1)&3]-skywalx[i&3])*_t1+skywalx[i&3]; +// _ny1 = (skywaly[(i+1)&3]-skywaly[i&3])*_t1+skywaly[i&3]; } - else { _t1 = 1.f; _nx1 = skywalx[(i+1)&3]; _ny1 = skywaly[(i+1)&3]; } + else { _t1 = 1.f; /*_nx1 = skywalx[(i+1)&3]; _ny1 = skywaly[(i+1)&3];*/ } _ryp0 = 1.f/_yp0; _ryp1 = 1.f/_yp1; diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 31deabaf1..4af8f407f 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -2757,7 +2757,7 @@ static void ExtSE40Draw(int32_t spnum,int32_t x,int32_t y,int32_t z,int16_t a,in static int32_t tempsectorz[MAXSECTORS]; static int32_t tempsectorpicnum[MAXSECTORS]; - int32_t i=0,j=0,k=0; + int32_t j=0,k=0; int32_t floor1=0,floor2=0,ok=0,fofmode=0,draw_both=0; int32_t offx,offy,offz; @@ -2831,7 +2831,7 @@ static void ExtSE40Draw(int32_t spnum,int32_t x,int32_t y,int32_t z,int16_t a,in } } - i=floor1; +// i=floor1; offx=sprite[floor2].x-sprite[floor1].x; offy=sprite[floor2].y-sprite[floor1].y; offz=0; diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 5b3d36adb..9744066e4 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -10769,7 +10769,7 @@ static void G_DoOrderScreen(void) void G_BonusScreen(int32_t bonusonly) { - int32_t t, tinc,gfx_offset; + int32_t t, /*tinc,*/ gfx_offset; int32_t i, y,xfragtotal,yfragtotal; int32_t bonuscnt; int32_t clockpad = 2; @@ -10844,7 +10844,7 @@ void G_BonusScreen(int32_t bonusonly) KB_FlushKeyboardQueue(); totalclock = 0; - tinc = 0; +// tinc = 0; while (1) { clearview(0L); @@ -11105,7 +11105,7 @@ FRAGBONUS: G_FadePalette(0,0,0,63); // JBF 20031228 KB_FlushKeyboardQueue(); totalclock = 0; - tinc = 0; +// tinc = 0; bonuscnt = 0; S_StopMusic(); @@ -11228,7 +11228,7 @@ FRAGBONUS: fadepal(0,0,0, 63,0,-1); bonuscnt = 0; totalclock = 0; - tinc = 0; +// tinc = 0; playerbest = CONFIG_GetMapBestTime(MapInfo[ud.volume_number*MAXLEVELS+ud.last_level-1].filename); diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 88d8ac1ec..7c8a64190 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -1888,7 +1888,7 @@ static void C_Include(const char *confile) static int32_t C_ParseCommand(int32_t loop) { int32_t i, j=0, k=0, tw, otw; - char *temptextptr; +// char *temptextptr; intptr_t *tempscrptr = NULL; do @@ -1906,7 +1906,7 @@ static int32_t C_ParseCommand(int32_t loop) if (g_scriptDebug) C_ReportError(-1); - tempscrptr = NULL, temptextptr = NULL; + tempscrptr = NULL; // temptextptr = NULL; otw = g_lastKeyword; switch ((g_lastKeyword = tw = C_GetNextKeyword())) @@ -4253,7 +4253,7 @@ static int32_t C_ParseCommand(int32_t loop) bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); *g_scriptPtr++=0; // leave spot for 'default' location (null if none) - temptextptr=textptr; +// temptextptr=textptr; // probably does not allow nesting... j=C_CountCaseStatements(); diff --git a/polymer/eduke32/source/m32def.c b/polymer/eduke32/source/m32def.c index e53def277..3c62a4914 100644 --- a/polymer/eduke32/source/m32def.c +++ b/polymer/eduke32/source/m32def.c @@ -1610,7 +1610,7 @@ static int32_t C_CountCaseStatements() static int32_t C_ParseCommand(void) { int32_t i, j=0, k=0, done, tw; - const char *temptextptr; +// const char *temptextptr; instype *tempscrptr = NULL; if (g_numCompilerErrors >= ABORTERRCNT || (*textptr == '\0') || (*(textptr+1) == '\0')) @@ -2266,7 +2266,7 @@ static int32_t C_ParseCommand(void) cs.caseScriptPtr = g_scriptPtr; // the first case's pointer. *g_scriptPtr++ = -1; // leave spot for 'default' offset to cases' code (-1 if none) - temptextptr = textptr; +// temptextptr = textptr; // probably does not allow nesting... //AddLog("Counting Case Statements..."); j = C_CountCaseStatements(); diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index c4c82202e..4164e91e0 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -1562,7 +1562,7 @@ void G_NewGame(int32_t vn,int32_t ln,int32_t sk) static void resetpspritevars(char g) { - int16_t i, j, nexti,circ; + int16_t i, j, nexti; //circ; // int32_t firstx,firsty; spritetype *s; uint8_t aimmode[MAXPLAYERS],autoaim[MAXPLAYERS],weaponswitch[MAXPLAYERS]; @@ -1613,7 +1613,7 @@ static void resetpspritevars(char g) } g_numPlayerSprites = 0; - circ = 2048/ud.multimode; +// circ = 2048/ud.multimode; g_whichPalForPlayer = 9; j = 0; diff --git a/polymer/eduke32/source/sdlmusic.c b/polymer/eduke32/source/sdlmusic.c index c599f7c61..63b9c4af6 100644 --- a/polymer/eduke32/source/sdlmusic.c +++ b/polymer/eduke32/source/sdlmusic.c @@ -127,13 +127,15 @@ int32_t MUSIC_Init(int32_t SoundCard, int32_t Address) char *command = getenv("EDUKE32_MUSIC_CMD"); const SDL_version *linked = Mix_Linked_Version(); + UNREFERENCED_PARAMETER(SoundCard); + UNREFERENCED_PARAMETER(Address); + if (music_initialized) { setErrorMessage("Music system is already initialized."); return(MUSIC_Error); } // if - UNREFERENCED_PARAMETER(Address); if (SDL_VERSIONNUM(linked->major,linked->minor,linked->patch) < MIX_REQUIREDVERSION) { // reject running with SDL_Mixer versions older than what is stated in sdl_inc.h @@ -222,7 +224,6 @@ int32_t MUSIC_Init(int32_t SoundCard, int32_t Address) } */ #endif - SoundCard = 1; music_initialized = 1; return(MUSIC_Ok); @@ -254,7 +255,6 @@ fallback: Bfclose(fp); } - SoundCard = 1; music_initialized = 1; return(MUSIC_Ok); } // MUSIC_Init diff --git a/polymer/eduke32/source/sector.c b/polymer/eduke32/source/sector.c index c48f3f9dc..4efedc980 100644 --- a/polymer/eduke32/source/sector.c +++ b/polymer/eduke32/source/sector.c @@ -1962,18 +1962,20 @@ void A_DamageObject(int32_t i,int32_t sn) int16_t j; int32_t k, p, rpg=0; spritetype *s; - int32_t switchpicnum = PN; +// int32_t switchpicnum = PN; i &= (MAXSPRITES-1); if (A_CheckSpriteFlags(sn,SPRITE_PROJECTILE)) if (SpriteProjectile[sn].workslike & PROJECTILE_RPG) rpg = 1; +/* switchpicnum = PN; if ((PN > WATERFOUNTAIN)&&(PN < WATERFOUNTAIN+3)) { switchpicnum = WATERFOUNTAIN; } +*/ switch (DynamicTileMap[PN]) { case OCEANSPRITE1__STATIC: