📄 gamescreen.java
字号:
hobjon = true;
hobjidx = (byte)j1;
}
} else
if(objinfo[j1][0] == 16)
{
if(hidden)
{
g_status = 8;
loadscr = 4;
return;
}
if(!bossalive)
{
g_status = 3;
actioncount = 0;
score += 300;
hlife = maxhlife;
hSlot[0] = 2;
rm.play(2, false);
}
} else
if(objinfo[j1][0] == 13 && objinfo[j1][4] == 2)
{
objinfo[j1][1] = 0;
byte abyte3[][] = rm.getMapData(scrinfo[mapID], (byte)2);
abyte3[objinfo[j1][6]][1] = 0;
g_status = 8;
loadscr = 3;
return;
}
if(objinfo[j1][1] == 0 && objinfo[j1][6] != -1)
{
byte abyte4[][] = rm.getMapData(scrinfo[mapID], (byte)2);
abyte4[objinfo[j1][6]][1] = 0;
}
}
}
if(hdie < 0)
{
if(stun_time > 0)
return;
for(int j2 = 0; j2 < moninfo.length; j2++)
{
if(moninfo[j2][1] != 1)
continue;
controlMon(moninfo[j2], monpos[j2]);
if(musuk_time >= 1 || !_HitCheck(hcbox[0][0], hcbox[0][1], hcbox[1][0], hcbox[1][1], monpos[j2][0] - monpos[j2][2], monpos[j2][1] - monpos[j2][3], monpos[j2][0] + monpos[j2][2], monpos[j2][1]))
continue;
if(moninfo[j2][0] == 6)
{
if(hSlot[1] >= 10)
continue;
hSlot[1]++;
setGetinfo(4);
moninfo[j2][1] = 0;
byte abyte5[][] = rm.getMapData(mapid, (byte)3);
for(int k2 = 0; k2 < abyte5.length; k2++)
{
if(abyte5[k2][0] != 6)
continue;
abyte5[k2][1] = 0;
break;
}
break;
}
hx = calPos(hx, hy - 2, 6, cx <= monpos[j2][0] ? -12 : 12);
if(moninfo[j2][0] == 8)
moninfo[j2][1] = 0;
hdir = ((byte)(cx <= monpos[j2][0] ? 3 : 2));
hjumpidx = -1;
hxspeed = 0;
updateHarryAnim();
die(1);
}
}
}
public boolean moveObj(int ai[])
{
if(ai[0] - magicx < 7 && ai[0] - magicx > -7)
{
magicdist -= Math.abs(magicspeedx);
tx = ai.length <= 2 ? 8 : ai[2] / 2;
ai[0] = calPos(ai[0], ai[1] - 2, tx, magicspeedx);
if(magicdist < 5)
{
magicalive = false;
return true;
}
}
return false;
}
public void setdoor(int l)
{
for(int i1 = 0; i1 < objinfo.length; i1++)
if(objinfo[i1][1] == 1 && objinfo[i1][0] == 10 || objinfo[i1][0] == 11)
{
objinfo[i1][1] = 0;
byte abyte0[][] = rm.getMapData(scrinfo[mapID], (byte)2);
abyte0[objinfo[i1][6]][1] = (byte)l;
tileset[objpos[i1][0] / 16][objpos[i1][1] / 16] = -1;
tileset[objpos[i1][0] / 16][objpos[i1][1] / 16 + 1] = -1;
abyte0[objinfo[i1][6]][1] = 0;
rm.play(8, false);
rock = 5;
rm.setVib(1000);
return;
}
}
public void popObj(byte byte0, int l, int i1, int j1)
{
for(int k1 = 0; k1 < objinfo.length; k1++)
{
if(objinfo[k1][1] == 1)
continue;
objinfo[k1][0] = byte0;
objinfo[k1][1] = 1;
objinfo[k1][2] = objimgidx[byte0];
if(byte0 == 0)
objinfo[k1][2] = (byte)(objimgidx[0] + getRandom(3));
objinfo[k1][3] = (byte)j1;
objinfo[k1][4] = 1;
objinfo[k1][5] = 0;
objinfo[k1][6] = -1;
if(objinfo[k1][0] == 1)
{
objinfo[k1][3] = (byte)getRandom(grade + 1);
if(objinfo[k1][3] > 5)
objinfo[k1][3] = 5;
}
objpos[k1][0] = l;
objpos[k1][1] = i1;
break;
}
}
public void popMon(byte byte0, int l, int i1)
{
for(int j1 = 0; j1 < moninfo.length; j1++)
{
if(moninfo[j1][1] == 1)
continue;
moninfo[j1][0] = byte0;
moninfo[j1][1] = 1;
moninfo[j1][2] = monbasic[byte0][1];
moninfo[j1][3] = monbasic[byte0][2];
moninfo[j1][4] = ((byte)(getRandom(2) != 0 ? 3 : 2));
moninfo[j1][5] = monbasic[byte0][0];
moninfo[j1][6] = -1;
moninfo[j1][7] = (byte)(30 + getRandom(10));
moninfo[j1][8] = -1;
moninfo[j1][9] = 0;
moninfo[j1][10] = ((byte)(getRandom(2) != 0 ? 1 : 0));
moninfo[j1][11] = monbasic[moninfo[j1][0]][0];
moninfo[j1][12] = (byte)(5 + getRandom(10));
monpos[j1][0] = l;
monpos[j1][1] = i1;
monpos[j1][2] = rm.moncoord[byte0][2] / 2;
monpos[j1][3] = rm.moncoord[byte0][3];
break;
}
}
private void controlMon(byte abyte0[], int ai[])
{
if(abyte0[9] == 1)
{
abyte0[9] = 0;
return;
}
xdiff = abyte0[5];
ydiff = 4;
if(abyte0[8] > -1)
if(abyte0[8] < monhitpos[0].length)
{
xdiff = monhitpos[0][abyte0[8]];
ydiff = monhitpos[1][abyte0[8]];
abyte0[8]++;
} else
{
abyte0[8] = -1;
}
switch(abyte0[0])
{
default:
break;
case 0: // '\0'
case 1: // '\001'
case 4: // '\004'
case 5: // '\005'
case 6: // '\006'
case 9: // '\t'
if(wayBlocked(ai, xdiff, ydiff, abyte0[4], abyte0[2]))
abyte0[4] = ((byte)(abyte0[4] != 2 ? 2 : 3));
break;
case 2: // '\002'
abyte0[7]--;
if(abyte0[7] < 0)
{
abyte0[7] = (byte)(30 + getRandom(10));
popMon((byte)8, ai[0], ai[1]);
}
if(wayBlocked(ai, xdiff, ydiff, abyte0[4], abyte0[2]))
abyte0[4] = ((byte)(abyte0[4] != 2 ? 2 : 3));
break;
case 8: // '\b'
if(wayBlocked(ai, xdiff, ydiff, abyte0[4], abyte0[2]))
abyte0[1] = 0;
break;
case 3: // '\003'
case 7: // '\007'
case 10: // '\n'
case 11: // '\013'
if(abyte0[4] == 2)
{
ai[0] -= abyte0[5];
if(ai[0] < 10)
abyte0[4] = 3;
} else
{
ai[0] += abyte0[5];
if(ai[0] > Harry.SW - 10)
abyte0[4] = 2;
}
if(abyte0[10] == 0)
{
ai[1] -= abyte0[11];
if(ai[1] < 10)
abyte0[10] = 1;
} else
{
ai[1] += abyte0[11];
if(ai[1] > Harry.SH - 10)
abyte0[10] = 0;
}
if(abyte0[12]-- < 0)
{
abyte0[12] = (byte)(5 + getRandom(10));
abyte0[4] = ((byte)(getRandom(2) != 0 ? 3 : 2));
abyte0[10] = ((byte)(getRandom(2) != 0 ? 1 : 0));
abyte0[5] = (byte)getRandom(monbasic[abyte0[0]][0]);
abyte0[11] = (byte)getRandom(monbasic[abyte0[0]][0]);
}
break;
}
}
public boolean isBlocked(int l, int i1, int j1, int k1, byte byte0)
{
boolean flag = false;
tx = 0;
ty = 0;
switch(byte0)
{
case 2: // '\002'
tx = l / 16;
ty = (i1 + (k1 - i1) / 2) / 16;
break;
case 3: // '\003'
tx = j1 / 16;
ty = (i1 + (k1 - i1) / 2) / 16;
break;
case 0: // '\0'
tx = (l + (j1 - l)) / 16;
ty = i1 / 16;
break;
case 1: // '\001'
tx = (l + (j1 - l)) / 16;
ty = k1 / 16;
break;
}
if(tx > tileset.length - 1)
return true;
if(ty > tileset[tx].length - 1)
return true;
if(tileset[tx][ty] != -1 && tileset[tx][ty] != 9 && tileset[tx][ty] != 8 && tileset[tx][ty] != 5 && tileset[tx][ty] != 6 && tileset[tx][ty] != 7)
flag = true;
return flag;
}
public boolean wayBlocked(int ai[], int l, int i1, byte byte0, byte byte1)
{
boolean flag = false;
tx = ai[0] / 16;
ty = (ai[1] + i1) / 16;
if(tx > tileset.length - 1)
return flag;
if(ty > tileset[tx].length - 1)
return flag;
if(byte1 == 0)
{
if(tileset[tx][ty] == -1)
{
ai[1] += i1;
return flag;
}
ai[1] = ty * 16 - (i1 != 4 ? i1 : 1);
}
switch(byte0)
{
default:
break;
case 2: // '\002'
if(ai[0] - l - ai[2] <= 0)
return true;
tx = (ai[0] - l - ai[2]) / 16;
ty = ai[1] / 16;
if(passable(tx, ty, byte1))
{
ai[0] -= l;
} else
{
ai[0] = (tx + 1) * 16 + ai[2];
flag = true;
}
break;
case 3: // '\003'
if(ai[0] + l + ai[2] >= Harry.SW)
return true;
tx = (ai[0] + l + ai[2]) / 16;
ty = ai[1] / 16;
if(passable(tx, ty, byte1))
{
ai[0] += l;
} else
{
ai[0] = tx * 16 - l;
flag = true;
}
break;
}
return flag;
}
public boolean passable(int l, int i1, int j1)
{
if(tileset[l][i1] != -1 && tileset[l][i1] != 9 && tileset[l][i1] != 8 && tileset[l][i1] != 5)
return false;
for(int k1 = 0; k1 < objinfo.length; k1++)
if(objinfo[k1][1] == 1 && (objinfo[k1][0] == 6 || objinfo[k1][0] == 10 || objinfo[k1][0] == 11) && l == objpos[k1][0] / 16 && i1 == objpos[k1][1] / 16)
return false;
if(j1 == 1)
return true;
if(i1 + 1 < tileset[l].length)
return tileset[l][i1 + 1] != -1;
else
return false;
}
public void move(byte byte0)
{
switch(byte0)
{
case 4: // '\004'
default:
break;
case 0: // '\0'
if(getTile(hx / 16, (hy - 4) / 16) == 9)
{
hyspeed = -5;
hstatus = 8;
break;
}
if(hyspeed != 0)
return;
hstatus = 2;
hjumpcount = 0;
hjumptype = 0;
hjumpidx = 0;
hjumpdir = 1;
break;
case 1: // '\001'
hyspeed = 5;
hstatus = 8;
break;
case 2: // '\002'
hxspeed = -5;
hdir = byte0;
hstatus = 1;
break;
case 3: // '\003'
hxspeed = 5;
hdir = byte0;
hstatus = 1;
break;
case 5: // '\005'
if(hyspeed != 0)
return;
hjumpcount = 0;
hjumptype = 1;
hjumpidx = 0;
hjumpdir = 1;
hstatus = 3;
break;
case 6: // '\006'
if(hyspeed != 0)
return;
hjumpcount = 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -