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

Entry / exit locations for non-dungeon areas #414

Closed
markusjohnsson opened this issue Jan 30, 2023 · 2 comments · May be fixed by #418
Closed

Entry / exit locations for non-dungeon areas #414

markusjohnsson opened this issue Jan 30, 2023 · 2 comments · May be fixed by #418

Comments

@markusjohnsson
Copy link

It seams to me that in the json, only dungeon exits are included in the objects list. Is it possible to also include the exit and entry points of non-dungeon areas, such as Cold plains (entry from Blood moor, exit to Stony field)?

Thanks for a useful project.

@blacha
Copy link
Owner

blacha commented Feb 11, 2023

The entry/exit for non dungeon areas is in a separate location to where I am grabbing the dungeon areas from.

https://github.com/blacha/diablo2/blob/master/packages/map/map/d2_client.c#L334 this loop is looking over the objects in the map which has all the exits that are objects like stairs or caves.

The near by object is never looped, so we are not currently exporting the "nearby" exits.

To export the near by you would need to loop the pRoom2->dwRoomsNear

something like

for (int i = 0; i < pRoom2->dwRoomsNear; i++) {
    if (pLevel->dwLevelNo != pRoom2->pRoom2Near[i]->pLevel->dwLevelNo){
        int levelX = pRoom2->pRoom2Near[i]->pLevel->dwPosX * 5;
        int levelY = pRoom2->pRoom2Near[i]->pLevel->dwPosY * 5 ;

        int levelNumber = pRoom2->pRoom2Near[i]->pLevel->dwLevelNo;

        json_object_start();
        json_key_value("id", levelNumber);
        json_key_value("type", "exit");
        json_key_value("x", levelX);
        json_key_value("y", levelY);
        if (is_good_exit(pAct, pLevel, levelNumber)) json_key_value("isGoodExit", true);
        json_object_end();
    }
}

@markusjohnsson
Copy link
Author

Wow cool, will check out your PR and try it!

@blacha blacha closed this as completed May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants