diff --git a/Source/control.cpp b/Source/control.cpp index 6095297f3..bc8b49b48 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -1537,33 +1537,35 @@ BOOL control_WriteStringToBuffer(BYTE *str) void DrawInfoBox() { - int v0; // ecx - int v1; // eax - int v2; // eax - int v3; // esi - char *v4; // eax - const char *v5; // eax - signed int v7; // edi - signed int v8; // ebp - int v9; // esi - char *v10; // ebx + int nGold; DrawPanelBox(177, 62, 288, 60, 241, 558); - v0 = trigflag; - v1 = spselflag; - if (!panelflag && !trigflag && pcursinvitem == -1) { - if (spselflag) { - LABEL_32: - infoclr = COL_WHITE; - goto LABEL_33; - } - infostr[0] = 0; + if (!panelflag && !trigflag && pcursinvitem == -1 && !spselflag) { + infostr[0] = '\0'; infoclr = COL_WHITE; ClearPanel(); } - if (v1 || v0) - goto LABEL_32; - if (pcurs < CURSOR_FIRSTITEM) { + if (spselflag || trigflag) { + infoclr = COL_WHITE; + } else if (pcurs >= CURSOR_FIRSTITEM) { + if (plr[myplr].HoldItem._itype == ITYPE_GOLD) { + nGold = plr[myplr].HoldItem._ivalue; + sprintf(infostr, "%i gold %s", nGold, get_pieces_str(plr[myplr].HoldItem._ivalue)); + } else if (!plr[myplr].HoldItem._iStatFlag) { + ClearPanel(); + AddPanelString("Requirements not met", 1); + pinfoflag = TRUE; + } else { + if (plr[myplr].HoldItem._iIdentified) + strcpy(infostr, plr[myplr].HoldItem._iIName); + else + strcpy(infostr, plr[myplr].HoldItem._iName); + if (plr[myplr].HoldItem._iMagical == ITEM_QUALITY_MAGIC) + infoclr = COL_BLUE; + if (plr[myplr].HoldItem._iMagical == ITEM_QUALITY_UNIQUE) + infoclr = COL_GOLD; + } + } else { if (pcursitem != -1) GetItemStr(pcursitem); if (pcursobj != -1) @@ -1592,56 +1594,29 @@ void DrawInfoBox() sprintf(tempstr, "Hit Points %i of %i", plr[pcursplr]._pHitPoints >> 6, plr[pcursplr]._pMaxHP >> 6); AddPanelString(tempstr, 1); } - } else { - v2 = myplr; - if (plr[myplr].HoldItem._itype == ITYPE_GOLD) { - v3 = plr[v2].HoldItem._ivalue; - v4 = get_pieces_str(plr[v2].HoldItem._ivalue); - sprintf(infostr, "%i gold %s", v3, v4); - } else if (plr[v2].HoldItem._iStatFlag) { - if (plr[v2].HoldItem._iIdentified) - v5 = plr[v2].HoldItem._iIName; - else - v5 = plr[v2].HoldItem._iName; - strcpy(infostr, v5); - if (plr[myplr].HoldItem._iMagical == ITEM_QUALITY_MAGIC) - infoclr = COL_BLUE; - if (plr[myplr].HoldItem._iMagical == ITEM_QUALITY_UNIQUE) - infoclr = COL_GOLD; - } else { - ClearPanel(); - AddPanelString("Requirements not met", 1); - pinfoflag = TRUE; - } } -LABEL_33: - if ((infostr[0] || pnumlines) && !talkflag) { - v7 = 0; - v8 = 1; + if (infostr[0] || pnumlines) + control_draw_info_str(); +} + +void control_draw_info_str() +{ + int yo, lo, i; + + if (!talkflag) { + yo = 0; + lo = 1; if (infostr[0]) { control_print_info_str(0, infostr, 1, pnumlines); - v7 = 1; - v8 = 0; + yo = 1; + lo = 0; } - v9 = 0; - if (pnumlines > 0) { - v10 = panelstr; - do { - control_print_info_str(v9 + v7, v10, pstrjust[v9], pnumlines - v8); - ++v9; - v10 += 64; - } while (v9 < pnumlines); + + for (i = 0; i < pnumlines; i++) { + control_print_info_str(i + yo, &panelstr[64 * i], pstrjust[i], pnumlines - lo); } } } -// 4B883C: using guessed type int infoclr; -// 4B8960: using guessed type int talkflag; -// 4B8B84: using guessed type int panelflag; -// 4B8C98: using guessed type int spselflag; -// 4B8CB8: using guessed type char pcursinvitem; -// 4B8CC0: using guessed type char pcursitem; -// 4B8CC1: using guessed type char pcursobj; -// 4B8CC2: using guessed type char pcursplr; void control_print_info_str(int y, char *str, BOOL center, int lines) { diff --git a/Source/control.h b/Source/control.h index 6924e6c1b..d87ca6cc8 100644 --- a/Source/control.h +++ b/Source/control.h @@ -85,6 +85,7 @@ void CheckBtnUp(); void FreeControlPan(); BOOL control_WriteStringToBuffer(BYTE *str); void DrawInfoBox(); +void control_draw_info_str(); void control_print_info_str(int y, char *str, BOOL center, int lines); void PrintGameStr(int x, int y, char *str, int color); void DrawChr(); diff --git a/Source/monster.cpp b/Source/monster.cpp index 4defe56eb..4434969a5 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -1092,13 +1092,14 @@ int AddMonster(int x, int y, int dir, int mtype, BOOL InMap) void NewMonsterAnim(int i, AnimStruct *anim, int md) { - monster[i]._mAnimData = anim->Data[md]; - monster[i]._mAnimCnt = 0; - monster[i]._mAnimLen = anim->Frames; - monster[i]._mAnimFrame = 1; - monster[i]._mFlags &= ~(MFLAG_LOCK_ANIMATION | MFLAG_ALLOW_SPECIAL); - monster[i]._mAnimDelay = anim->Rate; - monster[i]._mdir = md; + MonsterStruct *Monst = monster + i; + Monst->_mAnimData = anim->Data[md]; + Monst->_mAnimLen = anim->Frames; + Monst->_mAnimCnt = 0; + Monst->_mAnimFrame = 1; + Monst->_mAnimDelay = anim->Rate; + Monst->_mFlags &= ~(MFLAG_LOCK_ANIMATION | MFLAG_ALLOW_SPECIAL); + Monst->_mdir = md; } BOOL M_Ranged(int i) @@ -4290,7 +4291,7 @@ void MAI_SnotSpil(int i) if (dFlags[mx][my] & DFLAG_VISIBLE) { if (Monst->mtalkmsg == QUEST_BANNER12) { if (!effect_is_playing(USFX_SNOT3) && Monst->_mgoal == MGOAL_TALKING) { - ObjChangeMap(setpc_x, setpc_y, setpc_w + setpc_x + 1, setpc_h + setpc_y + 1); + ObjChangeMap(setpc_x, setpc_y, setpc_x + setpc_w + 1, setpc_y + setpc_h + 1); quests[QTYPE_BOL]._qvar1 = 3; RedoPlayerVision(); Monst->_msquelch = UCHAR_MAX; @@ -4403,16 +4404,16 @@ void MAI_Lachdanan(int i) app_fatal("MAI_Lachdanan: Invalid monster %d", i); Monst = &monster[i]; - if (Monst->_mmode != MM_STAND) { + if (monster[i]._mmode != MM_STAND) { return; } _mx = Monst->_mx; _my = Monst->_my; md = M_GetDir(i); - if (Monst->mtalkmsg == QUEST_VEIL9 && !(dFlags[_mx][_my] & DFLAG_VISIBLE) && Monst->_mgoal == MGOAL_TALKING) { + if (Monst->mtalkmsg == QUEST_VEIL9 && !(dFlags[_mx][_my] & DFLAG_VISIBLE) && monster[i]._mgoal == MGOAL_TALKING) { Monst->mtalkmsg = QUEST_VEIL10; - Monst->_mgoal = MGOAL_INQUIRING; + monster[i]._mgoal = MGOAL_INQUIRING; } if (dFlags[_mx][_my] & DFLAG_VISIBLE) { @@ -4427,7 +4428,7 @@ void MAI_Lachdanan(int i) Monst->_mdir = md; - if (Monst->_mmode == MM_STAND) + if (monster[i]._mmode == MM_STAND) Monst->_mAnimData = Monst->MType->Anims[MA_STAND].Data[md]; } diff --git a/Source/stores.cpp b/Source/stores.cpp index d614d90b5..782d99d49 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -2380,7 +2380,7 @@ void S_BBuyEnter() stextlhold = 10; stextvhold = stextsval; stextshold = STORE_BBOY; - if (plr[myplr]._pGold >= boyitem._iIvalue + (boyitem._iIvalue >> 1)) { + if (plr[myplr]._pGold < boyitem._iIvalue + (boyitem._iIvalue >> 1)) { StartStore(STORE_NOMONEY); } else { plr[myplr].HoldItem = boyitem;