From 4918ba6fdea80fbd5b82c01653ae483a5b1de559 Mon Sep 17 00:00:00 2001 From: terminx Date: Mon, 24 Jul 2006 02:47:47 +0000 Subject: [PATCH] Formatting fixes for build.c, config.c, engine.c and polymost.c plus some warning fixes from JonoF and some cfg file reading changes for the game git-svn-id: https://svn.eduke32.com/eduke32@248 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/src/build.c | 2 +- polymer/build/src/config.c | 2 +- polymer/build/src/engine.c | 42 +++--- polymer/build/src/polymost.c | 188 ++++++++++++------------- polymer/build/src/sdlayer.c | 18 +-- polymer/eduke32/source/_functio.h | 58 ++++++++ polymer/eduke32/source/config.c | 37 +++-- polymer/eduke32/source/function.h | 2 +- polymer/eduke32/source/game.c | 6 +- polymer/eduke32/source/jmact/animlib.h | 2 - 10 files changed, 215 insertions(+), 142 deletions(-) diff --git a/polymer/build/src/build.c b/polymer/build/src/build.c index 78a6144b7..edc0ccd7b 100644 --- a/polymer/build/src/build.c +++ b/polymer/build/src/build.c @@ -307,7 +307,7 @@ int app_main(int argc, char **argv) if ((i = ExtInit()) < 0) return -1; #if defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2) if (i || forcesetup || cmdsetup) { - if (quitevent || !startwin_run()) return -1; + if (quitevent || !startwin_run()) return -1; } #endif diff --git a/polymer/build/src/config.c b/polymer/build/src/config.c index 9d5950bf9..aa3f1cc26 100644 --- a/polymer/build/src/config.c +++ b/polymer/build/src/config.c @@ -304,7 +304,7 @@ int writesetup(const char *fn) forcesetup, fullscreen, xdim2d, ydim2d, xdimgame, ydimgame, bppgame, #if defined(POLYMOST) && defined(USE_OPENGL) - glusetexcache, glusetexcachecompression, gltexfiltermode, + glusetexcache, glusetexcachecompression, gltexfiltermode, #endif #ifdef RENDERTYPEWIN maxrefreshfreq, diff --git a/polymer/build/src/engine.c b/polymer/build/src/engine.c index 337d3faef..6825aad68 100644 --- a/polymer/build/src/engine.c +++ b/polymer/build/src/engine.c @@ -5460,23 +5460,23 @@ static void sighandler(int sig, const siginfo_t *info, void *ctx) static int preinitcalled = 0; int preinitengine(void) { - char *e; - if (initsystem()) exit(1); + char *e; + if (initsystem()) exit(1); - if ((e = Bgetenv("BUILD_NOP6")) != NULL) - if (!Bstrcasecmp(e, "TRUE")) { - Bprintf("Disabling P6 optimizations.\n"); - dommxoverlay = 0; - } - if (dommxoverlay) mmxoverlay(); + if ((e = Bgetenv("BUILD_NOP6")) != NULL) + if (!Bstrcasecmp(e, "TRUE")) { + Bprintf("Disabling P6 optimizations.\n"); + dommxoverlay = 0; + } + if (dommxoverlay) mmxoverlay(); - validmodecnt = 0; - getvalidmodes(); + validmodecnt = 0; + getvalidmodes(); - initcrc32table(); + initcrc32table(); - preinitcalled = 1; - return 0; + preinitcalled = 1; + return 0; } @@ -5494,11 +5494,11 @@ int initengine(void) sigact.sa_flags = SA_SIGINFO; sigaction(SIGFPE, &sigact, &oldact); #endif - if (!preinitcalled) { - i = preinitengine(); - if (i) return i; - } - + if (!preinitcalled) { + i = preinitengine(); + if (i) return i; + } + if (loadtables()) return 1; xyaspect = -1; @@ -5633,7 +5633,7 @@ void drawrooms(long daposx, long daposy, long daposz, short *shortptr1, *shortptr2; beforedrawrooms = 0; - indrawroomsandmasks = 1; + indrawroomsandmasks = 1; globalposx = daposx; globalposy = daposy; globalposz = daposz; globalang = (daang&2047); @@ -5679,7 +5679,7 @@ void drawrooms(long daposx, long daposy, long daposz, if (0) { polymer_drawrooms(); - return; + return; } #endif //============================================================================= //POLYMOST BEGINS @@ -6089,7 +6089,7 @@ killsprite: free(walldepths); #endif /* goodalpha */ - indrawroomsandmasks = 0; + indrawroomsandmasks = 0; enddrawing(); //}}} } diff --git a/polymer/build/src/polymost.c b/polymer/build/src/polymost.c index 72e50372a..9527d7d24 100644 --- a/polymer/build/src/polymost.c +++ b/polymer/build/src/polymost.c @@ -397,7 +397,7 @@ tryart: { if (pth->flags & 128) { - pth->flags &= ~128; + pth->flags &= ~128; if (gloadtile_art(dapicnum,dapalnum,dameth,pth,0)) return NULL; //reload tile (for animations) } return(pth); @@ -435,11 +435,11 @@ void gltexinvalidate (long dapicnum, long dapalnum, long dameth) j = (dapicnum&(GLTEXCACHEADSIZ-1)); for(pth=gltexcachead[j]; pth; pth=pth->next) if (pth->picnum == dapicnum && pth->palnum == dapalnum && (pth->flags & 1) == ((dameth&4)>>2) ) - { - pth->flags |= 128; - if (pth->flags & 16) - pth->ofb->flags |= 128; - } + { + pth->flags |= 128; + if (pth->flags & 16) + pth->ofb->flags |= 128; + } } //Make all textures "dirty" so they reload, but not re-allocate @@ -452,11 +452,11 @@ void gltexinvalidateall () for(j=GLTEXCACHEADSIZ-1;j>=0;j--) for(pth=gltexcachead[j];pth;pth=pth->next) - { + { pth->flags |= 128; - if (pth->flags & 16) - pth->ofb->flags |= 128; - } + if (pth->flags & 16) + pth->ofb->flags |= 128; + } clearskins(); #ifdef DEBUGGINGAIDS OSD_Printf("gltexinvalidateall()\n"); @@ -483,14 +483,14 @@ void gltexapplyprops (void) bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,glfiltermodes[gltexfiltermode].min); if (glinfo.maxanisotropy > 1.0) bglTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAX_ANISOTROPY_EXT,glanisotropy); - if (pth->flags & 16) - { - bglBindTexture(GL_TEXTURE_2D,pth->ofb->glpic); - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,glfiltermodes[gltexfiltermode].mag); - bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,glfiltermodes[gltexfiltermode].min); - if (glinfo.maxanisotropy > 1.0) - bglTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAX_ANISOTROPY_EXT,glanisotropy); - } + if (pth->flags & 16) + { + bglBindTexture(GL_TEXTURE_2D,pth->ofb->glpic); + bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,glfiltermodes[gltexfiltermode].mag); + bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,glfiltermodes[gltexfiltermode].min); + if (glinfo.maxanisotropy > 1.0) + bglTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAX_ANISOTROPY_EXT,glanisotropy); + } } } @@ -551,11 +551,11 @@ void polymost_glreset () for (i=GLTEXCACHEADSIZ-1; i>=0; i--) { for (pth=gltexcachead[i]; pth;) { next = pth->next; - if (pth->flags & 16) // fullbright textures - { - bglDeleteTextures(1,&pth->ofb->glpic); - free(pth->ofb); - } + if (pth->flags & 16) // fullbright textures + { + bglDeleteTextures(1,&pth->ofb->glpic); + free(pth->ofb); + } bglDeleteTextures(1,&pth->glpic); free(pth); pth = next; @@ -817,25 +817,25 @@ int gloadtile_art (long dapic, long dapal, long dameth, pthtyp *pth, long doallo { wpptr->r = wpptr->g = wpptr->b = wpptr->a = 0; continue; } if (x < tsizx) x2 = x; else x2 = x-tsizx; dacol = (long)(*(unsigned char *)(waloff[dapic]+x2*tsizy+y2)); - if (!fullbrightloadingpass) - { // regular texture - if ((dacol > 239) && (dacol != 255)) - hasfullbright = 1; - wpptr->a = 255; - } - else if (fullbrightloadingpass == 1) - { // texture with only fullbright areas - if (dacol < 240) { // regular colors - wpptr->a = 0; hasalpha = 1; - } else { // fullbright - wpptr->a = 255; - } - } - if (dacol != 255) - dacol = (long)((unsigned char)palookup[dapal][dacol]); - else { - wpptr->a = 0; hasalpha = 1; - } + if (!fullbrightloadingpass) + { // regular texture + if ((dacol > 239) && (dacol != 255)) + hasfullbright = 1; + wpptr->a = 255; + } + else if (fullbrightloadingpass == 1) + { // texture with only fullbright areas + if (dacol < 240) { // regular colors + wpptr->a = 0; hasalpha = 1; + } else { // fullbright + wpptr->a = 255; + } + } + if (dacol != 255) + dacol = (long)((unsigned char)palookup[dapal][dacol]); + else { + wpptr->a = 0; hasalpha = 1; + } if (gammabrightness) { wpptr->r = curpalette[dacol].r; wpptr->g = curpalette[dacol].g; @@ -885,16 +885,16 @@ int gloadtile_art (long dapic, long dapal, long dameth, pthtyp *pth, long doallo pth->flags = ((dameth&4)>>2) | (hasalpha<<3) | (hasfullbright<<4); pth->hicr = NULL; - if ((hasfullbright) && (!fullbrightloadingpass)) - { - // load the ONLY texture that'll be assembled with the regular one to make the final texture with fullbright pixels - fullbrightloadingpass = 1; - pth->ofb = (pthtyp *)calloc(1,sizeof(pthtyp)); - if (!pth->ofb) return 1; - if (gloadtile_art(dapic, dapal, dameth, pth->ofb, 1)) return 1; + if ((hasfullbright) && (!fullbrightloadingpass)) + { + // load the ONLY texture that'll be assembled with the regular one to make the final texture with fullbright pixels + fullbrightloadingpass = 1; + pth->ofb = (pthtyp *)calloc(1,sizeof(pthtyp)); + if (!pth->ofb) return 1; + if (gloadtile_art(dapic, dapal, dameth, pth->ofb, 1)) return 1; - fullbrightloadingpass = 0; - } + fullbrightloadingpass = 0; + } return 0; } @@ -1334,8 +1334,8 @@ void drawpoly (double *dpx, double *dpy, long n, long method) #ifdef USE_OPENGL pthtyp *pth; #endif - // backup of the n for possible redrawing of fullbright - long n_ = n, method_ = method; + // backup of the n for possible redrawing of fullbright + long n_ = n, method_ = method; if (method == -1) return; @@ -1420,14 +1420,14 @@ void drawpoly (double *dpx, double *dpy, long n, long method) if (skyclamphack) method |= 4; pth = gltexcache(globalpicnum,globalpal,method&(~3)); - if (pth->flags & 16) - if (indrawroomsandmasks) - { - if (!fullbrightdrawingpass) - fullbrightdrawingpass = 1; - else if (fullbrightdrawingpass == 2) - pth = pth->ofb; - } + if (pth->flags & 16) + if (indrawroomsandmasks) + { + if (!fullbrightdrawingpass) + fullbrightdrawingpass = 1; + else if (fullbrightdrawingpass == 2) + pth = pth->ofb; + } bglBindTexture(GL_TEXTURE_2D, pth ? pth->glpic : 0); @@ -1624,17 +1624,17 @@ void drawpoly (double *dpx, double *dpy, long n, long method) } bglEnd(); } - if (fullbrightdrawingpass == 1) // tile has fullbright colors ? - { - fullbrightdrawingpass = 2; - shadeforfullbrightpass = globalshade; // save the current shade - globalshade = -30; // fullbright - bglDisable(GL_FOG); // no fog - drawpoly(dpx, dpy, n_, method_); // draw them afterwards, then. :) - bglEnable(GL_FOG); - globalshade = shadeforfullbrightpass; - fullbrightdrawingpass = 0; - } + if (fullbrightdrawingpass == 1) // tile has fullbright colors ? + { + fullbrightdrawingpass = 2; + shadeforfullbrightpass = globalshade; // save the current shade + globalshade = -30; // fullbright + bglDisable(GL_FOG); // no fog + drawpoly(dpx, dpy, n_, method_); // draw them afterwards, then. :) + bglEnable(GL_FOG); + globalshade = shadeforfullbrightpass; + fullbrightdrawingpass = 0; + } return; } #endif @@ -2297,7 +2297,7 @@ static void polymost_drawalls (long bunch) bglFogfv(GL_FOG_COLOR,col); bglFogf(GL_FOG_DENSITY,gvisibility*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))); -// bglFogf(GL_FOG_DENSITY,gvisibility*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))); + // bglFogf(GL_FOG_DENSITY,gvisibility*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))); } } #endif @@ -2470,12 +2470,12 @@ static void polymost_drawalls (long bunch) #ifdef USE_OPENGL if (rendmode == 3) { -/* if (!nofog) { - bglDisable(GL_FOG); - //r = ((float)globalpisibility)*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))*FOGSCALE; - //r *= ((double)xdimscale*(double)viewingrange*gdo) / (65536.0*65536.0); - //bglFogf(GL_FOG_DENSITY,r); - } */ + /* if (!nofog) { + bglDisable(GL_FOG); + //r = ((float)globalpisibility)*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))*FOGSCALE; + //r *= ((double)xdimscale*(double)viewingrange*gdo) / (65536.0*65536.0); + //bglFogf(GL_FOG_DENSITY,r); + } */ if(!nofog) { @@ -2835,13 +2835,13 @@ static void polymost_drawalls (long bunch) #ifdef USE_OPENGL if (rendmode == 3) { -/* if (!nofog) { - bglDisable(GL_FOG); - //r = ((float)globalpisibility)*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))*FOGSCALE; - //r *= ((double)xdimscale*(double)viewingrange*gdo) / (65536.0*65536.0); - //bglFogf(GL_FOG_DENSITY,r); - } -*/ + /* if (!nofog) { + bglDisable(GL_FOG); + //r = ((float)globalpisibility)*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))*FOGSCALE; + //r *= ((double)xdimscale*(double)viewingrange*gdo) / (65536.0*65536.0); + //bglFogf(GL_FOG_DENSITY,r); + } + */ if(!nofog) { int i = klabs(sec->ceilingshade); @@ -2874,11 +2874,11 @@ static void polymost_drawalls (long bunch) if ((oy < cy0) && (oy < cy1)) domost(x1,oy,x0,oy); else if ((oy < cy0) != (oy < cy1)) { /* cy1 cy0 - // / \ - //oy---------- oy--------- - // / \ - // cy0 cy1 - */ + // / \ + //oy---------- oy--------- + // / \ + // cy0 cy1 + */ ox = (oy-cy0)*(x1-x0)/(cy1-cy0) + x0; if (oy < cy0) { domost(ox,oy,x0,oy); domost(x1,cy1,ox,oy); } else { domost(ox,oy,x0,cy0); domost(x1,oy,ox,oy); } @@ -3166,7 +3166,7 @@ static void polymost_drawalls (long bunch) bglFogf(GL_FOG_DENSITY,gvisibility/(wal->shade<0?(shadetable[i]-glnegshadeoffset)*glnegshadescale:1)*(wal->shade<0?1:shadetable[i]*glshadescale)*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))); } pow2xsplit = 1; domost(x1,ocy1,x0,ocy0); - if (wal->cstat&8) { gux = ogux; guy = oguy; guo = oguo; } + if (wal->cstat&8) { gux = ogux; guy = oguy; guo = oguo; } } if (((ofy0 < fy0) || (ofy1 < fy1)) && (!((sec->floorstat§or[nextsectnum].floorstat)&1))) { @@ -3207,7 +3207,7 @@ static void polymost_drawalls (long bunch) bglFogf(GL_FOG_DENSITY,gvisibility/(nwal->shade<0?(shadetable[i]-glnegshadeoffset)*glnegshadescale:1)*(nwal->shade<0?1:shadetable[i]*glshadescale)*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))); } pow2xsplit = 1; domost(x0,ofy0,x1,ofy1); - if (wal->cstat&(2+8)) { guo = oguo; gux = ogux; guy = oguy; } + if (wal->cstat&(2+8)) { guo = oguo; gux = ogux; guy = oguy; } } } @@ -4922,7 +4922,7 @@ static int osdcmd_polymostvars(const osdfuncparm_t *parm) Bstrcpy(value,parm->parms[0]); val = atof(value); glsprshadescale = val; - } + } return OSDCMD_OK; } else if (!Bstrcasecmp(parm->name, "r_negshadescale")) { diff --git a/polymer/build/src/sdlayer.c b/polymer/build/src/sdlayer.c index 988953893..7d619628a 100644 --- a/polymer/build/src/sdlayer.c +++ b/polymer/build/src/sdlayer.c @@ -339,7 +339,7 @@ int initinput(void) memset(keynames,0,sizeof(keynames)); for (i=0; i (unsigned)joynumaxes) return NULL; sprintf(tmp,"Axis %d",num); - return tmp; + return (unsigned char *)tmp; case 1: // button if ((unsigned)num > (unsigned)joynumbuttons) return NULL; sprintf(tmp,"Button %d",num); - return tmp; + return (unsigned char *)tmp; case 2: // hat if ((unsigned)num > (unsigned)joynumhats) return NULL; sprintf(tmp,"Hat %d",num); - return tmp; + return (unsigned char *)tmp; default: return NULL; @@ -931,7 +931,7 @@ int setvideomode(int x, int y, int c, int fs) #ifdef USE_OPENGL if (c > 8) { - GLubyte *p,*p2,*p3; + char *p,*p2,*p3; int i; polymost_glreset(); @@ -943,10 +943,10 @@ int setvideomode(int x, int y, int c, int fs) bglHint(GL_LINE_SMOOTH_HINT,GL_NICEST); bglDisable(GL_DITHER); - glinfo.vendor = bglGetString(GL_VENDOR); - glinfo.renderer = bglGetString(GL_RENDERER); - glinfo.version = bglGetString(GL_VERSION); - glinfo.extensions = bglGetString(GL_EXTENSIONS); + glinfo.vendor = (const char *)bglGetString(GL_VENDOR); + glinfo.renderer = (const char *)bglGetString(GL_RENDERER); + glinfo.version = (const char *)bglGetString(GL_VERSION); + glinfo.extensions = (const char *)bglGetString(GL_EXTENSIONS); glinfo.maxanisotropy = 1.0; glinfo.bgra = 0; diff --git a/polymer/eduke32/source/_functio.h b/polymer/eduke32/source/_functio.h index 6f4824f12..49073f4a2 100644 --- a/polymer/eduke32/source/_functio.h +++ b/polymer/eduke32/source/_functio.h @@ -94,6 +94,64 @@ char gamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN] = "Previous_Weapon", "Show_Console" }; + +char defaultgamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN] = + { + "Move_Forward", + "Move_Backward", + "Turn_Left", + "Turn_Right", + "Strafe", + "Fire", + "Open", + "Run", + "AutoRun", + "Jump", + "Crouch", + "Look_Up", + "Look_Down", + "Look_Left", + "Look_Right", + "Strafe_Left", + "Strafe_Right", + "Aim_Up", + "Aim_Down", + "Weapon_1", + "Weapon_2", + "Weapon_3", + "Weapon_4", + "Weapon_5", + "Weapon_6", + "Weapon_7", + "Weapon_8", + "Weapon_9", + "Weapon_10", + "Inventory", + "Inventory_Left", + "Inventory_Right", + "Holo_Duke", + "Jetpack", + "NightVision", + "MedKit", + "TurnAround", + "SendMessage", + "Map", + "Shrink_Screen", + "Enlarge_Screen", + "Center_View", + "Holster_Weapon", + "Show_Opponents_Weapon", + "Map_Follow_Mode", + "See_Coop_View", + "Mouse_Aiming", + "Toggle_Crosshair", + "Steroids", + "Quick_Kick", + "Next_Weapon", + "Previous_Weapon", + "Show_Console" + }; + #ifdef __SETUP__ #define NUMKEYENTRIES 53 diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 4b47a328b..2d7ec3f30 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -120,6 +120,13 @@ int32 CONFIG_FunctionNameToNum( char * func ) return i; } } + for (i=0;i