diff Player.cpp @ 223:1bd823f52e3a

Merge
author Gloval
date Sun, 17 Feb 2013 11:41:44 +0400
parents 8113753ed2ae 0c64754c7fd4
children c879446b4a22 0df4136b6aac 0191c3a3271c
line wrap: on
line diff
--- a/Player.cpp	Sun Feb 17 11:29:10 2013 +0400
+++ b/Player.cpp	Sun Feb 17 11:41:44 2013 +0400
@@ -576,7 +576,7 @@
   //Player *pPlayer; // edi@1
   //int v4; // eax@4
   signed int v5; // esi@4
-  char *v6; // ebx@4
+  unsigned char *v6; // ebx@4
   signed int v7; // ecx@5
   unsigned __int8 v8; // al@6
   int v9; // eax@10
@@ -608,8 +608,8 @@
   //v4 = a2;//102
   v5 = 0;
   pSoundId = 0;
-  v6 = (char *)&SoundSetAction[4 * speech];//byte_4ED280 &byte_4ED3D8[4 * v4] ???
-  if ( uVoicesVolumeMultiplier )
+  v6 = SoundSetAction[speech];//byte_4ED280 &byte_4ED3D8[4 * v4] ???
+  if (uVoicesVolumeMultiplier)
   {
     v7 = 0;
     do
@@ -625,17 +625,16 @@
       v9 = rand();
       //pVoiceID = uVoiceID;
       v11 = v20[v9 % v5];
-      if ( LOBYTE((&(&dlhu_texnames_by_face[19])[25 * v11 + 3])[uVoiceID]) )
-      {
-        pSoundId = rand() % SLOBYTE((&(&dlhu_texnames_by_face[19])[25 * v11 + 3])[uVoiceID])
-            + 2 * (v11 + 50 * uVoiceID)
-            + 4998;
-        v12 = 8 * pPlayerNum + 312;
-        LOBYTE(v12) = v12 | OBJECT_Player;
+
+      if (int _v1 = byte_4ECF08[v11 - 1][uVoiceID])
+      {
+        pSoundId = rand() % _v1 + 2 * (v11 + 50 * uVoiceID) + 4998;
+        v12 = (8 * pPlayerNum + 312) | OBJECT_Player;
         pAudioPlayer->PlaySound((SoundID)pSoundId, v12, 0, -1, 0, 0, (pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0), 0);
       }
     }
   }
+
   v13 = 0;
   v14 = (int)(v6 + 3);
   do
@@ -1374,7 +1373,7 @@
 
   v11 = this;
   v3 = pIcons_LOD->LoadTexture(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE);
-  v4 = (Texture *)(v3 != -1 ? (int)&pIcons_LOD->pTextures[v3] : 0);
+  v4 = (Texture *)(v3 != -1 ? &pIcons_LOD->pTextures[v3] : 0);
   v5 = GetSizeInInventorySlots(v3 != -1 ? pIcons_LOD->pTextures[v3].uTextureWidth : 24);
   uItemIDa = GetSizeInInventorySlots(v4->uTextureHeight);
   if ( !areWeLoadingTexture )
@@ -1463,7 +1462,7 @@
   if ( v12 == -1 )
   {
     if ( uActiveCharacter )
-      pPlayers[uActiveCharacter]->PlaySound(SPEECH_15, 0);
+      pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0);
     result = 0;
   }
   else
@@ -1761,6 +1760,8 @@
   unsigned int uSlota; // [sp+14h] [bp+4h]@1
 
   pIndices = &this->pInventoryIndices[uSlot];
+
+  __debugbreak();  // the following indexing is invalid
   v3 = (ItemGen *)&this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *pIndices + 5];
   v4 = v3->uItemID;
   v3->Reset();
@@ -2315,6 +2316,8 @@
   field_FC = 0;
   field_100 = 0;
   field_104 = 0;
+
+  lastOpenedSpellbookPage = 0;
 }
 
 //----- (0048C6F6) --------------------------------------------------------
@@ -6534,15 +6537,15 @@
 
     switch (i)
     {
-      case PLAYER_SKILL_FIRE:   spellbook.pFireSpellbook.bIsSpellbookAvailable = true;   break;
-      case PLAYER_SKILL_AIR:    spellbook.pAirSpellbook.bIsSpellbookAvailable = true;    break;
-      case PLAYER_SKILL_WATER:  spellbook.pWaterSpellbook.bIsSpellbookAvailable = true;  break;
-      case PLAYER_SKILL_EARTH:  spellbook.pEarthSpellbook.bIsSpellbookAvailable = true;  break;
-      case PLAYER_SKILL_SPIRIT: spellbook.pSpiritSpellbook.bIsSpellbookAvailable = true; break;
-      case PLAYER_SKILL_MIND:   spellbook.pMindSpellbook.bIsSpellbookAvailable = 1; break;
-      case PLAYER_SKILL_BODY:   spellbook.pBodySpellbook.bIsSpellbookAvailable = 1; break;
-      case PLAYER_SKILL_LIGHT:  spellbook.pLightSpellbook.bIsSpellbookAvailable = 1; break;
-      case PLAYER_SKILL_DARK:   spellbook.pDarkSpellbook.bIsSpellbookAvailable = 1; break;
+      case PLAYER_SKILL_FIRE:   spellbook.pFireSpellbook.bIsSpellAvailable[0] = true;   break;
+      case PLAYER_SKILL_AIR:    spellbook.pAirSpellbook.bIsSpellAvailable[0] = true;    break;
+      case PLAYER_SKILL_WATER:  spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true;  break;
+      case PLAYER_SKILL_EARTH:  spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true;  break;
+      case PLAYER_SKILL_SPIRIT: spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; break;
+      case PLAYER_SKILL_MIND:   spellbook.pMindSpellbook.bIsSpellAvailable[0] = true;   break;
+      case PLAYER_SKILL_BODY:   spellbook.pBodySpellbook.bIsSpellAvailable[0] = true;   break;
+      case PLAYER_SKILL_LIGHT:  spellbook.pLightSpellbook.bIsSpellAvailable[0] = true;  break;
+      case PLAYER_SKILL_DARK:   spellbook.pDarkSpellbook.bIsSpellAvailable[0] = true;   break;
     }
   }