Re-implement Pause menu Dungeon map texture effects #3496
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After introducing the HD and alternate resource system, dungeon maps were making multiple rooms glow due to permanently modified raw data in the resource manager. A reboot was required to fix the map. Additionally the current room indicator was not account for HD size textures.
This PR aims to re-implement support for the CPU modified texture effect for the current room indicator. Following similar patterns from #3434, I have gone about this by maintaining a copy of the dungeon map texture in kaleido code so that we can modify the texture without modifying the raw data from the resource manager, and then leverage
Gfx_RegisterBlendedTexture
to render the modified texture in place of the original texture.An alt-toggle hook is registered to update the maps correctly when changing alt mode and to re-override the current room palette index.
This requires that the HD map textures must be a png 4bit (16 color table), where the colors are
#000000FF
,#101010FF
,#202020FF
,#303030FF
, ...#F0F0F0FF
(multiples of 16), and the correct color needs to be used for the room matching the original map texture, this is because the palette index values correspond to specific rooms in the code. Retro will detect the image as a palette image and correctly pack it that way, instead of packing it as a RGBA32 texture. Safety measures are placed in the code to check that the image is correctly a palette based image, otherwise the texture will not be modified/registered and will just render as RGBA32 to avoid crashing.The only tool I was able to find that actually prepared a 4bit palette image without optimizing/changing the color table was GIMP. Photoshop CS6 was only able to export as 8bit with 256 colors. I tried to use ImageMagick to convert a png 8bit to png 4bit, but it kept breaking the color table by optimizing it. Alternatively, maybe Retro could be updated to help facilitate turning a regular png into the CI4 format. But that would not require any more changes in SoH, this branch should render HD maps appropriately once a pack is made.
(Note: I believe the thin vertical line gap is either an issue with my image export, or possibly something funky at the shader level that I can't figure out)
Fixes #2882 and Closes #2761
Depends on Kenix3/libultraship#393
Build Artifacts