本文整理汇总了C++中MESSAGE_BEGIN函数的典型用法代码示例。如果您正苦于以下问题:C++ MESSAGE_BEGIN函数的具体用法?C++ MESSAGE_BEGIN怎么用?C++ MESSAGE_BEGIN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MESSAGE_BEGIN函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MESSAGE_BEGIN
void CEnvExplosion::Smoke(void)
{
if (!(pev->spawnflags & SF_ENVEXPLOSION_NOSMOKE))
{
MESSAGE_BEGIN(MSG_PAS, SVC_TEMPENTITY, pev->origin);
WRITE_BYTE(TE_SMOKE);
WRITE_COORD(pev->origin.x);
WRITE_COORD(pev->origin.y);
WRITE_COORD(pev->origin.z);
WRITE_SHORT(g_sModelIndexSmoke);
WRITE_BYTE((BYTE)m_spriteScale); // scale * 10
WRITE_BYTE(12); // framerate
MESSAGE_END();
}
if (!(pev->spawnflags & SF_ENVEXPLOSION_REPEATABLE))
{
UTIL_Remove(this);
}
}
示例2: UTIL_Bubbles
void CGrenade::Smoke( void )
{
if (UTIL_PointContents ( pev->origin ) == CONTENTS_WATER)
{
UTIL_Bubbles( pev->origin - Vector( 64, 64, 64 ), pev->origin + Vector( 64, 64, 64 ), 100 );
}
else
{
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, pev->origin );
WRITE_BYTE( TE_SMOKE );
WRITE_COORD( pev->origin.x );
WRITE_COORD( pev->origin.y );
WRITE_COORD( pev->origin.z );
WRITE_SHORT( g_sModelIndexSmoke );
WRITE_BYTE( (pev->dmg - 50) * 0.80 ); // scale * 10
WRITE_BYTE( 12 ); // framerate
MESSAGE_END();
}
UTIL_Remove( this );
}
示例3: PrimaryAmmoIndex
int CHgun::AddToPlayer( CBasePlayer *pPlayer )
{
if ( CBasePlayerWeapon::AddToPlayer( pPlayer ) )
{
#ifndef CLIENT_DLL
if ( g_pGameRules->IsMultiplayer() )
{
// in multiplayer, all hivehands come full.
pPlayer->m_rgAmmo[ PrimaryAmmoIndex() ] = HORNET_MAX_CARRY;
}
#endif
MESSAGE_BEGIN( MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev );
WRITE_BYTE( m_iId );
MESSAGE_END();
return TRUE;
}
return FALSE;
}
示例4: ClientUserInfoChanged
/*
========================
ClientUserInfoChanged
called after the player changes
userinfo - gives dll a chance to modify it before
it gets sent into the rest of the engine.
========================
*/
void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer )
{
// Is the client spawned yet?
if ( !pEntity->pvPrivateData )
return;
// msg everyone if someone changes their name, and it isn't the first time (changing no name to current name)
if ( pEntity->v.netname && STRING(pEntity->v.netname)[0] != 0 && !FStrEq( STRING(pEntity->v.netname), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" )) )
{
char text[256];
sprintf( text, "* %s changed name to %s\n", STRING(pEntity->v.netname), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) );
MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL );
WRITE_BYTE( ENTINDEX(pEntity) );
WRITE_STRING( text );
MESSAGE_END();
UTIL_LogPrintf( "\"%s<%i>\" changed name to \"%s<%i>\"\n", STRING( pEntity->v.netname ), GETPLAYERUSERID( pEntity ), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ), GETPLAYERUSERID( pEntity ) );
}
g_pGameRules->ClientUserInfoChanged( GetClassPtr((CBasePlayer *)&pEntity->v), infobuffer );
}
示例5: ALERT
// Let the player know there is a particleemitter
void CParticleEmitter::MakeAware( CBaseEntity *pEnt )
{
ALERT(at_console, "CParticleEmitter :: MakeAware\n");
bool bTurnOn = true;
// lets give them everything
MESSAGE_BEGIN(MSG_ONE, gmsgParticles, NULL, pEnt->pev);
WRITE_SHORT(iID);
WRITE_BYTE(0);
WRITE_COORD(pev->origin.x);
WRITE_COORD(pev->origin.y);
WRITE_COORD(pev->origin.z);
WRITE_COORD(pev->angles.x);
WRITE_COORD(pev->angles.y);
WRITE_COORD(pev->angles.z);
WRITE_SHORT(0);
WRITE_STRING(STRING(pev->message));
WRITE_STRING(sParticleDefintionFile);
MESSAGE_END();
}
示例6: esf_set_maxhealth
static cell AMX_NATIVE_CALL esf_set_maxhealth(AMX *amx, cell *params) // esf_set_maxhealth(index, health); = 2 args
{
// Set maxhealth to a player
// params[1] = index
// params[2] = health
// Check index
CHECK_PLAYER( params[ 1 ] );
// Fetch player pointer
edict_t *pPlayer = MF_GetPlayerEdict( params[ 1 ] );
*((int *)pPlayer->pvPrivateData + ESFX_MAXHEALTH_OFFSET) = params[ 2 ];
// Writing maxhealth message to client...
MESSAGE_BEGIN(MSG_ONE, GET_USER_MSG_ID(PLID, "MaxHealth", NULL), NULL, pPlayer);
WRITE_BYTE(params[ 2 ]);
MESSAGE_END();
return 1;
}
示例7: UTIL_DrawBeamFromEnt
NOXREF void UTIL_DrawBeamFromEnt(int iIndex, Vector vecEnd, int iLifetime, byte bRed, byte bGreen, byte bBlue)
{
MESSAGE_BEGIN(MSG_PVS, SVC_TEMPENTITY, vecEnd);
WRITE_BYTE(TE_BEAMENTPOINT);
WRITE_SHORT(iIndex);
WRITE_COORD(vecEnd.x);
WRITE_COORD(vecEnd.y);
WRITE_COORD(vecEnd.z);
WRITE_SHORT(s_iBeamSprite);
WRITE_BYTE(0);
WRITE_BYTE(0);
WRITE_BYTE(iLifetime);
WRITE_BYTE(10);
WRITE_BYTE(0);
WRITE_BYTE(bRed);
WRITE_BYTE(bGreen);
WRITE_BYTE(bBlue);
WRITE_BYTE(255);
WRITE_BYTE(0);
MESSAGE_END();
}
示例8: UTIL_Bubbles
void CGrenade::Smoke3_A( void )
{
if( UTIL_PointContents( pev->origin ) == CONTENTS_WATER )
{
UTIL_Bubbles( pev->origin - Vector( 64, 64, 64 ), pev->origin + Vector( 64, 64, 64 ), 100 );
}
else
{
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, pev->origin );
WRITE_BYTE( TE_SMOKE );
WRITE_COORD( pev->origin.x + RANDOM_FLOAT( -128, 128 ) );
WRITE_COORD( pev->origin.y + RANDOM_FLOAT( -128, 128 ) );
WRITE_COORD( pev->origin.z + RANDOM_FLOAT( -10, 10 ) );
WRITE_SHORT( g_sModelIndexSmoke );
WRITE_BYTE( 15 + RANDOM_FLOAT( 0, 10 ) ); // scale * 10
WRITE_BYTE( 12 ); // framerate
MESSAGE_END();
}
UTIL_Remove( this );
}
示例9: UTIL_BloodStream
void UTIL_BloodStream( const Vector &origin, const Vector &direction, int color, int amount )
{
if ( !UTIL_ShouldShowBlood( color ) )
return;
if ( g_Language == LANGUAGE_GERMAN && color == BLOOD_COLOR_RED )
color = 0;
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, origin );
WRITE_BYTE( TE_BLOODSTREAM );
WRITE_COORD( origin.x );
WRITE_COORD( origin.y );
WRITE_COORD( origin.z );
WRITE_COORD( direction.x );
WRITE_COORD( direction.y );
WRITE_COORD( direction.z );
WRITE_BYTE( color );
WRITE_BYTE( min( amount, 255 ) );
MESSAGE_END();
}
示例10: GetAbsOrigin
void CSmoker::Think( void )
{
Vector vecOrigin = GetAbsOrigin();
// lots of smoke
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecOrigin );
WRITE_BYTE( TE_SMOKE );
WRITE_COORD( vecOrigin.x + RANDOM_FLOAT( -pev->dmg, pev->dmg ));
WRITE_COORD( vecOrigin.y + RANDOM_FLOAT( -pev->dmg, pev->dmg ));
WRITE_COORD( vecOrigin.z );
WRITE_SHORT( g_sModelIndexSmoke );
WRITE_BYTE( RANDOM_LONG( pev->scale, pev->scale * 1.1 ));
WRITE_BYTE( RANDOM_LONG( 8, 14 ) ); // framerate
MESSAGE_END();
pev->health--;
if ( pev->health > 0 )
pev->nextthink = gpGlobals->time + RANDOM_FLOAT(0.1, 0.2);
else
UTIL_Remove( this );
}
示例11: UTIL_Bubbles
void UTIL_Bubbles( Vector mins, Vector maxs, int count )
{
Vector mid = (mins + maxs) * 0.5;
float flHeight = UTIL_WaterLevel( mid, mid.z, mid.z + 1024 );
flHeight = flHeight - mins.z;
MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, mid );
WRITE_BYTE( TE_BUBBLES );
WRITE_COORD( mins.x ); // mins
WRITE_COORD( mins.y );
WRITE_COORD( mins.z );
WRITE_COORD( maxs.x ); // maxz
WRITE_COORD( maxs.y );
WRITE_COORD( maxs.z );
WRITE_COORD( flHeight ); // height
WRITE_SHORT( g_sModelIndexBubbles );
WRITE_BYTE( count ); // count
WRITE_COORD( 8 ); // speed
MESSAGE_END();
}
示例12: EMIT_SOUND
void CRpgRocket::CreateTrail(void)
{
if (!b_setup)
{
// make rocket sound after save\load
EMIT_SOUND(ENT(pev), CHAN_VOICE, "weapons/rocket1.wav", 1, 0.5);
// restore rocket trail
MESSAGE_BEGIN(MSG_BROADCAST, SVC_TEMPENTITY);
WRITE_BYTE(TE_BEAMFOLLOW);
WRITE_SHORT(entindex()); // entity
WRITE_SHORT(m_iTrail); // model
WRITE_BYTE(30); // life
WRITE_BYTE(5); // width
WRITE_BYTE(200); // r, g, b
WRITE_BYTE(200); // r, g, b
WRITE_BYTE(200); // r, g, b
WRITE_BYTE(200); // brightness
MESSAGE_END(); // move PHS/PVS data sending into here (SEND_ALL, SEND_PVS, SEND_PHS)
b_setup = TRUE;
}
}
示例13: GoToIntermission
void CHalfLifeMultiplay :: GoToIntermission( void )
{
if ( g_fGameOver )
return; // intermission has already been triggered, so ignore.
MESSAGE_BEGIN(MSG_ALL, SVC_INTERMISSION);
MESSAGE_END();
// bounds check
int time = (int)CVAR_GET_FLOAT( "mp_chattime" );
if ( time < 1 )
CVAR_SET_STRING( "mp_chattime", "1" );
else if ( time > MAX_INTERMISSION_TIME )
CVAR_SET_STRING( "mp_chattime", UTIL_dtos1( MAX_INTERMISSION_TIME ) );
m_flIntermissionEndTime = gpGlobals->time + ( (int)mp_chattime.value );
g_flIntermissionStartTime = gpGlobals->time;
g_fGameOver = true;
m_iEndIntermissionButtonHit = FALSE;
}
示例14: UTIL_PointContents
void CCrossbowBolt::ExplodeThink( void )
{
int iContents = UTIL_PointContents ( pev->origin );
int iScale;
pev->dmg = 40;
iScale = 10;
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, pev->origin );
WRITE_BYTE( TE_EXPLOSION);
WRITE_COORD( pev->origin.x );
WRITE_COORD( pev->origin.y );
WRITE_COORD( pev->origin.z );
if (iContents != CONTENTS_WATER)
{
WRITE_SHORT( g_sModelIndexFireball );
}
else
{
WRITE_SHORT( g_sModelIndexWExplosion );
}
WRITE_BYTE( iScale ); // scale * 10
WRITE_BYTE( 15 ); // framerate
WRITE_BYTE( TE_EXPLFLAG_NONE );
MESSAGE_END();
entvars_t *pevOwner;
if ( pev->owner )
pevOwner = VARS( pev->owner );
else
pevOwner = NULL;
pev->owner = NULL; // can't traceline attack owner if this is set
::RadiusDamage( pev->origin, pev, pevOwner, pev->dmg, 128, CLASS_NONE, DMG_BLAST | DMG_ALWAYSGIB );
UTIL_Remove(this);
}
示例15: FlashFade
void FlashFade( Vector vecSrc )
{
UTIL_EmitAmbientSound( ENT(0), vecSrc, "weapons/flashbang_explode.wav", 1, ATTN_NORM, 0, 100 );
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSrc );
WRITE_BYTE( TE_DLIGHT );
WRITE_COORD( vecSrc.x );
WRITE_COORD( vecSrc.y );
WRITE_COORD( vecSrc.z );
WRITE_BYTE( 200 );
WRITE_BYTE( 255 );
WRITE_BYTE( 255 );
WRITE_BYTE( 255 );
WRITE_BYTE( 1 );
WRITE_BYTE( 1 );
MESSAGE_END();
TraceResult tr;
CBaseEntity *pEntity = NULL;
for( int i = 1; i <= 32; i++ )
{
pEntity = UTIL_PlayerByIndex( i );
if( pEntity )
{
UTIL_TraceLine( vecSrc, pEntity->pev->origin, ignore_monsters, ENT( pEntity->pev ), &tr );
if( tr.flFraction >= 1 )
{
Vector Angles = UTIL_VecToAngles( vecSrc - pEntity->pev->origin ) - pEntity->pev->angles;
float a = 255;
if( Angles.y >= 135 && Angles.y <= 225 )
a = 200;
UTIL_ScreenFade( pEntity, Vector( 255, 255, 255 ), 5, 2, a, 0 );
}
}
}
}