From c708d91dbfd691b965e1d5fb06cf6f95e3673000 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Sun, 29 Mar 2020 21:40:00 +0200 Subject: Hide debug info (g_covidDebug) --- src/game/g_active.c | 18 +++++++++++------- src/game/g_client.c | 5 +++-- src/game/g_local.h | 1 + src/game/g_main.c | 2 ++ 4 files changed, 17 insertions(+), 9 deletions(-) (limited to 'src/game') diff --git a/src/game/g_active.c b/src/game/g_active.c index baba182..820b8f3 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -584,8 +584,9 @@ void G_ContractCoronavirus( gentity_t *ent ) else ent->client->covidKind = COVID_MODERATE; - trap_SendServerCommand( (int)( ent - g_entities ), - va("print \"^1COVID: ^7You contracted COVID of kind ^1%d^7.\n\"", ent->client->covidKind ) ); + if( g_covidDebug.integer ) + trap_SendServerCommand( (int)( ent - g_entities ), + va("print \"^1COVID^7: ^7You contracted COVID of kind ^1%d^7.\n\"", ent->client->covidKind ) ); } @@ -660,12 +661,14 @@ void G_Coronavirus( gentity_t *ent ) chance *= g_covidInfectionFactor.value; - trap_SendServerCommand( (int)( ent - g_entities ), va( "print \"^1COVID:^7 Chance to infect %s^7 is ^1%f^7\n\"", - target->client->pers.netname, chance ) ); + if( g_covidDebug.integer ) + trap_SendServerCommand( (int)( ent - g_entities ), va( "print \"^1COVID^7: Chance to infect %s^7 is ^1%f^7\n\"", + target->client->pers.netname, chance ) ); if( random( ) < chance ) { - trap_SendServerCommand( (int)( ent - g_entities ), va( "print \"^1COVID:^7 You spread the virus.\n\"" ) ); + if( g_covidDebug.integer ) + trap_SendServerCommand( (int)( ent - g_entities ), va( "print \"^1COVID^7: You spread the virus.\n\"" ) ); G_ContractCoronavirus( target ); } } @@ -711,8 +714,9 @@ void G_Coronavirus( gentity_t *ent ) G_Damage( ent, NULL, NULL, NULL, NULL, damage, DAMAGE_NO_PROTECTION, MOD_CORONAVIRUS ); } - trap_SendServerCommand( (int)( ent - g_entities ), va( "print \"^1COVID^7: Kind=^1%d^7, progress=^1%f^7, severity=^1%f^7.\n\"", - client->covidKind, client->covidProgress, client->covidSeverity) ); + if( g_covidDebug.integer ) + trap_SendServerCommand( (int)( ent - g_entities ), va( "print \"^1COVID^7: Kind=^1%d^7, progress=^1%f^7, severity=^1%f^7.\n\"", + client->covidKind, client->covidProgress, client->covidSeverity) ); } /* diff --git a/src/game/g_client.c b/src/game/g_client.c index 58ad321..7a81133 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -1927,8 +1927,9 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles && ent->client->covidKind < COVID_RECOVERED ) goto spawn_healthy; } - - trap_SendServerCommand( ent - g_entities, "print \"^1COVID^7: You're patient zero.\n\"" ); + + if( g_covidDebug.integer ) + trap_SendServerCommand( ent - g_entities, "print \"^1COVID^7: You're patient zero.\n\"" ); G_ContractCoronavirus( ent ); } spawn_healthy: diff --git a/src/game/g_local.h b/src/game/g_local.h index 47375d2..4836721 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -1523,6 +1523,7 @@ extern vmCvar_t g_practise; extern vmCvar_t g_covidInfectionFactor; extern vmCvar_t g_covidSeverityFactor; +extern vmCvar_t g_covidDebug; void trap_Printf( const char *fmt ); void trap_Error( const char *fmt ); diff --git a/src/game/g_main.c b/src/game/g_main.c index 410926a..32e8641 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -250,6 +250,7 @@ vmCvar_t g_tyrantNerf; vmCvar_t g_covidInfectionFactor; vmCvar_t g_covidSeverityFactor; +vmCvar_t g_covidDebug; static cvarTable_t gameCvarTable[ ] = { @@ -480,6 +481,7 @@ static cvarTable_t gameCvarTable[ ] = { &g_covidInfectionFactor, "g_covidInfectionFactor", "1", CVAR_ARCHIVE, 0, qtrue }, { &g_covidSeverityFactor, "g_covidSeverityFactor", "1", CVAR_ARCHIVE, 0, qtrue }, + { &g_covidDebug, "g_covidDebug", "0", CVAR_ARCHIVE, 0, qtrue }, }; static int gameCvarTableSize = sizeof( gameCvarTable ) / sizeof( gameCvarTable[ 0 ] ); -- cgit