#### Archived

This topic is now archived and is closed to further replies.

# Garphics not updating correctly..

This topic is 5753 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

This is an Iso-Diamond Map and only things that have changed or moved get updated so if a unit moved up the screen only that unit rect gets updated. But if this rect overlaps where another unit stands the other units imagie gets moved as well in this move. Its kind of hard to word The character that actually makes the move is uneffected..its just any chacter that is standing to close to the character that makes the move. Character1 to the SouthWest of the Character2, moved North 1 tile and when this happens it drags half of the Character2 up the screen while the move is being performed. Every move of the charcter is made in 8 little jumps to give the illusion that the character moves smothly, but when two characters are close together, the moving character distorts the stationary one while the move takes place. I have a gut feeling that the problem is beening cause by Unioning both the Unit tilesets together.


//calculate the extent rect

RECT rcExtent;
CopyRect(&rcExtent,&tsBack.GetTileList()[0].rcDstExt);
UnionRect(&rcExtent,&rcExtent,&tsUnit.GetTileList([0].rcDstExt)
;
UnionRect(&rcExtent,&rcExtent,&tsMarine.GetTileList([0].rcDstExt)
;
UnionRect(&rcExtent,&rcExtent,&tsTree.GetTileList( [0].rcDstExt); //union with tree extent


I will post other bits of the code if required. Below there is a shot of Character2 who is standing 2 tiles directly above Character1 and when Character2 moves south 1 tile his imagie slides down but also the top half of Character2 image slides down and covers the top of character1. It's all very annoying Below is the Render Function that is used

void RenderFunc(LPDIRECTDRAWSURFACE7 lpddsDst,RECT* rcClip,int xDst,int yDst,int xMap,int yMap)
{
//put background tile

tsBack.ClipTile(lpddsDst,rcClip,xDst,yDst,0);
if(mlMap[xMap][yMap].bTree)
{
//put tree

tsTree.ClipTile(lpddsDst,rcClip,xDst,yDst,0);
}
if((mlMap[xMap][yMap].bUnitOnLocation == true) && (Unitarray[iWhichUnit].iType==1))
{
tsUnit.ClipTile(lpddsDst,rcClip,xDst+ptUnitOffset.x,yDst+ptUnitOffset.y,1);//place the unit **** changed it to 1

}

if((mlMap[xMap][yMap].bUnitOnLocation == true) && (Unitarray[iWhichUnit].iType==0))
{
tsMarine.ClipTile(lpddsDst,rcClip,xDst+ptUnitOffset.x,yDst+ptUnitOffset.y,0);//place the unit **** changed it to 1

}
}                       
Thanks for your time Louise [edited by - louise on April 22, 2002 10:53:10 AM]

##### Share on other sites
Your gut feeling seems correct (I do not see the bitmap, just from the code). Two questions to get you started:
Does it happen everytime a sprite walks near a stationary character ?
Do you copy the background before drawing your sprite ?

Hope that helps.

Ghostly yours,
Red.

##### Share on other sites
My guess would be that you need both the area before and after the move, but are just doing the after. Another possibility is the order of the drawing.

##### Share on other sites
What way should i handle the graphics then..if this code is wrong..

      RECT rcExtent;CopyRect(&rcExtent,&tsBack.GetTileList()[0].rcDstExt);  UnionRect(&rcExtent,&rcExtent,&tsUnit.GetTileList([0].rcDstExt); UnionRect(&rcExtent,&rcExtent,&tsMarine.GetTileList([0].rcDstExt); UnionRect(&rcExtent,&rcExtent,&tsTree.GetTileList( [0].rcDstExt); //union with tree extent

[edited by - louise on April 22, 2002 10:59:03 AM]

##### Share on other sites
Ok, I saw the bitmaps you posted. It looks like the graphics from the book of TANSTAAFL : are you using his engine ?
If memory serves right, the extent rectangle is computed to check what part of the screen needs to be redrawn.

First Bitmap:
The background is incorrectly redrawn, the tree seems correct though. When character 2 in your first bitmap moves up north, you happen to redraw the part of character 1 at the new character 2 coordinates instead of the ancient. This is why half of the sprite is dragged. Check the rects drawing coordinates and the place where the redraw occurs: is it before the character is moved or after ?

Second Bitmap:
Here, character 2 is partially covered by the tree. I guess that character 2 is ORed with the tree and that when you move, the resulting bitmap is plotted at the tree coordinates without adding the legs height hiding thus character 1. I also think that the background is incorrectly redrawn since character 2 at the previous coordinated is not erased.

Could you compare with your book to see if there are any differences ? Also do not forget to check Tanstaafl''s website (http://www.isohex.net/default.asp?GroupID=3&View=Group) for erratas.

Hope that helps.

Ghostly yours,
Red.

##### Share on other sites
Yes it is tans engine......he's great i love him!! Just kidding!!

When i remove the trees totally it makes no difference as they always draw perfectly... Not sure what you are saying Red Ghost!

The greenback ground is drawn first for each tile then the tree and then the unit.

and (i think) the tiles are drawn starting at the top of the screen and working the way down so if a tree drawn on the second row down will over lap the legs of a unit on the first row.
This is alll good....should not effect anything got to do with the units..

problem is soley with the units!

[edited by - louise on April 22, 2002 12:19:00 PM]

##### Share on other sites
Could you check the following ?

- the coordinates calculated to place the units on the map (either moved units, or units needing a redraw because they are on a tile that needs redrawing)
- the coordinates of units or their rectangle regions after a movement (are they correctly placed, is it the correct rectangle region that is used to represent the sprite ?)

Could you also compare with the source in your book (check also the errata at TANSTAAFL web site since he had a problem in the walking section of the engine).

Hope that helps.

Ghostly yours,
Red.