|
|
|
|
@ -41,7 +41,7 @@ struct PanelEntry {
|
|
|
|
|
UiFlags GetBaseStatColor(CharacterAttribute attr) |
|
|
|
|
{ |
|
|
|
|
UiFlags style = UiFlags::ColorWhite; |
|
|
|
|
if (MyPlayer->GetBaseAttributeValue(attr) == MyPlayer->GetMaximumAttributeValue(attr)) |
|
|
|
|
if (InspectPlayer->GetBaseAttributeValue(attr) == InspectPlayer->GetMaximumAttributeValue(attr)) |
|
|
|
|
style = UiFlags::ColorWhitegold; |
|
|
|
|
return style; |
|
|
|
|
} |
|
|
|
|
@ -49,8 +49,8 @@ UiFlags GetBaseStatColor(CharacterAttribute attr)
|
|
|
|
|
UiFlags GetCurrentStatColor(CharacterAttribute attr) |
|
|
|
|
{ |
|
|
|
|
UiFlags style = UiFlags::ColorWhite; |
|
|
|
|
int current = MyPlayer->GetCurrentAttributeValue(attr); |
|
|
|
|
int base = MyPlayer->GetBaseAttributeValue(attr); |
|
|
|
|
int current = InspectPlayer->GetCurrentAttributeValue(attr); |
|
|
|
|
int base = InspectPlayer->GetBaseAttributeValue(attr); |
|
|
|
|
if (current > base) |
|
|
|
|
style = UiFlags::ColorBlue; |
|
|
|
|
if (current < base) |
|
|
|
|
@ -70,24 +70,24 @@ UiFlags GetValueColor(int value, bool flip = false)
|
|
|
|
|
|
|
|
|
|
UiFlags GetMaxManaColor() |
|
|
|
|
{ |
|
|
|
|
return MyPlayer->_pMaxMana > MyPlayer->_pMaxManaBase ? UiFlags::ColorBlue : UiFlags::ColorWhite; |
|
|
|
|
return InspectPlayer->_pMaxMana > InspectPlayer->_pMaxManaBase ? UiFlags::ColorBlue : UiFlags::ColorWhite; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UiFlags GetMaxHealthColor() |
|
|
|
|
{ |
|
|
|
|
return MyPlayer->_pMaxHP > MyPlayer->_pMaxHPBase ? UiFlags::ColorBlue : UiFlags::ColorWhite; |
|
|
|
|
return InspectPlayer->_pMaxHP > InspectPlayer->_pMaxHPBase ? UiFlags::ColorBlue : UiFlags::ColorWhite; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
std::pair<int, int> GetDamage() |
|
|
|
|
{ |
|
|
|
|
int damageMod = MyPlayer->_pIBonusDamMod; |
|
|
|
|
if (MyPlayer->InvBody[INVLOC_HAND_LEFT]._itype == ItemType::Bow && MyPlayer->_pClass != HeroClass::Rogue) { |
|
|
|
|
damageMod += MyPlayer->_pDamageMod / 2; |
|
|
|
|
int damageMod = InspectPlayer->_pIBonusDamMod; |
|
|
|
|
if (InspectPlayer->InvBody[INVLOC_HAND_LEFT]._itype == ItemType::Bow && InspectPlayer->_pClass != HeroClass::Rogue) { |
|
|
|
|
damageMod += InspectPlayer->_pDamageMod / 2; |
|
|
|
|
} else { |
|
|
|
|
damageMod += MyPlayer->_pDamageMod; |
|
|
|
|
damageMod += InspectPlayer->_pDamageMod; |
|
|
|
|
} |
|
|
|
|
int mindam = MyPlayer->_pIMinDam + MyPlayer->_pIBonusDam * MyPlayer->_pIMinDam / 100 + damageMod; |
|
|
|
|
int maxdam = MyPlayer->_pIMaxDam + MyPlayer->_pIBonusDam * MyPlayer->_pIMaxDam / 100 + damageMod; |
|
|
|
|
int mindam = InspectPlayer->_pIMinDam + InspectPlayer->_pIBonusDam * InspectPlayer->_pIMinDam / 100 + damageMod; |
|
|
|
|
int maxdam = InspectPlayer->_pIMaxDam + InspectPlayer->_pIBonusDam * InspectPlayer->_pIMaxDam / 100 + damageMod; |
|
|
|
|
return { mindam, maxdam }; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -117,78 +117,78 @@ constexpr unsigned GoldHeaderEntryIndex = 16;
|
|
|
|
|
|
|
|
|
|
PanelEntry panelEntries[] = { |
|
|
|
|
{ "", { 9, 14 }, 150, 0, |
|
|
|
|
[]() { return StyledText { UiFlags::ColorWhite, MyPlayer->_pName }; } }, |
|
|
|
|
[]() { return StyledText { UiFlags::ColorWhite, InspectPlayer->_pName }; } }, |
|
|
|
|
{ "", { 161, 14 }, 149, 0, |
|
|
|
|
[]() { return StyledText { UiFlags::ColorWhite, std::string(_(PlayersData[static_cast<std::size_t>(MyPlayer->_pClass)].className)) }; } }, |
|
|
|
|
[]() { return StyledText { UiFlags::ColorWhite, std::string(_(PlayersData[static_cast<std::size_t>(InspectPlayer->_pClass)].className)) }; } }, |
|
|
|
|
|
|
|
|
|
{ N_("Level"), { 57, 52 }, 57, 45, |
|
|
|
|
[]() { return StyledText { UiFlags::ColorWhite, StrCat(MyPlayer->_pLevel) }; } }, |
|
|
|
|
[]() { return StyledText { UiFlags::ColorWhite, StrCat(InspectPlayer->_pLevel) }; } }, |
|
|
|
|
{ N_("Experience"), { TopRightLabelX, 52 }, 99, 91, |
|
|
|
|
[]() { |
|
|
|
|
int spacing = ((MyPlayer->_pExperience >= 1000000000) ? 0 : 1); |
|
|
|
|
return StyledText { UiFlags::ColorWhite, FormatInteger(MyPlayer->_pExperience), spacing }; |
|
|
|
|
int spacing = ((InspectPlayer->_pExperience >= 1000000000) ? 0 : 1); |
|
|
|
|
return StyledText { UiFlags::ColorWhite, FormatInteger(InspectPlayer->_pExperience), spacing }; |
|
|
|
|
} }, |
|
|
|
|
{ N_("Next level"), { TopRightLabelX, 80 }, 99, 198, |
|
|
|
|
[]() { |
|
|
|
|
if (MyPlayer->_pLevel == MaxCharacterLevel) { |
|
|
|
|
if (InspectPlayer->_pLevel == MaxCharacterLevel) { |
|
|
|
|
return StyledText { UiFlags::ColorWhitegold, std::string(_("None")) }; |
|
|
|
|
} |
|
|
|
|
int spacing = ((MyPlayer->_pNextExper >= 1000000000) ? 0 : 1); |
|
|
|
|
return StyledText { UiFlags::ColorWhite, FormatInteger(MyPlayer->_pNextExper), spacing }; |
|
|
|
|
int spacing = ((InspectPlayer->_pNextExper >= 1000000000) ? 0 : 1); |
|
|
|
|
return StyledText { UiFlags::ColorWhite, FormatInteger(InspectPlayer->_pNextExper), spacing }; |
|
|
|
|
} }, |
|
|
|
|
|
|
|
|
|
{ N_("Base"), { LeftColumnLabelX, /* set dynamically */ 0 }, 0, 44, {} }, |
|
|
|
|
{ N_("Now"), { 135, /* set dynamically */ 0 }, 0, 44, {} }, |
|
|
|
|
{ N_("Strength"), { LeftColumnLabelX, 135 }, 45, LeftColumnLabelWidth, |
|
|
|
|
[]() { return StyledText { GetBaseStatColor(CharacterAttribute::Strength), StrCat(MyPlayer->_pBaseStr) }; } }, |
|
|
|
|
[]() { return StyledText { GetBaseStatColor(CharacterAttribute::Strength), StrCat(InspectPlayer->_pBaseStr) }; } }, |
|
|
|
|
{ "", { 135, 135 }, 45, 0, |
|
|
|
|
[]() { return StyledText { GetCurrentStatColor(CharacterAttribute::Strength), StrCat(MyPlayer->_pStrength) }; } }, |
|
|
|
|
[]() { return StyledText { GetCurrentStatColor(CharacterAttribute::Strength), StrCat(InspectPlayer->_pStrength) }; } }, |
|
|
|
|
{ N_("Magic"), { LeftColumnLabelX, 163 }, 45, LeftColumnLabelWidth, |
|
|
|
|
[]() { return StyledText { GetBaseStatColor(CharacterAttribute::Magic), StrCat(MyPlayer->_pBaseMag) }; } }, |
|
|
|
|
[]() { return StyledText { GetBaseStatColor(CharacterAttribute::Magic), StrCat(InspectPlayer->_pBaseMag) }; } }, |
|
|
|
|
{ "", { 135, 163 }, 45, 0, |
|
|
|
|
[]() { return StyledText { GetCurrentStatColor(CharacterAttribute::Magic), StrCat(MyPlayer->_pMagic) }; } }, |
|
|
|
|
{ N_("Dexterity"), { LeftColumnLabelX, 191 }, 45, LeftColumnLabelWidth, []() { return StyledText { GetBaseStatColor(CharacterAttribute::Dexterity), StrCat(MyPlayer->_pBaseDex) }; } }, |
|
|
|
|
[]() { return StyledText { GetCurrentStatColor(CharacterAttribute::Magic), StrCat(InspectPlayer->_pMagic) }; } }, |
|
|
|
|
{ N_("Dexterity"), { LeftColumnLabelX, 191 }, 45, LeftColumnLabelWidth, []() { return StyledText { GetBaseStatColor(CharacterAttribute::Dexterity), StrCat(InspectPlayer->_pBaseDex) }; } }, |
|
|
|
|
{ "", { 135, 191 }, 45, 0, |
|
|
|
|
[]() { return StyledText { GetCurrentStatColor(CharacterAttribute::Dexterity), StrCat(MyPlayer->_pDexterity) }; } }, |
|
|
|
|
{ N_("Vitality"), { LeftColumnLabelX, 219 }, 45, LeftColumnLabelWidth, []() { return StyledText { GetBaseStatColor(CharacterAttribute::Vitality), StrCat(MyPlayer->_pBaseVit) }; } }, |
|
|
|
|
[]() { return StyledText { GetCurrentStatColor(CharacterAttribute::Dexterity), StrCat(InspectPlayer->_pDexterity) }; } }, |
|
|
|
|
{ N_("Vitality"), { LeftColumnLabelX, 219 }, 45, LeftColumnLabelWidth, []() { return StyledText { GetBaseStatColor(CharacterAttribute::Vitality), StrCat(InspectPlayer->_pBaseVit) }; } }, |
|
|
|
|
{ "", { 135, 219 }, 45, 0, |
|
|
|
|
[]() { return StyledText { GetCurrentStatColor(CharacterAttribute::Vitality), StrCat(MyPlayer->_pVitality) }; } }, |
|
|
|
|
[]() { return StyledText { GetCurrentStatColor(CharacterAttribute::Vitality), StrCat(InspectPlayer->_pVitality) }; } }, |
|
|
|
|
{ N_("Points to distribute"), { LeftColumnLabelX, 248 }, 45, LeftColumnLabelWidth, |
|
|
|
|
[]() { |
|
|
|
|
MyPlayer->_pStatPts = std::min(CalcStatDiff(*MyPlayer), MyPlayer->_pStatPts); |
|
|
|
|
return StyledText { UiFlags::ColorRed, (MyPlayer->_pStatPts > 0 ? StrCat(MyPlayer->_pStatPts) : "") }; |
|
|
|
|
InspectPlayer->_pStatPts = std::min(CalcStatDiff(*InspectPlayer), InspectPlayer->_pStatPts); |
|
|
|
|
return StyledText { UiFlags::ColorRed, (InspectPlayer->_pStatPts > 0 ? StrCat(InspectPlayer->_pStatPts) : "") }; |
|
|
|
|
} }, |
|
|
|
|
|
|
|
|
|
{ N_("Gold"), { TopRightLabelX, /* set dynamically */ 0 }, 0, 98, {} }, |
|
|
|
|
{ "", { TopRightLabelX, 127 }, 99, 0, |
|
|
|
|
[]() { return StyledText { UiFlags::ColorWhite, FormatInteger(MyPlayer->_pGold) }; } }, |
|
|
|
|
[]() { return StyledText { UiFlags::ColorWhite, FormatInteger(InspectPlayer->_pGold) }; } }, |
|
|
|
|
|
|
|
|
|
{ N_("Armor class"), { RightColumnLabelX, 163 }, 57, RightColumnLabelWidth, |
|
|
|
|
[]() { return StyledText { GetValueColor(MyPlayer->_pIBonusAC), StrCat(MyPlayer->GetArmor() + MyPlayer->_pLevel * 2) }; } }, |
|
|
|
|
[]() { return StyledText { GetValueColor(InspectPlayer->_pIBonusAC), StrCat(InspectPlayer->GetArmor() + InspectPlayer->_pLevel * 2) }; } }, |
|
|
|
|
{ N_("To hit"), { RightColumnLabelX, 191 }, 57, RightColumnLabelWidth, |
|
|
|
|
[]() { return StyledText { GetValueColor(MyPlayer->_pIBonusToHit), StrCat(MyPlayer->InvBody[INVLOC_HAND_LEFT]._itype == ItemType::Bow ? MyPlayer->GetRangedToHit() : MyPlayer->GetMeleeToHit(), "%") }; } }, |
|
|
|
|
[]() { return StyledText { GetValueColor(InspectPlayer->_pIBonusToHit), StrCat(InspectPlayer->InvBody[INVLOC_HAND_LEFT]._itype == ItemType::Bow ? InspectPlayer->GetRangedToHit() : InspectPlayer->GetMeleeToHit(), "%") }; } }, |
|
|
|
|
{ N_("Damage"), { RightColumnLabelX, 219 }, 57, RightColumnLabelWidth, |
|
|
|
|
[]() { |
|
|
|
|
std::pair<int, int> dmg = GetDamage(); |
|
|
|
|
int spacing = ((dmg.first >= 100) ? -1 : 1); |
|
|
|
|
return StyledText { GetValueColor(MyPlayer->_pIBonusDam), StrCat(dmg.first, "-", dmg.second), spacing }; |
|
|
|
|
return StyledText { GetValueColor(InspectPlayer->_pIBonusDam), StrCat(dmg.first, "-", dmg.second), spacing }; |
|
|
|
|
} }, |
|
|
|
|
|
|
|
|
|
{ N_("Life"), { LeftColumnLabelX, 284 }, 45, LeftColumnLabelWidth, |
|
|
|
|
[]() { return StyledText { GetMaxHealthColor(), StrCat(MyPlayer->_pMaxHP >> 6) }; } }, |
|
|
|
|
[]() { return StyledText { GetMaxHealthColor(), StrCat(InspectPlayer->_pMaxHP >> 6) }; } }, |
|
|
|
|
{ "", { 135, 284 }, 45, 0, |
|
|
|
|
[]() { return StyledText { (MyPlayer->_pHitPoints != MyPlayer->_pMaxHP ? UiFlags::ColorRed : GetMaxHealthColor()), StrCat(MyPlayer->_pHitPoints >> 6) }; } }, |
|
|
|
|
[]() { return StyledText { (InspectPlayer->_pHitPoints != InspectPlayer->_pMaxHP ? UiFlags::ColorRed : GetMaxHealthColor()), StrCat(InspectPlayer->_pHitPoints >> 6) }; } }, |
|
|
|
|
{ N_("Mana"), { LeftColumnLabelX, 312 }, 45, LeftColumnLabelWidth, |
|
|
|
|
[]() { return StyledText { GetMaxManaColor(), StrCat(MyPlayer->_pMaxMana >> 6) }; } }, |
|
|
|
|
[]() { return StyledText { GetMaxManaColor(), StrCat(InspectPlayer->_pMaxMana >> 6) }; } }, |
|
|
|
|
{ "", { 135, 312 }, 45, 0, |
|
|
|
|
[]() { return StyledText { (MyPlayer->_pMana != MyPlayer->_pMaxMana ? UiFlags::ColorRed : GetMaxManaColor()), StrCat(MyPlayer->_pMana >> 6) }; } }, |
|
|
|
|
[]() { return StyledText { (InspectPlayer->_pMana != InspectPlayer->_pMaxMana ? UiFlags::ColorRed : GetMaxManaColor()), StrCat(InspectPlayer->_pMana >> 6) }; } }, |
|
|
|
|
|
|
|
|
|
{ N_("Resist magic"), { RightColumnLabelX, 256 }, 57, RightColumnLabelWidth, |
|
|
|
|
[]() { return GetResistInfo(MyPlayer->_pMagResist); } }, |
|
|
|
|
[]() { return GetResistInfo(InspectPlayer->_pMagResist); } }, |
|
|
|
|
{ N_("Resist fire"), { RightColumnLabelX, 284 }, 57, RightColumnLabelWidth, |
|
|
|
|
[]() { return GetResistInfo(MyPlayer->_pFireResist); } }, |
|
|
|
|
[]() { return GetResistInfo(InspectPlayer->_pFireResist); } }, |
|
|
|
|
{ N_("Resist lightning"), { RightColumnLabelX, 313 }, 57, RightColumnLabelWidth, |
|
|
|
|
[]() { return GetResistInfo(MyPlayer->_pLghtResist); } }, |
|
|
|
|
[]() { return GetResistInfo(InspectPlayer->_pLghtResist); } }, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
OptionalOwnedClxSpriteList Panel; |
|
|
|
|
@ -241,14 +241,14 @@ void DrawShadowString(const Surface &out, const PanelEntry &entry)
|
|
|
|
|
|
|
|
|
|
void DrawStatButtons(const Surface &out) |
|
|
|
|
{ |
|
|
|
|
if (MyPlayer->_pStatPts > 0) { |
|
|
|
|
if (MyPlayer->_pBaseStr < MyPlayer->GetMaximumAttributeValue(CharacterAttribute::Strength)) |
|
|
|
|
if (InspectPlayer->_pStatPts > 0 && !IsInspectingPlayer()) { |
|
|
|
|
if (InspectPlayer->_pBaseStr < InspectPlayer->GetMaximumAttributeValue(CharacterAttribute::Strength)) |
|
|
|
|
ClxDraw(out, GetPanelPosition(UiPanels::Character, { 137, 157 }), (*pChrButtons)[chrbtn[static_cast<size_t>(CharacterAttribute::Strength)] ? 2 : 1]); |
|
|
|
|
if (MyPlayer->_pBaseMag < MyPlayer->GetMaximumAttributeValue(CharacterAttribute::Magic)) |
|
|
|
|
if (InspectPlayer->_pBaseMag < InspectPlayer->GetMaximumAttributeValue(CharacterAttribute::Magic)) |
|
|
|
|
ClxDraw(out, GetPanelPosition(UiPanels::Character, { 137, 185 }), (*pChrButtons)[chrbtn[static_cast<size_t>(CharacterAttribute::Magic)] ? 4 : 3]); |
|
|
|
|
if (MyPlayer->_pBaseDex < MyPlayer->GetMaximumAttributeValue(CharacterAttribute::Dexterity)) |
|
|
|
|
if (InspectPlayer->_pBaseDex < InspectPlayer->GetMaximumAttributeValue(CharacterAttribute::Dexterity)) |
|
|
|
|
ClxDraw(out, GetPanelPosition(UiPanels::Character, { 137, 214 }), (*pChrButtons)[chrbtn[static_cast<size_t>(CharacterAttribute::Dexterity)] ? 6 : 5]); |
|
|
|
|
if (MyPlayer->_pBaseVit < MyPlayer->GetMaximumAttributeValue(CharacterAttribute::Vitality)) |
|
|
|
|
if (InspectPlayer->_pBaseVit < InspectPlayer->GetMaximumAttributeValue(CharacterAttribute::Vitality)) |
|
|
|
|
ClxDraw(out, GetPanelPosition(UiPanels::Character, { 137, 242 }), (*pChrButtons)[chrbtn[static_cast<size_t>(CharacterAttribute::Vitality)] ? 8 : 7]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|