- if(mapvers>=7){
- funpackf(tfile, "Bi", &numhotspots);
- for(int i=0;i<numhotspots;i++){
- funpackf(tfile, "Bi Bf Bf Bf Bf", &hotspottype[i],&hotspotsize[i],&hotspot[i].x,&hotspot[i].y,&hotspot[i].z);
- funpackf(tfile, "Bi", &templength);
- if(templength)
- for(int l=0;l<templength;l++)
- funpackf(tfile, "Bb", &hotspottext[i][l]);
- hotspottext[i][templength]='\0';
- if(hotspottype[i]==-111)
- indemo=1;
- }
- }else
- numhotspots=0;
-
- if(visibleloading)
- LoadingScreen();
-
- if(!stealthloading){
- objects.center=0;
- for(int i=0;i<objects.numobjects;i++)
- objects.center+=objects.position[i];
- objects.center/=objects.numobjects;
-
-
- if(visibleloading)
- LoadingScreen();
-
- float maxdistance=0;
- float tempdist;
- int whichclosest;
- for(int i=0;i<objects.numobjects;i++){
- tempdist=findDistancefast(&objects.center,&objects.position[i]);
- if(tempdist>maxdistance){
- whichclosest=i;
- maxdistance=tempdist;
- }
- }
- objects.radius=fast_sqrt(maxdistance);
- }
-
- if(visibleloading)
- LoadingScreen();
- //mapcenter=objects.center;
- //mapradius=objects.radius;
-
- funpackf(tfile, "Bi", &numplayers);
- int howmanyremoved=0;
- bool removeanother=0;
- if(numplayers>1&&numplayers<maxplayers){
- for(int i=1;i<numplayers;i++){
- if(visibleloading)
- LoadingScreen();
- removeanother=0;
-
- funpackf(tfile, "Bi Bi Bf Bf Bf Bi",&player[i-howmanyremoved].whichskin,&player[i-howmanyremoved].creature, &player[i-howmanyremoved].coords.x,&player[i-howmanyremoved].coords.y,&player[i-howmanyremoved].coords.z,&player[i-howmanyremoved].num_weapons);
- if(mapvers>=5)
- funpackf(tfile, "Bi", &player[i-howmanyremoved].howactive);
- else
- player[i-howmanyremoved].howactive=typeactive;
- if(mapvers>=3)
- funpackf(tfile, "Bf",&player[i-howmanyremoved].scale);
- else
- player[i-howmanyremoved].scale=-1;
- if(mapvers>=11)
- funpackf(tfile, "Bb",&player[i-howmanyremoved].immobile);
- else
- player[i-howmanyremoved].immobile=0;
- if(mapvers>=12)
- funpackf(tfile, "Bf",&player[i-howmanyremoved].rotation);
- else
- player[i-howmanyremoved].rotation=0;
- player[i-howmanyremoved].targetrotation=player[i-howmanyremoved].rotation;
- if(player[i-howmanyremoved].num_weapons<0||player[i-howmanyremoved].num_weapons>5){
- removeanother=1;
- howmanyremoved++;
- }
- if(!removeanother){
- if(player[i-howmanyremoved].num_weapons>0&&player[i-howmanyremoved].num_weapons<5){
- for(int j=0;j<player[i-howmanyremoved].num_weapons;j++){
- player[i-howmanyremoved].weaponids[j]=weapons.numweapons;
- funpackf(tfile, "Bi", &weapons.type[player[i-howmanyremoved].weaponids[j]]);
- weapons.owner[player[i-howmanyremoved].weaponids[j]]=i;
- weapons.numweapons++;
- }
- }
- funpackf(tfile, "Bi", &player[i-howmanyremoved].numwaypoints);
- //player[i-howmanyremoved].numwaypoints=10;
- for(int j=0;j<player[i-howmanyremoved].numwaypoints;j++){
- funpackf(tfile, "Bf", &player[i-howmanyremoved].waypoints[j].x);
- funpackf(tfile, "Bf", &player[i-howmanyremoved].waypoints[j].y);
- funpackf(tfile, "Bf", &player[i-howmanyremoved].waypoints[j].z);
- if(mapvers>=5)
- funpackf(tfile, "Bi", &player[i-howmanyremoved].waypointtype[j]);
- else
- player[i-howmanyremoved].waypointtype[j] = wpkeepwalking;
- }
-
- funpackf(tfile, "Bi", &player[i-howmanyremoved].waypoint);
- if(player[i-howmanyremoved].waypoint>player[i-howmanyremoved].numwaypoints-1)
- player[i-howmanyremoved].waypoint=0;
-
- funpackf(tfile, "Bf Bf Bf", &player[i-howmanyremoved].armorhead, &player[i-howmanyremoved].armorhigh, &player[i-howmanyremoved].armorlow);
- funpackf(tfile, "Bf Bf Bf", &player[i-howmanyremoved].protectionhead, &player[i-howmanyremoved].protectionhigh, &player[i-howmanyremoved].protectionlow);
- funpackf(tfile, "Bf Bf Bf", &player[i-howmanyremoved].metalhead, &player[i-howmanyremoved].metalhigh, &player[i-howmanyremoved].metallow);
- funpackf(tfile, "Bf Bf", &player[i-howmanyremoved].power, &player[i-howmanyremoved].speedmult);
-
- if(mapvers>=4)
- funpackf(tfile, "Bf Bf Bf Bf", &headprop, &bodyprop, &armprop, &legprop);
- else{
- headprop=1;
- bodyprop=1;
- armprop=1;
- legprop=1;
- }
- if(player[i-howmanyremoved].creature==wolftype){
- player[i-howmanyremoved].proportionhead=1.1*headprop;
- player[i-howmanyremoved].proportionbody=1.1*bodyprop;
- player[i-howmanyremoved].proportionarms=1.1*armprop;
- player[i-howmanyremoved].proportionlegs=1.1*legprop;
- }
-
- if(player[i-howmanyremoved].creature==rabbittype){
- player[i-howmanyremoved].proportionhead=1.2*headprop;
- player[i-howmanyremoved].proportionbody=1.05*bodyprop;
- player[i-howmanyremoved].proportionarms=1.00*armprop;
- player[i-howmanyremoved].proportionlegs=1.1*legprop;
- player[i-howmanyremoved].proportionlegs.y=1.05*legprop;
- }
-
- funpackf(tfile, "Bi", &player[i-howmanyremoved].numclothes);
- if(player[i-howmanyremoved].numclothes){
- for(int k=0;k<player[i-howmanyremoved].numclothes;k++){
- int templength;
- funpackf(tfile, "Bi", &templength);
- for(int l=0;l<templength;l++)
- funpackf(tfile, "Bb", &player[i-howmanyremoved].clothes[k][l]);
- player[i-howmanyremoved].clothes[k][templength]='\0';
- funpackf(tfile, "Bf Bf Bf", &player[i-howmanyremoved].clothestintr[k], &player[i-howmanyremoved].clothestintg[k], &player[i-howmanyremoved].clothestintb[k]);
- }
- }
- }
- }
- }
- if(visibleloading)
- LoadingScreen();
-
- numplayers-=howmanyremoved;
- funpackf(tfile, "Bi", &numpathpoints);
- if(numpathpoints>30||numpathpoints<0)
- numpathpoints=0;
- for(int j=0;j<numpathpoints;j++){
- funpackf(tfile, "Bf Bf Bf Bi", &pathpoint[j].x,&pathpoint[j].y,&pathpoint[j].z,&numpathpointconnect[j]);
- for(int k=0;k<numpathpointconnect[j];k++){
- funpackf(tfile, "Bi", &pathpointconnect[j][k]);
- }
- }
- if(visibleloading)
- LoadingScreen();
-
- funpackf(tfile, "Bf Bf Bf Bf", &mapcenter.x,&mapcenter.y,&mapcenter.z,&mapradius);
-
- SetUpLighting();
- if(environment!=oldenvironment)
- Setenvironment(environment);
- oldenvironment=environment;
-
- if(!stealthloading){
- int j=objects.numobjects;
- objects.numobjects=0;
- for(int i=0;i<j;i++){
- objects.MakeObject(objects.type[i],objects.position[i],objects.rotation[i],objects.rotation2[i],objects.scale[i]);
- if(visibleloading)
- LoadingScreen();
- }
-
- terrain.DoShadows();
- if(visibleloading)
- LoadingScreen();
- objects.DoShadows();
- if(visibleloading)
- LoadingScreen();
- }
-
- fclose(tfile);
-
- oldlevel=whichlevel;
-
-
- if(numplayers>maxplayers-1)
- numplayers=maxplayers-1;
- for(int i=0;i<numplayers;i++){
- if(visibleloading)
- LoadingScreen();
- player[i].burnt=0;
- player[i].bled=0;
- player[i].onfire=0;
- if(i==0||player[i].scale<0)
- player[i].scale=.2;
- player[i].skeleton.free=0;
- player[i].skeleton.id=i;
- if(i==0&&mapvers<9)
- player[i].creature=rabbittype;
- if(player[i].creature!=wolftype){
- player[i].skeleton.Load(
- (char *)":Data:Skeleton:Basic Figure",
- (char *)":Data:Skeleton:Basic Figurelow",
- (char *)":Data:Skeleton:Rabbitbelt",
- (char *)":Data:Models:Body.solid",
- (char *)":Data:Models:Body2.solid",
- (char *)":Data:Models:Body3.solid",
- (char *)":Data:Models:Body4.solid",
- (char *)":Data:Models:Body5.solid",
- (char *)":Data:Models:Body6.solid",
- (char *)":Data:Models:Body7.solid",
- (char *)":Data:Models:Bodylow.solid",
- (char *)":Data:Models:Belt.solid",0);
- }else{
- if(player[i].creature!=wolftype){
- player[i].skeleton.Load(
- (char *)":Data:Skeleton:Basic Figure",
- (char *)":Data:Skeleton:Basic Figurelow",
- (char *)":Data:Skeleton:Rabbitbelt",
- (char *)":Data:Models:Body.solid",
- (char *)":Data:Models:Body2.solid",
- (char *)":Data:Models:Body3.solid",
- (char *)":Data:Models:Body4.solid",
- (char *)":Data:Models:Body5.solid",
- (char *)":Data:Models:Body6.solid",
- (char *)":Data:Models:Body7.solid",
- (char *)":Data:Models:Bodylow.solid",
- (char *)":Data:Models:Belt.solid",1);
- LoadTexture(":Data:Textures:Belt.png",&player[i].skeleton.drawmodelclothes.textureptr,1,1);
- }
- if(player[i].creature==wolftype){
- player[i].skeleton.Load(
- (char *)":Data:Skeleton:Basic Figure Wolf",
- (char *)":Data:Skeleton:Basic Figure Wolf Low",
- (char *)":Data:Skeleton:Rabbitbelt",
- (char *)":Data:Models:Wolf.solid",
- (char *)":Data:Models:Wolf2.solid",
- (char *)":Data:Models:Wolf3.solid",
- (char *)":Data:Models:Wolf4.solid",
- (char *)":Data:Models:Wolf5.solid",
- (char *)":Data:Models:Wolf6.solid",
- (char *)":Data:Models:Wolf7.solid",
- (char *)":Data:Models:Wolflow.solid",
- (char *)":Data:Models:Belt.solid",0);
- }
- }
-
-
- 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(player[i].numclothes){
- for(int j=0;j<player[i].numclothes;j++){
- tintr=player[i].clothestintr[j];
- tintg=player[i].clothestintg[j];
- tintb=player[i].clothestintb[j];
- AddClothes((char *)player[i].clothes[j],&player[i].skeleton.skinText[0]);
- }
- player[i].DoMipmaps();
- }
-
- player[i].currentanimation=bounceidleanim;
- player[i].targetanimation=bounceidleanim;
- player[i].currentframe=0;
- player[i].targetframe=1;
- player[i].target=0;
- player[i].speed=1+(float)(Random()%100)/1000;
- if(difficulty==0)
- player[i].speed-=.2;
- if(difficulty==1)
- player[i].speed-=.1;
-
- player[i].velocity=0;
- player[i].oldcoords=player[i].coords;
- player[i].realoldcoords=player[i].coords;
-
- player[i].id=i;
- player[i].skeleton.id=i;
- player[i].updatedelay=0;
- player[i].normalsupdatedelay=0;
-
- player[i].aitype=passivetype;
- player[i].madskills=0;
-
- if(i==0){
- player[i].proportionhead=1.2;
- player[i].proportionbody=1.05;
- player[i].proportionarms=1.00;
- player[i].proportionlegs=1.1;
- player[i].proportionlegs.y=1.05;
- }
- player[i].headless=0;
- player[i].currentoffset=0;
- player[i].targetoffset=0;
-
- player[i].damagetolerance=200;
-
- if(player[i].creature==wolftype){
- if(i==0||player[i].scale<0)
- player[i].scale=.23;
- player[i].damagetolerance=300;
- }
-
- if(visibleloading)
- LoadingScreen();
- if(cellophane){
- player[i].proportionhead.z=0;
- player[i].proportionbody.z=0;
- player[i].proportionarms.z=0;
- player[i].proportionlegs.z=0;
- }
-
- player[i].tempanimation.Load((char *)"Tempanim",0,0);
-
- player[i].headmorphness=0;
- player[i].targetheadmorphness=1;
- player[i].headmorphstart=0;
- player[i].headmorphend=0;
-
- player[i].pausetime=0;
-
- player[i].dead=0;
- player[i].jumppower=5;
- player[i].damage=0;
- player[i].permanentdamage=0;
- player[i].superpermanentdamage=0;
-
- player[i].forwardkeydown=0;
- player[i].leftkeydown=0;
- player[i].backkeydown=0;
- player[i].rightkeydown=0;
- player[i].jumpkeydown=0;
- player[i].crouchkeydown=0;
- player[i].throwkeydown=0;
-
- player[i].collided=-10;
- player[i].loaded=1;
- player[i].bloodloss=0;
- player[i].weaponactive=-1;
- player[i].weaponstuck=-1;
- player[i].bleeding=0;
- player[i].deathbleeding=0;
- player[i].stunned=0;
- player[i].hasvictim=0;
- player[i].wentforweapon=0;
- }
-
- player[0].aitype=playercontrolled;
- player[0].weaponactive=-1;
-
- if(difficulty==1)
- player[0].power=1/.9;
-
- if(difficulty==0)
- player[0].power=1/.8;
-
- if(difficulty==1)
- player[0].damagetolerance=250;
- if(difficulty==0)
- player[0].damagetolerance=300;
- if(difficulty==0)
- player[0].armorhead*=1.5;
- if(difficulty==0)
- player[0].armorhigh*=1.5;
- if(difficulty==0)
- player[0].armorlow*=1.5;
- cameraloc=player[0].coords;
- cameraloc.y+=5;
- rotation=player[0].rotation;
-
- hawkcoords=player[0].coords;
- hawkcoords.y+=30;
-
- if(visibleloading)
- LoadingScreen();
- for(int i=0;i<weapons.numweapons;i++){
- weapons.bloody[i]=0;
- weapons.blooddrip[i]=0;
- weapons.blooddripdelay[i]=0;
- weapons.onfire[i]=0;
- weapons.flamedelay[i]=0;
- weapons.damage[i]=0;
- if(weapons.type[i]==sword){
- weapons.mass[i]=1.5;
- weapons.tipmass[i]=1;
- weapons.length[i]=.8;
- }
- if(weapons.type[i]==staff){
- weapons.mass[i]=2;
- weapons.tipmass[i]=1;
- weapons.length[i]=1.5;
- }
- if(weapons.type[i]==knife){
- weapons.mass[i]=1;
- weapons.tipmass[i]=1.2;
- weapons.length[i]=.25;
- }
- weapons.position[i]=-1000;
- weapons.tippoint[i]=-1000;
- }
-
- LOG("Starting background music...");
-
- OPENAL_StopSound(OPENAL_ALL);
- if(environment==snowyenvironment){
- if(ambientsound)
- emit_stream_np(stream_wind);
- }else if(environment==desertenvironment){
- if(ambientsound)
- emit_stream_np(stream_desertambient);
- }else if(environment==grassyenvironment){
- if(ambientsound)
- emit_stream_np(stream_wind, 100.);
- }
- oldmusicvolume[0]=0;
- oldmusicvolume[1]=0;
- oldmusicvolume[2]=0;
- oldmusicvolume[3]=0;
-
- if(!firstload)
- firstload=1;
- }
- leveltime=0;
- loadingstuff=0;
- visibleloading=0;
-}
-
-
-
-/*
-Values of mainmenu :
-1 Main menu
-2 Menu pause (resume/end game)
-3 Option menu
-4 Controls configuration menu
-5 Main game menu (choose level or challenge)
-6 Deleting user menu
-7 User managment menu (select/add)
-8 Choose difficulty menu
-9 Challenge level selection menu
-10 End of the campaign congratulation (is that really a menu?)
-11 Same that 9 ??? => unused
-18 stereo configuration
-*/
-
-void Game::MenuTick(){
- //menu buttons
- switch(mainmenu){
- case 1:
- case 2:
- if(Input::MouseClicked()&&selected==1){
- if(gameon) {
- //resume
- mainmenu=0;
- pause_sound(stream_menutheme);
- resume_stream(leveltheme);
- } else {
- fireSound(firestartsound);
- flash();
- //new game
- mainmenu=(accountactive?5:7);
- selected=-1;