changeset 2536:400edd7b0407

DrawTextureIndexed() func
author Ritor1
date Mon, 16 Feb 2015 00:48:08 +0600
parents 3a36de426f5f
children 5c03054c72b8
files Engine/Graphics/IRender.h Engine/Graphics/Render.cpp Engine/Graphics/Render.h Engine/Graphics/RenderD3D11.cpp Engine/Graphics/RenderD3D11.h GUI/UI/UIPartyCreation.cpp
diffstat 6 files changed, 36 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/Engine/Graphics/IRender.h	Sun Feb 15 23:39:07 2015 +0600
+++ b/Engine/Graphics/IRender.h	Mon Feb 16 00:48:08 2015 +0600
@@ -71,7 +71,7 @@
     virtual void DrawTextureNew(float u, float v, struct Texture *) = 0;
     virtual void DrawTextureNew(float u, float v, struct RGBTexture *) = 0;
     virtual void DrawTextureRGB(unsigned int uOutX, unsigned int uOutY, RGBTexture *a4) = 0;
-    virtual void DrawTextureIndexed(unsigned int uX, unsigned int uY, struct Texture *a4) = 0;
+    virtual void DrawTextureIndexed(signed int x, signed int y, struct Texture *tex) = 0;
 
     virtual void ZBuffer_Fill_2(signed int a2, signed int a3, struct Texture *pTexture, int a5) = 0;
     virtual void DrawMaskToZBuffer(signed int uOutX, unsigned int uOutY, struct Texture *pTexture, int zVal) = 0;
--- a/Engine/Graphics/Render.cpp	Sun Feb 15 23:39:07 2015 +0600
+++ b/Engine/Graphics/Render.cpp	Mon Feb 16 00:48:08 2015 +0600
@@ -7702,7 +7702,7 @@
 }
 
 //----- (004A5EB2) --------------------------------------------------------
-void Render::DrawTextureIndexed(unsigned int uX, unsigned int uY, Texture *a4)
+void Render::DrawTextureIndexed(signed int x, signed int y, Texture *tex)
 {
   int v5; // ebx@4
   unsigned int v8; // edx@6
@@ -7717,59 +7717,59 @@
 
   if ( this->uNumSceneBegins )
   {
-    if ( a4 )
-    {
-      if ( a4->pPalette16 )
-      {
-        v5 = a4->uTextureHeight;
+    if ( tex )
+    {
+      if ( tex->pPalette16 )
+      {
+        v5 = tex->uTextureHeight;
         //pTarget = &this->pTargetSurface[uX + uY * this->uTargetSurfacePitch];
-        v19 = a4->pLevelOfDetail0_prolly_alpha_mask;
-        v20 = a4->uTextureWidth;
-        v18 = a4->uTextureWidth;
-
-        int clipped_out_x = uX;
-        int clipped_out_y = uY;
+        v19 = tex->pLevelOfDetail0_prolly_alpha_mask;
+        v20 = tex->uTextureWidth;
+        v18 = tex->uTextureWidth;
+
+        int clipped_out_x = x;
+        int clipped_out_y = y;
         if ( this->bClip )
         {
-          if ( (signed int)uX < (signed int)this->uClipX )
+          if ( (signed int)x < (signed int)this->uClipX )
           {
-            v8 = this->uClipX - uX;
+            v8 = this->uClipX - x;
             v19 += v8;
-            v20 += uX - this->uClipX;
+            v20 += x - this->uClipX;
             clipped_out_x = uClipX;
           }
 
-          v5 = a4->uTextureHeight;
-          if ( (signed int)uY < (signed int)this->uClipY )
+          v5 = tex->uTextureHeight;
+          if ( (signed int)y < (signed int)this->uClipY )
           {
-            v10 = this->uClipY - uY;
+            v10 = this->uClipY - y;
             v19 += v18 * v10;
-            v5 = uY - this->uClipY + a4->uTextureHeight;
+            v5 = y - this->uClipY + tex->uTextureHeight;
             //v4 = a4;
             clipped_out_y = uClipY;
           }
 
           v11 = this->uClipX;
-          if ( (signed int)this->uClipX < (signed int)uX )
-            v11 = uX;
+          if ( (signed int)this->uClipX < (signed int)x )
+            v11 = x;
 
           if ( (signed int)(v11 + v20) > (signed int)this->uClipZ )
           {
             v12 = this->uClipX;
-            if ( (signed int)this->uClipX < (signed int)uX )
-              v12 = uX;
+            if ( (signed int)this->uClipX < (signed int)x )
+              v12 = x;
             v20 = this->uClipZ - v12;
           }
 
           v13 = this->uClipY;
-          if ( (signed int)this->uClipY < (signed int)uY )
-            v13 = uY;
+          if ( (signed int)this->uClipY < (signed int)y )
+            v13 = y;
 
           if ( (signed int)(v5 + v13) > (signed int)uClipW )
           {
             v15 = this->uClipY;
-            if ( (signed int)this->uClipY < (signed int)uY )
-              v15 = uY;
+            if ( (signed int)this->uClipY < (signed int)y )
+              v15 = y;
             v5 = uClipW - v15;
           }
         }
@@ -7778,8 +7778,8 @@
         {
           for (int x = 0; x < v20; ++x)
           {
-            if ( a4->pPalette16[*v19] != 0x7FF )// 2047
-              WritePixel16(clipped_out_x + x, clipped_out_y + y, a4->pPalette16[*v19]);
+            if ( tex->pPalette16[*v19] != 0x7FF )// 2047
+              WritePixel16(clipped_out_x + x, clipped_out_y + y, tex->pPalette16[*v19]);
             ++v19;
           }
           v19 += v18 - v20;
--- a/Engine/Graphics/Render.h	Sun Feb 15 23:39:07 2015 +0600
+++ b/Engine/Graphics/Render.h	Mon Feb 16 00:48:08 2015 +0600
@@ -255,7 +255,7 @@
   virtual void DrawTextureNew(float u, float v, struct Texture *);
   virtual void DrawTextureNew(float u, float v, struct RGBTexture *);
   virtual void DrawTextureRGB(unsigned int uOutX, unsigned int uOutY, RGBTexture *a4);
-  virtual void DrawTextureIndexed(unsigned int uX, unsigned int uY, struct Texture *a4);
+  virtual void DrawTextureIndexed(signed int x, signed int y, struct Texture *tex);
 
   virtual void ZBuffer_Fill_2(signed int a2, signed int a3, struct Texture *pTexture, int a5);
   virtual void DrawMaskToZBuffer(signed int uOutX, unsigned int uOutY, struct Texture *pTexture, int zVal);
--- a/Engine/Graphics/RenderD3D11.cpp	Sun Feb 15 23:39:07 2015 +0600
+++ b/Engine/Graphics/RenderD3D11.cpp	Mon Feb 16 00:48:08 2015 +0600
@@ -149,10 +149,10 @@
 }
 
 
-void RenderD3D11::DrawTextureIndexed(unsigned int uX, unsigned int uY, struct Texture *a4)
+void RenderD3D11::DrawTextureIndexed(signed int x, signed int y, struct Texture *tex)
 {
-  PrepareTextureIndexed(a4);
-  DrawTexture((float)uX / window->GetWidth(), (float)uY / window->GetHeight(), a4->uTextureWidth, a4->uTextureHeight, a4->d3d11_srv, ui_blend_solid);
+  PrepareTextureIndexed(tex);
+  DrawTexture((float)x / window->GetWidth(), (float)y / window->GetHeight(), tex->uTextureWidth, tex->uTextureHeight, tex->d3d11_srv, ui_blend_solid);
 }
 
 void RenderD3D11::DrawTextureIndexedAlpha(unsigned int uX, unsigned int uY, struct Texture *a4) 
--- a/Engine/Graphics/RenderD3D11.h	Sun Feb 15 23:39:07 2015 +0600
+++ b/Engine/Graphics/RenderD3D11.h	Mon Feb 16 00:48:08 2015 +0600
@@ -81,7 +81,7 @@
   virtual void DrawTextureNew(float u, float v, struct Texture *);
   virtual void DrawTextureNew(float u, float v, struct RGBTexture *);
   virtual void DrawTextureRGB(unsigned int uOutX, unsigned int uOutY, RGBTexture *a4);
-  virtual void DrawTextureIndexed(unsigned int uX, unsigned int uY, struct Texture *a4);
+  virtual void DrawTextureIndexed(signed int x, signed int y, struct Texture *tex);
 
   virtual void ZBuffer_Fill_2(signed int a2, signed int a3, struct Texture *pTexture, int a5);
   virtual void DrawMaskToZBuffer(signed int uOutX, unsigned int uOutY, struct Texture *pTexture, int zVal);
--- a/GUI/UI/UIPartyCreation.cpp	Sun Feb 15 23:39:07 2015 +0600
+++ b/GUI/UI/UIPartyCreation.cpp	Mon Feb 16 00:48:08 2015 +0600
@@ -92,7 +92,6 @@
   PLAYER_SKILL_TYPE pSkillId; // edi@72
   size_t pLenText; // eax@72
   signed int v104; // ecx@72
-//  int pTextY; // ST08_4@81
   signed int pBonusNum; // edi@82
   const char *uRaceName; // [sp+0h] [bp-170h]@39
   char pText[200]; // [sp+10h] [bp-160h]@14
@@ -131,12 +130,10 @@
   pRenderer->DrawTextureIndexedAlpha(494, 35, pPlayerPortraits[pParty->pPlayers[3].uCurrentFace]);
   pFrame = pIconsFrameTable->GetFrame(uIconID_CharacterFrame, pEventTimer->uStartTime);
 
-
+  //arrows
   pRenderer->DrawTextureIndexedAlpha(pX, 29, &pIcons_LOD->pTextures[pFrame->uTextureID]);
   uPosActiveItem = pGUIWindow_CurrentMenu->GetControl(pGUIWindow_CurrentMenu->pCurrentPosActiveItem);
   uPlayerCreationUI_ArrowAnim = 18 - (GetTickCount() % 450) / 25;
-  if (uPlayerCreationUI_ArrowAnim < 0)
-	  uPlayerCreationUI_ArrowAnim = 18;
   pRenderer->DrawTextureIndexedAlpha(uPosActiveItem->uZ - 4, uPosActiveItem->uY, pTextures_arrowl[uPlayerCreationUI_ArrowAnim + 1]);
   pRenderer->DrawTextureIndexedAlpha(uPosActiveItem->uX - 12, uPosActiveItem->uY, pTextures_arrowr[uPlayerCreationUI_ArrowAnim + 1]);