- ported the minibar HUD.

This commit is contained in:
Christoph Oelckers 2020-08-13 22:37:58 +02:00
parent 8c7b93ceef
commit 70b2215f4e
4 changed files with 48 additions and 80 deletions

View File

@ -2214,8 +2214,6 @@ drawscreen(PLAYERp pp)
DrawMessageInput(); // This is only used for non-multiplayer input now
UpdateMiniBar(pp);
if (!M_Active())
SecretInfo(pp);

View File

@ -101,81 +101,6 @@ INVENTORY_DATA InventoryData[MAX_INVENTORY+1] =
void PanelInvTestSuicide(PANEL_SPRITEp psp);
void UpdateMiniBar(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
int x,y;
INVENTORY_DATAp id;
extern SWBOOL PanelUpdateMode;
#define MINI_BAR_Y 174
#define MINI_BAR_HEALTH_BOX_PIC 2437
#define MINI_BAR_AMMO_BOX_PIC 2437
#define MINI_BAR_INVENTORY_BOX_PIC 2438
#define MINI_BAR_HEALTH_BOX_X 4
#define MINI_BAR_AMMO_BOX_X 32
#define MINI_BAR_INVENTORY_BOX_X 64
#define MINI_BAR_INVENTORY_BOX_Y MINI_BAR_Y
if (!PanelUpdateMode || !u)
return;
if (gs.BorderNum != BORDER_MINI_BAR)
return;
x = MINI_BAR_HEALTH_BOX_X;
y = 200 - 26;
rotatesprite(x << 16, y << 16, (1 << 16), 0,
MINI_BAR_HEALTH_BOX_PIC, 0, 0,
ROTATE_SPRITE_SCREEN_CLIP | ROTATE_SPRITE_CORNER | RS_ALIGN_L,
0, 0, xdim - 1, ydim - 1);
x = MINI_BAR_HEALTH_BOX_X+3;
DisplayMiniBarNumber(x, y+5, u->Health);
if (u->WeaponNum != WPN_SWORD && u->WeaponNum != WPN_FIST)
{
x = MINI_BAR_AMMO_BOX_X;
rotatesprite(x << 16, y << 16, (1 << 16), 0,
MINI_BAR_AMMO_BOX_PIC, 0, 0,
ROTATE_SPRITE_SCREEN_CLIP | ROTATE_SPRITE_CORNER | RS_ALIGN_L,
0, 0, xdim - 1, ydim - 1);
x = MINI_BAR_AMMO_BOX_X+3;
DisplayMiniBarNumber(x, y+5, pp->WpnAmmo[u->WeaponNum]);
}
if (!pp->InventoryAmount[pp->InventoryNum])
return;
// Inventory Box
x = MINI_BAR_INVENTORY_BOX_X;
rotatesprite(x << 16, y << 16, (1 << 16), 0,
MINI_BAR_INVENTORY_BOX_PIC, 0, 0,
ROTATE_SPRITE_SCREEN_CLIP | ROTATE_SPRITE_CORNER | RS_ALIGN_L,
0, 0, xdim - 1, ydim - 1);
id = &InventoryData[pp->InventoryNum];
// Inventory pic
x = MINI_BAR_INVENTORY_BOX_X + 2;
y += 2;
rotatesprite(x << 16, y << 16, (1 << 16), 0,
id->State->picndx, 0, 0,
ROTATE_SPRITE_SCREEN_CLIP | ROTATE_SPRITE_CORNER | RS_ALIGN_L,
0, 0, xdim - 1, ydim - 1);
// will update the AUTO and % inventory values
PlayerUpdateInventory(pp, pp->InventoryNum);
}
void PanelInvTestSuicide(PANEL_SPRITEp psp)
{
if (TEST(psp->flags, PANF_SUICIDE))

View File

@ -55,7 +55,6 @@ extern INVENTORY_DATA InventoryData[MAX_INVENTORY+1];
#define INVF_COUNT (BIT(2))
void PlayerUpdateInventory(PLAYERp pp,short InventoryNum);
void UpdateMiniBar(PLAYERp pp);
void InventoryKeys(PLAYERp pp);
void UseInventoryRepairKit(PLAYERp pp);
void InventoryTimer(PLAYERp pp);

View File

@ -84,6 +84,8 @@ class DSWStatusBar : public DBaseStatusBar
INVENTORY_STATE_YOFF = 1,
MINI_BAR_Y = 174 ,
MINI_BAR_HEALTH_BOX_X = 4,
MINI_BAR_AMMO_BOX_X = 32,
MINI_BAR_INVENTORY_BOX_X = 64,
MINI_BAR_INVENTORY_BOX_Y = MINI_BAR_Y,
@ -108,6 +110,10 @@ class DSWStatusBar : public DBaseStatusBar
PANEL_SKELKEY_BRONZE= 2458,
PANEL_SKELKEY_RED = 2459,
MINI_BAR_HEALTH_BOX_PIC = 2437,
MINI_BAR_AMMO_BOX_PIC = 2437,
MINI_BAR_INVENTORY_BOX_PIC = 2438,
};
//---------------------------------------------------------------------------
@ -637,7 +643,7 @@ class DSWStatusBar : public DBaseStatusBar
if (pp->InventoryAmount[pp->InventoryNum])
{
PlayerUpdateInventoryPic(pp, InventoryBoxX, InventoryBoxY, InventoryXoff, InventoryYoff);
PlayerUpdateInventoryPic(pp, InventoryBoxX, InventoryBoxY, InventoryXoff+1, InventoryYoff);
// Auto/On/Off
PlayerUpdateInventoryState(pp, InventoryBoxX, InventoryBoxY, InventoryXoff, InventoryYoff);
// Percent count/Item count
@ -645,6 +651,46 @@ class DSWStatusBar : public DBaseStatusBar
}
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void DrawHUD1()
{
BeginHUD(320, 200, 1);
auto pp = Player + screenpeek;
USERp u = User[pp->PlayerSprite];
int x, y;
INVENTORY_DATAp id;
x = MINI_BAR_HEALTH_BOX_X;
y = 200 - 26;
DrawGraphic(tileGetTexture(MINI_BAR_HEALTH_BOX_PIC), x, y, DI_ITEM_LEFT_TOP, 1, -1, -1, 1, 1);
x = MINI_BAR_HEALTH_BOX_X + 3;
DisplayMiniBarNumber(x, y + 5, u->Health);
if (u->WeaponNum != WPN_SWORD && u->WeaponNum != WPN_FIST)
{
x = MINI_BAR_AMMO_BOX_X;
DrawGraphic(tileGetTexture(MINI_BAR_AMMO_BOX_PIC), x, y, DI_ITEM_LEFT_TOP, 1, -1, -1, 1, 1);
x = MINI_BAR_AMMO_BOX_X + 3;
DisplayMiniBarNumber(x, y + 5, pp->WpnAmmo[u->WeaponNum]);
}
if (!pp->InventoryAmount[pp->InventoryNum])
return;
// Inventory Box
x = MINI_BAR_INVENTORY_BOX_X;
DrawGraphic(tileGetTexture(MINI_BAR_INVENTORY_BOX_PIC), x, y, DI_ITEM_LEFT_TOP, 1, -1, -1, 1, 1);
DisplayMinibarInventory(pp);
}
//---------------------------------------------------------------------------
//
@ -664,7 +710,7 @@ public:
}
else*/ if (gs.BorderNum == BORDER_MINI_BAR)
{
//DrawHUD1(nPalette);
DrawHUD1();
}
else
{