X Tutup
Skip to content

AGI: Fix PREAGI pictures#6322

Merged
bluegr merged 7 commits intoscummvm:masterfrom
sluicebox:preagi-pix
Dec 18, 2024
Merged

AGI: Fix PREAGI pictures#6322
bluegr merged 7 commits intoscummvm:masterfrom
sluicebox:preagi-pix

Conversation

@sluicebox
Copy link
Member

This PR fixes picture inaccuracies and bugs in Winnie the Pooh and Mickey's Space Adventure:

Some of these bugs were TODOs in TrollVM (2004). Some were regressions from TrollVM being merged in 2007. Some were regressions from a 2016 refactor.

This is part of an ongoing effort to get our AGI picture code under control so that we can keep building on it. Right now it's tricky: some code is from Sarien, some code is from NAGI, some code is from TrollVM, some code has never executed and never will, much has been lost in translation, and none of this is documented. Only now that I have Curt Coder's thoroughly documented TrollVM source from 2004 do I understand our code, and even that was a challenge because TrollVM has been practically wiped from the internet.

Reverse engineering the executables was hard, but it was nothing compared to reverse engineering the 20+ years that led to picture.cpp =)

Examples:

Missing flood fills in lower left, balloon circle pattern is wrong allowing flood fill to escape, balloon corrupts memory because it goes off screen, flood fills run wild through process memory.

1a
1b

Missing green flood fills due to inaccurate screen-on flag handling, the pink coat's circle pattern is wrong allowing flood fill to escape.

2a
2b

Water should have been blue, rain cloud circle patterns are wrong allowing flood fill to escape.

3a
3b

Spaceship lights are wrong shape, despite undocumented hacks (now removed)

4a
4b

Planets and sun are wrong shape and not solid (there is no texture in PreAGI)

5a
5b

This is a V1 opcode that was moved to the wrong function in 2016.
See: 8a595e7

Confirmed in the TrollVM source that this code originated in.

With this understood, I am reverting my change to fix SQ1 Apple II.
Its pictures contain FC bytes that had no effect in the original because
they were correctly ignored. SQ1's FC bytes crashed this opcode handler,
so I added validation, because I didn't realize that the handler itself
was the mistake. See: 9191698
- Fixes Winnie items
- Fixes Mickey spaceship lights
- Fixes Mickey star map

Fixes bug scummvm#5730
- Fixes Winnie wall color in first room
- Fixes Winnie water color behind bridge
- Fixes Winnie rabbit hole color
- Fixes Eeyore shack color

Fixes bug #14549
Fixes Roo in Winnie the Pooh
Fixes memory corruption in Winnie the Pooh when a
tall object is drawn at the bottom of the screen.

The existing boundary checks in these functions occur
before the PreAGI offsets are applied.
@bluegr
Copy link
Member

bluegr commented Dec 18, 2024

Very nice work, thanks! :)

And thanks for the PR, showcasing all the different places where these fixes apply!

Merging

@bluegr bluegr merged commit e082448 into scummvm:master Dec 18, 2024
@sluicebox sluicebox deleted the preagi-pix branch January 23, 2025 11:27
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 this pull request may close these issues.

2 participants

X Tutup