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: