v0.9.0: overhauled visuals for badges

This commit is contained in:
Evan Debenham 2020-09-29 20:34:20 -04:00
parent cebd646636
commit 7ba15b4712
5 changed files with 140 additions and 216 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -46,48 +46,82 @@ import java.util.List;
public class Badges {
public enum Badge {
MONSTERS_SLAIN_1( 0 ),
MONSTERS_SLAIN_2( 1 ),
MONSTERS_SLAIN_3( 2 ),
MONSTERS_SLAIN_4( 3 ),
GOLD_COLLECTED_1( 4 ),
GOLD_COLLECTED_2( 5 ),
GOLD_COLLECTED_3( 6 ),
GOLD_COLLECTED_4( 7 ),
LEVEL_REACHED_1( 8 ),
LEVEL_REACHED_2( 9 ),
LEVEL_REACHED_3( 10 ),
LEVEL_REACHED_4( 11 ),
ALL_WEAPONS_IDENTIFIED( 16 ),
ALL_ARMOR_IDENTIFIED( 17 ),
ALL_WANDS_IDENTIFIED( 18 ),
ALL_RINGS_IDENTIFIED( 19 ),
ALL_ARTIFACTS_IDENTIFIED( 20 ),
ALL_POTIONS_IDENTIFIED( 21 ),
ALL_SCROLLS_IDENTIFIED( 22 ),
ALL_ITEMS_IDENTIFIED( 23, true ),
MASTERY_WARRIOR,
MASTERY_MAGE,
MASTERY_ROGUE,
MASTERY_HUNTRESS,
//bronze
UNLOCK_MAGE ( 1 ),
UNLOCK_ROGUE ( 2 ),
UNLOCK_HUNTRESS ( 3 ),
MONSTERS_SLAIN_1 ( 4 ),
MONSTERS_SLAIN_2 ( 5 ),
GOLD_COLLECTED_1 ( 6 ),
GOLD_COLLECTED_2 ( 7 ),
ITEM_LEVEL_1 ( 8 ),
LEVEL_REACHED_1 ( 9 ),
STRENGTH_ATTAINED_1 ( 10 ),
FOOD_EATEN_1 ( 11 ),
POTIONS_COOKED_1 ( 12 ),
BOSS_SLAIN_1 ( 13 ),
DEATH_FROM_FIRE ( 14 ),
DEATH_FROM_POISON ( 15 ),
DEATH_FROM_GAS ( 16 ),
DEATH_FROM_HUNGER ( 17 ),
DEATH_FROM_FALLING ( 18 ),
//silver
NO_MONSTERS_SLAIN ( 32 ),
GRIM_WEAPON ( 33 ),
MONSTERS_SLAIN_3 ( 34 ),
MONSTERS_SLAIN_4 ( 35 ),
GOLD_COLLECTED_3 ( 36 ),
GOLD_COLLECTED_4 ( 37 ),
ITEM_LEVEL_2 ( 38 ),
ITEM_LEVEL_3 ( 39 ),
LEVEL_REACHED_2 ( 40 ),
LEVEL_REACHED_3 ( 41 ),
STRENGTH_ATTAINED_2 ( 42 ),
STRENGTH_ATTAINED_3 ( 43 ),
FOOD_EATEN_2 ( 44 ),
FOOD_EATEN_3 ( 45 ),
POTIONS_COOKED_2 ( 46 ),
POTIONS_COOKED_3 ( 47 ),
BOSS_SLAIN_2 ( 48 ),
BOSS_SLAIN_3 ( 49 ),
ALL_POTIONS_IDENTIFIED ( 50 ),
ALL_SCROLLS_IDENTIFIED ( 51 ),
DEATH_FROM_GLYPH ( 52 ),
BOSS_SLAIN_1_WARRIOR,
BOSS_SLAIN_1_MAGE,
BOSS_SLAIN_1_ROGUE,
BOSS_SLAIN_1_HUNTRESS,
BOSS_SLAIN_1_ALL_CLASSES ( 53, true ),
GAMES_PLAYED_1 ( 54, true ),
//gold
PIRANHAS ( 64 ),
//these names are a bit outdated, but it doesn't really matter.
BAG_BOUGHT_SEED_POUCH,
BAG_BOUGHT_SCROLL_HOLDER,
BAG_BOUGHT_POTION_BANDOLIER,
BAG_BOUGHT_WAND_HOLSTER,
ALL_BAGS_BOUGHT( 24 ),
DEATH_FROM_FIRE( 25 ),
DEATH_FROM_POISON( 26 ),
DEATH_FROM_GAS( 27 ),
DEATH_FROM_HUNGER( 28 ),
DEATH_FROM_GLYPH( 29 ),
DEATH_FROM_FALLING( 30 ),
YASD( 31, true ),
BOSS_SLAIN_1_WARRIOR,
BOSS_SLAIN_1_MAGE,
BOSS_SLAIN_1_ROGUE,
BOSS_SLAIN_1_HUNTRESS,
BOSS_SLAIN_1( 12 ),
BOSS_SLAIN_2( 13 ),
BOSS_SLAIN_3( 14 ),
BOSS_SLAIN_4( 15 ),
BOSS_SLAIN_1_ALL_CLASSES( 32, true ),
ALL_BAGS_BOUGHT ( 65 ),
MASTERY_COMBO ( 66 ),
ITEM_LEVEL_4 ( 67 ),
LEVEL_REACHED_4 ( 68 ),
STRENGTH_ATTAINED_4 ( 69 ),
FOOD_EATEN_4 ( 70 ),
POTIONS_COOKED_4 ( 71 ),
BOSS_SLAIN_4 ( 72 ),
ALL_WEAPONS_IDENTIFIED ( 73 ),
ALL_ARMOR_IDENTIFIED ( 74 ),
ALL_WANDS_IDENTIFIED ( 75 ),
ALL_RINGS_IDENTIFIED ( 76 ),
ALL_ARTIFACTS_IDENTIFIED ( 77 ),
VICTORY ( 78 ),
YASD ( 79, true ),
BOSS_SLAIN_3_GLADIATOR,
BOSS_SLAIN_3_BERSERKER,
BOSS_SLAIN_3_WARLOCK,
@ -96,48 +130,24 @@ public class Badges {
BOSS_SLAIN_3_ASSASSIN,
BOSS_SLAIN_3_SNIPER,
BOSS_SLAIN_3_WARDEN,
BOSS_SLAIN_3_ALL_SUBCLASSES( 33, true ),
BOSS_SLAIN_3_ALL_SUBCLASSES ( 80, true ),
GAMES_PLAYED_2 ( 81, true ),
//platinum
HAPPY_END ( 96 ),
ALL_ITEMS_IDENTIFIED ( 97, true ),
VICTORY_WARRIOR,
VICTORY_MAGE,
VICTORY_ROGUE,
VICTORY_HUNTRESS,
VICTORY( 34 ),
VICTORY_ALL_CLASSES( 35, true ),
HAPPY_END( 36 ),
CHAMPION_1( 37, true ),
CHAMPION_2( 38, true ),
CHAMPION_3( 39, true ),
STRENGTH_ATTAINED_1( 40 ),
STRENGTH_ATTAINED_2( 41 ),
STRENGTH_ATTAINED_3( 42 ),
STRENGTH_ATTAINED_4( 43 ),
FOOD_EATEN_1( 44 ),
FOOD_EATEN_2( 45 ),
FOOD_EATEN_3( 46 ),
FOOD_EATEN_4( 47 ),
MASTERY_WARRIOR,
MASTERY_MAGE,
MASTERY_ROGUE,
MASTERY_HUNTRESS,
UNLOCK_MAGE( 65 ),
UNLOCK_ROGUE( 66 ),
UNLOCK_HUNTRESS( 67 ),
ITEM_LEVEL_1( 48 ),
ITEM_LEVEL_2( 49 ),
ITEM_LEVEL_3( 50 ),
ITEM_LEVEL_4( 51 ),
POTIONS_COOKED_1( 52 ),
POTIONS_COOKED_2( 53 ),
POTIONS_COOKED_3( 54 ),
POTIONS_COOKED_4( 55 ),
MASTERY_COMBO( 56 ),
NO_MONSTERS_SLAIN( 57 ),
GRIM_WEAPON( 58 ),
PIRANHAS( 59 ),
GAMES_PLAYED_1( 60, true ),
GAMES_PLAYED_2( 61, true ),
GAMES_PLAYED_3( 62, true ),
GAMES_PLAYED_4( 63, true );
VICTORY_ALL_CLASSES ( 98, true ),
GAMES_PLAYED_3 ( 99, true ),
CHAMPION_1 ( 100, true ),
//diamond
GAMES_PLAYED_4 ( 112, true ),
CHAMPION_2 ( 113, true ),
CHAMPION_3 ( 114, true );
public boolean meta;

View File

@ -22,12 +22,17 @@
package com.shatteredpixel.shatteredpixeldungeon.effects;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.watabou.gltextures.SmartTexture;
import com.watabou.gltextures.TextureCache;
import com.watabou.noosa.Game;
import com.watabou.noosa.Image;
import com.watabou.noosa.TextureFilm;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Point;
import com.watabou.utils.PointF;
import java.util.HashMap;
public class BadgeBanner extends Image {
private enum State {
@ -119,149 +124,58 @@ public class BadgeBanner extends Image {
}
super.kill();
}
//map to cache highlight positions so we don't have to keep looking at texture pixels
private static HashMap<Integer, Point> highlightPositions = new HashMap<>();
//we also hardcode any special cases
static {
//combo master
highlightPositions.put(66, new Point(3, 7));
}
//adds a shine to an appropriate pixel on a badge
public static void highlight( Image image, int index ) {
PointF p = new PointF();
switch (index) {
case 0:
case 1:
case 2:
case 3:
p.offset( 7, 3 );
break;
case 4:
case 5:
case 6:
case 7:
p.offset( 6, 5 );
break;
case 8:
case 9:
case 10:
case 11:
p.offset( 6, 3 );
break;
case 12:
case 13:
case 14:
case 15:
p.offset( 7, 4 );
break;
case 16:
p.offset( 6, 3 );
break;
case 17:
p.offset( 5, 4 );
break;
case 18:
p.offset( 7, 3 );
break;
case 20:
p.offset( 7, 3 );
break;
case 21:
p.offset( 7, 3 );
break;
case 22:
p.offset( 6, 4 );
break;
case 23:
p.offset( 4, 5 );
break;
case 24:
p.offset( 6, 4 );
break;
case 25:
p.offset( 6, 5 );
break;
case 26:
p.offset( 5, 5 );
break;
case 27:
p.offset( 6, 4 );
break;
case 28:
p.offset( 3, 5 );
break;
case 29:
p.offset( 5, 4 );
break;
case 30:
p.offset( 5, 4 );
break;
case 31:
p.offset( 5, 5 );
break;
case 32:
case 33:
p.offset( 7, 4 );
break;
case 34:
p.offset( 6, 4 );
break;
case 35:
p.offset( 6, 4 );
break;
case 36:
p.offset( 6, 5 );
break;
case 37:
p.offset( 4, 4 );
break;
case 38:
p.offset( 5, 5 );
break;
case 39:
p.offset( 5, 4 );
break;
case 40:
case 41:
case 42:
case 43:
p.offset( 5, 4 );
break;
case 44:
case 45:
case 46:
case 47:
p.offset( 5, 5 );
break;
case 48:
case 49:
case 50:
case 51:
p.offset( 7, 4 );
break;
case 52:
case 53:
case 54:
case 55:
p.offset( 4, 4 );
break;
case 56:
p.offset( 3, 7 );
break;
case 57:
p.offset( 4, 5 );
break;
case 58:
p.offset( 6, 4 );
break;
case 59:
p.offset( 7, 4 );
break;
case 60:
case 61:
case 62:
case 63:
p.offset( 4, 4 );
break;
if (highlightPositions.containsKey(index)){
p.x = highlightPositions.get(index).x * image.scale.x;
p.y = highlightPositions.get(index).y * image.scale.y;
} else {
SmartTexture tx = TextureCache.get(Assets.Interfaces.BADGES);
int size = 16;
int cols = tx.width / size;
int row = index / cols;
int col = index % cols;
int x = 3;
int y = 4;
int bgColor = tx.getPixel(col * size + x, row * size + y);
int curColor = 0;
for (x = 3; x <= 12; x++) {
curColor = tx.getPixel(col * size + x, row * size + y);
if (curColor != bgColor) break;
}
if (curColor == bgColor) {
y++;
for (x = 3; x <= 12; x++) {
curColor = tx.getPixel(col * size + x, row * size + y);
if (curColor != bgColor) break;
}
}
p.x = x * image.scale.x;
p.y = y * image.scale.y;
highlightPositions.put(index, new Point(x, y));
}
p.x *= image.scale.x;
p.y *= image.scale.y;
p.offset(
-image.origin.x * (image.scale.x - 1),
-image.origin.y * (image.scale.y - 1) );

View File

@ -144,7 +144,7 @@ public class BadgesScene extends PixelScene {
icon = BadgeBanner.image(badge.image);
if (!unlocked) {
icon.brightness(0.25f);
icon.brightness(0.4f);
}
add(icon);

View File

@ -39,7 +39,7 @@ public class WndBadge extends Window {
Image icon = BadgeBanner.image( badge.image );
icon.scale.set( 2 );
if (!unlocked) icon.brightness(0.52f);
if (!unlocked) icon.brightness(0.4f);
add( icon );
RenderedTextBlock info = PixelScene.renderTextBlock( badge.desc(), 8 );