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

Re-implement Pause menu Dungeon map texture effects #3496

Merged
merged 6 commits into from
Dec 17, 2023

Conversation

Archez
Copy link
Contributor

@Archez Archez commented Dec 8, 2023

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.

image
(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

@briaguya-ai
Copy link
Contributor

adding "do not merge" until we get #3528 in and then this can be rebased

@briaguya-ai briaguya-ai added the do not merge Not ready or not valid changes label Dec 16, 2023
@Archez Archez removed do not merge Not ready or not valid changes libultraship labels Dec 17, 2023
@Archez Archez merged commit f655ab5 into HarbourMasters:develop-macready Dec 17, 2023
8 checks passed
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.

3 participants