mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 23:11:58 +00:00
- changed icon lookup for weapons in SBARINFO so that it uses the alternative HUD's method if the weapon does not have an icon defined.
SVN r3587 (trunk)
This commit is contained in:
parent
4df1ea63b5
commit
b2e5e15d3c
3 changed files with 36 additions and 18 deletions
|
@ -386,4 +386,6 @@ void ST_LoadCrosshair(bool alwaysload=false);
|
|||
void ST_Clear();
|
||||
extern FTexture *CrosshairImage;
|
||||
|
||||
FTextureID GetWeaponIcon(AWeapon *weapon);
|
||||
|
||||
#endif /* __SBAR_H__ */
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
// classes.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
class CommandDrawImage : public SBarInfoCommand
|
||||
{
|
||||
public:
|
||||
|
@ -169,8 +170,17 @@ class CommandDrawImage : public SBarInfoCommand
|
|||
else if(type == WEAPONICON)
|
||||
{
|
||||
AWeapon *weapon = statusBar->CPlayer->ReadyWeapon;
|
||||
if(weapon != NULL && weapon->Icon.isValid())
|
||||
if(weapon != NULL)
|
||||
{
|
||||
FTextureID icon;
|
||||
if (weapon->Icon.isValid())
|
||||
{
|
||||
icon = weapon->Icon;
|
||||
}
|
||||
else
|
||||
{
|
||||
icon = GetWeaponIcon(weapon);
|
||||
}
|
||||
texture = TexMan[weapon->Icon];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -594,25 +594,12 @@ static int DrawAmmo(player_t *CPlayer, int x, int y)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void DrawOneWeapon(player_t * CPlayer, int x, int & y, AWeapon * weapon)
|
||||
FTextureID GetWeaponIcon(AWeapon *weapon) // This function is also used by SBARINFO
|
||||
{
|
||||
int trans;
|
||||
FTextureID picnum;
|
||||
|
||||
// Powered up weapons and inherited sister weapons are not displayed.
|
||||
if (weapon->WeaponFlags & WIF_POWERED_UP) return;
|
||||
if (weapon->SisterWeapon && weapon->IsKindOf(RUNTIME_TYPE(weapon->SisterWeapon))) return;
|
||||
|
||||
trans=0x6666;
|
||||
if (CPlayer->ReadyWeapon)
|
||||
{
|
||||
if (weapon==CPlayer->ReadyWeapon || weapon==CPlayer->ReadyWeapon->SisterWeapon) trans=0xd999;
|
||||
}
|
||||
|
||||
FTextureID AltIcon = GetHUDIcon(weapon->GetClass());
|
||||
FState * state=NULL, *ReadyState;
|
||||
|
||||
FTextureID AltIcon = GetHUDIcon(weapon->GetClass());
|
||||
picnum = !AltIcon.isNull()? AltIcon : weapon->Icon;
|
||||
FTextureID picnum = !AltIcon.isNull()? AltIcon : weapon->Icon;
|
||||
|
||||
if (picnum.isNull())
|
||||
{
|
||||
|
@ -625,7 +612,7 @@ static void DrawOneWeapon(player_t * CPlayer, int x, int & y, AWeapon * weapon)
|
|||
{
|
||||
state = ReadyState;
|
||||
}
|
||||
if (state && (unsigned)state->sprite < (unsigned)sprites.Size ())
|
||||
if (state && (unsigned)state->sprite < (unsigned)sprites.Size ())
|
||||
{
|
||||
spritedef_t * sprdef = &sprites[state->sprite];
|
||||
spriteframe_t * sprframe = &SpriteFrames[sprdef->spriteframes + state->GetFrame()];
|
||||
|
@ -633,6 +620,25 @@ static void DrawOneWeapon(player_t * CPlayer, int x, int & y, AWeapon * weapon)
|
|||
picnum = sprframe->Texture[0];
|
||||
}
|
||||
}
|
||||
return picnum;
|
||||
}
|
||||
|
||||
|
||||
static void DrawOneWeapon(player_t * CPlayer, int x, int & y, AWeapon * weapon)
|
||||
{
|
||||
int trans;
|
||||
|
||||
// Powered up weapons and inherited sister weapons are not displayed.
|
||||
if (weapon->WeaponFlags & WIF_POWERED_UP) return;
|
||||
if (weapon->SisterWeapon && weapon->IsKindOf(RUNTIME_TYPE(weapon->SisterWeapon))) return;
|
||||
|
||||
trans=0x6666;
|
||||
if (CPlayer->ReadyWeapon)
|
||||
{
|
||||
if (weapon==CPlayer->ReadyWeapon || weapon==CPlayer->ReadyWeapon->SisterWeapon) trans=0xd999;
|
||||
}
|
||||
|
||||
FTextureID picnum = GetWeaponIcon(weapon);
|
||||
|
||||
if (picnum.isValid())
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue