Debian Codegraph @

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