Section 1
//Blockmap (com.brokenfunction.doom.data.Blockmap)
package com.brokenfunction.doom.data {
import flash.utils.*;
public class Blockmap {
private var _offX:int;
private var _offY:int;
private var _cols:uint;
private var map:Dictionary;
private var _rows:uint;
public static const BLOCK_SHIFT:uint = 7;
public static const BLOCK_SIZE:uint = (1 << BLOCK_SHIFT);
private static const BLOCK_MID:uint = (BLOCK_SIZE >>> 1);
public function Blockmap(_arg1:int, _arg2:int, _arg3:uint, _arg4:uint){
var _local6:int;
map = new Dictionary();
super();
_offX = _arg1;
_offY = _arg2;
if ((((_arg3 > 0xFFFF)) || ((_arg4 > 0xFFFF)))){
throw (new Error("Blockmap given bad boundries"));
};
_cols = _arg3;
_rows = _arg4;
var _local5:int = _cols;
while (_local5-- > 0) {
_local6 = _rows;
while (_local6-- > 0) {
map[((_local5 << 16) | _local6)] = new Block();
};
};
}
public function get rows():uint{
return (_rows);
}
public function get offX():int{
return (_offX);
}
public function get offY():int{
return (_offY);
}
public function setBlock(_arg1:uint, _arg2:uint, _arg3:Array):void{
var _local4:Block = map[(((_arg1 & 0xFFFF) << 16) | (_arg2 & 0xFFFF))];
if (_local4){
_local4.linedefs = _arg3;
};
}
public function get cols():uint{
return (_cols);
}
public function getThings(_arg1:uint, _arg2:uint):Array{
var _local3:Block = map[(((_arg1 & 0xFFFF) << 16) | (_arg2 & 0xFFFF))];
return ((_local3) ? _local3.things : []);
}
public function getBlock(_arg1:uint, _arg2:uint):Array{
var _local3:Block = map[(((_arg1 & 0xFFFF) << 16) | (_arg2 & 0xFFFF))];
return ((_local3) ? _local3.linedefs : []);
}
}
}//package com.brokenfunction.doom.data
class Block {
public var linedefs:Array;
public var things:Array;
private function Block(){
linedefs = [];
things = [];
super();
}
}
Section 2
//Colormap (com.brokenfunction.doom.data.Colormap)
package com.brokenfunction.doom.data {
import flash.utils.*;
public class Colormap extends ByteArray {
public function Colormap(_arg1:ByteArray, _arg2:uint){
length = 0x0100;
_arg1.position = (_arg1.position + (_arg2 * 0x0100));
_arg1.readBytes(this, 0, length);
}
}
}//package com.brokenfunction.doom.data
Section 3
//Flat (com.brokenfunction.doom.data.Flat)
package com.brokenfunction.doom.data {
import flash.utils.*;
public class Flat extends ByteArray {
private var _next:Flat;
private var _current:Flat;
public static const SKY_FLAT:Flat = new (Flat);
;
public function Flat(_arg1:ByteArray=null){
length = 0x1000;
if (_arg1){
writeBytes(_arg1, _arg1.position, length);
};
_next = (_current = this);
}
public function set current(_arg1:Flat):void{
_current = _arg1;
}
public function get next():Flat{
return (_next);
}
public function set next(_arg1:Flat):void{
_next = _arg1;
}
public function get current():Flat{
return (_current);
}
public function get isAnimated():Boolean{
return (!((_next == this)));
}
}
}//package com.brokenfunction.doom.data
Section 4
//Image (com.brokenfunction.doom.data.Image)
package com.brokenfunction.doom.data {
import flash.display.*;
import flash.geom.*;
public class Image extends BitmapData {
private var _height:uint;
private var _width:uint;
private var _offX:int;
private var _offY:int;
public function Image(_arg1:uint, _arg2:uint, _arg3:int=0, _arg4:int=0){
super(_arg1, _arg2, true, 0);
_offX = _arg3;
_offY = _arg4;
}
public function get offX():int{
return (_offX);
}
public function get offY():int{
return (_offY);
}
public function copyImage(_arg1:Image, _arg2:int=0, _arg3:int=0):void{
copyPixels(_arg1, _arg1.rect, new Point(_arg2, _arg3), null, null, true);
}
public function toBitmapData(_arg1:Colormap, _arg2:uint):BitmapData{
return (null);
}
}
}//package com.brokenfunction.doom.data
Section 5
//Linedef (com.brokenfunction.doom.data.Linedef)
package com.brokenfunction.doom.data {
public class Linedef {
private var _length:Number;
private var _flags:uint;
private var _angle:uint;
private var _type:uint;
private var _end:Vertex;
private var _leftSide:Sidedef;
private var _start:Vertex;
private var _rightSide:Sidedef;
public static const IMPASSIBLE:uint = (1 << 0);
public static const BLOCK_MONSTERS:uint = (1 << 1);
public static const AUTOMAP_VISIBLE:uint = (1 << 8);
public static const UNPEGGED_LOWER:uint = (1 << 4);
public static const UNPEGGED_UPPER:uint = (1 << 3);
public static const SECRET:uint = (1 << 5);
public static const TWO_SIDED:uint = (1 << 2);
public static const AUTOMAP_HIDDEN:uint = (1 << 7);
public static const BLOCK_SOUND:uint = (1 << 6);
public function Linedef(_arg1:Vertex, _arg2:Vertex, _arg3:uint, _arg4:uint, _arg5:Sidedef, _arg6:Sidedef){
_start = _arg1;
_end = _arg2;
_flags = _arg3;
_type = _arg4;
_rightSide = _arg5;
_leftSide = _arg6;
var _local7:int = (_end.x - _start.x);
var _local8:int = (_end.y - _start.y);
_length = Math.sqrt(((_local7 * _local7) + (_local8 * _local8)));
_angle = ((Math.atan2(_local8, _local7) * (0x8000 / Math.PI)) & 0xFFFF);
}
public function get flags():uint{
return (_flags);
}
public function get isSecret():Boolean{
return (((_flags & SECRET) === SECRET));
}
public function get isTwoSided():Boolean{
return (((_flags & TWO_SIDED) === TWO_SIDED));
}
public function get isImpassible():Boolean{
return (((_flags & IMPASSIBLE) === IMPASSIBLE));
}
public function get alwaysVisibleOnAutomap():Boolean{
return (((_flags & AUTOMAP_VISIBLE) === AUTOMAP_VISIBLE));
}
public function get angle():uint{
return (_angle);
}
public function get unpeggedUpper():Boolean{
return (((_flags & UNPEGGED_UPPER) === UNPEGGED_UPPER));
}
public function get rightSide():Sidedef{
return (_rightSide);
}
public function get end():Vertex{
return (_end);
}
public function get start():Vertex{
return (_start);
}
public function get length():Number{
return (_length);
}
public function get blocksSound():Boolean{
return (((_flags & BLOCK_SOUND) === BLOCK_SOUND));
}
public function toString():String{
return ((((((((("(x1=" + _start.x) + ", y1=") + _start.y) + ", x2=") + _end.x) + ", y2=") + _end.y) + ")"));
}
public function get unpeggedLower():Boolean{
return (((_flags & UNPEGGED_LOWER) === UNPEGGED_LOWER));
}
public function get hiddenFromAutomap():Boolean{
return (((_flags & AUTOMAP_HIDDEN) === AUTOMAP_HIDDEN));
}
public function get type():uint{
return (_type);
}
public function get leftSide():Sidedef{
return (_leftSide);
}
public function get blocksMonsters():Boolean{
return (((_flags & BLOCK_MONSTERS) === BLOCK_MONSTERS));
}
}
}//package com.brokenfunction.doom.data
Section 6
//Lump (com.brokenfunction.doom.data.Lump)
package com.brokenfunction.doom.data {
import flash.utils.*;
import com.brokenfunction.doom.*;
public class Lump {
private var _size:uint;
private var _name:String;
private var _offset:uint;
private var _next:Lump;// = null
public function Lump(_arg1:ByteArray){
_offset = _arg1.readUnsignedInt();
_size = _arg1.readUnsignedInt();
_name = readStr8(_arg1);
}
public function get size():uint{
return (_size);
}
public function get next():Lump{
return (_next);
}
public function get name():String{
return (_name);
}
public function set next(_arg1:Lump):void{
_next = _arg1;
}
public function toString():String{
return ((((((("(name=" + _name) + ", start=") + _offset) + ", size=") + _size) + ")"));
}
public function get offset():uint{
return (_offset);
}
}
}//package com.brokenfunction.doom.data
Section 7
//Node (com.brokenfunction.doom.data.Node)
package com.brokenfunction.doom.data {
public class Node {
private var _x:int;
private var _ly1:int;
private var _ly2:int;
private var _leftStop:Boolean;// = true
private var _ry1:int;
private var _ry2:int;
private var _right:Object;// = null
private var _dy:int;
private var _dx:int;
private var _rightStop:Boolean;// = true
private var _angle:uint;
private var _lx2:int;
private var _rx1:int;
private var _lx1:int;
private var _y:int;
private var _rx2:int;
private var _left:Object;// = null
public function Node(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:uint, _arg6:int, _arg7:int, _arg8:int, _arg9:int, _arg10:int, _arg11:int, _arg12:int, _arg13:int){
_x = _arg1;
_y = _arg2;
_dx = _arg3;
_dy = _arg4;
_angle = _arg5;
_ly1 = _arg6;
_ly2 = _arg7;
_lx1 = _arg8;
_lx2 = _arg9;
_ry1 = _arg10;
_ry2 = _arg11;
_rx1 = _arg12;
_rx2 = _arg13;
}
public function set rightSSector(_arg1:SSector):void{
_rightStop = true;
_right = _arg1;
}
public function set rightNode(_arg1:Node):void{
_rightStop = false;
_right = _arg1;
}
public function get dx():int{
return (_dx);
}
public function get dy():int{
return (_dy);
}
public function get rightY1():int{
return (_ry1);
}
public function get rightY2():int{
return (_ry2);
}
public function get leftX1():int{
return (_lx1);
}
public function get leftX2():int{
return (_lx2);
}
public function get leftStop():Boolean{
return (_leftStop);
}
public function get leftNode():Node{
return ((_left as Node));
}
public function get leftSSector():SSector{
return ((_left as SSector));
}
public function get rightStop():Boolean{
return (_rightStop);
}
public function get leftY1():int{
return (_ly1);
}
public function get leftY2():int{
return (_ly2);
}
public function get rightNode():Node{
return ((_right as Node));
}
public function set leftNode(_arg1:Node):void{
_leftStop = false;
_left = _arg1;
}
public function get angle():uint{
return (_angle);
}
public function set leftSSector(_arg1:SSector):void{
_leftStop = true;
_left = _arg1;
}
public function get rightX1():int{
return (_rx1);
}
public function get rightX2():int{
return (_rx2);
}
public function get x():int{
return (_x);
}
public function get y():int{
return (_y);
}
public function get rightSSector():SSector{
return ((_right as SSector));
}
}
}//package com.brokenfunction.doom.data
Section 8
//PlayPalette (com.brokenfunction.doom.data.PlayPalette)
package com.brokenfunction.doom.data {
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
public class PlayPalette {
private var _zeros:Array;
private var _ones:Array;
private var _list:Array;
private static const NULL_POINT:Point = new Point(0, 0);
public function PlayPalette(_arg1:ByteArray, _arg2:uint){
var _local4:int;
var _local5:int;
var _local6:int;
_zeros = new Array(0x0100);
_ones = new Array(0x0100);
_list = new Array(0x0100);
super();
if (_arg2 >= 14){
throw (new Error("Invalid index"));
};
_arg1.position = (_arg1.position + (_arg2 * 0x0100));
var _local3:int;
while (_local3 < 0x0100) {
_local4 = _arg1.readUnsignedByte();
_local5 = _arg1.readUnsignedByte();
_local6 = _arg1.readUnsignedByte();
_local4 = ((128 + ((_local4 - 128) * 1.15)) - 4);
_local5 = ((128 + ((_local5 - 128) * 1.15)) - 4);
_local6 = ((128 + ((_local6 - 128) * 1.15)) - 4);
if (_local4 < 0){
_local4 = 0;
} else {
if (_local4 > 0xFF){
_local4 = 0xFF;
};
};
if (_local5 < 0){
_local5 = 0;
} else {
if (_local5 > 0xFF){
_local5 = 0xFF;
};
};
if (_local6 < 0){
_local6 = 0;
} else {
if (_local6 > 0xFF){
_local6 = 0xFF;
};
};
_list[_local3] = (((_local4 << 16) | (_local5 << 8)) | _local6);
_zeros[_local3] = 0;
_ones[_local3] = 0xFF;
_local3++;
};
}
public function mapPalette(_arg1:BitmapData):void{
_arg1.paletteMap(_arg1, _arg1.rect, NULL_POINT, _zeros, _zeros, _list, null);
}
public function get list():Array{
return (_list);
}
}
}//package com.brokenfunction.doom.data
Section 9
//Reject (com.brokenfunction.doom.data.Reject)
package com.brokenfunction.doom.data {
import flash.utils.*;
public class Reject {
private var sectors:Dictionary;
public function Reject(){
sectors = new Dictionary(true);
super();
}
public function isRejected(_arg1:Sector, _arg2:Sector):Boolean{
return ((((_arg1 in sectors)) && ((sectors[_arg1][_arg2] === true))));
}
public function setReject(_arg1:Sector, _arg2:Sector):void{
if (!(_arg1 in sectors)){
sectors[_arg1] = new Dictionary(true);
};
sectors[_arg1][_arg2] = true;
}
public function unsetReject(_arg1:Sector, _arg2:Sector):void{
}
}
}//package com.brokenfunction.doom.data
Section 10
//Sector (com.brokenfunction.doom.data.Sector)
package com.brokenfunction.doom.data {
public class Sector {
private var _floor:int;
private var _type:uint;
private var _ceil:int;
private var _floorFlat:Flat;
private var _linedefs:Array;
private var _things:Array;
private var _lightLevel:uint;
private var _ceilFlat:Flat;
public function Sector(_arg1:int, _arg2:int, _arg3:Flat, _arg4:Flat, _arg5:uint, _arg6:uint){
_things = [];
_linedefs = [];
super();
_floor = _arg1;
_ceil = _arg2;
_floorFlat = _arg3;
_ceilFlat = _arg4;
_lightLevel = _arg5;
_type = _arg6;
}
public function get type():uint{
return (_type);
}
public function get ceil():int{
return (_ceil);
}
public function get linedefs():Array{
return (_linedefs);
}
public function set ceil(_arg1:int):void{
_ceil = _arg1;
}
public function get lightLevel():uint{
return (_lightLevel);
}
public function get floor():int{
return (_floor);
}
public function get things():Array{
return (_things);
}
public function set floor(_arg1:int):void{
_floor = _arg1;
}
public function set lightLevel(_arg1:uint):void{
_lightLevel = _arg1;
}
public function get ceilFlat():Flat{
return (_ceilFlat);
}
public function get floorFlat():Flat{
return (_floorFlat);
}
public function toString():String{
return ((((((((((((((("(ceiling=" + _ceilFlat) + " @ ") + _ceil) + ", floor=") + _floorFlat) + " @ ") + _floor) + ", type=") + _type) + ", lightLevel=") + _lightLevel) + ", linedefs=") + _linedefs.length) + ")"));
}
public function set type(_arg1:uint):void{
_type = _arg1;
}
}
}//package com.brokenfunction.doom.data
Section 11
//Seg (com.brokenfunction.doom.data.Seg)
package com.brokenfunction.doom.data {
public class Seg {
private var _start:Vertex;
private var _linedefOffset:int;
private var _reverseDir:Boolean;
private var _linedef:Linedef;
private var _angle:uint;
private var _end:Vertex;
public function Seg(_arg1:Vertex, _arg2:Vertex, _arg3:uint, _arg4:Linedef, _arg5:Boolean, _arg6:int){
_start = _arg1;
_end = _arg2;
_angle = _arg3;
_linedef = _arg4;
_reverseDir = _arg5;
_linedefOffset = _arg6;
}
public function get linedef():Linedef{
return (_linedef);
}
public function get start():Vertex{
return (_start);
}
public function get linedefOffset():int{
return (_linedefOffset);
}
public function get reverseDir():Boolean{
return (_reverseDir);
}
public function get sector():Sector{
return ((_reverseDir) ? _linedef.leftSide : _linedef.rightSide.sector);
}
public function get rightSide():Sidedef{
return ((_reverseDir) ? _linedef.leftSide : _linedef.rightSide);
}
public function get angle():uint{
return (_angle);
}
public function get end():Vertex{
return (_end);
}
public function get leftSide():Sidedef{
return ((_reverseDir) ? _linedef.rightSide : _linedef.leftSide);
}
}
}//package com.brokenfunction.doom.data
Section 12
//Sidedef (com.brokenfunction.doom.data.Sidedef)
package com.brokenfunction.doom.data {
public class Sidedef {
private var _sector:Sector;
private var _middleTexture:Texture;
private var _offX:int;
private var _offY:int;
private var _upperTexture:Texture;
private var _lowerTexture:Texture;
public function Sidedef(_arg1:int, _arg2:int, _arg3:Texture, _arg4:Texture, _arg5:Texture, _arg6:Sector){
_offX = _arg1;
_offY = _arg2;
_upperTexture = _arg3;
_lowerTexture = _arg4;
_middleTexture = _arg5;
_sector = _arg6;
}
public function get upperTexture():Texture{
return (_upperTexture);
}
public function get middleTexture():Texture{
return (_middleTexture);
}
public function get offX():int{
return (_offX);
}
public function toString():String{
return ((((((("(" + _upperTexture) + " ") + _middleTexture) + " ") + _lowerTexture) + ")"));
}
public function get sector():Sector{
return (_sector);
}
public function get offY():int{
return (_offY);
}
public function set offX(_arg1:int):void{
_offX = _arg1;
}
public function get lowerTexture():Texture{
return (_lowerTexture);
}
public function set offY(_arg1:int):void{
_offY = _arg1;
}
}
}//package com.brokenfunction.doom.data
Section 13
//SSector (com.brokenfunction.doom.data.SSector)
package com.brokenfunction.doom.data {
public dynamic class SSector extends Array {
private var _things:Array;
public function SSector(_arg1:uint=0){
_things = [];
super(_arg1);
}
public function get things():Array{
return (_things);
}
public function get sector():Sector{
return ((this[0] as Seg).sector);
}
}
}//package com.brokenfunction.doom.data
Section 14
//Texture (com.brokenfunction.doom.data.Texture)
package com.brokenfunction.doom.data {
public class Texture extends Image {
private var _next:Texture;
private var _current:Texture;
public function Texture(_arg1:uint, _arg2:uint, _arg3:int=0, _arg4:int=0){
super(_arg1, _arg2, _arg3, _arg4);
_next = (_current = this);
}
public function set current(_arg1:Texture):void{
_current = _arg1;
}
public function get next():Texture{
return (_next);
}
public function set next(_arg1:Texture):void{
_next = _arg1;
}
public function get current():Texture{
return (_current);
}
public function get isAnimated():Boolean{
return (!((_next == this)));
}
}
}//package com.brokenfunction.doom.data
Section 15
//TextureInfo (com.brokenfunction.doom.data.TextureInfo)
package com.brokenfunction.doom.data {
public class TextureInfo {
private var _height:uint;
private var _width:uint;
private var _name:String;
private var _next:TextureInfo;// = null
private var _patches:Array;
public function TextureInfo(_arg1:String, _arg2:uint, _arg3:uint){
_patches = [];
super();
_name = _arg1;
_width = _arg2;
_height = _arg3;
}
public function get name():String{
return (_name);
}
public function get width():uint{
return (_width);
}
public function get height():uint{
return (_height);
}
public function get next():TextureInfo{
return (_next);
}
public function get patches():Array{
return (_patches);
}
public function set next(_arg1:TextureInfo):void{
_next = _arg1;
}
}
}//package com.brokenfunction.doom.data
Section 16
//TexturePatch (com.brokenfunction.doom.data.TexturePatch)
package com.brokenfunction.doom.data {
public class TexturePatch {
private var _wall:String;
private var _offX:uint;
private var _offY:uint;
public function TexturePatch(_arg1:uint, _arg2:uint, _arg3:String){
_offX = _arg1;
_offY = _arg2;
_wall = _arg3;
}
public function get offY():uint{
return (_offY);
}
public function get offX():uint{
return (_offX);
}
public function get wall():String{
return (_wall);
}
}
}//package com.brokenfunction.doom.data
Section 17
//ThingInfo (com.brokenfunction.doom.data.ThingInfo)
package com.brokenfunction.doom.data {
public class ThingInfo {
private var _x:int;// = 0
private var _type:uint;// = 0
private var _y:int;// = 0
private var _ang:uint;// = 0
private var _options:uint;// = 0
public static const OPTION_DEAF:uint = (1 << 3);
public static const OPTION_SKILLEASY:uint = (1 << 0);
public static const OPTION_SKILLHARD:uint = (1 << 2);
public static const OPTION_SKILLNORMAL:uint = (1 << 1);
public static const OPTION_MULTIPLAYER:uint = (1 << 4);
public function ThingInfo(_arg1:int, _arg2:int, _arg3:uint, _arg4:uint, _arg5:uint){
_x = _arg1;
_y = _arg2;
_ang = _arg3;
_type = _arg4;
_options = _arg5;
}
public function get options():uint{
return (_options);
}
public function get y():int{
return (_y);
}
public function get ang():uint{
return (_ang);
}
public function get isDeaf():Boolean{
return (((_options & OPTION_DEAF) === OPTION_DEAF));
}
public function get x():int{
return (_x);
}
public function get type():uint{
return (_type);
}
}
}//package com.brokenfunction.doom.data
Section 18
//Vertex (com.brokenfunction.doom.data.Vertex)
package com.brokenfunction.doom.data {
public class Vertex {
private var _x:int;// = 0
private var _y:int;// = 0
public function Vertex(_arg1:int, _arg2:int){
_x = _arg1;
_y = _arg2;
}
public function get y():int{
return (_y);
}
public function get x():int{
return (_x);
}
public function toString():String{
return ((((("(x=" + _x) + ", y=") + _y) + ")"));
}
}
}//package com.brokenfunction.doom.data
Section 19
//AbstractEffect (com.brokenfunction.doom.effects.AbstractEffect)
package com.brokenfunction.doom.effects {
import com.brokenfunction.doom.data.*;
public class AbstractEffect {
protected function getLowestNearbyLightLevel(_arg1:Sector, _arg2:uint=0):uint{
var _local5:Linedef;
var _local6:Sector;
var _local3:Array = _arg1.linedefs;
var _local4:uint = _arg1.lightLevel;
var _local7:int = _local3.length;
while (_local7-- > 0) {
_local5 = _local3[_local7];
if (!_local5.isTwoSided){
} else {
_local6 = _local5.rightSide.sector;
if (_local6 === _arg1){
_local6 = _local5.leftSide.sector;
//unresolved if
} else {
if (_local6.lightLevel < _local4){
_local4 = _local6.lightLevel;
};
};
};
};
return (((_local4)<_arg1.lightLevel) ? _local4 : _arg2);
}
}
}//package com.brokenfunction.doom.effects
Section 20
//AnimatedFlat (com.brokenfunction.doom.effects.AnimatedFlat)
package com.brokenfunction.doom.effects {
import com.brokenfunction.doom.data.*;
import com.brokenfunction.ezlo.*;
public class AnimatedFlat {
private var _flat:Flat;
private var timeout:uint;// = 8
private static const MAX_TIMEOUT:uint = 8;
public function AnimatedFlat(_arg1:Flat, _arg2:TimeService){
_flat = _arg1;
_arg2.addTimeListener(onTick, 35);
}
private function onTick(_arg1:TimeEvent):void{
var _local2:uint = _arg1.steps;
if (_local2 >= timeout){
_flat.current = _flat.current.next;
timeout = MAX_TIMEOUT;
} else {
timeout = (timeout - _local2);
};
}
}
}//package com.brokenfunction.doom.effects
Section 21
//AnimatedTexture (com.brokenfunction.doom.effects.AnimatedTexture)
package com.brokenfunction.doom.effects {
import com.brokenfunction.doom.data.*;
import com.brokenfunction.ezlo.*;
public class AnimatedTexture {
private var timeout:uint;// = 8
private var _texture:Texture;
private static const MAX_TIMEOUT:uint = 8;
public function AnimatedTexture(_arg1:Texture, _arg2:TimeService){
_texture = _arg1;
_arg2.addTimeListener(onTick, 35);
}
private function onTick(_arg1:TimeEvent):void{
var _local2:uint = _arg1.steps;
if (_local2 >= timeout){
_texture.current = _texture.current.next;
timeout = MAX_TIMEOUT;
} else {
timeout = (timeout - _local2);
};
}
}
}//package com.brokenfunction.doom.effects
Section 22
//Blink05 (com.brokenfunction.doom.effects.Blink05)
package com.brokenfunction.doom.effects {
import com.brokenfunction.doom.data.*;
import com.brokenfunction.ezlo.*;
public class Blink05 extends AbstractEffect {
private var timeout:uint;// = 0
private var _sector:Sector;
private var lightA:uint;
private var lightB:uint;
private static const BLINK:uint = 35;
private static const HOLD:uint = 2;
public function Blink05(_arg1:Sector, _arg2:TimeService){
_sector = _arg1;
lightA = _sector.lightLevel;
lightB = getLowestNearbyLightLevel(_sector, 0);
_arg2.addTimeListener(onTick, 35);
}
private function onTick(_arg1:TimeEvent):void{
var _local2:uint = _arg1.steps;
if (_local2 >= timeout){
if (_sector.lightLevel === lightA){
_sector.lightLevel = lightB;
timeout = BLINK;
} else {
_sector.lightLevel = lightA;
timeout = HOLD;
};
} else {
timeout = (timeout - _local2);
};
}
}
}//package com.brokenfunction.doom.effects
Section 23
//Blink10 (com.brokenfunction.doom.effects.Blink10)
package com.brokenfunction.doom.effects {
import com.brokenfunction.doom.data.*;
import com.brokenfunction.ezlo.*;
public class Blink10 extends AbstractEffect {
private var timeout:uint;// = 0
private var _sector:Sector;
private var lightA:uint;
private var lightB:uint;
private static const BLINK:uint = 70;
private static const HOLD:uint = 2;
public function Blink10(_arg1:Sector, _arg2:TimeService){
_sector = _arg1;
lightA = _sector.lightLevel;
lightB = getLowestNearbyLightLevel(_sector, 0);
_arg2.addTimeListener(onTick, 35);
}
private function onTick(_arg1:TimeEvent):void{
var _local2:uint = _arg1.steps;
if (_local2 >= timeout){
if (_sector.lightLevel === lightA){
_sector.lightLevel = lightB;
timeout = BLINK;
} else {
_sector.lightLevel = lightA;
timeout = HOLD;
};
} else {
timeout = (timeout - _local2);
};
}
}
}//package com.brokenfunction.doom.effects
Section 24
//Glow (com.brokenfunction.doom.effects.Glow)
package com.brokenfunction.doom.effects {
import com.brokenfunction.doom.data.*;
import com.brokenfunction.ezlo.*;
public class Glow extends AbstractEffect {
private var dir:Boolean;// = false
private var _sector:Sector;
private var lightA:uint;
private var lightB:uint;
private var time:uint;
private static const GLOWDX:uint = 8;
public function Glow(_arg1:Sector, _arg2:TimeService){
_sector = _arg1;
lightA = _sector.lightLevel;
lightB = getLowestNearbyLightLevel(_arg1, 0);
_arg2.addTimeListener(onTick, 35);
}
private function onTick(_arg1:TimeEvent):void{
var _local2:uint = _arg1.steps;
while (_local2-- > 0) {
if (dir){
if ((_sector.lightLevel = (_sector.lightLevel - GLOWDX)) < lightB){
_sector.lightLevel = (_sector.lightLevel + GLOWDX);
dir = false;
};
} else {
if ((_sector.lightLevel = (_sector.lightLevel + GLOWDX)) > lightA){
_sector.lightLevel = (_sector.lightLevel - GLOWDX);
dir = true;
};
};
};
}
}
}//package com.brokenfunction.doom.effects
Section 25
//RandomBlink (com.brokenfunction.doom.effects.RandomBlink)
package com.brokenfunction.doom.effects {
import com.brokenfunction.doom.data.*;
import com.brokenfunction.ezlo.*;
public class RandomBlink extends AbstractEffect {
private var timeout:uint;// = 0
private var _sector:Sector;
private var lightA:uint;
private var lightB:uint;
private static const MAX:uint = 32;
public function RandomBlink(_arg1:Sector, _arg2:TimeService){
_sector = _arg1;
lightA = _sector.lightLevel;
lightB = getLowestNearbyLightLevel(_arg1, 0);
_arg2.addTimeListener(onTick, 35);
}
private function onTick(_arg1:TimeEvent):void{
var _local2:uint = _arg1.steps;
if (_local2 >= timeout){
_sector.lightLevel = lightB;
timeout = (Math.random() * MAX);
} else {
_sector.lightLevel = lightA;
timeout = (timeout - _local2);
};
}
}
}//package com.brokenfunction.doom.effects
Section 26
//ScrollingWall (com.brokenfunction.doom.effects.ScrollingWall)
package com.brokenfunction.doom.effects {
import com.brokenfunction.doom.data.*;
import com.brokenfunction.ezlo.*;
public class ScrollingWall {
private var _linedef:Linedef;
public function ScrollingWall(_arg1:Linedef, _arg2:TimeService){
_linedef = _arg1;
_arg2.addTimeListener(onTick, (35 / 2));
}
public function onTick(_arg1:TimeEvent):void{
_linedef.rightSide.offX = (_linedef.rightSide.offX + _arg1.steps);
}
}
}//package com.brokenfunction.doom.effects
Section 27
//AbstractThing (com.brokenfunction.doom.things.AbstractThing)
package com.brokenfunction.doom.things {
import com.brokenfunction.doom.*;
import com.brokenfunction.doom.data.*;
public class AbstractThing extends Thing {
protected var sector:Sector;
private var _alwaysBright:Boolean;
private var _hanging:Boolean;
private var _rad:uint;// = 0
protected var ssector:SSector;
public function AbstractThing(_arg1:DeWadLevel, _arg2:uint, _arg3:Boolean, _arg4:int, _arg5:int, _arg6:Boolean, _arg7:Boolean){
super(_arg4, _arg5);
_hanging = _arg6;
_alwaysBright = _arg7;
ssector = resolveSSector(_arg1.mainNode);
sector = ssector.sector;
ssector.things.push(this);
sector.things.push(this);
}
public function set rad(_arg1:uint):void{
_rad = _arg1;
}
override public function get lightLevel():uint{
return ((_alwaysBright) ? 0xFF : sector.lightLevel);
}
override public function get rad():uint{
return (_rad);
}
override public function get z():int{
return ((_hanging) ? sector.ceil : sector.floor);
}
}
}//package com.brokenfunction.doom.things
Section 28
//Barrel (com.brokenfunction.doom.things.Barrel)
package com.brokenfunction.doom.things {
import com.brokenfunction.doom.*;
import com.brokenfunction.doom.data.*;
public class Barrel extends SimpleThingAni2 {
public function Barrel(_arg1:DeWadLevel, _arg2:Image, _arg3:Image, _arg4:uint, _arg5:Boolean, _arg6:int, _arg7:int){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, false, false);
}
}
}//package com.brokenfunction.doom.things
Section 29
//SimpleThing (com.brokenfunction.doom.things.SimpleThing)
package com.brokenfunction.doom.things {
import com.brokenfunction.doom.*;
import com.brokenfunction.doom.data.*;
public class SimpleThing extends AbstractThing {
private var _img:Image;
public function SimpleThing(_arg1:DeWadLevel, _arg2:Image, _arg3:uint, _arg4:Boolean, _arg5:int, _arg6:int, _arg7:Boolean, _arg8:Boolean){
super(_arg1, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
_img = _arg2;
}
override public function getRelativeImage(_arg1:uint, _arg2:uint):Image{
return (_img);
}
}
}//package com.brokenfunction.doom.things
Section 30
//SimpleThingAni2 (com.brokenfunction.doom.things.SimpleThingAni2)
package com.brokenfunction.doom.things {
import com.brokenfunction.doom.*;
import com.brokenfunction.doom.data.*;
public class SimpleThingAni2 extends AbstractThing {
private var _img1:Image;
private var _img2:Image;
public function SimpleThingAni2(_arg1:DeWadLevel, _arg2:Image, _arg3:Image, _arg4:uint, _arg5:Boolean, _arg6:int, _arg7:int, _arg8:Boolean, _arg9:Boolean){
super(_arg1, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9);
_img1 = _arg2;
_img2 = _arg3;
}
override public function getRelativeImage(_arg1:uint, _arg2:uint):Image{
return ((((_arg2 & 8))===0) ? _img1 : _img2);
}
}
}//package com.brokenfunction.doom.things
Section 31
//SimpleThingAni3 (com.brokenfunction.doom.things.SimpleThingAni3)
package com.brokenfunction.doom.things {
import com.brokenfunction.doom.*;
import com.brokenfunction.doom.data.*;
public class SimpleThingAni3 extends AbstractThing {
private var _img2:Image;
private var _img1:Image;
private var _img3:Image;
public function SimpleThingAni3(_arg1:DeWadLevel, _arg2:Image, _arg3:Image, _arg4:Image, _arg5:uint, _arg6:Boolean, _arg7:int, _arg8:int, _arg9:Boolean, _arg10:Boolean){
super(_arg1, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10);
_img1 = _arg2;
_img2 = _arg3;
_img3 = _arg4;
}
override public function getRelativeImage(_arg1:uint, _arg2:uint):Image{
_arg2 = ((_arg2 >>> 3) % 3);
return ((_arg2) ? ((_arg2)===2) ? _img3 : _img2 : _img1);
}
}
}//package com.brokenfunction.doom.things
Section 32
//SimpleThingAni4 (com.brokenfunction.doom.things.SimpleThingAni4)
package com.brokenfunction.doom.things {
import com.brokenfunction.doom.*;
import com.brokenfunction.doom.data.*;
public class SimpleThingAni4 extends AbstractThing {
private var _img4:Image;
private var _img2:Image;
private var _img1:Image;
private var _img3:Image;
public function SimpleThingAni4(_arg1:DeWadLevel, _arg2:Image, _arg3:Image, _arg4:Image, _arg5:Image, _arg6:uint, _arg7:Boolean, _arg8:int, _arg9:int, _arg10:Boolean, _arg11:Boolean){
super(_arg1, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11);
_img1 = _arg2;
_img2 = _arg3;
_img3 = _arg4;
_img4 = _arg5;
}
override public function getRelativeImage(_arg1:uint, _arg2:uint):Image{
return ((((_arg2 & 16))===0) ? (((_arg2 & 8))===0) ? _img1 : _img2 : (((_arg2 & 8))===0) ? _img3 : _img4);
}
}
}//package com.brokenfunction.doom.things
Section 33
//SimpleThingAni4R (com.brokenfunction.doom.things.SimpleThingAni4R)
package com.brokenfunction.doom.things {
import com.brokenfunction.doom.*;
import com.brokenfunction.doom.data.*;
public class SimpleThingAni4R extends AbstractThing {
private var _img4:Image;
private var _img2:Image;
private var _img1:Image;
private var _img3:Image;
public function SimpleThingAni4R(_arg1:DeWadLevel, _arg2:Image, _arg3:Image, _arg4:Image, _arg5:Image, _arg6:uint, _arg7:Boolean, _arg8:int, _arg9:int, _arg10:Boolean, _arg11:Boolean){
super(_arg1, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11);
_img1 = _arg2;
_img2 = _arg3;
_img3 = _arg4;
_img4 = _arg5;
}
override public function getRelativeImage(_arg1:uint, _arg2:uint):Image{
_arg2 = ((_arg2 >>> 3) % 6);
return ((((_arg2 & 1))===0) ? (_arg2) ? _img3 : _img1 : ((_arg2)===3) ? _img4 : _img2);
}
}
}//package com.brokenfunction.doom.things
Section 34
//Data (com.brokenfunction.doom.Data)
package com.brokenfunction.doom {
public class Data {
public static var sintable:Array = genSin();
public static var costable:Array = genCos();
public static var tantable:Array = genTan();
private static function genTan():Array{
var _local1:Array = new Array(65536);
var _local2:int = _local1.length;
while (_local2-- > 0) {
_local1[_local2] = Math.tan(((_local2 * Math.PI) / 0x8000));
};
return (_local1);
}
private static function genSin():Array{
var _local1:Array = new Array(65536);
var _local2:int = _local1.length;
while (_local2-- > 0) {
_local1[_local2] = Math.sin(((_local2 * Math.PI) / 0x8000));
};
return (_local1);
}
private static function genCos():Array{
var _local1:Array = new Array(65536);
var _local2:int = _local1.length;
while (_local2-- > 0) {
_local1[_local2] = Math.cos(((_local2 * Math.PI) / 0x8000));
};
return (_local1);
}
}
}//package com.brokenfunction.doom
Section 35
//DeWad (com.brokenfunction.doom.DeWad)
package com.brokenfunction.doom {
import flash.utils.*;
import com.brokenfunction.doom.data.*;
import com.brokenfunction.util.*;
import com.brokenfunction.ezlo.*;
public class DeWad extends LumpGroup {
private var _dirpos:uint;// = 0
private var _lumps:uint;// = 0
private var flatCache:Object;
private var textureInfoCache:Object;
private var playpalCache:Object;
private var imageCache:Object;
private var colormapCache:Object;
private var data:ByteArray;
private var textureCache:Object;
private var levels:Object;
private var soundCache:Object;
private var _wadType:String;// = ""
private static const LUMP_SEQUENCE_LIST:Object = genLumpSequenceList();
private static const MAP_CONTINUE:RegExp = /^(THINGS|LINEDEFS|SIDEDEFS|VERTEXES|SEGS|SSECTORS|NODES|SECTORS|REJECT|BLOCKMAP)$/;
private static const TEXTURE_SEQUENCE_LIST:Object = genTextureSequenceList();
private static const BLANK_IGNORE:RegExp = /^(P(|1|2|3)|S|F(|1|2|3))_(START|END)$/;
private static const MAP_START:RegExp = /^(E[0-9]M[0-9]|MAP[0-9]{2})$/;
public function DeWad(_arg1:String, _arg2:ByteArray){
levels = {};
imageCache = {};
flatCache = {};
soundCache = {};
playpalCache = {};
colormapCache = {};
textureCache = {};
super(_arg1);
data = _arg2;
processWad();
}
public function createSound(_arg1:String):AudioSynth{
var sampleRate:uint;
var samples:uint;
var synth:AudioSynth;
var name = _arg1;
try {
data.position = getLump(name).offset;
data.position = (data.position + 2);
sampleRate = data.readUnsignedShort();
samples = data.readUnsignedShort();
data.position = (data.position + 2);
if (sampleRate !== 11025){
throw (new Error("Unknown sample rate"));
};
synth = new AudioSynth(AudioSynth.SAMPLE_RATE_11025, AudioSynth.CHANNELS_MONO, AudioSynth.DEPTH_8BIT);
synth.writeBytes(data, data.position, samples);
synth.close();
return (synth);
} catch(e:Error) {
throw (new Error(((("Could not load audio \"" + name) + "\": ") + e.message)));
};
return (null);
}
public function getFlat(_arg1:String):Flat{
var lump:Lump;
var flat:Flat;
var name = _arg1;
try {
if ((name in flatCache)){
return (flatCache[name]);
} else {
lump = getLump(name);
flat = (flatCache[name] = createFlat(lump));
if (lump.next){
flat.next = getFlat(lump.next.name);
};
return (flat);
};
} catch(e:Error) {
throw (new Error(((("Could not load flat \"" + name) + "\": ") + e.message)));
};
return (null);
}
private function createPlayPalette(_arg1:uint):PlayPalette{
data.position = getLump("PLAYPAL").offset;
return (new PlayPalette(data, _arg1));
}
public function getColormap(_arg1:uint=0):Colormap{
var index = _arg1;
try {
return (((colormapCache[index]) || ((colormapCache[index] = createColormap(index)))));
} catch(e:Error) {
throw (new Error(("Could not load colormap: " + e.message)));
};
return (null);
}
private function createTexture(_arg1:TextureInfo):Texture{
var _local4:TexturePatch;
var _local2:Texture = new Texture(_arg1.width, _arg1.height);
var _local3:Array = _arg1.patches;
var _local5:int;
while (_local5 < _local3.length) {
_local4 = (_local3[_local5] as TexturePatch);
_local2.copyImage(getImage(_local4.wall), _local4.offX, _local4.offY);
_local5++;
};
return (_local2);
}
private function createFlat(_arg1:Lump):Flat{
data.position = _arg1.offset;
return (new Flat(data));
}
public function getTextureInfo(_arg1:String):TextureInfo{
var name = _arg1;
name = name.toUpperCase();
try {
if (!textureInfoCache){
textureInfoCache = createTextureList(createPNames());
};
if ((name in textureInfoCache)){
return (textureInfoCache[name]);
} else {
throw (new Error("Not found"));
};
} catch(e:Error) {
throw (new Error(((("Could not load texture info \"" + name) + "\": ") + e.message)));
};
return (null);
}
private function createPNames():Array{
var _local1:Array = [];
data.position = getLump("PNAMES").offset;
var _local2:uint = data.readUnsignedInt();
while (_local2-- > 0) {
_local1.push(readStr8(data).toUpperCase());
};
return (_local1);
}
private function createTextureList2(_arg1:Object, _arg2:Array):void{
var _local4:String;
var _local5:uint;
var _local6:uint;
var _local7:int;
var _local8:int;
var _local9:uint;
var _local10:TextureInfo;
var _local12:String;
var _local13:TextureInfo;
var _local16:uint;
var _local3:uint = data.position;
var _local11:Boolean;
var _local14:uint;
var _local15:uint = data.readUnsignedInt();
while (_local14 < _local15) {
data.position = ((_local3 + 4) + (_local14 * 4));
data.position = (_local3 + data.readUnsignedInt());
_local4 = readStr8(data);
data.position = (data.position + 4);
_local5 = data.readUnsignedShort();
_local6 = data.readUnsignedShort();
data.position = (data.position + 4);
if (_local11){
_local10.next = new TextureInfo(_local4, _local5, _local6);
_local10 = _local10.next;
if (_local4 == _local12){
_local10.next = _local13;
_local11 = false;
};
} else {
_local10 = new TextureInfo(_local4, _local5, _local6);
if ((_local4 in TEXTURE_SEQUENCE_LIST)){
_local12 = TEXTURE_SEQUENCE_LIST[_local4];
_local11 = true;
_local13 = _local10;
};
};
_local16 = data.readUnsignedShort();
while (_local16-- > 0) {
_local7 = data.readShort();
_local8 = data.readShort();
_local9 = data.readUnsignedShort();
data.position = (data.position + 4);
if (!(_local9 in _arg2)){
throw (new Error((("Invalid pname index (" + _local9) + ")")));
};
_local10.patches.push(new TexturePatch(_local7, _local8, (_arg2[_local9] as String)));
};
if ((_local4 in _arg1)){
trace((("TextureInfo \"" + _local4) + "\" already encountered, ignoring"));
} else {
_arg1[_local4] = _local10;
};
_local14++;
};
if (_local11){
throw (new Error((((("Texture sequence \"" + _local13.name) + "\" is missing end \"") + _local12) + "\"")));
};
}
public function getImage(_arg1:String):Image{
var name = _arg1;
try {
return (((imageCache[name]) || ((imageCache[name] = createImage(getLump(name))))));
} catch(e:Error) {
throw (new Error(((("Could not load image \"" + name) + "\": ") + e.message)));
};
return (null);
}
public function createLevel(_arg1:String, _arg2:TimeService, _arg3:uint=0):DeWadLevel{
var name = _arg1;
var timeService = _arg2;
var thingRequire = _arg3;
try {
if ((levels[name] is LumpGroup)){
return (new DeWadLevel(this, data, levels[name], timeService, thingRequire));
} else {
throw (new Error("Level not found"));
};
} catch(e:Error) {
throw (new Error(((("Could not load level \"" + name) + "\": ") + e.message)));
};
return (null);
}
private function processWad():void{
var str1:uint;
var str2:uint;
var str3:uint;
var str4:uint;
trace((("Processing WAD (" + data.length) + " bytes)"));
try {
data.position = 0;
data.endian = Endian.LITTLE_ENDIAN;
str1 = data.readUnsignedByte();
str2 = data.readUnsignedByte();
str3 = data.readUnsignedByte();
str4 = data.readUnsignedByte();
_wadType = String.fromCharCode(str1, str2, str3, str4);
if (_wadType == "IWAD"){
trace("WAD type: IWAD");
_lumps = data.readUnsignedInt();
trace(("Lumps: " + _lumps));
_dirpos = data.readUnsignedInt();
data.position = _dirpos;
processDirectory();
} else {
if (_wadType == "PWAD"){
trace("WAD type: PWAD");
throw (new Error("Sorry, not compatible with PWADs (Patch WADs)"));
} else {
throw (new Error("Unknown WAD type (if it is a WAD)"));
};
};
} catch(e:Error) {
throw (new Error(("Could not load wad: " + e.message)));
};
}
public function getTexture(_arg1:String):Texture{
var info:TextureInfo;
var texture:Texture;
var name = _arg1;
name = name.toUpperCase();
try {
if ((name in textureCache)){
return (textureCache[name]);
} else {
info = getTextureInfo(name);
texture = (textureCache[name] = createTexture(info));
if (info.next){
texture.next = getTexture(info.next.name);
};
return (texture);
};
} catch(e:Error) {
throw (new Error(((("Could not load texture \"" + name) + "\": ") + e.message)));
};
return (null);
}
public function clearCaches():void{
imageCache = {};
flatCache = {};
playpalCache = {};
colormapCache = [];
textureCache = {};
textureInfoCache = null;
}
public function getPlayPalette(_arg1:uint=0):PlayPalette{
var index = _arg1;
try {
return (((playpalCache[index]) || ((playpalCache[index] = createPlayPalette(index)))));
} catch(e:Error) {
throw (new Error(("Could not load play palette: " + e.message)));
};
return (null);
}
private function createColormap(_arg1:uint):Colormap{
data.position = getLump("COLORMAP").offset;
return (new Colormap(data, _arg1));
}
private function createTextureList(_arg1:Array):Object{
var _local2:Object = {};
data.position = getLump("TEXTURE1").offset;
createTextureList2(_local2, _arg1);
if (lumpExists("TEXTURE2")){
data.position = getLump("TEXTURE2").offset;
createTextureList2(_local2, _arg1);
};
return (_local2);
}
private function processDirectory():void{
var _local2:Lump;
var _local3:LumpGroup;
var _local6:Lump;
var _local7:String;
var _local1:int;
var _local4:Boolean;
var _local5:Boolean;
while (_local1++ < _lumps) {
if (_local5){
_local2 = (_local2.next = new Lump(data));
if (_local2.name == _local7){
_local2.next = _local6;
_local5 = false;
};
} else {
_local2 = new Lump(data);
if ((_local2.name in LUMP_SEQUENCE_LIST)){
_local5 = true;
_local6 = _local2;
_local7 = LUMP_SEQUENCE_LIST[_local2.name];
};
};
if (_local4){
if (MAP_CONTINUE.exec(_local2.name) != null){
_local3.addLump(_local2);
continue;
} else {
_local4 = false;
};
};
if (MAP_START.exec(_local2.name) != null){
_local4 = true;
_local3 = new LumpGroup(_local2.name);
if ((levels[_local3.name] is LumpGroup)){
trace((("Level \"" + _local3.name) + "\" already encountered, ignoring"));
} else {
levels[_local2.name] = _local3;
};
} else {
if ((((_local2.size === 0)) && ((BLANK_IGNORE.exec(_local2.name) == null)))){
trace((("Entry \"" + _local2.name) + "\" has no size, ignoring"));
} else {
addLump(_local2);
};
};
};
if (_local5){
throw (new Error((((("Sequence \"" + _local6.name) + "\" is missing end \"") + _local7) + "\"")));
};
}
private function createImage(_arg1:Lump):Image{
var _local8:int;
var _local9:int;
var _local10:ByteArray;
var _local2:uint = (data.position = _arg1.offset);
var _local3:uint = data.readUnsignedShort();
var _local4:uint = data.readUnsignedShort();
var _local5:int = data.readShort();
var _local6:int = data.readShort();
var _local7:Image = new Image(_local3, _local4, _local5, _local6);
while (_local3-- > 0) {
data.position = ((_local2 + 8) + (_local3 * 4));
data.position = (_local2 + data.readUnsignedInt());
while ((_local8 = data.readUnsignedByte()) !== 0xFF) {
_local9 = data.readUnsignedByte();
data.position++;
while (_local9-- > 0) {
var _temp1 = _local8;
_local8 = (_local8 + 1);
_local7.setPixel32(_local3, _temp1, (4278190080 | data.readUnsignedByte()));
};
data.position++;
};
};
return (_local7);
}
private static function genTextureSequenceList():Object{
var _local1:Object = {};
_local1["BLODGR1"] = "BLODGR4";
_local1["BLODRIP1"] = "BLODRIP4";
_local1["FIREBLU1"] = "FIREBLU2";
_local1["FIRLAV3"] = "FIRELAVA";
_local1["FIREMAG1"] = "FIREMAG3";
_local1["FIREWALA"] = "FIREWALL";
_local1["GSTFONT1"] = "GSTFONT3";
_local1["ROCKRED1"] = "ROCKRED3";
_local1["SLADRIP1"] = "SLADRIP3";
_local1["BFALL1"] = "BFALL4";
_local1["SFALL1"] = "SFALL4";
_local1["WFALL1"] = "WFALL4";
_local1["DBRAIN1"] = "DBRAIN4";
return (_local1);
}
private static function genLumpSequenceList():Object{
var _local1:Object = {};
_local1["NUKAGE1"] = "NUKAGE3";
_local1["FWATER1"] = "FWATER4";
_local1["SWATER1"] = "SWATER4";
_local1["LAVA1"] = "LAVA4";
_local1["BLOOD1"] = "BLOOD3";
_local1["RROCK05"] = "RROCK08";
_local1["SLIME01"] = "SLIME04";
_local1["SLIME05"] = "SLIME08";
_local1["SLIME09"] = "SLIME12";
return (_local1);
}
}
}//package com.brokenfunction.doom
Section 36
//DeWadLevel (com.brokenfunction.doom.DeWadLevel)
package com.brokenfunction.doom {
import flash.utils.*;
import com.brokenfunction.doom.data.*;
import com.brokenfunction.ezlo.*;
public class DeWadLevel {
private var _blockmap:Blockmap;
private var _maxX:int;// = 0
private var _maxY:int;// = 0
private var _sectors:Array;
private var _vertices:Array;
private var _wad:DeWad;
private var _things:Array;
private var _minX:int;// = 0
private var _timeService:TimeService;
private var _minY:int;// = 0
private var _mainNode:Node;
private var _reject:Reject;
public function DeWadLevel(_arg1:DeWad, _arg2:ByteArray, _arg3:LumpGroup, _arg4:TimeService, _arg5:uint=0){
var lump:Lump;
var sidedefs:Array;
var linedefs:Array;
var segs:Array;
var ssectors:Array;
var wad = _arg1;
var data = _arg2;
var levelLump = _arg3;
var timeService = _arg4;
var thingRequire = _arg5;
super();
trace("Loading map...");
_wad = wad;
_timeService = timeService;
try {
lump = levelLump.getLump("SECTORS");
data.position = lump.offset;
_sectors = processSectors(data, lump.size);
} catch(e:Error) {
throw (new Error(("Couldn't load sectors: " + e.message)));
};
try {
lump = levelLump.getLump("SIDEDEFS");
data.position = lump.offset;
sidedefs = processSidedefs(data, lump.size, _sectors);
} catch(e:Error) {
throw (new Error(("Couldn't load sidedefs: " + e.message)));
};
try {
lump = levelLump.getLump("VERTEXES");
data.position = lump.offset;
_vertices = processVerticies(data, lump.size);
} catch(e:Error) {
throw (new Error(("Couldn't load vertices: " + e.message)));
};
try {
lump = levelLump.getLump("LINEDEFS");
data.position = lump.offset;
linedefs = processLinedefs(data, lump.size, _vertices, sidedefs);
} catch(e:Error) {
throw (new Error(("Couldn't load linedefs: " + e.message)));
};
try {
lump = levelLump.getLump("SEGS");
data.position = lump.offset;
segs = processSegs(data, lump.size, _vertices, linedefs);
} catch(e:Error) {
throw (new Error(("Couldn't load segs: " + e.message)));
};
try {
lump = levelLump.getLump("SSECTORS");
data.position = lump.offset;
ssectors = processSSectors(data, lump.size, segs);
} catch(e:Error) {
throw (new Error(("Couldn't load ssectors: " + e.message)));
};
try {
lump = levelLump.getLump("NODES");
data.position = lump.offset;
_mainNode = processNodes(data, lump.size, ssectors);
} catch(e:Error) {
throw (new Error(("Couldn't load nodes: " + e.message)));
};
try {
lump = levelLump.getLump("BLOCKMAP");
data.position = lump.offset;
_blockmap = processBlockmap(data, lump.size, linedefs);
} catch(e:Error) {
throw (new Error(("Couldn't load blockmap: " + e.message)));
};
try {
lump = levelLump.getLump("THINGS");
data.position = lump.offset;
_things = processThings(data, lump.size, thingRequire);
} catch(e:Error) {
throw (new Error(("Couldn't load things: " + e.message)));
};
try {
lump = levelLump.getLump("REJECT");
data.position = lump.offset;
_reject = processReject(data, lump.size, _sectors);
} catch(e:Error) {
throw (new Error(("Couldn't load reject: " + e.message)));
};
trace("Loaded");
}
private function processNodes(_arg1:ByteArray, _arg2:uint, _arg3:Array):Node{
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:uint;
var _local11:int;
var _local12:int;
var _local13:int;
var _local14:int;
var _local15:int;
var _local16:int;
var _local17:int;
var _local18:int;
var _local20:uint;
var _local21:Node;
var _local4:uint = _arg1.position;
var _local5:Array = [];
while (_arg2 >= 28) {
_local6 = _arg1.readShort();
_local7 = _arg1.readShort();
_local8 = _arg1.readShort();
_local9 = _arg1.readShort();
_local10 = ((Math.atan2(_local9, _local8) * (0x8000 / Math.PI)) & 0xFFFF);
_local11 = _arg1.readShort();
_local12 = _arg1.readShort();
_local13 = _arg1.readShort();
_local14 = _arg1.readShort();
_local15 = _arg1.readShort();
_local16 = _arg1.readShort();
_local17 = _arg1.readShort();
_local18 = _arg1.readShort();
_arg1.position = (_arg1.position + 4);
_local5.push(new Node(_local6, _local7, _local8, _local9, _local10, _local11, _local12, _local13, _local14, _local15, _local16, _local17, _local18));
_arg2 = (_arg2 - 28);
};
var _local19:uint;
while ((_local21 = _local5[_local19])) {
var _temp1 = _local19;
_local19 = (_local19 + 1);
_arg1.position = (((_temp1 * 28) + _local4) + 24);
_local20 = _arg1.readUnsignedShort();
if ((_local20 & 0x8000) === 0x8000){
if (!(_local21.rightSSector = (_arg3[(_local20 & 32767)] as SSector))){
throw (new Error((("Invalid right ssector (" + (_local20 & 32767)) + ")")));
};
} else {
if (!(_local21.rightNode = (_local5[_local20] as Node))){
throw (new Error((("Invalid right node (" + _local20) + ")")));
};
};
_local20 = _arg1.readUnsignedShort();
if ((_local20 & 0x8000) === 0x8000){
if (!(_local21.leftSSector = (_arg3[(_local20 & 32767)] as SSector))){
throw (new Error((("Invalid left ssector (" + (_local20 & 32767)) + ")")));
};
} else {
if (!(_local21.leftNode = (_local5[_local20] as Node))){
throw (new Error((("Invalid left node (" + _local20) + ")")));
};
};
};
if (_local5.length <= 0){
throw (new Error("There must be more than one node"));
};
trace((("\tNodes: " + _local5.length) + (_arg2) ? ((" (residue " + _arg2) + ")") : ""));
return ((_local5[(_local5.length - 1)] as Node));
}
public function get maxX():int{
return (_maxX);
}
private function processReject2(_arg1:Reject, _arg2:Array, _arg3:uint):void{
var _local4:uint = _arg2.length;
var _local5:uint = (_arg3 % _local4);
var _local6:uint = (_arg3 / _local4);
if (!(_local5 in _arg2)){
throw (new Error((((("Invalid column sector (" + _local5) + "/") + _local4) + ")")));
};
if (!(_local6 in _arg2)){
throw (new Error((((("Invalid row sector (" + _local6) + "/") + _local4) + ")")));
};
_arg1.setReject((_arg2[_local5] as Sector), (_arg2[_local6] as Sector));
}
private function processBlockmap(_arg1:ByteArray, _arg2:uint, _arg3:Array):Blockmap{
var _local12:uint;
var _local13:Array;
var _local4:uint = _arg1.position;
var _local5:int = _arg1.readShort();
var _local6:int = _arg1.readShort();
var _local7:uint = _arg1.readUnsignedShort();
var _local8:uint = _arg1.readUnsignedShort();
var _local9:uint = (_local7 * _local8);
var _local10:Blockmap = new Blockmap(_local5, _local6, _local7, _local8);
var _local11:uint;
while (_local11 < _local9) {
_arg1.position = ((_local4 + 8) + (_local11 << 1));
_arg1.position = (_local4 + (_arg1.readUnsignedShort() << 1));
if (_arg1.readUnsignedShort() !== 0){
throw (new Error((((("Blocklist " + _local11) + "/") + (_local9 - 1)) + " does not start with 0x0000")));
};
_local13 = [];
while ((_local12 = _arg1.readUnsignedShort()) !== 0xFFFF) {
if (!(_local12 in _arg3)){
throw (new Error((("Invalid linedef (" + _local12) + ")")));
};
_local13.push((_arg3[_local12] as Linedef));
};
_local10.setBlock((_local11 % _local7), (_local11 / _local7), _local13);
_local11++;
};
trace(((("\tBlockmap: " + _local7) + "x") + _local8));
return (_local10);
}
public function get sectors():Array{
return (_sectors.concat());
}
public function get blockmap():Blockmap{
return (_blockmap);
}
private function processSegs(_arg1:ByteArray, _arg2:uint, _arg3:Array, _arg4:Array):Array{
var _local6:uint;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:uint;
var _local11:int;
var _local5:Array = [];
while (_arg2 >= 12) {
_local6 = _arg1.readUnsignedShort();
_local7 = _arg1.readUnsignedShort();
_local8 = _arg1.readUnsignedShort();
_local9 = _arg1.readUnsignedShort();
_local10 = _arg1.readUnsignedShort();
_local11 = _arg1.readUnsignedShort();
if (!(_local6 in _arg3)){
throw (new Error((("Invalid \"from\" vertex (" + _local6) + ")")));
};
if (!(_local7 in _arg3)){
throw (new Error((("Invalid \"to\" vertex (" + _local7) + ")")));
};
if (!(_local9 in _arg4)){
throw (new Error((("Invalid linedef (" + _local9) + ")")));
};
if ((_local10 & ~(1)) !== 0){
throw (new Error((("reverseDir isn't specific (" + _local10) + ")")));
};
_local5.push(new Seg((_arg3[_local6] as Vertex), (_arg3[_local7] as Vertex), _local8, (_arg4[_local9] as Linedef), ((_local10 & 1) === 1), _local11));
_arg2 = (_arg2 - 12);
};
trace((("\tSegs: " + _local5.length) + (_arg2) ? ((" (residue " + _arg2) + ")") : ""));
return (_local5);
}
private function processLinedefs(_arg1:ByteArray, _arg2:uint, _arg3:Array, _arg4:Array):Array{
var _local6:uint;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:uint;
var _local11:uint;
var _local12:Sidedef;
var _local13:Sidedef;
var _local14:uint;
var _local15:Linedef;
var _local5:Array = [];
while (_arg2 >= 14) {
_local6 = (_arg1.readUnsignedShort() & 32767);
_local7 = (_arg1.readUnsignedShort() & 32767);
_local8 = _arg1.readUnsignedShort();
_local9 = _arg1.readUnsignedShort();
_local14 = _arg1.readUnsignedShort();
_local10 = _arg1.readUnsignedShort();
_local11 = _arg1.readUnsignedShort();
if (_local10 !== 0xFFFF){
if (!(_local10 in _arg4)){
throw (new Error((("Invalid \"right\" sidedef (" + _local10) + ")")));
};
_local12 = (_arg4[_local10] as Sidedef);
} else {
throw (new Error("Missing right sidedef"));
};
if ((_local8 & Linedef.TWO_SIDED) === Linedef.TWO_SIDED){
if (_local11 === 0xFFFF){
throw (new Error("Two-sided linedef is missing left side"));
};
if (!(_local11 in _arg4)){
throw (new Error((("Invalid \"left\" sidedef (" + _local11) + ")")));
};
_local13 = (_arg4[_local11] as Sidedef);
} else {
if (_local11 !== 0xFFFF){
throw (new Error("One-sided linedef has a left side (egads!)"));
};
_local13 = null;
};
if (!(_local6 in _arg3)){
throw (new Error((("Invalid \"from\" vertex (" + _local6) + ")")));
};
if (!(_local7 in _arg3)){
throw (new Error((("Invalid \"to\" vertex (" + _local7) + ")")));
};
_local15 = new Linedef((_arg3[_local6] as Vertex), (_arg3[_local7] as Vertex), _local8, _local9, _local12, _local13);
_local5.push(_local15);
if (_local12){
_local12.sector.linedefs.push(_local15);
};
if (_local13){
_local13.sector.linedefs.push(_local15);
};
_arg2 = (_arg2 - 14);
};
trace((("\tLinedefs: " + _local5.length) + (_arg2) ? ((" (residue " + _arg2) + ")") : ""));
return (_local5);
}
public function get minY():int{
return (_minY);
}
public function get wad():DeWad{
return (_wad);
}
public function get things():Array{
return (_things.concat());
}
private function processSectors(_arg1:ByteArray, _arg2:uint):Array{
var _local4:uint;
var _local5:int;
var _local6:int;
var _local7:String;
var _local8:String;
var _local9:Flat;
var _local10:Flat;
var _local11:uint;
var _local12:uint;
var _local13:uint;
var _local3:Array = [];
while (_arg2 >= 26) {
_local5 = _arg1.readShort();
_local6 = _arg1.readShort();
_local7 = readStr8(_arg1);
_local8 = readStr8(_arg1);
_local11 = _arg1.readUnsignedShort();
_local12 = _arg1.readUnsignedShort();
_local13 = _arg1.readUnsignedShort();
_local4 = _arg1.position;
_local9 = ((_local7)=="F_SKY1") ? Flat.SKY_FLAT : _wad.getFlat(_local7);
_local10 = ((_local8)=="F_SKY1") ? Flat.SKY_FLAT : _wad.getFlat(_local8);
_arg1.position = _local4;
_local3.push(new Sector(_local5, _local6, _local9, _local10, _local11, _local12));
_arg2 = (_arg2 - 26);
};
trace((("\tSectors: " + _local3.length) + (_arg2) ? ((" (residue " + _arg2) + ")") : ""));
return (_local3);
}
public function get reject():Reject{
return (_reject);
}
public function get mainNode():Node{
return (_mainNode);
}
private function processThings(_arg1:ByteArray, _arg2:uint, _arg3:uint=0):Array{
var _local7:int;
var _local8:int;
var _local9:uint;
var _local10:uint;
var _local11:uint;
var _local4:uint = _arg1.position;
var _local5:Array = [];
var _local6:uint;
while (_arg2 >= 10) {
_local7 = _arg1.readShort();
_local8 = _arg1.readShort();
_local9 = (((_arg1.readUnsignedShort() * 0x8000) / 180) & 0xFFFF);
_local10 = _arg1.readUnsignedShort();
_local11 = _arg1.readUnsignedShort();
if ((_local11 & _arg3) === _arg3){
_local5.push(new ThingInfo(_local7, _local8, _local9, _local10, _local11));
};
_local6++;
_arg2 = (_arg2 - 10);
};
trace((((("\tThings: " + _local5.length) + "/") + _local6) + (_arg2) ? ((" (residue " + _arg2) + ")") : ""));
return (_local5);
}
private function processReject(_arg1:ByteArray, _arg2:uint, _arg3:Array):Reject{
var _local10:uint;
var _local4:uint = _arg1.position;
var _local5:Reject = new Reject();
var _local6:uint = _arg3.length;
var _local7:uint = (_arg3.length * _local6);
var _local8:uint = ((_local7 >>> 3) + (((_local7 & 7))!==0) ? 1 : 0);
if (_arg2 < _local8){
_local7 = (_arg2 << 3);
};
var _local9:uint;
while (_local7 >= 8) {
_local10 = _arg1.readUnsignedByte();
if ((_local10 & 128) === 128){
processReject2(_local5, _arg3, _local9);
};
if ((_local10 & 64) === 64){
processReject2(_local5, _arg3, (_local9 + 1));
};
if ((_local10 & 32) === 32){
processReject2(_local5, _arg3, (_local9 + 2));
};
if ((_local10 & 16) === 16){
processReject2(_local5, _arg3, (_local9 + 3));
};
if ((_local10 & 8) === 8){
processReject2(_local5, _arg3, (_local9 + 4));
};
if ((_local10 & 4) === 4){
processReject2(_local5, _arg3, (_local9 + 5));
};
if ((_local10 & 2) === 2){
processReject2(_local5, _arg3, (_local9 + 6));
};
if ((_local10 & 1) === 1){
processReject2(_local5, _arg3, (_local9 + 7));
};
_local9 = (_local9 + 8);
_local7 = (_local7 - 8);
};
if (_local7 >= 1){
_local10 = _arg1.readUnsignedByte();
if ((_local10 & 128) === 128){
processReject2(_local5, _arg3, _local9);
};
_local9++;
--_local7;
if (_local7 >= 1){
if ((_local10 & 64) === 64){
processReject2(_local5, _arg3, _local9);
};
_local9++;
--_local7;
if (_local7 >= 1){
if ((_local10 & 32) === 32){
processReject2(_local5, _arg3, _local9);
};
_local9++;
--_local7;
if (_local7 >= 1){
if ((_local10 & 16) === 16){
processReject2(_local5, _arg3, _local9);
};
_local9++;
--_local7;
if (_local7 >= 1){
if ((_local10 & 8) === 8){
processReject2(_local5, _arg3, _local9);
};
_local9++;
--_local7;
if (_local7 >= 1){
if ((_local10 & 4) === 4){
processReject2(_local5, _arg3, _local9);
};
_local9++;
--_local7;
if (_local7 >= 1){
if ((_local10 & 2) === 2){
processReject2(_local5, _arg3, _local9);
};
_local9++;
--_local7;
if (_local7 >= 1){
if ((_local10 & 1) === 1){
processReject2(_local5, _arg3, _local9);
};
_local9++;
};
};
};
};
};
};
};
};
trace(((("\tReject: " + _local9) + " pairs ") + ((_arg2)<_local8) ? ((" (" + (_local8 - _arg2)) + " bytes missing)") : ((_arg2)>_local8) ? ((" (residue " + (_arg2 - _local8)) + ")") : ""));
return (_local5);
}
public function get timeService():TimeService{
return (_timeService);
}
public function get maxY():int{
return (_maxY);
}
private function processSSectors(_arg1:ByteArray, _arg2:uint, _arg3:Array):Array{
var _local5:uint;
var _local6:SSector;
var _local9:int;
var _local4:Array = [];
var _local7:uint;
var _local8:uint;
while (_arg2 >= 4) {
_local8 = _arg1.readUnsignedShort();
_local7 = _arg1.readUnsignedShort();
if (_local7 !== _local5){
throw (new Error((((("Segs not in proper order (" + _local7) + " != ") + _local5) + ")")));
};
if ((_local7 + _local8) > _arg3.length){
throw (new Error((((((("SSector accesses invalid segs (" + _arg3.length) + " < ") + _local7) + "+") + _local8) + ")")));
};
_local6 = new SSector(_local8);
_local4.push(_local6);
_local9 = _local8;
while (_local9-- > 0) {
_local6[_local9] = _arg3[(_local7 + _local9)];
};
_local5 = (_local5 + _local8);
_arg2 = (_arg2 - 4);
};
trace((("\tSSectors: " + _local4.length) + (_arg2) ? ((" (residue " + _arg2) + ")") : ""));
return (_local4);
}
public function get vertices():Array{
return (_vertices.concat());
}
private function processSidedefs(_arg1:ByteArray, _arg2:uint, _arg3:Array):Array{
var _local5:uint;
var _local6:int;
var _local7:int;
var _local8:String;
var _local9:String;
var _local10:String;
var _local11:Texture;
var _local12:Texture;
var _local13:Texture;
var _local14:uint;
var _local4:Array = [];
while (_arg2 >= 30) {
_local6 = _arg1.readShort();
_local7 = _arg1.readShort();
_local8 = readStr8(_arg1);
_local9 = readStr8(_arg1);
_local10 = readStr8(_arg1);
_local14 = _arg1.readUnsignedShort();
if (!(_local14 in _arg3)){
throw (new Error((("Invalid sector (" + _local14) + ")")));
};
_local5 = _arg1.position;
_local11 = ((_local8)=="-") ? null : _wad.getTexture(_local8);
_local12 = ((_local9)=="-") ? null : _wad.getTexture(_local9);
_local13 = ((_local10)=="-") ? null : _wad.getTexture(_local10);
_arg1.position = _local5;
_local4.push(new Sidedef(_local6, _local7, _local11, _local12, _local13, (_arg3[_local14] as Sector)));
_arg2 = (_arg2 - 30);
};
trace((("\tSidedefs: " + _local4.length) + (_arg2) ? ((" (residue " + _arg2) + ")") : ""));
return (_local4);
}
private function processVerticies(_arg1:ByteArray, _arg2:uint):Array{
var _local4:int;
var _local5:int;
var _local3:Array = [];
while (_arg2 >= 4) {
_local4 = _arg1.readShort();
_local5 = _arg1.readShort();
if (_local4 > _maxX){
_maxX = _local4;
} else {
if (_local4 < _minX){
_minX = _local4;
};
};
if (_local5 > _maxY){
_maxY = _local5;
} else {
if (_local5 < _minY){
_minY = _local5;
};
};
_local3.push(new Vertex(_local4, _local5));
_arg2 = (_arg2 - 4);
};
trace((("\tVerticies: " + _local3.length) + (_arg2) ? ((" (residue " + _arg2) + ")") : ""));
return (_local3);
}
public function get minX():int{
return (_minX);
}
private static function getAlternateTextures():Object{
var _local1:Object = {};
_local1["SW1BRCOM"] = "SW2BRCOM";
_local1["SW1BRN1"] = "SW2BRN1";
_local1["SW1BRN2"] = "SW2BRN2";
_local1["SW1BRNGN"] = "SW2BRNGN";
_local1["SW1BROWN"] = "SW2BROWN";
_local1["SW1COMM"] = "SW2COMM";
_local1["SW1COMP"] = "SW2COMP";
_local1["SW1DIRT"] = "SW2DIRT";
_local1["SW1EXIT"] = "SW2EXIT";
_local1["SW1GRAY"] = "SW2GRAY";
_local1["SW1GRAY1"] = "SW2GRAY1";
_local1["SW1METAL"] = "SW2METAL";
_local1["SW1PIPE"] = "SW2PIPE";
_local1["SW1SLAD"] = "SW2SLAD";
_local1["SW1STARG"] = "SW2STARG";
_local1["SW1STON1"] = "SW2STON1";
_local1["SW1STON2"] = "SW2STON2";
_local1["SW1STONE"] = "SW2STONE";
_local1["SW1STRTN"] = "SW2STRTN";
_local1["SW1BLUE"] = "SW2BLUE";
_local1["SW1CMT"] = "SW2CMT";
_local1["SW1GARG"] = "SW2GARG";
_local1["SW1GSTON"] = "SW2GSTON";
_local1["SW1HOT"] = "SW2HOT";
_local1["SW1LION"] = "SW2LION";
_local1["SW1SATYR"] = "SW2SATYR";
_local1["SW1SKIN"] = "SW2SKIN";
_local1["SW1VINE"] = "SW2VINE";
_local1["SW1WOOD"] = "SW2WOOD";
_local1["SW1PANEL"] = "SW2PANEL";
_local1["SW1ROCK"] = "SW2ROCK";
_local1["SW1MET2"] = "SW2MET2";
_local1["SW1WDMET"] = "SW2WDMET";
_local1["SW1BRIK"] = "SW2BRIK";
_local1["SW1MOD1"] = "SW2MOD1";
_local1["SW1ZIM"] = "SW2ZIM";
_local1["SW1STON6"] = "SW2STON6";
_local1["SW1TEK"] = "SW2TEK";
_local1["SW1MARB"] = "SW2MARB";
_local1["SW1SKULL"] = "SW2SKULL";
return (_local1);
}
}
}//package com.brokenfunction.doom
Section 37
//DoomCore (com.brokenfunction.doom.DoomCore)
package com.brokenfunction.doom {
import flash.display.*;
import flash.utils.*;
import com.brokenfunction.doom.data.*;
import com.brokenfunction.util.*;
import com.brokenfunction.ezlo.time.*;
import flash.ui.*;
public class DoomCore {
private var player:MovingThing;
private var playerControl:Player;
private var timeService:LazyTimeService;
private var rend:DoomRender;
private var input:KeyInput;
private var fps:Fps;
private var debug:Shape;
private var wad:DeWad;
private var counter:Counter;
public function DoomCore(_arg1:Sprite, _arg2:ByteArray){
fps = new Fps();
timeService = new LazyTimeService();
input = new KeyInput(_arg1.stage);
input.setKey(Player.KEY_FORWARD, Keyboard.UP);
input.setKey(Player.KEY_FORWARD, 87);
input.setKey(Player.KEY_RIGHT, Keyboard.RIGHT);
input.setKey(Player.KEY_RIGHT, 68);
input.setKey(Player.KEY_BACKWARD, Keyboard.DOWN);
input.setKey(Player.KEY_BACKWARD, 83);
input.setKey(Player.KEY_LEFT, Keyboard.LEFT);
input.setKey(Player.KEY_LEFT, 65);
input.setKey(Player.KEY_STRAFE, Keyboard.CONTROL);
input.setKey(Player.KEY_SPEED, Keyboard.SHIFT);
input.setKey(Player.KEY_FIRE, Keyboard.SPACE);
input.setKey(Player.KEY_USE, Keyboard.ENTER);
input.setKey(Player.KEY_USE, 69);
debug = new Shape();
rend = new DoomRender();
rend.x = (rend.y = 100);
_arg1.addChild(rend.displayObject);
debug.x = (rend.x + (rend.width / 2));
debug.y = (rend.y + (rend.height / 2));
_arg1.addChild(debug);
wad = new DeWad("root", _arg2);
var _local3:DeWadLevel = wad.createLevel("E1M1", timeService, ThingInfo.OPTION_SKILLNORMAL);
var _local4:ThingProcessor = new ThingProcessor(_local3);
var _local5:LevelProcessor = new LevelProcessor(_local3);
var _local6:ThingInfo = _local4.player1Start;
rend.setMap(_local3, wad.getTexture("SKY1"));
player = new MovingThing(_local3, 56, 40);
if (_local6){
player.x = _local6.x;
player.y = _local6.y;
player.rot = _local6.ang;
};
playerControl = new Player(player, input, timeService);
wad.clearCaches();
counter = new Counter((35 * 3), 35, onTick);
onTick(0);
}
private function onTick(_arg1:uint):void{
debug.graphics.clear();
timeService.update(_arg1);
rend.x = player.x;
rend.y = player.y;
rend.z = player.eyeZ;
rend.rot = player.rot;
var _local2:uint = rend.render(timeService.getTime(35));
fps.setScriptTime(_local2);
}
}
}//package com.brokenfunction.doom
Section 38
//DoomRender (com.brokenfunction.doom.DoomRender)
package com.brokenfunction.doom {
import flash.display.*;
import flash.utils.*;
import com.brokenfunction.doom.data.*;
public class DoomRender {
private var cmaps:Array;
private var palette:PlayPalette;
private var minFieldOfView:uint;
private var _bitmapData:BitmapData;
private var _rot:uint;// = 0
private var sky:Image;
private var _displayObject:Bitmap;
private var maxFieldOfView:uint;
private var thingCache:Dictionary;
private var vertexCache:Dictionary;
private var _height:uint;
private var _width:uint;
private var hrayAngleCache:Array;
private var staticThings:Array;
private var palettes:Array;
private var mainNode:Node;
private var vrayCache:Array;
private var _midX:int;
private var _midY:int;
private var cols:Array;
private var _x:int;// = 0
private var _y:int;// = 0
private var _z:int;// = 0
private var _debugGraphics:Graphics;
private static const EYE_DISTANCE:uint = 160;
private static const BASE_HEIGHT:uint = 200;
public static const SKY_FLAT:Flat = Flat.SKY_FLAT;
private static const BASE_WIDTH:uint = 320;
private static const BLANK_INDEX:uint = 0xFF001F;
public function DoomRender(){
staticThings = [];
_displayObject = new Bitmap();
super();
setSize(BASE_WIDTH, BASE_HEIGHT);
}
public function get y():int{
return (_y);
}
public function get debugGraphics():Graphics{
return (_debugGraphics);
}
public function get z():int{
return (_z);
}
private function setSize(_arg1:uint, _arg2:uint):void{
var _local4:VRayStatus;
_width = _arg1;
_height = _arg2;
_midX = (_arg1 / 2);
_midY = (_arg2 / 2);
var _local3:int = _width;
hrayAngleCache = new Array(_local3);
cols = new Array(_local3);
while (_local3-- > 0) {
cols[_local3] = new ColumnStatus();
hrayAngleCache[_local3] = ((Math.atan2((_midX - _local3), EYE_DISTANCE) * (0x8000 / Math.PI)) & 0xFFFF);
};
_local3 = _height;
vrayCache = new Array(_local3);
while (_local3-- > 0) {
_local4 = (vrayCache[_local3] = new VRayStatus());
_local4.raytan = ((_midY - _local3) / EYE_DISTANCE);
};
minFieldOfView = ((Math.atan2(_midX, EYE_DISTANCE) * (0x8000 / Math.PI)) & 0xFFFF);
maxFieldOfView = ((Math.atan2(-(_midX), EYE_DISTANCE) * (0x8000 / Math.PI)) & 0xFFFF);
_bitmapData = new BitmapData(_width, _height, false, 4294902015);
_displayObject.bitmapData = _bitmapData;
}
public function set debugGraphics(_arg1:Graphics):void{
_debugGraphics = _arg1;
}
private function drawThing(_arg1:Thing, _arg2:int, _arg3:uint):void{
_debugGraphics.lineStyle(0, _arg3);
_debugGraphics.drawCircle(((_arg1.x - _x) / 16), (-((_arg1.y - _y)) / 16), (_arg2 / 32));
}
public function set y(_arg1:int):void{
_y = _arg1;
}
public function render(_arg1:uint):int{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:int;
var _local12:Number;
var _local13:uint;
var _local14:int;
var _local15:int;
var _local16:int;
var _local17:int;
var _local18:int;
var _local19:uint;
var _local20:uint;
var _local21:uint;
var _local22:Number;
var _local23:int;
var _local24:int;
var _local25:int;
var _local26:int;
var _local27:int;
var _local28:int;
var _local29:uint;
var _local30:SSector;
var _local32:Seg;
var _local33:Thing;
var _local34:ThingStatus;
var _local35:Linedef;
var _local36:Sidedef;
var _local37:Sidedef;
var _local38:Sector;
var _local39:ColumnStatus;
var _local40:ByteArray;
var _local41:Vertex;
var _local42:VertexStatus;
var _local43:int;
var _local44:int;
var _local45:VRayStatus;
var _local46:Flat;
var _local47:Flat;
var _local48:Texture;
var _local49:Texture;
var _local50:Texture;
var _local51:Image;
var _local31:Array = [];
var _local52:Dictionary = new Dictionary(true);
var _local53:int = _midX;
var _local54:int = _midY;
var _local55:BitmapData = _bitmapData;
var _local56:Array = Data.sintable;
var _local57:Array = Data.costable;
var _local58:Array = Data.tantable;
var _local59:Number = _local56[(-(_rot) & 0xFFFF)];
var _local60:Number = _local57[_rot];
if (_debugGraphics){
_debugGraphics.lineStyle(0, 0xFFFFFF);
_debugGraphics.moveTo(0, 0);
_debugGraphics.lineTo((100 * _local57[((minFieldOfView + _rot) & 0xFFFF)]), (-100 * _local56[((minFieldOfView + _rot) & 0xFFFF)]));
_debugGraphics.moveTo(0, 0);
_debugGraphics.lineTo((100 * _local57[((maxFieldOfView + _rot) & 0xFFFF)]), (-100 * _local56[((maxFieldOfView + _rot) & 0xFFFF)]));
};
_local55.lock();
_local55.fillRect(_local55.rect, (4278190080 | BLANK_INDEX));
var _local61:int = _width;
var _local62:Array = [];
findSSectors(_local62, mainNode);
_local2 = _width;
while (_local2-- > 0) {
_local39 = cols[_local2];
_local39.min = 0;
_local39.max = (_local39.rows = _height);
};
var _local63:int = getTimer();
_local2 = _local62.length;
while ((((_local2-- > 0)) && ((_local61 > 0)))) {
_local30 = _local62[_local2];
_local38 = _local30.sector;
_local3 = _local30.things.length;
var _temp1 = _local3;
_local3 = (_local3 - 1);
if (_temp1 > 0){
do {
_local33 = _local30.things[_local3];
_local34 = ((thingCache[_local33]) || ((thingCache[_local33] = new ThingStatus(_local33))));
_local34.dist = (((_local60 * (_local33.x - _x)) - (_local59 * (_local33.y - _y))) / EYE_DISTANCE);
if (_local34.dist > 0){
_local31.push(_local34);
};
var _temp2 = _local3;
_local3 = (_local3 - 1);
} while (_temp2 > 0);
_local31.sortOn("dist", (Array.NUMERIC | Array.DESCENDING));
_local3 = _local31.length;
while (_local3-- > 0) {
_local34 = _local31.pop();
_local33 = _local34.thing;
_local12 = _local34.dist;
_local5 = (Math.atan2((_local33.y - _y), (_local33.x - _x)) * (0x8000 / Math.PI));
_local51 = _local33.getRelativeImage((_local5 & 0xFFFF), _arg1);
_local5 = (_local53 - int((_local58[((_local5 - _rot) & 0xFFFF)] * EYE_DISTANCE)));
_local23 = (_local5 - int((_local51.offX / _local12)));
_local17 = _local23;
_local24 = ((_local17 + int((_local51.width / _local12))) + 1);
if ((((_local24 < 0)) || ((_local23 >= _width)))){
if (_debugGraphics){
drawThing(_local33, _local51.width, 0xFF);
};
} else {
_local25 = (_local54 - int((((_local33.z - _z) + _local51.offY) / _local12)));
_local18 = _local25;
_local26 = ((_local18 + int((_local51.height / _local12))) + 1);
if (_debugGraphics){
drawThing(_local33, _local51.width, 16755370);
};
if (_local23 < 0){
_local23 = 0;
};
if (_local24 > _width){
_local24 = _width;
};
if (_local25 < 0){
_local25 = 0;
};
if (_local26 > _height){
_local26 = _height;
};
if ((((_local23 < _local24)) && ((_local25 < _local26)))){
_local4 = _local33.lightLevel;
_local4 = (_local4 / (1 + ((_local12 - 1) * ((0xFF - _local4) / 0xFF))));
_local4 = ((_local4)>0xFF) ? 0 : (0xFF - _local4);
_local40 = cmaps[(_local4 >>> 3)];
do {
_local39 = cols[_local23];
if (_local39.rows <= 0){
} else {
_local14 = _local25;
if (_local14 < _local39.min){
_local14 = _local39.min;
};
_local15 = _local26;
if (_local15 > _local39.max){
_local15 = _local39.max;
};
_local6 = ((_local23 - _local17) * _local12);
do {
if (_local55.getPixel(_local23, _local14) === BLANK_INDEX){
_local4 = _local51.getPixel32(_local6, ((_local14 - _local18) * _local12));
if (_local4 !== 0){
_local55.setPixel(_local23, _local14, _local40[(_local4 & 0xFF)]);
_local39.rows--;
};
};
++_local14;
} while (_local14 < _local15);
if (_local39.rows <= 0){
_local61--;
};
};
++_local23;
} while (_local23 < _local24);
};
};
};
};
_local29 = _local38.lightLevel;
_local3 = _local30.length;
while (_local3-- > 0) {
_local32 = _local30[_local3];
_local35 = _local32.linedef;
_local21 = ((_local32.angle - _rot) & 0xFFFF);
if ((((_local21 > minFieldOfView)) && ((_local21 < (maxFieldOfView - 0x8000))))){
} else {
_local41 = _local32.start;
if ((_local41 in _local52)){
_local42 = _local52[_local41];
_local19 = _local42.ang;
_local22 = _local42.dist;
_local23 = _local42.x;
} else {
_local42 = (_local52[_local41] = vertexCache[_local41]);
_local5 = (_local41.y - _y);
_local4 = (_local41.x - _x);
_local19 = (_local42.ang = ((int((Math.atan2(_local5, _local4) * (0x8000 / Math.PI))) - _rot) & 0xFFFF));
_local22 = (_local42.dist = Math.sqrt(((_local4 * _local4) + (_local5 * _local5))));
if (_local19 > 0xC000){
_local23 = (_local53 - int(((_local58[_local19] * EYE_DISTANCE) - 1)));
_local42.x = _local23;
} else {
if (_local19 < 0x4000){
_local23 = (_local53 - int((_local58[_local19] * EYE_DISTANCE)));
_local42.x = _local23;
};
};
};
_local41 = _local32.end;
if ((_local41 in _local52)){
_local42 = _local52[_local41];
_local20 = _local42.ang;
_local7 = _local42.dist;
_local24 = _local42.x;
} else {
_local42 = (_local52[_local41] = vertexCache[_local41]);
_local5 = (_local41.y - _y);
_local4 = (_local41.x - _x);
_local20 = (_local42.ang = ((int((Math.atan2(_local5, _local4) * (0x8000 / Math.PI))) - _rot) & 0xFFFF));
_local7 = (_local42.dist = Math.sqrt(((_local4 * _local4) + (_local5 * _local5))));
if (_local20 > 0xC000){
_local24 = (_local53 - int(((_local58[_local20] * EYE_DISTANCE) - 1)));
_local42.x = _local24;
} else {
if (_local20 < 0x4000){
_local24 = (_local53 - int((_local58[_local20] * EYE_DISTANCE)));
_local42.x = _local24;
};
};
};
if (((_local20 - _local19) & 0x8000) === 0){
} else {
if ((((_local19 >= 0x4000)) && ((_local19 <= 0xC000)))){
if ((((_local20 >= 0x4000)) && ((_local20 <= 0xC000)))){
if (_debugGraphics){
drawSeg(_local32, 0xAA00FF);
};
continue;
};
if (_local24 < 0){
if (_debugGraphics){
drawSeg(_local32, 43775);
};
continue;
};
_local23 = 0;
} else {
if ((((_local20 >= 0x4000)) && ((_local20 <= 0xC000)))){
if (_local23 >= _width){
if (_debugGraphics){
drawSeg(_local32, 43775);
};
continue;
};
_local24 = _width;
} else {
if ((((_local24 < 0)) || ((_local23 >= _width)))){
if (_debugGraphics){
drawSeg(_local32, 0xFF);
};
continue;
};
};
};
if (_local22 > _local7){
_local7 = _local22;
};
_local21 = (((_local21 - 0x8000) - _local19) & 0xFFFF);
_local35 = _local32.linedef;
_local36 = _local32.rightSide;
_local46 = _local38.ceilFlat.current;
_local47 = _local38.floorFlat.current;
_local48 = _local36.upperTexture;
_local49 = _local36.middleTexture;
_local50 = _local36.lowerTexture;
if (_local48){
_local48 = _local48.current;
};
if (_local49){
_local49 = _local49.current;
};
if (_local50){
_local50 = _local50.current;
};
if (_local35.isTwoSided){
_local37 = _local32.leftSide;
if ((((_local46 === SKY_FLAT)) && ((_local37.sector.ceilFlat === SKY_FLAT)))){
_local25 = (_z - _local38.ceil);
_local27 = (_z - _local37.sector.ceil);
if (_local25 < _local27){
_local27 = _local25;
} else {
_local25 = _local27;
};
} else {
_local25 = (_z - _local38.ceil);
_local27 = (_z - _local37.sector.ceil);
if (_local27 < _local25){
_local27 = _local25;
};
};
_local28 = (_z - _local37.sector.floor);
_local26 = (_z - _local38.floor);
if (_local28 > _local26){
_local28 = _local26;
};
} else {
_local37 = _local36;
_local27 = (_z - _local38.ceil);
_local25 = _local27;
_local28 = (_z - _local38.floor);
_local26 = _local28;
};
if (_debugGraphics){
drawSeg(_local32, (_local35.isTwoSided) ? 16764108 : 0xFFFFFF);
};
_local43 = (_local54 + int((_local25 / _local7)));
_local44 = (_local54 + int((_local26 / _local7)));
if (_local43 < 0){
_local43 = 0;
} else {
if (_local43 > _local54){
_local43 = _local54;
};
};
if (_local44 > _height){
_local44 = _height;
} else {
if (_local44 < _local54){
_local44 = _local54;
};
};
if (_local23 < 0){
_local23 = 0;
};
if (_local24 > _width){
_local24 = _width;
};
_local23--;
while (++_local23 < _local24) {
_local39 = cols[_local23];
if (_local39.rows <= 0){
} else {
_local13 = hrayAngleCache[_local23];
_local7 = _local56[((_local21 + (_local19 - _local13)) & 0xFFFF)];
_local12 = (((_local22 * _local56[_local21]) * _local57[_local13]) / (EYE_DISTANCE * _local7));
if (_local12 <= 0){
} else {
_local16 = ((_local22 * _local56[((_local19 - _local13) & 0xFFFF)]) / _local7);
_local16 = (_local16 + (_local36.offX + _local32.linedefOffset));
_local14 = _local39.min;
_local15 = (_local54 + int((_local25 / _local12)));
if (_local15 > _local39.max){
_local15 = _local39.max;
};
if (_local14 < _local15){
if (_local46 === SKY_FLAT){
_local4 = ((_local23 - (_rot >>> 5)) & 0xFF);
_local40 = cmaps[0];
do {
if (_local55.getPixel(_local23, _local14) === BLANK_INDEX){
_local55.setPixel(_local23, _local14, _local40[(sky.getPixel(_local4, (_local14 & 127)) & 0xFF)]);
_local39.rows--;
};
++_local14;
} while (_local14 < _local15);
} else {
if (_local15 <= _local54){
_local4 = ((_local13 + _rot) & 0xFFFF);
_local7 = (_local25 / _local57[_local13]);
_local9 = _local56[_local4];
_local10 = _local57[_local4];
while (_local14 < _local43) {
--_local43;
_local45 = vrayCache[_local43];
_local8 = (-(_local25) / (_local45.raytan * EYE_DISTANCE));
_local4 = ((_local29)<184) ? (_local29 / (1 + ((_local8 - 1) * ((184 - _local29) / 184)))) : _local29;
_local4 = ((_local4)>0xFF) ? 0 : (0xFF - _local4);
_local45.cmap = cmaps[(_local4 >>> 3)];
};
do {
if (_local55.getPixel(_local23, _local14) === BLANK_INDEX){
_local45 = vrayCache[_local14];
_local8 = (_local7 / _local45.raytan);
_local4 = _local45.cmap[_local46[(((((_local8 * _local9) - _y) & 63) << 6) | ((_x - (_local8 * _local10)) & 63))]];
_local55.setPixel(_local23, _local14, _local4);
_local39.rows--;
};
++_local14;
} while (_local14 < _local15);
} else {
_local14 = _local15;
};
};
};
_local39.min = _local14;
_local4 = ((_local29)<184) ? (_local29 / (1 + ((_local12 - 1) * ((184 - _local29) / 184)))) : _local29;
_local4 = ((_local4)>0xFF) ? 0 : (0xFF - _local4);
_local40 = cmaps[(_local4 >>> 3)];
_local15 = (_local54 + int((((_local28)<_local27) ? _local28 : _local27 / _local12)));
if (_local15 > _local39.max){
_local15 = _local39.max;
};
if (_local39.min < _local15){
_local39.min = _local15;
};
if (_local14 < _local15){
if (_local48){
_local18 = (_local36.offY - (_local35.unpeggedUpper) ? _local25 : _local27);
_local5 = (_local16 % _local48.width);
_local6 = (_local14 - _local54);
do {
if (_local55.getPixel(_local23, _local14) === BLANK_INDEX){
_local4 = ((_local6)>0) ? ((_local6 + 1) * _local12) : ((_local6)<0) ? ((_local6 * _local12) - 1) : (_local6 * _local12);
_local4 = ((_local18 + _local4) % _local48.height);
_local4 = _local48.getPixel32(_local5, ((_local4)<0) ? (_local4 + _local48.height) : _local4);
if (_local4 !== 0){
_local55.setPixel(_local23, _local14, _local40[(_local4 & 0xFF)]);
_local39.rows--;
};
};
_local6++;
++_local14;
} while (_local14 < _local15);
} else {
_local14 = _local15;
};
};
_local15 = (_local54 + int((_local28 / _local12)));
if (_local15 > _local39.max){
_local15 = _local39.max;
};
if (_local14 < _local15){
if (_local49){
_local18 = (_local36.offY - (_local35.unpeggedLower) ? _local28 : _local27);
_local5 = (_local16 % _local49.width);
_local6 = (_local14 - _local54);
do {
if (_local55.getPixel(_local23, _local14) === BLANK_INDEX){
_local4 = ((_local6)>0) ? ((_local6 + 1) * _local12) : ((_local6)<0) ? ((_local6 * _local12) - 1) : (_local6 * _local12);
_local4 = ((_local18 + _local4) % _local49.height);
_local4 = _local49.getPixel32(_local5, ((_local4)<0) ? (_local4 + _local49.height) : _local4);
if (_local4 !== 0){
_local55.setPixel(_local23, _local14, _local40[(_local4 & 0xFF)]);
_local39.rows--;
};
};
_local6++;
++_local14;
} while (_local14 < _local15);
} else {
_local14 = _local15;
};
};
_local15 = (_local54 + int((_local26 / _local12)));
if (_local15 > _local39.max){
_local15 = _local39.max;
};
_local11 = ((_local39.max)>_local14) ? _local14 : _local39.max;
if (_local14 < _local15){
if (_local50){
_local18 = (_local36.offY - (_local35.unpeggedLower) ? _local25 : _local28);
_local5 = (_local16 % _local50.width);
_local6 = (_local14 - _local54);
do {
if (_local55.getPixel(_local23, _local14) === BLANK_INDEX){
_local4 = ((_local6)>0) ? ((_local6 + 1) * _local12) : ((_local6)<0) ? ((_local6 * _local12) - 1) : (_local6 * _local12);
_local4 = ((_local18 + _local4) % _local50.height);
_local4 = _local50.getPixel32(_local5, ((_local4)<0) ? (_local4 + _local50.height) : _local4);
if (_local4 !== 0){
_local55.setPixel(_local23, _local14, _local40[(_local4 & 0xFF)]);
_local39.rows--;
};
};
_local6++;
++_local14;
} while (_local14 < _local15);
} else {
_local14 = _local15;
};
};
_local15 = _local39.max;
if (_local14 < _local15){
if (_local47 === SKY_FLAT){
_local4 = ((_local23 - (_rot >>> 5)) & 0xFF);
_local40 = cmaps[0];
do {
--_local15;
if (_local55.getPixel(_local23, _local15) === BLANK_INDEX){
_local55.setPixel(_local23, _local15, _local40[(sky.getPixel(_local4, (_local15 & 127)) & 0xFF)]);
_local39.rows--;
};
} while (_local14 < _local15);
} else {
if (_local14 >= _local54){
_local4 = ((_local13 + _rot) & 0xFFFF);
_local7 = (_local26 / _local57[_local13]);
_local9 = _local56[_local4];
_local10 = _local57[_local4];
while (_local15 > _local44) {
var _temp3 = _local44;
_local44 = (_local44 + 1);
_local45 = vrayCache[_temp3];
_local8 = (-(_local26) / (_local45.raytan * EYE_DISTANCE));
_local4 = ((_local29)<184) ? (_local29 / (1 + ((_local8 - 1) * ((184 - _local29) / 184)))) : _local29;
_local4 = ((_local4)>0xFF) ? 0 : (0xFF - _local4);
_local45.cmap = cmaps[(_local4 >>> 3)];
};
do {
--_local15;
if (_local55.getPixel(_local23, _local15) === BLANK_INDEX){
_local45 = vrayCache[_local15];
_local8 = (_local7 / _local45.raytan);
_local4 = _local45.cmap[_local47[(((((_local8 * _local9) - _y) & 63) << 6) | ((_x - (_local8 * _local10)) & 63))]];
_local55.setPixel(_local23, _local15, _local4);
_local39.rows--;
};
} while (_local14 < _local15);
};
};
};
_local39.max = ((_local15)<_local11) ? _local15 : _local11;
if (_local39.rows <= 0){
_local61--;
};
};
};
};
};
};
};
};
if (_local61 > 0){
trace("missing rows");
};
palette.mapPalette(_local55);
_local55.unlock();
return ((getTimer() - _local63));
}
public function setMap(_arg1:DeWadLevel, _arg2:Image):void{
var _local3:DeWad = _arg1.wad;
mainNode = _arg1.mainNode;
sky = _arg2;
palette = _local3.getPlayPalette(0);
thingCache = new Dictionary(true);
vertexCache = new Dictionary(true);
var _local4 = 32;
cmaps = new Array(_local4);
while (_local4-- > 0) {
cmaps[_local4] = _local3.getColormap(_local4);
};
var _local5:Array = _arg1.vertices;
_local4 = _local5.length;
while (_local4-- > 0) {
vertexCache[_local5[_local4]] = new VertexStatus();
};
}
public function get height():uint{
return (_height);
}
public function get displayObject():DisplayObject{
return (_displayObject);
}
public function set z(_arg1:int):void{
_z = _arg1;
}
public function set rot(_arg1:uint):void{
_rot = (_arg1 & 0xFFFF);
}
private function findSSectors(_arg1:Array, _arg2:Node):void{
var _local3:int = (_arg2.angle - _rot);
if ((_arg2.dx * (_arg2.y - _y)) <= ((_arg2.x - _x) * _arg2.dy)){
if (_arg2.leftStop){
_arg1.unshift(_arg2.leftSSector);
} else {
findSSectors(_arg1, _arg2.leftNode);
};
if ((((((minFieldOfView - _local3) & 0x8000) === 0x8000)) || (((((_local3 - 0x8000) - maxFieldOfView) & 0x8000) === 0x8000)))){
if (_arg2.rightStop){
_arg1.unshift(_arg2.rightSSector);
} else {
findSSectors(_arg1, _arg2.rightNode);
};
};
} else {
if (_arg2.rightStop){
_arg1.unshift(_arg2.rightSSector);
} else {
findSSectors(_arg1, _arg2.rightNode);
};
if ((((((_local3 - minFieldOfView) & 0x8000) === 0x8000)) || ((((maxFieldOfView - (_local3 - 0x8000)) & 0x8000) === 0x8000)))){
if (_arg2.leftStop){
_arg1.unshift(_arg2.leftSSector);
} else {
findSSectors(_arg1, _arg2.leftNode);
};
};
};
}
public function get width():uint{
return (_width);
}
public function get rot():uint{
return (_rot);
}
private function drawSeg(_arg1:Seg, _arg2:uint):void{
_debugGraphics.lineStyle(0, _arg2);
_debugGraphics.moveTo(((_arg1.start.x - _x) / 16), (-((_arg1.start.y - _y)) / 16));
_debugGraphics.lineTo(((_arg1.end.x - _x) / 16), (-((_arg1.end.y - _y)) / 16));
}
public function set x(_arg1:int):void{
_x = _arg1;
}
public function get x():int{
return (_x);
}
}
}//package com.brokenfunction.doom
import com.brokenfunction.doom.data.*;
class VRayStatus {
public var cmap:Colormap;
public var raytan:Number;
private function VRayStatus(){
}
}
class ColumnStatus {
public var min:int;
public var rows:int;
public var max:int;
private function ColumnStatus(){
}
}
class ThingStatus {
public var thing:Thing;
public var dist:Number;
private function ThingStatus(_arg1:Thing){
thing = _arg1;
}
}
class VertexStatus {
public var dist:Number;
public var x:int;
public var ang:uint;
private function VertexStatus(){
}
}
Section 39
//LevelProcessor (com.brokenfunction.doom.LevelProcessor)
package com.brokenfunction.doom {
import flash.utils.*;
import com.brokenfunction.doom.data.*;
import com.brokenfunction.doom.effects.*;
public class LevelProcessor {
public function LevelProcessor(_arg1:DeWadLevel){
var _local2:Array = _arg1.sectors;
var _local3:int = _local2.length;
var _local4:Dictionary = new Dictionary(true);
while (_local3-- > 0) {
processSector(_local2[_local3], _arg1, _local4);
};
}
private function processLinedef(_arg1:Linedef, _arg2:DeWadLevel, _arg3:Dictionary):void{
if (_arg1.isTwoSided){
processSidedef(_arg1.rightSide, true, _arg2, _arg3);
processSidedef(_arg1.leftSide, true, _arg2, _arg3);
} else {
processSidedef(_arg1.rightSide, false, _arg2, _arg3);
};
switch (_arg1.type){
case 48:
new ScrollingWall(_arg1, _arg2.timeService);
break;
};
}
private function processSector(_arg1:Sector, _arg2:DeWadLevel, _arg3:Dictionary):void{
var _local4:Array = _arg1.linedefs;
var _local5:int = _local4.length;
while (_local5-- > 0) {
processLinedef(_local4[_local5], _arg2, _arg3);
};
var _local6:Flat = _arg1.ceilFlat;
if (((_local6.isAnimated) && (!((_local6 in _arg3))))){
new AnimatedFlat(_local6, _arg2.timeService);
_arg3[_local6] = true;
};
_local6 = _arg1.floorFlat;
if (_local6.isAnimated){
new AnimatedFlat(_local6, _arg2.timeService);
_arg3[_local6] = true;
};
switch (_arg1.type){
case 1:
new RandomBlink(_arg1, _arg2.timeService);
break;
case 2:
case 4:
new Blink05(_arg1, _arg2.timeService);
break;
case 3:
new Blink10(_arg1, _arg2.timeService);
break;
case 8:
new Glow(_arg1, _arg2.timeService);
break;
case 10:
break;
case 12:
new Blink05(_arg1, _arg2.timeService);
break;
case 13:
new Blink10(_arg1, _arg2.timeService);
break;
case 14:
break;
};
}
private function randomUint():uint{
return (uint((Math.random() * uint.MAX_VALUE)));
}
private function processSidedef(_arg1:Sidedef, _arg2:Boolean, _arg3:DeWadLevel, _arg4:Dictionary):void{
var _local5:Texture = _arg1.upperTexture;
if (((((_local5) && (_local5.isAnimated))) && (!((_local5 in _arg4))))){
new AnimatedTexture(_local5, _arg3.timeService);
_arg4[_local5] = true;
};
_local5 = _arg1.middleTexture;
if (((((_local5) && (_local5.isAnimated))) && (!((_local5 in _arg4))))){
new AnimatedTexture(_local5, _arg3.timeService);
_arg4[_local5] = true;
};
_local5 = _arg1.lowerTexture;
if (((((_local5) && (_local5.isAnimated))) && (!((_local5 in _arg4))))){
new AnimatedTexture(_local5, _arg3.timeService);
_arg4[_local5] = true;
};
}
}
}//package com.brokenfunction.doom
Section 40
//LumpGroup (com.brokenfunction.doom.LumpGroup)
package com.brokenfunction.doom {
import com.brokenfunction.doom.data.*;
public class LumpGroup {
private var lumps:Object;
private var _name:String;
public function LumpGroup(_arg1:String){
lumps = {};
super();
_name = _arg1;
}
public function getLump(_arg1:String):Lump{
if ((lumps[_arg1] is Lump)){
return ((lumps[_arg1] as Lump));
};
throw (new Error((((("Lump \"" + _arg1) + "\" in \"") + _name) + "\" not found")));
}
public function lumpExists(_arg1:String):Boolean{
return ((lumps[_arg1] is Lump));
}
public function get name():String{
return (_name);
}
public function addLump(_arg1:Lump):void{
if ((lumps[_arg1.name] is Lump)){
trace((((("Lump \"" + _arg1.name) + "\" in \"") + _name) + "\" already encountered, ignoring"));
} else {
lumps[_arg1.name] = _arg1;
};
}
}
}//package com.brokenfunction.doom
Section 41
//MovingThing (com.brokenfunction.doom.MovingThing)
package com.brokenfunction.doom {
import com.brokenfunction.doom.data.*;
import com.brokenfunction.ezlo.*;
public class MovingThing extends Thing {
private var _height:int;
private var speed:int;// = 0
private var _forward:int;
private var mainNode:Node;
private var _rot:int;
private var vZ:int;// = 0
private var sector:Sector;
private var blockmap:Blockmap;
private var _time:uint;
private var _eyeHeight:int;
private var _z:int;// = 0
private var _side:int;
private static const MAX_MOVEMENT:uint = 25;
private static const FRICTION:Number = 0.90625;
public function MovingThing(_arg1:DeWadLevel, _arg2:int, _arg3:int=-1){
_height = _arg2;
_eyeHeight = ((_arg3)<0) ? (_height / 1.4) : _arg3;
mainNode = _arg1.mainNode;
blockmap = _arg1.blockmap;
}
override public function get z():int{
return (_z);
}
public function get eyeZ():int{
var _local1 = (((movX * movX) + (movY * movY)) >> 5);
if (_local1 > 8){
_local1 = 8;
};
_local1 = (_local1 * Data.sintable[(((_time >> 2) * (0x2000 / 2.5)) & 0xFFFF)]);
return (((_z + _eyeHeight) + _local1));
}
public function move(_arg1:int, _arg2:int, _arg3:uint, _arg4:TimeEvent):void{
var _local9:int;
var _local5:uint = _arg4.steps;
_rot = ((_rot + int((_arg3 * _arg4.subSteps))) & 0xFFFF);
while (_local5-- > 0) {
if (vZ >= 0){
_forward = ((_forward + _arg1) * FRICTION);
_side = ((_side + _arg2) * FRICTION);
};
if (_forward > MAX_MOVEMENT){
_forward = MAX_MOVEMENT;
} else {
if (_forward < -(MAX_MOVEMENT)){
_forward = -(MAX_MOVEMENT);
};
};
if (_side > MAX_MOVEMENT){
_side = MAX_MOVEMENT;
} else {
if (_side < -(MAX_MOVEMENT)){
_side = -(MAX_MOVEMENT);
};
};
};
var _local6:Number = Data.sintable[_rot];
var _local7:Number = Data.costable[_rot];
movX = ((_forward * _local7) + (_side * _local6));
movY = ((_forward * _local6) - (_side * _local7));
var _local8:Sector = sector;
if (!sector){
sector = resolveSSector(mainNode).sector;
};
clipMovement(blockmap, 1);
sector = resolveSSector(mainNode).sector;
if (sector){
if ((((vZ < 0)) && (!((_local8 === sector))))){
vZ = 0;
};
_local9 = sector.floor;
if (_local9 !== _z){
if (_local9 < _z){
if (_local9 > (_z = (_z + (vZ = (vZ - 4))))){
_z = _local9;
};
} else {
if (_local9 < (_z = (_z + (vZ = (vZ + 8))))){
_z = _local9;
};
};
} else {
if (vZ){
vZ = 0;
};
};
};
}
override public function get rot():uint{
return (_rot);
}
public function set z(_arg1:int):void{
_z = _arg1;
}
public function set rot(_arg1:uint):void{
_rot = (_arg1 & 0xFFFF);
}
}
}//package com.brokenfunction.doom
Section 42
//Player (com.brokenfunction.doom.Player)
package com.brokenfunction.doom {
import com.brokenfunction.util.*;
import com.brokenfunction.ezlo.*;
public class Player {
private var _input:Input;
private var _thing:MovingThing;
public static const KEY_BACKWARD:uint = (1 << 1);
public static const KEY_FORWARD:uint = (1 << 0);
public static const KEY_LEFT:uint = (1 << 2);
public static const KEY_USE:uint = (1 << 7);
public static const KEY_STRAFE:uint = (1 << 4);
public static const KEY_FIRE:uint = (1 << 5);
public static const KEY_RIGHT:uint = (1 << 3);
public static const KEY_SPEED:uint = (1 << 6);
public function Player(_arg1:MovingThing, _arg2:Input, _arg3:TimeService){
_thing = _arg1;
_input = _arg2;
_arg3.addTimeListener(onTick, 35);
}
private function onTick(_arg1:TimeEvent):void{
var _local2:uint = _input.getInput();
var _local3:int;
var _local4:int;
var _local5:uint;
if ((_local2 & KEY_STRAFE) === KEY_STRAFE){
if ((_local2 & KEY_LEFT) === KEY_LEFT){
_local4 = (_local4 - (((_local2 & KEY_SPEED))===KEY_SPEED) ? 40 : 24);
};
if ((_local2 & KEY_RIGHT) === KEY_RIGHT){
_local4 = (_local4 + (((_local2 & KEY_SPEED))===KEY_SPEED) ? 40 : 24);
};
} else {
if ((_local2 & KEY_LEFT) === KEY_LEFT){
_local5 = (_local5 + (((_local2 & KEY_SPEED))===KEY_SPEED) ? 0x0500 : 640);
};
if ((_local2 & KEY_RIGHT) === KEY_RIGHT){
_local5 = (_local5 - (((_local2 & KEY_SPEED))===KEY_SPEED) ? 0x0500 : 640);
};
};
if ((_local2 & KEY_FORWARD) === KEY_FORWARD){
_local3 = (_local3 + (((_local2 & KEY_SPEED))===KEY_SPEED) ? 50 : 25);
};
if ((_local2 & KEY_BACKWARD) === KEY_BACKWARD){
_local3 = (_local3 - (((_local2 & KEY_SPEED))===KEY_SPEED) ? 50 : 25);
};
_local3 = (_local3 / 8);
_local4 = (_local4 / 8);
_thing.move(_local3, _local4, _local5, _arg1);
}
}
}//package com.brokenfunction.doom
Section 43
//readStr8 (com.brokenfunction.doom.readStr8)
package com.brokenfunction.doom {
import flash.utils.*;
public function readStr8(_arg1:ByteArray):String{
var _local3:uint;
var _local2:uint = 8;
var _local4 = "";
while (_local2-- > 0) {
_local3 = _arg1.readUnsignedByte();
if (_local3){
_local4 = (_local4 + String.fromCharCode(_local3));
} else {
_arg1.position = (_arg1.position + _local2);
break;
};
};
if (_local4.length <= 0){
throw (new Error("Invalid name"));
};
return (_local4);
}
}//package com.brokenfunction.doom
Section 44
//Thing (com.brokenfunction.doom.Thing)
package com.brokenfunction.doom {
import flash.display.*;
import com.brokenfunction.doom.data.*;
public class Thing {
private var _x:int;
private var _y:int;
private var _movX:int;// = 0
private var _movY:int;// = 0
private var _debugGraphics:Graphics;
public function Thing(_arg1:int=0, _arg2:int=0){
_x = _arg1;
_y = _arg2;
}
public function get movX():int{
return (_movX);
}
public function get movY():int{
return (_movY);
}
public function set movY(_arg1:int):void{
_movY = _arg1;
}
public function get lightLevel():uint{
return (0);
}
public function set movX(_arg1:int):void{
_movX = _arg1;
}
public function getRelativeImage(_arg1:uint, _arg2:uint):Image{
throw (new Error("No image available"));
}
public function get rad():uint{
return (0);
}
public function get rot():uint{
return (0);
}
private function drawLine(_arg1:Linedef, _arg2:int, _arg3:int, _arg4:uint):void{
_debugGraphics.lineStyle(0, _arg4);
_debugGraphics.moveTo((_arg1.start.x - _arg2), -((_arg1.start.y - _arg3)));
_debugGraphics.lineTo((_arg1.end.x - _arg2), -((_arg1.end.y - _arg3)));
}
public function intersect(_arg1:Thing):Boolean{
return (false);
}
protected function clipMovement(_arg1:Blockmap, _arg2:int=0):void{
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local10:int;
var _local11:int;
var _local12:uint;
var _local13:int;
var _local14:Number;
var _local15:Number;
var _local16:int;
var _local17:int;
var _local18:int;
var _local19:int;
var _local20:int;
var _local21:int;
var _local22:int;
var _local23:Number;
var _local26:Linedef;
var _local27:Array;
var _local28:int;
var _local29:int;
var _local3:int = _x;
var _local4:int = _y;
_x = (_x + _movX);
_y = (_y + _movY);
if (((_debugGraphics) && ((_arg2 === 2)))){
_debugGraphics.lineStyle(0, 0xFFFFFF);
_debugGraphics.drawCircle(0, 0, 16);
_debugGraphics.moveTo(0, 0);
_debugGraphics.lineTo(_movX, -(_movY));
_debugGraphics.lineStyle(0, 0xFF00FF);
_debugGraphics.drawCircle(_movX, -(_movY), 16);
};
if (((!(_movX)) && (!(_movY)))){
return;
};
if (_movX > 0){
_local5 = (_local3 - 16);
_local7 = ((_movX + _local3) + 16);
} else {
_local5 = ((_movX + _local3) - 16);
_local7 = (_local3 + 16);
};
if (_movY > 0){
_local6 = (_local4 - 16);
_local8 = ((_movY + _local4) + 16);
} else {
_local6 = ((_movY + _local4) - 16);
_local8 = (_local4 + 16);
};
_local5 = ((_local5 - _arg1.offX) >> Blockmap.BLOCK_SHIFT);
_local7 = ((_local7 - _arg1.offX) >> Blockmap.BLOCK_SHIFT);
_local6 = ((_local6 - _arg1.offY) >> Blockmap.BLOCK_SHIFT);
_local8 = ((_local8 - _arg1.offY) >> Blockmap.BLOCK_SHIFT);
if (_local5 < 0){
_local5 = 0;
};
if (_local7 >= _arg1.cols){
_local7 = (_arg1.cols - 1);
};
if (_local6 < 0){
_local6 = 0;
};
if (_local8 >= _arg1.rows){
_local8 = (_arg1.rows - 1);
};
var _local9:Linedef;
var _local24:int = ((_movX * _movX) + (_movY * _movY));
var _local25 = ((Math.atan2(_movY, _movX) * (0x8000 / Math.PI)) & 0xFFFF);
while (_local5 <= _local7) {
_local28 = _local6;
while (_local28 <= _local8) {
_local27 = _arg1.getBlock(_local5, _local28);
_local29 = _local27.length;
while (_local29-- > 0) {
_local26 = _local27[_local29];
if (_local26.isImpassible){
if (((_debugGraphics) && ((_arg2 === 2)))){
drawLine(_local26, _local3, _local4, 0xFF);
};
_local12 = _local26.angle;
_local14 = Data.sintable[_local12];
_local15 = Data.costable[_local12];
_local16 = (_local26.start.x - int((16 * _local15)));
_local17 = (_local26.start.y - int((16 * _local14)));
_local18 = ((_local26.end.x + int((16 * _local15))) - _local16);
_local19 = ((_local26.end.y + int((16 * _local14))) - _local17);
_local13 = (_local26.length + (16 << 1));
if ((_local18 * (_local17 - _local4)) >= ((_local16 - _local3) * _local19)){
if ((((_local25 - _local12) - 1) & 0xFFFF) >= 32767){
continue;
};
_local12 = ((_local12 - 0x4000) & 0xFFFF);
_local16 = (_local16 + int((16 * Data.costable[_local12])));
_local17 = (_local17 + int((16 * Data.sintable[_local12])));
_local23 = ((_local19 * _movX) - (_local18 * _movY));
if (_local23 == 0){
continue;
};
_local23 = (((_movY * (_local16 - _local3)) - ((_local17 - _local4) * _movX)) / _local23);
if ((((_local23 <= 0)) || ((_local23 >= 1)))){
continue;
};
_local20 = ((_local16 + int((_local23 * _local18))) - _local3);
_local21 = ((_local17 + int((_local23 * _local19))) - _local4);
if (((_debugGraphics) && ((_arg2 === 2)))){
_debugGraphics.lineStyle(0, 0xFF00);
_debugGraphics.moveTo(_movX, -(_movY));
_debugGraphics.lineTo(_local20, -(_local21));
};
_local22 = ((_local20 * _local20) + (_local21 * _local21));
if (_local24 > _local22){
if (_arg2 > 0){
_local9 = _local26;
_local23 = ((_local19 * (_y - _local17)) - ((_local16 - _x) * _local18));
_local10 = (_local16 + int(((_local23 * _local15) / _local13)));
_local11 = (_local17 + int(((_local23 * _local14) / _local13)));
};
_movX = _local20;
_movY = _local21;
_local24 = _local22;
};
};
} else {
if (((_debugGraphics) && ((_arg2 === 2)))){
drawLine(_local26, _local3, _local4, 0xFF0000);
};
};
};
_local28++;
};
_local5++;
};
if (_local9){
_movX = (_local10 - (_x = (_movX + _local3)));
_movY = (_local11 - (_y = (_movY + _local4)));
clipMovement(_arg1, (_arg2 - 1));
_movX = (_x - _local3);
_movY = (_y - _local4);
} else {
_x = (_movX + _local3);
_y = (_movY + _local4);
};
}
protected function resolveSSector(_arg1:Node):SSector{
while (_arg1) {
if ((_arg1.dx * (_arg1.y - _y)) <= ((_arg1.x - _x) * _arg1.dy)){
if (_arg1.leftStop){
return (_arg1.leftSSector);
};
_arg1 = _arg1.leftNode;
} else {
if (_arg1.rightStop){
return (_arg1.rightSSector);
};
_arg1 = _arg1.rightNode;
};
};
return (null);
}
public function set x(_arg1:int):void{
_x = _arg1;
}
public function set y(_arg1:int):void{
_y = _arg1;
}
public function get x():int{
return (_x);
}
public function get y():int{
return (_y);
}
public function get z():int{
return (0);
}
public function set debugGraphics(_arg1:Graphics):void{
_debugGraphics = _arg1;
}
public function get debugGraphics():Graphics{
return (_debugGraphics);
}
}
}//package com.brokenfunction.doom
Section 45
//ThingProcessor (com.brokenfunction.doom.ThingProcessor)
package com.brokenfunction.doom {
import com.brokenfunction.doom.data.*;
import com.brokenfunction.doom.things.*;
public class ThingProcessor {
private var _items:uint;// = 0
private var _imps:uint;// = 0
private var _demons:uint;// = 0
private var _painElementals:uint;// = 0
private var _hellKnights:uint;// = 0
private var _unknown:uint;// = 0
private var _player4Start:ThingInfo;
private var _player2Start:ThingInfo;
private var _cacodemons:uint;// = 0
private var _deathmatchStart:Array;
private var _archViles:uint;// = 0
private var _wad:DeWad;
private var _lostSouls:uint;// = 0
private var _enemies:uint;// = 0
private var _mancubi:uint;// = 0
private var _ammo:uint;// = 0
private var _player3Start:ThingInfo;
private var _zombies:uint;// = 0
private var _player1Start:ThingInfo;
private var _revenants:uint;// = 0
private var _bosses:uint;// = 0
private var _barrels:uint;// = 0
public function ThingProcessor(_arg1:DeWadLevel){
var _local3:ThingInfo;
_deathmatchStart = [];
super();
trace("Loading things...");
_wad = _arg1.wad;
var _local2:Array = _arg1.things;
var _local4:int = _local2.length;
while (_local4-- > 0) {
_local3 = (_local2[_local4] as ThingInfo);
if (_local3){
genThing(_arg1, _local3, _local3.x, _local3.y);
};
};
_wad = null;
trace(("\tEnemies: " + _enemies));
trace(("\tItems: " + _items));
trace(("\tZombies: " + _zombies));
trace(("\tImps: " + _imps));
trace(("\tDemons: " + _demons));
trace(("\tLost Souls: " + _lostSouls));
trace(("\tCacodemons: " + _cacodemons));
trace(("\tHell Knights: " + _hellKnights));
trace(("\tPain Elementals: " + _painElementals));
trace(("\tRevenants: " + _revenants));
trace(("\tMancubi: " + _mancubi));
trace(("\tArch Viles: " + _archViles));
trace(("\tBosses: " + _bosses));
trace(("\tBarrels: " + _barrels));
trace(("\tUnknown: " + _unknown));
trace("Loaded");
}
private function img(_arg1:String):Image{
return (_wad.getImage(_arg1));
}
public function genThing(_arg1:DeWadLevel, _arg2:ThingInfo, _arg3:int, _arg4:int):void{
switch (_arg2.type){
case 0xFFFF:
case 0:
break;
case 1:
if (_player1Start){
trace("Player 1 start already encountered, ignoring");
} else {
_player1Start = _arg2;
};
break;
case 2:
if (_player2Start){
trace("Player 2 start already encountered, ignoring");
} else {
_player2Start = _arg2;
};
break;
case 3:
if (_player3Start){
trace("Player 3 start already encountered, ignoring");
} else {
_player3Start = _arg2;
};
break;
case 4:
if (_player4Start){
trace("Player 4 start already encountered, ignoring");
} else {
_player4Start = _arg2;
};
break;
case 11:
_deathmatchStart.push(_arg2);
break;
case 14:
break;
case 3004:
new SimpleThing(_arg1, img("POSSA1"), 20, false, _arg3, _arg4, false, false);
_enemies++;
_zombies++;
break;
case 84:
new SimpleThing(_arg1, img("SSWVA1"), 20, false, _arg3, _arg4, false, false);
_enemies++;
_zombies++;
break;
case 9:
new SimpleThing(_arg1, img("SPOSA1"), 20, false, _arg3, _arg4, false, false);
_enemies++;
_zombies++;
break;
case 65:
new SimpleThing(_arg1, img("CPOSA1"), 20, false, _arg3, _arg4, false, false);
_enemies++;
_zombies++;
break;
case 3001:
new SimpleThing(_arg1, img("TROOA1"), 20, false, _arg3, _arg4, false, false);
_enemies++;
_imps++;
break;
case 3002:
new SimpleThing(_arg1, img("SARGA1"), 20, false, _arg3, _arg4, false, false);
_enemies++;
_demons++;
break;
case 58:
_enemies++;
_demons++;
_unknown++;
break;
case 3006:
new SimpleThing(_arg1, img("SKULA1"), 20, false, _arg3, _arg4, false, false);
_unknown++;
_lostSouls++;
break;
case 3005:
new SimpleThing(_arg1, img("HEADA1"), 20, false, _arg3, _arg4, false, false);
_enemies++;
_cacodemons++;
break;
case 69:
new SimpleThing(_arg1, img("BOS2A1C1"), 20, false, _arg3, _arg4, false, false);
_enemies++;
_hellKnights++;
break;
case 3003:
new SimpleThing(_arg1, img("BOSSA1"), 20, false, _arg3, _arg4, false, false);
_enemies++;
_bosses++;
break;
case 68:
new SimpleThing(_arg1, img("BSPIA1D1"), 20, false, _arg3, _arg4, false, false);
_enemies++;
_bosses++;
break;
case 71:
new SimpleThing(_arg1, img("PAINA1"), 20, false, _arg3, _arg4, false, false);
_enemies++;
_painElementals++;
break;
case 66:
new SimpleThing(_arg1, img("SKELC1F1"), 20, false, _arg3, _arg4, false, false);
_enemies++;
_revenants++;
break;
case 67:
new SimpleThing(_arg1, img("FATTA1"), 20, false, _arg3, _arg4, false, false);
_enemies++;
_mancubi++;
break;
case 64:
new SimpleThing(_arg1, img("VILEB1E1"), 20, false, _arg3, _arg4, false, false);
_enemies++;
_archViles++;
break;
case 7:
new SimpleThing(_arg1, img("SPIDA1D1"), 20, false, _arg3, _arg4, false, false);
_enemies++;
_bosses++;
break;
case 16:
new SimpleThing(_arg1, img("CYBRA1"), 20, false, _arg3, _arg4, false, false);
_enemies++;
_bosses++;
break;
case 88:
new SimpleThing(_arg1, img("BBRNB0"), 16, false, _arg3, _arg4, false, false);
_bosses++;
break;
case 89:
_unknown++;
break;
case 87:
_unknown++;
break;
case 72:
_unknown++;
break;
case 2005:
new SimpleThing(_arg1, img("CSAWA0"), 20, false, _arg3, _arg4, false, false);
break;
case 2001:
new SimpleThing(_arg1, img("SHOTA0"), 20, false, _arg3, _arg4, false, false);
break;
case 82:
new SimpleThing(_arg1, img("SGN2A0"), 20, false, _arg3, _arg4, false, false);
break;
case 2002:
new SimpleThing(_arg1, img("MGUNA0"), 20, false, _arg3, _arg4, false, false);
break;
case 2003:
new SimpleThing(_arg1, img("LAUNA0"), 20, false, _arg3, _arg4, false, false);
break;
case 2004:
new SimpleThing(_arg1, img("PLASA0"), 20, false, _arg3, _arg4, false, false);
break;
case 2006:
new SimpleThing(_arg1, img("BFUGA0"), 20, false, _arg3, _arg4, false, false);
break;
case 2007:
new SimpleThing(_arg1, img("CLIPA0"), 20, false, _arg3, _arg4, false, false);
_ammo++;
break;
case 2008:
new SimpleThing(_arg1, img("SHELA0"), 20, false, _arg3, _arg4, false, false);
_ammo++;
break;
case 2010:
new SimpleThing(_arg1, img("ROCKA0"), 20, false, _arg3, _arg4, false, false);
_ammo++;
break;
case 2047:
new SimpleThing(_arg1, img("CELLA0"), 20, false, _arg3, _arg4, false, false);
_ammo++;
break;
case 0x0800:
new SimpleThing(_arg1, img("AMMOA0"), 20, false, _arg3, _arg4, false, false);
_ammo++;
break;
case 2049:
new SimpleThing(_arg1, img("SBOXA0"), 20, false, _arg3, _arg4, false, false);
_ammo++;
break;
case 2046:
new SimpleThing(_arg1, img("BROKA0"), 20, false, _arg3, _arg4, false, false);
_ammo++;
break;
case 17:
new SimpleThing(_arg1, img("CELPA0"), 20, false, _arg3, _arg4, false, false);
_ammo++;
break;
case 8:
new SimpleThing(_arg1, img("BPAKA0"), 20, false, _arg3, _arg4, false, false);
_ammo++;
break;
case 5:
new SimpleThingAni2(_arg1, img("BKEYA0"), img("BKEYB0"), 20, false, _arg3, _arg4, false, true);
break;
case 40:
new SimpleThingAni2(_arg1, img("BSKUA0"), img("BSKUB0"), 20, false, _arg3, _arg4, false, true);
break;
case 13:
new SimpleThingAni2(_arg1, img("RKEYA0"), img("RKEYB0"), 20, false, _arg3, _arg4, false, true);
break;
case 38:
new SimpleThingAni2(_arg1, img("RSKUA0"), img("RSKUB0"), 20, false, _arg3, _arg4, false, true);
break;
case 6:
new SimpleThingAni2(_arg1, img("YKEYA0"), img("YKEYB0"), 20, false, _arg3, _arg4, false, true);
break;
case 39:
new SimpleThingAni2(_arg1, img("YSKUA0"), img("YSKUB0"), 20, false, _arg3, _arg4, false, true);
break;
case 2014:
new SimpleThingAni4R(_arg1, img("BON1A0"), img("BON1B0"), img("BON1C0"), img("BON1D0"), 20, false, _arg3, _arg4, false, false);
_items++;
break;
case 2015:
new SimpleThingAni4R(_arg1, img("BON2A0"), img("BON2B0"), img("BON2C0"), img("BON2D0"), 20, false, _arg3, _arg4, false, false);
_items++;
break;
case 83:
new SimpleThingAni4(_arg1, img("MEGAA0"), img("MEGAB0"), img("MEGAC0"), img("MEGAD0"), 20, false, _arg3, _arg4, false, false);
_items++;
break;
case 2013:
new SimpleThingAni4R(_arg1, img("SOULA0"), img("SOULB0"), img("SOULC0"), img("SOULD0"), 20, false, _arg3, _arg4, false, false);
_items++;
break;
case 2022:
new SimpleThingAni4(_arg1, img("PINVA0"), img("PINVB0"), img("PINVC0"), img("PINVD0"), 20, false, _arg3, _arg4, false, false);
_items++;
break;
case 2023:
new SimpleThing(_arg1, img("PSTRA0"), 20, false, _arg3, _arg4, false, false);
_items++;
break;
case 2024:
new SimpleThingAni4(_arg1, img("PINSA0"), img("PINSB0"), img("PINSC0"), img("PINSD0"), 20, false, _arg3, _arg4, false, false);
_items++;
break;
case 2026:
new SimpleThingAni4R(_arg1, img("PMAPA0"), img("PMAPB0"), img("PMAPC0"), img("PMAPD0"), 20, false, _arg3, _arg4, false, true);
_items++;
break;
case 2045:
new SimpleThingAni2(_arg1, img("PVISA0"), img("PVISB0"), 20, false, _arg3, _arg4, false, false);
_items++;
break;
case 2011:
new SimpleThing(_arg1, img("STIMA0"), 20, false, _arg3, _arg4, false, false);
break;
case 2012:
new SimpleThing(_arg1, img("MEDIA0"), 20, false, _arg3, _arg4, false, false);
break;
case 2018:
new SimpleThingAni2(_arg1, img("ARM1A0"), img("ARM1B0"), 20, false, _arg3, _arg4, false, false);
break;
case 2019:
new SimpleThingAni2(_arg1, img("ARM2A0"), img("ARM2B0"), 20, false, _arg3, _arg4, false, false);
break;
case 2025:
new SimpleThing(_arg1, img("SUITA0"), 20, false, _arg3, _arg4, false, false);
break;
case 48:
new SimpleThing(_arg1, img("ELECA0"), 30, true, _arg3, _arg4, false, false);
break;
case 30:
new SimpleThing(_arg1, img("COL1A0"), 16, true, _arg3, _arg4, false, false);
break;
case 32:
new SimpleThing(_arg1, img("COL3A0"), 16, true, _arg3, _arg4, false, false);
break;
case 31:
new SimpleThing(_arg1, img("COL2A0"), 16, true, _arg3, _arg4, false, false);
break;
case 36:
new SimpleThingAni2(_arg1, img("COL4A0"), img("COL4B0"), 16, true, _arg3, _arg4, false, false);
break;
case 33:
new SimpleThing(_arg1, img("COL4A0"), 16, true, _arg3, _arg4, false, false);
break;
case 37:
new SimpleThing(_arg1, img("COL6A0"), 16, true, _arg3, _arg4, false, false);
break;
case 47:
new SimpleThing(_arg1, img("SMITA0"), 16, true, _arg3, _arg4, false, false);
break;
case 43:
new SimpleThing(_arg1, img("TRE1A0"), 32, true, _arg3, _arg4, false, false);
break;
case 54:
new SimpleThing(_arg1, img("TRE2A0"), 16, true, _arg3, _arg4, false, false);
break;
case 2028:
new SimpleThing(_arg1, img("COLUA0"), 16, true, _arg3, _arg4, false, true);
break;
case 85:
new SimpleThingAni4(_arg1, img("TLMPA0"), img("TLMPB0"), img("TLMPC0"), img("TLMPD0"), 16, true, _arg3, _arg4, false, true);
break;
case 86:
new SimpleThingAni4(_arg1, img("TLP2A0"), img("TLP2B0"), img("TLP2C0"), img("TLP2D0"), 16, true, _arg3, _arg4, false, true);
break;
case 35:
new SimpleThing(_arg1, img("CBRAA0"), 16, true, _arg3, _arg4, false, true);
break;
case 44:
new SimpleThingAni4(_arg1, img("TBLUA0"), img("TBLUB0"), img("TBLUC0"), img("TBLUD0"), 16, true, _arg3, _arg4, false, false);
break;
case 45:
new SimpleThingAni4(_arg1, img("TGRNA0"), img("TGRNB0"), img("TGRNC0"), img("TGRND0"), 16, true, _arg3, _arg4, false, false);
break;
case 46:
new SimpleThingAni4(_arg1, img("TREDA0"), img("TREDB0"), img("TREDC0"), img("TREDD0"), 16, true, _arg3, _arg4, false, false);
break;
case 55:
new SimpleThingAni4(_arg1, img("SMBTA0"), img("SMBTB0"), img("SMBTC0"), img("SMBTD0"), 16, true, _arg3, _arg4, false, false);
break;
case 56:
new SimpleThingAni4(_arg1, img("SMGTA0"), img("SMGTB0"), img("SMGTC0"), img("SMGTD0"), 16, true, _arg3, _arg4, false, false);
break;
case 57:
new SimpleThingAni4(_arg1, img("SMRTA0"), img("SMRTB0"), img("SMRTC0"), img("SMRTD0"), 16, true, _arg3, _arg4, false, false);
break;
case 70:
new SimpleThingAni3(_arg1, img("FCANA0"), img("FCANB0"), img("FCANC0"), 10, true, _arg3, _arg4, false, false);
break;
case 41:
new SimpleThingAni4(_arg1, img("CEYEA0"), img("CEYEB0"), img("CEYEC0"), img("CEYEB0"), 16, true, _arg3, _arg4, false, false);
break;
case 42:
new SimpleThingAni4(_arg1, img("CEYEA0"), img("CEYEB0"), img("CEYEC0"), img("CEYEB0"), 16, true, _arg3, _arg4, false, false);
break;
case 2035:
new Barrel(_arg1, img("BAR1A0"), img("BAR1B0"), 10, true, _arg3, _arg4);
_barrels++;
break;
case 49:
new SimpleThingAni4(_arg1, img("GOR1A0"), img("GOR1B0"), img("GOR1C0"), img("GOR1B0"), 16, true, _arg3, _arg4, false, false);
break;
case 50:
new SimpleThing(_arg1, img("GOR2A0"), 16, true, _arg3, _arg4, true, false);
break;
case 52:
new SimpleThing(_arg1, img("GOR4A0"), 16, true, _arg3, _arg4, true, false);
break;
case 51:
new SimpleThing(_arg1, img("GOR3A0"), 16, true, _arg3, _arg4, true, false);
break;
case 53:
new SimpleThing(_arg1, img("GOR5A0"), 16, true, _arg3, _arg4, true, false);
break;
case 73:
new SimpleThing(_arg1, img("HDB1A0"), 16, true, _arg3, _arg4, true, false);
break;
case 74:
new SimpleThing(_arg1, img("HDB2A0"), 16, true, _arg3, _arg4, true, false);
break;
case 75:
new SimpleThing(_arg1, img("HDB3A0"), 16, true, _arg3, _arg4, true, false);
break;
case 76:
new SimpleThing(_arg1, img("HDB4A0"), 16, true, _arg3, _arg4, true, false);
break;
case 77:
new SimpleThing(_arg1, img("HDB5A0"), 16, true, _arg3, _arg4, true, false);
break;
case 78:
new SimpleThing(_arg1, img("HDB6A0"), 16, true, _arg3, _arg4, true, false);
break;
case 25:
new SimpleThing(_arg1, img("POL1A0"), 16, true, _arg3, _arg4, false, false);
break;
case 26:
new SimpleThingAni2(_arg1, img("POL6A0"), img("POL6B0"), 16, true, _arg3, _arg4, false, false);
break;
case 27:
new SimpleThing(_arg1, img("POL4A0"), 16, true, _arg3, _arg4, false, false);
break;
case 28:
new SimpleThing(_arg1, img("POL2A0"), 16, true, _arg3, _arg4, false, false);
break;
case 29:
new SimpleThingAni2(_arg1, img("POL3A0"), img("POL3B0"), 16, true, _arg3, _arg4, false, false);
break;
case 34:
new SimpleThing(_arg1, img("CANDA0"), 16, true, _arg3, _arg4, false, false);
break;
case 63:
new SimpleThingAni4(_arg1, img("GOR1A0"), img("GOR1B0"), img("GOR1C0"), img("GOR1B0"), 16, false, _arg3, _arg4, true, false);
break;
case 59:
new SimpleThing(_arg1, img("GOR2A0"), 16, false, _arg3, _arg4, true, false);
break;
case 60:
new SimpleThing(_arg1, img("GOR4A0"), 16, false, _arg3, _arg4, true, false);
break;
case 61:
new SimpleThing(_arg1, img("GOR3A0"), 16, false, _arg3, _arg4, true, false);
break;
case 62:
new SimpleThing(_arg1, img("GOR5A0"), 16, false, _arg3, _arg4, true, false);
break;
case 10:
case 12:
new SimpleThing(_arg1, img("PLAYW0"), 16, false, _arg3, _arg4, false, false);
break;
case 24:
new SimpleThing(_arg1, img("POL5A0"), 16, false, _arg3, _arg4, false, false);
break;
case 79:
new SimpleThing(_arg1, img("POB1A0"), 16, false, _arg3, _arg4, false, false);
break;
case 80:
new SimpleThing(_arg1, img("POB2A0"), 16, false, _arg3, _arg4, false, false);
break;
case 81:
new SimpleThing(_arg1, img("BRS1A0"), 16, false, _arg3, _arg4, false, false);
break;
case 15:
new SimpleThing(_arg1, img("PLAYN0"), 16, false, _arg3, _arg4, false, false);
break;
case 18:
new SimpleThing(_arg1, img("POSSL0"), 20, false, _arg3, _arg4, false, false);
break;
case 19:
new SimpleThing(_arg1, img("SPOSL0"), 20, false, _arg3, _arg4, false, false);
break;
case 20:
new SimpleThing(_arg1, img("TROOM0"), 20, false, _arg3, _arg4, false, false);
break;
case 21:
new SimpleThing(_arg1, img("SARGN0"), 30, false, _arg3, _arg4, false, false);
break;
case 22:
new SimpleThing(_arg1, img("HEADL0"), 31, false, _arg3, _arg4, false, false);
break;
case 23:
_unknown++;
break;
default:
_unknown++;
trace((("Unknown thing type (0x" + _arg2.type.toString(16)) + ")"));
break;
};
}
public function get player3Start():ThingInfo{
return (_player3Start);
}
public function get player1Start():ThingInfo{
return (_player1Start);
}
public function get player4Start():ThingInfo{
return (_player4Start);
}
public function get player2Start():ThingInfo{
return (_player2Start);
}
}
}//package com.brokenfunction.doom
Section 46
//ConstantTimeService (com.brokenfunction.ezlo.time.ConstantTimeService)
package com.brokenfunction.ezlo.time {
import com.brokenfunction.ezlo.*;
import flash.events.*;
public class ConstantTimeService implements TimeService {
private var time:uint;// = 0
private var dispatch:EventDispatcher;
private var backtrace:Object;
private static const TICK_PREFIX:String = "_tk";
private static const BASE_PREFIX:String = (TICK_PREFIX + "1000");
public function ConstantTimeService(_arg1:IEventDispatcher=null){
backtrace = {};
super();
dispatch = new EventDispatcher(_arg1);
}
public function addTimeListener(_arg1:Function, _arg2:uint=1000, _arg3:int=0, _arg4:Boolean=false):void{
if (_arg2 === 0){
throw (new Error("Cannot split 0"));
};
createFpsEntry(_arg2);
dispatch.addEventListener((TICK_PREFIX + _arg2), _arg1, false, _arg3, _arg4);
}
public function getTime(_arg1:uint):uint{
return (createFpsEntry(_arg1).time);
}
public function removeTimeListener(_arg1:Function, _arg2:uint=1000):void{
var _local3:String = (TICK_PREFIX + _arg2);
dispatch.removeEventListener(_local3, _arg1);
if (((!(dispatch.hasEventListener(_local3))) && ((_arg2 in backtrace)))){
dispatch.removeEventListener(BASE_PREFIX, (backtrace[_arg2] as FpsEntry).onTick);
};
}
private function createFpsEntry(_arg1:uint):FpsEntry{
var _local2:FpsEntry;
if ((_arg1 in backtrace)){
return (backtrace[_arg1]);
};
_local2 = new FpsEntry(_arg1, (TICK_PREFIX + _arg1));
backtrace[_arg1] = _local2;
dispatch.addEventListener(BASE_PREFIX, _local2.onTick);
return (_local2);
}
public function restore():void{
throw (new Error("ConstantTimeService cannot be unpaused"));
}
public function update(_arg1:uint):void{
dispatch.dispatchEvent(new TimeEvent(BASE_PREFIX, _arg1, (time = (time + _arg1)), _arg1, true));
}
public function pause():TimeService{
throw (new Error("ConstantTimeService cannot be paused"));
}
private static function nullFunc():void{
}
}
}//package com.brokenfunction.ezlo.time
import com.brokenfunction.ezlo.*;
import flash.events.*;
class FpsEntry {
private var _remainder:uint;// = 0
private var _time:uint;// = 0
private var _subTime:uint;// = 0
private var _type:String;
private var _split:uint;
private function FpsEntry(_arg1:uint, _arg2:String){
_split = _arg1;
_type = _arg2;
}
public function onTick(_arg1:TimeEvent):void{
var _local2:uint = (_arg1.steps * _split);
var _local3:Number = (_local2 / 1000);
_local2 = (_local2 + _remainder);
_local2 = ((_local2 - (_remainder = (_local2 % 1000))) / 1000);
if ((_arg1.currentTarget as IEventDispatcher).dispatchEvent(new TimeEvent(_type, _local2, (_time = (_time + _local2)), _local3, _arg1.cancelable))){
_arg1.preventDefault();
};
}
public function get time():uint{
return (_time);
}
}
Section 47
//LazyTimeService (com.brokenfunction.ezlo.time.LazyTimeService)
package com.brokenfunction.ezlo.time {
import com.brokenfunction.ezlo.*;
public class LazyTimeService extends ConstantTimeService {
private var _onRestore:Function;
private var pausd:LazyTimeService;
private var _onPause:Function;
public function LazyTimeService(_arg1:Function=null, _arg2:Function=null){
_onPause = _arg1;
_onRestore = _arg2;
}
override public function pause():TimeService{
if (!pausd){
pausd = new LazyTimeService();
if (_onPause != null){
_onPause(pausd);
};
};
return (pausd);
}
override public function update(_arg1:uint):void{
if (pausd){
super.update(0);
pausd.update(_arg1);
} else {
super.update(_arg1);
};
}
override public function restore():void{
if (pausd){
pausd = null;
if (_onRestore != null){
_onRestore(this);
};
};
}
}
}//package com.brokenfunction.ezlo.time
Section 48
//TimeEvent (com.brokenfunction.ezlo.TimeEvent)
package com.brokenfunction.ezlo {
import flash.events.*;
public class TimeEvent extends Event {
private var _subSteps:Number;
private var _steps:uint;
private var _time:uint;
public function TimeEvent(_arg1:String, _arg2:uint, _arg3:uint, _arg4:uint, _arg5:Boolean=false){
super(_arg1, false, _arg5);
_steps = _arg2;
_time = _arg3;
_subSteps = _arg4;
}
public function get steps():uint{
return (_steps);
}
public function get time():uint{
return (_time);
}
public function get subSteps():uint{
return (_subSteps);
}
override public function toString():String{
return ((((((((((("[TimeEvent type=" + type) + " steps=") + steps) + " time=") + time) + " subSteps=") + subSteps) + " cancelable=") + cancelable) + "]"));
}
override public function clone():Event{
return (new TimeEvent(type, steps, time, subSteps, cancelable));
}
}
}//package com.brokenfunction.ezlo
Section 49
//TimeService (com.brokenfunction.ezlo.TimeService)
package com.brokenfunction.ezlo {
public interface TimeService {
function addTimeListener(_arg1:Function, _arg2:uint=1000, _arg3:int=0, _arg4:Boolean=false):void;
function getTime(_arg1:uint):uint;
function removeTimeListener(_arg1:Function, _arg2:uint=1000):void;
function pause():TimeService;
function restore():void;
}
}//package com.brokenfunction.ezlo
Section 50
//AudioSynth (com.brokenfunction.util.AudioSynth)
package com.brokenfunction.util {
import flash.utils.*;
public class AudioSynth extends ByteArray {
private const posSwfSize:uint = 4;
private var posAudioSize:uint;
private var _depth:uint;
private var _samples:uint;// = 0
private var posSamples:uint;
private var posStart:uint;
private var _channels:uint;
private var isClosed:Boolean;// = false
private var _rate:uint;
public static const SAMPLE_RATE_22050:uint = 2;
public static const CHANNELS_STEREO:uint = 1;
public static const SAMPLE_RATE_5512_5:uint = 0;
public static const SAMPLE_RATE_11025:uint = 1;
public static const DEPTH_16BIT:uint = 1;
public static const SAMPLE_RATE_44100:uint = 3;
private static const audioHeaderBytes:Array = [120, 0, 5, 95, 0, 0, 15, 160, 0, 0, 12, 1, 0, 68, 17, 8, 0, 0, 0, 67, 2, 0xFF, 0xFF, 0xFF, 191, 21, 11, 0, 0, 0, 1, 0, 83, 99, 101, 110, 101, 32, 49, 0, 0, 191, 20, 200, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 46, 0, 0, 0, 0, 8, 10, 83, 111, 117, 110, 100, 67, 108, 97, 115, 115, 0, 11, 102, 108, 97, 115, 104, 46, 109, 101, 100, 105, 97, 5, 83, 111, 117, 110, 100, 6, 79, 98, 106, 101, 99, 116, 15, 69, 118, 101, 110, 116, 68, 105, 115, 112, 97, 116, 99, 104, 101, 114, 12, 102, 108, 97, 115, 104, 46, 101, 118, 101, 110, 116, 115, 6, 5, 1, 22, 2, 22, 3, 24, 1, 22, 7, 0, 5, 7, 2, 1, 7, 3, 4, 7, 2, 5, 7, 5, 6, 3, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 1, 1, 2, 8, 4, 0, 1, 0, 0, 0, 1, 2, 1, 1, 4, 1, 0, 3, 0, 1, 1, 5, 6, 3, 208, 48, 71, 0, 0, 1, 1, 1, 6, 7, 6, 208, 48, 208, 73, 0, 71, 0, 0, 2, 2, 1, 1, 5, 31, 208, 48, 101, 0, 93, 3, 102, 3, 48, 93, 4, 102, 4, 48, 93, 2, 102, 2, 48, 93, 2, 102, 2, 88, 0, 29, 29, 29, 104, 1, 71, 0, 0, 191, 3];
public static const DEPTH_8BIT:uint = 0;
public static const CHANNELS_MONO:uint = 0;
private static const audioFooterBytes:Array = [63, 19, 15, 0, 0, 0, 1, 0, 1, 0, 83, 111, 117, 110, 100, 67, 108, 97, 115, 115, 0, 68, 11, 15, 0, 0, 0, 64, 0, 0, 0];
public function AudioSynth(_arg1:uint, _arg2:uint, _arg3:uint){
_rate = (_arg1 & 3);
_depth = (_arg2 & 1);
_channels = (_arg3 & 1);
endian = Endian.LITTLE_ENDIAN;
writeUnsignedInt(156456774);
writeUnsignedInt(0);
var _local4:uint;
while (_local4 < audioHeaderBytes.length) {
var _temp1 = _local4;
_local4 = (_local4 + 1);
writeByte(audioHeaderBytes[_temp1]);
};
posAudioSize = position;
writeUnsignedInt(0);
writeByte(1);
writeByte(0);
writeByte((((48 | (_rate << 2)) | (_depth << 1)) | _channels));
posSamples = position;
writeUnsignedInt(0);
posStart = position;
}
public function get bitDepth():uint{
return (_depth);
}
public function get samples():uint{
return (_samples);
}
public function get bitRate():uint{
return (_rate);
}
public function get channels():uint{
return (_channels);
}
override public function set position(_arg1:uint):void{
if (isClosed){
super.position = _arg1;
} else {
throw (new Error("Cannot change position before data is prepared"));
};
}
public function close():void{
if (isClosed){
throw (new Error("test"));
};
var _local1:uint = (position - posStart);
var _local2:uint = ((_channels + 1) * (_depth + 1));
_samples = (_local1 / _local2);
endian = Endian.LITTLE_ENDIAN;
var _local3:uint = position;
var _local4:uint;
while (_local4 < audioFooterBytes.length) {
var _temp1 = _local4;
_local4 = (_local4 + 1);
writeByte(audioFooterBytes[_temp1]);
};
isClosed = true;
position = posSwfSize;
writeUnsignedInt((position + bytesAvailable));
position = posAudioSize;
writeUnsignedInt((_local1 + 7));
position = posSamples;
writeUnsignedInt(_samples);
position = 0;
}
}
}//package com.brokenfunction.util
Section 51
//Counter (com.brokenfunction.util.Counter)
package com.brokenfunction.util {
import flash.utils.*;
import flash.events.*;
public class Counter {
private var _min:uint;
private var _max:uint;
private var timer:Timer;
private var _onTick:Function;
private var last:uint;
private static const SLACK:uint = 1;
public function Counter(_arg1:uint, _arg2:uint, _arg3:Function){
_min = (1000 / _arg1);
_max = (1000 / _arg2);
_onTick = _arg3;
timer = new Timer(1);
timer.addEventListener(TimerEvent.TIMER, onTimer);
last = getTimer();
timer.start();
}
private function onTimer(_arg1:TimerEvent):void{
var _local2:uint = getTimer();
var _local3:uint = (_local2 - last);
if (_local3 >= _min){
_local3 = (_local3 + SLACK);
_onTick(((_local3)<=_max) ? _max : _local3);
last = (_local2 + SLACK);
timer.delay = (SLACK + 1);
} else {
timer.delay = 1;
};
}
}
}//package com.brokenfunction.util
Section 52
//Fps (com.brokenfunction.util.Fps)
package com.brokenfunction.util {
import flash.utils.*;
import flash.events.*;
import flash.text.*;
import flash.system.*;
public class Fps extends TextField {
public const maxTimers:uint = 4;
private var stime:int;
private var baseMem:uint;// = 4294967295
private var cnt:Array;
private var txtA:String;
private var txtB:String;
private var timr:Array;
private var lastMem:uint;// = 4294967295
public function Fps(){
autoSize = TextFieldAutoSize.LEFT;
background = true;
backgroundColor = 0xFFFFFF;
multiline = false;
selectable = false;
type = TextFieldType.DYNAMIC;
wordWrap = false;
defaultTextFormat = new TextFormat();
defaultTextFormat.font = "Verdana";
defaultTextFormat.size = 8;
mouseEnabled = true;
addEventListener(MouseEvent.CLICK, onClick);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
text = ((txtA = "...") + (txtB = ""));
var _local1:uint = maxTimers;
timr = new Array(_local1);
cnt = new Array(_local1);
while (_local1 > 0) {
_local1--;
timr[_local1] = setTimeout(onStartCount, ((_local1 + (1 * 1000)) / maxTimers), _local1);
};
}
final private function onStartCount(_arg1:uint):void{
cnt[_arg1] = 0;
timr[_arg1] = setInterval(onCount, 1000, _arg1);
}
public function stopScriptTime():void{
setScriptTime((getTimer() - stime));
}
final private function onCount(_arg1:uint):void{
txtA = cnt[_arg1].toString();
cnt[_arg1] = 0;
update();
}
private function onClick(_arg1:MouseEvent):void{
background = !(background);
}
private function update():void{
var _local1:uint = System.totalMemory;
lastMem = ((_local1)<lastMem) ? baseMem = _local1 : _local1;
text = ((((((txtA + txtB) + " ") + uint((baseMem / 0x0400))) + "+") + uint(((_local1 - baseMem) / 0x0400))) + "kB");
}
private function onEnterFrame(_arg1:Event):void{
var _local2:uint = maxTimers;
while (_local2 > 0) {
var _local3 = cnt;
--_local2;
var _local4 = _local2;
var _local5 = (_local3[_local4] + 1);
_local3[_local4] = _local5;
};
}
public function startScriptTime():void{
stime = getTimer();
}
public function setScriptTime(_arg1:uint):void{
txtB = ((" (" + _arg1) + ")");
update();
}
}
}//package com.brokenfunction.util
Section 53
//Input (com.brokenfunction.util.Input)
package com.brokenfunction.util {
public interface Input {
function getInput(_arg1:uint=0):uint;
}
}//package com.brokenfunction.util
Section 54
//KeyInput (com.brokenfunction.util.KeyInput)
package com.brokenfunction.util {
import flash.events.*;
public class KeyInput implements Input {
private var dispatch:EventDispatcher;
private var keys:Object;
private var now:uint;// = 0
public function KeyInput(_arg1:EventDispatcher){
keys = {};
super();
dispatch = _arg1;
dispatch.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
dispatch.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
}
private function onKeyDown(_arg1:KeyboardEvent):void{
now = (now | uint(((keys[_arg1.keyCode]) || (0))));
}
private function onKeyUp(_arg1:KeyboardEvent):void{
now = (now & ~(uint(((keys[_arg1.keyCode]) || (0)))));
}
public function getInput(_arg1:uint=0):uint{
return (now);
}
public function resetKeys():void{
keys = {};
}
public function destroy():void{
dispatch.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
dispatch.removeEventListener(KeyboardEvent.KEY_UP, onKeyUp);
dispatch = null;
}
public function setKey(_arg1:uint, _arg2:uint):void{
keys[_arg2] = _arg1;
}
public function addKey(_arg1:uint, _arg2:uint):void{
if (keys[_arg2]){
keys[_arg2] = (keys[_arg2] | _arg1);
} else {
keys[_arg2] = _arg1;
};
}
}
}//package com.brokenfunction.util
Section 55
//ByteArrayAsset (mx.core.ByteArrayAsset)
package mx.core {
import flash.utils.*;
public class ByteArrayAsset extends ByteArray implements IFlexAsset {
mx_internal static const VERSION:String = "3.0.0.0";
}
}//package mx.core
Section 56
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 57
//mx_internal (mx.core.mx_internal)
package mx.core {
public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal";
}//package mx.core
Section 58
//DoomTest (DoomTest)
package {
import flash.display.*;
import flash.utils.*;
import com.brokenfunction.doom.*;
public class DoomTest extends Sprite {
private const DoomWad:Class;
public function DoomTest(){
DoomWad = DoomTest_DoomWad;
super();
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.quality = StageQuality.LOW;
scaleX = (scaleY = 2);
var _local1:ByteArray = (new DoomWad() as ByteArray);
new DoomCore(this, _local1);
}
}
}//package
Section 59
//DoomTest_DoomWad (DoomTest_DoomWad)
package {
import mx.core.*;
public class DoomTest_DoomWad extends ByteArrayAsset {
}
}//package