Displays a 'temporary' dialog with a message for example: ... DoWaitMessage(true,"Please Wait..."); ... //some code DoWaitMessage(false);
| 483 | // ... //some code |
| 484 | // DoWaitMessage(false); |
| 485 | void DoWaitMessage(bool enable, const char *message) { |
| 486 | static bool opened = false; |
| 487 | static uint8_t cur_pos = 0; |
| 488 | float curpos_f; |
| 489 | |
| 490 | // if (1) return; |
| 491 | |
| 492 | if (Dedicated_server) |
| 493 | return; |
| 494 | if (!enable && !opened) |
| 495 | return; |
| 496 | if (GetScreenMode() != SM_MENU) { |
| 497 | opened = false; |
| 498 | return; |
| 499 | } |
| 500 | if (enable && !opened) { |
| 501 | opened = true; |
| 502 | cur_pos = -1; |
| 503 | } |
| 504 | if (!enable && opened) { |
| 505 | opened = false; |
| 506 | return; |
| 507 | } |
| 508 | |
| 509 | // render a ui frame |
| 510 | DoUIFrame(); |
| 511 | cur_pos++; |
| 512 | if (cur_pos > 10) |
| 513 | cur_pos = 0; |
| 514 | curpos_f = (cur_pos / 10.0f); |
| 515 | |
| 516 | // print our downloading data message. |
| 517 | g3Point *pntlist[4], points[4]; |
| 518 | int i, rx, ry, rw, rh; |
| 519 | |
| 520 | StartFrame(0, 0, Max_window_w, Max_window_h); |
| 521 | grtext_SetFont(MONITOR9_NEWUI_FONT); |
| 522 | rw = Max_window_w; |
| 523 | rh = grfont_GetHeight(MONITOR9_NEWUI_FONT) + 8; |
| 524 | rx = 0; |
| 525 | ry = Max_window_h - rh; |
| 526 | points[0].p3_sx = rx; |
| 527 | points[0].p3_sy = ry; |
| 528 | points[1].p3_sx = rx + rw; |
| 529 | points[1].p3_sy = ry; |
| 530 | points[2].p3_sx = rx + rw; |
| 531 | points[2].p3_sy = ry + rh; |
| 532 | points[3].p3_sx = rx; |
| 533 | points[3].p3_sy = ry + rh; |
| 534 | |
| 535 | for (i = 0; i < 4; i++) { |
| 536 | points[i].p3_z = 0; |
| 537 | points[i].p3_flags = PF_PROJECTED; |
| 538 | pntlist[i] = &points[i]; |
| 539 | } |
| 540 | |
| 541 | rend_SetZBufferState(0); |
| 542 | rend_SetTextureType(TT_FLAT); |
no test coverage detected