changeset 43:484492a6dd28

Прорисовка окна создания персонажа готова, но не решена проблема кликабельности доступных навыков
author Ritor1
date Sun, 21 Oct 2012 23:26:23 +0600
parents 7071e4688db6
children 916bec351934 bcc051713d20 c83d06692295
files Render.cpp Texture.cpp Texture.h mm7_4.cpp
diffstat 4 files changed, 62 insertions(+), 77 deletions(-) [+]
line wrap: on
line diff
--- a/Render.cpp	Fri Oct 19 23:29:04 2012 +0600
+++ b/Render.cpp	Sun Oct 21 23:26:23 2012 +0600
@@ -10440,8 +10440,8 @@
 //----- (004A6274) --------------------------------------------------------
 void Render::DrawTextureTransparent(unsigned int uX, unsigned int uY, Texture *pTexture)
 {
-  Texture *v4; // edi@2
-  unsigned int v5; // ebx@4
+  Texture *pCurrentTexture; // edi@2
+  int uHeight; // ebx@4
   unsigned __int16 *v6; // eax@4
   unsigned int v7; // edx@5
   unsigned int v8; // edx@6
@@ -10453,25 +10453,25 @@
   unsigned int v14; // edx@17
   unsigned int v15; // esi@18
   unsigned __int8 *v16; // ebx@22
-  char v17; // zf@28
+  char uFlag; // zf@28
   int v18; // [sp+10h] [bp-10h]@4
   unsigned __int8 *v19; // [sp+18h] [bp-8h]@4
-  int v20; // [sp+1Ch] [bp-4h]@4
+  int uWidth; // [sp+1Ch] [bp-4h]@4
   int uXa; // [sp+28h] [bp+8h]@24
   unsigned int uYa; // [sp+2Ch] [bp+Ch]@22
   unsigned int pTexturea; // [sp+30h] [bp+10h]@11
 
   if ( this->uNumSceneBegins )
   {
-    v4 = pTexture;
+    pCurrentTexture = pTexture;
     if ( pTexture )
     {
       if ( pTexture->pPalette16 )
       {
-        v5 = pTexture->uTextureHeight;
+        uHeight = pTexture->uTextureHeight;
         v6 = &this->pTargetSurface[uX + uY * this->uTargetSurfacePitch];
         v19 = pTexture->pLevelOfDetail0;
-        v20 = pTexture->uTextureWidth;
+        uWidth = pTexture->uTextureWidth;
         v18 = pTexture->uTextureWidth;
         if ( this->bClip )
         {
@@ -10480,66 +10480,65 @@
           {
             v8 = v7 - uX;
             v19 += v8;
-            v20 += uX - this->uClipX;
+            uWidth += uX - this->uClipX;
             v6 += v8;
           }
           v9 = this->uClipY;
-          v5 = pTexture->uTextureHeight;
+          uHeight = pTexture->uTextureHeight;
           if ( (signed int)uY < (signed int)v9 )
           {
             v10 = v9 - uY;
             v19 += v18 * v10;
-            v5 = uY - this->uClipY + pTexture->uTextureHeight;
-            v4 = pTexture;
+            uHeight = uY - this->uClipY + pTexture->uTextureHeight;
+            pCurrentTexture = pTexture;
             v6 += this->uTargetSurfacePitch * v10;
           }
           v11 = this->uClipX;
           if ( (signed int)v11 < (signed int)uX )
             v11 = uX;
           pTexturea = this->uClipZ;
-          if ( (signed int)(v11 + v20) > (signed int)pTexturea )
+          if ( (signed int)(v11 + uWidth) > (signed int)pTexturea )
           {
             v12 = this->uClipX;
             if ( (signed int)v12 < (signed int)uX )
               v12 = uX;
-            v20 = pTexturea - v12;
+            uWidth = pTexturea - v12;
           }
           v13 = this->uClipY;
           if ( (signed int)v13 < (signed int)uY )
             v13 = uY;
           v14 = this->uClipW;
-          if ( (signed int)(v5 + v13) > (signed int)v14 )
+          if ( (signed int)(uHeight + v13) > (signed int)v14 )
           {
             v15 = this->uClipY;
             if ( (signed int)v15 < (signed int)uY )
               v15 = uY;
-            v5 = v14 - v15;
-          }
-        }
-        if ( (signed int)v5 > 0 )
-        {
-          uYa = v5;
+            uHeight = v14 - v15;
+          }
+        }
+        if ( (signed int)uHeight > 0 )
+        {
+          uYa = uHeight;
           v16 = v19;
           do
           {
-            if ( v20 > 0 )
+            if ( uWidth > 0 )
             {
-              uXa = v20;
+              uXa = uWidth;
               do
               {
                 if ( *v16 )
-                  *v6 = v4->pPalette16[*v16];
+                  *v6 = pCurrentTexture->pPalette16[*v16];
                 ++v6;
                 ++v16;
-                --uXa;
               }
-              while ( uXa );
+              while ( uXa-- !=1 );
             }
-            v16 += v18 - v20;
-            v17 = uYa-- == 1;
-            v6 += this->uTargetSurfacePitch - v20;
-          }
-          while ( !v17 );
+            v16 += v18 - uWidth;
+            uFlag = uYa-- == 1;
+            v6 += this->uTargetSurfacePitch - uWidth;
+          }
+          while ( !uFlag );
         }
       }
     }
--- a/Texture.cpp	Fri Oct 19 23:29:04 2012 +0600
+++ b/Texture.cpp	Sun Oct 21 23:26:23 2012 +0600
@@ -108,15 +108,7 @@
 unsigned int uTextureID_BUTTYES2;
 unsigned int uTextureID_x_ok_u;
 Texture *pPlayerPortraits[22];
-Texture *pTexture_IC_KNIGHT;
-Texture *pTexture_IC_THIEF;
-Texture *pTexture_IC_MONK;
-Texture *pTexture_IC_PALAD;
-Texture *pTexture_IC_ARCH;
-Texture *pTexture_IC_RANGER;
-Texture *pTexture_IC_CLER;
-Texture *pTexture_IC_DRUID;
-Texture *pTexture_IC_SORC;
+Texture *pTexture_IC_KNIGHT[8];
 Texture *pTexture_MAKESKY;
 Texture *pTexture_MAKETOP;
 Texture *pTextures_arrowr[20];
--- a/Texture.h	Fri Oct 19 23:29:04 2012 +0600
+++ b/Texture.h	Sun Oct 21 23:26:23 2012 +0600
@@ -210,15 +210,7 @@
 extern unsigned int uTextureID_BUTTYES2;
 extern unsigned int uTextureID_x_ok_u;
 extern Texture *pPlayerPortraits[22];
-extern Texture *pTexture_IC_KNIGHT;
-extern Texture *pTexture_IC_THIEF;
-extern Texture *pTexture_IC_MONK;
-extern Texture *pTexture_IC_PALAD;
-extern Texture *pTexture_IC_ARCH;
-extern Texture *pTexture_IC_RANGER;
-extern Texture *pTexture_IC_CLER;
-extern Texture *pTexture_IC_DRUID;
-extern Texture *pTexture_IC_SORC;
+extern Texture *pTexture_IC_KNIGHT[8];
 extern Texture *pTexture_MAKESKY;
 extern Texture *pTexture_MAKETOP;
 extern Texture *pTextures_arrowr[20];
--- a/mm7_4.cpp	Fri Oct 19 23:29:04 2012 +0600
+++ b/mm7_4.cpp	Sun Oct 21 23:26:23 2012 +0600
@@ -5441,7 +5441,7 @@
   int v105; // ecx@79
   int v106; // edi@81
   unsigned int v107; // ST0C_4@81
