master
Ondřej Hruška 10 years ago
parent 84789ccf47
commit 137dbc21da
  1. 9
      src/mightypork/rogue/Launcher.java
  2. 8
      src/mightypork/rogue/RogueApp.java
  3. 8
      src/mightypork/rogue/RogueResources.java
  4. 3
      src/mightypork/rogue/events/LoadingOverlayRequest.java
  5. 6
      src/mightypork/rogue/events/RogueStateRequest.java
  6. 4
      src/mightypork/rogue/screens/FpsOverlay.java
  7. 3
      src/mightypork/rogue/screens/LoadingOverlay.java
  8. 3
      src/mightypork/rogue/screens/game/HeartBar.java
  9. 6
      src/mightypork/rogue/screens/game/IngameNav.java
  10. 3
      src/mightypork/rogue/screens/game/InvSlot.java
  11. 2
      src/mightypork/rogue/screens/game/LayerAskSave.java
  12. 5
      src/mightypork/rogue/screens/game/LayerDeath.java
  13. 3
      src/mightypork/rogue/screens/game/LayerGameUi.java
  14. 5
      src/mightypork/rogue/screens/game/LayerInv.java
  15. 3
      src/mightypork/rogue/screens/game/LayerMapView.java
  16. 4
      src/mightypork/rogue/screens/game/LayerWin.java
  17. 3
      src/mightypork/rogue/screens/game/NavButton.java
  18. 5
      src/mightypork/rogue/screens/game/ScreenGame.java
  19. 2
      src/mightypork/rogue/screens/menu/ScreenMainMenu.java
  20. 9
      src/mightypork/rogue/screens/select_world/ScreenSelectWorld.java
  21. 3
      src/mightypork/rogue/screens/select_world/WorldSlot.java
  22. 10
      src/mightypork/rogue/screens/story/ScreenStory.java
  23. 12
      src/mightypork/rogue/world/Inventory.java
  24. 3
      src/mightypork/rogue/world/PlayerFacade.java
  25. 1
      src/mightypork/rogue/world/World.java
  26. 3
      src/mightypork/rogue/world/WorldConsole.java
  27. 3
      src/mightypork/rogue/world/WorldRenderer.java
  28. 3
      src/mightypork/rogue/world/entity/AiTimer.java
  29. 3
      src/mightypork/rogue/world/entity/Entity.java
  30. 3
      src/mightypork/rogue/world/entity/EntityModel.java
  31. 3
      src/mightypork/rogue/world/entity/EntityModule.java
  32. 3
      src/mightypork/rogue/world/entity/EntityPathFinder.java
  33. 3
      src/mightypork/rogue/world/entity/impl/BossRatAi.java
  34. 3
      src/mightypork/rogue/world/entity/impl/BrownRatAi.java
  35. 3
      src/mightypork/rogue/world/entity/impl/EntityBossRat.java
  36. 3
      src/mightypork/rogue/world/entity/impl/EntityBrownRat.java
  37. 3
      src/mightypork/rogue/world/entity/impl/EntityGrayRat.java
  38. 13
      src/mightypork/rogue/world/entity/impl/EntityPlayer.java
  39. 3
      src/mightypork/rogue/world/entity/impl/GrayRatAi.java
  40. 3
      src/mightypork/rogue/world/entity/impl/MonsterAi.java
  41. 3
      src/mightypork/rogue/world/entity/modules/EntityModuleHealth.java
  42. 3
      src/mightypork/rogue/world/entity/modules/EntityModulePosition.java
  43. 9
      src/mightypork/rogue/world/entity/modules/EntityPos.java
  44. 3
      src/mightypork/rogue/world/entity/render/EntityRendererMobLR.java
  45. 3
      src/mightypork/rogue/world/events/PlayerStepEndEvent.java
  46. 3
      src/mightypork/rogue/world/events/WorldPauseRequest.java
  47. 12
      src/mightypork/rogue/world/gen/LevelBuilder.java
  48. 3
      src/mightypork/rogue/world/gen/RoomEntry.java
  49. 9
      src/mightypork/rogue/world/gen/Rooms.java
  50. 3
      src/mightypork/rogue/world/gen/ScratchMap.java
  51. 12
      src/mightypork/rogue/world/gen/WorldGenError.java
  52. 3
      src/mightypork/rogue/world/gen/rooms/ItemShrineRoom.java
  53. 3
      src/mightypork/rogue/world/gen/rooms/TreasureChestRoom.java
  54. 6
      src/mightypork/rogue/world/gui/MapView.java
  55. 2
      src/mightypork/rogue/world/gui/Minimap.java
  56. 3
      src/mightypork/rogue/world/gui/WorldConsoleRenderer.java
  57. 3
      src/mightypork/rogue/world/gui/interaction/MIPKeyboard.java
  58. 4
      src/mightypork/rogue/world/gui/interaction/MIPMouse.java
  59. 3
      src/mightypork/rogue/world/gui/interaction/MapInteractionPlugin.java
  60. 3
      src/mightypork/rogue/world/item/Item.java
  61. 3
      src/mightypork/rogue/world/item/ItemModel.java
  62. 3
      src/mightypork/rogue/world/item/ItemRenderer.java
  63. 8
      src/mightypork/rogue/world/item/Items.java
  64. 3
      src/mightypork/rogue/world/item/impl/ItemBaseFood.java
  65. 3
      src/mightypork/rogue/world/item/impl/ItemBaseWeapon.java
  66. 3
      src/mightypork/rogue/world/item/impl/active/ItemHeartPiece.java
  67. 3
      src/mightypork/rogue/world/item/impl/food/ItemCheese.java
  68. 3
      src/mightypork/rogue/world/item/impl/food/ItemMeat.java
  69. 3
      src/mightypork/rogue/world/item/impl/food/ItemSandwich.java
  70. 3
      src/mightypork/rogue/world/item/impl/weapons/ItemAxe.java
  71. 3
      src/mightypork/rogue/world/item/impl/weapons/ItemBone.java
  72. 3
      src/mightypork/rogue/world/item/impl/weapons/ItemClub.java
  73. 3
      src/mightypork/rogue/world/item/impl/weapons/ItemKnife.java
  74. 3
      src/mightypork/rogue/world/item/impl/weapons/ItemRock.java
  75. 3
      src/mightypork/rogue/world/item/impl/weapons/ItemSword.java
  76. 3
      src/mightypork/rogue/world/item/impl/weapons/ItemTwig.java
  77. 3
      src/mightypork/rogue/world/item/render/QuadItemRenderer.java
  78. 18
      src/mightypork/rogue/world/level/Level.java
  79. 3
      src/mightypork/rogue/world/level/render/EntityRenderContext.java
  80. 3
      src/mightypork/rogue/world/level/render/MapRenderContext.java
  81. 3
      src/mightypork/rogue/world/level/render/TileRenderContext.java
  82. 4
      src/mightypork/rogue/world/tile/Tile.java
  83. 3
      src/mightypork/rogue/world/tile/TileModel.java
  84. 3
      src/mightypork/rogue/world/tile/TileRenderer.java
  85. 3
      src/mightypork/rogue/world/tile/TileType.java
  86. 9
      src/mightypork/rogue/world/tile/Tiles.java
  87. 3
      src/mightypork/rogue/world/tile/impl/NullTile.java
  88. 3
      src/mightypork/rogue/world/tile/impl/TileBaseChest.java
  89. 3
      src/mightypork/rogue/world/tile/impl/TileBaseDoor.java
  90. 3
      src/mightypork/rogue/world/tile/impl/TileBaseEntrance.java
  91. 3
      src/mightypork/rogue/world/tile/impl/TileBaseExit.java
  92. 3
      src/mightypork/rogue/world/tile/impl/TileBaseFloor.java
  93. 3
      src/mightypork/rogue/world/tile/impl/TileBasePassage.java
  94. 3
      src/mightypork/rogue/world/tile/impl/TileBaseSecretDoor.java
  95. 3
      src/mightypork/rogue/world/tile/impl/TileBaseStairs.java
  96. 3
      src/mightypork/rogue/world/tile/impl/TileBaseWall.java
  97. 3
      src/mightypork/rogue/world/tile/impl/TileSolid.java
  98. 3
      src/mightypork/rogue/world/tile/impl/TileWithItems.java
  99. 3
      src/mightypork/rogue/world/tile/impl/brick/TileBrickChest.java
  100. 13
      src/mightypork/rogue/world/tile/impl/brick/TileBrickDoor.java
  101. Some files were not shown because too many files have changed in this diff Show More

@ -4,7 +4,6 @@ package mightypork.rogue;
import java.io.File;
import java.util.logging.Level;
import junk.BaseApp;
import mightypork.gamecore.core.App;
import mightypork.utils.files.OsUtils;
@ -95,10 +94,10 @@ public class Launcher {
//@formatter:off
System.out.println(
"Arguments:\n" +
"\t--workdir <path>, -w <path> .... specify working directory\n" +
"\t--verbose, --debug, -v ......... print all messages\n" +
"\t--silent, -s ................... print no messages\n" +
"\t--warnings, -e ................. print only warning and error messages\n" +
"\t--workdir <path>, -w <path> .... specify working directory\n" +
"\t--verbose, --debug, -v ......... print all messages\n" +
"\t--silent, -s ................... print no messages\n" +
"\t--warnings, -e ................. print only warning and error messages\n" +
"\t--help, -h ..................... show this help\n");
//@formatter:on
}

@ -2,7 +2,6 @@ package mightypork.rogue;
import junk.AppInitOptions;
import junk.BaseApp;
import mightypork.gamecore.backends.lwjgl.LwjglBackend;
import mightypork.gamecore.backends.lwjgl.LwjglInputModule;
import mightypork.gamecore.core.App;
@ -40,10 +39,11 @@ import mightypork.utils.logging.Log;
*/
public final class RogueApp extends App implements ViewportChangeListener {
public RogueApp() {
public RogueApp()
{
super(new LwjglBackend());
AppInitOptions opt = getInitOptions();
final AppInitOptions opt = getInitOptions();
opt.addRoutes(new RogueRoutes());
opt.addResources(new RogueResources());
@ -90,7 +90,7 @@ public final class RogueApp extends App implements ViewportChangeListener {
super.initScreens(screens);
/* game screen references world provider instance */
WorldProvider.init(this);
WorldProvider.setBaseDir(this);
getEventBus().subscribe(new RogueStateManager(this));
screens.addScreen("main_menu", new ScreenMainMenu(this));

@ -2,7 +2,7 @@ package mightypork.rogue;
import mightypork.gamecore.audio.SoundRegistry;
import mightypork.gamecore.backends.lwjgl.graphics.font.DeferredLwjglFont;
import mightypork.gamecore.backends.lwjgl.graphics.font.LwjglFont;
import mightypork.gamecore.graphics.fonts.DeferredFont;
import mightypork.gamecore.graphics.fonts.FontRegistry;
import mightypork.gamecore.graphics.fonts.Glyphs;
@ -23,12 +23,12 @@ public class RogueResources implements ResourceSetup {
DeferredFont font;
//fonts.loadFont("polygon_pixel", new DeferredFont("/res/font/PolygonPixel5x7Standard.ttf", Glyphs.basic, 16));
fonts.addFont("press_start", font = new DeferredLwjglFont("/res/font/PressStart2P.ttf", Glyphs.basic, 16));
fonts.addFont("press_start", font = new LwjglFont("/res/font/PressStart2P.ttf", Glyphs.basic, 16));
fonts.addFont("battlenet", font = new DeferredLwjglFont("/res/font/battlenet.ttf", Glyphs.basic, 16));
fonts.addFont("battlenet", font = new LwjglFont("/res/font/battlenet.ttf", Glyphs.basic, 16));
font.setDiscardRatio(3 / 16D, 2 / 16D);
fonts.addFont("tinyutf", font = new DeferredLwjglFont("/res/font/TinyUnicode2.ttf", Glyphs.basic, 16));
fonts.addFont("tinyutf", font = new LwjglFont("/res/font/TinyUnicode2.ttf", Glyphs.basic, 16));
font.setDiscardRatio(5 / 16D, 3 / 16D);
// aliases

@ -22,7 +22,8 @@ public class LoadingOverlayRequest extends BusEvent<LoadingOverlay> {
* @param msg task description
* @param task task runnable
*/
public LoadingOverlayRequest(String msg, Runnable task) {
public LoadingOverlayRequest(String msg, Runnable task)
{
this.task = task;
this.msg = msg;
}

@ -17,13 +17,15 @@ public class RogueStateRequest extends BusEvent<RogueStateManager> {
private final boolean fromDark;
public RogueStateRequest(RogueState requested) {
public RogueStateRequest(RogueState requested)
{
this.requested = requested;
this.fromDark = false;
}
public RogueStateRequest(RogueState requested, boolean fromDark) {
public RogueStateRequest(RogueState requested, boolean fromDark)
{
this.requested = requested;
this.fromDark = fromDark;
}

@ -2,7 +2,6 @@ package mightypork.rogue.screens;
import mightypork.gamecore.core.App;
import mightypork.gamecore.core.config.Config;
import mightypork.gamecore.graphics.fonts.IFont;
import mightypork.gamecore.gui.Action;
import mightypork.gamecore.gui.components.painters.TextPainter;
@ -27,7 +26,8 @@ public class FpsOverlay extends Overlay {
TextPainter tp;
public FpsOverlay() {
public FpsOverlay()
{
/*
* Toggle key: F3

@ -63,7 +63,8 @@ public class LoadingOverlay extends Overlay {
};
public LoadingOverlay() {
public LoadingOverlay()
{
final QuadPainter qp = new QuadPainter(PAL16.SEABLUE);
qp.setRect(root);

@ -22,7 +22,8 @@ public class HeartBar extends BaseComponent {
private final Rect heart;
public HeartBar(Num total, Num active, TxQuad img_on, TxQuad img_half, TxQuad img_off, AlignX align) {
public HeartBar(Num total, Num active, TxQuad img_on, TxQuad img_half, TxQuad img_off, AlignX align)
{
super();
this.total = total;
this.active = active;

@ -20,12 +20,14 @@ public class IngameNav extends LayoutComponent {
private final TxQuad bg;
public IngameNav() {
public IngameNav()
{
this(null);
}
public IngameNav(RectBound context) {
public IngameNav(RectBound context)
{
super(context);
final Rect shr = this.shrink(height().perc(5));

@ -47,7 +47,8 @@ public class InvSlot extends ClickableComponent {
private final Num hAlpha = Num.make(0.7);
public InvSlot(int index, InvSlot[] allSlots) {
public InvSlot(int index, InvSlot[] allSlots)
{
super();
this.txBase = Res.getTxQuad("inv.slot.base");
this.txSelected = Res.getTxQuad("inv.slot.selected");

@ -123,7 +123,7 @@ public class LayerAskSave extends FadingLayer {
btn2.setAction(discard);
btn3.setAction(cancel);
Config cfg = App.cfg();
final Config cfg = App.cfg();
bindKey(cfg.getKeyStroke("general.close"), Trigger.RISING, cancel);
bindKey(cfg.getKeyStroke("general.cancel"), Trigger.RISING, cancel);

@ -29,7 +29,8 @@ import mightypork.utils.math.constraints.num.Num;
public class LayerDeath extends FadingLayer {
public LayerDeath(final ScreenGame screen) {
public LayerDeath(final ScreenGame screen)
{
super(screen);
// darker down to cover console.
@ -90,7 +91,7 @@ public class LayerDeath extends FadingLayer {
btn1.setAction(load);
btn2.setAction(quit);
Config cfg = App.cfg();
final Config cfg = App.cfg();
bindKey(cfg.getKeyStroke("game.load"), Trigger.RISING, load);
bindKey(cfg.getKeyStroke("general.confirm"), Trigger.RISING, load);

@ -40,7 +40,8 @@ public class LayerGameUi extends ScreenLayer {
private final ScreenGame gameScreen;
public LayerGameUi(ScreenGame screen) {
public LayerGameUi(ScreenGame screen)
{
super(screen);
this.gameScreen = screen;

@ -103,7 +103,8 @@ public class LayerInv extends FadingLayer {
}
public LayerInv(final ScreenGame screen) {
public LayerInv(final ScreenGame screen)
{
super(screen);
this.gscreen = screen;
@ -233,7 +234,7 @@ public class LayerInv extends FadingLayer {
private void setupGridWalkKeys()
{
Config cfg = App.cfg();
final Config cfg = App.cfg();
bindKey(cfg.getKeyStroke("game.inv.move.left"), Trigger.RISING, new Runnable() {

@ -14,7 +14,8 @@ public class LayerMapView extends ScreenLayer {
protected final MapView map;
public LayerMapView(Screen screen) {
public LayerMapView(Screen screen)
{
super(screen);
// render component

@ -4,7 +4,6 @@ package mightypork.rogue.screens.game;
import java.io.File;
import mightypork.gamecore.core.App;
import mightypork.gamecore.core.config.Config;
import mightypork.gamecore.graphics.fonts.IFont;
import mightypork.gamecore.gui.Action;
import mightypork.gamecore.gui.components.input.TextButton;
@ -26,7 +25,8 @@ import mightypork.utils.math.constraints.num.Num;
public class LayerWin extends FadingLayer {
public LayerWin(final ScreenGame screen) {
public LayerWin(final ScreenGame screen)
{
super(screen);
// darker down to cover console.

@ -17,7 +17,8 @@ public class NavButton extends ClickableComponent {
private final TxQuad base, hover, down, fg;
public NavButton(TxQuad fg) {
public NavButton(TxQuad fg)
{
super();
this.base = Res.getTxQuad("nav.button.bg.base");
this.hover = Res.getTxQuad("nav.button.bg.hover");

@ -237,7 +237,8 @@ public class ScreenGame extends RogueScreen implements PlayerDeathHandler, GameW
}
public ScreenGame() {
public ScreenGame()
{
addLayer(invLayer = new LayerInv(this));
addLayer(deathLayer = new LayerDeath(this));
@ -246,7 +247,7 @@ public class ScreenGame extends RogueScreen implements PlayerDeathHandler, GameW
addLayer(worldLayer = new LayerMapView(this));
addLayer(askSaveLayer = new LayerAskSave(this));
Config cfg = App.cfg();
final Config cfg = App.cfg();
bindKey(cfg.getKeyStroke("game.pause"), Trigger.RISING, actionTogglePause);

@ -2,8 +2,6 @@ package mightypork.rogue.screens.menu;
import mightypork.gamecore.core.App;
import mightypork.gamecore.core.config.Config;
import mightypork.gamecore.core.events.ShutdownEvent;
import mightypork.gamecore.graphics.fonts.IFont;
import mightypork.gamecore.gui.Action;
import mightypork.gamecore.gui.components.input.TextButton;

@ -2,8 +2,6 @@ package mightypork.rogue.screens.select_world;
import mightypork.gamecore.core.App;
import mightypork.gamecore.core.WorkDir;
import mightypork.gamecore.core.config.Config;
import mightypork.gamecore.gui.components.layout.RowLayout;
import mightypork.gamecore.gui.components.painters.QuadPainter;
import mightypork.gamecore.gui.components.painters.TextPainter;
@ -14,6 +12,7 @@ import mightypork.gamecore.resources.Res;
import mightypork.rogue.RogueStateManager.RogueState;
import mightypork.rogue.events.RogueStateRequest;
import mightypork.rogue.screens.RogueScreen;
import mightypork.utils.files.WorkDir;
import mightypork.utils.logging.Log;
import mightypork.utils.math.AlignX;
import mightypork.utils.math.color.Color;
@ -29,7 +28,8 @@ import mightypork.utils.math.constraints.rect.Rect;
*/
public class ScreenSelectWorld extends RogueScreen {
public ScreenSelectWorld() {
public ScreenSelectWorld()
{
addLayer(new WorldsLayer(this));
}
@ -40,7 +40,8 @@ public class ScreenSelectWorld extends RogueScreen {
private WorldSlot slot3;
public WorldsLayer(Screen screen) {
public WorldsLayer(Screen screen)
{
super(screen);
init();

@ -46,7 +46,8 @@ public class WorldSlot extends ConstraintLayout {
private TextButton delBtn;
public WorldSlot(File worldFile) {
public WorldSlot(File worldFile)
{
this.file = worldFile;

@ -2,7 +2,6 @@ package mightypork.rogue.screens.story;
import mightypork.gamecore.core.App;
import mightypork.gamecore.core.config.Config;
import mightypork.gamecore.gui.Action;
import mightypork.gamecore.gui.components.layout.RowLayout;
import mightypork.gamecore.gui.components.layout.linear.LinearLayout;
@ -103,10 +102,12 @@ public class ScreenStory extends RogueScreen implements MouseButtonHandler {
private final Color textColor = Color.fromHex(0x7ad8ff);
public LayerSlide(Screen screen) {
public LayerSlide(Screen screen)
{
super(screen);
final TextPainter help = new TextPainter(Res.getFont("tiny"), AlignX.CENTER, RGB.WHITE.withAlpha(txProceedAlpha.mul(0.3)), "Space / click to proceed.");
final TextPainter help = new TextPainter(Res.getFont("tiny"), AlignX.CENTER, RGB.WHITE.withAlpha(txProceedAlpha.mul(0.3)),
"Space / click to proceed.");
help.setRect(root.bottomEdge().growUp(root.height().perc(4)));
help.setVPaddingPercent(5);
root.add(help);
@ -208,7 +209,8 @@ public class ScreenStory extends RogueScreen implements MouseButtonHandler {
};
public ScreenStory() {
public ScreenStory()
{
addLayer(new LayerColor(this, Color.fromHex(0x040c1e), 0));
addLayer(slideLayer = new LayerSlide(this));

@ -17,12 +17,14 @@ public class Inventory implements IonBinary {
private int lastAddIndex = 0;
public Inventory(int size) {
public Inventory(int size)
{
this.items = new Item[size];
}
public Inventory() {
public Inventory()
{
// ION constructor
}
@ -182,10 +184,8 @@ public class Inventory implements IonBinary {
s += i + ": ";
final Item itm = getItem(i);
if (itm == null)
s += "<null>";
else
s += itm;
if (itm == null) s += "<null>";
else s += itm;
}
s += "]";
return s;

@ -38,7 +38,8 @@ public class PlayerFacade {
/**
* @param world
*/
PlayerFacade(World world) {
PlayerFacade(World world)
{
this.world = world;
}

@ -11,7 +11,6 @@ import mightypork.rogue.world.entity.Entity;
import mightypork.rogue.world.events.GameWinHandler;
import mightypork.rogue.world.events.PlayerDeathHandler;
import mightypork.rogue.world.level.Level;
import mightypork.utils.eventbus.EventBus;
import mightypork.utils.eventbus.clients.DelegatingClient;
import mightypork.utils.interfaces.Pauseable;
import mightypork.utils.interfaces.Updateable;

@ -34,7 +34,8 @@ public class WorldConsole implements Updateable {
private double elapsed = 0;
private Entry(String text) {
private Entry(String text)
{
this.text = text;
this.fadeout = new NumAnimated(1, Easing.LINEAR);
this.fadeout.setDefaultDuration(0.5);

@ -41,7 +41,8 @@ public class WorldRenderer extends RectProxy {
private TileRenderContext trc;
public WorldRenderer(Rect viewport, Num tileSize) {
public WorldRenderer(Rect viewport, Num tileSize)
{
super(viewport);
this.tileSize = tileSize;

@ -8,7 +8,8 @@ import mightypork.utils.math.timing.TaskRepeater;
public abstract class AiTimer extends TaskRepeater implements IonBundled {
public AiTimer(double duration) {
public AiTimer(double duration)
{
super(duration);
}

@ -44,7 +44,8 @@ public abstract class Entity implements IonBundled, Updateable, DelegatingClient
private boolean freed;
public Entity(EntityModel model, int eid) {
public Entity(EntityModel model, int eid)
{
this.entityId = eid;
this.model = model;

@ -21,7 +21,8 @@ public final class EntityModel {
public final Class<? extends Entity> tileClass;
public EntityModel(int id, Class<? extends Entity> entity) {
public EntityModel(int id, Class<? extends Entity> entity)
{
Entities.register(id, this);
this.id = id;
this.tileClass = entity;

@ -18,7 +18,8 @@ public abstract class EntityModule implements IonBundled, Updateable {
protected final Entity entity;
public EntityModule(Entity entity) {
public EntityModule(Entity entity)
{
this.entity = entity;
}

@ -20,7 +20,8 @@ public class EntityPathFinder extends PathFinder {
protected final Entity entity;
public EntityPathFinder(Entity entity) {
public EntityPathFinder(Entity entity)
{
this.entity = entity;
}

@ -18,7 +18,8 @@ public class BossRatAi extends GrayRatAi {
};
public BossRatAi(Entity entity) {
public BossRatAi(Entity entity)
{
super(entity);
setAttackTime(0.3);

@ -7,7 +7,8 @@ import mightypork.utils.math.Calc;
public class BrownRatAi extends GrayRatAi {
public BrownRatAi(Entity entity) {
public BrownRatAi(Entity entity)
{
super(entity);
setAttackTime(1.2);

@ -22,7 +22,8 @@ public class EntityBossRat extends Entity {
private final BossRatAi ai = new BossRatAi(this);
public EntityBossRat(EntityModel model, int eid) {
public EntityBossRat(EntityModel model, int eid)
{
super(model, eid);
addModule("ai", ai);

@ -21,7 +21,8 @@ public class EntityBrownRat extends Entity {
private final BrownRatAi ai = new BrownRatAi(this);
public EntityBrownRat(EntityModel model, int eid) {
public EntityBrownRat(EntityModel model, int eid)
{
super(model, eid);
addModule("ai", ai);

@ -21,7 +21,8 @@ public class EntityGrayRat extends Entity {
private EntityRenderer renderer;
public EntityGrayRat(EntityModel model, int eid) {
public EntityGrayRat(EntityModel model, int eid)
{
super(model, eid);
addModule("ai", ai);

@ -2,7 +2,12 @@ package mightypork.rogue.world.entity.impl;
import mightypork.gamecore.core.App;
import mightypork.rogue.world.entity.*;
import mightypork.rogue.world.entity.Entity;
import mightypork.rogue.world.entity.EntityModel;
import mightypork.rogue.world.entity.EntityModule;
import mightypork.rogue.world.entity.EntityPathFinder;
import mightypork.rogue.world.entity.EntityRenderer;
import mightypork.rogue.world.entity.EntityType;
import mightypork.rogue.world.entity.modules.EntityMoveListener;
import mightypork.rogue.world.entity.render.EntityRendererMobLR;
import mightypork.rogue.world.events.PlayerKilledEvent;
@ -17,7 +22,8 @@ public class EntityPlayer extends Entity {
class PlayerAi extends EntityModule implements EntityMoveListener {
public PlayerAi(Entity entity) {
public PlayerAi(Entity entity)
{
super(entity);
setDespawnDelay(2);
@ -81,7 +87,8 @@ public class EntityPlayer extends Entity {
private final PlayerAi ai = new PlayerAi(this);
public EntityPlayer(EntityModel model, int eid) {
public EntityPlayer(EntityModel model, int eid)
{
super(model, eid);
pos.setStepTime(0.25);

@ -7,7 +7,8 @@ import mightypork.utils.math.Calc;
public class GrayRatAi extends MonsterAi {
public GrayRatAi(Entity entity) {
public GrayRatAi(Entity entity)
{
super(entity);
setAttackTime(1.2);

@ -75,7 +75,8 @@ public class MonsterAi extends EntityModule implements EntityMoveListener {
private int preyId = -1;
public MonsterAi(final Entity entity) {
public MonsterAi(final Entity entity)
{
super(entity);
noDoorPf = new PathFinderProxy(entity.getPathFinder()) {

@ -10,7 +10,8 @@ import mightypork.utils.math.Calc;
public class EntityModuleHealth extends EntityModule {
public EntityModuleHealth(Entity entity) {
public EntityModuleHealth(Entity entity)
{
super(entity);
}

@ -32,7 +32,8 @@ public class EntityModulePosition extends EntityModule {
private final Set<EntityMoveListener> moveListeners = new LinkedHashSet<>();
public EntityModulePosition(Entity entity) {
public EntityModulePosition(Entity entity)
{
super(entity);
}

@ -23,17 +23,20 @@ class EntityPos implements IonBundled, Updateable {
private final VectAnimated walkOffset = new VectAnimated(Vect.ZERO, Easing.LINEAR);
public EntityPos(Coord pos) {
public EntityPos(Coord pos)
{
this.coord.setTo(pos);
}
public EntityPos(int x, int y) {
public EntityPos(int x, int y)
{
this.coord.setTo(x, y);
}
public EntityPos() {
public EntityPos()
{
}

@ -34,7 +34,8 @@ public class EntityRendererMobLR extends EntityRenderer {
private final Color hue = Color.rgb(Num.ONE, animRedVar, animRedVar);
public EntityRendererMobLR(Entity entity, String sheetKey) {
public EntityRendererMobLR(Entity entity, String sheetKey)
{
this.entity = entity;
this.sheet = Res.getTxSheet(sheetKey);
}

@ -12,7 +12,8 @@ public class PlayerStepEndEvent extends BusEvent<PlayerStepEndListener> {
private final EntityPlayer player;
public PlayerStepEndEvent(EntityPlayer player) {
public PlayerStepEndEvent(EntityPlayer player)
{
super();
this.player = player;
}

@ -20,7 +20,8 @@ public class WorldPauseRequest extends BusEvent<World> {
private final PauseAction op;
public WorldPauseRequest(PauseAction op) {
public WorldPauseRequest(PauseAction op)
{
super();
this.op = op;
}

@ -29,7 +29,8 @@ public class LevelBuilder {
boolean important;
public RoomEntry(RoomBuilder room, int count, boolean important) {
public RoomEntry(RoomBuilder room, int count, boolean important)
{
this.count = count;
this.room = room;
this.important = important;
@ -42,7 +43,8 @@ public class LevelBuilder {
boolean important;
public ItemEntry(Item item, boolean important) {
public ItemEntry(Item item, boolean important)
{
this.item = item;
this.important = important;
}
@ -54,7 +56,8 @@ public class LevelBuilder {
boolean important;
public EntityEntry(Entity item, boolean important) {
public EntityEntry(Entity item, boolean important)
{
this.entity = item;
this.important = important;
}
@ -79,7 +82,8 @@ public class LevelBuilder {
* @param theme tiles theme
* @param seed level seed
*/
public LevelBuilder(int max_size, MapTheme theme, long seed) {
public LevelBuilder(int max_size, MapTheme theme, long seed)
{
this.rand = new Random(seed);
this.map = new ScratchMap(max_size, theme, rand);
}

@ -15,7 +15,8 @@ public class RoomEntry {
final Coord max;
public RoomEntry(Coord min, Coord max) {
public RoomEntry(Coord min, Coord max)
{
super();
this.min = min;
this.max = max;

@ -1,7 +1,14 @@
package mightypork.rogue.world.gen;
import mightypork.rogue.world.gen.rooms.*;
import mightypork.rogue.world.gen.rooms.BasicRoom;
import mightypork.rogue.world.gen.rooms.BossRoom;
import mightypork.rogue.world.gen.rooms.DeadEndRoom;
import mightypork.rogue.world.gen.rooms.EntranceRoom;
import mightypork.rogue.world.gen.rooms.ExitRoom;
import mightypork.rogue.world.gen.rooms.ItemShrineRoom;
import mightypork.rogue.world.gen.rooms.StorageRoom;
import mightypork.rogue.world.gen.rooms.TreasureChestRoom;
import mightypork.rogue.world.item.Item;

@ -121,7 +121,8 @@ public class ScratchMap {
private static final boolean FIX_GLITCHES = true;
public ScratchMap(int max_size, MapTheme theme, Random rand) {
public ScratchMap(int max_size, MapTheme theme, Random rand)
{
map = new Tile[max_size][max_size];
genMin = Coord.make((max_size / 2) - 1, (max_size / 2) - 1);

@ -8,22 +8,26 @@ package mightypork.rogue.world.gen;
*/
public class WorldGenError extends RuntimeException {
public WorldGenError() {
public WorldGenError()
{
super();
}
public WorldGenError(String message, Throwable cause) {
public WorldGenError(String message, Throwable cause)
{
super(message, cause);
}
public WorldGenError(String message) {
public WorldGenError(String message)
{
super(message);
}
public WorldGenError(Throwable cause) {
public WorldGenError(Throwable cause)
{
super(cause);
}

@ -16,7 +16,8 @@ public class ItemShrineRoom extends SecretRoom {
private final Item item;
public ItemShrineRoom(Item item) {
public ItemShrineRoom(Item item)
{
this.item = item;
}

@ -12,7 +12,8 @@ import mightypork.utils.math.algo.Coord;
public class TreasureChestRoom extends ItemShrineRoom {
public TreasureChestRoom(Item item) {
public TreasureChestRoom(Item item)
{
super(item);
}

@ -32,7 +32,8 @@ import mightypork.utils.math.timing.TimedTask;
*
* @author Ondřej Hruška (MightyPork)
*/
public class MapView extends InputComponent implements DelegatingClient, MouseButtonHandler, Updateable, WorldAscendRequestListener, WorldDescendRequestListener {
public class MapView extends InputComponent implements DelegatingClient, MouseButtonHandler, Updateable, WorldAscendRequestListener,
WorldDescendRequestListener {
private static final double transition_time = 0.8;
@ -90,7 +91,8 @@ public class MapView extends InputComponent implements DelegatingClient, MouseBu
}
public MapView() {
public MapView()
{
this.tileSize = height().min(width()).div(9).max(32).mul(Num.make(1).sub(zoom.mul(0.5)));
this.worldRenderer = new WorldRenderer(this, tileSize);
plc = WorldProvider.get().getPlayerControl();

@ -18,8 +18,6 @@ import mightypork.utils.math.constraints.rect.Rect;
import mightypork.utils.math.constraints.rect.var.RectVar;
import mightypork.utils.math.constraints.vect.Vect;
import org.lwjgl.opengl.GL11;
public class Minimap extends InputComponent implements MouseButtonHandler {

@ -27,7 +27,8 @@ public class WorldConsoleRenderer extends BaseComponent {
private final Rect itemViewRect;
public WorldConsoleRenderer(Num rowHeight) {
public WorldConsoleRenderer(Num rowHeight)
{
this.rowHeight = rowHeight;
this.fr = new FontRenderer(Res.getFont("tiny"));

@ -58,7 +58,8 @@ public class MIPKeyboard extends MapInteractionPlugin implements DelegatingClien
}
public MIPKeyboard(MapView mapView) {
public MIPKeyboard(MapView mapView)
{
super(mapView);
// bind keys

@ -1,7 +1,6 @@
package mightypork.rogue.world.gui.interaction;
import mightypork.gamecore.backends.lwjgl.LwjglInputModule;
import mightypork.gamecore.core.App;
import mightypork.rogue.world.entity.impl.EntityPlayer;
import mightypork.rogue.world.events.PlayerStepEndListener;
@ -21,7 +20,8 @@ public class MIPMouse extends MapInteractionPlugin implements PlayerStepEndListe
private static final int RIGHT = 1; // left
public MIPMouse(MapView mapView) {
public MIPMouse(MapView mapView)
{
super(mapView);
}

@ -13,7 +13,8 @@ public abstract class MapInteractionPlugin {
protected final MapView mapView;
public MapInteractionPlugin(MapView mapView) {
public MapInteractionPlugin(MapView mapView)
{
super();
this.mapView = mapView;
}

@ -18,7 +18,8 @@ public abstract class Item implements IonBundled {
private int uses = 1;
public Item(ItemModel model) {
public Item(ItemModel model)
{
this.model = model;
}

@ -19,7 +19,8 @@ public final class ItemModel {
public final Class<? extends Item> itemClass;
public ItemModel(int id, Class<? extends Item> item) {
public ItemModel(int id, Class<? extends Item> item)
{
Items.register(id, this);
this.id = id;
this.itemClass = item;

@ -9,7 +9,8 @@ public abstract class ItemRenderer {
protected final Item item;
public ItemRenderer(Item item) {
public ItemRenderer(Item item)
{
this.item = item;
}

@ -8,7 +8,13 @@ import mightypork.rogue.world.item.impl.active.ItemHeartPiece;
import mightypork.rogue.world.item.impl.food.ItemCheese;
import mightypork.rogue.world.item.impl.food.ItemMeat;
import mightypork.rogue.world.item.impl.food.ItemSandwich;
import mightypork.rogue.world.item.impl.weapons.*;
import mightypork.rogue.world.item.impl.weapons.ItemAxe;
import mightypork.rogue.world.item.impl.weapons.ItemBone;
import mightypork.rogue.world.item.impl.weapons.ItemClub;
import mightypork.rogue.world.item.impl.weapons.ItemKnife;
import mightypork.rogue.world.item.impl.weapons.ItemRock;
import mightypork.rogue.world.item.impl.weapons.ItemSword;
import mightypork.rogue.world.item.impl.weapons.ItemTwig;
import mightypork.utils.ion.IonDataBundle;
import mightypork.utils.ion.IonInput;
import mightypork.utils.ion.IonOutput;

@ -8,7 +8,8 @@ import mightypork.rogue.world.item.ItemType;
public abstract class ItemBaseFood extends Item {
public ItemBaseFood(ItemModel model) {
public ItemBaseFood(ItemModel model)
{
super(model);
}

@ -8,7 +8,8 @@ import mightypork.rogue.world.item.ItemType;
public abstract class ItemBaseWeapon extends Item {
public ItemBaseWeapon(ItemModel model) {
public ItemBaseWeapon(ItemModel model)
{
super(model);
}

@ -12,7 +12,8 @@ import mightypork.rogue.world.item.render.QuadItemRenderer;
public class ItemHeartPiece extends Item {
public ItemHeartPiece(ItemModel model) {
public ItemHeartPiece(ItemModel model)
{
super(model);
}

@ -10,7 +10,8 @@ import mightypork.rogue.world.item.render.QuadItemRenderer;
public class ItemCheese extends ItemBaseFood {
public ItemCheese(ItemModel model) {
public ItemCheese(ItemModel model)
{
super(model);
}

@ -10,7 +10,8 @@ import mightypork.rogue.world.item.render.QuadItemRenderer;
public class ItemMeat extends ItemBaseFood {
public ItemMeat(ItemModel model) {
public ItemMeat(ItemModel model)
{
super(model);
}

@ -10,7 +10,8 @@ import mightypork.rogue.world.item.render.QuadItemRenderer;
public class ItemSandwich extends ItemBaseFood {
public ItemSandwich(ItemModel model) {
public ItemSandwich(ItemModel model)
{
super(model);
}

@ -10,7 +10,8 @@ import mightypork.rogue.world.item.render.QuadItemRenderer;
public class ItemAxe extends ItemBaseWeapon {
public ItemAxe(ItemModel model) {
public ItemAxe(ItemModel model)
{
super(model);
}

@ -10,7 +10,8 @@ import mightypork.rogue.world.item.render.QuadItemRenderer;
public class ItemBone extends ItemBaseWeapon {
public ItemBone(ItemModel model) {
public ItemBone(ItemModel model)
{
super(model);
}

@ -10,7 +10,8 @@ import mightypork.rogue.world.item.render.QuadItemRenderer;
public class ItemClub extends ItemBaseWeapon {
public ItemClub(ItemModel model) {
public ItemClub(ItemModel model)
{
super(model);
}

@ -10,7 +10,8 @@ import mightypork.rogue.world.item.render.QuadItemRenderer;
public class ItemKnife extends ItemBaseWeapon {
public ItemKnife(ItemModel model) {
public ItemKnife(ItemModel model)
{
super(model);
}

@ -10,7 +10,8 @@ import mightypork.rogue.world.item.render.QuadItemRenderer;
public class ItemRock extends ItemBaseWeapon {
public ItemRock(ItemModel model) {
public ItemRock(ItemModel model)
{
super(model);
}

@ -10,7 +10,8 @@ import mightypork.rogue.world.item.render.QuadItemRenderer;
public class ItemSword extends ItemBaseWeapon {
public ItemSword(ItemModel model) {
public ItemSword(ItemModel model)
{
super(model);
}

@ -10,7 +10,8 @@ import mightypork.rogue.world.item.render.QuadItemRenderer;
public class ItemTwig extends ItemBaseWeapon {
public ItemTwig(ItemModel model) {
public ItemTwig(ItemModel model)
{
super(model);
}

@ -13,7 +13,8 @@ public class QuadItemRenderer extends ItemRenderer {
private final TxQuad txq;
public QuadItemRenderer(Item item, TxQuad txq) {
public QuadItemRenderer(Item item, TxQuad txq)
{
super(item);
this.txq = txq;
}

@ -2,7 +2,16 @@ package mightypork.rogue.world.level;
import java.io.IOException;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import mightypork.rogue.world.World;
import mightypork.rogue.world.entity.Entities;
@ -13,7 +22,6 @@ import mightypork.rogue.world.item.Item;
import mightypork.rogue.world.tile.Tile;
import mightypork.rogue.world.tile.TileModel;
import mightypork.rogue.world.tile.Tiles;
import mightypork.utils.eventbus.EventBus;
import mightypork.utils.eventbus.clients.DelegatingClient;
import mightypork.utils.eventbus.clients.ToggleableClient;
import mightypork.utils.interfaces.Updateable;
@ -101,11 +109,13 @@ public class Level implements Updateable, DelegatingClient, ToggleableClient, Io
private double timeSinceLastEntitySort;
public Level() {
public Level()
{
}
public Level(int width, int height) {
public Level(int width, int height)
{
size.setTo(width, height);
buildArray();
}

@ -7,7 +7,8 @@ import mightypork.utils.math.constraints.rect.Rect;
public class EntityRenderContext extends MapRenderContext {
public EntityRenderContext(Level map, Rect drawArea) {
public EntityRenderContext(Level map, Rect drawArea)
{
super(map, drawArea);
}

@ -15,7 +15,8 @@ public abstract class MapRenderContext {
private final Rect mapRect;
public MapRenderContext(Level map, Rect drawArea) {
public MapRenderContext(Level map, Rect drawArea)
{
this.map = map;
this.tiler = drawArea.tiles(map.getWidth(), map.getHeight());

@ -21,7 +21,8 @@ public final class TileRenderContext extends MapRenderContext implements RectBou
private final NoiseGen noise;
public TileRenderContext(Level map, Rect drawArea) {
public TileRenderContext(Level map, Rect drawArea)
{
super(map, drawArea);
//this.tiler.setOverlap(0.002); // avoid gaps (rounding error?)

@ -10,7 +10,6 @@ import mightypork.rogue.world.level.Level;
import mightypork.rogue.world.level.render.TileRenderContext;
import mightypork.utils.Support;
import mightypork.utils.annotations.Stub;
import mightypork.utils.eventbus.EventBus;
import mightypork.utils.ion.IonBinary;
import mightypork.utils.ion.IonInput;
import mightypork.utils.ion.IonOutput;
@ -39,7 +38,8 @@ public abstract class Tile implements IonBinary {
private TileRenderer renderer;
public Tile(TileModel model) {
public Tile(TileModel model)
{
this.model = model;
}

@ -19,7 +19,8 @@ public final class TileModel {
public final Class<? extends Tile> tileClass;
public TileModel(int id, Class<? extends Tile> tile) {
public TileModel(int id, Class<? extends Tile> tile)
{
Tiles.register(id, this);
this.id = id;
this.tileClass = tile;

@ -41,7 +41,8 @@ public abstract class TileRenderer implements Updateable {
}
public TileRenderer(Tile tile) {
public TileRenderer(Tile tile)
{
this.tile = tile;
if (!inited) {

@ -28,7 +28,8 @@ public enum TileType
private final boolean potentiallyWalkable;
private TileType(Color defaultMapColor, boolean potentiallyWalkable) {
private TileType(Color defaultMapColor, boolean potentiallyWalkable)
{
this.mapColor = defaultMapColor;
this.potentiallyWalkable = potentiallyWalkable;
}

@ -4,7 +4,14 @@ package mightypork.rogue.world.tile;
import java.io.IOException;
import mightypork.rogue.world.tile.impl.NullTile;
import mightypork.rogue.world.tile.impl.brick.*;
import mightypork.rogue.world.tile.impl.brick.TileBrickChest;
import mightypork.rogue.world.tile.impl.brick.TileBrickDoor;
import mightypork.rogue.world.tile.impl.brick.TileBrickEntrance;
import mightypork.rogue.world.tile.impl.brick.TileBrickExit;
import mightypork.rogue.world.tile.impl.brick.TileBrickFloor;
import mightypork.rogue.world.tile.impl.brick.TileBrickPassage;
import mightypork.rogue.world.tile.impl.brick.TileBrickSecretDoor;
import mightypork.rogue.world.tile.impl.brick.TileBrickWall;
import mightypork.utils.ion.IonInput;
import mightypork.utils.ion.IonOutput;

@ -11,7 +11,8 @@ import mightypork.rogue.world.tile.TileType;
public class NullTile extends Tile {
public NullTile(TileModel model) {
public NullTile(TileModel model)
{
super(model);
}

@ -19,7 +19,8 @@ public abstract class TileBaseChest extends TileWithItems {
private int clicks = 1;
public TileBaseChest(TileModel model) {
public TileBaseChest(TileModel model)
{
super(model);
}

@ -18,7 +18,8 @@ public abstract class TileBaseDoor extends TileSolid {
protected boolean locked = false;
public TileBaseDoor(TileModel model, TxSheet locked, TxSheet closed, TxSheet open) {
public TileBaseDoor(TileModel model, TxSheet locked, TxSheet closed, TxSheet open)
{
super(model);
this.renderer = new DoorTileRenderer(this, locked, closed, open);

@ -11,7 +11,8 @@ import mightypork.utils.math.color.Color;
public abstract class TileBaseEntrance extends TileBaseStairs {
public TileBaseEntrance(TileModel model) {
public TileBaseEntrance(TileModel model)
{
super(model);
}

@ -11,7 +11,8 @@ import mightypork.utils.math.color.Color;
public abstract class TileBaseExit extends TileBaseStairs {
public TileBaseExit(TileModel model) {
public TileBaseExit(TileModel model)
{
super(model);
}

@ -13,7 +13,8 @@ public abstract class TileBaseFloor extends TileWithItems {
private final BasicTileRenderer renderer;
public TileBaseFloor(TileModel model, TxSheet sheet) {
public TileBaseFloor(TileModel model, TxSheet sheet)
{
super(model);
this.renderer = new BasicTileRenderer(this, sheet);
}

@ -18,7 +18,8 @@ public abstract class TileBasePassage extends TileSolid {
private final BasicTileRenderer renderer;
public TileBasePassage(TileModel model, TxSheet sheet) {
public TileBasePassage(TileModel model, TxSheet sheet)
{
super(model);
this.renderer = new BasicTileRenderer(this, sheet);

@ -16,7 +16,8 @@ public abstract class TileBaseSecretDoor extends TileBaseDoor {
private int clicks = 2;
public TileBaseSecretDoor(TileModel model, TxSheet secret, TxSheet closed, TxSheet open) {
public TileBaseSecretDoor(TileModel model, TxSheet secret, TxSheet closed, TxSheet open)
{
super(model, secret, closed, open);
}

@ -7,7 +7,8 @@ import mightypork.rogue.world.tile.TileType;
public abstract class TileBaseStairs extends TileSolid {
public TileBaseStairs(TileModel model) {
public TileBaseStairs(TileModel model)
{
super(model);
}

@ -12,7 +12,8 @@ public abstract class TileBaseWall extends TileSolid {
private final BasicTileRenderer renderer;
public TileBaseWall(TileModel model, TxSheet sheet) {
public TileBaseWall(TileModel model, TxSheet sheet)
{
super(model);
this.renderer = new BasicTileRenderer(this, sheet);
}

@ -8,7 +8,8 @@ import mightypork.rogue.world.tile.TileModel;
public abstract class TileSolid extends Tile {
public TileSolid(TileModel model) {
public TileSolid(TileModel model)
{
super(model);
}

@ -22,7 +22,8 @@ public abstract class TileWithItems extends Tile {
protected final Stack<Item> items = new Stack<>();
public TileWithItems(TileModel model) {
public TileWithItems(TileModel model)
{
super(model);
}

@ -10,7 +10,8 @@ import mightypork.rogue.world.tile.render.ChestRenderer;
public class TileBrickChest extends TileBaseChest {
public TileBrickChest(TileModel model) {
public TileBrickChest(TileModel model)
{
super(model);
}

@ -8,14 +8,15 @@ import mightypork.rogue.world.tile.impl.TileBaseDoor;
public class TileBrickDoor extends TileBaseDoor {
public TileBrickDoor(TileModel model) {
public TileBrickDoor(TileModel model)
{
//@formatter:off
super(
model,
Res.getTxSheet("tile.brick.door.closed"), // LOCKED
Res.getTxSheet("tile.brick.door.closed"),
Res.getTxSheet("tile.brick.door.open")
);
model,
Res.getTxSheet("tile.brick.door.closed"), // LOCKED
Res.getTxSheet("tile.brick.door.closed"),
Res.getTxSheet("tile.brick.door.open")
);
//@formatter:on
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save