Converted MQ2 Command - /face

Moderator: MacroQuest Developers

theduck
orc pawn
orc pawn
Posts: 26
Joined: Mon Dec 15, 2003 4:24 am

Converted MQ2 Command - /face

Post by theduck » Thu Sep 22, 2005 2:54 pm

ISXEQCommandList.h

Code: Select all

COMMAND("face",CMD_Face,true,false);
ISXEQCommands.cpp

Code: Select all

int CMD_Face(int argc, char* argv[]) 
{ 
   if (!ppSpawnList) return 0; 
   if (!pSpawnList) return 0; 
   PSPAWNINFO pSpawn = ((PSPAWNINFO)pTarget); 
   bool bfPredict=false; 
   bool bfAway=false; 
   bool bfNolook=false; 
   bool bfFast=false; 
   bool bfLoc=false; 
   double Y; 
   double X;    
   
	for (int i = 1 ; i < argc ; i++)
	{
      if (!stricmp(argv[i],"predict"))
         bfPredict=true;
      else if (!stricmp(argv[i],"nolook"))
         bfNolook=true;
      else if (!stricmp(argv[i],"away"))
         bfAway=true;
      else if (!stricmp(argv[i],"fast"))
         bfFast=true;
      else if (!stricmp(argv[i],"loc")) { 
         bfLoc=true;
         Y = atof(argv[++i]);
         X = atof(argv[++i]); 
      } else if (!stricmp(argv[i],"help")) { 
         WriteChatf("Syntax: %s predict|nolook|away|fast|loc y x",argv[0]); 
         return 0; 
      } 
   } 

   if (!bfLoc) { 
      if (pSpawn->SpawnID==((PSPAWNINFO)pCharSpawn)->SpawnID)   // If it is ourself, don't do anything. 
         return 1; 
          
      gFaceAngle = ( 
         atan2(pSpawn->X - ((PSPAWNINFO)pCharSpawn)->X, 
         pSpawn->Y - ((PSPAWNINFO)pCharSpawn)->Y) 
         * 256.0f / PI);              
   } else { 
      gFaceAngle = ( 
         atan2(X - ((PSPAWNINFO)pCharSpawn)->X, 
         Y - ((PSPAWNINFO)pCharSpawn)->Y) 
         * 256.0f / PI); 
   } 
          
   if (bfPredict) 
   { 
      DOUBLE Distance; 
      Distance = DistanceToSpawn((PSPAWNINFO)pCharSpawn, pSpawn); 
      gFaceAngle = ( 
         atan2((pSpawn->X + (pSpawn->SpeedX * Distance)) - ((PSPAWNINFO)pCharSpawn)->X, 
         (pSpawn->Y + (pSpawn->SpeedY * Distance)) - ((PSPAWNINFO)pCharSpawn)->Y) 
         * 256.0f / PI); 
   } 
   if (!bfNolook) { 
      DOUBLE Distance = DistanceToSpawn((PSPAWNINFO)pCharSpawn, pSpawn); 
      gLookAngle = ( 
         atan2(pSpawn->Z + pSpawn->AvatarHeight*StateHeightMultiplier(pSpawn->StandState) - ((PSPAWNINFO)pCharSpawn)->Z - 
         ((PSPAWNINFO)pCharSpawn)->AvatarHeight*StateHeightMultiplier(((PSPAWNINFO)pCharSpawn)->StandState), 
         (FLOAT)Distance) 
         * 256.0f / PI); 
      if (bfAway) gLookAngle = -gLookAngle; 
      if (bfFast) { 
         ((PSPAWNINFO)pCharSpawn)->CameraAngle = (FLOAT)gLookAngle; 
         gLookAngle=10000.0f; 
      } 
   } 
   if (bfAway) { 
      gFaceAngle += 256.0f; 
   } 
   if (gFaceAngle>=512.0f) gFaceAngle -= 512.0f; 
   if (gFaceAngle<0.0f) gFaceAngle += 512.0f; 
   if (bfFast) { 
      ((PSPAWNINFO)pCharSpawn)->Heading = (FLOAT)gFaceAngle; 
      gFaceAngle=10000.0f; 
   } 
   return 1;
}
*QUACK*

Red-One
a ghoul
a ghoul
Posts: 143
Joined: Tue Dec 28, 2004 9:14 pm

hmm

Post by Red-One » Mon Sep 26, 2005 10:18 am

To my knowledge, oth already did the conversion , and it should already be in the cvs.

http://www.macroquest2.com/phpBB2/viewtopic.php?t=10976


-Red

theduck
orc pawn
orc pawn
Posts: 26
Joined: Mon Dec 15, 2003 4:24 am

Post by theduck » Mon Sep 26, 2005 12:32 pm

OTH made Spawn:Face, I converted (using quite a bit of his code) the face command.

They are very similar in that /face fast does the same thing as ${Target:Face[fast]} so there is some duplication.

However, the command gives you the otherwise missing functionality of /face loc y x that existed in MQ2 but didn't as of yet with ISXEQ.
*QUACK*

theduck
orc pawn
orc pawn
Posts: 26
Joined: Mon Dec 15, 2003 4:24 am

Post by theduck » Thu Sep 29, 2005 1:31 pm

ISSUE:

Currently crashes to desktop if you have more than one copy of EQ running.
*QUACK*

xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: Converted MQ2 Command - /face

Post by xyilla » Sun Jun 15, 2025 9:27 am


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: Converted MQ2 Command - /face

Post by xyilla » Sun Jun 15, 2025 9:28 am


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: Converted MQ2 Command - /face

Post by xyilla » Sun Jun 15, 2025 9:29 am


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: Converted MQ2 Command - /face

Post by xyilla » Sun Jun 15, 2025 9:30 am


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: Converted MQ2 Command - /face

Post by xyilla » Sun Jun 15, 2025 9:31 am


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: Converted MQ2 Command - /face

Post by xyilla » Sun Jun 15, 2025 9:32 am


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: Converted MQ2 Command - /face

Post by xyilla » Sun Jun 15, 2025 9:34 am


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: Converted MQ2 Command - /face

Post by xyilla » Sun Jun 15, 2025 9:35 am


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: Converted MQ2 Command - /face

Post by xyilla » Sun Jun 15, 2025 9:36 am


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: Converted MQ2 Command - /face

Post by xyilla » Sun Jun 15, 2025 10:13 am


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: Converted MQ2 Command - /face

Post by xyilla » Sun Jun 15, 2025 10:14 am