mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
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:
parent
1579d2edd3
commit
ef912658a0
24 changed files with 3513 additions and 3445 deletions
|
@ -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");
|
||||
|
|
|
@ -538,7 +538,8 @@ int32_t clipmapinfo_load(const char *filename)
|
|||
}
|
||||
}
|
||||
}
|
||||
} while (++scnt < numclipsects);
|
||||
}
|
||||
while (++scnt < numclipsects);
|
||||
|
||||
if (outersect==-1)
|
||||
{
|
||||
|
|
|
@ -337,7 +337,8 @@ static void suckbitsnextblock()
|
|||
if (!zipfilmode)
|
||||
{
|
||||
if (!nfilptr)
|
||||
{ //|===|===|crc|lng|typ|===|===|
|
||||
{
|
||||
//|===|===|crc|lng|typ|===|===|
|
||||
// \ fakebuf: /
|
||||
// |===|===|
|
||||
//----x O---x O--------
|
||||
|
@ -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];
|
||||
|
||||
|
@ -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))
|
||||
|
|
|
@ -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;
|
||||
|
@ -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");
|
||||
|
|
|
@ -172,7 +172,8 @@ static LPVOID ChkedTlsGetValue(DWORD idx)
|
|||
|
||||
#if defined(__cplusplus)
|
||||
#if !defined(NO_NED_NAMESPACE)
|
||||
namespace nedalloc {
|
||||
namespace nedalloc
|
||||
{
|
||||
#else
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -290,7 +291,8 @@ static FORCEINLINE NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void *CallRealloc(void
|
|||
size_t *_ret=0, *_mem=(size_t *) mem-3;
|
||||
#endif
|
||||
if (isforeign)
|
||||
{ /* Transfer */
|
||||
{
|
||||
/* Transfer */
|
||||
#if USE_MAGIC_HEADERS
|
||||
assert(_mem[0]!=*(size_t *) "NEDMALOC");
|
||||
#endif
|
||||
|
@ -325,7 +327,8 @@ static FORCEINLINE NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void *CallRealloc(void
|
|||
#endif
|
||||
#endif
|
||||
if (!ret)
|
||||
{ /* Put it back the way it was */
|
||||
{
|
||||
/* Put it back the way it was */
|
||||
#if USE_MAGIC_HEADERS
|
||||
for (; *_mem==0; *_mem++=*(size_t *) "NEDMALOC");
|
||||
#endif
|
||||
|
@ -412,7 +415,8 @@ static NEDMALLOCNOALIASATTR mstate nedblkmstate(void *RESTRICT mem) THROWSPEC
|
|||
result1=header & mask1; /* Positive testing for NT heap */
|
||||
result2=header & mask2; /* Positive testing for dlmalloc */
|
||||
if (result1==0x00000100 && result2!=0x00000102)
|
||||
{ /* This is likely a NT heap block */
|
||||
{
|
||||
/* This is likely a NT heap block */
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -554,7 +558,8 @@ NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void **nedindependent_comalloc(size_t elem
|
|||
struct threadcacheblk_t;
|
||||
typedef struct threadcacheblk_t threadcacheblk;
|
||||
struct threadcacheblk_t
|
||||
{ /* Keep less than 16 bytes on 32 bit systems and 32 bytes on 64 bit systems */
|
||||
{
|
||||
/* Keep less than 16 bytes on 32 bit systems and 32 bytes on 64 bit systems */
|
||||
#ifdef FULLSANITYCHECKS
|
||||
unsigned int magic;
|
||||
#endif
|
||||
|
@ -589,7 +594,8 @@ struct nedpool_t
|
|||
static nedpool syspool;
|
||||
|
||||
static FORCEINLINE NEDMALLOCNOALIASATTR unsigned int size2binidx(size_t _size) THROWSPEC
|
||||
{ /* 8=1000 16=10000 20=10100 24=11000 32=100000 48=110000 4096=1000000000000 */
|
||||
{
|
||||
/* 8=1000 16=10000 20=10100 24=11000 32=100000 48=110000 4096=1000000000000 */
|
||||
unsigned int topbit, size=(unsigned int)(_size>>4);
|
||||
/* 16=1 20=1 24=1 32=10 48=11 64=100 96=110 128=1000 4096=100000000 */
|
||||
|
||||
|
@ -741,7 +747,8 @@ static NOINLINE threadcache *AllocCache(nedpool *RESTRICT p) THROWSPEC
|
|||
#endif
|
||||
for (n=0; n<THREADCACHEMAXCACHES && p->caches[n]; n++);
|
||||
if (THREADCACHEMAXCACHES==n)
|
||||
{ /* List exhausted, so disable for this thread */
|
||||
{
|
||||
/* List exhausted, so disable for this thread */
|
||||
#if USE_LOCKS
|
||||
RELEASE_LOCK(&p->mutex);
|
||||
#endif
|
||||
|
@ -814,7 +821,8 @@ static void *threadcache_malloc(nedpool *RESTRICT p, threadcache *RESTRICT tc, s
|
|||
/* Try to match close, but move up a bin if necessary */
|
||||
blk=*binsptr;
|
||||
if (!blk || blk->size<size)
|
||||
{ /* Bump it up a bin */
|
||||
{
|
||||
/* Bump it up a bin */
|
||||
if (idx<THREADCACHEMAXBINS)
|
||||
{
|
||||
idx++;
|
||||
|
@ -944,7 +952,8 @@ static void threadcache_free(nedpool *RESTRICT p, threadcache *RESTRICT tc, int
|
|||
|
||||
|
||||
static NOINLINE int InitPool(nedpool *RESTRICT p, size_t capacity, int threads) THROWSPEC
|
||||
{ /* threads is -1 for system pool */
|
||||
{
|
||||
/* threads is -1 for system pool */
|
||||
ensure_initialization();
|
||||
ACQUIRE_MALLOC_GLOBAL_LOCK();
|
||||
if (p->threads) goto done;
|
||||
|
@ -982,7 +991,8 @@ err:
|
|||
return 0;
|
||||
}
|
||||
static NOINLINE mstate FindMSpace(nedpool *RESTRICT p, threadcache *RESTRICT tc, int *RESTRICT lastUsed, size_t size) THROWSPEC
|
||||
{ /* Gets called when thread's last used mspace is in use. The strategy
|
||||
{
|
||||
/* Gets called when thread's last used mspace is in use. The strategy
|
||||
is to run through the list of all available mspaces looking for an
|
||||
unlocked one and if we fail, we create a new one so long as we don't
|
||||
exceed p->threads */
|
||||
|
@ -1011,7 +1021,8 @@ static NOINLINE mstate FindMSpace(nedpool *RESTRICT p, threadcache *RESTRICT tc,
|
|||
while (p->m[end] && end<p->threads)
|
||||
end++;
|
||||
if (end>=p->threads)
|
||||
{ /* Drat, must destroy it now */
|
||||
{
|
||||
/* Drat, must destroy it now */
|
||||
RELEASE_LOCK(&p->mutex);
|
||||
#if USE_ALLOCATOR==1
|
||||
destroy_mspace((mstate) temp);
|
||||
|
@ -1207,11 +1218,13 @@ void nedtrimthreadcache(nedpool *p, int disable) THROWSPEC
|
|||
}
|
||||
mycache=(int)(size_t) TLSGET(p->mycache);
|
||||
if (!mycache)
|
||||
{ /* Set to mspace 0 */
|
||||
{
|
||||
/* Set to mspace 0 */
|
||||
if (disable && TLSSET(p->mycache, (void *)(size_t)-1)) abort();
|
||||
}
|
||||
else if (mycache>0)
|
||||
{ /* Set to last used mspace */
|
||||
{
|
||||
/* Set to last used mspace */
|
||||
threadcache *tc=p->caches[mycache-1];
|
||||
#if defined(DEBUG)
|
||||
printf("Threadcache utilisation: %lf%% in cache with %lf%% lost to other threads\n",
|
||||
|
@ -1253,7 +1266,8 @@ void neddisablethreadcache(nedpool *p) THROWSPEC
|
|||
#endif
|
||||
|
||||
static FORCEINLINE mstate GetMSpace(nedpool *RESTRICT p, threadcache *RESTRICT tc, int mymspace, size_t size) THROWSPEC
|
||||
{ /* Returns a locked and ready for use mspace */
|
||||
{
|
||||
/* Returns a locked and ready for use mspace */
|
||||
mstate m=p->m[mymspace];
|
||||
assert(m);
|
||||
#if USE_LOCKS && USE_ALLOCATOR==1
|
||||
|
@ -1270,10 +1284,12 @@ static NOINLINE void GetThreadCache_cold1(nedpool *RESTRICT *RESTRICT p) THROWSP
|
|||
static NOINLINE void GetThreadCache_cold2(nedpool *RESTRICT *RESTRICT p, threadcache *RESTRICT *RESTRICT tc, int *RESTRICT mymspace, int mycache) THROWSPEC
|
||||
{
|
||||
if (!mycache)
|
||||
{ /* Need to allocate a new cache */
|
||||
{
|
||||
/* Need to allocate a new cache */
|
||||
*tc=AllocCache(*p);
|
||||
if (!*tc)
|
||||
{ /* Disable */
|
||||
{
|
||||
/* Disable */
|
||||
if (TLSSET((*p)->mycache, (void *)(size_t)-1)) abort();
|
||||
*mymspace=0;
|
||||
}
|
||||
|
@ -1294,7 +1310,8 @@ static FORCEINLINE void GetThreadCache(nedpool *RESTRICT *RESTRICT p, threadcach
|
|||
GetThreadCache_cold1(p);
|
||||
mycache=(int)(size_t) TLSGET((*p)->mycache);
|
||||
if (mycache>0)
|
||||
{ /* Already have a cache */
|
||||
{
|
||||
/* Already have a cache */
|
||||
*tc=(*p)->caches[mycache-1];
|
||||
*mymspace=(*tc)->mymspace;
|
||||
}
|
||||
|
@ -1322,12 +1339,14 @@ NEDMALLOCPTRATTR void * nedpmalloc(nedpool *p, size_t size) THROWSPEC
|
|||
GetThreadCache(&p, &tc, &mymspace, &size);
|
||||
#if THREADCACHEMAX
|
||||
if (tc && size<=THREADCACHEMAX)
|
||||
{ /* Use the thread cache */
|
||||
{
|
||||
/* Use the thread cache */
|
||||
ret=threadcache_malloc(p, tc, &size);
|
||||
}
|
||||
#endif
|
||||
if (!ret)
|
||||
{ /* Use this thread's mspace */
|
||||
{
|
||||
/* Use this thread's mspace */
|
||||
GETMSPACE(m, p, tc, mymspace, size,
|
||||
ret=CallMalloc(m, size, 0));
|
||||
}
|
||||
|
@ -1342,13 +1361,15 @@ NEDMALLOCPTRATTR void * nedpcalloc(nedpool *p, size_t no, size_t size) THROWSPEC
|
|||
GetThreadCache(&p, &tc, &mymspace, &rsize);
|
||||
#if THREADCACHEMAX
|
||||
if (tc && rsize<=THREADCACHEMAX)
|
||||
{ /* Use the thread cache */
|
||||
{
|
||||
/* Use the thread cache */
|
||||
if ((ret=threadcache_malloc(p, tc, &rsize)))
|
||||
memset(ret, 0, rsize);
|
||||
}
|
||||
#endif
|
||||
if (!ret)
|
||||
{ /* Use this thread's mspace */
|
||||
{
|
||||
/* Use this thread's mspace */
|
||||
GETMSPACE(m, p, tc, mymspace, rsize,
|
||||
ret=CallCalloc(m, rsize, 0));
|
||||
}
|
||||
|
@ -1379,7 +1400,8 @@ NEDMALLOCPTRATTR void * nedprealloc(nedpool *p, void *mem, size_t size) THROWSPE
|
|||
GetThreadCache(&p, &tc, &mymspace, &size);
|
||||
#if THREADCACHEMAX
|
||||
if (tc && size && size<=THREADCACHEMAX)
|
||||
{ /* Use the thread cache */
|
||||
{
|
||||
/* Use the thread cache */
|
||||
if ((ret=threadcache_malloc(p, tc, &size)))
|
||||
{
|
||||
memcpy(ret, mem, memsize<size ? memsize : size);
|
||||
|
@ -1391,20 +1413,23 @@ NEDMALLOCPTRATTR void * nedprealloc(nedpool *p, void *mem, size_t size) THROWSPE
|
|||
}
|
||||
#endif
|
||||
if (!ret)
|
||||
{ /* Reallocs always happen in the mspace they happened in, so skip
|
||||
{
|
||||
/* Reallocs always happen in the mspace they happened in, so skip
|
||||
locking the preferred mspace for this thread */
|
||||
ret=CallRealloc(p->m[mymspace], mem, isforeign, memsize, size);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
void nedpfree(nedpool *p, void *mem) THROWSPEC
|
||||
{ /* Frees always happen in the mspace they happened in, so skip
|
||||
{
|
||||
/* Frees always happen in the mspace they happened in, so skip
|
||||
locking the preferred mspace for this thread */
|
||||
threadcache *tc;
|
||||
int mymspace, isforeign=1;
|
||||
size_t memsize;
|
||||
if (!mem)
|
||||
{ /* If you tried this on FreeBSD you'd be sorry! */
|
||||
{
|
||||
/* If you tried this on FreeBSD you'd be sorry! */
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "nedmalloc: WARNING nedpfree() called with zero. This is not portable behaviour!\n");
|
||||
#endif
|
||||
|
|
|
@ -283,17 +283,17 @@ int32_t OSD_OSDKey(void)
|
|||
|
||||
char *OSD_GetTextPtr(void)
|
||||
{
|
||||
return (&osdtext[0]);
|
||||
return osdtext;
|
||||
}
|
||||
|
||||
char *OSD_GetFmtPtr(void)
|
||||
{
|
||||
return (&osdfmt[0]);
|
||||
return osdfmt;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -770,8 +769,12 @@ 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);
|
||||
}
|
||||
|
@ -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,7 +1516,8 @@ 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;
|
||||
|
@ -1533,6 +1532,7 @@ void OSD_Printf(const char *fmt, ...)
|
|||
{
|
||||
chp = Bstrdup(tmpstr);
|
||||
Bfputs(OSD_StripColors(chp, tmpstr), osdlog);
|
||||
Bprintf("%s", chp);
|
||||
Bfree(chp);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
@ -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++)
|
||||
|
@ -1857,19 +1876,23 @@ static int32_t SDL_WaitEventTimeout(SDL_Event * event, int32_t timeout)
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
#include "editor.h"
|
||||
#include "baselayer.h"
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
TAB_CONFIG,
|
||||
TAB_MESSAGES,
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue