cleaned Randomizer

This commit is contained in:
Dank074 2021-06-07 01:10:53 -05:00
parent c88cca1bf7
commit 8ef477ea80
10 changed files with 98 additions and 98 deletions

View File

@ -72,7 +72,7 @@ export class FurnitureParticleSystemEmitter extends FurnitureParticleSystemParti
this.init(0, 0, 0, this._direction, this._force, this._timeStep, this._fuseTime, true);
}
public _Str_17988(k:FurnitureParticleSystemEmitter, _arg_2: number): void
public copyStateFrom(k:FurnitureParticleSystemEmitter, _arg_2: number): void
{
super.copy(k, _arg_2);
this._force = k._force;
@ -87,7 +87,7 @@ export class FurnitureParticleSystemEmitter extends FurnitureParticleSystemParti
this._hasIgnited = k._hasIgnited;
}
public _Str_24892(k: number, _arg_2: boolean, _arg_3: GraphicAsset[], _arg_4: boolean): void
public configureParticle(k: number, _arg_2: boolean, _arg_3: GraphicAsset[], _arg_4: boolean): void
{
const _local_5 = [];
_local_5['lifeTime'] = k;
@ -104,17 +104,17 @@ export class FurnitureParticleSystemEmitter extends FurnitureParticleSystemParti
{
if(this.age > 1)
{
this._Str_19068(this, this.direction);
this.releaseParticles(this, this.direction);
}
}
}
private _Str_19068(k:FurnitureParticleSystemParticle, _arg_2: Vector3D = null): void
private releaseParticles(k:FurnitureParticleSystemParticle, _arg_2: Vector3D = null): void
{
if(!_arg_2) _arg_2 = new Vector3D();
const _local_3 = new Vector3D();
const _local_5 = this._Str_23904();
const _local_5 = this.getRandomParticleConfiguration();
let _local_10 = 0;
@ -123,19 +123,19 @@ export class FurnitureParticleSystemEmitter extends FurnitureParticleSystemParti
switch(this._explosionShape)
{
case FurnitureParticleSystemEmitter.CONE:
_local_3.x = ((this._Str_7471(0.5)) ? Math.random() : -(Math.random()));
_local_3.x = ((this.randomBoolean(0.5)) ? Math.random() : -(Math.random()));
_local_3.y = -(Math.random() + 1);
_local_3.z = ((this._Str_7471(0.5)) ? Math.random() : -(Math.random()));
_local_3.z = ((this.randomBoolean(0.5)) ? Math.random() : -(Math.random()));
break;
case FurnitureParticleSystemEmitter.PLANE:
_local_3.x = ((this._Str_7471(0.5)) ? Math.random() : -(Math.random()));
_local_3.x = ((this.randomBoolean(0.5)) ? Math.random() : -(Math.random()));
_local_3.y = 0;
_local_3.z = ((this._Str_7471(0.5)) ? Math.random() : -(Math.random()));
_local_3.z = ((this.randomBoolean(0.5)) ? Math.random() : -(Math.random()));
break;
case FurnitureParticleSystemEmitter.SPHERE:
_local_3.x = ((this._Str_7471(0.5)) ? Math.random() : -(Math.random()));
_local_3.y = ((this._Str_7471(0.5)) ? Math.random() : -(Math.random()));
_local_3.z = ((this._Str_7471(0.5)) ? Math.random() : -(Math.random()));
_local_3.x = ((this.randomBoolean(0.5)) ? Math.random() : -(Math.random()));
_local_3.y = ((this.randomBoolean(0.5)) ? Math.random() : -(Math.random()));
_local_3.z = ((this.randomBoolean(0.5)) ? Math.random() : -(Math.random()));
break;
}
@ -171,7 +171,7 @@ export class FurnitureParticleSystemEmitter extends FurnitureParticleSystemParti
}
}
private _Str_23904()
private getRandomParticleConfiguration()
{
const k: number = Math.trunc(Math.floor((Math.random() * this._particleConfigurations.length)));
return this._particleConfigurations[k];
@ -180,35 +180,35 @@ export class FurnitureParticleSystemEmitter extends FurnitureParticleSystemParti
public update(): void
{
super.update();
this._Str_25039();
this._Str_25400();
this._Str_23140();
if(((!(this._Str_16034)) && (this._emittedParticles < this._maxNumberOfParticles)))
this.accumulateForces();
this.verlet();
this.satisfyConstraints();
if(((!(this.isAlive)) && (this._emittedParticles < this._maxNumberOfParticles)))
{
if((this.age % this._burstPulse) == 0)
{
this._Str_19068(this, this.direction);
this.releaseParticles(this, this.direction);
}
}
}
public _Str_25400(): void
public verlet(): void
{
let _local_2:FurnitureParticleSystemParticle;
let _local_3: number;
let _local_4: number;
let _local_5: number;
if(((this._Str_16034) || (this._emittedParticles < this._maxNumberOfParticles)))
if(((this.isAlive) || (this._emittedParticles < this._maxNumberOfParticles)))
{
_local_3 = this.x;
_local_4 = this.y;
_local_5 = this.z;
this.x = (((2 - this._airFriction) * this.x) - ((1 - this._airFriction) * this._Str_10744));
this.y = ((((2 - this._airFriction) * this.y) - ((1 - this._airFriction) * this._Str_12459)) + ((this._gravity * this._timeStep) * this._timeStep));
this.z = (((2 - this._airFriction) * this.z) - ((1 - this._airFriction) * this._Str_11680));
this._Str_10744 = _local_3;
this._Str_12459 = _local_4;
this._Str_11680 = _local_5;
this.x = (((2 - this._airFriction) * this.x) - ((1 - this._airFriction) * this.lastX));
this.y = ((((2 - this._airFriction) * this.y) - ((1 - this._airFriction) * this.lastY)) + ((this._gravity * this._timeStep) * this._timeStep));
this.z = (((2 - this._airFriction) * this.z) - ((1 - this._airFriction) * this.lastZ));
this.lastX = _local_3;
this.lastY = _local_4;
this.lastZ = _local_5;
}
const k: FurnitureParticleSystemParticle[] = [];
@ -218,13 +218,13 @@ export class FurnitureParticleSystemEmitter extends FurnitureParticleSystemParti
_local_3 = _local_2.x;
_local_4 = _local_2.y;
_local_5 = _local_2.z;
_local_2.x = (((2 - this._airFriction) * _local_2.x) - ((1 - this._airFriction) * _local_2._Str_10744));
_local_2.y = ((((2 - this._airFriction) * _local_2.y) - ((1 - this._airFriction) * _local_2._Str_12459)) + ((this._gravity * this._timeStep) * this._timeStep));
_local_2.z = (((2 - this._airFriction) * _local_2.z) - ((1 - this._airFriction) * _local_2._Str_11680));
_local_2._Str_10744 = _local_3;
_local_2._Str_12459 = _local_4;
_local_2._Str_11680 = _local_5;
if(((_local_2.y > 10) || (!(_local_2._Str_16034))))
_local_2.x = (((2 - this._airFriction) * _local_2.x) - ((1 - this._airFriction) * _local_2.lastX));
_local_2.y = ((((2 - this._airFriction) * _local_2.y) - ((1 - this._airFriction) * _local_2.lastY)) + ((this._gravity * this._timeStep) * this._timeStep));
_local_2.z = (((2 - this._airFriction) * _local_2.z) - ((1 - this._airFriction) * _local_2.lastZ));
_local_2.lastX = _local_3;
_local_2.lastY = _local_4;
_local_2.lastZ = _local_5;
if(((_local_2.y > 10) || (!(_local_2.isAlive))))
{
k.push(_local_2);
}
@ -242,11 +242,11 @@ export class FurnitureParticleSystemEmitter extends FurnitureParticleSystemParti
}
}
private _Str_23140(): void
private satisfyConstraints(): void
{
}
private _Str_25039(): void
private accumulateForces(): void
{
for(const k of this._particles)
{
@ -259,18 +259,18 @@ export class FurnitureParticleSystemEmitter extends FurnitureParticleSystemParti
return this._particles;
}
public get _Str_22727(): boolean
public get hasIgnited(): boolean
{
return this._hasIgnited;
}
private _Str_7471(k: number): boolean
private randomBoolean(k: number): boolean
{
return Math.random() < k;
}
public get _Str_9107(): number
public get roomObjectSpriteId(): number
{
return this._roomObjectSpriteId;
}
}
}

