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

📄 main.java

📁 超级玛丽的源代码
💻 JAVA
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   Main.java

import com.nokia.mid.ui.*;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.util.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
import javax.microedition.rms.RecordStore;

public class Main extends MIDlet
{

    public Main()
    {
        cache = new Hashtable();
        timer = new Timer();
        display = Display.getDisplay(this);
        currentDA = null;
        random = new Random();
    }

    protected void startApp()
    {
        DeviceControl.setLights(0, 100);
        checkDemoState();
        SplashScreenFC splashscreenfc = new SplashScreenFC(this);
        int i = splashscreenfc.getWidth();
        int j = splashscreenfc.getHeight();
        if(i < 96 || j < 65)
        {
            MessageF messagef = new MessageF(this, "Error", "Display resolution is too small (" + i + "x" + j + "). Minimum required 96x65.", null);
            setCurrentDA(messagef);
        } else
        {
            setCurrentDA(splashscreenfc);
        }
    }

    protected void pauseApp()
    {
    }

    protected void destroyApp(boolean flag)
    {
        currentDA = null;
        timer.cancel();
    }

    public void destroy()
    {
        destroyApp(false);
        notifyDestroyed();
    }

    public Image loadImage(String s)
    {
        try
        {
            return Image.createImage("/gfx/" + s);
        }
        catch(Exception exception)
        {
            return null;
        }
    }

    public byte[] loadResource(String s)
    {
        InputStream inputstream = getClass().getResourceAsStream("/" + s);
        ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
        byte abyte0[] = new byte[1024];
        try
        {
            int i;
            while((i = inputstream.read(abyte0)) != -1) 
                bytearrayoutputstream.write(abyte0, 0, i);
            return bytearrayoutputstream.toByteArray();
        }
        catch(Exception exception)
        {
            return null;
        }
    }

    public void setCurrentDA(Displayable displayable)
    {
        display.setCurrent(displayable);
        currentDA = displayable;
    }

    public int randomInt(int i, int j)
    {
        int k = j / 31;
        int l = 0;
        do
        {
            int i1 = 0;
            for(int j1 = 0; j1 < k + 1; j1++)
                i1 += random.nextInt() & 0x1f;

            if(i1 >= i && i1 <= j)
                return i1;
        } while(++l <= 1000);
        return i;
    }

    public boolean inside(int i, int j, int k, int l, int i1, int j1)
    {
        return i >= k && i <= i1 && j >= l && j <= j1;
    }

    public void saveFile(String s, byte abyte0[])
    {
        RecordStore recordstore;
        deleteFile(s);
        recordstore = null;
        recordstore = RecordStore.openRecordStore(s, true);
        recordstore.addRecord(abyte0, 0, abyte0.length);
        try
        {
            recordstore.closeRecordStore();
        }
        catch(Exception exception4) { }
        break MISSING_BLOCK_LABEL_71;
        Exception exception;
        exception;
        try
        {
            recordstore.closeRecordStore();
        }
        catch(Exception exception2) { }
        try
        {
            recordstore.closeRecordStore();
        }
        catch(Exception exception5) { }
        break MISSING_BLOCK_LABEL_80;
        Exception exception3;
        exception3;
        try
        {
            recordstore.closeRecordStore();
        }
        catch(Exception exception6) { }
        throw exception3;
        try
        {
            recordstore.closeRecordStore();
        }
        catch(Exception exception1) { }
    }

    public void deleteFile(String s)
    {
        try
        {
            RecordStore.deleteRecordStore(s);
        }
        catch(Exception exception) { }
    }

    public byte[] loadFile(String s)
    {
        RecordStore recordstore = null;
        try
        {
            recordstore = RecordStore.openRecordStore(s, false);
            byte abyte0[] = recordstore.getRecord(1);
        }
        catch(Exception exception) { }
        try
        {
            recordstore.closeRecordStore();
        }
        catch(Exception exception1) { }
        byte abyte1[] = null;
        try
        {
            recordstore.closeRecordStore();
        }
        catch(Exception exception2) { }
        return abyte1;
    }

    private void checkDemoState()
    {
        demo = true;
        demo = false;
    }

    public void paintCenter(Graphics g, Image image)
    {
        int i = (g.getClipWidth() - 96) / 2;
        int j = (g.getClipHeight() - 65) / 2;
        g.translate(i, j);
        g.setColor(0, 0, 0);
        g.drawRect(-1, -1, 97, 66);
        Graphics g1 = g;
        Graphics g2 = g;
        g.drawImage(image, 0, 0, 20);
        g.translate(-i, -j);
    }

    public Vector getLines(String s)
    {
        Vector vector = new Vector();
        String s1 = "";
        int i = s.length();
        for(int j = 0; j < i; j++)
        {
            char c = s.charAt(j);
            if(c == '\n')
            {
                s1 = s1.trim();
                if(!s1.equals(""))
                    vector.addElement(s1);
                s1 = "";
            } else
            if(c != '\r')
                s1 = s1 + c;
        }

        s1 = s1.trim();
        if(!s1.equals(""))
            vector.addElement(s1);
        return vector;
    }

    public Image flipHorizontal(Image image)
    {
        Image image1 = DirectUtils.createImage(image.getWidth(), image.getHeight(), 0);
        Graphics g = image1.getGraphics();
        DirectGraphics directgraphics = DirectUtils.getDirectGraphics(g);
        Graphics g1 = g;
        Graphics g2 = g;
        directgraphics.drawImage(image, 0, 0, 20, 8192);
        return image1;
    }

    public Image extractFrame(Image image, int i, int j, int k)
    {
        Image image1 = DirectUtils.createImage(i, j, 0);
        Graphics g = image1.getGraphics();
        Graphics g1 = g;
        Graphics g2 = g;
        g.drawImage(image, (-i - 1) * k, 0, 20);
        return image1;
    }

    public Vector getTokens(String s)
    {
        Vector vector = new Vector();
        int i = 0;
        do
        {
            int j = s.indexOf(" ", i);
            if(j == -1)
                j = s.length();
            String s1 = s.substring(i, j);
            vector.addElement(s1);
            if(j != s.length())
                i = j + 1;
            else
                return vector;
        } while(true);
    }

    public Hashtable cache;
    public Timer timer;
    public Display display;
    public Displayable currentDA;
    private Random random;
    public boolean demo;
}

⌨️ 快捷键说明

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