Well, I guess this is the first portable-only CSE2 update:
CSE2 v2.2
Download here
Font overhaul
The main focus of this update is the font system, which has always been the least accurate part of CSE2.
Where do I begin... well, for starters, the font system no longer emulates a bug in the original game: if you run the original freeware EXE in Windows XP, you'll notice the font doesn't have any anti-aliasing. In Windows Vista and later, however, it does. Anti-aliasing is bad because it conflicts with the game's colour-keying system, causing text to have an ugly crusty black-blue-and-red outline:
This bug has been fixed because CSE2 portable has had a slight shift in direction: rather than providing an accurate emulation of the original EXE as it is on modern PCs, it now provides an accurate emulation of the original EXE
as it was back-in-the-day. Since PCs of the era didn't have anti-aliasing enabled (at least not by default), this bug has been corrected.
Unrelated bugs in the font renderer have also been fixed, increasing compatibility with alternate fonts.
Speaking of fonts, Courier New and MS Gothic have made a return: previously they were removed for legal reasons and replaced with DejaVu Mono and Migu1M, but now they've been brought back, and they're more accurate than ever:
You see, even with the original Courier New font file, CSE2 Portable didn't actually render it the same as the original EXE. This is because the original EXE uses Windows to render the font, while CSE2 uses FreeType. The two do not render identically:
To work around this, I've overhauled the font renderer to not use FreeType at all: rather than generating characters from a font file, CSE2 now simply has a big PNG file containing a complete set of pre-rendered characters. This allows for text rendering to match the original EXE with 100% accuracy.
This method also presumably works around the legal issue that prevented the use of Courier New and MS Gothic before, since
apparently typefaces cannot be protected by copyright - only the font files themselves.
Misc.
Window resizing has been added, to make 320x240 mode useable on modern high-DPI systems. The official Cave Story beta images show the game running at 320x240, so it seems that this was the way Pixel intended the game to be played.
An under-the-hood change has also been made to the way text blits are batched:
Previously, CSE2 relied on the
cute_spritebatch.h library to maintain a texture atlas. On top of being plain overkill, this had two issues:
- cute_spritebatch.h was written in C++11, while the rest of CSE2 used C++98.
- cute_spritebatch.h was very complex, and did a lot of texture creation/destruction internally. This caused frameskipping for some users.
To address this, I've replaced it with my own texture-atlas system, which has neither of these issues.
The accurate branch has had some minor updates too: a little extra documentation here, a few authentic struct names restored there, etc.
Closing
Hopefully, now that I'm done with this, I can finally start working on CSE2EX. It's nice to finally have accurate font rendering: that's been a problem area for as long as CSE2 has existed. Heck, I think it might have even been a problem for CSE1.