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)

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 10-11-2010, 06:18 PM
Xanathol
Sarnak
 
Join Date: Oct 2009
Posts: 52
Default

Ok, so I gave it a few runs, tried to add in debug messages to figure out what was going wrong, but have to throw in the towel and see if you guys can spot what I am doing wrong here. Here is the sample code I wrote for the Hate Step effect ( recall - warps a character forward in the direction they are facing x distance; its an SK AA on live ).

Code:
			case SE_ShadowStepDirectional:
			{
				double look_heading = GetHeading();
				look_heading /= 256;
				look_heading *= 360;
				look_heading += 180;
				if(look_heading > 360)
					look_heading -= 360;

				// note: x and y are backwards
                                // the -8 is just a multiplier to increase the distance I arbitrarily picked, nothing more
				double new_x = ( spells[spell_id].base[i] * -8 ) * sin(double(look_heading * 0.017453289 ));
				double new_y = ( spells[spell_id].base[i] * -8 ) * cos(double(look_heading * 0.017453289 ));
				double new_z = GetZ( );

				// try to see if a zone wall is in the way
				VERTEX	start, end, result;
				FACE	*triangle	= NULL;

				start.x		= GetX( );
				start.y		= GetY( );
				start.z		= GetZ( );
				end.x		= GetX( ) + new_x;
				end.y		= GetY( ) + new_y;
				end.z		= GetZ( );

				bool	b = zone->zonemap->LineIntersectsZone( start, end, 1.0f, &result, &triangle );
				Message(15, "Debug: result is %s: %lf %lf %lf", ( b == true ? "true" : "false" ), result.x, result.y, result.z );
				if( b )
				{	// result should give us the point we hit
					Message(15, "Debug: intersect @ %lf %lf %lf", result.x, result.y, result.z );
					new_x	= result.x;
					new_y	= result.y;
				}
				else
				{	// otherwise, set new_* to values we wanted to use
					new_x	+= GetX( );
					new_y	+= GetY( );
					Message(15, "Debug: used2 x,y %lf %lf", new_x, new_y );
				}
				// now lets find the z-axis value
				VERTEX	org;
				org.x	= new_x;
				org.y	= new_y;
				org.z	= GetZ( );
				Message(15, "Debug: old z %lf", org.z );
				//new_z	= zone->zonemap->FindBestZ( MAP_ROOT_NODE, org, &result, &triangle );
				new_z	= org.z - zone->zonemap->FindClosestZ( org );
				Message(15, "Debug: new z %lf", new_z );

                                // I have no idea why, but I had to double the GetHeading return value for this function to work for me, hence the *2
				CastToClient()->MovePC( zone->GetZoneID(), zone->GetInstanceID(), new_x, new_y, new_z, GetHeading( ) *2, 0, PCStep );
				Message(15, "%s %s", GetName(), spells[spell_id].cast_on_other );
Thus far, I still go into / through walls and seem to always get returned a 0 from FindBestZ ( note - I've been testing int he Arena ), either implementation, while the 'real Z' shown by a #loc command can be vastly different, plus or minus.


I can paste in some of the logs too if that helps, but I figured it may be hard to envision in pure numbers when one is in a wall or not...

Anything stand out as to what I am doing wrong? Seems like a rather simple thing to implement but I put no limits as to what I can screw up!
Reply With Quote
 

Thread Tools
Display Modes

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:29 AM.


 

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