Tutorial Drawing Lines with the engine
#1
Quote:hi peoples, here is a method to draw a line with the engine.
you will lose some fps on this method.

PHP Code:
float getAngle(DoublePoint self, DoublePoint target) { float dx = target[0] - self[0]; //calculate the distance to the target on the x-axis float dy = target[1] - self[1]; //calculate the distance to the target on the y-axis float dist = sqrt(pow(dx, 2) + pow(dy, 2)); //calculate distance to the target by using pythagoras float dangle; if (dy < 0) dangle = (M_PI * 2) - (acos(dx/dist)); else dangle = acos(dx/dist); //calculate the angle return dangle; }
PHP Code:
void cEngine::DrawLines() { float x, y; float Screen[2]; DoublePoint dpLocal = {Refdef->Width/2, Refdef->Height}; for(int i=0; i<MAX_PLAYERS; i++) { CEntity* pEnt = getValidEnt(); if(WorldToScreen(pEnt->vOrig, &Screen) { DoublePoint dpTarget = {Screen[0], Screen[1]}; float fAngle = getAngle(dpLocal, dpTarget); if(!fAngle) continue; float fDist = getDist(); int size = fdist/lineDist; for(int i=0; i<size; i++) { if(i == 0) { x = (dpLocal[0] + lineDist * cos(fAngle)); y = (dpLocal[1] + lineDist * sin(fAngle)); CG_DrawPic(x, y, 10, 10, tRed, RegisterShader("compassping_enemyfiring", 7)); }else { x = (x + lineDist * cos(fAngle)); y = (y + lineDist * sin(fAngle)); CG_DrawPic(x, y, 10, 10, tRed, RegisterShader("compassping_enemyfiring", 7)); } } } } }

by editing the linedist you can also make it look like a real line, or you can use other shaders

Credits:
cardoow
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  TUTORIAL CHEAT ENGINE for mw3 [HARD] Tony. 5 6,799 10-24-2013, 15:22
Last Post: Tomsen1410
  Using Cheat Engine 6.2 to change BO2 address values wzlrsaur 6 10,702 08-06-2013, 06:28
Last Post: 14th
  can't find script engine "VBScript" for script "C:\Windows\system32\slmgr.vbs" ddaavvee 6 27,287 06-18-2013, 03:46
Last Post: dylankrajewski
  [News] Call Of Duty: Ghosts - New Engine Video Tomsen1410 7 8,437 06-10-2013, 20:24
Last Post: Pozzuh
  Using Cheat Engine with Zombies Single Player kikkawa 3 14,849 06-03-2013, 01:18
Last Post: kikkawa
  Why there are no modding for Frostbite Engine RaZ 2 4,731 03-30-2013, 17:14
Last Post: Pozzuh
  [Request] Chat Lines Extended xDarkPrince 3 4,241 09-20-2012, 19:48
Last Post: xDarkPrince
  [News] Black ops 2 zombies in MP engine Pozzuh 28 16,764 09-02-2012, 15:21
Last Post: Nekochan
  Can't play any unreal engine games. Pozzuh 2 4,479 07-09-2012, 19:53
Last Post: Pozzuh
  Preview Unreal Engine 4 development walkthrough Pozzuh 6 4,962 06-11-2012, 23:05
Last Post: JoSchaap

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2026 Melroy van den Berg.