mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 22:11:43 +00:00
- fixed: The powerup icons did not blink when expiring.
This commit is contained in:
parent
0ed3ee6267
commit
3ccd4aa0d1
4 changed files with 44 additions and 41 deletions
|
@ -1088,7 +1088,9 @@ static void DrawPowerups(player_t *CPlayer)
|
||||||
|
|
||||||
for (item = CPlayer->mo->Inventory; item != NULL; item = item->Inventory)
|
for (item = CPlayer->mo->Inventory; item != NULL; item = item->Inventory)
|
||||||
{
|
{
|
||||||
IFVIRTUALPTR(item, AInventory, GetPowerupIcon)
|
if (item->IsKindOf(NAME_Powerup))
|
||||||
|
{
|
||||||
|
IFVIRTUALPTRNAME(item, NAME_Powerup, GetPowerupIcon)
|
||||||
{
|
{
|
||||||
VMValue param[] = { item };
|
VMValue param[] = { item };
|
||||||
int rv;
|
int rv;
|
||||||
|
@ -1098,6 +1100,13 @@ static void DrawPowerups(player_t *CPlayer)
|
||||||
if (!tex.isValid()) continue;
|
if (!tex.isValid()) continue;
|
||||||
auto texture = TexMan(tex);
|
auto texture = TexMan(tex);
|
||||||
|
|
||||||
|
IFVIRTUALPTRNAME(item, NAME_Powerup, IsBlinking)
|
||||||
|
{
|
||||||
|
// Reuse the parameters from GetPowerupIcon
|
||||||
|
VMCall(func, param, 1, &ret, 1);
|
||||||
|
if (!rv)
|
||||||
|
{
|
||||||
|
|
||||||
screen->DrawTexture(texture, x, y, DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_CenterBottomOffset, true, TAG_DONE);
|
screen->DrawTexture(texture, x, y, DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_CenterBottomOffset, true, TAG_DONE);
|
||||||
|
|
||||||
x -= POWERUPICONSIZE;
|
x -= POWERUPICONSIZE;
|
||||||
|
@ -1109,6 +1118,9 @@ static void DrawPowerups(player_t *CPlayer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
|
|
|
@ -858,21 +858,6 @@ class Inventory : Actor native
|
||||||
|
|
||||||
virtual ui version("2.4") bool DrawPowerup(int x, int y) { return false; }
|
virtual ui version("2.4") bool DrawPowerup(int x, int y) { return false; }
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
//
|
|
||||||
// AInventory :: GetPowerupIcon
|
|
||||||
//
|
|
||||||
// Returns the icon that should be drawn for an active powerup.
|
|
||||||
//
|
|
||||||
//===========================================================================
|
|
||||||
|
|
||||||
virtual clearscope version("2.5") TextureID GetPowerupIcon() const
|
|
||||||
{
|
|
||||||
TextureID id;
|
|
||||||
id.SetInvalid();
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
// AInventory :: AbsorbDamage
|
// AInventory :: AbsorbDamage
|
||||||
|
|
|
@ -269,11 +269,13 @@ class Powerup : Inventory
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
// APowerup :: DrawPowerup
|
// AInventory :: GetPowerupIcon
|
||||||
|
//
|
||||||
|
// Returns the icon that should be drawn for an active powerup.
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
override TextureID GetPowerupIcon()
|
virtual clearscope version("2.5") TextureID GetPowerupIcon() const
|
||||||
{
|
{
|
||||||
return Icon;
|
return Icon;
|
||||||
}
|
}
|
||||||
|
|
|
@ -813,10 +813,13 @@ class BaseStatusBar native ui
|
||||||
// that can obey AltHUD rules - which this cannot.
|
// that can obey AltHUD rules - which this cannot.
|
||||||
Vector2 pos = (-20, POWERUPICONSIZE * 5 / 4);
|
Vector2 pos = (-20, POWERUPICONSIZE * 5 / 4);
|
||||||
double maxpos = screen.GetWidth() / 2;
|
double maxpos = screen.GetWidth() / 2;
|
||||||
for (let item = CPlayer.mo.Inv; item != NULL; item = item.Inv)
|
for (let iitem = CPlayer.mo.Inv; iitem != NULL; iitem = iitem.Inv)
|
||||||
|
{
|
||||||
|
let item = Powerup(iitem);
|
||||||
|
if (item != null)
|
||||||
{
|
{
|
||||||
let icon = item.GetPowerupIcon();
|
let icon = item.GetPowerupIcon();
|
||||||
if (icon.IsValid())
|
if (icon.IsValid() && !item.IsBlinking())
|
||||||
{
|
{
|
||||||
// Each icon gets a 32x32 block.
|
// Each icon gets a 32x32 block.
|
||||||
DrawTexture(icon, pos, DI_SCREEN_RIGHT_TOP, 1.0, (POWERUPICONSIZE, POWERUPICONSIZE));
|
DrawTexture(icon, pos, DI_SCREEN_RIGHT_TOP, 1.0, (POWERUPICONSIZE, POWERUPICONSIZE));
|
||||||
|
@ -829,6 +832,7 @@ class BaseStatusBar native ui
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue