static void window_tile_inspector_tool_update() { short widgetIndex; rct_window *w; short x, y; int direction; window_tool_get_registers(w, widgetIndex, x, y); map_invalidate_selection_rect(); RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= ~(1 << 0); screen_pos_to_map_pos(&x, &y, &direction); if (x == (short)0x8000) { return; } RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) |= (1 << 0); RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16) = x; RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16) = y; RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16) = x; RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16) = y; RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_TYPE, uint16) = 4; map_invalidate_selection_rect(); }
/** * * rct2: 0x006C825F */ static void window_maze_construction_entrance_tooldown(sint32 x, sint32 y, rct_window* w){ ride_construction_invalidate_current_track(); map_invalidate_selection_rect(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; sint32 direction = 0; ride_get_entrance_or_exit_position_from_screen_position(x, y, &x, &y, &direction); if (gRideEntranceExitPlaceDirection == 0xFF) return; uint8 rideIndex = gRideEntranceExitPlaceRideIndex; uint8 entranceExitType = gRideEntranceExitPlaceType; if (entranceExitType == ENTRANCE_TYPE_RIDE_ENTRANCE) { gGameCommandErrorTitle = STR_CANT_BUILD_MOVE_ENTRANCE_FOR_THIS_RIDE_ATTRACTION; } else { gGameCommandErrorTitle = STR_CANT_BUILD_MOVE_EXIT_FOR_THIS_RIDE_ATTRACTION; } money32 cost = game_do_command( x, GAME_COMMAND_FLAG_APPLY | ((direction ^ 2) << 8), y, rideIndex | (entranceExitType << 8), GAME_COMMAND_PLACE_RIDE_ENTRANCE_OR_EXIT, gRideEntranceExitPlaceStationIndex, 0); if (cost == MONEY32_UNDEFINED) return; audio_play_sound_at_location( SOUND_PLACE_ITEM, gCommandPosition.x, gCommandPosition.y, gCommandPosition.z); rct_ride* ride = get_ride(rideIndex); if (ride_are_all_possible_entrances_and_exits_built(ride)){ tool_cancel(); if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_HAS_NO_TRACK)) window_close(w); } else{ gRideEntranceExitPlaceType = entranceExitType ^ 1; window_invalidate_by_class(WC_RIDE_CONSTRUCTION); gCurrentToolWidget.widget_index = entranceExitType ? WIDX_MAZE_ENTRANCE : WIDX_MAZE_EXIT; } }