// hi ( this value is for the dominate of the area )
// lo ( this value is for the subordinate of the quadrant )
double newLocationHi ( double angle , double move , double currentScaleCubed ) { return abs((( ( 90 - angle ) * move ) * currentScaleCubed )); }
double newLocationLo ( double angle , double move , double currentScaleCubed ) { return abs(( ( angle * move ) * currentScaleCubed )); }
// can also be determined for the movement of an object and the direction it is facing
void moveMouse
( int xMove , int yMove , bool xRight , bool zUp , double currentScale ,
mouseControls * MouseControls ,
rotation * Rotation )
{
// this value was added for a way to scale the objects to a default size upon init obj::obj(); vs having to do it later
// it can be removed and replaced with whatever value you use to determine how far the object is moving
double cubed = ( currentScale * currentScale * currentScale );
// my default horizontal rotation
/* pointless. can't believe I left It there all this time... i'm ashamed..
if ( ( Rotation->y == 0.0 ) || ( Rotation->y == 360.0 ) )
{
if ( zUp ) MouseControls->MouseCurrentLocation.z += (yMove*currentScale)/10;
else if ( !zUp ) MouseControls->MouseCurrentLocation.z -= ( yMove*currentScale)/10;
if ( xRight ) MouseControls->MouseCurrentLocation.x += (xMove*currentScale)/10;
else if ( !xRight ) MouseControls->MouseCurrentLocation.x -= (xMove*currentScale)/10;
return;
}
*/
// keep rotation between 0 and 360 I should remove this since I recently made it a safeguard of the
// class itself
if ( Rotation->y < 0.0 ) Rotation->y += 360.0;
if ( Rotation->y <= 90.0 )
{
// can be switched with your keys
// e.g. xRight would be 'D' I guess
// zUp would be W (!zUp) would be S
if ( xRight )
{
MouseControls->MouseCurrentLocation.x += newLocationHi( Rotation->y,xMove,cubed);
MouseControls->MouseCurrentLocation.z += newLocationLo( Rotation->y,xMove,cubed);
}
else if ( !xRight )
{
MouseControls->MouseCurrentLocation.x -= newLocationHi(Rotation->y,xMove,cubed);
MouseControls->MouseCurrentLocation.z -= newLocationLo(Rotation->y,xMove,cubed);
}
if ( zUp )
{
MouseControls->MouseCurrentLocation.x += newLocationLo ( Rotation->y,yMove,cubed);
MouseControls->MouseCurrentLocation.z -= newLocationHi ( Rotation->y,yMove,cubed);
}
else if ( !zUp )
{
MouseControls->MouseCurrentLocation.x -= newLocationLo ( Rotation->y,yMove,cubed);
MouseControls->MouseCurrentLocation.z += newLocationHi ( Rotation->y,yMove,cubed);
}
}
else if ( Rotation->y <= 180 )
{
if ( zUp )
{
MouseControls->MouseCurrentLocation.x += newLocationHi ( ( Rotation->y - 90 ) , yMove , cubed );
MouseControls->MouseCurrentLocation.z += newLocationLo ( ( Rotation->y - 90 ) , yMove , cubed );
}
else if ( !zUp )
{
MouseControls->MouseCurrentLocation.x -= newLocationHi ( ( Rotation->y - 90 ) , yMove,cubed);
MouseControls->MouseCurrentLocation.z -= newLocationLo ( ( Rotation->y - 90 ) , yMove,cubed);
}
if ( xRight )
{
MouseControls->MouseCurrentLocation.x -= newLocationLo ( ( Rotation->y - 90 ) , xMove,cubed);
MouseControls->MouseCurrentLocation.z += newLocationHi ( ( Rotation->y - 90 ) , xMove,cubed);
}
if ( !xRight )
{
MouseControls->MouseCurrentLocation.x += newLocationLo ( ( Rotation->y - 90 ) , xMove , cubed );
MouseControls->MouseCurrentLocation.z -= newLocationHi ( ( Rotation->y - 90 ) , xMove , cubed );
}
}
else if ( Rotation->y <= 270 )
{
if ( xRight )
{
MouseControls->MouseCurrentLocation.x -= newLocationHi ( ( Rotation->y - 180 ) , xMove , cubed );
MouseControls->MouseCurrentLocation.z -= newLocationLo ( ( Rotation->y - 180 ) , xMove , cubed );
}
else if ( !xRight )
{
MouseControls->MouseCurrentLocation.x += newLocationHi ( ( Rotation->y - 180 ) , xMove , cubed );
MouseControls->MouseCurrentLocation.z += newLocationLo ( ( Rotation->y - 180 ) , xMove , cubed );
}
if ( zUp )
{
MouseControls->MouseCurrentLocation.z += newLocationHi ( ( Rotation->y - 180 ) , yMove , cubed );
MouseControls->MouseCurrentLocation.x -= newLocationLo ( ( Rotation->y - 180 ) , yMove , cubed );
}
else if ( !zUp )
{
MouseControls->MouseCurrentLocation.z -= newLocationHi ( ( Rotation->y - 180 ) , yMove , cubed );
MouseControls->MouseCurrentLocation.x += newLocationLo ( ( Rotation->y - 180 ) , yMove , cubed );
}
}
else if ( Rotation->y <= 360.0 )
{
if ( xRight )
{
MouseControls->MouseCurrentLocation.z -= newLocationHi ( ( Rotation->y - 270 ) , xMove , cubed );
MouseControls->MouseCurrentLocation.x += newLocationLo ( ( Rotation->y - 270 ) , xMove , cubed );
}
else if ( !xRight )
{
MouseControls->MouseCurrentLocation.z += newLocationHi ( ( Rotation->y - 270 ) , xMove , cubed );
MouseControls->MouseCurrentLocation.x -= newLocationLo ( ( Rotation->y - 270 ) , xMove , cubed );
}
if ( zUp )
{
MouseControls->MouseCurrentLocation.x -= newLocationHi ( ( Rotation->y - 270 ) , yMove , cubed );
MouseControls->MouseCurrentLocation.z -= newLocationLo ( ( Rotation->y - 270 ) , yMove , cubed );
}
else if ( !zUp )
{
MouseControls->MouseCurrentLocation.x += newLocationHi ( ( Rotation->y - 270 ) , yMove , cubed );
MouseControls->MouseCurrentLocation.z += newLocationLo ( ( Rotation->y - 270 ) , yMove , cubed );
}
}
}