Precache more tiles on level start

# Conflicts:
#	source/blood/src/fx.cpp
#	source/blood/src/gib.cpp
#	source/blood/src/gib.h
#	source/blood/src/qav.cpp
#	source/blood/src/weapon.h
This commit is contained in:
nukeykt 2020-01-02 20:01:18 +09:00 committed by Christoph Oelckers
parent 7af92bb327
commit 2e085b559f
12 changed files with 125 additions and 24 deletions

View file

@ -43,6 +43,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "eventq.h"
#include "fire.h"
#include "fx.h"
#include "gib.h"
#include "getopt.h"
#include "globals.h"
#include "levels.h"
@ -291,14 +292,8 @@ void PrecacheThing(spritetype *pSprite) {
case kThingObjectGib:
//case kThingObjectExplode: weird that only gib object is precached and this one is not
break;
default:
tilePreloadTile(pSprite->picnum);
break;
}
seqPrecacheId(3);
seqPrecacheId(4);
seqPrecacheId(5);
seqPrecacheId(9);
tilePrecacheTile(pSprite->picnum);
}
void PreloadTiles(void)
@ -345,25 +340,40 @@ void PreloadTiles(void)
}
}
}
if (numplayers > 1)
// Precache common SEQs
for (int i = 0; i < 100; i++)
{
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(i);
}
tilePrecacheTile(1147); // water drip
tilePrecacheTile(1160); // 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);
if (skyTile > -1 && skyTile < kMaxTiles)
{
for (int i = 1; i < gSkyCount; i++)
tilePrecacheTile(skyTile+i, 0);
}
WeaponPrecache();
viewPrecacheTiles();
fxPrecache();
gibPrecache();
gameHandleEvents();
}

View file

@ -36,6 +36,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gameutil.h"
#include "levels.h"
#include "seq.h"
#include "tile.h"
#include "trig.h"
#include "view.h"
@ -355,4 +356,14 @@ void fxSpawnEjectingShell(spritetype *pSprite, int z, int a3, int a4)
}
}
void fxPrecache(void)
{
for (int i = 0; i < kFXMax; i++)
{
tilePrecacheTile(gFXData[i].at12, 0);
if (gFXData[i].at2)
seqPrecacheId(gFXData[i].at2);
}
}
END_BLD_NS

View file

@ -102,6 +102,8 @@ 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

View file

@ -37,6 +37,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gib.h"
#include "levels.h"
#include "sfx.h"
#include "tile.h"
#include "trig.h"
BEGIN_BLD_NS
@ -512,4 +513,18 @@ void GibWall(int nWall, GIBTYPE nGibType, CGibVelocity *pVel)
}
}
END_BLD_NS
void gibPrecache(void)
{
for (int i = 0; i < kGibMax; i++)
{
auto const pThing = gibList[i].at8;
if (pThing)
{
for (int j = 0; j < gibList[i].atc; j++)
{
if (pThing[j].at4 >= 0)
tilePrecacheTile(pThing[j].at4);
}
}
}
}

View file

@ -74,5 +74,5 @@ 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

View file

@ -145,4 +145,14 @@ void QAV::Preload(void)
}
}
END_BLD_NS
void QAV::Precache(void)
{
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);
}
}
}

View file

@ -82,6 +82,7 @@ struct QAV
void Draw(int ticks, int stat, int shade, int palnum);
void Play(int, int, int, void *);
void Preload(void);
void Precache(void);
void PlaySound(int nSound);
void PlaySound3D(spritetype *pSprite, int nSound, int a3, int a4);

View file

@ -156,7 +156,7 @@ uint8_t * tileAllocTile(int nTile, int x, int y, int ox, int oy)
void tilePreloadTile(int nTile)
{
int n = 0;
int n = 1;
switch (picanm[nTile].extra&7)
{
case 0:
@ -205,7 +205,7 @@ char precachehightile[2][(MAXTILES+7)>>3];
void tilePrecacheTile(int nTile, int nType)
{
int n = 0;
int n = 1;
switch (picanm[nTile].extra&7)
{
case 0:

View file

@ -1715,6 +1715,47 @@ void UpdateStatusBar(ClockTicks arg)
}
}
void viewPrecacheTiles(void)
{
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);
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);
}
for (int i = 0; i < 5; i++)
{
tilePrecacheTile(gPackIcons[i], 0);
tilePrecacheTile(gPackIcons2[i].nTile, 0);
}
for (int i = 0; i < 6; i++)
{
tilePrecacheTile(2220 + i, 0);
tilePrecacheTile(2552 + i, 0);
}
}
int *lensTable;
int gZoom = 1024;

View file

@ -153,6 +153,7 @@ void viewUpdateShake(void);
void viewSetCrosshairColor(int32_t r, int32_t g, int32_t b);
void viewResetCrosshairToDefault(void);
void viewSetSystemMessage(const char* pMessage, ...);
void viewPrecacheTiles(void);
inline void viewInterpolateSector(int nSector, sectortype *pSector)
{

View file

@ -228,6 +228,15 @@ void WeaponInit(void)
}
}
void WeaponPrecache(void)
{
for (int i = 0; i < kQAVEnd; i++)
{
if (weaponQAV[i])
weaponQAV[i]->Precache();
}
}
void WeaponDraw(PLAYER *pPlayer, int a2, int a3, int a4, int a5)
{
dassert(pPlayer != NULL);

View file

@ -40,4 +40,5 @@ 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);
END_BLD_NS