- temptexdetail=texdetail;
- if(texdetail>1)texdetail=4;
- skybox.load( ":Data:Textures:Skybox(snow):Front.jpg",
- ":Data:Textures:Skybox(snow):Left.jpg",
- ":Data:Textures:Skybox(snow):Back.jpg",
- ":Data:Textures:Skybox(snow):Right.jpg",
- ":Data:Textures:Skybox(snow):Up.jpg",
- ":Data:Textures:Skybox(snow):Down.jpg");
-
-
-
-
- texdetail=temptexdetail;
- }
- if(environment==desertenvironment){
- windvector=0;
- windvector.z=2;
- LoadTexture(":Data:Textures:deserttree.png",&objects.treetextureptr,0,1);
- LoadTexture(":Data:Textures:bushdesert.png",&objects.bushtextureptr,0,1);
- LoadTexture(":Data:Textures:boulderdesert.jpg",&objects.rocktextureptr,1,0);
- LoadTexture(":Data:Textures:desertbox.jpg",&objects.boxtextureptr,1,0);
-
-
- if(ambientsound)
- emit_stream_np(stream_desertambient);
-
- footstepsound = footstepsn1;
- footstepsound2 = footstepsn2;
- footstepsound3 = footstepsn1;
- footstepsound4 = footstepsn2;
-
- LoadTexture(":Data:Textures:sand.jpg",&terraintexture,1,0);
-
- LoadTexture(":Data:Textures:sandslope.jpg",&terraintexture2,1,0);
-
- //LoadTexture(":Data:Textures:detailgrain.png",&terraintexture3,1);
-
-
-
- temptexdetail=texdetail;
- if(texdetail>1)texdetail=4;
- skybox.load( ":Data:Textures:Skybox(sand):Front.jpg",
- ":Data:Textures:Skybox(sand):Left.jpg",
- ":Data:Textures:Skybox(sand):Back.jpg",
- ":Data:Textures:Skybox(sand):Right.jpg",
- ":Data:Textures:Skybox(sand):Up.jpg",
- ":Data:Textures:Skybox(sand):Down.jpg");
-
-
-
-
- texdetail=temptexdetail;
- }
- if(environment==grassyenvironment){
- windvector=0;
- windvector.z=2;
- LoadTexture(":Data:Textures:tree.png",&objects.treetextureptr,0,1);
- LoadTexture(":Data:Textures:bush.png",&objects.bushtextureptr,0,1);
- LoadTexture(":Data:Textures:boulder.jpg",&objects.rocktextureptr,1,0);
- LoadTexture(":Data:Textures:grassbox.jpg",&objects.boxtextureptr,1,0);
-
- if(ambientsound)
- emit_stream_np(stream_wind, 100.);
-
- footstepsound = footstepgr1;
- footstepsound2 = footstepgr2;
- footstepsound3 = footstepst1;
- footstepsound4 = footstepst2;
-
- LoadTexture(":Data:Textures:grassdirt.jpg",&terraintexture,1,0);
-
- LoadTexture(":Data:Textures:mossrock.jpg",&terraintexture2,1,0);
-
- //LoadTexture(":Data:Textures:detail.png",&terraintexture3,1);
-
-
-
- temptexdetail=texdetail;
- if(texdetail>1)texdetail=4;
- skybox.load( ":Data:Textures:Skybox(grass):Front.jpg",
- ":Data:Textures:Skybox(grass):Left.jpg",
- ":Data:Textures:Skybox(grass):Back.jpg",
- ":Data:Textures:Skybox(grass):Right.jpg",
- ":Data:Textures:Skybox(grass):Up.jpg",
- ":Data:Textures:Skybox(grass):Down.jpg");
-
-
-
- texdetail=temptexdetail;
- }
- temptexdetail=texdetail;
- texdetail=1;
- terrain.load(":Data:Textures:heightmap.png");
-
- texdetail=temptexdetail;
-}
-
-
-void Game::Loadlevel(int which){
- stealthloading=0;
- whichlevel=which;
-
- if (which == -1) {
- tutoriallevel = -1;
- Loadlevel("tutorial");
- } else if (which >= 0 && which <= 15) {
- char buf[32];
- snprintf(buf, 32, "map%d", which + 1);
- Loadlevel(buf);
- } else
- Loadlevel("mapsave");
-}
-
-void Game::Loadlevel(const char *name){
- static int oldlevel;
- int templength;
- float lamefloat;
- int lameint;
- static const char *pfx = ":Data:Maps:";
- char *buf;
-
- float headprop,legprop,armprop,bodyprop;
-
- LOGFUNC;
-
- LOG(std::string("Loading level...") + name);
-
- if(!gameon)visibleloading=1;
-
- if(stealthloading)visibleloading=0;
-
- if(!stillloading)loadtime=0;
- gamestarted=1;
-
- numenvsounds=0;
- //visibleloading=1;
- if(tutoriallevel!=-1)tutoriallevel=0;
- else tutoriallevel=1;
-
- if(tutoriallevel==1)tutorialstage=0;
- if(tutorialstage==0){
- tutorialstagetime=0;
- tutorialmaxtime=1;
- }
- loadingstuff=1;
- if(!firstload){
- oldlevel=50;
- }
- pause_sound(whooshsound);
- pause_sound(stream_firesound);
-
- // Change the map filename into something that is os specific
- buf = (char*) alloca(strlen(pfx) + strlen(name) + 1);
- sprintf(buf, "%s%s", pfx, name);
- const char *FixedFN = ConvertFileName(buf);
-
- int mapvers;
- FILE *tfile;
- tfile=fopen( FixedFN, "rb" );
- if(tfile)
- {
- pause_sound(stream_firesound);
-
-
- scoreadded=0;
- windialogue=0;
-
- hostiletime=0;
-
- won=0;
-
- //campaign=0;
- animation[bounceidleanim].Load((char *)"Idle",middleheight,neutral);
-
- numdialogues=0;
-
- for(int i=0;i<20;i++)
- {
- dialoguegonethrough[i]=0;
- }
-
- indialogue=-1;
- cameramode=0;
-
- damagedealt=0;
- damagetaken=0;
-
- if(accountactive)difficulty=accountactive->getDifficulty();
-
- if(difficulty!=2)minimap=1;
- else minimap=0;
-
- numhotspots=0;
- currenthotspot=-1;
- bonustime=1;
-
- skyboxtexture=1;
- skyboxr=1;
- skyboxg=1;
- skyboxb=1;
-
- freeze=0;
- winfreeze=0;
-
- for(int i=0;i<100;i++)
- {
- bonusnum[i]=0;
- }
-
- numfalls=0;
- numflipfail=0;
- numseen=0;
- numstaffattack=0;
- numswordattack=0;
- numknifeattack=0;
- numunarmedattack=0;
- numescaped=0;
- numflipped=0;
- numwallflipped=0;
- numthrowkill=0;
- numafterkill=0;
- numreversals=0;
- numattacks=0;
- maxalarmed=0;
- numresponded=0;
-
- bonustotal=startbonustotal;
- bonus=0;
- gameon=1;
- changedelay=0;
- if(console)
- {
- emit_sound_np(consolesuccesssound);
- freeze=0;
- console=0;
- }
-
- if(!stealthloading)
- {
- terrain.numdecals=0;
- Sprite::deleteSprites();
- for(int i=0;i<objects.numobjects;i++)
- {
- objects.model[i].numdecals=0;
- }
-
- int j=objects.numobjects;
- for(int i=0;i<j;i++)
- {
- objects.DeleteObject(0);
- if(visibleloading){loadscreencolor=4; LoadingScreen();}
- }
-
- for(int i=0;i<subdivision;i++)
- {
- for(int j=0;j<subdivision;j++)
- {
- terrain.patchobjectnum[i][j]=0;
- }
- }
- if(visibleloading){loadscreencolor=4; LoadingScreen();}
- }
-
- weapons.numweapons=0;
-
- funpackf(tfile, "Bi", &mapvers);
- if(mapvers>=15)funpackf(tfile, "Bi", &indemo);
- else indemo=0;
- if(mapvers>=5)funpackf(tfile, "Bi", &maptype);
- else maptype=mapkilleveryone;
- if(mapvers>=6)funpackf(tfile, "Bi", &hostile);
- else hostile=1;
- if(mapvers>=4)funpackf(tfile, "Bf Bf", &viewdistance, &fadestart);
- else
- {
- viewdistance=100;
- fadestart=.6;
- }
- if(mapvers>=2)funpackf(tfile, "Bb Bf Bf Bf", &skyboxtexture, &skyboxr, &skyboxg, &skyboxb);
- else
- {
- skyboxtexture=1;
- skyboxr=1;
- skyboxg=1;
- skyboxb=1;
- }
- if(mapvers>=10)funpackf(tfile, "Bf Bf Bf", &skyboxlightr, &skyboxlightg, &skyboxlightb);
- else
- {
- skyboxlightr=skyboxr;
- skyboxlightg=skyboxg;
- skyboxlightb=skyboxb;
- }
- if(!stealthloading)funpackf(tfile, "Bf Bf Bf Bf Bf Bi", &player[0].coords.x,&player[0].coords.y,&player[0].coords.z,&player[0].rotation,&player[0].targetrotation, &player[0].num_weapons);
- if(stealthloading)funpackf(tfile, "Bf Bf Bf Bf Bf Bi", &lamefloat,&lamefloat,&lamefloat,&lamefloat,&lamefloat, &player[0].num_weapons);
- player[0].originalcoords=player[0].coords;
- if(player[0].num_weapons>0&&player[0].num_weapons<5)
- {
- for(int j=0;j<player[0].num_weapons;j++)
- {
- player[0].weaponids[j]=weapons.numweapons;
- funpackf(tfile, "Bi", &weapons.type[weapons.numweapons]);
- weapons.owner[weapons.numweapons]=0;
- weapons.numweapons++;
- }
- }
-
- if(visibleloading){loadscreencolor=4; LoadingScreen();}
-
- funpackf(tfile, "Bf Bf Bf", &player[0].armorhead, &player[0].armorhigh, &player[0].armorlow);
- funpackf(tfile, "Bf Bf Bf", &player[0].protectionhead, &player[0].protectionhigh, &player[0].protectionlow);
- funpackf(tfile, "Bf Bf Bf", &player[0].metalhead, &player[0].metalhigh, &player[0].metallow);
- funpackf(tfile, "Bf Bf", &player[0].power, &player[0].speedmult);
-
- funpackf(tfile, "Bi", &player[0].numclothes);
-
- if(mapvers>=9)
- {
- funpackf(tfile, "Bi Bi", &player[0].whichskin, &player[0].creature);
- }
- else
- {
- player[0].whichskin=0;
- player[0].creature=rabbittype;
- }
-
- player[0].lastattack=-1;
- player[0].lastattack2=-1;
- player[0].lastattack3=-1;
-
- if(mapvers>=8)
- {
- funpackf(tfile, "Bi", &numdialogues);
- if(numdialogues)
- {
- for(int k=0;k<numdialogues;k++)
- {
- funpackf(tfile, "Bi", &numdialogueboxes[k]);
- funpackf(tfile, "Bi", &dialoguetype[k]);
- for(int l=0;l<10;l++)
- {
- funpackf(tfile, "Bf Bf Bf", &participantlocation[k][l].x, &participantlocation[k][l].y, &participantlocation[k][l].z);
- funpackf(tfile, "Bf", &participantrotation[k][l]);
- }
- if(numdialogueboxes)
- {
- for(int l=0;l<numdialogueboxes[k];l++)
- {
- funpackf(tfile, "Bi", &dialogueboxlocation[k][l]);
- funpackf(tfile, "Bf", &dialogueboxcolor[k][l][0]);
- funpackf(tfile, "Bf", &dialogueboxcolor[k][l][1]);
- 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;
- int m;
- for(m=0;m<templength;m++){
- funpackf(tfile, "Bb", &dialoguetext[k][l][m]);
- if(dialoguetext[k][l][m]=='\0')break;
- }
- dialoguetext[k][l][m] = 0;
-
- funpackf(tfile, "Bi",&templength);
- if(templength>64||templength<=0)templength=64;
- for(m=0;m<templength;m++){
- funpackf(tfile, "Bb", &dialoguename[k][l][m]);
- if(dialoguename[k][l][m]=='\0'){
- break;
- }
- }
- dialoguename[k][l][m] = 0;
- funpackf(tfile, "Bf Bf Bf", &dialoguecamera[k][l].x, &dialoguecamera[k][l].y, &dialoguecamera[k][l].z);
- funpackf(tfile, "Bi", &participantfocus[k][l]);
- funpackf(tfile, "Bi", &participantaction[k][l]);
-
- for(m=0;m<10;m++)
- funpackf(tfile, "Bf Bf Bf", &participantfacing[k][l][m].x, &participantfacing[k][l][m].y, &participantfacing[k][l][m].z);
-
- funpackf(tfile, "Bf Bf",&dialoguecamerarotation[k][l],&dialoguecamerarotation2[k][l]);
- }
- }
- }
- }
- }
- else numdialogues=0;
-
- if(player[0].numclothes)
- {
- for(int k=0;k<player[0].numclothes;k++)
- {
- funpackf(tfile, "Bi", &templength);
- for(int l=0;l<templength;l++)
- funpackf(tfile, "Bb", &player[0].clothes[k][l]);
- player[0].clothes[k][templength]='\0';
- funpackf(tfile, "Bf Bf Bf", &player[0].clothestintr[k], &player[0].clothestintg[k], &player[0].clothestintb[k]);
- }
- }
-
- funpackf(tfile, "Bi", &environment);
-
- funpackf(tfile, "Bi", &objects.numobjects);
- if(objects.numobjects)
- {
- for(int i=0;i<objects.numobjects;i++)
- {
- funpackf(tfile, "Bi Bf Bf Bf Bf Bf Bf", &objects.type[i],&objects.rotation[i],&objects.rotation2[i], &objects.position[i].x, &objects.position[i].y, &objects.position[i].z,&objects.scale[i]);
- if(objects.type[i]==treeleavestype)objects.scale[i]=objects.scale[i-1];
- }
- }
-
- if(mapvers>=7)
- {
- funpackf(tfile, "Bi", &numhotspots);
- if(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){loadscreencolor=4; 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){loadscreencolor=4; 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){loadscreencolor=4; 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){loadscreencolor=4; 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){loadscreencolor=4; LoadingScreen();}
-
- numplayers-=howmanyremoved;
- funpackf(tfile, "Bi", &numpathpoints);
- if(numpathpoints>30||numpathpoints<0)
- numpathpoints=0;
- if(numpathpoints)
- {
- 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){loadscreencolor=4; 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++)
- {
- //if(objects.type[i]!=spiketype)
- objects.MakeObject(objects.type[i],objects.position[i],objects.rotation[i],objects.rotation2[i],objects.scale[i]);
- if(visibleloading){loadscreencolor=4; LoadingScreen();}
- }
-
- //if(skyboxtexture){
- terrain.DoShadows();
- if(visibleloading){loadscreencolor=4; LoadingScreen();}
- objects.DoShadows();
- if(visibleloading){loadscreencolor=4; LoadingScreen();}
- /*}
- else terrain.DoLighting();
- */
- }
-
- fclose(tfile);
-
- oldlevel=whichlevel;
-
-
- if(numplayers>maxplayers-1)numplayers=maxplayers-1;
- for(int i=0;i<numplayers;i++)
- {
- if(visibleloading){loadscreencolor=4; 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(Random()%2==0)player[i].creature=wolftype;
- //else player[i].creature=rabbittype;
- 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;
- //if(!player[i].loaded)player[i].skeleton.skinText = new GLubyte[texsize];
- //player[i].skeleton.skinText.resize(texsize);
-
- 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],0,1,&player[i].skeleton.skinText[0],&player[i].skeleton.skinsize);
- }
- 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].armorhead=1;
- player[i].armorhigh=1;
- player[i].armorlow=1;
- player[i].protectionhead=1;
- player[i].protectionhigh=1;
- player[i].protectionlow=1;
- player[i].metalhead=1;
- player[i].metalhigh=1;
- player[i].metallow=1;
- player[i].power=1;
- player[i].speedmult=1;*/
-
- player[i].damagetolerance=200;
-
- if(player[i].creature==wolftype)
- {
- /*player[i].proportionhead=1.1;
- player[i].proportionbody=1.1;
- player[i].proportionarms=1.1;
- player[i].proportionlegs=1.1;
- player[i].proportionlegs.y=1.1;*/
- if(i==0||player[i].scale<0)player[i].scale=.23;
-
- player[i].damagetolerance=300;
- }
-
- if(visibleloading){loadscreencolor=4; 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].speedmult=1/.9;
- player[0].power=1/.9;
- }
-
- if(difficulty==0)
- {
- //player[0].speedmult=1/.8;
- player[0].power=1/.8;
- }
-
- //player[0].weaponstuck=1;
-
- 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){loadscreencolor=4; LoadingScreen();}
- //weapons.numweapons=numplayers;
- 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;
- //weapons.type[i]=sword;
- 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;
-}
-
-
-
-void Game::MenuTick(){
- //menu buttons
- if(mainmenu==1||mainmenu==2){
- if(Input::MouseClicked()&&selected==1){
- if(!gameon){
- fireSound(firestartsound);
- flash();
- //new game
- if(accountactive) {
- mainmenu=5;
- } else {
- mainmenu=7;
- }
- selected=-1;
- }else{
- //resume
- mainmenu=0;
- pause_sound(stream_music3);
- resume_stream(music1);
- }
- }
-
- if(Input::MouseClicked()&&selected==2){
- fireSound();
- flash();
- //options
- mainmenu=3;
- if(newdetail>2)newdetail=detail;
- if(newdetail<0)newdetail=detail;
- if(newscreenwidth>3000)newscreenwidth=screenwidth;
- if(newscreenwidth<0)newscreenwidth=screenwidth;
- if(newscreenheight>3000)newscreenheight=screenheight;
- if(newscreenheight<0)newscreenheight=screenheight;
- }
-
- if(Input::MouseClicked()&&selected==3){
- fireSound();
- flash();
- if(!gameon){
- //quit
- tryquit=1;
- pause_sound(stream_music3);
- }else{
- //end game
- gameon=0;
- mainmenu=1;
- }
- }
- }
- if(mainmenu==3){
- if(Input::MouseClicked()){
-
- if(selected!=-1)
- fireSound();
-
- switch(selected){
- case 0: {
- extern SDL_Rect **resolutions;
- bool isCustomResolution = true;
- bool found = false;
- for(int i = 0; (!found) && (resolutions[i]); i++){
- if((resolutions[i]->w == screenwidth) && (resolutions[i]->h == screenwidth))
- isCustomResolution = false;
-
- if((resolutions[i]->w == newscreenwidth) && (resolutions[i]->h == newscreenheight)){
- i++;
- if(resolutions[i] != NULL){
- newscreenwidth = (int) resolutions[i]->w;
- newscreenheight = (int) resolutions[i]->h;
- }else if(isCustomResolution){
- if((screenwidth == newscreenwidth) && (screenheight == newscreenheight)){
- newscreenwidth = (int) resolutions[0]->w;
- newscreenheight = (int) resolutions[0]->h;
- }else{
- newscreenwidth = screenwidth;
- newscreenheight = screenheight;
- }
- }else{
- newscreenwidth = (int) resolutions[0]->w;
- newscreenheight = (int) resolutions[0]->h;
- }
- found = true;
- }
- }
-
- if(!found){
- newscreenwidth = (int) resolutions[0]->w;
- newscreenheight = (int) resolutions[0]->h;
- }
- } break;
- case 1:
- newdetail++;
- if(newdetail>2)newdetail=0;
- break;
- case 2:
- bloodtoggle++;
- if(bloodtoggle>2)bloodtoggle=0;
- break;
- case 3:
- difficulty++;
- if(difficulty>2)difficulty=0;
- break;
- case 4:
- ismotionblur=1-ismotionblur;
- break;
- case 5:
- decals=1-decals;
- break;
- case 6:
- musictoggle=1-musictoggle;
-
- if(!musictoggle){
- pause_sound(music1);
- pause_sound(stream_music2);
- pause_sound(stream_music3);
-
- for(int i=0;i<4;i++){
- oldmusicvolume[i]=0;
- musicvolume[i]=0;
- }
- }
-
- if(musictoggle)
- emit_stream_np(stream_music3);
- break;
- case 7:
- flash();
- //options
- mainmenu=4;
- selected=-1;
- keyselect=-1;
- break;
- case 8:
- flash();
-
- if(newdetail>2)newdetail=detail;
- if(newdetail<0)newdetail=detail;
- if(newscreenwidth<0)newscreenwidth=screenwidth;
- if(newscreenheight<0)newscreenheight=screenheight;
-
- SaveSettings(*this);
- if(mainmenu==3&&gameon)mainmenu=2;
- if(mainmenu==3&&!gameon)mainmenu=1;
- break;
- case 9:
- invertmouse=1-invertmouse;
- break;
- case 10:
- usermousesensitivity+=.2;
- if(usermousesensitivity>2)usermousesensitivity=.2;
- break;
- case 11:
- volume+=.1f;
- if(volume>1.0001f)volume=0;
- OPENAL_SetSFXMasterVolume((int)(volume*255));
- break;
- case 12:
- flash();
-
- newstereomode = stereomode;
- mainmenu=18;
- keyselect=-1;
- break;
- case 13:
- showdamagebar=!showdamagebar;
- break;
- }
- }
- }
- if(mainmenu==4){
- if(Input::MouseClicked()&&selected!=-1&&!waiting){
- fireSound();
- if(selected<9&&keyselect==-1)
- keyselect=selected;
- if(keyselect!=-1)
- setKeySelected();
- if(selected==9){
- flash();
-
- mainmenu=3;
-
- if(newdetail>2)newdetail=detail;
- if(newdetail<0)newdetail=detail;
- if(newscreenwidth>3000)newscreenwidth=screenwidth;
- if(newscreenwidth<0)newscreenwidth=screenwidth;
- if(newscreenheight>3000)newscreenheight=screenheight;
- if(newscreenheight<0)newscreenheight=screenheight;
- }
- }
- }
-
- if(mainmenu==5){
-
- if(endgame==2){
- accountactive->endGame();
- endgame=0;
- }
-
- if(Input::MouseClicked()){
- if((selected-7>=accountactive->getCampaignChoicesMade())){
- fireSound();
- flash();
- startbonustotal=0;
-
- loading=2;
- loadtime=0;
- targetlevel=7;
- if(firstload) TickOnceAfter();
- else LoadStuff();
- whichchoice=selected-7-accountactive->getCampaignChoicesMade();
- visibleloading=1;
- stillloading=1;
- Loadlevel(campaignmapname[campaignchoicewhich[selected-7-accountactive->getCampaignChoicesMade()]]);
- //Loadlevel(campaignmapname[levelorder[selected-7]]);
- campaign=1;
- mainmenu=0;
- gameon=1;
- pause_sound(stream_music3);
- }
- if(selected>=1 && selected<=5){
- fireSound();
- flash();
- }
- switch(selected){
- case 1:
- startbonustotal=0;
-
- loading=2;
- loadtime=0;
- targetlevel=-1;
- if(firstload)TickOnceAfter();
- if(!firstload)LoadStuff();
- else {
- Loadlevel(-1);
- }
-
- mainmenu=0;
- gameon=1;
- pause_sound(stream_music3);
- break;
- case 2:
- mainmenu=9;
- break;
- case 3:
- mainmenu=6;
- break;
- case 4:
- if(mainmenu==5&&gameon)mainmenu=2;
- if(mainmenu==5&&!gameon)mainmenu=1;
- break;
- case 5:
- mainmenu=7;
- break;