From e665a0c4b01360a6e267ac64016145ff12effa7f Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 9 May 2021 16:47:56 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8FDraw=20info=20box=20text=20us?= =?UTF-8?q?ing=20DrawString?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/control.cpp | 88 +++++++------------------- Source/control.h | 3 +- Source/cursor.cpp | 4 +- Source/diablo.cpp | 8 +-- Source/items.cpp | 145 ++++++++++++++++++++++--------------------- Source/monster.cpp | 18 +++--- Source/qol/xpbar.cpp | 12 ++-- test/pack_test.cpp | 2 +- 8 files changed, 121 insertions(+), 159 deletions(-) diff --git a/Source/control.cpp b/Source/control.cpp index d7e5ea7a5..9b0d5b10b 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -57,7 +57,6 @@ int dropGoldValue; bool drawmanaflag; bool chrbtnactive; char sgszTalkMsg[MAX_SEND_STR_LEN]; -bool pstrjust[4]; int pnumlines; bool pinfoflag; bool talkButtonsDown[3]; @@ -398,13 +397,13 @@ void DrawSpellList(const CelOutputBuffer &out) sprintf(infostr, _("%s Spell"), _(spelldata[pSpell].sNameText)); if (pSpell == SPL_HBOLT) { strcpy(tempstr, _("Damages undead only")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); } if (s == 0) strcpy(tempstr, _("Spell Level 0 - Unusable")); else sprintf(tempstr, _("Spell Level %i"), s); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case RSPLTYPE_SCROLL: { sprintf(infostr, _("Scroll of %s"), _(spelldata[pSpell].sNameText)); @@ -424,13 +423,13 @@ void DrawSpellList(const CelOutputBuffer &out) } } sprintf(tempstr, ngettext("%i Scroll", "%i Scrolls", v), v); - AddPanelString(tempstr, true); + AddPanelString(tempstr); } break; case RSPLTYPE_CHARGES: { sprintf(infostr, _("Staff of %s"), _(spelldata[pSpell].sNameText)); int charges = plr[myplr].InvBody[INVLOC_HAND_LEFT]._iCharges; sprintf(tempstr, ngettext("%i Charge", "%i Charges", charges), charges); - AddPanelString(tempstr, true); + AddPanelString(tempstr); } break; case RSPLTYPE_INVALID: break; @@ -440,7 +439,7 @@ void DrawSpellList(const CelOutputBuffer &out) auto hotkeyName = keymapper.keyNameForAction(quickSpellActionIndexes[t]); PrintSBookHotkey(out, x, y, hotkeyName); sprintf(tempstr, _("Spell Hotkey %s"), hotkeyName.c_str()); - AddPanelString(tempstr, true); + AddPanelString(tempstr); } } } @@ -514,10 +513,9 @@ void ToggleSpell(int slot) } } -void AddPanelString(const char *str, bool just) +void AddPanelString(const char *str) { strcpy(panelstr[pnumlines], str); - pstrjust[pnumlines] = just; if (pnumlines < 4) pnumlines++; @@ -918,7 +916,7 @@ void CheckPanelInfo() } if (PanBtnHotKey[i] != nullptr) { sprintf(tempstr, _("Hotkey: %s"), _(PanBtnHotKey[i])); - AddPanelString(tempstr, true); + AddPanelString(tempstr); } infoclr = COL_WHITE; panelflag = true; @@ -931,17 +929,17 @@ void CheckPanelInfo() panelflag = true; pinfoflag = true; strcpy(tempstr, _("Hotkey: 's'")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); spell_id v = plr[myplr]._pRSpell; if (v != SPL_INVALID) { switch (plr[myplr]._pRSplType) { case RSPLTYPE_SKILL: sprintf(tempstr, _("%s Skill"), _(spelldata[v].sSkillText)); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case RSPLTYPE_SPELL: { sprintf(tempstr, _("%s Spell"), _(spelldata[v].sNameText)); - AddPanelString(tempstr, true); + AddPanelString(tempstr); int c = plr[myplr]._pISplLvlAdd + plr[myplr]._pSplLvl[v]; if (c < 0) c = 0; @@ -949,11 +947,11 @@ void CheckPanelInfo() strcpy(tempstr, _("Spell Level 0 - Unusable")); else sprintf(tempstr, _("Spell Level %i"), c); - AddPanelString(tempstr, true); + AddPanelString(tempstr); } break; case RSPLTYPE_SCROLL: { sprintf(tempstr, _("Scroll of %s"), _(spelldata[v].sNameText)); - AddPanelString(tempstr, true); + AddPanelString(tempstr); int s = 0; for (int i = 0; i < plr[myplr]._pNumInv; i++) { if (!plr[myplr].InvList[i].isEmpty() @@ -970,13 +968,13 @@ void CheckPanelInfo() } } sprintf(tempstr, ngettext("%i Scroll", "%i Scrolls", s), s); - AddPanelString(tempstr, true); + AddPanelString(tempstr); } break; case RSPLTYPE_CHARGES: sprintf(tempstr, _("Staff of %s"), _(spelldata[v].sNameText)); - AddPanelString(tempstr, true); + AddPanelString(tempstr); sprintf(tempstr, ngettext("%i Charge", "%i Charges", plr[myplr].InvBody[INVLOC_HAND_LEFT]._iCharges), plr[myplr].InvBody[INVLOC_HAND_LEFT]._iCharges); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case RSPLTYPE_INVALID: break; @@ -1087,64 +1085,24 @@ void FreeControlPan() pGBoxBuff = std::nullopt; } -bool control_WriteStringToBuffer(BYTE *str) -{ - int k = 0; - while (*str != '\0') { - BYTE ichar = gbFontTransTbl[*str]; - str++; - k += fontkern[GameFontSmall][fontframe[GameFontSmall][ichar]]; - if (k >= 125) - return false; - } - - return true; -} - -static void CPrintString(const CelOutputBuffer &out, int y, const char *str, bool center, int lines) -{ - int lineOffset = 0; - int sx = 177 + PANEL_X; - int sy = LineOffsets[lines][y] + PANEL_Y; - if (center) { - int strWidth = 0; - const char *tmp = str; - while (*tmp != 0) { - BYTE c = gbFontTransTbl[(BYTE)*tmp++]; - strWidth += fontkern[GameFontSmall][fontframe[GameFontSmall][c]] + 2; - } - if (strWidth < 288) - lineOffset = (288 - strWidth) / 2; - sx += lineOffset; - } - while (*str != '\0') { - BYTE c = gbFontTransTbl[(BYTE)*str++]; - c = fontframe[GameFontSmall][c]; - lineOffset += fontkern[GameFontSmall][c] + 2; - if (c != 0) { - if (lineOffset < 288) { - PrintChar(out, sx, sy, c, infoclr); - } - } - sx += fontkern[GameFontSmall][c] + 2; - } -} - static void PrintInfo(const CelOutputBuffer &out) { if (talkflag) return; + SDL_Rect line { PANEL_X + 177, PANEL_Y + LineOffsets[pnumlines][0], 288, 0 }; + int yo = 0; int lo = 1; if (infostr[0] != '\0') { - CPrintString(out, 0, infostr, true, pnumlines); + DrawString(out, infostr, line, UIS_SILVER | UIS_CENTER); yo = 1; lo = 0; } for (int i = 0; i < pnumlines; i++) { - CPrintString(out, i + yo, panelstr[i], pstrjust[i], pnumlines - lo); + line.y = PANEL_Y + LineOffsets[pnumlines - lo][i + yo]; + DrawString(out, panelstr[i], line, UIS_SILVER | UIS_CENTER); } } @@ -1164,7 +1122,7 @@ void DrawInfoBox(const CelOutputBuffer &out) sprintf(infostr, ngettext("%i gold piece", "%i gold pieces", nGold), nGold); } else if (!plr[myplr].HoldItem._iStatFlag) { ClearPanel(); - AddPanelString(_("Requirements not met"), true); + AddPanelString(_("Requirements not met")); pinfoflag = true; } else { if (plr[myplr].HoldItem._iIdentified) @@ -1203,9 +1161,9 @@ void DrawInfoBox(const CelOutputBuffer &out) strcpy(infostr, plr[pcursplr]._pName); ClearPanel(); sprintf(tempstr, _("%s, Level: %i"), _(ClassStrTbl[static_cast(plr[pcursplr]._pClass)]), plr[pcursplr]._pLevel); - AddPanelString(tempstr, true); + AddPanelString(tempstr); sprintf(tempstr, _("Hit Points %i of %i"), plr[pcursplr]._pHitPoints >> 6, plr[pcursplr]._pMaxHP >> 6); - AddPanelString(tempstr, true); + AddPanelString(tempstr); } } if (infostr[0] != '\0' || pnumlines != 0) diff --git a/Source/control.h b/Source/control.h index 0cfb778c5..4a88551ca 100644 --- a/Source/control.h +++ b/Source/control.h @@ -73,7 +73,7 @@ void SetSpell(); void SetSpeedSpell(int slot); void ToggleSpell(int slot); -void AddPanelString(const char *str, bool just); +void AddPanelString(const char *str); void ClearPanel(); void DrawPanelBox(const CelOutputBuffer &out, int x, int y, int w, int h, int sx, int sy); @@ -115,7 +115,6 @@ void DoAutoMap(); void CheckPanelInfo(); void CheckBtnUp(); void FreeControlPan(); -bool control_WriteStringToBuffer(BYTE *str); /** * Sets a string to be drawn in the info box and then draws it. diff --git a/Source/cursor.cpp b/Source/cursor.cpp index 595065804..c6e667b5e 100644 --- a/Source/cursor.cpp +++ b/Source/cursor.cpp @@ -204,7 +204,7 @@ void CheckTown() ClearPanel(); strcpy(infostr, _("Town Portal")); sprintf(tempstr, _("from %s"), plr[missile[mx]._misource]._pName); - AddPanelString(tempstr, true); + AddPanelString(tempstr); cursmx = missile[mx].position.tile.x; cursmy = missile[mx].position.tile.y; } @@ -233,7 +233,7 @@ void CheckRportal() strcpy(tempstr, _("The Unholy Altar")); else strcpy(tempstr, _("level 15")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); cursmx = missile[mx].position.tile.x; cursmy = missile[mx].position.tile.y; } diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 89419c4d4..8fe81264e 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -1909,8 +1909,8 @@ static void timeout_cursor(bool bTimeout) sgnTimeoutCurs = pcurs; multi_net_ping(); ClearPanel(); - AddPanelString(_("-- Network timeout --"), true); - AddPanelString(_("-- Waiting for players --"), true); + AddPanelString(_("-- Network timeout --")); + AddPanelString(_("-- Waiting for players --")); NewCursor(CURSOR_HOURGLASS); force_redraw = 255; } @@ -1967,8 +1967,8 @@ void helpKeyPressed() helpflag = false; } else if (stextflag != STORE_NONE) { ClearPanel(); - AddPanelString(_("No help available"), true); /// BUGFIX: message isn't displayed - AddPanelString(_("while in stores"), true); + AddPanelString(_("No help available")); /// BUGFIX: message isn't displayed + AddPanelString(_("while in stores")); track_repeat_walk(false); } else { invflag = false; diff --git a/Source/items.cpp b/Source/items.cpp index dd644729e..5cadb220d 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -1484,6 +1484,11 @@ void GetBookSpell(int i, int lvl) items[i]._iCurs = ICURS_BOOK_GREY; } +static bool control_WriteStringToBuffer(const char *str) +{ + return GetLineWidth(str) < 125; +} + void GetStaffPower(int i, int lvl, int bs, bool onlygood) { int l[256]; @@ -1527,7 +1532,7 @@ void GetStaffPower(int i, int lvl, int bs, bool onlygood) items[i]._iPrePower = PL_Prefix[preidx].PLPower; } } - if (!control_WriteStringToBuffer((BYTE *)items[i]._iIName)) { + if (!control_WriteStringToBuffer(items[i]._iIName)) { strcpy(items[i]._iIName, _(AllItemsList[items[i].IDidx].iSName)); if (preidx != -1) { sprintf(istr, "%s %s", _(PL_Prefix[preidx].PLName), items[i]._iIName); @@ -1574,9 +1579,9 @@ void GetStaffSpell(int i, int lvl, bool onlygood) if (s == maxSpells) s = SPL_FIREBOLT; } - sprintf(istr, _("%s of %s"), items[i]._iName, _(spelldata[bs].sNameText)); - if (!control_WriteStringToBuffer((BYTE *)istr)) - sprintf(istr, _("Staff of %s"), _(spelldata[bs].sNameText)); + if (!control_WriteStringToBuffer(istr)) + sprintf(istr, _("%s of %s"), items[i]._iName, _(spelldata[bs].sNameText)); + sprintf(istr, _("Staff of %s"), _(spelldata[bs].sNameText)); strcpy(items[i]._iName, istr); strcpy(items[i]._iIName, istr); @@ -2174,7 +2179,7 @@ void GetItemPower(int i, int minlvl, int maxlvl, affix_item_type flgs, bool only items[i]._iSufPower = PL_Suffix[sufidx].PLPower; } } - if (!control_WriteStringToBuffer((BYTE *)items[i]._iIName)) { + if (!control_WriteStringToBuffer(items[i]._iIName)) { int aii = items[i].IDidx; if (AllItemsList[aii].iSName != nullptr) strcpy(items[i]._iIName, _(AllItemsList[aii].iSName)); @@ -3289,145 +3294,145 @@ void PrintItemOil(char IDidx) switch (IDidx) { case IMISC_OILACC: strcpy(tempstr, _("increases a weapon's")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); strcpy(tempstr, _("chance to hit")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_OILMAST: strcpy(tempstr, _("greatly increases a")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); strcpy(tempstr, _("weapon's chance to hit")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_OILSHARP: strcpy(tempstr, _("increases a weapon's")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); strcpy(tempstr, _("damage potential")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_OILDEATH: strcpy(tempstr, _("greatly increases a weapon's")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); strcpy(tempstr, _("damage potential - not bows")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_OILSKILL: strcpy(tempstr, _("reduces attributes needed")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); strcpy(tempstr, _("to use armor or weapons")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_OILBSMTH: /*xgettext:no-c-format*/ strcpy(tempstr, _("restores 20% of an")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); strcpy(tempstr, _("item's durability")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_OILFORT: strcpy(tempstr, _("increases an item's")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); strcpy(tempstr, _("current and max durability")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_OILPERM: strcpy(tempstr, _("makes an item indestructible")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_OILHARD: strcpy(tempstr, _("increases the armor class")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); strcpy(tempstr, _("of armor and shields")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_OILIMP: strcpy(tempstr, _("greatly increases the armor")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); strcpy(tempstr, _("class of armor and shields")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_RUNEF: strcpy(tempstr, _("sets fire trap")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_RUNEL: strcpy(tempstr, _("sets lightning trap")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_GR_RUNEL: strcpy(tempstr, _("sets lightning trap")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_GR_RUNEF: strcpy(tempstr, _("sets fire trap")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_RUNES: strcpy(tempstr, _("sets petrification trap")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_FULLHEAL: strcpy(tempstr, _("fully recover life")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_HEAL: strcpy(tempstr, _("recover partial life")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_OLDHEAL: strcpy(tempstr, _("recover life")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_DEADHEAL: strcpy(tempstr, _("deadly heal")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_MANA: strcpy(tempstr, _("recover mana")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_FULLMANA: strcpy(tempstr, _("fully recover mana")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_ELIXSTR: strcpy(tempstr, _("increase strength")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_ELIXMAG: strcpy(tempstr, _("increase magic")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_ELIXDEX: strcpy(tempstr, _("increase dexterity")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_ELIXVIT: strcpy(tempstr, _("increase vitality")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_ELIXWEAK: strcpy(tempstr, _("decrease strength")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_ELIXDIS: strcpy(tempstr, _("decrease strength")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_ELIXCLUM: strcpy(tempstr, _("decrease dexterity")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_ELIXSICK: strcpy(tempstr, _("decrease vitality")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_REJUV: strcpy(tempstr, _("recover life and mana")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; case IMISC_FULLREJUV: strcpy(tempstr, _("fully recover life and mana")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); break; } } @@ -3786,48 +3791,48 @@ void PrintItemMisc(ItemStruct *x) { if (x->_iMiscId == IMISC_SCROLL) { strcpy(tempstr, _("Right-click to read")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); } if (x->_iMiscId == IMISC_SCROLLT) { strcpy(tempstr, _("Right-click to read, then")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); strcpy(tempstr, _("left-click to target")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); } if (x->_iMiscId >= IMISC_USEFIRST && x->_iMiscId <= IMISC_USELAST) { PrintItemOil(x->_iMiscId); strcpy(tempstr, _("Right-click to use")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); } if (x->_iMiscId > IMISC_OILFIRST && x->_iMiscId < IMISC_OILLAST) { PrintItemOil(x->_iMiscId); strcpy(tempstr, _("Right click to use")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); } if (x->_iMiscId > IMISC_RUNEFIRST && x->_iMiscId < IMISC_RUNELAST) { PrintItemOil(x->_iMiscId); strcpy(tempstr, _("Right click to use")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); } if (x->_iMiscId == IMISC_BOOK) { strcpy(tempstr, _("Right-click to read")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); } if (x->_iMiscId == IMISC_NOTE) { strcpy(tempstr, _("Right click to read")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); } if (x->_iMiscId == IMISC_MAPOFDOOM) { strcpy(tempstr, _("Right-click to view")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); } if (x->_iMiscId == IMISC_EAR) { sprintf(tempstr, _("Level: %i"), x->_ivalue); - AddPanelString(tempstr, true); + AddPanelString(tempstr); } if (x->_iMiscId == IMISC_AURIC) { strcpy(tempstr, _("Doubles gold capacity")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); } } @@ -3845,7 +3850,7 @@ static void PrintItemInfo(ItemStruct *x) sprintf(tempstr + strlen(tempstr), _(" %i Mag"), mag); if (dex) sprintf(tempstr + strlen(tempstr), _(" %i Dex"), dex); - AddPanelString(tempstr, true); + AddPanelString(tempstr); } pinfoflag = true; } @@ -3864,14 +3869,14 @@ void PrintItemDetails(ItemStruct *x) else sprintf(tempstr, _("damage: %i-%i Dur: %i/%i"), x->_iMinDam, x->_iMaxDam, x->_iDurability, x->_iMaxDur); } - AddPanelString(tempstr, true); + AddPanelString(tempstr); } if (x->_iClass == ICLASS_ARMOR) { if (x->_iMaxDur == DUR_INDESTRUCTIBLE) sprintf(tempstr, _("armor: %i Indestructible"), x->_iAC); else sprintf(tempstr, _("armor: %i Dur: %i/%i"), x->_iAC, x->_iDurability, x->_iMaxDur); - AddPanelString(tempstr, true); + AddPanelString(tempstr); } if (x->_iMiscId == IMISC_STAFF && x->_iMaxCharges != 0) { if (x->_iMinDam == x->_iMaxDam) @@ -3879,18 +3884,18 @@ void PrintItemDetails(ItemStruct *x) else sprintf(tempstr, _("dam: %i-%i Dur: %i/%i"), x->_iMinDam, x->_iMaxDam, x->_iDurability, x->_iMaxDur); sprintf(tempstr, _("Charges: %i/%i"), x->_iCharges, x->_iMaxCharges); - AddPanelString(tempstr, true); + AddPanelString(tempstr); } if (x->_iPrePower != -1) { PrintItemPower(x->_iPrePower, x); - AddPanelString(tempstr, true); + AddPanelString(tempstr); } if (x->_iSufPower != -1) { PrintItemPower(x->_iSufPower, x); - AddPanelString(tempstr, true); + AddPanelString(tempstr); } if (x->_iMagical == ITEM_QUALITY_UNIQUE) { - AddPanelString(_("unique item"), true); + AddPanelString(_("unique item")); uitemflag = true; curruitem = *x; } @@ -3911,29 +3916,29 @@ void PrintItemDur(ItemStruct *x) else sprintf(tempstr, _("damage: %i-%i Dur: %i/%i"), x->_iMinDam, x->_iMaxDam, x->_iDurability, x->_iMaxDur); } - AddPanelString(tempstr, true); + AddPanelString(tempstr); if (x->_iMiscId == IMISC_STAFF && x->_iMaxCharges) { sprintf(tempstr, _("Charges: %i/%i"), x->_iCharges, x->_iMaxCharges); - AddPanelString(tempstr, true); + AddPanelString(tempstr); } if (x->_iMagical != ITEM_QUALITY_NORMAL) - AddPanelString(_("Not Identified"), true); + AddPanelString(_("Not Identified")); } if (x->_iClass == ICLASS_ARMOR) { if (x->_iMaxDur == DUR_INDESTRUCTIBLE) sprintf(tempstr, _("armor: %i Indestructible"), x->_iAC); else sprintf(tempstr, _("armor: %i Dur: %i/%i"), x->_iAC, x->_iDurability, x->_iMaxDur); - AddPanelString(tempstr, true); + AddPanelString(tempstr); if (x->_iMagical != ITEM_QUALITY_NORMAL) - AddPanelString(_("Not Identified"), true); + AddPanelString(_("Not Identified")); if (x->_iMiscId == IMISC_STAFF && x->_iMaxCharges) { sprintf(tempstr, _("Charges: %i/%i"), x->_iCharges, x->_iMaxCharges); - AddPanelString(tempstr, true); + AddPanelString(tempstr); } } if (x->_itype == ITYPE_RING || x->_itype == ITYPE_AMULET) - AddPanelString(_("Not Identified"), true); + AddPanelString(_("Not Identified")); PrintItemInfo(x); } diff --git a/Source/monster.cpp b/Source/monster.cpp index 94c5d4e5d..45d799923 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -4969,7 +4969,7 @@ void PrintMonstHistory(int mt) sprintf(tempstr, _("Total kills: %i"), monstkills[mt]); } - AddPanelString(tempstr, true); + AddPanelString(tempstr); if (monstkills[mt] >= 30) { minHP = monsterdata[mt].mMinHP; maxHP = monsterdata[mt].mMaxHP; @@ -5000,7 +5000,7 @@ void PrintMonstHistory(int mt) maxHP = 4 * maxHP + hpBonusHell; } sprintf(tempstr, _("Hit Points: %i-%i"), minHP, maxHP); - AddPanelString(tempstr, true); + AddPanelString(tempstr); } if (monstkills[mt] >= 15) { if (sgGameInitInfo.nDifficulty != DIFF_HELL) @@ -5010,7 +5010,7 @@ void PrintMonstHistory(int mt) res = res & (RESIST_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMMUNE_MAGIC | IMMUNE_FIRE | IMMUNE_LIGHTNING); if (!res) { strcpy(tempstr, _("No magic resistance")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); } else { if (res & (RESIST_MAGIC | RESIST_FIRE | RESIST_LIGHTNING)) { strcpy(tempstr, _("Resists: ")); @@ -5021,7 +5021,7 @@ void PrintMonstHistory(int mt) if (res & RESIST_LIGHTNING) strcat(tempstr, _("Lightning ")); tempstr[strlen(tempstr) - 1] = '\0'; - AddPanelString(tempstr, true); + AddPanelString(tempstr); } if (res & (IMMUNE_MAGIC | IMMUNE_FIRE | IMMUNE_LIGHTNING)) { strcpy(tempstr, _("Immune: ")); @@ -5032,7 +5032,7 @@ void PrintMonstHistory(int mt) if (res & IMMUNE_LIGHTNING) strcat(tempstr, _("Lightning ")); tempstr[strlen(tempstr) - 1] = '\0'; - AddPanelString(tempstr, true); + AddPanelString(tempstr); } } } @@ -5045,27 +5045,27 @@ void PrintUniqueHistory() if (sgOptions.Gameplay.bShowMonsterType) { sprintf(tempstr, _("Type: %s"), GetMonsterTypeText(*monster[pcursmonst].MData)); - AddPanelString(tempstr, true); + AddPanelString(tempstr); } res = monster[pcursmonst].mMagicRes & (RESIST_MAGIC | RESIST_FIRE | RESIST_LIGHTNING | IMMUNE_MAGIC | IMMUNE_FIRE | IMMUNE_LIGHTNING); if (!res) { strcpy(tempstr, _("No resistances")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); strcpy(tempstr, _("No Immunities")); } else { if (res & (RESIST_MAGIC | RESIST_FIRE | RESIST_LIGHTNING)) strcpy(tempstr, _("Some Magic Resistances")); else strcpy(tempstr, _("No resistances")); - AddPanelString(tempstr, true); + AddPanelString(tempstr); if (res & (IMMUNE_MAGIC | IMMUNE_FIRE | IMMUNE_LIGHTNING)) { strcpy(tempstr, _("Some Magic Immunities")); } else { strcpy(tempstr, _("No Immunities")); } } - AddPanelString(tempstr, true); + AddPanelString(tempstr); pinfoflag = true; } diff --git a/Source/qol/xpbar.cpp b/Source/qol/xpbar.cpp index 14182a713..5d28af332 100644 --- a/Source/qol/xpbar.cpp +++ b/Source/qol/xpbar.cpp @@ -122,7 +122,7 @@ bool CheckXPBarInfo() const int charLevel = player._pLevel; sprintf(tempstr, _("Level %d"), charLevel); - AddPanelString(tempstr, true); + AddPanelString(tempstr); if (charLevel == MAXCHARLEVEL - 1) { // Show a maximum level indicator for max level players. @@ -130,9 +130,9 @@ bool CheckXPBarInfo() strcpy(tempstr, _("Experience: ")); PrintWithSeparator(tempstr + SDL_arraysize("Experience: ") - 1, ExpLvlsTbl[charLevel - 1]); - AddPanelString(tempstr, true); + AddPanelString(tempstr); - AddPanelString(_("Maximum Level"), true); + AddPanelString(_("Maximum Level")); return true; } @@ -141,14 +141,14 @@ bool CheckXPBarInfo() strcpy(tempstr, _("Experience: ")); PrintWithSeparator(tempstr + SDL_arraysize("Experience: ") - 1, player._pExperience); - AddPanelString(tempstr, true); + AddPanelString(tempstr); strcpy(tempstr, _("Next Level: ")); PrintWithSeparator(tempstr + SDL_arraysize("Next Level: ") - 1, ExpLvlsTbl[charLevel]); - AddPanelString(tempstr, true); + AddPanelString(tempstr); sprintf(PrintWithSeparator(tempstr, ExpLvlsTbl[charLevel] - player._pExperience), _(" to Level %d"), charLevel + 1); - AddPanelString(tempstr, true); + AddPanelString(tempstr); return true; } diff --git a/test/pack_test.cpp b/test/pack_test.cpp index d93e702d3..16790b9f1 100644 --- a/test/pack_test.cpp +++ b/test/pack_test.cpp @@ -491,7 +491,7 @@ const TestItemStruct HellfireItems[] = { { "Jester's Sabre", 1, 1, 67, 1710, 1, 8, 0, 0, 0, 0, 0, 0, 23, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 87, -1, 17, 0, 0, 124 }, { "Shield of blocking", 5, 2, 105, 4360, 0, 0, 6, 16777216, 0, 0, 0, 0, 24, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 60, 25, 0, 0, 72 }, { "The Butcher's Cleaver", 2, 1, 106, 3650, 4, 24, 0, 0, 27, 0, 0, 0, 10, 10, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, 0, 0, 6 }, - { "Scimitar of peril", 1, 1, 72, 700, 3, 7, 0, 0, 0, 0, 0, 0, 28, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 86, 23, 0, 23, 121 }, + { "Sword of peril", 1, 1, 72, 700, 3, 7, 0, 0, 0, 0, 0, 0, 28, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 86, 23, 0, 23, 121 }, { "Crystalline Axe", 2, 1, 142, 5250, 6, 16, 0, 0, 0, 0, 0, 0, 12, 12, 280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 88, -1, 30, 0, 0, 132 }, { "Red Cloak", 6, 2, 149, 580, 0, 0, 3, 0, 0, 0, 0, 0, 18, 18, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, -1, 0, 0, 0, 56 }, { "Mace of decay", 4, 1, 59, 600, 1, 8, 0, 0, 0, 0, 0, 0, 32, 32, 232, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 85, 16, 0, 0, 136 },