mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-24 23:34:37 +01:00
add global macro: gScenarioObjectiveType
This commit is contained in:
@@ -390,7 +390,7 @@ void game_command_cheat(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* e
|
||||
case CHEAT_FREEZECLIMATE: gCheatsFreezeClimate = !gCheatsFreezeClimate; break;
|
||||
case CHEAT_NEVERENDINGMARKETING: gCheatsNeverendingMarketing = !gCheatsNeverendingMarketing; break;
|
||||
case CHEAT_OPENCLOSEPARK: park_set_open(park_is_open() ? 0 : 1); break;
|
||||
case CHEAT_HAVEFUN: RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8) = OBJECTIVE_HAVE_FUN; break;
|
||||
case CHEAT_HAVEFUN: gScenarioObjectiveType = OBJECTIVE_HAVE_FUN; break;
|
||||
case CHEAT_SETFORCEDPARKRATING: if(*edx > -1) { park_rating_spinner_value = *edx; } set_forced_park_rating(*edx); break;
|
||||
}
|
||||
if (network_get_mode() == NETWORK_MODE_NONE) {
|
||||
|
||||
@@ -122,7 +122,7 @@ void editor_convert_save_to_scenario_callback(int result)
|
||||
|
||||
safe_strcpy(s6Info->name, (const char*)RCT2_ADDRESS_SCENARIO_NAME, 64);
|
||||
safe_strcpy(s6Info->details, (const char*)RCT2_ADDRESS_SCENARIO_DETAILS, 256);
|
||||
s6Info->objective_type = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8);
|
||||
s6Info->objective_type = gScenarioObjectiveType;
|
||||
s6Info->objective_arg_1 = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_YEAR, uint8);
|
||||
s6Info->objective_arg_2 = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, sint32);
|
||||
s6Info->objective_arg_3 = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, sint16);
|
||||
|
||||
@@ -1023,7 +1023,7 @@ void S4Importer::ImportScenarioNameDetails()
|
||||
|
||||
void S4Importer::ImportScenarioObjective()
|
||||
{
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8) = _s4.scenario_objective_type;
|
||||
gScenarioObjectiveType = _s4.scenario_objective_type;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_YEAR, uint8) = _s4.scenario_objective_years;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, uint32) = _s4.scenario_objective_currency;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16) = _s4.scenario_objective_num_guests;
|
||||
|
||||
@@ -6008,7 +6008,7 @@ foundRideEntry:
|
||||
ride->price_secondary = DefaultShopItemPrice[rideEntry->shop_item_secondary];
|
||||
}
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8) == OBJECTIVE_BUILD_THE_BEST) {
|
||||
if (gScenarioObjectiveType == OBJECTIVE_BUILD_THE_BEST) {
|
||||
ride->price = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -274,7 +274,7 @@ void scenario_begin()
|
||||
sub_684AC3();
|
||||
scenery_set_default_placement_configuration();
|
||||
news_item_init_queue();
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8) != OBJECTIVE_NONE)
|
||||
if (gScenarioObjectiveType != OBJECTIVE_NONE)
|
||||
window_park_objective_open();
|
||||
|
||||
gParkRating = calculate_park_rating();
|
||||
@@ -515,7 +515,7 @@ static void scenario_day_update()
|
||||
{
|
||||
finance_update_daily_profit();
|
||||
peep_update_days_in_queue();
|
||||
switch (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8)) {
|
||||
switch (gScenarioObjectiveType) {
|
||||
case OBJECTIVE_10_ROLLERCOASTERS:
|
||||
case OBJECTIVE_GUESTS_AND_RATING:
|
||||
case OBJECTIVE_10_ROLLERCOASTERS_LENGTH:
|
||||
@@ -724,7 +724,7 @@ void scenario_prepare_rides_for_save()
|
||||
rct_ride *ride;
|
||||
map_element_iterator it;
|
||||
|
||||
int isFiveCoasterObjective = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8) == OBJECTIVE_FINISH_5_ROLLERCOASTERS;
|
||||
int isFiveCoasterObjective = gScenarioObjectiveType == OBJECTIVE_FINISH_5_ROLLERCOASTERS;
|
||||
|
||||
// Set all existing track to be indestructible
|
||||
map_element_iterator_begin(&it);
|
||||
@@ -768,14 +768,14 @@ int scenario_prepare_for_save()
|
||||
if (s6Info->name[0] == 0)
|
||||
format_string(s6Info->name, gParkName, (void*)RCT2_ADDRESS_PARK_NAME_ARGS);
|
||||
|
||||
s6Info->objective_type = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8);
|
||||
s6Info->objective_type = gScenarioObjectiveType;
|
||||
s6Info->objective_arg_1 = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_YEAR, uint8);
|
||||
s6Info->objective_arg_2 = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, sint32);
|
||||
s6Info->objective_arg_3 = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16);
|
||||
|
||||
scenario_prepare_rides_for_save();
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8) == OBJECTIVE_GUESTS_AND_RATING)
|
||||
if (gScenarioObjectiveType == OBJECTIVE_GUESTS_AND_RATING)
|
||||
gParkFlags |= PARK_FLAGS_PARK_OPEN;
|
||||
|
||||
// Fix #2385: saved scenarios did not initialise temperatures to selected climate
|
||||
@@ -1445,7 +1445,7 @@ static void scenario_objective_check_monthly_food_income()
|
||||
*/
|
||||
static void scenario_objective_check()
|
||||
{
|
||||
uint8 objective_type = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8);
|
||||
uint8 objective_type = gScenarioObjectiveType;
|
||||
uint32 scenario_completed_company_value = RCT2_GLOBAL(RCT2_ADDRESS_COMPLETED_COMPANY_VALUE, uint32);
|
||||
|
||||
if (scenario_completed_company_value != MONEY32_UNDEFINED)
|
||||
|
||||
@@ -461,6 +461,8 @@ typedef struct {
|
||||
|
||||
extern const rct_string_id ScenarioCategoryStringIds[SCENARIO_CATEGORY_COUNT];
|
||||
|
||||
#define gScenarioObjectiveType RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8)
|
||||
|
||||
// Scenario list
|
||||
extern int gScenarioListCount;
|
||||
extern int gScenarioListCapacity;
|
||||
|
||||
@@ -346,7 +346,7 @@ static void window_editor_objective_options_set_page(rct_window *w, int page)
|
||||
*/
|
||||
static void window_editor_objective_options_set_objective(rct_window *w, int objective)
|
||||
{
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8) = objective;
|
||||
gScenarioObjectiveType = objective;
|
||||
window_invalidate(w);
|
||||
|
||||
// Set default objective arguments
|
||||
@@ -494,7 +494,7 @@ static void window_editor_objective_options_show_objective_dropdown(rct_window *
|
||||
dropdownWidget->right - dropdownWidget->left - 3
|
||||
);
|
||||
|
||||
objectiveType = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8);
|
||||
objectiveType = gScenarioObjectiveType;
|
||||
for (i = 0; i < numItems; i++) {
|
||||
if (gDropdownItemsArgs[i] - STR_OBJECTIVE_DROPDOWN_NONE == objectiveType) {
|
||||
dropdown_set_checked(i, true);
|
||||
@@ -552,7 +552,7 @@ static void window_editor_objective_options_show_category_dropdown(rct_window *w
|
||||
|
||||
static void window_editor_objective_options_arg_1_increase(rct_window *w)
|
||||
{
|
||||
switch (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8)) {
|
||||
switch (gScenarioObjectiveType) {
|
||||
case OBJECTIVE_PARK_VALUE_BY:
|
||||
case OBJECTIVE_MONTHLY_RIDE_INCOME:
|
||||
case OBJECTIVE_REPLAY_LOAN_AND_PARK_VALUE:
|
||||
@@ -600,7 +600,7 @@ static void window_editor_objective_options_arg_1_increase(rct_window *w)
|
||||
|
||||
static void window_editor_objective_options_arg_1_decrease(rct_window *w)
|
||||
{
|
||||
switch (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8)) {
|
||||
switch (gScenarioObjectiveType) {
|
||||
case OBJECTIVE_PARK_VALUE_BY:
|
||||
case OBJECTIVE_MONTHLY_RIDE_INCOME:
|
||||
case OBJECTIVE_REPLAY_LOAN_AND_PARK_VALUE:
|
||||
@@ -712,7 +712,7 @@ static void window_editor_objective_options_main_dropdown(rct_window *w, int wid
|
||||
switch (widgetIndex) {
|
||||
case WIDX_OBJECTIVE_DROPDOWN:
|
||||
newObjectiveType = (uint8)(gDropdownItemsArgs[dropdownIndex] - 2397);
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8) != newObjectiveType)
|
||||
if (gScenarioObjectiveType != newObjectiveType)
|
||||
window_editor_objective_options_set_objective(w, newObjectiveType);
|
||||
break;
|
||||
case WIDX_CLIMATE_DROPDOWN:
|
||||
@@ -744,7 +744,7 @@ static void window_editor_objective_options_main_update(rct_window *w)
|
||||
widget_invalidate(w, WIDX_TAB_1);
|
||||
|
||||
parkFlags = gParkFlags;
|
||||
objectiveType = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8);
|
||||
objectiveType = gScenarioObjectiveType;
|
||||
|
||||
// Reset objective if invalid
|
||||
if ((
|
||||
@@ -833,7 +833,7 @@ static void window_editor_objective_options_main_invalidate(rct_window *w)
|
||||
else
|
||||
w->disabled_widgets |= (WIDX_PARK_NAME | WIDX_SCENARIO_NAME);
|
||||
|
||||
switch (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8)) {
|
||||
switch (gScenarioObjectiveType) {
|
||||
case OBJECTIVE_GUESTS_BY:
|
||||
case OBJECTIVE_PARK_VALUE_BY:
|
||||
window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_1].type = WWT_SPINNER;
|
||||
@@ -899,14 +899,14 @@ static void window_editor_objective_options_main_paint(rct_window *w, rct_drawpi
|
||||
// Objective value
|
||||
x = w->x + w->widgets[WIDX_OBJECTIVE].left + 1;
|
||||
y = w->y + w->widgets[WIDX_OBJECTIVE].top;
|
||||
stringId = STR_OBJECTIVE_DROPDOWN_NONE + RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8);
|
||||
stringId = STR_OBJECTIVE_DROPDOWN_NONE + gScenarioObjectiveType;
|
||||
gfx_draw_string_left(dpi, 1193, &stringId, 0, x, y);
|
||||
|
||||
if (w->widgets[WIDX_OBJECTIVE_ARG_1].type != WWT_EMPTY) {
|
||||
// Objective argument 1 label
|
||||
x = w->x + 28;
|
||||
y = w->y + w->widgets[WIDX_OBJECTIVE_ARG_1].top;
|
||||
switch (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8)) {
|
||||
switch (gScenarioObjectiveType) {
|
||||
case OBJECTIVE_GUESTS_BY:
|
||||
case OBJECTIVE_GUESTS_AND_RATING:
|
||||
stringId = 3303;
|
||||
@@ -933,7 +933,7 @@ static void window_editor_objective_options_main_paint(rct_window *w, rct_drawpi
|
||||
// Objective argument 1 value
|
||||
x = w->x + w->widgets[WIDX_OBJECTIVE_ARG_1].left + 1;
|
||||
y = w->y + w->widgets[WIDX_OBJECTIVE_ARG_1].top;
|
||||
switch (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8)) {
|
||||
switch (gScenarioObjectiveType) {
|
||||
case OBJECTIVE_GUESTS_BY:
|
||||
case OBJECTIVE_GUESTS_AND_RATING:
|
||||
stringId = 3309;
|
||||
|
||||
@@ -743,7 +743,7 @@ static void window_finances_summary_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||
gfx_draw_string_left(dpi, stringId, ¤tCash, 0, w->x + 4, w->y + 244);
|
||||
|
||||
// Objective related financial information
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8) == OBJECTIVE_MONTHLY_FOOD_INCOME) {
|
||||
if (gScenarioObjectiveType == OBJECTIVE_MONTHLY_FOOD_INCOME) {
|
||||
// Last month's profit from food, drink and merchandise
|
||||
money32 lastMonthProfit = 0;
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16) != 0) {
|
||||
|
||||
@@ -957,7 +957,7 @@ static void window_park_entrance_invalidate(rct_window *w)
|
||||
|
||||
// Only allow closing of park for guest / rating objective
|
||||
// Only allow closing of park when there is money
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8) == OBJECTIVE_GUESTS_AND_RATING ||
|
||||
if (gScenarioObjectiveType == OBJECTIVE_GUESTS_AND_RATING ||
|
||||
(gParkFlags & PARK_FLAGS_NO_MONEY))
|
||||
w->disabled_widgets |= (1 << WIDX_OPEN_OR_CLOSE) | (1 << WIDX_CLOSE_LIGHT) | (1 << WIDX_OPEN_LIGHT);
|
||||
else
|
||||
@@ -981,7 +981,7 @@ static void window_park_entrance_invalidate(rct_window *w)
|
||||
|
||||
if (theme_get_flags() & UITHEME_FLAG_USE_LIGHTS_PARK) {
|
||||
window_park_entrance_widgets[WIDX_OPEN_OR_CLOSE].type = WWT_EMPTY;
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8) == OBJECTIVE_GUESTS_AND_RATING) {
|
||||
if (gScenarioObjectiveType == OBJECTIVE_GUESTS_AND_RATING) {
|
||||
window_park_entrance_widgets[WIDX_CLOSE_LIGHT].type = WWT_FLATBTN;
|
||||
window_park_entrance_widgets[WIDX_OPEN_LIGHT].type = WWT_FLATBTN;
|
||||
}
|
||||
@@ -1761,7 +1761,7 @@ static void window_park_objective_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, short) = date_get_total_months(MONTH_OCTOBER, RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_YEAR, uint8));
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, int) = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, sint32);
|
||||
|
||||
y += gfx_draw_string_left_wrapped(dpi, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, x, y, 221, 2385 + RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8), 0);
|
||||
y += gfx_draw_string_left_wrapped(dpi, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, x, y, 221, 2385 + gScenarioObjectiveType, 0);
|
||||
y += 5;
|
||||
|
||||
// Objective outcome
|
||||
|
||||
@@ -111,7 +111,7 @@ void park_init()
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HAPPINESS, uint8) = calculate_guest_initial_happiness(50); // 50%
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HUNGER, uint8) = 200;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_THIRST, uint8) = 200;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8) = 1;
|
||||
gScenarioObjectiveType = OBJECTIVE_GUESTS_BY;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_YEAR, uint8) = 4;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16) = 1000;
|
||||
gLandPrice = MONEY(90, 00);
|
||||
|
||||
Reference in New Issue
Block a user