class A4MapLayer { constructor(width:number, height:number, gfs:A4GraphicFile[]) { this.width = width; this.height = height; this.graphicFiles = gfs; let startTile:number = 0; for(let i:number = 0;i0 && visibility[offset-1]==visibilityRegion) || (j0 && visibility[offset-this.width]==visibilityRegion) || (i0 && i>0 && visibility[offset-(1+this.width)]==visibilityRegion) || (j>0 && i0 && visibility[offset+1-this.width]==visibilityRegion) || (j=this.height) return; let y:number = i*this.tileHeight - offsety; let offset:number = i*this.width; let offsetWithoutElevation:number = (i+this.elevation)*this.width; let visibilityOffset:number = (i+this.elevation)*this.width; let ZSX:number = Math.floor(SCREEN_X/zoom); let x:number = -offsetx; for(let j:number = 0;j0 && visibility[visibilityOffset-1]==visibilityRegion) || (j0 && visibility[visibilityOffset-this.width]==visibilityRegion) || (i0 && i>0 && visibility[visibilityOffset-(1+this.width)]==visibilityRegion) || (j>0 && i0 && visibility[visibilityOffset+1-this.width]==visibilityRegion) || (j=(this.width+1)*this.tileWidth || y+dy>=(this.height+1)*this.tileHeight) return false; let tile_x:number = Math.floor(x/this.tileWidth); let tile_y:number = Math.floor(y/this.tileHeight); let tile_x2:number = Math.floor((x+dx-1)/this.tileWidth); let tile_y2:number = Math.floor((y+dy-1)/this.tileHeight); let tile:A4MapTile = null; for(let i:number = tile_y;i<=tile_y2;i++) { if (i<0) continue; if (i>=this.height) continue; for(let j:number = tile_x;j<=tile_x2;j++) { //if (j>=this.width) return false; if (j>=this.width) continue; tile = this.tiles[j+i*this.width]; if (tile != null && !tile.walkable) { return false; } } } return true; } seeThrough(tilex:number, tiley:number) : boolean { let tile:A4MapTile = this.tiles[tilex+tiley*this.width]; if (tile != null && !tile.seeThrough) { return false; } return true; } width:number; height:number; tileWidth:number; tileHeight:number; elevation:number = 0; // this indicates the elevation offset of the tiles in this layer graphicFiles:A4GraphicFile[] = []; gfs_startTile:number[] = []; canDig:number[] = []; tiles:A4MapTile[] = []; };