diff --git a/lost-sector/src/main/java/com/ezardlabs/lostsector/map/MapManager.java b/lost-sector/src/main/java/com/ezardlabs/lostsector/map/MapManager.java index 3585d88..5c05cea 100644 --- a/lost-sector/src/main/java/com/ezardlabs/lostsector/map/MapManager.java +++ b/lost-sector/src/main/java/com/ezardlabs/lostsector/map/MapManager.java @@ -96,155 +96,243 @@ public class MapManager { * d'un autre niveau. */ playerSpawn = new Vector2(0, 0); + /* + * REJET DE GÉNÉRATION DÉGÉNÉRÉE (fix « joueur spawné HORS DE LA MAP », + * retour v0.16.0 récurrent + seed sweep 55642947464) : sur certains + * tirages, la coque du vaisseau FUIT vers le vide — AUCUNE zone + * intérieure scellée n'existe, findLargestInteriorAnchor rend son + * repli (0, PROC_START) HORS vaisseau, le graphe est VIDE (cellules + * debout=0, « composantes : (0 total) ») et le joueur spawn dans le + * néant. FIX : la chaîne de segments est tirée sur la DONNÉE SEULE + * (remplirSoliditeData, aucune instantiation) et validée par le + * flood de l'ancre AVANT d'instancier quoi que ce soit ; sans + * intérieur, on re-tire (seed+1, même pool de segments) — une map + * morte n'arrive plus JAMAIS en jeu. + */ + long seedInitial = proceduralSeed; + final int tentativesMax = 20; // Keep a list of added sections ArrayList renderSegments = new ArrayList<>(); - - MapSegment currSeg = null; - Vector2 nextOffset = new Vector2(PROC_START_POS.x, PROC_START_POS.y); + int[][] soliditeValidee = null; int solidityW = (mapCfg.numRooms * MAP_SEGMENT_SIZE) + ((int)PROC_START_POS.x / TILE_SIZE * MAP_SEGMENT_SIZE); int solidityH = (mapCfg.numRooms * MAP_SEGMENT_SIZE) + ((int)PROC_START_POS.y / TILE_SIZE * MAP_SEGMENT_SIZE); - solidityMap = new int[solidityW][solidityH]; - final int mapSegGridW = (int)(mapCfg.numRooms + (nextOffset.x / MAP_SEGMENT_SIZE)); - final int mapSegGridH = (int)(mapCfg.numRooms + (nextOffset.y / MAP_SEGMENT_SIZE)); - MapSegment[][] mapSegGrid = new MapSegment[mapSegGridW][mapSegGridH]; + final int mapSegGridW = (int)(mapCfg.numRooms + (PROC_START_POS.x / MAP_SEGMENT_SIZE)); + final int mapSegGridH = (int)(mapCfg.numRooms + (PROC_START_POS.y / MAP_SEGMENT_SIZE)); - // Load rooms in between - for(int i = 0; i < mapCfg.numRooms; i++) { - MapSegment nextSeg; - if(i == 0) { - // First segment - Object[] objStartSeg = mapCfg.spawnSegments.values().toArray(); - ArrayList spawnSegs = (ArrayList) getRandObj(objStartSeg); - nextSeg = getRandObj(spawnSegs); - /* - * Garde de survie : getRandObj renvoie null si aucune liste - * n'est vide-sûre (aucun segment de spawn chargé, ex : assets - * manquants sur Android). Depuis 2017 ça faisait un NPE - * anonyme à nextSeg.map — le suspect n°1 des crashs Android - * en Exterminate/Defend procédural. On loggue le POURQUOI et - * on saute ce segment au lieu de crasher sans information. - */ - if (nextSeg == null) { - GameLog.e("LS-MAP", "génération : AUCUN segment de spawn disponible" - + " (spawnSegments=" + mapCfg.spawnSegments.size() + " entrées)" - + " — vérifier maps/procedural/ dans les assets"); - continue; - } - GameLog.i("LS-MAP", "segment 0 (spawn) : '" + nextSeg.map.getFilePath() - + "' offset=" + nextOffset); - } else { - MapSegmentConnector currConn = getRandomValidConnector(mapCfg, currSeg, mapSegGrid, true); - if (currConn == null) { - GameLog.e("LS-MAP", "segment #" + i + " : aucun connecteur valide sur '" - + (currSeg == null ? "null" : currSeg.map.getFilePath()) - + "' — segment sauté"); - continue; - } - if(i == mapCfg.numRooms - 1) { - // Extraction segment - nextSeg = getRandomValidSegment(mapCfg, mapCfg.extractSegments,currSeg, currConn, mapSegGrid, true); - } else { - // Main segments. - nextSeg = getRandomValidSegment(mapCfg, mapCfg.mainSegments, currSeg, currConn, mapSegGrid, true); - } - if (nextSeg == null) { - // POURQUOI : la sélection peut renvoyer null (aucun segment - // valide pour ce type de connecteur) — crash NPE anonyme en - // 2017. On trace le connecteur fautif et on saute. - GameLog.e("LS-MAP", "segment #" + i + " : aucun segment valide pour '" - + currConn + "' (sortie de '" + currSeg.map.getFilePath() + "') — segment sauté"); - continue; - } - GameLog.d("LS-MAP", "segment #" + i + " : sortie de " + currConn); + for (int tentative = 0; tentative < tentativesMax; tentative++) { + if (tentative > 0) { + // Re-tirage : même pool, seed décalé d'un pas (rand reconstruit + // — la sélection entière re-consomme la même séquence). + proceduralSeed = seedInitial + tentative; + rand = new Random(proceduralSeed); + } + renderSegments.clear(); + MapSegment currSeg = null; + Vector2 nextOffset = new Vector2(PROC_START_POS.x, PROC_START_POS.y); + MapSegment[][] mapSegGrid = new MapSegment[mapSegGridW][mapSegGridH]; - ArrayList nextValidConns = new ArrayList<>(); - for (MapSegmentConnector c : nextSeg.connectors) { - if (currConn.isValidConnection(c)) { - nextValidConns.add(c); + // Load rooms in between + for(int i = 0; i < mapCfg.numRooms; i++) { + MapSegment nextSeg; + if(i == 0) { + // First segment + Object[] objStartSeg = mapCfg.spawnSegments.values().toArray(); + ArrayList spawnSegs = (ArrayList) getRandObj(objStartSeg); + nextSeg = getRandObj(spawnSegs); + /* + * Garde de survie : getRandObj renvoie null si aucune liste + * n'est vide-sûre (aucun segment de spawn chargé, ex : assets + * manquants sur Android). Depuis 2017 ça faisait un NPE + * anonyme à nextSeg.map — le suspect n°1 des crashs Android + * en Exterminate/Defend procédural. On loggue le POURQUOI et + * on saute ce segment au lieu de crasher sans information. + */ + if (nextSeg == null) { + GameLog.e("LS-MAP", "génération : AUCUN segment de spawn disponible" + + " (spawnSegments=" + mapCfg.spawnSegments.size() + " entrées)" + + " — vérifier maps/procedural/ dans les assets"); + continue; } - } - MapSegmentConnector nextConn = getRandObj(nextValidConns); + GameLog.i("LS-MAP", "segment 0 (spawn) : '" + nextSeg.map.getFilePath() + + "' offset=" + nextOffset); + } else { + MapSegmentConnector currConn = getRandomValidConnector(mapCfg, currSeg, mapSegGrid, true); + if (currConn == null) { + GameLog.e("LS-MAP", "segment #" + i + " : aucun connecteur valide sur '" + + (currSeg == null ? "null" : currSeg.map.getFilePath()) + + "' — segment sauté"); + continue; + } + if(i == mapCfg.numRooms - 1) { + // Extraction segment + nextSeg = getRandomValidSegment(mapCfg, mapCfg.extractSegments,currSeg, currConn, mapSegGrid, true); + } else { + // Main segments. + nextSeg = getRandomValidSegment(mapCfg, mapCfg.mainSegments, currSeg, currConn, mapSegGrid, true); + } + if (nextSeg == null) { + // POURQUOI : la sélection peut renvoyer null (aucun segment + // valide pour ce type de connecteur) — crash NPE anonyme en + // 2017. On trace le connecteur fautif et on saute. + GameLog.e("LS-MAP", "segment #" + i + " : aucun segment valide pour '" + + currConn + "' (sortie de '" + currSeg.map.getFilePath() + "') — segment sauté"); + continue; + } + GameLog.d("LS-MAP", "segment #" + i + " : sortie de " + currConn); - currConn.connect(nextConn); + ArrayList nextValidConns = new ArrayList<>(); + for (MapSegmentConnector c : nextSeg.connectors) { + if (currConn.isValidConnection(c)) { + nextValidConns.add(c); + } + } + MapSegmentConnector nextConn = getRandObj(nextValidConns); - switch (currConn.side) { - case CENTRE: - break; - case TOP: - nextOffset.x += (currConn.pos.x / currSeg.map.getTileWidth()) - (nextConn.pos.x / nextSeg.map.getTileWidth()); - nextOffset.y -= nextSeg.getHeight(); - break; - case RIGHT: - nextOffset.x += currSeg.getWidth(); - nextOffset.y += (currConn.pos.y / currSeg.map.getTileHeight()) - (nextConn.pos.y / nextSeg.map.getTileHeight()); - break; - case BOTTOM: - nextOffset.x += (currConn.pos.x / currSeg.map.getTileWidth()) - (nextConn.pos.x / nextSeg.map.getTileWidth()); - nextOffset.y += currSeg.getHeight(); - break; - case LEFT: - nextOffset.x -= nextSeg.getWidth(); - nextOffset.y += (currConn.pos.y / currSeg.map.getTileHeight()) - (nextConn.pos.y / nextSeg.map.getTileHeight()); - break; - default: - break; + currConn.connect(nextConn); + + switch (currConn.side) { + case CENTRE: + break; + case TOP: + nextOffset.x += (currConn.pos.x / currSeg.map.getTileWidth()) - (nextConn.pos.x / nextSeg.map.getTileWidth()); + nextOffset.y -= nextSeg.getHeight(); + break; + case RIGHT: + nextOffset.x += currSeg.getWidth(); + nextOffset.y += (currConn.pos.y / currSeg.map.getTileHeight()) - (nextConn.pos.y / nextSeg.map.getTileHeight()); + break; + case BOTTOM: + nextOffset.x += (currConn.pos.x / currSeg.map.getTileWidth()) - (nextConn.pos.x / nextSeg.map.getTileWidth()); + nextOffset.y += currSeg.getHeight(); + break; + case LEFT: + nextOffset.x -= nextSeg.getWidth(); + nextOffset.y += (currConn.pos.y / currSeg.map.getTileHeight()) - (nextConn.pos.y / nextSeg.map.getTileHeight()); + break; + default: + break; + } + GameLog.d("LS-MAP", "segment #" + i + " : '" + nextSeg.map.getFilePath() + + "' entrée depuis " + nextConn + " offset=" + nextOffset); } - GameLog.d("LS-MAP", "segment #" + i + " : '" + nextSeg.map.getFilePath() - + "' entrée depuis " + nextConn + " offset=" + nextOffset); + nextSeg.pos = new Vector2(nextOffset.x, nextOffset.y); + renderSegments.add(nextSeg); + addToMapSegGrid(mapSegGrid, nextSeg); + currSeg = nextSeg; } - nextSeg.pos = new Vector2(nextOffset.x, nextOffset.y); - renderSegments.add(nextSeg); - addToMapSegGrid(mapSegGrid, nextSeg); - currSeg = nextSeg; - } - // Grille du chemin principal en UN message (un println par ligne - // polluerait le tampon/journal sans valeur de debug supplémentaire). - StringBuilder gridSb = new StringBuilder("grille segments :\n"); - for(int y = 0; y < mapSegGridH; y++) { - for(int x = 0; x < mapSegGridW; x++) { - gridSb.append(mapSegGrid[x][y] != null ? " *" : " "); + // Grille du chemin principal en UN message (un println par ligne + // polluerait le tampon/journal sans valeur de debug supplémentaire). + StringBuilder gridSb = new StringBuilder("grille segments :\n"); + for(int y = 0; y < mapSegGridH; y++) { + for(int x = 0; x < mapSegGridW; x++) { + gridSb.append(mapSegGrid[x][y] != null ? " *" : " "); + } + gridSb.append('\n'); } - gridSb.append('\n'); - } - GameLog.d("LS-MAP", gridSb.toString()); + GameLog.d("LS-MAP", gridSb.toString()); - // Find "free" connectors and fill them up. - ArrayList lockSegmentsToRender = new ArrayList<>(); - for(MapSegment seg : renderSegments) { - for(MapSegmentConnector conn : seg.connectors) { - if(conn.isConnected()) { - continue; + // Find "free" connectors and fill them up. + ArrayList lockSegmentsToRender = new ArrayList<>(); + for(MapSegment seg : renderSegments) { + for(MapSegmentConnector conn : seg.connectors) { + if(conn.isConnected()) { + continue; + } + ArrayList lockSegments = mapCfg.lockSegments.get(conn.toString()); + if(lockSegments == null) { + continue; + } + // Get valid lock segment and instantiate copy + MapSegment lockSeg = new MapSegment(getRandObj(lockSegments).map); + lockSeg.pos = seg.pos; + if(lockSeg.connectors.size() != 1) + { + // POURQUOI : un segment de verrou mal câblé casse le + // remplissage des connecteurs libres en silence — en + // procédural, ça se voit plus tard comme un couloir mort. + GameLog.e("LS-MAP", "segment de verrou '" + lockSeg.map.getFilePath() + + "' a " + lockSeg.connectors.size() + " connecteur(s) au lieu d'1 !"); + } + conn.connect(lockSeg.connectors.get(0)); + lockSegmentsToRender.add(lockSeg); } - ArrayList lockSegments = mapCfg.lockSegments.get(conn.toString()); - if(lockSegments == null) { - continue; - } - // Get valid lock segment and instantiate copy - MapSegment lockSeg = new MapSegment(getRandObj(lockSegments).map); - lockSeg.pos = seg.pos; - if(lockSeg.connectors.size() != 1) - { - // POURQUOI : un segment de verrou mal câblé casse le - // remplissage des connecteurs libres en silence — en - // procédural, ça se voit plus tard comme un couloir mort. - GameLog.e("LS-MAP", "segment de verrou '" + lockSeg.map.getFilePath() - + "' a " + lockSeg.connectors.size() + " connecteur(s) au lieu d'1 !"); - } - conn.connect(lockSeg.connectors.get(0)); - lockSegmentsToRender.add(lockSeg); } - } - for(MapSegment seg : lockSegmentsToRender) { - renderSegments.add(seg); - } + for(MapSegment seg : lockSegmentsToRender) { + renderSegments.add(seg); + } + + /* + * VALIDATION SUR DONNÉE : la solidité est remplie SANS instancier + * (les tuiles GameObject ne sont posées qu'après acceptation) — + * le flood de l'ancre décide si le vaisseau tient debout. + */ + int[][] scratch = new int[solidityW][solidityH]; + for (MapSegment seg : renderSegments) remplirSoliditeData(seg, scratch); + if (findLargestInteriorAnchor(scratch) != null) { + soliditeValidee = scratch; + break; + } + GameLog.w("LS-MAP", "génération dégénérée (coque non scellée, aucun intérieur) — re-tirage " + + (tentative + 1) + "/" + tentativesMax + " (seed " + proceduralSeed + ")"); + } + solidityMap = new int[solidityW][solidityH]; + /* + * Repli historique : après 20 tirages sans intérieur scellé (jamais + * vu — le tirage dégage une coque scellée bien avant), on garde la + * DERNIÈRE génération plutôt que de ne pas charger la mission. + */ + if (soliditeValidee == null) { + GameLog.e("LS-MAP", "20 générations sans intérieur scellé — map conservée telle quelle"); + for (MapSegment seg : renderSegments) remplirSoliditeData(seg, solidityMap); + } for(MapSegment seg : renderSegments) { loadMapSegment(seg); } + /* + * Portes procédurales (retour v0.16.0 : « en exterminate il n'y a + * pas assez de portes ouvrantes — celles s'ouvrant sur le côté pour + * permettre le passage, comme celles de la map Defend — mets en + * plus ») : les segments corpus 2017 ne contiennent AUCUN objet + * door (constat : les portes n'existent qu'à la main dans + * defense0). POURQUOI une injection runtime est IMPOSSIBLE avec la + * géométrie existante : le prefab Door est fait pour une traversée + * HORIZONTALE (les DoorColliders linteau/plancher bloqueraient une + * chute verticale même porte ouverte) et les passages horizontaux + * du corpus procédural sont des halls de 20-50 colonnes — toute + * porte y est contournable, aucun couloir étroit n'existe à + * rétro-fitter. La solution est ASSET : trois segments-couloirs + * main_16x16_corridor_{a,b,c}.tmx (gueule de porte exacte 2 cols × + * 5 rangées, objet door au milieu, connecteurs l_0/r_0 alignés + * rangée 11 comme tous les segments main) — le générateur les + * chaîne naturellement entre les salles. + */ + /* + * Outil QA : dump de la carte de solidité (LS_DUMP_SOLIDITE=1, + * desktop) pour calibrer les motifs d'injection de portes contre la + * structure RÉELLE des maps générées. + */ + if ("1".equals(System.getenv("LS_DUMP_SOLIDITE"))) { + try { + java.io.PrintWriter pw = new java.io.PrintWriter("/tmp/solidite.txt"); + for (int j = 0; j < solidityMap[0].length; j++) { + StringBuilder row = new StringBuilder(); + for (int i = 0; i < solidityMap.length; i++) { + row.append(solidityMap[i][j] == 1 ? '#' : '.'); + } + pw.println(row.toString()); + } + pw.close(); + GameLog.i("LS-MAP", "solidité dumpée : /tmp/solidite.txt"); + } catch (Exception ex) { + GameLog.e("LS-MAP", "dump solidité échoué : " + ex); + } + } + /* * Ancre par défaut INTÉRIEURE (réécriture v0.16.0) : si AUCUN segment * n'a posé de player_spawn (cas RÉEL constaté : seed 1794824738987, @@ -268,7 +356,15 @@ public class MapManager { * Le spawn joueur suit : player_spawn TMX s'il existe SINON la * cellule d'ancre elle-même (le joueur démarre dans la grande zone). */ - Vector2 ancreFlood = findLargestInteriorAnchor(); + Vector2 ancreFlood = findLargestInteriorAnchor(solidityMap); + if (ancreFlood == null) { + // Ne devrait plus arriver (la génération est validée sur donnée + // AVANT instantiation — cf. le re-tirage) : repli historique + // plutôt que NPE. + ancreFlood = new Vector2((int) (PROC_START_POS.x * TILE_SIZE * MAP_SCALE / 100f) * 100f, + (int) (PROC_START_POS.y * TILE_SIZE * MAP_SCALE / 100f) * 100f); + GameLog.e("LS-MAP", "aucun intérieur après instantiation — repli " + ancreFlood); + } if (playerSpawn.x == 0 && playerSpawn.y == 0) { playerSpawn = ancreFlood; GameLog.w("LS-MAP", "aucun player_spawn TMX posé par les segments — " @@ -308,25 +404,36 @@ public class MapManager { * est disqualifié d'office. Coût : quelques floods bornés sur grille * 256x512, une fois par génération — négligeable. */ - private static Vector2 findLargestInteriorAnchor() { + private static Vector2 findLargestInteriorAnchor(int[][] solidite) { int startX = (int) (PROC_START_POS.x * TILE_SIZE * MAP_SCALE / 100f); int startY = (int) (PROC_START_POS.y * TILE_SIZE * MAP_SCALE / 100f); Vector2 best = new Vector2(startX * 100f, startY * 100f); int bestFlood = -1; - for (int i = startX; i < solidityMap.length - 2; i += 2) { - for (int j = startY; j < solidityMap[0].length - 3; j += 2) { - if (solidityMap[i][j] != 0 || solidityMap[i + 1][j] != 0) continue; - if (solidityMap[i][j + 1] != 0 || solidityMap[i + 1][j + 1] != 0) continue; - if (solidityMap[i][j + 2] != 1 || solidityMap[i + 1][j + 2] != 1) continue; - int taille = floodBorneTaille(i, j); + for (int i = startX; i < solidite.length - 2; i += 2) { + for (int j = startY; j < solidite[0].length - 3; j += 2) { + if (solidite[i][j] != 0 || solidite[i + 1][j] != 0) continue; + if (solidite[i][j + 1] != 0 || solidite[i + 1][j + 1] != 0) continue; + if (solidite[i][j + 2] != 1 || solidite[i + 1][j + 2] != 1) continue; + int taille = floodBorneTaille(solidite, i, j); if (taille > bestFlood) { bestFlood = taille; best = new Vector2(i * 100f, j * 100f); } } } + if (bestFlood <= 0) { + /* + * NULL = AUCUN intérieur scellé dans la carte : l'appelant (le + * re-tirage de génération) refuse ce tirage au lieu de poser + * l'ancien repli (0, PROC_START) hors vaisseau — le « joueur + * spawné hors de la map » (bug récurrent, seed sweep + * 55642947464 : toutes les salles fuyaient vers le vide). + */ + GameLog.w("LS-MAP", "ancre de flood : AUCUNE zone intérieure scellée (repli refusé)"); + return null; + } GameLog.i("LS-MAP", "ancre de flood : plus grande zone intérieure = " - + (bestFlood < 0 ? "?" : bestFlood + " cellules") + " depuis " + best); + + bestFlood + " cellules depuis " + best); return best; } @@ -337,7 +444,7 @@ public class MapManager { * départ comptée. Même algorithme que floodBorne (critère d'intériorité) * mais renvoie la TAILLE pour comparer les zones. */ - private static int floodBorneTaille(int i0, int j0) { + private static int floodBorneTaille(int[][] solidite, int i0, int j0) { /* * FLOOD_MAX = la grille ENTIÈRE (fix seed 1794907661113 : 40000 * était trop petit — l'intérieur d'une map 16 rooms dépasse @@ -347,9 +454,9 @@ public class MapManager { * w*h est la vraie borne supérieure d'un flood, la garde * anti-dérive n'a pas besoin d'être plus stricte. */ - int w = solidityMap.length; - final int FLOOD_MAX = w * solidityMap[0].length; - int h = solidityMap[0].length; + int w = solidite.length; + final int FLOOD_MAX = w * solidite[0].length; + int h = solidite[0].length; java.util.ArrayDeque pile = new java.util.ArrayDeque<>(); java.util.HashSet vus = new java.util.HashSet<>(); pile.push(new int[]{i0, j0}); @@ -361,12 +468,12 @@ public class MapManager { int j = c[1]; if (++count > FLOOD_MAX) return -1; if (i <= 0 || i >= w - 1 || j <= 0 || j >= h - 1) return -1; - if (solidityMap[i][j] != 0) continue; + if (solidite[i][j] != 0) continue; int[][] voisins = {{i - 1, j}, {i + 1, j}, {i, j - 1}, {i, j + 1}}; for (int[] v : voisins) { long key = ((long) v[0] << 32) | (long) v[1]; if (!vus.contains(key) && v[0] >= 0 && v[0] < w && v[1] >= 0 && v[1] < h - && solidityMap[v[0]][v[1]] == 0) { + && solidite[v[0]][v[1]] == 0) { vus.add(key); pile.push(v); } @@ -892,6 +999,56 @@ public class MapManager { + ennemisDedies + " ennemi(s) placé(s) dans le TMX"); } + /** + * Remplissage DATA-ONLY de la solidité depuis les TMX d'un segment + * (miroir exact d'instantiateTiles + du scellage de portes du bloc + * "For doors" de instantiateObjects) — SANS poser de GameObject. Servi + * par la validation de génération (rejet des tirages à coque non + * scellée) : le flood de l'ancre doit décider AVANT qu'une seule tuile + * n'instancie (une map refusée ne laisse RIEN derrière elle). + */ + private static void remplirSoliditeData(MapSegment seg, int[][] solidite) { + Vector2 offset = seg.pos; + for (Layer layer : seg.map.getTileLayers()) { + if (!"main".equals(layer.getName())) continue; + Tile[] tiles = layer.getTiles(); + for (int k = 0; k < tiles.length; k++) { + if (tiles[k].getGid() <= 0) continue; + int col = k % seg.map.getWidth(); + int row = k / seg.map.getWidth(); + try { + solidite[(int) (col + offset.x)][(int) (row + offset.y)] = 1; + } catch (ArrayIndexOutOfBoundsException ex) { + // Hors grille : même dégradation que l'instantiation. + } + } + } + for (ObjectGroup og : seg.map.getObjectGroups()) { + if (og.getName().equals("enemies") || og.getName().equals("spawns") + || og.getName().equals("connectors")) { + continue; + } + for (TMXObject object : og.getObjects()) { + if (!object.getType().contains("door")) continue; + int ci = object.getX() / TILE_SIZE + (int) offset.x; + int cj = object.getY() / TILE_SIZE + (int) offset.y; + try { + // Linteau (cj), corps (cj+1..cj+3), plancher (cj+4) : + // les 5 rangées de l'emprise de la porte, cf. + // instantiateObjects — la porte fermée est un mur. + for (int dx = 0; dx < 2; dx++) { + for (int dy = 0; dy <= 4; dy++) { + solidite[ci + dx][cj + dy] = 1; + } + } + } catch (ArrayIndexOutOfBoundsException ex) { + GameLog.e("LS-MAP", "solidité de porte (data) hors bornes : type=" + + object.getType() + " cellule=" + ci + "," + cj); + } + } + } + } + /** * Une porte vient de s'OUVRIR (appelé UNE FOIS par porte — latched — * depuis Door.open(), jamais à la fermeture : une porte ouverte reste diff --git a/lost-sector/src/main/resources/maps/procedural/corpus/main/main_16x16_corridor_a.tmx b/lost-sector/src/main/resources/maps/procedural/corpus/main/main_16x16_corridor_a.tmx new file mode 100644 index 0000000..b935761 --- /dev/null +++ b/lost-sector/src/main/resources/maps/procedural/corpus/main/main_16x16_corridor_a.tmx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lost-sector/src/main/resources/maps/procedural/corpus/main/main_16x16_corridor_b.tmx b/lost-sector/src/main/resources/maps/procedural/corpus/main/main_16x16_corridor_b.tmx new file mode 100644 index 0000000..6e7afb4 --- /dev/null +++ b/lost-sector/src/main/resources/maps/procedural/corpus/main/main_16x16_corridor_b.tmx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lost-sector/src/main/resources/maps/procedural/corpus/main/main_16x16_corridor_c.tmx b/lost-sector/src/main/resources/maps/procedural/corpus/main/main_16x16_corridor_c.tmx new file mode 100644 index 0000000..8fec3ed --- /dev/null +++ b/lost-sector/src/main/resources/maps/procedural/corpus/main/main_16x16_corridor_c.tmx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +