================= Item_MouseEnter ================= */
| 9089 | ================= |
| 9090 | */ |
| 9091 | void Item_MouseEnter(itemDef_t *item, float x, float y) |
| 9092 | { |
| 9093 | rectDef_t r; |
| 9094 | //JLFMOUSE |
| 9095 | if (item) |
| 9096 | { |
| 9097 | r = item->textRect; |
| 9098 | // r.y -= r.h; // NOt sure why this is here, but I commented it out. |
| 9099 | // in the text rect? |
| 9100 | |
| 9101 | // items can be enabled and disabled |
| 9102 | if (item->disabled) |
| 9103 | { |
| 9104 | return; |
| 9105 | } |
| 9106 | |
| 9107 | // items can be enabled and disabled based on cvars |
| 9108 | if (item->cvarFlags & (CVAR_ENABLE | CVAR_DISABLE) && !Item_EnableShowViaCvar(item, CVAR_ENABLE)) |
| 9109 | { |
| 9110 | return; |
| 9111 | } |
| 9112 | |
| 9113 | if (item->cvarFlags & (CVAR_SHOW | CVAR_HIDE) && !Item_EnableShowViaCvar(item, CVAR_SHOW)) |
| 9114 | { |
| 9115 | return; |
| 9116 | } |
| 9117 | |
| 9118 | //JLFMOUSE |
| 9119 | if (Rect_ContainsPoint(&r, x, y)) |
| 9120 | { |
| 9121 | if (!(item->window.flags & WINDOW_MOUSEOVERTEXT)) |
| 9122 | { |
| 9123 | Item_RunScript(item, item->mouseEnterText); |
| 9124 | item->window.flags |= WINDOW_MOUSEOVERTEXT; |
| 9125 | } |
| 9126 | |
| 9127 | if (!(item->window.flags & WINDOW_MOUSEOVER)) |
| 9128 | { |
| 9129 | Item_RunScript(item, item->mouseEnter); |
| 9130 | item->window.flags |= WINDOW_MOUSEOVER; |
| 9131 | } |
| 9132 | |
| 9133 | } |
| 9134 | else |
| 9135 | { |
| 9136 | // not in the text rect |
| 9137 | if (item->window.flags & WINDOW_MOUSEOVERTEXT) |
| 9138 | { |
| 9139 | // if we were |
| 9140 | Item_RunScript(item, item->mouseExitText); |
| 9141 | item->window.flags &= ~WINDOW_MOUSEOVERTEXT; |
| 9142 | } |
| 9143 | |
| 9144 | if (!(item->window.flags & WINDOW_MOUSEOVER)) |
| 9145 | { |
| 9146 | Item_RunScript(item, item->mouseEnter); |
| 9147 | item->window.flags |= WINDOW_MOUSEOVER; |
| 9148 | } |
no test coverage detected