Send the correct CGM number depending on the protocol used

This commit is contained in:
OM 2023-07-02 18:32:16 +02:00
parent b6a44fe810
commit 174d3f7447
8 changed files with 171 additions and 185 deletions

View file

@ -238,11 +238,11 @@ void BarrelObject::BarrelThink
if( m_iBarrelType == BARREL_OIL )
{
gi.MSG_StartCGM(CGM_MAKE_EFFECT_1);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_MAKE_EFFECT_1));
}
else
{
gi.MSG_StartCGM(CGM_MAKE_EFFECT_5);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_MAKE_EFFECT_5));
}
m_fFluidAmount -= 1.0f;
@ -254,11 +254,11 @@ void BarrelObject::BarrelThink
if( m_iBarrelType == BARREL_OIL )
{
gi.MSG_StartCGM(CGM_MAKE_EFFECT_2);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_MAKE_EFFECT_2));
}
else
{
gi.MSG_StartCGM(CGM_MAKE_EFFECT_6);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_MAKE_EFFECT_6));
}
m_fFluidAmount -= 0.75f;
@ -271,11 +271,11 @@ void BarrelObject::BarrelThink
if( m_iBarrelType == BARREL_OIL )
{
gi.MSG_StartCGM(CGM_MAKE_EFFECT_3);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_MAKE_EFFECT_3));
}
else
{
gi.MSG_StartCGM(CGM_MAKE_EFFECT_7);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_MAKE_EFFECT_7));
}
m_fFluidAmount -= 0.5f;
@ -294,11 +294,11 @@ void BarrelObject::BarrelThink
if( m_iBarrelType == BARREL_OIL )
{
gi.MSG_StartCGM(CGM_MAKE_EFFECT_3);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_MAKE_EFFECT_3));
}
else
{
gi.MSG_StartCGM(CGM_MAKE_EFFECT_7);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_MAKE_EFFECT_7));
}
gi.MSG_WriteCoord( m_vLeaks[ i ][ 0 ] );
@ -506,18 +506,18 @@ void BarrelObject::BarrelDamaged
gi.SetBroadcastVisible( vHitPos, vHitPos );
if( m_iBarrelType == BARREL_OIL )
gi.MSG_StartCGM(CGM_MAKE_EFFECT_4);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_MAKE_EFFECT_4));
else
gi.MSG_StartCGM(CGM_MAKE_EFFECT_8);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_MAKE_EFFECT_8));
}
else
{
gi.SetBroadcastVisible( vHitPos, vHitPos );
if( m_iBarrelType == BARREL_OIL )
gi.MSG_StartCGM(CGM_MAKE_EFFECT_3);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_MAKE_EFFECT_3));
else
gi.MSG_StartCGM(CGM_MAKE_EFFECT_7);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_MAKE_EFFECT_7));
}
gi.MSG_WriteCoord( vHitPos[ 0 ] );

View file

@ -387,3 +387,41 @@ void BG_PlayerStateToEntityStateExtraPolate( playerState_t *ps, entityState_t *s
s->groundEntityNum = ps->groundEntityNum;
}
/*
========================
BG_MapCGMToProtocol
This is done after each set of usercmd_t on the server,
and after local prediction on the client
========================
*/
int BG_MapCGMToProtocol(protocol_e protocol, int messageNumber)
{
int newMessageNumber = messageNumber;
if (protocol >= PROTOCOL_MOHTA_MIN) {
// no need translation
return messageNumber;
}
if (messageNumber > 40) {
// unsupported...
return messageNumber;
}
if (messageNumber >= 17) {
return messageNumber - 3;
}
if (messageNumber == 15 || messageNumber == 16) {
// return explosion effect number 2
return 14;
}
if (messageNumber > 10) {
return messageNumber - 1;
}
return newMessageNumber;
}

View file

@ -647,8 +647,6 @@ void BG_EvaluateTrajectoryDelta( const trajectory_t *tr, int atTime, vec3_t resu
void BG_PlayerStateToEntityState( playerState_t *ps, entityState_t *s, qboolean snap );
void BG_PlayerStateToEntityStateExtraPolate(playerState_t* ps, entityState_t* s, int time, qboolean snap);
#if TARGET_GAME_PROTOCOL >= 15
enum vmAnim_e {
VM_ANIM_DISABLED,
VM_ANIM_IDLE,
@ -667,7 +665,7 @@ enum vmAnim_e {
VM_ANIM_IDLE_2,
};
enum cg_message_e {
enum cg_message_ver_15_e {
CGM_NONE,
CGM_BULLET_1,
CGM_BULLET_2,
@ -681,10 +679,10 @@ enum cg_message_e {
CGM_BULLET_10,
CGM_BULLET_11,
CGM_MELEE_IMPACT,
CGM_EXPLOSION_EFFECT_1,
CGM_EXPLOSION_EFFECT_2,
CGM_EXPLOSION_EFFECT_3,
CGM_EXPLOSION_EFFECT_4,
CGM_EXPLOSION_EFFECT_1,
CGM_EXPLOSION_EFFECT_2,
CGM_EXPLOSION_EFFECT_3,
CGM_EXPLOSION_EFFECT_4,
CGM_PADDING_1,
CGM_MAKE_EFFECT_1,
CGM_MAKE_EFFECT_2,
@ -712,98 +710,48 @@ enum cg_message_e {
CGM_UNKNOWN_1,
};
#else
enum vmAnim_e {
VM_ANIM_IDLE,
VM_ANIM_CHARGE,
VM_ANIM_FIRE,
VM_ANIM_FIRE_SECONDARY,
VM_ANIM_RECHAMBER,
VM_ANIM_RELOAD,
VM_ANIM_RELOAD_SINGLE,
VM_ANIM_RELOAD_END,
VM_ANIM_PULLOUT,
VM_ANIM_PUTAWAY,
VM_ANIM_LADDERSTEP,
VM_ANIM_IDLE_0,
VM_ANIM_IDLE_1,
VM_ANIM_IDLE_2,
VM_ANIM_DISABLED,
enum cg_message_ver_6_e {
CGM6_NONE,
CGM6_BULLET_1,
CGM6_BULLET_2,
CGM6_BULLET_3,
CGM6_BULLET_4,
CGM6_BULLET_5,
CGM6_BULLET_6,
CGM6_BULLET_7,
CGM6_BULLET_8,
CGM6_BULLET_9,
CGM6_BULLET_10,
CGM6_MELEE_IMPACT,
CGM6_EXPLOSION_EFFECT_1,
CGM6_EXPLOSION_EFFECT_2,
CGM6_PADDING_1,
CGM6_MAKE_EFFECT_1,
CGM6_MAKE_EFFECT_2,
CGM6_MAKE_EFFECT_3,
CGM6_MAKE_EFFECT_4,
CGM6_MAKE_EFFECT_5,
CGM6_MAKE_EFFECT_6,
CGM6_MAKE_EFFECT_7,
CGM6_MAKE_EFFECT_8,
CGM6_MAKE_CRATE_DEBRIS,
CGM6_MAKE_WINDOW_DEBRIS,
CGM6_BULLET_NO_BARREL_1,
CGM6_BULLET_NO_BARREL_2,
CGM6_HUDDRAW_SHADER,
CGM6_HUDDRAW_ALIGN,
CGM6_HUDDRAW_RECT,
CGM6_HUDDRAW_VIRTUALSIZE,
CGM6_HUDDRAW_COLOR,
CGM6_HUDDRAW_ALPHA,
CGM6_HUDDRAW_STRING,
CGM6_HUDDRAW_FONT,
CGM6_NOTIFY_KILL,
CGM6_NOTIFY_HIT,
CGM6_VOICE_CHAT,
};
enum cg_message_e {
CGM_NONE,
CGM_BULLET_1,
CGM_BULLET_2,
CGM_BULLET_3,
CGM_BULLET_4,
CGM_BULLET_5,
CGM_BULLET_6,
CGM_BULLET_7,
CGM_BULLET_8,
CGM_BULLET_9,
CGM_BULLET_10,
CGM_MELEE_IMPACT,
CGM_EXPLOSION_EFFECT_1,
CGM_EXPLOSION_EFFECT_2,
CGM_PADDING_1,
CGM_MAKE_EFFECT_1,
CGM_MAKE_EFFECT_2,
CGM_MAKE_EFFECT_3,
CGM_MAKE_EFFECT_4,
CGM_MAKE_EFFECT_5,
CGM_MAKE_EFFECT_6,
CGM_MAKE_EFFECT_7,
CGM_MAKE_EFFECT_8,
CGM_MAKE_CRATE_DEBRIS,
CGM_MAKE_WINDOW_DEBRIS,
CGM_BULLET_NO_BARREL_1,
CGM_BULLET_NO_BARREL_2,
CGM_HUDDRAW_SHADER,
CGM_HUDDRAW_ALIGN,
CGM_HUDDRAW_RECT,
CGM_HUDDRAW_VIRTUALSIZE,
CGM_HUDDRAW_COLOR,
CGM_HUDDRAW_ALPHA,
CGM_HUDDRAW_STRING,
CGM_HUDDRAW_FONT,
CGM_NOTIFY_KILL,
CGM_NOTIFY_HIT,
CGM_VOICE_CHAT,
};
#endif
/*
#define CGM_HUDDRAW_SHADER 27
#define CGM_HUDDRAW_ALIGN 28
#define CGM_HUDDRAW_RECT 29
#define CGM_HUDDRAW_VIRTUALSIZE 30
#define CGM_HUDDRAW_COLOR 31
#define CGM_HUDDRAW_ALPHA 32
#define CGM_HUDDRAW_STRING 33
#define CGM_HUDDRAW_FONT 34
#define CGM_HUDDRAW_TIMER 38
#define CGM_HUDDRAW_3D 39
#define CGM_HUDDRAW_BREAK3D 40
#define CGM_HUDDRAW_FADE 41
#define CGM_HUDDRAW_MOVE 42
#define CGM_HUDDRAW_SCALE 43
#define CGM_VIEWMODELANIM 44
#define CGM_VIEWMODELPREFIX 45
#define CGM_MODHEIGHTFLOAT 46
#define CGM_SETVMASPEED 47
#define CGM_HINTSTRING 48
#define CGM_PLAYLOCALSOUND 49
#define CGM_SETLOCALSOUNDRATE 50
#define CGM_STOPLOCALSOUND 51
#define CGM_HUDDRAW_RECTX 52
#define CGM_HUDDRAW_RECTY 53
#define CGM_HUDDRAW_RECTWH 54
#define CGM_REPLICATION 55
#define CGM_HUDDRAW_DELETE 56
*/
int BG_MapCGMToProtocol(protocol_e protocol, int messageNumber);
#ifdef __cplusplus
}

View file

@ -465,7 +465,7 @@ void CrateObject::CrateKilled
// Tell clients around that a crate is destroyed
gi.SetBroadcastVisible( origin, origin );
gi.MSG_StartCGM(CGM_MAKE_CRATE_DEBRIS);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_MAKE_CRATE_DEBRIS));
gi.MSG_WriteCoord( vCenter[ 0 ] );
gi.MSG_WriteCoord( vCenter[ 1 ] );
gi.MSG_WriteCoord( vCenter[ 2 ] );

View file

@ -507,7 +507,7 @@ Hud::~Hud()
#ifdef GAME_DLL
SetBroadcast();
gi.MSG_StartCGM( CGM_HUDDRAW_DELETE );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_DELETE );
WriteNumber();
gi.MSG_EndCGM();
#endif
@ -960,7 +960,7 @@ void Hud::FadeOverTime( float time )
#ifdef GAME_DLL
SetBroadcast();
gi.MSG_StartCGM( CGM_HUDDRAW_FADE );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_FADE ));
WriteNumber();
gi.MSG_WriteFloat( time );
gi.MSG_EndCGM();
@ -991,7 +991,7 @@ void Hud::MoveOverTime( float time )
#ifdef GAME_DLL
SetBroadcast();
gi.MSG_StartCGM( CGM_HUDDRAW_MOVE );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_MOVE ));
WriteNumber();
gi.MSG_WriteFloat( time );
gi.MSG_EndCGM();
@ -1004,7 +1004,7 @@ void Hud::Refresh( int clientNumber )
#ifdef GAME_DLL
SetBroadcast( clientNumber );
gi.MSG_StartCGM( CGM_HUDDRAW_ALIGN );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_ALIGN ));
WriteNumber();
gi.MSG_WriteBits( alignX, 2 );
gi.MSG_WriteBits( alignY, 2 );
@ -1012,14 +1012,14 @@ void Hud::Refresh( int clientNumber )
SetBroadcast( clientNumber );
gi.MSG_StartCGM( CGM_HUDDRAW_ALPHA );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_ALPHA ));
WriteNumber();
gi.MSG_WriteByte( ( uchar )( alpha * 255.0f ) );
gi.MSG_EndCGM();
SetBroadcast( clientNumber );
gi.MSG_StartCGM( CGM_HUDDRAW_COLOR );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_COLOR ));
WriteNumber();
gi.MSG_WriteByte( ( uchar )( color.x * 255.0f ) );
gi.MSG_WriteByte( ( uchar )( color.y * 255.0f ) );
@ -1028,7 +1028,7 @@ void Hud::Refresh( int clientNumber )
SetBroadcast( clientNumber );
gi.MSG_StartCGM( CGM_HUDDRAW_FONT );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_FONT ));
WriteNumber();
gi.MSG_WriteString( fontName );
gi.MSG_EndCGM();
@ -1037,17 +1037,17 @@ void Hud::Refresh( int clientNumber )
/*if( sv_reborn->integer )
{
gi.MSG_StartCGM( CGM_HUDDRAW_RECTX );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_RECTX ));
WriteNumber();
gi.MSG_WriteShort( ( short )x );
gi.MSG_EndCGM();
gi.MSG_StartCGM( CGM_HUDDRAW_RECTY );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_RECTY ));
WriteNumber();
gi.MSG_WriteShort( ( short )y );
gi.MSG_EndCGM();
gi.MSG_StartCGM( CGM_HUDDRAW_RECTWH );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_RECTWH ));
WriteNumber();
gi.MSG_WriteShort( ( short )width );
gi.MSG_WriteShort( ( short )height );
@ -1055,7 +1055,7 @@ void Hud::Refresh( int clientNumber )
}
else
{
gi.MSG_StartCGM( CGM_HUDDRAW_RECT );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_RECT ));
WriteNumber();
gi.MSG_WriteShort( ( short )x );
gi.MSG_WriteShort( ( short )y );
@ -1064,7 +1064,7 @@ void Hud::Refresh( int clientNumber )
gi.MSG_EndCGM();
}*/
gi.MSG_StartCGM( CGM_HUDDRAW_RECT );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_RECT ));
WriteNumber();
gi.MSG_WriteShort( ( short )x );
gi.MSG_WriteShort( ( short )y );
@ -1074,21 +1074,21 @@ void Hud::Refresh( int clientNumber )
SetBroadcast( clientNumber );
gi.MSG_StartCGM( CGM_HUDDRAW_SHADER );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_SHADER ));
WriteNumber();
gi.MSG_WriteString( shader );
gi.MSG_EndCGM();
SetBroadcast( clientNumber );
gi.MSG_StartCGM( CGM_HUDDRAW_STRING );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_STRING ));
WriteNumber();
gi.MSG_WriteString( text );
gi.MSG_EndCGM();
SetBroadcast( clientNumber );
gi.MSG_StartCGM( CGM_HUDDRAW_VIRTUALSIZE );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_VIRTUALSIZE ));
WriteNumber();
gi.MSG_WriteBits( virtualSize, 1 );
gi.MSG_EndCGM();
@ -1100,7 +1100,7 @@ void Hud::Refresh( int clientNumber )
SetBroadcast();
/*
gi.MSG_StartCGM( CGM_HUDDRAW_3D );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_3D ));
WriteNumber();
gi.MSG_WriteCoord( org[ 0 ] );
gi.MSG_WriteCoord( org[ 1 ] );
@ -1119,7 +1119,7 @@ void Hud::Refresh( int clientNumber )
SetBroadcast();
/*
gi.MSG_StartCGM( CGM_HUDDRAW_FADE );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_FADE ));
WriteNumber();
gi.MSG_WriteFloat( fade_alpha_current );
gi.MSG_EndCGM();
@ -1127,7 +1127,7 @@ void Hud::Refresh( int clientNumber )
SetBroadcast();
gi.MSG_StartCGM( CGM_HUDDRAW_ALPHA );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_ALPHA ));
WriteNumber();
gi.MSG_WriteByte( ( uchar )( fade_alpha_target * 255.0f ) );
gi.MSG_EndCGM();
@ -1138,14 +1138,14 @@ void Hud::Refresh( int clientNumber )
SetBroadcast();
/*
gi.MSG_StartCGM( CGM_HUDDRAW_MOVE );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_MOVE ));
WriteNumber();
gi.MSG_WriteFloat( fade_move_current );
gi.MSG_EndCGM();
SetBroadcast();
gi.MSG_StartCGM( CGM_HUDDRAW_RECT );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_RECT ));
WriteNumber();
gi.MSG_WriteShort( ( short )fade_move_x_target );
gi.MSG_WriteShort( ( short )fade_move_y_target );
@ -1158,7 +1158,7 @@ void Hud::Refresh( int clientNumber )
/*
SetBroadcast();
gi.MSG_StartCGM( CGM_HUDDRAW_TIMER );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_TIMER ));
WriteNumber();
gi.MSG_WriteFloat( fade_time_current );
gi.MSG_WriteFloat( fade_out_time );
@ -1204,7 +1204,7 @@ void Hud::ScaleOverTime( float time, short w, short h )
SetBroadcast();
gi.MSG_StartCGM( CGM_HUDDRAW_SCALE );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_SCALE ));
WriteNumber();
gi.MSG_WriteFloat( time );
gi.MSG_WriteShort( w );
@ -1255,7 +1255,7 @@ void Hud::Set3D( Vector vector_or_offset, qboolean alwaysOnScreen, qboolean hasD
#ifdef GAME_DLL
SetBroadcast();
gi.MSG_StartCGM( CGM_HUDDRAW_3D );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_3D ));
WriteNumber();
gi.MSG_WriteCoord( vector_or_offset[ 0 ] );
gi.MSG_WriteCoord( vector_or_offset[ 1 ] );
@ -1277,7 +1277,7 @@ void Hud::SetNon3D()
/*
SetBroadcast();
gi.MSG_StartCGM( CGM_HUDDRAW_BREAK3D );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_BREAK3D ));
WriteNumber();
gi.MSG_EndCGM();
*/
@ -1294,7 +1294,7 @@ void Hud::SetAlignX( hudAlign_t align )
#ifdef GAME_DLL
SetBroadcast();
gi.MSG_StartCGM( CGM_HUDDRAW_ALIGN );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_ALIGN ));
WriteNumber();
gi.MSG_WriteBits( alignX, 2 );
gi.MSG_WriteBits( alignY, 2 );
@ -1313,7 +1313,7 @@ void Hud::SetAlignY( hudAlign_t align )
#ifdef GAME_DLL
SetBroadcast();
gi.MSG_StartCGM( CGM_HUDDRAW_ALIGN );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_ALIGN ));
WriteNumber();
gi.MSG_WriteBits( alignX, 2 );
gi.MSG_WriteBits( alignY, 2 );
@ -1344,7 +1344,7 @@ void Hud::SetAlpha( float value )
SetBroadcast();
gi.MSG_StartCGM( CGM_HUDDRAW_ALPHA );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_ALPHA ));
WriteNumber();
gi.MSG_WriteByte( ucharvalue );
gi.MSG_EndCGM();
@ -1358,7 +1358,7 @@ void Hud::SetColor( Vector c )
#ifdef GAME_DLL
SetBroadcast();
gi.MSG_StartCGM( CGM_HUDDRAW_COLOR );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_COLOR ));
WriteNumber();
gi.MSG_WriteByte( ( uchar )( c.x * 255.0f ) );
gi.MSG_WriteByte( ( uchar )( c.y * 255.0f ) );
@ -1378,7 +1378,7 @@ void Hud::SetClient( int c, qboolean clears )
#ifdef GAME_DLL
SetBroadcast();
gi.MSG_StartCGM( CGM_HUDDRAW_ALPHA );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_ALPHA ));
WriteNumber();
gi.MSG_WriteByte( 0 );
gi.MSG_EndCGM();
@ -1409,7 +1409,7 @@ void Hud::SetFont( const char * f )
#ifdef GAME_DLL
SetBroadcast();
gi.MSG_StartCGM( CGM_HUDDRAW_FONT );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_FONT ));
WriteNumber();
gi.MSG_WriteString( f );
gi.MSG_EndCGM();
@ -1436,7 +1436,7 @@ void Hud::SetRectX( short value )
#ifdef GAME_DLL
SetBroadcast();
gi.MSG_StartCGM(CGM_HUDDRAW_RECT);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_RECT));
WriteNumber();
gi.MSG_WriteShort((short)fade_move_x_target);
gi.MSG_WriteShort((short)fade_move_y_target);
@ -1462,7 +1462,7 @@ void Hud::SetRectY( short value )
#ifdef GAME_DLL
SetBroadcast();
gi.MSG_StartCGM(CGM_HUDDRAW_RECT);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_RECT));
WriteNumber();
gi.MSG_WriteShort((short)fade_move_x_target);
gi.MSG_WriteShort((short)fade_move_y_target);
@ -1513,7 +1513,7 @@ void Hud::SetShader( const char * s, float w, float h )
#ifdef GAME_DLL
SetBroadcast();
gi.MSG_StartCGM(CGM_HUDDRAW_RECT);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_RECT));
WriteNumber();
gi.MSG_WriteShort((short)x);
gi.MSG_WriteShort((short)y);
@ -1523,7 +1523,7 @@ void Hud::SetShader( const char * s, float w, float h )
SetBroadcast();
gi.MSG_StartCGM( CGM_HUDDRAW_SHADER );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_SHADER ));
WriteNumber();
gi.MSG_WriteString( s );
gi.MSG_EndCGM();
@ -1548,7 +1548,7 @@ void Hud::SetText( const char * t )
#ifdef GAME_DLL
SetBroadcast();
gi.MSG_StartCGM( CGM_HUDDRAW_STRING );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_STRING ));
WriteNumber();
gi.MSG_WriteString( t );
gi.MSG_EndCGM();
@ -1573,7 +1573,7 @@ void Hud::SetTimer( float time, float fade_at_time )
/*
SetBroadcast();
gi.MSG_StartCGM( CGM_HUDDRAW_TIMER );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_TIMER ));
WriteNumber();
gi.MSG_WriteFloat( time );
gi.MSG_WriteFloat( fade_at_time );
@ -1600,7 +1600,7 @@ void Hud::SetTimerUp( float time, float fade_at_time )
#ifdef GAME_DLL
SetBroadcast();
gi.MSG_StartCGM( CGM_HUDDRAW_TIMER );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_TIMER ));
WriteNumber();
gi.MSG_WriteFloat( time );
gi.MSG_WriteFloat( fade_at_time );
@ -1617,7 +1617,7 @@ void Hud::SetVirtualSize( qboolean v )
#ifdef GAME_DLL
SetBroadcast();
gi.MSG_StartCGM( CGM_HUDDRAW_VIRTUALSIZE );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_VIRTUALSIZE ));
WriteNumber();
gi.MSG_WriteBits( virtualSize, 1 );
gi.MSG_EndCGM();

View file

@ -38,7 +38,7 @@ void HudWriteNumber( int num )
void HudDrawShader( int info, const char *name )
{
gi.SetBroadcastAll();
gi.MSG_StartCGM(CGM_HUDDRAW_SHADER);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_SHADER));
HudWriteNumber( info ); // c = info
gi.MSG_WriteString(name); // s = name (shader_name)
gi.MSG_EndCGM();
@ -47,7 +47,7 @@ void HudDrawShader( int info, const char *name )
void HudDrawAlign( int info, int horizontalAlign, int verticalAlign )
{
gi.SetBroadcastAll();
gi.MSG_StartCGM(CGM_HUDDRAW_ALIGN);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_ALIGN));
HudWriteNumber( info ); // c = probably "info"
gi.MSG_WriteBits(horizontalAlign, 2); // value = 0,1,2 bits = 2
// 0 - left \
@ -66,7 +66,7 @@ void HudDrawAlign( int info, int horizontalAlign, int verticalAlign )
void HudDrawRect(int info, int x, int y, int width, int height)
{
gi.SetBroadcastAll();
gi.MSG_StartCGM(CGM_HUDDRAW_RECT);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_RECT));
HudWriteNumber( info ); // c = probably "info"
gi.MSG_WriteShort(x); // c = probably "x"
gi.MSG_WriteShort(y); // c = probably "y"
@ -79,7 +79,7 @@ void HudDrawRect(int info, int x, int y, int width, int height)
void HudDrawVirtualSize(int info, int virtualScreen)
{
gi.SetBroadcastAll();
gi.MSG_StartCGM(CGM_HUDDRAW_VIRTUALSIZE);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_VIRTUALSIZE));
HudWriteNumber( info ); // c = info
/*__asm
@ -116,7 +116,7 @@ void HudDrawColor(int info, float *color)
gi.SetBroadcastAll();
gi.MSG_StartCGM(CGM_HUDDRAW_COLOR);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_COLOR));
HudWriteNumber( info ); // c = info
gi.MSG_WriteByte(temp[0]); // c = color[2]
gi.MSG_WriteByte(temp[1]); // c = color[1] - Values can be messed up. To be tested.
@ -132,7 +132,7 @@ void HudDrawAlpha(int info, float alpha)
temp = (long int)(alpha*255.0f);
gi.SetBroadcastAll();
gi.MSG_StartCGM(CGM_HUDDRAW_ALPHA);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_ALPHA));
HudWriteNumber( info ); // c = info
gi.MSG_WriteByte(temp); // c = alpha
gi.MSG_EndCGM();
@ -144,7 +144,7 @@ void HudDrawAlpha(int info, float alpha)
void HudDrawString(int info, const char *string)
{
gi.SetBroadcastAll();
gi.MSG_StartCGM(CGM_HUDDRAW_STRING);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_STRING));
HudWriteNumber( info ); // c = info
gi.MSG_WriteString(string); // s = string (to show)
gi.MSG_EndCGM();
@ -154,7 +154,7 @@ void HudDrawString(int info, const char *string)
void HudDrawFont(int info, const char *fontName)
{
gi.SetBroadcastAll();
gi.MSG_StartCGM(CGM_HUDDRAW_FONT);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_FONT));
HudWriteNumber( info ); // c = info
gi.MSG_WriteString(fontName); // s = fontName (to use)
gi.MSG_EndCGM();
@ -167,7 +167,7 @@ void HudDraw3d( int index, vec3_t vector, int ent_num, qboolean bAlwaysShow, qbo
/*
gi.SetBroadcastAll();
gi.MSG_StartCGM( CGM_HUDDRAW_3D );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_3D ));
HudWriteNumber( index );
gi.MSG_WriteCoord( vector[0] );
gi.MSG_WriteCoord( vector[1] );
@ -186,7 +186,7 @@ void HudDrawTimer( int index, float duration, float fade_out_time )
/*
gi.SetBroadcastAll();
gi.MSG_StartCGM( CGM_HUDDRAW_TIMER );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_TIMER ));
HudWriteNumber( index );
gi.MSG_WriteFloat( duration );
gi.MSG_WriteFloat( fade_out_time );
@ -197,7 +197,7 @@ void HudDrawTimer( int index, float duration, float fade_out_time )
void iHudDrawShader( int cl_num, int info, const char *name )
{
gi.MSG_SetClient(cl_num);
gi.MSG_StartCGM(CGM_HUDDRAW_SHADER);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_SHADER));
HudWriteNumber( info ); // c = info
gi.MSG_WriteString(name); // s = name (shader_name)
gi.MSG_EndCGM();
@ -207,7 +207,7 @@ void iHudDrawShader( int cl_num, int info, const char *name )
void iHudDrawAlign(int cl_num, int info, int horizontalAlign, int verticalAlign )
{
gi.MSG_SetClient(cl_num);
gi.MSG_StartCGM(CGM_HUDDRAW_ALIGN);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_ALIGN));
HudWriteNumber( info ); // c = probably "info"
gi.MSG_WriteBits(horizontalAlign, 2); // value = 0,1,2 bits = 2
// 0 - left \
@ -226,7 +226,7 @@ void iHudDrawAlign(int cl_num, int info, int horizontalAlign, int verticalAlign
void iHudDrawRect(int cl_num, int info, int x, int y, int width, int height)
{
gi.MSG_SetClient(cl_num);
gi.MSG_StartCGM(CGM_HUDDRAW_RECT);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_RECT));
HudWriteNumber( info ); // c = probably "info"
gi.MSG_WriteShort(x); // c = probably "x"
gi.MSG_WriteShort(y); // c = probably "y"
@ -240,7 +240,7 @@ void iHudDraw3d( int cl_num, int index, vec3_t vector, int ent_num, qboolean bAl
/*
gi.MSG_SetClient( cl_num );
gi.MSG_StartCGM( CGM_HUDDRAW_3D );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_3D ));
HudWriteNumber( index );
gi.MSG_WriteCoord( vector[0] );
gi.MSG_WriteCoord( vector[1] );
@ -259,7 +259,7 @@ void iHudDrawTimer( int cl_num, int index, float duration, float fade_out_time )
/*
gi.MSG_SetClient( cl_num );
gi.MSG_StartCGM( CGM_HUDDRAW_TIMER );
gi.MSG_StartCGM( BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_TIMER ));
HudWriteNumber( index );
gi.MSG_WriteFloat( duration );
gi.MSG_WriteFloat( fade_out_time );
@ -270,7 +270,7 @@ void iHudDrawTimer( int cl_num, int index, float duration, float fade_out_time )
void iHudDrawVirtualSize(int cl_num, int info, int virtualScreen)
{
gi.MSG_SetClient(cl_num);
gi.MSG_StartCGM(CGM_HUDDRAW_VIRTUALSIZE);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_VIRTUALSIZE));
HudWriteNumber( info ); // c = info
gi.MSG_WriteBits(!!virtualScreen, 1); // value = ? bits = 1
@ -294,7 +294,7 @@ void iHudDrawColor(int cl_num, int info, float *color)
temp[2] = (long int)(color[2]*255.0f);
gi.MSG_SetClient(cl_num);
gi.MSG_StartCGM(CGM_HUDDRAW_COLOR);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_COLOR));
HudWriteNumber( info ); // c = info
gi.MSG_WriteByte(temp[0]); // c = color[2]
gi.MSG_WriteByte(temp[1]); // c = color[1] - Values can be messed up. To be tested.
@ -310,7 +310,7 @@ void iHudDrawAlpha(int cl_num, int info, float alpha)
temp = (long int)(alpha*255.0f);
gi.MSG_SetClient(cl_num);
gi.MSG_StartCGM(CGM_HUDDRAW_ALPHA);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_ALPHA));
HudWriteNumber( info ); // c = info
gi.MSG_WriteByte(temp); // c = alpha
gi.MSG_EndCGM();
@ -322,7 +322,7 @@ void iHudDrawAlpha(int cl_num, int info, float alpha)
void iHudDrawString( int cl_num, int info, const char *string )
{
gi.MSG_SetClient(cl_num);
gi.MSG_StartCGM(CGM_HUDDRAW_STRING);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_STRING));
HudWriteNumber( info ); // c = info
gi.MSG_WriteString(string); // s = string (to show)
gi.MSG_EndCGM();
@ -332,7 +332,7 @@ void iHudDrawString( int cl_num, int info, const char *string )
void iHudDrawFont( int cl_num, int info, const char *fontName )
{
gi.MSG_SetClient(cl_num);
gi.MSG_StartCGM(CGM_HUDDRAW_FONT);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_HUDDRAW_FONT));
HudWriteNumber( info ); // c = info
gi.MSG_WriteString(fontName); // s = fontName (to use)
gi.MSG_EndCGM();

View file

@ -5780,9 +5780,9 @@ void Player::Pain
{
gi.MSG_SetClient( attacker->edict - g_entities );
if( IsDead() )
gi.MSG_StartCGM(CGM_NOTIFY_KILL);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_NOTIFY_KILL));
else
gi.MSG_StartCGM(CGM_NOTIFY_HIT);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_NOTIFY_HIT));
gi.MSG_EndCGM();
}
@ -13214,13 +13214,13 @@ void Player::EventDMMessage
if( bInstaMessage )
{
gi.MSG_SetClient( i );
gi.MSG_StartCGM(CGM_VOICE_CHAT);
gi.MSG_WriteCoord( m_vViewPos[ 0 ] );
gi.MSG_WriteCoord( m_vViewPos[ 1 ] );
gi.MSG_WriteCoord( m_vViewPos[ 2 ] );
gi.MSG_WriteBits( 1, 1 );
gi.MSG_WriteBits( edict - g_entities, 6 );
gi.MSG_WriteString( voiceName.c_str() );
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_VOICE_CHAT));
gi.MSG_WriteCoord( m_vViewPos[ 0 ] );
gi.MSG_WriteCoord( m_vViewPos[ 1 ] );
gi.MSG_WriteCoord( m_vViewPos[ 2 ] );
gi.MSG_WriteBits( 1, 1 );
gi.MSG_WriteBits( edict - g_entities, 6 );
gi.MSG_WriteString( voiceName.c_str() );
gi.MSG_EndCGM();
}
}

View file

@ -1785,11 +1785,11 @@ void Explosion::MakeExplosionEffect
if( !sEffect.icmp( "grenade" ) )
{
gi.MSG_StartCGM(CGM_EXPLOSION_EFFECT_1);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_EXPLOSION_EFFECT_1));
}
else
{
gi.MSG_StartCGM(CGM_EXPLOSION_EFFECT_2);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_EXPLOSION_EFFECT_2));
}
gi.MSG_WriteCoord( origin[ 0 ] );
@ -2349,20 +2349,20 @@ void FakeBulletAttack
( *piTracerCount )++;
if( *piTracerCount == iTracerFrequency )
{
gi.MSG_StartCGM(CGM_BULLET_NO_BARREL_1);
gi.MSG_WriteCoord( vBarrel[ 0 ] );
gi.MSG_WriteCoord( vBarrel[ 1 ] );
gi.MSG_WriteCoord( vBarrel[ 2 ] );
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_BULLET_NO_BARREL_1));
gi.MSG_WriteCoord( vBarrel[ 0 ] );
gi.MSG_WriteCoord( vBarrel[ 1 ] );
gi.MSG_WriteCoord( vBarrel[ 2 ] );
*piTracerCount = 0;
}
else
{
gi.MSG_StartCGM(CGM_BULLET_NO_BARREL_2);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_BULLET_NO_BARREL_2));
}
}
else
{
gi.MSG_StartCGM(CGM_BULLET_NO_BARREL_2);
gi.MSG_StartCGM(BG_MapCGMToProtocol(gi.protocol, CGM_BULLET_NO_BARREL_2));
}
gi.MSG_WriteCoord( start[ 0 ] );