📄 jmps.java
字号:
GM = 800;
// End tutorial
if (GF[14]) {
GM = -100;
}
return;
}
}
//--------------------------------------------------------------------------
if( GM == 800 ){
GF[1] = true;
if( Frame < 9 ) Frame++;
if( ( Key[1] & ( 1048608 | 2097152 ) ) != 0 ){
Frame = 0;
GM = 850;
nSel = 0;
for( i = 0; i < 4; i++ ){
Temp[i] = nScore[i];
Temp[4 + i] = VSList[i];
}
for( i = 1; i < 4; i++ ){
Temp[8] = Temp[i];
Temp[9] = Temp[4 + i];
for( j = i; j > 0; j-- ){
if(Temp[8] < Temp[j-1]) break;
Temp[j] = Temp[j - 1];
Temp[4+j] = Temp[j + 3];
}
Temp[j] = Temp[8];
Temp[4+j] = Temp[9];
}
for( i = 0; i < 4; i++ )
if( VSList[0] == Temp[4 + i] ) break;
Temp[10] = i;
return;
}
}
//-------------------------------------------------------------------------- ranking
if( GM == 850 ){
GF[1] = true;
if( Frame < 13 ){
Frame++;
nSel = Frame / 3;
}
if( ( Key[1] & ( 1048608 | 2097152 ) ) != 0 ){
Kaisuu++;
Frame = 0;
GM = 300;
GF[11] = true;
nSel = 0;
if( Kaisuu == 3 ){ // lost
Kaisuu = 1;
if (Temp[10] == 0) GM = 888;
else GM = 950;
}
else { // next stage
FirstKyori = Kyori;
//nScore[1] += CpuScore[3 + ( nStage - 1 ) * 6] + Math.abs( R.nextInt() % CpuScore[33 + ( nStage - 1 ) * 6] );
//nScore[2] += CpuScore[4 + ( nStage - 1 ) * 6] + Math.abs( R.nextInt() % CpuScore[34 + ( nStage - 1 ) * 6] );
//nScore[3] += CpuScore[5 + ( nStage - 1 ) * 6] + Math.abs( R.nextInt() % CpuScore[35 + ( nStage - 1 ) * 6] );
// changed difficulty progression (harder first stages, same last stage)
nScore[1] += -3 + CpuScore[3 + (nStage - 1) * 6] + Math.abs( R.nextInt() % CpuScore[33 + ( nStage - 1 ) * 6] );
nScore[2] += -3 + CpuScore[4 + (nStage - 1) * 6] + Math.abs( R.nextInt() % CpuScore[34 + ( nStage - 1 ) * 6] );
nScore[3] += -3 + CpuScore[5 + (nStage - 1) * 6] + Math.abs( R.nextInt() % CpuScore[35 + ( nStage - 1 ) * 6] );
}
GF[11] = true;
Temp[0] = -20;
Temp[1] = 15;
return;
}
}
//-------------------------------------------------------------------------- applause
if( GM == 888 ){
GF[1] = true;
if( Frame < 35 && !( ( Key[1] & ( 1048608 | 2097152 ) ) != 0 ) ){
Frame++;
Temp[0] += 2;
Temp[1] += 1;
}
else{
Frame = 0;
GM = 900;
return;
}
}
//-------------------------------------------------------------------------- win cup
if (GM == 900) {
GF[1] = true;
if( ( Key[1] & ( 1048608 | 2097152 ) ) != 0 ){
nStage++;
updateScores();
GM = 200;
Frame = 0;
if( nStage > 5 ){
saveScores();
GM = 998;
nStage = 0;
fClear = 1;
}
else {
GF[11] = true;
}
return;
}
}
//-------------------------------------------------------------------------- continue?
if (GM == 950) {
GF[1] = true;
if (( Key[1] & (524544 | 131076) ) != 0) nSel = (nSel+1) % 2;
if (( Key[1] & 1048608) != 0) {
GF[11] = true;
GM = 200 * (1 - nSel);
Frame = 0;
updateScores();
if (nSel == 0) { // continue = yes
totalScore = 0;
}
else {
saveScores();
gameOver(); // continue = no
}
nScore[0] = 0;
nSel = 0;
return;
}
}
//--------------------------------------------------------------------------
if (GM == 998) {
GF[1] = true;
Frame++;
if(Frame > 10){
Frame = 0;
GM = 999;
return;
}
PXY = ( 40 * ( 10 - Frame ) ) / 10;
}
//--------------------------------------------------------------------------
if( GM == 999 ){
if(Frame < 9) Frame++;
nSel = Frame / 3;
GF[1] = true;
if( ( Key[1] & ( 1048608 | 2097152 ) ) != 0 ){
nSel = 0;
Temp[1] = 0;
Frame = 0;
GM = 1200;
return;
}
}
//--------------------------------------------------------------------------
if( GM == 1200 ) {
gameOver();
return;
}
Draw();
GF[1] = false;
GF[2] = false;
GF[3] = false;
GF[4] = false;
// GF[5] = false;
}
//------------------------------------------------------------------------------
public void processEvent(int type, int param)
{
if (type == Display.KEY_PRESSED_EVENT) {
//boolean SOFT_1 = (Key[3] & 0x400000) != 0; //boolean SOFT_1 = (Key[3] == 4194304);
//boolean SOFT_2 = (Key[3] & 0x200000) != 0; //boolean SOFT_2 = (Key[3] == 2097152);
boolean SOFT_1 = (param == Display.KEY_SOFT1);
boolean SOFT_2 = (param == Display.KEY_SOFT2);
if (!(SOFT_1 && GM == 350)) {
Key[3] = getKeypadState();
}
else resetKeypadState();
if (isPaused) {
if (helpFirstScreen) {
helpFirstScreen = false;
DrawHelp();
}
else {
isPaused = false;
helpFirstScreen = true;
setSoftLabels(strSpecific[39], main.txt.getBundle("cmdBack")[0]);
GF[4] = true;
Draw();
}
return;
}
if (GM == 0) { // TITLE Mode
if (SOFT_1) { // Menu Command
Key[3] = 0;
GM = -100;
}
else if (SOFT_2) main.terminate(); // Exit Command
else startGame();
}
else if (GM == 100 || GM == 200) { // PRE-GAME Modes
if (SOFT_2) notifyTitle(); // Back
if (SOFT_1) ProEvent(1048576); // OK button mapped to action key
}
else if (GM == 1000) { // SCORES Mode
if (SOFT_2) {
GM = -100; // Back (to menu)
}
}
else if (GF[14]) { // TUTORIAL Mode
if (SOFT_2) {
GM = -100; // Back (to menu)
}
}
else if (GM >= 800) { // RANKING/RESULTS Modes
if (SOFT_2) notifyTitle(); // Back
if (SOFT_1) ProEvent(1048576); // OK button mapped to action key
}
else { // GAME (DESCENDING) Modes
if (SOFT_1) pause(); // ProEvent(1048576); // OK button mapped to action key
if (SOFT_2) notifyTitle(); // Back
}
}
}
//------------------------------------------------------------------------------
public void CreateWind()
{
Wind = Math.abs( R.nextInt() % 8 );
WindPow = 1 + Math.abs( R.nextInt() % 3 );
WindTime = 10 + Math.abs( R.nextInt() % 11 );
WindUD = 13;
if( Wind == 0 || Wind == 1 || Wind == 7 ) WindUD = 255;
if( Wind > 2 && Wind < 4 ) WindUD = 5 + WindPow * 2;
WindLRPow = 0;
if( Wind != 0 && Wind != 4 )
WindLRPow = (1-2*(Wind/4)) * WindSpeed[VSList[0]*3 + WindPow-1];
}
//------------------------------------------------------------------------------
public void pause() {
resetKeypadState();
isPaused = true;
DrawHelp();
}
//------------------------------------------------------------------------------
public void DrawHelp() {
Graphics g = this.getGraphics();
g.setFont(NF);
g.setColor(C[0]); // white
int x1 = 5, y1 = 29, x2 = 116, y2 = 89, left_x = 5, space_y = 13; // GX10
g.fillRect(x1, y1, x2-x1, y2-y1); // GX10
g.setColor(0); // black
g.drawRoundRect(x1, y1, x2-x1, y2-y1, 7, 7);
//g.drawString(strSpecific[?], center, top, CENTER_TOP);
for (int i=0; i<4; i++) {
if (helpFirstScreen) {
g.drawString(strSpecific[40+i], x1+left_x, y1+5+space_y*i, LEFT_TOP);
}
else {
g.drawString(strSpecific[44+i], x1+left_x, y1+5+space_y*i, LEFT_TOP);
}
}
setSoftLabels(main.txt.getBundle("cmdContinue")[0], "");
repaint();
serviceRepaints();
}
//------------------------------------------------------------------------------
public synchronized void Draw()
{
// GF[18] = true;
int i, j, x, y;
int GM = this.GM;
Graphics g = this.getGraphics();
g.setFont(NF);
if (isPaused) return;
// restart screen
if(GF[1] || GM_old != GM) {
g.translate(0 - g.getTranslateX(), 0 - g.getTranslateY());
g.setColor(C[0]);
g.fillRect( 0, 0, Display.getWidth(), Display.getHeight() );
GF[2] = true;
GF[3] = true;
GF[4] = true;
}
// -100 = menu ; -1 = loading ; 0 = title ;
// 100 = choose country ; 200 = cup, opponents
// 300 = game intro ; 350 = choose wind
// {400, 500, 600, 700} = descent, jump, balance, landing
// 800 = jump results ; 850 = ranking
// 888 = get supporters' applause ; 900 = win (cup)
// {350, 400, 500, 600, 650, 700} = Tutorial
// 950 = continue?
// 1000 = scores
// {998, 999, 1200} = game cleared
// change mode
if (GM_old != GM) {
//System.out.println("New GM: " + GM);
switch (GM) {
case -100: setSoftLabels("", main.txt.getBundle("cmdBack")[0]);
repaint();
serviceRepaints();
main.notifyMenu();
break;
case -1: setSoftLabels("", "");
break;
case 0: setSoftLabels(main.txt.getBundle("cmdMenu")[0], main.txt.getBundle("cmdExit")[0]);
break;
case 100:
case 200: setSoftLabels(main.txt.getBundle("cmdOK")[0], main.txt.getBundle("cmdBack")[0]);
break;
case 300: setSoftLabels(strSpecific[39], main.txt.getBundle("cmdBack")[0]);
break;
case 350: if (GF[14]) setSoftLabels("", main.txt.getBundle("cmdBack")[0]);
break;
case 800: setSoftLabels(main.txt.getBundle("cmdOK")[0], "");
break;
case 888: playsound(applause);
break;
case 850: if ((nScore[0] < nScore[1] || nScore[0] < nScore[2] ||
nScore[0] < nScore[3]) && (Kaisuu == 2)) playsound(lost);
break;
case 900: playsound(wincup); break;
//case 950: playsound(lost); break;
case 999: playsound(wingame); break;
case 1000: if (GM_old < 950) break;
setSoftLabels("", main.txt.getBundle("cmdBack")[0]);
break;
}
GM_old = GM;
}
if (GM == -100) return;
if (ResCnt != 0 ){ ResCnt = 0; GF[1] = true; }
g.translate(Scr[0] - g.getTranslateX(), Scr[1] - g.getTranslateY());
if( GM == -1 ) {
int fntHeight = g.getFont().getHeight();
int width = progmax + 3;
int height = 8;
int top = (Display.getHeight() - fntHeight - 2 - height) / 2 - Scr[1];
int center = Display.getWidth() / 2 - Scr[0];
int left = (Display.getWidth() - width) / 2 - Scr[0];
g.setColor(C[0]);
g.fillRect(0, 0, Display.getWidth(), Display.getHeight());
g.setColor(0); // black
g.drawString(strCommon[0], center, top, CENTER_TOP); // loading...
g.drawRect(left, top + fntHeight + 6, width, height);
g.setColor(C[2]);
g.fillRect(left + 2, top + fntHeight + 8, progress, height - 3);
// try { Thread.sleep(0); } catch (Exception e) {}
}
//--------------------------------------------------------------------------
if( GM == 0 ){
// nokia 7650
g.translate(60 - g.getTranslateX(), -12 - g.getTranslateY());
// smaller display
//g.translate(72 - g.getTranslateX(), -12 - g.getTranslateY());
int DispW = Scr[0];
int DispH = Scr[1];
g.setColor(C[0]);
g.fillRect( 0, 0, DispW, DispH );
g.drawImage( startImage, DispW/2, 20, CENTER_TOP);
g.setColor(0);
//String msg = "00000" + Integer.toString(nScore[5]);
String msg = "00000" + Integer.toString(nScore[12]);
msg = msg.substring(msg.length() - 6);
g.drawString("HISCORE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -