示例#1
0
        private unsafe void InternalDraw(SpriteBatch spriteBatch, Vector2 drawOffset, int waterStyle, float globalAlpha, bool isBackgroundDraw)
        {
            Rectangle drawArea = this._drawArea;

            Main.tileBatch.Begin();
            fixed(LiquidRenderer.LiquidDrawCache *liquidDrawCachePtr1 = &this._drawCache[0])
            {
                LiquidRenderer.LiquidDrawCache *liquidDrawCachePtr2 = liquidDrawCachePtr1;
                for (int x = drawArea.X; x < drawArea.X + drawArea.Width; ++x)
                {
                    for (int y = drawArea.Y; y < drawArea.Y + drawArea.Height; ++y)
                    {
                        if (liquidDrawCachePtr2->IsVisible)
                        {
                            Rectangle sourceRectangle = liquidDrawCachePtr2->SourceRectangle;
                            if (liquidDrawCachePtr2->IsSurfaceLiquid)
                            {
                                sourceRectangle.Y = 1280;
                            }
                            else
                            {
                                sourceRectangle.Y += this._animationFrame * 80;
                            }
                            Vector2 liquidOffset = liquidDrawCachePtr2->LiquidOffset;
                            float   val2         = liquidDrawCachePtr2->Opacity * (isBackgroundDraw ? 1f : LiquidRenderer.DEFAULT_OPACITY[(int)liquidDrawCachePtr2->Type]);
                            int     index        = (int)liquidDrawCachePtr2->Type;
                            switch (index)
                            {
                            case 0:
                                index = waterStyle;
                                val2 *= isBackgroundDraw ? 1f : globalAlpha;
                                break;

                            case 2:
                                index = 11;
                                break;
                            }
                            float        num = Math.Min(1f, val2);
                            VertexColors vertices;
                            Lighting.GetColor4Slice_New(x, y, out vertices, 1f);
                            vertices.BottomLeftColor  *= num;
                            vertices.BottomRightColor *= num;
                            vertices.TopLeftColor     *= num;
                            vertices.TopRightColor    *= num;
                            Main.tileBatch.Draw(this._liquidTextures[index], new Vector2((float)(x << 4), (float)(y << 4)) + drawOffset + liquidOffset, new Rectangle?(sourceRectangle), vertices, Vector2.Zero, 1f, SpriteEffects.None);
                        }
                        ++liquidDrawCachePtr2;
                    }
                }
            }

            Main.tileBatch.End();
        }
示例#2
0
        public unsafe void InternalDraw(SpriteBatch spriteBatch, Vector2 drawOffset, int waterStyle, float globalAlpha, bool isBackgroundDraw)
        {
            Rectangle rectangle1 = _drawArea;

            fixed(LiquidDrawCache *liquidDrawCachePtr1 = &_drawCache[0])
            {
                LiquidDrawCache *liquidDrawCachePtr2 = liquidDrawCachePtr1;

                for (int centerX = rectangle1.X; centerX < rectangle1.X + rectangle1.Width; ++centerX)
                {
                    for (int centerY = rectangle1.Y; centerY < rectangle1.Y + rectangle1.Height; ++centerY)
                    {
                        if (liquidDrawCachePtr2->IsVisible)
                        {
                            Rectangle rectangle2 = liquidDrawCachePtr2->SourceRectangle;
                            if (liquidDrawCachePtr2->IsSurfaceLiquid)
                            {
                                rectangle2.Y = 1280;
                            }
                            else
                            {
                                rectangle2.Y += _animationFrame * 80;
                            }

                            Vector2 vector2 = liquidDrawCachePtr2->LiquidOffset;
                            int     index   = liquidDrawCachePtr2->Type;
                            switch (index)
                            {
                            case 0:
                                index = waterStyle;
                                break;

                            case 2:
                                index = 11;
                                break;
                            }

                            VertexColors vertices;
                            Lighting.GetColor4Slice_New(centerX, centerY, out vertices, 1f);
                            float num = liquidDrawCachePtr2->Opacity * Math.Min(1f, isBackgroundDraw ? 1f : globalAlpha * DEFAULT_OPACITY[liquidDrawCachePtr2->Type]);
                            vertices.BottomLeftColor  *= num;
                            vertices.BottomRightColor *= num;
                            vertices.TopLeftColor     *= num;
                            vertices.TopRightColor    *= num;
                            Main.tileBatch.Draw(_liquidTextures[index], new Vector2((float)(centerX << 4), (float)(centerY << 4)) + drawOffset + vector2,
                                                new Rectangle?(rectangle2), vertices, Vector2.Zero, 1f, SpriteEffects.None);
                        }
                        ++liquidDrawCachePtr2;
                    }
                }
            }
        }
        private unsafe void InternalDraw(SpriteBatch spriteBatch, Vector2 drawOffset, int waterStyle, float globalAlpha, bool isBackgroundDraw)
        {
            VertexColors bottomLeftColor;
            Rectangle    rectangle = this._drawArea;

            Main.tileBatch.Begin();
            fixed(ReplacementLiquidRenderer.LiquidDrawCache *liquidDrawCachePointer = &this._drawCache[0])
            {
                ReplacementLiquidRenderer.LiquidDrawCache *liquidDrawCachePointer1 = liquidDrawCachePointer;
                for (int i = rectangle.X; i < rectangle.X + rectangle.Width; i++)
                {
                    for (int j = rectangle.Y; j < rectangle.Y + rectangle.Height; j++)
                    {
                        if ((*liquidDrawCachePointer1).IsVisible)
                        {
                            Rectangle sourceRectangle = (*liquidDrawCachePointer1).SourceRectangle;
                            if (!(*liquidDrawCachePointer1).IsSurfaceLiquid)
                            {
                                sourceRectangle.Y = sourceRectangle.Y + this._animationFrame * 80;
                            }
                            else
                            {
                                sourceRectangle.Y = 1280;
                            }
                            Vector2 liquidOffset = (*liquidDrawCachePointer1).LiquidOffset;
                            float   opacity      = (*liquidDrawCachePointer1).Opacity * (isBackgroundDraw ? 1f : ReplacementLiquidRenderer.DEFAULT_OPACITY[(*liquidDrawCachePointer1).Type]);
                            int     type         = (*liquidDrawCachePointer1).Type;
                            if (type == 0)
                            {
                                type    = waterStyle;
                                opacity = opacity * (isBackgroundDraw ? 1f : globalAlpha);
                            }
                            else if (type == 2)
                            {
                                type = 11;
                            }
                            opacity = Math.Min(1f, opacity);
                            Lighting.GetColor4Slice_New(i, j, out bottomLeftColor, 1f);
                            bottomLeftColor.BottomLeftColor  = bottomLeftColor.BottomLeftColor * opacity;
                            bottomLeftColor.BottomRightColor = bottomLeftColor.BottomRightColor * opacity;
                            bottomLeftColor.TopLeftColor     = bottomLeftColor.TopLeftColor * opacity;
                            bottomLeftColor.TopRightColor    = bottomLeftColor.TopRightColor * opacity;
                            Main.tileBatch.Draw(this._liquidTextures[type], (new Vector2((float)(i << 4), (float)(j << 4)) + drawOffset) + liquidOffset, new Rectangle?(sourceRectangle), bottomLeftColor, Vector2.Zero, 1f, SpriteEffects.None);
                        }
                        liquidDrawCachePointer1 = liquidDrawCachePointer1 + 1;
                    }
                }
            }

            Main.tileBatch.End();
        }
示例#4
0
        // Token: 0x06000F3B RID: 3899 RVA: 0x003F37F8 File Offset: 0x003F19F8
        private unsafe void InternalDraw(SpriteBatch spriteBatch, Vector2 drawOffset, int waterStyle, float globalAlpha, bool isBackgroundDraw)
        {
            Rectangle drawArea = this._drawArea;

            Main.tileBatch.Begin();
            fixed(LiquidRenderer.LiquidDrawCache *ptr = &this._drawCache[0])
            {
                LiquidRenderer.LiquidDrawCache *ptr2 = ptr;
                for (int i = drawArea.X; i < drawArea.X + drawArea.Width; i++)
                {
                    for (int j = drawArea.Y; j < drawArea.Y + drawArea.Height; j++)
                    {
                        if (ptr2->IsVisible)
                        {
                            Rectangle sourceRectangle = ptr2->SourceRectangle;
                            if (ptr2->IsSurfaceLiquid)
                            {
                                sourceRectangle.Y = 1280;
                            }
                            else
                            {
                                sourceRectangle.Y += this._animationFrame * 80;
                            }
                            Vector2 liquidOffset = ptr2->LiquidOffset;
                            float   num          = ptr2->Opacity * (isBackgroundDraw ? 1f : LiquidRenderer.DEFAULT_OPACITY[(int)ptr2->Type]);
                            int     num2         = (int)ptr2->Type;
                            if (num2 == 0)
                            {
                                num2 = waterStyle;
                                num *= (isBackgroundDraw ? 1f : globalAlpha);
                            }
                            else if (num2 == 2)
                            {
                                num2 = 11;
                            }
                            num = Math.Min(1f, num);
                            VertexColors colors;
                            Lighting.GetColor4Slice_New(i, j, out colors, 1f);
                            colors.BottomLeftColor  *= num;
                            colors.BottomRightColor *= num;
                            colors.TopLeftColor     *= num;
                            colors.TopRightColor    *= num;
                            Main.tileBatch.Draw(this._liquidTextures[num2], new Vector2((float)(i << 4), (float)(j << 4)) + drawOffset + liquidOffset, new Rectangle?(sourceRectangle), colors, Vector2.Zero, 1f, SpriteEffects.None);
                        }
                        ptr2++;
                    }
                }
            }

            Main.tileBatch.End();
        }
示例#5
0
        public unsafe void InternalDraw(SpriteBatch spriteBatch, Vector2 drawOffset, int waterStyle, float globalAlpha, bool isBackgroundDraw)
        {
            Rectangle drawArea = _drawArea;

            fixed(LiquidDrawCache *ptr = &_drawCache[0])
            {
                LiquidDrawCache *ptr2 = ptr;

                for (int i = drawArea.X; i < drawArea.X + drawArea.Width; i++)
                {
                    for (int j = drawArea.Y; j < drawArea.Y + drawArea.Height; j++)
                    {
                        if (ptr2->IsVisible)
                        {
                            Rectangle sourceRectangle = ptr2->SourceRectangle;
                            if (ptr2->IsSurfaceLiquid)
                            {
                                sourceRectangle.Y = 1280;
                            }
                            else
                            {
                                sourceRectangle.Y += _animationFrame * 80;
                            }
                            Vector2 liquidOffset = ptr2->LiquidOffset;
                            int     num          = ptr2->Type;
                            switch (num)
                            {
                            case 0:
                                num = waterStyle;
                                break;

                            case 2:
                                num = 11;
                                break;
                            }
                            VertexColors vertices;
                            Lighting.GetColor4Slice_New(i, j, out vertices);
                            float num2 = ptr2->Opacity * Math.Min(1f, isBackgroundDraw ? 1f : (globalAlpha * DEFAULT_OPACITY[ptr2->Type]));
                            vertices.BottomLeftColor  *= num2;
                            vertices.BottomRightColor *= num2;
                            vertices.TopLeftColor     *= num2;
                            vertices.TopRightColor    *= num2;
                            Main.tileBatch.Draw(_liquidTextures[num], new Vector2(i << 4, j << 4) + drawOffset + liquidOffset, sourceRectangle, vertices, Vector2.Zero, 1f, SpriteEffects.None);
                        }
                        ptr2++;
                    }
                }
            }
        }
示例#6
0
        private unsafe void InternalDraw(SpriteBatch spriteBatch, Vector2 drawOffset, int waterStyle, float globalAlpha, bool isBackgroundDraw)
        {
            Rectangle drawArea = this._drawArea;

            Main.tileBatch.Begin();
            fixed(LiquidRenderer.LiquidDrawCache *liquidDrawCachePtr1 = &this._drawCache[0])
            {
                LiquidRenderer.LiquidDrawCache *liquidDrawCachePtr2 = liquidDrawCachePtr1;
                for (int x = (int)drawArea.X; x < drawArea.X + drawArea.Width; ++x)
                {
                    for (int y = (int)drawArea.Y; y < drawArea.Y + drawArea.Height; ++y)
                    {
                        if (liquidDrawCachePtr2->IsVisible)
                        {
                            Rectangle sourceRectangle = liquidDrawCachePtr2->SourceRectangle;
                            if (liquidDrawCachePtr2->IsSurfaceLiquid)
                            {
                                sourceRectangle.Y = (__Null)1280;
                            }
                            else
                            {
                                // ISSUE: explicit reference operation
                                // ISSUE: variable of a reference type
                                Rectangle& local = @sourceRectangle;
                                // ISSUE: explicit reference operation
                                int num = (^ local).Y + this._animationFrame * 80;
                                // ISSUE: explicit reference operation
                                (^ local).Y = (__Null)num;
                            }
                            Vector2 liquidOffset = liquidDrawCachePtr2->LiquidOffset;
                            float   val2         = liquidDrawCachePtr2->Opacity * (isBackgroundDraw ? 1f : LiquidRenderer.DEFAULT_OPACITY[(int)liquidDrawCachePtr2->Type]);
                            int     index        = (int)liquidDrawCachePtr2->Type;
                            switch (index)
                            {
                            case 0:
                                index = waterStyle;
                                val2 *= isBackgroundDraw ? 1f : globalAlpha;
                                break;

                            case 2:
                                index = 11;
                                break;
                            }
                            float        num1 = Math.Min(1f, val2);
                            VertexColors vertices;
                            Lighting.GetColor4Slice_New(x, y, out vertices, 1f);
                            // ISSUE: explicit reference operation
                            // ISSUE: variable of a reference type
                            VertexColors& local1 = @vertices;
                            // ISSUE: explicit reference operation
                            Color color1 = Color.op_Multiply((^ local1).BottomLeftColor, num1);
                            // ISSUE: explicit reference operation
                            (^ local1).BottomLeftColor = color1;
                            // ISSUE: explicit reference operation
                            // ISSUE: variable of a reference type
                            VertexColors& local2 = @vertices;
                            // ISSUE: explicit reference operation
                            Color color2 = Color.op_Multiply((^ local2).BottomRightColor, num1);
                            // ISSUE: explicit reference operation
                            (^ local2).BottomRightColor = color2;
                            // ISSUE: explicit reference operation
                            // ISSUE: variable of a reference type
                            VertexColors& local3 = @vertices;
                            // ISSUE: explicit reference operation
                            Color color3 = Color.op_Multiply((^ local3).TopLeftColor, num1);
                            // ISSUE: explicit reference operation
                            (^ local3).TopLeftColor = color3;
                            // ISSUE: explicit reference operation
                            // ISSUE: variable of a reference type
                            VertexColors& local4 = @vertices;
                            // ISSUE: explicit reference operation
                            Color color4 = Color.op_Multiply((^ local4).TopRightColor, num1);
                            // ISSUE: explicit reference operation
                            (^ local4).TopRightColor = color4;
                            Main.tileBatch.Draw(this._liquidTextures[index], Vector2.op_Addition(Vector2.op_Addition(new Vector2((float)(x << 4), (float)(y << 4)), drawOffset), liquidOffset), new Rectangle?(sourceRectangle), vertices, Vector2.get_Zero(), 1f, (SpriteEffects)0);
                        }
                        ++liquidDrawCachePtr2;
                    }
                }
            }

            Main.tileBatch.End();
        }