From 84e5fcdad877f15f0796bb468509b27dd165b184 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sat, 5 May 2012 22:23:44 +0000 Subject: [PATCH] Accumulated trivia, mostly "the usual". Among other things, comment out very seldomly (or not at all) used sprite member macros: SV, ZV, RX, RY, CX, CY, CD, PL. git-svn-id: https://svn.eduke32.com/eduke32@2639 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/baselayer.h | 2 +- polymer/eduke32/build/src/polymost.c | 23 ++++--- polymer/eduke32/build/src/winlayer.c | 4 +- polymer/eduke32/source/game.c | 11 +++- polymer/eduke32/source/macros.h | 16 ++--- polymer/eduke32/source/osdcmds.c | 23 +------ polymer/eduke32/source/player.c | 74 ++++++++++++----------- polymer/eduke32/source/sector.c | 5 +- 8 files changed, 79 insertions(+), 79 deletions(-) diff --git a/polymer/eduke32/build/include/baselayer.h b/polymer/eduke32/build/include/baselayer.h index 358c406bc..ba6aaa098 100644 --- a/polymer/eduke32/build/include/baselayer.h +++ b/polymer/eduke32/build/include/baselayer.h @@ -165,7 +165,7 @@ extern double vid_gamma, vid_contrast, vid_brightness; #define GAMMA_CALC ((int32_t)(min(max((double)((vid_gamma-1.0)*10.0),0),15))) -int32_t switchrendermethod(int32_t,int32_t); // 0 = software, 1 = opengl | bool = reinit +//int32_t switchrendermethod(int32_t,int32_t); // 0 = software, 1 = opengl | bool = reinit int32_t wm_msgbox(char *name, char *fmt, ...) ATTRIBUTE((format(printf,2,3))); int32_t wm_ynbox(char *name, char *fmt, ...) ATTRIBUTE((format(printf,2,3))); diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index 2519abbb6..609517dee 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -663,16 +663,19 @@ void polymost_glreset() bglDeleteTextures(1,&pth->ofb->glpic); Bfree(pth->ofb); } + bglDeleteTextures(1,&pth->glpic); Bfree(pth); pth = next; } + gltexcachead[i] = NULL; } clearskins(); } - if (polymosttext) bglDeleteTextures(1,&polymosttext); + if (polymosttext) + bglDeleteTextures(1,&polymosttext); polymosttext=0; freevbos(); @@ -1690,11 +1693,11 @@ failure: return -1; } // --------------------------------------------------- JONOF'S COMPRESSED TEXTURE CACHE STUFF -static int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp *hicr, int32_t dameth, pthtyp *pth, int32_t doalloc, char effect) +static int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp *hicr, + int32_t dameth, pthtyp *pth, int32_t doalloc, char effect) { coltype *pic = NULL, *rpptr; int32_t j, x, y, xsiz=0, ysiz=0, tsizx, tsizy; - int32_t r, g, b; char *picfil = NULL, *fn, hasalpha = 255; int32_t picfillen, texfmt = GL_RGBA, intexfmt = GL_RGBA, filh; @@ -1744,6 +1747,8 @@ static int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicre } else { + int32_t r, g, b; + cachefil = -1; // the compressed version will be saved to disk if ((filh = kopen4load(fn, 0)) < 0) return -1; @@ -1819,7 +1824,7 @@ static int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicre for (y=0,j=0; y tsizx) //Copy left to right @@ -1867,6 +1873,7 @@ static int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicre if (ysiz > tsizy) //Copy top to bottom Bmemcpy(&pic[xsiz*tsizy],pic,(ysiz-tsizy)*xsiz<<2); } + if (!glinfo.bgra) { for (j=xsiz*ysiz-1; j>=0; j--) @@ -1875,6 +1882,7 @@ static int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicre } } else texfmt = GL_BGRA; + Bfree(picfil); picfil = 0; if (tsizx>>r_downsize <= tilesizx[dapic] || tsizy>>r_downsize <= tilesizy[dapic]) @@ -1884,7 +1892,8 @@ static int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicre intexfmt = (hasalpha == 255) ? GL_COMPRESSED_RGB_ARB : GL_COMPRESSED_RGBA_ARB; else if (hasalpha == 255) intexfmt = GL_RGB; - if ((doalloc&3)==1) bglGenTextures(1,(GLuint *)&pth->glpic); //# of textures (make OpenGL allocate structure) + if ((doalloc&3)==1) + bglGenTextures(1, &pth->glpic); //# of textures (make OpenGL allocate structure) bglBindTexture(GL_TEXTURE_2D,pth->glpic); fixtransparency(pic,tsizx,tsizy,xsiz,ysiz,dameth); @@ -1903,8 +1912,8 @@ static int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicre pth->scaley = ((float)tsizy) / ((float)tilesizy[dapic]); } - if (gltexfiltermode < 0) gltexfiltermode = 0; - else if (gltexfiltermode >= (int32_t)numglfiltermodes) gltexfiltermode = numglfiltermodes-1; + gltexfiltermode = clamp(gltexfiltermode, 0, numglfiltermodes-1); + bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,glfiltermodes[gltexfiltermode].mag); bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,glfiltermodes[gltexfiltermode].min); diff --git a/polymer/eduke32/build/src/winlayer.c b/polymer/eduke32/build/src/winlayer.c index 7161a2557..d3cce8207 100644 --- a/polymer/eduke32/build/src/winlayer.c +++ b/polymer/eduke32/build/src/winlayer.c @@ -2624,7 +2624,9 @@ static int32_t SetupDirectDraw(int32_t width, int32_t height) // initprintf(" - Creating palette\n"); for (i=0; i<256; i++) curpalettefaded[i].f = PC_NOCOLLAPSE; - result = IDirectDraw_CreatePalette(lpDD, DDPCAPS_8BIT | DDPCAPS_ALLOW256, (LPPALETTEENTRY)curpalettefaded, &lpDDPalette, NULL); + + result = IDirectDraw_CreatePalette(lpDD, DDPCAPS_8BIT | DDPCAPS_ALLOW256, + (LPPALETTEENTRY)curpalettefaded, &lpDDPalette, NULL); if (result != DD_OK) { ShowDDrawErrorBox("Failure creating palette", result); diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index d4e8aac2d..341322ca3 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -2766,7 +2766,10 @@ void G_DisplayRest(int32_t smoothratio) } G_UpdateScreenArea(); } - if (tempTint.f > 0 || applyTint) G_FadePalette(tempTint.r,tempTint.g,tempTint.b,tempTint.f|128); + + if (tempTint.f > 0 || applyTint) + G_FadePalette(tempTint.r,tempTint.g,tempTint.b,tempTint.f|128); + return; } @@ -3050,9 +3053,11 @@ void G_DisplayRest(int32_t smoothratio) gametext(160,70,"Press F1 to Accept, F2 to Decline",0,2+8+16); } - if (BUTTON(gamefunc_Show_DukeMatch_Scores)) G_ShowScores(); + if (BUTTON(gamefunc_Show_DukeMatch_Scores)) + G_ShowScores(); - if (g_Debug) G_ShowCacheLocks(); + if (g_Debug) + G_ShowCacheLocks(); if (VOLUMEONE) { diff --git a/polymer/eduke32/source/macros.h b/polymer/eduke32/source/macros.h index 623f2876e..7b1bfd711 100644 --- a/polymer/eduke32/source/macros.h +++ b/polymer/eduke32/source/macros.h @@ -181,17 +181,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define SS sprite[i].shade #define PN sprite[i].picnum #define SA sprite[i].ang -#define SV sprite[i].xvel -#define ZV sprite[i].zvel -#define RX sprite[i].xrepeat -#define RY sprite[i].yrepeat +//#define SV sprite[i].xvel +//#define ZV sprite[i].zvel +//#define RX sprite[i].xrepeat +//#define RY sprite[i].yrepeat #define OW sprite[i].owner #define CS sprite[i].cstat #define SH sprite[i].extra -#define CX sprite[i].xoffset -#define CY sprite[i].yoffset -#define CD sprite[i].clipdist -#define PL sprite[i].pal +//#define CX sprite[i].xoffset +//#define CY sprite[i].yoffset +//#define CD sprite[i].clipdist +//#define PL sprite[i].pal #define SLT sprite[i].lotag #define SHT sprite[i].hitag #define SECT sprite[i].sectnum diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index 5df8380d8..392410d15 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -623,21 +623,6 @@ static int32_t osdcmd_crosshaircolor(const osdfuncparm_t *parm) return OSDCMD_OK; } -/* -static int32_t osdcmd_setbrightness(const osdfuncparm_t *parm) -{ - if (parm->numparms != 1) - { -// OSD_Printf("\"setbri\" \"%d\"\n",ud.brightness>>2); - return OSDCMD_SHOWHELP; - } - ud.brightness = Batoi(parm->parms[0])<<2; - setbrightness(ud.brightness>>2,&g_player[screenpeek].ps->palette[0],0); - OSD_Printf("setbrightness %d\n",ud.brightness>>2); - return OSDCMD_OK; -} -*/ - static int32_t osdcmd_give(const osdfuncparm_t *parm) { int32_t i; @@ -1304,13 +1289,7 @@ static int32_t osdcmd_cvar_set_game(const osdfuncparm_t *parm) return r; } - else if (!Bstrcasecmp(parm->name, "vid_brightness")) - { - setbrightness(ud.brightness>>2,g_player[myconnectindex].ps->palette,0); - - return r; - } - else if (!Bstrcasecmp(parm->name, "vid_contrast")) + else if (!Bstrcasecmp(parm->name, "vid_brightness") || !Bstrcasecmp(parm->name, "vid_contrast")) { setbrightness(ud.brightness>>2,g_player[myconnectindex].ps->palette,0); diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index 76a01b8d5..491ae0c57 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -1940,9 +1940,11 @@ static void P_DisplaySpit(int32_t snum) { int32_t i, a, x, y, z; - if (g_player[snum].ps->loogcnt == 0) return; + if (g_player[snum].ps->loogcnt == 0) + return; y = (g_player[snum].ps->loogcnt<<2); + for (i=0; inumloogs; i++) { a = klabs(sintable[((g_player[snum].ps->loogcnt+i)<<5)&2047])>>5; @@ -1981,11 +1983,9 @@ static int32_t P_DisplayFist(int32_t gs,int32_t snum) looking_arc = klabs(g_player[snum].ps->look_ang)/9; - fistzoom = 65536L - (sintable[(512+(fisti<<6))&2047]<<2); - if (fistzoom > 90612L) - fistzoom = 90612L; - if (fistzoom < 40920) - fistzoom = 40290; + fistzoom = 65536 - (sintable[(512+(fisti<<6))&2047]<<2); + fistzoom = clamp(fistzoom, 40920, 90612); + fistz = 194 + (sintable[((6+fisti)<<7)&2047]>>9); fistpal = get_hud_pal(g_player[snum].ps); @@ -2259,7 +2259,13 @@ static int32_t P_DisplayTip(int32_t gs,int32_t snum) static int32_t P_DisplayAccess(int32_t gs,int32_t snum) { - static int16_t access_y[] = {0,-8,-16,-32,-64,-84,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-96,-72,-64,-32,-16}; + static const int16_t access_y[] = { + 0,-8,-16,-32,-64, + -84,-108,-108,-108,-108, + -108,-108,-108,-108,-108, + -108,-96,-72,-64,-32,-16 + }; + int32_t looking_arc, p = 0; if (g_player[snum].ps->access_incs == 0 || sprite[g_player[snum].ps->i].extra <= 0) return 0; @@ -2831,38 +2837,36 @@ void P_DisplayWeapon(int32_t snum) pal = get_hud_pal(p); + if ((*kb) < aplWeaponTotalTime[p->curr_weapon][snum] && (*kb) > 0) { - if ((*kb) < aplWeaponTotalTime[p->curr_weapon][snum] && (*kb) > 0) + if (sprite[p->i].pal != 1) { - if (sprite[p->i].pal != 1) - { - weapon_xoffset += rand()&3; - gun_pos += (rand()&3); - } - - guniqhudid = cw<<1; - G_DrawWeaponTile(weapon_xoffset+184-(p->look_ang>>1), - looking_arc+240-gun_pos,SHRINKER+3+((*kb)&3),-32, - o,2,1); - - guniqhudid = cw; - G_DrawWeaponTile(weapon_xoffset+188-(p->look_ang>>1), - looking_arc+240-gun_pos,SHRINKER-1,gs,o,pal,0); - guniqhudid = 0; + weapon_xoffset += rand()&3; + gun_pos += (rand()&3); } - else - { - guniqhudid = cw<<1; - G_DrawWeaponTile(weapon_xoffset+184-(p->look_ang>>1), - looking_arc+240-gun_pos,SHRINKER+2, - 16-(sintable[p->random_club_frame&2047]>>10), - o,2,1); - guniqhudid = cw; - G_DrawWeaponTile(weapon_xoffset+188-(p->look_ang>>1), - looking_arc+240-gun_pos,SHRINKER-2,gs,o,pal,0); - guniqhudid = 0; - } + guniqhudid = cw<<1; + G_DrawWeaponTile(weapon_xoffset+184-(p->look_ang>>1), + looking_arc+240-gun_pos,SHRINKER+3+((*kb)&3),-32, + o,2,1); + + guniqhudid = cw; + G_DrawWeaponTile(weapon_xoffset+188-(p->look_ang>>1), + looking_arc+240-gun_pos,SHRINKER-1,gs,o,pal,0); + guniqhudid = 0; + } + else + { + guniqhudid = cw<<1; + G_DrawWeaponTile(weapon_xoffset+184-(p->look_ang>>1), + looking_arc+240-gun_pos,SHRINKER+2, + 16-(sintable[p->random_club_frame&2047]>>10), + o,2,1); + + guniqhudid = cw; + G_DrawWeaponTile(weapon_xoffset+188-(p->look_ang>>1), + looking_arc+240-gun_pos,SHRINKER-2,gs,o,pal,0); + guniqhudid = 0; } } break; diff --git a/polymer/eduke32/source/sector.c b/polymer/eduke32/source/sector.c index f2a598aa2..0cb743ef7 100644 --- a/polymer/eduke32/source/sector.c +++ b/polymer/eduke32/source/sector.c @@ -2391,7 +2391,8 @@ void A_DamageObject(int32_t i,int32_t sn) changespritestat(i, STAT_ACTOR); actor[i].timetosleep = SLEEPTIME; } - if ((RX < 24 || PN == SHARK) && sprite[sn].picnum == SHRINKSPARK) return; + if ((sprite[i].xrepeat < 24 || PN == SHARK) && sprite[sn].picnum == SHRINKSPARK) + return; } if (sprite[i].statnum != STAT_ZOMBIEACTOR) @@ -2427,7 +2428,7 @@ void A_DamageObject(int32_t i,int32_t sn) } } - if (RX < 24 && sprite[sn].picnum == SHRINKSPARK) + if (sprite[i].xrepeat < 24 && sprite[sn].picnum == SHRINKSPARK) return; if (sprite[actor[i].owner].picnum != APLAYER)