I am trying to make the terrain in my game blend together using a series of eight "masks" that are red (255, 0, 0) that represent the sides and corners (4 sides, 4 corners = 8 masks) of the tiles. The way I do this is draw the base tile, blt all of the masks for a certian terrian blend, blt that terrain using a destination color key to only draw on the mask (thus getting the two terrains to blend where the mask was), and repeat the process with the other terrian types. Just one problem. The destination color keys don't seem to work. The source keys work fine (I can see through the mask), but the dest keys don't work (I can still see the red mask instead of the blended terrain). Any idea why this would occur? I am going to post the code for it. It isn't exactly this way in my .cpp files, but it should be everything involved (in the right order).
const unsigned short MaskColor = RGB16BIT(255, 0, 0);
ColorKey.dwColorSpaceHighValue = MaskColor;
ColorKey.dwColorSpaceLowValue = MaskColor;
lpddsback->SetColorKey(DDCKEY_DESTBLT, &ColorKey); // set dest colorkey
// DestRect is a param to the blend function (RECT *DestRect)
lpddsback->Blt(DestRect, BlendMasks, &SourceRect, DDBLT_KEYSRC, NULL); // blt this mask segment
// get the source rect for the tile I want to blend with here...
lpddsback->Blt(DestRect, Tileset, &SourceRect, DDBLT_KEYDEST, NULL); // fill in the mask
|
This one really has me stumped. I say that a lot, don't I? According to everything I know (and my book agrees), it should work. Please help!
--EDIT--
Check out the messed up screenshot and the masks/tileset
here.
--------------------
You are not a real programmer until you end all your sentences with semicolons;
(c) 2000 ROAD Programming
You are unique. Just like everybody else.
"Mechanical engineers design weapons; civil engineers design targets."
Yanroy@usa.com
Visit the ROAD Programming Website for more programming help.
Edited by - Yanroy on January 19, 2001 10:22:01 AM