1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-22 23:33:04 +01:00

add DLC and Build your own scenario classification

This commit is contained in:
IntelOrca
2016-01-02 20:40:24 +00:00
parent a4e919b023
commit ededc82cba
8 changed files with 103 additions and 45 deletions

View File

@@ -3969,7 +3969,8 @@ STR_5627 :Group scenario list by:
STR_5628 :Source game STR_5628 :Source game
STR_5629 :Difficulty level STR_5629 :Difficulty level
STR_5630 :Enable unlocking of scenarios STR_5630 :Enable unlocking of scenarios
STR_5631 :{GREY}{STRINGID} STR_5631 :Original DLC Parks
STR_5632 :Build your own...
############# #############
# Scenarios # # Scenarios #

View File

@@ -2254,6 +2254,9 @@ enum {
STR_OPTIONS_SCENARIO_DIFFICULTY = 5629, STR_OPTIONS_SCENARIO_DIFFICULTY = 5629,
STR_OPTIONS_SCENARIO_UNLOCKING = 5630, STR_OPTIONS_SCENARIO_UNLOCKING = 5630,
STR_DLC_PARKS = 5631,
STR_BUILD_YOUR_OWN_PARKS = 5632,
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
STR_COUNT = 32768 STR_COUNT = 32768
}; };

View File

@@ -45,6 +45,17 @@
#include "world/sprite.h" #include "world/sprite.h"
#include "world/water.h" #include "world/water.h"
const rct_string_id ScenarioCategoryStringIds[SCENARIO_CATEGORY_COUNT] = {
STR_BEGINNER_PARKS,
STR_CHALLENGING_PARKS,
STR_EXPERT_PARKS,
STR_REAL_PARKS,
STR_OTHER_PARKS,
STR_DLC_PARKS,
STR_BUILD_YOUR_OWN_PARKS,
};
static char _scenarioPath[MAX_PATH]; static char _scenarioPath[MAX_PATH];
static const char *_scenarioFileName = ""; static const char *_scenarioFileName = "";

View File

@@ -398,11 +398,18 @@ enum {
#define S6_MAGIC_NUMBER 0x00031144 #define S6_MAGIC_NUMBER 0x00031144
enum { enum {
// RCT2 categories (keep order)
SCENARIO_CATEGORY_BEGINNER, SCENARIO_CATEGORY_BEGINNER,
SCENARIO_CATEGORY_CHALLENGING, SCENARIO_CATEGORY_CHALLENGING,
SCENARIO_CATEGORY_EXPERT, SCENARIO_CATEGORY_EXPERT,
SCENARIO_CATEGORY_REAL, SCENARIO_CATEGORY_REAL,
SCENARIO_CATEGORY_OTHER SCENARIO_CATEGORY_OTHER,
// OpenRCT2 categories
SCENARIO_CATEGORY_DLC,
SCENARIO_CATEGORY_BUILD_YOUR_OWN,
SCENARIO_CATEGORY_COUNT
}; };
enum { enum {
@@ -455,6 +462,8 @@ typedef struct {
uint8 category; uint8 category;
} source_desc; } source_desc;
extern const rct_string_id ScenarioCategoryStringIds[SCENARIO_CATEGORY_COUNT];
// Scenario list // Scenario list
extern int gScenarioListCount; extern int gScenarioListCount;
extern int gScenarioListCapacity; extern int gScenarioListCapacity;

View File

@@ -37,7 +37,7 @@ scenario_highscore_entry *gScenarioHighscoreList = NULL;
static void scenario_list_include(const utf8 *directory); static void scenario_list_include(const utf8 *directory);
static void scenario_list_add(const utf8 *path, uint64 timestamp); static void scenario_list_add(const utf8 *path, uint64 timestamp);
static void scenario_list_sort(); static void scenario_list_sort();
static int scenario_list_sort_by_name(const void *a, const void *b); static int scenario_list_sort_by_category(const void *a, const void *b);
static int scenario_list_sort_by_index(const void *a, const void *b); static int scenario_list_sort_by_index(const void *a, const void *b);
static void scenario_translate(scenario_index_entry *scenarioEntry, const rct_object_entry *stexObjectEntry); static void scenario_translate(scenario_index_entry *scenarioEntry, const rct_object_entry *stexObjectEntry);
@@ -222,19 +222,29 @@ static void scenario_list_sort()
compareFunc = gConfigGeneral.scenario_select_mode == SCENARIO_SELECT_MODE_ORIGIN ? compareFunc = gConfigGeneral.scenario_select_mode == SCENARIO_SELECT_MODE_ORIGIN ?
scenario_list_sort_by_index : scenario_list_sort_by_index :
scenario_list_sort_by_name; scenario_list_sort_by_category;
qsort(gScenarioList, gScenarioListCount, sizeof(scenario_index_entry), compareFunc); qsort(gScenarioList, gScenarioListCount, sizeof(scenario_index_entry), compareFunc);
} }
static int scenario_list_sort_by_name(const void *a, const void *b) static int scenario_list_category_compare(int categoryA, int categoryB)
{
if (categoryA == categoryB) return 0;
if (categoryA == SCENARIO_CATEGORY_DLC) return -1;
if (categoryB == SCENARIO_CATEGORY_DLC) return 1;
if (categoryA == SCENARIO_CATEGORY_BUILD_YOUR_OWN) return -1;
if (categoryB == SCENARIO_CATEGORY_BUILD_YOUR_OWN) return 1;
return sgn(categoryA - categoryB);
}
static int scenario_list_sort_by_category(const void *a, const void *b)
{ {
const scenario_index_entry *entryA = (const scenario_index_entry*)a; const scenario_index_entry *entryA = (const scenario_index_entry*)a;
const scenario_index_entry *entryB = (const scenario_index_entry*)b; const scenario_index_entry *entryB = (const scenario_index_entry*)b;
// Order by category // Order by category
if (entryA->category != entryB->category) { if (entryA->category != entryB->category) {
return entryA->category - entryB->category; return scenario_list_category_compare(entryA->category, entryB->category);
} }
// Then by source game / name // Then by source game / name
@@ -266,9 +276,9 @@ static int scenario_list_sort_by_index(const void *a, const void *b)
default: default:
if (entryA->source_index == -1 && entryB->source_index == -1) { if (entryA->source_index == -1 && entryB->source_index == -1) {
if (entryA->category == entryB->category) { if (entryA->category == entryB->category) {
return scenario_list_sort_by_name(a, b); return scenario_list_sort_by_category(a, b);
} else { } else {
return entryA->category - entryB->category; return scenario_list_category_compare(entryA->category, entryB->category);
} }
} else if (entryA->source_index == -1) { } else if (entryA->source_index == -1) {
return 1; return 1;
@@ -278,13 +288,7 @@ static int scenario_list_sort_by_index(const void *a, const void *b)
return entryA->source_index - entryB->source_index; return entryA->source_index - entryB->source_index;
} }
case SCENARIO_SOURCE_REAL: case SCENARIO_SOURCE_REAL:
return scenario_list_sort_by_name(a, b); return scenario_list_sort_by_category(a, b);
case SCENARIO_SOURCE_OTHER:
if (entryA->category == entryB->category) {
return scenario_list_sort_by_name(a, b);
} else {
return entryA->category - entryB->category;
}
} }
} }

View File

@@ -191,26 +191,35 @@ const scenario_title_desc ScenarioTitlesRealParks[] = {
}; };
// Other parks // Other parks
const scenario_title_desc ScenarioTitlesRCT2BuildYourOwnParks[] = { const scenario_title_desc ScenarioTitlesOtherParks[] = {
{ SC_UNIDENTIFIED, "Build your own Six Flags Belgium", SCENARIO_CATEGORY_OTHER }, { SC_UNIDENTIFIED, "Fort Anachronism", SCENARIO_CATEGORY_DLC },
{ SC_UNIDENTIFIED, "Build your own Six Flags Great Adventure", SCENARIO_CATEGORY_OTHER }, { SC_UNIDENTIFIED, "PC Player", SCENARIO_CATEGORY_DLC },
{ SC_UNIDENTIFIED, "Build your own Six Flags Holland", SCENARIO_CATEGORY_OTHER }, { SC_UNIDENTIFIED, "PC Gaming World", SCENARIO_CATEGORY_DLC },
{ SC_UNIDENTIFIED, "Build your own Six Flags Magic Mountain", SCENARIO_CATEGORY_OTHER }, { SC_UNIDENTIFIED, "gameplay", SCENARIO_CATEGORY_DLC },
{ SC_UNIDENTIFIED, "Build your own Six Flags Park", SCENARIO_CATEGORY_OTHER }, { SC_UNIDENTIFIED, "Panda World", SCENARIO_CATEGORY_DLC },
{ SC_UNIDENTIFIED, "Build your own Six Flags over Texas", SCENARIO_CATEGORY_OTHER }, { SC_UNIDENTIFIED, "Competition Land 1", SCENARIO_CATEGORY_DLC },
{ SC_UNIDENTIFIED, "Competition Land 2", SCENARIO_CATEGORY_DLC },
{ SC_UNIDENTIFIED, "Build your own Six Flags Belgium", SCENARIO_CATEGORY_BUILD_YOUR_OWN },
{ SC_UNIDENTIFIED, "Build your own Six Flags Great Adventure", SCENARIO_CATEGORY_BUILD_YOUR_OWN },
{ SC_UNIDENTIFIED, "Build your own Six Flags Holland", SCENARIO_CATEGORY_BUILD_YOUR_OWN },
{ SC_UNIDENTIFIED, "Build your own Six Flags Magic Mountain", SCENARIO_CATEGORY_BUILD_YOUR_OWN },
{ SC_UNIDENTIFIED, "Build your own Six Flags Park", SCENARIO_CATEGORY_BUILD_YOUR_OWN },
{ SC_UNIDENTIFIED, "Build your own Six Flags over Texas", SCENARIO_CATEGORY_BUILD_YOUR_OWN },
}; };
#define DEFINE_SCENARIO_TITLE_DESC_GROUP(x) { countof(x), x }
const struct { const struct {
int count; int count;
const scenario_title_desc * const titles; const scenario_title_desc * const titles;
} ScenarioTitlesBySource[] = { } ScenarioTitlesBySource[] = {
{ countof(ScenarioTitlesRCT1), ScenarioTitlesRCT1 }, DEFINE_SCENARIO_TITLE_DESC_GROUP(ScenarioTitlesRCT1),
{ countof(ScenarioTitlesRCT1AA), ScenarioTitlesRCT1AA }, DEFINE_SCENARIO_TITLE_DESC_GROUP(ScenarioTitlesRCT1AA),
{ countof(ScenarioTitlesRCT1LL), ScenarioTitlesRCT1LL }, DEFINE_SCENARIO_TITLE_DESC_GROUP(ScenarioTitlesRCT1LL),
{ countof(ScenarioTitlesRCT2), ScenarioTitlesRCT2 }, DEFINE_SCENARIO_TITLE_DESC_GROUP(ScenarioTitlesRCT2),
{ countof(ScenarioTitlesRCT2WW), ScenarioTitlesRCT2WW }, DEFINE_SCENARIO_TITLE_DESC_GROUP(ScenarioTitlesRCT2WW),
{ countof(ScenarioTitlesRCT2TT), ScenarioTitlesRCT2TT }, DEFINE_SCENARIO_TITLE_DESC_GROUP(ScenarioTitlesRCT2TT),
{ countof(ScenarioTitlesRealParks), ScenarioTitlesRealParks }, DEFINE_SCENARIO_TITLE_DESC_GROUP(ScenarioTitlesRealParks),
DEFINE_SCENARIO_TITLE_DESC_GROUP(ScenarioTitlesOtherParks),
}; };
bool scenario_get_source_desc(const utf8 *name, source_desc *outDesc) bool scenario_get_source_desc(const utf8 *name, source_desc *outDesc)

View File

@@ -534,9 +534,9 @@ static void window_editor_objective_options_show_category_dropdown(rct_window *w
dropdownWidget = &w->widgets[WIDX_CATEGORY]; dropdownWidget = &w->widgets[WIDX_CATEGORY];
for (i = 0; i < 5; i++) { for (i = SCENARIO_CATEGORY_BEGINNER; i <= SCENARIO_CATEGORY_OTHER; i++) {
gDropdownItemsFormat[i] = 1142; gDropdownItemsFormat[i] = 1142;
gDropdownItemsArgs[i] = STR_BEGINNER_PARKS + i; gDropdownItemsArgs[i] = ScenarioCategoryStringIds[i];
} }
window_dropdown_show_text_custom_width( window_dropdown_show_text_custom_width(
w->x + dropdownWidget->left, w->x + dropdownWidget->left,
@@ -1036,7 +1036,7 @@ static void window_editor_objective_options_main_paint(rct_window *w, rct_drawpi
// Scenario category value // Scenario category value
x = w->x + w->widgets[WIDX_CATEGORY].left + 1; x = w->x + w->widgets[WIDX_CATEGORY].left + 1;
y = w->y + w->widgets[WIDX_CATEGORY].top; y = w->y + w->widgets[WIDX_CATEGORY].top;
stringId = STR_BEGINNER_PARKS + s6Info->category; stringId = ScenarioCategoryStringIds[s6Info->category];
gfx_draw_string_left(dpi, 1193, &stringId, 0, x, y); gfx_draw_string_left(dpi, 1193, &stringId, 0, x, y);
} }

View File

@@ -189,7 +189,11 @@ static void window_scenarioselect_init_tabs(rct_window *w)
if (gConfigGeneral.scenario_select_mode == SCENARIO_SELECT_MODE_ORIGIN) { if (gConfigGeneral.scenario_select_mode == SCENARIO_SELECT_MODE_ORIGIN) {
showPages |= 1 << scenario->source_game; showPages |= 1 << scenario->source_game;
} else { } else {
showPages |= 1 << scenario->category; int category = scenario->category;
if (category > SCENARIO_CATEGORY_OTHER) {
category = SCENARIO_CATEGORY_OTHER;
}
showPages |= 1 << category;
} }
} }
@@ -358,7 +362,7 @@ static void window_scenarioselect_paint(rct_window *w, rct_drawpixelinfo *dpi)
if (gConfigGeneral.scenario_select_mode == SCENARIO_SELECT_MODE_ORIGIN) { if (gConfigGeneral.scenario_select_mode == SCENARIO_SELECT_MODE_ORIGIN) {
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, short) = STR_SCENARIO_CATEGORY_RCT1 + i; RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, short) = STR_SCENARIO_CATEGORY_RCT1 + i;
} else { // old-style } else { // old-style
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, short) = STR_BEGINNER_PARKS + i; RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, short) = ScenarioCategoryStringIds[i];
} }
gfx_draw_string_centred_wrapped(dpi, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, x, y, 87, format, 10); gfx_draw_string_centred_wrapped(dpi, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, x, y, 87, format, 10);
} }
@@ -415,7 +419,6 @@ static void window_scenarioselect_scrollpaint(rct_window *w, rct_drawpixelinfo *
int highlighted_format = (theme_get_preset()->features.rct1_scenario_font) ? 5139 : 1193; int highlighted_format = (theme_get_preset()->features.rct1_scenario_font) ? 5139 : 1193;
int unhighlighted_format = (theme_get_preset()->features.rct1_scenario_font) ? 5139 : 1191; int unhighlighted_format = (theme_get_preset()->features.rct1_scenario_font) ? 5139 : 1191;
int disabled_format = 5619;
bool wide = gConfigGeneral.scenario_select_mode == SCENARIO_SELECT_MODE_ORIGIN; bool wide = gConfigGeneral.scenario_select_mode == SCENARIO_SELECT_MODE_ORIGIN;
@@ -528,14 +531,25 @@ static void initialise_list_items(rct_window *w)
// Category heading // Category heading
rct_string_id headingStringId = STR_NONE; rct_string_id headingStringId = STR_NONE;
if (gConfigGeneral.scenario_select_mode == SCENARIO_SELECT_MODE_ORIGIN) { if (gConfigGeneral.scenario_select_mode == SCENARIO_SELECT_MODE_ORIGIN) {
if (w->selected_tab != 6 && currentHeading != scenario->category) { if (w->selected_tab != SCENARIO_SOURCE_REAL && currentHeading != scenario->category) {
currentHeading = scenario->category; currentHeading = scenario->category;
headingStringId = STR_BEGINNER_PARKS + currentHeading; headingStringId = ScenarioCategoryStringIds[currentHeading];
} }
} else { } else {
if (w->selected_tab < 3 && currentHeading != scenario->source_game) { if (w->selected_tab <= SCENARIO_CATEGORY_EXPERT) {
currentHeading = scenario->source_game; if (currentHeading != scenario->source_game) {
headingStringId = STR_SCENARIO_CATEGORY_RCT1 + currentHeading; currentHeading = scenario->source_game;
headingStringId = STR_SCENARIO_CATEGORY_RCT1 + currentHeading;
}
} else if (w->selected_tab == SCENARIO_CATEGORY_OTHER) {
int category = scenario->category;
if (category <= SCENARIO_CATEGORY_REAL) {
category = SCENARIO_CATEGORY_OTHER;
}
if (currentHeading != category) {
currentHeading = category;
headingStringId = ScenarioCategoryStringIds[category];
}
} }
} }
if (headingStringId != (rct_string_id)STR_NONE) { if (headingStringId != (rct_string_id)STR_NONE) {
@@ -612,12 +626,19 @@ static void initialise_list_items(rct_window *w)
static bool is_scenario_visible(rct_window *w, scenario_index_entry *scenario) static bool is_scenario_visible(rct_window *w, scenario_index_entry *scenario)
{ {
if ((gConfigGeneral.scenario_select_mode == SCENARIO_SELECT_MODE_ORIGIN && scenario->source_game != w->selected_tab) || if (gConfigGeneral.scenario_select_mode == SCENARIO_SELECT_MODE_ORIGIN) {
(gConfigGeneral.scenario_select_mode == SCENARIO_SELECT_MODE_DIFFICULTY && scenario->category != w->selected_tab) if (scenario->source_game != w->selected_tab) {
) { return false;
return false; }
} else {
int category = scenario->category;
if (category > SCENARIO_CATEGORY_OTHER) {
category = SCENARIO_CATEGORY_OTHER;
}
if (category != w->selected_tab) {
return false;
}
} }
return true; return true;
} }