Debian Codegraph @

common/main/menu.h

raw
1 /*
2 * Portions of this file are copyright Rebirth contributors and licensed as
3 * described in COPYING.txt.
4 * Portions of this file are copyright Parallax Software and licensed
5 * according to the Parallax license below.
6 * See COPYING.txt for license details.
7
8 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
9 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
10 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
11 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
12 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
13 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
14 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
15 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
16 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
17 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
18 */
19
20 /*
21 *
22 * Menu prototypes and variables
23 *
24 */
25
26 #ifndef _MENU_H
27 #define _MENU_H
28
29 #include <array>
30 #include <chrono>
31 #include "dsx-ns.h"
32 #include "strutil.h"
33
34 namespace dcx {
35
36 template <typename Rep>
37 using human_readable_mmss_time = std::array<char, number_to_text_length<std::numeric_limits<Rep>::max() / 60> + number_to_text_length<60> + sizeof("ms")>;
38
39 [[nodiscard]]
40 human_readable_mmss_time<uint16_t> build_human_readable_time(const std::chrono::duration<uint16_t, std::chrono::seconds::period> duration);
41
42 template <typename Rep, std::size_t S>
43 void parse_human_readable_time(std::chrono::duration<Rep, std::chrono::seconds::period> &duration, const std::array<char, S> &buf);
44
45 }
46
47 extern int hide_menus(void);
48 extern void show_menus(void);
49
50 #ifdef DXX_BUILD_DESCENT
51 namespace dsx {
52 // returns number of item chosen
53 extern int DoMenu();
54 }
55 #endif
56 extern void do_options_menu();
57
58 #ifdef DXX_BUILD_DESCENT
59 #if DXX_BUILD_DESCENT == 1
60 #define Menu_pcx_name (((SWIDTH >= 640 && SHEIGHT >= 480) && PHYSFS_exists("menuh.pcx")) ? "menuh.pcx" : "menu.pcx")
61 #define STARS_BACKGROUND (((SWIDTH >= 640 && SHEIGHT >= 480) && PHYSFS_exists("starsb.pcx")) ? "starsb.pcx" : "stars.pcx")
62 #elif DXX_BUILD_DESCENT == 2
63 #define MENU_PCX_MAC_SHARE ("menub.pcx")
64 #define MENU_PCX_SHAREWARE ("menud.pcx")
65 #define MENU_PCX_OEM (HIRESMODE?"menuob.pcx":"menuo.pcx")
66 #define MENU_PCX_FULL (HIRESMODE?"menub.pcx":"menu.pcx")
67
68 // name of background bitmap
69 #define Menu_pcx_name (PHYSFS_exists(MENU_PCX_FULL) ? MENU_PCX_FULL : (PHYSFS_exists(MENU_PCX_OEM) ? MENU_PCX_OEM : PHYSFS_exists(MENU_PCX_SHAREWARE) ? MENU_PCX_SHAREWARE : MENU_PCX_MAC_SHARE))
70 #define STARS_BACKGROUND ((HIRESMODE && PHYSFS_exists("starsb.pcx")) ? "starsb.pcx" : PHYSFS_exists("stars.pcx") ? "stars.pcx" : "starsb.pcx")
71 #endif
72 #endif
73
74 #endif /* _MENU_H */