Merging Source v1.7.2: top-level class changes
This commit is contained in:
parent
6d177a163a
commit
92a17f392e
|
@ -39,6 +39,7 @@ public class Assets {
|
||||||
public static final String ROGUE = "rogue.png";
|
public static final String ROGUE = "rogue.png";
|
||||||
public static final String HUNTRESS = "ranger.png";
|
public static final String HUNTRESS = "ranger.png";
|
||||||
public static final String AVATARS = "avatars.png";
|
public static final String AVATARS = "avatars.png";
|
||||||
|
public static final String PET = "pet.png";
|
||||||
|
|
||||||
public static final String SURFACE = "surface.png";
|
public static final String SURFACE = "surface.png";
|
||||||
|
|
||||||
|
|
|
@ -141,6 +141,7 @@ public class Badges {
|
||||||
GAMES_PLAYED_3( "500 games played", 62, true ),
|
GAMES_PLAYED_3( "500 games played", 62, true ),
|
||||||
GAMES_PLAYED_4( "2000 games played", 63, true ),
|
GAMES_PLAYED_4( "2000 games played", 63, true ),
|
||||||
HAPPY_END( "Happy end", 38 ),
|
HAPPY_END( "Happy end", 38 ),
|
||||||
|
CHAMPION( "Challenge won", 39, true ),
|
||||||
SUPPORTER( "Thanks for your support!", 31, true );
|
SUPPORTER( "Thanks for your support!", 31, true );
|
||||||
|
|
||||||
public boolean meta;
|
public boolean meta;
|
||||||
|
@ -843,6 +844,10 @@ public class Badges {
|
||||||
public static void validateHappyEnd() {
|
public static void validateHappyEnd() {
|
||||||
displayBadge( Badge.HAPPY_END );
|
displayBadge( Badge.HAPPY_END );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void validateChampion() {
|
||||||
|
displayBadge(Badge.CHAMPION);
|
||||||
|
}
|
||||||
|
|
||||||
private static void displayBadge( Badge badge ) {
|
private static void displayBadge( Badge badge ) {
|
||||||
|
|
||||||
|
|
42
src/com/shatteredpixel/shatteredpixeldungeon/Challenges.java
Normal file
42
src/com/shatteredpixel/shatteredpixeldungeon/Challenges.java
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
/*
|
||||||
|
* Pixel Dungeon
|
||||||
|
* Copyright (C) 2012-2014 Oleg Dolya
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
package com.shatteredpixel.shatteredpixeldungeon;
|
||||||
|
|
||||||
|
public class Challenges {
|
||||||
|
|
||||||
|
public static final int NO_FOOD = 1;
|
||||||
|
public static final int NO_ARMOR = 2;
|
||||||
|
public static final int NO_HEALING = 4;
|
||||||
|
public static final int NO_HERBALISM = 8;
|
||||||
|
public static final int SWARM_INTELLIGENCE = 16;
|
||||||
|
public static final int DARKNESS = 32;
|
||||||
|
|
||||||
|
public static final String[] NAMES = {
|
||||||
|
"No food",
|
||||||
|
"No armors",
|
||||||
|
"No healing potions",
|
||||||
|
"No dew, no seeds",
|
||||||
|
"Swarm intelligence",
|
||||||
|
"Darkness"
|
||||||
|
};
|
||||||
|
|
||||||
|
public static final int[] MASKS = {
|
||||||
|
NO_FOOD, NO_ARMOR, NO_HEALING, NO_HERBALISM, SWARM_INTELLIGENCE, DARKNESS
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -31,8 +31,7 @@ public class Chrome {
|
||||||
SCROLL,
|
SCROLL,
|
||||||
TAB_SET,
|
TAB_SET,
|
||||||
TAB_SELECTED,
|
TAB_SELECTED,
|
||||||
TAB_UNSELECTED,
|
TAB_UNSELECTED
|
||||||
SURFACE
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public static NinePatch get( Type type ) {
|
public static NinePatch get( Type type ) {
|
||||||
|
@ -57,8 +56,6 @@ public class Chrome {
|
||||||
return new NinePatch( Assets.CHROME, 64, 22, 10, 14, 4, 7, 4, 6 );
|
return new NinePatch( Assets.CHROME, 64, 22, 10, 14, 4, 7, 4, 6 );
|
||||||
case TAB_UNSELECTED:
|
case TAB_UNSELECTED:
|
||||||
return new NinePatch( Assets.CHROME, 74, 22, 10, 14, 4, 7, 4, 6 );
|
return new NinePatch( Assets.CHROME, 74, 22, 10, 14, 4, 7, 4, 6 );
|
||||||
case SURFACE:
|
|
||||||
return new NinePatch( Assets.CHROME, 86, 0, 22, 22, 5 );
|
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,12 +124,13 @@ public class Dungeon {
|
||||||
public static int arcaneStyli;
|
public static int arcaneStyli;
|
||||||
public static boolean dewVial; // true if the dew vial can be spawned
|
public static boolean dewVial; // true if the dew vial can be spawned
|
||||||
public static int transmutation; // depth number for a well of transmutation
|
public static int transmutation; // depth number for a well of transmutation
|
||||||
|
|
||||||
|
public static int challenges;
|
||||||
|
|
||||||
public static Hero hero;
|
public static Hero hero;
|
||||||
public static Level level;
|
public static Level level;
|
||||||
|
|
||||||
// Either<EFBFBD> Item or Class<? extends Item>
|
// Either Item or Class<? extends Item>
|
||||||
public static Object quickslot;
|
public static Object quickslot;
|
||||||
|
|
||||||
public static int depth;
|
public static int depth;
|
||||||
|
@ -148,6 +149,8 @@ public class Dungeon {
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
|
|
||||||
|
challenges = ShatteredPixelDungeon.challenges();
|
||||||
|
|
||||||
Actor.clear();
|
Actor.clear();
|
||||||
|
|
||||||
PathFinder.setMapSize( Level.WIDTH, Level.HEIGHT );
|
PathFinder.setMapSize( Level.WIDTH, Level.HEIGHT );
|
||||||
|
@ -185,6 +188,10 @@ public class Dungeon {
|
||||||
|
|
||||||
StartScene.curClass.initHero( hero );
|
StartScene.curClass.initHero( hero );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isChallenged( int mask ) {
|
||||||
|
return (challenges & mask) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
public static Level newLevel() {
|
public static Level newLevel() {
|
||||||
|
|
||||||
|
@ -375,6 +382,7 @@ public class Dungeon {
|
||||||
private static final String RN_DEPTH_FILE = "ranger%d.dat";
|
private static final String RN_DEPTH_FILE = "ranger%d.dat";
|
||||||
|
|
||||||
private static final String VERSION = "version";
|
private static final String VERSION = "version";
|
||||||
|
private static final String CHALLENGES = "challenges";
|
||||||
private static final String HERO = "hero";
|
private static final String HERO = "hero";
|
||||||
private static final String GOLD = "gold";
|
private static final String GOLD = "gold";
|
||||||
private static final String DEPTH = "depth";
|
private static final String DEPTH = "depth";
|
||||||
|
@ -420,6 +428,7 @@ public class Dungeon {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
|
|
||||||
bundle.put( VERSION, Game.versionCode );
|
bundle.put( VERSION, Game.versionCode );
|
||||||
|
bundle.put( CHALLENGES, challenges );
|
||||||
bundle.put( HERO, hero );
|
bundle.put( HERO, hero );
|
||||||
bundle.put( GOLD, gold );
|
bundle.put( GOLD, gold );
|
||||||
bundle.put( DEPTH, depth );
|
bundle.put( DEPTH, depth );
|
||||||
|
@ -488,12 +497,8 @@ public class Dungeon {
|
||||||
Actor.fixTime();
|
Actor.fixTime();
|
||||||
saveGame( gameFile( hero.heroClass ) );
|
saveGame( gameFile( hero.heroClass ) );
|
||||||
saveLevel();
|
saveLevel();
|
||||||
|
|
||||||
GamesInProgress.set(
|
GamesInProgress.set( hero.heroClass, depth, hero.lvl );
|
||||||
hero.heroClass,
|
|
||||||
depth,
|
|
||||||
hero.lvl,
|
|
||||||
hero.belongings.armor != null ? hero.belongings.armor.tier : 0 );
|
|
||||||
|
|
||||||
} else if (WndResurrect.instance != null) {
|
} else if (WndResurrect.instance != null) {
|
||||||
|
|
||||||
|
@ -516,6 +521,8 @@ public class Dungeon {
|
||||||
Bundle bundle = gameBundle( fileName );
|
Bundle bundle = gameBundle( fileName );
|
||||||
|
|
||||||
version = bundle.getInt( VERSION );
|
version = bundle.getInt( VERSION );
|
||||||
|
|
||||||
|
Dungeon.challenges = bundle.getInt( CHALLENGES );
|
||||||
|
|
||||||
Dungeon.level = null;
|
Dungeon.level = null;
|
||||||
Dungeon.depth = -1;
|
Dungeon.depth = -1;
|
||||||
|
@ -625,7 +632,7 @@ public class Dungeon {
|
||||||
public static void preview( GamesInProgress.Info info, Bundle bundle ) {
|
public static void preview( GamesInProgress.Info info, Bundle bundle ) {
|
||||||
info.depth = bundle.getInt( DEPTH );
|
info.depth = bundle.getInt( DEPTH );
|
||||||
if (info.depth == -1) {
|
if (info.depth == -1) {
|
||||||
info.depth = bundle.getInt( "maxDepth" ); // <-- It has to be refactored!
|
info.depth = bundle.getInt( "maxDepth" ); // FIXME
|
||||||
}
|
}
|
||||||
Hero.preview( info, bundle.getBundle( HERO ) );
|
Hero.preview( info, bundle.getBundle( HERO ) );
|
||||||
}
|
}
|
||||||
|
@ -638,6 +645,11 @@ public class Dungeon {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void win( String desc ) {
|
public static void win( String desc ) {
|
||||||
|
|
||||||
|
if (challenges != 0) {
|
||||||
|
Badges.validateChampion();
|
||||||
|
}
|
||||||
|
|
||||||
resultDescription = desc;
|
resultDescription = desc;
|
||||||
Rankings.INSTANCE.submit( true );
|
Rankings.INSTANCE.submit( true );
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,11 +51,10 @@ public class GamesInProgress {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void set( HeroClass cl, int depth, int level, int armor ) {
|
public static void set( HeroClass cl, int depth, int level ) {
|
||||||
Info info = new Info();
|
Info info = new Info();
|
||||||
info.depth = depth;
|
info.depth = depth;
|
||||||
info.level = level;
|
info.level = level;
|
||||||
info.armor = armor;
|
|
||||||
state.put( cl, info );
|
state.put( cl, info );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,6 +69,5 @@ public class GamesInProgress {
|
||||||
public static class Info {
|
public static class Info {
|
||||||
public int depth;
|
public int depth;
|
||||||
public int level;
|
public int level;
|
||||||
public int armor;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,11 +26,13 @@ enum Preferences {
|
||||||
INSTANCE;
|
INSTANCE;
|
||||||
|
|
||||||
public static final String KEY_LANDSCAPE = "landscape";
|
public static final String KEY_LANDSCAPE = "landscape";
|
||||||
|
public static final String KEY_IMMERSIVE = "immersive";
|
||||||
public static final String KEY_SCALE_UP = "scaleup";
|
public static final String KEY_SCALE_UP = "scaleup";
|
||||||
public static final String KEY_MUSIC = "music";
|
public static final String KEY_MUSIC = "music";
|
||||||
public static final String KEY_SOUND_FX = "soundfx";
|
public static final String KEY_SOUND_FX = "soundfx";
|
||||||
public static final String KEY_ZOOM = "zoom";
|
public static final String KEY_ZOOM = "zoom";
|
||||||
public static final String KEY_LAST_CLASS = "last_class";
|
public static final String KEY_LAST_CLASS = "last_class";
|
||||||
|
public static final String KEY_CHALLENGES = "challenges";
|
||||||
public static final String KEY_DONATED = "donated";
|
public static final String KEY_DONATED = "donated";
|
||||||
public static final String KEY_INTRO = "intro";
|
public static final String KEY_INTRO = "intro";
|
||||||
public static final String KEY_BRIGHTNESS = "brightness";
|
public static final String KEY_BRIGHTNESS = "brightness";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user