mirror of
https://github.com/ZDoom/Raze.git
synced 2025-06-03 02:30:58 +00:00
- split actInit into several smaller functions.
This commit is contained in:
parent
eee972d446
commit
51205fbdac
2 changed files with 254 additions and 180 deletions
|
@ -2342,6 +2342,9 @@ static const short gPlayerGibThingComments[] = {
|
||||||
734, 735, 736, 737, 738, 739, 740, 741, 3038, 3049
|
734, 735, 736, 737, 738, 739, 740, 741, 3038, 3049
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const int DudeDifficulty[5] = {
|
||||||
|
512, 384, 256, 208, 160
|
||||||
|
};
|
||||||
|
|
||||||
int gPostCount = 0;
|
int gPostCount = 0;
|
||||||
|
|
||||||
|
@ -2352,6 +2355,12 @@ struct POSTPONE {
|
||||||
|
|
||||||
POSTPONE gPost[kMaxSprites];
|
POSTPONE gPost[kMaxSprites];
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
bool IsUnderwaterSector(int nSector)
|
bool IsUnderwaterSector(int nSector)
|
||||||
{
|
{
|
||||||
int nXSector = sector[nSector].extra;
|
int nXSector = sector[nSector].extra;
|
||||||
|
@ -2360,55 +2369,39 @@ bool IsUnderwaterSector(int nSector)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int DudeDifficulty[5] = {
|
//---------------------------------------------------------------------------
|
||||||
512, 384, 256, 208, 160
|
//
|
||||||
};
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void actInit(bool bSaveLoad)
|
void actInitTraps()
|
||||||
{
|
{
|
||||||
|
BloodStatIterator it(kStatTraps);
|
||||||
#ifdef NOONE_EXTENSIONS
|
|
||||||
if (!gModernMap)
|
|
||||||
{
|
|
||||||
//Printf("> This map *does not* provides modern features.\n");
|
|
||||||
nnExtResetGlobals();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//Printf("> This map provides modern features.\n");
|
|
||||||
nnExtInitModernStuff(bSaveLoad);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
BloodStatIterator it(kStatItem);
|
|
||||||
while (auto act = it.Next())
|
|
||||||
{
|
|
||||||
switch (act->s().type)
|
|
||||||
{
|
|
||||||
case kItemWeaponVoodooDoll:
|
|
||||||
act->s().type = kAmmoItemVoodooDoll;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
it.Reset(kStatTraps);
|
|
||||||
while (auto act = it.Next())
|
while (auto act = it.Next())
|
||||||
{
|
{
|
||||||
spritetype* pSprite = &act->s();
|
spritetype* pSprite = &act->s();
|
||||||
auto x = &act->x();
|
if (pSprite->type == kTrapExploder)
|
||||||
switch (pSprite->type)
|
|
||||||
{
|
{
|
||||||
case kTrapExploder:
|
|
||||||
pSprite->cstat &= ~1;
|
pSprite->cstat &= ~1;
|
||||||
pSprite->cstat |= CSTAT_SPRITE_INVISIBLE;
|
pSprite->cstat |= CSTAT_SPRITE_INVISIBLE;
|
||||||
if (pSprite->extra <= 0 || pSprite->extra >= kMaxXSprites) continue;
|
if (!act->hasX()) continue;
|
||||||
|
auto x = &act->x();
|
||||||
x->waitTime = ClipLow(x->waitTime, 1);
|
x->waitTime = ClipLow(x->waitTime, 1);
|
||||||
x->state = 0;
|
x->state = 0;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
it.Reset(kStatThing);
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void actInitThings()
|
||||||
|
{
|
||||||
|
BloodStatIterator it(kStatThing);
|
||||||
while (auto act = it.Next())
|
while (auto act = it.Next())
|
||||||
{
|
{
|
||||||
if (!act->hasX()) continue;
|
if (!act->hasX()) continue;
|
||||||
|
@ -2452,7 +2445,16 @@ void actInit(bool bSaveLoad)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void actInitDudes()
|
||||||
|
{
|
||||||
if (gGameOptions.nMonsterSettings == 0)
|
if (gGameOptions.nMonsterSettings == 0)
|
||||||
{
|
{
|
||||||
gKillMgr.SetCount(0);
|
gKillMgr.SetCount(0);
|
||||||
|
@ -2496,7 +2498,7 @@ void actInit(bool bSaveLoad)
|
||||||
|
|
||||||
int nType = pSprite->type - kDudeBase;
|
int nType = pSprite->type - kDudeBase;
|
||||||
int seqStartId = dudeInfo[nType].seqStartID;
|
int seqStartId = dudeInfo[nType].seqStartID;
|
||||||
if (!IsPlayerSprite(pSprite))
|
if (!act->IsPlayerActor())
|
||||||
{
|
{
|
||||||
#ifdef NOONE_EXTENSIONS
|
#ifdef NOONE_EXTENSIONS
|
||||||
switch (pSprite->type)
|
switch (pSprite->type)
|
||||||
|
@ -2511,7 +2513,7 @@ void actInit(bool bSaveLoad)
|
||||||
|
|
||||||
case kDudePodMother: // FakeDude type (no seq, custom flags, clipdist and cstat)
|
case kDudePodMother: // FakeDude type (no seq, custom flags, clipdist and cstat)
|
||||||
if (gModernMap) break;
|
if (gModernMap) break;
|
||||||
fallthrough__;
|
[[fallthrough]];
|
||||||
default:
|
default:
|
||||||
pSprite->clipdist = dudeInfo[nType].clipdist;
|
pSprite->clipdist = dudeInfo[nType].clipdist;
|
||||||
pSprite->cstat |= 4096 + CSTAT_SPRITE_BLOCK_HITSCAN + CSTAT_SPRITE_BLOCK;
|
pSprite->cstat |= 4096 + CSTAT_SPRITE_BLOCK_HITSCAN + CSTAT_SPRITE_BLOCK;
|
||||||
|
@ -2540,6 +2542,41 @@ void actInit(bool bSaveLoad)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void actInit(bool bSaveLoad)
|
||||||
|
{
|
||||||
|
|
||||||
|
#ifdef NOONE_EXTENSIONS
|
||||||
|
if (!gModernMap) nnExtResetGlobals();
|
||||||
|
else nnExtInitModernStuff(bSaveLoad);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
BloodStatIterator it(kStatItem);
|
||||||
|
while (auto act = it.Next())
|
||||||
|
{
|
||||||
|
if (act->s().type == kItemWeaponVoodooDoll)
|
||||||
|
{
|
||||||
|
act->s().type = kAmmoItemVoodooDoll;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
actInitTraps();
|
||||||
|
actInitThings();
|
||||||
|
actInitDudes();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void ConcussSprite(int a1, spritetype *pSprite, int x, int y, int z, int a6)
|
void ConcussSprite(int a1, spritetype *pSprite, int x, int y, int z, int a6)
|
||||||
{
|
{
|
||||||
assert(pSprite != NULL);
|
assert(pSprite != NULL);
|
||||||
|
|
|
@ -42,6 +42,43 @@ public:
|
||||||
SPRITEMASS& spriteMass() { return gSpriteMass[sprite[index].extra]; }
|
SPRITEMASS& spriteMass() { return gSpriteMass[sprite[index].extra]; }
|
||||||
GENDUDEEXTRA& genDudeExtra() { return Blood::gGenDudeExtra[index]; }
|
GENDUDEEXTRA& genDudeExtra() { return Blood::gGenDudeExtra[index]; }
|
||||||
POINT3D& basePoint() { return Blood::baseSprite[index]; }
|
POINT3D& basePoint() { return Blood::baseSprite[index]; }
|
||||||
|
|
||||||
|
void SetOwner(DBloodActor* own)
|
||||||
|
{
|
||||||
|
s().owner = own? own->s().index : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
DBloodActor* GetOwner()
|
||||||
|
{
|
||||||
|
if (s().owner == -1) return nullptr;
|
||||||
|
return base() + s().owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsPlayerActor()
|
||||||
|
{
|
||||||
|
return s().type >= kDudePlayer1 && s().type <= kDudePlayer8;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsDudeActor()
|
||||||
|
{
|
||||||
|
return s().type >= kDudeBase && s().type < kDudeMax;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsItemActor()
|
||||||
|
{
|
||||||
|
return s().type >= kItemBase && s().type < kItemMax;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsWeaponActor()
|
||||||
|
{
|
||||||
|
return s().type >= kItemWeaponBase && s().type < kItemWeaponMax;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsAmmoActor()
|
||||||
|
{
|
||||||
|
return s().type >= kItemAmmoBase && s().type < kItemAmmoMax;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern DBloodActor bloodActors[kMaxSprites];
|
extern DBloodActor bloodActors[kMaxSprites];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue