changeset 73:0a7860ded5c2

spellbook close crash fixed
author zipi
date Sun, 27 Jan 2013 17:05:48 +0000
parents 55e3aa43021d
children 2c0260e09693
files Texture.cpp Texture.h mm7_5.cpp mm7_data.cpp mm7_data.h
diffstat 5 files changed, 27 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/Texture.cpp	Sun Jan 27 15:49:25 2013 +0000
+++ b/Texture.cpp	Sun Jan 27 17:05:48 2013 +0000
@@ -48,14 +48,13 @@
 Texture *pTexture_TownPortalIsland;
 Texture *pTexture_TownPortalHeaven;
 Texture *pTexture_TownPortalHell;
-Texture *dword_5063D8[777];
-Texture *dword_506404[777];
-Texture *dword_506434[777];
+Texture *dword_5063D8[12];
+Texture *dword_506408[12];
 Texture *pTexture_50643C; // idb
 Texture *ptr_506440;
 Texture *pTexture_506444;
 Texture *pTexture_506448; // idb
-Texture *pTextures_tabs[8][2];
+Texture *pTextures_tabs[9][2];
 Texture *pTexture_mapbordr; // idb
 Texture *pTexture_pagemask; // idb
 Texture *pTextures_5064A0[14];
--- a/Texture.h	Sun Jan 27 15:49:25 2013 +0000
+++ b/Texture.h	Sun Jan 27 17:05:48 2013 +0000
@@ -151,13 +151,12 @@
 extern Texture *pTexture_TownPortalHeaven;
 extern Texture *pTexture_TownPortalHell;
 extern Texture *dword_5063D8[];
-extern Texture *dword_506404[];
-extern Texture *dword_506434[];
+extern Texture *dword_506408[];
 extern Texture *pTexture_50643C; // idb
 extern Texture *ptr_506440;
 extern Texture *pTexture_506444;
 extern Texture *pTexture_506448; // idb
-extern Texture *pTextures_tabs[8][2];
+extern Texture *pTextures_tabs[9][2];
 extern Texture *pTexture_mapbordr; // idb
 extern Texture *pTexture_pagemask; // idb
 extern Texture *pTextures_5064A0[14];
--- a/mm7_5.cpp	Sun Jan 27 15:49:25 2013 +0000
+++ b/mm7_5.cpp	Sun Jan 27 17:05:48 2013 +0000
@@ -13169,7 +13169,7 @@
       v6 = &byte_4E2430[12 * v1] + v4;
       sprintf(pContainer, "SB%sS%02d", spellbook_texture_filename_suffices[v1], (unsigned __int8)*v6);
       v7 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      dword_506408[v12] = 72 * v7 + 7145548;
+      dword_506408[v12] = &pIcons_LOD->pTextures[v7];
       sprintf(pContainer, "SB%sC%02d", spellbook_texture_filename_suffices[v1], (unsigned __int8)*v6);
       result = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE)];
       dword_5063D8[v12] = result;
@@ -13197,8 +13197,8 @@
   v0 = 0;
   do
   {
-    dword_506404[v0]->Release();
-    dword_506434[v0]->Release();
+	dword_5063D8[11+v0]->Release();
+	dword_506408[11+v0]->Release();
     --v0;
   }
   while ( v0 >= -11 );
@@ -13237,15 +13237,15 @@
   do
   {
     (*v1)->Release();
-    v2 = (Texture *)*((int *)v0 - 1);
+    v2 = *(v0 - 1);
     *v1 = 0;
     v2->Release();
-    v3 = *(Texture **)v0;
-    *((int *)v0 - 1) = 0;
+    v3 = *v0;
+    *(v0 - 1) = 0;
     v3->Release();
-    *(int *)v0 = 0;
+    *v0 = 0;
     ++v1;
-    v0 += 8;
+    v0 += 2;
   }
   while ( (signed int)v1 < (signed int)&pTextures_5064A0[9] );
   pAudioPlayer->PlaySound((SoundID)231, 0, 0, -1, 0, 0, 0, 0);
@@ -13316,8 +13316,10 @@
   unsigned int v20; // [sp-8h] [bp-28h]@15
   Texture *v21; // [sp-4h] [bp-24h]@15
   signed int v22; // [sp-4h] [bp-24h]@22
-  int v23[2]; // [sp+10h] [bp-10h]@5
+  Texture *v23; // [sp+10h] [bp-10h]@5
   POINT a2; // [sp+18h] [bp-8h]@13
+  POINT v24;
+  int v25;
 
   sub_412AF9();
   v0 = pPlayers[uActiveCharacter];
@@ -13338,11 +13340,11 @@
           if ( dword_50654C == v4 )
           {
             v6 = dword_5063D8[v4];
-            v23[0] = (int)dword_5063D8[v4];
+            v23 = dword_5063D8[v4];
           }
           else
           {
-            v23[0] = dword_506408[v4];
+            v23 = dword_506408[v4];
             v6 = v5;
           }
           if ( v6->pLevelOfDetail0 )
@@ -13355,7 +13357,7 @@
             else
               pRenderer->DrawTextureIndexed(v17, v19, v6);
             v8 = 2 * (12 * v0->pNumSpellBookPage + (unsigned __int8)*(&byte_4E2430[12 * v0->pNumSpellBookPage] + v4));
-            pRenderer->_4A612A(dword_4E20D0[v8], dword_4E20D0[v8 + 1], (Texture *)v23[0], v4);
+            pRenderer->_4A612A(dword_4E20D0[v8], dword_4E20D0[v8 + 1], v23, v4);
           }
         }
       }
@@ -13364,7 +13366,7 @@
     while ( v4 + v1 - 1 < v1 + 11 );
   }
   v9 = pMouse->GetCursorPos(&a2);
-  v10 = pRenderer->pActiveZBuffer[v9->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)v23)->y]] & 0xFFFF;
+  v10 = pRenderer->pActiveZBuffer[v9->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v24)->y]] & 0xFFFF;
   if ( v10 )
   {
     v11 = dword_5063D8[v10];
@@ -13384,7 +13386,7 @@
   a2.x = (LONG)&v0->pActiveSkills[12];
   v14 = (unsigned int)&v0->pActiveSkills[12];
   v15 = (unsigned int)&v0->pActiveSkills[12];
-  v23[0] = 0;
+  v25 = 0;
   do
   {
     if ( *(short *)a2.x )
@@ -13478,11 +13480,11 @@
         }
       }
       pRenderer->DrawTextureTransparent(v14, v15, v16);
-      v13 = v23[0];
+      v13 = v25;
     }
     a2.x += 2;
     ++v13;
-    v23[0] = v13;
+    v25 = v13;
   }
   while ( v13 < 9 );
 }
--- a/mm7_data.cpp	Sun Jan 27 15:49:25 2013 +0000
+++ b/mm7_data.cpp	Sun Jan 27 17:05:48 2013 +0000
@@ -1278,8 +1278,8 @@
 __int64 qword_506350; // weak
 char byte_506360; // weak
 int dword_506364; // weak
-int dword_506408[777]; // weak
-int dword_50640C[777]; // weak
+Texture *dword_506404[12]; // weak
+Texture *dword_50640C[12]; // weak
 unsigned int uTextureID_506438;
 int dword_50651C; // weak
 int dword_506520; // weak
--- a/mm7_data.h	Sun Jan 27 15:49:25 2013 +0000
+++ b/mm7_data.h	Sun Jan 27 17:05:48 2013 +0000
@@ -1154,8 +1154,8 @@
 extern __int64 qword_506350; // weak
 extern char byte_506360; // weak
 extern int dword_506364; // weak
-extern int dword_506408[]; // weak
-extern int dword_50640C[]; // weak
+extern Texture *dword_506408[]; // weak
+extern Texture *dword_50640C[]; // weak
 extern unsigned int uTextureID_506438;
 extern int dword_50651C; // weak
 extern int dword_506520; // weak