Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upColored messages #7471
Conversation
added some commits
Apr 28, 2014
This comment has been minimized.
This comment has been minimized.
|
Nice work. Going through all those Some nitpicking: Why did you create so many
Btw. Also this branch does not have some of the recent changes like f1f2ae0 and e192341 - another thing that rebase can be used for - rebase is great tool. |
This comment has been minimized.
This comment has been minimized.
|
I've only had a chance to read the description so far, but this sounds like |
This comment has been minimized.
This comment has been minimized.
|
@BevapDin: Actually, there are not so many I fixed that stupid redundant code for I’ll look into rebase and the other redundant code at sometime. |
This comment has been minimized.
This comment has been minimized.
|
This will help with immersion in a big way. It was a lot of work...nice job! |
This comment has been minimized.
This comment has been minimized.
|
Wow, great! |
This comment has been minimized.
This comment has been minimized.
|
Always using m_neutral is good in that it makes it easier to find if |
This comment has been minimized.
This comment has been minimized.
|
May as well let people configure their colors; only objections I've got are potential colorblindness issues and having my message log get garish. But then I didn't think there needed to be a "mixed effect" mutation color, either. (Still don't.) |
This comment has been minimized.
This comment has been minimized.
|
I like it. @KA101 I think this will be better than the old scheme even for color-blind people, as the red-gray messages we're using now can be very problematic for people with red-green blindness. http://www.color-blindness.com/protanopia-red-green-color-blindness/ |
This comment has been minimized.
This comment has been minimized.
|
This is similar to @BevapDin unPR'ed message coloring that I've been using. |
kevingranade
reviewed
Apr 30, 2014
| @@ -11183,7 +11183,7 @@ void game::complete_butcher(int index) | |||
| if( corpse->has_flag(MF_CBM_CIV) ) { | |||
| //As long as the factor is above -4 (the sinew cutoff), you will be able to extract cbms | |||
| if( skill_shift >= 0 ) { | |||
| add_msg(_("You discover a CBM in the %s!"), corpse->name.c_str()); | |||
| add_msg(m_good, ("You discover a CBM in the %s!"), corpse->name.c_str()); | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
I'd actually prefer just to make the message type required and get rid of the old methods (or augment the old methods with the new parameter, whichever). |
This comment has been minimized.
This comment has been minimized.
|
@Wishbringer My code was terrible incomplete, I'm just to lazy to go through all the Loading color definitions from json is not difficult, an example is the ammo types to json: 3cd7ed6. Someone will do it, once this got merged. |
This comment has been minimized.
This comment has been minimized.
|
Damn it, sorry, people. I tried a rebase and then I totally screwed up my local reposity and I find myself unable to recover. I cloned my repo again from GitHub, now rebase requires me to go through 800 commits, most of them with conflicts in files I never touched. :-( It looks like it takes some time until I set up everything again. (I have to be more careful with git! Damn. Forgive me my clumsiness) |
This comment has been minimized.
This comment has been minimized.
|
I was strongly leaning toward merging soon and fixing up any issues anyway, |
Wuzzy2 commentedApr 29, 2014
This huge pull request adds message types. Different message types a colored differently in the message section of the sidebar and in the message log. Instead of new messages being red and a bit old messages being dark gray, new and and a bit older messages have a color depending on the mssage type. The aim is to improve usability.
Screenshot: https://i.imgur.com/HfawNIj.png
It follows a list of used colors and their meanings.
First color is for fresh messages, second color is for slightly older messages. Old messages are always dark gray.
Unused colors:
(If you have an idea for one more message type, I would happily include it, using these colors, but in a different pull request)
Here are the most important parts of this PR:
game_message_typefor the message types. It is documented inmessages.h. It is listed inENUMS.md.add_msg(and friends inmessages.cpp) with a new parametertype, of typegame_message_type.add_msg_if_player,add_msg_if_npc,add_msg_player_or_npc.add_msg(and wrappers) and assigning them a message type. This is the part which took the most work.add_msghas been intentionally overloaded, not rewritten. The old function without thetypeparameter still exists. The message will be then of the neutral type (m_neutral). This has been done for convenience reasons so you don’t have to supply thetypeevery time you calladd_msg.The special treatment for mutations works as this:
Determination of the proper message type if you just lose or gain a mutation is easy. If you gain a mutation, you get a “good” message if the mutation is good, a “bad” message if the mutation is bad, a “mixed” message if the mutation has
mixed_effect. Neutral mutations produce a "neutral" message. If you lose a mutation, good and bad messages are reversed. This is straightforward.The tricky part was to assign a message type if a mutation gets repaced. I have done it this way: Above all, if one of both mutations are mixed, the message is mixed. Period. If not, the points of the replacing mutation minus the points of the replaced mutation are compared. If the replacing mutation has more points, the message is positive, if it has less points, the message is negative. Otherwise it is neutral.
This behavior is different again if a natural trait is being replaced. Here the message is positive iff the replaced trait is bad and the replacing trait is good. This vise-versa produces a negative message. The message is neutral iff both traints are neutral, else the message is mixed. The two traits may be simply too different to surely be able to say “this is good/bad”, so better “play it safe” by using a “mixed” message more likely.
These methods to get the message type from mutation changes may seem strange, but so far they seem to work. But if you can find an example where the message color does not really fit the change, please say so!
There is one part of messages which is currently not coverd: Effects. This part seems to be in flux right now (probably port to JSON ongoing?), so I won’t touch this for now. Currently, all effects from JSON produce "neutral" messages, which is of course not always appropriate. You also see this in the screenshot (“You're blinded!”). I will try to tackle this after this PR is merged (it is big enough already!).
I took care I did not accidentally change any strings, but I have split a very few strings for style purposes, the additional load on translators is minimal.