Run engine source through new version of astyle, add printf() call to OSD_Printf() to facilitate console access through stdin/stdout for dedicated server mode, minor changes to sdlayer to allow operating without actually initializing SDL

git-svn-id: https://svn.eduke32.com/eduke32@1762 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2011-01-16 02:50:27 +00:00
parent 1579d2edd3
commit ef912658a0
24 changed files with 3513 additions and 3445 deletions

View file

@ -59,12 +59,12 @@ void setupslopevlin(int32_t logylogx, intptr_t bufplc, int32_t pinc)
}
void slopevlin(intptr_t p, int32_t i, intptr_t slopaloffs, int32_t cnt, int32_t bx, int32_t by)
{
intptr_t* slopalptr;
intptr_t *slopalptr;
int32_t bz, bzinc;
uint32_t u, v;
bz = asm3; bzinc = (asm1>>3);
slopalptr = (intptr_t*)slopaloffs;
slopalptr = (intptr_t *)slopaloffs;
for (; cnt>0; cnt--)
{
i = krecip(bz>>6); bz += bzinc;

View file

@ -279,7 +279,7 @@ static int32_t osdcmd_cvar_set_baselayer(const osdfuncparm_t *parm)
if (r != OSDCMD_OK) return r;
/*
/*
if (!Bstrcasecmp(parm->name, "r_scrcaptureformat"))
{
const char *fmts[] = {"TGA", "PCX"};
@ -313,17 +313,17 @@ int32_t baselayer_init(void)
cvar_t cvars_engine[] =
{
#ifdef SUPERBUILD
{ "r_usenewaspect","r_usenewaspect: enable/disable new screen aspect ratio determination code",(void *)&r_usenewaspect, CVAR_BOOL, 0, 1 },
{ "r_screenaspect","r_screenaspect: if using the new aspect code and in fullscreen, screen aspect ratio in the form XXYY, e.g. 1609 for 16:9",(void *)&r_screenxy, CVAR_UINT, 100, 9999 },
{ "r_novoxmips","r_novoxmips: turn off/on the use of mipmaps when rendering 8-bit voxels",(void *)&novoxmips, CVAR_BOOL, 0, 1 },
{ "r_voxels","r_voxels: enable/disable automatic sprite->voxel rendering",(void *)&usevoxels, CVAR_BOOL, 0, 1 },
/* { "r_scrcaptureformat","r_scrcaptureformat: sets the output format for screenshots (TGA or PCX)",osdcmd_vars, CVAR_FUNCPTR, 0, 0 },*/
{ "vid_gamma","vid_gamma <gamma>: adjusts gamma ramp",(void *)&vid_gamma, CVAR_DOUBLE|CVAR_FUNCPTR, 0, 10 },
{ "vid_contrast","vid_contrast <gamma>: adjusts gamma ramp",(void *)&vid_contrast, CVAR_DOUBLE|CVAR_FUNCPTR, 0, 10 },
{ "vid_brightness","vid_brightness <gamma>: adjusts gamma ramp",(void *)&vid_brightness, CVAR_DOUBLE|CVAR_FUNCPTR, 0, 10 },
{ "r_usenewaspect","r_usenewaspect: enable/disable new screen aspect ratio determination code",(void *) &r_usenewaspect, CVAR_BOOL, 0, 1 },
{ "r_screenaspect","r_screenaspect: if using the new aspect code and in fullscreen, screen aspect ratio in the form XXYY, e.g. 1609 for 16:9",(void *) &r_screenxy, CVAR_UINT, 100, 9999 },
{ "r_novoxmips","r_novoxmips: turn off/on the use of mipmaps when rendering 8-bit voxels",(void *) &novoxmips, CVAR_BOOL, 0, 1 },
{ "r_voxels","r_voxels: enable/disable automatic sprite->voxel rendering",(void *) &usevoxels, CVAR_BOOL, 0, 1 },
/* { "r_scrcaptureformat","r_scrcaptureformat: sets the output format for screenshots (TGA or PCX)",osdcmd_vars, CVAR_FUNCPTR, 0, 0 },*/
{ "vid_gamma","vid_gamma <gamma>: adjusts gamma ramp",(void *) &vid_gamma, CVAR_DOUBLE|CVAR_FUNCPTR, 0, 10 },
{ "vid_contrast","vid_contrast <gamma>: adjusts gamma ramp",(void *) &vid_contrast, CVAR_DOUBLE|CVAR_FUNCPTR, 0, 10 },
{ "vid_brightness","vid_brightness <gamma>: adjusts gamma ramp",(void *) &vid_brightness, CVAR_DOUBLE|CVAR_FUNCPTR, 0, 10 },
#endif
{ "debug1","debug counter",(void *)&debug1, CVAR_FLOAT, -100000, 100000 },
{ "debug2","debug counter",(void *)&debug2, CVAR_FLOAT, -100000, 100000 },
{ "debug1","debug counter",(void *) &debug1, CVAR_FLOAT, -100000, 100000 },
{ "debug2","debug counter",(void *) &debug2, CVAR_FLOAT, -100000, 100000 },
};
for (i=0; i<sizeof(cvars_engine)/sizeof(cvars_engine[0]); i++)

View file

@ -2834,7 +2834,8 @@ void overheadeditor(void)
// visitedwall[j>>3] |= (1<<(j&7));
n--;
}
} while (j!=refwall && n>0);
}
while (j!=refwall && n>0);
if (j!=refwall)
{
message("internal error while trying to trace outer loop: j!=refwall");
@ -3220,7 +3221,7 @@ SKIP:
vec.z = sprite[daspr].z;
if (setsprite(daspr, &vec) == -1 && osec>=0)
Bmemcpy(&sprite[daspr], &ovec, sizeof(vec3_t));
/*
/*
daz = ((tilesizy[sprite[daspr].picnum]*sprite[daspr].yrepeat)<<2);
for (i=0; i<numsectors; i++)
@ -3234,7 +3235,7 @@ SKIP:
changespritesect(daspr,(int16_t)i);
break;
}
*/
*/
}
}
asksave = 1;
@ -5863,7 +5864,7 @@ int32_t _getnumber256(const char *namestart, int32_t num, int32_t maxnumber, cha
// defaultstr: can be NULL
// NO overflow checks are done when copying them!
// maxlen: maximum length of entry string, if ==1, enter single char
const char* getstring_simple(const char *querystr, const char *defaultstr, int32_t maxlen)
const char *getstring_simple(const char *querystr, const char *defaultstr, int32_t maxlen)
{
static char buf[128];
int32_t ei=0, qrylen=0;

View file

@ -274,12 +274,12 @@ int32_t addsearchpath(const char *p)
}
if (!(st.st_mode & BS_IFDIR)) return -1;
srch = (searchpath_t*)Bmalloc(sizeof(searchpath_t));
srch = (searchpath_t *)Bmalloc(sizeof(searchpath_t));
if (!srch) return -1;
srch->next = searchpathhead;
srch->pathlen = strlen(p)+1;
srch->path = (char*)Bmalloc(srch->pathlen + 1);
srch->path = (char *)Bmalloc(srch->pathlen + 1);
if (!srch->path)
{
Bfree(srch);
@ -337,7 +337,7 @@ int32_t findfrompath(const char *fn, char **where)
}
}
for (pfn = (char*)fn; toupperlookup[*pfn] == '/'; pfn++);
for (pfn = (char *)fn; toupperlookup[*pfn] == '/'; pfn++);
ffn = Bstrdup(pfn);
if (!ffn) return -1;
Bcorrectfilename(ffn,0); // compress relative paths
@ -415,7 +415,7 @@ int32_t openfrompath(const char *fn, int32_t flags, int32_t mode)
return h;
}
BFILE* fopenfrompath(const char *fn, const char *mode)
BFILE *fopenfrompath(const char *fn, const char *mode)
{
int32_t fh;
BFILE *h;
@ -894,7 +894,7 @@ static int32_t klistaddentry(CACHE1D_FIND_REC **rec, char *name, int32_t type, i
r = (CACHE1D_FIND_REC *)Bmalloc(sizeof(CACHE1D_FIND_REC)+strlen(name)+1);
if (!r) return -1;
r->name = (char*)r + sizeof(CACHE1D_FIND_REC); strcpy(r->name, name);
r->name = (char *)r + sizeof(CACHE1D_FIND_REC); strcpy(r->name, name);
r->type = type;
r->source = source;
r->usera = r->userb = NULL;

View file

@ -119,47 +119,47 @@ int32_t Blseek(int32_t fildes, int32_t offset, int32_t whence)
BFILE *Bfopen(const char *path, const char *mode)
{
return (BFILE*)fopen(path,mode);
return (BFILE *)fopen(path,mode);
}
int32_t Bfclose(BFILE *stream)
{
return fclose((FILE*)stream);
return fclose((FILE *)stream);
}
void Brewind(BFILE *stream)
{
rewind((FILE*)stream);
rewind((FILE *)stream);
}
int32_t Bfgetc(BFILE *stream)
{
return fgetc((FILE*)stream);
return fgetc((FILE *)stream);
}
char *Bfgets(char *s, int32_t size, BFILE *stream)
{
return fgets(s,size,(FILE*)stream);
return fgets(s,size,(FILE *)stream);
}
int32_t Bfputc(int32_t c, BFILE *stream)
{
return fputc(c,(FILE*)stream);
return fputc(c,(FILE *)stream);
}
int32_t Bfputs(const char *s, BFILE *stream)
{
return fputs(s,(FILE*)stream);
return fputs(s,(FILE *)stream);
}
bsize_t Bfread(void *ptr, bsize_t size, bsize_t nmemb, BFILE *stream)
{
return fread(ptr,size,nmemb,(FILE*)stream);
return fread(ptr,size,nmemb,(FILE *)stream);
}
bsize_t Bfwrite(const void *ptr, bsize_t size, bsize_t nmemb, BFILE *stream)
{
return fwrite(ptr,size,nmemb,(FILE*)stream);
return fwrite(ptr,size,nmemb,(FILE *)stream);
}
@ -387,7 +387,7 @@ char *Bgethomedir(void)
str = CFURLCopyFileSystemPath(base, kCFURLPOSIXPathStyle);
CFRelease(base);
if (!str) return NULL;
s = (char*)CFStringGetCStringPtr(str,CFStringGetSystemEncoding());
s = (char *)CFStringGetCStringPtr(str,CFStringGetSystemEncoding());
if (s) s = Bstrdup(s);
CFRelease(str);
return s;
@ -417,7 +417,7 @@ char *Bgetsupportdir(int32_t global)
str = CFURLCopyFileSystemPath(base, kCFURLPOSIXPathStyle);
CFRelease(base);
if (!str) return NULL;
s = (char*)CFStringGetCStringPtr(str,CFStringGetSystemEncoding());
s = (char *)CFStringGetCStringPtr(str,CFStringGetSystemEncoding());
if (s) s = Bstrdup(s);
CFRelease(str);
return s;
@ -585,16 +585,16 @@ typedef struct
char name[1];
} BDIR_real;
BDIR* Bopendir(const char *name)
BDIR *Bopendir(const char *name)
{
BDIR_real *dirr;
#ifdef _MSC_VER
char *t,*tt;
t = (char*)Bmalloc(strlen(name)+1+4);
t = (char *)Bmalloc(strlen(name)+1+4);
if (!t) return NULL;
#endif
dirr = (BDIR_real*)Bmalloc(sizeof(BDIR_real) + strlen(name));
dirr = (BDIR_real *)Bmalloc(sizeof(BDIR_real) + strlen(name));
if (!dirr)
{
#ifdef _MSC_VER
@ -632,12 +632,12 @@ BDIR* Bopendir(const char *name)
dirr->status = 0;
strcpy(dirr->name, name);
return (BDIR*)dirr;
return (BDIR *)dirr;
}
struct Bdirent* Breaddir(BDIR *dir)
struct Bdirent *Breaddir(BDIR *dir)
{
BDIR_real *dirr = (BDIR_real*)dir;
BDIR_real *dirr = (BDIR_real *)dir;
struct dirent *de;
struct stat st;
char *fn;
@ -694,7 +694,7 @@ struct Bdirent* Breaddir(BDIR *dir)
int32_t Bclosedir(BDIR *dir)
{
BDIR_real *dirr = (BDIR_real*)dir;
BDIR_real *dirr = (BDIR_real *)dir;
#ifdef _MSC_VER
_findclose(dirr->dir);

View file

@ -1507,7 +1507,7 @@ static int32_t defsparser(scriptfile *script)
kclose(fd);
kpgetdim(filebuf, filesize, &xsiz, &ysiz);
if (xsiz != PR_HIGHPALOOKUP_DIM*PR_HIGHPALOOKUP_DIM || ysiz != PR_HIGHPALOOKUP_DIM)
if (xsiz != PR_HIGHPALOOKUP_DIM *PR_HIGHPALOOKUP_DIM || ysiz != PR_HIGHPALOOKUP_DIM)
{
initprintf("Error: image dimensions of '%s' must be %dx%d.\n",
fn, PR_HIGHPALOOKUP_DIM*PR_HIGHPALOOKUP_DIM, PR_HIGHPALOOKUP_DIM);

View file

@ -46,7 +46,7 @@
float debug1, debug2;
static void drawpixel_safe(void* s, char a)
static void drawpixel_safe(void *s, char a)
{
#if defined __GNUC__
if (__builtin_expect((intptr_t)s >= frameplace && (intptr_t)s < frameplace+bytesperline*ydim, 1))
@ -58,15 +58,15 @@ static void drawpixel_safe(void* s, char a)
else
{
static const char *const c = &editorcolors[15];
drawpixel((intptr_t*)frameplace, *c);
drawpixel((intptr_t*)frameplace+1, *c);
drawpixel((intptr_t*)frameplace+2, *c);
drawpixel((intptr_t*)frameplace+bytesperline, *c);
drawpixel((intptr_t*)frameplace+bytesperline+1, *c);
drawpixel((intptr_t*)frameplace+bytesperline+2, *c);
drawpixel((intptr_t*)frameplace+2*bytesperline, *c);
drawpixel((intptr_t*)frameplace+2*bytesperline+1, *c);
drawpixel((intptr_t*)frameplace+2*bytesperline+2, *c);
drawpixel((intptr_t *)frameplace, *c);
drawpixel((intptr_t *)frameplace+1, *c);
drawpixel((intptr_t *)frameplace+2, *c);
drawpixel((intptr_t *)frameplace+bytesperline, *c);
drawpixel((intptr_t *)frameplace+bytesperline+1, *c);
drawpixel((intptr_t *)frameplace+bytesperline+2, *c);
drawpixel((intptr_t *)frameplace+2*bytesperline, *c);
drawpixel((intptr_t *)frameplace+2*bytesperline+1, *c);
drawpixel((intptr_t *)frameplace+2*bytesperline+2, *c);
}
#endif
}
@ -295,7 +295,7 @@ int32_t clipmapinfo_load(const char *filename)
int32_t i,k,w, px,py,pz;
int16_t ang,cs;
char fn[BMAX_PATH], loadedwhich[32]={0}, *lwcp=loadedwhich;
char fn[BMAX_PATH], loadedwhich[32]= {0}, *lwcp=loadedwhich;
int32_t slen, fi, fisec[10], fispr[10];
int32_t ournumsectors=0, ournumwalls=0, ournumsprites=0, numsprites;
@ -538,7 +538,8 @@ int32_t clipmapinfo_load(const char *filename)
}
}
}
} while (++scnt < numclipsects);
}
while (++scnt < numclipsects);
if (outersect==-1)
{
@ -790,10 +791,10 @@ static inline int32_t nsqrtasm(int32_t a)
shr ebx, 12
mov cx, word ptr shlookup[ebx*2]
jmp short under24
over24:
over24:
shr ebx, 24
mov cx, word ptr shlookup[ebx*2+8192]
under24:
under24:
shr eax, cl
mov cl, ch
mov ax, word ptr sqrtable[eax*2]
@ -810,12 +811,12 @@ static inline int32_t msqrtasm(int32_t c)
mov ecx, c
mov eax, 0x40000000
mov ebx, 0x20000000
begit:
begit:
cmp ecx, eax
jl skip
sub ecx, eax
lea eax, [eax+ebx*4]
skip:
skip:
sub eax, ebx
shr eax, 1
shr ebx, 2
@ -884,7 +885,7 @@ static inline int32_t getkensmessagecrc(void *b)
mov ebx, b
xor eax, eax
mov ecx, 32
beg:
beg:
mov edx, dword ptr [ebx+ecx*4-4]
ror edx, cl
adc eax, edx
@ -1335,7 +1336,7 @@ static void scansector(int16_t sectnum)
rx2[numscans] = xp2; ry2[numscans] = yp2;
p2[numscans] = numscans+1;
numscans++;
skipitaddwall:
skipitaddwall:
if ((wall[z].point2 < z) && (scanfirst < numscans))
p2[numscans-1] = scanfirst, scanfirst = numscans;
@ -5772,9 +5773,9 @@ static void loadpalette(void)
kread(fil,&numpalookups,2); numpalookups = B_LITTLE16(numpalookups);
if ((palookup[0] = (char *)Bmalloc(numpalookups<<8)) == NULL)
allocache((intptr_t*)&palookup[0],numpalookups<<8,&permanentlock);
allocache((intptr_t *)&palookup[0],numpalookups<<8,&permanentlock);
if ((transluc = (char *)Bmalloc(65536L)) == NULL)
allocache((intptr_t*)&transluc,65536,&permanentlock);
allocache((intptr_t *)&transluc,65536,&permanentlock);
globalpalwritten = palookup[0]; globalpal = 0;
setpalookupaddress(globalpalwritten);
@ -6173,17 +6174,17 @@ int32_t preinitengine(void)
}
dynarray[] =
{
{ (void **)&sector, sizeof(sectortype) * MAXSECTORS },
{ (void **)&wall, sizeof(walltype) * (MAXWALLS+4) }, // +4: editor quirks
{ (void **)&sprite, sizeof(spritetype) * MAXSPRITES },
{ (void **)&tsprite, sizeof(spritetype) * MAXSPRITESONSCREEN },
{ (void **)&spriteext, sizeof(spriteext_t) * (MAXSPRITES+MAXUNIQHUDID) },
{ (void **)&spritesmooth, sizeof(spritesmooth_t) * (MAXSPRITES+MAXUNIQHUDID) },
{ (void **)&state_compress, sizeof(qlz_state_compress) },
{ (void **)&state_decompress, sizeof(qlz_state_decompress) }
{ (void **) &sector, sizeof(sectortype) *MAXSECTORS },
{ (void **) &wall, sizeof(walltype) *(MAXWALLS+4) }, // +4: editor quirks
{ (void **) &sprite, sizeof(spritetype) *MAXSPRITES },
{ (void **) &tsprite, sizeof(spritetype) *MAXSPRITESONSCREEN },
{ (void **) &spriteext, sizeof(spriteext_t) *(MAXSPRITES+MAXUNIQHUDID) },
{ (void **) &spritesmooth, sizeof(spritesmooth_t) *(MAXSPRITES+MAXUNIQHUDID) },
{ (void **) &state_compress, sizeof(qlz_state_compress) },
{ (void **) &state_decompress, sizeof(qlz_state_decompress) }
};
for (i=0;i<(signed)(sizeof(dynarray)/sizeof(dynarray[0])); i++)
for (i=0; i<(signed)(sizeof(dynarray)/sizeof(dynarray[0])); i++)
size += dynarray[i].size;
if ((blockptr = Bcalloc(1, size)) == NULL)
@ -6191,7 +6192,7 @@ int32_t preinitengine(void)
size = 0;
for (i=0;i<(signed)(sizeof(dynarray)/sizeof(dynarray[0])); i++)
for (i=0; i<(signed)(sizeof(dynarray)/sizeof(dynarray[0])); i++)
{
*dynarray[i].ptr = (int8_t *)blockptr + size;
size += dynarray[i].size;
@ -6206,7 +6207,7 @@ int32_t preinitengine(void)
spriteext = spriteext_s;
spritesmooth = spritesmooth_s;
state_compress = (qlz_state_compress *) Bmalloc(sizeof(qlz_state_compress) + sizeof(qlz_state_decompress));
state_decompress = (qlz_state_decompress *) ((int8_t *)(state_compress) + sizeof(qlz_state_compress));
state_decompress = (qlz_state_decompress *)((int8_t *)(state_compress) + sizeof(qlz_state_compress));
#endif
if ((e = Bgetenv("BUILD_NOP6")) != NULL)
@ -6332,7 +6333,7 @@ void uninitengine(void)
i=(sizeof(artptrs)/sizeof(intptr_t))-1;
// this leaves a bunch of invalid pointers in waloff... fixme?
for(; i>=0; i--)
for (; i>=0; i--)
{
if (artptrs[i])
{
@ -6682,7 +6683,7 @@ static inline void drawmaskleaf(_maskleaf* wall)
}
*/
static inline int32_t sameside(_equation* eq, _point2d* p1, _point2d* p2)
static inline int32_t sameside(_equation *eq, _point2d *p1, _point2d *p2)
{
float sign1, sign2;
@ -6731,7 +6732,7 @@ void drawmasks(void)
}
else if ((tspriteptr[i]->cstat&48) == 0)
{
killsprite:
killsprite:
spritesortcnt--; //Delete face sprite if on wrong side!
if (i == spritesortcnt) continue;
tspriteptr[i] = tspriteptr[spritesortcnt];
@ -7319,15 +7320,15 @@ int32_t loadboard(char *filename, char flags, int32_t *daposx, int32_t *daposy,
for (i=0; i<numsprites; i++)
{
int32_t k;
/*
/*
int16_t sect;
*/
*/
if ((sprite[i].cstat & 48) == 48) sprite[i].cstat &= ~48;
k = insertsprite(sprite[i].sectnum,sprite[i].statnum);
/*
/*
sect = sprite[k].sectnum;
updatesector(sprite[k].x, sprite[k].y, &sect);
@ -7350,16 +7351,16 @@ int32_t loadboard(char *filename, char flags, int32_t *daposx, int32_t *daposy,
if (sect == -1)
dq[dnum++] = k;
}
*/
*/
}
/*
/*
while (dnum--)
{
initprintf(OSD_ERROR "Map error: removing sprite #%d(%d,%d) in null space. Map is corrupt!\n",dq[dnum],sprite[dq[dnum]].x,sprite[dq[dnum]].y);
deletesprite(dq[dnum]);
}
*/
*/
//Must be after loading sectors, etc!
updatesector(*daposx,*daposy,dacursectnum);
@ -8346,11 +8347,11 @@ int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t da
#endif
if ((qsetmode == 200) && (videomodereset == 0) &&
(davidoption == fullscreen) && (xdim == daxdim) && (ydim == daydim) && (bpp == dabpp)
/*
#ifdef POLYMER
/*
#ifdef POLYMER
&& glrendmode != 4
#endif // POLYMER
*/
#endif // POLYMER
*/
)
return(0);
@ -9116,7 +9117,7 @@ static int32_t hitscan_trysector(const vec3_t *sv, const sectortype *sec, hitdat
}
}
}
else if ((how*vz > 0) && (how*sv->z <= how*z))
else if ((how*vz > 0) && (how *sv->z <= how*z))
{
z1 = z; i = z1-sv->z;
if ((klabs(i)>>1) < vz*how)
@ -10625,7 +10626,7 @@ void getzrange(const vec3_t *vect, int16_t sectnum,
if (0)
{
beginagain:
beginagain:
// replace sector and wall with clip map
mapinfo_set(&origmapinfo, &clipmapinfo);
clipsectcnt = clipsectnum; // should be a nop, "safety"...
@ -11052,7 +11053,7 @@ void makepalookup(int32_t palnum, char *remapbuf, int8_t r, int8_t g, int8_t b,
{
//Allocate palookup buffer
if ((palookup[palnum] = (char *)Bmalloc(numpalookups<<8)) == NULL)
allocache((intptr_t*)&palookup[palnum],numpalookups<<8,&permanentlock);
allocache((intptr_t *)&palookup[palnum],numpalookups<<8,&permanentlock);
}
if (dastat == 0) return;
@ -11242,7 +11243,7 @@ void clearview(int32_t dacol)
for (y=windowy1; y<=windowy2; y++)
{
//clearbufbyte((void*)p,dx,dacol);
Bmemset((void*)p,dacol,dx);
Bmemset((void *)p,dacol,dx);
p += ylookup[1];
}
enddrawing(); //}}}
@ -11276,7 +11277,7 @@ void clearallviews(int32_t dacol)
begindrawing(); //{{{
//clearbufbyte((void*)frameplace,imageSize,0L);
Bmemset((void*)frameplace,dacol,imageSize);
Bmemset((void *)frameplace,dacol,imageSize);
enddrawing(); //}}}
//nextpage();
@ -11308,7 +11309,7 @@ void plotpixel(int32_t x, int32_t y, char col)
#endif
begindrawing(); //{{{
drawpixel_safe((void*)(ylookup[y]+x+frameplace),(int32_t)col);
drawpixel_safe((void *)(ylookup[y]+x+frameplace),(int32_t)col);
enddrawing(); //}}}
}
@ -11356,7 +11357,7 @@ char getpixel(int32_t x, int32_t y)
#endif
begindrawing(); //{{{
r = readpixel((void*)(ylookup[y]+x+frameplace));
r = readpixel((void *)(ylookup[y]+x+frameplace));
enddrawing(); //}}}
return(r);
}
@ -11500,9 +11501,9 @@ void completemirror(void)
i = windowx2-windowx1-mirrorsx2-mirrorsx1; mirrorsx2 -= mirrorsx1;
for (dy=mirrorsy2-mirrorsy1-1; dy>=0; dy--)
{
copybufbyte((void*)(p+1),tempbuf,mirrorsx2+1);
copybufbyte((void *)(p+1),tempbuf,mirrorsx2+1);
tempbuf[mirrorsx2] = tempbuf[mirrorsx2-1];
copybufreverse(&tempbuf[mirrorsx2],(void*)(p+i),mirrorsx2+1);
copybufreverse(&tempbuf[mirrorsx2],(void *)(p+i),mirrorsx2+1);
p += ylookup[1];
faketimerhandler();
}
@ -11812,7 +11813,7 @@ void drawline256(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col)
{
j = (plc>>12);
if ((j >= startumost[i]) && (j < startdmost[i]))
drawpixel_safe((void*)(frameplace+ylookup[j]+i),col);
drawpixel_safe((void *)(frameplace+ylookup[j]+i),col);
plc += inc;
}
enddrawing(); //}}}
@ -11835,7 +11836,7 @@ void drawline256(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col)
{
j = (plc>>12);
if ((i >= startumost[j]) && (i < startdmost[j]))
drawpixel_safe((void*)(j+p),col);
drawpixel_safe((void *)(j+p),col);
plc += inc; p += ylookup[1];
}
enddrawing(); //}}}
@ -12861,14 +12862,14 @@ void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t z
m32_wallsprite[m32_swcnt++] = j;
sideview_getdist(j, i);
}
/*
/*
// j = sector[numsectors-1].wallptr + sector[numsectors-1].wallnum
for (; j<numwalls; j++) // new walls ...
{
m32_wallsprite[m32_swcnt++] = j;
m32_sidedist[j] = sideview_getdist(j, 0);
}
*/
*/
}
faketimerhandler();
@ -12890,7 +12891,7 @@ void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t z
if (m32_sideview)
{
qsort(m32_wallsprite, m32_swcnt, sizeof(int16_t), (int(*)(const void *, const void *))&sideview_cmppoints);
qsort(m32_wallsprite, m32_swcnt, sizeof(int16_t), (int( *)(const void *, const void *))&sideview_cmppoints);
for (i=0; i<m32_swcnt; i++) // shouldn't it go the other way around?
{

View file

@ -11,277 +11,277 @@
#include "sdl_inc.h"
#endif
void (APIENTRY * bglClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
void (APIENTRY * bglClear)(GLbitfield mask);
void (APIENTRY * bglColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
void (APIENTRY * bglAlphaFunc)(GLenum func, GLclampf ref);
void (APIENTRY * bglBlendFunc)(GLenum sfactor, GLenum dfactor);
void (APIENTRY * bglCullFace)(GLenum mode);
void (APIENTRY * bglFrontFace)(GLenum mode);
void (APIENTRY * bglPolygonOffset)(GLfloat factor, GLfloat units);
void (APIENTRY * bglPolygonMode)(GLenum face, GLenum mode);
void (APIENTRY * bglEnable)(GLenum cap);
void (APIENTRY * bglDisable)(GLenum cap);
void (APIENTRY * bglGetDoublev)(GLenum pname, GLdouble *params);
void (APIENTRY * bglGetFloatv)(GLenum pname, GLfloat *params);
void (APIENTRY * bglGetIntegerv)(GLenum pname, GLint *params);
void (APIENTRY * bglPushAttrib)(GLbitfield mask);
void (APIENTRY * bglPopAttrib)(void);
GLenum(APIENTRY * bglGetError)(void);
const GLubyte*(APIENTRY * bglGetString)(GLenum name);
void (APIENTRY * bglHint)(GLenum target, GLenum mode);
void (APIENTRY * bglDrawBuffer)(GLenum mode);
void (APIENTRY * bglReadBuffer)(GLenum mode);
void (APIENTRY * bglScissor)(GLint x, GLint y, GLsizei width, GLsizei height);
void (APIENTRY * bglClipPlane)(GLenum plane, const GLdouble *equation);
void (APIENTRY *bglClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
void (APIENTRY *bglClear)(GLbitfield mask);
void (APIENTRY *bglColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
void (APIENTRY *bglAlphaFunc)(GLenum func, GLclampf ref);
void (APIENTRY *bglBlendFunc)(GLenum sfactor, GLenum dfactor);
void (APIENTRY *bglCullFace)(GLenum mode);
void (APIENTRY *bglFrontFace)(GLenum mode);
void (APIENTRY *bglPolygonOffset)(GLfloat factor, GLfloat units);
void (APIENTRY *bglPolygonMode)(GLenum face, GLenum mode);
void (APIENTRY *bglEnable)(GLenum cap);
void (APIENTRY *bglDisable)(GLenum cap);
void (APIENTRY *bglGetDoublev)(GLenum pname, GLdouble *params);
void (APIENTRY *bglGetFloatv)(GLenum pname, GLfloat *params);
void (APIENTRY *bglGetIntegerv)(GLenum pname, GLint *params);
void (APIENTRY *bglPushAttrib)(GLbitfield mask);
void (APIENTRY *bglPopAttrib)(void);
GLenum(APIENTRY *bglGetError)(void);
const GLubyte *(APIENTRY *bglGetString)(GLenum name);
void (APIENTRY *bglHint)(GLenum target, GLenum mode);
void (APIENTRY *bglDrawBuffer)(GLenum mode);
void (APIENTRY *bglReadBuffer)(GLenum mode);
void (APIENTRY *bglScissor)(GLint x, GLint y, GLsizei width, GLsizei height);
void (APIENTRY *bglClipPlane)(GLenum plane, const GLdouble *equation);
// Depth
void (APIENTRY * bglDepthFunc)(GLenum func);
void (APIENTRY * bglDepthMask)(GLboolean flag);
void (APIENTRY * bglDepthRange)(GLclampd near_val, GLclampd far_val);
void (APIENTRY *bglDepthFunc)(GLenum func);
void (APIENTRY *bglDepthMask)(GLboolean flag);
void (APIENTRY *bglDepthRange)(GLclampd near_val, GLclampd far_val);
// Matrix
void (APIENTRY * bglMatrixMode)(GLenum mode);
void (APIENTRY * bglOrtho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val);
void (APIENTRY * bglFrustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val);
void (APIENTRY * bglViewport)(GLint x, GLint y, GLsizei width, GLsizei height);
void (APIENTRY * bglPushMatrix)(void);
void (APIENTRY * bglPopMatrix)(void);
void (APIENTRY * bglLoadIdentity)(void);
void (APIENTRY * bglLoadMatrixf)(const GLfloat *m);
void (APIENTRY * bglLoadMatrixd)(const GLdouble *m);
void (APIENTRY * bglMultMatrixf)(const GLfloat *m);
void (APIENTRY * bglMultMatrixd)(const GLdouble *m);
void (APIENTRY * bglRotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
void (APIENTRY * bglScalef)(GLfloat x, GLfloat y, GLfloat z);
void (APIENTRY * bglTranslatef)(GLfloat x, GLfloat y, GLfloat z);
void (APIENTRY *bglMatrixMode)(GLenum mode);
void (APIENTRY *bglOrtho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val);
void (APIENTRY *bglFrustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val);
void (APIENTRY *bglViewport)(GLint x, GLint y, GLsizei width, GLsizei height);
void (APIENTRY *bglPushMatrix)(void);
void (APIENTRY *bglPopMatrix)(void);
void (APIENTRY *bglLoadIdentity)(void);
void (APIENTRY *bglLoadMatrixf)(const GLfloat *m);
void (APIENTRY *bglLoadMatrixd)(const GLdouble *m);
void (APIENTRY *bglMultMatrixf)(const GLfloat *m);
void (APIENTRY *bglMultMatrixd)(const GLdouble *m);
void (APIENTRY *bglRotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
void (APIENTRY *bglScalef)(GLfloat x, GLfloat y, GLfloat z);
void (APIENTRY *bglTranslatef)(GLfloat x, GLfloat y, GLfloat z);
// Drawing
void (APIENTRY * bglBegin)(GLenum mode);
void (APIENTRY * bglEnd)(void);
void (APIENTRY * bglVertex2f)(GLfloat x, GLfloat y);
void (APIENTRY * bglVertex2i)(GLint x, GLint y);
void (APIENTRY * bglVertex3f)(GLfloat x, GLfloat y, GLfloat z);
void (APIENTRY * bglVertex3d)(GLdouble x, GLdouble y, GLdouble z);
void (APIENTRY * bglVertex3fv)(const GLfloat *v);
void (APIENTRY * bglVertex3dv)(const GLdouble *v);
void (APIENTRY * bglColor4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
void (APIENTRY * bglColor4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
void (APIENTRY * bglTexCoord2d)(GLdouble s, GLdouble t);
void (APIENTRY * bglTexCoord2f)(GLfloat s, GLfloat t);
void (APIENTRY * bglTexCoord2i)(GLint s, GLint t);
void (APIENTRY * bglNormal3f)(GLfloat x, GLfloat y, GLfloat z);
void (APIENTRY *bglBegin)(GLenum mode);
void (APIENTRY *bglEnd)(void);
void (APIENTRY *bglVertex2f)(GLfloat x, GLfloat y);
void (APIENTRY *bglVertex2i)(GLint x, GLint y);
void (APIENTRY *bglVertex3f)(GLfloat x, GLfloat y, GLfloat z);
void (APIENTRY *bglVertex3d)(GLdouble x, GLdouble y, GLdouble z);
void (APIENTRY *bglVertex3fv)(const GLfloat *v);
void (APIENTRY *bglVertex3dv)(const GLdouble *v);
void (APIENTRY *bglColor4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
void (APIENTRY *bglColor4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
void (APIENTRY *bglTexCoord2d)(GLdouble s, GLdouble t);
void (APIENTRY *bglTexCoord2f)(GLfloat s, GLfloat t);
void (APIENTRY *bglTexCoord2i)(GLint s, GLint t);
void (APIENTRY *bglNormal3f)(GLfloat x, GLfloat y, GLfloat z);
// Lighting
void (APIENTRY * bglShadeModel)(GLenum mode);
void (APIENTRY * bglLightfv)(GLenum light, GLenum pname, const GLfloat * params);
void (APIENTRY *bglShadeModel)(GLenum mode);
void (APIENTRY *bglLightfv)(GLenum light, GLenum pname, const GLfloat *params);
// Raster funcs
void (APIENTRY * bglReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
void (APIENTRY * bglRasterPos4i)(GLint x, GLint y, GLint z, GLint w);
void (APIENTRY * bglDrawPixels)(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
void (APIENTRY *bglReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
void (APIENTRY *bglRasterPos4i)(GLint x, GLint y, GLint z, GLint w);
void (APIENTRY *bglDrawPixels)(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
// Texture mapping
void (APIENTRY * bglTexEnvf)(GLenum target, GLenum pname, GLfloat param);
void (APIENTRY * bglGenTextures)(GLsizei n, GLuint *textures); // 1.1
void (APIENTRY * bglDeleteTextures)(GLsizei n, const GLuint *textures); // 1.1
void (APIENTRY * bglBindTexture)(GLenum target, GLuint texture); // 1.1
void (APIENTRY * bglTexImage2D)(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
void (APIENTRY * bglTexImage3D)(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
void (APIENTRY * bglCopyTexImage2D)(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
void (APIENTRY * bglCopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
void (APIENTRY * bglTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); // 1.1
void (APIENTRY * bglTexParameterf)(GLenum target, GLenum pname, GLfloat param);
void (APIENTRY * bglTexParameteri)(GLenum target, GLenum pname, GLint param);
void (APIENTRY * bglGetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint *params);
void (APIENTRY * bglCompressedTexImage2DARB)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
void (APIENTRY * bglGetCompressedTexImageARB)(GLenum, GLint, GLvoid *);
void (APIENTRY * bglTexGenfv)(GLenum coord, GLenum pname, const GLfloat *params);
void (APIENTRY *bglTexEnvf)(GLenum target, GLenum pname, GLfloat param);
void (APIENTRY *bglGenTextures)(GLsizei n, GLuint *textures); // 1.1
void (APIENTRY *bglDeleteTextures)(GLsizei n, const GLuint *textures); // 1.1
void (APIENTRY *bglBindTexture)(GLenum target, GLuint texture); // 1.1
void (APIENTRY *bglTexImage2D)(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
void (APIENTRY *bglTexImage3D)(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
void (APIENTRY *bglCopyTexImage2D)(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
void (APIENTRY *bglCopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
void (APIENTRY *bglTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); // 1.1
void (APIENTRY *bglTexParameterf)(GLenum target, GLenum pname, GLfloat param);
void (APIENTRY *bglTexParameteri)(GLenum target, GLenum pname, GLint param);
void (APIENTRY *bglGetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint *params);
void (APIENTRY *bglCompressedTexImage2DARB)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
void (APIENTRY *bglGetCompressedTexImageARB)(GLenum, GLint, GLvoid *);
void (APIENTRY *bglTexGenfv)(GLenum coord, GLenum pname, const GLfloat *params);
// Fog
void (APIENTRY * bglFogf)(GLenum pname, GLfloat param);
void (APIENTRY * bglFogi)(GLenum pname, GLint param);
void (APIENTRY * bglFogfv)(GLenum pname, const GLfloat *params);
void (APIENTRY *bglFogf)(GLenum pname, GLfloat param);
void (APIENTRY *bglFogi)(GLenum pname, GLint param);
void (APIENTRY *bglFogfv)(GLenum pname, const GLfloat *params);
// Display Lists
void (APIENTRY * bglNewList)(GLuint list, GLenum mode);
void (APIENTRY * bglEndList)(void);
void (APIENTRY * bglCallList)(GLuint list);
void (APIENTRY * bglDeleteLists)(GLuint list, GLsizei range);
void (APIENTRY *bglNewList)(GLuint list, GLenum mode);
void (APIENTRY *bglEndList)(void);
void (APIENTRY *bglCallList)(GLuint list);
void (APIENTRY *bglDeleteLists)(GLuint list, GLsizei range);
// Vertex Arrays
void (APIENTRY * bglEnableClientState)(GLenum cap);
void (APIENTRY * bglDisableClientState)(GLenum cap);
void (APIENTRY * bglVertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
void (APIENTRY * bglNormalPointer)(GLenum type, GLsizei stride, const GLvoid *pointer);
void (APIENTRY * bglTexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
void (APIENTRY * bglDrawArrays)(GLenum mode, GLint first, GLsizei count);
void (APIENTRY * bglDrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
void (APIENTRY *bglEnableClientState)(GLenum cap);
void (APIENTRY *bglDisableClientState)(GLenum cap);
void (APIENTRY *bglVertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
void (APIENTRY *bglNormalPointer)(GLenum type, GLsizei stride, const GLvoid *pointer);
void (APIENTRY *bglTexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
void (APIENTRY *bglDrawArrays)(GLenum mode, GLint first, GLsizei count);
void (APIENTRY *bglDrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
// Stencil Buffer
void (APIENTRY * bglClearStencil)(GLint s);
void (APIENTRY * bglStencilOp)(GLenum fail, GLenum zfail, GLenum zpass);
void (APIENTRY * bglStencilFunc)(GLenum func, GLint ref, GLuint mask);
void (APIENTRY *bglClearStencil)(GLint s);
void (APIENTRY *bglStencilOp)(GLenum fail, GLenum zfail, GLenum zpass);
void (APIENTRY *bglStencilFunc)(GLenum func, GLint ref, GLuint mask);
// GPU Programs
void (APIENTRY * bglGenProgramsARB)(GLsizei, GLuint *);
void (APIENTRY * bglBindProgramARB)(GLenum, GLuint);
void (APIENTRY * bglProgramStringARB)(GLenum, GLenum, GLsizei, const GLvoid *);
void (APIENTRY * bglDeleteProgramsARB)(GLsizei n, const GLuint *programs);
void (APIENTRY *bglGenProgramsARB)(GLsizei, GLuint *);
void (APIENTRY *bglBindProgramARB)(GLenum, GLuint);
void (APIENTRY *bglProgramStringARB)(GLenum, GLenum, GLsizei, const GLvoid *);
void (APIENTRY *bglDeleteProgramsARB)(GLsizei n, const GLuint *programs);
// Multitexturing
void (APIENTRY * bglActiveTextureARB)(GLenum texture);
void (APIENTRY * bglClientActiveTextureARB)(GLenum texture);
void (APIENTRY * bglMultiTexCoord2dARB)(GLenum target, GLdouble s, GLdouble t);
void (APIENTRY * bglMultiTexCoord2fARB)(GLenum target, GLfloat s, GLfloat t);
void (APIENTRY *bglActiveTextureARB)(GLenum texture);
void (APIENTRY *bglClientActiveTextureARB)(GLenum texture);
void (APIENTRY *bglMultiTexCoord2dARB)(GLenum target, GLdouble s, GLdouble t);
void (APIENTRY *bglMultiTexCoord2fARB)(GLenum target, GLfloat s, GLfloat t);
// Frame Buffer Objects
void (APIENTRY * bglGenFramebuffersEXT)(GLsizei n, GLuint *framebuffers);
void (APIENTRY * bglBindFramebufferEXT)(GLenum target, GLuint framebuffer);
void (APIENTRY * bglFramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
GLenum(APIENTRY * bglCheckFramebufferStatusEXT)(GLenum target);
void (APIENTRY * bglDeleteFramebuffersEXT)(GLsizei n, const GLuint *framebuffers);
void (APIENTRY *bglGenFramebuffersEXT)(GLsizei n, GLuint *framebuffers);
void (APIENTRY *bglBindFramebufferEXT)(GLenum target, GLuint framebuffer);
void (APIENTRY *bglFramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
GLenum(APIENTRY *bglCheckFramebufferStatusEXT)(GLenum target);
void (APIENTRY *bglDeleteFramebuffersEXT)(GLsizei n, const GLuint *framebuffers);
// Vertex Buffer Objects
void (APIENTRY * bglGenBuffersARB)(GLsizei n, GLuint * buffers);
void (APIENTRY * bglBindBufferARB)(GLenum target, GLuint buffer);
void (APIENTRY * bglDeleteBuffersARB)(GLsizei n, const GLuint * buffers);
void (APIENTRY * bglBufferDataARB)(GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage);
void (APIENTRY * bglBufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data);
void*(APIENTRY * bglMapBufferARB)(GLenum target, GLenum access);
GLboolean(APIENTRY * bglUnmapBufferARB)(GLenum target);
void (APIENTRY *bglGenBuffersARB)(GLsizei n, GLuint *buffers);
void (APIENTRY *bglBindBufferARB)(GLenum target, GLuint buffer);
void (APIENTRY *bglDeleteBuffersARB)(GLsizei n, const GLuint *buffers);
void (APIENTRY *bglBufferDataARB)(GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage);
void (APIENTRY *bglBufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data);
void *(APIENTRY *bglMapBufferARB)(GLenum target, GLenum access);
GLboolean(APIENTRY *bglUnmapBufferARB)(GLenum target);
// Occlusion queries
void (APIENTRY * bglGenQueriesARB)(GLsizei n, GLuint *ids);
void (APIENTRY * bglDeleteQueriesARB)(GLsizei n, const GLuint *ids);
GLboolean(APIENTRY * bglIsQueryARB)(GLuint id);
void (APIENTRY * bglBeginQueryARB)(GLenum target, GLuint id);
void (APIENTRY * bglEndQueryARB)(GLenum target);
void (APIENTRY * bglGetQueryivARB)(GLenum target, GLenum pname, GLint *params);
void (APIENTRY * bglGetQueryObjectivARB)(GLuint id, GLenum pname, GLint *params);
void (APIENTRY * bglGetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint *params);
void (APIENTRY *bglGenQueriesARB)(GLsizei n, GLuint *ids);
void (APIENTRY *bglDeleteQueriesARB)(GLsizei n, const GLuint *ids);
GLboolean(APIENTRY *bglIsQueryARB)(GLuint id);
void (APIENTRY *bglBeginQueryARB)(GLenum target, GLuint id);
void (APIENTRY *bglEndQueryARB)(GLenum target);
void (APIENTRY *bglGetQueryivARB)(GLenum target, GLenum pname, GLint *params);
void (APIENTRY *bglGetQueryObjectivARB)(GLuint id, GLenum pname, GLint *params);
void (APIENTRY *bglGetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint *params);
// Shader Objects
void (APIENTRY * bglDeleteObjectARB)(GLhandleARB);
GLhandleARB(APIENTRY * bglGetHandleARB)(GLenum);
void (APIENTRY * bglDetachObjectARB)(GLhandleARB, GLhandleARB);
GLhandleARB(APIENTRY * bglCreateShaderObjectARB)(GLenum);
void (APIENTRY * bglShaderSourceARB)(GLhandleARB, GLsizei, const GLcharARB* *, const GLint *);
void (APIENTRY * bglCompileShaderARB)(GLhandleARB);
GLhandleARB(APIENTRY * bglCreateProgramObjectARB)(void);
void (APIENTRY * bglAttachObjectARB)(GLhandleARB, GLhandleARB);
void (APIENTRY * bglLinkProgramARB)(GLhandleARB);
void (APIENTRY * bglUseProgramObjectARB)(GLhandleARB);
void (APIENTRY * bglValidateProgramARB)(GLhandleARB);
void (APIENTRY * bglUniform1fARB)(GLint, GLfloat);
void (APIENTRY * bglUniform2fARB)(GLint, GLfloat, GLfloat);
void (APIENTRY * bglUniform3fARB)(GLint, GLfloat, GLfloat, GLfloat);
void (APIENTRY * bglUniform4fARB)(GLint, GLfloat, GLfloat, GLfloat, GLfloat);
void (APIENTRY * bglUniform1iARB)(GLint, GLint);
void (APIENTRY * bglUniform2iARB)(GLint, GLint, GLint);
void (APIENTRY * bglUniform3iARB)(GLint, GLint, GLint, GLint);
void (APIENTRY * bglUniform4iARB)(GLint, GLint, GLint, GLint, GLint);
void (APIENTRY * bglUniform1fvARB)(GLint, GLsizei, const GLfloat *);
void (APIENTRY * bglUniform2fvARB)(GLint, GLsizei, const GLfloat *);
void (APIENTRY * bglUniform3fvARB)(GLint, GLsizei, const GLfloat *);
void (APIENTRY * bglUniform4fvARB)(GLint, GLsizei, const GLfloat *);
void (APIENTRY * bglUniform1ivARB)(GLint, GLsizei, const GLint *);
void (APIENTRY * bglUniform2ivARB)(GLint, GLsizei, const GLint *);
void (APIENTRY * bglUniform3ivARB)(GLint, GLsizei, const GLint *);
void (APIENTRY * bglUniform4ivARB)(GLint, GLsizei, const GLint *);
void (APIENTRY * bglUniformMatrix2fvARB)(GLint, GLsizei, GLboolean, const GLfloat *);
void (APIENTRY * bglUniformMatrix3fvARB)(GLint, GLsizei, GLboolean, const GLfloat *);
void (APIENTRY * bglUniformMatrix4fvARB)(GLint, GLsizei, GLboolean, const GLfloat *);
void (APIENTRY * bglGetObjectParameterfvARB)(GLhandleARB, GLenum, GLfloat *);
void (APIENTRY * bglGetObjectParameterivARB)(GLhandleARB, GLenum, GLint *);
void (APIENTRY * bglGetInfoLogARB)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *);
void (APIENTRY * bglGetAttachedObjectsARB)(GLhandleARB, GLsizei, GLsizei *, GLhandleARB *);
GLint(APIENTRY * bglGetUniformLocationARB)(GLhandleARB, const GLcharARB *);
void (APIENTRY * bglGetActiveUniformARB)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *);
void (APIENTRY * bglGetUniformfvARB)(GLhandleARB, GLint, GLfloat *);
void (APIENTRY * bglGetUniformivARB)(GLhandleARB, GLint, GLint *);
void (APIENTRY * bglGetShaderSourceARB)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *);
void (APIENTRY *bglDeleteObjectARB)(GLhandleARB);
GLhandleARB(APIENTRY *bglGetHandleARB)(GLenum);
void (APIENTRY *bglDetachObjectARB)(GLhandleARB, GLhandleARB);
GLhandleARB(APIENTRY *bglCreateShaderObjectARB)(GLenum);
void (APIENTRY *bglShaderSourceARB)(GLhandleARB, GLsizei, const GLcharARB* *, const GLint *);
void (APIENTRY *bglCompileShaderARB)(GLhandleARB);
GLhandleARB(APIENTRY *bglCreateProgramObjectARB)(void);
void (APIENTRY *bglAttachObjectARB)(GLhandleARB, GLhandleARB);
void (APIENTRY *bglLinkProgramARB)(GLhandleARB);
void (APIENTRY *bglUseProgramObjectARB)(GLhandleARB);
void (APIENTRY *bglValidateProgramARB)(GLhandleARB);
void (APIENTRY *bglUniform1fARB)(GLint, GLfloat);
void (APIENTRY *bglUniform2fARB)(GLint, GLfloat, GLfloat);
void (APIENTRY *bglUniform3fARB)(GLint, GLfloat, GLfloat, GLfloat);
void (APIENTRY *bglUniform4fARB)(GLint, GLfloat, GLfloat, GLfloat, GLfloat);
void (APIENTRY *bglUniform1iARB)(GLint, GLint);
void (APIENTRY *bglUniform2iARB)(GLint, GLint, GLint);
void (APIENTRY *bglUniform3iARB)(GLint, GLint, GLint, GLint);
void (APIENTRY *bglUniform4iARB)(GLint, GLint, GLint, GLint, GLint);
void (APIENTRY *bglUniform1fvARB)(GLint, GLsizei, const GLfloat *);
void (APIENTRY *bglUniform2fvARB)(GLint, GLsizei, const GLfloat *);
void (APIENTRY *bglUniform3fvARB)(GLint, GLsizei, const GLfloat *);
void (APIENTRY *bglUniform4fvARB)(GLint, GLsizei, const GLfloat *);
void (APIENTRY *bglUniform1ivARB)(GLint, GLsizei, const GLint *);
void (APIENTRY *bglUniform2ivARB)(GLint, GLsizei, const GLint *);
void (APIENTRY *bglUniform3ivARB)(GLint, GLsizei, const GLint *);
void (APIENTRY *bglUniform4ivARB)(GLint, GLsizei, const GLint *);
void (APIENTRY *bglUniformMatrix2fvARB)(GLint, GLsizei, GLboolean, const GLfloat *);
void (APIENTRY *bglUniformMatrix3fvARB)(GLint, GLsizei, GLboolean, const GLfloat *);
void (APIENTRY *bglUniformMatrix4fvARB)(GLint, GLsizei, GLboolean, const GLfloat *);
void (APIENTRY *bglGetObjectParameterfvARB)(GLhandleARB, GLenum, GLfloat *);
void (APIENTRY *bglGetObjectParameterivARB)(GLhandleARB, GLenum, GLint *);
void (APIENTRY *bglGetInfoLogARB)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *);
void (APIENTRY *bglGetAttachedObjectsARB)(GLhandleARB, GLsizei, GLsizei *, GLhandleARB *);
GLint(APIENTRY *bglGetUniformLocationARB)(GLhandleARB, const GLcharARB *);
void (APIENTRY *bglGetActiveUniformARB)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *);
void (APIENTRY *bglGetUniformfvARB)(GLhandleARB, GLint, GLfloat *);
void (APIENTRY *bglGetUniformivARB)(GLhandleARB, GLint, GLint *);
void (APIENTRY *bglGetShaderSourceARB)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *);
// Vertex Shaders
void (APIENTRY * bglVertexAttrib1dARB)(GLuint, GLdouble);
void (APIENTRY * bglVertexAttrib1dvARB)(GLuint, const GLdouble *);
void (APIENTRY * bglVertexAttrib1fARB)(GLuint, GLfloat);
void (APIENTRY * bglVertexAttrib1fvARB)(GLuint, const GLfloat *);
void (APIENTRY * bglVertexAttrib1sARB)(GLuint, GLshort);
void (APIENTRY * bglVertexAttrib1svARB)(GLuint, const GLshort *);
void (APIENTRY * bglVertexAttrib2dARB)(GLuint, GLdouble, GLdouble);
void (APIENTRY * bglVertexAttrib2dvARB)(GLuint, const GLdouble *);
void (APIENTRY * bglVertexAttrib2fARB)(GLuint, GLfloat, GLfloat);
void (APIENTRY * bglVertexAttrib2fvARB)(GLuint, const GLfloat *);
void (APIENTRY * bglVertexAttrib2sARB)(GLuint, GLshort, GLshort);
void (APIENTRY * bglVertexAttrib2svARB)(GLuint, const GLshort *);
void (APIENTRY * bglVertexAttrib3dARB)(GLuint, GLdouble, GLdouble, GLdouble);
void (APIENTRY * bglVertexAttrib3dvARB)(GLuint, const GLdouble *);
void (APIENTRY * bglVertexAttrib3fARB)(GLuint, GLfloat, GLfloat, GLfloat);
void (APIENTRY * bglVertexAttrib3fvARB)(GLuint, const GLfloat *);
void (APIENTRY * bglVertexAttrib3sARB)(GLuint, GLshort, GLshort, GLshort);
void (APIENTRY * bglVertexAttrib3svARB)(GLuint, const GLshort *);
void (APIENTRY * bglVertexAttrib4NbvARB)(GLuint, const GLbyte *);
void (APIENTRY * bglVertexAttrib4NivARB)(GLuint, const GLint *);
void (APIENTRY * bglVertexAttrib4NsvARB)(GLuint, const GLshort *);
void (APIENTRY * bglVertexAttrib4NubARB)(GLuint, GLubyte, GLubyte, GLubyte, GLubyte);
void (APIENTRY * bglVertexAttrib4NubvARB)(GLuint, const GLubyte *);
void (APIENTRY * bglVertexAttrib4NuivARB)(GLuint, const GLuint *);
void (APIENTRY * bglVertexAttrib4NusvARB)(GLuint, const GLushort *);
void (APIENTRY * bglVertexAttrib4bvARB)(GLuint, const GLbyte *);
void (APIENTRY * bglVertexAttrib4dARB)(GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
void (APIENTRY * bglVertexAttrib4dvARB)(GLuint, const GLdouble *);
void (APIENTRY * bglVertexAttrib4fARB)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
void (APIENTRY * bglVertexAttrib4fvARB)(GLuint, const GLfloat *);
void (APIENTRY * bglVertexAttrib4ivARB)(GLuint, const GLint *);
void (APIENTRY * bglVertexAttrib4sARB)(GLuint, GLshort, GLshort, GLshort, GLshort);
void (APIENTRY * bglVertexAttrib4svARB)(GLuint, const GLshort *);
void (APIENTRY * bglVertexAttrib4ubvARB)(GLuint, const GLubyte *);
void (APIENTRY * bglVertexAttrib4uivARB)(GLuint, const GLuint *);
void (APIENTRY * bglVertexAttrib4usvARB)(GLuint, const GLushort *);
void (APIENTRY * bglVertexAttribPointerARB)(GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *);
void (APIENTRY * bglEnableVertexAttribArrayARB)(GLuint);
void (APIENTRY * bglDisableVertexAttribArrayARB)(GLuint);
void (APIENTRY * bglGetVertexAttribdvARB)(GLuint, GLenum, GLdouble *);
void (APIENTRY * bglGetVertexAttribfvARB)(GLuint, GLenum, GLfloat *);
void (APIENTRY * bglGetVertexAttribivARB)(GLuint, GLenum, GLint *);
void (APIENTRY * bglGetVertexAttribPointervARB)(GLuint, GLenum, GLvoid* *);
void (APIENTRY * bglBindAttribLocationARB)(GLhandleARB, GLuint, const GLcharARB *);
void (APIENTRY * bglGetActiveAttribARB)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *);
GLint(APIENTRY * bglGetAttribLocationARB)(GLhandleARB, const GLcharARB *);
void (APIENTRY *bglVertexAttrib1dARB)(GLuint, GLdouble);
void (APIENTRY *bglVertexAttrib1dvARB)(GLuint, const GLdouble *);
void (APIENTRY *bglVertexAttrib1fARB)(GLuint, GLfloat);
void (APIENTRY *bglVertexAttrib1fvARB)(GLuint, const GLfloat *);
void (APIENTRY *bglVertexAttrib1sARB)(GLuint, GLshort);
void (APIENTRY *bglVertexAttrib1svARB)(GLuint, const GLshort *);
void (APIENTRY *bglVertexAttrib2dARB)(GLuint, GLdouble, GLdouble);
void (APIENTRY *bglVertexAttrib2dvARB)(GLuint, const GLdouble *);
void (APIENTRY *bglVertexAttrib2fARB)(GLuint, GLfloat, GLfloat);
void (APIENTRY *bglVertexAttrib2fvARB)(GLuint, const GLfloat *);
void (APIENTRY *bglVertexAttrib2sARB)(GLuint, GLshort, GLshort);
void (APIENTRY *bglVertexAttrib2svARB)(GLuint, const GLshort *);
void (APIENTRY *bglVertexAttrib3dARB)(GLuint, GLdouble, GLdouble, GLdouble);
void (APIENTRY *bglVertexAttrib3dvARB)(GLuint, const GLdouble *);
void (APIENTRY *bglVertexAttrib3fARB)(GLuint, GLfloat, GLfloat, GLfloat);
void (APIENTRY *bglVertexAttrib3fvARB)(GLuint, const GLfloat *);
void (APIENTRY *bglVertexAttrib3sARB)(GLuint, GLshort, GLshort, GLshort);
void (APIENTRY *bglVertexAttrib3svARB)(GLuint, const GLshort *);
void (APIENTRY *bglVertexAttrib4NbvARB)(GLuint, const GLbyte *);
void (APIENTRY *bglVertexAttrib4NivARB)(GLuint, const GLint *);
void (APIENTRY *bglVertexAttrib4NsvARB)(GLuint, const GLshort *);
void (APIENTRY *bglVertexAttrib4NubARB)(GLuint, GLubyte, GLubyte, GLubyte, GLubyte);
void (APIENTRY *bglVertexAttrib4NubvARB)(GLuint, const GLubyte *);
void (APIENTRY *bglVertexAttrib4NuivARB)(GLuint, const GLuint *);
void (APIENTRY *bglVertexAttrib4NusvARB)(GLuint, const GLushort *);
void (APIENTRY *bglVertexAttrib4bvARB)(GLuint, const GLbyte *);
void (APIENTRY *bglVertexAttrib4dARB)(GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
void (APIENTRY *bglVertexAttrib4dvARB)(GLuint, const GLdouble *);
void (APIENTRY *bglVertexAttrib4fARB)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
void (APIENTRY *bglVertexAttrib4fvARB)(GLuint, const GLfloat *);
void (APIENTRY *bglVertexAttrib4ivARB)(GLuint, const GLint *);
void (APIENTRY *bglVertexAttrib4sARB)(GLuint, GLshort, GLshort, GLshort, GLshort);
void (APIENTRY *bglVertexAttrib4svARB)(GLuint, const GLshort *);
void (APIENTRY *bglVertexAttrib4ubvARB)(GLuint, const GLubyte *);
void (APIENTRY *bglVertexAttrib4uivARB)(GLuint, const GLuint *);
void (APIENTRY *bglVertexAttrib4usvARB)(GLuint, const GLushort *);
void (APIENTRY *bglVertexAttribPointerARB)(GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *);
void (APIENTRY *bglEnableVertexAttribArrayARB)(GLuint);
void (APIENTRY *bglDisableVertexAttribArrayARB)(GLuint);
void (APIENTRY *bglGetVertexAttribdvARB)(GLuint, GLenum, GLdouble *);
void (APIENTRY *bglGetVertexAttribfvARB)(GLuint, GLenum, GLfloat *);
void (APIENTRY *bglGetVertexAttribivARB)(GLuint, GLenum, GLint *);
void (APIENTRY *bglGetVertexAttribPointervARB)(GLuint, GLenum, GLvoid* *);
void (APIENTRY *bglBindAttribLocationARB)(GLhandleARB, GLuint, const GLcharARB *);
void (APIENTRY *bglGetActiveAttribARB)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *);
GLint(APIENTRY *bglGetAttribLocationARB)(GLhandleARB, const GLcharARB *);
// GLU
void (APIENTRY * bgluTessBeginContour)(GLUtesselator* tess);
void (APIENTRY * bgluTessBeginPolygon)(GLUtesselator* tess, GLvoid* data);
void (APIENTRY * bgluTessCallback)(GLUtesselator* tess, GLenum which, void (PR_CALLBACK CallBackFunc)());
void (APIENTRY * bgluTessEndContour)(GLUtesselator* tess);
void (APIENTRY * bgluTessEndPolygon)(GLUtesselator* tess);
void (APIENTRY * bgluTessNormal)(GLUtesselator* tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ);
void (APIENTRY * bgluTessProperty)(GLUtesselator* tess, GLenum which, GLdouble data);
void (APIENTRY * bgluTessVertex)(GLUtesselator* tess, GLdouble *location, GLvoid* data);
GLUtesselator*(APIENTRY * bgluNewTess)(void);
void (APIENTRY *bgluTessBeginContour)(GLUtesselator *tess);
void (APIENTRY *bgluTessBeginPolygon)(GLUtesselator *tess, GLvoid *data);
void (APIENTRY *bgluTessCallback)(GLUtesselator *tess, GLenum which, void (PR_CALLBACK CallBackFunc)());
void (APIENTRY *bgluTessEndContour)(GLUtesselator *tess);
void (APIENTRY *bgluTessEndPolygon)(GLUtesselator *tess);
void (APIENTRY *bgluTessNormal)(GLUtesselator *tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ);
void (APIENTRY *bgluTessProperty)(GLUtesselator *tess, GLenum which, GLdouble data);
void (APIENTRY *bgluTessVertex)(GLUtesselator *tess, GLdouble *location, GLvoid *data);
GLUtesselator *(APIENTRY *bgluNewTess)(void);
void (APIENTRY * bgluPerspective)(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar);
void (APIENTRY *bgluPerspective)(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar);
const GLubyte *(APIENTRY * bgluErrorString)(GLenum error);
const GLubyte *(APIENTRY *bgluErrorString)(GLenum error);
GLint(APIENTRY * bgluProject)(GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* winX, GLdouble* winY, GLdouble* winZ);
GLint (APIENTRY * bgluUnProject)(GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble* objX, GLdouble* objY, GLdouble* objZ);
GLint(APIENTRY *bgluProject)(GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble *winX, GLdouble *winY, GLdouble *winZ);
GLint(APIENTRY *bgluUnProject)(GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble *objX, GLdouble *objY, GLdouble *objZ);
#ifdef RENDERTYPEWIN
// Windows
HGLRC(WINAPI * bwglCreateContext)(HDC);
BOOL (WINAPI * bwglDeleteContext)(HGLRC);
PROC(WINAPI * bwglGetProcAddress)(LPCSTR);
BOOL (WINAPI * bwglMakeCurrent)(HDC,HGLRC);
HGLRC(WINAPI *bwglCreateContext)(HDC);
BOOL (WINAPI *bwglDeleteContext)(HGLRC);
PROC(WINAPI *bwglGetProcAddress)(LPCSTR);
BOOL (WINAPI *bwglMakeCurrent)(HDC,HGLRC);
BOOL (WINAPI * bwglSwapBuffers)(HDC);
int32_t (WINAPI * bwglChoosePixelFormat)(HDC,CONST PIXELFORMATDESCRIPTOR*);
int32_t (WINAPI * bwglDescribePixelFormat)(HDC,int32_t,UINT,LPPIXELFORMATDESCRIPTOR);
int32_t (WINAPI * bwglGetPixelFormat)(HDC);
BOOL (WINAPI * bwglSetPixelFormat)(HDC,int32_t,const PIXELFORMATDESCRIPTOR*);
BOOL (WINAPI * bwglSwapIntervalEXT)(int32_t);
BOOL (WINAPI *bwglSwapBuffers)(HDC);
int32_t (WINAPI *bwglChoosePixelFormat)(HDC,CONST PIXELFORMATDESCRIPTOR *);
int32_t (WINAPI *bwglDescribePixelFormat)(HDC,int32_t,UINT,LPPIXELFORMATDESCRIPTOR);
int32_t (WINAPI *bwglGetPixelFormat)(HDC);
BOOL (WINAPI *bwglSetPixelFormat)(HDC,int32_t,const PIXELFORMATDESCRIPTOR *);
BOOL (WINAPI *bwglSwapIntervalEXT)(int32_t);
static HANDLE hGLDLL, hGLUDLL;
#else
@ -292,15 +292,15 @@ static void *gluhandle = NULL;
char *gldriver = NULL, *glulibrary = NULL;
static void * getproc_(const char *s, int32_t *err, int32_t fatal, int32_t extension)
static void *getproc_(const char *s, int32_t *err, int32_t fatal, int32_t extension)
{
void *t;
#if defined RENDERTYPESDL
UNREFERENCED_PARAMETER(extension);
t = (void*)SDL_GL_GetProcAddress(s);
t = (void *)SDL_GL_GetProcAddress(s);
#elif defined _WIN32
if (extension) t = (void*)bwglGetProcAddress(s);
else t = (void*)GetProcAddress(hGLDLL,s);
if (extension) t = (void *)bwglGetProcAddress(s);
else t = (void *)GetProcAddress(hGLDLL,s);
#else
#error Need a dynamic loader for this platform...
#endif
@ -889,13 +889,13 @@ int32_t unloadgldriver(void)
return 0;
}
static void * glugetproc_(const char *s, int32_t *err, int32_t fatal)
static void *glugetproc_(const char *s, int32_t *err, int32_t fatal)
{
void *t;
#if defined _WIN32
t = (void*)GetProcAddress(hGLUDLL,s);
t = (void *)GetProcAddress(hGLUDLL,s);
#else
t = (void*)dlsym(gluhandle,s);
t = (void *)dlsym(gluhandle,s);
#endif
if (!t && fatal)
{

View file

@ -20,7 +20,7 @@ char hicfirstinit = 0;
//
// find the index into hicreplc[] which contains the replacement tile particulars
//
hicreplctyp * hicfindsubst(int32_t picnum, int32_t palnum, int32_t skybox)
hicreplctyp *hicfindsubst(int32_t picnum, int32_t palnum, int32_t skybox)
{
if (!hicfirstinit || (uint32_t)picnum >= (uint32_t)MAXTILES) return NULL;

View file

@ -206,7 +206,7 @@ static _inline int32_t bitrev(int32_t b, int32_t c)
mov edx, b
mov ecx, c
xor eax, eax
beg: shr edx, 1
beg: shr edx, 1
adc eax, eax
sub ecx, 1
jnz short beg
@ -230,7 +230,7 @@ static _inline int32_t testflag(int32_t c)
mov eax, 1
jne menostinx
xor eax, eax
menostinx:
menostinx:
}
}
@ -256,7 +256,7 @@ static _inline void cpuid(int32_t a, int32_t *s)
static inline uint32_t bswap(uint32_t a)
{
__asm__ __volatile__("bswap %0" : "+r"(a) : : "cc");
__asm__ __volatile__("bswap %0" : "+r"(a) : : "cc");
return a;
}
@ -337,7 +337,8 @@ static void suckbitsnextblock()
if (!zipfilmode)
{
if (!nfilptr)
{ //|===|===|crc|lng|typ|===|===|
{
//|===|===|crc|lng|typ|===|===|
// \ fakebuf: /
// |===|===|
//----x O---x O--------
@ -568,26 +569,26 @@ static _inline void rgbhlineasm(int32_t c, int32_t d, int32_t t, int32_t b)
add edx, offset olinbuf
cmp dword ptr trnsrgb, 0
jz short begit2
begit:
begit:
mov eax, dword ptr [ecx+edx]
or eax, 0xff000000
cmp eax, dword ptr trnsrgb
jne short skipit
and eax, 0xffffff
skipit:
skipit:
sub ecx, 3
mov [edi], eax
lea edi, [edi+ebx]
jnz short begit
jmp short endit
begit2:
begit2:
mov eax, dword ptr [ecx+edx]
or eax, 0xff000000
sub ecx, 3
mov [edi], eax
lea edi, [edi+ebx]
jnz short begit2
endit:
endit:
pop edi
pop ebx
}
@ -607,7 +608,7 @@ static _inline void pal8hlineasm(int32_t c, int32_t d, int32_t t, int32_t b)
mov edi, t
mov ebx, b
add edx, offset olinbuf
begit:movzx eax, byte ptr [ecx+edx]
begit:movzx eax, byte ptr [ecx+edx]
mov eax, dword ptr palcol[eax*4]
sub ecx, 1
mov [edi], eax
@ -615,7 +616,7 @@ begit:movzx eax, byte ptr [ecx+edx]
jnz short begit
pop edi
pop ebx
endit:
endit:
}
}
@ -1107,7 +1108,7 @@ static int32_t kpngrend(const char *kfilebuf, int32_t kfilength,
putbuf(slidebuf,slidew&32767);
}
kpngrend_goodret:;
kpngrend_goodret:;
if (!(filterest&~(1<<filter1st))) filtype = (int8_t)filter1st;
else if ((filter1st == 1) && (!(filterest&~(1<<3)))) filtype = 3;
else filtype = 5;
@ -1187,7 +1188,7 @@ static inline int32_t mulshr32(int32_t a, int32_t b)
#endif
static int32_t cosqr16[8] = //cosqr16[i] = ((cos(PI*i/16)*sqrt(2))<<24);
{23726566,23270667,21920489,19727919,16777216,13181774,9079764,4628823};
{23726566,23270667,21920489,19727919,16777216,13181774,9079764,4628823};
static int32_t crmul[4096], cbmul[4096];
static void initkpeg()
@ -1603,7 +1604,8 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
if (!dctbuf) quanptr = &quantab[lcompquantab[c]][0];
for (yy=0; yy<(lcompvsamp[c]<<3); yy+=8)
for (xx=0; xx<(lcomphsamp[c]<<3); xx+=8)
{ //NOTE: Might help to split this code into firstime vs. refinement (!Ah vs. Ah!=0)
{
//NOTE: Might help to split this code into firstime vs. refinement (!Ah vs. Ah!=0)
if (dctbuf) dcs = &ldctptr[c][(((y+yy)>>lshy[c])*ldctx[c] + ((x+xx)>>lshx[c]))<<6];
@ -1758,7 +1760,7 @@ static int32_t kpegrend(const char *kfilebuf, int32_t kfilength,
eobrun = 0;
}
}
kpegrend_break2:;
kpegrend_break2:;
if (!dctbuf) return(0);
passcnt++; kfileptr -= ((curbits>>3)+1); break;
case 0xd9: break;
@ -1825,7 +1827,8 @@ static int32_t kgifrend(const char *kfilebuf, int32_t kfilelength,
if (kfilebuf[10]&128) { cptr = ptr; ptr += paleng*3; }
transcol = -1;
while ((chunkind = *ptr++) == '!')
{ //! 0xf9 leng flags ? ? transcol
{
//! 0xf9 leng flags ? ? transcol
if (ptr[0] == 0xf9) { if (ptr[2]&1) transcol = (int32_t)(((uint8_t)ptr[5])); }
ptr++;
do { i = *ptr++; ptr += i; }
@ -2479,7 +2482,8 @@ void kpgetdim(const char *buf, int32_t leng, int32_t *xsiz, int32_t *ysiz)
(*ysiz) = LSWAPIB(*(int32_t *)&buf[12]);
}
else
{ //Unreliable .TGA identification - this MUST be final case!
{
//Unreliable .TGA identification - this MUST be final case!
if ((leng >= 19) && (!(ubuf[1]&0xfe)))
if ((ubuf[2] < 12) && ((1<<ubuf[2])&0xe0e))
if ((!(ubuf[16]&7)) && (ubuf[16] != 0) && (ubuf[16] <= 32))
@ -2896,7 +2900,7 @@ int32_t kzfindfile(char *filnam)
{
int32_t i;
kzfindfile_beg:;
kzfindfile_beg:;
filnam[0] = 0;
if (srchstat == 0)
{
@ -3091,7 +3095,7 @@ int32_t kzread(void *buffer, int32_t leng)
case 2: goto kzreadplc2;
case 3: goto kzreadplc3;
}
kzreadplc0:;
kzreadplc0:;
do
{
bfinal = getbits(1); btype = getbits(2);
@ -3131,7 +3135,7 @@ kzreadplc0:;
{
kzfs.jmpplc = 1; kzfs.i = i; kzfs.bfinal = bfinal;
goto retkzread;
kzreadplc1:; i = kzfs.i; bfinal = kzfs.bfinal;
kzreadplc1:; i = kzfs.i; bfinal = kzfs.bfinal;
}
}
slidebuf[(gslidew++)&32767] = (uint8_t)getbits(8);
@ -3185,7 +3189,7 @@ kzreadplc1:; i = kzfs.i; bfinal = kzfs.bfinal;
if (gslider-16384 >= kzfs.endpos)
{
kzfs.jmpplc = 2; kzfs.bfinal = bfinal; goto retkzread;
kzreadplc2:; bfinal = kzfs.bfinal;
kzreadplc2:; bfinal = kzfs.bfinal;
}
}
@ -3215,10 +3219,10 @@ kzreadplc2:; bfinal = kzfs.bfinal;
putbuf4zip(&slidebuf[gslider&32767],gslider,gslidew&~32767);
putbuf4zip(slidebuf,gslidew&~32767,gslidew);
}
kzreadplc3:; kzfs.jmpplc = 3;
kzreadplc3:; kzfs.jmpplc = 3;
}
retkzread:;
retkzread:;
i = kzfs.pos;
kzfs.pos += leng; if (kzfs.pos > kzfs.leng) kzfs.pos = kzfs.leng;
return(kzfs.pos-i);

View file

@ -24,7 +24,7 @@
documentation and/or software.
*/
typedef unsigned char * POINTER;
typedef unsigned char *POINTER;
typedef unsigned short UINT2;
typedef unsigned int UINT4;

View file

@ -59,8 +59,8 @@ static int32_t maxmodeltris = 0, allocmodeltris = 0;
static point3d *vertlist = NULL; //temp array to store interpolated vertices for drawing
static int32_t allocvbos = 0, curvbo = 0;
static GLuint* vertvbos = NULL;
static GLuint* indexvbos = NULL;
static GLuint *vertvbos = NULL;
static GLuint *indexvbos = NULL;
mdmodel_t *mdload(const char *);
int32_t mddraw(spritetype *);
@ -118,13 +118,13 @@ void freeallmodels()
}
freevbos();
/*
/*
if (model_data_pool)
{
neddestroypool(model_data_pool);
model_data_pool = NULL;
}
*/
*/
}
void clearskins()
@ -137,27 +137,27 @@ void clearskins()
m = models[i];
if (m->mdnum == 1)
{
voxmodel_t *v = (voxmodel_t*)m;
voxmodel_t *v = (voxmodel_t *)m;
for (j=0; j<MAXPALOOKUPS; j++)
{
if (v->texid[j]) bglDeleteTextures(1,(GLuint*)&v->texid[j]);
if (v->texid[j]) bglDeleteTextures(1,(GLuint *)&v->texid[j]);
v->texid[j] = 0;
}
}
else if (m->mdnum == 2 || m->mdnum == 3)
{
md2model_t *m2 = (md2model_t*)m;
md2model_t *m2 = (md2model_t *)m;
mdskinmap_t *sk;
for (j=0; j<m2->numskins*(HICEFFECTMASK+1); j++)
{
if (m2->texid[j]) bglDeleteTextures(1,(GLuint*)&m2->texid[j]);
if (m2->texid[j]) bglDeleteTextures(1,(GLuint *)&m2->texid[j]);
m2->texid[j] = 0;
}
for (sk=m2->skinmap; sk; sk=sk->next)
for (j=0; j<(HICEFFECTMASK+1); j++)
{
if (sk->texid[j]) bglDeleteTextures(1,(GLuint*)&sk->texid[j]);
if (sk->texid[j]) bglDeleteTextures(1,(GLuint *)&sk->texid[j]);
sk->texid[j] = 0;
}
}
@ -165,10 +165,10 @@ void clearskins()
for (i=0; i<MAXVOXELS; i++)
{
voxmodel_t *v = (voxmodel_t*)voxmodels[i]; if (!v) continue;
voxmodel_t *v = (voxmodel_t *)voxmodels[i]; if (!v) continue;
for (j=0; j<MAXPALOOKUPS; j++)
{
if (v->texid[j]) bglDeleteTextures(1,(GLuint*)&v->texid[j]);
if (v->texid[j]) bglDeleteTextures(1,(GLuint *)&v->texid[j]);
v->texid[j] = 0;
}
}
@ -191,7 +191,7 @@ int32_t md_loadmodel(const char *fn)
if (nextmodelid >= nummodelsalloced)
{
ml = (mdmodel_t **)Brealloc(models,(nummodelsalloced+MODELALLOCGROUP)*sizeof(void*)); if (!ml) return(-1);
ml = (mdmodel_t **)Brealloc(models,(nummodelsalloced+MODELALLOCGROUP)*sizeof(void *)); if (!ml) return(-1);
models = ml; nummodelsalloced += MODELALLOCGROUP;
}
@ -272,7 +272,7 @@ int32_t md_defineframe(int32_t modelid, const char *framename, int32_t tilenume,
return 0;
}
i = framename2index((mdmodel_t*)m,framename);
i = framename2index((mdmodel_t *)m,framename);
if (i == m->numframes) return(-3); // frame name invalid
tile2model[tilenume].modelid = modelid;
@ -298,19 +298,19 @@ int32_t md_defineanimation(int32_t modelid, const char *framestart, const char *
if (m->mdnum < 2) return 0;
//find index of start frame
i = framename2index((mdmodel_t*)m,framestart);
i = framename2index((mdmodel_t *)m,framestart);
if (i == m->numframes) return -2;
ma.startframe = i;
//find index of finish frame which must trail start frame
i = framename2index((mdmodel_t*)m,frameend);
i = framename2index((mdmodel_t *)m,frameend);
if (i == m->numframes) return -3;
ma.endframe = i;
ma.fpssc = fpssc;
ma.flags = flags;
map = (mdanim_t*)Bcalloc(1,sizeof(mdanim_t));
map = (mdanim_t *)Bcalloc(1,sizeof(mdanim_t));
if (!map) return(-4);
Bmemcpy(map, &ma, sizeof(ma));
@ -789,15 +789,15 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
willprint = 1;
if (pal < (MAXPALOOKUPS - RESERVEDPALS)) m->usesalpha = hasalpha;
if ((doalloc&3)==1) bglGenTextures(1,(GLuint*)texidx);
if ((doalloc&3)==1) bglGenTextures(1,(GLuint *)texidx);
bglBindTexture(GL_TEXTURE_2D,*texidx);
//gluBuild2DMipmaps(GL_TEXTURE_2D,GL_RGBA,xsiz,ysiz,GL_BGRA_EXT,GL_UNSIGNED_BYTE,(char *)fptr);
if (glinfo.texcompr && glusetexcompr) intexfmt = hasalpha ? GL_COMPRESSED_RGBA_ARB : GL_COMPRESSED_RGB_ARB;
else if (!hasalpha) intexfmt = GL_RGB;
if (glinfo.bgra) texfmt = GL_BGRA;
uploadtexture((doalloc&1), xsiz, ysiz, intexfmt, texfmt, (coltype*)fptr, xsiz, ysiz, 0|8192);
Bfree((void*)fptr);
uploadtexture((doalloc&1), xsiz, ysiz, intexfmt, texfmt, (coltype *)fptr, xsiz, ysiz, 0|8192);
Bfree((void *)fptr);
}
if (!m->skinloaded)
@ -1097,7 +1097,7 @@ static md2model_t *md2load(int32_t fil, const char *filnam)
m->tris[i].u[1] = B_LITTLE16(m->tris[i].u[1]);
m->tris[i].u[2] = B_LITTLE16(m->tris[i].u[2]);
}
for(i = head.numuv-1; i>=0; i--)
for (i = head.numuv-1; i>=0; i--)
{
m->uv[i].u = B_LITTLE16(m->uv[i].u);
m->uv[i].v = B_LITTLE16(m->uv[i].v);
@ -1430,7 +1430,7 @@ static md3model_t *md3load(int32_t fil)
}
for (i=s->numverts-1; i>=0; i--)
{
l = (int32_t*)&s->uv[i].u;
l = (int32_t *)&s->uv[i].u;
l[0] = B_LITTLE32(l[0]);
l[1] = B_LITTLE32(l[1]);
}
@ -1490,7 +1490,7 @@ static md3model_t *md3load(int32_t fil)
return(m);
}
static inline void invertmatrix(float* m, float* out)
static inline void invertmatrix(float *m, float *out)
{
float det;
@ -1513,7 +1513,7 @@ static inline void invertmatrix(float* m, float* out)
out[8] = det * (m[0] * m[4] - m[1] * m[3]);
}
static inline void normalize(float* vec)
static inline void normalize(float *vec)
{
double norm;
@ -1526,7 +1526,7 @@ static inline void normalize(float* vec)
vec[2] *= norm;
}
static void md3postload_common(md3model_t* m)
static void md3postload_common(md3model_t *m)
{
int framei, surfi, verti;
md3frame_t *frame;
@ -1644,7 +1644,8 @@ static int md3postload_polymer_check(md3model_t *m)
// let the vertices know they're being referenced by a triangle
if (s->tris[trii].i[0] >= s->numverts || s->tris[trii].i[0] < 0 ||
s->tris[trii].i[1] >= s->numverts || s->tris[trii].i[1] < 0 ||
s->tris[trii].i[2] >= s->numverts || s->tris[trii].i[2] < 0) {
s->tris[trii].i[2] >= s->numverts || s->tris[trii].i[2] < 0)
{
// corrupt model
OSD_Printf("Triangle index out of bounds!\n");
return 0;
@ -1660,7 +1661,7 @@ static int md3postload_polymer_check(md3model_t *m)
}
#endif
int md3postload_polymer(md3model_t* m)
int md3postload_polymer(md3model_t *m)
{
#ifdef POLYMER
int framei, surfi, verti, trii, i;
@ -1711,7 +1712,8 @@ int md3postload_polymer(md3model_t* m)
// let the vertices know they're being referenced by a triangle
if (s->tris[trii].i[0] >= s->numverts || s->tris[trii].i[0] < 0 ||
s->tris[trii].i[1] >= s->numverts || s->tris[trii].i[1] < 0 ||
s->tris[trii].i[2] >= s->numverts || s->tris[trii].i[2] < 0) {
s->tris[trii].i[2] >= s->numverts || s->tris[trii].i[2] < 0)
{
// corrupt model
Bfree(numtris);
OSD_Printf("Triangle index out of bounds!\n");
@ -1816,9 +1818,9 @@ static int32_t md3draw(md3model_t *m, spritetype *tspr)
int32_t texunits = GL_TEXTURE0_ARB;
mdskinmap_t *sk;
//PLAG : sorting stuff
void* vbotemp;
point3d* vertexhandle = NULL;
uint16_t* indexhandle;
void *vbotemp;
point3d *vertexhandle = NULL;
uint16_t *indexhandle;
char lpal = (tspr->owner >= MAXSPRITES) ? tspr->pal : sprite[tspr->owner].pal;
if (r_vbos && (m->vbos == NULL))
@ -2406,7 +2408,7 @@ uint32_t gloadtex(int32_t *picbuf, int32_t xsiz, int32_t ysiz, int32_t is8bit, i
pic = (coltype *)picbuf; //Correct for GL's RGB order; also apply gamma here..
pic2 = (coltype *)Bmalloc(xsiz*ysiz*sizeof(int32_t)); if (!pic2) return((unsigned)-1);
cptr = (char*)&britable[gammabrightness ? 0 : curbrightness][0];
cptr = (char *)&britable[gammabrightness ? 0 : curbrightness][0];
if (!is8bit)
{
for (i=xsiz*ysiz-1; i>=0; i--)
@ -2429,7 +2431,7 @@ uint32_t gloadtex(int32_t *picbuf, int32_t xsiz, int32_t ysiz, int32_t is8bit, i
}
}
bglGenTextures(1,(GLuint*)&rtexid);
bglGenTextures(1,(GLuint *)&rtexid);
bglBindTexture(GL_TEXTURE_2D,rtexid);
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
@ -3208,7 +3210,7 @@ mdmodel_t *mdload(const char *filnam)
int32_t fil;
int32_t i;
vm = (mdmodel_t*)voxload(filnam); if (vm) return(vm);
vm = (mdmodel_t *)voxload(filnam); if (vm) return(vm);
fil = kopen4load((char *)filnam,0); if (fil < 0) return(0);
kread(fil,&i,4); klseek(fil,0,SEEK_SET);
@ -3217,30 +3219,30 @@ mdmodel_t *mdload(const char *filnam)
{
case 0x32504449:
// initprintf("Warning: model '%s' is version IDP2; wanted version IDP3\n",filnam);
vm = (mdmodel_t*)md2load(fil,filnam);
vm = (mdmodel_t *)md2load(fil,filnam);
break; //IDP2
case 0x33504449:
vm = (mdmodel_t*)md3load(fil);
vm = (mdmodel_t *)md3load(fil);
break; //IDP3
default:
vm = (mdmodel_t*)0; break;
vm = (mdmodel_t *)0; break;
}
kclose(fil);
if (vm)
{
md3postload_common((md3model_t*)vm);
md3postload_common((md3model_t *)vm);
#ifdef POLYMER
// implies defined(POLYMOST) && defined(USE_OPENGL)?
if (glrendmode==4)
i = md3postload_polymer((md3model_t*)vm);
i = md3postload_polymer((md3model_t *)vm);
else
i = md3postload_polymer_check((md3model_t*)vm);
i = md3postload_polymer_check((md3model_t *)vm);
if (!i)
{
mdfree(vm);
vm = (mdmodel_t*)0;
vm = (mdmodel_t *)0;
}
#endif
}

File diff suppressed because it is too large Load diff

View file

@ -27,7 +27,7 @@ static int32_t _internal_osdfunc_alias(const osdfuncparm_t *);
static int32_t white=-1; // colour of white (used by default display routines)
static void _internal_drawosdchar(int32_t, int32_t, char, int32_t, int32_t);
static void _internal_drawosdstr(int32_t, int32_t, char*, int32_t, int32_t, int32_t);
static void _internal_drawosdstr(int32_t, int32_t, char *, int32_t, int32_t, int32_t);
static void _internal_drawosdcursor(int32_t,int32_t,int32_t,int32_t);
static int32_t _internal_getcolumnwidth(int32_t);
static int32_t _internal_getrowheight(int32_t);
@ -105,7 +105,7 @@ static hashtable_t h_osd = { MAXSYMBOLS<<1, NULL };
// application callbacks
static void (*drawosdchar)(int32_t, int32_t, char, int32_t, int32_t) = _internal_drawosdchar;
static void (*drawosdstr)(int32_t, int32_t, char*, int32_t, int32_t, int32_t) = _internal_drawosdstr;
static void (*drawosdstr)(int32_t, int32_t, char *, int32_t, int32_t, int32_t) = _internal_drawosdstr;
static void (*drawosdcursor)(int32_t, int32_t, int32_t, int32_t) = _internal_drawosdcursor;
static int32_t (*getcolumnwidth)(int32_t) = _internal_getcolumnwidth;
static int32_t (*getrowheight)(int32_t) = _internal_getrowheight;
@ -114,7 +114,7 @@ static int32_t (*gettime)(void) = _internal_gettime;
static void (*onshowosd)(int32_t) = _internal_onshowosd;
static void (*_drawosdchar)(int32_t, int32_t, char, int32_t, int32_t) = _internal_drawosdchar;
static void (*_drawosdstr)(int32_t, int32_t, char*, int32_t, int32_t, int32_t) = _internal_drawosdstr;
static void (*_drawosdstr)(int32_t, int32_t, char *, int32_t, int32_t, int32_t) = _internal_drawosdstr;
static void (*_drawosdcursor)(int32_t, int32_t, int32_t, int32_t) = _internal_drawosdcursor;
static int32_t (*_getcolumnwidth)(int32_t) = _internal_getcolumnwidth;
static int32_t (*_getrowheight)(int32_t) = _internal_getrowheight;
@ -221,7 +221,7 @@ static int32_t OSD_CvarModified(const osdcvar_t *cvar)
// ^S# sets a shade, range is 0-7 equiv to shades 0-14
// ^O resets formatting to defaults
const char * OSD_StripColors(char *out, const char *in)
const char *OSD_StripColors(char *out, const char *in)
{
const char *ptr = out;
@ -254,7 +254,7 @@ const char * OSD_StripColors(char *out, const char *in)
int32_t OSD_Exec(const char *szScript)
{
FILE* fp = fopenfrompath(szScript, "r");
FILE *fp = fopenfrompath(szScript, "r");
if (fp != NULL)
{
@ -281,19 +281,19 @@ int32_t OSD_OSDKey(void)
return osdkey;
}
char * OSD_GetTextPtr(void)
char *OSD_GetTextPtr(void)
{
return (&osdtext[0]);
return osdtext;
}
char * OSD_GetFmtPtr(void)
char *OSD_GetFmtPtr(void)
{
return (&osdfmt[0]);
return osdfmt;
}
char * OSD_GetFmt(char *ptr)
char *OSD_GetFmt(char *ptr)
{
return (ptr - &osdtext[0] + &osdfmt[0]);
return (ptr - osdtext + osdfmt);
}
int32_t OSD_GetCols(void)
@ -603,13 +603,9 @@ static int32_t _internal_osdfunc_help(const osdfuncparm_t *parm)
if (parm->numparms != 1) return OSDCMD_SHOWHELP;
symb = findexactsymbol(parm->parms[0]);
if (!symb)
{
OSD_Printf("Help Error: \"%s\" is not a defined variable or function\n", parm->parms[0]);
}
OSD_Printf("Error: no help for undefined symbol \"%s\"\n", parm->parms[0]);
else
{
OSD_Printf("%s\n", symb->help);
}
return OSDCMD_OK;
}
@ -653,8 +649,11 @@ void OSD_Cleanup(void)
Bfree(symbols);
}
if (osdlog) Bfclose(osdlog);
if (osdlog)
{
Bfclose(osdlog);
osdlog = NULL;
}
if (cvars)
{
@ -717,15 +716,15 @@ void OSD_Init(void)
uint32_t i;
cvar_t cvars_osd[] =
{
{ "osdeditpal","osdeditpal: sets the palette of the OSD input text",(void *)&osdeditpal, CVAR_INT, 0, MAXPALOOKUPS-1 },
{ "osdpromptpal","osdpromptpal: sets the palette of the OSD prompt",(void *)&osdpromptpal, CVAR_INT, 0, MAXPALOOKUPS-1 },
{ "osdtextpal","osdtextpal: sets the palette of the OSD text",(void *)&osdtextpal, CVAR_INT, 0, MAXPALOOKUPS-1 },
{ "osdeditshade","osdeditshade: sets the shade of the OSD input text",(void *)&osdeditshade, CVAR_INT, 0, 7 },
{ "osdtextshade","osdtextshade: sets the shade of the OSD text",(void *)&osdtextshade, CVAR_INT, 0, 7 },
{ "osdpromptshade","osdpromptshade: sets the shade of the OSD prompt",(void *)&osdpromptshade, CVAR_INT, INT8_MIN, INT8_MAX },
{ "osdrows","osdrows: sets the number of visible lines of the OSD",(void *)&osdrows, CVAR_INT|CVAR_FUNCPTR, 0, MAXPALOOKUPS-1 },
{ "osdtextmode","osdtextmode: set OSD text mode (0:graphical, 1:fast)",(void *)&osdtextmode, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 },
{ "logcutoff","logcutoff: sets the maximal line count of the log file",(void *)&logcutoff, CVAR_INT, 0, 262144 },
{ "osdeditpal","osdeditpal: sets the palette of the OSD input text",(void *) &osdeditpal, CVAR_INT, 0, MAXPALOOKUPS-1 },
{ "osdpromptpal","osdpromptpal: sets the palette of the OSD prompt",(void *) &osdpromptpal, CVAR_INT, 0, MAXPALOOKUPS-1 },
{ "osdtextpal","osdtextpal: sets the palette of the OSD text",(void *) &osdtextpal, CVAR_INT, 0, MAXPALOOKUPS-1 },
{ "osdeditshade","osdeditshade: sets the shade of the OSD input text",(void *) &osdeditshade, CVAR_INT, 0, 7 },
{ "osdtextshade","osdtextshade: sets the shade of the OSD text",(void *) &osdtextshade, CVAR_INT, 0, 7 },
{ "osdpromptshade","osdpromptshade: sets the shade of the OSD prompt",(void *) &osdpromptshade, CVAR_INT, INT8_MIN, INT8_MAX },
{ "osdrows","osdrows: sets the number of visible lines of the OSD",(void *) &osdrows, CVAR_INT|CVAR_FUNCPTR, 0, MAXPALOOKUPS-1 },
{ "osdtextmode","osdtextmode: set OSD text mode (0:graphical, 1:fast)",(void *) &osdtextmode, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 },
{ "logcutoff","logcutoff: sets the maximal line count of the log file",(void *) &logcutoff, CVAR_INT, 0, 262144 },
};
mutex_init(&m_osdprintf);
@ -770,10 +769,14 @@ void OSD_Init(void)
//
void OSD_SetLogFile(char *fn)
{
if (osdlog) Bfclose(osdlog);
if (osdlog)
{
Bfclose(osdlog);
osdlog = NULL;
}
if (fn) osdlog = Bfopen(fn,"w");
if (osdlog) setvbuf(osdlog, (char*)NULL, _IONBF, 0);
if (osdlog) setvbuf(osdlog, (char *)NULL, _IONBF, 0);
}
@ -782,7 +785,7 @@ void OSD_SetLogFile(char *fn)
//
void OSD_SetFunctions(
void (*drawchar)(int32_t,int32_t,char,int32_t,int32_t),
void (*drawstr)(int32_t,int32_t,char*,int32_t,int32_t,int32_t),
void (*drawstr)(int32_t,int32_t,char *,int32_t,int32_t,int32_t),
void (*drawcursor)(int32_t,int32_t,int32_t,int32_t),
int32_t (*colwidth)(int32_t),
int32_t (*rowheight)(int32_t),
@ -1505,11 +1508,6 @@ void OSD_Printf(const char *fmt, ...)
char *chp, p=osdtextpal, s=osdtextshade;
va_list va;
/*
if ((osdflags & OSD_INITIALIZED) == 0)
OSD_Init();
*/
mutex_lock(&m_osdprintf);
va_start(va, fmt);
@ -1518,28 +1516,30 @@ void OSD_Printf(const char *fmt, ...)
if (tmpstr[0]=='^' && tmpstr[1]=='1' && tmpstr[2]=='0' && ++OSD_errors > MAX_ERRORS)
{
if (OSD_errors == MAX_ERRORS+1) Bstrcpy(tmpstr,OSD_ERROR "\nToo many errors. Logging errors stopped.\n");
if (OSD_errors == MAX_ERRORS + 1)
Bstrcpy(tmpstr, OSD_ERROR "\nToo many errors. Logging errors stopped.\n");
else
{
OSD_errors=MAX_ERRORS+2;
OSD_errors = MAX_ERRORS + 2;
mutex_unlock(&m_osdprintf);
return;
}
}
if (linecnt<logcutoff)
if (linecnt < logcutoff)
{
if (osdlog&&(!logcutoff||linecnt<logcutoff))
if (osdlog && (!logcutoff || linecnt < logcutoff))
{
chp = Bstrdup(tmpstr);
Bfputs(OSD_StripColors(chp,tmpstr), osdlog);
Bfputs(OSD_StripColors(chp, tmpstr), osdlog);
Bprintf("%s", chp);
Bfree(chp);
}
}
else if (linecnt==logcutoff)
else if (linecnt == logcutoff)
{
Bfputs("\nMaximal log size reached. Logging stopped.\nSet the \"logcutoff\" console variable to a higher value if you need a longer log.\n", osdlog);
linecnt=logcutoff+1;
linecnt = logcutoff + 1;
}
chp = tmpstr;
@ -1552,11 +1552,13 @@ void OSD_Printf(const char *fmt, ...)
OSD_LineFeed();
continue;
}
if (*chp == '\r')
{
osdpos=0;
continue;
}
if (*chp == '^')
{
if (isdigit(*(chp+1)))
@ -1569,12 +1571,14 @@ void OSD_Printf(const char *fmt, ...)
p = atol(smallbuf);
continue;
}
smallbuf[0] = *(chp++);
smallbuf[1] = *(chp);
smallbuf[2] = '\0';
p = atol(smallbuf);
continue;
}
if (Btoupper(*(chp+1)) == 'S')
{
chp++;
@ -1582,6 +1586,7 @@ void OSD_Printf(const char *fmt, ...)
s = *chp;
continue;
}
if (Btoupper(*(chp+1)) == 'O')
{
chp++;
@ -1590,8 +1595,10 @@ void OSD_Printf(const char *fmt, ...)
continue;
}
}
osdtext[osdpos] = *chp;
osdfmt[osdpos++] = p+(s<<5);
if (osdpos == osdcols)
{
osdpos = 0;
@ -1766,11 +1773,11 @@ int32_t OSD_Dispatch(const char *cmd)
ofp.parms = (const char **)parms;
ofp.raw = cmd;
switch((intptr_t)symb->func)
switch ((intptr_t)symb->func)
{
case (intptr_t)OSD_ALIAS:
case(intptr_t)OSD_ALIAS:
OSD_Dispatch(symb->help);
case (intptr_t)OSD_UNALIASED:
case(intptr_t)OSD_UNALIASED:
break;
default:
switch (symb->func(&ofp))
@ -1797,7 +1804,7 @@ int32_t OSD_Dispatch(const char *cmd)
//
// OSD_RegisterFunction() -- Registers a new function
//
int32_t OSD_RegisterFunction(const char *name, const char *help, int32_t (*func)(const osdfuncparm_t*))
int32_t OSD_RegisterFunction(const char *name, const char *help, int32_t (*func)(const osdfuncparm_t *))
{
symbol_t *symb;
const char *cp;
@ -1841,13 +1848,13 @@ int32_t OSD_RegisterFunction(const char *name, const char *help, int32_t (*func)
if (symb) // allow this now for reusing an alias name
{
/*
/*
if (symb->func != OSD_ALIAS && symb->func != OSD_UNALIASED)
{
OSD_Printf("OSD_RegisterFunction(): \"%s\" is already defined\n", name);
return -1;
}
*/
*/
// Bfree((char *)symb->help);
symb->help = help;
symb->func = func;
@ -1998,7 +2005,7 @@ int32_t osdcmd_cvar_set(const osdfuncparm_t *parm)
float val;
if (showval)
{
OSD_Printf("\"%s\" is \"%f\"\n%s\n",cvars[i].name,*(float*)cvars[i].var,(char*)cvars[i].helpstr);
OSD_Printf("\"%s\" is \"%f\"\n%s\n",cvars[i].name,*(float *)cvars[i].var,(char *)cvars[i].helpstr);
return OSDCMD_OK;
}
@ -2009,7 +2016,7 @@ int32_t osdcmd_cvar_set(const osdfuncparm_t *parm)
OSD_Printf("%s value out of range\n",cvars[i].name);
return OSDCMD_OK;
}
*(float*)cvars[i].var = val;
*(float *)cvars[i].var = val;
if (!OSD_ParsingScript())
OSD_Printf("%s %f",cvars[i].name,val);
}
@ -2019,7 +2026,7 @@ int32_t osdcmd_cvar_set(const osdfuncparm_t *parm)
double val;
if (showval)
{
OSD_Printf("\"%s\" is \"%f\"\n%s\n",cvars[i].name,*(double*)cvars[i].var,(char*)cvars[i].helpstr);
OSD_Printf("\"%s\" is \"%f\"\n%s\n",cvars[i].name,*(double *)cvars[i].var,(char *)cvars[i].helpstr);
return OSDCMD_OK;
}
@ -2030,7 +2037,7 @@ int32_t osdcmd_cvar_set(const osdfuncparm_t *parm)
OSD_Printf("%s value out of range\n",cvars[i].name);
return OSDCMD_OK;
}
*(double*)cvars[i].var = val;
*(double *)cvars[i].var = val;
if (!OSD_ParsingScript())
OSD_Printf("%s %f",cvars[i].name,val);
}
@ -2042,7 +2049,7 @@ int32_t osdcmd_cvar_set(const osdfuncparm_t *parm)
int32_t val;
if (showval)
{
OSD_Printf("\"%s\" is \"%d\"\n%s\n",cvars[i].name,*(int32_t*)cvars[i].var,(char*)cvars[i].helpstr);
OSD_Printf("\"%s\" is \"%d\"\n%s\n",cvars[i].name,*(int32_t *)cvars[i].var,(char *)cvars[i].helpstr);
return OSDCMD_OK;
}
@ -2054,7 +2061,7 @@ int32_t osdcmd_cvar_set(const osdfuncparm_t *parm)
OSD_Printf("%s value out of range\n",cvars[i].name);
return OSDCMD_OK;
}
*(int32_t*)cvars[i].var = val;
*(int32_t *)cvars[i].var = val;
if (!OSD_ParsingScript())
OSD_Printf("%s %d",cvars[i].name,val);
}
@ -2063,14 +2070,14 @@ int32_t osdcmd_cvar_set(const osdfuncparm_t *parm)
{
if (showval)
{
OSD_Printf("\"%s\" is \"%s\"\n%s\n",cvars[i].name,(char*)cvars[i].var,(char*)cvars[i].helpstr);
OSD_Printf("\"%s\" is \"%s\"\n%s\n",cvars[i].name,(char *)cvars[i].var,(char *)cvars[i].helpstr);
return OSDCMD_OK;
}
Bstrncpy((char*)cvars[i].var, parm->parms[0], cvars[i].max-1);
((char*)cvars[i].var)[cvars[i].max-1] = 0;
Bstrncpy((char *)cvars[i].var, parm->parms[0], cvars[i].max-1);
((char *)cvars[i].var)[cvars[i].max-1] = 0;
if (!OSD_ParsingScript())
OSD_Printf("%s %s",cvars[i].name,(char*)cvars[i].var);
OSD_Printf("%s %s",cvars[i].name,(char *)cvars[i].var);
}
break;
default:
@ -2097,10 +2104,10 @@ void OSD_WriteCvars(FILE *fp)
switch (cvars[i].type&(CVAR_FLOAT|CVAR_DOUBLE|CVAR_INT|CVAR_UINT|CVAR_BOOL|CVAR_STRING))
{
case CVAR_FLOAT:
fprintf(fp,"%s \"%f\"\n",cvars[i].name,*(float*)cvars[i].var);
fprintf(fp,"%s \"%f\"\n",cvars[i].name,*(float *)cvars[i].var);
break;
case CVAR_DOUBLE:
fprintf(fp,"%s \"%f\"\n",cvars[i].name,*(double*)cvars[i].var);
fprintf(fp,"%s \"%f\"\n",cvars[i].name,*(double *)cvars[i].var);
break;
case CVAR_INT:
case CVAR_UINT:
@ -2108,7 +2115,7 @@ void OSD_WriteCvars(FILE *fp)
fprintf(fp,"%s \"%d\"\n",cvars[i].name,*(int32_t *)cvars[i].var);
break;
case CVAR_STRING:
fprintf(fp,"%s \"%s\"\n",cvars[i].name,(char*)cvars[i].var);
fprintf(fp,"%s \"%s\"\n",cvars[i].name,(char *)cvars[i].var);
break;
default:
break;

View file

@ -300,10 +300,10 @@ pthtyp *gltexcachead[GLTEXCACHEADSIZ];
int32_t drawingskybox = 0;
int32_t gloadtile_art(int32_t,int32_t,int32_t,pthtyp*,int32_t);
int32_t gloadtile_hi(int32_t,int32_t,int32_t,hicreplctyp*,int32_t,pthtyp*,int32_t,char);
int32_t gloadtile_art(int32_t,int32_t,int32_t,pthtyp *,int32_t);
int32_t gloadtile_hi(int32_t,int32_t,int32_t,hicreplctyp *,int32_t,pthtyp *,int32_t,char);
static int32_t hicprecaching = 0;
pthtyp * gltexcache(int32_t dapicnum, int32_t dapalnum, int32_t dameth)
pthtyp *gltexcache(int32_t dapicnum, int32_t dapalnum, int32_t dameth)
{
int32_t i, j;
hicreplctyp *si;
@ -1199,7 +1199,7 @@ int32_t gloadtile_art(int32_t dapic, int32_t dapal, int32_t dameth, pthtyp *pth,
}
}
if (doalloc) bglGenTextures(1,(GLuint*)&pth->glpic); //# of textures (make OpenGL allocate structure)
if (doalloc) bglGenTextures(1,(GLuint *)&pth->glpic); //# of textures (make OpenGL allocate structure)
bglBindTexture(GL_TEXTURE_2D,pth->glpic);
fixtransparency(pic,tsizx,tsizy,xsiz,ysiz,dameth);
@ -1558,7 +1558,7 @@ int32_t gloadtile_cached(int32_t fil, texcacheheader *head, int32_t *doalloc, pt
if (*doalloc&1)
{
bglGenTextures(1,(GLuint*)&pth->glpic); //# of textures (make OpenGL allocate structure)
bglGenTextures(1,(GLuint *)&pth->glpic); //# of textures (make OpenGL allocate structure)
*doalloc |= 2; // prevents bglGenTextures being called again if we fail in here
}
bglBindTexture(GL_TEXTURE_2D,pth->glpic);
@ -1829,7 +1829,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
intexfmt = (hasalpha == 255) ? GL_COMPRESSED_RGB_ARB : GL_COMPRESSED_RGBA_ARB;
else if (hasalpha == 255) intexfmt = GL_RGB;
if ((doalloc&3)==1) bglGenTextures(1,(GLuint*)&pth->glpic); //# of textures (make OpenGL allocate structure)
if ((doalloc&3)==1) bglGenTextures(1,(GLuint *)&pth->glpic); //# of textures (make OpenGL allocate structure)
bglBindTexture(GL_TEXTURE_2D,pth->glpic);
fixtransparency(pic,tsizx,tsizy,xsiz,ysiz,dameth);
@ -2897,7 +2897,7 @@ void domost(float x0, float y0, float x1, float y1)
{
d = (y0-y1)*dx - (x0-x1)*cv[j];
n = (y0-cy[j])*dx - (x0-nx0)*cv[j];
if ((fabs(n) <= fabs(d)) && (d*n >= 0) && (d != 0))
if ((fabs(n) <= fabs(d)) && (d *n >= 0) && (d != 0))
{
t = n/d; nx = (x1-x0)*t + x0;
if ((nx > nx0) && (nx < nx1))
@ -4168,7 +4168,7 @@ static void polymost_scansector(int32_t sectnum)
if ((nextsectnum >= 0) && (!(wal->cstat&32)) && (!(gotsector[nextsectnum>>3]&pow2char[nextsectnum&7])))
{
d = (double)x1*(double)y2 - (double)x2*(double)y1; xp1 = (double)(x2-x1); yp1 = (double)(y2-y1);
if (d*d <= (xp1*xp1 + yp1*yp1)*(SCISDIST*SCISDIST*260.0))
if (d *d <= (xp1*xp1 + yp1*yp1)*(SCISDIST*SCISDIST*260.0))
sectorborder[sectorbordercnt++] = nextsectnum;
}
@ -5305,13 +5305,16 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
if (dastat&4) { x1 = -x1; y1 = -y1; }
// In Polymost, we don't care if the model is very big
if (rendmode < 4) {
if (rendmode < 4)
{
tspr.xrepeat = tspr.yrepeat = 32;
tspr.x = (int32_t)(((double)gcosang*z1 - (double)gsinang*x1)*16384.0 + globalposx);
tspr.y = (int32_t)(((double)gsinang*z1 + (double)gcosang*x1)*16384.0 + globalposy);
tspr.z = (int32_t)(globalposz + y1*16384.0*0.8);
} else {
}
else
{
float x, y, z;
tspr.xrepeat = tspr.yrepeat = 5;
@ -5373,7 +5376,8 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
if (!nofog) bglDisable(GL_FOG);
if (rendmode < 4)
mddraw(&tspr);
else {
else
{
tspriteptr[MAXSPRITESONSCREEN] = &tspr;
bglEnable(GL_ALPHA_TEST);
@ -5652,9 +5656,9 @@ static void tessectrap(float *px, float *py, int32_t *point2, int32_t numpoints)
if (numpoints+16 > allocpoints) //16 for safety
{
allocpoints = numpoints+16;
rst = (raster*)Brealloc(rst,allocpoints*sizeof(raster));
slist = (int32_t*)Brealloc(slist,allocpoints*sizeof(int32_t));
npoint2 = (int32_t*)Brealloc(npoint2,allocpoints*sizeof(int32_t));
rst = (raster *)Brealloc(rst,allocpoints*sizeof(raster));
slist = (int32_t *)Brealloc(slist,allocpoints*sizeof(int32_t));
npoint2 = (int32_t *)Brealloc(npoint2,allocpoints*sizeof(int32_t));
}
//Remove unnecessary collinear points:
@ -5949,7 +5953,7 @@ int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t ba
}
Bmemset(tbuf, 0, 256*128);
cptr = (char*)textfont;
cptr = (char *)textfont;
for (h=0; h<256; h++)
{
tptr = tbuf + (h%32)*8 + (h/32)*256*8;
@ -5963,7 +5967,7 @@ int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t ba
}
}
cptr = (char*)smalltextfont;
cptr = (char *)smalltextfont;
for (h=0; h<256; h++)
{
tptr = tbuf + 256*64 + (h%32)*8 + (h/32)*256*8;
@ -5978,7 +5982,7 @@ int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t ba
}
bglBindTexture(GL_TEXTURE_2D, polymosttext);
bglTexImage2D(GL_TEXTURE_2D,0,GL_ALPHA,256,128,0,GL_ALPHA,GL_UNSIGNED_BYTE,(GLvoid*)tbuf);
bglTexImage2D(GL_TEXTURE_2D,0,GL_ALPHA,256,128,0,GL_ALPHA,GL_UNSIGNED_BYTE,(GLvoid *)tbuf);
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
Bfree(tbuf);
@ -6160,73 +6164,73 @@ void polymost_initosdfuncs(void)
cvar_t cvars_polymost[] =
{
#ifdef USE_OPENGL
{ "r_animsmoothing","r_animsmoothing: enable/disable model animation smoothing",(void *)&r_animsmoothing, CVAR_BOOL, 0, 1 },
{ "r_modelocclusionchecking","r_modelocclusionchecking: enable/disable hack to cull \"obstructed\" models",(void *)&r_modelocclusionchecking, CVAR_INT, 0, 2 },
{ "r_detailmapping","r_detailmapping: enable/disable detail mapping",(void *)&r_detailmapping, CVAR_BOOL, 0, 1 },
{ "r_downsize","r_downsize: controls downsizing factor for hires textures",(void *)&r_downsize, CVAR_INT|CVAR_FUNCPTR, 0, 5 },
{ "r_fullbrights","r_fullbrights: enable/disable fullbright textures",(void *)&r_fullbrights, CVAR_BOOL, 0, 1 },
{ "r_glowmapping","r_glowmapping: enable/disable glow mapping",(void *)&r_glowmapping, CVAR_BOOL, 0, 1 },
{ "r_animsmoothing","r_animsmoothing: enable/disable model animation smoothing",(void *) &r_animsmoothing, CVAR_BOOL, 0, 1 },
{ "r_modelocclusionchecking","r_modelocclusionchecking: enable/disable hack to cull \"obstructed\" models",(void *) &r_modelocclusionchecking, CVAR_INT, 0, 2 },
{ "r_detailmapping","r_detailmapping: enable/disable detail mapping",(void *) &r_detailmapping, CVAR_BOOL, 0, 1 },
{ "r_downsize","r_downsize: controls downsizing factor for hires textures",(void *) &r_downsize, CVAR_INT|CVAR_FUNCPTR, 0, 5 },
{ "r_fullbrights","r_fullbrights: enable/disable fullbright textures",(void *) &r_fullbrights, CVAR_BOOL, 0, 1 },
{ "r_glowmapping","r_glowmapping: enable/disable glow mapping",(void *) &r_glowmapping, CVAR_BOOL, 0, 1 },
/*
{ "r_multisample","r_multisample: sets the number of samples used for antialiasing (0 = off)",(void *)&r_glowmapping, CVAR_BOOL, 0, 1 }
{ "r_nvmultisamplehint","r_nvmultisamplehint: enable/disable Nvidia multisampling hinting",(void *)&glnvmultisamplehint, CVAR_BOOL, 0, 1 }
*/
{
"r_parallaxskyclamping","r_parallaxskyclamping: enable/disable parallaxed floor/ceiling sky texture clamping",
(void *)&r_parallaxskyclamping, CVAR_BOOL, 0, 1
(void *) &r_parallaxskyclamping, CVAR_BOOL, 0, 1
},
{
"r_parallaxskypanning","r_parallaxskypanning: enable/disable parallaxed floor/ceiling panning when drawing a parallaxed sky",
(void *)&r_parallaxskypanning, CVAR_BOOL, 0, 1
(void *) &r_parallaxskypanning, CVAR_BOOL, 0, 1
},
{ "r_polygonmode","r_polygonmode: debugging feature",(void *)&glpolygonmode, CVAR_INT | CVAR_NOSAVE, 0, 3 },
{ "r_redbluemode","r_redbluemode: enable/disable experimental OpenGL red-blue glasses mode",(void *)&glredbluemode, CVAR_BOOL, 0, 1 },
{ "r_shadescale","r_shadescale: multiplier for lighting",(void *)&shadescale, CVAR_FLOAT, 0, 10 },
{ "r_swapinterval","r_swapinterval: sets the GL swap interval (VSync)",(void *)&vsync, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 },
{ "r_texcache","r_texcache: enable/disable OpenGL compressed texture cache",(void *)&glusetexcache, CVAR_INT, 0, 2 },
{ "r_texcompr","r_texcompr: enable/disable OpenGL texture compression",(void *)&glusetexcompr, CVAR_BOOL, 0, 1 },
{ "r_textureanisotropy", "r_textureanisotropy: changes the OpenGL texture anisotropy setting", (void *)&glanisotropy, CVAR_INT|CVAR_FUNCPTR, 0, 16 },
{ "r_texturemaxsize","r_texturemaxsize: changes the maximum OpenGL texture size limit",(void *)&gltexmaxsize, CVAR_INT | CVAR_NOSAVE, 0, 4096 },
{ "r_texturemiplevel","r_texturemiplevel: changes the highest OpenGL mipmap level used",(void *)&gltexmiplevel, CVAR_INT, 0, 6 },
{ "r_texturemode", "r_texturemode: changes the texture filtering settings", (void *)&gltexfiltermode, CVAR_INT|CVAR_FUNCPTR, 0, 5 },
{ "r_vbocount","r_vbocount: sets the number of Vertex Buffer Objects to use when drawing models",(void *)&r_vbocount, CVAR_INT, 1, 256 },
{ "r_vbos","r_vbos: enable/disable using Vertex Buffer Objects when drawing models",(void *)&r_vbos, CVAR_BOOL, 0, 1 },
{ "r_vertexarrays","r_vertexarrays: enable/disable using vertex arrays when drawing models",(void *)&r_vertexarrays, CVAR_BOOL, 0, 1 },
{ "r_anamorphic", "r_anamorphic: enable/disable widescreen mode", (void*)&glwidescreen, CVAR_BOOL, 0, 1 },
{ "r_projectionhack", "r_projectionhack: enable/disable projection hack", (void*)&glprojectionhacks, CVAR_INT, 0, 2 },
{ "r_polygonmode","r_polygonmode: debugging feature",(void *) &glpolygonmode, CVAR_INT | CVAR_NOSAVE, 0, 3 },
{ "r_redbluemode","r_redbluemode: enable/disable experimental OpenGL red-blue glasses mode",(void *) &glredbluemode, CVAR_BOOL, 0, 1 },
{ "r_shadescale","r_shadescale: multiplier for lighting",(void *) &shadescale, CVAR_FLOAT, 0, 10 },
{ "r_swapinterval","r_swapinterval: sets the GL swap interval (VSync)",(void *) &vsync, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 },
{ "r_texcache","r_texcache: enable/disable OpenGL compressed texture cache",(void *) &glusetexcache, CVAR_INT, 0, 2 },
{ "r_texcompr","r_texcompr: enable/disable OpenGL texture compression",(void *) &glusetexcompr, CVAR_BOOL, 0, 1 },
{ "r_textureanisotropy", "r_textureanisotropy: changes the OpenGL texture anisotropy setting", (void *) &glanisotropy, CVAR_INT|CVAR_FUNCPTR, 0, 16 },
{ "r_texturemaxsize","r_texturemaxsize: changes the maximum OpenGL texture size limit",(void *) &gltexmaxsize, CVAR_INT | CVAR_NOSAVE, 0, 4096 },
{ "r_texturemiplevel","r_texturemiplevel: changes the highest OpenGL mipmap level used",(void *) &gltexmiplevel, CVAR_INT, 0, 6 },
{ "r_texturemode", "r_texturemode: changes the texture filtering settings", (void *) &gltexfiltermode, CVAR_INT|CVAR_FUNCPTR, 0, 5 },
{ "r_vbocount","r_vbocount: sets the number of Vertex Buffer Objects to use when drawing models",(void *) &r_vbocount, CVAR_INT, 1, 256 },
{ "r_vbos","r_vbos: enable/disable using Vertex Buffer Objects when drawing models",(void *) &r_vbos, CVAR_BOOL, 0, 1 },
{ "r_vertexarrays","r_vertexarrays: enable/disable using vertex arrays when drawing models",(void *) &r_vertexarrays, CVAR_BOOL, 0, 1 },
{ "r_anamorphic", "r_anamorphic: enable/disable widescreen mode", (void *) &glwidescreen, CVAR_BOOL, 0, 1 },
{ "r_projectionhack", "r_projectionhack: enable/disable projection hack", (void *) &glprojectionhacks, CVAR_INT, 0, 2 },
#ifdef POLYMER
// polymer cvars
{ "r_pr_lighting", "r_pr_lighting: enable/disable dynamic lights", (void*)&pr_lighting, CVAR_BOOL, 0, 1 },
{ "r_pr_normalmapping", "r_pr_normalmapping: enable/disable virtual displacement mapping", (void*)&pr_normalmapping, CVAR_BOOL, 0, 1 },
{ "r_pr_specularmapping", "r_pr_specularmapping: enable/disable specular mapping", (void*)&pr_specularmapping, CVAR_BOOL, 0, 1 },
{ "r_pr_shadows", "r_pr_shadows: enable/disable dynamic shadows", (void*)&pr_shadows, CVAR_BOOL, 0, 1 },
{ "r_pr_shadowcount", "r_pr_shadowcount: maximal amount of shadow emitting lights on screen - you need to restart the renderer for it to take effect", (void*)&pr_shadowcount, CVAR_INT, 0, 64 },
{ "r_pr_shadowdetail", "r_pr_shadowdetail: sets the shadow map resolution - you need to restart the renderer for it to take effect", (void*)&pr_shadowdetail, CVAR_INT, 0, 5 },
{ "r_pr_shadowfiltering", "r_pr_shadowfiltering: enable/disable shadow edges filtering - you need to restart the renderer for it to take effect", (void*)&pr_shadowfiltering, CVAR_BOOL, 0, 1 },
{ "r_pr_maxlightpasses", "r_pr_maxlightpasses: the maximal amount of lights a single object can by affected by", (void*)&r_pr_maxlightpasses, CVAR_INT|CVAR_FUNCPTR, 0, PR_MAXLIGHTS },
{ "r_pr_maxlightpriority", "r_pr_maxlightpriority: lowering that value removes less meaningful lights from the scene", (void*)&pr_maxlightpriority, CVAR_INT, 0, PR_MAXLIGHTPRIORITY },
{ "r_pr_fov", "r_pr_fov: sets the field of vision in build angle", (void*)&pr_fov, CVAR_INT, 0, 1023},
{ "r_pr_customaspect", "r_pr_customaspect: if non-zero, forces the 3D view aspect ratio", (void*)&pr_customaspect, CVAR_FLOAT, 0, 3 },
{ "r_pr_billboardingmode", "r_pr_billboardingmode: face sprite display method. 0: classic mode; 1: polymost mode", (void*)&pr_billboardingmode, CVAR_INT, 0, 1 },
{ "r_pr_verbosity", "r_pr_verbosity: verbosity level of the polymer renderer", (void*)&pr_verbosity, CVAR_INT, 0, 3 },
{ "r_pr_wireframe", "r_pr_wireframe: toggles wireframe mode", (void*)&pr_wireframe, CVAR_INT | CVAR_NOSAVE, 0, 1 },
{ "r_pr_vbos", "r_pr_vbos: contols Vertex Buffer Object usage. 0: no VBOs. 1: VBOs for map data. 2: VBOs for model data.", (void*)&pr_vbos, CVAR_INT, 0, 2 },
{ "r_pr_gpusmoothing", "r_pr_gpusmoothing: toggles model animation interpolation", (void*)&pr_gpusmoothing, CVAR_INT, 0, 1 },
{ "r_pr_overrideparallax", "r_pr_overrideparallax: overrides parallax mapping scale and bias values with values from the pr_parallaxscale and pr_parallaxbias cvars; use it to fine-tune DEF tokens", (void*)&pr_overrideparallax, CVAR_BOOL | CVAR_NOSAVE, 0, 1 },
{ "r_pr_parallaxscale", "r_pr_parallaxscale: overriden parallax mapping offset scale", (void*)&pr_parallaxscale, CVAR_FLOAT | CVAR_NOSAVE, -10, 10 },
{ "r_pr_parallaxbias", "r_pr_parallaxbias: overriden parallax mapping offset bias", (void*)&pr_parallaxbias, CVAR_FLOAT | CVAR_NOSAVE, -10, 10 },
{ "r_pr_overridespecular", "r_pr_overridespecular: overrides specular material power and factor values with values from the pr_specularpower and pr_specularfactor cvars; use it to fine-tune DEF tokens", (void*)&pr_overridespecular, CVAR_BOOL | CVAR_NOSAVE, 0, 1 },
{ "r_pr_specularpower", "r_pr_specularpower: overriden specular material power", (void*)&pr_specularpower, CVAR_FLOAT | CVAR_NOSAVE, -10, 1000 },
{ "r_pr_specularfactor", "r_pr_specularfactor: overriden specular material factor", (void*)&pr_specularfactor, CVAR_FLOAT | CVAR_NOSAVE, -10, 1000 },
{ "r_pr_highpalookups", "r_pr_highpalookups: enable/disable highpalookups", (void*)&pr_highpalookups, CVAR_BOOL, 0, 1 },
{ "r_pr_ati_fboworkaround", "r_pr_ati_fboworkaround: enable this to workaround an ATI driver bug that causes sprite shadows to be square - you need to restart the renderer for it to take effect", (void*)&pr_ati_fboworkaround, CVAR_BOOL | CVAR_NOSAVE, 0, 1 },
{ "r_pr_ati_nodepthoffset", "r_pr_ati_nodepthoffset: enable this to workaround an ATI driver bug that causes sprite drawing to freeze the game on Radeon X1x00 hardware - you need to restart the renderer for it to take effect", (void*)&pr_ati_nodepthoffset, CVAR_BOOL | CVAR_NOSAVE, 0, 1 },
{ "r_pr_lighting", "r_pr_lighting: enable/disable dynamic lights", (void *) &pr_lighting, CVAR_BOOL, 0, 1 },
{ "r_pr_normalmapping", "r_pr_normalmapping: enable/disable virtual displacement mapping", (void *) &pr_normalmapping, CVAR_BOOL, 0, 1 },
{ "r_pr_specularmapping", "r_pr_specularmapping: enable/disable specular mapping", (void *) &pr_specularmapping, CVAR_BOOL, 0, 1 },
{ "r_pr_shadows", "r_pr_shadows: enable/disable dynamic shadows", (void *) &pr_shadows, CVAR_BOOL, 0, 1 },
{ "r_pr_shadowcount", "r_pr_shadowcount: maximal amount of shadow emitting lights on screen - you need to restart the renderer for it to take effect", (void *) &pr_shadowcount, CVAR_INT, 0, 64 },
{ "r_pr_shadowdetail", "r_pr_shadowdetail: sets the shadow map resolution - you need to restart the renderer for it to take effect", (void *) &pr_shadowdetail, CVAR_INT, 0, 5 },
{ "r_pr_shadowfiltering", "r_pr_shadowfiltering: enable/disable shadow edges filtering - you need to restart the renderer for it to take effect", (void *) &pr_shadowfiltering, CVAR_BOOL, 0, 1 },
{ "r_pr_maxlightpasses", "r_pr_maxlightpasses: the maximal amount of lights a single object can by affected by", (void *) &r_pr_maxlightpasses, CVAR_INT|CVAR_FUNCPTR, 0, PR_MAXLIGHTS },
{ "r_pr_maxlightpriority", "r_pr_maxlightpriority: lowering that value removes less meaningful lights from the scene", (void *) &pr_maxlightpriority, CVAR_INT, 0, PR_MAXLIGHTPRIORITY },
{ "r_pr_fov", "r_pr_fov: sets the field of vision in build angle", (void *) &pr_fov, CVAR_INT, 0, 1023},
{ "r_pr_customaspect", "r_pr_customaspect: if non-zero, forces the 3D view aspect ratio", (void *) &pr_customaspect, CVAR_FLOAT, 0, 3 },
{ "r_pr_billboardingmode", "r_pr_billboardingmode: face sprite display method. 0: classic mode; 1: polymost mode", (void *) &pr_billboardingmode, CVAR_INT, 0, 1 },
{ "r_pr_verbosity", "r_pr_verbosity: verbosity level of the polymer renderer", (void *) &pr_verbosity, CVAR_INT, 0, 3 },
{ "r_pr_wireframe", "r_pr_wireframe: toggles wireframe mode", (void *) &pr_wireframe, CVAR_INT | CVAR_NOSAVE, 0, 1 },
{ "r_pr_vbos", "r_pr_vbos: contols Vertex Buffer Object usage. 0: no VBOs. 1: VBOs for map data. 2: VBOs for model data.", (void *) &pr_vbos, CVAR_INT, 0, 2 },
{ "r_pr_gpusmoothing", "r_pr_gpusmoothing: toggles model animation interpolation", (void *) &pr_gpusmoothing, CVAR_INT, 0, 1 },
{ "r_pr_overrideparallax", "r_pr_overrideparallax: overrides parallax mapping scale and bias values with values from the pr_parallaxscale and pr_parallaxbias cvars; use it to fine-tune DEF tokens", (void *) &pr_overrideparallax, CVAR_BOOL | CVAR_NOSAVE, 0, 1 },
{ "r_pr_parallaxscale", "r_pr_parallaxscale: overriden parallax mapping offset scale", (void *) &pr_parallaxscale, CVAR_FLOAT | CVAR_NOSAVE, -10, 10 },
{ "r_pr_parallaxbias", "r_pr_parallaxbias: overriden parallax mapping offset bias", (void *) &pr_parallaxbias, CVAR_FLOAT | CVAR_NOSAVE, -10, 10 },
{ "r_pr_overridespecular", "r_pr_overridespecular: overrides specular material power and factor values with values from the pr_specularpower and pr_specularfactor cvars; use it to fine-tune DEF tokens", (void *) &pr_overridespecular, CVAR_BOOL | CVAR_NOSAVE, 0, 1 },
{ "r_pr_specularpower", "r_pr_specularpower: overriden specular material power", (void *) &pr_specularpower, CVAR_FLOAT | CVAR_NOSAVE, -10, 1000 },
{ "r_pr_specularfactor", "r_pr_specularfactor: overriden specular material factor", (void *) &pr_specularfactor, CVAR_FLOAT | CVAR_NOSAVE, -10, 1000 },
{ "r_pr_highpalookups", "r_pr_highpalookups: enable/disable highpalookups", (void *) &pr_highpalookups, CVAR_BOOL, 0, 1 },
{ "r_pr_ati_fboworkaround", "r_pr_ati_fboworkaround: enable this to workaround an ATI driver bug that causes sprite shadows to be square - you need to restart the renderer for it to take effect", (void *) &pr_ati_fboworkaround, CVAR_BOOL | CVAR_NOSAVE, 0, 1 },
{ "r_pr_ati_nodepthoffset", "r_pr_ati_nodepthoffset: enable this to workaround an ATI driver bug that causes sprite drawing to freeze the game on Radeon X1x00 hardware - you need to restart the renderer for it to take effect", (void *) &pr_ati_nodepthoffset, CVAR_BOOL | CVAR_NOSAVE, 0, 1 },
#endif
{ "r_models","r_models: enable/disable model rendering",(void *)&usemodels, CVAR_BOOL, 0, 1 },
{ "r_hightile","r_hightile: enable/disable hightile texture rendering",(void *)&usehightile, CVAR_BOOL, 0, 1 },
{ "r_models","r_models: enable/disable model rendering",(void *) &usemodels, CVAR_BOOL, 0, 1 },
{ "r_hightile","r_hightile: enable/disable hightile texture rendering",(void *) &usehightile, CVAR_BOOL, 0, 1 },
{ "r_preview_mouseaim", "r_preview_mouseaim: toggles mouse aiming preview, use this to calibrate yxaspect in Polymost Mapster32", (void *)&preview_mouseaim, CVAR_BOOL, 0, 1 },
{ "r_preview_mouseaim", "r_preview_mouseaim: toggles mouse aiming preview, use this to calibrate yxaspect in Polymost Mapster32", (void *) &preview_mouseaim, CVAR_BOOL, 0, 1 },
#endif
};
@ -6273,7 +6277,7 @@ void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype)
for (i=0; i<=j; i++)
{
mdloadskin((md2model_t*)models[mid], 0, dapalnum, i);
mdloadskin((md2model_t *)models[mid], 0, dapalnum, i);
}
}
#endif

View file

@ -191,19 +191,19 @@ void qinterpolatedown16short(intptr_t bufptr, int32_t num, int32_t val, int32_t
void clearbuf(void *d, int32_t c, int32_t a)
{
int32_t *p = (int32_t*)d;
int32_t *p = (int32_t *)d;
while ((c--) > 0) *(p++) = a;
}
void copybuf(void *s, void *d, int32_t c)
{
int32_t *p = (int32_t*)s, *q = (int32_t*)d;
int32_t *p = (int32_t *)s, *q = (int32_t *)d;
while ((c--) > 0) *(q++) = *(p++);
}
void swapbuf4(void *a, void *b, int32_t c)
{
int32_t *p = (int32_t*)a, *q = (int32_t*)b;
int32_t *p = (int32_t *)a, *q = (int32_t *)b;
int32_t x, y;
while ((c--) > 0)
{
@ -217,7 +217,7 @@ void swapbuf4(void *a, void *b, int32_t c)
void clearbufbyte(void *D, int32_t c, int32_t a)
{
// Cringe City
char *p = (char*)D;
char *p = (char *)D;
int32_t m[4] = { 0xffl,0xff00l,0xff0000l,0xff000000l };
int32_t n[4] = { 0,8,16,24 };
int32_t z=0;
@ -230,13 +230,13 @@ void clearbufbyte(void *D, int32_t c, int32_t a)
void copybufbyte(void *S, void *D, int32_t c)
{
char *p = (char*)S, *q = (char*)D;
char *p = (char *)S, *q = (char *)D;
while ((c--) > 0) *(q++) = *(p++);
}
void copybufreverse(void *S, void *D, int32_t c)
{
char *p = (char*)S, *q = (char*)D;
char *p = (char *)S, *q = (char *)D;
while ((c--) > 0) *(q++) = *(p--);
}

View file

@ -18,11 +18,11 @@
#include "quicklz.h"
#if QLZ_VERSION_MAJOR != 1 || QLZ_VERSION_MINOR != 5 || QLZ_VERSION_REVISION != 0
#error quicklz.c and quicklz.h have different versions
#error quicklz.c and quicklz.h have different versions
#endif
#if (defined(__X86__) || defined(__i386__) || defined(i386) || defined(_M_IX86) || defined(__386__) || defined(__x86_64__) || defined(_M_X64))
#define X86X64
#define X86X64
#endif
#define MINOFFSET 2
@ -31,11 +31,11 @@
#define CWORD_LEN 4
#if QLZ_COMPRESSION_LEVEL == 1 && defined QLZ_PTR_64 && QLZ_STREAMING_BUFFER == 0
#define OFFSET_BASE source
#define CAST (ui32)(size_t)
#define OFFSET_BASE source
#define CAST (ui32)(size_t)
#else
#define OFFSET_BASE 0
#define CAST
#define OFFSET_BASE 0
#define CAST
#endif
int qlz_get_setting(int setting)
@ -61,7 +61,7 @@ int qlz_get_setting(int setting)
#if QLZ_COMPRESSION_LEVEL == 1
static int same(const unsigned char *src, size_t n)
{
while(n > 0 && *(src + n) == *src)
while (n > 0 && *(src + n) == *src)
n--;
return n == 0 ? 1 : 0;
}
@ -70,7 +70,7 @@ static int same(const unsigned char *src, size_t n)
static void reset_table_compress(qlz_state_compress *state)
{
int i;
for(i = 0; i < QLZ_HASH_VALUES; i++)
for (i = 0; i < QLZ_HASH_VALUES; i++)
{
#if QLZ_COMPRESSION_LEVEL == 1
state->hash[i].offset = 0;
@ -86,7 +86,7 @@ static void reset_table_decompress(qlz_state_decompress *state)
(void)state;
(void)i;
#if QLZ_COMPRESSION_LEVEL == 2
for(i = 0; i < QLZ_HASH_VALUES; i++)
for (i = 0; i < QLZ_HASH_VALUES; i++)
{
state->hash_counter[i] = 0;
}
@ -96,7 +96,7 @@ static void reset_table_decompress(qlz_state_decompress *state)
static __inline ui32 hash_func(ui32 i)
{
#if QLZ_COMPRESSION_LEVEL == 2
return ((i >> 9) ^ (i >> 13) ^ i) & (QLZ_HASH_VALUES - 1);
return ((i >> 9) ^(i >> 13) ^ i) & (QLZ_HASH_VALUES - 1);
#else
return ((i >> 12) ^ i) & (QLZ_HASH_VALUES - 1);
#endif
@ -105,7 +105,7 @@ static __inline ui32 hash_func(ui32 i)
static __inline ui32 fast_read(void const *src, ui32 bytes)
{
#ifndef X86X64
unsigned char *p = (unsigned char*)src;
unsigned char *p = (unsigned char *)src;
switch (bytes)
{
case 4:
@ -120,7 +120,7 @@ static __inline ui32 fast_read(void const *src, ui32 bytes)
return 0;
#else
if (bytes >= 1 && bytes <= 4)
return *((ui32*)src);
return *((ui32 *)src);
else
return 0;
#endif
@ -137,7 +137,7 @@ static __inline ui32 hashat(const unsigned char *src)
static __inline void fast_write(ui32 f, void *dst, size_t bytes)
{
#ifndef X86X64
unsigned char *p = (unsigned char*)dst;
unsigned char *p = (unsigned char *)dst;
switch (bytes)
{
@ -164,16 +164,16 @@ static __inline void fast_write(ui32 f, void *dst, size_t bytes)
switch (bytes)
{
case 4:
*((ui32*)dst) = f;
*((ui32 *)dst) = f;
return;
case 3:
*((ui32*)dst) = f;
*((ui32 *)dst) = f;
return;
case 2:
*((ui16 *)dst) = (ui16)f;
return;
case 1:
*((unsigned char*)dst) = (unsigned char)f;
*((unsigned char *)dst) = (unsigned char)f;
return;
}
#endif
@ -210,7 +210,7 @@ static __inline void memcpy_up(unsigned char *dst, const unsigned char *src, ui3
// Caution if modifying memcpy_up! Overlap of dst and src must be special handled.
#ifndef X86X64
unsigned char *end = dst + n;
while(dst < end)
while (dst < end)
{
*dst = *src;
dst++;
@ -250,7 +250,7 @@ static __inline void update_hash(qlz_state_decompress *state, const unsigned cha
#if QLZ_COMPRESSION_LEVEL <= 2
static void update_hash_upto(qlz_state_decompress *state, unsigned char **lh, const unsigned char *max)
{
while(*lh < max)
while (*lh < max)
{
(*lh)++;
update_hash(state, *lh);
@ -271,10 +271,10 @@ static size_t qlz_compress_core(const unsigned char *source, unsigned char *dest
(void) lits;
if(src <= last_matchstart)
if (src <= last_matchstart)
fetch = fast_read(src, 3);
while(src <= last_matchstart)
while (src <= last_matchstart)
{
if ((cword_val & 1) == 1)
{
@ -304,7 +304,7 @@ static size_t qlz_compress_core(const unsigned char *source, unsigned char *dest
#ifdef X86X64
if ((cached & 0xffffff) == 0 && o != OFFSET_BASE && (src - o > MINOFFSET || (src == o + 1 && lits >= 3 && src > source + 3 && same(src - 3, 6))))
{
if(cached != 0)
if (cached != 0)
{
#else
if (cached == 0 && o != OFFSET_BASE && (src - o > MINOFFSET || (src == o + 1 && lits >= 3 && src > source + 3 && same(src - 3, 6))))
@ -327,15 +327,15 @@ static size_t qlz_compress_core(const unsigned char *source, unsigned char *dest
cword_val = (cword_val >> 1) | (1U << 31);
src += 4;
if(*(o + (src - old_src)) == *src)
if (*(o + (src - old_src)) == *src)
{
src++;
if(*(o + (src - old_src)) == *src)
if (*(o + (src - old_src)) == *src)
{
size_t q = last_byte - UNCOMPRESSED_END - (src - 5) + 1;
size_t remaining = q > 255 ? 255 : q;
src++;
while(*(o + (src - old_src)) == *src && (size_t)(src - old_src) < remaining)
while (*(o + (src - old_src)) == *src && (size_t)(src - old_src) < remaining)
src++;
}
}
@ -385,29 +385,29 @@ static size_t qlz_compress_core(const unsigned char *source, unsigned char *dest
c = state->hash_counter[hash];
offset2 = state->hash[hash].offset[0];
if(offset2 < src - MINOFFSET && c > 0 && ((fast_read(offset2, 3) ^ fetch) & 0xffffff) == 0)
if (offset2 < src - MINOFFSET && c > 0 && ((fast_read(offset2, 3) ^ fetch) & 0xffffff) == 0)
{
matchlen = 3;
if(*(offset2 + matchlen) == *(src + matchlen))
if (*(offset2 + matchlen) == *(src + matchlen))
{
matchlen = 4;
while(*(offset2 + matchlen) == *(src + matchlen) && matchlen < remaining)
while (*(offset2 + matchlen) == *(src + matchlen) && matchlen < remaining)
matchlen++;
}
}
else
matchlen = 0;
for(k = 1; k < QLZ_POINTERS && c > k; k++)
for (k = 1; k < QLZ_POINTERS && c > k; k++)
{
o = state->hash[hash].offset[k];
#if QLZ_COMPRESSION_LEVEL == 3
if(((fast_read(o, 3) ^ fetch) & 0xffffff) == 0 && o < src - MINOFFSET)
if (((fast_read(o, 3) ^ fetch) & 0xffffff) == 0 && o < src - MINOFFSET)
#elif QLZ_COMPRESSION_LEVEL == 2
if(*(src + matchlen) == *(o + matchlen) && ((fast_read(o, 3) ^ fetch) & 0xffffff) == 0 && o < src - MINOFFSET)
if (*(src + matchlen) == *(o + matchlen) && ((fast_read(o, 3) ^ fetch) & 0xffffff) == 0 && o < src - MINOFFSET)
#endif
{
m = 3;
while(*(o + m) == *(src + m) && m < remaining)
while (*(o + m) == *(src + m) && m < remaining)
m++;
#if QLZ_COMPRESSION_LEVEL == 3
if ((m > matchlen) || (m == matchlen && o > offset2))
@ -427,12 +427,12 @@ static size_t qlz_compress_core(const unsigned char *source, unsigned char *dest
state->hash_counter[hash] = c;
#if QLZ_COMPRESSION_LEVEL == 3
if(matchlen > 2 && src - o < 131071)
if (matchlen > 2 && src - o < 131071)
{
ui32 u;
size_t offset = src - o;
for(u = 1; u < matchlen; u++)
for (u = 1; u < matchlen; u++)
{
hash = hashat(src + u);
c = state->hash_counter[hash]++;
@ -442,7 +442,7 @@ static size_t qlz_compress_core(const unsigned char *source, unsigned char *dest
cword_val = (cword_val >> 1) | (1U << 31);
src += matchlen;
if(matchlen == 3 && offset <= 63)
if (matchlen == 3 && offset <= 63)
{
*dst = (unsigned char)(offset << 2);
dst++;
@ -460,7 +460,7 @@ static size_t qlz_compress_core(const unsigned char *source, unsigned char *dest
dst += 2;
}
else if(matchlen <= 33)
else if (matchlen <= 33)
{
ui32 f = ((matchlen - 2) << 2) | ((ui32)offset << 7) | 3;
fast_write(f, dst, 3);
@ -482,7 +482,7 @@ static size_t qlz_compress_core(const unsigned char *source, unsigned char *dest
}
#elif QLZ_COMPRESSION_LEVEL == 2
if(matchlen > 2)
if (matchlen > 2)
{
cword_val = (cword_val >> 1) | (1U << 31);
src += matchlen;
@ -546,7 +546,7 @@ static size_t qlz_compress_core(const unsigned char *source, unsigned char *dest
cword_val = (cword_val >> 1);
}
while((cword_val & 1) != 1)
while ((cword_val & 1) != 1)
cword_val = (cword_val >> 1);
fast_write((cword_val >> 1) | (1U << 31), cword_ptr, CWORD_LEN);
@ -571,14 +571,14 @@ static size_t qlz_decompress_core(const unsigned char *source, unsigned char *de
(void) state;
(void) history;
for(;;)
for (;;)
{
ui32 fetch;
if (cword_val == 1)
{
#ifdef QLZ_MEMORY_SAFE
if(src + CWORD_LEN - 1 > last_source_byte)
if (src + CWORD_LEN - 1 > last_source_byte)
return 0;
#endif
cword_val = fast_read(src, CWORD_LEN);
@ -586,7 +586,7 @@ static size_t qlz_decompress_core(const unsigned char *source, unsigned char *de
}
#ifdef QLZ_MEMORY_SAFE
if(src + 4 - 1 > last_source_byte)
if (src + 4 - 1 > last_source_byte)
return 0;
#endif
@ -603,7 +603,7 @@ static size_t qlz_decompress_core(const unsigned char *source, unsigned char *de
hash = (fetch >> 4) & 0xfff;
offset2 = (const unsigned char *)(size_t)state->hash[hash].offset;
if((fetch & 0xf) != 0)
if ((fetch & 0xf) != 0)
{
matchlen = (fetch & 0xf) + 2;
src += 2;
@ -622,7 +622,7 @@ static size_t qlz_decompress_core(const unsigned char *source, unsigned char *de
c = (unsigned char)(fetch & 0x3);
offset2 = state->hash[hash].offset[c];
if((fetch & (28)) != 0)
if ((fetch & (28)) != 0)
{
matchlen = ((fetch >> 2) & 0x7) + 2;
src += 2;
@ -671,10 +671,10 @@ static size_t qlz_decompress_core(const unsigned char *source, unsigned char *de
#endif
#ifdef QLZ_MEMORY_SAFE
if(offset2 < history || offset2 > dst - MINOFFSET - 1)
if (offset2 < history || offset2 > dst - MINOFFSET - 1)
return 0;
if(matchlen > (ui32)(last_destination_byte - dst - UNCOMPRESSED_END + 1))
if (matchlen > (ui32)(last_destination_byte - dst - UNCOMPRESSED_END + 1))
return 0;
#endif
@ -705,7 +705,7 @@ static size_t qlz_decompress_core(const unsigned char *source, unsigned char *de
}
else
{
while(dst <= last_destination_byte)
while (dst <= last_destination_byte)
{
if (cword_val == 1)
{
@ -713,7 +713,7 @@ static size_t qlz_decompress_core(const unsigned char *source, unsigned char *de
cword_val = 1U << 31;
}
#ifdef QLZ_MEMORY_SAFE
if(src >= last_source_byte + 1)
if (src >= last_source_byte + 1)
return 0;
#endif
*dst = *src;
@ -738,10 +738,10 @@ size_t qlz_compress(const void *source, char *destination, size_t size, qlz_stat
ui32 compressed;
size_t base;
if(size == 0 || size > 0xffffffff - 400)
if (size == 0 || size > 0xffffffff - 400)
return 0;
if(size < 216)
if (size < 216)
base = 3;
else
base = 9;
@ -751,11 +751,11 @@ size_t qlz_compress(const void *source, char *destination, size_t size, qlz_stat
#endif
{
reset_table_compress(state);
r = base + qlz_compress_core((const unsigned char *)source, (unsigned char*)destination + base, size, state);
r = base + qlz_compress_core((const unsigned char *)source, (unsigned char *)destination + base, size, state);
#if QLZ_STREAMING_BUFFER > 0
reset_table_compress(state);
#endif
if(r == base)
if (r == base)
{
memcpy(destination + base, source, size);
r = size + base;
@ -773,9 +773,9 @@ size_t qlz_compress(const void *source, char *destination, size_t size, qlz_stat
unsigned char *src = state->stream_buffer + state->stream_counter;
memcpy(src, source, size);
r = base + qlz_compress_core(src, (unsigned char*)destination + base, size, state);
r = base + qlz_compress_core(src, (unsigned char *)destination + base, size, state);
if(r == base)
if (r == base)
{
memcpy(destination + base, src, size);
r = size + base;
@ -789,7 +789,7 @@ size_t qlz_compress(const void *source, char *destination, size_t size, qlz_stat
state->stream_counter += size;
}
#endif
if(base == 3)
if (base == 3)
{
*destination = (unsigned char)(0 | compressed);
*(destination + 1) = (unsigned char)r;
@ -820,7 +820,7 @@ size_t qlz_decompress(const char *source, void *destination, qlz_state_decompres
if (state->stream_counter + qlz_size_decompressed(source) - 1 >= QLZ_STREAMING_BUFFER)
#endif
{
if((*source & 1) == 1)
if ((*source & 1) == 1)
{
reset_table_decompress(state);
dsiz = qlz_decompress_core((const unsigned char *)source, (unsigned char *)destination, dsiz, state, (const unsigned char *)destination);
@ -836,7 +836,7 @@ size_t qlz_decompress(const char *source, void *destination, qlz_state_decompres
else
{
unsigned char *dst = state->stream_buffer + state->stream_counter;
if((*source & 1) == 1)
if ((*source & 1) == 1)
{
dsiz = qlz_decompress_core((const unsigned char *)source, dst, dsiz, state, (const unsigned char *)state->stream_buffer);
}

View file

@ -18,10 +18,10 @@ extern void SetKey(int32_t key, int32_t state);
#define MASK_UP (MASK_DOWN<<1)
#define MouseWheelFakePressTime 50
#ifndef GET_RAWINPUT_CODE_WPARAM
#define GET_RAWINPUT_CODE_WPARAM(wParam) ((wParam) & 0xff)
#define GET_RAWINPUT_CODE_WPARAM(wParam) ((wParam) & 0xff)
#endif
static inline void RI_ProcessMouse(const RAWMOUSE* rmouse)
static inline void RI_ProcessMouse(const RAWMOUSE *rmouse)
{
int32_t i, mask;
@ -77,7 +77,7 @@ static inline void RI_ProcessMouse(const RAWMOUSE* rmouse)
}
}
static inline void RI_ProcessKeyboard(const RAWKEYBOARD* rkbd)
static inline void RI_ProcessKeyboard(const RAWKEYBOARD *rkbd)
{
uint8_t key = rkbd->MakeCode, VKey = rkbd->VKey;

View file

@ -279,7 +279,7 @@ scriptfile *scriptfile_fromfile(const char *fn)
return NULL;
}
sf = (scriptfile*) Bmalloc(sizeof(scriptfile));
sf = (scriptfile *) Bmalloc(sizeof(scriptfile));
if (!sf)
{
kclose(fp);
@ -311,7 +311,7 @@ scriptfile *scriptfile_fromstring(const char *string)
tx = (char *) Bmalloc(flen + 2);
if (!tx) return NULL;
sf = (scriptfile*) Bmalloc(sizeof(scriptfile));
sf = (scriptfile *) Bmalloc(sizeof(scriptfile));
if (!sf)
{
Bfree(tx);
@ -349,7 +349,7 @@ int32_t scriptfile_eof(scriptfile *sf)
static int32_t symbtablength=0, symbtaballoclength=0;
static char *symbtab = NULL;
static char * getsymbtabspace(int32_t reqd)
static char *getsymbtabspace(int32_t reqd)
{
char *pos,*np;
int32_t i;
@ -375,7 +375,7 @@ int32_t scriptfile_getsymbolvalue(char *name, int32_t *val)
{
if (!Bstrcasecmp(name, scanner))
{
*val = *(int32_t*)(scanner + strlen(scanner) + 1);
*val = *(int32_t *)(scanner + strlen(scanner) + 1);
return 1;
}
@ -397,7 +397,7 @@ int32_t scriptfile_addsymbolvalue(char *name, int32_t val)
{
if (!Bstrcasecmp(name, scanner))
{
*(int32_t*)(scanner + strlen(scanner) + 1) = val;
*(int32_t *)(scanner + strlen(scanner) + 1) = val;
return 1;
}
@ -409,7 +409,7 @@ int32_t scriptfile_addsymbolvalue(char *name, int32_t val)
if (!sp) return 0;
strcpy(sp, name);
sp += strlen(name)+1;
*(int32_t*)sp = val;
*(int32_t *)sp = val;
return 1; // added
}

View file

@ -54,7 +54,7 @@ int32_t _buildargc = 1;
const char **_buildargv = NULL;
extern int32_t app_main(int32_t argc, const char *argv[]);
char quitevent=0, appactive=1;
char quitevent=0, appactive=1, novideo=0;
// video
static SDL_Surface *sdl_surface;
@ -81,8 +81,8 @@ static char keytranslation[SDL_NUM_SCANCODES];
static int32_t buildkeytranslationtable(void);
//static SDL_Surface * loadtarga(const char *fn); // for loading the icon
static SDL_Surface * appicon = NULL;
static SDL_Surface * loadappicon(void);
static SDL_Surface *appicon = NULL;
static SDL_Surface *loadappicon(void);
static mutex_t m_initprintf;
@ -183,7 +183,7 @@ int32_t main(int32_t argc, char *argv[])
startwin_open();
_buildargc = argc;
_buildargv = (const char**)argv;
_buildargv = (const char **)argv;
// pipe standard outputs to files
if ((argp = Bgetenv("BUILD_LOGSTDOUT")) != NULL)
@ -228,7 +228,7 @@ void setvsync(int32_t sync)
}
#endif
static void attach_debugger_here(void){}
static void attach_debugger_here(void) {}
#ifdef __GNUC__
# define PRINTSTACKONSEGV 1
@ -294,10 +294,17 @@ int32_t initsystem(void)
| SDL_INIT_NOPARACHUTE
#endif
))
{
initprintf("Initialization failed! (%s)\nNon-interactive mode enabled\n", SDL_GetError());
/* if (SDL_Init(0))
{
initprintf("Initialization failed! (%s)\n", SDL_GetError());
return -1;
}
else
*/
novideo = nogl = 1;
}
signal(SIGSEGV, sighandler);
signal(SIGABRT, sighandler);
@ -309,7 +316,7 @@ int32_t initsystem(void)
lockcount = 0;
#ifdef USE_OPENGL
if (loadgldriver(getenv("BUILD_GLDRV")))
if (!novideo && loadgldriver(getenv("BUILD_GLDRV")))
{
initprintf("Failed loading OpenGL driver. GL modes will be unavailable.\n");
nogl = 1;
@ -319,11 +326,16 @@ int32_t initsystem(void)
#ifndef __APPLE__
//icon = loadtarga("icon.tga");
if (!novideo)
{
appicon = loadappicon();
if (appicon)
SDL_WM_SetIcon(appicon, 0);
}
#endif
if (!novideo)
if (SDL_VideoDriverName(drvname, 32))
initprintf("Using \"%s\" video driver\n", drvname);
@ -384,8 +396,8 @@ void initprintf(const char *f, ...)
Bvsnprintf(buf, sizeof(buf), f, va);
va_end(va);
OSD_Printf(buf);
Bprintf("%s", buf);
OSD_Printf("%s", buf);
// Bprintf("%s", buf);
mutex_lock(&m_initprintf);
if (Bstrlen(dabuf) + Bstrlen(buf) > 1022)
@ -793,7 +805,7 @@ void getvalidmodes(void)
#endif
int32_t i, j, maxx=0, maxy=0;
if (modeschecked) return;
if (modeschecked || novideo) return;
validmodecnt=0;
// initprintf("Detecting video modes:\n");
@ -879,7 +891,7 @@ void getvalidmodes(void)
#undef CHECK
#undef ADDMODE
qsort((void*)validmode, validmodecnt, sizeof(struct validmode_t), (int32_t(*)(const void*,const void*))sortmodes);
qsort((void *)validmode, validmodecnt, sizeof(struct validmode_t), (int32_t( *)(const void *,const void *))sortmodes);
modeschecked=1;
}
@ -1131,28 +1143,33 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
glinfo.extensions = (const char *)bglGetString(GL_EXTENSIONS);
#ifdef POLYMER
if (!Bstrcmp(glinfo.vendor,"ATI Technologies Inc.")) {
if (!Bstrcmp(glinfo.vendor,"ATI Technologies Inc."))
{
pr_ati_fboworkaround = 1;
initprintf("Enabling ATI FBO color attachment workaround.\n");
if (!Bstrncmp(glinfo.renderer,"Radeon X1", 9)) {
if (Bstrstr(glinfo.renderer,"Radeon X1"))
{
pr_ati_nodepthoffset = 1;
initprintf("Enabling ATI R520 polygon offset workaround.\n");
} else
}
else
pr_ati_nodepthoffset = 0;
#ifdef __APPLE__
//See bug description at http://lists.apple.com/archives/mac-opengl/2005/Oct/msg00169.html
if (!Bstrncmp(glinfo.renderer,"ATI Radeon 9600", 15)) {
if (!Bstrncmp(glinfo.renderer,"ATI Radeon 9600", 15))
{
pr_ati_textureformat_one = 1;
initprintf("Enabling ATI Radeon 9600 texture format workaround.\n");
} else
}
else
pr_ati_textureformat_one = 0;
#endif
} else
}
else
pr_ati_fboworkaround = 0;
#endif
glinfo.maxanisotropy = 1.0;
glinfo.bgra = 0;
glinfo.texcompr = 0;
@ -1160,7 +1177,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
// process the extensions string and flag stuff we recognize
p = Bstrdup(glinfo.extensions);
p3 = p;
while ((p2 = Bstrtoken(p3==p?p:NULL, " ", (char**)&p3, 1)) != NULL)
while ((p2 = Bstrtoken(p3==p?p:NULL, " ", (char **)&p3, 1)) != NULL)
{
if (!Bstrcmp(p2, "GL_EXT_texture_filter_anisotropic"))
{
@ -1487,6 +1504,8 @@ int32_t setgamma(void)
double invgamma = 1 / gamma;
double norm = pow(255., invgamma - 1);
if (novideo) return 0;
// This formula is taken from Doomsday
for (i = 0; i < 256; i++)
@ -1502,11 +1521,11 @@ int32_t setgamma(void)
#ifndef __APPLE__
extern struct sdlappicon sdlappicon;
static SDL_Surface * loadappicon(void)
static SDL_Surface *loadappicon(void)
{
SDL_Surface *surf;
surf = SDL_CreateRGBSurfaceFrom((void*)sdlappicon.pixels,
surf = SDL_CreateRGBSurfaceFrom((void *)sdlappicon.pixels,
sdlappicon.width, sdlappicon.height, 32, sdlappicon.width*4,
0xffl,0xff00l,0xff0000l,0xff000000l);
@ -1850,26 +1869,30 @@ inline void idle_waitevent(void)
#if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3) // SDL 1.2
// from SDL HG, modified
static int32_t SDL_WaitEventTimeout(SDL_Event * event, int32_t timeout)
static int32_t SDL_WaitEventTimeout(SDL_Event *event, int32_t timeout)
{
uint32_t expiration = 0;
if (timeout > 0)
expiration = SDL_GetTicks() + timeout;
for (;;) {
for (;;)
{
SDL_PumpEvents();
switch (SDL_PeepEvents(event, 1, SDL_GETEVENT, ~0)) { //SDL_FIRSTEVENT, SDL_LASTEVENT)) {
switch (SDL_PeepEvents(event, 1, SDL_GETEVENT, ~0)) //SDL_FIRSTEVENT, SDL_LASTEVENT)) {
{
case -1:
return 0;
case 1:
return 1;
case 0:
if (timeout == 0) {
if (timeout == 0)
{
/* Polling and no events, just return */
return 0;
}
if (timeout > 0 && ((int32_t) (SDL_GetTicks() - expiration) >= 0)) {
if (timeout > 0 && ((int32_t)(SDL_GetTicks() - expiration) >= 0))
{
/* Timeout expired and no events */
return 0;
}

View file

@ -1,15 +1,16 @@
#if defined(LINKED_GTK)
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixdata.h>
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixdata.h>
#else
#include "dynamicgtk.h"
#include "dynamicgtk.h"
#endif
#include "build.h"
#include "editor.h"
#include "baselayer.h"
enum {
enum
{
TAB_CONFIG,
TAB_MESSAGES,
};
@ -251,8 +252,8 @@ static GtkWidget *create_window(void)
// 2D video mode label
stwidgets.vmode2dlabel = gtk_label_new_with_mnemonic("_2D Video mode:");
gtk_misc_set_alignment (GTK_MISC(stwidgets.vmode2dlabel), 0.3, 0);
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode2dlabel, 0,1, 0,1, GTK_FILL, 0, 4, 6);
gtk_misc_set_alignment(GTK_MISC(stwidgets.vmode2dlabel), 0.3, 0);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode2dlabel, 0,1, 0,1, GTK_FILL, 0, 4, 6);
// 2D video mode combo
{
@ -266,22 +267,22 @@ static GtkWidget *create_window(void)
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(stwidgets.vmode2dcombo), cell, FALSE);
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(stwidgets.vmode2dcombo), cell, "text", 0, NULL);
}
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode2dcombo, 1,2, 0,1, GTK_EXPAND | GTK_FILL, 0, 4, 6);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode2dcombo, 1,2, 0,1, GTK_EXPAND | GTK_FILL, 0, 4, 6);
gtk_widget_add_accelerator(stwidgets.vmode2dcombo, "grab_focus", stwidgets.accel_group,
GDK_2, GDK_MOD1_MASK,
GTK_ACCEL_VISIBLE);
// Fullscreen checkbox
stwidgets.fullscreencheck = gtk_check_button_new_with_mnemonic("_Fullscreen");
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.fullscreencheck, 2,3, 0,1, GTK_FILL, 0, 4, 6);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.fullscreencheck, 2,3, 0,1, GTK_FILL, 0, 4, 6);
gtk_widget_add_accelerator(stwidgets.fullscreencheck, "grab_focus", stwidgets.accel_group,
GDK_F, GDK_MOD1_MASK,
GTK_ACCEL_VISIBLE);
// 3D video mode label
stwidgets.vmode3dlabel = gtk_label_new_with_mnemonic("_3D Video mode:");
gtk_misc_set_alignment (GTK_MISC(stwidgets.vmode3dlabel), 0.3, 0);
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dlabel, 0,1, 1,2, GTK_FILL, 0, 4, 6);
gtk_misc_set_alignment(GTK_MISC(stwidgets.vmode3dlabel), 0.3, 0);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dlabel, 0,1, 1,2, GTK_FILL, 0, 4, 6);
// 3D video mode combo
{
@ -295,17 +296,17 @@ static GtkWidget *create_window(void)
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(stwidgets.vmode3dcombo), cell, FALSE);
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(stwidgets.vmode3dcombo), cell, "text", 0, NULL);
}
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dcombo, 1,2, 1,2, GTK_EXPAND | GTK_FILL, 0, 4, 0);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dcombo, 1,2, 1,2, GTK_EXPAND | GTK_FILL, 0, 4, 0);
gtk_widget_add_accelerator(stwidgets.vmode3dcombo, "grab_focus", stwidgets.accel_group,
GDK_3, GDK_MOD1_MASK,
GTK_ACCEL_VISIBLE);
// Empty horizontal layout
stwidgets.emptyhlayout = gtk_hbox_new(TRUE, 0);
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.emptyhlayout, 0,1, 2,3, 0, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.emptyhlayout, 0,1, 2,3, 0, GTK_EXPAND | GTK_FILL, 0, 0);
// Always show config checkbox
stwidgets.alwaysshowcheck = gtk_check_button_new_with_mnemonic("_Always show configuration on start");
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.alwaysshowcheck, 0,2, 3,4, GTK_FILL, 0, 4, 6);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.alwaysshowcheck, 0,2, 3,4, GTK_FILL, 0, 4, 6);
gtk_widget_add_accelerator(stwidgets.alwaysshowcheck, "grab_focus", stwidgets.accel_group,
GDK_A, GDK_MOD1_MASK,
GTK_ACCEL_VISIBLE);

View file

@ -434,7 +434,7 @@ int32_t startwin_settitle(const char *str)
int32_t startwin_idle(void *v)
{
if (!startupdlg || !IsWindow(startupdlg)) return 0;
if (IsDialogMessage(startupdlg, (MSG*)v)) return 1;
if (IsDialogMessage(startupdlg, (MSG *)v)) return 1;
return 0;
}

View file

@ -69,8 +69,8 @@ char forcegl=0;
#endif
static LPTSTR GetWindowsErrorMsg(DWORD code);
static const char * GetDDrawError(HRESULT code);
static const char * GetDInputError(HRESULT code);
static const char *GetDDrawError(HRESULT code);
static const char *GetDInputError(HRESULT code);
static void ShowErrorBox(const char *m);
static void ShowDDrawErrorBox(const char *m, HRESULT r);
static void ShowDInputErrorBox(const char *m, HRESULT r);
@ -441,7 +441,7 @@ int32_t WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, in
}
*wp = 0;
_buildargv = (const char**)Bmalloc(sizeof(char*)*_buildargc);
_buildargv = (const char **)Bmalloc(sizeof(char *)*_buildargc);
wp = argvbuf;
for (i=0; i<_buildargc; i++,wp++)
{
@ -754,7 +754,7 @@ int32_t handleevents(void)
continue;
}
if (startwin_idle((void*)&msg) > 0) continue;
if (startwin_idle((void *)&msg) > 0) continue;
TranslateMessage(&msg);
DispatchMessage(&msg);
@ -1010,7 +1010,7 @@ static BOOL CALLBACK InitDirectInput_enum(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRe
static BOOL CALLBACK InitDirectInput_enumobjects(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvRef)
{
int32_t *typecounts = (int32_t*)pvRef;
int32_t *typecounts = (int32_t *)pvRef;
if (lpddoi->dwType & DIDFT_AXIS)
{
@ -1183,17 +1183,17 @@ static void UninitDirectInput(void)
if (axisdefs)
{
for (i=joynumaxes-1; i>=0; i--) if (axisdefs[i].name) Bfree((void*)axisdefs[i].name);
for (i=joynumaxes-1; i>=0; i--) if (axisdefs[i].name) Bfree((void *)axisdefs[i].name);
Bfree(axisdefs); axisdefs = NULL;
}
if (buttondefs)
{
for (i=joynumbuttons-1; i>=0; i--) if (buttondefs[i].name) Bfree((void*)buttondefs[i].name);
for (i=joynumbuttons-1; i>=0; i--) if (buttondefs[i].name) Bfree((void *)buttondefs[i].name);
Bfree(buttondefs); buttondefs = NULL;
}
if (hatdefs)
{
for (i=joynumhats-1; i>=0; i--) if (hatdefs[i].name) Bfree((void*)hatdefs[i].name);
for (i=joynumhats-1; i>=0; i--) if (hatdefs[i].name) Bfree((void *)hatdefs[i].name);
Bfree(hatdefs); hatdefs = NULL;
}
@ -1396,7 +1396,7 @@ static void ShowDInputErrorBox(const char *m, HRESULT r)
// GetDInputError() -- stinking huge list of error messages since MS didn't want to include
// them in the DLL
//
static const char * GetDInputError(HRESULT code)
static const char *GetDInputError(HRESULT code)
{
switch (code)
{
@ -1514,14 +1514,14 @@ int32_t inittimer(int32_t tickspersecond)
// OpenWatcom seems to want us to query the value into a local variable
// instead of the global 'timerfreq' or else it gets pissed with an
// access violation
if (!QueryPerformanceFrequency((LARGE_INTEGER*)&t))
if (!QueryPerformanceFrequency((LARGE_INTEGER *)&t))
{
ShowErrorBox("Failed fetching timer frequency");
return -1;
}
timerfreq = t;
timerticspersec = tickspersecond;
QueryPerformanceCounter((LARGE_INTEGER*)&t);
QueryPerformanceCounter((LARGE_INTEGER *)&t);
timerlastsample = (int32_t)(t*timerticspersec / timerfreq);
usertimercallback = NULL;
@ -1550,7 +1550,7 @@ inline void sampletimer(void)
if (!timerfreq) return;
QueryPerformanceCounter((LARGE_INTEGER*)&i);
QueryPerformanceCounter((LARGE_INTEGER *)&i);
n = (int32_t)((i*timerticspersec / timerfreq) - timerlastsample);
if (n <= 0) return;
@ -1569,7 +1569,7 @@ uint32_t getticks(void)
{
int64_t i;
if (timerfreq == 0) return 0;
QueryPerformanceCounter((LARGE_INTEGER*)&i);
QueryPerformanceCounter((LARGE_INTEGER *)&i);
return (uint32_t)(i*longlong(1000)/timerfreq);
}
@ -1594,7 +1594,7 @@ static HMODULE hDDrawDLL = NULL;
static LPDIRECTDRAW lpDD = NULL;
static LPDIRECTDRAWSURFACE lpDDSPrimary = NULL;
static LPDIRECTDRAWSURFACE lpDDSBack = NULL;
static char * lpOffscreen = NULL;
static char *lpOffscreen = NULL;
static LPDIRECTDRAWPALETTE lpDDPalette = NULL;
static BOOL bDDrawInited = FALSE;
static DWORD DDdwCaps = 0, DDdwCaps2 = 0;
@ -1909,7 +1909,7 @@ void getvalidmodes(void)
ADDMODE(defaultres[i][0],defaultres[i][1],cdepths[j],0,-1)
}
qsort((void*)validmode, validmodecnt, sizeof(struct validmode_t), (int32_t(*)(const void*,const void*))sortmodes);
qsort((void *)validmode, validmodecnt, sizeof(struct validmode_t), (int32_t( *)(const void *,const void *))sortmodes);
modeschecked=1;
}
@ -2889,7 +2889,7 @@ static int32_t SetupOpenGL(int32_t width, int32_t height, int32_t bitspp)
// process the extensions string and flag stuff we recognize
p = (GLubyte *)Bstrdup(glinfo.extensions);
p3 = p;
while ((p2 = (GLubyte *)Bstrtoken(p3==p?(char *)p:NULL, " ", (char**)&p3, 1)) != NULL)
while ((p2 = (GLubyte *)Bstrtoken(p3==p?(char *)p:NULL, " ", (char **)&p3, 1)) != NULL)
{
if (!Bstrcmp((char *)p2, "GL_EXT_texture_filter_anisotropic"))
{
@ -3285,7 +3285,7 @@ static void ShowDDrawErrorBox(const char *m, HRESULT r)
// GetDDrawError() -- stinking huge list of error messages since MS didn't want to include
// them in the DLL
//
static const char * GetDDrawError(HRESULT code)
static const char *GetDDrawError(HRESULT code)
{
switch (code)
{