Merge pull request #680 from ottools/master

Add a flag for idle animation game feature.
This commit is contained in:
Konrad Kuśnierz 2015-08-28 10:07:14 +02:00
commit 1686d8081b
5 changed files with 15 additions and 11 deletions

View File

@ -131,6 +131,7 @@ GameAuthenticator = 67
GameUnjustifiedPoints = 68 GameUnjustifiedPoints = 68
GameSessionKey = 69 GameSessionKey = 69
GameDeathType = 70 GameDeathType = 70
GameIdleAnimations = 71
TextColors = { TextColors = {
red = '#f55e5e', --'#c83200' red = '#f55e5e', --'#c83200'

View File

@ -403,6 +403,7 @@ namespace Otc
GameUnjustifiedPoints = 68, GameUnjustifiedPoints = 68,
GameSessionKey = 69, GameSessionKey = 69,
GameDeathType = 70, GameDeathType = 70,
GameIdleAnimations = 71,
LastGameFeature = 101 LastGameFeature = 101
}; };

View File

@ -1600,6 +1600,10 @@ void Game::setClientVersion(int version)
enableFeature(Otc::GameDeathType); enableFeature(Otc::GameDeathType);
} }
if(version >= 1057) {
enableFeature(Otc::GameIdleAnimations);
}
if(version >= 1061) { if(version >= 1061) {
enableFeature(Otc::GameOGLInformation); enableFeature(Otc::GameOGLInformation);
} }

View File

@ -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)", stdext::throw_exception(stdext::format("corrupt data (id: %d, category: %d, count: %d, lastAttr: %d)",
m_id, m_category, count, attr)); m_id, m_category, count, attr));
uint8 groupCount = 1; bool hasFrameGroups = (category == ThingCategoryCreature && g_game.getFeature(Otc::GameIdleAnimations));
if(category == ThingCategoryCreature && g_game.getClientVersion() >= 1057) uint8 groupCount = hasFrameGroups ? fin->getU8() : 1;
groupCount = fin->getU8();
for(int i = 0; i < groupCount; ++i) { for(int i = 0; i < groupCount; ++i) {
uint8 frameGroup = FrameGroupDefault; uint8 frameGroupType = FrameGroupDefault;
if(category == ThingCategoryCreature && g_game.getClientVersion() >= 1057) { if(hasFrameGroups)
frameGroup = fin->getU8(); frameGroupType = fin->getU8();
}
uint8 width = fin->getU8(); uint8 width = fin->getU8();
uint8 height = fin->getU8(); uint8 height = fin->getU8();

View File

@ -33,10 +33,10 @@
#include <framework/luaengine/luaobject.h> #include <framework/luaengine/luaobject.h>
#include <framework/net/server.h> #include <framework/net/server.h>
enum FrameGroup : uint8 { enum FrameGroupType : uint8 {
FrameGroupIdle = 0, FrameGroupDefault = 0,
FrameGroupMoving, FrameGroupIdle = FrameGroupDefault,
FrameGroupDefault = FrameGroupIdle FrameGroupMoving
}; };
enum ThingCategory : uint8 { enum ThingCategory : uint8 {