Use a map to convert vehicle subentry and restore seat rotation

This commit is contained in:
Gymnasiast 2017-01-07 00:01:13 +01:00 committed by Ted John
parent 8646f5d4ee
commit f7f744f59b
4 changed files with 286 additions and 5 deletions

View File

@ -1121,6 +1121,13 @@ enum {
RCT1_PARK_FLAGS_LOCK_REAL_NAMES_OPTION = (1 << 15),
};
enum {
STEEL_RC_FRONT = 0,
STEEL_RC_CARRIAGE = 1,
MINE_TRAIN_FRONT = 35,
MINE_TRAIN_CARRIAGE = 36,
};
#define RCT1_MAX_STATIONS 4
extern const uint8 gRideCategories[0x60];

View File

@ -847,11 +847,16 @@ private:
{
// TODO perform vehicle type conversion
// this will be whether the vehicle is the head of the train or a seat etc.
uint8 vehicleEntryIndex = 0;
if (src->vehicle_type == 36)
{
vehicleEntryIndex = 1;
}
// uint8 vehicleEntryIndex = 0;
// if (src->vehicle_type == 36)
// {
// vehicleEntryIndex = 1;
// }
char buf[64];
sprintf(buf, "%d", src->vehicle_type);
log_error(buf);
uint8 vehicleEntryIndex = RCT1::GetVehicleSubEntryIndex(src->vehicle_type);
rct_ride * ride = get_ride(src->ride);
rct_ride_entry * rideEntry = get_ride_entry_by_ride(ride);
@ -900,6 +905,10 @@ private:
dst->vehicle_sprite_type = src->vehicle_sprite_type;
dst->bank_rotation = src->bank_rotation;
// Seat rotation was not in RCT1
dst->target_seat_rotation = 4;
dst->seat_rotation = 4;
// Vehicle links (indexes converted later)
dst->prev_vehicle_on_ride = src->prev_vehicle_on_ride;
dst->next_vehicle_on_ride = src->next_vehicle_on_ride;

View File

@ -33,6 +33,7 @@ namespace RCT1
bool RideTypeUsesVehicles(uint8 rideType);
bool PathIsQueue(uint8 pathType);
uint8 NormalisePathAddition(uint8 pathAdditionType);
uint8 GetVehicleSubEntryIndex(uint8 vehicleSubEntry);
const char * GetRideTypeObject(uint8 rideType);
const char * GetVehicleObject(uint8 vehicleType);

View File

@ -314,6 +314,270 @@ namespace RCT1
return pathAdditionType;
}
uint8 GetVehicleSubEntryIndex(uint8 vehicleSubEntry)
{
static const uint8 map[] =
{
0, // STEEL_RC_FRONT
1, // STEEL_RC_CARRIAGE
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0, //MINE_TRAIN_FRONT
1, //MINE_TRAIN_CARRIAGE
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
};
return map[vehicleSubEntry];
}
const char * GetRideTypeObject(uint8 rideType)
{
static const char * map[] =