diff mm7_3.cpp @ 609:42d5777c2f47

Слияние
author Ritor1
date Wed, 06 Mar 2013 18:22:25 +0600
parents 653724e9c234 bcae3e06cadb
children 5bf285f56fa8
line wrap: on
line diff
--- a/mm7_3.cpp	Wed Mar 06 18:22:07 2013 +0600
+++ b/mm7_3.cpp	Wed Mar 06 18:22:25 2013 +0600
@@ -125,7 +125,7 @@
     {
       v9 = &pIndoor->pSectors[v33[result]];
       v10 = 0;
-      v32 = v9->uNumFloors + v9->field_C + v9->field_14;
+      v32 = v9->uNumFloors + v9->uNumWalls + v9->uNumCeilings;
       v26 = 0;
       if ( v32 > 0 )
         break;
@@ -1526,7 +1526,6 @@
   int v7; // [sp+10h] [bp-8h]@1
   signed int v8; // [sp+14h] [bp-4h]@1
 
-  __debugbreak();
   v5 = x - 2;
   v7 = x;
   v8 = y;
@@ -1650,10 +1649,10 @@
   v80 = _46ED1B_collide_against_floor(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID);
   if ( pParty->bFlying )
   {
-    pParty->bFlying = 0;
-    __debugbreak();
+    pParty->bFlying = false;
     if (pParty->FlyActive())
-      stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] |= 1u;// 005E4D58 pOtherOverlayList [negindexing]
+      pOtherOverlayList->pOverlays[pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID - 1].field_E |= 1;
+      //stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1u;// 005E4D58 pOtherOverlayList [negindexing]
   }
   if ( v80 == -30000 )
   {
@@ -1703,9 +1702,9 @@
 LABEL_20:
   if ( v6 - party_z > 512 && !bFeatherFall && party_z <= v80 + 1 )
   {
-    if ( BYTE1(pParty->uFlags) & 1 )
-    {
-      BYTE1(pParty->uFlags) &= 0xFEu;
+    if (pParty->uFlags & PARTY_FLAGS_1_LANDING)
+    {
+      pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
     }
     else for (uint i = 0; i < 4; ++i)
     {                                      // receive falling damage
@@ -1928,7 +1927,7 @@
       v89 -= pEventTimer->uTimeElapsed * GetGravityStrength();
       goto LABEL_92;
     }
-    if ( BYTE1(pParty->uFlags) & 1 )
+    if (pParty->uFlags & PARTY_FLAGS_1_LANDING)
       goto LABEL_92;
     v89 = 0;
   }
@@ -2182,16 +2181,16 @@
     }
   }
   if ( !bJumping || bFeatherFall )
-    pParty->uFlags &= 0xFFFFFFF7u;
-  else
-    pParty->uFlags |= 8u;
-  BYTE1(pParty->uFlags) &= 0xFDu;
+    pParty->uFlags &= ~PARTY_FLAGS_1_FALLING;
+  else
+    pParty->uFlags |= PARTY_FLAGS_1_FALLING;
+  pParty->uFlags &= ~0x200;
   pParty->vPosition.x = new_party_x;
   pParty->vPosition.z = new_party_z;
   pParty->vPosition.y = new_party_y;
   pParty->uFallSpeed = v89;
   if ( !bJumping && BYTE3(pIndoor->pFaces[uFaceID].uAttributes) & 0x40 )
-    BYTE1(pParty->uFlags) |= 2u;
+    pParty->uFlags |= 0x200;
   if (uFaceEvent)
     EventProcessor(uFaceEvent, 0, 1);
 }
@@ -2371,7 +2370,7 @@
   }
 //  bFeatherFall = 1;
 //LABEL_9:
-  LOBYTE(pParty->uFlags) &= 0x7Fu;
+  pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER;
   if (pParty->WaterWalkActive())
   {
     //LOBYTE(pParty->uFlags) &= 0x7Fu;
@@ -2477,7 +2476,7 @@
         pParty->bFlying = false;
         if (bUnderwater ||
             pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1 ||
-            pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].sMana <= 0 )
+            pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].sMana > 0 )
           {
             if ( pParty->vPosition.z < 4000 || bJumping )
             {
@@ -2498,7 +2497,7 @@
                 pParty->field_6E0 = 0;
                 pParty->field_6E4 = 0;
                 pPartyActionQueue->uNumActions = 0;
-                BYTE1(pParty->uFlags) |= 1u;
+                pParty->uFlags |= PARTY_FLAGS_1_LANDING;
                 pParty->vPosition.z = v109 - pParty->uPartyHeight - 31;
                 pParty->field_6F0 = v123;
                 pParty->bFlying = 0;
@@ -2518,7 +2517,7 @@
           pParty->bFlying = 0;
           if ( bUnderwater
             || pParty->pPartyBuffs[7].uFlags & 1
-            || pParty->pPlayers[pParty->pPartyBuffs[7].uCaster-1].sMana <= 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[7].uCaster + 10] > 0 )
+            || pParty->pPlayers[pParty->pPartyBuffs[7].uCaster - 1].sMana > 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[7].uCaster + 10] > 0 )
           {
             v123 -= 30;
             v113 -= 30;
@@ -3148,9 +3147,9 @@
     }
   }
   if ( !bJumping || v101 )
-    pParty->uFlags &= 0xFFFFFFF7u;
-  else
-    pParty->uFlags |= 8u;
+    pParty->uFlags &= ~PARTY_FLAGS_1_FALLING;
+  else
+    pParty->uFlags |= PARTY_FLAGS_1_FALLING;
   v126 = WorldPosToGridCellX(pParty->vPosition.x);
   v65 = WorldPosToGridCellZ(pParty->vPosition.y) - 1;
   v114 = WorldPosToGridCellX(v116);
@@ -3193,9 +3192,9 @@
         pParty->vPosition.z = v105;
         if ( pParty->uFallStartY - v70 > 512 && !bFeatherFall && v70 <= v105 && !bUnderwater )
         {
-          if ( pParty->uFlags & 0x100 )
-          {
-            BYTE1(pParty->uFlags) &= 0xFEu;
+          if ( pParty->uFlags & PARTY_FLAGS_1_LANDING )
+          {
+            pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
           }
           else
           {
@@ -3226,7 +3225,7 @@
           pParty->field_6F0 = v109 - pParty->uPartyHeight - 1;
         }
       }
-      LOWORD(pParty->uFlags) &= 0xFDFBu;
+      pParty->uFlags &= ~0x204;
     }
     return;
   }
@@ -3261,15 +3260,17 @@
 LABEL_313:
     if ( bWaterWalk )
     {
-      LOBYTE(pParty->uFlags) &= 0x7Fu;
-      v79 = 20 * pParty->pPartyBuffs[18].uOverlayID + 6180178;
-      *(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[18].uOverlayID + 119] |= 1u;
+      pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER;
+      //v79 = 20 * pParty->pPartyBuffs[18].uOverlayID + 6180178;
+      //*(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[18].uOverlayID + 119] |= 1u;
+      v79 = (int)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[18].uOverlayID + 119];
+      *(short *)v79 |= 1u;
       if ( !v122 || !v69 )
       {
         if ( !v76 )
         {
           v80 = *(short *)v79;
-          LOBYTE(pParty->uFlags) |= 0x80u;
+          pParty->uFlags |= PARTY_FLAGS_1_STANDING_ON_WATER;
           *(short *)v79 = v80 & 0xFFFE;
         }
       }
