When checking for redundant messages in HUD display, compare new message to most recent one for locking and check whole list only for messages marked with HM_REDUNDANT. This will show all messages in correct order while keeping redundancy-prone messages from looping infinitely

This commit is contained in:
zicodxx 2010-11-21 21:19:45 +01:00
parent 21d93e84de
commit be3b72b316
2 changed files with 16 additions and 10 deletions

View file

@ -4,6 +4,7 @@ D1X-Rebirth Changelog
--------
arch/sdl/jukebox.c, include/physfsx.h, main/menu.c, misc/physfsx.c: Created function PHYSFSX_isNewPath to check wether given path has already been added to Searchpath or not; Used PHYSFSX_isNewPath for menu browsing code instead it's own implementation; Using PHYSFSX_isNewPath for Jukebox directory, too to make sure Jukebox will not accidentially remove Game content depending on user selection; Also only keep Jukebox directory added until files are stored to prevent any other file present in this path can override or add anything to the game
main/config.c: For fresh configuration set Redbook music as default for Mac, Builtin music for all others
main/hud.c: When checking for redundant messages in HUD display, compare new message to most recent one for locking and check whole list only for messages marked with HM_REDUNDANT. This will show all messages in correct order while keeping redundancy-prone messages from looping infinitely
20101113
--------

View file

@ -110,7 +110,7 @@ void HUD_render_message_frame()
// Call to flash a message on the HUD. Returns true if message drawn.
// (message might not be drawn if previous message was same)
int HUD_init_message_va(char * format, va_list args)
int HUD_init_message_va(int class_flag, char * format, va_list args)
{
int i, j;
#ifndef macintosh
@ -125,16 +125,21 @@ int HUD_init_message_va(char * format, va_list args)
vsprintf(message, format, args);
#endif
// already in list - do not add again
for (i = 0; i < HUD_nmessages; i++)
// check if message is already in list and bail out if so
if (HUD_nmessages > 0)
{
if (!strnicmp(message, HUD_messages[i].message, sizeof(char)*HUD_MESSAGE_LENGTH))
// if "normal" message, only check if it's the same at the most recent one, if marked as "redundant" check whole list
for (i = ((class_flag & HM_REDUNDANT)?0:HUD_nmessages-1); i < HUD_nmessages; i++)
{
HUD_messages[i].time = F1_0*2; // keep redundant message in list
if (i >= HUD_nmessages-HUD_MAX_NUM_DISP) // if redundant message on display, update them all
for (i = (HUD_nmessages-HUD_MAX_NUM_DISP<0?0:HUD_nmessages-HUD_MAX_NUM_DISP), j = 1; i < HUD_nmessages; i++, j++)
HUD_messages[i].time = F1_0*(j*2);
return 0;
if (!strnicmp(message, HUD_messages[i].message, sizeof(char)*HUD_MESSAGE_LENGTH))
{
HUD_messages[i].time = F1_0*2; // keep redundant message in list
if (i >= HUD_nmessages-HUD_MAX_NUM_DISP) // if redundant message on display, update them all
for (i = (HUD_nmessages-HUD_MAX_NUM_DISP<0?0:HUD_nmessages-HUD_MAX_NUM_DISP), j = 1; i < HUD_nmessages; i++, j++)
HUD_messages[i].time = F1_0*(j*2);
return 0;
}
}
}
@ -189,7 +194,7 @@ int HUD_init_message(int class_flag, char * format, ... )
return 0;
va_start(args, format);
ret = HUD_init_message_va(format, args);
ret = HUD_init_message_va(class_flag, format, args);
va_end(args);
return ret;