"return" is not a function.

git-svn-id: https://svn.eduke32.com/eduke32@5803 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2016-06-21 00:34:41 +00:00
parent 951ad678c4
commit 95f7cf0982
35 changed files with 327 additions and 329 deletions

View file

@ -114,7 +114,7 @@ char getpixel(int32_t x, int32_t y)
begindrawing(); //{{{ begindrawing(); //{{{
r = readpixel((void *) (ylookup[y]+x+frameplace)); r = readpixel((void *) (ylookup[y]+x+frameplace));
enddrawing(); //}}} enddrawing(); //}}}
return(r); return r;
} }

View file

@ -919,7 +919,7 @@ CANCEL:
// clearfilenames(); // clearfilenames();
uninitengine(); uninitengine();
return(0); return 0;
} }
static int32_t mhk=0; static int32_t mhk=0;
@ -1523,7 +1523,7 @@ char changechar(char dachar, int32_t dadir, char smooshyalign, char boundcheck)
} }
} }
} }
return(dachar); return dachar;
} }
@ -8719,7 +8719,7 @@ static int32_t adjustmark(int32_t *xplc, int32_t *yplc, int16_t danumwalls)
*xplc = dax; *xplc = dax;
*yplc = day; *yplc = day;
return(0); return 0;
} }
static int32_t checkautoinsert(int32_t dax, int32_t day, int16_t danumwalls) static int32_t checkautoinsert(int32_t dax, int32_t day, int16_t danumwalls)
@ -8954,7 +8954,7 @@ static int32_t deletesector(int16_t sucksect)
if (wall[i].nextwall >= startwall) if (wall[i].nextwall >= startwall)
wall[i].nextsector--; wall[i].nextsector--;
return(0); return 0;
} }
int32_t fixspritesectors(void) int32_t fixspritesectors(void)
@ -9045,7 +9045,7 @@ static int32_t movewalls(int32_t start, int32_t offs)
yax_tweakwalls(start, offs); yax_tweakwalls(start, offs);
#endif #endif
return(0); return 0;
} }
int32_t wallength(int16_t i) int32_t wallength(int16_t i)
@ -9177,7 +9177,7 @@ static int32_t numloopsofsector(int16_t sectnum)
endwall = startwall + sector[sectnum].wallnum; endwall = startwall + sector[sectnum].wallnum;
for (i=startwall; i<endwall; i++) for (i=startwall; i<endwall; i++)
if (wall[i].point2 < i) numloops++; if (wall[i].point2 < i) numloops++;
return(numloops); return numloops;
} }
#endif #endif
@ -9628,7 +9628,7 @@ static int32_t getfilenames(const char *path, const char *kind)
findfileshigh = fnlist.findfiles; findfileshigh = fnlist.findfiles;
currentlist = (findfileshigh != NULL); currentlist = (findfileshigh != NULL);
return(0); return 0;
} }
static void tweak_sboardfilename(void) static void tweak_sboardfilename(void)
@ -10122,7 +10122,7 @@ int32_t fillsector_maybetrans(int16_t sectnum, int32_t fillcolor, uint8_t dotran
} }
} }
return(0); return 0;
} }
static int16_t whitelinescan(int16_t sucksect, int16_t dalinehighlight) static int16_t whitelinescan(int16_t sucksect, int16_t dalinehighlight)

View file

@ -50,7 +50,7 @@ static intptr_t kzipopen(const char *filnam)
newst[0] = '|'; newst[0] = '|';
for (i=0; filnam[i] && (i < sizeof(newst)-2); i++) newst[i+1] = filnam[i]; for (i=0; filnam[i] && (i < sizeof(newst)-2); i++) newst[i+1] = filnam[i];
newst[i+1] = 0; newst[i+1] = 0;
return(kzopen(newst)); return kzopen(newst);
} }
#endif #endif
@ -1140,7 +1140,7 @@ int32_t kread_internal(int32_t handle, void *buffer, int32_t leng, uint8_t *arra
int32_t filenum = arrayhan[handle]; int32_t filenum = arrayhan[handle];
int32_t groupnum = arraygrp[handle]; int32_t groupnum = arraygrp[handle];
if (groupnum == GRP_FILESYSTEM) return(Bread(filenum,buffer,leng)); if (groupnum == GRP_FILESYSTEM) return Bread(filenum,buffer,leng);
#ifdef WITHKPLIB #ifdef WITHKPLIB
else if (groupnum == GRP_ZIP) else if (groupnum == GRP_ZIP)
{ {
@ -1151,7 +1151,7 @@ int32_t kread_internal(int32_t handle, void *buffer, int32_t leng, uint8_t *arra
kzipopen(filenamsav[handle]); kzipopen(filenamsav[handle]);
kzseek(arraypos[handle],SEEK_SET); kzseek(arraypos[handle],SEEK_SET);
} }
return(kzread(buffer,leng)); return kzread(buffer,leng);
} }
#endif #endif
@ -1177,10 +1177,10 @@ int32_t kread_internal(int32_t handle, void *buffer, int32_t leng, uint8_t *arra
leng = Bread(groupfil[rootgroupnum],buffer,leng); leng = Bread(groupfil[rootgroupnum],buffer,leng);
arraypos[handle] += leng; arraypos[handle] += leng;
groupfilpos[rootgroupnum] += leng; groupfilpos[rootgroupnum] += leng;
return(leng); return leng;
} }
return(0); return 0;
} }
int32_t klseek_internal(int32_t handle, int32_t offset, int32_t whence, uint8_t *arraygrp, intptr_t *arrayhan, int32_t *arraypos) int32_t klseek_internal(int32_t handle, int32_t offset, int32_t whence, uint8_t *arraygrp, intptr_t *arrayhan, int32_t *arraypos)
@ -1189,7 +1189,7 @@ int32_t klseek_internal(int32_t handle, int32_t offset, int32_t whence, uint8_t
groupnum = arraygrp[handle]; groupnum = arraygrp[handle];
if (groupnum == GRP_FILESYSTEM) return(Blseek(arrayhan[handle],offset,whence)); if (groupnum == GRP_FILESYSTEM) return Blseek(arrayhan[handle],offset,whence);
#ifdef WITHKPLIB #ifdef WITHKPLIB
else if (groupnum == GRP_ZIP) else if (groupnum == GRP_ZIP)
{ {
@ -1200,7 +1200,7 @@ int32_t klseek_internal(int32_t handle, int32_t offset, int32_t whence, uint8_t
kzipopen(filenamsav[handle]); kzipopen(filenamsav[handle]);
kzseek(arraypos[handle],SEEK_SET); kzseek(arraypos[handle],SEEK_SET);
} }
return(kzseek(offset,whence)); return kzseek(offset,whence);
} }
#endif #endif
@ -1217,9 +1217,9 @@ int32_t klseek_internal(int32_t handle, int32_t offset, int32_t whence, uint8_t
case BSEEK_CUR: case BSEEK_CUR:
arraypos[handle] += offset; break; arraypos[handle] += offset; break;
} }
return(arraypos[handle]); return arraypos[handle];
} }
return(-1); return -1;
} }
int32_t kfilelength_internal(int32_t handle, uint8_t *arraygrp, intptr_t *arrayhan, int32_t *arraypos) int32_t kfilelength_internal(int32_t handle, uint8_t *arraygrp, intptr_t *arrayhan, int32_t *arraypos)
@ -1246,14 +1246,14 @@ int32_t kfilelength_internal(int32_t handle, uint8_t *arraygrp, intptr_t *arrayh
} }
#endif #endif
i = arrayhan[handle]; i = arrayhan[handle];
return(gfileoffs[groupnum][i+1]-gfileoffs[groupnum][i]); return gfileoffs[groupnum][i+1]-gfileoffs[groupnum][i];
} }
int32_t ktell_internal(int32_t handle, uint8_t *arraygrp, intptr_t *arrayhan, int32_t *arraypos) int32_t ktell_internal(int32_t handle, uint8_t *arraygrp, intptr_t *arrayhan, int32_t *arraypos)
{ {
int32_t groupnum = arraygrp[handle]; int32_t groupnum = arraygrp[handle];
if (groupnum == GRP_FILESYSTEM) return(Blseek(arrayhan[handle],0,BSEEK_CUR)); if (groupnum == GRP_FILESYSTEM) return Blseek(arrayhan[handle],0,BSEEK_CUR);
#ifdef WITHKPLIB #ifdef WITHKPLIB
else if (groupnum == GRP_ZIP) else if (groupnum == GRP_ZIP)
{ {
@ -1269,7 +1269,7 @@ int32_t ktell_internal(int32_t handle, uint8_t *arraygrp, intptr_t *arrayhan, in
#endif #endif
if (groupfil[groupnum] != -1) if (groupfil[groupnum] != -1)
return arraypos[handle]; return arraypos[handle];
return(-1); return -1;
} }
void kclose_internal(int32_t handle, uint8_t *arraygrp, intptr_t *arrayhan) void kclose_internal(int32_t handle, uint8_t *arraygrp, intptr_t *arrayhan)

View file

@ -1338,7 +1338,7 @@ int32_t pushmove(vec3_t *vect, int16_t *sectnum,
bad2--; if (bad2 == 0) break; bad2--; if (bad2 == 0) break;
} while ((klabs((vect->x)-spr->x) < t) && (klabs((vect->y)-spr->y) < t)); } while ((klabs((vect->x)-spr->x) < t) && (klabs((vect->y)-spr->y) < t));
bad = -1; bad = -1;
k--; if (k <= 0) return(bad); k--; if (k <= 0) return bad;
updatesector(vect->x, vect->y, sectnum); updatesector(vect->x, vect->y, sectnum);
} }
} }
@ -1399,7 +1399,7 @@ int32_t pushmove(vec3_t *vect, int16_t *sectnum,
bad2--; if (bad2 == 0) break; bad2--; if (bad2 == 0) break;
} while (clipinsidebox((vec2_t *)vect, i, walldist-4) != 0); } while (clipinsidebox((vec2_t *)vect, i, walldist-4) != 0);
bad = -1; bad = -1;
k--; if (k <= 0) return(bad); k--; if (k <= 0) return bad;
updatesector(vect->x, vect->y, sectnum); updatesector(vect->x, vect->y, sectnum);
if (*sectnum < 0) return -1; if (*sectnum < 0) return -1;
} }
@ -1416,5 +1416,5 @@ int32_t pushmove(vec3_t *vect, int16_t *sectnum,
dir = -dir; dir = -dir;
} while (bad != 0); } while (bad != 0);
return(bad); return bad;
} }

View file

@ -166,7 +166,7 @@ int32_t fnlist_getnames(fnlist_t *fnl, const char *dirname, const char *pattern,
for (r=fnl->findfiles; r; r=r->next) for (r=fnl->findfiles; r; r=r->next)
fnl->numfiles++; fnl->numfiles++;
return(0); return 0;
} }

View file

