/** * * rct2: 0x006CFF34 */ static void window_track_place_tooldown(rct_window* w, rct_widgetindex widgetIndex, sint32 x, sint32 y) { sint32 i; sint16 mapX, mapY, mapZ; money32 cost; uint8 rideIndex; window_track_place_clear_provisional(); map_invalidate_map_selection_tiles(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; sub_68A15E(x, y, &mapX, &mapY, nullptr, nullptr); if (mapX == LOCATION_NULL) return; // Try increasing Z until a feasible placement is found mapZ = window_track_place_get_base_z(mapX, mapY); for (i = 0; i < 7; i++) { gDisableErrorWindowSound = true; window_track_place_attempt_placement(_trackDesign, mapX, mapY, mapZ, 1, &cost, &rideIndex); gDisableErrorWindowSound = false; if (cost != MONEY32_UNDEFINED) { window_close_by_class(WC_ERROR); audio_play_sound_at_location(SOUND_PLACE_ITEM, mapX, mapY, mapZ); _currentRideIndex = rideIndex; if (track_design_are_entrance_and_exit_placed()) { auto intent = Intent(WC_RIDE); intent.putExtra(INTENT_EXTRA_RIDE_ID, rideIndex); context_open_intent(&intent); window_close(w); } else { ride_initialise_construction_window(rideIndex); w = window_find_by_class(WC_RIDE_CONSTRUCTION); window_event_mouse_up_call(w, WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE); } return; } // Check if player did not have enough funds if (gGameCommandErrorText == STR_NOT_ENOUGH_CASH_REQUIRES) break; mapZ += 8; } // Unable to build track audio_play_sound_at_location(SOUND_ERROR, mapX, mapY, mapZ); }
int audio_play_sound_panned(int soundId, int pan, sint16 x, sint16 y, sint16 z) { if (pan == AUDIO_PLAY_AT_LOCATION) return audio_play_sound_at_location(soundId, x, y, z); return audio_play_sound(soundId, 0, pan); }
/** * * 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; } }
/** * * rct2: 0x006CD4AB */ static void window_maze_construction_construct(sint32 direction) { sint32 x, y, z, flags, mode; ride_construction_invalidate_current_track(); x = _currentTrackBeginX + (TileDirectionDelta[direction].x / 2); y = _currentTrackBeginY + (TileDirectionDelta[direction].y / 2); z = _currentTrackBeginZ; switch (_rideConstructionState) { case RIDE_CONSTRUCTION_STATE_MAZE_BUILD: mode = GC_SET_MAZE_TRACK_BUILD; flags = GAME_COMMAND_FLAG_APPLY; break; case RIDE_CONSTRUCTION_STATE_MAZE_MOVE: mode = GC_SET_MAZE_TRACK_MOVE; flags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED; break; default: case RIDE_CONSTRUCTION_STATE_MAZE_FILL: mode = GC_SET_MAZE_TRACK_FILL; flags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED; break; } gGameCommandErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE; money32 cost = game_do_command( x, flags | (direction << 8), y, _currentRideIndex | (mode << 8), GAME_COMMAND_SET_MAZE_TRACK, z, 0 ); if (cost == MONEY32_UNDEFINED) { return; } _currentTrackBeginX = x; _currentTrackBeginY = y; if (_rideConstructionState != RIDE_CONSTRUCTION_STATE_MAZE_MOVE) { audio_play_sound_at_location(SOUND_PLACE_ITEM, x, y, z); } }