Merge pull request #723 from duncanspumpkin/peep_update

Peep update
This commit is contained in:
Ted John 2015-01-26 17:38:18 +00:00
commit 1aee1825d1
11 changed files with 933 additions and 77 deletions

View File

@ -412,13 +412,13 @@ static int award_is_deserved_most_disappointing(int awardType, int activeAwardTy
disappointingRides = 0;
FOR_ALL_RIDES(i, ride) {
if (ride->excitement == 0xFFFF || ride->var_158 == 0xFF)
if (ride->excitement == 0xFFFF || ride->popularity == 0xFF)
continue;
countedRides++;
// Satification maybe?
if (ride->var_158 <= 6)
// Unpopular
if (ride->popularity <= 6)
disappointingRides++;
}

File diff suppressed because it is too large Load Diff

View File

@ -202,7 +202,7 @@ enum PEEP_STATE {
PEEP_STATE_BUYING = 17,
PEEP_STATE_WATCHING = 18,
PEEP_STATE_EMPTYING_BIN = 19,
PEEP_STATE_20 = 20,
PEEP_STATE_USING_BIN = 20,
PEEP_STATE_WATERING = 21,
PEEP_STATE_HEADING_TO_INSPECTION = 22,
PEEP_STATE_INSPECTING = 23
@ -230,9 +230,14 @@ enum PEEP_ACTION_EVENTS {
PEEP_ACTION_STAFF_WATERING = 19,
PEEP_ACTION_WAVE = 22,
PEEP_ACTION_STAFF_EMPTY_BIN = 23,
PEEP_ACTION_WAVE_2 = 24,
PEEP_ACTION_TAKE_PHOTO = 25,
PEEP_ACTION_CLAP = 26,
PEEP_ACTION_DRAW_PICTURE = 28,
PEEP_ACTION_WITHDRAW_MONEY = 30,
PEEP_ACTION_NONE_1 = 254,
PEEP_ACTION_NONE_2 = 255
};
@ -258,6 +263,8 @@ enum PEEP_FLAGS {
PEEP_FLAGS_EATING = (1 << 17), // Reduces hunger
PEEP_FLAGS_EXPLODE = (1 << 18),
PEEP_FLAGS_21 = (1<<21),
PEEP_FLAGS_JOY = (1 << 23), // Makes the peep jump in joy
PEEP_FLAGS_ANGRY = (1 << 24),
PEEP_FLAGS_ICE_CREAM = (1 << 25) // Unconfirmed
@ -357,10 +364,11 @@ typedef struct {
uint16 name_string_idx; // 0x22
uint16 next_x; // 0x24
uint16 next_y; // 0x26
uint16 next_z; // 0x28 possibly split into two uint8s
uint8 next_z; // 0x28
uint8 next_var_29; // 0x29
uint8 var_2A;
uint8 state; // 0x2B
uint8 var_2C;
uint8 sub_state; // 0x2C
uint8 sprite_type; // 0x2D
uint8 type; // 0x2E
union{
@ -428,8 +436,8 @@ typedef struct {
money32 cash_spent; // 0xA4
sint32 time_in_park; // 0xA8
uint8 var_AC; // 0xAC
uint8 var_AD; // creation/hire time?
uint16 var_AE;
uint8 previous_ride; // 0xAD
uint16 previous_ride_time_out; // 0xAE
rct_peep_thought thoughts[PEEP_MAX_THOUGHTS]; // 0xB0
uint8 var_C4; // 0xC4
union // 0xC5
@ -446,9 +454,9 @@ typedef struct {
uint32 var_CC;
uint8 pad_D0[0x10];
uint8 var_E0; // 0xE0
uint8 pad_E1;
uint8 var_E1;
uint8 var_E2; // 0xE2
uint8 pad_E3;
uint8 var_E3;
union{
money16 paid_to_enter; // 0xE4
uint16 staff_lawns_mown; // 0xE4
@ -475,7 +483,8 @@ typedef struct {
uint8 voucher_arguments; // 0xF1 ride_id or string_offset_id
uint8 pad_F2;
uint8 var_F3;
uint8 pad_F4[0x02];
uint8 var_F4;
uint8 pad_F5;
uint8 balloon_colour; // 0xF6
uint8 umbrella_colour; // 0xF7
uint8 hat_colour; // 0xF8

View File

@ -204,7 +204,7 @@ void game_command_hire_new_staff_member(int* eax, int* ebx, int* ecx, int* edx,
sprite_move( newPeep->x, newPeep->y, newPeep->z, (rct_sprite*)newPeep);
invalidate_sprite((rct_sprite*)newPeep);
newPeep->var_AD = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint8);
newPeep->time_in_park = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16);
newPeep->var_CC = 0xFFFFFFFF;
uint8 colour = RCT2_ADDRESS(RCT2_ADDRESS_HANDYMAN_COLOUR, uint8)[staff_type > 2 ? 2 : staff_type];

View File

@ -664,7 +664,7 @@ static void ride_remove_peeps(int rideIndex)
continue;
peep_decrement_num_riders(peep);
if (peep->state == PEEP_STATE_QUEUING_FRONT && peep->var_2C == 0)
if (peep->state == PEEP_STATE_QUEUING_FRONT && peep->sub_state == 0)
RCT2_CALLPROC_X(0x006966A9, 0, 0, 0, 0, (int)peep, 0, 0);
invalidate_sprite((rct_sprite*)peep);
@ -672,8 +672,8 @@ static void ride_remove_peeps(int rideIndex)
if (exitDirection == 255) {
x = peep->next_x + 16;
y = peep->next_y + 16;
z = (peep->next_z & 0xFF) * 8;
if ((peep->next_z >> 8) & 4)
z = peep->next_z * 8;
if (peep->next_var_29 & 4)
z += 8;
z++;
sprite_move(exitX, exitY, exitZ, (rct_sprite*)peep);
@ -1119,6 +1119,23 @@ static void ride_chairlift_update(rct_ride *ride)
map_invalidate_tile(x, y, z, z + (4 * 8));
}
/* rct2: 0x0069A3D7
* Updates the ride popularity
* edi : ride
* bl : pop_amount
* pop_amount can be zero if peep visited but did not purchase.
*/
void ride_update_popularity(rct_ride* ride, uint8 pop_amount){
ride->popularity_next += pop_amount;
ride->popularity_time_out++;
if (ride->popularity_time_out < 25)return;
ride->popularity = ride->popularity_next;
ride->popularity_next = 0;
ride->popularity_time_out = 0;
ride->var_14D |= 1;
}
/**
*
* rct2: 0x006AC545
@ -1543,7 +1560,7 @@ static void ride_call_mechanic(int rideIndex, rct_peep *mechanic, int forInspect
peep_decrement_num_riders(mechanic);
mechanic->state = forInspection ? PEEP_STATE_HEADING_TO_INSPECTION : PEEP_STATE_ANSWERING;
peep_window_state_update(mechanic);
mechanic->var_2C = 0;
mechanic->sub_state = 0;
ride->mechanic_status = RIDE_MECHANIC_STATUS_HEADING;
ride->var_14D |= 0x20;
ride->mechanic = mechanic->sprite_index;
@ -1620,7 +1637,7 @@ rct_peep *find_closest_mechanic(int x, int y, int forInspection)
continue;
if (forInspection) {
if ((peep->state != PEEP_STATE_HEADING_TO_INSPECTION || peep->var_2C >= 4) && peep->state != PEEP_STATE_PATROLLING)
if ((peep->state != PEEP_STATE_HEADING_TO_INSPECTION || peep->sub_state >= 4) && peep->state != PEEP_STATE_PATROLLING)
continue;
if (!(peep->staff_orders & 2))

View File

@ -173,14 +173,16 @@ typedef struct {
};
uint16 reliability; // 0x146
uint16 var_148;
uint16 var_14A;
uint8 pad_14C;
uint8 satisfaction; // 0x14A
uint8 satisfaction_time_out; // 0x14B
uint8 satisfaction_next; // 0x14C
uint8 var_14D;
uint8 pad_14E[0x02];
uint32 total_customers; // 0x150
money32 total_profit; // 0x154
uint16 var_158;
uint8 pad_15A;
uint8 popularity; // 0x158
uint8 popularity_time_out; // 0x159 Updated every purchase and ?possibly by time?
uint8 popularity_next; // 0x15A When timeout reached this will be the next popularity
uint8 num_riders; // 0x15B
uint8 music_tune_id; // 0x15C
uint8 var_15D;
@ -218,8 +220,8 @@ typedef struct {
uint8 var_1A1;
uint8 var_1A2;
uint8 var_1A3;
uint32 no_primary_items_sold;
uint32 no_secondary_items_sold;
uint32 no_primary_items_sold; // 0x1A4
uint32 no_secondary_items_sold; // 0x1A8
uint8 var_1AC;
uint8 var_1AD;
uint8 var_1AE;
@ -610,6 +612,7 @@ void reset_all_ride_build_dates();
void ride_update_favourited_stat();
void ride_update_all();
void ride_check_all_reachable();
void ride_update_popularity(rct_ride* ride, uint8 pop_amount);
rct_map_element *sub_6CAF80(int rideIndex, int *outX, int *outY);
rct_map_element *ride_find_track_gap(rct_map_element *startTrackElement, int *outX, int *outY);
void ride_construct_new(ride_list_item listItem);

View File

@ -627,7 +627,7 @@ void window_guest_overview_mouse_up(){
sprite_move(0x8000, peep->y, peep->z, (rct_sprite*)peep);
peep_decrement_num_riders(peep);
peep->state = PEEP_STATE_PICKED;
peep->var_2C = 0;
peep->sub_state = 0;
peep_window_state_update(peep);
break;
case WIDX_RENAME:

View File

@ -5725,7 +5725,7 @@ static void window_ride_customer_paint()
y += 10;
// Popularity
popularity = ride->var_158 & 0xFF;
popularity = ride->popularity;
if (popularity == 255) {
stringId = STR_POPULARITY_UNKNOWN;
} else {
@ -5736,7 +5736,7 @@ static void window_ride_customer_paint()
y += 10;
// Satisfaction
satisfaction = ride->var_14A & 0xFF;
satisfaction = ride->satisfaction;
if (satisfaction == 255) {
stringId = STR_SATISFACTION_UNKNOWN;
} else {

View File

@ -471,16 +471,16 @@ static void window_ride_list_scrollpaint()
break;
case INFORMATION_TYPE_POPULARITY:
formatSecondary = STR_POPULARITY_UNKNOWN_LABEL;
if ((ride->var_158 & 0xFF) != 255) {
if (ride->popularity != 255) {
formatSecondary = STR_POPULARITY_LABEL;
RCT2_GLOBAL(0x013CE952 + 2, uint16) = (ride->var_158 & 0xFF) * 4;
RCT2_GLOBAL(0x013CE952 + 2, uint16) = ride->popularity * 4;
}
break;
case INFORMATION_TYPE_SATISFACTION:
formatSecondary = STR_SATISFACTION_UNKNOWN_LABEL;
if ((ride->var_14A & 0xFF) != 255) {
if (ride->satisfaction != 255) {
formatSecondary = STR_SATISFACTION_LABEL;
RCT2_GLOBAL(0x013CE952 + 2, uint16) = (ride->var_14A & 0xFF) * 5;
RCT2_GLOBAL(0x013CE952 + 2, uint16) = ride->satisfaction * 5;
}
break;
case INFORMATION_TYPE_PROFIT:
@ -616,7 +616,7 @@ static void window_ride_list_refresh_list(rct_window *w)
case INFORMATION_TYPE_POPULARITY:
while (--current_list_position >= 0) {
otherRide = &g_ride_list[w->list_item_positions[current_list_position]];
if ((ride->var_158 & 0xFF) * 4 <= (otherRide->var_158 & 0xFF) * 4)
if (ride->popularity * 4 <= otherRide->popularity * 4)
break;
window_bubble_list_item(w, current_list_position);
@ -625,7 +625,7 @@ static void window_ride_list_refresh_list(rct_window *w)
case INFORMATION_TYPE_SATISFACTION:
while (--current_list_position >= 0) {
otherRide = &g_ride_list[w->list_item_positions[current_list_position]];
if ((ride->var_14A & 0xFF) * 5 <= (otherRide->var_14A & 0xFF) * 5)
if (ride->satisfaction * 5 <= otherRide->satisfaction * 5)
break;
window_bubble_list_item(w, current_list_position);

View File

@ -193,6 +193,8 @@ enum {
#define MAP_ELEMENT_SLOPE_MASK 0x1F
#define MAP_ELEMENT_SLOPE_EDGE_STYLE_MASK 0xE0
// Terrain
#define MAP_ELEMENT_WATER_HEIGHT_MASK 0x1F
#define MAP_ELEMENT_SURFACE_TERRAIN_MASK 0xE0

View File

@ -88,7 +88,8 @@ typedef enum {
} WALL_SCENERY_FLAGS;
typedef struct {
uint8 pad_02[3];
uint16 var_06;
uint8 pad_08;
uint8 tool_id; // 0x09
uint16 price; // 0x0A
uint8 scenery_tab_id; // 0x0C