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

Per-room altstate system #906

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

AllyTally
Copy link
Contributor

@AllyTally AllyTally commented Nov 12, 2022

Changes:

VVVVVV has this interesting system called altstates. It's where a room can have multiple sets of tiles which can be switched between by using altstates(ID) in a script. This is only used in the pre-secret lab cutscene.

This works by the entity class having an altstates variable, which is 0 most of the time. Then when loading a room, it checks if that variable is a certain number, and switches out the set of tiles to load.

This is very hardcoded.

Like a couple of my other PRs (ex. #897, #905), this PR helps with the goal of reducing the split between custom levels and the main game. This gives the custom level system the ability to load alternate sets of tiles. To make it a bit more useful, it's per-room, instead of a global "altstate".

So, altstates(ID) has been stripped out -- it's not very useful when altstates are now per-room. Instead, altstate(x, y, ID) has taken it's place. x and y can be -1 to target the current x/y. The command changes the altstate and reloads the room. Altstates are stored separately from normal rooms in the level file, and this is because every single tile in levels are just one huge list... so altstates they're stored like so:

        <altstates>
            <state x="0" y="0">244,244,244,244,244,244,244,[...]</state> <!-- altstate 1 for 0, 0 -->
            <state x="0" y="0">244,244,244,244,244,244,244,[...]</state> <!-- altstate 2 for 0, 0 -->
        </altstates>

Like #897, this PR does NOT replace the current system used in the main game, as that should be done when the main game is overhauled to use a better format. However, laying down the systems for future use is the way to get there.

Also like #897, this doesn't add any editor support. In the future, I might make a PR to add some missing editor features, however I'm not sure yet. I'd love input on this decision. Additionally, if editor support for altstates is requested alone, I can do that in this PR as well.

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

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