⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 imageloader.java

📁 一个很不错的炸弹人J2ME游戏源码.画面及音效质量都不错,可供新手学习使用.
💻 JAVA
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 

package bombjack;

import java.io.DataInputStream;
import javax.microedition.lcdui.Image;
import javax.microedition.midlet.MIDlet;

// Referenced classes of package bombjack:
//            BombJackScreen

public class ImageLoader
{

    public static int FRAMERATE;
    public static final int BOMB = 0;
    public static final int ENEMYROBOT = 1;
    public static final int ENEMYBIRD = 2;
    public static final int ENEMYUFO = 3;
    public static final int ENEMYAPPEAR = 4;
    public static final int ENEMYBALL1 = 5;
    public static final int ENEMYBALL2 = 6;
    public static final int ENEMYHAT = 7;
    public static final int ENEMYANTENNA = 8;
    public static final int PLAYER = 9;
    public static final int SCORES = 10;
    public static final int SMILEY = 11;
    public static final int STATUS = 12;
    public static final int EXTRAS = 13;
    public static final int LOGO = 14;
    public static final int EEMO = 15;
    public static final int ELITE = 16;
    private static final int levelmap[] = {
        0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 
        10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 
        20, 6, 3, 12, 14, 17, 7, 16, 10, 9, 
        5, 2, 13, 15, 9, 8, 23, 16, 5, 4, 
        7, 17, 6, 3, 9, 2, 12, 8, 18, 19, 
        10, 15, 20, 13, 4, 0, 16, 5, 7, 9, 
        17, 6, 3, 2
    };
    public static Image images[];
    private static byte pfdata[][];
    private static byte bombdata[][];
    private static short enemydata[][];
    private static int levelLoaded = -1;
    public static final byte HORIZONTAL = 1;
    public static final byte HORIZONTAL_BIG = 2;
    public static final byte VERTICAL_TN = 3;
    public static final byte VERTICAL_TL = 4;
    public static final byte VERTICAL_TR = 5;
    public static final byte VERTICAL_TB = 6;
    public static final byte VERTICAL_BN = 10;
    public static final byte VERTICAL_BL = 20;
    public static final byte VERTICAL_BR = 30;
    public static final byte VERTICAL_BB = 40;

    public ImageLoader()
    {
    }

    public static Image getImage(int i)
    {
        return images[i];
    }

    public static void init()
    {
        try
        {
            images = new Image[17];
            images[0] = Image.createImage("/v600/bomb.png");
            images[1] = Image.createImage("/v600/EnemyRobot.png");
            images[2] = Image.createImage("/v600/EnemyBird.png");
            images[3] = Image.createImage("/v600/EnemyUfo.png");
            images[4] = Image.createImage("/v600/EnemyAppear.png");
            images[5] = Image.createImage("/v600/EnemyBall1.png");
            images[6] = Image.createImage("/v600/EnemyBall2.png");
            images[7] = Image.createImage("/v600/EnemyHat.png");
            images[8] = Image.createImage("/v600/EnemyAntenna.png");
            images[9] = Image.createImage("/v600/jack.png");
            images[10] = Image.createImage("/v600/scores.png");
            images[11] = Image.createImage("/v600/smiley.png");
            images[12] = Image.createImage("/v600/status.png");
            images[13] = Image.createImage("/v600/extras.png");
            images[14] = Image.createImage("/v600/logo.png");
            images[15] = Image.createImage("/v600/eemo.png");
            images[16] = Image.createImage("/v600/elite.png");
        }
        catch(Exception exception)
        {
            exception.printStackTrace();
        }
    }

    public static byte[][] getPlatformData(int i)
    {
        if(i > 63)
            i -= 32;
        if(levelLoaded != levelmap[i])
            loadLevel(levelmap[i]);
        return pfdata;
    }

    public static byte[][] getBombData(int i)
    {
        if(i > 63)
            i -= 32;
        if(levelLoaded != levelmap[i])
            loadLevel(levelmap[i]);
        return bombdata;
    }

