/** * * rct2: 0x006ED9D0 */ sint32 viewport_interaction_get_item_left(sint32 x, sint32 y, viewport_interaction_info *info) { rct_tile_element *tileElement; rct_sprite *sprite; rct_vehicle *vehicle; // No click input for title screen or scenario editor or track manager if (gScreenFlags & (SCREEN_FLAGS_TITLE_DEMO | SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_MANAGER)) return info->type = VIEWPORT_INTERACTION_ITEM_NONE; // if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) && gS6Info.editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) return info->type = VIEWPORT_INTERACTION_ITEM_NONE; LocationXY16 mapCoord = {}; get_map_coordinates_from_pos(x, y, VIEWPORT_INTERACTION_MASK_SPRITE & VIEWPORT_INTERACTION_MASK_RIDE & VIEWPORT_INTERACTION_MASK_PARK, &mapCoord.x, &mapCoord.y, &info->type, &info->tileElement, nullptr); info->x = mapCoord.x; info->y = mapCoord.y; tileElement = info->tileElement; sprite = (rct_sprite*)tileElement; switch (info->type) { case VIEWPORT_INTERACTION_ITEM_SPRITE: switch (sprite->unknown.sprite_identifier) { case SPRITE_IDENTIFIER_VEHICLE: vehicle = &(sprite->vehicle); if (vehicle->ride_subtype != 255) vehicle_set_map_toolbar(vehicle); else info->type = VIEWPORT_INTERACTION_ITEM_NONE; break; case SPRITE_IDENTIFIER_PEEP: peep_set_map_tooltip(&sprite->peep); break; } break; case VIEWPORT_INTERACTION_ITEM_RIDE: ride_set_map_tooltip(tileElement); break; case VIEWPORT_INTERACTION_ITEM_PARK: set_map_tooltip_format_arg(0, rct_string_id, gParkName); set_map_tooltip_format_arg(2, uint32, gParkNameArgs); break; default: info->type = VIEWPORT_INTERACTION_ITEM_NONE; break; } // If nothing is under cursor, find a close by peep if (info->type == VIEWPORT_INTERACTION_ITEM_NONE) { info->peep = viewport_interaction_get_closest_peep(x, y, 32); if (info->peep == nullptr) return VIEWPORT_INTERACTION_ITEM_NONE; info->type = VIEWPORT_INTERACTION_ITEM_SPRITE; info->x = info->peep->x; info->y = info->peep->y; peep_set_map_tooltip(info->peep); } return info->type; }
/** * * rct2: 0x006ED833 */ void process_mouse_over(sint32 x, sint32 y) { rct_window* window; sint32 cursorId; cursorId = CURSOR_ARROW; set_map_tooltip_format_arg(0, rct_string_id, STR_NONE); window = window_find_from_point(x, y); if (window != NULL) { sint32 ebx, edi; rct_window* subWindow; rct_widgetindex widgetId = window_find_widget_from_point(window, x, y); if (widgetId != -1) { switch (window->widgets[widgetId].type){ case WWT_VIEWPORT: if (!(_inputFlags & INPUT_FLAG_TOOL_ACTIVE)) { if (viewport_interaction_left_over(x, y)) { sub_6ED990(CURSOR_HAND_POINT); return; } break; } cursorId = gCurrentToolId; subWindow = window_find_by_number( gCurrentToolWidget.window_classification, gCurrentToolWidget.window_number ); if (subWindow == NULL) break; ebx = 0; edi = cursorId; // Window event WE_UNKNOWN_0E was called here, but no windows actually implemented a handler and // its not known what it was for cursorId = edi; if ((ebx & 0xFF) != 0) { sub_6ED990(cursorId); return; } break; case WWT_FRAME: case WWT_RESIZE: if (!(window->flags & WF_RESIZABLE)) break; if (window->min_width == window->max_width && window->min_height == window->max_height) break; if (x < window->x + window->width - 0x13) break; if (y < window->y + window->height - 0x13) break; cursorId = CURSOR_DIAGONAL_ARROWS; break; case WWT_SCROLL: { sint32 output_scroll_area, scroll_id; sint32 scroll_x, scroll_y; widget_scroll_get_part(window, &window->widgets[widgetId], x, y, &scroll_x, &scroll_y, &output_scroll_area, &scroll_id); cursorId = scroll_id; if (output_scroll_area != SCROLL_PART_VIEW) { cursorId = CURSOR_ARROW; break; } // Same as default but with scroll_x/y cursorId = window_event_cursor_call(window, widgetId, scroll_x, scroll_y); if (cursorId == -1) cursorId = CURSOR_ARROW; break; } default: cursorId = window_event_cursor_call(window, widgetId, x, y); if (cursorId == -1) cursorId = CURSOR_ARROW; break; } } } viewport_interaction_right_over(x, y); sub_6ED990(cursorId); }
/** * * rct2: 0x006EDE88 */ sint32 viewport_interaction_get_item_right(sint32 x, sint32 y, viewport_interaction_info *info) { rct_tile_element *tileElement; rct_scenery_entry *sceneryEntry; rct_banner *banner; Ride *ride; sint32 i, stationIndex; // No click input for title screen or track manager if (gScreenFlags & (SCREEN_FLAGS_TITLE_DEMO | SCREEN_FLAGS_TRACK_MANAGER)) return info->type = VIEWPORT_INTERACTION_ITEM_NONE; // if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) && gS6Info.editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) return info->type = VIEWPORT_INTERACTION_ITEM_NONE; LocationXY16 mapCoord = {}; get_map_coordinates_from_pos(x, y, ~(VIEWPORT_INTERACTION_MASK_TERRAIN & VIEWPORT_INTERACTION_MASK_WATER), &mapCoord.x, &mapCoord.y, &info->type, &info->tileElement, nullptr); info->x = mapCoord.x; info->y = mapCoord.y; tileElement = info->tileElement; switch (info->type) { case VIEWPORT_INTERACTION_ITEM_SPRITE: if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || tileElement->type != 0) return info->type = VIEWPORT_INTERACTION_ITEM_NONE; tileElement += 6; ride = get_ride(tileElement->type); if (ride->status == RIDE_STATUS_CLOSED) { set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_MODIFY); set_map_tooltip_format_arg(2, rct_string_id, ride->name); set_map_tooltip_format_arg(4, uint32, ride->name_arguments); } return info->type; case VIEWPORT_INTERACTION_ITEM_RIDE: if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) return info->type = VIEWPORT_INTERACTION_ITEM_NONE; if (tileElement->GetType() == TILE_ELEMENT_TYPE_PATH) return info->type = VIEWPORT_INTERACTION_ITEM_NONE; ride = get_ride(tile_element_get_ride_index(tileElement)); if (ride->status != RIDE_STATUS_CLOSED) return info->type; set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_MODIFY); if (tileElement->GetType() == TILE_ELEMENT_TYPE_ENTRANCE) { rct_string_id stringId; if (tileElement->properties.entrance.type == ENTRANCE_TYPE_RIDE_ENTRANCE) { if (ride->num_stations > 1) { stringId = STR_RIDE_STATION_X_ENTRANCE; } else { stringId = STR_RIDE_ENTRANCE; } } else { if (ride->num_stations > 1) { stringId = STR_RIDE_STATION_X_EXIT; } else { stringId = STR_RIDE_EXIT; } } set_map_tooltip_format_arg(2, rct_string_id, stringId); } else if (track_element_is_station(tileElement)) { rct_string_id stringId; if (ride->num_stations > 1) { stringId = STR_RIDE_STATION_X; } else { stringId = STR_RIDE_STATION; } set_map_tooltip_format_arg(2, rct_string_id, stringId); } else { if (!gCheatsSandboxMode && !map_is_location_owned(info->x, info->y, tileElement->base_height << 4)) { return info->type = VIEWPORT_INTERACTION_ITEM_NONE; } set_map_tooltip_format_arg(2, rct_string_id, ride->name); set_map_tooltip_format_arg(4, uint32, ride->name_arguments); return info->type; } set_map_tooltip_format_arg(4, rct_string_id, ride->name); set_map_tooltip_format_arg(6, uint32, ride->name_arguments); set_map_tooltip_format_arg(10, rct_string_id, RideComponentNames[RideNameConvention[ride->type].station].capitalised); stationIndex = tile_element_get_station(tileElement); for (i = stationIndex; i >= 0; i--) if (ride->station_starts[i].xy == RCT_XY8_UNDEFINED) stationIndex--; stationIndex++; set_map_tooltip_format_arg(12, uint16, stationIndex); return info->type; case VIEWPORT_INTERACTION_ITEM_WALL: sceneryEntry = get_wall_entry(tileElement->properties.scenery.type); if (sceneryEntry->wall.scrolling_mode != 255) { set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_MODIFY); set_map_tooltip_format_arg(2, rct_string_id, sceneryEntry->name); return info->type; } break; case VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY: sceneryEntry = get_large_scenery_entry(scenery_large_get_type(tileElement)); if (sceneryEntry->large_scenery.scrolling_mode != 255) { set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_MODIFY); set_map_tooltip_format_arg(2, rct_string_id, sceneryEntry->name); return info->type; } break; case VIEWPORT_INTERACTION_ITEM_BANNER: banner = &gBanners[tileElement->properties.banner.index]; sceneryEntry = get_banner_entry(banner->type); set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_MODIFY); set_map_tooltip_format_arg(2, rct_string_id, sceneryEntry->name); return info->type; } if (!(input_test_flag(INPUT_FLAG_6)) || !(input_test_flag(INPUT_FLAG_TOOL_ACTIVE))) { if (window_find_by_class(WC_RIDE_CONSTRUCTION) == nullptr && window_find_by_class(WC_FOOTPATH) == nullptr) { return info->type = VIEWPORT_INTERACTION_ITEM_NONE; } } switch (info->type) { case VIEWPORT_INTERACTION_ITEM_SCENERY: sceneryEntry = get_small_scenery_entry(tileElement->properties.scenery.type); set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_REMOVE); set_map_tooltip_format_arg(2, rct_string_id, sceneryEntry->name); return info->type; case VIEWPORT_INTERACTION_ITEM_FOOTPATH: set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_REMOVE); set_map_tooltip_format_arg(2, rct_string_id, STR_FOOTPATH_MAP_TIP); if (footpath_element_is_queue(tileElement)) set_map_tooltip_format_arg(2, rct_string_id, STR_QUEUE_LINE_MAP_TIP); return info->type; case VIEWPORT_INTERACTION_ITEM_FOOTPATH_ITEM: sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(tileElement)); set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_REMOVE); if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN) { set_map_tooltip_format_arg(2, rct_string_id, STR_BROKEN); set_map_tooltip_format_arg(4, rct_string_id, sceneryEntry->name); } else { set_map_tooltip_format_arg(2, rct_string_id, sceneryEntry->name); } return info->type; case VIEWPORT_INTERACTION_ITEM_PARK: if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) break; if (tileElement->GetType() != TILE_ELEMENT_TYPE_ENTRANCE) break; set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_REMOVE); set_map_tooltip_format_arg(2, rct_string_id, STR_OBJECT_SELECTION_PARK_ENTRANCE); return info->type; case VIEWPORT_INTERACTION_ITEM_WALL: sceneryEntry = get_wall_entry(tileElement->properties.scenery.type); set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_REMOVE); set_map_tooltip_format_arg(2, rct_string_id, sceneryEntry->name); return info->type; case VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY: sceneryEntry = get_large_scenery_entry(tileElement->properties.scenery.type & 0x3FF); set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_REMOVE); set_map_tooltip_format_arg(2, rct_string_id, sceneryEntry->name); return info->type; } return info->type = VIEWPORT_INTERACTION_ITEM_NONE; }