mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
More function name cleanup
git-svn-id: https://svn.eduke32.com/eduke32@6830 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
1fd209444f
commit
e5bcc1cf81
24 changed files with 176 additions and 181 deletions
|
@ -1032,28 +1032,27 @@ int32_t clipmapinfo_load(void);
|
||||||
#endif
|
#endif
|
||||||
int32_t saveboard(const char *filename, const vec3_t *dapos, int16_t daang, int16_t dacursectnum);
|
int32_t saveboard(const char *filename, const vec3_t *dapos, int16_t daang, int16_t dacursectnum);
|
||||||
|
|
||||||
void E_CreateDummyTile(int32_t const tile);
|
void tileSetupDummy(int32_t const tile);
|
||||||
void E_CreateFakeTile(int32_t const tile, int32_t tsiz, char const * const buffer);
|
void tileSetData(int32_t const tile, int32_t tsiz, char const * const buffer);
|
||||||
void E_UndefineTile(int32_t const tile);
|
void tileDelete(int32_t const tile);
|
||||||
void set_tilesiz(int32_t picnum, int16_t dasizx, int16_t dasizy);
|
void tileSetSize(int32_t picnum, int16_t dasizx, int16_t dasizy);
|
||||||
int32_t tile_exists(int32_t picnum);
|
int32_t artReadHeader(int32_t const fil, char const * const fn, artheader_t * const local);
|
||||||
int32_t E_ReadArtFileHeader(int32_t const fil, char const * const fn, artheader_t * const local);
|
int32_t artReadHeaderFromBuffer(uint8_t const * const buf, artheader_t * const local);
|
||||||
int32_t E_ReadArtFileHeaderFromBuffer(uint8_t const * const buf, artheader_t * const local);
|
int32_t artCheckUnitFileHeader(uint8_t const * const buf, int32_t length);
|
||||||
int32_t E_CheckUnitArtFileHeader(uint8_t const * const buf, int32_t length);
|
void tileConvertAnimFormat(int32_t const picnum);
|
||||||
void E_ConvertARTv1picanmToMemory(int32_t const picnum);
|
void artReadManifest(int32_t const fil, artheader_t const * const local);
|
||||||
void E_ReadArtFileTileInfo(int32_t const fil, artheader_t const * const local);
|
void artPreloadFile(int32_t const fil, artheader_t const * const local);
|
||||||
void E_ReadArtFileIntoFakeData(int32_t const fil, artheader_t const * const local);
|
int32_t artLoadFiles(const char *filename, int32_t askedsize);
|
||||||
int32_t loadpics(const char *filename, int32_t askedsize);
|
void artClearMapArt(void);
|
||||||
void E_MapArt_Clear(void);
|
void artSetupMapArt(const char *filename);
|
||||||
void E_MapArt_Setup(const char *filename);
|
bool tileLoad(int16_t tilenume);
|
||||||
void loadtile(int16_t tilenume);
|
void tileLoadData(int16_t tilenume, int32_t dasiz, char *buffer);
|
||||||
void E_LoadTileIntoBuffer(int16_t tilenume, int32_t dasiz, char *buffer);
|
void artConvertRGB(palette_t * pic, uint8_t const * buf, int32_t bufsizx, int32_t sizx, int32_t sizy);
|
||||||
void E_RenderArtDataIntoBuffer(palette_t * pic, uint8_t const * buf, int32_t bufsizx, int32_t sizx, int32_t sizy);
|
|
||||||
|
|
||||||
int32_t qloadkvx(int32_t voxindex, const char *filename);
|
int32_t qloadkvx(int32_t voxindex, const char *filename);
|
||||||
void vox_undefine(int32_t const);
|
void vox_undefine(int32_t const);
|
||||||
intptr_t allocatepermanenttile(int16_t tilenume, int32_t xsiz, int32_t ysiz);
|
intptr_t tileCreate(int16_t tilenume, int32_t xsiz, int32_t ysiz);
|
||||||
void copytilepiece(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, int32_t ysiz, int32_t tilenume2, int32_t sx2, int32_t sy2);
|
void tileCopySection(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, int32_t ysiz, int32_t tilenume2, int32_t sx2, int32_t sy2);
|
||||||
void squarerotatetile(int16_t tilenume);
|
void squarerotatetile(int16_t tilenume);
|
||||||
|
|
||||||
int32_t videoSetGameMode(char davidoption, int32_t daxdim, int32_t daydim, int32_t dabpp);
|
int32_t videoSetGameMode(char davidoption, int32_t daxdim, int32_t daydim, int32_t dabpp);
|
||||||
|
|
|
@ -18,9 +18,9 @@ extern int32_t kpzbufsiz;
|
||||||
extern int32_t kpzbufloadfil(int32_t);
|
extern int32_t kpzbufloadfil(int32_t);
|
||||||
extern int32_t kpzbufload(const char *);
|
extern int32_t kpzbufload(const char *);
|
||||||
|
|
||||||
void initcache(intptr_t dacachestart, int32_t dacachesize);
|
void cacheInitBuffer(intptr_t dacachestart, int32_t dacachesize);
|
||||||
void allocache(intptr_t *newhandle, int32_t newbytes, char *newlockptr);
|
void cacheAllocateBlock(intptr_t *newhandle, int32_t newbytes, char *newlockptr);
|
||||||
void agecache(void);
|
void cacheAgeEntries(void);
|
||||||
|
|
||||||
extern int32_t pathsearchmode; // 0 = gamefs mode (default), 1 = localfs mode (editor's mode)
|
extern int32_t pathsearchmode; // 0 = gamefs mode (default), 1 = localfs mode (editor's mode)
|
||||||
char *listsearchpath(int32_t initp);
|
char *listsearchpath(int32_t initp);
|
||||||
|
|
|
@ -1044,7 +1044,7 @@ int32_t getspritecol(int32_t spr)
|
||||||
|
|
||||||
if (tilecol) return palookup[pal][tilecol];
|
if (tilecol) return palookup[pal][tilecol];
|
||||||
|
|
||||||
if (!waloff[picnum]) loadtile(picnum);
|
if (!waloff[picnum]) tileLoad(picnum);
|
||||||
if (!waloff[picnum]) return editorcolors[3];
|
if (!waloff[picnum]) return editorcolors[3];
|
||||||
|
|
||||||
// Calculate 2D mode tile color.
|
// Calculate 2D mode tile color.
|
||||||
|
|
|
@ -466,7 +466,7 @@ int32_t baselayer_init(void)
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
for (native_t i=0; i<ARRAY_SIZE(cvars_engine); i++)
|
for (native_t i=0; i<ARRAY_SSIZE(cvars_engine); i++)
|
||||||
OSD_RegisterCvar(&cvars_engine[i], (cvars_engine[i].flags & CVAR_FUNCPTR) ? osdcmd_cvar_set_baselayer : osdcmd_cvar_set);
|
OSD_RegisterCvar(&cvars_engine[i], (cvars_engine[i].flags & CVAR_FUNCPTR) ? osdcmd_cvar_set_baselayer : osdcmd_cvar_set);
|
||||||
|
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
|
|
|
@ -468,7 +468,7 @@ static void reset_default_mapstate(void)
|
||||||
|
|
||||||
initspritelists();
|
initspritelists();
|
||||||
taglab_init();
|
taglab_init();
|
||||||
E_MapArt_Clear();
|
artClearMapArt();
|
||||||
#ifdef YAX_ENABLE
|
#ifdef YAX_ENABLE
|
||||||
yax_resetbunchnums();
|
yax_resetbunchnums();
|
||||||
#endif
|
#endif
|
||||||
|
@ -677,7 +677,7 @@ int app_main(int argc, char const * const * argv)
|
||||||
timerInit(TIMERINTSPERSECOND);
|
timerInit(TIMERINTSPERSECOND);
|
||||||
timerSetCallback(keytimerstuff);
|
timerSetCallback(keytimerstuff);
|
||||||
|
|
||||||
loadpics("tiles000.art", g_maxCacheSize);
|
artLoadFiles("tiles000.art", g_maxCacheSize);
|
||||||
|
|
||||||
Bstrcpy(kensig,"Uses BUILD technology by Ken Silverman");
|
Bstrcpy(kensig,"Uses BUILD technology by Ken Silverman");
|
||||||
initcrc();
|
initcrc();
|
||||||
|
@ -719,7 +719,7 @@ int app_main(int argc, char const * const * argv)
|
||||||
walock[i] = 255; // permanent tile
|
walock[i] = 255; // permanent tile
|
||||||
picsiz[i] = 5 + (5<<4);
|
picsiz[i] = 5 + (5<<4);
|
||||||
tilesiz[i].x = sx; tilesiz[i].y = sy;
|
tilesiz[i].x = sx; tilesiz[i].y = sy;
|
||||||
allocache(&waloff[i], sx*sy, &walock[i]);
|
cacheAllocateBlock(&waloff[i], sx*sy, &walock[i]);
|
||||||
newtile = (char *)waloff[i];
|
newtile = (char *)waloff[i];
|
||||||
|
|
||||||
col = getclosestcol(128, 128, 0);
|
col = getclosestcol(128, 128, 0);
|
||||||
|
|
|
@ -139,7 +139,7 @@ char toupperlookup[256] =
|
||||||
static void reportandexit(const char *errormessage);
|
static void reportandexit(const char *errormessage);
|
||||||
|
|
||||||
|
|
||||||
void initcache(intptr_t dacachestart, int32_t dacachesize)
|
void cacheInitBuffer(intptr_t dacachestart, int32_t dacachesize)
|
||||||
{
|
{
|
||||||
#ifndef DEBUG_ALLOCACHE_AS_MALLOC
|
#ifndef DEBUG_ALLOCACHE_AS_MALLOC
|
||||||
int32_t i;
|
int32_t i;
|
||||||
|
@ -165,7 +165,7 @@ void initcache(intptr_t dacachestart, int32_t dacachesize)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_ALLOCACHE_AS_MALLOC
|
#ifdef DEBUG_ALLOCACHE_AS_MALLOC
|
||||||
void allocache(intptr_t *newhandle, int32_t newbytes, char *newlockptr)
|
void cacheAllocateBlock(intptr_t *newhandle, int32_t newbytes, char *newlockptr)
|
||||||
{
|
{
|
||||||
UNREFERENCED_PARAMETER(newlockptr);
|
UNREFERENCED_PARAMETER(newlockptr);
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ static inline void inc_and_check_cacnum(void)
|
||||||
reportandexit("Too many objects in cache! (cacnum > MAXCACHEOBJECTS)");
|
reportandexit("Too many objects in cache! (cacnum > MAXCACHEOBJECTS)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void allocache(intptr_t *newhandle, int32_t newbytes, char *newlockptr)
|
void cacheAllocateBlock(intptr_t *newhandle, int32_t newbytes, char *newlockptr)
|
||||||
{
|
{
|
||||||
if (EDUKE32_PREDICT_FALSE(*newlockptr == 0))
|
if (EDUKE32_PREDICT_FALSE(*newlockptr == 0))
|
||||||
reportandexit("ALLOCACHE CALLED WITH LOCK OF 0!");
|
reportandexit("ALLOCACHE CALLED WITH LOCK OF 0!");
|
||||||
|
@ -290,7 +290,7 @@ void allocache(intptr_t *newhandle, int32_t newbytes, char *newlockptr)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void agecache(void)
|
void cacheAgeEntries(void)
|
||||||
{
|
{
|
||||||
#ifndef DEBUG_ALLOCACHE_AS_MALLOC
|
#ifndef DEBUG_ALLOCACHE_AS_MALLOC
|
||||||
static int32_t agecount;
|
static int32_t agecount;
|
||||||
|
|
|
@ -219,7 +219,7 @@ static void tile_from_truecolpic(int32_t tile, const palette_t *picptr, int32_t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
E_CreateFakeTile(tile, tsiz, faketilebuffer);
|
tileSetData(tile, tsiz, faketilebuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Defs_LoadTileIntoBuffer(int32_t const tile)
|
static int32_t Defs_LoadTileIntoBuffer(int32_t const tile)
|
||||||
|
@ -232,7 +232,7 @@ static int32_t Defs_LoadTileIntoBuffer(int32_t const tile)
|
||||||
|
|
||||||
maybe_grow_buffer(&faketilebuffer, &faketilebuffersiz, tsiz);
|
maybe_grow_buffer(&faketilebuffer, &faketilebuffersiz, tsiz);
|
||||||
|
|
||||||
E_LoadTileIntoBuffer(tile, tsiz, faketilebuffer);
|
tileLoadData(tile, tsiz, faketilebuffer);
|
||||||
|
|
||||||
return tsiz;
|
return tsiz;
|
||||||
}
|
}
|
||||||
|
@ -258,32 +258,32 @@ static int32_t Defs_ImportTileFromTexture(char const * const fn, int32_t const t
|
||||||
|
|
||||||
if (!picptr)
|
if (!picptr)
|
||||||
{
|
{
|
||||||
int32_t const artstatus = E_CheckUnitArtFileHeader((uint8_t *)kpzbuf, length);
|
int32_t const artstatus = artCheckUnitFileHeader((uint8_t *)kpzbuf, length);
|
||||||
if (artstatus < 0)
|
if (artstatus < 0)
|
||||||
return artstatus<<8;
|
return artstatus<<8;
|
||||||
|
|
||||||
Bmemcpy(&picanm[tile], &kpzbuf[20], sizeof(picanm_t));
|
Bmemcpy(&picanm[tile], &kpzbuf[20], sizeof(picanm_t));
|
||||||
E_ConvertARTv1picanmToMemory(tile);
|
tileConvertAnimFormat(tile);
|
||||||
|
|
||||||
int32_t const xsiz = B_LITTLE16(B_UNBUF16(&kpzbuf[16]));
|
int32_t const xsiz = B_LITTLE16(B_UNBUF16(&kpzbuf[16]));
|
||||||
int32_t const ysiz = B_LITTLE16(B_UNBUF16(&kpzbuf[18]));
|
int32_t const ysiz = B_LITTLE16(B_UNBUF16(&kpzbuf[18]));
|
||||||
|
|
||||||
if (EDUKE32_PREDICT_FALSE(xsiz <= 0 || ysiz <= 0))
|
if (EDUKE32_PREDICT_FALSE(xsiz <= 0 || ysiz <= 0))
|
||||||
{
|
{
|
||||||
E_UndefineTile(tile);
|
tileDelete(tile);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_tilesiz(tile, xsiz, ysiz);
|
tileSetSize(tile, xsiz, ysiz);
|
||||||
int32_t const dasiz = xsiz * ysiz;
|
int32_t const dasiz = xsiz * ysiz;
|
||||||
|
|
||||||
if (EDUKE32_PREDICT_FALSE(ARTv1_UNITOFFSET + dasiz > length))
|
if (EDUKE32_PREDICT_FALSE(ARTv1_UNITOFFSET + dasiz > length))
|
||||||
{
|
{
|
||||||
E_CreateDummyTile(tile);
|
tileSetupDummy(tile);
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
E_CreateFakeTile(tile, dasiz, &kpzbuf[ARTv1_UNITOFFSET]);
|
tileSetData(tile, dasiz, &kpzbuf[ARTv1_UNITOFFSET]);
|
||||||
|
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
if (istexture)
|
if (istexture)
|
||||||
|
@ -299,7 +299,7 @@ static int32_t Defs_ImportTileFromTexture(char const * const fn, int32_t const t
|
||||||
if (!(paletteloaded & PALETTE_MAIN))
|
if (!(paletteloaded & PALETTE_MAIN))
|
||||||
return -3;
|
return -3;
|
||||||
|
|
||||||
set_tilesiz(tile, xsiz, ysiz);
|
tileSetSize(tile, xsiz, ysiz);
|
||||||
|
|
||||||
tile_from_truecolpic(tile, picptr, alphacut);
|
tile_from_truecolpic(tile, picptr, alphacut);
|
||||||
|
|
||||||
|
@ -679,7 +679,7 @@ static int32_t defsparser(scriptfile *script)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
artheader_t local;
|
artheader_t local;
|
||||||
int32_t headerval = E_ReadArtFileHeader(fil, fn, &local);
|
int32_t headerval = artReadHeader(fil, fn, &local);
|
||||||
if (headerval != 0)
|
if (headerval != 0)
|
||||||
{
|
{
|
||||||
kclose(fil);
|
kclose(fil);
|
||||||
|
@ -695,8 +695,8 @@ static int32_t defsparser(scriptfile *script)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
E_ReadArtFileTileInfo(fil, &local);
|
artReadManifest(fil, &local);
|
||||||
E_ReadArtFileIntoFakeData(fil, &local);
|
artPreloadFile(fil, &local);
|
||||||
|
|
||||||
kclose(fil);
|
kclose(fil);
|
||||||
}
|
}
|
||||||
|
@ -982,7 +982,7 @@ static int32_t defsparser(scriptfile *script)
|
||||||
|
|
||||||
if (havetile)
|
if (havetile)
|
||||||
{
|
{
|
||||||
E_CreateFakeTile(tile, tsiz, faketilebuffer);
|
tileSetData(tile, tsiz, faketilebuffer);
|
||||||
}
|
}
|
||||||
else // if !havetile, we have never confirmed a valid source
|
else // if !havetile, we have never confirmed a valid source
|
||||||
{
|
{
|
||||||
|
@ -992,11 +992,11 @@ static int32_t defsparser(scriptfile *script)
|
||||||
|
|
||||||
if (tsiz <= 0)
|
if (tsiz <= 0)
|
||||||
{
|
{
|
||||||
E_UndefineTile(tile);
|
tileDelete(tile);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_tilesiz(tile, tilesiz[source].x, tilesiz[source].y);
|
tileSetSize(tile, tilesiz[source].x, tilesiz[source].y);
|
||||||
picanm[tile].xofs = havexoffset ? clamp(xoffset, -128, 127) : picanm[source].xofs;
|
picanm[tile].xofs = havexoffset ? clamp(xoffset, -128, 127) : picanm[source].xofs;
|
||||||
picanm[tile].yofs = haveyoffset ? clamp(yoffset, -128, 127) : picanm[source].yofs;
|
picanm[tile].yofs = haveyoffset ? clamp(yoffset, -128, 127) : picanm[source].yofs;
|
||||||
picanm[tile].sf = (picanm[tile].sf & ~PICANM_MISC_MASK) | (picanm[source].sf & PICANM_MISC_MASK) | flags;
|
picanm[tile].sf = (picanm[tile].sf & ~PICANM_MISC_MASK) | (picanm[source].sf & PICANM_MISC_MASK) | flags;
|
||||||
|
@ -1041,15 +1041,15 @@ static int32_t defsparser(scriptfile *script)
|
||||||
|
|
||||||
if ((int16_t) xsiz == 0 || (int16_t) ysiz == 0)
|
if ((int16_t) xsiz == 0 || (int16_t) ysiz == 0)
|
||||||
{
|
{
|
||||||
E_UndefineTile(tile);
|
tileDelete(tile);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xsiz > 0 && ysiz > 0)
|
if (xsiz > 0 && ysiz > 0)
|
||||||
{
|
{
|
||||||
set_tilesiz(tile, xsiz, ysiz);
|
tileSetSize(tile, xsiz, ysiz);
|
||||||
Bmemset(&picanm[tile], 0, sizeof(picanm_t));
|
Bmemset(&picanm[tile], 0, sizeof(picanm_t));
|
||||||
E_CreateDummyTile(tile);
|
tileSetupDummy(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -1072,15 +1072,15 @@ static int32_t defsparser(scriptfile *script)
|
||||||
if ((int16_t) xsiz == 0 || (int16_t) ysiz == 0)
|
if ((int16_t) xsiz == 0 || (int16_t) ysiz == 0)
|
||||||
{
|
{
|
||||||
for (i=tile1; i<=tile2; i++)
|
for (i=tile1; i<=tile2; i++)
|
||||||
E_UndefineTile(i);
|
tileDelete(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=tile1; i<=tile2; i++)
|
for (i=tile1; i<=tile2; i++)
|
||||||
{
|
{
|
||||||
set_tilesiz(i, xsiz, ysiz);
|
tileSetSize(i, xsiz, ysiz);
|
||||||
Bmemset(&picanm[i], 0, sizeof(picanm_t));
|
Bmemset(&picanm[i], 0, sizeof(picanm_t));
|
||||||
E_CreateDummyTile(i);
|
tileSetupDummy(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -1095,7 +1095,7 @@ static int32_t defsparser(scriptfile *script)
|
||||||
if (check_tile("undefinetile", tile, script, cmdtokptr))
|
if (check_tile("undefinetile", tile, script, cmdtokptr))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
E_UndefineTile(tile);
|
tileDelete(tile);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1110,7 +1110,7 @@ static int32_t defsparser(scriptfile *script)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
for (bssize_t i = tile1; i <= tile2; i++)
|
for (bssize_t i = tile1; i <= tile2; i++)
|
||||||
E_UndefineTile(i);
|
tileDelete(i);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2321,9 +2321,9 @@ static int32_t defsparser(scriptfile *script)
|
||||||
|
|
||||||
if (xsiz > 0 && ysiz > 0)
|
if (xsiz > 0 && ysiz > 0)
|
||||||
{
|
{
|
||||||
set_tilesiz(tile, xsiz, ysiz);
|
tileSetSize(tile, xsiz, ysiz);
|
||||||
Bmemset(&picanm[tile], 0, sizeof(picanm_t));
|
Bmemset(&picanm[tile], 0, sizeof(picanm_t));
|
||||||
E_CreateDummyTile(tile);
|
tileSetupDummy(tile);
|
||||||
}
|
}
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
xscale = 1.0f / xscale;
|
xscale = 1.0f / xscale;
|
||||||
|
|
|
@ -1911,7 +1911,7 @@ static void maskwallscan(int32_t x1, int32_t x2, int32_t saturatevplc)
|
||||||
|
|
||||||
setgotpic(globalpicnum);
|
setgotpic(globalpicnum);
|
||||||
|
|
||||||
if (waloff[globalpicnum] == 0) loadtile(globalpicnum);
|
if (waloff[globalpicnum] == 0) tileLoad(globalpicnum);
|
||||||
|
|
||||||
tweak_tsizes(&tsiz);
|
tweak_tsizes(&tsiz);
|
||||||
|
|
||||||
|
@ -2635,7 +2635,7 @@ static int32_t setup_globals_cf1(const usectortype *sec, int32_t pal, int32_t zd
|
||||||
DO_TILE_ANIM(globalpicnum, 0);
|
DO_TILE_ANIM(globalpicnum, 0);
|
||||||
setgotpic(globalpicnum);
|
setgotpic(globalpicnum);
|
||||||
if ((tilesiz[globalpicnum].x <= 0) || (tilesiz[globalpicnum].y <= 0)) return 1;
|
if ((tilesiz[globalpicnum].x <= 0) || (tilesiz[globalpicnum].y <= 0)) return 1;
|
||||||
if (waloff[globalpicnum] == 0) loadtile(globalpicnum);
|
if (waloff[globalpicnum] == 0) tileLoad(globalpicnum);
|
||||||
|
|
||||||
globalbufplc = waloff[globalpicnum];
|
globalbufplc = waloff[globalpicnum];
|
||||||
|
|
||||||
|
@ -2934,7 +2934,7 @@ static void wallscan(int32_t x1, int32_t x2,
|
||||||
if ((uwal[x1] > ydimen) && (uwal[x2] > ydimen)) return;
|
if ((uwal[x1] > ydimen) && (uwal[x2] > ydimen)) return;
|
||||||
if ((dwal[x1] < 0) && (dwal[x2] < 0)) return;
|
if ((dwal[x1] < 0) && (dwal[x2] < 0)) return;
|
||||||
|
|
||||||
if (waloff[globalpicnum] == 0) loadtile(globalpicnum);
|
if (waloff[globalpicnum] == 0) tileLoad(globalpicnum);
|
||||||
|
|
||||||
tweak_tsizes(&tsiz);
|
tweak_tsizes(&tsiz);
|
||||||
|
|
||||||
|
@ -3155,7 +3155,7 @@ static void transmaskwallscan(int32_t x1, int32_t x2, int32_t saturatevplc)
|
||||||
if ((tilesiz[globalpicnum].x <= 0) || (tilesiz[globalpicnum].y <= 0))
|
if ((tilesiz[globalpicnum].x <= 0) || (tilesiz[globalpicnum].y <= 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (waloff[globalpicnum] == 0) loadtile(globalpicnum);
|
if (waloff[globalpicnum] == 0) tileLoad(globalpicnum);
|
||||||
|
|
||||||
setuptvlineasm(globalshiftval, saturatevplc);
|
setuptvlineasm(globalshiftval, saturatevplc);
|
||||||
|
|
||||||
|
@ -3429,7 +3429,7 @@ static void grouscan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat)
|
||||||
DO_TILE_ANIM(globalpicnum, sectnum);
|
DO_TILE_ANIM(globalpicnum, sectnum);
|
||||||
setgotpic(globalpicnum);
|
setgotpic(globalpicnum);
|
||||||
if ((tilesiz[globalpicnum].x <= 0) || (tilesiz[globalpicnum].y <= 0)) return;
|
if ((tilesiz[globalpicnum].x <= 0) || (tilesiz[globalpicnum].y <= 0)) return;
|
||||||
if (waloff[globalpicnum] == 0) loadtile(globalpicnum);
|
if (waloff[globalpicnum] == 0) tileLoad(globalpicnum);
|
||||||
|
|
||||||
wal = (uwalltype *)&wall[sec->wallptr];
|
wal = (uwalltype *)&wall[sec->wallptr];
|
||||||
wx = wall[wal->point2].x - wal->x;
|
wx = wall[wal->point2].x - wal->x;
|
||||||
|
@ -5584,7 +5584,7 @@ draw_as_face_sprite:
|
||||||
globalpicnum = tilenum;
|
globalpicnum = tilenum;
|
||||||
if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
|
if ((unsigned)globalpicnum >= (unsigned)MAXTILES) globalpicnum = 0;
|
||||||
|
|
||||||
if (waloff[globalpicnum] == 0) loadtile(globalpicnum);
|
if (waloff[globalpicnum] == 0) tileLoad(globalpicnum);
|
||||||
setgotpic(globalpicnum);
|
setgotpic(globalpicnum);
|
||||||
globalbufplc = waloff[globalpicnum];
|
globalbufplc = waloff[globalpicnum];
|
||||||
|
|
||||||
|
@ -6615,7 +6615,7 @@ static void dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t
|
||||||
nextv = v;
|
nextv = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (waloff[picnum] == 0) loadtile(picnum);
|
if (waloff[picnum] == 0) tileLoad(picnum);
|
||||||
setgotpic(picnum);
|
setgotpic(picnum);
|
||||||
bufplc = waloff[picnum];
|
bufplc = waloff[picnum];
|
||||||
|
|
||||||
|
@ -8768,7 +8768,7 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang)
|
||||||
DO_TILE_ANIM(globalpicnum, s);
|
DO_TILE_ANIM(globalpicnum, s);
|
||||||
setgotpic(globalpicnum);
|
setgotpic(globalpicnum);
|
||||||
if ((tilesiz[globalpicnum].x <= 0) || (tilesiz[globalpicnum].y <= 0)) continue;
|
if ((tilesiz[globalpicnum].x <= 0) || (tilesiz[globalpicnum].y <= 0)) continue;
|
||||||
if (waloff[globalpicnum] == 0) loadtile(globalpicnum);
|
if (waloff[globalpicnum] == 0) tileLoad(globalpicnum);
|
||||||
globalbufplc = waloff[globalpicnum];
|
globalbufplc = waloff[globalpicnum];
|
||||||
globalshade = max(min(sec->floorshade,numshades-1),0);
|
globalshade = max(min(sec->floorshade,numshades-1),0);
|
||||||
globvis = globalhisibility;
|
globvis = globalhisibility;
|
||||||
|
@ -8893,7 +8893,7 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang)
|
||||||
DO_TILE_ANIM(globalpicnum, s);
|
DO_TILE_ANIM(globalpicnum, s);
|
||||||
setgotpic(globalpicnum);
|
setgotpic(globalpicnum);
|
||||||
if ((tilesiz[globalpicnum].x <= 0) || (tilesiz[globalpicnum].y <= 0)) continue;
|
if ((tilesiz[globalpicnum].x <= 0) || (tilesiz[globalpicnum].y <= 0)) continue;
|
||||||
if (waloff[globalpicnum] == 0) loadtile(globalpicnum);
|
if (waloff[globalpicnum] == 0) tileLoad(globalpicnum);
|
||||||
globalbufplc = waloff[globalpicnum];
|
globalbufplc = waloff[globalpicnum];
|
||||||
|
|
||||||
// 'loading' the tile doesn't actually guarantee that it's there afterwards.
|
// 'loading' the tile doesn't actually guarantee that it's there afterwards.
|
||||||
|
@ -9337,7 +9337,7 @@ skip_reading_mapbin:
|
||||||
system_getcvars();
|
system_getcvars();
|
||||||
|
|
||||||
// Per-map ART
|
// Per-map ART
|
||||||
E_MapArt_Setup(filename);
|
artSetupMapArt(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
// initprintf("Loaded map \"%s\" (md4sum: %08x%08x%08x%08x)\n", filename, B_BIG32(*((int32_t*)&md4out[0])), B_BIG32(*((int32_t*)&md4out[4])), B_BIG32(*((int32_t*)&md4out[8])), B_BIG32(*((int32_t*)&md4out[12])));
|
// initprintf("Loaded map \"%s\" (md4sum: %08x%08x%08x%08x)\n", filename, B_BIG32(*((int32_t*)&md4out[0])), B_BIG32(*((int32_t*)&md4out[4])), B_BIG32(*((int32_t*)&md4out[8])), B_BIG32(*((int32_t*)&md4out[12])));
|
||||||
|
@ -9982,7 +9982,7 @@ void videoNextPage(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
faketimerhandler();
|
faketimerhandler();
|
||||||
agecache();
|
cacheAgeEntries();
|
||||||
|
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
omdtims = mdtims;
|
omdtims = mdtims;
|
||||||
|
@ -10016,7 +10016,7 @@ int32_t qloadkvx(int32_t voxindex, const char *filename)
|
||||||
|
|
||||||
//Must store filenames to use cacheing system :(
|
//Must store filenames to use cacheing system :(
|
||||||
voxlock[voxindex][i] = 200;
|
voxlock[voxindex][i] = 200;
|
||||||
allocache(&voxoff[voxindex][i], dasiz, &voxlock[voxindex][i]);
|
cacheAllocateBlock(&voxoff[voxindex][i], dasiz, &voxlock[voxindex][i]);
|
||||||
|
|
||||||
char *ptr = (char *) voxoff[voxindex][i];
|
char *ptr = (char *) voxoff[voxindex][i];
|
||||||
kread(fil, ptr, dasiz);
|
kread(fil, ptr, dasiz);
|
||||||
|
@ -10903,7 +10903,7 @@ restart_grand:
|
||||||
DO_TILE_ANIM(tilenum, 0);
|
DO_TILE_ANIM(tilenum, 0);
|
||||||
|
|
||||||
if (!waloff[tilenum])
|
if (!waloff[tilenum])
|
||||||
loadtile(tilenum);
|
tileLoad(tilenum);
|
||||||
|
|
||||||
if (waloff[tilenum])
|
if (waloff[tilenum])
|
||||||
{
|
{
|
||||||
|
|
|
@ -740,7 +740,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
|
||||||
|
|
||||||
if (tsiz.x == 0 || tsiz.y == 0)
|
if (tsiz.x == 0 || tsiz.y == 0)
|
||||||
{
|
{
|
||||||
if (E_CheckUnitArtFileHeader((uint8_t *)kpzbuf, picfillen))
|
if (artCheckUnitFileHeader((uint8_t *)kpzbuf, picfillen))
|
||||||
return mdloadskin_failed(skinfile, fn);
|
return mdloadskin_failed(skinfile, fn);
|
||||||
|
|
||||||
tsiz.x = B_LITTLE16(B_UNBUF16(&kpzbuf[16]));
|
tsiz.x = B_LITTLE16(B_UNBUF16(&kpzbuf[16]));
|
||||||
|
@ -782,7 +782,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
|
||||||
{
|
{
|
||||||
if (isart)
|
if (isart)
|
||||||
{
|
{
|
||||||
E_RenderArtDataIntoBuffer((palette_t *)pic, (uint8_t *)&kpzbuf[ARTv1_UNITOFFSET], siz.x, tsiz.x, tsiz.y);
|
artConvertRGB((palette_t *)pic, (uint8_t *)&kpzbuf[ARTv1_UNITOFFSET], siz.x, tsiz.x, tsiz.y);
|
||||||
}
|
}
|
||||||
#ifdef WITHKPLIB
|
#ifdef WITHKPLIB
|
||||||
else
|
else
|
||||||
|
|
|
@ -1589,6 +1589,9 @@ static inline void OSD_LineFeed(void)
|
||||||
|
|
||||||
void OSD_Puts(const char *tmpstr)
|
void OSD_Puts(const char *tmpstr)
|
||||||
{
|
{
|
||||||
|
if (!osd)
|
||||||
|
OSD_Init();
|
||||||
|
|
||||||
if (tmpstr[0]==0)
|
if (tmpstr[0]==0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -1654,7 +1654,7 @@ int16_t polymer_addlight(_prlight* light)
|
||||||
DO_TILE_ANIM(picnum, 0);
|
DO_TILE_ANIM(picnum, 0);
|
||||||
|
|
||||||
if (!waloff[picnum])
|
if (!waloff[picnum])
|
||||||
loadtile(picnum);
|
tileLoad(picnum);
|
||||||
|
|
||||||
pth = NULL;
|
pth = NULL;
|
||||||
pth = texcache_fetch(picnum, 0, 0, DAMETH_NOMASK);
|
pth = texcache_fetch(picnum, 0, 0, DAMETH_NOMASK);
|
||||||
|
@ -2690,7 +2690,7 @@ static int32_t polymer_updatesector(int16_t sectnum)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!waloff[curpicnum])
|
if (!waloff[curpicnum])
|
||||||
loadtile(curpicnum);
|
tileLoad(curpicnum);
|
||||||
|
|
||||||
if (((sec->floorstat & 64) || (sec->ceilingstat & 64)) &&
|
if (((sec->floorstat & 64) || (sec->ceilingstat & 64)) &&
|
||||||
((secangcos == 2) && (secangsin == 2)))
|
((secangcos == 2) && (secangsin == 2)))
|
||||||
|
@ -4185,7 +4185,7 @@ static void polymer_drawartsky(int16_t tilenum, char palnum, int8_t shad
|
||||||
|
|
||||||
DO_TILE_ANIM(picnum, 0);
|
DO_TILE_ANIM(picnum, 0);
|
||||||
if (!waloff[picnum])
|
if (!waloff[picnum])
|
||||||
loadtile(picnum);
|
tileLoad(picnum);
|
||||||
pth = texcache_fetch(picnum, palnum, 0, DAMETH_NOMASK);
|
pth = texcache_fetch(picnum, palnum, 0, DAMETH_NOMASK);
|
||||||
glpics[i] = pth ? pth->glpic : 0;
|
glpics[i] = pth ? pth->glpic : 0;
|
||||||
|
|
||||||
|
@ -4929,7 +4929,7 @@ static _prbucket* polymer_getbuildmaterial(_prmaterial* material, int16_t tile
|
||||||
polymer_getscratchmaterial(material);
|
polymer_getscratchmaterial(material);
|
||||||
|
|
||||||
if (!waloff[tilenum])
|
if (!waloff[tilenum])
|
||||||
loadtile(tilenum);
|
tileLoad(tilenum);
|
||||||
|
|
||||||
// PR_BIT_DIFFUSE_MAP
|
// PR_BIT_DIFFUSE_MAP
|
||||||
pthtyp *pth = texcache_fetch(tilenum, pal, 0, cmeth);
|
pthtyp *pth = texcache_fetch(tilenum, pal, 0, cmeth);
|
||||||
|
@ -5773,7 +5773,7 @@ static void polymer_updatelights(void)
|
||||||
DO_TILE_ANIM(picnum, 0);
|
DO_TILE_ANIM(picnum, 0);
|
||||||
|
|
||||||
if (!waloff[picnum])
|
if (!waloff[picnum])
|
||||||
loadtile(picnum);
|
tileLoad(picnum);
|
||||||
|
|
||||||
pth = NULL;
|
pth = NULL;
|
||||||
pth = texcache_fetch(picnum, 0, 0, DAMETH_NOMASK);
|
pth = texcache_fetch(picnum, 0, 0, DAMETH_NOMASK);
|
||||||
|
|
|
@ -2263,7 +2263,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
|
||||||
|
|
||||||
if (tsiz.x == 0 || tsiz.y == 0)
|
if (tsiz.x == 0 || tsiz.y == 0)
|
||||||
{
|
{
|
||||||
if (E_CheckUnitArtFileHeader((uint8_t *)kpzbuf, picfillen))
|
if (artCheckUnitFileHeader((uint8_t *)kpzbuf, picfillen))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
tsiz.x = B_LITTLE16(B_UNBUF16(&kpzbuf[16]));
|
tsiz.x = B_LITTLE16(B_UNBUF16(&kpzbuf[16]));
|
||||||
|
@ -2307,7 +2307,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
|
||||||
{
|
{
|
||||||
if (isart)
|
if (isart)
|
||||||
{
|
{
|
||||||
E_RenderArtDataIntoBuffer((palette_t *)pic, (uint8_t *)&kpzbuf[ARTv1_UNITOFFSET], siz.x, tsiz.x, tsiz.y);
|
artConvertRGB((palette_t *)pic, (uint8_t *)&kpzbuf[ARTv1_UNITOFFSET], siz.x, tsiz.x, tsiz.y);
|
||||||
}
|
}
|
||||||
#ifdef WITHKPLIB
|
#ifdef WITHKPLIB
|
||||||
else
|
else
|
||||||
|
@ -2627,7 +2627,7 @@ static void polymost2_drawVBO(GLenum mode,
|
||||||
setgotpic(globalpicnum);
|
setgotpic(globalpicnum);
|
||||||
if (!waloff[globalpicnum])
|
if (!waloff[globalpicnum])
|
||||||
{
|
{
|
||||||
loadtile(globalpicnum);
|
tileLoad(globalpicnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
pthtyp *pth = our_texcache_fetch(dameth | (r_useindexedcolortextures ? PTH_INDEXED : 0));
|
pthtyp *pth = our_texcache_fetch(dameth | (r_useindexedcolortextures ? PTH_INDEXED : 0));
|
||||||
|
@ -2831,7 +2831,7 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
|
||||||
|
|
||||||
if (!waloff[globalpicnum])
|
if (!waloff[globalpicnum])
|
||||||
{
|
{
|
||||||
loadtile(globalpicnum);
|
tileLoad(globalpicnum);
|
||||||
|
|
||||||
if (!waloff[globalpicnum])
|
if (!waloff[globalpicnum])
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,20 +37,20 @@ static int32_t artfil = -1, artfilnum, artfilplc;
|
||||||
////////// Per-map ART file loading //////////
|
////////// Per-map ART file loading //////////
|
||||||
|
|
||||||
// Some forward declarations.
|
// Some forward declarations.
|
||||||
static void set_picsiz(int32_t picnum);
|
static void tileUpdatePicSiz(int32_t picnum);
|
||||||
static const char *E_GetArtFileName(int32_t tilefilei);
|
static const char *artGetIndexedFileName(int32_t tilefilei);
|
||||||
static int32_t E_ReadArtFileOfID(int32_t tilefilei);
|
static int32_t artReadIndexedFile(int32_t tilefilei);
|
||||||
|
|
||||||
static inline void clearmapartfilename(void)
|
static inline void artClearMapArtFilename(void)
|
||||||
{
|
{
|
||||||
Bmemset(mapartfilename, 0, sizeof(mapartfilename));
|
Bmemset(mapartfilename, 0, sizeof(mapartfilename));
|
||||||
mapartfnXXofs = 0;
|
mapartfnXXofs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void E_RecalcPicSiz(void)
|
static inline void artUpdateManifest(void)
|
||||||
{
|
{
|
||||||
for (bssize_t i=0; i<MAXTILES; i++)
|
for (bssize_t i=0; i<MAXTILES; i++)
|
||||||
set_picsiz(i);
|
tileUpdatePicSiz(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename origar_t, typename bakar_t>
|
template <typename origar_t, typename bakar_t>
|
||||||
|
@ -68,12 +68,12 @@ static inline void ALLOC_MAPART_ARRAY(origar_t & origar, bakar_t & bakar)
|
||||||
Bmemcpy(bakar, origar, ARRAY_SIZE(origar) * sizeof(origar[0]));
|
Bmemcpy(bakar, origar, ARRAY_SIZE(origar) * sizeof(origar[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
void E_MapArt_Clear(void)
|
void artClearMapArt(void)
|
||||||
{
|
{
|
||||||
if (g_bakTileFileNum == NULL)
|
if (g_bakTileFileNum == NULL)
|
||||||
return; // per-map ART N/A
|
return; // per-map ART N/A
|
||||||
|
|
||||||
clearmapartfilename();
|
artClearMapArtFilename();
|
||||||
|
|
||||||
if (artfilnum >= MAXARTFILES_BASE)
|
if (artfilnum >= MAXARTFILES_BASE)
|
||||||
{
|
{
|
||||||
|
@ -111,7 +111,7 @@ void E_MapArt_Clear(void)
|
||||||
}
|
}
|
||||||
DO_FREE_AND_NULL(g_bakFakeTileData);
|
DO_FREE_AND_NULL(g_bakFakeTileData);
|
||||||
|
|
||||||
E_RecalcPicSiz();
|
artUpdateManifest();
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
//POGOTODO: review this to ensure we're not invalidating more than we have to
|
//POGOTODO: review this to ensure we're not invalidating more than we have to
|
||||||
gltexinvalidatetype(INVALIDATE_ART);
|
gltexinvalidatetype(INVALIDATE_ART);
|
||||||
|
@ -122,9 +122,9 @@ void E_MapArt_Clear(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void E_MapArt_Setup(const char *filename)
|
void artSetupMapArt(const char *filename)
|
||||||
{
|
{
|
||||||
E_MapArt_Clear();
|
artClearMapArt();
|
||||||
|
|
||||||
if (Bstrlen(filename) + 7 >= sizeof(mapartfilename))
|
if (Bstrlen(filename) + 7 >= sizeof(mapartfilename))
|
||||||
return;
|
return;
|
||||||
|
@ -134,11 +134,11 @@ void E_MapArt_Setup(const char *filename)
|
||||||
mapartfnXXofs = Bstrlen(mapartfilename) - 6;
|
mapartfnXXofs = Bstrlen(mapartfilename) - 6;
|
||||||
|
|
||||||
// Check for first per-map ART file: if that one doesn't exist, don't load any.
|
// Check for first per-map ART file: if that one doesn't exist, don't load any.
|
||||||
int32_t fil = kopen4load(E_GetArtFileName(MAXARTFILES_BASE), 0);
|
int32_t fil = kopen4load(artGetIndexedFileName(MAXARTFILES_BASE), 0);
|
||||||
|
|
||||||
if (fil == -1)
|
if (fil == -1)
|
||||||
{
|
{
|
||||||
clearmapartfilename();
|
artClearMapArtFilename();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ void E_MapArt_Setup(const char *filename)
|
||||||
|
|
||||||
for (bssize_t i=MAXARTFILES_BASE; i<MAXARTFILES_TOTAL; i++)
|
for (bssize_t i=MAXARTFILES_BASE; i<MAXARTFILES_TOTAL; i++)
|
||||||
{
|
{
|
||||||
int ret = E_ReadArtFileOfID(i);
|
int ret = artReadIndexedFile(i);
|
||||||
|
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
|
@ -163,12 +163,12 @@ void E_MapArt_Setup(const char *filename)
|
||||||
// and now. Very cornerly... but I like my code to be prepared to
|
// and now. Very cornerly... but I like my code to be prepared to
|
||||||
// any eventuality.
|
// any eventuality.
|
||||||
if (i == MAXARTFILES_BASE || ret != -1)
|
if (i == MAXARTFILES_BASE || ret != -1)
|
||||||
E_MapArt_Clear();
|
artClearMapArt();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
E_RecalcPicSiz();
|
artUpdateManifest();
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
//POGOTODO: review this to ensure we're not invalidating more than we have to
|
//POGOTODO: review this to ensure we're not invalidating more than we have to
|
||||||
gltexinvalidatetype(INVALIDATE_ART);
|
gltexinvalidatetype(INVALIDATE_ART);
|
||||||
|
@ -183,13 +183,13 @@ void E_MapArt_Setup(const char *filename)
|
||||||
// ART loading
|
// ART loading
|
||||||
//
|
//
|
||||||
|
|
||||||
void E_CreateDummyTile(int32_t const tile)
|
void tileSetupDummy(int32_t const tile)
|
||||||
{
|
{
|
||||||
faketile[tile>>3] |= pow2char[tile&7];
|
faketile[tile>>3] |= pow2char[tile&7];
|
||||||
DO_FREE_AND_NULL(faketiledata[tile]);
|
DO_FREE_AND_NULL(faketiledata[tile]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void E_CreateFakeTileNonDestructive(int32_t const tile, int32_t tsiz, char const * const buffer)
|
static void tileSetDataSafe(int32_t const tile, int32_t tsiz, char const * const buffer)
|
||||||
{
|
{
|
||||||
int const compressed_tsiz = LZ4_compressBound(tsiz);
|
int const compressed_tsiz = LZ4_compressBound(tsiz);
|
||||||
char * newtile = (char *) Xmalloc(compressed_tsiz);
|
char * newtile = (char *) Xmalloc(compressed_tsiz);
|
||||||
|
@ -206,7 +206,7 @@ static void E_CreateFakeTileNonDestructive(int32_t const tile, int32_t tsiz, cha
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void E_CreateFakeTile(int32_t const tile, int32_t tsiz, char const * const buffer)
|
void tileSetData(int32_t const tile, int32_t tsiz, char const * const buffer)
|
||||||
{
|
{
|
||||||
int const compressed_tsiz = LZ4_compressBound(tsiz);
|
int const compressed_tsiz = LZ4_compressBound(tsiz);
|
||||||
faketiledata[tile] = (char *) Xrealloc(faketiledata[tile], compressed_tsiz);
|
faketiledata[tile] = (char *) Xrealloc(faketiledata[tile], compressed_tsiz);
|
||||||
|
@ -224,7 +224,7 @@ void E_CreateFakeTile(int32_t const tile, int32_t tsiz, char const * const buffe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void E_UndefineTileNonDestructive(int32_t const tile)
|
static void tileSoftDelete(int32_t const tile)
|
||||||
{
|
{
|
||||||
tilesiz[tile].x = 0;
|
tilesiz[tile].x = 0;
|
||||||
tilesiz[tile].y = 0;
|
tilesiz[tile].y = 0;
|
||||||
|
@ -239,9 +239,9 @@ static void E_UndefineTileNonDestructive(int32_t const tile)
|
||||||
Bmemset(&picanm[tile], 0, sizeof(picanm_t));
|
Bmemset(&picanm[tile], 0, sizeof(picanm_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
void E_UndefineTile(int32_t const tile)
|
void tileDelete(int32_t const tile)
|
||||||
{
|
{
|
||||||
E_UndefineTileNonDestructive(tile);
|
tileSoftDelete(tile);
|
||||||
|
|
||||||
DO_FREE_AND_NULL(faketiledata[tile]);
|
DO_FREE_AND_NULL(faketiledata[tile]);
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ void E_UndefineTile(int32_t const tile)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_picsiz(int32_t picnum)
|
static void tileUpdatePicSiz(int32_t picnum)
|
||||||
{
|
{
|
||||||
int j = 15;
|
int j = 15;
|
||||||
|
|
||||||
|
@ -269,23 +269,15 @@ static void set_picsiz(int32_t picnum)
|
||||||
picsiz[picnum] |= j<<4;
|
picsiz[picnum] |= j<<4;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_tilesiz(int32_t picnum, int16_t dasizx, int16_t dasizy)
|
void tileSetSize(int32_t picnum, int16_t dasizx, int16_t dasizy)
|
||||||
{
|
{
|
||||||
tilesiz[picnum].x = dasizx;
|
tilesiz[picnum].x = dasizx;
|
||||||
tilesiz[picnum].y = dasizy;
|
tilesiz[picnum].y = dasizy;
|
||||||
|
|
||||||
set_picsiz(picnum);
|
tileUpdatePicSiz(picnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tile_exists(int32_t picnum)
|
int32_t artReadHeader(int32_t const fil, char const * const fn, artheader_t * const local)
|
||||||
{
|
|
||||||
if (waloff[picnum] == 0)
|
|
||||||
loadtile(picnum);
|
|
||||||
|
|
||||||
return (waloff[picnum] != 0 && tilesiz[picnum].x > 0 && tilesiz[picnum].y > 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t E_ReadArtFileHeader(int32_t const fil, char const * const fn, artheader_t * const local)
|
|
||||||
{
|
{
|
||||||
int32_t artversion;
|
int32_t artversion;
|
||||||
kread(fil, &artversion, 4); artversion = B_LITTLE32(artversion);
|
kread(fil, &artversion, 4); artversion = B_LITTLE32(artversion);
|
||||||
|
@ -320,7 +312,7 @@ int32_t E_ReadArtFileHeader(int32_t const fil, char const * const fn, artheader_
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t E_ReadArtFileHeaderFromBuffer(uint8_t const * const buf, artheader_t * const local)
|
int32_t artReadHeaderFromBuffer(uint8_t const * const buf, artheader_t * const local)
|
||||||
{
|
{
|
||||||
int const artversion = B_LITTLE32(B_UNBUF32(&buf[0]));
|
int const artversion = B_LITTLE32(B_UNBUF32(&buf[0]));
|
||||||
if (EDUKE32_PREDICT_FALSE(artversion != 1))
|
if (EDUKE32_PREDICT_FALSE(artversion != 1))
|
||||||
|
@ -348,13 +340,13 @@ int32_t E_ReadArtFileHeaderFromBuffer(uint8_t const * const buf, artheader_t * c
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t E_CheckUnitArtFileHeader(uint8_t const * const buf, int32_t length)
|
int32_t artCheckUnitFileHeader(uint8_t const * const buf, int32_t length)
|
||||||
{
|
{
|
||||||
if (EDUKE32_PREDICT_FALSE(length <= ARTv1_UNITOFFSET))
|
if (EDUKE32_PREDICT_FALSE(length <= ARTv1_UNITOFFSET))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
artheader_t local;
|
artheader_t local;
|
||||||
if (EDUKE32_PREDICT_FALSE(E_ReadArtFileHeaderFromBuffer(buf, &local) != 0))
|
if (EDUKE32_PREDICT_FALSE(artReadHeaderFromBuffer(buf, &local) != 0))
|
||||||
return -2;
|
return -2;
|
||||||
|
|
||||||
if (EDUKE32_PREDICT_FALSE(local.numtiles != 1))
|
if (EDUKE32_PREDICT_FALSE(local.numtiles != 1))
|
||||||
|
@ -363,7 +355,7 @@ int32_t E_CheckUnitArtFileHeader(uint8_t const * const buf, int32_t length)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void E_ConvertARTv1picanmToMemory(int32_t const picnum)
|
void tileConvertAnimFormat(int32_t const picnum)
|
||||||
{
|
{
|
||||||
EDUKE32_STATIC_ASSERT(sizeof(picanm_t) == 4);
|
EDUKE32_STATIC_ASSERT(sizeof(picanm_t) == 4);
|
||||||
EDUKE32_STATIC_ASSERT(PICANM_ANIMTYPE_MASK == 192);
|
EDUKE32_STATIC_ASSERT(PICANM_ANIMTYPE_MASK == 192);
|
||||||
|
@ -379,7 +371,7 @@ void E_ConvertARTv1picanmToMemory(int32_t const picnum)
|
||||||
thispicanm->sf &= ~PICANM_MISC_MASK;
|
thispicanm->sf &= ~PICANM_MISC_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void E_ReadArtFileTileInfo(int32_t const fil, artheader_t const * const local)
|
void artReadManifest(int32_t const fil, artheader_t const * const local)
|
||||||
{
|
{
|
||||||
int16_t *tilesizx = (int16_t *) Xmalloc(local->numtiles * sizeof(int16_t));
|
int16_t *tilesizx = (int16_t *) Xmalloc(local->numtiles * sizeof(int16_t));
|
||||||
int16_t *tilesizy = (int16_t *) Xmalloc(local->numtiles * sizeof(int16_t));
|
int16_t *tilesizy = (int16_t *) Xmalloc(local->numtiles * sizeof(int16_t));
|
||||||
|
@ -392,14 +384,14 @@ void E_ReadArtFileTileInfo(int32_t const fil, artheader_t const * const local)
|
||||||
tilesiz[i].x = B_LITTLE16(tilesizx[i-local->tilestart]);
|
tilesiz[i].x = B_LITTLE16(tilesizx[i-local->tilestart]);
|
||||||
tilesiz[i].y = B_LITTLE16(tilesizy[i-local->tilestart]);
|
tilesiz[i].y = B_LITTLE16(tilesizy[i-local->tilestart]);
|
||||||
|
|
||||||
E_ConvertARTv1picanmToMemory(i);
|
tileConvertAnimFormat(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
DO_FREE_AND_NULL(tilesizx);
|
DO_FREE_AND_NULL(tilesizx);
|
||||||
DO_FREE_AND_NULL(tilesizy);
|
DO_FREE_AND_NULL(tilesizy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void E_ReadArtFileIntoFakeData(int32_t const fil, artheader_t const * const local)
|
void artPreloadFile(int32_t const fil, artheader_t const * const local)
|
||||||
{
|
{
|
||||||
char *buffer = NULL;
|
char *buffer = NULL;
|
||||||
int32_t buffersize = 0;
|
int32_t buffersize = 0;
|
||||||
|
@ -410,19 +402,19 @@ void E_ReadArtFileIntoFakeData(int32_t const fil, artheader_t const * const loca
|
||||||
|
|
||||||
if (dasiz == 0)
|
if (dasiz == 0)
|
||||||
{
|
{
|
||||||
E_UndefineTile(i);
|
tileDelete(i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
maybe_grow_buffer(&buffer, &buffersize, dasiz);
|
maybe_grow_buffer(&buffer, &buffersize, dasiz);
|
||||||
kread(fil, buffer, dasiz);
|
kread(fil, buffer, dasiz);
|
||||||
E_CreateFakeTile(i, dasiz, buffer);
|
tileSetData(i, dasiz, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
DO_FREE_AND_NULL(buffer);
|
DO_FREE_AND_NULL(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void E_ReadArtFileIntoFakeDataNonDestructive(int32_t const fil, artheader_t const * const local)
|
static void artPreloadFileSafe(int32_t const fil, artheader_t const * const local)
|
||||||
{
|
{
|
||||||
char *buffer = NULL;
|
char *buffer = NULL;
|
||||||
int32_t buffersize = 0;
|
int32_t buffersize = 0;
|
||||||
|
@ -433,19 +425,19 @@ static void E_ReadArtFileIntoFakeDataNonDestructive(int32_t const fil, artheader
|
||||||
|
|
||||||
if (dasiz == 0)
|
if (dasiz == 0)
|
||||||
{
|
{
|
||||||
E_UndefineTileNonDestructive(i);
|
tileSoftDelete(i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
maybe_grow_buffer(&buffer, &buffersize, dasiz);
|
maybe_grow_buffer(&buffer, &buffersize, dasiz);
|
||||||
kread(fil, buffer, dasiz);
|
kread(fil, buffer, dasiz);
|
||||||
E_CreateFakeTileNonDestructive(i, dasiz, buffer);
|
tileSetDataSafe(i, dasiz, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
DO_FREE_AND_NULL(buffer);
|
DO_FREE_AND_NULL(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *E_GetArtFileName(int32_t tilefilei)
|
static const char *artGetIndexedFileName(int32_t tilefilei)
|
||||||
{
|
{
|
||||||
if (tilefilei >= MAXARTFILES_BASE)
|
if (tilefilei >= MAXARTFILES_BASE)
|
||||||
{
|
{
|
||||||
|
@ -472,16 +464,16 @@ static const char *E_GetArtFileName(int32_t tilefilei)
|
||||||
// >0: error with the ART file
|
// >0: error with the ART file
|
||||||
// -1: ART file does not exist
|
// -1: ART file does not exist
|
||||||
//<-1: per-map ART issue
|
//<-1: per-map ART issue
|
||||||
static int32_t E_ReadArtFileOfID(int32_t tilefilei)
|
static int32_t artReadIndexedFile(int32_t tilefilei)
|
||||||
{
|
{
|
||||||
const char *fn = E_GetArtFileName(tilefilei);
|
const char *fn = artGetIndexedFileName(tilefilei);
|
||||||
const int32_t permap = (tilefilei >= MAXARTFILES_BASE); // is it a per-map ART file?
|
const int32_t permap = (tilefilei >= MAXARTFILES_BASE); // is it a per-map ART file?
|
||||||
int32_t fil;
|
int32_t fil;
|
||||||
|
|
||||||
if ((fil = kopen4load(fn, 0)) != -1)
|
if ((fil = kopen4load(fn, 0)) != -1)
|
||||||
{
|
{
|
||||||
artheader_t local;
|
artheader_t local;
|
||||||
int const headerval = E_ReadArtFileHeader(fil, fn, &local);
|
int const headerval = artReadHeader(fil, fn, &local);
|
||||||
if (headerval != 0)
|
if (headerval != 0)
|
||||||
{
|
{
|
||||||
kclose(fil);
|
kclose(fil);
|
||||||
|
@ -510,14 +502,14 @@ static int32_t E_ReadArtFileOfID(int32_t tilefilei)
|
||||||
Bmemset(&walock[local.tilestart], 1, local.numtiles*sizeof(walock[0]));
|
Bmemset(&walock[local.tilestart], 1, local.numtiles*sizeof(walock[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
E_ReadArtFileTileInfo(fil, &local);
|
artReadManifest(fil, &local);
|
||||||
|
|
||||||
if (cache1d_file_fromzip(fil))
|
if (cache1d_file_fromzip(fil))
|
||||||
{
|
{
|
||||||
if (permap)
|
if (permap)
|
||||||
E_ReadArtFileIntoFakeDataNonDestructive(fil, &local);
|
artPreloadFileSafe(fil, &local);
|
||||||
else
|
else
|
||||||
E_ReadArtFileIntoFakeData(fil, &local);
|
artPreloadFile(fil, &local);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -549,7 +541,7 @@ static int32_t E_ReadArtFileOfID(int32_t tilefilei)
|
||||||
//
|
//
|
||||||
// loadpics
|
// loadpics
|
||||||
//
|
//
|
||||||
int32_t loadpics(const char *filename, int32_t askedsize)
|
int32_t artLoadFiles(const char *filename, int32_t askedsize)
|
||||||
{
|
{
|
||||||
Bstrncpyz(artfilename, filename, sizeof(artfilename));
|
Bstrncpyz(artfilename, filename, sizeof(artfilename));
|
||||||
|
|
||||||
|
@ -559,18 +551,16 @@ int32_t loadpics(const char *filename, int32_t askedsize)
|
||||||
// artsize = 0;
|
// artsize = 0;
|
||||||
|
|
||||||
for (bssize_t tilefilei=0; tilefilei<MAXARTFILES_BASE; tilefilei++)
|
for (bssize_t tilefilei=0; tilefilei<MAXARTFILES_BASE; tilefilei++)
|
||||||
E_ReadArtFileOfID(tilefilei);
|
artReadIndexedFile(tilefilei);
|
||||||
|
|
||||||
Bmemset(gotpic, 0, sizeof(gotpic));
|
Bmemset(gotpic, 0, sizeof(gotpic));
|
||||||
|
|
||||||
//cachesize = min((int32_t)((Bgetsysmemsize()/100)*60),max(artsize,askedsize));
|
//cachesize = min((int32_t)((Bgetsysmemsize()/100)*60),max(artsize,askedsize));
|
||||||
cachesize = (Bgetsysmemsize() <= (uint32_t)askedsize) ? (int32_t)((Bgetsysmemsize() / 100) * 60) : askedsize;
|
cachesize = (Bgetsysmemsize() <= (uint32_t)askedsize) ? (int32_t)((Bgetsysmemsize() / 100) * 60) : askedsize;
|
||||||
|
|
||||||
// NOTE: this doesn't make a lot of sense on modern OSs...
|
|
||||||
pic = Xaligned_alloc(16, cachesize);
|
pic = Xaligned_alloc(16, cachesize);
|
||||||
initcache((intptr_t) pic, cachesize);
|
cacheInitBuffer((intptr_t) pic, cachesize);
|
||||||
|
|
||||||
E_RecalcPicSiz();
|
artUpdateManifest();
|
||||||
|
|
||||||
artfil = -1;
|
artfil = -1;
|
||||||
artfilnum = -1;
|
artfilnum = -1;
|
||||||
|
@ -583,22 +573,22 @@ int32_t loadpics(const char *filename, int32_t askedsize)
|
||||||
//
|
//
|
||||||
// loadtile
|
// loadtile
|
||||||
//
|
//
|
||||||
static void postloadtile(int16_t tilenume);
|
static void tilePostLoad(int16_t tilenume);
|
||||||
|
|
||||||
void loadtile(int16_t tilenume)
|
bool tileLoad(int16_t tileNum)
|
||||||
{
|
{
|
||||||
if ((unsigned) tilenume >= (unsigned) MAXTILES) return;
|
if ((unsigned) tileNum >= (unsigned) MAXTILES) return 0;
|
||||||
int const dasiz = tilesiz[tilenume].x*tilesiz[tilenume].y;
|
int const dasiz = tilesiz[tileNum].x*tilesiz[tileNum].y;
|
||||||
if (dasiz <= 0) return;
|
if (dasiz <= 0) return 0;
|
||||||
|
|
||||||
// Allocate storage if necessary.
|
// Allocate storage if necessary.
|
||||||
if (waloff[tilenume] == 0)
|
if (waloff[tileNum] == 0)
|
||||||
{
|
{
|
||||||
walock[tilenume] = 199;
|
walock[tileNum] = 199;
|
||||||
allocache(&waloff[tilenume], dasiz, &walock[tilenume]);
|
cacheAllocateBlock(&waloff[tileNum], dasiz, &walock[tileNum]);
|
||||||
}
|
}
|
||||||
|
|
||||||
E_LoadTileIntoBuffer(tilenume, dasiz, (char *) waloff[tilenume]);
|
tileLoadData(tileNum, dasiz, (char *) waloff[tileNum]);
|
||||||
|
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
if (videoGetRenderMode() >= REND_POLYMOST)
|
if (videoGetRenderMode() >= REND_POLYMOST)
|
||||||
|
@ -607,15 +597,17 @@ void loadtile(int16_t tilenume)
|
||||||
int type;
|
int type;
|
||||||
for (type = 0; type <= 1; ++type)
|
for (type = 0; type <= 1; ++type)
|
||||||
{
|
{
|
||||||
texcache_fetch(tilenume, 0, 0, (type ? DAMETH_CLAMPED : DAMETH_MASK) | PTH_INDEXED);
|
texcache_fetch(tileNum, 0, 0, (type ? DAMETH_CLAMPED : DAMETH_MASK) | PTH_INDEXED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
postloadtile(tilenume);
|
tilePostLoad(tileNum);
|
||||||
|
|
||||||
|
return (waloff[tileNum] != 0 && tilesiz[tileNum].x > 0 && tilesiz[tileNum].y > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void E_LoadTileIntoBuffer(int16_t tilenume, int32_t dasiz, char *buffer)
|
void tileLoadData(int16_t tilenume, int32_t dasiz, char *buffer)
|
||||||
{
|
{
|
||||||
// dummy tiles for highres replacements and tilefromtexture definitions
|
// dummy tiles for highres replacements and tilefromtexture definitions
|
||||||
|
|
||||||
|
@ -636,7 +628,7 @@ void E_LoadTileIntoBuffer(int16_t tilenume, int32_t dasiz, char *buffer)
|
||||||
if (artfil != -1)
|
if (artfil != -1)
|
||||||
kclose(artfil);
|
kclose(artfil);
|
||||||
|
|
||||||
char const *fn = E_GetArtFileName(tfn);
|
char const *fn = artGetIndexedFileName(tfn);
|
||||||
|
|
||||||
artfil = kopen4load(fn, 0);
|
artfil = kopen4load(fn, 0);
|
||||||
|
|
||||||
|
@ -665,7 +657,7 @@ void E_LoadTileIntoBuffer(int16_t tilenume, int32_t dasiz, char *buffer)
|
||||||
artfilplc = tilefileoffs[tilenume]+dasiz;
|
artfilplc = tilefileoffs[tilenume]+dasiz;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void postloadtile(int16_t tilenume)
|
static void tilePostLoad(int16_t tilenume)
|
||||||
{
|
{
|
||||||
#if !defined DEBUG_TILESIZY_512 && !defined DEBUG_TILEOFFSETS
|
#if !defined DEBUG_TILESIZY_512 && !defined DEBUG_TILEOFFSETS
|
||||||
UNREFERENCED_PARAMETER(tilenume);
|
UNREFERENCED_PARAMETER(tilenume);
|
||||||
|
@ -700,7 +692,7 @@ static void postloadtile(int16_t tilenume)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assumes pic has been initialized to zero.
|
// Assumes pic has been initialized to zero.
|
||||||
void E_RenderArtDataIntoBuffer(palette_t * const pic, uint8_t const * const buf, int32_t const bufsizx, int32_t const sizx, int32_t const sizy)
|
void artConvertRGB(palette_t * const pic, uint8_t const * const buf, int32_t const bufsizx, int32_t const sizx, int32_t const sizy)
|
||||||
{
|
{
|
||||||
for (bssize_t y = 0; y < sizy; ++y)
|
for (bssize_t y = 0; y < sizy; ++y)
|
||||||
{
|
{
|
||||||
|
@ -727,7 +719,7 @@ void E_RenderArtDataIntoBuffer(palette_t * const pic, uint8_t const * const buf,
|
||||||
//
|
//
|
||||||
// allocatepermanenttile
|
// allocatepermanenttile
|
||||||
//
|
//
|
||||||
intptr_t allocatepermanenttile(int16_t tilenume, int32_t xsiz, int32_t ysiz)
|
intptr_t tileCreate(int16_t tilenume, int32_t xsiz, int32_t ysiz)
|
||||||
{
|
{
|
||||||
if (xsiz <= 0 || ysiz <= 0 || (unsigned) tilenume >= MAXTILES)
|
if (xsiz <= 0 || ysiz <= 0 || (unsigned) tilenume >= MAXTILES)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -735,9 +727,9 @@ intptr_t allocatepermanenttile(int16_t tilenume, int32_t xsiz, int32_t ysiz)
|
||||||
int const dasiz = xsiz*ysiz;
|
int const dasiz = xsiz*ysiz;
|
||||||
|
|
||||||
walock[tilenume] = 255;
|
walock[tilenume] = 255;
|
||||||
allocache(&waloff[tilenume], dasiz, &walock[tilenume]);
|
cacheAllocateBlock(&waloff[tilenume], dasiz, &walock[tilenume]);
|
||||||
|
|
||||||
set_tilesiz(tilenume, xsiz, ysiz);
|
tileSetSize(tilenume, xsiz, ysiz);
|
||||||
Bmemset(&picanm[tilenume], 0, sizeof(picanm_t));
|
Bmemset(&picanm[tilenume], 0, sizeof(picanm_t));
|
||||||
|
|
||||||
return waloff[tilenume];
|
return waloff[tilenume];
|
||||||
|
@ -746,7 +738,7 @@ intptr_t allocatepermanenttile(int16_t tilenume, int32_t xsiz, int32_t ysiz)
|
||||||
//
|
//
|
||||||
// copytilepiece
|
// copytilepiece
|
||||||
//
|
//
|
||||||
void copytilepiece(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, int32_t ysiz,
|
void tileCopySection(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, int32_t ysiz,
|
||||||
int32_t tilenume2, int32_t sx2, int32_t sy2)
|
int32_t tilenume2, int32_t sx2, int32_t sy2)
|
||||||
{
|
{
|
||||||
char *ptr1, *ptr2, dat;
|
char *ptr1, *ptr2, dat;
|
||||||
|
@ -756,8 +748,8 @@ void copytilepiece(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, in
|
||||||
xsiz2 = tilesiz[tilenume2].x; ysiz2 = tilesiz[tilenume2].y;
|
xsiz2 = tilesiz[tilenume2].x; ysiz2 = tilesiz[tilenume2].y;
|
||||||
if ((xsiz1 > 0) && (ysiz1 > 0) && (xsiz2 > 0) && (ysiz2 > 0))
|
if ((xsiz1 > 0) && (ysiz1 > 0) && (xsiz2 > 0) && (ysiz2 > 0))
|
||||||
{
|
{
|
||||||
if (waloff[tilenume1] == 0) loadtile(tilenume1);
|
if (waloff[tilenume1] == 0) tileLoad(tilenume1);
|
||||||
if (waloff[tilenume2] == 0) loadtile(tilenume2);
|
if (waloff[tilenume2] == 0) tileLoad(tilenume2);
|
||||||
|
|
||||||
x1 = sx1;
|
x1 = sx1;
|
||||||
for (i=0; i<xsiz; i++)
|
for (i=0; i<xsiz; i++)
|
||||||
|
|
|
@ -434,7 +434,7 @@ int32_t Anim_Play(const char *fn)
|
||||||
anim->animlock = 1;
|
anim->animlock = 1;
|
||||||
|
|
||||||
if (!anim->animbuf)
|
if (!anim->animbuf)
|
||||||
allocache((intptr_t *)&anim->animbuf, length + 1, &anim->animlock);
|
cacheAllocateBlock((intptr_t *)&anim->animbuf, length + 1, &anim->animlock);
|
||||||
|
|
||||||
tilesiz[TILE_ANIM].x = 200;
|
tilesiz[TILE_ANIM].x = 200;
|
||||||
tilesiz[TILE_ANIM].y = 320;
|
tilesiz[TILE_ANIM].y = 320;
|
||||||
|
|
|
@ -3341,7 +3341,7 @@ static const char *GetTilePixels(int32_t idTile)
|
||||||
if (idTile >= 0 && idTile < MAXTILES)
|
if (idTile >= 0 && idTile < MAXTILES)
|
||||||
{
|
{
|
||||||
if (!waloff[idTile])
|
if (!waloff[idTile])
|
||||||
loadtile(idTile);
|
tileLoad(idTile);
|
||||||
|
|
||||||
if (IsValidTile(idTile))
|
if (IsValidTile(idTile))
|
||||||
pPixelData = (char *)waloff[idTile];
|
pPixelData = (char *)waloff[idTile];
|
||||||
|
@ -5775,7 +5775,7 @@ static void Keys3d(void)
|
||||||
getnumberptr256(tempbuf, picnumptr, sizeof(int16_t), MAXTILES-1, 0+2, NULL);
|
getnumberptr256(tempbuf, picnumptr, sizeof(int16_t), MAXTILES-1, 0+2, NULL);
|
||||||
|
|
||||||
Bassert((unsigned)*picnumptr < MAXTILES);
|
Bassert((unsigned)*picnumptr < MAXTILES);
|
||||||
if (!tile_exists(*picnumptr))
|
if (!tileLoad(*picnumptr))
|
||||||
*picnumptr = opicnum;
|
*picnumptr = opicnum;
|
||||||
|
|
||||||
if (*picnumptr != opicnum)
|
if (*picnumptr != opicnum)
|
||||||
|
|
|
@ -792,7 +792,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
|
||||||
{
|
{
|
||||||
walock[TILE_SAVESHOT] = 199;
|
walock[TILE_SAVESHOT] = 199;
|
||||||
if (waloff[TILE_SAVESHOT] == 0)
|
if (waloff[TILE_SAVESHOT] == 0)
|
||||||
allocache(&waloff[TILE_SAVESHOT],200*320,&walock[TILE_SAVESHOT]);
|
cacheAllocateBlock(&waloff[TILE_SAVESHOT],200*320,&walock[TILE_SAVESHOT]);
|
||||||
|
|
||||||
if (videoGetRenderMode() == REND_CLASSIC)
|
if (videoGetRenderMode() == REND_CLASSIC)
|
||||||
videoSetTarget(TILE_SAVESHOT, 200, 320);
|
videoSetTarget(TILE_SAVESHOT, 200, 320);
|
||||||
|
@ -852,7 +852,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
|
||||||
|
|
||||||
walock[TILE_TILT] = 255;
|
walock[TILE_TILT] = 255;
|
||||||
if (waloff[TILE_TILT] == 0)
|
if (waloff[TILE_TILT] == 0)
|
||||||
allocache(&waloff[TILE_TILT], maxTiltSize, &walock[TILE_TILT]);
|
cacheAllocateBlock(&waloff[TILE_TILT], maxTiltSize, &walock[TILE_TILT]);
|
||||||
|
|
||||||
videoSetTarget(TILE_TILT, viewtilexsiz, viewtileysiz);
|
videoSetTarget(TILE_TILT, viewtilexsiz, viewtileysiz);
|
||||||
|
|
||||||
|
@ -5974,10 +5974,10 @@ static void G_Startup(void)
|
||||||
if (g_modDir[0] != '/' && (cwd = getcwd(NULL, 0)))
|
if (g_modDir[0] != '/' && (cwd = getcwd(NULL, 0)))
|
||||||
{
|
{
|
||||||
Bchdir(g_modDir);
|
Bchdir(g_modDir);
|
||||||
if (loadpics("tiles000.art",MAXCACHE1DSIZE) < 0)
|
if (artLoadFiles("tiles000.art",MAXCACHE1DSIZE) < 0)
|
||||||
{
|
{
|
||||||
Bchdir(cwd);
|
Bchdir(cwd);
|
||||||
if (loadpics("tiles000.art",MAXCACHE1DSIZE) < 0)
|
if (artLoadFiles("tiles000.art",MAXCACHE1DSIZE) < 0)
|
||||||
G_GameExit("Failed loading art.");
|
G_GameExit("Failed loading art.");
|
||||||
}
|
}
|
||||||
Bchdir(cwd);
|
Bchdir(cwd);
|
||||||
|
@ -5986,7 +5986,7 @@ static void G_Startup(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (loadpics("tiles000.art",MAXCACHE1DSIZE) < 0)
|
else if (artLoadFiles("tiles000.art",MAXCACHE1DSIZE) < 0)
|
||||||
G_GameExit("Failed loading art.");
|
G_GameExit("Failed loading art.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6074,7 +6074,7 @@ static int G_EndOfLevel(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear potentially loaded per-map ART only after the bonus screens.
|
// Clear potentially loaded per-map ART only after the bonus screens.
|
||||||
E_MapArt_Clear();
|
artClearMapArt();
|
||||||
|
|
||||||
if (ud.eog)
|
if (ud.eog)
|
||||||
{
|
{
|
||||||
|
@ -6459,7 +6459,7 @@ int app_main(int argc, char const * const * argv)
|
||||||
|
|
||||||
G_PostLoadPalette();
|
G_PostLoadPalette();
|
||||||
|
|
||||||
E_UndefineTile(MIRROR);
|
tileDelete(MIRROR);
|
||||||
|
|
||||||
Gv_ResetSystemDefaults(); // called here to populate our fake tilesizx and tilesizy arrays presented to CON with sizes generated by dummytiles
|
Gv_ResetSystemDefaults(); // called here to populate our fake tilesizx and tilesizy arrays presented to CON with sizes generated by dummytiles
|
||||||
|
|
||||||
|
@ -6591,8 +6591,9 @@ int app_main(int argc, char const * const * argv)
|
||||||
// check if the minifont will support lowercase letters (3136-3161)
|
// check if the minifont will support lowercase letters (3136-3161)
|
||||||
// there is room for them in tiles012.art between "[\]^_." and "{|}~"
|
// there is room for them in tiles012.art between "[\]^_." and "{|}~"
|
||||||
minitext_lowercase = 1;
|
minitext_lowercase = 1;
|
||||||
|
|
||||||
for (bssize_t i = MINIFONT + ('a'-'!'); minitext_lowercase && i < MINIFONT + ('z'-'!') + 1; ++i)
|
for (bssize_t i = MINIFONT + ('a'-'!'); minitext_lowercase && i < MINIFONT + ('z'-'!') + 1; ++i)
|
||||||
minitext_lowercase &= tile_exists(i);
|
minitext_lowercase &= tileLoad(i);
|
||||||
|
|
||||||
if (g_networkMode != NET_DEDICATED_SERVER)
|
if (g_networkMode != NET_DEDICATED_SERVER)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3576,7 +3576,7 @@ static void Menu_Verify(int32_t input)
|
||||||
g_player[myconnectindex].ps->gm = MODE_DEMO;
|
g_player[myconnectindex].ps->gm = MODE_DEMO;
|
||||||
if (ud.recstat == 1)
|
if (ud.recstat == 1)
|
||||||
G_CloseDemoWrite();
|
G_CloseDemoWrite();
|
||||||
E_MapArt_Clear();
|
artClearMapArt();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -430,7 +430,7 @@ void G_CacheMapData(void)
|
||||||
if (gotpic[i>>3] & pow2char[i&7])
|
if (gotpic[i>>3] & pow2char[i&7])
|
||||||
{
|
{
|
||||||
if (waloff[i] == 0)
|
if (waloff[i] == 0)
|
||||||
loadtile((int16_t)i);
|
tileLoad((int16_t)i);
|
||||||
|
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
// PRECACHE
|
// PRECACHE
|
||||||
|
|
|
@ -155,7 +155,7 @@ void *RTS_GetSound(int32_t lump)
|
||||||
if (rts_lumpcache[lump] == NULL)
|
if (rts_lumpcache[lump] == NULL)
|
||||||
{
|
{
|
||||||
rts_lumplockbyte[lump] = 200;
|
rts_lumplockbyte[lump] = 200;
|
||||||
allocache((intptr_t *)&rts_lumpcache[lump], RTS_SoundLength(lump-1), &rts_lumplockbyte[lump]); // JBF 20030910: char * => int32_t *
|
cacheAllocateBlock((intptr_t *)&rts_lumpcache[lump], RTS_SoundLength(lump-1), &rts_lumplockbyte[lump]); // JBF 20030910: char * => int32_t *
|
||||||
RTS_ReadLump(lump, rts_lumpcache[lump]);
|
RTS_ReadLump(lump, rts_lumpcache[lump]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -294,7 +294,7 @@ int32_t G_LoadSaveHeaderNew(char const *fn, savehead_t *saveh)
|
||||||
|
|
||||||
walock[TILE_LOADSHOT] = 255;
|
walock[TILE_LOADSHOT] = 255;
|
||||||
if (waloff[TILE_LOADSHOT] == 0)
|
if (waloff[TILE_LOADSHOT] == 0)
|
||||||
allocache(&waloff[TILE_LOADSHOT], 320*200, &walock[TILE_LOADSHOT]);
|
cacheAllocateBlock(&waloff[TILE_LOADSHOT], 320*200, &walock[TILE_LOADSHOT]);
|
||||||
tilesiz[TILE_LOADSHOT].x = 200;
|
tilesiz[TILE_LOADSHOT].x = 200;
|
||||||
tilesiz[TILE_LOADSHOT].y = 320;
|
tilesiz[TILE_LOADSHOT].y = 320;
|
||||||
if (screenshotofs)
|
if (screenshotofs)
|
||||||
|
@ -390,7 +390,7 @@ int32_t G_LoadPlayer(savebrief_t & sv)
|
||||||
|
|
||||||
if (currentboardfilename[0])
|
if (currentboardfilename[0])
|
||||||
{
|
{
|
||||||
E_MapArt_Setup(currentboardfilename);
|
artSetupMapArt(currentboardfilename);
|
||||||
append_ext_UNSAFE(currentboardfilename, ".mhk");
|
append_ext_UNSAFE(currentboardfilename, ".mhk");
|
||||||
loadmaphack(currentboardfilename);
|
loadmaphack(currentboardfilename);
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ void G_GetCrosshairColor(void)
|
||||||
|
|
||||||
if (waloff[CROSSHAIR] == 0)
|
if (waloff[CROSSHAIR] == 0)
|
||||||
{
|
{
|
||||||
loadtile(CROSSHAIR);
|
tileLoad(CROSSHAIR);
|
||||||
ptr = (char const *) waloff[CROSSHAIR];
|
ptr = (char const *) waloff[CROSSHAIR];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ void G_SetCrosshairColor(int32_t r, int32_t g, int32_t b)
|
||||||
|
|
||||||
if (waloff[CROSSHAIR] == 0)
|
if (waloff[CROSSHAIR] == 0)
|
||||||
{
|
{
|
||||||
loadtile(CROSSHAIR);
|
tileLoad(CROSSHAIR);
|
||||||
ptr = (char *) waloff[CROSSHAIR];
|
ptr = (char *) waloff[CROSSHAIR];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -420,7 +420,7 @@ void G_AnimateCamSprite(int smoothRatio)
|
||||||
int const viewscrTile = TILE_VIEWSCR - viewscrShift;
|
int const viewscrTile = TILE_VIEWSCR - viewscrShift;
|
||||||
|
|
||||||
if (waloff[viewscrTile] == 0)
|
if (waloff[viewscrTile] == 0)
|
||||||
allocatepermanenttile(viewscrTile, tilesiz[PN(spriteNum)].x << viewscrShift, tilesiz[PN(spriteNum)].y << viewscrShift);
|
tileCreate(viewscrTile, tilesiz[PN(spriteNum)].x << viewscrShift, tilesiz[PN(spriteNum)].y << viewscrShift);
|
||||||
else
|
else
|
||||||
walock[viewscrTile] = 255;
|
walock[viewscrTile] = 255;
|
||||||
|
|
||||||
|
|
|
@ -465,7 +465,7 @@ int32_t S_LoadSound(uint32_t num)
|
||||||
int32_t l = kfilelength(fp);
|
int32_t l = kfilelength(fp);
|
||||||
g_soundlocks[num] = 200;
|
g_soundlocks[num] = 200;
|
||||||
g_sounds[num].soundsiz = l;
|
g_sounds[num].soundsiz = l;
|
||||||
allocache((intptr_t *)&g_sounds[num].ptr, l, (char *)&g_soundlocks[num]);
|
cacheAllocateBlock((intptr_t *)&g_sounds[num].ptr, l, (char *)&g_soundlocks[num]);
|
||||||
l = kread(fp, g_sounds[num].ptr, l);
|
l = kread(fp, g_sounds[num].ptr, l);
|
||||||
kclose(fp);
|
kclose(fp);
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ int32_t S_LoadSound(uint32_t num)
|
||||||
|
|
||||||
g_sounds[num].lock = 200;
|
g_sounds[num].lock = 200;
|
||||||
|
|
||||||
allocache((intptr_t *)&g_sounds[num].ptr,l,(char *)&g_sounds[num].lock);
|
cacheAllocateBlock((intptr_t *)&g_sounds[num].ptr,l,(char *)&g_sounds[num].lock);
|
||||||
kread(fp, g_sounds[num].ptr , l);
|
kread(fp, g_sounds[num].ptr , l);
|
||||||
kclose(fp);
|
kclose(fp);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in a new issue