+ if(mainmenu==6){
+ nummenuitems=3;
+
+ sprintf (menustring[0], "Are you sure you want to delete this user?");
+ startx[0]=10;
+ starty[0]=400;
+ endx[0]=startx[0]+strlen(menustring[0])*10;
+ endy[0]=starty[0]+20;
+
+ sprintf (menustring[1], "Yes");
+ startx[1]=10;
+ starty[1]=360;
+ endx[1]=startx[1]+strlen(menustring[1])*10;
+ endy[1]=starty[1]+20;
+
+ sprintf (menustring[2], "No");
+ startx[2]=10;
+ starty[2]=320;
+ endx[2]=startx[2]+strlen(menustring[2])*10;
+ endy[2]=starty[2]+20;
+
+ sprintf (menustring[3], "Extra 4");
+ startx[3]=10;
+ starty[3]=280;
+ endx[3]=startx[3]+strlen(menustring[3])*10;
+ endy[3]=starty[3]+20;
+
+ sprintf (menustring[4], "Extra 5");
+ startx[4]=10;
+ starty[4]=240;
+ endx[4]=startx[4]+strlen(menustring[4])*10;
+ endy[4]=starty[4]+20;
+
+ sprintf (menustring[5], "Back");
+ startx[5]=10;
+ endx[5]=startx[5]+strlen(menustring[5])*10;
+ starty[5]=10;
+ endy[5]=starty[5]+20;
+ }
+
+ if(mainmenu==7){
+ nummenuitems=Account::getNbAccounts()+2;
+
+ int num;
+
+ if(Account::getNbAccounts()<8)
+ sprintf (menustring[0], "New User");
+ else
+ sprintf (menustring[0], "No More Users");
+ startx[0]=10;
+ starty[0]=400;
+ endx[0]=startx[0]+strlen(menustring[0])*10;
+ endy[0]=starty[0]+20;
+
+ if(entername)
+ startx[0]+=10;
+
+
+ num=1;
+ for(i=0;i<Account::getNbAccounts();i++){
+ sprintf (menustring[num], "%s",Account::get(i)->getName());
+ startx[num]=10;
+ starty[num]=360-20-20*num;
+ endx[num]=startx[num]+strlen(menustring[num])*10;
+ endy[num]=starty[num]+20;
+
+ num++;
+ }
+
+ sprintf (menustring[num], "Back");
+ startx[num]=10;
+ endx[num]=startx[num]+strlen(menustring[num])*10;
+ starty[num]=10;
+ endy[num]=starty[num]+20;
+ }
+ if(mainmenu==8){
+ nummenuitems=3;
+
+ sprintf (menustring[0], "Easier");
+ startx[0]=10;
+ starty[0]=400;
+ endx[0]=startx[0]+strlen(menustring[0])*10;
+ endy[0]=starty[0]+20;
+
+ sprintf (menustring[1], "Difficult");
+ startx[1]=10;
+ starty[1]=360;
+ endx[1]=startx[1]+strlen(menustring[1])*10;
+ endy[1]=starty[1]+20;
+
+ sprintf (menustring[2], "Insane");
+ startx[2]=10;
+ starty[2]=320;
+ endx[2]=startx[2]+strlen(menustring[2])*10;
+ endy[2]=starty[2]+20;
+ }
+ if(mainmenu==9){
+ nummenuitems=2+numchallengelevels;
+ char temp[255];
+
+ for(j=0;j<numchallengelevels;j++){
+ for(i=0;i<255;i++)menustring[j][i]='\0';
+ sprintf (temp, "Level %d",j+1);
+ strcpy(menustring[j],temp);
+ for(i=0;i<17;i++)if(menustring[j][i]=='\0')menustring[j][i]=' ';
+ menustring[j][17]='\0';
+ sprintf (temp, "%d",(int)accountactive->getHighScore(j));
+ strcat(menustring[j],temp);
+ for(i=18;i<32;i++)if(menustring[j][i]=='\0')menustring[j][i]=' ';
+ menustring[j][32]='\0';
+ sprintf (temp, "%d:",(int)(((int)accountactive->getFastTime(j)-(int)(accountactive->getFastTime(j))%60)/60));
+ strcat(menustring[j],temp);
+ if((int)(accountactive->getFastTime(j))%60<10)strcat(menustring[j],"0");
+ sprintf (temp, "%d",(int)(accountactive->getFastTime(j))%60);
+ strcat(menustring[j],temp);
+
+ startx[j]=10;
+ starty[j]=400-j*25;
+ endx[j]=startx[j]+strlen(menustring[j])*10;
+ endy[j]=starty[j]+20;
+ }
+
+ sprintf (menustring[numchallengelevels], "Back");
+ startx[numchallengelevels]=10;
+ endx[numchallengelevels]=startx[numchallengelevels]+strlen(menustring[numchallengelevels])*10;
+ starty[numchallengelevels]=10;
+ endy[numchallengelevels]=starty[numchallengelevels]+20;
+
+ sprintf (menustring[numchallengelevels+1], " High Score Best Time");
+ startx[numchallengelevels+1]=10;
+ starty[numchallengelevels+1]=440;
+ endx[numchallengelevels+1]=startx[numchallengelevels+1]+strlen(menustring[numchallengelevels+1])*10;
+ endy[numchallengelevels+1]=starty[numchallengelevels+1]+20;
+
+ //numchallengelevels=tempncl;
+
+ }
+ if(mainmenu==10){
+ nummenuitems=6;
+ char temp[255];
+
+ sprintf (menustring[0], "Congratulations!");
+ startx[0]=220;
+ starty[0]=330;
+ endx[0]=startx[0]+strlen(menustring[0])*10;
+ endy[0]=starty[0]+20;
+
+ sprintf (menustring[1], "You have avenged your family and");
+ startx[1]=140;
+ starty[1]=300;
+ endx[1]=startx[1]+strlen(menustring[1])*10;
+ endy[1]=starty[1]+20;
+
+ sprintf (menustring[2], "restored peace to the island of Lugaru.");
+ startx[2]=110;
+ starty[2]=270;
+ endx[2]=startx[2]+strlen(menustring[2])*10;
+ endy[2]=starty[2]+20;
+
+ sprintf (menustring[3], "Back");
+ startx[3]=10;
+ endx[3]=startx[3]+strlen(menustring[3])*10;
+ starty[3]=10;
+ endy[3]=starty[3]+20;
+
+ for(i=0;i<255;i++)menustring[4][i]='\0';
+ sprintf (temp, "Your score:");
+ strcpy(menustring[4],temp);
+ for(i=0;i<20;i++)if(menustring[4][i]=='\0')menustring[4][i]=' ';
+ menustring[4][20]='\0';
+ sprintf (temp, "%d",(int)accountactive->getCampaignScore());
+ strcat(menustring[4],temp);
+ startx[4]=190;
+ endx[4]=startx[4]+strlen(menustring[4])*10;
+ starty[4]=200;
+ endy[4]=starty[4]+20;
+ for(i=0;i<255;i++)menustring[5][i]='\0';
+ sprintf (temp, "Highest score:");
+ strcpy(menustring[5],temp);
+ for(i=0;i<20;i++)if(menustring[5][i]=='\0')menustring[5][i]=' ';
+ menustring[5][20]='\0';
+ sprintf (temp, "%d",(int)accountactive->getCampaignHighScore());
+ strcat(menustring[5],temp);
+ startx[5]=190;
+ endx[5]=startx[5]+strlen(menustring[5])*10;
+ starty[5]=180;
+ endy[5]=starty[5]+20;
+ }
+ if (mainmenu==18) {
+ nummenuitems=4;
+ sprintf (menustring[0], "Stereo mode: %s", StereoModeName(newstereomode));
+ startx[0]=70;
+ starty[0]=400;
+ endx[0]=startx[0]+strlen(menustring[0])*10;
+ endy[0]=starty[0]+20;
+
+ sprintf (menustring[1], "Stereo separation: %.3f", stereoseparation);
+ startx[1]=10;
+ starty[1]=360;
+ endx[1]=startx[1]+strlen(menustring[1])*10;
+ endy[1]=starty[1]+20;
+
+ sprintf (menustring[2], "Reverse stereo: %s", stereoreverse ? "Yes" : "No");
+ startx[2]=40;
+ starty[2]=320;
+ endx[2]=startx[2]+strlen(menustring[2])*10;
+ endy[2]=starty[2]+20;
+
+ sprintf (menustring[3], "Back");
+ startx[3]=10;
+ endx[3]=startx[3]+strlen(menustring[3])*10;
+ starty[3]=10;
+ endy[3]=starty[3]+20;
+ }
+ }
+
+ if(mainmenu==1||mainmenu==2){
+ nummenuitems=4;
+ startx[0]=150;
+ starty[0]=480-128;
+ endx[0]=150+256;
+ endy[0]=480;
+
+ startx[1]=18;
+ starty[1]=480-152-32;
+ endx[1]=18+128;
+ endy[1]=480-152;
+
+ startx[2]=18;
+ starty[2]=480-228-32;
+ endx[2]=2+128;
+ endy[2]=480-228;
+
+ if(mainmenu==1){
+ startx[3]=18;
+ starty[3]=480-306-32;
+ endx[3]=22+64;
+ endy[3]=480-306;
+ }
+
+ if(mainmenu==2){
+ startx[3]=18;
+ starty[3]=480-306-32;
+ endx[3]=22+128;
+ endy[3]=480-306;
+ }
+
+ }
+
+ selected=-1;
+
+ for(i=0;i<nummenuitems;i++) {
+ if((mousecoordh/screenwidth*640)>startx[i]&&(mousecoordh/screenwidth*640)<endx[i]&&480-(mousecoordv/screenheight*480)>starty[i]&&480-(mousecoordv/screenheight*480)<endy[i]) {
+ if(mainmenu!=5) selected=i;
+ else if( (i>0) && (i!=NB_CAMPAIGN_MENU_ITEM) ) selected=i;
+ }
+ }
+
+ for(i=0;i<nummenuitems;i++){
+ if(selected==i) {
+ selectedlong[i]+=multiplier*5;
+ if(selectedlong[i]>1) selectedlong[i]=1;
+ } else {
+ selectedlong[i]-=multiplier*5;
+ if(selectedlong[i]<0) selectedlong[i]=0;
+ }
+ offsetx[i]=(startx[i]+endx[i])/2-(mousecoordh/screenwidth*640);
+ offsety[i]=(starty[i]+endy[i])/2-(480-(mousecoordv/screenheight*480));
+ offsetx[i]*=.06f;
+ offsety[i]*=.06f;
+ offsetx[i]=0;
+ offsety[i]=0;
+ }
+
+ if(mainmenu==1||mainmenu==2){
+ glClear(GL_DEPTH_BUFFER_BIT);
+ glEnable(GL_ALPHA_TEST);
+ glAlphaFunc(GL_GREATER, 0.001f);
+ glEnable(GL_TEXTURE_2D);
+ glDisable(GL_DEPTH_TEST); // Disables Depth Testing
+ glDisable(GL_CULL_FACE);
+ glDisable(GL_LIGHTING);
+ glDepthMask(0);
+ glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
+ glPushMatrix(); // Store The Projection Matrix
+ glLoadIdentity(); // Reset The Projection Matrix
+ glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
+ glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
+ glPushMatrix(); // Store The Modelview Matrix
+ glLoadIdentity(); // Reset The Modelview Matrix
+ glTranslatef(screenwidth/2,screenheight/2,0);
+ glPushMatrix();
+ glScalef((float)screenwidth/2,(float)screenheight/2,1);
+ glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+ glDisable(GL_BLEND);
+ glColor4f(0,0,0,1.0);
+ glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
+ glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
+ glDisable(GL_TEXTURE_2D);
+ glPushMatrix();
+ //glScalef(.25,.25,.25);
+ glBegin(GL_QUADS);
+ glTexCoord2f(0,0);
+ glVertex3f(-1, -1, 0.0f);
+ glTexCoord2f(1,0);
+ glVertex3f(1, -1, 0.0f);
+ glTexCoord2f(1,1);
+ glVertex3f(1, 1, 0.0f);
+ glTexCoord2f(0,1);
+ glVertex3f(-1, 1, 0.0f);
+ glEnd();
+ glPopMatrix();
+ glEnable(GL_BLEND);
+ glColor4f(0.4,0.4,0.4,1.0);
+ glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
+ glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
+ glEnable(GL_TEXTURE_2D);
+ glBindTexture( GL_TEXTURE_2D, Mainmenuitems[4]);
+ glPushMatrix();
+ //glScalef(.25,.25,.25);
+ glBegin(GL_QUADS);
+ glTexCoord2f(0,0);
+ glVertex3f(-1, -1, 0.0f);
+ glTexCoord2f(1,0);
+ glVertex3f(1, -1, 0.0f);
+ glTexCoord2f(1,1);
+ glVertex3f(1, 1, 0.0f);
+ glTexCoord2f(0,1);
+ glVertex3f(-1, 1, 0.0f);
+ glEnd();
+ glPopMatrix();
+ glPopMatrix();
+ glPopMatrix();
+ glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
+ glPopMatrix();
+
+ glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
+ glPushMatrix(); // Store The Projection Matrix
+ glLoadIdentity(); // Reset The Projection Matrix
+ glOrtho(0,640,0,480,-100,100); // Set Up An Ortho Screen
+ glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
+ glPushMatrix(); // Store The Modelview Matrix
+ glLoadIdentity(); // Reset The Modelview Matrix
+ glPushMatrix();
+ glDisable(GL_TEXTURE_2D);
+ glColor4f(1,0,0,1);
+ glPopMatrix();
+ glPopMatrix();
+ glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
+
+ }
+
+ glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
+ glPushMatrix(); // Store The Projection Matrix
+ glLoadIdentity(); // Reset The Projection Matrix
+ glOrtho(0,640,0,480,-100,100); // Set Up An Ortho Screen
+ glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
+ glPushMatrix(); // Store The Modelview Matrix
+ glLoadIdentity(); // Reset The Modelview Matrix
+ glEnable(GL_TEXTURE_2D);
+ for(j=0;j<nummenuitems;j++)
+ {
+ //glDisable(GL_BLEND);
+ glEnable(GL_ALPHA_TEST);
+ glEnable(GL_BLEND);
+ //glDisable(GL_ALPHA_TEST);
+ glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+ if(mainmenu==1||mainmenu==2)
+ {
+ glColor4f(1,1,1,1);
+ glBlendFunc(GL_SRC_ALPHA,GL_ONE);
+ glBindTexture( GL_TEXTURE_2D, Mainmenuitems[j]);
+ glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
+ glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
+ glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
+ glPushMatrix();
+ glBegin(GL_QUADS);
+ glTexCoord2f(0,0);
+ glVertex3f(startx[j], starty[j], 0.0f);
+ glTexCoord2f(1,0);
+ glVertex3f(endx[j], starty[j], 0.0f);
+ glTexCoord2f(1,1);
+ glVertex3f(endx[j], endy[j], 0.0f);
+ glTexCoord2f(0,1);
+ glVertex3f(startx[j], endy[j], 0.0f);
+ glEnd();
+ glPopMatrix();
+ glEnable(GL_BLEND);
+ //glDisable(GL_ALPHA_TEST);
+ glBlendFunc(GL_SRC_ALPHA,GL_ONE);
+ for(i=0;i<10;i++)
+ {
+ if(1-((float)i)/10-(1-selectedlong[j])>0)
+ {
+ glColor4f(1,1,1,(1-((float)i)/10-(1-selectedlong[j]))*.25);
+ glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
+ glPushMatrix();
+ glBegin(GL_QUADS);
+ glTexCoord2f(0,0);
+ glVertex3f(startx[j]-((float)i)*1/2+offsetx[j]*((float)i)/2, starty[j]-((float)i)*1/2+offsety[j]*((float)i)/2, 0.0f);
+ glTexCoord2f(1,0);
+ glVertex3f(endx[j]+((float)i)*1/2+offsetx[j]*((float)i)/2, starty[j]-((float)i)*1/2+offsety[j]*((float)i)/2, 0.0f);
+ glTexCoord2f(1,1);
+ glVertex3f(endx[j]+((float)i)*1/2+offsetx[j]*((float)i)/2, endy[j]+((float)i)*1/2+offsety[j]*((float)i)/2, 0.0f);
+ glTexCoord2f(0,1);
+ glVertex3f(startx[j]-((float)i)*1/2+offsetx[j]*((float)i)/2, endy[j]+((float)i)*1/2+offsety[j]*((float)i)/2, 0.0f);
+ glEnd();
+ glPopMatrix();
+ }
+ }
+ }
+ if(mainmenu==3||mainmenu==4||mainmenu==5||mainmenu==6||mainmenu==7||mainmenu==8||mainmenu==9||mainmenu==10||mainmenu==18)
+ {
+ if(mainmenu!=5||j<NB_CAMPAIGN_MENU_ITEM)
+ {
+ glColor4f(1,0,0,1);
+ if( (mainmenu==9) && j>accountactive->getProgress() && (j<numchallengelevels) )
+ glColor4f(0.5,0,0,1);
+ glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
+ glPushMatrix();
+ if(mainmenu!=7||j!=0||!entername)
+ text.glPrint(startx[j],starty[j],menustring[j],0,1,640,480);
+ else
+ {
+ char string[2]="_";
+ if(displayblink) {
+ //~ sprintf (string, "_");
+ text.glPrint(startx[j]+(float)(displayselected)*10,starty[j],string,0,1,640,480);
+ }
+ for(int l=0;l<displaychars[0];l++) {
+ sprintf (string, "%c",displaytext[0][l]);
+ text.glPrint(startx[j]+l*10,starty[j],string,0,1,640,480);