campaignfasttime = 0;
campaignscore = 0;
campaigntime = 0;
- campaignchoicesmade = 0;
- memset(campaignchoices, 0, sizeof(campaignchoices));
}
Account* Account::add(string name) {
}
void Account::endGame() {
- campaignchoicesmade=0;
+ campaignchoices.clear();
campaignscore=0;
campaigntime=0;
}
void Account::winCampaignLevel(int choice, float score, float time) {
- campaignchoices[campaignchoicesmade++] = choice;
+ campaignchoices.push_back(choice);
setCampaignScore(campaignscore+score);
campaigntime = time;
}
funpackf(tfile, "Bf", &(acc->campaignhighscore));
funpackf(tfile, "Bi", &(acc->difficulty));
funpackf(tfile, "Bi", &(acc->progress));
- funpackf(tfile, "Bi", &(acc->campaignchoicesmade));
- for(j=0;j<acc->campaignchoicesmade;j++)
+ int campaignchoicesmade,campaignchoice;
+ funpackf(tfile, "Bi", &campaignchoicesmade);
+ for(j=0;j<campaignchoicesmade;j++)
{
- funpackf(tfile, "Bi", &(acc->campaignchoices[j]));
- if (acc->campaignchoices[j] >= 10)
+ funpackf(tfile, "Bi", &campaignchoice);
+ if (campaignchoice >= 10) // what is that for?
{
- acc->campaignchoices[j] = 0;
+ campaignchoice = 0;
}
+ acc->campaignchoices.push_back(campaignchoice);
}
funpackf(tfile, "Bf", &(acc->points));
for(j=0;j<50;j++)
void Account::saveFile(string filename, Account* accountactive) {
FILE *tfile;
- int numaccounts;
int j;
tfile=fopen(ConvertFileName(filename.c_str(), "wb"), "wb" );
fpackf(tfile, "Bf", a->campaignhighscore);
fpackf(tfile, "Bi", a->difficulty);
fpackf(tfile, "Bi", a->progress);
- fpackf(tfile, "Bi", a->campaignchoicesmade);
- for(j=0;j<a->campaignchoicesmade;j++)
+ fpackf(tfile, "Bi", a->getCampaignChoicesMade());
+ for(j=0;j<a->getCampaignChoicesMade();j++)
{
fpackf(tfile, "Bi", a->campaignchoices[j]);
}
void setDifficulty(int i) { difficulty = i; };
const char* getName() { return name.c_str(); };
float getCampaignScore() { return campaignscore; };
- int getCampaignChoicesMade() { return campaignchoicesmade; };
+ int getCampaignChoicesMade() { return campaignchoices.size(); };
int getCampaignChoice(int i) { return campaignchoices[i]; };
void setCampaignScore(int s) {
campaignscore=s;
float campaignfasttime;
float campaignscore;
float campaigntime;
- int campaignchoicesmade;
- int campaignchoices[5000]; // should really disappear. I'd use a vector or something like that.
+ std::vector<int> campaignchoices;
//statics
static std::vector<Account*> accounts;
static float texviewwidth, texviewheight;
static int i,j,k,l;
static GLubyte color;
- static float newbrightness;
- static float changespeed;
static XYZ checkpoint;
static float tempmult;
float tutorialopac;
endy[2]=starty[2]+20;
}
if(mainmenu==9){
- int tempncl;
nummenuitems=2+numchallengelevels;
char temp[255];
}
void Game::Loadlevel(const char *name){
- static int oldlevel;
int templength;
float lamefloat;
- int lameint;
static const char *pfx = ":Data:Maps:";
char *buf;
tutorialmaxtime=1;
}
loadingstuff=1;
- if(!firstload)
- oldlevel=50;
pause_sound(whooshsound);
pause_sound(stream_firesound);
funpackf(tfile, "Bf", &dialogueboxcolor[k][l][2]);
funpackf(tfile, "Bi", &dialogueboxsound[k][l]);
- bool doneread;
-
funpackf(tfile, "Bi",&templength);
if(templength>128||templength<=0)
templength=128;
float maxdistance=0;
float tempdist;
- int whichclosest;
+ //~ int whichclosest;
for(int i=0;i<objects.numobjects;i++){
tempdist=findDistancefast(&objects.center,&objects.position[i]);
if(tempdist>maxdistance){
- whichclosest=i;
+ //~ whichclosest=i;
maxdistance=tempdist;
}
}
fclose(tfile);
- oldlevel=whichlevel;
-
-
if(numplayers>maxplayers-1)
numplayers=maxplayers-1;
for(int i=0;i<numplayers;i++){
}
- int texsize;
- texsize=512*512*3/texdetail/texdetail;
+ //~ int texsize;
+ //~ texsize=512*512*3/texdetail/texdetail;
LoadTextureSave(creatureskin[player[i].creature][player[i].whichskin],&player[i].skeleton.drawmodel.textureptr,1,&player[i].skeleton.skinText[0],&player[i].skeleton.skinsize);
}
if(Input::isKeyPressed(SDLK_n)&&Input::isKeyDown(SDLK_LCTRL)){
- int closest=-1;
- float closestdist=-1;
- float distance;
for(int i=0;i<objects.numobjects;i++){
if(objects.type[i]==treeleavestype){
objects.scale[i]*=.9;
static XYZ facing,flatfacing;
static int target;
- int templength;
-
for(int i=0;i<15;i++){
displaytime[i]+=multiplier;
}
}
}
- static float keyrefreshdelay=0,bigrefreshdelay=0;
-
if(!player[0].jumpkeydown){
player[0].jumptogglekeydown=0;
}
hawkcalldelay=16+abs(Random()%8);
}
- static float temptexdetail;
-
doDebugKeys();
player[i].targetheadrotation2=pitch(participantfacing[whichdialogue][indialogue][i]);
}
- bool pause;
-
if(leveltime<.5)
numenvsounds=0;
static XYZ coltarget;
static XYZ target;
static XYZ col;
- static float brotate;
static XYZ facing;
static float changedelay;
static bool alldead;
stealthloading=0;
if(!stealthloading){
- float gLoc[3]={0,0,0};
- float vel[3]={0,0,0};
fireSound(firestartsound);
flash();
facing=DoRotation(facing,0,0-rotation,0);
viewerfacing=facing;
- brotate=0;
if(!cameramode){
if((animation[player[0].targetanimation].attack!=3&&animation[player[0].currentanimation].attack!=3)||player[0].skeleton.free)target=player[0].coords+player[0].currentoffset*(1-player[0].target)*player[0].scale+player[0].targetoffset*player[0].target*player[0].scale-player[0].facing*.05;
else target=player[0].oldcoords+player[0].currentoffset*(1-player[0].target)*player[0].scale+player[0].targetoffset*player[0].target*player[0].scale-player[0].facing*.05;