From f1fdbd56e9cdb59fc1bc99c55deb3849b74170ad Mon Sep 17 00:00:00 2001 From: Nailson Date: Wed, 26 Aug 2015 19:49:43 -0300 Subject: [PATCH] Add a flag for idle animation game feature. --- modules/gamelib/const.lua | 1 + src/client/const.h | 1 + src/client/game.cpp | 4 ++++ src/client/thingtype.cpp | 12 +++++------- src/client/thingtype.h | 8 ++++---- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/modules/gamelib/const.lua b/modules/gamelib/const.lua index 2134760a..828579b5 100644 --- a/modules/gamelib/const.lua +++ b/modules/gamelib/const.lua @@ -131,6 +131,7 @@ GameAuthenticator = 67 GameUnjustifiedPoints = 68 GameSessionKey = 69 GameDeathType = 70 +GameIdleAnimations = 71 TextColors = { red = '#f55e5e', --'#c83200' diff --git a/src/client/const.h b/src/client/const.h index 54bd164f..d2d2c186 100644 --- a/src/client/const.h +++ b/src/client/const.h @@ -403,6 +403,7 @@ namespace Otc GameUnjustifiedPoints = 68, GameSessionKey = 69, GameDeathType = 70, + GameIdleAnimations = 71, LastGameFeature = 101 }; diff --git a/src/client/game.cpp b/src/client/game.cpp index dbe7bfc6..ff7d149b 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -1600,6 +1600,10 @@ void Game::setClientVersion(int version) enableFeature(Otc::GameDeathType); } + if(version >= 1057) { + enableFeature(Otc::GameIdleAnimations); + } + if(version >= 1061) { enableFeature(Otc::GameOGLInformation); } diff --git a/src/client/thingtype.cpp b/src/client/thingtype.cpp index 41fbf9d7..26215a95 100644 --- a/src/client/thingtype.cpp +++ b/src/client/thingtype.cpp @@ -268,15 +268,13 @@ void ThingType::unserialize(uint16 clientId, ThingCategory category, const FileS stdext::throw_exception(stdext::format("corrupt data (id: %d, category: %d, count: %d, lastAttr: %d)", m_id, m_category, count, attr)); - uint8 groupCount = 1; - if(category == ThingCategoryCreature && g_game.getClientVersion() >= 1057) - groupCount = fin->getU8(); + bool hasFrameGroups = (category == ThingCategoryCreature && g_game.getFeature(Otc::GameIdleAnimations)); + uint8 groupCount = hasFrameGroups ? fin->getU8() : 1; for(int i = 0; i < groupCount; ++i) { - uint8 frameGroup = FrameGroupDefault; - if(category == ThingCategoryCreature && g_game.getClientVersion() >= 1057) { - frameGroup = fin->getU8(); - } + uint8 frameGroupType = FrameGroupDefault; + if(hasFrameGroups) + frameGroupType = fin->getU8(); uint8 width = fin->getU8(); uint8 height = fin->getU8(); diff --git a/src/client/thingtype.h b/src/client/thingtype.h index fba57e9b..f3404483 100644 --- a/src/client/thingtype.h +++ b/src/client/thingtype.h @@ -33,10 +33,10 @@ #include #include -enum FrameGroup : uint8 { - FrameGroupIdle = 0, - FrameGroupMoving, - FrameGroupDefault = FrameGroupIdle +enum FrameGroupType : uint8 { + FrameGroupDefault = 0, + FrameGroupIdle = FrameGroupDefault, + FrameGroupMoving }; enum ThingCategory : uint8 {