git-svn-id: https://svn.eduke32.com/eduke32@1221 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2009-02-02 01:49:14 +00:00
parent 8f0b228f1a
commit 768f3ad6d6
28 changed files with 297 additions and 300 deletions

View file

@ -48,9 +48,11 @@ void gltexinvalidateall(void);
void gltexinvalidate8(void); void gltexinvalidate8(void);
int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, char *name, char fontsize); 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 // Depth peeling control
extern int32_t r_curpeel; extern int32_t r_curpeel;
extern float curpolygonoffset;
extern int32_t peelcompiling; extern int32_t peelcompiling;
// Depth peeling data // Depth peeling data
@ -58,6 +60,7 @@ extern GLuint ztexture[3];
extern GLuint *peels; extern GLuint *peels;
extern GLuint *peelfbos; extern GLuint *peelfbos;
extern GLuint peelprogram[2]; extern GLuint peelprogram[2];
*/
extern int32_t cachefilehandle; extern int32_t cachefilehandle;
extern FILE *cacheindexptr; extern FILE *cacheindexptr;

View file

@ -337,7 +337,7 @@ int32_t app_main(int32_t argc, const char **argv)
} }
if (!boardfilename[0]) if (!boardfilename[0])
{ {
strncpy(boardfilename, argv[i], BMAX_PATH-4-1); Bstrncpy(boardfilename, argv[i], BMAX_PATH-4-1);
boardfilename[i-BMAX_PATH] = 0; boardfilename[i-BMAX_PATH] = 0;
} }
} }
@ -5641,7 +5641,7 @@ int32_t menuselect(void)
} }
else 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"); grponlymode?"GRP-only ":"", grponlymode?"all files":"GRP contents only");
} }
printext16(halfxdim16-(8*strlen(buffer)/2), 4, editorcolors[12],editorcolors[0],buffer,0); 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 int32_t c = (dir->type == CACHE1D_FIND_DIR ? 2 : 3); //PK
memset(buffer,0,sizeof(buffer)); memset(buffer,0,sizeof(buffer));
strncpy(buffer,dir->name,25); Bstrncpy(buffer,dir->name,25);
if (strlen(buffer) == 25) if (strlen(buffer) == 25)
buffer[21] = buffer[22] = buffer[23] = '.', buffer[24] = 0; buffer[21] = buffer[22] = buffer[23] = '.', buffer[24] = 0;
if (dir == finddirshigh) if (dir == finddirshigh)

View file

@ -167,7 +167,7 @@ char *Bstrcpy(char *dest, const char *src)
char *Bstrncpy(char *dest, const char *src, bsize_t n) 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) 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); fn = (char *)malloc(strlen(dirr->name) + 1 + dirr->info.namlen + 1);
if (fn) if (fn)
{ {
sprintf(fn,"%s/%s",dirr->name,dirr->info.name); Bsprintf(fn,"%s/%s",dirr->name,dirr->info.name);
if (!stat(fn, &st)) if (!stat(fn, &st))
{ {
dirr->info.mode = st.st_mode; dirr->info.mode = st.st_mode;

View file

@ -996,7 +996,7 @@ int32_t wallfront(int32_t l1, int32_t l2)
// //
// spritewallfront (internal) // spritewallfront (internal)
// //
static int32_t spritewallfront(spritetype *s, int32_t w) static inline int32_t spritewallfront(spritetype *s, int32_t w)
{ {
walltype *wal; walltype *wal;
int32_t x1, y1; int32_t x1, y1;
@ -1061,7 +1061,7 @@ static int32_t spriteobstructswall(spritetype *s, int32_t w)
// //
// bunchfront (internal) // 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; 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) // 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; int32_t xl, r, s;
@ -1101,7 +1101,7 @@ static void hline(int32_t xr, int32_t yp)
// //
// slowhline (internal) // 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; int32_t xl, r;
@ -1206,7 +1206,7 @@ static void prepwall(int32_t z, walltype *wal)
// //
// animateoffs (internal) // 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; int32_t i, k, offs;
@ -2084,7 +2084,7 @@ static void transmaskvline2(int32_t x)
// //
// transmaskwallscan (internal) // transmaskwallscan (internal)
// //
static void transmaskwallscan(int32_t x1, int32_t x2) static inline void transmaskwallscan(int32_t x1, int32_t x2)
{ {
int32_t x; int32_t x;
@ -2109,7 +2109,7 @@ static void transmaskwallscan(int32_t x1, int32_t x2)
// //
// ceilspritehline (internal) // 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; int32_t x1, v, bx, by;
@ -2139,7 +2139,7 @@ static void ceilspritehline(int32_t x2, int32_t y)
// //
// ceilspritescan (internal) // 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; int32_t x, y1, y2, twall, bwall;
@ -6074,6 +6074,7 @@ int32_t sameside(_equation* eq, _point2d* p1, _point2d* p2)
return (0); return (0);
} }
/*
#ifdef USE_OPENGL #ifdef USE_OPENGL
void drawpeel(int32_t peel) void drawpeel(int32_t peel)
{ {
@ -6090,6 +6091,7 @@ void drawpeel(int32_t peel)
bglEnd(); bglEnd();
} }
#endif #endif
*/
// //
// drawmasks // drawmasks
@ -6136,7 +6138,7 @@ killsprite:
} }
#ifdef USE_OPENGL #ifdef USE_OPENGL
if ((!r_depthpeeling) || (rendmode < 3)) // if ((!r_depthpeeling) || (rendmode < 3))
#endif #endif
{ {
@ -6215,7 +6217,7 @@ killsprite:
}*/ }*/
#if defined(USE_OPENGL) && defined(POLYMOST) #if defined(USE_OPENGL) && defined(POLYMOST)
if ((!r_depthpeeling) || (rendmode < 3)) // if ((!r_depthpeeling) || (rendmode < 3))
#endif #endif
{ {
#if defined(USE_OPENGL) && defined(POLYMOST) #if defined(USE_OPENGL) && defined(POLYMOST)
@ -6285,6 +6287,7 @@ killsprite:
#endif #endif
} /* depthpeeling */ } /* depthpeeling */
#if defined(USE_OPENGL) && defined(POLYMOST) #if defined(USE_OPENGL) && defined(POLYMOST)
/*
else else
{ {
curpolygonoffset = 0; curpolygonoffset = 0;
@ -6299,9 +6302,11 @@ killsprite:
if (totalclock >= lastcullcheck + CULL_DELAY) if (totalclock >= lastcullcheck + CULL_DELAY)
lastcullcheck = (totalclock + CULL_DELAY); lastcullcheck = (totalclock + CULL_DELAY);
} }
*/
#endif #endif
#if defined(USE_OPENGL) && defined(POLYMOST) #if defined(USE_OPENGL) && defined(POLYMOST)
/*
if ((r_depthpeeling) && (rendmode >= 3)) if ((r_depthpeeling) && (rendmode >= 3))
{ {
bglPopAttrib(); bglPopAttrib();
@ -6402,6 +6407,7 @@ killsprite:
bglDeleteLists(1, 1); bglDeleteLists(1, 1);
} }
*/
#endif #endif
indrawroomsandmasks = 0; indrawroomsandmasks = 0;

View file

@ -618,7 +618,7 @@ int32_t mdloadskin_trytexcache(char *fn, int32_t len, int32_t pal, char effect,
// *(cp++) = '/'; // *(cp++) = '/';
cp = cachefn; cp = cachefn;
for (fp = 0; fp < 16; phex(mdsum[fp++], cp), cp+=2); 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); // fil = kopen4load(cachefn, 0);
// if (fil < 0) return -1; // if (fil < 0) return -1;
@ -1704,14 +1704,14 @@ static int32_t md3draw(md3model_t *m, spritetype *tspr)
float al = 0.0; float al = 0.0;
if (alphahackarray[globalpicnum] != 0) if (alphahackarray[globalpicnum] != 0)
al=alphahackarray[globalpicnum]; al=alphahackarray[globalpicnum];
if (!peelcompiling) /*if (!peelcompiling)*/
bglEnable(GL_BLEND); bglEnable(GL_BLEND);
bglEnable(GL_ALPHA_TEST); bglEnable(GL_ALPHA_TEST);
bglAlphaFunc(GL_GREATER,al); bglAlphaFunc(GL_GREATER,al);
} }
else 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]); bglColor4f(pc[0],pc[1],pc[2],pc[3]);
//if (m->head.flags == 1337) //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 //i = mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,surfi); //hack for testing multiple surfaces per MD3
bglBindTexture(GL_TEXTURE_2D, i); 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); i = mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,DETAILPAL,surfi);
else else
i = 0; i = 0;
@ -1845,7 +1845,7 @@ static int32_t md3draw(md3model_t *m, spritetype *tspr)
bglMatrixMode(GL_MODELVIEW); 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); i = mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,GLOWPAL,surfi);
else else
i = 0; i = 0;
@ -1887,7 +1887,7 @@ static int32_t md3draw(md3model_t *m, spritetype *tspr)
indexhandle = m->vindexes; indexhandle = m->vindexes;
//PLAG: delayed polygon-level sorted rendering //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--) 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; 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; } if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; }
else pc[3] = 1.0; 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 //transform to Build coords

View file

@ -670,7 +670,7 @@ static const char *win32netstrerror(void)
static char *static_ipstring(int32_t ip) static char *static_ipstring(int32_t ip)
{ {
static char s[16]; 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); return(s);
} }

View file

@ -152,11 +152,11 @@ static int32_t fullbrightloadingpass = 0;
static int32_t fullbrightdrawingpass = 0; static int32_t fullbrightdrawingpass = 0;
static int32_t shadeforfullbrightpass; static int32_t shadeforfullbrightpass;
/*
// Depth peeling control // Depth peeling control
int32_t r_depthpeeling = 0; // cvar toggling general depth peeling usage 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_peelscount = 5; // cvar controlling the number of peeling layers
int32_t r_curpeel = -1; // cvar controlling the display of independant 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 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 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 *peels; // peels identifiers
GLuint *peelfbos; // peels FBOs identifiers GLuint *peelfbos; // peels FBOs identifiers
GLuint peelprogram[2]; // ARBfp peeling fragment program GLuint peelprogram[2]; // ARBfp peeling fragment program
*/
float curpolygonoffset; // internal polygon offset stack for drawing flat sprites to avoid depth fighting
// Detail mapping cvar // Detail mapping cvar
int32_t r_detailmapping = 1; int32_t r_detailmapping = 1;
@ -503,7 +506,7 @@ tryart:
return(pth); 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)); int32_t j = (dapicnum&(GLTEXCACHEADSIZ-1));
pthtyp *pth; pthtyp *pth;
@ -697,6 +700,7 @@ void polymost_glreset()
glox1 = -1; glox1 = -1;
// Depth peeling cleanup // Depth peeling cleanup
/*
if (peels) if (peels)
{ {
bglDeleteProgramsARB(2, peelprogram); bglDeleteProgramsARB(2, peelprogram);
@ -708,6 +712,7 @@ void polymost_glreset()
peels = NULL; peels = NULL;
} }
*/
if (cachefilehandle != -1) if (cachefilehandle != -1)
{ {
@ -740,6 +745,7 @@ void polymost_glinit()
{ {
GLfloat col[4]; GLfloat col[4];
int32_t i; int32_t i;
/*
char notpeeledprogramstring[] = char notpeeledprogramstring[] =
"!!ARBfp1.0\n" "!!ARBfp1.0\n"
"OPTION ARB_fog_exp2;\n" "OPTION ARB_fog_exp2;\n"
@ -767,6 +773,7 @@ void polymost_glinit()
"TEX texsample, fragment.texcoord[0], texture[0], 2D;\n" "TEX texsample, fragment.texcoord[0], texture[0], 2D;\n"
"MUL result.color, fragment.color, texsample;\n" "MUL result.color, fragment.color, texsample;\n"
"END\n"; "END\n";
*/
if (!Bstrcmp(glinfo.vendor, "NVIDIA Corporation")) if (!Bstrcmp(glinfo.vendor, "NVIDIA Corporation"))
{ {
@ -796,11 +803,13 @@ void polymost_glinit()
bglEnable(GL_MULTISAMPLE_ARB); bglEnable(GL_MULTISAMPLE_ARB);
} }
/*
if (r_depthpeeling && (!glinfo.arbfp || !glinfo.depthtex || !glinfo.shadow || !glinfo.fbos || !glinfo.rect || !glinfo.multitex)) 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"); OSD_Printf("Your OpenGL implementation doesn't support depth peeling. Disabling...\n");
r_depthpeeling = 0; r_depthpeeling = 0;
} }
*/
if (r_detailmapping && (!glinfo.multitex || !glinfo.envcombine)) if (r_detailmapping && (!glinfo.multitex || !glinfo.envcombine))
{ {
@ -821,6 +830,7 @@ void polymost_glinit()
} }
//depth peeling initialization //depth peeling initialization
/*
if (r_depthpeeling) if (r_depthpeeling)
{ {
if (newpeelscount) if (newpeelscount)
@ -891,6 +901,7 @@ void polymost_glinit()
bglBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, peelprogram[1]); bglBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, peelprogram[1]);
bglProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(peeledprogramstring), peeledprogramstring); bglProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(peeledprogramstring), peeledprogramstring);
} }
*/
bglEnableClientState(GL_VERTEX_ARRAY); bglEnableClientState(GL_VERTEX_ARRAY);
bglEnableClientState(GL_TEXTURE_COORD_ARRAY); bglEnableClientState(GL_TEXTURE_COORD_ARRAY);
@ -1406,7 +1417,7 @@ static int32_t LoadCacheOffsets(void)
} }
else else
{ {
strncpy(curcacheindex->name, fname, BMAX_PATH); Bstrncpy(curcacheindex->name, fname, BMAX_PATH);
curcacheindex->offset = foffset; curcacheindex->offset = foffset;
curcacheindex->len = fsize; curcacheindex->len = fsize;
curcacheindex->next = Bcalloc(1, sizeof(texcacheindex)); 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; char cachefn[BMAX_PATH], *cp;
uint8_t mdsum[16]; uint8_t mdsum[16];
if (!glinfo.texcompr || !glusetexcompr || !glusetexcache || !cacheindexptr || cachefilehandle < 0) return -1; if (!glusetexcompr || !glusetexcache || !cacheindexptr || cachefilehandle < 0) return -1;
if (!bglCompressedTexImage2DARB || !bglGetCompressedTexImageARB) if (!glinfo.texcompr || !bglCompressedTexImage2DARB || !bglGetCompressedTexImageARB)
{ {
// lacking the necessary extensions to do this // lacking the necessary extensions to do this
OSD_Printf("Warning: the GL driver lacks necessary functions to use caching\n"); 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); for (fp = 0; fp < 16; phex(mdsum[fp++], cp), cp+=2);
Bsprintf(cp, "-%x-%x%x", len, dameth, effect); Bsprintf(cp, "-%x-%x%x", len, dameth, effect);
// fil = kopen4load(cachefn, 0);
// if (fil < 0) return -1;
{ {
int32_t offset = 0; int32_t offset = 0;
int32_t len = 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 & 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<<gltexmaxsize) || head->ydim > (1<<gltexmaxsize))) goto failure; if (gltexmaxsize && (head->xdim > (1<<gltexmaxsize) || head->ydim > (1<<gltexmaxsize))) goto failure;
if (!glinfo.texnpot && (head->flags & 1)) goto failure; if (!glinfo.texnpot && (head->flags & 1)) goto failure;
return cachefilehandle; return cachefilehandle;
failure: failure:
initprintf("cache miss\n"); initprintf("cache miss\n");
// kclose(cachefilehandle);
return -1; return -1;
} }
void writexcache(char *fn, int32_t len, int32_t dameth, char effect, texcacheheader *head) void writexcache(char *fn, int32_t len, int32_t dameth, char effect, texcacheheader *head)
{ {
// int32_t fil=-1;
int32_t fp; int32_t fp;
char cachefn[BMAX_PATH], *cp; char cachefn[BMAX_PATH], *cp;
uint8_t mdsum[16]; 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; if (gi != GL_TRUE) return;
md4once((uint8_t *)fn, strlen(fn), mdsum); md4once((uint8_t *)fn, strlen(fn), mdsum);
// for (cp = cachefn, fp = 0; (*cp = TEXCACHEFILE[fp]); cp++,fp++);
// *(cp++) = '/';
cp = cachefn; cp = cachefn;
for (fp = 0; fp < 16; phex(mdsum[fp++], cp), cp+=2); for (fp = 0; fp < 16; phex(mdsum[fp++], cp), cp+=2);
sprintf(cp, "-%x-%x%x", len, dameth, effect); Bsprintf(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;
Blseek(cachefilehandle, 0, BSEEK_END); Blseek(cachefilehandle, 0, BSEEK_END);
@ -1672,7 +1673,6 @@ failure:
Bmemset(curcacheindex->name,0,sizeof(curcacheindex->name)); Bmemset(curcacheindex->name,0,sizeof(curcacheindex->name));
success: success:
// if (fil>=0) Bclose(fil);
if (midbuf) free(midbuf); if (midbuf) free(midbuf);
if (pic) free(pic); if (pic) free(pic);
if (packbuf) free(packbuf); 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; tsizx = cachead.xdim;
tsizy = cachead.ydim; tsizy = cachead.ydim;
hasalpha = (cachead.flags & 2) ? 0 : 255; 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 else
{ {
// if (cachefil >= 0) kclose(cachefil);
cachefil = -1; // the compressed version will be saved to disk cachefil = -1; // the compressed version will be saved to disk
if ((filh = kopen4load(fn, 0)) < 0) return -1; 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 // detail texture
detailpth = NULL; detailpth = NULL;
if (r_detailmapping && usehightile && !r_depthpeeling && !drawingskybox && if (r_detailmapping && usehightile /*&& !r_depthpeeling*/ && !drawingskybox &&
hicfindsubst(globalpicnum, DETAILPAL, 0)) hicfindsubst(globalpicnum, DETAILPAL, 0))
detailpth = gltexcache(globalpicnum, DETAILPAL, method&(~3)); detailpth = gltexcache(globalpicnum, DETAILPAL, method&(~3));
@ -2197,7 +2193,7 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method)
// glow texture // glow texture
glowpth = NULL; glowpth = NULL;
if (r_glowmapping && usehightile && !r_depthpeeling && !drawingskybox && if (r_glowmapping && usehightile /*&& !r_depthpeeling*/ && !drawingskybox &&
hicfindsubst(globalpicnum, GLOWPAL, 0)) hicfindsubst(globalpicnum, GLOWPAL, 0))
glowpth = gltexcache(globalpicnum, GLOWPAL, method&(~3)); 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)) if ((!(method&3)) && (!fullbrightdrawingpass))
{ {
bglDisable(GL_BLEND); bglDisable(GL_BLEND);
if (!peelcompiling) /* if (!peelcompiling)*/
bglDisable(GL_ALPHA_TEST); bglDisable(GL_ALPHA_TEST);
} }
else else
@ -2261,7 +2257,7 @@ void drawpoly(double *dpx, double *dpy, int32_t n, int32_t method)
if (alphahackarray[globalpicnum]) if (alphahackarray[globalpicnum])
al=alphahackarray[globalpicnum]; al=alphahackarray[globalpicnum];
if (!waloff[globalpicnum]) al = 0.0; // invalid textures ignore the alpha cutoff settings if (!waloff[globalpicnum]) al = 0.0; // invalid textures ignore the alpha cutoff settings
if (!peelcompiling) /* if (!peelcompiling)*/
bglEnable(GL_BLEND); bglEnable(GL_BLEND);
bglEnable(GL_ALPHA_TEST); bglEnable(GL_ALPHA_TEST);
bglAlphaFunc(GL_GREATER,al); 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; 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; int32_t pi, ni;
//Delete i //Delete i
@ -2924,7 +2920,7 @@ void vsdel(int32_t i)
vsp[VSPMAX-1].n = i; vsp[VSPMAX-1].n = i;
} }
int32_t vsinsaft(int32_t i) static inline int32_t vsinsaft(int32_t i)
{ {
int32_t r; int32_t r;
//i = next element from empty list //i = next element from empty list
@ -2941,7 +2937,7 @@ int32_t vsinsaft(int32_t i)
return(r); return(r);
} }
int32_t testvisiblemost(float x0, float x1) static inline int32_t testvisiblemost(float x0, float x1)
{ {
int32_t i, newi; int32_t i, newi;
@ -4359,6 +4355,7 @@ void polymost_drawrooms()
globalposy += cosglobalang/1024; globalposy += cosglobalang/1024;
} }
} }
/*
if (r_depthpeeling) if (r_depthpeeling)
{ {
bglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, peelfbos[r_peelscount]); bglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, peelfbos[r_peelscount]);
@ -4366,6 +4363,7 @@ void polymost_drawrooms()
bglViewport(0, 0, xdim, ydim); bglViewport(0, 0, xdim, ydim);
//bglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); //bglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
} }
*/
} }
#endif #endif
@ -4605,6 +4603,7 @@ void polymost_drawmaskwall(int32_t damaskwallcnt)
globalpal = (int32_t)((uint8_t)wal->pal); globalpal = (int32_t)((uint8_t)wal->pal);
globalorientation = (int32_t)wal->cstat; globalorientation = (int32_t)wal->cstat;
/*
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (r_depthpeeling) if (r_depthpeeling)
{ {
@ -4614,6 +4613,7 @@ void polymost_drawmaskwall(int32_t damaskwallcnt)
return; // discard opaque sprite when composing the depth peels return; // discard opaque sprite when composing the depth peels
} }
#endif #endif
*/
sx0 = (float)(wal->x-globalposx); sx1 = (float)(wal2->x-globalposx); sx0 = (float)(wal->x-globalposx); sx1 = (float)(wal2->x-globalposx);
sy0 = (float)(wal->y-globalposy); sy1 = (float)(wal2->y-globalposy); 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; } if (tspr->cstat&2) { if (!(tspr->cstat&512)) method = 2+4; else method = 3+4; }
#ifdef USE_OPENGL #ifdef USE_OPENGL
/*
if (r_depthpeeling) if (r_depthpeeling)
{ {
if ((((tspr->cstat&2) || (gltexmayhavealpha(globalpicnum,tspr->pal)))) && !peelcompiling) 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) if (!(((tspr->cstat&2) || (gltexmayhavealpha(globalpicnum,tspr->pal)))) && peelcompiling)
return; // discard opaque sprite when composing the depth peels return; // discard opaque sprite when composing the depth peels
} }
*/
if (!nofog && rendmode >= 3) if (!nofog && rendmode >= 3)
{ {
@ -6170,6 +6172,7 @@ static int32_t osdcmd_polymostvars(const osdfuncparm_t *parm)
else gltexmiplevel = val; else gltexmiplevel = val;
return OSDCMD_OK; return OSDCMD_OK;
} }
/*
else if (!Bstrcasecmp(parm->name, "r_depthpeeling")) else if (!Bstrcasecmp(parm->name, "r_depthpeeling"))
{ {
if (showval) { OSD_Printf("r_depthpeeling is %d\n", 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; else r_curpeel = val;
return OSDCMD_OK; return OSDCMD_OK;
} }
*/
else if (!Bstrcasecmp(parm->name, "r_detailmapping")) else if (!Bstrcasecmp(parm->name, "r_detailmapping"))
{ {
if (showval) { OSD_Printf("r_detailmapping is %d\n", r_detailmapping); } if (showval) { OSD_Printf("r_detailmapping is %d\n", r_detailmapping); }
@ -6396,8 +6400,10 @@ void polymost_initosdfuncs(void)
#ifdef USE_OPENGL #ifdef USE_OPENGL
OSD_RegisterFunction("r_animsmoothing","r_animsmoothing: enable/disable model animation smoothing",osdcmd_polymostvars); 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_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_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_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_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_downsize","r_downsize: controls downsizing factor for hires textures",osdcmd_polymostvars);
OSD_RegisterFunction("r_fullbrights","r_fullbrights: enable/disable fullbright 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_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_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_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_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_redbluemode","r_redbluemode: enable/disable experimental OpenGL red-blue glasses mode",osdcmd_polymostvars);
OSD_RegisterFunction("r_shadescale","r_shadescale: multiplier for lighting",osdcmd_polymostvars); OSD_RegisterFunction("r_shadescale","r_shadescale: multiplier for lighting",osdcmd_polymostvars);

View file

@ -417,13 +417,13 @@ int32_t initinput(void)
for (i=0; i<SDLK_LAST; i++) for (i=0; i<SDLK_LAST; i++)
{ {
if (!keytranslation[i]) continue; if (!keytranslation[i]) continue;
strncpy((char *)key_names[ keytranslation[i] ], SDL_GetKeyName(i), sizeof(key_names[i])-1); Bstrncpy((char *)key_names[ keytranslation[i] ], SDL_GetKeyName(i), sizeof(key_names[i])-1);
} }
#else #else
for (i=0; i<SDL_NUM_SCANCODES; i++) for (i=0; i<SDL_NUM_SCANCODES; i++)
{ {
if (!keytranslation[i]) continue; if (!keytranslation[i]) continue;
strncpy((char *)key_names[ keytranslation[i] ], SDL_GetKeyName(SDL_SCANCODE_TO_KEYCODE(i)), sizeof(key_names[i])-1); Bstrncpy((char *)key_names[ keytranslation[i] ], SDL_GetKeyName(SDL_SCANCODE_TO_KEYCODE(i)), sizeof(key_names[i])-1);
} }
#endif #endif
@ -480,17 +480,17 @@ const char *getjoyname(int32_t what, int32_t num)
{ {
case 0: // axis case 0: // axis
if ((unsigned)num > (unsigned)joynumaxes) return NULL; if ((unsigned)num > (unsigned)joynumaxes) return NULL;
sprintf(tmp,"Axis %d",num); Bsprintf(tmp,"Axis %d",num);
return (char *)tmp; return (char *)tmp;
case 1: // button case 1: // button
if ((unsigned)num > (unsigned)joynumbuttons) return NULL; if ((unsigned)num > (unsigned)joynumbuttons) return NULL;
sprintf(tmp,"Button %d",num); Bsprintf(tmp,"Button %d",num);
return (char *)tmp; return (char *)tmp;
case 2: // hat case 2: // hat
if ((unsigned)num > (unsigned)joynumhats) return NULL; if ((unsigned)num > (unsigned)joynumhats) return NULL;
sprintf(tmp,"Hat %d",num); Bsprintf(tmp,"Hat %d",num);
return (char *)tmp; return (char *)tmp;
default: default:

View file

@ -87,7 +87,7 @@ static BOOL InitDirectInput(void);
static void UninitDirectInput(void); static void UninitDirectInput(void);
static void GetKeyNames(void); static void GetKeyNames(void);
static void AcquireInputDevices(char acquire, int8_t device); 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 int32_t SetupDirectDraw(int32_t width, int32_t height);
static void UninitDIB(void); static void UninitDIB(void);
static int32_t SetupDIB(int32_t width, int32_t height); static int32_t SetupDIB(int32_t width, int32_t height);
@ -1567,12 +1567,12 @@ static void GetKeyNames(void)
if (FAILED(res)) continue; if (FAILED(res)) continue;
CharToOem(key.tszName, tbuf); 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; tbuf[0] = 0;
GetKeyNameText((i>128?(i+128):i)<<16, tbuf, sizeof(key_names[i])-1); GetKeyNameText((i>128?(i+128):i)<<16, tbuf, sizeof(key_names[i])-1);
// initprintf("%d %15s %15s\n",i,key_names[i],tbuf); // 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 // ProcessInputDevices() -- processes the input devices
// //
static void ProcessInputDevices(void) static inline void ProcessInputDevices(void)
{ {
DWORD i; DWORD i;
HRESULT result; HRESULT result;
@ -2005,7 +2005,7 @@ void uninittimer(void)
// //
// sampletimer() -- update totalclock // sampletimer() -- update totalclock
// //
void sampletimer(void) inline void sampletimer(void)
{ {
int64 i; int64 i;
int32_t n; int32_t n;
@ -2335,7 +2335,7 @@ void getvalidmodes(void)
{ {
static int32_t defaultres[][2] = 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} {640,400},{512,384},{480,360},{400,300},{320,240},{320,200},{0,0}
}; };
int32_t cdepths[2] = { 8, 0 }; int32_t cdepths[2] = { 8, 0 };

View file

@ -44,7 +44,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <shellapi.h> #include <shellapi.h>
#endif #endif
#define BUILDDATE " 20090123" #define BUILDDATE " 20090131"
#define VERSION " 1.2.0devel" #define VERSION " 1.2.0devel"
static int32_t floor_over_floor; static int32_t floor_over_floor;
@ -4047,7 +4047,7 @@ static void Keys3d(void)
if (searchstat != 3) if (searchstat != 3)
{ {
wall[searchwall].cstat ^= 32; 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); message(getmessage);
asksave = 1; asksave = 1;
} }
@ -4063,7 +4063,7 @@ static void Keys3d(void)
sprite[searchwall].cstat |= 8; sprite[searchwall].cstat |= 8;
} }
asksave = 1; 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); message(getmessage);
} }
@ -4074,7 +4074,7 @@ static void Keys3d(void)
if (searchstat != 3) if (searchstat != 3)
{ {
wall[searchwall].cstat ^= 2; 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); message(getmessage);
asksave = 1; asksave = 1;
} }
@ -4109,7 +4109,7 @@ static void Keys3d(void)
if (i >= 0) if (i >= 0)
{ {
wall[searchwall].cstat ^= 16; 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); message(getmessage);
if ((wall[searchwall].cstat&16) > 0) if ((wall[searchwall].cstat&16) > 0)
{ {
@ -4170,7 +4170,7 @@ static void Keys3d(void)
if (searchstat == 3) if (searchstat == 3)
{ {
sprite[searchwall].cstat ^= 256; 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); message(getmessage);
asksave = 1; asksave = 1;
} }
@ -4183,7 +4183,7 @@ static void Keys3d(void)
wall[wall[searchwall].nextwall].cstat &= ~64; wall[wall[searchwall].nextwall].cstat &= ~64;
wall[wall[searchwall].nextwall].cstat |= (wall[searchwall].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); message(getmessage);
asksave = 1; asksave = 1;
@ -4466,14 +4466,14 @@ static void Keys3d(void)
if (searchstat == 1) if (searchstat == 1)
{ {
sector[searchsector].ceilingstat ^= 8; 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); message(getmessage);
asksave = 1; asksave = 1;
} }
if (searchstat == 2) if (searchstat == 2)
{ {
sector[searchsector].floorstat ^= 8; 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); message(getmessage);
asksave = 1; asksave = 1;
} }
@ -4497,14 +4497,14 @@ static void Keys3d(void)
if (searchstat == 1) if (searchstat == 1)
{ {
sector[searchsector].ceilingstat ^= 64; 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); message(getmessage);
asksave = 1; asksave = 1;
} }
if (searchstat == 2) if (searchstat == 2)
{ {
sector[searchsector].floorstat ^= 64; 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); message(getmessage);
asksave = 1; asksave = 1;
} }
@ -4517,11 +4517,11 @@ static void Keys3d(void)
sprite[searchwall].cstat = i; sprite[searchwall].cstat = i;
if (sprite[searchwall].cstat&16) 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) else if (sprite[searchwall].cstat&32)
sprintf(getmessage,"Sprite %d now floor aligned",searchwall); Bsprintf(getmessage,"Sprite %d now floor aligned",searchwall);
else else
sprintf(getmessage,"Sprite %d now view aligned",searchwall); Bsprintf(getmessage,"Sprite %d now view aligned",searchwall);
message(getmessage); message(getmessage);
asksave = 1; asksave = 1;
} }
@ -4728,7 +4728,7 @@ static void Keys3d(void)
i = nextspritesect[i]; i = nextspritesect[i];
} }
sector[searchsector].ceilingz -= updownunits << (eitherCTRL<<1); // JBF 20031128 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); message(getmessage);
} }
@ -4747,7 +4747,7 @@ static void Keys3d(void)
i = nextspritesect[i]; i = nextspritesect[i];
} }
sector[highlightsector[j]].ceilingz -= updownunits << (eitherCTRL<<1); // JBF 20031128 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); message(getmessage);
} }
@ -4767,7 +4767,7 @@ static void Keys3d(void)
i = nextspritesect[i]; i = nextspritesect[i];
} }
sector[searchsector].floorz -= updownunits << (eitherCTRL<<1); // JBF 20031128 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); message(getmessage);
} }
@ -4785,7 +4785,7 @@ static void Keys3d(void)
i = nextspritesect[i]; i = nextspritesect[i];
} }
sector[highlightsector[j]].floorz -= updownunits << (eitherCTRL<<1); // JBF 20031128 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); message(getmessage);
} }
@ -4815,7 +4815,7 @@ static void Keys3d(void)
{ {
sprite[searchwall].z -= updownunits; sprite[searchwall].z -= updownunits;
if (!spnoclip)sprite[searchwall].z = max(sprite[searchwall].z,spriteonceilingz(searchwall)); 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); message(getmessage);
} }
@ -4827,7 +4827,7 @@ static void Keys3d(void)
sprite[highlight[i]&16383].z -= updownunits; sprite[highlight[i]&16383].z -= updownunits;
if (!spnoclip)sprite[highlight[i]&16383].z = max(sprite[highlight[i]&16383].z,spriteonceilingz(highlight[i]&16383)); 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); message(getmessage);
} }
@ -4876,7 +4876,7 @@ static void Keys3d(void)
i = nextspritesect[i]; i = nextspritesect[i];
} }
sector[searchsector].ceilingz += updownunits << (eitherCTRL<<1); // JBF 20031128 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); message(getmessage);
} }
@ -4895,7 +4895,7 @@ static void Keys3d(void)
i = nextspritesect[i]; i = nextspritesect[i];
} }
sector[highlightsector[j]].ceilingz += updownunits << (eitherCTRL<<1); // JBF 20031128 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); message(getmessage);
} }
@ -4915,7 +4915,7 @@ static void Keys3d(void)
i = nextspritesect[i]; i = nextspritesect[i];
} }
sector[searchsector].floorz += updownunits << (eitherCTRL<<1); // JBF 20031128 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); message(getmessage);
} }
@ -4933,7 +4933,7 @@ static void Keys3d(void)
i = nextspritesect[i]; i = nextspritesect[i];
} }
sector[highlightsector[j]].floorz += updownunits << (eitherCTRL<<1); // JBF 20031128 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); message(getmessage);
} }
@ -4962,7 +4962,7 @@ static void Keys3d(void)
{ {
sprite[searchwall].z += updownunits; sprite[searchwall].z += updownunits;
if (!spnoclip)sprite[searchwall].z = min(sprite[searchwall].z,spriteongroundz(searchwall)); 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); message(getmessage);
} }
@ -4974,7 +4974,7 @@ static void Keys3d(void)
sprite[highlight[i]&16383].z += updownunits; sprite[highlight[i]&16383].z += updownunits;
if (!spnoclip)sprite[highlight[i]&16383].z = min(sprite[highlight[i]&16383].z,spriteongroundz(highlight[i]&16383)); 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); message(getmessage);
} }
@ -5106,7 +5106,7 @@ static void Keys3d(void)
Bsprintf(tempbuf,"%d",purpleon); Bsprintf(tempbuf,"%d",purpleon);
break; break;
default : default :
sprintf(tempbuf," "); Bsprintf(tempbuf," ");
break; break;
} }
begindrawing(); begindrawing();
@ -5399,7 +5399,7 @@ static void Keys3d(void)
sprite[searchwall].cstat ^= 1; sprite[searchwall].cstat ^= 1;
// sprite[searchwall].cstat &= ~256; // sprite[searchwall].cstat &= ~256;
// sprite[searchwall].cstat |= ((sprite[searchwall].cstat&1)<<8); // 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); message(getmessage);
asksave = 1; asksave = 1;
} }
@ -5412,7 +5412,7 @@ static void Keys3d(void)
wall[wall[searchwall].nextwall].cstat &= ~(1+64); wall[wall[searchwall].nextwall].cstat &= ~(1+64);
wall[wall[searchwall].nextwall].cstat |= (wall[searchwall].cstat&1); 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); message(getmessage);
asksave = 1; asksave = 1;
} }
@ -6913,11 +6913,11 @@ static void Keys2d(void)
sprite[cursprite].cstat = i; sprite[cursprite].cstat = i;
if (sprite[cursprite].cstat&16) 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) else if (sprite[cursprite].cstat&32)
sprintf(getmessage,"Sprite %d now floor aligned",cursprite); Bsprintf(getmessage,"Sprite %d now floor aligned",cursprite);
else else
sprintf(getmessage,"Sprite %d now view aligned",cursprite); Bsprintf(getmessage,"Sprite %d now view aligned",cursprite);
message(getmessage); message(getmessage);
asksave = 1; asksave = 1;
@ -7106,9 +7106,9 @@ static void Keys2d(void)
} }
} }
} }
if (autogrid) sprintf(tempbuf,"Grid size: 9 (autosize)"); if (autogrid) Bsprintf(tempbuf,"Grid size: 9 (autosize)");
else if (!grid) sprintf(tempbuf,"Grid off"); else if (!grid) Bsprintf(tempbuf,"Grid off");
else sprintf(tempbuf,"Grid size: %d (%d units)",grid,2048>>grid); else Bsprintf(tempbuf,"Grid size: %d (%d units)",grid,2048>>grid);
printmessage16(tempbuf); printmessage16(tempbuf);
keystatus[KEYSC_G] = 0; keystatus[KEYSC_G] = 0;
} }
@ -9526,14 +9526,6 @@ void faketimerhandler(void)
horiz = ((horiz*7+(100-(daang>>1)))>>3); horiz = ((horiz*7+(100-(daang>>1)))>>3);
if (horiz < 100) horiz++; if (horiz < 100) horiz++;
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; extern int16_t brightness;

