mirror of
https://github.com/ZDoom/Raze.git
synced 2025-05-30 17:01:03 +00:00
- ported Exhumed's status bar.
Not tested yet.
This commit is contained in:
parent
5a6121d424
commit
b71c725e3e
11 changed files with 997 additions and 30 deletions
|
@ -829,10 +829,10 @@ void CreateStatusBar()
|
|||
StatusBar->SetSize(0, 320, 200);
|
||||
InitStatusBar();
|
||||
// this is for comparing the scriptification with the C++ versions
|
||||
//stbarclass = PClass::FindClass("NativeBloodStatusBar");
|
||||
//StatusBar2 = static_cast<DBaseStatusBar*>(stbarclass->CreateNew());
|
||||
//StatusBar2->SetSize(0, 320, 200);
|
||||
//StatusBar2->Release();
|
||||
stbarclass = PClass::FindClass("NativeExhumedStatusBar");
|
||||
StatusBar2 = static_cast<DBaseStatusBar*>(stbarclass->CreateNew());
|
||||
StatusBar2->SetSize(0, 320, 200);
|
||||
StatusBar2->Release();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -203,17 +203,17 @@ static void cmd_Give(int player, uint8_t** stream, bool skip)
|
|||
if (buttons & kButtonCheatGuns) // LOBOCOP cheat
|
||||
{
|
||||
FillWeapons(player);
|
||||
if (player == myconnectindex) StatusMessage(150, GStrings("TXT_EX_WEAPONS"));
|
||||
if (player == myconnectindex) Printf(PRINT_NOTIFY, "%s\n", GStrings("TXT_EX_WEAPONS"));
|
||||
}
|
||||
if (buttons & kButtonCheatKeys) // LOBOPICK cheat
|
||||
{
|
||||
PlayerList[player].keys = 0xFFFF;
|
||||
if (player == myconnectindex) StatusMessage(150, GStrings("TXT_EX_KEYS"));
|
||||
if (player == myconnectindex) Printf(PRINT_NOTIFY, "%s\n", GStrings("TXT_EX_KEYS"));
|
||||
}
|
||||
if (buttons & kButtonCheatItems) // LOBOSWAG cheat
|
||||
{
|
||||
FillItems(player);
|
||||
if (player == myconnectindex) StatusMessage(150, GStrings("TXT_EX_ITEMS"));
|
||||
if (player == myconnectindex) Printf(PRINT_NOTIFY, "%s\n", GStrings("TXT_EX_ITEMS"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
x(Torch1, 338)
|
||||
x(Torch2, 350)
|
||||
x(TileRamsesGold, 590)
|
||||
x(TileRamsesWorkTile, 591)
|
||||
x(TileRamsesNormal, 592)
|
||||
x(TileStatusBar, 657)
|
||||
x(KeyIcon1, 675)
|
||||
x(KeyIcon2, 679)
|
||||
x(KeyIcon3, 683)
|
||||
x(KeyIcon4, 687)
|
||||
x(CrosshairTile, 1579)
|
||||
x(SkullJaw, 3437)
|
||||
x(PowerslaveLogo, 3442)
|
||||
|
|
|
@ -20,12 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
enum
|
||||
{
|
||||
kTorch1 = 338,
|
||||
kTorch2 = 350,
|
||||
kTileRamsesGold = 590,
|
||||
kTileRamsesWorkTile = 591,
|
||||
kTileRamsesNormal = 592,
|
||||
kTileStatusBar = 657,
|
||||
kTile985 = 985,
|
||||
kTile986 = 986,
|
||||
kTile3000 = 3000,
|
||||
|
|
|
@ -2760,4 +2760,54 @@ void SerializePlayer(FSerializer& arc)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, nHealth);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, nLives);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, nDouble);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, nInvisible);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, nTorch);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, field_2);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, nAction);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, nSprite);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, bIsMummified);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, invincibility);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, nAir);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, nSeq);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, nMaskAmount);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, keys);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, nMagic);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, nItem);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, items);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, nAmmo); // TODO - kMaxWeapons?
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, pad);
|
||||
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, nCurrentWeapon);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, field_3FOUR);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, bIsFiring);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, field_38);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, field_3A);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, field_3C);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, nRun);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, bPlayerPan);
|
||||
DEFINE_FIELD_X(ExhumedPlayer, Player, bLockPan);
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Exhumed, GetViewPlayer)
|
||||
{
|
||||
ACTION_RETURN_POINTER(&PlayerList[nLocalPlayer]);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_ExhumedPlayer, IsUnderwater)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(Player);
|
||||
auto nLocalPlayer = self - PlayerList;
|
||||
ACTION_RETURN_BOOL(SectFlag[nPlayerViewSect[nLocalPlayer]] & kSectUnderwater);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_ExhumedPlayer, GetAngle)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(Player);
|
||||
ACTION_RETURN_INT(sprite[self->nSprite].ang);
|
||||
}
|
||||
|
||||
|
||||
END_PS_NS
|
||||
|
|
|
@ -65,7 +65,7 @@ struct Player
|
|||
uint16_t keys;
|
||||
short nMagic;
|
||||
short nItem;
|
||||
char items[8];
|
||||
uint8_t items[8];
|
||||
short nAmmo[7]; // TODO - kMaxWeapons?
|
||||
short pad[2];
|
||||
|
||||
|
|
|
@ -47,9 +47,77 @@ void InitStatus()
|
|||
nStatusSeqOffset = SeqOffsets[kSeqStatus];
|
||||
}
|
||||
|
||||
class DExhumedStatusBar : public DBaseStatusBar
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// This is to hide the dirt from the script code.
|
||||
// These sequence arrays later need to be refactored
|
||||
// if this is ever supposed to become a useful feature,
|
||||
// so hide the dirty internals behind a handful of functions.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
struct ChunkFrame
|
||||
{
|
||||
DECLARE_CLASS(DExhumedStatusBar, DBaseStatusBar)
|
||||
FTextureID tex;
|
||||
int x, y;
|
||||
int flags;
|
||||
|
||||
void GetChunkFrame(int nFrameBase)
|
||||
{
|
||||
x = ChunkXpos[nFrameBase];
|
||||
y = ChunkYpos[nFrameBase];
|
||||
auto ttex = tileGetTexture(nFrameBase);
|
||||
if (ttex) tex = ttex->GetID();
|
||||
else tex.SetInvalid();
|
||||
flags = ChunkFlag[nFrameBase];
|
||||
}
|
||||
};
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_ChunkFrame, GetChunkFrame)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(ChunkFrame);
|
||||
PARAM_INT(index);
|
||||
self->GetChunkFrame(index);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Exhumed, GetStatusSequence)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_INT(nSequence);
|
||||
PARAM_INT(frameindex);
|
||||
|
||||
frameindex += SeqBase[nStatusSeqOffset + nSequence];
|
||||
if (numret > 0) ret[0].SetInt(FrameBase[frameindex]);
|
||||
if (numret > 1) ret[1].SetInt(FrameSize[frameindex]);
|
||||
return min(numret, 2);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Exhumed, MoveStatusSequence)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_INT(s1);
|
||||
PARAM_INT(s2);
|
||||
seq_MoveSequence(-1, nStatusSeqOffset + s1, s2);
|
||||
ACTION_RETURN_INT(SeqSize[nStatusSeqOffset + s1]);
|
||||
}
|
||||
|
||||
int SizeOfStatusSequence(int s1)
|
||||
{
|
||||
return SeqSize[nStatusSeqOffset + s1];
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_Exhumed, SizeOfStatusSequence, SizeOfStatusSequence)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_INT(s1);
|
||||
ACTION_RETURN_INT(SeqSize[nStatusSeqOffset + s1]);
|
||||
}
|
||||
|
||||
class DNativeExhumedStatusBar : public DBaseStatusBar
|
||||
{
|
||||
DECLARE_CLASS(DNativeExhumedStatusBar, DBaseStatusBar)
|
||||
HAS_OBJECT_POINTERS
|
||||
|
||||
TObjPtr<DHUDFont*> textfont, numberFont;
|
||||
|
@ -81,7 +149,7 @@ class DExhumedStatusBar : public DBaseStatusBar
|
|||
};
|
||||
|
||||
public:
|
||||
DExhumedStatusBar()
|
||||
DNativeExhumedStatusBar()
|
||||
{
|
||||
textfont = Create<DHUDFont>(SmallFont, 1, Off, 1, 1);
|
||||
numberFont = Create<DHUDFont>(BigFont, 0, Off, 1, 1);
|
||||
|
@ -505,12 +573,6 @@ private:
|
|||
}
|
||||
|
||||
DrawMulti();
|
||||
|
||||
if (nSnakeCam >= 0)
|
||||
{
|
||||
BeginHUD(320, 200, 1);
|
||||
SBar_DrawString(this, textfont, "S E R P E N T C A M", 0, 0, DI_TEXT_ALIGN_CENTER | DI_SCREEN_CENTER_TOP, CR_UNTRANSLATED, 1, -1, 0, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -898,8 +960,8 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_CLASS(DExhumedStatusBar, false, true)
|
||||
IMPLEMENT_POINTERS_START(DExhumedStatusBar)
|
||||
IMPLEMENT_CLASS(DNativeExhumedStatusBar, false, true)
|
||||
IMPLEMENT_POINTERS_START(DNativeExhumedStatusBar)
|
||||
IMPLEMENT_POINTER(textfont)
|
||||
IMPLEMENT_POINTER(numberFont)
|
||||
IMPLEMENT_POINTERS_END
|
||||
|
@ -928,7 +990,7 @@ void StatusMessage(int messageTime, const char* fmt, ...)
|
|||
va_end(ap);
|
||||
}
|
||||
|
||||
|
||||
CVAR(Bool, sb_native, false, 0)
|
||||
void DrawStatusBar()
|
||||
{
|
||||
if (nFreeze == 2) return; // Hide when Ramses is talking.
|
||||
|
@ -936,7 +998,21 @@ void DrawStatusBar()
|
|||
{
|
||||
UpdateFrame();
|
||||
}
|
||||
StatusBar->UpdateStatusBar();
|
||||
SummaryInfo info{};
|
||||
info.kills = nCreaturesKilled;
|
||||
info.maxkills = nCreaturesTotal;
|
||||
// got no secrets in the game
|
||||
info.time = Scale(PlayClock, 1000, 120);
|
||||
if (!sb_native) UpdateStatusBar(&info);
|
||||
else StatusBar2->UpdateStatusBar();
|
||||
|
||||
if (nSnakeCam >= 0)
|
||||
{
|
||||
const char* text = "S E R P E N T C A M";
|
||||
int width = SmallFont->StringWidth(text);
|
||||
DrawText(twod, SmallFont, CR_UNTRANSLATED, 160 - width / 2, 1, text, DTA_FullscreenScale, FSMode_Fit320x200, TAG_DONE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
END_PS_NS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue