v0.9.1b: addressed/removed numerous TODO/FIXME lines & some unused code
This commit is contained in:
@@ -214,36 +214,6 @@ public class Tilemap extends Visual {
|
||||
topLeftUpdating = -1;
|
||||
updating.setEmpty();
|
||||
}
|
||||
|
||||
//FIXME temporarily disabled this optimization as it is suspected to cause crashes
|
||||
/*Camera c = Camera.main;
|
||||
//we treat the position of the tilemap as (0,0) here
|
||||
camX = (int)(c.scroll.x/cellW - x/cellW);
|
||||
camY = (int)(c.scroll.y/cellH - y/cellH);
|
||||
camW = (int)Math.ceil(c.width/cellW);
|
||||
camH = (int)Math.ceil(c.height/cellH);
|
||||
|
||||
if (camX >= mapWidth
|
||||
|| camY >= mapHeight
|
||||
|| camW + camW <= 0
|
||||
|| camH + camH <= 0)
|
||||
return;
|
||||
|
||||
//determines the top-left visible tile, the bottom-right one, and the buffer length
|
||||
//between them, this culls a good number of none-visible tiles while keeping to 1 draw
|
||||
topLeft = Math.max(camX, 0)
|
||||
+ Math.max(camY*mapWidth, 0);
|
||||
|
||||
bottomRight = Math.min(camX+camW, mapWidth-1)
|
||||
+ Math.min((camY+camH)*mapWidth, (mapHeight-1)*mapWidth);
|
||||
|
||||
if (topLeft >= size || bottomRight < 0)
|
||||
length = 0;
|
||||
else
|
||||
length = bottomRight - topLeft + 1;
|
||||
|
||||
if (length <= 0)
|
||||
return;*/
|
||||
|
||||
NoosaScript script = script();
|
||||
|
||||
|
||||
@@ -345,7 +345,7 @@ public abstract class Char extends Actor {
|
||||
String defense = enemy.defenseVerb();
|
||||
enemy.sprite.showStatus( CharSprite.NEUTRAL, defense );
|
||||
|
||||
//TODO enemy.defenseSound? currently miss plays for monks/crab even when the parry
|
||||
//TODO enemy.defenseSound? currently miss plays for monks/crab even when they parry
|
||||
Sample.INSTANCE.play(Assets.Sounds.MISS);
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +104,6 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.mechanics.ShadowCaster;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Languages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Earthroot;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Swiftthistle;
|
||||
@@ -763,7 +762,6 @@ public class Hero extends Char {
|
||||
}
|
||||
|
||||
Alchemy alch = (Alchemy) Dungeon.level.blobs.get(Alchemy.class);
|
||||
//TODO logic for a well having dried up?
|
||||
if (alch != null) {
|
||||
alch.alchPos = dst;
|
||||
AlchemyScene.setProvider( alch );
|
||||
@@ -817,11 +815,8 @@ public class Hero extends Char {
|
||||
|| item instanceof Key) {
|
||||
//Do Nothing
|
||||
} else {
|
||||
//TODO temporary until 0.8.0a, when all languages will get this phrase
|
||||
if (Messages.lang() == Languages.ENGLISH) {
|
||||
GLog.newLine();
|
||||
GLog.n(Messages.get(this, "you_cant_have", item.name()));
|
||||
}
|
||||
GLog.newLine();
|
||||
GLog.n(Messages.get(this, "you_cant_have", item.name()));
|
||||
}
|
||||
|
||||
heap.sprite.drop();
|
||||
@@ -1317,10 +1312,7 @@ public class Hero extends Char {
|
||||
Buff.affect(this, Momentum.class).gainStack();
|
||||
}
|
||||
|
||||
//FIXME this is a fairly sloppy fix for a crash involving pitfall traps.
|
||||
//really there should be a way for traps to specify whether action should continue or
|
||||
//not when they are pressed.
|
||||
return InterlevelScene.mode != InterlevelScene.Mode.FALL;
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
@@ -817,7 +817,7 @@ public abstract class Mob extends Char {
|
||||
if (alignment == Alignment.ENEMY && Dungeon.isChallenged(Challenges.SWARM_INTELLIGENCE)) {
|
||||
for (Mob mob : Dungeon.level.mobs) {
|
||||
if (mob.paralysed <= 0
|
||||
&& Dungeon.level.distance(pos, mob.pos) <= 8 //TODO base on pathfinder distance instead?
|
||||
&& Dungeon.level.distance(pos, mob.pos) <= 8
|
||||
&& mob.state != mob.HUNTING) {
|
||||
mob.beckon(target);
|
||||
}
|
||||
@@ -865,7 +865,7 @@ public abstract class Mob extends Char {
|
||||
if (alignment == Alignment.ENEMY && Dungeon.isChallenged( Challenges.SWARM_INTELLIGENCE )) {
|
||||
for (Mob mob : Dungeon.level.mobs) {
|
||||
if (mob.paralysed <= 0
|
||||
&& Dungeon.level.distance(pos, mob.pos) <= 8 //TODO base on pathfinder distance instead?
|
||||
&& Dungeon.level.distance(pos, mob.pos) <= 8
|
||||
&& mob.state != mob.HUNTING) {
|
||||
mob.beckon( target );
|
||||
}
|
||||
|
||||
@@ -76,7 +76,6 @@ import java.util.List;
|
||||
public class NewDM300 extends Mob {
|
||||
|
||||
{
|
||||
//TODO improved sprite
|
||||
spriteClass = DM300Sprite.class;
|
||||
|
||||
HP = HT = 300;
|
||||
|
||||
@@ -38,7 +38,6 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
//TODO stats on these might be a bit weak
|
||||
public abstract class Shaman extends Mob {
|
||||
|
||||
{
|
||||
@@ -174,8 +173,6 @@ public abstract class Shaman extends Mob {
|
||||
}
|
||||
}
|
||||
|
||||
//TODO a rare variant that helps brutes?
|
||||
|
||||
public static Class<? extends Shaman> random(){
|
||||
float roll = Random.Float();
|
||||
if (roll < 0.4f){
|
||||
|
||||
@@ -44,7 +44,6 @@ import java.util.ArrayList;
|
||||
public class RegrowthBomb extends Bomb {
|
||||
|
||||
{
|
||||
//TODO visuals
|
||||
image = ItemSpriteSheet.REGROWTH_BOMB;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,6 @@ public class ShrapnelBomb extends Bomb {
|
||||
for (int i = 0; i < FOV.length; i++) {
|
||||
if (FOV[i]) {
|
||||
if (Dungeon.level.heroFOV[i] && !Dungeon.level.solid[i]) {
|
||||
//TODO better vfx?
|
||||
CellEmitter.center( i ).burst( BlastParticle.FACTORY, 5 );
|
||||
}
|
||||
Char ch = Actor.findChar(i);
|
||||
|
||||
@@ -38,7 +38,6 @@ import com.watabou.utils.PathFinder;
|
||||
public class CausticBrew extends Brew {
|
||||
|
||||
{
|
||||
//TODO finish visuals
|
||||
image = ItemSpriteSheet.BREW_CAUSTIC;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@ import com.watabou.utils.Random;
|
||||
public class ElixirOfAquaticRejuvenation extends Elixir {
|
||||
|
||||
{
|
||||
//TODO finish visuals
|
||||
image = ItemSpriteSheet.ELIXIR_AQUA;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ import com.watabou.noosa.audio.Sample;
|
||||
public class ElixirOfDragonsBlood extends Elixir {
|
||||
|
||||
{
|
||||
//TODO finish visuals
|
||||
image = ItemSpriteSheet.ELIXIR_DRAGON;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
public class ElixirOfIcyTouch extends Elixir {
|
||||
|
||||
{
|
||||
//TODO finish visuals
|
||||
image = ItemSpriteSheet.ELIXIR_ICY;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
public class ElixirOfToxicEssence extends Elixir {
|
||||
|
||||
{
|
||||
//TODO finish visuals
|
||||
image = ItemSpriteSheet.ELIXIR_TOXIC;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.scrolls;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
@@ -116,7 +117,8 @@ public class ScrollOfTransmutation extends InventoryScroll {
|
||||
if (result.isIdentified()){
|
||||
Catalog.setSeen(result.getClass());
|
||||
}
|
||||
//TODO visuals
|
||||
//TODO might be nice to have a spellsprite for this, like Enchanting
|
||||
curUser.sprite.emitter().start(Speck.factory(Speck.CHANGE), 0.2f, 10);
|
||||
GLog.p( Messages.get(this, "morph") );
|
||||
}
|
||||
|
||||
|
||||
@@ -298,11 +298,7 @@ public class MagesStaff extends MeleeWeapon {
|
||||
public String info() {
|
||||
String info = super.info();
|
||||
|
||||
if (wand == null){
|
||||
//FIXME this is removed because of journal stuff, and is generally unused.
|
||||
//perhaps reword to fit in journal better
|
||||
//info += "\n\n" + Messages.get(this, "no_wand");
|
||||
} else {
|
||||
if (wand != null){
|
||||
info += "\n\n" + Messages.get(this, "has_wand", Messages.get(wand, "name")) + " " + wand.statsDesc();
|
||||
}
|
||||
|
||||
|
||||
@@ -359,7 +359,6 @@ public class NewCityBossLevel extends Level {
|
||||
return visuals;
|
||||
}
|
||||
|
||||
//TODO need to change text for some of these tiles
|
||||
public static class CustomGroundVisuals extends CustomTilemap {
|
||||
|
||||
{
|
||||
@@ -469,7 +468,7 @@ public class NewCityBossLevel extends Level {
|
||||
//mid row of DK's throne
|
||||
}else if (map[i + 1] == Terrain.SIGN) {
|
||||
data[i] = 14 * 8 + 1;
|
||||
data[++i] = 14 * 8 + 2; //TODO finalize throne visuals
|
||||
data[++i] = 14 * 8 + 2;
|
||||
data[++i] = 14 * 8 + 3;
|
||||
|
||||
//bottom row of DK's throne
|
||||
|
||||
@@ -34,7 +34,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.HeavyBoomerang;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.MazeRoom;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EmptyRoom;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.GrippingTrap;
|
||||
@@ -352,7 +351,7 @@ public class OldPrisonBossLevel extends Level {
|
||||
TargetHealthIndicator.instance.target(null);
|
||||
tengu.sprite.kill();
|
||||
|
||||
Room maze = new MazeRoom();
|
||||
Room maze = new EmptyRoom();
|
||||
maze.set(10, 1, 31, 29);
|
||||
maze.connected.put(null, new Room.Door(10, 2));
|
||||
maze.connected.put(maze, new Room.Door(20, 29));
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.spells.FeatherFall;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.RegularLevel;
|
||||
@@ -106,7 +107,7 @@ public class Chasm {
|
||||
FeatherFall.FeatherBuff b = hero.buff(FeatherFall.FeatherBuff.class);
|
||||
|
||||
if (b != null){
|
||||
//TODO visuals
|
||||
hero.sprite.emitter().burst( Speck.factory( Speck.JET ), 20);
|
||||
b.detach();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2015 Oleg Dolya
|
||||
*
|
||||
* Shattered Pixel Dungeon
|
||||
* Copyright (C) 2014-2021 Evan Debenham
|
||||
*
|
||||
* 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.levels.rooms;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Maze;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
|
||||
|
||||
//TODO figure out where this should go, tunnel room type perhaps?
|
||||
public class MazeRoom extends Room {
|
||||
|
||||
public void paint( Level level ) {
|
||||
Painter.fill(level, this, 1, Terrain.EMPTY);
|
||||
|
||||
//true = space, false = wall
|
||||
Maze.allowDiagonals = false;
|
||||
boolean[][] maze = Maze.generate(this);
|
||||
|
||||
Painter.fill(level, this, 1, Terrain.EMPTY);
|
||||
for (int x = 0; x < maze.length; x++)
|
||||
for (int y = 0; y < maze[0].length; y++) {
|
||||
if (maze[x][y] == Maze.FILLED) {
|
||||
Painter.fill(level, x + left, y + top, 1, 1, Terrain.WALL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -137,7 +137,4 @@ public class PitfallTrap extends Trap {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//TODO these used to become chasms when disarmed, but the functionality was problematic
|
||||
//because it could block routes, perhaps some way to make this work elegantly?
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ public class Ballistica {
|
||||
public ArrayList<Integer> path = new ArrayList<>();
|
||||
public Integer sourcePos = null;
|
||||
public Integer collisionPos = null;
|
||||
public Integer collisionProperties = null;
|
||||
public Integer dist = 0;
|
||||
|
||||
//parameters to specify the colliding cell
|
||||
@@ -52,6 +53,7 @@ public class Ballistica {
|
||||
|
||||
public Ballistica( int from, int to, int params ){
|
||||
sourcePos = from;
|
||||
collisionProperties = params;
|
||||
build(from, to,
|
||||
(params & STOP_TARGET) > 0,
|
||||
(params & STOP_CHARS) > 0,
|
||||
|
||||
@@ -39,7 +39,7 @@ public class ConeAOE {
|
||||
public HashSet<Integer> cells = new HashSet<>();
|
||||
|
||||
public ConeAOE( Ballistica core, float degrees ){
|
||||
this( core, Float.POSITIVE_INFINITY, degrees, Ballistica.STOP_TARGET/* TODO */);
|
||||
this( core, Float.POSITIVE_INFINITY, degrees, core.collisionProperties );
|
||||
}
|
||||
|
||||
public ConeAOE( Ballistica core, float maxDist, float degrees, int ballisticaParams ){
|
||||
|
||||
@@ -161,7 +161,6 @@ public class WelcomeScene extends PixelScene {
|
||||
private void updateVersion(int previousVersion){
|
||||
|
||||
//update rankings, to update any data which may be outdated
|
||||
//FIXME this is set to true temporarily as we want to run this no matter what, to ensure the v0.9.0a- badges bug is fixed
|
||||
if (previousVersion < LATEST_UPDATE){
|
||||
int highestChalInRankings = 0;
|
||||
try {
|
||||
|
||||
@@ -62,7 +62,7 @@ public class GhoulSprite extends MobSprite {
|
||||
@Override
|
||||
public void move(int from, int to) {
|
||||
if (parent == null){
|
||||
//fixme this happens rarely, likely due to ghoul like link?
|
||||
//fixme this happens rarely, likely due to ghoul life link?
|
||||
Game.reportException(new RuntimeException("ghoul sprite tried to move with null parent! ghoul HP: " + ch.HP));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ import com.watabou.utils.PointF;
|
||||
import com.watabou.utils.RectF;
|
||||
import com.watabou.utils.SparseArray;
|
||||
|
||||
//TODO add in a proper set of vfx for plants growing/withering, grass burning, discovering traps
|
||||
public class TerrainFeaturesTilemap extends DungeonTilemap {
|
||||
|
||||
private static TerrainFeaturesTilemap instance;
|
||||
@@ -70,7 +69,6 @@ public class TerrainFeaturesTilemap extends DungeonTilemap {
|
||||
if (tile == Terrain.HIGH_GRASS){
|
||||
return 9 + 16*stage + (DungeonTileSheet.tileVariance[pos] >= 50 ? 1 : 0);
|
||||
} else if (tile == Terrain.FURROWED_GRASS){
|
||||
//TODO
|
||||
return 11 + 16*stage + (DungeonTileSheet.tileVariance[pos] >= 50 ? 1 : 0);
|
||||
} else if (tile == Terrain.GRASS) {
|
||||
return 13 + 16*stage + (DungeonTileSheet.tileVariance[pos] >= 50 ? 1 : 0);
|
||||
|
||||
@@ -1,208 +0,0 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2015 Oleg Dolya
|
||||
*
|
||||
* Shattered Pixel Dungeon
|
||||
* Copyright (C) 2014-2021 Evan Debenham
|
||||
*
|
||||
* 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.windows;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.journal.Document;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.ScrollPane;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.watabou.noosa.BitmapText;
|
||||
import com.watabou.noosa.ColorBlock;
|
||||
import com.watabou.noosa.Image;
|
||||
import com.watabou.noosa.ui.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
//FIXME lots of copy-pasta from WndJournal here. should generalize some of this. Primarily ListItem
|
||||
public class WndDocument extends Window {
|
||||
|
||||
private static final int WIDTH_P = 120;
|
||||
private static final int HEIGHT_P = 160;
|
||||
|
||||
private static final int WIDTH_L = 160;
|
||||
private static final int HEIGHT_L = 128;
|
||||
|
||||
private static final int ITEM_HEIGHT = 18;
|
||||
|
||||
private ScrollPane list;
|
||||
private ArrayList<docPage> pages = new ArrayList<>();
|
||||
|
||||
public WndDocument( Document doc ){
|
||||
|
||||
int w = PixelScene.landscape() ? WIDTH_L : WIDTH_P;
|
||||
int h = PixelScene.landscape() ? HEIGHT_L : HEIGHT_P;
|
||||
|
||||
resize(w, h);
|
||||
|
||||
list = new ScrollPane( new Component() ){
|
||||
@Override
|
||||
public void onClick( float x, float y ) {
|
||||
int size = pages.size();
|
||||
for (int i=0; i < size; i++) {
|
||||
if (pages.get( i ).onClick( x, y )) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
add( list );
|
||||
|
||||
list.setRect( 0, 0, w, h);
|
||||
|
||||
Component content = list.content();
|
||||
|
||||
float pos = 0;
|
||||
|
||||
ColorBlock line = new ColorBlock( w, 1, 0xFF222222);
|
||||
line.y = pos;
|
||||
content.add(line);
|
||||
|
||||
RenderedTextBlock title = PixelScene.renderTextBlock(doc.title(), 9);
|
||||
title.hardlight(TITLE_COLOR);
|
||||
title.maxWidth( w - 2 );
|
||||
title.setPos( (w - title.width())/2f, pos + 1 + ((ITEM_HEIGHT) - title.height())/2f);
|
||||
PixelScene.align(title);
|
||||
content.add(title);
|
||||
|
||||
pos += Math.max(ITEM_HEIGHT, title.height());
|
||||
|
||||
for (String page : doc.pages()){
|
||||
docPage item = new docPage( doc, page );
|
||||
|
||||
item.setRect( 0, pos, w, ITEM_HEIGHT );
|
||||
content.add( item );
|
||||
|
||||
pos += item.height();
|
||||
pages.add(item);
|
||||
}
|
||||
|
||||
content.setSize( w, pos );
|
||||
list.setSize( list.width(), list.height() );
|
||||
|
||||
}
|
||||
|
||||
private static class docPage extends ListItem {
|
||||
|
||||
private boolean found = false;
|
||||
|
||||
private Document doc;
|
||||
private String page;
|
||||
|
||||
public docPage(Document doc, String page ){
|
||||
super( new ItemSprite( doc.pageSprite(), null),
|
||||
Messages.titleCase(doc.pageTitle(page)), -1);
|
||||
|
||||
this.doc = doc;
|
||||
|
||||
this.page = page;
|
||||
found = doc.hasPage(page);
|
||||
|
||||
if (!found) {
|
||||
icon.hardlight( 0.5f, 0.5f, 0.5f);
|
||||
label.text( Messages.titleCase(Messages.get( WndDocument.class, "missing" )));
|
||||
label.hardlight( 0x999999 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean onClick( float x, float y ) {
|
||||
if (inside( x, y ) && found) {
|
||||
ShatteredPixelDungeon.scene().addToFront( new WndStory( doc.pageBody(page) ));
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class ListItem extends Component {
|
||||
|
||||
protected RenderedTextBlock label;
|
||||
protected BitmapText depth;
|
||||
protected ColorBlock line;
|
||||
protected Image icon;
|
||||
|
||||
public ListItem( Image icon, String text ) {
|
||||
this(icon, text, -1);
|
||||
}
|
||||
|
||||
public ListItem( Image icon, String text, int d ) {
|
||||
super();
|
||||
|
||||
this.icon.copy(icon);
|
||||
|
||||
label.text( text );
|
||||
|
||||
if (d >= 0) {
|
||||
depth.text(Integer.toString(d));
|
||||
depth.measure();
|
||||
|
||||
if (d == Dungeon.depth) {
|
||||
label.hardlight(TITLE_COLOR);
|
||||
depth.hardlight(TITLE_COLOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createChildren() {
|
||||
label = PixelScene.renderTextBlock( 7 );
|
||||
add( label );
|
||||
|
||||
icon = new Image();
|
||||
add( icon );
|
||||
|
||||
depth = new BitmapText( PixelScene.pixelFont);
|
||||
add( depth );
|
||||
|
||||
line = new ColorBlock( 1, 1, 0xFF222222);
|
||||
add(line);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void layout() {
|
||||
|
||||
icon.y = y + 1 + (height() - 1 - icon.height()) / 2f;
|
||||
PixelScene.align(icon);
|
||||
|
||||
depth.x = icon.x + (icon.width - depth.width()) / 2f;
|
||||
depth.y = icon.y + (icon.height - depth.height()) / 2f + 1;
|
||||
PixelScene.align(depth);
|
||||
|
||||
line.size(width, 1);
|
||||
line.x = 0;
|
||||
line.y = y;
|
||||
|
||||
label.maxWidth((int)(width - icon.width() - 8 - 1));
|
||||
label.setPos(icon.x + icon.width() + 1, y + 1 + (height() - label.height()) / 2f);
|
||||
PixelScene.align(label);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user