@@ -3313,9 +3314,9 @@
       pParty->vPosition.z = v105;
       if ( pParty->uFallStartY - v81 > 512 && !bFeatherFall && v81 <= v105 && !bUnderwater )
       {
-        if ( pParty->uFlags & 0x100 )
-        {
-          BYTE1(pParty->uFlags) &= 0xFEu;
+        if ( pParty->uFlags & PARTY_FLAGS_1_LANDING )
+        {
+          pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
         }
         else
         {
@@ -6165,47 +6166,38 @@
   array_50AC10[3].vWorldViewProjX = pViewport->uViewportZ;
   array_50AC10[3].vWorldViewProjY = v38;
 
-  v36 = (double)(pViewport->uViewportZ - pViewport->uViewportX) * 0.5;
+  /*v36 = (double)(pViewport->uViewportZ - pViewport->uViewportX) * 0.5;
   v33 = 65536 / (signed int)(v36 / tan(0.6457717418670654) + 0.5);
 
   for (int i = 0; i < _this.uNumVertices; ++i)
   {
-     v29 = floorf(array_50AC10[i].vWorldViewProjY + 0.5f);
-     v39 = (unsigned __int64)(_this.ptr_38->field_14 * v33 * (v30 - v29)) / 65536;
-     v8 = v39 + _this.ptr_38->field_C;
-
-     v39 = (unsigned __int64)(_this.ptr_38->field_20 * v33 * (v30 - v29)) / 65536;
-     v36 = v39 + _this.ptr_38->field_18;
-
-      v9 = (unsigned __int64)(_this.v_18.z * v33 * (v30 - v29)) / 65536;
-      v10 = _this.v_18.x + v9;
-      v39 = _this.v_18.x + v9;
-      if ( _this.v_18.x + v9 > 0 )
-      {
-        v10 = 0;
-        v39 = 0;
-      }
-      v11 = (signed __int64)array_50AC10[i].vWorldViewProjX;
-      v38 = v10;
-      v12 = array_50AC10[i].vWorldViewProjY - 1.0;
-      v13 = v33 * (pViewport->uScreenCenterX - v11);
-      v34 = -_this.field_24;
-      v32 = (signed __int64)v12;
-      v14 = v33 * (v30 - v32);
-      while ( 1 )
-      {
-        v40 = v14;
-        if ( !v10 )
-          goto LABEL_12;
-        v37 = abs(v34 >> 14);
-        v15 = abs(v10);
-        if ( v37 <= v15 || v32 <= pViewport->uViewportY )
-        {
-          if ( v39 <= 0 )
-            break;
-        }
-        v14 = v40;
-LABEL_12:
+    v29 = floorf(array_50AC10[i].vWorldViewProjY + 0.5f);
+    v39 = (unsigned __int64)(_this.ptr_38->field_14 * v33 * (v30 - v29)) / 65536;
+    v8 = v39 + _this.ptr_38->field_C;
+
+    v39 = (unsigned __int64)(_this.ptr_38->field_20 * v33 * (v30 - v29)) / 65536;
+    v36 = v39 + _this.ptr_38->field_18;
+
+    v9 = (unsigned __int64)(_this.v_18.z * v33 * (v30 - v29)) / 65536;
+    v10 = _this.v_18.x + v9;
+    v39 = _this.v_18.x + v9;
+    if ( _this.v_18.x + v9 > 0 )
+    {
+      v10 = 0;
+      v39 = 0;
+    }
+    v11 = (signed __int64)array_50AC10[i].vWorldViewProjX;
+    v38 = v10;
+    v12 = array_50AC10[i].vWorldViewProjY - 1.0;
+    v13 = v33 * (pViewport->uScreenCenterX - v11);
+    v34 = -_this.field_24;
+    v32 = (signed __int64)v12;
+    v14 = v33 * (v30 - v32);
+    while ( 1 )
+    {
+      //v40 = v14;
+      if ( !v10 )
+      {
         v37 = _this.v_18.z;
         v16 = (unsigned __int64)(_this.v_18.z * (signed __int64)v14) >> 16;
         --v32;
@@ -6215,46 +6207,66 @@
         v38 = _this.v_18.x + v16;
         break;
       }
-      LODWORD(v17) = v34 << 16;
-      HIDWORD(v17) = v34 >> 16;
-      v18 = v17 / v38;
-      if ( v18 < 0 )
-        v18 = pOutdoorCamera->shading_dist_mist;
-
-      v37 += ((unsigned __int64)(_this.ptr_38->field_10 * v13) >> 16);
-      v36 += ((unsigned __int64)(_this.ptr_38->field_1C * v13) >> 16);
-      v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + (signed int)((unsigned __int64)(v37 * v18) >> 16) / 8;
-      v36 = 224 * pMiscTimer->uTotalGameTimeElapsed + (signed int)((unsigned __int64)(v36 * v18) >> 16) / 8;
-
-      array_50AC10[i].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist;
-      array_50AC10[i]._rhw = 1.0 / (double)(v17 / 65536);
-      array_50AC10[i].u = (double)v35 / (65536.0 * pBitmaps_LOD->pTextures[pOutdoor->uSky_TextureID].uTextureWidth);
-      array_50AC10[i].v = (double)v36 / (65536.0 * pBitmaps_LOD->pTextures[pOutdoor->uSky_TextureID].uTextureWidth);
-    }
-
-     float t = (GetTickCount() % 96000) / 96000.0f;
-
- array_50AC10[0].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist;
- array_50AC10[0]._rhw = 1;
- array_50AC10[0].u = 0;
- array_50AC10[0].v = 0 + t;
-
- array_50AC10[1].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist;
- array_50AC10[1]._rhw = 1;
- array_50AC10[1].u = 0;
- array_50AC10[1].v = 1 + t;
- 
- array_50AC10[2].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist;
- array_50AC10[2]._rhw = 1;
- array_50AC10[2].u = 1;
- array_50AC10[2].v = 0 + t;
-
- array_50AC10[3].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist;
- array_50AC10[3]._rhw = 1;
- array_50AC10[3].u = 1;
- array_50AC10[3].v = 1 + t;
- pRenderer->DrawStrip(_this.uNumVertices, &_this, pBitmaps_LOD->pHardwareTextures[_this.uTileBitmapID]);
- return;
+      v37 = abs(v34 >> 14);
+      v15 = abs(v10);
+      if ( v37 <= v15 || v32 <= pViewport->uViewportY )
+      {
+        if ( v39 <= 0 )
+          break;
+      }
+      //v14 = v40;
+      v37 = _this.v_18.z;
+      v16 = (unsigned __int64)(_this.v_18.z * v14) >> 16;
+      --v32;
+      v14 += v33;
+      v10 = _this.v_18.x + v16;
+      v39 = _this.v_18.x + v16;
+      v38 = _this.v_18.x + v16;
+      break;
+    }
+    LODWORD(v17) = v34 << 16;
+    HIDWORD(v17) = v34 >> 16;
+    v18 = v17 / v38;
+    if ( v18 < 0 )
+      v18 = pOutdoorCamera->shading_dist_mist;
+
+    v37 += ((unsigned __int64)(_this.ptr_38->field_10 * v13) >> 16);
+    v36 += ((unsigned __int64)(_this.ptr_38->field_1C * v13) >> 16);
+    v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + (signed int)((unsigned __int64)(v37 * v18) >> 16) / 8;
+    v36 = 224 * pMiscTimer->uTotalGameTimeElapsed + (signed int)((unsigned __int64)(v36 * v18) >> 16) / 8;
+	*/
+    //array_50AC10[i].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist;
+    //array_50AC10[i]._rhw = 1;
+    //array_50AC10[i].u = (double)v35 / (65536.0 * pBitmaps_LOD->pTextures[pOutdoor->uSky_TextureID].uTextureWidth);
+    //array_50AC10[i].v = (double)v36 / (65536.0 * pBitmaps_LOD->pTextures[pOutdoor->uSky_TextureID].uTextureWidth);
+    //}
+    if ( _this.uNumVertices > 0)
+    {
+      float t = (GetTickCount() % 96000) / 96000.0f;
+
+      array_50AC10[0].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist;
+      array_50AC10[0]._rhw = 1;
+      array_50AC10[0].u = 0;
+      array_50AC10[0].v = 0 + t;
+
+      array_50AC10[1].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist;
+      array_50AC10[1]._rhw = 1;
+      array_50AC10[1].u = 0;
+      array_50AC10[1].v = 1 + t;
+
+      array_50AC10[2].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist;
+      array_50AC10[2]._rhw = 1;
+      array_50AC10[2].u = 1;
+      array_50AC10[2].v = 0 + t;
+
+      array_50AC10[3].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist;
+      array_50AC10[3]._rhw = 1;
+      array_50AC10[3].u = 1;
+      array_50AC10[3].v = 1 + t;
+      pRenderer->DrawStrip(_this.uNumVertices, &_this, pBitmaps_LOD->pHardwareTextures[_this.uTileBitmapID]);
+      return;
+    //}
+  }
 }
 
 
@@ -11653,25 +11665,16 @@
 //----- (0044100D) --------------------------------------------------------
 bool __cdecl sub_44100D()
 {
-  return pCurrentScreen == SCREEN_NPC_DIALOGUE
-      || pCurrentScreen == SCREEN_CHARACTERS
-      || pCurrentScreen > SCREEN_LOADGAME
-      && (pCurrentScreen <= SCREEN_E
-       || pCurrentScreen > SCREEN_VIDEO
-       && (pCurrentScreen <= SCREEN_INPUT_BLV
-        || pCurrentScreen == SCREEN_CASTING));
+  return pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_CHARACTERS ||
+         pCurrentScreen > SCREEN_LOADGAME && pCurrentScreen <= SCREEN_E ||
+         pCurrentScreen > SCREEN_VIDEO && pCurrentScreen <= SCREEN_INPUT_BLV || pCurrentScreen == SCREEN_CASTING;
 }
 // 4E28F8: using guessed type int pCurrentScreen;
 
 //----- (00441498) --------------------------------------------------------
 void __cdecl GameUI_DrawTorchlightAndWizardEye()
 {
-  unsigned int v0; // eax@15
-  IconFrame *v1; // eax@15
-  unsigned int v2; // eax@19
-  IconFrame *v3; // eax@19
-
-  if ( !pCurrentScreen
+  if (pCurrentScreen == SCREEN_GAME
     || pCurrentScreen == SCREEN_MENU
     || pCurrentScreen == SCREEN_OPTIONS
     || pCurrentScreen == SCREEN_REST
@@ -11683,25 +11686,15 @@
     || pCurrentScreen == SCREEN_BOOKS
     || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG )
   {
-    if ( SHIDWORD(pParty->pPartyBuffs[16].uExpireTime) >= 0
-      && (SHIDWORD(pParty->pPartyBuffs[16].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[16].uExpireTime)) )
-    {
-      v0 = pEventTimer->Time();
-      v1 = pIconsFrameTable->GetFrame((signed __int16)pUIAnum_Torchlight->uIconID, v0);
-      pRenderer->DrawTextureTransparent(
-        pUIAnum_Torchlight->x,
-        pUIAnum_Torchlight->y,
-        &pIcons_LOD->pTextures[v1->uTextureID]);
-    }
-    if ( SHIDWORD(pParty->pPartyBuffs[19].uExpireTime) >= 0
-      && (SHIDWORD(pParty->pPartyBuffs[19].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[19].uExpireTime)) )
-    {
-      v2 = pEventTimer->Time();
-      v3 = pIconsFrameTable->GetFrame((signed __int16)pUIAnim_WizardEye->uIconID, v2);
-      pRenderer->DrawTextureTransparent(
-        pUIAnim_WizardEye->x,
-        pUIAnim_WizardEye->y,
-        &pIcons_LOD->pTextures[v3->uTextureID]);
+    if (pParty->TorchlightActive())
+    {
+      auto icon = pIconsFrameTable->GetFrame((signed __int16)pUIAnum_Torchlight->uIconID, pEventTimer->Time());
+      pRenderer->DrawTextureTransparent(pUIAnum_Torchlight->x, pUIAnum_Torchlight->y, pIcons_LOD->GetTexture(icon->uTextureID));
+    }
+    if (pParty->WizardEyeActive())
+    {
+      auto icon = pIconsFrameTable->GetFrame((signed __int16)pUIAnim_WizardEye->uIconID, pEventTimer->Time());
+      pRenderer->DrawTextureTransparent(pUIAnim_WizardEye->x, pUIAnim_WizardEye->y, pIcons_LOD->GetTexture(icon->uTextureID));
     }
   }
 }
@@ -11719,81 +11712,71 @@
 
 
 //----- (004415C5) --------------------------------------------------------
-void __cdecl Load_isn_spells_21_27()
-{
-  signed int v0; // esi@1
-  char pContainer[120]; // [sp+8h] [bp-20h]@2
-
-  v0 = 0;
-  do
-  {
-    sprintf(pContainer, "isn-%02d", v0 + 1);
-    pTextureIDs_isns[v0++] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-  }
-  while ( v0 < 14 );
-  uIconIdx_Spell21 = pIconsFrameTable->FindIcon("spell21");
-  uIconIdx_Spell27 = pIconsFrameTable->FindIcon("spell27");
+void LoadPartyBuffIcons()
+{
+  for (uint i = 0; i < 14; ++i)
+  {
+    char filename[200];
+    sprintf(filename, "isn-%02d", i + 1);
+    pTextureIDs_PartyBuffIcons[i] = pIcons_LOD->LoadTexture(filename, TEXTURE_16BIT_PALETTE);
+  }
+
+  uIconIdx_FlySpell = pIconsFrameTable->FindIcon("spell21");
+  uIconIdx_WaterWalk = pIconsFrameTable->FindIcon("spell27");
 }
 
 //----- (0044162D) --------------------------------------------------------
 void __cdecl GameUI_DrawPartySpells()
 {
   unsigned int v0; // ebp@1
-  signed int v1; // edi@1
-  int v2; // eax@2
-  int v3; // ecx@5
-  __int16 *v4; // ebx@25
-  Player *v5; // edi@26
-  unsigned int v6; // [sp-4h] [bp-1Ch]@11
+  //signed int v1; // edi@1
+  //int v2; // eax@2
+  //int v3; // ecx@5
+  //__int16 *v4; // ebx@25
+  //Player *v5; // edi@26
+  //unsigned int v6; // [sp-4h] [bp-1Ch]@11
   Texture *v7; // [sp-4h] [bp-1Ch]@12
-  unsigned int v8; // [sp-4h] [bp-1Ch]@20
+  //unsigned int v8; // [sp-4h] [bp-1Ch]@20
   Texture *v9; // [sp-4h] [bp-1Ch]@21
-  Player **v10; // [sp+10h] [bp-8h]@25
+  //Player **v10; // [sp+10h] [bp-8h]@25
 
   v0 = (signed __int64)((double)GetTickCount() * 0.050000001);
-  v1 = 0;
-  do
-  {
-    v2 = (unsigned __int8)byte_4E5DD8[v1];
-    if ( SHIDWORD(pParty->pPartyBuffs[v2].uExpireTime) >= 0
-      && (SHIDWORD(pParty->pPartyBuffs[v2].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[v2].uExpireTime) > 0) )
-    {
-      v3 = pTextureIDs_isns[v1];
-      pRenderer->_4A65CC(
-        pPartySpellbuffsUI_XYs[v1][0],
-        pPartySpellbuffsUI_XYs[v1][1],
-        (Texture *)(v3 != -1 ? &pIcons_LOD->pTextures[v3] : 0),
-        (Texture *)(v3 != -1 ? &pIcons_LOD->pTextures[v3] : 0),
-        v0 + 20 * pPartySpellbuffsUI_smthns[v1],
-        0,
-        63);
-    }
-    ++v1;
-  }
-  while ( v1 < 14 );
-  if ( !pCurrentScreen
-    || pCurrentScreen == SCREEN_NPC_DIALOGUE )
-  {
-    if ( (signed __int64)pParty->pPartyBuffs[7].uExpireTime > 0 )
+  //v1 = 0;
+  for (uint i = 0; i < 14; ++i)
+  {
+    //v2 =  byte_4E5DD8[v1];
+    if (pParty->pPartyBuffs[byte_4E5DD8[i]].uExpireTime)
+    {
+      auto tex = pIcons_LOD->GetTexture(pTextureIDs_PartyBuffIcons[i]);
+      //v3 = pTextureIDs_PartyBuffIcons[i];
+      if (tex)
+        pRenderer->_4A65CC(pPartySpellbuffsUI_XYs[i][0],
+                           pPartySpellbuffsUI_XYs[i][1], tex, tex,
+                           v0 + 20 * pPartySpellbuffsUI_smthns[i], 0, 63);
+    }
+    //++v1;
+  }
+  //while ( v1 < 14 );
+
+  if (pCurrentScreen == SCREEN_GAME || pCurrentScreen == SCREEN_NPC_DIALOGUE)
+  {
+    if (pParty->FlyActive())
     {
       if ( pParty->bFlying )
-        v6 = v0;
-      else
-        v6 = 0;
-      v7 = &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconIdx_Spell21, v6)->uTextureID];
+        v7 = &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconIdx_FlySpell, v0)->uTextureID];
+      else
+        v7 = &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconIdx_FlySpell, 0)->uTextureID];
       if ( pRenderer->pRenderD3D )
         pRenderer->DrawTextureIndexed(8u, 8u, v7);
       else
         pRenderer->DrawTextureTransparent(8u, 8u, v7);
     }
-    if ( SHIDWORD(pParty->pPartyBuffs[18].uExpireTime) >= 0
-      && (SHIDWORD(pParty->pPartyBuffs[18].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[18].uExpireTime)) )
-    {
-      if ( pParty->uFlags & 0x80 )
-        v8 = v0;
-      else
-        v8 = 0;
-      v9 = &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconIdx_Spell27, v8)->uTextureID];
+    if (pParty->WaterWalkActive())
+    {
+      if ( pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER)
+        v9 = &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, v0)->uTextureID];
+      else
+        v9 = &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, 0)->uTextureID];
       if ( pRenderer->pRenderD3D )
         pRenderer->DrawTextureIndexed(396u, 8u, v9);
       else
