mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 12:31:54 +00:00
Display Z button
This commit is contained in:
parent
764010b3ab
commit
71e068a8b6
2 changed files with 32 additions and 13 deletions
|
|
@ -26,6 +26,7 @@
|
||||||
#include "r_skins.h"
|
#include "r_skins.h"
|
||||||
#include "s_sound.h"
|
#include "s_sound.h"
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
|
#include "k_hud.h"
|
||||||
|
|
||||||
#include "v_draw.hpp"
|
#include "v_draw.hpp"
|
||||||
|
|
||||||
|
|
@ -36,7 +37,6 @@ using srb2::Dialogue;
|
||||||
void Dialogue::Init(void)
|
void Dialogue::Init(void)
|
||||||
{
|
{
|
||||||
active = true;
|
active = true;
|
||||||
dismissable = false;
|
|
||||||
syllable = true;
|
syllable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -190,6 +190,19 @@ void Dialogue::WriteText(void)
|
||||||
textDone = (textTimer <= 0 && textDest.empty());
|
textDone = (textTimer <= 0 && textDest.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Dialogue::Held(void)
|
||||||
|
{
|
||||||
|
return ((players[serverplayer].cmd.buttons & BT_VOTE) == BT_VOTE);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Dialogue::Pressed(void)
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
((players[serverplayer].cmd.buttons & BT_VOTE) == BT_VOTE) &&
|
||||||
|
((players[serverplayer].oldcmd.buttons & BT_VOTE) == 0)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void Dialogue::CompleteText(void)
|
void Dialogue::CompleteText(void)
|
||||||
{
|
{
|
||||||
while (!textDest.empty())
|
while (!textDest.empty())
|
||||||
|
|
@ -235,12 +248,7 @@ void Dialogue::Tick(void)
|
||||||
|
|
||||||
if (Dismissable() == true)
|
if (Dismissable() == true)
|
||||||
{
|
{
|
||||||
bool pressed = (
|
if (Pressed() == true)
|
||||||
((players[serverplayer].cmd.buttons & BT_VOTE) == BT_VOTE) &&
|
|
||||||
((players[serverplayer].oldcmd.buttons & BT_VOTE) == 0)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (pressed == true)
|
|
||||||
{
|
{
|
||||||
if (TextDone())
|
if (TextDone())
|
||||||
{
|
{
|
||||||
|
|
@ -286,19 +294,27 @@ void Dialogue::Draw(void)
|
||||||
.font(srb2::Draw::Font::kConsole)
|
.font(srb2::Draw::Font::kConsole)
|
||||||
.text( text.c_str() );
|
.text( text.c_str() );
|
||||||
|
|
||||||
if (Dismissable() && TextDone() && Active())
|
if (Dismissable())
|
||||||
{
|
{
|
||||||
drawer
|
if (TextDone())
|
||||||
.xy(304, 7)
|
{
|
||||||
.patch("TUTDIAG2");
|
drawer
|
||||||
|
.xy(304, 7)
|
||||||
|
.patch("TUTDIAG2");
|
||||||
|
}
|
||||||
|
|
||||||
|
K_drawButton(
|
||||||
|
FloatToFixed(drawer.x() + 303),
|
||||||
|
FloatToFixed(drawer.y() + 39),
|
||||||
|
V_SNAPTOTOP,
|
||||||
|
kp_button_z[0], Held()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dialogue::Dismiss(void)
|
void Dialogue::Dismiss(void)
|
||||||
{
|
{
|
||||||
active = false;
|
active = false;
|
||||||
dismissable = false;
|
|
||||||
|
|
||||||
text.clear();
|
text.clear();
|
||||||
textDest.clear();
|
textDest.clear();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,9 @@ private:
|
||||||
void WriteText(void);
|
void WriteText(void);
|
||||||
void CompleteText(void);
|
void CompleteText(void);
|
||||||
|
|
||||||
|
bool Pressed(void);
|
||||||
|
bool Held(void);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static constexpr fixed_t kTextSpeedDefault = FRACUNIT;
|
static constexpr fixed_t kTextSpeedDefault = FRACUNIT;
|
||||||
static constexpr fixed_t kTextPunctPause = (FRACUNIT * TICRATE * 2) / 5;
|
static constexpr fixed_t kTextPunctPause = (FRACUNIT * TICRATE * 2) / 5;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue