Beispiel #1
0
        public static Sprite getSprite(int i, int j, int k)
        {
            if (k == 0)
            {
                Sprite sprite = (Sprite)mruNodes1.insertFromCache(i);
                if (sprite != null && sprite.anInt1445 != j && sprite.anInt1445 != -1)
                {
                    sprite.unlink();
                    sprite = null;
                }
                if (sprite != null)
                {
                    return(sprite);
                }
            }
            ItemDef itemDef = forID(i);

            if (itemDef.stackIDs == null)
            {
                j = -1;
            }
            if (j > 1)
            {
                int i1 = -1;
                for (int j1 = 0; j1 < 10; j1++)
                {
                    if (j >= itemDef.stackAmounts[j1] && itemDef.stackAmounts[j1] != 0)
                    {
                        i1 = itemDef.stackIDs[j1];
                    }
                }
                if (i1 != -1)
                {
                    itemDef = forID(i1);
                }
            }
            Model model = itemDef.method201(1);

            if (model == null)
            {
                return(null);
            }
            Sprite sprite2 = null;

            if (itemDef.certTemplateID != -1)
            {
                sprite2 = getSprite(itemDef.certID, 10, -1);
                if (sprite2 == null)
                {
                    return(null);
                }
            }
            if (itemDef.lentItemID != -1)
            {
                sprite2 = getSprite(itemDef.lendID, 50, 0);
                if (sprite2 == null)
                {
                    return(null);
                }
            }
            Sprite sprite3 = new Sprite(32, 32);
            int    k1      = Texture.center_x;
            int    l1      = Texture.center_y;

            int[] ai  = Texture.lineOffsets;
            int[] ai1 = DrawingArea.pixels;
            //float[] depthBuffer = DrawingArea.depthBuffer;
            int i2 = DrawingArea.width;
            int j2 = DrawingArea.height;
            int k2 = DrawingArea.topX;
            int l2 = DrawingArea.bottomX;
            int i3 = DrawingArea.topY;
            int j3 = DrawingArea.bottomY;

            Texture.notTextured = false;
            DrawingArea.initDrawingArea(32, 32, sprite3.myPixels);             //, new float[32*32]);
            DrawingArea.drawPixels(32, 0, 0, 0, 32);
            Texture.method364();
            int k3 = itemDef.modelZoom;

            if (k == -1)
            {
                k3 = (int)((double)k3 * 1.5D);
            }
            if (k > 0)
            {
                k3 = (int)((double)k3 * 1.04D);
            }
            int l3 = Texture.SINE[itemDef.modelRotation1] * k3 >> 16;
            int i4 = Texture.COSINE[itemDef.modelRotation1] * k3 >> 16;

            model.method482(itemDef.modelRotation2, itemDef.anInt204, itemDef.modelRotation1, itemDef.modelOffset1, l3 + model.modelHeight / 2 + itemDef.modelOffset2, i4 + itemDef.modelOffset2);
            for (int i5 = 31; i5 >= 0; i5--)
            {
                for (int j4 = 31; j4 >= 0; j4--)
                {
                    if (sprite3.myPixels[i5 + j4 * 32] == 0)
                    {
                        if (i5 > 0 && sprite3.myPixels[(i5 - 1) + j4 * 32] > 1)
                        {
                            sprite3.myPixels[i5 + j4 * 32] = 1;
                        }
                        else if (j4 > 0 && sprite3.myPixels[i5 + (j4 - 1) * 32] > 1)
                        {
                            sprite3.myPixels[i5 + j4 * 32] = 1;
                        }
                        else if (i5 < 31 && sprite3.myPixels[i5 + 1 + j4 * 32] > 1)
                        {
                            sprite3.myPixels[i5 + j4 * 32] = 1;
                        }
                        else if (j4 < 31 && sprite3.myPixels[i5 + (j4 + 1) * 32] > 1)
                        {
                            sprite3.myPixels[i5 + j4 * 32] = 1;
                        }
                    }
                }
            }
            if (k > 0)
            {
                for (int j5 = 31; j5 >= 0; j5--)
                {
                    for (int k4 = 31; k4 >= 0; k4--)
                    {
                        if (sprite3.myPixels[j5 + k4 * 32] == 0)
                        {
                            if (j5 > 0 && sprite3.myPixels[(j5 - 1) + k4 * 32] == 1)
                            {
                                sprite3.myPixels[j5 + k4 * 32] = k;
                            }
                            else if (k4 > 0 && sprite3.myPixels[j5 + (k4 - 1) * 32] == 1)
                            {
                                sprite3.myPixels[j5 + k4 * 32] = k;
                            }
                            else if (j5 < 31 && sprite3.myPixels[j5 + 1 + k4 * 32] == 1)
                            {
                                sprite3.myPixels[j5 + k4 * 32] = k;
                            }
                            else if (k4 < 31 && sprite3.myPixels[j5 + (k4 + 1) * 32] == 1)
                            {
                                sprite3.myPixels[j5 + k4 * 32] = k;
                            }
                        }
                    }
                }
            }
            else if (k == 0)
            {
                for (int k5 = 31; k5 >= 0; k5--)
                {
                    for (int l4 = 31; l4 >= 0; l4--)
                    {
                        if (sprite3.myPixels[k5 + l4 * 32] == 0 && k5 > 0 && l4 > 0 && sprite3.myPixels[(k5 - 1) + (l4 - 1) * 32] > 0)
                        {
                            sprite3.myPixels[k5 + l4 * 32] = 0x302020;
                        }
                    }
                }
            }
            if (itemDef.certTemplateID != -1)
            {
                int l5 = sprite2.anInt1444;
                int j6 = sprite2.anInt1445;
                sprite2.anInt1444 = 32;
                sprite2.anInt1445 = 32;
                sprite2.drawSprite(0, 0);
                sprite2.anInt1444 = l5;
                sprite2.anInt1445 = j6;
            }
            if (itemDef.lentItemID != -1)
            {
                int l5 = sprite2.anInt1444;
                int j6 = sprite2.anInt1445;
                sprite2.anInt1444 = 32;
                sprite2.anInt1445 = 32;
                sprite2.drawSprite(0, 0);
                sprite2.anInt1444 = l5;
                sprite2.anInt1445 = j6;
            }
            if (k == 0)
            {
                mruNodes1.removeFromCache(sprite3, i);
            }
            DrawingArea.initDrawingArea(j2, i2, ai1);             //, depthBuffer);
            DrawingArea.setDrawingArea(j3, k2, l2, i3);
            Texture.center_x    = k1;
            Texture.center_y    = l1;
            Texture.lineOffsets = ai;
            Texture.notTextured = true;
            if (itemDef.stackable)
            {
                sprite3.anInt1444 = 33;
            }
            else
            {
                sprite3.anInt1444 = 32;
            }
            sprite3.anInt1445 = j;
            return(sprite3);
        }
Beispiel #2
0
 public void initDrawingArea()
 {
     DrawingArea.initDrawingArea(anInt317, anInt316, anIntArray315);
 }
Beispiel #3
0
 public void method343()
 {
     DrawingArea.initDrawingArea(myHeight, myWidth, myPixels);
 }