Browse Source

show difficulty indicator on multiplayer characters

pull/5225/head
qndel 4 years ago committed by Anders Jenbo
parent
commit
ab6261bfe6
  1. 5
      Source/DiabloUI/diabloui.cpp
  2. 1
      Source/DiabloUI/diabloui.h
  3. 11
      Source/DiabloUI/selhero.cpp

5
Source/DiabloUI/diabloui.cpp

@ -44,6 +44,7 @@
namespace devilution {
OptionalOwnedClxSpriteList ArtLogo;
std::array<OptionalOwnedClxSpriteList, 2> DifficultyIndicator;
std::array<OptionalOwnedClxSpriteList, 3> ArtFocus;
@ -562,6 +563,8 @@ void LoadUiGFX()
} else {
ArtLogo = LoadPcxSpriteList("ui_art\\smlogo.pcx", /*numFrames=*/15, /*transparentColor=*/250);
}
DifficultyIndicator[0] = LoadPcx("ui_art\\radio1.pcx");
DifficultyIndicator[1] = LoadPcx("ui_art\\radio3.pcx");
ArtFocus[FOCUS_SMALL] = LoadPcxSpriteList("ui_art\\focus16.pcx", /*numFrames=*/8, /*transparentColor=*/250);
ArtFocus[FOCUS_MED] = LoadPcxSpriteList("ui_art\\focus.pcx", /*numFrames=*/8, /*transparentColor=*/250);
ArtFocus[FOCUS_BIG] = LoadPcxSpriteList("ui_art\\focus42.pcx", /*numFrames=*/8, /*transparentColor=*/250);
@ -589,6 +592,8 @@ void UnloadUiGFX()
for (auto &art : ArtFocus)
art = std::nullopt;
ArtLogo = std::nullopt;
for (auto &diffInd : DifficultyIndicator)
diffInd = std::nullopt;
}
void UiInitialize()

1
Source/DiabloUI/diabloui.h

@ -61,6 +61,7 @@ struct _uiheroinfo {
};
extern OptionalOwnedClxSpriteList ArtLogo;
extern std::array<OptionalOwnedClxSpriteList, 2> DifficultyIndicator;
extern std::array<OptionalOwnedClxSpriteList, 3> ArtFocus;
extern OptionalOwnedClxSpriteList ArtBackgroundWidescreen;
extern OptionalOwnedClxSpriteList ArtBackground;

11
Source/DiabloUI/selhero.cpp

@ -44,6 +44,7 @@ bool selhero_deleteEnabled;
std::vector<std::unique_ptr<UiItemBase>> vecSelHeroDialog;
std::vector<std::unique_ptr<UiListItem>> vecSelHeroDlgItems;
std::vector<std::unique_ptr<UiItemBase>> vecSelDlgItems;
std::vector<std::unique_ptr<UiItemBase>> vecDifficultyIndicators;
UiImageClx *SELHERO_DIALOG_HERO_IMG;
@ -70,6 +71,7 @@ void SelheroFree()
ArtBackground = std::nullopt;
vecSelHeroDialog.clear();
vecDifficultyIndicators.clear();
vecSelDlgItems.clear();
vecSelHeroDlgItems.clear();
@ -85,6 +87,14 @@ void SelheroSetStats()
CopyUtf8(textStats[3], StrCat(selhero_heroInfo.dexterity), sizeof(textStats[3]));
CopyUtf8(textStats[4], StrCat(selhero_heroInfo.vitality), sizeof(textStats[4]));
CopyUtf8(textStats[5], StrCat(selhero_heroInfo.saveNumber), sizeof(textStats[5]));
const Point uiPosition = GetUIRectangle().position;
vecDifficultyIndicators.clear();
SDL_Rect rect = MakeSdlRect(uiPosition.x + 28, uiPosition.y + 198, 12, 12);
for (int i = 0; i <= DIFF_LAST; i++) {
vecDifficultyIndicators.push_back(std::make_unique<UiImageAnimatedClx>(*DifficultyIndicator[i < selhero_heroInfo.herorank ? 0 : 1], rect, UiFlags::None));
rect.x += 12;
}
}
UiArtTextButton *SELLIST_DIALOG_DELETE_BUTTON;
@ -563,6 +573,7 @@ static void UiSelHeroDialog(
while (!selhero_endMenu && !selhero_navigateYesNo) {
UiClearScreen();
UiRenderItems(vecSelHeroDialog);
UiRenderItems(vecDifficultyIndicators);
UiPollAndRender();
}
SelheroFree();

Loading…
Cancel
Save