本文整理汇总了C++中MessageEnd函数的典型用法代码示例。如果您正苦于以下问题:C++ MessageEnd函数的具体用法?C++ MessageEnd怎么用?C++ MessageEnd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MessageEnd函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UTIL_PlayerByIndex
void NDebugOverlay::BoxAngles(const Vector &origin, const Vector &mins, const Vector &maxs, const QAngle &angles, int r, int g, int b, int a, float duration)
{
// --------------------------------------------------------------
// Have to do clip the boxes before sending so we
// don't overflow the client message buffer
// --------------------------------------------------------------
CBasePlayer *player = UTIL_PlayerByIndex(1);
if ( !player )
return;
// ------------------------------------
// Clip boxes that are far away
// ------------------------------------
if ((player->GetAbsOrigin() - origin).LengthSqr() > MAX_OVERLAY_DIST_SQR)
return;
// ------------------------------------
// Clip boxes that are behind the client
// ------------------------------------
Vector clientForward;
player->EyeVectors( &clientForward );
// Build a rotation matrix from orientation
matrix3x4_t fRotateMatrix;
AngleMatrix(angles, fRotateMatrix);
// Transform the mins and maxs
Vector tmins, tmaxs;
VectorRotate( mins, fRotateMatrix, tmins);
VectorAdd(tmins,origin,tmins);
VectorRotate( maxs, fRotateMatrix, tmaxs);
VectorAdd(tmaxs,origin,tmaxs);
Vector toMins = tmins - player->GetAbsOrigin();
Vector toMaxs = tmaxs - player->GetAbsOrigin();
float dotMins = DotProduct(clientForward,toMins);
float dotMaxs = DotProduct(clientForward,toMaxs);
if (dotMins < 0 && dotMaxs < 0)
return;
CSingleUserRecipientFilter user( player );
MessageBegin( user, SVC_DEBUG_BOX_OVERLAY );
WRITE_VEC3COORD(origin);
WRITE_VEC3COORD(mins);
WRITE_VEC3COORD(maxs);
WRITE_ANGLES(angles);
WRITE_SHORT(r);
WRITE_SHORT(g);
WRITE_SHORT(b);
WRITE_SHORT(a);
WRITE_FLOAT(duration);
MessageEnd();
}
示例2: UTIL_GetLocalPlayer
void CCredits::InputShowLogo( inputdata_t &inputdata )
{
CBasePlayer *pPlayer = UTIL_GetLocalPlayer();
CSingleUserRecipientFilter user( pPlayer );
user.MakeReliable();
if ( m_flLogoLength )
{
UserMessageBegin( user, "LogoTimeMsg" );
WRITE_FLOAT( m_flLogoLength );
MessageEnd();
}
else
{
UserMessageBegin( user, "CreditsMsg" );
WRITE_BYTE( 1 );
MessageEnd();
}
}
示例3: UserMessageBegin
void CASW_Sentry_Top::MakeTracer( const Vector &vecTracerSrc, const trace_t &tr, int iTracerType )
{
CBroadcastRecipientFilter filter;
UserMessageBegin( filter, "ASWSentryTracer" );
WRITE_SHORT( entindex() );
WRITE_FLOAT( tr.endpos.x );
WRITE_FLOAT( tr.endpos.y );
WRITE_FLOAT( tr.endpos.z );
MessageEnd();
}
示例4: Assert
void CBaseMultiplayerPlayer::AwardAchievement( int iAchievement, int iCount )
{
Assert( iAchievement >= 0 && iAchievement < 0xFFFF ); // must fit in short
CSingleUserRecipientFilter filter( this );
UserMessageBegin( filter, "AchievementEvent" );
WRITE_SHORT( iAchievement );
WRITE_SHORT( iCount );
MessageEnd();
}
示例5: EntityMessageBegin
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CVehicleMortar::OnFinishedDeploy( void )
{
BaseClass::OnFinishedDeploy();
EntityMessageBegin( this, true );
WRITE_STRING( "OnDeployed" );
MessageEnd();
m_flMortarYaw = 0;
m_flMortarPitch = 45;
}
示例6: HapticMsg_Punch
void HapticMsg_Punch(CBasePlayer* pPlayer, float x, float y, float z)
{
CSingleUserRecipientFilter user(pPlayer);
user.MakeReliable();
UserMessageBegin(user,"HapPunch");
WRITE_FLOAT(x);
WRITE_FLOAT(y);
WRITE_FLOAT(z);
MessageEnd();
}
示例7: HapticMsg_SetConstantForce
void HapticMsg_SetConstantForce(CBasePlayer* pPlayer, Vector force)
{
// portal does not network this.
CSingleUserRecipientFilter user( pPlayer );
user.MakeReliable();
UserMessageBegin( user, "HapSetConst" );
WRITE_SHORT(force.x);
WRITE_SHORT(force.y);
WRITE_SHORT(force.z);
MessageEnd();
}
示例8: HapticMsg_HapDmg
void HapticMsg_HapDmg(CBasePlayer* pPlayer, float pitch, float yaw, float dmg, float dmgType )
{
CSingleUserRecipientFilter user(pPlayer);
user.MakeReliable();
UserMessageBegin(user,"HapDmg");
WRITE_FLOAT(pitch);
WRITE_FLOAT(yaw);
WRITE_FLOAT(dmg);
WRITE_LONG(dmgType);
MessageEnd();
}
示例9: UTIL_GetLocalPlayer
void CTimer::DispatchStageCountMessage()
{
CBasePlayer* cPlayer = UTIL_GetLocalPlayer();
if (cPlayer)
{
CSingleUserRecipientFilter user(cPlayer);
user.MakeReliable();
UserMessageBegin(user, "Timer_StageCount");
WRITE_LONG(m_iStageCount);
MessageEnd();
}
}
示例10: EntityMessageBegin
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CGrenadeHopwire::EndThink( void )
{
if ( hopwire_vortex.GetBool() )
{
EntityMessageBegin( this, true );
WRITE_BYTE( 1 );
MessageEnd();
}
SetThink( &CBaseEntity::SUB_Remove );
SetNextThink( gpGlobals->curtime + 1.0f );
}
示例11: Msg
// if we've already started showing the credits and another player has joined up, show him them too
void CASW_Intro_Control::PlayerSpawned(CASW_Player *pPlayer)
{
Msg("CASW_Intro_Control::PlayerSpawned, showncredits = %d\n", m_bShownCredits);
if (m_bShownCredits && pPlayer)
{
Msg("Sending user message to this player telling him to show the credits\n");
CRecipientFilter filter;
filter.AddRecipient(pPlayer);
UserMessageBegin( filter, "LaunchCredits" );
MessageEnd();
}
}
示例12: GetLocalOrigin
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CSDKPlayer::UpdateClientData( void )
{
if (m_DmgTake || m_DmgSave || m_bitsHUDDamage != m_bitsDamageType)
{
// Comes from inside me if not set
Vector damageOrigin = GetLocalOrigin();
// send "damage" message
// causes screen to flash, and pain compass to show direction of damage
damageOrigin = m_DmgOrigin;
// only send down damage type that have hud art
int iShowHudDamage = g_pGameRules->Damage_GetShowOnHud();
int visibleDamageBits = m_bitsDamageType & iShowHudDamage;
m_DmgTake = clamp( m_DmgTake, 0, 255 );
m_DmgSave = clamp( m_DmgSave, 0, 255 );
// If we're poisoned, but it wasn't this frame, don't send the indicator
// Without this check, any damage that occured to the player while they were
// recovering from a poison bite would register as poisonous as well and flash
// the whole screen! -- jdw
if ( visibleDamageBits & DMG_POISON )
{
float flLastPoisonedDelta = gpGlobals->curtime - m_tbdPrev;
if ( flLastPoisonedDelta > 0.1f )
{
visibleDamageBits &= ~DMG_POISON;
}
}
CSingleUserRecipientFilter user( this );
user.MakeReliable();
UserMessageBegin( user, "Damage" );
WRITE_BYTE( m_DmgSave );
WRITE_BYTE( m_DmgTake );
WRITE_LONG( visibleDamageBits );
WRITE_FLOAT( damageOrigin.x ); //BUG: Should be fixed point (to hud) not floats
WRITE_FLOAT( damageOrigin.y ); //BUG: However, the HUD does _not_ implement bitfield messages (yet)
WRITE_FLOAT( damageOrigin.z ); //BUG: We use WRITE_VEC3COORD for everything else
MessageEnd();
m_DmgTake = 0;
m_DmgSave = 0;
m_bitsHUDDamage = m_bitsDamageType;
// Clear off non-time-based damage indicators
int iTimeBasedDamage = g_pGameRules->Damage_GetTimeBased();
m_bitsDamageType &= iTimeBasedDamage;
}
BaseClass::UpdateClientData();
}
示例13: UTIL_GetListenServerHost
void CASW_Intro_Control::InputShowCainMail( inputdata_t &inputdata )
{
// listen server goes back to the default mission
if ( !engine->IsDedicatedServer() && ASWGameRules() && gpGlobals->maxClients > 1 )
{
CBasePlayer *pPlayer = UTIL_GetListenServerHost();
if (pPlayer)
{
CSingleUserRecipientFilter filter(pPlayer);
filter.MakeReliable();
UserMessageBegin( filter, "LaunchCainMail" );
MessageEnd();
}
}
else
{
CReliableBroadcastRecipientFilter filter;
UserMessageBegin( filter, "LaunchCainMail" );
MessageEnd();
}
}
示例14: user
//-----------------------------------------------------------------------------
// Purpose:
// Input : *player -
//-----------------------------------------------------------------------------
void CForceFeedback::ResumeAll( CBasePlayer *player )
{
if ( !player )
return;
CSingleUserRecipientFilter user( player );
UserMessageBegin( user, "ForceFeedback" );
WRITE_BYTE( FFMSG_RESUME ); // Resume effects
MessageEnd();
}
示例15: DevWarning
//-----------------------------------------------------------------------------
// Purpose: The act has finished
//-----------------------------------------------------------------------------
void CInfoAct::FinishAct( )
{
if ( g_hCurrentAct.Get() != this )
{
DevWarning( 2, "Attempted to finish an act which wasn't started!\n" );
return;
}
ShutdownRespawnTimers();
switch( m_iWinners)
{
case 0:
m_OnFinishedTeamNone.FireOutput( this, this );
break;
case 1:
m_OnFinishedTeam1.FireOutput( this, this );
break;
case 2:
m_OnFinishedTeam2.FireOutput( this, this );
break;
default:
Assert(0);
break;
}
g_hCurrentAct = NULL;
// Tell all the clients
CRelieableBroadcastRecipientFilter filter;
UserMessageBegin( filter, "ActEnd" );
WRITE_BYTE( m_iWinners );
MessageEnd();
// Am I an intermission?
if ( HasSpawnFlags( SF_ACT_INTERMISSION ) )
{
// Cycle through all players and end the intermission for them
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
{
CBaseTFPlayer *pPlayer = (CBaseTFPlayer*)UTIL_PlayerByIndex( i );
if ( pPlayer )
{
EndIntermission( pPlayer );
}
}
}
}