From 12b238b2bf133674cdec6336c9f89a6dfa783f5d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 22 Aug 2022 22:10:26 +0200 Subject: [PATCH] - the remaining SpawnActor calls. --- source/games/sw/src/weapon.cpp | 30 ++++++++++-------------------- source/games/sw/src/zombie.cpp | 2 +- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index eb6562de9..a8434e260 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -16249,18 +16249,12 @@ int InitGrenade(PLAYER* pp) int InitSpriteGrenade(DSWActor* actor) { - int nx, ny, nz; - PlaySound(DIGI_30MMFIRE, actor, v3df_dontpan|v3df_doppler); - nx = actor->int_pos().X; - ny = actor->int_pos().Y; - nz = actor->int_pos().Z - Z(40); - // Spawn a shot // Inserting and setting up variables auto actorNew = SpawnActor(STAT_MISSILE, GRENADE, &s_Grenade[0][0], actor->sector(), - nx, ny, nz, actor->int_ang(), GRENADE_VELOCITY); + actor->spr.pos.plusZ(-40), actor->spr.angle, GRENADE_VELOCITY); actorNew->user.RotNum = 5; NewStateGroup(actorNew, &sg_Grenade[0]); @@ -16375,8 +16369,7 @@ int InitEnemyMine(DSWActor* actor) // Spawn a shot // Inserting and setting up variables - auto actorNew = SpawnActor(STAT_MISSILE, MINE, s_Mine, actor->sector(), - nx, ny, nz, actor->int_ang(), MINE_VELOCITY); + auto actorNew = SpawnActor(STAT_MISSILE, MINE, s_Mine, actor->sector(), actor->spr.pos.plusZ(-40), actor->spr.angle, MINE_VELOCITY); SetOwner(actor, actorNew); actorNew->spr.yrepeat = 32; @@ -16972,7 +16965,7 @@ DSWActor* SpawnBubble(DSWActor* actor) if (Prediction) return nullptr; - auto actorNew = SpawnActor(STAT_MISSILE, BUBBLE, s_Bubble, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->int_ang(), 0); + auto actorNew = SpawnActor(STAT_MISSILE, BUBBLE, s_Bubble, actor->sector(), actor->spr.pos, actor->spr.angle, 0); actorNew->spr.xrepeat = 8 + (RANDOM_P2(8 << 8) >> 8); actorNew->spr.yrepeat = actorNew->spr.xrepeat; @@ -17009,8 +17002,7 @@ int SpawnVehicleSmoke(DSWActor* actor) if (MoveSkip2 != 0) return false; - auto actorNew = SpawnActor(STAT_MISSILE, PUFF, s_VehicleSmoke, actor->sector(), - actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - RANDOM_P2(Z(8)), actor->int_ang(), 0); + auto actorNew = SpawnActor(STAT_MISSILE, PUFF, s_VehicleSmoke, actor->sector(), actor->spr.pos.plusZ(-RANDOM_P2F(8, 8)), actor->spr.angle, 0); actorNew->user.WaitTics = 1*120; actorNew->spr.shade = -40; @@ -17035,8 +17027,7 @@ int SpawnVehicleSmoke(DSWActor* actor) int SpawnSmokePuff(DSWActor* actor) { - auto actorNew = SpawnActor(STAT_MISSILE, PUFF, s_WaterSmoke, actor->sector(), - actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - RANDOM_P2(Z(8)), actor->int_ang(), 0); + auto actorNew = SpawnActor(STAT_MISSILE, PUFF, s_WaterSmoke, actor->sector(), actor->spr.pos.plusZ(-RANDOM_P2F(8, 8)), actor->spr.angle, 0); actorNew->user.WaitTics = 1*120; actorNew->spr.shade = -40; @@ -17329,7 +17320,7 @@ int QueueFloorBlood(DSWActor* actor) KillActor(FloorBloodQueue[FloorBloodQueueHead]); FloorBloodQueue[FloorBloodQueueHead] = spawnedActor = - SpawnActor(STAT_SKIP4, FLOORBLOOD1, s_FloorBlood1, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->int_ang(), 0); + SpawnActor(STAT_SKIP4, FLOORBLOOD1, s_FloorBlood1, actor->sector(), actor->spr.pos, actor->spr.angle, 0); FloorBloodQueueHead = (FloorBloodQueueHead+1) & (MAX_FLOORBLOOD_QUEUE-1); @@ -17422,13 +17413,13 @@ int QueueFootPrint(DSWActor* actor) if (rnd_num > 683) FloorBloodQueue[FloorBloodQueueHead] = spawnedActor = - SpawnActor(STAT_WALLBLOOD_QUEUE, FOOTPRINT1, s_FootPrint1, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->int_ang(), 0); + SpawnActor(STAT_WALLBLOOD_QUEUE, FOOTPRINT1, s_FootPrint1, actor->sector(), actor->spr.pos, actor->spr.angle, 0); else if (rnd_num > 342) FloorBloodQueue[FloorBloodQueueHead] = spawnedActor = - SpawnActor(STAT_WALLBLOOD_QUEUE, FOOTPRINT2, s_FootPrint2, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->int_ang(), 0); + SpawnActor(STAT_WALLBLOOD_QUEUE, FOOTPRINT2, s_FootPrint2, actor->sector(), actor->spr.pos, actor->spr.angle, 0); else FloorBloodQueue[FloorBloodQueueHead] = spawnedActor = - SpawnActor(STAT_WALLBLOOD_QUEUE, FOOTPRINT3, s_FootPrint3, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->int_ang(), 0); + SpawnActor(STAT_WALLBLOOD_QUEUE, FOOTPRINT3, s_FootPrint3, actor->sector(), actor->spr.pos, actor->spr.angle, 0); FloorBloodQueueHead = (FloorBloodQueueHead+1) & (MAX_FLOORBLOOD_QUEUE-1); @@ -18192,8 +18183,7 @@ void QueueLoWangs(DSWActor* actor) if (LoWangsQueue[LoWangsQueueHead] == nullptr) { LoWangsQueue[LoWangsQueueHead] = spawnedActor = - SpawnActor(STAT_GENERIC_QUEUE, actor->spr.picnum, s_DeadLoWang, actor->sector(), - actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->int_ang(), 0); + SpawnActor(STAT_GENERIC_QUEUE, actor->spr.picnum, s_DeadLoWang, actor->sector(), actor->spr.pos, actor->spr.angle, 0); } else { diff --git a/source/games/sw/src/zombie.cpp b/source/games/sw/src/zombie.cpp index 1d8c65d9e..6930250a3 100644 --- a/source/games/sw/src/zombie.cpp +++ b/source/games/sw/src/zombie.cpp @@ -776,7 +776,7 @@ void SpawnZombie(PLAYER* pp, DSWActor* weaponActor) if (ownerActor == nullptr) return; - auto actorNew = SpawnActor(STAT_ENEMY, ZOMBIE_RUN_R0, s_ZombieRun[0], pp->cursector, pp->int_ppos().X, pp->int_ppos().Y, pp->int_ppos().Z, pp->angle.ang.Buildang(), 0); + auto actorNew = SpawnActor(STAT_ENEMY, ZOMBIE_RUN_R0, s_ZombieRun[0], pp->cursector, pp->pos, pp->angle.ang, 0); SetOwner(actorNew, ownerActor); actorNew->spr.pal = actorNew->user.spal = ownerActor->user.spal; actorNew->spr.angle = RANDOM_ANGLE();