mirror of
https://github.com/ZDoom/Raze.git
synced 2025-06-01 17:52:13 +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
|
||||
};
|
||||
|
||||
const int DudeDifficulty[5] = {
|
||||
512, 384, 256, 208, 160
|
||||
};
|
||||
|
||||
int gPostCount = 0;
|
||||
|
||||
|
@ -2352,6 +2355,12 @@ struct POSTPONE {
|
|||
|
||||
POSTPONE gPost[kMaxSprites];
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool IsUnderwaterSector(int nSector)
|
||||
{
|
||||
int nXSector = sector[nSector].extra;
|
||||
|
@ -2360,55 +2369,39 @@ bool IsUnderwaterSector(int nSector)
|
|||
return 0;
|
||||
}
|
||||
|
||||
const int DudeDifficulty[5] = {
|
||||
512, 384, 256, 208, 160
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void actInit(bool bSaveLoad)
|
||||
void actInitTraps()
|
||||
{
|
||||
|
||||
#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);
|
||||
BloodStatIterator it(kStatTraps);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
switch (act->s().type)
|
||||
spritetype* pSprite = &act->s();
|
||||
if (pSprite->type == kTrapExploder)
|
||||
{
|
||||
case kItemWeaponVoodooDoll:
|
||||
act->s().type = kAmmoItemVoodooDoll;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
it.Reset(kStatTraps);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
spritetype *pSprite = &act->s();
|
||||
auto x = &act->x();
|
||||
switch (pSprite->type)
|
||||
{
|
||||
case kTrapExploder:
|
||||
pSprite->cstat &= ~1;
|
||||
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->state = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
it.Reset(kStatThing);
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void actInitThings()
|
||||
{
|
||||
BloodStatIterator it(kStatThing);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
if (!act->hasX()) continue;
|
||||
|
@ -2417,12 +2410,12 @@ void actInit(bool bSaveLoad)
|
|||
|
||||
int nType = pSprite->type - kThingBase;
|
||||
pXSprite->health = thingInfo[nType].startHealth << 4;
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
// allow level designer to set custom clipdist.
|
||||
// this is especially useful for various Gib and Explode objects which have clipdist 1 for some reason predefined,
|
||||
// but what if it have voxel model...?
|
||||
if (!gModernMap)
|
||||
#endif
|
||||
#endif
|
||||
pSprite->clipdist = thingInfo[nType].clipdist;
|
||||
|
||||
pSprite->flags = thingInfo[nType].flags;
|
||||
|
@ -2432,13 +2425,13 @@ void actInit(bool bSaveLoad)
|
|||
switch (pSprite->type) {
|
||||
case kThingArmedProxBomb:
|
||||
case kTrapMachinegun:
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
case kModernThingTNTProx:
|
||||
#endif
|
||||
#endif
|
||||
pXSprite->state = 0;
|
||||
break;
|
||||
case kThingBloodChunks: {
|
||||
SEQINST *pInst = GetInstance(3, pSprite->extra);
|
||||
SEQINST* pInst = GetInstance(3, pSprite->extra);
|
||||
if (pInst)
|
||||
{
|
||||
auto seq = getSequence(pInst->nSeqID);
|
||||
|
@ -2452,14 +2445,23 @@ void actInit(bool bSaveLoad)
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void actInitDudes()
|
||||
{
|
||||
if (gGameOptions.nMonsterSettings == 0)
|
||||
{
|
||||
gKillMgr.SetCount(0);
|
||||
BloodStatIterator it(kStatDude);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
spritetype *pSprite = &act->s();
|
||||
spritetype* pSprite = &act->s();
|
||||
if (act->hasX() && act->x().key > 0) // Drop Key
|
||||
actDropObject(pSprite, kItemKeyBase + (act->x().key - 1));
|
||||
DeleteSprite(act);
|
||||
|
@ -2469,12 +2471,12 @@ void actInit(bool bSaveLoad)
|
|||
{
|
||||
// by NoOne: WTF is this?
|
||||
///////////////
|
||||
char unk[kDudeMax-kDudeBase];
|
||||
char unk[kDudeMax - kDudeBase];
|
||||
memset(unk, 0, sizeof(unk));
|
||||
BloodStatIterator it(kStatDude);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
spritetype *pSprite = &act->s();
|
||||
spritetype* pSprite = &act->s();
|
||||
if (pSprite->type < kDudeBase || pSprite->type >= kDudeMax)
|
||||
I_Error("Non-enemy sprite (%d) in the enemy sprite list.\n", pSprite->index);
|
||||
unk[pSprite->type - kDudeBase] = 1;
|
||||
|
@ -2491,14 +2493,14 @@ void actInit(bool bSaveLoad)
|
|||
while (auto act = it.Next())
|
||||
{
|
||||
if (!act->hasX()) continue;
|
||||
spritetype *pSprite = &act->s();
|
||||
XSPRITE *pXSprite = &act->x();
|
||||
spritetype* pSprite = &act->s();
|
||||
XSPRITE* pXSprite = &act->x();
|
||||
|
||||
int nType = pSprite->type - kDudeBase;
|
||||
int seqStartId = dudeInfo[nType].seqStartID;
|
||||
if (!IsPlayerSprite(pSprite))
|
||||
if (!act->IsPlayerActor())
|
||||
{
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
switch (pSprite->type)
|
||||
{
|
||||
case kDudeModernCustom:
|
||||
|
@ -2511,26 +2513,26 @@ void actInit(bool bSaveLoad)
|
|||
|
||||
case kDudePodMother: // FakeDude type (no seq, custom flags, clipdist and cstat)
|
||||
if (gModernMap) break;
|
||||
fallthrough__;
|
||||
[[fallthrough]];
|
||||
default:
|
||||
pSprite->clipdist = dudeInfo[nType].clipdist;
|
||||
pSprite->cstat |= 4096 + CSTAT_SPRITE_BLOCK_HITSCAN + CSTAT_SPRITE_BLOCK;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
#else
|
||||
pSprite->clipdist = dudeInfo[nType].clipdist;
|
||||
pSprite->cstat |= 4096 + CSTAT_SPRITE_BLOCK_HITSCAN + CSTAT_SPRITE_BLOCK;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
act->xvel() = act->yvel() = act->zvel() = 0;
|
||||
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
// add a way to set custom hp for every enemy - should work only if map just started and not loaded.
|
||||
if (!gModernMap || pXSprite->sysData2 <= 0) pXSprite->health = dudeInfo[nType].startHealth << 4;
|
||||
else pXSprite->health = ClipRange(pXSprite->sysData2 << 4, 1, 65535);
|
||||
#else
|
||||
#else
|
||||
pXSprite->health = dudeInfo[nType].startHealth << 4;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
assert(pSprite != NULL);
|
||||
|
|
|
@ -42,6 +42,43 @@ public:
|
|||
SPRITEMASS& spriteMass() { return gSpriteMass[sprite[index].extra]; }
|
||||
GENDUDEEXTRA& genDudeExtra() { return Blood::gGenDudeExtra[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];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue