1-
21#include " cbase.h"
32#include " hud.h"
43#include " hud_macros.h"
@@ -86,7 +85,7 @@ class CASWHudEmotes : public CASW_HudElement, public vgui::Panel
8685 CPanelAnimationVarAliasType ( int , m_nHackTexture, " HackTexture" , " vgui/swarm/ClassIcons/HackIcon" , " textureid" );
8786 CPanelAnimationVarAliasType ( int , m_nWeldTexture, " WeldTexture" , " vgui/swarm/ClassIcons/WeldIcon" , " textureid" );
8887 CPanelAnimationVarAliasType ( int , m_nReviveMarineTexture, " ReviveMarineTexture" , " vgui/swarm/ClassIcons/revivemarine" , " textureid" );
89- CPanelAnimationVarAliasType (int , m_nTraceTexture, " TraceTexture" , " vgui/icon_arrow_down " , " textureid" );
88+ CPanelAnimationVarAliasType (int , m_nTraceTexture, " TraceTexture" , " vgui/arrow_right " , " textureid" );
9089};
9190
9291DECLARE_HUDELEMENT ( CASWHudEmotes );
@@ -325,6 +324,19 @@ void CASWHudEmotes::PaintTracesFor(C_ASW_Marine* pMarine)
325324 {
326325 iterNext++;
327326 }
327+
328+ int omx, omy;
329+ float fAlpha , fTraceRatio , xPos, yPos, angleRad, angleDeg;
330+ float fScale = (ScreenHeight () / 768 .0f );
331+ float HalfW = 16 .0f * fScale ;
332+ float HalfH = 16 .0f * fScale ;
333+ Vector vecPosition, vecPositionNext, screenPos, screenPosNext, vecTargetDirection;
334+
335+ Vector vecCameraFocus;
336+ QAngle cameraAngle;
337+
338+ ASWInput ()->ASW_GetCameraLocation (C_ASW_Player::GetLocalASWPlayer (), vecCameraFocus, cameraAngle, omx, omy, false );
339+
328340 for (; iter != pMarine->m_lstTracePlayerMovementList .end () && iterNext != pMarine->m_lstTracePlayerMovementList .end (); ++iter, ++iterNext)
329341 {
330342 float fTraceRatio = (*iter).m_flTraceTime / TRACE_FADE_TIME ;
@@ -338,7 +350,7 @@ void CASWHudEmotes::PaintTracesFor(C_ASW_Marine* pMarine)
338350
339351 // draw a circle at the position of the trace in world space
340352 // and fade it out over time
341- float fAlpha = (fTraceRatio + fTimeRatio ) - (int )(fTraceRatio + fTimeRatio );
353+ fAlpha = (fTraceRatio + fTimeRatio ) - (int )(fTraceRatio + fTimeRatio );
342354 if (fAlpha > 1.0 / 3.0 || fAlpha <= 0.01 )
343355 {
344356 continue ;
@@ -347,43 +359,40 @@ void CASWHudEmotes::PaintTracesFor(C_ASW_Marine* pMarine)
347359 {
348360 fAlpha = pow (3.0 * fAlpha , 2.2 );
349361 }
350- int iTexture = m_nTraceTexture;
351- Vector screenPos;
352- Vector screenPosNext;
362+
353363 if (!debugoverlay->ScreenPosition (vecPosition, screenPos) && !debugoverlay->ScreenPosition (vecPositionNext, screenPosNext))
354364 {
355- float xPos = screenPos[0 ];
356- float yPos = screenPos[1 ];
357- Vector vecTargetDirection = vecPositionNext - vecPosition;
365+ xPos = screenPos[0 ];
366+ yPos = screenPos[1 ];
367+ vecTargetDirection = vecPositionNext - vecPosition;
358368 vecTargetDirection.z = 0 ;
359369 if (vecTargetDirection.NormalizeInPlace () < 0.01 )
360370 {
361371 continue ; // no direction to draw
362372 }
363373
364- if (iTexture != -1 )
374+ if (m_nTraceTexture != -1 )
365375 {
366- float fScale = (ScreenHeight () / 768 .0f );
367- float HalfW = 16 .0f * fScale ;
368- float HalfH = 16 .0f * fScale ;
369-
370376 surface ()->DrawSetColor (Color (255 , 255 , 255 , fAlpha * fOpacity * 255 .0f ));
371- surface ()->DrawSetTexture (iTexture);
377+ surface ()->DrawSetTexture (m_nTraceTexture);
378+
379+ angleRad = atan2 (vecTargetDirection.y , vecTargetDirection.x );
380+ angleDeg = RAD2DEG (angleRad);
381+
382+ QAngle angFacing (0 , -angleDeg + cameraAngle.y - 90 , 0 );
372383
373- float fFacingYaw = -UTIL_VecToYaw (vecTargetDirection);
374384 Vector vecCornerTL (-HalfW, -HalfH, 0 );
375385 Vector vecCornerTR (HalfW, -HalfH, 0 );
376386 Vector vecCornerBR (HalfW, HalfH, 0 );
377387 Vector vecCornerBL (-HalfW, HalfH, 0 );
378388 Vector vecCornerTL_rotated, vecCornerTR_rotated, vecCornerBR_rotated, vecCornerBL_rotated;
379389
380390 // rotate it by our facing yaw
381- QAngle angFacing (0 , -fFacingYaw , 0 );
382391 VectorRotate (vecCornerTL, angFacing, vecCornerTL_rotated);
383392 VectorRotate (vecCornerTR, angFacing, vecCornerTR_rotated);
384393 VectorRotate (vecCornerBR, angFacing, vecCornerBR_rotated);
385394 VectorRotate (vecCornerBL, angFacing, vecCornerBL_rotated);
386-
395+
387396 Vertex_t points[4 ] =
388397 {
389398 Vertex_t (Vector2D (xPos + vecCornerTL_rotated.x , yPos + vecCornerTL_rotated.y ),
0 commit comments