Enemy Territory

Project: Bug Fix

The objective

The goal of this project is to provide modders in the ET community with a SDK code base that contains fixes for various bugs which are present in the stock etmain game (version 2.60).

26th september 2006: Sadly bugfix 088 had a bug :-( There were 3 lines that should have been deleted for the fix to work correctly.

Show index
Previous bug: Helmet insignias glowed in the dark
Next bug: Players field of view at intermission is different if you had deployed a MG42

Bugfix 087 - Player always mouting the last gun used, on multiple tank maps

Problem:

When a player uses a mounted gun on a vehicle, and configstring is made with the connection between the player and the gun. However the connection was not removed, when the player unmounted the vehicle gun. When there were more than one vehicles with guns in the game would always choose the last of these configstrings, and so cause the player to always use the last gun they mounted.

Solution:

Remove the configstring when the player unmounts the gun. Strangely enough ET has no function to remove a configstring, so one will be made.

References:

Solution thread. Thank you [RW]Fred

2.60 Code

g_cmds.c @ 2666 tank->backupWeaponTime = ent->client->ps.weaponTime; ent->client->ps.weaponTime = ent->backupWeaponTime;
// CHRUKER: b087 - Player always mounting the last gun used, on multiple tank maps G_RemoveConfigstringIndex( va("%i %i %s", ent->s.number, ent->tagParent->s.number, ent->tagName), CS_TAGCONNECTS, MAX_TAGCONNECTS );
G_Script_ScriptEvent( tank, "mg42", "unmount" ); ent->tagParent = NULL; *ent->tagName = '\0';
g_local.h @ 1168 // Ridah int G_FindConfigstringIndex( const char *name, int start, int max, qboolean create ); // done.
// CHRUKER: b087 - Player always mounting the last gun used, on multiple tank maps void G_RemoveConfigstringIndex( const char *name, int start, int max); // b087
int G_ModelIndex( char *name ); int G_SoundIndex( const char *name ); int G_SkinIndex( const char *name );
g_utils.c @ 101 }
/* ================ G_RemoveConfigstringIndex CHRUKER: b087 - Player always mounting the last gun used, on multiple tank maps ================ */ void G_RemoveConfigstringIndex( const char *name, int start, int max) { int i, j; char s[MAX_STRING_CHARS]; if ( !name || !name[0] ) { return; } for (i = 1; i < max; i++) { trap_GetConfigstring( start + i, s, sizeof( s ) ); if ( !s[0] ) { break; } if (strcmp( s, name ) == 0) { trap_SetConfigstring( start + i, ""); for (j = i + 1; j < max - 1; j++) { trap_GetConfigstring( start + j, s, sizeof( s ) ); trap_SetConfigstring( start + j, "" ); trap_SetConfigstring( start + i, s ); } break; } } } // b087
int G_ModelIndex( char *name ) { return G_FindConfigstringIndex (name, CS_MODELS, MAX_MODELS, qtrue); }

Show index
Previous bug: Helmet insignias glowed in the dark
Next bug: Players field of view at intermission is different if you had deployed a MG42

Color coding

Sample = New code
Sample = Changed code (the new version is what is displayed)
Sample = Deleted code

©2017 Chruker