Skip to content

Commit

Permalink
Issue #201: Show message when last player banner option disabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
pjbroad committed Mar 26, 2023
1 parent d13e624 commit 9277326
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
24 changes: 24 additions & 0 deletions actors.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,28 @@ static void set_food_color(float percent, float multiplier, float a)
set_banner_colour_general(zero_food, full_food, percent, multiplier, a);
}

static void check_for_banner_now_off(void)
{
static int banner_was_on = -1;
int banner_is_on = view_names||view_hp||view_health_bar||view_ether_bar||view_ether||view_food_bar||view_food;
if (banner_was_on == -1)
banner_was_on = banner_is_on;
else
{
if ((banner_was_on != banner_is_on) && (banner_is_on == 0))
{
char str[200];
char key_str[20];
str[0] = '\0';
safe_strcat(str, banner_off_help_str, sizeof(str));
safe_strcat(str, get_key_string(K_VIEWNAMES, key_str, sizeof(key_str)), sizeof(str));
safe_strcat(str, "].", sizeof(str));
LOG_TO_CONSOLE(c_red1, str);
}
banner_was_on = banner_is_on;
}
}

static void draw_actor_banner(actor *actor_id, const actor *me, float offset_z)
{
unsigned char str[60];
Expand Down Expand Up @@ -427,6 +449,8 @@ static void draw_actor_banner(actor *actor_id, const actor *me, float offset_z)
int display_ether_line = 0;
int display_food_line = 0;

check_for_banner_now_off();

if (displaying_me && first_person) return;

//if not drawing me, can't display ether/food or ether/food bar
Expand Down
2 changes: 2 additions & 0 deletions translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ char name_too_long[75],
commands_help_not_recognsed_str[40],
commands_help_description_help_str[100],
commands_help_search_help_str[100],
banner_off_help_str[100],
cmd_ignores[20],
cmd_ignore[20],
cmd_unignore[20],
Expand Down Expand Up @@ -1180,6 +1181,7 @@ void init_console()
add_xml_identifier(misc, "commands_help_not_recognsed", commands_help_not_recognsed_str, "Unrecognised command", sizeof(commands_help_not_recognsed_str));
add_xml_identifier(misc, "commands_help_description_help", commands_help_description_help_str, "For help on a particular command, use ## <command>.", sizeof(commands_help_description_help_str));
add_xml_identifier(misc, "commands_help_search_help", commands_help_search_help_str, "To search command name and description, use #? <search text>.", sizeof(commands_help_search_help_str));
add_xml_identifier(misc, "banner_off_help", banner_off_help_str, "Player banner off. To restore enable an option, e.g. names [", sizeof(banner_off_help_str));

add_xml_identifier(loading_msg,"init_opengl",init_opengl_str,"Initializing OpenGL extensions",sizeof(init_opengl_str));
add_xml_identifier(loading_msg,"init_random",init_random_str,"Generating random seed",sizeof(init_random_str));
Expand Down
1 change: 1 addition & 0 deletions translate.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ extern char
commands_help_not_recognsed_str[40],
commands_help_description_help_str[100],
commands_help_search_help_str[100],
banner_off_help_str[100],
cmd_ignores[20],
cmd_ignore[20],
cmd_unignore[20],
Expand Down

0 comments on commit 9277326

Please sign in to comment.