Part of #9473: Create Vehicle::PeepEasterEggHereWeAre

Converted from vehicle_peep_easteregg_here_we_are
This commit is contained in:
hdpoliveira 2020-04-19 01:33:05 -03:00
parent d69cc1c877
commit 53f6bd8340
2 changed files with 8 additions and 7 deletions

View File

@ -2974,18 +2974,19 @@ static bool vehicle_can_depart_synchronised(Vehicle* vehicle)
* *
* rct2: 0x006D9EB0 * rct2: 0x006D9EB0
*/ */
void vehicle_peep_easteregg_here_we_are(const Vehicle* vehicle) void Vehicle::PeepEasterEggHereWeAre() const
{ {
const Vehicle* vehicle = this;
uint16_t spriteId = vehicle->sprite_index; uint16_t spriteId = vehicle->sprite_index;
do do
{ {
vehicle = GET_VEHICLE(spriteId); vehicle = GET_VEHICLE(spriteId);
for (int32_t i = 0; i < vehicle->num_peeps; ++i) for (int32_t i = 0; i < vehicle->num_peeps; ++i)
{ {
Peep* peep = GET_PEEP(vehicle->peep[i]); Peep* curPeep = GET_PEEP(vehicle->peep[i]);
if (peep->peep_flags & PEEP_FLAGS_HERE_WE_ARE) if (curPeep->peep_flags & PEEP_FLAGS_HERE_WE_ARE)
{ {
peep->InsertNewThought(PEEP_THOUGHT_TYPE_HERE_WE_ARE, peep->current_ride); curPeep->InsertNewThought(PEEP_THOUGHT_TYPE_HERE_WE_ARE, curPeep->current_ride);
} }
} }
} while ((spriteId = vehicle->next_vehicle_on_train) != SPRITE_INDEX_NULL); } while ((spriteId = vehicle->next_vehicle_on_train) != SPRITE_INDEX_NULL);
@ -3172,7 +3173,7 @@ void Vehicle::UpdateDeparting()
} }
sub_state = 1; sub_state = 1;
vehicle_peep_easteregg_here_we_are(this); PeepEasterEggHereWeAre();
if (rideEntry->flags & RIDE_ENTRY_FLAG_PLAY_DEPART_SOUND) if (rideEntry->flags & RIDE_ENTRY_FLAG_PLAY_DEPART_SOUND)
{ {
@ -4156,7 +4157,7 @@ void Vehicle::UpdateTravellingCableLift()
} }
sub_state = 1; sub_state = 1;
vehicle_peep_easteregg_here_we_are(this); PeepEasterEggHereWeAre();
if (!(curRide->lifecycle_flags & RIDE_LIFECYCLE_TESTED)) if (!(curRide->lifecycle_flags & RIDE_LIFECYCLE_TESTED))
{ {
if (update_flags & VEHICLE_UPDATE_FLAG_TESTING) if (update_flags & VEHICLE_UPDATE_FLAG_TESTING)

View File

@ -360,6 +360,7 @@ private:
bool CurrentTowerElementIsTop(); bool CurrentTowerElementIsTop();
bool UpdateTrackMotionForwards(rct_ride_entry_vehicle* vehicleEntry, Ride* curRide, rct_ride_entry* rideEntry); bool UpdateTrackMotionForwards(rct_ride_entry_vehicle* vehicleEntry, Ride* curRide, rct_ride_entry* rideEntry);
bool UpdateTrackMotionBackwards(rct_ride_entry_vehicle* vehicleEntry, Ride* curRide, rct_ride_entry* rideEntry); bool UpdateTrackMotionBackwards(rct_ride_entry_vehicle* vehicleEntry, Ride* curRide, rct_ride_entry* rideEntry);
void PeepEasterEggHereWeAre() const;
}; };
struct train_ref struct train_ref
@ -562,7 +563,6 @@ int32_t vehicle_get_total_num_peeps(const Vehicle* vehicle);
void vehicle_invalidate_window(Vehicle* vehicle); void vehicle_invalidate_window(Vehicle* vehicle);
void vehicle_update_test_finish(Vehicle* vehicle); void vehicle_update_test_finish(Vehicle* vehicle);
void vehicle_test_reset(Vehicle* vehicle); void vehicle_test_reset(Vehicle* vehicle);
void vehicle_peep_easteregg_here_we_are(const Vehicle* vehicle);
const rct_vehicle_info* vehicle_get_move_info(int32_t trackSubposition, int32_t typeAndDirection, int32_t offset); const rct_vehicle_info* vehicle_get_move_info(int32_t trackSubposition, int32_t typeAndDirection, int32_t offset);
uint16_t vehicle_get_move_info_size(int32_t trackSubposition, int32_t typeAndDirection); uint16_t vehicle_get_move_info_size(int32_t trackSubposition, int32_t typeAndDirection);