changeset 2111:cdda00bb7a3e

Merge
author Ritor1
date Sat, 21 Dec 2013 01:03:54 +0600
parents 18b0ff5e1bf1 (diff) 4fae5a167a05 (current diff)
children 9d79b07dc237
files
diffstat 2 files changed, 26 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/AudioPlayer.cpp	Fri Dec 20 01:46:23 2013 +0100
+++ b/AudioPlayer.cpp	Sat Dec 21 01:03:54 2013 +0600
@@ -83,11 +83,14 @@
     {
       sprintf(pSoundName, "%s", pSounds[i].pSoundName);
       pSoundDesc = &pSoundList->pSounds[i];
-      if ( pSoundList->pSounds[i].eType != SOUND_DESC_SYSTEM || (sprintf(pSoundName, "%s", pSounds[i].pSoundName),
-            pSoundList->pSounds[i].pSoundData[0] = ::LoadSound(pSoundName, (SoundData *)-1, pSounds[i].uSoundID),
-            !pAudioPlayer->b3DSoundInitialized)
-        || (pSoundDesc = &pSoundList->pSounds[i], !(pSoundDesc->uFlags & SOUND_DESC_SWAP))
-        || !pSoundDesc->pSoundData[0] )
+      if ( pSoundList->pSounds[i].eType != SOUND_DESC_SYSTEM )
+        continue;
+      sprintf(pSoundName, "%s", pSounds[i].pSoundName);
+      pSoundList->pSounds[i].pSoundData[0] = ::LoadSound(pSoundName, (SoundData *)-1, pSounds[i].uSoundID);
+      if ( !pAudioPlayer->b3DSoundInitialized )
+        continue;
+      pSoundDesc = &pSoundList->pSounds[i];
+      if ( !(pSoundDesc->uFlags & SOUND_DESC_SWAP) || !pSoundDesc->pSoundData[0] )
         continue;
       pSoundData = pSoundDesc->pSoundData[0];
       uSoundSize = *(int *)pSoundData;
@@ -674,7 +677,11 @@
         if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done )
         {
           AIL_init_sample(pMixerChannels[j].hSample);
-          AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1);
+          char *p = (char *)pSoundList->pSounds[sound_id].pSoundData[a7];
+          if (a7 == 0)  p = p + 4;//for RIFF
+		  if ( eSoundID == 75 )// Ritor1: include +7 for pSounds[20]
+			  p = p + 7;
+          AIL_set_sample_file(pMixerChannels[j].hSample, p, -1);
           if ( sample_volume == 10000 )
             sample_volume = uMasterVolume;
           if (uVolume)
@@ -733,7 +740,11 @@
         if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done )
         {
           AIL_init_sample(pMixerChannels[j].hSample);
-          AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1);
+          char *p = (char *)pSoundList->pSounds[sound_id].pSoundData[a7];
+          if (a7 == 0)  p = p + 4;//for RIFF
+		  if ( eSoundID == 75 )//  Ritor1: include +7 for pSounds[20]
+			  p = p + 7;
+          AIL_set_sample_file(pMixerChannels[j].hSample, p, -1);
           if ( sample_volume == 10000 )
             sample_volume = uMasterVolume;
           if (uVolume)
@@ -1963,8 +1974,6 @@
       //v59 = 0;
   for (uint i = 0; i < _6807E0_num_decorations_with_sounds_6807B8; ++i)
   {
-      //while ( 1 )
-      //{
         LODWORD(v56) = 1;
         //v43 = _6807B8_level_decorations_ids[v59];
         //v44 = &pLevelDecorations[_6807B8_level_decorations_ids[v59]];
@@ -2147,7 +2156,7 @@
     return;
   }
 
-  ReadFile(hAudioSnd, &uNumSoundHeaders, 4u, &NumberOfBytesRead, 0);
+  ReadFile(hAudioSnd, &uNumSoundHeaders, 4, &NumberOfBytesRead, 0);
   pSoundHeaders = nullptr;
   pSoundHeaders = (SoundHeader *)malloc(52 * uNumSoundHeaders + 2);
   ReadFile(hAudioSnd, pSoundHeaders, 52 * uNumSoundHeaders, &NumberOfBytesRead, 0);
@@ -2755,7 +2764,7 @@
     pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uCompressedSize = pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uDecompressedSize;
     if ( pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uDecompressedSize )
     {
-      ReadFile(pAudioPlayer->hAudioSnd, (char *)pOutBuff + 4, pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uDecompressedSize, &NumberOfBytesRead, 0);
+      ReadFile(pAudioPlayer->hAudioSnd, pOutBuff->pData, pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uDecompressedSize + 7, &NumberOfBytesRead, 0);// Ritor1: include +7 for pSounds[20]
     }
     else
     {
@@ -2766,12 +2775,12 @@
   {
     uID = (unsigned int)malloc(pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uCompressedSize);
     ReadFile(pAudioPlayer->hAudioSnd, (LPVOID)uID, pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uCompressedSize, &NumberOfBytesRead, 0);
-    zlib::MemUnzip((char *)pOutBuff + 4, &pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uDecompressedSize, (const void *)uID, pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uCompressedSize);
+    zlib::MemUnzip(pOutBuff->pData, &pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uDecompressedSize, (const void *)uID, pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uCompressedSize);
     free((void *)uID);
   }
   if ( pOutBuff )
   {
-    *(int *)pOutBuff = pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uDecompressedSize;
+    pOutBuff->uDataSize = pAudioPlayer->pSoundHeaders[uFindSound_BinSearch_ResultID].uDecompressedSize;
     uLastLoadedSoundID = 0;
     if ( pSounds[0].pSoundData )
     {
--- a/Game.cpp	Fri Dec 20 01:46:23 2013 +0100
+++ b/Game.cpp	Sat Dec 21 01:03:54 2013 +0600
@@ -4515,12 +4515,14 @@
         case UIMSG_PlayerCreationRemoveUpSkill:
           v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem;
           pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v4 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam;
-          pParty->pPlayers[pParam].pActiveSkills[pPlayer[pParam].GetSkillIdxByOrder(2)] = 0;
+          if ( pPlayer[pParam].GetSkillIdxByOrder(2) != 37 )//37 - None(Νες)
+            pParty->pPlayers[pParam].pActiveSkills[pPlayer[pParam].GetSkillIdxByOrder(2)] = 0;
           break;
         case UIMSG_PlayerCreationRemoveDownSkill:
           v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem;
           pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v4 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam;
-          pParty->pPlayers[pParam].pActiveSkills[pPlayer[pParam].GetSkillIdxByOrder(3)] = 0;
+          if ( pPlayer[pParam].GetSkillIdxByOrder(3) != 37 )//37 - None(Νες)
+            pParty->pPlayers[pParam].pActiveSkills[pPlayer[pParam].GetSkillIdxByOrder(3)] = 0;
           break;
         case UIMSG_PlayerCreationChangeName:
           pAudioPlayer->PlaySound((SoundID)24, 0, 0, -1, 0, 0, 0, 0);