Clean up ride struct and num_riders import, update changelog

This commit is contained in:
Michael Steenbeek 2018-02-06 13:45:56 +01:00
parent 02196a1919
commit 34c8409251
3 changed files with 24 additions and 20 deletions

View File

@ -47,6 +47,7 @@
- Fix: [#2254] Edge scrolling horizontally now has the same speed as vertical edge scrolling.
- Fix: [#2607] Rain rendered incorrectly in additional viewport.
- Fix: [#3171] Guests entering from the corner of the tile in Amity Airfield (original bug).
- Fix: [#3330] Current number of passengers overflows when over 255.
- Fix: [#4760] Asia - Great Wall of China and South America - Rio Carnival have incorrect guest entry points (original bug).
- Fix: [#4991] Inverted helices can be built on the Lay Down RC, but are not drawn.
- Fix: [#5190] Cannot build Wild Mouse - Flying Dutchman Gold Mine.

View File

@ -631,19 +631,7 @@ public:
dst->popularity_time_out = src->popularity_time_out;
dst->popularity_next = src->popularity_next;
// The number of riders might have overflown or underflow. Re-calculate the value.
uint16 numRiders = 0;
for (const rct_sprite sprite : _s6.sprites)
{
if (sprite.unknown.sprite_identifier == SPRITE_IDENTIFIER_PEEP)
{
if (sprite.peep.state == PEEP_STATE_ON_RIDE && sprite.peep.current_ride == rideIndex)
{
numRiders++;
}
}
}
dst->num_riders = numRiders;
ImportNumRiders(dst, rideIndex);
dst->music_tune_id = src->music_tune_id;
dst->slide_in_use = src->slide_in_use;
@ -818,6 +806,23 @@ public:
gPeepSpawns[i].x = PEEP_SPAWN_UNDEFINED;
}
}
void ImportNumRiders(Ride * dst, const uint8 rideIndex)
{
// The number of riders might have overflown or underflown. Re-calculate the value.
uint16 numRiders = 0;
for (const rct_sprite sprite : _s6.sprites)
{
if (sprite.unknown.sprite_identifier == SPRITE_IDENTIFIER_PEEP)
{
if (sprite.peep.state == PEEP_STATE_ON_RIDE && sprite.peep.current_ride == rideIndex)
{
numRiders++;
}
}
}
dst->num_riders = numRiders;
}
};
IParkImporter * ParkImporter::CreateS6(IObjectRepository * objectRepository, IObjectManager * objectManager)

View File

@ -130,12 +130,12 @@ typedef struct rct_ride_entry {
/**
* Ride structure.
* size: 0x0260
*
* This is currently the same as rct2_ride and packed in order to keep Testpaint working.
* Testpaint could be modified to work with an unpacked and/or modified Ride struct.
* This is based on RCT2's ride structure and the fields currently still line up.
* It is, however, not the same size.
*/
typedef struct Ride {
typedef struct Ride
{
uint8 type; // 0x000
// pointer to static info. for example, wild mouse type is 0x36, subtype is
// 0x4c.
@ -268,7 +268,7 @@ typedef struct Ride {
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_rct2; // 0x15B
uint8 pad_15B; // 0x15B, used to be num_riders in rct2
uint8 music_tune_id; // 0x15C
uint8 slide_in_use; // 0x15D
union {
@ -342,9 +342,7 @@ typedef struct Ride {
uint16 cable_lift; // 0x1FE
uint16 queue_length[MAX_STATIONS]; // 0x200
uint16 num_riders; // 0x208
uint8 pad_210[0x56]; // 0x210
} Ride;
assert_struct_size(Ride, 0x260);
/**
* Ride measurement structure.