Advertisement
Guest User

QTS no. 9 - Primitive arrow drawing function

a guest
Jul 9th, 2010
542
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.79 KB | None | 0 0
  1. /*
  2. -----------------------------------------
  3. * Game hacking QTS ( Quickie Tip Series )
  4. * no. 9 - Primitive arrow drawing function
  5. -----------------------------------------
  6. * Author: SEGnosis  - GHAnon.net
  7. * Thanks to:
  8. * bitterbanana      - No known site
  9. * Drunken Cheetah   - No known site
  10. * fatboy88      - No known site
  11. * Geek4Ever         - No known site
  12. * learn_more        - www.uc-forum.com
  13. * Novocaine         - http://ilsken.net/blog/?page_id=64
  14. * Philly0494        - No known site
  15. * Roverturbo        - www.uc-forum.com
  16. * SilentKarma       - www.halocoders.com - offline
  17. * Strife        - www.uc-forum.com
  18. * Wieter20      - No known site
  19. */
  20.  
  21. #define PI 3.14159265
  22. #define TWO_PI ( PI * 2 )
  23.  
  24. #define DegreeToRadian(a)( ( ( a * PI ) / 180.0f ) )
  25. #define LimitTwoPI(a)while( a > TWO_PI )a -= TWO_PI
  26. #define Limit360(a)while( a > 360.0f )a -= 360.0f
  27.  
  28. //----------------------------------//
  29. void DrawArrow( long x, long y, float fDegrees, DWORD dwLength, DWORD dwAngleDivisor, DWORD dwLineWidth, D3DCOLOR Color )
  30. {
  31.     Limit360( fDegrees );
  32.    
  33.     DWORD dwAngleLength = dwLength/dwAngleDivisor;
  34.    
  35.     float fRightAngle = 135.0f + fDegrees,
  36.           fLeftAngle  = 225.0f + fDegrees;
  37.          
  38.     Limit360(fRightAngle);
  39.     Limit360(fLeftAngle);
  40.    
  41.     fRightAngle = DegreeToRadian( fRightAngle );
  42.     fLeftAngle  = DegreeToRadian( fLeftAngle );
  43.     fDegrees    = DegreeToRadian( fDegrees );
  44.    
  45.     POINT pt = { cos( fDegrees ) * dwLength + x, sin( fDegrees ) * dwLength + y };
  46.    
  47.     CDraw.Line( x, y, pt.x, pt.y, dwLineWidth, Color );
  48.    
  49.     CDraw.Line( pt.x, pt.y, cos( fRightAngle ) * dwAngleLength + pt.x,
  50.                             sin( fRightAngle ) * dwAngleLength + pt.y, dwLineWidth, Color );
  51.                            
  52.     CDraw.Line( pt.x, pt.y, cos( fLeftAngle ) * dwAngleLength + pt.x,
  53.                             sin( fLeftAngle ) * dwAngleLength + pt.y, dwLineWidth, Color );
  54. }
  55. //----------------------------------//
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement