The fix is simpl to make blitTextInPlace center text to the
screen rather than the text creation doing it. That way you don't
get weird behavior with screen_blitText (which already handles centering).
The old one still remains while I adapt the code to the new one.
This is simply a decoupling of the absolute position of text from
the creation of the text, to better facilitate position adaptation
to changes in screen size. Position indicated at creation remains
only for relative position (for use by e.g. credits and status lines).
Problem 1: fullscreen switching was leaving artifacts. Fixed by
drawing all black when switching fullscreen (and switching fullscreen
is now handled by its own function).
Problem 2: the mission briefing screen would distort if you changed
fullscreen during it. Fixed by redrawing the screen (it was previously
only drawn once).
This way preserves checks for Classic difficulty within (where
auto-camera-centering is implemented) so that if the edge behavior
ever changes again, it won't have unintended side-effects. The
conditional is also inverted to make it easier to read.
I think this should be good, but I can't test it right now because
I don't have a Windows compiler handy at the moment. Will make sure
to do so before making a release.
The modern version sells for rockets (i.e. you get rockets back when
you sell your secondary), but the original instead left you with
no secondary at all in this case. This behavior has now been restored.
At some point I replaced the "Target" text with "Sid", "Phoebe", and
"Kline" for those respective characters. Classic difficulty now always
uses the word "Target" once again.
The main problem with this bug was simply that it caused a constant
cycle of resurrection and death, which generated tons and tons of
powerups. It was only realistically achievable with cheats enabled,
but still, this seems undesirable.
It's not exactly the same technically, but in function it is. The
only functional difference is that the original would sometimes show
an unexpected health bar for a small(ish) enemy, whereas the new
implementation never does that.
Also different is that exact location is still shown. Will fix that
next.
So, that segfault? Turns out there's a place where I forgot to check
if something was NULL before accessing it, which turned out to be
important because for some reason, gfx_textSprites[TS_RADIO] got
set to 32 at some point while gfx_messageBox remained NULL.
This may be indicative of a memory leak somewhere, but it's
also possible that maybe it was left-over from a previous mission
or something, which may have been what made it so hard to spot (that
would make the bug time-sensitive as well as context-sensitive). In
any case, at least the segfault is fixed now.
This is something I forgot about before: the executive transport
A.I. was changed by me at some point from "Normal" to "Evasive".
This change re-introduces "Normal" A.I. for this ship in Classic
difficulty.
There are only a couple changes that I've left in:
1. On normal missions, the edge of the screen still doesn't slow you down.
2. The shop still does not have the old bug where selling was based on the price of the next item.
3. Not sure about this, but some powerups don't spawn if they're of no use to you; I believe this was not in the original, but it's been left in anyway.
4. Not sure about this either, but I believe the original had the 3-way spread much wider. This has not been adjusted for Classic difficulty.
Other than those three, Classic difficulty is now exactly the same,
including a re-implementation of the whole "score" system where destroying
a ship nets you money instantly and the absurd system where you buy only
10 plasma capacity at a time. I might adjust 1, 3, and/or 4 above later
on.
Limited damage prevention to only at the "low" and "critical" levels,
plus added a delay for when damage is first inflicted by rays.
This prevents ships with multiple concentrated shots from having
a disadvantage, and it helps make rays easier to avoid at the same
time (just get out of the ray in time and you don't take damage).
Of course, neither of these apply to Classic difficulty, although
the ray damage delay does apply to Nightmare difficulty (which,
given how unpredictable rays are, I think is quite reasonable).
Limits the damage you take somewhat. Basically, this is intended
to prevent sudden deaths; if it doesn't look like you're dying,
you probably won't suddenly get axed. Of course, this is disabled
in Classic difficulty.
The mistake caused the Classic game to deviate from the original
by not allowing Kline to drop mines in the Elamale mission. For
some reason I accidentally put that check in for Moebo instead.
Whoops!
At first I was going to just not bother with the resizing thing, but
then I found out that SDL actually has a scaling function built-in.
So rather than depending on SDL_gfx for this one purpose that never
sees the light of day in practice, I have handed that job over to
that function.
The fake "windowed fullscreen" is less invasive, but it sometimes
causes ugly artifacts and as a general rule isn't really all that
useful.
However, I also defined it in defs.h, so that it can be more easily
changed in the future.
In particular, sizes larger than the background work properly now
(in general; there are of course some things positioned badly still,
but everything updates correctly at any rate).
Ultimately, the following were removed:
* The portrait of Chris on top, which was superfluous.
* The text telling you who you were communicating with. Both superfluous and prone to inconsistencies.
* The button allowing you to return to the list of missions. Instead, you can click anywhere to do so, or just click on the "Missions" button again.
So now, the only thing left preventing 640x480 from being a usable
resolution is the shop. That's going to be a tough one...
It's not perfect, but I honestly just can't be arsed to figure out
how to use the Windows API to do the same thing that pwd.h does.
At the very least, Starfighter can now be successfully compiled for
Windows with MinGW simply by defining the "SF_WINDOWS" environment
variable to 1 (or any other non-empty value). The only downside is
that it uses the current working directory to decide where
.config/starfighter should go, meaning it can't be installed into
restricted directories like Program Files.
gfx_drawLine only supported drawing straight horizontal and vertical
lines anyway, so the method it used was completely pointless. It also
wasn't used anywhere other than gfx_drawRect.
I've made a couple of improvements here:
1. There is now a limit to how much value can be in a single
collectable. This means, most importantly, that there will be
no more 1000 plasma collectables or anything else ridiculous
like that. It also means that bosses now tend to drop a ton of
different collectable objects.
2. Collectables dropped by ships now live longer if a lot of
collectables were dropped. In practice, this only affects bosses;
no normal enemy drops enough to trigger this.
The combined results of these changes are that you're less likely
to get stuck with a useless item when you kill a boss (such as
plasma you don't need) rather than money, and you are more capable
of collecting the huge wads of cash left behind by the bosses that
drop more.
Classic difficulty penalizes you for selling items, so it's best not
to automatically sell anything that doesn't need to be. It could be,
for example, that you want to switch to a laser and then back to
rockets, in which case the auto-selling could make this much more
costly or cripple your missiles when you come back to them.
It looks like I'm finally almost done with this! The only thing left
is gradually replacing "Starfighter.h" imports with imports of what
actually is needed.
I did one structural change to the way ship_fireBullet works. It
previously had two separate places for reducing ammo from the player.
I changed this so that it removes ammo in the same place regardless
of which weapon it is, but then performs the plasma "out of ammo"
action afterwards. It seems to work properly.
Also fixed a flaw in the saving which would in some cases cause
the stationed planet to not get saved properly.
This was done with "replace all" actions, but I have checked and
the only collatoral damage has been to capitalize some instances
of "objective" in comments.
At first I was doing the same thing to them I did to the bragging
messages, but when it came to actually thinking of things these
characters should say, nothing I liked came up. The main problem
is nothing fits the characters' expressions. Add to that the
complexity of making this really work right, and it's just not
worth it.
The Sid death message has also been removed, both for consistency
and because of the mismatch of Chris's face with what he said there.
I considered rewriting it, but I don't think the intro text really
adds anything. Starfighter is an action game, not an adventure game,
so it's just out of place to show a paragraph of backstory before
the game starts.