@@ -11801,37 +11784,19 @@
     }
   }
 
-  uint _it = 0;
-  v10 = &pPlayers[1];
-  v4 = pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing;
-  do
-  {
-    v5 = *v10;
-    if ( (signed __int64)(*v10)->pPlayerBuffs[6].uExpireTime > 0 )
-      pRenderer->DrawTextureIndexed(
-        *v4 + 72,
-        0x1ABu,
-        (Texture *)(dword_507964 != -1 ? &pIcons_LOD->pTextures[dword_507964] : 0));
-    if ( (signed __int64)v5->pPlayerBuffs[1].uExpireTime > 0 )
-      pRenderer->DrawTextureIndexed(
-        *v4 + 72,
-        0x189u,
-        (Texture *)(dword_50796C != -1 ? &pIcons_LOD->pTextures[dword_50796C] : 0));
-    if ( (signed __int64)v5->pPlayerBuffs[11].uExpireTime > 0 )
-      pRenderer->DrawTextureIndexed(
-        *v4 + 72,
-        0x19Au,
-        (Texture *)(dword_507968 != -1 ? &pIcons_LOD->pTextures[dword_507968] : 0));
-    if ( (signed __int64)v5->pPlayerBuffs[10].uExpireTime > 0 )
-      pRenderer->DrawTextureIndexed(
-        *v4 + 72,
-        0x1BCu,
-        (Texture *)(dword_507960 != -1 ? &pIcons_LOD->pTextures[dword_507960] : 0));
-    ++v10;
-    ++v4;
-  }
-  //while ( (signed int)v4 < (signed int)pBaseHealthByClass );
-  while (++_it != 4);
+  for (uint i = 0; i < 4; ++i)
+  {
+    auto player = pParty->pPlayers + i;
+
+    if (player->pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].uExpireTime)
+      pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 427, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Hammerhands));
+    if (player->pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime)
+      pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 393, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Bless));
+    if (player->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime)
+      pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 410, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Preservation));
+    if (player->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].uExpireTime)
+      pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 444, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_PainReflection));
+  }
 }
 
 //----- (00441A4E) --------------------------------------------------------
@@ -15522,8 +15487,8 @@
   signed int v29; // edx@66
   char *v30; // ecx@67
   unsigned __int16 v31; // ax@70
-  Player *v32; // eax@80
-  unsigned __int16 v33; // si@85
+  //Player *v32; // eax@80
+  //unsigned __int16 v33; // si@85
   int v34; // eax@96
   int v35; // eax@97
   unsigned __int64 v36; // qax@99
@@ -15535,7 +15500,7 @@
   int v42; // esi@111
   int v43; // ebx@111
   int v44; // eax@117
-  unsigned __int16 v45; // si@137
+  //unsigned __int16 v45; // si@137
   unsigned __int16 v46; // [sp-8h] [bp-BCh]@99
   int v47; // [sp-4h] [bp-B8h]@35
   unsigned __int16 v48; // [sp-4h] [bp-B8h]@99
@@ -15551,8 +15516,8 @@
   //SpriteObject a1; // [sp+38h] [bp-7Ch]@12
   int v59; // [sp+A8h] [bp-Ch]@1
   int v60; // [sp+ACh] [bp-8h]@1
-  int spellnum_; // [sp+B0h] [bp-4h]@1
-  signed int levela; // [sp+BCh] [bp+8h]@80
+  //int spellnum_; // [sp+B0h] [bp-4h]@1
+  //signed int levela; // [sp+BCh] [bp+8h]@80
   int a6_4; // [sp+C8h] [bp+14h]@117
   float a7a; // [sp+CCh] [bp+18h]@6
   signed int a7b; // [sp+CCh] [bp+18h]@12
