mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 13:47:58 +03:00
Added Spearhead/Breakthrough client support
This commit is contained in:
parent
e23ce01d19
commit
04b5fdb934
7 changed files with 110 additions and 17 deletions
|
@ -3666,6 +3666,49 @@ qboolean Player::checkimmediateswitch( Conditional &condition )
|
|||
return ( g_gametype->integer && g_immediateswitch->integer );
|
||||
}
|
||||
|
||||
|
||||
qboolean Player::checkmovementspeed(Conditional& condition)
|
||||
{
|
||||
int speed = atoi(condition.getParm(1));
|
||||
return client->ps.speed >= speed;
|
||||
}
|
||||
|
||||
qboolean Player::checkabletodefuse(Conditional& condition)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
return true;
|
||||
}
|
||||
|
||||
qboolean Player::checkonlandmine(Conditional& condition)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
return false;
|
||||
}
|
||||
|
||||
qboolean Player::checknearlandmine(Conditional& condition)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
return false;
|
||||
}
|
||||
|
||||
qboolean Player::CondCanPlaceLandmine(Conditional& condition)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
return false;
|
||||
}
|
||||
|
||||
qboolean Player::CondWeaponCurrentFireAnim(Conditional& condition)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
return false;
|
||||
}
|
||||
|
||||
qboolean Player::CondVehicleType(Conditional& condition)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
return false;
|
||||
}
|
||||
|
||||
qboolean Player::CondAnimDoneVM( Conditional &condition )
|
||||
{
|
||||
return animDoneVM;
|
||||
|
@ -4024,6 +4067,13 @@ Condition<Player> Player::Conditions[] =
|
|||
{ "MIN_CHARGE_TIME_MET", &Player::checkminchargetimemet },
|
||||
{ "MAX_CHARGE_TIME_MET", &Player::checkmaxchargetimemet },
|
||||
{ "IMMEDIATE_SWITCH", &Player::checkimmediateswitch },
|
||||
{ "CHECK_MOVEMENT_SPEED", &Player::checkmovementspeed },
|
||||
{ "ABLE_TO_DEFUSE", &Player::checkabletodefuse },
|
||||
{ "ON_LANDMINE", &Player::checkonlandmine },
|
||||
{ "NEAR_LANDMINE", &Player::checknearlandmine },
|
||||
{ "CAN_PLACE_LANDMINE", &Player::CondCanPlaceLandmine },
|
||||
{ "WEAPON_CURRENT_FIRE_ANIM", &Player::CondWeaponCurrentFireAnim },
|
||||
{ "VEHICLE_TYPE", &Player::CondVehicleType },
|
||||
{ "ANIMDONE_VM", &Player::CondAnimDoneVM },
|
||||
{ "CLIENT_COMMAND", &Player::CondClientCommand },
|
||||
{ "IS_VM_ANIM", &Player::CondVMAnim },
|
||||
|
|
|
@ -443,6 +443,13 @@ public:
|
|||
qboolean checkminchargetimemet( Conditional &condition );
|
||||
qboolean checkmaxchargetimemet( Conditional &condition );
|
||||
qboolean checkimmediateswitch( Conditional &condition );
|
||||
qboolean checkmovementspeed( Conditional &condition );
|
||||
qboolean checkabletodefuse( Conditional &condition );
|
||||
qboolean checkonlandmine( Conditional &condition );
|
||||
qboolean checknearlandmine( Conditional &condition );
|
||||
qboolean CondCanPlaceLandmine( Conditional &condition );
|
||||
qboolean CondWeaponCurrentFireAnim( Conditional &condition );
|
||||
qboolean CondVehicleType( Conditional &condition );
|
||||
qboolean CondAnimDoneVM( Conditional &condition );
|
||||
qboolean CondClientCommand( Conditional &condition );
|
||||
qboolean CondVMAnim( Conditional &condition );
|
||||
|
|
|
@ -326,6 +326,7 @@ int MSG_ReadBits( msg_t *msg, int bits ) {
|
|||
}
|
||||
msg->readcount = (msg->bit>>3)+1;
|
||||
}
|
||||
#if TARGET_GAME_PROTOCOL >= 15
|
||||
if (sgn) {
|
||||
if (value & 1) {
|
||||
value = ~(value >> 1);
|
||||
|
@ -333,6 +334,13 @@ int MSG_ReadBits( msg_t *msg, int bits ) {
|
|||
value >>= 1;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (sgn) {
|
||||
if (value & (1 << (bits - 1))) {
|
||||
value |= -1 ^ ((1 << bits) - 1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return value;
|
||||
}
|
||||
|
@ -1611,16 +1619,19 @@ void MSG_WriteRegular(msg_t* sb, int bits, const void* toF)
|
|||
}
|
||||
else {
|
||||
MSG_WriteBits(sb, 1, 1);
|
||||
if (trunc == fullFloat && trunc + FLOAT_INT_BIAS >= 0 &&
|
||||
trunc + FLOAT_INT_BIAS < (1 << FLOAT_INT_BITS)) {
|
||||
if (trunc == fullFloat && trunc >= -4096 && trunc < 4096) {
|
||||
// send as small integer
|
||||
MSG_WriteBits(sb, 0, 1);
|
||||
MSG_WriteBits(sb, trunc + FLOAT_INT_BIAS, FLOAT_INT_BITS);
|
||||
MSG_WriteBits(sb, trunc, -FLOAT_INT_BITS);
|
||||
}
|
||||
else {
|
||||
// send as full floating point value
|
||||
int newvalue = *(int*)toF * 2 - 0x7A000000;
|
||||
if (*(int*)toF < 0) {
|
||||
newvalue |= 1;
|
||||
}
|
||||
MSG_WriteBits(sb, 1, 1);
|
||||
MSG_WriteBits(sb, *(int*)toF, 32);
|
||||
// send as full floating point value
|
||||
MSG_WriteBits(sb, newvalue, 32);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1819,7 +1830,7 @@ void MSG_WriteDeltaEntity( msg_t *msg, struct entityState_s *from, struct entity
|
|||
if ( from == NULL ) {
|
||||
return;
|
||||
}
|
||||
MSG_WriteEntityNum(msg, to->number);
|
||||
MSG_WriteEntityNum(msg, from->number);
|
||||
MSG_WriteBits( msg, 1, 1 );
|
||||
return;
|
||||
}
|
||||
|
@ -2126,6 +2137,7 @@ void MSG_WritePackedAnimTime(msg_t* msg, float fromValue, float toValue, float f
|
|||
if (fabs(fromValue - toValue) < frameTime) {
|
||||
// below the frame time, don't send
|
||||
MSG_WriteBits(msg, 0, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
MSG_WriteBits(msg, 1, 1);
|
||||
|
|
|
@ -86,6 +86,7 @@ void MSG_WriteBigString (msg_t *sb, const char *s);
|
|||
void MSG_WriteScrambledString(msg_t* sb, const char* s);
|
||||
void MSG_WriteScrambledBigString(msg_t* sb, const char* s);
|
||||
void MSG_WriteAngle16 (msg_t *sb, float f);
|
||||
void MSG_WriteEntityNum(msg_t* sb, short number);
|
||||
|
||||
void MSG_BeginReading (msg_t *sb);
|
||||
void MSG_BeginReadingOOB(msg_t *sb);
|
||||
|
|
|
@ -439,9 +439,15 @@ gotnewcl:
|
|||
Com_DPrintf( "Going from CS_FREE to CS_CONNECTED for %s\n", newcl->name );
|
||||
|
||||
newcl->state = CS_CONNECTED;
|
||||
newcl->nextSnapshotTime = svs.time;
|
||||
newcl->lastPacketTime = svs.time;
|
||||
newcl->lastConnectTime = svs.time;
|
||||
if (sv_maxclients->integer > 1) {
|
||||
newcl->nextSnapshotTime = svs.time + 800;
|
||||
newcl->lastPacketTime = svs.time + 800;
|
||||
newcl->lastConnectTime = svs.time + 800;
|
||||
} else {
|
||||
newcl->nextSnapshotTime = svs.time + 300;
|
||||
newcl->lastPacketTime = svs.time + 300;
|
||||
newcl->lastConnectTime = svs.time + 300;
|
||||
}
|
||||
|
||||
// when we receive the first packet from the client, we will
|
||||
// notice that it is from a different serverid and that the
|
||||
|
@ -530,6 +536,19 @@ void SV_DropClient( client_t *drop, const char *reason ) {
|
|||
}
|
||||
}
|
||||
|
||||
#if TARGET_GAME_PROTOCOL >= 15
|
||||
|
||||
void MSG_WriteServerFrameTime(msg_t* msg, float f) {
|
||||
MSG_WriteFloat(msg, f);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void MSG_WriteServerFrameTime(msg_t* msg, float f) {
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
================
|
||||
SV_SendClientGameState
|
||||
|
@ -583,7 +602,7 @@ void SV_SendClientGameState( client_t *client ) {
|
|||
if (sv.configstrings[start][0]) {
|
||||
MSG_WriteSVC( &msg, svc_configstring );
|
||||
MSG_WriteShort( &msg, start );
|
||||
MSG_WriteString( &msg, sv.configstrings[start] );
|
||||
MSG_WriteScrambledBigString( &msg, sv.configstrings[start] );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -604,7 +623,10 @@ void SV_SendClientGameState( client_t *client ) {
|
|||
MSG_WriteLong( &msg, client - svs.clients);
|
||||
|
||||
// write the checksum feed
|
||||
MSG_WriteLong( &msg, sv.checksumFeed);
|
||||
MSG_WriteLong( &msg, 0);
|
||||
|
||||
// write the server frametime to the client (only on TA/TT)
|
||||
MSG_WriteServerFrameTime(&msg, sv.frameTime);
|
||||
|
||||
// deliver this to the client
|
||||
SV_SendMessageToClient( &msg, client );
|
||||
|
@ -1310,7 +1332,7 @@ static qboolean SV_ClientCommand( client_t *cl, msg_t *msg ) {
|
|||
qboolean clientOk = qtrue;
|
||||
|
||||
seq = MSG_ReadLong( msg );
|
||||
s = MSG_ReadString( msg );
|
||||
s = MSG_ReadScrambledString( msg );
|
||||
|
||||
// see if we have already executed it
|
||||
if ( cl->lastClientCommand >= seq ) {
|
||||
|
|
|
@ -521,6 +521,7 @@ void SV_ClearServer(void) {
|
|||
}
|
||||
}
|
||||
Com_Memset (&sv, 0, sizeof(sv));
|
||||
sv.frameTime = 1.0 / sv_fps->value;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1012,7 +1013,7 @@ void SV_Init( void ) {
|
|||
sv_showloss = Cvar_Get ("sv_showloss", "0", 0);
|
||||
sv_padPackets = Cvar_Get ("sv_padPackets", "0", 0);
|
||||
sv_killserver = Cvar_Get ("sv_killserver", "0", 0);
|
||||
sv_mapChecksum = Cvar_Get ("sv_mapChecksum", "", CVAR_ROM);
|
||||
sv_mapChecksum = Cvar_Get ("sv_mapChecksum", "", CVAR_ROM | CVAR_SERVERINFO);
|
||||
sv_drawentities = Cvar_Get( "sv_drawentities", "1", 0 );
|
||||
sv_deeptracedebug = Cvar_Get( "sv_deeptracedebug", "0", 0 );
|
||||
sv_chatter = Cvar_Get( "sv_chatter", "0", 0 );
|
||||
|
|
|
@ -109,7 +109,7 @@ static void SV_EmitPacketEntities( clientSnapshot_t *from, clientSnapshot_t *to,
|
|||
}
|
||||
}
|
||||
|
||||
MSG_WriteBits( msg, (MAX_GENTITIES-1), GENTITYNUM_BITS ); // end of packetentities
|
||||
MSG_WriteEntityNum(msg, (MAX_GENTITIES - 1)); // end of packetentities
|
||||
}
|
||||
|
||||
|
||||
|
@ -217,11 +217,11 @@ static void SV_WriteSnapshotToClient( client_t *client, msg_t *msg ) {
|
|||
MSG_WriteSVC( msg, svc_locprint );
|
||||
MSG_WriteShort( msg, client->XOffset );
|
||||
MSG_WriteShort( msg, client->YOffset );
|
||||
MSG_WriteString( msg, client->centerprint );
|
||||
MSG_WriteScrambledString( msg, client->centerprint );
|
||||
}
|
||||
else {
|
||||
MSG_WriteSVC( msg, svc_centerprint );
|
||||
MSG_WriteString( msg, client->centerprint );
|
||||
MSG_WriteScrambledString( msg, client->centerprint );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ void SV_UpdateServerCommandsToClient( client_t *client, msg_t *msg ) {
|
|||
for ( i = client->reliableAcknowledge + 1 ; i <= client->reliableSequence ; i++ ) {
|
||||
MSG_WriteSVC( msg, svc_serverCommand );
|
||||
MSG_WriteLong( msg, i );
|
||||
MSG_WriteString( msg, client->reliableCommands[ i & (MAX_RELIABLE_COMMANDS-1) ] );
|
||||
MSG_WriteScrambledString( msg, client->reliableCommands[ i & (MAX_RELIABLE_COMMANDS-1) ] );
|
||||
}
|
||||
client->reliableSent = client->reliableSequence;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue