From dee78e31f8b60a79bffdc25be1c5aceb191a1a28 Mon Sep 17 00:00:00 2001 From: Gene Date: Mon, 24 Jun 2024 23:16:01 -0700 Subject: [PATCH] more widescreen hud icons - also get rid of `hudRatio` parameters --- code/cgame/cg_draw.cpp | 96 ++++++++++++++--------------- codemp/cgame/cg_draw.c | 135 ++++++++++++++++++++--------------------- 2 files changed, 114 insertions(+), 117 deletions(-) diff --git a/code/cgame/cg_draw.cpp b/code/cgame/cg_draw.cpp index 6f73a9bb11..64635518b9 100644 --- a/code/cgame/cg_draw.cpp +++ b/code/cgame/cg_draw.cpp @@ -128,7 +128,7 @@ Draw the force power graphics (tics) and the force power numeric amount. Any tic be alphaed out. ================ */ -static void CG_DrawForcePower(const centity_t *cent,const int xPos,const int yPos,const float hudRatio) +static void CG_DrawForcePower(const centity_t *cent,const int xPos,const int yPos) { int i; qboolean flash=qfalse; @@ -220,9 +220,9 @@ static void CG_DrawForcePower(const centity_t *cent,const int xPos,const int yPo } cgi_R_SetColor( calcColor); - CG_DrawPic( SCREEN_WIDTH - (SCREEN_WIDTH - forceTics[i].xPos) * hudRatio, + CG_DrawPic( SCREEN_WIDTH - (SCREEN_WIDTH - forceTics[i].xPos) * cgs.widthRatioCoef, forceTics[i].yPos, - forceTics[i].width * hudRatio, + forceTics[i].width * cgs.widthRatioCoef, forceTics[i].height, forceTics[i].background ); @@ -240,11 +240,11 @@ static void CG_DrawForcePower(const centity_t *cent,const int xPos,const int yPo // Print force numeric amount CG_DrawNumField ( - SCREEN_WIDTH - (SCREEN_WIDTH - otherHUDBits[OHB_FORCEAMOUNT].xPos) * hudRatio, + SCREEN_WIDTH - (SCREEN_WIDTH - otherHUDBits[OHB_FORCEAMOUNT].xPos) * cgs.widthRatioCoef, otherHUDBits[OHB_FORCEAMOUNT].yPos, 3, cent->gent->client->ps.forcePower, - otherHUDBits[OHB_FORCEAMOUNT].width * hudRatio, + otherHUDBits[OHB_FORCEAMOUNT].width * cgs.widthRatioCoef, otherHUDBits[OHB_FORCEAMOUNT].height, NUM_FONT_SMALL, qfalse); @@ -258,7 +258,7 @@ If the weapon is a light saber (which needs no ammo) then draw a graphic showing the saber style (fast, medium, strong) ================ */ -static void CG_DrawSaberStyle(const centity_t *cent,const int xPos,const int yPos,const float hudRatio) +static void CG_DrawSaberStyle(const centity_t *cent,const int xPos,const int yPos) { int index; @@ -299,9 +299,9 @@ static void CG_DrawSaberStyle(const centity_t *cent,const int xPos,const int yPo cgi_R_SetColor( otherHUDBits[index].color); CG_DrawPic( - SCREEN_WIDTH - (SCREEN_WIDTH - otherHUDBits[index].xPos) * hudRatio, + SCREEN_WIDTH - (SCREEN_WIDTH - otherHUDBits[index].xPos) * cgs.widthRatioCoef, otherHUDBits[index].yPos, - otherHUDBits[index].width * hudRatio, + otherHUDBits[index].width * cgs.widthRatioCoef, otherHUDBits[index].height, otherHUDBits[index].background ); @@ -316,7 +316,7 @@ Draw the ammo graphics (tics) and the ammo numeric amount. Any tics that are par be alphaed out. ================ */ -static void CG_DrawAmmo(const centity_t *cent,const int xPos,const int yPos,const float hudRatio) +static void CG_DrawAmmo(const centity_t *cent,const int xPos,const int yPos) { playerState_t *ps; int i; @@ -385,11 +385,11 @@ static void CG_DrawAmmo(const centity_t *cent,const int xPos,const int yPos,cons cgi_R_SetColor( calcColor ); CG_DrawNumField ( - SCREEN_WIDTH - (SCREEN_WIDTH - otherHUDBits[OHB_AMMOAMOUNT].xPos) * hudRatio, + SCREEN_WIDTH - (SCREEN_WIDTH - otherHUDBits[OHB_AMMOAMOUNT].xPos) * cgs.widthRatioCoef, otherHUDBits[OHB_AMMOAMOUNT].yPos, 3, ps->ammo[weaponData[cent->currentState.weapon].ammoIndex], - otherHUDBits[OHB_AMMOAMOUNT].width * hudRatio, + otherHUDBits[OHB_AMMOAMOUNT].width * cgs.widthRatioCoef, otherHUDBits[OHB_AMMOAMOUNT].height, NUM_FONT_SMALL, qfalse); @@ -415,9 +415,9 @@ static void CG_DrawAmmo(const centity_t *cent,const int xPos,const int yPos,cons } cgi_R_SetColor( calcColor); - CG_DrawPic( SCREEN_WIDTH - (SCREEN_WIDTH - ammoTics[i].xPos) * hudRatio, + CG_DrawPic( SCREEN_WIDTH - (SCREEN_WIDTH - ammoTics[i].xPos) * cgs.widthRatioCoef, ammoTics[i].yPos, - ammoTics[i].width * hudRatio, + ammoTics[i].width * cgs.widthRatioCoef, ammoTics[i].height, ammoTics[i].background ); @@ -432,7 +432,7 @@ static void CG_DrawAmmo(const centity_t *cent,const int xPos,const int yPos,cons CG_DrawHealth ================ */ -static void CG_DrawHealth(const int x,const int y,const int w,const int h,const float hudRatio) +static void CG_DrawHealth(const int x,const int y,const int w,const int h) { vec4_t calcColor; playerState_t *ps = &cg.snap->ps; @@ -461,9 +461,9 @@ static void CG_DrawHealth(const int x,const int y,const int w,const int h,const cgi_R_SetColor( calcColor); CG_DrawPic( - healthTics[i].xPos * hudRatio, + healthTics[i].xPos * cgs.widthRatioCoef, healthTics[i].yPos, - healthTics[i].width * hudRatio, + healthTics[i].width * cgs.widthRatioCoef, healthTics[i].height, healthTics[i].background ); @@ -476,11 +476,11 @@ static void CG_DrawHealth(const int x,const int y,const int w,const int h,const cgi_R_SetColor( otherHUDBits[OHB_HEALTHAMOUNT].color ); CG_DrawNumField ( - otherHUDBits[OHB_HEALTHAMOUNT].xPos * hudRatio, + otherHUDBits[OHB_HEALTHAMOUNT].xPos * cgs.widthRatioCoef, otherHUDBits[OHB_HEALTHAMOUNT].yPos, 3, ps->stats[STAT_HEALTH], - otherHUDBits[OHB_HEALTHAMOUNT].width * hudRatio, + otherHUDBits[OHB_HEALTHAMOUNT].width * cgs.widthRatioCoef, otherHUDBits[OHB_HEALTHAMOUNT].height, NUM_FONT_SMALL, qfalse); @@ -495,7 +495,7 @@ Draw the armor graphics (tics) and the armor numeric amount. Any tics that are p be alphaed out. ================ */ -static void CG_DrawArmor(const int x,const int y,const int w,const int h,const float hudRatio) +static void CG_DrawArmor(const int x,const int y,const int w,const int h) { vec4_t calcColor; playerState_t *ps = &cg.snap->ps; @@ -530,9 +530,9 @@ static void CG_DrawArmor(const int x,const int y,const int w,const int h,const f if (cg.HUDArmorFlag) { CG_DrawPic( - armorTics[i].xPos * hudRatio, + armorTics[i].xPos * cgs.widthRatioCoef, armorTics[i].yPos, - armorTics[i].width * hudRatio, + armorTics[i].width * cgs.widthRatioCoef, armorTics[i].height, armorTics[i].background ); @@ -541,9 +541,9 @@ static void CG_DrawArmor(const int x,const int y,const int w,const int h,const f else { CG_DrawPic( - armorTics[i].xPos * hudRatio, + armorTics[i].xPos * cgs.widthRatioCoef, armorTics[i].yPos, - armorTics[i].width * hudRatio, + armorTics[i].width * cgs.widthRatioCoef, armorTics[i].height, armorTics[i].background ); @@ -556,11 +556,11 @@ static void CG_DrawArmor(const int x,const int y,const int w,const int h,const f cgi_R_SetColor( otherHUDBits[OHB_ARMORAMOUNT].color ); CG_DrawNumField ( - otherHUDBits[OHB_ARMORAMOUNT].xPos * hudRatio, + otherHUDBits[OHB_ARMORAMOUNT].xPos * cgs.widthRatioCoef, otherHUDBits[OHB_ARMORAMOUNT].yPos, 3, ps->stats[STAT_ARMOR], - otherHUDBits[OHB_ARMORAMOUNT].width * hudRatio, + otherHUDBits[OHB_ARMORAMOUNT].width * cgs.widthRatioCoef, otherHUDBits[OHB_ARMORAMOUNT].height, NUM_FONT_SMALL, qfalse); @@ -1421,7 +1421,6 @@ static void CG_DrawATSTHud( centity_t *cent ) vec4_t color; qhandle_t background; float health; - float hudRatio = cg_hudRatio.integer ? cgs.widthRatioCoef : 1.0f; if ( !cg.snap ||!g_entities[cg.snap->ps.viewEntity].activator ) @@ -1482,7 +1481,7 @@ static void CG_DrawATSTHud( centity_t *cent ) { cgi_R_SetColor( color ); - CG_DrawPic( xPos * hudRatio, yPos, width * hudRatio, height, background ); + CG_DrawPic( xPos * cgs.widthRatioCoef, yPos, width * cgs.widthRatioCoef, height, background ); } if (cgi_UI_GetMenuItemInfo( @@ -1496,7 +1495,7 @@ static void CG_DrawATSTHud( centity_t *cent ) &background)) { cgi_R_SetColor( color ); - CG_DrawPic( xPos * hudRatio, yPos, width * hudRatio, height, background ); + CG_DrawPic( xPos * cgs.widthRatioCoef, yPos, width * cgs.widthRatioCoef, height, background ); } if (cgi_UI_GetMenuItemInfo( @@ -1511,7 +1510,7 @@ static void CG_DrawATSTHud( centity_t *cent ) { cgi_R_SetColor( color ); - CG_DrawPic( xPos * hudRatio, yPos, width * hudRatio, height, background ); + CG_DrawPic( xPos * cgs.widthRatioCoef, yPos, width * cgs.widthRatioCoef, height, background ); } } @@ -1827,7 +1826,6 @@ static void CG_DrawHUD( centity_t *cent ) { int value; int sectionXPos,sectionYPos,sectionWidth,sectionHeight; - float hudRatio = cg_hudRatio.integer ? cgs.widthRatioCoef : 1.0f; if ( cg_hudFiles.integer ) { @@ -1865,9 +1863,9 @@ static void CG_DrawHUD( centity_t *cent ) cgi_R_SetColor( otherHUDBits[OHB_SCANLINE_LEFT].color); CG_DrawPic( - otherHUDBits[OHB_SCANLINE_LEFT].xPos * hudRatio, + otherHUDBits[OHB_SCANLINE_LEFT].xPos * cgs.widthRatioCoef, otherHUDBits[OHB_SCANLINE_LEFT].yPos, - otherHUDBits[OHB_SCANLINE_LEFT].width * hudRatio, + otherHUDBits[OHB_SCANLINE_LEFT].width * cgs.widthRatioCoef, otherHUDBits[OHB_SCANLINE_LEFT].height, otherHUDBits[OHB_SCANLINE_LEFT].background ); @@ -1875,16 +1873,16 @@ static void CG_DrawHUD( centity_t *cent ) // Print frame cgi_R_SetColor( otherHUDBits[OHB_FRAME_LEFT].color); CG_DrawPic( - otherHUDBits[OHB_FRAME_LEFT].xPos * hudRatio, + otherHUDBits[OHB_FRAME_LEFT].xPos * cgs.widthRatioCoef, otherHUDBits[OHB_FRAME_LEFT].yPos, - otherHUDBits[OHB_FRAME_LEFT].width * hudRatio, + otherHUDBits[OHB_FRAME_LEFT].width * cgs.widthRatioCoef, otherHUDBits[OHB_FRAME_LEFT].height, otherHUDBits[OHB_FRAME_LEFT].background ); - CG_DrawArmor(sectionXPos,sectionYPos,sectionWidth,sectionHeight,hudRatio); + CG_DrawArmor(sectionXPos,sectionYPos,sectionWidth,sectionHeight); - CG_DrawHealth(sectionXPos,sectionYPos,sectionWidth,sectionHeight,hudRatio); + CG_DrawHealth(sectionXPos,sectionYPos,sectionWidth,sectionHeight); } @@ -1909,9 +1907,9 @@ static void CG_DrawHUD( centity_t *cent ) cgi_R_SetColor( otherHUDBits[OHB_SCANLINE_RIGHT].color); CG_DrawPic( - SCREEN_WIDTH - (SCREEN_WIDTH - otherHUDBits[OHB_SCANLINE_RIGHT].xPos) * hudRatio, + SCREEN_WIDTH - (SCREEN_WIDTH - otherHUDBits[OHB_SCANLINE_RIGHT].xPos) * cgs.widthRatioCoef, otherHUDBits[OHB_SCANLINE_RIGHT].yPos, - otherHUDBits[OHB_SCANLINE_RIGHT].width * hudRatio, + otherHUDBits[OHB_SCANLINE_RIGHT].width * cgs.widthRatioCoef, otherHUDBits[OHB_SCANLINE_RIGHT].height, otherHUDBits[OHB_SCANLINE_RIGHT].background ); @@ -1920,23 +1918,23 @@ static void CG_DrawHUD( centity_t *cent ) // Print frame cgi_R_SetColor( otherHUDBits[OHB_FRAME_RIGHT].color); CG_DrawPic( - SCREEN_WIDTH - (SCREEN_WIDTH - otherHUDBits[OHB_FRAME_RIGHT].xPos) * hudRatio, + SCREEN_WIDTH - (SCREEN_WIDTH - otherHUDBits[OHB_FRAME_RIGHT].xPos) * cgs.widthRatioCoef, otherHUDBits[OHB_FRAME_RIGHT].yPos, - otherHUDBits[OHB_FRAME_RIGHT].width * hudRatio, + otherHUDBits[OHB_FRAME_RIGHT].width * cgs.widthRatioCoef, otherHUDBits[OHB_FRAME_RIGHT].height, otherHUDBits[OHB_FRAME_RIGHT].background ); - CG_DrawForcePower(cent,sectionXPos,sectionYPos,hudRatio); + CG_DrawForcePower(cent,sectionXPos,sectionYPos); // Draw ammo tics or saber style if ( cent->currentState.weapon == WP_SABER ) { - CG_DrawSaberStyle(cent,sectionXPos,sectionYPos,hudRatio); + CG_DrawSaberStyle(cent,sectionXPos,sectionYPos); } else { - CG_DrawAmmo(cent,sectionXPos,sectionYPos,hudRatio); + CG_DrawAmmo(cent,sectionXPos,sectionYPos); } // CG_DrawMessageLit(cent,x,y); } @@ -1972,7 +1970,7 @@ void CG_DrawDataPadHUD( centity_t *cent ) x = 34; y = 286; - CG_DrawHealth(x,y,80,80,1.0f); + CG_DrawHealth(x,y,80,80); x = 526; @@ -2000,8 +1998,8 @@ void CG_DrawDataPadHUD( centity_t *cent ) // CG_ClearDataPadCvars(); } - CG_DrawForcePower(cent,x,y,1.0f); - CG_DrawAmmo(cent,x,y,1.0f); + CG_DrawForcePower(cent,x,y); + CG_DrawAmmo(cent,x,y); CG_DrawMessageLit(cent,x,y); cgi_R_SetColor( colorTable[CT_WHITE]); @@ -2400,7 +2398,7 @@ static void CG_DrawPickupItem( void ) { { CG_RegisterItemVisuals( value ); cgi_R_SetColor( fadeColor ); - CG_DrawPic( 573, 320, ICON_SIZE, ICON_SIZE, cg_items[ value ].icon ); + CG_DrawPic( 573, 320, ICON_SIZE * cgs.widthRatioCoef, ICON_SIZE, cg_items[ value ].icon ); //CG_DrawBigString( ICON_SIZE + 16, 398, bg_itemlist[ value ].classname, fadeColor[0] ); //CG_DrawProportionalString( ICON_SIZE + 16, 398, // bg_itemlist[ value ].classname, CG_SMALLFONT,fadeColor ); @@ -3212,7 +3210,7 @@ static void CG_DrawActivePowers(void) int startx = icon_size*2+16; int starty = SCREEN_HEIGHT - icon_size*2; - int endx = icon_size; + int endx = icon_size * cgs.widthRatioCoef; int endy = icon_size; if (cg.zoomMode) @@ -3560,7 +3558,7 @@ static void CG_UseIcon() if (cg_usingInFrontOf) { cgi_R_SetColor( NULL ); - CG_DrawPic( 50, 285, 64, 64, cgs.media.useableHint ); + CG_DrawPic( 50, 285, 64 * cgs.widthRatioCoef, 64, cgs.media.useableHint ); } } diff --git a/codemp/cgame/cg_draw.c b/codemp/cgame/cg_draw.c index 6814d81e38..00e177207c 100644 --- a/codemp/cgame/cg_draw.c +++ b/codemp/cgame/cg_draw.c @@ -488,12 +488,12 @@ void CG_DrawHead( float x, float y, float w, float h, int clientNum, vec3_t head ci = &cgs.clientinfo[ clientNum ]; - CG_DrawPic( x, y, w, h, ci->modelIcon ); + CG_DrawPic( x, y, w * cgs.widthRatioCoef, h, ci->modelIcon ); // if they are deferred, draw a cross out if ( ci->deferred ) { - CG_DrawPic( x, y, w, h, cgs.media.deferShader ); + CG_DrawPic( x, y, w * cgs.widthRatioCoef, h, cgs.media.deferShader ); } } @@ -557,7 +557,7 @@ void CG_DrawFlagModel( float x, float y, float w, float h, int team, qboolean fo return; } if (item) { - CG_DrawPic( x, y, w, h, cg_items[ ITEM_INDEX(item) ].icon ); + CG_DrawPic( x, y, w * cgs.widthRatioCoef, h, cg_items[ ITEM_INDEX(item) ].icon ); } } } @@ -567,7 +567,7 @@ void CG_DrawFlagModel( float x, float y, float w, float h, int team, qboolean fo CG_DrawHealth ================ */ -void CG_DrawHealth( menuDef_t *menuHUD, float hudRatio ) +void CG_DrawHealth( menuDef_t *menuHUD ) { vec4_t calcColor; playerState_t *ps; @@ -620,9 +620,9 @@ void CG_DrawHealth( menuDef_t *menuHUD, float hudRatio ) trap->R_SetColor( calcColor); CG_DrawPic( - focusItem->window.rect.x * hudRatio, + focusItem->window.rect.x * cgs.widthRatioCoef, focusItem->window.rect.y, - focusItem->window.rect.w * hudRatio, + focusItem->window.rect.w * cgs.widthRatioCoef, focusItem->window.rect.h, focusItem->window.background ); @@ -638,11 +638,11 @@ void CG_DrawHealth( menuDef_t *menuHUD, float hudRatio ) trap->R_SetColor( focusItem->window.foreColor ); CG_DrawNumField ( - focusItem->window.rect.x * hudRatio, + focusItem->window.rect.x * cgs.widthRatioCoef, focusItem->window.rect.y, 3, ps->stats[STAT_HEALTH], - focusItem->window.rect.w * hudRatio, + focusItem->window.rect.w * cgs.widthRatioCoef, focusItem->window.rect.h, NUM_FONT_SMALL, qfalse); @@ -655,7 +655,7 @@ void CG_DrawHealth( menuDef_t *menuHUD, float hudRatio ) CG_DrawArmor ================ */ -void CG_DrawArmor( menuDef_t *menuHUD, float hudRatio ) +void CG_DrawArmor( menuDef_t *menuHUD ) { vec4_t calcColor; playerState_t *ps; @@ -707,9 +707,9 @@ void CG_DrawArmor( menuDef_t *menuHUD, float hudRatio ) if (cg.HUDArmorFlag) { CG_DrawPic( - focusItem->window.rect.x * hudRatio, + focusItem->window.rect.x * cgs.widthRatioCoef, focusItem->window.rect.y, - focusItem->window.rect.w * hudRatio, + focusItem->window.rect.w * cgs.widthRatioCoef, focusItem->window.rect.h, focusItem->window.background ); @@ -718,9 +718,9 @@ void CG_DrawArmor( menuDef_t *menuHUD, float hudRatio ) else { CG_DrawPic( - focusItem->window.rect.x * hudRatio, + focusItem->window.rect.x * cgs.widthRatioCoef, focusItem->window.rect.y, - focusItem->window.rect.w * hudRatio, + focusItem->window.rect.w * cgs.widthRatioCoef, focusItem->window.rect.h, focusItem->window.background ); @@ -737,11 +737,11 @@ void CG_DrawArmor( menuDef_t *menuHUD, float hudRatio ) trap->R_SetColor( focusItem->window.foreColor ); CG_DrawNumField ( - focusItem->window.rect.x * hudRatio, + focusItem->window.rect.x * cgs.widthRatioCoef, focusItem->window.rect.y, 3, ps->stats[STAT_ARMOR], - focusItem->window.rect.w * hudRatio, + focusItem->window.rect.w * cgs.widthRatioCoef, focusItem->window.rect.h, NUM_FONT_SMALL, qfalse); @@ -788,7 +788,7 @@ If the weapon is a light saber (which needs no ammo) then draw a graphic showing the saber style (fast, medium, strong) ================ */ -static void CG_DrawSaberStyle( centity_t *cent, menuDef_t *menuHUD, float hudRatio ) +static void CG_DrawSaberStyle( centity_t *cent, menuDef_t *menuHUD ) { itemDef_t *focusItem; @@ -822,9 +822,9 @@ static void CG_DrawSaberStyle( centity_t *cent, menuDef_t *menuHUD, float hudRat trap->R_SetColor( colorTable[CT_WHITE] ); CG_DrawPic( - SCREEN_WIDTH - (SCREEN_WIDTH - focusItem->window.rect.x) * hudRatio, + SCREEN_WIDTH - (SCREEN_WIDTH - focusItem->window.rect.x) * cgs.widthRatioCoef, focusItem->window.rect.y, - focusItem->window.rect.w * hudRatio, + focusItem->window.rect.w * cgs.widthRatioCoef, focusItem->window.rect.h, focusItem->window.background ); @@ -841,9 +841,9 @@ static void CG_DrawSaberStyle( centity_t *cent, menuDef_t *menuHUD, float hudRat trap->R_SetColor( colorTable[CT_WHITE] ); CG_DrawPic( - SCREEN_WIDTH - (SCREEN_WIDTH - focusItem->window.rect.x) * hudRatio, + SCREEN_WIDTH - (SCREEN_WIDTH - focusItem->window.rect.x) * cgs.widthRatioCoef, focusItem->window.rect.y, - focusItem->window.rect.w * hudRatio, + focusItem->window.rect.w * cgs.widthRatioCoef, focusItem->window.rect.h, focusItem->window.background ); @@ -858,9 +858,9 @@ static void CG_DrawSaberStyle( centity_t *cent, menuDef_t *menuHUD, float hudRat trap->R_SetColor( colorTable[CT_WHITE] ); CG_DrawPic( - SCREEN_WIDTH - (SCREEN_WIDTH - focusItem->window.rect.x) * hudRatio, + SCREEN_WIDTH - (SCREEN_WIDTH - focusItem->window.rect.x) * cgs.widthRatioCoef, focusItem->window.rect.y, - focusItem->window.rect.w * hudRatio, + focusItem->window.rect.w * cgs.widthRatioCoef, focusItem->window.rect.h, focusItem->window.background ); @@ -875,7 +875,7 @@ static void CG_DrawSaberStyle( centity_t *cent, menuDef_t *menuHUD, float hudRat CG_DrawAmmo ================ */ -static void CG_DrawAmmo( centity_t *cent,menuDef_t *menuHUD, float hudRatio ) +static void CG_DrawAmmo( centity_t *cent,menuDef_t *menuHUD ) { playerState_t *ps; int i; @@ -924,7 +924,7 @@ static void CG_DrawAmmo( centity_t *cent,menuDef_t *menuHUD, float hudRatio ) trap->R_SetColor( colorTable[CT_YELLOW] ); if (focusItem) { - CG_DrawProportionalString(SCREEN_WIDTH - (SCREEN_WIDTH - focusItem->window.rect.x) * hudRatio, focusItem->window.rect.y, "--", NUM_FONT_SMALL, focusItem->window.foreColor); + CG_DrawProportionalString(SCREEN_WIDTH - (SCREEN_WIDTH - focusItem->window.rect.x) * cgs.widthRatioCoef, focusItem->window.rect.y, "--", NUM_FONT_SMALL, focusItem->window.foreColor); } } else @@ -972,11 +972,11 @@ static void CG_DrawAmmo( centity_t *cent,menuDef_t *menuHUD, float hudRatio ) value =ps->ammo[weaponData[cent->currentState.weapon].ammoIndex]; CG_DrawNumField ( - SCREEN_WIDTH - (SCREEN_WIDTH - focusItem->window.rect.x) * hudRatio, + SCREEN_WIDTH - (SCREEN_WIDTH - focusItem->window.rect.x) * cgs.widthRatioCoef, focusItem->window.rect.y, 3, value, - focusItem->window.rect.w * hudRatio, + focusItem->window.rect.w * cgs.widthRatioCoef, focusItem->window.rect.h, NUM_FONT_SMALL, qfalse); @@ -1010,9 +1010,9 @@ static void CG_DrawAmmo( centity_t *cent,menuDef_t *menuHUD, float hudRatio ) trap->R_SetColor( calcColor); CG_DrawPic( - SCREEN_WIDTH - (SCREEN_WIDTH - focusItem->window.rect.x) * hudRatio, + SCREEN_WIDTH - (SCREEN_WIDTH - focusItem->window.rect.x) * cgs.widthRatioCoef, focusItem->window.rect.y, - focusItem->window.rect.w * hudRatio, + focusItem->window.rect.w * cgs.widthRatioCoef, focusItem->window.rect.h, focusItem->window.background ); @@ -1027,7 +1027,7 @@ static void CG_DrawAmmo( centity_t *cent,menuDef_t *menuHUD, float hudRatio ) CG_DrawForcePower ================ */ -void CG_DrawForcePower( menuDef_t *menuHUD, float hudRatio ) +void CG_DrawForcePower( menuDef_t *menuHUD ) { int i; vec4_t calcColor; @@ -1120,9 +1120,9 @@ void CG_DrawForcePower( menuDef_t *menuHUD, float hudRatio ) trap->R_SetColor( calcColor); CG_DrawPic( - SCREEN_WIDTH - (SCREEN_WIDTH - focusItem->window.rect.x) * hudRatio, + SCREEN_WIDTH - (SCREEN_WIDTH - focusItem->window.rect.x) * cgs.widthRatioCoef, focusItem->window.rect.y, - focusItem->window.rect.w * hudRatio, + focusItem->window.rect.w * cgs.widthRatioCoef, focusItem->window.rect.h, focusItem->window.background ); @@ -1145,11 +1145,11 @@ void CG_DrawForcePower( menuDef_t *menuHUD, float hudRatio ) } CG_DrawNumField ( - SCREEN_WIDTH - (SCREEN_WIDTH - focusItem->window.rect.x) * hudRatio, + SCREEN_WIDTH - (SCREEN_WIDTH - focusItem->window.rect.x) * cgs.widthRatioCoef, focusItem->window.rect.y, 3, cg.snap->ps.fd.forcePower, - focusItem->window.rect.w * hudRatio, + focusItem->window.rect.w * cgs.widthRatioCoef, focusItem->window.rect.h, NUM_FONT_SMALL, qfalse); @@ -1330,7 +1330,6 @@ void CG_DrawHUD(centity_t *cent) const char *scoreStr = NULL; int scoreBias; char scoreBiasStr[16]; - float hudRatio = cg_hudRatio.integer ? cgs.widthRatioCoef : 1.0f; if (cg_hudFiles.integer) { @@ -1372,9 +1371,9 @@ void CG_DrawHUD(centity_t *cent) { trap->R_SetColor( colorTable[CT_WHITE] ); CG_DrawPic( - focusItem->window.rect.x * hudRatio, + focusItem->window.rect.x * cgs.widthRatioCoef, focusItem->window.rect.y, - focusItem->window.rect.w * hudRatio, + focusItem->window.rect.w * cgs.widthRatioCoef, focusItem->window.rect.h, focusItem->window.background ); @@ -1386,16 +1385,16 @@ void CG_DrawHUD(centity_t *cent) { trap->R_SetColor( colorTable[CT_WHITE] ); CG_DrawPic( - focusItem->window.rect.x * hudRatio, + focusItem->window.rect.x * cgs.widthRatioCoef, focusItem->window.rect.y, - focusItem->window.rect.w * hudRatio, + focusItem->window.rect.w * cgs.widthRatioCoef, focusItem->window.rect.h, focusItem->window.background ); } - CG_DrawArmor(menuHUD,hudRatio); - CG_DrawHealth(menuHUD,hudRatio); + CG_DrawArmor(menuHUD); + CG_DrawHealth(menuHUD); } else { @@ -1467,9 +1466,9 @@ void CG_DrawHUD(centity_t *cent) { trap->R_SetColor( colorTable[CT_WHITE] ); CG_DrawPic( - SCREEN_WIDTH - (SCREEN_WIDTH - focusItem->window.rect.x) * hudRatio, + SCREEN_WIDTH - (SCREEN_WIDTH - focusItem->window.rect.x) * cgs.widthRatioCoef, focusItem->window.rect.y, - focusItem->window.rect.w * hudRatio, + focusItem->window.rect.w * cgs.widthRatioCoef, focusItem->window.rect.h, focusItem->window.background ); @@ -1480,24 +1479,24 @@ void CG_DrawHUD(centity_t *cent) { trap->R_SetColor( colorTable[CT_WHITE] ); CG_DrawPic( - SCREEN_WIDTH - (SCREEN_WIDTH - focusItem->window.rect.x) * hudRatio, + SCREEN_WIDTH - (SCREEN_WIDTH - focusItem->window.rect.x) * cgs.widthRatioCoef, focusItem->window.rect.y, - focusItem->window.rect.w * hudRatio, + focusItem->window.rect.w * cgs.widthRatioCoef, focusItem->window.rect.h, focusItem->window.background ); } - CG_DrawForcePower(menuHUD,hudRatio); + CG_DrawForcePower(menuHUD); // Draw ammo tics or saber style if ( cent->currentState.weapon == WP_SABER ) { - CG_DrawSaberStyle(cent,menuHUD,hudRatio); + CG_DrawSaberStyle(cent,menuHUD); } else { - CG_DrawAmmo(cent,menuHUD,hudRatio); + CG_DrawAmmo(cent,menuHUD); } } else @@ -2519,7 +2518,7 @@ veh_damage_t vehDamageData[4] = }; // Draw health graphic for given part of vehicle -void CG_DrawVehicleDamage(const centity_t *veh,int brokenLimbs,const menuDef_t *menuHUD,float alpha,int index,float hudRatio,int isEnemyVehicleHUD) +void CG_DrawVehicleDamage(const centity_t *veh,int brokenLimbs,const menuDef_t *menuHUD,float alpha,int index,int isEnemyVehicleHUD) { itemDef_t *item; int colorI; @@ -2569,9 +2568,9 @@ void CG_DrawVehicleDamage(const centity_t *veh,int brokenLimbs,const menuDef_t * if (graphicHandle) { CG_DrawPic( - isEnemyVehicleHUD ? SCREEN_WIDTH - (SCREEN_WIDTH - item->window.rect.x) * hudRatio : item->window.rect.x * hudRatio, + isEnemyVehicleHUD ? SCREEN_WIDTH - (SCREEN_WIDTH - item->window.rect.x) * cgs.widthRatioCoef : item->window.rect.x * cgs.widthRatioCoef, item->window.rect.y, - item->window.rect.w * hudRatio, + item->window.rect.w * cgs.widthRatioCoef, item->window.rect.h, graphicHandle ); } @@ -2624,9 +2623,9 @@ void CG_DrawVehicleDamageHUD(const centity_t *veh,int brokenLimbs,float percShie } CG_DrawPic( - isEnemyVehicleHUD ? SCREEN_WIDTH - (SCREEN_WIDTH - item->window.rect.x) * hudRatio : item->window.rect.x * hudRatio, + isEnemyVehicleHUD ? SCREEN_WIDTH - (SCREEN_WIDTH - item->window.rect.x) * cgs.widthRatioCoef : item->window.rect.x * cgs.widthRatioCoef, item->window.rect.y, - item->window.rect.w * hudRatio, + item->window.rect.w * cgs.widthRatioCoef, item->window.rect.h, veh->m_pVehicle->m_pVehicleInfo->dmgIndicBackgroundHandle ); } @@ -2639,9 +2638,9 @@ void CG_DrawVehicleDamageHUD(const centity_t *veh,int brokenLimbs,float percShie { trap->R_SetColor( item->window.foreColor ); CG_DrawPic( - isEnemyVehicleHUD ? SCREEN_WIDTH - (SCREEN_WIDTH - item->window.rect.x) * hudRatio : item->window.rect.x * hudRatio, + isEnemyVehicleHUD ? SCREEN_WIDTH - (SCREEN_WIDTH - item->window.rect.x) * cgs.widthRatioCoef : item->window.rect.x * cgs.widthRatioCoef, item->window.rect.y, - item->window.rect.w * hudRatio, + item->window.rect.w * cgs.widthRatioCoef, item->window.rect.h, veh->m_pVehicle->m_pVehicleInfo->dmgIndicFrameHandle ); } @@ -2656,9 +2655,9 @@ void CG_DrawVehicleDamageHUD(const centity_t *veh,int brokenLimbs,float percShie color[3] = percShields; trap->R_SetColor( color ); CG_DrawPic( - isEnemyVehicleHUD ? SCREEN_WIDTH - (SCREEN_WIDTH - item->window.rect.x) * hudRatio : item->window.rect.x * hudRatio, + isEnemyVehicleHUD ? SCREEN_WIDTH - (SCREEN_WIDTH - item->window.rect.x) * cgs.widthRatioCoef : item->window.rect.x * cgs.widthRatioCoef, item->window.rect.y, - item->window.rect.w * hudRatio, + item->window.rect.w * cgs.widthRatioCoef, item->window.rect.h, veh->m_pVehicle->m_pVehicleInfo->dmgIndicShieldHandle ); } @@ -2666,10 +2665,10 @@ void CG_DrawVehicleDamageHUD(const centity_t *veh,int brokenLimbs,float percShie //TODO: if we check nextState.brokenLimbs & prevState.brokenLimbs, we can tell when a damage flag has been added and flash that part of the ship //FIXME: when ship explodes, either stop drawing ship or draw all parts black - CG_DrawVehicleDamage(veh,brokenLimbs,menuHUD,alpha,VEH_DAMAGE_FRONT,hudRatio,isEnemyVehicleHUD); - CG_DrawVehicleDamage(veh,brokenLimbs,menuHUD,alpha,VEH_DAMAGE_BACK,hudRatio,isEnemyVehicleHUD); - CG_DrawVehicleDamage(veh,brokenLimbs,menuHUD,alpha,VEH_DAMAGE_LEFT,hudRatio,isEnemyVehicleHUD); - CG_DrawVehicleDamage(veh,brokenLimbs,menuHUD,alpha,VEH_DAMAGE_RIGHT,hudRatio,isEnemyVehicleHUD); + CG_DrawVehicleDamage(veh,brokenLimbs,menuHUD,alpha,VEH_DAMAGE_FRONT,isEnemyVehicleHUD); + CG_DrawVehicleDamage(veh,brokenLimbs,menuHUD,alpha,VEH_DAMAGE_BACK,isEnemyVehicleHUD); + CG_DrawVehicleDamage(veh,brokenLimbs,menuHUD,alpha,VEH_DAMAGE_LEFT,isEnemyVehicleHUD); + CG_DrawVehicleDamage(veh,brokenLimbs,menuHUD,alpha,VEH_DAMAGE_RIGHT,isEnemyVehicleHUD); } qboolean CG_DrawVehicleHud( const centity_t *cent ) @@ -2851,7 +2850,7 @@ static void CG_DrawPickupItem( void ) { { CG_RegisterItemVisuals( value ); trap->R_SetColor( fadeColor ); - CG_DrawPic( 573, 320, ICON_SIZE, ICON_SIZE, cg_items[ value ].icon ); + CG_DrawPic( 573, 320, ICON_SIZE * cgs.widthRatioCoef, ICON_SIZE, cg_items[ value ].icon ); trap->R_SetColor( NULL ); } } @@ -2993,7 +2992,7 @@ static float CG_DrawEnemyInfo ( float y ) size = ICON_SIZE * 1.25; y += 5; - CG_DrawPic( 640 - size - 12 + xOffset, y, size, size, cgs.media.weaponIcons[WP_SABER] ); + CG_DrawPic( SCREEN_WIDTH - (SCREEN_WIDTH - size - 12 + xOffset) * cgs.widthRatioCoef, y, size * cgs.widthRatioCoef, size, cgs.media.weaponIcons[WP_SABER] ); y += size; @@ -3084,7 +3083,7 @@ static float CG_DrawEnemyInfo ( float y ) if ( ci->modelIcon ) { - CG_DrawPic( 640 - size - 5 + xOffset, y, size, size, ci->modelIcon ); + CG_DrawPic( SCREEN_WIDTH - (SCREEN_WIDTH - size - 5 + xOffset) * cgs.widthRatioCoef, y, size * cgs.widthRatioCoef, size, ci->modelIcon ); } y += size; @@ -4057,7 +4056,7 @@ static void CG_DrawPowerupIcons(int y) icoShader = trap->R_RegisterShader( item->icon ); } - CG_DrawPic( (640-(ico_size*1.1)) + xOffset, y, ico_size, ico_size, icoShader ); + CG_DrawPic( SCREEN_WIDTH - ((SCREEN_WIDTH-(ico_size*1.1)) + xOffset) * cgs.widthRatioCoef, y, ico_size * cgs.widthRatioCoef, ico_size, icoShader ); y += ico_size; @@ -5676,7 +5675,7 @@ static void CG_DrawHolocronIcons(void) int startx = 10; int starty = 10;//SCREEN_HEIGHT - icon_size*3; - int endx = icon_size; + int endx = icon_size * cgs.widthRatioCoef; int endy = icon_size; if (cg.snap->ps.zoomMode) @@ -5731,7 +5730,7 @@ static void CG_DrawActivePowers(void) int startx = icon_size*2+16; int starty = SCREEN_HEIGHT - icon_size*2; - int endx = icon_size; + int endx = icon_size * cgs.widthRatioCoef; int endy = icon_size; if (cg.snap->ps.zoomMode) @@ -6992,14 +6991,14 @@ void CG_DrawFlagStatus() if (CG_YourTeamHasFlag()) { //CG_DrawPic( startDrawPos, 330, ico_size, ico_size, theirFlagShader ); - CG_DrawPic( 2, 330-startDrawPos, ico_size, ico_size, theirFlagShader ); + CG_DrawPic( 2, 330-startDrawPos, ico_size * cgs.widthRatioCoef, ico_size, theirFlagShader ); startDrawPos += ico_size+2; } if (CG_OtherTeamHasFlag()) { //CG_DrawPic( startDrawPos, 330, ico_size, ico_size, myFlagTakenShader ); - CG_DrawPic( 2, 330-startDrawPos, ico_size, ico_size, myFlagTakenShader ); + CG_DrawPic( 2, 330-startDrawPos, ico_size * cgs.widthRatioCoef, ico_size, myFlagTakenShader ); } }