// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

import java.util.Random;
import sign.signlink;

public class Class31_Sub3_Sub1_Sub4 extends Class31_Sub3_Sub1
{

    public Class31_Sub3_Sub1_Sub4(boolean flag, String s, Class11 class11, int i)
    {
        aByte1510 = 1;
        aByte1511 = 119;
        aByte1512 = 107;
        aBoolean1513 = true;
        anInt1514 = 709;
        aBoolean1515 = false;
        aByteArrayArray1516 = new byte[256][];
        anIntArray1517 = new int[256];
        anIntArray1518 = new int[256];
        anIntArray1519 = new int[256];
        anIntArray1520 = new int[256];
        anIntArray1521 = new int[256];
        aRandom1523 = new Random();
        aBoolean1524 = false;
        Class31_Sub3_Sub2 class31_sub3_sub2 = new Class31_Sub3_Sub2((byte)114, class11.method204(s + ".dat", null));
        Class31_Sub3_Sub2 class31_sub3_sub2_1 = new Class31_Sub3_Sub2((byte)114, class11.method204("index.dat", null));
        byte byte0 = -1;
        class31_sub3_sub2_1.anInt1440 = class31_sub3_sub2.method424() + 4;
        while(i >= 0) 
            aBoolean1515 = !aBoolean1515;
        int k = class31_sub3_sub2_1.method422();
        if(k > 0)
            class31_sub3_sub2_1.anInt1440 += 3 * (k - 1);
        for(int l = 0; l < 256; l++)
        {
            int j = l;
            anIntArray1519[l] = class31_sub3_sub2_1.method422();
            anIntArray1520[l] = class31_sub3_sub2_1.method422();
            int i1 = anIntArray1517[l] = class31_sub3_sub2_1.method424();
            int j1 = anIntArray1518[l] = class31_sub3_sub2_1.method424();
            int k1 = class31_sub3_sub2_1.method422();
            int l1 = i1 * j1;
            aByteArrayArray1516[l] = new byte[l1];
            if(k1 == 0)
            {
                for(int i2 = 0; i2 < l1; i2++)
                    aByteArrayArray1516[l][i2] = class31_sub3_sub2.method423();

            } else
            if(k1 == 1)
            {
                for(int j2 = 0; j2 < i1; j2++)
                {
                    for(int l2 = 0; l2 < j1; l2++)
                        aByteArrayArray1516[l][j2 + l2 * i1] = class31_sub3_sub2.method423();

                }

            }
            if(j1 > anInt1522 && l < 128)
                anInt1522 = j1;
            anIntArray1519[l] = 1;
            anIntArray1521[l] = i1 + 2;
            int k2 = 0;
            for(int i3 = j1 / 7; i3 < j1; i3++)
                k2 += aByteArrayArray1516[l][i3 * i1];

            if(k2 <= j1 / 7)
            {
                anIntArray1521[l]--;
                anIntArray1519[l] = 0;
            }
            k2 = 0;
            for(int j3 = j1 / 7; j3 < j1; j3++)
                k2 += aByteArrayArray1516[l][(i1 - 1) + j3 * i1];

            if(k2 <= j1 / 7)
                anIntArray1521[l]--;
        }

        if(flag)
        {
            anIntArray1521[32] = anIntArray1521[73];
            return;
        } else
        {
            anIntArray1521[32] = anIntArray1521[105];
            return;
        }
    }

    public void method394(int i, int j, int k, int l, String s)
    {
        method399(s, i, k - method398((byte)107, s), l, -32001);
        if(j != 0)
        {
            for(int i1 = 1; i1 > 0; i1++);
        }
    }

    public void method395(int i, int j, int k, String s, byte byte0)
    {
        method399(s, k, j - method398((byte)107, s) / 2, i, -32001);
        if(byte0 != aByte1511)
            aBoolean1515 = !aBoolean1515;
    }

    public void method396(boolean flag, String s, byte byte0, int i, int j, int k)
    {
        method403(i, s, flag, k - method397(s, aByte1510) / 2, aBoolean1513, j);
        if(byte0 == 9);
    }

