Hi,
well the two vars are declared as u64 and i don't get any compile error's with this but when i use the gettickcount(the two before the sprintf
Code: Select all
//iResult = sceRtcGetCurrentTick(&iTimeNow);
//iResultTime = (iTimeNow - iTimeStart) / sceRtcGetTickResolution();
then when the following code runs it creates another critter:
Code: Select all
int GameEvents(void){
if (iQuadPosY == 11){
if (BlockStatus[1] == 0) {
iField[iQuadPosX][iQuadPosY] = iCurrentQuad[1];
BlockStatus[1] = 1;
}
if (BlockStatus[2] == 0) {
iField[iQuadPosX + 1][iQuadPosY] = iCurrentQuad[2];
BlockStatus[2] = 1;
}
if (BlockStatus[3] == 0) {
iField[iQuadPosX + 1][iQuadPosY + 1] = iCurrentQuad[3];
BlockStatus[3] = 1;
}
if (BlockStatus[4] == 0) {
iField[iQuadPosX][iQuadPosY + 1] = iCurrentQuad[4];
BlockStatus[4] = 1;
}
CheckSurroundingField(iQuadPosX, iQuadPosY + 1, iCurrentQuad[4]);
CheckSurroundingField(iQuadPosX, iQuadPosY, iCurrentQuad[1]);
CheckSurroundingField(iQuadPosX + 1, iQuadPosY + 1, iCurrentQuad[3]);
CheckSurroundingField(iQuadPosX + 1, iQuadPosY, iCurrentQuad[2]);
iControllable = 1;
}
else {
//if (iQuadPosYold + 1 == iQuadPosY){
if (iControllable == 0) {
if (iDropSpeed == 40){
iQuadPosY += 1;
iDropSpeed = 0;
}
else { iDropSpeed += 1;}
}
else {
//if (iDropSpeed == 5){
iQuadPosY += 1;
// iDropSpeed = 0;
//iTest +=1;
//}
//else { iDropSpeed += 1;}
}
}
return 0;
}
the above code checks if the position is 11 and when it is then the code save the temporary blocks and saves them in the field. The problem that occurs only when the tickcount code is added is that instead of 4 blocks that are saved in the field, 5 are saved in the field. When this occurs then in the following function:
Code: Select all
int GameHandleQuad(void){
int iCheck = 0;
// check block 4 en 1
if (BlockStatus[4] != 1){
if (iField[iQuadPosX][iQuadPosY + 1] > 0){
if (iQuadPosY <= 2){ GameOver(); }
iField[iQuadPosX][iQuadPosY] = iCurrentQuad[4];
iField[iQuadPosX][iQuadPosY - 1] = iCurrentQuad[1];
BlockStatus[1] = 1;
BlockStatus[4] = 1;
iControllable = 1;
iCheck += 1;
CheckSurroundingField(iQuadPosX, iQuadPosY, iCurrentQuad[4]);
CheckSurroundingField(iQuadPosX, iQuadPosY - 1, iCurrentQuad[1]);
}
else {BlockStatus[4] = 0; BlockStatus[1] = 0;}
}
// check block 3 en 2
if (BlockStatus[3] != 1){
if (iField[iQuadPosX + 1][iQuadPosY + 1] > 0){
if (iQuadPosY <= 2){ GameOver(); }
iField[iQuadPosX + 1][iQuadPosY] = iCurrentQuad[3];
iField[iQuadPosX + 1][iQuadPosY - 1] = iCurrentQuad[2];
BlockStatus[3] = 1;
BlockStatus[2] = 1;
iControllable = 1;
iCheck += 2;
CheckSurroundingField(iQuadPosX + 1, iQuadPosY, iCurrentQuad[3]);
CheckSurroundingField(iQuadPosX + 1, iQuadPosY - 1, iCurrentQuad[2]);
}
else {BlockStatus[2] = 0; BlockStatus[3] = 0;}
}
if (iCheck != 3 && iCheck != 0){
iQuadPosY -= 1;
}
if (BlockStatus[3] == 1) {
if (BlockStatus[2] == 1) {
if (BlockStatus[1] == 1) {
if (BlockStatus[4] == 1) {
BlockStatus[1] = 0;
BlockStatus[2] = 0;
BlockStatus[3] = 0;
BlockStatus[4] = 0;
GameCreateQuad();
}
}
}
}
return 0;
}
then not every BlockStatus = 1 however it should be and without the code it is, so it should be the code with the ticks that cause the errors but i do not know why and what. Maybe it is because i calculate with u64 and u32 but save it into a integer?