mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-27 09:20:51 +00:00
- use a local bit array in Blood's precacher.
This commit is contained in:
parent
298949ceb8
commit
5d7a51df9d
12 changed files with 236 additions and 231 deletions
|
@ -354,13 +354,13 @@ void fxSpawnEjectingShell(spritetype *pSprite, int z, int a3, int a4)
|
|||
}
|
||||
}
|
||||
|
||||
void fxPrecache(void)
|
||||
void fxPrecache(HitList &hits)
|
||||
{
|
||||
for (int i = 0; i < kFXMax; i++)
|
||||
{
|
||||
tilePrecacheTile(gFXData[i].at12, 0);
|
||||
tilePrecacheTile(gFXData[i].at12, 0, hits);
|
||||
if (gFXData[i].at2)
|
||||
seqPrecacheId(gFXData[i].at2);
|
||||
seqPrecacheId(gFXData[i].at2, hits);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -102,8 +102,6 @@ void sub_746D4(spritetype *pSprite, int a2);
|
|||
void fxSpawnEjectingBrass(spritetype *pSprite, int z, int a3, int a4);
|
||||
void fxSpawnEjectingShell(spritetype *pSprite, int z, int a3, int a4);
|
||||
|
||||
void fxPrecache(void);
|
||||
|
||||
extern CFX gFX;
|
||||
|
||||
END_BLD_NS
|
||||
|
|
|
@ -511,7 +511,7 @@ void GibWall(int nWall, GIBTYPE nGibType, CGibVelocity *pVel)
|
|||
}
|
||||
}
|
||||
|
||||
void gibPrecache(void)
|
||||
void gibPrecache(HitList &hits)
|
||||
{
|
||||
for (int i = 0; i < kGibMax; i++)
|
||||
{
|
||||
|
@ -521,7 +521,7 @@ void gibPrecache(void)
|
|||
for (int j = 0; j < gibList[i].atc; j++)
|
||||
{
|
||||
if (pThing[j].Kills >= 0)
|
||||
tilePrecacheTile(pThing[j].Kills);
|
||||
tilePrecacheTile(pThing[j].Kills, -1, hits);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,5 +74,4 @@ public:
|
|||
void GibSprite(spritetype *pSprite, GIBTYPE nGibType, CGibPosition *pPos, CGibVelocity *pVel);
|
||||
//void GibFX(int nWall, GIBFX * pGFX, int a3, int a4, int a5, int a6, CGibVelocity * pVel);
|
||||
void GibWall(int nWall, GIBTYPE nGibType, CGibVelocity *pVel);
|
||||
void gibPrecache(void);
|
||||
END_BLD_NS
|
||||
|
|
|
@ -22,11 +22,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
//-------------------------------------------------------------------------
|
||||
#pragma once
|
||||
|
||||
#include "build.h"
|
||||
#include "m_fixed.h"
|
||||
#include "filesystem.h"
|
||||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
using HitList = FixedBitArray<MAXTILES>;
|
||||
|
||||
void playlogos();
|
||||
unsigned int qrand(void);
|
||||
int wrand(void);
|
||||
|
@ -56,7 +59,7 @@ void WeaponProcess(PLAYER *pPlayer);
|
|||
void WeaponUpdateState(PLAYER* pPlayer);
|
||||
void sub_51340(spritetype *pMissile, int a2);
|
||||
void StartQAV(PLAYER* pPlayer, int nWeaponQAV, int a3 = -1, char a4 = 0);
|
||||
void WeaponPrecache(void);
|
||||
void WeaponPrecache(HitList &hits);
|
||||
|
||||
struct ZONE {
|
||||
int x, y, z;
|
||||
|
@ -121,13 +124,12 @@ extern signed char tileShade[MAXTILES];
|
|||
extern short voxelIndex[MAXTILES];
|
||||
|
||||
extern int nPrecacheCount;
|
||||
extern char precachehightile[2][(MAXTILES+7)>>3];
|
||||
|
||||
int tileInit(char a1, const char *a2);
|
||||
void tileProcessGLVoxels(void);
|
||||
void tilePreloadTile(int nTile);
|
||||
void tilePrecacheTile(int nTile, int nType, HitList& hits);
|
||||
|
||||
void tilePrecacheTile(int nTile, int nType = 1);
|
||||
char tileGetSurfType(int hit);
|
||||
|
||||
void scrLoadPalette(void);
|
||||
|
|
|
@ -33,36 +33,139 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
#define gotpic blafasl
|
||||
|
||||
int nPrecacheCount;
|
||||
|
||||
void fxPrecache(HitList &hits);
|
||||
void gibPrecache(HitList &hits);
|
||||
|
||||
|
||||
void tilePreloadTile(int nTile)
|
||||
{
|
||||
if (!r_precache) return;
|
||||
int n = 1;
|
||||
switch (picanm[nTile].extra & 7)
|
||||
{
|
||||
case 0:
|
||||
n = 1;
|
||||
break;
|
||||
case 1:
|
||||
n = 5;
|
||||
break;
|
||||
case 2:
|
||||
n = 8;
|
||||
break;
|
||||
case 3:
|
||||
n = 2;
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
if (voxelIndex[nTile] < 0 || voxelIndex[nTile] >= kMaxVoxels)
|
||||
{
|
||||
voxelIndex[nTile] = -1;
|
||||
picanm[nTile].extra &= ~7;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
while (n--)
|
||||
{
|
||||
if (picanm[nTile].sf & PICANM_ANIMTYPE_MASK)
|
||||
{
|
||||
for (int frame = picanm[nTile].num; frame >= 0; frame--)
|
||||
{
|
||||
if ((picanm[nTile].sf & PICANM_ANIMTYPE_MASK) == PICANM_ANIMTYPE_BACK)
|
||||
PrecacheHardwareTextures(nTile - frame);
|
||||
else
|
||||
PrecacheHardwareTextures(nTile + frame);
|
||||
}
|
||||
}
|
||||
else
|
||||
PrecacheHardwareTextures(nTile);
|
||||
nTile += 1 + picanm[nTile].num;
|
||||
}
|
||||
}
|
||||
|
||||
void tilePrecacheTile(int nTile, int nType, HitList &hits)
|
||||
{
|
||||
int n = 1;
|
||||
switch (picanm[nTile].extra & 7)
|
||||
{
|
||||
case 0:
|
||||
n = 1;
|
||||
break;
|
||||
case 1:
|
||||
n = 5;
|
||||
break;
|
||||
case 2:
|
||||
n = 8;
|
||||
break;
|
||||
case 3:
|
||||
n = 2;
|
||||
break;
|
||||
}
|
||||
while (n--)
|
||||
{
|
||||
if (picanm[nTile].sf & PICANM_ANIMTYPE_MASK)
|
||||
{
|
||||
for (int frame = picanm[nTile].num; frame >= 0; frame--)
|
||||
{
|
||||
int tile;
|
||||
if ((picanm[nTile].sf & PICANM_ANIMTYPE_MASK) == PICANM_ANIMTYPE_BACK)
|
||||
tile = nTile - frame;
|
||||
else
|
||||
tile = nTile + frame;
|
||||
if (!hits[tile])
|
||||
{
|
||||
nPrecacheCount++;
|
||||
hits.Set(tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!hits[nTile])
|
||||
{
|
||||
nPrecacheCount++;
|
||||
hits.Set(nTile);
|
||||
}
|
||||
}
|
||||
nTile += 1 + picanm[nTile].num;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// To do: This needs to handle the sprite palettes as well to properly precache the needed content.
|
||||
|
||||
void viewPrecacheTiles(void)
|
||||
void viewPrecacheTiles(HitList &hits)
|
||||
{
|
||||
tilePrecacheTile(2173, 0);
|
||||
tilePrecacheTile(2200, 0);
|
||||
tilePrecacheTile(2201, 0);
|
||||
tilePrecacheTile(2202, 0);
|
||||
tilePrecacheTile(2207, 0);
|
||||
tilePrecacheTile(2208, 0);
|
||||
tilePrecacheTile(2209, 0);
|
||||
tilePrecacheTile(2229, 0);
|
||||
tilePrecacheTile(2260, 0);
|
||||
tilePrecacheTile(2559, 0);
|
||||
tilePrecacheTile(2169, 0);
|
||||
tilePrecacheTile(2578, 0);
|
||||
tilePrecacheTile(2586, 0);
|
||||
tilePrecacheTile(2602, 0);
|
||||
tilePrecacheTile(2173, 0, hits);
|
||||
tilePrecacheTile(2200, 0, hits);
|
||||
tilePrecacheTile(2201, 0, hits);
|
||||
tilePrecacheTile(2202, 0, hits);
|
||||
tilePrecacheTile(2207, 0, hits);
|
||||
tilePrecacheTile(2208, 0, hits);
|
||||
tilePrecacheTile(2209, 0, hits);
|
||||
tilePrecacheTile(2229, 0, hits);
|
||||
tilePrecacheTile(2260, 0, hits);
|
||||
tilePrecacheTile(2559, 0, hits);
|
||||
tilePrecacheTile(2169, 0, hits);
|
||||
tilePrecacheTile(2578, 0, hits);
|
||||
tilePrecacheTile(2586, 0, hits);
|
||||
tilePrecacheTile(2602, 0, hits);
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
tilePrecacheTile(2190 + i, 0);
|
||||
tilePrecacheTile(2230 + i, 0);
|
||||
tilePrecacheTile(2240 + i, 0);
|
||||
tilePrecacheTile(2250 + i, 0);
|
||||
tilePrecacheTile(kSBarNumberHealth + i, 0);
|
||||
tilePrecacheTile(kSBarNumberAmmo + i, 0);
|
||||
tilePrecacheTile(kSBarNumberInv + i, 0);
|
||||
tilePrecacheTile(kSBarNumberArmor1 + i, 0);
|
||||
tilePrecacheTile(kSBarNumberArmor2 + i, 0);
|
||||
tilePrecacheTile(kSBarNumberArmor3 + i, 0);
|
||||
tilePrecacheTile(2190 + i, 0, hits);
|
||||
tilePrecacheTile(2230 + i, 0, hits);
|
||||
tilePrecacheTile(2240 + i, 0, hits);
|
||||
tilePrecacheTile(2250 + i, 0, hits);
|
||||
tilePrecacheTile(kSBarNumberHealth + i, 0, hits);
|
||||
tilePrecacheTile(kSBarNumberAmmo + i, 0, hits);
|
||||
tilePrecacheTile(kSBarNumberInv + i, 0, hits);
|
||||
tilePrecacheTile(kSBarNumberArmor1 + i, 0, hits);
|
||||
tilePrecacheTile(kSBarNumberArmor2 + i, 0, hits);
|
||||
tilePrecacheTile(kSBarNumberArmor3 + i, 0, hits);
|
||||
}
|
||||
/*
|
||||
for (int i = 0; i < 5; i++)
|
||||
|
@ -73,54 +176,54 @@ void viewPrecacheTiles(void)
|
|||
*/
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
tilePrecacheTile(2220 + i, 0);
|
||||
tilePrecacheTile(2552 + i, 0);
|
||||
tilePrecacheTile(2220 + i, 0, hits);
|
||||
tilePrecacheTile(2552 + i, 0, hits);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PrecacheDude(spritetype *pSprite)
|
||||
void PrecacheDude(spritetype *pSprite, HitList &hits)
|
||||
{
|
||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||
seqPrecacheId(pDudeInfo->seqStartID);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+5);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+1);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+2);
|
||||
seqPrecacheId(pDudeInfo->seqStartID , hits);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+5, hits);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+1, hits);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+2, hits);
|
||||
switch (pSprite->type)
|
||||
{
|
||||
case kDudeCultistTommy:
|
||||
case kDudeCultistShotgun:
|
||||
case kDudeCultistTesla:
|
||||
case kDudeCultistTNT:
|
||||
seqPrecacheId(pDudeInfo->seqStartID+6);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+7);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+8);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+9);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+13);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+14);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+15);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+6 , hits);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+7 , hits);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+8 , hits);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+9 , hits);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+13, hits);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+14, hits);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+15, hits);
|
||||
break;
|
||||
case kDudeZombieButcher:
|
||||
case kDudeGillBeast:
|
||||
seqPrecacheId(pDudeInfo->seqStartID+6);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+7);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+8);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+9);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+10);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+11);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+6, hits);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+7, hits);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+8, hits);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+9, hits);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+10, hits);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+11, hits);
|
||||
break;
|
||||
case kDudeGargoyleStatueFlesh:
|
||||
case kDudeGargoyleStatueStone:
|
||||
seqPrecacheId(pDudeInfo->seqStartID+6);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+6);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+6, hits);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+6, hits); //???
|
||||
fallthrough__;
|
||||
case kDudeGargoyleFlesh:
|
||||
case kDudeGargoyleStone:
|
||||
seqPrecacheId(pDudeInfo->seqStartID+6);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+7);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+8);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+9);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+6, hits);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+7, hits);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+8, hits);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+9, hits);
|
||||
break;
|
||||
case kDudePhantasm:
|
||||
case kDudeHellHound:
|
||||
|
@ -129,88 +232,88 @@ void PrecacheDude(spritetype *pSprite)
|
|||
case kDudeSpiderBlack:
|
||||
case kDudeSpiderMother:
|
||||
case kDudeTchernobog:
|
||||
seqPrecacheId(pDudeInfo->seqStartID+6);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+7);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+8);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+6, hits);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+7, hits);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+8, hits);
|
||||
break;
|
||||
case kDudeCerberusTwoHead:
|
||||
seqPrecacheId(pDudeInfo->seqStartID+6);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+7);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+6, hits);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+7, hits);
|
||||
fallthrough__;
|
||||
case kDudeHand:
|
||||
case kDudeBoneEel:
|
||||
case kDudeBat:
|
||||
case kDudeRat:
|
||||
seqPrecacheId(pDudeInfo->seqStartID+6);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+7);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+6, hits);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+7, hits);
|
||||
break;
|
||||
case kDudeCultistBeast:
|
||||
seqPrecacheId(pDudeInfo->seqStartID+6);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+6, hits);
|
||||
break;
|
||||
case kDudeZombieAxeBuried:
|
||||
seqPrecacheId(pDudeInfo->seqStartID+12);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+9);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+12, hits);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+9, hits);
|
||||
fallthrough__;
|
||||
case kDudeZombieAxeLaying:
|
||||
seqPrecacheId(pDudeInfo->seqStartID+10);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+10, hits);
|
||||
fallthrough__;
|
||||
case kDudeZombieAxeNormal:
|
||||
seqPrecacheId(pDudeInfo->seqStartID+6);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+7);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+8);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+11);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+13);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+14);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+6, hits);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+7, hits);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+8, hits);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+11, hits);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+13, hits);
|
||||
seqPrecacheId(pDudeInfo->seqStartID+14, hits);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void PrecacheThing(spritetype *pSprite) {
|
||||
void PrecacheThing(spritetype *pSprite, HitList &hits) {
|
||||
switch (pSprite->type) {
|
||||
case kThingGlassWindow: // worthless...
|
||||
case kThingFluorescent:
|
||||
seqPrecacheId(12);
|
||||
seqPrecacheId(12, hits);
|
||||
break;
|
||||
case kThingSpiderWeb:
|
||||
seqPrecacheId(15);
|
||||
seqPrecacheId(15, hits);
|
||||
break;
|
||||
case kThingMetalGrate:
|
||||
seqPrecacheId(21);
|
||||
seqPrecacheId(21, hits);
|
||||
break;
|
||||
case kThingFlammableTree:
|
||||
seqPrecacheId(25);
|
||||
seqPrecacheId(26);
|
||||
seqPrecacheId(25, hits);
|
||||
seqPrecacheId(26, hits);
|
||||
break;
|
||||
case kTrapMachinegun:
|
||||
seqPrecacheId(38);
|
||||
seqPrecacheId(40);
|
||||
seqPrecacheId(28);
|
||||
seqPrecacheId(38, hits);
|
||||
seqPrecacheId(40, hits);
|
||||
seqPrecacheId(28, hits);
|
||||
break;
|
||||
case kThingObjectGib:
|
||||
//case kThingObjectExplode: weird that only gib object is precached and this one is not
|
||||
break;
|
||||
}
|
||||
tilePrecacheTile(pSprite->picnum);
|
||||
tilePrecacheTile(pSprite->picnum, -1, hits);
|
||||
}
|
||||
|
||||
void PreloadTiles(void)
|
||||
void PreloadTiles(HitList & hits)
|
||||
{
|
||||
nPrecacheCount = 0;
|
||||
int skyTile = -1;
|
||||
memset(gotpic,0,sizeof(gotpic));
|
||||
hits.Zero();
|
||||
// Fonts
|
||||
for (int i = 0; i < numsectors; i++)
|
||||
{
|
||||
tilePrecacheTile(sector[i].floorpicnum, 0);
|
||||
tilePrecacheTile(sector[i].ceilingpicnum, 0);
|
||||
tilePrecacheTile(sector[i].floorpicnum, 0, hits);
|
||||
tilePrecacheTile(sector[i].ceilingpicnum, 0, hits);
|
||||
if ((sector[i].ceilingstat&1) != 0 && skyTile == -1)
|
||||
skyTile = sector[i].ceilingpicnum;
|
||||
}
|
||||
for (int i = 0; i < numwalls; i++)
|
||||
{
|
||||
tilePrecacheTile(wall[i].picnum, 0);
|
||||
tilePrecacheTile(wall[i].picnum, 0, hits);
|
||||
if (wall[i].overpicnum >= 0)
|
||||
tilePrecacheTile(wall[i].overpicnum, 0);
|
||||
tilePrecacheTile(wall[i].overpicnum, 0, hits);
|
||||
}
|
||||
for (int i = 0; i < kMaxSprites; i++)
|
||||
{
|
||||
|
@ -220,13 +323,13 @@ void PreloadTiles(void)
|
|||
switch (pSprite->statnum)
|
||||
{
|
||||
case kStatDude:
|
||||
PrecacheDude(pSprite);
|
||||
PrecacheDude(pSprite, hits);
|
||||
break;
|
||||
case kStatThing:
|
||||
PrecacheThing(pSprite);
|
||||
PrecacheThing(pSprite, hits);
|
||||
break;
|
||||
default:
|
||||
tilePrecacheTile(pSprite->picnum);
|
||||
tilePrecacheTile(pSprite->picnum, -1, hits);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -235,49 +338,50 @@ void PreloadTiles(void)
|
|||
// Precache common SEQs
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
seqPrecacheId(i);
|
||||
seqPrecacheId(i, hits);
|
||||
}
|
||||
|
||||
tilePrecacheTile(1147); // water drip
|
||||
tilePrecacheTile(1160); // blood drip
|
||||
tilePrecacheTile(1147, -1, hits); // water drip
|
||||
tilePrecacheTile(1160, -1, hits); // blood drip
|
||||
|
||||
// Player SEQs
|
||||
seqPrecacheId(dudeInfo[31].seqStartID+6);
|
||||
seqPrecacheId(dudeInfo[31].seqStartID+7);
|
||||
seqPrecacheId(dudeInfo[31].seqStartID+8);
|
||||
seqPrecacheId(dudeInfo[31].seqStartID+9);
|
||||
seqPrecacheId(dudeInfo[31].seqStartID+10);
|
||||
seqPrecacheId(dudeInfo[31].seqStartID+14);
|
||||
seqPrecacheId(dudeInfo[31].seqStartID+15);
|
||||
seqPrecacheId(dudeInfo[31].seqStartID+12);
|
||||
seqPrecacheId(dudeInfo[31].seqStartID+16);
|
||||
seqPrecacheId(dudeInfo[31].seqStartID+17);
|
||||
seqPrecacheId(dudeInfo[31].seqStartID+18);
|
||||
seqPrecacheId(dudeInfo[31].seqStartID+6, hits);
|
||||
seqPrecacheId(dudeInfo[31].seqStartID+7, hits);
|
||||
seqPrecacheId(dudeInfo[31].seqStartID+8, hits);
|
||||
seqPrecacheId(dudeInfo[31].seqStartID+9, hits);
|
||||
seqPrecacheId(dudeInfo[31].seqStartID+10, hits);
|
||||
seqPrecacheId(dudeInfo[31].seqStartID+14, hits);
|
||||
seqPrecacheId(dudeInfo[31].seqStartID+15, hits);
|
||||
seqPrecacheId(dudeInfo[31].seqStartID+12, hits);
|
||||
seqPrecacheId(dudeInfo[31].seqStartID+16, hits);
|
||||
seqPrecacheId(dudeInfo[31].seqStartID+17, hits);
|
||||
seqPrecacheId(dudeInfo[31].seqStartID+18, hits);
|
||||
|
||||
if (skyTile > -1 && skyTile < kMaxTiles)
|
||||
{
|
||||
for (int i = 1; i < gSkyCount; i++)
|
||||
tilePrecacheTile(skyTile+i, 0);
|
||||
tilePrecacheTile(skyTile+i, 0, hits);
|
||||
}
|
||||
|
||||
WeaponPrecache();
|
||||
viewPrecacheTiles();
|
||||
fxPrecache();
|
||||
gibPrecache();
|
||||
WeaponPrecache(hits);
|
||||
viewPrecacheTiles(hits);
|
||||
fxPrecache(hits);
|
||||
gibPrecache(hits);
|
||||
|
||||
I_GetEvent();
|
||||
}
|
||||
|
||||
void PreloadCache(void)
|
||||
void PreloadCache()
|
||||
{
|
||||
if (!r_precache) return;
|
||||
PreloadTiles();
|
||||
HitList hits;
|
||||
PreloadTiles(hits);
|
||||
int cnt = 0;
|
||||
int percentDisplayed = -1;
|
||||
|
||||
for (int i = 0; i < kMaxTiles; i++)
|
||||
{
|
||||
if (TestBitString(gotpic, i))
|
||||
if (hits[i])
|
||||
{
|
||||
PrecacheHardwareTextures(i);
|
||||
|
||||
|
@ -285,7 +389,6 @@ void PreloadCache(void)
|
|||
I_GetEvent();
|
||||
}
|
||||
}
|
||||
memset(gotpic,0,sizeof(gotpic));
|
||||
}
|
||||
|
||||
END_BLD_NS
|
||||
|
|
|
@ -170,14 +170,14 @@ void QAV::Preload(void)
|
|||
}
|
||||
}
|
||||
|
||||
void QAV::Precache(void)
|
||||
void QAV::Precache(HitList &hits)
|
||||
{
|
||||
for (int i = 0; i < nFrames; i++)
|
||||
{
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
if (frames[i].tiles[j].picnum >= 0)
|
||||
tilePrecacheTile(frames[i].tiles[j].picnum, 0);
|
||||
tilePrecacheTile(frames[i].tiles[j].picnum, 0, hits);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "build.h"
|
||||
#include "common_game.h"
|
||||
#include "blood.h"
|
||||
#include "misc.h"
|
||||
|
||||
class F2DDrawer;
|
||||
|
||||
|
@ -85,7 +86,7 @@ struct QAV
|
|||
void Draw(double x, double y, int ticks, int stat, int shade, int palnum, bool in3dscene);
|
||||
void Play(int, int, int, void *);
|
||||
void Preload(void);
|
||||
void Precache(void);
|
||||
void Precache(HitList &hits);
|
||||
|
||||
void PlaySound(int nSound);
|
||||
void PlaySound3D(spritetype *pSprite, int nSound, int a3, int a4);
|
||||
|
|
|
@ -66,20 +66,20 @@ void Seq::Preload(void)
|
|||
tilePreloadTile(seqGetTile(&frames[i]));
|
||||
}
|
||||
|
||||
void Seq::Precache(void)
|
||||
void Seq::Precache(HitList &hits)
|
||||
{
|
||||
if (memcmp(signature, "SEQ\x1a", 4) != 0)
|
||||
ThrowError("Invalid sequence");
|
||||
if ((version & 0xff00) != 0x300)
|
||||
ThrowError("Obsolete sequence version");
|
||||
for (int i = 0; i < nFrames; i++)
|
||||
tilePrecacheTile(seqGetTile(&frames[i]));
|
||||
tilePrecacheTile(seqGetTile(&frames[i]), -1, hits);
|
||||
}
|
||||
|
||||
void seqPrecacheId(int id)
|
||||
void seqPrecacheId(int id, HitList &hits)
|
||||
{
|
||||
auto pSeq = getSequence(id);
|
||||
if (pSeq) pSeq->Precache();
|
||||
if (pSeq) pSeq->Precache(hits);
|
||||
}
|
||||
|
||||
SEQINST siWall[kMaxXWalls];
|
||||
|
|
|
@ -22,6 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
//-------------------------------------------------------------------------
|
||||
#pragma once
|
||||
|
||||
#include "misc.h"
|
||||
BEGIN_BLD_NS
|
||||
|
||||
|
||||
|
@ -58,7 +59,7 @@ struct Seq {
|
|||
int atc;
|
||||
SEQFRAME frames[1];
|
||||
void Preload(void);
|
||||
void Precache(void);
|
||||
void Precache(HitList &);
|
||||
};
|
||||
|
||||
struct ACTIVE
|
||||
|
@ -84,7 +85,7 @@ inline int seqGetTile(SEQFRAME* pFrame)
|
|||
}
|
||||
|
||||
int seqRegisterClient(void(*pClient)(int, int));
|
||||
void seqPrecacheId(int id);
|
||||
void seqPrecacheId(int id, HitList &hits);
|
||||
SEQINST * GetInstance(int a1, int a2);
|
||||
void UnlockInstance(SEQINST *pInst);
|
||||
void seqSpawn(int a1, int a2, int a3, int a4 = -1);
|
||||
|
|
|
@ -111,105 +111,6 @@ void tileProcessGLVoxels(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
void tilePreloadTile(int nTile)
|
||||
{
|
||||
if (!r_precache) return;
|
||||
int n = 1;
|
||||
switch (picanm[nTile].extra&7)
|
||||
{
|
||||
case 0:
|
||||
n = 1;
|
||||
break;
|
||||
case 1:
|
||||
n = 5;
|
||||
break;
|
||||
case 2:
|
||||
n = 8;
|
||||
break;
|
||||
case 3:
|
||||
n = 2;
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
if (voxelIndex[nTile] < 0 || voxelIndex[nTile] >= kMaxVoxels)
|
||||
{
|
||||
voxelIndex[nTile] = -1;
|
||||
picanm[nTile].extra &= ~7;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
while(n--)
|
||||
{
|
||||
if (picanm[nTile].sf&PICANM_ANIMTYPE_MASK)
|
||||
{
|
||||
for (int frame = picanm[nTile].num; frame >= 0; frame--)
|
||||
{
|
||||
if ((picanm[nTile].sf&PICANM_ANIMTYPE_MASK) == PICANM_ANIMTYPE_BACK)
|
||||
PrecacheHardwareTextures(nTile-frame);
|
||||
else
|
||||
PrecacheHardwareTextures(nTile+frame);
|
||||
}
|
||||
}
|
||||
else
|
||||
PrecacheHardwareTextures(nTile);
|
||||
nTile += 1+picanm[nTile].num;
|
||||
}
|
||||
}
|
||||
|
||||
int nPrecacheCount;
|
||||
char precachehightile[2][(MAXTILES+7)>>3];
|
||||
|
||||
void tilePrecacheTile(int nTile, int nType)
|
||||
{
|
||||
int n = 1;
|
||||
switch (picanm[nTile].extra&7)
|
||||
{
|
||||
case 0:
|
||||
n = 1;
|
||||
break;
|
||||
case 1:
|
||||
n = 5;
|
||||
break;
|
||||
case 2:
|
||||
n = 8;
|
||||
break;
|
||||
case 3:
|
||||
n = 2;
|
||||
break;
|
||||
}
|
||||
while(n--)
|
||||
{
|
||||
if (picanm[nTile].sf&PICANM_ANIMTYPE_MASK)
|
||||
{
|
||||
for (int frame = picanm[nTile].num; frame >= 0; frame--)
|
||||
{
|
||||
int tile;
|
||||
if ((picanm[nTile].sf&PICANM_ANIMTYPE_MASK) == PICANM_ANIMTYPE_BACK)
|
||||
tile = nTile-frame;
|
||||
else
|
||||
tile = nTile+frame;
|
||||
if (!TestBitString(gotpic, tile))
|
||||
{
|
||||
nPrecacheCount++;
|
||||
SetBitString(gotpic, tile);
|
||||
}
|
||||
SetBitString(precachehightile[nType], tile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!TestBitString(gotpic, nTile))
|
||||
{
|
||||
nPrecacheCount++;
|
||||
SetBitString(gotpic, nTile);
|
||||
}
|
||||
SetBitString(precachehightile[nType], nTile);
|
||||
}
|
||||
nTile += 1+picanm[nTile].num;
|
||||
}
|
||||
}
|
||||
|
||||
char tileGetSurfType(int hit)
|
||||
{
|
||||
int n = hit & 0x3fff;
|
||||
|
|
|
@ -223,12 +223,12 @@ void WeaponInit(void)
|
|||
}
|
||||
}
|
||||
|
||||
void WeaponPrecache(void)
|
||||
void WeaponPrecache(HitList &hits)
|
||||
{
|
||||
for (int i = 0; i < kQAVEnd; i++)
|
||||
{
|
||||
if (weaponQAV[i])
|
||||
weaponQAV[i]->Precache();
|
||||
weaponQAV[i]->Precache(hits);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue