]> git.jsancho.org Git - lugaru.git/blobdiff - Source/GameDraw.cpp
Migrate some more definitions from Constants.h
[lugaru.git] / Source / GameDraw.cpp
index 79625b1795d23be8a81f5bf5f5b539c95cfc098d..2b2c8b7cf9948b3b0eb0fc09dddc33292b0cae53 100644 (file)
@@ -81,13 +81,6 @@ extern bool decals;
 //extern int texdetail;
 extern float texdetail;
 extern bool musictoggle;
-extern int bonus;
-extern float bonusvalue;
-extern float bonustotal;
-extern float bonustime;
-extern int oldbonus;
-extern float startbonustotal;
-extern float bonusnum[100];
 extern int tutoriallevel;
 extern float smoketex;
 extern float tutorialstagetime;
@@ -139,8 +132,10 @@ extern bool gamestarted;
 
 extern bool showdamagebar;
 
-extern int channels[100];
-extern "C"     void PlaySoundEx(int channel, OPENAL_SAMPLE *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused);
+enum drawmodes {
+  normalmode, motionblurmode, radialzoommode,
+  realmotionblurmode, doublevisionmode, glowmode,
+};
 
 void Game::flash() { // shouldn't be that way, these should be attributes and Person class should not change rendering.
        flashr=1;
@@ -586,38 +581,16 @@ int Game::DrawGLScene(StereoSide side)
 
                        if(!tutoriallevel)
                                if(bonus>0&&bonustime<1&&!winfreeze&&indialogue==-1/*bonustime<4*/){
-                                       if(bonus==tracheotomy)sprintf (string, "Tracheotomy!");
-                                       else if(bonus==backstab)sprintf (string, "Backstabber!");
-                                       else if(bonus==spinecrusher)sprintf (string, "Spinecrusher!");
-                                       else if(bonus==ninja)sprintf (string, "Ninja Bonus!");
-                                       else if(bonus==style)sprintf (string, "Style Bonus!");
-                                       else if(bonus==cannon)sprintf (string, "Leg Cannon!");
-                                       else if(bonus==aimbonus)sprintf (string, "Nice Aim!");
-                                       else if(bonus==deepimpact)sprintf (string, "Heavy Impact!");
-                                       else if(bonus==touchofdeath)sprintf (string, "Touch of Death!");
-                                       else if(bonus==swordreversebonus)sprintf (string, "Sword Disarm!");
-                                       else if(bonus==staffreversebonus)sprintf (string, "Staff Disarm!");
-                                       else if(bonus==reverseko)sprintf (string, "Reversal KO!");
-                                       else if(bonus==solidhit)sprintf (string, "Solid Hit!");
-                                       else if(bonus==twoxcombo)sprintf (string, "2X Combo!");
-                                       else if(bonus==threexcombo)sprintf (string, "3X Combo!");
-                                       else if(bonus==fourxcombo)sprintf (string, "4X COMBO!");
-                                       else if(bonus==megacombo)sprintf (string, "MEGA COMBO!");
-                                       else if(bonus==Reversal)sprintf (string, "Reversal!");
-                                       else if(bonus==Stabbonus)sprintf (string, "Punctured!");
-                                       else if(bonus==Slicebonus)sprintf (string, "Sliced!");
-                                       else if(bonus==Bullseyebonus)sprintf (string, "Bullseye!");
-                                       else if(bonus==Slashbonus)sprintf (string, "Slashed!");
-                                       else if(bonus==Wolfbonus)sprintf (string, "WOLF SLAYER!");
-                                       else if(bonus==FinishedBonus)sprintf (string, "SLAIN!");
-                                       else if(bonus==TackleBonus)sprintf (string, "Tackle!");
-                                       else if(bonus==AboveBonus)sprintf (string, "Death from Above!");
-                                       else sprintf (string, "Excellent!");
+                                       const char *bonus_name;
+                                       if (bonus < bonus_count)
+                                         bonus_name = bonus_names[bonus];
+                                       else
+                                         bonus_name = "Excellent!"; // When does this happen?
 
                                        glColor4f(0,0,0,1-bonustime);
-                                       text.glPrintOutline(1024/2-10*strlen(string)-4,768/16-4+768*4/5,string,1,2.5,1024,768);
+                                       text.glPrintOutline(1024/2-10*strlen(bonus_name)-4,768/16-4+768*4/5,bonus_name,1,2.5,1024,768);
                                        glColor4f(1,0,0,1-bonustime);
-                                       text.glPrint(1024/2-10*strlen(string),768/16+768*4/5,string,1,2,1024,768);
+                                       text.glPrint(1024/2-10*strlen(bonus_name),768/16+768*4/5,bonus_name,1,2,1024,768);
 
                                        sprintf (string, "%d",(int)bonusvalue);
                                        glColor4f(0,0,0,1-bonustime);
@@ -983,14 +956,6 @@ int Game::DrawGLScene(StereoSide side)
                                                        indialogue=0;
                                                        dialoguegonethrough[whichdialogue]++;
                                                        if(dialogueboxsound[whichdialogue][indialogue]!=0){
-                                                               static float gLoc[3];
-                                                               static float vel[3];
-                                                               gLoc[0]=player[participantfocus[whichdialogue][indialogue]].coords.x;
-                                                               gLoc[1]=player[participantfocus[whichdialogue][indialogue]].coords.y;
-                                                               gLoc[2]=player[participantfocus[whichdialogue][indialogue]].coords.z;
-                                                               vel[0]=0;
-                                                               vel[1]=0;
-                                                               vel[2]=0;
                                                                int whichsoundplay;
                                                                if(dialogueboxsound[whichdialogue][indialogue]==1)whichsoundplay=rabbitchitter;
                                                                if(dialogueboxsound[whichdialogue][indialogue]==2)whichsoundplay=rabbitchitter2;
@@ -1012,10 +977,7 @@ int Game::DrawGLScene(StereoSide side)
                                                                if(dialogueboxsound[whichdialogue][indialogue]==-2)whichsoundplay=firestartsound;
                                                                if(dialogueboxsound[whichdialogue][indialogue]==-3)whichsoundplay=consolesuccesssound;
                                                                if(dialogueboxsound[whichdialogue][indialogue]==-4)whichsoundplay=consolefailsound;
-                                                               PlaySoundEx( whichsoundplay, samp[whichsoundplay], NULL, true);
-                                                               OPENAL_3D_SetAttributes(channels[whichsoundplay], gLoc, vel);
-                                                               OPENAL_SetVolume(channels[whichsoundplay], 256);
-                                                               OPENAL_SetPaused(channels[whichsoundplay], false);
+                                                               emit_sound_at(whichsoundplay, player[participantfocus[whichdialogue][indialogue]].coords);
                                                        }
                                                }
                                        }