Original Post
Hello everyone My game is acting increadibly funny, seems it has a mind of it's own. I'm using VC++ 6, C++, with OpenGL, FMOD (for sound), and win32 API for the window. My problem is that the program crashes in a predictable, but to me not very logical manner. When compiling the program under DEBUG, and run from the IDE it works fine; when compiling the program under DEBUG and run from the exe it works fine; when compiling the program under RELEASE and run from the IDE it works fine, BUT, when compiling the program under RELEASE and run from the exe, it crashes with the error-report window, with not much other information other than it occured in the exe specifically (rather than a used dll). I put in manual debugging (in this case message boxes that popped up and intervals) to locate the error, found it, and it's even more suspicious. The program dies here: It gets to 9.1.0.0.2, goes into the loop, then calls the function DrawPlayer(), gets to 9.1.0, visible==false (in this case), but instead of returning to the loop the program haults. Some times it dies immidiatly, sometimes it starts looping reading from the hard drive. I have checked, all the memory for player* has been created succesfully. Thanks for ANY input for anyone, feel free to help, cause I'm lost on this one ~zix~
void PLAYER::DrawPlayer(){
MessageBox(NULL, "9.1.0", "DEBUG", MB_OK);
if (visible==false)
return;
MessageBox(NULL, "9.1.0.1", "DEBUG", MB_OK);
if (frame < 0.0f || frame > 197.0f)
return;
MessageBox(NULL, "9.1.1", "DEBUG", MB_OK);
/*GLUquadric *quadric = gluNewQuadric();
gluQuadricNormals(quadric, 1);
glPushMatrix();
glTranslatef(x,y,z);
gluSphere(quadric, 0.5f, 5,5);
glPopMatrix();
gluDeleteQuadric(quadric);*/
MessageBox(NULL, "9.1.2", "DEBUG", MB_OK);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, skin);
MessageBox(NULL, "9.1.3", "DEBUG", MB_OK);
glPushMatrix();
glTranslatef(x,y,z);
glRotatef(-(rotz-PID2)*DPI, 0,0,1);
glScalef(0.008f, 0.008f, 0.008f);
MessageBox(NULL, "9.1.4", "DEBUG", MB_OK);
model->Draw(frame);
glPopMatrix();
MessageBox(NULL, "9.1.5", "DEBUG", MB_OK);
//shadow
glPushMatrix();
glTranslatef(x,y,0.0f);
MessageBox(NULL, "9.1.6", "DEBUG", MB_OK);
glBindTexture(GL_TEXTURE_2D, shadowtex);
MessageBox(NULL, "9.1.7", "DEBUG", MB_OK);
glEnable(GL_BLEND);
glDisable(GL_LIGHTING);
glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f); glVertex3f(0.5f, 0.5f, terr_GetHeight(x+0.5f, y+0.5f)+0.012f);
glTexCoord2f(1.0f, 0.0f); glVertex3f(-0.5f, 0.5f, terr_GetHeight(x-0.5f, y+0.5f)+0.012f);
glTexCoord2f(1.0f, 1.0f); glVertex3f(-0.5f, -0.5f, terr_GetHeight(x-0.5f, y-0.5f)+0.012f);
glTexCoord2f(0.0f, 1.0f); glVertex3f(0.5f, -0.5f, terr_GetHeight(x+0.5f, y-0.5f)+0.012f);
glEnd();
glDisable(GL_BLEND);
glEnable(GL_LIGHTING);
glPopMatrix();
MessageBox(NULL, "9.1.8", "DEBUG", MB_OK);
}
void player_Draw(){
MessageBox(NULL, "9.1.0.0.2", "DEBUG", MB_OK);
for (int i=0; i<PLAYERAMT; ++i)
player.DrawPlayer();
MessageBox(NULL, "9.1.0.0.3", "DEBUG", MB_OK);
}