It's not 100%, and when I click Debug->Break All, VStudio said that I could only look at the assembly code, so I'm at a loss as how to fix this--particularly given that it's not 100%, more like 10-25%.
It always hangs while dealing out the cards, so, for readability sake, I've deleted most everything else.
while (LoopGDK())
{
switch (NewGame.getState())
{
case START:
NewGame.setup();
break;
case DEALING:
NewGame.dealCards();
break;
case ANIMATION:
//looks to see if the card has gotten to its destination yet
if (turn == WEST)
foundLocation = updateCardLocs(turn, SpriteDeck, NewGame.getCardFromPlayerHand(WEST, (round * 4)), NewGame.getCardFromPlayerHand(WEST, (round * 4) + 1), NewGame.getCardFromPlayerHand(WEST, (round * 4) + 2), NewGame.getCardFromPlayerHand(WEST, (round * 4) + 3), round);
else if (turn == NORTH)
foundLocation = updateCardLocs(turn, SpriteDeck, NewGame.getCardFromPlayerHand(NORTH, (round * 4)), NewGame.getCardFromPlayerHand(NORTH, (round * 4) + 1), NewGame.getCardFromPlayerHand(NORTH, (round * 4) + 2), NewGame.getCardFromPlayerHand(NORTH, (round * 4) + 3), round);
else if (turn == EAST)
foundLocation = updateCardLocs(turn, SpriteDeck, NewGame.getCardFromPlayerHand(EAST, (round * 4)), NewGame.getCardFromPlayerHand(EAST, (round * 4) + 1), NewGame.getCardFromPlayerHand(EAST, (round * 4) + 2), NewGame.getCardFromPlayerHand(EAST, (round * 4) + 3), round);
else if (turn == SOUTH)
foundLocation = updateCardLocs(turn, SpriteDeck, NewGame.getCardFromPlayerHand(SOUTH, (round * 4)), NewGame.getCardFromPlayerHand(SOUTH, (round * 4) + 1), NewGame.getCardFromPlayerHand(SOUTH, (round * 4) + 2), NewGame.getCardFromPlayerHand(SOUTH, (round * 4) + 3), round);
if (foundLocation) //at location! Setup for next phase
{
turn = (turn + 1) % 4;
count += 4;
if (count % 16 == 0)
round++;
if (count == 80)
{
count = 0;
NewGame.toggleXState(ANIMATION);
NewGame.toggleXState(SORTING);
}
}
break;
case SORTING:
break;
default:
break;
}
dbSync();
}
The function it calls is the following:
bool updateCardLocs(int turn, Sprite *vDec, int card1, int card2, int card3, int card4, int round)
{
int x[4] = {-1, -1, -1, -1};
int y[4] = {-1, -1, -1, -1};
int cardSprites[4] = {card1, card2, card3, card4};
int cardWidth = 20;
int offset = (round * 4 * cardWidth) + cardWidth;
switch (turn)
{
case WEST:
x[0] = x[1] = x[2] = x[3] = WEST_LOC_X;
y[0] = WEST_LOC_Y + offset;
y[1] = y[0] + cardWidth;
y[2] = y[1] + cardWidth;
y[3] = y[2] + cardWidth;
break;
case NORTH:
x[0] = NORTH_LOC_X + offset;
x[1] = x[0] + cardWidth;
x[2] = x[1] + cardWidth;
x[3] = x[2] + cardWidth;
y[0] = y[1] = y[2] = y[3] = NORTH_LOC_Y;
break;
case EAST:
x[0] = x[1] = x[2] = x[3] = EAST_LOC_X;
y[0] = EAST_LOC_Y - offset;
y[1] = y[0] - cardWidth;
y[2] = y[1] - cardWidth;
y[3] = y[2] - cardWidth;
break;
case SOUTH:
x[0] = SOUTH_LOC_X + offset;
x[1] = x[0] + cardWidth;
x[2] = x[1] + cardWidth;
x[3] = x[2] + cardWidth;
y[0] = y[1] = y[2] = y[3] = SOUTH_LOC_Y;
break;
default:
break;
}
if (x[3] == vDec[cardSprites[3]].getX())
if (y[3] == vDec[cardSprites[3]].getY())
return true;
for (int i = 0; i < 4; i++)
{
vDec[cardSprites[i]].display(x[i], y[i]);
vDec[cardSprites[i]].setPriority((round * 4) + i);
}
return false;
}
Additionally, in the call stack, there is nothing that I call:
ntdll.dll!776996f4()
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
ntdll.dll!77698eb4()
kernel32.dll!7690c3e4()
kernel32.dll!7690c527()
user32.dll!768394b0()
user32.dll!76839541()
user32.dll!76840208()
dinput8.dll!70b0a62f()
kernel32.dll!76904911()
ntdll.dll!7767e1c6()
ntdll.dll!7767e199()