mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #3398 from IntelOrca/refactor/vars
Add global macros for many variables
This commit is contained in:
commit
c40a4c3805
|
@ -3,6 +3,7 @@
|
|||
#include "game.h"
|
||||
#include "interface/window.h"
|
||||
#include "network/network.h"
|
||||
#include "management/finance.h"
|
||||
#include "world/climate.h"
|
||||
#include "world/footpath.h"
|
||||
#include "world/scenery.h"
|
||||
|
@ -196,12 +197,12 @@ static void cheat_increase_money(money32 amount)
|
|||
{
|
||||
money32 currentMoney;
|
||||
|
||||
currentMoney = DECRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, sint32));
|
||||
currentMoney = DECRYPT_MONEY(gCashEncrypted);
|
||||
if (currentMoney < INT_MAX - amount)
|
||||
currentMoney += amount;
|
||||
else
|
||||
currentMoney = INT_MAX;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, sint32) = ENCRYPT_MONEY(currentMoney);
|
||||
gCashEncrypted = ENCRYPT_MONEY(currentMoney);
|
||||
|
||||
window_invalidate_by_class(WC_FINANCES);
|
||||
window_invalidate_by_class(WC_BOTTOM_TOOLBAR);
|
||||
|
@ -210,7 +211,7 @@ static void cheat_increase_money(money32 amount)
|
|||
static void cheat_clear_loan()
|
||||
{
|
||||
// First give money
|
||||
game_do_command(0, GAME_COMMAND_FLAG_APPLY, CHEAT_INCREASEMONEY, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32), GAME_COMMAND_CHEAT, 0, 0);
|
||||
game_do_command(0, GAME_COMMAND_FLAG_APPLY, CHEAT_INCREASEMONEY, gBankLoan, GAME_COMMAND_CHEAT, 0, 0);
|
||||
|
||||
// Then pay the loan
|
||||
money32 newLoan;
|
||||
|
@ -389,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) {
|
||||
|
|
30
src/editor.c
30
src/editor.c
|
@ -122,10 +122,10 @@ 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_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);
|
||||
s6Info->objective_type = gScenarioObjectiveType;
|
||||
s6Info->objective_arg_1 = gScenarioObjectiveYear;
|
||||
s6Info->objective_arg_2 = gScenarioObjectiveCurrency;
|
||||
s6Info->objective_arg_3 = gScenarioObjectiveNumGuests;
|
||||
climate_reset(RCT2_GLOBAL(RCT2_ADDRESS_CLIMATE, uint8));
|
||||
|
||||
rct_stex_entry* stex = g_stexEntries[0];
|
||||
|
@ -430,9 +430,9 @@ static void editor_clear_map_for_editing()
|
|||
reset_sprite_list();
|
||||
staff_reset_modes();
|
||||
gNumGuestsInPark = 0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_HEADING_FOR_PARK, uint16) = 0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAST_GUESTS_IN_PARK, uint16) = 0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_CHANGE_MODIFIER, uint16) = 0;
|
||||
gNumGuestsHeadingForPark = 0;
|
||||
gNumGuestsInParkLastWeek = 0;
|
||||
gGuestChangeModifier = 0;
|
||||
if (s6Header->type != S6_TYPE_SCENARIO) {
|
||||
research_populate_list_random();
|
||||
research_remove_non_separate_vehicle_types();
|
||||
|
@ -450,19 +450,15 @@ static void editor_clear_map_for_editing()
|
|||
|
||||
gParkFlags &= ~PARK_FLAGS_18;
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16) = clamp(
|
||||
MONEY(10,00),
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16),
|
||||
MONEY(100,00)
|
||||
);
|
||||
gGuestInitialCash = clamp(MONEY(10,00), gGuestInitialCash, MONEY(100,00));
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, uint32) = min(RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, uint32), 100000);
|
||||
finance_reset_cash_to_initial();
|
||||
finance_update_loan_hash();
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) = clamp(
|
||||
gBankLoan = clamp(
|
||||
MONEY(0,00),
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32),
|
||||
gBankLoan,
|
||||
MONEY(5000000,00)
|
||||
);
|
||||
|
||||
|
@ -472,11 +468,7 @@ static void editor_clear_map_for_editing()
|
|||
MONEY(5000000,00)
|
||||
);
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_INTEREST_RATE, uint8) = clamp(
|
||||
5,
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_INTEREST_RATE, uint8),
|
||||
80
|
||||
);
|
||||
gBankLoanInterestRate = clamp(5, gBankLoanInterestRate, 80);
|
||||
}
|
||||
|
||||
climate_reset(RCT2_GLOBAL(RCT2_ADDRESS_CLIMATE, uint8));
|
||||
|
|
10
src/game.c
10
src/game.c
|
@ -265,7 +265,7 @@ void game_update()
|
|||
}
|
||||
|
||||
if (network_get_mode() == NETWORK_MODE_CLIENT && network_get_status() == NETWORK_STATUS_CONNECTED && network_get_authstatus() == NETWORK_AUTH_OK) {
|
||||
if (network_get_server_tick() - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) >= 10) {
|
||||
if (network_get_server_tick() - gCurrentTicks >= 10) {
|
||||
// make sure client doesn't fall behind the server too much
|
||||
numUpdates += 10;
|
||||
}
|
||||
|
@ -318,7 +318,7 @@ void game_update()
|
|||
// the flickering frequency is reduced by 4, compared to the original
|
||||
// it was done due to inability to reproduce original frequency
|
||||
// and decision that the original one looks too fast
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) % 4 == 0)
|
||||
if (gCurrentTicks % 4 == 0)
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_MAP_FLASHING_FLAGS, uint16) ^= (1 << 15);
|
||||
|
||||
// Handle guest map flashing
|
||||
|
@ -347,12 +347,12 @@ void game_logic_update()
|
|||
///////////////////////////
|
||||
network_update();
|
||||
if (network_get_mode() == NETWORK_MODE_CLIENT && network_get_status() == NETWORK_STATUS_CONNECTED && network_get_authstatus() == NETWORK_AUTH_OK) {
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) >= network_get_server_tick()) {
|
||||
if (gCurrentTicks >= network_get_server_tick()) {
|
||||
// dont run past the server
|
||||
return;
|
||||
}
|
||||
}
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32)++;
|
||||
gCurrentTicks++;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, uint32)++;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_AGE, sint16)++;
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_AGE, sint16) == 0)
|
||||
|
@ -409,7 +409,7 @@ static int game_check_affordability(int cost)
|
|||
{
|
||||
if (cost <= 0)return cost;
|
||||
if (RCT2_GLOBAL(0x141F568, uint8) & 0xF0)return cost;
|
||||
if (cost <= (sint32)(DECRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, sint32))))return cost;
|
||||
if (cost <= (sint32)(DECRYPT_MONEY(gCashEncrypted)))return cost;
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) = cost;
|
||||
|
||||
|
|
|
@ -122,6 +122,8 @@ extern rct_string_id gGameCommandErrorText;
|
|||
|
||||
extern GAME_COMMAND_POINTER* new_game_command_table[66];
|
||||
|
||||
#define gCurrentTicks RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32)
|
||||
|
||||
extern int gGameSpeed;
|
||||
extern float gDayNightCycle;
|
||||
extern bool gInUpdateCode;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "../object.h"
|
||||
#include "../world/banner.h"
|
||||
#include "../world/scenery.h"
|
||||
#include "../management/finance.h"
|
||||
#include "../management/research.h"
|
||||
#include "../util/util.h"
|
||||
#include "console.h"
|
||||
|
@ -467,37 +468,37 @@ static int cc_get(const utf8 **argv, int argc)
|
|||
{
|
||||
if (argc > 0) {
|
||||
if (strcmp(argv[0], "park_rating") == 0) {
|
||||
console_printf("park_rating %d", RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, sint16));
|
||||
console_printf("park_rating %d", gParkRating);
|
||||
}
|
||||
else if (strcmp(argv[0], "money") == 0) {
|
||||
console_printf("money %d.%d0", DECRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, money32)) / 10, DECRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, money32)) % 10);
|
||||
console_printf("money %d.%d0", DECRYPT_MONEY(gCashEncrypted) / 10, DECRYPT_MONEY(gCashEncrypted) % 10);
|
||||
}
|
||||
else if (strcmp(argv[0], "current_loan") == 0) {
|
||||
console_printf("current_loan %d", RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) / 10);
|
||||
console_printf("current_loan %d", gBankLoan / 10);
|
||||
}
|
||||
else if (strcmp(argv[0], "max_loan") == 0) {
|
||||
console_printf("max_loan %d", RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32) / 10);
|
||||
}
|
||||
else if (strcmp(argv[0], "guest_initial_cash") == 0) {
|
||||
console_printf("guest_initial_cash %d.%d0", RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16) / 10, RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16) % 10);
|
||||
console_printf("guest_initial_cash %d.%d0", gGuestInitialCash / 10, gGuestInitialCash % 10);
|
||||
}
|
||||
else if (strcmp(argv[0], "guest_initial_happiness") == 0) {
|
||||
uint32 current_happiness = RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HAPPINESS, uint8);
|
||||
uint32 current_happiness = gGuestInitialHappiness;
|
||||
for (int i = 15; i <= 99; i++) {
|
||||
if (i == 99) {
|
||||
console_printf("guest_initial_happiness %d%% (%d)", 15, RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HAPPINESS, uint8));
|
||||
console_printf("guest_initial_happiness %d%% (%d)", 15, gGuestInitialHappiness);
|
||||
}
|
||||
else if (current_happiness == calculate_guest_initial_happiness(i)) {
|
||||
console_printf("guest_initial_happiness %d%% (%d)", i, RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HAPPINESS, uint8));
|
||||
console_printf("guest_initial_happiness %d%% (%d)", i, gGuestInitialHappiness);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (strcmp(argv[0], "guest_initial_hunger") == 0) {
|
||||
console_printf("guest_initial_hunger %d%% (%d)", ((255 - RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HUNGER, uint8)) * 100) / 255, RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HUNGER, uint8));
|
||||
console_printf("guest_initial_hunger %d%% (%d)", ((255 - gGuestInitialHunger) * 100) / 255, gGuestInitialHunger);
|
||||
}
|
||||
else if (strcmp(argv[0], "guest_initial_thirst") == 0) {
|
||||
console_printf("guest_initial_thirst %d%% (%d)", ((255 - RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_THIRST, uint8)) * 100) / 255, RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_THIRST, uint8));
|
||||
console_printf("guest_initial_thirst %d%% (%d)", ((255 - gGuestInitialThirst) * 100) / 255, gGuestInitialThirst);
|
||||
}
|
||||
else if (strcmp(argv[0], "guest_prefer_less_intense_rides") == 0) {
|
||||
console_printf("guest_prefer_less_intense_rides %d", (gParkFlags & PARK_FLAGS_PREF_LESS_INTENSE_RIDES) != 0);
|
||||
|
@ -533,10 +534,10 @@ static int cc_get(const utf8 **argv, int argc)
|
|||
console_printf("park_open %d", (gParkFlags & PARK_FLAGS_PARK_OPEN) != 0);
|
||||
}
|
||||
else if (strcmp(argv[0], "land_rights_cost") == 0) {
|
||||
console_printf("land_rights_cost %d.%d0", RCT2_GLOBAL(RCT2_ADDRESS_LAND_COST, money16) / 10, RCT2_GLOBAL(RCT2_ADDRESS_LAND_COST, money16) % 10);
|
||||
console_printf("land_rights_cost %d.%d0", gLandPrice / 10, gLandPrice % 10);
|
||||
}
|
||||
else if (strcmp(argv[0], "construction_rights_cost") == 0) {
|
||||
console_printf("construction_rights_cost %d.%d0", RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST, money32) / 10, RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST, money32) % 10);
|
||||
console_printf("construction_rights_cost %d.%d0", gConstructionRightsPrice / 10, gConstructionRightsPrice % 10);
|
||||
}
|
||||
else if (strcmp(argv[0], "climate") == 0) {
|
||||
const utf8* climate_names[] = { "cool_and_wet", "warm", "hot_and_dry", "cold" };
|
||||
|
@ -601,11 +602,11 @@ static int cc_set(const utf8 **argv, int argc)
|
|||
}
|
||||
|
||||
if (strcmp(argv[0], "money") == 0 && invalidArguments(&invalidArgs, double_valid[0])) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, money32) = ENCRYPT_MONEY(MONEY((int)double_val[0], ((int)(double_val[0] * 100)) % 100));
|
||||
gCashEncrypted = ENCRYPT_MONEY(MONEY((int)double_val[0], ((int)(double_val[0] * 100)) % 100));
|
||||
console_execute_silent("get money");
|
||||
}
|
||||
else if (strcmp(argv[0], "current_loan") == 0 && invalidArguments(&invalidArgs, int_valid[0])) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) = clamp(MONEY(int_val[0] - (int_val[0] % 1000), 0), MONEY(0, 0), RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32));
|
||||
gBankLoan = clamp(MONEY(int_val[0] - (int_val[0] % 1000), 0), MONEY(0, 0), RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32));
|
||||
console_execute_silent("get current_loan");
|
||||
}
|
||||
else if (strcmp(argv[0], "max_loan") == 0 && invalidArguments(&invalidArgs, int_valid[0])) {
|
||||
|
@ -613,19 +614,19 @@ static int cc_set(const utf8 **argv, int argc)
|
|||
console_execute_silent("get max_loan");
|
||||
}
|
||||
else if (strcmp(argv[0], "guest_initial_cash") == 0 && invalidArguments(&invalidArgs, double_valid[0])) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16) = clamp(MONEY((int)double_val[0], ((int)(double_val[0] * 100)) % 100), MONEY(0, 0), MONEY(1000, 0));
|
||||
gGuestInitialCash = clamp(MONEY((int)double_val[0], ((int)(double_val[0] * 100)) % 100), MONEY(0, 0), MONEY(1000, 0));
|
||||
console_execute_silent("get guest_initial_cash");
|
||||
}
|
||||
else if (strcmp(argv[0], "guest_initial_happiness") == 0 && invalidArguments(&invalidArgs, int_valid[0])) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HAPPINESS, uint8) = calculate_guest_initial_happiness((uint8)int_val[0]);
|
||||
gGuestInitialHappiness = calculate_guest_initial_happiness((uint8)int_val[0]);
|
||||
console_execute_silent("get guest_initial_happiness");
|
||||
}
|
||||
else if (strcmp(argv[0], "guest_initial_hunger") == 0 && invalidArguments(&invalidArgs, int_valid[0])) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HUNGER, uint8) = (clamp(int_val[0], 1, 84) * 255 / 100 - 255) * -1;
|
||||
gGuestInitialHunger = (clamp(int_val[0], 1, 84) * 255 / 100 - 255) * -1;
|
||||
console_execute_silent("get guest_initial_hunger");
|
||||
}
|
||||
else if (strcmp(argv[0], "guest_initial_thirst") == 0 && invalidArguments(&invalidArgs, int_valid[0])) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_THIRST, uint8) = (clamp(int_val[0], 1, 84) * 255 / 100 - 255) * -1;
|
||||
gGuestInitialThirst = (clamp(int_val[0], 1, 84) * 255 / 100 - 255) * -1;
|
||||
console_execute_silent("get guest_initial_thirst");
|
||||
}
|
||||
else if (strcmp(argv[0], "guest_prefer_less_intense_rides") == 0 && invalidArguments(&invalidArgs, int_valid[0])) {
|
||||
|
@ -673,11 +674,11 @@ static int cc_set(const utf8 **argv, int argc)
|
|||
console_execute_silent("get park_open");
|
||||
}
|
||||
else if (strcmp(argv[0], "land_rights_cost") == 0 && invalidArguments(&invalidArgs, double_valid[0])) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAND_COST, money16) = clamp(MONEY((int)double_val[0], ((int)(double_val[0] * 100)) % 100), MONEY(0, 0), MONEY(200, 0));
|
||||
gLandPrice = clamp(MONEY((int)double_val[0], ((int)(double_val[0] * 100)) % 100), MONEY(0, 0), MONEY(200, 0));
|
||||
console_execute_silent("get land_rights_cost");
|
||||
}
|
||||
else if (strcmp(argv[0], "construction_rights_cost") == 0 && invalidArguments(&invalidArgs, double_valid[0])) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST, money16) = clamp(MONEY((int)double_val[0], ((int)(double_val[0] * 100)) % 100), MONEY(0, 0), MONEY(200, 0));
|
||||
gConstructionRightsPrice = clamp(MONEY((int)double_val[0], ((int)(double_val[0] * 100)) % 100), MONEY(0, 0), MONEY(200, 0));
|
||||
console_execute_silent("get construction_rights_cost");
|
||||
}
|
||||
else if (strcmp(argv[0], "climate") == 0) {
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "../config.h"
|
||||
#include "../drawing/drawing.h"
|
||||
#include "../drawing/supports.h"
|
||||
#include "../game.h"
|
||||
#include "../input.h"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "../ride/ride_data.h"
|
||||
|
@ -1416,7 +1417,7 @@ void viewport_ride_entrance_exit_paint_setup(uint8 direction, int height, rct_ma
|
|||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 0x1C0;
|
||||
|
||||
uint16 string_width = gfx_get_string_width(entrance_string);
|
||||
uint16 scroll = (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) / 2) % string_width;
|
||||
uint16 scroll = (gCurrentTicks / 2) % string_width;
|
||||
|
||||
sub_98199C(scrolling_text_setup(string_id, scroll, style->scrolling_mode), 0, 0, 0x1C, 0x1C, 0x33, height + style->height, 2, 2, height + style->height, get_current_rotation());
|
||||
}
|
||||
|
@ -1488,8 +1489,8 @@ void viewport_park_entrance_paint_setup(uint8 direction, int height, rct_map_ele
|
|||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, uint32) = 0;
|
||||
|
||||
if (gParkFlags & PARK_FLAGS_PARK_OPEN){
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, rct_string_id) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, rct_string_id) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME_ARGS, rct_string_id);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, rct_string_id) = gParkName;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = gParkNameArgs;
|
||||
|
||||
park_text_id = 1731;
|
||||
}
|
||||
|
@ -1503,7 +1504,7 @@ void viewport_park_entrance_paint_setup(uint8 direction, int height, rct_map_ele
|
|||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 0x1C0;
|
||||
uint16 string_width = gfx_get_string_width(park_name);
|
||||
uint16 scroll = (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) / 2) % string_width;
|
||||
uint16 scroll = (gCurrentTicks / 2) % string_width;
|
||||
|
||||
if (entrance->scrolling_mode == 0xFF)
|
||||
break;
|
||||
|
@ -1763,7 +1764,7 @@ void viewport_banner_paint_setup(uint8 direction, int height, rct_map_element* m
|
|||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 0x1C0;
|
||||
|
||||
uint16 string_width = gfx_get_string_width(RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, char));
|
||||
uint16 scroll = (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) / 2) % string_width;
|
||||
uint16 scroll = (gCurrentTicks / 2) % string_width;
|
||||
|
||||
sub_98199C(scrolling_text_setup(string_id, scroll, scrollingMode), 0, 0, 1, 1, 0x15, height + 22, boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ, get_current_rotation());
|
||||
}
|
||||
|
|
|
@ -86,8 +86,8 @@ int viewport_interaction_get_item_left(int x, int y, viewport_interaction_info *
|
|||
ride_set_map_tooltip(mapElement);
|
||||
break;
|
||||
case VIEWPORT_INTERACTION_ITEM_PARK:
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 0, uint16) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint32) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME_ARGS, uint32);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 0, uint16) = gParkName;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint32) = gParkNameArgs;
|
||||
break;
|
||||
default:
|
||||
info->type = VIEWPORT_INTERACTION_ITEM_NONE;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include "../addresses.h"
|
||||
#include "../game.h"
|
||||
#include "date.h"
|
||||
#include "string_ids.h"
|
||||
|
||||
|
@ -62,5 +63,5 @@ void date_reset()
|
|||
{
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16) = MONTH_MARCH;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, sint16) = 0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) = 0;
|
||||
gCurrentTicks = 0;
|
||||
}
|
||||
|
|
|
@ -416,7 +416,7 @@ static int award_is_deserved_most_disappointing(int awardType, int activeAwardTy
|
|||
|
||||
if (activeAwardTypes & (1 << PARK_AWARD_BEST_VALUE))
|
||||
return 0;
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16) > 650)
|
||||
if (gParkRating > 650)
|
||||
return 0;
|
||||
|
||||
// Count the number of disappointing rides
|
||||
|
|
|
@ -58,11 +58,11 @@ money32 *gParkValueHistory = RCT2_ADDRESS(RCT2_ADDRESS_PARK_VALUE_HISTORY, money
|
|||
*/
|
||||
void finance_payment(money32 amount, rct_expenditure_type type)
|
||||
{
|
||||
money32 cur_money = DECRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, sint32));
|
||||
money32 cur_money = DECRYPT_MONEY(gCashEncrypted);
|
||||
money32 new_money = cur_money - amount;
|
||||
|
||||
//overflow check
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, sint32) = ENCRYPT_MONEY(new_money);
|
||||
gCashEncrypted = ENCRYPT_MONEY(new_money);
|
||||
RCT2_ADDRESS(RCT2_ADDRESS_EXPENDITURE_TABLE, money32)[type] -= amount;
|
||||
if (dword_988E60[type] & 1)
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_EXPENDITURE, money32) -= amount; // Cumulative amount of money spent this day
|
||||
|
@ -109,8 +109,8 @@ void finance_pay_research()
|
|||
*/
|
||||
void finance_pay_interest()
|
||||
{
|
||||
money32 current_loan = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, sint32);
|
||||
sint16 current_interest = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_INTEREST_RATE, sint16);
|
||||
money32 current_loan = gBankLoan;
|
||||
sint16 current_interest = gBankLoanInterestRate;
|
||||
money32 tempcost = (current_loan * 5 * current_interest) >> 14; // (5 * interest) / 2^14 is pretty close to
|
||||
|
||||
if (gParkFlags & PARK_FLAGS_NO_MONEY)
|
||||
|
@ -177,15 +177,15 @@ void finance_init() {
|
|||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32) = MONEY(10000,00); // Cheat detection
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, sint32) = ENCRYPT_MONEY(MONEY(10000,00));
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) = MONEY(10000,00);
|
||||
gCashEncrypted = ENCRYPT_MONEY(MONEY(10000,00));
|
||||
gBankLoan = MONEY(10000,00);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32) = MONEY(20000,00);
|
||||
|
||||
RCT2_GLOBAL(0x013587D0, uint32) = 0;
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_INTEREST_RATE, uint8) = 10;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_VALUE, money32) = 0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_COMPANY_VALUE, money32) = 0;
|
||||
gBankLoanInterestRate = 10;
|
||||
gParkValue = 0;
|
||||
gCompanyValue = 0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMPLETED_COMPANY_VALUE, money32) = MONEY32_UNDEFINED;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_TOTAL_ADMISSIONS, uint32) = 0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_INCOME_FROM_ADMISSIONS, uint32) = 0;
|
||||
|
@ -222,7 +222,7 @@ void finance_update_daily_profit()
|
|||
current_profit -= research_cost_table[level];
|
||||
|
||||
// Loan costs
|
||||
money32 current_loan = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32);
|
||||
money32 current_loan = gBankLoan;
|
||||
current_profit -= current_loan / 600;
|
||||
|
||||
// Ride costs
|
||||
|
@ -253,7 +253,7 @@ void finance_update_loan_hash()
|
|||
sint32 value = 0x70093A;
|
||||
value -= RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32);
|
||||
value = ror32(value, 5);
|
||||
value -= RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32);
|
||||
value -= gBankLoan;
|
||||
value = ror32(value, 7);
|
||||
value += RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32);
|
||||
value = ror32(value, 3);
|
||||
|
@ -272,7 +272,7 @@ money32 finance_get_initial_cash()
|
|||
|
||||
money32 finance_get_current_loan()
|
||||
{
|
||||
return RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32);
|
||||
return gBankLoan;
|
||||
}
|
||||
|
||||
money32 finance_get_maximum_loan()
|
||||
|
@ -282,7 +282,7 @@ money32 finance_get_maximum_loan()
|
|||
|
||||
money32 finance_get_current_cash()
|
||||
{
|
||||
return DECRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, money32));
|
||||
return DECRYPT_MONEY(gCashEncrypted);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -294,8 +294,8 @@ void game_command_set_current_loan(int* eax, int* ebx, int* ecx, int* edx, int*
|
|||
money32 money, loanDifference, currentLoan;
|
||||
money32 newLoan = *edx;
|
||||
|
||||
currentLoan = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32);
|
||||
money = DECRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, money32));
|
||||
currentLoan = gBankLoan;
|
||||
money = DECRYPT_MONEY(gCashEncrypted);
|
||||
loanDifference = currentLoan - newLoan;
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = RCT_EXPENDITURE_TYPE_INTEREST * 4;
|
||||
|
@ -315,9 +315,9 @@ void game_command_set_current_loan(int* eax, int* ebx, int* ecx, int* edx, int*
|
|||
|
||||
if (*ebx & GAME_COMMAND_FLAG_APPLY) {
|
||||
money -= loanDifference;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) = newLoan;
|
||||
gBankLoan = newLoan;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32) = money;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, money32) = ENCRYPT_MONEY(money);
|
||||
gCashEncrypted = ENCRYPT_MONEY(money);
|
||||
finance_update_loan_hash();
|
||||
|
||||
window_invalidate_by_class(WC_FINANCES);
|
||||
|
@ -362,5 +362,5 @@ void finance_shift_expenditure_table() {
|
|||
*/
|
||||
void finance_reset_cash_to_initial()
|
||||
{
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, money32) = ENCRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32));
|
||||
gCashEncrypted = ENCRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32));
|
||||
}
|
||||
|
|
|
@ -46,6 +46,10 @@ enum {
|
|||
#define EXPENDITURE_TABLE_MONTH_COUNT 16
|
||||
#define EXPENDITURE_TABLE_TOTAL_COUNT (EXPENDITURE_TABLE_MONTH_COUNT * RCT_EXPENDITURE_TYPE_COUNT)
|
||||
|
||||
#define gCashEncrypted RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, money32)
|
||||
#define gBankLoan RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32)
|
||||
#define gBankLoanInterestRate RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_INTEREST_RATE, sint8)
|
||||
|
||||
extern const money32 research_cost_table[4];
|
||||
|
||||
extern money32 *gCashHistory;
|
||||
|
|
|
@ -45,6 +45,7 @@ extern "C" {
|
|||
#include "../interface/keyboard_shortcut.h"
|
||||
#include "../localisation/date.h"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "../management/finance.h"
|
||||
#include "../network/http.h"
|
||||
#include "../scenario.h"
|
||||
#include "../windows/error.h"
|
||||
|
@ -912,7 +913,7 @@ void Network::UpdateClient()
|
|||
ProcessGameCommandQueue();
|
||||
|
||||
// Check synchronisation
|
||||
if (!_desynchronised && !CheckSRAND(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32), RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_SRAND_0, uint32))) {
|
||||
if (!_desynchronised && !CheckSRAND(gCurrentTicks, RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_SRAND_0, uint32))) {
|
||||
_desynchronised = true;
|
||||
char str_desync[256];
|
||||
format_string(str_desync, STR_MULTIPLAYER_DESYNC, NULL);
|
||||
|
@ -1128,9 +1129,9 @@ void Network::AdvertiseHeartbeat()
|
|||
json_object_set_new(gameInfo, "day", json_integer(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, uint16)));
|
||||
json_object_set_new(gameInfo, "month", json_integer(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16)));
|
||||
json_object_set_new(gameInfo, "guests", json_integer(gNumGuestsInPark));
|
||||
json_object_set_new(gameInfo, "parkValue", json_integer(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_VALUE, money32)));
|
||||
json_object_set_new(gameInfo, "parkValue", json_integer(gParkValue));
|
||||
if (!(gParkFlags & PARK_FLAGS_NO_MONEY)) {
|
||||
money32 cash = DECRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, money32));
|
||||
money32 cash = DECRYPT_MONEY(gCashEncrypted);
|
||||
json_object_set_new(gameInfo, "cash", json_integer(cash));
|
||||
}
|
||||
|
||||
|
@ -1386,14 +1387,14 @@ void Network::Server_Send_CHAT(const char* text)
|
|||
void Network::Client_Send_GAMECMD(uint32 eax, uint32 ebx, uint32 ecx, uint32 edx, uint32 esi, uint32 edi, uint32 ebp, uint8 callback)
|
||||
{
|
||||
std::unique_ptr<NetworkPacket> packet = std::move(NetworkPacket::Allocate());
|
||||
*packet << (uint32)NETWORK_COMMAND_GAMECMD << (uint32)RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) << eax << (ebx | GAME_COMMAND_FLAG_NETWORKED) << ecx << edx << esi << edi << ebp << callback;
|
||||
*packet << (uint32)NETWORK_COMMAND_GAMECMD << (uint32)gCurrentTicks << eax << (ebx | GAME_COMMAND_FLAG_NETWORKED) << ecx << edx << esi << edi << ebp << callback;
|
||||
server_connection.QueuePacket(std::move(packet));
|
||||
}
|
||||
|
||||
void Network::Server_Send_GAMECMD(uint32 eax, uint32 ebx, uint32 ecx, uint32 edx, uint32 esi, uint32 edi, uint32 ebp, uint8 playerid, uint8 callback)
|
||||
{
|
||||
std::unique_ptr<NetworkPacket> packet = std::move(NetworkPacket::Allocate());
|
||||
*packet << (uint32)NETWORK_COMMAND_GAMECMD << (uint32)RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) << eax << (ebx | GAME_COMMAND_FLAG_NETWORKED) << ecx << edx << esi << edi << ebp << playerid << callback;
|
||||
*packet << (uint32)NETWORK_COMMAND_GAMECMD << (uint32)gCurrentTicks << eax << (ebx | GAME_COMMAND_FLAG_NETWORKED) << ecx << edx << esi << edi << ebp << playerid << callback;
|
||||
SendPacketToClients(*packet);
|
||||
}
|
||||
|
||||
|
@ -1401,7 +1402,7 @@ void Network::Server_Send_TICK()
|
|||
{
|
||||
last_tick_sent_time = SDL_GetTicks();
|
||||
std::unique_ptr<NetworkPacket> packet = std::move(NetworkPacket::Allocate());
|
||||
*packet << (uint32)NETWORK_COMMAND_TICK << (uint32)RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) << (uint32)RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_SRAND_0, uint32);
|
||||
*packet << (uint32)NETWORK_COMMAND_TICK << (uint32)gCurrentTicks << (uint32)RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_SRAND_0, uint32);
|
||||
SendPacketToClients(*packet);
|
||||
}
|
||||
|
||||
|
@ -1574,7 +1575,7 @@ void Network::ProcessPacket(NetworkConnection& connection, NetworkPacket& packet
|
|||
|
||||
void Network::ProcessGameCommandQueue()
|
||||
{
|
||||
while (game_command_queue.begin() != game_command_queue.end() && game_command_queue.begin()->tick == RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32)) {
|
||||
while (game_command_queue.begin() != game_command_queue.end() && game_command_queue.begin()->tick == gCurrentTicks) {
|
||||
// run all the game commands at the current tick
|
||||
const GameCommand& gc = (*game_command_queue.begin());
|
||||
if (GetPlayerID() == gc.playerid) {
|
||||
|
@ -1776,7 +1777,7 @@ void Network::Client_Handle_MAP(NetworkConnection& connection, NetworkPacket& pa
|
|||
if (game_load_network(rw)) {
|
||||
game_load_init();
|
||||
game_command_queue.clear();
|
||||
server_tick = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32);
|
||||
server_tick = gCurrentTicks;
|
||||
server_srand0_tick = 0;
|
||||
// window_network_status_open("Loaded new map from network");
|
||||
_desynchronised = false;
|
||||
|
@ -2450,7 +2451,7 @@ void network_set_password(const char* password)
|
|||
int network_get_mode() { return NETWORK_MODE_NONE; }
|
||||
int network_get_status() { return NETWORK_STATUS_NONE; }
|
||||
int network_get_authstatus() { return NETWORK_AUTH_NONE; }
|
||||
uint32 network_get_server_tick() { return RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32); }
|
||||
uint32 network_get_server_tick() { return gCurrentTicks; }
|
||||
void network_send_gamecmd(uint32 eax, uint32 ebx, uint32 ecx, uint32 edx, uint32 esi, uint32 edi, uint32 ebp, uint8 callback) {}
|
||||
void network_send_map() {}
|
||||
void network_update() {}
|
||||
|
|
|
@ -177,7 +177,7 @@ void peep_update_all()
|
|||
peep = &(g_sprite_list[spriteIndex].peep);
|
||||
spriteIndex = peep->next;
|
||||
|
||||
if ((i & 0x7F) != (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 0x7F)) {
|
||||
if ((i & 0x7F) != (gCurrentTicks & 0x7F)) {
|
||||
peep_update(peep);
|
||||
} else {
|
||||
sub_68F41A(peep, i);
|
||||
|
@ -399,7 +399,7 @@ static void sub_68F41A(rct_peep *peep, int index)
|
|||
return;
|
||||
}
|
||||
|
||||
if ((index & 0x1FF) == (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 0x1FF)){
|
||||
if ((index & 0x1FF) == (gCurrentTicks & 0x1FF)){
|
||||
//RCT2_GLOBAL(0x00F1EDFE, uint32) = index; not needed all cases accounted for
|
||||
|
||||
if (peep->peep_flags & PEEP_FLAGS_CROWDED){
|
||||
|
@ -504,7 +504,7 @@ static void sub_68F41A(rct_peep *peep, int index)
|
|||
peep_pick_ride_to_go_on(peep);
|
||||
}
|
||||
|
||||
if ((index & 0x3FF) == (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 0x3FF)){
|
||||
if ((index & 0x3FF) == (gCurrentTicks & 0x3FF)){
|
||||
|
||||
if (peep->outside_of_park == 0 &&
|
||||
(peep->state == PEEP_STATE_WALKING || peep->state == PEEP_STATE_SITTING)){
|
||||
|
@ -1321,7 +1321,7 @@ void peep_remove(rct_peep* peep){
|
|||
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |= BTM_TB_DIRTY_FLAG_PEEP_COUNT;
|
||||
}
|
||||
if (peep->state == PEEP_STATE_ENTERING_PARK){
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_HEADING_FOR_PARK, uint16)--;
|
||||
gNumGuestsHeadingForPark--;
|
||||
}
|
||||
}
|
||||
peep_sprite_remove(peep);
|
||||
|
@ -4342,7 +4342,7 @@ static void peep_update_1(rct_peep* peep){
|
|||
* rct2: 0x690009
|
||||
*/
|
||||
static void peep_update_picked(rct_peep* peep){
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 0x1F) return;
|
||||
if (gCurrentTicks & 0x1F) return;
|
||||
peep->sub_state++;
|
||||
if (peep->sub_state == 13){
|
||||
peep_insert_new_thought(peep, PEEP_THOUGHT_TYPE_HELP, 0xFF);
|
||||
|
@ -4476,7 +4476,7 @@ static void peep_update_entering_park(rct_peep* peep){
|
|||
if (peep->var_37 != 1){
|
||||
sub_693C9E(peep);
|
||||
if ((RCT2_GLOBAL(0xF1EE18, uint16) & 2)){
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_HEADING_FOR_PARK, uint16)--;
|
||||
gNumGuestsHeadingForPark--;
|
||||
peep_sprite_remove(peep);
|
||||
}
|
||||
return;
|
||||
|
@ -4495,7 +4495,7 @@ static void peep_update_entering_park(rct_peep* peep){
|
|||
peep->outside_of_park = 0;
|
||||
peep->time_in_park = RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, uint32);
|
||||
gNumGuestsInPark++;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_HEADING_FOR_PARK, uint16)--;
|
||||
gNumGuestsHeadingForPark--;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |= BTM_TB_DIRTY_FLAG_PEEP_COUNT;
|
||||
window_invalidate_by_class(WC_GUEST_LIST);
|
||||
}
|
||||
|
@ -5452,7 +5452,7 @@ static void peep_update_walking(rct_peep* peep){
|
|||
}
|
||||
else if (peep_has_empty_container(peep)){
|
||||
if ((!(peep->next_var_29 & 0x18)) &&
|
||||
((peep->sprite_index & 0x1FF) == (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 0x1FF))&&
|
||||
((peep->sprite_index & 0x1FF) == (gCurrentTicks & 0x1FF))&&
|
||||
((0xFFFF & scenario_rand()) <= 4096)){
|
||||
|
||||
uint8 pos_stnd = 0;
|
||||
|
@ -6116,9 +6116,9 @@ rct_peep *peep_generate(int x, int y, int z)
|
|||
|
||||
peep->nausea_tolerance = RCT2_ADDRESS(0x009823A0, uint8)[nausea_tolerance];
|
||||
|
||||
sint8 happiness = (scenario_rand() & 0x1F) - 15 + RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HAPPINESS, uint8);
|
||||
sint8 happiness = (scenario_rand() & 0x1F) - 15 + gGuestInitialHappiness;
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HAPPINESS, uint8) == 0)
|
||||
if (gGuestInitialHappiness == 0)
|
||||
happiness += 0x80;
|
||||
|
||||
peep->happiness = happiness;
|
||||
|
@ -6126,11 +6126,11 @@ rct_peep *peep_generate(int x, int y, int z)
|
|||
peep->nausea = 0;
|
||||
peep->nausea_growth_rate = 0;
|
||||
|
||||
sint8 hunger = (scenario_rand() & 0x1F) - 15 + RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HUNGER, uint8);
|
||||
sint8 hunger = (scenario_rand() & 0x1F) - 15 + gGuestInitialHunger;
|
||||
|
||||
peep->hunger = hunger;
|
||||
|
||||
sint8 thirst = (scenario_rand() & 0x1F) - 15 + RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_THIRST, uint8);
|
||||
sint8 thirst = (scenario_rand() & 0x1F) - 15 + gGuestInitialThirst;
|
||||
|
||||
peep->thirst = thirst;
|
||||
|
||||
|
@ -6143,10 +6143,10 @@ rct_peep *peep_generate(int x, int y, int z)
|
|||
peep->id = RCT2_GLOBAL(0x013B0E6C, uint32)++;
|
||||
peep->name_string_idx = 767;
|
||||
|
||||
money32 cash = (scenario_rand() & 0x3) * 100 - 100 + RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16);
|
||||
money32 cash = (scenario_rand() & 0x3) * 100 - 100 + gGuestInitialCash;
|
||||
if (cash < 0) cash = 0;
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16) == 0){
|
||||
if (gGuestInitialCash == 0){
|
||||
cash = 500;
|
||||
}
|
||||
|
||||
|
@ -6154,7 +6154,7 @@ rct_peep *peep_generate(int x, int y, int z)
|
|||
cash = 0;
|
||||
}
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16) == (money16)0xFFFF){
|
||||
if (gGuestInitialCash == (money16)0xFFFF){
|
||||
cash = 0;
|
||||
}
|
||||
|
||||
|
@ -6198,7 +6198,7 @@ rct_peep *peep_generate(int x, int y, int z)
|
|||
}
|
||||
peep_update_name_sort(peep);
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_HEADING_FOR_PARK, uint16)++;
|
||||
gNumGuestsHeadingForPark++;
|
||||
|
||||
return peep;
|
||||
}
|
||||
|
@ -6961,7 +6961,7 @@ static int peep_interact_with_entrance(rct_peep* peep, sint16 x, sint16 y, rct_m
|
|||
if (!(gParkFlags & PARK_FLAGS_PARK_OPEN)){
|
||||
peep->state = PEEP_STATE_LEAVING_PARK;
|
||||
peep->var_37 = 1;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_HEADING_FOR_PARK, uint16)--;
|
||||
gNumGuestsHeadingForPark--;
|
||||
peep_window_state_update(peep);
|
||||
return peep_return_to_center_of_tile(peep);
|
||||
}
|
||||
|
@ -7019,7 +7019,7 @@ static int peep_interact_with_entrance(rct_peep* peep, sint16 x, sint16 y, rct_m
|
|||
if (!found){
|
||||
peep->state = PEEP_STATE_LEAVING_PARK;
|
||||
peep->var_37 = 1;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_HEADING_FOR_PARK, uint16)--;
|
||||
gNumGuestsHeadingForPark--;
|
||||
peep_window_state_update(peep);
|
||||
return peep_return_to_center_of_tile(peep);
|
||||
}
|
||||
|
@ -7041,7 +7041,7 @@ static int peep_interact_with_entrance(rct_peep* peep, sint16 x, sint16 y, rct_m
|
|||
if (entranceFee > peep->cash_in_pocket){
|
||||
peep->state = PEEP_STATE_LEAVING_PARK;
|
||||
peep->var_37 = 1;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_HEADING_FOR_PARK, uint16)--;
|
||||
gNumGuestsHeadingForPark--;
|
||||
peep_window_state_update(peep);
|
||||
return peep_return_to_center_of_tile(peep);
|
||||
}
|
||||
|
|
|
@ -599,6 +599,16 @@ enum {
|
|||
FOR_ALL_PEEPS(sprite_index, peep) \
|
||||
if (peep->type == PEEP_TYPE_STAFF)
|
||||
|
||||
#define gGuestChangeModifier RCT2_GLOBAL(RCT2_ADDRESS_GUEST_CHANGE_MODIFIER, uint8)
|
||||
#define gNumGuestsInPark RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16)
|
||||
#define gNumGuestsInParkLastWeek RCT2_GLOBAL(RCT2_ADDRESS_LAST_GUESTS_IN_PARK, uint16)
|
||||
#define gNumGuestsHeadingForPark RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_HEADING_FOR_PARK, uint16)
|
||||
|
||||
#define gGuestInitialCash RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16)
|
||||
#define gGuestInitialHappiness RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HAPPINESS, uint8)
|
||||
#define gGuestInitialHunger RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HUNGER, uint8)
|
||||
#define gGuestInitialThirst RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_THIRST, uint8)
|
||||
|
||||
int peep_get_staff_count();
|
||||
int peep_can_be_picked_up(rct_peep* peep);
|
||||
void peep_update_all();
|
||||
|
|
|
@ -739,7 +739,7 @@ static int staff_path_finding_handyman(rct_peep* peep)
|
|||
uint8 validDirections = staff_get_valid_patrol_directions(peep, peep->next_x, peep->next_y);
|
||||
|
||||
if ((peep->staff_orders & STAFF_ORDERS_SWEEPING) &&
|
||||
((RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) + peep->sprite_index) & 0xFFF) > 110) {
|
||||
((gCurrentTicks + peep->sprite_index) & 0xFFF) > 110) {
|
||||
litterDirection = staff_handyman_direction_to_nearest_litter(peep);
|
||||
}
|
||||
|
||||
|
|
|
@ -653,16 +653,16 @@ void S4Importer::ImportMapAnimations()
|
|||
void S4Importer::ImportFinance()
|
||||
{
|
||||
gParkEntranceFee = _s4.park_entrance_fee;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAND_COST, money16) = _s4.land_price;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST, money16) = _s4.construction_rights_price;
|
||||
gLandPrice = _s4.land_price;
|
||||
gConstructionRightsPrice = _s4.construction_rights_price;
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, uint32) = ENCRYPT_MONEY(_s4.cash);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) = _s4.loan;
|
||||
gCashEncrypted = ENCRYPT_MONEY(_s4.cash);
|
||||
gBankLoan = _s4.loan;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32) = _s4.max_loan;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32) = _s4.cash;
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_COMPANY_VALUE, money32) = _s4.company_value;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_VALUE, money32) = _s4.park_value;
|
||||
gCompanyValue = _s4.company_value;
|
||||
gParkValue = _s4.park_value;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PROFIT, money32) = _s4.profit;
|
||||
|
||||
for (int i = 0; i < 128; i++)
|
||||
|
@ -917,22 +917,22 @@ void S4Importer::ImportParkName()
|
|||
rct_string_id stringId = user_string_allocate(4, parkName);
|
||||
if (stringId != 0)
|
||||
{
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id) = stringId;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME_ARGS, uint32) = 0;
|
||||
gParkName = stringId;
|
||||
gParkNameArgs = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void S4Importer::ImportParkFlags()
|
||||
{
|
||||
// Date and srand
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) = _s4.ticks;
|
||||
gCurrentTicks = _s4.ticks;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_SRAND_0, uint32) = _s4.random_a;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_SRAND_1, uint32) = _s4.random_b;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16) = _s4.month;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, uint16) = _s4.day;
|
||||
|
||||
// Park rating
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16) = _s4.park_rating;
|
||||
gParkRating = _s4.park_rating;
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
gParkRatingHistory[i] = _s4.park_rating_history[i];
|
||||
|
@ -958,9 +958,9 @@ void S4Importer::ImportParkFlags()
|
|||
}
|
||||
|
||||
// Initial guest status
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16) = _s4.guest_initial_cash;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HUNGER, uint8) = _s4.guest_initial_hunger;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_THIRST, uint8) = _s4.guest_initial_thirst;
|
||||
gGuestInitialCash = _s4.guest_initial_cash;
|
||||
gGuestInitialHunger = _s4.guest_initial_hunger;
|
||||
gGuestInitialThirst = _s4.guest_initial_thirst;
|
||||
|
||||
// Staff colours
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_HANDYMAN_COLOUR, uint8) = RCT1::GetColour(_s4.handman_colour);
|
||||
|
@ -1023,10 +1023,10 @@ void S4Importer::ImportScenarioNameDetails()
|
|||
|
||||
void S4Importer::ImportScenarioObjective()
|
||||
{
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8) = _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;
|
||||
gScenarioObjectiveType = _s4.scenario_objective_type;
|
||||
gScenarioObjectiveYear = _s4.scenario_objective_years;
|
||||
gScenarioObjectiveCurrency = _s4.scenario_objective_currency;
|
||||
gScenarioObjectiveNumGuests = _s4.scenario_objective_num_guests;
|
||||
}
|
||||
|
||||
void S4Importer::ImportSavedView()
|
||||
|
|
|
@ -1943,7 +1943,7 @@ static void ride_update(int rideIndex)
|
|||
|
||||
// Various things include news messages
|
||||
if (ride->lifecycle_flags & (RIDE_LIFECYCLE_BREAKDOWN_PENDING | RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_DUE_INSPECTION))
|
||||
if (((RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) >> 1) & 255) == rideIndex)
|
||||
if (((gCurrentTicks >> 1) & 255) == rideIndex)
|
||||
ride_breakdown_status_update(rideIndex);
|
||||
|
||||
ride_inspection_update(ride);
|
||||
|
@ -2039,7 +2039,7 @@ static void ride_spiral_slide_update(rct_ride *ride)
|
|||
rct_map_element *mapElement;
|
||||
rct_peep *peep;
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 3)
|
||||
if (gCurrentTicks & 3)
|
||||
return;
|
||||
if (ride->slide_in_use == 0)
|
||||
return;
|
||||
|
@ -2095,7 +2095,7 @@ static void ride_inspection_update(rct_ride *ride)
|
|||
{
|
||||
int i;
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 2047)
|
||||
if (gCurrentTicks & 2047)
|
||||
return;
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_DESIGNER)
|
||||
return;
|
||||
|
@ -2160,7 +2160,7 @@ static void ride_breakdown_update(int rideIndex)
|
|||
int breakdownReason, unreliabilityAccumulator;
|
||||
rct_ride *ride = get_ride(rideIndex);
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 255)
|
||||
if (gCurrentTicks & 255)
|
||||
return;
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_DESIGNER)
|
||||
return;
|
||||
|
@ -2168,7 +2168,7 @@ static void ride_breakdown_update(int rideIndex)
|
|||
if (ride->lifecycle_flags & (RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_CRASHED))
|
||||
ride->downtime_history[0]++;
|
||||
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 8191)) {
|
||||
if (!(gCurrentTicks & 8191)) {
|
||||
int totalDowntime =
|
||||
ride->downtime_history[0] +
|
||||
ride->downtime_history[1] +
|
||||
|
@ -2677,7 +2677,7 @@ static void ride_music_update(int rideIndex)
|
|||
// Oscillate parameters for a power cut effect when breaking down
|
||||
if (ride->lifecycle_flags & (RIDE_LIFECYCLE_BREAKDOWN_PENDING | RIDE_LIFECYCLE_BROKEN_DOWN)) {
|
||||
if (ride->breakdown_reason_pending == BREAKDOWN_CONTROL_FAILURE) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 7))
|
||||
if (!(gCurrentTicks & 7))
|
||||
if (ride->breakdown_sound_modifier != 255)
|
||||
ride->breakdown_sound_modifier++;
|
||||
} else {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -6332,7 +6332,7 @@ void game_command_demolish_ride(int *eax, int *ebx, int *ecx, int *edx, int *esi
|
|||
user_string_free(ride->name);
|
||||
ride->type = RIDE_TYPE_NULL;
|
||||
window_invalidate_by_class(WC_RIDE_LIST);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_VALUE, money32) = calculate_park_value();
|
||||
gParkValue = calculate_park_value();
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16) = x;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16) = y;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16) = z;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include "../addresses.h"
|
||||
#include "../game.h"
|
||||
#include "../scenario.h"
|
||||
#include "../world/sprite.h"
|
||||
#include "station.h"
|
||||
|
@ -146,7 +147,7 @@ static void ride_update_station_normal(rct_ride *ride, int stationIndex)
|
|||
(ride->lifecycle_flags & (RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_CRASHED)) ||
|
||||
(ride->status == RIDE_STATUS_CLOSED && ride->num_riders == 0)
|
||||
) {
|
||||
if (time != 0 && time != 127 && !(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 7))
|
||||
if (time != 0 && time != 127 && !(gCurrentTicks & 7))
|
||||
time--;
|
||||
|
||||
ride->station_depart[stationIndex] = time;
|
||||
|
@ -156,7 +157,7 @@ static void ride_update_station_normal(rct_ride *ride, int stationIndex)
|
|||
ride->station_depart[stationIndex] |= STATION_DEPART_FLAG;
|
||||
ride_invalidate_station_start(ride, stationIndex, 1);
|
||||
} else {
|
||||
if (time != 127 && !(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 31))
|
||||
if (time != 127 && !(gCurrentTicks & 31))
|
||||
time--;
|
||||
|
||||
ride->station_depart[stationIndex] = time;
|
||||
|
|
|
@ -541,7 +541,7 @@ void vehicle_sounds_update()
|
|||
vehicle_sound->sound1_pan = vehicle_sound_params->pan_x;
|
||||
Mixer_Channel_Pan(vehicle_sound->sound1_channel, DStoMixerPan(vehicle_sound_params->pan_x));
|
||||
}
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 3) && vehicle_sound_params->frequency != vehicle_sound->sound1_freq) {
|
||||
if (!(gCurrentTicks & 3) && vehicle_sound_params->frequency != vehicle_sound->sound1_freq) {
|
||||
vehicle_sound->sound1_freq = vehicle_sound_params->frequency;
|
||||
uint16 frequency = vehicle_sound_params->frequency;
|
||||
if (_soundParams[sprite->vehicle.sound1_id][1] & 2) {
|
||||
|
@ -596,7 +596,7 @@ void vehicle_sounds_update()
|
|||
vehicle_sound->sound2_pan = vehicle_sound_params->pan_x;
|
||||
Mixer_Channel_Pan(vehicle_sound->sound2_channel, DStoMixerPan(vehicle_sound_params->pan_x));
|
||||
}
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 3) && vehicle_sound_params->frequency != vehicle_sound->sound2_freq) {
|
||||
if (!(gCurrentTicks & 3) && vehicle_sound_params->frequency != vehicle_sound->sound2_freq) {
|
||||
vehicle_sound->sound2_freq = vehicle_sound_params->frequency;
|
||||
if (!(_soundParams[sprite->vehicle.sound2_id][1] & 1)) {
|
||||
uint16 frequency = (vehicle_sound_params->frequency * 2) - 3248;
|
||||
|
@ -3847,7 +3847,7 @@ static void vehicle_update_haunted_house_operating(rct_vehicle* vehicle) {
|
|||
return;
|
||||
|
||||
if (vehicle->vehicle_sprite_type != 0) {
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 1) {
|
||||
if (gCurrentTicks & 1) {
|
||||
vehicle->vehicle_sprite_type++;
|
||||
vehicle_invalidate(vehicle);
|
||||
|
||||
|
@ -4320,7 +4320,7 @@ static void vehicle_update_sound(rct_vehicle *vehicle)
|
|||
switch (vehicleEntry->sound_range) {
|
||||
case 3:
|
||||
screamId = vehicle->scream_sound_id;
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 0x7F)) {
|
||||
if (!(gCurrentTicks & 0x7F)) {
|
||||
if (vehicle->velocity < 0x40000 || vehicle->scream_sound_id != 255)
|
||||
goto loc_6D7A97;
|
||||
|
||||
|
@ -4336,7 +4336,7 @@ static void vehicle_update_sound(rct_vehicle *vehicle)
|
|||
|
||||
case 4:
|
||||
screamId = vehicle->scream_sound_id;
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 0x7F)) {
|
||||
if (!(gCurrentTicks & 0x7F)) {
|
||||
if (vehicle->velocity < 0x40000 || vehicle->scream_sound_id != 255)
|
||||
goto loc_6D7A97;
|
||||
|
||||
|
@ -5073,7 +5073,7 @@ static int vehicle_update_motion_bumper_car(rct_vehicle* vehicle) {
|
|||
vehicle->acceleration = 0;
|
||||
if (!(ride->lifecycle_flags & (RIDE_LIFECYCLE_BREAKDOWN_PENDING | RIDE_LIFECYCLE_BROKEN_DOWN)) ||
|
||||
ride->breakdown_reason_pending != BREAKDOWN_SAFETY_CUT_OUT) {
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 1 &&
|
||||
if (gCurrentTicks & 1 &&
|
||||
vehicle->var_34 != 0) {
|
||||
|
||||
if (vehicle->var_34 > 0) {
|
||||
|
@ -6911,7 +6911,7 @@ loc_6DAEB9:
|
|||
if (regs.eax < RCT2_GLOBAL(0x00F64E08, sint32)) {
|
||||
vehicle->acceleration = -RCT2_GLOBAL(0x00F64E08, sint32) * 16;
|
||||
}
|
||||
else if (!(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 0x0F)) {
|
||||
else if (!(gCurrentTicks & 0x0F)) {
|
||||
if (RCT2_GLOBAL(0x00F64E2C, uint8) == 0) {
|
||||
RCT2_GLOBAL(0x00F64E2C, uint8)++;
|
||||
audio_play_sound_at_location(SOUND_51, vehicle->x, vehicle->y, vehicle->z);
|
||||
|
|
|
@ -274,14 +274,14 @@ 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();
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, sint16) = calculate_park_rating();
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_VALUE, money32) = calculate_park_value();
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_COMPANY_VALUE, money32) = calculate_company_value();
|
||||
RCT2_GLOBAL(0x013587D0, money32) = RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32) - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, sint32) = ENCRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, sint32));
|
||||
gParkRating = calculate_park_rating();
|
||||
gParkValue = calculate_park_value();
|
||||
gCompanyValue = calculate_company_value();
|
||||
RCT2_GLOBAL(0x013587D0, money32) = RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32) - gBankLoan;
|
||||
gCashEncrypted = ENCRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, sint32));
|
||||
|
||||
finance_update_loan_hash();
|
||||
|
||||
|
@ -328,7 +328,7 @@ void scenario_begin()
|
|||
|
||||
// Set the last saved game path
|
||||
char parkName[128];
|
||||
format_string(parkName, RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id), (void*)RCT2_ADDRESS_PARK_NAME_ARGS);
|
||||
format_string(parkName, gParkName, &gParkNameArgs);
|
||||
|
||||
platform_get_user_directory(gScenarioSavePath, "save");
|
||||
strncat(gScenarioSavePath, parkName, sizeof(gScenarioSavePath) - strlen(gScenarioSavePath) - 1);
|
||||
|
@ -409,7 +409,7 @@ void scenario_failure()
|
|||
*/
|
||||
void scenario_success()
|
||||
{
|
||||
const money32 companyValue = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_COMPANY_VALUE, money32);
|
||||
const money32 companyValue = gCompanyValue;
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMPLETED_COMPANY_VALUE, uint32) = companyValue;
|
||||
peep_applause();
|
||||
|
@ -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);
|
||||
|
@ -766,16 +766,16 @@ int scenario_prepare_for_save()
|
|||
}
|
||||
|
||||
if (s6Info->name[0] == 0)
|
||||
format_string(s6Info->name, RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id), (void*)RCT2_ADDRESS_PARK_NAME_ARGS);
|
||||
format_string(s6Info->name, gParkName, &gParkNameArgs);
|
||||
|
||||
s6Info->objective_type = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8);
|
||||
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);
|
||||
s6Info->objective_type = gScenarioObjectiveType;
|
||||
s6Info->objective_arg_1 = gScenarioObjectiveYear;
|
||||
s6Info->objective_arg_2 = gScenarioObjectiveCurrency;
|
||||
s6Info->objective_arg_3 = gScenarioObjectiveNumGuests;
|
||||
|
||||
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
|
||||
|
@ -1253,10 +1253,10 @@ bool scenario_save_s6(SDL_RWops* rw, rct_s6_data *s6)
|
|||
|
||||
static void scenario_objective_check_guests_by()
|
||||
{
|
||||
uint8 objectiveYear = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_YEAR, uint8);
|
||||
sint16 parkRating = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, sint16);
|
||||
uint8 objectiveYear = gScenarioObjectiveYear;
|
||||
sint16 parkRating = gParkRating;
|
||||
sint16 guestsInPark = gNumGuestsInPark;
|
||||
sint16 objectiveGuests = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16);
|
||||
sint16 objectiveGuests = gScenarioObjectiveNumGuests;
|
||||
sint16 currentMonthYear = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16);
|
||||
|
||||
if (currentMonthYear == 8 * objectiveYear){
|
||||
|
@ -1269,10 +1269,10 @@ static void scenario_objective_check_guests_by()
|
|||
|
||||
static void scenario_objective_check_park_value_by()
|
||||
{
|
||||
uint8 objectiveYear = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_YEAR, uint8);
|
||||
uint8 objectiveYear = gScenarioObjectiveYear;
|
||||
sint16 currentMonthYear = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16);
|
||||
money32 objectiveParkValue = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, money32);
|
||||
money32 parkValue = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_VALUE, money32);
|
||||
money32 objectiveParkValue = gScenarioObjectiveCurrency;
|
||||
money32 parkValue = gParkValue;
|
||||
|
||||
if (currentMonthYear == 8 * objectiveYear) {
|
||||
if (parkValue >= objectiveParkValue)
|
||||
|
@ -1321,7 +1321,7 @@ static void scenario_objective_check_10_rollercoasters()
|
|||
*/
|
||||
static void scenario_objective_check_guests_and_rating()
|
||||
{
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16) < 700 && RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16) >= 1) {
|
||||
if (gParkRating < 700 && RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16) >= 1) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_PARK_RATING_WARNING_DAYS, uint16)++;
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_RATING_WARNING_DAYS, uint16) == 1) {
|
||||
if (gConfigNotifications.park_rating_warnings) {
|
||||
|
@ -1343,20 +1343,20 @@ static void scenario_objective_check_guests_and_rating()
|
|||
news_item_add_to_queue(NEWS_ITEM_GRAPH, STR_PARK_HAS_BEEN_CLOSED_DOWN, 0);
|
||||
gParkFlags &= ~PARK_FLAGS_PARK_OPEN;
|
||||
scenario_failure();
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HAPPINESS, uint8) = 50;
|
||||
gGuestInitialHappiness = 50;
|
||||
}
|
||||
} else if (RCT2_GLOBAL(RCT2_ADDRESS_COMPLETED_COMPANY_VALUE, money32) != 0x80000001) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_PARK_RATING_WARNING_DAYS, uint16) = 0;
|
||||
}
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16) >= 700)
|
||||
if (gNumGuestsInPark >= RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16))
|
||||
if (gParkRating >= 700)
|
||||
if (gNumGuestsInPark >= gScenarioObjectiveNumGuests)
|
||||
scenario_success();
|
||||
}
|
||||
|
||||
static void scenario_objective_check_monthly_ride_income()
|
||||
{
|
||||
money32 objectiveMonthlyRideIncome = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, money32);
|
||||
money32 objectiveMonthlyRideIncome = gScenarioObjectiveCurrency;
|
||||
money32 monthlyRideIncome = RCT2_GLOBAL(RCT2_ADDRESS_MONTHLY_RIDE_INCOME, money32);
|
||||
if (monthlyRideIncome >= objectiveMonthlyRideIncome)
|
||||
scenario_success();
|
||||
|
@ -1371,7 +1371,7 @@ static void scenario_objective_check_10_rollercoasters_length()
|
|||
{
|
||||
int i, rcs = 0;
|
||||
uint8 type_already_counted[256];
|
||||
sint16 objective_length = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16);
|
||||
sint16 objective_length = gScenarioObjectiveNumGuests;
|
||||
rct_ride* ride;
|
||||
|
||||
memset(type_already_counted, 0, 256);
|
||||
|
@ -1402,7 +1402,7 @@ static void scenario_objective_check_finish_5_rollercoasters()
|
|||
int i;
|
||||
rct_ride* ride;
|
||||
|
||||
money32 objectiveRideExcitement = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, money32);
|
||||
money32 objectiveRideExcitement = gScenarioObjectiveCurrency;
|
||||
|
||||
// ORIGINAL BUG?:
|
||||
// This does not check if the rides are even rollercoasters nevermind the right rollercoasters to be finished.
|
||||
|
@ -1418,9 +1418,9 @@ static void scenario_objective_check_finish_5_rollercoasters()
|
|||
|
||||
static void scenario_objective_check_replay_loan_and_park_value()
|
||||
{
|
||||
money32 objectiveParkValue = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, money32);
|
||||
money32 parkValue = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_VALUE, money32);
|
||||
money32 currentLoan = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32);
|
||||
money32 objectiveParkValue = gScenarioObjectiveCurrency;
|
||||
money32 parkValue = gParkValue;
|
||||
money32 currentLoan = gBankLoan;
|
||||
|
||||
if (currentLoan <= 0 && parkValue >= objectiveParkValue)
|
||||
scenario_success();
|
||||
|
@ -1428,7 +1428,7 @@ static void scenario_objective_check_replay_loan_and_park_value()
|
|||
|
||||
static void scenario_objective_check_monthly_food_income()
|
||||
{
|
||||
money32 objectiveMonthlyIncome = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, money32);
|
||||
money32 objectiveMonthlyIncome = gScenarioObjectiveCurrency;
|
||||
sint32 monthlyIncome =
|
||||
RCT2_GLOBAL(0x013578A4, money32) +
|
||||
RCT2_GLOBAL(0x013578A0, money32) +
|
||||
|
@ -1445,16 +1445,8 @@ static void scenario_objective_check_monthly_food_income()
|
|||
*/
|
||||
static void scenario_objective_check()
|
||||
{
|
||||
uint8 objective_type = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8),
|
||||
objective_year = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_YEAR, uint8);
|
||||
sint16 park_rating = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, sint16),
|
||||
guests_in_park = gNumGuestsInPark,
|
||||
objective_guests = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16),
|
||||
cur_month_year = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16);
|
||||
uint8 objective_type = gScenarioObjectiveType;
|
||||
uint32 scenario_completed_company_value = RCT2_GLOBAL(RCT2_ADDRESS_COMPLETED_COMPANY_VALUE, uint32);
|
||||
sint32 objective_currency = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, sint32),
|
||||
park_value = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_VALUE, sint32);
|
||||
|
||||
|
||||
if (scenario_completed_company_value != MONEY32_UNDEFINED)
|
||||
return;
|
||||
|
|
|
@ -461,6 +461,11 @@ typedef struct {
|
|||
|
||||
extern const rct_string_id ScenarioCategoryStringIds[SCENARIO_CATEGORY_COUNT];
|
||||
|
||||
#define gScenarioObjectiveType RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8)
|
||||
#define gScenarioObjectiveYear RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_YEAR, uint8)
|
||||
#define gScenarioObjectiveNumGuests RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16)
|
||||
#define gScenarioObjectiveCurrency RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, money32)
|
||||
|
||||
// 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
|
||||
|
@ -357,30 +357,30 @@ static void window_editor_objective_options_set_objective(rct_window *w, int obj
|
|||
case OBJECTIVE_10_ROLLERCOASTERS:
|
||||
break;
|
||||
case OBJECTIVE_GUESTS_BY:
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_YEAR, uint8) = 3;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16) = 1500;
|
||||
gScenarioObjectiveYear = 3;
|
||||
gScenarioObjectiveNumGuests = 1500;
|
||||
break;
|
||||
case OBJECTIVE_PARK_VALUE_BY:
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_YEAR, uint8) = 3;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, money32) = MONEY(50000,00);
|
||||
gScenarioObjectiveYear = 3;
|
||||
gScenarioObjectiveCurrency = MONEY(50000,00);
|
||||
break;
|
||||
case OBJECTIVE_GUESTS_AND_RATING:
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16) = 2000;
|
||||
gScenarioObjectiveNumGuests = 2000;
|
||||
break;
|
||||
case OBJECTIVE_MONTHLY_RIDE_INCOME:
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, money32) = MONEY(10000,00);
|
||||
gScenarioObjectiveCurrency = MONEY(10000,00);
|
||||
break;
|
||||
case OBJECTIVE_10_ROLLERCOASTERS_LENGTH:
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16) = 1200;
|
||||
gScenarioObjectiveNumGuests = 1200;
|
||||
break;
|
||||
case OBJECTIVE_FINISH_5_ROLLERCOASTERS:
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, money32) = FIXED_2DP(6,70);
|
||||
gScenarioObjectiveCurrency = FIXED_2DP(6,70);
|
||||
break;
|
||||
case OBJECTIVE_REPLAY_LOAN_AND_PARK_VALUE:
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, money32) = MONEY(50000,00);
|
||||
gScenarioObjectiveCurrency = MONEY(50000,00);
|
||||
break;
|
||||
case OBJECTIVE_MONTHLY_FOOD_INCOME:
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, money32) = MONEY(1000,00);
|
||||
gScenarioObjectiveCurrency = MONEY(1000,00);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -402,8 +402,8 @@ static void window_editor_objective_options_main_mouseup(rct_window *w, int widg
|
|||
window_editor_objective_options_set_page(w, widgetIndex - WIDX_TAB_1);
|
||||
break;
|
||||
case WIDX_PARK_NAME:
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 16, uint32) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME_ARGS, uint32);
|
||||
window_text_input_open(w, WIDX_PARK_NAME, STR_PARK_NAME, STR_ENTER_PARK_NAME, RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id), 0, 32);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 16, uint32) = gParkNameArgs;
|
||||
window_text_input_open(w, WIDX_PARK_NAME, STR_PARK_NAME, STR_ENTER_PARK_NAME, gParkName, 0, 32);
|
||||
break;
|
||||
case WIDX_SCENARIO_NAME:
|
||||
safe_strcpy((char*)0x009BC677, s6Info->name, 64);
|
||||
|
@ -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,46 +552,46 @@ 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:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, money32) >= MONEY(2000000,00)) {
|
||||
if (gScenarioObjectiveCurrency >= MONEY(2000000,00)) {
|
||||
window_error_open(3264, STR_NONE);
|
||||
} else {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, money32) += MONEY(1000,0);
|
||||
gScenarioObjectiveCurrency += MONEY(1000,0);
|
||||
window_invalidate(w);
|
||||
}
|
||||
break;
|
||||
case OBJECTIVE_MONTHLY_FOOD_INCOME:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, money32) >= MONEY(2000000,00)) {
|
||||
if (gScenarioObjectiveCurrency >= MONEY(2000000,00)) {
|
||||
window_error_open(3264, STR_NONE);
|
||||
} else {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, money32) += MONEY(100,0);
|
||||
gScenarioObjectiveCurrency += MONEY(100,0);
|
||||
window_invalidate(w);
|
||||
}
|
||||
break;
|
||||
case OBJECTIVE_10_ROLLERCOASTERS_LENGTH:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16) >= 5000) {
|
||||
if (gScenarioObjectiveNumGuests >= 5000) {
|
||||
window_error_open(3264, STR_NONE);
|
||||
} else {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16) += 100;
|
||||
gScenarioObjectiveNumGuests += 100;
|
||||
window_invalidate(w);
|
||||
}
|
||||
break;
|
||||
case OBJECTIVE_FINISH_5_ROLLERCOASTERS:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, money32) >= FIXED_2DP(9,90)) {
|
||||
if (gScenarioObjectiveCurrency >= FIXED_2DP(9,90)) {
|
||||
window_error_open(3264, STR_NONE);
|
||||
} else {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, money32) += FIXED_2DP(0,10);
|
||||
gScenarioObjectiveCurrency += FIXED_2DP(0,10);
|
||||
window_invalidate(w);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16) >= 5000) {
|
||||
if (gScenarioObjectiveNumGuests >= 5000) {
|
||||
window_error_open(3264, STR_NONE);
|
||||
} else {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16) += 50;
|
||||
gScenarioObjectiveNumGuests += 50;
|
||||
window_invalidate(w);
|
||||
}
|
||||
break;
|
||||
|
@ -600,46 +600,46 @@ 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:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, money32) <= MONEY(1000,00)) {
|
||||
if (gScenarioObjectiveCurrency <= MONEY(1000,00)) {
|
||||
window_error_open(3265, STR_NONE);
|
||||
} else {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, money32) -= MONEY(1000,0);
|
||||
gScenarioObjectiveCurrency -= MONEY(1000,0);
|
||||
window_invalidate(w);
|
||||
}
|
||||
break;
|
||||
case OBJECTIVE_MONTHLY_FOOD_INCOME:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, money32) <= MONEY(1000,00)) {
|
||||
if (gScenarioObjectiveCurrency <= MONEY(1000,00)) {
|
||||
window_error_open(3265, STR_NONE);
|
||||
} else {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, money32) -= MONEY(100,0);
|
||||
gScenarioObjectiveCurrency -= MONEY(100,0);
|
||||
window_invalidate(w);
|
||||
}
|
||||
break;
|
||||
case OBJECTIVE_10_ROLLERCOASTERS_LENGTH:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16) <= 1000) {
|
||||
if (gScenarioObjectiveNumGuests <= 1000) {
|
||||
window_error_open(3265, STR_NONE);
|
||||
} else {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16) -= 100;
|
||||
gScenarioObjectiveNumGuests -= 100;
|
||||
window_invalidate(w);
|
||||
}
|
||||
break;
|
||||
case OBJECTIVE_FINISH_5_ROLLERCOASTERS:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, money32) <= FIXED_2DP(4,00)) {
|
||||
if (gScenarioObjectiveCurrency <= FIXED_2DP(4,00)) {
|
||||
window_error_open(3265, STR_NONE);
|
||||
} else {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, money32) -= FIXED_2DP(0,10);
|
||||
gScenarioObjectiveCurrency -= FIXED_2DP(0,10);
|
||||
window_invalidate(w);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16) <= 250) {
|
||||
if (gScenarioObjectiveNumGuests <= 250) {
|
||||
window_error_open(3265, STR_NONE);
|
||||
} else {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16) -= 50;
|
||||
gScenarioObjectiveNumGuests -= 50;
|
||||
window_invalidate(w);
|
||||
}
|
||||
break;
|
||||
|
@ -648,20 +648,20 @@ static void window_editor_objective_options_arg_1_decrease(rct_window *w)
|
|||
|
||||
static void window_editor_objective_options_arg_2_increase(rct_window *w)
|
||||
{
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_YEAR, uint8) >= 25) {
|
||||
if (gScenarioObjectiveYear >= 25) {
|
||||
window_error_open(3264, STR_NONE);
|
||||
} else {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_YEAR, uint8)++;
|
||||
gScenarioObjectiveYear++;
|
||||
window_invalidate(w);
|
||||
}
|
||||
}
|
||||
|
||||
static void window_editor_objective_options_arg_2_decrease(rct_window *w)
|
||||
{
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_YEAR, uint8) <= 1) {
|
||||
if (gScenarioObjectiveYear <= 1) {
|
||||
window_error_open(3265, STR_NONE);
|
||||
} else {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_YEAR, uint8)--;
|
||||
gScenarioObjectiveYear--;
|
||||
window_invalidate(w);
|
||||
}
|
||||
}
|
||||
|
@ -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 ((
|
||||
|
@ -782,7 +782,7 @@ static void window_editor_objective_options_main_textinput(rct_window *w, int wi
|
|||
park_set_name(text);
|
||||
|
||||
if (s6Info->name[0] == 0)
|
||||
format_string(s6Info->name, RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id), (void*)RCT2_ADDRESS_PARK_NAME_ARGS);
|
||||
format_string(s6Info->name, gParkName, &gParkNameArgs);
|
||||
break;
|
||||
case WIDX_SCENARIO_NAME:
|
||||
strncpy(s6Info->name, text, 64);
|
||||
|
@ -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,26 +933,26 @@ 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;
|
||||
arg = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16);
|
||||
arg = gScenarioObjectiveNumGuests;
|
||||
break;
|
||||
case OBJECTIVE_PARK_VALUE_BY:
|
||||
case OBJECTIVE_REPLAY_LOAN_AND_PARK_VALUE:
|
||||
case OBJECTIVE_MONTHLY_RIDE_INCOME:
|
||||
case OBJECTIVE_MONTHLY_FOOD_INCOME:
|
||||
stringId = 3246;
|
||||
arg = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, money32);
|
||||
arg = gScenarioObjectiveCurrency;
|
||||
break;
|
||||
case OBJECTIVE_10_ROLLERCOASTERS_LENGTH:
|
||||
stringId = 3310;
|
||||
arg = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16);
|
||||
arg = gScenarioObjectiveNumGuests;
|
||||
break;
|
||||
default:
|
||||
stringId = 3311;
|
||||
arg = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_CURRENCY, money32);
|
||||
arg = gScenarioObjectiveCurrency;
|
||||
break;
|
||||
}
|
||||
gfx_draw_string_left(dpi, stringId, &arg, 0, x, y);
|
||||
|
@ -967,7 +967,7 @@ static void window_editor_objective_options_main_paint(rct_window *w, rct_drawpi
|
|||
// Objective argument 2 value
|
||||
x = w->x + w->widgets[WIDX_OBJECTIVE_ARG_2].left + 1;
|
||||
y = w->y + w->widgets[WIDX_OBJECTIVE_ARG_2].top;
|
||||
arg = (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_YEAR, uint8) * MONTH_COUNT) - 1;
|
||||
arg = (gScenarioObjectiveYear * MONTH_COUNT) - 1;
|
||||
gfx_draw_string_left(dpi, 3302, &arg, 0, x, y);
|
||||
}
|
||||
|
||||
|
@ -990,9 +990,9 @@ static void window_editor_objective_options_main_paint(rct_window *w, rct_drawpi
|
|||
if (stex != NULL) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = stex->park_name;
|
||||
} else {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = gParkName;
|
||||
}
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME_ARGS, uint32);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = gParkNameArgs;
|
||||
gfx_draw_string_left_clipped(dpi, 3298, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y, width);
|
||||
|
||||
// Scenario name
|
||||
|
@ -1006,7 +1006,7 @@ static void window_editor_objective_options_main_paint(rct_window *w, rct_drawpi
|
|||
safe_strcpy((char*)0x009BC677, s6Info->name, 64);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = 3165;
|
||||
}
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME_ARGS, uint32);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = gParkNameArgs;
|
||||
gfx_draw_string_left_clipped(dpi, 3300, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y, width);
|
||||
|
||||
// Scenario details label
|
||||
|
@ -1025,7 +1025,7 @@ static void window_editor_objective_options_main_paint(rct_window *w, rct_drawpi
|
|||
safe_strcpy((char*)0x009BC677, s6Info->details, 256);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = 3165;
|
||||
}
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME_ARGS, uint32);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = gParkNameArgs;
|
||||
gfx_draw_string_left_wrapped(dpi, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, x, y, width, 1191, 0);
|
||||
|
||||
// Scenario category label
|
||||
|
|
|
@ -484,7 +484,7 @@ static void window_editor_scenario_options_financial_mousedown(int widgetIndex,
|
|||
case WIDX_INITIAL_CASH_INCREASE:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32) < MONEY(1000000,00)) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32) += MONEY(500,00);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, money32) = ENCRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32));
|
||||
gCashEncrypted = ENCRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32));
|
||||
finance_update_loan_hash();
|
||||
} else {
|
||||
window_error_open(3248, STR_NONE);
|
||||
|
@ -494,7 +494,7 @@ static void window_editor_scenario_options_financial_mousedown(int widgetIndex,
|
|||
case WIDX_INITIAL_CASH_DECREASE:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32) > MONEY(0,00)) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32) -= MONEY(500,00);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, money32) = ENCRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32));
|
||||
gCashEncrypted = ENCRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_INITIAL_CASH, money32));
|
||||
finance_update_loan_hash();
|
||||
} else {
|
||||
window_error_open(3249, STR_NONE);
|
||||
|
@ -502,9 +502,9 @@ static void window_editor_scenario_options_financial_mousedown(int widgetIndex,
|
|||
window_invalidate(w);
|
||||
break;
|
||||
case WIDX_INITIAL_LOAN_INCREASE:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) < MONEY(5000000,00)) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) += MONEY(1000,00);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32) = max(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32), RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32));
|
||||
if (gBankLoan < MONEY(5000000,00)) {
|
||||
gBankLoan += MONEY(1000,00);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32) = max(gBankLoan, RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32));
|
||||
finance_update_loan_hash();
|
||||
} else {
|
||||
window_error_open(3250, STR_NONE);
|
||||
|
@ -512,9 +512,9 @@ static void window_editor_scenario_options_financial_mousedown(int widgetIndex,
|
|||
window_invalidate(w);
|
||||
break;
|
||||
case WIDX_INITIAL_LOAN_DECREASE:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) > MONEY(0,00)) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) -= MONEY(1000,00);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32) = max(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32), RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32));
|
||||
if (gBankLoan > MONEY(0,00)) {
|
||||
gBankLoan -= MONEY(1000,00);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32) = max(gBankLoan, RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32));
|
||||
finance_update_loan_hash();
|
||||
} else {
|
||||
window_error_open(3251, STR_NONE);
|
||||
|
@ -524,7 +524,7 @@ static void window_editor_scenario_options_financial_mousedown(int widgetIndex,
|
|||
case WIDX_MAXIMUM_LOAN_INCREASE:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32) < MONEY(5000000,00)) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32) += MONEY(1000,00);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) = min(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32), RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32));
|
||||
gBankLoan = min(gBankLoan, RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32));
|
||||
finance_update_loan_hash();
|
||||
} else {
|
||||
window_error_open(3252, STR_NONE);
|
||||
|
@ -534,7 +534,7 @@ static void window_editor_scenario_options_financial_mousedown(int widgetIndex,
|
|||
case WIDX_MAXIMUM_LOAN_DECREASE:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32) > MONEY(0,00)) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32) -= MONEY(1000,00);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) = min(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32), RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32));
|
||||
gBankLoan = min(gBankLoan, RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, money32));
|
||||
finance_update_loan_hash();
|
||||
} else {
|
||||
window_error_open(3253, STR_NONE);
|
||||
|
@ -542,11 +542,11 @@ static void window_editor_scenario_options_financial_mousedown(int widgetIndex,
|
|||
window_invalidate(w);
|
||||
break;
|
||||
case WIDX_INTEREST_RATE_INCREASE:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_INTEREST_RATE, money32) < 80) {
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_INTEREST_RATE, money32) < 0) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_INTEREST_RATE, money32) = 0;
|
||||
if (gBankLoanInterestRate < 80) {
|
||||
if (gBankLoanInterestRate < 0) {
|
||||
gBankLoanInterestRate = 0;
|
||||
} else {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_INTEREST_RATE, money32)++;
|
||||
gBankLoanInterestRate++;
|
||||
}
|
||||
} else {
|
||||
window_error_open(3254, STR_NONE);
|
||||
|
@ -554,11 +554,11 @@ static void window_editor_scenario_options_financial_mousedown(int widgetIndex,
|
|||
window_invalidate(w);
|
||||
break;
|
||||
case WIDX_INTEREST_RATE_DECREASE:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_INTEREST_RATE, money32) > 0) {
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_INTEREST_RATE, money32) > 80) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_INTEREST_RATE, money32) = 80;
|
||||
if (gBankLoanInterestRate > 0) {
|
||||
if (gBankLoanInterestRate > 80) {
|
||||
gBankLoanInterestRate = 80;
|
||||
} else {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_INTEREST_RATE, money32)--;
|
||||
gBankLoanInterestRate--;
|
||||
}
|
||||
} else {
|
||||
window_error_open(3255, STR_NONE);
|
||||
|
@ -664,7 +664,7 @@ static void window_editor_scenario_options_financial_paint(rct_window *w, rct_dr
|
|||
|
||||
x = w->x + w->widgets[WIDX_INITIAL_LOAN].left + 1;
|
||||
y = w->y + w->widgets[WIDX_INITIAL_LOAN].top;
|
||||
gfx_draw_string_left(dpi, 3246, &RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32), 0, x, y);
|
||||
gfx_draw_string_left(dpi, 3246, &gBankLoan, 0, x, y);
|
||||
}
|
||||
|
||||
if (w->widgets[WIDX_MAXIMUM_LOAN].type != WWT_EMPTY) {
|
||||
|
@ -685,7 +685,7 @@ static void window_editor_scenario_options_financial_paint(rct_window *w, rct_dr
|
|||
x = w->x + w->widgets[WIDX_INTEREST_RATE].left + 1;
|
||||
y = w->y + w->widgets[WIDX_INTEREST_RATE].top;
|
||||
|
||||
money16 interestRate = (money16)clamp(INT16_MIN, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_INTEREST_RATE, money32), INT16_MAX);
|
||||
money16 interestRate = (money16)clamp(INT16_MIN, gBankLoanInterestRate, INT16_MAX);
|
||||
gfx_draw_string_left(dpi, 3247, &interestRate, 0, x, y);
|
||||
}
|
||||
}
|
||||
|
@ -737,64 +737,64 @@ static void window_editor_scenario_options_guests_mousedown(int widgetIndex, rct
|
|||
{
|
||||
switch (widgetIndex) {
|
||||
case WIDX_CASH_PER_GUEST_INCREASE:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16) < MONEY(1000, 00)) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16) += MONEY(1, 00);
|
||||
if (gGuestInitialCash < MONEY(1000, 00)) {
|
||||
gGuestInitialCash += MONEY(1, 00);
|
||||
} else {
|
||||
window_error_open(3264, STR_NONE);
|
||||
}
|
||||
window_invalidate(w);
|
||||
break;
|
||||
case WIDX_CASH_PER_GUEST_DECREASE:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16) > MONEY(0, 00)) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16) -= MONEY(1, 00);
|
||||
if (gGuestInitialCash > MONEY(0, 00)) {
|
||||
gGuestInitialCash -= MONEY(1, 00);
|
||||
} else {
|
||||
window_error_open(3265, STR_NONE);
|
||||
}
|
||||
window_invalidate(w);
|
||||
break;
|
||||
case WIDX_GUEST_INITIAL_HAPPINESS_INCREASE:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HAPPINESS, uint8) < 250) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HAPPINESS, uint8) += 4;
|
||||
if (gGuestInitialHappiness < 250) {
|
||||
gGuestInitialHappiness += 4;
|
||||
} else {
|
||||
window_error_open(3264, STR_NONE);
|
||||
}
|
||||
window_invalidate(w);
|
||||
break;
|
||||
case WIDX_GUEST_INITIAL_HAPPINESS_DECREASE:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HAPPINESS, uint8) > 40) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HAPPINESS, uint8) -= 4;
|
||||
if (gGuestInitialHappiness > 40) {
|
||||
gGuestInitialHappiness -= 4;
|
||||
} else {
|
||||
window_error_open(3265, STR_NONE);
|
||||
}
|
||||
window_invalidate(w);
|
||||
break;
|
||||
case WIDX_GUEST_INITIAL_HUNGER_INCREASE:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HUNGER, uint8) > 40) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HUNGER, uint8) -= 4;
|
||||
if (gGuestInitialHunger > 40) {
|
||||
gGuestInitialHunger -= 4;
|
||||
} else {
|
||||
window_error_open(3264, STR_NONE);
|
||||
}
|
||||
window_invalidate(w);
|
||||
break;
|
||||
case WIDX_GUEST_INITIAL_HUNGER_DECREASE:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HUNGER, uint8) < 250) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HUNGER, uint8) += 4;
|
||||
if (gGuestInitialHunger < 250) {
|
||||
gGuestInitialHunger += 4;
|
||||
} else {
|
||||
window_error_open(3265, STR_NONE);
|
||||
}
|
||||
window_invalidate(w);
|
||||
break;
|
||||
case WIDX_GUEST_INITIAL_THIRST_INCREASE:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_THIRST, uint8) > 40) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_THIRST, uint8) -= 4;
|
||||
if (gGuestInitialThirst > 40) {
|
||||
gGuestInitialThirst -= 4;
|
||||
} else {
|
||||
window_error_open(3264, STR_NONE);
|
||||
}
|
||||
window_invalidate(w);
|
||||
break;
|
||||
case WIDX_GUEST_INITIAL_THIRST_DECREASE:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_THIRST, uint8) < 250) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_THIRST, uint8) += 4;
|
||||
if (gGuestInitialThirst < 250) {
|
||||
gGuestInitialThirst += 4;
|
||||
} else {
|
||||
window_error_open(3265, STR_NONE);
|
||||
}
|
||||
|
@ -881,7 +881,7 @@ static void window_editor_scenario_options_guests_paint(rct_window *w, rct_drawp
|
|||
// Cash per guest value
|
||||
x = w->x + w->widgets[WIDX_CASH_PER_GUEST].left + 1;
|
||||
y = w->y + w->widgets[WIDX_CASH_PER_GUEST].top;
|
||||
arg = RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16);
|
||||
arg = gGuestInitialCash;
|
||||
gfx_draw_string_left(dpi, 3246, &arg, 0, x, y);
|
||||
}
|
||||
|
||||
|
@ -893,7 +893,7 @@ static void window_editor_scenario_options_guests_paint(rct_window *w, rct_drawp
|
|||
// Guest initial happiness value
|
||||
x = w->x + w->widgets[WIDX_GUEST_INITIAL_HAPPINESS].left + 1;
|
||||
y = w->y + w->widgets[WIDX_GUEST_INITIAL_HAPPINESS].top;
|
||||
arg = (RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HAPPINESS, uint8) * 100) / 255;
|
||||
arg = (gGuestInitialHappiness * 100) / 255;
|
||||
gfx_draw_string_left(dpi, 3247, &arg, 0, x, y);
|
||||
|
||||
// Guest initial hunger label
|
||||
|
@ -904,7 +904,7 @@ static void window_editor_scenario_options_guests_paint(rct_window *w, rct_drawp
|
|||
// Guest initial hunger value
|
||||
x = w->x + w->widgets[WIDX_GUEST_INITIAL_HUNGER].left + 1;
|
||||
y = w->y + w->widgets[WIDX_GUEST_INITIAL_HUNGER].top;
|
||||
arg = ((255 - RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HUNGER, uint8)) * 100) / 255;
|
||||
arg = ((255 - gGuestInitialHunger) * 100) / 255;
|
||||
gfx_draw_string_left(dpi, 3247, &arg, 0, x, y);
|
||||
|
||||
// Guest initial thirst label
|
||||
|
@ -915,7 +915,7 @@ static void window_editor_scenario_options_guests_paint(rct_window *w, rct_drawp
|
|||
// Guest initial thirst value
|
||||
x = w->x + w->widgets[WIDX_GUEST_INITIAL_THIRST].left + 1;
|
||||
y = w->y + w->widgets[WIDX_GUEST_INITIAL_THIRST].top;
|
||||
arg = ((255 - RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_THIRST, uint8)) * 100) / 255;
|
||||
arg = ((255 - gGuestInitialThirst) * 100) / 255;
|
||||
gfx_draw_string_left(dpi, 3247, &arg, 0, x, y);
|
||||
}
|
||||
|
||||
|
@ -980,32 +980,32 @@ static void window_editor_scenario_options_park_mousedown(int widgetIndex, rct_w
|
|||
|
||||
switch (widgetIndex) {
|
||||
case WIDX_LAND_COST_INCREASE:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_COST, money16) < MONEY(200,00)) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAND_COST, money16) += MONEY(1,00);
|
||||
if (gLandPrice < MONEY(200,00)) {
|
||||
gLandPrice += MONEY(1,00);
|
||||
} else {
|
||||
window_error_open(3264, STR_NONE);
|
||||
}
|
||||
window_invalidate(w);
|
||||
break;
|
||||
case WIDX_LAND_COST_DECREASE:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_COST, money16) > MONEY(5,00)) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAND_COST, money16) -= MONEY(1,00);
|
||||
if (gLandPrice > MONEY(5,00)) {
|
||||
gLandPrice -= MONEY(1,00);
|
||||
} else {
|
||||
window_error_open(3265, STR_NONE);
|
||||
}
|
||||
window_invalidate(w);
|
||||
break;
|
||||
case WIDX_CONSTRUCTION_RIGHTS_COST_INCREASE:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST, money16) < MONEY(200,00)) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST, money16) += MONEY(1,00);
|
||||
if (gConstructionRightsPrice < MONEY(200,00)) {
|
||||
gConstructionRightsPrice += MONEY(1,00);
|
||||
} else {
|
||||
window_error_open(3264, STR_NONE);
|
||||
}
|
||||
window_invalidate(w);
|
||||
break;
|
||||
case WIDX_CONSTRUCTION_RIGHTS_COST_DECREASE:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST, money16) > MONEY(5,00)) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST, money16) -= MONEY(1,00);
|
||||
if (gConstructionRightsPrice > MONEY(5,00)) {
|
||||
gConstructionRightsPrice -= MONEY(1,00);
|
||||
} else {
|
||||
window_error_open(3265, STR_NONE);
|
||||
}
|
||||
|
@ -1191,7 +1191,7 @@ static void window_editor_scenario_options_park_paint(rct_window *w, rct_drawpix
|
|||
// Cost to buy land value
|
||||
x = w->x + w->widgets[WIDX_LAND_COST].left + 1;
|
||||
y = w->y + w->widgets[WIDX_LAND_COST].top;
|
||||
arg = RCT2_GLOBAL(RCT2_ADDRESS_LAND_COST, money16);
|
||||
arg = gLandPrice;
|
||||
gfx_draw_string_left(dpi, 3246, &arg, 0, x, y);
|
||||
}
|
||||
|
||||
|
@ -1204,7 +1204,7 @@ static void window_editor_scenario_options_park_paint(rct_window *w, rct_drawpix
|
|||
// Cost to buy construction rights value
|
||||
x = w->x + w->widgets[WIDX_CONSTRUCTION_RIGHTS_COST].left + 1;
|
||||
y = w->y + w->widgets[WIDX_CONSTRUCTION_RIGHTS_COST].top;
|
||||
arg = RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST, money16);
|
||||
arg = gConstructionRightsPrice;
|
||||
gfx_draw_string_left(dpi, 3246, &arg, 0, x, y);
|
||||
}
|
||||
|
||||
|
|
|
@ -600,13 +600,13 @@ static void window_finances_summary_mousedown(int widgetIndex, rct_window*w, rct
|
|||
|
||||
switch (widgetIndex) {
|
||||
case WIDX_LOAN_INCREASE:
|
||||
newLoan = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) + MONEY(1000, 00);
|
||||
newLoan = gBankLoan + MONEY(1000, 00);
|
||||
gGameCommandErrorTitle = STR_CANT_BORROW_ANY_MORE_MONEY;
|
||||
finance_set_loan(newLoan);
|
||||
break;
|
||||
case WIDX_LOAN_DECREASE:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) > 0) {
|
||||
newLoan = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) - MONEY(1000, 00);
|
||||
if (gBankLoan > 0) {
|
||||
newLoan = gBankLoan - MONEY(1000, 00);
|
||||
gGameCommandErrorTitle = STR_CANT_PAY_BACK_LOAN;
|
||||
finance_set_loan(newLoan);
|
||||
}
|
||||
|
@ -640,7 +640,7 @@ static void window_finances_summary_invalidate(rct_window *w)
|
|||
}
|
||||
|
||||
window_finances_set_pressed_tab(w);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6, money32) = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 6, money32) = gBankLoan;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -734,16 +734,16 @@ static void window_finances_summary_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
|
||||
// Loan and interest rate
|
||||
gfx_draw_string_left(dpi, STR_FINANCES_SUMMARY_LOAN, NULL, 0, w->x + 4, w->y + 229);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_INTEREST_RATE, uint8);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = gBankLoanInterestRate;
|
||||
gfx_draw_string_left(dpi, STR_FINANCES_SUMMARY_AT_X_PER_YEAR, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, w->x + 156, w->y + 229);
|
||||
|
||||
// Current cash
|
||||
money32 currentCash = DECRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, money32));
|
||||
money32 currentCash = DECRYPT_MONEY(gCashEncrypted);
|
||||
rct_string_id stringId = currentCash >= 0 ? STR_CASH_LABEL : STR_CASH_NEGATIVE_LABEL;
|
||||
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) {
|
||||
|
@ -756,8 +756,8 @@ static void window_finances_summary_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
gfx_draw_string_left(dpi, STR_LAST_MONTH_PROFIT_FROM_FOOD_DRINK_MERCHANDISE_SALES_LABEL, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, w->x + 280, w->y + 229);
|
||||
} else {
|
||||
// Park value and company value
|
||||
gfx_draw_string_left(dpi, STR_PARK_VALUE_LABEL, (void*)RCT2_ADDRESS_CURRENT_PARK_VALUE, 0, w->x + 280, w->y + 229);
|
||||
gfx_draw_string_left(dpi, STR_COMPANY_VALUE_LABEL, (void*)RCT2_ADDRESS_CURRENT_COMPANY_VALUE, 0, w->x + 280, w->y + 244);
|
||||
gfx_draw_string_left(dpi, STR_PARK_VALUE_LABEL, &gParkValue, 0, w->x + 280, w->y + 229);
|
||||
gfx_draw_string_left(dpi, STR_COMPANY_VALUE_LABEL, &gCompanyValue, 0, w->x + 280, w->y + 244);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -824,8 +824,8 @@ static void window_finances_financial_graph_paint(rct_window *w, rct_drawpixelin
|
|||
|
||||
// Cash (less loan)
|
||||
money32 cashLessLoan =
|
||||
DECRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, money32)) -
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32);
|
||||
DECRYPT_MONEY(gCashEncrypted) -
|
||||
gBankLoan;
|
||||
|
||||
gfx_draw_string_left(
|
||||
dpi,
|
||||
|
@ -933,7 +933,7 @@ static void window_finances_park_value_graph_paint(rct_window *w, rct_drawpixeli
|
|||
graphBottom = w->y + pageWidget->bottom - 4;
|
||||
|
||||
// Park value
|
||||
money32 parkValue = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_VALUE, money32);
|
||||
money32 parkValue = gParkValue;
|
||||
gfx_draw_string_left(
|
||||
dpi,
|
||||
STR_FINACNES_PARK_VALUE,
|
||||
|
@ -1183,8 +1183,8 @@ static void window_finances_marketing_paint(rct_window *w, rct_drawpixelinfo *dp
|
|||
continue;
|
||||
|
||||
noCampaignsActive = 0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME_ARGS, uint32);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = gParkName;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = gParkNameArgs;
|
||||
|
||||
// Set special parameters
|
||||
switch (i) {
|
||||
|
|
|
@ -20,12 +20,14 @@
|
|||
|
||||
#include "../addresses.h"
|
||||
#include "../config.h"
|
||||
#include "../game.h"
|
||||
#include "../input.h"
|
||||
#include "../interface/themes.h"
|
||||
#include "../interface/widget.h"
|
||||
#include "../interface/window.h"
|
||||
#include "../localisation/date.h"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "../management/finance.h"
|
||||
#include "../management/news_item.h"
|
||||
#include "../peep/peep.h"
|
||||
#include "../peep/staff.h"
|
||||
|
@ -220,10 +222,10 @@ static void window_game_bottom_toolbar_tooltip(rct_window* w, int widgetIndex, r
|
|||
switch (widgetIndex) {
|
||||
case WIDX_MONEY:
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, int) = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PROFIT, sint32);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, int) = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_VALUE, sint32);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, int) = gParkValue;
|
||||
break;
|
||||
case WIDX_PARK_RATING:
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, short) = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, sint16);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, short) = gParkRating;
|
||||
break;
|
||||
case WIDX_DATE:
|
||||
month = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16) & 7;
|
||||
|
@ -380,7 +382,7 @@ static void window_game_bottom_toolbar_draw_left_panel(rct_drawpixelinfo *dpi, r
|
|||
|
||||
// Draw money
|
||||
if (!(gParkFlags & PARK_FLAGS_NO_MONEY)) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, int) = DECRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, sint32));
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, int) = DECRYPT_MONEY(gCashEncrypted);
|
||||
gfx_draw_string_centred(
|
||||
dpi,
|
||||
(RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, int) < 0 ? 1391 : 1390),
|
||||
|
@ -394,7 +396,7 @@ static void window_game_bottom_toolbar_draw_left_panel(rct_drawpixelinfo *dpi, r
|
|||
// Draw guests
|
||||
gfx_draw_string_centred(
|
||||
dpi,
|
||||
STR_NUM_GUESTS + RCT2_GLOBAL(RCT2_ADDRESS_GUEST_CHANGE_MODIFIER, uint8),
|
||||
STR_NUM_GUESTS + gGuestChangeModifier,
|
||||
x, y,
|
||||
(gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_GUESTS ? COLOUR_WHITE : w->colours[0] & 0x7F),
|
||||
&gNumGuestsInPark
|
||||
|
@ -407,7 +409,7 @@ static void window_game_bottom_toolbar_draw_left_panel(rct_drawpixelinfo *dpi, r
|
|||
w->colours[3],
|
||||
w->x + window_game_bottom_toolbar_widgets[WIDX_PARK_RATING].left + 11,
|
||||
w->y + window_game_bottom_toolbar_widgets[WIDX_PARK_RATING].top,
|
||||
max(10, ((RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, sint16) / 4) * 263) / 256)
|
||||
max(10, ((gParkRating / 4) * 263) / 256)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -421,7 +423,7 @@ static void window_game_bottom_toolbar_draw_park_rating(rct_drawpixelinfo *dpi,
|
|||
|
||||
bar_width = (factor * (90 + WIDTH_MOD)) / 256;
|
||||
gfx_fill_rect_inset(dpi, x, y + 1, x + (93 + WIDTH_MOD), y + 9, w->colours[1], 48);
|
||||
if (!(colour & 0x80000000) || RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 || (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 8)) {
|
||||
if (!(colour & 0x80000000) || RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 || (gCurrentTicks & 8)) {
|
||||
if (bar_width > 2)
|
||||
gfx_fill_rect_inset(dpi, x + 2, y + 2, x + bar_width - 1, y + 8, colour & 0x7FFFFFFF, 0);
|
||||
}
|
||||
|
|
|
@ -1404,7 +1404,7 @@ void window_guest_stats_bars_paint(int value, int x, int y, rct_window *w, rct_d
|
|||
colour &= ~(1 << 0x1F);
|
||||
if (!blink_flag ||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0 ||
|
||||
(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 8) == 0)
|
||||
(gCurrentTicks & 8) == 0)
|
||||
{
|
||||
if (value <= 2)
|
||||
return;
|
||||
|
@ -2096,8 +2096,8 @@ static rct_string_id window_guest_inventory_format_item(rct_peep *peep, int item
|
|||
// Default arguments
|
||||
RCT2_GLOBAL(args + 0, uint32) = ShopItemImage[item];
|
||||
RCT2_GLOBAL(args + 4, uint16) = ShopItemStringIds[item].display;
|
||||
RCT2_GLOBAL(args + 6, uint16) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, uint16);
|
||||
RCT2_GLOBAL(args + 8, uint32) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME_ARGS, uint32);
|
||||
RCT2_GLOBAL(args + 6, uint16) = gParkName;
|
||||
RCT2_GLOBAL(args + 8, uint32) = gParkNameArgs;
|
||||
|
||||
// Special overrides
|
||||
switch (item) {
|
||||
|
@ -2116,8 +2116,8 @@ static rct_string_id window_guest_inventory_format_item(rct_peep *peep, int item
|
|||
switch (peep->voucher_type) {
|
||||
case VOUCHER_TYPE_PARK_ENTRY_FREE:
|
||||
RCT2_GLOBAL(args + 6, uint16) = 2418;
|
||||
RCT2_GLOBAL(args + 8, uint16) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, uint16);
|
||||
RCT2_GLOBAL(args + 10, uint32) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME_ARGS, uint32);
|
||||
RCT2_GLOBAL(args + 8, uint16) = gParkName;
|
||||
RCT2_GLOBAL(args + 10, uint32) = gParkNameArgs;
|
||||
break;
|
||||
case VOUCHER_TYPE_RIDE_FREE:
|
||||
ride = get_ride(peep->voucher_arguments);
|
||||
|
@ -2127,8 +2127,8 @@ static rct_string_id window_guest_inventory_format_item(rct_peep *peep, int item
|
|||
break;
|
||||
case VOUCHER_TYPE_PARK_ENTRY_HALF_PRICE:
|
||||
RCT2_GLOBAL(args + 6, uint16) = 2420;
|
||||
RCT2_GLOBAL(args + 8, uint16) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, uint16);
|
||||
RCT2_GLOBAL(args + 10, uint32) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME_ARGS, uint32);
|
||||
RCT2_GLOBAL(args + 8, uint16) = gParkName;
|
||||
RCT2_GLOBAL(args + 10, uint32) = gParkNameArgs;
|
||||
break;
|
||||
case VOUCHER_TYPE_FOOD_OR_DRINK_FREE:
|
||||
RCT2_GLOBAL(args + 6, uint16) = 2421;
|
||||
|
|
|
@ -576,8 +576,8 @@ static void window_park_set_disabled_tabs(rct_window *w)
|
|||
|
||||
static void window_park_prepare_window_title_text()
|
||||
{
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME_ARGS, uint32);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = gParkName;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = gParkNameArgs;
|
||||
}
|
||||
|
||||
#pragma region Entrance page
|
||||
|
@ -646,8 +646,8 @@ static void window_park_entrance_mouseup(rct_window *w, int widgetIndex)
|
|||
window_scroll_to_viewport(w);
|
||||
break;
|
||||
case WIDX_RENAME:
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 16, uint32) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME_ARGS, uint32);
|
||||
window_text_input_open(w, WIDX_RENAME, STR_PARK_NAME, STR_ENTER_PARK_NAME, RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id), 0, 32);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 16, uint32) = gParkNameArgs;
|
||||
window_text_input_open(w, WIDX_RENAME, STR_PARK_NAME, STR_ENTER_PARK_NAME, gParkName, 0, 32);
|
||||
break;
|
||||
case WIDX_CLOSE_LIGHT:
|
||||
park_set_open(0);
|
||||
|
@ -949,15 +949,15 @@ static void window_park_entrance_invalidate(rct_window *w)
|
|||
window_park_set_pressed_tab(w);
|
||||
|
||||
// Set open / close park button state
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME_ARGS, uint32);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = gParkName;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = gParkNameArgs;
|
||||
window_park_entrance_widgets[WIDX_OPEN_OR_CLOSE].image = park_is_open() ? SPR_OPEN : SPR_CLOSED;
|
||||
window_park_entrance_widgets[WIDX_CLOSE_LIGHT].image = SPR_G2_RCT1_CLOSE_BUTTON_0 + !park_is_open() * 2 + widget_is_pressed(w, WIDX_CLOSE_LIGHT);
|
||||
window_park_entrance_widgets[WIDX_OPEN_LIGHT].image = SPR_G2_RCT1_OPEN_BUTTON_0 + park_is_open() * 2 + widget_is_pressed(w, WIDX_OPEN_LIGHT);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
@ -1242,7 +1242,7 @@ static void window_park_rating_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
widget = &window_park_rating_widgets[WIDX_PAGE_BACKGROUND];
|
||||
|
||||
// Current value
|
||||
gfx_draw_string_left(dpi, STR_PARK_RATING_LABEL, (void*)RCT2_ADDRESS_CURRENT_PARK_RATING, 0, x + widget->left + 3, y + widget->top + 2);
|
||||
gfx_draw_string_left(dpi, STR_PARK_RATING_LABEL, &gParkRating, 0, x + widget->left + 3, y + widget->top + 2);
|
||||
|
||||
// Graph border
|
||||
gfx_fill_rect_inset(dpi, x + widget->left + 4, y + widget->top + 15, x + widget->right - 4, y + widget->bottom - 4, w->colours[1], 0x30);
|
||||
|
@ -1757,11 +1757,11 @@ static void window_park_objective_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
y += 10;
|
||||
|
||||
// Objective
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, short) = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16);
|
||||
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);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, short) = gScenarioObjectiveNumGuests;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, short) = date_get_total_months(MONTH_OCTOBER, gScenarioObjectiveYear);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 4, int) = gScenarioObjectiveCurrency;
|
||||
|
||||
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
|
||||
|
|
|
@ -3360,7 +3360,7 @@ static void window_ride_maintenance_draw_bar(rct_window *w, rct_drawpixelinfo *d
|
|||
gfx_fill_rect_inset(dpi, x, y, x + 149, y + 8, w->colours[1], 0x30);
|
||||
if (unk & (1u << 31)) {
|
||||
unk &= ~(1u << 31);
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) == 0 && (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 8))
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) == 0 && (gCurrentTicks & 8))
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ void climate_update()
|
|||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CLIMATE_UPDATE_TIMER, sint16)--;
|
||||
|
||||
} else if (!(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 0x7F)) {
|
||||
} else if (!(gCurrentTicks & 0x7F)) {
|
||||
|
||||
if (temperature == target_temperature) {
|
||||
if (cur_gloom == next_gloom) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "../addresses.h"
|
||||
#include "../audio/audio.h"
|
||||
#include "../game.h"
|
||||
#include "../localisation/date.h"
|
||||
#include "../scenario.h"
|
||||
#include "sprite.h"
|
||||
|
@ -113,7 +114,7 @@ static void duck_invalidate(rct_duck *duck)
|
|||
*/
|
||||
static void duck_update_fly_to_water(rct_duck *duck)
|
||||
{
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 3)
|
||||
if (gCurrentTicks & 3)
|
||||
return;
|
||||
|
||||
duck->var_26++;
|
||||
|
@ -167,7 +168,7 @@ static void duck_update_fly_to_water(rct_duck *duck)
|
|||
*/
|
||||
static void duck_update_swim(rct_duck *duck)
|
||||
{
|
||||
if ((RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) + duck->sprite_index) & 3)
|
||||
if ((gCurrentTicks + duck->sprite_index) & 3)
|
||||
return;
|
||||
|
||||
uint32 randomNumber = scenario_rand();
|
||||
|
@ -261,7 +262,7 @@ static void duck_update_double_drink(rct_duck *duck)
|
|||
*/
|
||||
static void duck_update_fly_away(rct_duck *duck)
|
||||
{
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 3)
|
||||
if (gCurrentTicks & 3)
|
||||
return;
|
||||
|
||||
duck->var_26++;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include "../addresses.h"
|
||||
#include "../game.h"
|
||||
#include "../scenario.h"
|
||||
#include "fountain.h"
|
||||
#include "map.h"
|
||||
|
@ -106,7 +107,7 @@ void jumping_fountain_begin(int type, int x, int y, rct_map_element *mapElement)
|
|||
int z = mapElement->base_height * 8;
|
||||
|
||||
// Change pattern approximately every 51 seconds
|
||||
int pattern = (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) >> 11) & 7;
|
||||
int pattern = (gCurrentTicks >> 11) & 7;
|
||||
switch (pattern) {
|
||||
case PATTERN_CYCLIC_SQUARES:
|
||||
// 0, 1, 2, 3
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include "../addresses.h"
|
||||
#include "../game.h"
|
||||
#include "../ride/ride.h"
|
||||
#include "../ride/ride_data.h"
|
||||
#include "../ride/track.h"
|
||||
|
@ -194,7 +195,7 @@ static bool map_animation_invalidate_small_scenery(int x, int y, int baseZ)
|
|||
|
||||
if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_IS_CLOCK) {
|
||||
// Peep, looking at scenery
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 0x3FF) && RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) == 0) {
|
||||
if (!(gCurrentTicks & 0x3FF) && RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) == 0) {
|
||||
int direction = mapElement->type & 3;
|
||||
int x2 = x - TileDirectionDelta[direction].x;
|
||||
int y2 = y - TileDirectionDelta[direction].y;
|
||||
|
@ -458,7 +459,7 @@ static bool map_animation_invalidate_wall_door(int x, int y, int baseZ)
|
|||
rct_map_element *mapElement;
|
||||
rct_scenery_entry *sceneryEntry;
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 1)
|
||||
if (gCurrentTicks & 1)
|
||||
return false;
|
||||
|
||||
bool wasInvalidated = false;
|
||||
|
|
|
@ -76,15 +76,15 @@ void park_init()
|
|||
int i;
|
||||
|
||||
RCT2_GLOBAL(0x013CA740, uint8) = 0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, uint16) = 777;
|
||||
gParkName = 777;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_HANDYMAN_COLOUR, uint8) = COLOUR_BRIGHT_RED;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MECHANIC_COLOUR, uint8) = COLOUR_LIGHT_BLUE;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SECURITY_COLOUR, uint8) = COLOUR_YELLOW;
|
||||
gNumGuestsInPark = 0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAST_GUESTS_IN_PARK, uint16) = 0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_HEADING_FOR_PARK, uint16) = 0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_CHANGE_MODIFIER, uint16) = 0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16) = 0;
|
||||
gNumGuestsInParkLastWeek = 0;
|
||||
gNumGuestsHeadingForPark = 0;
|
||||
gGuestChangeModifier = 0;
|
||||
gParkRating = 0;
|
||||
_guestGenerationProbability = 0;
|
||||
RCT2_GLOBAL(RCT2_TOTAL_RIDE_VALUE, uint16) = 0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAST_RESEARCHED_ITEM_SUBJECT, sint32) = -1;
|
||||
|
@ -107,15 +107,15 @@ void park_init()
|
|||
RCT2_GLOBAL(RCT2_ADDRESS_ACTIVE_RESEARCH_TYPES, uint16) = 127;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_RESEARCH_LEVEL, uint8) = 2;
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, uint16) = MONEY(50,00); // Cash per guest (average)
|
||||
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;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_YEAR, uint8) = 4;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16) = 1000;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAND_COST, uint16) = MONEY(90, 00);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST, uint16) = MONEY(40,00);
|
||||
gGuestInitialCash = MONEY(50,00); // Cash per guest (average)
|
||||
gGuestInitialHappiness = calculate_guest_initial_happiness(50); // 50%
|
||||
gGuestInitialHunger = 200;
|
||||
gGuestInitialThirst = 200;
|
||||
gScenarioObjectiveType = OBJECTIVE_GUESTS_BY;
|
||||
gScenarioObjectiveYear = 4;
|
||||
gScenarioObjectiveNumGuests = 1000;
|
||||
gLandPrice = MONEY(90, 00);
|
||||
gConstructionRightsPrice = MONEY(40,00);
|
||||
RCT2_GLOBAL(0x01358774, uint16) = 0;
|
||||
gParkFlags = PARK_FLAGS_NO_MONEY | PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
|
||||
park_reset_history();
|
||||
|
@ -327,9 +327,9 @@ money32 calculate_park_value()
|
|||
money32 calculate_company_value()
|
||||
{
|
||||
return
|
||||
DECRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, sint32)) +
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_VALUE, money32) -
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32);
|
||||
DECRYPT_MONEY(gCashEncrypted) +
|
||||
gParkValue -
|
||||
gBankLoan;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -338,7 +338,7 @@ money32 calculate_company_value()
|
|||
*/
|
||||
void reset_park_entrances()
|
||||
{
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id) = 0;
|
||||
gParkName = 0;
|
||||
|
||||
for (short i = 0; i < 4; i++) {
|
||||
RCT2_ADDRESS(RCT2_ADDRESS_PARK_ENTRANCE_X, uint16)[i] = 0x8000;
|
||||
|
@ -413,10 +413,10 @@ static int park_calculate_guest_generation_probability()
|
|||
_suggestedGuestMaximum = suggestedMaxGuests;
|
||||
|
||||
// Begin with 50 + park rating
|
||||
probability = 50 + clamp(0, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16) - 200, 650);
|
||||
probability = 50 + clamp(0, gParkRating - 200, 650);
|
||||
|
||||
// The more guests, the lower the chance of a new one
|
||||
int numGuests = gNumGuestsInPark + RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_HEADING_FOR_PARK, uint16);
|
||||
int numGuests = gNumGuestsInPark + gNumGuestsHeadingForPark;
|
||||
if (numGuests > suggestedMaxGuests) {
|
||||
probability /= 4;
|
||||
|
||||
|
@ -539,10 +539,10 @@ void park_update()
|
|||
return;
|
||||
|
||||
// Every 5 seconds approximately
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) % 512 == 0) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16) = calculate_park_rating();
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_VALUE, money32) = calculate_park_value();
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_COMPANY_VALUE, money32) = calculate_company_value();
|
||||
if (gCurrentTicks % 512 == 0) {
|
||||
gParkRating = calculate_park_rating();
|
||||
gParkValue = calculate_park_value();
|
||||
gCompanyValue = calculate_company_value();
|
||||
window_invalidate_by_class(WC_FINANCES);
|
||||
_guestGenerationProbability = park_calculate_guest_generation_probability();
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |= BTM_TB_DIRTY_FLAG_PARK_RATING;
|
||||
|
@ -584,8 +584,8 @@ uint8 calculate_guest_initial_happiness(uint8 percentage) {
|
|||
void park_update_histories()
|
||||
{
|
||||
int guestsInPark = gNumGuestsInPark;
|
||||
int lastGuestsInPark = RCT2_GLOBAL(RCT2_ADDRESS_LAST_GUESTS_IN_PARK, uint16);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAST_GUESTS_IN_PARK, uint16) = guestsInPark;
|
||||
int lastGuestsInPark = gNumGuestsInParkLastWeek;
|
||||
gNumGuestsInParkLastWeek = guestsInPark;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |= 4;
|
||||
|
||||
int changeInGuestsInPark = guestsInPark - lastGuestsInPark;
|
||||
|
@ -595,7 +595,7 @@ void park_update_histories()
|
|||
if (changeInGuestsInPark < 20)
|
||||
guestChangeModifier = 0;
|
||||
}
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_CHANGE_MODIFIER, uint8) = guestChangeModifier;
|
||||
gGuestChangeModifier = guestChangeModifier;
|
||||
|
||||
// Update park rating history
|
||||
for (int i = 31; i > 0; i--)
|
||||
|
@ -612,7 +612,7 @@ void park_update_histories()
|
|||
// Update current cash history
|
||||
for (int i = 127; i > 0; i--)
|
||||
gCashHistory[i] = gCashHistory[i - 1];
|
||||
gCashHistory[0] = DECRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, money32)) - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32);
|
||||
gCashHistory[0] = DECRYPT_MONEY(gCashEncrypted) - gBankLoan;
|
||||
window_invalidate_by_class(WC_FINANCES);
|
||||
|
||||
// Update weekly profit history
|
||||
|
@ -631,7 +631,7 @@ void park_update_histories()
|
|||
// Update park value history
|
||||
for (int i = 127; i > 0; i--)
|
||||
gParkValueHistory[i] = gParkValueHistory[i - 1];
|
||||
gParkValueHistory[0] = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_VALUE, money32);
|
||||
gParkValueHistory[0] = gParkValue;
|
||||
}
|
||||
|
||||
void park_set_entrance_fee(money32 value)
|
||||
|
@ -899,7 +899,7 @@ void game_command_set_park_name(int *eax, int *ebx, int *ecx, int *edx, int *esi
|
|||
return;
|
||||
}
|
||||
|
||||
format_string(oldName, RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id), &RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME_ARGS, uint32));
|
||||
format_string(oldName, gParkName, &gParkNameArgs);
|
||||
if (strcmp(oldName, newName) == 0) {
|
||||
*ebx = 0;
|
||||
return;
|
||||
|
@ -920,8 +920,8 @@ void game_command_set_park_name(int *eax, int *ebx, int *ecx, int *edx, int *esi
|
|||
|
||||
if (*ebx & GAME_COMMAND_FLAG_APPLY) {
|
||||
// Free the old ride name
|
||||
user_string_free(RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id));
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id) = newUserStringId;
|
||||
user_string_free(gParkName);
|
||||
gParkName = newUserStringId;
|
||||
|
||||
gfx_invalidate_screen();
|
||||
} else {
|
||||
|
@ -954,7 +954,7 @@ money32 map_buy_land_rights_for_tile(int x, int y, int setting, int flags) {
|
|||
update_park_fences(x, y + 32);
|
||||
update_park_fences(x, y - 32);
|
||||
}
|
||||
return RCT2_GLOBAL(RCT2_ADDRESS_LAND_COST, uint16);
|
||||
return gLandPrice;
|
||||
case 1:
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY) {
|
||||
surfaceElement->properties.surface.ownership &= ~(OWNERSHIP_OWNED | OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED);
|
||||
|
@ -980,7 +980,7 @@ money32 map_buy_land_rights_for_tile(int x, int y, int setting, int flags) {
|
|||
uint16 baseHeight = surfaceElement->base_height * 8;
|
||||
map_invalidate_tile(x, y, baseHeight, baseHeight + 16);
|
||||
}
|
||||
return RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST, uint16);
|
||||
return gConstructionRightsPrice;
|
||||
case 3:
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY) {
|
||||
surfaceElement->properties.surface.ownership &= ~OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED;
|
||||
|
@ -1030,7 +1030,7 @@ money32 map_buy_land_rights_for_tile(int x, int y, int setting, int flags) {
|
|||
}
|
||||
|
||||
if (!(flags & GAME_COMMAND_FLAG_APPLY)) {
|
||||
return RCT2_GLOBAL(RCT2_ADDRESS_LAND_COST, uint16);
|
||||
return gLandPrice;
|
||||
}
|
||||
|
||||
if ((newOwnership & 0xF0) != 0) {
|
||||
|
@ -1111,7 +1111,7 @@ void game_command_buy_land_rights(int *eax, int *ebx, int *ecx, int *edx, int *e
|
|||
|
||||
void set_forced_park_rating(int rating){
|
||||
gForcedParkRating = rating;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16) = calculate_park_rating();
|
||||
gParkRating = calculate_park_rating();
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |= BTM_TB_DIRTY_FLAG_PARK_RATING;
|
||||
window_invalidate_by_class(WC_PARK_INFORMATION);
|
||||
}
|
||||
|
|
|
@ -48,10 +48,18 @@ enum {
|
|||
PARK_FLAGS_SIX_FLAGS_DEPRECATED = (1 << 19) // Not used anymore
|
||||
};
|
||||
|
||||
#define gParkName RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME, rct_string_id)
|
||||
#define gParkNameArgs RCT2_GLOBAL(RCT2_ADDRESS_PARK_NAME_ARGS, uint32)
|
||||
#define gParkFlags RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32)
|
||||
#define gParkSize RCT2_GLOBAL(RCT2_ADDRESS_PARK_SIZE, uint16)
|
||||
#define gParkRating RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16)
|
||||
#define gParkEntranceFee RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16)
|
||||
#define gNumGuestsInPark RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16)
|
||||
|
||||
#define gParkValue RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_VALUE, money32)
|
||||
#define gCompanyValue RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_COMPANY_VALUE, money32)
|
||||
|
||||
#define gLandPrice RCT2_GLOBAL(RCT2_ADDRESS_LAND_COST, money16)
|
||||
#define gConstructionRightsPrice RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST, money16)
|
||||
|
||||
extern uint8 *gParkRatingHistory;
|
||||
extern uint8 *gGuestsInParkHistory;
|
||||
|
|
Loading…
Reference in New Issue