mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-15 04:00:53 +00:00
- all Blood stat iterators ported.
This commit is contained in:
parent
33164694b9
commit
eb78b88598
20 changed files with 248 additions and 126 deletions
|
@ -5471,7 +5471,7 @@ void actProcessSprites(void)
|
||||||
StatIterator it1(kStatDude);
|
StatIterator it1(kStatDude);
|
||||||
while ((nSprite2 = it1.NextIndex()) >= 0)
|
while ((nSprite2 = it1.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
nNextSprite = nextspritestat[nSprite2];
|
nNextSprite = it1.PeekIndex();
|
||||||
spritetype *pSprite2 = &sprite[nSprite2];
|
spritetype *pSprite2 = &sprite[nSprite2];
|
||||||
|
|
||||||
if (pSprite2->flags&32) continue;
|
if (pSprite2->flags&32) continue;
|
||||||
|
@ -5936,7 +5936,7 @@ void actProcessSprites(void)
|
||||||
StatIterator it1(kStatDude);
|
StatIterator it1(kStatDude);
|
||||||
while ((nSprite2 = it1.NextIndex()) >= 0)
|
while ((nSprite2 = it1.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
nNextSprite = nextspritestat[nSprite2];
|
nNextSprite = it1.PeekIndex();
|
||||||
spritetype *pSprite2 = &sprite[nSprite2];
|
spritetype *pSprite2 = &sprite[nSprite2];
|
||||||
|
|
||||||
if (pSprite2->flags&32)
|
if (pSprite2->flags&32)
|
||||||
|
|
|
@ -1418,7 +1418,10 @@ void sub_5F15C(spritetype *pSprite, XSPRITE *pXSprite)
|
||||||
gAffectedSectors[0] = 0;
|
gAffectedSectors[0] = 0;
|
||||||
gAffectedXWalls[0] = 0;
|
gAffectedXWalls[0] = 0;
|
||||||
GetClosestSpriteSectors(pSprite->sectnum, pSprite->x, pSprite->y, 400, gAffectedSectors, va4, gAffectedXWalls);
|
GetClosestSpriteSectors(pSprite->sectnum, pSprite->x, pSprite->y, 400, gAffectedSectors, va4, gAffectedXWalls);
|
||||||
for (int nSprite2 = headspritestat[kStatDude]; nSprite2 >= 0; nSprite2 = nextspritestat[nSprite2])
|
|
||||||
|
int nSprite2;
|
||||||
|
StatIterator it(kStatDude);
|
||||||
|
while ((nSprite2 = it.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
spritetype *pSprite2 = &sprite[nSprite2];
|
spritetype *pSprite2 = &sprite[nSprite2];
|
||||||
int dx = pSprite2->x-pSprite->x;
|
int dx = pSprite2->x-pSprite->x;
|
||||||
|
@ -1439,7 +1442,10 @@ void sub_5F15C(spritetype *pSprite, XSPRITE *pXSprite)
|
||||||
}
|
}
|
||||||
|
|
||||||
void aiProcessDudes(void) {
|
void aiProcessDudes(void) {
|
||||||
for (int nSprite = headspritestat[kStatDude]; nSprite >= 0; nSprite = nextspritestat[nSprite]) {
|
int nSprite;
|
||||||
|
StatIterator it(kStatDude);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
|
{
|
||||||
spritetype *pSprite = &sprite[nSprite];
|
spritetype *pSprite = &sprite[nSprite];
|
||||||
if (pSprite->flags & 32) continue;
|
if (pSprite->flags & 32) continue;
|
||||||
int nXSprite = pSprite->extra;
|
int nXSprite = pSprite->extra;
|
||||||
|
@ -1491,7 +1497,9 @@ void aiProcessDudes(void) {
|
||||||
|
|
||||||
void aiInit(void)
|
void aiInit(void)
|
||||||
{
|
{
|
||||||
for (int nSprite = headspritestat[kStatDude]; nSprite >= 0; nSprite = nextspritestat[nSprite])
|
int nSprite;
|
||||||
|
StatIterator it(kStatDude);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
aiInitSprite(&sprite[nSprite]);
|
aiInitSprite(&sprite[nSprite]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,9 @@ static void StompSeqCallback(int, int nXSprite)
|
||||||
v4 = 0;
|
v4 = 0;
|
||||||
}
|
}
|
||||||
vc <<= 4;
|
vc <<= 4;
|
||||||
for (int nSprite2 = headspritestat[kStatDude]; nSprite2 >= 0; nSprite2 = nextspritestat[nSprite2])
|
int nSprite2;
|
||||||
|
StatIterator it1(kStatDude);
|
||||||
|
while ((nSprite2 = it1.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
if (nSprite != nSprite2 || v4)
|
if (nSprite != nSprite2 || v4)
|
||||||
{
|
{
|
||||||
|
@ -161,7 +163,8 @@ static void StompSeqCallback(int, int nXSprite)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int nSprite2 = headspritestat[kStatThing]; nSprite2 >= 0; nSprite2 = nextspritestat[nSprite2])
|
it1.Reset(kStatThing);
|
||||||
|
while ((nSprite2 = it1.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
spritetype *pSprite2 = &sprite[nSprite2];
|
spritetype *pSprite2 = &sprite[nSprite2];
|
||||||
if (pSprite2->flags&32)
|
if (pSprite2->flags&32)
|
||||||
|
|
|
@ -118,7 +118,9 @@ static void cerberusBurnSeqCallback(int, int nXSprite)
|
||||||
aim.dy = SinScale16(pSprite->ang);
|
aim.dy = SinScale16(pSprite->ang);
|
||||||
aim.dz = gDudeSlope[nXSprite];
|
aim.dz = gDudeSlope[nXSprite];
|
||||||
int nClosest = 0x7fffffff;
|
int nClosest = 0x7fffffff;
|
||||||
for (short nSprite2 = headspritestat[kStatDude]; nSprite2 >= 0; nSprite2 = nextspritestat[nSprite2])
|
int nSprite2;
|
||||||
|
StatIterator it(kStatDude);
|
||||||
|
while ((nSprite2 = it.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
spritetype *pSprite2 = &sprite[nSprite2];
|
spritetype *pSprite2 = &sprite[nSprite2];
|
||||||
if (pSprite == pSprite2 || !(pSprite2->flags&8))
|
if (pSprite == pSprite2 || !(pSprite2->flags&8))
|
||||||
|
@ -202,7 +204,9 @@ static void cerberusBurnSeqCallback2(int, int nXSprite)
|
||||||
aim.dz = gDudeSlope[nXSprite];
|
aim.dz = gDudeSlope[nXSprite];
|
||||||
az = 0;
|
az = 0;
|
||||||
int nClosest = 0x7fffffff;
|
int nClosest = 0x7fffffff;
|
||||||
for (short nSprite2 = headspritestat[kStatDude]; nSprite2 >= 0; nSprite2 = nextspritestat[nSprite2])
|
int nSprite2;
|
||||||
|
StatIterator it(kStatDude);
|
||||||
|
while ((nSprite2 = it.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
spritetype *pSprite2 = &sprite[nSprite2];
|
spritetype *pSprite2 = &sprite[nSprite2];
|
||||||
if (pSprite == pSprite2 || !(pSprite2->flags&8))
|
if (pSprite == pSprite2 || !(pSprite2->flags&8))
|
||||||
|
|
|
@ -147,7 +147,9 @@ static void BlastSSeqCallback(int, int nXSprite)
|
||||||
aim.dy = SinScale16(pSprite->ang);
|
aim.dy = SinScale16(pSprite->ang);
|
||||||
aim.dz = gDudeSlope[nXSprite];
|
aim.dz = gDudeSlope[nXSprite];
|
||||||
int nClosest = 0x7fffffff;
|
int nClosest = 0x7fffffff;
|
||||||
for (short nSprite2 = headspritestat[kStatDude]; nSprite2 >= 0; nSprite2 = nextspritestat[nSprite2])
|
int nSprite2;
|
||||||
|
StatIterator it(kStatDude);
|
||||||
|
while ((nSprite2 = it.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
spritetype *pSprite2 = &sprite[nSprite2];
|
spritetype *pSprite2 = &sprite[nSprite2];
|
||||||
if (pSprite == pSprite2 || !(pSprite2->flags&8))
|
if (pSprite == pSprite2 || !(pSprite2->flags&8))
|
||||||
|
|
|
@ -130,7 +130,9 @@ static void ghostBlastSeqCallback(int, int nXSprite)
|
||||||
aim.dy = SinScale16(pSprite->ang);
|
aim.dy = SinScale16(pSprite->ang);
|
||||||
aim.dz = gDudeSlope[nXSprite];
|
aim.dz = gDudeSlope[nXSprite];
|
||||||
int nClosest = 0x7fffffff;
|
int nClosest = 0x7fffffff;
|
||||||
for (short nSprite2 = headspritestat[kStatDude]; nSprite2 >= 0; nSprite2 = nextspritestat[nSprite2])
|
int nSprite2;
|
||||||
|
StatIterator it(kStatDude);
|
||||||
|
while ((nSprite2 = it.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
spritetype *pSprite2 = &sprite[nSprite2];
|
spritetype *pSprite2 = &sprite[nSprite2];
|
||||||
if (pSprite == pSprite2 || !(pSprite2->flags&8))
|
if (pSprite == pSprite2 || !(pSprite2->flags&8))
|
||||||
|
|
|
@ -102,7 +102,9 @@ static void sub_71BD4(int, int nXSprite)
|
||||||
aim.dy = SinScale16(pSprite->ang);
|
aim.dy = SinScale16(pSprite->ang);
|
||||||
aim.dz = gDudeSlope[nXSprite];
|
aim.dz = gDudeSlope[nXSprite];
|
||||||
int nClosest = 0x7fffffff;
|
int nClosest = 0x7fffffff;
|
||||||
for (short nSprite2 = headspritestat[kStatDude]; nSprite2 >= 0; nSprite2 = nextspritestat[nSprite2])
|
int nSprite2;
|
||||||
|
StatIterator it(kStatDude);
|
||||||
|
while ((nSprite2 = it.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
spritetype *pSprite2 = &sprite[nSprite2];
|
spritetype *pSprite2 = &sprite[nSprite2];
|
||||||
if (pSprite == pSprite2 || !(pSprite2->flags&8))
|
if (pSprite == pSprite2 || !(pSprite2->flags&8))
|
||||||
|
@ -180,7 +182,9 @@ static void sub_720AC(int, int nXSprite)
|
||||||
aim.dz = gDudeSlope[nXSprite];
|
aim.dz = gDudeSlope[nXSprite];
|
||||||
int nClosest = 0x7fffffff;
|
int nClosest = 0x7fffffff;
|
||||||
az = 0;
|
az = 0;
|
||||||
for (short nSprite2 = headspritestat[kStatDude]; nSprite2 >= 0; nSprite2 = nextspritestat[nSprite2])
|
int nSprite2;
|
||||||
|
StatIterator it(kStatDude);
|
||||||
|
while ((nSprite2 = it.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
spritetype *pSprite2 = &sprite[nSprite2];
|
spritetype *pSprite2 = &sprite[nSprite2];
|
||||||
if (pSprite == pSprite2 || !(pSprite2->flags&8))
|
if (pSprite == pSprite2 || !(pSprite2->flags&8))
|
||||||
|
|
|
@ -1194,7 +1194,10 @@ spritetype* leechIsDropped(spritetype* pSprite) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeDudeStuff(spritetype* pSprite) {
|
void removeDudeStuff(spritetype* pSprite) {
|
||||||
for (short nSprite = headspritestat[kStatThing]; nSprite >= 0; nSprite = nextspritestat[nSprite]) {
|
int nSprite;
|
||||||
|
StatIterator it(kStatThing);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
|
{
|
||||||
if (sprite[nSprite].owner != pSprite->index) continue;
|
if (sprite[nSprite].owner != pSprite->index) continue;
|
||||||
switch (sprite[nSprite].type) {
|
switch (sprite[nSprite].type) {
|
||||||
case kThingArmedProxBomb:
|
case kThingArmedProxBomb:
|
||||||
|
@ -1209,7 +1212,9 @@ void removeDudeStuff(spritetype* pSprite) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (short nSprite = headspritestat[kStatDude]; nSprite >= 0; nSprite = nextspritestat[nSprite]) {
|
it.Reset(kStatDude);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
|
{
|
||||||
if (sprite[nSprite].owner != pSprite->index) continue;
|
if (sprite[nSprite].owner != pSprite->index) continue;
|
||||||
actDamageSprite(sprite[nSprite].owner, &sprite[nSprite], (DAMAGE_TYPE) 0, 65535);
|
actDamageSprite(sprite[nSprite].owner, &sprite[nSprite], (DAMAGE_TYPE) 0, 65535);
|
||||||
}
|
}
|
||||||
|
@ -2126,7 +2131,10 @@ bool genDudePrepare(spritetype* pSprite, int propId) {
|
||||||
case kGenDudePropertyLeech:
|
case kGenDudePropertyLeech:
|
||||||
pExtra->nLifeLeech = -1;
|
pExtra->nLifeLeech = -1;
|
||||||
if (pSprite->owner != kMaxSprites - 1) {
|
if (pSprite->owner != kMaxSprites - 1) {
|
||||||
for (int nSprite = headspritestat[kStatThing]; nSprite >= 0; nSprite = nextspritestat[nSprite]) {
|
int nSprite;
|
||||||
|
StatIterator it(kStatThing);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
|
{
|
||||||
if (sprite[nSprite].owner == pSprite->index && sprite[nSprite].type == kModernThingEnemyLifeLeech) {
|
if (sprite[nSprite].owner == pSprite->index && sprite[nSprite].type == kModernThingEnemyLifeLeech) {
|
||||||
pExtra->nLifeLeech = nSprite;
|
pExtra->nLifeLeech = nSprite;
|
||||||
break;
|
break;
|
||||||
|
@ -2137,8 +2145,12 @@ bool genDudePrepare(spritetype* pSprite, int propId) {
|
||||||
fallthrough__;
|
fallthrough__;
|
||||||
|
|
||||||
case kGenDudePropertySlaves:
|
case kGenDudePropertySlaves:
|
||||||
|
{
|
||||||
pExtra->slaveCount = 0; memset(pExtra->slave, -1, sizeof(pExtra->slave));
|
pExtra->slaveCount = 0; memset(pExtra->slave, -1, sizeof(pExtra->slave));
|
||||||
for (int nSprite = headspritestat[kStatDude]; nSprite >= 0; nSprite = nextspritestat[nSprite]) {
|
int nSprite;
|
||||||
|
StatIterator it(kStatDude);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
|
{
|
||||||
if (sprite[nSprite].owner != pSprite->index) continue;
|
if (sprite[nSprite].owner != pSprite->index) continue;
|
||||||
else if (!IsDudeSprite(&sprite[nSprite]) || !xspriRangeIsFine(sprite[nSprite].extra) || xsprite[sprite[nSprite].extra].health <= 0) {
|
else if (!IsDudeSprite(&sprite[nSprite]) || !xspriRangeIsFine(sprite[nSprite].extra) || xsprite[sprite[nSprite].extra].health <= 0) {
|
||||||
sprite[nSprite].owner = -1;
|
sprite[nSprite].owner = -1;
|
||||||
|
@ -2151,7 +2163,7 @@ bool genDudePrepare(spritetype* pSprite, int propId) {
|
||||||
}
|
}
|
||||||
if (propId) break;
|
if (propId) break;
|
||||||
fallthrough__;
|
fallthrough__;
|
||||||
|
}
|
||||||
case kGenDudePropertySpriteSize: {
|
case kGenDudePropertySpriteSize: {
|
||||||
if (seqGetStatus(3, pSprite->extra) == -1)
|
if (seqGetStatus(3, pSprite->extra) == -1)
|
||||||
seqSpawn(pXSprite->data2 + pXSprite->aiState->seqId, 3, pSprite->extra, -1);
|
seqSpawn(pXSprite->data2 + pXSprite->aiState->seqId, 3, pSprite->extra, -1);
|
||||||
|
|
|
@ -52,7 +52,9 @@ void ambProcess(void)
|
||||||
{
|
{
|
||||||
if (!SoundEnabled())
|
if (!SoundEnabled())
|
||||||
return;
|
return;
|
||||||
for (int nSprite = headspritestat[kStatAmbience]; nSprite >= 0; nSprite = nextspritestat[nSprite])
|
int nSprite;
|
||||||
|
StatIterator it(kStatAmbience);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
spritetype *pSprite = &sprite[nSprite];
|
spritetype *pSprite = &sprite[nSprite];
|
||||||
if (pSprite->owner < 0 || pSprite->owner >= kMaxAmbChannel)
|
if (pSprite->owner < 0 || pSprite->owner >= kMaxAmbChannel)
|
||||||
|
@ -114,7 +116,10 @@ void ambInit(void)
|
||||||
{
|
{
|
||||||
ambKillAll();
|
ambKillAll();
|
||||||
memset(ambChannels, 0, sizeof(ambChannels));
|
memset(ambChannels, 0, sizeof(ambChannels));
|
||||||
for (int nSprite = headspritestat[kStatAmbience]; nSprite >= 0; nSprite = nextspritestat[nSprite]) {
|
int nSprite;
|
||||||
|
StatIterator it(kStatAmbience);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
|
{
|
||||||
if (sprite[nSprite].extra <= 0 || sprite[nSprite].extra >= kMaxXSprites) continue;
|
if (sprite[nSprite].extra <= 0 || sprite[nSprite].extra >= kMaxXSprites) continue;
|
||||||
|
|
||||||
XSPRITE *pXSprite = &xsprite[sprite[nSprite].extra];
|
XSPRITE *pXSprite = &xsprite[sprite[nSprite].extra];
|
||||||
|
|
|
@ -639,10 +639,11 @@ void DropVoodooCb(int nSprite) // unused
|
||||||
evPost(nSprite, 3, 0, kCallbackRemove);
|
evPost(nSprite, 3, 0, kCallbackRemove);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int nSprite2, nNextSprite;
|
int nSprite2;
|
||||||
for (nSprite2 = headspritestat[kStatDude]; nSprite2 >= 0; nSprite2 = nNextSprite)
|
StatIterator it(kStatDude);
|
||||||
|
while ((nSprite2 = it.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
nNextSprite = nextspritestat[nSprite2];
|
int nNextSprite = it.PeekIndex();
|
||||||
if (nOwner == nSprite2)
|
if (nOwner == nSprite2)
|
||||||
continue;
|
continue;
|
||||||
spritetype *pSprite2 = &sprite[nSprite2];
|
spritetype *pSprite2 = &sprite[nSprite2];
|
||||||
|
|
|
@ -219,7 +219,9 @@ void CKillMgr::AddKill(spritetype* pSprite)
|
||||||
void CKillMgr::CountTotalKills(void)
|
void CKillMgr::CountTotalKills(void)
|
||||||
{
|
{
|
||||||
TotalKills = 0;
|
TotalKills = 0;
|
||||||
for (int nSprite = headspritestat[kStatDude]; nSprite >= 0; nSprite = nextspritestat[nSprite])
|
int nSprite;
|
||||||
|
StatIterator it(kStatDude);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
spritetype* pSprite = &sprite[nSprite];
|
spritetype* pSprite = &sprite[nSprite];
|
||||||
if (pSprite->type < kDudeBase || pSprite->type >= kDudeMax)
|
if (pSprite->type < kDudeBase || pSprite->type >= kDudeMax)
|
||||||
|
|
|
@ -405,7 +405,10 @@ void evSend(int nIndex, int nType, int rxId, COMMAND_ID command)
|
||||||
case kChannelRemoteBomb5:
|
case kChannelRemoteBomb5:
|
||||||
case kChannelRemoteBomb6:
|
case kChannelRemoteBomb6:
|
||||||
case kChannelRemoteBomb7:
|
case kChannelRemoteBomb7:
|
||||||
for (int nSprite = headspritestat[kStatThing]; nSprite >= 0; nSprite = nextspritestat[nSprite])
|
{
|
||||||
|
int nSprite;
|
||||||
|
StatIterator it(kStatThing);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
spritetype* pSprite = &sprite[nSprite];
|
spritetype* pSprite = &sprite[nSprite];
|
||||||
if (pSprite->flags & 32)
|
if (pSprite->flags & 32)
|
||||||
|
@ -419,9 +422,13 @@ void evSend(int nIndex, int nType, int rxId, COMMAND_ID command)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
case kChannelTeamAFlagCaptured:
|
case kChannelTeamAFlagCaptured:
|
||||||
case kChannelTeamBFlagCaptured:
|
case kChannelTeamBFlagCaptured:
|
||||||
for (int nSprite = headspritestat[kStatItem]; nSprite >= 0; nSprite = nextspritestat[nSprite])
|
{
|
||||||
|
int nSprite;
|
||||||
|
StatIterator it(kStatItem);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
spritetype* pSprite = &sprite[nSprite];
|
spritetype* pSprite = &sprite[nSprite];
|
||||||
if (pSprite->flags & 32)
|
if (pSprite->flags & 32)
|
||||||
|
@ -435,6 +442,7 @@ void evSend(int nIndex, int nType, int rxId, COMMAND_ID command)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,9 +168,10 @@ spritetype * CFX::fxSpawn(FX_ID nFx, int nSector, int x, int y, int z, unsigned
|
||||||
FXDATA *pFX = &gFXData[nFx];
|
FXDATA *pFX = &gFXData[nFx];
|
||||||
if (gStatCount[1] == 512)
|
if (gStatCount[1] == 512)
|
||||||
{
|
{
|
||||||
int nSprite = headspritestat[kStatFX];;
|
StatIterator it(kStatFX);
|
||||||
while ((sprite[nSprite].flags & 32) && nSprite != -1)
|
int nSprite = it.NextIndex();
|
||||||
nSprite = nextspritestat[nSprite];
|
while (nSprite != -1 && (sprite[nSprite].flags & 32))
|
||||||
|
nSprite = it.NextIndex();
|
||||||
if (nSprite == -1)
|
if (nSprite == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
sub_73FB0(nSprite);
|
sub_73FB0(nSprite);
|
||||||
|
@ -204,7 +205,9 @@ spritetype * CFX::fxSpawn(FX_ID nFx, int nSector, int x, int y, int z, unsigned
|
||||||
|
|
||||||
void CFX::fxProcess(void)
|
void CFX::fxProcess(void)
|
||||||
{
|
{
|
||||||
for (int nSprite = headspritestat[kStatFX]; nSprite >= 0; nSprite = nextspritestat[nSprite])
|
int nSprite;
|
||||||
|
StatIterator it(kStatFX);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
spritetype *pSprite = &sprite[nSprite];
|
spritetype *pSprite = &sprite[nSprite];
|
||||||
viewBackupSpriteLoc(nSprite, pSprite);
|
viewBackupSpriteLoc(nSprite, pSprite);
|
||||||
|
|
|
@ -389,16 +389,20 @@ void nnExtInitModernStuff(bool bSaveLoad) {
|
||||||
pXSprite->Proximity = true;
|
pXSprite->Proximity = true;
|
||||||
break;
|
break;
|
||||||
case kDudeModernCustom:
|
case kDudeModernCustom:
|
||||||
|
{
|
||||||
if (pXSprite->txID <= 0) break;
|
if (pXSprite->txID <= 0) break;
|
||||||
for (int nSprite = headspritestat[kStatDude], found = 0; nSprite >= 0; nSprite = nextspritestat[nSprite]) {
|
int nSprite, found = 0;
|
||||||
|
StatIterator it(kStatDude);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
|
{
|
||||||
XSPRITE* pXSpr = &xsprite[sprite[nSprite].extra];
|
XSPRITE* pXSpr = &xsprite[sprite[nSprite].extra];
|
||||||
if (pXSpr->rxID != pXSprite->txID) continue;
|
if (pXSpr->rxID != pXSprite->txID) continue;
|
||||||
else if (found) I_Error("\nCustom dude (TX ID %d):\nOnly one incarnation allowed per channel!", pXSprite->txID);
|
else if (found) I_Error("\nCustom dude (TX ID %d):\nOnly one incarnation allowed per channel!", pXSprite->txID);
|
||||||
changespritestat(nSprite, kStatInactive);
|
changespritestat(nSprite, kStatInactive);
|
||||||
nSprite = headspritestat[kStatDude];
|
|
||||||
found++;
|
found++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case kDudePodMother:
|
case kDudePodMother:
|
||||||
case kDudeTentacleMother:
|
case kDudeTentacleMother:
|
||||||
pXSprite->state = 1;
|
pXSprite->state = 1;
|
||||||
|
@ -406,9 +410,10 @@ void nnExtInitModernStuff(bool bSaveLoad) {
|
||||||
case kModernPlayerControl:
|
case kModernPlayerControl:
|
||||||
switch (pXSprite->command) {
|
switch (pXSprite->command) {
|
||||||
case kCmdLink:
|
case kCmdLink:
|
||||||
|
{
|
||||||
if (pXSprite->data1 < 1 || pXSprite->data1 >= kMaxPlayers)
|
if (pXSprite->data1 < 1 || pXSprite->data1 >= kMaxPlayers)
|
||||||
I_Error("\nPlayer Control (SPRITE #%d):\nPlayer out of a range (data1 = %d)", pSprite->index, pXSprite->data1);
|
I_Error("\nPlayer Control (SPRITE #%d):\nPlayer out of a range (data1 = %d)", pSprite->index, pXSprite->data1);
|
||||||
|
|
||||||
//if (numplayers < pXSprite->data1)
|
//if (numplayers < pXSprite->data1)
|
||||||
//I_Error("\nPlayer Control (SPRITE #%d):\n There is no player #%d", pSprite->index, pXSprite->data1);
|
//I_Error("\nPlayer Control (SPRITE #%d):\n There is no player #%d", pSprite->index, pXSprite->data1);
|
||||||
|
|
||||||
|
@ -419,7 +424,10 @@ void nnExtInitModernStuff(bool bSaveLoad) {
|
||||||
I_Error("\nPlayer Control (SPRITE #%d):\nTX ID should be in range of %d and %d!", pSprite->index, kChannelUser, kChannelMax);
|
I_Error("\nPlayer Control (SPRITE #%d):\nTX ID should be in range of %d and %d!", pSprite->index, kChannelUser, kChannelMax);
|
||||||
|
|
||||||
// only one linker per player allowed
|
// only one linker per player allowed
|
||||||
for (int nSprite = headspritestat[kStatModernPlayerLinker]; nSprite >= 0; nSprite = nextspritestat[nSprite]) {
|
int nSprite;
|
||||||
|
StatIterator it(kStatModernPlayerLinker);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
|
{
|
||||||
XSPRITE* pXCtrl = &xsprite[sprite[nSprite].extra];
|
XSPRITE* pXCtrl = &xsprite[sprite[nSprite].extra];
|
||||||
if (pXSprite->data1 == pXCtrl->data1)
|
if (pXSprite->data1 == pXCtrl->data1)
|
||||||
I_Error("\nPlayer Control (SPRITE #%d):\nPlayer %d already linked with different player control sprite #%d!", pSprite->index, pXSprite->data1, nSprite);
|
I_Error("\nPlayer Control (SPRITE #%d):\nPlayer %d already linked with different player control sprite #%d!", pSprite->index, pXSprite->data1, nSprite);
|
||||||
|
@ -428,6 +436,7 @@ void nnExtInitModernStuff(bool bSaveLoad) {
|
||||||
pSprite->cstat &= ~CSTAT_SPRITE_BLOCK;
|
pSprite->cstat &= ~CSTAT_SPRITE_BLOCK;
|
||||||
changespritestat(pSprite->index, kStatModernPlayerLinker);
|
changespritestat(pSprite->index, kStatModernPlayerLinker);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case 67: // play qav animation
|
case 67: // play qav animation
|
||||||
if (pXSprite->txID && !pXSprite->waitTime) pXSprite->waitTime = 1;
|
if (pXSprite->txID && !pXSprite->waitTime) pXSprite->waitTime = 1;
|
||||||
changespritestat(pSprite->index, kStatModernQavScene);
|
changespritestat(pSprite->index, kStatModernQavScene);
|
||||||
|
@ -532,18 +541,19 @@ void nnExtInitModernStuff(bool bSaveLoad) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int i;
|
||||||
if (!bSaveLoad) {
|
if (!bSaveLoad) {
|
||||||
|
|
||||||
// let's try to find "else" and "else if" of conditions here
|
// let's try to find "else" and "else if" of conditions here
|
||||||
spritetype* pCond = NULL; XSPRITE* pXCond = NULL;
|
spritetype* pCond = NULL; XSPRITE* pXCond = NULL;
|
||||||
bool found = false; int rx = 0; int sum1 = 0; int sum2 = 0;
|
bool found = false; int rx = 0; int sum1 = 0; int sum2 = 0;
|
||||||
|
|
||||||
for (int i = headspritestat[kStatModernCondition]; i >= 0;) {
|
for (i = StatIterator::First(kStatModernCondition); i >= 0;) {
|
||||||
pCond = &sprite[i]; pXCond = &xsprite[pCond->extra];
|
pCond = &sprite[i]; pXCond = &xsprite[pCond->extra];
|
||||||
sum1 = pXCond->locked + pXCond->busyTime + pXCond->waitTime + pXCond->data1;
|
sum1 = pXCond->locked + pXCond->busyTime + pXCond->waitTime + pXCond->data1;
|
||||||
if (!found) rx = pXCond->rxID;
|
if (!found) rx = pXCond->rxID;
|
||||||
|
|
||||||
for (int a = i; a >= 0; a = nextspritestat[a], found = false) {
|
for (int a = i; a >= 0; a = StatIterator::NextFor(a), found = false) {
|
||||||
spritetype* pCond2 = &sprite[a]; XSPRITE* pXCond2 = &xsprite[pCond2->extra];
|
spritetype* pCond2 = &sprite[a]; XSPRITE* pXCond2 = &xsprite[pCond2->extra];
|
||||||
sum2 = pXCond2->locked + pXCond2->busyTime + pXCond2->waitTime + pXCond2->data1;
|
sum2 = pXCond2->locked + pXCond2->busyTime + pXCond2->waitTime + pXCond2->data1;
|
||||||
|
|
||||||
|
@ -558,13 +568,15 @@ void nnExtInitModernStuff(bool bSaveLoad) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) i = nextspritestat[i];
|
if (!found) i = StatIterator::NextFor(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// collect objects for tracking conditions
|
// collect objects for tracking conditions
|
||||||
for (int i = headspritestat[kStatModernCondition]; i >= 0; i = nextspritestat[i]) {
|
StatIterator it(kStatModernCondition);
|
||||||
|
while ((i = it.NextIndex()) >= 0)
|
||||||
|
{
|
||||||
spritetype* pSprite = &sprite[i]; XSPRITE* pXSprite = &xsprite[pSprite->extra];
|
spritetype* pSprite = &sprite[i]; XSPRITE* pXSprite = &xsprite[pSprite->extra];
|
||||||
|
|
||||||
if (pXSprite->busyTime <= 0) continue;
|
if (pXSprite->busyTime <= 0) continue;
|
||||||
|
@ -791,8 +803,10 @@ void nnExtProcessSuperSprites() {
|
||||||
|
|
||||||
if (!pXProxSpr->DudeLockout) {
|
if (!pXProxSpr->DudeLockout) {
|
||||||
|
|
||||||
for (int nAffected = headspritestat[kStatDude]; nAffected >= 0; nAffected = nextspritestat[nAffected]) {
|
int nAffected;
|
||||||
|
StatIterator it(kStatDude);
|
||||||
|
while ((nAffected = it.NextIndex()) >= 0)
|
||||||
|
{
|
||||||
if ((sprite[nAffected].flags & 32) || xsprite[sprite[nAffected].extra].health <= 0) continue;
|
if ((sprite[nAffected].flags & 32) || xsprite[sprite[nAffected].extra].health <= 0) continue;
|
||||||
else if (CheckProximity(&sprite[nAffected], x, y, z, sectnum, 96)) {
|
else if (CheckProximity(&sprite[nAffected], x, y, z, sectnum, 96)) {
|
||||||
trTriggerSprite(index, pXProxSpr, kCmdSpriteProximity);
|
trTriggerSprite(index, pXProxSpr, kCmdSpriteProximity);
|
||||||
|
@ -2834,16 +2848,6 @@ bool condCheckWall(XSPRITE* pXCond, int cmpOp, bool PUSH) {
|
||||||
if (!sectRangeIsFine(var = sectorofwall(pWall->nextwall))) return false;
|
if (!sectRangeIsFine(var = sectorofwall(pWall->nextwall))) return false;
|
||||||
else if (PUSH) condPush(pXCond, OBJ_SECTOR, var);
|
else if (PUSH) condPush(pXCond, OBJ_SECTOR, var);
|
||||||
return true;
|
return true;
|
||||||
/*case 57: // someone touching this wall?
|
|
||||||
for (int i = headspritestat[kStatDude]; i >= 0; i = nextspritestat[i]) {
|
|
||||||
if (!xspriRangeIsFine(sprite[i].extra) || (gSpriteHit[sprite[i].extra].hit & 0xc000) != 0x8000) continue;
|
|
||||||
else if ((gSpriteHit[sprite[i].extra].hit & 0x3fff) != objIndex) continue;
|
|
||||||
else if (PUSH) {
|
|
||||||
condPush(pXCond, OBJ_SPRITE, i);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3103,7 +3107,10 @@ bool condCheckSprite(XSPRITE* pXCond, int cmpOp, bool PUSH) {
|
||||||
}
|
}
|
||||||
return retn;
|
return retn;
|
||||||
case 45: // this sprite is a target of some dude?
|
case 45: // this sprite is a target of some dude?
|
||||||
for (int nSprite = headspritestat[kStatDude]; nSprite >= 0; nSprite = nextspritestat[nSprite]) {
|
int nSprite;
|
||||||
|
StatIterator it(kStatDude);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
|
{
|
||||||
if (pSpr->index == nSprite) continue;
|
if (pSpr->index == nSprite) continue;
|
||||||
|
|
||||||
spritetype* pDude = &sprite[nSprite];
|
spritetype* pDude = &sprite[nSprite];
|
||||||
|
@ -3160,17 +3167,22 @@ bool condCheckSprite(XSPRITE* pXCond, int cmpOp, bool PUSH) {
|
||||||
else if (PUSH && spriRangeIsFine(pXSpr->burnSource)) condPush(pXCond, OBJ_SPRITE, pXSpr->burnSource);
|
else if (PUSH && spriRangeIsFine(pXSpr->burnSource)) condPush(pXCond, OBJ_SPRITE, pXSpr->burnSource);
|
||||||
return true;
|
return true;
|
||||||
case 66: // any flares stuck in this sprite?
|
case 66: // any flares stuck in this sprite?
|
||||||
for (int nSprite = headspritestat[kStatFlare]; nSprite >= 0; nSprite = nextspritestat[nSprite]) {
|
{
|
||||||
|
int nSprite;
|
||||||
|
StatIterator it(kStatFlare);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
|
{
|
||||||
spritetype* pFlare = &sprite[nSprite];
|
spritetype* pFlare = &sprite[nSprite];
|
||||||
if (!xspriRangeIsFine(pFlare->extra) || (pFlare->flags & kHitagFree))
|
if (!xspriRangeIsFine(pFlare->extra) || (pFlare->flags & kHitagFree))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
XSPRITE* pXFlare = &xsprite[pFlare->extra];
|
XSPRITE* pXFlare = &xsprite[pFlare->extra];
|
||||||
if (!spriRangeIsFine(pXFlare->target) || pXFlare->target != objIndex) continue;
|
if (!spriRangeIsFine(pXFlare->target) || pXFlare->target != objIndex) continue;
|
||||||
else if (PUSH) condPush(pXCond, OBJ_SPRITE, nSprite);
|
else if (PUSH) condPush(pXCond, OBJ_SPRITE, nSprite);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
case 70:
|
case 70:
|
||||||
return condCmp(getSpriteMassBySize(pSpr), arg1, arg2, cmpOp); // mass of the sprite in a range?
|
return condCmp(getSpriteMassBySize(pSpr), arg1, arg2, cmpOp); // mass of the sprite in a range?
|
||||||
}
|
}
|
||||||
|
@ -3207,8 +3219,10 @@ void condUpdateObjectIndex(int objType, int oldIndex, int newIndex) {
|
||||||
int newSerial = condSerialize(objType, newIndex);
|
int newSerial = condSerialize(objType, newIndex);
|
||||||
|
|
||||||
// then update serials
|
// then update serials
|
||||||
for (int nSpr = headspritestat[kStatModernCondition]; nSpr >= 0; nSpr = nextspritestat[nSpr]) {
|
int nSpr;
|
||||||
|
StatIterator it(kStatModernCondition);
|
||||||
|
while ((nSpr = it.NextIndex()) >= 0)
|
||||||
|
{
|
||||||
XSPRITE* pXCond = &xsprite[sprite[nSpr].extra];
|
XSPRITE* pXCond = &xsprite[sprite[nSpr].extra];
|
||||||
if (pXCond->targetX == oldSerial) pXCond->targetX = newSerial;
|
if (pXCond->targetX == oldSerial) pXCond->targetX = newSerial;
|
||||||
if (pXCond->targetY == oldSerial) pXCond->targetY = newSerial;
|
if (pXCond->targetY == oldSerial) pXCond->targetY = newSerial;
|
||||||
|
@ -3383,7 +3397,10 @@ void modernTypeTrigger(int destObjType, int destObjIndex, EVENT event) {
|
||||||
spritetype* aiFightGetTargetInRange(spritetype* pSprite, int minDist, int maxDist, short data, short teamMode) {
|
spritetype* aiFightGetTargetInRange(spritetype* pSprite, int minDist, int maxDist, short data, short teamMode) {
|
||||||
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type); XSPRITE* pXSprite = &xsprite[pSprite->extra];
|
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type); XSPRITE* pXSprite = &xsprite[pSprite->extra];
|
||||||
spritetype* pTarget = NULL; XSPRITE* pXTarget = NULL; spritetype* cTarget = NULL;
|
spritetype* pTarget = NULL; XSPRITE* pXTarget = NULL; spritetype* cTarget = NULL;
|
||||||
for (int nSprite = headspritestat[kStatDude]; nSprite >= 0; nSprite = nextspritestat[nSprite]) {
|
int nSprite;
|
||||||
|
StatIterator it(kStatDude);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
|
{
|
||||||
pTarget = &sprite[nSprite]; pXTarget = &xsprite[pTarget->extra];
|
pTarget = &sprite[nSprite]; pXTarget = &xsprite[pTarget->extra];
|
||||||
if (!aiFightDudeCanSeeTarget(pXSprite, pDudeInfo, pTarget)) continue;
|
if (!aiFightDudeCanSeeTarget(pXSprite, pDudeInfo, pTarget)) continue;
|
||||||
|
|
||||||
|
@ -3498,7 +3515,10 @@ void aiFightActivateDudes(int rx) {
|
||||||
|
|
||||||
// this function sets target to -1 for all dudes that hunting for nSprite
|
// this function sets target to -1 for all dudes that hunting for nSprite
|
||||||
void aiFightFreeTargets(int nSprite) {
|
void aiFightFreeTargets(int nSprite) {
|
||||||
for (int nTarget = headspritestat[kStatDude]; nTarget >= 0; nTarget = nextspritestat[nTarget]) {
|
int nTarget;
|
||||||
|
StatIterator it(kStatDude);
|
||||||
|
while ((nTarget = it.NextIndex()) >= 0)
|
||||||
|
{
|
||||||
if (!IsDudeSprite(&sprite[nTarget]) || sprite[nTarget].extra < 0) continue;
|
if (!IsDudeSprite(&sprite[nTarget]) || sprite[nTarget].extra < 0) continue;
|
||||||
else if (xsprite[sprite[nTarget].extra].target == nSprite)
|
else if (xsprite[sprite[nTarget].extra].target == nSprite)
|
||||||
aiSetTarget(&xsprite[sprite[nTarget].extra], sprite[nTarget].x, sprite[nTarget].y, sprite[nTarget].z);
|
aiSetTarget(&xsprite[sprite[nTarget].extra], sprite[nTarget].x, sprite[nTarget].y, sprite[nTarget].z);
|
||||||
|
@ -3521,7 +3541,10 @@ void aiFightFreeAllTargets(XSPRITE* pXSource) {
|
||||||
|
|
||||||
bool aiFightDudeIsAffected(XSPRITE* pXDude) {
|
bool aiFightDudeIsAffected(XSPRITE* pXDude) {
|
||||||
if (pXDude->rxID <= 0 || pXDude->locked == 1) return false;
|
if (pXDude->rxID <= 0 || pXDude->locked == 1) return false;
|
||||||
for (int nSprite = headspritestat[kStatModernDudeTargetChanger]; nSprite >= 0; nSprite = nextspritestat[nSprite]) {
|
int nSprite;
|
||||||
|
StatIterator it(kStatModernDudeTargetChanger);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
|
{
|
||||||
XSPRITE* pXSprite = (sprite[nSprite].extra >= 0) ? &xsprite[sprite[nSprite].extra] : NULL;
|
XSPRITE* pXSprite = (sprite[nSprite].extra >= 0) ? &xsprite[sprite[nSprite].extra] : NULL;
|
||||||
if (pXSprite == NULL || pXSprite->txID <= 0 || pXSprite->state != 1) continue;
|
if (pXSprite == NULL || pXSprite->txID <= 0 || pXSprite->state != 1) continue;
|
||||||
for (int i = bucketHead[pXSprite->txID]; i < bucketHead[pXSprite->txID + 1]; i++) {
|
for (int i = bucketHead[pXSprite->txID]; i < bucketHead[pXSprite->txID + 1]; i++) {
|
||||||
|
@ -3564,7 +3587,10 @@ void aiFightAlarmDudesInSight(spritetype* pSprite, int max) {
|
||||||
spritetype* pDude = NULL; XSPRITE* pXDude = NULL;
|
spritetype* pDude = NULL; XSPRITE* pXDude = NULL;
|
||||||
XSPRITE* pXSprite = &xsprite[pSprite->extra];
|
XSPRITE* pXSprite = &xsprite[pSprite->extra];
|
||||||
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
for (int nSprite = headspritestat[kStatDude]; nSprite >= 0; nSprite = nextspritestat[nSprite]) {
|
int nSprite;
|
||||||
|
StatIterator it(kStatDude);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
|
{
|
||||||
pDude = &sprite[nSprite];
|
pDude = &sprite[nSprite];
|
||||||
if (pDude->index == pSprite->index || !IsDudeSprite(pDude) || pDude->extra < 0)
|
if (pDude->index == pSprite->index || !IsDudeSprite(pDude) || pDude->extra < 0)
|
||||||
continue;
|
continue;
|
||||||
|
@ -4243,7 +4269,10 @@ int useCondition(spritetype* pSource, XSPRITE* pXSource, EVENT event) {
|
||||||
void useRandomItemGen(spritetype* pSource, XSPRITE* pXSource) {
|
void useRandomItemGen(spritetype* pSource, XSPRITE* pXSource) {
|
||||||
// let's first search for previously dropped items and remove it
|
// let's first search for previously dropped items and remove it
|
||||||
if (pXSource->dropMsg > 0) {
|
if (pXSource->dropMsg > 0) {
|
||||||
for (short nItem = headspritestat[kStatItem]; nItem >= 0; nItem = nextspritestat[nItem]) {
|
int nItem;
|
||||||
|
StatIterator it(kStatItem);
|
||||||
|
while ((nItem = it.NextIndex()) >= 0)
|
||||||
|
{
|
||||||
spritetype* pItem = &sprite[nItem];
|
spritetype* pItem = &sprite[nItem];
|
||||||
if ((unsigned int)pItem->type == pXSource->dropMsg && pItem->x == pSource->x && pItem->y == pSource->y && pItem->z == pSource->z) {
|
if ((unsigned int)pItem->type == pXSource->dropMsg && pItem->x == pSource->x && pItem->y == pSource->y && pItem->z == pSource->z) {
|
||||||
gFX.fxSpawn((FX_ID)29, pSource->sectnum, pSource->x, pSource->y, pSource->z, 0);
|
gFX.fxSpawn((FX_ID)29, pSource->sectnum, pSource->x, pSource->y, pSource->z, 0);
|
||||||
|
@ -4630,8 +4659,10 @@ void useTargetChanger(XSPRITE* pXSource, spritetype* pSprite) {
|
||||||
|
|
||||||
if ((pXSprite->target < 0 || pPlayer != NULL) && (gFrameClock & 32) != 0) {
|
if ((pXSprite->target < 0 || pPlayer != NULL) && (gFrameClock & 32) != 0) {
|
||||||
// try find first target that dude can see
|
// try find first target that dude can see
|
||||||
for (int nSprite = headspritestat[kStatDude]; nSprite >= 0; nSprite = nextspritestat[nSprite]) {
|
int nSprite;
|
||||||
|
StatIterator it(kStatDude);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
|
{
|
||||||
pTarget = &sprite[nSprite]; pXTarget = &xsprite[pTarget->extra];
|
pTarget = &sprite[nSprite]; pXTarget = &xsprite[pTarget->extra];
|
||||||
|
|
||||||
if (pXTarget->target == pSprite->index) {
|
if (pXTarget->target == pSprite->index) {
|
||||||
|
|
|
@ -787,7 +787,10 @@ void playerStart(int nPlayer, int bNewLevel)
|
||||||
// assign or update player's sprite index for conditions
|
// assign or update player's sprite index for conditions
|
||||||
if (gModernMap) {
|
if (gModernMap) {
|
||||||
|
|
||||||
for (int nSprite = headspritestat[kStatModernPlayerLinker]; nSprite >= 0; nSprite = nextspritestat[nSprite]) {
|
int nSprite;
|
||||||
|
StatIterator it(kStatModernPlayerLinker);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
|
{
|
||||||
XSPRITE* pXCtrl = &xsprite[sprite[nSprite].extra];
|
XSPRITE* pXCtrl = &xsprite[sprite[nSprite].extra];
|
||||||
if (pXCtrl->data1 == pPlayer->nPlayer + 1) {
|
if (pXCtrl->data1 == pPlayer->nPlayer + 1) {
|
||||||
int nSpriteOld = pXCtrl->sysData1;
|
int nSpriteOld = pXCtrl->sysData1;
|
||||||
|
@ -888,7 +891,9 @@ void playerInit(int nPlayer, unsigned int a2)
|
||||||
|
|
||||||
char sub_3A158(PLAYER *a1, spritetype *a2)
|
char sub_3A158(PLAYER *a1, spritetype *a2)
|
||||||
{
|
{
|
||||||
for (int nSprite = headspritestat[kStatThing]; nSprite >= 0; nSprite = nextspritestat[nSprite])
|
int nSprite;
|
||||||
|
StatIterator it(kStatThing);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
if (a2 && a2->index == nSprite)
|
if (a2 && a2->index == nSprite)
|
||||||
continue;
|
continue;
|
||||||
|
@ -1198,7 +1203,10 @@ void CheckPickUp(PLAYER *pPlayer)
|
||||||
int z = pSprite->z;
|
int z = pSprite->z;
|
||||||
int nSector = pSprite->sectnum;
|
int nSector = pSprite->sectnum;
|
||||||
int nNextSprite;
|
int nNextSprite;
|
||||||
for (int nSprite = headspritestat[kStatItem]; nSprite >= 0; nSprite = nNextSprite) {
|
int nSprite;
|
||||||
|
StatIterator it(kStatItem);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
|
{
|
||||||
spritetype *pItem = &sprite[nSprite];
|
spritetype *pItem = &sprite[nSprite];
|
||||||
nNextSprite = nextspritestat[nSprite];
|
nNextSprite = nextspritestat[nSprite];
|
||||||
if (pItem->flags&32)
|
if (pItem->flags&32)
|
||||||
|
|
|
@ -1528,7 +1528,8 @@ void OperatePath(unsigned int nSector, XSECTOR *pXSector, EVENT event)
|
||||||
spritetype *pSprite2 = &sprite[pXSector->marker0];
|
spritetype *pSprite2 = &sprite[pXSector->marker0];
|
||||||
XSPRITE *pXSprite2 = &xsprite[pSprite2->extra];
|
XSPRITE *pXSprite2 = &xsprite[pSprite2->extra];
|
||||||
int nId = pXSprite2->data2;
|
int nId = pXSprite2->data2;
|
||||||
for (nSprite = headspritestat[kStatPathMarker]; nSprite >= 0; nSprite = nextspritestat[nSprite])
|
StatIterator it(kStatMarker);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
pSprite = &sprite[nSprite];
|
pSprite = &sprite[nSprite];
|
||||||
if (pSprite->type == kMarkerPath)
|
if (pSprite->type == kMarkerPath)
|
||||||
|
@ -1681,7 +1682,8 @@ void InitPath(unsigned int nSector, XSECTOR *pXSector)
|
||||||
XSPRITE *pXSprite;
|
XSPRITE *pXSprite;
|
||||||
assert(nSector < (unsigned int)numsectors);
|
assert(nSector < (unsigned int)numsectors);
|
||||||
int nId = pXSector->data;
|
int nId = pXSector->data;
|
||||||
for (nSprite = headspritestat[kStatPathMarker]; nSprite >= 0; nSprite = nextspritestat[nSprite])
|
StatIterator it(kStatMarker);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
pSprite = &sprite[nSprite];
|
pSprite = &sprite[nSprite];
|
||||||
if (pSprite->type == kMarkerPath)
|
if (pSprite->type == kMarkerPath)
|
||||||
|
|
|
@ -847,9 +847,11 @@ void viewDrawScreen(bool sceneonly)
|
||||||
deliriumTurn = 0;
|
deliriumTurn = 0;
|
||||||
deliriumPitch = 0;
|
deliriumPitch = 0;
|
||||||
}
|
}
|
||||||
int nSprite = headspritestat[kStatExplosion];
|
|
||||||
int unk = 0;
|
int unk = 0;
|
||||||
while (nSprite >= 0)
|
|
||||||
|
int nSprite;
|
||||||
|
StatIterator it(kStatExplosion);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
spritetype* pSprite = &sprite[nSprite];
|
spritetype* pSprite = &sprite[nSprite];
|
||||||
int nXSprite = pSprite->extra;
|
int nXSprite = pSprite->extra;
|
||||||
|
@ -859,10 +861,10 @@ void viewDrawScreen(bool sceneonly)
|
||||||
{
|
{
|
||||||
unk += pXSprite->data3 * 32;
|
unk += pXSprite->data3 * 32;
|
||||||
}
|
}
|
||||||
nSprite = nextspritestat[nSprite];
|
|
||||||
}
|
}
|
||||||
nSprite = headspritestat[kStatProjectile];
|
it.Reset(kStatProjectile);
|
||||||
while (nSprite >= 0) {
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
|
{
|
||||||
spritetype* pSprite = &sprite[nSprite];
|
spritetype* pSprite = &sprite[nSprite];
|
||||||
switch (pSprite->type) {
|
switch (pSprite->type) {
|
||||||
case kMissileFlareRegular:
|
case kMissileFlareRegular:
|
||||||
|
@ -872,7 +874,6 @@ void viewDrawScreen(bool sceneonly)
|
||||||
if (TestBitString(gotsector, pSprite->sectnum)) unk += 256;
|
if (TestBitString(gotsector, pSprite->sectnum)) unk += 256;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
nSprite = nextspritestat[nSprite];
|
|
||||||
}
|
}
|
||||||
g_visibility = (int32_t)(ClipLow(gVisibility - 32 * gView->visibility - unk, 0));
|
g_visibility = (int32_t)(ClipLow(gVisibility - 32 * gView->visibility - unk, 0));
|
||||||
cA += q16ang(interpolateangfix16(IntToFixed(deliriumTurnO), IntToFixed(deliriumTurn), gInterpolate));
|
cA += q16ang(interpolateangfix16(IntToFixed(deliriumTurnO), IntToFixed(deliriumTurn), gInterpolate));
|
||||||
|
|
|
@ -307,7 +307,6 @@ WEAPONTRACK gWeaponTrack[] = {
|
||||||
|
|
||||||
void UpdateAimVector(PLAYER * pPlayer)
|
void UpdateAimVector(PLAYER * pPlayer)
|
||||||
{
|
{
|
||||||
short nSprite;
|
|
||||||
spritetype *pSprite;
|
spritetype *pSprite;
|
||||||
assert(pPlayer != NULL);
|
assert(pPlayer != NULL);
|
||||||
spritetype *pPSprite = pPlayer->pSprite;
|
spritetype *pPSprite = pPlayer->pSprite;
|
||||||
|
@ -324,7 +323,9 @@ void UpdateAimVector(PLAYER * pPlayer)
|
||||||
if (cl_autoaim == 1 || (cl_autoaim == 2 && !pWeaponTrack->bIsProjectile) || pPlayer->curWeapon == 10 || pPlayer->curWeapon == 9)
|
if (cl_autoaim == 1 || (cl_autoaim == 2 && !pWeaponTrack->bIsProjectile) || pPlayer->curWeapon == 10 || pPlayer->curWeapon == 9)
|
||||||
{
|
{
|
||||||
int nClosest = 0x7fffffff;
|
int nClosest = 0x7fffffff;
|
||||||
for (nSprite = headspritestat[kStatDude]; nSprite >= 0; nSprite = nextspritestat[nSprite])
|
int nSprite;
|
||||||
|
StatIterator it(kStatDude);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
pSprite = &sprite[nSprite];
|
pSprite = &sprite[nSprite];
|
||||||
if (pSprite == pPSprite)
|
if (pSprite == pPSprite)
|
||||||
|
@ -382,7 +383,9 @@ void UpdateAimVector(PLAYER * pPlayer)
|
||||||
}
|
}
|
||||||
if (pWeaponTrack->atc > 0)
|
if (pWeaponTrack->atc > 0)
|
||||||
{
|
{
|
||||||
for (nSprite = headspritestat[kStatThing]; nSprite >= 0; nSprite = nextspritestat[nSprite])
|
int nSprite;
|
||||||
|
StatIterator it(kStatThing);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
pSprite = &sprite[nSprite];
|
pSprite = &sprite[nSprite];
|
||||||
if (!gGameOptions.bFriendlyFire && IsTargetTeammate(pPlayer, pSprite))
|
if (!gGameOptions.bFriendlyFire && IsTargetTeammate(pPlayer, pSprite))
|
||||||
|
@ -2508,7 +2511,9 @@ void sub_51340(spritetype *pMissile, int a2)
|
||||||
actHitcodeToData(a2, &gHitInfo, &v24, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
actHitcodeToData(a2, &gHitInfo, &v24, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
if (a2 == 3 && v24 >= 0 && sprite[v24].statnum == kStatDude)
|
if (a2 == 3 && v24 >= 0 && sprite[v24].statnum == kStatDude)
|
||||||
v4 = 0;
|
v4 = 0;
|
||||||
for (int nSprite = headspritestat[kStatDude]; nSprite >= 0; nSprite = nextspritestat[nSprite])
|
int nSprite;
|
||||||
|
StatIterator it(kStatDude);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
if (nSprite != nOwner || v4)
|
if (nSprite != nOwner || v4)
|
||||||
{
|
{
|
||||||
|
@ -2526,7 +2531,8 @@ void sub_51340(spritetype *pMissile, int a2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int nSprite = headspritestat[kStatThing]; nSprite >= 0; nSprite = nextspritestat[nSprite])
|
it.Reset(kStatThing);
|
||||||
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
spritetype *pSprite = &sprite[nSprite];
|
spritetype *pSprite = &sprite[nSprite];
|
||||||
if (pSprite->flags&32)
|
if (pSprite->flags&32)
|
||||||
|
|
|
@ -921,53 +921,6 @@ extern int32_t(*changespritestat_replace)(int16_t spritenum, int16_t newstatnum)
|
||||||
extern void(*PolymostProcessVoxels_Callback)(void);
|
extern void(*PolymostProcessVoxels_Callback)(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "iterators.h"
|
||||||
class StatIterator
|
|
||||||
{
|
|
||||||
int next;
|
|
||||||
public:
|
|
||||||
StatIterator(int stat)
|
|
||||||
{
|
|
||||||
assert(stat >= 0 && stat < MAXSTATUS);
|
|
||||||
next = headspritestat[stat];
|
|
||||||
}
|
|
||||||
|
|
||||||
void Reset(int stat)
|
|
||||||
{
|
|
||||||
assert(stat >= 0 && stat < MAXSTATUS);
|
|
||||||
next = headspritestat[stat];
|
|
||||||
}
|
|
||||||
|
|
||||||
int NextIndex()
|
|
||||||
{
|
|
||||||
int n = next;
|
|
||||||
next = nextspritestat[next];
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class SectIterator
|
|
||||||
{
|
|
||||||
int next;
|
|
||||||
public:
|
|
||||||
SectIterator(int stat)
|
|
||||||
{
|
|
||||||
assert(stat >= 0 && stat < MAXSECTORS);
|
|
||||||
next = headspritesect[stat];
|
|
||||||
}
|
|
||||||
|
|
||||||
void Reset(int stat)
|
|
||||||
{
|
|
||||||
assert(stat >= 0 && stat < MAXSECTORS);
|
|
||||||
next = headspritesect[stat];
|
|
||||||
}
|
|
||||||
|
|
||||||
int NextIndex()
|
|
||||||
{
|
|
||||||
int n = next;
|
|
||||||
next = nextspritesect[next];
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // build_h_
|
#endif // build_h_
|
||||||
|
|
67
source/core/iterators.h
Normal file
67
source/core/iterators.h
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
class StatIterator
|
||||||
|
{
|
||||||
|
int next;
|
||||||
|
public:
|
||||||
|
StatIterator(int stat)
|
||||||
|
{
|
||||||
|
assert(stat >= 0 && stat < MAXSTATUS);
|
||||||
|
next = headspritestat[stat];
|
||||||
|
}
|
||||||
|
|
||||||
|
void Reset(int stat)
|
||||||
|
{
|
||||||
|
assert(stat >= 0 && stat < MAXSTATUS);
|
||||||
|
next = headspritestat[stat];
|
||||||
|
}
|
||||||
|
|
||||||
|
int NextIndex()
|
||||||
|
{
|
||||||
|
int n = next;
|
||||||
|
next = nextspritestat[next];
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PeekIndex()
|
||||||
|
{
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// These are only used by one particularly screwy loop in Blood's nnexts.cpp.
|
||||||
|
static int First(int stat)
|
||||||
|
{
|
||||||
|
return headspritestat[stat];
|
||||||
|
}
|
||||||
|
|
||||||
|
static int NextFor(int spr)
|
||||||
|
{
|
||||||
|
return nextspritestat[spr];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class SectIterator
|
||||||
|
{
|
||||||
|
int next;
|
||||||
|
public:
|
||||||
|
SectIterator(int stat)
|
||||||
|
{
|
||||||
|
assert(stat >= 0 && stat < MAXSECTORS);
|
||||||
|
next = headspritesect[stat];
|
||||||
|
}
|
||||||
|
|
||||||
|
void Reset(int stat)
|
||||||
|
{
|
||||||
|
assert(stat >= 0 && stat < MAXSECTORS);
|
||||||
|
next = headspritesect[stat];
|
||||||
|
}
|
||||||
|
|
||||||
|
int NextIndex()
|
||||||
|
{
|
||||||
|
int n = next;
|
||||||
|
next = nextspritesect[next];
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in a new issue