Ever since I started maintaining Project: Starfighter (
http://starfighter.nongnu.org ), I’ve been scratching my head over this.
I don’t know when it happened, because this was some time before I
started maintaining it, but a certain collection of surfaces that are
supposed to be reddened versions of ships are often, but not always,
blank instead. I don’t see any consistent pattern in how it happens, or
any code that should fail in this particular way. The bug can be seen in
this video:
https://goblinrefuge.com/mediagoblin/u/onpon4/m/project-starfighter-1-3-gameplay/
All the game’s source code can be found in the public Git repository:
https://savannah.nongnu.org/git/?group=starfighter
I’ve verified that the surfaces are blank (or perhaps NULL, does
SDL_BlitSurface accept NULL for the first argument?), rather than some
other code just failing to draw the surface, by causing the surface
that’s supposed to be reddened to always be used; this causes the ship
in question (the player, in my test) to be invisible.
This is the code that is supposed to generate the reddened ships:
This code originally did have some problems which I fixed, though I
don’t remember what they were, so I originally supposed that maybe the
method just didn’t work with certain colors or certain formats or
something. I didn’t find any such pattern, but what really discredited
that hypothesis is that the following code, which used to be what was
used before the previous maintainer of Starfighter changed it to more or
less the current implementation, fails in exactly the same way, even
though it worked fine before:
At this point, my only remaining guess is that this code somehow broke
when Starfighter was upgraded from SDL 1.2 to SDL 2.0 (which, again, was
done before I started maintaining Starfighter). But I don’t see a
problem in that regard. Maybe it’s just because of my fairly rudimentary
understanding of SDL, though. Is there anything problematic in here?
Anything that might cause the entirety of certain images to be erased,
or perhaps for them to be replaced with NULL (or perhaps
SDL_CreateRGBSurface can return NULL)?
Sorry if the question is a little vague. :(–
Julian Marchant
https://onpon4.github.io
Protect your privacy with GnuPG:
https://emailselfdefense.fsf.org