Skip to content

Commit

Permalink
add ui warp buttons to special game screens
Browse files Browse the repository at this point in the history
  • Loading branch information
Dregu committed Oct 11, 2023
1 parent 3be15a4 commit 2dd67d9
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 2 deletions.
62 changes: 60 additions & 2 deletions src/injected/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1886,8 +1886,6 @@ void quick_start(uint8_t screen, uint8_t world, uint8_t level, uint8_t theme)
g_state->level_next = level;
g_state->theme_next = theme;
g_state->quest_flags = g_state->quest_flags | 1;
g_state->fadein = 1;
g_state->fadeout = 1;
g_state->loading = 1;

if (g_game_manager->main_menu_music)
Expand Down Expand Up @@ -3515,6 +3513,66 @@ const char* theme_name(int theme)

void render_narnia()
{
if (submenu("Other game screens"))
{
int screen = -1;
ImGui::PushID("WarpSpecial");
for (unsigned int i = 0; i < 21; ++i)
{
if ((i >= 5 && i <= 10))
continue;
if (options["menu_ui"])
{
if (ImGui::MenuItem(screen_names[i]))
screen = i;
}
else
{
if (i % 2)
ImGui::SameLine(ImGui::GetContentRegionAvail().x * 0.5f);
if (ImGui::Button(screen_names[i], ImVec2(ImGui::GetContentRegionMax().x * 0.5f, 0)))
screen = i;
}
}
endmenu();
if (screen != -1)
{
if (screen == 14)
{
if (g_state->screen == 11 or g_state->screen == 12)
UI::load_death_screen();
}
else if (g_state->screen != 12 && screen >= 11)
{
quick_start((uint8_t)screen, 1, 1, 1);
}
else
{
g_state->screen_next = screen;
g_state->loading = 1;
}
if (screen >= 16 && screen <= 18)
{
g_state->win_state = 1;
if (!g_state->end_spaceship_character)
g_state->end_spaceship_character = to_id("ENT_TYPE_CHAR_EGGPLANT_CHILD");
}
if (screen == 19)
{
g_state->world_next = 8;
g_state->level_next = 99;
g_state->theme_next = 10;
if (!g_state->level_gen->theme_cosmicocean->sub_theme)
g_state->level_gen->theme_cosmicocean->sub_theme = g_state->level_gen->theme_dwelling;
g_state->current_theme = g_state->level_gen->theme_cosmicocean;
g_state->win_state = 3;
if (g_state->level_count < 1)
g_state->level_count = 1;
}
}
ImGui::PopID();
}

ImGui::Text("Next level");
ImGui::SameLine(100.0f);

Expand Down
5 changes: 5 additions & 0 deletions src/injected/ui_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -759,3 +759,8 @@ std::pair<float, float> UI::spawn_position()
{
return {State::get().ptr()->level_gen->spawn_x, State::get().ptr()->level_gen->spawn_y};
}

void UI::load_death_screen()
{
call_death_screen();
}
1 change: 1 addition & 0 deletions src/injected/ui_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,5 @@ class UI
static int32_t spawn_playerghost(ENT_TYPE char_type, float x, float y, LAYER layer, float vx, float vy);
static void spawn_player(uint8_t player_slot, float x, float y);
static std::pair<float, float> spawn_position();
static void load_death_screen();
};

0 comments on commit 2dd67d9

Please sign in to comment.