Skip to content

Commit

Permalink
hudfragmessagecolors -> hudfragmessageforcecolors
Browse files Browse the repository at this point in the history
  • Loading branch information
sauerbraten committed Mar 11, 2021
1 parent b38a16b commit 799c52c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 18 deletions.
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,7 @@ a.k.a. Features
- `hudfragmessagescale`: size of the messages, between 0.0 and 1.0
- `hudfragmessagestackdir`: direction in which to stack old messages: -1 to stack upwards, 1 to stack downwards, 0 to stack towards the closes edge of the screen depending on `hudfragmessagey`
- `hudfragmessagefilter`: bitfield filter var (like confilter), e.g. 0x3800 shows all players' frags, suicides, and teamkills
- `hudfragmessagecolors`: when 1 (default), uses colored names, even in non-team modes:
- yellow: you (while playing)
- blue: your team or the player you're spectating
- red: anyone else
- `hudfragmessageforcecolors`: when 1 (default), uses colored names, even in non-team modes

You can easily configure the hud frag messages using the [improved menu](#menu) (options → hud → adjust hud frag messages).

Expand Down
14 changes: 7 additions & 7 deletions patches/hudfragmessages.patch
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ Index: src/fpsgame/fps.cpp
if(d==player1) conoutf(contype, "\f2%s got fragged by %s", dname, aname);
else conoutf(contype, "\f2%s fragged %s", aname, dname);
}
+ if(hudfragmessagecolors)
+ if(hudfragmessageforcecolors && !m_teammode)
+ {
+ if(h==player1 && actor==player1) aname = "\fs\f2you\fr";
+ else aname = colorname(actor, aname, actor==h ? "\fs\f1" : "\fs\f3", "\fr", NULL);
+ if(h==player1 && d==player1) dname = "\fs\f2you\fr";
+ else dname = colorname(d, dname, d==h ? "\fs\f1" : "\fs\f3", "\fr", NULL);
+ dname = colorname(d, NULL, d==h ? "\fs\f1" : "\fs\f3", "\fr", NULL);
+ aname = colorname(actor, NULL, actor==h ? "\fs\f1" : "\fs\f3", "\fr", NULL);
+ }
+ if(h==player1 && d==player1) dname = "\fs\f2you\fr";
+ if(h==player1 && actor==player1) aname = "\fs\f2you\fr";
+ if(d==actor) addfragmessage(contype, NULL, dname, HICON_TOKEN-HICON_FIST);
+ else addfragmessage(contype, aname, dname, d->lasthitpushgun);
deathstate(d);
Expand Down Expand Up @@ -95,7 +95,7 @@ Index: src/fpsgame/fragmessages.cpp
+ FVARP(hudfragmessagescale, 0.1f, 0.5f, 1.0f);
+ VARP(hudfragmessagestackdir, -1, 0, 1); // -1 = upwards, 1 = downwards
+ HVARP(hudfragmessagefilter, 0, 0x2800, 0x7FFFFFF); // default: own frags + teamkills
+ VARP(hudfragmessagecolors, 0, 1, 1);
+ VARP(hudfragmessageforcecolors, 0, 1, 1);
+
+ void addfragmessage(int contype, const char *aname, const char *vname, int gun)
+ {
Expand Down Expand Up @@ -185,7 +185,7 @@ Index: src/fpsgame/fragmessages.h
+
+ extern vector<fragmessage> fragmessages;
+ extern int hudfragmessages;
+ extern int hudfragmessagecolors;
+ extern int hudfragmessageforcecolors;
+ extern void addfragmessage(int contype, const char *aname, const char *vname, int gun);
+ extern void clearfragmessages();
+ extern void drawfragmessages(int w, int h);
Expand Down
10 changes: 5 additions & 5 deletions src/fpsgame/fps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,13 +506,13 @@ namespace game
if(d==player1) conoutf(contype, "\f2%s got fragged by %s", dname, aname);
else conoutf(contype, "\f2%s fragged %s", aname, dname);
}
if(hudfragmessagecolors)
if(hudfragmessageforcecolors && !m_teammode)
{
if(h==player1 && actor==player1) aname = "\fs\f2you\fr";
else aname = colorname(actor, aname, actor==h ? "\fs\f1" : "\fs\f3", "\fr", NULL);
if(h==player1 && d==player1) dname = "\fs\f2you\fr";
else dname = colorname(d, dname, d==h ? "\fs\f1" : "\fs\f3", "\fr", NULL);
dname = colorname(d, NULL, d==h ? "\fs\f1" : "\fs\f3", "\fr", NULL);
aname = colorname(actor, NULL, actor==h ? "\fs\f1" : "\fs\f3", "\fr", NULL);
}
if(h==player1 && d==player1) dname = "\fs\f2you\fr";
if(h==player1 && actor==player1) aname = "\fs\f2you\fr";
if(d==actor) addfragmessage(contype, NULL, dname, HICON_TOKEN-HICON_FIST);
else addfragmessage(contype, aname, dname, d->lasthitpushgun);
deathstate(d);
Expand Down
2 changes: 1 addition & 1 deletion src/fpsgame/fragmessages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace game {
FVARP(hudfragmessagescale, 0.1f, 0.5f, 1.0f);
VARP(hudfragmessagestackdir, -1, 0, 1); // -1 = upwards, 1 = downwards
HVARP(hudfragmessagefilter, 0, 0x2800, 0x7FFFFFF); // default: own frags + teamkills
VARP(hudfragmessagecolors, 0, 1, 1);
VARP(hudfragmessageforcecolors, 0, 1, 1);

void addfragmessage(int contype, const char *aname, const char *vname, int gun)
{
Expand Down
2 changes: 1 addition & 1 deletion src/fpsgame/fragmessages.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace game {

extern vector<fragmessage> fragmessages;
extern int hudfragmessages;
extern int hudfragmessagecolors;
extern int hudfragmessageforcecolors;
extern void addfragmessage(int contype, const char *aname, const char *vname, int gun);
extern void clearfragmessages();
extern void drawfragmessages(int w, int h);
Expand Down

0 comments on commit 799c52c

Please sign in to comment.