Jump to content
  • Advertisement
  • entries
  • comments
  • views


Sign in to follow this  


Quite good night last night. Getting far to old for this though. Once you pass the magic 30, you just can't drink like you used to.

Hey - I've just discovered that me here on this site gets the first two Google hits for "EasilyConfused". Groovy.

Little to report on the game this morning. I've just implemented the bits to restore the device and so on if you Alt-Tab out and back in again. Not really feeling well enough at the moment to approach anything more complex than that.

Got my edge tracing algorythm working last night, as I mentioned. The main thing with it is that you need to step along each edge by a fixed amount (the dimension of a map block in this case) but you need to ensure that you sample all four corners, regardless of the size of the CRect.

Solution is to just move clockwise around the rect, for each edge starting at the corner. This does mean that if an edge is exactly BlockDimension+1 wide or high, a corner gets sampled twice. Not a major issue here since sampling from the map grid is pretty fast, but would need to be special cased out if it was important.

On the off-chance that anyone cares, here is the edge sampling code:

bool CMap::Collisions(CRect R,std::vector &V)
size_t No=V.size();

for(int X=R.X;X {
CMapCell C=MapCells[At(X,R.Y)];

for(int Y=R.Y;Y {
CMapCell C=MapCells[At(R.X+R.W-1,Y)];

for(int X=R.X+R.W-1;X>=R.X;X-=BD)
CMapCell C=MapCells[At(X,R.Y+R.H-1)];

for(int Y=R.Y+R.H-1;Y>=R.Y;Y-=BD)
CMapCell C=MapCells[At(R.X,Y)];

return No!=V.size();

Man, this forum really buggers about with tab characters.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!