View file

@ -807,6 +807,7 @@ enum GamevarFlags_t {
GAMEVAR_SHORTPTR = 0x00008000, // plValues is a pointer to a short GAMEVAR_SHORTPTR = 0x00008000, // plValues is a pointer to a short
GAMEVAR_CHARPTR = 0x00010000, // plValues is a pointer to a char GAMEVAR_CHARPTR = 0x00010000, // plValues is a pointer to a char
GAMEVAR_NORESET = 0x00020000, // var values are not reset when restoring map state GAMEVAR_NORESET = 0x00020000, // var values are not reset when restoring map state
GAMEVAR_SPECIAL = 0x00040000, // flag for structure member shortcut vars
}; };
enum GamearrayFlags_t { enum GamearrayFlags_t {

View file

@ -220,7 +220,7 @@ extern void G_ProcessDynamicTileMapping(const char *szLabel, int32_t lValue);
extern void A_LoadActor(int32_t sActor); 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 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 AddLog(const char *psz, ...);
extern void Gv_ResetSystemDefaults(void); extern void Gv_ResetSystemDefaults(void);

View file

@ -143,7 +143,7 @@ int32_t tempwallptr;
static int32_t nonsharedtimer; static int32_t nonsharedtimer;
static void G_DrawCameraText(int16_t i); 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 G_DoOrderScreen(void);
static void Net_DoPrediction(void); static void Net_DoPrediction(void);
static void Net_CorrectPrediction(void); static void Net_CorrectPrediction(void);
@ -643,35 +643,7 @@ void Net_GetPackets(void)
g_player[i].movefifoend++; g_player[i].movefifoend++;
} }
/* while (j != packbufleng) Net_GetSyncData(packbuf, packbufleng, &j, other);
{
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);
TRAVERSE_CONNECT(i) TRAVERSE_CONNECT(i)
if (i != myconnectindex) 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); */ if (k&2048) nsyn[other].extbits = ((nsyn[other].extbits&0x00ffffff)|((int32_t)packbuf[j++])<<24); */
g_player[other].movefifoend++; g_player[other].movefifoend++;
/* while (j != packbufleng) Net_GetSyncData(packbuf, packbufleng, &j, other);
{
g_player[other].syncval[g_player[other].syncvalhead&(MOVEFIFOSIZ-1)] = packbuf[j++];
g_player[other].syncvalhead++;
} */
Net_GetSyncInfoFromPacket(packbuf, packbufleng, &j, other);
for (i=g_movesPerPacket-1;i>=1;i--) for (i=g_movesPerPacket-1;i>=1;i--)
{ {
@ -765,14 +732,7 @@ void Net_GetPackets(void)
g_player[other].movefifoend++; g_player[other].movefifoend++;
} }
/* Net_GetSyncData(packbuf, packbufleng, &j, other);
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);
if (j > packbufleng) if (j > packbufleng)
initprintf("INVALID GAME PACKET!!! (packet %d, %d too many bytes (%d %d))\n",packbuf[0],j-packbufleng,packbufleng,k); 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++; syncvaltail++;
} */ } */
Net_AddSyncInfoToPacket(&j); Net_AddSyncData(&j);
TRAVERSE_CONNECT(i) TRAVERSE_CONNECT(i)
if (i != myconnectindex) if (i != myconnectindex)
@ -1397,7 +1357,7 @@ void faketimerhandler(void)
packbuf[j++] = g_player[myconnectindex].syncval[syncvaltail&(MOVEFIFOSIZ-1)]; packbuf[j++] = g_player[myconnectindex].syncval[syncvaltail&(MOVEFIFOSIZ-1)];
syncvaltail++; syncvaltail++;
} */ } */
Net_AddSyncInfoToPacket(&j); Net_AddSyncData(&j);
mmulti_sendpacket(connecthead,packbuf,j); mmulti_sendpacket(connecthead,packbuf,j);
return; return;
@ -1486,7 +1446,7 @@ void faketimerhandler(void)
packbuf[j++] = g_player[myconnectindex].syncval[syncvaltail&(MOVEFIFOSIZ-1)]; packbuf[j++] = g_player[myconnectindex].syncval[syncvaltail&(MOVEFIFOSIZ-1)];
syncvaltail++; syncvaltail++;
} */ } */
Net_AddSyncInfoToPacket(&j); Net_AddSyncData(&j);
for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i])
if (g_player[i].playerquitflag) if (g_player[i].playerquitflag)
@ -2619,7 +2579,7 @@ static void G_PrintCoords(int32_t snum)
else if (ud.multimode > 1) else if (ud.multimode > 1)
y = 24; 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); printext256(250L,y,31,-1,tempbuf,0);
Bsprintf(tempbuf,"A/H= %d,%d",g_player[snum].ps->ang,g_player[snum].ps->horiz); Bsprintf(tempbuf,"A/H= %d,%d",g_player[snum].ps->ang,g_player[snum].ps->horiz);
printext256(250L,y+9L,31,-1,tempbuf,0); 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) static void G_DumpDebugInfo(void)
{ {
int32_t i,j,x; int32_t i,j,x;
FILE * fp=fopen("debug.con","w"); // FILE * fp=fopen("condebug.log","w");
for (i=0;i<MAX_WEAPONS;i++) for (i=0;i<MAX_WEAPONS;i++)
{ {
for (j=0;j<numplayers;j++) for (j=0;j<numplayers;j++)
{ {
fprintf(fp,"Player %d\n\n",j); OSD_Printf("Player %d\n\n",j);
fprintf(fp,"WEAPON%d_CLIP %" PRIdPTR "\n",i,aplWeaponClip[i][j]); OSD_Printf("WEAPON%d_CLIP %" PRIdPTR "\n",i,aplWeaponClip[i][j]);
fprintf(fp,"WEAPON%d_RELOAD %" PRIdPTR "\n",i,aplWeaponReload[i][j]); OSD_Printf("WEAPON%d_RELOAD %" PRIdPTR "\n",i,aplWeaponReload[i][j]);
fprintf(fp,"WEAPON%d_FIREDELAY %" PRIdPTR "\n",i,aplWeaponFireDelay[i][j]); OSD_Printf("WEAPON%d_FIREDELAY %" PRIdPTR "\n",i,aplWeaponFireDelay[i][j]);
fprintf(fp,"WEAPON%d_TOTALTIME %" PRIdPTR "\n",i,aplWeaponTotalTime[i][j]); OSD_Printf("WEAPON%d_TOTALTIME %" PRIdPTR "\n",i,aplWeaponTotalTime[i][j]);
fprintf(fp,"WEAPON%d_HOLDDELAY %" PRIdPTR "\n",i,aplWeaponHoldDelay[i][j]); OSD_Printf("WEAPON%d_HOLDDELAY %" PRIdPTR "\n",i,aplWeaponHoldDelay[i][j]);
fprintf(fp,"WEAPON%d_FLAGS %" PRIdPTR "\n",i,aplWeaponFlags[i][j]); OSD_Printf("WEAPON%d_FLAGS %" PRIdPTR "\n",i,aplWeaponFlags[i][j]);
fprintf(fp,"WEAPON%d_SHOOTS %" PRIdPTR "\n",i,aplWeaponShoots[i][j]); OSD_Printf("WEAPON%d_SHOOTS %" PRIdPTR "\n",i,aplWeaponShoots[i][j]);
fprintf(fp,"WEAPON%d_SPAWNTIME %" PRIdPTR "\n",i,aplWeaponSpawnTime[i][j]); OSD_Printf("WEAPON%d_SPAWNTIME %" PRIdPTR "\n",i,aplWeaponSpawnTime[i][j]);
fprintf(fp,"WEAPON%d_SPAWN %" PRIdPTR "\n",i,aplWeaponSpawn[i][j]); OSD_Printf("WEAPON%d_SPAWN %" PRIdPTR "\n",i,aplWeaponSpawn[i][j]);
fprintf(fp,"WEAPON%d_SHOTSPERBURST %" PRIdPTR "\n",i,aplWeaponShotsPerBurst[i][j]); OSD_Printf("WEAPON%d_SHOTSPERBURST %" PRIdPTR "\n",i,aplWeaponShotsPerBurst[i][j]);
fprintf(fp,"WEAPON%d_WORKSLIKE %" PRIdPTR "\n",i,aplWeaponWorksLike[i][j]); OSD_Printf("WEAPON%d_WORKSLIKE %" PRIdPTR "\n",i,aplWeaponWorksLike[i][j]);
fprintf(fp,"WEAPON%d_INITIALSOUND %" PRIdPTR "\n",i,aplWeaponInitialSound[i][j]); OSD_Printf("WEAPON%d_INITIALSOUND %" PRIdPTR "\n",i,aplWeaponInitialSound[i][j]);
fprintf(fp,"WEAPON%d_FIRESOUND %" PRIdPTR "\n",i,aplWeaponFireSound[i][j]); OSD_Printf("WEAPON%d_FIRESOUND %" PRIdPTR "\n",i,aplWeaponFireSound[i][j]);
fprintf(fp,"WEAPON%d_SOUND2TIME %" PRIdPTR "\n",i,aplWeaponSound2Time[i][j]); OSD_Printf("WEAPON%d_SOUND2TIME %" PRIdPTR "\n",i,aplWeaponSound2Time[i][j]);
fprintf(fp,"WEAPON%d_SOUND2SOUND %" PRIdPTR "\n",i,aplWeaponSound2Sound[i][j]); OSD_Printf("WEAPON%d_SOUND2SOUND %" PRIdPTR "\n",i,aplWeaponSound2Sound[i][j]);
fprintf(fp,"WEAPON%d_RELOADSOUND1 %" PRIdPTR "\n",i,aplWeaponReloadSound1[i][j]); OSD_Printf("WEAPON%d_RELOADSOUND1 %" PRIdPTR "\n",i,aplWeaponReloadSound1[i][j]);
fprintf(fp,"WEAPON%d_RELOADSOUND2 %" PRIdPTR "\n",i,aplWeaponReloadSound2[i][j]); OSD_Printf("WEAPON%d_RELOADSOUND2 %" PRIdPTR "\n",i,aplWeaponReloadSound2[i][j]);
fprintf(fp,"WEAPON%d_SELECTSOUND %" PRIdPTR "\n",i,aplWeaponSelectSound[i][j]); OSD_Printf("WEAPON%d_SELECTSOUND %" PRIdPTR "\n",i,aplWeaponSelectSound[i][j]);
} }
fprintf(fp,"\n"); OSD_Printf("\n");
} }
for (x=0;x<MAXSTATUS;x++) for (x=0;x<MAXSTATUS;x++)
{ {
j = headspritestat[x]; j = headspritestat[x];
while (j >= 0) while (j >= 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;i<g_gameVarCount;i++) for (i=0;i<g_gameVarCount;i++)
{ {
if (aGameVars[i].dwFlags & (GAMEVAR_PERACTOR)) if (aGameVars[i].dwFlags & (GAMEVAR_PERACTOR))
{ {
if (aGameVars[i].val.plValues[j] != aGameVars[i].lDefault) if (aGameVars[i].val.plValues[j] != aGameVars[i].lDefault)
{ {
fprintf(fp,"gamevar %s ",aGameVars[i].szLabel); OSD_Printf("gamevar %s ",aGameVars[i].szLabel);
fprintf(fp,"%" PRIdPTR "",aGameVars[i].val.plValues[j]); OSD_Printf("%" PRIdPTR "",aGameVars[i].val.plValues[j]);
fprintf(fp," GAMEVAR_PERACTOR"); OSD_Printf(" GAMEVAR_PERACTOR");
if (aGameVars[i].dwFlags != GAMEVAR_PERACTOR) if (aGameVars[i].dwFlags != GAMEVAR_PERACTOR)
{ {
fprintf(fp," // "); OSD_Printf(" // ");
if (aGameVars[i].dwFlags & (GAMEVAR_SYSTEM)) if (aGameVars[i].dwFlags & (GAMEVAR_SYSTEM))
{ {
fprintf(fp," (system)"); OSD_Printf(" (system)");
} }
} }
fprintf(fp,"\n"); OSD_Printf("\n");
} }
} }
} }
fprintf(fp,"\n"); OSD_Printf("\n");
j = nextspritestat[j]; j = nextspritestat[j];
} }
} }
Gv_DumpValues(fp); Gv_DumpValues();
fclose(fp); // fclose(fp);
saveboard("debug.map",&g_player[myconnectindex].ps->posx,&g_player[myconnectindex].ps->posy,&g_player[myconnectindex].ps->posz,&g_player[myconnectindex].ps->ang,&g_player[myconnectindex].ps->cursectnum); saveboard("debug.map",&g_player[myconnectindex].ps->posx,&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; 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->pal = 6;
t->shade = 0; t->shade = 0;
@ -7776,7 +7737,7 @@ FOUNDCHEAT:
g_player[myconnectindex].ps->cheat_phase = 0; g_player[myconnectindex].ps->cheat_phase = 0;
G_DumpDebugInfo(); G_DumpDebugInfo();
Bsprintf(tempbuf,"GAMEVARS DUMPED TO DEBUG.CON"); Bsprintf(tempbuf,"GAMEVARS DUMPED TO LOG");
G_AddUserQuote(tempbuf); G_AddUserQuote(tempbuf);
Bsprintf(tempbuf,"MAP DUMPED TO DEBUG.MAP"); Bsprintf(tempbuf,"MAP DUMPED TO DEBUG.MAP");
G_AddUserQuote(tempbuf); G_AddUserQuote(tempbuf);
@ -9798,6 +9759,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
g_noMusic = 1; g_noMusic = 1;
initprintf("Music off.\n"); initprintf("Music off.\n");
} }
/*
else if (*c == 'd' || *c == 'D') else if (*c == 'd' || *c == 'D')
{ {
FILE * fp=fopen("gamevars.txt","w"); FILE * fp=fopen("gamevars.txt","w");
@ -9806,6 +9768,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
fclose(fp); fclose(fp);
initprintf("Game variables saved to gamevars.txt.\n"); initprintf("Game variables saved to gamevars.txt.\n");
} }
*/
else else
{ {
G_ShowParameterHelp(); G_ShowParameterHelp();
@ -12053,7 +12016,7 @@ RECHECK:
return 1; return 1;
} }
static int32_t G_MoveLoop() static inline int32_t G_MoveLoop()
{ {
int32_t i; int32_t i;
@ -13464,7 +13427,7 @@ FRAGBONUS:
if (playerbest > 0) 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)%60, (playerbest/26)%60,
((playerbest%26)*38)/10 ((playerbest%26)*38)/10
@ -13498,20 +13461,20 @@ FRAGBONUS:
bonuscnt++; bonuscnt++;
S_PlaySound(PIPEBOMB_EXPLODE); 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); gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16);
yy += 10; yy += 10;
if (ud.player_skill > 3) if (ud.player_skill > 3)
{ {
sprintf(tempbuf,"N/A"); Bsprintf(tempbuf,"N/A");
gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16);
yy += 10; yy += 10;
} }
else else
{ {
if ((g_player[myconnectindex].ps->max_actors_killed-g_player[myconnectindex].ps->actors_killed) < 0) if ((g_player[myconnectindex].ps->max_actors_killed-g_player[myconnectindex].ps->actors_killed) < 0)
sprintf(tempbuf,"%-3d",0); Bsprintf(tempbuf,"%-3d",0);
else sprintf(tempbuf,"%-3d",g_player[myconnectindex].ps->max_actors_killed-g_player[myconnectindex].ps->actors_killed); 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); gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16);
yy += 10; yy += 10;
} }
@ -13535,12 +13498,12 @@ FRAGBONUS:
bonuscnt++; bonuscnt++;
S_PlaySound(PIPEBOMB_EXPLODE); 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); gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16);
yy += 10; yy += 10;
if (g_player[myconnectindex].ps->secret_rooms > 0) 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)); Bsprintf(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",g_player[myconnectindex].ps->max_secret_rooms-g_player[myconnectindex].ps->secret_rooms);
gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16);
yy += 10; yy += 10;
} }

