changeset 2488:e8130e8c116f

Слияние
author Ritor1
date Thu, 11 Sep 2014 17:26:30 +0600
parents 0683c0a38282 (current diff) 1e70f8470638 (diff)
children ceda74e07201
files
diffstat 3 files changed, 81 insertions(+), 145 deletions(-) [+]
line wrap: on
line diff
--- a/DecalBuilder.cpp	Thu Sep 11 17:26:19 2014 +0600
+++ b/DecalBuilder.cpp	Thu Sep 11 17:26:30 2014 +0600
@@ -386,7 +386,7 @@
         pGame->pIndoorCameraD3D->_436CDC_mess_with_lightmap__clipflag_2(v13->pVertices, v13->uNumVertices, this->pVertices, &a8b);
         //v40 = (int)v31;
         //v39 = this->pVertices;
-        pGame->pIndoorCameraD3D->_437143(a8b, v13->pVertices, this->pVertices, (unsigned int *)v13->uNumVertices);
+        pGame->pIndoorCameraD3D->_437143(a8b, v13->pVertices, this->pVertices, (unsigned int *)&v13->uNumVertices);
       }
       else if ( uClipFlags & 4 )
       {
@@ -395,7 +395,7 @@
         pGame->pIndoorCameraD3D->_436F09_mess_with_lightmap__clipflag_4(v13->pVertices, v13->uNumVertices, this->pVertices, &a8b);
         //v40 = (int)v31;
         //v39 = this->pVertices;
-        pGame->pIndoorCameraD3D->_437143(a8b, v13->pVertices, this->pVertices, (unsigned int *)v13->uNumVertices);
+        pGame->pIndoorCameraD3D->_437143(a8b, v13->pVertices, this->pVertices, (unsigned int *)&v13->uNumVertices);
       }
       else
         MessageBoxA(nullptr, "Undefined clip flag specified", "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\PolyProjector.cpp:258", 0);
--- a/Keyboard.cpp	Thu Sep 11 17:26:19 2014 +0600
+++ b/Keyboard.cpp	Thu Sep 11 17:26:30 2014 +0600
@@ -705,30 +705,44 @@
             }
             break;
           case INPUT_CastReady:
-            if (pCurrentScreen != SCREEN_GAME)
-              break;
-            if (pParty->bTurnBasedModeOn && pTurnEngine->turn_stage == TE_MOVEMENT)
             {
-              pTurnEngine->field_18 |= TE_FLAG_8;
-              break;
+              if (pCurrentScreen != SCREEN_GAME)
+                break;
+              if (pParty->bTurnBasedModeOn && pTurnEngine->turn_stage == TE_MOVEMENT)
+              {
+                pTurnEngine->field_18 |= TE_FLAG_8;
+                break;
+              }
+              if ( !uActiveCharacter )
+                break;
+              uchar quickSpellNumber = pPlayers[uActiveCharacter]->uQuickSpell;
+              v9 = pPlayers[uActiveCharacter]->pActiveSkills[quickSpellNumber / 11 + 12];
+              bool enoughMana = false;
+              if ((v9 & 0x100) != 0)
+              {
+                enoughMana = pSpellDatas[quickSpellNumber].uMagisterLevelMana < pPlayers[uActiveCharacter]->sMana;
+              }
+              else if ((v9 & 0x80) != 0)
+              {
+                enoughMana = pSpellDatas[quickSpellNumber].uMasterLevelMana < pPlayers[uActiveCharacter]->sMana;
+              }
+              else if ((v9 & 0x40) != 0)
+              {
+                enoughMana = pSpellDatas[quickSpellNumber].uExpertLevelMana < pPlayers[uActiveCharacter]->sMana;
+              }
+              else
+              {
+                enoughMana = pSpellDatas[quickSpellNumber].uNormalLevelMana < pPlayers[uActiveCharacter]->sMana;
+              }
+              if ( !pPlayers[uActiveCharacter]->uQuickSpell || bUnderwater || !enoughMana)
+              {
+                pPartyActionQueue = pPartyActionQueue;
+                pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Attack, 0, 0);
+                break;
+              }
+              else
+                pMessageQueue_50C9E8->AddGUIMessage(UIMSG_CastQuickSpell, 0, 0);
             }
-            if ( !uActiveCharacter )
-              break;
-            v9 = pPlayers[uActiveCharacter]->pActiveSkills[(unsigned __int8)pPlayers[uActiveCharacter]->uQuickSpell / 11 + 12];
-            if ( !pPlayers[uActiveCharacter]->uQuickSpell || bUnderwater
-              || (( !(HIBYTE(v9) & 1)) ? 
-                 ((v9 & 0x80) == 0 ? 
-                 ((v9 & 0x40) == 0 ? spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uNormalLevelMana : spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uExpertLevelMana) : 
-                 spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uMasterLevelMana) : 
-                 spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uMagisterLevelMana,
-                 spell_price > pPlayers[uActiveCharacter]->sMana) )
-            {
-              pPartyActionQueue = pPartyActionQueue;
-              pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Attack, 0, 0);
-              break;
-            }
-            else
-              pMessageQueue_50C9E8->AddGUIMessage(UIMSG_CastQuickSpell, 0, 0);
             break;
           case INPUT_Attack:
             if (pCurrentScreen != SCREEN_GAME)
--- a/SpriteObject.cpp	Thu Sep 11 17:26:19 2014 +0600
+++ b/SpriteObject.cpp	Thu Sep 11 17:26:30 2014 +0600
@@ -84,130 +84,52 @@
   field_64.z = vPosition.z;
 
   assert(sizeof(SpriteObject) == 0x70);
-  memcpy(&pSpriteObjects[v6], this, sizeof(*this));
-  if ( a5 == 0 )
-  {
-    pSpriteObjects[v6].vVelocity.z = 0;
-    if ( a4 )
-    {
-      v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch));
-      a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch));
-      pSpriteObjects[v6].vVelocity.x = fixpoint_mul(v13, a4);
-      pSpriteObjects[v6].vVelocity.y = fixpoint_mul(a5a, a4);
-      pSpriteObjects[v6].vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4);
-    }
-    else
-    {
-      pSpriteObjects[v6].vVelocity.y = 0;
-      pSpriteObjects[v6].vVelocity.x = 0;
-    }
-    if ( v6 >= (signed int)uNumSpriteObjects )
-      uNumSpriteObjects = v6 + 1;
-    return v6;
-  }
-  if ( a5 == 1 )
-  {
-    v17.x = vPosition.x;
-    v17.y = vPosition.y;
-    v17.z = vPosition.z;
-    Vec3_int_::Rotate(24, stru_5C6E00->uIntegerHalfPi + pSpriteObjects[v6].uFacing, 0, v17, &pSpriteObjects[v6].vPosition.x,
-                      &pSpriteObjects[v6].vPosition.y, &pSpriteObjects[v6].vPosition.z);
-    pSpriteObjects[v6].vVelocity.z = 0;
-    if ( a4 )
-    {
-      v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch));
-      a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch));
-      pSpriteObjects[v6].vVelocity.x = fixpoint_mul(v13, a4);
-      pSpriteObjects[v6].vVelocity.y = fixpoint_mul(a5a, a4);
-      pSpriteObjects[v6].vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4);
-    }
-    else
-    {
-      pSpriteObjects[v6].vVelocity.y = 0;
-      pSpriteObjects[v6].vVelocity.x = 0;
-    }
-    if ( v6 >= (signed int)uNumSpriteObjects )
-      uNumSpriteObjects = v6 + 1;
-    return v6;
-  }
-  if ( a5 == 2 )
+  
+  switch (a5)
   {
-    v17.x = vPosition.x;
-    v17.y = vPosition.y;
-    v17.z = vPosition.z;
-    Vec3_int_::Rotate(8, stru_5C6E00->uIntegerHalfPi + pSpriteObjects[v6].uFacing, 0, v17, &pSpriteObjects[v6].vPosition.x,
-                      &pSpriteObjects[v6].vPosition.y, &pSpriteObjects[v6].vPosition.z);
-    pSpriteObjects[v6].vVelocity.z = 0;
-    if ( a4 )
-    {
-      v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch)) >> 16;
-      a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch)) >> 16;
-      pSpriteObjects[v6].vVelocity.x = fixpoint_mul(v13, a4);
-      pSpriteObjects[v6].vVelocity.y = fixpoint_mul(a5a, a4);
-      pSpriteObjects[v6].vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4);
-    }
-    else
-    {
-      pSpriteObjects[v6].vVelocity.y = 0;
-      pSpriteObjects[v6].vVelocity.x = 0;
-    }
-    if ( v6 >= (signed int)uNumSpriteObjects )
-      uNumSpriteObjects = v6 + 1;
-    return v6;
-  }
-  if ( a5 == 3 )
-  {
-    v17.x = vPosition.x;
-    v17.y = vPosition.y;
-    v17.z = vPosition.z;
-    Vec3_int_::Rotate(8, pSpriteObjects[v6].uFacing - stru_5C6E00->uIntegerHalfPi, 0, v17, &pSpriteObjects[v6].vPosition.x,
-                      &pSpriteObjects[v6].vPosition.y, &pSpriteObjects[v6].vPosition.z);
-    pSpriteObjects[v6].vVelocity.z = 0;
-    if ( a4 )
-    {
-      v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch));
-      a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch));
-      pSpriteObjects[v6].vVelocity.x = fixpoint_mul(v13, a4);
-      pSpriteObjects[v6].vVelocity.y = fixpoint_mul(a5a, a4);
-      pSpriteObjects[v6].vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4);
-    }
-    else
-    {
-      pSpriteObjects[v6].vVelocity.y = 0;
-      pSpriteObjects[v6].vVelocity.x = 0;
-    }
-    if ( v6 >= (signed int)uNumSpriteObjects )
-      uNumSpriteObjects = v6 + 1;
-    return v6;
-  }
-  if ( a5 == 4 )
-  {
-    v17.x = vPosition.x;
-    v17.y = vPosition.y;
-    v17.z = vPosition.z;
-    Vec3_int_::Rotate(24, pSpriteObjects[v6].uFacing - stru_5C6E00->uIntegerHalfPi, 0, v17, &pSpriteObjects[v6].vPosition.x,
-                      &pSpriteObjects[v6].vPosition.y, &pSpriteObjects[v6].vPosition.z);
-    pSpriteObjects[v6].vVelocity.z = 0;
-    if ( a4 )
-    {
-      v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch));
-      a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch));
-      pSpriteObjects[v6].vVelocity.x = fixpoint_mul(v13, a4);
-      pSpriteObjects[v6].vVelocity.y = fixpoint_mul(a5a, a4);
-      pSpriteObjects[v6].vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4);
-    }
-    else
-    {
-      pSpriteObjects[v6].vVelocity.y = 0;
-      pSpriteObjects[v6].vVelocity.x = 0;
-    }
-    if ( v6 >= (signed int)uNumSpriteObjects )
-      uNumSpriteObjects = v6 + 1;
-    return v6;
+  case 0:
+    break;  //do nothing
+  case 1:
+    Vec3_int_::Rotate(24, stru_5C6E00->uIntegerHalfPi + uFacing, 0, vPosition, &vPosition.x,
+      &vPosition.y, &vPosition.z);
+    break;
+  case 2:
+    Vec3_int_::Rotate(8, stru_5C6E00->uIntegerHalfPi + uFacing, 0, vPosition, &vPosition.x,
+      &vPosition.y, &vPosition.z);
+    break;
+  case 3:
+    Vec3_int_::Rotate(8, uFacing - stru_5C6E00->uIntegerHalfPi, 0, vPosition, &vPosition.x,
+      &vPosition.y, &vPosition.z);
+    break;
+  case 4:
+    Vec3_int_::Rotate(24, uFacing - stru_5C6E00->uIntegerHalfPi, 0, vPosition, &vPosition.x,
+      &vPosition.y, &vPosition.z);
+    break;
+  default:
+    assert(false);
+    return 0;
+    break;
   }
 
-  assert(false);
-  return 0;
+  if ( a4 )
+  {
+    v13 = fixpoint_mul(stru_5C6E00->Cos(angle), stru_5C6E00->Cos(pitch));
+    a5a = fixpoint_mul(stru_5C6E00->Sin(angle), stru_5C6E00->Cos(pitch));
+    vVelocity.x = fixpoint_mul(v13, a4);
+    vVelocity.y = fixpoint_mul(a5a, a4);
+    vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pitch), a4);
+  }
+  else
+  {
+    vVelocity.y = 0;
+    vVelocity.x = 0;
+    vVelocity.z = 0;
+  }
+
+  memcpy(&pSpriteObjects[v6], this, sizeof(*this));
+  if ( v6 >= (signed int)uNumSpriteObjects )
+    uNumSpriteObjects = v6 + 1;
+  return v6;
 }
 
 //----- (00471C03) --------------------------------------------------------