There are four types of background animations in the game:
- Type 0 - loop of just one sub-animation (e.g. gravedigger in loc. 1 - graveyard)
- Type 1 - loop with randomized sub-animation (e.g. owl in loc. 1 - graveyard)
- Type 2 - loop with base animation and after constant delay - change to one of another sub-animation (e.g. beggar in loc. 4 - city)
- Type 3 - loop of one sub-animation that is turning off for randomized amount of time (only in loc. 14 - treasury)
https://www.youtube.com/watch?v=rq7yIA5Fp-c
I also allow to cut them properly on edges of the screen while scrolling the location. I still have memory leak problems that I have to fix. Application is not crashing, but there have to be mistake somewhere. I'm using VS 2010 on Windows 7 and I don't have ScummVM compiled with gcc on Linux, so I'm using similar tool to Valgrind for memory checking - Dr. Memory. It gives me some errors in type 1 and 3 but it looks like it is not related with randomizing of sub-animations.
I also start working on part of code that allow drawing masks / overlays of background on top of other sprites (which allow to create Z axis in 2D world) and I have to say that it's going pretty good.