diff TurnEngine.cpp @ 1465:090ff42290c4

Слияние
author Ritor1
date Mon, 26 Aug 2013 10:39:24 +0600
parents 5c95f2246c2a
children 9a6567c6c76c
line wrap: on
line diff
--- a/TurnEngine.cpp	Mon Aug 26 10:39:10 2013 +0600
+++ b/TurnEngine.cpp	Mon Aug 26 10:39:24 2013 +0600
@@ -357,7 +357,7 @@
         }
     else if ( turn_stage == 2 )
         {
-        if ( field_18 == TE_FLAG_1)
+        if ( !(field_18 &TE_FLAG_1))
             {
             if ( turn_initiative == 100 )
                 {
@@ -375,7 +375,7 @@
         }
     else if ( turn_stage == 3 )
         {
-        if ( (uActionPointsLeft > 0) && (field_18 == TE_FLAG_8) )
+        if ( (uActionPointsLeft > 0) && (!(field_18 & TE_FLAG_8)) )
            ActorAIChooseNewTargets();
         else
             { 
@@ -625,18 +625,16 @@
     else
         uActiveCharacter = 0;
     viewparams->bRedrawGameUI = 1;
-    if (pQueue[0].actor_initiative > 0)
+
+    while ( (pQueue[0].actor_initiative > 0)&&(turn_initiative > 0) )
         {
-        while(turn_initiative > 0)
+        for (i=0; i<uActorQueueSize; ++i)
             {
-            for (i=0; i<uActorQueueSize; ++i)
-                {
-                --pQueue[i].actor_initiative;
-                if (pQueue[i].actor_initiative==0)
-                    pQueue[i].uActionLength=0;
-                }
-            --turn_initiative;
+            --pQueue[i].actor_initiative;
+            if (pQueue[i].actor_initiative==0)
+                pQueue[i].uActionLength=0;
             }
+        --turn_initiative;
         }
     }
 
@@ -1072,7 +1070,7 @@
             }
         else
             {
-             Actor::AI_4032B2(uActorID, a2a, 1024, 0);
+             Actor::AI_RandomMove(uActorID, a2a, 1024, 0);
              v29->AI_action_type = TE_AI_PURSUE;
             }         
     
@@ -1086,11 +1084,11 @@
         {
         if ( actor->pMonsterInfo.uAIType == 1 )
             {
-            if ( actor->pMonsterInfo.uMovementType == 5 )
+            if ( actor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
                 Actor::AI_Stand(uActorID, a2a, 32, 0);
             else
                 Actor::AI_Flee(uActorID, a2a, 32, 0);
-            v29->AI_action_type = 4;
+            v29->AI_action_type = TE_AI_FLEE;
             v29->uActionLength = actor->uCurrentActionLength;
             return 1;
             }
@@ -1099,11 +1097,11 @@
            
             if (((double)actor->pMonsterInfo.uHP * 0.2) > (double)actor->sCurrentHP && (v11 < 10240 ) )
                 {
-                if ( actor->pMonsterInfo.uMovementType == 5 )
+                if ( actor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
                     Actor::AI_Stand(uActorID, a2a, 32, 0);
                 else
                      Actor::AI_Flee(uActorID, a2a, 32, 0);
-                v29->AI_action_type = 4;
+                v29->AI_action_type = TE_AI_FLEE;
                 v29->uActionLength = actor->uCurrentActionLength;
                 return 1;
                 }
@@ -1113,11 +1111,11 @@
 
             if ( ((double)actor->pMonsterInfo.uHP * 0.1) > (double)actor->sCurrentHP && (v11 < 10240 ))
                 {
-                if ( actor->pMonsterInfo.uMovementType == 5 )
+                if ( actor->pMonsterInfo.uMovementType == MONSTER_MOVEMENT_TYPE_STAIONARY )
                     Actor::AI_Stand(uActorID, a2a, 32, 0);
                 else
                      Actor::AI_Flee(uActorID, a2a, 32, 0);
-                v29->AI_action_type = 4;
+                v29->AI_action_type = TE_AI_FLEE;
                 v29->uActionLength = actor->uCurrentActionLength;
                 return 1;
                 }
@@ -1140,19 +1138,19 @@
         }
     switch(actor->pMonsterInfo.uMovementType)
         {
-        case 0: 
-            Actor::AI_4032B2(uActorID, a2a, 1024, 32);
+        case MONSTER_MOVEMENT_TYPE_SHORT: 
+            Actor::AI_RandomMove(uActorID, a2a, 1024, 32);
             break;
-        case 1:
-             Actor::AI_4032B2(uActorID, a2a, 2560, 32);
+        case MONSTER_MOVEMENT_TYPE_MEDIUM:
+             Actor::AI_RandomMove(uActorID, a2a, 2560, 32);
              break;
-         case 2:
-             Actor::AI_4032B2(uActorID, a2a, 5120, 32);
+         case MONSTER_MOVEMENT_TYPE_LONG:
+             Actor::AI_RandomMove(uActorID, a2a, 5120, 32);
              break;
-         case 4:
-             Actor::AI_4032B2(uActorID, a2a, 10240, 32);
+         case MONSTER_MOVEMENT_TYPE_FREE:
+             Actor::AI_RandomMove(uActorID, a2a, 10240, 32);
              break;
-         case 5:
+         case MONSTER_MOVEMENT_TYPE_STAIONARY:
              Actor::AI_Stand(uActorID, a2a, 32, 0);
               break;
          default: