mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-02-21 20:18:14 +07:00
Implemented warp interaction
Implemented warp interaction (hard-coded to specific offset) Added Den of Evil (hard-coded layout) Increased MapLoader min load to load all Act 1 DT1s (will relax a bit) and up to cave level type
This commit is contained in:
parent
b7e745a0b8
commit
e3366849fa
@ -8,10 +8,12 @@ public class DT1Sound {
|
||||
private DT1Sound() {}
|
||||
|
||||
public static String getType(Levels.Entry levels, DT1.Tile tile) {
|
||||
if (tile == null) return "dirt";
|
||||
int soundIndex = tile.soundIndex & 0xFF;
|
||||
switch (levels.LevelType) {
|
||||
case 1: return getType1(soundIndex);
|
||||
case 2: return getType2(soundIndex);
|
||||
case 3: return getType3(soundIndex);
|
||||
default: return "dirt";
|
||||
}
|
||||
|
||||
@ -39,4 +41,11 @@ public class DT1Sound {
|
||||
default: return "dirt";
|
||||
}
|
||||
}
|
||||
|
||||
private static String getType3(int soundIndex) {
|
||||
switch (soundIndex) {
|
||||
case 0: return "dirt";
|
||||
default: return "dirt";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.riiablo.entity;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
||||
import com.badlogic.gdx.math.GridPoint2;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import com.badlogic.gdx.utils.IntIntMap;
|
||||
@ -12,6 +13,7 @@ import com.riiablo.codec.util.BBox;
|
||||
import com.riiablo.graphics.PaletteIndexedBatch;
|
||||
import com.riiablo.map.DT1;
|
||||
import com.riiablo.map.Map;
|
||||
import com.riiablo.screen.GameScreen;
|
||||
|
||||
import static com.riiablo.map.DT1.Tile;
|
||||
|
||||
@ -73,6 +75,21 @@ public class Warp extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void interact(GameScreen gameScreen) {
|
||||
System.out.println("zim zim zala bim");
|
||||
Map.Zone dst = map.findZone(dstLevel);
|
||||
GridPoint2 point = dst.find(0, 1, Map.ID.VIS_0_03);
|
||||
System.out.println(point);
|
||||
gameScreen.player.position.set(dst.getGlobalX(point.x * 5) + 2, dst.getGlobalY(point.y * 5) + 24 * 5 + 5);
|
||||
gameScreen.player.setPath(map, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getInteractRange() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOver(boolean b) {
|
||||
super.setOver(b);
|
||||
|
@ -383,6 +383,13 @@ public class Map implements Disposable {
|
||||
}
|
||||
};
|
||||
|
||||
level = Riiablo.files.Levels.get(8);
|
||||
zone = map.addZone(level, diff, 24, 24);
|
||||
zone.setPosition(level.OffsetX, level.OffsetY);
|
||||
zone.presets[0][1] = Preset.of(Riiablo.files.LvlPrest.get(84), 0);
|
||||
zone.presets[1][1] = Preset.of(Riiablo.files.LvlPrest.get(61), 1);
|
||||
zone.presets[1][0] = Preset.of(Riiablo.files.LvlPrest.get(97), 0);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
@ -438,7 +445,6 @@ public class Map implements Disposable {
|
||||
dependencies.add(new AssetDescriptor<>(TILES_PATH + zone.type.File[i], DT1.class));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -525,6 +531,14 @@ public class Map implements Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
public Zone findZone(Levels.Entry level) {
|
||||
for (Zone zone : zones) {
|
||||
if (zone.level == level) return zone;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Zone getZone(int x, int y) {
|
||||
for (Zone zone : zones) {
|
||||
if (zone.contains(x, y)) {
|
||||
@ -710,6 +724,11 @@ public class Map implements Disposable {
|
||||
ty = y / DT1.Tile.SUBTILE_SIZE;
|
||||
}
|
||||
|
||||
// TODO: define entrance, exit to eliminate x,y
|
||||
public GridPoint2 find(int x, int y, int id) {
|
||||
return presets[x][y].ds1.find(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this)
|
||||
@ -732,6 +751,8 @@ public class Map implements Disposable {
|
||||
|
||||
public int getLocalTX(int tx) { return tx - this.tx; }
|
||||
public int getLocalTY(int ty) { return ty - this.ty; }
|
||||
public int getGlobalX(int x) { return this.x + x; }
|
||||
public int getGlobalY(int y) { return this.y + y; }
|
||||
|
||||
public boolean contains(int x, int y) {
|
||||
x -= this.x;
|
||||
@ -767,7 +788,7 @@ public class Map implements Disposable {
|
||||
for (int y = 0; y < gridsY; y++, gridY += gridSizeY) {
|
||||
Preset preset = presets[x][y];
|
||||
if (preset == null) {
|
||||
generator.generate(this, dt1s, gridX, gridY);
|
||||
if (generator != null) generator.generate(this, dt1s, gridX, gridY);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -927,6 +948,12 @@ public class Map implements Disposable {
|
||||
}
|
||||
|
||||
Tile tile = zone.tiles[layer][tx][ty] = Tile.of(dt1s, cell);
|
||||
// FIXME: These are "empty"/"unknown" tiles, in caves, they fill in the gaps
|
||||
if (tile.tile == null) System.out.println(cell.orientation + ":" + cell.mainIndex + ":" + cell.subIndex + ": " + cell.prop1() + " " + cell.prop2() + " " + cell.prop3() + " " + cell.prop4());
|
||||
if (tile.tile == null) {
|
||||
zone.tiles[layer][tx][ty] = null;
|
||||
continue;
|
||||
}
|
||||
copyFlags(zone.flags, tx, ty, tile.tile);
|
||||
if (NO_FLOOR) {
|
||||
orFlags(zone.flags, tx, ty, DT1.Tile.FLAG_BLOCK_WALK);
|
||||
|
@ -56,7 +56,7 @@ public class MapLoader extends AsynchronousAssetLoader<Map, MapLoader.MapParamet
|
||||
@Override
|
||||
public Array<AssetDescriptor> getDependencies(String fileName, FileHandle file, MapLoader.MapParameters params) {
|
||||
Array<AssetDescriptor> dependencies = new Array<>();
|
||||
for (int def = Map.ACT_DEF[params.act]; def < 53/*Map.ACT_DEF[params.act + 1]*/; def++) {
|
||||
for (int def = Map.ACT_DEF[params.act]; def < /*53*/Map.ACT_DEF[params.act + 1]; def++) {
|
||||
LvlPrest.Entry preset = Riiablo.files.LvlPrest.get(def);
|
||||
for (int i = 0; i < preset.File.length; i++) {
|
||||
if (preset.File[i].charAt(0) != '0') {
|
||||
@ -66,7 +66,7 @@ public class MapLoader extends AsynchronousAssetLoader<Map, MapLoader.MapParamet
|
||||
}
|
||||
|
||||
for (LvlTypes.Entry type : Riiablo.files.LvlTypes) {
|
||||
if ((type.Act - 1) == params.act && type.Id < 3) {
|
||||
if ((type.Act - 1) == params.act && type.Id <= 3) {
|
||||
for (int i = 0; type.File[i].charAt(0) != '0'; i++) {
|
||||
dependencies.add(new AssetDescriptor<>(Map.TILES_PATH + type.File[i], DT1.class));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user