piątek, 30 maja 2014

Background animations #2

Hello everyone in new weekly update.
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)
I finally manage to draw background animations of all types and also to draw shadows for them:

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.

sobota, 24 maja 2014

Background animations and objects displaying

I had a lot of school work this week, so my progress is smaller then I hope. I’m not proud of it but I’m going to work harder in upcoming week.

I was working on background animations displaying. I manage to load and display proper first frames of animations for each location. At the beginning I thought that I will be able to use same way of loading that is used for objects loading (like for shovel in first location). Sadly, there are more complications with them.

I was trying to understand how animations for Prince are stored. For each location we have anim.lst file that contains information about all animations of loaded room: special animations of hero (like hero with shovel for first room), background animations (like owl or bats in loc no. 1) and normal animations (like wizard Arivald). I had to implement InstallBackAnimations and InstallSingleBackAnim functions to find and load only background animations. These functions allow to find their proper numbers in anim.lst and load data for them.

But there are some background animations that has more then one type / sub-animation (like owl in first location – there are animations of her blinking eyes, waving her wings, etc). I decided to store main info (BAS structure) and array of all sub-animations (Anim) for one background animation in one structure (BackgroundAnim) and then create array of these structures (backAnimList) that contains all of them, but I’m not 100% sure if it’s the best idea. Some of background animations can change into normal animations (like gravedigger in first location) and that will be important too.
I’m still working on finding which sub-animation should be loaded in specific moment - it’s calculated in ShowBackAnims function.

Background animations - location no. 1

Background animations - location no. 3

Background animations - location no. 10

piątek, 16 maja 2014

Hero’s shadow drawing #2

I finally updated showHeroShadow function and I think that it’s working as in original game now.
With help of Eugene I manage to fix shadow colors. I had thought that there was a problem with algorithm or with finding right values in memory, but there was small mistake in getting location palette for makeShadowTable function - I was using palette from previous location after loading a new one. It was easy to fix but very hard to find out, so thanks again to him.
I also extend shadow function by adding proper drawing on walls and masking on objects and you can see it on screenshots below:

Location no. 1 - shadow masking and correct palette
ScummVM (left) / Original game (right)

Location no. 2 - shadow masking and correct palette
ScummVM (left) / Original game (right)

Location no. 2 - shadow after hero scrolling
ScummVM (left) / Original game (right)

Location no. 3 - shadow drawing on walls
ScummVM (left) / Original game (right)


poniedziałek, 12 maja 2014

Hero’s shadow drawing

So here we have next weekly update:

I finally made progress with shadow drawing last night. Position of hero’s shadow is changing in different locations and shape of the shadow depends on a hero position right now. Shadow is also correctly zooming when hero is resizing. I also manage to fix some memory leak problems in this functions.

I still have problems with shadow color palette so I’m using black color to fill the shadows and to check if the shape is good. There is a part of code that needs to be implemented that allows to change the shadow’s shape when it’s drawing on a wall of a building and I’m going to work on this part right now. Actual code still needs some tweaks and clean up which I’m also going to do this week.

ScummVM (left) / Original game (right)
Location no. 1
ScummVM (left) / Original game (right)
Location no. 2

ScummVM (left) / Original game (right)
Location no. 7

My actual shadow palette - loc no. 1

My actual shadow palette - loc no. 2

niedziela, 4 maja 2014

Hero scrolling and zooming

I am in the middle of work with hero sprite displaying. My progress isn’t as fast as I was thinking at a beginning but I’m not losing my hope. I feel that assembler and I are getting to know each other better but there are still some new things that I have to learn.

The best progress is when you can see it, so here we go:

First location - before hero zooming

First location - after hero zooming

Second location - before hero zooming

Second location - after hero zooming

Hero is also drawing in a right spot in wider locations where a background is moving while he walks.
Next thing that I am going to implement is drawing hero's shadow so wish me luck ;)
I'm still fighting with functions that allow to calculate colors and positions for it but I'm slowly pushing it forward.

See you next week!