Author Topic: Bug: Fix code for displaying funnames  (Read 14091 times)

webhead

  • Committee Member
  • Autococker
  • Posts: 1185
Bug: Fix code for displaying funnames
« on: January 05, 2008, 07:36:03 PM »
Quote from: http://garrettw.net/public/featvote.txt
3: Fix funnames so they don't screw with other characters output after it, such as in the scoreboard. - webhead, T3RR0R15T, Termin8oR

add plz. ;)

jitspoe

  • Administrator
  • Autococker
  • Posts: 18802
Re: Bug: Fix code for displaying funnames
« Reply #1 on: January 05, 2008, 07:52:28 PM »
I think we just need to phase out the old scoreboard completely.

webhead

  • Committee Member
  • Autococker
  • Posts: 1185
Re: Bug: Fix code for displaying funnames
« Reply #2 on: January 05, 2008, 10:23:59 PM »
in favor of what?

jitspoe

  • Administrator
  • Autococker
  • Posts: 18802
Re: Bug: Fix code for displaying funnames
« Reply #3 on: January 05, 2008, 10:27:13 PM »
Just use the regular scoreboard (when you hit tab) at the end of the round instead of displaying the old one.  It just needs to be tweaked so it will stay up until the map change.

webhead

  • Committee Member
  • Autococker
  • Posts: 1185
Re: Bug: Fix code for displaying funnames
« Reply #4 on: January 05, 2008, 10:43:17 PM »
yah that sounds good. but i think there are also problems every once in a while with funnames messing with information text that shows up on the screen (and console). this usually involves italics and/or underlines affecting the entire line of text.

Zorchenhimer

  • Autococker
  • Posts: 2614
Re: Bug: Fix code for displaying funnames
« Reply #5 on: January 06, 2008, 12:27:36 AM »
Yea, I've seen that happen.

jitspoe

  • Administrator
  • Autococker
  • Posts: 18802

Herron

  • VM-68
  • Posts: 235
Re: Bug: Fix code for displaying funnames
« Reply #7 on: February 16, 2008, 03:20:30 PM »
Related to:
http://dplogin.com/forums/index.php?topic=11180.0

Bug:
When you use underline and/or italics in your name and do not:
   (1) terminate the underline/italics; or
   (2) use a char_endformat (ctrl+o) at the end of your name
it frequently messes up the formatting on the line of text appearing after your name (e.g., chat, scoreboard, event text).

Note:
Only the lines that have // herron format fix on them were changed, and the precise change is (listed in parentheses).  This does not fix the scoreboard that pops up at the end of the map, but it does fix the one that is brought up manually.

Fix:
1.  In cl_decode.h:
Code: [Select]
case 'n': // name
Q_strncpyz(out_str, name_from_index(index_array[current_element++]), max_len);
temp_len = strlen(out_str);
out_str[temp_len] = CHAR_ENDFORMAT; // herron format fix (new)
out_str += temp_len+1; // herron format fix (temp_len"+1")
max_len -= temp_len+1; // herron format fix (temp_len"+1")
break;
What it does:  Prevents underlined/italics in names from carrying over into event print messages (e.g., joins, grabs, kills, etc.)



2. In cl_scores.c:
Part A
Code: [Select]
if (len_noformat >= MAX_NAME_WIDTH) // name too long // herron format fix (">"=)
Part B
Code: [Select]
else if (format_diff)
{
// add spaces to compensate for format codes
memset(cl_scores_info[i]+len, ' ', MAX_NAME_WIDTH - len_noformat);
cl_scores_info[i][len] = CHAR_ENDFORMAT; // herron format fix (new)
cl_scores_info[i][MAX_NAME_WIDTH+format_diff+1] = '\0'; // herron format fix (format_diff"+1")
}
What it does:  Prevents underlined/italics in names from carrying over into other columns on the scoreboard (e.g., ping, kills, deaths, etc.)



