From da42665e80227bfd978613303edfd32f113495d1 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 25 Jun 2024 16:19:52 -0400 Subject: [PATCH] v2.5.0: added landmark functionality for level feelings --- .../assets/messages/levels/levels.properties | 15 +++++ .../assets/messages/scenes/scenes.properties | 7 -- .../shatteredpixeldungeon/journal/Notes.java | 64 +++++++++++++++++-- .../shatteredpixeldungeon/levels/Level.java | 10 ++- .../scenes/GameScene.java | 36 +++++++++-- .../shatteredpixeldungeon/ui/MenuPane.java | 27 ++++---- 6 files changed, 129 insertions(+), 30 deletions(-) diff --git a/core/src/main/assets/messages/levels/levels.properties b/core/src/main/assets/messages/levels/levels.properties index 5109be740..4f3aa3001 100644 --- a/core/src/main/assets/messages/levels/levels.properties +++ b/core/src/main/assets/messages/levels/levels.properties @@ -231,6 +231,21 @@ levels.level.statue_desc=Someone wanted to adorn this place, but failed, obvious levels.level.alchemy_desc=This pot is filled with magical water. Items can be mixed into the pot to create something new! levels.level.empty_well_desc=The well has run dry. +levels.level$feeling.chasm_title=Chasm Floor +levels.level$feeling.water_title=Water Floor +levels.level$feeling.grass_title=Grass Floor +levels.level$feeling.dark_title=Dark Floor +levels.level$feeling.large_title=Large Floor +levels.level$feeling.traps_title=Traps Floor +levels.level$feeling.secrets_title=Secrets Floor +levels.level$feeling.chasm_desc=Your steps echo across the dungeon. +levels.level$feeling.water_desc=You hear water splashing around you. +levels.level$feeling.grass_desc=The smell of vegetation is thick in the air. +levels.level$feeling.dark_desc=You can hear enemies moving in the darkness. +levels.level$feeling.large_desc=This dungeon floor seems unusually large. +levels.level$feeling.traps_desc=The ground seems especially treacherous here. +levels.level$feeling.secrets_desc=The atmosphere hints that this floor hides many secrets. + levels.mininglevel.wall_desc=A smooth rock wall that's a little softer than usual. You can mine through it with your pickaxe, but it'll take some effort and increase your hunger a bit. levels.mininglevel.gold_extra_desc=You can probably mine it out with your pickaxe. levels.mininglevel.crystal_name=Crystal spike diff --git a/core/src/main/assets/messages/scenes/scenes.properties b/core/src/main/assets/messages/scenes/scenes.properties index 4e72e583f..b073754fd 100644 --- a/core/src/main/assets/messages/scenes/scenes.properties +++ b/core/src/main/assets/messages/scenes/scenes.properties @@ -36,13 +36,6 @@ scenes.gamescene.warp=The walls warp and shift around you! scenes.gamescene.return=You return to floor %d of the dungeon. scenes.gamescene.resurrect=You materialize somewhere on floor %d. scenes.gamescene.secret_hint=You're certain that there's a secret room somewhere on this floor. -scenes.gamescene.chasm=Your steps echo across the dungeon. -scenes.gamescene.water=You hear water splashing around you. -scenes.gamescene.grass=The smell of vegetation is thick in the air. -scenes.gamescene.dark=You can hear enemies moving in the darkness. -scenes.gamescene.large=This dungeon floor seems unusually large. -scenes.gamescene.traps=The ground seems especially treacherous here. -scenes.gamescene.secrets=The atmosphere hints that this floor hides many secrets. scenes.gamescene.choose_examine=Choose Examine scenes.gamescene.multiple_examine=There are multiple things of interest here, which one do you want to examine? scenes.gamescene.dont_know=You don't know what is there. diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Notes.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Notes.java index 334061aa9..92f9cc7f8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Notes.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/journal/Notes.java @@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.journal; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.items.keys.Key; +import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.BlacksmithSprite; @@ -85,7 +86,13 @@ public class Notes { } public enum Landmark { - //a landmark for each depth type + CHASM_FLOOR, + WATER_FLOOR, + GRASS_FLOOR, + DARK_FLOOR, + LARGE_FLOOR, + TRAPS_FLOOR, + SECRETS_FLOOR, //more special room landmarks? // distant well @@ -124,7 +131,38 @@ public class Notes { public Image icon(){ switch (landmark){ default: - return super.icon(); + return Icons.STAIRS.get(); + + //TODO using a 2x bloated sprite isn't ideal.. + // but I want them to visually match what's in the game scene + case CHASM_FLOOR: + Image result = Icons.DEPTH_CHASM.get(); + result.scale.set(2f); + return result; + case WATER_FLOOR: + result = Icons.DEPTH_WATER.get(); + result.scale.set(2f); + return result; + case GRASS_FLOOR: + result = Icons.DEPTH_GRASS.get(); + result.scale.set(2f); + return result; + case DARK_FLOOR: + result = Icons.DEPTH_DARK.get(); + result.scale.set(2f); + return result; + case LARGE_FLOOR: + result = Icons.DEPTH_LARGE.get(); + result.scale.set(2f); + return result; + case TRAPS_FLOOR: + result = Icons.DEPTH_TRAPS.get(); + result.scale.set(2f); + return result; + case SECRETS_FLOOR: + result = Icons.DEPTH_SECRETS.get(); + result.scale.set(2f); + return result; case WELL_OF_HEALTH: return Icons.get(Icons.WELL_HEALTH); @@ -157,12 +195,30 @@ public class Notes { @Override public String title() { - return landmark.title(); + switch (landmark) { + default: landmark.title(); + case CHASM_FLOOR: return Messages.get(Level.Feeling.class, "chasm_title"); + case WATER_FLOOR: return Messages.get(Level.Feeling.class, "water_title"); + case GRASS_FLOOR: return Messages.get(Level.Feeling.class, "grass_title"); + case DARK_FLOOR: return Messages.get(Level.Feeling.class, "dark_title"); + case LARGE_FLOOR: return Messages.get(Level.Feeling.class, "large_title"); + case TRAPS_FLOOR: return Messages.get(Level.Feeling.class, "traps_title"); + case SECRETS_FLOOR: return Messages.get(Level.Feeling.class, "secrets_title"); + } } @Override public String desc() { - return ""; + switch (landmark) { + default: return ""; + case CHASM_FLOOR: return Messages.get(Level.Feeling.class, "chasm_desc"); + case WATER_FLOOR: return Messages.get(Level.Feeling.class, "water_desc"); + case GRASS_FLOOR: return Messages.get(Level.Feeling.class, "grass_desc"); + case DARK_FLOOR: return Messages.get(Level.Feeling.class, "dark_desc"); + case LARGE_FLOOR: return Messages.get(Level.Feeling.class, "large_desc"); + case TRAPS_FLOOR: return Messages.get(Level.Feeling.class, "traps_desc"); + case SECRETS_FLOOR: return Messages.get(Level.Feeling.class, "secrets_desc"); + } } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java index 258fe16c4..ec098d14d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -121,7 +121,15 @@ public abstract class Level implements Bundlable { DARK, LARGE, TRAPS, - SECRETS + SECRETS; + + public String title(){ + return Messages.get(this, name()+"_title"); + } + + public String desc() { + return Messages.get(this, name()+"_desc"); + } } protected int width; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java index 20735a832..f432b1575 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java @@ -64,6 +64,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.MimicTooth; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; import com.shatteredpixel.shatteredpixeldungeon.journal.Document; import com.shatteredpixel.shatteredpixeldungeon.journal.Journal; +import com.shatteredpixel.shatteredpixeldungeon.journal.Notes; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.RegularLevel; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; @@ -545,13 +546,34 @@ public class GameScene extends PixelScene { } switch (Dungeon.level.feeling) { - case CHASM: GLog.w(Messages.get(this, "chasm")); break; - case WATER: GLog.w(Messages.get(this, "water")); break; - case GRASS: GLog.w(Messages.get(this, "grass")); break; - case DARK: GLog.w(Messages.get(this, "dark")); break; - case LARGE: GLog.w(Messages.get(this, "large")); break; - case TRAPS: GLog.w(Messages.get(this, "traps")); break; - case SECRETS: GLog.w(Messages.get(this, "secrets")); break; + case CHASM: + GLog.w(Dungeon.level.feeling.desc()); + Notes.add(Notes.Landmark.CHASM_FLOOR); + break; + case WATER: + GLog.w(Dungeon.level.feeling.desc()); + Notes.add(Notes.Landmark.WATER_FLOOR); + break; + case GRASS: + GLog.w(Dungeon.level.feeling.desc()); + Notes.add(Notes.Landmark.GRASS_FLOOR); + break; + case DARK: + GLog.w(Dungeon.level.feeling.desc()); + Notes.add(Notes.Landmark.DARK_FLOOR); + break; + case LARGE: + GLog.w(Dungeon.level.feeling.desc()); + Notes.add(Notes.Landmark.LARGE_FLOOR); + break; + case TRAPS: + GLog.w(Dungeon.level.feeling.desc()); + Notes.add(Notes.Landmark.TRAPS_FLOOR); + break; + case SECRETS: + GLog.w(Dungeon.level.feeling.desc()); + Notes.add(Notes.Landmark.SECRETS_FLOOR); + break; } for (Mob mob : Dungeon.level.mobs) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/MenuPane.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/MenuPane.java index 5558cb86a..c4fff0105 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/MenuPane.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/MenuPane.java @@ -28,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.SPDAction; import com.shatteredpixel.shatteredpixeldungeon.SPDSettings; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.journal.Document; +import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; @@ -36,6 +37,7 @@ import com.shatteredpixel.shatteredpixeldungeon.windows.WndGame; import com.shatteredpixel.shatteredpixeldungeon.windows.WndJournal; import com.shatteredpixel.shatteredpixeldungeon.windows.WndKeyBindings; import com.shatteredpixel.shatteredpixeldungeon.windows.WndStory; +import com.shatteredpixel.shatteredpixeldungeon.windows.WndTitledMessage; import com.watabou.input.GameAction; import com.watabou.noosa.BitmapText; import com.watabou.noosa.Game; @@ -84,23 +86,26 @@ public class MenuPane extends Component { depthButton = new Button(){ @Override protected String hoverText() { - switch (Dungeon.level.feeling) { - case CHASM: return Messages.get(GameScene.class, "chasm"); - case WATER: return Messages.get(GameScene.class, "water"); - case GRASS: return Messages.get(GameScene.class, "grass"); - case DARK: return Messages.get(GameScene.class, "dark"); - case LARGE: return Messages.get(GameScene.class, "large"); - case TRAPS: return Messages.get(GameScene.class, "traps"); - case SECRETS: return Messages.get(GameScene.class, "secrets"); + if (Dungeon.level.feeling != Level.Feeling.NONE){ + return Dungeon.level.feeling.desc(); + } else { + return null; } - return null; } @Override protected void onClick() { super.onClick(); - //just open journal for now, maybe have it open landmarks after expanding that page? - GameScene.show( new WndJournal() ); + + if (Dungeon.level.feeling == Level.Feeling.NONE){ + GameScene.show(new WndJournal()); + } else { + Image icon = Icons.get(Dungeon.level.feeling); + icon.scale.set(2f); + GameScene.show(new WndTitledMessage(icon, + Dungeon.level.feeling.title(), + Dungeon.level.feeling.desc())); + } } }; add(depthButton);