Skip to content

Commit

Permalink
widescreen hud selection
Browse files Browse the repository at this point in the history
  • Loading branch information
TwelveEyes committed Jun 23, 2024
1 parent 03a8255 commit 0f82931
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 81 deletions.
56 changes: 28 additions & 28 deletions code/cgame/cg_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3296,7 +3296,7 @@ void CG_DrawInventorySelect( void )
int holdCount,iconCnt;
int sideLeftIconCnt,sideRightIconCnt;
int count;
int holdX;
float holdX;
//int height;
// int tag;
float addX;
Expand Down Expand Up @@ -3370,18 +3370,18 @@ void CG_DrawInventorySelect( void )
i = INV_MAX-1;
}

const int smallIconSize = 40;
const int bigIconSize = 80;
const int pad = 16;
const float smallIconSize_x = 40 * cgs.widthRatioCoef, smallIconSize_y = 40;
const float bigIconSize_x = 80 * cgs.widthRatioCoef, bigIconSize_y = 80;
const float pad = 16 * cgs.widthRatioCoef;

const int x = 320;
const int y = 410;

// Left side ICONS
// Work backwards from current icon
holdX = x - ((bigIconSize/2) + pad + smallIconSize);
holdX = x - ((bigIconSize_x/2) + pad + smallIconSize_x);
//height = smallIconSize * cg.iconHUDPercent;
addX = (float) smallIconSize * .75;
addX = smallIconSize_x * .75;

for (iconCnt=0;iconCnt<sideLeftIconCnt;i--)
{
Expand All @@ -3400,13 +3400,13 @@ void CG_DrawInventorySelect( void )
if (inv_icons[i])
{
cgi_R_SetColor(NULL);
CG_DrawPic( holdX, y+10, smallIconSize, smallIconSize, inv_icons[i] );
CG_DrawPic( holdX, y+10, smallIconSize_x, smallIconSize_y, inv_icons[i] );

cgi_R_SetColor(colorTable[CT_ICON_BLUE]);
CG_DrawNumField (holdX + addX, y + smallIconSize, 2, cg.snap->ps.inventory[i], 6, 12,
CG_DrawNumField (holdX + addX, y + smallIconSize_y, 2, cg.snap->ps.inventory[i], 6*cgs.widthRatioCoef, 12,
NUM_FONT_SMALL,qfalse);

holdX -= (smallIconSize+pad);
holdX -= (smallIconSize_x+pad);
}
}

Expand All @@ -3415,10 +3415,10 @@ void CG_DrawInventorySelect( void )
if (inv_icons[cg.inventorySelect])
{
cgi_R_SetColor(NULL);
CG_DrawPic( x-(bigIconSize/2), (y-((bigIconSize-smallIconSize)/2))+10, bigIconSize, bigIconSize, inv_icons[cg.inventorySelect] );
addX = (float) bigIconSize * .75;
CG_DrawPic( x-(bigIconSize_x/2), (y-((bigIconSize_y-smallIconSize_y)/2))+10, bigIconSize_x, bigIconSize_y, inv_icons[cg.inventorySelect] );
addX = bigIconSize_x * .75;
cgi_R_SetColor(colorTable[CT_ICON_BLUE]);
CG_DrawNumField ((x-(bigIconSize/2)) + addX, y, 2, cg.snap->ps.inventory[cg.inventorySelect], 6, 12,
CG_DrawNumField ((x-(bigIconSize_x/2)) + addX, y, 2, cg.snap->ps.inventory[cg.inventorySelect], 6*cgs.widthRatioCoef, 12,
NUM_FONT_SMALL,qfalse);

if (inv_names[cg.inventorySelect])
Expand Down Expand Up @@ -3451,9 +3451,9 @@ void CG_DrawInventorySelect( void )

// Right side ICONS
// Work forwards from current icon
holdX = x + (bigIconSize/2) + pad;
holdX = x + (bigIconSize_x/2) + pad;
//height = smallIconSize * cg.iconHUDPercent;
addX = (float) smallIconSize * .75;
addX = smallIconSize_x * .75;
for (iconCnt=0;iconCnt<sideRightIconCnt;i++)
{
if (i> INV_MAX-1)
Expand All @@ -3471,13 +3471,13 @@ void CG_DrawInventorySelect( void )
if (inv_icons[i])
{
cgi_R_SetColor(NULL);
CG_DrawPic( holdX, y+10, smallIconSize, smallIconSize, inv_icons[i] );
CG_DrawPic( holdX, y+10, smallIconSize_x, smallIconSize_y, inv_icons[i] );

cgi_R_SetColor(colorTable[CT_ICON_BLUE]);
CG_DrawNumField (holdX + addX, y + smallIconSize, 2, cg.snap->ps.inventory[i], 6, 12,
CG_DrawNumField (holdX + addX, y + smallIconSize_y, 2, cg.snap->ps.inventory[i], 6*cgs.widthRatioCoef, 12,
NUM_FONT_SMALL,qfalse);

holdX += (smallIconSize+pad);
holdX += (smallIconSize_x+pad);
}
}
}
Expand Down Expand Up @@ -3866,7 +3866,7 @@ void CG_DrawForceSelect( void )
{
int i;
int count;
int holdX;
float holdX;
int sideLeftIconCnt,sideRightIconCnt;
int holdCount,iconCnt;
char text[1024]={0};
Expand Down Expand Up @@ -3932,9 +3932,9 @@ void CG_DrawForceSelect( void )
sideRightIconCnt = holdCount - sideLeftIconCnt;
}

const int smallIconSize = 30;
const int bigIconSize = 60;
const int pad = 12;
const float smallIconSize_x = 30 * cgs.widthRatioCoef, smallIconSize_y = 30;
const float bigIconSize_x = 60 * cgs.widthRatioCoef, bigIconSize_y = 60;
const float pad = 12;

const int x = 320;
const int y = 425;
Expand All @@ -3947,7 +3947,7 @@ void CG_DrawForceSelect( void )

cgi_R_SetColor(NULL);
// Work backwards from current icon
holdX = x - ((bigIconSize/2) + pad + smallIconSize);
holdX = x - ((bigIconSize_x/2) + pad + smallIconSize_x);
for (iconCnt=1;iconCnt<(sideLeftIconCnt+1);i--)
{
if (i < 0)
Expand All @@ -3964,15 +3964,15 @@ void CG_DrawForceSelect( void )

if (force_icons[showPowers[i]])
{
CG_DrawPic( holdX, y + yOffset, smallIconSize, smallIconSize, force_icons[showPowers[i]] );
holdX -= (smallIconSize+pad);
CG_DrawPic( holdX, y + yOffset, smallIconSize_x, smallIconSize_y, force_icons[showPowers[i]] );
holdX -= (smallIconSize_x+pad);
}
}

// Current Center Icon
if (force_icons[showPowers[cg.forcepowerSelect]])
{
CG_DrawPic( x-(bigIconSize/2), (y-((bigIconSize-smallIconSize)/2)) + yOffset, bigIconSize, bigIconSize, force_icons[showPowers[cg.forcepowerSelect]] );
CG_DrawPic( x-(bigIconSize_x/2), (y-((bigIconSize_y-smallIconSize_y)/2)) + yOffset, bigIconSize_x, bigIconSize_y, force_icons[showPowers[cg.forcepowerSelect]] );
}


Expand All @@ -3983,7 +3983,7 @@ void CG_DrawForceSelect( void )
}

// Work forwards from current icon
holdX = x + (bigIconSize/2) + pad;
holdX = x + (bigIconSize_x/2) + pad;
for (iconCnt=1;iconCnt<(sideRightIconCnt+1);i++)
{
if (i>=MAX_SHOWPOWERS)
Expand All @@ -4000,8 +4000,8 @@ void CG_DrawForceSelect( void )

if (force_icons[showPowers[i]])
{
CG_DrawPic( holdX, y + yOffset, smallIconSize, smallIconSize, force_icons[showPowers[i]] );
holdX += (smallIconSize+pad);
CG_DrawPic( holdX, y + yOffset, smallIconSize_x, smallIconSize_y, force_icons[showPowers[i]] );
holdX += (smallIconSize_x+pad);
}
}

Expand Down
34 changes: 19 additions & 15 deletions code/cgame/cg_weapons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1774,8 +1774,10 @@ void CG_DrawWeaponSelect( void )
int i;
int bits;
int count;
int smallIconSize,bigIconSize;
int holdX,x,y,x2,y2,w2,h2,pad;
float smallIconSize_x,bigIconSize_x;
float smallIconSize_y,bigIconSize_y;
float holdX,pad;
int x,y,x2,y2,w2,h2;
int sideLeftIconCnt,sideRightIconCnt;
int sideMax,holdCount,iconCnt;
//int height;
Expand Down Expand Up @@ -1853,9 +1855,11 @@ void CG_DrawWeaponSelect( void )
i = MAX_PLAYER_WEAPONS;
}

smallIconSize = 40;
bigIconSize = 80;
pad = 12;
smallIconSize_x = 40 * cgs.widthRatioCoef;
smallIconSize_y = 40;
bigIconSize_x = 80 * cgs.widthRatioCoef;
bigIconSize_y = 80;
pad = 12 * cgs.widthRatioCoef;

if (!cgi_UI_GetMenuInfo("weaponselecthud",&x2,&y2,&w2,&h2))
{
Expand All @@ -1872,7 +1876,7 @@ void CG_DrawWeaponSelect( void )
// Left side ICONS
cgi_R_SetColor( calcColor);
// Work backwards from current icon
holdX = x - ((bigIconSize/2) + pad + smallIconSize);
holdX = x - ((bigIconSize_x/2) + pad + smallIconSize_x);
//height = smallIconSize * cg.iconHUDPercent;
drewConc = qfalse;

Expand Down Expand Up @@ -1923,14 +1927,14 @@ void CG_DrawWeaponSelect( void )

if (!CG_WeaponCheck(i))
{
CG_DrawPic( holdX, y+10+yOffset, smallIconSize, smallIconSize, weaponInfo->weaponIconNoAmmo );
CG_DrawPic( holdX, y+10+yOffset, smallIconSize_x, smallIconSize_y, weaponInfo->weaponIconNoAmmo );
}
else
{
CG_DrawPic( holdX, y+10+yOffset, smallIconSize, smallIconSize, weaponInfo->weaponIcon );
CG_DrawPic( holdX, y+10+yOffset, smallIconSize_x, smallIconSize_y, weaponInfo->weaponIcon );
}

holdX -= (smallIconSize+pad);
holdX -= (smallIconSize_x+pad);
}
if ( i == WP_CONCUSSION )
{
Expand All @@ -1950,11 +1954,11 @@ void CG_DrawWeaponSelect( void )

if (!CG_WeaponCheck(cg.weaponSelect))
{
CG_DrawPic( x-(bigIconSize/2), (y-((bigIconSize-smallIconSize)/2))+10+yOffset, bigIconSize, bigIconSize, weaponInfo->weaponIconNoAmmo );
CG_DrawPic( x-(bigIconSize_x/2), (y-((bigIconSize_y-smallIconSize_y)/2))+10+yOffset, bigIconSize_x, bigIconSize_y, weaponInfo->weaponIconNoAmmo );
}
else
{
CG_DrawPic( x-(bigIconSize/2), (y-((bigIconSize-smallIconSize)/2))+10+yOffset, bigIconSize, bigIconSize, weaponInfo->weaponIcon );
CG_DrawPic( x-(bigIconSize_x/2), (y-((bigIconSize_y-smallIconSize_y)/2))+10+yOffset, bigIconSize_x, bigIconSize_y, weaponInfo->weaponIcon );
}
}

Expand All @@ -1974,7 +1978,7 @@ void CG_DrawWeaponSelect( void )
// Right side ICONS
// Work forwards from current icon
cgi_R_SetColor( calcColor);
holdX = x + (bigIconSize/2) + pad;
holdX = x + (bigIconSize_x/2) + pad;
//height = smallIconSize * cg.iconHUDPercent;
drewConc = qfalse;
for (iconCnt=1;iconCnt<(sideRightIconCnt+1);i++)
Expand Down Expand Up @@ -2024,15 +2028,15 @@ void CG_DrawWeaponSelect( void )
// No ammo for this weapon?
if (!CG_WeaponCheck(i))
{
CG_DrawPic( holdX, y+10+yOffset, smallIconSize, smallIconSize, weaponInfo->weaponIconNoAmmo );
CG_DrawPic( holdX, y+10+yOffset, smallIconSize_x, smallIconSize_y, weaponInfo->weaponIconNoAmmo );
}
else
{
CG_DrawPic( holdX, y+10+yOffset, smallIconSize, smallIconSize, weaponInfo->weaponIcon );
CG_DrawPic( holdX, y+10+yOffset, smallIconSize_x, smallIconSize_y, weaponInfo->weaponIcon );
}


holdX += (smallIconSize+pad);
holdX += (smallIconSize_x+pad);
}
if ( i == WP_CONCUSSION )
{
Expand Down
Loading

0 comments on commit 0f82931

Please sign in to comment.