* Checks the mouse cursor position within the control panel and sets information * strings if needed. */
| 946 | * strings if needed. |
| 947 | */ |
| 948 | void CheckPanelInfo() |
| 949 | { |
| 950 | int i, c, v, s, xend, yend; |
| 951 | |
| 952 | panelflag = FALSE; |
| 953 | ClearPanel(); |
| 954 | for (i = 0; i < numpanbtns; i++) { |
| 955 | xend = PanBtnPos[i][0] + PanBtnPos[i][2]; |
| 956 | yend = PanBtnPos[i][1] + PanBtnPos[i][3]; |
| 957 | if (MouseX >= PanBtnPos[i][0] && MouseX <= xend && MouseY >= PanBtnPos[i][1] && MouseY <= yend) { |
| 958 | if (i != 7) { |
| 959 | strcpy(infostr, PanBtnStr[i]); |
| 960 | } else { |
| 961 | if (FriendlyMode) |
| 962 | strcpy(infostr, "Player friendly"); |
| 963 | else |
| 964 | strcpy(infostr, "Player attack"); |
| 965 | } |
| 966 | if (PanBtnHotKey[i]) { |
| 967 | sprintf(tempstr, "Hotkey : %s", PanBtnHotKey[i]); |
| 968 | AddPanelString(tempstr, TRUE); |
| 969 | } |
| 970 | infoclr = COL_WHITE; |
| 971 | panelflag = TRUE; |
| 972 | pinfoflag = TRUE; |
| 973 | } |
| 974 | } |
| 975 | if (!spselflag && MouseX >= 565 + PANEL_LEFT && MouseX < 621 + PANEL_LEFT && MouseY >= 64 + PANEL_TOP && MouseY < 120 + PANEL_TOP) { |
| 976 | strcpy(infostr, "Select current spell button"); |
| 977 | infoclr = COL_WHITE; |
| 978 | panelflag = TRUE; |
| 979 | pinfoflag = TRUE; |
| 980 | strcpy(tempstr, "Hotkey : 's'"); |
| 981 | AddPanelString(tempstr, TRUE); |
| 982 | v = plr[myplr]._pRSpell; |
| 983 | if (v != SPL_INVALID) { |
| 984 | switch (plr[myplr]._pRSplType) { |
| 985 | case RSPLTYPE_SKILL: |
| 986 | sprintf(tempstr, "%s Skill", spelldata[v].sSkillText); |
| 987 | AddPanelString(tempstr, TRUE); |
| 988 | break; |
| 989 | case RSPLTYPE_SPELL: |
| 990 | sprintf(tempstr, "%s Spell", spelldata[v].sNameText); |
| 991 | AddPanelString(tempstr, TRUE); |
| 992 | c = plr[myplr]._pISplLvlAdd + plr[myplr]._pSplLvl[v]; |
| 993 | if (c < 0) |
| 994 | c = 0; |
| 995 | if (!c) |
| 996 | sprintf(tempstr, "Spell Level 0 - Unusable"); |
| 997 | else |
| 998 | sprintf(tempstr, "Spell Level %i", c); |
| 999 | AddPanelString(tempstr, TRUE); |
| 1000 | break; |
| 1001 | case RSPLTYPE_SCROLL: |
| 1002 | sprintf(tempstr, "Scroll of %s", spelldata[v].sNameText); |
| 1003 | AddPanelString(tempstr, TRUE); |
| 1004 | s = 0; |
| 1005 | for (i = 0; i < plr[myplr]._pNumInv; i++) { |
no test coverage detected