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

Releasing the "windo_filter" texture, then using it again causes it to be replaced with a sprite displayed on screen #51

Open
drojf opened this issue Nov 1, 2020 · 0 comments

Comments

@drojf
Copy link
Contributor

drojf commented Nov 1, 2020

Disclaimer: I haven't tested this on the stock game, so it could be some other of my changes which causes this to happen. Also, it's not possible? for this to happen on the base game, but it is more of a "annoying for developers" thing.

Currently, before we switch window filters (the background for the textbox), we call ReleaseTextures(); just before it:

GameSystem.Instance.MainUIController.bgLayer.ReleaseTextures();
GameSystem.Instance.MainUIController.bgLayer2.ReleaseTextures();
GameSystem.Instance.MainUIController.bgLayer.DrawLayer("windo_filter", 0, 0, 0, null, gameSystem.MessageWindowOpacity, /*isBustshot:*/ false, 0, 0f, /*isBlocking:*/ false);
GameSystem.Instance.MainUIController.bgLayer2.DrawLayer("windo_filter", 0, 0, 0, null, gameSystem.MessageWindowOpacity, /*isBustshot:*/ false, 0, 0f, /*isBlocking:*/ false);

When testing my own code, I found that if you call this twice with "windo_filter" as the image, it can result in this happening.

sprite_as_window

It only happens with "windo_filter" in particular, because there is a hardcoded cache for that particular image in:

if (textureName == "windo_filter" && windowTexture != null)
{
return windowTexture;
}

However, if you remove the ReleaseTextures();, then the problem goes away.

I'm guessing that if you call releaseTextures on windo_filter, it doesn't invalidate (it doesn't set windo_filter to null), and when the game tries to use that texture, it ends up using some random texture instead.

I could either fix this by disabling the caching (currently you're not caching the ADV/NVLADV textures), or adding an extra condition check which disables the cache. Edit: If I just use a third type and switch ADV->NVL->OG->ADV... then the problem goes away so I guess it's not really an issue for now.

I don't think this is related to #45 even though it looks similar, because the sprite appears slightly transparent (it draws it with the window opacity).

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

No branches or pull requests

1 participant