Skip to content

Commit 85c812e

Browse files
committed
MENUQC: Add TIKHAYA NOCH to Menu, support Map Badges
1 parent c833aec commit 85c812e

4 files changed

Lines changed: 58 additions & 27 deletions

File tree

source/menu/defs/menu_defs.qc

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,16 +167,28 @@ var struct
167167
float user_maps_count;
168168
float user_maps_page;
169169

170+
// Different categories for maps
171+
#define MAP_CATEGORY_USER 0
172+
#define MAP_CATEGORY_WAW 1
173+
#define MAP_CATEGORY_NZP 2
174+
#define MAP_CATEGORY_NZPBETA 3
175+
#define MAP_CATEGORY_BLACKOPSDS 4
176+
170177
// Built-in (stock) maps, array_index
171178
// is populated later.
172179
var struct
173180
{
174181
string bsp_name;
182+
float map_category;
175183
float array_index;
176184
} stock_maps[] =
177185
{
178-
{"ndu", 0},
179-
{"nzp_warehouse", 0},
180-
{"nzp_warehouse2", 0},
181-
{"christmas_special", 0}
186+
{"ndu", MAP_CATEGORY_WAW, 0},
187+
{"nzp_warehouse2", MAP_CATEGORY_NZP, 0},
188+
{"nzp_xmas2", MAP_CATEGORY_NZP, 0},
189+
{"nzp_warehouse", MAP_CATEGORY_NZPBETA, 0},
190+
{"christmas_special", MAP_CATEGORY_NZPBETA, 0},
191+
{"lexi_house", MAP_CATEGORY_BLACKOPSDS, 0},
192+
{"lexi_temple", MAP_CATEGORY_BLACKOPSDS, 0},
193+
{"lexi_overlook", MAP_CATEGORY_BLACKOPSDS, 0},
182194
};

source/menu/m_menu.qc

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,12 @@ void(float order, string bind) Menu_DrawOptionKey =
220220
};
221221

222222
//
223-
// Menu_MapButton(order, id, bsp_name)
223+
// Menu_MapButton(order, id, bsp_name, map_category, usermap_index)
224224
// Displays a fancy menu option that loads
225225
// and draws the details for the given
226226
// .BSP.
227227
//
228-
float(float order, string id, string bsp_name, float usermap_index) Menu_MapButton =
228+
float(float order, string id, string bsp_name, float map_category, float usermap_index) Menu_MapButton =
229229
{
230230
sui_set_align([SUI_ALIGN_START, SUI_ALIGN_START]);
231231

@@ -281,6 +281,22 @@ float(float order, string id, string bsp_name, float usermap_index) Menu_MapButt
281281
sui_text([150, 30 + (i * 14)], MENU_TEXT_SMALL, user_maps[index].map_desc[i], [1, 1, 1], 1, 0);
282282
}
283283

284+
// Map Badge
285+
string badge_name = "";
286+
vector coords_size = [0.25, 0.5];
287+
vector coords_pos = [0, 0];
288+
289+
switch(map_category) {
290+
case MAP_CATEGORY_NZPBETA: coords_pos = [0, 0]; badge_name = "NZ:P BETA (2011)"; break;
291+
case MAP_CATEGORY_WAW: coords_pos = [0.25, 0]; badge_name = "WORLD AT WAR"; break;
292+
case MAP_CATEGORY_NZP: coords_pos = [0, 0.5]; badge_name = "NZ:P ORIGINAL"; break;
293+
case MAP_CATEGORY_BLACKOPSDS: coords_pos = [0.25, 0.5]; badge_name = "BLACK OPS (DS)"; break;
294+
case MAP_CATEGORY_USER: coords_pos = [0.5, 0]; badge_name = "USERMAP"; break;
295+
}
296+
297+
sui_text([30 + (getTextWidth(badge_name, MENU_TEXT_SUPERSMALL_x)/2), 5], MENU_TEXT_SUPERSMALL, badge_name, [1, 1, 0], 1, 0);
298+
sui_subpic([12, 4], [20, 20], "gfx/menu/map_badges", [1, 1, 1], coords_pos, coords_size, 1, 0);
299+
284300
// Author/Description
285301
if (user_maps[index].map_author != "") {
286302
sui_set_align([SUI_ALIGN_CENTER, SUI_ALIGN_END]);

source/menu/main.qc

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -107,29 +107,12 @@ void() Menu_MapFinder =
107107
maps = search_begin("maps/*.bsp", 0, 0);
108108
user_maps_count = search_getsize(maps);
109109

110-
//custom_map_pages = ceil(map_count/10);
111-
112-
//float stock_step_back; // So stock maps aren't appended to user maps..
113110
for (float i = 0; i < user_maps_count; i++) {
114-
//float index = i - stock_step_back;
115111
float index = i;
116112

117113
user_maps[index].occupied = TRUE;
118114
user_maps[index].map_name = strip_custominfo(search_getfilename(maps, i));
119115

120-
// float is_stock;
121-
// for(int j = 0; j < stock_maps.length; j++) {
122-
// if (user_maps[index].map_name == stock_maps[j].bsp_name) {
123-
// stock_step_back++;
124-
// is_stock = true;
125-
// break;
126-
// }
127-
// }
128-
129-
// // Don't bother occupying if this map is built in.
130-
// if (is_stock)
131-
// return;
132-
133116
float settings = fopen(strcat("maps/", user_maps[index].map_name, ".txt"), FILE_READ);
134117
if (settings != -1) {
135118
user_maps[index].map_name_pretty = fgets(settings);
@@ -148,7 +131,6 @@ void() Menu_MapFinder =
148131
}
149132

150133
}
151-
//user_maps_count -= stock_step_back;
152134

153135
search_end(maps);
154136
};