    public static short[][] getEnemyData(int i)
    {
        if(i > 63)
            i -= 32;
        if(levelLoaded != levelmap[i])
            loadLevel(levelmap[i]);
        return enemydata;
    }

    private static final void loadLevel(int i)
    {
        if(levelLoaded != i)
            try
            {
                pfdata = (byte[][])null;
                bombdata = (byte[][])null;
                enemydata = (short[][])null;
                System.gc();
                DataInputStream datainputstream = new DataInputStream(BombJackScreen.parent.getClass().getResourceAsStream("/levels.dat"));
                int j = 0;
                for(int k = 0; k < 21; k++)
                    if(k == i)
                        j = datainputstream.readInt();
                    else
                        datainputstream.readInt();

                datainputstream.skip(j);
                byte byte0 = datainputstream.readByte();
                pfdata = new byte[byte0][4];
                for(int l = 0; l < pfdata.length; l++)
                {
                    pfdata[l][0] = datainputstream.readByte();
                    pfdata[l][1] = datainputstream.readByte();
                    pfdata[l][2] = datainputstream.readByte();
                    pfdata[l][3] = datainputstream.readByte();
                }

                byte0 = datainputstream.readByte();
                bombdata = new byte[byte0][2];
                for(int i1 = 0; i1 < bombdata.length; i1++)
                {
                    bombdata[i1][0] = datainputstream.readByte();
                    bombdata[i1][1] = datainputstream.readByte();
                }

                byte0 = datainputstream.readByte();
                enemydata = new short[byte0][];
                for(int j1 = 0; j1 < enemydata.length; j1++)
                {
                    short word0 = datainputstream.readShort();
                    if(word0 == 1)
                    {
                        enemydata[j1] = new short[7];
                        enemydata[j1][0] = word0;
                    } else
                    {
                        enemydata[j1] = new short[3];
                        enemydata[j1][0] = word0;
                    }
                    for(int k1 = 1; k1 < enemydata[j1].length; k1++)
                        enemydata[j1][k1] = datainputstream.readShort();

                }

                datainputstream.close();
                levelLoaded = i;
                datainputstream = null;
                System.gc();
            }
            catch(Exception exception)
            {
                exception.printStackTrace();
            }
    }

    public static final String[] loadText(String s)
    {
        String as[];
        DataInputStream datainputstream = new DataInputStream(BombJackScreen.parent.getClass().getResourceAsStream(s));
        byte abyte0[] = new byte[1024];
        int i = datainputstream.read(abyte0);
        datainputstream.close();
        datainputstream = null;
        int j = 0;
        for(int k = 0; k < i; k++)
            if(abyte0[k] == 10)
                j++;

        as = new String[j];
        int l = 0;
        j = 0;
        for(int i1 = 0; i1 < i; i1++)
        {
            if(abyte0[i1] != 10)
                continue;
            as[l] = new String(abyte0, j, i1 - j);
            if(as[l].equals("00[VER]"))
                as[l] = "11Version: " + BombJackScreen.parent.getAppProperty("MIDlet-Version");
            l++;
            j = i1 + 1;
        }

        abyte0 = null;
        System.gc();
        return as;
        Exception exception;
        exception;
        exception.printStackTrace();
        return null;
    }

    public static final byte[] loadData(String s, int i)
    {
        byte abyte0[];
        DataInputStream datainputstream = new DataInputStream(BombJackScreen.parent.getClass().getResourceAsStream(s));
        abyte0 = new byte[i];
        for(int j = 0; (j += datainputstream.read(abyte0, j, i - j)) != i;);
        datainputstream.close();
        datainputstream = null;
        return abyte0;
        Exception exception;
        exception;
        exception.printStackTrace();
        return null;
    }

    static 
    {
        FRAMERATE = BombJackScreen.FRAMERATE;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -