diff TurnEngine.cpp @ 1456:5c95f2246c2a

TE mostly working
author Gloval
date Wed, 14 Aug 2013 00:40:23 +0400
parents 8ff3c675a726
children 9a6567c6c76c
line wrap: on
line diff
--- a/TurnEngine.cpp	Wed Aug 07 08:55:34 2013 +0400
+++ b/TurnEngine.cpp	Wed Aug 14 00:40:23 2013 +0400
@@ -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: