📄 gamescreen.java
字号:
public void changeMap(byte abyte0[][], byte abyte1[][])
{
boolean flag = false;
int i1 = 0;
cx = (abyte1.length - abyte0.length) / 2;
mdx = (byte)cx;
mdy = (byte)(abyte1[0].length - abyte0[0].length);
if(mdy > 0)
cy = 1;
for(int j1 = 0; j1 < abyte1.length; j1++)
{
if(j1 - cx <= 0)
i1 = 0;
else
if(i1 > abyte0.length - 1)
i1 = abyte0.length - 1;
int l = abyte0[i1].length - 1;
for(int k1 = abyte1[j1].length - (mdy <= 0 ? 1 : 2); k1 > -1; k1--)
{
if(l > -1)
abyte1[j1][k1] = abyte0[i1][l];
else
abyte1[j1][k1] = abyte0[i1][0];
l--;
}
i1++;
}
cx = abyte1[0].length - 1;
if(mdy > 0)
{
for(int l1 = 0; l1 < abyte1.length; l1++)
if(abyte1[l1][cx - 1] != -1 && abyte1[l1][cx - 1] < 5)
abyte1[l1][cx] = 3;
else
abyte1[l1][cx] = abyte1[l1][cx - 1];
mdy--;
}
}
public void update()
{
if(g_status == 2)
{
if(pause)
return;
updateHarry();
updateHarryAnim();
updateShot();
if(bosson)
updateBoss();
}
}
public void updateLoading()
{
if(loadidx == 0)
{
loadidx++;
return;
}
if(loadscr == 0)
loadscr = 1;
else
if(loadscr == 1)
initLevel(stage, mapid, (byte)0);
else
if(loadscr == 3)
{
switch(getRandom(3))
{
case 0: // '\0'
tx = 0;
break;
case 1: // '\001'
tx = 3;
break;
default:
tx = 4;
break;
}
prehx = hx;
prehy = hy;
premapid = mapid;
initLevel((byte)14, (byte)tx, (byte)1);
} else
if(loadscr == 4)
{
initLevel(stage, premapid, (byte)2);
hx = prehx;
hy = prehy;
} else
if(loadscr == 2)
gc.menu();
}
public void updateHarry()
{
if(hdie > -1)
hdie--;
if(hstatus == 6 && hdie < 18)
{
hstatus = 0;
setHarryAnim(hstatus);
}
if(hstatus == 3 && hjumpcount > -1)
{
hjumpcount++;
if(hjumpcount > 2)
hjumptype = 2;
}
tx = hx;
hex = hx;
hey = hy - 13;
if(hjumpidx > -1)
if(hjumpidx < hjumpdata[hjumptype][0].length)
{
hxspeed = (byte)(hjumpdata[hjumptype][0][hjumpidx] * hjumpdir);
hyspeed = hjumpdata[hjumptype][1][hjumpidx];
hjumpidx++;
} else
{
hjumpidx = -1;
hxspeed = hyspeed = 0;
}
if(hxspeed < 0)
{
hex = (hx - 6) + hxspeed;
if(hex < 0 && nextMap((byte)2))
{
hx = Harry.SW - 6;
hex = (hx - 6) + hxspeed;
if(!hidden)
{
prehx = hx;
prehy = hy;
}
}
} else
if(hxspeed > 0)
{
hex = hx + 6 + hxspeed;
if(hex >= Harry.SW && nextMap((byte)3))
{
hx = 6;
hex = hx + 6 + hxspeed;
if(!hidden)
{
prehx = hx;
prehy = hy;
}
}
}
if(hxspeed != 0)
{
ti = getTilenum(hx, hy);
if(ti == 8 && hstatus == 1)
{
hy = (hy / 16) * 16 + hx % 16;
hx += hxspeed;
hy += hxspeed;
return;
}
if(ti == 7 && hstatus == 1)
{
hx += hxspeed;
hy += hxspeed;
return;
}
if(ti == 5 && hstatus == 1)
{
hy = (hy / 16 + 1) * 16 - hx % 16;
hx += hxspeed;
hy -= hxspeed;
return;
}
if(ti == 6 && hstatus == 1)
{
hx += hxspeed;
hy -= hxspeed;
return;
}
if(ti == 10)
{
if(hdie < 0 && musuk_time < 1)
{
die(0);
return;
}
hx += hxspeed;
}
if(ti == 9)
{
if(getTilenum(hex, hy - 7) == -1)
hy = (hy / 16) * 16;
ti = getTilenum(hex, hy - 1);
} else
{
ti = getTilenum(hex, hey);
}
switch(ti)
{
case -1:
case 5: // '\005'
case 6: // '\006'
case 7: // '\007'
case 8: // '\b'
case 9: // '\t'
hx += hxspeed;
break;
}
}
ty = hy;
if(hyspeed != 0)
{
hey += hyspeed;
ty += hyspeed;
ti = getTilenum(hx, hy);
if(hey < 0)
{
if(ti == 9 && nextMap((byte)0))
{
hy = Harry.SH - 1;
if(!hidden)
{
prehx = hx;
prehy = hy;
}
}
return;
}
if(ty >= Harry.SH)
{
if(nextMap((byte)1))
{
hy = 10;
if(!hidden)
{
prehx = hx;
prehy = hy;
}
}
return;
}
ti = getTilenum(hx, ty);
if(ti == 9 && hstatus != 5)
{
hy = ty;
return;
}
if(hyspeed > 0)
{
if(ti == 10)
{
if(hdie < 0 && musuk_time < 1)
{
die(0);
return;
}
ti = 11;
}
if(ti == -1 || ti == 7 || ti == 6)
{
hy += hyspeed;
if(hstatus != 2 || hstatus != 3 || hstatus != 5)
{
hstatus = 5;
setHarryAnim((byte)5);
}
} else
{
hy = (ty / 16) * 16;
hyspeed = 0;
hxspeed = 0;
hanimindex = 0;
hanimstep = 2;
hanimdata = hanimend[hstatus];
hjumpidx = -1;
}
} else
if(hstatus == 2 || hstatus == 3)
{
hy += hyspeed;
} else
{
hyspeed = 0;
hanimindex = 0;
hanimstep = 2;
hanimdata = hanimend[hstatus];
}
} else
if(hyspeed == 0)
{
ti = getTilenum(hx, hy);
if(ti == -1)
{
hstatus = 5;
hyspeed = 5;
} else
if(ti == 10 && hdie < 0 && musuk_time < 1)
die(0);
}
}
public void updateHarryAnim()
{
hcbox[0][0] = hx - 6;
hcbox[0][1] = hy - 26;
hcbox[1][0] = hx + 6;
hcbox[1][1] = hy;
if(hstatus == 8 && hanimstep == 1 && hyspeed == 0)
hanimindex--;
hanimindex++;
if(hanimindex > hanimdata.length - 1)
{
hanimindex = 0;
if(hanimstep == 0)
{
hanimstep = 1;
hanimdata = hanims[hstatus];
} else
if(hanimstep == 2)
{
if(getTilenum(hx, hy - 1) == 9)
hstatus = 8;
else
hstatus = 0;
setHarryAnim(hstatus);
}
}
}
public int calPos(int l, int i1, int j1, int k1)
{
tx = l + k1;
tx = tx + (k1 >= 0 ? j1 : -j1);
ty = getTilenum(tx, i1);
if(ty == -1)
return tx;
if(ty == -2)
{
if(k1 < 0)
return j1;
if(k1 > 0)
return Harry.SW - j1;
} else
if(ty == -3)
return l;
if((tcdata[ty] & 1) > 0)
{
if(k1 < 0)
return (l / 16) * 16 + j1;
else
return (l / 16 + 1) * 16 - j1;
} else
{
return tx;
}
}
public byte getTilenum(int l, int i1)
{
if(l < 0 || l >= Harry.SW)
return -2;
if(i1 < 0 || i1 >= Harry.SH)
return -2;
else
return getTile(l / 16, i1 / 16);
}
public byte getTile(int l, int i1)
{
if(l < 0 || l >= tileset.length)
return -3;
if(i1 < 0 || i1 >= tileset[0].length)
return -3;
else
return tileset[l][i1];
}
public void hmagicshot()
{
if(magicalive)
return;
magicalive = true;
magicdist = hshotcount;
magictype = selectmagic;
if(magictype == 2)
{
magicspeedx = 0;
mprey = magicy = hy - 7;
lumos = 5;
mcount = 3;
} else
{
magicspeedx = hdir != 2 ? hshotcount * 2 + 3 : -1 * (hshotcount * 2 + 3);
mprey = magicy = hy - 15;
lumos = -1;
mcount = 2 + hshotcount / 2;
}
mprex = magicx = hdir != 2 ? hcbox[1][0] : hcbox[0][0];
magicspeedy = 3;
if(magictype == 1)
{
magicspeedy = 0;
magicdist = (byte)((hshotcount / 2 + 1) * 16);
}
mdir = -1;
rm.play(12, false);
}
public void updateShot()
{
if(hshotready && hshotcount < 5)
hshotcount++;
if(magicalive)
{
mprex = magicx;
mprey = magicy;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -