From c4f29772ae4fd1e650e4a364ee80f66f9c3758b4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 25 Nov 2021 18:30:10 +0100 Subject: [PATCH] - SpawnVis --- source/games/sw/src/misc.h | 2 +- source/games/sw/src/panel.cpp | 16 ++++++++-------- source/games/sw/src/vis.cpp | 6 +++--- source/games/sw/src/weapon.cpp | 30 +++++++++++++++--------------- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/source/games/sw/src/misc.h b/source/games/sw/src/misc.h index db9ab17d7..238667aed 100644 --- a/source/games/sw/src/misc.h +++ b/source/games/sw/src/misc.h @@ -43,7 +43,7 @@ DSWActor* WarpPlane(int32_t* x, int32_t* y, int32_t* z, int16_t* sectnum) void ProcessVisOn(void); void VisViewChange(PLAYERp pp, int* vis); -void SpawnVis(DSWActor* Parent, short sectnum, int x, int y, int z, int amt); +void SpawnVis(DSWActor* Parent, sectortype* sect, int x, int y, int z, int amt); enum TriggerType { TRIGGER_TYPE_REMOTE_SO }; diff --git a/source/games/sw/src/panel.cpp b/source/games/sw/src/panel.cpp index 4050acbe4..b2520dd84 100644 --- a/source/games/sw/src/panel.cpp +++ b/source/games/sw/src/panel.cpp @@ -2345,7 +2345,7 @@ pUziFire(PANEL_SPRITEp psp) } else { - SpawnVis(psp->PlayerP->Actor(), -1, -1, -1, -1, 32); + SpawnVis(psp->PlayerP->Actor(), nullptr, -1, -1, -1, 32); if (!WeaponOK(psp->PlayerP)) return; @@ -3005,7 +3005,7 @@ pShotgunAction(PANEL_SPRITEp psp) void pShotgunFire(PANEL_SPRITEp psp) { - SpawnVis(psp->PlayerP->Actor(), -1, -1, -1, -1, 32); + SpawnVis(psp->PlayerP->Actor(), nullptr, -1, -1, -1, 32); InitShotgun(psp->PlayerP); //SpawnShotgunShell(psp); } @@ -3376,7 +3376,7 @@ pRailAction(PANEL_SPRITEp psp) void pRailFire(PANEL_SPRITEp psp) { - SpawnVis(psp->PlayerP->Actor(), -1, -1, -1, -1, 16); + SpawnVis(psp->PlayerP->Actor(), nullptr, -1, -1, -1, 16); InitRail(psp->PlayerP); } @@ -3780,15 +3780,15 @@ pHotheadAttack(PANEL_SPRITEp psp) switch (psp->PlayerP->WpnFlameType) { case 0: - SpawnVis(psp->PlayerP->Actor(), -1, -1, -1, -1, 32); + SpawnVis(psp->PlayerP->Actor(), nullptr, -1, -1, -1, 32); InitFireball(psp->PlayerP); break; case 1: - SpawnVis(psp->PlayerP->Actor(), -1, -1, -1, -1, 20); + SpawnVis(psp->PlayerP->Actor(), nullptr, -1, -1, -1, 20); InitSpellRing(psp->PlayerP); break; case 2: - SpawnVis(psp->PlayerP->Actor(), -1, -1, -1, -1, 16); + SpawnVis(psp->PlayerP->Actor(), nullptr, -1, -1, -1, 16); InitSpellNapalm(psp->PlayerP); break; } @@ -4331,7 +4331,7 @@ pMicroAction(PANEL_SPRITEp psp) void pMicroFire(PANEL_SPRITEp psp) { - SpawnVis(psp->PlayerP->Actor(), -1, -1, -1, -1, 20); + SpawnVis(psp->PlayerP->Actor(), nullptr, -1, -1, -1, 20); switch (psp->PlayerP->WpnRocketType) { case 0: @@ -5151,7 +5151,7 @@ pGrenadeAction(PANEL_SPRITEp psp) void pGrenadeFire(PANEL_SPRITEp psp) { - SpawnVis(psp->PlayerP->Actor(), -1, -1, -1, -1, 32); + SpawnVis(psp->PlayerP->Actor(), nullptr, -1, -1, -1, 32); InitGrenade(psp->PlayerP); } diff --git a/source/games/sw/src/vis.cpp b/source/games/sw/src/vis.cpp index 8dcef7824..4a9ae9ad8 100644 --- a/source/games/sw/src/vis.cpp +++ b/source/games/sw/src/vis.cpp @@ -127,7 +127,7 @@ void VisViewChange(PLAYERp pp, int *vis) *vis = BrightestVis; } -void SpawnVis(DSWActor* parentActor, short sectnum, int x, int y, int z, int amt) +void SpawnVis(DSWActor* parentActor, sectortype* sect, int x, int y, int z, int amt) { SPRITEp sp; if (parentActor != nullptr) @@ -167,10 +167,10 @@ void SpawnVis(DSWActor* parentActor, short sectnum, int x, int y, int z, int amt } else { - if (sector[sectnum].floorpal == PALETTE_FOG) + if (sect->floorpal == PALETTE_FOG) return; - auto actorNew = InsertActor(sectnum, STAT_VIS_ON); + auto actorNew = InsertActor(sect, STAT_VIS_ON); sp = &actorNew->s(); sp->x = x; diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 48f141d73..fd468fa4d 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -10385,7 +10385,7 @@ void SpawnBoltExp(DSWActor* actor) DoExpDamageTest(expActor); SetExpQuake(actor); // !JIM! made rocket launcher shake things - SpawnVis(nullptr, exp->sectnum, exp->x, exp->y, exp->z, 16); + SpawnVis(nullptr, exp->sector(), exp->x, exp->y, exp->z, 16); } int SpawnBunnyExp(DSWActor* actor) @@ -10441,7 +10441,7 @@ void SpawnTankShellExp(DSWActor* actor) SpawnExpZadjust(actor, expActor, Z(40), Z(40)); DoExpDamageTest(expActor); - SpawnVis(nullptr, exp->sectnum, exp->x, exp->y, exp->z, 16); + SpawnVis(nullptr, exp->sector(), exp->x, exp->y, exp->z, 16); } @@ -10651,7 +10651,7 @@ void SpawnMicroExp(DSWActor* actor) // SpawnExpZadjust(actor, expActor, Z(20), Z(20)); - SpawnVis(nullptr, exp->sectnum, exp->x, exp->y, exp->z, 16); + SpawnVis(nullptr, exp->sector(), exp->x, exp->y, exp->z, 16); } void AddSpriteToSectorObject(DSWActor* actor, SECTOR_OBJECTp sop) @@ -10865,7 +10865,7 @@ void SpawnGrenadeExp(DSWActor* actor) DoExpDamageTest(expActor); SetExpQuake(expActor); - SpawnVis(nullptr, exp->sectnum, exp->x, exp->y, exp->z, 0); + SpawnVis(nullptr, exp->sector(), exp->x, exp->y, exp->z, 0); } void SpawnExpZadjust(DSWActor* actor, DSWActor* expActor, int upper_zsize, int lower_zsize) @@ -10950,7 +10950,7 @@ void SpawnMineExp(DSWActor* actor) // SpawnExpZadjust(actor, expActor, Z(100), Z(20)); - SpawnVis(nullptr, exp->sectnum, exp->x, exp->y, exp->z, 16); + SpawnVis(nullptr, exp->sector(), exp->x, exp->y, exp->z, 16); SetExpQuake(expActor); } @@ -11003,7 +11003,7 @@ DSWActor* SpawnSectorExp(DSWActor* actor) DoExpDamageTest(expActor); SetExpQuake(expActor); - SpawnVis(nullptr, exp->sectnum, exp->x, exp->y, exp->z, 16); + SpawnVis(nullptr, exp->sector(), exp->x, exp->y, exp->z, 16); return expActor; } @@ -11036,7 +11036,7 @@ DSWActor* SpawnLargeExp(DSWActor* actor) // Should not cause other sectors to explode DoExpDamageTest(expActor); SetExpQuake(expActor); - SpawnVis(nullptr, exp->sectnum, exp->x, exp->y, exp->z, 16); + SpawnVis(nullptr, exp->sector(), exp->x, exp->y, exp->z, 16); return expActor; } @@ -11109,7 +11109,7 @@ void SpawnLittleExp(DSWActor* actor) RESET(exp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); eu->Radius = DamageData[DMG_BASIC_EXP].radius; DoExpDamageTest(expActor); - SpawnVis(nullptr, exp->sectnum, exp->x, exp->y, exp->z, 16); + SpawnVis(nullptr, exp->sector(), exp->x, exp->y, exp->z, 16); } int DoFireball(DSWActor* actor) @@ -16841,7 +16841,7 @@ int InitSobjGun(PLAYERp pp) { case 32: case 0: - SpawnVis(actor, -1, -1, -1, -1, 8); + SpawnVis(actor, nullptr, -1, -1, -1, 8); SpawnBigGunFlames(actor, pp->Actor(), pp->sop, false); SetGunQuake(actor); InitTankShell(actor, pp); @@ -16851,7 +16851,7 @@ int InitSobjGun(PLAYERp pp) pp->FirePause = SP_TAG5(sp); break; case 1: - SpawnVis(actor, -1, -1, -1, -1, 32); + SpawnVis(actor, nullptr, -1, -1, -1, 32); SpawnBigGunFlames(actor, pp->Actor(), pp->sop, true); InitSobjMachineGun(actor, pp); if (!SP_TAG5(sp)) @@ -16861,7 +16861,7 @@ int InitSobjGun(PLAYERp pp) break; case 2: if (SW_SHAREWARE) break; - SpawnVis(actor, -1, -1, -1, -1, 32); + SpawnVis(actor, nullptr, -1, -1, -1, 32); InitTurretLaser(actor, pp); if (!SP_TAG5(sp)) pp->FirePause = 120; @@ -16870,7 +16870,7 @@ int InitSobjGun(PLAYERp pp) break; case 3: if (SW_SHAREWARE) break; - SpawnVis(actor, -1, -1, -1, -1, 32); + SpawnVis(actor, nullptr, -1, -1, -1, 32); InitTurretRail(actor, pp); if (!SP_TAG5(sp)) pp->FirePause = 120; @@ -16879,7 +16879,7 @@ int InitSobjGun(PLAYERp pp) break; case 4: if (SW_SHAREWARE) break; - SpawnVis(actor, -1, -1, -1, -1, 32); + SpawnVis(actor, nullptr, -1, -1, -1, 32); InitTurretFireball(actor, pp); if (!SP_TAG5(sp)) pp->FirePause = 20; @@ -16888,7 +16888,7 @@ int InitSobjGun(PLAYERp pp) break; case 5: if (SW_SHAREWARE) break; - SpawnVis(actor, -1, -1, -1, -1, 32); + SpawnVis(actor, nullptr, -1, -1, -1, 32); InitTurretRocket(actor, pp); if (!SP_TAG5(sp)) pp->FirePause = 100; @@ -16897,7 +16897,7 @@ int InitSobjGun(PLAYERp pp) break; case 6: if (SW_SHAREWARE) break; - SpawnVis(actor, -1, -1, -1, -1, 32); + SpawnVis(actor, nullptr, -1, -1, -1, 32); InitTurretMicro(actor, pp); if (!SP_TAG5(sp)) pp->FirePause = 100;