MCPcopy Create free account
hub / github.com/diasurgical/devilution / DrawInfoBox

Function DrawInfoBox

Source/control.cpp:1160–1222  ·  view source on GitHub ↗

* Sets a string to be drawn in the info box and then draws it. */

Source from the content-addressed store, hash-verified

1158 * Sets a string to be drawn in the info box and then draws it.
1159 */
1160void DrawInfoBox()
1161{
1162 int nGold;
1163
1164 DrawPanelBox(177, 62, 288, 60, PANEL_X + 177, PANEL_Y + 46);
1165 if (!panelflag && !trigflag && pcursinvitem == -1 && !spselflag) {
1166 infostr[0] = '\0';
1167 infoclr = COL_WHITE;
1168 ClearPanel();
1169 }
1170 if (spselflag || trigflag) {
1171 infoclr = COL_WHITE;
1172 } else if (pcurs >= CURSOR_FIRSTITEM) {
1173 if (plr[myplr].HoldItem._itype == ITYPE_GOLD) {
1174 nGold = plr[myplr].HoldItem._ivalue;
1175 sprintf(infostr, "%i gold %s", nGold, get_pieces_str(plr[myplr].HoldItem._ivalue));
1176 } else if (!plr[myplr].HoldItem._iStatFlag) {
1177 ClearPanel();
1178 AddPanelString("Requirements not met", TRUE);
1179 pinfoflag = TRUE;
1180 } else {
1181 if (plr[myplr].HoldItem._iIdentified)
1182 strcpy(infostr, plr[myplr].HoldItem._iIName);
1183 else
1184 strcpy(infostr, plr[myplr].HoldItem._iName);
1185 if (plr[myplr].HoldItem._iMagical == ITEM_QUALITY_MAGIC)
1186 infoclr = COL_BLUE;
1187 if (plr[myplr].HoldItem._iMagical == ITEM_QUALITY_UNIQUE)
1188 infoclr = COL_GOLD;
1189 }
1190 } else {
1191 if (pcursitem != -1)
1192 GetItemStr(pcursitem);
1193 else if (pcursobj != -1)
1194 GetObjectStr(pcursobj);
1195 if (pcursmonst != -1) {
1196 if (leveltype != DTYPE_TOWN) {
1197 infoclr = COL_WHITE;
1198 strcpy(infostr, monster[pcursmonst].mName);
1199 ClearPanel();
1200 if (monster[pcursmonst]._uniqtype) {
1201 infoclr = COL_GOLD;
1202 PrintUniqueHistory();
1203 } else {
1204 PrintMonstHistory(monster[pcursmonst].MType->mtype);
1205 }
1206 } else if (pcursitem == -1) {
1207 strcpy(infostr, towner[pcursmonst]._tName);
1208 }
1209 }
1210 if (pcursplr != -1) {
1211 infoclr = COL_GOLD;
1212 strcpy(infostr, plr[pcursplr]._pName);
1213 ClearPanel();
1214 sprintf(tempstr, "Level : %i", plr[pcursplr]._pLevel);
1215 AddPanelString(tempstr, TRUE);
1216 sprintf(tempstr, "Hit Points %i of %i", plr[pcursplr]._pHitPoints >> 6, plr[pcursplr]._pMaxHP >> 6);
1217 AddPanelString(tempstr, TRUE);

Callers 2

DrawCtrlPanFunction · 0.85
DrawViewFunction · 0.85

Calls 9

DrawPanelBoxFunction · 0.85
ClearPanelFunction · 0.85
get_pieces_strFunction · 0.85
AddPanelStringFunction · 0.85
GetItemStrFunction · 0.85
GetObjectStrFunction · 0.85
PrintUniqueHistoryFunction · 0.85
PrintMonstHistoryFunction · 0.85
PrintInfoFunction · 0.85

Tested by

no test coverage detected