View File

@ -102,7 +102,7 @@ export class FurnitureParticleSystemParticle
return this._isEmitter;
}
public get _Str_16034(): boolean
public get isAlive(): boolean
{
return this._age <= this._lifeTime;
}
@ -137,40 +137,40 @@ export class FurnitureParticleSystemParticle
this._z = k;
}
public get _Str_10744(): number
public get lastX(): number
{
return this._lastX;
}
public set _Str_10744(k: number)
public set lastX(k: number)
{
this._hasMoved = true;
this._lastX = k;
}
public get _Str_12459(): number
public get lastY(): number
{
return this._lastY;
}
public set _Str_12459(k: number)
public set lastY(k: number)
{
this._hasMoved = true;
this._lastY = k;
}
public get _Str_11680(): number
public get lastZ(): number
{
return this._lastZ;
}
public set _Str_11680(k: number)
public set lastZ(k: number)
{
this._hasMoved = true;
this._lastZ = k;
}
public get _Str_22611(): boolean
public get hasMoved(): boolean
{
return this._hasMoved;
}
@ -188,7 +188,7 @@ export class FurnitureParticleSystemParticle
this._lastX = (k._lastX * _arg_2);
this._lastY = (k._lastY * _arg_2);
this._lastZ = (k._lastZ * _arg_2);
this._hasMoved = k._Str_22611;
this._hasMoved = k.hasMoved;
this._direction = k._direction;
this._age = k._age;
this._lifeTime = k._lifeTime;
@ -197,4 +197,4 @@ export class FurnitureParticleSystemParticle
this._fadeTime = k._fadeTime;
this._alphaMultiplier = k._alphaMultiplier;
}
}
}

View File

@ -512,7 +512,7 @@ export class RoomPlane implements IRoomPlane
//const data = new PlaneDrawingData(maskData, blend(this._color, layer.getColor()), cm._Str_14945());
const data = new PlaneDrawingData(maskData, this._color, cm._Str_14945());
Randomizer._Str_17384(this._randomSeed);
Randomizer.setSeed(this._randomSeed);
for(const column of cm._Str_23721(this.screenWidth(geometry)))
{
@ -664,7 +664,7 @@ export class RoomPlane implements IRoomPlane
//this._bitmapData.fillRect(this._bitmapData.rect, 0xFFFFFF);
}
Randomizer._Str_17384(this._randomSeed);
Randomizer.setSeed(this._randomSeed);
const texture = this.getTexture(geometry, timeSinceStartMs);

View File

@ -16,7 +16,7 @@ export class LandscapePlane extends Plane
{
const _local_2 = this.getPlaneVisualization(k);
if(_local_2) return !(_local_2._Str_20530);
if(_local_2) return !(_local_2.hasAnimationLayers);
return super.isStatic(k);
}

View File

@ -75,7 +75,7 @@ export class LandscapeRasterizer extends PlaneRasterizer
if(planeVisualization)
{
Randomizer._Str_17384(randomNumber);
Randomizer.setSeed(randomNumber);
let layerId = 0;
@ -108,7 +108,7 @@ export class LandscapeRasterizer extends PlaneRasterizer
else if(layer.align === 'top') align = PlaneVisualizationLayer.ALIGN_TOP;
}
planeVisualization._Str_21464(layerId, material, color, align, offset);
planeVisualization.setLayer(layerId, material, color, align, offset);
}
layerId++;
@ -157,7 +157,7 @@ export class LandscapeRasterizer extends PlaneRasterizer
layerId++;
}
planeVisualization._Str_23489(layerId, animationItems, this.assetCollection);
planeVisualization.setAnimationLayer(layerId, animationItems, this.assetCollection);
}
}
}
@ -183,7 +183,7 @@ export class LandscapeRasterizer extends PlaneRasterizer
if((_arg_2.length > 0))
{
const _local_4 = 10000;
const _local_5 = Randomizer._Str_1612(1, 0, _local_4);
const _local_5 = Randomizer.getValues(1, 0, _local_4);
const _local_6 = (_local_5[0] / _local_4);
if(_arg_2.charAt((_arg_2.length - 1)) === '%')

View File

@ -175,7 +175,7 @@ export class PlaneMaterialCell
// const limitMin = Math.min(this._extraItemCount, this._extraItemOffsets.length);
// const limitMax = Math.max(this._extraItemCount, this._extraItemOffsets.length);
// const offsetIndexes = Randomizer._Str_23572(this._extraItemCount, limitMax);
// const offsetIndexes = Randomizer.getArray(this._extraItemCount, limitMax);
// let i = 0;

View File

@ -62,7 +62,7 @@ export class PlaneMaterialCellMatrix
private static _Str_12526(k: number): number
{
return ((Randomizer._Str_1612(1, 0, (k * 17631))[0]) % k);
return ((Randomizer.getValues(1, 0, (k * 17631))[0]) % k);
}
public get normalMinX(): number

View File

@ -578,7 +578,7 @@ export class PlaneRasterizer implements IPlaneRasterizer
else if(layer.align == 'top') align = PlaneVisualizationLayer.ALIGN_TOP;
}
planeVisualization._Str_21464(layerId, material, color, align, offset);
planeVisualization.setLayer(layerId, material, color, align, offset);
}
layerId++;

View File

@ -44,7 +44,7 @@ export class PlaneVisualization
return this._geometry;
}
public get _Str_20530(): boolean
public get hasAnimationLayers(): boolean
{
return this._hasAnimationLayers;
}
@ -106,7 +106,7 @@ export class PlaneVisualization
this._isCached = false;
}
public _Str_21464(k: number, _arg_2: PlaneMaterial, _arg_3: number, _arg_4: number, _arg_5: number = 0): boolean
public setLayer(k: number, _arg_2: PlaneMaterial, _arg_3: number, _arg_4: number, _arg_5: number = 0): boolean
{
if((k < 0) || (k > this._layers.length)) return false;
@ -121,7 +121,7 @@ export class PlaneVisualization
return true;
}
public _Str_23489(k: number, _arg_2: any, _arg_3: IGraphicAssetCollection): boolean
public setAnimationLayer(k: number, _arg_2: any, _arg_3: IGraphicAssetCollection): boolean
{
if((k < 0) || (k > this._layers.length)) return false;
@ -154,7 +154,7 @@ export class PlaneVisualization
{
if(((this._cachedBitmapData.width === width) && (this._cachedBitmapData.height === height)) && (Vector3d.isEqual(this._cachedBitmapNormal, normal)))
{
if(!this._Str_20530)
if(!this.hasAnimationLayers)
{
if(canvas)
{

View File

@ -1,60 +1,60 @@
export class Randomizer
{
public static _Str_21045: number = 1;
public static _Str_20078: number = 16777216;
public static DEFAULT_SEED: number = 1;
public static DEFAULT_MODULUS: number = 16777216;
private static _Str_3699:Randomizer = null;
private static _randomizer:Randomizer = null;
private _Str_16737: number = 1;
private _Str_16979: number = 16777216;
private _Str_25697: number = 69069;
private _Str_23320: number = 5;
private _seed: number = 1;
private _modulus: number = 16777216;
private _multiplier: number = 69069;
private _increment: number = 5;
public static _Str_17384(k: number = 1): void
public static setSeed(k: number = 1): void
{
if(!Randomizer._Str_3699) Randomizer._Str_3699 = new Randomizer();
if(!Randomizer._randomizer) Randomizer._randomizer = new Randomizer();
Randomizer._Str_3699._Str_15634 = k;
Randomizer._randomizer.seed = k;
}
public static _Str_26085(k: number = 16777216): void
public static setModulus(k: number = 16777216): void
{
if(!Randomizer._Str_3699) Randomizer._Str_3699 = new Randomizer();
if(!Randomizer._randomizer) Randomizer._randomizer = new Randomizer();
Randomizer._Str_3699._Str_25321 = k;
Randomizer._randomizer.modulus = k;
}
public static _Str_1612(k: number, _arg_2: number, _arg_3: number): number[]
public static getValues(k: number, _arg_2: number, _arg_3: number): number[]
{
if(!Randomizer._Str_3699) Randomizer._Str_3699 = new Randomizer();
if(!Randomizer._randomizer) Randomizer._randomizer = new Randomizer();
return Randomizer._Str_3699._Str_24535(k, _arg_2, _arg_3);
return Randomizer._randomizer.getRandomValues(k, _arg_2, _arg_3);
}
public static _Str_23572(k: number, _arg_2: number): number[]
public static getArray(k: number, _arg_2: number): number[]
{
if(!Randomizer._Str_3699) Randomizer._Str_3699 = new Randomizer();
if(!Randomizer._randomizer) Randomizer._randomizer = new Randomizer();
return Randomizer._Str_3699._Str_24231(k, _arg_2);
return Randomizer._randomizer.getRandomArray(k, _arg_2);
}
public set _Str_15634(k: number)
public set seed(k: number)
{
this._Str_16737 = k;
this._seed = k;
}
public set _Str_25321(k: number)
public set modulus(k: number)
{
if(k < 1) k = 1;
this._Str_16979 = k;
this._modulus = k;
}
public dispose(): void
{
}
public _Str_24535(k: number, _arg_2: number, _arg_3: number): number[]
public getRandomValues(k: number, _arg_2: number, _arg_3: number): number[]
{
const _local_4: number[] = [];
@ -62,14 +62,14 @@
while(_local_5 < k)
{
_local_4.push(this._Str_19361(_arg_2, (_arg_3 - _arg_2)));
_local_4.push(this.iterateScaled(_arg_2, (_arg_3 - _arg_2)));
_local_5++;
}
return _local_4;
}
public _Str_24231(k: number, _arg_2: number): number[]
public getRandomArray(k: number, _arg_2: number): number[]
{
if(((k > _arg_2) || (_arg_2 > 1000))) return null;
@ -89,7 +89,7 @@
while(_local_6 < k)
{
const _local_7 = this._Str_19361(0, (_local_3.length - 1));
const _local_7 = this.iterateScaled(0, (_local_3.length - 1));
_local_5.push(_local_3[_local_7]);
_local_3.splice(_local_7, 1);
@ -100,27 +100,27 @@
return _local_5;
}
private _Str_24980(): number
private iterate(): number
{
let k: number = ((this._Str_25697 * this._Str_16737) + this._Str_23320);
let k: number = ((this._multiplier * this._seed) + this._increment);
if(k < 0) k = -(k);
k = (k % this._Str_16979);
k = (k % this._modulus);
this._Str_16737 = k;
this._seed = k;
return k;
}
private _Str_19361(k: number, _arg_2: number): number
private iterateScaled(k: number, _arg_2: number): number
{
let _local_3: number = this._Str_24980();
let _local_3: number = this.iterate();
if(_arg_2 < 1) return k;
_local_3 = (k + ((_local_3 / this._Str_16979) * _arg_2));
_local_3 = (k + ((_local_3 / this._modulus) * _arg_2));
return _local_3;
}
}
}