- Exhumed: made the status bar independent of static global state.

It will now perform all state change checks itself
This commit is contained in:
Christoph Oelckers 2021-05-13 18:48:42 +02:00
parent c9361aff76
commit 4e182ea5ee
7 changed files with 345 additions and 543 deletions

View file

@ -346,7 +346,7 @@ void GameInterface::Ticker()
break;
}
if (i > 0) SetPlayerItem(nLocalPlayer, nItem);
if (i > 0) PlayerList[nLocalPlayer].nItem = nItem;
}
if (localInput.actions & SB_INVNEXT)
@ -363,7 +363,7 @@ void GameInterface::Ticker()
break;
}
if (i > 0) SetPlayerItem(nLocalPlayer, nItem);
if (i > 0) PlayerList[nLocalPlayer].nItem = nItem;
}
if (localInput.actions & SB_INVUSE)

View file

@ -104,12 +104,6 @@ void FillWeapons(short nPlayer)
}
CheckClip(nPlayer);
if (nPlayer == nLocalPlayer)
{
short nWeapon = PlayerList[nPlayer].nCurrentWeapon;
SetCounter(PlayerList[nPlayer].nAmmo[nWeapon]);
}
}
void ResetPlayerWeapons(short nPlayer)
@ -172,20 +166,6 @@ void SetNewWeapon(short nPlayer, short nWeapon)
}
PlayerList[nPlayer].field_38 = nWeapon;
if (nPlayer == nLocalPlayer)
{
int nCounter;
if (nWeapon >= kWeaponSword && nWeapon <= kWeaponRing) {
nCounter = PlayerList[nPlayer].nAmmo[nWeapon];
}
else {
nCounter = 0;
}
SetCounterImmediate(nCounter);
}
}
void SetNewWeaponImmediate(short nPlayer, short nWeapon)

View file

@ -172,11 +172,10 @@ void FillItems(short nPlayer)
if (nPlayer == nLocalPlayer)
{
ItemFlash();
SetMagicFrame();
}
if (PlayerList[nPlayer].nItem == -1) {
SetPlayerItem(nPlayer, 0);
PlayerList[nPlayer].nItem = 0;
}
}
@ -232,7 +231,6 @@ bool UseHeart(short nPlayer)
if (nPlayer == nLocalPlayer)
{
ItemFlash();
SetHealthFrame(1);
D3PlayFX(StaticSound[kSound31], PlayerList[nPlayer].nSprite);
}
return true;
@ -300,11 +298,6 @@ void UseItem(short nPlayer, short nItem)
int nMagic = nItemMagic[nItem];
if (nPlayer == nLocalPlayer)
{
BuildStatusAnim(156 + (nItemCount * 2), 0);
}
if (!nItemCount)
{
for (nItem = 0; nItem < 6; nItem++)
@ -320,11 +313,7 @@ void UseItem(short nPlayer, short nItem)
}
PlayerList[nPlayer].nMagic -= nMagic;
SetPlayerItem(nPlayer, nItem);
if (nPlayer == nLocalPlayer) {
SetMagicFrame();
}
PlayerList[nPlayer].nItem = nItem;
}
// TODO - bool return type?
@ -337,7 +326,7 @@ int GrabItem(short nPlayer, short nItem)
PlayerList[nPlayer].items[nItem]++;
if (PlayerList[nPlayer].nItem < 0 || nItem == PlayerList[nPlayer].nItem) {
SetPlayerItem(nPlayer, nItem);
PlayerList[nPlayer].nItem = nItem;
}
return 1;

View file

@ -201,7 +201,6 @@ void MoveThings()
actortime.Unclock();
}
MoveStatus();
DoBubbleMachines();
DoDrips();
DoMovingSects();

View file

@ -416,7 +416,6 @@ void RestartPlayer(short nPlayer)
plr->field_3C = 0;
plr->nAir = 100;
airpages = 0;
if (!(currentLevel->gameflags & LEVEL_EX_MULTI))
{
@ -455,7 +454,6 @@ void RestartPlayer(short nPlayer)
{
nLocalSpr = nSprite;
SetMagicFrame();
RestoreGreenPal();
plr->bPlayerPan = plr->bLockPan = false;
@ -468,10 +466,6 @@ void RestartPlayer(short nPlayer)
nDeathType[nPlayer] = 0;
nQuake[nPlayer] = 0;
if (nPlayer == nLocalPlayer) {
SetHealthFrame(0);
}
}
int GrabPlayer()
@ -565,12 +559,6 @@ void StartDeathSeq(int nPlayer, int nVal)
if (nTotalPlayers == 1)
{
short nLives = nPlayerLives[nPlayer];
if (nLives > 0) {
BuildStatusAnim((3 * (nLives - 1)) + 7, 0);
}
if (!(currentLevel->gameflags & LEVEL_EX_TRAINING)) { // if not on the training level
nPlayerLives[nPlayer]--;
}
@ -749,7 +737,6 @@ void FuncPlayer(int a, int nDamage, int nRun)
if (nPlayer == nLocalPlayer)
{
TintPalette(nDamage, 0, 0);
SetHealthFrame(-1);
}
}
@ -1267,7 +1254,6 @@ sectdone:
// if underwater
if (var_5C)
{
airpages = 1;
if (PlayerList[nPlayer].nMaskAmount > 0)
{
D3PlayFX(StaticSound[kSound30], nPlayerSprite);
@ -1290,11 +1276,6 @@ sectdone:
StartDeathSeq(nPlayer, 0);
}
if (nPlayer == nLocalPlayer)
{
SetHealthFrame(-1);
}
PlayerList[nPlayer].nAir = 0;
if (PlayerList[nPlayer].nHealth < 300)
@ -1310,10 +1291,6 @@ sectdone:
DoBubbles(nPlayer);
}
else
{
airpages = 0;
}
}
}
@ -1349,8 +1326,6 @@ sectdone:
nBreathTimer[nPlayer] = 1;
}
airpages = 0;
nBreathTimer[nPlayer]--;
if (nBreathTimer[nPlayer] <= 0)
{
@ -1580,11 +1555,6 @@ do_default_b:
}
}
if (nLocalPlayer == nPlayer)
{
SetHealthFrame(1);
}
if (var_70 == 12)
{
sprite[nValB].hitag = 0;
@ -1654,11 +1624,6 @@ do_default_b:
}
}
if (nLocalPlayer == nPlayer)
{
SetHealthFrame(1);
}
if (var_70 == 12)
{
sprite[nValB].hitag = 0;
@ -1728,11 +1693,6 @@ do_default_b:
}
}
if (nLocalPlayer == nPlayer)
{
SetHealthFrame(1);
}
if (var_70 == 12)
{
sprite[nValB].hitag = 0;
@ -1858,10 +1818,6 @@ do_default_b:
nPlayerLives[nPlayer]++;
if (nPlayer == nLocalPlayer) {
BuildStatusAnim(146 + ((nPlayerLives[nPlayer] - 1) * 2), 0);
}
var_8C = 32;
var_44 = 32;
goto do_default;
@ -2299,11 +2255,6 @@ do_default_b:
PlayerList[nPlayer].nMagic = 1000;
}
if (nLocalPlayer == nPlayer)
{
SetMagicFrame();
}
goto do_default;
}

View file

