changeset 180:d8aa322a19e5

VideoSound(work)
author Ritor1
date Wed, 19 Dec 2012 18:04:28 +0600
parents dd1e818a6b4c
children 52f2bb358c28 705a6c270835
files AudioPlayer.cpp CShow.h VideoPlayer.cpp mm7_2.cpp mm7_5.cpp
diffstat 5 files changed, 154 insertions(+), 144 deletions(-) [+]
line wrap: on
line diff
--- a/AudioPlayer.cpp	Wed Dec 19 09:36:10 2012 +0600
+++ b/AudioPlayer.cpp	Wed Dec 19 18:04:28 2012 +0600
@@ -612,8 +612,8 @@
 //----- (004AA306) --------------------------------------------------------
 void AudioPlayer::PlaySound(SoundID eSoundID, signed int a3, unsigned int uNumRepeats, signed int PartyX, signed int PartyY, int a7, unsigned int uVolume, int sPlaybackRate)
 {
-  AudioPlayer *pAudioPlayer1; // esi@1
-  signed int v10; // edx@5
+  //AudioPlayer *pAudioPlayer1; // esi@1
+  signed int pNum; // edx@5
   int *pSoundID; // ecx@6
   int v12; // edi@13
   signed int v13; // ecx@17
@@ -640,7 +640,7 @@
   int v34; // eax@70
   char v35; // zf@70
   signed int v36; // ebx@74
-  AudioPlayer *pAudioPlayer2; // edi@79
+  //AudioPlayer *pAudioPlayer2; // edi@79
   AudioPlayer_3DSample *pAudioPlayer_3DSample3; // esi@79
   unsigned int v39; // ebx@80
   int v40; // eax@81
@@ -658,7 +658,7 @@
   int v52; // eax@104
   float v53; // ST0C_4@106
   float v54; // ST04_4@106
-  AudioPlayer *pAudioPlayer3; // edx@106
+  //AudioPlayer *pAudioPlayer3; // edx@106
   SoundDesc *pSoundDesc; // edx@107
   LayingItem *pLayingItem3; // eax@114
   int v58; // edx@115
@@ -666,10 +666,10 @@
   Actor *pActor2; // eax@118
   MixerChannel *pMixerChannel; // esi@126
   signed int v62; // esi@133
-  AudioPlayer *pAudioPlayer4; // ebx@133
+  //AudioPlayer *pAudioPlayer4; // ebx@133
   MixerChannel *pMixerChannel2; // edi@134
   int v65; // ebx@141
-  AudioPlayer *pAudioPlayer5; // ecx@142
+  //AudioPlayer *pAudioPlayer5; // ecx@142
   MixerChannel *pMixerChannel3; // edi@142
   int v68; // eax@143
   MixerChannel *pMixerChannel4; // edi@149
@@ -695,7 +695,7 @@
   unsigned int v89; // [sp+54h] [bp-20h]@12
   int v90; // [sp+58h] [bp-1Ch]@68
   float v91; // [sp+5Ch] [bp-18h]@68
-  unsigned int v92; // [sp+60h] [bp-14h]@10
+  //unsigned int v92; // [sp+60h] [bp-14h]@10
   float v93; // [sp+64h] [bp-10h]@1
   signed int varC; // [sp+68h] [bp-Ch]@68
   AudioPlayer *pAudioPlayer; // [sp+6Ch] [bp-8h]@1
@@ -708,34 +708,39 @@
   int v102; // [sp+90h] [bp+1Ch]@60
   int v103; // [sp+90h] [bp+1Ch]@68
 
-  pAudioPlayer1 = this;
+  pAudioPlayer = this;
   v35 = this->bPlayerReady == 0;
-  pAudioPlayer = this;
+  //pAudioPlayer = this;
   RenderVertexSoft.flt_2C = 0.0;
   LODWORD(v93) = 10000;
   if ( v35 || !uSoundVolumeMultiplier || !this->hDigDriver || !eSoundID )
     return;
-  v10 = 0;
+ /*pNum = 0;
   if ( (signed int)pSoundList->uNumSounds <= 0 )
   {
 LABEL_9:
-    v10 = 0;
+    pNum = 0;
   }
   else
   {
     pSoundID = (int *)&pSoundList->pSounds->uSoundID;
     while ( *pSoundID != eSoundID )
     {
-      ++v10;
+      ++pNum;
       pSoundID += 30;
-      if ( v10 >= (signed int)pSoundList->uNumSounds )
+      if ( pNum >= (signed int)pSoundList->uNumSounds )
         goto LABEL_9;
     }
   }
-  v92 = v10;
-  if ( !v10 )
+  v92 = pNum;//38 */
+  pNum = 0;
+  for ( pSoundID = (int *)&pSoundList->pSounds->uSoundID; *pSoundID != eSoundID; pSoundID += 30)
+  {
+    ++pNum;
+  }
+  if ( !pNum )
     return;
-  if ( !pAudioPlayer1->b3DSoundInitialized || (v89 = 120 * v10, !(pSoundList->pSounds[v10].uFlags & 2)) )
+  if ( !pAudioPlayer->b3DSoundInitialized || (v89 = 120 * pNum, !(pSoundList->pSounds[pNum].uFlags & 2)) )
   {
     //pSoundDesc = (SoundDesc *)7;
     if ( a3 < 0 )
@@ -762,7 +767,7 @@
               if ( AIL_sample_status(pMixerChannel->hSample) == 4 && pMixerChannel->dword_000004 == a3
                 && AIL_sample_status(pMixerChannel->hSample) == 4 )
               {
-                if ( pMixerChannel->uSourceTrackIdx == v92 )
+                if ( pMixerChannel->uSourceTrackIdx == pNum )
                   return;
                 AIL_end_sample(pMixerChannel->hSample);
                 _4ABE55(pMixerChannel);
@@ -776,7 +781,7 @@
       }
 LABEL_133:
       v62 = varC;
-      pAudioPlayer4 = pAudioPlayer;
+      //pAudioPlayer4 = pAudioPlayer;
       if ( varC <= v96 )
       {
         pMixerChannel2 = &pAudioPlayer->pMixerChannels[varC];
@@ -792,26 +797,26 @@
           _4ABE55(pMixerChannel2);
       }
 LABEL_140:
-      if ( v62 != v96 + 1 )
+      if ( v62 != v96 + 1 )//10!=13
       {
 LABEL_150:
         if ( LODWORD(v93) == 10000 )
-          LODWORD(v93) = pAudioPlayer4->uMasterVolume;
+          LODWORD(v93) = pAudioPlayer->uMasterVolume;
         v70 = 0;
         if ( !a7 )
         {
           //pSoundDesc = pSoundList->pSounds;
-          pSoundDesc2 = &pSoundList->pSounds[v92];
+          pSoundDesc2 = &pSoundList->pSounds[pNum];
           if ( !pSoundDesc2->pSoundData[0] )
           {
             if (pSoundDesc2->eType == SOUND_DESC_SWAP)
               pSoundList->LoadSound(eSoundID, 0);
           }
         }
-        v72 = 4 * (a7 + 30 * v92) + 44;
+        v72 = 4 * (a7 + 30 * pNum) + 44;
         if ( !*(int *)&pSoundList->pSounds->pSoundName[v72] )
           return;
-        pMixerChannel5 = &pAudioPlayer4->pMixerChannels[v62];
+        pMixerChannel5 = &pAudioPlayer->pMixerChannels[v62];
         AIL_init_sample(pMixerChannel5->hSample);
         AIL_set_sample_file(pMixerChannel5->hSample, (void *)(*(int *)&pSoundList->pSounds->pSoundName[v72] + 4 * (a7 == 0)), -1);
         pVolume = uVolume;
@@ -881,7 +886,7 @@
             if ( uNumRepeats )
               AIL_set_sample_loop_count(pMixerChannel5->hSample, uNumRepeats - 1);
             v85 = pMixerChannel5->hSample;
-            pMixerChannel5->uSourceTrackIdx = v92;
+            pMixerChannel5->uSourceTrackIdx = pNum;
             pMixerChannel5->dword_000004 = v76;
             pMixerChannel5->uSourceTrackID = eSoundID;
             AIL_start_sample(v85);
@@ -908,7 +913,7 @@
       v91 = v93;
       if ( varC <= v96 )
       {
-        pAudioPlayer5 = pAudioPlayer;
+        //pAudioPlayer5 = pAudioPlayer;
         pMixerChannel3 = &pAudioPlayer->pMixerChannels[varC];
         do
         {
@@ -925,7 +930,7 @@
         if ( v62 != -1 )
         {
 //LABEL_149:
-          pAudioPlayer4 = pAudioPlayer;
+          //pAudioPlayer4 = pAudioPlayer;
           pMixerChannel4 = &pAudioPlayer->pMixerChannels[v62];
           AIL_end_sample(pMixerChannel4->hSample);
           _4ABE55(pMixerChannel4);
@@ -937,7 +942,7 @@
       if ( v65 != 13 )
         return;
       //goto LABEL_149;
-	  pAudioPlayer4 = pAudioPlayer;
+	  //pAudioPlayer4 = pAudioPlayer;
       pMixerChannel4 = &pAudioPlayer->pMixerChannels[v62];
       AIL_end_sample(pMixerChannel4->hSample);
       _4ABE55(pMixerChannel4);
@@ -991,7 +996,7 @@
   v12 = 13;
   if ( a3 < 0 )
   {
-    v15 = pAudioPlayer1->uNum3DSamples;
+    v15 = pAudioPlayer->uNum3DSamples;
     if ( a3 == -1 )
     {
       if ( v15 < 16 )
@@ -1015,7 +1020,7 @@
   }
   if ( (a3 & 7) == 2 )
   {
-    v22 = pAudioPlayer1->uNum3DSamples;
+    v22 = pAudioPlayer->uNum3DSamples;
     if ( v22 < 16 )
     {
       v12 = 5 * v22 / 16;
@@ -1032,7 +1037,7 @@
   {
     if ( (a3 & 7) == 3 )
     {
-      v18 = pAudioPlayer1->uNum3DSamples;
+      v18 = pAudioPlayer->uNum3DSamples;
       v12 = 0;
       if ( v18 < 16 )
         v96 = 3 * v18 / 16;
@@ -1048,7 +1053,7 @@
     }
     if ( (a3 & 7) != 5 )
     {
-      v13 = pAudioPlayer1->uNum3DSamples;
+      v13 = pAudioPlayer->uNum3DSamples;
       if ( (a3 & 7) == 6 )
       {
         if ( v13 >= 16 )
@@ -1088,7 +1093,7 @@
       v21 = (double)pParty->sEyelevel + (double)pParty->vPosition.z;
       goto LABEL_47;
     }
-    v16 = pAudioPlayer1->uNum3DSamples;
+    v16 = pAudioPlayer->uNum3DSamples;
     if ( v16 < 16 )
     {
       v12 = v16 / 4;
@@ -1115,7 +1120,7 @@
     if ( a3 != -1 )
     {
       v101 = 0;
-      if ( pAudioPlayer1->uNum3DSamples > 0 )
+      if ( pAudioPlayer->uNum3DSamples > 0 )
       {
         pAudioPlayer_3DSample = pAudioPlayer->p3DSamples;
         do
@@ -1123,7 +1128,7 @@
           if ( AIL_3D_sample_status(pAudioPlayer_3DSample->hSample) == 4 
 			  && pAudioPlayer_3DSample->field_4 == a3 && AIL_3D_sample_status(pAudioPlayer_3DSample->hSample) == 4 )
           {
-            if ( pAudioPlayer_3DSample->field_8 == v92 )
+            if ( pAudioPlayer_3DSample->field_8 == pNum )
               return;
             AIL_end_3D_sample(pAudioPlayer_3DSample->hSample);
             pAudioPlayer->_4ABF23(pAudioPlayer_3DSample);
@@ -1201,10 +1206,10 @@
       if ( v12 != 13 )
         return;
     }
-    pAudioPlayer2 = pAudioPlayer;
+    //pAudioPlayer2 = pAudioPlayer;
     pAudioPlayer_3DSample3 = &pAudioPlayer->p3DSamples[v36];
     AIL_end_3D_sample(pAudioPlayer_3DSample3->hSample);
-    pAudioPlayer2->_4ABF23(pAudioPlayer_3DSample3);
+    pAudioPlayer->_4ABF23(pAudioPlayer_3DSample3);
     v102 = v36;
   }
   v39 = v89;
@@ -1259,10 +1264,10 @@
             v53 = -uNumRepeatsa;
             v54 = -v99;
             AIL_set_3D_orientation((void *)*(int *)v42, LODWORD(v54), 0.0, LODWORD(v53), 0.0, 1.0, 0.0);
-            pAudioPlayer3 = pAudioPlayer;
+            //pAudioPlayer3 = pAudioPlayer;
             *((int *)v41 + 6) = a3;
-            *((int *)v41 + 7) = v92;
-            *(&pAudioPlayer3->bEAXSupported + 4 * (v102 + 2)) = eSoundID;
+            *((int *)v41 + 7) = pNum;
+            *(&pAudioPlayer->bEAXSupported + 4 * (v102 + 2)) = eSoundID;
           }
           else
           {
--- a/CShow.h	Wed Dec 19 09:36:10 2012 +0600
+++ b/CShow.h	Wed Dec 19 18:04:28 2012 +0600
@@ -33,13 +33,13 @@
   {
   int v3; // edx@5
   const char *Name; // ecx@5
-  std::string v5; // [sp-18h] [bp-24h]@4
-  signed int v6; // [sp-Ch] [bp-18h]@10
+  //std::string v5; // [sp-18h] [bp-24h]@4
+  //signed int v6; // [sp-Ch] [bp-18h]@10
   int ScreenSizeFlag; // [sp-8h] [bp-14h]@4
   int v8; // [sp-4h] [bp-10h]@4
-  char v9; // [sp+0h] [bp-Ch]@14
-  char v10; // [sp+4h] [bp-8h]@4
-  int a3; // [sp+Bh] [bp-1h]@14
+  //char v9; // [sp+0h] [bp-Ch]@14
+  //char v10; // [sp+4h] [bp-8h]@4
+  //int a3; // [sp+Bh] [bp-1h]@14
 
   if (pAsyncMouse)
     pAsyncMouse->Suspend();
@@ -53,45 +53,48 @@
       ScreenSizeFlag = 0;
       v3 = 0;
       Name = "3dologo";
-      goto LABEL_13;
+      VideoPlayer::MovieLoop(Name, v3, ScreenSizeFlag, v8);
+      break;
     case MOVIE_NWCLogo:
       v8 = 1;
       ScreenSizeFlag = 1;
       v3 = 0;
       Name = "new world logo";
-      goto LABEL_13;
+      VideoPlayer::MovieLoop(Name, v3, ScreenSizeFlag, v8);
+      break;
     case MOVIE_JVC:
       v8 = 1;
       ScreenSizeFlag = 1;
       v3 = 0;
       Name = "jvc";
-      goto LABEL_13;
+      VideoPlayer::MovieLoop(Name, v3, ScreenSizeFlag, v8);
+      break;
     case MOVIE_Intro:
       v8 = 1;
       ScreenSizeFlag = 1;
       v3 = 0;
       Name = "Intro";
-      goto LABEL_13;
+      VideoPlayer::MovieLoop(Name, v3, ScreenSizeFlag, v8);
+      break;
     case MOVIE_Emerald:
       v8 = 1;
       ScreenSizeFlag = 1;
       v3 = 0;
       Name = "Intro Post";
-      goto LABEL_13;
+      VideoPlayer::MovieLoop(Name, v3, ScreenSizeFlag, v8);
+      break;
     case MOVIE_Death:
       v8 = 1;
       ScreenSizeFlag = 1;
-      v6 = 2;
+      v3 = 2;
       Name = "losegame";
-      goto LABEL_12;
+      VideoPlayer::MovieLoop(Name, v3, ScreenSizeFlag, v8);
+      break;
     case MOVIE_Outro:
       v8 = 1;
       ScreenSizeFlag = 1;
-      v6 = 20;
+      v3 = 20;
       Name = "end_seq1";
-LABEL_12:
-      v3 = v6;
-LABEL_13:
       VideoPlayer::MovieLoop(Name, v3, ScreenSizeFlag, v8);
       break;
     default:
--- a/VideoPlayer.cpp	Wed Dec 19 09:36:10 2012 +0600
+++ b/VideoPlayer.cpp	Wed Dec 19 18:04:28 2012 +0600
@@ -328,7 +328,7 @@
   {
     pAudioPlayer->SetMusicVolume((signed __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0));
     AIL_redbook_stop(pAudioPlayer->hAILRedbook);
-    AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 0xEu, &uTrackStartMS, &uTrackEndMS);
+    AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 0xE, &uTrackStartMS, &uTrackEndMS);
     AIL_redbook_play(pAudioPlayer->hAILRedbook, uTrackStartMS + 1, uTrackEndMS);
   }
   bGameoverLoop = 0;
@@ -338,20 +338,20 @@
 
 
 //----- (004BE70E) --------------------------------------------------------
-void __fastcall VideoPlayer::MovieLoop(const char *pMovieName, int a2, int a3, int a4)
+void __fastcall VideoPlayer::MovieLoop(const char *pMovieName, int a2, int ScreenSizeFlag, int a4)
 {
   int v4; // ebp@1
-  const char *v5; // edi@1
+  const char *pName; // edi@1
   MSG Msg; // [sp+Ch] [bp-1Ch]@12
 
   v4 = a2;
-  v5 = pMovieName;
+  pName = pMovieName;
   if ( !(dword_6BE364_game_settings_1 & 0x44) )
   {
     if ( a2 == 2 )
       v4 = 0;
     ShowCursor(0);
-    pVideoPlayer->OpenMovie(v5, 0, a3);
+    pVideoPlayer->OpenMovie(pName, 0, ScreenSizeFlag);
     pVideoPlayer->bPlayingMovie = 1;
     pVideoPlayer->field_44 = v4;
     if ( pRenderer->pRenderD3D )
@@ -369,12 +369,12 @@
     {
       if ( pVideoPlayer->pBinkMovie )
       {
-        pVideoPlayer->BinkDrawFrame(pVideoPlayer->hWindow, v4, a3);
+        pVideoPlayer->BinkDrawFrame(pVideoPlayer->hWindow, v4, ScreenSizeFlag);
         while ( pVideoPlayer->pBinkMovie )
         {
           if ( pVideoPlayer->bStopBeforeSchedule )
             break;
-          while ( PeekMessageA(&Msg, 0, 0, 0, 1u) )
+          while ( PeekMessageA(&Msg, 0, 0, 0, 1) )
           {
             if ( Msg.message == 18 )
               Game_DeinitializeAndTerminate(0);
@@ -387,7 +387,7 @@
           if ( !pVideoPlayer->pBinkMovie )
             break;
           if ( !BinkWait(pVideoPlayer->pBinkMovie) && !pVideoPlayer->bStopBeforeSchedule )
-            pVideoPlayer->BinkDrawFrame(pVideoPlayer->hWindow, v4, a3);
+            pVideoPlayer->BinkDrawFrame(pVideoPlayer->hWindow, v4, ScreenSizeFlag);
         }
       }
       if ( pVideoPlayer->bStopBeforeSchedule == 1 )
@@ -399,12 +399,12 @@
       {
         if ( pVideoPlayer->pSmackerMovie )
         {
-          pVideoPlayer->SmackDrawFrame(pVideoPlayer->hWindow, v4, a3);
+          pVideoPlayer->SmackDrawFrame(pVideoPlayer->hWindow, v4, ScreenSizeFlag);
           while ( pVideoPlayer->pSmackerMovie )
           {
             if ( pVideoPlayer->bStopBeforeSchedule )
               break;
-            while ( PeekMessageW(&Msg, 0, 0, 0, 1u) )
+            while ( PeekMessageW(&Msg, 0, 0, 0, 1) )
             {
               if (Msg.message == WM_QUIT)
                 Game_DeinitializeAndTerminate(0);
@@ -417,7 +417,7 @@
             if ( !pVideoPlayer->pSmackerMovie )
               break;
             if ( !SmackWait(pVideoPlayer->pSmackerMovie) && !pVideoPlayer->bStopBeforeSchedule )
-              pVideoPlayer->SmackDrawFrame(pVideoPlayer->hWindow, v4, a3);
+              pVideoPlayer->SmackDrawFrame(pVideoPlayer->hWindow, v4, ScreenSizeFlag);
           }
         }
       }
@@ -562,49 +562,49 @@
 //----- (004BEBD7) --------------------------------------------------------
 void VideoPlayer::Unload()
 {
-  VideoPlayer *v1; // esi@1
-  _BINK *v2; // eax@1
-  _BINKBUF *v3; // eax@3
-  _SMACK *v4; // eax@5
+  VideoPlayer *pVideoPlayer; // esi@1
+  _BINK *pBinkMovie; // eax@1
+  _BINKBUF *pBinkBuffer; // eax@3
+  _SMACK *pSmackerMovie; // eax@5
 
-  v1 = this;
-  v2 = this->pBinkMovie;
-  if ( v2 )
+  pVideoPlayer = this;
+  pBinkMovie = this->pBinkMovie;
+  if ( pBinkMovie )
   {
-    BinkPause(v2, 1);
-    Sleep(300u);
-    BinkClose(v1->pBinkMovie);
-    v1->pBinkMovie = 0;
+    BinkPause(pBinkMovie, 1);
+    Sleep(300);
+    BinkClose(pVideoPlayer->pBinkMovie);
+    pVideoPlayer->pBinkMovie = 0;
   }
-  v3 = v1->pBinkBuffer;
-  if ( v3 )
+  pBinkBuffer = pVideoPlayer->pBinkBuffer;
+  if ( pBinkBuffer )
   {
-    v3->pTargetDDrawSurface->Release();
-    v1->pBinkBuffer->pTargetDDrawSurface = 0;
-    free(v1->pBinkBuffer);
-    v1->pBinkBuffer = 0;
+    pBinkBuffer->pTargetDDrawSurface->Release();
+    pVideoPlayer->pBinkBuffer->pTargetDDrawSurface = 0;
+    free(pVideoPlayer->pBinkBuffer);
+    pVideoPlayer->pBinkBuffer = 0;
   }
-  v4 = v1->pSmackerMovie;
-  if ( v4 )
+  pSmackerMovie = pVideoPlayer->pSmackerMovie;
+  if ( pSmackerMovie )
   {
-    SmackSoundOnOff(v4, 0);
-    SmackClose(v1->pSmackerMovie);
-    v1->pSmackerMovie = 0;
+    SmackSoundOnOff(pSmackerMovie, 0);
+    SmackClose(pVideoPlayer->pSmackerMovie);
+    pVideoPlayer->pSmackerMovie = 0;
   }
-  if ( v1->pSmackerBuffer )
+  if ( pVideoPlayer->pSmackerBuffer )
   {
-    SmackBufferClose(v1->pSmackerBuffer);
-    v1->pSmackerBuffer = 0;
+    SmackBufferClose(pVideoPlayer->pSmackerBuffer);
+    pVideoPlayer->pSmackerBuffer = 0;
   }
-  if ( v1->pSmackMovieBlit )
+  if ( pVideoPlayer->pSmackMovieBlit )
   {
-    SmackBlitClose(v1->pSmackMovieBlit);
-    v1->pSmackMovieBlit = 0;
+    SmackBlitClose(pVideoPlayer->pSmackMovieBlit);
+    pVideoPlayer->pSmackMovieBlit = 0;
   }
-  v1->field_54 = 0;
-  v1->uMovieFormat = 0;
-  v1->dword_0000A0 = 0;
-  memset(v1->pCurrentMovieName, 0, 0x40u);
+  pVideoPlayer->field_54 = 0;
+  pVideoPlayer->uMovieFormat = 0;
+  pVideoPlayer->dword_0000A0 = 0;
+  memset(pVideoPlayer->pCurrentMovieName, 0, 0x40);
   if ( pAudioPlayer->hAILRedbook && !bGameoverLoop )
     AIL_redbook_resume(pAudioPlayer->hAILRedbook);
   pEventTimer->Resume();
@@ -941,7 +941,7 @@
 //----- (004BF1E6) --------------------------------------------------------
 _SMACK *VideoPlayer::OpenSmack(const char *pFilename)
 {
-  VideoPlayer *v2; // esi@1
+  VideoPlayer *pVideoPlayer; // esi@1
   signed int v3; // edi@1
   int v4; // ebx@2
   signed int v5; // edi@5
@@ -950,40 +950,37 @@
   unsigned int v9; // [sp-8h] [bp-18h]@10
   signed int v10; // [sp-4h] [bp-14h]@10
 
-  v2 = this;
+  pVideoPlayer = this;
   v3 = 0;
   if ( (signed int)this->uNumMightVideoHeaders > 0 )
   {
     v4 = 0;
-    while ( _strcmpi(v2->pMightVideoHeaders[v4].pVideoName, pFilename) )
+    while ( _strcmpi(pVideoPlayer->pMightVideoHeaders[v4].pVideoName, pFilename) )
     {
       ++v3;
       ++v4;
-      if ( v3 >= (signed int)v2->uNumMightVideoHeaders )
+      if ( v3 >= (signed int)pVideoPlayer->uNumMightVideoHeaders )
         goto LABEL_5;
     }
-    SetFilePointer(v2->hMightVid, v2->pMightVideoHeaders[v3].uFileOffset, 0, 0);
-    v10 = -1;
-    v9 = 0x7140u;
-    v8 = v2->hMightVid;
-    return SmackOpen(v8, v9, v10);
+    SetFilePointer(pVideoPlayer->hMightVid, pVideoPlayer->pMightVideoHeaders[v3].uFileOffset, 0, 0);
+    return SmackOpen(pVideoPlayer->hMightVid, 0x7140, -1);
   }
 LABEL_5:
   v5 = 0;
-  if ( (signed int)v2->uNumMagicVideoHeaders > 0 )
+  if ( (signed int)pVideoPlayer->uNumMagicVideoHeaders > 0 )
   {
     v6 = 0;
-    while ( _strcmpi(v2->pMagicVideoHeaders[v6].pVideoName, pFilename) )
+    while ( _strcmpi(pVideoPlayer->pMagicVideoHeaders[v6].pVideoName, pFilename) )
     {
       ++v5;
       ++v6;
-      if ( v5 >= (signed int)v2->uNumMagicVideoHeaders )
+      if ( v5 >= (signed int)pVideoPlayer->uNumMagicVideoHeaders )
         return 0;
     }
-    SetFilePointer(v2->hMagicVid, v2->pMagicVideoHeaders[v5].uFileOffset, 0, 0);
+    SetFilePointer(pVideoPlayer->hMagicVid, pVideoPlayer->pMagicVideoHeaders[v5].uFileOffset, 0, 0);
     v10 = -1;
     v9 = 0x7140u;
-    v8 = v2->hMagicVid;
+    v8 = pVideoPlayer->hMagicVid;
     return SmackOpen(v8, v9, v10);
   }
   return 0;
@@ -1068,8 +1065,8 @@
 //----- (004BF411) --------------------------------------------------------
 void VideoPlayer::OpenMovie(const char *pFilename, unsigned int bLoop, int a4)
 {
-  VideoPlayer *v4; // esi@1
-  _BINK *v5; // eax@2
+  VideoPlayer *pVideoPlayer; // esi@1
+  _BINK *pVideoOpen; // eax@2
   _SMACK *v6; // eax@3
   _BINK *pBinkMovie; // eax@5
   _SMACK *v8; // eax@7
@@ -1079,52 +1076,54 @@
   const char *v12; // [sp-4h] [bp-38h]@8
   char pVideoName[120]; // [sp+Ch] [bp-28h]@2
 
-  v4 = this;
+  pVideoPlayer = this;
   if ( !this->field_54 )
   {
     Prepare();
-    v4->bLoopPlaying = bLoop;
+    pVideoPlayer->bLoopPlaying = bLoop;
     sprintf(pVideoName, "%s.bik", pFilename);
-    v5 = OpenBink(pVideoName);
-    v4->pBinkMovie = v5;
-    if ( v5 )
+    pVideoOpen = OpenBink(pVideoName);
+    pVideoPlayer->pBinkMovie = pVideoOpen;
+    if ( pVideoOpen )
     {
-      v4->uMovieFormat = 2;
-      strcpy(v4->pCurrentMovieName, pFilename);
-      pBinkMovie = v4->pBinkMovie;
-      v4->dword_0000A0 = 1;
+      pVideoPlayer->uMovieFormat = 2;
+      strcpy(pVideoPlayer->pCurrentMovieName, pFilename);
+      pBinkMovie = pVideoPlayer->pBinkMovie;
+      pVideoPlayer->dword_0000A0 = 1;
       if ( pBinkMovie )
-        v4->pBinkBuffer = CreateBinkBuffer(v4->hWindow, pBinkMovie->uWidth, pBinkMovie->uHeight, 0);
+        pVideoPlayer->pBinkBuffer = CreateBinkBuffer(pVideoPlayer->hWindow, pBinkMovie->uWidth, pBinkMovie->uHeight, 0);
     }
     else
     {
       Unload();
       sprintf(pVideoName, "%s.smk", pFilename);
       v6 = OpenSmack(pVideoName);
-      v4->pSmackerMovie = v6;
+      pVideoPlayer->pSmackerMovie = v6;
       if ( !v6 )
       {
         Unload();
         sprintf(pVideoName, "Can't load file - anims\\%s.smk", pFilename);
-LABEL_17:
+//LABEL_17:
         MessageBoxA(0, pVideoName, "Smacker Error", 0);
         return;
       }
-      v4->uMovieFormat = 1;
-      strcpy(v4->pCurrentMovieName, pFilename);
-      v8 = v4->pSmackerMovie;
-      v4->dword_0000A0 = 2;
+      pVideoPlayer->uMovieFormat = 1;
+      strcpy(pVideoPlayer->pCurrentMovieName, pFilename);
+      v8 = pVideoPlayer->pSmackerMovie;
+      pVideoPlayer->dword_0000A0 = 2;
       v9 = (char *)malloc(v8->Width * v8->Height);
-      v4->pSomeSmackerBuffer = v9;
+      pVideoPlayer->pSomeSmackerBuffer = v9;
       if ( !v9 )
       {
         Unload();
         v12 = "Can't allocate memory for buffer";
-LABEL_16:
+//LABEL_16:
         sprintf(pVideoName, v12);
-        goto LABEL_17;
+        //goto LABEL_17;
+		MessageBoxA(0, pVideoName, "Smacker Error", 0);
+        return;
       }
-      SmackToBuffer(v4->pSmackerMovie, 0, 0, v4->pSmackerMovie->Width, v4->pSmackerMovie->Height, v9, 0);
+      SmackToBuffer(pVideoPlayer->pSmackerMovie, 0, 0, pVideoPlayer->pSmackerMovie->Width, pVideoPlayer->pSmackerMovie->Height, v9, 0);
       if ( a4 )
       {
         if ( (unsigned int)uCPUSpeed < 165 )
@@ -1142,12 +1141,15 @@
         v10 = SmackCheckSurfaceFromat();
       }
       v11 = SmackBlitOpen(v10);
-      v4->pSmackMovieBlit = v11;
+      pVideoPlayer->pSmackMovieBlit = v11;
       if ( !v11 )
       {
         Unload();
         v12 = "Failed to open Blit API";
-        goto LABEL_16;
+        //goto LABEL_16;
+		sprintf(pVideoName, v12);
+        MessageBoxA(0, pVideoName, "Smacker Error", 0);
+        return;
       }
     }
   }
--- a/mm7_2.cpp	Wed Dec 19 09:36:10 2012 +0600
+++ b/mm7_2.cpp	Wed Dec 19 18:04:28 2012 +0600
@@ -14108,12 +14108,14 @@
         if ( uGameState == 3 )
         {
           v12 = 5;
-          goto LABEL_57;
+          //goto LABEL_57;
+		  SetCurrentMenuID((MENU_STATE)v12);
+          goto LABEL_21;
         }
         if ( uGameState == 4 )
         {
           v12 = 1;
-LABEL_57:
+//LABEL_57:
           SetCurrentMenuID((MENU_STATE)v12);
           goto LABEL_21;
         }
@@ -14133,12 +14135,10 @@
 LABEL_53:
       if (!bNoSound && pAudioPlayer->hAILRedbook)
       {
-        pAudioPlayer->SetMusicVolume(
-          (signed __int64)(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0));
+        pAudioPlayer->SetMusicVolume((signed __int64)(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0));
         AIL_redbook_stop(pAudioPlayer->hAILRedbook);
-
         unsigned int end_ms;
-        AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 0xEu, &startms, &end_ms);
+        AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 0xE, &startms, &end_ms);
         AIL_redbook_play(pAudioPlayer->hAILRedbook, startms + 1, end_ms);
       }
     }
--- a/mm7_5.cpp	Wed Dec 19 09:36:10 2012 +0600
+++ b/mm7_5.cpp	Wed Dec 19 18:04:28 2012 +0600
@@ -14895,12 +14895,12 @@
           if ( pWindow->Hint != (char *)1 )
             pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0);
           v22 = (GUIButton *)pWindow->ptr_1C;
-          if ( (v22->uX & 0x80000000u) == 0 )
+          if ( (v22->uX /*& 0x80000000u*/) == 0 )
           {
             if ( (signed int)v22->uX <= 640 )
             {
               v25 = v22->uY;
-              if ( (v25 & 0x80000000u) == 0 )
+              if ( (v25 /*& 0x80000000u*/) == 0 )
               {
                 if ( (signed int)v25 <= 480 )
                 {