[openjk] 111/130: SP: Added WIP difficulty command

Simon McVittie smcv at debian.org
Fri Oct 28 11:09:26 UTC 2016


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian/master
in repository openjk.

commit d31b847861217cc2d7fa00a73dca21917270c719
Author: Ensiform <ensiform at gmail.com>
Date:   Thu Oct 20 20:58:02 2016 -0500

    SP: Added WIP difficulty command
    
    Currently only displays current difficulty.
    Ability to set the difficulty from this command will come later.
---
 code/game/g_svcmds.cpp | 38 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 36 insertions(+), 2 deletions(-)

diff --git a/code/game/g_svcmds.cpp b/code/game/g_svcmds.cpp
index 475701d..1ef8388 100644
--- a/code/game/g_svcmds.cpp
+++ b/code/game/g_svcmds.cpp
@@ -843,12 +843,46 @@ static void Svcmd_Secrets_f(void)
 
 // PADAWAN - g_spskill 0 + cg_crosshairForceHint 1 + handicap 100
 // JEDI - g_spskill 1 + cg_crosshairForceHint 1 + handicap 100
-// JEDI KNIGHT - g_spskill 2 + cg_crosshairForceHint 0 + handicapp 100
+// JEDI KNIGHT - g_spskill 2 + cg_crosshairForceHint 0 + handicap 100
 // JEDI MASTER - g_spskill 2 + cg_crosshairForceHint 0 + handicap 50
 
+extern cvar_t *g_spskill;
 static void Svcmd_Difficulty_f(void)
 {
-	gi.Printf( S_COLOR_RED "This command is not yet implemented!" S_COLOR_WHITE "\n" );
+	if(gi.argc() == 1)
+	{
+		if(g_spskill->integer == 0)
+		{
+			gi.Printf( S_COLOR_GREEN "Current Difficulty: Padawan" S_COLOR_WHITE "\n" );
+		}
+		else if(g_spskill->integer == 1)
+		{
+			gi.Printf( S_COLOR_GREEN "Current Difficulty: Jedi" S_COLOR_WHITE "\n" );
+		}
+		else if(g_spskill->integer == 2)
+		{
+			int crosshairHint = gi.Cvar_VariableIntegerValue("cg_crosshairForceHint");
+			int handicap = gi.Cvar_VariableIntegerValue("handicap");
+			if(handicap == 100 && crosshairHint == 0)
+			{
+				gi.Printf( S_COLOR_GREEN "Current Difficulty: Jedi Knight" S_COLOR_WHITE "\n" );
+			}
+			else if(handicap == 50 && crosshairHint == 0)
+			{
+				gi.Printf( S_COLOR_GREEN "Current Difficulty: Jedi Master" S_COLOR_WHITE "\n" );
+			}
+			else
+			{
+				gi.Printf( S_COLOR_GREEN "Current Difficulty: Jedi Knight (Custom)" S_COLOR_WHITE "\n" );
+				gi.Printf( S_COLOR_GREEN "Crosshair Force Hint: %i" S_COLOR_WHITE "\n", crosshairHint != 0 ? 1 : 0 );
+				gi.Printf( S_COLOR_GREEN "Handicap: %i" S_COLOR_WHITE "\n", handicap );
+			}
+		}
+		else
+		{
+			gi.Printf( S_COLOR_RED "Invalid difficulty cvar set! g_spskill (%i) [0-2] is valid range only" S_COLOR_WHITE "\n", g_spskill->integer );
+		}
+	}
 }
 
 #define CMD_NONE				(0x00000000u)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/openjk.git



More information about the Pkg-games-commits mailing list