Skip to content

Commit 7cf6516

Browse files
authored
MENU: Add Character Bios menu (#160)
* MENU: Add Character Bio menu * MENU: Update portrait graphics name
1 parent 4f12006 commit 7cf6516

6 files changed

Lines changed: 536 additions & 3 deletions

File tree

progs/menu.src

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ menu_load.qc // Loading Screen
2525
menu_coop.qc // Co-op Menu
2626
menu_gset.qc // Game Settings
2727
menu_loby.qc // Lobby Menu
28+
menu_bios.qc // Character Bios
2829

2930
main.qc
3031
#endlist

source/menu/defs/menu_defs.qc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ enum {
5757
MENU_GAMEPAD,
5858
MENU_BINDINGS,
5959
MENU_ACCESSIBILITY,
60+
MENU_BIOS,
6061
MENU_CREDITS,
6162
MENU_PAUSE,
6263
MENU_LOBBY,
@@ -80,6 +81,7 @@ void() Menu_Coop_Join;
8081
void() Menu_Coop_Browse;
8182
void() Menu_Coop_Direct;
8283
void() Menu_Coop_Create;
84+
void() Menu_Bios;
8385
void() Menu_Credits;
8486
void() Menu_Lobby;
8587
void() Menu_GameSettings;
@@ -124,6 +126,9 @@ string(string next_id) Menu_Lobby_GetPreviousButton;
124126
string(string prev_id) Menu_GameSettings_GetNextButton;
125127
string(string next_id) Menu_GameSettings_GetPreviousButton;
126128

129+
string(string prev_id) Menu_Bios_GetNextButton;
130+
string(string next_id) Menu_Bios_GetPreviousButton;
131+
127132
#else
128133

129134
string(string prev_id) Menu_Pause_GetNextButton;

source/menu/m_menu.qc

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,44 @@ void(string line_1, string line_2) Menu_DrawYesNoPanel =
156156
sui_set_align([SUI_ALIGN_START, SUI_ALIGN_START]);
157157
};
158158

159+
//
160+
// Menu_DrawCharacterPanel()
161+
// Draws a ribbon over the screen used
162+
// for lengthy character bios.
163+
//
164+
void(string l1, string l2, string l3, string l4, string l5, string l6, string l7, string l8, string l9, string l10, string l11, string l12, string l13, string l14, string l15, string l16, string l17) Menu_DrawCharacterPanel =
165+
{
166+
sui_set_align([SUI_ALIGN_START, SUI_ALIGN_START]);
167+
sui_fill([0, 0], sui_current_frame_size(), [0.01, 0, 0], 0.5, 0);
168+
169+
// Black Fill
170+
sui_fill([0, 50], [sui_current_frame_size()[0], sui_current_frame_size()[1] - 100], [0, 0, 0], 1, 0);
171+
172+
// Yellow borders
173+
sui_fill([0, 50], [sui_current_frame_size()[0], 3], [1, 1, 0], 0.9, 0);
174+
sui_fill([0, sui_current_frame_size()[1] - 53], [sui_current_frame_size()[0], 3], [1, 1, 0], 0.9, 0);
175+
176+
sui_set_align([SUI_ALIGN_CENTER, SUI_ALIGN_START]);
177+
sui_text([0, 110], MENU_TEXT_MEDIUM, l1, [1, 1, 1], 1, 0);
178+
sui_text([0, 125], MENU_TEXT_MEDIUM, l2, [1, 1, 1], 1, 0);
179+
sui_text([0, 140], MENU_TEXT_MEDIUM, l3, [1, 1, 1], 1, 0);
180+
sui_text([0, 155], MENU_TEXT_MEDIUM, l4, [1, 1, 1], 1, 0);
181+
sui_text([0, 170], MENU_TEXT_MEDIUM, l5, [1, 1, 1], 1, 0);
182+
sui_text([0, 185], MENU_TEXT_MEDIUM, l6, [1, 1, 1], 1, 0);
183+
sui_text([0, 200], MENU_TEXT_MEDIUM, l7, [1, 1, 1], 1, 0);
184+
sui_text([0, 215], MENU_TEXT_MEDIUM, l8, [1, 1, 1], 1, 0);
185+
sui_text([0, 230], MENU_TEXT_MEDIUM, l9, [1, 1, 1], 1, 0);
186+
sui_text([0, 245], MENU_TEXT_MEDIUM, l10, [1, 1, 1], 1, 0);
187+
sui_text([0, 260], MENU_TEXT_MEDIUM, l11, [1, 1, 1], 1, 0);
188+
sui_text([0, 275], MENU_TEXT_MEDIUM, l12, [1, 1, 1], 1, 0);
189+
sui_text([0, 290], MENU_TEXT_MEDIUM, l13, [1, 1, 1], 1, 0);
190+
sui_text([0, 305], MENU_TEXT_MEDIUM, l14, [1, 1, 1], 1, 0);
191+
sui_text([0, 320], MENU_TEXT_MEDIUM, l15, [1, 1, 1], 1, 0);
192+
sui_text([0, 335], MENU_TEXT_MEDIUM, l16, [1, 1, 1], 1, 0);
193+
sui_text([0, 350], MENU_TEXT_MEDIUM, l17, [1, 1, 1], 1, 0);
194+
sui_set_align([SUI_ALIGN_START, SUI_ALIGN_START]);
195+
};
196+
159197
//
160198
// Menu_DrawMapPanel()
161199
// Draws a translucent box on the right
@@ -222,6 +260,55 @@ void(float order, string bind) Menu_DrawOptionKey =
222260
}
223261
};
224262

263+
//
264+
// Menu_BioButton(order, id, char_name, map, portrait, coords)
265+
// Displays a fancy menu option that loads
266+
// and draws the details for the given
267+
// character in the Bios menu.
268+
//
269+
float(float order, string id, string char_name, string map, string portrait, vector coords) Menu_BioButton =
270+
{
271+
sui_set_align([SUI_ALIGN_START, SUI_ALIGN_START]);
272+
273+
float is_hovered = sui_is_hovered(id);
274+
vector text_color = is_hovered ? [1, 0, 0] : [1, 1, 1];
275+
vector position = [6, 50 + (order * 25)];
276+
vector bbox_pos = position - [6, 5, 0];
277+
vector bbox_size = [290, 22];
278+
279+
if (is_hovered) {
280+
// Background
281+
sui_fill(bbox_pos, bbox_size, [0, 0, 0], 0.9, 0);
282+
// Top
283+
sui_fill(bbox_pos, [bbox_size_x, 2], [0.4, 0, 0], 1, 0);
284+
// Bottom
285+
sui_fill(bbox_pos + [0, bbox_size_y - 2], [bbox_size_x, 2], [0.4, 0, 0], 1, 0);
286+
// Right
287+
sui_fill(bbox_pos + [bbox_size_x - 2, 0], [2, bbox_size_y], [0.4, 0, 0], 1, 0);
288+
}
289+
290+
// Character Name
291+
sui_text(position - [getTextWidth(char_name, MENU_TEXT_MEDIUM_x), 0, 0] + [275, 0, 0], MENU_TEXT_MEDIUM, strtoupper(char_name), text_color, 1, 0);
292+
293+
if (is_hovered) {
294+
sui_set_align([SUI_ALIGN_CENTER, SUI_ALIGN_CENTER]);
295+
296+
// Character Portrait
297+
sui_fill([150, -30], [264, 264], [0.4, 0.4, 0.4], 1, 0);
298+
sui_subpic([150, -30], [260, 260], strcat("gfx/portraits/", portrait), [1, 1, 1], coords, [0.5, 0.5], 1, 0);
299+
300+
// Map
301+
sui_set_align([SUI_ALIGN_CENTER, SUI_ALIGN_END]);
302+
sui_text([0, -30], MENU_TEXT_MEDIUM, map, [1, 1, 0], 1, 0);
303+
304+
sui_set_align([SUI_ALIGN_START, SUI_ALIGN_START]);
305+
}
306+
307+
sui_action_element(bbox_pos, bbox_size, id, sui_noop);
308+
309+
return sui_is_clicked(id);
310+
}
311+
225312
//
226313
// Menu_MapButton(order, id, bsp_name, map_category, usermap_index)
227314
// Displays a fancy menu option that loads
@@ -935,6 +1022,7 @@ void(vector size) root_menu =
9351022
case MENU_CREDITS: Menu_Credits(); break;
9361023
case MENU_LOBBY: Menu_Lobby(); break;
9371024
case MENU_GAMESETTINGS: Menu_GameSettings(); break;
1025+
case MENU_BIOS: Menu_Bios(); break;
9381026

9391027
#else
9401028

0 commit comments

Comments
 (0)