mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
Fix (most) issues with status bar. Health markers and animations should now work. Air gauge still needs to be fixed.
This commit is contained in:
parent
5acd37d3ee
commit
1a01ee6130
3 changed files with 44 additions and 58 deletions
|
@ -270,7 +270,7 @@ void UseItem(short nPlayer, short nItem)
|
||||||
|
|
||||||
if (nPlayer == nLocalPlayer)
|
if (nPlayer == nLocalPlayer)
|
||||||
{
|
{
|
||||||
BuildStatusAnim(nItemCount * 2 + 156, 0);
|
BuildStatusAnim(156 + (nItemCount * 2), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!nItemCount)
|
if (!nItemCount)
|
||||||
|
|
|
@ -1604,6 +1604,7 @@ loc_1AB8E:
|
||||||
nBreathTimer[nPlayer] = 90;
|
nBreathTimer[nPlayer] = 90;
|
||||||
if (nPlayer == nLocalPlayer)
|
if (nPlayer == nLocalPlayer)
|
||||||
{
|
{
|
||||||
|
// animate lungs
|
||||||
BuildStatusAnim(132, 0);
|
BuildStatusAnim(132, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2113,7 +2114,7 @@ do_default_b:
|
||||||
nPlayerLives[nPlayer]++;
|
nPlayerLives[nPlayer]++;
|
||||||
|
|
||||||
if (nPlayer == nLocalPlayer) {
|
if (nPlayer == nLocalPlayer) {
|
||||||
BuildStatusAnim(((nPlayerLives[nPlayer] - 1) * 2) + 146, 0);
|
BuildStatusAnim(146 + ((nPlayerLives[nPlayer] - 1) * 2), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
var_8C = 32;
|
var_8C = 32;
|
||||||
|
|
|
@ -67,18 +67,18 @@ short nCounterBullet = -1;
|
||||||
// 8 bytes
|
// 8 bytes
|
||||||
struct statusAnim
|
struct statusAnim
|
||||||
{
|
{
|
||||||
short s1;
|
int16_t s1;
|
||||||
short s2;
|
int16_t s2;
|
||||||
int16_t nPage;
|
// int16_t nPage;
|
||||||
int8_t c1;
|
int8_t nPrevAnim;
|
||||||
int8_t c2;
|
int8_t nNextAnim;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define kMaxStatusAnims 50
|
#define kMaxStatusAnims 50
|
||||||
|
|
||||||
statusAnim StatusAnim[kMaxStatusAnims];
|
statusAnim StatusAnim[kMaxStatusAnims];
|
||||||
uint8_t StatusAnimsFree[kMaxStatusAnims];
|
uint8_t StatusAnimsFree[kMaxStatusAnims];
|
||||||
char StatusAnimFlags[kMaxStatusAnims];
|
uint8_t StatusAnimFlags[kMaxStatusAnims];
|
||||||
|
|
||||||
short nItemSeqOffset[] = {91, 72, 76, 79, 68, 87, 83};
|
short nItemSeqOffset[] = {91, 72, 76, 79, 68, 87, 83};
|
||||||
|
|
||||||
|
@ -88,10 +88,20 @@ int dword_9AD64[kMaxPlayers] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
void SetCounterDigits();
|
void SetCounterDigits();
|
||||||
void SetItemSeq();
|
void SetItemSeq();
|
||||||
void SetItemSeq2(int nSeqOffset);
|
void SetItemSeq2(int nSeqOffset);
|
||||||
|
void DestroyStatusAnim(short nAnim);
|
||||||
|
|
||||||
|
|
||||||
int BuildStatusAnim(int val, int nFlags)
|
int BuildStatusAnim(int val, int nFlags)
|
||||||
{
|
{
|
||||||
|
// destroy this anim if it already exists
|
||||||
|
for (int i = nFirstAnim; i >= 0; i = StatusAnim[i].nPrevAnim)
|
||||||
|
{
|
||||||
|
if (StatusAnim[i].s1 == val) {
|
||||||
|
DestroyStatusAnim(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (nAnimsFree <= 0) {
|
if (nAnimsFree <= 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -100,14 +110,14 @@ int BuildStatusAnim(int val, int nFlags)
|
||||||
|
|
||||||
uint8_t nStatusAnim = StatusAnimsFree[nAnimsFree];
|
uint8_t nStatusAnim = StatusAnimsFree[nAnimsFree];
|
||||||
|
|
||||||
StatusAnim[nStatusAnim].c1 = -1;
|
StatusAnim[nStatusAnim].nPrevAnim = -1;
|
||||||
StatusAnim[nStatusAnim].c2 = nLastAnim;
|
StatusAnim[nStatusAnim].nNextAnim = nLastAnim;
|
||||||
|
|
||||||
if (nLastAnim < 0) {
|
if (nLastAnim < 0) {
|
||||||
nFirstAnim = nStatusAnim;
|
nFirstAnim = nStatusAnim;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
StatusAnim[nLastAnim].c1 = nStatusAnim;
|
StatusAnim[nLastAnim].nPrevAnim = nStatusAnim;
|
||||||
}
|
}
|
||||||
|
|
||||||
nLastAnim = nStatusAnim;
|
nLastAnim = nStatusAnim;
|
||||||
|
@ -115,7 +125,7 @@ int BuildStatusAnim(int val, int nFlags)
|
||||||
StatusAnim[nStatusAnim].s1 = val;
|
StatusAnim[nStatusAnim].s1 = val;
|
||||||
StatusAnim[nStatusAnim].s2 = 0;
|
StatusAnim[nStatusAnim].s2 = 0;
|
||||||
StatusAnimFlags[nStatusAnim] = nFlags;
|
StatusAnimFlags[nStatusAnim] = nFlags;
|
||||||
StatusAnim[nStatusAnim].nPage = numpages;
|
// StatusAnim[nStatusAnim].nPage = numpages;
|
||||||
return nStatusAnim;
|
return nStatusAnim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +137,7 @@ void RefreshStatus()
|
||||||
}
|
}
|
||||||
|
|
||||||
// draws the red dots that indicate the lives amount
|
// draws the red dots that indicate the lives amount
|
||||||
BuildStatusAnim(2 * nLives + 145, 0);
|
BuildStatusAnim(145 + (2 * nLives), 0);
|
||||||
|
|
||||||
uint16_t nKeys = PlayerList[nLocalPlayer].keys;
|
uint16_t nKeys = PlayerList[nLocalPlayer].keys;
|
||||||
|
|
||||||
|
@ -189,9 +199,7 @@ void InitStatus()
|
||||||
|
|
||||||
void MoveStatusAnims()
|
void MoveStatusAnims()
|
||||||
{
|
{
|
||||||
// int16_t nAnim = nFirstAnim;
|
for (int i = nFirstAnim; i >= 0; i = StatusAnim[i].nPrevAnim)
|
||||||
|
|
||||||
for (int i = nFirstAnim; i >= 0; i = StatusAnim[i].c1)
|
|
||||||
{
|
{
|
||||||
seq_MoveSequence(-1, nStatusSeqOffset + StatusAnim[i].s1, StatusAnim[i].s2);
|
seq_MoveSequence(-1, nStatusSeqOffset + StatusAnim[i].s1, StatusAnim[i].s2);
|
||||||
|
|
||||||
|
@ -205,52 +213,31 @@ void MoveStatusAnims()
|
||||||
StatusAnim[i].s2 = 0;
|
StatusAnim[i].s2 = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
StatusAnim[i].s2 = nSize - 1;
|
StatusAnim[i].s2 = nSize - 1; // restart it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
while (nAnim != -1)
|
|
||||||
{
|
|
||||||
seq_MoveSequence(-1, nStatusSeqOffset + StatusAnim[nAnim].s1, StatusAnim[nAnim].s2);
|
|
||||||
|
|
||||||
StatusAnim[nAnim].s2++;
|
|
||||||
|
|
||||||
short nSize = SeqSize[nStatusSeqOffset + StatusAnim[nAnim].s1];
|
|
||||||
|
|
||||||
if (StatusAnim[nAnim].s2 >= nSize)
|
|
||||||
{
|
|
||||||
if (StatusAnimFlags[nAnim] & 0x10)
|
|
||||||
StatusAnim[nAnim].s2 = 0;
|
|
||||||
else
|
|
||||||
StatusAnim[nAnim].s2 = nSize - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
nAnim = StatusAnim[nAnim].c1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DestroyStatusAnim(short nAnim)
|
void DestroyStatusAnim(short nAnim)
|
||||||
{
|
{
|
||||||
short c1 = StatusAnim[nAnim].c1;
|
int8_t nPrev = StatusAnim[nAnim].nPrevAnim;
|
||||||
short c2 = StatusAnim[nAnim].c2;
|
int8_t nNext = StatusAnim[nAnim].nNextAnim;
|
||||||
|
|
||||||
if (c2 >= 0) {
|
if (nNext >= 0) {
|
||||||
StatusAnim[c2].c1 = c1;
|
StatusAnim[nNext].nPrevAnim = nPrev;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c1 >= 0) {
|
if (nPrev >= 0) {
|
||||||
StatusAnim[c1].c2 = c2;
|
StatusAnim[nPrev].nNextAnim = nNext;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nAnim == nFirstAnim) {
|
if (nAnim == nFirstAnim) {
|
||||||
nFirstAnim = c1;
|
nFirstAnim = nPrev;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nAnim == nLastAnim) {
|
if (nAnim == nLastAnim) {
|
||||||
nLastAnim = c2;
|
nLastAnim = nNext;
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusAnimsFree[nAnimsFree] = (uint8_t)nAnim;
|
StatusAnimsFree[nAnimsFree] = (uint8_t)nAnim;
|
||||||
|
@ -259,16 +246,13 @@ void DestroyStatusAnim(short nAnim)
|
||||||
|
|
||||||
void DrawStatusAnims()
|
void DrawStatusAnims()
|
||||||
{
|
{
|
||||||
int16_t nAnim = nFirstAnim;
|
for (int i = nFirstAnim; i >= 0; i = StatusAnim[i].nPrevAnim)
|
||||||
|
|
||||||
while (nAnim != -1)
|
|
||||||
{
|
{
|
||||||
int nextAnim = StatusAnim[nAnim].c1;
|
int nSequence = nStatusSeqOffset + StatusAnim[i].s1;
|
||||||
|
|
||||||
int nSequence = nStatusSeqOffset + StatusAnim[nAnim].s1;
|
seq_DrawStatusSequence(nSequence, StatusAnim[i].s2, 0);
|
||||||
|
|
||||||
seq_DrawStatusSequence(nSequence, StatusAnim[nAnim].s2, 0);
|
|
||||||
|
|
||||||
|
/*
|
||||||
if (StatusAnim[nAnim].s2 >= (SeqSize[nSequence] - 1))
|
if (StatusAnim[nAnim].s2 >= (SeqSize[nSequence] - 1))
|
||||||
{
|
{
|
||||||
if (!(StatusAnimFlags[nAnim] & 0x10))
|
if (!(StatusAnimFlags[nAnim] & 0x10))
|
||||||
|
@ -279,8 +263,7 @@ void DrawStatusAnims()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
nAnim = nextAnim;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,7 +385,7 @@ void SetPlayerItem(short nPlayer, short nItem)
|
||||||
{
|
{
|
||||||
SetItemSeq();
|
SetItemSeq();
|
||||||
if (nItem >= 0) {
|
if (nItem >= 0) {
|
||||||
BuildStatusAnim((2 * PlayerList[nLocalPlayer].items[nItem]) + 156, 0);
|
BuildStatusAnim(156 + (2 * PlayerList[nLocalPlayer].items[nItem]), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -705,16 +688,17 @@ void DrawStatus()
|
||||||
seq_DrawStatusSequence(nItemSeq + nStatusSeqOffset, nItemFrame, 0);
|
seq_DrawStatusSequence(nItemSeq + nStatusSeqOffset, nItemFrame, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// draws health level dots and other things
|
// draws health level dots, animates breathing lungs and other things
|
||||||
DrawStatusAnims();
|
DrawStatusAnims();
|
||||||
|
|
||||||
|
// draw the blue air level meter when underwater (but not responsible for animating the breathing lungs otherwise)
|
||||||
if (airpages)
|
if (airpages)
|
||||||
{
|
{
|
||||||
seq_DrawStatusSequence(nStatusSeqOffset + 133, airframe, 0);
|
seq_DrawStatusSequence(nStatusSeqOffset + 133, airframe, 0);
|
||||||
airpages--;
|
airpages--;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw compass
|
// draw compass
|
||||||
seq_DrawStatusSequence(nStatusSeqOffset + 35, ((inita + 128) & kAngleMask) >> 8, 0);
|
seq_DrawStatusSequence(nStatusSeqOffset + 35, ((inita + 128) & kAngleMask) >> 8, 0);
|
||||||
|
|
||||||
if (bCoordinates)
|
if (bCoordinates)
|
||||||
|
@ -723,6 +707,7 @@ void DrawStatus()
|
||||||
printext(xdim - 20, nViewTop, cFPS, kTile159, -1);
|
printext(xdim - 20, nViewTop, cFPS, kTile159, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// draw ammo count
|
||||||
seq_DrawStatusSequence(nStatusSeqOffset + 44, nDigit[2], 0);
|
seq_DrawStatusSequence(nStatusSeqOffset + 44, nDigit[2], 0);
|
||||||
seq_DrawStatusSequence(nStatusSeqOffset + 45, nDigit[1], 0);
|
seq_DrawStatusSequence(nStatusSeqOffset + 45, nDigit[1], 0);
|
||||||
seq_DrawStatusSequence(nStatusSeqOffset + 46, nDigit[0], 0);
|
seq_DrawStatusSequence(nStatusSeqOffset + 46, nDigit[0], 0);
|
||||||
|
|
Loading…
Reference in a new issue