add global macro: gGuestInitialHappiness

This commit is contained in:
Ted John 2016-04-23 02:36:24 +01:00
parent 8509927dc7
commit 727a568e32
6 changed files with 14 additions and 13 deletions

View File

@ -483,13 +483,13 @@ static int cc_get(const utf8 **argv, int argc)
console_printf("guest_initial_cash %d.%d0", gGuestInitialCash / 10, gGuestInitialCash % 10); console_printf("guest_initial_cash %d.%d0", gGuestInitialCash / 10, gGuestInitialCash % 10);
} }
else if (strcmp(argv[0], "guest_initial_happiness") == 0) { 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++) { for (int i = 15; i <= 99; i++) {
if (i == 99) { 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)) { 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; break;
} }
} }
@ -618,7 +618,7 @@ static int cc_set(const utf8 **argv, int argc)
console_execute_silent("get guest_initial_cash"); console_execute_silent("get guest_initial_cash");
} }
else if (strcmp(argv[0], "guest_initial_happiness") == 0 && invalidArguments(&invalidArgs, int_valid[0])) { 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"); console_execute_silent("get guest_initial_happiness");
} }
else if (strcmp(argv[0], "guest_initial_hunger") == 0 && invalidArguments(&invalidArgs, int_valid[0])) { else if (strcmp(argv[0], "guest_initial_hunger") == 0 && invalidArguments(&invalidArgs, int_valid[0])) {

View File

@ -6116,9 +6116,9 @@ rct_peep *peep_generate(int x, int y, int z)
peep->nausea_tolerance = RCT2_ADDRESS(0x009823A0, uint8)[nausea_tolerance]; 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; happiness += 0x80;
peep->happiness = happiness; peep->happiness = happiness;

View File

@ -600,6 +600,7 @@ enum {
if (peep->type == PEEP_TYPE_STAFF) if (peep->type == PEEP_TYPE_STAFF)
#define gGuestInitialCash RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16) #define gGuestInitialCash RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_CASH, money16)
#define gGuestInitialHappiness RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HAPPINESS, uint8)
int peep_get_staff_count(); int peep_get_staff_count();
int peep_can_be_picked_up(rct_peep* peep); int peep_can_be_picked_up(rct_peep* peep);

View File

@ -1343,7 +1343,7 @@ static void scenario_objective_check_guests_and_rating()
news_item_add_to_queue(NEWS_ITEM_GRAPH, STR_PARK_HAS_BEEN_CLOSED_DOWN, 0); news_item_add_to_queue(NEWS_ITEM_GRAPH, STR_PARK_HAS_BEEN_CLOSED_DOWN, 0);
gParkFlags &= ~PARK_FLAGS_PARK_OPEN; gParkFlags &= ~PARK_FLAGS_PARK_OPEN;
scenario_failure(); scenario_failure();
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HAPPINESS, uint8) = 50; gGuestInitialHappiness = 50;
} }
} else if (RCT2_GLOBAL(RCT2_ADDRESS_COMPLETED_COMPANY_VALUE, money32) != 0x80000001) { } else if (RCT2_GLOBAL(RCT2_ADDRESS_COMPLETED_COMPANY_VALUE, money32) != 0x80000001) {
RCT2_GLOBAL(RCT2_ADDRESS_PARK_RATING_WARNING_DAYS, uint16) = 0; RCT2_GLOBAL(RCT2_ADDRESS_PARK_RATING_WARNING_DAYS, uint16) = 0;

View File

@ -753,16 +753,16 @@ static void window_editor_scenario_options_guests_mousedown(int widgetIndex, rct
window_invalidate(w); window_invalidate(w);
break; break;
case WIDX_GUEST_INITIAL_HAPPINESS_INCREASE: case WIDX_GUEST_INITIAL_HAPPINESS_INCREASE:
if (RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HAPPINESS, uint8) < 250) { if (gGuestInitialHappiness < 250) {
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HAPPINESS, uint8) += 4; gGuestInitialHappiness += 4;
} else { } else {
window_error_open(3264, STR_NONE); window_error_open(3264, STR_NONE);
} }
window_invalidate(w); window_invalidate(w);
break; break;
case WIDX_GUEST_INITIAL_HAPPINESS_DECREASE: case WIDX_GUEST_INITIAL_HAPPINESS_DECREASE:
if (RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HAPPINESS, uint8) > 40) { if (gGuestInitialHappiness > 40) {
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HAPPINESS, uint8) -= 4; gGuestInitialHappiness -= 4;
} else { } else {
window_error_open(3265, STR_NONE); window_error_open(3265, STR_NONE);
} }
@ -893,7 +893,7 @@ static void window_editor_scenario_options_guests_paint(rct_window *w, rct_drawp
// Guest initial happiness value // Guest initial happiness value
x = w->x + w->widgets[WIDX_GUEST_INITIAL_HAPPINESS].left + 1; x = w->x + w->widgets[WIDX_GUEST_INITIAL_HAPPINESS].left + 1;
y = w->y + w->widgets[WIDX_GUEST_INITIAL_HAPPINESS].top; 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); gfx_draw_string_left(dpi, 3247, &arg, 0, x, y);
// Guest initial hunger label // Guest initial hunger label

View File

@ -108,7 +108,7 @@ void park_init()
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_RESEARCH_LEVEL, uint8) = 2; RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_RESEARCH_LEVEL, uint8) = 2;
gGuestInitialCash = MONEY(50,00); // Cash per guest (average) gGuestInitialCash = MONEY(50,00); // Cash per guest (average)
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HAPPINESS, uint8) = calculate_guest_initial_happiness(50); // 50% gGuestInitialHappiness = calculate_guest_initial_happiness(50); // 50%
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HUNGER, uint8) = 200; RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_HUNGER, uint8) = 200;
RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_THIRST, uint8) = 200; RCT2_GLOBAL(RCT2_ADDRESS_GUEST_INITIAL_THIRST, uint8) = 200;
gScenarioObjectiveType = OBJECTIVE_GUESTS_BY; gScenarioObjectiveType = OBJECTIVE_GUESTS_BY;