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: Warmup damage change notifications has been moved from console-only to popup messages
Next bug: Knife now has antilag

Bugfix 049 - Correct placement of the map name

Problem:

Some maps like Stalingrad and Ruins are placed so far to the right of the campaign map, that their names appeared on the left side of the pin. However the algorithm for calculating the name location on the left side of the pin is faulty.

Solution:

Change the values used when writing to the left of the pin. I also tweaked the size of the border when the text is written to the right of the pin. Anyway, it should be uniform now.

Notes:

The bug is still present in version 2.60

2.56 & 2.60 Code

cg_debriefing.c @ 2535 w = CG_Text_Width_Ext( cgs.campaignData.arenas[i].longname, 0.2f, 0, &cgs.media.limboFont2 );
// CHRUKER: b049 - Correct placement of the map name // Pin half width is 12 // Pin left margin is 3 // Pin right margin is 0 // Text margin is 2
if( x + 14 + w > button->rect.x + button->rect.w ) {
// x - pinhwidth (12) - pin left margin (3) - w - text margin (2) => x - w - 17
CG_FillRect( x - w - 17 + 1, y - 6 + 1, 17 + w, 12, colourFadedBlack ); CG_FillRect( x - w - 17, y - 6, 17 + w, 12, colorBlack ); } else {
// Width = pinhwidth (12) + pin right margin (0) + w + text margin (2) = 14 + w
CG_FillRect( x + 1, y - 6 + 1, 14 + w, 12, colourFadedBlack ); CG_FillRect( x, y - 6, 14 + w, 12, colorBlack ); } // b049 switch( CG_Debriefing_FindWinningTeamForPos( i + 1 ) ) { case TEAM_AXIS: CG_DrawPic( x - 12, y - 12, 24, 24, trap_R_RegisterShaderNoMip( "gfx/loading/pin_axis" ) ); break; case TEAM_ALLIES: CG_DrawPic( x - 12, y - 12, 24, 24, trap_R_RegisterShaderNoMip( "gfx/loading/pin_allied" ) ); break; default: CG_DrawPic( x - 12, y - 12, 24, 24, trap_R_RegisterShaderNoMip( "gfx/loading/pin_neutral" ) ); break; }
// CHRUKER: b049 - Correct placement of the map name
if( x + 14 + w > button->rect.x + button->rect.w ) {
// x - pinhwidth (12) - pin left margin (3) - w => x - w - 15
CG_Text_Paint_Ext( x - w - 15, y + 3, 0.2f, 0.2f, colorWhite, cgs.campaignData.arenas[i].longname, 0, 0, 0, &cgs.media.limboFont2 ); } else {
// x + pinhwidth (12) + pin right margin (0) => x + 12
CG_Text_Paint_Ext( x + 12, y + 3, 0.2f, 0.2f, colorWhite, cgs.campaignData.arenas[i].longname, 0, 0, 0, &cgs.media.limboFont2 ); } // b049 }
cg_debriefing.c @ 2618 (2.56) @ 2630 (2.60) w = CG_Text_Width_Ext( cgs.arenaData.longname, 0.2f, 0, &cgs.media.limboFont2 );
// CHRUKER: b049 - Correct placement of the map name // Pin half width is 12 // Pin left margin is 3 // Pin right margin is 0 // Text margin is 2
if( x + 14 + w > button->rect.x + button->rect.w ) {
// x - pinhwidth (12) - pin left margin (3) - w - text margin (2) => x - w - 17
CG_FillRect( x - w - 17 + 1, y - 6 + 1, 17 + w, 12, colourFadedBlack ); CG_FillRect( x - w - 17, y - 6, 17 + w, 12, colorBlack ); } else {
// Width = pinhwidth (12) + pin right margin (0) + w + text margin (2) = 14 + w
CG_FillRect( x + 1, y - 6 + 1, 14 + w, 12, colourFadedBlack ); CG_FillRect( x, y - 6, 14 + w, 12, colorBlack ); } // b049 switch( CG_Debriefing_FindWinningTeam() ) { case TEAM_AXIS: CG_DrawPic( x - 12, y - 12, 24, 24, trap_R_RegisterShaderNoMip( "gfx/loading/pin_axis" ) ); break; case TEAM_ALLIES: CG_DrawPic( x - 12, y - 12, 24, 24, trap_R_RegisterShaderNoMip( "gfx/loading/pin_allied" ) ); break; default: CG_DrawPic( x - 12, y - 12, 24, 24, trap_R_RegisterShaderNoMip( "gfx/loading/pin_neutral" ) ); break; }
// CHRUKER: b049 - Correct placement of the map name
if( x + 14 + w > button->rect.x + button->rect.w ) {
// x - pinhwidth (12) - pin left margin (3) - w => x - w - 15
CG_Text_Paint_Ext( x - w - 15, y + 3, 0.2f, 0.2f, colorWhite, cgs.arenaData.longname, 0, 0, 0, &cgs.media.limboFont2 ); } else {
// x + pinhwidth (12) + pin right margin (0) => x + 12
CG_Text_Paint_Ext( x + 12, y + 3, 0.2f, 0.2f, colorWhite, cgs.arenaData.longname, 0, 0, 0, &cgs.media.limboFont2 ); } // b049 } else { CG_DrawPic( button->rect.x, button->rect.y, button->rect.w, button->rect.h, trap_R_RegisterShaderNoMip( "menu/art/unknownmap" ) );
cg_loadpanel.c @ 530 (2.56) @ 532 (2.60) void CG_LoadPanel_DrawPin( const char* text, float px, float py, float sx, float sy, qhandle_t shader, float pinsize, float backheight ) { float x, y, w, h; vec4_t colourFadedBlack = { 0.f, 0.f, 0.f, 0.4f }; w = DC->textWidthExt( text, sx, 0, &bg_loadscreenfont2 );
// CHRUKER: b049 - Correct placement of the map name // Pin half width is 16 // Pin left margin is 4 // Pin right margin is 0 // Text margin is 4
if( px + 20 + w > 440 ) {
// x - pinhwidth (16) - pin left margin (4) - w - text margin (4) => x - w - 24
DC->fillRect( px - w - 24 + 2, py - (backheight/2.f) + 2, 24 + w, backheight, colourFadedBlack ); DC->fillRect( px - w - 24, py - (backheight/2.f), 24 + w, backheight, colorBlack ); } else {
// Width = pinhwidth (16) + pin right margin (0) + w + text margin (4) = 20 + w
DC->fillRect( px + 2, py - (backheight/2.f) + 2, 20 + w, backheight, colourFadedBlack ); DC->fillRect( px, py - (backheight/2.f), 20 + w, backheight, colorBlack ); }
x = px - pinsize; y = py - pinsize; w = pinsize * 2.f; h = pinsize * 2.f; DC->drawHandlePic( x, y, w, h, shader );
DC->drawHandlePic( px - pinsize, py - pinsize, pinsize * 2.f, pinsize * 2.f, shader );
if( px + 20 + w > 440 ) {
// x - pinhwidth (16) - pin left margin (4) - w => x - w - 20
DC->drawTextExt( px - w - 20, py + 4, sx, sy, colorWhite, text, 0, 0, 0, &bg_loadscreenfont2 ); } else {
// x + pinhwidth (16) + pin right margin (0) => x + 16
DC->drawTextExt( px + 16, py + 4, sx, sy, colorWhite, text, 0, 0, 0, &bg_loadscreenfont2 ); } // b049 }
ui_main.c @ 1596 (2.56) @ 1577 (2.60) w = Text_Width( uiInfo.campaignList[map].mapInfos[i]->mapName, scale, 0 );
// CHRUKER: b049 - Correct placement of the map name // Pin half width is 8 // Pin left margin is 2 // Pin right margin is 0 // Text margin is 2
if( x + 10 + w > rect->x + rect->w ) {
// x - pinhwidth (8) - pin left margin (2) - w - text margin (2) => x - w - 12
UI_FillRect( x - w - 12 + 1, y - 6 + 1, 12 + w, 12, colourFadedBlack ); UI_FillRect( x - w - 12, y - 6, 12 + w, 12, colorBlack ); } else {
// Width = pinhwidth (8) + pin right margin (0) + w + text margin (2) = 10 + w
UI_FillRect( x + 1, y - 6 + 1, 10 + w, 12, colourFadedBlack ); UI_FillRect( x, y - 6, 10 + w, 12, colorBlack ); } UI_DrawHandlePic( x - 8, y - 8, 16, 16, trap_R_RegisterShaderNoMip( "gfx/loading/pin_neutral" ) ); if( x + 10 + w > rect->x + rect->w ) {
// x - pinhwidth (8) - pin left margin (2) - w => x - w - 10
Text_Paint( x - w - 10, y + 3, scale, colorWhite, uiInfo.campaignList[map].mapInfos[i]->mapName, 0, 0, 0 ); } else {
// x + pinhwidth (8) + pin right margin (0) => x + 8
Text_Paint( x + 8, y + 3, scale, colorWhite, uiInfo.campaignList[map].mapInfos[i]->mapName, 0, 0, 0 ); } // b049 } } else {
ui_main.c @ 1669 (2.56) @ 1659 (2.60) w = Text_Width( uiInfo.mapList[map].mapName, scale, 0 );
// CHRUKER: b049 - Correct placement of the map name // Pin half width is 8 // Pin left margin is 2 // Pin right margin is 0 // Text margin is 2
if( x + 10 + w > rect->x + rect->w ) {
// x - pinhwidth (8) - pin left margin (2) - w - text margin (2) => x - w - 12
UI_FillRect( x - w - 12 + 1, y - 6 + 1, 12 + w, 12, colourFadedBlack ); UI_FillRect( x - w - 12, y - 6, 12 + w, 12, colorBlack ); } else {
// Width = pinhwidth (8) + pin right margin (0) + w + text margin (2) = 10 + w
UI_FillRect( x + 1, y - 6 + 1, 10 + w, 12, colourFadedBlack ); UI_FillRect( x, y - 6, 10 + w, 12, colorBlack ); } UI_DrawHandlePic( x - 8, y - 8, 16, 16, trap_R_RegisterShaderNoMip( "gfx/loading/pin_neutral" ) ); if( x + 10 + w > rect->x + rect->w ) {
// x - pinhwidth (8) - pin left margin (2) - w => x - w - 10
Text_Paint( x - w - 10, y + 3, scale, colorWhite, uiInfo.mapList[map].mapName, 0, 0, 0 ); } else {
// x + pinhwidth (8) + pin right margin (0) => x + 8
Text_Paint( x + 8, y + 3, scale, colorWhite, uiInfo.mapList[map].mapName, 0, 0, 0 ); } // b049 } else { UI_DrawHandlePic( rect->x, rect->y, rect->w, rect->h, trap_R_RegisterShaderNoMip( "levelshots/unknownmap" ) );

Show index
Previous bug: Warmup damage change notifications has been moved from console-only to popup messages
Next bug: Knife now has antilag

Color coding

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

©2017 Chruker