- SW: use a DVector3 in SpawnVis

This commit is contained in:
Christoph Oelckers 2022-08-18 16:38:22 +02:00
parent 89816f4582
commit 661655fb67
5 changed files with 27 additions and 27 deletions

View file

@ -344,7 +344,7 @@ struct TVector3
return X == 0 && Y == 0 && Z == 0;
}
TVector3 plusZ(double z)
TVector3 plusZ(double z) const
{
return { X, Y, Z + z };
}

View file

@ -40,7 +40,7 @@ inline DSWActor* WarpPlane(DVector3& pos, sectortype** sect)
void ProcessVisOn(void);
void VisViewChange(PLAYER* pp, int* vis);
void SpawnVis(DSWActor* Parent, sectortype* sect, int x, int y, int z, int amt);
void SpawnVis(DSWActor* Parent, sectortype* sect, const DVector3& pos, int amt);
enum TriggerType { TRIGGER_TYPE_REMOTE_SO };

View file

@ -2283,7 +2283,7 @@ void pUziFire(PANEL_SPRITE* psp)
}
else
{
SpawnVis(psp->PlayerP->actor, nullptr, -1, -1, -1, 32);
SpawnVis(psp->PlayerP->actor, nullptr, {}, 32);
if (!WeaponOK(psp->PlayerP))
return;
@ -2923,7 +2923,7 @@ void pShotgunAction(PANEL_SPRITE* psp)
void pShotgunFire(PANEL_SPRITE* psp)
{
SpawnVis(psp->PlayerP->actor, nullptr, -1, -1, -1, 32);
SpawnVis(psp->PlayerP->actor, nullptr, {}, 32);
InitShotgun(psp->PlayerP);
//SpawnShotgunShell(psp);
}
@ -3281,7 +3281,7 @@ void pRailAction(PANEL_SPRITE* psp)
void pRailFire(PANEL_SPRITE* psp)
{
SpawnVis(psp->PlayerP->actor, nullptr, -1, -1, -1, 16);
SpawnVis(psp->PlayerP->actor, nullptr, {}, 16);
InitRail(psp->PlayerP);
}
@ -3675,15 +3675,15 @@ void pHotheadAttack(PANEL_SPRITE* psp)
switch (psp->PlayerP->WpnFlameType)
{
case 0:
SpawnVis(psp->PlayerP->actor, nullptr, -1, -1, -1, 32);
SpawnVis(psp->PlayerP->actor, nullptr, {}, 32);
InitFireball(psp->PlayerP);
break;
case 1:
SpawnVis(psp->PlayerP->actor, nullptr, -1, -1, -1, 20);
SpawnVis(psp->PlayerP->actor, nullptr, {}, 20);
InitSpellRing(psp->PlayerP);
break;
case 2:
SpawnVis(psp->PlayerP->actor, nullptr, -1, -1, -1, 16);
SpawnVis(psp->PlayerP->actor, nullptr, {}, 16);
InitSpellNapalm(psp->PlayerP);
break;
}
@ -4212,7 +4212,7 @@ void pMicroAction(PANEL_SPRITE* psp)
void pMicroFire(PANEL_SPRITE* psp)
{
SpawnVis(psp->PlayerP->actor, nullptr, -1, -1, -1, 20);
SpawnVis(psp->PlayerP->actor, nullptr, {}, 20);
switch (psp->PlayerP->WpnRocketType)
{
case 0:
@ -5000,7 +5000,7 @@ void pGrenadeAction(PANEL_SPRITE* psp)
void pGrenadeFire(PANEL_SPRITE* psp)
{
SpawnVis(psp->PlayerP->actor, nullptr, -1, -1, -1, 32);
SpawnVis(psp->PlayerP->actor, nullptr, {}, 32);
InitGrenade(psp->PlayerP);
}

View file

@ -120,7 +120,7 @@ void VisViewChange(PLAYER* pp, int *vis)
*vis = BrightestVis;
}
void SpawnVis(DSWActor* parentActor, sectortype* sect, int x, int y, int z, int amt)
void SpawnVis(DSWActor* parentActor, sectortype* sect, const DVector3& pos, int amt)
{
DSWActor* actorNew = nullptr;
if (parentActor != nullptr)
@ -159,7 +159,7 @@ void SpawnVis(DSWActor* parentActor, sectortype* sect, int x, int y, int z, int
actorNew = insertActor(sect, STAT_VIS_ON);
actorNew->set_int_pos({ x, y, z - Z(20) });
actorNew->spr.pos = pos.plusZ(-20);
}
actorNew->spr.cstat = 0;

View file

@ -9957,7 +9957,7 @@ void SpawnBoltExp(DSWActor* actor)
DoExpDamageTest(expActor);
SetExpQuake(actor); // !JIM! made rocket launcher shake things
SpawnVis(nullptr, expActor->sector(), expActor->int_pos().X, expActor->int_pos().Y, expActor->int_pos().Z, 16);
SpawnVis(nullptr, expActor->sector(), expActor->spr.pos, 16);
}
int SpawnBunnyExp(DSWActor* actor)
@ -10003,7 +10003,7 @@ void SpawnTankShellExp(DSWActor* actor)
SpawnExpZadjust(actor, expActor, Z(40), Z(40));
DoExpDamageTest(expActor);
SpawnVis(nullptr, expActor->sector(), expActor->int_pos().X, expActor->int_pos().Y, expActor->int_pos().Z, 16);
SpawnVis(nullptr, expActor->sector(), expActor->spr.pos, 16);
}
@ -10184,7 +10184,7 @@ void SpawnMicroExp(DSWActor* actor)
//
SpawnExpZadjust(actor, expActor, Z(20), Z(20));
SpawnVis(nullptr, expActor->sector(), expActor->int_pos().X, expActor->int_pos().Y, expActor->int_pos().Z, 16);
SpawnVis(nullptr, expActor->sector(), expActor->spr.pos, 16);
}
void AddSpriteToSectorObject(DSWActor* actor, SECTOR_OBJECT* sop)
@ -10375,7 +10375,7 @@ void SpawnGrenadeExp(DSWActor* actor)
DoExpDamageTest(expActor);
SetExpQuake(expActor);
SpawnVis(nullptr, expActor->sector(), expActor->int_pos().X, expActor->int_pos().Y, expActor->int_pos().Z, 0);
SpawnVis(nullptr, expActor->sector(), expActor->spr.pos, 0);
}
void SpawnExpZadjust(DSWActor* actor, DSWActor* expActor, int upper_zsize, int lower_zsize)
@ -10450,7 +10450,7 @@ void SpawnMineExp(DSWActor* actor)
//
SpawnExpZadjust(actor, expActor, Z(100), Z(20));
SpawnVis(nullptr, expActor->sector(), expActor->int_pos().X, expActor->int_pos().Y, expActor->int_pos().Z, 16);
SpawnVis(nullptr, expActor->sector(), expActor->spr.pos, 16);
SetExpQuake(expActor);
}
@ -10491,7 +10491,7 @@ DSWActor* SpawnSectorExp(DSWActor* actor)
DoExpDamageTest(expActor);
SetExpQuake(expActor);
SpawnVis(nullptr, expActor->sector(), expActor->int_pos().X, expActor->int_pos().Y, expActor->int_pos().Z, 16);
SpawnVis(nullptr, expActor->sector(), expActor->spr.pos, 16);
return expActor;
}
@ -10517,7 +10517,7 @@ DSWActor* SpawnLargeExp(DSWActor* actor)
// Should not cause other sectors to explode
DoExpDamageTest(expActor);
SetExpQuake(expActor);
SpawnVis(nullptr, expActor->sector(), expActor->int_pos().X, expActor->int_pos().Y, expActor->int_pos().Z, 16);
SpawnVis(nullptr, expActor->sector(), expActor->spr.pos, 16);
return expActor;
}
@ -10577,7 +10577,7 @@ void SpawnLittleExp(DSWActor* actor)
expActor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
expActor->user.Radius = DamageData[DMG_BASIC_EXP].radius;
DoExpDamageTest(expActor);
SpawnVis(nullptr, expActor->sector(), expActor->int_pos().X, expActor->int_pos().Y, expActor->int_pos().Z, 16);
SpawnVis(nullptr, expActor->sector(), expActor->spr.pos, 16);
}
int DoFireball(DSWActor* actor)
@ -15768,7 +15768,7 @@ int InitSobjGun(PLAYER* pp)
{
case 32:
case 0:
SpawnVis(actor, nullptr, -1, -1, -1, 8);
SpawnVis(actor, nullptr, {}, 8);
SpawnBigGunFlames(actor, pp->actor, pp->sop, false);
SetGunQuake(actor);
InitTankShell(actor, pp);
@ -15778,7 +15778,7 @@ int InitSobjGun(PLAYER* pp)
pp->FirePause = SP_TAG5(actor);
break;
case 1:
SpawnVis(actor, nullptr, -1, -1, -1, 32);
SpawnVis(actor, nullptr, {}, 32);
SpawnBigGunFlames(actor, pp->actor, pp->sop, true);
InitSobjMachineGun(actor, pp);
if (!SP_TAG5(actor))
@ -15788,7 +15788,7 @@ int InitSobjGun(PLAYER* pp)
break;
case 2:
if (SW_SHAREWARE) break;
SpawnVis(actor, nullptr, -1, -1, -1, 32);
SpawnVis(actor, nullptr, {}, 32);
InitTurretLaser(actor, pp);
if (!SP_TAG5(actor))
pp->FirePause = 120;
@ -15797,7 +15797,7 @@ int InitSobjGun(PLAYER* pp)
break;
case 3:
if (SW_SHAREWARE) break;
SpawnVis(actor, nullptr, -1, -1, -1, 32);
SpawnVis(actor, nullptr, {}, 32);
InitTurretRail(actor, pp);
if (!SP_TAG5(actor))
pp->FirePause = 120;
@ -15806,7 +15806,7 @@ int InitSobjGun(PLAYER* pp)
break;
case 4:
if (SW_SHAREWARE) break;
SpawnVis(actor, nullptr, -1, -1, -1, 32);
SpawnVis(actor, nullptr, {}, 32);
InitTurretFireball(actor, pp);
if (!SP_TAG5(actor))
pp->FirePause = 20;
@ -15815,7 +15815,7 @@ int InitSobjGun(PLAYER* pp)
break;
case 5:
if (SW_SHAREWARE) break;
SpawnVis(actor, nullptr, -1, -1, -1, 32);
SpawnVis(actor, nullptr, {}, 32);
InitTurretRocket(actor, pp);
if (!SP_TAG5(actor))
pp->FirePause = 100;
@ -15824,7 +15824,7 @@ int InitSobjGun(PLAYER* pp)
break;
case 6:
if (SW_SHAREWARE) break;
SpawnVis(actor, nullptr, -1, -1, -1, 32);
SpawnVis(actor, nullptr, {}, 32);
InitTurretMicro(actor, pp);
if (!SP_TAG5(actor))
pp->FirePause = 100;