本文整理汇总了C++中IPlayerInfo::GetLastUserCommand方法的典型用法代码示例。如果您正苦于以下问题:C++ IPlayerInfo::GetLastUserCommand方法的具体用法?C++ IPlayerInfo::GetLastUserCommand怎么用?C++ IPlayerInfo::GetLastUserCommand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPlayerInfo
的用法示例。
在下文中一共展示了IPlayerInfo::GetLastUserCommand方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Bot_RunMimicCommand
bool Bot_RunMimicCommand( CBotCmd& cmd )
{
if ( bot_mimic.GetInt() <= 0 )
return false;
if ( bot_mimic.GetInt() > gpGlobals->maxClients )
return false;
IPlayerInfo *playerInfo = playerinfomanager->GetPlayerInfo( engine->PEntityOfEntIndex( bot_mimic.GetInt() ) );
if ( !playerInfo )
return false;
cmd = playerInfo->GetLastUserCommand();
cmd.viewangles[YAW] += bot_mimic_yaw_offset.GetFloat();
if( bot_crouch.GetInt() )
cmd.buttons |= IN_DUCK;
return true;
}
示例2: if
//.........这里部分代码省略.........
m_fSpeed = m_vVelocity.Length();
m_vLastPos = getOrigin();
if ( (m_fUpdatePos > 0) && (m_fSpeed > 0) )
{
if ( !m_bSentWelcomeMessage )
{
m_bSentWelcomeMessage = true;
giveMessage(CStrings::getString(BOT_WELCOME_MESSAGE));
giveMessage(CStrings::getString(CWaypoints::getWelcomeMessage()),5.0f);
}
}
m_fUpdatePos = engine->Time() + 1.0f;
}
if ( isDebugging() )
{
IPlayerInfo *p = playerinfomanager->GetPlayerInfo(m_pPlayer);
if ( isDebugOn(BOT_DEBUG_SPEED) )
{
CBotGlobals::botMessage(m_pPlayer,0,"speed = %0.0f",m_fSpeed);
}
if ( isDebugOn(BOT_DEBUG_USERCMD) )
{
if ( p )
{
CBotCmd cmd = p->GetLastUserCommand();
CBotGlobals::botMessage(m_pPlayer,0,"Btns = %d, cmd_no = %d, impulse = %d, weapselect = %d, weapsub = %d",cmd.buttons,cmd.command_number,cmd.impulse,cmd.weaponselect,cmd.weaponsubtype);
}
}
if ( (m_pDebugBot!=NULL) && isDebugOn(BOT_DEBUG_HUD) )
{
if ( m_fNextPrintDebugInfo < engine->Time() )
{
char msg[1024];
CBot *pBot = CBots::getBotPointer(m_pDebugBot);
QAngle eyes = p->GetLastUserCommand().viewangles;
Vector vForward;
// in fov? Check angle to edict
AngleVectors(eyes,&vForward);
vForward = vForward / vForward.Length(); // normalize
Vector vLeft = (vForward-p->GetAbsOrigin()).Cross(Vector(0,0,1));
vLeft = vLeft/vLeft.Length();
Vector vDisplay = p->GetAbsOrigin() + vForward*300.0f;
vDisplay = vDisplay - vLeft*300.0f;
// get debug message
pBot->debugBot(msg);
#ifndef __linux__
int i = 0;
int n = 0;