-  int v108; // ST08_4@81
+  int pTextY; // ST08_4@81
   int v109; // eax@81
   const char *v110; // ST10_4@82
   int v111; // ST0C_4@82
@@ -5451,7 +5451,7 @@
   int v115; // eax@82
   const char *uRaceName; // [sp+0h] [bp-170h]@39
   char Str1[200]; // [sp+10h] [bp-160h]@14
-  GUIWindow v118; // [sp+D8h] [bp-98h]@83
+  GUIWindow pWindow; // [sp+D8h] [bp-98h]@83
   int v119; // [sp+12Ch] [bp-44h]@18
   size_t v120; // [sp+130h] [bp-40h]@25
   int uY; // [sp+134h] [bp-3Ch]@18
@@ -5469,6 +5469,7 @@
   unsigned int v133; // [sp+164h] [bp-Ch]@25
   int v134; // [sp+168h] [bp-8h]@14
   Player *pPlayer;
+  const char *pSkillName;
 
   uColor1 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xD1u, 0xBBu, 0x61u);
   uColorTeal = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xF7u, 0xF7u);
@@ -5561,7 +5562,7 @@
     pRenderer->DrawTextureTransparent(
       v134 + 77,
       50u,
-      *(&pTexture_IC_KNIGHT + ((unsigned int)(unsigned __int8)pPlayer->uClass >> 2)));
+      pTexture_IC_KNIGHT[pPlayer->uClass/4]);
     v11 = pGUIWindow_CurrentMenu->field_40;
     if ( v11 && (v12 = pGUIWindow_CurrentMenu->ptr_1C, v12 == v124) )
     {
@@ -5664,12 +5665,14 @@
     LOWORD(v36) = pPlayer->GetStatColor(6u);
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, v119, v36, pTmpBuf, 0, 0, 0);
     v37 = pPlayer->GetSkillIdxByOrder(0);
-    v38 = pFontCreate->AlignText_Center(0x96u, pSkillNames[v37]);
-    sprintf(pTmpBuf, "\t%03u%s", v38);
+	pSkillName = pSkillNames[v37];
+    v38 = pFontCreate->AlignText_Center(0x96u, pSkillName);
+    sprintf(pTmpBuf, "\t%03u%s", v38, pSkillName);
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, 311, uColorWhite, pTmpBuf, 0, 0, 0);
     v39 = pPlayer->GetSkillIdxByOrder(1);
-    v40 = pFontCreate->AlignText_Center(0x96u, pSkillNames[v39]);
-    sprintf(pTmpBuf, "\t%03u%s", v40);
+	pSkillName = pSkillNames[v39];
+    v40 = pFontCreate->AlignText_Center(0x96u, pSkillName);
+    sprintf(pTmpBuf, "\t%03u%s", v40, pSkillName);
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, v128 + 311, uColorWhite, pTmpBuf, 0, 0, 0);
     v41 = pPlayer->GetSkillIdxByOrder(2);
     v42 = pSkillNames[v41];
@@ -5819,13 +5822,12 @@
     if ( !pParty->pPlayers[0].pActiveSkills[v102 + 3486 * uPlayerCreationUI_SelectedCharacter] )
       v105 = uColorWhite;
     v106 = v134 / 3;
-    v107 = v105;
-    v108 = v128 * v134 % 3 + 417;
-    v109 = pFontCreate->AlignText_Center(100u, Str1);
+	v107 = v105;
+	v109 = pFontCreate->AlignText_Center(100u, Str1);
     pGUIWindow_CurrentMenu->DrawText(
       pFontCreate,
       100 * v106 + v109 + uColorGreen + 17,
-      v108,
+      v128 * (v134 % 3) + 417,
       v107,
       Str1,
       0,
@@ -5845,16 +5847,16 @@
   pGUIWindow_CurrentMenu->DrawText(pFontCreate, v115 + 530, 410, v114, pTmpBuf, 0, 0, 0);
   if ( GameUI_StatusBar_TimedStringTimeLeft > GetTickCount() )
   {
-    v118.str_48 = pGlobalTXT_LocalizationStrings[412];// "Create Party cannot be completed unless you have assigned all characters 2 extra skills and have spent all of your bonus points."
+    pWindow.str_48 = pGlobalTXT_LocalizationStrings[412];// "Create Party cannot be completed unless you have assigned all characters 2 extra skills and have spent all of your bonus points."
     if ( v113 < 0 )
-      v118.str_48 = pGlobalTXT_LocalizationStrings[413];// "You can't spend more than 50 points."
-    v118.uFrameWidth = 300;
-    v118.uFrameHeight = 100;
-    v118.uFrameX = 170;
-    v118.uFrameY = 140;
-    v118.uFrameZ = 469;
-    v118.uFrameW = 239;
-    v118._415551(0);
+      pWindow.str_48 = pGlobalTXT_LocalizationStrings[413];// "You can't spend more than 50 points."
+    pWindow.uFrameWidth = 300;
+    pWindow.uFrameHeight = 100;
+    pWindow.uFrameX = 170;
+    pWindow.uFrameY = 140;
+    pWindow.uFrameZ = 469;
+    pWindow.uFrameW = 239;
+    pWindow._415551(0);
   }
   pRenderer->EndScene();
 }
@@ -5889,15 +5891,15 @@
   uPlayerCreationUI_SkySliderPos = 0;
   uPlayerCreationUI_SelectedCharacter = 0;
   v0 = LOBYTE(pFontCreate->uFontHeight) - 2;
-  pTexture_IC_KNIGHT = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("IC_KNIGHT", TEXTURE_16BIT_PALETTE)];
-  pTexture_IC_THIEF  = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("IC_THIEF", TEXTURE_16BIT_PALETTE)];
-  pTexture_IC_MONK   = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("IC_MONK", TEXTURE_16BIT_PALETTE)];
-  pTexture_IC_PALAD  = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("IC_PALAD", TEXTURE_16BIT_PALETTE)];
-  pTexture_IC_ARCH   = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("IC_ARCH", TEXTURE_16BIT_PALETTE)];
-  pTexture_IC_RANGER = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("IC_RANGER", TEXTURE_16BIT_PALETTE)];
-  pTexture_IC_CLER   = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("IC_CLER", TEXTURE_16BIT_PALETTE)];
-  pTexture_IC_DRUID  = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("IC_DRUID", TEXTURE_16BIT_PALETTE)];
-  pTexture_IC_SORC   = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("IC_SORC", TEXTURE_16BIT_PALETTE)];
+  pTexture_IC_KNIGHT[0] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("IC_KNIGHT", TEXTURE_16BIT_PALETTE)];
+  pTexture_IC_KNIGHT[1] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("IC_THIEF", TEXTURE_16BIT_PALETTE)];
+  pTexture_IC_KNIGHT[2] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("IC_MONK", TEXTURE_16BIT_PALETTE)];
+  pTexture_IC_KNIGHT[3] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("IC_PALAD", TEXTURE_16BIT_PALETTE)];
+  pTexture_IC_KNIGHT[4] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("IC_ARCH", TEXTURE_16BIT_PALETTE)];
+  pTexture_IC_KNIGHT[5] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("IC_RANGER", TEXTURE_16BIT_PALETTE)];
+  pTexture_IC_KNIGHT[6] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("IC_CLER", TEXTURE_16BIT_PALETTE)];
+  pTexture_IC_KNIGHT[7] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("IC_DRUID", TEXTURE_16BIT_PALETTE)];
+  pTexture_IC_KNIGHT[8] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("IC_SORC", TEXTURE_16BIT_PALETTE)];
   pTexture_MAKETOP   = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("MAKETOP", TEXTURE_16BIT_PALETTE)];
   uX = 0;
   pTexture_MAKESKY = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("MAKESKY", TEXTURE_16BIT_PALETTE)];