changeset 1397:eb02a65e5c82

Quick Spell fixed. Removed CShow, ThreadWard structures.
author Nomad
date Fri, 19 Jul 2013 09:42:03 +0200
parents e6908823897f
children 3161094869e0
files CShow.cpp CShow.h Game.cpp Game.h Mouse.h OSAPI.h UI/Books/UISpellBook.cpp VideoPlayer.cpp mm7_2.cpp mm7_5.cpp
diffstat 10 files changed, 60 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/CShow.cpp	Thu Jul 18 17:29:20 2013 +0200
+++ b/CShow.cpp	Fri Jul 19 09:42:03 2013 +0200
@@ -1,4 +1,4 @@
-#include <assert.h>
+/*#include <assert.h>
 
 #include "CShow.h"
 
@@ -26,3 +26,4 @@
   }
 }
 
+*/
\ No newline at end of file
--- a/CShow.h	Thu Jul 18 17:29:20 2013 +0200
+++ b/CShow.h	Fri Jul 19 09:42:03 2013 +0200
@@ -1,5 +1,5 @@
 #pragma once
-
+#include "VideoPlayer.h"
 
 
 /*  302 */
@@ -15,7 +15,28 @@
   MOVIE_Outro = 0x7,
 };
 
+inline void PlayFullscreenMovie(MovieType movie, bool bShowMouseAfterPlayback = false)
+{
+  extern unsigned int bNoVideo;
+  if (bNoVideo) return;
 
+  switch (movie)
+  {
+    case MOVIE_3DOLogo: VideoPlayer::MovieLoop("3dologo", 0, 0, 1);        break;
+    case MOVIE_NWCLogo: VideoPlayer::MovieLoop("new world logo", 0, 1, 1); break;
+    case MOVIE_JVC:     VideoPlayer::MovieLoop("jvc", 0, 1, 1);            break;
+    case MOVIE_Intro:   VideoPlayer::MovieLoop("Intro", 0, 1, 1);          break;
+    case MOVIE_Emerald: VideoPlayer::MovieLoop("Intro Post", 0, 1, 1);     break;
+    case MOVIE_Death:   VideoPlayer::MovieLoop("losegame", 2, 1, 1);       break;
+    case MOVIE_Outro:   VideoPlayer::MovieLoop("end_seq1", 20, 1, 1);      break;
+
+    default:
+      assert(false && "Invalid movie requested in " __FUNCTION__);
+      break;
+  }
+}
+
+/*
 #pragma pack(push, 1)
 class CShow
 {
@@ -33,4 +54,4 @@
 
   void (__thiscall ***vdestructor_ptr)(CShow *, bool);
 };
-#pragma pack(pop)
\ No newline at end of file
+#pragma pack(pop)*/
\ No newline at end of file
--- a/Game.cpp	Thu Jul 18 17:29:20 2013 +0200
+++ b/Game.cpp	Fri Jul 19 09:42:03 2013 +0200
@@ -941,7 +941,8 @@
   uSomeGammaStartTime = 0;
   uSomeGammaDeltaTime = 0;
 
-  pThreadWardInstance = new ThreadWard;
+  //pThreadWardInstance = new ThreadWard;
+  pThreadWardInstance = nullptr;
   pParticleEngine = new ParticleEngine;
   pMouse = pMouseInstance = new Mouse(pThreadWardInstance);
   pLightmapBuilder = new LightmapBuilder;
@@ -954,7 +955,8 @@
   pStru11Instance = nullptr;
   //pStru12Instance = new stru12(pStru11Instance);
   pStru12Instance = nullptr;
-  pCShow = new CShow;
+  //pCShow = new CShow;
+  pCShow = nullptr;
   pKeyboardInstance = new Keyboard;
   pGammaController = new GammaController;
 
@@ -976,12 +978,12 @@
     delete pGammaController;
   if (pKeyboardInstance)
     delete pKeyboardInstance;
-  if (pCShow)
+  /*if (pCShow)
     delete pCShow;
   if (pStru12Instance)
     delete pStru12Instance;
   if (pStru11Instance)
-    delete pStru11Instance;
+    delete pStru11Instance;*/
   if (pStru10Instance)
     delete pStru10Instance;
   if (pStru9Instance)
@@ -998,8 +1000,8 @@
     delete pMouseInstance;
   if (pParticleEngine)
     delete pParticleEngine;
-  if (pThreadWardInstance)
-    delete pThreadWardInstance;
+  //if (pThreadWardInstance)
+  //  delete pThreadWardInstance;
 }
 
 //----- (0044E904) --------------------------------------------------------
--- a/Game.h	Thu Jul 18 17:29:20 2013 +0200
+++ b/Game.h	Fri Jul 19 09:42:03 2013 +0200
@@ -153,7 +153,7 @@
   float fSaturation;
   unsigned __int64 uSomeGammaStartTime;
   __int64 uSomeGammaDeltaTime;
-  ThreadWard *pThreadWardInstance;
+  void/*ThreadWard*/ *pThreadWardInstance;
   ParticleEngine *pParticleEngine;
   Mouse *pMouseInstance;
   LightmapBuilder *pLightmapBuilder;
@@ -164,7 +164,7 @@
   stru10 *pStru10Instance;
   void/*stru11*/ *pStru11Instance;
   void/*stru12*/ *pStru12Instance;
-  CShow *pCShow;
+  void/*CShow*/ *pCShow;
   Keyboard *pKeyboardInstance;
   GammaController *pGammaController;
   int field_E74;
--- a/Mouse.h	Thu Jul 18 17:29:20 2013 +0200
+++ b/Mouse.h	Fri Jul 19 09:42:03 2013 +0200
@@ -46,7 +46,7 @@
 {
 public:
   //----- (00467E4E) --------------------------------------------------------
-  inline Mouse(ThreadWard *pWard)
+  inline Mouse(void/*ThreadWard*/ *pWard)
   {
     uCursorTextureID = 0;
     uCursorTextureID_2 = 0;
@@ -132,7 +132,7 @@
   int field_104;
   unsigned int uMouseClickX;
   unsigned int uMouseClickY;
-  ThreadWard *pWard;
+  void/*ThreadWard*/ *pWard;
 };
 #pragma pack(pop)
 
--- a/OSAPI.h	Thu Jul 18 17:29:20 2013 +0200
+++ b/OSAPI.h	Fri Jul 19 09:42:03 2013 +0200
@@ -1,4 +1,5 @@
 #define WIN32_LEAN_AND_MEAN
+#include <assert.h>
 #include <windows.h>
 
 #include <MMSystem.h>
--- a/UI/Books/UISpellBook.cpp	Thu Jul 18 17:29:20 2013 +0200
+++ b/UI/Books/UISpellBook.cpp	Fri Jul 19 09:42:03 2013 +0200
@@ -110,7 +110,7 @@
   Texture *v6; // edx@5
   int v7; // eax@8
   int v8; // eax@11
-  POINT *v9; // esi@13
+  //POINT *v9; // esi@13
   int v10; // eax@13
   Texture *v11; // edx@14
   int v12; // eax@15
@@ -126,7 +126,7 @@
   signed int v22; // [sp-4h] [bp-24h]@22
   Texture *v23; // [sp+10h] [bp-10h]@5
   POINT a2; // [sp+18h] [bp-8h]@13
-  POINT v24;
+  //POINT v24;
   int v25;
 
   static unsigned int texture_tab_coord1[9][2]=
@@ -143,11 +143,11 @@
   v3 = pIcons_LOD->GetTexture(pIcons_LOD->FindTextureByName("Pending"));
   pRenderer->ClearZBuffer(0, 479);
   v4 = 1;
-  if ( __OFSUB__(v1, v1 + 11) ^ 1 )
+  //if ( __OFSUB__(v1, v1 + 11) ^ 1 )
   {
     do
     {
-      if ( *(&player->_guilds_member_bits[v1 + 63] + v4) )
+      if (player->_guilds_member_bits[v1 + v4 + 63] )
       {
         v5 = (Texture *)dword_506408[v4];
         if ( v5 != v3 )
@@ -182,8 +182,8 @@
     while ( v4 - 1 < 11 );
   }
 
-  v9 = pMouse->GetCursorPos(&a2);
-  v10 = pRenderer->pActiveZBuffer[v9->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v24)->y]] & 0xFFFF;
+  /*v9 = */pMouse->GetCursorPos(&a2);
+  v10 = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF;
   if ( v10 )
   {
     v11 = dword_5063D8[v10];
@@ -192,8 +192,8 @@
       v21 = dword_5063D8[v10];
 	  v12 = player->lastOpenedSpellbookPage;
     //  v12 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v10]);
-      v20 = pViewport->uViewportTL_Y +  pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Ypos;
-      v18 = pViewport->uViewportTL_X +  pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Xpos;
+      v20 = pViewport->uViewportTL_Y + pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Ypos;
+      v18 = pViewport->uViewportTL_X + pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Xpos;
       if ( BYTE1(v11->pBits) & 2 )
         pRenderer->DrawTextureTransparent(v18, v20, v21);
       else
--- a/VideoPlayer.cpp	Thu Jul 18 17:29:20 2013 +0200
+++ b/VideoPlayer.cpp	Fri Jul 19 09:42:03 2013 +0200
@@ -305,15 +305,19 @@
   if (!bNoVideo)
   {
     pRenderer->PresentBlackScreen();
-    pGame->pCShow->PlayMovie(MOVIE_3DOLogo, 1);
+    PlayFullscreenMovie(MOVIE_3DOLogo, true);
+    //pGame->pCShow->PlayMovie(MOVIE_3DOLogo, 1);
     if ( !pVideoPlayer->bStopBeforeSchedule )
     {
-      pGame->pCShow->PlayMovie(MOVIE_NWCLogo, 1);
+      PlayFullscreenMovie(MOVIE_NWCLogo, true);
+      //pGame->pCShow->PlayMovie(MOVIE_NWCLogo, 1);
       if ( !pVideoPlayer->bStopBeforeSchedule )
       {
-        pGame->pCShow->PlayMovie(MOVIE_JVC, 1);
+        PlayFullscreenMovie(MOVIE_JVC, true);
+        //pGame->pCShow->PlayMovie(MOVIE_JVC, 1);
         if ( !pVideoPlayer->bStopBeforeSchedule )
-          pGame->pCShow->PlayMovie(MOVIE_Intro, 1);
+          PlayFullscreenMovie(MOVIE_Intro, true);
+          //pGame->pCShow->PlayMovie(MOVIE_Intro, 1);
       }
     }
   }
@@ -1170,7 +1174,8 @@
 {
   bStopBeforeSchedule = 0;
   pResetflag = 0;
-  pGame->pCShow->PlayMovie(MOVIE_Death, 1);
+  PlayFullscreenMovie(MOVIE_Death, true);
+  //pGame->pCShow->PlayMovie(MOVIE_Death, 1);
 }
 
 //----- (004BE6F5) --------------------------------------------------------
--- a/mm7_2.cpp	Thu Jul 18 17:29:20 2013 +0200
+++ b/mm7_2.cpp	Fri Jul 19 09:42:03 2013 +0200
@@ -5485,20 +5485,10 @@
     pGame->Deinitialize();
     return 1;
   }
-
-
   Log::Warning(L"MM init: ok");
 
     pEventTimer->Pause();
-    if ( pRenderer->bUserDirect3D && pRenderer->uAcquiredDirect3DDevice == 1 )
-    {
-      SetWindowPos(hWnd, (HWND)((int)HWND_MESSAGE|0x2), 320, 240, 640, 480, 0);
-      Rect.left = 325;
-      Rect.top = 245;
-      Rect.right = 326;
-      Rect.bottom = 246;
-      ClipCursor(&Rect);
-    }
+
     SetUserInterface(PartyAlignment_Neutral, false);
     ShowIntroVideo_and_LoadingScreen();
     WriteWindowsRegistryInt("Ran once", 1);
@@ -5540,7 +5530,8 @@
           }
           DeleteCCharFont();
           bFlashQuestBook = true;
-          pGame->pCShow->PlayMovie(MOVIE_Emerald, 0);
+          PlayFullscreenMovie(MOVIE_Emerald);
+          //pGame->pCShow->PlayMovie(MOVIE_Emerald, 0);
           SaveNewGame();
 
           if (bNoMargareth)
--- a/mm7_5.cpp	Thu Jul 18 17:29:20 2013 +0200
+++ b/mm7_5.cpp	Fri Jul 19 09:42:03 2013 +0200
@@ -2666,7 +2666,7 @@
           }
           v99 = quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage;
           pPlayers[uActiveCharacter]->uQuickSpell = v99;
-          stru_A750F8[uActiveCharacter + 3]._494836(v99, uActiveCharacter);
+          stru_AA1058[uActiveCharacter - 1]._494836(v99, uActiveCharacter);
           if ( uActiveCharacter )
             pPlayer10->PlaySound(SPEECH_12, 0);
           byte_506550 = 0;