Something's screwy.

Archives Forums/BlitzPlus Bug Reports/Something's screwy.

Pineapple(Posted 2008) [#1]
I'm writing a program similar to Falling Sand Game, except without the physics and a couple previously unexplored features. (only one at the moment). It's supposed to be kind of specialized, for those who want to know where the physics have gone.

I've searched the relevant code for errors, revised it, rewritten it, everything, and I always end up with the same problem. I can now say confidently that the error must not be in my code, but rather in the complier.

Here's a brief explanation of what should happen and what is happening:
Each pixel is checked for either adjacent pixels, diagonal pixels, or both to see if the two elements each one can be match a combination saved in memory, and if they do, the desired results for each of those two pixels are stored in memory as well. The pixels are converted to the correct results, and the pixel is set to be unable to react until the next frame.

Now this is what it does - All but two of the reactions work perfectly fine. However, when all 8 pixels are checked, directly down (x+0,y+1) and directly right (x+1,y+0) continue to react with no regard for the instruvtion to react only once per frame, therefore making all reactions in a straight line in that direction occur instantaneously, reulting in bad visuals and messed up reactions for the rest of the pixels on-screen. When none of the for adjacent checks are done, the down-right diagonal (x+1,y+1) happens instantaneously, but only when none of the adjacency checks are performed.

If this is a programming error on my part, forgive me, but if it is, I cannot for the life of me find it. I've been trying to fix this for several days now with no results. The thing that really baffles me, though, is that all 8 reactions are passed through the exact same function, which means that if this is happening for one reaction, shouldn't all of them experience the same problem?

The entire program is a couple lines short of 400, so I don't think that's going to be very easy on you, so I'll post the function which is used and the code which uses it.

The function:

React type, which stores each possible reaction in memory.

Function applied:

Oh yea, I running Windows XP 32 bit processing with DirectX 9.0 (I'm pretty sure)
I have the latest version of Blitz+ (I think)

Luke111(Posted 2008) [#2]
i recently had a problem with blitz+ where my function would not properly work because my If/EndIfs got messed up. I solved it with using cases.
I am pretty sure thats your case. Use cases in this case!!!