@@ -97,9 +97,9 @@ public Action L4D_TankRock_OnRelease(int tank, int rock, float vecPos[3], float
9797 GetClientAbsOrigin (tank , g_ReleasePos [tank ]);
9898 g_ReleasePos [tank ][2 ] += 50.0 ;
9999 }
100- float throwAng [3 ];
101- GetTankThrowAngles (tank , throwAng );
102- GetThrowVelocity (throwAng , g_ReleaseVel [tank ]);
100+ float eyeAng [3 ];
101+ GetClientEyeAngles (tank , eyeAng );
102+ GetThrowVelocity (eyeAng , g_ReleaseVel [tank ]);
103103
104104 delete g_PostReleaseTimer [tank ];
105105 DrawParabolaLongLife (g_ReleasePos [tank ], g_ReleaseVel [tank ], g_RockGravityScale [tank ], tank , duration );
@@ -118,8 +118,7 @@ Action Timer_PredictTrajectory(Handle timer, int userid) {
118118 return Plugin_Stop ;
119119 }
120120
121- float startPos [3 ], startAng [3 ], throwAng [3 ], velocity [3 ];
122- GetTankThrowAngles (client , throwAng );
121+ float startPos [3 ], startAng [3 ], eyeAng [3 ], velocity [3 ];
123122
124123 if (g_cvUseRockPosition .BoolValue ) {
125124 if (! GetAttachmentVectors (client , " debris" , startPos , startAng )) {
@@ -146,15 +145,16 @@ Action Timer_PredictTrajectory(Handle timer, int userid) {
146145 // Convert local offset to world space
147146 float tankPos [3 ], tankAngles [3 ];
148147 GetClientAbsOrigin (client , tankPos );
149- tankAngles = throwAng ;
148+ GetEntPropVector ( client , Prop_Data , " m_angRotation " , tankAngles ) ;
150149
151150 float yaw = tankAngles [1 ] * 0.017453293 ;
152151 startPos [0 ] = tankPos [0 ] + localOffset [0 ] * Cosine (yaw ) - localOffset [1 ] * Sine (yaw );
153152 startPos [1 ] = tankPos [1 ] + localOffset [0 ] * Sine (yaw ) + localOffset [1 ] * Cosine (yaw );
154153 startPos [2 ] = tankPos [2 ] + localOffset [2 ];
155154 }
156155
157- GetThrowVelocity (throwAng , velocity );
156+ GetClientEyeAngles (client , eyeAng );
157+ GetThrowVelocity (eyeAng , velocity );
158158 DrawParabola (startPos , velocity , g_RockGravityScale [client ], client );
159159
160160 // Draw start point marker when using fixed offset
@@ -165,8 +165,8 @@ Action Timer_PredictTrajectory(Handle timer, int userid) {
165165 float corners [4 ][3 ];
166166
167167 // Get view direction
168- float pitch = DegToRad (throwAng [0 ]);
169- float yaw = DegToRad (throwAng [1 ]);
168+ float pitch = DegToRad (eyeAng [0 ]);
169+ float yaw = DegToRad (eyeAng [1 ]);
170170
171171 // Right vector (perpendicular to view)
172172 float right [3 ];
@@ -292,34 +292,6 @@ void GetThrowVelocity(float angles[3], float velocity[3]) {
292292 velocity [2 ] = - Sine (pitch ) * speed ;
293293}
294294
295- // Returns the direction used by the world model for a Tank throw. The
296- // vertical aim still follows the camera, while horizontal aim follows the
297- // body's body_yaw pose parameter instead of the camera yaw.
298- bool GetTankThrowAngles (int tank , float angles [3 ]) {
299- if (tank <= 0 || tank > MaxClients || ! IsClientInGame (tank )) {
300- return false ;
301- }
302-
303- float eyeAngles [3 ];
304- GetClientEyeAngles (tank , eyeAngles );
305-
306- // L4D2 player models expose body_yaw as pose parameter 1, normalized
307- // from 0..1 over the model range -90..90 degrees.
308- float bodyYawPose = GetEntPropFloat (tank , Prop_Send , " m_flPoseParameter" , 1 );
309- float bodyYawOffset = (bodyYawPose * 180.0 ) - 90.0 ;
310-
311- angles [0 ] = eyeAngles [0 ];
312- angles [1 ] = NormalizeYaw (eyeAngles [1 ] - bodyYawOffset );
313- angles [2 ] = eyeAngles [2 ];
314- return true ;
315- }
316-
317- float NormalizeYaw (float yaw ) {
318- while (yaw > 180.0 ) yaw -= 360.0 ;
319- while (yaw < - 180.0 ) yaw += 360.0 ;
320- return yaw ;
321- }
322-
323295void DrawParabola (float startPos [3 ], float vel [3 ], float gravScale = 1.0 , int tank = 0 ) {
324296 float pos [3 ], lastPos [3 ], velocity [3 ];
325297 pos = startPos ;
0 commit comments