Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a "prev map" key binding #2007

Open
ceski-1 opened this issue Nov 9, 2024 · 3 comments · May be fixed by #2046
Open

Add a "prev map" key binding #2007

ceski-1 opened this issue Nov 9, 2024 · 3 comments · May be fixed by #2046

Comments

@ceski-1
Copy link
Collaborator

ceski-1 commented Nov 9, 2024

This would be very useful for testing. I think the key bindings menu is out of room though.

@fabiangreffrath
Copy link
Owner

fabiangreffrath commented Nov 22, 2024

How about this?

int G_GotoPrevLevel(void)
{
    const int cur_epsd = gameepisode;
    const int cur_map = gamemap;
    const int start_epsd = (gamemode == commercial) ? 1 : 9;
    int ret = false;

    for (gameepisode = start_epsd; gameepisode > 0; gameepisode--)
    {
        for (gamemap = 99; gamemap >= 0; gamemap--)
        {
            int next_epsd, next_map;
            G_GotoNextLevel(&next_epsd, &next_map);

            if (next_epsd == cur_epsd && next_map == cur_map)
            {
                G_DeferedInitNew(gameskill, gameepisode, gamemap);
                ret = true;
                break;
            }
        }
    }

    gameepisode = cur_epsd;
    gamemap = cur_map;

    return ret;
}

@rfomin
Copy link
Collaborator

rfomin commented Nov 22, 2024

for (gamemap = 99; gamemap >= 0; gamemap--)

Why are we looking from the end?

BTW, It is possible that we will not find the current map due to secret exits. Try to test "Fork in the Road" WAD

@fabiangreffrath
Copy link
Owner

Why are we looking from the end?

I'd like to find the highest possible map that would lead to the current map. For reasons I don't remember. It appeared plausible to me. 😁

BTW, It is possible that we will not find the current map due to secret exits. Try to test "Fork in the Road" WAD

Yes, it's possible, but then nothing will happen. We will have to provide feedback to the player, just as we do for e.g. IDCLEV99.

fabiangreffrath added a commit that referenced this issue Nov 23, 2024
@fabiangreffrath fabiangreffrath linked a pull request Nov 23, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants