Various Fixes

There’s no cohesive theme to what I did this last week, so sorry for the undescriptive title. 🙂

First I was tasked with fixing digital video in L-Zone. Previously, the videos in this game were being rendered entirely black, which is a rather suboptimal viewing experience. After a bit of investigation, I discovered that there were actually two issues present. First, there was a recent regression which prevented video sprites from refreshing, breaking video in every Director game. After I fixed this general issue, I started searching for the second, specific issue affecting L-Zone.

I found my answer in the video subsystem’s QuickTime decoder. When paletted QuickTime videos were implemented about a decade ago, support for the default QuickTime palettes was left out. Without the proper default palettes, the L-Zone videos, which did not come with custom palettes, were left with a palette consisting entirely of black. I borrowed the QuickTime palettes from FFmpeg, solving this rendering issue:

Next I did some more refactoring. Until Director 4, a movie could only have one cast, so cast members were referred to by a single integer ID. Director 5 introduced multiple casts, requiring cast member references to specify two IDs – one for the cast member and one for the cast which contains it. In preparation for Director 5 support, I replaced every use of cast member IDs with a struct consisting of these two integers.

After that, I began work on font maps. We already supported the Director 2 and 3 font map chunk (VWFM), a rather simple map associating Macintosh font names with integer IDs. In Director 4, the first version with a Windows port, font handling got more complicated. The VWFM chunk was replaced with Fmap, which included a platform ID along with the font name and ID. In addition, Director 4 movies include a FXmp chunk, which maps Macintosh fonts to similar-looking Windows fonts and vice versa. Interestingly, this is the only Director movie chunk I’ve seen which has a text-based format instead of binary. Director game developers could specify mappings like “Mac:Helvetica => Win:Arial“, placing these in a text file. Then they would import this text file into Director, and it would be saved as-is in the movie’s FXmp chunk. This made FXmp much easier to decipher than Director’s normal binary messes. 🙂

Now that I’ve implemented Fmap and FXmp, the next step is to handle different text encodings. For languages which use the Latin alphabet, movies could use either Mac Roman or Windows-1252 (or a combination of the two!). Then, of course, there were different encodings for Japanese and Korean before Director finally switched to UTF-8 in version 11.

I’ll see you next week with news on that!


Leave a Reply

Your email address will not be published. Required fields are marked *