palManipulateInit code (bug #558245)
|Reported by:||SF/jamieson630||Owned by:||fingolfin|
The included modifications to gfx.cpp implement palManipulateInit with the necessary information for palManipulate to correctly execute SCUMM opcode 0x33 subcode 0x0F (palManipulate). The lack of implementation of this opcode is addressed in bug #558245, in which the knowledge basis for this implementation was developed.
* The implementation of palManipulate was left untouched, since according to fingolfin it is the result of direct reverse engineering on the LEC code. However, it has a resolution problem: the slowest transition rate it supports is 1 luminescence value every 256 ticks. FOA has at least one occurrence of a palManipulate over 800 ticks, and I believe the lack of resolution shows. (I also believe this is why in that instance, there is a trailing palManipulate to immediately change to the target palette and clean up any inaccuracies that arose over the course of the transition.)
I originally showed fingolfin a slightly modified palManipulate implementation that has no such resolution limitations, at the cost of 3 extra divide operations per tick. If there is any interest in this variation, I would be happy to submit a patch for that as well. (There are associated mods to palManipulateInit to make it work.)
* I have assumed in my code that each tick corrseponds to 1/10 second; consequently, _palManipCounter is set equal to the "time" parameter without any transformation. In timing tests, this appeared to work out properly. I'm sure someone can confirm or deny the validity of this assumption for me off the top of their head.
* I tested the palManipulate usage in FOA Room 23 (the Inner Sanctum) and Room 96 (the extro). Everything seems to be working quite well. However, I only tested it in the Win32 non-MP3 debug build. For some reason, I kept getting page faults immediately when trying to run the Win32 release build. I may be linking to a debug version of SDL.lib; I'll keep trying to get it to work.
* The patch submitted was generated by diff - GNU diffutils version 2.7, the Win32 port available from SourceForge. I was using the "diff" command on CVS 1.11.2, but its output appeared to be substantially different from the patches that I've seen here. Let me know if this patch is not in the form needed.
I hope this patch helps bring that gorgeous Indy sunset back to life. :-)
Ticket imported from: #608138. Ticket imported from: patches/147.