当前位置: 首页>>代码示例>>C++>>正文


C++ MessageEnd函数代码示例

本文整理汇总了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();

}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:55,代码来源:ndebugoverlay.cpp

示例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();
	}
}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:20,代码来源:envmessage.cpp

示例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();
}
开发者ID:Nightgunner5,项目名称:Jastian-Summer,代码行数:11,代码来源:asw_sentry_top.cpp

示例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();
}
开发者ID:mkane848,项目名称:HLPlague,代码行数:11,代码来源:basemultiplayerplayer.cpp

示例5: EntityMessageBegin

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CVehicleMortar::OnFinishedDeploy( void )
{
	BaseClass::OnFinishedDeploy();

	EntityMessageBegin( this, true );
		WRITE_STRING( "OnDeployed" );
	MessageEnd();
	
	m_flMortarYaw = 0;
	m_flMortarPitch = 45;
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:14,代码来源:tf_vehicle_mortar.cpp

示例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();
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:11,代码来源:haptic_msgs.cpp

示例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();
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:11,代码来源:haptic_msgs.cpp

示例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();
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:12,代码来源:haptic_msgs.cpp

示例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();
    }
}
开发者ID:kirkelifson,项目名称:game,代码行数:12,代码来源:Timer.cpp

示例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 );
}
开发者ID:Muini,项目名称:Nag-asw,代码行数:15,代码来源:grenade_hopwire.cpp

示例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();
    }
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:13,代码来源:asw_intro_control.cpp

示例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();
}
开发者ID:gamenew09,项目名称:SourceSDK2010,代码行数:55,代码来源:sdk_player.cpp

示例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();
    }
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:22,代码来源:asw_intro_control.cpp

示例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();
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:17,代码来源:forcefeedback.cpp

示例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 );
			}
		}
	}
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:54,代码来源:info_act.cpp


注:本文中的MessageEnd函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。