From 59e90e8f1e7f980512225cf5512bdaf172f5f7ba Mon Sep 17 00:00:00 2001 From: dalkon Date: Wed, 13 Nov 2013 00:18:15 +0100 Subject: [PATCH 1/3] Item phases --- src/client/item.cpp | 19 +++++++++++++++---- src/client/item.h | 6 ++++++ src/client/protocolgameparse.cpp | 2 +- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/client/item.cpp b/src/client/item.cpp index 83dc3599..2c984f10 100644 --- a/src/client/item.cpp +++ b/src/client/item.cpp @@ -41,7 +41,10 @@ Item::Item() : m_clientId(0), m_serverId(0), m_countOrSubType(1), - m_color(Color::alpha) + m_color(Color::alpha), + m_async(true), + m_phase(0), + m_lastPhase(0) { } @@ -363,9 +366,17 @@ void Item::calculatePatterns(int& xPattern, int& yPattern, int& zPattern) int Item::calculateAnimationPhase(bool animate) { if(getAnimationPhases() > 1) { - if(animate) - return (g_clock.millis() % (Otc::ITEM_TICKS_PER_FRAME * getAnimationPhases())) / Otc::ITEM_TICKS_PER_FRAME; - else + if(animate) { + if(m_async) + return (g_clock.millis() % (Otc::ITEM_TICKS_PER_FRAME * getAnimationPhases())) / Otc::ITEM_TICKS_PER_FRAME; + else { + if(g_clock.millis() - m_lastPhase >= Otc::ITEM_TICKS_PER_FRAME) { + m_phase = (m_phase + 1) % getAnimationPhases(); + m_lastPhase = g_clock.millis(); + } + return m_phase; + } + } else return getAnimationPhases()-1; } return 0; diff --git a/src/client/item.h b/src/client/item.h index e5ad727e..cb145d2a 100644 --- a/src/client/item.h +++ b/src/client/item.h @@ -112,6 +112,8 @@ public: void setActionId(uint16 actionId) { m_attribs.set(ATTR_ACTION_ID, actionId); } void setUniqueId(uint16 uniqueId) { m_attribs.set(ATTR_UNIQUE_ID, uniqueId); } + void setAsync(bool enable) { m_async = enable; } + bool isHouseDoor() { return m_attribs.has(ATTR_HOUSEDOORID); } bool isDepot() { return m_attribs.has(ATTR_DEPOT_ID); } bool isContainer() { return m_attribs.has(ATTR_CONTAINER_ITEMS); } @@ -141,6 +143,10 @@ private: stdext::packed_storage m_attribs; ItemList m_containerItems; Color m_color; + bool m_async; + + uint8 m_phase; + ticks_t m_lastPhase; }; #pragma pack(pop) diff --git a/src/client/protocolgameparse.cpp b/src/client/protocolgameparse.cpp index f1af16d8..332598c8 100644 --- a/src/client/protocolgameparse.cpp +++ b/src/client/protocolgameparse.cpp @@ -2008,7 +2008,7 @@ ItemPtr ProtocolGame::getItem(const InputMessagePtr& msg, int id) if(item->getAnimationPhases() > 1) { // 0xfe => random phase // 0xff => async? - msg->getU8(); // phase + item->setAsync(msg->getU8() == 0xff); } } From 5b8ff29fa3ee958de5b3a5c7f396433d087960d9 Mon Sep 17 00:00:00 2001 From: dalkon Date: Wed, 13 Nov 2013 00:48:41 +0100 Subject: [PATCH 2/3] Fix party "bug" & Additions --- data/images/game/dangerous.png | Bin 0 -> 227 bytes data/images/game/emblems/emblem_member.png | Bin 0 -> 333 bytes data/images/game/emblems/emblem_other.png | Bin 0 -> 319 bytes data/images/game/shields/shield_gray.png | Bin 0 -> 330 bytes data/images/game/summon_other.png | Bin 0 -> 283 bytes data/images/game/summon_own.png | Bin 0 -> 283 bytes modules/gamelib/const.lua | 3 +++ modules/gamelib/creature.lua | 24 +++++++++++++-------- src/client/const.h | 7 ++++-- src/client/protocolcodes.h | 4 +++- 10 files changed, 26 insertions(+), 12 deletions(-) create mode 100644 data/images/game/dangerous.png create mode 100644 data/images/game/emblems/emblem_member.png create mode 100644 data/images/game/emblems/emblem_other.png create mode 100644 data/images/game/shields/shield_gray.png create mode 100644 data/images/game/summon_other.png create mode 100644 data/images/game/summon_own.png diff --git a/data/images/game/dangerous.png b/data/images/game/dangerous.png new file mode 100644 index 0000000000000000000000000000000000000000..c927c67f5b3767bad8cc801619161426c6d71958 GIT binary patch literal 227 zcmeAS@N?(olHy`uVBq!ia0vp^+#t-s1|(OmDOUqhEa{HEjtmSN`?>!lvI6;>1s;*b zKs7=j%y{W;-5;PJdx@v7EBhTrHc<_Ur~kwM1BIkYTq8;L|k?K3J`UsvAX)N%{& z2xh*~J3aTw0TT~lj^-ZF;i! OxeT7JelF{r5}E+`BSNkK literal 0 HcmV?d00001 diff --git a/data/images/game/emblems/emblem_member.png b/data/images/game/emblems/emblem_member.png new file mode 100644 index 0000000000000000000000000000000000000000..7af0ad97edad453a81e1b6211f931bac3a99b98e GIT binary patch literal 333 zcmeAS@N?(olHy`uVBq!ia0vp^+#t-s1|(OmDOUqhEa{HEjtmSN`?>!lvI6;>1s;*b zKs7=j%y{W;-5;PJdx@v7EBhTrHc=TtbxxTzKq09T*NBqf{Irtt#G+J&fW*wa5hJyShHL-)^4=0H{3JY5_^G=h^4F#dDSEHgYuBPs#OO_~zynmheQ(jDr?RdTY{J;O7C;t84(7<58cJi?3{#bPuGu{@* zu1S+7{X2gAc(dV&w({4l54#*6{NK&{DB-An8CSDtvq_`K{b-$zMFK1bCK+6IlyZ<* z^5buqsLxS_@!lvI6;>1s;*b zKs7=j%y{W;-5;PJdx@v7EBhTrHc=TtbxxTzKq09T*NBqf{Irtt#G+J&fW*wa5hJyShHL-)^4=0H^|JY5_^G=fVf9OP|L5O7_Yz#rYln!lvI6;>1s;*b zKs7=j%y{W;-5;PJdx@v7EBhTrHc?H{rcfznppaCFYeY$Kep*R+Vo@qXKw@TIiJqTp zh(ejMo~fRpq5EeibD*lto-U3d8o{L#Y`Izt1X_zjxfP=_Cx;2TuF>T=qBKGJi9phU-L99`3OsvWYs@3qUU0;GuH7b`_JVP|HRUq{o0Q93k2kUR_#B1 Tj`ay2(D@9Wu6{1-oD!M<&Hr`K literal 0 HcmV?d00001 diff --git a/data/images/game/summon_other.png b/data/images/game/summon_other.png new file mode 100644 index 0000000000000000000000000000000000000000..6f6fa60a762b131f6f636e402bd5203678f291c6 GIT binary patch literal 283 zcmeAS@N?(olHy`uVBq!ia0vp^+#t-s1|(OmDOUqhEa{HEjtmSN`?>!lvI6;>1s;*b zKs7=j%y{W;-5;PJdx@v7EBhTrHc?%D1yi=IKq09T*NBqf{Irtt#G+J&fW*wa5hJyShHL-)^4=0H^~o-U3d8o{-FfuaoxJgz?*<&7^i7#uTb>C{+xzg|tsQL(ma&-r)AwOhs962K zWul3JrMH1YY?Fssj<QyKFn`w3P|D?@1Yv$@N4PcZiW(W%? V>q=y;YzDfA!PC{xWt~$(698JGT(STF literal 0 HcmV?d00001 diff --git a/data/images/game/summon_own.png b/data/images/game/summon_own.png new file mode 100644 index 0000000000000000000000000000000000000000..0abcb94105c16f1e125a5d7ccfeab9609f094d9f GIT binary patch literal 283 zcmeAS@N?(olHy`uVBq!ia0vp^+#t-s1|(OmDOUqhEa{HEjtmSN`?>!lvI6;>1s;*b zKs7=j%y{W;-5;PJdx@v7EBhTrHc<_Ur~kwM1BIkYTq8PfyaVax|{Xs#l%xZ>H7F|C2W7teLC7G=Nd6n8Bf} WtgGP1m!m-UFnGH9xvX Date: Wed, 13 Nov 2013 00:50:46 +0100 Subject: [PATCH 3/3] Format fix --- src/client/const.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/const.h b/src/client/const.h index bea888d4..e9ad69ca 100644 --- a/src/client/const.h +++ b/src/client/const.h @@ -237,7 +237,7 @@ namespace Otc EmblemRed, EmblemBlue, EmblemMember, - EmblemOther + EmblemOther }; enum PlayerStates {