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

📄 samkokgame.java

📁 俄罗斯制作的横版动作游戏
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
// 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 
// Source File Name:   SamkokGame.java

import com.nokia.mid.ui.FullCanvas;
import java.util.Random;
import javax.microedition.lcdui.*;
import javax.microedition.media.Manager;
import javax.microedition.media.Player;
import javax.microedition.midlet.MIDlet;

public class SamkokGame extends FullCanvas
    implements Runnable
{

    private Random rm;
    private TitleGame titleGame;
    private SamkokMID parent;
    private boolean running;
    private boolean gameOver;
    private long gameOverTime;
    private int menuSelect;
    private int curLevel;
    private int mapNumber;
    private byte gameMode;
    private int startLevel;
    private int levelFinish;
    private Font fontS;
    private Font fontL;
    private static final byte IN_GAME = 10;
    private static final byte START_GAME = 11;
    private static final byte PAUSE_MENU = 80;
    private static final byte CONFIRM_MM = 81;
    private static final byte CONFIRM_EX = 82;
    private static final byte GAME_OVER = 90;
    private static final short TIMER = 50;
    private int playerX;
    private int playerY;
    private int playerAddX;
    private int playerAddY;
    private int nextAddX;
    private int curMapX;
    private int sBlockX;
    private int eBlockX;
    private int oldCurMapX;
    private short playerMode;
    private short playerFrameStep;
    private byte weaponMode;
    private byte maxWeaponMode;
    private byte fightFrameMode;
    private byte playerNextFight;
    private byte playerAttack;
    private byte showItemName;
    private byte itemNameNumber;
    private long gameTime;
    private long fightTime;
    private long pressTime;
    private boolean playerJump;
    private boolean playerFight;
    private boolean playerTempJump;
    private byte playerLifeOn;
    private byte playerLife;
    private byte playerFightCount;
    private byte playerType;
    private byte playerNextMode;
    private byte specialCombo;
    private byte maifaHP;
    private byte bossStageFinish;
    private short specialType[];
    private byte playerHP;
    private byte playerMaxHP;
    private byte playerWalkStep;
    private byte playerMP[];
    private byte playerMaxMP;
    private byte frameStep;
    private byte playerDie;
    private short playerShotX[];
    private short playerShotY[];
    private byte playerShotT[];
    private short monsterShotX[];
    private short monsterShotY[];
    private short effectX[];
    private short effectY[];
    private byte effectT[];
    private byte characterOrder[];
    private short recX;
    private short recY;
    private short recW;
    private short recH;
    private short recAttack;
    private boolean playerAtt;
    private boolean bossStage;
    private byte startStage;
    private short bossHP;
    private short bossMaxHP;
    private byte bossType;
    private byte bossLifeOn;
    private boolean playExit;
    private short playerFrame[][] = {
        {
            1, 0
        }, {
            1, 2, 1, 3, 0
        }, {
            6, 6, 6, 6, 6, 6, 6, 6, 0
        }, {
            0
        }, {
            124, 15, 15, 25, 0
        }, {
            25, 114, 114, 124, 0
        }, {
            164, 164, 164, 55, 55, 65, 0
        }, {
            65, 154, 154, 164, 0
        }, {
            164, 55, 55, 55, 65, 65, 65, 0
        }, {
            144, 144, 144, 144, 35, 35, 45, 0
        }, {
            45, 134, 134, 144, 0
        }, {
            45, 144, 144, 35, 134, 1035, 1134, 35, 134, 1035, 
            1134, 144, 144, 144, 144, 0
        }
    };
    private String itemName[] = {
        "??????", "????", "???", "???????????", "???????", "???????", "?????", "???????", "??????????", "?????????????", 
        "?????????????"
    };
    private String stageName;
    private byte itemAddY[] = {
        -1, -1, -1, 1, 1, 1, 0
    };
    private static final byte PL_STAND = 0;
    private static final byte PL_WALK = 1;
    private static final byte PL_STUN = 2;
    private static final byte PL_FGH = 4;
    private static final byte HAND = 0;
    private static final byte KABEE = 16;
    private static final byte TUAN = 48;
    private static final byte NGOA = 32;
    private byte skyFrame[][] = {
        {
            9, 5, 8, 3, 2, 1, 7, 7
        }, {
            9, 6, 8, 3, 2, 1, 7, 7
        }, {
            9, 5, 8, 4, 2, 1, 7, 7
        }, {
            9, 6, 8, 3, 2, 1, 7, 7
        }
    };
    private byte BOT_TEST;
    private byte BOT_POWER;
    private SecondAnimation saTileMap;
    private SecondAnimation saTileMapBG;
    private SecondAnimation saPlayer;
    private SecondAnimation saWeaponF;
    private SecondAnimation saWeaponB;
    private SecondAnimation saEffect;
    private SecondAnimation saItem;
    private SecondAnimation saFace1;
    private SecondAnimation saShot;
    private SecondAnimation saMBoss[];
    private SecondAnimation saBoss[];
    public SecondAnimation saEnermy;
    private SecondAnimation thaiFontB;
    private SecondAnimation thaiFontW;
    private Image boxItem;
    private Image imgPowerLb;
    private Image imgFlush;
    private Graphics gr;
    private Image imgSkyBG;
    private byte mapData[];
    private byte mapCode[][];
    private short monsterX[];
    private short monsterY[];
    private short monsterTempX[];
    private short monsterTempY[];
    private byte monsterT[];
    private byte monsterTempT[];
    private byte monsterHP[];
    private byte monsterM[];
    private byte monsterAddX[];
    private byte monsterAddY[];
    private byte monsterF[];
    private byte monsterS[];
    private short mapSizeX;
    private short mapSizeY;
    private byte maxMonster;
    private SecondMonsterData monsterData;
    public byte beforeComing;
    public boolean bcon;
    private boolean addmon;
    private byte nextMap[] = {
        11, 15, 21, 25, 31, 32, 35, 41, 42, 45, 
        50
    };
    private byte mapSound[] = {
        2, 3, 2, 4, 3, 3, 4, 3, 4, 5
    };
    private SecondLoadEncodeData encode;
    private static byte music[] = null;
    private byte data[];
    private Player gameMusic;
    private int songNumber;
    private boolean haveDraw;
    private static final byte ADD_FONT[] = {
        4, 3, 5, 7, 6, 8, 8, 3, 4, 4, 
        7, 6, 3, 4, 3, 5, 6, 6, 6, 6, 
        6, 6, 6, 6, 6, 6, 3, 3, 5, 6, 
        5, 5, 8, 8, 6, 6, 7, 5, 5, 6, 
        7, 4, 4, 6, 5, 8, 7, 7, 6, 7, 
        6, 6, 8, 7, 6, 8, 6, 6, 7, 4, 
        5, 4, 6, 5, 3, 6, 6, 5, 6, 6, 
        5, 6, 6, 2, 3, 6, 2, 9, 6, 6, 
        6, 6, 4, 6, 5, 6, 6, 8, 6, 6, 
        6, 5, 3, 5, 6, 4, 0, 0, 0, 0, 
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
        0, 0, 0, 0, 0, 0, 0, 0, 5, 6, 
        7, 7, 6, 6, 8, 5, 5, 7, 7, 8, 
        9, 8, 6, 6, 5, 8, 9, 9, 6, 6, 
        6, 6, 6, 7, 6, 6, 6, 6, 7, 7, 
        6, 6, 6, 5, 6, 6, 6, 5, 6, 7, 
        6, 7, 8, 6, 6, 5, 4, 0, 5, 8, 
        0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 
        4, 6, 3, 6, 5, 6, 6, 5, 5, 0, 
        0, 0, 0, 0, 0, 0, 0, 7, 6, 6, 
        7, 7, 6, 6, 6, 8, 7, 7, 4, 4, 
        4, 4, 4, 4
    };

    public SamkokGame(SamkokMID parent, TitleGame title)
    {
        titleGame = null;
        this.parent = null;
        running = true;
        gameOver = false;
        fontS = Font.getFont(0, 0, 8);
        fontL = Font.getFont(0, 1, 16);
        specialType = new short[3];
        playerMP = new byte[3];
        playerShotX = new short[5];
        playerShotY = new short[5];
        playerShotT = new byte[5];
        monsterShotX = new short[5];
        monsterShotY = new short[5];
        effectX = new short[5];
        effectY = new short[5];
        effectT = new byte[5];
        characterOrder = new byte[20];
        stageName = null;
        BOT_TEST = 6;
        BOT_POWER = 20;
        saMBoss = new SecondAnimation[2];
        saBoss = new SecondAnimation[3];
        addmon = true;
        data = null;
        this.parent = parent;
        titleGame = title;
        titleGame = null;
        thaiFontW = new SecondAnimation("/data/fw", 32, 7);
        thaiFontB = new SecondAnimation("/data/fb", 32, 7);
        rm = new Random();
        encode = new SecondLoadEncodeData();
        data = encode.LoadToByteArray("/data/gm");
        saTileMap = new SecondAnimation(data, 9033, 2728, 36, 1);
        saTileMapBG = new SecondAnimation(data, 8258, 775, 9, 1);
        saWeaponF = new SecondAnimation(data, 516, 377, 6, 1);
        saWeaponB = new SecondAnimation(data, 0, 516, 6, 1);
        saEffect = new SecondAnimation(data, 893, 1149, 9, 1);
        saEnermy = new SecondAnimation(data, 2042, 3694, 12, 2);
        saFace1 = new SecondAnimation(data, 5736, 1206, 7, 1);
        saItem = new SecondAnimation(data, 6942, 684, 12, 1);
        saShot = new SecondAnimation(data, 7865, 393, 5, 1);
        imgPowerLb = Image.createImage(data, 7626, 239);
        try
        {
            boxItem = Image.createImage("/data/bi");
        }
        catch(Exception e) { }
        data = null;
        data = encode.LoadToByteArray("/data/mbs");
        saMBoss[0] = new SecondAnimation(data, 2, 1029, 5, 1);
        saMBoss[1] = new SecondAnimation(data, 1031, 1123, 5, 1);
        data = null;
        data = encode.LoadToByteArray("/data/bs");
        saBoss[1] = new SecondAnimation(data, 3, 1417, 8, 1);
        saBoss[0] = new SecondAnimation(data, 1420, 1600, 8, 1);
        saBoss[2] = new SecondAnimation(data, 3020, 1729, 8, 1);
        data = null;
        encode = null;
        imgSkyBG = Image.createImage(64, 128);
        gr = imgSkyBG.getGraphics();
        for(int y = 0; y < 8; y++)
        {
            for(int x = 0; x < 4; x++)
                saTileMapBG.drawImage(gr, x << 4, y << 4, skyFrame[x][y], false);

        }

        saTileMapBG = null;
        gr = null;
        songNumber = -1;
    }

    private void loadSound(int track, boolean play)
    {
        if(track == songNumber || track < 0)
            return;
        try
        {
            if(gameMusic != null)
                gameMusic.close();
            java.io.InputStream in = getClass().getResourceAsStream("/data/m" + track);
            gameMusic = Manager.createPlayer(in, "audio/midi");
            gameMusic.setLoopCount(-1);
            in = null;
            if(parent.playSound > 0 && play)
                gameMusic.start();
        }
        catch(Exception ioe) { }
        songNumber = track;
        addmon = true;
    }

    public void newGame(int type, boolean newer)
    {
        gameOver = false;
        if(newer)
        {
            weaponMode = 0;
            playerType = (byte)type;
            playerLife = 3;
            maxWeaponMode = 0;
            curLevel = 0;
        }
        maifaHP = 0;
        playerAddHP();
        if(playerType == 3)
            playerWalkStep = 4;
        else
            playerWalkStep = 3;
        encode = new SecondLoadEncodeData();
        data = encode.LoadToByteArray("/data/pl");
        switch(playerType)
        {
        case 1: // '\001'
            saPlayer = new SecondAnimation(data, 16, 827, 6, 1);
            break;

        case 2: // '\002'
            saPlayer = new SecondAnimation(data, 843, 955, 6, 1);
            break;

        case 3: // '\003'
            saPlayer = new SecondAnimation(data, 1798, 854, 6, 1);
            break;
        }
        encode = null;
        data = null;
        initLevel(curLevel);
    }

    public void setCurrent(int type, int weapon, int maxweapon, int life, int level)
    {
        playerType = (byte)type;
        weaponMode = (byte)weapon;
        maxWeaponMode = (byte)maxweapon;
        playerLife = (byte)life;
        curLevel = level;
    }

    private void playerAddHP()
    {
        if(playerType == 2)
            playerAttack = 3;
        else
            playerAttack = 1;
        if(playerType == 1)
        {
            playerMaxHP = playerHP = 45;
            playerMaxMP = 20;
            playerMP[0] = 20;
            playerMP[1] = 20;
            playerMP[2] = 20;
        } else
        {
            playerMaxHP = playerHP = 50;
            playerMaxMP = 15;
            playerMP[0] = 15;
            playerMP[1] = 15;
            playerMP[2] = 15;
        }
    }

    private void restartGame(int plx, int ply, boolean restart)
    {

⌨️ 快捷键说明

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