📄 engine.java
字号:
break;
case STATE_LOGOS:
fillScreen(tmp_g, 255, 255, 255);
if(m_state_timer > PUBLISHER_TIMER) {
drawCentredImage(tmp_g, Coords.CAPY_LOGO);
} else {
drawCentredImage(tmp_g, Coords.STARWAVE_LOGO);
}
break;
case STATE_LOADING:
//fillScreen(tmp_g, 0, 0, 0);
red = 255;
green = 221;
blue = 0;
//#if DefaultConfiguration || Nokia_6600 || Nokia_6600_Unobfuscated || Nokia_3220 || Nokia_3220_Unobfuscated || Razr
fillGradient(tmp_g, 0,0, SCREEN_WIDTH, SCREEN_HEIGHT, Menus.GREEN_BACK_RGB_1, Menus.GREEN_BACK_RGB_2, Level.BG_GRADIENT_LEVELS, true);
x = SCREEN_HALF_WIDTH - (COORDS[Coords.LOADING_BAR][WIDTH] / 2);
y = LOADING_WINDOW_Y;
drawImage(tmp_g, Coords.SLEEPING_BIGGS, SCREEN_HALF_WIDTH - COORDS[Coords.SLEEPING_BIGGS][WIDTH]/2, LOADING_BIGGS_Y);
drawImage(tmp_g, Coords.LOADING_BAR, x, y);
Engine.clipScreen(tmp_g);
for(int i = 0; i < LOADING_BAR_HEIGHT; i++) {
tmp_g.setColor(red, green, blue);
tmp_g.fillRect(x + LOADING_BAR_X, y + LOADING_BAR_Y + i, LOADING_BAR_DIVISOR * m_loading_count + (i == 0 || i == LOADING_BAR_HEIGHT - 1 ? 0 : 1), 1);
//tira smudrievsky CRC-77
if (m_loading_count == ASSETS_TOTAL)
tmp_g.fillRect(x + LOADING_BAR_X, y + LOADING_BAR_Y + i, LOADING_BAR_WIDTH + (i == 0 || i == LOADING_BAR_HEIGHT - 1 ? 0 : 1), 1);
//<-
red -= 15;
green -= 15;
}
if(S_IMAGES[IMAGE_FONT_1] != null) {
s_current_font = CUSTOM_FONT_NORMAL;
stringBufferClear();
//stringBufferAppend(Locale.LOADING);
stringBufferAppendInt(m_loading_count * 100 / ASSETS_TOTAL);
stringBufferAppend(Locale.PERCENT);
drawStringBuffer(g, SCREEN_HALF_WIDTH, y + LOADING_BAR_Y - LOADING_BAR_TEXT_ANCHOR, Graphics.HCENTER);
}
//#else
//# fillGradient(tmp_g, 0,0, SCREEN_WIDTH, SCREEN_HEIGHT, Menus.GREEN_BACK_RGB_1, Menus.GREEN_BACK_RGB_2, Level.BG_GRADIENT_LEVELS, true);
//#
//# if(S_IMAGES[IMAGE_FONT_1] != null) {
//# s_current_font = CUSTOM_FONT_HIGHLIGHT;
//# stringBufferClear();
//# stringBufferAppend(Locale.LOADING);
//# stringBufferAppendInt(m_loading_count * 100 / ASSETS_TOTAL);
//# stringBufferAppend(Locale.PERCENT);
//# drawStringBuffer(g, SCREEN_HALF_WIDTH, LOADING_BAR_TEXT_ANCHOR, Graphics.HCENTER);
//# }
//#
//# Engine.clipScreen(tmp_g);
//# for(int i = 0; i < LOADING_BAR_HEIGHT; i++) {
//# tmp_g.setColor(red, green, blue);
//# tmp_g.fillRect(LOADING_BAR_X, LOADING_BAR_Y + i, LOADING_BAR_DIVISOR * m_loading_count + (i == 0 || i == LOADING_BAR_HEIGHT - 1 ? 0 : 1), 1);
//# red -= 15;
//# green -= 15;
//# }
//#endif
break;
case STATE_TITLE:
break;
case STATE_GAME:
Level.render(tmp_g);
break;
case STATE_INGAME_MENU:
if (Level.s_background == FULL_BYTE && m_state_timer <= 1) {
//fillScreen(tmp_g, 0,0,0); // no level loaded yet
fillGradient(tmp_g, 0,0, SCREEN_WIDTH, SCREEN_HEIGHT, Menus.GREEN_BACK_RGB_1, Menus.GREEN_BACK_RGB_2, Level.BG_GRADIENT_LEVELS, true);
}
//#if DefaultConfiguration || Nokia_6600 || Nokia_6600_Unobfuscated || Razr
else if (Menus.m_prev_engine_state==STATE_END_GAME) renderEnding(tmp_g);
else if (Level.s_type==Level.TYPE_MAINMENU) Level.render(tmp_g);
else if (Level.s_type==Level.TYPE_TUTORIAL) Level.render(tmp_g);
else if (Level.s_state==Level.STATE_SCORE) Level.render(tmp_g);
else if (Level.s_state==Level.STATE_GAME_OVER) Level.render(tmp_g);
//#endif
else if (Menus.m_prev_engine_state == STATE_END_GAME && m_state_timer <= 1) renderEnding(tmp_g);
else if (m_state_timer <= 1) Level.render(tmp_g);
Menus.render(tmp_g);
break;
case STATE_END_GAME:
renderEnding(tmp_g);
// drawLeftSoftKey(tmp_g, SOFTKEY_ACCEPT);
//tira CRC-7
//smudrievsky
drawSoftKeys(tmp_g, SOFTKEY_ACCEPT, SOFTKEY_NONE);
//<-
break;
default:
// fill screen with magenta for debugging.
fillScreen(tmp_g, 255, 0, 255);
break;
}
// draw frames per second.
debugFPS(tmp_g);
// draw a debug-indicating rectangle in the top left side of the screen.
if(TOTFC.s_cheats) {
clipScreen(tmp_g);
tmp_g.setColor(255, 0, 0);
tmp_g.fillRect(2, 2, 7, 7);
}
//#ifdef MANUAL_BUFFER
//# clipScreen(g);
//# g.drawImage(s_screen_image, 0, 0, TOP_LEFT);
//#endif
}
// Canvas -- user input filter.
protected void keyPressed(int key_code) {
// added by ychokov GFL for sinhronized actions in tutorial screen
if(s_current_action == INPUT_UP && Level.s_type == Level.TYPE_TUTORIAL && key_code == LEFT_SOFT_KEY)return;
//<--
switch(key_code) {
case SEND_KEY : s_current_action = INPUT_NONE; break;
case CLEAR_KEY:
case BACK_KEY:
case RIGHT_SOFT_KEY : s_current_action = INPUT_RIGHT_SOFT_KEY; break;
case LEFT_SOFT_KEY : s_current_action = INPUT_LEFT_SOFT_KEY; break;
case Canvas.KEY_NUM2 : s_current_action = INPUT_UP; break;
case Canvas.KEY_NUM6 : s_current_action = INPUT_RIGHT; break;
case Canvas.KEY_NUM8 : s_current_action = INPUT_DOWN; break;
case Canvas.KEY_NUM4 : s_current_action = INPUT_LEFT; break;
case Canvas.KEY_NUM5 : s_current_action = INPUT_ACTION; break;
case Canvas.KEY_NUM1 : s_current_action = INPUT_1; break;
case Canvas.KEY_NUM3 : s_current_action = INPUT_3; break;
case Canvas.KEY_NUM7 : s_current_action = INPUT_7; break;
case Canvas.KEY_NUM9 : s_current_action = INPUT_9; break;
case Canvas.KEY_NUM0 : s_current_action = INPUT_0; break;
case Canvas.KEY_STAR : s_current_action = INPUT_STAR; break;
case Canvas.KEY_POUND : s_current_action = INPUT_POUND; break;
default:
int gameAction = getGameAction(key_code);
switch(gameAction) {
case Canvas.UP : s_current_action = INPUT_UP; break;
case Canvas.RIGHT : s_current_action = INPUT_RIGHT; break;
case Canvas.DOWN : s_current_action = INPUT_DOWN; break;
case Canvas.LEFT : s_current_action = INPUT_LEFT; break;
case Canvas.FIRE : s_current_action = INPUT_ACTION; break;
}
break;
}
}
// Canvas -- user input stopped.
protected void keyReleased(int keyCode) { s_current_action = INPUT_NONE; }
/****************************************************************************
** Rendering
***************************************************************************/
public static final int IMAGE_SPLASHES = 0; // various splash screens.
public static final int IMAGE_FONT_1 = 1; // small font.
public static final int IMAGE_FONT_2 = 2; // big font.
public static final int IMAGE_GUI = 3; // sprites used by the game's GUI system.
public static final int IMAGE_BIGGS = 4; // sprites used by Biggs, the player avatar.
public static final int IMAGE_GREEN = 5; // the standard green creature.
public static final int IMAGE_RED = 6; // the standard red creature.
public static final int IMAGE_BLUE = 7; // the standard blue creature.
public static final int IMAGE_BLOCKER = 8; // blocker creature.
public static final int IMAGE_TNT = 9; // exploder creature.
public static final int IMAGE_WILDCARD = 10; // wildcard creature.
public static final int IMAGE_ORANGE = 11; // the standard orange creature.
public static final int IMAGE_PURPLE = 12; // the standard purple creature.
public static final int IMAGE_POWERUPS = 13; // generic in-game objects.
public static final int IMAGE_BG_TITLE = 14; // main title image bg.
public static final int IMAGE_BG_TUTORIAL = 15; // tutorial bg.
public static final int IMAGE_BG_PUZZLE = 16; // puzzle bg.
public static final int IMAGE_BG_TIME_TRIAL = 17; // time trial bg.
public static final int IMAGE_BG_SURVIVAL = 18; // jewel catch bg.
public static final int IMAGE_BG_EXTRAMODE = 19; // extra mode bg.
public static final int IMAGE_BG_ADVENTURE_1 = 20; // adventure 1 bg.
public static final int IMAGE_BG_ADVENTURE_2 = 21; // adventure 2 bg.
public static final int IMAGE_BG_ADVENTURE_3 = 22; // adventure 3 bg.
public static final int IMAGE_BG_ADVENTURE_4 = 23; // adventure 4 bg.
public static final int IMAGE_BG_ADVENTURE_5 = 24; // adventure 5 bg.
public static final int IMAGE_BG_ADVENTURE_6 = 25; // adventure 6 bg.
public static final int IMAGE_BG_ADVENTURE_7 = 26; // adventure 7 bg.
public static final int IMAGE_END_GAME = 27; // end game sprites
public static final int IMAGE_COUNT = 28; // total amount of images used in the game.
public static final int X = 0; // x-base of image, left side.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -