View Single Post
Old 10-14-2011, 11:17 AM   #225
-=*Raz0r*=-
Rookie
 
-=*Raz0r*=-'s Avatar
 
Join Date: Oct 2006
Location: Australia
Posts: 243
The name field in the profile customisation screen will not allow more than 26 characters, despite the actual limit being 36 characters.
Furthermore, overflowing this then changing your name results in some...odd behaviour.

The first part of this fix is in the ui/jamp/ingame_player.menu
Adjust this part
Code:
		itemDef 
		{
			name 				namefield
			type 				ITEM_TYPE_EDITFIELD
			style 				0
			text 				@MENUS_NAME1
			cvar 				"ui_Name"
			maxchars 			26
To match
Code:
		itemDef 
		{
			name 				namefield
			type 				ITEM_TYPE_EDITFIELD
			style 				0
			text 				@MENUS_NAME1
			cvar 				"ui_Name"
			maxchars 			35
36-1 characters to account for the null-terminator, if I am correct.


ui_main.c -> UI_Update

Replace
Code:
 	if (Q_stricmp(name, "ui_SetName") == 0) {
		trap_Cvar_Set( "name", UI_Cvar_VariableString("ui_Name"));
 	} else if (Q_stricmp(name, "ui_setRate") == 0) {
With
Code:
 	if ( !Q_stricmp( name, "ui_SetName" ) )
	{
		char buf[36] = { 0 };
		Q_strncpyz( buf, UI_Cvar_VariableString( "ui_Name" ), sizeof( buf ) );
		trap_Cvar_Set( "name", buf );
 	}
	else if (Q_stricmp(name, "ui_setRate") == 0) {
Replace
Code:
	else if (Q_stricmp(name, "ui_GetName") == 0) 
	{
		trap_Cvar_Set( "ui_Name", UI_Cvar_VariableString("name"));
	}
With
Code:
	else if ( !Q_stricmp( name, "ui_GetName" ) ) 
	{
		char buf[36] = { 0 };
		Q_strncpyz( buf, UI_Cvar_VariableString( "name" ), sizeof( buf ) );
		trap_Cvar_Set( "ui_Name", buf );
	}

ui_main.c -> _UI_Init

Replace
Code:
	trap_Cvar_Register(NULL, "ui_name", UI_Cvar_VariableString("name"), CVAR_INTERNAL );	//get this now, jic the menus change again trying to setName before getName
With
Code:
	{
		char buf[36] = { 0 };
		Q_strncpyz( buf, UI_Cvar_VariableString( "name" ), sizeof( buf ) );
		trap_Cvar_Register( NULL, "ui_Name", buf, CVAR_INTERNAL );
	}

-=*Raz0r*=- is offline   you may: quote & reply,