mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
Fix quite a few issues with casting away const and volatile qualifiers, found with -Wcast-qual. If we're going to use const everywhere, we should really mean it!
git-svn-id: https://svn.eduke32.com/eduke32@5540 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
8fc803fee3
commit
a7e6ed8745
37 changed files with 165 additions and 139 deletions
|
@ -241,8 +241,8 @@ void copybufreverse(const void *S, void *D, int32_t c);
|
||||||
static inline int32_t krecipasm(int32_t i)
|
static inline int32_t krecipasm(int32_t i)
|
||||||
{
|
{
|
||||||
// Ken did this
|
// Ken did this
|
||||||
float const f = (float)i;
|
float const f = (float const)i;
|
||||||
i = *(int32_t *)&f;
|
i = *(int32_t const *)&f;
|
||||||
return ((reciptable[(i >> 12) & 2047] >> (((i - 0x3f800000) >> 23) & 31)) ^ (i >> 31));
|
return ((reciptable[(i >> 12) & 2047] >> (((i - 0x3f800000) >> 23) & 31)) ^ (i >> 31));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,10 +80,10 @@ void clearbufbyte(void *D, int32_t c, int32_t a);
|
||||||
void copybufbyte(const void *S, void *D, int32_t c);
|
void copybufbyte(const void *S, void *D, int32_t c);
|
||||||
void copybufreverse(const void *S, void *D, int32_t c);
|
void copybufreverse(const void *S, void *D, int32_t c);
|
||||||
|
|
||||||
static inline int32_t krecipasm(int32_t i)
|
static inline int32_t krecipasm(int32_t const i)
|
||||||
{
|
{
|
||||||
// Ken did this
|
// Ken did this
|
||||||
float f = (float)i;
|
float f = (float const)i;
|
||||||
i = *(int32_t *)&f;
|
i = *(int32_t *)&f;
|
||||||
return ((reciptable[(i >> 12) & 2047] >> (((i - 0x3f800000) >> 23) & 31)) ^ (i >> 31));
|
return ((reciptable[(i >> 12) & 2047] >> (((i - 0x3f800000) >> 23) & 31)) ^ (i >> 31));
|
||||||
}
|
}
|
||||||
|
|
|
@ -518,10 +518,6 @@ void removesearchpaths_withuser(int32_t usermask)
|
||||||
|
|
||||||
int32_t findfrompath(const char *fn, char **where)
|
int32_t findfrompath(const char *fn, char **where)
|
||||||
{
|
{
|
||||||
searchpath_t *sp;
|
|
||||||
char *pfn, *ffn;
|
|
||||||
int32_t allocsiz;
|
|
||||||
|
|
||||||
// pathsearchmode == 0: tests current dir and then the dirs of the path stack
|
// pathsearchmode == 0: tests current dir and then the dirs of the path stack
|
||||||
// pathsearchmode == 1: tests fn without modification, then like for pathsearchmode == 0
|
// pathsearchmode == 1: tests fn without modification, then like for pathsearchmode == 0
|
||||||
|
|
||||||
|
@ -557,16 +553,18 @@ int32_t findfrompath(const char *fn, char **where)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
for (pfn = (char *)fn; toupperlookup[*pfn] == '/'; pfn++);
|
char const *cpfn;
|
||||||
ffn = Xstrdup(pfn);
|
|
||||||
|
for (cpfn = fn; toupperlookup[*cpfn] == '/'; cpfn++);
|
||||||
|
char *ffn = Xstrdup(cpfn);
|
||||||
|
|
||||||
Bcorrectfilename(ffn,0); // compress relative paths
|
Bcorrectfilename(ffn,0); // compress relative paths
|
||||||
|
|
||||||
allocsiz = max(maxsearchpathlen, 2); // "./" (aka. curdir)
|
int32_t allocsiz = max(maxsearchpathlen, 2); // "./" (aka. curdir)
|
||||||
allocsiz += strlen(ffn);
|
allocsiz += strlen(ffn);
|
||||||
allocsiz += 1; // a nul
|
allocsiz += 1; // a nul
|
||||||
|
|
||||||
pfn = (char *)Xmalloc(allocsiz);
|
char *pfn = (char *)Xmalloc(allocsiz);
|
||||||
|
|
||||||
strcpy(pfn, "./");
|
strcpy(pfn, "./");
|
||||||
strcat(pfn, ffn);
|
strcat(pfn, ffn);
|
||||||
|
@ -577,7 +575,7 @@ int32_t findfrompath(const char *fn, char **where)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (sp = searchpathhead; sp; sp = sp->next)
|
for (searchpath_t *sp = searchpathhead; sp; sp = sp->next)
|
||||||
{
|
{
|
||||||
char *tfn = Xstrdup(ffn);
|
char *tfn = Xstrdup(ffn);
|
||||||
|
|
||||||
|
@ -1765,7 +1763,7 @@ static uint32_t compress_part(uint32_t k, intptr_t f)
|
||||||
// Write from 'buffer' to 'f'.
|
// Write from 'buffer' to 'f'.
|
||||||
C1D_STATIC void c1d_write_compressed(const void *buffer, bsize_t dasizeof, bsize_t count, intptr_t f)
|
C1D_STATIC void c1d_write_compressed(const void *buffer, bsize_t dasizeof, bsize_t count, intptr_t f)
|
||||||
{
|
{
|
||||||
const char *ptr = (char*)buffer;
|
char const *ptr = (char const *)buffer;
|
||||||
|
|
||||||
if (dasizeof > LZWSIZE)
|
if (dasizeof > LZWSIZE)
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,7 +40,7 @@ void initfastcolorlookup_palette(uint8_t const * const pal)
|
||||||
|
|
||||||
colmatch_palette = pal;
|
colmatch_palette = pal;
|
||||||
|
|
||||||
char const *pal1 = (char *)&pal[768-3];
|
char const *pal1 = (char const *)&pal[768-3];
|
||||||
for (int i=255; i>=0; i--,pal1-=3)
|
for (int i=255; i>=0; i--,pal1-=3)
|
||||||
{
|
{
|
||||||
int32_t const j = (pal1[0]>>FASTPALRIGHTSHIFT)*FASTPALGRIDSIZ*FASTPALGRIDSIZ
|
int32_t const j = (pal1[0]>>FASTPALRIGHTSHIFT)*FASTPALGRIDSIZ*FASTPALGRIDSIZ
|
||||||
|
@ -155,7 +155,7 @@ int32_t getclosestcol_nocache_lim(int32_t r, int32_t g, int32_t b, int32_t const
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
char const * const pal1 = (char *)&colmatch_palette[i*3];
|
char const * const pal1 = (char const *)&colmatch_palette[i*3];
|
||||||
int dist = gdist[pal1[1]+g];
|
int dist = gdist[pal1[1]+g];
|
||||||
|
|
||||||
if (dist >= mindist || i > lastokcol) continue;
|
if (dist >= mindist || i > lastokcol) continue;
|
||||||
|
@ -175,7 +175,7 @@ int32_t getclosestcol_nocache_lim(int32_t r, int32_t g, int32_t b, int32_t const
|
||||||
|
|
||||||
for (int i = 0; i < lastokcol; ++i)
|
for (int i = 0; i < lastokcol; ++i)
|
||||||
{
|
{
|
||||||
char const * const pal1 = (char *)&colmatch_palette[i*3];
|
char const * const pal1 = (char const *)&colmatch_palette[i*3];
|
||||||
int dist = gdist[pal1[1]+g];
|
int dist = gdist[pal1[1]+g];
|
||||||
|
|
||||||
if (dist >= mindist) continue;
|
if (dist >= mindist) continue;
|
||||||
|
|
|
@ -189,15 +189,15 @@ int32_t maybe_append_ext(char *wbuf, int32_t wbufsiz, const char *fn, const char
|
||||||
|
|
||||||
int32_t ldist(const void *s1, const void *s2)
|
int32_t ldist(const void *s1, const void *s2)
|
||||||
{
|
{
|
||||||
tspritetype const *const sp1 = (tspritetype *)s1;
|
tspritetype const *const sp1 = (tspritetype const *)s1;
|
||||||
tspritetype const *const sp2 = (tspritetype *)s2;
|
tspritetype const *const sp2 = (tspritetype const *)s2;
|
||||||
return sepldist(sp1->x - sp2->x, sp1->y - sp2->y);
|
return sepldist(sp1->x - sp2->x, sp1->y - sp2->y);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t dist(const void *s1, const void *s2)
|
int32_t dist(const void *s1, const void *s2)
|
||||||
{
|
{
|
||||||
tspritetype const *const sp1 = (tspritetype *)s1;
|
tspritetype const *const sp1 = (tspritetype const *)s1;
|
||||||
tspritetype const *const sp2 = (tspritetype *)s2;
|
tspritetype const *const sp2 = (tspritetype const *)s2;
|
||||||
return sepdist(sp1->x - sp2->x, sp1->y - sp2->y, sp1->z - sp2->z);
|
return sepdist(sp1->x - sp2->x, sp1->y - sp2->y, sp1->z - sp2->z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
uint32_t Bcrc32(const void* data, size_t length, uint32_t crc)
|
uint32_t Bcrc32(const void* data, size_t length, uint32_t crc)
|
||||||
{
|
{
|
||||||
const uint32_t* current = (const uint32_t*) data;
|
const uint32_t* current = (const uint32_t*) data;
|
||||||
uint8_t *currentChar;
|
uint8_t const * currentChar;
|
||||||
crc = ~crc;
|
crc = ~crc;
|
||||||
|
|
||||||
#ifdef BITNESS64
|
#ifdef BITNESS64
|
||||||
|
@ -61,7 +61,7 @@ uint32_t Bcrc32(const void* data, size_t length, uint32_t crc)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
currentChar = (uint8_t*) current;
|
currentChar = (uint8_t const *) current;
|
||||||
// remaining 1 to 7 bytes (standard algorithm)
|
// remaining 1 to 7 bytes (standard algorithm)
|
||||||
while (length-- > 0)
|
while (length-- > 0)
|
||||||
crc = (crc >> 8) ^ crc32table[0][(crc & 0xFF) ^ *currentChar++];
|
crc = (crc >> 8) ^ crc32table[0][(crc & 0xFF) ^ *currentChar++];
|
||||||
|
|
|
@ -98,7 +98,7 @@ usermaphack_t g_loadedMapHack; // used only for the MD4 part
|
||||||
|
|
||||||
int32_t compare_usermaphacks(const void *a, const void *b)
|
int32_t compare_usermaphacks(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
return Bmemcmp(((usermaphack_t*) a)->md4, ((usermaphack_t*) b)->md4, 16);
|
return Bmemcmp(((usermaphack_t const *) a)->md4, ((usermaphack_t const *) b)->md4, 16);
|
||||||
}
|
}
|
||||||
usermaphack_t *usermaphacks;
|
usermaphack_t *usermaphacks;
|
||||||
int32_t num_usermaphacks;
|
int32_t num_usermaphacks;
|
||||||
|
@ -12635,7 +12635,7 @@ int32_t setsprite(int16_t spritenum, const vec3_t *newpos)
|
||||||
{
|
{
|
||||||
int16_t tempsectnum = sprite[spritenum].sectnum;
|
int16_t tempsectnum = sprite[spritenum].sectnum;
|
||||||
|
|
||||||
if ((void *)newpos != (void *)&sprite[spritenum])
|
if ((void const *)newpos != (void *)&sprite[spritenum])
|
||||||
Bmemcpy(&sprite[spritenum], newpos, sizeof(vec3_t));
|
Bmemcpy(&sprite[spritenum], newpos, sizeof(vec3_t));
|
||||||
|
|
||||||
updatesector(newpos->x,newpos->y,&tempsectnum);
|
updatesector(newpos->x,newpos->y,&tempsectnum);
|
||||||
|
@ -12652,7 +12652,7 @@ int32_t setspritez(int16_t spritenum, const vec3_t *newpos)
|
||||||
{
|
{
|
||||||
int16_t tempsectnum = sprite[spritenum].sectnum;
|
int16_t tempsectnum = sprite[spritenum].sectnum;
|
||||||
|
|
||||||
if ((void *)newpos != (void *)&sprite[spritenum])
|
if ((void const *)newpos != (void *)&sprite[spritenum])
|
||||||
Bmemcpy(&sprite[spritenum], newpos, sizeof(vec3_t));
|
Bmemcpy(&sprite[spritenum], newpos, sizeof(vec3_t));
|
||||||
|
|
||||||
updatesectorz(newpos->x,newpos->y,newpos->z,&tempsectnum);
|
updatesectorz(newpos->x,newpos->y,newpos->z,&tempsectnum);
|
||||||
|
@ -13393,7 +13393,7 @@ restart_grand:
|
||||||
if (klabs(intx-sv->x)+klabs(inty-sv->y) > klabs((hit->pos.x)-sv->x)+klabs((hit->pos.y)-sv->y))
|
if (klabs(intx-sv->x)+klabs(inty-sv->y) > klabs((hit->pos.x)-sv->x)+klabs((hit->pos.y)-sv->y))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
get_floorspr_points((tspritetype *)spr, intx, inty, &x1, &x2, &x3, &x4,
|
get_floorspr_points((tspritetype const *)spr, intx, inty, &x1, &x2, &x3, &x4,
|
||||||
&y1, &y2, &y3, &y4);
|
&y1, &y2, &y3, &y4);
|
||||||
|
|
||||||
if (get_floorspr_clipyou(x1, x2, x3, x4, y1, y2, y3, y4))
|
if (get_floorspr_clipyou(x1, x2, x3, x4, y1, y2, y3, y4))
|
||||||
|
@ -14214,7 +14214,7 @@ int32_t clipmove(vec3_t *pos, int16_t *sectnum,
|
||||||
|
|
||||||
rxi[0] = x1;
|
rxi[0] = x1;
|
||||||
ryi[0] = y1;
|
ryi[0] = y1;
|
||||||
get_floorspr_points((tspritetype *) spr, 0, 0, &rxi[0], &rxi[1], &rxi[2], &rxi[3],
|
get_floorspr_points((tspritetype const *) spr, 0, 0, &rxi[0], &rxi[1], &rxi[2], &rxi[3],
|
||||||
&ryi[0], &ryi[1], &ryi[2], &ryi[3]);
|
&ryi[0], &ryi[1], &ryi[2], &ryi[3]);
|
||||||
|
|
||||||
dax = mulscale14(sintable[(spr->ang-256+512)&2047],walldist);
|
dax = mulscale14(sintable[(spr->ang-256+512)&2047],walldist);
|
||||||
|
@ -15082,7 +15082,7 @@ restart_grand:
|
||||||
if ((pos->z > daz) == ((cstat&8)==0))
|
if ((pos->z > daz) == ((cstat&8)==0))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
get_floorspr_points((tspritetype *) spr, pos->x, pos->y, &x1, &x2, &x3, &x4,
|
get_floorspr_points((tspritetype const *) spr, pos->x, pos->y, &x1, &x2, &x3, &x4,
|
||||||
&y1, &y2, &y3, &y4);
|
&y1, &y2, &y3, &y4);
|
||||||
|
|
||||||
const int32_t dax = mulscale14(sintable[(spr->ang-256+512)&2047],walldist+4);
|
const int32_t dax = mulscale14(sintable[(spr->ang-256+512)&2047],walldist+4);
|
||||||
|
@ -18052,11 +18052,13 @@ static int32_t screencapture_png(const char *filename, char inverseit, const cha
|
||||||
#endif
|
#endif
|
||||||
text[0].compression = PNG_TEXT_COMPRESSION_NONE;
|
text[0].compression = PNG_TEXT_COMPRESSION_NONE;
|
||||||
text[0].key = "Title";
|
text[0].key = "Title";
|
||||||
text[0].text = (png_charp)(editstatus ? "Mapster32 screenshot" : "EDuke32 screenshot");
|
char *pngtext = Bstrdup((editstatus ? "Mapster32 screenshot" : "EDuke32 screenshot"));
|
||||||
|
text[0].text = pngtext;
|
||||||
|
|
||||||
text[1].compression = PNG_TEXT_COMPRESSION_NONE;
|
text[1].compression = PNG_TEXT_COMPRESSION_NONE;
|
||||||
text[1].key = "Software";
|
text[1].key = "Software";
|
||||||
text[1].text = (char *)versionstr;
|
char *pngversion = Bstrdup(versionstr);
|
||||||
|
text[1].text = pngversion;
|
||||||
png_set_text(png_ptr, info_ptr, text, 2);
|
png_set_text(png_ptr, info_ptr, text, 2);
|
||||||
|
|
||||||
// get/set the pixel data
|
// get/set the pixel data
|
||||||
|
@ -18095,6 +18097,10 @@ static int32_t screencapture_png(const char *filename, char inverseit, const cha
|
||||||
Bfclose(fp);
|
Bfclose(fp);
|
||||||
if (palette) png_free(png_ptr, palette);
|
if (palette) png_free(png_ptr, palette);
|
||||||
if (text) png_free(png_ptr, text);
|
if (text) png_free(png_ptr, text);
|
||||||
|
|
||||||
|
DO_FREE_AND_NULL(pngtext);
|
||||||
|
DO_FREE_AND_NULL(pngversion);
|
||||||
|
|
||||||
if (buf) png_free(png_ptr, buf);
|
if (buf) png_free(png_ptr, buf);
|
||||||
if (rowptrs) png_free(png_ptr, rowptrs);
|
if (rowptrs) png_free(png_ptr, rowptrs);
|
||||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||||
|
@ -18287,7 +18293,7 @@ int32_t setrendermode(int32_t renderer)
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
void setrollangle(int32_t rolla)
|
void setrollangle(int32_t rolla)
|
||||||
{
|
{
|
||||||
gtang = (float)rolla * (PI * (1.f/1024.f));
|
gtang = (float)rolla * ((float)PI * (1.f/1024.f));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ int32_t hicsetsubsttex(int32_t picnum, int32_t palnum, const char *filen, float
|
||||||
Bfree(hrn->filename);
|
Bfree(hrn->filename);
|
||||||
|
|
||||||
hrn->filename = Xstrdup(filen);
|
hrn->filename = Xstrdup(filen);
|
||||||
hrn->alphacut = min(alphacut,1.0);
|
hrn->alphacut = min(alphacut,1.f);
|
||||||
hrn->scale.x = xscale;
|
hrn->scale.x = xscale;
|
||||||
hrn->scale.y = yscale;
|
hrn->scale.y = yscale;
|
||||||
hrn->specpower = specpower;
|
hrn->specpower = specpower;
|
||||||
|
|
|
@ -208,7 +208,8 @@ static inline int32_t bitrev(int32_t b, int32_t c)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static uint8_t fakebuf[8], *nfilptr;
|
static uint8_t fakebuf[8];
|
||||||
|
static uint8_t const *nfilptr;
|
||||||
static int32_t nbitpos;
|
static int32_t nbitpos;
|
||||||
static void suckbitsnextblock()
|
static void suckbitsnextblock()
|
||||||
{
|
{
|
||||||
|
@ -237,7 +238,7 @@ static void suckbitsnextblock()
|
||||||
// |===|===|
|
// |===|===|
|
||||||
//----x O---x O--------
|
//----x O---x O--------
|
||||||
nbitpos = B_BIG32(B_UNBUF32(&filptr[8]));
|
nbitpos = B_BIG32(B_UNBUF32(&filptr[8]));
|
||||||
nfilptr = (uint8_t *)&filptr[nbitpos+12];
|
nfilptr = &filptr[nbitpos+12];
|
||||||
B_BUF32(&fakebuf[0], B_UNBUF32(&filptr[0])); //Copy last dword of IDAT chunk
|
B_BUF32(&fakebuf[0], B_UNBUF32(&filptr[0])); //Copy last dword of IDAT chunk
|
||||||
if (B_UNBUF32(&filptr[12]) == B_LITTLE32(0x54414449)) //Copy 1st dword of next IDAT chunk
|
if (B_UNBUF32(&filptr[12]) == B_LITTLE32(0x54414449)) //Copy 1st dword of next IDAT chunk
|
||||||
B_BUF32(&fakebuf[4], B_UNBUF32(&filptr[16]));
|
B_BUF32(&fakebuf[4], B_UNBUF32(&filptr[16]));
|
||||||
|
@ -754,7 +755,7 @@ static int32_t kpngrend(const char *kfilebuf, int32_t kfilength,
|
||||||
|
|
||||||
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 *)&kfilebuf[8];
|
filptr = (uint8_t const *)&kfilebuf[8];
|
||||||
|
|
||||||
trnsrgb = 0; filter1st = -1; filterest = 0;
|
trnsrgb = 0; filter1st = -1; filterest = 0;
|
||||||
|
|
||||||
|
@ -1289,7 +1290,7 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
|
||||||
|
|
||||||
if (!kpeginited) { kpeginited = 1; initkpeg(); }
|
if (!kpeginited) { kpeginited = 1; initkpeg(); }
|
||||||
|
|
||||||
kfileptr = (uint8_t *)kfilebuf;
|
kfileptr = (uint8_t const *)kfilebuf;
|
||||||
kfileend = &kfileptr[kfilength];
|
kfileend = &kfileptr[kfilength];
|
||||||
|
|
||||||
if (B_UNBUF16(kfileptr) == B_LITTLE16(0xd8ff)) kfileptr += 2;
|
if (B_UNBUF16(kfileptr) == B_LITTLE16(0xd8ff)) kfileptr += 2;
|
||||||
|
@ -1348,7 +1349,7 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
|
||||||
ch = *kfileptr++; leng--;
|
ch = *kfileptr++; leng--;
|
||||||
if (ch >= 16) { index = ch-12; }
|
if (ch >= 16) { index = ch-12; }
|
||||||
else { index = ch; }
|
else { index = ch; }
|
||||||
Bmemcpy((void *)&hufnumatbit[index][1],(void *)kfileptr,16); kfileptr += 16;
|
Bmemcpy((void *)&hufnumatbit[index][1],(void const *)kfileptr,16); kfileptr += 16;
|
||||||
leng -= 16;
|
leng -= 16;
|
||||||
|
|
||||||
v = 0; hufcnt[index] = 0;
|
v = 0; hufcnt[index] = 0;
|
||||||
|
@ -1357,7 +1358,7 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
|
||||||
{
|
{
|
||||||
hufmaxatbit[index][i] = v+hufnumatbit[index][i];
|
hufmaxatbit[index][i] = v+hufnumatbit[index][i];
|
||||||
hufvalatbit[index][i] = hufcnt[index]-v;
|
hufvalatbit[index][i] = hufcnt[index]-v;
|
||||||
Bmemcpy((void *)&huftable[index][hufcnt[index]],(void *)kfileptr,(int32_t)hufnumatbit[index][i]);
|
Bmemcpy((void *)&huftable[index][hufcnt[index]],(void const *)kfileptr,(int32_t)hufnumatbit[index][i]);
|
||||||
if (i <= 10)
|
if (i <= 10)
|
||||||
for (c=0; c<hufnumatbit[index][i]; c++)
|
for (c=0; c<hufnumatbit[index][i]; c++)
|
||||||
for (j=(1<<(10-i)); j>0; j--)
|
for (j=(1<<(10-i)); j>0; j--)
|
||||||
|
@ -1468,7 +1469,7 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
|
||||||
for (y=0; y<ydim; y+=glvstep)
|
for (y=0; y<ydim; y+=glvstep)
|
||||||
for (x=0; x<xdim; x+=glhstep)
|
for (x=0; x<xdim; x+=glhstep)
|
||||||
{
|
{
|
||||||
if (kfileptr-4-(uint8_t *)kfilebuf >= kfilength) goto kpegrend_break2; //rest of file is missing!
|
if (kfileptr-4-(uint8_t const *)kfilebuf >= kfilength) goto kpegrend_break2; //rest of file is missing!
|
||||||
|
|
||||||
if (!dctbuf) dc = dct[0];
|
if (!dctbuf) dc = dct[0];
|
||||||
for (c=0; c<lnumcomponents; c++)
|
for (c=0; c<lnumcomponents; c++)
|
||||||
|
@ -1607,7 +1608,7 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
|
||||||
default: kfileptr += leng; break;
|
default: kfileptr += leng; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (kfileptr-(uint8_t *)kfilebuf < kfilength);
|
while (kfileptr-(uint8_t const *)kfilebuf < kfilength);
|
||||||
|
|
||||||
if (!dctbuf) return(0);
|
if (!dctbuf) return(0);
|
||||||
|
|
||||||
|
@ -1663,7 +1664,7 @@ static int32_t kgifrend(const char *kfilebuf, int32_t kfilelength,
|
||||||
|
|
||||||
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 *)&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; }
|
||||||
transcol = -1;
|
transcol = -1;
|
||||||
while ((chunkind = *ptr++) == '!')
|
while ((chunkind = *ptr++) == '!')
|
||||||
|
@ -1827,7 +1828,7 @@ static int32_t ktgarend(const char *header, int32_t fleng,
|
||||||
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 *)&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);
|
||||||
|
@ -2027,7 +2028,8 @@ static int32_t kpcxrend(const char *buf, int32_t fleng,
|
||||||
{
|
{
|
||||||
int32_t j, x, y, nplanes, x0, x1, y0, y1, bpl, xsiz, ysiz;
|
int32_t j, x, y, nplanes, x0, x1, y0, y1, bpl, xsiz, ysiz;
|
||||||
intptr_t p,i;
|
intptr_t p,i;
|
||||||
uint8_t c, *cptr;
|
uint8_t c;
|
||||||
|
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);
|
||||||
|
@ -2038,7 +2040,7 @@ static int32_t kpcxrend(const char *buf, int32_t fleng,
|
||||||
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 *)&buf[fleng-768];
|
cptr = (uint8_t const *)&buf[fleng-768];
|
||||||
for (i=0; i<256; i++)
|
for (i=0; i<256; i++)
|
||||||
{
|
{
|
||||||
palcol[i] = (((int32_t)cptr[0])<<16) +
|
palcol[i] = (((int32_t)cptr[0])<<16) +
|
||||||
|
@ -2062,7 +2064,7 @@ static int32_t kpcxrend(const char *buf, int32_t fleng,
|
||||||
|
|
||||||
x = x0 = 0; x1 = xsiz;
|
x = x0 = 0; x1 = xsiz;
|
||||||
y = y0 = 0; y1 = ysiz;
|
y = y0 = 0; y1 = ysiz;
|
||||||
cptr = (uint8_t *)&buf[128];
|
cptr = (uint8_t const *)&buf[128];
|
||||||
p = y*dabytesperline+daframeplace;
|
p = y*dabytesperline+daframeplace;
|
||||||
|
|
||||||
if (bpl > xsiz) { daxres = min(daxres,x1); x1 += bpl-xsiz; }
|
if (bpl > xsiz) { daxres = min(daxres,x1); x1 += bpl-xsiz; }
|
||||||
|
@ -2238,14 +2240,14 @@ static int32_t istarga(const uint8_t *buf, int32_t leng)
|
||||||
|
|
||||||
void kpgetdim(const char *buf, int32_t leng, int32_t *xsiz, int32_t *ysiz)
|
void kpgetdim(const char *buf, int32_t leng, int32_t *xsiz, int32_t *ysiz)
|
||||||
{
|
{
|
||||||
int32_t *lptr;
|
int32_t const *lptr;
|
||||||
const uint8_t *cptr;
|
const uint8_t *cptr;
|
||||||
const uint8_t *ubuf = (uint8_t *)buf;
|
const uint8_t *ubuf = (uint8_t const *)buf;
|
||||||
|
|
||||||
(*xsiz) = (*ysiz) = 0; if (leng < 16) return;
|
(*xsiz) = (*ysiz) = 0; if (leng < 16) return;
|
||||||
if (B_UNBUF16(&ubuf[0]) == B_LITTLE16(0x5089)) //.PNG
|
if (B_UNBUF16(&ubuf[0]) == B_LITTLE16(0x5089)) //.PNG
|
||||||
{
|
{
|
||||||
lptr = (int32_t *)buf;
|
lptr = (int32_t const *)buf;
|
||||||
if ((lptr[0] != (int32_t)B_LITTLE32(0x474e5089)) || (lptr[1] != (int32_t)B_LITTLE32(0x0a1a0a0d))) return;
|
if ((lptr[0] != (int32_t)B_LITTLE32(0x474e5089)) || (lptr[1] != (int32_t)B_LITTLE32(0x0a1a0a0d))) return;
|
||||||
lptr = &lptr[2];
|
lptr = &lptr[2];
|
||||||
while (((uintptr_t)lptr-(uintptr_t)buf) < (uintptr_t)(leng-16))
|
while (((uintptr_t)lptr-(uintptr_t)buf) < (uintptr_t)(leng-16))
|
||||||
|
@ -2257,7 +2259,7 @@ void kpgetdim(const char *buf, int32_t leng, int32_t *xsiz, int32_t *ysiz)
|
||||||
}
|
}
|
||||||
else if (B_UNBUF16(&ubuf[0]) == B_LITTLE16(0xd8ff)) //.JPG
|
else if (B_UNBUF16(&ubuf[0]) == B_LITTLE16(0xd8ff)) //.JPG
|
||||||
{
|
{
|
||||||
cptr = (uint8_t *)&buf[2];
|
cptr = (uint8_t const *)&buf[2];
|
||||||
while (((uintptr_t)cptr-(uintptr_t)buf) < (uintptr_t)(leng-8))
|
while (((uintptr_t)cptr-(uintptr_t)buf) < (uintptr_t)(leng-8))
|
||||||
{
|
{
|
||||||
if ((cptr[0] != 0xff) || (cptr[1] == 0xff)) { cptr++; continue; }
|
if ((cptr[0] != 0xff) || (cptr[1] == 0xff)) { cptr++; continue; }
|
||||||
|
@ -2323,7 +2325,7 @@ void kpgetdim(const char *buf, int32_t leng, int32_t *xsiz, int32_t *ysiz)
|
||||||
int32_t kprender(const char *buf, int32_t leng, intptr_t frameptr, int32_t bpl,
|
int32_t kprender(const char *buf, int32_t leng, intptr_t frameptr, int32_t bpl,
|
||||||
int32_t xdim, int32_t ydim)
|
int32_t xdim, int32_t ydim)
|
||||||
{
|
{
|
||||||
uint8_t *ubuf = (uint8_t *)buf;
|
uint8_t const *ubuf = (uint8_t const *)buf;
|
||||||
|
|
||||||
paleng = 0; bakcol = 0; numhufblocks = zlibcompflags = 0; filtype = -1;
|
paleng = 0; bakcol = 0; numhufblocks = zlibcompflags = 0; filtype = -1;
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef unsigned char *POINTER;
|
typedef unsigned char *POINTER;
|
||||||
|
typedef unsigned char const *RPOINTER;
|
||||||
typedef unsigned short UINT2;
|
typedef unsigned short UINT2;
|
||||||
typedef unsigned int UINT4;
|
typedef unsigned int UINT4;
|
||||||
|
|
||||||
|
@ -130,7 +131,7 @@ void md4block(MD4_CTX *context, const unsigned char *input, unsigned int inputLe
|
||||||
if (inputLen >= partLen)
|
if (inputLen >= partLen)
|
||||||
{
|
{
|
||||||
MD4_memcpy
|
MD4_memcpy
|
||||||
((POINTER)&context->buffer[index], (POINTER)input, partLen);
|
((POINTER)&context->buffer[index], (RPOINTER)input, partLen);
|
||||||
MD4Transform(context->state, context->buffer);
|
MD4Transform(context->state, context->buffer);
|
||||||
|
|
||||||
for (i = partLen; i + 63 < inputLen; i += 64)
|
for (i = partLen; i + 63 < inputLen; i += 64)
|
||||||
|
@ -143,7 +144,7 @@ void md4block(MD4_CTX *context, const unsigned char *input, unsigned int inputLe
|
||||||
|
|
||||||
/* Buffer remaining input */
|
/* Buffer remaining input */
|
||||||
MD4_memcpy
|
MD4_memcpy
|
||||||
((POINTER)&context->buffer[index], (POINTER)&input[i],
|
((POINTER)&context->buffer[index], (RPOINTER)&input[i],
|
||||||
inputLen-i);
|
inputLen-i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2597,7 +2597,7 @@ mdmodel_t *mdload(const char *filnam)
|
||||||
vm = (mdmodel_t *)voxload(filnam);
|
vm = (mdmodel_t *)voxload(filnam);
|
||||||
if (vm) return vm;
|
if (vm) return vm;
|
||||||
|
|
||||||
fil = kopen4load((char *)filnam,0);
|
fil = kopen4load(filnam,0);
|
||||||
|
|
||||||
if (fil < 0)
|
if (fil < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2688,7 +2688,7 @@ int32_t polymost_mddraw(const tspritetype *tspr)
|
||||||
allocmodelverts = maxmodelverts;
|
allocmodelverts = maxmodelverts;
|
||||||
}
|
}
|
||||||
|
|
||||||
mdmodel_t const *const vm = models[tile2model[Ptile2tile(tspr->picnum,
|
mdmodel_t *const vm = models[tile2model[Ptile2tile(tspr->picnum,
|
||||||
(tspr->owner >= MAXSPRITES) ? tspr->pal : sprite[tspr->owner].pal)].modelid];
|
(tspr->owner >= MAXSPRITES) ? tspr->pal : sprite[tspr->owner].pal)].modelid];
|
||||||
if (vm->mdnum == 1) { return polymost_voxdraw((voxmodel_t *)vm,tspr); }
|
if (vm->mdnum == 1) { return polymost_voxdraw((voxmodel_t *)vm,tspr); }
|
||||||
if (vm->mdnum == 3) { return polymost_md3draw((md3model_t *)vm,tspr); }
|
if (vm->mdnum == 3) { return polymost_md3draw((md3model_t *)vm,tspr); }
|
||||||
|
|
|
@ -332,7 +332,7 @@ static int32_t _internal_osdfunc_fileinfo(const osdfuncparm_t *parm)
|
||||||
|
|
||||||
if (parm->numparms != 1) return OSDCMD_SHOWHELP;
|
if (parm->numparms != 1) return OSDCMD_SHOWHELP;
|
||||||
|
|
||||||
if ((i = kopen4load((char *)parm->parms[0],0)) < 0)
|
if ((i = kopen4load(parm->parms[0],0)) < 0)
|
||||||
{
|
{
|
||||||
OSD_Printf("fileinfo: File \"%s\" not found.\n", parm->parms[0]);
|
OSD_Printf("fileinfo: File \"%s\" not found.\n", parm->parms[0]);
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
|
@ -1797,7 +1797,7 @@ int32_t OSD_Dispatch(const char *cmd)
|
||||||
int32_t numparms = 0;
|
int32_t numparms = 0;
|
||||||
symbol_t *symb;
|
symbol_t *symb;
|
||||||
osdfuncparm_t ofp;
|
osdfuncparm_t ofp;
|
||||||
char *parms[MAXPARMS];
|
char const *parms[MAXPARMS];
|
||||||
|
|
||||||
Bmemset(parms, 0, sizeof(parms));
|
Bmemset(parms, 0, sizeof(parms));
|
||||||
|
|
||||||
|
@ -2054,7 +2054,7 @@ int32_t osdcmd_cvar_set(const osdfuncparm_t *parm)
|
||||||
{
|
{
|
||||||
if (showval)
|
if (showval)
|
||||||
{
|
{
|
||||||
OSD_Printf("\"%s\" is \"%f\"\n%s: %s\n",osd->cvars[i].c.name,*(float *)osd->cvars[i].c.vptr,osd->cvars[i].c.name,(char *)osd->cvars[i].c.desc);
|
OSD_Printf("\"%s\" is \"%f\"\n%s: %s\n",osd->cvars[i].c.name,*(float *)osd->cvars[i].c.vptr,osd->cvars[i].c.name,osd->cvars[i].c.desc);
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2075,7 +2075,7 @@ int32_t osdcmd_cvar_set(const osdfuncparm_t *parm)
|
||||||
{
|
{
|
||||||
if (showval)
|
if (showval)
|
||||||
{
|
{
|
||||||
OSD_Printf("\"%s\" is \"%f\"\n%s: %s\n",osd->cvars[i].c.name,*(double *)osd->cvars[i].c.vptr,osd->cvars[i].c.name,(char *)osd->cvars[i].c.desc);
|
OSD_Printf("\"%s\" is \"%f\"\n%s: %s\n",osd->cvars[i].c.name,*(double *)osd->cvars[i].c.vptr,osd->cvars[i].c.name,osd->cvars[i].c.desc);
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2098,7 +2098,7 @@ int32_t osdcmd_cvar_set(const osdfuncparm_t *parm)
|
||||||
{
|
{
|
||||||
if (showval)
|
if (showval)
|
||||||
{
|
{
|
||||||
OSD_Printf((osd->cvars[i].c.type & CVAR_UINT) ? "\"%s\" is \"%u\"\n%s: %s\n" : "\"%s\" is \"%d\"\n%s: %s\n",osd->cvars[i].c.name,*(int32_t *)osd->cvars[i].c.vptr,osd->cvars[i].c.name,(char *)osd->cvars[i].c.desc);
|
OSD_Printf((osd->cvars[i].c.type & CVAR_UINT) ? "\"%s\" is \"%u\"\n%s: %s\n" : "\"%s\" is \"%d\"\n%s: %s\n",osd->cvars[i].c.name,*(int32_t *)osd->cvars[i].c.vptr,osd->cvars[i].c.name,osd->cvars[i].c.desc);
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2119,7 +2119,7 @@ int32_t osdcmd_cvar_set(const osdfuncparm_t *parm)
|
||||||
{
|
{
|
||||||
if (showval)
|
if (showval)
|
||||||
{
|
{
|
||||||
OSD_Printf("\"%s\" is \"%s\"\n%s: %s\n",osd->cvars[i].c.name,(char *)osd->cvars[i].c.vptr,osd->cvars[i].c.name, (char *)osd->cvars[i].c.desc);
|
OSD_Printf("\"%s\" is \"%s\"\n%s: %s\n",osd->cvars[i].c.name,(char *)osd->cvars[i].c.vptr,osd->cvars[i].c.name, osd->cvars[i].c.desc);
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -424,8 +424,8 @@ static void fogcalc_old(int32_t shade, int32_t vis)
|
||||||
|
|
||||||
// For GL_LINEAR fog:
|
// For GL_LINEAR fog:
|
||||||
#define FOGDISTCONST 600
|
#define FOGDISTCONST 600
|
||||||
#define FULLVIS_BEGIN 2.9e30
|
#define FULLVIS_BEGIN 2.9e30f
|
||||||
#define FULLVIS_END 3.0e30
|
#define FULLVIS_END 3.0e30f
|
||||||
|
|
||||||
static inline void fogcalc(int32_t tile, int32_t shade, int32_t vis, int32_t pal)
|
static inline void fogcalc(int32_t tile, int32_t shade, int32_t vis, int32_t pal)
|
||||||
{
|
{
|
||||||
|
@ -2735,7 +2735,7 @@ static void polymost_drawalls(int32_t const bunch)
|
||||||
ytex.d = ytex.u = 0;
|
ytex.d = ytex.u = 0;
|
||||||
otex.d = dd;
|
otex.d = dd;
|
||||||
xtex.u = otex.d * (t * (float)((uint64_t)(xdimscale * yxaspect) * viewingrange)) *
|
xtex.u = otex.d * (t * (float)((uint64_t)(xdimscale * yxaspect) * viewingrange)) *
|
||||||
(1.f / (16384.0 * 65536.0 * 65536.0 * 5.0 * 1024.0));
|
(1.f / (16384.f * 65536.f * 65536.f * 5.f * 1024.f));
|
||||||
ytex.v = vv[1];
|
ytex.v = vv[1];
|
||||||
otex.v = r_parallaxskypanning ? vv[0] + dd*(float)sec->floorypanning*(float)i*(1.f/256.f) : vv[0];
|
otex.v = r_parallaxskypanning ? vv[0] + dd*(float)sec->floorypanning*(float)i*(1.f/256.f) : vv[0];
|
||||||
|
|
||||||
|
@ -3027,7 +3027,7 @@ static void polymost_drawalls(int32_t const bunch)
|
||||||
ytex.d = ytex.u = 0;
|
ytex.d = ytex.u = 0;
|
||||||
otex.d = dd;
|
otex.d = dd;
|
||||||
xtex.u = otex.d * (t * (float)((uint64_t)(xdimscale * yxaspect) * viewingrange)) *
|
xtex.u = otex.d * (t * (float)((uint64_t)(xdimscale * yxaspect) * viewingrange)) *
|
||||||
(1.f / (16384.0 * 65536.0 * 65536.0 * 5.0 * 1024.0));
|
(1.f / (16384.f * 65536.f * 65536.f * 5.f * 1024.f));
|
||||||
ytex.v = vv[1];
|
ytex.v = vv[1];
|
||||||
otex.v = r_parallaxskypanning ? vv[0] + dd*(float)sec->ceilingypanning*(float)i*(1.f/256.f) : vv[0];
|
otex.v = r_parallaxskypanning ? vv[0] + dd*(float)sec->ceilingypanning*(float)i*(1.f/256.f) : vv[0];
|
||||||
|
|
||||||
|
@ -4839,7 +4839,7 @@ void polymost_dorotatespritemodel(int32_t sx, int32_t sy, int32_t z, int16_t a,
|
||||||
fov = pr_hudfov;
|
fov = pr_hudfov;
|
||||||
#endif
|
#endif
|
||||||
if (fov != -1)
|
if (fov != -1)
|
||||||
f = 1.f/tanf(((float)fov * 2.56f) * ((.5f * PI) * (1.0f/2048.f)));
|
f = 1.f/tanf(((float)fov * 2.56f) * ((.5f * (float)PI) * (1.0f/2048.f)));
|
||||||
|
|
||||||
m[0][0] = f*fydimen; m[0][2] = 1.f;
|
m[0][0] = f*fydimen; m[0][2] = 1.f;
|
||||||
m[1][1] = f*fxdimen; m[1][2] = 1.f;
|
m[1][1] = f*fxdimen; m[1][2] = 1.f;
|
||||||
|
@ -5617,7 +5617,7 @@ int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t ba
|
||||||
static int32_t gltexturemode(const osdfuncparm_t *parm)
|
static int32_t gltexturemode(const osdfuncparm_t *parm)
|
||||||
{
|
{
|
||||||
int32_t m;
|
int32_t m;
|
||||||
const char *p;
|
char *p;
|
||||||
|
|
||||||
if (parm->numparms != 1)
|
if (parm->numparms != 1)
|
||||||
{
|
{
|
||||||
|
@ -5629,7 +5629,7 @@ static int32_t gltexturemode(const osdfuncparm_t *parm)
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
m = Bstrtoul(parm->parms[0], (char **)&p, 10);
|
m = Bstrtoul(parm->parms[0], &p, 10);
|
||||||
if (p == parm->parms[0])
|
if (p == parm->parms[0])
|
||||||
{
|
{
|
||||||
// string
|
// string
|
||||||
|
|
|
@ -461,7 +461,7 @@ static const char * texcache_calcid(char *cachefn, const char *fn, const int32_t
|
||||||
Bstrcat(id.name, fn);
|
Bstrcat(id.name, fn);
|
||||||
|
|
||||||
Bsprintf(cachefn, "%08x%08x%08x",
|
Bsprintf(cachefn, "%08x%08x%08x",
|
||||||
XXH32((uint8_t *)fn, Bstrlen(fn), TEXCACHEMAGIC[3]),
|
XXH32((uint8_t const *)fn, Bstrlen(fn), TEXCACHEMAGIC[3]),
|
||||||
XXH32((uint8_t *)id.name, Bstrlen(id.name), TEXCACHEMAGIC[3]),
|
XXH32((uint8_t *)id.name, Bstrlen(id.name), TEXCACHEMAGIC[3]),
|
||||||
XXH32((uint8_t *)&id, sizeof(struct texcacheid_t), TEXCACHEMAGIC[3]));
|
XXH32((uint8_t *)&id, sizeof(struct texcacheid_t), TEXCACHEMAGIC[3]));
|
||||||
|
|
||||||
|
|
|
@ -5584,7 +5584,7 @@ static void MaybeTrainKillPlayer(const spritetype *s, int32_t dosetopos)
|
||||||
|
|
||||||
ps->cursectnum = s->sectnum;
|
ps->cursectnum = s->sectnum;
|
||||||
|
|
||||||
setsprite(ps->i,(vec3_t *)s);
|
setsprite(ps->i,(vec3_t const *)s);
|
||||||
P_QuickKill(ps);
|
P_QuickKill(ps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -384,7 +384,7 @@ static int32_t texuploaded;
|
||||||
// YUV->RGB conversion fragment shader adapted from
|
// YUV->RGB conversion fragment shader adapted from
|
||||||
// http://www.fourcc.org/fccyvrgb.php: "Want some sample code?"
|
// http://www.fourcc.org/fccyvrgb.php: "Want some sample code?"
|
||||||
// direct link: http://www.fourcc.org/source/YUV420P-OpenGL-GLSLang.c
|
// direct link: http://www.fourcc.org/source/YUV420P-OpenGL-GLSLang.c
|
||||||
static char *fragprog_src =
|
static const char *fragprog_src =
|
||||||
"#version 120\n"
|
"#version 120\n"
|
||||||
|
|
||||||
"uniform sampler2D tex;\n"
|
"uniform sampler2D tex;\n"
|
||||||
|
|
|
@ -8042,7 +8042,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
|
||||||
|
|
||||||
while (i < argc)
|
while (i < argc)
|
||||||
{
|
{
|
||||||
c = (char *)argv[i];
|
c = argv[i];
|
||||||
|
|
||||||
if ((*c == '-')
|
if ((*c == '-')
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
|
@ -417,7 +417,7 @@ static inline int32_t G_GetTeamPalette(int32_t team)
|
||||||
|
|
||||||
#define minitextshade(x, y, t, s, p, sb) minitext_(x,y,t,s,p,sb)
|
#define minitextshade(x, y, t, s, p, sb) minitext_(x,y,t,s,p,sb)
|
||||||
#define minitext(x, y, t, p, sb) minitext_(x,y,t,0,p,sb)
|
#define minitext(x, y, t, p, sb) minitext_(x,y,t,0,p,sb)
|
||||||
#define menutext(x,y,s,p,t) menutext_(x,y,s,p,(char *)OSD_StripColors(menutextbuf,t),10+16)
|
#define menutext(x,y,s,p,t) menutext_(x,y,s,p,OSD_StripColors(menutextbuf,t),10+16)
|
||||||
#define gametext(x,y,t,s,dabits) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536, 0)
|
#define gametext(x,y,t,s,dabits) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536, 0)
|
||||||
#define gametextscaled(x,y,t,s,dabits) G_PrintGameText(1,STARTALPHANUM, x,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536, 0)
|
#define gametextscaled(x,y,t,s,dabits) G_PrintGameText(1,STARTALPHANUM, x,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536, 0)
|
||||||
#define gametextpal(x,y,t,s,p) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,p,26,0, 0, xdim-1, ydim-1, 65536, 0)
|
#define gametextpal(x,y,t,s,p) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,p,26,0, 0, xdim-1, ydim-1, 65536, 0)
|
||||||
|
|
|
@ -93,7 +93,7 @@ enum
|
||||||
};
|
};
|
||||||
|
|
||||||
#if !defined LUNATIC
|
#if !defined LUNATIC
|
||||||
static const char *C_GetLabelType(int32_t type)
|
static char *C_GetLabelType(int32_t type)
|
||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
char x[64];
|
char x[64];
|
||||||
|
@ -1954,7 +1954,7 @@ static int32_t C_GetNextValue(int32_t type)
|
||||||
{
|
{
|
||||||
if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1)
|
if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1)
|
||||||
{
|
{
|
||||||
char *gl = (char *)C_GetLabelType(labeltype[i]);
|
char *gl = C_GetLabelType(labeltype[i]);
|
||||||
initprintf("%s:%d: debug: %s label `%s'.\n",g_szScriptFileName,g_lineNumber,gl,label+(i<<6));
|
initprintf("%s:%d: debug: %s label `%s'.\n",g_szScriptFileName,g_lineNumber,gl,label+(i<<6));
|
||||||
Bfree(gl);
|
Bfree(gl);
|
||||||
}
|
}
|
||||||
|
@ -1969,8 +1969,8 @@ static int32_t C_GetNextValue(int32_t type)
|
||||||
BITPTR_CLEAR(g_scriptPtr-script);
|
BITPTR_CLEAR(g_scriptPtr-script);
|
||||||
*(g_scriptPtr++) = 0;
|
*(g_scriptPtr++) = 0;
|
||||||
textptr += l;
|
textptr += l;
|
||||||
char *el = (char *)C_GetLabelType(type);
|
char *el = C_GetLabelType(type);
|
||||||
char *gl = (char *)C_GetLabelType(labeltype[i]);
|
char *gl = C_GetLabelType(labeltype[i]);
|
||||||
C_ReportError(-1);
|
C_ReportError(-1);
|
||||||
initprintf("%s:%d: warning: expected %s, found %s.\n",g_szScriptFileName,g_lineNumber,el,gl);
|
initprintf("%s:%d: warning: expected %s, found %s.\n",g_szScriptFileName,g_lineNumber,el,gl);
|
||||||
g_numCompilerWarnings++;
|
g_numCompilerWarnings++;
|
||||||
|
@ -6162,7 +6162,7 @@ void C_Compile(const char *filenam)
|
||||||
|
|
||||||
C_InitProjectiles();
|
C_InitProjectiles();
|
||||||
|
|
||||||
int32_t fp = kopen4loadfrommod((char *)filenam,g_loadFromGroupOnly);
|
int32_t fp = kopen4loadfrommod(filenam,g_loadFromGroupOnly);
|
||||||
|
|
||||||
if (fp == -1) // JBF: was 0
|
if (fp == -1) // JBF: was 0
|
||||||
{
|
{
|
||||||
|
|
|
@ -142,7 +142,7 @@ G_EXTERN sound_t g_sounds[MAXSOUNDS];
|
||||||
G_EXTERN uint32_t everyothertime;
|
G_EXTERN uint32_t everyothertime;
|
||||||
G_EXTERN uint32_t g_moveThingsCount;
|
G_EXTERN uint32_t g_moveThingsCount;
|
||||||
G_EXTERN vec3_t my,omy,myvel;
|
G_EXTERN vec3_t my,omy,myvel;
|
||||||
G_EXTERN volatile char g_soundlocks[MAXSOUNDS];
|
G_EXTERN char g_soundlocks[MAXSOUNDS];
|
||||||
G_EXTERN int32_t g_restorePalette;
|
G_EXTERN int32_t g_restorePalette;
|
||||||
G_EXTERN int32_t g_screenCapture;
|
G_EXTERN int32_t g_screenCapture;
|
||||||
G_EXTERN int32_t g_noEnemies;
|
G_EXTERN int32_t g_noEnemies;
|
||||||
|
|
|
@ -84,7 +84,7 @@ typedef struct VoiceNode
|
||||||
const int16_t *LeftVolume;
|
const int16_t *LeftVolume;
|
||||||
const int16_t *RightVolume;
|
const int16_t *RightVolume;
|
||||||
|
|
||||||
const void *rawdataptr;
|
void *rawdataptr;
|
||||||
|
|
||||||
const char *NextBlock;
|
const char *NextBlock;
|
||||||
const char *LoopStart;
|
const char *LoopStart;
|
||||||
|
|
|
@ -80,7 +80,7 @@ static playbackstatus MV_GetNextVOCBlock(VoiceNode *voice)
|
||||||
return KeepPlaying;
|
return KeepPlaying;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint8_t *ptr = (uint8_t *)voice->NextBlock;
|
const uint8_t *ptr = (uint8_t const *)voice->NextBlock;
|
||||||
|
|
||||||
voice->Playing = TRUE;
|
voice->Playing = TRUE;
|
||||||
voice->Paused = FALSE;
|
voice->Paused = FALSE;
|
||||||
|
@ -186,7 +186,7 @@ end_of_data:
|
||||||
// Repeat begin
|
// Repeat begin
|
||||||
if (voice->LoopEnd == NULL)
|
if (voice->LoopEnd == NULL)
|
||||||
{
|
{
|
||||||
voice->LoopCount = LITTLE16(*(uint16_t *)ptr);
|
voice->LoopCount = LITTLE16(*(uint16_t const *)ptr);
|
||||||
voice->LoopStart = (char *)((intptr_t) ptr + blocklength);
|
voice->LoopStart = (char *)((intptr_t) ptr + blocklength);
|
||||||
}
|
}
|
||||||
ptr += blocklength;
|
ptr += blocklength;
|
||||||
|
@ -201,7 +201,7 @@ end_of_data:
|
||||||
{
|
{
|
||||||
if ((voice->LoopCount > 0) && (voice->LoopStart != NULL))
|
if ((voice->LoopCount > 0) && (voice->LoopStart != NULL))
|
||||||
{
|
{
|
||||||
ptr = (uint8_t *) voice->LoopStart;
|
ptr = (uint8_t const *) voice->LoopStart;
|
||||||
|
|
||||||
if (voice->LoopCount < 0xffff)
|
if (voice->LoopCount < 0xffff)
|
||||||
{
|
{
|
||||||
|
@ -216,7 +216,7 @@ end_of_data:
|
||||||
// Extended block
|
// Extended block
|
||||||
voice->bits = 8;
|
voice->bits = 8;
|
||||||
voice->channels = 1;
|
voice->channels = 1;
|
||||||
tc = LITTLE16(*(uint16_t *)ptr);
|
tc = LITTLE16(*(uint16_t const *)ptr);
|
||||||
packtype = *(ptr + 2);
|
packtype = *(ptr + 2);
|
||||||
voicemode = *(ptr + 3);
|
voicemode = *(ptr + 3);
|
||||||
ptr += blocklength;
|
ptr += blocklength;
|
||||||
|
@ -224,10 +224,10 @@ end_of_data:
|
||||||
|
|
||||||
case 9 :
|
case 9 :
|
||||||
// New sound data block
|
// New sound data block
|
||||||
samplespeed = LITTLE32(*(uint32_t *)ptr);
|
samplespeed = LITTLE32(*(uint32_t const *)ptr);
|
||||||
BitsPerSample = (unsigned)*(ptr + 4);
|
BitsPerSample = (unsigned)*(ptr + 4);
|
||||||
Channels = (unsigned)*(ptr + 5);
|
Channels = (unsigned)*(ptr + 5);
|
||||||
Format = (unsigned)LITTLE16(*(uint16_t *)(ptr + 6));
|
Format = (unsigned)LITTLE16(*(uint16_t const *)(ptr + 6));
|
||||||
|
|
||||||
if ((BitsPerSample == 8) && (Channels == 1 || Channels == 2) && (Format == VOC_8BIT))
|
if ((BitsPerSample == 8) && (Channels == 1 || Channels == 2) && (Format == VOC_8BIT))
|
||||||
{
|
{
|
||||||
|
@ -271,8 +271,8 @@ end_of_data:
|
||||||
|
|
||||||
if (voice->Playing)
|
if (voice->Playing)
|
||||||
{
|
{
|
||||||
voice->NextBlock = (char *)ptr + blocklength;
|
voice->NextBlock = (char const *)ptr + blocklength;
|
||||||
voice->sound = (char *)ptr;
|
voice->sound = (char const *)ptr;
|
||||||
|
|
||||||
// CODEDUP multivoc.c MV_SetVoicePitch
|
// CODEDUP multivoc.c MV_SetVoicePitch
|
||||||
voice->SamplingRate = samplespeed;
|
voice->SamplingRate = samplespeed;
|
||||||
|
|
|
@ -193,7 +193,7 @@ static wavefmt_t FX_AutoDetectFormat(const char *ptr, uint32_t length)
|
||||||
if (length < 12)
|
if (length < 12)
|
||||||
return fmt;
|
return fmt;
|
||||||
|
|
||||||
switch (LITTLE32(*(int32_t *)ptr))
|
switch (LITTLE32(*(int32_t const *)ptr))
|
||||||
{
|
{
|
||||||
case 'C' + ('r' << 8) + ('e' << 16) + ('a' << 24): // Crea
|
case 'C' + ('r' << 8) + ('e' << 16) + ('a' << 24): // Crea
|
||||||
fmt = FMT_VOC;
|
fmt = FMT_VOC;
|
||||||
|
@ -202,7 +202,7 @@ static wavefmt_t FX_AutoDetectFormat(const char *ptr, uint32_t length)
|
||||||
fmt = FMT_VORBIS;
|
fmt = FMT_VORBIS;
|
||||||
break;
|
break;
|
||||||
case 'R' + ('I' << 8) + ('F' << 16) + ('F' << 24): // RIFF
|
case 'R' + ('I' << 8) + ('F' << 16) + ('F' << 24): // RIFF
|
||||||
switch (LITTLE32(*(int32_t *)(ptr + 8)))
|
switch (LITTLE32(*(int32_t const *)(ptr + 8)))
|
||||||
{
|
{
|
||||||
case 'C' + ('D' << 8) + ('X' << 16) + ('A' << 24): // CDXA
|
case 'C' + ('D' << 8) + ('X' << 16) + ('A' << 24): // CDXA
|
||||||
fmt = FMT_XA;
|
fmt = FMT_XA;
|
||||||
|
@ -214,7 +214,7 @@ static wavefmt_t FX_AutoDetectFormat(const char *ptr, uint32_t length)
|
||||||
fmt = FMT_FLAC;
|
fmt = FMT_FLAC;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
switch (LITTLE32(*(int32_t *)(ptr + 8)))
|
switch (LITTLE32(*(int32_t const *)(ptr + 8)))
|
||||||
{
|
{
|
||||||
case 'W' + ('A' << 8) + ('V' << 16) + ('E' << 24): // WAVE
|
case 'W' + ('A' << 8) + ('V' << 16) + ('E' << 24): // WAVE
|
||||||
fmt = FMT_WAV;
|
fmt = FMT_WAV;
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
// 8-bit mono source, 16-bit mono output
|
// 8-bit mono source, 16-bit mono output
|
||||||
void MV_Mix16BitMono(uint32_t position, uint32_t rate, const char *start, uint32_t length)
|
void MV_Mix16BitMono(uint32_t position, uint32_t rate, const char *start, uint32_t length)
|
||||||
{
|
{
|
||||||
uint8_t const * const source = (uint8_t *) start;
|
uint8_t const * const source = (uint8_t const *) start;
|
||||||
int16_t *dest = (int16_t *) MV_MixDestination;
|
int16_t *dest = (int16_t *) MV_MixDestination;
|
||||||
int32_t sample0;
|
int32_t sample0;
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ void MV_Mix16BitMono(uint32_t position, uint32_t rate, const char *start, uint32
|
||||||
// 8-bit mono source, 16-bit stereo output
|
// 8-bit mono source, 16-bit stereo output
|
||||||
void MV_Mix16BitStereo(uint32_t position, uint32_t rate, const char *start, uint32_t length)
|
void MV_Mix16BitStereo(uint32_t position, uint32_t rate, const char *start, uint32_t length)
|
||||||
{
|
{
|
||||||
uint8_t const * const source = (uint8_t *) start;
|
uint8_t const * const source = (uint8_t const *) start;
|
||||||
int16_t *dest = (int16_t *) MV_MixDestination;
|
int16_t *dest = (int16_t *) MV_MixDestination;
|
||||||
int32_t sample0, sample1;
|
int32_t sample0, sample1;
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ void MV_Mix16BitStereo(uint32_t position, uint32_t rate, const char *start, uint
|
||||||
// 16-bit mono source, 16-bit mono output
|
// 16-bit mono source, 16-bit mono output
|
||||||
void MV_Mix16BitMono16(uint32_t position, uint32_t rate, const char *start, uint32_t length)
|
void MV_Mix16BitMono16(uint32_t position, uint32_t rate, const char *start, uint32_t length)
|
||||||
{
|
{
|
||||||
uint16_t const * const source = (uint16_t *) start;
|
uint16_t const * const source = (uint16_t const *) start;
|
||||||
int16_t *dest = (int16_t *) MV_MixDestination;
|
int16_t *dest = (int16_t *) MV_MixDestination;
|
||||||
int32_t sample0l, sample0h, sample0;
|
int32_t sample0l, sample0h, sample0;
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ void MV_Mix16BitMono16(uint32_t position, uint32_t rate, const char *start, uint
|
||||||
// 16-bit mono source, 16-bit stereo output
|
// 16-bit mono source, 16-bit stereo output
|
||||||
void MV_Mix16BitStereo16(uint32_t position, uint32_t rate, const char *start, uint32_t length)
|
void MV_Mix16BitStereo16(uint32_t position, uint32_t rate, const char *start, uint32_t length)
|
||||||
{
|
{
|
||||||
uint16_t const * const source = (uint16_t *) start;
|
uint16_t const * const source = (uint16_t const *) start;
|
||||||
int16_t *dest = (int16_t *) MV_MixDestination;
|
int16_t *dest = (int16_t *) MV_MixDestination;
|
||||||
int32_t sample0l, sample0h, sample0;
|
int32_t sample0l, sample0h, sample0;
|
||||||
int32_t sample1l, sample1h, sample1;
|
int32_t sample1l, sample1h, sample1;
|
||||||
|
@ -159,7 +159,7 @@ void MV_Mix16BitStereo16(uint32_t position, uint32_t rate, const char *start, ui
|
||||||
|
|
||||||
void MV_16BitReverb(char const *src, char *dest, int16_t *volume, int32_t count)
|
void MV_16BitReverb(char const *src, char *dest, int16_t *volume, int32_t count)
|
||||||
{
|
{
|
||||||
uint16_t const * input = (uint16_t *) src;
|
uint16_t const * input = (uint16_t const *) src;
|
||||||
int16_t * output = (int16_t *) dest;
|
int16_t * output = (int16_t *) dest;
|
||||||
int16_t sample0l, sample0h, sample0;
|
int16_t sample0l, sample0h, sample0;
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
// 8-bit stereo source, 16-bit mono output
|
// 8-bit stereo source, 16-bit mono output
|
||||||
void MV_Mix16BitMono8Stereo(uint32_t position, uint32_t rate, const char *start, uint32_t length)
|
void MV_Mix16BitMono8Stereo(uint32_t position, uint32_t rate, const char *start, uint32_t length)
|
||||||
{
|
{
|
||||||
uint8_t const * const source = (uint8_t *) start;
|
uint8_t const * const source = (uint8_t const *) start;
|
||||||
int16_t *dest = (int16_t *) MV_MixDestination;
|
int16_t *dest = (int16_t *) MV_MixDestination;
|
||||||
int32_t sample0, sample1;
|
int32_t sample0, sample1;
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ void MV_Mix16BitMono8Stereo(uint32_t position, uint32_t rate, const char *start,
|
||||||
// 8-bit stereo source, 16-bit stereo output
|
// 8-bit stereo source, 16-bit stereo output
|
||||||
void MV_Mix16BitStereo8Stereo(uint32_t position, uint32_t rate, const char *start, uint32_t length)
|
void MV_Mix16BitStereo8Stereo(uint32_t position, uint32_t rate, const char *start, uint32_t length)
|
||||||
{
|
{
|
||||||
uint8_t const * const source = (uint8_t *) start;
|
uint8_t const * const source = (uint8_t const *) start;
|
||||||
int16_t *dest = (int16_t *) MV_MixDestination;
|
int16_t *dest = (int16_t *) MV_MixDestination;
|
||||||
int32_t sample0, sample1;
|
int32_t sample0, sample1;
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ void MV_Mix16BitStereo8Stereo(uint32_t position, uint32_t rate, const char *star
|
||||||
// 16-bit stereo source, 16-bit mono output
|
// 16-bit stereo source, 16-bit mono output
|
||||||
void MV_Mix16BitMono16Stereo(uint32_t position, uint32_t rate, const char *start, uint32_t length)
|
void MV_Mix16BitMono16Stereo(uint32_t position, uint32_t rate, const char *start, uint32_t length)
|
||||||
{
|
{
|
||||||
uint16_t const * const source = (uint16_t *) start;
|
uint16_t const * const source = (uint16_t const *) start;
|
||||||
int16_t *dest = (int16_t *) MV_MixDestination;
|
int16_t *dest = (int16_t *) MV_MixDestination;
|
||||||
int32_t sample0l, sample0h, sample0;
|
int32_t sample0l, sample0h, sample0;
|
||||||
int32_t sample1l, sample1h, sample1;
|
int32_t sample1l, sample1h, sample1;
|
||||||
|
@ -131,7 +131,7 @@ void MV_Mix16BitMono16Stereo(uint32_t position, uint32_t rate, const char *start
|
||||||
// 16-bit stereo source, 16-bit stereo output
|
// 16-bit stereo source, 16-bit stereo output
|
||||||
void MV_Mix16BitStereo16Stereo(uint32_t position, uint32_t rate, const char *start, uint32_t length)
|
void MV_Mix16BitStereo16Stereo(uint32_t position, uint32_t rate, const char *start, uint32_t length)
|
||||||
{
|
{
|
||||||
uint16_t const * const source = (uint16_t *) start;
|
uint16_t const * const source = (uint16_t const *) start;
|
||||||
int16_t *dest = (int16_t *) MV_MixDestination;
|
int16_t *dest = (int16_t *) MV_MixDestination;
|
||||||
int32_t sample0l, sample0h, sample0;
|
int32_t sample0l, sample0h, sample0;
|
||||||
int32_t sample1l, sample1h, sample1;
|
int32_t sample1l, sample1h, sample1;
|
||||||
|
|
|
@ -89,7 +89,7 @@ typedef struct
|
||||||
lp_descriptor * curlp; // header of large page currently in memory
|
lp_descriptor * curlp; // header of large page currently in memory
|
||||||
uint16_t * thepage; // buffer where current large page is loaded
|
uint16_t * thepage; // buffer where current large page is loaded
|
||||||
uint8_t imagebuffer[IMAGEBUFFERSIZE]; // buffer where anim frame is decoded
|
uint8_t imagebuffer[IMAGEBUFFERSIZE]; // buffer where anim frame is decoded
|
||||||
const uint8_t * buffer;
|
uint8_t * buffer;
|
||||||
uint8_t pal[768];
|
uint8_t pal[768];
|
||||||
int32_t currentframe;
|
int32_t currentframe;
|
||||||
} anim_t;
|
} anim_t;
|
||||||
|
@ -255,7 +255,7 @@ static inline void drawframe(uint16_t framenumber)
|
||||||
}
|
}
|
||||||
|
|
||||||
// <length> is the file size, for consistency checking.
|
// <length> is the file size, for consistency checking.
|
||||||
int32_t ANIM_LoadAnim(const uint8_t *buffer, int32_t length)
|
int32_t ANIM_LoadAnim(uint8_t *buffer, int32_t length)
|
||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ extern "C" {
|
||||||
//
|
//
|
||||||
//****************************************************************************
|
//****************************************************************************
|
||||||
|
|
||||||
int32_t ANIM_LoadAnim(const uint8_t *buffer, int32_t length);
|
int32_t ANIM_LoadAnim(uint8_t *buffer, int32_t length);
|
||||||
|
|
||||||
//****************************************************************************
|
//****************************************************************************
|
||||||
//
|
//
|
||||||
|
|
|
@ -116,7 +116,7 @@ static const char *LabelTypeText[] =
|
||||||
"event"
|
"event"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *C_GetLabelType(int32_t type)
|
static char *C_GetLabelType(int32_t type)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
char x[64];
|
char x[64];
|
||||||
|
@ -1457,8 +1457,8 @@ static int32_t C_GetNextValue(int32_t type)
|
||||||
*(g_scriptPtr++) = 0;
|
*(g_scriptPtr++) = 0;
|
||||||
textptr += l;
|
textptr += l;
|
||||||
|
|
||||||
el = (char *)C_GetLabelType(type);
|
el = C_GetLabelType(type);
|
||||||
gl = (char *)C_GetLabelType(labeltype[i]);
|
gl = C_GetLabelType(labeltype[i]);
|
||||||
C_CUSTOMERROR("expected %s, found %s.", el, gl);
|
C_CUSTOMERROR("expected %s, found %s.", el, gl);
|
||||||
// initprintf("i=%d, %s!!! lt:%d t:%d\n", i, label+(i*MAXLABELLEN), labeltype[i], type);
|
// initprintf("i=%d, %s!!! lt:%d t:%d\n", i, label+(i*MAXLABELLEN), labeltype[i], type);
|
||||||
Bfree(el);
|
Bfree(el);
|
||||||
|
|
|
@ -226,13 +226,13 @@ static inline void __fastcall VM_DoConditional(register int32_t condition)
|
||||||
|
|
||||||
static int X_DoSortDefault(const void *lv, const void *rv)
|
static int X_DoSortDefault(const void *lv, const void *rv)
|
||||||
{
|
{
|
||||||
return *(int32_t *)rv - *(int32_t *)lv;
|
return *(int32_t const *)rv - *(int32_t const *)lv;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int X_DoSort(const void *lv, const void *rv)
|
static int X_DoSort(const void *lv, const void *rv)
|
||||||
{
|
{
|
||||||
m32_sortvar1 = *(int32_t *)lv;
|
m32_sortvar1 = *(int32_t const *)lv;
|
||||||
m32_sortvar2 = *(int32_t *)rv;
|
m32_sortvar2 = *(int32_t const *)rv;
|
||||||
insptr = x_sortingstateptr;
|
insptr = x_sortingstateptr;
|
||||||
VM_Execute(0);
|
VM_Execute(0);
|
||||||
return g_iReturnVar;
|
return g_iReturnVar;
|
||||||
|
|
|
@ -100,7 +100,7 @@ static void creditsminitext(int32_t x, int32_t y, const char *t, int32_t p)
|
||||||
G_ScreenTextShadow(1, 1, MINIFONT, x, y, 65536, 0, 0, t, 0, p, 2|8|16|ROTATESPRITE_FULL16, 0, 4<<16, 8<<16, 1<<16, 0, f, 0, 0, xdim-1, ydim-1);
|
G_ScreenTextShadow(1, 1, MINIFONT, x, y, 65536, 0, 0, t, 0, p, 2|8|16|ROTATESPRITE_FULL16, 0, 4<<16, 8<<16, 1<<16, 0, f, 0, 0, xdim-1, ydim-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t menutext_(int32_t x, int32_t y, int32_t s, int32_t p, char *t, int32_t bits)
|
int32_t menutext_(int32_t x, int32_t y, int32_t s, int32_t p, char const *t, int32_t bits)
|
||||||
{
|
{
|
||||||
vec2_t dim;
|
vec2_t dim;
|
||||||
int32_t f = TEXT_BIGALPHANUM|TEXT_UPPERCASE|TEXT_LITERALESCAPE;
|
int32_t f = TEXT_BIGALPHANUM|TEXT_UPPERCASE|TEXT_LITERALESCAPE;
|
||||||
|
|
|
@ -418,7 +418,7 @@ extern Menu_t *m_currentMenu;
|
||||||
extern int32_t g_lastSaveSlot;
|
extern int32_t g_lastSaveSlot;
|
||||||
extern int32_t g_quitDeadline;
|
extern int32_t g_quitDeadline;
|
||||||
extern int32_t voting;
|
extern int32_t voting;
|
||||||
int32_t menutext_(int32_t x,int32_t y,int32_t s,int32_t p,char *t,int32_t bits);
|
int32_t menutext_(int32_t x,int32_t y,int32_t s,int32_t p,char const *t,int32_t bits);
|
||||||
int M_ChangeMenu(int32_t cm);
|
int M_ChangeMenu(int32_t cm);
|
||||||
void M_ChangeMenuAnimate(int32_t cm, MenuAnimationType_t animtype);
|
void M_ChangeMenuAnimate(int32_t cm, MenuAnimationType_t animtype);
|
||||||
int32_t M_IsTextInput(Menu_t *cm);
|
int32_t M_IsTextInput(Menu_t *cm);
|
||||||
|
|
|
@ -1109,7 +1109,7 @@ void Net_ReceiveMapUpdate(ENetEvent *event)
|
||||||
|
|
||||||
static int Net_CompareActors(const void *actor1, const void *actor2)
|
static int Net_CompareActors(const void *actor1, const void *actor2)
|
||||||
{
|
{
|
||||||
return ((netactor_t *)actor1)->netIndex - ((netactor_t *)actor2)->netIndex;
|
return ((netactor_t const *)actor1)->netIndex - ((netactor_t const *)actor2)->netIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Net_SaveMapState(netmapstate_t *save)
|
void Net_SaveMapState(netmapstate_t *save)
|
||||||
|
|
|
@ -47,7 +47,7 @@ static int32_t RTS_AddFile(const char *filename)
|
||||||
// read the entire file in
|
// read the entire file in
|
||||||
// FIXME: shared opens
|
// FIXME: shared opens
|
||||||
|
|
||||||
handle = kopen4loadfrommod((char *)filename, 0);
|
handle = kopen4loadfrommod(filename, 0);
|
||||||
if (handle < 0)
|
if (handle < 0)
|
||||||
{
|
{
|
||||||
initprintf("RTS file \"%s\" was not found\n",filename);
|
initprintf("RTS file \"%s\" was not found\n",filename);
|
||||||
|
|
|
@ -505,11 +505,19 @@ void G_SavePlayerMaybeMulti(int32_t slot)
|
||||||
typedef struct dataspec_
|
typedef struct dataspec_
|
||||||
{
|
{
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
void *ptr;
|
void * const ptr;
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
intptr_t cnt;
|
intptr_t cnt;
|
||||||
} dataspec_t;
|
} dataspec_t;
|
||||||
|
|
||||||
|
typedef struct dataspec_gv_
|
||||||
|
{
|
||||||
|
uint32_t flags;
|
||||||
|
void * ptr;
|
||||||
|
uint32_t size;
|
||||||
|
intptr_t cnt;
|
||||||
|
} dataspec_gv_t;
|
||||||
|
|
||||||
#define SV_DEFAULTCOMPRTHRES 8
|
#define SV_DEFAULTCOMPRTHRES 8
|
||||||
static uint8_t savegame_diffcompress; // 0:none, 1:Ken's LZW in cache1d.c
|
static uint8_t savegame_diffcompress; // 0:none, 1:Ken's LZW in cache1d.c
|
||||||
static uint8_t savegame_comprthres;
|
static uint8_t savegame_comprthres;
|
||||||
|
@ -690,7 +698,8 @@ static int32_t readspecdata(const dataspec_t *spec, int32_t fil, uint8_t **dumpv
|
||||||
|
|
||||||
#define UINT(bits) uint##bits##_t
|
#define UINT(bits) uint##bits##_t
|
||||||
#define BYTES(bits) (bits>>3)
|
#define BYTES(bits) (bits>>3)
|
||||||
#define VAL(bits,p) (*(UINT(bits) *)(p))
|
#define VAL(bits,p) (*(UINT(bits) const *)(p))
|
||||||
|
#define WVAL(bits,p) (*(UINT(bits) *)(p))
|
||||||
|
|
||||||
static void docmpsd(const void *ptr, void *dump, uint32_t size, uint32_t cnt, uint8_t **diffvar)
|
static void docmpsd(const void *ptr, void *dump, uint32_t size, uint32_t cnt, uint8_t **diffvar)
|
||||||
{
|
{
|
||||||
|
@ -700,7 +709,7 @@ static void docmpsd(const void *ptr, void *dump, uint32_t size, uint32_t cnt, ui
|
||||||
#define CPSINGLEVAL(Datbits) \
|
#define CPSINGLEVAL(Datbits) \
|
||||||
if (VAL(Datbits, ptr) != VAL(Datbits, dump)) \
|
if (VAL(Datbits, ptr) != VAL(Datbits, dump)) \
|
||||||
{ \
|
{ \
|
||||||
VAL(Datbits, retdiff) = VAL(Datbits, dump) = VAL(Datbits, ptr); \
|
WVAL(Datbits, retdiff) = WVAL(Datbits, dump) = VAL(Datbits, ptr); \
|
||||||
*diffvar = retdiff+BYTES(Datbits); \
|
*diffvar = retdiff+BYTES(Datbits); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -720,21 +729,21 @@ static void docmpsd(const void *ptr, void *dump, uint32_t size, uint32_t cnt, ui
|
||||||
if (*p!=*op) \
|
if (*p!=*op) \
|
||||||
{ \
|
{ \
|
||||||
*op = *p; \
|
*op = *p; \
|
||||||
VAL(Idxbits, retdiff) = i; \
|
WVAL(Idxbits, retdiff) = i; \
|
||||||
retdiff += BYTES(Idxbits); \
|
retdiff += BYTES(Idxbits); \
|
||||||
VAL(Datbits, retdiff) = *p; \
|
WVAL(Datbits, retdiff) = *p; \
|
||||||
retdiff += BYTES(Datbits); \
|
retdiff += BYTES(Datbits); \
|
||||||
} \
|
} \
|
||||||
p++; \
|
p++; \
|
||||||
op++; \
|
op++; \
|
||||||
} \
|
} \
|
||||||
VAL(Idxbits, retdiff) = -1; \
|
WVAL(Idxbits, retdiff) = -1; \
|
||||||
retdiff += BYTES(Idxbits); \
|
retdiff += BYTES(Idxbits); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define CPDATA(Datbits) do \
|
#define CPDATA(Datbits) do \
|
||||||
{ \
|
{ \
|
||||||
const UINT(Datbits) *p=(UINT(Datbits) *)ptr; \
|
const UINT(Datbits) *p=(UINT(Datbits) const *)ptr; \
|
||||||
UINT(Datbits) *op=(UINT(Datbits) *)dump; \
|
UINT(Datbits) *op=(UINT(Datbits) *)dump; \
|
||||||
uint32_t i, nelts=tabledivide32_noinline(size*cnt, BYTES(Datbits)); \
|
uint32_t i, nelts=tabledivide32_noinline(size*cnt, BYTES(Datbits)); \
|
||||||
if (nelts>65536) \
|
if (nelts>65536) \
|
||||||
|
@ -844,7 +853,7 @@ static int32_t applydiff(const dataspec_t *spec, uint8_t **dumpvar, uint8_t **di
|
||||||
|
|
||||||
// ----------
|
// ----------
|
||||||
#define CPSINGLEVAL(Datbits) \
|
#define CPSINGLEVAL(Datbits) \
|
||||||
VAL(Datbits, dumptr) = VAL(Datbits, diffptr); \
|
WVAL(Datbits, dumptr) = VAL(Datbits, diffptr); \
|
||||||
diffptr += BYTES(Datbits); \
|
diffptr += BYTES(Datbits); \
|
||||||
dumptr += BYTES(Datbits)
|
dumptr += BYTES(Datbits)
|
||||||
|
|
||||||
|
@ -983,9 +992,10 @@ static char(*savegame_quotes)[MAXQUOTELEN];
|
||||||
static char(*savegame_quoteredefs)[MAXQUOTELEN];
|
static char(*savegame_quoteredefs)[MAXQUOTELEN];
|
||||||
static uint8_t savegame_restdata[SVARDATALEN];
|
static uint8_t savegame_restdata[SVARDATALEN];
|
||||||
|
|
||||||
|
static char svgm_udnetw_string [] = "blK:udnt";
|
||||||
static const dataspec_t svgm_udnetw[] =
|
static const dataspec_t svgm_udnetw[] =
|
||||||
{
|
{
|
||||||
{ DS_STRING, (void *)"blK:udnt", 0, 1 },
|
{ DS_STRING, (void *)svgm_udnetw_string, 0, 1 },
|
||||||
{ 0, &ud.multimode, sizeof(ud.multimode), 1 },
|
{ 0, &ud.multimode, sizeof(ud.multimode), 1 },
|
||||||
{ 0, &g_numPlayerSprites, sizeof(g_numPlayerSprites), 1 },
|
{ 0, &g_numPlayerSprites, sizeof(g_numPlayerSprites), 1 },
|
||||||
{ 0, &g_playerSpawnPoints, sizeof(g_playerSpawnPoints), 1 },
|
{ 0, &g_playerSpawnPoints, sizeof(g_playerSpawnPoints), 1 },
|
||||||
|
@ -1031,9 +1041,10 @@ static const dataspec_t svgm_udnetw[] =
|
||||||
# define DS_MAINAR 0
|
# define DS_MAINAR 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static char svgm_secwsp_string [] = "blK:swsp";
|
||||||
static const dataspec_t svgm_secwsp[] =
|
static const dataspec_t svgm_secwsp[] =
|
||||||
{
|
{
|
||||||
{ DS_STRING, (void *)"blK:swsp", 0, 1 },
|
{ DS_STRING, (void *)svgm_secwsp_string, 0, 1 },
|
||||||
{ DS_NOCHK, &numwalls, sizeof(numwalls), 1 },
|
{ DS_NOCHK, &numwalls, sizeof(numwalls), 1 },
|
||||||
{ DS_MAINAR|DS_CNT(numwalls), &wall, sizeof(walltype), (intptr_t)&numwalls },
|
{ DS_MAINAR|DS_CNT(numwalls), &wall, sizeof(walltype), (intptr_t)&numwalls },
|
||||||
{ DS_NOCHK, &numsectors, sizeof(numsectors), 1 },
|
{ DS_NOCHK, &numsectors, sizeof(numsectors), 1 },
|
||||||
|
@ -1077,9 +1088,10 @@ static const dataspec_t svgm_secwsp[] =
|
||||||
{ DS_END, 0, 0, 0 }
|
{ DS_END, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static char svgm_script_string [] = "blK:scri";
|
||||||
static const dataspec_t svgm_script[] =
|
static const dataspec_t svgm_script[] =
|
||||||
{
|
{
|
||||||
{ DS_STRING, (void *)"blK:scri", 0, 1 },
|
{ DS_STRING, (void *)svgm_script_string, 0, 1 },
|
||||||
#if !defined LUNATIC
|
#if !defined LUNATIC
|
||||||
{ DS_NOCHK, &g_scriptSize, sizeof(g_scriptSize), 1 },
|
{ DS_NOCHK, &g_scriptSize, sizeof(g_scriptSize), 1 },
|
||||||
{ DS_SAVEFN|DS_LOADFN|DS_NOCHK, (void *)&sv_calcbitptrsize, 0, 1 },
|
{ DS_SAVEFN|DS_LOADFN|DS_NOCHK, (void *)&sv_calcbitptrsize, 0, 1 },
|
||||||
|
@ -1108,9 +1120,12 @@ static const dataspec_t svgm_script[] =
|
||||||
{ DS_END, 0, 0, 0 }
|
{ DS_END, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static char svgm_anmisc_string [] = "blK:anms";
|
||||||
|
static char svgm_end_string [] = "savegame_end";
|
||||||
|
|
||||||
static const dataspec_t svgm_anmisc[] =
|
static const dataspec_t svgm_anmisc[] =
|
||||||
{
|
{
|
||||||
{ DS_STRING, (void *)"blK:anms", 0, 1 },
|
{ DS_STRING, (void *)svgm_anmisc_string, 0, 1 },
|
||||||
{ 0, &g_animateCount, sizeof(g_animateCount), 1 },
|
{ 0, &g_animateCount, sizeof(g_animateCount), 1 },
|
||||||
{ 0, &animatesect[0], sizeof(animatesect[0]), MAXANIMATES },
|
{ 0, &animatesect[0], sizeof(animatesect[0]), MAXANIMATES },
|
||||||
{ 0, &animategoal[0], sizeof(animategoal[0]), MAXANIMATES },
|
{ 0, &animategoal[0], sizeof(animategoal[0]), MAXANIMATES },
|
||||||
|
@ -1151,12 +1166,12 @@ static const dataspec_t svgm_anmisc[] =
|
||||||
{ 0, savegame_restdata, 1, sizeof(savegame_restdata) }, // sz/cnt swapped for kdfread
|
{ 0, savegame_restdata, 1, sizeof(savegame_restdata) }, // sz/cnt swapped for kdfread
|
||||||
{ DS_LOADFN, (void *)&sv_restload, 0, 1 },
|
{ DS_LOADFN, (void *)&sv_restload, 0, 1 },
|
||||||
|
|
||||||
{ DS_STRING, (void *)"savegame_end", 0, 1 },
|
{ DS_STRING, (void *)svgm_end_string, 0, 1 },
|
||||||
{ DS_END, 0, 0, 0 }
|
{ DS_END, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
#if !defined LUNATIC
|
#if !defined LUNATIC
|
||||||
static dataspec_t *svgm_vars=NULL;
|
static dataspec_gv_t *svgm_vars=NULL;
|
||||||
#endif
|
#endif
|
||||||
static uint8_t *dosaveplayer2(FILE *fil, uint8_t *mem);
|
static uint8_t *dosaveplayer2(FILE *fil, uint8_t *mem);
|
||||||
static int32_t doloadplayer2(int32_t fil, uint8_t **memptr);
|
static int32_t doloadplayer2(int32_t fil, uint8_t **memptr);
|
||||||
|
@ -1186,7 +1201,7 @@ static void sv_makevarspec()
|
||||||
numsavedarrays += !(aGameArrays[i].dwFlags & GAMEARRAY_READONLY); // SYSTEM_GAMEARRAY
|
numsavedarrays += !(aGameArrays[i].dwFlags & GAMEARRAY_READONLY); // SYSTEM_GAMEARRAY
|
||||||
|
|
||||||
Bfree(svgm_vars);
|
Bfree(svgm_vars);
|
||||||
svgm_vars = (dataspec_t *)Xmalloc((numsavedvars+numsavedarrays+2)*sizeof(dataspec_t));
|
svgm_vars = (dataspec_gv_t *)Xmalloc((numsavedvars+numsavedarrays+2)*sizeof(dataspec_gv_t));
|
||||||
|
|
||||||
svgm_vars[0].flags = DS_STRING;
|
svgm_vars[0].flags = DS_STRING;
|
||||||
svgm_vars[0].ptr = magic;
|
svgm_vars[0].ptr = magic;
|
||||||
|
@ -1261,7 +1276,7 @@ int32_t sv_saveandmakesnapshot(FILE *fil, int8_t spot, int8_t recdiffsp, int8_t
|
||||||
// calculate total snapshot size
|
// calculate total snapshot size
|
||||||
#if !defined LUNATIC
|
#if !defined LUNATIC
|
||||||
sv_makevarspec();
|
sv_makevarspec();
|
||||||
svsnapsiz = calcsz(svgm_vars);
|
svsnapsiz = calcsz((const dataspec_t *)svgm_vars);
|
||||||
#else
|
#else
|
||||||
svsnapsiz = 0;
|
svsnapsiz = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1523,7 +1538,7 @@ uint32_t sv_writediff(FILE *fil)
|
||||||
cmpspecdata(svgm_script, &p, &d);
|
cmpspecdata(svgm_script, &p, &d);
|
||||||
cmpspecdata(svgm_anmisc, &p, &d);
|
cmpspecdata(svgm_anmisc, &p, &d);
|
||||||
#if !defined LUNATIC
|
#if !defined LUNATIC
|
||||||
cmpspecdata(svgm_vars, &p, &d);
|
cmpspecdata((const dataspec_t *)svgm_vars, &p, &d);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (p != svsnapshot+svsnapsiz)
|
if (p != svsnapshot+svsnapsiz)
|
||||||
|
@ -1570,7 +1585,7 @@ int32_t sv_readdiff(int32_t fil)
|
||||||
if (applydiff(svgm_script, &p, &d)) return -5;
|
if (applydiff(svgm_script, &p, &d)) return -5;
|
||||||
if (applydiff(svgm_anmisc, &p, &d)) return -6;
|
if (applydiff(svgm_anmisc, &p, &d)) return -6;
|
||||||
#if !defined LUNATIC
|
#if !defined LUNATIC
|
||||||
if (applydiff(svgm_vars, &p, &d)) return -7;
|
if (applydiff((const dataspec_t *)svgm_vars, &p, &d)) return -7;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (p!=svsnapshot+svsnapsiz)
|
if (p!=svsnapshot+svsnapsiz)
|
||||||
|
@ -1915,7 +1930,7 @@ static uint8_t *dosaveplayer2(FILE *fil, uint8_t *mem)
|
||||||
|
|
||||||
#if !defined LUNATIC
|
#if !defined LUNATIC
|
||||||
Gv_WriteSave(fil, 1); // gamevars
|
Gv_WriteSave(fil, 1); // gamevars
|
||||||
mem=writespecdata(svgm_vars, 0, mem);
|
mem=writespecdata((const dataspec_t *)svgm_vars, 0, mem);
|
||||||
PRINTSIZE("vars");
|
PRINTSIZE("vars");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2042,7 +2057,7 @@ int32_t sv_updatestate(int32_t frominit)
|
||||||
if (readspecdata(svgm_anmisc, -1, &p)) return -6;
|
if (readspecdata(svgm_anmisc, -1, &p)) return -6;
|
||||||
|
|
||||||
#if !defined LUNATIC
|
#if !defined LUNATIC
|
||||||
if (readspecdata(svgm_vars, -1, &p)) return -8;
|
if (readspecdata((const dataspec_t *)svgm_vars, -1, &p)) return -8;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (p != pbeg+svsnapsiz)
|
if (p != pbeg+svsnapsiz)
|
||||||
|
|
|
@ -277,19 +277,23 @@ void S_Cleanup(void)
|
||||||
// process from our own local copy of the delete queue so we don't hold the lock long
|
// process from our own local copy of the delete queue so we don't hold the lock long
|
||||||
mutex_lock(&s_mutex);
|
mutex_lock(&s_mutex);
|
||||||
|
|
||||||
if (!dnum)
|
uint32_t ldnum = dnum;
|
||||||
|
|
||||||
|
if (!ldnum)
|
||||||
{
|
{
|
||||||
mutex_unlock(&s_mutex);
|
mutex_unlock(&s_mutex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bmemcpy(ldq, (void *)dq, dnum * sizeof(int32_t));
|
|
||||||
|
|
||||||
uint32_t ldnum = dnum-1;
|
|
||||||
dnum = 0;
|
dnum = 0;
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < ldnum; i++)
|
||||||
|
ldq[i] = dq[i];
|
||||||
|
|
||||||
mutex_unlock(&s_mutex);
|
mutex_unlock(&s_mutex);
|
||||||
|
|
||||||
|
ldnum--;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
uint32_t num = ldq[ldnum];
|
uint32_t num = ldq[ldnum];
|
||||||
|
|
|
@ -76,7 +76,7 @@ typedef struct
|
||||||
char pr,m; // 2b
|
char pr,m; // 2b
|
||||||
} sound_t;
|
} sound_t;
|
||||||
|
|
||||||
extern volatile char g_soundlocks[MAXSOUNDS];
|
extern char g_soundlocks[MAXSOUNDS];
|
||||||
extern sound_t g_sounds[MAXSOUNDS];
|
extern sound_t g_sounds[MAXSOUNDS];
|
||||||
extern int32_t g_skillSoundVoice;
|
extern int32_t g_skillSoundVoice;
|
||||||
extern int32_t g_numEnvSoundsPlaying,g_maxSoundPos;
|
extern int32_t g_numEnvSoundsPlaying,g_maxSoundPos;
|
||||||
|
|
|
@ -40,7 +40,7 @@ typedef struct {
|
||||||
SOUNDOWNER SoundOwner[4];
|
SOUNDOWNER SoundOwner[4];
|
||||||
int16_t ps,pe,vo;
|
int16_t ps,pe,vo;
|
||||||
char pr,m;
|
char pr,m;
|
||||||
volatile char lock;
|
char lock;
|
||||||
char *definedname; // new
|
char *definedname; // new
|
||||||
} sound_t;
|
} sound_t;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue