#include "Input.h"
#include "Awards.h"
+#include <dirent.h>
+
using namespace std;
extern XYZ viewer;
return 0;
}
-void Game::LoadCampaign() {
- ifstream ipstream(ConvertFileName(":Data:Campaigns:main.txt"));
- ipstream.ignore(256,':');
- ipstream >> campaignnumlevels;
- for(int i=0;i<campaignnumlevels;i++){
- ipstream.ignore(256,':');
- ipstream.ignore(256,':');
- ipstream.ignore(256,' ');
- ipstream >> campaignmapname[i];
- ipstream.ignore(256,':');
- ipstream >> campaigndescription[i];
- for(int j=0;j<256;j++){
- if(campaigndescription[i][j]=='_')campaigndescription[i][j]=' ';
- }
- ipstream.ignore(256,':');
- ipstream >> campaignchoosenext[i];
- ipstream.ignore(256,':');
- ipstream >> campaignnumnext[i];
- for(int j=0;j<campaignnumnext[i];j++){
- ipstream.ignore(256,':');
- ipstream >> campaignnextlevel[i][j];
- campaignnextlevel[i][j]-=1;
+vector<string> Game::ListCampaigns() {
+ DIR *campaigns = opendir(ConvertFileName(":Data:Campaigns"));
+ struct dirent *campaign = NULL;
+ if(!campaigns) {
+ perror("Problem while loading campaigns");
+ cerr << "campaign folder was : " << ConvertFileName(":Data:Campaigns") << endl;
+ exit(EXIT_FAILURE);
+ }
+ vector<string> campaignNames;
+ while ((campaign = readdir(campaigns)) != NULL) {
+ string name(campaign->d_name);
+ if(name.length()<5)
+ continue;
+ if(!name.compare(name.length()-4,4,".txt")) {
+ campaignNames.push_back(name.substr(0,name.length()-4));
}
- ipstream.ignore(256,':');
- ipstream >> campaignlocationx[i];
- ipstream.ignore(256,':');
- ipstream >> campaignlocationy[i];
}
- ipstream.close();
+ return campaignNames;
+}
- for(int i=0;i<campaignnumlevels;i++){
- levelvisible[i]=0;
- levelhighlight[i]=0;
+void Game::LoadCampaign() {
+ if(!accountactive)
+ return;
+ ifstream ipstream(ConvertFileName((":Data:Campaigns:"+accountactive->getCurrentCampaign()+".txt").c_str()));
+ ipstream.ignore(256,':');
+ int numlevels;
+ ipstream >> numlevels;
+ campaignlevels.clear();
+ for(int i=0;i<numlevels;i++) {
+ CampaignLevel cl;
+ ipstream >> cl;
+ campaignlevels.push_back(cl);
}
+ ipstream.close();
- levelorder[0]=0;
- levelvisible[0]=1;
- for(int i=0;i<accountactive->getCampaignChoicesMade();i++){
- levelorder[i+1]=campaignnextlevel[levelorder[i]][accountactive->getCampaignChoice(i)];
- levelvisible[levelorder[i+1]]=1;
- }
- int whichlevelstart = (accountactive?accountactive->getCampaignChoicesMade():0)-1;
- if(whichlevelstart<0){
- if(accountactive) {
- accountactive->setCampaignScore(0);
- accountactive->resetFasttime();
+ if(!Mainmenuitems[7]) {
+ ifstream test(ConvertFileName((":Data:Textures:"+accountactive->getCurrentCampaign()+":World.png").c_str()));
+ if(test.good()) {
+ LoadTextureData((":Data:Textures:"+accountactive->getCurrentCampaign()+":World.png").c_str(),&Mainmenuitems[7],0,0);
+ } else {
+ LoadTextureData(":Data:Textures:World.png",&Mainmenuitems[7],0,0);
}
- campaignchoicenum=1;
- campaignchoicewhich[0]=0;
}
- else
- {
- campaignchoicenum=campaignnumnext[levelorder[whichlevelstart]];
- for(int i=0;i<campaignchoicenum;i++){
- campaignchoicewhich[i]=campaignnextlevel[levelorder[whichlevelstart]][i];
- levelvisible[campaignnextlevel[levelorder[whichlevelstart]][i]]=1;
- levelhighlight[campaignnextlevel[levelorder[whichlevelstart]][i]]=1;
- }
+
+ if(accountactive->getCampaignChoicesMade()==0) {
+ accountactive->setCampaignScore(0);
+ accountactive->resetFasttime();
}
}
-void Game::DrawMenu()
-{
- int i,j;
+void Game::DrawMenu() {
static float lastcheck;
lastcheck+=multiplier;
starty[9]=10;
endy[9]=starty[9]+20;
}
+
if(mainmenu==5){
- nummenuitems=7+(accountactive?accountactive->getCampaignChoicesMade():0)+campaignchoicenum;
+ nummenuitems=NB_CAMPAIGN_MENU_ITEM+1+accountactive->getCampaignChoicesMade()+(accountactive->getCampaignChoicesMade()>0?campaignlevels[accountactive->getCampaignChoicesMade()-1].nextlevel.size():1);
sprintf (menustring[0], "%s",accountactive->getName());
startx[0]=5;
starty[0]=400;
- endx[0]=startx[0]+strlen(menustring[0])*10;
- endy[0]=starty[0]+20;
sprintf (menustring[1], "Tutorial");
startx[1]=5;
starty[1]=300;
- endx[1]=startx[1]+strlen(menustring[1])*10;
- endy[1]=starty[1]+20;
sprintf (menustring[2], "Challenge");
startx[2]=5;
starty[2]=240;
- endx[2]=startx[2]+strlen(menustring[2])*10;
- endy[2]=starty[2]+20;
sprintf (menustring[3], "Delete User");
startx[3]=400;
starty[3]=10;
- endx[3]=startx[3]+strlen(menustring[3])*10;
- endy[3]=starty[3]+20;
sprintf (menustring[4], "Main Menu");
startx[4]=5;
starty[4]=10;
- endx[4]=startx[4]+strlen(menustring[4])*10;
- endy[4]=starty[4]+20;
sprintf (menustring[5], "Change User");
startx[5]=5;
- endx[5]=startx[5]+strlen(menustring[5])*10;
starty[5]=180;
- endy[5]=starty[5]+20;
+
+ sprintf (menustring[6], "Campaign : %s", accountactive->getCurrentCampaign().c_str());
+ startx[6]=200;
+ starty[6]=420;
+
+ for(int i=0;i<NB_CAMPAIGN_MENU_ITEM;++i) {
+ endx[i]=startx[i]+strlen(menustring[i])*10;
+ endy[i]=starty[i]+20;
+ }
//World
- sprintf (menustring[6], "World");
- startx[6]=30+120;
- starty[6]=30+480-400-50;
- endx[6]=startx[6]+400;
- endy[6]=30+480-50;
-
- if((accountactive?accountactive->getCampaignChoicesMade():0)) {
- for(i=0;i<(accountactive?accountactive->getCampaignChoicesMade():0);i++) {
- sprintf (menustring[7+i], "%s", campaigndescription[levelorder[i]]);
- startx[7+i]=30+120+campaignlocationx[levelorder[i]]*400/512;
- starty[7+i]=30+30+(512-campaignlocationy[levelorder[i]])*400/512;
- endx[7+i]=startx[7+i]+10;
- endy[7+i]=starty[7+i]+10;
+ sprintf (menustring[NB_CAMPAIGN_MENU_ITEM], "World");
+ startx[NB_CAMPAIGN_MENU_ITEM]=30+120;
+ starty[NB_CAMPAIGN_MENU_ITEM]=30+480-400-50;
+ endx[NB_CAMPAIGN_MENU_ITEM]=startx[NB_CAMPAIGN_MENU_ITEM]+400;
+ endy[NB_CAMPAIGN_MENU_ITEM]=30+480-50;
+
+ if(accountactive->getCampaignChoicesMade()) {
+ cout << "niveaux passés" << endl;
+ for(int i=0;i<accountactive->getCampaignChoicesMade();i++) {
+ cout << campaignlevels[i].location.x << "x" << campaignlevels[i].location.y << endl;
+ sprintf (menustring[NB_CAMPAIGN_MENU_ITEM+1+i], "%s", campaignlevels[i].description.c_str());
+ startx[NB_CAMPAIGN_MENU_ITEM+1+i]=30+120+campaignlevels[i].location.x*400/512;
+ starty[NB_CAMPAIGN_MENU_ITEM+1+i]=30+30+(512-campaignlevels[i].location.y)*400/512;
+ endx[NB_CAMPAIGN_MENU_ITEM+1+i]=startx[NB_CAMPAIGN_MENU_ITEM+1+i]+10;
+ endy[NB_CAMPAIGN_MENU_ITEM+1+i]=starty[NB_CAMPAIGN_MENU_ITEM+1+i]+10;
+ cout << "-->" << startx[NB_CAMPAIGN_MENU_ITEM+1+i] << "x" << starty[NB_CAMPAIGN_MENU_ITEM+1+i] << endl;
}
- }
-
- if(campaignchoicenum>0)
- for(i=(accountactive?accountactive->getCampaignChoicesMade():0);i<(accountactive?accountactive->getCampaignChoicesMade():0)+campaignchoicenum;i++){
- sprintf (menustring[7+i], "%s", campaigndescription[levelorder[i]]);
- startx[7+i]=30+120+campaignlocationx[campaignchoicewhich[i-((accountactive?accountactive->getCampaignChoicesMade():0))]]*400/512;
- starty[7+i]=30+30+(512-campaignlocationy[campaignchoicewhich[i-((accountactive?accountactive->getCampaignChoicesMade():0))]])*400/512;
- endx[7+i]=startx[7+i]+10;
- endy[7+i]=starty[7+i]+10;
+ cout << "niveaux à choisir" << endl;
+ for(int i=0;i<campaignlevels[accountactive->getCampaignChoicesMade()-1].nextlevel.size();i++) {
+ int j = campaignlevels[accountactive->getCampaignChoicesMade()-1].nextlevel[i];
+ cout << campaignlevels[j].location.x << "x" << campaignlevels[j].location.y << endl;
+ sprintf (menustring[NB_CAMPAIGN_MENU_ITEM+1+j], "%s", campaignlevels[j].description.c_str());
+ startx[NB_CAMPAIGN_MENU_ITEM+1+j]=30+120+campaignlevels[j].location.x*400/512;
+ starty[NB_CAMPAIGN_MENU_ITEM+1+j]=30+30+(512-campaignlevels[j].location.y)*400/512;
+ endx[NB_CAMPAIGN_MENU_ITEM+1+j]=startx[NB_CAMPAIGN_MENU_ITEM+1+j]+10;
+ endy[NB_CAMPAIGN_MENU_ITEM+1+j]=starty[NB_CAMPAIGN_MENU_ITEM+1+j]+10;
+ cout << "-->" << startx[NB_CAMPAIGN_MENU_ITEM+1+j] << "x" << starty[NB_CAMPAIGN_MENU_ITEM+1+j] << endl;
}
+ } else {
+ cout << "premier niveau" << endl;
+ sprintf (menustring[NB_CAMPAIGN_MENU_ITEM+1], "%s", campaignlevels[0].description.c_str());
+ startx[NB_CAMPAIGN_MENU_ITEM+1]=30+120+campaignlevels[0].location.x*400/512;
+ starty[NB_CAMPAIGN_MENU_ITEM+1]=30+30+(512-campaignlevels[0].location.y)*400/512;
+ endx[NB_CAMPAIGN_MENU_ITEM+1]=startx[NB_CAMPAIGN_MENU_ITEM+1]+10;
+ endy[NB_CAMPAIGN_MENU_ITEM+1]=starty[NB_CAMPAIGN_MENU_ITEM+1]+10;
+ }
+ cout << nummenuitems << " items" << endl;
+
}
if(mainmenu==6){
num=1;
- for(i=0;i<Account::getNbAccounts();i++){
+ for(int i=0;i<Account::getNbAccounts();i++){
sprintf (menustring[num], "%s",Account::get(i)->getName());
startx[num]=10;
starty[num]=360-20-20*num;
sprintf (menustring[num], "Back");
startx[num]=10;
- endx[num]=startx[num]+strlen(menustring[num])*10;
starty[num]=10;
+ endx[num]=startx[num]+strlen(menustring[num])*10;
endy[num]=starty[num]+20;
}
if(mainmenu==8){
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;
+ for(int i=0;i<numchallengelevels;i++){
+ string name="";
+ sprintf (temp, "Level %d",i+1);
+ for(int j=strlen(temp);j<17;j++)
+ strcat(temp," ");
+ name+=temp;
+ sprintf (temp, "%d",(int)accountactive->getHighScore(i));
+ for(int j=strlen(temp);j<(32-17);j++)
+ strcat(temp," ");
+ name+=temp;
+ sprintf (temp, "%d:",(int)(((int)accountactive->getFastTime(i)-(int)(accountactive->getFastTime(i))%60)/60));
+ if((int)(accountactive->getFastTime(i))%60<10)strcat(temp,"0");
+ name+=temp;
+ sprintf (temp, "%d",(int)(accountactive->getFastTime(i))%60);
+ name+=temp;
+
+ sprintf(menustring[i],"%s",name.c_str());
+
+ startx[i]=10;
+ starty[i]=400-i*25;
+ endx[i]=startx[i]+strlen(menustring[i])*10;
+ endy[i]=starty[i]+20;
}
sprintf (menustring[numchallengelevels], "Back");
starty[3]=10;
endy[3]=starty[3]+20;
- for(i=0;i<255;i++)menustring[4][i]='\0';
+ for(int 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]=' ';
+ for(int 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);
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';
+ for(int 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]=' ';
+ for(int 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);
}
if(mainmenu==1||mainmenu==2){
- nummenuitems=7;
+ nummenuitems=4;
startx[0]=150;
starty[0]=480-128;
endx[0]=150+256;
endy[3]=480-306;
}
- /*startx[4]=150;
- starty[4]=480-256;
- endx[4]=150+256;
- endy[4]=480;
- */
- /*if(anim==0){
- startx[4]=380;
- starty[4]=480-140-256;
- endx[4]=380+256;
- endy[4]=480-140;
-
- startx[5]=145;
- starty[5]=480-138-256;
- endx[5]=145+256;
- endy[5]=480-138;
-
- startx[6]=254;
- starty[6]=480-144-256;
- endx[6]=254+256;
- endy[6]=480-144;
- }*/
}
selected=-1;
- if(mainmenu==1||mainmenu==2)
- for(i=1;i<4;i++){
- if((mousecoordh/screenwidth*640)>startx[i]&&(mousecoordh/screenwidth*640)<endx[i]&&480-(mousecoordv/screenheight*480)>starty[i]&&480-(mousecoordv/screenheight*480)<endy[i]){
- selected=i;
- }
- }
-
- if(mainmenu==3||mainmenu==4||mainmenu==5||mainmenu==6||mainmenu==7||mainmenu==8||mainmenu==9||mainmenu==10||mainmenu==18)
- 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;
- if(mainmenu==5&&(i!=0&&i!=6))selected=i;
- if(mainmenu==9&&(i!=numchallengelevels+1))selected=i; // seem useless, if mainmenu==9 then mainmenu!=5, so selected==i.
- }
+ for(int 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) && (mainmenu!=1) && (mainmenu!=2)) selected=i; // username in menu 5 and game title in menu 1&2 can't be selected
+ else if( (i>0) && (i!=NB_CAMPAIGN_MENU_ITEM) ) selected=i;
}
+ }
- for(i=0;i<nummenuitems;i++){
+ for(int i=0;i<nummenuitems;i++) {
if(selected==i) {
selectedlong[i]+=multiplier*5;
if(selectedlong[i]>1) selectedlong[i]=1;
offsety[i]*=.06f;
offsetx[i]=0;
offsety[i]=0;
- if(i>=4&&(mainmenu==1||mainmenu==2)){
- selectedlong[i]=0;
- offsetx[i]=(startx[i]+endx[i])/2-(640+190)/2;
- offsety[i]=(starty[i]+endy[i])/2-(336+150)/2;
- offsetx[i]*=.06f;
- offsety[i]*=.06f;
- }
}
if(mainmenu==1||mainmenu==2){
glPushMatrix(); // Store The Modelview Matrix
glLoadIdentity(); // Reset The Modelview Matrix
glEnable(GL_TEXTURE_2D);
- for(j=0;j<nummenuitems;j++)
+ for(int j=0;j<nummenuitems;j++)
{
- if(j>3 && (mainmenu==1||mainmenu==2))
- continue;
//glDisable(GL_BLEND);
glEnable(GL_ALPHA_TEST);
glEnable(GL_BLEND);
glPopMatrix();
glEnable(GL_BLEND);
//glDisable(GL_ALPHA_TEST);
- if(j<4)glBlendFunc(GL_SRC_ALPHA,GL_ONE);
- for(i=0;i<10;i++)
+ glBlendFunc(GL_SRC_ALPHA,GL_ONE);
+ for(int i=0;i<10;i++)
{
if(1-((float)i)/10-(1-selectedlong[j])>0)
{
}
if(mainmenu==3||mainmenu==4||mainmenu==5||mainmenu==6||mainmenu==7||mainmenu==8||mainmenu==9||mainmenu==10||mainmenu==18)
{
- if(mainmenu!=5||j<6)
+ if(mainmenu!=5||j<NB_CAMPAIGN_MENU_ITEM)
{
glColor4f(1,0,0,1);
if( (mainmenu==9) && j>accountactive->getProgress() && (j<numchallengelevels) )
glPopMatrix();
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
- for(i=0;i<15;i++)
+ for(int i=0;i<15;i++)
{
if(1-((float)i)/15-(1-selectedlong[j])>0)
{
}
else
{
+ if(j==NB_CAMPAIGN_MENU_ITEM) {
+ //glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); // black background for the map
+ glBlendFunc(GL_SRC_ALPHA,GL_ONE); // no background
+ }
+
glClear(GL_DEPTH_BUFFER_BIT);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.001f);
glDisable(GL_DEPTH_TEST); // Disables Depth Testing
glDisable(GL_CULL_FACE);
glDisable(GL_LIGHTING);
- if(j==6)glColor4f(1,1,1,1);
+ if(j==NB_CAMPAIGN_MENU_ITEM) glColor4f(1,1,1,1);
else glColor4f(1,0,0,1);
glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
//Draw world, draw map
glTranslatef(2,-5,0);
- if(j>6&&j<nummenuitems-1)
+ if(j>NB_CAMPAIGN_MENU_ITEM&&j<nummenuitems-1)
{
XYZ linestart,lineend,offset;
XYZ fac;
//float linestartx,lineendx,linestarty,lineendy,offsetx,offsety;
linestart.x=(startx[j]+endx[j])/2;
linestart.y=(starty[j]+endy[j])/2;
- if(j>=6+(accountactive?accountactive->getCampaignChoicesMade():0)){
- linestart.x=(startx[6+(accountactive?accountactive->getCampaignChoicesMade():0)]+endx[6+(accountactive?accountactive->getCampaignChoicesMade():0)])/2;
- linestart.y=(starty[6+(accountactive?accountactive->getCampaignChoicesMade():0)]+endy[6+(accountactive?accountactive->getCampaignChoicesMade():0)])/2;
- }
+ //~ if(j>=NB_CAMPAIGN_MENU_ITEM-1+(accountactive?accountactive->getCampaignChoicesMade():0)){
+ //~ linestart.x=(startx[NB_CAMPAIGN_MENU_ITEM-1+(accountactive?accountactive->getCampaignChoicesMade():0)]+endx[NB_CAMPAIGN_MENU_ITEM-1+(accountactive?accountactive->getCampaignChoicesMade():0)])/2;
+ //~ linestart.y=(starty[NB_CAMPAIGN_MENU_ITEM-1+(accountactive?accountactive->getCampaignChoicesMade():0)]+endy[NB_CAMPAIGN_MENU_ITEM-1+(accountactive?accountactive->getCampaignChoicesMade():0)])/2;
+ //~ } // what was this if for?
lineend.x=(startx[j+1]+endx[j+1])/2;
lineend.y=(starty[j+1]+endy[j+1])/2;
offset=lineend-linestart;
Normalise(&offset);
glDisable(GL_TEXTURE_2D);
- if(j<6+(accountactive?accountactive->getCampaignChoicesMade():0)){
+ if(j<NB_CAMPAIGN_MENU_ITEM+accountactive->getCampaignChoicesMade()){
glColor4f(0.5,0,0,1);
endsize=.5;
} else {
linestart+=fac*4*startsize;
lineend-=fac*4*endsize;
- if(!(j>7+(accountactive?accountactive->getCampaignChoicesMade():0)+campaignchoicenum)){
+ //~ if(!(j>NB_CAMPAIGN_MENU_ITEM+1+accountactive->getCampaignChoicesMade()+campaignchoicenum)){
glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
glPushMatrix();
glBegin(GL_QUADS);
glVertex3f(lineend.x-offset.x*endsize, lineend.y-offset.y*endsize, 0.0f);
glEnd();
glPopMatrix();
- }
+ //~ }
glEnable(GL_TEXTURE_2D);
}
- if(j==6)glBindTexture( GL_TEXTURE_2D, Mainmenuitems[7]);
+ if(j==NB_CAMPAIGN_MENU_ITEM) glBindTexture( GL_TEXTURE_2D, Mainmenuitems[7]);
else glBindTexture( GL_TEXTURE_2D, Mapcircletexture);
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
- if(j-7<(accountactive?accountactive->getCampaignChoicesMade():0))glColor4f(0.5,0,0,1);
- if(j-7>=(accountactive?accountactive->getCampaignChoicesMade():0))glColor4f(1,0,0,1);
- if(j==6)glColor4f(1,1,1,1);
+ if(j-NB_CAMPAIGN_MENU_ITEM-1 < (accountactive?accountactive->getCampaignChoicesMade():0)) glColor4f(0.5,0,0,1);
+ if(j-NB_CAMPAIGN_MENU_ITEM-1 >= (accountactive?accountactive->getCampaignChoicesMade():0)) glColor4f(1,0,0,1);
+ if(j==NB_CAMPAIGN_MENU_ITEM) glColor4f(1,1,1,1);
XYZ midpoint;
float itemsize;
itemsize=abs(startx[j]-endx[j])/2;
midpoint=0;
midpoint.x=(startx[j]+endx[j])/2;
midpoint.y=(starty[j]+endy[j])/2;
- if(j>6&&(j-7<(accountactive?accountactive->getCampaignChoicesMade():0)))itemsize*=.5;
- if(!(j-7>(accountactive?accountactive->getCampaignChoicesMade():0)+campaignchoicenum))
- {
+ if (j>NB_CAMPAIGN_MENU_ITEM &&
+ (j-NB_CAMPAIGN_MENU_ITEM-1 < accountactive->getCampaignChoicesMade())) {
+ itemsize*=.5;
+ }
+ //~ if(!(j-NB_CAMPAIGN_MENU_ITEM-1 > accountactive->getCampaignChoicesMade()+campaignnumnext[accountactive->getCampaignChoicesMade()]))
+ //~ {
glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
glPushMatrix();
glBegin(GL_QUADS);
glPopMatrix();
glEnable(GL_BLEND);
//glDisable(GL_ALPHA_TEST);
- if(j<4)glBlendFunc(GL_SRC_ALPHA,GL_ONE);
- for(i=0;i<10;i++)
+ if(j<4) glBlendFunc(GL_SRC_ALPHA,GL_ONE); // Black is transparent
+ for(int i=0;i<10;i++)
{
if(1-((float)i)/10-(1-selectedlong[j])>0)
{
glPopMatrix();
}
}
- }
+ //~ }
glPopMatrix();
glPopMatrix();
glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
glPopMatrix();
glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
- if(j-7>=(accountactive?accountactive->getCampaignChoicesMade():0)){
+ if(j-NB_CAMPAIGN_MENU_ITEM-1>=(accountactive?accountactive->getCampaignChoicesMade():0)){
text.glPrintOutlined(0.9,0,0,startx[j]+10,starty[j]-4,menustring[j],0,0.6,640,480);
glDisable(GL_DEPTH_TEST);
}
glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
glPopMatrix();
- if(mainmenu==1||mainmenu==2)
- //if(transition<.1||transition>.9){
+ if(mainmenu==1||mainmenu==2) {
+ //if(transition<.1||transition>.9) {
glClear(GL_DEPTH_BUFFER_BIT);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.001f);
glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
glPopMatrix();
//}
+ }
glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
glPushMatrix(); // Store The Projection Matrix