feat(client): spawn bullet tracers at the current weapon skin's muzzle position
This commit is contained in:
parent
c1b5781752
commit
c51f1453cc
Sources/Client
@ -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.
|
||||
|
@ -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> clientPlayer = clientPlayers[player->GetId()];
|
||||
muzzlePos = clientPlayer->ShouldRenderInThirdPersonView()
|
||||
? clientPlayer->GetMuzzlePosition()
|
||||
: clientPlayer->GetMuzzlePositionInFirstPersonView();
|
||||
|
||||
float vel;
|
||||
switch (player.GetWeapon().GetWeaponType()) {
|
||||
case RIFLE_WEAPON: vel = 700.f; break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user