diff --git a/examples/skipintro.lua b/examples/skipintro.lua index 8c23e0847..d367d3faa 100644 --- a/examples/skipintro.lua +++ b/examples/skipintro.lua @@ -12,10 +12,15 @@ Quick start with Q is baked into Overlunky now, but maybe you can use this with local function skip() -- Jump to 1-1 from any screen before menu if state.screen >= 0 and state.screen < 4 then + + -- init single player: state.items.player_select[1].activated = true + -- get character from last played game state.items.player_select[1].character = ENT_TYPE.CHAR_ANA_SPELUNKY + savegame.players[1] state.items.player_select[1].texture = TEXTURE.DATA_TEXTURES_CHAR_YELLOW_0 + savegame.players[1] state.items.player_count = 1 + + -- init state: state.screen_next = 12 state.world_start = 1 state.level_start = 1 @@ -25,11 +30,30 @@ local function skip() state.theme_next = 1 state.quest_flags = 1 state.loading = 1 + + -- fix for character select screen: + state.screen_character_select.available_mine_entrances = 4; + -- you can also set it to SCREEN.LEVEL to skip the camp + state.screen_character_select.next_screen_to_load = SCREEN.CAMP; + + -- disable the [title screen -> menu] animation: + game_manager.screen_menu.loaded_once = true + + -- set controller to first input device for player one and menu + -- id 0 usually is keyboard, without this, you will need to press jump button first to register controller + if game_manager.game_props.input_index[1] == -1 then + game_manager.game_props.input_index[1] = 0 + end + if game_manager.game_props.input_index[5] == -1 then + game_manager.game_props.input_index[5] = 0 + end end end set_callback(function() skip() + -- run only once, otherwise we can't go back to main menu + clear_callback() end, ON.SCREEN) skip() diff --git a/src/injected/ui.cpp b/src/injected/ui.cpp index 58ad5c6f1..c20e7004c 100644 --- a/src/injected/ui.cpp +++ b/src/injected/ui.cpp @@ -2019,6 +2019,8 @@ void quick_start(uint8_t screen, uint8_t world, uint8_t level, uint8_t theme, st g_game_manager->game_props->input_index[0] = 0; if (g_game_manager->game_props->input_index[4] == -1) g_game_manager->game_props->input_index[4] = 0; + + g_game_manager->screen_menu->loaded_once = true; } void restart_adventure()