| 98 | } |
| 99 | |
| 100 | static void menuUpdateAnimation(menu_s* menu, float maxScroll, float val) |
| 101 | { |
| 102 | if (menu->perturbed) |
| 103 | { |
| 104 | menu->scrollTarget = menuGetEntryPos(menu, menu->curEntry) - menu->scrollLocation; |
| 105 | float borderBot = 240.0f - g_imageData[images_appbubble_idx].height - 4; |
| 106 | if (menu->scrollTarget > borderBot || (maxScroll > 0.0f && menu->curEntry==(menu->nEntries-1))) |
| 107 | menu->scrollVelocity += (menu->scrollTarget - borderBot) / SCROLLING_SPEED; |
| 108 | if (menu->scrollTarget < 0.0f || (maxScroll > 0.0f && menu->curEntry==0)) |
| 109 | menu->scrollVelocity += menu->scrollTarget / SCROLLING_SPEED; |
| 110 | } else if (maxScroll > 0.0f) |
| 111 | { |
| 112 | if (menu->scrollLocation >= maxScroll) |
| 113 | { |
| 114 | menu->scrollVelocity += (maxScroll - menu->scrollLocation) / SCROLLING_SPEED; |
| 115 | if (val > 0.0f) menu->scrollVelocity -= val; |
| 116 | } else if (menu->scrollLocation < 0.0f) |
| 117 | { |
| 118 | menu->scrollVelocity -= menu->scrollLocation / SCROLLING_SPEED; |
| 119 | if (val < 0.0f) menu->scrollVelocity -= val; |
| 120 | } else |
| 121 | menu->scrollVelocity -= val; |
| 122 | } |
| 123 | |
| 124 | menu->scrollLocation += menu->scrollVelocity; |
| 125 | menu->scrollVelocity *= 0.75f; |
| 126 | if (fabs(menu->scrollVelocity) < (1.0f/1024)) |
| 127 | { |
| 128 | menu->scrollVelocity = 0.0f; |
| 129 | menu->perturbed = false; |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | void menuUpdate(void) |
| 134 | { |
no test coverage detected