3.  In cl_parse.c:
Code: [Select]
if (cl_timestamp->value)
Com_Printf("%c%c[%s] %c%s%s%s%c%c%c%s%s %s%s", // herron format fix (%s%s%s"%c")
CHAR_COLOR, isteam ? cl_scores_get_team_textcolor(idx) : COLOR_CHAT,
timestamp, cl_scores_get_team_splat(idx),
cl_scores_get_isalive(idx) ? "" : "[ELIM] ",
(isteam || isprivate) ? "(" : "", name_from_index(idx), CHAR_ENDFORMAT, // herron format fix ("CHAR_ENDFORMAT,")
CHAR_COLOR, isteam ? cl_scores_get_team_textcolor(idx) : COLOR_CHAT,
(isteam || isprivate) ? ")" : "",
level == PRINT_CHATN_ACTION ? "" : ":",
s, (s[strlen(s)-1] == '\n') ? "" : "\n");
else
Com_Printf("%c%c%c%s%s%s%c%c%c%s%s %s%s", cl_scores_get_team_splat(idx),
CHAR_COLOR, isteam ? cl_scores_get_team_textcolor(idx) : COLOR_CHAT,
cl_scores_get_isalive(idx) ? "" : "[ELIM] ", // jitodo - [OBS]
(isteam || isprivate) ? "(" : "", name_from_index(idx), CHAR_ENDFORMAT, // herron format fix ("CHAR_ENDFORMAT,")
CHAR_COLOR, isteam ? cl_scores_get_team_textcolor(idx) : COLOR_CHAT,
(isteam || isprivate) ? ")" : "",
level == PRINT_CHATN_ACTION ? "" : ":",
s, (s[strlen(s)-1] == '\n') ? "" : "\n");
What it does:  Prevents underlined/italics in names from carrying over into chat messages (e.g., say and say_team)


ViciouZ

  • Map Committee
  • Autococker
  • Posts: 2227
Re: Bug: Fix code for displaying funnames
« Reply #8 on: February 16, 2008, 03:33:43 PM »
Shreds talks to me in my sleep.

Not only is herron clever as hell at C, but he is also Andy Lewis Norm.

Herron

  • VM-68
  • Posts: 235
Re: Bug: Fix code for displaying funnames
« Reply #9 on: April 20, 2008, 10:51:53 AM »
 :'(

i_am_a_pirate

  • Autococker
  • Posts: 759
Re: Bug: Fix code for displaying funnames
« Reply #10 on: April 21, 2008, 03:15:11 PM »
it's quite cool (...kamikazee)

sk89q

  • Global Moderator
  • Autococker
  • Posts: 1049
Re: Bug: Fix code for displaying funnames
« Reply #11 on: April 29, 2008, 05:09:02 PM »
Can I add to this?

Can the length of a funname be calculated correctly so that it is drawn correctly? The invisible fun name characters cause lines to wrap too early and also sometimes causes extra spaces to appear.

jitspoe

  • Administrator
  • Autococker
  • Posts: 18802
Re: Bug: Fix code for displaying funnames
« Reply #12 on: April 30, 2008, 09:00:25 AM »
The way the console system works is basically one big buffer with no concept of lines.  It just draws X number of characters, then it's at the next line. I'll probably look into rewriting this system if/when I add a variable-width font.

i_am_a_pirate

  • Autococker
  • Posts: 759
Re: Bug: Fix code for displaying funnames
« Reply #13 on: May 02, 2008, 12:27:08 AM »
erm, that screen there. Is that a double bug? cos you're on the blue team, and you've just gone and picked up the flag and dropped it....

webhead

  • Committee Member
  • Autococker
  • Posts: 1185
Re: Bug: Fix code for displaying funnames
« Reply #14 on: May 02, 2008, 02:44:24 AM »
lol pirate, read the text at the top. he picked it up while he was on the red team.

Rick

  • Map Committee
  • Autococker
  • Posts: 2190
Re: Bug: Fix code for displaying funnames
« Reply #15 on: May 02, 2008, 03:26:58 AM »
Also look at the the bottom left, it indicates the dropping of a flag.

i_am_a_pirate

  • Autococker
  • Posts: 759
Re: Bug: Fix code for displaying funnames
« Reply #16 on: May 02, 2008, 06:05:44 AM »
Also look at the the bottom left, it indicates the dropping of a flag.
you've [...] dropped it....

lol pirate, read the text at the top. he picked it up while he was on the red team.

oops...... Man I'm bad today....
I don't really care about the whole fixing it. It makes it stand out more and looks cool. It isn't a major priority. Now a new physics engine is a completely different matter.....

webhead

  • Committee Member
  • Autococker
  • Posts: 1185
Re: Bug: Fix code for displaying funnames
« Reply #17 on: May 02, 2008, 08:32:00 AM »
lol youre crazy ;)
"stand out more"? uh as far as i know, thats not really the desired effect...
"looks cool"? well that's definitely subjective.

Garrett

  • Autococker
  • Posts: 1372
Re: Bug: Fix code for displaying funnames
« Reply #18 on: May 02, 2008, 08:40:55 AM »
oops...... Man I'm bad today....
I don't really care about the whole fixing it. It makes it stand out more and looks cool. It isn't a major priority. Now a new physics engine is a completely different matter.....
You have a very odd sense of cool.

i_am_a_pirate

  • Autococker
  • Posts: 759
Re: Bug: Fix code for displaying funnames
« Reply #19 on: May 02, 2008, 10:24:42 AM »
You have a very odd sense of cool.
Okay, okay. Maybe not cool. It just looks different.
Man I'm bad today....