mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-12 03:00:38 +00:00
- genDudePrepare
This commit is contained in:
parent
fb5916a3dd
commit
013eadfd9f
5 changed files with 22 additions and 22 deletions
|
@ -2482,7 +2482,7 @@ static void actInitDudes()
|
|||
case kDudeModernCustom:
|
||||
case kDudeModernCustomBurning:
|
||||
pSprite->cstat |= 4096 + CSTAT_SPRITE_BLOCK_HITSCAN + CSTAT_SPRITE_BLOCK;
|
||||
seqStartId = genDudeSeqStartId(pXSprite); // Custom Dude stores its SEQ in data2
|
||||
seqStartId = genDudeSeqStartId(act); // Custom Dude stores its SEQ in data2
|
||||
pXSprite->sysData1 = pXSprite->data3; // move sndStartId to sysData1, because data3 used by the game;
|
||||
pXSprite->data3 = 0;
|
||||
break;
|
||||
|
|
|
@ -1901,7 +1901,7 @@ void aiInitSprite(DBloodActor* actor)
|
|||
case kDudeModernCustomBurning:
|
||||
if (!gModernMap) break;
|
||||
aiGenDudeInitSprite(pSprite, pXSprite);
|
||||
genDudePrepare(pSprite, kGenDudePropertyAll);
|
||||
genDudePrepare(actor, kGenDudePropertyAll);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
|
|
@ -188,7 +188,7 @@ void genDudeUpdate(DBloodActor* actor)
|
|||
{
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra();
|
||||
for (int i = 0; i < kGenDudePropertyMax; i++) {
|
||||
if (pExtra->updReq[i]) genDudePrepare(&actor->s(), i);
|
||||
if (pExtra->updReq[i]) genDudePrepare(actor, i);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1987,7 +1987,7 @@ DBloodActor* genDudeSpawn(DBloodActor* source, DBloodActor* actor, int nDist)
|
|||
pXDude->data3 = 0;
|
||||
|
||||
// spawn seq
|
||||
seqSpawn(genDudeSeqStartId(pXDude), 3, pDude->extra, -1);
|
||||
seqSpawn(genDudeSeqStartId(spawned), 3, pDude->extra, -1);
|
||||
|
||||
// inherit movement speed.
|
||||
pXDude->busyTime = pXSource->busyTime;
|
||||
|
@ -2132,8 +2132,8 @@ void genDudeTransform(DBloodActor* actor)
|
|||
break;
|
||||
case kDudeModernCustom:
|
||||
case kDudeModernCustomBurning:
|
||||
seqId = genDudeSeqStartId(pXSprite);
|
||||
genDudePrepare(pSprite, kGenDudePropertyMass);
|
||||
seqId = genDudeSeqStartId(actor);
|
||||
genDudePrepare(actor, kGenDudePropertyMass);
|
||||
[[fallthrough]]; // go below
|
||||
default:
|
||||
seqSpawn(seqId, 3, pSprite->extra, -1);
|
||||
|
@ -2343,19 +2343,20 @@ bool canWalk(DBloodActor* actor)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int genDudeSeqStartId(XSPRITE* pXSprite) {
|
||||
if (genDudePrepare(&sprite[pXSprite->reference], kGenDudePropertyStates)) return pXSprite->data2;
|
||||
int genDudeSeqStartId(DBloodActor* actor)
|
||||
{
|
||||
if (genDudePrepare(actor, kGenDudePropertyStates)) return actor->x().data2;
|
||||
else return kGenDudeDefaultSeq;
|
||||
}
|
||||
|
||||
bool genDudePrepare(spritetype* pSprite, int propId) {
|
||||
if (!spriRangeIsFine(pSprite->index)) {
|
||||
Printf(PRINT_HIGH, "!spriRangeIsFine(pSprite->index)");
|
||||
return false;
|
||||
} else if (!xspriRangeIsFine(pSprite->extra)) {
|
||||
Printf(PRINT_HIGH, "!xspriRangeIsFine(pSprite->extra)");
|
||||
return false;
|
||||
} else if (pSprite->type != kDudeModernCustom) {
|
||||
bool genDudePrepare(DBloodActor* actor, int propId)
|
||||
{
|
||||
if (!actor || !actor->hasX()) return false;
|
||||
|
||||
auto const pSprite = &actor->s();
|
||||
auto const pXSprite = &actor->x();
|
||||
|
||||
if (pSprite->type != kDudeModernCustom) {
|
||||
Printf(PRINT_HIGH, "pSprite->type != kDudeModernCustom");
|
||||
return false;
|
||||
} else if (propId < kGenDudePropertyAll || propId >= kGenDudePropertyMax) {
|
||||
|
@ -2363,9 +2364,8 @@ bool genDudePrepare(spritetype* pSprite, int propId) {
|
|||
return false;
|
||||
}
|
||||
|
||||
auto actor = &bloodActors[pSprite->index];
|
||||
XSPRITE* pXSprite = &xsprite[pSprite->extra];
|
||||
GENDUDEEXTRA* pExtra = &gGenDudeExtra[pSprite->index]; pExtra->updReq[propId] = false;
|
||||
GENDUDEEXTRA* pExtra = &actor->genDudeExtra();
|
||||
pExtra->updReq[propId] = false;
|
||||
|
||||
switch (propId) {
|
||||
case kGenDudePropertyAll:
|
||||
|
|
|
@ -225,8 +225,8 @@ short inRecoil(AISTATE* aiState);
|
|||
short inSearch(AISTATE* aiState);
|
||||
short inChase(AISTATE* aiState);
|
||||
short inDuck(AISTATE* aiState);
|
||||
int genDudeSeqStartId(XSPRITE* pXSprite);
|
||||
bool genDudePrepare(spritetype* pSprite, int propId);
|
||||
int genDudeSeqStartId(DBloodActor* pXSprite);
|
||||
bool genDudePrepare(DBloodActor* pSprite, int propId);
|
||||
void genDudeUpdate(DBloodActor* pSprite);
|
||||
void genDudePostDeath(spritetype* pSprite, DAMAGE_TYPE damageType, int damage);
|
||||
void aiGenDudeInitSprite(spritetype* pSprite, XSPRITE* pXSprite);
|
||||
|
|
|
@ -262,7 +262,7 @@ void Respawn(int nSprite) // 9
|
|||
seqSpawn(getDudeInfo(nType + kDudeBase)->seqStartID, 3, pSprite->extra, -1);
|
||||
break;
|
||||
case kDudeModernCustom:
|
||||
seqSpawn(genDudeSeqStartId(pXSprite), 3, pSprite->extra, -1);
|
||||
seqSpawn(genDudeSeqStartId(actor), 3, pSprite->extra, -1);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue