diff GUI/UI/UIPopup.cpp @ 2566:30eb6dcac768

big spell fx overhaul
author a.parshin
date Wed, 20 May 2015 21:05:07 +0200
parents 91c75d202d30
children d569340b05ff
line wrap: on
line diff
--- a/GUI/UI/UIPopup.cpp	Wed May 20 15:12:33 2015 +0200
+++ b/GUI/UI/UIPopup.cpp	Wed May 20 21:05:07 2015 +0200
@@ -1452,7 +1452,7 @@
         {
           if ( !(pObjectList->pObjects[pSpriteObjects[PID_ID((unsigned __int16)v5)].uObjectDescID].uFlags & 0x10 ) )
           {
-            GameUI_DrawItemInfo(&pSpriteObjects[PID_ID((unsigned __int16)v5)].stru_24);
+              GameUI_DrawItemInfo(&pSpriteObjects[PID_ID((unsigned __int16)v5)].containing_item);
           }
         }
       }
@@ -1855,111 +1855,52 @@
       GameUI_DrawItemInfo(item);
       return;
     }
-    if ( damage_level == 1 )
-    {
-      pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y);
-      pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 11 + 10, DMGT_FIRE);
-      pAudioPlayer->PlaySound(SOUND_fireBall, 0, 0, -1, 0, 0, 0, 0);
-      pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
-      v39.z = pParty->vPosition.z + pParty->sEyelevel;
-      v39.x = pParty->vPosition.x;
-      v39.y = pParty->vPosition.y;
 
-      int rot_x, rot_y, rot_z;
-      Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z);
-      SpriteObject::sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0);
-      if ( dword_4E455C )
-      {
-        if ( pPlayers[uActiveCharacter]->CanAct() )
-          pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0);
-        ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ξι!
-        dword_4E455C = 0;
-      }
-      pMouse->RemoveHoldingItem();
-      no_rightlick_in_inventory = 1;
-      return;
-    }
-    if ( damage_level == 2 )
-    {
-      pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y);
-      pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 71 + 30, DMGT_FIRE);
-      pPlayers[uActiveCharacter]->ItemsEnchant(1);
-      pAudioPlayer->PlaySound(SOUND_fireBall, 0, 0, -1, 0, 0, 0, 0);
-      pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
-
-      v39.z = pParty->vPosition.z + pParty->sEyelevel;
-      v39.x = pParty->vPosition.x;
-      v39.y = pParty->vPosition.y;
-
-      int rot_x, rot_y, rot_z;
-      Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z);
-      SpriteObject::sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0);
-      if ( dword_4E455C )
-      {
-        if ( pPlayers[uActiveCharacter]->CanAct() )
-          pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0);
-        ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ξι!
-        dword_4E455C = 0;
-      }
-      pMouse->RemoveHoldingItem();
-      no_rightlick_in_inventory = 1;
-      return;
-    }
-    if ( damage_level == 3 )
+    if (damage_level > 0)
     {
-      pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y);
-      pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 201 + 50, DMGT_FIRE);
-      pPlayers[uActiveCharacter]->ItemsEnchant(5);
-      pAudioPlayer->PlaySound(SOUND_fireBall, 0, 0, -1, 0, 0, 0, 0);
-
-      pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
-
-      v39.z = pParty->vPosition.z + pParty->sEyelevel;
-      v39.x = pParty->vPosition.x;
-      v39.y = pParty->vPosition.y;
+        pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y);
 
-      int rot_x, rot_y, rot_z;
-      Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z);
-      SpriteObject::sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0);
-      if ( dword_4E455C )
-      {
-        if ( pPlayers[uActiveCharacter]->CanAct() )
-          pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0);
-        ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ξι!
-        dword_4E455C = 0;
-      }
-      pMouse->RemoveHoldingItem();
-      no_rightlick_in_inventory = 1;
-      return;
+        if (damage_level == 1)
+        {
+            pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 11 + 10, DMGT_FIRE);
+        }
+        else if (damage_level == 2)
+        {
+            pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 71 + 30, DMGT_FIRE);
+            pPlayers[uActiveCharacter]->ItemsEnchant(1);
+        }
+        else if (damage_level == 3)
+        {
+            pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 201 + 50, DMGT_FIRE);
+            pPlayers[uActiveCharacter]->ItemsEnchant(5);        
+        }
+        else if (damage_level >= 4)
+        {
+            pPlayers[uActiveCharacter]->SetCondition(Condition_Eradicated, 0);
+            pPlayers[uActiveCharacter]->ItemsEnchant(0);
+        }
+
+        pAudioPlayer->PlaySound(SOUND_fireBall, 0, 0, -1, 0, 0, 0, 0);
+        pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
+        v39.z = pParty->vPosition.z + pParty->sEyelevel;
+        v39.x = pParty->vPosition.x;
+        v39.y = pParty->vPosition.y;
+
+        int rot_x, rot_y, rot_z;
+        Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z);
+        SpriteObject::sub_42F7EB_DropItemAt(SPRITE_SPELL_FIRE_FIREBALL_IMPACT, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0);
+        if (dword_4E455C)
+        {
+            if (pPlayers[uActiveCharacter]->CanAct())
+                pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0);
+            ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ξι!
+            dword_4E455C = 0;
+        }
+        pMouse->RemoveHoldingItem();
+        no_rightlick_in_inventory = 1;
+        return;
     }
-    if ( damage_level == 4 )
-    {
-      pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y);
-      pPlayers[uActiveCharacter]->SetCondition(Condition_Eradicated, 0);
-      pPlayers[uActiveCharacter]->ItemsEnchant(0);
-      pAudioPlayer->PlaySound(SOUND_fireBall, 0, 0, -1, 0, 0, 0, 0);
-
-      pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
-
-      v39.z = pParty->vPosition.z + pParty->sEyelevel;
-      v39.x = pParty->vPosition.x;
-      v39.y = pParty->vPosition.y;
-
-      int rot_x, rot_y, rot_z;
-      Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z);
-      SpriteObject::sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0);
-      if ( dword_4E455C )
-      {
-        if ( pPlayers[uActiveCharacter]->CanAct() )
-          pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0);
-        ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ξι!
-        dword_4E455C = 0;
-      }
-      pMouse->RemoveHoldingItem();
-      no_rightlick_in_inventory = 1;
-      return;
-    }
-    if ( damage_level == 0 )
+    else //if ( damage_level == 0 )
     {
       if ( alchemy_skill_points )
       {