All pastes #1964300 Raw Edit

Miscellany

public diff v1 · immutable
#1964300 ·published 2010-10-16 20:36 UTC
rendered paste body
From e210f79331d81fcea889361dc721c78e14006146 Mon Sep 17 00:00:00 2001From: Andrei Karas <akaras@inbox.ru>Date: Sat, 16 Oct 2010 23:22:55 +0300Subject: [PATCH] Add new three colors.Add colors:Local Player Hits MonsterLocal Player Critical HitLocal Player Miss--- src/being.cpp           |   23 ++++++++++++++++++++--- src/gui/userpalette.cpp |    9 +++++++++ src/gui/userpalette.h   |    3 +++ 3 files changed, 32 insertions(+), 3 deletions(-)diff --git a/src/being.cpp b/src/being.cppindex f2d95c4..be8afa7 100644--- a/src/being.cpp+++ b/src/being.cpp@@ -261,7 +261,15 @@ void Being::takeDamage(Being *attacker, int amount, AttackType type)     // Selecting the right color     if (type == CRITICAL || type == FLEE)     {-        color = &userPalette->getColor(UserPalette::HIT_CRITICAL);+        if (attacker == player_node)+        {+            color = &userPalette->getColor(+                UserPalette::HIT_LOCAL_PLAYER_CRITICAL);+        }+        else+        {+            color = &userPalette->getColor(UserPalette::HIT_CRITICAL);+        }     }     else if (!amount)     {@@ -269,7 +277,7 @@ void Being::takeDamage(Being *attacker, int amount, AttackType type)         {             // This is intended to be the wrong direction to visually             // differentiate between hits and misses-            color = &userPalette->getColor(UserPalette::HIT_MONSTER_PLAYER);+            color = &userPalette->getColor(UserPalette::HIT_LOCAL_PLAYER_MISS);         }         else         {@@ -278,7 +286,16 @@ void Being::takeDamage(Being *attacker, int amount, AttackType type)     }     else if (getType() == MONSTER)     {-        color = &userPalette->getColor(UserPalette::HIT_PLAYER_MONSTER);+        if (attacker == player_node)+        {+            color = &userPalette->getColor(+                UserPalette::HIT_LOCAL_PLAYER_MONSTER);+        }+        else+        {+            color = &userPalette->getColor(+                UserPalette::HIT_PLAYER_MONSTER);+        }     }     else     {diff --git a/src/gui/userpalette.cpp b/src/gui/userpalette.cppindex e5726ad..2b5b8a8 100644--- a/src/gui/userpalette.cpp+++ b/src/gui/userpalette.cpp@@ -47,6 +47,9 @@ const std::string ColorTypeNames[] = {     "ColorHitPlayerMonster",     "ColorHitMonsterPlayer",     "ColorHitCritical",+    "ColorHitLocalPlayerMonster",+    "ColorHitLocalPlayerCritical",+    "ColorHitLocalPlayerMiss",     "ColorMiss" }; @@ -99,6 +102,12 @@ UserPalette::UserPalette():     addColor(HIT_PLAYER_MONSTER, 0x0064ff, STATIC, _("Player Hits Monster"));     addColor(HIT_MONSTER_PLAYER, 0xff3232, STATIC, _("Monster Hits Player"));     addColor(HIT_CRITICAL, 0xff0000, RAINBOW, _("Critical Hit"));+    addColor(HIT_LOCAL_PLAYER_MONSTER, 0x00ff00, STATIC,+             _("Local Player Hits Monster"));+    addColor(HIT_LOCAL_PLAYER_CRITICAL, 0xff0000, RAINBOW,+             _("Local Player Critical Hit"));+    addColor(HIT_LOCAL_PLAYER_MISS, 0x00ffa6, STATIC,+             _("Local Player Miss"));     addColor(MISS, 0xffff00, STATIC, _("Misses"));     commit(true); }diff --git a/src/gui/userpalette.h b/src/gui/userpalette.hindex 82bcea1..be02db1 100644--- a/src/gui/userpalette.h+++ b/src/gui/userpalette.h@@ -49,6 +49,9 @@ class UserPalette : public Palette, public gcn::ListModel             HIT_PLAYER_MONSTER,             HIT_MONSTER_PLAYER,             HIT_CRITICAL,+            HIT_LOCAL_PLAYER_MONSTER,+            HIT_LOCAL_PLAYER_CRITICAL,+            HIT_LOCAL_PLAYER_MISS,             MISS,             USER_COLOR_LAST         };-- 1.7.2.3