MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / DemoPostPlaybackMenu

Function DemoPostPlaybackMenu

Descent3/demofile.cpp:1525–1594  ·  view source on GitHub ↗

Display options and statistics after displaying a demofile

Source from the content-addressed store, hash-verified

1523
1524// Display options and statistics after displaying a demofile
1525void DemoPostPlaybackMenu(void) {
1526#define DEMO_MENU_WIDTH 320
1527#define DEMO_MENU_HEIGHT 192
1528#define BTN_WIDTH 96
1529#define UID_LOOPING 200
1530 NewUIGameWindow window;
1531 NewUIButton ok_btn;
1532 NewUIButton cancel_btn;
1533 NewUIButton loop_btn;
1534 UIText wndtitle, fps_min, fps_avg, fps_max;
1535 bool exit_menu = false, ret = true;
1536 int cury = 9;
1537 char sztemp[200] = "";
1538
1539 window.Create(0, 0, DEMO_MENU_WIDTH, DEMO_MENU_HEIGHT, UIF_PROCESS_MENU | UIF_CENTER | NUWF_TITLELARGE);
1540 UITextItem itemTitle{TXT_DEMO_PLAY_OPTIONS};
1541 wndtitle.Create(&window, &itemTitle, 0, cury, UIF_CENTER | UIF_FIT);
1542 cury += 30;
1543 if (Demo_play_fast) {
1544 snprintf(sztemp, sizeof(sztemp), TXT_MINFPS, (float)1 / Max_frametime);
1545 UITextItem itemFpsMin{sztemp};
1546 fps_min.Create(&window, &itemFpsMin, 0, cury, UIF_CENTER | UIF_FIT);
1547 cury += 20;
1548 snprintf(sztemp, sizeof(sztemp), TXT_MAXFPS, (float)1 / Min_frametime);
1549 UITextItem itemFpsMax{sztemp};
1550 fps_max.Create(&window, &itemFpsMax, 0, cury, UIF_CENTER | UIF_FIT);
1551 cury += 20;
1552 snprintf(sztemp, sizeof(sztemp), TXT_AVGFSP, (float)1 / (Avg_frametime / Frames_counted));
1553 UITextItem itemFpsAvg{sztemp};
1554 fps_avg.Create(&window, &itemFpsAvg, 0, cury, UIF_CENTER | UIF_FIT);
1555 cury += 20;
1556 }
1557 // cury+=20;
1558 UITextItem itemLooping{TXT_PLAYLOOPING};
1559 loop_btn.Create(&window, UID_LOOPING, &itemLooping, 0, cury, BTN_WIDTH * 1.5, 32, UIF_CENTER | UIF_FIT);
1560 cury += 35;
1561
1562 UITextItem itemDone{TXT_DONE};
1563 ok_btn.Create(&window, UID_OK, &itemDone, 0, DEMO_MENU_HEIGHT - 70, BTN_WIDTH, 32, UIF_CENTER | UIF_FIT);
1564
1565 window.Open();
1566
1567 while (!exit_menu) {
1568 int res = DoUI();
1569
1570 switch (res) {
1571 case UID_LOOPING:
1572 Game_interface_mode = GAME_DEMO_LOOP;
1573 strcpy(Demo_fname, Old_demo_fname);
1574 Demo_looping = true;
1575 exit_menu = true;
1576 ret = true;
1577 break;
1578 case NEWUIRES_FORCEQUIT:
1579 case UID_OK:
1580 exit_menu = true;
1581 ret = true;
1582 if ((Players[Player_num].flags & PLAYER_FLAGS_DYING) || (Players[Player_num].flags & PLAYER_FLAGS_DEAD)) {

Callers 1

RunGameMenuFunction · 0.85

Calls 7

DoUIFunction · 0.85
EndPlayerDeathFunction · 0.85
SetFunctionModeFunction · 0.85
CreateMethod · 0.45
OpenMethod · 0.45
CloseMethod · 0.45
DestroyMethod · 0.45

Tested by

no test coverage detected