diff --git a/Sources/Client/ClientPlayer.h b/Sources/Client/ClientPlayer.h index 70f1bb31..cb29bfa1 100644 --- a/Sources/Client/ClientPlayer.h +++ b/Sources/Client/ClientPlayer.h @@ -89,8 +89,6 @@ namespace spades { float GetLocalFireVibration(); - bool ShouldRenderInThirdPersonView(); - // TODO: Naming convention violation asIScriptObject *initScriptFactory(ScriptFunction &creator, IRenderer &renderer, IAudioDevice &audio); @@ -114,6 +112,8 @@ namespace spades { float GetAimDownState() { return aimDownState; } float GetSprintState() { return sprintState; } + bool ShouldRenderInThirdPersonView(); + /** * Get the world coordinates representing the position of the currently wielded weapon's * muzzle. diff --git a/Sources/Client/Client_Update.cpp b/Sources/Client/Client_Update.cpp index ca07115a..0d3ff1c5 100644 --- a/Sources/Client/Client_Update.cpp +++ b/Sources/Client/Client_Update.cpp @@ -1110,6 +1110,15 @@ namespace spades { return; } + // The line segment containing `muzzlePos` and `hitPos` represents the accurate + // trajectory of the fired bullet (as far as the game physics is concerned), but + // displaying it as-is would make it seem like it was fired from a skull gun. Rewrite + // the starting point with the muzzle point of the current weapon skin. + Handle clientPlayer = clientPlayers[player->GetId()]; + muzzlePos = clientPlayer->ShouldRenderInThirdPersonView() + ? clientPlayer->GetMuzzlePosition() + : clientPlayer->GetMuzzlePositionInFirstPersonView(); + float vel; switch (player.GetWeapon().GetWeaponType()) { case RIFLE_WEAPON: vel = 700.f; break;