Page 1 of 1

DOS Shadow Sprites

Posted: June 4th, 2016, 10:41 pm
by lvcabral
I understand that in DOS port the Shadow is done programmatically but anyone ever captured the images to have the sprites already changed ?

Re: DOS Shadow Sprites

Posted: June 5th, 2016, 12:16 am
by Norbert
Some possible paths to obtain what you want:
- Use the images of the prince, and make them partially transparent, as MININIM does.
- Use the images of the prince, and process them with custom code taken partially from SDLPoP.
- Use a terminal/shell (command-line) and run a program to process the images of the prince, for example with G'MIC or ImageMagick.

Note that - readers, correct me if I'm wrong - the bitwise xor operation is performed with two images (layers). As you can see in the attached image, the location of the shadow impacts the look of his face (and body) because of the position of the background's shadow. When using G'MIC or ImageMagick, the second layer could just be fully black. But this is why making screenshots of the game itself, for instance frame by frame to get the images, isn't ideal.

I've had no success with this, but ImageMagick's convert might be usable like this:
convert in1.png in2.png -fx "(((255*u)&(255*(1-v)))|((255*(1-u))&(255*v)))/255" out.png
(I found that on StackOverflow.)

And G'MIC like this, although I wouldn't know what value "200" should be changed into:
gmic in.png -xor 200 -o out.png

Also, GIMP has a gimp-gmic plug-in.
You'd need two layers, and then go to: Filters -> G'MIC...
- On the left, for "Input layers..." pick "All".
- Layers -> Blend [standard] -> Mode: Xor
- Apply.

Actually, I don't understand why the shadow has a white outline.
Maybe there's more going on than just a bitwise xor?

Re: DOS Shadow Sprites

Posted: June 5th, 2016, 2:20 am
by lvcabral
Thanks Norbert, great explanation.

I already did something similar to MININIM but I would prefer to have it look closer to the original.

Re: DOS Shadow Sprites

Posted: June 5th, 2016, 6:45 am
by lvcabral
I did a quick test using Paint.Net and it seems I got good results!

Re: DOS Shadow Sprites

Posted: June 5th, 2016, 7:46 am
by lvcabral
I managed to make the sprites look like the original, I think this is good enough :)

Thanks again Norbert for the tips.
screenshot-43-20160604.jpg

Re: DOS Shadow Sprites

Posted: June 5th, 2016, 11:45 pm
by lvcabral
Just to share If someone needs these sprites I'm attaching a zip with all the frames I needed to the shadow.

Re: DOS Shadow Sprites

Posted: June 7th, 2016, 7:02 pm
by David
Norbert wrote:Actually, I don't understand why the shadow has a white outline.
Maybe there's more going on than just a bitwise xor?
Well, that's exactly what happens if you xor the white clothes with the black background.

As a side note, the original DOS game xors the color indices instead of the RGB values.
And, the "base" image is drawn with the or blitter there, which I replaced in SDLPoP with a simple transparent blitter.

Re: DOS Shadow Sprites

Posted: June 7th, 2016, 9:58 pm
by Norbert
David wrote:
Norbert wrote:Actually, I don't understand why the shadow has a white outline.
Well, that's exactly what happens if you xor the white clothes with the black background.
That doesn't make any sense to me, but I trust your word for it.

Re: DOS Shadow Sprites

Posted: June 11th, 2016, 12:30 pm
by David
(Continuing the outline thing.)
Basically, if you have a row of white pixels, with black at each end, then this will happen if you xor the image with its copy shifted one pixel: (see attachment)
Black = 0, so White xor White = Black and White xor Black = White.

Re: DOS Shadow Sprites

Posted: June 11th, 2016, 2:54 pm
by Norbert
Thanks for explaining it.
With "its copy shifted one pixel" it all makes sense.

Re: DOS Shadow Sprites

Posted: June 16th, 2016, 4:49 pm
by David
Wait, did you think the two copies are positioned exactly on top of each other?

By the way, here is how the shadow is drawn in SDLPoP: https://github.com/NagyD/SDLPoP/blob/ma ... 08.c#L1528

Re: DOS Shadow Sprites

Posted: June 16th, 2016, 5:12 pm
by Norbert
David wrote:Wait, did you think the two copies are positioned exactly on top of each other?
I initially did, yes.