Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Development

Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum)

Reply
 
Thread Tools Display Modes
  #1  
Old 08-01-2009, 08:54 AM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,498
Default GetReciprocalHeading()

Code:
2182 float Mob::GetReciprocalHeading(Mob* target) {
2183 float Result = 0;
2184 
2185 if(target) {
2186 float h = target->GetHeading();
2187 
2188 if(h > 0.0 && h < 128.0)
2189 Result = h + 128.0;
2190 else if(h > 128.0 && h < 256)
2191 Result = h - 128.0;
2192 else if(h == 128.0)
2193 Result = 255.9;
2194 else
2195 Result = h;
2196 }
2197 
2198 return Result;
2199 }
Just a note for the author of this code:

First off, great idea! Just 2 questions, though. What if the heading is already 0.0 and wouldn't it be easier to just do a mod?

Code:
float Mob::GetReciprocalHeading(Mob* target) {
  float Result = 0;

  if(target) {
    float h = target->GetHeading();
    Result = (h + 128.0) % 256;
  }

  return Result;
}
Reply With Quote
  #2  
Old 08-01-2009, 12:28 PM
WildcardX
Developer
 
Join Date: Apr 2003
Posts: 589
Default

Thanks. Yours looks cleaner. Obviously, I should have spent more time paying attention in math class I'm trying it out in branch now along with some new code to get bot rogue's and rogue pet's to position themselves behind a mob they are attacking.
__________________
Read my developer notes at my blog.

Quote:
If it's not on IRC, it ain't l33t!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 07:47 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3