From cb983ed7105c618fd1f94f4fb3439683fe429c25 Mon Sep 17 00:00:00 2001 From: Dank074 Date: Sat, 15 May 2021 04:50:18 -0500 Subject: [PATCH] cleaned RoomPlane --- src/nitro/room/object/RoomPlaneData.ts | 6 +- src/nitro/room/object/RoomPlaneParser.ts | 6 +- .../object/visualization/room/RoomPlane.ts | 558 +++++++++--------- .../visualization/room/RoomVisualization.ts | 32 +- .../room/mask/PlaneMaskManager.ts | 4 +- .../room/rasterizer/basic/PlaneRasterizer.ts | 4 +- src/nitro/room/utils/SpriteDataCollector.ts | 8 +- src/room/object/visualization/IRoomPlane.ts | 8 +- 8 files changed, 313 insertions(+), 313 deletions(-) diff --git a/src/nitro/room/object/RoomPlaneData.ts b/src/nitro/room/object/RoomPlaneData.ts index e9f8f4c7..d8d483c6 100644 --- a/src/nitro/room/object/RoomPlaneData.ts +++ b/src/nitro/room/object/RoomPlaneData.ts @@ -104,12 +104,12 @@ export class RoomPlaneData return this._loc; } - public get _Str_5424(): IVector3D + public get leftSide(): IVector3D { return this._leftSide; } - public get _Str_4968(): IVector3D + public get rightSide(): IVector3D { return this._rightSide; } @@ -199,4 +199,4 @@ export class RoomPlaneData } return -1; } -} \ No newline at end of file +} diff --git a/src/nitro/room/object/RoomPlaneParser.ts b/src/nitro/room/object/RoomPlaneParser.ts index 827a8a16..e104325c 100644 --- a/src/nitro/room/object/RoomPlaneParser.ts +++ b/src/nitro/room/object/RoomPlaneParser.ts @@ -1385,7 +1385,7 @@ export class RoomPlaneParser if(!planeData) return null; - return planeData._Str_5424; + return planeData.leftSide; } public getPlaneRightSide(k: number): IVector3D @@ -1396,7 +1396,7 @@ export class RoomPlaneParser if(!planeData) return null; - return planeData._Str_4968; + return planeData.rightSide; } public getPlaneNormalDirection(k: number): IVector3D @@ -1697,4 +1697,4 @@ export class RoomPlaneParser { this._restrictedScale = scale; } -} \ No newline at end of file +} diff --git a/src/nitro/room/object/visualization/room/RoomPlane.ts b/src/nitro/room/object/visualization/room/RoomPlane.ts index 95e5626c..e12273a3 100644 --- a/src/nitro/room/object/visualization/room/RoomPlane.ts +++ b/src/nitro/room/object/visualization/room/RoomPlane.ts @@ -25,67 +25,67 @@ export class RoomPlane implements IRoomPlane private static _uniqueIdCounter: number = 1; private _disposed: boolean; - private _Str_16308: number; - private _Str_5221: Vector3d; + private _randomSeed: number; + private _origin: Vector3d; private _location: Vector3d; - private _Str_2920: Vector3d; - private _Str_2943: Vector3d; + private _leftSide: Vector3d; + private _rightSide: Vector3d; private _normal: Vector3d; - private _Str_5886: Vector3d[]; - private _Str_3406: number; + private _secondaryNormals: Vector3d[]; + private _geometryUpdateId: number; private _type: number; - private _Str_3816: boolean; - private _Str_1049: Graphics; - private _Str_13946: boolean; + private _isVisible: boolean; + private _bitmapData: Graphics; + private _hasTexture: boolean; private _offset: Point; private _relativeDepth: number; private _color: number; private _rasterizer: IPlaneRasterizer; - private _Str_4795: PlaneMaskManager = null; - private _Str_576: string; + private _maskManager: PlaneMaskManager = null; + private _id: string; private _uniqueId: number; - private _Str_20541: number; - private _Str_19707: number; - private _Str_21079: number; - private _Str_22024: number; - private _Str_2708: Map; - private _Str_5545: PlaneBitmapData; - private _Str_4542: boolean; - private _Str_4047: RoomPlaneBitmapMask[]; - private _Str_5088: RoomPlaneRectangleMask[]; - private _Str_4891: boolean; - private _Str_2730: Graphics; - private _Str_8341: RoomPlaneBitmapMask[]; - private _Str_14495: RoomPlaneRectangleMask[]; - private _Str_2820:Vector3d; - private _Str_2745:Vector3d; - private _Str_2639:Vector3d; - private _Str_2766:Vector3d; - private _Str_1720: number = 0; + private _textureOffsetX: number; + private _textureOffsetY: number; + private _textureMaxX: number; + private _textureMaxY: number; + private _textures: Map; + private _activeTexture: PlaneBitmapData; + private _useMask: boolean; + private _bitmapMasks: RoomPlaneBitmapMask[]; + private _rectangleMasks: RoomPlaneRectangleMask[]; + private _maskChanged: boolean; + private _maskBitmapData: Graphics; + private _bitmapMasksOld: RoomPlaneBitmapMask[]; + private _rectangleMasksOld: RoomPlaneRectangleMask[]; + private _cornerA:Vector3d; + private _cornerB:Vector3d; + private _cornerC:Vector3d; + private _cornerD:Vector3d; + private _width: number = 0; private _height: number = 0; - private _Str_7367: boolean; + private _canBeVisible: boolean; constructor(k: IVector3D, _arg_2: IVector3D, _arg_3: IVector3D, _arg_4: IVector3D, _arg_5: number, _arg_6: boolean, _arg_7: IVector3D[], _arg_8: number, _arg_9: number=0, _arg_10: number=0, _arg_11: number=0, _arg_12: number=0) { - this._Str_5886 = []; - this._Str_4047 = []; - this._Str_5088 = []; - this._Str_8341 = []; - this._Str_14495 = []; - this._Str_16308 = _arg_8; - this._Str_1049 = null; - this._Str_2730 = null; - this._Str_4891 = false; - this._Str_5545 = null; - this._Str_5221 = new Vector3d(); - this._Str_5221.assign(k); + this._secondaryNormals = []; + this._bitmapMasks = []; + this._rectangleMasks = []; + this._bitmapMasksOld = []; + this._rectangleMasksOld = []; + this._randomSeed = _arg_8; + this._bitmapData = null; + this._maskBitmapData = null; + this._maskChanged = false; + this._activeTexture = null; + this._origin = new Vector3d(); + this._origin.assign(k); this._location = new Vector3d(); this._location.assign(_arg_2); - this._Str_2920 = new Vector3d(); - this._Str_2920.assign(_arg_3); - this._Str_2943 = new Vector3d(); - this._Str_2943.assign(_arg_4); - this._normal = Vector3d.crossProduct(this._Str_2920, this._Str_2943); + this._leftSide = new Vector3d(); + this._leftSide.assign(_arg_3); + this._rightSide = new Vector3d(); + this._rightSide.assign(_arg_4); + this._normal = Vector3d.crossProduct(this._leftSide, this._rightSide); if(this._normal.length > 0) { this._normal.multiply((1 / this._normal.length)); @@ -100,32 +100,32 @@ export class RoomPlane implements IRoomPlane vector.assign(entry); - this._Str_5886.push(vector); + this._secondaryNormals.push(vector); } } this._disposed = false; - this._Str_3816 = false; - this._Str_576 = null; - this._Str_13946 = true; - this._Str_3406 = -1; + this._isVisible = false; + this._id = null; + this._hasTexture = true; + this._geometryUpdateId = -1; this._offset = new Point(); this._relativeDepth = 0; this._type = _arg_5; this._color = 0; this._rasterizer = null; - this._Str_7367 = true; - this._Str_2708 = new Map(); - this._Str_2820 = new Vector3d(); - this._Str_2745 = new Vector3d(); - this._Str_2639 = new Vector3d(); - this._Str_2766 = new Vector3d(); - this._Str_1720 = 0; + this._canBeVisible = true; + this._textures = new Map(); + this._cornerA = new Vector3d(); + this._cornerB = new Vector3d(); + this._cornerC = new Vector3d(); + this._cornerD = new Vector3d(); + this._width = 0; this._height = 0; - this._Str_20541 = _arg_9; - this._Str_19707 = _arg_10; - this._Str_21079 = _arg_11; - this._Str_22024 = _arg_12; - this._Str_4542 = _arg_6; + this._textureOffsetX = _arg_9; + this._textureOffsetY = _arg_10; + this._textureMaxX = _arg_11; + this._textureMaxY = _arg_12; + this._useMask = _arg_6; this._uniqueId = ++RoomPlane._uniqueIdCounter; } @@ -135,32 +135,32 @@ export class RoomPlane implements IRoomPlane //return Canvas.colorize(_arg_2, (k | 0xFF000000)) & 0xFFFFFF; } - public set _Str_14801(k: boolean) + public set canBeVisible(k: boolean) { - if(k !== this._Str_7367) + if(k !== this._canBeVisible) { - if(!this._Str_7367) this._Str_11000(); + if(!this._canBeVisible) this.resetTextureCache(); - this._Str_7367 = k; + this._canBeVisible = k; } } - public get _Str_14801(): boolean + public get canBeVisible(): boolean { - return this._Str_7367; + return this._canBeVisible; } public get bitmapData(): Texture { - if(!this.visible || !this._Str_1049) return null; + if(!this.visible || !this._bitmapData) return null; - let texture: RenderTexture = RoomVisualization.getTextureCache(this._Str_1049); + let texture: RenderTexture = RoomVisualization.getTextureCache(this._bitmapData); if(!texture) { - texture = TextureUtils.generateTexture(this._Str_1049, new Rectangle(0, 0, this._Str_1720, this._height)); + texture = TextureUtils.generateTexture(this._bitmapData, new Rectangle(0, 0, this._width, this._height)); - RoomVisualization.addTextureCache(this._Str_1049, texture); + RoomVisualization.addTextureCache(this._bitmapData, texture); } return texture; @@ -168,7 +168,7 @@ export class RoomPlane implements IRoomPlane public get visible(): boolean { - return (this._Str_3816 && this._Str_7367); + return (this._isVisible && this._canBeVisible); } public get offset(): Point @@ -196,14 +196,14 @@ export class RoomPlane implements IRoomPlane return this._type; } - public get _Str_5424(): IVector3D + public get leftSide(): IVector3D { - return this._Str_2920; + return this._leftSide; } - public get _Str_4968(): IVector3D + public get rightSide(): IVector3D { - return this._Str_2943; + return this._rightSide; } public get location(): IVector3D @@ -216,14 +216,14 @@ export class RoomPlane implements IRoomPlane return this._normal; } - public get _Str_18448(): boolean + public get hasTexture(): boolean { - return this._Str_13946; + return this._hasTexture; } - public set _Str_18448(k: boolean) + public set hasTexture(k: boolean) { - this._Str_13946 = k; + this._hasTexture = k; } public set rasterizer(k:IPlaneRasterizer) @@ -231,17 +231,17 @@ export class RoomPlane implements IRoomPlane this._rasterizer = k; } - public set _Str_16279(k: PlaneMaskManager) + public set maskManager(k: PlaneMaskManager) { - this._Str_4795 = k; + this._maskManager = k; } public set id(k: string) { - if(k === this._Str_576) return; + if(k === this._id) return; - this._Str_11000(); - this._Str_576 = k; + this.resetTextureCache(); + this._id = k; } public get uniqueId(): number @@ -251,16 +251,16 @@ export class RoomPlane implements IRoomPlane public dispose(): void { - if(this._Str_1049) + if(this._bitmapData) { - this._Str_1049.destroy(); + this._bitmapData.destroy(); - this._Str_1049 = null; + this._bitmapData = null; } - if(this._Str_2708) + if(this._textures) { - for(const bitmap of this._Str_2708.values()) + for(const bitmap of this._textures.values()) { if(!bitmap) continue; @@ -269,75 +269,75 @@ export class RoomPlane implements IRoomPlane bitmap.dispose(); } - this._Str_2708 = null; + this._textures = null; } - this._Str_5545 = null; + this._activeTexture = null; this._location = null; - this._Str_5221 = null; - this._Str_2920 = null; - this._Str_2943 = null; + this._origin = null; + this._leftSide = null; + this._rightSide = null; this._normal = null; this._rasterizer = null; - this._Str_2820 = null; - this._Str_2745 = null; - this._Str_2639 = null; - this._Str_2766 = null; - this._Str_4047 = null; - this._Str_5088 = null; + this._cornerA = null; + this._cornerB = null; + this._cornerC = null; + this._cornerD = null; + this._bitmapMasks = null; + this._rectangleMasks = null; - if(this._Str_2730) + if(this._maskBitmapData) { - this._Str_2730.destroy(); + this._maskBitmapData.destroy(); - this._Str_2730 = null; + this._maskBitmapData = null; } this._disposed = true; } - public _Str_24896(k: Texture): Texture + public copyBitmapData(k: Texture): Texture { - if(!this.visible || !this._Str_1049 || !k) return null; + if(!this.visible || !this._bitmapData || !k) return null; - if((this._Str_1049.width !== k.width) || (this._Str_1049.height !== k.height)) return null; + if((this._bitmapData.width !== k.width) || (this._bitmapData.height !== k.height)) return null; - //k.copyPixels(this._Str_1049, this._Str_1049.rect, RoomPlane.ZERO_POINT); + //k.copyPixels(this._bitmapData, this._bitmapData.rect, RoomPlane.ZERO_POINT); return k; } - private _Str_17642(k: string, _arg_2: PlaneBitmapData): boolean + private cacheTexture(k: string, _arg_2: PlaneBitmapData): boolean { - const existing = this._Str_2708.get(k); + const existing = this._textures.get(k); if(existing) { - this._Str_2708.delete(k); + this._textures.delete(k); existing.dispose(); } - this._Str_5545 = _arg_2; - this._Str_2708.set(k, _arg_2); + this._activeTexture = _arg_2; + this._textures.set(k, _arg_2); return true; } - private _Str_11000(k: Graphics = null): void + private resetTextureCache(k: Graphics = null): void { - if(this._Str_2708 && this._Str_2708.size) + if(this._textures && this._textures.size) { - for(const bitmap of this._Str_2708.values()) + for(const bitmap of this._textures.values()) { if(!bitmap) continue; bitmap.dispose(); } - this._Str_2708.clear(); + this._textures.clear(); } - this._Str_5545 = null; + this._activeTexture = null; } private getTextureIdentifier(k: number): string @@ -347,44 +347,44 @@ export class RoomPlane implements IRoomPlane return k.toString(); } - private _Str_10518(k: IRoomGeometry, _arg_2: number): boolean + private needsNewTexture(k: IRoomGeometry, _arg_2: number): boolean { if(!k) return false; - let planeBitmap = this._Str_5545; + let planeBitmap = this._activeTexture; if(!planeBitmap) { - planeBitmap = this._Str_2708.get(this.getTextureIdentifier(k.scale)); + planeBitmap = this._textures.get(this.getTextureIdentifier(k.scale)); } - this._Str_19336(); + this.updateMaskChangeStatus(); - if(this._Str_7367 && ((!planeBitmap || ((planeBitmap.timeStamp >= 0) && (_arg_2 > planeBitmap.timeStamp))) || this._Str_4891)) return true; + if(this._canBeVisible && ((!planeBitmap || ((planeBitmap.timeStamp >= 0) && (_arg_2 > planeBitmap.timeStamp))) || this._maskChanged)) return true; return false; } - private _Str_10114(k: IRoomGeometry, _arg_2: number): Graphics + private getTexture(k: IRoomGeometry, _arg_2: number): Graphics { if(!k) return null; let _local_3: PlaneBitmapData = null; - if(this._Str_10518(k, _arg_2)) + if(this.needsNewTexture(k, _arg_2)) { const _local_4 = this.getTextureIdentifier(k.scale); - const _local_5 = (this._Str_2920.length * k.scale); - const _local_6 = (this._Str_2943.length * k.scale); + const _local_5 = (this._leftSide.length * k.scale); + const _local_6 = (this._rightSide.length * k.scale); const _local_7 = k.getCoordinatePosition(this._normal); - if(this._Str_5545) + if(this._activeTexture) { - _local_3 = this._Str_5545; + _local_3 = this._activeTexture; } else { - _local_3 = this._Str_2708.get(_local_4); + _local_3 = this._textures.get(_local_4); } let _local_8: Graphics = null; @@ -393,7 +393,7 @@ export class RoomPlane implements IRoomPlane if(this._rasterizer) { - _local_3 = this._rasterizer.render(_local_8, this._Str_576, _local_5, _local_6, k.scale, _local_7, this._Str_13946, this._Str_20541, this._Str_19707, this._Str_21079, this._Str_22024, _arg_2); + _local_3 = this._rasterizer.render(_local_8, this._id, _local_5, _local_6, k.scale, _local_7, this._hasTexture, this._textureOffsetX, this._textureOffsetY, this._textureMaxX, this._textureMaxY, _arg_2); if(_local_3) { @@ -413,25 +413,25 @@ export class RoomPlane implements IRoomPlane if(_local_3) { - this._Str_17859(_local_3.bitmap, k); - this._Str_17642(_local_4, _local_3); + this.updateMask(_local_3.bitmap, k); + this.cacheTexture(_local_4, _local_3); } } else { - if(this._Str_5545) + if(this._activeTexture) { - _local_3 = this._Str_5545; + _local_3 = this._activeTexture; } else { - _local_3 = this._Str_2708.get(this.getTextureIdentifier(k.scale)); + _local_3 = this._textures.get(this.getTextureIdentifier(k.scale)); } } if(_local_3) { - this._Str_5545 = _local_3; + this._activeTexture = _local_3; return _local_3.bitmap; } @@ -439,21 +439,21 @@ export class RoomPlane implements IRoomPlane return null; } - private _Str_23649(k: IRoomGeometry): PlaneDrawingData + private resolveMasks(k: IRoomGeometry): PlaneDrawingData { - if(!this._Str_4542) return null; + if(!this._useMask) return null; const _local_5 = new PlaneDrawingData(); const index = 0; - while(index < this._Str_4047.length) + while(index < this._bitmapMasks.length) { - const mask = this._Str_4047[index]; + const mask = this._bitmapMasks[index]; if(mask) { - const planeMask = this._Str_4795._Str_8361(mask.type); + const planeMask = this._maskManager._Str_8361(mask.type); if(planeMask) { @@ -466,8 +466,8 @@ export class RoomPlane implements IRoomPlane if(asset) { - const _local_3 = (this._Str_2730.width * (1 - (mask._Str_5120 / this._Str_2920.length))); - const _local_4 = (this._Str_2730.height * (1 - (mask._Str_4659 / this._Str_2943.length))); + const _local_3 = (this._maskBitmapData.width * (1 - (mask._Str_5120 / this._leftSide.length))); + const _local_4 = (this._maskBitmapData.height * (1 - (mask._Str_4659 / this._rightSide.length))); const _local_11 = new Point((_local_3 + asset.offsetX), (_local_4 + asset.offsetY)); _local_5.addMask(assetName, _local_11, asset.flipH, asset.flipV); @@ -480,22 +480,22 @@ export class RoomPlane implements IRoomPlane return _local_5; } - private _Str_24802(k: IRoomGeometry): number + private screenWidth(k: IRoomGeometry): number { const _local_2 = k.getScreenPoint(new Vector3d(0, 0, 0)); const _local_3 = k.getScreenPoint(new Vector3d(0, 1, 0)); - return Math.round((this._Str_2920.length * Math.abs((_local_2.x - _local_3.x)))); + return Math.round((this._leftSide.length * Math.abs((_local_2.x - _local_3.x)))); } - public _Str_22136(geometry:IRoomGeometry): PlaneDrawingData[] + public getDrawingDatas(geometry:IRoomGeometry): PlaneDrawingData[] { const drawingDatas: PlaneDrawingData[] = []; - if(this._Str_3816) + if(this._isVisible) { - const maskData = this._Str_23649(geometry); - const layers = this._rasterizer._Str_8988(this._Str_576); + const maskData = this.resolveMasks(geometry); + const layers = this._rasterizer._Str_8988(this._id); let i = 0; @@ -505,16 +505,16 @@ export class RoomPlane implements IRoomPlane if(layer) { - if(this._Str_13946 && layer._Str_8547()) + if(this._hasTexture && layer._Str_8547()) { const normal = geometry.getCoordinatePosition(this._normal); const cm = layer._Str_8547()._Str_21968(normal); //const data = new PlaneDrawingData(maskData, blend(this._color, layer._Str_751()), cm._Str_14945()); const data = new PlaneDrawingData(maskData, this._color, cm._Str_14945()); - Randomizer._Str_17384(this._Str_16308); + Randomizer._Str_17384(this._randomSeed); - for(const column of cm._Str_23721(this._Str_24802(geometry))) + for(const column of cm._Str_23721(this.screenWidth(geometry))) { const assetNames: string[] = []; @@ -563,16 +563,16 @@ export class RoomPlane implements IRoomPlane let geometryChanged = false; - if(this._Str_3406 != geometry.updateId) geometryChanged = true; + if(this._geometryUpdateId != geometry.updateId) geometryChanged = true; - if(!geometryChanged || !this._Str_7367) + if(!geometryChanged || !this._canBeVisible) { if(!this.visible) return false; } if(geometryChanged) { - this._Str_5545 = null; + this._activeTexture = null; let cosAngle = 0; @@ -580,9 +580,9 @@ export class RoomPlane implements IRoomPlane if(cosAngle > -0.001) { - if(this._Str_3816) + if(this._isVisible) { - this._Str_3816 = false; + this._isVisible = false; return true; } @@ -591,15 +591,15 @@ export class RoomPlane implements IRoomPlane let i = 0; - while(i < this._Str_5886.length) + while(i < this._secondaryNormals.length) { - cosAngle = Vector3d.cosAngle(geometry.directionAxis, this._Str_5886[i]); + cosAngle = Vector3d.cosAngle(geometry.directionAxis, this._secondaryNormals[i]); if(cosAngle > -0.001) { - if(this._Str_3816) + if(this._isVisible) { - this._Str_3816 = false; + this._isVisible = false; return true; } @@ -609,16 +609,16 @@ export class RoomPlane implements IRoomPlane i++; } - this._Str_18702(geometry); + this.updateCorners(geometry); - const originPos = geometry.getScreenPosition(this._Str_5221); + const originPos = geometry.getScreenPosition(this._origin); const originZ = originPos.z; - let relativeDepth = (Math.max(this._Str_2820.z, this._Str_2745.z, this._Str_2639.z, this._Str_2766.z) - originZ); + let relativeDepth = (Math.max(this._cornerA.z, this._cornerB.z, this._cornerC.z, this._cornerD.z) - originZ); if(this._type === RoomPlane.TYPE_FLOOR) { - relativeDepth = (relativeDepth - ((this._location.z + Math.min(0, this._Str_2920.z, this._Str_2943.z)) * 8)); + relativeDepth = (relativeDepth - ((this._location.z + Math.min(0, this._leftSide.z, this._rightSide.z)) * 8)); } if(this._type === RoomPlane.TYPE_LANDSCAPE) @@ -627,50 +627,50 @@ export class RoomPlane implements IRoomPlane } this._relativeDepth = relativeDepth; - this._Str_3816 = true; - this._Str_3406 = geometry.updateId; + this._isVisible = true; + this._geometryUpdateId = geometry.updateId; } - if(geometryChanged || this._Str_10518(geometry, timeSinceStartMs)) + if(geometryChanged || this.needsNewTexture(geometry, timeSinceStartMs)) { - if(!this._Str_1049 || (this._Str_1720 !== this._Str_1049.width) || (this._height !== this._Str_1049.height)) + if(!this._bitmapData || (this._width !== this._bitmapData.width) || (this._height !== this._bitmapData.height)) { - if(this._Str_1049) + if(this._bitmapData) { - this._Str_1049.destroy(); + this._bitmapData.destroy(); - this._Str_1049 = null; + this._bitmapData = null; - if((this._Str_1720 < 1) || (this._height < 1)) return true; + if((this._width < 1) || (this._height < 1)) return true; } else { - if((this._Str_1720 < 1) || (this._height < 1)) return false; + if((this._width < 1) || (this._height < 1)) return false; } const graphic = new Graphics(); graphic.beginFill(0xFFFFFF, 0); - graphic.drawRect(0, 0, this._Str_1720, this._height); + graphic.drawRect(0, 0, this._width, this._height); graphic.endFill(); - this._Str_1049 = graphic; + this._bitmapData = graphic; - if(!this._Str_1049) return false; + if(!this._bitmapData) return false; } else { - //this._Str_1049.lock(); - //this._Str_1049.fillRect(this._Str_1049.rect, 0xFFFFFF); + //this._bitmapData.lock(); + //this._bitmapData.fillRect(this._bitmapData.rect, 0xFFFFFF); } - Randomizer._Str_17384(this._Str_16308); + Randomizer._Str_17384(this._randomSeed); - const texture = this._Str_10114(geometry, timeSinceStartMs); + const texture = this.getTexture(geometry, timeSinceStartMs); if(texture) { - this._Str_17000(geometry, texture); + this.renderTexture(geometry, texture); } else { @@ -685,53 +685,53 @@ export class RoomPlane implements IRoomPlane return false; } - private _Str_18702(k: IRoomGeometry): void + private updateCorners(k: IRoomGeometry): void { - this._Str_2820.assign(k.getScreenPosition(this._location)); - this._Str_2745.assign(k.getScreenPosition(Vector3d.sum(this._location, this._Str_2943))); - this._Str_2639.assign(k.getScreenPosition(Vector3d.sum(Vector3d.sum(this._location, this._Str_2920), this._Str_2943))); - this._Str_2766.assign(k.getScreenPosition(Vector3d.sum(this._location, this._Str_2920))); - this._offset = k.getScreenPoint(this._Str_5221); - this._Str_2820.x = Math.round(this._Str_2820.x); - this._Str_2820.y = Math.round(this._Str_2820.y); - this._Str_2745.x = Math.round(this._Str_2745.x); - this._Str_2745.y = Math.round(this._Str_2745.y); - this._Str_2639.x = Math.round(this._Str_2639.x); - this._Str_2639.y = Math.round(this._Str_2639.y); - this._Str_2766.x = Math.round(this._Str_2766.x); - this._Str_2766.y = Math.round(this._Str_2766.y); + this._cornerA.assign(k.getScreenPosition(this._location)); + this._cornerB.assign(k.getScreenPosition(Vector3d.sum(this._location, this._rightSide))); + this._cornerC.assign(k.getScreenPosition(Vector3d.sum(Vector3d.sum(this._location, this._leftSide), this._rightSide))); + this._cornerD.assign(k.getScreenPosition(Vector3d.sum(this._location, this._leftSide))); + this._offset = k.getScreenPoint(this._origin); + this._cornerA.x = Math.round(this._cornerA.x); + this._cornerA.y = Math.round(this._cornerA.y); + this._cornerB.x = Math.round(this._cornerB.x); + this._cornerB.y = Math.round(this._cornerB.y); + this._cornerC.x = Math.round(this._cornerC.x); + this._cornerC.y = Math.round(this._cornerC.y); + this._cornerD.x = Math.round(this._cornerD.x); + this._cornerD.y = Math.round(this._cornerD.y); this._offset.x = Math.round(this._offset.x); this._offset.y = Math.round(this._offset.y); - const _local_2: number = Math.min(this._Str_2820.x, this._Str_2745.x, this._Str_2639.x, this._Str_2766.x); - let _local_3: number = Math.max(this._Str_2820.x, this._Str_2745.x, this._Str_2639.x, this._Str_2766.x); - const _local_4: number = Math.min(this._Str_2820.y, this._Str_2745.y, this._Str_2639.y, this._Str_2766.y); - let _local_5: number = Math.max(this._Str_2820.y, this._Str_2745.y, this._Str_2639.y, this._Str_2766.y); + const _local_2: number = Math.min(this._cornerA.x, this._cornerB.x, this._cornerC.x, this._cornerD.x); + let _local_3: number = Math.max(this._cornerA.x, this._cornerB.x, this._cornerC.x, this._cornerD.x); + const _local_4: number = Math.min(this._cornerA.y, this._cornerB.y, this._cornerC.y, this._cornerD.y); + let _local_5: number = Math.max(this._cornerA.y, this._cornerB.y, this._cornerC.y, this._cornerD.y); _local_3 = (_local_3 - _local_2); this._offset.x = (this._offset.x - _local_2); - this._Str_2820.x = (this._Str_2820.x - _local_2); - this._Str_2745.x = (this._Str_2745.x - _local_2); - this._Str_2639.x = (this._Str_2639.x - _local_2); - this._Str_2766.x = (this._Str_2766.x - _local_2); + this._cornerA.x = (this._cornerA.x - _local_2); + this._cornerB.x = (this._cornerB.x - _local_2); + this._cornerC.x = (this._cornerC.x - _local_2); + this._cornerD.x = (this._cornerD.x - _local_2); _local_5 = (_local_5 - _local_4); this._offset.y = (this._offset.y - _local_4); - this._Str_2820.y = (this._Str_2820.y - _local_4); - this._Str_2745.y = (this._Str_2745.y - _local_4); - this._Str_2639.y = (this._Str_2639.y - _local_4); - this._Str_2766.y = (this._Str_2766.y - _local_4); - this._Str_1720 = _local_3; + this._cornerA.y = (this._cornerA.y - _local_4); + this._cornerB.y = (this._cornerB.y - _local_4); + this._cornerC.y = (this._cornerC.y - _local_4); + this._cornerD.y = (this._cornerD.y - _local_4); + this._width = _local_3; this._height = _local_5; } - private _Str_17000(k: IRoomGeometry, _arg_2: Graphics): void + private renderTexture(k: IRoomGeometry, _arg_2: Graphics): void { - if(((((((this._Str_2820 == null) || (this._Str_2745 == null)) || (this._Str_2639 == null)) || (this._Str_2766 == null)) || (_arg_2 == null)) || (this._Str_1049 == null))) + if(((((((this._cornerA == null) || (this._cornerB == null)) || (this._cornerC == null)) || (this._cornerD == null)) || (_arg_2 == null)) || (this._bitmapData == null))) { return; } - let _local_3: number = (this._Str_2766.x - this._Str_2639.x); - let _local_4: number = (this._Str_2766.y - this._Str_2639.y); - let _local_5: number = (this._Str_2745.x - this._Str_2639.x); - let _local_6: number = (this._Str_2745.y - this._Str_2639.y); + let _local_3: number = (this._cornerD.x - this._cornerC.x); + let _local_4: number = (this._cornerD.y - this._cornerC.y); + let _local_5: number = (this._cornerB.x - this._cornerC.x); + let _local_6: number = (this._cornerB.y - this._cornerC.y); if(((this._type == RoomPlane.TYPE_WALL) || (this._type == RoomPlane.TYPE_LANDSCAPE))) { if(Math.abs((_local_5 - _arg_2.width)) <= 1) @@ -760,7 +760,7 @@ export class RoomPlane implements IRoomPlane _local_11.b = _local_8; _local_11.c = _local_9; _local_11.d = _local_10; - _local_11.translate(this._Str_2639.x, this._Str_2639.y); + _local_11.translate(this._cornerC.x, this._cornerC.y); this.draw(_arg_2, _local_11); } @@ -771,26 +771,26 @@ export class RoomPlane implements IRoomPlane clone.transform.setFromMatrix(matrix); - this._Str_1049 = clone; + this._bitmapData = clone; } - public _Str_25213(): void + public resetBitmapMasks(): void { - if(this._disposed || !this._Str_4542 || !this._Str_4047.length) return; + if(this._disposed || !this._useMask || !this._bitmapMasks.length) return; - this._Str_4891 = true; - this._Str_4047 = []; + this._maskChanged = true; + this._bitmapMasks = []; } - public _Str_24569(k: string, _arg_2: number, _arg_3: number): boolean + public addBitmapMask(k: string, _arg_2: number, _arg_3: number): boolean { - if(!this._Str_4542) return false; + if(!this._useMask) return false; let _local_5 = 0; - while(_local_5 < this._Str_4047.length) + while(_local_5 < this._bitmapMasks.length) { - const mask = this._Str_4047[_local_5]; + const mask = this._bitmapMasks[_local_5]; if(mask) { @@ -802,25 +802,25 @@ export class RoomPlane implements IRoomPlane const mask = new RoomPlaneBitmapMask(k, _arg_2, _arg_3); - this._Str_4047.push(mask); - this._Str_4891 = true; + this._bitmapMasks.push(mask); + this._maskChanged = true; return true; } - public _Str_25934(): void + public resetRectangleMasks(): void { - if(!this._Str_4542 || !this._Str_5088.length) return; + if(!this._useMask || !this._rectangleMasks.length) return; - this._Str_4891 = true; - this._Str_5088 = []; + this._maskChanged = true; + this._rectangleMasks = []; } - public _Str_24758(k: number, _arg_2: number, _arg_3: number, _arg_4: number): boolean + public addRectangleMask(k: number, _arg_2: number, _arg_3: number, _arg_4: number): boolean { - if(this._Str_4542) + if(this._useMask) { - for(const mask of this._Str_5088) + for(const mask of this._rectangleMasks) { if(!mask) continue; @@ -829,8 +829,8 @@ export class RoomPlane implements IRoomPlane const _local_5 = new RoomPlaneRectangleMask(k, _arg_2, _arg_3, _arg_4); - this._Str_5088.push(_local_5); - this._Str_4891 = true; + this._rectangleMasks.push(_local_5); + this._maskChanged = true; return true; } @@ -838,22 +838,22 @@ export class RoomPlane implements IRoomPlane return false; } - private _Str_19336(): void + private updateMaskChangeStatus(): void { - if(!this._Str_4891) return; + if(!this._maskChanged) return; let _local_3 = true; let _local_6: boolean; - if(this._Str_4047.length === this._Str_8341.length) + if(this._bitmapMasks.length === this._bitmapMasksOld.length) { - for(const mask of this._Str_4047) + for(const mask of this._bitmapMasks) { if(!mask) continue; _local_6 = false; - for(const plane of this._Str_8341) + for(const plane of this._bitmapMasksOld) { if(!plane) continue; @@ -878,28 +878,28 @@ export class RoomPlane implements IRoomPlane _local_3 = false; } - if(this._Str_5088.length > this._Str_14495.length) _local_3 = false; + if(this._rectangleMasks.length > this._rectangleMasksOld.length) _local_3 = false; - if(_local_3) this._Str_4891 = false; + if(_local_3) this._maskChanged = false; } - private _Str_17859(texture: Graphics, geometry: IRoomGeometry): void + private updateMask(texture: Graphics, geometry: IRoomGeometry): void { if(!texture || !geometry) return; - if(((!this._Str_4542) || ((!this._Str_4047.length && !this._Str_5088.length) && !this._Str_4891)) || !this._Str_4795) return; + if(((!this._useMask) || ((!this._bitmapMasks.length && !this._rectangleMasks.length) && !this._maskChanged)) || !this._maskManager) return; const width = texture.width; const height = texture.height; - this._Str_19336(); + this.updateMaskChangeStatus(); - if(!this._Str_2730 || (this._Str_2730.width !== width) || (this._Str_2730.height !== height)) + if(!this._maskBitmapData || (this._maskBitmapData.width !== width) || (this._maskBitmapData.height !== height)) { - if(this._Str_2730) + if(this._maskBitmapData) { - this._Str_2730.destroy(); - this._Str_2730 = null; + this._maskBitmapData.destroy(); + this._maskBitmapData = null; } const graphic = new Graphics(); @@ -909,24 +909,24 @@ export class RoomPlane implements IRoomPlane .drawRect(0, 0, width, height) .endFill(); - this._Str_2730 = graphic; - this._Str_4891 = true; + this._maskBitmapData = graphic; + this._maskChanged = true; } - if(this._Str_4891) + if(this._maskChanged) { - this._Str_8341 = []; - this._Str_14495 = []; + this._bitmapMasksOld = []; + this._rectangleMasksOld = []; - if(this._Str_2730) + if(this._maskBitmapData) { - this._Str_2730 + this._maskBitmapData .beginFill(0xFFFFFF, 0) .drawRect(0, 0, width, height) .endFill(); } - this._Str_11000(texture); + this.resetTextureCache(texture); const normal = geometry.getCoordinatePosition(this._normal); @@ -935,18 +935,18 @@ export class RoomPlane implements IRoomPlane let posY = 0; let i = 0; - while(i < this._Str_4047.length) + while(i < this._bitmapMasks.length) { - const mask = this._Str_4047[i]; + const mask = this._bitmapMasks[i]; if(mask) { type = mask.type; - posX = (this._Str_2730.width - ((this._Str_2730.width * mask._Str_5120) / this._Str_2920.length)); - posY = (this._Str_2730.height - ((this._Str_2730.height * mask._Str_4659) / this._Str_2943.length)); + posX = (this._maskBitmapData.width - ((this._maskBitmapData.width * mask._Str_5120) / this._leftSide.length)); + posY = (this._maskBitmapData.height - ((this._maskBitmapData.height * mask._Str_4659) / this._rightSide.length)); - this._Str_4795._Str_17859(this._Str_2730, type, geometry.scale, normal, posX, posY); - this._Str_8341.push(new RoomPlaneBitmapMask(type, mask._Str_5120, mask._Str_4659)); + this._maskManager.updateMask(this._maskBitmapData, type, geometry.scale, normal, posX, posY); + this._bitmapMasksOld.push(new RoomPlaneBitmapMask(type, mask._Str_5120, mask._Str_4659)); } i++; @@ -954,36 +954,36 @@ export class RoomPlane implements IRoomPlane i = 0; - while(i < this._Str_5088.length) + while(i < this._rectangleMasks.length) { - const rectMask = this._Str_5088[i]; + const rectMask = this._rectangleMasks[i]; if(rectMask) { - posX = (this._Str_2730.width - ((this._Str_2730.width * rectMask._Str_5120) / this._Str_2920.length)); - posY = (this._Str_2730.height - ((this._Str_2730.height * rectMask._Str_4659) / this._Str_2943.length)); + posX = (this._maskBitmapData.width - ((this._maskBitmapData.width * rectMask._Str_5120) / this._leftSide.length)); + posY = (this._maskBitmapData.height - ((this._maskBitmapData.height * rectMask._Str_4659) / this._rightSide.length)); - const wd = ((this._Str_2730.width * rectMask._Str_9124) / this._Str_2920.length); - const ht = ((this._Str_2730.height * rectMask._Str_12156) / this._Str_2943.length); + const wd = ((this._maskBitmapData.width * rectMask._Str_9124) / this._leftSide.length); + const ht = ((this._maskBitmapData.height * rectMask._Str_12156) / this._rightSide.length); - this._Str_2730 + this._maskBitmapData .beginFill(0xFF0000) .drawRect((posX - wd), (posY - ht), wd, ht) .endFill(); - this._Str_14495.push(new RoomPlaneRectangleMask(rectMask._Str_9124, rectMask._Str_4659, rectMask._Str_9124, rectMask._Str_12156)); + this._rectangleMasksOld.push(new RoomPlaneRectangleMask(rectMask._Str_9124, rectMask._Str_4659, rectMask._Str_9124, rectMask._Str_12156)); } i++; } - this._Str_4891 = false; + this._maskChanged = false; } - this._Str_24790(texture, this._Str_2730); + this.combineTextureMask(texture, this._maskBitmapData); } - private _Str_24790(texture: Graphics, mask: Graphics): void + private combineTextureMask(texture: Graphics, mask: Graphics): void { if(!texture || !mask) return; diff --git a/src/nitro/room/object/visualization/room/RoomVisualization.ts b/src/nitro/room/object/visualization/room/RoomVisualization.ts index 988467d1..9085f6d4 100644 --- a/src/nitro/room/object/visualization/room/RoomVisualization.ts +++ b/src/nitro/room/object/visualization/room/RoomVisualization.ts @@ -507,7 +507,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements if((leftSide.length < 1) || (rightSide.length < 1)) { - plane._Str_18448 = false; + plane.hasTexture = false; } if((_local_14.x === 0) && (_local_14.y === 0)) @@ -566,7 +566,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements plane = new RoomPlane(this.object.getLocation(), location, leftSide, rightSide, RoomPlane.TYPE_WALL, true, secondaryNormals, _local_6); if(((leftSide.length < 1) || (rightSide.length < 1))) { - plane._Str_18448 = false; + plane.hasTexture = false; } if(((_local_14.x == 0) && (_local_14.y == 0))) { @@ -599,7 +599,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements if(plane) { - plane._Str_16279 = this._data.maskManager; + plane.maskManager = this._data.maskManager; let _local_19 = 0; @@ -610,7 +610,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements const _local_22 = this._roomPlaneParser.getPlaneMaskLeftSideLength(index, _local_19); const _local_23 = this._roomPlaneParser.getPlaneMaskRightSideLength(index, _local_19); - plane._Str_24758(_local_20, _local_21, _local_22, _local_23); + plane.addRectangleMask(_local_20, _local_21, _local_22, _local_23); _local_19++; } @@ -643,9 +643,9 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements const plane = this._Str_2540[planeIndex]; const sprite = this.getSprite(planeIndex); - if(plane && sprite && plane._Str_5424 && plane._Str_4968) + if(plane && sprite && plane.leftSide && plane.rightSide) { - if((plane.type === RoomPlane.TYPE_WALL) && ((plane._Str_5424.length < 1) || (plane._Str_4968.length < 1))) + if((plane.type === RoomPlane.TYPE_WALL) && ((plane.leftSide.length < 1) || (plane.rightSide.length < 1))) { sprite.alphaTolerance = AlphaTolerance._Str_9268; } @@ -825,7 +825,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements { depth = ((_local_12.relativeDepth + this._Str_25403) + (_local_10 / 1000)); - if((_local_12._Str_5424.length < 1) || (_local_12._Str_4968.length < 1)) + if((_local_12.leftSide.length < 1) || (_local_12.rightSide.length < 1)) { depth = (depth + (RoomVisualization._Str_8621 * 0.5)); } @@ -885,7 +885,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements if(plane) { - plane._Str_25213(); + plane.resetBitmapMasks(); if(plane.type === RoomPlane.TYPE_LANDSCAPE) _local_4.push(index); } @@ -916,22 +916,22 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements if(_local_15 < 0.01) { - if(plane._Str_5424 && plane._Str_4968) + if(plane.leftSide && plane.rightSide) { - const _local_16 = Vector3d.scalarProjection(_local_14, plane._Str_5424); - const _local_17 = Vector3d.scalarProjection(_local_14, plane._Str_4968); + const _local_16 = Vector3d.scalarProjection(_local_14, plane.leftSide); + const _local_17 = Vector3d.scalarProjection(_local_14, plane.rightSide); if((plane.type === RoomPlane.TYPE_WALL) || ((plane.type === RoomPlane.TYPE_LANDSCAPE) && (maskCategory === RoomPlaneBitmapMaskData.HOLE))) { - plane._Str_24569(maskType, _local_16, _local_17); + plane.addBitmapMask(maskType, _local_16, _local_17); } else { if(plane.type === RoomPlane.TYPE_LANDSCAPE) { - if(!plane._Str_14801) _local_6 = true; + if(!plane.canBeVisible) _local_6 = true; - plane._Str_14801 = true; + plane.canBeVisible = true; _local_5.push(i); } @@ -956,7 +956,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements { const plane = this._Str_2540[planeIndex]; - plane._Str_14801 = false; + plane.canBeVisible = false; _local_6 = true; } @@ -1012,4 +1012,4 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements { return RoomVisualization._Str_8621 + 0.5; } -} \ No newline at end of file +} diff --git a/src/nitro/room/object/visualization/room/mask/PlaneMaskManager.ts b/src/nitro/room/object/visualization/room/mask/PlaneMaskManager.ts index 315d9148..8b76b8e5 100644 --- a/src/nitro/room/object/visualization/room/mask/PlaneMaskManager.ts +++ b/src/nitro/room/object/visualization/room/mask/PlaneMaskManager.ts @@ -141,7 +141,7 @@ export class PlaneMaskManager return graphicName; } - public _Str_17859(k: Graphics, _arg_2: string, _arg_3: number, _arg_4: IVector3D, _arg_5: number, _arg_6: number): boolean + public updateMask(k: Graphics, _arg_2: string, _arg_3: number, _arg_4: IVector3D, _arg_5: number, _arg_6: number): boolean { const mask = this._masks.get(_arg_2); @@ -193,4 +193,4 @@ export class PlaneMaskManager return this._masks.get(k) || null; } -} \ No newline at end of file +} diff --git a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneRasterizer.ts b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneRasterizer.ts index ceacb8fc..9af0b805 100644 --- a/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneRasterizer.ts +++ b/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneRasterizer.ts @@ -150,7 +150,7 @@ export class PlaneRasterizer implements IPlaneRasterizer this._textures.clear(); } - protected _Str_10114(k: string): PlaneTexture + protected getTexture(k: string): PlaneTexture { return this._textures.get(k); } @@ -446,7 +446,7 @@ export class PlaneRasterizer implements IPlaneRasterizer } } - const texture = this._Str_10114(textureId); + const texture = this.getTexture(textureId); const newCell = new PlaneMaterialCell(texture, graphics, offsetPoints, limit); cells.push(newCell); diff --git a/src/nitro/room/utils/SpriteDataCollector.ts b/src/nitro/room/utils/SpriteDataCollector.ts index e8f2c264..f20de016 100644 --- a/src/nitro/room/utils/SpriteDataCollector.ts +++ b/src/nitro/room/utils/SpriteDataCollector.ts @@ -403,11 +403,11 @@ export class SpriteDataCollector const _local_12 = _local_11.plane; const _local_13: Point[] = []; - const _local_14 = Vector3d.sum(_local_12.location, _local_12._Str_5424); + const _local_14 = Vector3d.sum(_local_12.location, _local_12.leftSide); const _local_15 = _local_8.getScreenPoint(_local_12.location); const _local_16 = _local_8.getScreenPoint(_local_14); - const _local_17 = _local_8.getScreenPoint(Vector3d.sum(_local_12.location, _local_12._Str_4968)); - const _local_18 = _local_8.getScreenPoint(Vector3d.sum(_local_14, _local_12._Str_4968)); + const _local_17 = _local_8.getScreenPoint(Vector3d.sum(_local_12.location, _local_12.rightSide)); + const _local_18 = _local_8.getScreenPoint(Vector3d.sum(_local_14, _local_12.rightSide)); _local_13.push(_local_15, _local_16, _local_17, _local_18); @@ -442,7 +442,7 @@ export class SpriteDataCollector { const _local_22 = SpriteDataCollector._Str_14110(_local_15, _local_16, _local_17, _local_18); - for(const _local_23 of _local_12._Str_22136(_local_8)) + for(const _local_23 of _local_12.getDrawingDatas(_local_8)) { _local_23.cornerPoints = _local_22; _local_23.z = _local_11.z; diff --git a/src/room/object/visualization/IRoomPlane.ts b/src/room/object/visualization/IRoomPlane.ts index 881c2868..476fef77 100644 --- a/src/room/object/visualization/IRoomPlane.ts +++ b/src/room/object/visualization/IRoomPlane.ts @@ -6,8 +6,8 @@ export interface IRoomPlane { uniqueId: number; location: IVector3D; - _Str_5424: IVector3D; - _Str_4968: IVector3D; + leftSide: IVector3D; + rightSide: IVector3D; color: number; - _Str_22136(_arg_1: IRoomGeometry): PlaneDrawingData[]; -} \ No newline at end of file + getDrawingDatas(_arg_1: IRoomGeometry): PlaneDrawingData[]; +}