mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-22 11:22:18 -04:00
if announce string is too long, draw author on next line (#2195)
* if announce string is too long, draw author on next line * fix redeclaration
This commit is contained in:
parent
2bf26395b8
commit
4faa2833f5
@ -80,7 +80,6 @@ void MN_BackSecondary(void);
|
|||||||
// [FG] alternative text for missing menu graphics lumps
|
// [FG] alternative text for missing menu graphics lumps
|
||||||
void MN_DrawTitle(int x, int y, const char *patch, const char *alttext);
|
void MN_DrawTitle(int x, int y, const char *patch, const char *alttext);
|
||||||
void MN_DrawStringCR(int cx, int cy, byte *cr1, byte *cr2, const char *ch);
|
void MN_DrawStringCR(int cx, int cy, byte *cr1, byte *cr2, const char *ch);
|
||||||
int MN_StringWidth(const char *string);
|
|
||||||
int MN_StringHeight(const char *string);
|
int MN_StringHeight(const char *string);
|
||||||
|
|
||||||
void MN_General(int choice);
|
void MN_General(int choice);
|
||||||
|
@ -100,6 +100,7 @@ void MN_InitMenuStrings(void);
|
|||||||
|
|
||||||
boolean MN_StartsWithMapIdentifier(char *str);
|
boolean MN_StartsWithMapIdentifier(char *str);
|
||||||
|
|
||||||
|
int MN_StringWidth(const char *string);
|
||||||
int MN_GetPixelWidth(const char *ch);
|
int MN_GetPixelWidth(const char *ch);
|
||||||
void MN_DrawString(int cx, int cy, int color, const char *ch);
|
void MN_DrawString(int cx, int cy, int color, const char *ch);
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include "m_config.h"
|
#include "m_config.h"
|
||||||
#include "m_input.h"
|
#include "m_input.h"
|
||||||
#include "m_misc.h"
|
#include "m_misc.h"
|
||||||
|
#include "mn_menu.h"
|
||||||
#include "p_mobj.h"
|
#include "p_mobj.h"
|
||||||
#include "p_spec.h"
|
#include "p_spec.h"
|
||||||
#include "r_main.h"
|
#include "r_main.h"
|
||||||
@ -132,7 +133,7 @@ static void UpdateMessage(sbe_widget_t *widget, player_t *player)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static char announce_string[HU_MAXLINELENGTH];
|
static char announce_string[HU_MAXLINELENGTH], author_string[HU_MAXLINELENGTH];
|
||||||
|
|
||||||
static void UpdateAnnounceMessage(sbe_widget_t *widget, player_t *player)
|
static void UpdateAnnounceMessage(sbe_widget_t *widget, player_t *player)
|
||||||
{
|
{
|
||||||
@ -162,6 +163,7 @@ static void UpdateAnnounceMessage(sbe_widget_t *widget, player_t *player)
|
|||||||
}
|
}
|
||||||
else if (player->secretmessage)
|
else if (player->secretmessage)
|
||||||
{
|
{
|
||||||
|
author_string[0] = '\0';
|
||||||
state = announce_secret;
|
state = announce_secret;
|
||||||
widget->duration_left = widget->duration;
|
widget->duration_left = widget->duration;
|
||||||
M_snprintf(string, sizeof(string), GOLD_S "%s" ORIG_S,
|
M_snprintf(string, sizeof(string), GOLD_S "%s" ORIG_S,
|
||||||
@ -172,6 +174,10 @@ static void UpdateAnnounceMessage(sbe_widget_t *widget, player_t *player)
|
|||||||
if (widget->duration_left > 0)
|
if (widget->duration_left > 0)
|
||||||
{
|
{
|
||||||
ST_AddLine(widget, string);
|
ST_AddLine(widget, string);
|
||||||
|
if (author_string[0])
|
||||||
|
{
|
||||||
|
ST_AddLine(widget, author_string);
|
||||||
|
}
|
||||||
--widget->duration_left;
|
--widget->duration_left;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -645,16 +651,23 @@ void ST_ResetTitle(void)
|
|||||||
'0' + hudcolor_titl, string);
|
'0' + hudcolor_titl, string);
|
||||||
|
|
||||||
announce_string[0] = '\0';
|
announce_string[0] = '\0';
|
||||||
|
author_string[0] = '\0';
|
||||||
if (hud_map_announce && leveltime == 0)
|
if (hud_map_announce && leveltime == 0)
|
||||||
{
|
{
|
||||||
if (gamemapinfo && gamemapinfo->author)
|
if (gamemapinfo && gamemapinfo->author)
|
||||||
{
|
{
|
||||||
M_snprintf(announce_string, sizeof(announce_string), "%s by %s",
|
M_snprintf(announce_string, sizeof(announce_string), "%s by %s",
|
||||||
string, gamemapinfo->author);
|
string, gamemapinfo->author);
|
||||||
|
if (MN_StringWidth(announce_string) > SCREENWIDTH)
|
||||||
|
{
|
||||||
|
M_StringCopy(announce_string, string, sizeof(announce_string));
|
||||||
|
M_snprintf(author_string, sizeof(author_string), "by %s",
|
||||||
|
gamemapinfo->author);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
M_snprintf(announce_string, sizeof(announce_string), "%s", string);
|
M_StringCopy(announce_string, string, sizeof(announce_string));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user