📄 menus.java
字号:
if (m_current_menu == peak()) return; // don't push the same menu twice
if (m_menu_type[m_current_menu] == MENU_TYPE_BASE) emptyStack();
//if (m_menu_type[m_current_menu] == MENU_TYPE_PROMPT) return;
//if (m_menu_type[m_current_menu] > MENU_TYPE_BASE) return; // all non-normal menus do not get stored in stack
m_menu_stack[m_current_stack_height] = (byte)m_current_menu;
m_menu_item_stack[m_current_stack_height] = (byte)m_current_menu_item;
m_menu_top_stack[m_current_stack_height] = (byte)m_current_menu_top;
m_current_stack_height++;
}
/* pop the last menu state off the stack */
public static final void pop() {
if (m_current_stack_height <= 0) return;
m_current_stack_height--;
m_next_menu = m_menu_stack[m_current_stack_height];
m_next_menu_item = m_menu_item_stack[m_current_stack_height];
m_next_menu_top = m_menu_top_stack[m_current_stack_height];
Engine.s_engine.m_state_timer = 0; // redraw background
}
/* peak at the last menu id that's on the stack */
private static final int peak() {
return (m_current_stack_height<=0 || m_current_stack_height > MAX_MENU_DEPTH) ? -1 : m_menu_stack[m_current_stack_height-1];
}
/* peak at the stacks first item */
private static final int peakBottom() {
return (m_current_stack_height<=0) ? -1 : m_menu_stack[0];
}
/* empty the stack */
public static final void emptyStack() { m_current_stack_height = 0; }
// process player's input.
public static void processInput(boolean repeat) {
//CRC-594,
//added by ychokov GFL for correct return by LSK from pause menu
if (m_current_menu == MENU_INGAME)
{
if (Engine.s_current_action == Engine.INPUT_LEFT_SOFT_KEY || Engine.s_current_action == Engine.INPUT_ACTION)
{
if (getMenuItem(m_current_menu, m_current_menu_item) == MENU_ITEM_RESUME)
{
Engine.s_current_action = Engine.INPUT_RIGHT_SOFT_KEY;
processInput(true);
return;
}
}
}
//<--
int current_menu_item_id = getMenuItem(m_current_menu, m_current_menu_item);
switch(m_menu_state) {
case MENU_STATE_NORMAL:
//if (repeat) break;
mb_go_back = false;
current_menu_item_id = getMenuItem(m_current_menu, m_current_menu_item);
switch(Engine.s_current_action) {
case Engine.INPUT_UP:
if (m_menu_type[m_current_menu] == MENU_TYPE_TEXT_BOX) {
scrollUpTextBox();
} else if (m_menu_type[m_current_menu] == MENU_TYPE_STATS) {
} else if (m_current_menu == MENU_SPECIAL_CONFIRMATION) {
//} else if (m_menu_type[m_current_menu] == MENU_TYPE_LIST) {
} else {
m_next_menu_item = getPrevItem(m_current_menu, m_current_menu_item);
scrollUpMenu();
}
break;
case Engine.INPUT_DOWN:
if (m_menu_type[m_current_menu] == MENU_TYPE_TEXT_BOX) {
scrollDownTextBox();
} else if (m_menu_type[m_current_menu] == MENU_TYPE_STATS) {
} else if (m_current_menu == MENU_SPECIAL_CONFIRMATION) {
//} else if (m_menu_type[m_current_menu] == MENU_TYPE_LIST) {
} else {
m_next_menu_item = getNextItem(m_current_menu, m_current_menu_item);
scrollDownMenu();
}
break;
case Engine.INPUT_LEFT:
case Engine.INPUT_RIGHT:
// high score screens
if (m_current_menu == MENU_SPECIAL_HIGHSCORES) {
if (Engine.s_current_action == Engine.INPUT_LEFT) scrollLeftHighscores();
else if (Engine.s_current_action == Engine.INPUT_RIGHT) scrollRightHighscores();
break;
// level select screen
} else if (m_current_menu == MENU_SPECIAL_LEVEL_SELECT && m_level_list_size > NUM_LEVELS) {
if (Engine.s_current_action == Engine.INPUT_LEFT) scrollLeftLevelSelect();
else if (Engine.s_current_action == Engine.INPUT_RIGHT) scrollRightLevelSelect();
break;
}
// toggle items (behaves like action/left soft key)
if (m_menu_item_type[current_menu_item_id] != MENU_ITEM_TYPE_TOGGLE) break;
case Engine.INPUT_ACTION:
case Engine.INPUT_LEFT_SOFT_KEY:
// special case: skip a tutorial with left soft key
if (m_menu_type[m_current_menu] == MENU_TYPE_TEXT_BOX && m_text_type != TEXT_TYPE_FULLSCREEN && Level.s_state != Level.STATE_SCORE) {
// don't treat action like left soft key here
if (Engine.mb_script_active && Engine.s_current_action == Engine.INPUT_LEFT_SOFT_KEY) {
Engine.s_engine.endScript();
m_prev_engine_state = Engine.STATE_GAME;
break;
}
else if (Engine.s_current_action == Engine.INPUT_ACTION) {
if (m_text_page<m_text_num_pages-1) {
scrollDownTextBox();
}
else {
// start the next text box if there are back to back text boxes in the tutorial
if (m_text_next!=NONE && Engine.mb_script_active) {
pop();
startTextBox(m_text_next, TEXT_TYPE_WINDOW);
Engine.m_script_position--;
m_text_next = Engine.s_engine.getNextScriptText();
if (m_text_next==NONE) Engine.m_script_position++;
}
processEvent(MENU_ITEM_RESUME);
}
break;
}
}
// special case: confirmation menu ok
if (m_current_menu == MENU_SPECIAL_CONFIRMATION) {
if (Engine.s_current_action == Engine.INPUT_LEFT_SOFT_KEY) processEvent(m_confirm_event);
break;
}
// special case: skip counting during score screen
if(m_menu_type[m_current_menu] == MENU_TYPE_STATS && !mb_skip_score) {
mb_skip_score = true;
break;
}
// special case score screen behavior
if (Level.s_state==Level.STATE_SCORE) {
if (Level.s_game_win) { // game end, start credits sequence
Engine.s_engine.initEnding();
break;
}
if (m_unlocked != NONE) {
startTextBox(m_unlocked, TEXT_TYPE_WINDOW);
m_unlocked = NONE;
} else if (m_text_page<m_text_num_pages-1) {
scrollDownTextBox();
} else if (Level.s_type==Level.TYPE_SURVIVAL) { // survival mode will bring up a restart menu
Level.s_survival_score = Level.s_current_score;
Engine.saveGameToRecordStore();
Menus.startMenu(Menus.MENU_LOSE);
Level.s_state = Level.STATE_OUTRO;
} else {
m_prev_engine_state = Engine.STATE_GAME;
Level.dropBiggsDown();
processEvent(MENU_ITEM_RESUME);
}
break;
}
if (m_menu_item_pointer[current_menu_item_id] == GO_BACK) {
pop();
}
else if (m_menu_item_pointer[current_menu_item_id] == CLOSE) {
//emptyStack(); // yes or no??
m_next_menu = CLOSE;
}
else if (m_menu_item_type[current_menu_item_id] == MENU_ITEM_TYPE_CONFIRM) {
push();
startConfirmation(current_menu_item_id);
}
else if (m_menu_item_pointer[current_menu_item_id] != m_current_menu &&
m_menu_item_pointer[current_menu_item_id] != NONE) {
push();
setMenu(m_menu_item_pointer[current_menu_item_id]);
}
else {
processEvent(current_menu_item_id); // process this event immediately if there are no special pointers
}
break;
case Engine.INPUT_RIGHT_SOFT_KEY:
//#if DefaultConfiguration || Nokia_6600 || Nokia_6600_Unobfuscated || Nokia_3220 || Nokia_3220_Unobfuscated || Razr
// make sure sound is restarted when exiting out from ingame menu
if (m_current_menu == MENU_INGAME) Engine.playSound(Engine.s_current_sound);
// also make sure sound is restarted when returning to the end game credits
if (m_current_menu == MENU_SPECIAL_CONFIRMATION && m_prev_engine_state == Engine.STATE_END_GAME) {
Engine.playSound(Engine.s_current_sound);
}
//#endif
// special case: rsk to bring up quit screen during language menu, sound menu and main menu
if (m_current_menu == MENU_LANGUAGE || m_current_menu == MENU_SOUND || m_current_menu == MENU_MAIN) {
mb_go_back = true;
push();
startConfirmation(MENU_ITEM_QUIT);
break;
}
// special case lose menu - return to title prompt
if (m_current_menu == MENU_LOSE) {
mb_go_back = true;
push();
startConfirmation(MENU_ITEM_BACK_TO_TITLE);
break;
}
// pressing right soft key to return to the game
if (m_current_stack_height == 0 && m_prev_engine_state != Engine.STATE_INGAME_MENU) {
m_next_menu = CLOSE;
// special case tutorial - bring up the ingame menu during a text box too?
if (Engine.mb_script_active && m_current_menu != MENU_INGAME) {
mb_go_back = true;
push();
setMenu(MENU_INGAME);
break;
}
// special case score screen - do nothing
if (m_menu_type[m_current_menu] == MENU_TYPE_STATS ||
(Level.s_state==Level.STATE_SCORE && m_menu_type[m_current_menu] == MENU_TYPE_TEXT_BOX) ) {
// do nothing!
m_next_menu = m_current_menu;
break;
}
// special case tutorial menu while in tutorial mode
if (Level.s_main_type != Level.TYPE_ADVENTURE && Level.s_type == Level.TYPE_TUTORIAL && !Engine.mb_script_active) {
mb_go_back = true;
push();
setMenu(MENU_INGAME);
break;
}
}
mb_go_back = true;
pop();
break;
}
break;
default:
break;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -