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

Externalize sector Loading Screens #1182

Merged

Conversation

ja2-derek
Copy link
Member

@ja2-derek ja2-derek commented Aug 7, 2020

At the high level, there are 2 ways to determine the loading screen for a sector:

  1. Specific mapping from sector to loading screen (e.g. P3 => DAYPALACE, A2 => NIGHTCHITZENA)
  2. If no mapping found, there are rules for land types, SAM sites, underground caves, etc

What's included

This PR externalizes part 1 of the loading screen logic. There are 2 kinds of data externalized:

  1. Loading screen details, which has an index (LoadingScreenID), and points to a resource file (.STI)
  2. Mapping from sector + night/day to LoadingScreenID

With this, mods can freely add new loading screens and then maps specific sectors to them. Though it is not possible to change the rules via JSON, the mods can resort to adding a mapping for every single sector.

Part of #665.

Many sectorrs are specifically mapped to loading screens. The list of screens and also the sector mapping are externalized to JSON files.

Mods can add new loading screens for sectors.
No longer uses the LoadingScreenID enum, because it is not a complete list.

We will now first look up mapping and use it, if any. If no mapping is found, we fall back to the rules in Loading_Screen.cc
@ja2-derek
Copy link
Member Author

I am still looking at the failed check but I don't understand why it happens. It is consistently crashing at the same test even when it is re-run.

All tests work fine on the GitHub CI Linux and Mac builds, and also on my VC++ environment.

@ja2-derek
Copy link
Member Author

I am still looking at the failed check but I don't understand why it happens. It is consistently crashing at the same test even when it is re-run.

All tests work fine on the GitHub CI Linux and Mac builds, and also on my VC++ environment.

Fixed. It is a unit test only problem. The ContentManager in tests tried to delete an un-initialized pointer, i.e. one with garbage value.

@selaux
Copy link
Member

selaux commented Aug 10, 2020

👍 . Thanks.

@selaux selaux merged commit c45e22b into ja2-stracciatella:master Aug 10, 2020
@lynxlynxlynx lynxlynxlynx added this to the v0.18 milestone Aug 10, 2020
@ja2-derek ja2-derek deleted the externalize-loading-screens branch August 11, 2020 00:44
@ja2-derek ja2-derek added the externalization Extracting hard-coded data to externalized files label Oct 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement externalization Extracting hard-coded data to externalized files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants