Refactor turn count variables

This commit is contained in:
Duncan Frost 2015-04-05 20:22:27 +01:00 committed by duncanspumpkin
parent 59736c7b4a
commit 2b7f7c9232
4 changed files with 266 additions and 153 deletions

View File

@ -5880,52 +5880,164 @@ bool ride_type_has_flag(int rideType, int flag)
}
/*
* The next six functions are helpers to access ride data at the offset 10E &
* 110. We believe it stores three distinct values in the following format:
* The next eight functions are helpers to access ride data at the offset 10E &
* 110. Known as the turn counts. There are 3 different types (default, banked, sloped)
* and there are 4 counts as follows:
*
* unknown1: bits 9-11
* unknown2: bits 6-8
* unknown3: low 5 bits
* 1 element turns: low 5 bits
* 2 element turns: bits 6-8
* 3 element turns: bits 9-11
* 4 element or more turns: bits 12-15
*
* 4 plus elements only possible on sloped type. Falls back to 3 element
* if by some miracle you manage 4 element none sloped.
*/
int get_var_10E_unk_1(rct_ride* ride) {
return (ride->var_10E >> 8) & 0x7;
void increment_turn_count_1_element(rct_ride* ride, uint8 type){
uint16* turn_count;
switch (type){
case 0:
turn_count = &ride->turn_count_default;
break;
case 1:
turn_count = &ride->turn_count_banked;
break;
case 2:
turn_count = &ride->turn_count_sloped;
break;
}
uint16 value = (*turn_count & TURN_MASK_1_ELEMENT) + 1;
*turn_count &= ~TURN_MASK_1_ELEMENT;
if (value > TURN_MASK_1_ELEMENT)
value = TURN_MASK_1_ELEMENT;
*turn_count |= value;
}
int get_var_10E_unk_2(rct_ride* ride) {
return (ride->var_10E >> 5) & 0x7;
void increment_turn_count_2_elements(rct_ride* ride, uint8 type){
uint16* turn_count;
switch (type){
case 0:
turn_count = &ride->turn_count_default;
break;
case 1:
turn_count = &ride->turn_count_banked;
break;
case 2:
turn_count = &ride->turn_count_sloped;
break;
}
uint16 value = (*turn_count & TURN_MASK_2_ELEMENTS) + 0x20;
*turn_count &= ~TURN_MASK_2_ELEMENTS;
value <<= 5;
if (value > TURN_MASK_2_ELEMENTS)
value = TURN_MASK_2_ELEMENTS;
*turn_count |= value;
}
int get_var_10E_unk_3(rct_ride* ride) {
return ride->var_10E & 0x1F;
void increment_turn_count_3_elements(rct_ride* ride, uint8 type){
uint16* turn_count;
switch (type){
case 0:
turn_count = &ride->turn_count_default;
break;
case 1:
turn_count = &ride->turn_count_banked;
break;
case 2:
turn_count = &ride->turn_count_sloped;
break;
}
uint16 value = (*turn_count & TURN_MASK_3_ELEMENTS) + 0x100;
*turn_count &= ~TURN_MASK_3_ELEMENTS;
value <<= 8;
if (value > TURN_MASK_3_ELEMENTS)
value = TURN_MASK_3_ELEMENTS;
*turn_count |= value;
}
int get_var_110_unk_1(rct_ride* ride) {
return (ride->var_110 >> 8) & 0x7;
void increment_turn_count_4_plus_elements(rct_ride* ride, uint8 type){
uint16* turn_count;
switch (type){
case 0:
case 1:
// Just incase fallback to 3 element turn
increment_turn_count_3_elements(ride, type);
return;
case 2:
turn_count = &ride->turn_count_sloped;
break;
}
uint16 value = (*turn_count & TURN_MASK_4_PLUS_ELEMENTS) + 0x800;
*turn_count &= ~TURN_MASK_4_PLUS_ELEMENTS;
value <<= 11;
if (value > TURN_MASK_4_PLUS_ELEMENTS)
value = TURN_MASK_4_PLUS_ELEMENTS;
*turn_count |= value;
}
int get_var_110_unk_2(rct_ride* ride) {
return (ride->var_110 >> 5) & 0x7;
int get_turn_count_1_element(rct_ride* ride, uint8 type) {
uint16* turn_count;
switch (type){
case 0:
turn_count = &ride->turn_count_default;
break;
case 1:
turn_count = &ride->turn_count_banked;
break;
case 2:
turn_count = &ride->turn_count_sloped;
break;
}
return (*turn_count) & TURN_MASK_1_ELEMENT;
}
int get_var_110_unk_3(rct_ride* ride) {
return ride->var_110 & 0x1F;
int get_turn_count_2_elements(rct_ride* ride, uint8 type) {
uint16* turn_count;
switch (type){
case 0:
turn_count = &ride->turn_count_default;
break;
case 1:
turn_count = &ride->turn_count_banked;
break;
case 2:
turn_count = &ride->turn_count_sloped;
break;
}
return (*turn_count >> 5) & TURN_MASK_2_ELEMENTS;
}
int get_var_112_unk_1(rct_ride* ride) {
return (ride->var_112 >> 11) & 0x3F;
int get_turn_count_3_elements(rct_ride* ride, uint8 type) {
uint16* turn_count;
switch (type){
case 0:
turn_count = &ride->turn_count_default;
break;
case 1:
turn_count = &ride->turn_count_banked;
break;
case 2:
turn_count = &ride->turn_count_sloped;
break;
}
return (*turn_count >> 8) & TURN_MASK_3_ELEMENTS;
}
int get_var_112_unk_2(rct_ride* ride) {
return (ride->var_112 >> 8) & 7;
}
int get_turn_count_4_plus_elements(rct_ride* ride, uint8 type) {
uint16* turn_count;
switch (type){
case 0:
case 1:
return 0;
case 2:
turn_count = &ride->turn_count_sloped;
break;
}
int get_var_112_unk_3(rct_ride* ride) {
return (ride->var_112 >> 5) & 7;
}
int get_var_112_unk_4(rct_ride* ride) {
return ride->var_112 & 0x1F;
return (*turn_count >> 11) & TURN_MASK_4_PLUS_ELEMENTS;
}
bool ride_has_spinning_tunnel(rct_ride *ride) {

View File

@ -243,13 +243,13 @@ typedef struct {
fixed16_2dp previous_vertical_g;// 0x102
fixed16_2dp previous_lateral_g; // 0x104
uint8 pad_106[0x2];
uint32 var_108;
uint32 testing_flags; // 0x108
// x y map location
uint16 var_10C;
// Next 3 variables are related (XXXX XYYY ZZZa aaaa)
uint16 var_10E;
uint16 var_110;
uint16 var_112;
uint16 turn_count_default; // 0x10E X = current turn count
uint16 turn_count_banked; // 0x110
uint16 turn_count_sloped; // 0x112 X = number turns > 3 elements
union {
uint8 inversions; // 0x114 (???X XXXX)
uint8 holes; // 0x114 (???X XXXX)
@ -257,7 +257,8 @@ typedef struct {
// It reaches the maximum value of 7 at about 50% undercover and doesn't increase beyond that.
uint8 undercover_portion; // 0x114 (XXX?-????)
};
uint8 drops; // 0x115 (??XX XXXX)
// Y is number of powered lifts, X is drops
uint8 drops; // 0x115 (YYXX XXXX)
uint8 start_drop_height; // 0x116
uint8 highest_drop_height; // 0x117
sint32 sheltered_length; // 0x118
@ -475,6 +476,17 @@ enum {
RIDE_ENTRY_FLAG_31 = 1 << 31, // 0x80000000
};
enum{
RIDE_TESTING_FLAG_0 = (1 << 0),
RIDE_TESTING_TURN_LEFT = (1 << 1),
RIDE_TESTING_TURN_RIGHT = (1 << 2),
RIDE_TESTING_TURN_BANKED = (1 << 3),
RIDE_TESTING_TURN_SLOPED = (1 << 4),
RIDE_TESTING_DROP_DOWN = (1 << 5),
RIDE_TESTING_POWERED_LIFT = (1 << 6),
RIDE_TESTING_DROP_UP = (1 << 7),
};
enum {
RIDE_TYPE_NULL = 255,
RIDE_TYPE_SPIRAL_ROLLER_COASTER = 0,
@ -882,6 +894,12 @@ enum {
#define STATION_DEPART_FLAG (1 << 7)
#define STATION_DEPART_MASK (~STATION_DEPART_FLAG)
#define CURRENT_TURN_COUNT_MASK 0xF800
#define TURN_MASK_1_ELEMENT 0x001F
#define TURN_MASK_2_ELEMENTS 0x00E0
#define TURN_MASK_3_ELEMENTS 0x0700
#define TURN_MASK_4_PLUS_ELEMENTS 0xF800
// rct2: 0x009ACFA4
extern rct_ride_type **gRideTypeList;
@ -1003,6 +1021,7 @@ void game_command_callback_ride_remove_track_piece(int eax, int ebx, int ecx, in
void game_command_demolish_ride(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp);
void game_command_set_ride_appearance(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp);
void game_command_set_ride_price(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp);
void ride_clear_for_construction(int rideIndex);
void set_vehicle_type_image_max_sizes(rct_ride_type_vehicle* vehicle_type, int num_images);
void invalidate_test_results(int rideIndex);
@ -1010,16 +1029,14 @@ void invalidate_test_results(int rideIndex);
void ride_select_next_section();
void ride_select_previous_section();
int get_var_10E_unk_1(rct_ride* ride);
int get_var_10E_unk_2(rct_ride* ride);
int get_var_10E_unk_3(rct_ride* ride);
int get_var_110_unk_1(rct_ride* ride);
int get_var_110_unk_2(rct_ride* ride);
int get_var_110_unk_3(rct_ride* ride);
int get_var_112_unk_1(rct_ride* ride);
int get_var_112_unk_2(rct_ride* ride);
int get_var_112_unk_3(rct_ride* ride);
int get_var_112_unk_4(rct_ride* ride);
void increment_turn_count_1_element(rct_ride* ride, uint8 type);
void increment_turn_count_2_elements(rct_ride* ride, uint8 type);
void increment_turn_count_3_elements(rct_ride* ride, uint8 type);
void increment_turn_count_4_plus_elements(rct_ride* ride, uint8 type);
int get_turn_count_1_element(rct_ride* ride, uint8 type);
int get_turn_count_2_elements(rct_ride* ride, uint8 type);
int get_turn_count_3_elements(rct_ride* ride, uint8 type);
int get_turn_count_4_plus_elements(rct_ride* ride, uint8 type);
uint8 ride_get_helix_sections(rct_ride *ride);
bool ride_has_spinning_tunnel(rct_ride *ride);

View File

@ -930,22 +930,22 @@ static int sub_65E72D(rct_ride *ride)
return (dh << 8) | numShelteredEighths;
}
static rating_tuple get_var_10E_rating(rct_ride* ride) {
int var_10E_unk_1 = get_var_10E_unk_1(ride);
int var_10E_unk_2 = get_var_10E_unk_2(ride);
int var_10E_unk_3 = get_var_10E_unk_3(ride);
static rating_tuple get_flat_turns_rating(rct_ride* ride) {
int no_3_plus_turns = get_turn_count_3_elements(ride, 0);
int no_2_turns = get_turn_count_2_elements(ride, 0);
int no_1_turns = get_turn_count_1_element(ride, 0);
int excitement = (var_10E_unk_1 * 0x28000) >> 16;
excitement += (var_10E_unk_2 * 0x30000) >> 16;
excitement += (var_10E_unk_3 * 63421) >> 16;
int excitement = (no_3_plus_turns * 0x28000) >> 16;
excitement += no_2_turns * 3;
excitement += (no_1_turns * 63421) >> 16;
int intensity = (var_10E_unk_1 * 81920) >> 16;
intensity += (var_10E_unk_2 * 49152) >> 16;
intensity += (var_10E_unk_3 * 21140) >> 16;
int intensity = (no_3_plus_turns * 81920) >> 16;
intensity += (no_2_turns * 49152) >> 16;
intensity += (no_1_turns * 21140) >> 16;
int nausea = (var_10E_unk_1 * 0x50000) >> 16;
nausea += (var_10E_unk_2 * 0x32000) >> 16;
nausea += (var_10E_unk_3 * 42281) >> 16;
int nausea = no_3_plus_turns * 5;
nausea += (no_2_turns * 0x3200) >> 16;
nausea += (no_1_turns * 42281) >> 16;
rating_tuple rating = { excitement, intensity, nausea };
return rating;
@ -954,22 +954,22 @@ static rating_tuple get_var_10E_rating(rct_ride* ride) {
/**
* rct2: 0x0065DF72
*/
static rating_tuple get_var_110_rating(rct_ride* ride) {
int var_110_unk_1 = get_var_110_unk_1(ride);
int var_110_unk_2 = get_var_110_unk_2(ride);
int var_110_unk_3 = get_var_110_unk_3(ride);
static rating_tuple get_banked_turns_rating(rct_ride* ride) {
int no_3_plus_turns = get_turn_count_3_elements(ride, 1);
int no_2_turns = get_turn_count_2_elements(ride, 1);
int no_1_turns = get_turn_count_1_element(ride, 1);
int excitement = (var_110_unk_1 * 0x3C000) >> 16;
excitement += (var_110_unk_2 * 0x3C000) >> 16;
excitement += (var_110_unk_3 * 73992) >> 16;
int excitement = (no_3_plus_turns * 0x3c000) >> 16;
excitement += (no_2_turns * 0x3c000) >> 16;
excitement += (no_1_turns * 73992) >> 16;
int intensity = (var_110_unk_1 * 0x14000) >> 16;
intensity += (var_110_unk_2 * 49152) >> 16;
intensity += (var_110_unk_3 * 21140) >> 16;
int intensity = (no_3_plus_turns * 0x14000) >> 16;
intensity += (no_2_turns * 49152) >> 16;
intensity += (no_1_turns * 21140) >> 16;
int nausea = (var_110_unk_1 * 0x50000) >> 16;
nausea += (var_110_unk_2 * 0x32000) >> 16;
nausea += (var_110_unk_3 * 48623) >> 16;
int nausea = no_3_plus_turns * 5;
nausea += (no_2_turns * 0x32000) >> 16;
nausea += (no_1_turns * 48623) >> 16;
rating_tuple rating = { excitement, intensity, nausea };
return rating;
@ -978,27 +978,26 @@ static rating_tuple get_var_110_rating(rct_ride* ride) {
/**
* rct2: 0x0065E047
*/
static rating_tuple get_var_112_rating(rct_ride *ride) {
static rating_tuple get_sloped_turns_rating(rct_ride* ride) {
int no_4_plus_turns = get_turn_count_4_plus_elements(ride, 2);
int no_3_turns = get_turn_count_3_elements(ride, 2);
int no_2_turns = get_turn_count_2_elements(ride, 2);
int no_1_turns = get_turn_count_1_element(ride, 2);
int al;
al = get_var_112_unk_1(ride);
al = min(al, 4);
al = min(no_4_plus_turns, 4);
int excitement = (al * 0x78000) >> 16;
al = get_var_112_unk_1(ride);
al = min(al, 8);
al = min(no_4_plus_turns, 8);
int nausea = (al * 0x78000) >> 16;
al = get_var_112_unk_2(ride);
al = min(al, 6);
al = min(no_3_turns, 6);
excitement += (al * 273066) >> 16;
al = get_var_112_unk_3(ride);
al = min(al, 6);
excitement += (al * 0x3AAAA) >> 16;
al = min(no_2_turns, 6);
excitement += (al * 0x3aaaa) >> 16;
al = get_var_112_unk_4(ride);
al = min(al, 7);
al = min(no_1_turns, 7);
excitement += (al * 187245) >> 16;
rating_tuple rating = { excitement, 0, nausea };
@ -1078,17 +1077,17 @@ static rating_tuple sub_65DDD1(rct_ride *ride)
intensity += special_track_element_rating.intensity;
nausea += special_track_element_rating.nausea;
rating_tuple var_10E_rating = get_var_10E_rating(ride);
rating_tuple var_10E_rating = get_flat_turns_rating(ride);
excitement += var_10E_rating.excitement;
intensity += var_10E_rating.intensity;
nausea += var_10E_rating.nausea;
rating_tuple var_110_rating = get_var_110_rating(ride);
rating_tuple var_110_rating = get_banked_turns_rating(ride);
excitement += var_110_rating.excitement;
intensity += var_110_rating.intensity;
nausea += var_110_rating.nausea;
rating_tuple var_112_rating = get_var_112_rating(ride);
rating_tuple var_112_rating = get_sloped_turns_rating(ride);
excitement += var_112_rating.excitement;
intensity += var_112_rating.intensity;
nausea += var_112_rating.nausea;

View File

@ -553,15 +553,15 @@ static void vehicle_update_measurements(rct_vehicle *vehicle)
uint16 track_elem_type = vehicle->track_type / 4;
if (track_elem_type == TRACK_ELEM_POWERED_LIFT || !(vehicle->var_48 & (1 << 0))){
if (!(ride->var_108 & (1 << 6))){
ride->var_108 |= (1 << 6);
if (!(ride->testing_flags & RIDE_TESTING_POWERED_LIFT)){
ride->testing_flags |= RIDE_TESTING_POWERED_LIFT;
if (ride->drops + 64 < 0xFF){
ride->drops += 64;
}
}
}
else{
ride->var_108 &= ~(1 << 6);
ride->testing_flags &= ~RIDE_TESTING_POWERED_LIFT;
}
if (ride->type == RIDE_TYPE_WATER_COASTER){
@ -592,92 +592,77 @@ static void vehicle_update_measurements(rct_vehicle *vehicle)
// ax
uint16 track_flags = RCT2_ADDRESS(0x0099423C, uint16)[track_elem_type];
uint32 var_108 = ride->var_108;
if (var_108 & (1 << 1) && track_flags & TRACK_ELEM_FLAG_TURN_LEFT){
ride->var_10E += 0x800;
uint32 testing_flags = ride->testing_flags;
if (testing_flags & RIDE_TESTING_TURN_LEFT &&
track_flags & TRACK_ELEM_FLAG_TURN_LEFT){
// 0x800 as this is masked to CURRENT_TURN_COUNT_MASK
ride->turn_count_default += 0x800;
}
else if (var_108 & (1 << 2) && track_flags & TRACK_ELEM_FLAG_TURN_RIGHT){
ride->var_10E += 0x800;
else if (testing_flags & RIDE_TESTING_TURN_RIGHT &&
track_flags & TRACK_ELEM_FLAG_TURN_RIGHT){
// 0x800 as this is masked to CURRENT_TURN_COUNT_MASK
ride->turn_count_default += 0x800;
}
else if (var_108 & (1 << 2) || var_108 & (1 << 1)){
ride->var_108 &= ~(0x6);
ride->var_108 &= ~(0x18);
else if (testing_flags & RIDE_TESTING_TURN_RIGHT ||
testing_flags & RIDE_TESTING_TURN_LEFT){
uint16* ebp = &ride->var_110;
if (!(var_108 & (1 << 3))){
ebp = &ride->var_112;
if (!(var_108 & (1 << 4))){
ebp = &ride->var_10E;
ride->testing_flags &= ~(
RIDE_TESTING_TURN_LEFT |
RIDE_TESTING_TURN_RIGHT |
RIDE_TESTING_TURN_BANKED |
RIDE_TESTING_TURN_SLOPED);
uint8 turn_type = 1;
if (!(testing_flags & RIDE_TESTING_TURN_BANKED)){
turn_type = 2;
if (!(testing_flags & RIDE_TESTING_TURN_SLOPED)){
turn_type = 0;
}
}
uint16 bx;
switch (ride->var_10E >> 11){
switch (ride->turn_count_default >> 11){
case 0:
bx = *ebp & 0x1F;
if (bx != 0x1F){
bx++;
}
*ebp &= 0xFFE0;
*ebp |= bx;
increment_turn_count_1_element(ride, turn_type);
break;
case 1:
bx = *ebp & 0xE0;
if (bx != 0xE0){
bx += 0x20;
}
*ebp &= 0xFF1F;
*ebp |= bx;
increment_turn_count_2_elements(ride, turn_type);
break;
default:
if (var_108&(1 << 4)){
bx = *ebp & 0xF800;
if (bx != 0xF800){
bx += 0x800;
}
*ebp &= 0x7FF;
*ebp |= bx;
break;
}
// fall through to case 2
case 2:
bx = *ebp & 0x700;
if (bx != 0x700){
bx += 0x100;
}
*ebp &= 0xF8FF;
*ebp |= bx;
increment_turn_count_3_elements(ride, turn_type);
break;
default:
increment_turn_count_4_plus_elements(ride, turn_type);
break;
}
}
else {
if (track_flags & TRACK_ELEM_FLAG_TURN_LEFT){
ride->var_108 |= (1 << 1);
ride->var_10E &= 0x7FF;
ride->testing_flags |= RIDE_TESTING_TURN_LEFT;
ride->turn_count_default &= ~CURRENT_TURN_COUNT_MASK;
if (track_flags & TRACK_ELEM_FLAG_TURN_BANKED){
ride->var_108 |= (1 << 3);
ride->testing_flags |= RIDE_TESTING_TURN_BANKED;
}
if (track_flags & TRACK_ELEM_FLAG_TURN_SLOPED){
ride->var_108 |= (1 << 4);
ride->testing_flags |= RIDE_TESTING_TURN_SLOPED;
}
}
if (track_flags & TRACK_ELEM_FLAG_TURN_RIGHT){
ride->var_108 |= (1 << 2);
ride->var_10E &= 0x7FF;
ride->testing_flags |= RIDE_TESTING_TURN_RIGHT;
ride->turn_count_default &= ~CURRENT_TURN_COUNT_MASK;
if (track_flags & TRACK_ELEM_FLAG_TURN_BANKED){
ride->var_108 |= (1 << 3);
ride->testing_flags |= RIDE_TESTING_TURN_BANKED;
}
if (track_flags & TRACK_ELEM_FLAG_TURN_SLOPED){
ride->var_108 |= (1 << 4);
ride->testing_flags |= RIDE_TESTING_TURN_SLOPED;
}
}
}
if (var_108 & (1 << 5)){
if (testing_flags & RIDE_TESTING_DROP_DOWN){
if (vehicle->velocity < 0 || !(track_flags & TRACK_ELEM_FLAG_DOWN)){
ride->var_108 &= ~(1 << 5);
ride->testing_flags &= ~RIDE_TESTING_DROP_DOWN;
sint16 z = vehicle->z / 8 - ride->start_drop_height;
if (z < 0){
@ -689,8 +674,8 @@ static void vehicle_update_measurements(rct_vehicle *vehicle)
}
}
else if (track_flags & TRACK_ELEM_FLAG_DOWN && vehicle->velocity >= 0){
ride->var_108 &= ~(1 << 7);
ride->var_108 |= (1 << 5);
ride->testing_flags &= ~RIDE_TESTING_DROP_UP;
ride->testing_flags |= RIDE_TESTING_DROP_DOWN;
uint8 drops = ride->drops & 0x3F;
if (drops != 0x3F)
@ -699,12 +684,12 @@ static void vehicle_update_measurements(rct_vehicle *vehicle)
ride->drops |= drops;
ride->start_drop_height = vehicle->z / 8;
var_108 &= ~(1 << 7);
testing_flags &= ~RIDE_TESTING_DROP_UP;
}
if (var_108 & (1 << 7)){
if (testing_flags & RIDE_TESTING_DROP_UP){
if (vehicle->velocity > 0 || !(track_flags & TRACK_ELEM_FLAG_UP)){
ride->var_108 &= ~(1 << 7);
ride->testing_flags &= ~RIDE_TESTING_DROP_UP;
sint16 z = vehicle->z / 8 - ride->start_drop_height;
if (z < 0){
@ -716,8 +701,8 @@ static void vehicle_update_measurements(rct_vehicle *vehicle)
}
}
else if (track_flags & TRACK_ELEM_FLAG_UP && vehicle->velocity <= 0){
ride->var_108 &= ~(1 << 5);
ride->var_108 |= (1 << 7);
ride->testing_flags &= ~RIDE_TESTING_DROP_DOWN;
ride->testing_flags |= RIDE_TESTING_DROP_UP;
uint8 drops = ride->drops & 0x3F;
if (drops != 0x3F)
@ -726,7 +711,7 @@ static void vehicle_update_measurements(rct_vehicle *vehicle)
ride->drops |= drops;
ride->start_drop_height = vehicle->z / 8;
var_108 &= ~(1 << 7);
testing_flags &= ~RIDE_TESTING_DROP_UP;
}
if (track_flags & TRACK_ELEM_FLAG_INVERSION){
@ -757,7 +742,7 @@ static void vehicle_update_measurements(rct_vehicle *vehicle)
y = vehicle->y;
if (x == SPRITE_LOCATION_NULL){
ride->var_108 &= (1 << 0);
ride->testing_flags &= RIDE_TESTING_FLAG_0;
return;
}
@ -766,7 +751,7 @@ static void vehicle_update_measurements(rct_vehicle *vehicle)
for (;; map_element++){
if (map_element_is_last_for_tile(map_element)){
ride->var_108 &= (1 << 0);
ride->testing_flags &= RIDE_TESTING_FLAG_0;
return;
}
@ -785,8 +770,8 @@ static void vehicle_update_measurements(rct_vehicle *vehicle)
}
}
if (!(ride->var_108 & (1 << 0))){
ride->var_108 |= (1 << 0);
if (!(ride->testing_flags & RIDE_TESTING_FLAG_0)){
ride->testing_flags |= RIDE_TESTING_FLAG_0;
uint8 num_sheltered_sections = ride->num_sheltered_sections & 0x1F;
if (num_sheltered_sections != 0x1F)