    public int method397(String s, byte byte0)
    {
        if(byte0 == 1)
            byte0 = 0;
        else
            anInt1514 = -482;
        if(s == null)
            return 0;
        int i = 0;
        for(int j = 0; j < s.length(); j++)
            if(s.charAt(j) == '@' && j + 4 < s.length() && s.charAt(j + 4) == '@')
                j += 4;
            else
                i += anIntArray1521[s.charAt(j)];

        return i;
    }

    public int method398(byte byte0, String s)
    {
        if(s == null)
            return 0;
        int i = 0;
        if(byte0 != aByte1512)
            return 4;
        for(int j = 0; j < s.length(); j++)
            i += anIntArray1521[s.charAt(j)];

        return i;
    }

    public void method399(String s, int i, int j, int k, int l)
    {
        if(s == null)
            return;
        i -= anInt1522;
        if(l != -32001)
            return;
        for(int i1 = 0; i1 < s.length(); i1++)
        {
            char c = s.charAt(i1);
            if(c != ' ')
                method406(aByteArrayArray1516[c], j + anIntArray1519[c], i + anIntArray1520[c], anIntArray1517[c], anIntArray1518[c], k);
            j += anIntArray1521[c];
        }

    }

    public void method400(String s, int i, int j, int k, int l, int i1)
    {
        if(s == null)
            return;
        i -= method398((byte)107, s) / 2;
        k -= anInt1522;
        for(int j1 = 0; j1 < s.length(); j1++)
        {
            char c = s.charAt(j1);
            if(c != ' ')
                method406(aByteArrayArray1516[c], i + anIntArray1519[c], k + anIntArray1520[c] + (int)(Math.sin((double)j1 / 2D + (double)j / 5D) * 5D), anIntArray1517[c], anIntArray1518[c], l);
            i += anIntArray1521[c];
        }

        if(i1 != 0)
            aBoolean1515 = !aBoolean1515;
    }

    public void method401(String s, int i, int j, int k, byte byte0, int l)
    {
        if(s == null)
            return;
        k -= method398((byte)107, s) / 2;
        if(byte0 == 2)
            byte0 = 0;
        else
            return;
        l -= anInt1522;
        for(int i1 = 0; i1 < s.length(); i1++)
        {
            char c = s.charAt(i1);
            if(c != ' ')
                method406(aByteArrayArray1516[c], k + anIntArray1519[c] + (int)(Math.sin((double)i1 / 5D + (double)i / 5D) * 5D), l + anIntArray1520[c] + (int)(Math.sin((double)i1 / 3D + (double)i / 5D) * 5D), anIntArray1517[c], anIntArray1518[c], j);
            k += anIntArray1521[c];
        }

    }

    public void method402(String s, int i, byte byte0, int j, int k, int l, int i1)
    {
        if(byte0 != 4)
            return;
        if(s == null)
            return;
        double d = 7D - (double)j / 8D;
        if(d < 0.0D)
            d = 0.0D;
        k -= method398((byte)107, s) / 2;
        i -= anInt1522;
        for(int j1 = 0; j1 < s.length(); j1++)
        {
            char c = s.charAt(j1);
            if(c != ' ')
                method406(aByteArrayArray1516[c], k + anIntArray1519[c], i + anIntArray1520[c] + (int)(Math.sin((double)j1 / 1.5D + (double)i1) * d), anIntArray1517[c], anIntArray1518[c], l);
            k += anIntArray1521[c];
        }

    }

    public void method403(int i, String s, boolean flag, int j, boolean flag1, int k)
    {
        aBoolean1524 = false;
        int l = j;
        if(!flag1)
            return;
        if(s == null)
            return;
        k -= anInt1522;
        for(int i1 = 0; i1 < s.length(); i1++)
            if(s.charAt(i1) == '@' && i1 + 4 < s.length() && s.charAt(i1 + 4) == '@')
            {
                int j1 = method405(0, s.substring(i1 + 1, i1 + 4));
                if(j1 != -1)
                    i = j1;
                i1 += 4;
            } else
            {
                char c = s.charAt(i1);
                if(c != ' ')
                {
                    if(flag)
                        method406(aByteArrayArray1516[c], j + anIntArray1519[c] + 1, k + anIntArray1520[c] + 1, anIntArray1517[c], anIntArray1518[c], 0);
                    method406(aByteArrayArray1516[c], j + anIntArray1519[c], k + anIntArray1520[c], anIntArray1517[c], anIntArray1518[c], i);
                }
                j += anIntArray1521[c];
            }

        if(aBoolean1524)
            Class31_Sub3_Sub1.method353(j - l, l, 0, k + (int)((double)anInt1522 * 0.69999999999999996D), 0x800000);
    }

    public void method404(boolean flag, String s, int i, int j, int k, int l, int i1)
    {
        if(s == null)
            return;
        aRandom1523.setSeed(l);
        if(i != 3169)
            return;
        int j1 = 192 + (aRandom1523.nextInt() & 0x1f);
        j -= anInt1522;
        for(int k1 = 0; k1 < s.length(); k1++)
            if(s.charAt(k1) == '@' && k1 + 4 < s.length() && s.charAt(k1 + 4) == '@')
            {
                int l1 = method405(0, s.substring(k1 + 1, k1 + 4));
                if(l1 != -1)
                    i1 = l1;
                k1 += 4;
            } else
            {
                char c = s.charAt(k1);
                if(c != ' ')
                {
                    if(flag)
                        method408(192, j + anIntArray1520[c] + 1, true, 0, k + anIntArray1519[c] + 1, anIntArray1517[c], anIntArray1518[c], aByteArrayArray1516[c]);
                    method408(j1, j + anIntArray1520[c], true, i1, k + anIntArray1519[c], anIntArray1517[c], anIntArray1518[c], aByteArrayArray1516[c]);
                }
                k += anIntArray1521[c];
                if((aRandom1523.nextInt() & 3) == 0)
                    k++;
            }

    }

    public int method405(int i, String s)
    {
        if(i != 0)
        {
            for(int j = 1; j > 0; j++);
        }
        if(s.equals("red"))
            return 0xff0000;
        if(s.equals("gre"))
            return 65280;
        if(s.equals("blu"))
            return 255;
        if(s.equals("yel"))
            return 0xffff00;
        if(s.equals("cya"))
            return 65535;
        if(s.equals("mag"))
            return 0xff00ff;
        if(s.equals("whi"))
            return 0xffffff;
        if(s.equals("bla"))
            return 0;
        if(s.equals("lre"))
            return 0xff9040;
        if(s.equals("dre"))
            return 0x800000;
        if(s.equals("dbl"))
            return 128;
        if(s.equals("or1"))
            return 0xffb000;
        if(s.equals("or2"))
            return 0xff7000;
        if(s.equals("or3"))
            return 0xff3000;
        if(s.equals("gr1"))
            return 0xc0ff00;
        if(s.equals("gr2"))
            return 0x80ff00;
        if(s.equals("gr3"))
            return 0x40ff00;
        if(s.equals("str"))
            aBoolean1524 = true;
        if(s.equals("end"))
            aBoolean1524 = false;
        return -1;
    }

    public void method406(byte abyte0[], int i, int j, int k, int l, int i1)
    {
        int j1 = i + j * Class31_Sub3_Sub1.anInt1412;
        int k1 = Class31_Sub3_Sub1.anInt1412 - k;
        int l1 = 0;
        int i2 = 0;
        if(j < Class31_Sub3_Sub1.anInt1414)
        {
            int j2 = Class31_Sub3_Sub1.anInt1414 - j;
            l -= j2;
            j = Class31_Sub3_Sub1.anInt1414;
            i2 += j2 * k;
            j1 += j2 * Class31_Sub3_Sub1.anInt1412;
        }
        if(j + l >= Class31_Sub3_Sub1.anInt1415)
            l -= ((j + l) - Class31_Sub3_Sub1.anInt1415) + 1;
        if(i < Class31_Sub3_Sub1.anInt1416)
        {
            int k2 = Class31_Sub3_Sub1.anInt1416 - i;
            k -= k2;
            i = Class31_Sub3_Sub1.anInt1416;
            i2 += k2;
            j1 += k2;
            l1 += k2;
            k1 += k2;
        }
        if(i + k >= Class31_Sub3_Sub1.anInt1417)
        {
            int l2 = ((i + k) - Class31_Sub3_Sub1.anInt1417) + 1;
            k -= l2;
            l1 += l2;
            k1 += l2;
        }
        if(k <= 0 || l <= 0)
        {
            return;
        } else
        {
            method407(Class31_Sub3_Sub1.anIntArray1411, abyte0, i1, i2, j1, k, l, k1, l1);
            return;
        }
    }