View file

@ -4884,7 +4884,8 @@ repeatcase:
if (j < 0 || j > MAXVOLUMES-1) 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++; g_numCompilerErrors++;
while (*textptr != 0x0a && *textptr != 0) textptr++; while (*textptr != 0x0a && *textptr != 0) textptr++;
break; break;
@ -4898,8 +4899,9 @@ repeatcase:
textptr++,i++; textptr++,i++;
if (i >= (signed)sizeof(EpisodeNames[j])-1) 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); initprintf("%s:%d: warning: truncating volume name to %d characters.\n",
g_numCompilerErrors++; g_szScriptFileName,g_lineNumber,sizeof(EpisodeNames[j])-1);
g_numCompilerWarnings++;
while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++;
break; break;
} }
@ -4917,7 +4919,8 @@ repeatcase:
if (j < 0 || j > NUMGAMEFUNCTIONS-1) 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++; g_numCompilerErrors++;
while (*textptr != 0x0a && *textptr != 0) textptr++; while (*textptr != 0x0a && *textptr != 0) textptr++;
break; break;
@ -4932,14 +4935,16 @@ repeatcase:
textptr++,i++; textptr++,i++;
if (*textptr == '/' || *textptr == ' ') 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++; g_numCompilerWarnings++;
while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++;
break; break;
} }
if (i >= MAXGAMEFUNCLEN-1) 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++; g_numCompilerWarnings++;
while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++;
break; break;
@ -4966,7 +4971,8 @@ repeatcase:
if (j < 0 || j > 4) 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++; g_numCompilerErrors++;
while (*textptr != 0x0a && *textptr != 0) textptr++; while (*textptr != 0x0a && *textptr != 0) textptr++;
break; break;
@ -4980,8 +4986,9 @@ repeatcase:
textptr++,i++; textptr++,i++;
if (i >= (signed)sizeof(SkillNames[j])-1) 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); initprintf("%s:%d: warning: truncating skill name to %d characters.\n",
g_numCompilerErrors++; g_szScriptFileName,g_lineNumber,sizeof(SkillNames[j])-1);
g_numCompilerWarnings++;
while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++;
break; break;
} }
@ -5004,8 +5011,9 @@ repeatcase:
textptr++,i++; textptr++,i++;
if (i >= (signed)sizeof(gamename)-1) 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); initprintf("%s:%d: warning: truncating game name to %d characters.\n",
g_numCompilerErrors++; g_szScriptFileName,g_lineNumber,sizeof(gamename)-1);
g_numCompilerWarnings++;
while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++;
break; break;
} }
@ -5058,6 +5066,10 @@ repeatcase:
{ {
char temp[BMAX_PATH]; char temp[BMAX_PATH];
struct stat st; 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 (stat(mod_dir, &st) < 0)
{ {
if (errno == ENOENT) // path doesn't exist if (errno == ENOENT) // path doesn't exist
@ -5080,13 +5092,23 @@ repeatcase:
// directory isn't a directory // directory isn't a directory
return 0; return 0;
} }
Bstrcpy(temp,tempbuf); Bstrcpy(temp,tempbuf);
CONFIG_WriteSetup(); CONFIG_WriteSetup();
Bsprintf(setupfilename,"%s/",mod_dir); Bsprintf(setupfilename,"%s/",mod_dir);
Bstrcat(setupfilename,temp); Bstrcat(setupfilename,temp);
initprintf("Using config file '%s'.\n",setupfilename);
CONFIG_ReadSetup(); 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; return 0;
@ -5119,8 +5141,9 @@ repeatcase:
textptr++,i++; textptr++,i++;
if (i >= (signed)sizeof(GametypeNames[j])-1) 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); initprintf("%s:%d: warning: truncating gametype name to %d characters.\n",
g_numCompilerErrors++; g_szScriptFileName,g_lineNumber,sizeof(GametypeNames[j])-1);
g_numCompilerWarnings++;
while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++;
break; break;
} }
@ -5206,8 +5229,9 @@ repeatcase:
textptr++,i++; textptr++,i++;
if (i >= 32) if (i >= 32)
{ {
initprintf("%s:%d: error: level name exceeds limit of %d characters.\n",g_szScriptFileName,g_lineNumber,32); initprintf("%s:%d: warning: truncating level name to %d characters.\n",
g_numCompilerErrors++; g_szScriptFileName,g_lineNumber,32);
g_numCompilerWarnings++;
while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++;
break; break;
} }
@ -5288,8 +5312,8 @@ repeatcase:
textptr++,i++; textptr++,i++;
if (i >= MAXQUOTELEN-1) if (i >= MAXQUOTELEN-1)
{ {
initprintf("%s:%d: error: quote text exceeds limit of %d characters.\n",g_szScriptFileName,g_lineNumber,MAXQUOTELEN-1); initprintf("%s:%d: warning: truncating quote text to %d characters.\n",g_szScriptFileName,g_lineNumber,MAXQUOTELEN-1);
g_numCompilerErrors++; g_numCompilerWarnings++;
while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++;
break; break;
} }
@ -5336,8 +5360,9 @@ repeatcase:
textptr++,i++; textptr++,i++;
if (i >= (signed)sizeof(CheatStrings[k])-1) 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); initprintf("%s:%d: warning: truncating cheat string to %d characters.\n",
g_numCompilerErrors++; g_szScriptFileName,g_lineNumber,MAXCHEATLEN,sizeof(CheatStrings[k])-1);
g_numCompilerWarnings++;
while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0 && *textptr != ' ') textptr++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0 && *textptr != ' ') textptr++;
break; break;
} }
@ -5936,7 +5961,7 @@ void C_Compile(const char *filenam)
{ {
if (g_loadFromGroupOnly) if (g_loadFromGroupOnly)
{ {
sprintf(buf,"Error compiling CON files."); Bsprintf(buf,"Error compiling CON files.");
G_GameExit(buf); G_GameExit(buf);
} }
else else

View file

@ -303,46 +303,47 @@ void Gv_WriteSave(FILE *fil)
dfwrite(g_szBuf,l,1,fil); dfwrite(g_szBuf,l,1,fil);
} }
void Gv_DumpValues(FILE *fp) void Gv_DumpValues(void)
{ {
int32_t i; int32_t i;
if (!fp) OSD_Printf("// Current Game Definitions\n\n");
return;
fprintf(fp,"// Current Game Definitions\n\n");
for (i=0;i<g_gameVarCount;i++) for (i=0;i<g_gameVarCount;i++)
{ {
if (aGameVars[i].dwFlags & (GAMEVAR_SECRET)) if (aGameVars[i].dwFlags & (GAMEVAR_SECRET))
continue; // do nothing... continue; // do nothing...
fprintf(fp,"gamevar %s ",aGameVars[i].szLabel); OSD_Printf("gamevar %s ",aGameVars[i].szLabel);
if (aGameVars[i].dwFlags & (GAMEVAR_INTPTR)) if (aGameVars[i].dwFlags & (GAMEVAR_INTPTR))
fprintf(fp,"%d",*((int32_t*)aGameVars[i].val.lValue)); OSD_Printf("%d",*((int32_t*)aGameVars[i].val.lValue));
else if (aGameVars[i].dwFlags & (GAMEVAR_SHORTPTR)) else if (aGameVars[i].dwFlags & (GAMEVAR_SHORTPTR))
fprintf(fp,"%d",*((int16_t*)aGameVars[i].val.lValue)); OSD_Printf("%d",*((int16_t*)aGameVars[i].val.lValue));
else if (aGameVars[i].dwFlags & (GAMEVAR_CHARPTR)) else if (aGameVars[i].dwFlags & (GAMEVAR_CHARPTR))
fprintf(fp,"%d",*((char*)aGameVars[i].val.lValue)); OSD_Printf("%d",*((char*)aGameVars[i].val.lValue));
else else
fprintf(fp,"%" PRIdPTR "",aGameVars[i].val.lValue); OSD_Printf("%" PRIdPTR "",aGameVars[i].val.lValue);
if (aGameVars[i].dwFlags & (GAMEVAR_PERPLAYER)) if (aGameVars[i].dwFlags & (GAMEVAR_PERPLAYER))
fprintf(fp," GAMEVAR_PERPLAYER"); OSD_Printf(" GAMEVAR_PERPLAYER");
else if (aGameVars[i].dwFlags & (GAMEVAR_PERACTOR)) else if (aGameVars[i].dwFlags & (GAMEVAR_PERACTOR))
fprintf(fp," GAMEVAR_PERACTOR"); OSD_Printf(" GAMEVAR_PERACTOR");
else else
fprintf(fp," %d",aGameVars[i].dwFlags & (GAMEVAR_USER_MASK)); OSD_Printf(" %d",aGameVars[i].dwFlags/* & (GAMEVAR_USER_MASK)*/);
fprintf(fp," // ");
OSD_Printf(" // ");
if (aGameVars[i].dwFlags & (GAMEVAR_SYSTEM)) if (aGameVars[i].dwFlags & (GAMEVAR_SYSTEM))
fprintf(fp," (system)"); OSD_Printf(" (system)");
if (aGameVars[i].dwFlags & (GAMEVAR_INTPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR)) if (aGameVars[i].dwFlags & (GAMEVAR_INTPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR))
fprintf(fp," (pointer)"); OSD_Printf(" (pointer)");
if (aGameVars[i].dwFlags & (GAMEVAR_READONLY)) if (aGameVars[i].dwFlags & (GAMEVAR_READONLY))
fprintf(fp," (read only)"); OSD_Printf(" (read only)");
fprintf(fp,"\n"); if (aGameVars[i].dwFlags & (GAMEVAR_SPECIAL))
OSD_Printf(" (special)");
OSD_Printf("\n");
} }
fprintf(fp,"\n// end of game definitions\n"); OSD_Printf("\n// end of game definitions\n");
} }
void Gv_ResetVars(void) /* this is called during a new game and nowhere else */ void Gv_ResetVars(void) /* this is called during a new game and nowhere else */
@ -1502,11 +1503,11 @@ static void Gv_AddSystemVars(void)
Gv_NewVar("THISACTOR", 0, GAMEVAR_READONLY | GAMEVAR_SYSTEM); Gv_NewVar("THISACTOR", 0, GAMEVAR_READONLY | GAMEVAR_SYSTEM);
// special vars for struct access // special vars for struct access
Gv_NewVar("sprite", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_INTPTR); Gv_NewVar("sprite", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
Gv_NewVar("sector", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_INTPTR); Gv_NewVar("sector", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
Gv_NewVar("wall", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_INTPTR); Gv_NewVar("wall", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
Gv_NewVar("player", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_INTPTR); Gv_NewVar("player", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
Gv_NewVar("actorvar", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_INTPTR); Gv_NewVar("actorvar", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
Gv_NewVar("myconnectindex", (intptr_t)&myconnectindex, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK); Gv_NewVar("myconnectindex", (intptr_t)&myconnectindex, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK);
Gv_NewVar("screenpeek", (intptr_t)&screenpeek, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK); Gv_NewVar("screenpeek", (intptr_t)&screenpeek, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK);

View file

@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
#include "duke3d.h" #include "duke3d.h"
const char *s_buildDate = "20090123"; const char *s_buildDate = "20090131";
char *MusicPtr = NULL; char *MusicPtr = NULL;
int32_t g_musicSize; int32_t g_musicSize;

View file

@ -56,7 +56,7 @@ static int32_t LoadGroupsCache(void)
fg->next = grpcache; fg->next = grpcache;
grpcache = fg; grpcache = fg;
strncpy(fg->name, fname, BMAX_PATH); Bstrncpy(fg->name, fname, BMAX_PATH);
fg->size = fsize; fg->size = fsize;
fg->mtime = fmtime; fg->mtime = fmtime;
fg->crcval = fcrcval; fg->crcval = fcrcval;
@ -157,7 +157,7 @@ int32_t ScanGroups(void)
foundgrps = grp; foundgrps = grp;
fgg = (struct grpcache *)Bcalloc(1, sizeof(struct grpcache)); 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->size = st.st_size;
fgg->mtime = st.st_mtime; fgg->mtime = st.st_mtime;
fgg->crcval = crcval; fgg->crcval = crcval;

View file

@ -659,7 +659,7 @@ int32_t FX_PlayLoopedVOC
vol, left, right, priority, callbackval); vol, left, right, priority, callbackval);
if (handle < MV_Ok) 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); initprintf(tempbuf);
FX_SetErrorCode(FX_MultiVocError); FX_SetErrorCode(FX_MultiVocError);
handle = FX_Warning; handle = FX_Warning;
@ -757,7 +757,7 @@ int32_t FX_PlayLoopedWAV
pitchoffset, vol, left, right, priority, callbackval); pitchoffset, vol, left, right, priority, callbackval);
if (handle < MV_Ok) 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); initprintf(tempbuf);
FX_SetErrorCode(FX_MultiVocError); FX_SetErrorCode(FX_MultiVocError);
handle = FX_Warning; handle = FX_Warning;
@ -786,7 +786,7 @@ int32_t FX_PlayLoopedOGG
pitchoffset, vol, left, right, priority, callbackval); pitchoffset, vol, left, right, priority, callbackval);
if (handle < MV_Ok) 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); initprintf(tempbuf);
FX_SetErrorCode(FX_MultiVocError); FX_SetErrorCode(FX_MultiVocError);
handle = FX_Warning; handle = FX_Warning;

View file

@ -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); status = MV_PlayLoopedWAV(ptr, -1, -1, pitchoffset, vol, left, right, priority, callbackval);
if (status < MV_Ok) 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); 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); status = MV_PlayLoopedVOC(ptr, -1, -1, pitchoffset, vol, left, right, priority, callbackval);
if (status < MV_Ok) 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); 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); status = MV_PlayLoopedOGG(ptr, -1, -1, pitchoffset, vol, left, right, priority, callbackval);
if (status < MV_Ok) 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); initprintf(tempbuf);
} }

View file

@ -429,7 +429,7 @@ int32 SCRIPT_Init(char * name)
{ {
int32 h = SCRIPT_New(); int32 h = SCRIPT_New();
if (h >= 0) strncpy(SCRIPT(h,scriptfilename), name, 127); if (h >= 0) Bstrncpy(SCRIPT(h,scriptfilename), name, 127);
return h; return h;
} }
@ -903,8 +903,8 @@ void SCRIPT_PutNumber
char raw[64]; char raw[64];
UNREFERENCED_PARAMETER(defaultvalue); UNREFERENCED_PARAMETER(defaultvalue);
if (hexadecimal) sprintf(raw, "0x%X", number); if (hexadecimal) Bsprintf(raw, "0x%X", number);
else sprintf(raw, "%d", number); else Bsprintf(raw, "%d", number);
SCRIPT_AddEntry(scripthandle, sectionname, entryname, raw); SCRIPT_AddEntry(scripthandle, sectionname, entryname, raw);
} }
@ -936,7 +936,7 @@ void SCRIPT_PutDouble
char raw[64]; char raw[64];
UNREFERENCED_PARAMETER(defaultvalue); UNREFERENCED_PARAMETER(defaultvalue);
sprintf(raw, "%g", number); Bsprintf(raw, "%g", number);
SCRIPT_AddEntry(scripthandle, sectionname, entryname, raw); SCRIPT_AddEntry(scripthandle, sectionname, entryname, raw);
} }

View file

@ -57,7 +57,7 @@ LONG MiniDumper::TopLevelFilter( struct _EXCEPTION_POINTERS *pExceptionInfo )
/*if (!GetTempPath( _MAX_PATH, szDumpPath )) /*if (!GetTempPath( _MAX_PATH, szDumpPath ))
_tcscpy( szDumpPath, "c:\\temp\\" ); _tcscpy( szDumpPath, "c:\\temp\\" );
*/ */
sprintf(szDumpPath,"%s_%u",m_szAppName,timeGetTime()); Bsprintf(szDumpPath,"%s_%u",m_szAppName,timeGetTime());
_tcscat( szDumpPath, ".dmp" ); _tcscat( szDumpPath, ".dmp" );
// ask the user if they want to save a dump file // 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 ); BOOL bOK = pDump( GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpNormal, &ExInfo, NULL, NULL );
if (bOK) if (bOK)
{ {
sprintf( szScratch, "Saved dump file to '%s'", szDumpPath ); Bsprintf( szScratch, "Saved dump file to '%s'", szDumpPath );
szResult = szScratch; szResult = szScratch;
retval = EXCEPTION_EXECUTE_HANDLER; retval = EXCEPTION_EXECUTE_HANDLER;
} }
else 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; szResult = szScratch;
} }
::CloseHandle(hFile); ::CloseHandle(hFile);
} }
else 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; szResult = szScratch;
} }
} }

View file

@ -1279,7 +1279,7 @@ void M_DisplayMenus(void)
mgametext(160,90,"LOAD last game:",0,2+8+16); 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,tempbuf,0,2+8+16);
mgametext(160,99+9,"(Y/N)",0,2+8+16); mgametext(160,99+9,"(Y/N)",0,2+8+16);
@ -1444,17 +1444,17 @@ void M_DisplayMenus(void)
M_DisplaySaveGameList(); M_DisplaySaveGameList();
sprintf(tempbuf,"PLAYERS: %-2d ",savehead.numplr); Bsprintf(tempbuf,"PLAYERS: %-2d ",savehead.numplr);
mgametext(160,156,tempbuf,0,2+8+16); 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); mgametext(160,168,tempbuf,0,2+8+16);
if (savehead.volnum == 0 && savehead.levnum == 7) if (savehead.volnum == 0 && savehead.levnum == 7)
mgametext(160,180,savehead.boardfn,0,2+8+16); mgametext(160,180,savehead.boardfn,0,2+8+16);
mgametext(160,90,"LOAD game:",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,tempbuf,0,2+8+16);
mgametext(160,99+9,"(Y/N)",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"); 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); 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); 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); mgametext(160,168,tempbuf,0,2+8+16);
if (ud.volume_number == 0 && ud.level_number == 7) 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; else if (glanisotropy < 1) glanisotropy = (int32_t)glinfo.maxanisotropy;
gltexapplyprops(); gltexapplyprops();
if (glanisotropy == 1) strcpy(tempbuf,"NONE"); if (glanisotropy == 1) strcpy(tempbuf,"NONE");
else sprintf(tempbuf,"%dx",glanisotropy); else Bsprintf(tempbuf,"%dx",glanisotropy);
mgametextpal(d,yy, tempbuf, MENUHIGHLIGHT(io), 0); mgametextpal(d,yy, tempbuf, MENUHIGHLIGHT(io), 0);
break; break;
} }
@ -3394,7 +3394,7 @@ cheat_for_port_credits:
} }
menutext(c,50,MENUHIGHLIGHT(0),0,"RESOLUTION"); 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)?xdim:validmode[newvidmode].xdim,
(newvidmode==validmodecnt)?ydim:validmode[newvidmode].ydim); (newvidmode==validmodecnt)?ydim:validmode[newvidmode].ydim);
mgametext(c+168,50-8,tempbuf,MENUHIGHLIGHT(0),2+8+16); 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"); menutext(320>>1,24,0,0,"KEYBOARD SETUP");
mgametext(320>>1,90,"PRESS THE KEY TO ASSIGN AS",0,2+8+16); 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,tempbuf,0,2+8+16);
mgametext(320>>1,90+9+9+9,"PRESS \"ESCAPE\" TO CANCEL",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 (function == 0)
{ {
if (whichkey < (MAXMOUSEBUTTONS-2)*2) 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 else
Bstrcpy(tempbuf, mousebuttonnames[whichkey-(MAXMOUSEBUTTONS-2)]); Bstrcpy(tempbuf, mousebuttonnames[whichkey-(MAXMOUSEBUTTONS-2)]);
} }
@ -4125,7 +4125,7 @@ cheat_for_port_credits:
{ {
if (m+l < 2*joynumbuttons) 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]; x = ud.config.JoystickFunctions[(l+m)>>1][(l+m)&1];
} }
else else
@ -4133,7 +4133,7 @@ cheat_for_port_credits:
static char *directions[] = static char *directions[] =
{ "Up", "Right", "Down", "Left" { "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]; 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); 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) if (joynumaxes > 2)
{ {
menutext(320>>1,twothispage?158:108,SHX(-10),(joynumaxes<=2),"NEXT..."); 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); mgametext(320-100,158,tempbuf,0,2+8+16);
} }
break; break;
@ -4401,7 +4401,7 @@ cheat_for_port_credits:
if (joynumaxes>4) if (joynumaxes>4)
{ {
menutext(32,48+30*(last-first),0,0,"NEXT..."); 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); mgametext(320-100,158,tempbuf,0,2+8+16);
} }
break; break;
@ -4715,9 +4715,9 @@ cheat_for_port_credits:
if (g_currentMenu >= 360 && g_currentMenu <= 369) 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); 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); mgametext(160,168,tempbuf,0,2+8+16);
if (ud.volume_number == 0 && ud.level_number == 7) if (ud.volume_number == 0 && ud.level_number == 7)
mgametext(160,180,currentboardfilename,0,2+8+16); 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); 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); 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); mgametext(160,168,tempbuf,0,2+8+16);
if (savehead.volnum == 0 && savehead.levnum == 7) if (savehead.volnum == 0 && savehead.levnum == 7)
mgametext(160,180,savehead.boardfn,0,2+8+16); 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); 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"); 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); 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); mgametext(160,168,tempbuf,0,2+8+16);
if (ud.volume_number == 0 && ud.level_number == 7) if (ud.volume_number == 0 && ud.level_number == 7)
mgametext(160,180,currentboardfilename,0,2+8+16); 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); 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]); 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,50,tempbuf,0,2+8+16);
mgametext(160,59,"to select level",0,2+8+16); mgametext(160,59,"to select level",0,2+8+16);
@ -5368,16 +5368,16 @@ VOLUME_ALL_40x:
if (VOLUMEONE) 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); menutext(c,57+16-9,MENUHIGHLIGHT(1),1,tempbuf);
} }
else 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); 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-9,MENUHIGHLIGHT(2),PHX(-4),tempbuf);
menutext(c,57+16+16+16-9,MENUHIGHLIGHT(3),PHX(-5),"MONSTERS"); menutext(c,57+16+16+16-9,MENUHIGHLIGHT(3),PHX(-5),"MONSTERS");

