}
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;
}
//campaign over?
if(mainmenu&&endgame==1)
mainmenu=10;
+ //go to level select after completing a campaign level
+ if(campaign&&winfreeze&&mainmenu==0&&campaignchoosenext[campaignchoicewhich[whichchoice]]==1){
+ mainmenu=5;
+ gameon=0;
+ winfreeze=0;
+ fireSound();
+ flash();
+ if(musictoggle){
+ OPENAL_SetFrequency(OPENAL_ALL, 0.001);
+ emit_stream_np(stream_menutheme);
+ pause_sound(leveltheme);
+ }
+ }
//escape key pressed
//TODO: there must be code somewhere else that handles clicking the Back button, merge it with this
if(Input::isKeyPressed(SDLK_ESCAPE)&&
selected=-1;
if(mainmenu==0&&!winfreeze)
mainmenu=2; //pause
- else if(mainmenu==0&&winfreeze&&campaignchoosenext[campaignchoicewhich[whichchoice]]==1){
- mainmenu=100;
- gameon=0;
- winfreeze=0;
- }else if(mainmenu==1||mainmenu==2)
+ else if(mainmenu==1||mainmenu==2){
mainmenu=0; //unpause
+ }
//play menu theme
- if(musictoggle&&(mainmenu==1||mainmenu==2||mainmenu==100)){
+ if(musictoggle&&(mainmenu==1||mainmenu==2)){
OPENAL_SetFrequency(OPENAL_ALL, 0.001);
emit_stream_np(stream_menutheme);
pause_sound(leveltheme);
mainmenu=gameon?2:1; break;
case 4: case 18:
mainmenu=3; break;
- case 6: case 7: case 9: case 10: case 100:
+ case 6: case 7: case 9: case 10:
mainmenu=5; break;
}
}
}
}
- 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;
}
}
- if(campaign)
- if(mainmenu==0&&winfreeze&&(campaignchoosenext[campaignchoicewhich[whichchoice]])==1)
+ if(campaign){
+ // campaignchoosenext determines what to do when the level is complete:
+ // 0 = load next level
+ // 1 = go back to level select screen
+ // 2 = stealthload next level
+ if(mainmenu==0&&winfreeze&&(campaignchoosenext[campaignchoicewhich[whichchoice]])==1){
if(campaignnumnext[campaignchoicewhich[whichchoice]]==0)
endgame=1;
- else if(mainmenu==0&&winfreeze){
+ }else if(mainmenu==0&&winfreeze){
if(campaignchoosenext[campaignchoicewhich[whichchoice]]==2)
stealthloading=1;
else
stealthloading=0;
if(!stealthloading){
- float gLoc[3]={0,0,0};
- float vel[3]={0,0,0};
fireSound(firestartsound);
flash();
stealthloading=0;
}
+ }
if(loading==3)
loading=0;
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;