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

📄 game.java.bak

📁 j2me游戏Global星球文明,是国外的游戏,45度视角.
💻 BAK
📖 第 1 页 / 共 3 页
字号:
     while(l <= 3){
     	int k;
        byte byte1;
        byte byte0 = -3;
        byte1 = 3;
        if(l == -3 || l == 3)
        {
            byte0 = -2;
            byte1 = 2;
        }
        k = byte0;
          //goto _L2
        while(k <= byte1){
        	if((k == 0) & (l == 0))
                continue; /* Loop/switch isn't completed */
            byte byte2;
            int i1;
            int j1;
            byte2 = gw.lv.map[j + l][i + k];
            i1 = gw.lv.resources[j + l][i + k];
            j1 = i1 >> 6 & 3;
            i1 &= 0x3f;
            if((byte2 == 42 || byte2 == 43) && j1 == 0 && i1 > 0)
                return (j + l << 8) + (i + k);
            continue; /* Loop/switch isn't completed */
            //Exception exception;
            //exception;
            k++;
        }
   _L4:
        
   _L2:
        //if(k <= byte1) goto _L4; else goto _L3
   _L3:
        l++;
     }
       //goto _L1
_L6:
     
_L1:
     //if(l <= 3) goto _L6; else goto _L5
_L5:
     return 0;
 }

 public void gameOver()
 {
     gameover = true;
     gw.gs.newGame = true;
     gw.gs.hassave = false;
     gw.gs.localhiscores = false;
     gw.gs.hiscoresFromMenu = false;
     gw.gs.addscores = true;
     if(byUragan)
     {
         Strings _tmp = gw.st;
         Strings _tmp1 = gw.st;
         gw.gs.beginSplash(gw.st.get("Game Over"), Strings.gameover[gw.st.locint] + " " + Strings.gameoveruragan[gw.st.locint]);
     } else
     {
         Strings _tmp2 = gw.st;
         Strings _tmp3 = gw.st;
         gw.gs.beginSplash(gw.st.get("Game Over"), Strings.gameover[gw.st.locint] + " " + Strings.gameoverloc[gw.st.locint][gw.gs.country]);
     }
 }

 public void gameWin()
 {
     gameover = true;
     gw.gs.newGame = true;
     gw.gs.hassave = false;
     gw.gs.hiscoresFromMenu = false;
     if(mission < 11)
     {
         Strings _tmp = gw.st;
         gw.gs.beginSplash(gw.st.get("Congratulations!"), Strings.win[gw.st.locint]);
     } else
     {
         Strings _tmp1 = gw.st;
         gw.gs.beginSplash(gw.st.get("Congratulations!"), Strings.winchapter[gw.st.locint]);
         gw.gs.country++;
         if(gw.gs.country > 2)
             gw.gs.country = 0;
     }
 }

 public void hassave()
 {
     try
     {
         rStore = RecordStore.openRecordStore("globalw", false);
         gw.gs.hassave = true;
         rStore.closeRecordStore();
     }
     catch(Exception exception)
     {
         gw.gs.hassave = false;
     }
 }

 public void initOptions()
 {
     chapter = 1;
     mission = 0;
     gw.gs.days = 1;
     gw.gt.daycnt = 0;
     gw.gs.cursori = gw.gs.castlei;
     gw.gs.cursorj = gw.gs.castlej;
     gw.gs.uragan = false;
     gw.gs.uraganvisible = false;
 }

 public boolean movePeople(int i)
 {
     boolean flag = false;
     short word0 = people[i][0];
     short word1 = people[i][1];
     if(people[i][7] != 4)
     {
         if(word0 % 22 == 0 && word1 % 22 == 0)
             flag = swapPeople(i);
         switch(people[i][7])
         {
         case 0: // '\0'
             people[i][1] += 2;
             break;

         case 1: // '\001'
             people[i][0] += 2;
             break;

         case 2: // '\002'
             people[i][1] -= 2;
             break;

         case 3: // '\003'
             people[i][0] -= 2;
             break;
         }
     }
     people[i][10] = (short)(people[i][0] / 22);
     people[i][11] = (short)(people[i][1] / 22);
     return flag;
 }

 public void newBuild()
 {
     if(buildsNum < 120)
     {
         objects[buildsNum][0] = (byte)gw.gs.cursori;
         objects[buildsNum][1] = (byte)gw.gs.cursorj;
         objects[buildsNum][2] = (byte)gw.gs.buildNum;
         objects[buildsNum][3] = 0;
         objects[buildsNum][4] = 0;
         gw.lv.flags[gw.gs.cursorj][gw.gs.cursori] |= 4;
         objects[buildsNum][5] = 0;
         objects[buildsNum][6] = 0;
         objects[buildsNum][7] = 0;
         buildsNum++;
         gw.gm.scores += 10;
     }
 }

 public void newPeople(int i, int j, int k, int l)
 {
     if(peopleNum < 240)
     {
         people[peopleNum][0] = (short)(gw.gs.castlei * 22);
         people[peopleNum][1] = (short)(gw.gs.castlej * 22);
         people[peopleNum][2] = 0;
         people[peopleNum][5] = (short)j;
         people[peopleNum][6] = (short)k;
         people[peopleNum][8] = (short)i;
         if(i == 80)
             people[peopleNum][9] = 0;
         else
             people[peopleNum][9] = 2;
         people[peopleNum][3] = (short)l;
         people[peopleNum][4] = 0;
         people[peopleNum][7] = 0;
         people[peopleNum][10] = 0;
         people[peopleNum][11] = 0;
         peopleNum++;
         stock[15] = (short)peopleNum;
     }
 }

 public void peopletoxy(int i, int j, int k)
 {
     people[i][5] = (short)(j * 22);
     people[i][6] = (short)(k * 22);
 }

 public void restore()
 {
     try
     {
         rStore = RecordStore.openRecordStore("globalw", true);
         if(rStore.getNumRecords() > 0)
         {
             RecordEnumeration recordenumeration = rStore.enumerateRecords(null, null, true);
             ByteArrayInputStream bytearrayinputstream = new ByteArrayInputStream(recordenumeration.nextRecord());
             DataInputStream datainputstream = new DataInputStream(bytearrayinputstream);
             gw.gs.country = datainputstream.readByte();
             chapter = datainputstream.readInt();
             mission = datainputstream.readInt();
             for(int i = 0; i < 64; i++)
             {
                 for(int j = 0; j < 64; j++)
                 {
                     gw.lv.map[i][j] = datainputstream.readByte();
                     gw.lv.flags[i][j] = datainputstream.readByte();
                     gw.lv.resources[i][j] = datainputstream.readByte();
                 }

             }

             for(int k = 0; k < 64; k++)
             {
                 gw.lv.barhany[k] = datainputstream.readByte();
                 gw.lv.ljod[k] = datainputstream.readByte();
                 gw.lv.bereg[k] = datainputstream.readByte();
             }

             buildsNum = datainputstream.readShort();
             for(int l = 0; l < buildsNum; l++)
             {
                 for(int i1 = 0; i1 < 8; i1++)
                     objects[l][i1] = datainputstream.readByte();

             }

             peopleNum = datainputstream.readShort();
             for(int j1 = 0; j1 < peopleNum; j1++)
             {
                 for(int k1 = 0; k1 < 12; k1++)
                     people[j1][k1] = datainputstream.readShort();

             }

             for(int l1 = 0; l1 < stock.length; l1++)
                 stock[l1] = datainputstream.readShort();

             gw.gs.days = datainputstream.readInt();
             gw.gt.daycnt = datainputstream.readByte();
             gw.gs.cursori = datainputstream.readByte();
             gw.gs.cursorj = datainputstream.readByte();
             gw.gs.uragan = datainputstream.readBoolean();
             gw.gs.uraganvisible = datainputstream.readBoolean();
             gw.gs.uraganx = datainputstream.readInt();
             gw.gs.uragany = datainputstream.readInt();
             gw.gs.uraganvx = datainputstream.readInt();
             gw.gs.uraganvy = datainputstream.readInt();
             gw.gm.scores = datainputstream.readInt();
             gw.gs.earthQuake = datainputstream.readBoolean();
             gw.gs.earthQuakePeriod = datainputstream.readInt();
             gw.gs.deltaScrX = 4;
             gw.gs.deltaScrY = 4;
         }
         rStore.closeRecordStore();
     }
     catch(Exception exception) { }
 }

 public void restoreOpt()
 {
     try
     {
         rStore = RecordStore.openRecordStore("globalwopt", false);
         if(rStore.getNumRecords() > 0)
         {
             RecordEnumeration recordenumeration = rStore.enumerateRecords(null, null, true);
             ByteArrayInputStream bytearrayinputstream = new ByteArrayInputStream(recordenumeration.nextRecord());
             DataInputStream datainputstream = new DataInputStream(bytearrayinputstream);
             userid = datainputstream.readInt();
             gw.st.locint = datainputstream.readInt();
             if(gw.st.locint == 1)
                 gw.st.locale = "ru";
             else
                 gw.st.locale = "en";
             gw.gs.sound = datainputstream.readBoolean();
             gw.gs.vibration = datainputstream.readBoolean();
         }
         rStore.closeRecordStore();
     }
     catch(Exception exception)
     {
         userid = gw.gs.rnd.nextInt();
         gw.gs.sound = true;
         gw.gs.vibration = true;
     }
 }

 public void save()
 {
     ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
     DataOutputStream dataoutputstream = new DataOutputStream(bytearrayoutputstream);
     try
     {
         dataoutputstream.writeByte(gw.gs.country);
         dataoutputstream.writeInt(chapter);
         dataoutputstream.writeInt(mission);
         for(int i = 0; i < 64; i++)
         {
             for(int j = 0; j < 64; j++)
             {
                 dataoutputstream.writeByte(gw.lv.map[i][j]);
                 dataoutputstream.writeByte(gw.lv.flags[i][j]);
                 dataoutputstream.writeByte(gw.lv.resources[i][j]);
             }

         }

         for(int k = 0; k < 64; k++)
         {
             dataoutputstream.writeByte(gw.lv.barhany[k]);
             dataoutputstream.writeByte(gw.lv.ljod[k]);
             dataoutputstream.writeByte(gw.lv.bereg[k]);
         }

         dataoutputstream.writeShort(buildsNum);
         for(int l = 0; l < buildsNum; l++)
         {
             for(int i1 = 0; i1 < 8; i1++)
                 dataoutputstream.writeByte(objects[l][i1]);

         }

         dataoutputstream.writeShort(peopleNum);
         for(int j1 = 0; j1 < peopleNum; j1++)
         {
             for(int k1 = 0; k1 < 12; k1++)
                 dataoutputstream.writeShort(people[j1][k1]);

         }

         for(int l1 = 0; l1 < stock.length; l1++)
             dataoutputstream.writeShort(stock[l1]);

         dataoutputstream.writeInt(gw.gs.days);
         dataoutputstream.writeByte(gw.gt.daycnt);
         dataoutputstream.writeByte(gw.gs.cursori);
         dataoutputstream.writeByte(gw.gs.cursorj);
         dataoutputstream.writeBoolean(gw.gs.uragan);
         dataoutputstream.writeBoolean(gw.gs.uraganvisible);
         dataoutputstream.writeInt(gw.gs.uraganx);
         dataoutputstream.writeInt(gw.gs.uragany);
         dataoutputstream.writeInt(gw.gs.uraganvx);
         dataoutputstream.writeInt(gw.gs.uraganvy);
         dataoutputstream.writeInt(gw.gm.scores);
         dataoutputstream.writeBoolean(gw.gs.earthQuake);
         dataoutputstream.writeInt(gw.gs.earthQuakePeriod);
         byte abyte0[] = bytearrayoutputstream.toByteArray();
         rStore = RecordStore.openRecordStore("globalw", true);
         if(rStore.getNumRecords() > 0)
         {
             rStore.closeRecordStore();
             RecordStore.deleteRecordStore("globalw");
             rStore = RecordStore.openRecordStore("globalw", true);
         }
         rStore.addRecord(abyte0, 0, abyte0.length);
         rStore.closeRecordStore();
     }
     catch(Exception exception) { }
 }

 public void saveOpt()
 {
     ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
     DataOutputStream dataoutputstream = new DataOutputStream(bytearrayoutputstream);
     try
     {
         int i = 0;
         if(gw.st.locale == "ru")
             i = 1;
         dataoutputstream.writeInt(userid);
         dataoutputstream.writeInt(i);
         dataoutputstream.writeBoolean(gw.gs.sound);
         dataoutputstream.writeBoolean(gw.gs.vibration);
         byte abyte0[] = bytearrayoutputstream.toByteArray();
         rStore = RecordStore.openRecordStore("globalwopt", true);
         if(rStore.getNumRecords() > 0)
         {
             rStore.closeRecordStore();
             RecordStore.deleteRecordStore("globalwopt");
             rStore = RecordStore.openRecordStore("globalwopt", true);
         }
         rStore.addRecord(abyte0, 0, abyte0.length);
         rStore.closeRecordStore();
     }
     catch(Exception exception) { }
 }

 public void start()
 {
     for(int i = 0; i < stock.length; i++)
         stock[i] = 0;

     buildsNum = 0;
     calculateBuilds();
     peopleNum = 0;
     stock[2] = 10;
     stock[3] = 10;
     chapter = 1;
     mission = 0;
     scores = 0;
     gameover = false;
 }

 public boolean swapPeople(int i)
 {
     int j = people[i][5] - people[i][0];
     int k = people[i][6] - people[i][1];
     int l = j;
     int i1 = k;
     boolean flag = true;
     boolean flag1 = true;
     boolean flag2 = false;
     if(j < 0)
     {
         j = -j;
         flag = false;
     }
     if(k < 0)
     {
         k = -k;
         flag1 = false;
     }
     if(j < 22 && k < 22)
     {
         byte byte0 = 4;
         gw.lv.flags[people[i][11]][people[i][10]] |= 4;
         people[i][7] = byte0;
         return true;
     }
     byte byte1;
     if(people[i][8] != 0 || people[i][9] != 4 && people[i][9] != 6)
     {
         if((gw.gs.rnd.nextInt() & 0xffff) * (j + k) >> 16 < k)
             flag2 = true;
         if(flag2)
         {
             if(flag1)
                 byte1 = 0;
             else
                 byte1 = 2;
         } else
         if(flag)
             byte1 = 1;
         else
             byte1 = 3;
     } else
     if(l + i1 > 0)
     {
         if(k < 22)
         {
             if(l > 0)
                 byte1 = 1;
             else
                 byte1 = 3;
         } else
         if(i1 > 0)
             byte1 = 0;
         else
             byte1 = 2;
     } else
     if(j < 22)
     {
         if(i1 > 0)
             byte1 = 0;
         else
             byte1 = 2;
     } else
     if(l > 0)
         byte1 = 1;
     else
         byte1 = 3;
     people[i][7] = byte1;
     return false;
 }

 public void triggerPeople()
 {
     boolean flag = false;
     try
     {
         int l = 0;
         boolean flag1 = false;
         for(int i = peopleNum; i >= 0; i--)
             gw.lv.flags[people[i][11]][people[i][10]] &= 0xfd;

         for(int j = peopleNum - 1; j >= 0; j--)
             switch(people[j][9])
             {
             case 1: // '\001'
             case 5: // '\005'
             default:
                 break;

             case 0: // '\0'
                 short word0 = people[j][8];
                 if(word0 >= 7 && word0 <= 9)
                 {
                     short word3 = people[j][3];
                     if(objects[word3][6] > 0)
                         people[j][9] = 3;
                 }
                 break;

             case 2: // '\002'
                 if(!movePeople(j))
                     break;
                 short word1 = people[j][8];
                 if(word1 == 0 || word1 == 1 || word1 == 3 || word1 >= 7 && word1 <= 9)
                 {
                     people[j][9] = 3;
                     break;
                 }
                 if(word1 == 80)
                 {

⌨️ 快捷键说明

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