static void window_title_editor_scrollpaint_commands(rct_window * w, rct_drawpixelinfo * dpi) { sint32 position = -1; if (title_is_previewing_sequence() && _selectedTitleSequence == title_get_current_sequence()) { ITitleSequencePlayer * player = window_title_editor_get_player(); position = title_sequence_player_get_current_position(player); } sint32 x = 0; sint32 y = 0; for (sint32 i = 0; i < (sint32)_editingTitleSequence->NumCommands; i++, y += SCROLLABLE_ROW_HEIGHT) { TitleCommand * command = &_editingTitleSequence->Commands[i]; bool selected = false; bool hover = false; bool error = false; if (i == w->selected_list_item) { selected = true; gfx_fill_rect(dpi, x, y, x + SCROLL_WIDTH + 100, y + SCROLLABLE_ROW_HEIGHT - 1, ColourMapA[w->colours[1]].dark); } else if (i == (sint32)_window_title_editor_highlighted_index || i == position) { hover = true; gfx_fill_rect(dpi, x, y, x + SCROLL_WIDTH + 100, y + SCROLLABLE_ROW_HEIGHT - 1, ColourMapA[w->colours[1]].mid_dark); } else if (i & 1) { gfx_fill_rect(dpi, x, y, x + SCROLL_WIDTH + 100, y + SCROLLABLE_ROW_HEIGHT - 1, ColourMapA[w->colours[1]].lighter | 0x1000000); } rct_string_id commandName = STR_NONE; switch (command->Type) { case TITLE_SCRIPT_LOAD: commandName = STR_TITLE_EDITOR_COMMAND_LOAD_FILE; if (command->SaveIndex == SAVE_INDEX_INVALID) { commandName = STR_TITLE_EDITOR_COMMAND_LOAD_NO_SAVE; error = true; } else { set_format_arg(0, uintptr_t, _editingTitleSequence->Saves[command->SaveIndex]); } break; case TITLE_SCRIPT_LOADMM: commandName = STR_TITLE_EDITOR_COMMAND_LOAD_SFMM; break; case TITLE_SCRIPT_LOCATION: commandName = STR_TITLE_EDITOR_COMMAND_LOCATION; set_format_arg(0, uint16, command->X); set_format_arg(2, uint16, command->Y); break; case TITLE_SCRIPT_ROTATE: commandName = STR_TITLE_EDITOR_COMMAND_ROTATE; set_format_arg(0, uint16, command->Rotations); break; case TITLE_SCRIPT_ZOOM: commandName = STR_TITLE_EDITOR_COMMAND_ZOOM; set_format_arg(0, uint16, command->Zoom); break; case TITLE_SCRIPT_SPEED: commandName = STR_TITLE_EDITOR_COMMAND_SPEED; set_format_arg(0, rct_string_id, SpeedNames[command->Speed - 1]); break; case TITLE_SCRIPT_FOLLOW: commandName = STR_TITLE_EDITOR_COMMAND_FOLLOW; if (command->SpriteIndex == SPRITE_INDEX_NULL) { commandName = STR_TITLE_EDITOR_COMMAND_FOLLOW_NO_SPRITE; } else { set_format_arg(0, uintptr_t, (uintptr_t)command->SpriteName); } break; case TITLE_SCRIPT_WAIT: commandName = STR_TITLE_EDITOR_COMMAND_WAIT; set_format_arg(0, uint16, command->Milliseconds); break; case TITLE_SCRIPT_RESTART: commandName = STR_TITLE_EDITOR_RESTART; break; case TITLE_SCRIPT_END: commandName = STR_TITLE_EDITOR_END; break; case TITLE_SCRIPT_LOADRCT1: { commandName = STR_TITLE_EDITOR_COMMAND_LOAD_FILE; const char * name = ""; source_desc desc; if (scenario_get_source_desc_by_id(command->SaveIndex, &desc)) { name = desc.title; } set_format_arg(0, uintptr_t, name); break; } case TITLE_SCRIPT_LOADSC: { commandName = STR_TITLE_EDITOR_COMMAND_LOAD_FILE; const char * name = ""; auto scenario = GetScenarioRepository()->GetByInternalName(command->Scenario); if (command->Scenario[0] == '\0') { commandName = STR_TITLE_EDITOR_COMMAND_LOAD_NO_SCENARIO; } else if (scenario != nullptr) { name = scenario->name; } else { commandName = STR_TITLE_EDITOR_COMMAND_LOAD_MISSING_SCENARIO; } set_format_arg(0, uintptr_t, name); break; } default: log_warning("Unknown command %d", command->Type); } char buffer[256]; if ((selected || hover) && !error) { format_string(buffer, 256, commandName, gCommonFormatArgs); } else { format_string(buffer + 1, 255, commandName, gCommonFormatArgs); buffer[0] = (utf8)(error ? ((selected || hover) ? FORMAT_LIGHTPINK : FORMAT_RED) : FORMAT_BLACK); } set_format_arg(0, uintptr_t, &buffer); gfx_draw_string_left(dpi, STR_STRING, gCommonFormatArgs, w->colours[1], x + 5, y); } }
bool scenario_repository_try_record_highscore(const utf8 * scenarioFileName, money32 companyValue, const utf8 * name) { IScenarioRepository * repo = GetScenarioRepository(); return repo->TryRecordHighscore(scenarioFileName, companyValue, name); }
size_t scenario_repository_get_count() { IScenarioRepository * repo = GetScenarioRepository(); return repo->GetCount(); }
const scenario_index_entry *scenario_repository_get_by_index(size_t index) { IScenarioRepository * repo = GetScenarioRepository(); return repo->GetByIndex(index); }
void scenario_repository_scan() { IScenarioRepository * repo = GetScenarioRepository(); repo->Scan(); }