    public void method407(int ai[], byte abyte0[], int i, int j, int k, int l, int i1, 
            int j1, int k1)
    {
        int l1 = -(l >> 2);
        l = -(l & 3);
        for(int i2 = -i1; i2 < 0; i2++)
        {
            for(int j2 = l1; j2 < 0; j2++)
            {
                if(abyte0[j++] != 0)
                    ai[k++] = i;
                else
                    k++;
                if(abyte0[j++] != 0)
                    ai[k++] = i;
                else
                    k++;
                if(abyte0[j++] != 0)
                    ai[k++] = i;
                else
                    k++;
                if(abyte0[j++] != 0)
                    ai[k++] = i;
                else
                    k++;
            }

            for(int k2 = l; k2 < 0; k2++)
                if(abyte0[j++] != 0)
                    ai[k++] = i;
                else
                    k++;

            k += j1;
            j += k1;
        }

    }

    public void method408(int i, int j, boolean flag, int k, int l, int i1, int j1, 
            byte abyte0[])
    {
        int k1 = l + j * Class31_Sub3_Sub1.anInt1412;
        int l1 = Class31_Sub3_Sub1.anInt1412 - i1;
        int i2 = 0;
        int j2 = 0;
        if(!flag)
        {
            for(int k2 = 1; k2 > 0; k2++);
        }
        if(j < Class31_Sub3_Sub1.anInt1414)
        {
            int l2 = Class31_Sub3_Sub1.anInt1414 - j;
            j1 -= l2;
            j = Class31_Sub3_Sub1.anInt1414;
            j2 += l2 * i1;
            k1 += l2 * Class31_Sub3_Sub1.anInt1412;
        }
        if(j + j1 >= Class31_Sub3_Sub1.anInt1415)
            j1 -= ((j + j1) - Class31_Sub3_Sub1.anInt1415) + 1;
        if(l < Class31_Sub3_Sub1.anInt1416)
        {
            int i3 = Class31_Sub3_Sub1.anInt1416 - l;
            i1 -= i3;
            l = Class31_Sub3_Sub1.anInt1416;
            j2 += i3;
            k1 += i3;
            i2 += i3;
            l1 += i3;
        }
        if(l + i1 >= Class31_Sub3_Sub1.anInt1417)
        {
            int j3 = ((l + i1) - Class31_Sub3_Sub1.anInt1417) + 1;
            i1 -= j3;
            i2 += j3;
            l1 += j3;
        }
        if(i1 <= 0 || j1 <= 0)
        {
            return;
        } else
        {
            method409(k1, j2, j1, k, -2270, i, i1, i2, Class31_Sub3_Sub1.anIntArray1411, l1, abyte0);
            return;
        }
    }

    public void method409(int i, int j, int k, int l, int i1, int j1, int k1, 
            int l1, int ai[], int i2, byte abyte0[])
    {
        l = ((l & 0xff00ff) * j1 & 0xff00ff00) + ((l & 0xff00) * j1 & 0xff0000) >> 8;
        j1 = 256 - j1;
        if(i1 != -2270)
            return;
        for(int j2 = -k; j2 < 0; j2++)
        {
            for(int k2 = -k1; k2 < 0; k2++)
                if(abyte0[j++] != 0)
                {
                    int l2 = ai[i];
                    ai[i++] = (((l2 & 0xff00ff) * j1 & 0xff00ff00) + ((l2 & 0xff00) * j1 & 0xff0000) >> 8) + l;
                } else
                {
                    i++;
                }

            i += i2;
            j += l1;
        }

    }

    public byte aByte1510;
    public byte aByte1511;
    public byte aByte1512;
    public boolean aBoolean1513;
    public int anInt1514;
    public boolean aBoolean1515;
    public byte aByteArrayArray1516[][];
    public int anIntArray1517[];
    public int anIntArray1518[];
    public int anIntArray1519[];
    public int anIntArray1520[];
    public int anIntArray1521[];
    public int anInt1522;
    public Random aRandom1523;
    public boolean aBoolean1524;
}