@ -40,105 +40,11 @@ BEGIN_PS_NS
// All this must be moved into the status bar once it is made persistent!
const int kMaxStatusAnims = 50;
short nStatusSeqOffset;
short nHealthFrames;
short nMagicFrames;
short nHealthLevel;
short nMagicLevel;
short nHealthFrame;
short nMagicFrame;
short nMaskY;
int magicperline;
int healthperline;
int nCounter;
int nCounterDest;
short nItemFrames;
int16_t nItemSeq;
short nDigit[3];
short nItemFrame;
short nMeterRange;
int16_t nFirstAnim;
int16_t nLastAnim;
short nItemAltSeq;
short airpages = 0;
short ammodelay = 3;
short nCounterBullet = -1;
// 8 bytes
struct statusAnim
{
int16_t s1;
int16_t s2;
// int16_t nPage;
int8_t nPrevAnim;
int8_t nNextAnim;
uint8_t StatusAnimFlags;
};
FreeListArray<statusAnim, kMaxStatusAnims> StatusAnim;
short nItemSeqOffset[] = {91, 72, 76, 79, 68, 87, 83};
void SetCounterDigits();
void SetItemSeq();
void SetItemSeq2(int nSeqOffset);
void DestroyStatusAnim(short nAnim);
FSerializer& Serialize(FSerializer& arc, const char* keyname, statusAnim& w, statusAnim* def)
{
if (arc.BeginObject(keyname))
{
arc("s1", w.s1)
("s2", w.s2)
("prev", w.nPrevAnim)
("next", w.nNextAnim)
("flags", w.StatusAnimFlags)
.EndObject();
}
return arc;
}
void InitStatus()
{
nStatusSeqOffset = SeqOffsets[kSeqStatus];
nHealthFrames = SeqSize[nStatusSeqOffset + 1];
int nPicNum = seq_GetSeqPicnum(kSeqStatus, 1, 0);
nMagicFrames = SeqSize[nStatusSeqOffset + 129];
nHealthFrame = 0;
nMagicFrame = 0;
nHealthLevel = 0;
nMagicLevel = 0;
nMeterRange = tileHeight(nPicNum);
magicperline = 1000 / nMeterRange;
healthperline = 800 / nMeterRange;
nCounter = 0;
nCounterDest = 0;
memset(nDigit, 0, sizeof(nDigit));
SetCounter(0);
SetHealthFrame(0);
SetMagicFrame();
StatusAnim.Clear();
nLastAnim = -1;
nFirstAnim = -1;
nItemSeq = -1;
}
int ItemTimer(int num, int plr)
@ -159,334 +65,6 @@ int ItemTimer(int num, int plr)
return -1;
}
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;
}
}
int nStatusAnim = StatusAnim.Get();
StatusAnim[nStatusAnim].nPrevAnim = -1;
StatusAnim[nStatusAnim].nNextAnim = (int8_t)nLastAnim;
if (nLastAnim < 0) {
nFirstAnim = nStatusAnim;
}
else {
StatusAnim[nLastAnim].nPrevAnim = (int8_t)nStatusAnim;
}
nLastAnim = nStatusAnim;
StatusAnim[nStatusAnim].s1 = val;
StatusAnim[nStatusAnim].s2 = 0;
StatusAnim[nStatusAnim].StatusAnimFlags = nFlags;
return nStatusAnim;
}
void RefreshStatus()
{
short nLives = nPlayerLives[nLocalPlayer];
if (nLives < 0 || nLives > kMaxPlayerLives) {
//Error("illegal value for nPlayerLives #%d\n", nLocalPlayer);
nLives = 0;
}
// draws the red dots that indicate the lives amount
BuildStatusAnim(145 + (2 * nLives), 0);
uint16_t nKeys = PlayerList[nLocalPlayer].keys;
int val = 37;
SetPlayerItem(nLocalPlayer, PlayerList[nLocalPlayer].nItem);
SetHealthFrame(0);
SetMagicFrame();
}
void MoveStatusAnims()
{
for (int i = nFirstAnim; i >= 0; i = StatusAnim[i].nPrevAnim)
{
seq_MoveSequence(-1, nStatusSeqOffset + StatusAnim[i].s1, StatusAnim[i].s2);
StatusAnim[i].s2++;
short nSize = SeqSize[nStatusSeqOffset + StatusAnim[i].s1];
if (StatusAnim[i].s2 >= nSize)
{
if (StatusAnim[i].StatusAnimFlags & 0x10) {
StatusAnim[i].s2 = 0;
}
else {
StatusAnim[i].s2 = nSize - 1; // restart it
}
}
}
}
void DestroyStatusAnim(short nAnim)
{
int8_t nPrev = StatusAnim[nAnim].nPrevAnim;
int8_t nNext = StatusAnim[nAnim].nNextAnim;
if (nNext >= 0) {
StatusAnim[nNext].nPrevAnim = nPrev;
}
if (nPrev >= 0) {
StatusAnim[nPrev].nNextAnim = nNext;
}
if (nAnim == nFirstAnim) {
nFirstAnim = nPrev;
}
if (nAnim == nLastAnim) {
nLastAnim = nNext;
}
StatusAnim.Release(nAnim);
}
void SetMagicFrame()
{
nMagicLevel = (1000 - PlayerList[nLocalPlayer].nMagic) / magicperline;
if (nMagicLevel >= nMeterRange) {
nMagicLevel = nMeterRange - 1;
}
if (nMagicLevel < 0) {
nMagicLevel = 0;
}
SetItemSeq();
}
void SetHealthFrame(short nVal)
{
nHealthLevel = (800 - PlayerList[nLocalPlayer].nHealth) / healthperline;
if (nHealthLevel >= nMeterRange ) {
nHealthLevel = nMeterRange - 1;
}
if (nHealthLevel < 0) {
nHealthLevel = 0;
}
if (nVal < 0) {
BuildStatusAnim(4, 0);
}
}
void SetCounter(short nVal)
{
if (nVal <= 999)
{
if (nVal < 0) {
nVal = 0;
}
}
else {
nVal = 999;
}
nCounterDest = nVal;
}
void SetCounterImmediate(short nVal)
{
SetCounter(nVal);
nCounter = nCounterDest;
SetCounterDigits();
}
void SetCounterDigits()
{
nDigit[2] = 3 * (nCounter / 100 % 10);
nDigit[1] = 3 * (nCounter / 10 % 10);
nDigit[0] = 3 * (nCounter % 10);
}
void SetItemSeq()
{
short nItem = PlayerList[nLocalPlayer].nItem;
if (nItem < 0)
{
nItemSeq = -1;
return;
}
short nOffset = nItemSeqOffset[nItem];
SetItemSeq2(nOffset);
}
void SetItemSeq2(int nSeqOffset)
{
short nItem = PlayerList[nLocalPlayer].nItem;
if (nItemMagic[nItem] <= PlayerList[nLocalPlayer].nMagic) {
nItemAltSeq = 0;
}
else {
nItemAltSeq = 2;
}
nItemFrame = 0;
nItemSeq = nSeqOffset + nItemAltSeq;
nItemFrames = SeqSize[nItemSeq + nStatusSeqOffset];
}
void SetPlayerItem(short nPlayer, short nItem)
{
PlayerList[nLocalPlayer].nItem = nItem;
if (nPlayer == nLocalPlayer)
{
SetItemSeq();
if (nItem >= 0) {
BuildStatusAnim(156 + (2 * PlayerList[nLocalPlayer].items[nItem]), 0);
}
}
}
void MoveStatus()
{
if (nItemSeq >= 0)
{
nItemFrame++;
if (nItemFrame >= nItemFrames)
{
if (nItemSeq == 67) {
SetItemSeq();
}
else
{
nItemSeq -= nItemAltSeq;
if (nItemAltSeq || totalmoves & 0x1F)
{
if (nItemSeq < 2) {
nItemAltSeq = 0;
}
}
else
{
nItemAltSeq = 1;
}
nItemFrame = 0;
nItemSeq += nItemAltSeq;
nItemFrames = SeqSize[nStatusSeqOffset + nItemSeq];
}
}
}
nHealthFrame++;
if (nHealthFrame >= nHealthFrames) {
nHealthFrame = 0;
}
nMagicFrame++;
if (nMagicFrame >= nMagicFrames) {
nMagicFrame = 0;
}
MoveStatusAnims();
if (nCounter == nCounterDest)
{
nCounter = nCounterDest;
ammodelay = 3;
return;
}
else
{
ammodelay--;
if (ammodelay > 0) {
return;
}
}
int eax = nCounterDest - nCounter;
if (eax <= 0)
{
if (eax >= -30)
{
for (int i = 0; i < 3; i++)
{
nDigit[i]--;
if (nDigit[i] < 0)
{
nDigit[i] += 30;
}
if (nDigit[i] < 27) {
break;
}
}
}
else
{
nCounter += (nCounterDest - nCounter) >> 1;
SetCounterDigits();
return;
}
}
else
{
if (eax <= 30)
{
for (int i = 0; i < 3; i++)
{
nDigit[i]++;
if (nDigit[i] <= 27) {
break;
}
if (nDigit[i] >= 30) {
nDigit[i] -= 30;
}
}
}
else
{
nCounter += (nCounterDest - nCounter) >> 1;
SetCounterDigits();
return;
}
}
if (!(nDigit[0] % 3)) {
nCounter = nDigit[0] / 3 + 100 * (nDigit[2] / 3) + 10 * (nDigit[1] / 3);
}
eax = nCounterDest - nCounter;
if (eax < 0) {
eax = -eax;
}
ammodelay = 4 - (eax >> 1);
if (ammodelay < 1) {
ammodelay = 1;
}
}
class DExhumedStatusBar : public DBaseStatusBar
{
@ -497,6 +75,25 @@ class DExhumedStatusBar : public DBaseStatusBar
int keyanims[4];
int airframe, lungframe;
int nSelectedItem;
int nHealthLevel;
int nMagicLevel;
int nMeterRange;
int nHurt;
int nHealthFrame;
int nMagicFrame;
int nItemAltSeq;
int nItemSeq;
int nItemFrames;
int nItemFrame;
int nCounter;
int nCounterDest;
int nDigit[3];
int ammodelay;
int nLastWeapon;
enum EConst
{
KeySeq = 36,
@ -505,8 +102,26 @@ class DExhumedStatusBar : public DBaseStatusBar
public:
DExhumedStatusBar()
{
textfont = Create<DHUDFont>(SmallFont, 1, Off, 1, 1 );
numberFont = Create<DHUDFont>(BigFont, 0, Off, 1, 1 );
textfont = Create<DHUDFont>(SmallFont, 1, Off, 1, 1);
numberFont = Create<DHUDFont>(BigFont, 0, Off, 1, 1);
int nPicNum = seq_GetSeqPicnum(kSeqStatus, 1, 0);
nMeterRange = tileHeight(nPicNum);
Reset();
}
void Reset()
{
airframe = lungframe = nHurt = nHealthFrame = nMagicFrame = nItemAltSeq = nItemFrames = nItemFrame = nCounter = 0;
nDigit[0] = nDigit[1] = nDigit[2] = 0;
nHealthLevel = -1;
nMagicLevel = -1;
nSelectedItem = -1;
nItemSeq = -1;
ammodelay = 3;
nLastWeapon = -1;
SetCounter(0);
}
private:
@ -601,22 +216,6 @@ private:
return ChunkPict[nFrameBase];
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void DrawStatusAnims()
{
for (int i = nFirstAnim; i >= 0; i = StatusAnim[i].nPrevAnim)
{
int nSequence = nStatusSeqOffset + StatusAnim[i].s1;
DrawStatusSequence(nSequence, StatusAnim[i].s2, 0, 0);
}
}
//---------------------------------------------------------------------------
//
// Frag display - very ugly and may have to be redone if multiplayer support gets added.
@ -873,9 +472,6 @@ private:
DrawStatusSequence(nItemSeq + nStatusSeqOffset, nItemFrame, 1);
}
// draws health level dots, animates breathing lungs and other things
DrawStatusAnims();
// draw the blue air level meter when underwater
if (SectFlag[nPlayerViewSect[nLocalPlayer]] & kSectUnderwater)
{
@ -886,6 +482,16 @@ private:
DrawStatusSequence(nStatusSeqOffset + 132, lungframe, 0);
}
if (nSelectedItem >= 0)
{
int count = PlayerList[nLocalPlayer].items[nSelectedItem];
DrawStatusSequence(nStatusSeqOffset + 156 + 2* count, 0, 0);
}
short nLives = nPlayerLives[nLocalPlayer];
DrawStatusSequence(nStatusSeqOffset + 145 + (2 * nLives), 0, 0);
if (nHurt > 0) DrawStatusSequence(nStatusSeqOffset + 4, nHurt - 1, 0);
// draw compass
if (hud_size <= Hud_StbarOverlay) DrawStatusSequence(nStatusSeqOffset + 35, ((inita + 128) & kAngleMask) >> 8, 0, 0.5);
@ -943,9 +549,300 @@ private:
}
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void SetItemSeq()
{
static const int nItemSeqOffset[] = { 91, 72, 76, 79, 68, 87, 83 };
short nItem = PlayerList[nLocalPlayer].nItem;
if (nItem < 0)
{
nItemSeq = -1;
return;
}
if (nItemMagic[nItem] <= PlayerList[nLocalPlayer].nMagic) nItemAltSeq = 0;
else nItemAltSeq = 2;
nItemFrame = 0;
nItemSeq = nItemSeqOffset[nItem] + nItemAltSeq;
nItemFrames = SeqSize[nItemSeq + nStatusSeqOffset];
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void SetMagicFrame()
{
int magicperline = 1000 / nMeterRange;
int newMagicLevel = (1000 - PlayerList[nLocalPlayer].nMagic) / magicperline;
newMagicLevel = clamp(newMagicLevel, 0, nMeterRange - 1);
if (newMagicLevel != nMagicLevel) SetItemSeq();
nMagicLevel = newMagicLevel;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void SetHealthFrame()
{
if (nHurt)
{
nHurt++;
if (nHurt > SeqSize[nStatusSeqOffset + 4]) nHurt = 0;
}
int healthperline = 800 / nMeterRange;
int newHealthLevel = (800 - PlayerList[nLocalPlayer].nHealth) / healthperline;
newHealthLevel = clamp(newHealthLevel, 0, nMeterRange - 1);
if (newHealthLevel > nHealthLevel) nHurt = 1;
nHealthLevel = newHealthLevel;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void SetCounter(int nVal)
{
if (nVal <= 999)
{
if (nVal < 0) {
nVal = 0;
}
}
else {
nVal = 999;
}
nCounterDest = nVal;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void SetCounterImmediate(int nVal)
{
SetCounter(nVal);
nCounter = nCounterDest;
SetCounterDigits();
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void SetCounterDigits()
{
nDigit[2] = 3 * (nCounter / 100 % 10);
nDigit[1] = 3 * (nCounter / 10 % 10);
nDigit[0] = 3 * (nCounter % 10);
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void UpdateCounter()
{
int nWeapon = PlayerList[nLocalPlayer].nCurrentWeapon;
if (nWeapon < 0)
{
SetCounterImmediate(0);
}
else
{
int thiscount;
if (nWeapon >= kWeaponSword && nWeapon <= kWeaponRing)
thiscount = PlayerList[nLocalPlayer].nAmmo[nWeapon];
else
thiscount = 0;
if (nWeapon != nLastWeapon) SetCounterImmediate(thiscount);
else SetCounter(thiscount);
}
nLastWeapon = nWeapon;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void MoveStatus()
{
if (nItemSeq >= 0)
{
nItemFrame++;
if (nItemFrame >= nItemFrames)
{
if (nItemSeq == 67) {
SetItemSeq();
}
else
{
nItemSeq -= nItemAltSeq;
if (nItemAltSeq || totalmoves & 0x1F)
{
if (nItemSeq < 2) {
nItemAltSeq = 0;
}
}
else
{
nItemAltSeq = 1;
}
nItemFrame = 0;
nItemSeq += nItemAltSeq;
nItemFrames = SeqSize[nStatusSeqOffset + nItemSeq];
}
}
}
nHealthFrame++;
if (nHealthFrame >= SeqSize[nStatusSeqOffset + 1]) nHealthFrame = 0;
nMagicFrame++;
if (nMagicFrame >= SeqSize[nStatusSeqOffset + 129]) nMagicFrame = 0;
if (nCounter == nCounterDest)
{
nCounter = nCounterDest;
ammodelay = 3;
return;
}
else
{
ammodelay--;
if (ammodelay > 0) {
return;
}
}
int eax = nCounterDest - nCounter;
if (eax <= 0)
{
if (eax >= -30)
{
for (int i = 0; i < 3; i++)
{
nDigit[i]--;
if (nDigit[i] < 0)
{
nDigit[i] += 30;
}
if (nDigit[i] < 27) {
break;
}
}
}
else
{
nCounter += (nCounterDest - nCounter) >> 1;
SetCounterDigits();
return;
}
}
else
{
if (eax <= 30)
{
for (int i = 0; i < 3; i++)
{
nDigit[i]++;
if (nDigit[i] <= 27) {
break;
}
if (nDigit[i] >= 30) {
nDigit[i] -= 30;
}
}
}
else
{
nCounter += (nCounterDest - nCounter) >> 1;
SetCounterDigits();
return;
}
}
if (!(nDigit[0] % 3)) {
nCounter = nDigit[0] / 3 + 100 * (nDigit[2] / 3) + 10 * (nDigit[1] / 3);
}
eax = nCounterDest - nCounter;
if (eax < 0) {
eax = -eax;
}
ammodelay = 4 - (eax >> 1);
if (ammodelay < 1) {
ammodelay = 1;
}
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void SetPlayerItem()
{
if (nSelectedItem != PlayerList[nLocalPlayer].nItem)
{
nSelectedItem = PlayerList[nLocalPlayer].nItem;
SetItemSeq();
}
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void Tick() override
{
SetMagicFrame();
SetHealthFrame();
SetPlayerItem();
UpdateCounter();
MoveStatus();
for (int i = 0; i < 4; i++)
{
int seq = nStatusSeqOffset + KeySeq + 2 * i;

View file

@ -21,21 +21,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_PS_NS
extern short nMaskY;
extern short nCounterBullet;
extern short airpages;
void RefreshStatus();
void InitStatus();
void SetPlayerItem(short nPlayer, short nItem);
void SetMagicFrame();
void SetHealthFrame(short nVal);
void MoveStatus();
void DrawSnakeCamStatus();
void DrawStatus();
int BuildStatusAnim(int val, int nFlags);
void SetCounter(short nVal);
void SetCounterImmediate(short nVal);
END_PS_NS