Edit: Works perfectly in debugger now, but block doesn't rotate at all when run normally..
I'm having a problem that I've run through the debugger a ton and have narrowed it down to this.
I've got a block on screen that comes down in the middle and rotates. The image of the block obviously changes depends on the rotation, and this is done in a switch statement.
switch ( m_CurrentRotation ) {
case BossRotation_ZeroDegrees: {
ApplySurface(
m_BossRect.topLeftX,
m_BossRect.topLeftY,
BossFiveImage::p_ZeroDegrees,
p_Buffer
);
break;
}
case BossRotation_NinetyDegrees: {
ApplySurface(
m_BossRect.topLeftX,
m_BossRect.topLeftY,
BossFiveImage::p_NinetyDegrees,
p_Buffer
);
break;
}
case BossRotation_OneEightyDegrees: {
ApplySurface(
m_BossRect.topLeftX,
m_BossRect.topLeftY,
BossFiveImage::p_OneEightyDegrees,
p_Buffer
);
break;
}
case BossRotation_TwoSeventyDegrees: {
ApplySurface(
m_BossRect.topLeftX,
m_BossRect.topLeftY,
BossFiveImage::p_TwoSeventyDegrees,
p_Buffer
);
break;
}
default: {}
}
The block enters at zero degrees, and once it gets in the middle it starts rotating. I've found from debugging that in the switch statement, the ApplySurface for the FIRST case isn't being called (when I try to step into it, nothing happens). This causes the block to go "blank" every time it gets to that rotation point.
Here are the odd things...
1) If the ApplySurface function isn't being called, then why can you see the block coming down at first (before it starts rotating)?
2) Running the program in the debugger and running it normally show different results. Normally, it just shows the block in its zero degree position the whole time. The debugger is the only time it actually attempts to rotate the block. Are there compiler optimizations going on that are preventing whatever is going horribly wrong in my switch statement from happening?