Merge pull request #43 from Gymnasiast/rct1/import-peeps

Name more peep flags, import peeps on ride, import staff, import more peep fields
This commit is contained in:
Ted John 2016-12-21 21:46:51 +00:00 committed by GitHub
commit 2f4a81b165
9 changed files with 298 additions and 117 deletions

View File

@ -396,9 +396,9 @@ list(APPEND DOC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/contributors.md" "${CMAKE_CUR
# CMake does not allow specifying a dependency chain which includes built-in
# targets, like `install`, so we have to trick it and execute dependency ourselves.
install(CODE "execute_process(COMMAND \"${CMAKE_COMMAND}\" --build \"${CMAKE_CURRENT_BINARY_DIR}\" --target g2)")
install(CODE "file(DOWNLOAD https://github.com/OpenRCT2/title-sequences/releases/download/v0.0.5/title-sequence-v0.0.5.zip ${CMAKE_INSTALL_PREFIX}/share/${PROJECT}/title/title-sequences.zip EXPECTED_HASH_SHA1=79ffb2585d12abcbfce205d7696e3472a504b005 SHOW_PROGRESS)")
install(CODE "execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir ${CMAKE_INSTALL_PREFIX}/share/${PROJECT}/title/ \"${CMAKE_COMMAND}\" -E tar xvf title-sequences.zip)")
install(CODE "file(REMOVE ${CMAKE_INSTALL_PREFIX}/share/${PROJECT}/title/title-sequences.zip)")
install(CODE "file(DOWNLOAD https://github.com/OpenRCT2/title-sequences/releases/download/v0.0.5/title-sequence-v0.0.5.zip \$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/share/${PROJECT}/title/title-sequences.zip EXPECTED_HASH_SHA1=79ffb2585d12abcbfce205d7696e3472a504b005 SHOW_PROGRESS)")
install(CODE "execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir \$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/share/${PROJECT}/title/ \"${CMAKE_COMMAND}\" -E tar xvf title-sequences.zip)")
install(CODE "file(REMOVE \$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/share/${PROJECT}/title/title-sequences.zip)")
install(TARGETS ${PROJECT} RUNTIME DESTINATION bin)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/g2.dat" DESTINATION share/${PROJECT})
install(DIRECTORY data/ DESTINATION share/${PROJECT})

View File

@ -947,7 +947,7 @@ static void sub_68F41A(rct_peep *peep, int index)
if (peep->staff_type != STAFF_TYPE_SECURITY)
return;
uint8 sprite_type = PEEP_SPRITE_TYPE_23;
uint8 sprite_type = PEEP_SPRITE_TYPE_SECURITY_ALT;
if (peep->state != PEEP_STATE_PATROLLING)
sprite_type = PEEP_SPRITE_TYPE_SECURITY;
@ -1771,7 +1771,7 @@ item_pref item_order_preference[] = {
void peep_update_sprite_type(rct_peep* peep)
{
if (
peep->sprite_type == PEEP_SPRITE_TYPE_19 &&
peep->sprite_type == PEEP_SPRITE_TYPE_BALLOON &&
(scenario_rand() & 0xFFFF) <= 327
) {
uint8 bl = 0;
@ -1846,12 +1846,12 @@ void peep_update_sprite_type(rct_peep* peep)
}
if (peep->energy <= 64 && peep->happiness < 128) {
set_sprite_type(peep, PEEP_SPRITE_TYPE_26);
set_sprite_type(peep, PEEP_SPRITE_TYPE_HEAD_DOWN);
return;
}
if (peep->energy <= 80 && peep->happiness < 128) {
set_sprite_type(peep, PEEP_SPRITE_TYPE_25);
set_sprite_type(peep, PEEP_SPRITE_TYPE_ARMS_CROSSED);
return;
}
@ -2159,7 +2159,7 @@ static void peep_update_falling(rct_peep* peep){
if (peep->item_standard_flags & PEEP_ITEM_BALLOON) {
peep->item_standard_flags &= ~PEEP_ITEM_BALLOON;
if (peep->sprite_type == PEEP_SPRITE_TYPE_19 && peep->x != (sint16) 0x8000) {
if (peep->sprite_type == PEEP_SPRITE_TYPE_BALLOON && peep->x != (sint16) 0x8000) {
create_balloon(peep->x, peep->y, height, peep->balloon_colour, 0);
peep->window_invalidate_flags |= PEEP_INVALIDATE_PEEP_INVENTORY;
peep_update_sprite_type(peep);
@ -2330,7 +2330,7 @@ static void peep_update_sitting(rct_peep* peep){
peep_try_get_up_from_sitting(peep);
return;
}
if (peep->sprite_type == PEEP_SPRITE_TYPE_19 || peep->sprite_type == PEEP_SPRITE_TYPE_30) {
if (peep->sprite_type == PEEP_SPRITE_TYPE_BALLOON || peep->sprite_type == PEEP_SPRITE_TYPE_HAT) {
peep_try_get_up_from_sitting(peep);
return;
}
@ -4036,7 +4036,7 @@ static void peep_update_ride_sub_state_18(rct_peep* peep){
}
}
peep->var_79 = 0xFF;
peep->interactionRideIndex = 0xFF;
peep_decrement_num_riders(peep);
peep->state = PEEP_STATE_FALLING;
peep_window_state_update(peep);
@ -6154,6 +6154,11 @@ static int peep_update_patrolling_find_watering(rct_peep* peep){
rct_map_element* map_element = map_get_first_element_at(x / 32, y / 32);
// This seems to happen in some SV4 files.
if (map_element == NULL) {
continue;
}
do {
if (map_element_get_type(map_element) != MAP_ELEMENT_TYPE_SCENERY){
continue;
@ -7181,7 +7186,7 @@ rct_peep *peep_generate(int x, int y, int z)
peep->var_41 = (scenario_rand() & 0x1F) + 45;
peep->var_C4 = 0;
peep->var_79 = 0xFF;
peep->interactionRideIndex = 0xFF;
peep->type = PEEP_TYPE_GUEST;
peep->previous_ride = 0xFF;
peep->thoughts->type = PEEP_THOUGHT_TYPE_NONE;
@ -7994,13 +7999,13 @@ static int peep_interact_with_entrance(rct_peep* peep, sint16 x, sint16 y, rct_m
}
if (entranceType == ENTRANCE_TYPE_RIDE_EXIT){
peep->var_79 = 0xFF;
peep->interactionRideIndex = 0xFF;
return peep_return_to_center_of_tile(peep);
}
if (entranceType == ENTRANCE_TYPE_RIDE_ENTRANCE){
if (peep->type == PEEP_TYPE_STAFF){
peep->var_79 = 0xFF;
peep->interactionRideIndex = 0xFF;
return peep_return_to_center_of_tile(peep);
}
@ -8010,18 +8015,18 @@ static int peep_interact_with_entrance(rct_peep* peep, sint16 x, sint16 y, rct_m
return 1;
}
if (peep->var_79 == rideIndex)
if (peep->interactionRideIndex == rideIndex)
return peep_return_to_center_of_tile(peep);
peep->var_F4 = 0;
uint8 stationNum = (map_element->properties.entrance.index >> 4) & 0x7;
if (!peep_should_go_on_ride(peep, rideIndex, stationNum, 0)){
peep->var_79 = rideIndex;
peep->interactionRideIndex = rideIndex;
return peep_return_to_center_of_tile(peep);
}
peep->action_sprite_image_offset = _unk_F1AEF0;
peep->var_79 = rideIndex;
peep->interactionRideIndex = rideIndex;
rct_ride* ride = get_ride(rideIndex);
uint16 previous_last = ride->last_peep_in_queue[stationNum];
@ -8373,7 +8378,7 @@ static int peep_interact_with_path(rct_peep* peep, sint16 x, sint16 y, rct_map_e
uint8 rideIndex = map_element->properties.path.ride_index;
if (rideIndex == 0xFF){
peep->var_79 = 0xFF;
peep->interactionRideIndex = 0xFF;
return peep_footpath_move_forward(peep, x, y, map_element, vandalism_present);
}
@ -8388,18 +8393,18 @@ static int peep_interact_with_path(rct_peep* peep, sint16 x, sint16 y, rct_map_e
return peep_footpath_move_forward(peep, x, y, map_element, vandalism_present);
}
if (peep->var_79 == rideIndex){
if (peep->interactionRideIndex == rideIndex){
return peep_footpath_move_forward(peep, x, y, map_element, vandalism_present);
}
peep->var_F4 = 0;
uint8 stationNum = (map_element->properties.path.additions & 0x70) >> 4;
if (!peep_should_go_on_ride(peep, rideIndex, stationNum, PEEP_RIDE_DECISION_AT_QUEUE)){
peep->var_79 = rideIndex;
peep->interactionRideIndex = rideIndex;
return peep_return_to_center_of_tile(peep);
}
peep->var_79 = rideIndex;
peep->interactionRideIndex = rideIndex;
rct_ride* ride = get_ride(rideIndex);
uint16 old_last_peep = ride->last_peep_in_queue[stationNum];
@ -8430,7 +8435,7 @@ static int peep_interact_with_path(rct_peep* peep, sint16 x, sint16 y, rct_map_e
return peep_footpath_move_forward(peep, x, y, map_element, vandalism_present);
}
else{
peep->var_79 = 0xFF;
peep->interactionRideIndex = 0xFF;
if (peep->state == PEEP_STATE_QUEUING){
remove_peep_from_queue(peep);
peep_decrement_num_riders(peep);
@ -8460,7 +8465,7 @@ static int peep_interact_with_shop(rct_peep* peep, sint16 x, sint16 y, rct_map_e
if (ride->status != RIDE_STATUS_OPEN)
return peep_return_to_center_of_tile(peep);
if (peep->var_79 == rideIndex)
if (peep->interactionRideIndex == rideIndex)
return peep_return_to_center_of_tile(peep);
if (peep->peep_flags & PEEP_FLAGS_LEAVING_PARK)
@ -10291,7 +10296,7 @@ static int sub_693C9E(rct_peep *peep)
sint16 z = abs(map_element_height(x, y) - peep->z);
if (z <= 3 || (peep->type == PEEP_TYPE_STAFF && z <= 32)){
peep->var_79 = 0xFF;
peep->interactionRideIndex = 0xFF;
if (peep->state == PEEP_STATE_QUEUING){
remove_peep_from_queue(peep);
peep_decrement_num_riders(peep);
@ -12523,3 +12528,72 @@ void game_command_set_guest_name(int *eax, int *ebx, int *ecx, int *edx, int *es
(uint8*)edi
);
}
void peep_autoposition(rct_peep *newPeep)
{
// Find a location to place new staff member
newPeep->state = PEEP_STATE_FALLING;
sint16 x, y, z;
uint32 count = 0;
uint16 sprite_index;
rct_peep *guest = NULL;
// Count number of walking guests
FOR_ALL_GUESTS(sprite_index, guest) {
if (guest->state == PEEP_STATE_WALKING)
++count;
}
if (count > 0) {
// Place staff at a random guest
uint32 rand = scenario_rand_max(count);
FOR_ALL_GUESTS(sprite_index, guest) {
if (guest->state == PEEP_STATE_WALKING) {
if (rand == 0)
break;
--rand;
}
}
x = guest->x;
y = guest->y;
z = guest->z;
} else {
// No walking guests; pick random park entrance
count = 0;
uint8 i;
for (i = 0; i < 4; ++i) {
if (gParkEntranceX[i] != SPRITE_LOCATION_NULL)
++count;
}
if (count > 0) {
uint32 rand = scenario_rand_max(count);
for (i = 0; i < 4; ++i) {
if (gParkEntranceX[i] != SPRITE_LOCATION_NULL) {
if (rand == 0)
break;
--rand;
}
}
uint8 dir = gParkEntranceDirection[i];
x = gParkEntranceX[i];
y = gParkEntranceY[i];
z = gParkEntranceZ[i];
x += 16 + ((dir & 1) == 0 ? ((dir & 2) ? 32 : -32) : 0);
y += 16 + ((dir & 1) == 1 ? ((dir & 2) ? -32 : 32) : 0);
} else {
// No more options; user must pick a location
newPeep->state = PEEP_STATE_PICKED;
x = newPeep->x;
y = newPeep->y;
z = newPeep->z;
}
}
sprite_move(x, y, z + 16, (rct_sprite *)newPeep);
invalidate_sprite_2((rct_sprite *)newPeep);
}

View File

@ -363,15 +363,21 @@ enum PEEP_SPRITE_TYPE {
PEEP_SPRITE_TYPE_ENTERTAINER_BANDIT = 12,
PEEP_SPRITE_TYPE_ENTERTAINER_SHERIFF = 13,
PEEP_SPRITE_TYPE_ENTERTAINER_PIRATE = 14,
PEEP_SPRITE_TYPE_19 = 19,
PEEP_SPRITE_TYPE_BALLOON = 19,
PEEP_SPRITE_TYPE_CANDYFLOSS = 20,
PEEP_SPRITE_TYPE_UMBRELLA = 21,
PEEP_SPRITE_TYPE_23 = 23,
PEEP_SPRITE_TYPE_25 = 25,
PEEP_SPRITE_TYPE_26 = 26,
PEEP_SPRITE_TYPE_PIZZA = 22,
PEEP_SPRITE_TYPE_SECURITY_ALT = 23,
PEEP_SPRITE_TYPE_POPCORN = 24,
PEEP_SPRITE_TYPE_ARMS_CROSSED = 25,
PEEP_SPRITE_TYPE_HEAD_DOWN = 26,
PEEP_SPRITE_TYPE_NAUSEOUS = 27,
PEEP_SPRITE_TYPE_VERY_NAUSEOUS = 28,
PEEP_SPRITE_TYPE_REQUIRE_BATHROOM = 29,
PEEP_SPRITE_TYPE_30 = 30,
PEEP_SPRITE_TYPE_HAT = 30,
PEEP_SPRITE_TYPE_BURGER = 31,
PEEP_SPRITE_TYPE_TENTACLE = 32,
PEEP_SPRITE_TYPE_TOFFEE_APPLE = 33,
PEEP_SPRITE_TYPE_WATCHING = 38
};
@ -497,7 +503,7 @@ typedef struct rct_peep {
uint8 maze_last_edge; // 0x78
uint8 direction; //Direction ?
};
uint8 var_79;
uint8 interactionRideIndex;
uint16 time_in_queue; // 0x7A
uint8 rides_been_on[32]; // 0x7C
// 255 bit bitmap of every ride the peep has been on see
@ -685,5 +691,6 @@ money32 set_peep_name(int flags, int state, uint16 sprite_index, uint8* text_1,
void game_command_set_guest_name(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp);
int peep_pathfind_choose_direction(sint16 x, sint16 y, uint8 z, rct_peep *peep);
void peep_autoposition(rct_peep *newPeep);
#endif

View File

@ -84,75 +84,6 @@ void game_command_update_staff_colour(int *eax, int *ebx, int *ecx, int *edx, in
*ebx = 0;
}
static inline void staff_autoposition_new_staff_member(rct_peep *newPeep)
{
// Find a location to place new staff member
newPeep->state = PEEP_STATE_FALLING;
sint16 x, y, z;
uint32 count = 0;
uint16 sprite_index;
rct_peep *guest = NULL;
// Count number of walking guests
FOR_ALL_GUESTS(sprite_index, guest) {
if (guest->state == PEEP_STATE_WALKING)
++count;
}
if (count > 0) {
// Place staff at a random guest
uint32 rand = scenario_rand_max(count);
FOR_ALL_GUESTS(sprite_index, guest) {
if (guest->state == PEEP_STATE_WALKING) {
if (rand == 0)
break;
--rand;
}
}
x = guest->x;
y = guest->y;
z = guest->z;
} else {
// No walking guests; pick random park entrance
count = 0;
uint8 i;
for (i = 0; i < 4; ++i) {
if (gParkEntranceX[i] != SPRITE_LOCATION_NULL)
++count;
}
if (count > 0) {
uint32 rand = scenario_rand_max(count);
for (i = 0; i < 4; ++i) {
if (gParkEntranceX[i] != SPRITE_LOCATION_NULL) {
if (rand == 0)
break;
--rand;
}
}
uint8 dir = gParkEntranceDirection[i];
x = gParkEntranceX[i];
y = gParkEntranceY[i];
z = gParkEntranceZ[i];
x += 16 + ((dir & 1) == 0 ? ((dir & 2) ? 32 : -32) : 0);
y += 16 + ((dir & 1) == 1 ? ((dir & 2) ? -32 : 32) : 0);
} else {
// No more options; user must pick a location
newPeep->state = PEEP_STATE_PICKED;
x = newPeep->x;
y = newPeep->y;
z = newPeep->z;
}
}
sprite_move(x, y, z + 16, (rct_sprite *)newPeep);
invalidate_sprite_2((rct_sprite *)newPeep);
}
static money32 staff_hire_new_staff_member(uint8 staff_type, uint8 flags, sint16 command_x, sint16 command_y, sint16 command_z, int *newPeep_sprite_index)
{
gCommandExpenditureType = RCT_EXPENDITURE_TYPE_WAGES;
@ -276,7 +207,7 @@ static money32 staff_hire_new_staff_member(uint8 staff_type, uint8 flags, sint16
// gConfigGeneral.auto_staff_placement is client specific so we need to force this
if (network_get_mode() == NETWORK_MODE_NONE && gConfigGeneral.auto_staff_placement != ((SDL_GetModState() & KMOD_SHIFT) != 0)) {
staff_autoposition_new_staff_member(newPeep);
peep_autoposition(newPeep);
} else {
newPeep->state = PEEP_STATE_PICKED;
@ -366,7 +297,7 @@ static const bool peep_slow_walking_types[] = {
false, // PEEP_SPRITE_TYPE_ENTERTAINER_BANDIT
false, // PEEP_SPRITE_TYPE_ENTERTAINER_SHERIFF
true, // PEEP_SPRITE_TYPE_ENTERTAINER_PIRATE
true, // PEEP_SPRITE_TYPE_19
true, // PEEP_SPRITE_TYPE_BALLOON
};
/**

View File

@ -295,7 +295,7 @@ typedef struct rct1_peep {
uint8 maze_last_edge; // 0x78
uint8 direction; //Direction ?
};
uint8 var_79;
uint8 interactionRideIndex;
uint16 time_in_queue; // 0x7A
uint8 rides_been_on[32]; // 0x7C
// 255 bit bitmap of every ride the peep has been on see
@ -354,10 +354,43 @@ typedef struct rct1_peep {
} rct1_peep;
assert_struct_size(rct1_peep, 0x100);
enum RCT1_PEEP_SPRITE_TYPE {
RCT1_PEEP_SPRITE_TYPE_NORMAL = 0,
RCT1_PEEP_SPRITE_TYPE_HANDYMAN = 1,
RCT1_PEEP_SPRITE_TYPE_MECHANIC = 2,
RCT1_PEEP_SPRITE_TYPE_SECURITY = 3,
RCT1_PEEP_SPRITE_TYPE_ENTERTAINER_PANDA = 4,
RCT1_PEEP_SPRITE_TYPE_ENTERTAINER_TIGER = 5,
RCT1_PEEP_SPRITE_TYPE_ENTERTAINER_ELEPHANT = 6,
RCT1_PEEP_SPRITE_TYPE_ENTERTAINER_ROMAN = 7,
RCT1_PEEP_SPRITE_TYPE_ENTERTAINER_GORILLA = 8,
RCT1_PEEP_SPRITE_TYPE_ENTERTAINER_SNOWMAN = 9,
RCT1_PEEP_SPRITE_TYPE_ENTERTAINER_KNIGHT = 10,
RCT1_PEEP_SPRITE_TYPE_ENTERTAINER_ASTRONAUT = 11,
RCT1_PEEP_SPRITE_TYPE_BALLOON = 16,
RCT1_PEEP_SPRITE_TYPE_CANDYFLOSS = 17,
RCT1_PEEP_SPRITE_TYPE_UMBRELLA = 18,
RCT1_PEEP_SPRITE_TYPE_PIZZA = 19, // Unsure
RCT1_PEEP_SPRITE_TYPE_SECURITY_ALT = 20, // Unknown
RCT1_PEEP_SPRITE_TYPE_POPCORN = 21,
RCT1_PEEP_SPRITE_TYPE_ARMS_CROSSED = 22,
RCT1_PEEP_SPRITE_TYPE_HEAD_DOWN = 23,
RCT1_PEEP_SPRITE_TYPE_NAUSEOUS = 24,
RCT1_PEEP_SPRITE_TYPE_VERY_NAUSEOUS = 25,
RCT1_PEEP_SPRITE_TYPE_REQUIRE_BATHROOM = 26,
RCT1_PEEP_SPRITE_TYPE_HAT = 27,
RCT1_PEEP_SPRITE_TYPE_BURGER = 28,
RCT1_PEEP_SPRITE_TYPE_TENTACLE = 29,
RCT1_PEEP_SPRITE_TYPE_TOFFEE_APPLE = 30
};
typedef union rct1_sprite {
uint8 pad_00[0x100];
rct1_unk_sprite unknown;
rct1_peep peep;
rct_litter litter;
} rct1_sprite;
assert_struct_size(rct1_sprite, 0x100);

View File

@ -569,10 +569,11 @@ private:
dst->status = RIDE_STATUS_CLOSED;
// Flags
if (src->lifecycle_flags & RIDE_LIFECYCLE_ON_RIDE_PHOTO) dst->lifecycle_flags |= RIDE_LIFECYCLE_ON_RIDE_PHOTO;
if (src->lifecycle_flags & RIDE_LIFECYCLE_MUSIC) dst->lifecycle_flags |= RIDE_LIFECYCLE_MUSIC;
if (src->lifecycle_flags & RIDE_LIFECYCLE_INDESTRUCTIBLE) dst->lifecycle_flags |= RIDE_LIFECYCLE_INDESTRUCTIBLE;
if (src->lifecycle_flags & RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK) dst->lifecycle_flags |= RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK;
// if (src->lifecycle_flags & RIDE_LIFECYCLE_ON_RIDE_PHOTO) dst->lifecycle_flags |= RIDE_LIFECYCLE_ON_RIDE_PHOTO;
// if (src->lifecycle_flags & RIDE_LIFECYCLE_MUSIC) dst->lifecycle_flags |= RIDE_LIFECYCLE_MUSIC;
// if (src->lifecycle_flags & RIDE_LIFECYCLE_INDESTRUCTIBLE) dst->lifecycle_flags |= RIDE_LIFECYCLE_INDESTRUCTIBLE;
// if (src->lifecycle_flags & RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK) dst->lifecycle_flags |= RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK;
dst->lifecycle_flags = src->lifecycle_flags;
// Station
dst->overall_view = src->overall_view;
@ -687,6 +688,24 @@ private:
dst->unreliability_factor = src->unreliability_factor;
dst->breakdown_reason = src->breakdown_reason;
// Measurement data
dst->excitement = src->excitement;
dst->intensity = src->intensity;
dst->nausea = src->nausea;
dst->max_speed = src->max_speed;
dst->average_speed = src->average_speed;
for (int i = 0; i < 4; i++) {
dst->time[i] = src->time[i];
dst->length[i] = src->length[i];
}
dst->max_positive_vertical_g = src->max_positive_vertical_g;
dst->max_negative_vertical_g = src->max_negative_vertical_g;
dst->max_lateral_g = src->max_lateral_g;
dst->drops = src->num_drops;
dst->highest_drop_height = src->highest_drop_height / 2;
dst->inversions = src->num_inversions;
// Finance
dst->upkeep_cost = src->upkeep_cost;
dst->price = src->price;
@ -737,15 +756,12 @@ private:
if (_s4.sprites[i].unknown.sprite_identifier == SPRITE_IDENTIFIER_PEEP)
{
rct1_peep *srcPeep = &_s4.sprites[i].peep;
if (srcPeep->x != (sint16)0x8000)
if (srcPeep->x != (sint16)0x8000 || srcPeep->state == PEEP_STATE_ON_RIDE)
{
rct_peep *peep = (rct_peep*)create_sprite(1);
rct_peep *peep = (rct_peep*)create_sprite(SPRITE_IDENTIFIER_PEEP);
move_sprite_to_list((rct_sprite*)peep, SPRITE_LIST_PEEP * 2);
if (srcPeep->state != PEEP_STATE_ON_RIDE)
{
ImportPeep(peep, srcPeep);
}
ImportPeep(peep, srcPeep);
}
}
}
@ -754,7 +770,8 @@ private:
void ImportPeep(rct_peep * dst, rct1_peep * src)
{
dst->sprite_identifier = SPRITE_IDENTIFIER_PEEP;
dst->sprite_type = PEEP_SPRITE_TYPE_NORMAL;
// Peep vs. staff (including which kind)
dst->sprite_type = RCT1::GetPeepSpriteType(src->sprite_type);
dst->action = PEEP_ACTION_NONE_2;
dst->special_sprite = 0;
dst->action_sprite_image_offset = 0;
@ -774,12 +791,27 @@ private:
dst->name_string_idx = src->name_string_idx;
dst->outside_of_park = src->outside_of_park;
dst->state = src->state;
dst->type = PEEP_TYPE_GUEST;
// We cannot yet import peeps that are on a ride properly. Move these to a safe place.
switch(src->state) {
case PEEP_STATE_ON_RIDE:
case PEEP_STATE_QUEUING_FRONT:
case PEEP_STATE_LEAVING_RIDE:
case PEEP_STATE_ENTERING_RIDE:
dst->state = PEEP_STATE_FALLING;
peep_autoposition(dst);
break;
default:
dst->state = src->state;
}
dst->type = src->type;
dst->tshirt_colour = RCT1::GetColour(src->tshirt_colour);
dst->trousers_colour = RCT1::GetColour(src->trousers_colour);
dst->balloon_colour = RCT1::GetColour(src->balloon_colour);
dst->umbrella_colour = RCT1::GetColour(src->umbrella_colour);
dst->hat_colour = RCT1::GetColour(src->hat_colour);
dst->destination_x = src->destination_x;
dst->destination_y = src->destination_y;
dst->destination_tolerence = src->destination_tolerence;
@ -795,6 +827,9 @@ private:
dst->bathroom = src->bathroom;
dst->var_41 = src->var_41;
dst->litter_count = src->litter_count;
dst->disgusting_count = src->disgusting_count;
dst->intensity = src->intensity;
dst->nausea_tolerance = src->nausea_tolerance;
dst->window_invalidate_flags = 0;
@ -802,12 +837,41 @@ private:
dst->current_ride = src->current_ride;
dst->current_ride_station = src->current_ride_station;
dst->var_79 = 0xFF;
dst->interactionRideIndex = 0xFF;
dst->id = src->id;
dst->cash_in_pocket = src->cash_in_pocket;
dst->cash_spent = src->cash_spent;
dst->time_in_park = -1;
dst->time_in_park = src->time_in_park;
// This doubles as staff type
dst->no_of_rides = src->no_of_rides;
dst->no_of_drinks = src->no_of_drinks;
dst->no_of_food = src->no_of_food;
dst->no_of_souvenirs = src->no_of_souvenirs;
dst->paid_to_enter = src->paid_to_enter;
dst->paid_on_rides = src->paid_on_rides;
dst->paid_on_drink = src->paid_on_drink;
dst->paid_on_food = src->paid_on_food;
dst->paid_on_souvenirs = src->paid_on_souvenirs;
dst->voucher_arguments = src->voucher_arguments;
dst->voucher_type = src->voucher_type;
for (int i = 0; i < 32; i++) {
dst->rides_been_on[i] = src->rides_been_on[i];
}
for (int i = 0; i < 16; i++) {
dst->ride_types_been_on[i] = src->ride_types_been_on[i];
}
dst->photo1_ride_ref = src->photo1_ride_ref;
for (int i = 0; i < PEEP_MAX_THOUGHTS; i++) {
dst->thoughts[i] = src->thoughts[i];
}
dst->previous_ride = 0xFF;
@ -815,6 +879,8 @@ private:
dst->var_C4 = 0;
dst->guest_heading_to_ride_id = src->guest_heading_to_ride_id;
// Doubles as staff orders
dst->peep_is_lost_countdown = src->peep_is_lost_countdown;
dst->peep_flags = 0;
dst->pathfind_goal.x = 0xFF;
@ -829,12 +895,36 @@ private:
peep_update_name_sort(dst);
if (!dst->outside_of_park)
if (!dst->outside_of_park && dst->type == PEEP_TYPE_GUEST)
{
gNumGuestsInPark++;
}
}
void ImportLitter()
{
for (int i = 0; i < 5000; i++)
{
if (_s4.sprites[i].unknown.sprite_identifier == SPRITE_IDENTIFIER_LITTER) {
rct_litter *srcLitter = &_s4.sprites[i].litter;
if (srcLitter->x != (sint16) 0x8000) {
rct_litter *litter = (rct_litter *) create_sprite(SPRITE_IDENTIFIER_LITTER);
move_sprite_to_list((rct_sprite *) litter, SPRITE_LIST_LITTER * 2);
litter->x = srcLitter->x;
litter->y = srcLitter->y;
litter->z = srcLitter->z;
sprite_move(srcLitter->x, srcLitter->y, srcLitter->z, (rct_sprite *) litter);
invalidate_sprite_2((rct_sprite *) litter);
litter->sprite_direction = srcLitter->sprite_direction;
litter->type = srcLitter->type;
}
}
}
}
void ImportPeepSpawns()
{
for (int i = 0; i < 2; i++)

View File

@ -25,6 +25,7 @@
namespace RCT1
{
colour_t GetColour(colour_t colour);
uint8 GetPeepSpriteType(uint8 rct1SpriteType);
uint8 GetTerrain(uint8 terrain);
uint8 GetTerrainEdge(uint8 terrainEdge);

View File

@ -70,6 +70,45 @@ namespace RCT1
return map[colour];
}
uint8 GetPeepSpriteType(uint8 rct1SpriteType)
{
static const uint8 map[] =
{
PEEP_SPRITE_TYPE_NORMAL,
PEEP_SPRITE_TYPE_HANDYMAN,
PEEP_SPRITE_TYPE_MECHANIC,
PEEP_SPRITE_TYPE_SECURITY,
PEEP_SPRITE_TYPE_ENTERTAINER_PANDA,
PEEP_SPRITE_TYPE_ENTERTAINER_TIGER,
PEEP_SPRITE_TYPE_ENTERTAINER_ELEPHANT,
PEEP_SPRITE_TYPE_ENTERTAINER_ROMAN,
PEEP_SPRITE_TYPE_ENTERTAINER_GORILLA,
PEEP_SPRITE_TYPE_ENTERTAINER_SNOWMAN,
PEEP_SPRITE_TYPE_ENTERTAINER_KNIGHT,
PEEP_SPRITE_TYPE_ENTERTAINER_ASTRONAUT,
PEEP_SPRITE_TYPE_NORMAL, // Not used
PEEP_SPRITE_TYPE_NORMAL, // Not used
PEEP_SPRITE_TYPE_NORMAL, // Not used
PEEP_SPRITE_TYPE_NORMAL, // Not used
PEEP_SPRITE_TYPE_BALLOON,
PEEP_SPRITE_TYPE_CANDYFLOSS,
PEEP_SPRITE_TYPE_UMBRELLA,
PEEP_SPRITE_TYPE_PIZZA,
PEEP_SPRITE_TYPE_SECURITY_ALT,
PEEP_SPRITE_TYPE_POPCORN,
PEEP_SPRITE_TYPE_ARMS_CROSSED,
PEEP_SPRITE_TYPE_HEAD_DOWN,
PEEP_SPRITE_TYPE_NAUSEOUS,
PEEP_SPRITE_TYPE_VERY_NAUSEOUS,
PEEP_SPRITE_TYPE_REQUIRE_BATHROOM,
PEEP_SPRITE_TYPE_HAT,
PEEP_SPRITE_TYPE_BURGER,
PEEP_SPRITE_TYPE_TENTACLE,
PEEP_SPRITE_TYPE_TOFFEE_APPLE
};
return map[rct1SpriteType];
}
uint8 GetTerrain(uint8 terrain)
{
static const uint8 map[] =

View File

@ -86,6 +86,12 @@ public:
sint32 entryPosition = _position;
FixViewLocation();
if (_sequence == nullptr)
{
SetViewLocation(75 * 32, 75 * 32);
return false;
}
// Check that position is valid
if (_position >= (sint32)_sequence->NumCommands)
{