From 768f3ad6d6517993fe585f78f21e98ecfc4ab892 Mon Sep 17 00:00:00 2001 From: terminx Date: Mon, 2 Feb 2009 01:49:14 +0000 Subject: [PATCH] git-svn-id: https://svn.eduke32.com/eduke32@1221 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/polymost.h | 5 +- polymer/eduke32/build/src/build.c | 6 +- polymer/eduke32/build/src/compat.c | 4 +- polymer/eduke32/build/src/engine.c | 26 ++-- polymer/eduke32/build/src/mdsprite.c | 14 +- polymer/eduke32/build/src/mmulti_unstable.c | 2 +- polymer/eduke32/build/src/polymost.c | 68 +++++----- polymer/eduke32/build/src/sdlayer.c | 10 +- polymer/eduke32/build/src/winlayer.c | 12 +- polymer/eduke32/source/astub.c | 78 +++++------ polymer/eduke32/source/duke3d.h | 1 + polymer/eduke32/source/funct.h | 2 +- polymer/eduke32/source/game.c | 143 ++++++++------------ polymer/eduke32/source/gamedef.c | 67 ++++++--- polymer/eduke32/source/gamevars.c | 49 +++---- polymer/eduke32/source/global.c | 2 +- polymer/eduke32/source/grpscan.c | 4 +- polymer/eduke32/source/jaudiolib/fx_man.c | 6 +- polymer/eduke32/source/jaudiolib/multivoc.c | 6 +- polymer/eduke32/source/jmact/scriplib.c | 8 +- polymer/eduke32/source/mdump.cpp | 8 +- polymer/eduke32/source/menus.c | 48 +++---- polymer/eduke32/source/rts.c | 2 +- polymer/eduke32/source/sounds.c | 4 +- polymer/eduke32/source/startgtk.game.c | 2 +- polymer/eduke32/source/startwin.game.c | 2 +- polymer/eduke32/source/sync.c | 12 +- polymer/eduke32/source/wrapper.c | 6 +- 28 files changed, 297 insertions(+), 300 deletions(-) diff --git a/polymer/eduke32/build/include/polymost.h b/polymer/eduke32/build/include/polymost.h index 1446fafd9..19c301d08 100644 --- a/polymer/eduke32/build/include/polymost.h +++ b/polymer/eduke32/build/include/polymost.h @@ -48,9 +48,11 @@ void gltexinvalidateall(void); void gltexinvalidate8(void); int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, char *name, char fontsize); +extern float curpolygonoffset; + +/* // Depth peeling control extern int32_t r_curpeel; -extern float curpolygonoffset; extern int32_t peelcompiling; // Depth peeling data @@ -58,6 +60,7 @@ extern GLuint ztexture[3]; extern GLuint *peels; extern GLuint *peelfbos; extern GLuint peelprogram[2]; +*/ extern int32_t cachefilehandle; extern FILE *cacheindexptr; diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index 4048f9364..37a71185f 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -337,7 +337,7 @@ int32_t app_main(int32_t argc, const char **argv) } if (!boardfilename[0]) { - strncpy(boardfilename, argv[i], BMAX_PATH-4-1); + Bstrncpy(boardfilename, argv[i], BMAX_PATH-4-1); boardfilename[i-BMAX_PATH] = 0; } } @@ -5641,7 +5641,7 @@ int32_t menuselect(void) } else { - sprintf(buffer,"Game filesystem %smode; press F for local filesystem or G for %s.", + Bsprintf(buffer,"Game filesystem %smode; press F for local filesystem or G for %s.", grponlymode?"GRP-only ":"", grponlymode?"all files":"GRP contents only"); } printext16(halfxdim16-(8*strlen(buffer)/2), 4, editorcolors[12],editorcolors[0],buffer,0); @@ -5662,7 +5662,7 @@ int32_t menuselect(void) { int32_t c = (dir->type == CACHE1D_FIND_DIR ? 2 : 3); //PK memset(buffer,0,sizeof(buffer)); - strncpy(buffer,dir->name,25); + Bstrncpy(buffer,dir->name,25); if (strlen(buffer) == 25) buffer[21] = buffer[22] = buffer[23] = '.', buffer[24] = 0; if (dir == finddirshigh) diff --git a/polymer/eduke32/build/src/compat.c b/polymer/eduke32/build/src/compat.c index 2b58ca04c..2e34122f2 100644 --- a/polymer/eduke32/build/src/compat.c +++ b/polymer/eduke32/build/src/compat.c @@ -167,7 +167,7 @@ char *Bstrcpy(char *dest, const char *src) char *Bstrncpy(char *dest, const char *src, bsize_t n) { - return strncpy(dest,src,n); + return Bstrncpy(dest,src,n); } int32_t Bstrcmp(const char *s1, const char *s2) @@ -667,7 +667,7 @@ struct Bdirent* Breaddir(BDIR *dir) fn = (char *)malloc(strlen(dirr->name) + 1 + dirr->info.namlen + 1); if (fn) { - sprintf(fn,"%s/%s",dirr->name,dirr->info.name); + Bsprintf(fn,"%s/%s",dirr->name,dirr->info.name); if (!stat(fn, &st)) { dirr->info.mode = st.st_mode; diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 0f0cfe961..d2da36c2b 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -996,7 +996,7 @@ int32_t wallfront(int32_t l1, int32_t l2) // // spritewallfront (internal) // -static int32_t spritewallfront(spritetype *s, int32_t w) +static inline int32_t spritewallfront(spritetype *s, int32_t w) { walltype *wal; int32_t x1, y1; @@ -1061,7 +1061,7 @@ static int32_t spriteobstructswall(spritetype *s, int32_t w) // // bunchfront (internal) // -static int32_t bunchfront(int32_t b1, int32_t b2) +static inline int32_t bunchfront(int32_t b1, int32_t b2) { int32_t x1b1, x2b1, x1b2, x2b2, b1f, b2f, i; @@ -1083,7 +1083,7 @@ static int32_t bunchfront(int32_t b1, int32_t b2) // // hline (internal) // -static void hline(int32_t xr, int32_t yp) +static inline void hline(int32_t xr, int32_t yp) { int32_t xl, r, s; @@ -1101,7 +1101,7 @@ static void hline(int32_t xr, int32_t yp) // // slowhline (internal) // -static void slowhline(int32_t xr, int32_t yp) +static inline void slowhline(int32_t xr, int32_t yp) { int32_t xl, r; @@ -1206,7 +1206,7 @@ static void prepwall(int32_t z, walltype *wal) // // animateoffs (internal) // -int32_t animateoffs(int16_t tilenum, int16_t fakevar) +inline int32_t animateoffs(int16_t tilenum, int16_t fakevar) { int32_t i, k, offs; @@ -2084,7 +2084,7 @@ static void transmaskvline2(int32_t x) // // transmaskwallscan (internal) // -static void transmaskwallscan(int32_t x1, int32_t x2) +static inline void transmaskwallscan(int32_t x1, int32_t x2) { int32_t x; @@ -2109,7 +2109,7 @@ static void transmaskwallscan(int32_t x1, int32_t x2) // // ceilspritehline (internal) // -static void ceilspritehline(int32_t x2, int32_t y) +static inline void ceilspritehline(int32_t x2, int32_t y) { int32_t x1, v, bx, by; @@ -2139,7 +2139,7 @@ static void ceilspritehline(int32_t x2, int32_t y) // // ceilspritescan (internal) // -static void ceilspritescan(int32_t x1, int32_t x2) +static inline void ceilspritescan(int32_t x1, int32_t x2) { int32_t x, y1, y2, twall, bwall; @@ -6074,6 +6074,7 @@ int32_t sameside(_equation* eq, _point2d* p1, _point2d* p2) return (0); } +/* #ifdef USE_OPENGL void drawpeel(int32_t peel) { @@ -6090,6 +6091,7 @@ void drawpeel(int32_t peel) bglEnd(); } #endif +*/ // // drawmasks @@ -6136,7 +6138,7 @@ killsprite: } #ifdef USE_OPENGL - if ((!r_depthpeeling) || (rendmode < 3)) +// if ((!r_depthpeeling) || (rendmode < 3)) #endif { @@ -6215,7 +6217,7 @@ killsprite: }*/ #if defined(USE_OPENGL) && defined(POLYMOST) - if ((!r_depthpeeling) || (rendmode < 3)) +// if ((!r_depthpeeling) || (rendmode < 3)) #endif { #if defined(USE_OPENGL) && defined(POLYMOST) @@ -6285,6 +6287,7 @@ killsprite: #endif } /* depthpeeling */ #if defined(USE_OPENGL) && defined(POLYMOST) +/* else { curpolygonoffset = 0; @@ -6299,9 +6302,11 @@ killsprite: if (totalclock >= lastcullcheck + CULL_DELAY) lastcullcheck = (totalclock + CULL_DELAY); } +*/ #endif #if defined(USE_OPENGL) && defined(POLYMOST) +/* if ((r_depthpeeling) && (rendmode >= 3)) { bglPopAttrib(); @@ -6402,6 +6407,7 @@ killsprite: bglDeleteLists(1, 1); } +*/ #endif indrawroomsandmasks = 0; diff --git a/polymer/eduke32/build/src/mdsprite.c b/polymer/eduke32/build/src/mdsprite.c index aa4d6e970..495f8b7a4 100644 --- a/polymer/eduke32/build/src/mdsprite.c +++ b/polymer/eduke32/build/src/mdsprite.c @@ -618,7 +618,7 @@ int32_t mdloadskin_trytexcache(char *fn, int32_t len, int32_t pal, char effect, // *(cp++) = '/'; cp = cachefn; for (fp = 0; fp < 16; phex(mdsum[fp++], cp), cp+=2); - sprintf(cp, "-%x-%x%x", len, pal, effect); + Bsprintf(cp, "-%x-%x%x", len, pal, effect); // fil = kopen4load(cachefn, 0); // if (fil < 0) return -1; @@ -1704,14 +1704,14 @@ static int32_t md3draw(md3model_t *m, spritetype *tspr) float al = 0.0; if (alphahackarray[globalpicnum] != 0) al=alphahackarray[globalpicnum]; - if (!peelcompiling) + /*if (!peelcompiling)*/ bglEnable(GL_BLEND); bglEnable(GL_ALPHA_TEST); bglAlphaFunc(GL_GREATER,al); } else { - if (tspr->cstat&2 && (!peelcompiling)) bglEnable(GL_BLEND); //else bglDisable(GL_BLEND); + if (tspr->cstat&2/* && (!peelcompiling)*/) bglEnable(GL_BLEND); //else bglDisable(GL_BLEND); } bglColor4f(pc[0],pc[1],pc[2],pc[3]); //if (m->head.flags == 1337) @@ -1805,7 +1805,7 @@ static int32_t md3draw(md3model_t *m, spritetype *tspr) //i = mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,surfi); //hack for testing multiple surfaces per MD3 bglBindTexture(GL_TEXTURE_2D, i); - if (r_detailmapping && !r_depthpeeling && !(tspr->cstat&1024)) + if (r_detailmapping && /*!r_depthpeeling &&*/ !(tspr->cstat&1024)) i = mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,DETAILPAL,surfi); else i = 0; @@ -1845,7 +1845,7 @@ static int32_t md3draw(md3model_t *m, spritetype *tspr) bglMatrixMode(GL_MODELVIEW); } - if (r_glowmapping && !r_depthpeeling && !(tspr->cstat&1024)) + if (r_glowmapping && /*!r_depthpeeling &&*/ !(tspr->cstat&1024)) i = mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,GLOWPAL,surfi); else i = 0; @@ -1887,7 +1887,7 @@ static int32_t md3draw(md3model_t *m, spritetype *tspr) indexhandle = m->vindexes; //PLAG: delayed polygon-level sorted rendering - if (m->usesalpha && !(tspr->cstat & 1024) && !r_depthpeeling) + if (m->usesalpha && !(tspr->cstat & 1024)/* && !r_depthpeeling*/) { for (i=s->numtris-1;i>=0;i--) { @@ -2867,7 +2867,7 @@ int32_t voxdraw(voxmodel_t *m, spritetype *tspr) pc[2] *= (float)hictinting[globalpal].b / 255.0; if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; } else pc[3] = 1.0; - if (tspr->cstat&2 && (!peelcompiling)) bglEnable(GL_BLEND); //else bglDisable(GL_BLEND); + if (tspr->cstat&2/* && (!peelcompiling)*/) bglEnable(GL_BLEND); //else bglDisable(GL_BLEND); //------------ //transform to Build coords diff --git a/polymer/eduke32/build/src/mmulti_unstable.c b/polymer/eduke32/build/src/mmulti_unstable.c index fce5a530f..ffb7cafbf 100644 --- a/polymer/eduke32/build/src/mmulti_unstable.c +++ b/polymer/eduke32/build/src/mmulti_unstable.c @@ -670,7 +670,7 @@ static const char *win32netstrerror(void) static char *static_ipstring(int32_t ip) { static char s[16]; - sprintf(s, "%u.%u.%u.%u", IPSEG1(ip), IPSEG2(ip), IPSEG3(ip), IPSEG4(ip)); + Bsprintf(s, "%u.%u.%u.%u", IPSEG1(ip), IPSEG2(ip), IPSEG3(ip), IPSEG4(ip)); return(s); } diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index 7c64eb100..b8929b131 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -152,11 +152,11 @@ static int32_t fullbrightloadingpass = 0; static int32_t fullbrightdrawingpass = 0; static int32_t shadeforfullbrightpass; +/* // Depth peeling control int32_t r_depthpeeling = 0; // cvar toggling general depth peeling usage int32_t r_peelscount = 5; // cvar controlling the number of peeling layers int32_t r_curpeel = -1; // cvar controlling the display of independant peeling layers -float curpolygonoffset; // internal polygon offset stack for drawing flat sprites to avoid depth fighting int32_t peelcompiling = 0; // internal control var to disable blending when compiling the peeling display list int32_t newpeelscount = 0; // temporary var for peels count changing during the game @@ -165,6 +165,9 @@ GLuint ztexture[3]; // secondary Z-buffers identifier GLuint *peels; // peels identifiers GLuint *peelfbos; // peels FBOs identifiers GLuint peelprogram[2]; // ARBfp peeling fragment program +*/ + +float curpolygonoffset; // internal polygon offset stack for drawing flat sprites to avoid depth fighting // Detail mapping cvar int32_t r_detailmapping = 1; @@ -503,7 +506,7 @@ tryart: return(pth); } -int32_t gltexmayhavealpha(int32_t dapicnum, int32_t dapalnum) +static inline int32_t gltexmayhavealpha(int32_t dapicnum, int32_t dapalnum) { int32_t j = (dapicnum&(GLTEXCACHEADSIZ-1)); pthtyp *pth; @@ -697,6 +700,7 @@ void polymost_glreset() glox1 = -1; // Depth peeling cleanup +/* if (peels) { bglDeleteProgramsARB(2, peelprogram); @@ -708,6 +712,7 @@ void polymost_glreset() peels = NULL; } +*/ if (cachefilehandle != -1) { @@ -740,6 +745,7 @@ void polymost_glinit() { GLfloat col[4]; int32_t i; +/* char notpeeledprogramstring[] = "!!ARBfp1.0\n" "OPTION ARB_fog_exp2;\n" @@ -767,6 +773,7 @@ void polymost_glinit() "TEX texsample, fragment.texcoord[0], texture[0], 2D;\n" "MUL result.color, fragment.color, texsample;\n" "END\n"; +*/ if (!Bstrcmp(glinfo.vendor, "NVIDIA Corporation")) { @@ -796,11 +803,13 @@ void polymost_glinit() bglEnable(GL_MULTISAMPLE_ARB); } +/* if (r_depthpeeling && (!glinfo.arbfp || !glinfo.depthtex || !glinfo.shadow || !glinfo.fbos || !glinfo.rect || !glinfo.multitex)) { OSD_Printf("Your OpenGL implementation doesn't support depth peeling. Disabling...\n"); r_depthpeeling = 0; } +*/ if (r_detailmapping && (!glinfo.multitex || !glinfo.envcombine)) { @@ -821,6 +830,7 @@ void polymost_glinit() } //depth peeling initialization +/* if (r_depthpeeling) { if (newpeelscount) @@ -891,6 +901,7 @@ void polymost_glinit() bglBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, peelprogram[1]); bglProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(peeledprogramstring), peeledprogramstring); } +*/ bglEnableClientState(GL_VERTEX_ARRAY); bglEnableClientState(GL_TEXTURE_COORD_ARRAY); @@ -1406,7 +1417,7 @@ static int32_t LoadCacheOffsets(void) } else { - strncpy(curcacheindex->name, fname, BMAX_PATH); + Bstrncpy(curcacheindex->name, fname, BMAX_PATH); curcacheindex->offset = foffset; curcacheindex->len = fsize; curcacheindex->next = Bcalloc(1, sizeof(texcacheindex)); @@ -1435,8 +1446,8 @@ int32_t trytexcache(char *fn, int32_t len, int32_t dameth, char effect, texcache char cachefn[BMAX_PATH], *cp; uint8_t mdsum[16]; - if (!glinfo.texcompr || !glusetexcompr || !glusetexcache || !cacheindexptr || cachefilehandle < 0) return -1; - if (!bglCompressedTexImage2DARB || !bglGetCompressedTexImageARB) + if (!glusetexcompr || !glusetexcache || !cacheindexptr || cachefilehandle < 0) return -1; + if (!glinfo.texcompr || !bglCompressedTexImage2DARB || !bglGetCompressedTexImageARB) { // lacking the necessary extensions to do this OSD_Printf("Warning: the GL driver lacks necessary functions to use caching\n"); @@ -1451,9 +1462,6 @@ int32_t trytexcache(char *fn, int32_t len, int32_t dameth, char effect, texcache for (fp = 0; fp < 16; phex(mdsum[fp++], cp), cp+=2); Bsprintf(cp, "-%x-%x%x", len, dameth, effect); -// fil = kopen4load(cachefn, 0); -// if (fil < 0) return -1; - { int32_t offset = 0; int32_t len = 0; @@ -1489,20 +1497,18 @@ int32_t trytexcache(char *fn, int32_t len, int32_t dameth, char effect, texcache if ((head->flags & 4) && !glusetexcachecompression) goto failure; if (!(head->flags & 4) && glusetexcachecompression) goto failure; - if (!(head->flags & 8) && head->quality != r_downsize) goto failure; // handle nocompress + if (!(head->flags & 8) && head->quality != r_downsize) return -1; // handle nocompress if (gltexmaxsize && (head->xdim > (1<ydim > (1<flags & 1)) goto failure; return cachefilehandle; failure: initprintf("cache miss\n"); -// kclose(cachefilehandle); return -1; } void writexcache(char *fn, int32_t len, int32_t dameth, char effect, texcacheheader *head) { -// int32_t fil=-1; int32_t fp; char cachefn[BMAX_PATH], *cp; uint8_t mdsum[16]; @@ -1558,15 +1564,10 @@ void writexcache(char *fn, int32_t len, int32_t dameth, char effect, texcachehea if (gi != GL_TRUE) return; md4once((uint8_t *)fn, strlen(fn), mdsum); -// for (cp = cachefn, fp = 0; (*cp = TEXCACHEFILE[fp]); cp++,fp++); -// *(cp++) = '/'; + cp = cachefn; for (fp = 0; fp < 16; phex(mdsum[fp++], cp), cp+=2); - sprintf(cp, "-%x-%x%x", len, dameth, effect); - -// fil = Bopen(cachefn,BO_BINARY|BO_CREAT|BO_TRUNC|BO_RDWR,BS_IREAD|BS_IWRITE); -// if (fil < 0) return; - + Bsprintf(cp, "-%x-%x%x", len, dameth, effect); Blseek(cachefilehandle, 0, BSEEK_END); @@ -1672,7 +1673,6 @@ failure: Bmemset(curcacheindex->name,0,sizeof(curcacheindex->name)); success: -// if (fil>=0) Bclose(fil); if (midbuf) free(midbuf); if (pic) free(pic); if (packbuf) free(packbuf); @@ -1827,13 +1827,9 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp tsizx = cachead.xdim; tsizy = cachead.ydim; hasalpha = (cachead.flags & 2) ? 0 : 255; -// kclose(cachefil); - //kclose(filh); // FIXME: uncomment when cache1d.c is fixed - // cachefil >= 0, so it won't be rewritten } else { -// if (cachefil >= 0) kclose(cachefil); cachefil = -1; // the compressed version will be saved to disk if ((filh = kopen4load(fn, 0)) < 0) return -1; @@ -2151,7 +2147,7 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method) // detail texture detailpth = NULL; - if (r_detailmapping && usehightile && !r_depthpeeling && !drawingskybox && + if (r_detailmapping && usehightile /*&& !r_depthpeeling*/ && !drawingskybox && hicfindsubst(globalpicnum, DETAILPAL, 0)) detailpth = gltexcache(globalpicnum, DETAILPAL, method&(~3)); @@ -2197,7 +2193,7 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method) // glow texture glowpth = NULL; - if (r_glowmapping && usehightile && !r_depthpeeling && !drawingskybox && + if (r_glowmapping && usehightile /*&& !r_depthpeeling*/ && !drawingskybox && hicfindsubst(globalpicnum, GLOWPAL, 0)) glowpth = gltexcache(globalpicnum, GLOWPAL, method&(~3)); @@ -2251,7 +2247,7 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method) if ((!(method&3)) && (!fullbrightdrawingpass)) { bglDisable(GL_BLEND); - if (!peelcompiling) +/* if (!peelcompiling)*/ bglDisable(GL_ALPHA_TEST); } else @@ -2261,7 +2257,7 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method) if (alphahackarray[globalpicnum]) al=alphahackarray[globalpicnum]; if (!waloff[globalpicnum]) al = 0.0; // invalid textures ignore the alpha cutoff settings - if (!peelcompiling) +/* if (!peelcompiling)*/ bglEnable(GL_BLEND); bglEnable(GL_ALPHA_TEST); bglAlphaFunc(GL_GREATER,al); @@ -2908,7 +2904,7 @@ void initmosts(double *px, double *py, int32_t n) vsp[VSPMAX-1].n = vcnt; vsp[vcnt].p = VSPMAX-1; } -void vsdel(int32_t i) +static inline void vsdel(int32_t i) { int32_t pi, ni; //Delete i @@ -2924,7 +2920,7 @@ void vsdel(int32_t i) vsp[VSPMAX-1].n = i; } -int32_t vsinsaft(int32_t i) +static inline int32_t vsinsaft(int32_t i) { int32_t r; //i = next element from empty list @@ -2941,7 +2937,7 @@ int32_t vsinsaft(int32_t i) return(r); } -int32_t testvisiblemost(float x0, float x1) +static inline int32_t testvisiblemost(float x0, float x1) { int32_t i, newi; @@ -4359,6 +4355,7 @@ void polymost_drawrooms() globalposy += cosglobalang/1024; } } +/* if (r_depthpeeling) { bglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, peelfbos[r_peelscount]); @@ -4366,6 +4363,7 @@ void polymost_drawrooms() bglViewport(0, 0, xdim, ydim); //bglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); } +*/ } #endif @@ -4605,6 +4603,7 @@ void polymost_drawmaskwall(int32_t damaskwallcnt) globalpal = (int32_t)((uint8_t)wal->pal); globalorientation = (int32_t)wal->cstat; +/* #ifdef USE_OPENGL if (r_depthpeeling) { @@ -4614,6 +4613,7 @@ void polymost_drawmaskwall(int32_t damaskwallcnt) return; // discard opaque sprite when composing the depth peels } #endif +*/ sx0 = (float)(wal->x-globalposx); sx1 = (float)(wal2->x-globalposx); sy0 = (float)(wal->y-globalposy); sy1 = (float)(wal2->y-globalposy); @@ -4854,6 +4854,7 @@ void polymost_drawsprite(int32_t snum) if (tspr->cstat&2) { if (!(tspr->cstat&512)) method = 2+4; else method = 3+4; } #ifdef USE_OPENGL +/* if (r_depthpeeling) { if ((((tspr->cstat&2) || (gltexmayhavealpha(globalpicnum,tspr->pal)))) && !peelcompiling) @@ -4861,6 +4862,7 @@ void polymost_drawsprite(int32_t snum) if (!(((tspr->cstat&2) || (gltexmayhavealpha(globalpicnum,tspr->pal)))) && peelcompiling) return; // discard opaque sprite when composing the depth peels } +*/ if (!nofog && rendmode >= 3) { @@ -6170,6 +6172,7 @@ static int32_t osdcmd_polymostvars(const osdfuncparm_t *parm) else gltexmiplevel = val; return OSDCMD_OK; } +/* else if (!Bstrcasecmp(parm->name, "r_depthpeeling")) { if (showval) { OSD_Printf("r_depthpeeling is %d\n", r_depthpeeling); } @@ -6208,6 +6211,7 @@ static int32_t osdcmd_polymostvars(const osdfuncparm_t *parm) else r_curpeel = val; return OSDCMD_OK; } +*/ else if (!Bstrcasecmp(parm->name, "r_detailmapping")) { if (showval) { OSD_Printf("r_detailmapping is %d\n", r_detailmapping); } @@ -6396,8 +6400,10 @@ void polymost_initosdfuncs(void) #ifdef USE_OPENGL OSD_RegisterFunction("r_animsmoothing","r_animsmoothing: enable/disable model animation smoothing",osdcmd_polymostvars); OSD_RegisterFunction("r_modelocclusionchecking","r_modelocclusionchecking: enable/disable hack to cull \"obstructed\" models",osdcmd_polymostvars); +/* OSD_RegisterFunction("r_curpeel","r_curpeel: allows to display one depth layer at a time (for development purposes)",osdcmd_polymostvars); OSD_RegisterFunction("r_depthpeeling","r_depthpeeling: enable/disable order-independant transparency",osdcmd_polymostvars); +*/ OSD_RegisterFunction("r_detailmapping","r_detailmapping: enable/disable detail mapping",osdcmd_polymostvars); OSD_RegisterFunction("r_downsize","r_downsize: controls downsizing factor for hires textures",osdcmd_polymostvars); OSD_RegisterFunction("r_fullbrights","r_fullbrights: enable/disable fullbright textures",osdcmd_polymostvars); @@ -6406,7 +6412,7 @@ void polymost_initosdfuncs(void) OSD_RegisterFunction("r_nvmultisamplehint","r_nvmultisamplehint: enable/disable Nvidia multisampling hinting",osdcmd_polymostvars); OSD_RegisterFunction("r_parallaxskyclamping","r_parallaxskyclamping: enable/disable parallaxed floor/ceiling sky texture clamping",osdcmd_polymostvars); OSD_RegisterFunction("r_parallaxskypanning","r_parallaxskypanning: enable/disable parallaxed floor/ceiling panning when drawing a parallaxed sky",osdcmd_polymostvars); - OSD_RegisterFunction("r_peelscount","r_peelscount: sets the number of depth layers for depth peeling",osdcmd_polymostvars); +/* OSD_RegisterFunction("r_peelscount","r_peelscount: sets the number of depth layers for depth peeling",osdcmd_polymostvars);*/ OSD_RegisterFunction("r_polygonmode","r_polygonmode: debugging feature",osdcmd_polymostvars); //FUK OSD_RegisterFunction("r_redbluemode","r_redbluemode: enable/disable experimental OpenGL red-blue glasses mode",osdcmd_polymostvars); OSD_RegisterFunction("r_shadescale","r_shadescale: multiplier for lighting",osdcmd_polymostvars); diff --git a/polymer/eduke32/build/src/sdlayer.c b/polymer/eduke32/build/src/sdlayer.c index 0e4a79f93..0735f8c13 100644 --- a/polymer/eduke32/build/src/sdlayer.c +++ b/polymer/eduke32/build/src/sdlayer.c @@ -417,13 +417,13 @@ int32_t initinput(void) for (i=0; i (unsigned)joynumaxes) return NULL; - sprintf(tmp,"Axis %d",num); + Bsprintf(tmp,"Axis %d",num); return (char *)tmp; case 1: // button if ((unsigned)num > (unsigned)joynumbuttons) return NULL; - sprintf(tmp,"Button %d",num); + Bsprintf(tmp,"Button %d",num); return (char *)tmp; case 2: // hat if ((unsigned)num > (unsigned)joynumhats) return NULL; - sprintf(tmp,"Hat %d",num); + Bsprintf(tmp,"Hat %d",num); return (char *)tmp; default: diff --git a/polymer/eduke32/build/src/winlayer.c b/polymer/eduke32/build/src/winlayer.c index 379663eab..1fef95b13 100644 --- a/polymer/eduke32/build/src/winlayer.c +++ b/polymer/eduke32/build/src/winlayer.c @@ -87,7 +87,7 @@ static BOOL InitDirectInput(void); static void UninitDirectInput(void); static void GetKeyNames(void); static void AcquireInputDevices(char acquire, int8_t device); -static void ProcessInputDevices(void); +static inline void ProcessInputDevices(void); static int32_t SetupDirectDraw(int32_t width, int32_t height); static void UninitDIB(void); static int32_t SetupDIB(int32_t width, int32_t height); @@ -1567,12 +1567,12 @@ static void GetKeyNames(void) if (FAILED(res)) continue; CharToOem(key.tszName, tbuf); - strncpy((char *)key_names[i], tbuf, sizeof(key_names[i])-1); + Bstrncpy((char *)key_names[i], tbuf, sizeof(key_names[i])-1); tbuf[0] = 0; GetKeyNameText((i>128?(i+128):i)<<16, tbuf, sizeof(key_names[i])-1); // initprintf("%d %15s %15s\n",i,key_names[i],tbuf); - if (*tbuf)strncpy(&key_names[i][0], tbuf, sizeof(key_names[i])-1); + if (*tbuf)Bstrncpy(&key_names[i][0], tbuf, sizeof(key_names[i])-1); } } @@ -1664,7 +1664,7 @@ static void AcquireInputDevices(char acquire, int8_t device) // // ProcessInputDevices() -- processes the input devices // -static void ProcessInputDevices(void) +static inline void ProcessInputDevices(void) { DWORD i; HRESULT result; @@ -2005,7 +2005,7 @@ void uninittimer(void) // // sampletimer() -- update totalclock // -void sampletimer(void) +inline void sampletimer(void) { int64 i; int32_t n; @@ -2335,7 +2335,7 @@ void getvalidmodes(void) { static int32_t defaultres[][2] = { - {1280,1024},{1280,960},{1152,864},{1024,768},{800,600},{640,480}, + {1920,1440},{1920,1200},{1600,1200},{1280,1024},{1280,960},{1152,864},{1024,768},{1024,600},{800,600},{640,480}, {640,400},{512,384},{480,360},{400,300},{320,240},{320,200},{0,0} }; int32_t cdepths[2] = { 8, 0 }; diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 4d2d031e0..33afd4b91 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -44,7 +44,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #endif -#define BUILDDATE " 20090123" +#define BUILDDATE " 20090131" #define VERSION " 1.2.0devel" static int32_t floor_over_floor; @@ -4047,7 +4047,7 @@ static void Keys3d(void) if (searchstat != 3) { wall[searchwall].cstat ^= 32; - sprintf(getmessage,"Wall %d one side masking bit %s",searchwall,wall[searchwall].cstat&32?"ON":"OFF"); + Bsprintf(getmessage,"Wall %d one side masking bit %s",searchwall,wall[searchwall].cstat&32?"ON":"OFF"); message(getmessage); asksave = 1; } @@ -4063,7 +4063,7 @@ static void Keys3d(void) sprite[searchwall].cstat |= 8; } asksave = 1; - sprintf(getmessage,"Sprite %d one sided bit %s",searchwall,sprite[searchwall].cstat&64?"ON":"OFF"); + Bsprintf(getmessage,"Sprite %d one sided bit %s",searchwall,sprite[searchwall].cstat&64?"ON":"OFF"); message(getmessage); } @@ -4074,7 +4074,7 @@ static void Keys3d(void) if (searchstat != 3) { wall[searchwall].cstat ^= 2; - sprintf(getmessage,"Wall %d bottom texture swap bit %s",searchwall,wall[searchwall].cstat&2?"ON":"OFF"); + Bsprintf(getmessage,"Wall %d bottom texture swap bit %s",searchwall,wall[searchwall].cstat&2?"ON":"OFF"); message(getmessage); asksave = 1; } @@ -4109,7 +4109,7 @@ static void Keys3d(void) if (i >= 0) { wall[searchwall].cstat ^= 16; - sprintf(getmessage,"Wall %d masking bit %s",searchwall,wall[searchwall].cstat&16?"ON":"OFF"); + Bsprintf(getmessage,"Wall %d masking bit %s",searchwall,wall[searchwall].cstat&16?"ON":"OFF"); message(getmessage); if ((wall[searchwall].cstat&16) > 0) { @@ -4170,7 +4170,7 @@ static void Keys3d(void) if (searchstat == 3) { sprite[searchwall].cstat ^= 256; - sprintf(getmessage,"Sprite %d hitscan sensitivity bit %s",searchwall,sprite[searchwall].cstat&256?"ON":"OFF"); + Bsprintf(getmessage,"Sprite %d hitscan sensitivity bit %s",searchwall,sprite[searchwall].cstat&256?"ON":"OFF"); message(getmessage); asksave = 1; } @@ -4183,7 +4183,7 @@ static void Keys3d(void) wall[wall[searchwall].nextwall].cstat &= ~64; wall[wall[searchwall].nextwall].cstat |= (wall[searchwall].cstat&64); } - sprintf(getmessage,"Wall %d hitscan sensitivity bit %s",searchwall,wall[searchwall].cstat&64?"ON":"OFF"); + Bsprintf(getmessage,"Wall %d hitscan sensitivity bit %s",searchwall,wall[searchwall].cstat&64?"ON":"OFF"); message(getmessage); asksave = 1; @@ -4466,14 +4466,14 @@ static void Keys3d(void) if (searchstat == 1) { sector[searchsector].ceilingstat ^= 8; - sprintf(getmessage,"Sector %d ceiling texture expansion bit %s",searchsector,sector[searchsector].ceilingstat&8?"ON":"OFF"); + Bsprintf(getmessage,"Sector %d ceiling texture expansion bit %s",searchsector,sector[searchsector].ceilingstat&8?"ON":"OFF"); message(getmessage); asksave = 1; } if (searchstat == 2) { sector[searchsector].floorstat ^= 8; - sprintf(getmessage,"Sector %d floor texture expansion bit %s",searchsector,sector[searchsector].floorstat&8?"ON":"OFF"); + Bsprintf(getmessage,"Sector %d floor texture expansion bit %s",searchsector,sector[searchsector].floorstat&8?"ON":"OFF"); message(getmessage); asksave = 1; } @@ -4497,14 +4497,14 @@ static void Keys3d(void) if (searchstat == 1) { sector[searchsector].ceilingstat ^= 64; - sprintf(getmessage,"Sector %d ceiling texture relativity bit %s",searchsector,sector[searchsector].ceilingstat&64?"ON":"OFF"); + Bsprintf(getmessage,"Sector %d ceiling texture relativity bit %s",searchsector,sector[searchsector].ceilingstat&64?"ON":"OFF"); message(getmessage); asksave = 1; } if (searchstat == 2) { sector[searchsector].floorstat ^= 64; - sprintf(getmessage,"Sector %d floor texture relativity bit %s",searchsector,sector[searchsector].floorstat&64?"ON":"OFF"); //PK (was ceiling in string) + Bsprintf(getmessage,"Sector %d floor texture relativity bit %s",searchsector,sector[searchsector].floorstat&64?"ON":"OFF"); //PK (was ceiling in string) message(getmessage); asksave = 1; } @@ -4517,11 +4517,11 @@ static void Keys3d(void) sprite[searchwall].cstat = i; if (sprite[searchwall].cstat&16) - sprintf(getmessage,"Sprite %d now wall aligned",searchwall); + Bsprintf(getmessage,"Sprite %d now wall aligned",searchwall); else if (sprite[searchwall].cstat&32) - sprintf(getmessage,"Sprite %d now floor aligned",searchwall); + Bsprintf(getmessage,"Sprite %d now floor aligned",searchwall); else - sprintf(getmessage,"Sprite %d now view aligned",searchwall); + Bsprintf(getmessage,"Sprite %d now view aligned",searchwall); message(getmessage); asksave = 1; } @@ -4728,7 +4728,7 @@ static void Keys3d(void) i = nextspritesect[i]; } sector[searchsector].ceilingz -= updownunits << (eitherCTRL<<1); // JBF 20031128 - sprintf(getmessage,"Sector %d ceilingz = %d",searchsector,sector[searchsector].ceilingz); + Bsprintf(getmessage,"Sector %d ceilingz = %d",searchsector,sector[searchsector].ceilingz); message(getmessage); } @@ -4747,7 +4747,7 @@ static void Keys3d(void) i = nextspritesect[i]; } sector[highlightsector[j]].ceilingz -= updownunits << (eitherCTRL<<1); // JBF 20031128 - sprintf(getmessage,"Sector %d ceilingz = %d",*highlightsector,sector[highlightsector[j]].ceilingz); + Bsprintf(getmessage,"Sector %d ceilingz = %d",*highlightsector,sector[highlightsector[j]].ceilingz); message(getmessage); } @@ -4767,7 +4767,7 @@ static void Keys3d(void) i = nextspritesect[i]; } sector[searchsector].floorz -= updownunits << (eitherCTRL<<1); // JBF 20031128 - sprintf(getmessage,"Sector %d floorz = %d",searchsector,sector[searchsector].floorz); + Bsprintf(getmessage,"Sector %d floorz = %d",searchsector,sector[searchsector].floorz); message(getmessage); } @@ -4785,7 +4785,7 @@ static void Keys3d(void) i = nextspritesect[i]; } sector[highlightsector[j]].floorz -= updownunits << (eitherCTRL<<1); // JBF 20031128 - sprintf(getmessage,"Sector %d floorz = %d",*highlightsector,sector[highlightsector[j]].floorz); + Bsprintf(getmessage,"Sector %d floorz = %d",*highlightsector,sector[highlightsector[j]].floorz); message(getmessage); } @@ -4815,7 +4815,7 @@ static void Keys3d(void) { sprite[searchwall].z -= updownunits; if (!spnoclip)sprite[searchwall].z = max(sprite[searchwall].z,spriteonceilingz(searchwall)); - sprintf(getmessage,"Sprite %d z = %d",searchwall,sprite[searchwall].z); + Bsprintf(getmessage,"Sprite %d z = %d",searchwall,sprite[searchwall].z); message(getmessage); } @@ -4827,7 +4827,7 @@ static void Keys3d(void) sprite[highlight[i]&16383].z -= updownunits; if (!spnoclip)sprite[highlight[i]&16383].z = max(sprite[highlight[i]&16383].z,spriteonceilingz(highlight[i]&16383)); } - sprintf(getmessage,"Sprite %d z = %d",highlight[i]&16383,sprite[highlight[i]&16383].z); + Bsprintf(getmessage,"Sprite %d z = %d",highlight[i]&16383,sprite[highlight[i]&16383].z); message(getmessage); } @@ -4876,7 +4876,7 @@ static void Keys3d(void) i = nextspritesect[i]; } sector[searchsector].ceilingz += updownunits << (eitherCTRL<<1); // JBF 20031128 - sprintf(getmessage,"Sector %d ceilingz = %d",searchsector,sector[searchsector].ceilingz); + Bsprintf(getmessage,"Sector %d ceilingz = %d",searchsector,sector[searchsector].ceilingz); message(getmessage); } @@ -4895,7 +4895,7 @@ static void Keys3d(void) i = nextspritesect[i]; } sector[highlightsector[j]].ceilingz += updownunits << (eitherCTRL<<1); // JBF 20031128 - sprintf(getmessage,"Sector %d ceilingz = %d",*highlightsector,sector[highlightsector[j]].ceilingz); + Bsprintf(getmessage,"Sector %d ceilingz = %d",*highlightsector,sector[highlightsector[j]].ceilingz); message(getmessage); } @@ -4915,7 +4915,7 @@ static void Keys3d(void) i = nextspritesect[i]; } sector[searchsector].floorz += updownunits << (eitherCTRL<<1); // JBF 20031128 - sprintf(getmessage,"Sector %d floorz = %d",searchsector,sector[searchsector].floorz); + Bsprintf(getmessage,"Sector %d floorz = %d",searchsector,sector[searchsector].floorz); message(getmessage); } @@ -4933,7 +4933,7 @@ static void Keys3d(void) i = nextspritesect[i]; } sector[highlightsector[j]].floorz += updownunits << (eitherCTRL<<1); // JBF 20031128 - sprintf(getmessage,"Sector %d floorz = %d",*highlightsector,sector[highlightsector[j]].floorz); + Bsprintf(getmessage,"Sector %d floorz = %d",*highlightsector,sector[highlightsector[j]].floorz); message(getmessage); } @@ -4962,7 +4962,7 @@ static void Keys3d(void) { sprite[searchwall].z += updownunits; if (!spnoclip)sprite[searchwall].z = min(sprite[searchwall].z,spriteongroundz(searchwall)); - sprintf(getmessage,"Sprite %d z = %d",searchwall,sprite[searchwall].z); + Bsprintf(getmessage,"Sprite %d z = %d",searchwall,sprite[searchwall].z); message(getmessage); } @@ -4974,7 +4974,7 @@ static void Keys3d(void) sprite[highlight[i]&16383].z += updownunits; if (!spnoclip)sprite[highlight[i]&16383].z = min(sprite[highlight[i]&16383].z,spriteongroundz(highlight[i]&16383)); } - sprintf(getmessage,"Sprite %d z = %d",highlight[i]&16383,sprite[highlight[i]&16383].z); + Bsprintf(getmessage,"Sprite %d z = %d",highlight[i]&16383,sprite[highlight[i]&16383].z); message(getmessage); } @@ -5106,7 +5106,7 @@ static void Keys3d(void) Bsprintf(tempbuf,"%d",purpleon); break; default : - sprintf(tempbuf," "); + Bsprintf(tempbuf," "); break; } begindrawing(); @@ -5399,7 +5399,7 @@ static void Keys3d(void) sprite[searchwall].cstat ^= 1; // sprite[searchwall].cstat &= ~256; // sprite[searchwall].cstat |= ((sprite[searchwall].cstat&1)<<8); - sprintf(getmessage,"Sprite %d blocking bit %s",searchwall,sprite[searchwall].cstat&1?"ON":"OFF"); + Bsprintf(getmessage,"Sprite %d blocking bit %s",searchwall,sprite[searchwall].cstat&1?"ON":"OFF"); message(getmessage); asksave = 1; } @@ -5412,7 +5412,7 @@ static void Keys3d(void) wall[wall[searchwall].nextwall].cstat &= ~(1+64); wall[wall[searchwall].nextwall].cstat |= (wall[searchwall].cstat&1); } - sprintf(getmessage,"Wall %d blocking bit %s",searchwall,wall[searchwall].cstat&1?"ON":"OFF"); + Bsprintf(getmessage,"Wall %d blocking bit %s",searchwall,wall[searchwall].cstat&1?"ON":"OFF"); message(getmessage); asksave = 1; } @@ -6913,11 +6913,11 @@ static void Keys2d(void) sprite[cursprite].cstat = i; if (sprite[cursprite].cstat&16) - sprintf(getmessage,"Sprite %d now wall aligned",cursprite); + Bsprintf(getmessage,"Sprite %d now wall aligned",cursprite); else if (sprite[cursprite].cstat&32) - sprintf(getmessage,"Sprite %d now floor aligned",cursprite); + Bsprintf(getmessage,"Sprite %d now floor aligned",cursprite); else - sprintf(getmessage,"Sprite %d now view aligned",cursprite); + Bsprintf(getmessage,"Sprite %d now view aligned",cursprite); message(getmessage); asksave = 1; @@ -7106,9 +7106,9 @@ static void Keys2d(void) } } } - if (autogrid) sprintf(tempbuf,"Grid size: 9 (autosize)"); - else if (!grid) sprintf(tempbuf,"Grid off"); - else sprintf(tempbuf,"Grid size: %d (%d units)",grid,2048>>grid); + if (autogrid) Bsprintf(tempbuf,"Grid size: 9 (autosize)"); + else if (!grid) Bsprintf(tempbuf,"Grid off"); + else Bsprintf(tempbuf,"Grid size: %d (%d units)",grid,2048>>grid); printmessage16(tempbuf); keystatus[KEYSC_G] = 0; } @@ -9526,14 +9526,6 @@ void faketimerhandler(void) horiz = ((horiz*7+(100-(daang>>1)))>>3); if (horiz < 100) horiz++; if (horiz > 100) horiz--; - /* - if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_5]) // ' 5 - { - keystatus[KEYSC_5]=0; - editstatus = 1; - sidemode = 2; - } - */ } extern int16_t brightness; diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index bf3d44f77..ecdb0c41b 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -807,6 +807,7 @@ enum GamevarFlags_t { GAMEVAR_SHORTPTR = 0x00008000, // plValues is a pointer to a short GAMEVAR_CHARPTR = 0x00010000, // plValues is a pointer to a char GAMEVAR_NORESET = 0x00020000, // var values are not reset when restoring map state + GAMEVAR_SPECIAL = 0x00040000, // flag for structure member shortcut vars }; enum GamearrayFlags_t { diff --git a/polymer/eduke32/source/funct.h b/polymer/eduke32/source/funct.h index eb7fe2a33..361f33012 100644 --- a/polymer/eduke32/source/funct.h +++ b/polymer/eduke32/source/funct.h @@ -220,7 +220,7 @@ extern void G_ProcessDynamicTileMapping(const char *szLabel, int32_t lValue); extern void A_LoadActor(int32_t sActor); extern int32_t Gv_GetVarByLabel(const char *szGameLabel, int32_t lDefault, int32_t iActor, int32_t iPlayer); -extern void Gv_DumpValues(FILE *fp); +extern void Gv_DumpValues(void); // extern void AddLog(const char *psz, ...); extern void Gv_ResetSystemDefaults(void); diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 192837775..ce676e9d4 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -143,7 +143,7 @@ int32_t tempwallptr; static int32_t nonsharedtimer; static void G_DrawCameraText(int16_t i); -static int32_t G_MoveLoop(void); +static inline int32_t G_MoveLoop(void); static void G_DoOrderScreen(void); static void Net_DoPrediction(void); static void Net_CorrectPrediction(void); @@ -643,35 +643,7 @@ void Net_GetPackets(void) g_player[i].movefifoend++; } - /* while (j != packbufleng) - { - for (i=connecthead;i>=0;i=connectpoint2[i]) - if (i != myconnectindex) - { - g_player[i].syncval[g_player[i].syncvalhead&(MOVEFIFOSIZ-1)] = packbuf[j]; - g_player[i].syncvalhead++; - } - j++; - } */ - /* while (j != packbufleng) - { - for (i = connecthead; i >= 0; i = connectpoint2[i]) - { - if (i != myconnectindex) - { - for (sb = 0; sb < g_numSyncBytes; sb++) - { - g_player[i].syncval[g_player[i].syncvalhead & (SYNCFIFOSIZ - 1)][sb] = packbuf[j + sb]; - } - - g_player[i].syncvalhead++; - } - } - - j += g_numSyncBytes; - } */ - - Net_GetSyncInfoFromPacket(packbuf, packbufleng, &j, other); + Net_GetSyncData(packbuf, packbufleng, &j, other); TRAVERSE_CONNECT(i) if (i != myconnectindex) @@ -707,12 +679,7 @@ void Net_GetPackets(void) if (k&2048) nsyn[other].extbits = ((nsyn[other].extbits&0x00ffffff)|((int32_t)packbuf[j++])<<24); */ g_player[other].movefifoend++; - /* while (j != packbufleng) - { - g_player[other].syncval[g_player[other].syncvalhead&(MOVEFIFOSIZ-1)] = packbuf[j++]; - g_player[other].syncvalhead++; - } */ - Net_GetSyncInfoFromPacket(packbuf, packbufleng, &j, other); + Net_GetSyncData(packbuf, packbufleng, &j, other); for (i=g_movesPerPacket-1;i>=1;i--) { @@ -765,14 +732,7 @@ void Net_GetPackets(void) g_player[other].movefifoend++; } - /* - while (j < packbufleng) - { - g_player[other].syncval[g_player[other].syncvalhead&(MOVEFIFOSIZ-1)] = packbuf[j++]; - g_player[other].syncvalhead++; - } - */ - Net_GetSyncInfoFromPacket(packbuf, packbufleng, &j, other); + Net_GetSyncData(packbuf, packbufleng, &j, other); if (j > packbufleng) initprintf("INVALID GAME PACKET!!! (packet %d, %d too many bytes (%d %d))\n",packbuf[0],j-packbufleng,packbufleng,k); @@ -1312,7 +1272,7 @@ void faketimerhandler(void) syncvaltail++; } */ - Net_AddSyncInfoToPacket(&j); + Net_AddSyncData(&j); TRAVERSE_CONNECT(i) if (i != myconnectindex) @@ -1397,7 +1357,7 @@ void faketimerhandler(void) packbuf[j++] = g_player[myconnectindex].syncval[syncvaltail&(MOVEFIFOSIZ-1)]; syncvaltail++; } */ - Net_AddSyncInfoToPacket(&j); + Net_AddSyncData(&j); mmulti_sendpacket(connecthead,packbuf,j); return; @@ -1486,7 +1446,7 @@ void faketimerhandler(void) packbuf[j++] = g_player[myconnectindex].syncval[syncvaltail&(MOVEFIFOSIZ-1)]; syncvaltail++; } */ - Net_AddSyncInfoToPacket(&j); + Net_AddSyncData(&j); for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) if (g_player[i].playerquitflag) @@ -2619,7 +2579,7 @@ static void G_PrintCoords(int32_t snum) else if (ud.multimode > 1) y = 24; } - sprintf(tempbuf,"XYZ= (%d,%d,%d)",g_player[snum].ps->posx,g_player[snum].ps->posy,g_player[snum].ps->posz); + Bsprintf(tempbuf,"XYZ= (%d,%d,%d)",g_player[snum].ps->posx,g_player[snum].ps->posy,g_player[snum].ps->posz); printext256(250L,y,31,-1,tempbuf,0); Bsprintf(tempbuf,"A/H= %d,%d",g_player[snum].ps->ang,g_player[snum].ps->horiz); printext256(250L,y+9L,31,-1,tempbuf,0); @@ -4616,66 +4576,66 @@ void G_DrawRooms(int32_t snum,int32_t smoothratio) static void G_DumpDebugInfo(void) { int32_t i,j,x; - FILE * fp=fopen("debug.con","w"); +// FILE * fp=fopen("condebug.log","w"); for (i=0;i= 0) { - fprintf(fp,"Sprite %d (%d,%d,%d) (picnum: %d)\n",j,sprite[j].x,sprite[j].y,sprite[j].z,sprite[j].picnum); + OSD_Printf("Sprite %d (%d,%d,%d) (picnum: %d)\n",j,sprite[j].x,sprite[j].y,sprite[j].z,sprite[j].picnum); for (i=0;iposx,&g_player[myconnectindex].ps->posy,&g_player[myconnectindex].ps->posz,&g_player[myconnectindex].ps->ang,&g_player[myconnectindex].ps->cursectnum); } @@ -7311,7 +7271,8 @@ PALONLY: t->cstat |= 4; } - if (g_player[screenpeek].ps->heat_amount > 0 && g_player[screenpeek].ps->heat_on && (A_CheckEnemySprite(s) || A_CheckSpriteFlags(t->owner,SPRITE_NVG) || s->picnum == APLAYER || s->statnum == 13)) + if (g_player[screenpeek].ps->heat_amount > 0 && g_player[screenpeek].ps->heat_on && + (A_CheckEnemySprite(s) || A_CheckSpriteFlags(t->owner,SPRITE_NVG) || s->picnum == APLAYER || s->statnum == 13)) { t->pal = 6; t->shade = 0; @@ -7776,7 +7737,7 @@ FOUNDCHEAT: g_player[myconnectindex].ps->cheat_phase = 0; G_DumpDebugInfo(); - Bsprintf(tempbuf,"GAMEVARS DUMPED TO DEBUG.CON"); + Bsprintf(tempbuf,"GAMEVARS DUMPED TO LOG"); G_AddUserQuote(tempbuf); Bsprintf(tempbuf,"MAP DUMPED TO DEBUG.MAP"); G_AddUserQuote(tempbuf); @@ -9798,6 +9759,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv) g_noMusic = 1; initprintf("Music off.\n"); } +/* else if (*c == 'd' || *c == 'D') { FILE * fp=fopen("gamevars.txt","w"); @@ -9806,6 +9768,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv) fclose(fp); initprintf("Game variables saved to gamevars.txt.\n"); } +*/ else { G_ShowParameterHelp(); @@ -12053,7 +12016,7 @@ RECHECK: return 1; } -static int32_t G_MoveLoop() +static inline int32_t G_MoveLoop() { int32_t i; @@ -13464,7 +13427,7 @@ FRAGBONUS: if (playerbest > 0) { - sprintf(tempbuf,"%0*d:%02d.%02d",clockpad, + Bsprintf(tempbuf,"%0*d:%02d.%02d",clockpad, (playerbest/(26*60)), (playerbest/26)%60, ((playerbest%26)*38)/10 @@ -13498,20 +13461,20 @@ FRAGBONUS: bonuscnt++; S_PlaySound(PIPEBOMB_EXPLODE); } - sprintf(tempbuf,"%-3d",g_player[myconnectindex].ps->actors_killed); + Bsprintf(tempbuf,"%-3d",g_player[myconnectindex].ps->actors_killed); gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); yy += 10; if (ud.player_skill > 3) { - sprintf(tempbuf,"N/A"); + Bsprintf(tempbuf,"N/A"); gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); yy += 10; } else { if ((g_player[myconnectindex].ps->max_actors_killed-g_player[myconnectindex].ps->actors_killed) < 0) - sprintf(tempbuf,"%-3d",0); - else sprintf(tempbuf,"%-3d",g_player[myconnectindex].ps->max_actors_killed-g_player[myconnectindex].ps->actors_killed); + Bsprintf(tempbuf,"%-3d",0); + else Bsprintf(tempbuf,"%-3d",g_player[myconnectindex].ps->max_actors_killed-g_player[myconnectindex].ps->actors_killed); gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); yy += 10; } @@ -13535,12 +13498,12 @@ FRAGBONUS: bonuscnt++; S_PlaySound(PIPEBOMB_EXPLODE); } - sprintf(tempbuf,"%-3d",g_player[myconnectindex].ps->secret_rooms); + Bsprintf(tempbuf,"%-3d",g_player[myconnectindex].ps->secret_rooms); gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); yy += 10; if (g_player[myconnectindex].ps->secret_rooms > 0) - sprintf(tempbuf,"%-3d%%",(100*g_player[myconnectindex].ps->secret_rooms/g_player[myconnectindex].ps->max_secret_rooms)); - sprintf(tempbuf,"%-3d",g_player[myconnectindex].ps->max_secret_rooms-g_player[myconnectindex].ps->secret_rooms); + Bsprintf(tempbuf,"%-3d%%",(100*g_player[myconnectindex].ps->secret_rooms/g_player[myconnectindex].ps->max_secret_rooms)); + Bsprintf(tempbuf,"%-3d",g_player[myconnectindex].ps->max_secret_rooms-g_player[myconnectindex].ps->secret_rooms); gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); yy += 10; } diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 02b48a29b..fede48490 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -4884,7 +4884,8 @@ repeatcase: if (j < 0 || j > MAXVOLUMES-1) { - initprintf("%s:%d: error: volume number exceeds maximum volume count.\n",g_szScriptFileName,g_lineNumber); + initprintf("%s:%d: error: volume number exceeds maximum volume count.\n", + g_szScriptFileName,g_lineNumber); g_numCompilerErrors++; while (*textptr != 0x0a && *textptr != 0) textptr++; break; @@ -4898,8 +4899,9 @@ repeatcase: textptr++,i++; if (i >= (signed)sizeof(EpisodeNames[j])-1) { - initprintf("%s:%d: error: volume name exceeds limit of %d characters.\n",g_szScriptFileName,g_lineNumber,sizeof(EpisodeNames[j])-1); - g_numCompilerErrors++; + initprintf("%s:%d: warning: truncating volume name to %d characters.\n", + g_szScriptFileName,g_lineNumber,sizeof(EpisodeNames[j])-1); + g_numCompilerWarnings++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; break; } @@ -4917,7 +4919,8 @@ repeatcase: if (j < 0 || j > NUMGAMEFUNCTIONS-1) { - initprintf("%s:%d: error: function number exceeds number of game functions.\n",g_szScriptFileName,g_lineNumber); + initprintf("%s:%d: error: function number exceeds number of game functions.\n", + g_szScriptFileName,g_lineNumber); g_numCompilerErrors++; while (*textptr != 0x0a && *textptr != 0) textptr++; break; @@ -4932,14 +4935,16 @@ repeatcase: textptr++,i++; if (*textptr == '/' || *textptr == ' ') { - initprintf("%s:%d: warning: invalid character in function name.\n",g_szScriptFileName,g_lineNumber); + initprintf("%s:%d: warning: invalid character in function name.\n", + g_szScriptFileName,g_lineNumber); g_numCompilerWarnings++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; break; } if (i >= MAXGAMEFUNCLEN-1) { - initprintf("%s:%d: warning: function name exceeds limit of %d characters, truncating.\n",g_szScriptFileName,g_lineNumber,MAXGAMEFUNCLEN); + initprintf("%s:%d: warning: truncating function name to %d characters.\n", + g_szScriptFileName,g_lineNumber,MAXGAMEFUNCLEN); g_numCompilerWarnings++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; break; @@ -4966,7 +4971,8 @@ repeatcase: if (j < 0 || j > 4) { - initprintf("%s:%d: error: skill number exceeds maximum skill count.\n",g_szScriptFileName,g_lineNumber); + initprintf("%s:%d: error: skill number exceeds maximum skill count.\n", + g_szScriptFileName,g_lineNumber); g_numCompilerErrors++; while (*textptr != 0x0a && *textptr != 0) textptr++; break; @@ -4980,8 +4986,9 @@ repeatcase: textptr++,i++; if (i >= (signed)sizeof(SkillNames[j])-1) { - initprintf("%s:%d: error: skill name exceeds limit of %d characters.\n",g_szScriptFileName,g_lineNumber,sizeof(SkillNames[j])-1); - g_numCompilerErrors++; + initprintf("%s:%d: warning: truncating skill name to %d characters.\n", + g_szScriptFileName,g_lineNumber,sizeof(SkillNames[j])-1); + g_numCompilerWarnings++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; break; } @@ -5004,8 +5011,9 @@ repeatcase: textptr++,i++; if (i >= (signed)sizeof(gamename)-1) { - initprintf("%s:%d: error: game name exceeds limit of %d characters.\n",g_szScriptFileName,g_lineNumber,sizeof(gamename)-1); - g_numCompilerErrors++; + initprintf("%s:%d: warning: truncating game name to %d characters.\n", + g_szScriptFileName,g_lineNumber,sizeof(gamename)-1); + g_numCompilerWarnings++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; break; } @@ -5058,6 +5066,10 @@ repeatcase: { char temp[BMAX_PATH]; struct stat st; + int32_t fullscreen = ud.config.ScreenMode; + int32_t xdim = ud.config.ScreenWidth, ydim = ud.config.ScreenHeight, bpp = ud.config.ScreenBPP; + int32_t usemouse = ud.config.UseMouse, usejoy = ud.config.UseJoystick; + if (stat(mod_dir, &st) < 0) { if (errno == ENOENT) // path doesn't exist @@ -5080,13 +5092,23 @@ repeatcase: // directory isn't a directory return 0; } + Bstrcpy(temp,tempbuf); CONFIG_WriteSetup(); Bsprintf(setupfilename,"%s/",mod_dir); Bstrcat(setupfilename,temp); + + initprintf("Using config file '%s'.\n",setupfilename); + CONFIG_ReadSetup(); + + ud.config.ScreenMode = fullscreen; + ud.config.ScreenWidth = xdim; + ud.config.ScreenHeight = ydim; + ud.config.ScreenBPP = bpp; + ud.config.UseMouse = usemouse; + ud.config.UseJoystick = usejoy; } - initprintf("Using config file '%s'.\n",setupfilename); } return 0; @@ -5119,8 +5141,9 @@ repeatcase: textptr++,i++; if (i >= (signed)sizeof(GametypeNames[j])-1) { - initprintf("%s:%d: error: gametype name exceeds limit of %d characters.\n",g_szScriptFileName,g_lineNumber,sizeof(GametypeNames[j])-1); - g_numCompilerErrors++; + initprintf("%s:%d: warning: truncating gametype name to %d characters.\n", + g_szScriptFileName,g_lineNumber,sizeof(GametypeNames[j])-1); + g_numCompilerWarnings++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; break; } @@ -5206,8 +5229,9 @@ repeatcase: textptr++,i++; if (i >= 32) { - initprintf("%s:%d: error: level name exceeds limit of %d characters.\n",g_szScriptFileName,g_lineNumber,32); - g_numCompilerErrors++; + initprintf("%s:%d: warning: truncating level name to %d characters.\n", + g_szScriptFileName,g_lineNumber,32); + g_numCompilerWarnings++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; break; } @@ -5288,8 +5312,8 @@ repeatcase: textptr++,i++; if (i >= MAXQUOTELEN-1) { - initprintf("%s:%d: error: quote text exceeds limit of %d characters.\n",g_szScriptFileName,g_lineNumber,MAXQUOTELEN-1); - g_numCompilerErrors++; + initprintf("%s:%d: warning: truncating quote text to %d characters.\n",g_szScriptFileName,g_lineNumber,MAXQUOTELEN-1); + g_numCompilerWarnings++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; break; } @@ -5336,8 +5360,9 @@ repeatcase: textptr++,i++; if (i >= (signed)sizeof(CheatStrings[k])-1) { - initprintf("%s:%d: error: cheat exceeds limit of %d characters.\n",g_szScriptFileName,g_lineNumber,MAXCHEATLEN,sizeof(CheatStrings[k])-1); - g_numCompilerErrors++; + initprintf("%s:%d: warning: truncating cheat string to %d characters.\n", + g_szScriptFileName,g_lineNumber,MAXCHEATLEN,sizeof(CheatStrings[k])-1); + g_numCompilerWarnings++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0 && *textptr != ' ') textptr++; break; } @@ -5936,7 +5961,7 @@ void C_Compile(const char *filenam) { if (g_loadFromGroupOnly) { - sprintf(buf,"Error compiling CON files."); + Bsprintf(buf,"Error compiling CON files."); G_GameExit(buf); } else diff --git a/polymer/eduke32/source/gamevars.c b/polymer/eduke32/source/gamevars.c index 7dcba4e88..dbd0b0241 100644 --- a/polymer/eduke32/source/gamevars.c +++ b/polymer/eduke32/source/gamevars.c @@ -303,46 +303,47 @@ void Gv_WriteSave(FILE *fil) dfwrite(g_szBuf,l,1,fil); } -void Gv_DumpValues(FILE *fp) +void Gv_DumpValues(void) { int32_t i; - if (!fp) - return; - - fprintf(fp,"// Current Game Definitions\n\n"); + OSD_Printf("// Current Game Definitions\n\n"); for (i=0;inext = grpcache; grpcache = fg; - strncpy(fg->name, fname, BMAX_PATH); + Bstrncpy(fg->name, fname, BMAX_PATH); fg->size = fsize; fg->mtime = fmtime; fg->crcval = fcrcval; @@ -157,7 +157,7 @@ int32_t ScanGroups(void) foundgrps = grp; fgg = (struct grpcache *)Bcalloc(1, sizeof(struct grpcache)); - strncpy(fgg->name, sidx->name, BMAX_PATH); + Bstrncpy(fgg->name, sidx->name, BMAX_PATH); fgg->size = st.st_size; fgg->mtime = st.st_mtime; fgg->crcval = crcval; diff --git a/polymer/eduke32/source/jaudiolib/fx_man.c b/polymer/eduke32/source/jaudiolib/fx_man.c index fab0a193d..b644984a6 100644 --- a/polymer/eduke32/source/jaudiolib/fx_man.c +++ b/polymer/eduke32/source/jaudiolib/fx_man.c @@ -659,7 +659,7 @@ int32_t FX_PlayLoopedVOC vol, left, right, priority, callbackval); if (handle < MV_Ok) { - sprintf(tempbuf, "Sound error %d: %s\n",callbackval, FX_ErrorString(FX_Error)); + Bsprintf(tempbuf, "Sound error %d: %s\n",callbackval, FX_ErrorString(FX_Error)); initprintf(tempbuf); FX_SetErrorCode(FX_MultiVocError); handle = FX_Warning; @@ -757,7 +757,7 @@ int32_t FX_PlayLoopedWAV pitchoffset, vol, left, right, priority, callbackval); if (handle < MV_Ok) { - sprintf(tempbuf, "Sound error %d: %s\n",callbackval, FX_ErrorString(FX_Error)); + Bsprintf(tempbuf, "Sound error %d: %s\n",callbackval, FX_ErrorString(FX_Error)); initprintf(tempbuf); FX_SetErrorCode(FX_MultiVocError); handle = FX_Warning; @@ -786,7 +786,7 @@ int32_t FX_PlayLoopedOGG pitchoffset, vol, left, right, priority, callbackval); if (handle < MV_Ok) { - sprintf(tempbuf, "Sound error %d: %s\n",callbackval, FX_ErrorString(FX_Error)); + Bsprintf(tempbuf, "Sound error %d: %s\n",callbackval, FX_ErrorString(FX_Error)); initprintf(tempbuf); FX_SetErrorCode(FX_MultiVocError); handle = FX_Warning; diff --git a/polymer/eduke32/source/jaudiolib/multivoc.c b/polymer/eduke32/source/jaudiolib/multivoc.c index 342f0d3fb..267956414 100644 --- a/polymer/eduke32/source/jaudiolib/multivoc.c +++ b/polymer/eduke32/source/jaudiolib/multivoc.c @@ -2103,7 +2103,7 @@ int32_t MV_PlayWAV(char *ptr, int32_t pitchoffset, int32_t vol, int32_t left, in status = MV_PlayLoopedWAV(ptr, -1, -1, pitchoffset, vol, left, right, priority, callbackval); if (status < MV_Ok) { - sprintf(tempbuf, "Sound error %d: %s\n",callbackval, FX_ErrorString(FX_Error)); + Bsprintf(tempbuf, "Sound error %d: %s\n",callbackval, FX_ErrorString(FX_Error)); initprintf(tempbuf); } @@ -2325,7 +2325,7 @@ int32_t MV_PlayVOC(char *ptr, int32_t pitchoffset, int32_t vol, int32_t left, in status = MV_PlayLoopedVOC(ptr, -1, -1, pitchoffset, vol, left, right, priority, callbackval); if (status < MV_Ok) { - sprintf(tempbuf, "Sound error %d: %s\n",callbackval, FX_ErrorString(FX_Error)); + Bsprintf(tempbuf, "Sound error %d: %s\n",callbackval, FX_ErrorString(FX_Error)); initprintf(tempbuf); } @@ -2503,7 +2503,7 @@ int32_t MV_PlayOGG(char *ptr, int32_t pitchoffset, int32_t vol, int32_t left, in status = MV_PlayLoopedOGG(ptr, -1, -1, pitchoffset, vol, left, right, priority, callbackval); if (status < MV_Ok) { - sprintf(tempbuf, "Sound error %d: %s\n",callbackval, FX_ErrorString(FX_Error)); + Bsprintf(tempbuf, "Sound error %d: %s\n",callbackval, FX_ErrorString(FX_Error)); initprintf(tempbuf); } diff --git a/polymer/eduke32/source/jmact/scriplib.c b/polymer/eduke32/source/jmact/scriplib.c index ffa392f0f..8ca34ed2c 100644 --- a/polymer/eduke32/source/jmact/scriplib.c +++ b/polymer/eduke32/source/jmact/scriplib.c @@ -429,7 +429,7 @@ int32 SCRIPT_Init(char * name) { int32 h = SCRIPT_New(); - if (h >= 0) strncpy(SCRIPT(h,scriptfilename), name, 127); + if (h >= 0) Bstrncpy(SCRIPT(h,scriptfilename), name, 127); return h; } @@ -903,8 +903,8 @@ void SCRIPT_PutNumber char raw[64]; UNREFERENCED_PARAMETER(defaultvalue); - if (hexadecimal) sprintf(raw, "0x%X", number); - else sprintf(raw, "%d", number); + if (hexadecimal) Bsprintf(raw, "0x%X", number); + else Bsprintf(raw, "%d", number); SCRIPT_AddEntry(scripthandle, sectionname, entryname, raw); } @@ -936,7 +936,7 @@ void SCRIPT_PutDouble char raw[64]; UNREFERENCED_PARAMETER(defaultvalue); - sprintf(raw, "%g", number); + Bsprintf(raw, "%g", number); SCRIPT_AddEntry(scripthandle, sectionname, entryname, raw); } diff --git a/polymer/eduke32/source/mdump.cpp b/polymer/eduke32/source/mdump.cpp index 4a754f1e6..f4c91ec00 100644 --- a/polymer/eduke32/source/mdump.cpp +++ b/polymer/eduke32/source/mdump.cpp @@ -57,7 +57,7 @@ LONG MiniDumper::TopLevelFilter( struct _EXCEPTION_POINTERS *pExceptionInfo ) /*if (!GetTempPath( _MAX_PATH, szDumpPath )) _tcscpy( szDumpPath, "c:\\temp\\" ); */ - sprintf(szDumpPath,"%s_%u",m_szAppName,timeGetTime()); + Bsprintf(szDumpPath,"%s_%u",m_szAppName,timeGetTime()); _tcscat( szDumpPath, ".dmp" ); // ask the user if they want to save a dump file @@ -79,20 +79,20 @@ LONG MiniDumper::TopLevelFilter( struct _EXCEPTION_POINTERS *pExceptionInfo ) BOOL bOK = pDump( GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpNormal, &ExInfo, NULL, NULL ); if (bOK) { - sprintf( szScratch, "Saved dump file to '%s'", szDumpPath ); + Bsprintf( szScratch, "Saved dump file to '%s'", szDumpPath ); szResult = szScratch; retval = EXCEPTION_EXECUTE_HANDLER; } else { - sprintf( szScratch, "Failed to save dump file to '%s' (error %d)", szDumpPath, GetLastError() ); + Bsprintf( szScratch, "Failed to save dump file to '%s' (error %d)", szDumpPath, GetLastError() ); szResult = szScratch; } ::CloseHandle(hFile); } else { - sprintf( szScratch, "Failed to create dump file '%s' (error %d)", szDumpPath, GetLastError() ); + Bsprintf( szScratch, "Failed to create dump file '%s' (error %d)", szDumpPath, GetLastError() ); szResult = szScratch; } } diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index b530312d2..433bfc3d1 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -1279,7 +1279,7 @@ void M_DisplayMenus(void) mgametext(160,90,"LOAD last game:",0,2+8+16); - sprintf(tempbuf,"\"%s\"",ud.savegame[g_lastSaveSlot]); + Bsprintf(tempbuf,"\"%s\"",ud.savegame[g_lastSaveSlot]); mgametext(160,99,tempbuf,0,2+8+16); mgametext(160,99+9,"(Y/N)",0,2+8+16); @@ -1444,17 +1444,17 @@ void M_DisplayMenus(void) M_DisplaySaveGameList(); - sprintf(tempbuf,"PLAYERS: %-2d ",savehead.numplr); + Bsprintf(tempbuf,"PLAYERS: %-2d ",savehead.numplr); mgametext(160,156,tempbuf,0,2+8+16); - sprintf(tempbuf,"EPISODE: %-2d / LEVEL: %-2d / SKILL: %-2d",1+savehead.volnum,1+savehead.levnum,savehead.plrskl); + Bsprintf(tempbuf,"EPISODE: %-2d / LEVEL: %-2d / SKILL: %-2d",1+savehead.volnum,1+savehead.levnum,savehead.plrskl); mgametext(160,168,tempbuf,0,2+8+16); if (savehead.volnum == 0 && savehead.levnum == 7) mgametext(160,180,savehead.boardfn,0,2+8+16); mgametext(160,90,"LOAD game:",0,2+8+16); - sprintf(tempbuf,"\"%s\"",ud.savegame[g_currentMenu-1000]); + Bsprintf(tempbuf,"\"%s\"",ud.savegame[g_currentMenu-1000]); mgametext(160,99,tempbuf,0,2+8+16); mgametext(160,99+9,"(Y/N)",0,2+8+16); @@ -1571,10 +1571,10 @@ void M_DisplayMenus(void) menutext(160,24,0,0,"SAVE GAME"); rotatesprite(101<<16,97<<16,65536L>>1,512,TILE_LOADSHOT,-32,0,4+10+64,0,0,xdim-1,ydim-1); - sprintf(tempbuf,"PLAYERS: %-2d ",ud.multimode); + Bsprintf(tempbuf,"PLAYERS: %-2d ",ud.multimode); mgametext(160,156,tempbuf,0,2+8+16); - sprintf(tempbuf,"EPISODE: %-2d / LEVEL: %-2d / SKILL: %-2d",1+ud.volume_number,1+ud.level_number,ud.player_skill); + Bsprintf(tempbuf,"EPISODE: %-2d / LEVEL: %-2d / SKILL: %-2d",1+ud.volume_number,1+ud.level_number,ud.player_skill); mgametext(160,168,tempbuf,0,2+8+16); if (ud.volume_number == 0 && ud.level_number == 7) @@ -2493,7 +2493,7 @@ cheat_for_port_credits: else if (glanisotropy < 1) glanisotropy = (int32_t)glinfo.maxanisotropy; gltexapplyprops(); if (glanisotropy == 1) strcpy(tempbuf,"NONE"); - else sprintf(tempbuf,"%dx",glanisotropy); + else Bsprintf(tempbuf,"%dx",glanisotropy); mgametextpal(d,yy, tempbuf, MENUHIGHLIGHT(io), 0); break; } @@ -3394,7 +3394,7 @@ cheat_for_port_credits: } menutext(c,50,MENUHIGHLIGHT(0),0,"RESOLUTION"); - sprintf(tempbuf,"%d x %d", + Bsprintf(tempbuf,"%d x %d", (newvidmode==validmodecnt)?xdim:validmode[newvidmode].xdim, (newvidmode==validmodecnt)?ydim:validmode[newvidmode].ydim); mgametext(c+168,50-8,tempbuf,MENUHIGHLIGHT(0),2+8+16); @@ -3580,7 +3580,7 @@ cheat_for_port_credits: menutext(320>>1,24,0,0,"KEYBOARD SETUP"); mgametext(320>>1,90,"PRESS THE KEY TO ASSIGN AS",0,2+8+16); - sprintf(tempbuf,"%s FOR \"%s\"", whichkey?"SECONDARY":"PRIMARY", CONFIG_FunctionNumToName(function)); + Bsprintf(tempbuf,"%s FOR \"%s\"", whichkey?"SECONDARY":"PRIMARY", CONFIG_FunctionNumToName(function)); mgametext(320>>1,90+9,tempbuf,0,2+8+16); mgametext(320>>1,90+9+9+9,"PRESS \"ESCAPE\" TO CANCEL",0,2+8+16); @@ -3840,7 +3840,7 @@ cheat_for_port_credits: if (function == 0) { if (whichkey < (MAXMOUSEBUTTONS-2)*2) - sprintf(tempbuf,"TO %s%s", (whichkey&1)?"DOUBLE-CLICKED ":"", mousebuttonnames[whichkey>>1]); + Bsprintf(tempbuf,"TO %s%s", (whichkey&1)?"DOUBLE-CLICKED ":"", mousebuttonnames[whichkey>>1]); else Bstrcpy(tempbuf, mousebuttonnames[whichkey-(MAXMOUSEBUTTONS-2)]); } @@ -4125,7 +4125,7 @@ cheat_for_port_credits: { if (m+l < 2*joynumbuttons) { - sprintf(tempbuf, "%s%s", ((l+m)&1)?"Double ":"", getjoyname(1,(l+m)>>1)); + Bsprintf(tempbuf, "%s%s", ((l+m)&1)?"Double ":"", getjoyname(1,(l+m)>>1)); x = ud.config.JoystickFunctions[(l+m)>>1][(l+m)&1]; } else @@ -4133,7 +4133,7 @@ cheat_for_port_credits: static char *directions[] = { "Up", "Right", "Down", "Left" }; - sprintf(tempbuf, "Hat %s", directions[(l+m)-2*joynumbuttons]); + Bsprintf(tempbuf, "Hat %s", directions[(l+m)-2*joynumbuttons]); x = ud.config.JoystickFunctions[joynumbuttons + ((l+m)-2*joynumbuttons)][0]; } minitextshade(80-4,33+l*8,tempbuf,(m+l == probey)?0:16,1,10+16); @@ -4337,7 +4337,7 @@ cheat_for_port_credits: if (joynumaxes > 2) { menutext(320>>1,twothispage?158:108,SHX(-10),(joynumaxes<=2),"NEXT..."); - sprintf(tempbuf,"Page %d of %d",thispage+1,(joynumaxes+1)/2); + Bsprintf(tempbuf,"Page %d of %d",thispage+1,(joynumaxes+1)/2); mgametext(320-100,158,tempbuf,0,2+8+16); } break; @@ -4401,7 +4401,7 @@ cheat_for_port_credits: if (joynumaxes>4) { menutext(32,48+30*(last-first),0,0,"NEXT..."); - sprintf(tempbuf,"Page %d of %d", 1+(g_currentMenu-213), (joynumaxes+3)/4); + Bsprintf(tempbuf,"Page %d of %d", 1+(g_currentMenu-213), (joynumaxes+3)/4); mgametext(320-100,158,tempbuf,0,2+8+16); } break; @@ -4715,9 +4715,9 @@ cheat_for_port_credits: if (g_currentMenu >= 360 && g_currentMenu <= 369) { - sprintf(tempbuf,"PLAYERS: %-2d ",ud.multimode); + Bsprintf(tempbuf,"PLAYERS: %-2d ",ud.multimode); mgametext(160,156,tempbuf,0,2+8+16); - sprintf(tempbuf,"EPISODE: %-2d / LEVEL: %-2d / SKILL: %-2d",1+ud.volume_number,1+ud.level_number,ud.player_skill); + Bsprintf(tempbuf,"EPISODE: %-2d / LEVEL: %-2d / SKILL: %-2d",1+ud.volume_number,1+ud.level_number,ud.player_skill); mgametext(160,168,tempbuf,0,2+8+16); if (ud.volume_number == 0 && ud.level_number == 7) mgametext(160,180,currentboardfilename,0,2+8+16); @@ -4782,9 +4782,9 @@ cheat_for_port_credits: } rotatesprite(101<<16,97<<16,65536L>>1,512,TILE_LOADSHOT,-32,0,4+10+64,0,0,xdim-1,ydim-1); - sprintf(tempbuf,"PLAYERS: %-2d ",savehead.numplr); + Bsprintf(tempbuf,"PLAYERS: %-2d ",savehead.numplr); mgametext(160,156,tempbuf,0,2+8+16); - sprintf(tempbuf,"EPISODE: %-2d / LEVEL: %-2d / SKILL: %-2d",1+savehead.volnum,1+savehead.levnum,savehead.plrskl); + Bsprintf(tempbuf,"EPISODE: %-2d / LEVEL: %-2d / SKILL: %-2d",1+savehead.volnum,1+savehead.levnum,savehead.plrskl); mgametext(160,168,tempbuf,0,2+8+16); if (savehead.volnum == 0 && savehead.levnum == 7) mgametext(160,180,savehead.boardfn,0,2+8+16); @@ -4801,9 +4801,9 @@ cheat_for_port_credits: rotatesprite(101<<16,97<<16,65536L>>1,512,TILE_LOADSHOT,-32,0,4+10+64,0,0,xdim-1,ydim-1); } else menutext(69,70,0,0,"EMPTY"); - sprintf(tempbuf,"PLAYERS: %-2d ",ud.multimode); + Bsprintf(tempbuf,"PLAYERS: %-2d ",ud.multimode); mgametext(160,156,tempbuf,0,2+8+16); - sprintf(tempbuf,"EPISODE: %-2d / LEVEL: %-2d / SKILL: %-2d",1+ud.volume_number,1+ud.level_number,ud.player_skill); + Bsprintf(tempbuf,"EPISODE: %-2d / LEVEL: %-2d / SKILL: %-2d",1+ud.volume_number,1+ud.level_number,ud.player_skill); mgametext(160,168,tempbuf,0,2+8+16); if (ud.volume_number == 0 && ud.level_number == 7) mgametext(160,180,currentboardfilename,0,2+8+16); @@ -5069,7 +5069,7 @@ VOLUME_ALL_40x: rotatesprite(160<<16,29<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); menutext(320>>1,34,0,0,&g_player[myconnectindex].user_name[0]); - sprintf(tempbuf,"Waiting for master"); + Bsprintf(tempbuf,"Waiting for master"); mgametext(160,50,tempbuf,0,2+8+16); mgametext(160,59,"to select level",0,2+8+16); @@ -5368,16 +5368,16 @@ VOLUME_ALL_40x: if (VOLUMEONE) { - sprintf(tempbuf,"EPISODE %d",ud.m_volume_number+1); + Bsprintf(tempbuf,"EPISODE %d",ud.m_volume_number+1); menutext(c,57+16-9,MENUHIGHLIGHT(1),1,tempbuf); } else { - sprintf(tempbuf,"EPISODE %d",ud.m_volume_number+1); + Bsprintf(tempbuf,"EPISODE %d",ud.m_volume_number+1); menutext(c,57+16-9,MENUHIGHLIGHT(1),PHX(-3),tempbuf); } - sprintf(tempbuf,"LEVEL %d",ud.m_level_number+1); + Bsprintf(tempbuf,"LEVEL %d",ud.m_level_number+1); menutext(c,57+16+16-9,MENUHIGHLIGHT(2),PHX(-4),tempbuf); menutext(c,57+16+16+16-9,MENUHIGHLIGHT(3),PHX(-5),"MONSTERS"); diff --git a/polymer/eduke32/source/rts.c b/polymer/eduke32/source/rts.c index 4d4355958..b8a6dfa2a 100644 --- a/polymer/eduke32/source/rts.c +++ b/polymer/eduke32/source/rts.c @@ -119,7 +119,7 @@ int32 RTS_AddFile(const char *filename) lump_p->handle = handle; lump_p->position = IntelLong(fileinfo->filepos); lump_p->size = IntelLong(fileinfo->size); - strncpy(lump_p->name, fileinfo->name, 8); + Bstrncpy(lump_p->name, fileinfo->name, 8); } free(fileinfoo); diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c index 550f710b8..c9d96f74e 100644 --- a/polymer/eduke32/source/sounds.c +++ b/polymer/eduke32/source/sounds.c @@ -70,7 +70,7 @@ void S_SoundStartup(void) if (status != FX_Ok) { - sprintf(tempbuf, "Sound startup error: %s", FX_ErrorString(FX_Error)); + Bsprintf(tempbuf, "Sound startup error: %s", FX_ErrorString(FX_Error)); G_GameExit(tempbuf); } } @@ -94,7 +94,7 @@ void S_SoundShutdown(void) status = FX_Shutdown(); if (status != FX_Ok) { - sprintf(tempbuf, "Sound shutdown error: %s", FX_ErrorString(FX_Error)); + Bsprintf(tempbuf, "Sound shutdown error: %s", FX_ErrorString(FX_Error)); G_GameExit(tempbuf); } } diff --git a/polymer/eduke32/source/startgtk.game.c b/polymer/eduke32/source/startgtk.game.c index 0314794ec..5ef82b31e 100644 --- a/polymer/eduke32/source/startgtk.game.c +++ b/polymer/eduke32/source/startgtk.game.c @@ -760,7 +760,7 @@ int32_t startwin_run(void) settings.usemouse = ud.config.UseMouse; settings.usejoy = ud.config.UseJoystick; settings.game = g_gameType; - strncpy(settings.selectedgrp, duke3dgrp, BMAX_PATH); + Bstrncpy(settings.selectedgrp, duke3dgrp, BMAX_PATH); PopulateForm(-1); gtk_main(); diff --git a/polymer/eduke32/source/startwin.game.c b/polymer/eduke32/source/startwin.game.c index bb6119f61..36edfaf96 100644 --- a/polymer/eduke32/source/startwin.game.c +++ b/polymer/eduke32/source/startwin.game.c @@ -634,7 +634,7 @@ int32_t startwin_run(void) settings.usejoy = ud.config.UseJoystick; settings.game = g_gameType; // settings.crcval = 0; - strncpy(settings.selectedgrp, duke3dgrp, BMAX_PATH); + Bstrncpy(settings.selectedgrp, duke3dgrp, BMAX_PATH); settings.gamedir = mod_dir; PopulateForm(-1); diff --git a/polymer/eduke32/source/sync.c b/polymer/eduke32/source/sync.c index 5b04d3288..755bacae0 100644 --- a/polymer/eduke32/source/sync.c +++ b/polymer/eduke32/source/sync.c @@ -271,7 +271,7 @@ void Net_DisplaySyncMsg(void) { if (g_numSyncBytes > 1) { - sprintf(tempbuf, "Out Of Sync - %s", SyncNames[i]); + Bsprintf(tempbuf, "Out Of Sync - %s", SyncNames[i]); printext256(4L, 100L + (i * 8), 31, 1, tempbuf, 0); } @@ -287,7 +287,7 @@ void Net_DisplaySyncMsg(void) { if (syncstat[j] != 0 && g_szfirstSyncMsg[j][0] == '\0') { - sprintf(tempbuf, "Out Of Sync - %s", SyncNames[j]); + Bsprintf(tempbuf, "Out Of Sync - %s", SyncNames[j]); strcpy(g_szfirstSyncMsg[j], tempbuf); } } @@ -302,9 +302,9 @@ void Net_DisplaySyncMsg(void) { if (g_numSyncBytes > 1) { - sprintf(tempbuf, "FIRST %s", g_szfirstSyncMsg[i]); + Bsprintf(tempbuf, "FIRST %s", g_szfirstSyncMsg[i]); printext256(4L, 44L + (i * 8), 31, 1, tempbuf, 0); - sprintf(tempbuf, "moveCount %d",moveCount); + Bsprintf(tempbuf, "moveCount %d",moveCount); printext256(4L, 52L + (i * 8), 31, 1, tempbuf, 0); } else @@ -319,7 +319,7 @@ void Net_DisplaySyncMsg(void) } -void Net_AddSyncInfoToPacket(int32_t *j) +static inline void Net_AddSyncData(int32_t *j) { int32_t sb; int32_t count = 0; @@ -334,7 +334,7 @@ void Net_AddSyncInfoToPacket(int32_t *j) } } -void Net_GetSyncInfoFromPacket(char *packbuf, int32_t packbufleng, int32_t *j, int32_t otherconnectindex) +void Net_GetSyncData(char *packbuf, int32_t packbufleng, int32_t *j, int32_t otherconnectindex) { int32_t sb, i; extern int32_t syncvaltail, syncvaltottail; diff --git a/polymer/eduke32/source/wrapper.c b/polymer/eduke32/source/wrapper.c index f49a7d5f7..e50076542 100644 --- a/polymer/eduke32/source/wrapper.c +++ b/polymer/eduke32/source/wrapper.c @@ -44,9 +44,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst, LPSTR lpCmdLine, in CmdLine[i] = '\0'; } - if (szFileName[0] != '\0' && CmdLine[0] != '\0') sprintf(sCmdLine,"eduke32.exe %s -rmnet %s",CmdLine,szFileName); - else if (CmdLine[0] != '\0') sprintf(sCmdLine,"eduke32.exe %s",CmdLine); - else sprintf(sCmdLine,"eduke32.exe"); + if (szFileName[0] != '\0' && CmdLine[0] != '\0') Bsprintf(sCmdLine,"eduke32.exe %s -rmnet %s",CmdLine,szFileName); + else if (CmdLine[0] != '\0') Bsprintf(sCmdLine,"eduke32.exe %s",CmdLine); + else Bsprintf(sCmdLine,"eduke32.exe"); szCmdLine = sCmdLine;