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  * Prototypes and defines for gauges
23  *
24  */
25 
26 #pragma once
27 
28 #include "fwd-player.h"
29 
30 struct bitmap_index;
31 
32 #include "fwd-object.h"
33 #include "kconfig.h"
34 
35 //from gauges.c
36 
37 namespace dcx {
38 
39 enum class gauge_inset_window_view : unsigned
40 {
41 	primary,
42 	secondary,
43 };
44 
45 void show_mousefs_indicator(grs_canvas &canvas, int mx, int my, int mz, int x, int y, int size);
46 }
47 
48 #if defined(DXX_BUILD_DESCENT_I)
49 #define MAX_GAUGE_BMS_PC 80u		//	increased from 56 to 80 by a very unhappy MK on 10/24/94.
50 #define MAX_GAUGE_BMS_MAC 85u
51 #define MAX_GAUGE_BMS (MacPig ? MAX_GAUGE_BMS_MAC : MAX_GAUGE_BMS_PC)
52 
53 extern std::array<bitmap_index, MAX_GAUGE_BMS_MAC> Gauges;   // Array of all gauge bitmaps.
54 #elif defined(DXX_BUILD_DESCENT_II)
55 #define MAX_GAUGE_BMS 100u   // increased from 56 to 80 by a very unhappy MK on 10/24/94.
56 
57 extern std::array<bitmap_index, MAX_GAUGE_BMS> Gauges;      // Array of all gauge bitmaps.
58 extern std::array<bitmap_index, MAX_GAUGE_BMS> Gauges_hires;    // hires gauges
59 #endif
60 
61 // Flags for gauges/hud stuff
62 
63 #ifdef dsx
64 namespace dsx {
65 void add_points_to_score(player_info &, unsigned points, game_mode_flags);
66 void add_bonus_points_to_score(player_info &, unsigned points, game_mode_flags);
67 void render_gauges(grs_canvas &, game_mode_flags game_mode);
68 void init_gauges(void);
69 void draw_hud(grs_canvas &, const object &, const control_info &Controls, game_mode_flags);     // draw all the HUD stuff
70 }
71 #endif
72 void close_gauges(void);
73 #ifdef dsx
74 namespace dsx {
75 void show_reticle(grs_canvas &canvas, const player_info &, int reticle_type, int secondary_display);
76 void show_HUD_names(grs_canvas &, game_mode_flags);
77 }
78 #endif
79 
80 void player_dead_message(grs_canvas &);
81 //extern void say_afterburner_status(void);
82 
83 // from testgaug.c
84 
85 #ifdef dsx
86 namespace dsx {
87 extern void update_laser_weapon_info(void);
88 void play_homing_warning(const player_info &);
89 }
90 #endif
91 
92 struct rgb {
93 	ubyte r,g,b;
94 };
95 
96 using rgb_array_t = const std::array<rgb, MAX_PLAYERS>;
97 extern const rgb_array_t player_rgb_normal;
98 
99 /* Stub for mods that provide switchable player colors */
100 class rgb_array_wrapper
101 {
102 public:
103 	const rgb &operator[](std::size_t i) const
104 	{
105 		return player_rgb_normal[i];
106 	}
107 };
108 
109 constexpr rgb_array_wrapper player_rgb{};
110 
111 #if defined(DXX_BUILD_DESCENT_II)
112 namespace dsx {
113 
114 enum class weapon_box_user : uint8_t
115 {
116 	weapon,
117 	missile,
118 	escort,
119 	rear,
120 	coop,
121 	guided,
122 	marker,
123 	post_missile_static,
124 };
125 
126 // draws a 3d view into one of the cockpit windows.  win is 0 for
127 // left, 1 for right.  viewer is object.  NULL object means give up
128 // window user is one of the WBU_ constants.  If rear_view_flag is
129 // set, show a rear view.  If label is non-NULL, print the label at
130 // the top of the window.
131 void do_cockpit_window_view(grs_canvas &, gauge_inset_window_view win, const object &viewer, int rear_view_flag, weapon_box_user user, const char *label, const player_info * = nullptr);
132 void do_cockpit_window_view(gauge_inset_window_view win, weapon_box_user user);
133 }
134 #endif
135 
136 #define GAUGE_HUD_NUMMODES 4
137 
138 extern int	Color_0_31_0;
139 
140 // defines for the reticle(s)
141 #define RET_TYPE_CLASSIC        0
142 #define RET_TYPE_CLASSIC_REBOOT 1
143 #define RET_TYPE_NONE           2
144 #define RET_TYPE_X              3
145 #define RET_TYPE_DOT            4
146 #define RET_TYPE_CIRCLE         5
147 #define RET_TYPE_CROSS_V1       6
148 #define RET_TYPE_CROSS_V2       7
149 #define RET_TYPE_ANGLE          8
150 
151 #define RET_COLOR_DEFAULT_R     0
152 #define RET_COLOR_DEFAULT_G     32
153 #define RET_COLOR_DEFAULT_B     0
154 #define RET_COLOR_DEFAULT_A     0
155