From 8ba37856ba1ce1f5aec2c290d8c554d755bcf7c7 Mon Sep 17 00:00:00 2001 From: CJ AYHO Date: Wed, 14 Aug 2013 15:54:19 +0300 Subject: [PATCH] added ch_god cvar with behavior like g_god in source engine --- neo/d3xp/Player.cpp | 2 +- neo/d3xp/gamesys/SysCvar.cpp | 3 +++ neo/game/Player.cpp | 2 +- neo/game/gamesys/SysCvar.cpp | 3 +++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/neo/d3xp/Player.cpp b/neo/d3xp/Player.cpp index dc779dfe..184a1084 100644 --- a/neo/d3xp/Player.cpp +++ b/neo/d3xp/Player.cpp @@ -7963,7 +7963,7 @@ void idPlayer::CalcDamagePoints( idEntity *inflictor, idEntity *attacker, const // check for completely getting out of the damage if ( !damageDef->GetBool( "noGod" ) ) { // check for godmode - if ( godmode ) { + if ( godmode || ( cvarSystem->GetCVarBool( "ch_god" ) ) ) { damage = 0; } #ifdef _D3XP diff --git a/neo/d3xp/gamesys/SysCvar.cpp b/neo/d3xp/gamesys/SysCvar.cpp index 5ed1b1a3..85563a47 100644 --- a/neo/d3xp/gamesys/SysCvar.cpp +++ b/neo/d3xp/gamesys/SysCvar.cpp @@ -69,6 +69,9 @@ struct gameVersion_s { char string[256]; } gameVersion; +// cjayho: add cheat cvars. cheaters are people too +idCVar ch_god( "ch_god", "0", CVAR_GAME | CVAR_ARCHIVE | CVAR_BOOL | CVAR_CHEAT, "set game to permanent god mode" ); + idCVar g_version( "g_version", gameVersion.string, CVAR_GAME | CVAR_ROM, "game version" ); // noset vars diff --git a/neo/game/Player.cpp b/neo/game/Player.cpp index e3878fa7..084e45c7 100644 --- a/neo/game/Player.cpp +++ b/neo/game/Player.cpp @@ -6633,7 +6633,7 @@ void idPlayer::CalcDamagePoints( idEntity *inflictor, idEntity *attacker, const // check for completely getting out of the damage if ( !damageDef->GetBool( "noGod" ) ) { // check for godmode - if ( godmode ) { + if ( godmode || ( cvarSystem->GetCVarBool( "ch_god" ) ) ) { damage = 0; } } diff --git a/neo/game/gamesys/SysCvar.cpp b/neo/game/gamesys/SysCvar.cpp index 9751ca8f..ad1503f5 100644 --- a/neo/game/gamesys/SysCvar.cpp +++ b/neo/game/gamesys/SysCvar.cpp @@ -59,6 +59,9 @@ struct gameVersion_s { char string[256]; } gameVersion; +// cjayho: add cheat cvars. cheaters are people too +idCVar ch_god( "ch_god", "0", CVAR_GAME | CVAR_ARCHIVE | CVAR_BOOL | CVAR_CHEAT, "set game to permanent god mode" ); + idCVar g_version( "g_version", gameVersion.string, CVAR_GAME | CVAR_ROM, "game version" ); // noset vars