@ -419,7 +419,7 @@ static int32_t defsparser(scriptfile *script)
initprintf("Error on line %s:%d.\n", script->filename,scriptfile_getlinum(script,cmdtokptr)); initprintf("Error on line %s:%d.\n", script->filename,scriptfile_getlinum(script,cmdtokptr));
break; break;
case T_EOF: case T_EOF:
return(0); return 0;
case T_INCLUDE: case T_INCLUDE:
{ {
char *fn; char *fn;

View file

@ -2132,9 +2132,9 @@ static int32_t spriteobstructswall(spritetype *s, int32_t w)
// check if the sprite obstructs the wall // check if the sprite obstructs the wall
if ((d1 < d2) && (min(x1, x2) <= x) && (x <= max(x1, x2)) && (min(y1, y2) <= y) && (y <= max(y1, y2))) if ((d1 < d2) && (min(x1, x2) <= x) && (x <= max(x1, x2)) && (min(y1, y2) <= y) && (y <= max(y1, y2)))
return (1); return 1;
else else
return (0); return 0;
} }
#endif #endif
// //
@ -2147,14 +2147,14 @@ static inline int32_t bunchfront(int32_t b1, int32_t b2)
int const x2b2 = xb2[bunchlast[b2]] + 1; int const x2b2 = xb2[bunchlast[b2]] + 1;
if (x1b1 >= x2b2) if (x1b1 >= x2b2)
return (-1); return -1;
int b2f = bunchfirst[b2]; int b2f = bunchfirst[b2];
int const x1b2 = xb1[b2f]; int const x1b2 = xb1[b2f];
int const x2b1 = xb2[bunchlast[b1]] + 1; int const x2b1 = xb2[bunchlast[b1]] + 1;
if (x1b2 >= x2b1) if (x1b2 >= x2b1)
return (-1); return -1;
if (x1b1 >= x1b2) if (x1b1 >= x1b2)
{ {
@ -6145,7 +6145,7 @@ static int32_t clippoly(int32_t npoints, int32_t clipstat)
while ((z < npoints) && (xb1[z] < 0)) z++; while ((z < npoints) && (xb1[z] < 0)) z++;
} }
while (z < npoints); while (z < npoints);
if (npoints2 <= 2) return(0); if (npoints2 <= 2) return 0;
for (z=1; z<splitcnt; z++) for (z=1; z<splitcnt; z++)
for (zz=0; zz<z; zz++) for (zz=0; zz<z; zz++)
@ -6194,7 +6194,7 @@ static int32_t clippoly(int32_t npoints, int32_t clipstat)
while ((z < npoints2) && (xb2[z] < 0)) z++; while ((z < npoints2) && (xb2[z] < 0)) z++;
} }
while (z < npoints2); while (z < npoints2);
if (npoints <= 2) return(0); if (npoints <= 2) return 0;
for (z=1; z<splitcnt; z++) for (z=1; z<splitcnt; z++)
for (zz=0; zz<z; zz++) for (zz=0; zz<z; zz++)
@ -6244,7 +6244,7 @@ static int32_t clippoly(int32_t npoints, int32_t clipstat)
while ((z < npoints) && (xb1[z] < 0)) z++; while ((z < npoints) && (xb1[z] < 0)) z++;
} }
while (z < npoints); while (z < npoints);
if (npoints2 <= 2) return(0); if (npoints2 <= 2) return 0;
for (z=1; z<splitcnt; z++) for (z=1; z<splitcnt; z++)
for (zz=0; zz<z; zz++) for (zz=0; zz<z; zz++)
@ -6293,7 +6293,7 @@ static int32_t clippoly(int32_t npoints, int32_t clipstat)
while ((z < npoints2) && (xb2[z] < 0)) z++; while ((z < npoints2) && (xb2[z] < 0)) z++;
} }
while (z < npoints2); while (z < npoints2);
if (npoints <= 2) return(0); if (npoints <= 2) return 0;
for (z=1; z<splitcnt; z++) for (z=1; z<splitcnt; z++)
for (zz=0; zz<z; zz++) for (zz=0; zz<z; zz++)
@ -6307,7 +6307,7 @@ static int32_t clippoly(int32_t npoints, int32_t clipstat)
{ t = xb1[bunchp2[z]]; xb1[bunchp2[z]] = xb1[bunchp2[zz]]; xb1[bunchp2[zz]] = t; } { t = xb1[bunchp2[z]]; xb1[bunchp2[z]] = xb1[bunchp2[zz]]; xb1[bunchp2[zz]] = t; }
} }
} }
return(npoints); return npoints;
} }
@ -6342,7 +6342,7 @@ static int32_t clippoly4(int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2)
z = zz; z = zz;
} }
while (z != 0); while (z != 0);
if (nn < 3) return(0); if (nn < 3) return 0;
n = 0; z = 0; n = 0; z = 0;
do do
@ -6366,7 +6366,7 @@ static int32_t clippoly4(int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2)
z = zz; z = zz;
} }
while (z != 0); while (z != 0);
return(n); return n;
} }
@ -7370,7 +7370,7 @@ int32_t changespritestat(int16_t spritenum, int16_t newstatnum)
do_deletespritestat(spritenum); do_deletespritestat(spritenum);
do_insertsprite_at_headofstat(spritenum, newstatnum); do_insertsprite_at_headofstat(spritenum, newstatnum);
return(0); return 0;
} }
// //
@ -8155,15 +8155,15 @@ _point2d intersection(_equation eq1, _equation eq2)
ret.x = ((eq1.b*eq2.c - eq2.b*eq1.c) * det); ret.x = ((eq1.b*eq2.c - eq2.b*eq1.c) * det);
ret.y = ((eq2.a*eq1.c - eq1.a*eq2.c) * det); ret.y = ((eq2.a*eq1.c - eq1.a*eq2.c) * det);
return (ret); return ret;
} }
// check if a point that's on the line is within the segment boundaries // check if a point that's on the line is within the segment boundaries
int32_t pointonmask(_point2d point, _maskleaf* wall) int32_t pointonmask(_point2d point, _maskleaf* wall)
{ {
if ((min(wall->p1.x, wall->p2.x) <= point.x) && (point.x <= max(wall->p1.x, wall->p2.x)) && (min(wall->p1.y, wall->p2.y) <= point.y) && (point.y <= max(wall->p1.y, wall->p2.y))) if ((min(wall->p1.x, wall->p2.x) <= point.x) && (point.x <= max(wall->p1.x, wall->p2.x)) && (min(wall->p1.y, wall->p2.y) <= point.y) && (point.y <= max(wall->p1.y, wall->p2.y)))
return (1); return 1;
return (0); return 0;
} }
// returns 1 if wall2 is hidden by wall1 // returns 1 if wall2 is hidden by wall1
@ -8173,21 +8173,21 @@ int32_t wallobstructswall(_maskleaf* wall1, _maskleaf* wall2)
cross = intersection(wall2->p1eq, wall1->maskeq); cross = intersection(wall2->p1eq, wall1->maskeq);
if (pointonmask(cross, wall1)) if (pointonmask(cross, wall1))
return (1); return 1;
cross = intersection(wall2->p2eq, wall1->maskeq); cross = intersection(wall2->p2eq, wall1->maskeq);
if (pointonmask(cross, wall1)) if (pointonmask(cross, wall1))
return (1); return 1;
cross = intersection(wall1->p1eq, wall2->maskeq); cross = intersection(wall1->p1eq, wall2->maskeq);
if (pointonmask(cross, wall2)) if (pointonmask(cross, wall2))
return (1); return 1;
cross = intersection(wall1->p2eq, wall2->maskeq); cross = intersection(wall1->p2eq, wall2->maskeq);
if (pointonmask(cross, wall2)) if (pointonmask(cross, wall2))
return (1); return 1;
return (0); return 0;
} }
// recursive mask drawing function // recursive mask drawing function
@ -9287,15 +9287,15 @@ int32_t loadoldboard(const char *filename, char fromwhere, vec3_t *dapos, int16_
struct spritetypev6 v6spr; struct spritetypev6 v6spr;
if ((fil = kopen4load(filename,fromwhere)) == -1) if ((fil = kopen4load(filename,fromwhere)) == -1)
{ mapversion = 5L; return(-1); } { mapversion = 5L; return -1; }
kread(fil,&mapversion,4); mapversion = B_LITTLE32(mapversion); kread(fil,&mapversion,4); mapversion = B_LITTLE32(mapversion);
if (mapversion != 5L && mapversion != 6L) { kclose(fil); return(-2); } if (mapversion != 5L && mapversion != 6L) { kclose(fil); return -2; }
prepare_loadboard(fil, dapos, daang, dacursectnum); prepare_loadboard(fil, dapos, daang, dacursectnum);
kread(fil,&numsectors,2); numsectors = B_LITTLE16(numsectors); kread(fil,&numsectors,2); numsectors = B_LITTLE16(numsectors);
if (numsectors > MAXSECTORS) { kclose(fil); return(-1); } if (numsectors > MAXSECTORS) { kclose(fil); return -1; }
for (i=0; i<numsectors; i++) for (i=0; i<numsectors; i++)
{ {
switch (mapversion) switch (mapversion)
@ -9340,7 +9340,7 @@ int32_t loadoldboard(const char *filename, char fromwhere, vec3_t *dapos, int16_
} }
kread(fil,&numwalls,2); numwalls = B_LITTLE16(numwalls); kread(fil,&numwalls,2); numwalls = B_LITTLE16(numwalls);
if (numwalls > MAXWALLS) { kclose(fil); return(-1); } if (numwalls > MAXWALLS) { kclose(fil); return -1; }
for (i=0; i<numwalls; i++) for (i=0; i<numwalls; i++)
{ {
switch (mapversion) switch (mapversion)
@ -9387,7 +9387,7 @@ int32_t loadoldboard(const char *filename, char fromwhere, vec3_t *dapos, int16_
} }
kread(fil,&numsprites,2); numsprites = B_LITTLE16(numsprites); kread(fil,&numsprites,2); numsprites = B_LITTLE16(numsprites);
if (numsprites > MAXSPRITES) { kclose(fil); return(-1); } if (numsprites > MAXSPRITES) { kclose(fil); return -1; }
for (i=0; i<numsprites; i++) for (i=0; i<numsprites; i++)
{ {
switch (mapversion) switch (mapversion)
@ -9763,21 +9763,21 @@ int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t da
if (in3dmode() && videomodereset == 0 && if (in3dmode() && videomodereset == 0 &&
(davidoption == fullscreen) && (xdim == daxdim) && (ydim == daydim) && (bpp == dabpp)) (davidoption == fullscreen) && (xdim == daxdim) && (ydim == daydim) && (bpp == dabpp))
return(0); return 0;
Bstrcpy(kensmessage,"!!!! BUILD engine&tools programmed by Ken Silverman of E.G. RI." Bstrcpy(kensmessage,"!!!! BUILD engine&tools programmed by Ken Silverman of E.G. RI."
" (c) Copyright 1995 Ken Silverman. Summary: BUILD = Ken. !!!!"); " (c) Copyright 1995 Ken Silverman. Summary: BUILD = Ken. !!!!");
// if (getkensmessagecrc(FP_OFF(kensmessage)) != 0x56c764d4) // if (getkensmessagecrc(FP_OFF(kensmessage)) != 0x56c764d4)
// { OSD_Printf("Nice try.\n"); Bexit(0); } // { OSD_Printf("Nice try.\n"); Bexit(0); }
//if (checkvideomode(&daxdim, &daydim, dabpp, davidoption)<0) return (-1); //if (checkvideomode(&daxdim, &daydim, dabpp, davidoption)<0) return -1;
//bytesperline is set in this function //bytesperline is set in this function
j = bpp; j = bpp;
g_lastpalettesum = 0; g_lastpalettesum = 0;
if (setvideomode(daxdim,daydim,dabpp,davidoption) < 0) return(-1); if (setvideomode(daxdim,daydim,dabpp,davidoption) < 0) return -1;
// Workaround possible bugs in the GL driver // Workaround possible bugs in the GL driver
makeasmwriteable(); makeasmwriteable();
@ -9838,7 +9838,7 @@ int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t da
#endif #endif
#endif #endif
qsetmode = 200; qsetmode = 200;
return(0); return 0;
} }
@ -10092,11 +10092,11 @@ int32_t setsprite(int16_t spritenum, const vec3_t *newpos)
updatesector(newpos->x,newpos->y,&tempsectnum); updatesector(newpos->x,newpos->y,&tempsectnum);
if (tempsectnum < 0) if (tempsectnum < 0)
return(-1); return -1;
if (tempsectnum != sprite[spritenum].sectnum) if (tempsectnum != sprite[spritenum].sectnum)
changespritesect(spritenum,tempsectnum); changespritesect(spritenum,tempsectnum);
return(0); return 0;
} }
int32_t setspritez(int16_t spritenum, const vec3_t *newpos) int32_t setspritez(int16_t spritenum, const vec3_t *newpos)
@ -10109,11 +10109,11 @@ int32_t setspritez(int16_t spritenum, const vec3_t *newpos)
updatesectorz(newpos->x,newpos->y,newpos->z,&tempsectnum); updatesectorz(newpos->x,newpos->y,newpos->z,&tempsectnum);
if (tempsectnum < 0) if (tempsectnum < 0)
return(-1); return -1;
if (tempsectnum != sprite[spritenum].sectnum) if (tempsectnum != sprite[spritenum].sectnum)
changespritesect(spritenum,tempsectnum); changespritesect(spritenum,tempsectnum);
return(0); return 0;
} }
@ -10902,7 +10902,7 @@ restart_grand:
} }
#endif #endif
return(0); return 0;
} }

View file

@ -352,7 +352,7 @@ FORCE_INLINE int32_t bad_tspr(const uspritetype *tspr)
// //
FORCE_INLINE int32_t getpalookup(int32_t davis, int32_t dashade) FORCE_INLINE int32_t getpalookup(int32_t davis, int32_t dashade)
{ {
return (min(max(dashade + (davis >> 8), 0), numshades - 1)); return min(max(dashade + (davis >> 8), 0), numshades - 1);
} }
FORCE_INLINE int32_t getpalookupsh(int32_t davis) { return getpalookup(davis, globalshade) << 8; } FORCE_INLINE int32_t getpalookupsh(int32_t davis) { return getpalookup(davis, globalshade) << 8; }

View file

@ -4052,7 +4052,7 @@ jwzgles_gluProject (GLdouble objx, GLdouble objy, GLdouble objz,
in[3]=1.0; in[3]=1.0;
__gluMultMatrixVecd(modelMatrix, in, out); __gluMultMatrixVecd(modelMatrix, in, out);
__gluMultMatrixVecd(projMatrix, out, in); __gluMultMatrixVecd(projMatrix, out, in);
if (in[3] == 0.0) return(GL_FALSE); if (in[3] == 0.0) return GL_FALSE;
in[0] /= in[3]; in[0] /= in[3];
in[1] /= in[3]; in[1] /= in[3];
in[2] /= in[3]; in[2] /= in[3];
@ -4068,7 +4068,7 @@ jwzgles_gluProject (GLdouble objx, GLdouble objy, GLdouble objz,
*winx=in[0]; *winx=in[0];
*winy=in[1]; *winy=in[1];
*winz=in[2]; *winz=in[2];
return(GL_TRUE); return GL_TRUE;
} }

View file

@ -46,13 +46,12 @@ credits.
# if !defined __INTEL_COMPILER # if !defined __INTEL_COMPILER
typedef long long __int64; typedef long long __int64;
# endif # endif
static __inline int32_t _lrotl(int32_t i, int sh) static __inline int32_t _lrotl(int32_t i, int sh) { return (i >> (-sh)) | (i << sh); }
{ return((i>>(-sh))|(i<<sh)); }
/*__inline*/ int32_t filelength(int h) /*__inline*/ int32_t filelength(int h)
{ {
struct stat st; struct stat st;
if (fstat(h,&st) < 0) return(-1); if (fstat(h,&st) < 0) return -1;
return(st.st_size); return st.st_size;
} }
#define _fileno fileno #define _fileno fileno
#else #else
@ -206,7 +205,7 @@ static inline int32_t bitrev(int32_t b, int32_t c)
{ {
int32_t i, j; int32_t i, j;
for (i=1,j=0,c=(1<<c); i<c; i+=i) { j += j; if (b&i) j++; } for (i=1,j=0,c=(1<<c); i<c; i+=i) { j += j; if (b&i) j++; }
return(j); return j;
} }
#endif #endif
@ -248,9 +247,9 @@ static void suckbitsnextblock()
filptr = &fakebuf[4]; bitpos -= 32; filptr = &fakebuf[4]; bitpos -= 32;
} }
static _inline int32_t peekbits(int32_t n) { return((B_LITTLE32(B_UNBUF32(&filptr[bitpos>>3]))>>(bitpos&7))&pow2mask[n]); } static _inline int32_t peekbits(int32_t n) { return (B_LITTLE32(B_UNBUF32(&filptr[bitpos>>3]))>>(bitpos&7))&pow2mask[n]; }
static _inline void suckbits(int32_t n) { bitpos += n; if (bitpos < 0) return; suckbitsnextblock(); } static _inline void suckbits(int32_t n) { bitpos += n; if (bitpos < 0) return; suckbitsnextblock(); }
static _inline int32_t getbits(int32_t n) { int32_t i = peekbits(n); suckbits(n); return(i); } static _inline int32_t getbits(int32_t n) { int32_t i = peekbits(n); suckbits(n); return i; }
static int32_t hufgetsym(int32_t *hitab, int32_t *hbmax) static int32_t hufgetsym(int32_t *hitab, int32_t *hbmax)
{ {
@ -259,7 +258,7 @@ static int32_t hufgetsym(int32_t *hitab, int32_t *hbmax)
v = n = 0; v = n = 0;
do { v = (v<<1)+getbits(1)+hbmax[n]-hbmax[n+1]; n++; } do { v = (v<<1)+getbits(1)+hbmax[n]-hbmax[n+1]; n++; }
while (v >= 0); while (v >= 0);
return(hitab[hbmax[n]+v]); return hitab[hbmax[n]+v];
} }
//This did not result in a speed-up on P4-3.6Ghz (02/22/2005) //This did not result in a speed-up on P4-3.6Ghz (02/22/2005)
@ -269,7 +268,7 @@ static int32_t hufgetsym(int32_t *hitab, int32_t *hbmax)
// //
// v = bitrev(getbits(n),n)+addit; // v = bitrev(getbits(n),n)+addit;
// do { v = (v<<1)+getbits(1)+hbmax[n]-hbmax[n+1]; n++; } while (v >= 0); // do { v = (v<<1)+getbits(1)+hbmax[n]-hbmax[n+1]; n++; } while (v >= 0);
// return(hitab[hbmax[n]+v]); // return hitab[hbmax[n]+v];
//} //}
static void qhufgencode(int32_t *hitab, int32_t *hbmax, int32_t *qhval, uint8_t *qhbit, int32_t numbits) static void qhufgencode(int32_t *hitab, int32_t *hbmax, int32_t *qhval, uint8_t *qhbit, int32_t numbits)
@ -312,7 +311,7 @@ static void qhufgencode(int32_t *hitab, int32_t *hbmax, int32_t *qhval, uint8_t
// //hufgetsym_skipb related code: // //hufgetsym_skipb related code:
//for(k=n=0;n<numbits;n++) k = (k<<1)+hbmax[n]-hbmax[n+1]; //for(k=n=0;n<numbits;n++) k = (k<<1)+hbmax[n]-hbmax[n+1];
//return(k); //return k;
} }
//inbuf[inum] : Bit length of each symbol //inbuf[inum] : Bit length of each symbol
@ -412,7 +411,7 @@ static int32_t initpass() //Interlaced images have 7 "passes", non-interlaced h
} }
} }
ixstp <<= 2; ixstp <<= 2;
return(0); return 0;
} }
#if defined(_MSC_VER) && !defined(NOASM) #if defined(_MSC_VER) && !defined(NOASM)
@ -757,7 +756,7 @@ static int32_t kpngrend(const char *kfilebuf, int32_t kfilength,
if (!pnginited) { pnginited = 1; initpngtables(); } if (!pnginited) { pnginited = 1; initpngtables(); }
if ((B_UNBUF32(&kfilebuf[0]) != B_LITTLE32(0x474e5089)) || (B_UNBUF32(&kfilebuf[4]) != B_LITTLE32(0x0a1a0a0d))) if ((B_UNBUF32(&kfilebuf[0]) != B_LITTLE32(0x474e5089)) || (B_UNBUF32(&kfilebuf[4]) != B_LITTLE32(0x0a1a0a0d)))
return(-1); //"Invalid PNG file signature" return -1; //"Invalid PNG file signature"
filptr = (uint8_t const *)&kfilebuf[8]; filptr = (uint8_t const *)&kfilebuf[8];
trnsrgb = 0; filter1st = -1; filterest = 0; trnsrgb = 0; filter1st = -1; filterest = 0;
@ -769,13 +768,13 @@ static int32_t kpngrend(const char *kfilebuf, int32_t kfilength,
if (i == (int32_t)B_LITTLE32(0x52444849)) //IHDR (must be first) if (i == (int32_t)B_LITTLE32(0x52444849)) //IHDR (must be first)
{ {
xsiz = B_BIG32(B_UNBUF32(&filptr[0])); if (xsiz <= 0) return(-1); xsiz = B_BIG32(B_UNBUF32(&filptr[0])); if (xsiz <= 0) return -1;
ysiz = B_BIG32(B_UNBUF32(&filptr[4])); if (ysiz <= 0) return(-1); ysiz = B_BIG32(B_UNBUF32(&filptr[4])); if (ysiz <= 0) return -1;
bitdepth = filptr[8]; if (!((1<<bitdepth)&0x116)) return(-1); //"Bit depth not supported" bitdepth = filptr[8]; if (!((1<<bitdepth)&0x116)) return -1; //"Bit depth not supported"
kcoltype = filptr[9]; if (!((1<<kcoltype)&0x5d)) return(-1); //"Color type not supported" kcoltype = filptr[9]; if (!((1<<kcoltype)&0x5d)) return -1; //"Color type not supported"
if (filptr[10]) return(-1); //"Only *flate is supported" if (filptr[10]) return -1; //"Only *flate is supported"
if (filptr[11]) return(-1); //"Filter not supported" if (filptr[11]) return -1; //"Filter not supported"
if (filptr[12] >= 2) return(-1); //"Unsupported interlace type" if (filptr[12] >= 2) return -1; //"Unsupported interlace type"
intlac = filptr[12]*7; //0=no interlace/1=Adam7 interlace intlac = filptr[12]*7; //0=no interlace/1=Adam7 interlace
//Save code by making grayscale look like a palette color scheme //Save code by making grayscale look like a palette color scheme
@ -880,7 +879,7 @@ static int32_t kpngrend(const char *kfilebuf, int32_t kfilength,
} }
//Tests to see if xsiz > allocated space in olinbuf //Tests to see if xsiz > allocated space in olinbuf
//Note: xsizbpl gets re-written inside initpass() //Note: xsizbpl gets re-written inside initpass()
if ((xsizbpl+1)*sizeof(olinbuf[0]) > sizeof(olinbuf)) return(-1); if ((xsizbpl+1)*sizeof(olinbuf[0]) > sizeof(olinbuf)) return -1;
initpass(); initpass();
@ -893,7 +892,7 @@ static int32_t kpngrend(const char *kfilebuf, int32_t kfilength,
{ {
//Raw (uncompressed) //Raw (uncompressed)
suckbits((-bitpos)&7); //Synchronize to start of next byte suckbits((-bitpos)&7); //Synchronize to start of next byte
i = getbits(16); if ((getbits(16)^i) != 0xffff) return(-1); i = getbits(16); if ((getbits(16)^i) != 0xffff) return -1;
for (; i; i--) for (; i; i--)
{ {
if (slidew >= slider) if (slidew >= slider)
@ -990,7 +989,7 @@ kpngrend_goodret:
else if ((filter1st == 1) && (!(filterest&~(1<<3)))) filtype = 3; else if ((filter1st == 1) && (!(filterest&~(1<<3)))) filtype = 3;
else filtype = 5; else filtype = 5;
if (kcoltype == 4) paleng = 0; //For /c4, palcol/paleng used as LUT for "*0x10101": alpha is invalid! if (kcoltype == 4) paleng = 0; //For /c4, palcol/paleng used as LUT for "*0x10101": alpha is invalid!
return(0); return 0;
} }
//============================= KPNGILIB ends ================================ //============================= KPNGILIB ends ================================
@ -1054,12 +1053,12 @@ static _inline int32_t mulshr32(int32_t a, int32_t d)
static inline int32_t mulshr24(int32_t a, int32_t b) static inline int32_t mulshr24(int32_t a, int32_t b)
{ {
return((int32_t)((((__int64)a)*((__int64)b))>>24)); return (int32_t)((((__int64)a)*((__int64)b))>>24);
} }
static inline int32_t mulshr32(int32_t a, int32_t b) static inline int32_t mulshr32(int32_t a, int32_t b)
{ {
return((int32_t)((((__int64)a)*((__int64)b))>>32)); return (int32_t)((((__int64)a)*((__int64)b))>>32);
} }
#endif #endif
@ -1297,7 +1296,7 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
kfileend = &kfileptr[kfilength]; kfileend = &kfileptr[kfilength];
if (B_UNBUF16(kfileptr) == B_LITTLE16(0xd8ff)) kfileptr += 2; if (B_UNBUF16(kfileptr) == B_LITTLE16(0xd8ff)) kfileptr += 2;
else return(-1); //"%s is not a JPEG file\n",filename else return -1; //"%s is not a JPEG file\n",filename
restartinterval = 0; restartinterval = 0;
for (i=0; i<4; i++) lastdc[i] = 0; for (i=0; i<4; i++) lastdc[i] = 0;
@ -1404,9 +1403,9 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
kfileptr += leng; kfileptr += leng;
break; break;
case 0xda: case 0xda:
if ((xdim <= 0) || (ydim <= 0)) { Bfree(dctbuf); return(-1); } if ((xdim <= 0) || (ydim <= 0)) { Bfree(dctbuf); return -1; }
lnumcomponents = (int32_t)(*kfileptr++); if (!lnumcomponents) { Bfree(dctbuf); return(-1); } lnumcomponents = (int32_t)(*kfileptr++); if (!lnumcomponents) { Bfree(dctbuf); return -1; }
if (lnumcomponents > 1) kcoltype = 2; if (lnumcomponents > 1) kcoltype = 2;
for (z=0; z<lnumcomponents; z++) for (z=0; z<lnumcomponents; z++)
{ {
@ -1432,7 +1431,7 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
zz += dctx[z]*dcty[z]; zz += dctx[z]*dcty[z];
} }
z = zz*64*sizeof(int16_t); z = zz*64*sizeof(int16_t);
dctbuf = (int16_t *)Bmalloc(z); if (!dctbuf) return(-1); dctbuf = (int16_t *)Bmalloc(z); if (!dctbuf) return -1;
Bmemset(dctbuf,0,z); Bmemset(dctbuf,0,z);
for (z=zz=0; z<gnumcomponents; z++) { dctptr[z] = &dctbuf[zz*64]; zz += dctx[z]*dcty[z]; } for (z=zz=0; z<gnumcomponents; z++) { dctptr[z] = &dctbuf[zz*64]; zz += dctx[z]*dcty[z]; }
} }
@ -1605,7 +1604,7 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
} }
} }
kpegrend_break2:; kpegrend_break2:;
if (!dctbuf) return(0); if (!dctbuf) return 0;
passcnt++; kfileptr -= ((curbits>>3)+1); break; passcnt++; kfileptr -= ((curbits>>3)+1); break;
case 0xd9: break; case 0xd9: break;
default: kfileptr += leng; break; default: kfileptr += leng; break;
@ -1613,7 +1612,7 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
} }
while (kfileptr-(uint8_t const *)kfilebuf < kfilength); while (kfileptr-(uint8_t const *)kfilebuf < kfilength);
if (!dctbuf) return(0); if (!dctbuf) return 0;
lnumcomponents = gnumcomponents; lnumcomponents = gnumcomponents;
for (i=0; i<gnumcomponents; i++) for (i=0; i<gnumcomponents; i++)
@ -1642,7 +1641,7 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
kplib_yrbrend_func(x,y,&dct[0][0]); kplib_yrbrend_func(x,y,&dct[0][0]);
} }
Bfree(dctbuf); return(0); Bfree(dctbuf); return 0;
} }
//============================== KPEGILIB ends ============================== //============================== KPEGILIB ends ==============================
@ -1665,7 +1664,7 @@ static int32_t kgifrend(const char *kfilebuf, int32_t kfilelength,
kcoltype = 3; bitdepth = 8; //For PNGOUT kcoltype = 3; bitdepth = 8; //For PNGOUT
if ((kfilebuf[0] != 'G') || (kfilebuf[1] != 'I') || (kfilebuf[2] != 'F')) return(-1); if ((kfilebuf[0] != 'G') || (kfilebuf[1] != 'I') || (kfilebuf[2] != 'F')) return -1;
paleng = (1<<((kfilebuf[10]&7)+1)); paleng = (1<<((kfilebuf[10]&7)+1));
ptr = (uint8_t const *)&kfilebuf[13]; ptr = (uint8_t const *)&kfilebuf[13];
if (kfilebuf[10]&128) { cptr = ptr; ptr += paleng*3; } if (kfilebuf[10]&128) { cptr = ptr; ptr += paleng*3; }
@ -1678,7 +1677,7 @@ static int32_t kgifrend(const char *kfilebuf, int32_t kfilelength,
do { i = *ptr++; ptr += i; } do { i = *ptr++; ptr += i; }
while (i); while (i);
} }
if (chunkind != ',') return(-1); if (chunkind != ',') return -1;
xoff = B_LITTLE16(B_UNBUF16(&ptr[0])); xoff = B_LITTLE16(B_UNBUF16(&ptr[0]));
yoff = B_LITTLE16(B_UNBUF16(&ptr[2])); yoff = B_LITTLE16(B_UNBUF16(&ptr[2]));
@ -1759,7 +1758,7 @@ static int32_t kgifrend(const char *kfilebuf, int32_t kfilelength,
case 8: if (!ilacefirst) { y = daglobyoffs+2; yinc = 4; break; } case 8: if (!ilacefirst) { y = daglobyoffs+2; yinc = 4; break; }
ilacefirst = 0; y = daglobyoffs+4; yinc = 8; break; ilacefirst = 0; y = daglobyoffs+4; yinc = 8; break;
case 4: y = daglobyoffs+1; yinc = 2; break; case 4: y = daglobyoffs+1; yinc = 2; break;
case 2: case 1: return(0); case 2: case 1: return 0;
} }
if ((uint32_t)y < (uint32_t)dayres) if ((uint32_t)y < (uint32_t)dayres)
{ yoff = y*dakpbytesperline+dakpframeplace; x = daglobxoffs; xend = xspan; } { yoff = y*dakpbytesperline+dakpframeplace; x = daglobxoffs; xend = xspan; }
@ -1789,8 +1788,8 @@ static int32_t kcelrend(const char *buf, int32_t fleng,
kcoltype = 3; bitdepth = 8; paleng = 256; //For PNGOUT kcoltype = 3; bitdepth = 8; paleng = 256; //For PNGOUT
xsiz = (int32_t)B_LITTLE16(B_UNBUF16(&buf[2])); if (xsiz <= 0) return(-1); xsiz = (int32_t)B_LITTLE16(B_UNBUF16(&buf[2])); if (xsiz <= 0) return -1;
ysiz = (int32_t)B_LITTLE16(B_UNBUF16(&buf[4])); if (ysiz <= 0) return(-1); ysiz = (int32_t)B_LITTLE16(B_UNBUF16(&buf[4])); if (ysiz <= 0) return -1;
cptr = &buf[32]; cptr = &buf[32];
for (i=0; i<256; i++) for (i=0; i<256; i++)
@ -1810,7 +1809,7 @@ static int32_t kcelrend(const char *buf, int32_t fleng,
B_BUF32(y*dakpbytesperline+x*4+dakpframeplace, palcol[cptr[0]]); B_BUF32(y*dakpbytesperline+x*4+dakpframeplace, palcol[cptr[0]]);
cptr++; cptr++;
} }
return(0); return 0;
} }
#endif #endif
@ -1826,14 +1825,14 @@ static int32_t ktgarend(const char *header, int32_t fleng,
const uint8_t *fptr, *cptr = NULL, *nptr; const uint8_t *fptr, *cptr = NULL, *nptr;
//Ugly and unreliable identification for .TGA! //Ugly and unreliable identification for .TGA!
if ((fleng < 19) || (header[1]&0xfe)) return(-1); if ((fleng < 19) || (header[1]&0xfe)) return -1;
if ((header[2] >= 12) || (!((1<<header[2])&0xe0e))) return(-1); if ((header[2] >= 12) || (!((1<<header[2])&0xe0e))) return -1;
if ((header[16]&7) || (header[16] == 0) || (header[16] > 32)) return(-1); if ((header[16]&7) || (header[16] == 0) || (header[16] > 32)) return -1;
if (header[17]&0xc0) return(-1); if (header[17]&0xc0) return -1;
fptr = (uint8_t const *)&header[header[0]+18]; fptr = (uint8_t const *)&header[header[0]+18];
xsiz = (int32_t)B_LITTLE16(B_UNBUF16(&header[12])); if (xsiz <= 0) return(-1); xsiz = (int32_t)B_LITTLE16(B_UNBUF16(&header[12])); if (xsiz <= 0) return -1;
ysiz = (int32_t)B_LITTLE16(B_UNBUF16(&header[14])); if (ysiz <= 0) return(-1); ysiz = (int32_t)B_LITTLE16(B_UNBUF16(&header[14])); if (ysiz <= 0) return -1;
colbyte = ((((int32_t)header[16])+7)>>3); colbyte = ((((int32_t)header[16])+7)>>3);
if (header[1] == 1) if (header[1] == 1)
@ -1889,7 +1888,7 @@ static int32_t ktgarend(const char *header, int32_t fleng,
if (((uint32_t)x < (uint32_t)daxres) && ((uint32_t)y < (uint32_t)dayres)) if (((uint32_t)x < (uint32_t)daxres) && ((uint32_t)y < (uint32_t)dayres))
B_BUF32((void *) (x*4+p), i); B_BUF32((void *) (x*4+p), i);
} }
return(0); return 0;
} }
//============================== TARGA ends ================================= //============================== TARGA ends =================================
@ -1923,7 +1922,7 @@ static int32_t kbmprend(const char *buf, int32_t fleng,
headsiz = B_UNBUF32(&buf[14]); headsiz = B_UNBUF32(&buf[14]);
if (headsiz == (int32_t)B_LITTLE32(12)) //OS/2 1.x (old format) if (headsiz == (int32_t)B_LITTLE32(12)) //OS/2 1.x (old format)
{ {
if (B_UNBUF16(&buf[22]) != B_LITTLE16(1)) return(-1); if (B_UNBUF16(&buf[22]) != B_LITTLE16(1)) return -1;
xsiz = (int32_t)B_LITTLE16(B_UNBUF16(&buf[18])); xsiz = (int32_t)B_LITTLE16(B_UNBUF16(&buf[18]));
ysiz = (int32_t)B_LITTLE16(B_UNBUF16(&buf[20])); ysiz = (int32_t)B_LITTLE16(B_UNBUF16(&buf[20]));
cdim = (int32_t)B_LITTLE16(B_UNBUF16(&buf[24])); cdim = (int32_t)B_LITTLE16(B_UNBUF16(&buf[24]));
@ -1931,16 +1930,16 @@ static int32_t kbmprend(const char *buf, int32_t fleng,
} }
else //All newer formats... else //All newer formats...
{ {
if (B_UNBUF16(&buf[26]) != B_LITTLE16(1)) return(-1); if (B_UNBUF16(&buf[26]) != B_LITTLE16(1)) return -1;
xsiz = B_LITTLE32(B_UNBUF32(&buf[18])); xsiz = B_LITTLE32(B_UNBUF32(&buf[18]));
ysiz = B_LITTLE32(B_UNBUF32(&buf[22])); ysiz = B_LITTLE32(B_UNBUF32(&buf[22]));
cdim = (int32_t)B_LITTLE16(B_UNBUF16(&buf[28])); cdim = (int32_t)B_LITTLE16(B_UNBUF16(&buf[28]));
comp = B_LITTLE32(B_UNBUF32(&buf[30])); comp = B_LITTLE32(B_UNBUF32(&buf[30]));
} }
if ((xsiz <= 0) || (!ysiz)) return(-1); if ((xsiz <= 0) || (!ysiz)) return -1;
//cdim must be: (1,4,8,16,24,32) //cdim must be: (1,4,8,16,24,32)
if (((uint32_t)(cdim-1) >= (uint32_t)32) || (!((1<<cdim)&0x1010113))) return(-1); if (((uint32_t)(cdim-1) >= (uint32_t)32) || (!((1<<cdim)&0x1010113))) return -1;
if ((comp != 0) && (comp != 3)) return(-1); if ((comp != 0) && (comp != 3)) return -1;
rastoff = B_LITTLE32(B_UNBUF32(&buf[10])); rastoff = B_LITTLE32(B_UNBUF32(&buf[10]));
@ -1991,7 +1990,7 @@ static int32_t kbmprend(const char *buf, int32_t fleng,
x0 = 0; x1 = xsiz; x0 = 0; x1 = xsiz;
y0 = 0; y1 = ysiz; y0 = 0; y1 = ysiz;
if ((x0 >= daxres) || (x1 <= 0) || (y0 >= dayres) || (y1 <= 0)) return(0); if ((x0 >= daxres) || (x1 <= 0) || (y0 >= dayres) || (y1 <= 0)) return 0;
if (x0 < 0) x0 = 0; if (x0 < 0) x0 = 0;
if (x1 > daxres) x1 = daxres; if (x1 > daxres) x1 = daxres;
for (y=y0; y<y1; y++,cptr=&cptr[cptrinc]) for (y=y0; y<y1; y++,cptr=&cptr[cptrinc])
@ -2021,7 +2020,7 @@ static int32_t kbmprend(const char *buf, int32_t fleng,
} }
} }
return(0); return 0;
} }
//=============================== BMP ends ================================== //=============================== BMP ends ==================================
//============================== PCX begins ================================= //============================== PCX begins =================================
@ -2034,15 +2033,15 @@ static int32_t kpcxrend(const char *buf, int32_t fleng,
uint8_t c; uint8_t c;
uint8_t const *cptr; uint8_t const *cptr;
if (B_UNBUF32(buf) != B_LITTLE32(0x0801050a)) return(-1); if (B_UNBUF32(buf) != B_LITTLE32(0x0801050a)) return -1;
xsiz = B_LITTLE16(B_UNBUF16(&buf[ 8]))-B_LITTLE16(B_UNBUF16(&buf[4]))+1; if (xsiz <= 0) return(-1); xsiz = B_LITTLE16(B_UNBUF16(&buf[ 8]))-B_LITTLE16(B_UNBUF16(&buf[4]))+1; if (xsiz <= 0) return -1;
ysiz = B_LITTLE16(B_UNBUF16(&buf[10]))-B_LITTLE16(B_UNBUF16(&buf[6]))+1; if (ysiz <= 0) return(-1); ysiz = B_LITTLE16(B_UNBUF16(&buf[10]))-B_LITTLE16(B_UNBUF16(&buf[6]))+1; if (ysiz <= 0) return -1;
//buf[3]: bpp/plane:{1,2,4,8} //buf[3]: bpp/plane:{1,2,4,8}
nplanes = buf[65]; //nplanes*bpl bytes per scanline; always be decoding break at the end of scan line nplanes = buf[65]; //nplanes*bpl bytes per scanline; always be decoding break at the end of scan line
bpl = B_LITTLE16(B_UNBUF16(&buf[66])); //#bytes per scanline. Must be EVEN. May have unused data. bpl = B_LITTLE16(B_UNBUF16(&buf[66])); //#bytes per scanline. Must be EVEN. May have unused data.
if (nplanes == 1) if (nplanes == 1)
{ {
//if (buf[fleng-769] != 12) return(-1); //Some PCX are buggy! //if (buf[fleng-769] != 12) return -1; //Some PCX are buggy!
cptr = (uint8_t const *)&buf[fleng-768]; cptr = (uint8_t const *)&buf[fleng-768];
for (i=0; i<256; i++) for (i=0; i<256; i++)
{ {
@ -2103,7 +2102,7 @@ static int32_t kpcxrend(const char *buf, int32_t fleng,
while (y < y1); while (y < y1);
} }
return(0); return 0;
} }
//=============================== PCX ends ================================== //=============================== PCX ends ==================================
@ -2126,11 +2125,11 @@ static int32_t kddsrend(const char *buf, int32_t leng,
ysiz = B_LITTLE32(B_UNBUF32(&buf[12])); ysiz = B_LITTLE32(B_UNBUF32(&buf[12]));
if ((B_UNBUF32(&buf[80]))&B_LITTLE32(64)) //Uncompressed supports only A8R8G8B8 for now if ((B_UNBUF32(&buf[80]))&B_LITTLE32(64)) //Uncompressed supports only A8R8G8B8 for now
{ {
if ((B_UNBUF32(&buf[88])) != B_LITTLE32(32)) return(-1); if ((B_UNBUF32(&buf[88])) != B_LITTLE32(32)) return -1;
if ((B_UNBUF32(&buf[92])) != B_LITTLE32(0x00ff0000)) return(-1); if ((B_UNBUF32(&buf[92])) != B_LITTLE32(0x00ff0000)) return -1;
if ((B_UNBUF32(&buf[96])) != B_LITTLE32(0x0000ff00)) return(-1); if ((B_UNBUF32(&buf[96])) != B_LITTLE32(0x0000ff00)) return -1;
if ((B_UNBUF32(&buf[100])) != B_LITTLE32(0x000000ff)) return(-1); if ((B_UNBUF32(&buf[100])) != B_LITTLE32(0x000000ff)) return -1;
if ((B_UNBUF32(&buf[104])) != B_LITTLE32(0xff000000)) return(-1); if ((B_UNBUF32(&buf[104])) != B_LITTLE32(0xff000000)) return -1;
buf += 128; buf += 128;
j = yoff*bpl + (xoff<<2) + frameptr; xx = (xsiz<<2); j = yoff*bpl + (xoff<<2) + frameptr; xx = (xsiz<<2);
@ -2141,11 +2140,11 @@ static int32_t kddsrend(const char *buf, int32_t leng,
if ((uint32_t)(y+yoff) >= (uint32_t)ydim) continue; if ((uint32_t)(y+yoff) >= (uint32_t)ydim) continue;
Bmemcpy((void *)j,(void *)buf,xsiz); Bmemcpy((void *)j,(void *)buf,xsiz);
} }
return(0); return 0;
} }
if (!((B_UNBUF32(&buf[80]))&B_LITTLE32(4))) return(-1); //FOURCC invalid if (!((B_UNBUF32(&buf[80]))&B_LITTLE32(4))) return -1; //FOURCC invalid
dxt = buf[87]-'0'; dxt = buf[87]-'0';
if ((buf[84] != 'D') || (buf[85] != 'X') || (buf[86] != 'T') || (dxt < 1) || (dxt > 5)) return(-1); if ((buf[84] != 'D') || (buf[85] != 'X') || (buf[86] != 'T') || (dxt < 1) || (dxt > 5)) return -1;
buf += 128; buf += 128;
if (!(dxt&1)) if (!(dxt&1))
@ -2228,7 +2227,7 @@ static int32_t kddsrend(const char *buf, int32_t leng,
} }
} }
} }
return(0); return 0;
} }
#endif #endif
//=============================== DDS ends ================================== //=============================== DDS ends ==================================
@ -2333,28 +2332,28 @@ int32_t kprender(const char *buf, int32_t leng, intptr_t frameptr, int32_t bpl,
paleng = 0; bakcol = 0; numhufblocks = zlibcompflags = 0; filtype = -1; paleng = 0; bakcol = 0; numhufblocks = zlibcompflags = 0; filtype = -1;
if (B_UNBUF16(&ubuf[0]) == B_LITTLE16(0x5089)) //.PNG if (B_UNBUF16(&ubuf[0]) == B_LITTLE16(0x5089)) //.PNG
return(kpngrend(buf,leng,frameptr,bpl,xdim,ydim)); return kpngrend(buf,leng,frameptr,bpl,xdim,ydim);
else if (B_UNBUF16(&ubuf[0]) == B_LITTLE16(0xd8ff)) //.JPG else if (B_UNBUF16(&ubuf[0]) == B_LITTLE16(0xd8ff)) //.JPG
return(kpegrend(buf,leng,frameptr,bpl,xdim,ydim)); return kpegrend(buf,leng,frameptr,bpl,xdim,ydim);
else else
{ {
if ((ubuf[0] == 'G') && (ubuf[1] == 'I') && (ubuf[2] == 'F')) //.GIF if ((ubuf[0] == 'G') && (ubuf[1] == 'I') && (ubuf[2] == 'F')) //.GIF
return(kgifrend(buf, leng, frameptr, bpl, xdim, ydim)); return kgifrend(buf, leng, frameptr, bpl, xdim, ydim);
else if ((ubuf[0] == 'B') && (ubuf[1] == 'M')) //.BMP else if ((ubuf[0] == 'B') && (ubuf[1] == 'M')) //.BMP
return(kbmprend(buf, leng, frameptr, bpl, xdim, ydim)); return kbmprend(buf, leng, frameptr, bpl, xdim, ydim);
else if (B_UNBUF32(ubuf) == B_LITTLE32(0x0801050a)) //.PCX else if (B_UNBUF32(ubuf) == B_LITTLE32(0x0801050a)) //.PCX
return(kpcxrend(buf, leng, frameptr, bpl, xdim, ydim)); return kpcxrend(buf, leng, frameptr, bpl, xdim, ydim);
#ifdef KPCEL #ifdef KPCEL
else if ((ubuf[0] == 0x19) && (ubuf[1] == 0x91) && (ubuf[10] == 8) && (ubuf[11] == 0)) //old .CEL/.PIC else if ((ubuf[0] == 0x19) && (ubuf[1] == 0x91) && (ubuf[10] == 8) && (ubuf[11] == 0)) //old .CEL/.PIC
return(kcelrend(buf, leng, frameptr, bpl, xdim, ydim, xoff, yoff)); return kcelrend(buf, leng, frameptr, bpl, xdim, ydim, xoff, yoff);
#endif #endif
#ifdef KPDDS #ifdef KPDDS
else if ((B_UNBUF32(ubuf) == B_LITTLE32(0x20534444)) && (B_UNBUF32(&ubuf[4]) == B_LITTLE32(124))) //.DDS else if ((B_UNBUF32(ubuf) == B_LITTLE32(0x20534444)) && (B_UNBUF32(&ubuf[4]) == B_LITTLE32(124))) //.DDS
return(kddsrend(buf, leng, frameptr, bpl, xdim, ydim, xoff, yoff)); return kddsrend(buf, leng, frameptr, bpl, xdim, ydim, xoff, yoff);
#endif #endif
//Unreliable .TGA identification - this MUST be final case! //Unreliable .TGA identification - this MUST be final case!
else if (istarga(ubuf, leng)) else if (istarga(ubuf, leng))
return(ktgarend(buf, leng, frameptr, bpl, xdim, ydim)); return ktgarend(buf, leng, frameptr, bpl, xdim, ydim);
else return -1; else return -1;
} }
} }
@ -2427,17 +2426,17 @@ static int32_t kzcheckhashsiz(int32_t siz)
if (!kzhashbuf) //Initialize hash table on first call if (!kzhashbuf) //Initialize hash table on first call
{ {
Bmemset(kzhashead,-1,sizeof(kzhashead)); Bmemset(kzhashead,-1,sizeof(kzhashead));
kzhashbuf = (char *)Bmalloc(KZHASHINITSIZE); if (!kzhashbuf) return(0); kzhashbuf = (char *)Bmalloc(KZHASHINITSIZE); if (!kzhashbuf) return 0;
kzhashpos = 0; kzlastfnam = -1; kzhashsiz = KZHASHINITSIZE; kzdirnamhead = -1; kzhashpos = 0; kzlastfnam = -1; kzhashsiz = KZHASHINITSIZE; kzdirnamhead = -1;
} }
if (kzhashpos+siz > kzhashsiz) //Make sure string fits in kzhashbuf if (kzhashpos+siz > kzhashsiz) //Make sure string fits in kzhashbuf
{ {
i = kzhashsiz; do { i <<= 1; } i = kzhashsiz; do { i <<= 1; }
while (kzhashpos+siz > i); while (kzhashpos+siz > i);
kzhashbuf = (char *)Brealloc(kzhashbuf,i); if (!kzhashbuf) return(0); kzhashbuf = (char *)Brealloc(kzhashbuf,i); if (!kzhashbuf) return 0;
kzhashsiz = i; kzhashsiz = i;
} }
return(1); return 1;
} }
static int32_t kzcalchash(const char *st) static int32_t kzcalchash(const char *st)
@ -2447,14 +2446,14 @@ static int32_t kzcalchash(const char *st)
for (i=0,hashind=0; st[i]; i++) for (i=0,hashind=0; st[i]; i++)
hashind = toupperlookup[st[i]]-((hashind<<1)+hashind); hashind = toupperlookup[st[i]]-((hashind<<1)+hashind);
return(hashind%ARRAY_SIZE(kzhashead)); return hashind%ARRAY_SIZE(kzhashead);
} }
static int32_t kzcheckhash(const char *filnam, char **zipnam, int32_t *fileoffs, int32_t *fileleng, char *iscomp) static int32_t kzcheckhash(const char *filnam, char **zipnam, int32_t *fileoffs, int32_t *fileleng, char *iscomp)
{ {
int32_t i; int32_t i;
if (!kzhashbuf) return(0); if (!kzhashbuf) return 0;
if (filnam[0] == '|') filnam++; if (filnam[0] == '|') filnam++;
for (i=kzhashead[kzcalchash(filnam)]; i>=0; i=(B_UNBUF32(&kzhashbuf[i]))) for (i=kzhashead[kzcalchash(filnam)]; i>=0; i=(B_UNBUF32(&kzhashbuf[i])))
if (!filnamcmp(filnam,&kzhashbuf[i+21])) if (!filnamcmp(filnam,&kzhashbuf[i+21]))
@ -2463,9 +2462,9 @@ static int32_t kzcheckhash(const char *filnam, char **zipnam, int32_t *fileoffs,
(*fileoffs) = B_UNBUF32(&kzhashbuf[i+12]); (*fileoffs) = B_UNBUF32(&kzhashbuf[i+12]);
(*fileleng) = B_UNBUF32(&kzhashbuf[i+16]); (*fileleng) = B_UNBUF32(&kzhashbuf[i+16]);
(*iscomp) = kzhashbuf[i+20]; (*iscomp) = kzhashbuf[i+20];
return(1); return 1;
} }
return(0); return 0;
} }
void kzuninit() void kzuninit()
@ -2486,16 +2485,16 @@ int32_t kzaddstack(const char *filnam)
if (!fil) //if file not found, assume it's a directory if (!fil) //if file not found, assume it's a directory
{ {
//Add directory name to internal list (using kzhashbuf for convenience of dynamic allocation) //Add directory name to internal list (using kzhashbuf for convenience of dynamic allocation)
i = strlen(filnam)+5; if (!kzcheckhashsiz(i)) return(-1); i = strlen(filnam)+5; if (!kzcheckhashsiz(i)) return -1;
B_BUF32(&kzhashbuf[kzhashpos], kzdirnamhead); kzdirnamhead = kzhashpos; B_BUF32(&kzhashbuf[kzhashpos], kzdirnamhead); kzdirnamhead = kzhashpos;
strcpy(&kzhashbuf[kzhashpos+4],filnam); strcpy(&kzhashbuf[kzhashpos+4],filnam);
kzhashpos += i; kzhashpos += i;
return(-1); return -1;
} }
//Write ZIP/GRP filename to hash //Write ZIP/GRP filename to hash
i = strlen(filnam)+1; if (!kzcheckhashsiz(i)) { fclose(fil); return(-1); } i = strlen(filnam)+1; if (!kzcheckhashsiz(i)) { fclose(fil); return -1; }
strcpy(&kzhashbuf[kzhashpos],filnam); strcpy(&kzhashbuf[kzhashpos],filnam);
zipnamoffs = kzhashpos; kzhashpos += i; zipnamoffs = kzhashpos; kzhashpos += i;
@ -2521,20 +2520,20 @@ int32_t kzaddstack(const char *filnam)
fseek(fil,B_LITTLE32(B_UNBUF32(&tempbuf[14])) + B_LITTLE16(B_UNBUF16(&tempbuf[24])) + B_LITTLE16(B_UNBUF16(&tempbuf[22])),SEEK_CUR); fseek(fil,B_LITTLE32(B_UNBUF32(&tempbuf[14])) + B_LITTLE16(B_UNBUF16(&tempbuf[24])) + B_LITTLE16(B_UNBUF16(&tempbuf[22])),SEEK_CUR);
numfiles++; numfiles++;
} }
if (numfiles < 0) { fclose(fil); return(-1); } if (numfiles < 0) { fclose(fil); return -1; }
fseek(fil,-4,SEEK_CUR); fseek(fil,-4,SEEK_CUR);
} }
for (i=0; i<numfiles; i++) for (i=0; i<numfiles; i++)
{ {
fread(tempbuf,46,1,fil); fread(tempbuf,46,1,fil);
if (B_UNBUF32(&tempbuf[0]) != B_LITTLE32(0x02014b50)) { fclose(fil); return(0); } if (B_UNBUF32(&tempbuf[0]) != B_LITTLE32(0x02014b50)) { fclose(fil); return 0; }
j = B_LITTLE16(B_UNBUF16(&tempbuf[28])); //filename length j = B_LITTLE16(B_UNBUF16(&tempbuf[28])); //filename length
fread(&tempbuf[46],j,1,fil); fread(&tempbuf[46],j,1,fil);
tempbuf[j+46] = 0; tempbuf[j+46] = 0;
//Write information into hash //Write information into hash
j = strlen(&tempbuf[46])+22; if (!kzcheckhashsiz(j)) { fclose(fil); return(-1); } j = strlen(&tempbuf[46])+22; if (!kzcheckhashsiz(j)) { fclose(fil); return -1; }
hashind = kzcalchash(&tempbuf[46]); hashind = kzcalchash(&tempbuf[46]);
B_BUF32(&kzhashbuf[kzhashpos], kzhashead[hashind]); B_BUF32(&kzhashbuf[kzhashpos], kzhashead[hashind]);
B_BUF32(&kzhashbuf[kzhashpos+4], kzlastfnam); B_BUF32(&kzhashbuf[kzhashpos+4], kzlastfnam);
@ -2555,7 +2554,7 @@ int32_t kzaddstack(const char *filnam)
fread(tempbuf,12,1,fil); fread(tempbuf,12,1,fil);
if ((B_UNBUF32(&tempbuf[0]) != B_LITTLE32(0x65766c69)) || //'ilve' if ((B_UNBUF32(&tempbuf[0]) != B_LITTLE32(0x65766c69)) || //'ilve'
(B_UNBUF32(&tempbuf[4]) != B_LITTLE32(0x6e616d72))) //'rman' (B_UNBUF32(&tempbuf[4]) != B_LITTLE32(0x6e616d72))) //'rman'
{ fclose(fil); return(0); } { fclose(fil); return 0; }
numfiles = B_LITTLE32(B_UNBUF32(&tempbuf[8])); k = ((numfiles+1)<<4); numfiles = B_LITTLE32(B_UNBUF32(&tempbuf[8])); k = ((numfiles+1)<<4);
for (i=0; i<numfiles; i++,k+=leng) for (i=0; i<numfiles; i++,k+=leng)
{ {
@ -2564,7 +2563,7 @@ int32_t kzaddstack(const char *filnam)
tempbuf[12] = 0; tempbuf[12] = 0;
//Write information into hash //Write information into hash
j = strlen(tempbuf)+22; if (!kzcheckhashsiz(j)) { fclose(fil); return(-1); } j = strlen(tempbuf)+22; if (!kzcheckhashsiz(j)) { fclose(fil); return -1; }
hashind = kzcalchash(tempbuf); hashind = kzcalchash(tempbuf);
B_BUF32(&kzhashbuf[kzhashpos], kzhashead[hashind]); B_BUF32(&kzhashbuf[kzhashpos], kzhashead[hashind]);
B_BUF32(&kzhashbuf[kzhashpos+4], kzlastfnam); B_BUF32(&kzhashbuf[kzhashpos+4], kzlastfnam);
@ -2577,7 +2576,7 @@ int32_t kzaddstack(const char *filnam)
} }
} }
fclose(fil); fclose(fil);
return(0); return 0;
} }
//this allows the use of kplib.c with a file that is already open //this allows the use of kplib.c with a file that is already open
@ -2608,12 +2607,12 @@ intptr_t kzopen(const char *filnam)
kzfs.leng = filelength(_fileno(kzfs.fil)); kzfs.leng = filelength(_fileno(kzfs.fil));
kzfs.pos = 0; kzfs.pos = 0;
kzfs.i = 0; kzfs.i = 0;
return((intptr_t)kzfs.fil); return (intptr_t)kzfs.fil;
} }
} }
if (kzcheckhash(filnam,&zipnam,&fileoffs,&fileleng,&iscomp)) //Then check mounted ZIP/GRP files if (kzcheckhash(filnam,&zipnam,&fileoffs,&fileleng,&iscomp)) //Then check mounted ZIP/GRP files
{ {
fil = fopen(zipnam,"rb"); if (!fil) return(0); fil = fopen(zipnam,"rb"); if (!fil) return 0;
fseek(fil,fileoffs,SEEK_SET); fseek(fil,fileoffs,SEEK_SET);
if (!iscomp) //Must be from GRP file if (!iscomp) //Must be from GRP file
{ {
@ -2623,12 +2622,12 @@ intptr_t kzopen(const char *filnam)
kzfs.leng = fileleng; kzfs.leng = fileleng;
kzfs.pos = 0; kzfs.pos = 0;
kzfs.i = 0; kzfs.i = 0;
return((intptr_t)kzfs.fil); return (intptr_t)kzfs.fil;
} }
else else
{ {
fread(tempbuf,30,1,fil); fread(tempbuf,30,1,fil);
if (B_UNBUF32(&tempbuf[0]) != B_LITTLE32(0x04034b50)) { fclose(fil); return(0); } if (B_UNBUF32(&tempbuf[0]) != B_LITTLE32(0x04034b50)) { fclose(fil); return 0; }
fseek(fil,B_LITTLE16(B_UNBUF16(&tempbuf[26]))+B_LITTLE16(B_UNBUF16(&tempbuf[28])),SEEK_CUR); fseek(fil,B_LITTLE16(B_UNBUF16(&tempbuf[26]))+B_LITTLE16(B_UNBUF16(&tempbuf[28])),SEEK_CUR);
kzfs.fil = fil; kzfs.fil = fil;
@ -2638,7 +2637,7 @@ intptr_t kzopen(const char *filnam)
kzfs.pos = 0; kzfs.pos = 0;
switch (kzfs.comptyp) //Compression method switch (kzfs.comptyp) //Compression method
{ {
case 0: kzfs.i = 0; return((intptr_t)kzfs.fil); case 0: kzfs.i = 0; return (intptr_t)kzfs.fil;
case 8: case 8:
if (!pnginited) { pnginited = 1; initpngtables(); } if (!pnginited) { pnginited = 1; initpngtables(); }
kzfs.comptell = 0; kzfs.comptell = 0;
@ -2647,8 +2646,8 @@ intptr_t kzopen(const char *filnam)
//WARNING: No file in ZIP can be > 2GB-32K bytes //WARNING: No file in ZIP can be > 2GB-32K bytes
gslidew = 0x7fffffff; //Force reload at beginning gslidew = 0x7fffffff; //Force reload at beginning
return((intptr_t)kzfs.fil); return (intptr_t)kzfs.fil;
default: fclose(kzfs.fil); kzfs.fil = 0; return(0); default: fclose(kzfs.fil); kzfs.fil = 0; return 0;
} }
} }
} }
@ -2674,11 +2673,11 @@ intptr_t kzopen(const char *filnam)
kzfs.leng = filelength(_fileno(kzfs.fil)); kzfs.leng = filelength(_fileno(kzfs.fil));
kzfs.pos = 0; kzfs.pos = 0;
kzfs.i = 0; kzfs.i = 0;
return((intptr_t)kzfs.fil); return (intptr_t)kzfs.fil;
} }
} }
return(0); return 0;
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@ -2722,7 +2721,7 @@ int32_t kzfindfile(char *filnam)
filnam[0] = 0; filnam[0] = 0;
if (srchstat == 0) if (srchstat == 0)
{ {
if (!newildst[0]) { srchstat = -1; return(0); } if (!newildst[0]) { srchstat = -1; return 0; }
do do
{ {
srchstat = 1; srchstat = 1;
@ -2738,7 +2737,7 @@ int32_t kzfindfile(char *filnam)
#if defined(_WIN32) #if defined(_WIN32)
hfind = FindFirstFile(newildst,&findata); hfind = FindFirstFile(newildst,&findata);
if (hfind == INVALID_HANDLE_VALUE) if (hfind == INVALID_HANDLE_VALUE)
{ if (!kzhashbuf) return(0); srchstat = 2; continue; } { if (!kzhashbuf) return 0; srchstat = 2; continue; }
if (findata.dwFileAttributes&FILE_ATTRIBUTE_HIDDEN) continue; if (findata.dwFileAttributes&FILE_ATTRIBUTE_HIDDEN) continue;
i = wildstpathleng; i = wildstpathleng;
if (findata.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) if (findata.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)
@ -2759,7 +2758,7 @@ int32_t kzfindfile(char *filnam)
} }
break; // process srchstat == 1 break; // process srchstat == 1
#endif #endif
return(1); return 1;
} }
while (0); while (0);
} }
@ -2770,7 +2769,7 @@ int32_t kzfindfile(char *filnam)
Bmemcpy(filnam,newildst,wildstpathleng); Bmemcpy(filnam,newildst,wildstpathleng);
#if defined(_WIN32) #if defined(_WIN32)
if (!FindNextFile(hfind,&findata)) if (!FindNextFile(hfind,&findata))
{ FindClose(hfind); hfind = INVALID_HANDLE_VALUE; if (!kzhashbuf) return(0); srchstat = 2; break; } { FindClose(hfind); hfind = INVALID_HANDLE_VALUE; if (!kzhashbuf) return 0; srchstat = 2; break; }
if (findata.dwFileAttributes&FILE_ATTRIBUTE_HIDDEN) continue; if (findata.dwFileAttributes&FILE_ATTRIBUTE_HIDDEN) continue;
i = wildstpathleng; i = wildstpathleng;
if (findata.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) if (findata.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)
@ -2790,7 +2789,7 @@ int32_t kzfindfile(char *filnam)
strcpy(&filnam[i],findata->d_name); strcpy(&filnam[i],findata->d_name);
if (findata->d_type == DT_DIR) strcat(&filnam[i],"/"); if (findata->d_type == DT_DIR) strcat(&filnam[i],"/");
#endif #endif
return(1); return 1;
} }
} }
while (srchstat == 2) while (srchstat == 2)
@ -2801,7 +2800,7 @@ int32_t kzfindfile(char *filnam)
//strcpy(filnam,&kzhashbuf[srchzoff+21]); //strcpy(filnam,&kzhashbuf[srchzoff+21]);
filnam[0] = '|'; strcpy(&filnam[1],&kzhashbuf[srchzoff+21]); filnam[0] = '|'; strcpy(&filnam[1],&kzhashbuf[srchzoff+21]);
srchzoff = B_UNBUF32(&kzhashbuf[srchzoff+4]); srchzoff = B_UNBUF32(&kzhashbuf[srchzoff+4]);
return(1); return 1;
} }
srchzoff = B_UNBUF32(&kzhashbuf[srchzoff+4]); srchzoff = B_UNBUF32(&kzhashbuf[srchzoff+4]);
} }
@ -2821,7 +2820,7 @@ int32_t kzfindfile(char *filnam)
srchstat = 0; goto kzfindfile_beg; srchstat = 0; goto kzfindfile_beg;
} }
return(0); return 0;
} }
//File searching code (supports inside ZIP files!) How to use this code: //File searching code (supports inside ZIP files!) How to use this code:
@ -2850,7 +2849,7 @@ int32_t kzread(void *buffer, int32_t leng)
{ {
int32_t i, j, k, bfinal, btype, hlit, hdist; int32_t i, j, k, bfinal, btype, hlit, hdist;
if ((!kzfs.fil) || (leng <= 0)) return(0); if ((!kzfs.fil) || (leng <= 0)) return 0;
if (kzfs.comptyp == 0) if (kzfs.comptyp == 0)
{ {
@ -2867,7 +2866,7 @@ int32_t kzread(void *buffer, int32_t leng)
//Initialize for putbuf4zip //Initialize for putbuf4zip
gzbufptr = (char *)buffer; gzbufptr = &gzbufptr[-kzfs.pos]; gzbufptr = (char *)buffer; gzbufptr = &gzbufptr[-kzfs.pos];
kzfs.endpos = min(kzfs.pos+leng,kzfs.leng); kzfs.endpos = min(kzfs.pos+leng,kzfs.leng);
if (kzfs.endpos == kzfs.pos) return(0); //Guard against reading 0 length if (kzfs.endpos == kzfs.pos) return 0; //Guard against reading 0 length
if (kzfs.pos < gslidew-32768) // Must go back to start :( if (kzfs.pos < gslidew-32768) // Must go back to start :(
{ {
@ -2943,7 +2942,7 @@ int32_t kzread(void *buffer, int32_t leng)
{ {
//Raw (uncompressed) //Raw (uncompressed)
suckbits((-bitpos)&7); //Synchronize to start of next byte suckbits((-bitpos)&7); //Synchronize to start of next byte
i = getbits(16); if ((getbits(16)^i) != 0xffff) return(-1); i = getbits(16); if ((getbits(16)^i) != 0xffff) return -1;
for (; i; i--) for (; i; i--)
{ {
if (gslidew >= gslider) if (gslidew >= gslider)
@ -3043,14 +3042,14 @@ int32_t kzread(void *buffer, int32_t leng)
retkzread:; retkzread:;
i = kzfs.pos; i = kzfs.pos;
kzfs.pos += leng; if (kzfs.pos > kzfs.leng) kzfs.pos = kzfs.leng; kzfs.pos += leng; if (kzfs.pos > kzfs.leng) kzfs.pos = kzfs.leng;
return(kzfs.pos-i); return kzfs.pos-i;
} }
//WARNING: kzseek(<-32768,SEEK_CUR); or: //WARNING: kzseek(<-32768,SEEK_CUR); or:
// kzseek(0,SEEK_END); can make next kzread very slow!!! // kzseek(0,SEEK_END); can make next kzread very slow!!!
int32_t kzseek(int32_t offset, int32_t whence) int32_t kzseek(int32_t offset, int32_t whence)
{ {
if (!kzfs.fil) return(-1); if (!kzfs.fil) return -1;
switch (whence) switch (whence)
{ {
case SEEK_CUR: kzfs.pos += offset; break; case SEEK_CUR: kzfs.pos += offset; break;
@ -3059,7 +3058,7 @@ int32_t kzseek(int32_t offset, int32_t whence)
} }
if (kzfs.pos < 0) kzfs.pos = 0; if (kzfs.pos < 0) kzfs.pos = 0;
if (kzfs.pos > kzfs.leng) kzfs.pos = kzfs.leng; if (kzfs.pos > kzfs.leng) kzfs.pos = kzfs.leng;
return(kzfs.pos); return kzfs.pos;
} }
//====================== ZIP decompression code ends ========================= //====================== ZIP decompression code ends =========================

View file

@ -948,7 +948,7 @@ void LZ4_resetStream (LZ4_stream_t* LZ4_stream)
int LZ4_freeStream (LZ4_stream_t* LZ4_stream) int LZ4_freeStream (LZ4_stream_t* LZ4_stream)
{ {
FREEMEM(LZ4_stream); FREEMEM(LZ4_stream);
return (0); return 0;
} }

View file

@ -261,9 +261,9 @@ int32_t md_loadmodel(const char *fn)
models = ml; nummodelsalloced += MODELALLOCGROUP; models = ml; nummodelsalloced += MODELALLOCGROUP;
} }
vm = mdload(fn); if (!vm) return(-1); vm = mdload(fn); if (!vm) return -1;
models[nextmodelid++] = vm; models[nextmodelid++] = vm;
return(nextmodelid-1); return nextmodelid-1;
} }
int32_t md_setmisc(int32_t modelid, float scale, int32_t shadeoff, float zadd, float yoffset, int32_t flags) int32_t md_setmisc(int32_t modelid, float scale, int32_t shadeoff, float zadd, float yoffset, int32_t flags)
@ -308,7 +308,7 @@ static int32_t framename2index(mdmodel_t *vm, const char *nam)
} }
break; break;
} }
return(i); return i;
} }
int32_t md_defineframe(int32_t modelid, const char *framename, int32_t tilenume, int32_t skinnum, float smoothduration, int32_t pal) int32_t md_defineframe(int32_t modelid, const char *framename, int32_t tilenume, int32_t skinnum, float smoothduration, int32_t pal)
@ -318,9 +318,9 @@ int32_t md_defineframe(int32_t modelid, const char *framename, int32_t tilenume,
if (!mdinited) mdinit(); if (!mdinited) mdinit();
if ((uint32_t)modelid >= (uint32_t)nextmodelid) return(-1); if ((uint32_t)modelid >= (uint32_t)nextmodelid) return -1;
if ((uint32_t)tilenume >= (uint32_t)MAXTILES) return(-2); if ((uint32_t)tilenume >= (uint32_t)MAXTILES) return -2;
if (!framename) return(-3); if (!framename) return -3;
tilenume=addtileP(modelid,tilenume,pal); tilenume=addtileP(modelid,tilenume,pal);
m = (md2model_t *)models[modelid]; m = (md2model_t *)models[modelid];
@ -332,7 +332,7 @@ int32_t md_defineframe(int32_t modelid, const char *framename, int32_t tilenume,
} }
i = framename2index((mdmodel_t *)m,framename); i = framename2index((mdmodel_t *)m,framename);
if (i == m->numframes) return(-3); // frame name invalid if (i == m->numframes) return -3; // frame name invalid
tile2model[tilenume].modelid = modelid; tile2model[tilenume].modelid = modelid;
tile2model[tilenume].framenum = i; tile2model[tilenume].framenum = i;
@ -350,7 +350,7 @@ int32_t md_defineanimation(int32_t modelid, const char *framestart, const char *
if (!mdinited) mdinit(); if (!mdinited) mdinit();
if ((uint32_t)modelid >= (uint32_t)nextmodelid) return(-1); if ((uint32_t)modelid >= (uint32_t)nextmodelid) return -1;
Bmemset(&ma, 0, sizeof(ma)); Bmemset(&ma, 0, sizeof(ma));
m = (md2model_t *)models[modelid]; m = (md2model_t *)models[modelid];
@ -376,7 +376,7 @@ int32_t md_defineanimation(int32_t modelid, const char *framestart, const char *
map->next = m->animations; map->next = m->animations;
m->animations = map; m->animations = map;
return(0); return 0;
} }
#if 0 #if 0
@ -638,7 +638,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
if (!sk) if (!sk)
{ {
if (pal >= (MAXPALOOKUPS - RESERVEDPALS)) if (pal >= (MAXPALOOKUPS - RESERVEDPALS))
return (0); return 0;
if (skzero) if (skzero)
{ {
@ -1223,7 +1223,7 @@ static md2model_t *md2load(int32_t fil, const char *filnam)
head.ofseof = B_LITTLE32(head.ofseof); head.ofseof = B_LITTLE32(head.ofseof);
#endif #endif
if ((head.id != IDP2_MAGIC) || (head.vers != 8)) { Bfree(m); return(0); } //"IDP2" if ((head.id != IDP2_MAGIC) || (head.vers != 8)) { Bfree(m); return 0; } //"IDP2"
ournumskins = head.numskins ? head.numskins : 1; ournumskins = head.numskins ? head.numskins : 1;
ournumglcmds = head.numglcmds ? head.numglcmds : 1; ournumglcmds = head.numglcmds ? head.numglcmds : 1;
@ -1241,22 +1241,22 @@ static md2model_t *md2load(int32_t fil, const char *filnam)
klseek(fil,head.ofsframes,SEEK_SET); klseek(fil,head.ofsframes,SEEK_SET);
if (kread(fil,(char *)m->frames,m->numframes*m->framebytes) != m->numframes*m->framebytes) if (kread(fil,(char *)m->frames,m->numframes*m->framebytes) != m->numframes*m->framebytes)
{ Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } { Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return 0; }
if (m->numglcmds > 0) if (m->numglcmds > 0)
{ {
klseek(fil,head.ofsglcmds,SEEK_SET); klseek(fil,head.ofsglcmds,SEEK_SET);
if (kread(fil,(char *)m->glcmds,m->numglcmds*sizeof(int32_t)) != (int32_t)(m->numglcmds*sizeof(int32_t))) if (kread(fil,(char *)m->glcmds,m->numglcmds*sizeof(int32_t)) != (int32_t)(m->numglcmds*sizeof(int32_t)))
{ Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } { Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return 0; }
} }
klseek(fil,head.ofstris,SEEK_SET); klseek(fil,head.ofstris,SEEK_SET);
if (kread(fil,(char *)m->tris,head.numtris*sizeof(md2tri_t)) != (int32_t)(head.numtris*sizeof(md2tri_t))) if (kread(fil,(char *)m->tris,head.numtris*sizeof(md2tri_t)) != (int32_t)(head.numtris*sizeof(md2tri_t)))
{ Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } { Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return 0; }
klseek(fil,head.ofsuv,SEEK_SET); klseek(fil,head.ofsuv,SEEK_SET);
if (kread(fil,(char *)m->uv,head.numuv*sizeof(md2uv_t)) != (int32_t)(head.numuv*sizeof(md2uv_t))) if (kread(fil,(char *)m->uv,head.numuv*sizeof(md2uv_t)) != (int32_t)(head.numuv*sizeof(md2uv_t)))
{ Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } { Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return 0; }
#if B_BIG_ENDIAN != 0 #if B_BIG_ENDIAN != 0
{ {
@ -1306,7 +1306,7 @@ static md2model_t *md2load(int32_t fil, const char *filnam)
{ {
klseek(fil,head.ofsskins,SEEK_SET); klseek(fil,head.ofsskins,SEEK_SET);
if (kread(fil,m->skinfn,64*m->numskins) != 64*m->numskins) if (kread(fil,m->skinfn,64*m->numskins) != 64*m->numskins)
{ Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } { Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return 0; }
} }
m->texid = (GLuint *)Xcalloc(ournumskins, sizeof(GLuint) * (HICEFFECTMASK+1)); m->texid = (GLuint *)Xcalloc(ournumskins, sizeof(GLuint) * (HICEFFECTMASK+1));
@ -1314,7 +1314,7 @@ static md2model_t *md2load(int32_t fil, const char *filnam)
maxmodelverts = max(maxmodelverts, m->numverts); maxmodelverts = max(maxmodelverts, m->numverts);
maxmodeltris = max(maxmodeltris, head.numtris); maxmodeltris = max(maxmodeltris, head.numtris);
//return(m); //return m;
// the MD2 is now loaded internally - let's begin the MD3 conversion process // the MD2 is now loaded internally - let's begin the MD3 conversion process
//OSD_Printf("Beginning md3 conversion.\n"); //OSD_Printf("Beginning md3 conversion.\n");
@ -1501,7 +1501,7 @@ static md3model_t *md3load(int32_t fil)
m->head.eof = B_LITTLE32(m->head.eof); m->head.eof = B_LITTLE32(m->head.eof);
#endif #endif
if ((m->head.id != IDP3_MAGIC) && (m->head.vers != 15)) { Bfree(m); return(0); } //"IDP3" if ((m->head.id != IDP3_MAGIC) && (m->head.vers != 15)) { Bfree(m); return 0; } //"IDP3"
m->numskins = m->head.numskins; //<- dead code? m->numskins = m->head.numskins; //<- dead code?
m->numframes = m->head.numframes; m->numframes = m->head.numframes;
@ -1623,7 +1623,7 @@ static md3model_t *md3load(int32_t fil)
m->vbos = NULL; m->vbos = NULL;
return(m); return m;
} }
#ifdef POLYMER #ifdef POLYMER

View file

@ -769,7 +769,7 @@ int32_t polymer_init(void)
{ {
OSD_Printf("PR : Your video card driver/combo doesn't support the necessary features!\n"); OSD_Printf("PR : Your video card driver/combo doesn't support the necessary features!\n");
OSD_Printf("PR : Disabling Polymer...\n"); OSD_Printf("PR : Disabling Polymer...\n");
return (0); return 0;
} }
// clean up existing stuff since it will be initialized again if we're re-entering here // clean up existing stuff since it will be initialized again if we're re-entering here
@ -782,7 +782,7 @@ int32_t polymer_init(void)
if (prtess == 0) if (prtess == 0)
{ {
OSD_Printf("PR : Tessellation object initialization failed!\n"); OSD_Printf("PR : Tessellation object initialization failed!\n");
return (0); return 0;
} }
polymer_loadboard(); polymer_loadboard();
@ -860,7 +860,7 @@ int32_t polymer_init(void)
if (pr_verbosity >= 1) OSD_Printf("PR : Initialization complete in %d ms.\n", getticks()-t); if (pr_verbosity >= 1) OSD_Printf("PR : Initialization complete in %d ms.\n", getticks()-t);
return (1); return 1;
} }
void polymer_uninit(void) void polymer_uninit(void)
@ -1627,23 +1627,23 @@ int16_t polymer_addlight(_prlight* light)
int32_t lighti; int32_t lighti;
if (lightcount >= PR_MAXLIGHTS || light->priority > pr_maxlightpriority || !pr_lighting) if (lightcount >= PR_MAXLIGHTS || light->priority > pr_maxlightpriority || !pr_lighting)
return (-1); return -1;
if ((light->sector == -1) || (light->sector >= numsectors)) if ((light->sector == -1) || (light->sector >= numsectors))
return (-1); return -1;
lighti = 0; lighti = 0;
while ((lighti < PR_MAXLIGHTS) && (prlights[lighti].flags.active)) while ((lighti < PR_MAXLIGHTS) && (prlights[lighti].flags.active))
lighti++; lighti++;
if (lighti == PR_MAXLIGHTS) if (lighti == PR_MAXLIGHTS)
return (-1); return -1;
#if 0 #if 0
// Spot lights disabled on ATI cards because they cause crashes with // Spot lights disabled on ATI cards because they cause crashes with
// Catalyst 12.8 drivers. // Catalyst 12.8 drivers.
// See: http://forums.duke4.net/topic/5723-hrp-polymer-crash/ // See: http://forums.duke4.net/topic/5723-hrp-polymer-crash/
if (pr_ati_fboworkaround && light->radius) if (pr_ati_fboworkaround && light->radius)
return (-1); return -1;
#endif #endif
Bmemcpy(&prlights[lighti], light, sizeof(_prlight)); Bmemcpy(&prlights[lighti], light, sizeof(_prlight));
@ -1680,7 +1680,7 @@ int16_t polymer_addlight(_prlight* light)
lightcount++; lightcount++;
return (lighti); return lighti;
} }
void polymer_deletelight(int16_t lighti) void polymer_deletelight(int16_t lighti)
@ -2575,7 +2575,7 @@ static int32_t polymer_initsector(int16_t sectnum)
if (pr_verbosity >= 2) OSD_Printf("PR : Initialized sector %i.\n", sectnum); if (pr_verbosity >= 2) OSD_Printf("PR : Initialized sector %i.\n", sectnum);
return (1); return 1;
} }
static int32_t polymer_updatesector(int16_t sectnum) static int32_t polymer_updatesector(int16_t sectnum)
@ -2602,7 +2602,7 @@ static int32_t polymer_updatesector(int16_t sectnum)
if (s == NULL) if (s == NULL)
{ {
if (pr_verbosity >= 1) OSD_Printf("PR : Can't update uninitialized sector %i.\n", sectnum); if (pr_verbosity >= 1) OSD_Printf("PR : Can't update uninitialized sector %i.\n", sectnum);
return (-1); return -1;
} }
needfloor = wallinvalidate = 0; needfloor = wallinvalidate = 0;
@ -2875,7 +2875,7 @@ finish:
if (pr_verbosity >= 3) OSD_Printf("PR : Updated sector %i.\n", sectnum); if (pr_verbosity >= 3) OSD_Printf("PR : Updated sector %i.\n", sectnum);
return (0); return 0;
} }
void PR_CALLBACK polymer_tesserror(GLenum error) void PR_CALLBACK polymer_tesserror(GLenum error)
@ -2923,7 +2923,7 @@ static int32_t polymer_buildfloor(int16_t sectnum)
sec = (usectortype *)&sector[sectnum]; sec = (usectortype *)&sector[sectnum];
if (s == NULL) if (s == NULL)
return (-1); return -1;
if (s->floor.indices == NULL) if (s->floor.indices == NULL)
{ {
@ -2968,7 +2968,7 @@ static int32_t polymer_buildfloor(int16_t sectnum)
if (pr_verbosity >= 2) OSD_Printf("PR : Tesselated floor of sector %i.\n", sectnum); if (pr_verbosity >= 2) OSD_Printf("PR : Tesselated floor of sector %i.\n", sectnum);
return (1); return 1;
} }
static void polymer_drawsector(int16_t sectnum, int32_t domasks) static void polymer_drawsector(int16_t sectnum, int32_t domasks)
@ -3091,7 +3091,7 @@ static int32_t polymer_initwall(int16_t wallnum)
if (pr_verbosity >= 2) OSD_Printf("PR : Initialized wall %i.\n", wallnum); if (pr_verbosity >= 2) OSD_Printf("PR : Initialized wall %i.\n", wallnum);
return (1); return 1;
} }
// TODO: r_npotwallmode. Needs polymost_is_npotmode() handling among others. // TODO: r_npotwallmode. Needs polymost_is_npotmode() handling among others.
@ -5471,7 +5471,7 @@ static int32_t polymer_bindmaterial(const _prmaterial *material, int16_t* l
bglActiveTextureARB(GL_TEXTURE0_ARB); bglActiveTextureARB(GL_TEXTURE0_ARB);
return (programbits); return programbits;
} }
static void polymer_unbindmaterial(int32_t programbits) static void polymer_unbindmaterial(int32_t programbits)

View file

@ -293,7 +293,7 @@ static int32_t screencapture_tga(const char *filename, char inverseit)
OSD_Printf("Saved screenshot to %s\n", fn); OSD_Printf("Saved screenshot to %s\n", fn);
Bfree(fn); Bfree(fn);
capturecount++; capturecount++;
return(0); return 0;
} }
# endif # endif

View file

@ -35,9 +35,9 @@ int32_t scriptfile_getstring(scriptfile *sf, char **retst)
if (*retst == NULL) if (*retst == NULL)
{ {
initprintf("Error on line %s:%d: unexpected eof\n",sf->filename,scriptfile_getlinum(sf,sf->textptr)); initprintf("Error on line %s:%d: unexpected eof\n",sf->filename,scriptfile_getlinum(sf,sf->textptr));
return(-2); return -2;
} }
return(0); return 0;
} }
int32_t scriptfile_getnumber(scriptfile *sf, int32_t *num) int32_t scriptfile_getnumber(scriptfile *sf, int32_t *num)
@ -172,7 +172,7 @@ int32_t scriptfile_getbraces(scriptfile *sf, char **braceend)
bracestart = ++sf->textptr; bracecnt = 1; bracestart = ++sf->textptr; bracecnt = 1;
while (1) while (1)
{ {
if (sf->textptr >= sf->eof) return(0); if (sf->textptr >= sf->eof) return 0;
if (sf->textptr[0] == '{') bracecnt++; if (sf->textptr[0] == '{') bracecnt++;
if (sf->textptr[0] == '}') { bracecnt--; if (!bracecnt) break; } if (sf->textptr[0] == '}') { bracecnt--; if (!bracecnt) break; }
sf->textptr++; sf->textptr++;
@ -188,14 +188,14 @@ int32_t scriptfile_getlinum(const scriptfile *sf, const char *ptr)
int32_t i, stp; int32_t i, stp;
intptr_t ind; intptr_t ind;
//for(i=0;i<sf->linenum;i++) if (sf->lineoffs[i] >= ind) return(i+1); //brute force algo //for(i=0;i<sf->linenum;i++) if (sf->lineoffs[i] >= ind) return i+1; //brute force algo
ind = ((intptr_t)ptr) - ((intptr_t)sf->textbuf); ind = ((intptr_t)ptr) - ((intptr_t)sf->textbuf);
for (stp=1; stp+stp<sf->linenum; stp+=stp) { } //stp = highest power of 2 less than sf->linenum for (stp=1; stp+stp<sf->linenum; stp+=stp) { } //stp = highest power of 2 less than sf->linenum
for (i=0; stp; stp>>=1) for (i=0; stp; stp>>=1)
if ((i+stp < sf->linenum) && (sf->lineoffs[i+stp] < ind)) i += stp; if ((i+stp < sf->linenum) && (sf->lineoffs[i+stp] < ind)) i += stp;
return(i+1); //i = index to highest lineoffs which is less than ind; convert to 1-based line numbers return i+1; //i = index to highest lineoffs which is less than ind; convert to 1-based line numbers
} }
void scriptfile_preparse(scriptfile *sf, char *tx, int32_t flen) void scriptfile_preparse(scriptfile *sf, char *tx, int32_t flen)

View file

@ -56,7 +56,7 @@ static pthtyp *texcache_tryart(int32_t const dapicnum, int32_t const dapalnum, i
pth->palnum = dapalnum; pth->palnum = dapalnum;
} }
return(pth); return pth;
} }
pth = (pthtyp *)Xcalloc(1,sizeof(pthtyp)); pth = (pthtyp *)Xcalloc(1,sizeof(pthtyp));
@ -67,7 +67,7 @@ static pthtyp *texcache_tryart(int32_t const dapicnum, int32_t const dapalnum, i
pth->next = texcache.list[j]; pth->next = texcache.list[j];
texcache.list[j] = pth; texcache.list[j] = pth;
return(pth); return pth;
} }
pthtyp *texcache_fetchmulti(pthtyp *pth, hicreplctyp *si, int32_t dapicnum, int32_t dameth) pthtyp *texcache_fetchmulti(pthtyp *pth, hicreplctyp *si, int32_t dapicnum, int32_t dameth)

View file

@ -135,7 +135,7 @@ static int32_t isrectfree(int32_t x0, int32_t y0, int32_t dx, int32_t dy)
int32_t i, j, x; int32_t i, j, x;
i = y0*gvox->mytexx + x0; i = y0*gvox->mytexx + x0;
for (dy=0; dy; dy--, i+=gvox->mytexx) for (dy=0; dy; dy--, i+=gvox->mytexx)
for (x=0; x<dx; x++) { j = i+x; if (zbit[j>>5]&(1<<SHIFTMOD32(j))) return(0); } for (x=0; x<dx; x++) { j = i+x; if (zbit[j>>5]&(1<<SHIFTMOD32(j))) return 0; }
#else #else
int32_t i = y0*mytexo5 + (x0>>5); int32_t i = y0*mytexo5 + (x0>>5);
dx += x0-1; dx += x0-1;
@ -167,7 +167,7 @@ static int32_t isrectfree(int32_t x0, int32_t y0, int32_t dx, int32_t dy)
} }
} }
#endif #endif
return(1); return 1;
} }
static void setrect(int32_t x0, int32_t y0, int32_t dx, int32_t dy) static void setrect(int32_t x0, int32_t y0, int32_t dx, int32_t dy)
@ -581,7 +581,7 @@ skindidntfit:
Bfree(shp); Bfree(zbit); Bfree(bx0); Bfree(shp); Bfree(zbit); Bfree(bx0);
return(gvox); return gvox;
} }
static void alloc_vcolhashead(void) static void alloc_vcolhashead(void)
@ -785,7 +785,7 @@ static int32_t loadkv6(const char *filnam)
if (B_LITTLE32(i) != 0x6c78764b) if (B_LITTLE32(i) != 0x6c78764b)
{ {
kclose(fil); kclose(fil);
return(-1); return -1;
} //Kvxl } //Kvxl
kread(fil, &voxsiz, sizeof(vec3_t)); kread(fil, &voxsiz, sizeof(vec3_t));

View file

@ -1818,7 +1818,7 @@ static HRESULT WINAPI getvalidmodes_enum(DDSURFACEDESC *ddsd, VOID *udata)
ADDMODE(ddsd->dwWidth, ddsd->dwHeight, ddsd->ddpfPixelFormat.dwRGBBitCount, 1,-1); ADDMODE(ddsd->dwWidth, ddsd->dwHeight, ddsd->ddpfPixelFormat.dwRGBBitCount, 1,-1);
} }
return(DDENUMRET_OK); return DDENUMRET_OK;
} }
static int sortmodes(const void *a_, const void *b_) static int sortmodes(const void *a_, const void *b_)

View file

@ -725,7 +725,7 @@ const char *ExtGetSectorCaption(int16_t sectnum)
else else
Bsprintf(tempbuf,"%hu %s", TrackerCast(sector[sectnum].lotag), lo); Bsprintf(tempbuf,"%hu %s", TrackerCast(sector[sectnum].lotag), lo);
} }
return(tempbuf); return tempbuf;
} }
const char *ExtGetWallCaption(int16_t wallnum) const char *ExtGetWallCaption(int16_t wallnum)
@ -738,13 +738,13 @@ const char *ExtGetWallCaption(int16_t wallnum)
{ {
Bsprintf(tempbuf,"%d", wallength(wallnum)); Bsprintf(tempbuf,"%d", wallength(wallnum));
wall[wallnum].cstat &= ~(1<<14); wall[wallnum].cstat &= ~(1<<14);
return(tempbuf); return tempbuf;
} }
if (!(onnames==2 || onnames==4)) if (!(onnames==2 || onnames==4))
{ {
tempbuf[0] = 0; tempbuf[0] = 0;
return(tempbuf); return tempbuf;
} }
// HERE // HERE
@ -777,7 +777,7 @@ const char *ExtGetWallCaption(int16_t wallnum)
} }
} }
return(tempbuf); return tempbuf;
} //end } //end
const char *SectorEffectorTagText(int32_t lotag) const char *SectorEffectorTagText(int32_t lotag)
@ -843,7 +843,7 @@ const char *SectorEffectorTagText(int32_t lotag)
break; break;
} }
return (tempbuf); return tempbuf;
} }
const char *MusicAndSFXTagText(int32_t lotag) const char *MusicAndSFXTagText(int32_t lotag)
@ -880,7 +880,7 @@ const char *SectorEffectorText(int32_t spritenum)
else Bstrcpy(tempbuf, lo); else Bstrcpy(tempbuf, lo);
} }
return (tempbuf); return tempbuf;
} }
const char *ExtGetSpriteCaption(int16_t spritenum) const char *ExtGetSpriteCaption(int16_t spritenum)
@ -9302,7 +9302,7 @@ static int32_t parsegroupfiles(scriptfile *script)
} }
break; break;
case T_EOF: case T_EOF:
return(0); return 0;
default: default:
break; break;
} }
@ -9610,7 +9610,7 @@ int32_t parsetilegroups(scriptfile *script)
break; break;
} }
case T_EOF: case T_EOF:
return(0); return 0;
default: default:
break; break;
} }

View file

@ -5391,7 +5391,7 @@ static int32_t parsedefinitions_game(scriptfile *script, int32_t preload)
} }
break; break;
case T_EOF: case T_EOF:
return(0); return 0;
default: default:
break; break;
} }

View file

@ -493,14 +493,14 @@ int32_t G_GetAngleDelta(int32_t a,int32_t na)
if (klabs(a-na) < 1024) if (klabs(a-na) < 1024)
{ {
// OSD_Printf("G_GetAngleDelta() returning %d\n",na-a); // OSD_Printf("G_GetAngleDelta() returning %d\n",na-a);
return (na-a); return na-a;
} }
if (na > 1024) na -= 2048; if (na > 1024) na -= 2048;
if (a > 1024) a -= 2048; if (a > 1024) a -= 2048;
// OSD_Printf("G_GetAngleDelta() returning %d\n",na-a); // OSD_Printf("G_GetAngleDelta() returning %d\n",na-a);
return (na-a); return na-a;
} }
GAMEEXEC_STATIC void VM_AlterAng(int32_t movflags) GAMEEXEC_STATIC void VM_AlterAng(int32_t movflags)

View file

@ -261,9 +261,9 @@ int32_t Gv_ReadSave(int32_t fil, int32_t newbehav)
AddLog("Done Dumping..."); AddLog("Done Dumping...");
} }
# endif # endif
return(0); return 0;
corrupt: corrupt:
return(1); return 1;
} }
void Gv_WriteSave(FILE *fil, int32_t newbehav) void Gv_WriteSave(FILE *fil, int32_t newbehav)

View file

@ -163,7 +163,7 @@ int32_t CONTROL_KeyboardFunctionPressed(int32_t which)
if (CONTROL_KeyMapping[which].key2 != KEYUNDEFINED && !KeyBindings[CONTROL_KeyMapping[which].key2].cmdstr) if (CONTROL_KeyMapping[which].key2 != KEYUNDEFINED && !KeyBindings[CONTROL_KeyMapping[which].key2].cmdstr)
key2 = KB_KeyDown[ CONTROL_KeyMapping[which].key2 ] ? TRUE : FALSE; key2 = KB_KeyDown[ CONTROL_KeyMapping[which].key2 ] ? TRUE : FALSE;
return (key1 | key2); return key1 | key2;
} }
void CONTROL_ClearKeyboardFunction(int32_t which) void CONTROL_ClearKeyboardFunction(int32_t which)

View file

@ -193,14 +193,14 @@ static int32_t G_GetAngleDelta(int32_t a,int32_t na)
if (klabs(a-na) < 1024) if (klabs(a-na) < 1024)
{ {
// OSD_Printf("G_GetAngleDelta() returning %d\n",na-a); // OSD_Printf("G_GetAngleDelta() returning %d\n",na-a);
return (na-a); return na-a;
} }
if (na > 1024) na -= 2048; if (na > 1024) na -= 2048;
if (a > 1024) a -= 2048; if (a > 1024) a -= 2048;
// OSD_Printf("G_GetAngleDelta() returning %d\n",na-a); // OSD_Printf("G_GetAngleDelta() returning %d\n",na-a);
return (na-a); return na-a;
} }
static inline void __fastcall VM_DoConditional(register int32_t condition) static inline void __fastcall VM_DoConditional(register int32_t condition)

View file

@ -136,7 +136,7 @@ static int32_t _MIDI_ReadNumber
value += *FromPtr++; value += *FromPtr++;
} }
return(value); return value;
} }
@ -168,7 +168,7 @@ static int32_t _MIDI_ReadDelta
while (c & 0x80); while (c & 0x80);
} }
return(value); return value;
} }
@ -707,23 +707,23 @@ static int32_t _MIDI_SendControlChange
c1, c2); c1, c2);
if (status == MIDI_DONT_PLAY) if (status == MIDI_DONT_PLAY)
{ {
return(MIDI_Ok); return MIDI_Ok;
} }
} }
if (_MIDI_Funcs == NULL) if (_MIDI_Funcs == NULL)
{ {
return(MIDI_Error); return MIDI_Error;
} }
if (_MIDI_Funcs->ControlChange == NULL) if (_MIDI_Funcs->ControlChange == NULL)
{ {
return(MIDI_Error); return MIDI_Error;
} }
_MIDI_Funcs->ControlChange(channel, c1, c2); _MIDI_Funcs->ControlChange(channel, c1, c2);
return(MIDI_Ok); return MIDI_Ok;
} }
@ -769,7 +769,7 @@ int32_t MIDI_AllNotesOff
_MIDI_SendControlChange(channel, 0x78, 0); _MIDI_SendControlChange(channel, 0x78, 0);
} }
return(MIDI_Ok); return MIDI_Ok;
} }
@ -933,7 +933,7 @@ int32_t MIDI_Reset
Reset = TRUE; Reset = TRUE;
return(MIDI_Ok); return MIDI_Ok;
} }
@ -953,7 +953,7 @@ int32_t MIDI_SetVolume
if (_MIDI_Funcs == NULL) if (_MIDI_Funcs == NULL)
{ {
return(MIDI_NullMidiModule); return MIDI_NullMidiModule;
} }
volume = min(MIDI_MaxVolume, volume); volume = min(MIDI_MaxVolume, volume);
@ -978,7 +978,7 @@ int32_t MIDI_SetVolume
_MIDI_SendChannelVolumes(); _MIDI_SendChannelVolumes();
} }
return(MIDI_Ok); return MIDI_Ok;
} }
@ -998,7 +998,7 @@ int32_t MIDI_GetVolume
if (_MIDI_Funcs == NULL) if (_MIDI_Funcs == NULL)
{ {
return(MIDI_NullMidiModule); return MIDI_NullMidiModule;
} }
if (_MIDI_Funcs->GetVolume) if (_MIDI_Funcs->GetVolume)
@ -1010,7 +1010,7 @@ int32_t MIDI_GetVolume
volume = _MIDI_TotalVolume; volume = _MIDI_TotalVolume;
} }
return(volume); return volume;
} }
@ -1118,7 +1118,7 @@ int32_t MIDI_SongPlaying
) )
{ {
return(_MIDI_SongActive); return _MIDI_SongActive;
} }
@ -1209,12 +1209,12 @@ int32_t MIDI_PlaySong
if (_MIDI_Funcs == NULL) if (_MIDI_Funcs == NULL)
{ {
return(MIDI_NullMidiModule); return MIDI_NullMidiModule;
} }
if (B_UNBUF32(song) != MIDI_HEADER_SIGNATURE) if (B_UNBUF32(song) != MIDI_HEADER_SIGNATURE)
{ {
return(MIDI_InvalidMidiFile); return MIDI_InvalidMidiFile;
} }
song += 4; song += 4;
@ -1232,14 +1232,14 @@ int32_t MIDI_PlaySong
if (format > MAX_FORMAT) if (format > MAX_FORMAT)
{ {
return(MIDI_UnknownMidiFormat); return MIDI_UnknownMidiFormat;
} }
ptr = song + headersize; ptr = song + headersize;
if (_MIDI_NumTracks == 0) if (_MIDI_NumTracks == 0)
{ {
return(MIDI_NoTracks); return MIDI_NoTracks;
} }
_MIDI_TrackMemSize = _MIDI_NumTracks * sizeof(track); _MIDI_TrackMemSize = _MIDI_NumTracks * sizeof(track);
@ -1255,7 +1255,7 @@ int32_t MIDI_PlaySong
_MIDI_TrackMemSize = 0; _MIDI_TrackMemSize = 0;
return(MIDI_InvalidTrack); return MIDI_InvalidTrack;
} }
tracklength = _MIDI_ReadNumber(ptr + 4, 4); tracklength = _MIDI_ReadNumber(ptr + 4, 4);
@ -1295,7 +1295,7 @@ int32_t MIDI_PlaySong
while (_MPU_BuffersWaiting < 4) _MIDI_ServiceRoutine(); while (_MPU_BuffersWaiting < 4) _MIDI_ServiceRoutine();
MPU_BeginPlayback(); MPU_BeginPlayback();
return(MIDI_Ok); return MIDI_Ok;
} }
@ -1337,7 +1337,7 @@ int32_t MIDI_GetTempo
) )
{ {
return(MIDI_Tempo); return MIDI_Tempo;
} }
@ -1487,7 +1487,7 @@ static int32_t _MIDI_ProcessNextTick
_MIDI_AdvanceTick(); _MIDI_AdvanceTick();
return(TimeSet); return TimeSet;
} }

View file

@ -257,7 +257,7 @@ int32_t MPU_Reset
midiStreamStop(hmido); midiStreamStop(hmido);
midiStreamClose(hmido); midiStreamClose(hmido);
return(MPU_Ok); return MPU_Ok;
} }
@ -281,9 +281,9 @@ int32_t MPU_Init
if (midiOutGetDevCaps(mididevice, &midicaps, sizeof(MIDIOUTCAPS)) != MMSYSERR_NOERROR) return MPU_Error; if (midiOutGetDevCaps(mididevice, &midicaps, sizeof(MIDIOUTCAPS)) != MMSYSERR_NOERROR) return MPU_Error;
if (midiStreamOpen(&hmido,(LPUINT)&mididevice,1,(DWORD_PTR)MPU_MIDICallback,0L,CALLBACK_FUNCTION) != MMSYSERR_NOERROR) return(MPU_Error); if (midiStreamOpen(&hmido,(LPUINT)&mididevice,1,(DWORD_PTR)MPU_MIDICallback,0L,CALLBACK_FUNCTION) != MMSYSERR_NOERROR) return MPU_Error;
return(MPU_Ok); return MPU_Ok;
} }

View file

@ -119,7 +119,7 @@ const char *MUSIC_ErrorString
break; break;
} }
return(ErrorString); return ErrorString;
} }
@ -148,7 +148,7 @@ int32_t MUSIC_Init
status = MUSIC_InitMidi(SoundCard, &MUSIC_MidiFunctions, Address); status = MUSIC_InitMidi(SoundCard, &MUSIC_MidiFunctions, Address);
return(status); return status;
} }
@ -172,7 +172,7 @@ int32_t MUSIC_Shutdown
//MPU_Reset(); //MPU_Reset();
return(status); return status;
} }
@ -244,9 +244,9 @@ int32_t MUSIC_GetVolume
{ {
if (MUSIC_SoundDevice == -1) if (MUSIC_SoundDevice == -1)
{ {
return(0); return 0;
} }
return(MIDI_GetVolume()); return MIDI_GetVolume();
} }
@ -279,7 +279,7 @@ int32_t MUSIC_SongPlaying
) )
{ {
return(MIDI_SongPlaying()); return MIDI_SongPlaying();
} }
@ -330,7 +330,7 @@ int32_t MUSIC_StopSong
MUSIC_StopFade(); MUSIC_StopFade();
MIDI_StopSong(); MIDI_StopSong();
MUSIC_SetErrorCode(MUSIC_Ok); MUSIC_SetErrorCode(MUSIC_Ok);
return(MUSIC_Ok); return MUSIC_Ok;
} }
@ -355,11 +355,11 @@ int32_t MUSIC_PlaySong
if (status != MIDI_Ok) if (status != MIDI_Ok)
{ {
MUSIC_SetErrorCode(MUSIC_MidiError); MUSIC_SetErrorCode(MUSIC_MidiError);
return(MUSIC_Warning); return MUSIC_Warning;
} }
} }
return(MUSIC_Ok); return MUSIC_Ok;
} }
@ -501,7 +501,7 @@ int32_t MUSIC_InitMidi
MIDI_SetMidiFuncs(Funcs); MIDI_SetMidiFuncs(Funcs);
return(MIDI_Ok); return MIDI_Ok;
} }
@ -521,7 +521,7 @@ int32_t MUSIC_FadeVolume
{ {
UNREFERENCED_PARAMETER(milliseconds); UNREFERENCED_PARAMETER(milliseconds);
MIDI_SetVolume(tovolume); MIDI_SetVolume(tovolume);
return(MUSIC_Ok); return MUSIC_Ok;
} }
@ -537,7 +537,7 @@ int32_t MUSIC_FadeActive
) )
{ {
return(0); return 0;
} }

View file

@ -496,17 +496,17 @@ static int32_t G_GetInvAmount(const DukePlayer_t *p)
case ICON_FIRSTAID: case ICON_FIRSTAID:
return p->inv_amount[GET_FIRSTAID]; return p->inv_amount[GET_FIRSTAID];
case ICON_STEROIDS: case ICON_STEROIDS:
return ((p->inv_amount[GET_STEROIDS]+3)>>2); return (p->inv_amount[GET_STEROIDS]+3)>>2;
case ICON_HOLODUKE: case ICON_HOLODUKE:
return ((p->inv_amount[GET_HOLODUKE]+15)/24); return (p->inv_amount[GET_HOLODUKE]+15)/24;
case ICON_JETPACK: case ICON_JETPACK:
return ((p->inv_amount[GET_JETPACK]+15)>>4); return (p->inv_amount[GET_JETPACK]+15)>>4;
case ICON_HEATS: case ICON_HEATS:
return p->inv_amount[GET_HEATS]/12; return p->inv_amount[GET_HEATS]/12;
case ICON_SCUBA: case ICON_SCUBA:
return ((p->inv_amount[GET_SCUBA]+63)>>6); return (p->inv_amount[GET_SCUBA]+63)>>6;
case ICON_BOOTS: case ICON_BOOTS:
return (p->inv_amount[GET_BOOTS]>>1); return p->inv_amount[GET_BOOTS]>>1;
} }
return -1; return -1;
@ -1112,7 +1112,6 @@ void G_DrawBackground(void)
rotatesprite(x<<16, y<<16, 65536L, 0, dapicnum, 8, 0, 8+16+64, 0, y2, x2, ydim-1); rotatesprite(x<<16, y<<16, 65536L, 0, dapicnum, 8, 0, 8+16+64, 0, y2, x2, ydim-1);
rotatesprite((xdim-x)<<16, y<<16, 65536L, 0, dapicnum, 8, 0, 8+16+64, xdim-x2-1, y2, xdim-1, ydim-1); rotatesprite((xdim-x)<<16, y<<16, 65536L, 0, dapicnum, 8, 0, 8+16+64, xdim-x2-1, y2, xdim-1, ydim-1);
} }
} }
if (ud.screen_size > 8) if (ud.screen_size > 8)

View file

@ -84,50 +84,50 @@ const char *MUSIC_ErrorString(int32_t ErrorNumber)
switch (ErrorNumber) switch (ErrorNumber)
{ {
case MUSIC_Warning: case MUSIC_Warning:
return(warningMessage); return warningMessage;
case MUSIC_Error: case MUSIC_Error:
return(errorMessage); return errorMessage;
case MUSIC_Ok: case MUSIC_Ok:
return("OK; no error."); return "OK; no error.";
case MUSIC_ASSVersion: case MUSIC_ASSVersion:
return("Incorrect sound library version."); return "Incorrect sound library version.";
case MUSIC_SoundCardError: case MUSIC_SoundCardError:
return("General sound card error."); return "General sound card error.";
case MUSIC_InvalidCard: case MUSIC_InvalidCard:
return("Invalid sound card."); return "Invalid sound card.";
case MUSIC_MidiError: case MUSIC_MidiError:
return("MIDI error."); return "MIDI error.";
case MUSIC_MPU401Error: case MUSIC_MPU401Error:
return("MPU401 error."); return "MPU401 error.";
case MUSIC_TaskManError: case MUSIC_TaskManError:
return("Task Manager error."); return "Task Manager error.";
//case MUSIC_FMNotDetected: //case MUSIC_FMNotDetected:
// return("FM not detected error."); // return "FM not detected error.";
case MUSIC_DPMI_Error: case MUSIC_DPMI_Error:
return("DPMI error."); return "DPMI error.";
default: default:
return("Unknown error."); return "Unknown error.";
} // switch } // switch
return(NULL); return NULL;
} // MUSIC_ErrorString } // MUSIC_ErrorString
int32_t MUSIC_Init(int32_t SoundCard, int32_t Address) int32_t MUSIC_Init(int32_t SoundCard, int32_t Address)
{ {
#ifdef __ANDROID__ #ifdef __ANDROID__
music_initialized = 1; music_initialized = 1;
return(MUSIC_Ok); return MUSIC_Ok;
#endif #endif
// Use an external MIDI player if the user has specified to do so // Use an external MIDI player if the user has specified to do so
char *command = getenv("EDUKE32_MUSIC_CMD"); char *command = getenv("EDUKE32_MUSIC_CMD");
@ -139,14 +139,14 @@ int32_t MUSIC_Init(int32_t SoundCard, int32_t Address)
if (music_initialized) if (music_initialized)
{ {
setErrorMessage("Music system is already initialized."); setErrorMessage("Music system is already initialized.");
return(MUSIC_Error); return MUSIC_Error;
} // if } // if
if (SDL_VERSIONNUM(linked->major,linked->minor,linked->patch) < MIX_REQUIREDVERSION) if (SDL_VERSIONNUM(linked->major,linked->minor,linked->patch) < MIX_REQUIREDVERSION)
{ {
// reject running with SDL_Mixer versions older than what is stated in sdl_inc.h // reject running with SDL_Mixer versions older than what is stated in sdl_inc.h
initprintf("You need at least v%d.%d.%d of SDL_mixer for music\n",SDL_MIXER_MIN_X,SDL_MIXER_MIN_Y,SDL_MIXER_MIN_Z); initprintf("You need at least v%d.%d.%d of SDL_mixer for music\n",SDL_MIXER_MIN_X,SDL_MIXER_MIN_Y,SDL_MIXER_MIN_Z);
return(MUSIC_Error); return MUSIC_Error;
} }
external_midi = (command != NULL && command[0] != 0); external_midi = (command != NULL && command[0] != 0);
@ -232,7 +232,7 @@ int32_t MUSIC_Init(int32_t SoundCard, int32_t Address)
# endif # endif
#endif #endif
music_initialized = 1; music_initialized = 1;
return(MUSIC_Ok); return MUSIC_Ok;
fallback: fallback:
initprintf("Error setting music command, falling back to timidity.\n"); initprintf("Error setting music command, falling back to timidity.\n");
@ -253,7 +253,7 @@ fallback:
initprintf("Error: couldn't open any of the following files:\n"); initprintf("Error: couldn't open any of the following files:\n");
for (i = ARRAY_SIZE(s)-1; i>=0; i--) for (i = ARRAY_SIZE(s)-1; i>=0; i--)
initprintf("%s\n",s[i]); initprintf("%s\n",s[i]);
return(MUSIC_Error); return MUSIC_Error;
} }
continue; continue;
} }
@ -263,7 +263,7 @@ fallback:
} }
music_initialized = 1; music_initialized = 1;
return(MUSIC_Ok); return MUSIC_Ok;
} // MUSIC_Init } // MUSIC_Init
@ -280,7 +280,7 @@ int32_t MUSIC_Shutdown(void)
music_initialized = 0; music_initialized = 0;
music_loopflag = MUSIC_PlayOnce; music_loopflag = MUSIC_PlayOnce;
return(MUSIC_Ok); return MUSIC_Ok;
} // MUSIC_Shutdown } // MUSIC_Shutdown
@ -378,7 +378,7 @@ int32_t MUSIC_StopSong(void)
external_midi_pid = -1; external_midi_pid = -1;
} }
return(MUSIC_Ok); return MUSIC_Ok;
} }
#endif #endif
@ -386,7 +386,7 @@ int32_t MUSIC_StopSong(void)
if (!Mix_QuerySpec(NULL, NULL, NULL)) if (!Mix_QuerySpec(NULL, NULL, NULL))
{ {
setErrorMessage("Need FX system initialized, too. Sorry."); setErrorMessage("Need FX system initialized, too. Sorry.");
return(MUSIC_Error); return MUSIC_Error;
} // if } // if
if ((Mix_PlayingMusic()) || (Mix_PausedMusic())) if ((Mix_PlayingMusic()) || (Mix_PausedMusic()))
@ -397,7 +397,7 @@ int32_t MUSIC_StopSong(void)
music_musicchunk = NULL; music_musicchunk = NULL;
return(MUSIC_Ok); return MUSIC_Ok;
} // MUSIC_StopSong } // MUSIC_StopSong
#if defined FORK_EXEC_MIDI #if defined FORK_EXEC_MIDI
@ -513,7 +513,7 @@ void MUSIC_SetContext(int32_t context)
int32_t MUSIC_GetContext(void) int32_t MUSIC_GetContext(void)
{ {
return(music_context); return music_context;
} // MUSIC_GetContext } // MUSIC_GetContext
@ -553,7 +553,7 @@ int32_t MUSIC_FadeVolume(int32_t tovolume, int32_t milliseconds)
{ {
UNREFERENCED_PARAMETER(tovolume); UNREFERENCED_PARAMETER(tovolume);
Mix_FadeOutMusic(milliseconds); Mix_FadeOutMusic(milliseconds);
return(MUSIC_Ok); return MUSIC_Ok;
} // MUSIC_FadeVolume } // MUSIC_FadeVolume

View file

@ -112,7 +112,7 @@ int32_t G_CheckActivatorMotion(int32_t lotag)
for (j = g_animateCount-1; j >= 0; j--) for (j = g_animateCount-1; j >= 0; j--)
if (s->sectnum == animatesect[j]) if (s->sectnum == animatesect[j])
return(1); return 1;
j = headspritestat[STAT_EFFECTOR]; j = headspritestat[STAT_EFFECTOR];
while (j >= 0) while (j >= 0)
@ -123,14 +123,14 @@ int32_t G_CheckActivatorMotion(int32_t lotag)
case SE_11_SWINGING_DOOR: case SE_11_SWINGING_DOOR:
case SE_30_TWO_WAY_TRAIN: case SE_30_TWO_WAY_TRAIN:
if (actor[j].t_data[4]) if (actor[j].t_data[4])
return(1); return 1;
break; break;
case SE_20_STRETCH_BRIDGE: case SE_20_STRETCH_BRIDGE:
case SE_31_FLOOR_RISE_FALL: case SE_31_FLOOR_RISE_FALL:
case SE_32_CEILING_RISE_FALL: case SE_32_CEILING_RISE_FALL:
case SE_18_INCREMENTAL_SECTOR_RISE_FALL: case SE_18_INCREMENTAL_SECTOR_RISE_FALL:
if (actor[j].t_data[0]) if (actor[j].t_data[0])
return(1); return 1;
break; break;
} }
@ -139,7 +139,7 @@ int32_t G_CheckActivatorMotion(int32_t lotag)
} }
i = nextspritestat[i]; i = nextspritestat[i];
} }
return(0); return 0;
} }
int32_t CheckDoorTile(int32_t dapic) int32_t CheckDoorTile(int32_t dapic)

View file

@ -276,7 +276,7 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos)
g_sounds[num].num++; g_sounds[num].num++;
} }
else g_sounds[num].lock--; else g_sounds[num].lock--;
return (voice); return voice;
} }
void S_PlaySound(int32_t num) void S_PlaySound(int32_t num)
@ -501,7 +501,7 @@ int32_t S_CheckSoundPlaying(int32_t i, int32_t num)
return 1; return 1;
return 0; return 0;
} }
return(g_sounds[num].num); return g_sounds[num].num;
} }
int32_t S_SoundsPlaying(int32_t i) int32_t S_SoundsPlaying(int32_t i)

View file

@ -84,7 +84,7 @@ static inline int32_t getfilenames(char const *path)
{ {
clearfilenames(); clearfilenames();
finddirs = klistpath(path,"*",CACHE1D_FIND_DIR); finddirs = klistpath(path,"*",CACHE1D_FIND_DIR);
return(0); return 0;
} }
#define POPULATE_VIDEO 1 #define POPULATE_VIDEO 1

View file

@ -54,7 +54,7 @@ int32_t G_GetVersionFromWebsite(char *buffer)
if (WSAStartup(0x101,&ws) == SOCKET_ERROR) if (WSAStartup(0x101,&ws) == SOCKET_ERROR)
{ {
// initprintf("update: Winsock error in G_GetVersionFromWebsite() (%d)\n",errno); // initprintf("update: Winsock error in G_GetVersionFromWebsite() (%d)\n",errno);
return(0); return 0;
} }
wsainitialized = 1; wsainitialized = 1;
} }
@ -63,7 +63,7 @@ int32_t G_GetVersionFromWebsite(char *buffer)
if ((h=gethostbyname(host)) == NULL) if ((h=gethostbyname(host)) == NULL)
{ {
// initprintf("update: gethostbyname() error in G_GetVersionFromWebsite() (%d)\n",h_errno); // initprintf("update: gethostbyname() error in G_GetVersionFromWebsite() (%d)\n",h_errno);
return(0); return 0;
} }
dest_addr.sin_addr.s_addr = ((struct in_addr *)(h->h_addr))->s_addr; dest_addr.sin_addr.s_addr = ((struct in_addr *)(h->h_addr))->s_addr;
@ -78,20 +78,20 @@ int32_t G_GetVersionFromWebsite(char *buffer)
if (mysock == INVALID_SOCKET) if (mysock == INVALID_SOCKET)
{ {
// initprintf("update: socket() error in G_GetVersionFromWebsite() (%d)\n",errno); // initprintf("update: socket() error in G_GetVersionFromWebsite() (%d)\n",errno);
return(0); return 0;
} }
initprintf("Connecting to http://%s\n",host); initprintf("Connecting to http://%s\n",host);
if (connect(mysock, (struct sockaddr *)&dest_addr, sizeof(struct sockaddr)) == SOCKET_ERROR) if (connect(mysock, (struct sockaddr *)&dest_addr, sizeof(struct sockaddr)) == SOCKET_ERROR)
{ {
// initprintf("update: connect() error in G_GetVersionFromWebsite() (%d)\n",errno); // initprintf("update: connect() error in G_GetVersionFromWebsite() (%d)\n",errno);
return(0); return 0;
} }
bytes_sent = send(mysock, req, strlen(req), 0); bytes_sent = send(mysock, req, strlen(req), 0);
if (bytes_sent == SOCKET_ERROR) if (bytes_sent == SOCKET_ERROR)
{ {
// initprintf("update: send() error in G_GetVersionFromWebsite() (%d)\n",errno); // initprintf("update: send() error in G_GetVersionFromWebsite() (%d)\n",errno);
return(0); return 0;
} }
// initprintf("sent %d bytes\n",bytes_sent); // initprintf("sent %d bytes\n",bytes_sent);
@ -135,9 +135,9 @@ int32_t G_GetVersionFromWebsite(char *buffer)
if (j) if (j)
{ {
strcpy(buffer,ver); strcpy(buffer,ver);
return(1); return 1;
} }
} }
return(0); return 0;
} }
#endif #endif