From f4ad6ecb3cb3a003778357565d7faf5f10822c2c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 1 Jul 2013 23:29:39 +0300 Subject: fix up/down direction in sprites drawbefore/drawafter for legacy servers. --- src/resources/iteminfo.cpp | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp index 9ca3f4f1e..4b85beb64 100644 --- a/src/resources/iteminfo.cpp +++ b/src/resources/iteminfo.cpp @@ -239,14 +239,33 @@ SpriteToItemMap *ItemInfo::getSpriteToItemReplaceMap(const int direction) const void ItemInfo::setSpriteOrder(int *const ptr, const int direction, const int n, const int def) const { - if (direction == -1) + switch (direction) { - for (int f = 0; f < 10; f ++) + case -1: { - if (ptr[f] == def) - ptr[f] = n; + for (int f = 0; f < 10; f ++) + { + if (ptr[f] == def) + ptr[f] = n; + } + return; } - return; + case -2: + { + ptr[DIRECTION_DOWN] = n; + ptr[DIRECTION_DOWNLEFT] = n; + ptr[DIRECTION_DOWNRIGHT] = n; + return; + } + case -3: + { + ptr[DIRECTION_UP] = n; + ptr[DIRECTION_UPLEFT] = n; + ptr[DIRECTION_UPRIGHT] = n; + return; + } + default: + break; } if (direction < 0 || direction >= 9) return; -- cgit v1.2.3-70-g09d2