@@ -15565,7 +15530,7 @@
 
   v9 = 0;
   v59 = rank + 1;
-  spellnum_ = spellnum;
+  //spellnum_ = spellnum;
   v60 = 0;
   if ( tox || toy || toz )
   {
@@ -15608,12 +15573,12 @@
   SpriteObject a1; // [sp+38h] [bp-7Ch]@12
   //SpriteObject::SpriteObject(&a1);
 
-  a1.uType = stru_4E3ACC[spellnum_].field_0;
-  if ( spellnum_ > 58 )
-  {
-    if ( spellnum_ == 69 )
+  a1.uType = stru_4E3ACC[spellnum].field_0;
+  if ( spellnum > 58 )
+  {
+    if ( spellnum == 69 )
       goto LABEL_117;
-    if ( spellnum_ != 83 )
+    if ( spellnum != 83 )
       return;
     v40 = v15 - 2;
     if ( v40 )
@@ -15651,9 +15616,9 @@
     v37->Apply(v36, v46, v48, v50, v52);
     goto LABEL_139;
   }
-  if ( spellnum_ != 58 )
-  {
-    switch ( spellnum_ )
+  if ( spellnum != 58 )
+  {
+    switch ( spellnum )
     {
       case 2:
       case 6:
@@ -15665,7 +15630,7 @@
       case 41:
         a1.stru_24.Reset();
         v16 = 0;
-        a1.field_48 = spellnum_;
+        a1.field_48 = spellnum;
         a1.field_4C = level;
         a1.field_50 = v15;
         if ( (signed int)pObjectList->uNumObjects <= 0 )
@@ -15703,7 +15668,7 @@
           a8b = a7c / (v60 - 1);
           a1.stru_24.Reset();
           v21 = 0;
-          a1.field_48 = spellnum_;
+          a1.field_48 = spellnum;
           a1.field_4C = level;
           a1.field_50 = v15;
           if ( (signed int)pObjectList->uNumObjects <= 0 )
@@ -15746,7 +15711,7 @@
         }
         a1.stru_24.Reset();
         v16 = 0;
-        a1.field_48 = spellnum_;
+        a1.field_48 = spellnum;
         a1.field_4C = level;
         a1.field_50 = v15;
         if ( (signed int)pObjectList->uNumObjects <= 0 )
@@ -15799,7 +15764,7 @@
         a8c = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (v60 - 1);
         a1.stru_24.Reset();
         v25 = 0;
-        a1.field_48 = spellnum_;
+        a1.field_48 = spellnum;
         a1.field_4C = level;
         a1.field_50 = v15;
         if ( (signed int)pObjectList->uNumObjects <= 0 )
@@ -15843,14 +15808,15 @@
           return;
         a1.stru_24.Reset();
         v29 = 0;
-        a1.field_48 = spellnum_;
+        a1.field_48 = spellnum;
         a1.field_4C = level;
         a1.field_50 = v15;
         if ( (signed int)pObjectList->uNumObjects <= 0 )
           goto LABEL_70;
         v30 = (char *)&pObjectList->pObjects->uObjectID;
         break;
-      case 5:
+
+      case SPELL_FIRE_HASTE:
         if ( v15 > 0 )
         {
           if ( v15 <= 2 )
@@ -15870,28 +15836,25 @@
             }
           }
         }
-        levela = 1;
-        v32 = pParty->pPlayers;//[0].pConditions[1];
-        do
-        {
-		  if ( v32->pConditions[1] )
-            levela = 0;
-          ++v32;
-        }
-		while ( v32 <= &pParty->pPlayers[3] );
-        if ( !levela )
-          return;
-        pParty->pPartyBuffs[8].Apply(
-          pParty->uTimePlayed + (signed int)(signed __int64)((double)(v9 << 7) * 0.033333335),
+        //levela = 1;
+        //v32 = pParty->pPlayers;//[0].pConditions[1];
+        //do
+        for (uint i = 0; i < 4; ++i)
+          if (pParty->pPlayers[i].pConditions[Player::Condition_Weak])
+            return;
+		//while ( v32 <= &pParty->pPlayers[3] );
+        //if ( !levela )
+        //  return;
+        pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(v9 * 128) * 0.033333335),
           v15,
           0,
           0,
           0);
-        v33 = spellnum_;
-        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum_, 0);
-        pGame->pStru6Instance->SetPlayerBuffAnim(v33, 1u);
-        pGame->pStru6Instance->SetPlayerBuffAnim(v33, 2u);
-        pGame->pStru6Instance->SetPlayerBuffAnim(v33, 3u);
+        //v33 = spellnum_;
+        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 0);
+        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 1);
+        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 2);
+        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 3);
         goto LABEL_138;
       case 17:
       case 38:
@@ -15909,7 +15872,7 @@
             v9 = 3600 * (level + 1);
             break;
         }
-        switch ( spellnum_ )
+        switch ( spellnum )
         {
           case 17:
             v60 = 0;
@@ -15926,10 +15889,10 @@
             v60 = v34;
             break;
         }
-        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum_, 0);
-        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum_, 1u);
-        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum_, 2u);
-        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum_, 3u);
+        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 0);
+        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 1);
+        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 2);
+        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 3);
         v52 = 0;
         v50 = 0;
         v48 = v60;
@@ -15942,10 +15905,10 @@
           v38 = 60 * level;
         else
           v38 = 600 * level;
-        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum_, 0);
-        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum_, 1u);
-        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum_, 2u);
-        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum_, 3u);
+        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 0);
+        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 1);
+        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 2);
+        pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 3);
         v52 = 0;
         v50 = 0;
         v48 = level;
@@ -16017,7 +15980,7 @@
     goto LABEL_124;
   }
 LABEL_125:
-  switch ( spellnum_ )
+  switch ( spellnum )
   {
     case 3:
       level = 6;
@@ -16038,22 +16001,22 @@
       level = 1;
       break;
   }
-  v45 = spellnum_;
-  pGame->pStru6Instance->SetPlayerBuffAnim(spellnum_, 0);
-  pGame->pStru6Instance->SetPlayerBuffAnim(v45, 1u);
-  pGame->pStru6Instance->SetPlayerBuffAnim(v45, 2u);
-  pGame->pStru6Instance->SetPlayerBuffAnim(v45, 3u);
+  //v45 = spellnum_;
+  pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 0);
+  pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 1);
+  pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 2);
+  pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 3);
   pParty->pPartyBuffs[level].Apply(
     pParty->uTimePlayed + (signed int)(signed __int64)((double)a6_4 * 4.2666669),
     v15,
     v60,
     0,
     0);
-  levela = 1;
+  //levela = 1;
 LABEL_138:
-  if ( levela )
+  //if ( levela )
 LABEL_139:
-    pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[spellnum_], 0, 0, fromx, fromy, 0, 0, 0);
+    pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[spellnum], 0, 0, fromx, fromy, 0, 0, 0);
 }
 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[];