diff mm7_5.cpp @ 73:0a7860ded5c2

spellbook close crash fixed
author zipi
date Sun, 27 Jan 2013 17:05:48 +0000
parents f12a7fd4d114
children 377535d6e366
line wrap: on
line diff
--- 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 );
 }