raze-gles/polymer/eduke32/source/sw/src/common.c

76 lines
1.6 KiB
C
Raw Normal View History

#include "build.h"
#include "common_game.h"
static const char *defaultgrpfilename = "sw.grp";
static const char *defaultdeffilename = "sw.def";
// g_grpNamePtr can ONLY point to a malloc'd block (length BMAX_PATH)
char *g_grpNamePtr = NULL;
void clearGrpNamePtr(void)
{
if (g_grpNamePtr != NULL)
Bfree(g_grpNamePtr);
// g_grpNamePtr assumed to be assigned to right after
}
const char *G_DefaultGrpFile(void)
{
return defaultgrpfilename;
}
const char *G_GrpFile(void)
{
if (g_grpNamePtr == NULL)
return G_DefaultGrpFile();
else
return g_grpNamePtr;
}
const char *G_DefaultDefFile(void)
{
return defaultdeffilename;
}
const char *G_DefFile(void)
{
if (g_defNamePtr == NULL)
return G_DefaultDefFile();
else
return g_defNamePtr;
}
#define NUMPSKYMULTIS 1
EDUKE32_STATIC_ASSERT(NUMPSKYMULTIS <= MAXPSKYMULTIS);
EDUKE32_STATIC_ASSERT(PSKYOFF_MAX <= MAXPSKYTILES);
// Set up new-style multi-psky handling.
void SW_InitMultiPsky(void)
{
int32_t i;
static int32_t inited;
if (inited)
return;
inited = 1;
multipskytile[0] = -1;
pskynummultis = NUMPSKYMULTIS;
// When adding other multi-skies, take care that the tileofs[] values are
// <= PSKYOFF_MAX. (It can be increased up to MAXPSKYTILES, but should be
// set as tight as possible.)
// The default sky properties (all others are implicitly zero):
multipsky[0].lognumtiles = 1;
multipsky[0].horizfrac = 8192;
for (i=0; i<pskynummultis; ++i)
{
int32_t j;
for (j=0; j<(1<<multipsky[i].lognumtiles); ++j)
Bassert(multipsky[i].tileofs[j] <= PSKYOFF_MAX);
}
}