Revision: 900
Author:
Pooch...@gmail.com
Date: Sat Nov 10 00:34:19 2012
Log: Add framework for less WTF-y mode menus
http://code.google.com/p/nullpomino/source/detail?r=900
Added:
/trunk/src/mu/nu/nullpo/game/subsystem/mode/AbstractMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/menu
/trunk/src/mu/nu/nullpo/game/subsystem/mode/menu/AbstractMenuItem.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/menu/BooleanMenuItem.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/menu/EnumMenuItem.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/menu/IntegerMenuItem.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/menu/ManiaLevelMenuItem.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/menu/OXMenuItem.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/menu/OnOffMenuItem.java
Deleted:
/trunk/src/mu/nu/nullpo/game/subsystem/mode/DummyMode.java
Modified:
/trunk/src/mu/nu/nullpo/game/subsystem/mode/Avalanche1PDummyMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/AvalancheFeverMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/AvalancheMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/AvalancheVSDummyMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/ComboRaceMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/DigChallengeMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/DigRaceMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/ExtremeMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/FinalMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/GarbageManiaMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/GemManiaMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/GradeMania2Mode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/GradeMania3Mode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/GradeManiaMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/LegacyNetVSBattleMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/LineRaceMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/MarathonMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/MarathonPlusMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/NetDummyMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/PhantomManiaMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/PhysicianMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/PhysicianVSMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/PracticeMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/PreviewMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/RetroManiaMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/RetroMarathonMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/RetroMasteryMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/SPFMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/ScoreAttackMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/ScoreRaceMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/SpeedMania2Mode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/SpeedManiaMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/SquareMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/TechnicianMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/TimeAttackMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/ToolVSMapEditMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/UltraMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/VSBattleMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/VSDigRaceMode.java
/trunk/src/mu/nu/nullpo/game/subsystem/mode/VSLineRaceMode.java
=======================================
--- /dev/null
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/AbstractMode.java Sat Nov
10 00:34:19 2012
@@ -0,0 +1,512 @@
+/*
+ Copyright (c) 2010, NullNoname
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
the
+ documentation and/or other materials provided with the
distribution.
+ * Neither the name of NullNoname nor the names of its
+ contributors may be used to endorse or promote products derived
from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+package mu.nu.nullpo.game.subsystem.mode;
+
+import java.util.ArrayList;
+
+import mu.nu.nullpo.game.component.Block;
+import mu.nu.nullpo.game.component.Controller;
+import mu.nu.nullpo.game.event.EventReceiver;
+import mu.nu.nullpo.game.play.GameEngine;
+import mu.nu.nullpo.game.play.GameManager;
+import mu.nu.nullpo.game.subsystem.mode.menu.AbstractMenuItem;
+import mu.nu.nullpo.util.CustomProperties;
+import mu.nu.nullpo.util.GeneralUtil;
+
+/**
+ * Dummy implementation of game mode. Used as a base of most game modes.
+ */
+public abstract class AbstractMode implements GameMode {
+
+ /** Total score */
+ protected static final int STAT_SCORE = 1, STAT_LINES = 2, STAT_TIME = 3,
+ STAT_LEVEL = 4, STAT_LEVEL_MANIA = 5, STAT_PIECE = 6,
+ STAT_MAXCOMBO = 7, STAT_SPL = 8, STAT_SPM = 9, STAT_SPS = 10,
+ STAT_LPM = 11, STAT_LPS = 12, STAT_PPM = 13, STAT_PPS = 14,
+ STAT_MAXCHAIN = 15, STAT_LEVEL_ADD_DISP = 16;
+
+ /** GameManager that owns this mode */
+ protected GameManager owner;
+
+ /** Drawing and event handling EventReceiver */
+ protected EventReceiver receiver;
+
+ /** Current state of menu for drawMenu */
+ protected int statcMenu, menuColor, menuY;
+
+ protected ArrayList<AbstractMenuItem> menu;
+
+ /** Name of mode in properties file */
+ protected String propName;
+
+ public AbstractMode() {
+ statcMenu = 0;
+ menuColor = EventReceiver.COLOR_WHITE;
+ menuY = 0;
+ menu = new ArrayList<AbstractMenuItem>();
+ propName = "dummy";
+ }
+
+ protected void loadSetting(CustomProperties prop) {
+ for (AbstractMenuItem i : menu)
+ i.load(-1, prop, propName);
+ }
+
+ protected void saveSetting(CustomProperties prop) {
+ for (AbstractMenuItem i : menu)
+ i.save(-1, prop, propName);
+ }
+
+ public void pieceLocked(GameEngine engine, int playerID, int lines) {
+ }
+
+ public boolean lineClearEnd(GameEngine engine, int playerID) {
+ return false;
+ }
+
+ public void afterHardDropFall(GameEngine engine, int playerID, int fall) {
+ }
+
+ public void afterSoftDropFall(GameEngine engine, int playerID, int fall) {
+ }
+
+ public void blockBreak(GameEngine engine, int playerID, int x, int y,
Block blk) {
+ }
+
+ public void calcScore(GameEngine engine, int playerID, int lines) {
+ }
+
+ public void fieldEditExit(GameEngine engine, int playerID) {}
+
+ public String getName() {
+ return "DUMMY";
+ }
+
+ public int getPlayers() {
+ return 1;
+ }
+
+ public int getGameStyle() {
+ return GameEngine.GAMESTYLE_TETROMINO;
+ }
+
+ public void loadReplay(GameEngine engine, int playerID, CustomProperties
prop) {
+ }
+
+ public void modeInit(GameManager manager) {
+ }
+
+ public boolean onARE(GameEngine engine, int playerID) {
+ return false;
+ }
+
+ public boolean onCustom(GameEngine engine, int playerID) {
+ return false;
+ }
+
+ public boolean onEndingStart(GameEngine engine, int playerID) {
+ return false;
+ }
+
+ public boolean onExcellent(GameEngine engine, int playerID) {
+ return false;
+ }
+
+ public void onFirst(GameEngine engine, int playerID) {
+ }
+
+ public boolean onGameOver(GameEngine engine, int playerID) {
+ return false;
+ }
+
+ public void onLast(GameEngine engine, int playerID) {
+ }
+
+ public boolean onLineClear(GameEngine engine, int playerID) {
+ return false;
+ }
+
+ public boolean onLockFlash(GameEngine engine, int playerID) {
+ return false;
+ }
+
+ public boolean onMove(GameEngine engine, int playerID) {
+ return false;
+ }
+
+ public boolean onReady(GameEngine engine, int playerID) {
+ return false;
+ }
+
+ public boolean onResult(GameEngine engine, int playerID) {
+ return false;
+ }
+
+ public boolean onSetting(GameEngine engine, int playerID) {
+ return false;
+ }
+
+ public boolean onFieldEdit(GameEngine engine, int playerID) {
+ return false;
+ }
+
+ public void playerInit(GameEngine engine, int playerID) {
+ owner = engine.owner;
+ receiver = engine.owner.receiver;
+ }
+
+ public void renderARE(GameEngine engine, int playerID) {
+ }
+
+ public void renderCustom(GameEngine engine, int playerID) {
+ }
+
+ public void renderEndingStart(GameEngine engine, int playerID) {
+ }
+
+ public void renderExcellent(GameEngine engine, int playerID) {
+ }
+
+ public void renderFirst(GameEngine engine, int playerID) {
+ }
+
+ public void renderGameOver(GameEngine engine, int playerID) {
+ }
+
+ public void renderLast(GameEngine engine, int playerID) {
+ }
+
+ public void renderLineClear(GameEngine engine, int playerID) {
+ }
+
+ public void renderLockFlash(GameEngine engine, int playerID) {
+ }
+
+ public void renderMove(GameEngine engine, int playerID) {
+ }
+
+ public void renderReady(GameEngine engine, int playerID) {
+ }
+
+ public void renderResult(GameEngine engine, int playerID) {
+ }
+
+ public void renderSetting(GameEngine engine, int playerID) {
+ //TODO: Multi-page menus
+ AbstractMenuItem menuItem;
+ for (int i = 0; i < menu.size(); i++)
+ {
+ menuItem = menu.get(i);
+ receiver.drawMenuFont(engine, playerID, 0, i << 1,
menuItem.displayName, menuItem.color);
+ if (engine.statc[2] == i && !engine.owner.replayMode)
+ receiver.drawMenuFont(engine, playerID, 0, (i << 1) + 1, "b" +
menuItem.getValueString(), true);
+ else
+ receiver.drawMenuFont(engine, playerID, 1, (i << 1) + 1,
menuItem.getValueString());
+ }
+ }
+
+ public void renderFieldEdit(GameEngine engine, int playerID) {
+ }
+
+ public void saveReplay(GameEngine engine, int playerID, CustomProperties
prop) {
+ }
+
+ public void startGame(GameEngine engine, int playerID) {
+ }
+
+ public boolean isNetplayMode() {
+ return false;
+ }
+
+ public boolean isVSMode() {
+ return false;
+ }
+
+ public void netplayInit(Object obj) {
+ }
+
+ public void netplayUnload(Object obj){
+ }
+
+ public void netplayOnRetryKey(GameEngine engine, int playerID) {
+ }
+
+ /**
+ * Update menu cursor
+ * @param engine GameEngine
+ * @param maxCursor Max value of cursor position
+ * @return -1 if Left key is pressed, 1 if Right key is pressed, 0
otherwise
+ */
+ protected int updateCursor(GameEngine engine, int maxCursor) {
+ return updateCursor(engine, maxCursor, 0);
+ }
+
+ /**
+ * Update menu cursor
+ * @param engine GameEngine
+ * @param maxCursor Max value of cursor position
+ * @param playerID Player ID (unused)
+ * @return -1 if Left key is pressed, 1 if Right key is pressed, 0
otherwise
+ */
+ protected int updateCursor (GameEngine engine, int maxCursor, int
playerID) {
+ // Up
+ if(engine.ctrl.isMenuRepeatKey(Controller.BUTTON_UP)) {
+ engine.statc[2]--;
+ if(engine.statc[2] < 0) engine.statc[2] = maxCursor;
+ engine.playSE("cursor");
+ }
+ // Down
+ if(engine.ctrl.isMenuRepeatKey(Controller.BUTTON_DOWN)) {
+ engine.statc[2]++;
+ if(engine.statc[2] > maxCursor) engine.statc[2] = 0;
+ engine.playSE("cursor");
+ }
+
+ // Configuration changes
+ if(engine.ctrl.isMenuRepeatKey(Controller.BUTTON_LEFT)) return -1;
+ if(engine.ctrl.isMenuRepeatKey(Controller.BUTTON_RIGHT)) return 1;
+ return 0;
+ }
+
+ protected void updateMenu(GameEngine engine) {
+ // Configuration changes
+ int change = updateCursor(engine, menu.size()-1);
+
+ if(change != 0) {
+ engine.playSE("change");
+ int fast = 0;
+ if (engine.ctrl.isPush(Controller.BUTTON_E)) fast++;
+ if (engine.ctrl.isPush(Controller.BUTTON_F)) fast += 2;
+ menu.get(engine.statc[2]).change(change, fast);
+ }
+ }
+
+ protected void initMenu (int y, int color, int statc) {
+ menuY = y;
+ menuColor = color;
+ statcMenu = statc;
+ }
+
+ protected void initMenu (int color, int statc) {
+ menuY = 0;
+ statcMenu = statc;
+ menuColor = color;
+ }
+
+ protected void drawMenu (GameEngine engine, int playerID, EventReceiver
receiver, String... str) {
+ for (int i = 0; i < str.length; i++)
+ {
+ if ((i&1) == 0)
+ receiver.drawMenuFont(engine, playerID, 0, menuY, str[i], menuColor);
+ else if (engine.statc[2] == statcMenu && !engine.owner.replayMode)
+ {
+ receiver.drawMenuFont(engine, playerID, 0, menuY, "b" + str[i], true);
+ statcMenu++;
+ }
+ else {
+ receiver.drawMenuFont(engine, playerID, 1, menuY, str[i]);
+ statcMenu++;
+ }
+ menuY++;
+ }
+ }
+
+ protected void drawMenu (GameEngine engine, int playerID, EventReceiver
receiver,
+ int y, int color, int statc, String... str) {
+ menuY = y;
+ menuColor = color;
+ statcMenu = statc;
+ drawMenu(engine, playerID, receiver, str);
+ }
+
+ protected void drawMenuCompact (GameEngine engine, int playerID,
EventReceiver receiver, String... str) {
+ for (int i = 0; i < str.length-1; i+= 2)
+ {
+ receiver.drawMenuFont(engine, playerID, 1, menuY, str[i] + ":",
menuColor);
+ if (engine.statc[2] == statcMenu && !engine.owner.replayMode)
+ {
+ receiver.drawMenuFont(engine, playerID, 0, menuY, "b", true);
+ receiver.drawMenuFont(engine, playerID, str[i].length()+2, menuY,
str[i+1], true);
+ }
+ else
+ receiver.drawMenuFont(engine, playerID, str[i].length()+2, menuY,
str[i+1]);
+ statcMenu++;
+ menuY++;
+ }
+ }
+
+ protected void drawMenuCompact (GameEngine engine, int playerID,
EventReceiver receiver,
+ int y, int color, int statc, String... str) {
+ menuY = y;
+ menuColor = color;
+ statcMenu = statc;
+ drawMenuCompact(engine, playerID, receiver, str);
+ }
+
+ protected void drawResult (GameEngine engine, int playerID, EventReceiver
receiver, int y, int color, String... str) {
+ drawResultScale(engine, playerID, receiver, y, color, 1.0f, str);
+ }
+ protected void drawResultScale (GameEngine engine, int playerID,
EventReceiver receiver, int y, int color, float scale, String... str) {
+ for (int i = 0; i < str.length; i++)
+ receiver.drawMenuFont(engine, playerID, 0, y+i, str[i], ((i&1) == 0) ?
color : EventReceiver.COLOR_WHITE, scale);
+ }
+ protected void drawResultRank (GameEngine engine, int playerID,
EventReceiver receiver, int y, int color, int rank) {
+ drawResultRankScale(engine, playerID, receiver, y, color, 1.0f, rank);
+ }
+ protected void drawResultRankScale (GameEngine engine, int playerID,
EventReceiver receiver, int y, int color, float scale, int rank) {
+ if(rank != -1) {
+ receiver.drawMenuFont(engine, playerID, 0, y, "RANK", color, scale);
+ receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10d",
rank + 1), scale);
+ }
+ }
+ protected void drawResultNetRank (GameEngine engine, int playerID,
EventReceiver receiver, int y, int color, int rank) {
+ drawResultNetRankScale(engine, playerID, receiver, y, color, 1.0f, rank);
+ }
+ protected void drawResultNetRankScale (GameEngine engine, int playerID,
EventReceiver receiver, int y, int color, float scale, int rank) {
+ if(rank != -1) {
+ receiver.drawMenuFont(engine, playerID, 0, y, "NET-RANK", color, scale);
+ receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10d",
rank + 1), scale);
+ }
+ }
+ protected void drawResultNetRankDaily(GameEngine engine, int playerID,
EventReceiver receiver, int y, int color, int rank) {
+ drawResultNetRankDailyScale(engine, playerID, receiver, y, color, 1.0f,
rank);
+ }
+ protected void drawResultNetRankDailyScale(GameEngine engine, int
playerID, EventReceiver receiver, int y, int color, float scale, int rank) {
+ if(rank != -1) {
+ receiver.drawMenuFont(engine, playerID, 0, y, "DAILY-RANK", color,
scale);
+ receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10d",
rank + 1), scale);
+ }
+ }
+ protected void drawResultStats (GameEngine engine, int playerID,
EventReceiver receiver, int y, int color, int... stats) {
+ drawResultStatsScale(engine, playerID, receiver, y, color, 1.0f, stats);
+ }
+ protected void drawResultStatsScale (GameEngine engine, int playerID,
EventReceiver receiver, int y, int color, float scale, int... stats) {
+ for (int i = 0; i < stats.length; i++)
+ {
+ switch(stats[i]) {
+ case STAT_SCORE:
+ receiver.drawMenuFont(engine, playerID, 0, y, "SCORE", color, scale);
+ receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10d",
engine.statistics.score), scale);
+ break;
+ case STAT_LINES:
+ receiver.drawMenuFont(engine, playerID, 0, y, "LINES", color, scale);
+ receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10d",
engine.statistics.lines), scale);
+ break;
+ case STAT_TIME:
+ receiver.drawMenuFont(engine, playerID, 0, y, "TIME", color, scale);
+ receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10s",
GeneralUtil.getTime(engine.statistics.time)), scale);
+ break;
+ case STAT_LEVEL:
+ receiver.drawMenuFont(engine, playerID, 0, y, "LEVEL", color, scale);
+ receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10d",
engine.statistics.level + 1), scale);
+ break;
+ case STAT_LEVEL_MANIA:
+ receiver.drawMenuFont(engine, playerID, 0, y, "LEVEL", color, scale);
+ receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10d",
engine.statistics.level), scale);
+ break;
+ case STAT_PIECE:
+ receiver.drawMenuFont(engine, playerID, 0, y, "PIECE", color, scale);
+ receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10d",
engine.statistics.totalPieceLocked), scale);
+ break;
+ case STAT_MAXCOMBO:
+ receiver.drawMenuFont(engine, playerID, 0, y, "MAX COMBO", color,
scale);
+ receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10d",
engine.statistics.maxCombo - 1), scale);
+ break;
+ case STAT_SPL:
+ receiver.drawMenuFont(engine, playerID, 0, y, "SCORE/LINE", color,
scale);
+ receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10g",
engine.statistics.spl), scale);
+ break;
+ case STAT_SPM:
+ receiver.drawMenuFont(engine, playerID, 0, y, "SCORE/MIN", color,
scale);
+ receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10g",
engine.statistics.spm), scale);
+ break;
+ case STAT_SPS:
+ receiver.drawMenuFont(engine, playerID, 0, y, "SCORE/SEC", color,
scale);
+ receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10g",
engine.statistics.sps), scale);
+ break;
+ case STAT_LPM:
+ receiver.drawMenuFont(engine, playerID, 0, y, "LINE/MIN", color,
scale);
+ receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10g",
engine.statistics.lpm), scale);
+ break;
+ case STAT_LPS:
+ receiver.drawMenuFont(engine, playerID, 0, y, "LINE/SEC", color,
scale);
+ receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10g",
engine.statistics.lps), scale);
+ break;
+ case STAT_PPM:
+ receiver.drawMenuFont(engine, playerID, 0, y, "PIECE/MIN", color,
scale);
+ receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10g",
engine.statistics.ppm), scale);
+ break;
+ case STAT_PPS:
+ receiver.drawMenuFont(engine, playerID, 0, y, "PIECE/SEC", color,
scale);
+ receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10g",
engine.statistics.pps), scale);
+ break;
+ case STAT_MAXCHAIN:
+ receiver.drawMenuFont(engine, playerID, 0, y, "MAX CHAIN", color,
scale);
+ receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10d",
engine.statistics.maxChain), scale);
+ break;
+ case STAT_LEVEL_ADD_DISP:
+ receiver.drawMenuFont(engine, playerID, 0, y, "LEVEL", color, scale);
+ receiver.drawMenuFont(engine,
playerID,0,y+1,String.format("%10d",engine.statistics.level+engine.statistics.levelDispAdd),scale);
+ break;
+ }
+ y += 2;
+ }
+ }
+
+ /**
+ * Default method to render controller input display
+ * @param engine GameEngine
+ * @param playerID Player ID
+ */
+ public void renderInput(GameEngine engine, int playerID) {
+ EventReceiver receiver = engine.owner.receiver;
+ int y = 24;
+ if (isVSMode() && !isNetplayMode()) {
+ int color = EventReceiver.COLOR_BLUE;
+ if (playerID == 0) {
+ color = EventReceiver.COLOR_RED;
+ y--;
+ }
+ receiver.drawScoreFont(engine, 0, -9, y, (playerID+1) + "P INPUT:",
color);
+ } else {
+ receiver.drawScoreFont(engine, 0, -6, y, "INPUT:",
EventReceiver.COLOR_BLUE);
+ }
+ Controller ctrl = engine.ctrl;
+ if (ctrl.isPress(Controller.BUTTON_LEFT)) receiver.drawScoreFont(engine,
0, 0, y, "<");
+ if (ctrl.isPress(Controller.BUTTON_DOWN)) receiver.drawScoreFont(engine,
0, 1, y, "n");
+ if (ctrl.isPress(Controller.BUTTON_UP)) receiver.drawScoreFont(engine,
0, 2, y, "k");
+ if (ctrl.isPress(Controller.BUTTON_RIGHT))
receiver.drawScoreFont(engine, 0, 3, y, ">");
+ if (ctrl.isPress(Controller.BUTTON_A)) receiver.drawScoreFont(engine, 0,
4, y, "A");
+ if (ctrl.isPress(Controller.BUTTON_B)) receiver.drawScoreFont(engine, 0,
5, y, "B");
+ if (ctrl.isPress(Controller.BUTTON_C)) receiver.drawScoreFont(engine, 0,
6, y, "C");
+ if (ctrl.isPress(Controller.BUTTON_D)) receiver.drawScoreFont(engine, 0,
7, y, "D");
+ if (ctrl.isPress(Controller.BUTTON_E)) receiver.drawScoreFont(engine, 0,
8, y, "E");
+ if (ctrl.isPress(Controller.BUTTON_F)) receiver.drawScoreFont(engine, 0,
9, y, "F");
+ }
+}
=======================================
--- /dev/null
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/menu/AbstractMenuItem.java
Sat Nov 10 00:34:19 2012
@@ -0,0 +1,38 @@
+package mu.nu.nullpo.game.subsystem.mode.menu;
+
+import mu.nu.nullpo.util.CustomProperties;
+
+public abstract class AbstractMenuItem<T> {
+ public final String name;
+ public final String displayName;
+ public final int color;
+ public final T DEFAULT_VALUE;
+ public T value;
+
+ public AbstractMenuItem(String name, String displayName, int color,
+ T defaultValue) {
+
this.name = name;
+ this.displayName = displayName;
+ this.color = color;
+ DEFAULT_VALUE = defaultValue;
+ value = defaultValue;
+ }
+
+ public abstract String getValueString();
+
+ /**
+ * Change the attribute
+ *
+ * @param dir
+ * Direction pressed: -1 = left, 1 = right
+ * @param fast
+ * 0 by default, +1 if E held, +2 if F held.
+ */
+ public abstract void change(int dir, int fast);
+
+ public abstract void save(int playerID, CustomProperties prop,
+ String modeName);
+
+ public abstract void load(int playerID, CustomProperties prop,
+ String modeName);
+}
=======================================
--- /dev/null
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/menu/BooleanMenuItem.java
Sat Nov 10 00:34:19 2012
@@ -0,0 +1,32 @@
+package mu.nu.nullpo.game.subsystem.mode.menu;
+
+import mu.nu.nullpo.util.CustomProperties;
+
+public class BooleanMenuItem extends AbstractMenuItem<Boolean> {
+ public BooleanMenuItem(String name, String displayName, int color,
+ boolean defaultValue) {
+ super(name, displayName, color, defaultValue);
+ }
+
+ @Override
+ public void change(int dir, int fast) {
+ value = !value;
+ }
+
+ @Override
+ public String getValueString() {
+ return String.valueOf(value).toUpperCase();
+ }
+
+ @Override
+ public void save(int playerID, CustomProperties prop, String modeName) {
+ prop.setProperty(modeName + "." + name
+ + (playerID >= 0 ? "" : ".p" + playerID), value);
+ }
+
+ @Override
+ public void load(int playerID, CustomProperties prop, String modeName) {
+ prop.getProperty(modeName + "." + name
+ + (playerID >= 0 ? "" : ".p" + playerID), DEFAULT_VALUE);
+ }
+}
=======================================
--- /dev/null
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/menu/EnumMenuItem.java Sat
Nov 10 00:34:19 2012
@@ -0,0 +1,15 @@
+package mu.nu.nullpo.game.subsystem.mode.menu;
+
+public abstract class EnumMenuItem extends IntegerMenuItem {
+ public final String[] CHOICE_NAMES;
+ public EnumMenuItem(String name, String displayName, int color, int
defaultValue,
+ String[] choiceNames) {
+ super(name, displayName, color, defaultValue,0, choiceNames.length);
+ CHOICE_NAMES = choiceNames;
+ }
+
+ @Override
+ public String getValueString() {
+ return CHOICE_NAMES[value];
+ }
+}
=======================================
--- /dev/null
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/menu/IntegerMenuItem.java
Sat Nov 10 00:34:19 2012
@@ -0,0 +1,40 @@
+package mu.nu.nullpo.game.subsystem.mode.menu;
+
+import mu.nu.nullpo.util.CustomProperties;
+
+public class IntegerMenuItem extends AbstractMenuItem<Integer> {
+ public int min, max;
+
+ public IntegerMenuItem(String name, String displayName, int color,
+ int defaultValue, int min, int max) {
+ super(name, displayName, color, defaultValue);
+ this.min = min;
+ this.max = max;
+ }
+
+ @Override
+ public void change(int dir, int fast) {
+ value += dir;
+ if (value < min)
+ value = max;
+ if (value > max)
+ value = min;
+ }
+
+ @Override
+ public void save(int playerID, CustomProperties prop, String modeName) {
+ prop.setProperty(modeName + "." + name
+ + (playerID >= 0 ? "" : ".p" + playerID), value);
+ }
+
+ @Override
+ public void load(int playerID, CustomProperties prop, String modeName) {
+ prop.getProperty(modeName + "." + name
+ + (playerID >= 0 ? "" : ".p" + playerID), DEFAULT_VALUE);
+ }
+
+ @Override
+ public String getValueString() {
+ return String.valueOf(value);
+ }
+}
=======================================
--- /dev/null
+++
/trunk/src/mu/nu/nullpo/game/subsystem/mode/menu/ManiaLevelMenuItem.java
Sat Nov 10 00:34:19 2012
@@ -0,0 +1,14 @@
+package mu.nu.nullpo.game.subsystem.mode.menu;
+
+public class ManiaLevelMenuItem extends IntegerMenuItem {
+ public int min, max;
+
+ public ManiaLevelMenuItem(String name, String displayName, int color) {
+ super(name, displayName, color, 0, 0, 9);
+ }
+
+ @Override
+ public String getValueString() {
+ return String.valueOf(value * 100);
+ }
+}
=======================================
--- /dev/null
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/menu/OXMenuItem.java Sat
Nov 10 00:34:19 2012
@@ -0,0 +1,15 @@
+package mu.nu.nullpo.game.subsystem.mode.menu;
+
+import mu.nu.nullpo.util.GeneralUtil;
+
+public class OXMenuItem extends BooleanMenuItem {
+ public OXMenuItem(String name, String displayName, int color,
+ boolean defaultValue) {
+ super(name, displayName, color, defaultValue);
+ }
+
+ @Override
+ public String getValueString() {
+ return GeneralUtil.getOorX(value);
+ }
+}
=======================================
--- /dev/null
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/menu/OnOffMenuItem.java Sat
Nov 10 00:34:19 2012
@@ -0,0 +1,15 @@
+package mu.nu.nullpo.game.subsystem.mode.menu;
+
+import mu.nu.nullpo.util.GeneralUtil;
+
+public class OnOffMenuItem extends BooleanMenuItem {
+ public OnOffMenuItem(String name, String displayName, int color,
+ boolean defaultValue) {
+ super(name, displayName, color, defaultValue);
+ }
+
+ @Override
+ public String getValueString() {
+ return GeneralUtil.getONorOFF(value);
+ }
+}
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/DummyMode.java Mon Feb 28
13:32:16 2011
+++ /dev/null
@@ -1,460 +0,0 @@
-/*
- Copyright (c) 2010, NullNoname
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
the
- documentation and/or other materials provided with the
distribution.
- * Neither the name of NullNoname nor the names of its
- contributors may be used to endorse or promote products derived
from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-package mu.nu.nullpo.game.subsystem.mode;
-
-import mu.nu.nullpo.game.component.Block;
-import mu.nu.nullpo.game.component.Controller;
-import mu.nu.nullpo.game.event.EventReceiver;
-import mu.nu.nullpo.game.play.GameEngine;
-import mu.nu.nullpo.game.play.GameManager;
-import mu.nu.nullpo.util.CustomProperties;
-import mu.nu.nullpo.util.GeneralUtil;
-
-/**
- * Dummy implementation of game mode. Used as a base of most game modes.
- */
-public class DummyMode implements GameMode {
-
- /** Total score */
- protected static final int STAT_SCORE = 1, STAT_LINES = 2, STAT_TIME = 3,
- STAT_LEVEL = 4, STAT_LEVEL_MANIA = 5, STAT_PIECE = 6,
- STAT_MAXCOMBO = 7, STAT_SPL = 8, STAT_SPM = 9, STAT_SPS = 10,
- STAT_LPM = 11, STAT_LPS = 12, STAT_PPM = 13, STAT_PPS = 14,
- STAT_MAXCHAIN = 15, STAT_LEVEL_ADD_DISP = 16;
-
- /** Current state of menu for drawMenu */
- protected int statcMenu, menuColor, menuY;
-
- public DummyMode() {
- statcMenu = 0;
- menuColor = EventReceiver.COLOR_WHITE;
- menuY = 0;
- }
-
- public void pieceLocked(GameEngine engine, int playerID, int lines) {
- }
-
- public boolean lineClearEnd(GameEngine engine, int playerID) {
- return false;
- }
-
- public void afterHardDropFall(GameEngine engine, int playerID, int fall) {
- }
-
- public void afterSoftDropFall(GameEngine engine, int playerID, int fall) {
- }
-
- public void blockBreak(GameEngine engine, int playerID, int x, int y,
Block blk) {
- }
-
- public void calcScore(GameEngine engine, int playerID, int lines) {
- }
-
- public void fieldEditExit(GameEngine engine, int playerID) {}
-
- public String getName() {
- return "DUMMY";
- }
-
- public int getPlayers() {
- return 1;
- }
-
- public int getGameStyle() {
- return GameEngine.GAMESTYLE_TETROMINO;
- }
-
- public void loadReplay(GameEngine engine, int playerID, CustomProperties
prop) {
- }
-
- public void modeInit(GameManager manager) {
- }
-
- public boolean onARE(GameEngine engine, int playerID) {
- return false;
- }
-
- public boolean onCustom(GameEngine engine, int playerID) {
- return false;
- }
-
- public boolean onEndingStart(GameEngine engine, int playerID) {
- return false;
- }
-
- public boolean onExcellent(GameEngine engine, int playerID) {
- return false;
- }
-
- public void onFirst(GameEngine engine, int playerID) {
- }
-
- public boolean onGameOver(GameEngine engine, int playerID) {
- return false;
- }
-
- public void onLast(GameEngine engine, int playerID) {
- }
-
- public boolean onLineClear(GameEngine engine, int playerID) {
- return false;
- }
-
- public boolean onLockFlash(GameEngine engine, int playerID) {
- return false;
- }
-
- public boolean onMove(GameEngine engine, int playerID) {
- return false;
- }
-
- public boolean onReady(GameEngine engine, int playerID) {
- return false;
- }
-
- public boolean onResult(GameEngine engine, int playerID) {
- return false;
- }
-
- public boolean onSetting(GameEngine engine, int playerID) {
- return false;
- }
-
- public boolean onFieldEdit(GameEngine engine, int playerID) {
- return false;
- }
-
- public void playerInit(GameEngine engine, int playerID) {
- }
-
- public void renderARE(GameEngine engine, int playerID) {
- }
-
- public void renderCustom(GameEngine engine, int playerID) {
- }
-
- public void renderEndingStart(GameEngine engine, int playerID) {
- }
-
- public void renderExcellent(GameEngine engine, int playerID) {
- }
-
- public void renderFirst(GameEngine engine, int playerID) {
- }
-
- public void renderGameOver(GameEngine engine, int playerID) {
- }
-
- public void renderLast(GameEngine engine, int playerID) {
- }
-
- public void renderLineClear(GameEngine engine, int playerID) {
- }
-
- public void renderLockFlash(GameEngine engine, int playerID) {
- }
-
- public void renderMove(GameEngine engine, int playerID) {
- }
-
- public void renderReady(GameEngine engine, int playerID) {
- }
-
- public void renderResult(GameEngine engine, int playerID) {
- }
-
- public void renderSetting(GameEngine engine, int playerID) {
- }
-
- public void renderFieldEdit(GameEngine engine, int playerID) {
- }
-
- public void saveReplay(GameEngine engine, int playerID, CustomProperties
prop) {
- }
-
- public void startGame(GameEngine engine, int playerID) {
- }
-
- public boolean isNetplayMode() {
- return false;
- }
-
- public boolean isVSMode() {
- return false;
- }
-
- public void netplayInit(Object obj) {
- }
-
- public void netplayUnload(Object obj){
- }
-
- public void netplayOnRetryKey(GameEngine engine, int playerID) {
- }
-
- /**
- * Update menu cursor
- * @param engine GameEngine
- * @param maxCursor Max value of cursor position
- * @return -1 if Left key is pressed, 1 if Right key is pressed, 0
otherwise
- */
- protected int updateCursor(GameEngine engine, int maxCursor) {
- return updateCursor(engine, maxCursor, 0);
- }
-
- /**
- * Update menu cursor
- * @param engine GameEngine
- * @param maxCursor Max value of cursor position
- * @param playerID Player ID (unused)
- * @return -1 if Left key is pressed, 1 if Right key is pressed, 0
otherwise
- */
- protected int updateCursor (GameEngine engine, int maxCursor, int
playerID) {
- // Up
- if(engine.ctrl.isMenuRepeatKey(Controller.BUTTON_UP)) {
- engine.statc[2]--;
- if(engine.statc[2] < 0) engine.statc[2] = maxCursor;
- engine.playSE("cursor");
- }
- // Down
- if(engine.ctrl.isMenuRepeatKey(Controller.BUTTON_DOWN)) {
- engine.statc[2]++;
- if(engine.statc[2] > maxCursor) engine.statc[2] = 0;
- engine.playSE("cursor");
- }
-
- // Configuration changes
- if(engine.ctrl.isMenuRepeatKey(Controller.BUTTON_LEFT)) return -1;
- if(engine.ctrl.isMenuRepeatKey(Controller.BUTTON_RIGHT)) return 1;
- return 0;
- }
-
- protected void initMenu (int y, int color, int statc) {
- menuY = y;
- menuColor = color;
- statcMenu = statc;
- }
-
- protected void initMenu (int color, int statc) {
- menuY = 0;
- statcMenu = statc;
- menuColor = color;
- }
-
- protected void drawMenu (GameEngine engine, int playerID, EventReceiver
receiver, String... str) {
- for (int i = 0; i < str.length; i++)
- {
- if ((i&1) == 0)
- receiver.drawMenuFont(engine, playerID, 0, menuY, str[i], menuColor);
- else if (engine.statc[2] == statcMenu && !engine.owner.replayMode)
- {
- receiver.drawMenuFont(engine, playerID, 0, menuY, "b" + str[i], true);
- statcMenu++;
- }
- else {
- receiver.drawMenuFont(engine, playerID, 1, menuY, str[i]);
- statcMenu++;
- }
- menuY++;
- }
- }
-
- protected void drawMenu (GameEngine engine, int playerID, EventReceiver
receiver,
- int y, int color, int statc, String... str) {
- menuY = y;
- menuColor = color;
- statcMenu = statc;
- drawMenu(engine, playerID, receiver, str);
- }
-
- protected void drawMenuCompact (GameEngine engine, int playerID,
EventReceiver receiver, String... str) {
- for (int i = 0; i < str.length-1; i+= 2)
- {
- receiver.drawMenuFont(engine, playerID, 1, menuY, str[i] + ":",
menuColor);
- if (engine.statc[2] == statcMenu && !engine.owner.replayMode)
- {
- receiver.drawMenuFont(engine, playerID, 0, menuY, "b", true);
- receiver.drawMenuFont(engine, playerID, str[i].length()+2, menuY,
str[i+1], true);
- }
- else
- receiver.drawMenuFont(engine, playerID, str[i].length()+2, menuY,
str[i+1]);
- statcMenu++;
- menuY++;
- }
- }
-
- protected void drawMenuCompact (GameEngine engine, int playerID,
EventReceiver receiver,
- int y, int color, int statc, String... str) {
- menuY = y;
- menuColor = color;
- statcMenu = statc;
- drawMenuCompact(engine, playerID, receiver, str);
- }
-
- protected void drawResult (GameEngine engine, int playerID, EventReceiver
receiver, int y, int color, String... str) {
- drawResultScale(engine, playerID, receiver, y, color, 1.0f, str);
- }
- protected void drawResultScale (GameEngine engine, int playerID,
EventReceiver receiver, int y, int color, float scale, String... str) {
- for (int i = 0; i < str.length; i++)
- receiver.drawMenuFont(engine, playerID, 0, y+i, str[i], ((i&1) == 0) ?
color : EventReceiver.COLOR_WHITE, scale);
- }
- protected void drawResultRank (GameEngine engine, int playerID,
EventReceiver receiver, int y, int color, int rank) {
- drawResultRankScale(engine, playerID, receiver, y, color, 1.0f, rank);
- }
- protected void drawResultRankScale (GameEngine engine, int playerID,
EventReceiver receiver, int y, int color, float scale, int rank) {
- if(rank != -1) {
- receiver.drawMenuFont(engine, playerID, 0, y, "RANK", color, scale);
- receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10d",
rank + 1), scale);
- }
- }
- protected void drawResultNetRank (GameEngine engine, int playerID,
EventReceiver receiver, int y, int color, int rank) {
- drawResultNetRankScale(engine, playerID, receiver, y, color, 1.0f, rank);
- }
- protected void drawResultNetRankScale (GameEngine engine, int playerID,
EventReceiver receiver, int y, int color, float scale, int rank) {
- if(rank != -1) {
- receiver.drawMenuFont(engine, playerID, 0, y, "NET-RANK", color, scale);
- receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10d",
rank + 1), scale);
- }
- }
- protected void drawResultNetRankDaily(GameEngine engine, int playerID,
EventReceiver receiver, int y, int color, int rank) {
- drawResultNetRankDailyScale(engine, playerID, receiver, y, color, 1.0f,
rank);
- }
- protected void drawResultNetRankDailyScale(GameEngine engine, int
playerID, EventReceiver receiver, int y, int color, float scale, int rank) {
- if(rank != -1) {
- receiver.drawMenuFont(engine, playerID, 0, y, "DAILY-RANK", color,
scale);
- receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10d",
rank + 1), scale);
- }
- }
- protected void drawResultStats (GameEngine engine, int playerID,
EventReceiver receiver, int y, int color, int... stats) {
- drawResultStatsScale(engine, playerID, receiver, y, color, 1.0f, stats);
- }
- protected void drawResultStatsScale (GameEngine engine, int playerID,
EventReceiver receiver, int y, int color, float scale, int... stats) {
- for (int i = 0; i < stats.length; i++)
- {
- switch(stats[i]) {
- case STAT_SCORE:
- receiver.drawMenuFont(engine, playerID, 0, y, "SCORE", color, scale);
- receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10d",
engine.statistics.score), scale);
- break;
- case STAT_LINES:
- receiver.drawMenuFont(engine, playerID, 0, y, "LINES", color, scale);
- receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10d",
engine.statistics.lines), scale);
- break;
- case STAT_TIME:
- receiver.drawMenuFont(engine, playerID, 0, y, "TIME", color, scale);
- receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10s",
GeneralUtil.getTime(engine.statistics.time)), scale);
- break;
- case STAT_LEVEL:
- receiver.drawMenuFont(engine, playerID, 0, y, "LEVEL", color, scale);
- receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10d",
engine.statistics.level + 1), scale);
- break;
- case STAT_LEVEL_MANIA:
- receiver.drawMenuFont(engine, playerID, 0, y, "LEVEL", color, scale);
- receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10d",
engine.statistics.level), scale);
- break;
- case STAT_PIECE:
- receiver.drawMenuFont(engine, playerID, 0, y, "PIECE", color, scale);
- receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10d",
engine.statistics.totalPieceLocked), scale);
- break;
- case STAT_MAXCOMBO:
- receiver.drawMenuFont(engine, playerID, 0, y, "MAX COMBO", color,
scale);
- receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10d",
engine.statistics.maxCombo - 1), scale);
- break;
- case STAT_SPL:
- receiver.drawMenuFont(engine, playerID, 0, y, "SCORE/LINE", color,
scale);
- receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10g",
engine.statistics.spl), scale);
- break;
- case STAT_SPM:
- receiver.drawMenuFont(engine, playerID, 0, y, "SCORE/MIN", color,
scale);
- receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10g",
engine.statistics.spm), scale);
- break;
- case STAT_SPS:
- receiver.drawMenuFont(engine, playerID, 0, y, "SCORE/SEC", color,
scale);
- receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10g",
engine.statistics.sps), scale);
- break;
- case STAT_LPM:
- receiver.drawMenuFont(engine, playerID, 0, y, "LINE/MIN", color,
scale);
- receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10g",
engine.statistics.lpm), scale);
- break;
- case STAT_LPS:
- receiver.drawMenuFont(engine, playerID, 0, y, "LINE/SEC", color,
scale);
- receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10g",
engine.statistics.lps), scale);
- break;
- case STAT_PPM:
- receiver.drawMenuFont(engine, playerID, 0, y, "PIECE/MIN", color,
scale);
- receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10g",
engine.statistics.ppm), scale);
- break;
- case STAT_PPS:
- receiver.drawMenuFont(engine, playerID, 0, y, "PIECE/SEC", color,
scale);
- receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10g",
engine.statistics.pps), scale);
- break;
- case STAT_MAXCHAIN:
- receiver.drawMenuFont(engine, playerID, 0, y, "MAX CHAIN", color,
scale);
- receiver.drawMenuFont(engine, playerID, 0, y+1, String.format("%10d",
engine.statistics.maxChain), scale);
- break;
- case STAT_LEVEL_ADD_DISP:
- receiver.drawMenuFont(engine, playerID, 0, y, "LEVEL", color, scale);
- receiver.drawMenuFont(engine,
playerID,0,y+1,String.format("%10d",engine.statistics.level+engine.statistics.levelDispAdd),scale);
- break;
- }
- y += 2;
- }
- }
-
- /**
- * Default method to render controller input display
- * @param engine GameEngine
- * @param playerID Player ID
- */
- public void renderInput(GameEngine engine, int playerID) {
- EventReceiver receiver = engine.owner.receiver;
- int y = 24;
- if (isVSMode() && !isNetplayMode()) {
- int color = EventReceiver.COLOR_BLUE;
- if (playerID == 0) {
- color = EventReceiver.COLOR_RED;
- y--;
- }
- receiver.drawScoreFont(engine, 0, -9, y, (playerID+1) + "P INPUT:",
color);
- } else {
- receiver.drawScoreFont(engine, 0, -6, y, "INPUT:",
EventReceiver.COLOR_BLUE);
- }
- Controller ctrl = engine.ctrl;
- if (ctrl.isPress(Controller.BUTTON_LEFT)) receiver.drawScoreFont(engine,
0, 0, y, "<");
- if (ctrl.isPress(Controller.BUTTON_DOWN)) receiver.drawScoreFont(engine,
0, 1, y, "n");
- if (ctrl.isPress(Controller.BUTTON_UP)) receiver.drawScoreFont(engine,
0, 2, y, "k");
- if (ctrl.isPress(Controller.BUTTON_RIGHT))
receiver.drawScoreFont(engine, 0, 3, y, ">");
- if (ctrl.isPress(Controller.BUTTON_A)) receiver.drawScoreFont(engine, 0,
4, y, "A");
- if (ctrl.isPress(Controller.BUTTON_B)) receiver.drawScoreFont(engine, 0,
5, y, "B");
- if (ctrl.isPress(Controller.BUTTON_C)) receiver.drawScoreFont(engine, 0,
6, y, "C");
- if (ctrl.isPress(Controller.BUTTON_D)) receiver.drawScoreFont(engine, 0,
7, y, "D");
- if (ctrl.isPress(Controller.BUTTON_E)) receiver.drawScoreFont(engine, 0,
8, y, "E");
- if (ctrl.isPress(Controller.BUTTON_F)) receiver.drawScoreFont(engine, 0,
9, y, "F");
- }
-}
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/Avalanche1PDummyMode.java
Fri Feb 18 00:18:10 2011
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/Avalanche1PDummyMode.java
Sat Nov 10 00:34:19 2012
@@ -38,7 +38,7 @@
/**
* AVALANCHE DUMMY Mode
*/
-public abstract class Avalanche1PDummyMode extends DummyMode {
+public abstract class Avalanche1PDummyMode extends AbstractMode {
/** Enabled piece types */
public static final int[] PIECE_ENABLE = {0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
0};
@@ -167,8 +167,7 @@
*/
@Override
public void playerInit(GameEngine engine, int playerID) {
- owner = engine.owner;
- receiver = engine.owner.receiver;
+ super.playerInit(engine, playerID);
lastscore = 0;
lastmultiplier = 0;
scgettime = 0;
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/AvalancheFeverMode.java Fri
Feb 18 23:13:38 2011
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/AvalancheFeverMode.java Sat
Nov 10 00:34:19 2012
@@ -660,7 +660,7 @@
* Load settings from property file
* @param prop Property file
*/
- private void loadSetting(CustomProperties prop) {
+ protected void loadSetting(CustomProperties prop) {
mapSet = prop.getProperty("avalanchefever.gametype", 0);
outlinetype = prop.getProperty("avalanchefever.outlinetype", 0);
numColors = prop.getProperty("avalanchefever.numcolors", 4);
@@ -673,7 +673,7 @@
* Save settings to property file
* @param prop Property file
*/
- private void saveSetting(CustomProperties prop) {
+ protected void saveSetting(CustomProperties prop) {
prop.setProperty("avalanchefever.gametype", mapSet);
prop.setProperty("avalanchefever.outlinetype", outlinetype);
prop.setProperty("avalanchefever.numcolors", numColors);
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/AvalancheMode.java Thu Dec
30 17:04:46 2010
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/AvalancheMode.java Sat Nov
10 00:34:19 2012
@@ -545,7 +545,7 @@
* Load settings from property file
* @param prop Property file
*/
- private void loadSetting(CustomProperties prop) {
+ protected void loadSetting(CustomProperties prop) {
gametype = prop.getProperty("avalanche.gametype", 0);
sprintTarget = prop.getProperty("avalanche.sprintTarget", 0);
scoreType = prop.getProperty("avalanche.scoreType", 0);
@@ -563,7 +563,7 @@
* Save settings to property file
* @param prop Property file
*/
- private void saveSetting(CustomProperties prop) {
+ protected void saveSetting(CustomProperties prop) {
prop.setProperty("avalanche.gametype", gametype);
prop.setProperty("avalanche.sprintTarget", sprintTarget);
prop.setProperty("avalanche.scoreType", scoreType);
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/AvalancheVSDummyMode.java
Tue Mar 1 04:39:13 2011
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/AvalancheVSDummyMode.java
Sat Nov 10 00:34:19 2012
@@ -43,7 +43,7 @@
/**
* AVALANCHE VS DUMMY Mode
*/
-public abstract class AvalancheVSDummyMode extends DummyMode {
+public abstract class AvalancheVSDummyMode extends AbstractMode {
/** Enabled piece types */
public static final int[] PIECE_ENABLE = {0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
0};
@@ -96,10 +96,8 @@
/** Each player's frame color */
public static final int[] PLAYER_COLOR_FRAME =
{GameEngine.FRAME_COLOR_RED, GameEngine.FRAME_COLOR_BLUE};
- /** GameManager that owns this mode */
protected GameManager owner;
- /** Drawing and event handling EventReceiver */
protected EventReceiver receiver;
/** Rule settings for countering ojama not yet dropped */
@@ -768,7 +766,6 @@
engine.field.setAllSkin(engine.getSkin());
engine.field.shuffleColors(BLOCK_COLORS, numColors[playerID], new
Random(rand.nextLong()));
}
-
/*
* Called after every frame
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/ComboRaceMode.java Wed Mar
30 23:13:09 2011
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/ComboRaceMode.java Sat Nov
10 00:34:19 2012
@@ -132,7 +132,6 @@
/** EventReceiver object (This receives many game events, can also be
used for drawing the fonts.) */
- private EventReceiver receiver;
/** Elapsed time from last line clear (lastscore is displayed to screen
until this reaches to 120) */
private int scgettime;
@@ -210,8 +209,7 @@
*/
@Override
public void playerInit(GameEngine engine, int playerID) {
- owner = engine.owner;
- receiver = engine.owner.receiver;
+ super.playerInit(engine, playerID);
scgettime = 0;
lastevent = EVENT_NONE;
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/DigChallengeMode.java Fri
Feb 4 02:24:07 2011
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/DigChallengeMode.java Sat
Nov 10 00:34:19 2012
@@ -60,9 +60,6 @@
/** Fall velocity table (denominators) */
private static final int tableDenominator[] = {63, 50, 39, 30, 22, 16,
12, 8, 6, 4, 3, 2, 1, 256, 256, 256, 256, 256, 256, 256};
- /** Drawing and event handling EventReceiver */
- private EventReceiver receiver;
-
/** Most recent increase in score */
private int lastscore;
@@ -154,8 +151,7 @@
*/
@Override
public void playerInit(GameEngine engine, int playerID) {
- owner = engine.owner;
- receiver = engine.owner.receiver;
+ super.playerInit(engine, playerID);
lastscore = 0;
lastbonusscore = 0;
@@ -862,7 +858,7 @@
* Load settings from property file
* @param prop Property file
*/
- private void loadSetting(CustomProperties prop) {
+ protected void loadSetting(CustomProperties prop) {
goaltype = prop.getProperty("digchallenge.goaltype", GOALTYPE_NORMAL);
startlevel = prop.getProperty("digchallenge.startlevel", 0);
bgmno = prop.getProperty("digchallenge.bgmno", 0);
@@ -880,7 +876,7 @@
* Save settings to property file
* @param prop Property file
*/
- private void saveSetting(CustomProperties prop) {
+ protected void saveSetting(CustomProperties prop) {
prop.setProperty("digchallenge.goaltype", goaltype);
prop.setProperty("digchallenge.startlevel", startlevel);
prop.setProperty("digchallenge.bgmno", bgmno);
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/DigRaceMode.java Thu Feb 24
21:33:35 2011
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/DigRaceMode.java Sat Nov 10
00:34:19 2012
@@ -59,9 +59,6 @@
/** Table of garbage lines */
private static final int[] GOAL_TABLE = {5, 10, 18};
- /** Drawing and event handling EventReceiver */
- private EventReceiver receiver;
-
/** BGM number */
private int bgmno;
@@ -102,8 +99,7 @@
*/
@Override
public void playerInit(GameEngine engine, int playerID) {
- owner = engine.owner;
- receiver = engine.owner.receiver;
+ super.playerInit(engine, playerID);
bgmno = 0;
big = false;
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/ExtremeMode.java Tue Dec 28
16:48:57 2010
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/ExtremeMode.java Sat Nov 10
00:34:19 2012
@@ -86,9 +86,6 @@
EVENT_TSPIN_TRIPLE = 11,
EVENT_TSPIN_EZ = 12;
- /** Drawing and event handling EventReceiver */
- private EventReceiver receiver;
-
/** Most recent increase in score */
private int lastscore;
@@ -171,8 +168,7 @@
*/
@Override
public void playerInit(GameEngine engine, int playerID) {
- owner = engine.owner;
- receiver = engine.owner.receiver;
+ super.playerInit(engine, playerID);
lastscore = 0;
scgettime = 0;
lastevent = EVENT_NONE;
@@ -755,7 +751,7 @@
* Load settings from property file
* @param prop Property file
*/
- private void loadSetting(CustomProperties prop) {
+ protected void loadSetting(CustomProperties prop) {
startlevel = prop.getProperty("extreme.startlevel", 0);
tspinEnableType = prop.getProperty("extreme.tspinEnableType", 1);
enableTSpin = prop.getProperty("extreme.enableTSpin", true);
@@ -773,7 +769,7 @@
* Save settings to property file
* @param prop Property file
*/
- private void saveSetting(CustomProperties prop) {
+ protected void saveSetting(CustomProperties prop) {
prop.setProperty("extreme.startlevel", startlevel);
prop.setProperty("extreme.tspinEnableType", tspinEnableType);
prop.setProperty("extreme.enableTSpin", enableTSpin);
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/FinalMode.java Mon Nov 8
08:03:55 2010
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/FinalMode.java Sat Nov 10
00:34:19 2012
@@ -39,7 +39,7 @@
/**
* FINAL mode (Original from NullpoUE build 010210 by Zircean)
*/
-public class FinalMode extends DummyMode {
+public class FinalMode extends AbstractMode {
/** Current version */
private static final int CURRENT_VERSION = 3;
@@ -82,10 +82,8 @@
private static final int DEFAULT_SECTION_TIME = 1800;
/** GameManager object (Manages entire game status) */
- private GameManager owner;
/** EventReceiver object (This receives many game events, can also be
used for drawing the fonts.) */
- private EventReceiver receiver;
/** Next section level */
private int nextseclv;
@@ -196,8 +194,7 @@
*/
@Override
public void playerInit(GameEngine engine, int playerID) {
- owner = engine.owner;
- receiver = engine.owner.receiver;
+ super.playerInit(engine, playerID);
nextseclv = 0;
lvupflag = true;
@@ -255,7 +252,7 @@
* Load the settings
* @param prop CustomProperties
*/
- private void loadSetting(CustomProperties prop) {
+ protected void loadSetting(CustomProperties prop) {
startlevel = prop.getProperty("final.startlevel", 0);
lvstopse = prop.getProperty("final.lvstopse", false);
showsectiontime = prop.getProperty("final.showsectiontime", false);
@@ -266,7 +263,7 @@
* Save the settings
* @param prop CustomProperties
*/
- private void saveSetting(CustomProperties prop) {
+ protected void saveSetting(CustomProperties prop) {
prop.setProperty("final.startlevel", startlevel);
prop.setProperty("final.lvstopse", lvstopse);
prop.setProperty("final.showsectiontime", showsectiontime);
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/GarbageManiaMode.java Mon
Nov 8 08:03:55 2010
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/GarbageManiaMode.java Sat
Nov 10 00:34:19 2012
@@ -39,7 +39,7 @@
/**
* GARBAGE MANIA Mode
*/
-public class GarbageManiaMode extends DummyMode {
+public class GarbageManiaMode extends AbstractMode {
/** Current version */
private static final int CURRENT_VERSION = 3;
@@ -139,12 +139,6 @@
{1,0,0,0,1},
};
- /** GameManager that owns this mode */
- private GameManager owner;
-
- /** Drawing and event handling EventReceiver */
- private EventReceiver receiver;
-
/** Current 落下速度の number (tableGravityChangeLevelの levelに到達するた
びに1つ増える) */
private int gravityindex;
@@ -248,8 +242,7 @@
*/
@Override
public void playerInit(GameEngine engine, int playerID) {
- owner = engine.owner;
- receiver = engine.owner.receiver;
+ super.playerInit(engine, playerID);
gravityindex = 0;
nextseclv = 0;
@@ -311,7 +304,7 @@
* Load settings from property file
* @param prop Property file
*/
- private void loadSetting(CustomProperties prop) {
+ protected void loadSetting(CustomProperties prop) {
startlevel = prop.getProperty("garbagemania.startlevel", 0);
alwaysghost = prop.getProperty("garbagemania.alwaysghost", false);
always20g = prop.getProperty("garbagemania.always20g", false);
@@ -324,7 +317,7 @@
* Save settings to property file
* @param prop Property file
*/
- private void saveSetting(CustomProperties prop) {
+ protected void saveSetting(CustomProperties prop) {
prop.setProperty("garbagemania.startlevel", startlevel);
prop.setProperty("garbagemania.alwaysghost", alwaysghost);
prop.setProperty("garbagemania.always20g", always20g);
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/GemManiaMode.java Mon Nov
8 08:03:55 2010
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/GemManiaMode.java Sat Nov
10 00:34:19 2012
@@ -43,7 +43,7 @@
/**
* GEM MANIA
*/
-public class GemManiaMode extends DummyMode {
+public class GemManiaMode extends AbstractMode {
/** Log */
static Logger log = Logger.getLogger(GemManiaMode.class);
@@ -80,12 +80,6 @@
/** Number of entries in rankings */
private static final int RANKING_MAX = 10;
- /** GameManager that owns this mode */
- private GameManager owner;
-
- /** Drawing and event handling EventReceiver */
- private EventReceiver receiver;
-
/** Stage set property file */
private CustomProperties propStageSet;
@@ -466,7 +460,7 @@
* Load settings from property file
* @param prop Property file
*/
- private void loadSetting(CustomProperties prop) {
+ protected void loadSetting(CustomProperties prop) {
startstage = prop.getProperty("gemmania.startstage", 0);
stageset = prop.getProperty("gemmania.stageset", -1);
alwaysghost = prop.getProperty("gemmania.alwaysghost", false);
@@ -482,7 +476,7 @@
* Save settings to property file
* @param prop Property file
*/
- private void saveSetting(CustomProperties prop) {
+ protected void saveSetting(CustomProperties prop) {
prop.setProperty("gemmania.startstage", startstage);
prop.setProperty("gemmania.stageset", stageset);
prop.setProperty("gemmania.alwaysghost", alwaysghost);
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/GradeMania2Mode.java Tue
Feb 15 16:04:32 2011
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/GradeMania2Mode.java Sat
Nov 10 00:34:19 2012
@@ -39,7 +39,7 @@
/**
* GRADE MANIA 2 Mode
*/
-public class GradeMania2Mode extends DummyMode {
+public class GradeMania2Mode extends AbstractMode {
/** Current version */
private static final int CURRENT_VERSION = 2;
@@ -137,12 +137,6 @@
/** Default section time */
private static final int DEFAULT_SECTION_TIME = 5400;
- /** GameManager that owns this mode */
- private GameManager owner;
-
- /** Drawing and event handling EventReceiver */
- private EventReceiver receiver;
-
/** Current 落下速度の number (tableGravityChangeLevelの levelに到達するた
びに1つ増える) */
private int gravityindex;
@@ -306,8 +300,7 @@
*/
@Override
public void playerInit(GameEngine engine, int playerID) {
- owner = engine.owner;
- receiver = engine.owner.receiver;
+ super.playerInit(engine, playerID);
gravityindex = 0;
nextseclv = 0;
@@ -386,7 +379,7 @@
* Load settings from property file
* @param prop Property file
*/
- private void loadSetting(CustomProperties prop) {
+ protected void loadSetting(CustomProperties prop) {
startlevel = prop.getProperty("grademania2.startlevel", 0);
alwaysghost = prop.getProperty("grademania2.alwaysghost", false);
always20g = prop.getProperty("grademania2.always20g", false);
@@ -399,7 +392,7 @@
* Save settings to property file
* @param prop Property file
*/
- private void saveSetting(CustomProperties prop) {
+ protected void saveSetting(CustomProperties prop) {
prop.setProperty("grademania2.startlevel", startlevel);
prop.setProperty("grademania2.alwaysghost", alwaysghost);
prop.setProperty("grademania2.always20g", always20g);
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/GradeMania3Mode.java Mon
Mar 7 17:00:56 2011
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/GradeMania3Mode.java Sat
Nov 10 00:34:19 2012
@@ -43,7 +43,7 @@
/**
* GRADE MANIA 3 Mode
*/
-public class GradeMania3Mode extends DummyMode {
+public class GradeMania3Mode extends AbstractMode {
/** Log */
static final Logger log = Logger.getLogger(GradeMania3Mode.class);
@@ -166,12 +166,6 @@
/** Default section time */
private static final int DEFAULT_SECTION_TIME = 5400;
- /** GameManager that owns this mode */
- private GameManager owner;
-
- /** Drawing and event handling EventReceiver */
- private EventReceiver receiver;
-
/** Current 落下速度の number (tableGravityChangeLevelの levelに到達するた
びに1つ増える) */
private int gravityindex;
@@ -395,8 +389,7 @@
*/
@Override
public void playerInit(GameEngine engine, int playerID) {
- owner = engine.owner;
- receiver = engine.owner.receiver;
+ super.playerInit(engine, playerID);
gravityindex = 0;
nextseclv = 0;
@@ -519,7 +512,7 @@
* Load settings from property file
* @param prop Property file
*/
- private void loadSetting(CustomProperties prop) {
+ protected void loadSetting(CustomProperties prop) {
startlevel = prop.getProperty("grademania3.startlevel", 0);
internalStartLevel = prop.getProperty("grademania3.internalLevel",
startlevel * 100);
alwaysghost = prop.getProperty("grademania3.alwaysghost", false);
@@ -537,7 +530,7 @@
* Save settings to property file
* @param prop Property file
*/
- private void saveSetting(CustomProperties prop) {
+ protected void saveSetting(CustomProperties prop) {
prop.setProperty("grademania3.startlevel", startlevel);
prop.setProperty("grademania3.internalLevel", internalStartLevel);
prop.setProperty("grademania3.alwaysghost", alwaysghost);
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/GradeManiaMode.java Mon
Nov 8 08:03:55 2010
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/GradeManiaMode.java Sat Nov
10 00:34:19 2012
@@ -32,14 +32,15 @@
import mu.nu.nullpo.game.component.Controller;
import mu.nu.nullpo.game.event.EventReceiver;
import mu.nu.nullpo.game.play.GameEngine;
-import mu.nu.nullpo.game.play.GameManager;
+import mu.nu.nullpo.game.subsystem.mode.menu.ManiaLevelMenuItem;
+import mu.nu.nullpo.game.subsystem.mode.menu.OnOffMenuItem;
import mu.nu.nullpo.util.CustomProperties;
import mu.nu.nullpo.util.GeneralUtil;
/**
* GRADE MANIA Mode
*/
-public class GradeManiaMode extends DummyMode {
+public class GradeManiaMode extends AbstractMode {
/** Current version */
private static final int CURRENT_VERSION = 1;
@@ -110,12 +111,6 @@
/** Default section time */
private static final int DEFAULT_SECTION_TIME = 5400;
- /** GameManager that owns this mode */
- private GameManager owner;
-
- /** Drawing and event handling EventReceiver */
- private EventReceiver receiver;
-
/** Current 落下速度の number (tableGravityChangeLevelの levelに到達するた
びに1つ増える) */
private int gravityindex;
@@ -211,6 +206,16 @@
/** Section Time記録 */
private int[] bestSectionTime;
+
+ public GradeManiaMode() {
+ propName = "grademania";
+ menu.add(new ManiaLevelMenuItem("startlevel", "LEVEL",
EventReceiver.COLOR_BLUE));
+ menu.add(new OnOffMenuItem("alwaysghost", "FULL GHOST",
EventReceiver.COLOR_BLUE, false));
+ menu.add(new OnOffMenuItem("always20g", "20G MODE",
EventReceiver.COLOR_BLUE, false));
+ menu.add(new OnOffMenuItem("lvstopse", "LVSTOPSE",
EventReceiver.COLOR_BLUE, false));
+ menu.add(new OnOffMenuItem("showsectiontime", "SHOW STIME",
EventReceiver.COLOR_BLUE, false));
+ menu.add(new OnOffMenuItem("big", "BIG", EventReceiver.COLOR_BLUE,
false));
+ }
/*
* Mode name
@@ -225,8 +230,7 @@
*/
@Override
public void playerInit(GameEngine engine, int playerID) {
- owner = engine.owner;
- receiver = engine.owner.receiver;
+ super.playerInit(engine, playerID);
gravityindex = 0;
nextseclv = 0;
@@ -284,32 +288,6 @@
owner.backgroundStatus.bg = startlevel;
}
-
- /**
- * Load settings from property file
- * @param prop Property file
- */
- private void loadSetting(CustomProperties prop) {
- startlevel = prop.getProperty("grademania.startlevel", 0);
- alwaysghost = prop.getProperty("grademania.alwaysghost", false);
- always20g = prop.getProperty("grademania.always20g", false);
- lvstopse = prop.getProperty("grademania.lvstopse", false);
- showsectiontime = prop.getProperty("grademania.showsectiontime", false);
- big = prop.getProperty("grademania.big", false);
- }
-
- /**
- * Save settings to property file
- * @param prop Property file
- */
- private void saveSetting(CustomProperties prop) {
- prop.setProperty("grademania.startlevel", startlevel);
- prop.setProperty("grademania.alwaysghost", alwaysghost);
- prop.setProperty("grademania.always20g", always20g);
- prop.setProperty("grademania.lvstopse", lvstopse);
- prop.setProperty("grademania.showsectiontime", showsectiontime);
- prop.setProperty("grademania.big", big);
- }
/**
* Update falling speed
@@ -356,37 +334,8 @@
@Override
public boolean onSetting(GameEngine engine, int playerID) {
// Menu
- if(engine.owner.replayMode == false) {
- // Configuration changes
- int change = updateCursor(engine, 5);
-
- if(change != 0) {
- engine.playSE("change");
-
- switch(engine.statc[2]) {
- case 0:
- startlevel += change;
- if(startlevel < 0) startlevel = 9;
- if(startlevel > 9) startlevel = 0;
-
owner.backgroundStatus.bg = startlevel;
- break;
- case 1:
- alwaysghost = !alwaysghost;
- break;
- case 2:
- always20g = !always20g;
- break;
- case 3:
- lvstopse = !lvstopse;
- break;
- case 4:
- showsectiontime = !showsectiontime;
- break;
- case 5:
- big = !big;
- break;
- }
- }
+ if(!engine.owner.replayMode) {
+ updateMenu(engine);
// section time display切替
if(engine.ctrl.isPush(Controller.BUTTON_F) && (engine.statc[3] >= 5)) {
@@ -421,20 +370,6 @@
return true;
}
-
- /*
- * Render the settings screen
- */
- @Override
- public void renderSetting(GameEngine engine, int playerID) {
- drawMenu(engine, playerID, receiver, 0, EventReceiver.COLOR_BLUE, 0,
- "LEVEL", String.valueOf(startlevel * 100),
- "FULL GHOST", GeneralUtil.getONorOFF(alwaysghost),
- "20G MODE", GeneralUtil.getONorOFF(always20g),
- "LVSTOPSE", GeneralUtil.getONorOFF(lvstopse),
- "SHOW STIME", GeneralUtil.getONorOFF(showsectiontime),
- "BIG", GeneralUtil.getONorOFF(big));
- }
/*
* Called at game start
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/LegacyNetVSBattleMode.java
Mon Feb 28 13:32:16 2011
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/LegacyNetVSBattleMode.java
Sat Nov 10 00:34:19 2012
@@ -173,9 +173,6 @@
private static int GARBAGE_DENOMINATOR = 60; // can be divided by 2,3,4,5
- /** Drawing and event handling EventReceiver */
- private EventReceiver receiver;
-
/** Current room ID */
private int currentRoomID;
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/LineRaceMode.java Thu Feb
24 21:33:35 2011
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/LineRaceMode.java Sat Nov
10 00:34:19 2012
@@ -55,9 +55,6 @@
/** Target line count constants */
private static final int[] GOAL_TABLE = {20, 40, 100};
- /** Drawing and event handling EventReceiver */
- private EventReceiver receiver;
-
/** BGM number */
private int bgmno;
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/MarathonMode.java Tue Dec
28 16:48:57 2010
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/MarathonMode.java Sat Nov
10 00:34:19 2012
@@ -80,9 +80,6 @@
EVENT_TSPIN_TRIPLE = 11,
EVENT_TSPIN_EZ = 12;
- /** Drawing and event handling EventReceiver */
- private EventReceiver receiver;
-
/** Most recent increase in score */
private int lastscore;
@@ -162,8 +159,7 @@
*/
@Override
public void playerInit(GameEngine engine, int playerID) {
- owner = engine.owner;
- receiver = engine.owner.receiver;
+ super.playerInit(engine, playerID);
lastscore = 0;
scgettime = 0;
lastevent = EVENT_NONE;
@@ -734,7 +730,7 @@
* Load settings from property file
* @param prop Property file
*/
- private void loadSetting(CustomProperties prop) {
+ protected void loadSetting(CustomProperties prop) {
startlevel = prop.getProperty("marathon.startlevel", 0);
tspinEnableType = prop.getProperty("marathon.tspinEnableType", 1);
enableTSpin = prop.getProperty("marathon.enableTSpin", true);
@@ -752,7 +748,7 @@
* Save settings to property file
* @param prop Property file
*/
- private void saveSetting(CustomProperties prop) {
+ protected void saveSetting(CustomProperties prop) {
prop.setProperty("marathon.startlevel", startlevel);
prop.setProperty("marathon.tspinEnableType", tspinEnableType);
prop.setProperty("marathon.enableTSpin", enableTSpin);
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/MarathonPlusMode.java Wed
Jan 5 03:37:43 2011
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/MarathonPlusMode.java Sat
Nov 10 00:34:19 2012
@@ -82,9 +82,6 @@
EVENT_TSPIN_TRIPLE = 11,
EVENT_TSPIN_EZ = 12;
- /** Drawing and event handling EventReceiver */
- private EventReceiver receiver;
-
/** Most recent increase in score */
private int lastscore;
@@ -173,8 +170,7 @@
*/
@Override
public void playerInit(GameEngine engine, int playerID) {
- owner = engine.owner;
- receiver = engine.owner.receiver;
+ super.playerInit(engine, playerID);
lastscore = 0;
scgettime = 0;
lastevent = EVENT_NONE;
@@ -936,7 +932,7 @@
* Load settings from property file
* @param prop Property file
*/
- private void loadSetting(CustomProperties prop) {
+ protected void loadSetting(CustomProperties prop) {
startlevel = prop.getProperty("marathonplus.startlevel", 0);
tspinEnableType = prop.getProperty("marathonplus.tspinEnableType", 1);
enableTSpin = prop.getProperty("marathonplus.enableTSpin", true);
@@ -953,7 +949,7 @@
* Save settings to property file
* @param prop Property file
*/
- private void saveSetting(CustomProperties prop) {
+ protected void saveSetting(CustomProperties prop) {
prop.setProperty("marathonplus.startlevel", startlevel);
prop.setProperty("marathonplus.tspinEnableType", tspinEnableType);
prop.setProperty("marathonplus.enableTSpin", enableTSpin);
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/NetDummyMode.java Sat Feb
26 08:19:01 2011
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/NetDummyMode.java Sat Nov
10 00:34:19 2012
@@ -33,7 +33,7 @@
/**
* Special base class for netplay
*/
-public class NetDummyMode extends DummyMode implements NetLobbyListener {
+public class NetDummyMode extends AbstractMode implements NetLobbyListener
{
/** Log (Declared in NetDummyMode) */
static Logger log = Logger.getLogger(NetDummyMode.class);
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/PhantomManiaMode.java Sun
Feb 13 02:15:56 2011
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/PhantomManiaMode.java Sat
Nov 10 00:34:19 2012
@@ -38,7 +38,7 @@
/**
* PHANTOM MANIA mode (Original from NullpoUE build 121909 by Zircean)
*/
-public class PhantomManiaMode extends DummyMode {
+public class PhantomManiaMode extends AbstractMode {
/** Current version */
private static final int CURRENT_VERSION = 1;
@@ -99,10 +99,8 @@
private static final int DEFAULT_SECTION_TIME = 3600;
/** GameManager object (Manages entire game status) */
- private GameManager owner;
/** EventReceiver object (This receives many game events, can also be
used for drawing the fonts.) */
- private EventReceiver receiver;
/** Next section level */
private int nextseclv;
@@ -234,8 +232,7 @@
*/
@Override
public void playerInit(GameEngine engine, int playerID) {
- owner = engine.owner;
- receiver = engine.owner.receiver;
+ super.playerInit(engine, playerID);
nextseclv = 0;
lvupflag = true;
@@ -303,7 +300,7 @@
/**
* Load the settings
*/
- private void loadSetting(CustomProperties prop) {
+ protected void loadSetting(CustomProperties prop) {
startlevel = prop.getProperty("phantommania.startlevel", 0);
lvstopse = prop.getProperty("phantommania.lvstopse", false);
showsectiontime = prop.getProperty("phantommania.showsectiontime", true);
@@ -313,7 +310,7 @@
/**
* Save the settings
*/
- private void saveSetting(CustomProperties prop) {
+ protected void saveSetting(CustomProperties prop) {
prop.setProperty("phantommania.startlevel", startlevel);
prop.setProperty("phantommania.lvstopse", lvstopse);
prop.setProperty("phantommania.showsectiontime", showsectiontime);
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/PhysicianMode.java Mon Nov
8 08:03:55 2010
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/PhysicianMode.java Sat Nov
10 00:34:19 2012
@@ -40,7 +40,7 @@
/**
* PHYSICIAN mode (beta)
*/
-public class PhysicianMode extends DummyMode {
+public class PhysicianMode extends AbstractMode {
/** Current version */
private static final int CURRENT_VERSION = 0;
@@ -78,10 +78,8 @@
};
/** GameManager object (Manages entire game status) */
- private GameManager owner;
/** EventReceiver object (This receives many game events, can also be
used for drawing the fonts.) */
- private EventReceiver receiver;
/** Amount of points you just get from line clears */
private int lastscore;
@@ -131,8 +129,7 @@
*/
@Override
public void playerInit(GameEngine engine, int playerID) {
- owner = engine.owner;
- receiver = engine.owner.receiver;
+ super.playerInit(engine, playerID);
lastscore = 0;
scgettime = 0;
gemsClearedChainTotal = 0;
@@ -421,7 +418,7 @@
* Load settings from property file
* @param prop Property file
*/
- private void loadSetting(CustomProperties prop) {
+ protected void loadSetting(CustomProperties prop) {
hoverBlocks = prop.getProperty("physician.hoverBlocks", 40);
speed = prop.getProperty("physician.speed", 1);
version = prop.getProperty("physician.version", 0);
@@ -431,7 +428,7 @@
* Save settings to property file
* @param prop Property file
*/
- private void saveSetting(CustomProperties prop) {
+ protected void saveSetting(CustomProperties prop) {
prop.setProperty("physician.hoverBlocks", hoverBlocks);
prop.setProperty("physician.speed", speed);
prop.setProperty("physician.version", version);
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/PhysicianVSMode.java Mon
Feb 28 13:32:16 2011
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/PhysicianVSMode.java Sat
Nov 10 00:34:19 2012
@@ -46,7 +46,7 @@
/**
* PHYSICIAN VS-BATTLE mode (beta)
*/
-public class PhysicianVSMode extends DummyMode {
+public class PhysicianVSMode extends AbstractMode {
/** Current version */
private static final int CURRENT_VERSION = 0;
@@ -86,12 +86,6 @@
/** Each player's frame color */
private final int[] PLAYER_COLOR_FRAME = {GameEngine.FRAME_COLOR_RED,
GameEngine.FRAME_COLOR_BLUE};
- /** GameManager that owns this mode */
- private GameManager owner;
-
- /** Drawing and event handling EventReceiver */
- private EventReceiver receiver;
-
/** 溜まっているojama blockのcount */
//private int[] garbage;
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/PracticeMode.java Sun Jan
2 01:49:39 2011
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/PracticeMode.java Sat Nov
10 00:34:19 2012
@@ -44,7 +44,7 @@
/**
* PRACTICE Mode
*/
-public class PracticeMode extends DummyMode {
+public class PracticeMode extends AbstractMode {
/** Log */
static Logger log = Logger.getLogger(PracticeMode.class);
@@ -94,12 +94,6 @@
/** Outline type names */
private static final String[] BLOCK_OUTLINE_TYPE_STRING =
{"NONE", "NORMAL", "CONNECT", "SAMECOLOR"};
- /** GameManager that owns this mode */
- private GameManager owner;
-
- /** Drawing and event handling EventReceiver */
- private EventReceiver receiver;
-
/** Level upまでの残り point */
private int goal;
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/PreviewMode.java Tue Feb 15
03:31:16 2011
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/PreviewMode.java Sat Nov 10
00:34:19 2012
@@ -5,7 +5,7 @@
/**
* PREVIEW mode - A game mode for Tuning preview
*/
-public class PreviewMode extends DummyMode {
+public class PreviewMode extends AbstractMode {
/*
* Mode name
*/
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/RetroManiaMode.java Mon Dec
13 04:19:53 2010
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/RetroManiaMode.java Sat Nov
10 00:34:19 2012
@@ -38,7 +38,7 @@
/**
* RETRO MANIA mode (Original from NullpoUE build 121909 by Zircean)
*/
-public class RetroManiaMode extends DummyMode {
+public class RetroManiaMode extends AbstractMode {
/** Current version */
private static final int CURRENT_VERSION = 2;
@@ -87,10 +87,8 @@
private static final int MAX_LEVEL = 99;
/** GameManager object (Manages entire game status) */
- private GameManager owner;
/** EventReceiver object (This receives many game events, can also be
used for drawing the fonts.) */
- private EventReceiver receiver;
/** Amount of points you just get from line clears */
private int lastscore;
@@ -144,8 +142,7 @@
*/
@Override
public void playerInit(GameEngine engine, int playerID) {
- owner = engine.owner;
- receiver = engine.owner.receiver;
+ super.playerInit(engine, playerID);
lastscore = 0;
scgettime = 0;
levelTimer = 0;
@@ -473,7 +470,7 @@
/**
* Load the settings
*/
- private void loadSetting(CustomProperties prop) {
+ protected void loadSetting(CustomProperties prop) {
startlevel = prop.getProperty("retromania.startlevel", 0);
gametype = prop.getProperty("retromania.gametype", 0);
big = prop.getProperty("retromania.big", false);
@@ -484,7 +481,7 @@
/**
* Save the settings
*/
- private void saveSetting(CustomProperties prop) {
+ protected void saveSetting(CustomProperties prop) {
prop.setProperty("retromania.startlevel", startlevel);
prop.setProperty("retromania.gametype", gametype);
prop.setProperty("retromania.big", big);
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/RetroMarathonMode.java Mon
Nov 8 08:03:55 2010
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/RetroMarathonMode.java Sat
Nov 10 00:34:19 2012
@@ -39,7 +39,7 @@
/**
* CLASSIC MARATHON mode (Original from NullpoUE build 010210 by Zircean)
*/
-public class RetroMarathonMode extends DummyMode {
+public class RetroMarathonMode extends AbstractMode {
/** Current version of this mode */
private static final int CURRENT_VERSION = 2;
@@ -125,10 +125,8 @@
};
/** GameManager object (Manages entire game status) */
- private GameManager owner;
/** EventReceiver object (This receives many game events, can also be
used for drawing the fonts.) */
- private EventReceiver receiver;
/** Amount of points you just get from line clears */
private int lastscore;
@@ -185,8 +183,7 @@
*/
@Override
public void playerInit(GameEngine engine, int playerID) {
- owner = engine.owner;
- receiver = engine.owner.receiver;
+ super.playerInit(engine, playerID);
lastscore = 0;
scgettime = 0;
softdropscore = 0;
@@ -540,7 +537,7 @@
* Load the settings
* @param prop CustomProperties
*/
- private void loadSetting(CustomProperties prop) {
+ protected void loadSetting(CustomProperties prop) {
gametype = prop.getProperty("retromarathon.gametype", 0);
startlevel = prop.getProperty("retromarathon.startlevel", 0);
startheight = prop.getProperty("retromarathon.startheight", 0);
@@ -552,7 +549,7 @@
* Save the settings
* @param prop CustomProperties
*/
- private void saveSetting(CustomProperties prop) {
+ protected void saveSetting(CustomProperties prop) {
prop.setProperty("retromarathon.gametype", gametype);
prop.setProperty("retromarathon.startlevel", startlevel);
prop.setProperty("retromarathon.startheight", startheight);
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/RetroMasteryMode.java Mon
Nov 8 08:03:55 2010
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/RetroMasteryMode.java Sat
Nov 10 00:34:19 2012
@@ -38,7 +38,7 @@
/**
* RETRO MASTERY mode by Pineapple 20100722 - 20100808
*/
-public class RetroMasteryMode extends DummyMode {
+public class RetroMasteryMode extends AbstractMode {
/** Current version of this mode */
private static final int CURRENT_VERSION = 1;
@@ -88,10 +88,8 @@
private static final int RANKING_TYPE = 3;
/** GameManager object (Manages entire game status) */
- private GameManager owner;
/** EventReceiver object (This receives many game events, can also be
used for drawing the fonts.) */
- private EventReceiver receiver;
/** Amount of points you just get from line clears */
private int lastscore;
@@ -533,7 +531,7 @@
* Load the settings
* @param prop CustomProperties
*/
- private void loadSetting(CustomProperties prop) {
+ protected void loadSetting(CustomProperties prop) {
gametype = prop.getProperty("retromastery.gametype", 0);
startlevel = prop.getProperty("retromastery.startlevel", 0);
big = prop.getProperty("retromastery.big", false);
@@ -544,7 +542,7 @@
* Save the settings
* @param prop CustomProperties
*/
- private void saveSetting(CustomProperties prop) {
+ protected void saveSetting(CustomProperties prop) {
prop.setProperty("retromastery.gametype", gametype);
prop.setProperty("retromastery.startlevel", startlevel);
prop.setProperty("retromastery.big", big);
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/SPFMode.java Mon Feb 28
13:32:16 2011
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/SPFMode.java Sat Nov 10
00:34:19 2012
@@ -46,7 +46,7 @@
/**
* SPF VS-BATTLE mode (Beta)
*/
-public class SPFMode extends DummyMode {
+public class SPFMode extends AbstractMode {
/** Log (Apache log4j) */
static Logger log = Logger.getLogger(SPFMode.class);
@@ -201,12 +201,6 @@
/** Each player's frame color */
private static final int[] PLAYER_COLOR_FRAME =
{GameEngine.FRAME_COLOR_RED, GameEngine.FRAME_COLOR_BLUE};
- /** GameManager that owns this mode */
- private GameManager owner;
-
- /** Drawing and event handling EventReceiver */
- private EventReceiver receiver;
-
/** 溜まっているojama blockのcount */
private int[] ojama;
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/ScoreAttackMode.java Mon
Nov 8 08:03:55 2010
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/ScoreAttackMode.java Sat
Nov 10 00:34:19 2012
@@ -38,7 +38,7 @@
/**
* SCORE ATTACK mode (Original from NullpoUE build 121909 by Zircean)
*/
-public class ScoreAttackMode extends DummyMode {
+public class ScoreAttackMode extends AbstractMode {
/** Current version */
private static final int CURRENT_VERSION = 0;
@@ -75,10 +75,8 @@
private static final int DEFAULT_SECTION_TIME = 6000;
/** GameManager object (Manages entire game status) */
- private GameManager owner;
/** EventReceiver object (This receives many game events, can also be
used for drawing the fonts.) */
- private EventReceiver receiver;
/** Current gravity index number (Increases when the level reaches to
certain value that defined in tableGravityChangeLevel) */
private int gravityindex;
@@ -174,8 +172,7 @@
*/
@Override
public void playerInit(GameEngine engine, int playerID) {
- owner = engine.owner;
- receiver = engine.owner.receiver;
+ super.playerInit(engine, playerID);
gravityindex = 0;
nextseclv = 0;
@@ -231,7 +228,7 @@
/**
* Load the settings
*/
- private void loadSetting(CustomProperties prop) {
+ protected void loadSetting(CustomProperties prop) {
startlevel = prop.getProperty("scoreattack.startlevel", 0);
alwaysghost = prop.getProperty("scoreattack.alwaysghost", false);
always20g = prop.getProperty("scoreattack.always20g", false);
@@ -243,7 +240,7 @@
/**
* Save the settings
*/
- private void saveSetting(CustomProperties prop) {
+ protected void saveSetting(CustomProperties prop) {
prop.setProperty("scoreattack.startlevel", startlevel);
prop.setProperty("scoreattack.alwaysghost", alwaysghost);
prop.setProperty("scoreattack.always20g", always20g);
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/ScoreRaceMode.java Tue Dec
28 16:48:57 2010
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/ScoreRaceMode.java Sat Nov
10 00:34:19 2012
@@ -75,9 +75,6 @@
/** Log */
static Logger log = Logger.getLogger(ScoreRaceMode.class);
- /** Drawing and event handling EventReceiver */
- private EventReceiver receiver;
-
/** Most recent increase in score */
private int lastscore;
@@ -157,8 +154,7 @@
*/
@Override
public void playerInit(GameEngine engine, int playerID) {
- owner = engine.owner;
- receiver = engine.owner.receiver;
+ super.playerInit(engine, playerID);
lastscore = 0;
scgettime = 0;
lastevent = EVENT_NONE;
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/SpeedMania2Mode.java Sat
Feb 19 23:25:06 2011
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/SpeedMania2Mode.java Sat
Nov 10 00:34:19 2012
@@ -40,7 +40,7 @@
/**
* SPEED MANIA 2 Mode
*/
-public class SpeedMania2Mode extends DummyMode {
+public class SpeedMania2Mode extends AbstractMode {
/** Current version */
private static final int CURRENT_VERSION = 2;
@@ -100,12 +100,6 @@
/** Default section time */
private static final int DEFAULT_SECTION_TIME = 2520;
- /** GameManager that owns this mode */
- private GameManager owner;
-
- /** Drawing and event handling EventReceiver */
- private EventReceiver receiver;
-
/** Next Section の level (これ-1のときに levelストップする) */
private int nextseclv;
@@ -230,8 +224,7 @@
*/
@Override
public void playerInit(GameEngine engine, int playerID) {
- owner = engine.owner;
- receiver = engine.owner.receiver;
+ super.playerInit(engine, playerID);
nextseclv = 0;
lvupflag = true;
@@ -300,7 +293,7 @@
* @param prop Property file
* @param strRuleName Rule name
*/
- private void loadSetting(CustomProperties prop, String strRuleName) {
+ protected void loadSetting(CustomProperties prop, String strRuleName) {
startlevel = prop.getProperty("speedmania2.startlevel", 0);
lvstopse = prop.getProperty("speedmania2.lvstopse", true);
showsectiontime = prop.getProperty("speedmania2.showsectiontime", false);
@@ -320,7 +313,7 @@
* @param prop Property file
* @param strRuleName Rule name
*/
- private void saveSetting(CustomProperties prop, String strRuleName) {
+ protected void saveSetting(CustomProperties prop, String strRuleName) {
prop.setProperty("speedmania2.startlevel", startlevel);
prop.setProperty("speedmania2.lvstopse", lvstopse);
prop.setProperty("speedmania2.showsectiontime", showsectiontime);
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/SpeedManiaMode.java Mon
Nov 8 08:03:55 2010
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/SpeedManiaMode.java Sat Nov
10 00:34:19 2012
@@ -38,7 +38,7 @@
/**
* SPEED MANIA Mode
*/
-public class SpeedManiaMode extends DummyMode {
+public class SpeedManiaMode extends AbstractMode {
/** Current version */
private static final int CURRENT_VERSION = 3;
@@ -86,12 +86,6 @@
/** Default section time */
private static final int DEFAULT_SECTION_TIME = 2520;
- /** GameManager that owns this mode */
- private GameManager owner;
-
- /** Drawing and event handling EventReceiver */
- private EventReceiver receiver;
-
/** Next Section の level (これ-1のときに levelストップする) */
private int nextseclv;
@@ -213,8 +207,7 @@
*/
@Override
public void playerInit(GameEngine engine, int playerID) {
- owner = engine.owner;
- receiver = engine.owner.receiver;
+ super.playerInit(engine, playerID);
nextseclv = 0;
lvupflag = true;
@@ -280,7 +273,7 @@
* Load settings from property file
* @param prop Property file
*/
- private void loadSetting(CustomProperties prop) {
+ protected void loadSetting(CustomProperties prop) {
startlevel = prop.getProperty("speedmania.startlevel", 0);
lvstopse = prop.getProperty("speedmania.lvstopse", false);
showsectiontime = prop.getProperty("speedmania.showsectiontime", false);
@@ -292,7 +285,7 @@
* Save settings to property file
* @param prop Property file
*/
- private void saveSetting(CustomProperties prop) {
+ protected void saveSetting(CustomProperties prop) {
prop.setProperty("speedmania.startlevel", startlevel);
prop.setProperty("speedmania.lvstopse", lvstopse);
prop.setProperty("speedmania.showsectiontime", showsectiontime);
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/SquareMode.java Mon Nov 8
08:03:55 2010
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/SquareMode.java Sat Nov 10
00:34:19 2012
@@ -40,7 +40,7 @@
/**
* SQUARE Mode
*/
-public class SquareMode extends DummyMode {
+public class SquareMode extends AbstractMode {
/** Current version */
private static final int CURRENT_VERSION = 1;
@@ -73,10 +73,8 @@
private static final int SPRINT_MAX_SCORE = 150;
/** GameManager object (Manages entire game status) */
- private GameManager owner;
/** EventReceiver object (This receives many game events, can also be
used for drawing the fonts.) */
- private EventReceiver receiver;
/** Current gravity number (When the point reaches
tableGravityChangeScore's value, this variable will increase) */
private int gravityindex;
@@ -133,8 +131,7 @@
*/
@Override
public void playerInit(GameEngine engine, int playerID) {
- owner = engine.owner;
- receiver = engine.owner.receiver;
+ super.playerInit(engine, playerID);
lastscore = 0;
scgettime = 0;
squares = 0;
@@ -678,7 +675,7 @@
* Load the settings from CustomProperties
* @param prop CustomProperties to read
*/
- private void loadSetting(CustomProperties prop) {
+ protected void loadSetting(CustomProperties prop) {
gametype = prop.getProperty("square.gametype", 0);
outlinetype = prop.getProperty("square.outlinetype", 0);
tspinEnableType = prop.getProperty("square.tspinEnableType", 2);
@@ -694,7 +691,7 @@
* Save the settings to CustomProperties
* @param prop CustomProperties to write
*/
- private void saveSetting(CustomProperties prop) {
+ protected void saveSetting(CustomProperties prop) {
prop.setProperty("square.gametype", gametype);
prop.setProperty("square.outlinetype", outlinetype);
prop.setProperty("square.tspinEnableType", tspinEnableType);
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/TechnicianMode.java Tue
Jan 4 04:25:21 2011
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/TechnicianMode.java Sat Nov
10 00:34:19 2012
@@ -105,9 +105,6 @@
/** Ending time */
private static final int TIMELIMIT_ROLL = 3600;
- /** Drawing and event handling EventReceiver */
- private EventReceiver receiver;
-
/** Number of Goal-points remaining */
private int goal;
@@ -211,8 +208,7 @@
*/
@Override
public void playerInit(GameEngine engine, int playerID) {
- owner = engine.owner;
- receiver = engine.owner.receiver;
+ super.playerInit(engine, playerID);
goal = 0;
levelTimer = 0;
levelTimeOut = false;
@@ -968,7 +964,7 @@
* Load settings from property file
* @param prop Property file
*/
- private void loadSetting(CustomProperties prop) {
+ protected void loadSetting(CustomProperties prop) {
goaltype = prop.getProperty("technician.gametype", 0);
startlevel = prop.getProperty("technician.startlevel", 0);
tspinEnableType = prop.getProperty("technician.tspinEnableType", 1);
@@ -986,7 +982,7 @@
* Save settings to property file
* @param prop Property file
*/
- private void saveSetting(CustomProperties prop) {
+ protected void saveSetting(CustomProperties prop) {
prop.setProperty("technician.gametype", goaltype);
prop.setProperty("technician.startlevel", startlevel);
prop.setProperty("technician.tspinEnableType", tspinEnableType);
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/TimeAttackMode.java Sun
Jan 2 01:49:39 2011
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/TimeAttackMode.java Sat Nov
10 00:34:19 2012
@@ -233,7 +233,6 @@
private static final int RANKING_TYPE = 11;
/** EventReceiver object (This receives many game events, can also be
used for drawing the fonts.) */
- private EventReceiver receiver;
/** Remaining level time */
private int levelTimer;
@@ -302,8 +301,7 @@
*/
@Override
public void playerInit(GameEngine engine, int playerID) {
- owner = engine.owner;
- receiver = engine.owner.receiver;
+ super.playerInit(engine, playerID);
norm = 0;
goaltype = 0;
@@ -984,7 +982,7 @@
* Load the settings
* @param prop CustomProperties
*/
- private void loadSetting(CustomProperties prop) {
+ protected void loadSetting(CustomProperties prop) {
goaltype = prop.getProperty("timeattack.gametype", 0);
startlevel = prop.getProperty("timeattack.startlevel", 0);
big = prop.getProperty("timeattack.big", false);
@@ -996,7 +994,7 @@
* Save the settings
* @param prop CustomProperties
*/
- private void saveSetting(CustomProperties prop) {
+ protected void saveSetting(CustomProperties prop) {
prop.setProperty("timeattack.gametype", goaltype);
prop.setProperty("timeattack.startlevel", startlevel);
prop.setProperty("timeattack.big", big);
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/ToolVSMapEditMode.java Tue
Oct 5 22:24:44 2010
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/ToolVSMapEditMode.java Sat
Nov 10 00:34:19 2012
@@ -42,12 +42,7 @@
/**
* TOOL-VS MAP EDIT
*/
-public class ToolVSMapEditMode extends DummyMode {
- /** GameManager that owns this mode */
- private GameManager owner;
-
- /** Drawing and event handling EventReceiver */
- private EventReceiver receiver;
+public class ToolVSMapEditMode extends AbstractMode {
/** Map dataの入ったProperty file */
private CustomProperties propMap;
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/UltraMode.java Tue Dec 28
16:48:57 2010
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/UltraMode.java Sat Nov 10
00:34:19 2012
@@ -68,9 +68,6 @@
EVENT_TSPIN_TRIPLE = 11,
EVENT_TSPIN_EZ = 12;
- /** Drawing and event handling EventReceiver */
- private EventReceiver receiver;
-
/** Most recent increase in score */
private int lastscore;
@@ -147,8 +144,7 @@
*/
@Override
public void playerInit(GameEngine engine, int playerID) {
- owner = engine.owner;
- receiver = engine.owner.receiver;
+ super.playerInit(engine, playerID);
lastscore = 0;
scgettime = 0;
lastevent = EVENT_NONE;
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/VSBattleMode.java Mon Feb
28 13:32:16 2011
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/VSBattleMode.java Sat Nov
10 00:34:19 2012
@@ -45,7 +45,7 @@
/**
* VS-BATTLE Mode
*/
-public class VSBattleMode extends DummyMode {
+public class VSBattleMode extends AbstractMode {
/** Current version */
private static final int CURRENT_VERSION = 5;
@@ -86,12 +86,6 @@
/** Each player's frame color */
private final int[] PLAYER_COLOR_FRAME = {GameEngine.FRAME_COLOR_RED,
GameEngine.FRAME_COLOR_BLUE};
- /** GameManager that owns this mode */
- private GameManager owner;
-
- /** Drawing and event handling EventReceiver */
- private EventReceiver receiver;
-
/** garbage blockのタイプ */
private int[] garbageType;
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/VSDigRaceMode.java Mon Feb
28 13:32:16 2011
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/VSDigRaceMode.java Sat Nov
10 00:34:19 2012
@@ -14,7 +14,7 @@
/**
* VS-DIG RACE mode
*/
-public class VSDigRaceMode extends DummyMode {
+public class VSDigRaceMode extends AbstractMode {
/** Current version */
private static final int CURRENT_VERSION = 0;
@@ -24,12 +24,6 @@
/** Each player's frame color */
private final int[] PLAYER_COLOR_FRAME = {GameEngine.FRAME_COLOR_RED,
GameEngine.FRAME_COLOR_BLUE};
- /** GameManager that owns this mode */
- private GameManager owner;
-
- /** Drawing and event handling EventReceiver */
- private EventReceiver receiver;
-
/** Number of garbage lines to clear */
private int[] goalLines;
=======================================
--- /trunk/src/mu/nu/nullpo/game/subsystem/mode/VSLineRaceMode.java Mon Feb
28 13:32:16 2011
+++ /trunk/src/mu/nu/nullpo/game/subsystem/mode/VSLineRaceMode.java Sat Nov
10 00:34:19 2012
@@ -13,7 +13,7 @@
/**
* VS-LINE RACE Mode
*/
-public class VSLineRaceMode extends DummyMode {
+public class VSLineRaceMode extends AbstractMode {
/** Current version */
private static final int CURRENT_VERSION = 0;
@@ -23,12 +23,6 @@
/** Each player's frame color */
private final int[] PLAYER_COLOR_FRAME = {GameEngine.FRAME_COLOR_RED,
GameEngine.FRAME_COLOR_BLUE};
- /** GameManager that owns this mode */
- private GameManager owner;
-
- /** Drawing and event handling EventReceiver */
- private EventReceiver receiver;
-
/** Number of lines to clear */
private int[] goalLines;