From b0e37be06900f3889dfe9dffa55d799cad2f1f36 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 31 Jul 2017 17:40:20 +0300 Subject: Show player name on fixed position on top. Before it depend on sprite height and some times it was wrong. --- src/being/being.cpp | 12 +++--------- src/client.cpp | 2 ++ src/defaults.cpp | 1 + src/settings.h | 2 ++ 4 files changed, 8 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/being/being.cpp b/src/being/being.cpp index 6eae50281..31ea99b27 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -2292,9 +2292,7 @@ void Being::drawEmotion(Graphics *restrict const graphics, } else { - int height = getHeight(); - if (height < 64) - height = 64; + int height = settings.playerNameOffset; y = py + height + 16; } } @@ -2317,9 +2315,7 @@ void Being::drawEmotion(Graphics *restrict const graphics, else if (mShowBadges == BadgeDrawType::Bottom) { x = px + 8 - mBadgesCount * 8; - int height = getHeight(); - if (height < 64) - height = 64; + int height = settings.playerNameOffset; if (mVisibleNamePos == VisibleNamePos::Buttom) y = py + height; else @@ -2457,9 +2453,7 @@ void Being::updateCoords() restrict2 if (mType == ActorType::Monster || mVisibleNamePos == VisibleNamePos::Top) { - int height = getHeight(); - if (height < 64) - height = 64; + int height = settings.playerNameOffset; offsetY += - height - mDispName->getHeight(); } diff --git a/src/client.cpp b/src/client.cpp index 5867c9474..57e870b05 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1730,6 +1730,8 @@ void Client::initPaths() if (settings.linkCommandSymbol.empty()) settings.linkCommandSymbol = "="; settings.overweightPercent = paths.getIntValue("overweightPercent"); + settings.playerNameOffset = paths.getIntValue( + "playerNameOffset"); } void Client::initTradeFilter() diff --git a/src/defaults.cpp b/src/defaults.cpp index 24aa3452c..934683f57 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -691,6 +691,7 @@ DefaultsData* getPathsDefaults() AddDEF("defaultPaletteFile", "palette.gpl"); AddDEF("overweightPercent", 50); + AddDEF("playerNameStandOffset", 64); #ifdef TMWA_SUPPORT AddDEF("gmDefaultLevel", 60); diff --git a/src/settings.h b/src/settings.h index d9378b2db..7570e0df2 100644 --- a/src/settings.h +++ b/src/settings.h @@ -76,6 +76,7 @@ class Settings final crazyMoveState(0U), targetingType(0U), overweightPercent(50U), + playerNameOffset(64), mapDrawType(MapType::NORMAL), emoteType(EmoteType::Player), persistentIp(true), @@ -137,6 +138,7 @@ class Settings final unsigned int crazyMoveState; unsigned int targetingType; unsigned int overweightPercent; + int playerNameOffset; MapTypeT mapDrawType; EmoteTypeT emoteType; bool persistentIp; -- cgit v1.2.3-60-g2f50