mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
- actSpawnSprite
# Conflicts: # source/games/blood/src/actor.cpp # Conflicts: # source/games/blood/src/actor.cpp
This commit is contained in:
parent
ebdb4927cc
commit
ac40e86ab2
6 changed files with 35 additions and 27 deletions
|
@ -2779,7 +2779,7 @@ static DBloodActor* actSpawnFloor(DBloodActor* actor)
|
|||
int y = pSprite->y;
|
||||
updatesector(x, y, §or);
|
||||
int zFloor = getflorzofslope(sector, x, y);
|
||||
auto* spawned = actSpawnSprite(sector, x, y, zFloor, 3, 0);
|
||||
auto spawned = actSpawnSprite(sector, x, y, zFloor, 3, 0);
|
||||
if (spawned) spawned->s().cstat &= ~257;
|
||||
return spawned;
|
||||
}
|
||||
|
@ -6388,42 +6388,40 @@ void actProcessSprites(void)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
spritetype * actSpawnSprite_(int nSector, int x, int y, int z, int nStat, char a6)
|
||||
DBloodActor* actSpawnSprite(int nSector, int x, int y, int z, int nStat, bool setextra)
|
||||
{
|
||||
int nSprite = InsertSprite(nSector, nStat);
|
||||
if (nSprite >= 0)
|
||||
sprite[nSprite].extra = -1;
|
||||
if (nSprite >= 0) sprite[nSprite].extra = -1;
|
||||
else
|
||||
{
|
||||
StatIterator it(kStatPurge);
|
||||
BloodStatIterator it(kStatPurge);
|
||||
nSprite = it.NextIndex();
|
||||
assert(nSprite >= 0);
|
||||
assert(nSector >= 0 && nSector < kMaxSectors);
|
||||
ChangeSpriteSect(nSprite, nSector);
|
||||
actPostSprite(nSprite, nStat);
|
||||
}
|
||||
DBloodActor* actor = &bloodActors[nSprite];
|
||||
|
||||
vec3_t pos = { x, y, z };
|
||||
setsprite(nSprite, &pos);
|
||||
spritetype *pSprite = &sprite[nSprite];
|
||||
spritetype* pSprite = &actor->s();
|
||||
pSprite->type = kSpriteDecoration;
|
||||
if (a6 && pSprite->extra == -1)
|
||||
if (setextra && !actor->hasX())
|
||||
{
|
||||
int nXSprite = dbInsertXSprite(nSprite);
|
||||
gSpriteHit[nXSprite].florhit = 0;
|
||||
gSpriteHit[nXSprite].ceilhit = 0;
|
||||
if (!VanillaMode())
|
||||
xsprite[nXSprite].target = -1;
|
||||
actor->addExtra();
|
||||
actor->hit().florhit = 0;
|
||||
actor->hit().ceilhit = 0;
|
||||
if (!VanillaMode()) actor->SetTarget(nullptr);
|
||||
}
|
||||
return pSprite;
|
||||
return actor;
|
||||
}
|
||||
|
||||
DBloodActor* actSpawnSprite(int nSector, int x, int y, int z, int nStat, bool a6)
|
||||
{
|
||||
auto spr = actSpawnSprite_(nSector, x, y, z, nStat, a6);
|
||||
return &bloodActors[spr->index];
|
||||
}
|
||||
|
||||
spritetype * actSpawnSprite(spritetype *pSource, int nStat);
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
spritetype *actSpawnDude(spritetype *pSource, short nType, int a3, int a4)
|
||||
{
|
||||
|
@ -6520,7 +6518,8 @@ spritetype * actSpawnSprite(spritetype *pSource, int nStat)
|
|||
spritetype * actSpawnThing(int nSector, int x, int y, int z, int nThingType)
|
||||
{
|
||||
assert(nThingType >= kThingBase && nThingType < kThingMax);
|
||||
spritetype *pSprite = actSpawnSprite_(nSector, x, y, z, 4, 1);
|
||||
auto actor = actSpawnSprite(nSector, x, y, z, 4, 1);
|
||||
spritetype* pSprite = &actor->s();
|
||||
int nType = nThingType-kThingBase;
|
||||
int nThing = pSprite->index;
|
||||
int nXThing = pSprite->extra;
|
||||
|
@ -6661,7 +6660,8 @@ spritetype* actFireMissile(spritetype *pSprite, int a2, int a3, int a4, int a5,
|
|||
y = gHitInfo.hity-MulScale(pMissileInfo->clipDist<<1, Sin(pSprite->ang), 28);
|
||||
}
|
||||
}
|
||||
spritetype *pMissile = actSpawnSprite_(pSprite->sectnum, x, y, z, 5, 1);
|
||||
auto actor = actSpawnSprite(pSprite->sectnum, x, y, z, 5, 1);
|
||||
spritetype* pMissile = &actor->s();
|
||||
int nMissile = pMissile->index;
|
||||
show2dsprite.Set(nMissile);
|
||||
pMissile->type = nType;
|
||||
|
|
|
@ -232,7 +232,6 @@ void actAirDrag(DBloodActor *pSprite, int a2);
|
|||
void actExplodeSprite(DBloodActor *pSprite);
|
||||
void actActivateGibObject(DBloodActor *actor);
|
||||
void actProcessSprites(void);
|
||||
spritetype * actSpawnSprite_(int nSector, int x, int y, int z, int nStat, char a6);
|
||||
DBloodActor* actSpawnSprite(int nSector, int x, int y, int z, int nStat, bool a6);
|
||||
spritetype *actSpawnDude(spritetype *pSource, short nType, int a3, int a4);
|
||||
spritetype * actSpawnSprite(spritetype *pSource, int nStat);
|
||||
|
|
|
@ -1593,8 +1593,10 @@ void dudeLeechOperate(spritetype* pSprite, XSPRITE* pXSprite, EVENT event)
|
|||
}
|
||||
}
|
||||
|
||||
bool doExplosion(spritetype* pSprite, int nType) {
|
||||
spritetype* pExplosion = actSpawnSprite_(pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, kStatExplosion, true);
|
||||
bool doExplosion(spritetype* pSprite, int nType)
|
||||
{
|
||||
auto actor = actSpawnSprite(pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, kStatExplosion, true);
|
||||
spritetype* pExplosion = &actor->s();
|
||||
if (pExplosion->extra < 0 || pExplosion->extra >= kMaxXSprites)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -128,6 +128,11 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void addExtra()
|
||||
{
|
||||
if (s().extra <= 0) s().extra = dbInsertXSprite(index);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
extern DBloodActor bloodActors[kMaxSprites];
|
||||
|
|
|
@ -165,7 +165,8 @@ spritetype * CFX::fxSpawn(FX_ID nFx, int nSector, int x, int y, int z, unsigned
|
|||
return NULL;
|
||||
destroy(nSprite);
|
||||
}
|
||||
spritetype *pSprite = actSpawnSprite_(nSector, x, y, z, 1, 0);
|
||||
auto actor = actSpawnSprite(nSector, x, y, z, 1, 0);
|
||||
spritetype* pSprite = &actor->s();
|
||||
pSprite->type = nFx;
|
||||
pSprite->picnum = pFX->picnum;
|
||||
pSprite->cstat |= pFX->cstat;
|
||||
|
|
|
@ -660,7 +660,8 @@ void playerStart(int nPlayer, int bNewLevel)
|
|||
pStartZone = &gStartZone[Random(8)];
|
||||
}
|
||||
|
||||
spritetype *pSprite = actSpawnSprite_(pStartZone->sectnum, pStartZone->x, pStartZone->y, pStartZone->z, 6, 1);
|
||||
auto actor = actSpawnSprite(pStartZone->sectnum, pStartZone->x, pStartZone->y, pStartZone->z, 6, 1);
|
||||
spritetype* pSprite = &actor->s();
|
||||
assert(pSprite->extra > 0 && pSprite->extra < kMaxXSprites);
|
||||
XSPRITE *pXSprite = &xsprite[pSprite->extra];
|
||||
pPlayer->pSprite = pSprite;
|
||||
|
|
Loading…
Reference in a new issue