mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- first batch of adjustments to the new tile management.
- consolidated Polymost precaching and removed precaching for static tiles because they now are always loaded. - removed cache configurability. On modern systems this is relatively pointless - allocating 50 or 100 MB is a non-issue - and the cache is due for replacement anyway.
This commit is contained in:
parent
4b6f28e7c8
commit
0e165e40a3
37 changed files with 84 additions and 290 deletions
|
@ -390,49 +390,6 @@ void PreloadTiles(void)
|
|||
G_HandleAsync();
|
||||
}
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
void PrecacheExtraTextureMaps(int nTile)
|
||||
{
|
||||
// PRECACHE
|
||||
if (useprecache && bpp > 8)
|
||||
{
|
||||
for (int type = 0; type < 2 && !KB_KeyPressed(sc_Space); type++)
|
||||
{
|
||||
if (TestBitString(precachehightile[type], nTile))
|
||||
{
|
||||
for (int k = 0; k < MAXPALOOKUPS - RESERVEDPALS && !KB_KeyPressed(sc_Space); k++)
|
||||
{
|
||||
// this is the CROSSHAIR_PAL, see screens.cpp
|
||||
if (k == MAXPALOOKUPS - RESERVEDPALS - 1)
|
||||
break;
|
||||
#ifdef POLYMER
|
||||
if (videoGetRenderMode() != REND_POLYMER || !polymer_havehighpalookup(0, k))
|
||||
#endif
|
||||
polymost_precache(nTile, k, type);
|
||||
}
|
||||
|
||||
#ifdef USE_GLEXT
|
||||
if (r_detailmapping)
|
||||
polymost_precache(nTile, DETAILPAL, type);
|
||||
|
||||
if (r_glowmapping)
|
||||
polymost_precache(nTile, GLOWPAL, type);
|
||||
#endif
|
||||
#ifdef POLYMER
|
||||
if (videoGetRenderMode() == REND_POLYMER)
|
||||
{
|
||||
if (pr_specularmapping)
|
||||
polymost_precache(nTile, SPECULARPAL, type);
|
||||
|
||||
if (pr_normalmapping)
|
||||
polymost_precache(nTile, NORMALPAL, type);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void PreloadCache(void)
|
||||
{
|
||||
|
@ -454,10 +411,12 @@ void PreloadCache(void)
|
|||
{
|
||||
if (TestBitString(gotpic, i))
|
||||
{
|
||||
tileCache(i);
|
||||
// For the hardware renderer precaching the raw pixel data is pointless.
|
||||
if (videoGetRenderMode() < REND_POLYMOST)
|
||||
tileLoad(i);
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
PrecacheExtraTextureMaps(i);
|
||||
if (useprecache) PrecacheHardwareTextures(i);
|
||||
#endif
|
||||
|
||||
MUSIC_Update();
|
||||
|
@ -1459,10 +1418,8 @@ void ParseOptions(void)
|
|||
{
|
||||
if (OptArgc < 1)
|
||||
ThrowError("Missing argument");
|
||||
uint32_t j = strtoul(OptArgv[0], NULL, 0);
|
||||
MAXCACHE1DSIZE = j<<10;
|
||||
initprintf("Cache size: %dkB\n", j);
|
||||
break;
|
||||
// No longer supported.
|
||||
break;
|
||||
}
|
||||
case 35:
|
||||
if (OptArgc < 1)
|
||||
|
@ -2168,9 +2125,6 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass)
|
|||
|
||||
if (scriptfile_getnumber(pScript, &cacheSize) || !firstPass)
|
||||
break;
|
||||
|
||||
if (cacheSize > 0)
|
||||
MAXCACHE1DSIZE = cacheSize << 10;
|
||||
}
|
||||
break;
|
||||
case T_INCLUDE:
|
||||
|
@ -2596,39 +2550,13 @@ void ScanINIFiles(void)
|
|||
}
|
||||
}
|
||||
|
||||
bool LoadArtFile(const char *pzFile)
|
||||
{
|
||||
int hFile = kopen4loadfrommod(pzFile, 0);
|
||||
if (hFile == -1)
|
||||
{
|
||||
initprintf("Can't open extra art file:\"%s\"\n", pzFile);
|
||||
return false;
|
||||
}
|
||||
artheader_t artheader;
|
||||
int nStatus = artReadHeader(hFile, pzFile, &artheader);
|
||||
if (nStatus != 0)
|
||||
{
|
||||
kclose(hFile);
|
||||
initprintf("Error reading extra art file:\"%s\"\n", pzFile);
|
||||
return false;
|
||||
}
|
||||
for (int i = artheader.tilestart; i <= artheader.tileend; i++)
|
||||
tileDelete(i);
|
||||
artReadManifest(hFile, &artheader);
|
||||
artPreloadFile(hFile, &artheader);
|
||||
for (int i = artheader.tilestart; i <= artheader.tileend; i++)
|
||||
tileUpdatePicSiz(i);
|
||||
kclose(hFile);
|
||||
return true;
|
||||
}
|
||||
|
||||
void LoadExtraArts(void)
|
||||
{
|
||||
if (!pINISelected->pDescription)
|
||||
return;
|
||||
for (int i = 0; i < pINISelected->pDescription->nArts; i++)
|
||||
{
|
||||
LoadArtFile(pINISelected->pDescription->pzArts[i]);
|
||||
TileFiles.LoadArtFile(pINISelected->pDescription->pzArts[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,6 @@ void PreloadCache(void);
|
|||
void StartLevel(GAMEOPTIONS *gameOptions);
|
||||
void ProcessFrame(void);
|
||||
void ScanINIFiles(void);
|
||||
bool LoadArtFile(const char *pzFile);
|
||||
void LoadExtraArts(void);
|
||||
bool DemoRecordStatus(void);
|
||||
bool VanillaMode(void);
|
||||
|
|
|
@ -723,22 +723,22 @@ inline int QRandom2(int a1)
|
|||
template<class T>
|
||||
inline void SetBitString(T *pArray, int nIndex)
|
||||
{
|
||||
static_assert(sizeof(T) == 1, "");
|
||||
static_assert(sizeof(T) == 1, "Bit array element too large");
|
||||
pArray[nIndex>>3] |= 1<<(nIndex&7);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline void ClearBitString(T *pArray, int nIndex)
|
||||
{
|
||||
static_assert(sizeof(T) == 1, "");
|
||||
static_assert(sizeof(T) == 1, "Bit array element too large");
|
||||
pArray[nIndex >> 3] &= ~(1 << (nIndex & 7));
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline char TestBitString(T *pArray, int nIndex)
|
||||
{
|
||||
static_assert(sizeof(T) == 1, "");
|
||||
return pArray[nIndex>>3] & (1<<(nIndex&7));
|
||||
static_assert(sizeof(T) == 1, "Bit array element too large");
|
||||
return pArray[nIndex>>3] & (1<<(nIndex&7));
|
||||
}
|
||||
|
||||
// This is to override the namepace prioritization without altering the actual calls.
|
||||
|
|
|
@ -724,12 +724,6 @@ int CONFIG_ReadSetup(void)
|
|||
SCRIPT_GetNumber(scripthandle, "Setup", "ForceSetup", &gSetup.forcesetup);
|
||||
SCRIPT_GetNumber(scripthandle, "Setup", "NoAutoLoad", &gSetup.noautoload);
|
||||
|
||||
int32_t cachesize;
|
||||
SCRIPT_GetNumber(scripthandle, "Setup", "CacheSize", &cachesize);
|
||||
|
||||
if (cachesize > MAXCACHE1DSIZE)
|
||||
MAXCACHE1DSIZE = cachesize;
|
||||
|
||||
if (gNoSetup == 0 && g_modDir[0] == '/')
|
||||
{
|
||||
struct Bstat st;
|
||||
|
@ -846,7 +840,6 @@ void CONFIG_WriteSetup(uint32_t flags)
|
|||
|
||||
//SCRIPT_PutNumber(scripthandle, "Misc", "Executions", ud.executions, FALSE, FALSE);
|
||||
|
||||
SCRIPT_PutNumber(scripthandle, "Setup", "CacheSize", MAXCACHE1DSIZE, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(scripthandle, "Setup", "ConfigVersion", BYTEVERSION, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(scripthandle, "Setup", "ForceSetup", gSetup.forcesetup, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(scripthandle, "Setup", "NoAutoLoad", gSetup.noautoload, FALSE, FALSE);
|
||||
|
|
|
@ -67,10 +67,8 @@ void DoFireFrame(void)
|
|||
{
|
||||
memcpy(FrameBuffer+16896+i*128, SeedBuffer[nRand], 128);
|
||||
}
|
||||
CellularFrame(FrameBuffer, 128, 132);
|
||||
tileLoadTile(2342);
|
||||
tileMakeWritable(2342);
|
||||
auto pData = tileData(2342);
|
||||
CellularFrame(FrameBuffer, 128, 132);
|
||||
auto pData = TileFiles.tileMakeWritable(2342);
|
||||
char *pSource = FrameBuffer;
|
||||
int x = fireSize;
|
||||
do
|
||||
|
|
|
@ -79,8 +79,6 @@ short voxelIndex[kMaxTiles];
|
|||
|
||||
const char *pzBaseFileName = "TILES%03i.ART"; //"TILES%03i.ART";
|
||||
|
||||
int32_t MAXCACHE1DSIZE = (96*1024*1024);
|
||||
|
||||
int tileInit(char a1, const char *a2)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(a1);
|
||||
|
|
|
@ -53,8 +53,6 @@ extern short voxelIndex[kMaxTiles];
|
|||
extern int nPrecacheCount;
|
||||
extern char precachehightile[2][(MAXTILES+7)>>3];
|
||||
|
||||
extern int32_t MAXCACHE1DSIZE;
|
||||
|
||||
void qloadvoxel(int32_t nVoxel);
|
||||
int tileInit(char a1, const char *a2);
|
||||
#ifdef USE_OPENGL
|
||||
|
|
|
@ -3688,13 +3688,8 @@ void viewSetCrosshairColor(int32_t r, int32_t g, int32_t b)
|
|||
CrosshairColors.g = g;
|
||||
CrosshairColors.b = b;
|
||||
|
||||
tileMakeWritable(kCrosshairTile);
|
||||
tileLoad(kCrosshairTile);
|
||||
|
||||
if (!tilePtr(kCrosshairTile))
|
||||
return;
|
||||
|
||||
auto ptr = tileData(kCrosshairTile);
|
||||
auto ptr = TileFiles.tileMakeWritable(kCrosshairTile);
|
||||
if (!ptr) return;
|
||||
|
||||
int32_t ii = tilesiz[kCrosshairTile].x * tilesiz[kCrosshairTile].y;
|
||||
|
||||
|
|
|
@ -1058,7 +1058,6 @@ bool tileLoad(int16_t tilenume);
|
|||
void tileLoadData(int16_t tilenume, int32_t dasiz, char *buffer);
|
||||
int32_t tileCRC(int16_t tileNum);
|
||||
void tileUpdatePicSiz(int32_t picnum);
|
||||
void tileMakeWritable(int num);
|
||||
|
||||
int32_t qloadkvx(int32_t voxindex, const char *filename);
|
||||
void vox_undefine(int32_t const);
|
||||
|
@ -1325,6 +1324,7 @@ void polymostSet2dView(void); // sets up GL for 2D drawing
|
|||
|
||||
void polymost_glreset(void);
|
||||
void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype);
|
||||
void PrecacheHardwareTextures(int nTile);
|
||||
|
||||
typedef uint16_t polytintflags_t;
|
||||
|
||||
|
|
|
@ -819,6 +819,8 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
|
|||
|
||||
if (method & DAMETH_MASKPROPS)
|
||||
{
|
||||
// Fixme: Alpha test on shaders must be done differently.
|
||||
// Also: Consider a texture's alpha threshold.
|
||||
float const al = alphahackarray[globalpicnum] != 0 ? alphahackarray[globalpicnum] * (1.f/255.f) :
|
||||
(pth->hicr && pth->hicr->alphacut >= 0.f ? pth->hicr->alphacut : 0.f);
|
||||
|
||||
|
@ -5772,3 +5774,17 @@ void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype)
|
|||
mdloadskin((md2model_t *)models[mid], 0, dapalnum, i);
|
||||
}
|
||||
|
||||
void PrecacheHardwareTextures(int nTile)
|
||||
{
|
||||
// PRECACHE
|
||||
// This really *really* needs improvement on the game side - the entire precaching logic has no clue about the different needs of a hardware renderer.
|
||||
|
||||
polymost_precache(nTile, 0, 1);
|
||||
|
||||
if (r_detailmapping)
|
||||
polymost_precache(nTile, DETAILPAL, 1);
|
||||
|
||||
if (r_glowmapping)
|
||||
polymost_precache(nTile, GLOWPAL, 1);
|
||||
|
||||
}
|
||||
|
|
|
@ -619,17 +619,12 @@ const uint8_t* tilePtr(int num)
|
|||
}
|
||||
uint8_t* tileData(int num)
|
||||
{
|
||||
// Q: Should this automatically make the tile writable?
|
||||
auto tex = TileFiles.tiles[num];
|
||||
assert(tex);
|
||||
if (tex->GetWritableBuffer()) return tex->GetWritableBuffer();
|
||||
return tiledata[num];
|
||||
}
|
||||
|
||||
void tileMakeWritable(int num)
|
||||
{
|
||||
// This won't be so simple anymore with a real texture manager backing this.
|
||||
tiledata[num] = TileFiles.tileMakeWritable(num);
|
||||
tilesizearray[num] = TileFiles.tiles[num]->GetSize();
|
||||
}
|
||||
|
||||
//
|
||||
// loadtile
|
||||
//
|
||||
|
|
|
@ -72,7 +72,7 @@ enum ECreateTexBufferFlags
|
|||
|
||||
enum
|
||||
{
|
||||
//MAXCACHE1DSIZE = (50 * 1024 * 1024),
|
||||
MAXCACHE1DSIZE = (50 * 1024 * 1024),
|
||||
|
||||
MAXTILES = 30720,
|
||||
MAXUSERTILES = (MAXTILES-16) // reserve 16 tiles at the end
|
||||
|
|
|
@ -430,6 +430,7 @@ int32_t Anim_Play(const char *fn)
|
|||
return 0;
|
||||
|
||||
int32_t length = kfilelength(handle);
|
||||
TArray<uint8_t> buffer(length + 1, true);
|
||||
|
||||
if (length <= 4)
|
||||
{
|
||||
|
@ -438,9 +439,7 @@ int32_t Anim_Play(const char *fn)
|
|||
}
|
||||
|
||||
anim->animlock = 255;
|
||||
|
||||
if (!anim->animbuf)
|
||||
cacheAllocateBlock((intptr_t *)&anim->animbuf, length + 1, &anim->animlock);
|
||||
anim->animbuf = buffer.Data();
|
||||
|
||||
kread(handle, anim->animbuf, length);
|
||||
kclose(handle);
|
||||
|
@ -572,6 +571,7 @@ end_anim_restore_gl:
|
|||
#endif
|
||||
end_anim:
|
||||
I_ClearAllInput();
|
||||
anim->animbuf = nullptr;
|
||||
ANIM_FreeAnim();
|
||||
|
||||
tileDelete(TILE_ANIM);
|
||||
|
|
|
@ -523,10 +523,8 @@ void G_CheckCommandLine(int32_t argc, char const * const * argv)
|
|||
{
|
||||
if (argc > i+1)
|
||||
{
|
||||
uint32_t j = Batol(argv[i+1]);
|
||||
MAXCACHE1DSIZE = j<<10;
|
||||
initprintf("Cache size: %dkB\n", j);
|
||||
i++;
|
||||
// No longer supported.
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
|
|
|
@ -833,12 +833,6 @@ int CONFIG_ReadSetup(void)
|
|||
SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "ForceSetup", &ud.setup.forcesetup);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "NoAutoLoad", &ud.setup.noautoload);
|
||||
|
||||
int32_t cachesize;
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "CacheSize", &cachesize);
|
||||
|
||||
if (cachesize > MAXCACHE1DSIZE)
|
||||
MAXCACHE1DSIZE = cachesize;
|
||||
|
||||
if (g_noSetup == 0 && g_modDir[0] == '/')
|
||||
{
|
||||
SCRIPT_GetString(ud.config.scripthandle, "Setup","ModDir",&g_modDir[0]);
|
||||
|
@ -968,7 +962,6 @@ void CONFIG_WriteSetup(uint32_t flags)
|
|||
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Executions", ud.executions, FALSE, FALSE);
|
||||
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "CacheSize", MAXCACHE1DSIZE, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "ConfigVersion", BYTEVERSION_EDUKE32, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "ForceSetup", ud.setup.forcesetup, FALSE, FALSE);
|
||||
SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "NoAutoLoad", ud.setup.noautoload, FALSE, FALSE);
|
||||
|
|
|
@ -98,15 +98,6 @@ static const char *defaultrtsfilename[GAMECOUNT] = { "DUKE.RTS", "NAM.RTS", "NAP
|
|||
|
||||
int32_t g_Shareware = 0;
|
||||
|
||||
// This was 32 for a while, but I think lowering it to 24 will help things like the Dingoo.
|
||||
// Ideally, we would look at our memory usage on our most cramped platform and figure out
|
||||
// how much of that is needed for the underlying OS and things like SDL instead of guessing
|
||||
#ifndef GEKKO
|
||||
int32_t MAXCACHE1DSIZE = (96*1024*1024);
|
||||
#else
|
||||
int32_t MAXCACHE1DSIZE = (8*1024*1024);
|
||||
#endif
|
||||
|
||||
int32_t tempwallptr;
|
||||
|
||||
static int32_t nonsharedtimer;
|
||||
|
@ -1106,7 +1097,6 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
|
|||
if (videoGetRenderMode() == REND_CLASSIC)
|
||||
{
|
||||
renderRestoreTarget();
|
||||
// walock[TILE_SAVESHOT] = 1;
|
||||
}
|
||||
#ifdef USE_OPENGL
|
||||
else
|
||||
|
@ -1154,7 +1144,6 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
|
|||
tiltZoom >>= tiltcs; // JBF 20030807
|
||||
|
||||
rotatesprite_win(160 << 16, 100 << 16, tiltZoom, tang + 512, TILE_TILT, 0, 0, 4 + 2 + 64 + 1024);
|
||||
walock[TILE_TILT] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5370,9 +5359,6 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass)
|
|||
|
||||
if (scriptfile_getnumber(pScript, &cacheSize) || !firstPass)
|
||||
break;
|
||||
|
||||
if (cacheSize > 0)
|
||||
MAXCACHE1DSIZE = cacheSize << 10;
|
||||
}
|
||||
break;
|
||||
case T_INCLUDE:
|
||||
|
|
|
@ -343,7 +343,6 @@ extern int32_t ticrandomseed;
|
|||
extern int32_t vote_map;
|
||||
extern int32_t voting;
|
||||
|
||||
extern int32_t MAXCACHE1DSIZE;
|
||||
//extern int8_t cheatbuf[MAXCHEATLEN],cheatbuflen;
|
||||
|
||||
#define CROSSHAIR_PAL (MAXPALOOKUPS-RESERVEDPALS-1)
|
||||
|
|
|
@ -89,10 +89,11 @@ enum GamearrayFlags_t
|
|||
GAMEARRAY_UINT8 = GAMEARRAY_INT8 | GAMEARRAY_UNSIGNED,
|
||||
GAMEARRAY_BITMAP = 0x00100000,
|
||||
GAMEARRAY_WARN = 0x00200000,
|
||||
GAMEARRAY_FUNC = 0x00400000,
|
||||
|
||||
GAMEARRAY_SIZE_MASK = GAMEARRAY_INT8 | GAMEARRAY_INT16 | GAMEARRAY_BITMAP,
|
||||
GAMEARRAY_STORAGE_MASK = GAMEARRAY_INT8 | GAMEARRAY_INT16 | GAMEARRAY_BITMAP | GAMEARRAY_STRIDE2,
|
||||
GAMEARRAY_TYPE_MASK = GAMEARRAY_UNSIGNED | GAMEARRAY_INT8 | GAMEARRAY_INT16 | GAMEARRAY_BITMAP,
|
||||
GAMEARRAY_TYPE_MASK = GAMEARRAY_UNSIGNED | GAMEARRAY_INT8 | GAMEARRAY_INT16 | GAMEARRAY_BITMAP | GAMEARRAY_FUNC,
|
||||
};
|
||||
|
||||
#pragma pack(push,1)
|
||||
|
|
|
@ -4548,7 +4548,6 @@ void Menu_Close(uint8_t playerID)
|
|||
actor[g_curViewscreen].t_data[0] = (int32_t) totalclock;
|
||||
}
|
||||
|
||||
walock[TILE_SAVESHOT] = 1;
|
||||
G_UpdateScreenArea();
|
||||
S_PauseSounds(false);
|
||||
}
|
||||
|
|
|
@ -412,49 +412,7 @@ static void G_DoLoadScreen(const char *statustext, int percent)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
static void cacheExtraTextureMaps(int tileNum)
|
||||
{
|
||||
// PRECACHE
|
||||
if (ud.config.useprecache && bpp > 8)
|
||||
{
|
||||
for (int type = 0; type < 2 && !KB_KeyPressed(sc_Space); type++)
|
||||
{
|
||||
if (precachehightile[type][tileNum >> 3] & pow2char[tileNum & 7])
|
||||
{
|
||||
for (int k = 0; k < MAXPALOOKUPS - RESERVEDPALS && !KB_KeyPressed(sc_Space); k++)
|
||||
{
|
||||
// this is the CROSSHAIR_PAL, see screens.cpp
|
||||
if (k == MAXPALOOKUPS - RESERVEDPALS - 1)
|
||||
break;
|
||||
#ifdef POLYMER
|
||||
if (videoGetRenderMode() != REND_POLYMER || !polymer_havehighpalookup(0, k))
|
||||
#endif
|
||||
polymost_precache(tileNum, k, type);
|
||||
}
|
||||
|
||||
#ifdef USE_GLEXT
|
||||
if (r_detailmapping)
|
||||
polymost_precache(tileNum, DETAILPAL, type);
|
||||
|
||||
if (r_glowmapping)
|
||||
polymost_precache(tileNum, GLOWPAL, type);
|
||||
#endif
|
||||
#ifdef POLYMER
|
||||
if (videoGetRenderMode() == REND_POLYMER)
|
||||
{
|
||||
if (pr_specularmapping)
|
||||
polymost_precache(tileNum, SPECULARPAL, type);
|
||||
|
||||
if (pr_normalmapping)
|
||||
polymost_precache(tileNum, NORMALPAL, type);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void G_CacheMapData(void)
|
||||
{
|
||||
|
@ -505,10 +463,12 @@ void G_CacheMapData(void)
|
|||
else if ((gotpic[i>>3] & pow2char[i&7]) != pow2char[i&7])
|
||||
continue;
|
||||
|
||||
tileCache(i);
|
||||
// For the hardware renderer precaching the raw pixel data is pointless.
|
||||
if (videoGetRenderMode() < REND_POLYMOST)
|
||||
tileLoad(i);
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
cacheExtraTextureMaps(i);
|
||||
if (ud.config.useprecache) PrecacheHardwareTextures(i);
|
||||
#endif
|
||||
|
||||
MUSIC_Update();
|
||||
|
|
|
@ -134,10 +134,7 @@ void G_SetCrosshairColor(int32_t r, int32_t g, int32_t b)
|
|||
if (g_crosshairSum == r+(g<<8)+(b<<16))
|
||||
return;
|
||||
|
||||
tileLoad(CROSSHAIR);
|
||||
tileMakeWritable(CROSSHAIR);
|
||||
|
||||
auto ptr = tileData(CROSSHAIR);
|
||||
auto ptr = TileFiles.tileMakeWritable(CROSSHAIR);
|
||||
if (!ptr) return;
|
||||
|
||||
if (!DefaultCrosshairColors.f)
|
||||
|
|
|
@ -435,10 +435,8 @@ void G_AnimateCamSprite(int smoothRatio)
|
|||
int const viewscrShift = G_GetViewscreenSizeShift((uspriteptr_t)&sprite[spriteNum]);
|
||||
int const viewscrTile = TILE_VIEWSCR - viewscrShift;
|
||||
|
||||
if (tileData(viewscrTile) == 0)
|
||||
if (tileData(viewscrTile) ==nullptr)
|
||||
tileCreate(viewscrTile, tilesiz[PN(spriteNum)].x << viewscrShift, tilesiz[PN(spriteNum)].y << viewscrShift);
|
||||
else
|
||||
walock[viewscrTile] = 199;
|
||||
|
||||
G_SetupCamTile(OW(spriteNum), viewscrTile, smoothRatio);
|
||||
#ifdef POLYMER
|
||||
|
|
|
@ -3694,7 +3694,7 @@ ACTOR_STATIC int A_CheckPins(int16_t const sectNum)
|
|||
if (tag != 0)
|
||||
{
|
||||
int const tileNumber = LANEPICS + tag + 1;
|
||||
tileMakeWritable(tileNumber);
|
||||
TileFiles.tileMakeWritable(tileNumber);
|
||||
tileCopySection(LANEPICS+1, 0, 0, 128, 64, tileNumber, 0, 0);
|
||||
|
||||
for (int pin = 0; pin < 10; pin++)
|
||||
|
@ -3787,7 +3787,7 @@ ACTOR_STATIC void A_ResetPins(int16_t sect)
|
|||
if (tag != 0)
|
||||
{
|
||||
int const tileNumber = LANEPICS + tag + 1;
|
||||
tileMakeWritable(tileNumber);
|
||||
TileFiles.tileMakeWritable(tileNumber);
|
||||
tileCopySection(LANEPICS+1, 0, 0, 128, 64, tileNumber, 0, 0);
|
||||
|
||||
for (int pin = 0; pin < 10; pin++)
|
||||
|
@ -3846,7 +3846,7 @@ void A_ResetLanePics(void)
|
|||
for (int tag = 1; tag <= 4; tag++)
|
||||
{
|
||||
int const tileNumber = LANEPICS + tag + 1;
|
||||
tileMakeWritable(tileNumber);
|
||||
TileFiles.tileMakeWritable(tileNumber);
|
||||
tileCopySection(LANEPICS + 1, 0, 0, 128, 64, tileNumber, 0, 0);
|
||||
|
||||
for (int pin = 0; pin < 10; pin++)
|
||||
|
|
|
@ -460,6 +460,7 @@ int32_t Anim_Play(const char *fn)
|
|||
return 0;
|
||||
|
||||
int32_t length = kfilelength(handle);
|
||||
TArray<uint8_t> buffer(length + 1, true);
|
||||
|
||||
if (length <= 4)
|
||||
{
|
||||
|
@ -467,10 +468,7 @@ int32_t Anim_Play(const char *fn)
|
|||
goto end_anim;
|
||||
}
|
||||
|
||||
anim->animlock = 1;
|
||||
|
||||
if (!anim->animbuf)
|
||||
cacheAllocateBlock((intptr_t *)&anim->animbuf, length + 1, &anim->animlock);
|
||||
anim->animbuf = buffer.Data();
|
||||
|
||||
tileCreate(TILE_ANIM, 200, 320);
|
||||
|
||||
|
@ -592,10 +590,9 @@ end_anim_restore_gl:
|
|||
#endif
|
||||
end_anim:
|
||||
I_ClearAllInput();
|
||||
anim->animbuf = nullptr;
|
||||
ANIM_FreeAnim();
|
||||
tileDelete(TILE_ANIM);
|
||||
walock[TILE_ANIM] = 1;
|
||||
anim->animlock = 0;
|
||||
|
||||
return !running;
|
||||
}
|
||||
|
|
|
@ -500,10 +500,8 @@ void G_CheckCommandLine(int32_t argc, char const * const * argv)
|
|||
{
|
||||
if (argc > i+1)
|
||||
{
|
||||
uint32_t j = Batol(argv[i+1]);
|
||||
MAXCACHE1DSIZE = j<<10;
|
||||
initprintf("Cache size: %dkB\n", j);
|
||||
i++;
|
||||
// No longer supported.
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
|
|
|
@ -678,9 +678,6 @@ int32_t CONFIG_ReadSetup(void)
|
|||
SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "NoAutoLoad", &ud.setup.noautoload);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "CacheSize", &dummy);
|
||||
|
||||
if (dummy > MAXCACHE1DSIZE)
|
||||
MAXCACHE1DSIZE = dummy;
|
||||
|
||||
if (g_noSetup == 0 && g_modDir[0] == '/')
|
||||
{
|
||||
struct Bstat st;
|
||||
|
|
|
@ -90,15 +90,6 @@ const char *defaultrtsfilename[GAMECOUNT] = { "DUKE.RTS", "REDNECK.RTS", "REDNEC
|
|||
|
||||
int32_t g_Shareware = 0;
|
||||
|
||||
// This was 32 for a while, but I think lowering it to 24 will help things like the Dingoo.
|
||||
// Ideally, we would look at our memory usage on our most cramped platform and figure out
|
||||
// how much of that is needed for the underlying OS and things like SDL instead of guessing
|
||||
#ifndef GEKKO
|
||||
int32_t MAXCACHE1DSIZE = (96*1024*1024);
|
||||
#else
|
||||
int32_t MAXCACHE1DSIZE = (8*1024*1024);
|
||||
#endif
|
||||
|
||||
int32_t tempwallptr;
|
||||
|
||||
static int32_t nonsharedtimer;
|
||||
|
@ -1488,7 +1479,6 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
|
|||
if (videoGetRenderMode() == REND_CLASSIC)
|
||||
{
|
||||
renderRestoreTarget();
|
||||
// walock[TILE_SAVESHOT] = 1;
|
||||
}
|
||||
#ifdef USE_OPENGL
|
||||
else
|
||||
|
@ -1536,7 +1526,6 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
|
|||
tiltZoom >>= tiltcs; // JBF 20030807
|
||||
|
||||
rotatesprite_win(160 << 16, 100 << 16, tiltZoom, tang + 512, TILE_TILT, 0, 0, 4 + 2 + 64 + 1024);
|
||||
walock[TILE_TILT] = 199;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5052,7 +5041,7 @@ default_case1:
|
|||
t->xrepeat += 10;
|
||||
t->yrepeat += 9;
|
||||
}
|
||||
else if (g_curViewscreen == i && display_mirror != 3 && tileData(viewscrTile) && walock[viewscrTile] > 200)
|
||||
else if (g_curViewscreen == i && display_mirror != 3 && tileData(viewscrTile))
|
||||
{
|
||||
// this exposes a sprite sorting issue which needs to be debugged further...
|
||||
#if 0
|
||||
|
@ -6866,9 +6855,6 @@ static int parsedefinitions_game(scriptfile *pScript, int firstPass)
|
|||
|
||||
if (scriptfile_getnumber(pScript, &cacheSize) || !firstPass)
|
||||
break;
|
||||
|
||||
if (cacheSize > 0)
|
||||
MAXCACHE1DSIZE = cacheSize << 10;
|
||||
}
|
||||
break;
|
||||
case T_INCLUDE:
|
||||
|
|
|
@ -306,7 +306,6 @@ extern int32_t ticrandomseed;
|
|||
extern int32_t vote_map;
|
||||
extern int32_t voting;
|
||||
|
||||
extern int32_t MAXCACHE1DSIZE;
|
||||
//extern int8_t cheatbuf[MAXCHEATLEN],cheatbuflen;
|
||||
|
||||
#define CROSSHAIR_PAL (MAXPALOOKUPS-RESERVEDPALS-1)
|
||||
|
|
|
@ -4870,7 +4870,6 @@ void Menu_Close(uint8_t playerID)
|
|||
actor[g_curViewscreen].t_data[0] = (int32_t) totalclock;
|
||||
}
|
||||
|
||||
walock[TILE_SAVESHOT] = 199;
|
||||
G_UpdateScreenArea();
|
||||
|
||||
if (!ud.pause_on)
|
||||
|
@ -7604,7 +7603,6 @@ void M_DisplayMenus(void)
|
|||
|
||||
if ((g_player[myconnectindex].ps->gm&MODE_MENU) == 0)
|
||||
{
|
||||
walock[TILE_LOADSHOT] = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -615,48 +615,14 @@ void G_CacheMapData(void)
|
|||
}
|
||||
if (gotpic[i>>3] & pow2char[i&7])
|
||||
{
|
||||
tileCache(i);
|
||||
// For the hardware renderer precaching the raw pixel data is pointless.
|
||||
if (videoGetRenderMode() < REND_POLYMOST)
|
||||
tileLoad(i);
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
// PRECACHE
|
||||
if (ud.config.useprecache && bpp > 8)
|
||||
{
|
||||
int32_t k,type;
|
||||
|
||||
for (type=0; type<=1; type++)
|
||||
if (precachehightile[type][i>>3] & pow2char[i&7])
|
||||
{
|
||||
k = 0;
|
||||
for (k=0; k<MAXPALOOKUPS-RESERVEDPALS && !KB_KeyPressed(sc_Space); k++)
|
||||
{
|
||||
// this is the CROSSHAIR_PAL, see comment in game.c
|
||||
if (k == MAXPALOOKUPS-RESERVEDPALS-1)
|
||||
break;
|
||||
#ifdef POLYMER
|
||||
if (videoGetRenderMode() != REND_POLYMER || !polymer_havehighpalookup(0, k))
|
||||
if (ud.config.useprecache) PrecacheHardwareTextures(i);
|
||||
#endif
|
||||
polymost_precache(i,k,type);
|
||||
}
|
||||
|
||||
#ifdef USE_GLEXT
|
||||
if (r_detailmapping && !KB_KeyPressed(sc_Space))
|
||||
polymost_precache(i,DETAILPAL,type);
|
||||
if (r_glowmapping && !KB_KeyPressed(sc_Space))
|
||||
polymost_precache(i,GLOWPAL,type);
|
||||
#endif
|
||||
#ifdef POLYMER
|
||||
if (videoGetRenderMode() == REND_POLYMER)
|
||||
{
|
||||
if (pr_specularmapping && !KB_KeyPressed(sc_Space))
|
||||
polymost_precache(i,SPECULARPAL,type);
|
||||
if (pr_normalmapping && !KB_KeyPressed(sc_Space))
|
||||
polymost_precache(i,NORMALPAL,type);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
j++;
|
||||
j++;
|
||||
pc++;
|
||||
}
|
||||
else continue;
|
||||
|
|
|
@ -127,10 +127,7 @@ void G_SetCrosshairColor(int32_t r, int32_t g, int32_t b)
|
|||
if (g_crosshairSum == r+(g<<8)+(b<<16))
|
||||
return;
|
||||
|
||||
tileLoad(CROSSHAIR);
|
||||
tileMakeWritable(CROSSHAIR);
|
||||
|
||||
auto ptr = tileData(CROSSHAIR);
|
||||
auto ptr = TileFiles.tileMakeWritable(CROSSHAIR);
|
||||
if (!ptr) return;
|
||||
|
||||
if (!DefaultCrosshairColors.f)
|
||||
|
|
|
@ -541,10 +541,8 @@ void G_AnimateCamSprite(int smoothRatio)
|
|||
int const viewscrShift = G_GetViewscreenSizeShift((const uspritetype *)&sprite[spriteNum]);
|
||||
int const viewscrTile = TILE_VIEWSCR - viewscrShift;
|
||||
|
||||
if (tileData(viewscrTile) == 0)
|
||||
if (tileData(viewscrTile) == nullptr)
|
||||
tileCreate(viewscrTile, tilesiz[PN(spriteNum)].x << viewscrShift, tilesiz[PN(spriteNum)].y << viewscrShift);
|
||||
else
|
||||
walock[viewscrTile] = 255;
|
||||
|
||||
G_SetupCamTile(OW(spriteNum), viewscrTile, smoothRatio);
|
||||
#ifdef POLYMER
|
||||
|
|
|
@ -57,6 +57,7 @@ int ANIMnumframes;
|
|||
unsigned char ANIMpal[3*256];
|
||||
unsigned char ANIMnum = 0;
|
||||
short SoundState;
|
||||
static TArray<uint8_t> buffer;
|
||||
|
||||
const char *ANIMname[] =
|
||||
{
|
||||
|
@ -238,8 +239,7 @@ unsigned char *LoadAnm(short anim_num)
|
|||
ANIMnum = anim_num;
|
||||
|
||||
// lock it
|
||||
walock[ANIM_TILE(ANIMnum)] = 219;
|
||||
|
||||
|
||||
if (anm_ptr[anim_num] == 0)
|
||||
{
|
||||
handle = kopen4load(ANIMname[ANIMnum], 0);
|
||||
|
@ -247,7 +247,8 @@ unsigned char *LoadAnm(short anim_num)
|
|||
return NULL;
|
||||
length = kfilelength(handle);
|
||||
|
||||
cacheAllocateBlock((intptr_t *) &anm_ptr[anim_num], length + sizeof(anim_t), &walock[ANIM_TILE(ANIMnum)]);
|
||||
buffer.Resize(length + sizeof(anim_t));
|
||||
anm_ptr[anim_num] = (anim_t*)buffer.Data();
|
||||
animbuf = (unsigned char *)((intptr_t)anm_ptr[anim_num] + sizeof(anim_t));
|
||||
|
||||
kread(handle, animbuf, length);
|
||||
|
@ -387,6 +388,5 @@ ENDOFANIMLOOP:
|
|||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeysDown();
|
||||
ANIM_FreeAnim();
|
||||
walock[ANIM_TILE(ANIMnum)] = 1;
|
||||
}
|
||||
END_SW_NS
|
||||
|
|
|
@ -633,8 +633,14 @@ void DoTheCache(void)
|
|||
{
|
||||
if ((TEST(gotpic[i>>3], 1<<(i&7))) && (!tilePtr(i)))
|
||||
{
|
||||
tileLoad(i);
|
||||
cnt++;
|
||||
// For the hardware renderer precaching the raw pixel data is pointless.
|
||||
if (videoGetRenderMode() < REND_POLYMOST)
|
||||
tileLoad(i);
|
||||
#ifdef USE_OPENGL
|
||||
/*if (useprecache)*/ PrecacheHardwareTextures(i);
|
||||
#endif
|
||||
|
||||
cnt++;
|
||||
if (!(cnt&7))
|
||||
{
|
||||
AnimateCacheCursor();
|
||||
|
|
|
@ -2676,12 +2676,10 @@ DrawCompass(PLAYERp pp)
|
|||
|
||||
void ScreenTileLock(void)
|
||||
{
|
||||
walock[SAVE_SCREEN_TILE] = CACHE_LOCK_MAX;
|
||||
}
|
||||
|
||||
void ScreenTileUnLock(void)
|
||||
{
|
||||
walock[SAVE_SCREEN_TILE] = CACHE_UNLOCK_MAX;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -5833,9 +5833,6 @@ SHOWSPRITE:
|
|||
|
||||
}
|
||||
|
||||
extern int tilefileoffs[MAXTILES]; //offset into the
|
||||
extern char tilefilenum[MAXTILES]; //0-11
|
||||
|
||||
|
||||
#if RANDOM_DEBUG
|
||||
int
|
||||
|
|
|
@ -666,7 +666,10 @@ int SaveGame(short save_num)
|
|||
MWRITE(palette,sizeof(palette),1,fil);
|
||||
MWRITE(palette_data,sizeof(palette_data),1,fil);
|
||||
MWRITE(&gs,sizeof(gs),1,fil);
|
||||
MWRITE(picanm,sizeof(picanm),1,fil);
|
||||
for (int i = 0; i < MAXTILES; i++)
|
||||
{
|
||||
MWRITE(&picanm[i], sizeof(picanm[i]), 1, fil);
|
||||
}
|
||||
|
||||
MWRITE(&LevelSecrets,sizeof(LevelSecrets),1,fil);
|
||||
|
||||
|
@ -1182,7 +1185,10 @@ int LoadGame(short save_num)
|
|||
|
||||
//COVERsetbrightness(gs.Brightness,(char *)palette_data);
|
||||
|
||||
MREAD(picanm,sizeof(picanm),1,fil);
|
||||
for (int i = 0; i < MAXTILES; i++)
|
||||
{
|
||||
MREAD(&picanm[i], sizeof(picanm[i]), 1, fil);
|
||||
}
|
||||
|
||||
MREAD(&LevelSecrets,sizeof(LevelSecrets),1,fil);
|
||||
|
||||
|
|
Loading…
Reference in a new issue