11 August, 2009

More progress on Kyrandia 1 Amiga

Today I started to implement more differences in the Kyrandia 1 Amiga code. I finally got the GUI colors to work. Here is an screenshot of the text input field of the GUI.


Fixing up the colors of the GUI was quite easy. It was just a matter of changing some color values if the game platform is set to Amiga. The Amiga GUI uses color 17 for the background, and the colors 18 and 31 for the outlines. Color 18 is also used for the text field input background.

What was more work was to get the GUI strings to work. It turned out that the extraction routines, which extracted the strings from the original executable, were bugged. The Amiga version does use padding bytes now and then, so all strings start at even addresses. After I fixed proper handling of that, it worked just fine.

I was also able to implement palette differences for all opcodes I tested so far. This resulted in the grotto to be working now. Before I implemented the differences ScummVM always crashed, because the code tried to access non existent data. Funny here is that while the DOS version contained the special palettes in the executable, the Amiga version goes a much nicer way: All the special palettes are placed inside "PALETTE.DAT". This saved me some time finding the correct executable offsets for extraction. Now the fireberry glow palette for example works, which handles darkening of the grotto scenes, depending on the brightest fireberry in the scene and/or the players inventory. Here are some screenshots for that feature:


As you can see the brighter the fireberries are, the brighter the scene's color is.

The Will-O-Wisp also uses a special palette in the grotto. At first I thought it would work out of the box with the aforementioned changes, but sadly the Will-O-Wisp code has hardcoded palette handling, so I had to adjust that too. A little side note: I noticed that, when I wanted to make an screenshot of it for this blog entry ;-). Here comes a screenshot for the Will-O-Wisp in the grotto:


If I caught all palette differences, the game might be completable now. I probably missed some bits though. Of course there might be some other differences in the Amiga version, which might render the game not completable, but seeing how nice it worked so far, I doubt that is the case.

For the people interested why the palette differences might render the game not completable: I have an object / class handling palettes in the code. To catch all palette differences this code does assert out when the client code tries to access colors outside of the palette scope. This makes ScummVM quit when the code tries for example to use color 250 in a 32 color palette, which only offers colors 0 to 31. Of course that assertion also helps to catch out of bounds access in general cases too. So if now there is still a place I missed, which has hardcoded palette access based on the 256 color version, ScummVM will quit and that might render the game not completable. Of course that only applies if it is a critical point, which has to be passed, like for example the fireberry glow palette of the grotto was.

I also started to look a little bit into the outro / credits code. After implementing the differences, the outro works fine. The fewer colors of the Amiga version are noticeable here though. For example the Amiga version does not offer any Kyragem fading effects, as far as I can tell. I do not have any screenshot for that yet though, I will post some, when I really played the game till that point, instead of just using the ScummVM debugger for cheating ;-). The credits show up, but there are graphical glitches, like text not being aligned properly. I will need to take a look into that soon.

No comments: