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: Player booted to spec if they have level 4 light weapon or heavy weapon skills at map start
Next bug: When using Panzer and SMG, it switches to grenades and not the SMG after you fire the panzer

Bugfix 020 - Getting level 4 light weapons or heavy weapons during a map make people spawn as soldier with a SMG

Problem:

After getting level 4 light weapons or heavy weapons during a map people are switched to soldier with a SMG.

Solution:

Make sure that player class and primary weapons are set correctly before making the changes. This fix also only changes to the SMG or Akimbo, if the person is using the single gun.

References:

Spawning thread I
Spawning thread II
Spawning thread III

Notes:

The bug was semi-fixed in version 2.60. Players stay in their class, but are switched to their first weapon. The 2.60 Code below removes the faulty fix in the SDK.

2.60 Code

cg_players.c @ 136 const char *configstring; const char *v;
int oldclass;
ci = &cgs.clientinfo[clientNum];
cg_players.c @ 256 CG_AddPMItemBig( PM_RANK, va("Promoted to rank %s!", cgs.clientinfo[ cg.clientNum ].team == TEAM_AXIS ? rankNames_Axis[newInfo.rank] : rankNames_Allies[newInfo.rank] ), rankicons[ newInfo.rank ][ 0 ].shader ); }
// CHRUKER: b020 - Make sure player class and primary weapons are correct for // subsequent calls to CG_LimboPanel_SendSetupMsg CG_LimboPanel_Setup();
for( i = 0; i < SK_NUM_SKILLS; i++ ) { if( newInfo.skill[i] > cgs.clientinfo[ cg.clientNum ].skill[i] ) { // Gordon: slick hack so that funcs we call use teh new value now cgs.clientinfo[ cg.clientNum ].skill[ i ] = newInfo.skill[ i ]; if( newInfo.skill[i] == 4 && i == SK_HEAVY_WEAPONS ) { if( cgs.clientinfo[ cg.clientNum ].skill[SK_LIGHT_WEAPONS] >= 4 ) {
// CHRUKER: b020 - Only select SMG (2) if using the single gun (0) if( cgs.ccSelectedWeapon2 == 0 ) {
oldclass = cgs.ccSelectedClass; cgs.ccSelectedClass = newInfo.cls;
CG_LimboPanel_SetSelectedWeaponNumForSlot( 1, 2 ); // Selects SMG CG_LimboPanel_SendSetupMsg( qfalse );
cgs.ccSelectedClass = oldclass;
}
} else {
oldclass = cgs.ccSelectedClass; cgs.ccSelectedClass = newInfo.cls;
CG_LimboPanel_SetSelectedWeaponNumForSlot( 1, 1 ); // Selects SMG CG_LimboPanel_SendSetupMsg( qfalse );
cgs.ccSelectedClass = oldclass;
} } if( newInfo.skill[i] == 4 && i == SK_LIGHT_WEAPONS ) { if( cgs.clientinfo[ cg.clientNum ].skill[SK_HEAVY_WEAPONS] >= 4 ) {
// CHRUKER: b020 - Only select Akimbo guns (1) if using the single gun (0)
if( cgs.ccSelectedWeapon2 == 0 ) {
oldclass = cgs.ccSelectedClass; cgs.ccSelectedClass = newInfo.cls;
CG_LimboPanel_SetSelectedWeaponNumForSlot( 1, 1 ); // Selects Akimbo guns CG_LimboPanel_SendSetupMsg( qfalse );
cgs.ccSelectedClass = oldclass;
} } else {
oldclass = cgs.ccSelectedClass; cgs.ccSelectedClass = newInfo.cls;
CG_LimboPanel_SetSelectedWeaponNumForSlot( 1, 1 ); // Selects Akimbo guns CG_LimboPanel_SendSetupMsg( qfalse );
cgs.ccSelectedClass = oldclass;
} } CG_AddPMItemBig( PM_SKILL, va("Increased %s skill to level %i!", skillNames[i], newInfo.skill[i] ), cgs.media.skillPics[ i ] ); CG_PriorityCenterPrint( va( "You have been rewarded with %s", cg_skillRewards[ i ][ newInfo.skill[i]-1 ]), SCREEN_HEIGHT - (SCREEN_HEIGHT * 0.20), SMALLCHAR_WIDTH, 99999 ); } }

2.56 Code

cg_players.c @ 257 }
// CHRUKER: b020 - Make sure player class and primary weapons are correct for // subsequent calls to CG_LimboPanel_SendSetupMsg CG_LimboPanel_Setup();
for( i = 0; i < SK_NUM_SKILLS; i++ ) { if( newInfo.skill[i] > cgs.clientinfo[ cg.clientNum ].skill[i] ) { // Gordon: slick hack so that funcs we call use teh new value now cgs.clientinfo[ cg.clientNum ].skill[ i ] = newInfo.skill[ i ]; if( newInfo.skill[i] == 4 && i == SK_HEAVY_WEAPONS ) { if( cgs.clientinfo[ cg.clientNum ].skill[SK_LIGHT_WEAPONS] >= 4 ) {
// CHRUKER: b020 - Only select SMG (2) if using the single gun (0) if( cgs.ccSelectedWeapon2 == 0 ) {
CG_LimboPanel_SetSelectedWeaponNumForSlot( 1, 2 ); // Selects SMG CG_LimboPanel_SendSetupMsg( qfalse );
}
} else { CG_LimboPanel_SetSelectedWeaponNumForSlot( 1, 1 ); // Selects SMG CG_LimboPanel_SendSetupMsg( qfalse ); } } if( newInfo.skill[i] == 4 && i == SK_LIGHT_WEAPONS ) { if( cgs.clientinfo[ cg.clientNum ].skill[SK_HEAVY_WEAPONS] >= 4 ) {
// CHRUKER: b020 - Only select Akimbo guns (1) if using the single gun (0)
if( cgs.ccSelectedWeapon2 == 0 ) { CG_LimboPanel_SetSelectedWeaponNumForSlot( 1, 1 ); // Selects Akimbo guns CG_LimboPanel_SendSetupMsg( qfalse ); } } else { CG_LimboPanel_SetSelectedWeaponNumForSlot( 1, 1 ); // Selects Akimbo guns CG_LimboPanel_SendSetupMsg( qfalse ); } } CG_AddPMItemBig( PM_SKILL, va("Increased %s skill to level %i!", skillNames[i], newInfo.skill[i] ), cgs.media.skillPics[ i ] ); CG_PriorityCenterPrint( va( "You have been rewarded with %s", cg_skillRewards[ i ][ newInfo.skill[i]-1 ]), SCREEN_HEIGHT - (SCREEN_HEIGHT * 0.20), SMALLCHAR_WIDTH, 99999 ); } }

Show index
Previous bug: Player booted to spec if they have level 4 light weapon or heavy weapon skills at map start
Next bug: When using Panzer and SMG, it switches to grenades and not the SMG after you fire the panzer

Color coding

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

©2017 Chruker