(menuframework_s m, int dir)
| 4383 | * next available * slot. |
| 4384 | */ |
| 4385 | static void Menu_AdjustCursor(menuframework_s m, int dir) { |
| 4386 | menucommon_s citem; |
| 4387 | |
| 4388 | /* |
| 4389 | * * see if it's in a valid spot |
| 4390 | */ |
| 4391 | if (m.cursor >= 0 && m.cursor < m.nitems) { |
| 4392 | if ((citem = Menu_ItemAtCursor(m)) != null) { |
| 4393 | if (citem.type != MTYPE_SEPARATOR) |
| 4394 | return; |
| 4395 | } |
| 4396 | } |
| 4397 | |
| 4398 | /* |
| 4399 | * * it's not in a valid spot, so crawl in the direction indicated until |
| 4400 | * we * find a valid spot |
| 4401 | */ |
| 4402 | if (dir == 1) { |
| 4403 | while (true) { |
| 4404 | citem = Menu_ItemAtCursor(m); |
| 4405 | if (citem != null) |
| 4406 | if (citem.type != MTYPE_SEPARATOR) |
| 4407 | break; |
| 4408 | m.cursor += dir; |
| 4409 | if (m.cursor >= m.nitems) |
| 4410 | m.cursor = 0; |
| 4411 | } |
| 4412 | } else { |
| 4413 | while (true) { |
| 4414 | citem = Menu_ItemAtCursor(m); |
| 4415 | if (citem != null) |
| 4416 | if (citem.type != MTYPE_SEPARATOR) |
| 4417 | break; |
| 4418 | m.cursor += dir; |
| 4419 | if (m.cursor < 0) |
| 4420 | m.cursor = m.nitems - 1; |
| 4421 | } |
| 4422 | } |
| 4423 | } |
| 4424 | |
| 4425 | static void Menu_Center(menuframework_s menu) { |
| 4426 | int height; |
no test coverage detected