- if(tutoriallevel==1){
- tutorialopac=tutorialmaxtime-tutorialstagetime;
- if(tutorialopac>1)tutorialopac=1;
- if(tutorialopac<0)tutorialopac=0;
-
- sprintf (string, " ");
- sprintf (string2, " ");
- sprintf (string3, " ");
- if(tutorialstage==0){
- sprintf (string, " ");
- sprintf (string2, " ");
- sprintf (string3, " ");
- }
- if(tutorialstage==1){
- sprintf (string, "Welcome to the Lugaru training level!");
- sprintf (string2, " ");
- sprintf (string3, " ");
- }
- if(tutorialstage==2){
- sprintf (string, "BASIC MOVEMENT:");
- sprintf (string2, " ");
- sprintf (string3, " ");
- }
- if(tutorialstage==3){
- sprintf (string, "You can move the mouse to rotate the camera.");
- sprintf (string2, " ");
- sprintf (string3, " ");
- }
- if(tutorialstage==4){
- sprintf (string, "Try using the %s, %s, %s and %s keys to move around.",Input::keyToChar(forwardkey),Input::keyToChar(leftkey),Input::keyToChar(backkey),Input::keyToChar(rightkey));
- sprintf (string2, "All movement is relative to the camera.");
- sprintf (string3, " ");
- }
- if(tutorialstage==5){
- sprintf (string, "Please press %s to jump.",Input::keyToChar(jumpkey));
- sprintf (string2, "You can hold it longer to jump higher.");
- sprintf (string3, " ");
- }
- if(tutorialstage==6){
- sprintf (string, "You can press %s to crouch.",Input::keyToChar(crouchkey));
- sprintf (string2, "You can jump higher from a crouching position.");
- sprintf (string3, " ");
- }
- if(tutorialstage==7){
- sprintf (string, "While running, you can press %s to roll.",Input::keyToChar(crouchkey));
- sprintf (string2, " ");
- sprintf (string3, " ");
- }
- if(tutorialstage==8){
- sprintf (string, "While crouching, you can sneak around silently");
- sprintf (string2, "using the movement keys.");
- sprintf (string3, " ");
- }
- if(tutorialstage==9){
- sprintf (string, "Release the crouch key while sneaking and hold the movement keys");
- sprintf (string2, "to run animal-style.");
- sprintf (string3, " ");
- }
- if(tutorialstage==10){
- sprintf (string, "ADVANCED MOVEMENT:");
- sprintf (string2, " ");
- sprintf (string3, " ");
- }
- if(tutorialstage==11){
- sprintf (string, "When you jump at a wall, you can hold %s again",Input::keyToChar(jumpkey));
- sprintf (string2, "during impact to perform a walljump.");
- sprintf (string3, "Be sure to use the movement keys to press against the wall");
- }
- if(tutorialstage==12){
- sprintf (string, "While in the air, you can press crouch to flip.",Input::keyToChar(jumpkey));
- sprintf (string2, "Walljumps and flips confuse enemies and give you more control.");
- sprintf (string3, " ");
- }
- if(tutorialstage==13){
- sprintf (string, "BASIC COMBAT:");
- sprintf (string2, " ");
- sprintf (string3, " ");
- }
- if(tutorialstage==14){
- sprintf (string, "There is now an imaginary enemy");
- sprintf (string2, "in the middle of the training area.");
- sprintf (string3, " ");
- }
- if(tutorialstage==15){
- if(attackkey==MOUSEBUTTON1)sprintf (string, "Click to attack when you are near an enemy.");
- else sprintf (string, "Press %s to attack when you are near an enemy.",Input::keyToChar(attackkey));
- sprintf (string2, "You can punch by standing still near an enemy and attacking.");
- sprintf (string3, " ");
- }
- if(tutorialstage==16){
- sprintf (string, "If you are close, you will perform a weak punch.");
- sprintf (string2, "The weak punch is excellent for starting attack combinations.");
- sprintf (string3, " ");
- }
- if(tutorialstage==17){
- sprintf (string, "Attacking while running results in a spin kick.");
- sprintf (string2, "This is one of your most powerful ground attacks.");
- sprintf (string3, " ");
- }
- if(tutorialstage==18){
- sprintf (string, "Sweep the enemy's legs out by attacking while crouched.");
- sprintf (string2, "This is a very fast attack, and easy to follow up.");
- sprintf (string3, " ");
- }
- if(tutorialstage==19){
- sprintf (string, "When an enemy is on the ground, you can deal some extra");
- sprintf (string2, "damage by running up and drop-kicking him.");
- sprintf (string3, "(Try knocking them down with a sweep first)");
- }
- if(tutorialstage==20){
- sprintf (string, "Your most powerful individual attack is the rabbit kick.");
- if(attackkey==MOUSEBUTTON1)sprintf (string2, "Run at the enemy while holding the mouse button, and press");
- else sprintf (string2, "Run at the enemy while holding %s, and press", Input::keyToChar(attackkey));
- sprintf (string3, "the jump key (%s) to attack.",Input::keyToChar(jumpkey));
- }
- if(tutorialstage==21){
- sprintf (string, "This attack is devastating if timed correctly.");
- sprintf (string2, "Even if timed incorrectly, it will knock the enemy over.");
- if(againbonus)sprintf (string3, "Try rabbit-kicking the imaginary enemy again.");
- else sprintf (string3, "Try rabbit-kicking the imaginary enemy.");
- }
- if(tutorialstage==22){
- sprintf (string, "If you sneak behind an enemy unnoticed, you can kill");
- sprintf (string2, "him instantly. Move close behind this enemy");
- sprintf (string3, "and attack.");
- }
- if(tutorialstage==23){
- sprintf (string, "Another important attack is the wall kick. When an enemy");
- sprintf (string2, "is near a wall, perform a walljump nearby and hold");
- sprintf (string3, "the attack key during impact with the wall.");
- }
- if(tutorialstage==24){
- sprintf (string, "You can tackle enemies by running at them animal-style");
- if(attackkey==MOUSEBUTTON1)sprintf (string2, "and pressing jump (%s) or attack(mouse button).",Input::keyToChar(jumpkey));
- else sprintf (string2, "and pressing jump (%s) or attack(%s).",Input::keyToChar(jumpkey),Input::keyToChar(attackkey));
- sprintf (string3, "This is especially useful when they are running away.");
- }
- if(tutorialstage==25){
- sprintf (string, "Dodge by pressing back and attack. Dodging is essential");
- sprintf (string2, "against enemies with swords or other long weapons.");
- sprintf (string3, " ");
- }
- if(tutorialstage==26){
- sprintf (string, "REVERSALS AND COUNTER-REVERSALS");
- sprintf (string2, " ");
- sprintf (string3, " ");
- }
- if(tutorialstage==27){
- sprintf (string, "The enemy can now reverse your attacks.");
- sprintf (string2, " ");
- sprintf (string3, " ");
- }
- if(tutorialstage==28){
- sprintf (string, "If you attack, you will notice that the enemy now sometimes");
- sprintf (string2, "catches your attack and uses it against you. Hold");
- sprintf (string3, "crouch (%s) after attacking to escape from reversals.",Input::keyToChar(crouchkey));
- }
- if(tutorialstage==29){
- sprintf (string, "Try escaping from two more reversals in a row.");
- sprintf (string2, " ");
- sprintf (string3, " ");
- }
- if(tutorialstage==30){
- sprintf (string, "Good!");
- sprintf (string2, " ");
- sprintf (string3, " ");
- }
- if(tutorialstage==31){
- sprintf (string, "To reverse an attack, you must tap crouch (%s) during the",Input::keyToChar(crouchkey));
- sprintf (string2, "enemy's attack. You must also be close to the enemy;");
- sprintf (string3, "this is especially important against armed opponents.");
- }
- if(tutorialstage==32){
- sprintf (string, "The enemy can attack in %d seconds.", (int)(tutorialmaxtime-tutorialstagetime));
- sprintf (string2, "This imaginary opponents attacks will be highlighted");
- sprintf (string3, "to make this easier.");
- }
- if(tutorialstage==33){
- sprintf (string, "Reverse three enemy attacks!");
- sprintf (string2, " ");
- sprintf (string3, " ");
- }
- if(tutorialstage==34){
- sprintf (string, "Reverse two more enemy attacks!");
- sprintf (string2, " ");
- sprintf (string3, " ");
- }
- if(tutorialstage==35){
- sprintf (string, "Reverse one more enemy attack!");
- sprintf (string2, " ");
- sprintf (string3, " ");
- }
- if(tutorialstage==36){
- sprintf (string, "Excellent!");
- sprintf (string2, " ");
- sprintf (string3, " ");
- }
- if(tutorialstage==37){
- sprintf (string, "Now spar with the enemy for %d more seconds.", (int)(tutorialmaxtime-tutorialstagetime));
- sprintf (string2, "Damage dealt: %d",(int)damagedealt);
- sprintf (string3, "Damage taken: %d.",(int)damagetaken);
- }
- if(tutorialstage==38){
- sprintf (string, "WEAPONS:");
- sprintf (string2, " ");
- sprintf (string3, " ");
- }
- if(tutorialstage==39){
- sprintf (string, "There is now an imaginary knife");
- sprintf (string2, "in the center of the training area.");
- sprintf (string3, " ");
- }
- if(tutorialstage==40){
- sprintf (string, "Stand, roll or handspring over the knife");
- sprintf (string2, "while pressing %s to pick it up.",Input::keyToChar(throwkey));
- sprintf (string3, "You can crouch and press the same key to drop it again.");
- }
- if(tutorialstage==41){
- sprintf (string, "You can equip and unequip weapons using the %s key.",Input::keyToChar(drawkey));
- sprintf (string2, "Sometimes it is best to keep them unequipped to");
- sprintf (string3, "prevent enemies from taking them. ");
- }
- if(tutorialstage==42){
- sprintf (string, "The knife is the smallest weapon and the least encumbering.");
- sprintf (string2, "You can equip or unequip it while standing, crouching,");
- sprintf (string3, "running or flipping.");
- }
- if(tutorialstage==43){
- sprintf (string, "You perform weapon attacks the same way as unarmed attacks,");
- sprintf (string2, "but sharp weapons cause permanent damage, instead of the");
- sprintf (string3, "temporary trauma from blunt weapons, fists and feet.");
- }
- if(tutorialstage==44){
- sprintf (string, "The enemy now has your knife!");
- sprintf (string2, "Please reverse two of his knife attacks.");
- sprintf (string3, " ");
- }
- if(tutorialstage==45){
- sprintf (string, "Please reverse one more of his knife attacks.");
- sprintf (string2, " ");
- sprintf (string3, " ");
- }
- if(tutorialstage==46){
- sprintf (string, "Now he has a sword!");
- sprintf (string2, "The sword has longer reach than your arms, so you");
- sprintf (string3, "must move close to reverse the sword slash.");
- }
- if(tutorialstage==47){
- sprintf (string, "Long weapons like the sword and staff are also useful for defense;");
- sprintf (string2, "you can parry enemy weapon attacks by pressing the attack key");
- sprintf (string3, "at the right time. Please try parrying the enemy's attacks!");
- }
- if(tutorialstage==48){
- sprintf (string, "The staff is like the sword, but has two main attacks.");
- sprintf (string2, "The standing smash is fast and effective, and the running");
- sprintf (string3, "spin smash is slower and more powerful.");
- }
- if(tutorialstage==49){
- sprintf (string, "When facing an enemy, you can throw the knife with %s.",Input::keyToChar(throwkey));
- sprintf (string2, "It is possible to throw the knife while flipping,");
- sprintf (string3, "but it is very inaccurate.");
- }
- if(tutorialstage==50){
- sprintf (string, "You now know everything you can learn from training.");
- sprintf (string2, "Everything else you must learn from experience!");
- sprintf (string3, " ");
- }
- if(tutorialstage==51){
- sprintf (string, "Walk out of the training area to return to the main menu.");
- sprintf (string2, " ");
- sprintf (string3, " ");
- }
-
- glColor4f(0,0,0,tutorialopac);
- text.glPrintOutline(screenwidth/2-7.6*strlen(string)*screenwidth/1024-4,screenheight/16-4+screenheight*4/5,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
- text.glPrintOutline(screenwidth/2-7.6*strlen(string2)*screenwidth/1024-4,screenheight/16-4+screenheight*4/5-20*screenwidth/1024,string2,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
- text.glPrintOutline(screenwidth/2-7.6*strlen(string3)*screenwidth/1024-4,screenheight/16-4+screenheight*4/5-40*screenwidth/1024,string3,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
- glColor4f(1,1,1,tutorialopac);
- text.glPrint(screenwidth/2-7.6*strlen(string)*screenwidth/1024,screenheight/16+screenheight*4/5,string,1,1.5*screenwidth/1024,screenwidth,screenheight);
- text.glPrint(screenwidth/2-7.6*strlen(string2)*screenwidth/1024,screenheight/16+screenheight*4/5-20*screenwidth/1024,string2,1,1.5*screenwidth/1024,screenwidth,screenheight);
- text.glPrint(screenwidth/2-7.6*strlen(string3)*screenwidth/1024,screenheight/16+screenheight*4/5-40*screenwidth/1024,string3,1,1.5*screenwidth/1024,screenwidth,screenheight);
-
- sprintf (string, "Press 'tab' to skip to the next item.",Input::keyToChar(jumpkey));
- sprintf (string2, "Press escape at any time to");
- sprintf (string3, "pause or exit the tutorial.");
-
- glColor4f(0,0,0,1);
- text.glPrintOutline(screenwidth/2-7.6*strlen(string)*screenwidth/1024*.8-4,0-4+screenheight*1/10,string,1,1.5*1.25*screenwidth/1024*.8,screenwidth,screenheight);
- text.glPrintOutline(screenwidth/2-7.6*strlen(string2)*screenwidth/1024*.8-4,0-4+screenheight*1/10-20*.8*screenwidth/1024,string2,1,1.5*1.25*screenwidth/1024*.8,screenwidth,screenheight);
- text.glPrintOutline(screenwidth/2-7.6*strlen(string3)*screenwidth/1024*.8-4,0-4+screenheight*1/10-40*.8*screenwidth/1024,string3,1,1.5*1.25*screenwidth/1024*.8,screenwidth,screenheight);
- glColor4f(0.5,0.5,0.5,1);
- text.glPrint(screenwidth/2-7.6*strlen(string)*screenwidth/1024*.8,0+screenheight*1/10,string,1,1.5*screenwidth/1024*.8,screenwidth,screenheight);
- text.glPrint(screenwidth/2-7.6*strlen(string2)*screenwidth/1024*.8,0+screenheight*1/10-20*.8*screenwidth/1024,string2,1,1.5*screenwidth/1024*.8,screenwidth,screenheight);
- text.glPrint(screenwidth/2-7.6*strlen(string3)*screenwidth/1024*.8,0+screenheight*1/10-40*.8*screenwidth/1024,string3,1,1.5*screenwidth/1024*.8,screenwidth,screenheight);
- }
- //Hot spots
-
- if(numhotspots&&(bonustime>=1||bonus<=0||bonustime<0)&&!tutoriallevel){
- int closest=-1;
- float closestdist=-1;
- float distance=0;
- closest=currenthotspot;
- for(i=0;i<numhotspots;i++){
- distance=findDistancefast(&player[0].coords,&hotspot[i]);
- if(closestdist==-1||distance<closestdist){
- if(findDistancefast(&player[0].coords,&hotspot[i])<hotspotsize[i]&&((hotspottype[i]<=10&&hotspottype[i]>=0)||(hotspottype[i]<=40&&hotspottype[i]>=20))){
- closestdist=distance;
- closest=i;
- }
- }
- }
- if(closest!=-1)
- currenthotspot=closest;
- if(currenthotspot!=-1){
- if(hotspottype[closest]<=10){
- if(findDistancefast(&player[0].coords,&hotspot[closest])<hotspotsize[closest])
- tutorialstagetime=0;
- tutorialmaxtime=1;
- tutorialopac=tutorialmaxtime-tutorialstagetime;
- if(tutorialopac>1)tutorialopac=1;
- if(tutorialopac<0)tutorialopac=0;
-
- sprintf (string, "%s", hotspottext[closest]);
-
- int lastline = 0;
- int line = 0;
- bool done = false;
- i=0;
- while(!done){
- if(string[i]=='\n'||string[i]>'z'||string[i]<' '||string[i]=='\0'){
- glColor4f(0,0,0,tutorialopac);
- text.glPrintOutline(screenwidth/2-7.6*(i-lastline)*screenwidth/1024-4,screenheight/16-4+screenheight*4/5-20*screenwidth/1024*line,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight,lastline,i);
- glColor4f(1,1,1,tutorialopac);
- text.glPrint(screenwidth/2-7.6*(i-lastline)*screenwidth/1024,screenheight/16+screenheight*4/5-20*screenwidth/1024*line,string,1,1.5*screenwidth/1024,screenwidth,screenheight,lastline,i);
- lastline=i+1;
- line++;
- if(string[i]=='\0')done=1;
- }
- if(i>=255)done=1;
- i++;
- }
- }
- else if (hotspottype[closest]>=20&&dialoguegonethrough[hotspottype[closest]-20]==0){
- whichdialogue=hotspottype[closest]-20;
- for(j=0;j<numdialogueboxes[whichdialogue];j++){
- player[participantfocus[whichdialogue][j]].coords=participantlocation[whichdialogue][participantfocus[whichdialogue][j]];
- player[participantfocus[whichdialogue][j]].rotation=participantrotation[whichdialogue][participantfocus[whichdialogue][j]];
- player[participantfocus[whichdialogue][j]].targetrotation=participantrotation[whichdialogue][participantfocus[whichdialogue][j]];
- player[participantfocus[whichdialogue][j]].velocity=0;
- player[participantfocus[whichdialogue][j]].targetanimation=player[participantfocus[whichdialogue][j]].getIdle();
- player[participantfocus[whichdialogue][j]].targetframe=0;
- }
- directing=0;
- indialogue=0;
- dialoguegonethrough[whichdialogue]++;
- if(dialogueboxsound[whichdialogue][indialogue]!=0){
- int whichsoundplay;
- if(dialogueboxsound[whichdialogue][indialogue]==1)whichsoundplay=rabbitchitter;
- if(dialogueboxsound[whichdialogue][indialogue]==2)whichsoundplay=rabbitchitter2;
- if(dialogueboxsound[whichdialogue][indialogue]==3)whichsoundplay=rabbitpainsound;
- if(dialogueboxsound[whichdialogue][indialogue]==4)whichsoundplay=rabbitpain1sound;
- if(dialogueboxsound[whichdialogue][indialogue]==5)whichsoundplay=rabbitattacksound;
- if(dialogueboxsound[whichdialogue][indialogue]==6)whichsoundplay=rabbitattack2sound;
- if(dialogueboxsound[whichdialogue][indialogue]==7)whichsoundplay=rabbitattack3sound;
- if(dialogueboxsound[whichdialogue][indialogue]==8)whichsoundplay=rabbitattack4sound;
- if(dialogueboxsound[whichdialogue][indialogue]==9)whichsoundplay=growlsound;
- if(dialogueboxsound[whichdialogue][indialogue]==10)whichsoundplay=growl2sound;
- if(dialogueboxsound[whichdialogue][indialogue]==11)whichsoundplay=snarlsound;
- if(dialogueboxsound[whichdialogue][indialogue]==12)whichsoundplay=snarl2sound;
- if(dialogueboxsound[whichdialogue][indialogue]==13)whichsoundplay=barksound;
- if(dialogueboxsound[whichdialogue][indialogue]==14)whichsoundplay=bark2sound;
- if(dialogueboxsound[whichdialogue][indialogue]==15)whichsoundplay=bark3sound;
- if(dialogueboxsound[whichdialogue][indialogue]==16)whichsoundplay=barkgrowlsound;
- if(dialogueboxsound[whichdialogue][indialogue]==-1)whichsoundplay=fireendsound;
- if(dialogueboxsound[whichdialogue][indialogue]==-2)whichsoundplay=firestartsound;
- if(dialogueboxsound[whichdialogue][indialogue]==-3)whichsoundplay=consolesuccesssound;
- if(dialogueboxsound[whichdialogue][indialogue]==-4)whichsoundplay=consolefailsound;
- emit_sound_at(whichsoundplay, player[participantfocus[whichdialogue][indialogue]].coords);
- }
- }
- }
- }
-
- if(indialogue!=-1&&!mainmenu){
- glDisable(GL_DEPTH_TEST); // Disables Depth Testing
- glDisable(GL_CULL_FACE);
- glDisable(GL_LIGHTING);
- glDisable(GL_TEXTURE_2D);
- glDepthMask(0);
- glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
- glPushMatrix(); // Store The Projection Matrix
- glLoadIdentity(); // Reset The Projection Matrix
- glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
- glPushMatrix(); // Store The Modelview Matrix
- glLoadIdentity(); // Reset The Modelview Matrix
- if(dialogueboxlocation[whichdialogue][indialogue]==1)glTranslatef(0,screenheight*3/4,0);
- glScalef(screenwidth,screenheight/4,1);
- glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
-
- glColor4f(dialogueboxcolor[whichdialogue][indialogue][0],dialogueboxcolor[whichdialogue][indialogue][1],dialogueboxcolor[whichdialogue][indialogue][2],0.7);
- glBegin(GL_QUADS);
- glVertex3f(0, 0, 0.0f);
- glVertex3f(1, 0, 0.0f);
- glVertex3f(1, 1, 0.0f);
- glVertex3f(0, 1, 0.0f);
- glEnd();
- glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
- glPopMatrix(); // Restore The Old Projection Matrix
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
- glPopMatrix(); // Restore The Old Projection Matrix
- glEnable(GL_DEPTH_TEST); // Enables Depth Testing
- glEnable(GL_CULL_FACE);
- glDisable(GL_BLEND);
- glDepthMask(1);
- glEnable(GL_TEXTURE_2D);
-
- tutorialopac=1;
-
- float startx;
- float starty;
-
- startx=screenwidth*1/5;
- if(dialogueboxlocation[whichdialogue][indialogue]==1)starty=screenheight/16+screenheight*4/5;
- if(dialogueboxlocation[whichdialogue][indialogue]==2)starty=screenheight*1/5-screenheight/16;
-
- char tempname[264];
- bool goodchar;
- int tempnum=0;
- for(i=0;i<264;i++){
- tempname[i]='\0';
- }
-
- for(i=0;i<(int)strlen(dialoguename[whichdialogue][indialogue]);i++){
- tempname[tempnum]=dialoguename[whichdialogue][indialogue][i];
- goodchar=1;
- if(dialoguename[whichdialogue][indialogue][i]=='#'||dialoguename[whichdialogue][indialogue][i]=='\0')goodchar=0;
- if(goodchar)
- tempnum++;
- else
- tempname[tempnum]='\0';
- }
-
- sprintf (string, "%s: ", tempname);
-
- if(dialogueboxcolor[whichdialogue][indialogue][0]+dialogueboxcolor[whichdialogue][indialogue][1]+dialogueboxcolor[whichdialogue][indialogue][2]<1.5){
- glColor4f(0,0,0,tutorialopac);
- text.glPrintOutline(startx-2*7.6*strlen(string)*screenwidth/1024-4,starty-4,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
- glColor4f(0.7,0.7,0.7,tutorialopac);
- text.glPrint(startx-2*7.6*strlen(string)*screenwidth/1024,starty,string,1,1.5*screenwidth/1024,screenwidth,screenheight);
- }
- else
- {
- glColor4f(0,0,0,tutorialopac);
- text.glPrintOutline(startx-2*7.6*strlen(string)*screenwidth/1024-4,starty-4,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
- }
-
- tempnum=0;
- for(i=0;i<(int)strlen(dialoguetext[whichdialogue][indialogue])+1;i++){
- tempname[tempnum]=dialoguetext[whichdialogue][indialogue][i];
- if(dialoguetext[whichdialogue][indialogue][i]!='#')tempnum++;
- }
-
- sprintf (string, "%s", tempname);
-
- int lastline = 0;
- int line = 0;
- bool done = false;
- i=0;
- while(!done){
- if(string[i]=='\n'||string[i]>'z'||string[i]<' '||string[i]=='\0'){
- if(dialogueboxcolor[whichdialogue][indialogue][0]+dialogueboxcolor[whichdialogue][indialogue][1]+dialogueboxcolor[whichdialogue][indialogue][2]<1.5){
- glColor4f(0,0,0,tutorialopac);
- text.glPrintOutline(startx/*-7.6*(i-lastline)*screenwidth/1024*/-4,starty-4-20*screenwidth/1024*line,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight,lastline,i);
- glColor4f(1,1,1,tutorialopac);
- text.glPrint(startx/*-7.6*(i-lastline)*screenwidth/1024*/,starty-20*screenwidth/1024*line,string,1,1.5*screenwidth/1024,screenwidth,screenheight,lastline,i);
- }
- else
- {
- glColor4f(0,0,0,tutorialopac);
- text.glPrint(startx/*-7.6*(i-lastline)*screenwidth/1024*/,starty-20*screenwidth/1024*line,string,1,1.5*screenwidth/1024,screenwidth,screenheight,lastline,i);
- }
- lastline=i+1;
- line++;
- if(string[i]=='\0')done=1;
- }
- if(i>=255)done=1;
- i++;
- }
- }
-
- if(!tutoriallevel&&!winfreeze&&indialogue==-1&&!mainmenu){
- if(campaign){
- if(scoreadded)
- sprintf (string, "Score: %d", (int)accountactive->getCampaignScore());
- else
- sprintf (string, "Score: %d", (int)accountactive->getCampaignScore()+(int)bonustotal);
- }
- if(!campaign)sprintf (string, "Score: %d", (int)bonustotal);
- glColor4f(0,0,0,1);
- text.glPrintOutline(1024/40-4,768/16-4+768*14/16,string,1,1.5*1.25,1024,768);
- glColor4f(1,0,0,1);
- text.glPrint(1024/40,768/16+768*14/16,string,1,1.5,1024,768);
- if(showdamagebar) {
- glDisable(GL_DEPTH_TEST); // Disables Depth Testing
- glDisable(GL_CULL_FACE);
- glDisable(GL_LIGHTING);
- glDisable(GL_TEXTURE_2D);
- glDepthMask(0);
- glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
- glPushMatrix(); // Store The Projection Matrix
- glLoadIdentity(); // Reset The Projection Matrix
- glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
- glPushMatrix(); // Store The Modelview Matrix
- glLoadIdentity(); // Reset The Modelview Matrix
- glTranslatef(15,screenheight*17.5/20,0);
- glScalef(screenwidth/3+20,screenheight/20,1);
- glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
- glColor4f(0.0,0.4,0.0,0.7);
- float bar=((float)player[0].damage)/player[0].damagetolerance;
- glBegin(GL_QUADS);
- glVertex3f((bar<1?bar:1),0,0.0f);
- glVertex3f(1,0,0.0f);
- glVertex3f(1,1,0.0f);
- glVertex3f((bar<1?bar:1),1,0.0f);
- glEnd();
- glColor4f(0.1,0.0,0.0,1);
- bar = ((float)player[0].bloodloss)/player[0].damagetolerance;
- glBegin(GL_QUADS);
- glVertex3f(0,0,0.0f);
- glVertex3f((bar<1?bar:1),0,0.0f);
- glVertex3f((bar<1?bar:1),1,0.0f);
- glVertex3f(0,1,0.0f);
- glEnd();
- glColor4f(0.4,0.0,0.0,0.7);
- bar = ((float)player[0].damage)/player[0].damagetolerance;
- glBegin(GL_QUADS);
- glVertex3f(0,0,0.0f);
- glVertex3f((bar<1?bar:1),0,0.0f);
- glVertex3f((bar<1?bar:1),1,0.0f);
- glVertex3f(0,1,0.0f);
- glEnd();
- glColor4f(0.4,0.0,0.0,0.7);
- bar = ((float)player[0].permanentdamage)/player[0].damagetolerance;
- glBegin(GL_QUADS);
- glVertex3f(0,0,0.0f);
- glVertex3f((bar<1?bar:1),0,0.0f);
- glVertex3f((bar<1?bar:1),1,0.0f);
- glVertex3f(0,1,0.0f);
- glEnd();
- glColor4f(0.4,0.0,0.0,0.7);
- bar = ((float)player[0].superpermanentdamage)/player[0].damagetolerance;
- glBegin(GL_QUADS);
- glVertex3f(0,0,0.0f);
- glVertex3f((bar<1?bar:1),0,0.0f);
- glVertex3f((bar<1?bar:1),1,0.0f);
- glVertex3f(0,1,0.0f);
- glEnd();
- glColor4f(0.0,0.0,0.0,0.7);
- glLineWidth(2.0);
- glBegin(GL_LINE_STRIP);
- glVertex3f(0,0,0.0f);
- glVertex3f(1,0,0.0f);
- glVertex3f(1,1,0.0f);
- glVertex3f(0,1,0.0f);
- glVertex3f(0,0,0.0f);
- glEnd();
-
- glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
- glPopMatrix(); // Restore The Old Projection Matrix
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
- glPopMatrix(); // Restore The Old Projection Matrix
- glEnable(GL_DEPTH_TEST); // Enables Depth Testing
- glEnable(GL_CULL_FACE);
- glDisable(GL_BLEND);
- glDepthMask(1);
- glEnable(GL_TEXTURE_2D);
-
- // writing the numbers :
- sprintf (string, "Damages : %d/%d (%d)",(int)(player[0].damage),(int)(player[0].damagetolerance),(int)(player[0].bloodloss));
- glColor4f(0,0,0,1);
- text.glPrintOutline(1024/40-4,768/16-4+768*14/16-40,string,1,1.5*1.25,1024,768);
- glColor4f(1,0,0,1);
- text.glPrint(1024/40,768/16+768*14/16-40,string,1,1.5,1024,768);
- }
- }
-
- glColor4f(.5,.5,.5,1);
-
-
- if((texttoggle||editorenabled)&&debugmode&&!mainmenu){
- sprintf (string, "The framespersecond is %d.",(int)(fps));
- text.glPrint(10,30,string,0,.8,1024,768);
-
- sprintf (string, "Name: %s", registrationname);
- text.glPrint(10,260,string,0,.8,1024,768);
-
-
- if(editorenabled)
- sprintf (string, "Map editor enabled.");
- else
- sprintf (string, "Map editor disabled.");
- text.glPrint(10,60,string,0,.8,1024,768);
- if(editorenabled){
- sprintf (string, "Object size: %f",editorsize);
- text.glPrint(10,75,string,0,.8,1024,768);
- if(editorrotation>=0)sprintf (string, "Object rotation: %f",editorrotation);
- else sprintf (string, "Object rotation: Random");
- text.glPrint(10,90,string,0,.8,1024,768);
- if(editorrotation2>=0)sprintf (string, "Object rotation2: %f",editorrotation2);
- else sprintf (string, "Object rotation2: Random");
- text.glPrint(10,105,string,0,.8,1024,768);
- sprintf (string, "Object type: %d",editortype);
- text.glPrint(10,120,string,0,.8,1024,768);
- switch(editortype) {
- case boxtype:
- sprintf (string, "(box)");
- break;
- case treetrunktype:
- sprintf (string, "(tree)");
- break;
- case walltype:
- sprintf (string, "(wall)");
- break;
- case weirdtype:
- sprintf (string, "(weird)");
- break;
- case spiketype:
- sprintf (string, "(spike)");
- break;
- case rocktype:
- sprintf (string, "(rock)");
- break;
- case bushtype:
- sprintf (string, "(bush)");
- break;
- case tunneltype:
- sprintf (string, "(tunnel)");
- break;
- case chimneytype:
- sprintf (string, "(chimney)");
- break;
- case platformtype:
- sprintf (string, "(platform)");
- break;
- case cooltype:
- sprintf (string, "(cool)");
- break;
- case firetype:
- sprintf (string, "(fire)");
- break;
- }
- text.glPrint(130,120,string,0,.8,1024,768);
-
- sprintf (string, "Numplayers: %d",numplayers);
- text.glPrint(10,155,string,0,.8,1024,768);
- sprintf (string, "Player %d: numwaypoints: %d",numplayers,player[numplayers-1].numwaypoints);
- text.glPrint(10,140,string,0,.8,1024,768);
- }
- sprintf (string, "Difficulty: %d",difficulty);
- text.glPrint(10,240,string,0,.8,1024,768);
-
- }
+ if(tutoriallevel==1){
+ tutorialopac=tutorialmaxtime-tutorialstagetime;
+ if(tutorialopac>1)tutorialopac=1;
+ if(tutorialopac<0)tutorialopac=0;
+
+ sprintf (string, " ");
+ sprintf (string2, " ");
+ sprintf (string3, " ");
+ if(tutorialstage==0){
+ sprintf (string, " ");
+ sprintf (string2, " ");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==1){
+ sprintf (string, "Welcome to the Lugaru training level!");
+ sprintf (string2, " ");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==2){
+ sprintf (string, "BASIC MOVEMENT:");
+ sprintf (string2, " ");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==3){
+ sprintf (string, "You can move the mouse to rotate the camera.");
+ sprintf (string2, " ");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==4){
+ sprintf (string, "Try using the %s, %s, %s and %s keys to move around.",Input::keyToChar(forwardkey),Input::keyToChar(leftkey),Input::keyToChar(backkey),Input::keyToChar(rightkey));
+ sprintf (string2, "All movement is relative to the camera.");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==5){
+ sprintf (string, "Please press %s to jump.",Input::keyToChar(jumpkey));
+ sprintf (string2, "You can hold it longer to jump higher.");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==6){
+ sprintf (string, "You can press %s to crouch.",Input::keyToChar(crouchkey));
+ sprintf (string2, "You can jump higher from a crouching position.");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==7){
+ sprintf (string, "While running, you can press %s to roll.",Input::keyToChar(crouchkey));
+ sprintf (string2, " ");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==8){
+ sprintf (string, "While crouching, you can sneak around silently");
+ sprintf (string2, "using the movement keys.");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==9){
+ sprintf (string, "Release the crouch key while sneaking and hold the movement keys");
+ sprintf (string2, "to run animal-style.");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==10){
+ sprintf (string, "ADVANCED MOVEMENT:");
+ sprintf (string2, " ");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==11){
+ sprintf (string, "When you jump at a wall, you can hold %s again",Input::keyToChar(jumpkey));
+ sprintf (string2, "during impact to perform a walljump.");
+ sprintf (string3, "Be sure to use the movement keys to press against the wall");
+ }
+ if(tutorialstage==12){
+ sprintf (string, "While in the air, you can press crouch to flip.",Input::keyToChar(jumpkey));
+ sprintf (string2, "Walljumps and flips confuse enemies and give you more control.");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==13){
+ sprintf (string, "BASIC COMBAT:");
+ sprintf (string2, " ");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==14){
+ sprintf (string, "There is now an imaginary enemy");
+ sprintf (string2, "in the middle of the training area.");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==15){
+ if(attackkey==MOUSEBUTTON1)sprintf (string, "Click to attack when you are near an enemy.");
+ else sprintf (string, "Press %s to attack when you are near an enemy.",Input::keyToChar(attackkey));
+ sprintf (string2, "You can punch by standing still near an enemy and attacking.");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==16){
+ sprintf (string, "If you are close, you will perform a weak punch.");
+ sprintf (string2, "The weak punch is excellent for starting attack combinations.");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==17){
+ sprintf (string, "Attacking while running results in a spin kick.");
+ sprintf (string2, "This is one of your most powerful ground attacks.");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==18){
+ sprintf (string, "Sweep the enemy's legs out by attacking while crouched.");
+ sprintf (string2, "This is a very fast attack, and easy to follow up.");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==19){
+ sprintf (string, "When an enemy is on the ground, you can deal some extra");
+ sprintf (string2, "damage by running up and drop-kicking him.");
+ sprintf (string3, "(Try knocking them down with a sweep first)");
+ }
+ if(tutorialstage==20){
+ sprintf (string, "Your most powerful individual attack is the rabbit kick.");
+ if(attackkey==MOUSEBUTTON1)sprintf (string2, "Run at the enemy while holding the mouse button, and press");
+ else sprintf (string2, "Run at the enemy while holding %s, and press", Input::keyToChar(attackkey));
+ sprintf (string3, "the jump key (%s) to attack.",Input::keyToChar(jumpkey));
+ }
+ if(tutorialstage==21){
+ sprintf (string, "This attack is devastating if timed correctly.");
+ sprintf (string2, "Even if timed incorrectly, it will knock the enemy over.");
+ if(againbonus)sprintf (string3, "Try rabbit-kicking the imaginary enemy again.");
+ else sprintf (string3, "Try rabbit-kicking the imaginary enemy.");
+ }
+ if(tutorialstage==22){
+ sprintf (string, "If you sneak behind an enemy unnoticed, you can kill");
+ sprintf (string2, "him instantly. Move close behind this enemy");
+ sprintf (string3, "and attack.");
+ }
+ if(tutorialstage==23){
+ sprintf (string, "Another important attack is the wall kick. When an enemy");
+ sprintf (string2, "is near a wall, perform a walljump nearby and hold");
+ sprintf (string3, "the attack key during impact with the wall.");
+ }
+ if(tutorialstage==24){
+ sprintf (string, "You can tackle enemies by running at them animal-style");
+ if(attackkey==MOUSEBUTTON1)sprintf (string2, "and pressing jump (%s) or attack(mouse button).",Input::keyToChar(jumpkey));
+ else sprintf (string2, "and pressing jump (%s) or attack(%s).",Input::keyToChar(jumpkey),Input::keyToChar(attackkey));
+ sprintf (string3, "This is especially useful when they are running away.");
+ }
+ if(tutorialstage==25){
+ sprintf (string, "Dodge by pressing back and attack. Dodging is essential");
+ sprintf (string2, "against enemies with swords or other long weapons.");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==26){
+ sprintf (string, "REVERSALS AND COUNTER-REVERSALS");
+ sprintf (string2, " ");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==27){
+ sprintf (string, "The enemy can now reverse your attacks.");
+ sprintf (string2, " ");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==28){
+ sprintf (string, "If you attack, you will notice that the enemy now sometimes");
+ sprintf (string2, "catches your attack and uses it against you. Hold");
+ sprintf (string3, "crouch (%s) after attacking to escape from reversals.",Input::keyToChar(crouchkey));
+ }
+ if(tutorialstage==29){
+ sprintf (string, "Try escaping from two more reversals in a row.");
+ sprintf (string2, " ");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==30){
+ sprintf (string, "Good!");
+ sprintf (string2, " ");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==31){
+ sprintf (string, "To reverse an attack, you must tap crouch (%s) during the",Input::keyToChar(crouchkey));
+ sprintf (string2, "enemy's attack. You must also be close to the enemy;");
+ sprintf (string3, "this is especially important against armed opponents.");
+ }
+ if(tutorialstage==32){
+ sprintf (string, "The enemy can attack in %d seconds.", (int)(tutorialmaxtime-tutorialstagetime));
+ sprintf (string2, "This imaginary opponents attacks will be highlighted");
+ sprintf (string3, "to make this easier.");
+ }
+ if(tutorialstage==33){
+ sprintf (string, "Reverse three enemy attacks!");
+ sprintf (string2, " ");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==34){
+ sprintf (string, "Reverse two more enemy attacks!");
+ sprintf (string2, " ");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==35){
+ sprintf (string, "Reverse one more enemy attack!");
+ sprintf (string2, " ");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==36){
+ sprintf (string, "Excellent!");
+ sprintf (string2, " ");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==37){
+ sprintf (string, "Now spar with the enemy for %d more seconds.", (int)(tutorialmaxtime-tutorialstagetime));
+ sprintf (string2, "Damage dealt: %d",(int)damagedealt);
+ sprintf (string3, "Damage taken: %d.",(int)damagetaken);
+ }
+ if(tutorialstage==38){
+ sprintf (string, "WEAPONS:");
+ sprintf (string2, " ");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==39){
+ sprintf (string, "There is now an imaginary knife");
+ sprintf (string2, "in the center of the training area.");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==40){
+ sprintf (string, "Stand, roll or handspring over the knife");
+ sprintf (string2, "while pressing %s to pick it up.",Input::keyToChar(throwkey));
+ sprintf (string3, "You can crouch and press the same key to drop it again.");
+ }
+ if(tutorialstage==41){
+ sprintf (string, "You can equip and unequip weapons using the %s key.",Input::keyToChar(drawkey));
+ sprintf (string2, "Sometimes it is best to keep them unequipped to");
+ sprintf (string3, "prevent enemies from taking them. ");
+ }
+ if(tutorialstage==42){
+ sprintf (string, "The knife is the smallest weapon and the least encumbering.");
+ sprintf (string2, "You can equip or unequip it while standing, crouching,");
+ sprintf (string3, "running or flipping.");
+ }
+ if(tutorialstage==43){
+ sprintf (string, "You perform weapon attacks the same way as unarmed attacks,");
+ sprintf (string2, "but sharp weapons cause permanent damage, instead of the");
+ sprintf (string3, "temporary trauma from blunt weapons, fists and feet.");
+ }
+ if(tutorialstage==44){
+ sprintf (string, "The enemy now has your knife!");
+ sprintf (string2, "Please reverse two of his knife attacks.");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==45){
+ sprintf (string, "Please reverse one more of his knife attacks.");
+ sprintf (string2, " ");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==46){
+ sprintf (string, "Now he has a sword!");
+ sprintf (string2, "The sword has longer reach than your arms, so you");
+ sprintf (string3, "must move close to reverse the sword slash.");
+ }
+ if(tutorialstage==47){
+ sprintf (string, "Long weapons like the sword and staff are also useful for defense;");
+ sprintf (string2, "you can parry enemy weapon attacks by pressing the attack key");
+ sprintf (string3, "at the right time. Please try parrying the enemy's attacks!");
+ }
+ if(tutorialstage==48){
+ sprintf (string, "The staff is like the sword, but has two main attacks.");
+ sprintf (string2, "The standing smash is fast and effective, and the running");
+ sprintf (string3, "spin smash is slower and more powerful.");
+ }
+ if(tutorialstage==49){
+ sprintf (string, "When facing an enemy, you can throw the knife with %s.",Input::keyToChar(throwkey));
+ sprintf (string2, "It is possible to throw the knife while flipping,");
+ sprintf (string3, "but it is very inaccurate.");
+ }
+ if(tutorialstage==50){
+ sprintf (string, "You now know everything you can learn from training.");
+ sprintf (string2, "Everything else you must learn from experience!");
+ sprintf (string3, " ");
+ }
+ if(tutorialstage==51){
+ sprintf (string, "Walk out of the training area to return to the main menu.");
+ sprintf (string2, " ");
+ sprintf (string3, " ");
+ }
+
+ glColor4f(0,0,0,tutorialopac);
+ text.glPrintOutline(screenwidth/2-7.6*strlen(string)*screenwidth/1024-4,screenheight/16-4+screenheight*4/5,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
+ text.glPrintOutline(screenwidth/2-7.6*strlen(string2)*screenwidth/1024-4,screenheight/16-4+screenheight*4/5-20*screenwidth/1024,string2,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
+ text.glPrintOutline(screenwidth/2-7.6*strlen(string3)*screenwidth/1024-4,screenheight/16-4+screenheight*4/5-40*screenwidth/1024,string3,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
+ glColor4f(1,1,1,tutorialopac);
+ text.glPrint(screenwidth/2-7.6*strlen(string)*screenwidth/1024,screenheight/16+screenheight*4/5,string,1,1.5*screenwidth/1024,screenwidth,screenheight);
+ text.glPrint(screenwidth/2-7.6*strlen(string2)*screenwidth/1024,screenheight/16+screenheight*4/5-20*screenwidth/1024,string2,1,1.5*screenwidth/1024,screenwidth,screenheight);
+ text.glPrint(screenwidth/2-7.6*strlen(string3)*screenwidth/1024,screenheight/16+screenheight*4/5-40*screenwidth/1024,string3,1,1.5*screenwidth/1024,screenwidth,screenheight);
+
+ sprintf (string, "Press 'tab' to skip to the next item.",Input::keyToChar(jumpkey));
+ sprintf (string2, "Press escape at any time to");
+ sprintf (string3, "pause or exit the tutorial.");
+
+ glColor4f(0,0,0,1);
+ text.glPrintOutline(screenwidth/2-7.6*strlen(string)*screenwidth/1024*.8-4,0-4+screenheight*1/10,string,1,1.5*1.25*screenwidth/1024*.8,screenwidth,screenheight);
+ text.glPrintOutline(screenwidth/2-7.6*strlen(string2)*screenwidth/1024*.8-4,0-4+screenheight*1/10-20*.8*screenwidth/1024,string2,1,1.5*1.25*screenwidth/1024*.8,screenwidth,screenheight);
+ text.glPrintOutline(screenwidth/2-7.6*strlen(string3)*screenwidth/1024*.8-4,0-4+screenheight*1/10-40*.8*screenwidth/1024,string3,1,1.5*1.25*screenwidth/1024*.8,screenwidth,screenheight);
+ glColor4f(0.5,0.5,0.5,1);
+ text.glPrint(screenwidth/2-7.6*strlen(string)*screenwidth/1024*.8,0+screenheight*1/10,string,1,1.5*screenwidth/1024*.8,screenwidth,screenheight);
+ text.glPrint(screenwidth/2-7.6*strlen(string2)*screenwidth/1024*.8,0+screenheight*1/10-20*.8*screenwidth/1024,string2,1,1.5*screenwidth/1024*.8,screenwidth,screenheight);
+ text.glPrint(screenwidth/2-7.6*strlen(string3)*screenwidth/1024*.8,0+screenheight*1/10-40*.8*screenwidth/1024,string3,1,1.5*screenwidth/1024*.8,screenwidth,screenheight);
+ }
+ //Hot spots
+
+ if(numhotspots&&(bonustime>=1||bonus<=0||bonustime<0)&&!tutoriallevel){
+ int closest=-1;
+ float closestdist=-1;
+ float distance=0;
+ closest=currenthotspot;
+ for(i=0;i<numhotspots;i++){
+ distance=findDistancefast(&player[0].coords,&hotspot[i]);
+ if(closestdist==-1||distance<closestdist){
+ if(findDistancefast(&player[0].coords,&hotspot[i])<hotspotsize[i]&&((hotspottype[i]<=10&&hotspottype[i]>=0)||(hotspottype[i]<=40&&hotspottype[i]>=20))){
+ closestdist=distance;
+ closest=i;
+ }
+ }
+ }
+ if(closest!=-1)
+ currenthotspot=closest;
+ if(currenthotspot!=-1){
+ if(hotspottype[closest]<=10){
+ if(findDistancefast(&player[0].coords,&hotspot[closest])<hotspotsize[closest])
+ tutorialstagetime=0;
+ tutorialmaxtime=1;
+ tutorialopac=tutorialmaxtime-tutorialstagetime;
+ if(tutorialopac>1)tutorialopac=1;
+ if(tutorialopac<0)tutorialopac=0;
+
+ sprintf (string, "%s", hotspottext[closest]);
+
+ int lastline = 0;
+ int line = 0;
+ bool done = false;
+ i=0;
+ while(!done){
+ if(string[i]=='\n'||string[i]>'z'||string[i]<' '||string[i]=='\0'){
+ glColor4f(0,0,0,tutorialopac);
+ text.glPrintOutline(screenwidth/2-7.6*(i-lastline)*screenwidth/1024-4,screenheight/16-4+screenheight*4/5-20*screenwidth/1024*line,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight,lastline,i);
+ glColor4f(1,1,1,tutorialopac);
+ text.glPrint(screenwidth/2-7.6*(i-lastline)*screenwidth/1024,screenheight/16+screenheight*4/5-20*screenwidth/1024*line,string,1,1.5*screenwidth/1024,screenwidth,screenheight,lastline,i);
+ lastline=i+1;
+ line++;
+ if(string[i]=='\0')done=1;
+ }
+ if(i>=255)done=1;
+ i++;
+ }
+ } else if (hotspottype[closest]>=20&&dialoguegonethrough[hotspottype[closest]-20]==0){
+ whichdialogue=hotspottype[closest]-20;
+ for(j=0;j<numdialogueboxes[whichdialogue];j++){
+ player[participantfocus[whichdialogue][j]].coords=participantlocation[whichdialogue][participantfocus[whichdialogue][j]];
+ player[participantfocus[whichdialogue][j]].rotation=participantrotation[whichdialogue][participantfocus[whichdialogue][j]];
+ player[participantfocus[whichdialogue][j]].targetrotation=participantrotation[whichdialogue][participantfocus[whichdialogue][j]];
+ player[participantfocus[whichdialogue][j]].velocity=0;
+ player[participantfocus[whichdialogue][j]].targetanimation=player[participantfocus[whichdialogue][j]].getIdle();
+ player[participantfocus[whichdialogue][j]].targetframe=0;
+ }
+ directing=0;
+ indialogue=0;
+ dialoguegonethrough[whichdialogue]++;
+ if(dialogueboxsound[whichdialogue][indialogue]!=0){
+ int whichsoundplay;
+ if(dialogueboxsound[whichdialogue][indialogue]==1)whichsoundplay=rabbitchitter;
+ if(dialogueboxsound[whichdialogue][indialogue]==2)whichsoundplay=rabbitchitter2;
+ if(dialogueboxsound[whichdialogue][indialogue]==3)whichsoundplay=rabbitpainsound;
+ if(dialogueboxsound[whichdialogue][indialogue]==4)whichsoundplay=rabbitpain1sound;
+ if(dialogueboxsound[whichdialogue][indialogue]==5)whichsoundplay=rabbitattacksound;
+ if(dialogueboxsound[whichdialogue][indialogue]==6)whichsoundplay=rabbitattack2sound;
+ if(dialogueboxsound[whichdialogue][indialogue]==7)whichsoundplay=rabbitattack3sound;
+ if(dialogueboxsound[whichdialogue][indialogue]==8)whichsoundplay=rabbitattack4sound;
+ if(dialogueboxsound[whichdialogue][indialogue]==9)whichsoundplay=growlsound;
+ if(dialogueboxsound[whichdialogue][indialogue]==10)whichsoundplay=growl2sound;
+ if(dialogueboxsound[whichdialogue][indialogue]==11)whichsoundplay=snarlsound;
+ if(dialogueboxsound[whichdialogue][indialogue]==12)whichsoundplay=snarl2sound;
+ if(dialogueboxsound[whichdialogue][indialogue]==13)whichsoundplay=barksound;
+ if(dialogueboxsound[whichdialogue][indialogue]==14)whichsoundplay=bark2sound;
+ if(dialogueboxsound[whichdialogue][indialogue]==15)whichsoundplay=bark3sound;
+ if(dialogueboxsound[whichdialogue][indialogue]==16)whichsoundplay=barkgrowlsound;
+ if(dialogueboxsound[whichdialogue][indialogue]==-1)whichsoundplay=fireendsound;
+ if(dialogueboxsound[whichdialogue][indialogue]==-2)whichsoundplay=firestartsound;
+ if(dialogueboxsound[whichdialogue][indialogue]==-3)whichsoundplay=consolesuccesssound;
+ if(dialogueboxsound[whichdialogue][indialogue]==-4)whichsoundplay=consolefailsound;
+ emit_sound_at(whichsoundplay, player[participantfocus[whichdialogue][indialogue]].coords);
+ }
+ }
+ }
+ }
+
+ if(indialogue!=-1&&!mainmenu){
+ glDisable(GL_DEPTH_TEST); // Disables Depth Testing
+ glDisable(GL_CULL_FACE);
+ glDisable(GL_LIGHTING);
+ glDisable(GL_TEXTURE_2D);
+ glDepthMask(0);
+ glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
+ glPushMatrix(); // Store The Projection Matrix
+ glLoadIdentity(); // Reset The Projection Matrix
+ glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
+ glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
+ glPushMatrix(); // Store The Modelview Matrix
+ glLoadIdentity(); // Reset The Modelview Matrix
+ if(dialogueboxlocation[whichdialogue][indialogue]==1)glTranslatef(0,screenheight*3/4,0);
+ glScalef(screenwidth,screenheight/4,1);
+ glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+
+ glColor4f(dialogueboxcolor[whichdialogue][indialogue][0],dialogueboxcolor[whichdialogue][indialogue][1],dialogueboxcolor[whichdialogue][indialogue][2],0.7);
+ glBegin(GL_QUADS);
+ glVertex3f(0, 0, 0.0f);
+ glVertex3f(1, 0, 0.0f);
+ glVertex3f(1, 1, 0.0f);
+ glVertex3f(0, 1, 0.0f);
+ glEnd();
+ glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
+ glPopMatrix(); // Restore The Old Projection Matrix
+ glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
+ glPopMatrix(); // Restore The Old Projection Matrix
+ glEnable(GL_DEPTH_TEST); // Enables Depth Testing
+ glEnable(GL_CULL_FACE);
+ glDisable(GL_BLEND);
+ glDepthMask(1);
+ glEnable(GL_TEXTURE_2D);
+
+ tutorialopac=1;
+
+ float startx;
+ float starty;
+
+ startx=screenwidth*1/5;
+ if(dialogueboxlocation[whichdialogue][indialogue]==1)
+ starty=screenheight/16+screenheight*4/5;
+ if(dialogueboxlocation[whichdialogue][indialogue]==2)
+ starty=screenheight*1/5-screenheight/16;
+
+ char tempname[264];
+ bool goodchar;
+ int tempnum=0;
+ for(i=0;i<264;i++){
+ tempname[i]='\0';
+ }
+
+ for(i=0;i<(int)strlen(dialoguename[whichdialogue][indialogue]);i++){
+ tempname[tempnum]=dialoguename[whichdialogue][indialogue][i];
+ goodchar=1;
+ if(dialoguename[whichdialogue][indialogue][i]=='#'||dialoguename[whichdialogue][indialogue][i]=='\0')goodchar=0;
+ if(goodchar)
+ tempnum++;
+ else
+ tempname[tempnum]='\0';
+ }
+
+ sprintf (string, "%s: ", tempname);
+
+ if(dialogueboxcolor[whichdialogue][indialogue][0]+dialogueboxcolor[whichdialogue][indialogue][1]+dialogueboxcolor[whichdialogue][indialogue][2]<1.5){
+ glColor4f(0,0,0,tutorialopac);
+ text.glPrintOutline(startx-2*7.6*strlen(string)*screenwidth/1024-4,starty-4,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
+ glColor4f(0.7,0.7,0.7,tutorialopac);
+ text.glPrint(startx-2*7.6*strlen(string)*screenwidth/1024,starty,string,1,1.5*screenwidth/1024,screenwidth,screenheight);
+ }
+ else
+ {
+ glColor4f(0,0,0,tutorialopac);
+ text.glPrintOutline(startx-2*7.6*strlen(string)*screenwidth/1024-4,starty-4,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight);
+ }
+
+ tempnum=0;
+ for(i=0;i<(int)strlen(dialoguetext[whichdialogue][indialogue])+1;i++){
+ tempname[tempnum]=dialoguetext[whichdialogue][indialogue][i];
+ if(dialoguetext[whichdialogue][indialogue][i]!='#')tempnum++;
+ }
+
+ sprintf (string, "%s", tempname);
+
+ int lastline = 0;
+ int line = 0;
+ bool done = false;
+ i=0;
+ while(!done){
+ if(string[i]=='\n'||string[i]>'z'||string[i]<' '||string[i]=='\0'){
+ if(dialogueboxcolor[whichdialogue][indialogue][0]+dialogueboxcolor[whichdialogue][indialogue][1]+dialogueboxcolor[whichdialogue][indialogue][2]<1.5){
+ glColor4f(0,0,0,tutorialopac);
+ text.glPrintOutline(startx/*-7.6*(i-lastline)*screenwidth/1024*/-4,starty-4-20*screenwidth/1024*line,string,1,1.5*1.25*screenwidth/1024,screenwidth,screenheight,lastline,i);
+ glColor4f(1,1,1,tutorialopac);
+ text.glPrint(startx/*-7.6*(i-lastline)*screenwidth/1024*/,starty-20*screenwidth/1024*line,string,1,1.5*screenwidth/1024,screenwidth,screenheight,lastline,i);
+ }
+ else
+ {
+ glColor4f(0,0,0,tutorialopac);
+ text.glPrint(startx/*-7.6*(i-lastline)*screenwidth/1024*/,starty-20*screenwidth/1024*line,string,1,1.5*screenwidth/1024,screenwidth,screenheight,lastline,i);
+ }
+ lastline=i+1;
+ line++;
+ if(string[i]=='\0')done=1;
+ }
+ if(i>=255)done=1;
+ i++;
+ }
+ }
+
+ if(!tutoriallevel&&!winfreeze&&indialogue==-1&&!mainmenu){
+ if(campaign){
+ if(scoreadded)
+ sprintf (string, "Score: %d", (int)accountactive->getCampaignScore());
+ else
+ sprintf (string, "Score: %d", (int)accountactive->getCampaignScore()+(int)bonustotal);
+ }
+ if(!campaign)sprintf (string, "Score: %d", (int)bonustotal);
+ glColor4f(0,0,0,1);
+ text.glPrintOutline(1024/40-4,768/16-4+768*14/16,string,1,1.5*1.25,1024,768);
+ glColor4f(1,0,0,1);
+ text.glPrint(1024/40,768/16+768*14/16,string,1,1.5,1024,768);
+ if(showdamagebar) {
+ glDisable(GL_DEPTH_TEST); // Disables Depth Testing
+ glDisable(GL_CULL_FACE);
+ glDisable(GL_LIGHTING);
+ glDisable(GL_TEXTURE_2D);
+ glDepthMask(0);
+ glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
+ glPushMatrix(); // Store The Projection Matrix
+ glLoadIdentity(); // Reset The Projection Matrix
+ glOrtho(0,screenwidth,0,screenheight,-100,100); // Set Up An Ortho Screen
+ glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
+ glPushMatrix(); // Store The Modelview Matrix
+ glLoadIdentity(); // Reset The Modelview Matrix
+ glTranslatef(15,screenheight*17.5/20,0);
+ glScalef(screenwidth/3+20,screenheight/20,1);
+ glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+ glColor4f(0.0,0.4,0.0,0.7);
+ float bar=((float)player[0].damage)/player[0].damagetolerance;
+ glBegin(GL_QUADS);
+ glVertex3f((bar<1?bar:1),0,0.0f);
+ glVertex3f(1,0,0.0f);
+ glVertex3f(1,1,0.0f);
+ glVertex3f((bar<1?bar:1),1,0.0f);
+ glEnd();
+ glColor4f(0.1,0.0,0.0,1);
+ bar = ((float)player[0].bloodloss)/player[0].damagetolerance;
+ glBegin(GL_QUADS);
+ glVertex3f(0,0,0.0f);
+ glVertex3f((bar<1?bar:1),0,0.0f);
+ glVertex3f((bar<1?bar:1),1,0.0f);
+ glVertex3f(0,1,0.0f);
+ glEnd();
+ glColor4f(0.4,0.0,0.0,0.7);
+ bar = ((float)player[0].damage)/player[0].damagetolerance;
+ glBegin(GL_QUADS);
+ glVertex3f(0,0,0.0f);
+ glVertex3f((bar<1?bar:1),0,0.0f);
+ glVertex3f((bar<1?bar:1),1,0.0f);
+ glVertex3f(0,1,0.0f);
+ glEnd();
+ glColor4f(0.4,0.0,0.0,0.7);
+ bar = ((float)player[0].permanentdamage)/player[0].damagetolerance;
+ glBegin(GL_QUADS);
+ glVertex3f(0,0,0.0f);
+ glVertex3f((bar<1?bar:1),0,0.0f);
+ glVertex3f((bar<1?bar:1),1,0.0f);
+ glVertex3f(0,1,0.0f);
+ glEnd();
+ glColor4f(0.4,0.0,0.0,0.7);
+ bar = ((float)player[0].superpermanentdamage)/player[0].damagetolerance;
+ glBegin(GL_QUADS);
+ glVertex3f(0,0,0.0f);
+ glVertex3f((bar<1?bar:1),0,0.0f);
+ glVertex3f((bar<1?bar:1),1,0.0f);
+ glVertex3f(0,1,0.0f);
+ glEnd();
+ glColor4f(0.0,0.0,0.0,0.7);
+ glLineWidth(2.0);
+ glBegin(GL_LINE_STRIP);
+ glVertex3f(0,0,0.0f);
+ glVertex3f(1,0,0.0f);
+ glVertex3f(1,1,0.0f);
+ glVertex3f(0,1,0.0f);
+ glVertex3f(0,0,0.0f);
+ glEnd();
+
+ glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
+ glPopMatrix(); // Restore The Old Projection Matrix
+ glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
+ glPopMatrix(); // Restore The Old Projection Matrix
+ glEnable(GL_DEPTH_TEST); // Enables Depth Testing
+ glEnable(GL_CULL_FACE);
+ glDisable(GL_BLEND);
+ glDepthMask(1);
+ glEnable(GL_TEXTURE_2D);
+
+ // writing the numbers :
+ sprintf (string, "Damages : %d/%d (%d)",(int)(player[0].damage),(int)(player[0].damagetolerance),(int)(player[0].bloodloss));
+ glColor4f(0,0,0,1);
+ text.glPrintOutline(1024/40-4,768/16-4+768*14/16-40,string,1,1.5*1.25,1024,768);
+ glColor4f(1,0,0,1);
+ text.glPrint(1024/40,768/16+768*14/16-40,string,1,1.5,1024,768);
+ }
+ }
+
+ glColor4f(.5,.5,.5,1);
+
+
+ if((texttoggle||editorenabled)&&debugmode&&!mainmenu){
+ sprintf (string, "The framespersecond is %d.",(int)(fps));
+ text.glPrint(10,30,string,0,.8,1024,768);
+
+ sprintf (string, "Name: %s", registrationname);
+ text.glPrint(10,260,string,0,.8,1024,768);
+
+
+ if(editorenabled)
+ sprintf (string, "Map editor enabled.");
+ else
+ sprintf (string, "Map editor disabled.");
+ text.glPrint(10,60,string,0,.8,1024,768);
+ if(editorenabled){
+ sprintf (string, "Object size: %f",editorsize);
+ text.glPrint(10,75,string,0,.8,1024,768);
+ if(editorrotation>=0)sprintf (string, "Object rotation: %f",editorrotation);
+ else sprintf (string, "Object rotation: Random");
+ text.glPrint(10,90,string,0,.8,1024,768);
+ if(editorrotation2>=0)sprintf (string, "Object rotation2: %f",editorrotation2);
+ else sprintf (string, "Object rotation2: Random");
+ text.glPrint(10,105,string,0,.8,1024,768);
+ sprintf (string, "Object type: %d",editortype);
+ text.glPrint(10,120,string,0,.8,1024,768);
+ switch(editortype) {
+ case boxtype:
+ sprintf (string, "(box)");
+ break;
+ case treetrunktype:
+ sprintf (string, "(tree)");
+ break;
+ case walltype:
+ sprintf (string, "(wall)");
+ break;
+ case weirdtype:
+ sprintf (string, "(weird)");
+ break;
+ case spiketype:
+ sprintf (string, "(spike)");
+ break;
+ case rocktype:
+ sprintf (string, "(rock)");
+ break;
+ case bushtype:
+ sprintf (string, "(bush)");
+ break;
+ case tunneltype:
+ sprintf (string, "(tunnel)");
+ break;
+ case chimneytype:
+ sprintf (string, "(chimney)");
+ break;
+ case platformtype:
+ sprintf (string, "(platform)");
+ break;
+ case cooltype:
+ sprintf (string, "(cool)");
+ break;
+ case firetype:
+ sprintf (string, "(fire)");
+ break;
+ }
+ text.glPrint(130,120,string,0,.8,1024,768);
+
+ sprintf (string, "Numplayers: %d",numplayers);
+ text.glPrint(10,155,string,0,.8,1024,768);
+ sprintf (string, "Player %d: numwaypoints: %d",numplayers,player[numplayers-1].numwaypoints);
+ text.glPrint(10,140,string,0,.8,1024,768);
+ }
+ sprintf (string, "Difficulty: %d",difficulty);
+ text.glPrint(10,240,string,0,.8,1024,768);
+
+ }