Skip to content

Commit

Permalink
update skipintro.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Auto committed Feb 3, 2025
1 parent 2be334a commit 9a4eda5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
24 changes: 24 additions & 0 deletions examples/skipintro.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
2 changes: 2 additions & 0 deletions src/injected/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 9a4eda5

Please sign in to comment.