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

Archive::Development Archive area for Development's posts that were moved here after an inactivity period of 90 days.

Reply
 
Thread Tools Display Modes
  #1  
Old 08-13-2003, 12:25 AM
Wiz
Dragon
 
Join Date: Feb 2002
Posts: 583
Default Basic Line of Sight

This function will use the nodes in .map files to apply line of sight (prevents wall aggro if used right, among other things). It is not perfect yet, as it tends to fail on thin walls, or walls on top of other floors (such as in unrest or hole), but it's a start.

Code:
bool Mob::CheckLos(Mob* other) {
	if (zone->map == 0)
	{
		return true;
	}
	float tmp_x = GetX();
	float tmp_y = GetY();
	float trg_x = other->GetX();
	float trg_y = other->GetY();
	float perwalk_x = 0.2;
	float perwalk_y = 0.2;
	float dist_x = tmp_x - trg_x;
	if (dist_x < 0)
		dist_x *= -1;
	float dist_y = tmp_y - trg_y;
	if (dist_y < 0)
		dist_y *= -1;
	if (dist_x  < dist_y)
		perwalk_x /= (dist_y/dist_x);
	else if (dist_y < dist_x)
		perwalk_y /= (dist_x/dist_y);
	while (1) {
		if (tmp_x < trg_x)
		{
			if (tmp_x + perwalk_x < trg_x)
				tmp_x += perwalk_x;
			else
				tmp_x = trg_x;
		}
		if (tmp_y < trg_y)
		{
			if (tmp_y + perwalk_y < trg_y)
				tmp_y += perwalk_y;
			else
				tmp_y = trg_y;
		}
		if (tmp_x > trg_x)
		{
			if (tmp_x - perwalk_x > trg_x)
				tmp_x -= perwalk_x;
			else
				tmp_x = trg_x;
		}
		if (tmp_y > trg_y)
		{
			if (tmp_y - perwalk_y > trg_y)
				tmp_y -= perwalk_y;
			else
				tmp_y = trg_y;
		}
		if (tmp_y == trg_y && tmp_x == trg_x)
		{
			return true;
		}
		PNODE pnode = zone->map->SeekNode( zone->map->GetRoot(), tmp_x, tmp_y );
		if (pnode != 0)
		{
			int *iface = zone->map->SeekFace( pnode, tmp_x, tmp_y );
			if (*iface == -1) {
				return false;
			}							
		}
	}
	return true;
}
Reply With Quote
  #2  
Old 08-13-2003, 02:22 AM
Merth
Dragon
 
Join Date: May 2003
Location: Seattle, WA
Posts: 609
Default

Wow, this is very cool. I can't wait to see this in action.
Reply With Quote
  #3  
Old 08-13-2003, 01:13 PM
x-scythe
Discordant
 
Join Date: Jun 2003
Posts: 449
Default nice

nice, now i wont get jumped by 50 mobs at a time in dungeons good job
Reply With Quote
  #4  
Old 08-14-2003, 11:18 AM
Merth
Dragon
 
Join Date: May 2003
Location: Seattle, WA
Posts: 609
Default

Is there a server available where I can see this is action? I can go both 0.4.x and 0.5.0.
Reply With Quote
  #5  
Old 08-15-2003, 02:33 AM
Wiz
Dragon
 
Join Date: Feb 2002
Posts: 583
Default

Well, Winter's Roar, I'd be happy to demonstrate it when the logins come back up.
Reply With Quote
  #6  
Old 01-05-2004, 07:10 AM
cokerms
Fire Beetle
 
Join Date: Dec 2003
Posts: 3
Default

Did this code ever get added? I was looking through the code base and didn't see that particular function, but I didn't know if it was added elsewhere. I still get jumped by mobs through walls in najena so I am guessing it didn't.

You guys are still doing a great job. Thanks
Reply With Quote
  #7  
Old 02-06-2004, 08:37 AM
Eglin
Hill Giant
 
Join Date: Nov 2003
Posts: 168
Default

Quote:
Originally Posted by cokerms
Did this code ever get added?
http://cvs.sourceforge.net/viewcvs.p...in&rev=1.1.1.8
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 12:22 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3