- position in actSpawnSprite

This commit is contained in:
Christoph Oelckers 2022-08-22 18:24:09 +02:00
parent 08c19cd2a4
commit cb39a07580
5 changed files with 17 additions and 15 deletions

View file

@ -2743,11 +2743,10 @@ static void actNapalmMove(DBloodActor* actor)
static DBloodActor* actSpawnFloor(DBloodActor* actor) static DBloodActor* actSpawnFloor(DBloodActor* actor)
{ {
auto pSector = actor->sector(); auto pSector = actor->sector();
int x = actor->int_pos().X; auto pos = actor->spr.pos;
int y = actor->int_pos().Y; updatesector(pos, &pSector);
updatesector(x, y, &pSector); double zFloor = getflorzofslopeptrf(pSector, pos.X, pos.Y);
int zFloor = getflorzofslopeptr(pSector, x, y); auto spawned = actSpawnSprite(pSector, DVector3(pos.XY(), zFloor), 3, 0);
auto spawned = actSpawnSprite(pSector, x, y, zFloor, 3, 0);
if (spawned) spawned->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL; if (spawned) spawned->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
return spawned; return spawned;
} }
@ -5423,7 +5422,7 @@ void actExplodeSprite(DBloodActor* actor)
case kThingTNTBarrel: case kThingTNTBarrel:
{ {
auto spawned = actSpawnSprite(actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0, 1); auto spawned = actSpawnSprite(actor->sector(), actor->spr.pos, 0, 1);
spawned->SetOwner(actor->GetOwner()); spawned->SetOwner(actor->GetOwner());
if (actCheckRespawn(actor)) if (actCheckRespawn(actor))
{ {
@ -6184,12 +6183,11 @@ void actProcessSprites(void)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
DBloodActor* actSpawnSprite(sectortype* pSector, int x, int y, int z, int nStat, bool setextra) DBloodActor* actSpawnSprite(sectortype* pSector, const DVector3& pos, int nStat, bool setextra)
{ {
DBloodActor* actor = InsertSprite(pSector, nStat); DBloodActor* actor = InsertSprite(pSector, nStat);
vec3_t pos = { x, y, z }; SetActor(actor, pos);
SetActor(actor, &pos);
actor->spr.type = kSpriteDecoration; actor->spr.type = kSpriteDecoration;
if (setextra && !actor->hasX()) if (setextra && !actor->hasX())
{ {
@ -6302,8 +6300,9 @@ DBloodActor* actSpawnDude(DBloodActor* source, int nType, int a3, int a4)
DBloodActor* actSpawnThing(sectortype* pSector, int x, int y, int z, int nThingType) DBloodActor* actSpawnThing(sectortype* pSector, int x, int y, int z, int nThingType)
{ {
DVector3 pos(x * inttoworld, y * inttoworld, z * zinttoworld);
assert(nThingType >= kThingBase && nThingType < kThingMax); assert(nThingType >= kThingBase && nThingType < kThingMax);
auto actor = actSpawnSprite(pSector, x, y, z, 4, 1); auto actor = actSpawnSprite(pSector, pos, 4, 1);
int nType = nThingType - kThingBase; int nType = nThingType - kThingBase;
actor->spr.type = nThingType; actor->spr.type = nThingType;
assert(actor->hasX()); assert(actor->hasX());
@ -6528,7 +6527,8 @@ DBloodActor* actFireMissile(DBloodActor* actor, int a2, int a3, int a4, int a5,
y = gHitInfo.int_hitpos().Y - MulScale(pMissileInfo->clipDist << 1, Sin(actor->int_ang()), 28); y = gHitInfo.int_hitpos().Y - MulScale(pMissileInfo->clipDist << 1, Sin(actor->int_ang()), 28);
} }
} }
auto spawned = actSpawnSprite(actor->sector(), x, y, z, 5, 1); DVector3 pos(x * inttoworld, y * inttoworld, z * zinttoworld);
auto spawned = actSpawnSprite(actor->sector(), pos, 5, 1);
spawned->spr.cstat2 |= CSTAT2_SPRITE_MAPPED; spawned->spr.cstat2 |= CSTAT2_SPRITE_MAPPED;
spawned->spr.type = nType; spawned->spr.type = nType;

View file

@ -222,7 +222,7 @@ void actAirDrag(DBloodActor *pSprite, int a2);
void actExplodeSprite(DBloodActor *pSprite); void actExplodeSprite(DBloodActor *pSprite);
void actActivateGibObject(DBloodActor *actor); void actActivateGibObject(DBloodActor *actor);
void actProcessSprites(void); void actProcessSprites(void);
DBloodActor* actSpawnSprite(sectortype* pSector, int x, int y, int z, int nStat, bool a6); DBloodActor* actSpawnSprite(sectortype* pSector, const DVector3& pos, int nStat, bool a6);
DBloodActor* actSpawnDude(DBloodActor* pSource, int nType, int a3, int a4); DBloodActor* actSpawnDude(DBloodActor* pSource, int nType, int a3, int a4);
DBloodActor * actSpawnSprite(DBloodActor *pSource, int nStat); DBloodActor * actSpawnSprite(DBloodActor *pSource, int nStat);
DBloodActor * actSpawnThing(sectortype* pSector, int x, int y, int z, int nThingType); DBloodActor * actSpawnThing(sectortype* pSector, int x, int y, int z, int nThingType);

View file

@ -1835,7 +1835,7 @@ void dudeLeechOperate(DBloodActor* actor, const EVENT& event)
bool doExplosion(DBloodActor* actor, int nType) bool doExplosion(DBloodActor* actor, int nType)
{ {
auto actExplosion = actSpawnSprite(actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, kStatExplosion, true); auto actExplosion = actSpawnSprite(actor->sector(), actor->spr.pos, kStatExplosion, true);
if (!actExplosion->hasX()) if (!actExplosion->hasX())
return false; return false;

View file

@ -137,6 +137,8 @@ void CFX::remove(DBloodActor* actor)
DBloodActor* CFX::fxSpawnActor(FX_ID nFx, sectortype* pSector, int x, int y, int z, unsigned int a6) DBloodActor* CFX::fxSpawnActor(FX_ID nFx, sectortype* pSector, int x, int y, int z, unsigned int a6)
{ {
DVector3 pos(x * inttoworld, y * inttoworld, z * zinttoworld);
if (pSector == nullptr) if (pSector == nullptr)
return nullptr; return nullptr;
auto pSector2 = pSector; auto pSector2 = pSector;
@ -163,7 +165,7 @@ DBloodActor* CFX::fxSpawnActor(FX_ID nFx, sectortype* pSector, int x, int y, int
return nullptr; return nullptr;
FXDATA* pFX = &gFXData[nFx]; FXDATA* pFX = &gFXData[nFx];
auto actor = actSpawnSprite(pSector, x, y, z, 1, 0); auto actor = actSpawnSprite(pSector, pos, 1, 0);
actor->spr.type = nFx; actor->spr.type = nFx;
actor->spr.picnum = pFX->picnum; actor->spr.picnum = pFX->picnum;

View file

@ -795,7 +795,7 @@ void playerStart(int nPlayer, int bNewLevel)
pStartZone = &gStartZone[Random(8)]; pStartZone = &gStartZone[Random(8)];
} }
auto actor = actSpawnSprite(pStartZone->sector, pStartZone->x, pStartZone->y, pStartZone->z, 6, 1); auto actor = actSpawnSprite(pStartZone->sector, {pStartZone->x * inttoworld, pStartZone->y * inttoworld, pStartZone->z * zinttoworld}, 6, 1);
assert(actor->hasX()); assert(actor->hasX());
pPlayer->actor = actor; pPlayer->actor = actor;
DUDEINFO* pDudeInfo = &dudeInfo[kDudePlayer1 + nPlayer - kDudeBase]; DUDEINFO* pDudeInfo = &dudeInfo[kDudePlayer1 + nPlayer - kDudeBase];