mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-20 08:00:56 +00:00
- Exhumed: some quick sector[] substitution
This commit is contained in:
parent
a35900362e
commit
ef241acda2
4 changed files with 71 additions and 54 deletions
|
@ -42,23 +42,34 @@ void precache()
|
|||
|
||||
for (i = 0; i < numsectors; i++)
|
||||
{
|
||||
int j = sector[i].ceilingpicnum;
|
||||
markTileForPrecache(j, sector[i].ceilingpal);
|
||||
auto sectp = §or[i];
|
||||
int j = sectp->ceilingpicnum;
|
||||
markTileForPrecache(j, sectp->ceilingpal);
|
||||
if (picanm[j].sf & PICANM_ANIMTYPE_MASK)
|
||||
for (int k = 1; k <= picanm[j].num; k++) markTileForPrecache(j + k, sector[i].ceilingpal);
|
||||
for (int k = 1; k <= picanm[j].num; k++) markTileForPrecache(j + k, sectp->ceilingpal);
|
||||
|
||||
j = sector[i].floorpicnum;
|
||||
markTileForPrecache(j, sector[i].floorpal);
|
||||
j = sectp->floorpicnum;
|
||||
markTileForPrecache(j, sectp->floorpal);
|
||||
if (picanm[j].sf & PICANM_ANIMTYPE_MASK)
|
||||
for (int k = 1; k <= picanm[j].num; k++) markTileForPrecache(j + k, sector[i].floorpal);
|
||||
for (int k = 1; k <= picanm[j].num; k++) markTileForPrecache(j + k, sectp->floorpal);
|
||||
}
|
||||
|
||||
for (i = 0; i < numwalls; i++)
|
||||
{
|
||||
int j = wall[i].picnum;
|
||||
markTileForPrecache(j, wall[i].pal);
|
||||
auto wallp = &wall[i];
|
||||
int j = wallp->picnum;
|
||||
markTileForPrecache(j, wallp->pal);
|
||||
if (picanm[j].sf & PICANM_ANIMTYPE_MASK)
|
||||
for (int k = 1; k <= picanm[j].num; k++) markTileForPrecache(j + k, wall[i].pal);
|
||||
for (int k = 1; k <= picanm[j].num; k++) markTileForPrecache(j + k, wallp->pal);
|
||||
|
||||
if (wallp->nextsector != -1)
|
||||
{
|
||||
int j = wallp->overpicnum;
|
||||
markTileForPrecache(j, wallp->pal);
|
||||
if (picanm[j].sf & PICANM_ANIMTYPE_MASK)
|
||||
for (int k = 1; k <= picanm[j].num; k++) markTileForPrecache(j + k, wallp->pal);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ExhumedSpriteIterator it;
|
||||
|
|
|
@ -848,17 +848,18 @@ void LoadObjects()
|
|||
|
||||
for (int nSector = 0; nSector < numsectors; nSector++)
|
||||
{
|
||||
short hitag = sector[nSector].hitag;
|
||||
short lotag = sector[nSector].lotag;
|
||||
auto sectp = §or[nSector];
|
||||
short hitag = sectp->hitag;
|
||||
short lotag = sectp->lotag;
|
||||
|
||||
sector[nSector].hitag = 0;
|
||||
sector[nSector].lotag = 0;
|
||||
sector[nSector].extra = -1;
|
||||
sectp->hitag = 0;
|
||||
sectp->lotag = 0;
|
||||
sectp->extra = -1;
|
||||
|
||||
if (hitag || lotag)
|
||||
{
|
||||
sector[nSector].lotag = runlist_HeadRun() + 1;
|
||||
sector[nSector].hitag = lotag;
|
||||
sectp->lotag = runlist_HeadRun() + 1;
|
||||
sectp->hitag = lotag;
|
||||
|
||||
runlist_ProcessSectorTag(nSector, lotag, hitag);
|
||||
}
|
||||
|
|
|
@ -215,6 +215,7 @@ void InitLights()
|
|||
void AddFlash(short nSector, int x, int y, int z, int val)
|
||||
{
|
||||
assert(nSector >= 0 && nSector < kMaxSectors);
|
||||
auto sectp = §or[nSector];
|
||||
|
||||
int var_28 = 0;
|
||||
int var_1C = val >> 8;
|
||||
|
@ -230,8 +231,8 @@ void AddFlash(short nSector, int x, int y, int z, int val)
|
|||
|
||||
int var_14 = 0;
|
||||
|
||||
short startwall = sector[nSector].wallptr;
|
||||
short endwall = sector[nSector].wallptr + sector[nSector].wallnum;
|
||||
int startwall = sectp->wallptr;
|
||||
int endwall = sectp->wallptr + sectp->wallnum;
|
||||
|
||||
for (int i = startwall; i < endwall; i++)
|
||||
{
|
||||
|
@ -271,7 +272,7 @@ void AddFlash(short nSector, int x, int y, int z, int val)
|
|||
|
||||
if (wall[i].pal < 5)
|
||||
{
|
||||
if (!pNextSector || pNextSector->floorz < sector[nSector].floorz)
|
||||
if (!pNextSector || pNextSector->floorz < sectp->floorz)
|
||||
{
|
||||
short nFlash = GrabFlash();
|
||||
if (nFlash < 0) {
|
||||
|
@ -302,7 +303,7 @@ void AddFlash(short nSector, int x, int y, int z, int val)
|
|||
}
|
||||
}
|
||||
|
||||
if (var_14 && sector[nSector].floorpal < 4)
|
||||
if (var_14 && sectp->floorpal < 4)
|
||||
{
|
||||
short nFlash = GrabFlash();
|
||||
if (nFlash < 0) {
|
||||
|
@ -311,40 +312,40 @@ void AddFlash(short nSector, int x, int y, int z, int val)
|
|||
|
||||
sFlash[nFlash].nType = var_20 | 1;
|
||||
sFlash[nFlash].nIndex = nSector;
|
||||
sFlash[nFlash].shade = sector[nSector].floorshade;
|
||||
sFlash[nFlash].shade = sectp->floorshade;
|
||||
|
||||
sector[nSector].floorpal += 7;
|
||||
sectp->floorpal += 7;
|
||||
|
||||
int edx = sector[nSector].floorshade + var_28;
|
||||
int edx = sectp->floorshade + var_28;
|
||||
int eax = edx;
|
||||
|
||||
if (edx < -127) {
|
||||
eax = -127;
|
||||
}
|
||||
|
||||
sector[nSector].floorshade = eax;
|
||||
sectp->floorshade = eax;
|
||||
|
||||
if (!(sector[nSector].ceilingstat & 1))
|
||||
if (!(sectp->ceilingstat & 1))
|
||||
{
|
||||
if (sector[nSector].ceilingpal < 4)
|
||||
if (sectp->ceilingpal < 4)
|
||||
{
|
||||
short nFlash2 = GrabFlash();
|
||||
if (nFlash2 >= 0)
|
||||
{
|
||||
sFlash[nFlash2].nType = var_20 | 3;
|
||||
sFlash[nFlash2].nIndex = nSector;
|
||||
sFlash[nFlash2].shade = sector[nSector].ceilingshade;
|
||||
sFlash[nFlash2].shade = sectp->ceilingshade;
|
||||
|
||||
sector[nSector].ceilingpal += 7;
|
||||
sectp->ceilingpal += 7;
|
||||
|
||||
int edx = sector[nSector].ceilingshade + var_28;
|
||||
int edx = sectp->ceilingshade + var_28;
|
||||
int eax = edx;
|
||||
|
||||
if (edx < -127) {
|
||||
eax = -127;
|
||||
}
|
||||
|
||||
sector[nSector].ceilingshade = eax;
|
||||
sectp->ceilingshade = eax;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -588,6 +589,7 @@ void DoGlows()
|
|||
sGlow[i].field_2++;
|
||||
|
||||
short nSector = sGlow[i].nSector;
|
||||
auto sectp = §or[nSector];
|
||||
short nShade = sGlow[i].field_0;
|
||||
|
||||
if (sGlow[i].field_2 >= sGlow[i].field_6)
|
||||
|
@ -596,11 +598,11 @@ void DoGlows()
|
|||
sGlow[i].field_0 = -sGlow[i].field_0;
|
||||
}
|
||||
|
||||
sector[nSector].ceilingshade += nShade;
|
||||
sector[nSector].floorshade += nShade;
|
||||
sectp->ceilingshade += nShade;
|
||||
sectp->floorshade += nShade;
|
||||
|
||||
int startwall = sector[nSector].wallptr;
|
||||
int endwall = startwall + sector[nSector].wallnum - 1;
|
||||
int startwall = sectp->wallptr;
|
||||
int endwall = startwall + sectp->wallnum - 1;
|
||||
|
||||
for (int nWall = startwall; nWall <= endwall; nWall++)
|
||||
{
|
||||
|
@ -621,6 +623,7 @@ void DoFlickers()
|
|||
for (int i = 0; i < nFlickerCount; i++)
|
||||
{
|
||||
short nSector = sFlicker[i].nSector;
|
||||
auto sectp = §or[nSector];
|
||||
|
||||
unsigned int eax = (sFlicker[i].field_4 & 1);
|
||||
unsigned int edx = (sFlicker[i].field_4 & 1) << 31;
|
||||
|
@ -644,11 +647,11 @@ void DoFlickers()
|
|||
shade = -sFlicker[i].field_0;
|
||||
}
|
||||
|
||||
sector[nSector].ceilingshade += shade;
|
||||
sector[nSector].floorshade += shade;
|
||||
sectp->ceilingshade += shade;
|
||||
sectp->floorshade += shade;
|
||||
|
||||
int startwall = sector[nSector].wallptr;
|
||||
int endwall = startwall + sector[nSector].wallnum - 1;
|
||||
int startwall = sectp->wallptr;
|
||||
int endwall = startwall + sectp->wallnum - 1;
|
||||
|
||||
for (int nWall = endwall; nWall >= startwall; nWall--)
|
||||
{
|
||||
|
|
|
@ -30,13 +30,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_PS_NS
|
||||
|
||||
short NearSector[kMaxSectors] = { 0 };
|
||||
int NearSector[kMaxSectors] = { 0 };
|
||||
|
||||
short nPushBlocks;
|
||||
|
||||
// TODO - moveme?
|
||||
short overridesect;
|
||||
short NearCount = -1;
|
||||
int NearCount = -1;
|
||||
|
||||
DExhumedActor* nBodySprite[50];
|
||||
|
||||
|
@ -851,11 +851,12 @@ int GrabPushBlock()
|
|||
|
||||
void CreatePushBlock(int nSector)
|
||||
{
|
||||
auto sectp = §or[nSector];
|
||||
int nBlock = GrabPushBlock();
|
||||
int i;
|
||||
|
||||
int startwall = sector[nSector].wallptr;
|
||||
int nWalls = sector[nSector].wallnum;
|
||||
int startwall = sectp->wallptr;
|
||||
int nWalls = sectp->wallnum;
|
||||
|
||||
int xSum = 0;
|
||||
int ySum = 0;
|
||||
|
@ -879,7 +880,7 @@ void CreatePushBlock(int nSector)
|
|||
|
||||
pSprite->x = xAvg;
|
||||
pSprite->y = yAvg;
|
||||
pSprite->z = sector[nSector].floorz - 256;
|
||||
pSprite->z = sectp->floorz - 256;
|
||||
pSprite->cstat = 0x8000;
|
||||
|
||||
int var_28 = 0;
|
||||
|
@ -906,7 +907,7 @@ void CreatePushBlock(int nSector)
|
|||
sBlockInfo[nBlock].field_8 = var_28;
|
||||
|
||||
pSprite->clipdist = (var_28 & 0xFF) << 2;
|
||||
sector[nSector].extra = nBlock;
|
||||
sectp->extra = nBlock;
|
||||
}
|
||||
|
||||
void MoveSector(short nSector, int nAngle, int *nXVel, int *nYVel)
|
||||
|
@ -928,14 +929,15 @@ void MoveSector(short nSector, int nAngle, int *nXVel, int *nYVel)
|
|||
nXVect = bcos(nAngle, 6);
|
||||
nYVect = bsin(nAngle, 6);
|
||||
}
|
||||
sectortype *pSector = §or[nSector];
|
||||
|
||||
short nBlock = sector[nSector].extra;
|
||||
|
||||
short nBlock = pSector->extra;
|
||||
short nSectFlag = SectFlag[nSector];
|
||||
|
||||
sectortype *pSector = §or[nSector];
|
||||
int nFloorZ = sector[nSector].floorz;
|
||||
int startwall = sector[nSector].wallptr;
|
||||
int nWalls = sector[nSector].wallnum;
|
||||
int nFloorZ = pSector->floorz;
|
||||
int startwall = pSector->wallptr;
|
||||
int nWalls = pSector->wallnum;
|
||||
|
||||
walltype *pStartWall = &wall[startwall];
|
||||
short nNextSector = wall[startwall].nextsector;
|
||||
|
@ -958,17 +960,17 @@ void MoveSector(short nSector, int nAngle, int *nXVel, int *nYVel)
|
|||
|
||||
if (nSectFlag & kSectUnderwater)
|
||||
{
|
||||
nZVal = sector[nSector].ceilingz;
|
||||
nZVal = pSector->ceilingz;
|
||||
pos.z = sector[nNextSector].ceilingz + 256;
|
||||
|
||||
sector[nSector].ceilingz = sector[nNextSector].ceilingz;
|
||||
pSector->ceilingz = sector[nNextSector].ceilingz;
|
||||
}
|
||||
else
|
||||
{
|
||||
nZVal = sector[nSector].floorz;
|
||||
nZVal = pSector->floorz;
|
||||
pos.z = sector[nNextSector].floorz - 256;
|
||||
|
||||
sector[nSector].floorz = sector[nNextSector].floorz;
|
||||
pSector->floorz = sector[nNextSector].floorz;
|
||||
}
|
||||
|
||||
clipmove(&pos, &nSectorB, nXVect, nYVect, pBlockInfo->field_8, 0, 0, CLIPMASK1);
|
||||
|
|
Loading…
Reference in a new issue