mirror of https://github.com/OpenRCT2/OpenRCT2.git
implement peep update real names and update ride vehicle colours
This commit is contained in:
parent
2c3c8dc188
commit
0da767fcea
|
@ -44,6 +44,7 @@ static int peep_should_find_bench(rct_peep* peep);
|
||||||
static void peep_stop_purchase_thought(rct_peep* peep, uint8 ride_type);
|
static void peep_stop_purchase_thought(rct_peep* peep, uint8 ride_type);
|
||||||
static void sub_693BAB(rct_peep* peep);
|
static void sub_693BAB(rct_peep* peep);
|
||||||
static void peep_spend_money(rct_peep *peep, money32 amount);
|
static void peep_spend_money(rct_peep *peep, money32 amount);
|
||||||
|
static void peep_give_real_name(rct_peep *peep);
|
||||||
|
|
||||||
const char *gPeepEasterEggNames[] = {
|
const char *gPeepEasterEggNames[] = {
|
||||||
"MICHAEL SCHUMACHER",
|
"MICHAEL SCHUMACHER",
|
||||||
|
@ -4783,9 +4784,9 @@ rct_peep *peep_generate(int x, int y, int z)
|
||||||
peep->energy_growth_rate = energy;
|
peep->energy_growth_rate = energy;
|
||||||
|
|
||||||
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_SHOW_REAL_GUEST_NAMES){
|
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_SHOW_REAL_GUEST_NAMES){
|
||||||
RCT2_CALLPROC_X(0x0069C483, 0, 0, 0, 0, (int)peep, 0, 0);
|
peep_give_real_name(peep);
|
||||||
}
|
}
|
||||||
RCT2_CALLPROC_X(0x00699115, 0, 0, 0, 0, (int)peep, 0, 0);
|
peep_update_name_sort(peep);
|
||||||
|
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_HEADING_FOR_PARK, uint16)++;
|
RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_HEADING_FOR_PARK, uint16)++;
|
||||||
|
|
||||||
|
@ -5331,4 +5332,64 @@ static void peep_spend_money(rct_peep *peep, money32 amount)
|
||||||
finance_payment(-amount, RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint32));
|
finance_payment(-amount, RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint32));
|
||||||
|
|
||||||
sound_play_panned(SOUND_PURCHASE, 0x8001, peep->x, peep->y, peep->z);
|
sound_play_panned(SOUND_PURCHASE, 0x8001, peep->x, peep->y, peep->z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* rct2: 0x0069C483
|
||||||
|
*/
|
||||||
|
static void peep_give_real_name(rct_peep *peep)
|
||||||
|
{
|
||||||
|
RCT2_CALLPROC_X(0x0069C483, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* rct2: 0x00699115
|
||||||
|
*/
|
||||||
|
void peep_update_name_sort(rct_peep *peep)
|
||||||
|
{
|
||||||
|
RCT2_CALLPROC_X(0x00699115, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* rct2: 0x0069926C
|
||||||
|
*/
|
||||||
|
void peep_update_names(bool realNames)
|
||||||
|
{
|
||||||
|
rct_peep *peep;
|
||||||
|
uint16 spriteIndex;
|
||||||
|
bool restart;
|
||||||
|
|
||||||
|
if (realNames) {
|
||||||
|
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
|
||||||
|
do {
|
||||||
|
restart = false;
|
||||||
|
FOR_ALL_GUESTS(spriteIndex, peep) {
|
||||||
|
if (peep->name_string_idx == 767) {
|
||||||
|
peep_give_real_name(peep);
|
||||||
|
peep_update_name_sort(peep);
|
||||||
|
restart = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (restart);
|
||||||
|
gfx_invalidate_screen();
|
||||||
|
} else {
|
||||||
|
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) &= ~PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
|
||||||
|
do {
|
||||||
|
restart = false;
|
||||||
|
FOR_ALL_GUESTS(spriteIndex, peep) {
|
||||||
|
if (peep->name_string_idx < 0xA000)
|
||||||
|
continue;
|
||||||
|
if (peep->name_string_idx >= 0xE000)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
peep->name_string_idx = 767;
|
||||||
|
peep_update_name_sort(peep);
|
||||||
|
restart = true;
|
||||||
|
}
|
||||||
|
} while (restart);
|
||||||
|
gfx_invalidate_screen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -592,5 +592,7 @@ void remove_peep_from_ride(rct_peep* peep);
|
||||||
void remove_peep_from_queue(rct_peep* peep);
|
void remove_peep_from_queue(rct_peep* peep);
|
||||||
|
|
||||||
void sub_693BE5(rct_peep* peep, uint8 al);
|
void sub_693BE5(rct_peep* peep, uint8 al);
|
||||||
|
void peep_update_name_sort(rct_peep *peep);
|
||||||
|
void peep_update_names(bool realNames);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -241,8 +241,7 @@ void game_command_hire_new_staff_member(int* eax, int* ebx, int* ecx, int* edx,
|
||||||
newPeep->energy_growth_rate = 0x60;
|
newPeep->energy_growth_rate = 0x60;
|
||||||
newPeep->var_E2 = 0;
|
newPeep->var_E2 = 0;
|
||||||
|
|
||||||
RCT2_CALLPROC_X(0x00699115, (uint32)ebp & 0xFFFFFF3F, 0, 0, 0, (int)newPeep, 0,
|
peep_update_name_sort(newPeep);
|
||||||
(*ebp << 25) | (*ebp >> 6));
|
|
||||||
|
|
||||||
newPeep->staff_id = newStaffId;
|
newPeep->staff_id = newStaffId;
|
||||||
|
|
||||||
|
|
|
@ -140,6 +140,7 @@ static void ride_shop_connected(rct_ride* ride, int ride_idx);
|
||||||
static void ride_spiral_slide_update(rct_ride *ride);
|
static void ride_spiral_slide_update(rct_ride *ride);
|
||||||
static void ride_update(int rideIndex);
|
static void ride_update(int rideIndex);
|
||||||
static void sub_6B59C6(int rideIndex);
|
static void sub_6B59C6(int rideIndex);
|
||||||
|
static void ride_update_vehicle_colours(int rideIndex);
|
||||||
|
|
||||||
rct_ride_type *ride_get_entry(rct_ride *ride)
|
rct_ride_type *ride_get_entry(rct_ride *ride)
|
||||||
{
|
{
|
||||||
|
@ -4504,11 +4505,11 @@ void game_command_set_ride_appearance(int *eax, int *ebx, int *ecx, int *edx, in
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
*((uint8*)(&ride->vehicle_colours[index])) = value;
|
*((uint8*)(&ride->vehicle_colours[index])) = value;
|
||||||
RCT2_CALLPROC_X(0x006DE102, 0, 0, 0, ride_id, 0, 0, 0);
|
ride_update_vehicle_colours(ride_id);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
*((uint8*)(&ride->vehicle_colours[index]) + 1) = value;
|
*((uint8*)(&ride->vehicle_colours[index]) + 1) = value;
|
||||||
RCT2_CALLPROC_X(0x006DE102, 0, 0, 0, ride_id, 0, 0, 0);
|
ride_update_vehicle_colours(ride_id);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
ride->track_colour_supports[index] = value;
|
ride->track_colour_supports[index] = value;
|
||||||
|
@ -4521,7 +4522,7 @@ void game_command_set_ride_appearance(int *eax, int *ebx, int *ecx, int *edx, in
|
||||||
ride->vehicle_colours[i] = ride->vehicle_colours[0];
|
ride->vehicle_colours[i] = ride->vehicle_colours[0];
|
||||||
ride->vehicle_colours_extended[i] = ride->vehicle_colours_extended[0];
|
ride->vehicle_colours_extended[i] = ride->vehicle_colours_extended[0];
|
||||||
}
|
}
|
||||||
RCT2_CALLPROC_X(0x006DE102, 0, 0, 0, ride_id, 0, 0, 0);
|
ride_update_vehicle_colours(ride_id);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
ride->entrance_style = value;
|
ride->entrance_style = value;
|
||||||
|
@ -4530,7 +4531,7 @@ void game_command_set_ride_appearance(int *eax, int *ebx, int *ecx, int *edx, in
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
ride->vehicle_colours_extended[index] = value;
|
ride->vehicle_colours_extended[index] = value;
|
||||||
RCT2_CALLPROC_X(0x006DE102, 0, 0, 0, ride_id, 0, 0, 0);
|
ride_update_vehicle_colours(ride_id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
window_invalidate_by_number(WC_RIDE, ride_id);
|
window_invalidate_by_number(WC_RIDE, ride_id);
|
||||||
|
@ -5007,3 +5008,49 @@ void ride_fix_breakdown(int rideIndex, int reliabilityIncreaseFactor)
|
||||||
uint8 unreliability = 100 - ((ride->reliability >> 8) & 0xFF);
|
uint8 unreliability = 100 - ((ride->reliability >> 8) & 0xFF);
|
||||||
ride->reliability += reliabilityIncreaseFactor * (unreliability / 2);
|
ride->reliability += reliabilityIncreaseFactor * (unreliability / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* rct2: 0x006DE102
|
||||||
|
*/
|
||||||
|
static void ride_update_vehicle_colours(int rideIndex)
|
||||||
|
{
|
||||||
|
rct_ride *ride;
|
||||||
|
rct_vehicle *vehicle;
|
||||||
|
rct_vehicle_colour colours;
|
||||||
|
uint16 spriteIndex;
|
||||||
|
uint8 coloursExtended;
|
||||||
|
|
||||||
|
ride = GET_RIDE(rideIndex);
|
||||||
|
if (ride->type == RIDE_TYPE_SPACE_RINGS || ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_16)) {
|
||||||
|
gfx_invalidate_screen();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 32; i++) {
|
||||||
|
int carIndex = 0;
|
||||||
|
spriteIndex = ride->vehicles[i];
|
||||||
|
while (spriteIndex != SPRITE_INDEX_NULL) {
|
||||||
|
vehicle = &(g_sprite_list[spriteIndex].vehicle);
|
||||||
|
switch (ride->colour_scheme_type & 3) {
|
||||||
|
case RIDE_COLOUR_SCHEME_ALL_SAME:
|
||||||
|
colours = ride->vehicle_colours[0];
|
||||||
|
coloursExtended = ride->vehicle_colours_extended[0];
|
||||||
|
break;
|
||||||
|
case RIDE_COLOUR_SCHEME_DIFFERENT_PER_TRAIN:
|
||||||
|
colours = ride->vehicle_colours[i];
|
||||||
|
coloursExtended = ride->vehicle_colours_extended[i];
|
||||||
|
break;
|
||||||
|
case RIDE_COLOUR_SCHEME_DIFFERENT_PER_CAR:
|
||||||
|
colours = ride->vehicle_colours[carIndex];
|
||||||
|
coloursExtended = ride->vehicle_colours_extended[carIndex];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
vehicle->colours = colours;
|
||||||
|
vehicle->colours_extended = coloursExtended;
|
||||||
|
invalidate_sprite((rct_sprite*)vehicle);
|
||||||
|
spriteIndex = vehicle->next_vehicle_on_train;
|
||||||
|
carIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ typedef struct {
|
||||||
uint8 pad_2C[0x04];
|
uint8 pad_2C[0x04];
|
||||||
uint8 ride; // 0x30
|
uint8 ride; // 0x30
|
||||||
uint8 vehicle_type; // 0x31
|
uint8 vehicle_type; // 0x31
|
||||||
uint8 pad_32[0x02];
|
rct_vehicle_colour colours; // 0x32
|
||||||
uint16 var_34;
|
uint16 var_34;
|
||||||
sint16 var_36;
|
sint16 var_36;
|
||||||
//x related
|
//x related
|
||||||
|
@ -101,6 +101,7 @@ typedef struct {
|
||||||
uint8 pad_CF[0x06];
|
uint8 pad_CF[0x06];
|
||||||
uint8 var_D5;
|
uint8 var_D5;
|
||||||
uint8 ride_subtype; // 0xD6
|
uint8 ride_subtype; // 0xD6
|
||||||
|
uint8 colours_extended; // 0xD7
|
||||||
} rct_vehicle;
|
} rct_vehicle;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|
|
@ -555,8 +555,9 @@ static void window_options_mouseup()
|
||||||
window_invalidate(w);
|
window_invalidate(w);
|
||||||
break;
|
break;
|
||||||
case WIDX_REAL_NAME_CHECKBOX:
|
case WIDX_REAL_NAME_CHECKBOX:
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) ^= PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
|
peep_update_names(
|
||||||
RCT2_CALLPROC_X(0x0069C52F, RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_SHOW_REAL_GUEST_NAMES ? 0 : 1, 0, 0, 0, 0, 0, 0);
|
!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_SHOW_REAL_GUEST_NAMES)
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case WIDX_SAVE_PLUGIN_DATA_CHECKBOX:
|
case WIDX_SAVE_PLUGIN_DATA_CHECKBOX:
|
||||||
gConfigGeneral.save_plugin_data ^= 1;
|
gConfigGeneral.save_plugin_data ^= 1;
|
||||||
|
|
Loading…
Reference in New Issue