From 0eb7c166c0dc6848968a7162cb8cbc5dbfd56d4a Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Thu, 26 Jul 2012 09:19:01 -0300 Subject: [PATCH] Fix console blue messages --- modules/game_textmessage/textmessage.lua | 5 +++-- modules/gamelib/const.lua | 1 + src/otclient/const.h | 1 - src/otclient/effect.cpp | 9 +++++++-- src/otclient/effect.h | 4 ++++ 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/modules/game_textmessage/textmessage.lua b/modules/game_textmessage/textmessage.lua index dda14d67..77e2ac6f 100644 --- a/modules/game_textmessage/textmessage.lua +++ b/modules/game_textmessage/textmessage.lua @@ -23,7 +23,8 @@ MessageTypes = { [MessageModes.Loot] = MessageSettings.centerGreen, [MessageModes.Red] = MessageSettings.consoleRed, [MessageModes.Blue] = MessageSettings.consoleBlue, - [MessageModes.PrivateFrom] = MessageSettings.private + [MessageModes.PrivateFrom] = MessageSettings.consoleBlue, + [254] = MessageSettings.private } messagesPanel = nil @@ -91,6 +92,6 @@ end function onPrivateTalk(code, text, speaker, speakerlevel, statmentid) if Options.getOption('showPrivateMessagesOnScreen') then - displayMessage(code, speaker .. ':\n' .. text) + displayMessage(254, speaker .. ':\n' .. text) end end diff --git a/modules/gamelib/const.lua b/modules/gamelib/const.lua index 0e4704fa..3e9d294e 100644 --- a/modules/gamelib/const.lua +++ b/modules/gamelib/const.lua @@ -72,6 +72,7 @@ TextColors = { yellow = '#ffff00', --'#e6c832' green = '#00EB00', --'#3fbe32' lightblue = '#5ff7f7', + blue = '#9f9dfd', --blue1 = '#6e50dc', --blue2 = '#3264c8', --blue3 = '#0096c8', diff --git a/src/otclient/const.h b/src/otclient/const.h index fbbcd4c4..1339b89f 100644 --- a/src/otclient/const.h +++ b/src/otclient/const.h @@ -42,7 +42,6 @@ namespace Otc AWARE_Y_TOP_TILES = AWARE_Y_TILES/2 - 1, AWARE_Y_BOTTOM_TILES = AWARE_Y_TILES/2, - EFFECT_TICKS_PER_FRAME = 75, INVISIBLE_TICKS_PER_FRAME = 500, ITEM_TICKS_PER_FRAME = 500, ANIMATED_TEXT_DURATION = 1000, diff --git a/src/otclient/effect.cpp b/src/otclient/effect.cpp index 9ade6253..385fbb5b 100644 --- a/src/otclient/effect.cpp +++ b/src/otclient/effect.cpp @@ -31,17 +31,22 @@ void Effect::draw(const Point& dest, float scaleFactor, bool animate) int animationPhase = 0; if(animate) - animationPhase = std::min((int)(m_animationTimer.ticksElapsed() / Otc::EFFECT_TICKS_PER_FRAME), getAnimationPhases() - 1); + animationPhase = std::min((int)(m_animationTimer.ticksElapsed() / m_phaseDuration), getAnimationPhases() - 1); rawGetThingType()->draw(dest, scaleFactor, 0, 0, 0, 0, animationPhase); } void Effect::startAnimation() { m_animationTimer.restart(); + m_phaseDuration = EFFECT_TICKS_PER_FRAME; + + // hack to fix some animation phases duration, currently there is no better solution + if(m_id == 33) + m_phaseDuration *= 4; // schedule removal auto self = asEffect(); - g_dispatcher.scheduleEvent([self]() { g_map.removeThing(self); }, Otc::EFFECT_TICKS_PER_FRAME * getAnimationPhases()); + g_dispatcher.scheduleEvent([self]() { g_map.removeThing(self); }, m_phaseDuration * getAnimationPhases()); } void Effect::setId(uint32 id) diff --git a/src/otclient/effect.h b/src/otclient/effect.h index 047a3f5b..5b9d2888 100644 --- a/src/otclient/effect.h +++ b/src/otclient/effect.h @@ -30,6 +30,9 @@ // @bindclass class Effect : public Thing { + enum { + EFFECT_TICKS_PER_FRAME = 75 + }; public: void draw(const Point& dest, float scaleFactor, bool animate); @@ -46,6 +49,7 @@ public: private: Timer m_animationTimer; + uint m_phaseDuration; uint16 m_id; };