Jump to content

Setting a static global value of 1 to cg_crosshairForceHint


Recommended Posts

Posted

Hello everybody

I may have pretty generic problem regarding OpenJK, however it's causing me a problem 2nd night in a row. I would like to set cg_crosshairForceHint to permanent value of "1",so blue indicator over crosshair stay no matter which difficulty player has chosen, no matter which save it has ben loaded afterwards etc.

Right now I am lost in where to look for a place where this value have been modified or even initially declared. I had few build attempts already but did not succeed. Can you help?

If there is any curiosity why I might need that is that, well I took today lack of this force hint as a bug, but then I realized at Jedi Master level there are no forcehint active. If I come back to my build after a year or two I don't want to get surprised again 🙂

  • Librarian changed the title to Setting a static global value of 1 to cg_crosshairForceHint
  • 6 months later...
Posted
On 3/20/2022 at 1:03 AM, Librarian said:

Hello everybody

I may have pretty generic problem regarding OpenJK, however it's causing me a problem 2nd night in a row. I would like to set cg_crosshairForceHint to permanent value of "1",so blue indicator over crosshair stay no matter which difficulty player has chosen, no matter which save it has ben loaded afterwards etc.

Right now I am lost in where to look for a place where this value have been modified or even initially declared. I had few build attempts already but did not succeed. Can you help?

If there is any curiosity why I might need that is that, well I took today lack of this force hint as a bug, but then I realized at Jedi Master level there are no forcehint active. If I come back to my build after a year or two I don't want to get surprised again 🙂

 

you should search the cvar

"cg_crosshairForceHint" into the code and go undo with reverse engeneering for see the chunks of code involved on it.

use "go to definition" and "find all references" of visual studio for find all code places when the cvar is called and configurated.

i not know where is called the shader used for forceusable objects when you pass the crosshair on them, but crosshairs colors i guess should be into cg_draw.cpp or cg_player.cpp or some place like that.

sure they are set into the cgame folder.

 

  • 2 weeks later...
Posted

Hey @Asgarath83thanks for your interest, sure I will recheck in a way that you mentioned, visual studio does much better than notepad++. So far I ended up again in cg_draw.cpp. It uses few real numbers but I think its to define color scale. I still cannot find and reference to fe. difficulty level which is a key player in setting this value to 1 or 0. My assumption altough not sure if it makes any sense is that difficulty might be hidden somewhere in map files But that's maybe my lack of experience, I am not a coder so I might not get the logic of it. Anyway I will try whatever I find a moment to dig deeper. I am open for any other suggestions you may have.

Asgarath83 likes this
Posted
2 hours ago, Librarian said:

Hey @Asgarath83thanks for your interest, sure I will recheck in a way that you mentioned, visual studio does much better than notepad++. So far I ended up again in cg_draw.cpp. It uses few real numbers but I think its to define color scale. I still cannot find and reference to fe. difficulty level which is a key player in setting this value to 1 or 0. My assumption altough not sure if it makes any sense is that difficulty might be hidden somewhere in map files But that's maybe my lack of experience, I am not a coder so I might not get the logic of it. Anyway I will try whatever I find a moment to dig deeper. I am open for any other suggestions you may have.

why not check all code calls of g_spskill cvar ? there is something that deactivate into the code the use of crosshair force hint if difficult level is > of some value.

Posted

Well, I checked that while ago. Couldn't really tell whats going on with it as there was no clear statement when integer value provided during a choice of difficulty modifies force hint value. I really cant find the actual source of where this fuction is declared to contribute its value to hint setting altough I am 100% sure it works that way as on knight and master levels this force hint is just gone.

Any relation to force hint is in:

 

extern cvar_t *g_spskill;
static void Svcmd_Difficulty_f(void)
{
	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 );
		}
	}
}

but then again its just to display text after setting up difficulty value trough console.

It's kind of weird since I was able to pin point other functions where g_spskill was used to manipulate player balance, LP, shield recharge, heal amount etc, however this one elude me 😞

I also tried a method to set forcehint value as constant in cg_main.ccp but I guess it's still being overwritten during difficulty choice at new game menu.


I changed it from this

{ &cg_crosshairForceHint, "cg_crosshairForceHint", "1", CVAR_ARCHIVE|CVAR_SAVEGAME|CVAR_NORESTART },

to this
 

	{ &cg_crosshairForceHint, "cg_crosshairForceHint", "1", 0 },

which I assume was correct when I looked into config of other cvars where first "value" is I guess default and then modifier where 0 says do not pull data from anywhere.

Altough I am unsure if I think correctly.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...