Last week I finished up adding support for multiple text encodings to the Director engine. Now, any text contained in a Director file is automatically converted to UTF-8, greatly easing the pain of dealing with games in different languages and for different platforms. For the most part, this was rather straightforward, but there were a few places where it got interesting.
As it turns out, Director for Windows doesn’t store text in any standard encoding, but rather something partway between Mac OS Roman and Windows-1252. Any character which is present in both Windows-1252 and Mac OS Roman is stored using the Mac OS Roman code point. Any character which is present in Windows-1252 but not in Mac OS Roman is assigned an arbitrary, unique code point, and the end result is an encoding which has all the Windows-1252 characters but with different code points.
Not only is this encoding non-standard, but it isn’t even fixed! Game developers could customize the character mappings on a per-file basis in the font cross-platform map (FXmp). I haven’t seen any games where developers bothered to customize this, and I have a hard time believing that anyone cared enough about this to do so. Still, to be safe, we have to parse these mappings, then use them to convert all the text in Windows movies from the custom encoding back to Windows-1252.
The only other place where things got a bit interesting is the Lingo commands
numToChar. We can’t just use the Unicode code points for these functions. Instead, we have to map the Unicode code points to the code points of the native encoding for whatever platform we’re pretending to be—right now either Mac OS Roman, Windows-1252, or Shift JIS.
After fully Unicode-ifying the engine, I started fixing up Meet MediaBand, an interactive music video CD-ROM. With just a few fixes to sound looping logic, the
play command, and the
updateStage command, the beginning now works rather well!
It’s still pretty broken past the point I showed in the video, but I’ll keep fixing bugs in Meet MediaBand this week. I really like this thing, enough that I bought three copies of it, and I’m excited to get it working. 🙂