- armor and key display.

This commit is contained in:
Christoph Oelckers 2020-08-13 21:14:01 +02:00
parent 188b2d2daa
commit eafaa56834
7 changed files with 80 additions and 137 deletions

View file

@ -278,7 +278,6 @@ bool ItemCheat(cheatseq_t* c)
}
WeaponCheat(c);
PlayerUpdateKeys(pp);
return true;
}
@ -383,7 +382,6 @@ bool KeyCheat(cheatseq_t* c)
}
}
}
PlayerUpdateKeys(pp);
PutStringInfo(pp, GStrings(str));
return true;
}
@ -403,7 +401,6 @@ bool KeysCheat(cheatseq_t* c)
p = &Player[pnum];
memset(p->HasKey, TRUE, sizeof(p->HasKey));
}
PlayerUpdateKeys(pp);
PutStringInfo(pp, GStrings(str));
return true;
}

View file

@ -56,7 +56,6 @@ inline int TEXT_INFO_LINE(int line) { return (TEXT_INFO_Y + ((line)*TEXT_INFO_YO
void DisplayMiniBarSmString(PLAYERp pp, short xs, short ys, short pal, const char* buffer);
void DisplaySmString(PLAYERp pp, short xs, short ys, short pal, const char* buffer);
void DisplayMiniBarNumber(short xs, short ys, int number);
void DisplayPanelNumber(PLAYERp pp, short xs, short ys, int number);
void PutStringInfo(PLAYERp pp, const char* string);
void PutStringInfoLine(PLAYERp pp, const char* string);
void PutStringInfoLine2(PLAYERp pp, const char* string);

View file

@ -485,13 +485,6 @@ void PlayerUpdateKills(PLAYERp pp, short value)
void PlayerUpdateArmor(PLAYERp pp, short value)
{
short x,y;
#define PANEL_ARMOR_BOX_X 56
#define PANEL_ARMOR_XOFF 2
#define PANEL_ARMOR_YOFF 4
#define ARMOR_ERASE 2401
if (Prediction)
return;
@ -504,100 +497,9 @@ void PlayerUpdateArmor(PLAYERp pp, short value)
pp->Armor = 100;
if (pp->Armor < 0)
pp->Armor = 0;
if (gs.BorderNum < BORDER_BAR || pp - Player != screenpeek)
return;
// erase old info
pSpawnFullScreenSprite(pp, ARMOR_ERASE, PRI_MID, PANEL_ARMOR_BOX_X, PANEL_BOX_Y);
x = PANEL_ARMOR_BOX_X + PANEL_ARMOR_XOFF;
y = PANEL_BOX_Y + PANEL_ARMOR_YOFF;
DisplayPanelNumber(pp, x, y, pp->Armor);
}
void PlayerUpdateKeys(PLAYERp pp)
{
#define PANEL_KEYS_BOX_X 276
#define PANEL_KEYS_XOFF 0
#define PANEL_KEYS_YOFF 2
#define KEYS_ERASE 2402
short x,y;
short row,col;
short i, xsize, ysize;
#define PANEL_KEY_RED 2392
#define PANEL_KEY_GREEN 2393
#define PANEL_KEY_BLUE 2394
#define PANEL_KEY_YELLOW 2395
#define PANEL_SKELKEY_GOLD 2448
#define PANEL_SKELKEY_SILVER 2449
#define PANEL_SKELKEY_BRONZE 2458
#define PANEL_SKELKEY_RED 2459
static short StatusKeyPics[] =
{
PANEL_KEY_RED,
PANEL_KEY_BLUE,
PANEL_KEY_GREEN,
PANEL_KEY_YELLOW,
PANEL_SKELKEY_GOLD,
PANEL_SKELKEY_SILVER,
PANEL_SKELKEY_BRONZE,
PANEL_SKELKEY_RED
};
if (Prediction)
return;
if (gNet.MultiGameType == MULTI_GAME_COMMBAT)
return;
if (gs.BorderNum < BORDER_BAR || pp - Player != screenpeek)
return;
xsize = tilesiz[PANEL_KEY_RED].x+1;
ysize = tilesiz[PANEL_KEY_RED].y+2;
// erase old info
pSpawnFullScreenSprite(pp, KEYS_ERASE, PRI_MID, PANEL_KEYS_BOX_X, PANEL_BOX_Y);
i = 0;
for (row = 0; row < 2; row++)
{
for (col = 0; col < 2; col++)
{
if (pp->HasKey[i])
{
x = PANEL_KEYS_BOX_X + PANEL_KEYS_XOFF + (row * xsize);
y = PANEL_BOX_Y + PANEL_KEYS_YOFF + (col * ysize);
pSpawnFullScreenSprite(pp, StatusKeyPics[i], PRI_FRONT_MAX, x, y);
}
i++;
}
}
// Check for skeleton keys
i = 0;
for (row = 0; row < 2; row++)
{
for (col = 0; col < 2; col++)
{
if (pp->HasKey[i+4])
{
x = PANEL_KEYS_BOX_X + PANEL_KEYS_XOFF + (row * xsize);
y = PANEL_BOX_Y + PANEL_KEYS_YOFF + (col * ysize);
pSpawnFullScreenSprite(pp, StatusKeyPics[i+4], PRI_FRONT_MAX, x, y);
}
i++;
}
}
}
void PlayerUpdatePanelInfo(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
@ -606,10 +508,6 @@ void PlayerUpdatePanelInfo(PLAYERp pp)
return;
PlayerUpdateInventory(pp, pp->InventoryNum);
PlayerUpdateAmmo(pp, u->WeaponNum, 0);
PlayerUpdateWeapon(pp, u->WeaponNum);
PlayerUpdateKeys(pp);
PlayerUpdateArmor(pp, 0);
}
int WeaponOperate(PLAYERp pp)

View file

@ -192,7 +192,6 @@ SWBOOL pKillScreenSpiteIDs(PLAYERp pp, short id);
void pFlushPerms(PLAYERp pp);
void PreUpdatePanel(void);
void UpdatePanel(void);
void PlayerUpdateKeys(PLAYERp pp);
void PlayerUpdateArmor(PLAYERp pp,short value);
void pToggleCrosshair(void);
void pKillSprite(PANEL_SPRITEp psp);

View file

@ -65,8 +65,11 @@ class DSWStatusBar : public DBaseStatusBar
PANEL_KEYS_XOFF = 0,
PANEL_KEYS_YOFF = 2,
FRAG_YOFF = 2,
PANEL_ARMOR_BOX_X = 56,
PANEL_ARMOR_XOFF = 2,
PANEL_ARMOR_YOFF = 4,
FRAG_YOFF = 2,
};
enum
@ -79,6 +82,15 @@ class DSWStatusBar : public DBaseStatusBar
PANEL_SM_FONT_Y = 3613,
PANEL_SM_FONT_R = 3625,
PANEL_KEY_RED = 2392,
PANEL_KEY_GREEN = 2393,
PANEL_KEY_BLUE = 2394,
PANEL_KEY_YELLOW = 2395,
PANEL_SKELKEY_GOLD = 2448,
PANEL_SKELKEY_SILVER= 2449,
PANEL_SKELKEY_BRONZE= 2458,
PANEL_SKELKEY_RED = 2459,
};
//---------------------------------------------------------------------------
@ -155,9 +167,6 @@ class DSWStatusBar : public DBaseStatusBar
void DisplayTimeLimit(PLAYERp pp)
{
if (gNet.MultiGameType != MULTI_GAME_COMMBAT || !gNet.TimeLimit)
return;
int seconds = gNet.TimeLimitClock / 120;
sprintf(ds, "%03d:%02d", seconds / 60, seconds % 60);
DisplaySummaryString(PANEL_KEYS_BOX_X + 1, PANEL_BOX_Y + 6, 0, 0, ds);
@ -259,9 +268,6 @@ class DSWStatusBar : public DBaseStatusBar
}
}
//---------------------------------------------------------------------------
//
//
@ -330,6 +336,67 @@ class DSWStatusBar : public DBaseStatusBar
}
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void DisplayKeys(PLAYERp pp)
{
double x, y;
int row, col;
int i, xsize, ysize;
static short StatusKeyPics[] =
{
PANEL_KEY_RED,
PANEL_KEY_BLUE,
PANEL_KEY_GREEN,
PANEL_KEY_YELLOW,
PANEL_SKELKEY_GOLD,
PANEL_SKELKEY_SILVER,
PANEL_SKELKEY_BRONZE,
PANEL_SKELKEY_RED
};
xsize = tilesiz[PANEL_KEY_RED].x + 1;
ysize = tilesiz[PANEL_KEY_RED].y + 2;
i = 0;
for (row = 0; row < 2; row++)
{
for (col = 0; col < 2; col++)
{
if (pp->HasKey[i])
{
x = PANEL_KEYS_BOX_X + PANEL_KEYS_XOFF + (row * xsize);
y = PANEL_BOX_Y + PANEL_KEYS_YOFF + (col * ysize);
DrawGraphic(tileGetTexture(StatusKeyPics[i]), x, y, DI_ITEM_LEFT_TOP, 1, -1, -1, 1, 1);
}
i++;
}
}
// Check for skeleton keys
i = 0;
for (row = 0; row < 2; row++)
{
for (col = 0; col < 2; col++)
{
if (pp->HasKey[i + 4])
{
x = PANEL_KEYS_BOX_X + PANEL_KEYS_XOFF + (row * xsize);
y = PANEL_BOX_Y + PANEL_KEYS_YOFF + (col * ysize);
DrawGraphic(tileGetTexture(StatusKeyPics[i + 4]), x, y, DI_ITEM_LEFT_TOP, 1, -1, -1, 1, 1);
}
i++;
}
}
}
void DrawStatusBar()
{
@ -339,8 +406,14 @@ class DSWStatusBar : public DBaseStatusBar
DrawGraphic(tileGetTexture(STATUS_BAR), 0, 200, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, 1, 1);
DisplayPanelNumber(PANEL_HEALTH_BOX_X + PANEL_HEALTH_XOFF, PANEL_BOX_Y + PANEL_HEALTH_YOFF, u->Health);
DisplayPanelNumber(PANEL_ARMOR_BOX_X + PANEL_ARMOR_XOFF, PANEL_BOX_Y + PANEL_ARMOR_YOFF, pp->Armor);
DisplayPanelNumber(PANEL_AMMO_BOX_X + PANEL_AMMO_XOFF, PANEL_BOX_Y + PANEL_AMMO_YOFF, pp->WpnAmmo[u->WeaponNum]);
PlayerUpdateWeaponSummaryAll(pp);
if (gNet.MultiGameType != MULTI_GAME_COMMBAT)
DisplayKeys(pp);
else if (gNet.TimeLimit)
DisplayTimeLimit(pp);
}

View file

@ -5660,7 +5660,6 @@ KeyMain:
SetFadeAmt(pp,ITEMFLASHAMT,ITEMFLASHCLR); // Flash blue on item pickup
if (pp == Player+myconnectindex)
PlaySound(DIGI_KEY, sp, v3df_dontpan);
PlayerUpdateKeys(pp);
// don't kill keys in coop
if (gNet.MultiGameType == MULTI_GAME_COOPERATIVE)

View file

@ -179,28 +179,6 @@ PANEL_SPRITEp pClearSpriteID(PLAYERp pp, short id)
}
void DisplayPanelNumber(PLAYERp pp, short xs, short ys, int number)
{
char buffer[32];
char *ptr;
short x, size;
sprintf(buffer, "%03d", number);
for (ptr = buffer, x = xs; *ptr; ptr++, x += size)
{
if (!isdigit(*ptr))
{
size = 0;
continue;
}
pSpawnFullScreenSprite(pp, PANEL_FONT_G + (*ptr - '0'), PRI_FRONT_MAX, x, ys);
size = tilesiz[PANEL_FONT_G + (*ptr - '0')].x + 1;
}
}
void
DisplayMiniBarNumber(short xs, short ys, int number)
{