diff Render.cpp @ 1675:f1cdf8c062d4

MainMenuUI_Credits_Loop() and CreditsTextureScroll
author Ritor1
date Thu, 19 Sep 2013 16:45:21 +0600
parents 5302a9811767
children 4da5644df18f
line wrap: on
line diff
--- a/Render.cpp	Thu Sep 19 09:29:30 2013 +0600
+++ b/Render.cpp	Thu Sep 19 16:45:21 2013 +0600
@@ -6914,101 +6914,61 @@
 }
 
 //----- (004A5D33) --------------------------------------------------------
-void Render::_4A5D33(unsigned int pX, unsigned int pY, int a4, int a5, RGBTexture *pTexture)
+void Render::CreditsTextureScroll(unsigned int pX, unsigned int pY, int move_X, int move_Y, RGBTexture *pTexture)
 {
-  Render *v6; // esi@1
   unsigned __int16 *v7; // ebx@3
-  int v8; // ecx@3
-  int v9; // edx@3
-  int v10; // ecx@3
-  int v11; // edi@3
-  signed int v12; // eax@4
-  unsigned int v13; // eax@5
-  signed int v14; // eax@6
-  unsigned int v15; // eax@7
-  unsigned int v16; // edx@8
-  int v17; // eax@10
-  unsigned int v18; // ecx@11
-  unsigned int v19; // ecx@14
-  int v20; // eax@16
-  unsigned int v21; // ecx@17
-  int v22; // eax@21
+  int full_width; // ecx@3
+  int full_height; // edi@3
   int v23; // edi@23
-  int v24; // [sp+Ch] [bp-4h]@3
-  int a2a; // [sp+18h] [bp+8h]@21
-  unsigned int teal; // [sp+1Ch] [bp+Ch]@20
-  int a4a; // [sp+20h] [bp+10h]@3
-  int a4b; // [sp+20h] [bp+10h]@21
   unsigned __int16 *pTexturea; // [sp+28h] [bp+18h]@3
 
-  v6 = this;
   if ( this->uNumSceneBegins && pTexture )
   {
     v7 = &this->pTargetSurface[pX + pY * this->uTargetSurfacePitch];
-    v8 = pTexture->uWidth;
-    v24 = pTexture->uWidth;
-    v9 = a4 + a5 * v8;
-    v10 = v8 - a4;
-    a4a = v10;
-    v11 = pTexture->uHeight - a5;
-    pTexturea = &pTexture->pPixels[v9];
-    if ( v6->bClip )
-    {
-      v12 = v6->uClipX;
-      if ( (signed int)pX < v12 )
-      {
-        v13 = 2 * (v12 - pX);
-        pTexturea = (unsigned __int16 *)((char *)pTexturea + v13);
-        v10 += pX - v6->uClipX;
-        v7 = (unsigned __int16 *)((char *)v7 + v13);
-        a4a = v10;
-      }
-      v14 = v6->uClipY;
-      if ( (signed int)pY < v14 )
-      {
-        v15 = v14 - pY;
-        pTexturea += v24 * v15;
-        v11 += pY - v6->uClipY;
-        v10 = a4a;
-        v7 += v6->uTargetSurfacePitch * v15;
-      }
-      v16 = v6->uClipX;
-      if ( (signed int)v16 < (signed int)pX )
-        v16 = pX;
-      v17 = v6->uClipZ;
-      if ( (signed int)(v10 + v16) > v17 )
-      {
-        v18 = v6->uClipX;
-        if ( (signed int)v18 < (signed int)pX )
-          v18 = pX;
-        a4a = v17 - v18;
-      }
-      v19 = v6->uClipY;
-      if ( (signed int)v19 < (signed int)pY )
-        v19 = pY;
-      v20 = v6->uClipW;
-      if ( (signed int)(v11 + v19) > v20 )
-      {
-        v21 = v6->uClipY;
-        if ( (signed int)v21 < (signed int)pY )
-          v21 = pY;
-        v11 = v20 - v21;
-      }
-    }
-    teal = TargetColor(0, 0xFFu, 0xFFu);
-    if ( v11 > 0 )
-    {
-      v22 = a4a;
-      a2a = v11;
-      a4b = 2 * (v24 - a4a);
+    full_width = pTexture->uWidth - move_X;
+    full_height = pTexture->uHeight - move_Y;
+    pTexturea = &pTexture->pPixels[move_X + move_Y * pTexture->uWidth];
+    if ( this->bClip )
+    {
+      if ( pX < this->uClipX )//если кадр выходит за правую границу
+      {
+        pTexturea = (unsigned __int16 *)((char *)pTexturea + (2 * (this->uClipX - pX)));
+        full_width += pX - this->uClipX;
+        v7 = (unsigned __int16 *)((char *)v7 + (2 * (this->uClipX - pX)));
+      }
+      if ( pY < this->uClipY )//если кадр выходит за верхнюю границу
+      {
+        pTexturea += pTexture->uWidth * (this->uClipY - pY);
+        full_height += pY - this->uClipY;
+        v7 += this->uTargetSurfacePitch * (this->uClipY - pY);
+      }
+      if ( this->uClipX < pX )//если правая граница окна меньше х координаты кадра
+        this->uClipX = pX;
+      if ( this->uClipY < pY )//если верхняя граница окна меньше y координаты кадра
+        this->uClipY = pY;
+      if ( (full_width + this->uClipX) > this->uClipZ )//если ширина кадра выходит за правую границу
+      {
+        if ( this->uClipX < pX )
+          this->uClipX = pX;
+        full_width = this->uClipZ - this->uClipX;
+      }
+      if ( (full_height + this->uClipY) > this->uClipW )//если высота кадра выходит за нижнюю границу
+      {
+        if ( this->uClipY < pY )
+          this->uClipY = pY;
+        full_height = this->uClipW - this->uClipY;
+      }
+    }
+    if ( full_height > 0 )
+    {
       do
       {
-        if ( v22 > 0 )
+        if ( full_width > 0 )
         {
-          v23 = v22;
+          v23 = full_width;
           do
           {
-            if ( *pTexturea != teal )
+            if ( *pTexturea != TargetColor(0, 0xFFu, 0xFFu) )
               *v7 = *pTexturea;
             ++pTexturea;
             ++v7;
@@ -7016,11 +6976,11 @@
           }
           while ( v23 );
         }
-        v7 += v6->uTargetSurfacePitch - v22;
-        pTexturea = (unsigned __int16 *)((char *)pTexturea + a4b);
-        --a2a;
-      }
-      while ( a2a );
+        v7 += this->uTargetSurfacePitch - full_width;
+        pTexturea = (unsigned __int16 *)((char *)pTexturea + 2 * (pTexture->uWidth - full_width));
+        --full_height;
+      }
+      while ( full_height );
     }
   }
 }
@@ -8392,9 +8352,9 @@
       SetUserInterface(pParty->alignment, true);
       if ( pVideoPlayer->pVideoFrame.pPixels )
         pVideoPlayer->pVideoFrame.Load(pVideoPlayer->pVideoFrameTextureFilename, 1);
-      if ( uCurrentMenuID != 6 )
-      {
-        if ( uCurrentMenuID == 8 )
+      if ( uCurrentMenuID != MENU_CREATEPARTY )
+      {
+        if ( uCurrentMenuID == MENU_CREDITSPROC )
           dword_A74C88 = 1; 
       }
       else