source/menu/menu_maps.qc

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ void() Menu_Maps_Init =
1515
user_maps_page = 0;
1616

1717
for(int i = 0; i < stock_maps.length; i++) {
18+
if (stock_maps[i].bsp_name == "")
19+
continue;
20+
1821
for(int j = 0; j < user_maps_count; j++) {
1922
if (user_maps[j].map_name == stock_maps[i].bsp_name)
2023
stock_maps[i].array_index = j;
@@ -129,11 +132,19 @@ void() Menu_Maps =
129132

130133
// Stock Maps
131134
if (menu_map_mode == MAP_SOLOSTOCK || menu_map_mode == MAP_COOPSTOCK) {
135+
int blank_map_spots = 0;
136+
132137
for(i = 0; i < stock_maps.length; i++) {
138+
if (stock_maps[i].bsp_name == "") {
139+
blank_map_spots++;
140+
Menu_DrawDivider(i + 1.25);
141+
continue;
142+
}
143+
133144
// Build the map strings
134-
menu_maps_buttons[i] = sprintf("map_%s", stock_maps[i].bsp_name);
145+
menu_maps_buttons[i - blank_map_spots] = sprintf("map_%s", stock_maps[i].bsp_name);
135146

136-
Menu_MapButton(i + 1, sprintf("map_%s", stock_maps[i].bsp_name), stock_maps[i].bsp_name, -1) ? Menu_Maps_LoadMap(stock_maps[i].bsp_name) : 0;
147+
Menu_MapButton(i + 1, sprintf("map_%s", stock_maps[i].bsp_name), stock_maps[i].bsp_name, stock_maps[i].map_category, -1) ? Menu_Maps_LoadMap(stock_maps[i].bsp_name) : 0;
137148
}
138149
Menu_DrawDivider(i + 1.25);
139150

@@ -169,7 +180,17 @@ void() Menu_Maps =
169180
// Build the map strings
170181
menu_maps_buttons[menu_position - 1] = sprintf("map_%s", bsp_name);
171182

172-
Menu_MapButton(menu_position, sprintf("map_%s", bsp_name), bsp_name, i) ? Menu_Maps_LoadMap(bsp_name) : 0;
183+
// Kind of a hack but whatever..
184+
// Make sure we keep the correct badge when viewing
185+
// official maps in the user maps menu.
186+
float map_category = MAP_CATEGORY_USER;
187+
for(int j = 0; j < stock_maps.length; j++) {
188+
if (user_maps[i].map_name == stock_maps[j].bsp_name) {
189+
map_category = stock_maps[j].map_category;
190+
}
191+
}
192+
193+
Menu_MapButton(menu_position, sprintf("map_%s", bsp_name), bsp_name, map_category, i) ? Menu_Maps_LoadMap(bsp_name) : 0;
173194
}
174195

175196
int current_registry_position = ((i + 1) - (user_maps_page * 10)) - 1;

0 commit comments

Comments
 (0)