diff --git a/src/hook.c b/src/hook.c index 1f8da14bf6..c0b9e16b72 100644 --- a/src/hook.c +++ b/src/hook.c @@ -79,7 +79,7 @@ void hookfunc(int address, int newaddress, int stacksize, int registerargs[], in data[i++] = 0x89; //mov eax, esp data[i++] = 0xE0; data[i++] = 0x83; //sub eax, (0xC + numargs*4) & 0xF - data[i++] = 0xE8; + data[i++] = 0xE8; data[i++] = (0xC + numrargs * 4) & 0xF; data[i++] = 0x83; //and eax, 0xC data[i++] = 0xE0; @@ -87,7 +87,7 @@ void hookfunc(int address, int newaddress, int stacksize, int registerargs[], in data[i++] = 0xA3; //mov [0x9ABDA8], eax data[i++] = 0xA8; data[i++] = 0xBD; - data[i++] = 0x9A; + data[i++] = 0x9A; data[i++] = 0x00; data[i++] = 0x58; //pop eax data[i++] = 0x2B; //sub esp, [0x9ABDA8] @@ -230,4 +230,4 @@ void addhook(int address, int newaddress, int stacksize, int registerargs[], int #endif // _WIN32 hookfunc(hookaddress, newaddress, stacksize, registerargs, registersreturned, eaxDestinationRegister); g_hooktableoffset++; -} \ No newline at end of file +} diff --git a/src/openrct2.c b/src/openrct2.c index 6f5ca0f1fc..eb41a4457f 100644 --- a/src/openrct2.c +++ b/src/openrct2.c @@ -595,4 +595,4 @@ FILE **__iob_func() streams[2] = stderr; return streams; } -#endif \ No newline at end of file +#endif diff --git a/src/peep/peep.c b/src/peep/peep.c index 9fdc1a01b6..3828a234d0 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -1726,7 +1726,7 @@ static void peep_update_ride_sub_state_0(rct_peep* peep){ } else{ chosen_train = ride->train_at_station[peep->current_ride_station]; - } + } if (chosen_train == 0xFF){ return; } diff --git a/src/ride/cable_lift.h b/src/ride/cable_lift.h index 46f65d035c..95b32757c4 100644 --- a/src/ride/cable_lift.h +++ b/src/ride/cable_lift.h @@ -8,4 +8,4 @@ rct_vehicle *cable_lift_segment_create(int rideIndex, int x, int y, int z, int d void cable_lift_update(rct_vehicle *vehicle); int cable_lift_update_track_motion(rct_vehicle *cableLift); -#endif \ No newline at end of file +#endif diff --git a/src/ride/ride.c b/src/ride/ride.c index d8bc04a53a..0fe59765e6 100644 --- a/src/ride/ride.c +++ b/src/ride/ride.c @@ -6027,7 +6027,7 @@ int get_turn_count_3_elements(rct_ride* ride, uint8 type) { break; case 1: turn_count = &ride->turn_count_banked; - break; + break; case 2: turn_count = &ride->turn_count_sloped; break; @@ -6044,7 +6044,7 @@ int get_turn_count_4_plus_elements(rct_ride* ride, uint8 type) { case 0: case 1: return 0; - case 2: + case 2: turn_count = &ride->turn_count_sloped; break; default: diff --git a/src/ride/ride.h b/src/ride/ride.h index 2626e38108..7239791272 100644 --- a/src/ride/ride.h +++ b/src/ride/ride.h @@ -82,13 +82,13 @@ typedef struct { uint8 ride_type[3]; // 0x00C uint8 min_cars_in_train; // 0x00F uint8 max_cars_in_train; // 0x010 - uint8 cars_per_flat_ride; // 0x011 + uint8 cars_per_flat_ride; // 0x011 // Number of cars that can't hold passengers - uint8 zero_cars; // 0x012 + uint8 zero_cars; // 0x012 // The index to the vehicle type displayed in // the vehicle tab. uint8 tab_vehicle; // 0x013 - uint8 default_vehicle; // 0x014 + uint8 default_vehicle; // 0x014 // Convert from first - fourth vehicle to // vehicle structure uint8 front_vehicle; // 0x015 @@ -200,7 +200,7 @@ typedef struct { uint16 var_10C; // Next 3 variables are related (XXXX XYYY ZZZa aaaa) uint16 turn_count_default; // 0x10E X = current turn count - uint16 turn_count_banked; // 0x110 + uint16 turn_count_banked; // 0x110 uint16 turn_count_sloped; // 0x112 X = number turns > 3 elements union { uint8 inversions; // 0x114 (???X XXXX) @@ -410,8 +410,8 @@ enum { RIDE_ENTRY_FLAG_16 = 1 << 16, // 0x10000 RIDE_ENTRY_DISABLE_FIRST_TWO_OPERATING_MODES = 1 << 17, // 0x20000 RIDE_ENTRY_FLAG_18 = 1 << 18, // 0x40000 - RIDE_ENTRY_FLAG_19 = 1 << 19, // 0x80000 - // Must be set with swing mode 1 as well. + RIDE_ENTRY_FLAG_19 = 1 << 19, // 0x80000 + // Must be set with swing mode 1 as well. RIDE_ENTRY_FLAG_ALTERNATIVE_SWING_MODE_2 = 1 << 20, // 0x100000 RIDE_ENTRY_FLAG_21 = 1 << 21, // 0x200000 RIDE_ENTRY_FLAG_22 = 1 << 22, // 0x400000 diff --git a/src/ride/ride_data.c b/src/ride/ride_data.c index 0937db17e1..2a20c03721 100644 --- a/src/ride/ride_data.c +++ b/src/ride/ride_data.c @@ -1316,7 +1316,7 @@ const uint16 RideCrookedHouseLength[1] = { }; /* rct2: 0x0097D7C8, 0x0097D7C9, 0x0097D7CA */ -const rct_ride_lift_data RideLiftData[] = { +const rct_ride_lift_data RideLiftData[] = { { SOUND_LIFT_3, 7, 7 }, // Spiral Roller coaster { SOUND_LIFT_1, 4, 6 }, // Stand Up Coaster { SOUND_LIFT_1, 4, 6 }, // Suspended Swinging @@ -1408,4 +1408,4 @@ const rct_ride_lift_data RideLiftData[] = { { 255, 5, 5 }, // Mine Ride { SOUND_LIFT_6, 4, 6 }, // (none) { 255, 4, 6 } // LIM Launched Roller Coaster -}; \ No newline at end of file +}; diff --git a/src/ride/ride_ratings.c b/src/ride/ride_ratings.c index 5389fc0b1d..a2262d6549 100644 --- a/src/ride/ride_ratings.c +++ b/src/ride/ride_ratings.c @@ -981,7 +981,7 @@ static rating_tuple get_banked_turns_rating(rct_ride* ride) { */ static rating_tuple get_sloped_turns_rating(rct_ride* ride) { rating_tuple rating; - + 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); diff --git a/src/ride/track_paint.c b/src/ride/track_paint.c index f294444c95..9585a0c7f9 100644 --- a/src/ride/track_paint.c +++ b/src/ride/track_paint.c @@ -82,7 +82,7 @@ static rct_xy16 loc_7667AC[] = { /** * - * rct2: 0x0142811C + * rct2: 0x0142811C * Can be calculated as Rounddown(34*sin(x)+0.5) * where x is in 7.5 deg segments. */ @@ -1028,7 +1028,7 @@ static void shop_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 directi RCT2_GLOBAL(0x009DEA52, uint16) = 2; RCT2_GLOBAL(0x009DEA54, uint16) = 2; RCT2_GLOBAL(0x009DEA56, sint16) = height16; - sub_98199C(0, 45, imageId, 0, height, 28, 28, rotation); + sub_98199C(0, 45, imageId, 0, height, 28, 28, rotation); } else { RCT2_GLOBAL(0x009DEA52, uint16) = 2; RCT2_GLOBAL(0x009DEA54, uint16) = 2; @@ -1099,7 +1099,7 @@ static void facility_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 dir RCT2_GLOBAL(0x009DEA52, uint16) = direction == 3 ? 28 : 2; RCT2_GLOBAL(0x009DEA54, uint16) = direction == 0 ? 28 : 2; RCT2_GLOBAL(0x009DEA56, sint16) = height16; - sub_98199C(0, 29, imageId, 0, height, lengthY, lengthX, rotation); + sub_98199C(0, 29, imageId, 0, height, lengthY, lengthX, rotation); } else { // Door image or base RCT2_GLOBAL(0x009DEA52, uint16) = direction == 3 ? 28 : 2; diff --git a/src/ride/vehicle.c b/src/ride/vehicle.c index b378724515..5e18be5c29 100644 --- a/src/ride/vehicle.c +++ b/src/ride/vehicle.c @@ -6426,37 +6426,37 @@ static bool vehicle_update_motion_collision_detection( rct_vehicle *vehicle, sint16 x, sint16 y, sint16 z, uint16* otherVehicleIndex ) { if (vehicle->update_flags & VEHICLE_UPDATE_FLAG_1) return false; - + rct_ride_type_vehicle *vehicleEntry = vehicle_get_vehicle_entry(vehicle); - + if (!(vehicleEntry->flags_b & VEHICLE_ENTRY_FLAG_B_6)){ vehicle->var_C4 = 0; rct_vehicle* collideVehicle = GET_VEHICLE(*otherVehicleIndex); - + if (vehicle == collideVehicle) return false; - + sint32 x_diff = abs(x - collideVehicle->x); if (x_diff > 0x7FFF) return false; - + sint32 y_diff = abs(y - collideVehicle->y); if (y_diff > 0x7FFF) return false; - + if (x_diff + y_diff > 0xFFFF) return false; - + sint32 z_diff = abs(z - collideVehicle->z); if (x_diff + y_diff + z_diff > 0xFFFF) return false; - + uint16 ecx = min(vehicle->var_44 + collideVehicle->var_44, 560); ecx = ((ecx >> 1) * 30) >> 8; - + if (x_diff + y_diff + z_diff >= ecx) return false; - + uint8 direction = (vehicle->sprite_direction - collideVehicle->sprite_direction + 7) & 0x1F; if (direction >= 0xF) return false; - + return true; } - + uint16 eax = ((x / 32) << 8) + (y / 32); // TODO change to using a better technique uint32* ebp = RCT2_ADDRESS(0x009A37C4, uint32); @@ -6468,53 +6468,53 @@ static bool vehicle_update_motion_collision_detection( for(; collideId != 0xFFFF; collideId = collideVehicle->next_in_quadrant){ collideVehicle = GET_VEHICLE(collideId); if (collideVehicle == vehicle) continue; - + if (collideVehicle->sprite_identifier != SPRITE_IDENTIFIER_VEHICLE) continue; - + sint32 z_diff = abs(collideVehicle->z - z); - + if (z_diff > 16) continue; - + rct_ride_type_vehicle* collideType = vehicle_get_vehicle_entry(collideVehicle); - + if (!(collideType->flags_b & VEHICLE_ENTRY_FLAG_B_6)) continue; - + sint32 x_diff = abs(collideVehicle->x - x); if (x_diff > 0x7FFF) continue; - + sint32 y_diff = abs(collideVehicle->y - y); if (y_diff > 0x7FFF) continue; - + if (x_diff + y_diff > 0xFFFF) continue; - + uint8 cl = min(vehicle->var_CD, collideVehicle->var_CD); uint8 ch = max(vehicle->var_CD, collideVehicle->var_CD); if (cl != ch){ if (cl == 5 && ch == 6) continue; } - + uint32 ecx = vehicle->var_44 + collideVehicle->var_44; ecx = ((ecx >> 1) * 30) >> 8; - + if (x_diff + y_diff >= ecx) continue; - + if (!(collideType->flags_b & VEHICLE_ENTRY_FLAG_B_14)){ mayCollide = true; break; } - + uint8 direction = (vehicle->sprite_direction - collideVehicle->sprite_direction - 6) & 0x1F; - + if (direction < 0x14) continue; - + sint16 next_x_diff = abs(x + RCT2_ADDRESS(0x009A3B04, sint16)[vehicle->sprite_direction*2]-collideVehicle->x); sint16 next_y_diff = abs(y + RCT2_ADDRESS(0x009A3B06, sint16)[vehicle->sprite_direction*2]-collideVehicle->y); - + if (next_x_diff + next_y_diff < x_diff + y_diff){ mayCollide = true; break; } - + } if (mayCollide == true) { break; @@ -6523,12 +6523,12 @@ static bool vehicle_update_motion_collision_detection( // TODO change this eax += *ebp; } - + if (mayCollide == false) { vehicle->var_C4 = 0; return false; } - + vehicle->var_C4++; if (vehicle->var_C4 < 200) { vehicle->update_flags |= VEHICLE_UPDATE_FLAG_6; @@ -6538,7 +6538,7 @@ static bool vehicle_update_motion_collision_detection( } // TODO Is it possible for collideVehicle to be NULL? - + if (vehicle->status == VEHICLE_STATUS_MOVING_TO_END_OF_STATION){ if (vehicle->sprite_direction == 0) { if (vehicle->x <= collideVehicle->x) { @@ -6561,14 +6561,14 @@ static bool vehicle_update_motion_collision_detection( } } } - + if (collideVehicle->status == VEHICLE_STATUS_TRAVELLING_BOAT && vehicle->status != VEHICLE_STATUS_ARRIVING && vehicle->status != VEHICLE_STATUS_TRAVELLING ) { return false; } - + vehicle->update_flags |= VEHICLE_UPDATE_FLAG_6; if (otherVehicleIndex != NULL) *otherVehicleIndex = collideId; diff --git a/src/world/map.c b/src/world/map.c index d32136bdce..4228bc709d 100644 --- a/src/world/map.c +++ b/src/world/map.c @@ -897,7 +897,7 @@ void game_command_remove_large_scenery(int* eax, int* ebx, int* ecx, int* edx, i } *ebx = scenery_entry->large_scenery.removal_price * 10; - if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY || + if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY || calculate_cost == false){ *ebx = 0; } @@ -985,7 +985,7 @@ void game_command_set_scenery_colour(int* eax, int* ebx, int* ecx, int* edx, int // Previously it would do a search for type of bh (set from calling function) instead of just small scenery // Unsure if this was a mistake. rct_map_element* map_element = map_get_small_scenery_element_at(x, y, base_height, scenery_type); - + if (map_element == NULL) { *ebx = 0; return; @@ -1053,7 +1053,7 @@ void game_command_set_fence_colour(int* eax, int* ebx, int* ecx, int* edx, int* rct_scenery_entry* scenery_entry = g_wallSceneryEntries[map_element->properties.fence.type]; map_element->properties.fence.item[1] &= 0xE0; map_element->properties.fence.item[1] |= color1; - map_element->properties.fence.item[1] &= 0x1F; + map_element->properties.fence.item[1] &= 0x1F; map_element->flags &= 0x9F; map_element->properties.fence.item[1] |= (color2 & 0x7) * 32; map_element->flags |= (color2 & 0x18) * 4; @@ -1093,7 +1093,7 @@ void game_command_set_large_scenery_colour(int* eax, int* ebx, int* ecx, int* ed *ebx = 0; return; } - + if((flags & GAME_COMMAND_FLAG_GHOST) && !(map_element->flags & MAP_ELEMENT_FLAG_GHOST)){ *ebx = 0; return; @@ -1134,10 +1134,10 @@ void game_command_set_large_scenery_colour(int* eax, int* ebx, int* ecx, int* ed if(flags & GAME_COMMAND_FLAG_APPLY){ rct_map_element* mapElement = map_get_large_scenery_segment( - currentTile.x, - currentTile.y, - base_height, - map_element_direction, + currentTile.x, + currentTile.y, + base_height, + map_element_direction, i); mapElement->properties.scenerymultiple.colour[0] &= 0xE0; @@ -1567,7 +1567,7 @@ static money32 map_set_land_height(int flags, int x, int y, int height, int styl return MONEY32_UNDEFINED; } } - + //Uncomment to use vanilla code /* registers regs = {0}; @@ -1581,7 +1581,7 @@ static money32 map_set_land_height(int flags, int x, int y, int height, int styl regs.ebp = 0; RCT2_CALLFUNC_Y(0x006639FE, ®s); return regs.ebx; */ - + RCT2_GLOBAL(0x9E2E18, money32) = MONEY(0, 0); if(flags & GAME_COMMAND_FLAG_APPLY) { @@ -1589,10 +1589,10 @@ static money32 map_set_land_height(int flags, int x, int y, int height, int styl map_remove_walls_at(x, y, height * 8 - 16, height * 8 + 32); } RCT2_GLOBAL(0x9E2E18, money32) += MONEY(20, 0); - + //Check for obstructing scenery - rct_map_element *mapElement = map_get_first_element_at(x / 32, y / 32); - do{ + rct_map_element *mapElement = map_get_first_element_at(x / 32, y / 32); + do{ if(map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_SCENERY) continue; if(height > mapElement->clearance_height) @@ -1609,7 +1609,7 @@ static money32 map_set_land_height(int flags, int x, int y, int height, int styl if(flags & GAME_COMMAND_FLAG_APPLY) map_element_remove(mapElement--); }while(!map_element_is_last_for_tile(mapElement++)); - + //Check for ride support limits if(gCheatsDisableSupportLimits==false) { @@ -1653,7 +1653,7 @@ static money32 map_set_land_height(int flags, int x, int y, int height, int styl } } } - + zCorner = height; if(style & 0xF) { @@ -1663,14 +1663,14 @@ static money32 map_set_land_height(int flags, int x, int y, int height, int styl zCorner += 2; } } - + if(map_can_construct_with_clear_at(x, y, height, zCorner, RCT2_ADDRESS(0x663CB9, void), 0xF) == false) return MONEY32_UNDEFINED; - + mapElement = map_get_first_element_at(x / 32, y / 32); - do{ + do{ int elementType = map_element_get_type(mapElement); - + if(elementType == MAP_ELEMENT_TYPE_FENCE) continue; if(elementType == MAP_ELEMENT_TYPE_SCENERY) @@ -1694,7 +1694,7 @@ static money32 map_set_land_height(int flags, int x, int y, int height, int styl return MONEY32_UNDEFINED; } }while(!map_element_is_last_for_tile(mapElement++)); - + if(flags & GAME_COMMAND_FLAG_APPLY) { surfaceElement = map_get_surface_element_at(x / 32, y / 32); @@ -3323,7 +3323,7 @@ void game_command_place_large_scenery(int* eax, int* ebx, int* ecx, int* edx, in } } - + sint16 maxHeight = 0xFFFF; for (rct_large_scenery_tile* tile = scenery_entry->large_scenery.tiles; tile->x_offset != -1; @@ -3335,7 +3335,7 @@ void game_command_place_large_scenery(int* eax, int* ebx, int* ecx, int* edx, in }; rotate_map_coordinates(&curTile.x, &curTile.y, rotation); - + curTile.x += x; curTile.y += y; @@ -3440,8 +3440,8 @@ void game_command_place_large_scenery(int* eax, int* ebx, int* ecx, int* edx, in new_map_element->clearance_height = zHigh; new_map_element->type = MAP_ELEMENT_TYPE_SCENERY_MULTIPLE | rotation; - new_map_element->properties.scenerymultiple.type = - (tile_num << 10) | + new_map_element->properties.scenerymultiple.type = + (tile_num << 10) | entry_index; new_map_element->properties.scenerymultiple.colour[0] = color1; @@ -4894,7 +4894,7 @@ void game_command_set_banner_style(int* eax, int* ebx, int* ecx, int* edx, int* *ebx = MONEY32_UNDEFINED; return; } - + map_element->properties.banner.flags = 0xFF; if (banner->flags & BANNER_FLAG_NO_ENTRY){ map_element->properties.banner.flags &= ~(1 << map_element->properties.banner.position); @@ -4929,7 +4929,7 @@ void game_command_set_banner_style(int* eax, int* ebx, int* ecx, int* edx, int* *ebx = 0; } -void game_command_set_sign_style(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* edi, int* ebp) { +void game_command_set_sign_style(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* edi, int* ebp) { uint8 bannerId = *ecx & 0xFF; rct_banner *banner = &gBanners[bannerId]; int x = banner->x << 5; @@ -4937,9 +4937,9 @@ void game_command_set_sign_style(int* eax, int* ebx, int* ecx, int* edx, int* es uint8 mainColour = (uint8)*edx; uint8 textColour = (uint8)*edi; - + if (*ebp == 0) { // small sign - + rct_map_element* map_element = map_get_first_element_at(x / 32, y / 32); bool fence_found = false; do{