mirror of https://github.com/OpenRCT2/OpenRCT2.git
Labelled remaining_distance. Relabelled acceleration/powered acceleration
This commit is contained in:
parent
c4d8b8c665
commit
e14fa03be1
|
@ -9,7 +9,7 @@ static void cable_lift_update_departing(rct_vehicle *vehicle);
|
|||
static void cable_lift_update_travelling(rct_vehicle *vehicle);
|
||||
static void cable_lift_update_arriving(rct_vehicle *vehicle);
|
||||
|
||||
rct_vehicle *cable_lift_segment_create(int rideIndex, int x, int y, int z, int direction, uint16 var_44, sint32 var_24, bool head)
|
||||
rct_vehicle *cable_lift_segment_create(int rideIndex, int x, int y, int z, int direction, uint16 var_44, sint32 remaining_distance, bool head)
|
||||
{
|
||||
rct_ride *ride = GET_RIDE(rideIndex);
|
||||
rct_vehicle *current = &(create_sprite(1)->vehicle);
|
||||
|
@ -22,16 +22,16 @@ rct_vehicle *cable_lift_segment_create(int rideIndex, int x, int y, int z, int d
|
|||
}
|
||||
current->is_child = head ? 0 : 1;
|
||||
current->var_44 = var_44;
|
||||
current->var_24 = var_24;
|
||||
current->remaining_distance = remaining_distance;
|
||||
current->sprite_width = 10;
|
||||
current->sprite_height_negative = 10;
|
||||
current->sprite_height_positive = 10;
|
||||
current->friction = 100;
|
||||
current->num_seats = 0;
|
||||
current->speed = 20;
|
||||
current->acceleration = 80;
|
||||
current->powered_acceleration = 80;
|
||||
current->velocity = 0;
|
||||
current->var_2C = 0;
|
||||
current->acceleration = 0;
|
||||
current->var_4A = 0;
|
||||
current->var_4C = 0;
|
||||
current->var_4E = 0;
|
||||
|
@ -102,18 +102,18 @@ void cable_lift_update(rct_vehicle *vehicle)
|
|||
static void cable_lift_update_moving_to_end_of_station(rct_vehicle *vehicle)
|
||||
{
|
||||
if (vehicle->velocity >= -439800)
|
||||
vehicle->var_2C = -2932;
|
||||
vehicle->acceleration = -2932;
|
||||
|
||||
if (vehicle->velocity < -439800) {
|
||||
vehicle->velocity -= vehicle->velocity / 16;
|
||||
vehicle->var_2C = 0;
|
||||
vehicle->acceleration = 0;
|
||||
}
|
||||
|
||||
if (!(cable_lift_update_track_motion(vehicle) & (1 << 0)))
|
||||
return;
|
||||
|
||||
vehicle->velocity = 0;
|
||||
vehicle->var_2C = 0;
|
||||
vehicle->acceleration = 0;
|
||||
vehicle->status = VEHICLE_STATUS_WAITING_FOR_PASSENGERS;
|
||||
}
|
||||
|
||||
|
@ -124,11 +124,11 @@ static void cable_lift_update_moving_to_end_of_station(rct_vehicle *vehicle)
|
|||
static void cable_lift_update_waiting_to_depart(rct_vehicle *vehicle)
|
||||
{
|
||||
if (vehicle->velocity >= -58640)
|
||||
vehicle->var_2C = -14660;
|
||||
vehicle->acceleration = -14660;
|
||||
|
||||
if (vehicle->velocity < -58640) {
|
||||
vehicle->velocity -= vehicle->velocity / 16;
|
||||
vehicle->var_2C = 0;
|
||||
vehicle->acceleration = 0;
|
||||
}
|
||||
|
||||
cable_lift_update_track_motion(vehicle);
|
||||
|
@ -146,7 +146,7 @@ static void cable_lift_update_waiting_to_depart(rct_vehicle *vehicle)
|
|||
return;
|
||||
|
||||
vehicle->velocity = 0;
|
||||
vehicle->var_2C = 0;
|
||||
vehicle->acceleration = 0;
|
||||
vehicle->status = VEHICLE_STATUS_DEPARTING;
|
||||
vehicle->sub_state = 0;
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ static void cable_lift_update_travelling(rct_vehicle *vehicle)
|
|||
rct_vehicle* passengerVehicle = GET_VEHICLE(vehicle->var_C0);
|
||||
|
||||
vehicle->velocity = min(passengerVehicle->velocity, 439800);
|
||||
vehicle->var_2C = 0;
|
||||
vehicle->acceleration = 0;
|
||||
if (passengerVehicle->update_flags & VEHICLE_UPDATE_FLAG_BROKEN_TRAIN)
|
||||
return;
|
||||
|
||||
|
@ -183,7 +183,7 @@ static void cable_lift_update_travelling(rct_vehicle *vehicle)
|
|||
return;
|
||||
|
||||
vehicle->velocity = 0;
|
||||
vehicle->var_2C = 0;
|
||||
vehicle->acceleration = 0;
|
||||
vehicle->status = VEHICLE_STATUS_ARRIVING;
|
||||
vehicle->sub_state = 0;
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ bool sub_6DF01A_loop(rct_vehicle* vehicle) {
|
|||
rct_ride* ride = GET_RIDE(vehicle->ride);
|
||||
rct_xyz16 *unk_F64E20 = RCT2_ADDRESS(0x00F64E20, rct_xyz16);
|
||||
|
||||
for (; vehicle->var_24 >= 13962; RCT2_GLOBAL(0x00F64E10, uint32)++) {
|
||||
for (; vehicle->remaining_distance >= 13962; RCT2_GLOBAL(0x00F64E10, uint32)++) {
|
||||
uint8 trackType = vehicle->track_type >> 2;
|
||||
if (trackType == TRACK_ELEM_CABLE_LIFT_HILL &&
|
||||
vehicle->track_progress == 160) {
|
||||
|
@ -270,7 +270,7 @@ bool sub_6DF01A_loop(rct_vehicle* vehicle) {
|
|||
if (unk.z != unk_F64E20->z)
|
||||
bx |= (1 << 2);
|
||||
|
||||
vehicle->var_24 -= RCT2_ADDRESS(0x009A2930, sint32)[bx];
|
||||
vehicle->remaining_distance -= RCT2_ADDRESS(0x009A2930, sint32)[bx];
|
||||
unk_F64E20->x = unk.x;
|
||||
unk_F64E20->y = unk.y;
|
||||
unk_F64E20->z = unk.z;
|
||||
|
@ -279,8 +279,8 @@ bool sub_6DF01A_loop(rct_vehicle* vehicle) {
|
|||
vehicle->var_20 = moveInfo->var_08;
|
||||
vehicle->var_1F = moveInfo->var_07;
|
||||
|
||||
if (vehicle->var_24 >= 13962) {
|
||||
vehicle->var_2C += RCT2_ADDRESS(0x009A2970, sint32)[vehicle->var_1F];
|
||||
if (vehicle->remaining_distance >= 13962) {
|
||||
vehicle->acceleration += RCT2_ADDRESS(0x009A2970, sint32)[vehicle->var_1F];
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -290,7 +290,7 @@ bool sub_6DF21B_loop(rct_vehicle* vehicle) {
|
|||
rct_ride* ride = GET_RIDE(vehicle->ride);
|
||||
rct_xyz16 *unk_F64E20 = RCT2_ADDRESS(0x00F64E20, rct_xyz16);
|
||||
|
||||
for (; vehicle->var_24 < 0; RCT2_GLOBAL(0x00F64E10, uint32)++) {
|
||||
for (; vehicle->remaining_distance < 0; RCT2_GLOBAL(0x00F64E10, uint32)++) {
|
||||
uint16 trackProgress = vehicle->track_progress - 1;
|
||||
const rct_vehicle_info *moveInfo;
|
||||
|
||||
|
@ -356,7 +356,7 @@ bool sub_6DF21B_loop(rct_vehicle* vehicle) {
|
|||
if (unk.z != unk_F64E20->z)
|
||||
bx |= (1 << 2);
|
||||
|
||||
vehicle->var_24 += RCT2_ADDRESS(0x009A2930, sint32)[bx];
|
||||
vehicle->remaining_distance += RCT2_ADDRESS(0x009A2930, sint32)[bx];
|
||||
unk_F64E20->x = unk.x;
|
||||
unk_F64E20->y = unk.y;
|
||||
unk_F64E20->z = unk.z;
|
||||
|
@ -365,8 +365,8 @@ bool sub_6DF21B_loop(rct_vehicle* vehicle) {
|
|||
vehicle->var_20 = moveInfo->var_08;
|
||||
vehicle->var_1F = moveInfo->var_07;
|
||||
|
||||
if (vehicle->var_24 < 0) {
|
||||
vehicle->var_2C += RCT2_ADDRESS(0x009A2970, sint32)[vehicle->var_1F];
|
||||
if (vehicle->remaining_distance < 0) {
|
||||
vehicle->acceleration += RCT2_ADDRESS(0x009A2970, sint32)[vehicle->var_1F];
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -387,7 +387,7 @@ int cable_lift_update_track_motion(rct_vehicle *cableLift)
|
|||
RCT2_GLOBAL(0x00F64E18, uint32) = 0;
|
||||
RCT2_GLOBAL(0x00F64E1C, uint32) = (uint32)-1;
|
||||
|
||||
cableLift->velocity += cableLift->var_2C;
|
||||
cableLift->velocity += cableLift->acceleration;
|
||||
RCT2_GLOBAL(0x00F64E08, sint32) = cableLift->velocity;
|
||||
RCT2_GLOBAL(0x00F64E0C, sint32) = (cableLift->velocity / 1024) * 42;
|
||||
|
||||
|
@ -399,11 +399,11 @@ int cable_lift_update_track_motion(rct_vehicle *cableLift)
|
|||
RCT2_GLOBAL(0x00F64E00, rct_vehicle*) = frontVehicle;
|
||||
|
||||
for (rct_vehicle* vehicle = frontVehicle;;) {
|
||||
vehicle->var_2C = RCT2_ADDRESS(0x009A2970, sint32)[vehicle->var_1F];
|
||||
vehicle->acceleration = RCT2_ADDRESS(0x009A2970, sint32)[vehicle->var_1F];
|
||||
RCT2_GLOBAL(0x00F64E10, uint32) = 1;
|
||||
vehicle->var_24 += RCT2_GLOBAL(0x00F64E0C, sint32);
|
||||
vehicle->remaining_distance += RCT2_GLOBAL(0x00F64E0C, sint32);
|
||||
|
||||
if (vehicle->var_24 < 0 || vehicle->var_24 >= 13962) {
|
||||
if (vehicle->remaining_distance < 0 || vehicle->remaining_distance >= 13962) {
|
||||
rct_xyz16 *unk_F64E20 = RCT2_ADDRESS(0x00F64E20, rct_xyz16);
|
||||
unk_F64E20->x = vehicle->x;
|
||||
unk_F64E20->y = vehicle->y;
|
||||
|
@ -411,15 +411,15 @@ int cable_lift_update_track_motion(rct_vehicle *cableLift)
|
|||
invalidate_sprite_2((rct_sprite*)vehicle);
|
||||
|
||||
while (true) {
|
||||
if (vehicle->var_24 < 0) {
|
||||
if (vehicle->remaining_distance < 0) {
|
||||
if (sub_6DF21B_loop(vehicle) == true) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
RCT2_GLOBAL(0x00F64E18, uint32) |= (1 << 5);
|
||||
RCT2_GLOBAL(0x00F64E0C, uint32) -= vehicle->var_24 - 13962;
|
||||
vehicle->var_24 = 13962;
|
||||
vehicle->var_2C += RCT2_ADDRESS(0x009A2970, uint32)[vehicle->var_1F];
|
||||
RCT2_GLOBAL(0x00F64E0C, uint32) -= vehicle->remaining_distance - 13962;
|
||||
vehicle->remaining_distance = 13962;
|
||||
vehicle->acceleration += RCT2_ADDRESS(0x009A2970, uint32)[vehicle->var_1F];
|
||||
RCT2_GLOBAL(0x00F64E10, uint32)++;
|
||||
continue;
|
||||
}
|
||||
|
@ -430,9 +430,9 @@ int cable_lift_update_track_motion(rct_vehicle *cableLift)
|
|||
}
|
||||
else {
|
||||
RCT2_GLOBAL(0x00F64E18, uint32) |= (1 << 5);
|
||||
RCT2_GLOBAL(0x00F64E0C, uint32) -= vehicle->var_24 + 1;
|
||||
vehicle->var_24 = -1;
|
||||
vehicle->var_2C += RCT2_ADDRESS(0x009A2970, uint32)[vehicle->var_1F];
|
||||
RCT2_GLOBAL(0x00F64E0C, uint32) -= vehicle->remaining_distance + 1;
|
||||
vehicle->remaining_distance = -1;
|
||||
vehicle->acceleration += RCT2_ADDRESS(0x009A2970, uint32)[vehicle->var_1F];
|
||||
RCT2_GLOBAL(0x00F64E10, uint32)++;
|
||||
}
|
||||
}
|
||||
|
@ -445,7 +445,7 @@ int cable_lift_update_track_motion(rct_vehicle *cableLift)
|
|||
|
||||
invalidate_sprite_2((rct_sprite*)vehicle);
|
||||
}
|
||||
vehicle->var_2C /= RCT2_GLOBAL(0x00F64E10, uint32);
|
||||
vehicle->acceleration /= RCT2_GLOBAL(0x00F64E10, uint32);
|
||||
if (RCT2_GLOBAL(0x00F64E08, sint32) >= 0) {
|
||||
if (vehicle->next_vehicle_on_train == 0xFFFF)
|
||||
break;
|
||||
|
@ -466,7 +466,7 @@ int cable_lift_update_track_motion(rct_vehicle *cableLift)
|
|||
rct_vehicle* vehicle = GET_VEHICLE(spriteId);
|
||||
vehicleCount++;
|
||||
frictionTotal += vehicle->friction;
|
||||
var2CTotal += vehicle->var_2C;
|
||||
var2CTotal += vehicle->acceleration;
|
||||
spriteId = vehicle->next_vehicle_on_train;
|
||||
}
|
||||
|
||||
|
@ -480,6 +480,6 @@ int cable_lift_update_track_motion(rct_vehicle *cableLift)
|
|||
edx >>= 4;
|
||||
ecx -= edx / frictionTotal;
|
||||
|
||||
cableLift->var_2C = ecx;
|
||||
cableLift->acceleration = ecx;
|
||||
return RCT2_GLOBAL(0x00F64E18, uint32);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "../common.h"
|
||||
#include "vehicle.h"
|
||||
|
||||
rct_vehicle *cable_lift_segment_create(int rideIndex, int x, int y, int z, int direction, uint16 var_44, sint32 var_24, bool head);
|
||||
rct_vehicle *cable_lift_segment_create(int rideIndex, int x, int y, int z, int direction, uint16 var_44, sint32 remaining_distance, bool head);
|
||||
void cable_lift_update(rct_vehicle *vehicle);
|
||||
int cable_lift_update_track_motion(rct_vehicle *cableLift);
|
||||
|
||||
|
|
|
@ -4291,9 +4291,9 @@ void loc_6DDF9C(rct_ride *ride, rct_map_element *mapElement)
|
|||
car = train;
|
||||
while (true) {
|
||||
car->velocity = 0;
|
||||
car->var_2C = 0;
|
||||
car->acceleration = 0;
|
||||
car->var_4A = 0;
|
||||
car->var_24 += 13962;
|
||||
car->remaining_distance += 13962;
|
||||
|
||||
uint16 spriteIndex = car->next_vehicle_on_train;
|
||||
if (spriteIndex == SPRITE_INDEX_NULL) {
|
||||
|
@ -4482,10 +4482,10 @@ bool ride_create_cable_lift(int rideIndex, bool isApplying)
|
|||
uint16 var_44 = edx & 0xFFFF;
|
||||
edx = rol32(edx, 10) >> 1;
|
||||
ebx -= edx;
|
||||
sint32 var_24 = ebx;
|
||||
sint32 remaining_distance = ebx;
|
||||
ebx -= edx;
|
||||
|
||||
rct_vehicle *current = cable_lift_segment_create(rideIndex, x, y, z, direction, var_44, var_24, i == 0);
|
||||
rct_vehicle *current = cable_lift_segment_create(rideIndex, x, y, z, direction, var_44, remaining_distance, i == 0);
|
||||
current->next_vehicle_on_train = SPRITE_INDEX_NULL;
|
||||
if (i == 0) {
|
||||
head = current;
|
||||
|
|
|
@ -763,7 +763,7 @@ static void vehicle_update_measurements(rct_vehicle *vehicle)
|
|||
ride->time[test_segment]++;
|
||||
}
|
||||
|
||||
sint32 distance = abs(((vehicle->velocity + vehicle->var_2C) >> 10) * 42);
|
||||
sint32 distance = abs(((vehicle->velocity + vehicle->acceleration) >> 10) * 42);
|
||||
if (vehicle->var_CE == 0){
|
||||
ride->length[test_segment] += distance;
|
||||
}
|
||||
|
@ -1048,7 +1048,7 @@ static void vehicle_update_measurements(rct_vehicle *vehicle)
|
|||
}
|
||||
}
|
||||
|
||||
sint32 distance = ((vehicle->velocity + vehicle->var_2C) >> 10) * 42;
|
||||
sint32 distance = ((vehicle->velocity + vehicle->acceleration) >> 10) * 42;
|
||||
if (distance < 0)return;
|
||||
|
||||
ride->sheltered_length += distance;
|
||||
|
@ -1200,11 +1200,11 @@ static void vehicle_update_moving_to_end_of_station(rct_vehicle *vehicle){
|
|||
case RIDE_MODE_DOWNWARD_LAUNCH:
|
||||
case RIDE_MODE_FREEFALL_DROP:
|
||||
if (vehicle->velocity >= -131940){
|
||||
vehicle->var_2C = -3298;
|
||||
vehicle->acceleration = -3298;
|
||||
}
|
||||
if (vehicle->velocity < -131940){
|
||||
vehicle->velocity = vehicle->velocity / 16;
|
||||
vehicle->var_2C = 0;
|
||||
vehicle->acceleration = 0;
|
||||
}
|
||||
|
||||
eax = vehicle_update_track_motion(vehicle, &ebx);
|
||||
|
@ -1230,7 +1230,7 @@ static void vehicle_update_moving_to_end_of_station(rct_vehicle *vehicle){
|
|||
case RIDE_MODE_CIRCUS_SHOW:
|
||||
vehicle->current_station = 0;
|
||||
vehicle->velocity = 0;
|
||||
vehicle->var_2C = 0;
|
||||
vehicle->acceleration = 0;
|
||||
vehicle->status = VEHICLE_STATUS_WAITING_FOR_PASSENGERS;
|
||||
vehicle->sub_state = 0;
|
||||
vehicle_invalidate_window(vehicle);
|
||||
|
@ -1242,12 +1242,12 @@ static void vehicle_update_moving_to_end_of_station(rct_vehicle *vehicle){
|
|||
|
||||
if (!(vehicleEntry->flags_b & VEHICLE_ENTRY_FLAG_B_3)){
|
||||
if (vehicle->velocity <= 131940){
|
||||
vehicle->var_2C = 3298;
|
||||
vehicle->acceleration = 3298;
|
||||
}
|
||||
}
|
||||
if (vehicle->velocity > 131940){
|
||||
vehicle->velocity = vehicle->velocity / 16;
|
||||
vehicle->var_2C = 0;
|
||||
vehicle->acceleration = 0;
|
||||
}
|
||||
|
||||
int station;
|
||||
|
@ -1255,7 +1255,7 @@ static void vehicle_update_moving_to_end_of_station(rct_vehicle *vehicle){
|
|||
|
||||
if (eax & (1 << 1)){
|
||||
vehicle->velocity = 0;
|
||||
vehicle->var_2C = 0;
|
||||
vehicle->acceleration = 0;
|
||||
vehicle->sub_state++;
|
||||
|
||||
if (ride->mode == RIDE_MODE_RACE &&
|
||||
|
@ -1277,7 +1277,7 @@ static void vehicle_update_moving_to_end_of_station(rct_vehicle *vehicle){
|
|||
|
||||
vehicle->current_station = station;
|
||||
vehicle->velocity = 0;
|
||||
vehicle->var_2C = 0;
|
||||
vehicle->acceleration = 0;
|
||||
vehicle->status = VEHICLE_STATUS_WAITING_FOR_PASSENGERS;
|
||||
vehicle->sub_state = 0;
|
||||
vehicle_invalidate_window(vehicle);
|
||||
|
@ -1549,7 +1549,7 @@ static void vehicle_update_bumpcar_mode(rct_vehicle* vehicle) {
|
|||
vehicle->var_C5 = 0;
|
||||
vehicle_invalidate(vehicle);
|
||||
vehicle->velocity = 0;
|
||||
vehicle->var_2C = 0;
|
||||
vehicle->acceleration = 0;
|
||||
vehicle->status = VEHICLE_STATUS_UNLOADING_PASSENGERS;
|
||||
vehicle->sub_state = 0;
|
||||
vehicle_invalidate_window(vehicle);
|
||||
|
@ -2061,7 +2061,7 @@ static void vehicle_update_travelling_boat_hire_setup(rct_vehicle* vehicle) {
|
|||
vehicle->status = VEHICLE_STATUS_TRAVELLING_BOAT;
|
||||
vehicle_invalidate_window(vehicle);
|
||||
vehicle->sub_state = 0;
|
||||
vehicle->var_24 += 27924;
|
||||
vehicle->remaining_distance += 27924;
|
||||
|
||||
vehicle_update_travelling_boat(vehicle);
|
||||
}
|
||||
|
@ -2154,7 +2154,7 @@ static void vehicle_update_departing(rct_vehicle* vehicle) {
|
|||
switch (ride->mode) {
|
||||
case RIDE_MODE_REVERSE_INCLINE_LAUNCHED_SHUTTLE:
|
||||
if (vehicle->velocity >= -131940)
|
||||
vehicle->var_2C = -3298;
|
||||
vehicle->acceleration = -3298;
|
||||
break;
|
||||
case RIDE_MODE_POWERED_LAUNCH_PASSTROUGH:
|
||||
case RIDE_MODE_POWERED_LAUNCH:
|
||||
|
@ -2163,18 +2163,18 @@ static void vehicle_update_departing(rct_vehicle* vehicle) {
|
|||
case RIDE_MODE_UPWARD_LAUNCH:
|
||||
if (ride->type == RIDE_TYPE_AIR_POWERED_VERTICAL_COASTER) {
|
||||
if ((ride->launch_speed << 16) > vehicle->velocity) {
|
||||
vehicle->var_2C = ride->launch_speed << 13;
|
||||
vehicle->acceleration = ride->launch_speed << 13;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ((ride->launch_speed << 16) > vehicle->velocity)
|
||||
vehicle->var_2C = ride->launch_speed << 12;
|
||||
vehicle->acceleration = ride->launch_speed << 12;
|
||||
break;
|
||||
case RIDE_MODE_DOWNWARD_LAUNCH:
|
||||
if (vehicle->var_CE >= 1) {
|
||||
if ((14 << 16) > vehicle->velocity)
|
||||
vehicle->var_2C = 14 << 12;
|
||||
vehicle->acceleration = 14 << 12;
|
||||
break;
|
||||
}
|
||||
// Fall through
|
||||
|
@ -2187,7 +2187,7 @@ static void vehicle_update_departing(rct_vehicle* vehicle) {
|
|||
break;
|
||||
|
||||
if (vehicle->velocity <= 131940)
|
||||
vehicle->var_2C = 3298;
|
||||
vehicle->acceleration = 3298;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2222,7 +2222,7 @@ static void vehicle_update_departing(rct_vehicle* vehicle) {
|
|||
if (ride->mode != RIDE_MODE_REVERSE_INCLINE_LAUNCHED_SHUTTLE) {
|
||||
sint32 speed = ride->lift_hill_speed * 31079;
|
||||
if (vehicle->velocity <= speed) {
|
||||
vehicle->var_2C = 15539;
|
||||
vehicle->acceleration = 15539;
|
||||
if (vehicle->velocity != 0) {
|
||||
if (RCT2_GLOBAL(0x00F64E34, uint8) == BREAKDOWN_SAFETY_CUT_OUT) {
|
||||
vehicle->update_flags |= VEHICLE_UPDATE_FLAG_7;
|
||||
|
@ -2236,7 +2236,7 @@ static void vehicle_update_departing(rct_vehicle* vehicle) {
|
|||
else {
|
||||
sint32 speed = ride->lift_hill_speed * -31079;
|
||||
if (vehicle->velocity >= speed) {
|
||||
vehicle->var_2C = -15539;
|
||||
vehicle->acceleration = -15539;
|
||||
if (vehicle->velocity != 0) {
|
||||
if (RCT2_GLOBAL(0x00F64E34, uint8) == BREAKDOWN_SAFETY_CUT_OUT) {
|
||||
vehicle->update_flags |= VEHICLE_UPDATE_FLAG_7;
|
||||
|
@ -2543,7 +2543,7 @@ static void vehicle_update_travelling(rct_vehicle* vehicle) {
|
|||
|
||||
if (vehicle->sub_state == 2) {
|
||||
vehicle->velocity = 0;
|
||||
vehicle->var_2C = 0;
|
||||
vehicle->acceleration = 0;
|
||||
vehicle->var_C0--;
|
||||
if (vehicle->var_C0 == 0)
|
||||
vehicle->sub_state = 0;
|
||||
|
@ -2554,7 +2554,7 @@ static void vehicle_update_travelling(rct_vehicle* vehicle) {
|
|||
|
||||
vehicle->var_C5++;
|
||||
vehicle->velocity = 0;
|
||||
vehicle->var_2C = 0;
|
||||
vehicle->acceleration = 0;
|
||||
vehicle_invalidate(vehicle);
|
||||
return;
|
||||
}
|
||||
|
@ -2627,7 +2627,7 @@ static void vehicle_update_travelling(rct_vehicle* vehicle) {
|
|||
|
||||
if (vehicle->sub_state == 0) {
|
||||
if (vehicle->velocity >= -131940)
|
||||
vehicle->var_2C = -3298;
|
||||
vehicle->acceleration = -3298;
|
||||
vehicle->velocity = max(vehicle->velocity, -131940);
|
||||
}
|
||||
else {
|
||||
|
@ -2638,7 +2638,7 @@ static void vehicle_update_travelling(rct_vehicle* vehicle) {
|
|||
}
|
||||
else {
|
||||
if (vehicle->velocity <= 131940)
|
||||
vehicle->var_2C = 3298;
|
||||
vehicle->acceleration = 3298;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2651,7 +2651,7 @@ static void vehicle_update_travelling(rct_vehicle* vehicle) {
|
|||
|
||||
if (!(vehicle->update_flags & VEHICLE_UPDATE_FLAG_12)) {
|
||||
if (vehicle->velocity >= ride->lift_hill_speed * -31079) {
|
||||
vehicle->var_2C = -15539;
|
||||
vehicle->acceleration = -15539;
|
||||
|
||||
if (RCT2_GLOBAL(0x00F64E34, uint8) == 0) {
|
||||
vehicle->var_B8 &= ~(1 << 1);
|
||||
|
@ -2664,7 +2664,7 @@ static void vehicle_update_travelling(rct_vehicle* vehicle) {
|
|||
else {
|
||||
vehicle->var_B8 |= (1 << 1);
|
||||
if (vehicle->velocity <= ride->lift_hill_speed * 31079) {
|
||||
vehicle->var_2C = 15539;
|
||||
vehicle->acceleration = 15539;
|
||||
if (vehicle->velocity != 0) {
|
||||
if (RCT2_GLOBAL(0x00F64E34, uint8) == 0) {
|
||||
vehicle->update_flags |= VEHICLE_UPDATE_FLAG_7;
|
||||
|
@ -2728,7 +2728,7 @@ static void vehicle_update_arriving(rct_vehicle* vehicle) {
|
|||
case RIDE_MODE_CROOKED_HOUSE:
|
||||
vehicle->update_flags &= ~VEHICLE_UPDATE_FLAG_12;
|
||||
vehicle->velocity = 0;
|
||||
vehicle->var_2C = 0;
|
||||
vehicle->acceleration = 0;
|
||||
vehicle->status = VEHICLE_STATUS_UNLOADING_PASSENGERS;
|
||||
vehicle->sub_state = 0;
|
||||
vehicle_invalidate_window(vehicle);
|
||||
|
@ -2751,7 +2751,7 @@ static void vehicle_update_arriving(rct_vehicle* vehicle) {
|
|||
}
|
||||
|
||||
if (vehicle->velocity <= 131940) {
|
||||
vehicle->var_2C = 3298;
|
||||
vehicle->acceleration = 3298;
|
||||
goto loc_6D8E36;
|
||||
}
|
||||
|
||||
|
@ -2771,12 +2771,12 @@ static void vehicle_update_arriving(rct_vehicle* vehicle) {
|
|||
}
|
||||
}
|
||||
vehicle->velocity -= velocity_diff;
|
||||
vehicle->var_2C = 0;
|
||||
vehicle->acceleration = 0;
|
||||
}
|
||||
else {
|
||||
if (!(vehicleEntry->flags_b & VEHICLE_ENTRY_FLAG_B_3) &&
|
||||
vehicle->velocity >= -131940) {
|
||||
vehicle->var_2C = -3298;
|
||||
vehicle->acceleration = -3298;
|
||||
}
|
||||
|
||||
if (vehicle->velocity >= -131940) {
|
||||
|
@ -2799,7 +2799,7 @@ static void vehicle_update_arriving(rct_vehicle* vehicle) {
|
|||
|
||||
if (vehicle->num_laps + 1 != ride->num_circuits) {
|
||||
vehicle->velocity -= velocity_diff;
|
||||
vehicle->var_2C = 0;
|
||||
vehicle->acceleration = 0;
|
||||
goto loc_6D8E36;
|
||||
}
|
||||
|
||||
|
@ -2810,7 +2810,7 @@ static void vehicle_update_arriving(rct_vehicle* vehicle) {
|
|||
}
|
||||
else{
|
||||
vehicle->velocity -= velocity_diff;
|
||||
vehicle->var_2C = 0;
|
||||
vehicle->acceleration = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2887,7 +2887,7 @@ static void vehicle_update_arriving(rct_vehicle* vehicle) {
|
|||
vehicle->y,
|
||||
vehicle->z);
|
||||
vehicle->velocity = 0;
|
||||
vehicle->var_2C = 0;
|
||||
vehicle->acceleration = 0;
|
||||
vehicle->status = VEHICLE_STATUS_DEPARTING;
|
||||
vehicle->sub_state = 1;
|
||||
vehicle_invalidate_window(vehicle);
|
||||
|
@ -2904,7 +2904,7 @@ static void vehicle_update_arriving(rct_vehicle* vehicle) {
|
|||
|
||||
vehicle->update_flags &= ~VEHICLE_UPDATE_FLAG_12;
|
||||
vehicle->velocity = 0;
|
||||
vehicle->var_2C = 0;
|
||||
vehicle->acceleration = 0;
|
||||
vehicle->status = VEHICLE_STATUS_UNLOADING_PASSENGERS;
|
||||
vehicle->sub_state = 0;
|
||||
vehicle_invalidate_window(vehicle);
|
||||
|
@ -3070,7 +3070,7 @@ static void vehicle_update_travelling_cable_lift(rct_vehicle* vehicle) {
|
|||
rct_ride_type_vehicle* vehicleEntry = &rideEntry->vehicles[vehicle->vehicle_type];
|
||||
|
||||
if (vehicle->velocity <= 439800) {
|
||||
vehicle->var_2C = 4398;
|
||||
vehicle->acceleration = 4398;
|
||||
}
|
||||
int flags = vehicle_update_track_motion(vehicle, NULL);
|
||||
|
||||
|
@ -4619,7 +4619,7 @@ static int vehicle_update_motion_bumper_car(rct_vehicle* vehicle) {
|
|||
RCT2_GLOBAL(0x00F64E18, uint32) = 0;
|
||||
rct_ride* ride = GET_RIDE(vehicle->ride);
|
||||
|
||||
sint32 nextVelocity = vehicle->velocity + vehicle->var_2C;
|
||||
sint32 nextVelocity = vehicle->velocity + vehicle->acceleration;
|
||||
if (ride->lifecycle_flags & (RIDE_LIFECYCLE_BREAKDOWN_PENDING | RIDE_LIFECYCLE_BROKEN_DOWN) &&
|
||||
ride->breakdown_reason_pending == BREAKDOWN_SAFETY_CUT_OUT) {
|
||||
nextVelocity = 0;
|
||||
|
@ -4630,7 +4630,7 @@ static int vehicle_update_motion_bumper_car(rct_vehicle* vehicle) {
|
|||
RCT2_GLOBAL(0x00F64E0C, sint32) = (nextVelocity / 1024) * 42;
|
||||
RCT2_GLOBAL(0x00F64E10, uint32) = 1;
|
||||
|
||||
vehicle->var_2C = 0;
|
||||
vehicle->acceleration = 0;
|
||||
if (!(ride->lifecycle_flags & (RIDE_LIFECYCLE_BREAKDOWN_PENDING | RIDE_LIFECYCLE_BROKEN_DOWN)) ||
|
||||
ride->breakdown_reason_pending != BREAKDOWN_SAFETY_CUT_OUT) {
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 1 &&
|
||||
|
@ -4686,9 +4686,9 @@ static int vehicle_update_motion_bumper_car(rct_vehicle* vehicle) {
|
|||
}
|
||||
}
|
||||
|
||||
vehicle->var_24 += RCT2_GLOBAL(0x00F64E0C, sint32);
|
||||
vehicle->remaining_distance += RCT2_GLOBAL(0x00F64E0C, sint32);
|
||||
|
||||
if (vehicle->var_24 >= 13962) {
|
||||
if (vehicle->remaining_distance >= 13962) {
|
||||
vehicle->var_B8 &= ~(1 << 1);
|
||||
rct_xyz16 *unk_F64E20 = RCT2_ADDRESS(0x00F64E20, rct_xyz16);
|
||||
unk_F64E20->x = vehicle->x;
|
||||
|
@ -4709,18 +4709,18 @@ static int vehicle_update_motion_bumper_car(rct_vehicle* vehicle) {
|
|||
if (vehicle_update_bumper_car_collision(vehicle, location.x, location.y, &collideSprite))
|
||||
break;
|
||||
|
||||
vehicle->var_24 -= RCT2_ADDRESS(0x009A36C8, sint16)[direction * 4];
|
||||
vehicle->remaining_distance -= RCT2_ADDRESS(0x009A36C8, sint16)[direction * 4];
|
||||
unk_F64E20->x = location.x;
|
||||
unk_F64E20->y = location.y;
|
||||
if (vehicle->var_24 < 13962) {
|
||||
if (vehicle->remaining_distance < 13962) {
|
||||
break;
|
||||
}
|
||||
RCT2_GLOBAL(0x00F64E10, uint32)++;
|
||||
}
|
||||
|
||||
if (vehicle->var_24 >= 13962) {
|
||||
if (vehicle->remaining_distance >= 13962) {
|
||||
sint32 oldVelocity = vehicle->velocity;
|
||||
vehicle->var_24 = 0;
|
||||
vehicle->remaining_distance = 0;
|
||||
vehicle->velocity = 0;
|
||||
uint8 direction = vehicle->sprite_direction | 1;
|
||||
|
||||
|
@ -4763,7 +4763,7 @@ static int vehicle_update_motion_bumper_car(rct_vehicle* vehicle) {
|
|||
rct_ride_type_vehicle* vehicleEntry = &rideEntry->vehicles[vehicle->vehicle_type];
|
||||
|
||||
if (!(vehicleEntry->flags_b & VEHICLE_ENTRY_FLAG_B_3)) {
|
||||
vehicle->var_2C = -eax;
|
||||
vehicle->acceleration = -eax;
|
||||
return RCT2_GLOBAL(0x00F64E18, uint32);
|
||||
}
|
||||
|
||||
|
@ -4773,10 +4773,10 @@ static int vehicle_update_motion_bumper_car(rct_vehicle* vehicle) {
|
|||
_eax = -_eax;
|
||||
}
|
||||
_eax -= vehicle->velocity;
|
||||
_eax *= vehicle->acceleration * 2;
|
||||
_eax *= vehicle->powered_acceleration * 2;
|
||||
_eax /= ebx;
|
||||
|
||||
vehicle->var_2C = _eax - eax;
|
||||
vehicle->acceleration = _eax - eax;
|
||||
return RCT2_GLOBAL(0x00F64E18, uint32);
|
||||
}
|
||||
|
||||
|
@ -4917,7 +4917,7 @@ static void sub_6DAB4C_chunk_2(rct_vehicle *vehicle)
|
|||
velocity = 0;
|
||||
}
|
||||
vehicle->velocity = velocity;
|
||||
vehicle->var_2C = 0;
|
||||
vehicle->acceleration = 0;
|
||||
}
|
||||
|
||||
int trackType = vehicle->track_type >> 2;
|
||||
|
@ -4956,16 +4956,16 @@ static void sub_6DAB4C_chunk_2(rct_vehicle *vehicle)
|
|||
if (trackType == TRACK_ELEM_BLOCK_BRAKES && vehicle->velocity >= 0) {
|
||||
if (vehicle->velocity <= 0x20364) {
|
||||
vehicle->velocity = 0x20364;
|
||||
vehicle->var_2C = 0;
|
||||
vehicle->acceleration = 0;
|
||||
} else {
|
||||
vehicle->velocity -= vehicle->velocity >> 4;
|
||||
vehicle->var_2C = 0;
|
||||
vehicle->acceleration = 0;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
RCT2_GLOBAL(0x00F64E18, uint32) |= VEHICLE_UPDATE_MOTION_TRACK_FLAG_10;
|
||||
vehicle->var_2C = 0;
|
||||
vehicle->acceleration = 0;
|
||||
if (vehicle->velocity <= 0x20000) {
|
||||
vehicle->velocity = 0;
|
||||
}
|
||||
|
@ -4979,7 +4979,7 @@ static void sub_6DAB4C_chunk_2(rct_vehicle *vehicle)
|
|||
*/
|
||||
static void sub_6DAB4C_chunk_3(rct_vehicle *vehicle)
|
||||
{
|
||||
sint32 nextVelocity = vehicle->var_2C + vehicle->velocity;
|
||||
sint32 nextVelocity = vehicle->acceleration + vehicle->velocity;
|
||||
if (vehicle->update_flags & VEHICLE_UPDATE_FLAG_7) {
|
||||
nextVelocity = 0;
|
||||
}
|
||||
|
@ -4990,7 +4990,7 @@ static void sub_6DAB4C_chunk_3(rct_vehicle *vehicle)
|
|||
}
|
||||
if (vehicle->var_D2 >= 0) {
|
||||
nextVelocity = 0;
|
||||
vehicle->var_2C = 0;
|
||||
vehicle->acceleration = 0;
|
||||
}
|
||||
}
|
||||
vehicle->velocity = nextVelocity;
|
||||
|
@ -6041,7 +6041,7 @@ void sub_6DBF3E(rct_vehicle *vehicle)
|
|||
{
|
||||
rct_ride_type_vehicle *vehicleEntry = vehicle_get_vehicle_entry(vehicle);
|
||||
|
||||
vehicle->var_2C = (uint32)((sint32)vehicle->var_2C / RCT2_GLOBAL(0x00F64E10, sint32));
|
||||
vehicle->acceleration = (uint32)((sint32)vehicle->acceleration / RCT2_GLOBAL(0x00F64E10, sint32));
|
||||
if (vehicle->var_CD == 2) {
|
||||
return;
|
||||
}
|
||||
|
@ -6297,10 +6297,10 @@ loc_6DAEB9:
|
|||
vehicleEntry = vehicle_get_vehicle_entry(vehicle);
|
||||
}
|
||||
if (RCT2_GLOBAL(0x00F64E08, sint32) >= 0x40000) {
|
||||
vehicle->var_2C = -RCT2_GLOBAL(0x00F64E08, sint32) * 8;
|
||||
vehicle->acceleration = -RCT2_GLOBAL(0x00F64E08, sint32) * 8;
|
||||
}
|
||||
else if (RCT2_GLOBAL(0x00F64E08, sint32) < 0x20000) {
|
||||
vehicle->var_2C = 0x50000;
|
||||
vehicle->acceleration = 0x50000;
|
||||
}
|
||||
}
|
||||
else if (trackType == TRACK_ELEM_BRAKES) {
|
||||
|
@ -6311,7 +6311,7 @@ loc_6DAEB9:
|
|||
)) {
|
||||
regs.eax = vehicle->var_CF << 16;
|
||||
if (regs.eax < RCT2_GLOBAL(0x00F64E08, sint32)) {
|
||||
vehicle->var_2C = -RCT2_GLOBAL(0x00F64E08, sint32) * 16;
|
||||
vehicle->acceleration = -RCT2_GLOBAL(0x00F64E08, sint32) * 16;
|
||||
}
|
||||
else if (!(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 0x0F)) {
|
||||
if (RCT2_GLOBAL(0x00F64E2C, uint8) == 0) {
|
||||
|
@ -6325,13 +6325,13 @@ loc_6DAEB9:
|
|||
if ((trackType == TRACK_ELEM_FLAT && ride->type == RIDE_TYPE_REVERSE_FREEFALL_COASTER) ||
|
||||
(trackType == TRACK_ELEM_POWERED_LIFT)
|
||||
) {
|
||||
vehicle->var_2C = RCT2_GLOBAL(0x0097CF40 + (ride->type * 8) + 7, uint8) << 16;
|
||||
vehicle->acceleration = RCT2_GLOBAL(0x0097CF40 + (ride->type * 8) + 7, uint8) << 16;
|
||||
}
|
||||
if (trackType == TRACK_ELEM_BRAKE_FOR_DROP) {
|
||||
if (!vehicle->is_child) {
|
||||
if (!(vehicle->update_flags & VEHICLE_UPDATE_FLAG_10)) {
|
||||
if (vehicle->track_progress >= 8) {
|
||||
vehicle->var_2C = -RCT2_GLOBAL(0x00F64E08, sint32) * 16;
|
||||
vehicle->acceleration = -RCT2_GLOBAL(0x00F64E08, sint32) * 16;
|
||||
if (vehicle->track_progress >= 24) {
|
||||
vehicle->update_flags |= VEHICLE_UPDATE_FLAG_10;
|
||||
vehicle->var_D2 = 90;
|
||||
|
@ -6414,7 +6414,7 @@ loc_6DB706:;
|
|||
|
||||
loc_6DB8A5:
|
||||
regs.ebx = RCT2_ADDRESS(0x009A2930, sint32)[regs.ebx];
|
||||
vehicle->var_24 -= regs.ebx;
|
||||
vehicle->remaining_distance -= regs.ebx;
|
||||
unk_F64E20->x = x;
|
||||
unk_F64E20->y = y;
|
||||
unk_F64E20->z = z;
|
||||
|
@ -6441,27 +6441,27 @@ loc_6DB8A5:
|
|||
}
|
||||
|
||||
loc_6DB928:
|
||||
if (vehicle->var_24 < 0x368A) {
|
||||
if (vehicle->remaining_distance < 0x368A) {
|
||||
return true;
|
||||
}
|
||||
|
||||
regs.ebx = dword_9A2970[regs.ebx];
|
||||
vehicle->var_2C += regs.ebx;
|
||||
vehicle->acceleration += regs.ebx;
|
||||
RCT2_GLOBAL(0x00F64E10, uint32)++;
|
||||
goto loc_6DAEB9;
|
||||
|
||||
loc_6DB94A:
|
||||
RCT2_GLOBAL(0x00F64E18, uint32) |= VEHICLE_UPDATE_MOTION_TRACK_FLAG_5;
|
||||
regs.eax = vehicle->var_24 + 1;
|
||||
regs.eax = vehicle->remaining_distance + 1;
|
||||
RCT2_GLOBAL(0x00F64E0C, sint32) -= regs.eax;
|
||||
vehicle->var_24 = 0xFFFFFFFF;
|
||||
vehicle->remaining_distance = 0xFFFFFFFF;
|
||||
regs.ebx = vehicle->var_1F;
|
||||
return false;
|
||||
|
||||
loc_6DB967:
|
||||
regs.eax = vehicle->var_24 + 1;
|
||||
regs.eax = vehicle->remaining_distance + 1;
|
||||
RCT2_GLOBAL(0x00F64E0C, sint32) -= regs.eax;
|
||||
vehicle->var_24 -= regs.eax;
|
||||
vehicle->remaining_distance -= regs.eax;
|
||||
|
||||
// Might need to be bp rather than vehicle, but hopefully not
|
||||
rct_vehicle *head = vehicle_get_head(GET_VEHICLE(regs.bp));
|
||||
|
@ -6500,7 +6500,7 @@ loc_6DBA33:;
|
|||
sint32 unkVelocity = RCT2_GLOBAL(0x00F64E08, sint32);
|
||||
if (unkVelocity > 0xFFF80000) {
|
||||
unkVelocity = abs(unkVelocity);
|
||||
vehicle->var_2C = unkVelocity * 2;
|
||||
vehicle->acceleration = unkVelocity * 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6508,7 +6508,7 @@ loc_6DBA33:;
|
|||
regs.eax = -(vehicle->var_CF << 16);
|
||||
if (regs.eax <= RCT2_GLOBAL(0x00F64E08, sint32)) {
|
||||
regs.eax = RCT2_GLOBAL(0x00F64E08, sint32) * -4;
|
||||
vehicle->var_2C = regs.eax;
|
||||
vehicle->acceleration = regs.eax;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6685,7 +6685,7 @@ loc_6DBD42:
|
|||
if (x == unk_F64E20->x) { regs.ebx |= 1; }
|
||||
if (y == unk_F64E20->y) { regs.ebx |= 2; }
|
||||
if (z == unk_F64E20->z) { regs.ebx |= 4; }
|
||||
vehicle->var_24 += RCT2_ADDRESS(0x009A2930, sint32)[regs.ebx];
|
||||
vehicle->remaining_distance += RCT2_ADDRESS(0x009A2930, sint32)[regs.ebx];
|
||||
|
||||
unk_F64E20->x = x;
|
||||
unk_F64E20->y = y;
|
||||
|
@ -6711,26 +6711,26 @@ loc_6DBD42:
|
|||
}
|
||||
|
||||
loc_6DBE3F:
|
||||
if ((sint32)vehicle->var_24 >= 0) {
|
||||
if ((sint32)vehicle->remaining_distance >= 0) {
|
||||
return true;
|
||||
}
|
||||
regs.ebx = dword_9A2970[regs.ebx];
|
||||
vehicle->var_2C += regs.ebx;
|
||||
vehicle->acceleration += regs.ebx;
|
||||
RCT2_GLOBAL(0x00F64E10, uint32)++;
|
||||
goto loc_6DBA33;
|
||||
|
||||
loc_6DBE5E:
|
||||
RCT2_GLOBAL(0x00F64E18, uint32) |= VEHICLE_UPDATE_MOTION_TRACK_FLAG_5;
|
||||
regs.eax = vehicle->var_24 - 0x368A;
|
||||
regs.eax = vehicle->remaining_distance - 0x368A;
|
||||
RCT2_GLOBAL(0x00F64E0C, sint32) -= regs.eax;
|
||||
vehicle->var_24 -= regs.eax;
|
||||
vehicle->remaining_distance -= regs.eax;
|
||||
regs.ebx = vehicle->var_1F;
|
||||
return false;
|
||||
|
||||
loc_6DBE7F:
|
||||
regs.eax = vehicle->var_24 - 0x368A;
|
||||
regs.eax = vehicle->remaining_distance - 0x368A;
|
||||
RCT2_GLOBAL(0x00F64E0C, sint32) -= regs.eax;
|
||||
vehicle->var_24 -= regs.eax;
|
||||
vehicle->remaining_distance -= regs.eax;
|
||||
|
||||
rct_vehicle *v3 = GET_VEHICLE(regs.bp);
|
||||
rct_vehicle *v4 = RCT2_GLOBAL(0x00F64E04, rct_vehicle*);
|
||||
|
@ -6767,9 +6767,9 @@ int vehicle_update_track_motion(rct_vehicle *vehicle, int *outStation)
|
|||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
regs.esi = (int)vehicle;
|
||||
RCT2_CALLFUNC_Y(0x006DAB4C, ®s);
|
||||
if (outStation != NULL) *outStation = regs.ebx;
|
||||
return regs.eax;
|
||||
//RCT2_CALLFUNC_Y(0x006DAB4C, ®s);
|
||||
//if (outStation != NULL) *outStation = regs.ebx;
|
||||
//return regs.eax;
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
rct_ride *ride = GET_RIDE(vehicle->ride);
|
||||
|
@ -6816,11 +6816,11 @@ int vehicle_update_track_motion(rct_vehicle *vehicle, int *outStation)
|
|||
if ((vehicleEntry->flags_b & VEHICLE_ENTRY_FLAG_B_7) || (vehicleEntry->flags_b & VEHICLE_ENTRY_FLAG_B_8)) {
|
||||
sub_6D63D4(car);
|
||||
}
|
||||
car->var_2C = dword_9A2970[car->var_1F];
|
||||
car->acceleration = dword_9A2970[car->var_1F];
|
||||
RCT2_GLOBAL(0x00F64E10, uint32) = 1;
|
||||
|
||||
regs.eax = RCT2_GLOBAL(0x00F64E0C, sint32) + car->var_24;
|
||||
car->var_24 = regs.eax;
|
||||
regs.eax = RCT2_GLOBAL(0x00F64E0C, sint32) + car->remaining_distance;
|
||||
car->remaining_distance = regs.eax;
|
||||
|
||||
car->var_B8 &= ~(1 << 1);
|
||||
unk_F64E20->x = car->x;
|
||||
|
@ -6829,22 +6829,22 @@ int vehicle_update_track_motion(rct_vehicle *vehicle, int *outStation)
|
|||
invalidate_sprite_2((rct_sprite*)car);
|
||||
|
||||
while (true) {
|
||||
if (car->var_24 < 0) {
|
||||
if (car->remaining_distance < 0) {
|
||||
// Backward loop
|
||||
if (vehicle_update_track_motion_backwards(car, vehicleEntry, ride, rideEntry)) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
if (car->var_24 < 0x368A) {
|
||||
if (car->remaining_distance < 0x368A) {
|
||||
break;
|
||||
}
|
||||
regs.ebx = dword_9A2970[car->var_1F];
|
||||
car->var_2C += regs.ebx;
|
||||
car->acceleration += regs.ebx;
|
||||
RCT2_GLOBAL(0x00F64E10, uint32)++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (car->var_24 < 0x368A) {
|
||||
if (car->remaining_distance < 0x368A) {
|
||||
// Location found
|
||||
goto loc_6DBF3E;
|
||||
}
|
||||
|
@ -6852,11 +6852,11 @@ int vehicle_update_track_motion(rct_vehicle *vehicle, int *outStation)
|
|||
break;
|
||||
}
|
||||
else {
|
||||
if (car->var_24 >= 0) {
|
||||
if (car->remaining_distance >= 0) {
|
||||
break;
|
||||
}
|
||||
regs.ebx = dword_9A2970[car->var_1F];
|
||||
car->var_2C = regs.ebx;
|
||||
car->acceleration = regs.ebx;
|
||||
RCT2_GLOBAL(0x00F64E10, uint32)++;
|
||||
continue;
|
||||
}
|
||||
|
@ -6893,7 +6893,7 @@ loc_6DC144:
|
|||
regs.ebx++;
|
||||
regs.dx |= vehicle->update_flags;
|
||||
regs.bp += vehicle->friction;
|
||||
regs.eax += vehicle->var_2C;
|
||||
regs.eax += vehicle->acceleration;
|
||||
|
||||
uint16 spriteIndex = vehicle->next_vehicle_on_train;
|
||||
if (spriteIndex == SPRITE_INDEX_NULL) {
|
||||
|
@ -6974,7 +6974,7 @@ loc_6DC23A:
|
|||
regs.eax = -regs.eax;
|
||||
}
|
||||
regs.eax -= vehicle->velocity;
|
||||
regs.edx = vehicle->acceleration;
|
||||
regs.edx = vehicle->powered_acceleration;
|
||||
regs.edx <<= 1;
|
||||
regs.eax *= regs.edx;
|
||||
regs.eax /= regs.ebx;
|
||||
|
@ -7060,7 +7060,7 @@ loc_6DC316:
|
|||
}
|
||||
}
|
||||
|
||||
vehicle->var_2C = regs.ecx;
|
||||
vehicle->acceleration = regs.ecx;
|
||||
|
||||
regs.eax = RCT2_GLOBAL(0x00F64E18, uint32);
|
||||
regs.ebx = RCT2_GLOBAL(0x00F64E1C, uint32);
|
||||
|
@ -7073,7 +7073,7 @@ loc_6DC316:
|
|||
loc_6DC3A7:
|
||||
RCT2_GLOBAL(0x00F64E04, rct_vehicle*) = vehicle;
|
||||
RCT2_GLOBAL(0x00F64E18, uint32) = 0;
|
||||
vehicle->velocity += vehicle->var_2C;
|
||||
vehicle->velocity += vehicle->acceleration;
|
||||
RCT2_GLOBAL(0x00F64E08, sint32) = vehicle->velocity;
|
||||
RCT2_GLOBAL(0x00F64E0C, sint32) = (vehicle->velocity >> 10) * 42;
|
||||
if (RCT2_GLOBAL(0x00F64E08, sint32) < 0) {
|
||||
|
@ -7084,12 +7084,12 @@ loc_6DC3A7:
|
|||
loc_6DC40E:
|
||||
regs.ebx = vehicle->var_1F;
|
||||
RCT2_GLOBAL(0x00F64E10, uint32) = 1;
|
||||
vehicle->var_2C = dword_9A2970[vehicle->var_1F];
|
||||
vehicle->var_24 = RCT2_GLOBAL(0x00F64E0C, sint32) + vehicle->var_24;
|
||||
if ((sint32)vehicle->var_24 < 0) {
|
||||
vehicle->acceleration = dword_9A2970[vehicle->var_1F];
|
||||
vehicle->remaining_distance = RCT2_GLOBAL(0x00F64E0C, sint32) + vehicle->remaining_distance;
|
||||
if ((sint32)vehicle->remaining_distance < 0) {
|
||||
goto loc_6DCA7A;
|
||||
}
|
||||
if ((sint32)vehicle->var_24 < 0x368A) {
|
||||
if ((sint32)vehicle->remaining_distance < 0x368A) {
|
||||
goto loc_6DCE02;
|
||||
}
|
||||
vehicle->var_B8 &= ~(1 << 1);
|
||||
|
@ -7325,9 +7325,9 @@ loc_6DC8A1:
|
|||
regs.ebx |= 4;
|
||||
}
|
||||
regs.ebx = 0x368A;
|
||||
vehicle->var_24 -= regs.ebx;
|
||||
if ((sint32)vehicle->var_24 < 0) {
|
||||
vehicle->var_24 = 0;
|
||||
vehicle->remaining_distance -= regs.ebx;
|
||||
if ((sint32)vehicle->remaining_distance < 0) {
|
||||
vehicle->remaining_distance = 0;
|
||||
}
|
||||
|
||||
unk_F64E20->x = x;
|
||||
|
@ -7355,24 +7355,24 @@ loc_6DC8A1:
|
|||
|
||||
loc_6DC985:
|
||||
regs.ebx = 0;
|
||||
vehicle->var_24 -= 0x368A;
|
||||
if ((sint32)vehicle->var_24 < 0) {
|
||||
vehicle->var_24 = 0;
|
||||
vehicle->remaining_distance -= 0x368A;
|
||||
if ((sint32)vehicle->remaining_distance < 0) {
|
||||
vehicle->remaining_distance = 0;
|
||||
}
|
||||
|
||||
loc_6DC99A:
|
||||
if ((sint32)vehicle->var_24 < 0x368A) {
|
||||
if ((sint32)vehicle->remaining_distance < 0x368A) {
|
||||
goto loc_6DCDE4;
|
||||
}
|
||||
vehicle->var_2C = dword_9A2970[vehicle->var_1F];
|
||||
vehicle->acceleration = dword_9A2970[vehicle->var_1F];
|
||||
RCT2_GLOBAL(0x00F64E10, uint32)++;
|
||||
goto loc_6DC462;
|
||||
|
||||
loc_6DC9BC:
|
||||
RCT2_GLOBAL(0x00F64E18, uint32) |= 0x20;
|
||||
regs.eax = vehicle->var_24 + 1;
|
||||
regs.eax = vehicle->remaining_distance + 1;
|
||||
RCT2_GLOBAL(0x00F64E0C, sint32) -= regs.eax;
|
||||
vehicle->var_24 -= regs.eax;
|
||||
vehicle->remaining_distance -= regs.eax;
|
||||
regs.ebx = vehicle->var_1F;
|
||||
goto loc_6DCD2B;
|
||||
|
||||
|
@ -7465,9 +7465,9 @@ loc_6DCC2C:
|
|||
regs.ebx |= 4;
|
||||
}
|
||||
regs.ebx = 0x368A;
|
||||
vehicle->var_24 -= regs.ebx;
|
||||
if ((sint32)vehicle->var_24 < 0) {
|
||||
vehicle->var_24 = 0;
|
||||
vehicle->remaining_distance -= regs.ebx;
|
||||
if ((sint32)vehicle->remaining_distance < 0) {
|
||||
vehicle->remaining_distance = 0;
|
||||
}
|
||||
|
||||
unk_F64E20->x = x;
|
||||
|
@ -7495,25 +7495,25 @@ loc_6DCC2C:
|
|||
}
|
||||
|
||||
loc_6DCD2B:
|
||||
if (vehicle->var_24 >= 0) {
|
||||
if (vehicle->remaining_distance >= 0) {
|
||||
goto loc_6DCDE4;
|
||||
}
|
||||
vehicle->var_2C += dword_9A2970[vehicle->var_1F];
|
||||
vehicle->acceleration += dword_9A2970[vehicle->var_1F];
|
||||
RCT2_GLOBAL(0x00F64E10, uint32)++;
|
||||
goto loc_6DCA9A;
|
||||
|
||||
loc_6DCD4A:
|
||||
RCT2_GLOBAL(0x00F64E18, uint32) |= VEHICLE_UPDATE_MOTION_TRACK_FLAG_5;
|
||||
regs.eax = vehicle->var_24 - 0x368A;
|
||||
regs.eax = vehicle->remaining_distance - 0x368A;
|
||||
RCT2_GLOBAL(0x00F64E0C, sint32) -= regs.eax;
|
||||
vehicle->var_24 -= regs.eax;
|
||||
vehicle->remaining_distance -= regs.eax;
|
||||
regs.ebx = vehicle->var_1F;
|
||||
goto loc_6DC99A;
|
||||
|
||||
loc_6DCD6B:
|
||||
regs.eax = vehicle->var_24 - 0x368A;
|
||||
regs.eax = vehicle->remaining_distance - 0x368A;
|
||||
RCT2_GLOBAL(0x00F64E0C, sint32) -= regs.eax;
|
||||
vehicle->var_24 -= regs.eax;
|
||||
vehicle->remaining_distance -= regs.eax;
|
||||
rct_vehicle *vEBP = GET_VEHICLE(regs.bp);
|
||||
rct_vehicle *vEDI = RCT2_GLOBAL(0x00F64E04, uint32);
|
||||
regs.eax = abs(vEDI->velocity - vEBP->velocity);
|
||||
|
@ -7532,7 +7532,7 @@ loc_6DCDE4:
|
|||
vehicle_invalidate(vehicle);
|
||||
|
||||
loc_6DCE02:
|
||||
vehicle->var_2C /= RCT2_GLOBAL(0x00F64E10, uint32);
|
||||
vehicle->acceleration /= RCT2_GLOBAL(0x00F64E10, uint32);
|
||||
if (vehicle->var_CD == 2) {
|
||||
goto loc_6DCEB2;
|
||||
}
|
||||
|
@ -7607,7 +7607,7 @@ loc_6DCEFF:
|
|||
regs.ebx++;
|
||||
regs.dx |= vehicle->update_flags;
|
||||
regs.bp += vehicle->friction;
|
||||
regs.eax += vehicle->var_2C;
|
||||
regs.eax += vehicle->acceleration;
|
||||
regs.si = vehicle->next_vehicle_on_train;
|
||||
if ((uint16)regs.si == SPRITE_INDEX_NULL) {
|
||||
break;
|
||||
|
@ -7649,7 +7649,7 @@ loc_6DCEFF:
|
|||
regs.eax = -regs.eax;
|
||||
}
|
||||
regs.eax -= vehicle->velocity;
|
||||
regs.edx = vehicle->acceleration;
|
||||
regs.edx = vehicle->powered_acceleration;
|
||||
regs.edx <<= 1;
|
||||
regs.eax *= regs.edx;
|
||||
regs.eax = regs.eax / regs.ebx;
|
||||
|
@ -7683,7 +7683,7 @@ loc_6DCEFF:
|
|||
regs.ecx += regs.eax;
|
||||
|
||||
loc_6DD069:
|
||||
vehicle->var_2C = regs.ecx;
|
||||
vehicle->acceleration = regs.ecx;
|
||||
regs.eax = RCT2_GLOBAL(0x00F64E18, uint32);
|
||||
regs.ebx = RCT2_GLOBAL(0x00F64E1C, uint32);
|
||||
|
||||
|
|
|
@ -106,9 +106,9 @@ typedef struct {
|
|||
uint8 var_1F;
|
||||
uint8 var_20;
|
||||
uint8 pad_21[3];
|
||||
sint32 var_24;
|
||||
sint32 remaining_distance; // 0x24
|
||||
sint32 velocity; // 0x28
|
||||
sint32 var_2C;
|
||||
sint32 acceleration; // 0x2C
|
||||
uint8 ride; // 0x30
|
||||
uint8 vehicle_type; // 0x31
|
||||
rct_vehicle_colour colours; // 0x32
|
||||
|
@ -160,7 +160,7 @@ typedef struct {
|
|||
sint8 var_BF;
|
||||
uint16 var_C0;
|
||||
uint8 speed; // 0xC2
|
||||
uint8 acceleration; // 0xC3
|
||||
uint8 powered_acceleration; // 0xC3
|
||||
uint8 var_C4;
|
||||
uint8 var_C5;
|
||||
uint8 pad_C6[0x2];
|
||||
|
|
Loading…
Reference in New Issue