mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
Check against invalid tiles correctly
This commit is contained in:
@@ -1482,7 +1482,7 @@ int sound_play_panned(int sound_id, int ebx, sint16 x, sint16 y, sint16 z)
|
||||
}
|
||||
other_sound->id = sound_id;
|
||||
int pan;
|
||||
if (ebx == 0x8000) {
|
||||
if (ebx == (sint16)0x8000) {
|
||||
pan = 0;
|
||||
} else {
|
||||
int x2 = ebx << 16;
|
||||
|
||||
@@ -1652,7 +1652,7 @@ void sub_688972(int screenX, int screenY, sint16 *x, sint16 *y, rct_viewport **v
|
||||
void screen_pos_to_map_pos(sint16 *x, sint16 *y, int *direction)
|
||||
{
|
||||
sub_688972(*x, *y, x, y, NULL);
|
||||
if (*x == 0x8000)
|
||||
if (*x == (sint16)0x8000)
|
||||
return;
|
||||
|
||||
int my_direction;
|
||||
|
||||
@@ -548,7 +548,7 @@ static rct_peep *viewport_interaction_get_closest_peep(int x, int y, int maxDist
|
||||
closestPeep = NULL;
|
||||
closestDistance = 0xFFFF;
|
||||
FOR_ALL_PEEPS(spriteIndex, peep) {
|
||||
if (peep->sprite_left == 0x8000)
|
||||
if (peep->sprite_left == (sint16)0x8000)
|
||||
continue;
|
||||
|
||||
distance =
|
||||
|
||||
@@ -667,7 +667,7 @@ void peep_update_falling(rct_peep* peep){
|
||||
if (peep->item_standard_flags & PEEP_ITEM_BALLOON){
|
||||
peep->item_standard_flags &= ~PEEP_ITEM_BALLOON;
|
||||
|
||||
if (peep->sprite_type == 19 && peep->x != 0x8000){
|
||||
if (peep->sprite_type == 19 && peep->x != (sint16)0x8000){
|
||||
create_balloon(peep->x, peep->y, height, peep->balloon_colour, 0);
|
||||
peep->var_45 |= (1 << 3);
|
||||
peep_update_sprite_type(peep);
|
||||
@@ -4619,7 +4619,7 @@ void peep_applause()
|
||||
// Release balloon
|
||||
if (peep->item_standard_flags & PEEP_ITEM_BALLOON) {
|
||||
peep->item_standard_flags &= ~PEEP_ITEM_BALLOON;
|
||||
if (peep->x != 0x8000) {
|
||||
if (peep->x != (sint16)0x8000) {
|
||||
create_balloon(peep->x, peep->y, peep->z + 9, peep->balloon_colour, 0);
|
||||
peep->var_45 |= 8;
|
||||
peep_update_sprite_type(peep);
|
||||
|
||||
@@ -500,7 +500,7 @@ static void sub_666DFD()
|
||||
|
||||
x = RCT2_GLOBAL(0x013573EA, uint16);
|
||||
y = RCT2_GLOBAL(0x013573EC, uint16);
|
||||
if (x == 0x8000)
|
||||
if (x == (sint16)0x8000)
|
||||
return;
|
||||
|
||||
x /= 32;
|
||||
|
||||
@@ -37,7 +37,7 @@ void vehicle_update_sound_params(rct_vehicle* vehicle)
|
||||
{
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_DESIGNER) || RCT2_GLOBAL(0x0141F570, uint8) == 6)) {
|
||||
if (vehicle->sound1_id != (uint8)-1 || vehicle->sound2_id != (uint8)-1) {
|
||||
if (vehicle->sprite_left != 0x8000) {
|
||||
if (vehicle->sprite_left != (sint16)0x8000) {
|
||||
RCT2_GLOBAL(0x009AF5A0, sint16) = vehicle->sprite_left;
|
||||
RCT2_GLOBAL(0x009AF5A2, sint16) = vehicle->sprite_top;
|
||||
RCT2_GLOBAL(0x009AF5A4, sint16) = vehicle->sprite_right;
|
||||
@@ -116,7 +116,7 @@ void vehicle_update_sound_params(rct_vehicle* vehicle)
|
||||
i->frequency = (uint16)v19;
|
||||
i->id = vehicle->sprite_index;
|
||||
i->volume = 0;
|
||||
if (vehicle->x != 0x8000) {
|
||||
if (vehicle->x != (sint16)0x8000) {
|
||||
int tile_idx = (((vehicle->y & 0xFFE0) * 256) + (vehicle->x & 0xFFE0)) / 32;
|
||||
rct_map_element* map_element;
|
||||
for (map_element = RCT2_ADDRESS(RCT2_ADDRESS_TILE_MAP_ELEMENT_POINTERS, rct_map_element*)[tile_idx]; map_element->type & MAP_ELEMENT_TYPE_MASK; map_element++);
|
||||
|
||||
@@ -836,7 +836,7 @@ static void window_cheats_misc_tool_update()
|
||||
|
||||
int map_x, map_y;
|
||||
footpath_get_coordinates_from_pos(x, y + 16, &map_x, &map_y, NULL, NULL);
|
||||
if (map_x != 0x8000){
|
||||
if (map_x != (sint16)0x8000){
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) |= 1;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_TYPE, uint16) = 4;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, uint16) = map_x;
|
||||
@@ -862,7 +862,7 @@ static void window_cheats_misc_tool_down()
|
||||
int dest_x, dest_y;
|
||||
footpath_get_coordinates_from_pos(x, y + 16, &dest_x, &dest_y, NULL, NULL);
|
||||
|
||||
if (dest_x == 0x8000)return;
|
||||
if (dest_x == (sint16)0x8000)return;
|
||||
|
||||
// Set the coordinate of destination to be exactly
|
||||
// in the middle of a tile.
|
||||
|
||||
@@ -719,7 +719,7 @@ static void window_footpath_set_selection_start_bridge_at_point(int screenX, int
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= ~(1 << 0) & ~(1 << 2);
|
||||
|
||||
footpath_bridge_get_info_from_pos(screenX, screenY, &x, &y, &direction, &mapElement);
|
||||
if (x == 0x8000)
|
||||
if (x == (sint16)0x8000)
|
||||
return;
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) |= (1 << 0) | (1 << 2);
|
||||
@@ -801,7 +801,7 @@ static void window_footpath_start_bridge_at_point(int screenX, int screenY)
|
||||
rct_map_element *mapElement;
|
||||
|
||||
footpath_bridge_get_info_from_pos(screenX, screenY, &x, &y, &direction, &mapElement);
|
||||
if (x == 0x8000)
|
||||
if (x == (sint16)0x8000)
|
||||
return;
|
||||
|
||||
if (map_element_get_type(mapElement) == MAP_ELEMENT_TYPE_SURFACE) {
|
||||
|
||||
@@ -1149,7 +1149,7 @@ void window_guest_overview_tool_update(){
|
||||
|
||||
int map_x, map_y;
|
||||
footpath_get_coordinates_from_pos(x, y + 16, &map_x, &map_y, NULL, NULL);
|
||||
if (map_x != 0x8000){
|
||||
if (map_x != (sint16)0x8000){
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) |= 1;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_TYPE, uint16) = 4;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, uint16) = map_x;
|
||||
@@ -1199,7 +1199,7 @@ void window_guest_overview_tool_down(){
|
||||
rct_map_element *mapElement;
|
||||
footpath_get_coordinates_from_pos(x, y + 16, &dest_x, &dest_y, NULL, &mapElement);
|
||||
|
||||
if (dest_x == 0x8000)return;
|
||||
if (dest_x == (sint16)0x8000)return;
|
||||
|
||||
// Set the coordinate of destination to be exactly
|
||||
// in the middle of a tile.
|
||||
@@ -1263,7 +1263,7 @@ void window_guest_overview_tool_abort(){
|
||||
sprite_move( w->var_48C, peep->y, peep->z + 8, (rct_sprite*)peep);
|
||||
invalidate_sprite((rct_sprite*)peep);
|
||||
|
||||
if (peep->x != 0x8000){
|
||||
if (peep->x != (sint16)0x8000){
|
||||
peep_decrement_num_riders(peep);
|
||||
peep->state = 0;
|
||||
peep_window_state_update(peep);
|
||||
|
||||
@@ -1123,7 +1123,7 @@ void window_staff_overview_tool_down(){
|
||||
rct_map_element *mapElement;
|
||||
footpath_get_coordinates_from_pos(x, y + 16, &dest_x, &dest_y, NULL, &mapElement);
|
||||
|
||||
if (dest_x == 0x8000)return;
|
||||
if (dest_x == (sint16)0x8000)return;
|
||||
|
||||
// Set the coordinate of destination to be exactly
|
||||
// in the middle of a tile.
|
||||
@@ -1172,7 +1172,7 @@ void window_staff_overview_tool_down(){
|
||||
int dest_x, dest_y;
|
||||
footpath_get_coordinates_from_pos(x, y, &dest_x, &dest_y, NULL, NULL);
|
||||
|
||||
if (dest_x == 0x8000)return;
|
||||
if (dest_x == (sint16)0x8000)return;
|
||||
|
||||
game_do_command(dest_x, 1, dest_y, w->number, GAME_COMMAND_SET_STAFF_PATROL, 0, 0);
|
||||
}
|
||||
|
||||
@@ -808,14 +808,14 @@ void sprite_misc_update_all()
|
||||
*/
|
||||
void sprite_move(int x, int y, int z, rct_sprite* sprite){
|
||||
int new_position = x;
|
||||
if ((uint16)x == 0x8000)new_position = 0x10000;
|
||||
if (x == (sint16)0x8000)new_position = 0x10000;
|
||||
else{
|
||||
new_position &= 0x1FE0;
|
||||
new_position = (y >> 5) | (new_position << 3);
|
||||
}
|
||||
|
||||
int current_position = sprite->unknown.x;
|
||||
if ((uint16)sprite->unknown.x == 0x8000)current_position = 0x10000;
|
||||
if (sprite->unknown.x == (sint16)0x8000)current_position = 0x10000;
|
||||
else{
|
||||
current_position &= 0x1FE0;
|
||||
current_position = (sprite->unknown.y >> 5) | (current_position << 3);
|
||||
@@ -835,7 +835,7 @@ void sprite_move(int x, int y, int z, rct_sprite* sprite){
|
||||
sprite->unknown.next_in_quadrant = temp_sprite_idx;
|
||||
}
|
||||
|
||||
if (x == 0x8000){
|
||||
if (x == (sint16)0x8000){
|
||||
sprite->unknown.sprite_left = 0x8000;
|
||||
sprite->unknown.x = x;
|
||||
sprite->unknown.y = y;
|
||||
|
||||
Reference in New Issue
Block a user