From fe585d27d8a52e2a7a3707292dd01dbaebef869b Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 30 Jul 2014 17:06:05 +0200 Subject: [PATCH] Cleanup dat loading, fix version 8.6+ --- src/client/thingtype.cpp | 41 +++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/src/client/thingtype.cpp b/src/client/thingtype.cpp index ce25348b..236f38b9 100644 --- a/src/client/thingtype.cpp +++ b/src/client/thingtype.cpp @@ -147,6 +147,11 @@ void ThingType::unserialize(uint16 clientId, ThingCategory category, const FileS attr = ThingAttrNoMoveAnimation; else if(attr > 16) attr -= 1; + } else if(g_game.getProtocolVersion() >= 860) { + /* Default attribute values follow + * the format of 8.6-9.86. + * Therefore no changes here. + */ } else if(g_game.getProtocolVersion() >= 780) { /* In 7.80-8.54 all attributes from 8 and higher were * incremented by 1 to make space for 8 as @@ -162,28 +167,38 @@ void ThingType::unserialize(uint16 clientId, ThingCategory category, const FileS if(attr == 23) attr = ThingAttrFloorChange; } else if(g_game.getProtocolVersion() >= 740) { - /* 7.4-7.5 */ + /* In 7.4-7.5 attribute "Ground Border" did not exist + * attributes 1-15 have to be adjusted. + * Several other changes in the format. + */ if(attr > 0 && attr <= 15) attr += 1; + else if(attr == 16) + attr = ThingAttrLight; else if(attr == 17) attr = ThingAttrFloorChange; else if(attr == 18) - attr += 12; - else if(attr == 19 || attr == 22) - attr += 6; - else if(attr == 16) - attr += 5; + attr = ThingAttrFullGround; + else if(attr == 19) + attr = ThingAttrElevation; else if(attr == 20) - attr += 4; - else if(attr == 24) - attr += 2; - else if(attr >= 25 && attr <= 27) - attr -= 8; + attr = ThingAttrDisplacement; + else if(attr == 22) + attr = ThingAttrMinimapColor; else if(attr == 23) - attr -= 3; + attr = ThingAttrRotateable; + else if(attr == 24) + attr = ThingAttrLyingCorpse; + else if(attr == 25) + attr = ThingAttrHangable; + else if(attr == 26) + attr = ThingAttrHookSouth; + else if(attr == 27) + attr = ThingAttrHookEast; else if(attr == 28) - attr -= 1; + attr = ThingAttrAnimateAlways; + /* "Multi Use" and "Force Use" are swapped */ if(attr == ThingAttrMultiUse) attr = ThingAttrForceUse; else if(attr == ThingAttrForceUse)