mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-22 11:22:18 -04:00
reset message widget at level transition
This commit is contained in:
parent
658f06b83a
commit
c4b806523e
@ -198,8 +198,8 @@ typedef struct sbe_widget_s
|
||||
|
||||
int height;
|
||||
|
||||
// message
|
||||
int duration;
|
||||
int duration_left;
|
||||
} sbe_widget_t;
|
||||
|
||||
struct sbarelem_s
|
||||
|
@ -1080,6 +1080,10 @@ static void ResetElem(sbarelem_t *elem)
|
||||
elem->subtype.number->oldvalue = -1;
|
||||
break;
|
||||
|
||||
case sbe_widget:
|
||||
elem->subtype.widget->duration_left = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -92,7 +92,6 @@ static void UpdateMessage(sbe_widget_t *widget, player_t *player)
|
||||
ST_ClearLines(widget);
|
||||
|
||||
static char string[120];
|
||||
static int duration_left;
|
||||
static boolean overwrite = true;
|
||||
static boolean messages_enabled = true;
|
||||
|
||||
@ -100,21 +99,21 @@ static void UpdateMessage(sbe_widget_t *widget, player_t *player)
|
||||
{
|
||||
if (message_string[0])
|
||||
{
|
||||
duration_left = widget->duration;
|
||||
widget->duration_left = widget->duration;
|
||||
M_StringCopy(string, message_string, sizeof(string));
|
||||
message_string[0] = '\0';
|
||||
overwrite = false;
|
||||
}
|
||||
else if (player->message && player->message[0] && overwrite)
|
||||
{
|
||||
duration_left = widget->duration;
|
||||
widget->duration_left = widget->duration;
|
||||
M_StringCopy(string, player->message, sizeof(string));
|
||||
player->message[0] = '\0';
|
||||
}
|
||||
else if (message_review)
|
||||
{
|
||||
message_review = false;
|
||||
duration_left = widget->duration;
|
||||
widget->duration_left = widget->duration;
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,14 +122,14 @@ static void UpdateMessage(sbe_widget_t *widget, player_t *player)
|
||||
messages_enabled = show_messages;
|
||||
}
|
||||
|
||||
if (duration_left == 0)
|
||||
if (widget->duration_left == 0)
|
||||
{
|
||||
overwrite = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ST_AddLine(widget, string);
|
||||
--duration_left;
|
||||
--widget->duration_left;
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,19 +143,18 @@ static void UpdateSecretMessage(sbe_widget_t *widget, player_t *player)
|
||||
}
|
||||
|
||||
static char string[80];
|
||||
static int duration_left;
|
||||
|
||||
if (player->secretmessage)
|
||||
{
|
||||
duration_left = widget->duration;
|
||||
widget->duration_left = widget->duration;
|
||||
M_StringCopy(string, player->secretmessage, sizeof(string));
|
||||
player->secretmessage = NULL;
|
||||
}
|
||||
|
||||
if (duration_left > 0)
|
||||
if (widget->duration_left > 0)
|
||||
{
|
||||
ST_AddLine(widget, string);
|
||||
--duration_left;
|
||||
--widget->duration_left;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user