* Get an input from the history buffer. * @param index Current index in the history. * @return Read input. * @note Provided \a index gets updated and written to #historyHead */
| 262 | * @note Provided \a index gets updated and written to #historyHead |
| 263 | */ |
| 264 | static uint16 Input_ReadHistory(uint16 index) |
| 265 | { |
| 266 | uint16 value; |
| 267 | |
| 268 | if (g_mouseMode != INPUT_MOUSE_MODE_PLAY) g_mouseInputValue = s_history[index / 2]; |
| 269 | value = g_mouseInputValue; |
| 270 | index = (index + 2) & 0xFF; |
| 271 | |
| 272 | if ((value & 0xFF) >= 0x41) { |
| 273 | if ((value & 0xFF) <= 0x42) { |
| 274 | if (g_mouseMode != INPUT_MOUSE_MODE_PLAY) g_mouseRecordedX = s_history[index / 2]; |
| 275 | g_mouseClickX = g_mouseRecordedX; |
| 276 | index = (index + 2) & 0xFF; |
| 277 | |
| 278 | if (g_mouseMode != INPUT_MOUSE_MODE_PLAY) g_mouseRecordedY = s_history[index / 2]; |
| 279 | g_mouseClickY = g_mouseRecordedY; |
| 280 | index = (index + 2) & 0xFF; |
| 281 | } else if ((value & 0xFF) <= 0x44) { |
| 282 | if (g_mouseMode != INPUT_MOUSE_MODE_PLAY) g_mouseRecordedX = s_history[index / 2]; |
| 283 | index = (index + 2) & 0xFF; |
| 284 | |
| 285 | if (g_mouseMode != INPUT_MOUSE_MODE_PLAY) g_mouseRecordedY = s_history[index / 2]; |
| 286 | index = (index + 2) & 0xFF; |
| 287 | } |
| 288 | } |
| 289 | if (g_mouseMode != INPUT_MOUSE_MODE_PLAY) s_historyHead = index; |
| 290 | return value; |
| 291 | } |
| 292 | |
| 293 | /** |
| 294 | * Add a value to the history buffer. |
no outgoing calls
no test coverage detected