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

Fix regression: Overzealous emitter dupe fix #1173

Merged
merged 1 commit into from
Jun 7, 2024

Conversation

InfoTeddy
Copy link
Collaborator

Commit 4f881b9 fixed a duplication bug where enemy movement types 10 and 12 would keep duplicating itself on every frame if it was spawned outside of the rooms they were supposed to be used in the main game. The downside was that this was an overzealous fix and unintentionally broke some cases that were working before.

As brought to my attention by Ally, you can no longer place an edentity with a p1 of 10 or 12 (translating to movement type 10 or 12) in the proper rooms and have it spawn perfectly working entities (that don't clone on themselves every frame), whereas you could in 2.2. This is considered a regression from 2.3.

So the problem here is that the reason the two emitter entities were so dangerous outside their respective rooms is because the entity they spawned (createentity entry 1) checked if it was in the correct rooms, and if so, it would call setenemy, and setenemy would set the behave attribute (movement type) correctly, and so the new entity would have a different behave that wouldn't be the exact same behave as the previous one, so it wouldn't be a duplicate emitter entity.

The previous entityclonefix worked okay for entry 1, because it would only be run if the room checks failed and setenemy wasn't called, but it broke a previously-working case for entry 56, because it was always run for entry 56.

So the best way to check if we have a dangerous entity is not by seeing if it is still behave 10 or 12 at the end of entity creation - because 10 or 12 could be harmless under the right conditions - but by checking if the right conditions were satisfied, and if not, then neutralize the entity.

I considered making the emitter entities work everywhere - which would be simpler - but I didn't want to go too far and add a new feature, especially in a minor release.

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 unless there is a prior written agreement

Commit 4f881b9 fixed a duplication bug
where enemy movement types 10 and 12 would keep duplicating itself on
every frame if it was spawned outside of the rooms they were supposed to
be used in the main game. The downside was that this was an overzealous
fix and unintentionally broke some cases that were working before.

As brought to my attention by Ally, you can no longer place an edentity
with a `p1` of 10 or 12 (translating to movement type 10 or 12) in the
proper rooms and have it spawn perfectly working entities (that don't
clone on themselves every frame), whereas you could in 2.2. This is
considered a regression from 2.3.

So the problem here is that the reason the two emitter entities were so
dangerous outside their respective rooms is because the entity they
spawned (`createentity` entry 1) checked if it was in the correct rooms,
and if so, it would call `setenemy`, and `setenemy` would set the
`behave` attribute (movement type) correctly, and so the new entity
would have a different `behave` that wouldn't be the exact same `behave`
as the previous one, so it wouldn't be a duplicate emitter entity.

The previous `entityclonefix` worked okay for entry 1, because it would
only be run if the room checks failed and `setenemy` wasn't called, but
it broke a previously-working case for entry 56, because it was always
run for entry 56.

So the best way to check if we have a dangerous entity is not by seeing
if it is still `behave` 10 or 12 at the end of entity creation - because
10 or 12 could be harmless under the right conditions - but by checking
if the right conditions were satisfied, and if not, then neutralize the
entity.

I considered making the emitter entities work everywhere - which would
be simpler - but I didn't want to go too far and add a new feature,
especially in a minor release.
@InfoTeddy InfoTeddy self-assigned this Jun 5, 2024
@NyakoFox
Copy link
Contributor

NyakoFox commented Jun 7, 2024

Tested, seems fine to me!

@InfoTeddy InfoTeddy merged commit 53d725f into TerryCavanagh:master Jun 7, 2024
3 checks passed
@InfoTeddy InfoTeddy deleted the general-bug-fixes branch June 7, 2024 21:20
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