Eliminated mishaps extern.
authorGwyn Ciesla <limb@jcomserv.net>
Tue, 4 May 2010 12:15:12 +0000 (07:15 -0500)
committerGwyn Ciesla <limb@jcomserv.net>
Tue, 4 May 2010 12:15:12 +0000 (07:15 -0500)
main.cpp
mishaps.cpp
mishaps.h

index 76ed40f..47a090c 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -723,7 +723,7 @@ int main(int argc, char *argv[]){
          missiles[missileloop] = process_motion(missiles[missileloop], player);
          //missiles[missileloop] = age_bullet(missiles[missileloop]);  //Something to think about
         } else {
-         boom_object(boomstuff, missiles[missileloop], boomsound, boomchannel);
+         drawlocation = boom_object(drawlocation, boomstuff, missiles[missileloop], boomsound, boomchannel);
          missiles[missileloop] = object_out(missiles[missileloop]);
         };
       };
@@ -1084,7 +1084,7 @@ int main(int argc, char *argv[]){
        for(int landerloop = 0; landerloop<landermax; landerloop++){
          if(((abs(player.y-landers[landerloop].y)<=80)||(abs(player.y-landers[landerloop].y)>=540))&&(player.x==landers[landerloop].x)&&((player.face==0&&(landers[landerloop].y<player.y))||(player.face==1&&(landers[landerloop].y>player.y)))){
            determine_powerup(powerups, landers[landerloop], 800, pupcreatesound, pupcreatechannel);
-           boom_object(boomstuff, landers[landerloop], boomsound, boomchannel);
+           drawlocation = boom_object(drawlocation, boomstuff, landers[landerloop], boomsound, boomchannel);
            landers[landerloop] = object_out(landers[landerloop]);
            score = score + 15;
          };
@@ -1093,7 +1093,7 @@ int main(int argc, char *argv[]){
        for(int crazyloop = 0; crazyloop<landermax; crazyloop++){
          if(((abs(player.y-crazies[crazyloop].y)<=80)||(abs(player.y-crazies[crazyloop].y)>=540))&&(player.x==crazies[crazyloop].x)&&((player.face==0&&(crazies[crazyloop].y<player.y))||(player.face==1&&(crazies[crazyloop].y>player.y)))){
            determine_powerup(powerups, crazies[crazyloop], 800, pupcreatesound, pupcreatechannel);
-           boom_object(boomstuff, crazies[crazyloop], boomsound, boomchannel);     
+           drawlocation = boom_object(drawlocation, boomstuff, crazies[crazyloop], boomsound, boomchannel);
            crazies[crazyloop] = object_out(crazies[crazyloop]);
            score = score + 15;
          };
@@ -1102,7 +1102,7 @@ int main(int argc, char *argv[]){
        for(int crawlerloop = 0; crawlerloop<crawlermax; crawlerloop++){
          if(((abs(player.y-crawlers[crawlerloop].y)<=80)||(abs(player.y-crawlers[crawlerloop].y)>=540))&&(player.x==crawlers[crawlerloop].x)&&((player.face==0&&(crawlers[crawlerloop].y<player.y))||(player.face==1&&(crawlers[crawlerloop].y>player.y)))){
            determine_powerup(powerups, crawlers[crawlerloop], 800, pupcreatesound, pupcreatechannel);
-           boom_object(boomstuff, crawlers[crawlerloop], boomsound, boomchannel);
+           drawlocation = boom_object(drawlocation, boomstuff, crawlers[crawlerloop], boomsound, boomchannel);
            crawlers[crawlerloop] = object_out(crawlers[crawlerloop]);
            score = score + 15;
          };
@@ -1114,7 +1114,7 @@ int main(int argc, char *argv[]){
              bosses[bossloop].phase = bosses[bossloop].phase - 5;
              if(bosses[bossloop].phase<=0){
                determine_powerup(powerups, bosses[bossloop], 600, pupcreatesound, pupcreatechannel);
-               boom_object(boomstuff, bosses[bossloop], boomsound, boomchannel);
+               drawlocation = boom_object(drawlocation, boomstuff, bosses[bossloop], boomsound, boomchannel);
                bosses[bossloop] = object_out(bosses[bossloop]);
                score = score + 75;
              };
@@ -1180,7 +1180,7 @@ int main(int argc, char *argv[]){
         if(landers[landerloop].active==1){
          if((abs(player.y-landers[landerloop].y)<=40)||(abs(player.y-landers[landerloop].y)>=580)){
            determine_powerup(powerups, landers[landerloop], 800, pupcreatesound, pupcreatechannel);
-           boom_object(boomstuff, landers[landerloop], boomsound, boomchannel);
+           drawlocation = boom_object(drawlocation, boomstuff, landers[landerloop], boomsound, boomchannel);
            landers[landerloop] = object_out(landers[landerloop]);
            score = score + 5;
          };
@@ -1189,7 +1189,7 @@ int main(int argc, char *argv[]){
       for(int crazyloop = 0; crazyloop<landermax; crazyloop++){
         if(crazies[crazyloop].active==1){
          if((abs(player.y-crazies[crazyloop].y)<=40)||(abs(player.y-crazies[crazyloop].y)>=580)){
-           boom_object(boomstuff, crazies[crazyloop], boomsound, boomchannel);
+           drawlocation = boom_object(drawlocation, boomstuff, crazies[crazyloop], boomsound, boomchannel);
            crazies[crazyloop] = object_out(crazies[crazyloop]);
            score = score + 5;
          };
@@ -1198,7 +1198,7 @@ int main(int argc, char *argv[]){
       for(int crawlerloop = 0; crawlerloop<crawlermax; crawlerloop++){
         if(crawlers[crawlerloop].active==1){
          if((abs(player.y-crawlers[crawlerloop].y)<=40)||(abs(player.y-crawlers[crawlerloop].y)>=580)){
-           boom_object(boomstuff, crawlers[crawlerloop], boomsound, boomchannel);
+           drawlocation = boom_object(drawlocation, boomstuff, crawlers[crawlerloop], boomsound, boomchannel);
            crawlers[crawlerloop] = object_out(crawlers[crawlerloop]);
            score = score + 5;
          };
@@ -1209,7 +1209,7 @@ int main(int argc, char *argv[]){
          if((abs(player.y-bosses[bossloop].y)<=40)||(abs(player.y-bosses[bossloop].y)>=580)){
            bosses[bossloop].phase = bosses[bossloop].phase - 5;
            if(bosses[bossloop].phase<=0){
-             boom_object(boomstuff, bosses[bossloop], boomsound, boomchannel);
+             drawlocation = boom_object(drawlocation, boomstuff, bosses[bossloop], boomsound, boomchannel);
              bosses[bossloop] = object_out(bosses[bossloop]);
              score = score + 50;
            };
@@ -1237,7 +1237,7 @@ int main(int argc, char *argv[]){
            if(check_collision(bullets[bulletloop], landers[landerloop])==1){
              //kill lander and bullet
              determine_powerup(powerups, landers[landerloop], 800, pupcreatesound, pupcreatechannel);
-             boom_object(boomstuff, landers[landerloop], boomsound, boomchannel);
+             drawlocation = boom_object(drawlocation, boomstuff, landers[landerloop], boomsound, boomchannel);
              landers[landerloop] = object_out(landers[landerloop]);
              bullets[bulletloop] = object_out(bullets[bulletloop]);
              //add to score
@@ -1251,7 +1251,7 @@ int main(int argc, char *argv[]){
            if(check_collision(bullets[bulletloop], crazies[crazyloop])==1){
              //kill crazy and bullet
              determine_powerup(powerups, crazies[crazyloop], 800, pupcreatesound, pupcreatechannel);         
-             boom_object(boomstuff, crazies[crazyloop], boomsound, boomchannel);
+             drawlocation = boom_object(drawlocation, boomstuff, crazies[crazyloop], boomsound, boomchannel);
              crazies[crazyloop] = object_out(crazies[crazyloop]);
              bullets[bulletloop] = object_out(bullets[bulletloop]);
              //add to score
@@ -1265,7 +1265,7 @@ int main(int argc, char *argv[]){
            if(check_collision(bullets[bulletloop], crawlers[crawlerloop])==1){
              //kill crawler and bullet
              determine_powerup(powerups, crawlers[crawlerloop], 800, pupcreatesound, pupcreatechannel);
-             boom_object(boomstuff, crawlers[crawlerloop], boomsound, boomchannel);
+             drawlocation = boom_object(drawlocation, boomstuff, crawlers[crawlerloop], boomsound, boomchannel);
              crawlers[crawlerloop] = object_out(crawlers[crawlerloop]);
              bullets[bulletloop] = object_out(bullets[bulletloop]);
              //add to score
@@ -1281,7 +1281,7 @@ int main(int argc, char *argv[]){
              bosses[bossloop].phase = bosses[bossloop].phase - 1;
              if(bosses[bossloop].phase<=0){
                determine_powerup(powerups, bosses[bossloop], 600, pupcreatesound, pupcreatechannel);
-               boom_object(boomstuff, bosses[bossloop], boomsound, boomchannel);
+               drawlocation = boom_object(drawlocation, boomstuff, bosses[bossloop], boomsound, boomchannel);
                bosses[bossloop] = object_out(bosses[bossloop]);
                bullets[bulletloop] = object_out(bullets[bulletloop]);
                //add to score
@@ -1302,7 +1302,7 @@ int main(int argc, char *argv[]){
          lives--;
          //add to score
          score = score + 10;
-         boom_object(boomstuff, player, boomsound, boomchannel);
+         drawlocation = boom_object(drawlocation, boomstuff, player, boomsound, boomchannel);
          life_loss(lives, score);
          player = player_init(player);
          drawlocation = player.y-20;
@@ -1321,7 +1321,7 @@ int main(int argc, char *argv[]){
        if(shieldup==1&&super_shield>0){
          for(int shieldloop = 0; shieldloop<12; shieldloop++){
            if(check_collision(landers[landerloop], shields[shieldloop])==1){
-             boom_object(boomstuff, landers[landerloop], boomsound, boomchannel);
+             drawlocation = boom_object(drawlocation, boomstuff, landers[landerloop], boomsound, boomchannel);
              landers[landerloop] = object_out(landers[landerloop]);
              score = score + 10;
            };
@@ -1339,7 +1339,7 @@ int main(int argc, char *argv[]){
          lives--;
          //add to score
          score = score + 10;
-         boom_object(boomstuff, player, boomsound, boomchannel);
+         drawlocation = boom_object(drawlocation, boomstuff, player, boomsound, boomchannel);
          life_loss(lives, score);
          player = player_init(player);
          drawlocation = player.y-20;
@@ -1358,7 +1358,7 @@ int main(int argc, char *argv[]){
        if(shieldup==1&&super_shield>0){
          for(int shieldloop = 0; shieldloop<12; shieldloop++){
            if(check_collision(crazies[crazyloop], shields[shieldloop])==1){
-             boom_object(boomstuff, crazies[crazyloop], boomsound, boomchannel);
+             drawlocation = boom_object(drawlocation, boomstuff, crazies[crazyloop], boomsound, boomchannel);
              crazies[crazyloop] = object_out(crazies[crazyloop]);
              score = score + 10;
            };
@@ -1376,7 +1376,7 @@ int main(int argc, char *argv[]){
          lives--;
          //add to score
          score = score + 10;
-         boom_object(boomstuff, player, boomsound, boomchannel);
+         drawlocation = boom_object(drawlocation, boomstuff, player, boomsound, boomchannel);
          life_loss(lives, score);
          player = player_init(player);
          drawlocation = player.y-20;
@@ -1395,7 +1395,7 @@ int main(int argc, char *argv[]){
        if(shieldup==1&&super_shield>0){
          for(int shieldloop = 0; shieldloop<12; shieldloop++){
            if(check_collision(crawlers[crawlerloop], shields[shieldloop])==1){
-             boom_object(boomstuff, crawlers[crawlerloop], boomsound, boomchannel);
+             drawlocation = boom_object(drawlocation, boomstuff, crawlers[crawlerloop], boomsound, boomchannel);
              crawlers[crawlerloop] = object_out(crawlers[crawlerloop]);
              score = score + 10;
            };
@@ -1410,7 +1410,7 @@ int main(int argc, char *argv[]){
         if(check_collision(player, bosses[bossloop])==1){
          //kill player only
          lives--;
-         boom_object(boomstuff, player, boomsound, boomchannel);
+         drawlocation = boom_object(drawlocation, boomstuff, player, boomsound, boomchannel);
          life_loss(lives, score);
          player = player_init(player);
          drawlocation = player.y-20;
@@ -1434,8 +1434,8 @@ int main(int argc, char *argv[]){
       if(missiles[missileloop].active == 1){
         if(check_collision(landers[missiles[missileloop].chase], missiles[missileloop])==1){
          //kill missile and lander
-         boom_object(boomstuff, landers[missiles[missileloop].chase], boomsound, boomchannel);
-         boom_object(boomstuff, missiles[missileloop], boomsound, boomchannel);
+         drawlocation = boom_object(drawlocation, boomstuff, landers[missiles[missileloop].chase], boomsound, boomchannel);
+         drawlocation = boom_object(drawlocation, boomstuff, missiles[missileloop], boomsound, boomchannel);
          landers[missiles[missileloop].chase] = object_out(landers[missiles[missileloop].chase]);
          missiles[missileloop] = object_out(missiles[missileloop]);
         };
@@ -1509,7 +1509,7 @@ int main(int argc, char *argv[]){
          //kill landershot and player
          lives--;
          landershot[landershotloop] = object_out(landershot[landershotloop]);  
-         boom_object(boomstuff, player, boomsound, boomchannel);
+         drawlocation = boom_object(drawlocation, boomstuff, player, boomsound, boomchannel);
          life_loss(lives, score);
          player = player_init(player);
          drawlocation = player.y-20;
index 174eb3f..c85331d 100644 (file)
@@ -22,9 +22,7 @@ game_object encrazify(game_object lander, game_object crazy, Mix_Chunk *sound, i
   return crazy;
 }
 
-void boom_object(game_object boomstuff, game_object object, Mix_Chunk *sound, int channel){
-
-  extern int drawlocation;
+int boom_object(int drawlocation, game_object boomstuff, game_object object, Mix_Chunk *sound, int channel){
 
   int deathcycle=1;
   int loop=1;
@@ -57,6 +55,8 @@ void boom_object(game_object boomstuff, game_object object, Mix_Chunk *sound, in
   if(object.number!=1){
     usleep(50000);
   };
+
+  return drawlocation;
 }
 
 void life_loss(int lives, int score){
index f590a6b..a6b7257 100644 (file)
--- a/mishaps.h
+++ b/mishaps.h
@@ -1,3 +1,3 @@
 game_object encrazify(game_object, game_object, Mix_Chunk*, int);
-void boom_object(game_object, game_object, Mix_Chunk*, int);
+int boom_object(int, game_object, game_object, Mix_Chunk*, int);
 void life_loss(int, int);