]> git.mxchange.org Git - quix0rs-blobwars.git/blobdiff - src/enemies.cpp
Ensure the map editor can be compiled.
[quix0rs-blobwars.git] / src / enemies.cpp
index 4ee1595e32197a9c087cd40034502eb547ef539f..1e59f832cc118919568ce386c2a37696611272a2 100644 (file)
@@ -268,9 +268,8 @@ void doAI(Entity *enemy)
        // Don't enter areas you're not supposed to
        if (enemy->tx != (int)enemy->x)
        {
-               if (!(enemy->flags & ENT_FLIES))
+               if (!(enemy->flags & (ENT_FLIES|ENT_SWIMS)))
                {
-                       //if ((map.data[x][y] == MAP_AIR) || (map.data[x][y] >= MAP_DECORATION))
                        if (!map.isSolid(x, y))
                        {
                                enemy->tx = (int)enemy->x;
@@ -344,6 +343,18 @@ void doAI(Entity *enemy)
        lookForPlayer(enemy);
 }
 
+void checkCombo()
+{
+       int old = game.currentComboHits;
+       
+       game.doCombo();
+       
+       if (old == 24 && game.currentComboHits == 25)
+       {
+               presentPlayerMedal("25_Hit_Combo");
+       }
+}
+
 void enemyBulletCollisions(Entity *bullet)
 {
        if (bullet->health < 1)
@@ -366,7 +377,7 @@ void enemyBulletCollisions(Entity *bullet)
 
                if ((bullet->owner == &player) || (bullet->owner == &engine.world) || (bullet->flags & ENT_BOSS))
                {
-                       sprintf(comboString, "Combo-%s", bullet->name);
+                       snprintf(comboString, sizeof comboString, "Combo-%s", bullet->name);
 
                        if (Collision::collision(enemy, bullet))
                        {
@@ -439,12 +450,12 @@ void enemyBulletCollisions(Entity *bullet)
                                        {       
                                                if (bullet->owner == &player)
                                                {
-                                                       game.score += enemy->value;
+                                                       addPlayerScore(enemy->value);
                                                        game.currentMissionEnemiesDefeated++;
        
                                                        if (player.currentWeapon != &weapon[WP_LASER])
                                                        {
-                                                               game.doCombo();
+                                                               checkCombo();
                                                        }
                                                        
                                                        checkObjectives(comboString, false);
@@ -494,7 +505,7 @@ void enemyBulletCollisions(Entity *bullet)
                                        {
                                                if (player.currentWeapon != &weapon[WP_LASER])
                                                {
-                                                       game.doCombo();
+                                                       checkCombo();
                                                        checkObjectives(comboString, false);
                                                }
                                        }
@@ -503,7 +514,7 @@ void enemyBulletCollisions(Entity *bullet)
                                if (game.currentComboHits >= 3)
                                {
                                        char message[50];
-                                       sprintf(message, _("%d Hit Combo!"), game.currentComboHits);
+                                       snprintf(message, sizeof message, _("%d Hit Combo!"), game.currentComboHits);
                                        engine.setInfoMessage(message, 0, INFO_NORMAL);
                                }
 
@@ -837,7 +848,7 @@ void loadDefEnemies()
 {
        for (int i = 0 ; i < MAX_ENEMIES ; i++)
        {
-               strcpy(defEnemy[i].name, "");
+               defEnemy[i].name[0] = 0;
        }
 
        int enemy = 0;