| 2070 | } |
| 2071 | |
| 2072 | BOOL UseInvItem(int pnum, int cii) |
| 2073 | { |
| 2074 | int c, idata; |
| 2075 | ItemStruct *Item; |
| 2076 | BOOL speedlist; |
| 2077 | |
| 2078 | if (plr[pnum]._pInvincible && !plr[pnum]._pHitPoints && pnum == myplr) |
| 2079 | return TRUE; |
| 2080 | if (pcurs != 1) |
| 2081 | return TRUE; |
| 2082 | if (stextflag) |
| 2083 | return TRUE; |
| 2084 | if (cii <= INVITEM_HAND_RIGHT) |
| 2085 | return FALSE; |
| 2086 | |
| 2087 | if (cii <= INVITEM_INV_LAST) { |
| 2088 | c = cii - INVITEM_INV_FIRST; |
| 2089 | Item = &plr[pnum].InvList[c]; |
| 2090 | speedlist = FALSE; |
| 2091 | } else { |
| 2092 | if (talkflag) |
| 2093 | return TRUE; |
| 2094 | c = cii - INVITEM_BELT_FIRST; |
| 2095 | Item = &plr[pnum].SpdList[c]; |
| 2096 | speedlist = TRUE; |
| 2097 | } |
| 2098 | |
| 2099 | switch (Item->IDidx) { |
| 2100 | case IDI_MUSHROOM: |
| 2101 | sfxdelay = 10; |
| 2102 | #ifndef SPAWN |
| 2103 | if (plr[pnum]._pClass == PC_WARRIOR) { |
| 2104 | sfxdnum = PS_WARR95; |
| 2105 | } else if (plr[pnum]._pClass == PC_ROGUE) { |
| 2106 | sfxdnum = PS_ROGUE95; |
| 2107 | } else if (plr[pnum]._pClass == PC_SORCERER) { |
| 2108 | sfxdnum = PS_MAGE95; |
| 2109 | } |
| 2110 | #endif |
| 2111 | return TRUE; |
| 2112 | case IDI_FUNGALTM: |
| 2113 | PlaySFX(IS_IBOOK); |
| 2114 | sfxdelay = 10; |
| 2115 | if (plr[pnum]._pClass == PC_WARRIOR) { |
| 2116 | sfxdnum = PS_WARR29; |
| 2117 | #ifndef SPAWN |
| 2118 | } else if (plr[pnum]._pClass == PC_ROGUE) { |
| 2119 | sfxdnum = PS_ROGUE29; |
| 2120 | } else if (plr[pnum]._pClass == PC_SORCERER) { |
| 2121 | sfxdnum = PS_MAGE29; |
| 2122 | #endif |
| 2123 | } |
| 2124 | return TRUE; |
| 2125 | } |
| 2126 | |
| 2127 | if (!AllItemsList[Item->IDidx].iUsable) |
| 2128 | return FALSE; |
| 2129 |
no test coverage detected