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

Region system #896

Merged
merged 6 commits into from
Nov 4, 2024
Merged

Region system #896

merged 6 commits into from
Nov 4, 2024

Conversation

mothbeanie
Copy link
Contributor

@mothbeanie mothbeanie commented Oct 31, 2022

Changes:

This PR adds a map region system. Regions allow the minimap to display only part of a level even if the level has larger bounds (for example, a 5x5 region in a 20x16 level). Regions can also have custom images. If regionid.png is present in /graphics, then the minimap will display that image when the current region is id. The default region is 0, and in region 0 the map will display minimap.png (instead of region0.png) if it is present, in order to maintain forwards compatibility. There are a maximum of 401 regions, from 0 to 400.
It adds three commands to manage them:
setregion(id,x,y,x2,y2) - sets region id from x,y to x2,y2.
changeregion(id) - sets the current region to id. If region id doesn't exist, then it will act as if you aren't in any region at all.
removeregion(id) - removes region id from the array.

Here is a demonstration video:

Regiondemo.mp4

This PR will not break forwards compatibility. Playing a level which uses this system with an older version of the game probably won't even affect their ability to navigate, although they might end up seeing rooms on the minimap that the level creator intended to be outside of the bounds of the displayed map.

Regions are saved to and loaded from a level's save file, as well as what the current region is. The map cursor and icons for trinkets and teleporters will display properly - if the player/a trinket/a teleporter is outside the bounds of the current region, it won't render on the map screen.

This also cleans up a lot of map code, moving more things into MapRenderData. Thanks to Ally and Dav999 for help with this!!!

Legal Stuff:

By submitting this pull request, I confirm that...

  • My changes may be used in a future commercial release of VVVVVV
  • I will be credited in a CONTRIBUTORS file and the "GitHub Friends"
    section of the credits for all of said releases, but will NOT be compensated
    for these changes

@InfoTeddy InfoTeddy self-assigned this Nov 2, 2022
@mothbeanie mothbeanie marked this pull request as ready for review November 7, 2022 00:15
@mothbeanie mothbeanie changed the title Region system (draft) Region system Nov 7, 2022
@mothbeanie mothbeanie closed this Aug 24, 2023
@mothbeanie mothbeanie reopened this Aug 24, 2023
@mothbeanie mothbeanie force-pushed the region-system branch 2 times, most recently from 62d6082 to bf8ca30 Compare August 24, 2023 20:56
@mothbeanie
Copy link
Contributor Author

This has been updated to work with the current map code!

@mothbeanie
Copy link
Contributor Author

This has been updated to work with the current map code. Again.

Copy link
Contributor

@InfoTeddy InfoTeddy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was expecting this to be a quick review. Unfortunately, it wasn't. 😛

I haven't even fully tested everything yet.

desktop_version/src/Game.cpp Outdated Show resolved Hide resolved
desktop_version/src/Game.cpp Outdated Show resolved Hide resolved
desktop_version/src/Map.cpp Outdated Show resolved Hide resolved
desktop_version/src/Map.cpp Outdated Show resolved Hide resolved
desktop_version/src/Map.cpp Outdated Show resolved Hide resolved
desktop_version/src/Map.cpp Outdated Show resolved Hide resolved
desktop_version/src/Map.h Outdated Show resolved Hide resolved
desktop_version/src/Map.cpp Show resolved Hide resolved
desktop_version/src/Map.cpp Outdated Show resolved Hide resolved
desktop_version/src/Map.cpp Show resolved Hide resolved
mothbeanie and others added 2 commits November 3, 2024 15:24
Co-authored-by: Misa Elizabeth Kai <infoteddy@infoteddy.info>
Fixes errors or oversights with the region system for the PR review
@mothbeanie
Copy link
Contributor Author

Applied changes from the review!

desktop_version/src/Map.cpp Outdated Show resolved Hide resolved
desktop_version/src/Map.cpp Outdated Show resolved Hide resolved
@mothbeanie
Copy link
Contributor Author

HAHAHAHA OMG OKAY I'LL FIX THAT

mothbeanie and others added 2 commits November 3, 2024 21:16
Co-authored-by: Misa Elizabeth Kai <infoteddy@infoteddy.info>
Co-authored-by: Misa Elizabeth Kai <infoteddy@infoteddy.info>
@InfoTeddy InfoTeddy merged commit d8a8e44 into TerryCavanagh:master Nov 4, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants