Browse Source

Clean up control_WriteStringToBuffer

pull/93/head
Anders Jenbo 7 years ago
parent
commit
ea8eeefc57
  1. 25
      Source/control.cpp
  2. 2
      Source/control.h
  3. 6
      Source/items.cpp

25
Source/control.cpp

@ -1617,20 +1617,21 @@ void FreeControlPan()
MemFreeDbg(pGBoxBuff); MemFreeDbg(pGBoxBuff);
} }
int control_WriteStringToBuffer(char *str) BOOL control_WriteStringToBuffer(BYTE *str)
{ {
signed int v1; // edx int k;
unsigned char v2; // al BYTE ichar;
v1 = 0; k = 0;
do { while (*str) {
v2 = *str; ichar = gbFontTransTbl[*str];
if (!*str) str++;
return 1; k += fontkern[fontframe[ichar]];
++str; if (k >= 125)
v1 += fontkern[fontframe[gbFontTransTbl[v2]]]; return FALSE;
} while (v1 < 125); }
return 0;
return TRUE;
} }
void DrawInfoBox() void DrawInfoBox()

2
Source/control.h

@ -83,7 +83,7 @@ void DoAutoMap();
void CheckPanelInfo(); void CheckPanelInfo();
void CheckBtnUp(); void CheckBtnUp();
void FreeControlPan(); void FreeControlPan();
int control_WriteStringToBuffer(char *str); BOOL control_WriteStringToBuffer(BYTE *str);
void DrawInfoBox(); void DrawInfoBox();
void control_print_info_str(int y, char *str, BOOLEAN center, int lines); void control_print_info_str(int y, char *str, BOOLEAN center, int lines);
void PrintGameStr(int x, int y, char *str, int color); void PrintGameStr(int x, int y, char *str, int color);

6
Source/items.cpp

@ -1192,7 +1192,7 @@ void GetStaffPower(int i, int lvl, int bs, unsigned char onlygood)
} }
v12 = ia; v12 = ia;
v13 = item[ia]._iIName; v13 = item[ia]._iIName;
if (!control_WriteStringToBuffer(item[ia]._iIName)) { if (!control_WriteStringToBuffer((BYTE *)item[ia]._iIName)) {
strcpy(v13, AllItemsList[item[v12].IDidx].iSName); strcpy(v13, AllItemsList[item[v12].IDidx].iSName);
if (v5 != -1) { if (v5 != -1) {
sprintf(istr, "%s %s", PL_Prefix[v5].PLName, v13); sprintf(istr, "%s %s", PL_Prefix[v5].PLName, v13);
@ -1241,7 +1241,7 @@ void GetStaffSpell(int i, int lvl, unsigned char onlygood)
goto LABEL_15; goto LABEL_15;
} }
sprintf(istr, "%s of %s", item[i]._iName, spelldata[bs].sNameText); sprintf(istr, "%s of %s", item[i]._iName, spelldata[bs].sNameText);
if (!control_WriteStringToBuffer(istr)) if (!control_WriteStringToBuffer((BYTE *)istr))
sprintf(istr, "Staff of %s", spelldata[bs].sNameText); sprintf(istr, "Staff of %s", spelldata[bs].sNameText);
strcpy(item[i]._iName, istr); strcpy(item[i]._iName, istr);
strcpy(item[i]._iIName, istr); strcpy(item[i]._iIName, istr);
@ -1835,7 +1835,7 @@ void GetItemPower(int i, int minlvl, int maxlvl, int flgs, int onlygood)
} }
} }
} }
if (!control_WriteStringToBuffer(item[i]._iIName)) { if (!control_WriteStringToBuffer((BYTE *)item[i]._iIName)) {
strcpy(item[i]._iIName, AllItemsList[item[i].IDidx].iSName); strcpy(item[i]._iIName, AllItemsList[item[i].IDidx].iSName);
if (preidx != -1) { if (preidx != -1) {
sprintf(istr, "%s %s", PL_Prefix[preidx].PLName, item[i]._iIName); sprintf(istr, "%s %s", PL_Prefix[preidx].PLName, item[i]._iIName);

Loading…
Cancel
Save