| 490 | } |
| 491 | } |
| 492 | void MenuItem::Draw(int x, int y, int height, int bmp, float *not_used) { |
| 493 | int old_font = DLLgrtext_GetFont(); |
| 494 | DLLgrtext_SetFont(basethis->Game_fonts[HUD_FONT_INDEX]); |
| 495 | |
| 496 | /* |
| 497 | static float aspratio; |
| 498 | if(!ratio){ |
| 499 | //we need to calculate a ratio |
| 500 | aspratio = DEFAULT_HUD_WIDTH / ((float)*base->Game_window_w); |
| 501 | } |
| 502 | |
| 503 | float useratio; |
| 504 | if(!ratio) useratio = aspratio; else useratio = *ratio; |
| 505 | */ |
| 506 | |
| 507 | uint8_t alpha_to_use = 255; |
| 508 | |
| 509 | #define FLASHRATE 700.0 // alphas per second |
| 510 | |
| 511 | int16_t a = m_Alpha; |
| 512 | int units = (int)FLASHRATE * (*basethis->Frametime); |
| 513 | |
| 514 | // do alphaing effect |
| 515 | while (units > 0) { |
| 516 | if (m_AlphaDir) { |
| 517 | // find the amount to adjust |
| 518 | uint8_t amount = std::min<int>(255 - a, units); |
| 519 | units -= amount; |
| 520 | a += amount; |
| 521 | if (a >= 255) { |
| 522 | a = 255; |
| 523 | m_AlphaDir = false; |
| 524 | } |
| 525 | } else { |
| 526 | // find the amount to adjust |
| 527 | uint8_t amount = std::min<int>(a, units); |
| 528 | units -= amount; |
| 529 | a -= amount; |
| 530 | if (a <= 0) { |
| 531 | a = 0; |
| 532 | m_AlphaDir = true; |
| 533 | } |
| 534 | } |
| 535 | } |
| 536 | |
| 537 | m_Alpha = alpha_to_use = (uint8_t)a; |
| 538 | |
| 539 | ddgr_color color; |
| 540 | int temp, maxx; |
| 541 | temp = maxx = 0; |
| 542 | char buff[256]; |
| 543 | char checked[3]; |
| 544 | char buffer[100]; |
| 545 | |
| 546 | if (SubMenuCount <= 0) { |
| 547 | DLLgrtext_SetFont(old_font); |
| 548 | return; |
| 549 | } |
no test coverage detected