- status bar interface work.

This commit is contained in:
Christoph Oelckers 2021-05-13 19:48:27 +02:00
parent c716900a3c
commit 5a6121d424
7 changed files with 44 additions and 8 deletions

View file

@ -827,6 +827,7 @@ void CreateStatusBar()
}
StatusBar = static_cast<DBaseStatusBar*>(stbarclass->CreateNew());
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());

View file

@ -150,6 +150,7 @@ void NewGame(MapRecord* map, int skill, bool ns = false)
newGameStarted = true;
ShowIntermission(nullptr, map, nullptr, [=](bool) {
gi->NewGame(map, skill, ns);
ResetStatusBar();
});
}
@ -199,6 +200,7 @@ static void GameTicker()
gi->FreeLevelData();
gameaction = ga_level;
gi->NextLevel(g_nextmap, g_nextskill);
ResetStatusBar();
}
else
{
@ -211,6 +213,7 @@ static void GameTicker()
gi->FreeLevelData();
gameaction = ga_level;
gi->NextLevel(g_nextmap, g_nextskill);
ResetStatusBar();
break;
case ga_newgame:
@ -360,6 +363,7 @@ static void GameTicker()
gameupdatetime.Reset();
gameupdatetime.Clock();
gi->Ticker();
TickStatusBar();
levelTextTime--;
gameupdatetime.Unclock();
break;

View file

@ -147,5 +147,8 @@ void SerializeHud(FSerializer &arc);
extern int levelTextTime;
struct SummaryInfo;
void UpdateStatusBar(SummaryInfo* info);
void TickStatusBar();
void ResetStatusBar();
void InitStatusBar();
#endif /* __SBAR_H__ */

View file

@ -386,4 +386,32 @@ void UpdateStatusBar(SummaryInfo* info)
VMValue params[] = { StatusBar, info };
VMCall(func, params, 2, nullptr, 0);
}
}
}
void TickStatusBar()
{
IFVIRTUALPTRNAME(StatusBar, NAME_RazeStatusBar, Tick)
{
VMValue params[] = { StatusBar };
VMCall(func, params, 1, nullptr, 0);
}
}
void ResetStatusBar()
{
IFVIRTUALPTRNAME(StatusBar, NAME_RazeStatusBar, Reset)
{
VMValue params[] = { StatusBar };
VMCall(func, params, 1, nullptr, 0);
}
}
void InitStatusBar()
{
IFVIRTUALPTRNAME(StatusBar, NAME_RazeStatusBar, Init)
{
VMValue params[] = { StatusBar };
VMCall(func, params, 1, nullptr, 0);
}
}

View file

@ -1086,12 +1086,12 @@ void GameInterface::NewGame(MapRecord* map, int skill, bool)
ud.multimode = 1;
donewgame(map, skill);
enterlevel(map, 0);
enterlevel(map, 0);
if (isShareware() && ud.recstat != 2) FTA(QUOTE_F1HELP, &ps[myconnectindex]);
PlayerColorChanged();
inputState.ClearAllInput();
gameaction = ga_level;
PlayerColorChanged();
inputState.ClearAllInput();
gameaction = ga_level;
}
//---------------------------------------------------------------------------

View file

@ -30,7 +30,7 @@ class BloodStatusBar : RazeStatusBar
int team_score[2], team_ticker[2]; // placeholders for MP display
bool gBlueFlagDropped, gRedFlagDropped; // also placeholders until we know where MP will go.
void Init()
override void Init()
{
smallf = HUDFont.Create(SmallFont, 0, Mono_Off, 0, 0);
tinyf = HUDFont.Create(Font.FindFont("DIGIFONT"), 4, Mono_CellRight, 0, 0);

View file

@ -18,12 +18,12 @@ struct StatsPrintInfo
class RazeStatusBar : StatusBarCore
{
void Init()
virtual void Init()
{
SetSize(0, 320, 200);
}
virtual void Tick() {}
virtual void Reset() {}
virtual void UpdateStatusBar(SummaryInfo info) {}
void drawStatText(Font statFont, int x, int y, String text, double scale)