mirror of https://github.com/OpenRCT2/OpenRCT2.git
Integrate 0x008B8F30 (gTrackVehicleInfo) (#3605)
This commit is contained in:
parent
f5b208d629
commit
938c498fac
|
@ -230,7 +230,7 @@ bool sub_6DF01A_loop(rct_vehicle* vehicle) {
|
|||
uint16 trackProgress = vehicle->track_progress + 1;
|
||||
|
||||
const rct_vehicle_info *moveInfo = vehicle_get_move_info(vehicle->var_CD, vehicle->track_type, 0);
|
||||
uint16 trackTotalProgress = *((uint16*)((int)moveInfo - 2));
|
||||
uint16 trackTotalProgress = vehicle_get_move_info_size(vehicle->var_CD, vehicle->track_type);
|
||||
if (trackProgress >= trackTotalProgress) {
|
||||
RCT2_GLOBAL(0x00F64E36, uint8) = gTrackDefinitions[trackType].vangle_end;
|
||||
RCT2_GLOBAL(0x00F64E37, uint8) = gTrackDefinitions[trackType].bank_end;
|
||||
|
@ -348,7 +348,7 @@ bool sub_6DF21B_loop(rct_vehicle* vehicle) {
|
|||
}
|
||||
|
||||
moveInfo = vehicle_get_move_info(vehicle->var_CD, vehicle->track_type, 0);
|
||||
uint16 trackTotalProgress = *((uint16*)((int)moveInfo - 2));
|
||||
uint16 trackTotalProgress = vehicle_get_move_info_size(vehicle->var_CD, vehicle->track_type);
|
||||
trackProgress = trackTotalProgress - 1;
|
||||
}
|
||||
vehicle->track_progress = trackProgress;
|
||||
|
|
24380
src/ride/track_data.c
24380
src/ride/track_data.c
File diff suppressed because it is too large
Load Diff
|
@ -51,3 +51,10 @@ typedef struct track_descriptor {
|
|||
} track_descriptor;
|
||||
|
||||
extern const track_descriptor gTrackDescriptors[142];
|
||||
|
||||
typedef struct {
|
||||
uint16 size;
|
||||
const rct_vehicle_info info[];
|
||||
} rct_vehicle_info_list;
|
||||
|
||||
extern const rct_vehicle_info_list **gTrackVehicleInfo[];
|
||||
|
|
|
@ -152,9 +152,12 @@ const uint8 _soundParams[SOUND_MAXID][2] = {
|
|||
|
||||
const rct_vehicle_info *vehicle_get_move_info(int cd, int typeAndDirection, int offset)
|
||||
{
|
||||
const rct_vehicle_info **infoListList = RCT2_ADDRESS(0x008B8F30, const rct_vehicle_info**)[cd];
|
||||
const rct_vehicle_info *infoList = infoListList[typeAndDirection];
|
||||
return &infoList[offset];
|
||||
return &gTrackVehicleInfo[cd][typeAndDirection]->info[offset];
|
||||
}
|
||||
|
||||
uint16 vehicle_get_move_info_size(int cd, int typeAndDirection)
|
||||
{
|
||||
return gTrackVehicleInfo[cd][typeAndDirection]->size;
|
||||
}
|
||||
|
||||
const uint8 DoorOpenSoundIds[] = {
|
||||
|
@ -6956,7 +6959,7 @@ loc_6DAEB9:
|
|||
);
|
||||
|
||||
// Track Total Progress is in the two bytes before the move info list
|
||||
uint16 trackTotalProgress = *((uint16*)((int)moveInfo - 2));
|
||||
uint16 trackTotalProgress = vehicle_get_move_info_size(vehicle->var_CD, vehicle->track_type);
|
||||
if (regs.ax >= trackTotalProgress) {
|
||||
if (!vehicle_update_track_motion_forwards_get_new_track(vehicle, trackType, ride, rideEntry)) {
|
||||
goto loc_6DB94A;
|
||||
|
@ -7237,7 +7240,7 @@ bool vehicle_update_track_motion_backwards_get_new_track(rct_vehicle *vehicle, u
|
|||
);
|
||||
|
||||
// There are two bytes before the move info list
|
||||
uint16 trackTotalProgress = *((uint16*)((int)moveInfo - 2));
|
||||
uint16 trackTotalProgress = vehicle_get_move_info_size(vehicle->var_CD, vehicle->track_type);
|
||||
*progress = trackTotalProgress - 1;
|
||||
return true;
|
||||
}
|
||||
|
@ -7474,7 +7477,7 @@ loc_6DC476:
|
|||
// There are two bytes before the move info list
|
||||
{
|
||||
uint16 unk16_v34 = vehicle->track_progress + 1;
|
||||
uint16 unk16 = *((uint16*)((int)moveInfo - 2));
|
||||
uint16 unk16 = vehicle_get_move_info_size(vehicle->var_CD, vehicle->track_type);
|
||||
if (unk16_v34 < unk16) {
|
||||
regs.ax = unk16_v34;
|
||||
goto loc_6DC743;
|
||||
|
@ -7749,7 +7752,7 @@ loc_6DCA9A:
|
|||
moveInfo = vehicle_get_move_info(vehicle->var_CD, vehicle->track_type, 0);
|
||||
|
||||
// There are two bytes before the move info list
|
||||
regs.ax = *((uint16*)((int)moveInfo - 2)) - 1;
|
||||
regs.ax = vehicle_get_move_info_size(vehicle->var_CD, vehicle->track_type);
|
||||
|
||||
loc_6DCC2C:
|
||||
vehicle->track_progress = regs.ax;
|
||||
|
|
|
@ -201,9 +201,9 @@ typedef struct train_ref {
|
|||
|
||||
// Size: 0x09
|
||||
typedef struct rct_vehicle_info {
|
||||
uint16 x; // 0x00
|
||||
uint16 y; // 0x02
|
||||
uint16 z; // 0x04
|
||||
sint16 x; // 0x00
|
||||
sint16 y; // 0x02
|
||||
sint16 z; // 0x04
|
||||
uint8 direction; // 0x06
|
||||
uint8 vehicle_sprite_type; // 0x07
|
||||
uint8 bank_rotation; // 0x08
|
||||
|
@ -375,6 +375,7 @@ void vehicle_peep_easteregg_here_we_are(rct_vehicle* vehicle);
|
|||
rct_vehicle *vehicle_get_head(rct_vehicle *vehicle);
|
||||
rct_vehicle *vehicle_get_tail(rct_vehicle *vehicle);
|
||||
const rct_vehicle_info *vehicle_get_move_info(int cd, int typeAndDirection, int offset);
|
||||
uint16 vehicle_get_move_info_size(int cd, int typeAndDirection);
|
||||
bool vehicle_update_bumper_car_collision(rct_vehicle *vehicle, sint16 x, sint16 y, uint16 *spriteId);
|
||||
|
||||
/** Helper macro until rides are stored in this module. */
|
||||
|
|
Loading…
Reference in New Issue