View file

@ -119,7 +119,7 @@ int32 RTS_AddFile(const char *filename)
lump_p->handle = handle; lump_p->handle = handle;
lump_p->position = IntelLong(fileinfo->filepos); lump_p->position = IntelLong(fileinfo->filepos);
lump_p->size = IntelLong(fileinfo->size); lump_p->size = IntelLong(fileinfo->size);
strncpy(lump_p->name, fileinfo->name, 8); Bstrncpy(lump_p->name, fileinfo->name, 8);
} }
free(fileinfoo); free(fileinfoo);

View file

@ -70,7 +70,7 @@ void S_SoundStartup(void)
if (status != FX_Ok) 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); G_GameExit(tempbuf);
} }
} }
@ -94,7 +94,7 @@ void S_SoundShutdown(void)
status = FX_Shutdown(); status = FX_Shutdown();
if (status != FX_Ok) 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); G_GameExit(tempbuf);
} }
} }

View file

@ -760,7 +760,7 @@ int32_t startwin_run(void)
settings.usemouse = ud.config.UseMouse; settings.usemouse = ud.config.UseMouse;
settings.usejoy = ud.config.UseJoystick; settings.usejoy = ud.config.UseJoystick;
settings.game = g_gameType; settings.game = g_gameType;
strncpy(settings.selectedgrp, duke3dgrp, BMAX_PATH); Bstrncpy(settings.selectedgrp, duke3dgrp, BMAX_PATH);
PopulateForm(-1); PopulateForm(-1);
gtk_main(); gtk_main();

View file

@ -634,7 +634,7 @@ int32_t startwin_run(void)
settings.usejoy = ud.config.UseJoystick; settings.usejoy = ud.config.UseJoystick;
settings.game = g_gameType; settings.game = g_gameType;
// settings.crcval = 0; // settings.crcval = 0;
strncpy(settings.selectedgrp, duke3dgrp, BMAX_PATH); Bstrncpy(settings.selectedgrp, duke3dgrp, BMAX_PATH);
settings.gamedir = mod_dir; settings.gamedir = mod_dir;
PopulateForm(-1); PopulateForm(-1);

View file

@ -271,7 +271,7 @@ void Net_DisplaySyncMsg(void)
{ {
if (g_numSyncBytes > 1) 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); 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') 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); strcpy(g_szfirstSyncMsg[j], tempbuf);
} }
} }
@ -302,9 +302,9 @@ void Net_DisplaySyncMsg(void)
{ {
if (g_numSyncBytes > 1) 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); 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); printext256(4L, 52L + (i * 8), 31, 1, tempbuf, 0);
} }
else 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 sb;
int32_t count = 0; 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; int32_t sb, i;
extern int32_t syncvaltail, syncvaltottail; extern int32_t syncvaltail, syncvaltottail;

View file

@ -44,9 +44,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst, LPSTR lpCmdLine, in
CmdLine[i] = '\0'; CmdLine[i] = '\0';
} }
if (szFileName[0] != '\0' && CmdLine[0] != '\0') sprintf(sCmdLine,"eduke32.exe %s -rmnet %s",CmdLine,szFileName); if (szFileName[0] != '\0' && CmdLine[0] != '\0') Bsprintf(sCmdLine,"eduke32.exe %s -rmnet %s",CmdLine,szFileName);
else if (CmdLine[0] != '\0') sprintf(sCmdLine,"eduke32.exe %s",CmdLine); else if (CmdLine[0] != '\0') Bsprintf(sCmdLine,"eduke32.exe %s",CmdLine);
else sprintf(sCmdLine,"eduke32.exe"); else Bsprintf(sCmdLine,"eduke32.exe");
szCmdLine = sCmdLine; szCmdLine = sCmdLine;