📄 seafox.java
字号:
g.setColor(Color.black);
for(int i3 = 0; i3 < byte1; i3++)
g.drawRect(i + i3, j + i3, c - 2 * i3 - 1, byte0 - 2 * i3 - 1);
String s2 = "Loading graphics...";
j2 = (dimension.width - fontmetrics.stringWidth(s2)) / 2;
k2 = j - fontmetrics.getDescent() - 2;
g.drawString(s2, j2, k2);
g.dispose();
do {
int i2 = 0;
for(int j3 = 0; j3 < k1; j3++)
if(m_mediaTracker.checkID(j3, true))
i2++;
if(i2 > l1) {
l1 = i2;
DrawProgressBar(k, l, i1, j1, (double)l1 / (double)k1);
}
if(l1 >= k1)
break;
try {
Thread.sleep(100L);
}
catch(InterruptedException _ex) { }
} while(true);
g = m_imageLoading.getGraphics();
g.setFont(new Font("Helvetica", 0, 14));
fontmetrics = g.getFontMetrics();
g.setColor(Color.white);
g.fillRect(0, l2, dimension.width, dimension.height - l2);
g.setColor(Color.black);
for(int k3 = 0; k3 < byte1; k3++)
g.drawRect(i + k3, j + k3, c - 2 * k3 - 1, byte0 - 2 * k3 - 1);
s2 = "Loading sounds...";
j2 = (dimension.width - fontmetrics.stringWidth(s2)) / 2;
k2 = j - fontmetrics.getDescent() - 2;
g.drawString(s2, j2, k2);
g.dispose();
DrawProgressBar(k, l, i1, j1, 0.0D);
m_acBigExplosion = getAudioClip(getDocumentBase(), "big_expl.au");
m_acBigExplosion.play();
DrawProgressBar(k, l, i1, j1, 0.12D);
m_bPlayBigExplosion = false;
m_acLittleExplosion = getAudioClip(getDocumentBase(), "ltl_expl.au");
m_acLittleExplosion.play();
DrawProgressBar(k, l, i1, j1, 0.25D);
m_bPlayLittleExplosion = false;
m_acFireTorpedo = getAudioClip(getDocumentBase(), "fire.au");
m_acFireTorpedo.play();
DrawProgressBar(k, l, i1, j1, 0.37D);
m_bPlayFireTorpedo = false;
m_acOutOfTorpedoes = getAudioClip(getDocumentBase(), "empty.au");
m_acOutOfTorpedoes.play();
DrawProgressBar(k, l, i1, j1, 0.5D);
m_bPlayOutOfTorpedoes = false;
m_acClank = getAudioClip(getDocumentBase(), "clank.au");
m_acClank.play();
DrawProgressBar(k, l, i1, j1, 0.62D);
m_bPlayClank = false;
m_acSupplies = getAudioClip(getDocumentBase(), "supplies.au");
m_acSupplies.play();
DrawProgressBar(k, l, i1, j1, 0.75D);
m_bPlaySupplies = false;
m_acSplash = getAudioClip(getDocumentBase(), "splash.au");
m_acSplash.play();
DrawProgressBar(k, l, i1, j1, 0.87D);
m_bPlaySplash = false;
m_acShark = getAudioClip(getDocumentBase(), "shark.au");
m_acShark.play();
DrawProgressBar(k, l, i1, j1, 1.0D);
m_bPlayShark = false;
m_imageLoading.flush();
m_nPlayfieldWidth = m_nWindowWidth;
m_nPlayfieldHeight = m_nWindowHeight - 20;
m_bufferPlayfield = createImage(m_nPlayfieldWidth, m_nPlayfieldHeight);
m_bufferSurface = createImage(m_nPlayfieldWidth, 60);
Graphics g1 = m_bufferSurface.getGraphics();
int l3 = m_imageWater.getWidth(null);
int i4 = m_imageWater.getHeight(null);
for(int j4 = 0; j4 < m_nPlayfieldWidth; j4 += l3) {
int k4 = 0;
do {
g1.drawImage(m_imageWater, j4, k4, null);
k4 += i4;
} while(k4 < 60);
}
g1.dispose();
m_nMission = 1;
m_nScore = 0;
m_nSubsLeft = 3;
m_bufferScorebar = createImage(m_nPlayfieldWidth, 20);
Font font = new Font("Helvetica", 1, 16);
m_fontScorebar = new Font("Helvetica", 0, 16);
Graphics g2 = m_bufferScorebar.getGraphics();
g2.setColor(SCOREBAR_BACKGROUND_COLOR);
g2.fillRect(0, 0, m_nPlayfieldWidth, 20);
g2.setColor(SCOREBAR_CAPTION_COLOR);
int l4 = 8;
int i5 = 0;
do {
String s3 = null;
String s4 = null;
switch(i5) {
case 0: // '\0'
s3 = new String("Mission:");
s4 = new String("0");
break;
case 1: // '\001'
s3 = new String("Ships sunk:");
s4 = new String("10");
break;
case 2: // '\002'
s3 = new String("Score:");
s4 = new String("000000");
break;
case 3: // '\003'
s3 = new String("Torpedoes:");
s4 = new String("00");
break;
case 4: // '\004'
s3 = new String("Fuel:");
s4 = new String("100%");
break;
}
g2.setFont(font);
FontMetrics fontmetrics1 = g2.getFontMetrics();
m_nScorebarZoneCaptionWidth[i5] = fontmetrics1.stringWidth(s3);
l4 += m_nScorebarZoneCaptionWidth[i5];
g2.setFont(m_fontScorebar);
FontMetrics fontmetrics3 = g2.getFontMetrics();
m_nScorebarZoneDataWidth[i5] = fontmetrics3.stringWidth(s4);
l4 += m_nScorebarZoneDataWidth[i5];
l4 += 4;
} while(++i5 < 5);
i5 = (m_nPlayfieldWidth - l4) / 4;
int j5 = 4;
g2.setFont(font);
g2.getFontMetrics();
int k5 = 0;
do {
String s5 = null;
switch(k5) {
case 0: // '\0'
s5 = new String("Mission:");
break;
case 1: // '\001'
s5 = new String("Ships sunk:");
break;
case 2: // '\002'
s5 = new String("Score:");
break;
case 3: // '\003'
s5 = new String("Torpedoes:");
break;
case 4: // '\004'
s5 = new String("Fuel:");
break;
}
g2.drawString(s5, j5, 16);
m_nScorebarZoneDataX[k5] = j5 + m_nScorebarZoneCaptionWidth[k5] + 4;
m_nScorebarZoneValue[k5] = -1;
j5 = m_nScorebarZoneDataX[k5] + m_nScorebarZoneDataWidth[k5] + i5;
} while(++k5 < 5);
g2.dispose();
Graphics g3 = m_bufferPlayfield.getGraphics();
g3.setFont(m_fontMessage);
FontMetrics fontmetrics2 = g3.getFontMetrics();
int l5 = fontmetrics2.stringWidth(m_stringStart);
m_nXstartString = (m_nPlayfieldWidth - l5) / 2;
m_nYstartString = 60 + (m_nPlayfieldHeight - 60) / 2;
l5 = fontmetrics2.stringWidth(m_stringOutOfFuel);
m_nXoutOfFuel = (m_nPlayfieldWidth - l5) / 2;
m_nYoutOfFuel = 60 + ((m_nPlayfieldHeight - 60) * 3) / 4;
l5 = fontmetrics2.stringWidth(m_stringGameOver);
m_nXgameOver = (m_nPlayfieldWidth - l5) / 2;
m_nYgameOver = 60 + (m_nPlayfieldHeight - 60) / 4;
l5 = fontmetrics2.stringWidth(m_stringMissionTitle);
m_nXmissionTitle = (m_nPlayfieldWidth - l5) / 2;
m_nYmissionTitle = 60 + (m_nPlayfieldHeight - 60) / 4;
l5 = fontmetrics2.stringWidth(m_stringMissionComplete);
m_nXmissionComplete = (m_nPlayfieldWidth - l5) / 2;
m_nYmissionComplete = 60 + (m_nPlayfieldHeight - 60) / 2;
m_stringSubsLeft[2] = new String("3 subs left");
l5 = fontmetrics2.stringWidth(m_stringSubsLeft[2]);
m_nXsubsLeft[2] = (m_nPlayfieldWidth - l5) / 2;
m_stringSubsLeft[1] = new String("2 subs left");
l5 = fontmetrics2.stringWidth(m_stringSubsLeft[1]);
m_nXsubsLeft[1] = (m_nPlayfieldWidth - l5) / 2;
m_stringSubsLeft[0] = new String("Last sub!!");
l5 = fontmetrics2.stringWidth(m_stringSubsLeft[0]);
m_nXsubsLeft[0] = (m_nPlayfieldWidth - l5) / 2;
m_nYsubsLeft = 60 + ((m_nPlayfieldHeight - 60) * 4) / 5;
g3.dispose();
m_player.OneTimeInitialization();
CapitalShip.m_nXspacing = m_nWindowWidth / 2;
CapitalShip.m_nWakeWidth = CapitalShip.m_imageWake[0].getWidth(null);
CapitalShip.m_nWakeHeight = CapitalShip.m_imageWake[0].getHeight(null);
int i6 = 0;
do
m_capitalShip[i6] = new CapitalShip();
while(++i6 < 10);
HospitalShip.m_nXspacing = m_nWindowWidth / 2;
i6 = 0;
do
m_hospitalShip[i6] = new HospitalShip();
while(++i6 < 3);
Destroyer.m_dShipWidth = Destroyer.m_imageShip.getWidth(null);
Destroyer.m_nShipHeight = Destroyer.m_imageShip.getHeight(null);
Destroyer.m_nWakeWidth = Destroyer.m_imageWake[0].getWidth(null);
Destroyer.m_nWakeHeight = Destroyer.m_imageWake[0].getHeight(null);
i6 = 0;
do
m_destroyer[i6] = new Destroyer();
while(++i6 < 3);
i6 = 0;
do
m_depthCharge[i6] = new DepthCharge();
while(++i6 < 3);
EnemySub.m_dSubWidth = EnemySub.m_imageSub.getWidth(null);
EnemySub.m_dSubHeight = EnemySub.m_imageSub.getHeight(null);
EnemySub.m_dYlaunchMin = Player.m_dYmin;
EnemySub.m_dYlaunchMax = (double)m_nPlayfieldHeight - 2D * EnemySub.m_dSubHeight;
i6 = 0;
do
m_enemySub[i6] = new EnemySub();
while(++i6 < 3);
VerticalTorpedo.m_nTorpedoWidth = VerticalTorpedo.m_imageUp.getWidth(null);
VerticalTorpedo.m_nTorpedoHeight = VerticalTorpedo.m_imageUp.getHeight(null);
VerticalTorpedo.m_nBlastWidth = VerticalTorpedo.m_imageBlast[0].getWidth(null);
VerticalTorpedo.m_nBlastHeight = VerticalTorpedo.m_imageBlast[0].getHeight(null);
HorizontalTorpedo.m_dTorpedoWidth = HorizontalTorpedo.m_imageTorpedo.getWidth(null);
HorizontalTorpedo.m_dTorpedoHeight = HorizontalTorpedo.m_imageTorpedo.getHeight(null);
i6 = 0;
do
m_enemyTorpedo[i6] = new EnemyTorpedo();
while(++i6 < 3);
EnemyTorpedo.m_dTorpedoWidth = EnemyTorpedo.m_imageTorpedo.getWidth(null);
EnemyTorpedo.m_dTorpedoHeight = EnemyTorpedo.m_imageTorpedo.getHeight(null);
EnemyTorpedo.m_dWakeWidth = EnemyTorpedo.m_imageWake[0].getWidth(null);
i6 = 0;
do {
m_magneticMine[i6] = new MagneticMine();
m_magneticMine[i6].m_ndx = i6;
} while(++i6 < 3);
MagneticMine.m_dMineRadius = MagneticMine.m_imageMine.getWidth(null) / 2;
SupplySub.m_dImageWidth = SupplySub.m_imageSub.getWidth(null);
SupplySub.m_dImageHeight = SupplySub.m_imageSub.getHeight(null);
SupplySub.m_dY = (double)m_nPlayfieldHeight - SupplySub.m_dImageHeight;
SupplySub.m_dXrelease = (double)m_nPlayfieldWidth / 4D;
Dolphin.m_dImageWidth = Dolphin.m_imageDolphin[0].getWidth(null);
Package.m_dPackageWidth = Package.m_imagePackage.getWidth(null);
Package.m_dPackageHeight = Package.m_imagePackage.getHeight(null);
MissionInit();
SubInit();
m_bGameOver = true;
Player.m_nStatus = 2;
m_player.m_lRestartTime = 1L;
m_nSubsLeft = 0;
m_bDisplayMissionTitle = false;
Destroyer.m_nShipLimit = 3;
DepthCharge.m_nChargeLimit = 3;
EnemySub.m_nSubLimit = 3;
EnemyTorpedo.m_nTorpedoLimit = 3;
MagneticMine.m_nMineLimit = 3;
m_bInitialized = true;
}
private void SubInit() {
m_player.MissionInitialization();
CapitalShip.m_lStartTime = System.currentTimeMillis();
CapitalShip.m_dXoriginStart = -(10 * CapitalShip.m_nXspacing);
HospitalShip.m_lStartTime = System.currentTimeMillis();
HospitalShip.m_dXoriginStart = -(3 * HospitalShip.m_nXspacing);
int i = 0;
do
m_destroyer[i].m_nStatus = 4;
while(++i < 3);
Destroyer.m_lTimeNextLaunch = System.currentTimeMillis() + 5000L;
Destroyer.m_nActiveShips = 0;
i = 0;
do
m_depthCharge[i].m_nStatus = 0;
while(++i < 3);
DepthCharge.m_nActiveCharges = 0;
i = 0;
do
m_enemySub[i].m_nStatus = 4;
while(++i < 3);
EnemySub.m_lTimeNextLaunch = System.currentTimeMillis() + 7000L;
EnemySub.m_nActiveSubs = 0;
i = 0;
do
m_enemyTorpedo[i].m_nStatus = 0;
while(++i < 3);
EnemyTorpedo.m_nActiveTorpedoes = 0;
i = 0;
do
m_magneticMine[i].m_nStatus = 0;
while(++i < 3);
MagneticMine.m_nActiveMines = 0;
m_verticalTorpedo.m_nStatus = 0;
m_horizontalTorpedo.m_nStatus = 0;
m_supplySub.m_lLaunchTime = System.currentTimeMillis();
m_supplySub.m_nStatus = 0;
m_dolphin.m_bActive = false;
m_package.m_nStatus = 2;
m_killerFish.m_bActive = false;
}
private void PlaySoundEffects() {
if(m_bPlayBigExplosion) {
m_acBigExplosion.play();
m_bPlayBigExplosion = false;
}
if(m_bPlayLittleExplosion) {
m_acLittleExplosion.play();
m_bPlayLittleExplosion = false;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -