From 64b5ba8c68048d8931e58c401f5d772f3c667064 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 6 Sep 2022 18:24:49 +0200 Subject: [PATCH] - pass floating point velocities to SpawnActor Also remove the fixed point variant --- source/games/sw/src/actor.cpp | 2 +- source/games/sw/src/coolg.cpp | 2 +- source/games/sw/src/jweapon.cpp | 20 ++++---- source/games/sw/src/ninja.cpp | 4 +- source/games/sw/src/player.cpp | 6 +-- source/games/sw/src/sprite.cpp | 82 ++++++++++++++++----------------- source/games/sw/src/sprite.h | 7 +-- source/games/sw/src/track.cpp | 2 +- source/games/sw/src/weapon.cpp | 55 ++++++++++------------ source/games/sw/src/weapon.h | 42 ++++++++--------- 10 files changed, 103 insertions(+), 119 deletions(-) diff --git a/source/games/sw/src/actor.cpp b/source/games/sw/src/actor.cpp index 0cd17b448..66d7cd875 100644 --- a/source/games/sw/src/actor.cpp +++ b/source/games/sw/src/actor.cpp @@ -507,7 +507,7 @@ int DoGenerateSewerDebris(DSWActor* actor) { actor->user.Tics = actor->user.WaitTics; - auto spawned = SpawnActor(STAT_DEAD_ACTOR, 0, Debris[RANDOM_P2(4<<8)>>8], actor->sector(), actor->spr.pos, actor->spr.angle, 200); + auto spawned = SpawnActor(STAT_DEAD_ACTOR, 0, Debris[RANDOM_P2(4<<8)>>8], actor->sector(), actor->spr.pos, actor->spr.angle, 12.5); SetOwner(actor, spawned); } diff --git a/source/games/sw/src/coolg.cpp b/source/games/sw/src/coolg.cpp index 087d9ef08..88cde0630 100644 --- a/source/games/sw/src/coolg.cpp +++ b/source/games/sw/src/coolg.cpp @@ -559,7 +559,7 @@ int NewCoolg(DSWActor* actor) { ANIMATOR DoActorDecide; - auto actorNew = SpawnActor(STAT_ENEMY, COOLG_RUN_R0, &s_CoolgBirth[0], actor->sector(), actor->spr.pos, actor->spr.angle, 50); + auto actorNew = SpawnActor(STAT_ENEMY, COOLG_RUN_R0, &s_CoolgBirth[0], actor->sector(), actor->spr.pos, actor->spr.angle, 50/16.); ChangeState(actorNew, &s_CoolgBirth[0]); actorNew->user.StateEnd = s_CoolgDie; diff --git a/source/games/sw/src/jweapon.cpp b/source/games/sw/src/jweapon.cpp index 8d93194c3..fc73c7b56 100644 --- a/source/games/sw/src/jweapon.cpp +++ b/source/games/sw/src/jweapon.cpp @@ -303,7 +303,7 @@ int DoWallBloodDrip(DSWActor* actor) void SpawnMidSplash(DSWActor* actor) { auto actorNew = SpawnActor(STAT_MISSILE, GOREDrip, s_GoreSplash, actor->sector(), - DVector3(actor->spr.pos.XY(), ActorZOfMiddle(actor)), actor->spr.angle, 0); + DVector3(actor->spr.pos.XY(), ActorZOfMiddle(actor)), actor->spr.angle); actorNew->spr.shade = -12; actorNew->spr.xrepeat = 70-RandomRange(20); @@ -329,7 +329,7 @@ void SpawnMidSplash(DSWActor* actor) void SpawnFloorSplash(DSWActor* actor) { - auto actorNew = SpawnActor(STAT_MISSILE, GOREDrip, s_GoreFloorSplash, actor->sector(), actor->spr.pos, actor->spr.angle, 0); + auto actorNew = SpawnActor(STAT_MISSILE, GOREDrip, s_GoreFloorSplash, actor->sector(), actor->spr.pos, actor->spr.angle); actorNew->spr.shade = -12; actorNew->spr.xrepeat = 70-RandomRange(20); @@ -529,7 +529,7 @@ int DoBloodSpray(DSWActor* actor) if (!(actor->user.Flags & (SPR_BOUNCE | SPR_UNDERWATER))) { - auto actorNew = SpawnActor(STAT_MISSILE, GOREDrip, s_BloodSpray, actor->sector(), actor->spr.pos, actor->spr.angle, 100); + auto actorNew = SpawnActor(STAT_MISSILE, GOREDrip, s_BloodSpray, actor->sector(), actor->spr.pos, actor->spr.angle, 6.25); SetOwner(actor, actorNew); actorNew->spr.shade = -12; @@ -726,7 +726,7 @@ int DoPhosphorus(DSWActor* actor) if (!(actor->user.Flags & (SPR_BOUNCE | SPR_UNDERWATER)) && !(actor->spr.cstat & CSTAT_SPRITE_INVISIBLE)) { - auto actorNew = SpawnActor(STAT_SKIP4, PUFF, s_PhosphorExp, actor->sector(), actor->spr.pos, actor->spr.angle, 100); + auto actorNew = SpawnActor(STAT_SKIP4, PUFF, s_PhosphorExp, actor->sector(), actor->spr.pos, actor->spr.angle, 6.25); actorNew->spr.hitag = LUMINOUS; // Always full brightness SetOwner(actor, actorNew); @@ -948,7 +948,7 @@ int DoChemBomb(DSWActor* actor) // if you haven't bounced or your going slow do some puffs if (!(actor->user.Flags & (SPR_BOUNCE | SPR_UNDERWATER)) && !(actor->spr.cstat & CSTAT_SPRITE_INVISIBLE)) { - auto actorNew = SpawnActor(STAT_MISSILE, PUFF, s_Puff, actor->sector(), actor->spr.pos, actor->spr.angle, 100); + auto actorNew = SpawnActor(STAT_MISSILE, PUFF, s_Puff, actor->sector(), actor->spr.pos, actor->spr.angle, 6.25); SetOwner(actor, actorNew); actorNew->spr.shade = -40; @@ -1183,7 +1183,7 @@ int SpawnRadiationCloud(DSWActor* actor) return -1; auto actorNew = SpawnActor(STAT_MISSILE, RADIATION_CLOUD, s_RadiationCloud, actor->sector(), - actor->spr.pos.plusZ(-RANDOM_P2F(8, 8)), actor->spr.angle, 0); + actor->spr.pos.plusZ(-RANDOM_P2F(8, 8)), actor->spr.angle); SetOwner(GetOwner(actor), actorNew); actorNew->user.WaitTics = 1 * 120; @@ -1582,7 +1582,7 @@ void SpawnFlashBombOnActor(DSWActor* actor) } auto actorNew = SpawnActor(STAT_MISSILE, FIREBALL_FLAMES, s_FireballFlames, actor->sector(), - actor->spr.pos, actor->spr.angle, 0); + actor->spr.pos, actor->spr.angle); if (actor != nullptr) actor->user.flameActor = actorNew; @@ -1629,7 +1629,7 @@ int PlayerInitCaltrops(PLAYER* pp) auto pos = pp->pos.plusZ(pp->bob_z + 8); - auto actorNew = SpawnActor(STAT_DEAD_ACTOR, CALTROPS, s_Caltrops, pp->cursector, pos, pp->angle.ang, (CHEMBOMB_VELOCITY + RandomRange(CHEMBOMB_VELOCITY)) / 2); + auto actorNew = SpawnActor(STAT_DEAD_ACTOR, CALTROPS, s_Caltrops, pp->cursector, pos, pp->angle.ang, (CHEMBOMB_VELOCITY + RandomRangeF(CHEMBOMB_VELOCITY)) / 2); // don't throw it as far if crawling if (pp->Flags & (PF_CRAWLING)) @@ -1795,7 +1795,7 @@ int InitBloodSpray(DSWActor* actor, bool dogib, short velocity) // Spawn a shot auto actorNew = SpawnActor(STAT_MISSILE, GOREDrip, s_BloodSprayChunk, actor->sector(), - ActorVectOfTop(actor).plusZ(- 20/256.), ang, vel*2); + ActorVectOfTop(actor).plusZ(- 20/256.), ang, vel / 8.); actorNew->user.Flags |= (SPR_XFLIP_TOGGLE); if (dogib) @@ -2192,7 +2192,7 @@ int SpawnShell(DSWActor* actor, int ShellNum) break; } - auto actorNew = SpawnActor(STAT_SKIP4, id, p, actor->sector(), ActorVectOfMiddle(actor), actor->spr.angle, 64); + auto actorNew = SpawnActor(STAT_SKIP4, id, p, actor->sector(), ActorVectOfMiddle(actor), actor->spr.angle, 4); actorNew->vel.Z = -velocity; diff --git a/source/games/sw/src/ninja.cpp b/source/games/sw/src/ninja.cpp index dfe5d6965..14e1752e7 100644 --- a/source/games/sw/src/ninja.cpp +++ b/source/games/sw/src/ninja.cpp @@ -2393,7 +2393,7 @@ void InitPlayerSprite(PLAYER* pp) COVER_SetReverb(0); // Turn off any echoing that may have been going before pp->Reverb = 0; - auto actor = SpawnActor(STAT_PLAYER0 + pnum, NINJA_RUN_R0, nullptr, pp->cursector, pp->pos, pp->angle.ang, 0); + auto actor = SpawnActor(STAT_PLAYER0 + pnum, NINJA_RUN_R0, nullptr, pp->cursector, pp->pos, pp->angle.ang); pp->actor = actor; pp->pnum = pnum; @@ -2467,7 +2467,7 @@ void SpawnPlayerUnderSprite(PLAYER* pp) int pnum = int(pp - Player); pp->PlayerUnderActor = SpawnActor(STAT_PLAYER_UNDER0 + pnum, - NINJA_RUN_R0, nullptr, pp->cursector, pp->pos, pp->angle.ang, 0); + NINJA_RUN_R0, nullptr, pp->cursector, pp->pos, pp->angle.ang); DSWActor* actor = pp->PlayerUnderActor; diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 7b3deca9a..011f9f28f 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -1346,7 +1346,7 @@ void DoSpawnTeleporterEffect(DSWActor* actor) DVector2 vect = actor->spr.angle.ToVector() * 32; auto effectActor = SpawnActor(STAT_MISSILE, 0, s_TeleportEffect, actor->sector(), - ActorVectOfTop(actor).plusZ(16) + vect, actor->spr.angle, 0); + ActorVectOfTop(actor).plusZ(16) + vect, actor->spr.angle); SetActorZ(effectActor, effectActor->spr.pos); @@ -1368,7 +1368,7 @@ void DoSpawnTeleporterEffectPlace(DSWActor* actor) { extern STATE s_TeleportEffect[]; - auto effectActor = SpawnActor(STAT_MISSILE, 0, s_TeleportEffect, actor->sector(), ActorVectOfTop(actor).plusZ(16), actor->spr.angle, 0); + auto effectActor = SpawnActor(STAT_MISSILE, 0, s_TeleportEffect, actor->sector(), ActorVectOfTop(actor).plusZ(16), actor->spr.angle); SetActorZ(effectActor, effectActor->spr.pos); @@ -7406,7 +7406,7 @@ void InitMultiPlayerInfo(void) continue; } - auto start0 = SpawnActor(MultiStatList[stat], ST1, nullptr, pp->cursector, pp->pos, pp->angle.ang, 0); + auto start0 = SpawnActor(MultiStatList[stat], ST1, nullptr, pp->cursector, pp->pos, pp->angle.ang); start0->clearUser(); start0->spr.picnum = ST1; } diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index f2aac38a0..7166a3af7 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -907,7 +907,7 @@ void SpawnUser(DSWActor* actor, short id, STATE* state) // //--------------------------------------------------------------------------- -DSWActor* SpawnActor(int stat, int id, STATE* state, sectortype* sect, const DVector3& pos, DAngle init_ang, int vel) +DSWActor* SpawnActor(int stat, int id, STATE* state, sectortype* sect, const DVector3& pos, DAngle init_ang, double vel) { if (sect == nullptr) return nullptr; @@ -930,7 +930,7 @@ DSWActor* SpawnActor(int stat, int id, STATE* state, sectortype* sect, const DVe spawnedActor->spr.xrepeat = 64; spawnedActor->spr.yrepeat = 64; spawnedActor->spr.angle = init_ang; - spawnedActor->set_int_xvel(vel); + spawnedActor->vel.X = vel; return spawnedActor; } @@ -3896,7 +3896,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_REPAIR_KIT)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_REPAIR_KIT, s_RepairKit, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_REPAIR_KIT, s_RepairKit, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -3907,7 +3907,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_STAR)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_STAR, s_IconStar, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_STAR, s_IconStar, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -3918,7 +3918,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_LG_MINE)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_LG_MINE, s_IconLgMine, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_LG_MINE, s_IconLgMine, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -3929,7 +3929,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_MICRO_GUN)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_MICRO_GUN, s_IconMicroGun, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_MICRO_GUN, s_IconMicroGun, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -3940,7 +3940,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_MICRO_BATTERY)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_MICRO_BATTERY, s_IconMicroBattery, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_MICRO_BATTERY, s_IconMicroBattery, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -3951,7 +3951,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_GRENADE_LAUNCHER)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_GRENADE_LAUNCHER, s_IconGrenadeLauncher, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_GRENADE_LAUNCHER, s_IconGrenadeLauncher, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -3962,7 +3962,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_LG_GRENADE)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_LG_GRENADE, s_IconLgGrenade, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_LG_GRENADE, s_IconLgGrenade, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -3973,7 +3973,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_RAIL_GUN)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_RAIL_GUN, s_IconRailGun, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_RAIL_GUN, s_IconRailGun, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -3984,7 +3984,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_RAIL_AMMO)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_RAIL_AMMO, s_IconRailAmmo, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_RAIL_AMMO, s_IconRailAmmo, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -3995,7 +3995,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_ROCKET)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_ROCKET, s_IconRocket, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_ROCKET, s_IconRocket, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -4006,7 +4006,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_SHOTGUN)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_SHOTGUN, s_IconShotgun, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_SHOTGUN, s_IconShotgun, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -4017,7 +4017,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_LG_SHOTSHELL)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_LG_SHOTSHELL, s_IconLgShotshell, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_LG_SHOTSHELL, s_IconLgShotshell, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -4028,7 +4028,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_GUARD_HEAD)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_GUARD_HEAD, s_IconGuardHead, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_GUARD_HEAD, s_IconGuardHead, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -4039,7 +4039,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_FIREBALL_LG_AMMO)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_FIREBALL_LG_AMMO, s_IconFireballLgAmmo, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_FIREBALL_LG_AMMO, s_IconFireballLgAmmo, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -4050,7 +4050,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_HEART)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_HEART, s_IconHeart, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_HEART, s_IconHeart, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -4061,7 +4061,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_HEART_LG_AMMO)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_HEART_LG_AMMO, s_IconHeartLgAmmo, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_HEART_LG_AMMO, s_IconHeartLgAmmo, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -4073,7 +4073,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_ARMOR)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_ARMOR, s_IconArmor, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_ARMOR, s_IconArmor, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -4090,7 +4090,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_MEDKIT)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_MEDKIT, s_IconMedkit, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_MEDKIT, s_IconMedkit, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -4101,7 +4101,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_SM_MEDKIT)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_SM_MEDKIT, s_IconSmMedkit, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_SM_MEDKIT, s_IconSmMedkit, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -4112,7 +4112,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_CHEMBOMB)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_CHEMBOMB, s_IconChemBomb, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_CHEMBOMB, s_IconChemBomb, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -4123,7 +4123,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_FLASHBOMB)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_FLASHBOMB, s_IconFlashBomb, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_FLASHBOMB, s_IconFlashBomb, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -4134,7 +4134,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_NUKE)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_NUKE, s_IconNuke, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_NUKE, s_IconNuke, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -4145,7 +4145,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_CALTROPS)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_CALTROPS, s_IconCaltrops, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_CALTROPS, s_IconCaltrops, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -4156,7 +4156,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_BOOSTER)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_BOOSTER, s_IconBooster, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_BOOSTER, s_IconBooster, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -4167,7 +4167,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_HEAT_CARD)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_HEAT_CARD, s_IconHeatCard, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_HEAT_CARD, s_IconHeatCard, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -4178,7 +4178,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_CLOAK)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_CLOAK, s_IconCloak, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_CLOAK, s_IconCloak, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -4189,7 +4189,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_NIGHT_VISION)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_NIGHT_VISION, s_IconNightVision, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_NIGHT_VISION, s_IconNightVision, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -4201,7 +4201,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_LG_UZI_AMMO)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_LG_UZI_AMMO, s_IconLgUziAmmo, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_LG_UZI_AMMO, s_IconLgUziAmmo, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -4212,7 +4212,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_GUARD_HEAD)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_GUARD_HEAD, s_IconGuardHead, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_GUARD_HEAD, s_IconGuardHead, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -4223,7 +4223,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_HEART)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_HEART, s_IconHeart, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_HEART, s_IconHeart, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -4235,7 +4235,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_UZIFLOOR)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_UZIFLOOR, s_IconUziFloor, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_UZIFLOOR, s_IconUziFloor, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -4249,7 +4249,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, ICON_UZI)) break; - spawnedActor = SpawnActor(STAT_ITEM, ICON_UZI, s_IconUzi, itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, ICON_UZI, s_IconUzi, itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->user.Flags2 |= SPR2_NEVER_RESPAWN; IconDefault(spawnedActor); @@ -4295,7 +4295,7 @@ int SpawnItemsMatch(short match) if (!ItemSpotClear(itActor, STAT_ITEM, s_Key[num]->Pic)) break; - spawnedActor = SpawnActor(STAT_ITEM, s_Key[num]->Pic, s_Key[num], itActor->sector(), itActor->spr.pos, itActor->spr.angle, 0); + spawnedActor = SpawnActor(STAT_ITEM, s_Key[num]->Pic, s_Key[num], itActor->sector(), itActor->spr.pos, itActor->spr.angle); spawnedActor->spr.picnum = spawnedActor->user.ID = s_Key[num]->Pic; @@ -4951,7 +4951,7 @@ int KillGet(DSWActor* actor) if (!gNet.SpawnMarkers || actor->spr.hitag == TAG_NORESPAWN_FLAG) // No coin if it's a special flag break; - auto actorNew = SpawnActor(STAT_ITEM, Red_COIN, s_RedCoin, actor->sector(), actor->spr.pos, nullAngle, 0); + auto actorNew = SpawnActor(STAT_ITEM, Red_COIN, s_RedCoin, actor->sector(), actor->spr.pos, nullAngle); actorNew->spr.shade = -20; actorNew->user.WaitTics = actor->user.WaitTics - 12; @@ -4999,7 +4999,7 @@ int KillGetAmmo(DSWActor* actor) if (!gNet.SpawnMarkers) break; - auto actorNew = SpawnActor(STAT_ITEM, Red_COIN, s_RedCoin, actor->sector(), actor->spr.pos, nullAngle, 0); + auto actorNew = SpawnActor(STAT_ITEM, Red_COIN, s_RedCoin, actor->sector(), actor->spr.pos, nullAngle); actorNew->spr.shade = -20; actorNew->user.WaitTics = actor->user.WaitTics - 12; @@ -5055,7 +5055,7 @@ int KillGetWeapon(DSWActor* actor) if (!gNet.SpawnMarkers) break; - auto actorNew = SpawnActor(STAT_ITEM, Red_COIN, s_RedCoin, actor->sector(), actor->spr.pos, nullAngle, 0); + auto actorNew = SpawnActor(STAT_ITEM, Red_COIN, s_RedCoin, actor->sector(), actor->spr.pos, nullAngle); actorNew->spr.shade = -20; actorNew->user.WaitTics = actor->user.WaitTics - 12; @@ -5075,7 +5075,7 @@ int DoSpawnItemTeleporterEffect(DSWActor* actor) { extern STATE s_TeleportEffect[]; - auto effect = SpawnActor(STAT_MISSILE, 0, s_TeleportEffect, actor->sector(), actor->spr.pos.plusZ(-12), actor->spr.angle, 0); + auto effect = SpawnActor(STAT_MISSILE, 0, s_TeleportEffect, actor->sector(), actor->spr.pos.plusZ(-12), actor->spr.angle); effect->spr.shade = -40; effect->spr.xrepeat = effect->spr.yrepeat = 36; @@ -6008,9 +6008,9 @@ KeyMain: DSWActor* actorNew; if (actor->spr.hitag == TAG_NORESPAWN_FLAG) - actorNew = SpawnActor(STAT_ITEM, ICON_FLAG, s_CarryFlagNoDet, actor->sector(), actor->spr.pos, nullAngle, 0); + actorNew = SpawnActor(STAT_ITEM, ICON_FLAG, s_CarryFlagNoDet, actor->sector(), actor->spr.pos, nullAngle); else - actorNew = SpawnActor(STAT_ITEM, ICON_FLAG, s_CarryFlag, actor->sector(), actor->spr.pos, nullAngle, 0); + actorNew = SpawnActor(STAT_ITEM, ICON_FLAG, s_CarryFlag, actor->sector(), actor->spr.pos, nullAngle); actorNew->spr.shade = -20; diff --git a/source/games/sw/src/sprite.h b/source/games/sw/src/sprite.h index ab8c640f3..09ef0a5ee 100644 --- a/source/games/sw/src/sprite.h +++ b/source/games/sw/src/sprite.h @@ -31,12 +31,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS void KillActor(DSWActor* actor); -DSWActor* SpawnActor(int stat, int id, STATE* state, sectortype* sect, const DVector3& pos, DAngle ang, int vel); -inline DSWActor* SpawnActor(int stat, int id, STATE* state, sectortype* sect, int x, int y, int z, int ang, int vel) -{ - auto vec= DVector3(x * inttoworld, y * inttoworld, z * zinttoworld); - return SpawnActor(stat, id, state, sect, vec, DAngle::fromBuild(ang), vel); -} +DSWActor* SpawnActor(int stat, int id, STATE* state, sectortype* sect, const DVector3& pos, DAngle ang, double vel = 0); void SpriteSetup(void); int move_actor(DSWActor* actor, const DVector3& change); diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index 8d081d10e..2ab866815 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -985,7 +985,7 @@ void SetupSectorObject(sectortype* sectp, short tag) sop->track = sectp->hitag; // spawn a sprite to make it easier to integrate with sprite routines - auto actorNew = SpawnActor(STAT_SO_SP_CHILD, 0, nullptr, sectp, sop->pmid, nullAngle, 0); + auto actorNew = SpawnActor(STAT_SO_SP_CHILD, 0, nullptr, sectp, sop->pmid, nullAngle); sop->sp_child = actorNew; actorNew->user.sop_parent = sop; actorNew->user.Flags2 |= (SPR2_SPRITE_FAKE_BLOCK); // for damage test diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index f3c987317..b6d75167b 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -8284,7 +8284,7 @@ int DoGrenade(DSWActor* actor) if (!(actor->user.Flags & (SPR_BOUNCE|SPR_UNDERWATER))) { auto actorNew = SpawnActor(STAT_MISSILE, PUFF, s_Puff, actor->sector(), - actor->spr.pos, actor->spr.angle, 100); + actor->spr.pos, actor->spr.angle, 6.25); SetOwner(actor, actorNew); actorNew->spr.shade = -40; @@ -9106,7 +9106,7 @@ int DoRail(DSWActor* actor) spawn_count++; if (spawn_count < 128) { - auto actorNew = SpawnActor(STAT_MISSILE, PUFF, &s_RailPuff[0][0], actor->sector(), actor->spr.pos, actor->spr.angle, 20); + auto actorNew = SpawnActor(STAT_MISSILE, PUFF, &s_RailPuff[0][0], actor->sector(), actor->spr.pos, actor->spr.angle, 1.25); actorNew->add_int_xvel( (RandomRange(140)-RandomRange(140))); actorNew->add_int_zvel( (RandomRange(140)-RandomRange(140))); @@ -9155,8 +9155,6 @@ int DoRailStart(DSWActor* actor) int DoRocket(DSWActor* actor) { int dist,a,b,c; - auto pos = actor->int_pos(); - if ((actor->user.FlagOwner -= ACTORMOVETICS)<=0 && actor->user.spal == 20) { @@ -9201,8 +9199,7 @@ int DoRocket(DSWActor* actor) if (!actor->user.Counter) { - auto actorNew = SpawnActor(STAT_MISSILE, PUFF, s_Puff, actor->sector(), - pos.X, pos.Y, pos.Z, actor->int_ang(), 100); + auto actorNew = SpawnActor(STAT_MISSILE, PUFF, s_Puff, actor->sector(), actor->spr.pos, actor->spr.angle, 6.25); SetOwner(actor, actorNew); actorNew->spr.shade = -40; @@ -9248,8 +9245,7 @@ int DoMicroMini(DSWActor* actor) int SpawnExtraMicroMini(DSWActor* actor) { - auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R0, &s_Micro[0][0], actor->sector(), - actor->spr.pos, actor->spr.angle, actor->int_xvel()); + auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R0, &s_Micro[0][0], actor->sector(), actor->spr.pos, actor->spr.angle, actor->vel.X); SetOwner(GetOwner(actor), actorNew); actorNew->spr.yrepeat = actorNew->spr.xrepeat = actor->spr.xrepeat; @@ -9286,7 +9282,7 @@ int DoMicro(DSWActor* actor) if (!actor->user.Counter) { auto actorNew = SpawnActor(STAT_MISSILE, PUFF, s_Puff, actor->sector(), - actor->spr.pos, actor->spr.angle, 100); + actor->spr.pos, actor->spr.angle, 6.25); SetOwner(GetOwner(actor), actorNew); actorNew->spr.shade = -40; @@ -9846,7 +9842,7 @@ void SpawnNuclearSecondaryExp(DSWActor* actor, short ang) { ASSERT(actor->hasU()); - auto expActor = SpawnActor(STAT_MISSILE, GRENADE_EXP, s_GrenadeExp, actor->sector(), actor->spr.pos, actor->spr.angle, 512); + auto expActor = SpawnActor(STAT_MISSILE, GRENADE_EXP, s_GrenadeExp, actor->sector(), actor->spr.pos, actor->spr.angle, 32); expActor->spr.hitag = LUMINOUS; //Always full brightness SetOwner(GetOwner(actor), expActor); @@ -10106,7 +10102,7 @@ void SpawnGrenadeSecondaryExp(DSWActor* actor, int ang) int vel; ASSERT(actor->hasU()); - auto expActor = SpawnActor(STAT_MISSILE, GRENADE_EXP, s_GrenadeSmallExp, actor->sector(), actor->spr.pos, actor->spr.angle, 1024); + auto expActor = SpawnActor(STAT_MISSILE, GRENADE_EXP, s_GrenadeSmallExp, actor->sector(), actor->spr.pos, actor->spr.angle, 64); expActor->spr.hitag = LUMINOUS; //Always full brightness SetOwner(GetOwner(actor), expActor); @@ -10808,7 +10804,7 @@ int DoMirv(DSWActor* actor) for (i = 0; i < 2; i++) { auto actorNew = SpawnActor(STAT_MISSILE, MIRV_METEOR, &sg_MirvMeteor[0][0], actor->sector(), - actor->spr.pos, actor->spr.angle + DAngle::fromBuild(angs[i]), 800); + actor->spr.pos, actor->spr.angle + DAngle::fromBuild(angs[i]), 50); actorNew->user.RotNum = 5; NewStateGroup(actorNew, &sg_MirvMeteor[0]); @@ -11239,7 +11235,7 @@ void InitVulcanBoulder(DSWActor* actor) vel = 800; // Spawn a shot - auto actorNew = SpawnActor(STAT_MISSILE, LAVA_BOULDER, s_VulcanBoulder, actor->sector(), actor->spr.pos.plusZ(-40), nang, (vel/2 + vel/4) + RandomRange(vel/4)); + auto actorNew = SpawnActor(STAT_MISSILE, LAVA_BOULDER, s_VulcanBoulder, actor->sector(), actor->spr.pos.plusZ(-40), nang, ((vel/2 + vel/4) + RandomRange(vel/4)) / 16.); SetOwner(actor, actorNew); actorNew->spr.xrepeat = actorNew->spr.yrepeat = 8 + RandomRange(72); @@ -12358,7 +12354,7 @@ int InitStar(PLAYER* pp) for (size_t i = 0; i < countof(dang); i++) { - auto actorNew2 = SpawnActor(STAT_MISSILE, STAR1, s_Star, pp->cursector,pos, actorNew->spr.angle + dang[i], actorNew->int_xvel()); + auto actorNew2 = SpawnActor(STAT_MISSILE, STAR1, s_Star, pp->cursector,pos, actorNew->spr.angle + dang[i], actorNew->vel.X); SetOwner(GetOwner(actorNew), actorNew2); actorNew2->spr.yrepeat = actorNew2->spr.xrepeat = STAR_REPEAT; @@ -12705,7 +12701,7 @@ int InitLaser(PLAYER* pp) // Spawn a shot // Inserting and setting up variables - auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R0, s_Laser, pp->cursector, pos, pp->angle.ang, 300); + auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R0, s_Laser, pp->cursector, pos, pp->angle.ang, 18.75); actorNew->spr.hitag = LUMINOUS; //Always full brightness SetOwner(pp->actor, actorNew); @@ -12801,7 +12797,7 @@ int InitRail(PLAYER* pp) // Spawn a shot // Inserting and setting up variables - auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R1, &s_Rail[0][0], pp->cursector, pos, pp->angle.ang, 1200); + auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R1, &s_Rail[0][0], pp->cursector, pos, pp->angle.ang, 75); SetOwner(pp->actor, actorNew); @@ -12870,7 +12866,7 @@ int InitZillaRail(DSWActor* actor) // Spawn a shot // Inserting and setting up variables - auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R1, &s_Rail[0][0], actor->sector(), pos, actor->spr.angle, 1200); + auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R1, &s_Rail[0][0], actor->sector(), pos, actor->spr.angle, 75); SetOwner(actor, actorNew); actorNew->spr.yrepeat = 52; @@ -13156,7 +13152,7 @@ int InitNuke(PLAYER* pp) // Spawn a shot // Inserting and setting up variables - auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R0, &s_Rocket[0][0], pp->cursector, pos, pp->angle.ang, 700); + auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R0, &s_Rocket[0][0], pp->cursector, pos, pp->angle.ang, 700/16.); SetOwner(pp->actor, actorNew); actorNew->spr.yrepeat = 128; @@ -13234,8 +13230,7 @@ int InitEnemyNuke(DSWActor* actor) // Spawn a shot nz = actor->int_pos().Z + Z(40); - auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R0, &s_Rocket[0][0], actor->sector(), - nx, ny, nz, actor->int_ang(), 700); + auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R0, &s_Rocket[0][0], actor->sector(), actor->spr.pos.plusZ(40), actor->spr.angle, 700/16.); if (actor->user.ID == ZOMBIE_RUN_R0) SetOwner(GetOwner(actor), actorNew); @@ -13334,7 +13329,7 @@ int InitMicro(PLAYER* pp) // Spawn a shot // Inserting and setting up variables - auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R0, &s_Micro[0][0], pp->cursector, pos, angle, 1200); + auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R0, &s_Micro[0][0], pp->cursector, pos, angle, 75); SetOwner(pp->actor, actorNew); actorNew->spr.yrepeat = 24; @@ -13699,7 +13694,7 @@ int InitSerpSpell(DSWActor* actor) { actor->spr.angle = VecToAngle(actor->user.targetActor->spr.pos.XY() - actor->spr.pos.XY()); - auto actorNew = SpawnActor(STAT_MISSILE, SERP_METEOR, &sg_SerpMeteor[0][0], actor->sector(), actor->spr.pos, actor->spr.angle, 1500); + auto actorNew = SpawnActor(STAT_MISSILE, SERP_METEOR, &sg_SerpMeteor[0][0], actor->sector(), actor->spr.pos, actor->spr.angle, 93.75); actorNew->spr.pos.Z = ActorZOfTop(actor); @@ -13791,7 +13786,7 @@ int InitSerpMonstSpell(DSWActor* actor) { actor->spr.angle = VecToAngle(actor->user.targetActor->spr.pos.XY() - actor->spr.pos.XY()); - auto actorNew = SpawnActor(STAT_MISSILE, SERP_METEOR, &sg_SerpMeteor[0][0], actor->sector(), actor->spr.pos, actor->spr.angle, 500); + auto actorNew = SpawnActor(STAT_MISSILE, SERP_METEOR, &sg_SerpMeteor[0][0], actor->sector(), actor->spr.pos, actor->spr.angle, 31.25); actorNew->user.spal = actorNew->spr.pal = 25; // Bright Red actorNew->spr.pos.Z = ActorZOfTop(actor); @@ -13930,7 +13925,7 @@ int InitEnemyRail(DSWActor* actor) // Inserting and setting up variables auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R1, &s_Rail[0][0], actor->sector(), - actor->spr.pos.plusZ(-(ActorSizeZ(actor) * 0.5) - 8), actor->spr.angle, 1200); + actor->spr.pos.plusZ(-(ActorSizeZ(actor) * 0.5) - 8), actor->spr.angle, 75); if (actor->user.ID == ZOMBIE_RUN_R0) SetOwner(GetOwner(actor), actorNew); @@ -14074,7 +14069,7 @@ int InitEnemyCrossbow(DSWActor* actor) // Spawn a shot auto actorNew = SpawnActor(STAT_MISSILE, CROSSBOLT, &s_CrossBolt[0][0], actor->sector(), - ActorVectOfMiddle(actor).plusZ(-14), actor->user.targetActor->spr.angle, 800); + ActorVectOfMiddle(actor).plusZ(-14), actor->user.targetActor->spr.angle, 50); SetOwner(actor, actorNew); actorNew->spr.xrepeat = 16; @@ -14329,7 +14324,7 @@ void InitBoltTrap(DSWActor* actor) void InitSpearTrap(DSWActor* actor) { // Spawn a shot - auto actorNew = SpawnActor(STAT_MISSILE, CROSSBOLT, &s_CrossBolt[0][0], actor->sector(), ActorVectOfMiddle(actor), actor->spr.angle, 750); + auto actorNew = SpawnActor(STAT_MISSILE, CROSSBOLT, &s_CrossBolt[0][0], actor->sector(), ActorVectOfMiddle(actor), actor->spr.angle, 750/16.); SetOwner(actor, actorNew); actorNew->spr.xrepeat = 16; @@ -14896,7 +14891,7 @@ int InitTurretMicro(DSWActor* actor, PLAYER* pp) // Inserting and setting up variables auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R0, &s_Micro[0][0], actor->sector(), - nx, ny, nz, ang, 1200); + actor->spr.pos.plusZ(10 + RandomRangeF(20)), DAngle::fromBuild(ang), 75); SetOwner(plActor, actorNew); actorNew->spr.yrepeat = 24; @@ -15028,7 +15023,7 @@ int InitTurretRail(DSWActor* actor, PLAYER* pp) // Spawn a shot // Inserting and setting up variables - auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R1, &s_Rail[0][0], pp->cursector, actor->spr.pos, actor->spr.angle, 1200); + auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R1, &s_Rail[0][0], pp->cursector, actor->spr.pos, actor->spr.angle, 75); SetOwner(pp->actor, actorNew); actorNew->spr.yrepeat = 52; @@ -15068,7 +15063,7 @@ int InitTurretLaser(DSWActor* actor, PLAYER* pp) // Spawn a shot // Inserting and setting up variables - auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R0, s_Laser, pp->cursector, actor->spr.pos, actor->spr.angle, 300); + auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R0, s_Laser, pp->cursector, actor->spr.pos, actor->spr.angle, 18.75); SetOwner(pp->actor, actorNew); actorNew->spr.yrepeat = 52; @@ -16093,7 +16088,7 @@ int InitEnemyFireball(DSWActor* actor) for (i = 0; i < 2; i++) { auto actorNew = SpawnActor(STAT_MISSILE, GORO_FIREBALL, s_Fireball, actor->sector(), - actor->int_pos().X, actor->int_pos().Y, nz, actor->int_ang(), int(GORO_FIREBALL_VELOCITY * worldtoint)); + DVector3(actor->spr.pos, nz * zinttoworld), actor->spr.angle, GORO_FIREBALL_VELOCITY); actorNew->spr.hitag = LUMINOUS; //Always full brightness actorNew->spr.xrepeat = 20; diff --git a/source/games/sw/src/weapon.h b/source/games/sw/src/weapon.h index 5b951bd62..299596631 100644 --- a/source/games/sw/src/weapon.h +++ b/source/games/sw/src/weapon.h @@ -111,37 +111,31 @@ const char *DeathString(DSWActor*); #define DAMAGE_BLADE_TIME (10) // Player Missile Speeds -#define STAR_VELOCITY (1800) -#define BOLT_VELOCITY (900) -#define ROCKET_VELOCITY (1350) -#define BOLT_SEEKER_VELOCITY (820) -#define FIREBALL_VELOCITY (2000) -#define ELECTRO_VELOCITY (800) -#define PLASMA_VELOCITY (1000) -#define UZI_BULLET_VELOCITY (2500) -#define TRACER_VELOCITY (1200) -#define TANK_SHELL_VELOCITY (1200) -#define GRENADE_VELOCITY (900) -#define MINE_VELOCITY (520) // Was 420 -#define CHEMBOMB_VELOCITY (420) +constexpr double STAR_VELOCITY = (1800) / 16.; +constexpr double ROCKET_VELOCITY = (1350) / 16.; +constexpr double FIREBALL_VELOCITY = 125; + +constexpr double TRACER_VELOCITY = (1200)/ 16.; +constexpr double TANK_SHELL_VELOCITY = (1200)/ 16.; +constexpr double GRENADE_VELOCITY = (900) / 16.; +constexpr double MINE_VELOCITY = (520) / 16.; // Was 420 +constexpr double CHEMBOMB_VELOCITY = (420 /16.); // Player Spell Missile Speeds -#define BLOOD_WORM_VELOCITY (800) -#define NAPALM_VELOCITY (800) -#define MIRV_VELOCITY (600) -#define SPIRAL_VELOCITY (600) +constexpr double BLOOD_WORM_VELOCITY = (800 / 16.); +constexpr double NAPALM_VELOCITY = (800 / 16.); +constexpr double MIRV_VELOCITY = (600 / 16.); // Trap Speeds -#define BOLT_TRAP_VELOCITY (950) -#define SPEAR_TRAP_VELOCITY (650) -#define FIREBALL_TRAP_VELOCITY (750) +constexpr double BOLT_TRAP_VELOCITY = (950 / 16.); +constexpr double FIREBALL_TRAP_VELOCITY = (750 / 16.); // NPC Missile Speeds -#define NINJA_STAR_VELOCITY (1800) -#define NINJA_BOLT_VELOCITY (500) +constexpr double NINJA_STAR_VELOCITY = (1800 / 16.); +constexpr double NINJA_BOLT_VELOCITY = (500 / 16.); +constexpr double SKEL_ELECTRO_VELOCITY = (850 / 16.); +constexpr double COOLG_FIRE_VELOCITY = (400 / 16.); constexpr int GORO_FIREBALL_VELOCITY = 50; -#define SKEL_ELECTRO_VELOCITY (850) -#define COOLG_FIRE_VELOCITY (400) #define GRENADE_RECOIL_AMT (12) #define ROCKET_RECOIL_AMT (7)