PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Found it, fixed it, can you see my smile ?

After vast hours spent trying to see why my game was not behaving re: notifications / owner information at startup including trying the HAL version 0.8.0 I have proved that despite appearances I was not using PF 0.7.0 but still 0.6.0. I proved this by upgrading to 0.8.0 which caused the game to crash. On investigating the crash I found that the bug was in a 'screen clear & simple background' display function used in lots of parts of the game. The function has worked for months. One loop which drew a Vline took the game down. On examination I found that I only had to change a 320 to a 319 for the problem to stop. In other words the 0.6.0 function VLine which works with 320 fails in V 0.7.0 and 0.8.0.

Code:
for(z= 0;z<50;z++)
{
display->DrawVLine(z*5,0,320,Color(80,50,5));
display->DrawVLine((z*5)+1,0,320,Color(85,45,0));
}//end for
}


btw, is this a bug which should be fixed?

also this means that sometime I can try HAL again as it was this bug which took it down.
The bug was in 0.6. It shouldn't have worked in the first place.

If you draw a VLine from 0 to 320, it's wrong. That's 321 pixels. It should be from 0 to 319.
Actually it shouldn't have crashed. The clipper should have handled that properly. I will hunt this bug.

I remember Frank fixed something related to vertical lines not drawing the last pixel or something like that. Perhaps the clipper also needed an update.
if you are bug hunting you might want to deal with the 0.8/HAL bug I found the other day. A FillRect using x of 240 crashes PF 0.8.0
Code:

r_general.Set(0,0,240,319);
display->FillRect(r_general,Color(35,0,2));
shouldn't the 240 be 239 ?

for the same reasons as above
muff wrote:shouldn't the 240 be 239 ?
for the same reasons as above


It should be. But PocketFrog shouldn't crash when you exceed the screen's dimensions. Clipping should be performed.
I believe the only surface with a default clipper is the backbuffer. GetDisplay->GetBackBuffer()

Any created or loaded surfaces don't have a clipper by default, so it's not checking on those. (I'm almost 100% sure on this.)

I've always used fillrects using 240 and 320 because using 239 and 319 always ended up one pixel short... (maybe that's fixed now)

Even with Pocket Dice Master that I just converted from 0.7.0 to PF0.8.0 I'm using a FillRect going to 240, and it doesn't have any problems. That's probably because I'm hitting the BackBuffer though.

What's your RenderTarget set to when it fails Conan? Is it the display BackBuffer or another surface?

-John
It's just the regular display device that's failing with 240 / 320 values
Surfaces never have a clipper. It's the rasterizer that does. If you create multiple rasterizer, each one will have it's own clipper.