mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 17:01:28 +00:00
- quick replacement of some sprite[] accesses.
This commit is contained in:
parent
944b7b8776
commit
fa8edc7493
3 changed files with 41 additions and 36 deletions
|
@ -65,9 +65,10 @@ short nTalkTime = 0;
|
||||||
void InitSpiritHead()
|
void InitSpiritHead()
|
||||||
{
|
{
|
||||||
nPixels = 0;
|
nPixels = 0;
|
||||||
|
auto pSpiritSprite = &sprite[nSpiritSprite];
|
||||||
|
|
||||||
nSpiritRepeatX = sprite[nSpiritSprite].xrepeat;
|
nSpiritRepeatX = pSpiritSprite->xrepeat;
|
||||||
nSpiritRepeatY = sprite[nSpiritSprite].yrepeat;
|
nSpiritRepeatY = pSpiritSprite->yrepeat;
|
||||||
|
|
||||||
tileLoad(kTileRamsesNormal); // Ramses Normal Head
|
tileLoad(kTileRamsesNormal); // Ramses Normal Head
|
||||||
|
|
||||||
|
@ -115,16 +116,16 @@ void InitSpiritHead()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sprite[nSpiritSprite].yrepeat = 140;
|
pSpiritSprite->yrepeat = 140;
|
||||||
sprite[nSpiritSprite].xrepeat = 140;
|
pSpiritSprite->xrepeat = 140;
|
||||||
sprite[nSpiritSprite].picnum = kTileRamsesWorkTile;
|
pSpiritSprite->picnum = kTileRamsesWorkTile;
|
||||||
|
|
||||||
nHeadStage = 0;
|
nHeadStage = 0;
|
||||||
|
|
||||||
// work tile is twice as big as the normal head size
|
// work tile is twice as big as the normal head size
|
||||||
Worktile = TileFiles.tileCreate(kTileRamsesWorkTile, kSpiritY * 2, kSpiritX * 2);
|
Worktile = TileFiles.tileCreate(kTileRamsesWorkTile, kSpiritY * 2, kSpiritX * 2);
|
||||||
|
|
||||||
sprite[nSpiritSprite].cstat &= 0x7FFF;
|
pSpiritSprite->cstat &= 0x7FFF;
|
||||||
|
|
||||||
nHeadTimeStart = PlayClock;
|
nHeadTimeStart = PlayClock;
|
||||||
|
|
||||||
|
@ -196,6 +197,7 @@ void CopyHeadToWorkTile(short nTile)
|
||||||
void DoSpiritHead()
|
void DoSpiritHead()
|
||||||
{
|
{
|
||||||
static short dimSectCount = 0;
|
static short dimSectCount = 0;
|
||||||
|
auto pSpiritSprite = &sprite[nSpiritSprite];
|
||||||
|
|
||||||
sPlayerInput[0].actions |= SB_CENTERVIEW;
|
sPlayerInput[0].actions |= SB_CENTERVIEW;
|
||||||
TileFiles.InvalidateTile(kTileRamsesWorkTile);
|
TileFiles.InvalidateTile(kTileRamsesWorkTile);
|
||||||
|
@ -295,11 +297,11 @@ void DoSpiritHead()
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
UpdateSwirlies();
|
UpdateSwirlies();
|
||||||
if (sprite[nSpiritSprite].shade > -127)
|
if (pSpiritSprite->shade > -127)
|
||||||
sprite[nSpiritSprite].shade--;
|
pSpiritSprite->shade--;
|
||||||
if (--dimSectCount < 0)
|
if (--dimSectCount < 0)
|
||||||
{
|
{
|
||||||
DimSector(sprite[nSpiritSprite].sectnum);
|
DimSector(pSpiritSprite->sectnum);
|
||||||
dimSectCount = 5;
|
dimSectCount = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,17 +381,17 @@ void DoSpiritHead()
|
||||||
|
|
||||||
if (nHeadStage == 1)
|
if (nHeadStage == 1)
|
||||||
{
|
{
|
||||||
if (sprite[nSpiritSprite].xrepeat > nSpiritRepeatX)
|
if (pSpiritSprite->xrepeat > nSpiritRepeatX)
|
||||||
{
|
{
|
||||||
sprite[nSpiritSprite].xrepeat -= 2;
|
pSpiritSprite->xrepeat -= 2;
|
||||||
if (sprite[nSpiritSprite].xrepeat < nSpiritRepeatX)
|
if (pSpiritSprite->xrepeat < nSpiritRepeatX)
|
||||||
sprite[nSpiritSprite].xrepeat = (uint8_t)nSpiritRepeatX;
|
pSpiritSprite->xrepeat = (uint8_t)nSpiritRepeatX;
|
||||||
}
|
}
|
||||||
if (sprite[nSpiritSprite].yrepeat > nSpiritRepeatY)
|
if (pSpiritSprite->yrepeat > nSpiritRepeatY)
|
||||||
{
|
{
|
||||||
sprite[nSpiritSprite].yrepeat -= 2;
|
pSpiritSprite->yrepeat -= 2;
|
||||||
if (sprite[nSpiritSprite].yrepeat < nSpiritRepeatY)
|
if (pSpiritSprite->yrepeat < nSpiritRepeatY)
|
||||||
sprite[nSpiritSprite].yrepeat = (uint8_t)nSpiritRepeatY;
|
pSpiritSprite->yrepeat = (uint8_t)nSpiritRepeatY;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nCount = 0;
|
int nCount = 0;
|
||||||
|
@ -425,9 +427,9 @@ void DoSpiritHead()
|
||||||
|
|
||||||
if (nCount < (15 * nPixels) / 16) {
|
if (nCount < (15 * nPixels) / 16) {
|
||||||
SoundBigEntrance();
|
SoundBigEntrance();
|
||||||
AddGlow(sprite[nSpiritSprite].sectnum, 20);
|
AddGlow(pSpiritSprite->sectnum, 20);
|
||||||
AddFlash(sprite[nSpiritSprite].sectnum, sprite[nSpiritSprite].x, sprite[nSpiritSprite].y,
|
AddFlash(pSpiritSprite->sectnum, pSpiritSprite->x, pSpiritSprite->y,
|
||||||
sprite[nSpiritSprite].z, 128);
|
pSpiritSprite->z, 128);
|
||||||
nHeadStage = 3;
|
nHeadStage = 3;
|
||||||
TintPalette(255, 255, 255);
|
TintPalette(255, 255, 255);
|
||||||
CopyHeadToWorkTile(kTileRamsesNormal);
|
CopyHeadToWorkTile(kTileRamsesNormal);
|
||||||
|
|
|
@ -150,7 +150,8 @@ void BuildSet(short nSprite, int x, int y, int z, short nSector, short nAngle, i
|
||||||
void BuildSoul(int nSet)
|
void BuildSoul(int nSet)
|
||||||
{
|
{
|
||||||
int nSetSprite = SetList[nSet].nSprite;
|
int nSetSprite = SetList[nSet].nSprite;
|
||||||
int nSprite = insertsprite(sprite[nSetSprite].sectnum, 0);
|
auto pSetSprite = &sprite[nSetSprite];
|
||||||
|
int nSprite = insertsprite(pSetSprite->sectnum, 0);
|
||||||
auto pSprite = &sprite[nSprite];
|
auto pSprite = &sprite[nSprite];
|
||||||
|
|
||||||
assert(nSprite >= 0 && nSprite < kMaxSprites);
|
assert(nSprite >= 0 && nSprite < kMaxSprites);
|
||||||
|
@ -168,8 +169,8 @@ void BuildSoul(int nSet)
|
||||||
pSprite->xvel = 0;
|
pSprite->xvel = 0;
|
||||||
pSprite->yvel = 0;
|
pSprite->yvel = 0;
|
||||||
pSprite->zvel = (-256) - RandomSize(10);
|
pSprite->zvel = (-256) - RandomSize(10);
|
||||||
pSprite->x = sprite[nSetSprite].x;
|
pSprite->x = pSetSprite->x;
|
||||||
pSprite->y = sprite[nSetSprite].y;
|
pSprite->y = pSetSprite->y;
|
||||||
|
|
||||||
short nSector = pSprite->sectnum;
|
short nSector = pSprite->sectnum;
|
||||||
pSprite->z = (RandomSize(8) << 8) + 8192 + sector[nSector].ceilingz - GetSpriteHeight(nSprite);
|
pSprite->z = (RandomSize(8) << 8) + 8192 + sector[nSector].ceilingz - GetSpriteHeight(nSprite);
|
||||||
|
@ -205,14 +206,15 @@ void AISoul::Tick(RunListEvent* ev)
|
||||||
{
|
{
|
||||||
int nSet = pSprite->hitag;
|
int nSet = pSprite->hitag;
|
||||||
int nSetSprite = SetList[nSet].nSprite;
|
int nSetSprite = SetList[nSet].nSprite;
|
||||||
|
auto pSetSprite = &sprite[nSetSprite];
|
||||||
|
|
||||||
pSprite->cstat = 0;
|
pSprite->cstat = 0;
|
||||||
pSprite->yrepeat = 1;
|
pSprite->yrepeat = 1;
|
||||||
pSprite->xrepeat = 1;
|
pSprite->xrepeat = 1;
|
||||||
pSprite->x = sprite[nSetSprite].x;
|
pSprite->x = pSetSprite->x;
|
||||||
pSprite->y = sprite[nSetSprite].y;
|
pSprite->y = pSetSprite->y;
|
||||||
pSprite->z = sprite[nSetSprite].z - (GetSpriteHeight(nSetSprite) >> 1);
|
pSprite->z = pSetSprite->z - (GetSpriteHeight(nSetSprite) >> 1);
|
||||||
mychangespritesect(nSprite, sprite[nSetSprite].sectnum);
|
mychangespritesect(nSprite, pSetSprite->sectnum);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,13 +121,14 @@ void BuildSnake(short nPlayer, short zVal)
|
||||||
zVal -= 1280;
|
zVal -= 1280;
|
||||||
|
|
||||||
short nPlayerSprite = PlayerList[nPlayer].nSprite;
|
short nPlayerSprite = PlayerList[nPlayer].nSprite;
|
||||||
|
auto pPlayerSprite = &sprite[nPlayerSprite];
|
||||||
short nViewSect = nPlayerViewSect[nPlayer];
|
short nViewSect = nPlayerViewSect[nPlayer];
|
||||||
short nPic = seq_GetSeqPicnum(kSeqSnakBody, 0, 0);
|
short nPic = seq_GetSeqPicnum(kSeqSnakBody, 0, 0);
|
||||||
|
|
||||||
int x = sprite[nPlayerSprite].x;
|
int x = pPlayerSprite->x;
|
||||||
int y = sprite[nPlayerSprite].y;
|
int y = pPlayerSprite->y;
|
||||||
int z = (sprite[nPlayerSprite].z + zVal) - 2560;
|
int z = (pPlayerSprite->z + zVal) - 2560;
|
||||||
short nAngle = sprite[nPlayerSprite].ang;
|
short nAngle = pPlayerSprite->ang;
|
||||||
|
|
||||||
short hitsect, hitsprite;
|
short hitsect, hitsprite;
|
||||||
int hitx, hity, hitz;
|
int hitx, hity, hitz;
|
||||||
|
@ -136,7 +137,7 @@ void BuildSnake(short nPlayer, short zVal)
|
||||||
|
|
||||||
vec3_t pos = { x, y, z };
|
vec3_t pos = { x, y, z };
|
||||||
hitdata_t hitData;
|
hitdata_t hitData;
|
||||||
hitscan(&pos, sprite[nPlayerSprite].sectnum, bcos(nAngle), bsin(nAngle), 0, &hitData, CLIPMASK1);
|
hitscan(&pos, pPlayerSprite->sectnum, bcos(nAngle), bsin(nAngle), 0, &hitData, CLIPMASK1);
|
||||||
|
|
||||||
hitx = hitData.pos.x;
|
hitx = hitData.pos.x;
|
||||||
hity = hitData.pos.y;
|
hity = hitData.pos.y;
|
||||||
|
@ -199,9 +200,9 @@ void BuildSnake(short nPlayer, short zVal)
|
||||||
|
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
pSprite->x = sprite[nPlayerSprite].x;
|
pSprite->x = pPlayerSprite->x;
|
||||||
pSprite->y = sprite[nPlayerSprite].y;
|
pSprite->y = pPlayerSprite->y;
|
||||||
pSprite->z = sprite[nPlayerSprite].z + zVal;
|
pSprite->z = pPlayerSprite->z + zVal;
|
||||||
pSprite->xrepeat = 32;
|
pSprite->xrepeat = 32;
|
||||||
pSprite->yrepeat = 32;
|
pSprite->yrepeat = 32;
|
||||||
nViewSect = pSprite->sectnum;
|
nViewSect = pSprite->sectnum;
|
||||||
|
@ -222,7 +223,7 @@ void BuildSnake(short nPlayer, short zVal)
|
||||||
pSprite->pal = 0;
|
pSprite->pal = 0;
|
||||||
pSprite->xoffset = 0;
|
pSprite->xoffset = 0;
|
||||||
pSprite->yoffset = 0;
|
pSprite->yoffset = 0;
|
||||||
pSprite->ang = sprite[nPlayerSprite].ang;
|
pSprite->ang = pPlayerSprite->ang;
|
||||||
pSprite->xvel = 0;
|
pSprite->xvel = 0;
|
||||||
pSprite->yvel = 0;
|
pSprite->yvel = 0;
|
||||||
pSprite->zvel = 0;
|
pSprite->zvel = 0;
|
||||||
|
|
Loading…
Reference in a new issue