Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions Extensions/TileMap/JsExtension.js
Original file line number Diff line number Diff line change
Expand Up @@ -1804,7 +1804,11 @@ module.exports = {
this._editableTileMap,
textureCache,
displayMode,
layerIndex
layerIndex,
0,
this._editableTileMap.getDimensionX(),
0,
this._editableTileMap.getDimensionY()
);
}
);
Expand Down Expand Up @@ -1880,7 +1884,11 @@ module.exports = {
this._editableTileMap,
textureCache,
displayMode,
layerIndex
layerIndex,
0,
this._editableTileMap.getDimensionX(),
0,
this._editableTileMap.getDimensionY()
);
}
);
Expand Down Expand Up @@ -2259,7 +2267,11 @@ module.exports = {
this._editableTileMap,
textureCache,
'all', // No notion of visibility on simple tile maps.
0 // Only one layer is used on simple tile maps.
0, // Only one layer is used on simple tile maps.
0,
this._editableTileMap.getDimensionX(),
0,
this._editableTileMap.getDimensionY()
);
}
);
Expand Down Expand Up @@ -2324,7 +2336,11 @@ module.exports = {
this._editableTileMap,
textureCache,
'all',
0
0,
0,
this._editableTileMap.getDimensionX(),
0,
this._editableTileMap.getDimensionY()
);
}
);
Expand Down
30 changes: 3 additions & 27 deletions Extensions/TileMap/collision/TransformedTileMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ namespace gdjs {
*/
readonly y: integer;
private readonly hitBoxes: gdjs.Polygon[];
private affineTransformationUpToDateCount: integer = 0;
private affineTransformationUpToDateCount: integer = -1;

/**
* An reusable AffineTransformation to avoid allocations.
Expand All @@ -673,31 +673,7 @@ namespace gdjs {
this.layer = layer;
this.x = x;
this.y = y;
const definition = this.getDefinition();
this.hitBoxes = [];
if (definition) {
const tag = this.layer.tileMap.tag;
const definitionHitboxes = definition.getHitBoxes(tag);
if (definitionHitboxes) {
this.hitBoxes.length = definitionHitboxes.length;
for (
let polygonIndex = 0;
polygonIndex < this.hitBoxes.length;
polygonIndex++
) {
const polygon = new gdjs.Polygon();
this.hitBoxes[polygonIndex] = polygon;
polygon.vertices.length = definitionHitboxes[polygonIndex].length;
for (
let vertexIndex = 0;
vertexIndex < polygon.vertices.length;
vertexIndex++
) {
polygon.vertices[vertexIndex] = [0, 0];
}
}
}
}
}

/**
Expand Down Expand Up @@ -834,8 +810,8 @@ namespace gdjs {
) {
const defPolygon = definitionHitboxes[polygonIndex];
if (polygonIndex >= this.hitBoxes.length) {
// This can't happen in practice as only the simple tile map can be
// modify and it only contains full hit boxes.
// This only happens the first time (since only the simple tile
// map can be modified and it only contains full hit boxes).
this.hitBoxes[polygonIndex] = gdjs.Polygon.createRectangle(0, 0);
}
const polygon = this.hitBoxes[polygonIndex];
Expand Down
2 changes: 1 addition & 1 deletion Extensions/TileMap/helper/TileMapHelper.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Extensions/TileMap/helper/TileMapHelper.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Extensions/TileMap/helper/dts/model/TileMapModel.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
* A tile map model.
*
* Tile map files are parsed into this model by {@link TiledTileMapLoader} or {@link LDtkTileMapLoader}.
* This model is used for rendering ({@link TileMapRuntimeObjectPixiRenderer})
* This model is used for rending ({@link TileMapRuntimeObjectPixiRenderer})
* and hitboxes handling ({@link TransformedCollisionTileMap}).
* This allows to support new file format with only a new parser.
*/
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion Extensions/TileMap/helper/dts/render/TileMapPixiHelper.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,21 @@ export declare namespace PixiTileMapHelper {
* - everything (`all`).
* @param layerIndex If `displayMode` is set to `index`, the layer index to be
* displayed.
* @param leftBound Left bound position in tiles
* @param rightBound Right bound position in tiles
* @param topBound Top bound position in tiles
* @param bottomBound Button bound position in tiles
*/
function updatePixiTileMap(
untypedPixiTileMap: any,
tileMap: EditableTileMap,
textureCache: TileTextureCache,
displayMode: 'index' | 'visible' | 'all',
layerIndex: number
layerIndex: number,
leftBound: number,
rightBound: number,
topBound: number,
bottomBound: number
): void;
/**
* Re-renders the collision mask
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading