Section 1
//DebugDispatcher (com.blitzagency.xray.logger.events.DebugDispatcher)
package com.blitzagency.xray.logger.events {
import flash.events.*;
public class DebugDispatcher extends EventDispatcher {
public static var TRACE:String = "trace";
public function
(_arg1:String, _arg2:Object):void{
dispatchEvent(new DebugEvent(DebugDispatcher.TRACE, false, false, _arg2));
}
}
}//package com.blitzagency.xray.logger.events
Section 2
//DebugEvent (com.blitzagency.xray.logger.events.DebugEvent)
package com.blitzagency.xray.logger.events {
import flash.events.*;
public class DebugEvent extends Event {
public var obj:Object;
public function DebugEvent(_arg1:String, _arg2:Boolean, _arg3:Boolean, _arg4:Object):void{
obj = new Object();
super(_arg1, _arg2, _arg3);
obj = _arg4;
}
}
}//package com.blitzagency.xray.logger.events
Section 3
//ObjectTools (com.blitzagency.xray.logger.util.ObjectTools)
package com.blitzagency.xray.logger.util {
import com.blitzagency.xray.logger.*;
import flash.utils.*;
public class ObjectTools {
private static var log:XrayLog = new XrayLog();
public function (_arg1:Object):String{
return ("");
}
public static function getImmediateClassPath(_arg1:Object):String{
var _local2:String;
var _local3:String;
_local2 = getQualifiedClassName(_arg1);
_local3 = getQualifiedSuperclassName(_arg1);
_local2 = ((_local2.indexOf("::") > -1)) ? _local2.split("::").join(".") : _local2;
if (_local3 == null){
return (_local2);
};
_local3 = ((_local3.indexOf("::") > -1)) ? _local3.split("::").join(".") : _local3;
return (((_local3 + ".") + _local2));
}
public static function getFullClassPath(_arg1:Object):String{
var _local2:XML;
var _local3:Array;
var _local4:String;
var _local5:XML;
var _local6:String;
_local2 = describeType(_arg1);
_local3 = [];
_local4 = getQualifiedClassName(_arg1);
_local4 = ((_local4.indexOf("::") > -1)) ? _local4.split("::").join(".") : _local4;
_local3.push(_local4);
for each (_local5 in _local2.extendsClass) {
_local6 = ((_local5.@type.toString().indexOf("::") > -1)) ? _local5.@type.toString().split("::")[1] : _local5.@type.toString();
_local3.push(_local6);
};
return (_local3.join("."));
}
}
}//package com.blitzagency.xray.logger.util
Section 4
//PropertyTools (com.blitzagency.xray.logger.util.PropertyTools)
package com.blitzagency.xray.logger.util {
import flash.utils.*;
public class PropertyTools {
private static function getVariables():void{
}
public static function getProperties(_arg1:Object):Array{
var ary:Array;
var xmlDoc:XML;
var item:XML;
var name:String;
var type:String;
var value:Object;
var obj = _arg1;
ary = [];
try {
xmlDoc = describeType(obj);
for each (item in xmlDoc.variable) {
name = item.@name.toString();
type = item.@type.toString();
value = ((obj[name])!=null) ? obj[name] : "";
ary.push({name:name, type:type, value:value});
};
} catch(e:Error) {
};
return (ary);
}
private static function getMethods():void{
}
}
}//package com.blitzagency.xray.logger.util
Section 5
//Debug (com.blitzagency.xray.logger.Debug)
package com.blitzagency.xray.logger {
import flash.events.*;
import flash.utils.*;
import com.blitzagency.xray.logger.events.*;
import flash.net.*;
public class Debug {
private static var connected:Boolean = false;
private static var xrayLC:LocalConnection;
private static var ed:DebugDispatcher = new DebugDispatcher();
public static function traceObject(_arg1:Object, _arg2:Number=254, _arg3:Number=0, _arg4:String="", _arg5:Number=0):void{
var recurseDepth:Number;
var indent:Number;
var prop:String;
var lead:String;
var i:Number;
var obj:String;
var o = _arg1;
var pRecurseDepth = _arg2;
var pIndent = _arg3;
var pPackage = _arg4;
var pLevel = _arg5;
try {
recurseDepth = pRecurseDepth;
indent = pIndent;
for (prop in o) {
lead = "";
i = 0;
while (i < indent) {
lead = (lead + " ");
i = (i + 1);
};
obj = o[prop].toString();
if ((o[prop] is Array)){
obj = "[Array]";
};
if (obj == "[object Object]"){
obj = "[Object]";
};
Debug.trace((((lead + prop) + ": ") + obj), pPackage, pLevel);
if (recurseDepth > 0){
Debug.traceObject(o[prop], (recurseDepth - 1), (indent + 1), pPackage, pLevel);
};
};
} catch(e:Error) {
};
}
public static function trace(_arg1:Object, _arg2:String="", _arg3:Number=0):void{
var msg:String;
var pMsg = _arg1;
var pPackage = _arg2;
var pLevel = _arg3;
ed.
(DebugDispatcher.TRACE, {message:pMsg, classPackage:pPackage});
if (!connected){
makeConnection();
};
if (connected){
try {
msg = ((String(pMsg).length >= 39995)) ? (String(pMsg).substr(0, 39995) + "...") : String(pMsg);
xrayLC.send("_xray_view_conn", "setTrace", msg, pLevel, pPackage);
} catch(e:LogError) {
LogError("No Xray Interface running");
};
};
}
private static function makeConnection():void{
var err:LogError;
xrayLC = new LocalConnection();
xrayLC.addEventListener("status", statusHandler);
xrayLC.allowDomain("*");
try {
xrayLC.connect(("_xray_standAlone_debug" + getTimer()));
connected = true;
} catch(e:Error) {
err = new LogError("log");
setTimeout(makeConnection, 1000);
};
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
ed.addEventListener(_arg1, _arg2);
}
private static function initialize():Boolean{
ed = new DebugDispatcher();
return (true);
}
private static function statusHandler(_arg1:StatusEvent):void{
if ((((((_arg1.code == null)) && ((_arg1.level == "error")))) && (connected))){
connected = false;
} else {
if ((((_arg1.level == "status")) && ((_arg1.code == null)))){
connected = true;
};
};
}
}
}//package com.blitzagency.xray.logger
class LogError extends Error {
private function LogError(_arg1:String){
super(_arg1);
}
}
Section 6
//Log (com.blitzagency.xray.logger.Log)
package com.blitzagency.xray.logger {
import com.blitzagency.xray.logger.util.*;
public class Log {
private var level:Number;
private var :String;// = ""
private var classPackage:String;
private var :Object;
private var message:String;
public function Log(_arg1:String, _arg2:Object, _arg3:Number, ... _args){
var err:LogError;
var nullArray:Array;
var str:String;
var p_message = _arg1;
var p_dump = _arg2;
var p_level = _arg3;
var rest = _args;
= "";
super();
try {
nullArray.push("bogus");
} catch(e:Error) {
err = new LogError("log");
} finally {
if (err.hasOwnProperty("getStackTrace")){
str = err.getStackTrace();
(
(str));
} else {
("");
};
(p_message);
(p_dump);
setLevel(p_level);
(p_dump);
};
}
public function setLevel(_arg1:Number):void{
level = _arg1;
}
public function getCaller():String{
return ( );
}
public function (_arg1:String):void{
message = _arg1;
}
public function getLevel():Number{
return (level);
}
public function getDump():Object{
return ( );
}
public function (_arg1:String):void{
= _arg1;
}
public function (_arg1:Object):void{
classPackage = ObjectTools.getImmediateClassPath(_arg1);
}
public function getMessage():String{
return (message);
}
public function getClassPackage():String{
return (classPackage);
}
public function (_arg1:Object):void{
= _arg1;
}
private function
(_arg1:String):String{
var ary:Array;
var str = _arg1;
ary = [];
try {
str = str.split("\n").join("");
ary = str.split("\tat ");
str = ary[3];
} catch(e:Error) {
} finally {
str = "";
};
return (str);
}
}
}//package com.blitzagency.xray.logger
class LogError extends Error {
private function LogError(_arg1:String){
super(_arg1);
}
}
Section 7
//Logger (com.blitzagency.xray.logger.Logger)
package com.blitzagency.xray.logger {
public interface Logger {
function setLevel(_arg1:Number=0):void;
function debug(_arg1:Log):void;
function fatal(_arg1:Log):void;
function warn(_arg1:Log):void;
function error(_arg1:Log):void;
function log(_arg1:String, _arg2:String, _arg3:String, _arg4:Number, _arg5:Object=null):void;
function info(_arg1:Log):void;
}
}//package com.blitzagency.xray.logger
Section 8
//XrayLog (com.blitzagency.xray.logger.XrayLog)
package com.blitzagency.xray.logger {
public class XrayLog {
private var :XrayLogger;
public function XrayLog(){
= XrayLogger.getInstance();
}
public function debug(_arg1:String, ... _args):void{
var _local3:Number;
if (_args.length == 0){
.debug(new Log(_arg1, null, XrayLogger.DEBUG));
};
_local3 = 0;
while (_local3 < _args.length) {
if (_local3 > 0){
_arg1 = "";
};
.debug(new Log(_arg1, _args[_local3], XrayLogger.DEBUG));
_local3++;
};
}
public function fatal(_arg1:String, ... _args):void{
var _local3:Number;
if (_args.length == 0){
.fatal(new Log(_arg1, null, XrayLogger.FATAL));
};
_local3 = 0;
while (_local3 < _args.length) {
if (_local3 > 0){
_arg1 = "";
};
.fatal(new Log(_arg1, _args[_local3], XrayLogger.FATAL));
_local3++;
};
}
public function info(_arg1:String, ... _args):void{
var _local3:Number;
if (_args.length == 0){
.info(new Log(_arg1, null, XrayLogger.INFO));
};
_local3 = 0;
while (_local3 < _args.length) {
if (_local3 > 0){
_arg1 = "";
};
.info(new Log(_arg1, _args[_local3], XrayLogger.INFO));
_local3++;
};
}
public function warn(_arg1:String, ... _args):void{
var _local3:Number;
if (_args.length == 0){
.warn(new Log(_arg1, null, XrayLogger.WARN));
};
_local3 = 0;
while (_local3 < _args.length) {
if (_local3 > 0){
_arg1 = "";
};
.warn(new Log(_arg1, _args[_local3], XrayLogger.WARN));
_local3++;
};
}
public function error(_arg1:String, ... _args):void{
var _local3:Number;
if (_args.length == 0){
.error(new Log(_arg1, null, XrayLogger.ERROR));
};
_local3 = 0;
while (_local3 < _args.length) {
if (_local3 > 0){
_arg1 = "";
};
.error(new Log(_arg1, _args[_local3], XrayLogger.ERROR));
_local3++;
};
}
}
}//package com.blitzagency.xray.logger
Section 9
//XrayLogger (com.blitzagency.xray.logger.XrayLogger)
package com.blitzagency.xray.logger {
import flash.events.*;
import flash.utils.*;
import com.blitzagency.xray.logger.util.*;
public class XrayLogger extends EventDispatcher implements Logger {
private var :Number;// = 3
private var level:Number;// = 0
private var :Number;// = 0
private var :Number;// = 254
private var filters:Array;
public static var FATAL:Number = 4;
public static var WARN:Number = 2;
public static var ERROR:Number = 3;
public static var INFO:Number = 1;
public static var DEBUG:Number = 0;
private static var _instance:XrayLogger = null;
public static var NONE:Number = 5;
public function XrayLogger(){
level = 0;
= 3;
= 254;
= 0;
filters = [];
super();
}
public function ():Boolean{
var _local1:uint;
if (filters.length == 0){
return (true);
};
_local1 = 0;
while (_local1 < filters.length) {
_local1++;
};
return (true);
}
public function debug(_arg1:Log):void{
if (_arg1.getLevel() == level){
log(_arg1.getMessage(), _arg1.getCaller(), _arg1.getClassPackage(), 0, _arg1.getDump());
};
}
public function
(_arg1:Number=0):void{
= _arg1;
}
public function error(_arg1:Log):void{
if (_arg1.getLevel() >= level){
log(_arg1.getMessage(), _arg1.getCaller(), _arg1.getClassPackage(), 3, _arg1.getDump());
};
}
public function setLevel(_arg1:Number=0):void{
level = _arg1;
}
public function fatal(_arg1:Log):void{
if (_arg1.getLevel() >= level){
log(_arg1.getMessage(), _arg1.getCaller(), _arg1.getClassPackage(), 4, _arg1.getDump());
};
}
public function warn(_arg1:Log):void{
if (_arg1.getLevel() >= level){
log(_arg1.getMessage(), _arg1.getCaller(), _arg1.getClassPackage(), 2, _arg1.getDump());
};
}
public function (_arg1:Number):void{
= _arg1;
}
public function
(_arg1:Number):void{
= _arg1;
}
public function info(_arg1:Log):void{
if (_arg1.getLevel() >= level){
log(_arg1.getMessage(), _arg1.getCaller(), _arg1.getClassPackage(), 1, _arg1.getDump());
};
}
public function log(_arg1:String, _arg2:String, _arg3:String, _arg4:Number, _arg5:Object=null):void{
var _local6:String;
var _local7:String;
var _local8:String;
var _local9:Object;
_local6 = (("(" + getTimer()) + ") ");
if (_arg3.length > 0){
_local6 = (_local6 + (_arg2 + "\n"));
};
_local6 = (_local6 + _arg1);
if (_arg1.length > 0){
Debug.trace(_local6, _arg3, _arg4);
};
if (_arg5 == null){
return;
};
_local7 = typeof(_arg5);
if ((((((((((_local7 == "string")) || ((_local7 == "number")))) || ((_local7 == "boolean")))) || ((_local7 == "undefined")))) || ((_local7 == "null")))){
Debug.trace(_arg5, _arg3, _arg4);
} else {
if (_local7 == "xml"){
Debug.trace(_arg5.toString(), _arg3, _arg4);
} else {
_local8 = ObjectTools.getImmediateClassPath(_arg5);
if ((((_local8 == "Object")) || ((_local8 == "Object.Array")))){
Debug.traceObject(_arg5, , , _arg3, _arg4);
} else {
_local9 = PropertyTools.getProperties(_arg5);
Debug.traceObject(_local9, , , _arg3, _arg4);
};
};
};
}
public function (_arg1:Array):void{
filters = _arg1;
}
public static function getInstance():XrayLogger{
if (_instance == null){
_instance = new (XrayLogger);
};
return (_instance);
}
public static function resolveLevelAsName(_arg1:Number):String{
switch (_arg1){
case 0:
return ("debug");
case 1:
return ("info");
case 2:
return ("warn");
case 3:
return ("error");
case 4:
return ("fatal");
default:
return ("debug");
};
}
}
}//package com.blitzagency.xray.logger
Section 10
//AdLoader (CPMStar.AdLoader)
package CPMStar {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public class AdLoader {
private static var cpmstarLoader:Loader;
public static function LoadAd(_arg1:int, _arg2:int):DisplayObject{
var _local3:String;
Security.allowDomain("server.cpmstar.com");
_local3 = "http://server.cpmstar.com/adviewas3.swf";
cpmstarLoader = new Loader();
cpmstarLoader.load(new URLRequest(((((_local3 + "?poolid=") + _arg1) + "&subpoolid=") + _arg2)));
return (cpmstarLoader);
}
}
}//package CPMStar
Section 11
//Camera3D (org.papervision3d.cameras.Camera3D)
package org.papervision3d.cameras {
import org.papervision3d.core.proto.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.*;
public class Camera3D extends CameraObject3D {
public var :Number3D;
public var :DisplayObject3D;
public function Camera3D(_arg1:DisplayObject3D=null, _arg2:Number=2, _arg3:Number=100, _arg4:Object=null){
super(_arg2, _arg3, _arg4);
this. = ((_arg1) || (DisplayObject3D.ZERO));
this. = new Number3D(this.x, this.y, this.z);
}
override public function transformView(_arg1:Matrix3D=null):void{
this.lookAt(this.);
super.transformView();
}
public function (_arg1:Number, _arg2:Number, _arg3:Number):void{
var _local4:DisplayObject3D;
var _local5:Number3D;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
_local4 = this.;
_local5 = this.;
_local6 = 8;
switch (_arg1){
case 0:
_local7 = (_local5.x - _local4.x);
_local8 = (_local5.z - _local4.z);
_local9 = Math.atan2(_local8, _local7);
_local10 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8)));
_local11 = (0.5 * _arg2);
_local12 = (_local10 * Math.cos((_local9 - _local11)));
_local13 = (_local10 * Math.sin((_local9 - _local11)));
_local14 = (_local5.y - (300 * _arg3));
this.x = (this.x - ((this.x - _local12) / _local6));
this.y = (this.y - ((this.y - _local14) / _local6));
this.z = (this.z - ((this.z - _local13) / _local6));
break;
case 1:
this.x = (this.x - ((this.x - (1000 * _arg2)) / _local6));
this.y = (this.y - ((this.y - (1000 * _arg3)) / _local6));
break;
};
}
}
}//package org.papervision3d.cameras
Section 12
//DefaultTriangleCuller (org.papervision3d.core.culling.DefaultTriangleCuller)
package org.papervision3d.core.culling {
import org.papervision3d.core.proto.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.*;
public class DefaultTriangleCuller implements ITriangleCuller {
private static var y2:Number;
private static var y1:Number;
private static var y0:Number;
private static var x0:Number;
private static var x1:Number;
private static var x2:Number;
public function testFace(_arg1:DisplayObject3D, _arg2:Face3DInstance, _arg3:Vertex2D, _arg4:Vertex2D, _arg5:Vertex2D):Boolean{
var _local6:MaterialObject3D;
if (((((_arg3.visible) && (_arg4.visible))) && (_arg5.visible))){
_local6 = (_arg2.face.material) ? _arg2.face.material : _arg1.material;
if (_local6.invisible){
return (false);
};
x0 = _arg3.x;
y0 = _arg3.y;
x1 = _arg4.x;
y1 = _arg4.y;
x2 = _arg5.x;
y2 = _arg5.y;
if (_local6.oneSide){
if (_local6.opposite){
if ((((x2 - x0) * (y1 - y0)) - ((y2 - y0) * (x1 - x0))) > 0){
return (false);
};
} else {
if ((((x2 - x0) * (y1 - y0)) - ((y2 - y0) * (x1 - x0))) < 0){
return (false);
};
};
};
return (true);
};
return (false);
}
}
}//package org.papervision3d.core.culling
Section 13
//ITriangleCuller (org.papervision3d.core.culling.ITriangleCuller)
package org.papervision3d.core.culling {
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.*;
public interface ITriangleCuller {
function testFace(_arg1:DisplayObject3D, _arg2:Face3DInstance, _arg3:Vertex2D, _arg4:Vertex2D, _arg5:Vertex2D):Boolean;
}
}//package org.papervision3d.core.culling
Section 14
//IFaceDrawer (org.papervision3d.core.draw.IFaceDrawer)
package org.papervision3d.core.draw {
import flash.display.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.*;
public interface IFaceDrawer {
function drawFace3D(_arg1:DisplayObject3D, _arg2:Face3D, _arg3:Graphics, _arg4:Vertex2D, _arg5:Vertex2D, _arg6:Vertex2D):int;
}
}//package org.papervision3d.core.draw
Section 15
//Face3D (org.papervision3d.core.geom.Face3D)
package org.papervision3d.core.geom {
import flash.display.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.*;
public class Face3D {
public var vertices:Array;
public var face3DInstance:Face3DInstance;
public var id:Number;
public var uv:Array;
public var material:MaterialObject3D;
private var :MaterialObject3D;
public var faceNormal:Number3D;
public var screenZ:Number;
public var :String;
public var visible:Boolean;
public var v0:Vertex3D;
public var v1:Vertex3D;
public var v2:Vertex3D;
private static var _totalFaces:Number = 0;
public function Face3D(_arg1:Array, _arg2:MaterialObject3D=null, _arg3:Array=null){
this.vertices = _arg1;
v0 = _arg1[0];
v1 = _arg1[1];
v2 = _arg1[2];
this.material = _arg2;
this.uv = _arg3;
this.id = _totalFaces++;
face3DInstance = new Face3DInstance(this);
();
}
protected function ():void{
var _local1:Number3D;
var _local2:Number3D;
var _local3:Number3D;
var _local4:Number3D;
var _local5:Number3D;
_local1 = v0.toNumber3D();
_local2 = v1.toNumber3D();
_local3 = v2.toNumber3D();
_local4 = Number3D.sub(_local2, _local1);
_local5 = Number3D.sub(_local3, _local1);
faceNormal = Number3D.cross(_local5, _local4);
faceNormal.normalize();
}
public function render(_arg1:DisplayObject3D, _arg2:Sprite):Number{
= (material) ? material : _arg1.material;
return (.drawFace3D(_arg1, this, _arg2.graphics, v0.vertex2DInstance, v1.vertex2DInstance, v2.vertex2DInstance));
}
}
}//package org.papervision3d.core.geom
Section 16
//Face3DInstance (org.papervision3d.core.geom.Face3DInstance)
package org.papervision3d.core.geom {
import flash.display.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.*;
public class Face3DInstance {
public var container:Sprite;
public var faceNormal:Number3D;
public var screenZ:Number;
public var visible:Boolean;// = false
public var instance:DisplayObject3D;
public var face:Face3D;
public function Face3DInstance(_arg1:Face3D, _arg2:DisplayObject3D=null){
visible = false;
super();
this.face = _arg1;
this.instance = _arg2;
faceNormal = new Number3D();
}
}
}//package org.papervision3d.core.geom
Section 17
//Mesh3D (org.papervision3d.core.geom.Mesh3D)
package org.papervision3d.core.geom {
import org.papervision3d.core.proto.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.*;
import flash.utils.*;
import org.papervision3d.core.culling.*;
public class Mesh3D extends Vertices3D {
public function Mesh3D(_arg1:MaterialObject3D, _arg2:Array, _arg3:Array, _arg4:String=null, _arg5:Object=null){
super(_arg2, _arg4, _arg5);
this.geometry.faces = ((_arg3) || (new Array()));
this.material = ((_arg1) || (MaterialObject3D.DEFAULT));
}
override public function project(_arg1:DisplayObject3D, _arg2:CameraObject3D, _arg3:Array=null):Number{
var _local4:Array;
var _local5:Number;
var _local6:Number;
var _local7:ITriangleCuller;
var _local8:Vertex2D;
var _local9:Vertex2D;
var _local10:Vertex2D;
var _local11:Face3DInstance;
var _local12:Face3D;
var _local13:MaterialObject3D;
super.project(_arg1, _arg2, _arg3);
if (!_arg3){
_arg3 = this._sorted;
};
_local4 = this.geometry.faces;
_local5 = 0;
_local6 = 0;
_local7 = scene.triangleCuller;
for each (_local12 in _local4) {
_local13 = (_local12.material) ? _local12.material : material;
_local11 = _local12.face3DInstance;
_local11.instance = this;
_local8 = _local12.v0.vertex2DInstance;
_local9 = _local12.v1.vertex2DInstance;
_local10 = _local12.v2.vertex2DInstance;
if ((_local11.visible = _local7.testFace(this, _local11, _local8, _local9, _local10))){
if (_local13.needsFaceNormals){
_local12.faceNormal.copyTo(_local11.faceNormal);
Matrix3D.multiplyVector3x3(this.view, _local11.faceNormal);
};
if (_local13.needsVertexNormals){
_local12.v0.normal.copyTo(_local12.v0.vertex2DInstance.normal);
Matrix3D.multiplyVector3x3(this.view, _local12.v0.vertex2DInstance.normal);
_local12.v1.normal.copyTo(_local12.v1.vertex2DInstance.normal);
Matrix3D.multiplyVector3x3(this.view, _local12.v1.vertex2DInstance.normal);
_local12.v2.normal.copyTo(_local12.v2.vertex2DInstance.normal);
Matrix3D.multiplyVector3x3(this.view, _local12.v2.vertex2DInstance.normal);
};
switch (meshSort){
case DisplayObject3D.MESH_SORT_CENTER:
_local5 = (_local5 + (_local11.screenZ = (((_local8.z + _local9.z) + _local10.z) * 0.333)));
break;
case DisplayObject3D.MESH_SORT_FAR:
_local5 = (_local5 + (_local11.screenZ = Math.max(_local8.z, _local9.z, _local10.z)));
break;
case DisplayObject3D.MESH_SORT_CLOSE:
_local5 = (_local5 + (_local11.screenZ = Math.min(_local8.z, _local9.z, _local10.z)));
break;
};
_local6++;
_arg3.push(_local11);
} else {
scene.stats.culledTriangles++;
};
};
return ((this.screenZ = (_local5 / _local6)));
}
public function mergeVertices():void{
var _local1:Dictionary;
var _local2:Array;
var _local3:Vertex3D;
var _local4:Face3D;
var _local5:Vertex3D;
_local1 = new Dictionary();
_local2 = new Array();
for each (_local3 in this.geometry.vertices) {
for each (_local5 in _local1) {
if ((((((_local3.x == _local5.x)) && ((_local3.y == _local5.y)))) && ((_local3.z == _local5.z)))){
_local1[_local3] = _local5;
break;
};
};
if (!_local1[_local3]){
_local1[_local3] = _local3;
_local2.push(_local3);
};
};
this.geometry.vertices = _local2;
for each (_local4 in this.geometry.faces) {
_local4.v0 = _local1[_local4.v0];
_local4.v1 = _local1[_local4.v1];
_local4.v2 = _local1[_local4.v2];
};
}
public function (_arg1:String="x", _arg2:String="y"):void{
var _local3:Array;
var _local4:Object;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:MaterialObject3D;
var _local10:String;
var _local11:Face3D;
var _local12:Array;
var _local13:Vertex3D;
var _local14:Vertex3D;
var _local15:Vertex3D;
var _local16:NumberUV;
var _local17:NumberUV;
var _local18:NumberUV;
_local3 = this.geometry.faces;
_local4 = this.boundingBox();
_local5 = _local4.min[_arg1];
_local6 = _local4.size[_arg1];
_local7 = _local4.min[_arg2];
_local8 = _local4.size[_arg2];
_local9 = this.material;
for (_local10 in _local3) {
_local11 = _local3[Number(_local10)];
_local12 = _local11.vertices;
_local13 = _local12[0];
_local14 = _local12[1];
_local15 = _local12[2];
_local16 = new NumberUV(((_local13[_arg1] - _local5) / _local6), ((_local13[_arg2] - _local7) / _local8));
_local17 = new NumberUV(((_local14[_arg1] - _local5) / _local6), ((_local14[_arg2] - _local7) / _local8));
_local18 = new NumberUV(((_local15[_arg1] - _local5) / _local6), ((_local15[_arg2] - _local7) / _local8));
_local11.uv = [_local16, _local17, _local18];
};
}
}
}//package org.papervision3d.core.geom
Section 18
//Vertex2D (org.papervision3d.core.geom.Vertex2D)
package org.papervision3d.core.geom {
import org.papervision3d.core.*;
public class Vertex2D {
public var visible:Boolean;
public var normal:Number3D;
public var extra:Object;
public var x:Number;
public var y:Number;
public var z:Number;
public function Vertex2D(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0){
this.x = _arg1;
this.y = _arg2;
this.z = _arg3;
this.visible = false;
this.normal = new Number3D();
}
public function clone():Vertex2D{
var _local1:Vertex2D;
_local1 = new Vertex2D(x, y, z);
_local1.visible = visible;
_local1.extra = extra;
return (_local1);
}
}
}//package org.papervision3d.core.geom
Section 19
//Vertex3D (org.papervision3d.core.geom.Vertex3D)
package org.papervision3d.core.geom {
import org.papervision3d.core.*;
import flash.utils.*;
public class Vertex3D {
public var vertex2DInstance:Vertex2D;
public var connectedFaces:Dictionary;
public var normal:Number3D;
public var extra:Object;
public var x:Number;
public var y:Number;
public var z:Number;
public function Vertex3D(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0){
this.x = _arg1;
this.y = _arg2;
this.z = _arg3;
this.vertex2DInstance = new Vertex2D();
this.normal = new Number3D();
this.connectedFaces = new Dictionary();
}
public function calculateNormal():void{
var _local1:Face3D;
normal = new Number3D();
for each (_local1 in connectedFaces) {
normal = Number3D.add(_local1.faceNormal, normal);
};
normal.normalize();
}
public function toNumber3D():Number3D{
return (new Number3D(x, y, z));
}
public function clone():Vertex3D{
var _local1:Vertex3D;
_local1 = new Vertex3D(x, y, z);
_local1.extra = extra;
_local1.vertex2DInstance = vertex2DInstance.clone();
_local1.normal = normal.clone();
return (_local1);
}
}
}//package org.papervision3d.core.geom
Section 20
//Vertices3D (org.papervision3d.core.geom.Vertices3D)
package org.papervision3d.core.geom {
import org.papervision3d.core.proto.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.*;
import org.papervision3d.scenes.*;
public class Vertices3D extends DisplayObject3D {
public function Vertices3D(_arg1:Array, _arg2:String=null, _arg3:Object=null){
super(_arg2, new GeometryObject3D(), _arg3);
this.geometry.vertices = ((_arg1) || (new Array()));
}
override public function project(_arg1:DisplayObject3D, _arg2:CameraObject3D, _arg3:Array=null):Number{
var _local4:Matrix3D;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Vertex3D;
var _local21:Vertex2D;
var _local22:Number;
var _local23:Array;
var _local24:int;
var _local25:Number;
var _local26:Number;
super.project(_arg1, _arg2, _arg3);
_local4 = this.view;
_local5 = _local4.n11;
_local6 = _local4.n12;
_local7 = _local4.n13;
_local8 = _local4.n21;
_local9 = _local4.n22;
_local10 = _local4.n23;
_local11 = _local4.n31;
_local12 = _local4.n32;
_local13 = _local4.n33;
_local23 = this.geometry.vertices;
_local24 = _local23.length;
_local25 = _arg2.focus;
_local26 = (_local25 * _arg2.zoom);
while ((_local20 = _local23[--_local24])) {
_local14 = _local20.x;
_local15 = _local20.y;
_local16 = _local20.z;
_local19 = ((((_local14 * _local11) + (_local15 * _local12)) + (_local16 * _local13)) + _local4.n34);
_local21 = _local20.vertex2DInstance;
if ((_local21.visible = (_local19 > 0))){
_local17 = ((((_local14 * _local5) + (_local15 * _local6)) + (_local16 * _local7)) + _local4.n14);
_local18 = ((((_local14 * _local8) + (_local15 * _local9)) + (_local16 * _local10)) + _local4.n24);
_local22 = (_local26 / (_local25 + _local19));
_local21.x = (_local17 * _local22);
_local21.y = (_local18 * _local22);
_local21.z = _local19;
};
};
return (0);
}
public function transformVertices(_arg1:Matrix3D):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Array;
var _local15:int;
var _local16:Vertex3D;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
_local2 = _arg1.n11;
_local3 = _arg1.n12;
_local4 = _arg1.n13;
_local5 = _arg1.n21;
_local6 = _arg1.n22;
_local7 = _arg1.n23;
_local8 = _arg1.n31;
_local9 = _arg1.n32;
_local10 = _arg1.n33;
_local11 = _arg1.n14;
_local12 = _arg1.n24;
_local13 = _arg1.n34;
_local14 = this.geometry.vertices;
_local15 = _local14.length;
while ((_local16 = _local14[--_local15])) {
_local17 = _local16.x;
_local18 = _local16.y;
_local19 = _local16.z;
_local20 = ((((_local17 * _local2) + (_local18 * _local3)) + (_local19 * _local4)) + _local11);
_local21 = ((((_local17 * _local5) + (_local18 * _local6)) + (_local19 * _local7)) + _local12);
_local22 = ((((_local17 * _local8) + (_local18 * _local9)) + (_local19 * _local10)) + _local13);
_local16.x = _local20;
_local16.y = _local21;
_local16.z = _local22;
};
}
public function boundingBox():Object{
var _local1:Object;
var _local2:Object;
var _local3:String;
var _local4:Vertex3D;
_local1 = this.geometry.vertices;
_local2 = new Object();
_local2.min = new Number3D();
_local2.max = new Number3D();
_local2.size = new Number3D();
for (_local3 in _local1) {
_local4 = _local1[Number(_local3)];
_local2.min.x = ((_local2.min.x)==undefined) ? _local4.x : Math.min(_local4.x, _local2.min.x);
_local2.max.x = ((_local2.max.x)==undefined) ? _local4.x : Math.max(_local4.x, _local2.max.x);
_local2.min.y = ((_local2.min.y)==undefined) ? _local4.y : Math.min(_local4.y, _local2.min.y);
_local2.max.y = ((_local2.max.y)==undefined) ? _local4.y : Math.max(_local4.y, _local2.max.y);
_local2.min.z = ((_local2.min.z)==undefined) ? _local4.z : Math.min(_local4.z, _local2.min.z);
_local2.max.z = ((_local2.max.z)==undefined) ? _local4.z : Math.max(_local4.z, _local2.max.z);
};
_local2.size.x = (_local2.max.x - _local2.min.x);
_local2.size.y = (_local2.max.y - _local2.min.y);
_local2.size.z = (_local2.max.z - _local2.min.z);
return (_local2);
}
}
}//package org.papervision3d.core.geom
Section 21
//CameraObject3D (org.papervision3d.core.proto.CameraObject3D)
package org.papervision3d.core.proto {
import org.papervision3d.objects.*;
import org.papervision3d.core.*;
public class CameraObject3D extends DisplayObject3D {
public var sort:Boolean;
public var zoom:Number;
public var focus:Number;
private static var _flipY:Matrix3D = Matrix3D.scaleMatrix(1, -1, 1);
public static var DEFAULT_POS:Number3D = new Number3D(0, 0, -1000);
public function CameraObject3D(_arg1:Number=3, _arg2:Number=500, _arg3:Object=null){
this.x = (_arg3) ? ((_arg3.x) || (DEFAULT_POS.x)) : DEFAULT_POS.x;
this.y = (_arg3) ? ((_arg3.y) || (DEFAULT_POS.y)) : DEFAULT_POS.y;
this.z = (_arg3) ? ((_arg3.z) || (DEFAULT_POS.z)) : DEFAULT_POS.z;
this.zoom = _arg1;
this.focus = _arg2;
this.sort = (_arg3) ? !((_arg3.sort == false)) : true;
}
public function transformView(_arg1:Matrix3D=null):void{
this.view = Matrix3D.inverse(Matrix3D.multiply(((_arg1) || (this.transform)), _flipY));
}
public function (_arg1:Number):void{
super.yaw(_arg1);
}
public function (_arg1:Number):void{
super.pitch(_arg1);
}
}
}//package org.papervision3d.core.proto
Section 22
//DisplayObjectContainer3D (org.papervision3d.core.proto.DisplayObjectContainer3D)
package org.papervision3d.core.proto {
import flash.events.*;
import org.papervision3d.materials.*;
import org.papervision3d.objects.*;
import flash.utils.*;
import org.papervision3d.*;
public class DisplayObjectContainer3D extends EventDispatcher {
protected var :Dictionary;
public var :DisplayObjectContainer3D;
private var :int;
protected var _childrenByName:Object;
public function DisplayObjectContainer3D():void{
this. = new Dictionary(false);
this._childrenByName = new Dictionary(true);
this. = 0;
}
public function
(_arg1:String):DisplayObject3D{
return (this._childrenByName[_arg1]);
}
public function (_arg1:String, _arg2:MaterialsList=null, _arg3:Number=1):void{
Papervision3D.log("The addCollada() method has been deprecated. Use addChildren( new Collada( filename ) )");
}
public function (_arg1:String):DisplayObject3D{
return (removeChild(
(_arg1)));
}
public function get numChildren():int{
return (this.);
}
override public function toString():String{
return (());
}
public function (_arg1:DisplayObject3D):DisplayObjectContainer3D{
var _local2:DisplayObject3D;
for each (_local2 in _arg1.children) {
_arg1.removeChild(_local2);
this.addChild(_local2);
};
return (this);
}
public function removeChild(_arg1:DisplayObject3D):DisplayObject3D{
if (_arg1){
delete this._childrenByName[this.[_arg1]];
delete this.[_arg1];
_arg1.parent = null;
_arg1. = null;
return (_arg1);
};
return (null);
}
public function addChild(_arg1:DisplayObject3D, _arg2:String=null):DisplayObject3D{
_arg2 = ((((_arg2) || (_arg1.name))) || (String(_arg1.id)));
this.[_arg1] = _arg2;
this._childrenByName[_arg2] = _arg1;
this.++;
_arg1.parent = this;
_arg1. = this.;
return (_arg1);
}
public function ():String{
var _local1:String;
var _local2:String;
_local1 = "";
for (_local2 in this.) {
_local1 = (_local1 + (_local2 + "\n"));
};
return (_local1);
}
public function get children():Object{
return (this._childrenByName);
}
}
}//package org.papervision3d.core.proto
Section 23
//GeometryObject3D (org.papervision3d.core.proto.GeometryObject3D)
package org.papervision3d.core.proto {
import flash.events.*;
import org.papervision3d.materials.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.core.*;
import flash.utils.*;
import org.papervision3d.scenes.*;
public class GeometryObject3D extends EventDispatcher {
protected var :Number;
protected var :Boolean;// = true
public var :Boolean;// = false
protected var :MaterialObject3D;
public var faces:Array;
public var vertices:Array;
public function GeometryObject3D(_arg1:Object=null):void{
= false;
= true;
super();
}
public function transformVertices(_arg1:Matrix3D):void{
}
public function get boundingSphere2():Number{
if (){
return (());
};
return ();
}
public function ():Number{
var _local1:Number;
var _local2:Number;
var _local3:Vertex3D;
_local1 = 0;
for each (_local3 in this.vertices) {
_local2 = (((_local3.x * _local3.x) + (_local3.y * _local3.y)) + (_local3.z * _local3.z));
_local1 = ((_local2)>_local1) ? _local2 : _local1;
};
this. = false;
return (( = _local1));
}
private function ():void{
var _local1:Dictionary;
var _local2:Face3D;
var _local3:Vertex3D;
_local1 = new Dictionary(true);
for each (_local2 in faces) {
_local2.v0.connectedFaces[_local2] = _local2;
_local2.v1.connectedFaces[_local2] = _local2;
_local2.v2.connectedFaces[_local2] = _local2;
_local1[_local2.v0] = _local2.v0;
_local1[_local2.v1] = _local2.v1;
_local1[_local2.v2] = _local2.v2;
};
for each (_local3 in _local1) {
_local3.calculateNormal();
};
}
public function transformUV(_arg1:MaterialObject3D):void{
var _local2:String;
if (_arg1.bitmap){
for (_local2 in this.faces) {
faces[_local2].transformUV(_arg1);
};
};
}
public function set ready(_arg1:Boolean):void{
if (_arg1){
();
};
= _arg1;
}
public function get ready():Boolean{
return ();
}
}
}//package org.papervision3d.core.proto
Section 24
//MaterialObject3D (org.papervision3d.core.proto.MaterialObject3D)
package org.papervision3d.core.proto {
import flash.display.*;
import flash.events.*;
import org.papervision3d.materials.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.core.draw.*;
public class MaterialObject3D extends EventDispatcher implements IFaceDrawer {
public var widthOffset:Number;// = 0
public var name:String;
public var scene:SceneObject3D;
public var needsVertexNormals:Boolean;// = false
public var heightOffset:Number;// = 0
public var fillAlpha:Number;// = 0
public var fillColor:Number;
public var id:Number;
public var invisible:Boolean;// = false
public var smooth:Boolean;// = false
public var bitmap:BitmapData;
public var lineColor:Number;
public var lineAlpha:Number;// = 0
public var oneSide:Boolean;// = true
public var :Number;// = 1
public var opposite:Boolean;// = false
public var maxU:Number;
public var maxV:Number;
public var tiled:Boolean;// = false
public var needsFaceNormals:Boolean;// = false
public static var DEFAULT_COLOR:int = 0;
public static var DEBUG_COLOR:int = 0xFF00FF;
private static var _totalMaterialObjects:Number = 0;
public function MaterialObject3D(){
smooth = false;
tiled = false;
lineColor = DEFAULT_COLOR;
lineAlpha = 0;
= 1;
fillColor = DEFAULT_COLOR;
fillAlpha = 0;
oneSide = true;
invisible = false;
opposite = false;
needsFaceNormals = false;
needsVertexNormals = false;
widthOffset = 0;
heightOffset = 0;
super();
this.id = _totalMaterialObjects++;
}
public function get doubleSided():Boolean{
return (!(this.oneSide));
}
public function drawFace3D(_arg1:DisplayObject3D, _arg2:Face3D, _arg3:Graphics, _arg4:Vertex2D, _arg5:Vertex2D, _arg6:Vertex2D):int{
return (0);
}
public function set doubleSided(_arg1:Boolean):void{
this.oneSide = !(_arg1);
}
public function updateBitmap():void{
}
override public function toString():String{
return (((((("[MaterialObject3D] bitmap:" + this.bitmap) + " lineColor:") + this.lineColor) + " fillColor:") + fillColor));
}
public function copy(_arg1:MaterialObject3D):void{
this.bitmap = _arg1.bitmap;
this.smooth = _arg1.smooth;
this.lineColor = _arg1.lineColor;
this.lineAlpha = _arg1.lineAlpha;
this.fillColor = _arg1.fillColor;
this.fillAlpha = _arg1.fillAlpha;
this.needsFaceNormals = _arg1.needsFaceNormals;
this.needsVertexNormals = _arg1.needsVertexNormals;
this.oneSide = _arg1.oneSide;
this.opposite = _arg1.opposite;
this.invisible = _arg1.invisible;
this.scene = _arg1.scene;
this.name = _arg1.name;
this.maxU = _arg1.maxU;
this.maxV = _arg1.maxV;
}
public function clone():MaterialObject3D{
var _local1:MaterialObject3D;
_local1 = new MaterialObject3D();
_local1.copy(this);
return (_local1);
}
public static function get DEFAULT():MaterialObject3D{
var _local1:MaterialObject3D;
_local1 = new WireframeMaterial();
_local1.lineColor = (0xFFFFFF * Math.random());
_local1.lineAlpha = 1;
_local1.fillColor = DEFAULT_COLOR;
_local1.fillAlpha = 1;
_local1.doubleSided = false;
return (_local1);
}
public static function get DEBUG():MaterialObject3D{
var _local1:MaterialObject3D;
_local1 = new (MaterialObject3D);
_local1.lineColor = (0xFFFFFF * Math.random());
_local1.lineAlpha = 1;
_local1.fillColor = DEBUG_COLOR;
_local1.fillAlpha = 0.37;
_local1.doubleSided = true;
return (_local1);
}
}
}//package org.papervision3d.core.proto
Section 25
//SceneObject3D (org.papervision3d.core.proto.SceneObject3D)
package org.papervision3d.core.proto {
import flash.display.*;
import org.papervision3d.materials.*;
import org.papervision3d.objects.*;
import flash.utils.*;
import org.papervision3d.core.culling.*;
import org.papervision3d.core.stat.*;
import org.papervision3d.*;
public class SceneObject3D extends DisplayObjectContainer3D {
public var container:Sprite;
public var triangleCuller:ITriangleCuller;
private var :Dictionary;
public var objects:Array;
public var stats:RenderStatistics;
public var materials:MaterialsList;
public function SceneObject3D(_arg1:Sprite){
triangleCuller = new DefaultTriangleCuller();
super();
if (_arg1){
this.container = _arg1;
} else {
Papervision3D.log("Scene3D: container argument required.");
};
this.objects = new Array();
this.materials = new MaterialsList();
Papervision3D.log((((((Papervision3D.NAME + " ") + Papervision3D.VERSION) + " (") + Papervision3D.DATE) + ")\n"));
this.stats = new RenderStatistics();
this.stats. = 0;
this.stats. = 0;
this.stats. = 0;
this.stats.performance = 0;
this.stats.rendered = 0;
this. = this;
}
override public function addChild(_arg1:DisplayObject3D, _arg2:String=null):DisplayObject3D{
var _local3:DisplayObject3D;
_local3 = super.addChild(_arg1, _arg2);
_arg1.scene = this;
this.objects.push(_local3);
return (_local3);
}
public function renderCamera(_arg1:CameraObject3D):void{
var _local2:Array;
var _local3:DisplayObject3D;
var _local4:Number;
stats.clear();
stats.performance = getTimer();
MovieMaterial.updateAnimatedBitmaps();
if (_arg1){
_arg1.transformView();
_local2 = this.objects;
_local4 = _local2.length;
while ((_local3 = _local2[--_local4])) {
if (_local3.visible){
_local3.project(_arg1, _arg1);
};
};
};
if (_arg1.sort){
this.objects.sortOn("screenZ", Array.NUMERIC);
};
renderObjects(_arg1.sort);
}
protected function renderObjects(_arg1:Boolean):void{
}
override public function removeChild(_arg1:DisplayObject3D):DisplayObject3D{
var _local2:int;
super.removeChild(_arg1);
_local2 = 0;
while (_local2 < this.objects.length) {
if (this.objects[_local2] === _arg1){
this.objects.splice(_local2, 1);
return (_arg1);
};
_local2++;
};
return (_arg1);
}
}
}//package org.papervision3d.core.proto
Section 26
//RenderStatistics (org.papervision3d.core.stat.RenderStatistics)
package org.papervision3d.core.stat {
public class RenderStatistics {
public var :int;// = 0
public var :int;// = 0
public var :int;// = 0
public var :Number;
public var performance:int;// = 0
public var rendered:int;// = 0
public var culledTriangles:int;// = 0
public var :Number;
public function RenderStatistics(){
performance = 0;
= 0;
= 0;
rendered = 0;
= 0;
culledTriangles = 0;
super();
}
public function clear():void{
performance = 0;
= 0;
= 0;
rendered = 0;
= 0;
= 0;
= 0;
culledTriangles = 0;
}
public function toString():String{
return (new String(((((((((("Performance:" + performance) + ", Points:") + ) + " Polys:") + ) + " Rendered:") + rendered) + " Culled:") + culledTriangles)));
}
}
}//package org.papervision3d.core.stat
Section 27
//Matrix3D (org.papervision3d.core.Matrix3D)
package org.papervision3d.core {
public class Matrix3D {
public var n31:Number;
public var n32:Number;
public var n11:Number;
public var n13:Number;
public var n14:Number;
public var n33:Number;
public var n12:Number;
public var n21:Number;
public var n22:Number;
public var n23:Number;
public var n24:Number;
public var n34:Number;
private static var toDEGREES:Number = 57.2957795130823;
private static var toRADIANS:Number = 0.0174532925199433;
public function Matrix3D(_arg1:Array=null){
if (((!(_arg1)) || ((_arg1.length < 12)))){
n11 = (n22 = (n33 = 1));
n12 = (n13 = (n14 = (n21 = (n23 = (n24 = (n31 = (n32 = (n34 = 0))))))));
} else {
n11 = _arg1[0];
n12 = _arg1[1];
n13 = _arg1[2];
n14 = _arg1[3];
n21 = _arg1[4];
n22 = _arg1[5];
n23 = _arg1[6];
n24 = _arg1[7];
n31 = _arg1[8];
n32 = _arg1[9];
n33 = _arg1[10];
n34 = _arg1[11];
};
}
public function calculateMultiply3x3(_arg1:Matrix3D, _arg2:Matrix3D):void{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
_local3 = _arg1.n11;
_local4 = _arg2.n11;
_local5 = _arg1.n21;
_local6 = _arg2.n21;
_local7 = _arg1.n31;
_local8 = _arg2.n31;
_local9 = _arg1.n12;
_local10 = _arg2.n12;
_local11 = _arg1.n22;
_local12 = _arg2.n22;
_local13 = _arg1.n32;
_local14 = _arg2.n32;
_local15 = _arg1.n13;
_local16 = _arg2.n13;
_local17 = _arg1.n23;
_local18 = _arg2.n23;
_local19 = _arg1.n33;
_local20 = _arg2.n33;
this.n11 = (((_local3 * _local4) + (_local9 * _local6)) + (_local15 * _local8));
this.n12 = (((_local3 * _local10) + (_local9 * _local12)) + (_local15 * _local14));
this.n13 = (((_local3 * _local16) + (_local9 * _local18)) + (_local15 * _local20));
this.n21 = (((_local5 * _local4) + (_local11 * _local6)) + (_local17 * _local8));
this.n22 = (((_local5 * _local10) + (_local11 * _local12)) + (_local17 * _local14));
this.n23 = (((_local5 * _local16) + (_local11 * _local18)) + (_local17 * _local20));
this.n31 = (((_local7 * _local4) + (_local13 * _local6)) + (_local19 * _local8));
this.n32 = (((_local7 * _local10) + (_local13 * _local12)) + (_local19 * _local14));
this.n33 = (((_local7 * _local16) + (_local13 * _local18)) + (_local19 * _local20));
}
public function get trace():Number{
return ((((this.n11 + this.n22) + this.n33) + 1));
}
public function get det():Number{
return ((((((this.n11 * this.n22) - (this.n21 * this.n12)) * this.n33) - (((this.n11 * this.n32) - (this.n31 * this.n12)) * this.n23)) + (((this.n21 * this.n32) - (this.n31 * this.n22)) * this.n13)));
}
public function (_arg1:Matrix3D):Matrix3D{
this.n11 = _arg1.n11;
this.n12 = _arg1.n12;
this.n13 = _arg1.n13;
this.n21 = _arg1.n21;
this.n22 = _arg1.n22;
this.n23 = _arg1.n23;
this.n31 = _arg1.n31;
this.n32 = _arg1.n32;
this.n33 = _arg1.n33;
return (this);
}
public function (_arg1:Matrix3D, _arg2:Matrix3D):void{
this.n11 = (_arg1.n11 + _arg2.n11);
this.n12 = (_arg1.n12 + _arg2.n12);
this.n13 = (_arg1.n13 + _arg2.n13);
this.n14 = (_arg1.n14 + _arg2.n14);
this.n21 = (_arg1.n21 + _arg2.n21);
this.n22 = (_arg1.n22 + _arg2.n22);
this.n23 = (_arg1.n23 + _arg2.n23);
this.n24 = (_arg1.n24 + _arg2.n24);
this.n31 = (_arg1.n31 + _arg2.n31);
this.n32 = (_arg1.n32 + _arg2.n32);
this.n33 = (_arg1.n33 + _arg2.n33);
this.n34 = (_arg1.n34 + _arg2.n34);
}
public function calculateMultiply(_arg1:Matrix3D, _arg2:Matrix3D):void{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
_local3 = _arg1.n11;
_local4 = _arg2.n11;
_local5 = _arg1.n21;
_local6 = _arg2.n21;
_local7 = _arg1.n31;
_local8 = _arg2.n31;
_local9 = _arg1.n12;
_local10 = _arg2.n12;
_local11 = _arg1.n22;
_local12 = _arg2.n22;
_local13 = _arg1.n32;
_local14 = _arg2.n32;
_local15 = _arg1.n13;
_local16 = _arg2.n13;
_local17 = _arg1.n23;
_local18 = _arg2.n23;
_local19 = _arg1.n33;
_local20 = _arg2.n33;
_local21 = _arg1.n14;
_local22 = _arg2.n14;
_local23 = _arg1.n24;
_local24 = _arg2.n24;
_local25 = _arg1.n34;
_local26 = _arg2.n34;
this.n11 = (((_local3 * _local4) + (_local9 * _local6)) + (_local15 * _local8));
this.n12 = (((_local3 * _local10) + (_local9 * _local12)) + (_local15 * _local14));
this.n13 = (((_local3 * _local16) + (_local9 * _local18)) + (_local15 * _local20));
this.n14 = ((((_local3 * _local22) + (_local9 * _local24)) + (_local15 * _local26)) + _local21);
this.n21 = (((_local5 * _local4) + (_local11 * _local6)) + (_local17 * _local8));
this.n22 = (((_local5 * _local10) + (_local11 * _local12)) + (_local17 * _local14));
this.n23 = (((_local5 * _local16) + (_local11 * _local18)) + (_local17 * _local20));
this.n24 = ((((_local5 * _local22) + (_local11 * _local24)) + (_local17 * _local26)) + _local23);
this.n31 = (((_local7 * _local4) + (_local13 * _local6)) + (_local19 * _local8));
this.n32 = (((_local7 * _local10) + (_local13 * _local12)) + (_local19 * _local14));
this.n33 = (((_local7 * _local16) + (_local13 * _local18)) + (_local19 * _local20));
this.n34 = ((((_local7 * _local22) + (_local13 * _local24)) + (_local19 * _local26)) + _local25);
}
public function toString():String{
var _local1:String;
_local1 = "";
_local1 = (_local1 + ((((((((int((n11 * 1000)) / 1000) + "\t\t") + (int((n12 * 1000)) / 1000)) + "\t\t") + (int((n13 * 1000)) / 1000)) + "\t\t") + (int((n14 * 1000)) / 1000)) + "\n"));
_local1 = (_local1 + ((((((((int((n21 * 1000)) / 1000) + "\t\t") + (int((n22 * 1000)) / 1000)) + "\t\t") + (int((n23 * 1000)) / 1000)) + "\t\t") + (int((n24 * 1000)) / 1000)) + "\n"));
_local1 = (_local1 + ((((((((int((n31 * 1000)) / 1000) + "\t\t") + (int((n32 * 1000)) / 1000)) + "\t\t") + (int((n33 * 1000)) / 1000)) + "\t\t") + (int((n34 * 1000)) / 1000)) + "\n"));
return (_local1);
}
public function copy(_arg1:Matrix3D):Matrix3D{
this.n11 = _arg1.n11;
this.n12 = _arg1.n12;
this.n13 = _arg1.n13;
this.n14 = _arg1.n14;
this.n21 = _arg1.n21;
this.n22 = _arg1.n22;
this.n23 = _arg1.n23;
this.n24 = _arg1.n24;
this.n31 = _arg1.n31;
this.n32 = _arg1.n32;
this.n33 = _arg1.n33;
this.n34 = _arg1.n34;
return (this);
}
public function
(_arg1:Matrix3D):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
_local2 = _arg1.det;
if (Math.abs(_local2) > 0.001){
_local2 = (1 / _local2);
_local3 = _arg1.n11;
_local4 = _arg1.n21;
_local5 = _arg1.n31;
_local6 = _arg1.n12;
_local7 = _arg1.n22;
_local8 = _arg1.n32;
_local9 = _arg1.n13;
_local10 = _arg1.n23;
_local11 = _arg1.n33;
_local12 = _arg1.n14;
_local13 = _arg1.n24;
_local14 = _arg1.n34;
this.n11 = (_local2 * ((_local7 * _local11) - (_local8 * _local10)));
this.n12 = (-(_local2) * ((_local6 * _local11) - (_local8 * _local9)));
this.n13 = (_local2 * ((_local6 * _local10) - (_local7 * _local9)));
this.n14 = (-(_local2) * (((_local6 * ((_local10 * _local14) - (_local11 * _local13))) - (_local7 * ((_local9 * _local14) - (_local11 * _local12)))) + (_local8 * ((_local9 * _local13) - (_local10 * _local12)))));
this.n21 = (-(_local2) * ((_local4 * _local11) - (_local5 * _local10)));
this.n22 = (_local2 * ((_local3 * _local11) - (_local5 * _local9)));
this.n23 = (-(_local2) * ((_local3 * _local10) - (_local4 * _local9)));
this.n24 = (_local2 * (((_local3 * ((_local10 * _local14) - (_local11 * _local13))) - (_local4 * ((_local9 * _local14) - (_local11 * _local12)))) + (_local5 * ((_local9 * _local13) - (_local10 * _local12)))));
this.n31 = (_local2 * ((_local4 * _local8) - (_local5 * _local7)));
this.n32 = (-(_local2) * ((_local3 * _local8) - (_local5 * _local6)));
this.n33 = (_local2 * ((_local3 * _local7) - (_local4 * _local6)));
this.n34 = (-(_local2) * (((_local3 * ((_local7 * _local14) - (_local8 * _local13))) - (_local4 * ((_local6 * _local14) - (_local8 * _local12)))) + (_local5 * ((_local6 * _local13) - (_local7 * _local12)))));
};
}
public static function rotationMatrixWithReference(_arg1:Number3D, _arg2:Number, _arg3:Number3D):Matrix3D{
var _local4:Matrix3D;
_local4 = Matrix3D.translationMatrix(_arg3.x, -(_arg3.y), _arg3.z);
Matrix3D.translationMatrix(_arg3.x, -(_arg3.y), _arg3.z).calculateMultiply(_local4, Matrix3D.rotationMatrix(_arg1.x, _arg1.y, _arg1.z, _arg2));
_local4.calculateMultiply(_local4, Matrix3D.translationMatrix(-(_arg3.x), _arg3.y, -(_arg3.z)));
return (_local4);
}
public static function multiplyVector3x3(_arg1:Matrix3D, _arg2:Number3D):void{
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local3 = _arg2.x;
_local4 = _arg2.y;
_local5 = _arg2.z;
_arg2.x = (((_local3 * _arg1.n11) + (_local4 * _arg1.n12)) + (_local5 * _arg1.n13));
_arg2.y = (((_local3 * _arg1.n21) + (_local4 * _arg1.n22)) + (_local5 * _arg1.n23));
_arg2.z = (((_local3 * _arg1.n31) + (_local4 * _arg1.n32)) + (_local5 * _arg1.n33));
}
public static function multiply3x3(_arg1:Matrix3D, _arg2:Matrix3D):Matrix3D{
var _local3:Matrix3D;
_local3 = new (Matrix3D);
_local3.calculateMultiply3x3(_arg1, _arg2);
return (_local3);
}
public static function normalizeQuaternion(_arg1:Object):Object{
var _local2:Number;
_local2 = magnitudeQuaternion(_arg1);
_arg1.x = (_arg1.x / _local2);
_arg1.y = (_arg1.y / _local2);
_arg1.z = (_arg1.z / _local2);
_arg1.w = (_arg1.w / _local2);
return (_arg1);
}
public static function multiplyVector(_arg1:Matrix3D, _arg2:Number3D):void{
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local3 = _arg2.x;
_local4 = _arg2.y;
_local5 = _arg2.z;
_arg2.x = ((((_local3 * _arg1.n11) + (_local4 * _arg1.n12)) + (_local5 * _arg1.n13)) + _arg1.n14);
_arg2.y = ((((_local3 * _arg1.n21) + (_local4 * _arg1.n22)) + (_local5 * _arg1.n23)) + _arg1.n24);
_arg2.z = ((((_local3 * _arg1.n31) + (_local4 * _arg1.n32)) + (_local5 * _arg1.n33)) + _arg1.n34);
}
public static function axis2quaternion(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Object{
var _local5:Number;
var _local6:Number;
var _local7:Object;
_local5 = Math.sin((_arg4 / 2));
_local6 = Math.cos((_arg4 / 2));
_local7 = new Object();
_local7.x = (_arg1 * _local5);
_local7.y = (_arg2 * _local5);
_local7.z = (_arg3 * _local5);
_local7.w = _local6;
return (normalizeQuaternion(_local7));
}
public static function translationMatrix(_arg1:Number, _arg2:Number, _arg3:Number):Matrix3D{
var _local4:Matrix3D;
_local4 = IDENTITY;
_local4.n14 = _arg1;
_local4.n24 = _arg2;
_local4.n34 = _arg3;
return (_local4);
}
public static function magnitudeQuaternion(_arg1:Object):Number{
return (Math.sqrt(((((_arg1.w * _arg1.w) + (_arg1.x * _arg1.x)) + (_arg1.y * _arg1.y)) + (_arg1.z * _arg1.z))));
}
public static function euler2quaternion(_arg1:Number, _arg2:Number, _arg3:Number):Object{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Object;
_local4 = Math.sin((_arg1 * 0.5));
_local5 = Math.cos((_arg1 * 0.5));
_local6 = Math.sin((_arg2 * 0.5));
_local7 = Math.cos((_arg2 * 0.5));
_local8 = Math.sin((_arg3 * 0.5));
_local9 = Math.cos((_arg3 * 0.5));
_local10 = (_local5 * _local7);
_local11 = (_local4 * _local6);
_local12 = new Object();
_local12.x = ((_local8 * _local10) - (_local9 * _local11));
_local12.y = (((_local9 * _local4) * _local7) + ((_local8 * _local5) * _local6));
_local12.z = (((_local9 * _local5) * _local6) - ((_local8 * _local4) * _local7));
_local12.w = ((_local9 * _local10) + (_local8 * _local11));
return (_local12);
}
public static function rotationX(_arg1:Number):Matrix3D{
var _local2:Matrix3D;
var _local3:Number;
var _local4:Number;
_local2 = IDENTITY;
_local3 = Math.cos(_arg1);
_local4 = Math.sin(_arg1);
_local2.n22 = _local3;
_local2.n23 = -(_local4);
_local2.n32 = _local4;
_local2.n33 = _local3;
return (_local2);
}
public static function rotationY(_arg1:Number):Matrix3D{
var _local2:Matrix3D;
var _local3:Number;
var _local4:Number;
_local2 = IDENTITY;
_local3 = Math.cos(_arg1);
_local4 = Math.sin(_arg1);
_local2.n11 = _local3;
_local2.n13 = -(_local4);
_local2.n31 = _local4;
_local2.n33 = _local3;
return (_local2);
}
public static function rotationZ(_arg1:Number):Matrix3D{
var _local2:Matrix3D;
var _local3:Number;
var _local4:Number;
_local2 = IDENTITY;
_local3 = Math.cos(_arg1);
_local4 = Math.sin(_arg1);
_local2.n11 = _local3;
_local2.n12 = -(_local4);
_local2.n21 = _local4;
_local2.n22 = _local3;
return (_local2);
}
public static function clone(_arg1:Matrix3D):Matrix3D{
return (new Matrix3D([_arg1.n11, _arg1.n12, _arg1.n13, _arg1.n14, _arg1.n21, _arg1.n22, _arg1.n23, _arg1.n24, _arg1.n31, _arg1.n32, _arg1.n33, _arg1.n34]));
}
public static function rotationMatrix(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Matrix3D{
var _local5:Matrix3D;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
_local5 = IDENTITY;
_local6 = Math.cos(_arg4);
_local7 = Math.sin(_arg4);
_local8 = (1 - _local6);
_local9 = ((_arg1 * _arg2) * _local8);
_local10 = ((_arg2 * _arg3) * _local8);
_local11 = ((_arg1 * _arg3) * _local8);
_local12 = (_local7 * _arg3);
_local13 = (_local7 * _arg2);
_local14 = (_local7 * _arg1);
_local5.n11 = (_local6 + ((_arg1 * _arg1) * _local8));
_local5.n12 = (-(_local12) + _local9);
_local5.n13 = (_local13 + _local11);
_local5.n21 = (_local12 + _local9);
_local5.n22 = (_local6 + ((_arg2 * _arg2) * _local8));
_local5.n23 = (-(_local14) + _local10);
_local5.n31 = (-(_local13) + _local11);
_local5.n32 = (_local14 + _local10);
_local5.n33 = (_local6 + ((_arg3 * _arg3) * _local8));
return (_local5);
}
public static function add(_arg1:Matrix3D, _arg2:Matrix3D):Matrix3D{
var _local3:Matrix3D;
_local3 = new (Matrix3D);
_local3.(_arg1, _arg2);
return (_local3);
}
public static function rotateAxis(_arg1:Matrix3D, _arg2:Number3D):void{
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local3 = _arg2.x;
_local4 = _arg2.y;
_local5 = _arg2.z;
_arg2.x = (((_local3 * _arg1.n11) + (_local4 * _arg1.n12)) + (_local5 * _arg1.n13));
_arg2.y = (((_local3 * _arg1.n21) + (_local4 * _arg1.n22)) + (_local5 * _arg1.n23));
_arg2.z = (((_local3 * _arg1.n31) + (_local4 * _arg1.n32)) + (_local5 * _arg1.n33));
_arg2.normalize();
}
public static function multiply(_arg1:Matrix3D, _arg2:Matrix3D):Matrix3D{
var _local3:Matrix3D;
_local3 = new (Matrix3D);
_local3.calculateMultiply(_arg1, _arg2);
return (_local3);
}
public static function multiplyQuaternion(_arg1:Object, _arg2:Object):Object{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Object;
_local3 = _arg1.x;
_local4 = _arg1.y;
_local5 = _arg1.z;
_local6 = _arg1.w;
_local7 = _arg2.x;
_local8 = _arg2.y;
_local9 = _arg2.z;
_local10 = _arg2.w;
_local11 = new Object();
_local11.x = ((((_local6 * _local7) + (_local3 * _local10)) + (_local4 * _local9)) - (_local5 * _local8));
_local11.y = ((((_local6 * _local8) + (_local4 * _local10)) + (_local5 * _local7)) - (_local3 * _local9));
_local11.z = ((((_local6 * _local9) + (_local5 * _local10)) + (_local3 * _local8)) - (_local4 * _local7));
_local11.w = ((((_local6 * _local10) - (_local3 * _local7)) - (_local4 * _local8)) - (_local5 * _local9));
return (_local11);
}
public static function euler2matrix(_arg1:Number3D):Matrix3D{
var _local2:Matrix3D;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
_local2 = IDENTITY;
_local3 = (_arg1.x * toRADIANS);
_local4 = (_arg1.y * toRADIANS);
_local5 = (_arg1.z * toRADIANS);
_local6 = Math.cos(_local3);
_local7 = Math.sin(_local3);
_local8 = Math.cos(_local4);
_local9 = Math.sin(_local4);
_local10 = Math.cos(_local5);
_local11 = Math.sin(_local5);
_local12 = (_local6 * _local9);
_local13 = (_local7 * _local9);
_local2.n11 = (_local8 * _local10);
_local2.n12 = (-(_local8) * _local11);
_local2.n13 = _local9;
_local2.n21 = ((_local13 * _local10) + (_local6 * _local11));
_local2.n22 = ((-(_local13) * _local11) + (_local6 * _local10));
_local2.n23 = (-(_local7) * _local8);
_local2.n31 = ((-(_local12) * _local10) + (_local7 * _local11));
_local2.n32 = ((_local12 * _local11) + (_local7 * _local10));
_local2.n33 = (_local6 * _local8);
return (_local2);
}
public static function scaleMatrix(_arg1:Number, _arg2:Number, _arg3:Number):Matrix3D{
var _local4:Matrix3D;
_local4 = IDENTITY;
_local4.n11 = _arg1;
_local4.n22 = _arg2;
_local4.n33 = _arg3;
return (_local4);
}
public static function quaternion2matrix(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Matrix3D{
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Matrix3D;
_local5 = (_arg1 * _arg1);
_local6 = (_arg1 * _arg2);
_local7 = (_arg1 * _arg3);
_local8 = (_arg1 * _arg4);
_local9 = (_arg2 * _arg2);
_local10 = (_arg2 * _arg3);
_local11 = (_arg2 * _arg4);
_local12 = (_arg3 * _arg3);
_local13 = (_arg3 * _arg4);
_local14 = IDENTITY;
_local14.n11 = (1 - (2 * (_local9 + _local12)));
_local14.n12 = (2 * (_local6 - _local13));
_local14.n13 = (2 * (_local7 + _local11));
_local14.n21 = (2 * (_local6 + _local13));
_local14.n22 = (1 - (2 * (_local5 + _local12)));
_local14.n23 = (2 * (_local10 - _local8));
_local14.n31 = (2 * (_local7 - _local11));
_local14.n32 = (2 * (_local10 + _local8));
_local14.n33 = (1 - (2 * (_local5 + _local9)));
return (_local14);
}
public static function inverse(_arg1:Matrix3D):Matrix3D{
var _local2:Matrix3D;
_local2 = new (Matrix3D);
_local2.
(_arg1);
return (_local2);
}
public static function matrix2euler(_arg1:Matrix3D):Number3D{
var _local2:Number3D;
var _local3:Number3D;
var _local4:Number3D;
var _local5:Number3D;
var _local6:Matrix3D;
var _local7:Matrix3D;
var _local8:Matrix3D;
var _local9:Number;
_local2 = new Number3D();
_local3 = new Number3D(_arg1.n11, _arg1.n21, _arg1.n31);
_local4 = new Number3D(_arg1.n12, _arg1.n22, _arg1.n32);
_local5 = new Number3D(_arg1.n13, _arg1.n23, _arg1.n33);
_local3.normalize();
_local4.normalize();
_local5.normalize();
_local6 = new Matrix3D([_local3.x, _local4.x, _local5.x, 0, _local3.y, _local4.y, _local5.y, 0, _local3.z, _local4.z, _local5.z, 0]);
_local2.x = Math.atan2(_local6.n23, _local6.n33);
_local7 = Matrix3D.rotationX(-(_local2.x));
_local8 = Matrix3D.multiply(_local7, _local6);
_local9 = Math.sqrt(((_local8.n11 * _local8.n11) + (_local8.n21 * _local8.n21)));
_local2.y = Math.atan2(-(_local8.n31), _local9);
_local2.z = Math.atan2(-(_local8.n12), _local8.n11);
if (_local2.x == Math.PI){
if (_local2.y > 0){
_local2.y = (_local2.y - Math.PI);
} else {
_local2.y = (_local2.y + Math.PI);
};
_local2.x = 0;
_local2.z = (_local2.z + Math.PI);
};
_local2.x = (_local2.x * toDEGREES);
_local2.y = (_local2.y * toDEGREES);
_local2.z = (_local2.z * toDEGREES);
return (_local2);
}
public static function get IDENTITY():Matrix3D{
return (new Matrix3D([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0]));
}
}
}//package org.papervision3d.core
Section 28
//Number3D (org.papervision3d.core.Number3D)
package org.papervision3d.core {
public class Number3D {
public var x:Number;
public var y:Number;
public var z:Number;
public function Number3D(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0){
this.x = _arg1;
this.y = _arg2;
this.z = _arg3;
}
public function toString():String{
return (((((("x:" + x) + " y:") + y) + " z:") + z));
}
public function normalize():void{
var _local1:Number;
_local1 = this.modulo;
if (((!((_local1 == 0))) && (!((_local1 == 1))))){
this.x = (this.x / _local1);
this.y = (this.y / _local1);
this.z = (this.z / _local1);
};
}
public function get modulo():Number{
return (Math.sqrt((((this.x * this.x) + (this.y * this.y)) + (this.z * this.z))));
}
public function copyTo(_arg1:Number3D):void{
_arg1.x = x;
_arg1.y = y;
_arg1.z = z;
}
public function clone():Number3D{
return (new Number3D(this.x, this.y, this.z));
}
public static function sub(_arg1:Number3D, _arg2:Number3D):Number3D{
return (new Number3D((_arg1.x - _arg2.x), (_arg1.y - _arg2.y), (_arg1.z - _arg2.z)));
}
public static function add(_arg1:Number3D, _arg2:Number3D):Number3D{
return (new Number3D((_arg1.x + _arg2.x), (_arg1.y + _arg2.y), (_arg1.z + _arg2.z)));
}
public static function cross(_arg1:Number3D, _arg2:Number3D):Number3D{
return (new Number3D(((_arg2.y * _arg1.z) - (_arg2.z * _arg1.y)), ((_arg2.z * _arg1.x) - (_arg2.x * _arg1.z)), ((_arg2.x * _arg1.y) - (_arg2.y * _arg1.x))));
}
public static function get ZERO():Number3D{
return (new Number3D(0, 0, 0));
}
public static function dot(_arg1:Number3D, _arg2:Number3D):Number{
return ((((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)) + (_arg2.z * _arg1.z)));
}
}
}//package org.papervision3d.core
Section 29
//NumberUV (org.papervision3d.core.NumberUV)
package org.papervision3d.core {
public class NumberUV {
public var u:Number;
public var v:Number;
public function NumberUV(_arg1:Number=0, _arg2:Number=0){
this.u = _arg1;
this.v = _arg2;
}
public function toString():String{
return (((("u:" + u) + " v:") + v));
}
public function clone():NumberUV{
return (new NumberUV(this.u, this.v));
}
public static function get ZERO():NumberUV{
return (new NumberUV(0, 0));
}
}
}//package org.papervision3d.core
Section 30
//InteractiveScene3DEvent (org.papervision3d.events.InteractiveScene3DEvent)
package org.papervision3d.events {
import flash.display.*;
import flash.events.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.utils.*;
public class InteractiveScene3DEvent extends Event {
public var :Sprite;// = null
public var interactiveContainerData:InteractiveContainerData;// = null
public var displayObject3D:DisplayObject3D;// = null
public var face3d:Face3D;// = null
public static const OBJECT_ADDED:String = "objectAdded";
public static const OBJECT_PRESS:String = "mousePress";
public static const OBJECT_RELEASE:String = "mouseRelease";
public static const OBJECT_CLICK:String = "mouseClick";
public static const OBJECT_RELEASE_OUTSIDE:String = "mouseReleaseOutside";
public static const OBJECT_OUT:String = "mouseOut";
public static const OBJECT_MOVE:String = "mouseMove";
public static const OBJECT_OVER:String = "mouseOver";
public function InteractiveScene3DEvent(_arg1:String, _arg2:DisplayObject3D=null, _arg3:Sprite=null, _arg4:Face3D=null, _arg5:InteractiveContainerData=null, _arg6:Boolean=false, _arg7:Boolean=false){
displayObject3D = null;
= null;
face3d = null;
interactiveContainerData = null;
super(_arg1, _arg6, _arg7);
this.displayObject3D = _arg2;
this. = _arg3;
this.face3d = _arg4;
this.interactiveContainerData = _arg5;
}
}
}//package org.papervision3d.events
Section 31
//BitmapAssetMaterial (org.papervision3d.materials.BitmapAssetMaterial)
package org.papervision3d.materials {
import flash.display.*;
import flash.utils.*;
import org.papervision3d.*;
public class BitmapAssetMaterial extends BitmapMaterial {
private static var _library:Object = new Object();
private static var _count:Object = new Object();
public function BitmapAssetMaterial(_arg1:String){
texture = _arg1;
}
override public function get texture():Object{
return (this._texture);
}
override public function set texture(_arg1:Object):void{
if ((_arg1 is String) == false){
Papervision3D.log("Error: BitmapMaterial.texture requires a BitmapData object for the texture");
return;
};
bitmap = (String(_arg1));
_texture = _arg1;
}
protected function (_arg1:String):BitmapData{
var _local2:BitmapData;
var _local3:BitmapData;
var _local4:BitmapData;
var _local5:Class;
var _local6:XML;
if (this._texture != _arg1){
var _local7 = _count;
var _local8 = this._texture;
var _local9 = (_local7[_local8] - 1);
_local7[_local8] = _local9;
_local4 = _library[this._texture];
if (((_local4) && ((_count[this._texture] == 0)))){
_local4.dispose();
};
};
_local3 = _library[_arg1];
if (!_local3){
_local5 = (getDefinitionByName(_arg1) as Class);
_local6 = describeType(_local5);
if (_local6..constructor.length() == 0){
_local3 = (new (_local5) as BitmapData);
} else {
_local3 = (new _local5(0, 0) as BitmapData);
};
_local2 = createBitmap(_local3);
_library[_arg1] = _local2;
_count[_arg1] = 0;
} else {
_local2 = _local3;
maxU = (maxV = 1);
_local7 = _count;
_local8 = _arg1;
_local9 = (_local7[_local8] + 1);
_local7[_local8] = _local9;
};
return (_local2);
}
}
}//package org.papervision3d.materials
Section 32
//BitmapMaterial (org.papervision3d.materials.BitmapMaterial)
package org.papervision3d.materials {
import flash.display.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.*;
import flash.geom.*;
import flash.utils.*;
import org.papervision3d.core.draw.*;
import org.papervision3d.*;
public class BitmapMaterial extends MaterialObject3D implements IFaceDrawer {
public var
:Dictionary;
protected var _texture:Object;
public static var AUTO_MIP_MAPPING:Boolean = false;
protected static var _localMatrix:Matrix = new Matrix();
public static var MIP_MAP_DEPTH:Number = 8;
protected static var _triMatrix:Matrix = new Matrix();
public function BitmapMaterial(_arg1:BitmapData=null){
= new Dictionary();
super();
if (_arg1){
texture = _arg1;
};
}
override public function drawFace3D(_arg1:DisplayObject3D, _arg2:Face3D, _arg3:Graphics, _arg4:Vertex2D, _arg5:Vertex2D, _arg6:Vertex2D):int{
var _local7:Matrix;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
if (lineAlpha){
_arg3.lineStyle(0, lineColor, lineAlpha);
};
if (bitmap){
_local7 = ((
[_arg2]) || (transformUV(_arg2, _arg1)));
_local8 = _arg4.x;
_local9 = _arg4.y;
_local10 = _arg5.x;
_local11 = _arg5.y;
_local12 = _arg6.x;
_local13 = _arg6.y;
_triMatrix.a = (_local10 - _local8);
_triMatrix.b = (_local11 - _local9);
_triMatrix.c = (_local12 - _local8);
_triMatrix.d = (_local13 - _local9);
_triMatrix.tx = _local8;
_triMatrix.ty = _local9;
_localMatrix.a = _local7.a;
_localMatrix.b = _local7.b;
_localMatrix.c = _local7.c;
_localMatrix.d = _local7.d;
_localMatrix.tx = _local7.tx;
_localMatrix.ty = _local7.ty;
_localMatrix.concat(_triMatrix);
_arg3.beginBitmapFill(bitmap, _localMatrix, tiled, smooth);
};
_arg3.moveTo(_local8, _local9);
_arg3.lineTo(_local10, _local11);
_arg3.lineTo(_local12, _local13);
_arg3.lineTo(_local8, _local9);
if (bitmap){
_arg3.endFill();
};
if (lineAlpha){
_arg3.lineStyle();
};
return (1);
}
public function ():void{
= new Dictionary();
}
public function transformUV(_arg1:Face3D, _arg2:DisplayObject3D=null):Matrix{
var _local3:Array;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Matrix;
var _local17:Matrix;
if (!_arg1.uv){
Papervision3D.log("MaterialObject3D: transformUV() uv not found!");
} else {
if (bitmap){
_local3 = _arg1.uv;
_local4 = (bitmap.width * maxU);
_local5 = (bitmap.height * maxV);
_local6 = (_local4 * _local3[0].u);
_local7 = (_local5 * (1 - _local3[0].v));
_local8 = (_local4 * _local3[1].u);
_local9 = (_local5 * (1 - _local3[1].v));
_local10 = (_local4 * _local3[2].u);
_local11 = (_local5 * (1 - _local3[2].v));
if ((((((_local6 == _local8)) && ((_local7 == _local9)))) || ((((_local6 == _local10)) && ((_local7 == _local11)))))){
_local6 = (_local6 - ((_local6)>0.05) ? 0.05 : -0.05);
_local7 = (_local7 - ((_local7)>0.07) ? 0.07 : -0.07);
};
if ((((_local10 == _local8)) && ((_local11 == _local9)))){
_local10 = (_local10 - ((_local10)>0.05) ? 0.04 : -0.04);
_local11 = (_local11 - ((_local11)>0.06) ? 0.06 : -0.06);
};
_local12 = (_local8 - _local6);
_local13 = (_local9 - _local7);
_local14 = (_local10 - _local6);
_local15 = (_local11 - _local7);
_local16 = new Matrix(_local12, _local13, _local14, _local15, _local6, _local7);
_local16.invert();
_local17 = ((
[_arg1]) || ((
[_arg1] = _local16.clone())));
_local17.a = _local16.a;
_local17.b = _local16.b;
_local17.c = _local16.c;
_local17.d = _local16.d;
_local17.tx = _local16.tx;
_local17.ty = _local16.ty;
} else {
Papervision3D.log("MaterialObject3D: transformUV() material.bitmap not found!");
};
};
return (_local17);
}
public function get texture():Object{
return (this._texture);
}
protected function (_arg1:BitmapData):BitmapData{
var _local2:BitmapData;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Boolean;
_local3 = (1 << MIP_MAP_DEPTH);
_local4 = (_arg1.width / _local3);
_local4 = ((_local4 == uint(_local4))) ? _local4 : (uint(_local4) + 1);
_local5 = (_arg1.height / _local3);
_local5 = ((_local5 == uint(_local5))) ? _local5 : (uint(_local5) + 1);
_local6 = (_local3 * _local4);
_local7 = (_local3 * _local5);
_local8 = true;
if (_local6 > 2880){
_local6 = _arg1.width;
_local8 = false;
};
if (_local7 > 2880){
_local7 = _arg1.height;
_local8 = false;
};
if (!_local8){
Papervision3D.log((("Material " + this.name) + ": Texture too big for mip mapping. Resizing recommended for better performance and quality."));
};
if (((_arg1) && (((!(((_arg1.width % _local3) == 0))) || (!(((_arg1.height % _local3) == 0))))))){
_local2 = new BitmapData(_local6, _local7, _arg1.transparent, 0);
widthOffset = _arg1.width;
heightOffset = _arg1.height;
this.maxU = (_arg1.width / _local6);
this.maxV = (_arg1.height / _local7);
_local2.draw(_arg1);
(_local2, _arg1.width, _arg1.height);
} else {
this.maxU = (this.maxV = 1);
_local2 = _arg1;
};
return (_local2);
}
public function set texture(_arg1:Object):void{
if ((_arg1 is BitmapData) == false){
Papervision3D.log("Error: BitmapMaterial.texture requires a BitmapData object for the texture");
return;
};
bitmap = createBitmap(BitmapData(_arg1));
_texture = _arg1;
}
protected function createBitmap(_arg1:BitmapData):BitmapData{
();
if (AUTO_MIP_MAPPING){
return ((_arg1));
};
this.maxU = (this.maxV = 1);
return (_arg1);
}
override public function toString():String{
return (((((("Texture:" + this.texture) + " lineColor:") + this.lineColor) + " lineAlpha:") + this.lineAlpha));
}
override public function copy(_arg1:MaterialObject3D):void{
super.copy(_arg1);
this.maxU = _arg1.maxU;
this.maxV = _arg1.maxV;
}
protected function (_arg1:BitmapData, _arg2:Number, _arg3:Number):void{
var _local4:Rectangle;
var _local5:Point;
var _local6:int;
_local4 = new Rectangle();
_local5 = new Point();
if (_arg1.width > _arg2){
_local4.x = (_arg2 - 1);
_local4.y = 0;
_local4.width = 1;
_local4.height = _arg3;
_local5.y = 0;
_local6 = _arg2;
while (_local6 < _arg1.width) {
_local5.x = _local6;
_arg1.copyPixels(_arg1, _local4, _local5);
_local6++;
};
};
if (_arg1.height > _arg3){
_local4.x = 0;
_local4.y = (_arg3 - 1);
_local4.width = _arg1.width;
_local4.height = 1;
_local5.x = 0;
_local6 = _arg3;
while (_local6 < _arg1.height) {
_local5.y = _local6;
_arg1.copyPixels(_arg1, _local4, _local5);
_local6++;
};
};
}
override public function clone():MaterialObject3D{
var _local1:MaterialObject3D;
_local1 = super.clone();
_local1.maxU = this.maxU;
_local1.maxV = this.maxV;
return (_local1);
}
}
}//package org.papervision3d.materials
Section 33
//ColorMaterial (org.papervision3d.materials.ColorMaterial)
package org.papervision3d.materials {
import flash.display.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.core.draw.*;
public class ColorMaterial extends MaterialObject3D implements IFaceDrawer {
public function ColorMaterial(_arg1:Number=0xFF00FF, _arg2:Number=1, _arg3:Object=null){
this.fillColor = _arg1;
this.fillAlpha = _arg2;
}
override public function drawFace3D(_arg1:DisplayObject3D, _arg2:Face3D, _arg3:Graphics, _arg4:Vertex2D, _arg5:Vertex2D, _arg6:Vertex2D):int{
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
_local7 = _arg4.x;
_local8 = _arg4.y;
_local9 = _arg5.x;
_local10 = _arg5.y;
_local11 = _arg6.x;
_local12 = _arg6.y;
_arg3.beginFill(fillColor, fillAlpha);
_arg3.moveTo(_local7, _local8);
_arg3.lineTo(_local9, _local10);
_arg3.lineTo(_local11, _local12);
_arg3.lineTo(_local7, _local8);
_arg3.endFill();
return (1);
}
override public function toString():String{
return (((("ColorMaterial - color:" + this.fillColor) + " alpha:") + this.fillAlpha));
}
}
}//package org.papervision3d.materials
Section 34
//InteractiveMovieMaterial (org.papervision3d.materials.InteractiveMovieMaterial)
package org.papervision3d.materials {
import flash.display.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.*;
public class InteractiveMovieMaterial extends MovieMaterial {
public function InteractiveMovieMaterial(_arg1:Sprite, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
override public function drawFace3D(_arg1:DisplayObject3D, _arg2:Face3D, _arg3:Graphics, _arg4:Vertex2D, _arg5:Vertex2D, _arg6:Vertex2D):int{
var _local7:int;
_local7 = super.drawFace3D(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
if (((!((_arg1.interactiveSceneManager == null))) && (_local7))){
_arg1.interactiveSceneManager.drawFace(_arg1, _arg2, _arg4.x, _arg5.x, _arg6.x, _arg4.y, _arg5.y, _arg6.y);
};
return (_local7);
}
}
}//package org.papervision3d.materials
Section 35
//MaterialsList (org.papervision3d.materials.MaterialsList)
package org.papervision3d.materials {
import org.papervision3d.core.proto.*;
import flash.utils.*;
public class MaterialsList {
public var materialsByName:Dictionary;
protected var :Dictionary;
private var :int;
public function MaterialsList(_arg1=null):void{
var _local2:String;
var _local3:String;
super();
this.materialsByName = new Dictionary(true);
this. = new Dictionary(false);
this. = 0;
if (_arg1){
if ((_arg1 is Array)){
for (_local2 in _arg1) {
this.(_arg1[_local2]);
};
} else {
if ((_arg1 is Object)){
for (_local3 in _arg1) {
this.(_arg1[_local3], _local3);
};
};
};
};
}
public function get numMaterials():int{
return (this.);
}
public function (_arg1:MaterialObject3D, _arg2:String=null):MaterialObject3D{
_arg2 = ((((_arg2) || (_arg1.name))) || (String(_arg1.id)));
this.[_arg1] = _arg2;
this.materialsByName[_arg2] = _arg1;
this.++;
return (_arg1);
}
public function (_arg1:MaterialObject3D):MaterialObject3D{
delete this.materialsByName[this.[_arg1]];
delete this.[_arg1];
return (_arg1);
}
public function toString():String{
var _local1:String;
var _local2:MaterialObject3D;
_local1 = "";
for each (_local2 in this.materialsByName) {
_local1 = (_local1 + (this.[_local2] + "\n"));
};
return (_local1);
}
public function
(_arg1:String):MaterialObject3D{
return ((getMaterialByName(_arg1)));
}
public function clone():MaterialsList{
var _local1:MaterialsList;
var _local2:MaterialObject3D;
_local1 = new MaterialsList();
for each (_local2 in this.materialsByName) {
_local1.(_local2.clone(), this.[_local2]);
};
return (_local1);
}
public function getMaterialByName(_arg1:String):MaterialObject3D{
return ((this.materialsByName[_arg1]) ? this.materialsByName[_arg1] : this.materialsByName["all"]);
}
}
}//package org.papervision3d.materials
Section 36
//MovieMaterial (org.papervision3d.materials.MovieMaterial)
package org.papervision3d.materials {
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import org.papervision3d.*;
public class MovieMaterial extends BitmapMaterial {
public var :Boolean;
public var :Boolean;// = true
public var movie:DisplayObject;
private static var animatedMaterials:Dictionary = new Dictionary(false);
public function MovieMaterial(_arg1:DisplayObject=null, _arg2:Boolean=false, _arg3:Boolean=false){
= true;
super();
= _arg2;
this.animated = _arg3;
if (_arg1){
texture = _arg1;
};
}
public function ():void{
var _local1:Matrix;
bitmap.fillRect(bitmap.rect, this.fillColor);
_local1 = new Matrix();
_local1.scale(movie.scaleX, movie.scaleY);
bitmap.draw(movie, _local1, movie.transform.colorTransform);
}
override public function get texture():Object{
return (this._texture);
}
public function get animated():Boolean{
return (animatedMaterials[this]);
}
override public function set texture(_arg1:Object):void{
if ((_arg1 is DisplayObject) == false){
Papervision3D.log("Error: MovieMaterial.texture requires a Sprite to be passed as the object");
return;
};
bitmap = (DisplayObject(_arg1));
_texture = _arg1;
}
protected function (_arg1:DisplayObject):BitmapData{
movie = _arg1;
(movie);
();
bitmap = super.createBitmap(bitmap);
return (bitmap);
}
public function set animated(_arg1:Boolean):void{
animatedMaterials[this] = _arg1;
}
override public function updateBitmap():void{
var _local1:int;
var _local2:int;
_local1 = int(movie.width);
_local2 = int(movie.height);
if ((() && (((!((_local1 == bitmap.width))) || (!((_local2 == bitmap.height))))))){
(movie);
};
();
}
protected function (_arg1:DisplayObject):void{
if (bitmap){
bitmap.dispose();
};
bitmap = new BitmapData(_arg1.width, _arg1.height, this.);
}
public static function updateAnimatedBitmaps():void{
var _local1:Object;
for (_local1 in animatedMaterials) {
if (animatedMaterials[_local1]){
_local1.updateBitmap();
};
};
}
}
}//package org.papervision3d.materials
Section 37
//WireframeMaterial (org.papervision3d.materials.WireframeMaterial)
package org.papervision3d.materials {
import flash.display.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.core.draw.*;
public class WireframeMaterial extends MaterialObject3D implements IFaceDrawer {
public function WireframeMaterial(_arg1:Number=0xFF00FF, _arg2:Number=100){
this.lineColor = _arg1;
this.lineAlpha = _arg2;
this.doubleSided = false;
}
override public function drawFace3D(_arg1:DisplayObject3D, _arg2:Face3D, _arg3:Graphics, _arg4:Vertex2D, _arg5:Vertex2D, _arg6:Vertex2D):int{
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
_local7 = _arg4.x;
_local8 = _arg4.y;
_local9 = _arg5.x;
_local10 = _arg5.y;
_local11 = _arg6.x;
_local12 = _arg6.y;
if (lineAlpha){
_arg3.lineStyle(0, lineColor, lineAlpha);
_arg3.moveTo(_local7, _local8);
_arg3.lineTo(_local9, _local10);
_arg3.lineTo(_local11, _local12);
_arg3.lineTo(_local7, _local8);
_arg3.lineStyle();
return (1);
};
return (0);
}
override public function toString():String{
return (((("WireframeMaterial - color:" + this.lineColor) + " alpha:") + this.lineAlpha));
}
}
}//package org.papervision3d.materials
Section 38
//Cube (org.papervision3d.objects.Cube)
package org.papervision3d.objects {
import org.papervision3d.core.proto.*;
import org.papervision3d.materials.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.core.*;
import org.papervision3d.*;
public class Cube extends Mesh3D {
private var :int;
public var
:Number3D;
private var :int;
public static var ALL:int = (((((FRONT + BACK) + RIGHT) + LEFT) + TOP) + BOTTOM);
public static var LEFT:int = 8;
public static var FRONT:int = 1;
public static var BOTTOM:int = 32;
public static var TOP:int = 16;
public static var BACK:int = 2;
public static var NONE:int = 0;
public static var RIGHT:int = 4;
public function Cube(_arg1:MaterialsList, _arg2:Number=500, _arg3:Number=500, _arg4:Number=500, _arg5:int=1, _arg6:int=1, _arg7:int=1, _arg8:int=0, _arg9:int=0, _arg10:Object=null){
super(_arg1.getMaterialByName("all"), new Array(), new Array(), null, _arg10);
this.materials = _arg1;
this. = _arg8;
this. = _arg9;
= new Number3D(_arg5, _arg6, _arg7);
(_arg2, _arg4, _arg3);
}
private function (_arg1:String, _arg2:String, _arg3:String, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Boolean=false):void{
var _local8:MaterialObject3D;
var _local9:String;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Array;
var _local16:Array;
var _local17:Array;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:int;
var _local23:NumberUV;
var _local24:NumberUV;
var _local25:NumberUV;
var _local26:int;
var _local27:Vertex3D;
var _local28:Vertex3D;
var _local29:Vertex3D;
var _local30:Vertex3D;
_local8 = materials.getMaterialByName(_arg1);
if (!_local8){
_local8 = materials.getMaterialByName("all");
if (!_local8){
Papervision3D.log("Cube: Required material not found in given materials list. Supported materials are: front, back, right, left, top, bottom & all.");
return;
};
};
if ((((((_arg2 == "x")) && ((_arg3 == "y")))) || ((((_arg2 == "y")) && ((_arg3 == "x")))))){
_local9 = "z";
} else {
if ((((((_arg2 == "x")) && ((_arg3 == "z")))) || ((((_arg2 == "z")) && ((_arg3 == "x")))))){
_local9 = "y";
} else {
if ((((((_arg2 == "z")) && ((_arg3 == "y")))) || ((((_arg2 == "y")) && ((_arg3 == "z")))))){
_local9 = "x";
};
};
};
_local10 = (_arg7) ? -1 : 1;
_local11 = this.
[_arg2];
_local12 = this.
[_arg3];
_local13 = (_local11 + 1);
_local14 = (_local12 + 1);
_local15 = this.geometry.vertices;
_local16 = this.geometry.faces;
_local17 = new Array();
_local18 = (_arg4 / 2);
_local19 = (_arg5 / 2);
_local20 = (_arg4 / _local11);
_local21 = (_arg5 / _local12);
_local22 = 0;
while (_local22 < _local13) {
_local26 = 0;
while (_local26 < _local14) {
_local27 = new Vertex3D();
_local27[_arg2] = (((_local22 * _local20) - _local18) * _local10);
_local27[_arg3] = ((_local26 * _local21) - _local19);
_local27[_local9] = _arg6;
_local15.push(_local27);
_local17.push(_local27);
_local26++;
};
_local22++;
};
_local22 = 0;
while (_local22 < _local11) {
_local26 = 0;
while (_local26 < _local12) {
_local28 = _local17[((_local22 * _local14) + _local26)];
_local29 = _local17[((_local22 * _local14) + (_local26 + 1))];
_local30 = _local17[(((_local22 + 1) * _local14) + _local26)];
_local23 = new NumberUV((_local22 / _local11), (_local26 / _local12));
_local24 = new NumberUV((_local22 / _local11), ((_local26 + 1) / _local12));
_local25 = new NumberUV(((_local22 + 1) / _local11), (_local26 / _local12));
_local16.push(new Face3D([_local28, _local30, _local29], _local8, [_local23, _local25, _local24]));
_local28 = _local17[(((_local22 + 1) * _local14) + (_local26 + 1))];
_local29 = _local17[(((_local22 + 1) * _local14) + _local26)];
_local30 = _local17[((_local22 * _local14) + (_local26 + 1))];
_local23 = new NumberUV(((_local22 + 1) / _local11), ((_local26 + 1) / _local12));
_local24 = new NumberUV(((_local22 + 1) / _local11), (_local26 / _local12));
_local25 = new NumberUV((_local22 / _local11), ((_local26 + 1) / _local12));
_local16.push(new Face3D([_local28, _local30, _local29], _local8, [_local23, _local25, _local24]));
_local26++;
};
_local22++;
};
}
private function (_arg1:Number, _arg2:Number, _arg3:Number):void{
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local4 = (_arg1 / 2);
_local5 = (_arg2 / 2);
_local6 = (_arg3 / 2);
if (!( & FRONT)){
("front", "x", "y", _arg1, _arg2, _local6, !(Boolean(( & FRONT))));
};
if (!( & BACK)){
("back", "x", "y", _arg1, _arg2, -(_local6), Boolean(( & BACK)));
};
if (!( & RIGHT)){
("right", "z", "y", _arg3, _arg2, _local4, Boolean(( & RIGHT)));
};
if (!( & LEFT)){
("left", "z", "y", _arg3, _arg2, -(_local4), !(Boolean(( & LEFT))));
};
if (!( & TOP)){
("top", "x", "z", _arg1, _arg3, _local5, Boolean(( & TOP)));
};
if (!( & BOTTOM)){
("bottom", "x", "z", _arg1, _arg3, -(_local5), !(Boolean(( & BOTTOM))));
};
mergeVertices();
this.geometry.ready = true;
}
}
}//package org.papervision3d.objects
Section 39
//DisplayObject3D (org.papervision3d.objects.DisplayObject3D)
package org.papervision3d.objects {
import flash.display.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.materials.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.core.*;
import com.blitzagency.xray.logger.*;
import org.papervision3d.utils.*;
import org.papervision3d.*;
import org.papervision3d.scenes.*;
public class DisplayObject3D extends DisplayObjectContainer3D {
public var extra:Object;
public var id:int;
private var :Number;
private var
:Number;
private var :Number;
public var material:MaterialObject3D;
public var meshSort:uint;// = 1
public var materials:MaterialsList;
private var
:Boolean;// = false
public var transform:Matrix3D;
public var screenZ:Number;
public var visible:Boolean;
private var :Number;
private var :Number;
private var :Number;
public var geometry:GeometryObject3D;
public var interactiveSceneManager:InteractiveSceneManager;
public var
:Number3D;
public var name:String;
public var container:Sprite;
public var world:Matrix3D;
public var parent:DisplayObjectContainer3D;
public var view:Matrix3D;
protected var :SceneObject3D;// = null
public var faces:Array;
protected var :Boolean;// = false
private var :Boolean;// = false
protected var _sorted:Array;
public static const MESH_SORT_CENTER:uint = 1;
public static const MESH_SORT_CLOSE:uint = 3;
public static const MESH_SORT_FAR:uint = 2;
private static var LEFT:Number3D = new Number3D(-1, 0, 0);
private static var _totalDisplayObjects:int = 0;
private static var UP:Number3D = new Number3D(0, 1, 0);
private static var BACKWARD:Number3D = new Number3D(0, 0, -1);
private static var FORWARD:Number3D = new Number3D(0, 0, 1);
private static var DOWN:Number3D = new Number3D(0, -1, 0);
public static var faceLevelMode:Boolean;
private static var toDEGREES:Number = 57.2957795130823;
private static var toRADIANS:Number = 0.0174532925199433;
private static var RIGHT:Number3D = new Number3D(1, 0, 0);
public function DisplayObject3D(_arg1:String=null, _arg2:GeometryObject3D=null, _arg3:Object=null):void{
var _local4:Number;
= new Number3D();
= null;
meshSort = MESH_SORT_CENTER;
faces = new Array();
= false;
= false;
= false;
super();
Papervision3D.log(("DisplayObject3D: " + _arg1));
this.transform = Matrix3D.IDENTITY;
this.world = Matrix3D.IDENTITY;
this.view = Matrix3D.IDENTITY;
this.x = (_arg3) ? ((_arg3.x) || (0)) : 0;
this.y = (_arg3) ? ((_arg3.y) || (0)) : 0;
this.z = (_arg3) ? ((_arg3.z) || (0)) : 0;
rotationX = (_arg3) ? ((_arg3.rotationX) || (0)) : 0;
rotationY = (_arg3) ? ((_arg3.rotationY) || (0)) : 0;
rotationZ = (_arg3) ? ((_arg3.rotationZ) || (0)) : 0;
_local4 = (Papervision3D.usePERCENT) ? 100 : 1;
scaleX = (_arg3) ? ((_arg3.scaleX) || (_local4)) : _local4;
scaleY = (_arg3) ? ((_arg3.scaleY) || (_local4)) : _local4;
scaleZ = (_arg3) ? ((_arg3.scaleZ) || (_local4)) : _local4;
if (((_arg3) && (_arg3.extra))){
this.extra = _arg3.extra;
};
if (((_arg3) && (_arg3.container))){
this.container = _arg3.container;
};
this.visible = true;
this.id = _totalDisplayObjects++;
this.name = ((_arg1) || (String(this.id)));
if (_arg2){
(_arg2);
};
}
public function set z(_arg1:Number):void{
this.transform.n34 = _arg1;
}
override public function addChild(_arg1:DisplayObject3D, _arg2:String=null):DisplayObject3D{
_arg1 = super.addChild(_arg1, _arg2);
if (_arg1.scene == null){
_arg1.scene = scene;
};
return (_arg1);
}
public function
(_arg1:Number):void{
(_arg1, DOWN);
}
public function set scene(_arg1:SceneObject3D):void{
var _local2:DisplayObject3D;
= _arg1;
for each (_local2 in this._childrenByName) {
if (_local2.scene == null){
_local2.scene = ;
};
};
if (( is InteractiveScene3D) == false){
return;
};
interactiveSceneManager = InteractiveScene3D().interactiveSceneManager;
}
public function project(_arg1:DisplayObject3D, _arg2:CameraObject3D, _arg3:Array=null):Number{
var _local4:Number;
var _local5:Number;
var _local6:DisplayObject3D;
if (this. ){
();
};
this.view.calculateMultiply(_arg1.view, this.transform);
this.world.calculateMultiply(_arg1.world, this.transform);
(_arg2);
_local4 = 0;
_local5 = 0;
if (!_arg3){
_arg3 = new Array();
this._sorted = _arg3;
};
for each (_local6 in this._childrenByName) {
if (_local6.visible){
_local4 = (_local4 + _local6.project(this, _arg2, _arg3));
_local5++;
};
};
return ((this.screenZ = (_local4 / _local5)));
}
private function (_arg1:CameraObject3D):void{
var _local2:Number;
_local2 = ((_arg1.focus * _arg1.zoom) / (_arg1.focus + view.n34));
.x = (view.n14 * _local2);
.y = (view.n24 * _local2);
.z = view.n34;
}
public function lookAt(_arg1:DisplayObject3D, _arg2:Number3D=null):void{
var _local3:Number3D;
var _local4:Number3D;
var _local5:Number3D;
var _local6:Number3D;
var _local7:Number3D;
var _local8:Matrix3D;
var _local9:XrayLog;
_local3 = new Number3D(this.x, this.y, this.z);
_local4 = new Number3D(_arg1.x, _arg1.y, _arg1.z);
_local5 = Number3D.sub(_local4, _local3);
_local5.normalize();
if (_local5.modulo > 0.1){
_local6 = Number3D.cross(_local5, ((_arg2) || (UP)));
_local6.normalize();
_local7 = Number3D.cross(_local5, _local6);
_local7.normalize();
_local8 = this.transform;
_local8.n11 = (_local6.x * );
_local8.n21 = (_local6.y * );
_local8.n31 = (_local6.z * );
_local8.n12 = (-(_local7.x) * );
_local8.n22 = (-(_local7.y) * );
_local8.n32 = (-(_local7.z) * );
_local8.n13 = (_local5.x * );
_local8.n23 = (_local5.y * );
_local8.n33 = (_local5.z * );
this. = false;
this. = true;
} else {
_local9 = new XrayLog();
_local9.debug("lookAt Error");
};
}
public function set rotationX(_arg1:Number):void{
this. = (Papervision3D.useDEGREES) ? (-(_arg1) * toRADIANS) : -(_arg1);
this. = true;
}
public function set rotationY(_arg1:Number):void{
this. = (Papervision3D.useDEGREES) ? (-(_arg1) * toRADIANS) : -(_arg1);
this. = true;
}
public function set rotationZ(_arg1:Number):void{
this.
= (Papervision3D.useDEGREES) ? (-(_arg1) * toRADIANS) : -(_arg1);
this. = true;
}
public function
(_arg1:GeometryObject3D=null):void{
if (_arg1){
this.geometry = _arg1;
};
}
public function get sceneX():Number{
return (this.world.n14);
}
public function get scaleX():Number{
if (Papervision3D.usePERCENT){
return ((this. * 100));
};
return (this.);
}
public function get scaleY():Number{
if (Papervision3D.usePERCENT){
return ((this. * 100));
};
return (this.);
}
public function get scaleZ():Number{
if (Papervision3D.usePERCENT){
return ((this. * 100));
};
return (this.);
}
public function
(_arg1:Number):void{
(_arg1, UP);
}
public function get sceneZ():Number{
return (this.world.n34);
}
public function
(_arg1:DisplayObject3D):Number{
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local2 = (this.x - _arg1.x);
_local3 = (this.y - _arg1.y);
_local4 = (this.z - _arg1.z);
return (Math.sqrt((((_local2 * _local2) + (_local3 * _local3)) + (_local4 * _local4))));
}
public function get scale():Number{
if ((((this. == this.)) && ((this. == this.)))){
if (Papervision3D.usePERCENT){
return ((this. * 100));
};
return (this.);
//unresolved jump
};
return (NaN);
}
public function get sceneY():Number{
return (this.world.n24);
}
public function
(_arg1:DisplayObject3D, _arg2:Number=1):Boolean{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local3 = (this.x - _arg1.x);
_local4 = (this.y - _arg1.y);
_local5 = (this.z - _arg1.z);
_local6 = (((_local3 * _local3) + (_local4 * _local4)) + (_local5 * _local5));
_local7 = (this.geometry) ? this.geometry.boundingSphere2 : 0;
_local8 = (_arg1.geometry) ? _arg1.geometry.boundingSphere2 : 0;
_local7 = (_local7 * _arg2);
return (((_local7 + _local8) > _local6));
}
public function (_arg1:Number, _arg2:Number3D):void{
var _local3:Number3D;
_local3 = _arg2.clone();
if (this. ){
();
};
Matrix3D.rotateAxis(transform, _local3);
this.x = (this.x + (_arg1 * _local3.x));
this.y = (this.y + (_arg1 * _local3.y));
this.z = (this.z + (_arg1 * _local3.z));
}
private function ():void{
var _local1:Number3D;
_local1 = Matrix3D.matrix2euler(this.transform);
this. = (_local1.x * toRADIANS);
this. = (_local1.y * toRADIANS);
this.
= (_local1.z * toRADIANS);
this. = false;
}
public function pitch(_arg1:Number):void{
var _local2:Number3D;
var _local3:Matrix3D;
_arg1 = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
_local2 = RIGHT.clone();
if (this. ){
();
};
Matrix3D.rotateAxis(transform, _local2);
_local3 = Matrix3D.rotationMatrix(_local2.x, _local2.y, _local2.z, _arg1);
this.transform.calculateMultiply3x3(_local3, transform);
this. = true;
}
public function yaw(_arg1:Number):void{
var _local2:Number3D;
var _local3:Matrix3D;
_arg1 = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
_local2 = UP.clone();
if (this. ){
();
};
Matrix3D.rotateAxis(transform, _local2);
_local3 = Matrix3D.rotationMatrix(_local2.x, _local2.y, _local2.z, _arg1);
this.transform.calculateMultiply3x3(_local3, transform);
this. = true;
}
public function (_arg1):void{
var _local2:Matrix3D;
var _local3:Matrix3D;
_local2 = this.transform;
_local3 = ((_arg1 is DisplayObject3D)) ? _arg1.transform : _arg1;
_local2.n11 = _local3.n11;
_local2.n12 = _local3.n12;
_local2.n13 = _local3.n13;
_local2.n14 = _local3.n14;
_local2.n21 = _local3.n21;
_local2.n22 = _local3.n22;
_local2.n23 = _local3.n23;
_local2.n24 = _local3.n24;
_local2.n31 = _local3.n31;
_local2.n32 = _local3.n32;
_local2.n33 = _local3.n33;
_local2.n34 = _local3.n34;
this. = false;
this. = true;
}
public function get x():Number{
return (this.transform.n14);
}
public function get z():Number{
return (this.transform.n34);
}
override public function toString():String{
return (((((((this.name + ": x:") + Math.round(this.x)) + " y:") + Math.round(this.y)) + " z:") + Math.round(this.z)));
}
public function (_arg1:Number):void{
var _local2:Number3D;
var _local3:Matrix3D;
_arg1 = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
_local2 = FORWARD.clone();
if (this. ){
();
};
Matrix3D.rotateAxis(transform, _local2);
_local3 = Matrix3D.rotationMatrix(_local2.x, _local2.y, _local2.z, _arg1);
this.transform.calculateMultiply3x3(_local3, transform);
this. = true;
}
public function getMaterialByName(_arg1:String):MaterialObject3D{
var _local2:MaterialObject3D;
var _local3:DisplayObject3D;
_local2 = this.materials.getMaterialByName(_arg1);
if (_local2){
return (_local2);
};
for each (_local3 in this._childrenByName) {
_local2 = _local3.getMaterialByName(_arg1);
if (_local2){
return (_local2);
};
};
return (null);
}
public function (_arg1:Number):void{
(_arg1, LEFT);
}
public function get scene():SceneObject3D{
return ();
}
public function get y():Number{
return (this.transform.n24);
}
public function set scale(_arg1:Number):void{
if (Papervision3D.usePERCENT){
_arg1 = (_arg1 / 100);
};
this. = (this. = (this. = _arg1));
this. = true;
}
public function render(_arg1:SceneObject3D):void{
var _local2:Array;
var _local3:Sprite;
var _local4:Number;
var _local5:Face3DInstance;
var _local6:Number;
var _local7:int;
_local2 = this._sorted;
_local2.sortOn("screenZ", (Array.DESCENDING | Array.NUMERIC));
_local3 = ((this.container) || (_arg1.container));
_local4 = 0;
_local6 = _local2.length;
_local7 = 0;
while (_local7 < _local6) {
_local5 = _local2[_local7];
if (faceLevelMode){
if (!_local5.container){
_local5.container = new InteractiveSprite(this);
_arg1.container.addChild(_local5.container);
} else {
_local5.container.graphics.clear();
};
if (_local5.visible){
_local4 = (_local4 + _local5.face.render(_local5.instance, _local5.container));
};
} else {
if (_local5.visible){
_local4 = (_local4 + _local5.face.render(_local5.instance, _local3));
};
};
_local7++;
};
_arg1.stats.rendered = (_arg1.stats.rendered + _local4);
}
public function get rotationY():Number{
if (this.){
();
};
return ((Papervision3D.useDEGREES) ? (-(this.) * toDEGREES) : -(this.));
}
public function get rotationZ():Number{
if (this.){
();
};
return ((Papervision3D.useDEGREES) ? (-(this.
) * toDEGREES) : -(this.
));
}
public function set scaleY(_arg1:Number):void{
if (Papervision3D.usePERCENT){
this. = (_arg1 / 100);
} else {
this. = _arg1;
};
this. = true;
}
public function set scaleZ(_arg1:Number):void{
if (Papervision3D.usePERCENT){
this. = (_arg1 / 100);
} else {
this. = _arg1;
};
this. = true;
}
public function get rotationX():Number{
if (this.){
();
};
return ((Papervision3D.useDEGREES) ? (-(this.) * toDEGREES) : -(this.));
}
public function set scaleX(_arg1:Number):void{
if (Papervision3D.usePERCENT){
this. = (_arg1 / 100);
} else {
this. = _arg1;
};
this. = true;
}
protected function ():void{
var _local1:Object;
var _local2:Matrix3D;
var _local3:Matrix3D;
var _local4:Matrix3D;
_local1 = Matrix3D.euler2quaternion(-(this.), -(this.
), this.);
_local2 = Matrix3D.quaternion2matrix(_local1.x, _local1.y, _local1.z, _local1.w);
_local3 = this.transform;
_local2.n14 = _local3.n14;
_local2.n24 = _local3.n24;
_local2.n34 = _local3.n34;
_local3.copy(_local2);
_local4 = Matrix3D.IDENTITY;
_local4.n11 = this.;
_local4.n22 = this.;
_local4.n33 = this.;
this.transform.calculateMultiply(_local3, _local4);
this. = false;
}
public function (_arg1:Number):void{
(_arg1, FORWARD);
}
public function (_arg1):void{
var _local2:Matrix3D;
var _local3:Matrix3D;
_local2 = this.transform;
_local3 = ((_arg1 is DisplayObject3D)) ? _arg1.transform : _arg1;
_local2.n14 = _local3.n14;
_local2.n24 = _local3.n24;
_local2.n34 = _local3.n34;
}
public function (_arg1:Number, _arg2:Number, _arg3:Number):Boolean{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local4 = (this.x - _arg1);
_local5 = (this.y - _arg2);
_local6 = (this.z - _arg3);
_local7 = (((_arg1 * _arg1) + (_arg2 * _arg2)) + (_arg3 * _arg3));
_local8 = (this.geometry) ? this.geometry.boundingSphere2 : 0;
return ((_local8 > _local7));
}
public function (_arg1:Number):void{
(_arg1, RIGHT);
}
public function (_arg1:Number):void{
(_arg1, BACKWARD);
}
public function
():String{
var _local1:String;
var _local2:String;
var _local3:DisplayObject3D;
_local1 = "";
for (_local2 in this.materials) {
_local1 = (_local1 + (_local2 + "\n"));
};
for each (_local3 in this._childrenByName) {
for (_local2 in _local3.materials.materialsByName) {
_local1 = (_local1 + (("+ " + _local2) + "\n"));
};
};
return (_local1);
}
public function set x(_arg1:Number):void{
this.transform.n14 = _arg1;
}
public function set y(_arg1:Number):void{
this.transform.n24 = _arg1;
}
public static function get ZERO():DisplayObject3D{
return (new (DisplayObject3D));
}
}
}//package org.papervision3d.objects
Section 40
//Plane (org.papervision3d.objects.Plane)
package org.papervision3d.objects {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.core.*;
public class Plane extends Mesh3D {
public var :Number;
public var :Number;
public static var DEFAULT_SCALE:Number = 1;
public static var DEFAULT_SEGMENTS:Number = 1;
public static var DEFAULT_SIZE:Number = 500;
public function Plane(_arg1:MaterialObject3D=null, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0, _arg6:Object=null){
var _local7:Number;
super(_arg1, new Array(), new Array(), null, _arg6);
this. = ((_arg4) || (DEFAULT_SEGMENTS));
this. = ((_arg5) || (this.));
_local7 = DEFAULT_SCALE;
if (!_arg3){
if (_arg2){
_local7 = _arg2;
};
if (((_arg1) && (_arg1.bitmap))){
_arg2 = (_arg1.bitmap.width * _local7);
_arg3 = (_arg1.bitmap.height * _local7);
} else {
_arg2 = (DEFAULT_SIZE * _local7);
_arg3 = (DEFAULT_SIZE * _local7);
};
};
(_arg2, _arg3);
}
private function (_arg1:Number, _arg2:Number):void{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Array;
var _local8:Array;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:int;
var _local14:NumberUV;
var _local15:NumberUV;
var _local16:NumberUV;
var _local17:int;
var _local18:Number;
var _local19:Number;
var _local20:Vertex3D;
var _local21:Vertex3D;
var _local22:Vertex3D;
_local3 = this.;
_local4 = this.;
_local5 = (_local3 + 1);
_local6 = (_local4 + 1);
_local7 = this.geometry.vertices;
_local8 = this.geometry.faces;
_local9 = (_arg1 / 2);
_local10 = (_arg2 / 2);
_local11 = (_arg1 / _local3);
_local12 = (_arg2 / _local4);
_local13 = 0;
while (_local13 < (_local3 + 1)) {
_local17 = 0;
while (_local17 < _local6) {
_local18 = ((_local13 * _local11) - _local9);
_local19 = ((_local17 * _local12) - _local10);
_local7.push(new Vertex3D(_local18, _local19, 0));
_local17++;
};
_local13++;
};
_local13 = 0;
while (_local13 < _local3) {
_local17 = 0;
while (_local17 < _local4) {
_local20 = _local7[((_local13 * _local6) + _local17)];
_local21 = _local7[((_local13 * _local6) + (_local17 + 1))];
_local22 = _local7[(((_local13 + 1) * _local6) + _local17)];
_local14 = new NumberUV((_local13 / _local3), (_local17 / _local4));
_local15 = new NumberUV((_local13 / _local3), ((_local17 + 1) / _local4));
_local16 = new NumberUV(((_local13 + 1) / _local3), (_local17 / _local4));
_local8.push(new Face3D([_local20, _local22, _local21], null, [_local14, _local16, _local15]));
_local20 = _local7[(((_local13 + 1) * _local6) + (_local17 + 1))];
_local21 = _local7[(((_local13 + 1) * _local6) + _local17)];
_local22 = _local7[((_local13 * _local6) + (_local17 + 1))];
_local14 = new NumberUV(((_local13 + 1) / _local3), ((_local17 + 1) / _local4));
_local15 = new NumberUV(((_local13 + 1) / _local3), (_local17 / _local4));
_local16 = new NumberUV((_local13 / _local3), ((_local17 + 1) / _local4));
_local8.push(new Face3D([_local20, _local22, _local21], null, [_local14, _local16, _local15]));
_local17++;
};
_local13++;
};
this.geometry.ready = true;
}
}
}//package org.papervision3d.objects
Section 41
//InteractiveScene3D (org.papervision3d.scenes.InteractiveScene3D)
package org.papervision3d.scenes {
import flash.display.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.utils.*;
public class InteractiveScene3D extends MovieScene3D {
public var interactiveSceneManager:InteractiveSceneManager;
public function InteractiveScene3D(_arg1:Sprite){
super(_arg1);
interactiveSceneManager = new InteractiveSceneManager(this);
}
override public function renderCamera(_arg1:CameraObject3D):void{
interactiveSceneManager.resetFaces();
super.renderCamera(_arg1);
interactiveSceneManager.sortObjects();
}
}
}//package org.papervision3d.scenes
Section 42
//MovieScene3D (org.papervision3d.scenes.MovieScene3D)
package org.papervision3d.scenes {
import flash.display.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.objects.*;
import flash.utils.*;
public class MovieScene3D extends Scene3D {
private var :Dictionary;
private var :Array;
public function MovieScene3D(_arg1:Sprite){
super(_arg1);
this. = new Array();
= new Dictionary();
}
override public function addChild(_arg1:DisplayObject3D, _arg2:String=null):DisplayObject3D{
_arg1 = super.addChild(_arg1, _arg2);
_arg1.container = new Sprite();
container.addChild(_arg1.container);
this..push(_arg1.container);
[_arg1] = _arg1.container;
return (_arg1);
}
public function
(_arg1:DisplayObject3D):Sprite{
return ([_arg1]);
}
override protected function renderObjects(_arg1:Boolean):void{
var _local2:Number;
var _local3:Sprite;
var _local4:Array;
var _local5:Number;
var _local6:DisplayObject3D;
var _local7:Array;
var _local8:Object;
_local2 = this.objects.length;
_local4 = this.;
_local5 = 0;
while ((_local3 = _local4[_local5++])) {
_local3.graphics.clear();
};
_local7 = this.objects;
_local5 = _local7.length;
if (_arg1){
while ((_local6 = _local7[--_local5])) {
if (_local6.visible){
container.addChild(_local6.container);
_local6.render(this);
};
};
} else {
while ((_local6 = _local7[--_local5])) {
if (_local6.visible){
_local6.render(this);
};
};
};
_local8 = this.stats;
_local8.performance = (getTimer() - _local8.performance);
}
override public function removeChild(_arg1:DisplayObject3D):DisplayObject3D{
var _local2:DisplayObject3D;
var _local3:int;
_local2 = super.removeChild(_arg1);
_local3 = 0;
while (_local3 < .length) {
if (_local2.container == [_local3]){
this..splice(_local3, 1);
};
_local3++;
};
container.removeChild(_local2.container);
delete [_local2];
return (_local2);
}
}
}//package org.papervision3d.scenes
Section 43
//Scene3D (org.papervision3d.scenes.Scene3D)
package org.papervision3d.scenes {
import flash.display.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.objects.*;
import flash.utils.*;
public class Scene3D extends SceneObject3D {
public function Scene3D(_arg1:Sprite){
super(_arg1);
}
override protected function renderObjects(_arg1:Boolean):void{
var _local2:DisplayObject3D;
var _local3:Array;
var _local4:Number;
var _local5:Object;
this.container.graphics.clear();
_local3 = this.objects;
_local4 = _local3.length;
while ((_local2 = _local3[--_local4])) {
if (_local2.visible){
_local2.render(this);
};
};
_local5 = this.stats;
_local5.performance = (getTimer() - _local5.performance);
}
}
}//package org.papervision3d.scenes
Section 44
//IVirtualMouseEvent (org.papervision3d.utils.virtualmouse.IVirtualMouseEvent)
package org.papervision3d.utils.virtualmouse {
public interface IVirtualMouseEvent {
}
}//package org.papervision3d.utils.virtualmouse
Section 45
//VirtualMouse (org.papervision3d.utils.virtualmouse.VirtualMouse)
package org.papervision3d.utils.virtualmouse {
import flash.display.*;
import flash.events.*;
import com.blitzagency.xray.logger.*;
import flash.geom.*;
import flash.utils.*;
public class VirtualMouse extends EventDispatcher {
private var :Sprite;
private var :DisplayObject;
private var :InteractiveObject;
private var :Boolean;// = false
private var
:Class;
private var :Event;
private var :Class;
private var :Point;
private var :int;// = 0
private var :Object;
private var log:XrayLog;
private var :Dictionary;
private var :Boolean;// = false
private var :Boolean;// = true
private var :Point;
private var :Boolean;// = false
private var :Boolean;// = false
private var altKey:Boolean;// = false
private var :Boolean;// = false
private var ctrlKey:Boolean;// = false
private var shiftKey:Boolean;// = false
private var :Stage;
public static const UPDATE:String = "update";
private static var _mouseIsDown:Boolean = false;
public function VirtualMouse(_arg1:Stage=null, _arg2:Sprite=null, _arg3:Number=0, _arg4:Number=0){
altKey = false;
ctrlKey = false;
shiftKey = false;
= 0;
= false;
= false;
= new Object();
= new Dictionary(true);
= false;
= false;
= true;
= false;
= VirtualMouseEvent;
= VirtualMouseMouseEvent;
log = new XrayLog();
super();
this.stage = _arg1;
this.container = _arg2;
= new Point(_arg3, _arg4);
= .clone();
addEventListener(UPDATE, );
update();
}
public function get mouseIsDown():Boolean{
return (_mouseIsDown);
}
public function get stage():Stage{
return ( );
}
public function exitContainer():void{
var _local1:Point;
_local1 = .globalToLocal();
if (! [MouseEvent.MOUSE_OUT]){
= new (MouseEvent.MOUSE_OUT, true, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, );
container.dispatchEvent();
dispatchEvent();
};
if (! [MouseEvent.ROLL_OUT]){
= new (MouseEvent.ROLL_OUT, false, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, );
container.dispatchEvent();
dispatchEvent();
};
if ( != container){
if (! [MouseEvent.MOUSE_OUT]){
= new (MouseEvent.MOUSE_OUT, true, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, );
.dispatchEvent();
dispatchEvent();
};
if (! [MouseEvent.ROLL_OUT]){
= new (MouseEvent.ROLL_OUT, false, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, );
.dispatchEvent();
dispatchEvent();
};
};
= ;
}
public function release():void{
= true;
_mouseIsDown = false;
if (!){
update();
};
}
public function click():void{
press();
release();
}
public function get container():Sprite{
return ();
}
public function set container(_arg1:Sprite):void{
= _arg1;
}
public function get y():Number{
return (.y);
}
public function set x(_arg1:Number):void{
.x = _arg1;
if (!){
update();
};
}
public function (_arg1:String):void{
[_arg1] = true;
}
public function get lastEvent():Event{
return ();
}
private function (_arg1:Event):void{
var _local2:Array;
var _local3:InteractiveObject;
var _local4:DisplayObject;
var _local5:int;
var _local6:Point;
var _local7:Point;
var _local8:Boolean;
if (!container){
return;
};
_local2 = container.getObjectsUnderPoint();
_local5 = _local2.length;
while (_local5--) {
_local4 = _local2[_local5];
while (_local4) {
if ([_local4]){
_local3 = null;
break;
};
if (((_local3) && ((_local4 is SimpleButton)))){
_local3 = null;
} else {
if (((_local3) && (!(DisplayObjectContainer(_local4).mouseChildren)))){
_local3 = null;
};
};
if (((((!(_local3)) && ((_local4 is InteractiveObject)))) && (InteractiveObject(_local4).mouseEnabled))){
_local3 = InteractiveObject(_local4);
};
_local4 = _local4.parent;
};
if (_local3){
break;
};
};
if (!_local3){
_local3 = ;
log.debug("no new target found, using stage");
};
_local6 = .globalToLocal();
_local7 = _local3.globalToLocal();
if (((!(( .x == .x))) || (!(( .y == .y))))){
_local8 = false;
if (stage){
_local8 = (((((((.x >= 0)) && ((.y >= 0)))) && ((.x <= stage.stageWidth)))) && ((.y <= stage.stageHeight)));
};
if (((((!(_local8)) && ())) && (!( [Event.MOUSE_LEAVE])))){
= new
(Event.MOUSE_LEAVE, false, false);
stage.dispatchEvent();
dispatchEvent();
};
if (((_local8) && (!( [MouseEvent.MOUSE_MOVE])))){
= new (MouseEvent.MOUSE_MOVE, true, false, _local7.x, _local7.y, _local3, ctrlKey, altKey, shiftKey, _mouseIsDown, );
_local3.dispatchEvent();
dispatchEvent();
};
= _local8;
};
if (_local3 != ){
if (! [MouseEvent.MOUSE_OUT]){
= new (MouseEvent.MOUSE_OUT, true, false, _local6.x, _local6.y, _local3, ctrlKey, altKey, shiftKey, _mouseIsDown, );
.dispatchEvent();
dispatchEvent();
};
if (! [MouseEvent.ROLL_OUT]){
= new (MouseEvent.ROLL_OUT, false, false, _local6.x, _local6.y, _local3, ctrlKey, altKey, shiftKey, _mouseIsDown, );
.dispatchEvent();
dispatchEvent();
};
if (! [MouseEvent.MOUSE_OVER]){
= new (MouseEvent.MOUSE_OVER, true, false, _local7.x, _local7.y, , ctrlKey, altKey, shiftKey, _mouseIsDown, );
_local3.dispatchEvent();
dispatchEvent();
};
if (! [MouseEvent.ROLL_OVER]){
= new (MouseEvent.ROLL_OVER, false, false, _local7.x, _local7.y, , ctrlKey, altKey, shiftKey, _mouseIsDown, );
_local3.dispatchEvent();
dispatchEvent();
};
};
if ( ){
if (_mouseIsDown){
if (! [MouseEvent.MOUSE_DOWN]){
= new (MouseEvent.MOUSE_DOWN, true, false, _local7.x, _local7.y, _local3, ctrlKey, altKey, shiftKey, _mouseIsDown, );
_local3.dispatchEvent();
dispatchEvent();
};
= _local3;
= false;
} else {
if (! [MouseEvent.MOUSE_UP]){
= new (MouseEvent.MOUSE_UP, true, false, _local7.x, _local7.y, _local3, ctrlKey, altKey, shiftKey, _mouseIsDown, );
_local3.dispatchEvent();
dispatchEvent();
};
if (((!( [MouseEvent.CLICK])) && ((_local3 == )))){
= new (MouseEvent.CLICK, true, false, _local7.x, _local7.y, _local3, ctrlKey, altKey, shiftKey, _mouseIsDown, );
_local3.dispatchEvent();
dispatchEvent();
};
= null;
= false;
};
};
if ((((( ) && (!( [MouseEvent.DOUBLE_CLICK])))) && (_local3.doubleClickEnabled))){
= new (MouseEvent.DOUBLE_CLICK, true, false, _local7.x, _local7.y, _local3, ctrlKey, altKey, shiftKey, _mouseIsDown, );
_local3.dispatchEvent();
dispatchEvent();
};
= .clone();
= _mouseIsDown;
= _local3;
}
public function ():Point{
return (.clone());
}
public function get x():Number{
return (.x);
}
public function ():void{
= true;
}
public function get useNativeEvents():Boolean{
return ( );
}
public function setLocation(_arg1, _arg2=null):void{
var _local3:Point;
if ((_arg1 is Point)){
_local3 = Point(_arg1);
.x = _local3.x;
.y = _local3.y;
} else {
.x = Number(_arg1);
.y = Number(_arg2);
};
if (!){
update();
};
}
private function (_arg1:KeyboardEvent):void{
altKey = _arg1.altKey;
ctrlKey = _arg1.ctrlKey;
shiftKey = _arg1.shiftKey;
}
public function (_arg1:DisplayObject):void{
if ((_arg1 in )){
delete [_arg1];
};
}
public function
():void{
if (){
release();
} else {
click();
press();
= true;
release();
= false;
};
}
public function update():void{
dispatchEvent(new Event(UPDATE, false, false));
}
public function ignore(_arg1:DisplayObject):void{
[_arg1] = true;
}
public function
():void{
= false;
update();
}
public function (_arg1:String):void{
if ((_arg1 in )){
delete [_arg1];
};
}
public function press():void{
= true;
_mouseIsDown = true;
if (!){
update();
};
}
public function set useNativeEvents(_arg1:Boolean):void{
if (_arg1 == ){
return;
};
= _arg1;
if ( ){
= VirtualMouseEvent;
= VirtualMouseMouseEvent;
} else {
= Event;
= MouseEvent;
};
}
public function set y(_arg1:Number):void{
.y = _arg1;
if (!){
update();
};
}
public function set stage(_arg1:Stage):void{
var _local2:Boolean;
if ( ){
_local2 = true;
.removeEventListener(KeyboardEvent.KEY_DOWN, );
.removeEventListener(KeyboardEvent.KEY_UP, );
} else {
_local2 = false;
};
= _arg1;
if ( ){
.addEventListener(KeyboardEvent.KEY_DOWN, );
.addEventListener(KeyboardEvent.KEY_UP, );
= ;
if (!_local2){
update();
};
};
}
}
}//package org.papervision3d.utils.virtualmouse
Section 46
//VirtualMouseEvent (org.papervision3d.utils.virtualmouse.VirtualMouseEvent)
package org.papervision3d.utils.virtualmouse {
import flash.events.*;
public class VirtualMouseEvent extends Event implements IVirtualMouseEvent {
public function VirtualMouseEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
}
}//package org.papervision3d.utils.virtualmouse
Section 47
//VirtualMouseMouseEvent (org.papervision3d.utils.virtualmouse.VirtualMouseMouseEvent)
package org.papervision3d.utils.virtualmouse {
import flash.display.*;
import flash.events.*;
public class VirtualMouseMouseEvent extends MouseEvent implements IVirtualMouseEvent {
public function VirtualMouseMouseEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:Number=NaN, _arg5:Number=NaN, _arg6:InteractiveObject=null, _arg7:Boolean=false, _arg8:Boolean=false, _arg9:Boolean=false, _arg10:Boolean=false, _arg11:int=0){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11);
}
}
}//package org.papervision3d.utils.virtualmouse
Section 48
//InteractiveContainerData (org.papervision3d.utils.InteractiveContainerData)
package org.papervision3d.utils {
import flash.events.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.*;
public class InteractiveContainerData extends EventDispatcher {
public var container:InteractiveSprite;
public var displayObject3D:DisplayObject3D;// = null
public var lineColor:Number;
public var lineAlpha:Number;
public var fillAlpha:Number;
public var sort:Boolean;// = false
public var isDrawn:Boolean;// = false
public var color:Number;
public var lineSize:Number;
public var face3d:Face3D;
public function InteractiveContainerData(_arg1, _arg2:Number=0, _arg3:IEventDispatcher=null){
displayObject3D = null;
isDrawn = false;
sort = false;
color = InteractiveSceneManager.DEFAULT_FILL_COLOR;
fillAlpha = InteractiveSceneManager.DEFAULT_FILL_ALPHA;
lineColor = InteractiveSceneManager.DEFAULT_LINE_COLOR;
lineSize = InteractiveSceneManager.DEFAULT_LINE_SIZE;
lineAlpha = InteractiveSceneManager.DEFAULT_LINE_ALPHA;
super(_arg3);
displayObject3D = (((_arg1 is DisplayObject3D) == true)) ? _arg1 : null;
face3d = (((_arg1 is Face3D) == true)) ? _arg1 : null;
if (displayObject3D != null){
this.container = new InteractiveSprite(_arg1);
};
if (face3d != null){
if (face3d.face3DInstance.container != null){
this.container = InteractiveSprite(face3d.face3DInstance.container);
} else {
this.container = new InteractiveSprite();
};
};
color = _arg2;
container.alpha = InteractiveSceneManager.DEFAULT_SPRITE_ALPHA;
container.interactiveContainerData = this;
}
public function get screenZ():Number{
return (((displayObject3D)!=null) ? displayObject3D.screenZ : face3d.screenZ);
}
}
}//package org.papervision3d.utils
Section 49
//InteractiveSceneManager (org.papervision3d.utils.InteractiveSceneManager)
package org.papervision3d.utils {
import flash.display.*;
import flash.events.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.materials.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.*;
import com.blitzagency.xray.logger.*;
import flash.geom.*;
import flash.utils.*;
import org.papervision3d.utils.virtualmouse.*;
import org.papervision3d.events.*;
public class InteractiveSceneManager extends EventDispatcher {
public var container:Sprite;
public var scene:SceneObject3D;
protected var :Boolean;// = true
protected var log:XrayLog;
private var :Boolean;// = false
public var :Dictionary;
public var :Mouse3D;
public var
:VirtualMouse;
public var faceLevelMode:Boolean;// = false
public var debug:Boolean;// = false
protected var :Boolean;// = false
public var :Boolean;// = false
public var :Dictionary;
public static var DEFAULT_FILL_ALPHA:Number = 1;
public static var DEFAULT_SPRITE_ALPHA:Number = 1;
public static var DEFAULT_FILL_COLOR:Number = 0xFFFFFF;
public static var DEFAULT_LINE_SIZE:Number = 1;
public static var DEFAULT_LINE_ALPHA:Number = 1;
public static var DEFAULT_LINE_COLOR:Number = -1;
public static var MOUSE_IS_DOWN:Boolean = false;
public static var SHOW_DRAWN_FACES:Boolean = false;
public function InteractiveSceneManager(_arg1:SceneObject3D):void{
= false;
faceLevelMode = false;
= false;
= new Dictionary();
= new Dictionary();
container = new InteractiveSprite();
= new Mouse3D();
= new VirtualMouse();
debug = false;
= true;
= false;
log = new XrayLog();
super();
container.addEventListener(Event.ADDED_TO_STAGE, );
scene = _arg1;
scene.container.parent.addChild(container);
container.x = scene.container.x;
container.y = scene.container.y;
enableMouse = false;
}
protected function (_arg1:MouseEvent):void{
= true;
}
public function sortObjects():void{
var _local1:Array;
var _local2:InteractiveContainerData;
var _local3:uint;
var _local4:Number;
_local1 = [];
for each (_local2 in ) {
if (!_local2.sort){
} else {
_local4 = ((_local2.face3d == null)) ? _local2.screenZ : _local2.face3d.face3DInstance.screenZ;
_local1.push({container:_local2.container, distance:_local4});
};
};
_local1.sortOn("distance", (Array.DESCENDING | Array.NUMERIC));
_local3 = 0;
while (_local3 < _local1.length) {
container.addChild(_local1[_local3].container);
_local3++;
};
if (mouseInteractionMode){
= false;
};
}
public function
():void{
SHOW_DRAWN_FACES = false;
DEFAULT_SPRITE_ALPHA = 1;
DEFAULT_FILL_ALPHA = 1;
BitmapMaterial.AUTO_MIP_MAPPING = false;
DisplayObject3D.faceLevelMode = false;
= true;
faceLevelMode = true;
mouseInteractionMode = false;
}
public function (_arg1:Object):void{
var _local2:InteractiveContainerData;
var _local3:InteractiveSprite;
if ([_arg1] == null){
_local2 = ([_arg1] = new InteractiveContainerData(_arg1));
[_local2.container] = _arg1;
_local3 = _local2.container;
_local3.addEventListener(MouseEvent.MOUSE_DOWN,
);
_local3.addEventListener(MouseEvent.MOUSE_UP, );
_local3.addEventListener(MouseEvent.CLICK, );
_local3.addEventListener(MouseEvent.MOUSE_OVER, );
_local3.addEventListener(MouseEvent.MOUSE_OUT, );
_local3.addEventListener(MouseEvent.MOUSE_MOVE, );
_local3. = ;
if (((!(SHOW_DRAWN_FACES)) && (!(DisplayObject3D.faceLevelMode)))){
_local3.blendMode = BlendMode.ERASE;
};
.ignore(_local3);
dispatchEvent(new InteractiveScene3DEvent(InteractiveScene3DEvent.OBJECT_ADDED, null, _local3));
if (debug){
log.debug("addDisplayObject id", _arg1.id, _arg1.name, DEFAULT_SPRITE_ALPHA);
};
};
}
public function resetFaces():void{
var _local1:InteractiveContainerData;
for each (_local1 in ) {
_local1.container.graphics.clear();
_local1.sort = _local1.isDrawn;
_local1.isDrawn = false;
};
();
}
public function
():void{
container.x = scene.container.x;
container.y = scene.container.y;
}
protected function (_arg1:MouseEvent):void{
(InteractiveScene3DEvent.OBJECT_CLICK, Sprite(_arg1.currentTarget));
}
protected function (_arg1:MouseEvent):void{
var face3d:Face3D;
var p:Object;
var mat:InteractiveMovieMaterial;
var rect:Rectangle;
var contains:Boolean;
var e = _arg1;
if (((VirtualMouse) && (((faceLevelMode) || (DisplayObject3D.faceLevelMode))))){
try {
face3d = [e.currentTarget];
p = InteractiveUtils.getMapCoordAtPoint(face3d, container.mouseX, container.mouseY);
mat = InteractiveMovieMaterial(face3d.face3DInstance.instance.material);
rect = new Rectangle(0, 0, mat.movie.width, mat.movie.height);
contains = rect.contains(p.x, p.y);
if (!contains){
.exitContainer();
};
} catch(err:Error) {
log.error("material type is not Interactive. If you're using a Collada object, you may have to reassign the material to the object after the collada scene is loaded", err.message);
};
};
(InteractiveScene3DEvent.OBJECT_OUT, Sprite(e.currentTarget));
}
public function drawFace(_arg1:DisplayObject3D, _arg2:Face3D, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number):void{
var _local9:Object;
var _local10:InteractiveContainerData;
var _local11:InteractiveSprite;
var _local12:Graphics;
_local9 = _arg1;
if (((faceLevelMode) || (DisplayObject3D.faceLevelMode))){
_local9 = _arg2;
};
if ([_local9] == null){
(_local9);
};
if ((() && (!(DisplayObject3D.faceLevelMode)))){
_local10 = [_local9];
_local11 = _local10.container;
_local12 = _local11.graphics;
_local11.x0 = _arg3;
_local11.x1 = _arg4;
_local11.x2 = _arg5;
_local11.y0 = _arg6;
_local11.y1 = _arg7;
_local11.y2 = _arg8;
_local12.beginFill(_local10.color, _local10.fillAlpha);
if (((!((_local10.lineColor == -1))) && (SHOW_DRAWN_FACES))){
_local12.lineStyle(_local10.lineSize, _local10.lineColor, _local10.lineAlpha);
};
_local12.moveTo(_arg3, _arg6);
_local12.lineTo(_arg4, _arg7);
_local12.lineTo(_arg5, _arg8);
_local12.endFill();
_local10.isDrawn = true;
};
}
public function set enableMouse(_arg1:Boolean):void{
Mouse3D.enabled = _arg1;
}
protected function (_arg1:String, _arg2:Sprite):void{
var _local3:Face3D;
var _local4:InteractiveContainerData;
if (debug){
log.debug(_arg1, DisplayObject3D([_arg2]).name);
};
if (([_arg2] is DisplayObject3D)){
[_arg2].dispatchEvent(new InteractiveScene3DEvent(_arg1, [_arg2], InteractiveSprite(_arg2)));
dispatchEvent(new InteractiveScene3DEvent(_arg1, [_arg2], InteractiveSprite(_arg2), null, null));
} else {
if (([_arg2] is Face3D)){
_local3 = [_arg2];
_local4 = [_local3];
dispatchEvent(new InteractiveScene3DEvent(_arg1, null, InteractiveSprite(_arg2), _local3, _local4));
};
};
}
protected function (_arg1:MouseEvent):void{
var point:Object;
var face3d:Face3D;
var mat:MovieMaterial;
var e = _arg1;
if (((VirtualMouse) && (((faceLevelMode) || (DisplayObject3D.faceLevelMode))))){
face3d = [e.currentTarget];
point = InteractiveUtils.getMapCoordAtPoint(face3d, container.mouseX, container.mouseY);
try {
mat = (face3d.face3DInstance.instance.material as MovieMaterial);
.container = (mat.movie as Sprite);
if (
.container){
.setLocation(point.x, point.y);
};
} catch(err:Error) {
log.error("material type is not Inter active. If you're using a Collada object, you may have to reassign the material to the object after the collada scene is loaded", err.message);
};
};
(InteractiveScene3DEvent.OBJECT_MOVE, Sprite(e.currentTarget));
if (((Mouse3D.enabled) && (((faceLevelMode) || (DisplayObject3D.faceLevelMode))))){
.updatePosition(Face3D([e.currentTarget]), (e.currentTarget as Sprite));
};
}
protected function (_arg1:MouseEvent):void{
var _local2:String;
_local2 = (((!()) || (!(mouseInteractionMode)))) ? InteractiveScene3DEvent.OBJECT_OVER : InteractiveScene3DEvent.OBJECT_CLICK;
= false;
if (((
) && ((_local2 == InteractiveScene3DEvent.OBJECT_CLICK)))){
.click();
};
(_local2, Sprite(_arg1.currentTarget));
}
public function set mouseInteractionMode(_arg1:Boolean):void{
= _arg1;
= !(_arg1);
if (_arg1){
container.stage.addEventListener(MouseEvent.MOUSE_MOVE, );
};
if (!_arg1){
container.stage.removeEventListener(MouseEvent.MOUSE_MOVE, );
};
}
public function get enableMouse():Boolean{
return (Mouse3D.enabled);
}
protected function
(_arg1:MouseEvent):void{
MOUSE_IS_DOWN = true;
if (
){
.press();
};
(InteractiveScene3DEvent.OBJECT_PRESS, Sprite(_arg1.currentTarget));
}
protected function (_arg1:MouseEvent):void{
if (debug){
log.debug("releaseOutside");
};
dispatchEvent(new InteractiveScene3DEvent(InteractiveScene3DEvent.OBJECT_RELEASE_OUTSIDE));
MOUSE_IS_DOWN = false;
= true;
= true;
}
public function get mouseInteractionMode():Boolean{
return ();
}
protected function (_arg1:Event):void{
container.stage.addEventListener(Event.RESIZE, );
container.stage.addEventListener(MouseEvent.MOUSE_UP, );
.stage = container.stage;
}
protected function (_arg1:MouseEvent):void{
MOUSE_IS_DOWN = false;
if (
){
.release();
};
(InteractiveScene3DEvent.OBJECT_RELEASE, Sprite(_arg1.currentTarget));
}
protected function (_arg1:Event):void{
();
}
}
}//package org.papervision3d.utils
Section 50
//InteractiveSprite (org.papervision3d.utils.InteractiveSprite)
package org.papervision3d.utils {
import flash.display.*;
import org.papervision3d.objects.*;
public class InteractiveSprite extends Sprite {
public var interactiveContainerData:InteractiveContainerData;// = null
public var x1:Number;
public var x2:Number;
public var x0:Number;
public var y0:Number;
public var y2:Number;
public var obj:DisplayObject3D;// = null
public var y1:Number;
public function InteractiveSprite(_arg1:DisplayObject3D=null):void{
obj = null;
interactiveContainerData = null;
super();
this.obj = _arg1;
}
}
}//package org.papervision3d.utils
Section 51
//InteractiveUtils (org.papervision3d.utils.InteractiveUtils)
package org.papervision3d.utils {
import flash.display.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.materials.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.*;
public class InteractiveUtils {
public static function getMapCoordAtPointDO3D(_arg1:DisplayObject3D, _arg2:Number, _arg3:Number):Object{
var _local4:Face3D;
_local4 = _arg1.geometry.faces[0];
return (getMapCoordAtPoint(_local4, _arg2, _arg3));
}
public static function UVatPoint(_arg1:Face3D, _arg2:Number, _arg3:Number):Object{
var _local4:Vertex3D;
var _local5:Vertex3D;
var _local6:Vertex3D;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
_local4 = _arg1.v0;
_local5 = _arg1.v1;
_local6 = _arg1.v2;
_local7 = _local4.vertex2DInstance.x;
_local8 = _local4.vertex2DInstance.y;
_local9 = _local5.vertex2DInstance.x;
_local10 = _local5.vertex2DInstance.y;
_local11 = _local6.vertex2DInstance.x;
_local12 = _local6.vertex2DInstance.y;
_local13 = (_local11 - _local7);
_local14 = (_local12 - _local8);
_local15 = (_local9 - _local7);
_local16 = (_local10 - _local8);
_local17 = (_arg2 - _local7);
_local18 = (_arg3 - _local8);
_local19 = ((_local13 * _local13) + (_local14 * _local14));
_local20 = ((_local13 * _local15) + (_local14 * _local16));
_local21 = ((_local13 * _local17) + (_local14 * _local18));
_local22 = ((_local15 * _local15) + (_local16 * _local16));
_local23 = ((_local15 * _local17) + (_local16 * _local18));
_local24 = (1 / ((_local19 * _local22) - (_local20 * _local20)));
_local25 = (((_local22 * _local21) - (_local20 * _local23)) * _local24);
_local26 = (((_local19 * _local23) - (_local20 * _local21)) * _local24);
return ({u:_local25, v:_local26});
}
public static function getMapCoordAtPoint(_arg1:Face3D, _arg2:Number, _arg3:Number):Object{
var _local4:Array;
var _local5:Object;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:MaterialObject3D;
var _local17:BitmapData;
var _local18:Number;
var _local19:Number;
_local4 = _arg1.uv;
_local5 = UVatPoint(_arg1, _arg2, _arg3);
_local6 = _local5.u;
_local7 = _local5.v;
_local8 = _local4[0].u;
_local9 = _local4[1].u;
_local10 = _local4[2].u;
_local11 = _local4[0].v;
_local12 = _local4[1].v;
_local13 = _local4[2].v;
_local14 = ((((_local9 - _local8) * _local7) + ((_local10 - _local8) * _local6)) + _local8);
_local15 = ((((_local12 - _local11) * _local7) + ((_local13 - _local11) * _local6)) + _local11);
_local16 = _arg1.face3DInstance.instance.material;
_local17 = _local16.bitmap;
_local18 = 1;
_local19 = 1;
if (_local17){
_local18 = (BitmapMaterial.AUTO_MIP_MAPPING) ? _local16.widthOffset : _local17.width;
_local19 = (BitmapMaterial.AUTO_MIP_MAPPING) ? _local16.heightOffset : _local17.height;
};
return ({x:(_local14 * _local18), y:(_local19 - (_local15 * _local19))});
}
public static function getCoordAtPoint(_arg1:Face3D, _arg2:Number, _arg3:Number):Vertex3D{
var _local4:Object;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
_local4 = UVatPoint(_arg1, _arg2, _arg3);
_local5 = _arg1.v0.x;
_local6 = _arg1.v0.y;
_local7 = _arg1.v0.z;
_local8 = _arg1.v1.x;
_local9 = _arg1.v1.y;
_local10 = _arg1.v1.z;
_local11 = _arg1.v2.x;
_local12 = _arg1.v2.y;
_local13 = _arg1.v2.z;
_local14 = _local4.u;
_local15 = _local4.v;
_local16 = ((_local5 + ((_local8 - _local5) * _local15)) + ((_local11 - _local5) * _local14));
_local17 = ((_local6 + ((_local9 - _local6) * _local15)) + ((_local12 - _local6) * _local14));
_local18 = ((_local7 + ((_local10 - _local7) * _local15)) + ((_local13 - _local7) * _local14));
return (new Vertex3D(_local16, _local17, _local18));
}
}
}//package org.papervision3d.utils
Section 52
//Mouse3D (org.papervision3d.utils.Mouse3D)
package org.papervision3d.utils {
import flash.display.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.core.*;
public class Mouse3D extends DisplayObject3D {
public static var enabled:Boolean = true;
private static var UP:Number3D = new Number3D(0, 1, 0);
public function Mouse3D(_arg1:Object=null):void{
}
public function updatePosition(_arg1:Face3D, _arg2:Sprite):void{
var _local3:Number3D;
var _local4:Number3D;
var _local5:Number3D;
var _local6:Matrix3D;
var _local7:Matrix3D;
var _local8:Number;
var _local9:Number;
var _local10:Number3D;
var _local11:Number3D;
var _local12:Matrix3D;
_local3 = new Number3D(0, 0, 0);
_local4 = new Number3D(_arg1.faceNormal.x, _arg1.faceNormal.y, _arg1.faceNormal.z);
_local5 = Number3D.sub(_local4, _local3);
_local5.normalize();
if (_local5.modulo > 0.1){
_local10 = Number3D.cross(_local5, UP);
_local10.normalize();
_local11 = Number3D.cross(_local5, _local10);
_local11.normalize();
_local12 = this.transform;
_local12.n11 = _local10.x;
_local12.n21 = _local10.y;
_local12.n31 = _local10.z;
_local12.n12 = -(_local11.x);
_local12.n22 = -(_local11.y);
_local12.n32 = -(_local11.z);
_local12.n13 = _local5.x;
_local12.n23 = _local5.y;
_local12.n33 = _local5.z;
};
_local6 = Matrix3D.IDENTITY;
this.transform = Matrix3D.multiply(_arg1.face3DInstance.instance.world, _local12);
_local7 = Matrix3D.IDENTITY;
_local8 = _arg2.mouseX;
_local9 = _arg2.mouseY;
_local7.n14 = InteractiveUtils.getCoordAtPoint(_arg1, _local8, _local9).x;
_local7.n24 = InteractiveUtils.getCoordAtPoint(_arg1, _local8, _local9).y;
_local7.n34 = InteractiveUtils.getCoordAtPoint(_arg1, _local8, _local9).z;
_local6.calculateMultiply(_arg1.face3DInstance.instance.world, _local7);
x = _local6.n14;
y = _local6.n24;
z = _local6.n34;
}
}
}//package org.papervision3d.utils
Section 53
//Papervision3D (org.papervision3d.Papervision3D)
package org.papervision3d {
public class Papervision3D {
public static var useDEGREES:Boolean = true;
public static var VERBOSE:Boolean = true;
public static var AUTHOR:String = "(c) 2006-2007 Copyright by Carlos Ulloa | papervision3d.org | carlos@papervision3d.org";
public static var DATE:String = "20.08.07";
public static var NAME:String = "Papervision3D";
public static var VERSION:String = "Beta 1.7";
public static var usePERCENT:Boolean = false;
public static function log(_arg1:String):void{
if (Papervision3D.VERBOSE){
};
}
}
}//package org.papervision3d
Section 54
//jpg (play_background.jpg)
package play_background {
import flash.display.*;
public dynamic class jpg extends BitmapData {
public function jpg(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package play_background
Section 55
//AIArchetype (Subterfuge.AIArchetype)
package Subterfuge {
public class AIArchetype {
var :String;
var use_best_move_percentage:Number;
var leader_protection_radius:int;
var attack_percentage:Number;
var
:Number;
var move_preference_list:Array;
var initial_setup_list:Array;
}
}//package Subterfuge
Section 56
//AIDatabase (Subterfuge.AIDatabase)
package Subterfuge {
public class AIDatabase {
public var archetypes:Array;
public static var PTR:AIDatabase;
public function AIDatabase(){
var _local1:AIArchetype;
super();
archetypes = new Array();
_local1 = new AIArchetype();
_local1. = "\"Snake\" Marconi";
_local1.initial_setup_list = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.initial_setup_list[UnitDatabase.UA_LEADER] = new AIUnitPlacement(UnitDatabase.UA_LEADER, 3, 7, 0, 1);
_local1.initial_setup_list[UnitDatabase.UA_SCOUT] = new AIUnitPlacement(UnitDatabase.UA_SCOUT, 1, 9, 2, 3);
_local1.initial_setup_list[UnitDatabase.UA_BOMBER] = new AIUnitPlacement(UnitDatabase.UA_BOMBER, 1, 9, 1, 3);
_local1.initial_setup_list[UnitDatabase.UA_ENFORCER] = new AIUnitPlacement(UnitDatabase.UA_ENFORCER, 1, 9, 1, 3);
_local1.initial_setup_list[UnitDatabase.UA_MERCENARY] = new AIUnitPlacement(UnitDatabase.UA_MERCENARY, 1, 9, 0, 3);
_local1.initial_setup_list[UnitDatabase.UA_ASSASSIN] = new AIUnitPlacement(UnitDatabase.UA_ASSASSIN, 1, 9, 1, 3);
_local1.move_preference_list = new Array();
_local1.move_preference_list.push(UnitDatabase.UA_SCOUT);
_local1.move_preference_list.push(UnitDatabase.UA_ASSASSIN);
_local1.leader_protection_radius = 2;
_local1.
= 0.3;
_local1.attack_percentage = 0.5;
_local1.use_best_move_percentage = 0.6;
archetypes.push(_local1);
_local1 = new AIArchetype();
_local1. = "The Overlords";
_local1.initial_setup_list = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.initial_setup_list[UnitDatabase.UA_LEADER] = new AIUnitPlacement(UnitDatabase.UA_LEADER, 3, 7, 0, 1);
_local1.initial_setup_list[UnitDatabase.UA_SCOUT] = new AIUnitPlacement(UnitDatabase.UA_SCOUT, 1, 9, 2, 3);
_local1.initial_setup_list[UnitDatabase.UA_BOMBER] = new AIUnitPlacement(UnitDatabase.UA_BOMBER, 1, 9, 1, 3);
_local1.initial_setup_list[UnitDatabase.UA_ENFORCER] = new AIUnitPlacement(UnitDatabase.UA_ENFORCER, 1, 9, 1, 3);
_local1.initial_setup_list[UnitDatabase.UA_MERCENARY] = new AIUnitPlacement(UnitDatabase.UA_MERCENARY, 1, 9, 0, 3);
_local1.initial_setup_list[UnitDatabase.UA_ASSASSIN] = new AIUnitPlacement(UnitDatabase.UA_ASSASSIN, 1, 9, 1, 3);
_local1.move_preference_list = new Array();
_local1.move_preference_list.push(UnitDatabase.UA_SCOUT);
_local1.move_preference_list.push(UnitDatabase.UA_ASSASSIN);
_local1.leader_protection_radius = 2;
_local1.
= 0.3;
_local1.attack_percentage = 0.5;
_local1.use_best_move_percentage = 0.75;
archetypes.push(_local1);
_local1 = new AIArchetype();
_local1. = "Antor Kova";
_local1.initial_setup_list = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.initial_setup_list[UnitDatabase.UA_LEADER] = new AIUnitPlacement(UnitDatabase.UA_LEADER, 3, 7, 0, 1);
_local1.initial_setup_list[UnitDatabase.UA_SCOUT] = new AIUnitPlacement(UnitDatabase.UA_SCOUT, 1, 9, 2, 3);
_local1.initial_setup_list[UnitDatabase.UA_BOMBER] = new AIUnitPlacement(UnitDatabase.UA_BOMBER, 1, 9, 1, 3);
_local1.initial_setup_list[UnitDatabase.UA_ENFORCER] = new AIUnitPlacement(UnitDatabase.UA_ENFORCER, 1, 9, 1, 3);
_local1.initial_setup_list[UnitDatabase.UA_MERCENARY] = new AIUnitPlacement(UnitDatabase.UA_MERCENARY, 1, 9, 0, 3);
_local1.initial_setup_list[UnitDatabase.UA_ASSASSIN] = new AIUnitPlacement(UnitDatabase.UA_ASSASSIN, 1, 9, 1, 3);
_local1.move_preference_list = new Array();
_local1.move_preference_list.push(UnitDatabase.UA_SCOUT);
_local1.move_preference_list.push(UnitDatabase.UA_ASSASSIN);
_local1.leader_protection_radius = 2;
_local1.
= 0.3;
_local1.attack_percentage = 0.5;
_local1.use_best_move_percentage = 0.75;
archetypes.push(_local1);
_local1 = new AIArchetype();
_local1. = "Katsu Gang";
_local1.initial_setup_list = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.initial_setup_list[UnitDatabase.UA_LEADER] = new AIUnitPlacement(UnitDatabase.UA_LEADER, 3, 7, 0, 1);
_local1.initial_setup_list[UnitDatabase.UA_SCOUT] = new AIUnitPlacement(UnitDatabase.UA_SCOUT, 1, 9, 2, 3);
_local1.initial_setup_list[UnitDatabase.UA_BOMBER] = new AIUnitPlacement(UnitDatabase.UA_BOMBER, 1, 9, 1, 3);
_local1.initial_setup_list[UnitDatabase.UA_ENFORCER] = new AIUnitPlacement(UnitDatabase.UA_ENFORCER, 1, 9, 1, 3);
_local1.initial_setup_list[UnitDatabase.UA_MERCENARY] = new AIUnitPlacement(UnitDatabase.UA_MERCENARY, 1, 9, 0, 3);
_local1.initial_setup_list[UnitDatabase.UA_ASSASSIN] = new AIUnitPlacement(UnitDatabase.UA_ASSASSIN, 1, 9, 1, 3);
_local1.move_preference_list = new Array();
_local1.move_preference_list.push(UnitDatabase.UA_SCOUT);
_local1.move_preference_list.push(UnitDatabase.UA_ASSASSIN);
_local1.leader_protection_radius = 2;
_local1.
= 0.3;
_local1.attack_percentage = 0.5;
_local1.use_best_move_percentage = 0.75;
archetypes.push(_local1);
_local1 = new AIArchetype();
_local1. = "Neko Blade";
_local1.initial_setup_list = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.initial_setup_list[UnitDatabase.UA_LEADER] = new AIUnitPlacement(UnitDatabase.UA_LEADER, 3, 7, 0, 1);
_local1.initial_setup_list[UnitDatabase.UA_SCOUT] = new AIUnitPlacement(UnitDatabase.UA_SCOUT, 1, 9, 2, 3);
_local1.initial_setup_list[UnitDatabase.UA_BOMBER] = new AIUnitPlacement(UnitDatabase.UA_BOMBER, 1, 9, 1, 3);
_local1.initial_setup_list[UnitDatabase.UA_ENFORCER] = new AIUnitPlacement(UnitDatabase.UA_ENFORCER, 1, 9, 1, 3);
_local1.initial_setup_list[UnitDatabase.UA_MERCENARY] = new AIUnitPlacement(UnitDatabase.UA_MERCENARY, 1, 9, 0, 3);
_local1.initial_setup_list[UnitDatabase.UA_ASSASSIN] = new AIUnitPlacement(UnitDatabase.UA_ASSASSIN, 1, 9, 1, 3);
_local1.move_preference_list = new Array();
_local1.move_preference_list.push(UnitDatabase.UA_SCOUT);
_local1.move_preference_list.push(UnitDatabase.UA_ASSASSIN);
_local1.leader_protection_radius = 2;
_local1.
= 0.3;
_local1.attack_percentage = 0.5;
_local1.use_best_move_percentage = 0.75;
archetypes.push(_local1);
_local1 = new AIArchetype();
_local1. = "Futago brothers";
_local1.initial_setup_list = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.initial_setup_list[UnitDatabase.UA_LEADER] = new AIUnitPlacement(UnitDatabase.UA_LEADER, 3, 7, 0, 1);
_local1.initial_setup_list[UnitDatabase.UA_SCOUT] = new AIUnitPlacement(UnitDatabase.UA_SCOUT, 1, 9, 2, 3);
_local1.initial_setup_list[UnitDatabase.UA_BOMBER] = new AIUnitPlacement(UnitDatabase.UA_BOMBER, 1, 9, 1, 3);
_local1.initial_setup_list[UnitDatabase.UA_ENFORCER] = new AIUnitPlacement(UnitDatabase.UA_ENFORCER, 1, 9, 1, 3);
_local1.initial_setup_list[UnitDatabase.UA_MERCENARY] = new AIUnitPlacement(UnitDatabase.UA_MERCENARY, 1, 9, 0, 3);
_local1.initial_setup_list[UnitDatabase.UA_ASSASSIN] = new AIUnitPlacement(UnitDatabase.UA_ASSASSIN, 1, 9, 1, 3);
_local1.move_preference_list = new Array();
_local1.move_preference_list.push(UnitDatabase.UA_SCOUT);
_local1.move_preference_list.push(UnitDatabase.UA_ASSASSIN);
_local1.leader_protection_radius = 2;
_local1.
= 0.3;
_local1.attack_percentage = 0.5;
_local1.use_best_move_percentage = 0.75;
archetypes.push(_local1);
_local1 = new AIArchetype();
_local1. = "Elena Fermi";
_local1.initial_setup_list = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.initial_setup_list[UnitDatabase.UA_LEADER] = new AIUnitPlacement(UnitDatabase.UA_LEADER, 3, 7, 0, 1);
_local1.initial_setup_list[UnitDatabase.UA_SCOUT] = new AIUnitPlacement(UnitDatabase.UA_SCOUT, 1, 9, 2, 3);
_local1.initial_setup_list[UnitDatabase.UA_BOMBER] = new AIUnitPlacement(UnitDatabase.UA_BOMBER, 1, 9, 1, 3);
_local1.initial_setup_list[UnitDatabase.UA_ENFORCER] = new AIUnitPlacement(UnitDatabase.UA_ENFORCER, 1, 9, 1, 3);
_local1.initial_setup_list[UnitDatabase.UA_MERCENARY] = new AIUnitPlacement(UnitDatabase.UA_MERCENARY, 1, 9, 0, 3);
_local1.initial_setup_list[UnitDatabase.UA_ASSASSIN] = new AIUnitPlacement(UnitDatabase.UA_ASSASSIN, 1, 9, 1, 3);
_local1.move_preference_list = new Array();
_local1.move_preference_list.push(UnitDatabase.UA_SCOUT);
_local1.move_preference_list.push(UnitDatabase.UA_ASSASSIN);
_local1.leader_protection_radius = 2;
_local1.
= 0.3;
_local1.attack_percentage = 0.5;
_local1.use_best_move_percentage = 0.75;
archetypes.push(_local1);
_local1 = new AIArchetype();
_local1. = "Francois Philidor";
_local1.initial_setup_list = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.initial_setup_list[UnitDatabase.UA_LEADER] = new AIUnitPlacement(UnitDatabase.UA_LEADER, 3, 7, 0, 1);
_local1.initial_setup_list[UnitDatabase.UA_SCOUT] = new AIUnitPlacement(UnitDatabase.UA_SCOUT, 1, 9, 2, 3);
_local1.initial_setup_list[UnitDatabase.UA_BOMBER] = new AIUnitPlacement(UnitDatabase.UA_BOMBER, 1, 9, 1, 3);
_local1.initial_setup_list[UnitDatabase.UA_ENFORCER] = new AIUnitPlacement(UnitDatabase.UA_ENFORCER, 1, 9, 1, 3);
_local1.initial_setup_list[UnitDatabase.UA_MERCENARY] = new AIUnitPlacement(UnitDatabase.UA_MERCENARY, 1, 9, 0, 3);
_local1.initial_setup_list[UnitDatabase.UA_ASSASSIN] = new AIUnitPlacement(UnitDatabase.UA_ASSASSIN, 1, 9, 1, 3);
_local1.move_preference_list = new Array();
_local1.move_preference_list.push(UnitDatabase.UA_ENFORCER);
_local1.move_preference_list.push(UnitDatabase.UA_ASSASSIN);
_local1.move_preference_list.push(UnitDatabase.UA_SCOUT);
_local1.leader_protection_radius = 2;
_local1.
= 0.3;
_local1.attack_percentage = 0.8;
_local1.use_best_move_percentage = 1;
archetypes.push(_local1);
_local1 = new AIArchetype();
_local1. = "Chaos Challenge";
_local1.initial_setup_list = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.initial_setup_list[UnitDatabase.UA_LEADER] = new AIUnitPlacement(UnitDatabase.UA_LEADER, 3, 7, 0, 1);
_local1.initial_setup_list[UnitDatabase.UA_SCOUT] = new AIUnitPlacement(UnitDatabase.UA_SCOUT, 1, 9, 1, 3);
_local1.initial_setup_list[UnitDatabase.UA_BOMBER] = new AIUnitPlacement(UnitDatabase.UA_BOMBER, 1, 9, 1, 3);
_local1.initial_setup_list[UnitDatabase.UA_ENFORCER] = new AIUnitPlacement(UnitDatabase.UA_ENFORCER, 1, 9, 1, 3);
_local1.initial_setup_list[UnitDatabase.UA_MERCENARY] = new AIUnitPlacement(UnitDatabase.UA_MERCENARY, 1, 9, 0, 3);
_local1.initial_setup_list[UnitDatabase.UA_ASSASSIN] = new AIUnitPlacement(UnitDatabase.UA_ASSASSIN, 1, 9, 1, 3);
_local1.move_preference_list = new Array();
_local1.move_preference_list.push(UnitDatabase.UA_ENFORCER);
_local1.move_preference_list.push(UnitDatabase.UA_ASSASSIN);
_local1.move_preference_list.push(UnitDatabase.UA_SCOUT);
_local1.leader_protection_radius = 2;
_local1.
= 0.3;
_local1.attack_percentage = 0.6;
_local1.use_best_move_percentage = 0.75;
archetypes.push(_local1);
_local1 = new AIArchetype();
_local1. = "Gridlock challenge";
_local1.initial_setup_list = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.initial_setup_list[UnitDatabase.UA_LEADER] = new AIUnitPlacement(UnitDatabase.UA_LEADER, 3, 7, 0, 1);
_local1.initial_setup_list[UnitDatabase.UA_SCOUT] = new AIUnitPlacement(UnitDatabase.UA_SCOUT, 1, 9, 2, 3);
_local1.initial_setup_list[UnitDatabase.UA_BOMBER] = new AIUnitPlacement(UnitDatabase.UA_BOMBER, 1, 9, 1, 3);
_local1.initial_setup_list[UnitDatabase.UA_ENFORCER] = new AIUnitPlacement(UnitDatabase.UA_ENFORCER, 1, 9, 1, 3);
_local1.initial_setup_list[UnitDatabase.UA_MERCENARY] = new AIUnitPlacement(UnitDatabase.UA_MERCENARY, 1, 9, 0, 3);
_local1.initial_setup_list[UnitDatabase.UA_ASSASSIN] = new AIUnitPlacement(UnitDatabase.UA_ASSASSIN, 1, 9, 1, 3);
_local1.move_preference_list = new Array();
_local1.move_preference_list.push(UnitDatabase.UA_SCOUT);
_local1.move_preference_list.push(UnitDatabase.UA_ASSASSIN);
_local1.leader_protection_radius = 2;
_local1.
= 0.3;
_local1.attack_percentage = 0.5;
_local1.use_best_move_percentage = 0.75;
archetypes.push(_local1);
_local1 = new AIArchetype();
_local1. = "Tiny battle";
_local1.initial_setup_list = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.initial_setup_list[UnitDatabase.UA_LEADER] = new AIUnitPlacement(UnitDatabase.UA_LEADER, 3, 7, 0, 1);
_local1.initial_setup_list[UnitDatabase.UA_SCOUT] = new AIUnitPlacement(UnitDatabase.UA_SCOUT, 1, 9, 1, 3);
_local1.initial_setup_list[UnitDatabase.UA_BOMBER] = new AIUnitPlacement(UnitDatabase.UA_BOMBER, 1, 9, 1, 3);
_local1.initial_setup_list[UnitDatabase.UA_ENFORCER] = new AIUnitPlacement(UnitDatabase.UA_ENFORCER, 1, 9, 1, 3);
_local1.initial_setup_list[UnitDatabase.UA_MERCENARY] = new AIUnitPlacement(UnitDatabase.UA_MERCENARY, 1, 9, 0, 3);
_local1.initial_setup_list[UnitDatabase.UA_ASSASSIN] = new AIUnitPlacement(UnitDatabase.UA_ASSASSIN, 1, 9, 1, 3);
_local1.move_preference_list = new Array();
_local1.move_preference_list.push(UnitDatabase.UA_ENFORCER);
_local1.move_preference_list.push(UnitDatabase.UA_ASSASSIN);
_local1.move_preference_list.push(UnitDatabase.UA_SCOUT);
_local1.leader_protection_radius = 2;
_local1.
= 0.25;
_local1.attack_percentage = 0.7;
_local1.use_best_move_percentage = 0.9;
archetypes.push(_local1);
_local1 = new AIArchetype();
_local1. = "AI challenge";
_local1.initial_setup_list = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.initial_setup_list[UnitDatabase.UA_LEADER] = new AIUnitPlacement(UnitDatabase.UA_LEADER, 3, 7, 0, 1);
_local1.initial_setup_list[UnitDatabase.UA_SCOUT] = new AIUnitPlacement(UnitDatabase.UA_SCOUT, 1, 9, 2, 3);
_local1.initial_setup_list[UnitDatabase.UA_BOMBER] = new AIUnitPlacement(UnitDatabase.UA_BOMBER, 1, 9, 1, 3);
_local1.initial_setup_list[UnitDatabase.UA_ENFORCER] = new AIUnitPlacement(UnitDatabase.UA_ENFORCER, 1, 9, 1, 3);
_local1.initial_setup_list[UnitDatabase.UA_MERCENARY] = new AIUnitPlacement(UnitDatabase.UA_MERCENARY, 1, 9, 0, 3);
_local1.initial_setup_list[UnitDatabase.UA_ASSASSIN] = new AIUnitPlacement(UnitDatabase.UA_ASSASSIN, 1, 9, 1, 3);
_local1.move_preference_list = new Array();
_local1.move_preference_list.push(UnitDatabase.UA_ENFORCER);
_local1.move_preference_list.push(UnitDatabase.UA_ASSASSIN);
_local1.move_preference_list.push(UnitDatabase.UA_SCOUT);
_local1.leader_protection_radius = 2;
_local1.
= 0.1;
_local1.attack_percentage = 0.8;
_local1.use_best_move_percentage = 1;
archetypes.push(_local1);
}
}
}//package Subterfuge
Section 57
//AIMove (Subterfuge.AIMove)
package Subterfuge {
public class AIMove {
var target_cell:Cell;
var win_chance:Number;
var start_cell:Cell;
}
}//package Subterfuge
Section 58
//AIUnitPlacement (Subterfuge.AIUnitPlacement)
package Subterfuge {
public class AIUnitPlacement {
var y_end:int;
var x_end:int;
var unit_type:int;
var x_start:int;
var y_start:int;
public function AIUnitPlacement(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int){
unit_type = _arg1;
x_start = _arg2;
x_end = _arg3;
y_start = _arg4;
y_end = _arg5;
}
}
}//package Subterfuge
Section 59
//BoardAnalysis (Subterfuge.BoardAnalysis)
package Subterfuge {
public class BoardAnalysis {
var :GenericAI;
public var capture_moves:Array;
var :UnitPool;
public var combat_moves:Array;
var :UnitPool;
public function add_unit_information(_arg1:Unit, _arg2:Unit, _arg3:Boolean){
var _local4:MatchRules;
var _local5:*;
var _local6:int;
var _local7:Boolean;
_local4 = MatchManager.PTR.rules;
_local5 = UnitDatabase.UA_MAX_TYPES;
_local6 = 0;
while (_local6 < UnitDatabase.UA_MAX_TYPES) {
if (_arg3){
_local7 = (_local4.test_types(_local6, _arg2.archetype.type_id) == 1);
} else {
_local7 = (_local4.test_types(_arg2.archetype.type_id, _local6) == 0);
};
if (_local7 == false){
_arg1.type_possibilities[_local6] = false;
_local5--;
};
_local6++;
};
if (_local5 == 1){
_local6 = 0;
while (_local6 < UnitDatabase.UA_MAX_TYPES) {
if (_arg1.type_possibilities[_local6] == true){
_arg1.type_identified = _local6;
break;
};
_local6++;
};
};
}
public function update():void{
var _local1:MatchRules;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:Unit;
var _local6:int;
var _local7:Unit;
var _local8:AIMove;
var _local9:int;
_local1 = MatchManager.PTR.rules;
capture_moves = new Array();
combat_moves = new Array();
_local4 = 0;
while (_local4 < .unit_list.length) {
_local5 = .unit_list[_local4];
_local6 = 0;
while (_local6 < .unit_list.length) {
_local7 = .unit_list[_local6];
if (GameBoard.PTR.get_distance(_local5.cell, _local7.cell) <= _local5.archetype.movement_rate){
_local8 = new AIMove();
_local8.start_cell = _local5.cell;
_local8.target_cell = _local7.cell;
if (_local5.archetype.can_attack){
if (_local5.archetype.is_leader == false){
_local2 = 0;
_local3 = 0;
_local9 = 0;
while (_local9 < UnitDatabase.UA_MAX_TYPES) {
if (_local7.type_possibilities[_local9] == true){
_local3++;
if (_local1.test_types(_local5.archetype.type_id, _local9) == true){
_local2++;
};
};
_local9++;
};
if (_local2 == _local3){
_local8.win_chance = 1;
capture_moves.push(_local8);
} else {
if (_local2 > 0){
_local8.win_chance = (Number(_local2) / Number(_local3));
combat_moves.push(_local8);
};
};
};
};
};
_local6++;
};
_local4++;
};
if (capture_moves.length > 0){
} else {
if (combat_moves.length > 0){
};
};
}
public function initialize(_arg1:GenericAI, _arg2:UnitPool, _arg3:UnitPool):void{
= _arg1;
= _arg2;
= _arg3;
}
}
}//package Subterfuge
Section 60
//Cell (Subterfuge.Cell)
package Subterfuge {
import flash.display.*;
import org.papervision3d.objects.*;
public class Cell {
public var unit:Unit;
var pos_x:int;
var pos_y:int;
var :int;
var array_x:int;
var array_y:int;
var passable:Boolean;
var :MovieClip;
var :Cube;
var size_x:int;
var size_y:int;
static var STATE_NORMAL:int = 0;
static var STATE_HIGHLIGHT:int = 1;
static var STATE_MOVEMENT:int = 2;
public function switch_state(_arg1:int):void{
if ( == null){
return;
};
if (_arg1 == STATE_NORMAL){
= _arg1;
.gotoAndStop(1);
} else {
if (_arg1 == STATE_HIGHLIGHT){
= _arg1;
.gotoAndStop(2);
} else {
if (_arg1 == STATE_MOVEMENT){
= _arg1;
.gotoAndStop(3);
};
};
};
}
public function destroy():void{
Application.PTR.layer_grid.removeChild();
= null;
unit = null;
}
public function initialize():void{
var _local1:Number;
var _local2:Number;
unit = null;
if (passable){
} else {
_local1 = 220;
_local2 = (120 + (Math.random() * 350));
= new Cube(GameBoard.PTR.cube_material, ((_local1 * 0.7) + (Math.random() * 0.4)), _local2, ((_local1 * 0.7) + (Math.random() * 0.4)));
GameBoard.PTR.scene_2.addChild();
.x = (-((array_x - 5)) * _local1);
.y = (-((array_y - 5)) * _local1);
.z = (_local2 * 0.5);
};
size_x = 40;
size_y = 40;
if (passable){
= new CellEmpty();
} else {
= new CellFilled();
};
.x = pos_x;
.y = pos_y;
.blendMode = BlendMode.ADD;
.alpha = 0.6;
Application.PTR.layer_grid.addChild();
.stop();
= STATE_NORMAL;
}
public function contains_point(_arg1:int, _arg2:int):Boolean{
if (_arg1 <= pos_x){
return (false);
};
if (_arg1 >= (pos_x + size_x)){
return (false);
};
if (_arg2 <= pos_y){
return (false);
};
if (_arg2 >= (pos_y + size_y)){
return (false);
};
return (true);
}
}
}//package Subterfuge
Section 61
//CreditsScreen (Subterfuge.CreditsScreen)
package Subterfuge {
import flash.display.*;
public class CreditsScreen extends IScreen {
var bkg_clip:MovieClip;
override public function update(_arg1:Number):void{
}
override public function enter_screen():void{
bkg_clip = new ScreenCredits();
bkg_clip.x = 0;
bkg_clip.y = 0;
Application.get_singleton().layer_menu.addChild(bkg_clip);
clip_switch_active = true;
clip_switch_array = new Array();
clip_switch_target = new Array();
clip_switch_array.push(bkg_clip.ok_btn);
clip_switch_target.push(IScreen.IS_MAIN_MENU);
clip_switch_active = true;
}
override public function get_id():int{
return (IScreen.IS_CREDITS);
}
override public function exit_screen():void{
Application.get_singleton().layer_menu.removeChild(bkg_clip);
bkg_clip = null;
}
}
}//package Subterfuge
Section 62
//Game (Subterfuge.Game)
package Subterfuge {
import flash.events.*;
public class Game extends IScreen {
var :Boolean;
var :Array;
public function Game(){
request_fade = true;
}
override public function mouse_up_handler(_arg1:MouseEvent):void{
}
override public function update(_arg1:Number):void{
var _local2:int;
_local2 = 0;
while (_local2 < .length) {
[_local2].update(_arg1);
_local2++;
};
if (MatchManager.PTR.exit_match == true){
if (MatchManager.PTR.player_win){
if (Application.get_singleton().challenge_mode){
dynamic_transition_desired = IScreen.IS_MAIN_MENU;
} else {
if (Application.get_singleton().current_mission == 8){
dynamic_transition_desired = IScreen.IS_GAME_OVER;
} else {
dynamic_transition_desired = IScreen.IS_MISSION_INFO;
Application.get_singleton().current_mission++;
};
};
} else {
dynamic_transition_desired = IScreen.IS_MAIN_MENU;
};
};
}
override public function enter_screen():void{
var _local1:int;
= new Array();
.push((MessageBoard.PTR = new MessageBoard()));
.push((UnitDatabase.PTR = new UnitDatabase()));
.push((GameBoard.PTR = new GameBoard()));
.push((MatchManager.PTR = new MatchManager()));
.push((UISidebar.PTR = new UISidebar()));
_local1 = 0;
while (_local1 < .length) {
[_local1].initialize();
_local1++;
};
dynamic_transition_desired = -1;
}
override public function key_down_handler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == 80){
};
}
override public function mouse_left_window():void{
}
override public function mouse_enter_window():void{
}
override public function mouse_down_handler(_arg1:MouseEvent):void{
}
override public function get_id():int{
return (IScreen.IS_PLAYING_GAME);
}
override public function exit_screen():void{
();
}
public function ():void{
var _local1:int;
_local1 = 0;
while (_local1 < .length) {
[_local1].destroy();
[_local1] = null;
_local1++;
};
= null;
}
}
}//package Subterfuge
Section 63
//GameBoard (Subterfuge.GameBoard)
package Subterfuge {
import flash.display.*;
import org.papervision3d.materials.*;
import org.papervision3d.objects.*;
import org.papervision3d.utils.*;
import org.papervision3d.scenes.*;
import org.papervision3d.cameras.*;
public class GameBoard extends Sprite {
public var :BitmapAssetMaterial;
var :Camera3D;
var :Sprite;
public var
:Plane;
var :Array;
public var :Scene3D;
public var scene_2:Scene3D;
var fill_count:int;
var size_x:int;
var size_y:int;
var background_clip:MovieClip;
public var cube_material:MaterialsList;
var
:Sprite;
static var PTR:GameBoard;
public function GameBoard(){
var _local1:ColorMaterial;
var _local2:ColorMaterial;
var _local3:ColorMaterial;
super();
= new Array();
size_x = 11;
size_y = 11;
fill_count = 0;
= new Sprite();
Application.get_singleton().layer_grid.addChild(
);
.x = 238;
.y = 245;
= new Scene3D(
);
= new Sprite();
Application.get_singleton().layer_objects2.addChild();
.x = 238;
.y = 245;
scene_2 = new Scene3D();
= new Camera3D(null, 0.28, 7500);
.sort = true;
.x = 0;
.y = 0;
.z = 1000;
= new BitmapAssetMaterial("GridTexture");
= new Plane( , 2400, 2400, 8, 8);
.addChild(
);
.x = 0;
.y = 0;
.z = 0;
.yaw(180);
_local1 = new ColorMaterial(3355450);
_local2 = new ColorMaterial(5592422);
_local3 = new ColorMaterial(0xAAAAAA);
cube_material = new MaterialsList();
cube_material.(_local1, "left");
cube_material.(_local1, "right");
cube_material.(_local3, "front");
cube_material.(_local3, "back");
cube_material.(_local2, "top");
cube_material.(_local2, "bottom");
run_animation(0);
}
public function destroy():void{
var _local1:int;
var _local2:int;
var _local3:Cell;
.removeChild(
);
= null;
scene_2 = null;
= null;
Application.get_singleton().layer_objects2.removeChild();
= null;
Application.get_singleton().layer_grid.removeChild(
);
= null;
_local1 = 0;
while (_local1 < size_y) {
_local2 = 0;
while (_local2 < size_x) {
_local3 = [(_local2 + (_local1 * size_x))];
_local3.unit = null;
_local3.destroy();
_local2++;
};
_local1++;
};
= null;
}
public function get_random_cell(_arg1:Boolean, _arg2:int=-1, _arg3:int=-1, _arg4:int=-1, _arg5:int=-1):Cell{
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:Cell;
_local6 = 0;
while (1) {
if (_arg4 == -1){
_local7 = int((Math.random() * size_x));
} else {
_local7 = (_arg4 + int((Math.random() * ((_arg5 - _arg4) + 1))));
};
if (_arg2 == -1){
_local8 = int((Math.random() * size_y));
} else {
_local8 = (_arg2 + int((Math.random() * ((_arg3 - _arg2) + 1))));
};
_local9 = [(_local7 + (_local8 * size_x))];
if (_arg1){
if (_local9.passable == false){
return (_local9);
};
} else {
if (_local9.passable == true){
if (_local9.unit == null){
return (_local9);
};
};
};
_local6++;
if (_local6 > 10000){
break;
};
};
return (null);
}
public function show_movement_range(_arg1:Cell, _arg2:int, _arg3:int=0):void{
var _local4:int;
var _local5:int;
var _local6:Cell;
_local4 = _arg3;
while (_local4 < size_y) {
_local5 = 0;
while (_local5 < size_x) {
_local6 = [(_local5 + (_local4 * size_x))];
if (_local6.passable){
if (get_distance(_arg1, _local6) <= _arg2){
_local6.switch_state(Cell.STATE_MOVEMENT);
} else {
_local6.switch_state(Cell.STATE_NORMAL);
};
};
_local5++;
};
_local4++;
};
}
public function fill_squares(_arg1:int){
var _local2:int;
var _local3:Cell;
var _local4:int;
fill_count = _arg1;
_arg1 = 0;
while (_arg1 < (fill_count / 2)) {
_local3 = get_random_cell(false, 0, ((size_y / 2) - 1));
if (_local3){
_local3.passable = false;
};
_arg1++;
};
_arg1 = 0;
while (_arg1 < (fill_count / 2)) {
_local3 = get_random_cell(false, ((size_y / 2) + 1), (size_y - 1));
if (_local3){
_local3.passable = false;
};
_arg1++;
};
_local2 = 0;
while (_local2 < size_y) {
_local4 = 0;
while (_local4 < size_x) {
[(_local4 + (_local2 * size_x))].initialize();
_local4++;
};
_local2++;
};
}
public function initialize():void{
var _local1:Cell;
var _local2:int;
var _local3:int;
_local2 = 0;
while (_local2 < size_y) {
_local3 = 0;
while (_local3 < size_x) {
_local1 = new Cell();
[(_local3 + (_local2 * size_x))] = _local1;
_local1.array_x = _local3;
_local1.array_y = _local2;
_local1.pos_x = (18 + (_local3 * 40));
_local1.pos_y = (25 + (_local2 * 40));
_local1.passable = true;
_local3++;
};
_local2++;
};
}
function (_arg1:Number, _arg2:Number, _arg3:Number):Number{
return ((_arg1 + (_arg3 * (_arg2 - _arg1))));
}
public function get_distance(_arg1:Cell, _arg2:Cell):int{
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
_local3 = 0;
_local4 = _arg1.array_x;
_local5 = _arg1.array_y;
_local6 = _arg2.array_x;
_local7 = _arg2.array_y;
while ((((_local4 == _local6)) && ((_local5 == _local7))) == false) {
if (_local4 < _local6){
_local4++;
} else {
if (_local4 > _local6){
_local4--;
};
};
if (_local5 < _local7){
_local5++;
} else {
if (_local5 > _local7){
_local5--;
};
};
_local3++;
};
return (_local3);
}
public function get_cell(_arg1:int, _arg2:int):Cell{
if (_arg1 < 0){
return (null);
};
if (_arg2 < 0){
return (null);
};
if (_arg1 >= size_x){
return (null);
};
if (_arg2 >= size_y){
return (null);
};
return ([(_arg1 + (_arg2 * size_x))]);
}
public function update(_arg1:Number):void{
.renderCamera();
scene_2.renderCamera();
}
public function run_animation(_arg1:Number){
if (_arg1 < 0.5){
.x = (300, 0, (_arg1 * 2));
.y = (-15000, -8000, (_arg1 * 2));
.z = (1000, 3000, (_arg1 * 2));
} else {
.x = 0;
.y = (-8000, 0, ((_arg1 - 0.5) * 2));
.z = (3000, 4000, ((_arg1 - 0.5) * 2));
};
}
public function screen_to_cell(_arg1:int, _arg2:int):Cell{
var _local3:int;
var _local4:int;
var _local5:Cell;
_local3 = 0;
while (_local3 < size_y) {
_local4 = 0;
while (_local4 < size_x) {
_local5 = [(_local4 + (_local3 * size_x))];
if (_local5.contains_point(_arg1, _arg2)){
return (_local5);
};
_local4++;
};
_local3++;
};
return (null);
}
}
}//package Subterfuge
Section 64
//GameOverScreen (Subterfuge.GameOverScreen)
package Subterfuge {
import flash.display.*;
public class GameOverScreen extends IScreen {
var bkg_clip:MovieClip;
override public function update(_arg1:Number):void{
if (bkg_clip.currentFrame == 62){
bkg_clip.final_time.text = GameStatistics.PTR.get_total_game_time();
bkg_clip.final_units.text = GameStatistics.PTR.total_units_lost.toString();
};
}
override public function enter_screen():void{
bkg_clip = new ScreenGameOver();
bkg_clip.x = 0;
bkg_clip.y = 0;
Application.get_singleton().layer_menu.addChild(bkg_clip);
clip_switch_active = true;
clip_switch_array = new Array();
clip_switch_target = new Array();
clip_switch_array.push(bkg_clip.ok_btn);
clip_switch_target.push(IScreen.IS_MAIN_MENU);
clip_switch_active = true;
SoundManager.PTR.sfx_event(SoundManager.SM_GAME_WIN);
}
override public function get_id():int{
return (IScreen.IS_GAME_OVER);
}
override public function exit_screen():void{
Application.get_singleton().layer_menu.removeChild(bkg_clip);
bkg_clip = null;
}
}
}//package Subterfuge
Section 65
//GameStatistics (Subterfuge.GameStatistics)
package Subterfuge {
public class GameStatistics {
var :int;
var :int;
var
:Boolean;
var :int;
public var total_units_lost:int;
public var mission_units_lost:int;
public static var PTR:GameStatistics;
public function GameStatistics(){
= 0;
= false;
}
public function get_mission_complete_time():String{
return ( ( ));
}
public function update():void{
++;
if ( >= 30){
= 0;
if (
){
++;
};
};
}
public function full_reset(){
total_units_lost = 0;
= 0;
= 0;
}
public function mission_start(){
= 0;
mission_units_lost = 0;
= true;
}
public function mission_end(){
= ( + );
= false;
}
public function add_lost_unit(){
mission_units_lost++;
total_units_lost++;
}
function (_arg1:int):String{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
_local2 = (_arg1 / 60);
_local3 = (_arg1 - (_local2 * 60));
_local4 = (_local3 / 10);
_local5 = (_local3 % 10);
return ((((_local2.toString() + ":") + _local4.toString()) + _local5.toString()));
}
public function get_total_game_time():String{
return ( ( ));
}
}
}//package Subterfuge
Section 66
//GenericAI (Subterfuge.GenericAI)
package Subterfuge {
public class GenericAI extends MatchPlayer {
var analyzer:BoardAnalysis;
var archetype:AIArchetype;
public function GenericAI(_arg1:AIArchetype){
= false;
archetype = _arg1;
analyzer = new BoardAnalysis();
}
public function (_arg1:Unit, _arg2:Cell, _arg3:Cell):Cell{
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:int;
var _local11:int;
var _local12:int;
var _local13:Cell;
var _local14:int;
var _local15:int;
var _local16:Cell;
var _local17:int;
var _local18:int;
_local4 = GameBoard.PTR.get_distance(_arg2, _arg3);
_local5 = _arg1.archetype.movement_rate;
_local6 = _arg2.array_x;
_local7 = _arg2.array_y;
_local8 = _arg3.array_x;
_local9 = _arg3.array_y;
_local10 = ((_local8)>_local6) ? _local6 : (_local6 - _local5);
_local11 = ((_local9)>_local7) ? _local7 : (_local7 - _local5);
_local12 = 100000;
_local13 = null;
_local14 = (_local11 + 0);
while (_local14 <= (_local11 + _local5)) {
_local15 = (_local10 + 0);
while (_local15 <= (_local10 + _local5)) {
_local16 = GameBoard.PTR.get_cell(_local15, _local14);
if (!_local16){
} else {
if (_local16.unit != null){
} else {
if (_local16.passable == false){
} else {
_local17 = GameBoard.PTR.get_distance(_arg2, _local16);
_local18 = GameBoard.PTR.get_distance(_local16, _arg3);
if (_local17 > _local5){
} else {
if (_local18 < _local12){
_local12 = _local18;
_local13 = _local16;
};
};
};
};
};
_local15++;
};
_local14++;
};
if (_local13 == null){
};
return (_local13);
}
public function ():AIMove{
var _local1:AIMove;
var _local2:Array;
var _local3:int;
var _local4:int;
var _local5:Unit;
var _local6:UnitPool;
var _local7:int;
var _local8:Cell;
var _local9:Unit;
var _local10:Unit;
var _local11:int;
var _local12:Unit;
var _local13:int;
_local1 = new AIMove();
_local2 = new Array();
_local3 = 0;
while (_local3 < unit_pool.unit_list.length) {
_local10 = unit_pool.unit_list[_local3];
_local11 = 0;
while (_local11 < archetype.move_preference_list.length) {
if (_local10.archetype.type_id == archetype.move_preference_list[_local11]){
_local2.push(_local10);
};
_local11++;
};
_local3++;
};
if (_local2.length == 0){
_local3 = 0;
while (_local3 < unit_pool.unit_list.length) {
if (unit_pool.unit_list.length > 1){
if (unit_pool.unit_list[_local3].archetype.type_id != UnitDatabase.UA_LEADER){
_local2.push(unit_pool.unit_list[_local3]);
};
} else {
_local2.push(unit_pool.unit_list[_local3]);
};
_local3++;
};
//unresolved jump
};
_local4 = int((Math.random() * (_local2.length - 1)));
_local5 = _local2[_local4];
_local6 = MatchManager.PTR.human_player.unit_pool;
_local7 = int((Math.random() * (_local6.unit_list.length - 1)));
_local8 = _local6.unit_list[_local7].cell;
_local3 = 0;
while (_local3 < unit_pool.unit_list.length) {
if (unit_pool.unit_list[_local3].archetype.type_id == UnitDatabase.UA_LEADER){
break;
};
_local3++;
};
_local9 = unit_pool.unit_list[_local3];
_local11 = 0;
while (_local11 < _local6.unit_list.length) {
_local12 = _local6.unit_list[_local11];
_local13 = GameBoard.PTR.get_distance(_local12.cell, _local9.cell);
if (_local13 <= archetype.leader_protection_radius){
_local5 = _local9;
_local8 = GameBoard.PTR.get_random_cell(true);
break;
};
_local11++;
};
_local8 = (_local5, _local5.cell, _local8);
_local1.start_cell = _local5.cell;
_local1.target_cell = _local8;
return (_local1);
}
public function calculate_move():AIMove{
var _local1:AIMove;
var _local2:Number;
var _local3:Number;
_local1 = null;
analyzer.update();
_local2 = Math.random();
if (analyzer.capture_moves.length > 0){
if (_local2 < archetype.use_best_move_percentage){
_local1 = analyzer.capture_moves[int((Math.random() * analyzer.capture_moves.length))];
//unresolved jump
};
};
if (_local1 == null){
_local3 = Math.random();
if (analyzer.combat_moves.length > 0){
if (_local3 < archetype.attack_percentage){
_local1 = analyzer.combat_moves[int((Math.random() * analyzer.combat_moves.length))];
};
};
};
if (_local1 == null){
_local1 = ();
};
if (_local1.start_cell.unit == null){
};
return (_local1);
}
public function hide_units():void{
var _local1:int;
_local1 = 0;
while (_local1 < unit_pool.unit_list.length) {
unit_pool.unit_list[_local1].set_visual_state(Unit.US_AI_HIDDEN);
_local1++;
};
}
override public function auto_populate(_arg1:MissionArchetype){
var _local2:int;
var _local3:int;
var _local4:Array;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:Cell;
_local2 = 0;
_local3 = 4;
_local4 = archetype.initial_setup_list;
_local5 = 0;
while (_local5 < UnitDatabase.UA_MAX_TYPES) {
_local6 = _arg1.AI_starting_units[_local5];
_local7 = 0;
while (_local7 < _local6) {
_local8 = GameBoard.PTR.get_random_cell(false, _local4[_local5].y_start, _local4[_local5].y_end, _local4[_local5].x_start, _local4[_local5].x_end);
if (_local8 == null){
_local8 = GameBoard.PTR.get_random_cell(false, 0, 3, 0, 10);
};
_local8.unit = unit_pool.create_unit(_local5);
_local8.unit.set_cell(_local8);
_local8.unit.controller = this;
_local8.unit.set_visual_state(Unit.US_AI_HIDDEN);
_local7++;
};
_local5++;
};
analyzer.initialize(this, unit_pool, MatchManager.PTR.human_player.unit_pool);
}
public function reveal_all_units():void{
var _local1:int;
_local1 = 0;
while (_local1 < unit_pool.unit_list.length) {
if (unit_pool.unit_list[_local1]){
unit_pool.unit_list[_local1].set_visual_state(Unit.US_AI_REVEALED);
};
_local1++;
};
}
}
}//package Subterfuge
Section 67
//IGameSystem (Subterfuge.IGameSystem)
package Subterfuge {
interface IGameSystem {
function initialize():void;
function update(_arg1:Number):void;
function destroy():void;
}
}//package Subterfuge
Section 68
//InstructionsScreen (Subterfuge.InstructionsScreen)
package Subterfuge {
import flash.display.*;
public class InstructionsScreen extends IScreen {
var bkg_clip:MovieClip;
override public function update(_arg1:Number):void{
}
override public function enter_screen():void{
bkg_clip = new ScreenInstructions();
bkg_clip.x = 0;
bkg_clip.y = 0;
Application.get_singleton().layer_menu.addChild(bkg_clip);
clip_switch_active = true;
clip_switch_array = new Array();
clip_switch_target = new Array();
clip_switch_array.push(bkg_clip.ok_btn);
clip_switch_target.push(IScreen.IS_MAIN_MENU);
clip_switch_active = true;
}
override public function get_id():int{
return (IScreen.IS_INSTRUCTIONS);
}
override public function exit_screen():void{
Application.get_singleton().layer_menu.removeChild(bkg_clip);
bkg_clip = null;
}
}
}//package Subterfuge
Section 69
//IWindowButton (Subterfuge.IWindowButton)
package Subterfuge {
import flash.display.*;
public class IWindowButton {
var button_id:String;
var button_clip:MovieClip;
}
}//package Subterfuge
Section 70
//IWindowComponent (Subterfuge.IWindowComponent)
package Subterfuge {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class IWindowComponent {
var active:Boolean;
var button_list:Array;
var clip:MovieClip;
var name_id:String;
var close_pending:Boolean;
var
:String;
var z_level:int;
public function display():void{
var _local1:Class;
_local1 = (getDefinitionByName(
) as Class);
clip = new (_local1);
active = true;
close_pending = false;
if (clip == null){
};
Application.get_singleton().layer_menu.addChild(clip);
clip.x = 250;
clip.y = 200;
initialize_buttons();
}
public function hide():void{
if (clip){
Application.get_singleton().layer_menu.removeChild(clip);
clip = null;
active = false;
};
}
final public function check_buttons(_arg1:MouseEvent):void{
var _local2:int;
var _local3:IWindowButton;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
if (button_list){
_local2 = 0;
while (_local2 < button_list.length) {
_local3 = button_list[_local2];
_local4 = ((clip.x + _local3.button_clip.x) - _local3.button_clip.width);
_local5 = ((clip.x + _local3.button_clip.x) + _local3.button_clip.width);
_local6 = ((clip.y + _local3.button_clip.y) - _local3.button_clip.height);
_local7 = ((clip.y + _local3.button_clip.y) + _local3.button_clip.height);
if ((((((((_arg1.stageX >= _local4)) && ((_arg1.stageX <= _local5)))) && ((_arg1.stageY >= _local6)))) && ((_arg1.stageY <= _local7)))){
button_click(_local3);
SoundManager.PTR.sfx_event(SoundManager.SM_BUTTON);
return;
};
_local2++;
};
};
}
public function initialize_buttons():void{
}
public function button_click(_arg1:IWindowButton):void{
}
public function mouse_down(_arg1:MouseEvent):void{
}
}
}//package Subterfuge
Section 71
//LoseMissionWindow (Subterfuge.LoseMissionWindow)
package Subterfuge {
import flash.events.*;
public class LoseMissionWindow extends IWindowComponent {
public function LoseMissionWindow(){
name_id = "win_mission";
= "WindowLoseMission";
z_level = 2;
}
override public function initialize_buttons():void{
var _local1:IWindowButton;
button_list = new Array();
_local1 = new IWindowButton();
_local1.button_id = "ok_button";
_local1.button_clip = clip.ok_button;
button_list.push(_local1);
clip.mission_time.text = GameStatistics.PTR.get_mission_complete_time();
clip.units_lost.text = GameStatistics.PTR.mission_units_lost.toString();
}
override public function button_click(_arg1:IWindowButton):void{
close_pending = true;
}
override public function mouse_down(_arg1:MouseEvent):void{
}
}
}//package Subterfuge
Section 72
//MainMenuScreen (Subterfuge.MainMenuScreen)
package Subterfuge {
import flash.display.*;
import flash.filters.*;
public class MainMenuScreen extends IScreen {
var menu_clip:MovieClip;
var highlight_target:int;
public function MainMenuScreen(){
request_fade = true;
}
override public function update(_arg1:Number):void{
var _local2:int;
var _local3:GlowFilter;
_local2 = get_clip_at_location(Application.get_singleton().stage.mouseX, Application.get_singleton().stage.mouseY);
if (_local2 != highlight_target){
if (highlight_target != -1){
clip_switch_array[highlight_target].filters = null;
};
highlight_target = _local2;
if (highlight_target != -1){
_local3 = new GlowFilter();
_local3.alpha = 1;
_local3.quality = BitmapFilterQuality.HIGH;
_local3.strength = 3;
_local3.blurX = 10;
_local3.blurY = 10;
_local3.color = 0xAAAAAA;
clip_switch_array[highlight_target].filters = new Array(_local3);
};
};
}
override public function enter_screen():void{
SoundManager.PTR.sfx_event(SoundManager.SM_MAIN_MENU);
menu_clip = new WindowMainMenu();
menu_clip.x = 0;
menu_clip.y = 0;
Application.get_singleton().layer_menu.addChild(menu_clip);
clip_switch_active = true;
clip_switch_array = new Array();
clip_switch_target = new Array();
clip_switch_array.push(menu_clip.btn_play_game);
clip_switch_target.push(IScreen.IS_MISSION_INFO);
clip_switch_array.push(menu_clip.btn_challenge);
clip_switch_target.push(IScreen.IS_SELECT_CHALLENGE);
clip_switch_array.push(menu_clip.btn_play_more_games);
clip_switch_target.push(IScreen.IS_PLAY_MORE_GAMES);
clip_switch_array.push(menu_clip.btn_gaming_news);
clip_switch_target.push(IScreen.IS_GAMING_NEWS);
clip_switch_array.push(menu_clip.btn_instructions);
clip_switch_target.push(IScreen.IS_INSTRUCTIONS);
clip_switch_array.push(menu_clip.btn_credits);
clip_switch_target.push(IScreen.IS_CREDITS);
clip_switch_active = true;
highlight_target = -1;
GameStatistics.PTR.full_reset();
Application.get_singleton().current_mission = 1;
}
override public function get_id():int{
return (IScreen.IS_MAIN_MENU);
}
override public function exit_screen():void{
Application.get_singleton().layer_menu.removeChild(menu_clip);
menu_clip = null;
}
}
}//package Subterfuge
Section 73
//MatchManager (Subterfuge.MatchManager)
package Subterfuge {
import flash.events.*;
public class MatchManager implements IGameSystem {
var
:Cell;
var :Boolean;
var :LoseMissionWindow;
var
:int;
var
:WinMissionWindow;
var
:PieceSetupWindow;
var
:Cell;
var
:Boolean;
var
:int;
var
:AIArchetype;
var human_player:MatchPlayer;
var
:Boolean;
var
:int;
var
:int;
var current_mission:int;
var
:GenericAI;
var
:MatchStartLogo;
var :Boolean;
var :StartMatchWindow;
var :MatchPlayer;
var exit_match:Boolean;
var :int;
var :MatchWindow;
public var rules:MatchRules;
var :Cell;
var :MissionArchetype;
var player_win:Boolean;
static const MS_RESOLVE_COMBAT:int = 5;
static const MS_PLAYER_SELECT_UNIT:int = 0;
static const MOVE_PIECE_TIME:int = 12;
static const MS_PLAYER_SELECT_TARGET:int = 1;
static const MS_AI_PICK_MOVE:int = 2;
static const MS_MATCH_START:int = 10;
static const MS_LOSE_DIALOG:int = 12;
static const MS_START_MOVE_UNIT:int = 6;
static const MS_ATTACK_PHASE:int = 3;
static const MS_SETUP_DIALOG:int = 9;
static const MS_WIN_DIALOG:int = 11;
static const MS_MATCH_OVER:int = 99;
static const MS_INTRO_FLYIN:int = 13;
static const MS_REVEAL_PIECES:int = 4;
static const MS_LEADER_SWAP:int = 8;
static const MS_FINISH_MOVE_UNIT:int = 7;
static var PTR:MatchManager;
public function MatchManager(){
rules = new MatchRules();
= MS_MATCH_START;
= 0;
= true;
}
public function mouse_down(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
var _local4:Cell;
var _local5:int;
var _local6:Boolean;
_local2 = Application.PTR.stage.mouseX;
_local3 = Application.PTR.stage.mouseY;
if ((((((((_local2 > 486)) && ((_local2 < 658)))) && ((_local3 > 473)))) && ((_local3 < 507)))){
GameStatistics.PTR.mission_end();
.reveal_all_units();
= 60;
= MS_LOSE_DIALOG;
return;
};
if (
== MS_PLAYER_SELECT_UNIT){
_local4 = GameBoard.PTR.screen_to_cell(_local2, _local3);
if (_local4 == null){
return;
};
if (_local4.passable == false){
MessageBoard.PTR.add_line("Square is blocked.");
return;
};
if (_local4.unit == null){
MessageBoard.PTR.add_line("No unit at this square.");
return;
};
if (_local4.unit.controller != ){
MessageBoard.PTR.add_line("Unit is not yours.");
return;
};
= _local4;
_local4.switch_state(Cell.STATE_HIGHLIGHT);
GameBoard.PTR.show_movement_range(_local4,
.unit.archetype.movement_rate, () ? 7 : 0);
UISidebar.PTR.display_unit_info(
.unit);
SoundManager.PTR.sfx_event(SoundManager.SM_BUTTON);
} else {
if (
== MS_PLAYER_SELECT_TARGET){
_local2 = Application.PTR.stage.mouseX;
_local3 = Application.PTR.stage.mouseY;
GameBoard.PTR.show_movement_range(
, -1);
_local4 = GameBoard.PTR.screen_to_cell(_local2, _local3);
if (_local4 == null){
return;
};
_local5 =
.unit.test_move(human_player,
.unit, _local4.array_x, _local4.array_y, );
_local6 = false;
if (_local5 == Unit.UE_VALID_ATTACK){
_local6 = true;
};
if (){
if (_local4.array_y <= 6){
_local5 = Unit.UE_INVALID_SQUARE;
};
};
if (_local6 == false){
if (_local5 != Unit.UE_SUCCESS){
= MS_PLAYER_SELECT_UNIT;
if (_local5 == Unit.UE_INVALID_SQUARE){
MessageBoard.PTR.add_line("Invalid movement destination.");
} else {
if (_local5 == Unit.UE_FRIENDLY_OCCUPIED){
if ((((
.unit.archetype.type_id == UnitDatabase.UA_LEADER)) || ())){
=
;
= _local4;
= MS_LEADER_SWAP;
} else {
MessageBoard.PTR.add_line("Square is occupied.");
};
} else {
if (_local5 == Unit.UE_TOO_FAR){
MessageBoard.PTR.add_line("This unit can't move that far.");
} else {
if (_local5 == Unit.UE_CANT_ATTACK){
MessageBoard.PTR.add_line("This unit type can't attack.");
};
};
};
};
.switch_state(Cell.STATE_NORMAL);
= null;
return;
};
};
.switch_state(Cell.STATE_NORMAL);
=
;
= _local4;
if (_local6){
= MS_ATTACK_PHASE;
} else {
MessageBoard.PTR.add_line((("Your " +
.unit.archetype.name_id) + " moves."));
= MS_START_MOVE_UNIT;
= MOVE_PIECE_TIME;
SoundManager.PTR.sfx_event(SoundManager.SM_PIECE_MOVE);
};
= null;
};
};
}
public function ():void{
var _local1:Boolean;
var _local2:int;
_local1 = false;
_local2 = 0;
while (_local2 < human_player.unit_pool.unit_list.length) {
if (human_player.unit_pool.unit_list[_local2].archetype.is_leader == true){
_local1 = true;
};
_local2++;
};
if (!_local1){
MessageBoard.PTR.add_line("You have been defeated!");
GameStatistics.PTR.mission_end();
.reveal_all_units();
= 90;
= MS_LOSE_DIALOG;
return;
};
_local1 = false;
_local2 = 0;
while (_local2 <
.unit_pool.unit_list.length) {
if (
.unit_pool.unit_list[_local2]){
if (
.unit_pool.unit_list[_local2].archetype.is_leader == true){
_local1 = true;
};
};
_local2++;
};
if (!_local1){
MessageBoard.PTR.add_line("You have won the match!");
GameStatistics.PTR.mission_end();
.reveal_all_units();
= 50;
= MS_WIN_DIALOG;
return;
};
}
public function initialize():void{
exit_match = false;
if (Application.get_singleton().challenge_mode == true){
current_mission = Application.get_singleton().challenge_mission;
} else {
current_mission = Application.get_singleton().current_mission;
};
= MissionDatabase.PTR.missions[(current_mission - 1)];
= AIDatabase.PTR.archetypes[(current_mission - 1)];
= new MatchWindow();
Application.PTR.window_manager.register_window();
.active = true;
GameBoard.PTR.fill_squares( .fill_count);
human_player = new MatchPlayer();
human_player.initialize();
= new GenericAI(
);
.initialize();
= human_player;
= null;
= -1;
}
public function destroy():void{
if (
){
Application.PTR.layer_objects.removeChild(
);
= null;
};
Application.PTR.window_manager.clear_windows();
human_player.destroy();
.destroy();
}
public function
():void{
var _local1:String;
var _local2:String;
var _local3:Cell;
_local1 =
.unit.archetype.name_id;
_local2 = .unit.archetype.name_id;
if (
.unit.controller ==
){
if (
.unit.visual_state != Unit.US_AI_REVEALED){
_local1 = "Enemy unit";
};
};
if (.unit.controller ==
){
if (.unit.visual_state != Unit.US_AI_REVEALED){
_local2 = "enemy unit";
};
};
if (
){
MessageBoard.PTR.add_line((((_local1 + " defeats ") + _local2) + "!"));
_local3 = .unit.cell;
if (.unit.controller == human_player){
GameStatistics.PTR.add_lost_unit();
SoundManager.PTR.sfx_event(SoundManager.SM_ENEMY_CAPTURE);
} else {
SoundManager.PTR.sfx_event(SoundManager.SM_PIECE_CAPTURE);
};
.unit.pool.destroy_unit(.unit);
} else {
MessageBoard.PTR.add_line((((_local1 + " defeated by ") + _local2) + "!"));
if (
.unit.controller == human_player){
GameStatistics.PTR.add_lost_unit();
SoundManager.PTR.sfx_event(SoundManager.SM_ENEMY_CAPTURE);
} else {
SoundManager.PTR.sfx_event(SoundManager.SM_PIECE_CAPTURE);
};
.unit.pool.destroy_unit(
.unit);
};
}
public function update(_arg1:Number):void{
var _local2:Boolean;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:int;
var _local8:int;
var _local9:Cell;
var _local10:Boolean;
var _local11:int;
var _local12:AIMove;
if (exit_match == true){
return;
};
if (
!= -1){
--;
if (
<= 0){
= -1;
switch_state();
} else {
return;
};
};
if (
== MS_INTRO_FLYIN){
++;
GameBoard.PTR.run_animation((
/ 90));
if (
> 90){
this.switch_state(MS_SETUP_DIALOG);
};
return;
} else {
if (
== MS_MATCH_START){
this.switch_state(MS_INTRO_FLYIN);
UISidebar.PTR.set_mission(current_mission);
GameStatistics.PTR.mission_start();
= 0;
return;
};
if (
== MS_SETUP_DIALOG){
if (
.active){
return;
};
= true;
switch_state(MS_PLAYER_SELECT_UNIT);
= new StartMatchWindow();
Application.PTR.window_manager.register_window();
.display();
} else {
if (
== MS_WIN_DIALOG){
if (
.active){
return;
};
exit_match = true;
player_win = true;
return;
} else {
if (
== MS_LOSE_DIALOG){
if (.active){
return;
};
exit_match = true;
player_win = false;
return;
};
};
};
};
if (){
if (.active == false){
= false;
switch_state(MS_PLAYER_SELECT_UNIT);
MessageBoard.PTR.add_line("The battle begins!");
MessageBoard.PTR.add_line("It's your move.");
= new MatchStartLogo();
Application.PTR.layer_objects.addChild(
);
.x = 250;
.y = 230;
SoundManager.PTR.sfx_event(SoundManager.SM_MATCH_START);
return;
};
};
if (
!= MS_MATCH_OVER){
();
};
_local2 = false;
if (
> 0){
--;
if (
== MS_START_MOVE_UNIT){
_local3 =
.pos_x;
_local4 = (.pos_x -
.pos_x);
_local5 =
.pos_y;
_local6 = (.pos_y -
.pos_y);
.unit.set_pixel_position((_local3 + (_local4 * ((MOVE_PIECE_TIME -
) / MOVE_PIECE_TIME))), (_local5 + (_local6 * ((MOVE_PIECE_TIME -
) / MOVE_PIECE_TIME))));
if (
== 0){
= MS_FINISH_MOVE_UNIT;
};
};
return;
};
if (
== MS_PLAYER_SELECT_TARGET){
if (!){
_local7 = Application.PTR.stage.mouseX;
_local8 = Application.PTR.stage.mouseY;
_local9 = GameBoard.PTR.screen_to_cell(_local7, _local8);
if (_local9 == null){
return;
};
_local10 = true;
_local11 =
.unit.test_move(human_player,
.unit, _local9.array_x, _local9.array_y, );
if (_local11 == Unit.UE_VALID_ATTACK){
MouseManager.PTR.set_mouse_frame(3);
} else {
if (_local11 == Unit.UE_SUCCESS){
MouseManager.PTR.set_mouse_frame(2);
} else {
MouseManager.PTR.set_mouse_frame(1);
};
};
};
} else {
MouseManager.PTR.set_mouse_frame(1);
};
if (
== MS_PLAYER_SELECT_UNIT){
if (
){
= MS_PLAYER_SELECT_TARGET;
};
} else {
if (
== MS_FINISH_MOVE_UNIT){
.unit.move_unit();
_local2 = true;
} else {
if (
== MS_ATTACK_PHASE){
if ( == human_player){
MessageBoard.PTR.add_line((("Your " +
.unit.archetype.name_id) + " attacks!"));
} else {
MessageBoard.PTR.add_line("Enemy unit attacks!");
};
= rules.resolve_combat(
.unit, .unit);
= false;
= false;
if (
.unit.archetype.forces_reveal){
= true;
};
if (.unit.archetype.forces_reveal){
= true;
};
if (
){
= true;
} else {
= true;
};
if ( == human_player){
if (
){
.analyzer.add_unit_information(
.unit, .unit, true);
};
} else {
if (
== false){
if (){
.unit.type_identified = .unit.archetype.type_id;
} else {
.analyzer.add_unit_information(.unit,
.unit, false);
};
};
};
= 20;
= MS_REVEAL_PIECES;
} else {
if (
== MS_AI_PICK_MOVE){
.hide_units();
_local12 =
.calculate_move();
if (_local12.target_cell){
= _local12.start_cell;
= _local12.target_cell;
if (_local12.target_cell.unit == null){
= MS_START_MOVE_UNIT;
= MOVE_PIECE_TIME;
SoundManager.PTR.sfx_event(SoundManager.SM_PIECE_MOVE);
} else {
= MS_ATTACK_PHASE;
};
};
} else {
if (
== MS_REVEAL_PIECES){
if (
){
if (
.unit.controller ==
){
.unit.set_visual_state(Unit.US_AI_REVEALED);
};
};
if (){
if (.unit.controller ==
){
.unit.set_visual_state(Unit.US_AI_REVEALED);
};
};
.switch_state(Cell.STATE_HIGHLIGHT);
= 30;
= MS_RESOLVE_COMBAT;
} else {
if (
== MS_RESOLVE_COMBAT){
();
if (
){
= MS_START_MOVE_UNIT;
= MOVE_PIECE_TIME;
} else {
_local2 = true;
= 30;
};
.switch_state(Cell.STATE_NORMAL);
} else {
if (
== MS_LEADER_SWAP){
human_player.unit_pool.swap_units(
.unit, .unit);
if ( == false){
MessageBoard.PTR.add_line("Your leader swaps to a new position.");
};
_local2 = true;
};
};
};
};
};
};
};
if (_local2){
if (){
= MS_PLAYER_SELECT_UNIT;
} else {
if ( == human_player){
= MS_AI_PICK_MOVE;
=
;
= (30 + (Math.random() * 60));
} else {
= MS_PLAYER_SELECT_UNIT;
= human_player;
MessageBoard.PTR.add_line("It's your turn.");
};
};
};
}
public function switch_state(_arg1:int){
= _arg1;
if (
== MS_INTRO_FLYIN){
SoundManager.PTR.sfx_event(SoundManager.SM_BOARD_ZOOM);
} else {
if (
== MS_SETUP_DIALOG){
= new PieceSetupWindow();
Application.PTR.window_manager.register_window(
);
if (current_mission == 1){
.display();
};
human_player.auto_populate( );
.auto_populate( );
} else {
if (
== MS_WIN_DIALOG){
if (Application.get_singleton().challenge_mode){
= new WinChallengeWindow();
} else {
= new WinMissionWindow();
};
Application.PTR.window_manager.register_window(
);
.display();
SoundManager.PTR.sfx_event(SoundManager.SM_MATCH_WIN);
} else {
if (
== MS_LOSE_DIALOG){
= new LoseMissionWindow();
Application.PTR.window_manager.register_window();
.display();
SoundManager.PTR.sfx_event(SoundManager.SM_MATCH_LOSE);
};
};
};
};
}
}
}//package Subterfuge
Section 74
//MatchPlayer (Subterfuge.MatchPlayer)
package Subterfuge {
public class MatchPlayer {
var unit_pool:UnitPool;
var :Boolean;
public function MatchPlayer(){
= true;
}
public function initialize(){
unit_pool = new UnitPool();
unit_pool.initialize();
}
public function destroy(){
unit_pool.destroy();
unit_pool = null;
}
public function auto_populate(_arg1:MissionArchetype){
var _local2:int;
var _local3:int;
var _local4:Cell;
var _local5:int;
var _local6:int;
var _local7:int;
_local2 = 7;
_local3 = 10;
_local5 = 0;
while (_local5 < 15) {
_local6 = _arg1.player_starting_units[_local5];
_local7 = 0;
while (_local7 < _local6) {
if (_local5 == UnitDatabase.UA_LEADER){
_local4 = GameBoard.PTR.get_random_cell(false, _local3, _local3, 3, 7);
} else {
_local4 = GameBoard.PTR.get_random_cell(false, _local2, _local3, 1, 9);
};
_local4.unit = unit_pool.create_unit(_local5);
_local4.unit.set_cell(_local4);
_local4.unit.controller = this;
_local4.unit.set_visual_state(Unit.US_PLAYER);
_local7++;
};
_local5++;
};
}
}
}//package Subterfuge
Section 75
//MatchRules (Subterfuge.MatchRules)
package Subterfuge {
public class MatchRules {
public var :Array;
public function MatchRules(){
var _local1:int;
var _local2:int;
super();
= new Array((UnitDatabase.UA_MAX_TYPES * UnitDatabase.UA_MAX_TYPES));
_local1 = 0;
while (_local1 < (UnitDatabase.UA_MAX_TYPES - 1)) {
_local2 = 0;
while (_local2 < (UnitDatabase.UA_MAX_TYPES - 1)) {
[(_local2 + (_local1 * UnitDatabase.UA_MAX_TYPES))] = 1;
_local2++;
};
_local1++;
};
(UnitDatabase.UA_SCOUT, UnitDatabase.UA_BOMBER);
(UnitDatabase.UA_SCOUT, UnitDatabase.UA_SCOUT);
(UnitDatabase.UA_SCOUT, UnitDatabase.UA_LEADER);
(UnitDatabase.UA_LEADER, UnitDatabase.UA_LEADER);
(UnitDatabase.UA_ASSASSIN, UnitDatabase.UA_LEADER);
(UnitDatabase.UA_ASSASSIN, UnitDatabase.UA_SCOUT);
(UnitDatabase.UA_ASSASSIN, UnitDatabase.UA_ASSASSIN);
(UnitDatabase.UA_ASSASSIN, UnitDatabase.UA_MERCENARY);
(UnitDatabase.UA_ASSASSIN, UnitDatabase.UA_ENFORCER);
(UnitDatabase.UA_MERCENARY, UnitDatabase.UA_MERCENARY);
(UnitDatabase.UA_MERCENARY, UnitDatabase.UA_LEADER);
(UnitDatabase.UA_MERCENARY, UnitDatabase.UA_SCOUT);
(UnitDatabase.UA_MERCENARY, UnitDatabase.UA_ASSASSIN);
(UnitDatabase.UA_ENFORCER, UnitDatabase.UA_ENFORCER);
(UnitDatabase.UA_ENFORCER, UnitDatabase.UA_MERCENARY);
(UnitDatabase.UA_ENFORCER, UnitDatabase.UA_LEADER);
(UnitDatabase.UA_ENFORCER, UnitDatabase.UA_SCOUT);
(UnitDatabase.UA_ENFORCER, UnitDatabase.UA_ASSASSIN);
}
public function (_arg1:int, _arg2:int){
[(_arg1 + (_arg2 * UnitDatabase.UA_MAX_TYPES))] = 0;
}
public function test_types(_arg1:int, _arg2:int):Boolean{
return (([(_arg1 + (_arg2 * UnitDatabase.UA_MAX_TYPES))] == 0));
}
public function resolve_combat(_arg1:Unit, _arg2:Unit):Boolean{
var _local3:int;
var _local4:int;
_local3 = _arg1.archetype.type_id;
_local4 = _arg2.archetype.type_id;
return (test_types(_local3, _local4));
}
}
}//package Subterfuge
Section 76
//MatchWindow (Subterfuge.MatchWindow)
package Subterfuge {
import flash.events.*;
public class MatchWindow extends IWindowComponent {
public function MatchWindow(){
name_id = "match_window";
button_list = null;
z_level = 1;
}
override public function mouse_down(_arg1:MouseEvent):void{
MatchManager.PTR.mouse_down(_arg1);
}
}
}//package Subterfuge
Section 77
//MessageBoard (Subterfuge.MessageBoard)
package Subterfuge {
import flash.text.*;
public class MessageBoard implements IGameSystem {
var :int;
var :int;
var :TextFormat;
var :Array;
var :int;
var :int;
public static var PTR:MessageBoard;
public function MessageBoard(){
= 4;
= 18;
= 480;
= 390;
= new Array();
= new TextFormat();
.font = "Isonorm";
.size = 13;
}
public function add_line(_arg1:String):void{
var _local2:int;
_local2 = 0;
while (_local2 < ( - 1)) {
[_local2].text = [(_local2 + 1)].text;
_local2++;
};
[( - 1)].text = _arg1;
}
public function update(_arg1:Number):void{
}
public function initialize():void{
var _local1:int;
var _local2:TextField;
_local1 = 0;
while (_local1 < ) {
_local2 = new TextField();
_local2.embedFonts = true;
_local2.autoSize = TextFieldAutoSize.LEFT;
_local2.defaultTextFormat = ;
_local2.antiAliasType = AntiAliasType.ADVANCED;
_local2.selectable = false;
_local2.width = 300;
if (_local1 == ( - 1)){
_local2.textColor = 0xFFFFFF;
} else {
_local2.textColor = 0xCCCCCC;
};
_local2.x = ;
_local2.y = ( + (_local1 * ));
[_local1] = _local2;
Application.get_singleton().layer_menu.addChild([_local1]);
_local1++;
};
}
public function destroy():void{
var _local1:int;
_local1 = 0;
while (_local1 < ) {
Application.get_singleton().layer_menu.removeChild([_local1]);
[_local1] = null;
_local1++;
};
}
}
}//package Subterfuge
Section 78
//MissionArchetype (Subterfuge.MissionArchetype)
package Subterfuge {
public class MissionArchetype {
public var name_text:String;
public var description_text:String;
public var :AIArchetype;
public var fill_count:int;
public var player_starting_units:Array;
public var AI_starting_units:Array;
}
}//package Subterfuge
Section 79
//MissionDatabase (Subterfuge.MissionDatabase)
package Subterfuge {
public class MissionDatabase {
public var missions:Array;
public static var PTR:MissionDatabase;
public function MissionDatabase(){
var _local1:MissionArchetype;
super();
missions = new Array();
_local1 = new MissionArchetype();
_local1.name_text = "Mission 1: Stolen Property";
_local1.description_text = "A bunch of small-time thugs led by Johnny \"Snake\" Marconi has been fencing stolen goods along the riverfront. Unfortunately, they also smashed your window and grabbed your 52-inch HoloTV last night. They talk tough, but you have a superior crew. Get down there and bust some heads!";
_local1.fill_count = 16;
_local1.player_starting_units = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.player_starting_units[UnitDatabase.UA_LEADER] = 1;
_local1.player_starting_units[UnitDatabase.UA_SCOUT] = 3;
_local1.player_starting_units[UnitDatabase.UA_ASSASSIN] = 2;
_local1.player_starting_units[UnitDatabase.UA_MERCENARY] = 6;
_local1.player_starting_units[UnitDatabase.UA_ENFORCER] = 2;
_local1.player_starting_units[UnitDatabase.UA_BOMBER] = 2;
_local1.AI_starting_units = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.AI_starting_units[UnitDatabase.UA_LEADER] = 1;
_local1.AI_starting_units[UnitDatabase.UA_SCOUT] = 2;
_local1.AI_starting_units[UnitDatabase.UA_ASSASSIN] = 1;
_local1.AI_starting_units[UnitDatabase.UA_MERCENARY] = 4;
_local1.AI_starting_units[UnitDatabase.UA_ENFORCER] = 0;
_local1.AI_starting_units[UnitDatabase.UA_BOMBER] = 0;
missions.push(_local1);
_local1 = new MissionArchetype();
_local1.name_text = "Mission 2: The Overlords";
_local1.description_text = "The Overlord gang has been harassing business owners on the West Side for ages. Protection money, petty theft, that kinda thing. There will be lots of them -- but they are inexperienced and will make mistakes. Shouldn't be a problem for a trained assassin like yourself...";
_local1.fill_count = 12;
_local1.player_starting_units = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.player_starting_units[UnitDatabase.UA_LEADER] = 1;
_local1.player_starting_units[UnitDatabase.UA_SCOUT] = 3;
_local1.player_starting_units[UnitDatabase.UA_ASSASSIN] = 2;
_local1.player_starting_units[UnitDatabase.UA_MERCENARY] = 6;
_local1.player_starting_units[UnitDatabase.UA_ENFORCER] = 2;
_local1.player_starting_units[UnitDatabase.UA_BOMBER] = 2;
_local1.AI_starting_units = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.AI_starting_units[UnitDatabase.UA_LEADER] = 1;
_local1.AI_starting_units[UnitDatabase.UA_SCOUT] = 3;
_local1.AI_starting_units[UnitDatabase.UA_ASSASSIN] = 1;
_local1.AI_starting_units[UnitDatabase.UA_MERCENARY] = 5;
_local1.AI_starting_units[UnitDatabase.UA_ENFORCER] = 1;
_local1.AI_starting_units[UnitDatabase.UA_BOMBER] = 0;
missions.push(_local1);
_local1 = new MissionArchetype();
_local1.name_text = "Mission 3: Antor Kova";
_local1.description_text = "Antor Kova and his Russian crime syndicate have been dealing Temazepam to the kids in Riviera Park, including your kid brother. Deal them a beatdown in return. You'll have to confront them out in the open, so there won't be a lot of places to hide.";
_local1.fill_count = 6;
_local1.player_starting_units = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.player_starting_units[UnitDatabase.UA_LEADER] = 1;
_local1.player_starting_units[UnitDatabase.UA_SCOUT] = 3;
_local1.player_starting_units[UnitDatabase.UA_ASSASSIN] = 2;
_local1.player_starting_units[UnitDatabase.UA_MERCENARY] = 6;
_local1.player_starting_units[UnitDatabase.UA_ENFORCER] = 2;
_local1.player_starting_units[UnitDatabase.UA_BOMBER] = 2;
_local1.AI_starting_units = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.AI_starting_units[UnitDatabase.UA_LEADER] = 1;
_local1.AI_starting_units[UnitDatabase.UA_SCOUT] = 3;
_local1.AI_starting_units[UnitDatabase.UA_ASSASSIN] = 1;
_local1.AI_starting_units[UnitDatabase.UA_MERCENARY] = 6;
_local1.AI_starting_units[UnitDatabase.UA_ENFORCER] = 2;
_local1.AI_starting_units[UnitDatabase.UA_BOMBER] = 1;
missions.push(_local1);
_local1 = new MissionArchetype();
_local1.name_text = "Mission 4: A Just Dessert";
_local1.description_text = "Your crew has just gotten together for dinner at Oresto, and the lobster was fantastic. As you're leaving, you hear a rustling in the alley. You look around, and the streets suddenly are deserted. It must be your rivals from the Katsu gang. Defend yourself! Use the dense terrain to your advantage.";
_local1.fill_count = 28;
_local1.player_starting_units = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.player_starting_units[UnitDatabase.UA_LEADER] = 1;
_local1.player_starting_units[UnitDatabase.UA_SCOUT] = 3;
_local1.player_starting_units[UnitDatabase.UA_ASSASSIN] = 2;
_local1.player_starting_units[UnitDatabase.UA_MERCENARY] = 6;
_local1.player_starting_units[UnitDatabase.UA_ENFORCER] = 2;
_local1.player_starting_units[UnitDatabase.UA_BOMBER] = 2;
_local1.AI_starting_units = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.AI_starting_units[UnitDatabase.UA_LEADER] = 1;
_local1.AI_starting_units[UnitDatabase.UA_SCOUT] = 3;
_local1.AI_starting_units[UnitDatabase.UA_ASSASSIN] = 1;
_local1.AI_starting_units[UnitDatabase.UA_MERCENARY] = 6;
_local1.AI_starting_units[UnitDatabase.UA_ENFORCER] = 2;
_local1.AI_starting_units[UnitDatabase.UA_BOMBER] = 2;
missions.push(_local1);
_local1 = new MissionArchetype();
_local1.name_text = "Mission 5: Neko Blade";
_local1.description_text = "Neko Blade and her team of assassins have been killing your informants up in Northern Village. You tried to bribe one of her bodyguards to take care of the situation, but the plan was discovered. Now, you're forced to make your move. Watch our for her assassins: don't let them get on the offensive.";
_local1.fill_count = 14;
_local1.player_starting_units = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.player_starting_units[UnitDatabase.UA_LEADER] = 1;
_local1.player_starting_units[UnitDatabase.UA_SCOUT] = 3;
_local1.player_starting_units[UnitDatabase.UA_ASSASSIN] = 2;
_local1.player_starting_units[UnitDatabase.UA_MERCENARY] = 6;
_local1.player_starting_units[UnitDatabase.UA_ENFORCER] = 2;
_local1.player_starting_units[UnitDatabase.UA_BOMBER] = 2;
_local1.AI_starting_units = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.AI_starting_units[UnitDatabase.UA_LEADER] = 1;
_local1.AI_starting_units[UnitDatabase.UA_SCOUT] = 2;
_local1.AI_starting_units[UnitDatabase.UA_ASSASSIN] = 4;
_local1.AI_starting_units[UnitDatabase.UA_MERCENARY] = 4;
_local1.AI_starting_units[UnitDatabase.UA_ENFORCER] = 1;
_local1.AI_starting_units[UnitDatabase.UA_BOMBER] = 2;
missions.push(_local1);
_local1 = new MissionArchetype();
_local1.name_text = "Mission 6: Double Vision";
_local1.description_text = "The infamous Futago brothers have infiltrated city's autobanks and have been sending the money offshore. Some of this money was yours. This makes you angry. Don't underestimate them, as they are both dangerous and crafty. You must take out both leaders.";
_local1.fill_count = 16;
_local1.player_starting_units = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.player_starting_units[UnitDatabase.UA_LEADER] = 1;
_local1.player_starting_units[UnitDatabase.UA_SCOUT] = 3;
_local1.player_starting_units[UnitDatabase.UA_ASSASSIN] = 2;
_local1.player_starting_units[UnitDatabase.UA_MERCENARY] = 6;
_local1.player_starting_units[UnitDatabase.UA_ENFORCER] = 2;
_local1.player_starting_units[UnitDatabase.UA_BOMBER] = 2;
_local1.AI_starting_units = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.AI_starting_units[UnitDatabase.UA_LEADER] = 2;
_local1.AI_starting_units[UnitDatabase.UA_SCOUT] = 2;
_local1.AI_starting_units[UnitDatabase.UA_ASSASSIN] = 2;
_local1.AI_starting_units[UnitDatabase.UA_MERCENARY] = 6;
_local1.AI_starting_units[UnitDatabase.UA_ENFORCER] = 2;
_local1.AI_starting_units[UnitDatabase.UA_BOMBER] = 2;
missions.push(_local1);
_local1 = new MissionArchetype();
_local1.name_text = "Mission 7: Chain Reaction";
_local1.description_text = "We have discovered that a woman named Elena Fermi has been building bombs in her warehouse near the Kurata docks. Rumor is that she's going to try to take out the Mayor when he presides over the Chinese New Year parade. Be careful, her hideout is likely booby-trapped with bombs.";
_local1.fill_count = 12;
_local1.player_starting_units = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.player_starting_units[UnitDatabase.UA_LEADER] = 1;
_local1.player_starting_units[UnitDatabase.UA_SCOUT] = 3;
_local1.player_starting_units[UnitDatabase.UA_ASSASSIN] = 2;
_local1.player_starting_units[UnitDatabase.UA_MERCENARY] = 6;
_local1.player_starting_units[UnitDatabase.UA_ENFORCER] = 2;
_local1.player_starting_units[UnitDatabase.UA_BOMBER] = 2;
_local1.AI_starting_units = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.AI_starting_units[UnitDatabase.UA_LEADER] = 1;
_local1.AI_starting_units[UnitDatabase.UA_SCOUT] = 1;
_local1.AI_starting_units[UnitDatabase.UA_ASSASSIN] = 2;
_local1.AI_starting_units[UnitDatabase.UA_MERCENARY] = 4;
_local1.AI_starting_units[UnitDatabase.UA_ENFORCER] = 2;
_local1.AI_starting_units[UnitDatabase.UA_BOMBER] = 4;
missions.push(_local1);
_local1 = new MissionArchetype();
_local1.name_text = "Final mission: Checkmate";
_local1.description_text = "The brilliant Francois Philidor and his criminal gang have placed informants inside the City Police. This network must be eliminated to clear the way for a major sting operation. They are gathering for a meeting inside of Lucena Industries, and we are ready to strike. Philidor will be an extremely smart and observant opponent -- be careful how you reveal your forces.";
_local1.fill_count = 16;
_local1.player_starting_units = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.player_starting_units[UnitDatabase.UA_LEADER] = 1;
_local1.player_starting_units[UnitDatabase.UA_SCOUT] = 3;
_local1.player_starting_units[UnitDatabase.UA_ASSASSIN] = 3;
_local1.player_starting_units[UnitDatabase.UA_MERCENARY] = 5;
_local1.player_starting_units[UnitDatabase.UA_ENFORCER] = 2;
_local1.player_starting_units[UnitDatabase.UA_BOMBER] = 2;
_local1.AI_starting_units = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.AI_starting_units[UnitDatabase.UA_LEADER] = 1;
_local1.AI_starting_units[UnitDatabase.UA_SCOUT] = 3;
_local1.AI_starting_units[UnitDatabase.UA_ASSASSIN] = 3;
_local1.AI_starting_units[UnitDatabase.UA_MERCENARY] = 4;
_local1.AI_starting_units[UnitDatabase.UA_ENFORCER] = 3;
_local1.AI_starting_units[UnitDatabase.UA_BOMBER] = 2;
missions.push(_local1);
_local1 = new MissionArchetype();
_local1.name_text = "Challenge #1";
_local1.description_text = "";
_local1.fill_count = 0;
_local1.player_starting_units = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.player_starting_units[UnitDatabase.UA_LEADER] = 1;
_local1.player_starting_units[UnitDatabase.UA_SCOUT] = 6;
_local1.player_starting_units[UnitDatabase.UA_ASSASSIN] = 4;
_local1.player_starting_units[UnitDatabase.UA_MERCENARY] = 12;
_local1.player_starting_units[UnitDatabase.UA_ENFORCER] = 4;
_local1.player_starting_units[UnitDatabase.UA_BOMBER] = 4;
_local1.AI_starting_units = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.AI_starting_units[UnitDatabase.UA_LEADER] = 1;
_local1.AI_starting_units[UnitDatabase.UA_SCOUT] = 6;
_local1.AI_starting_units[UnitDatabase.UA_ASSASSIN] = 4;
_local1.AI_starting_units[UnitDatabase.UA_MERCENARY] = 12;
_local1.AI_starting_units[UnitDatabase.UA_ENFORCER] = 4;
_local1.AI_starting_units[UnitDatabase.UA_BOMBER] = 4;
missions.push(_local1);
_local1 = new MissionArchetype();
_local1.name_text = "Challenge #2";
_local1.description_text = "";
_local1.fill_count = 40;
_local1.player_starting_units = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.player_starting_units[UnitDatabase.UA_LEADER] = 1;
_local1.player_starting_units[UnitDatabase.UA_SCOUT] = 3;
_local1.player_starting_units[UnitDatabase.UA_ASSASSIN] = 2;
_local1.player_starting_units[UnitDatabase.UA_MERCENARY] = 6;
_local1.player_starting_units[UnitDatabase.UA_ENFORCER] = 2;
_local1.player_starting_units[UnitDatabase.UA_BOMBER] = 2;
_local1.AI_starting_units = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.AI_starting_units[UnitDatabase.UA_LEADER] = 1;
_local1.AI_starting_units[UnitDatabase.UA_SCOUT] = 2;
_local1.AI_starting_units[UnitDatabase.UA_ASSASSIN] = 4;
_local1.AI_starting_units[UnitDatabase.UA_MERCENARY] = 4;
_local1.AI_starting_units[UnitDatabase.UA_ENFORCER] = 1;
_local1.AI_starting_units[UnitDatabase.UA_BOMBER] = 2;
missions.push(_local1);
_local1 = new MissionArchetype();
_local1.name_text = "Challenge #3";
_local1.description_text = "";
_local1.fill_count = 16;
_local1.player_starting_units = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.player_starting_units[UnitDatabase.UA_LEADER] = 1;
_local1.player_starting_units[UnitDatabase.UA_SCOUT] = 1;
_local1.player_starting_units[UnitDatabase.UA_ASSASSIN] = 1;
_local1.player_starting_units[UnitDatabase.UA_MERCENARY] = 1;
_local1.player_starting_units[UnitDatabase.UA_ENFORCER] = 1;
_local1.player_starting_units[UnitDatabase.UA_BOMBER] = 1;
_local1.AI_starting_units = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.AI_starting_units[UnitDatabase.UA_LEADER] = 1;
_local1.AI_starting_units[UnitDatabase.UA_SCOUT] = 1;
_local1.AI_starting_units[UnitDatabase.UA_ASSASSIN] = 1;
_local1.AI_starting_units[UnitDatabase.UA_MERCENARY] = 1;
_local1.AI_starting_units[UnitDatabase.UA_ENFORCER] = 1;
_local1.AI_starting_units[UnitDatabase.UA_BOMBER] = 1;
missions.push(_local1);
_local1 = new MissionArchetype();
_local1.name_text = "AI challenge";
_local1.description_text = "";
_local1.fill_count = 16;
_local1.player_starting_units = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.player_starting_units[UnitDatabase.UA_LEADER] = 1;
_local1.player_starting_units[UnitDatabase.UA_SCOUT] = 1;
_local1.player_starting_units[UnitDatabase.UA_ASSASSIN] = 2;
_local1.player_starting_units[UnitDatabase.UA_MERCENARY] = 2;
_local1.player_starting_units[UnitDatabase.UA_ENFORCER] = 1;
_local1.player_starting_units[UnitDatabase.UA_BOMBER] = 1;
_local1.AI_starting_units = new Array(UnitDatabase.UA_MAX_TYPES);
_local1.AI_starting_units[UnitDatabase.UA_LEADER] = 1;
_local1.AI_starting_units[UnitDatabase.UA_SCOUT] = 3;
_local1.AI_starting_units[UnitDatabase.UA_ASSASSIN] = 2;
_local1.AI_starting_units[UnitDatabase.UA_MERCENARY] = 6;
_local1.AI_starting_units[UnitDatabase.UA_ENFORCER] = 2;
_local1.AI_starting_units[UnitDatabase.UA_BOMBER] = 2;
missions.push(_local1);
}
}
}//package Subterfuge
Section 80
//MissionInfoScreen (Subterfuge.MissionInfoScreen)
package Subterfuge {
import flash.display.*;
public class MissionInfoScreen extends IScreen {
var
:MovieClip;
var
:int;
var
:MissionArchetype;
var
:MovieClip;
var bkg_clip:MovieClip;
override public function update(_arg1:Number):void{
if (
> 0){
--;
} else {
.mission_name.text =
.name_text;
.mission_text.text =
.description_text;
};
}
override public function enter_screen():void{
var _local1:int;
SoundManager.PTR.sfx_event(SoundManager.SM_MISSION_INTRO);
= 32;
bkg_clip = new MissionUIBackground();
bkg_clip.x = 0;
bkg_clip.y = 0;
Application.get_singleton().layer_menu.addChild(bkg_clip);
= new MissionUITop();
.x = 0;
.y = 0;
Application.get_singleton().layer_menu.addChild(
);
= new MissionUIBottom();
bkg_clip.x = 0;
bkg_clip.y = 0;
Application.get_singleton().layer_menu.addChild(
);
clip_switch_active = true;
clip_switch_array = new Array();
clip_switch_target = new Array();
clip_switch_array.push(
.ok_btn);
clip_switch_target.push(IScreen.IS_PLAYING_GAME);
clip_switch_active = true;
Application.get_singleton().challenge_mode = false;
_local1 = Application.get_singleton().current_mission;
set_mission(_local1);
.bottom_frame.enemy_icon.gotoAndStop(_local1);
bkg_clip.gotoAndPlay((((_local1 - 1) * 120) + 1));
}
override public function get_id():int{
return (IScreen.IS_MISSION_INFO);
}
override public function exit_screen():void{
Application.get_singleton().layer_menu.removeChild(bkg_clip);
bkg_clip = null;
Application.get_singleton().layer_menu.removeChild(
);
= null;
Application.get_singleton().layer_menu.removeChild(
);
= null;
}
public function set_mission(_arg1:int){
= MissionDatabase.PTR.missions[(_arg1 - 1)];
}
}
}//package Subterfuge
Section 81
//PieceSetupWindow (Subterfuge.PieceSetupWindow)
package Subterfuge {
import flash.events.*;
public class PieceSetupWindow extends IWindowComponent {
public function PieceSetupWindow(){
name_id = "piece_setup_window";
= "WindowPieceSetup";
z_level = 2;
}
override public function initialize_buttons():void{
var _local1:IWindowButton;
button_list = new Array();
_local1 = new IWindowButton();
_local1.button_id = "ok_button";
_local1.button_clip = clip.ok_button;
button_list.push(_local1);
}
override public function button_click(_arg1:IWindowButton):void{
close_pending = true;
}
override public function mouse_down(_arg1:MouseEvent):void{
}
}
}//package Subterfuge
Section 82
//SelectChallengeScreen (Subterfuge.SelectChallengeScreen)
package Subterfuge {
import flash.display.*;
import flash.filters.*;
public class SelectChallengeScreen extends IScreen {
var menu_clip:MovieClip;
var highlight_target:int;
override public function update(_arg1:Number):void{
var _local2:int;
var _local3:GlowFilter;
_local2 = get_clip_at_location(Application.get_singleton().stage.mouseX, Application.get_singleton().stage.mouseY);
if (_local2 != highlight_target){
if (highlight_target != -1){
clip_switch_array[highlight_target].filters = null;
};
highlight_target = _local2;
if (highlight_target != -1){
if (clip_switch_array[highlight_target] == menu_clip.btn_challenge1){
Application.get_singleton().challenge_mission = 9;
};
if (clip_switch_array[highlight_target] == menu_clip.btn_challenge2){
Application.get_singleton().challenge_mission = 10;
};
if (clip_switch_array[highlight_target] == menu_clip.btn_challenge3){
Application.get_singleton().challenge_mission = 11;
};
if (clip_switch_array[highlight_target] == menu_clip.btn_challenge4){
Application.get_singleton().challenge_mission = 12;
};
_local3 = new GlowFilter();
_local3.alpha = 0.5;
_local3.quality = BitmapFilterQuality.HIGH;
_local3.strength = 2;
_local3.blurX = 6;
_local3.blurY = 6;
_local3.color = 0xFFFFFF;
clip_switch_array[highlight_target].filters = new Array(_local3);
};
};
}
override public function enter_screen():void{
menu_clip = new WindowChallenge();
menu_clip.x = 0;
menu_clip.y = 0;
Application.get_singleton().layer_menu.addChild(menu_clip);
clip_switch_active = true;
clip_switch_array = new Array();
clip_switch_target = new Array();
clip_switch_array.push(menu_clip.btn_challenge1);
clip_switch_target.push(IScreen.IS_PLAYING_GAME);
clip_switch_array.push(menu_clip.btn_challenge2);
clip_switch_target.push(IScreen.IS_PLAYING_GAME);
clip_switch_array.push(menu_clip.btn_challenge3);
clip_switch_target.push(IScreen.IS_PLAYING_GAME);
clip_switch_array.push(menu_clip.btn_challenge4);
clip_switch_target.push(IScreen.IS_PLAYING_GAME);
clip_switch_array.push(menu_clip.btn_return_to_menu);
clip_switch_target.push(IScreen.IS_MAIN_MENU);
clip_switch_active = true;
highlight_target = -1;
Application.get_singleton().challenge_mode = true;
}
override public function get_id():int{
return (IScreen.IS_SELECT_CHALLENGE);
}
override public function exit_screen():void{
Application.get_singleton().layer_menu.removeChild(menu_clip);
menu_clip = null;
}
}
}//package Subterfuge
Section 83
//StartMatchWindow (Subterfuge.StartMatchWindow)
package Subterfuge {
import flash.events.*;
public class StartMatchWindow extends IWindowComponent {
public function StartMatchWindow(){
name_id = "start_match";
= "WindowStartMatch";
z_level = 1;
}
override public function initialize_buttons():void{
var _local1:IWindowButton;
button_list = new Array();
_local1 = new IWindowButton();
_local1.button_id = "ok_button";
_local1.button_clip = clip.ok_button;
button_list.push(_local1);
}
override public function button_click(_arg1:IWindowButton):void{
close_pending = true;
}
override public function mouse_down(_arg1:MouseEvent):void{
}
}
}//package Subterfuge
Section 84
//UISidebar (Subterfuge.UISidebar)
package Subterfuge {
import flash.display.*;
public class UISidebar implements IGameSystem {
public var :MovieClip;
public static var PTR:UISidebar;
public function display_unit_info(_arg1:Unit):void{
.unit_type.text = _arg1.archetype.name_id;
.unit_power.text = _arg1.archetype.display_power_level.toString();
.unit_text_1.text = _arg1.archetype.display_text_1;
.unit_text_2.text = _arg1.archetype.display_text_2;
.unit_movement.text = ("Movement: " + _arg1.archetype.movement_rate.toString());
.player_unit_icon.gotoAndStop((_arg1.archetype.type_id + 1));
}
public function set_mission(_arg1:int):void{
if (Application.get_singleton().challenge_mode == true){
.mission_id.text = "Challenge!";
} else {
.mission_id.text = ("Mission " + _arg1.toString());
};
.enemy_icon.gotoAndStop(_arg1);
}
public function initialize():void{
= new UIMockup();
Application.PTR.layer_interface.addChild();
.enemy_icon.gotoAndStop(25);
.player_unit_icon.gotoAndStop(7);
}
public function destroy():void{
Application.PTR.layer_interface.removeChild();
= null;
}
public function update(_arg1:Number):void{
}
}
}//package Subterfuge
Section 85
//Unit (Subterfuge.Unit)
package Subterfuge {
import flash.display.*;
public class Unit {
public var type_identified:int;
var background_clip:MovieClip;
var archetype:UnitArchetype;
public var type_possibilities:Array;
public var visual_state:int;
var pool:UnitPool;
var cell:Cell;
var controller:MatchPlayer;
var id_clip:MovieClip;
static const US_AI_HIDDEN:int = 1;
static const UE_VALID_ATTACK:int = 2;
static const UE_FRIENDLY_OCCUPIED:int = 3;
static const US_PLAYER:int = 0;
static const UE_SUCCESS:int = 0;
static const US_AI_REVEALED:int = 2;
static const UE_CANT_ATTACK:int = 5;
static const UE_INVALID_SQUARE:int = 1;
static const UE_TOO_FAR:int = 4;
public function Unit(){
var _local1:int;
super();
archetype = null;
controller = null;
pool = null;
type_possibilities = new Array(UnitDatabase.UA_MAX_TYPES);
_local1 = 0;
while (_local1 < UnitDatabase.UA_MAX_TYPES) {
type_possibilities[_local1] = true;
_local1++;
};
type_identified = -1;
}
public function test_move(_arg1:MatchPlayer, _arg2:Unit, _arg3:int, _arg4:int, _arg5:Boolean=false):int{
var _local6:Cell;
if ((((cell.array_x == _arg3)) && ((cell.array_y == _arg4)))){
return (UE_FRIENDLY_OCCUPIED);
};
_local6 = GameBoard.PTR.get_cell(_arg3, _arg4);
if (_local6 == null){
return (UE_INVALID_SQUARE);
};
if (_local6.passable == false){
return (UE_INVALID_SQUARE);
};
if (_arg5 == false){
if (Math.abs((cell.array_x - _arg3)) > archetype.movement_rate){
return (UE_TOO_FAR);
};
if (Math.abs((cell.array_y - _arg4)) > archetype.movement_rate){
return (UE_TOO_FAR);
};
};
if (_local6.unit != null){
if (_local6.unit.controller == _arg1){
return (UE_FRIENDLY_OCCUPIED);
};
if (_arg2.archetype.can_attack == false){
return (UE_CANT_ATTACK);
};
return (UE_VALID_ATTACK);
};
return (UE_SUCCESS);
}
public function set_cell(_arg1:Cell){
cell = _arg1;
set_pixel_position(_arg1.pos_x, _arg1.pos_y);
}
public function set_visual_state(_arg1:int):void{
if (_arg1 == US_PLAYER){
id_clip.gotoAndStop(archetype.get_visible_frame());
background_clip.gotoAndStop((5 + archetype.type_id));
} else {
if (_arg1 == US_AI_HIDDEN){
id_clip.gotoAndStop(0);
background_clip.gotoAndStop("AI_hidden");
} else {
if (_arg1 == US_AI_REVEALED){
id_clip.gotoAndStop(archetype.get_visible_frame());
background_clip.gotoAndStop("AI_revealed");
};
};
};
visual_state = _arg1;
}
public function move_unit(_arg1:Cell):void{
cell.unit = null;
_arg1.unit = this;
set_cell(_arg1);
}
public function set_pixel_position(_arg1:int, _arg2:int){
background_clip.x = _arg1;
background_clip.y = _arg2;
}
}
}//package Subterfuge
Section 86
//UnitArchetype (Subterfuge.UnitArchetype)
package Subterfuge {
public class UnitArchetype {
var type_id:int;
var display_text_1:String;
var forces_reveal:Boolean;
var is_leader:Boolean;
var display_power_level:int;
var movement_rate:int;
var name_id:String;
var can_attack:Boolean;
var display_text_2:String;
public function UnitArchetype(){
type_id = -1;
is_leader = false;
can_attack = true;
forces_reveal = false;
movement_rate = 2;
display_text_1 = "text1";
display_text_2 = "text2";
}
public function get_visible_frame():int{
return (0);
}
}
}//package Subterfuge
Section 87
//UnitAssassin (Subterfuge.UnitAssassin)
package Subterfuge {
public class UnitAssassin extends UnitArchetype {
public function UnitAssassin(){
name_id = "Assassin";
display_power_level = 2;
display_text_1 = "Defeats all units, if attacking.";
display_text_2 = "Loses to bombs, and weak on defense.";
}
override public function get_visible_frame():int{
return (15);
}
}
}//package Subterfuge
Section 88
//UnitBomber (Subterfuge.UnitBomber)
package Subterfuge {
public class UnitBomber extends UnitArchetype {
public function UnitBomber(){
name_id = "Bomb";
display_power_level = 9;
is_leader = false;
can_attack = false;
display_text_1 = "Destroys any attacking unit.";
display_text_2 = "Can not attack.";
}
override public function get_visible_frame():int{
return (30);
}
}
}//package Subterfuge
Section 89
//UnitDatabase (Subterfuge.UnitDatabase)
package Subterfuge {
public class UnitDatabase implements IGameSystem {
var :Array;
static var UA_MERCENARY:int = 3;
static var UA_BOMBER:int = 5;
static var UA_ENFORCER:int = 4;
static var UA_SCOUT:int = 1;
static var PTR:UnitDatabase;
static var UA_MAX_TYPES:int = 6;
static var UA_LEADER:int = 0;
static var UA_ASSASSIN:int = 2;
public function destroy_unit(_arg1:Unit):void{
_arg1.cell.unit = null;
_arg1.background_clip.removeChild(_arg1.id_clip);
Application.PTR.layer_objects.removeChild(_arg1.background_clip);
_arg1.id_clip = null;
_arg1.background_clip = null;
}
public function update(_arg1:Number):void{
}
public function create_unit(_arg1:int):Unit{
var _local2:Unit;
_local2 = new Unit();
_local2.archetype = [_arg1];
_local2.background_clip = new IconPieceBackground();
Application.PTR.layer_objects.addChild(_local2.background_clip);
_local2.id_clip = new IconPiece();
_local2.background_clip.addChild(_local2.id_clip);
_local2.background_clip.stop();
_local2.id_clip.stop();
return (_local2);
}
public function initialize():void{
var _local1:UnitArchetype;
= new Array();
_local1 = new UnitLeader();
_local1.type_id = UA_LEADER;
[_local1.type_id] = _local1;
_local1 = new UnitScout();
_local1.type_id = UA_SCOUT;
[_local1.type_id] = _local1;
_local1 = new UnitAssassin();
_local1.type_id = UA_ASSASSIN;
[_local1.type_id] = _local1;
_local1 = new UnitMercenary();
_local1.type_id = UA_MERCENARY;
[_local1.type_id] = _local1;
_local1 = new UnitEnforcer();
_local1.type_id = UA_ENFORCER;
[_local1.type_id] = _local1;
_local1 = new UnitBomber();
_local1.type_id = UA_BOMBER;
[_local1.type_id] = _local1;
}
public function destroy():void{
}
public function
(_arg1:int):String{
if (_arg1 == 0){
return ("Leader");
};
if (_arg1 == 1){
return ("Scout");
};
if (_arg1 == 2){
return ("Assassin");
};
if (_arg1 == 3){
return ("Mercenary");
};
if (_arg1 == 4){
return ("Enforcer");
};
if (_arg1 == 5){
return ("Bomber");
};
return ("Unknown?");
}
}
}//package Subterfuge
Section 90
//UnitEnforcer (Subterfuge.UnitEnforcer)
package Subterfuge {
public class UnitEnforcer extends UnitArchetype {
public function UnitEnforcer(){
name_id = "Enforcer";
display_power_level = 7;
display_text_1 = "Very strong attacking unit.";
display_text_2 = "";
}
override public function get_visible_frame():int{
return (25);
}
}
}//package Subterfuge
Section 91
//UnitLeader (Subterfuge.UnitLeader)
package Subterfuge {
public class UnitLeader extends UnitArchetype {
public function UnitLeader(){
name_id = "Leader";
display_power_level = 1;
is_leader = true;
display_text_1 = "The leader of your army.";
display_text_2 = "* Can secretly swap places with any nearby unit, once per turn.";
}
override public function get_visible_frame():int{
return (5);
}
}
}//package Subterfuge
Section 92
//UnitMercenary (Subterfuge.UnitMercenary)
package Subterfuge {
public class UnitMercenary extends UnitArchetype {
public function UnitMercenary(){
name_id = "Mercenary";
display_power_level = 5;
display_text_1 = "Medium strength combat unit.";
display_text_2 = "";
}
override public function get_visible_frame():int{
return (20);
}
}
}//package Subterfuge
Section 93
//UnitPool (Subterfuge.UnitPool)
package Subterfuge {
public class UnitPool {
var unit_list:Array;
public function initialize(){
unit_list = new Array();
}
public function swap_units(_arg1:Unit, _arg2:Unit){
var _local3:Cell;
var _local4:Cell;
_local3 = _arg1.cell;
_local4 = _arg2.cell;
_arg1.set_cell(_local4);
_arg2.set_cell(_local3);
_local3.unit = _arg2;
_local4.unit = _arg1;
}
public function destroy_unit(_arg1:Unit):void{
var _local2:Boolean;
var _local3:int;
if (unit_list.length == 1){
UnitDatabase.PTR.destroy_unit(unit_list[0]);
unit_list[0] = null;
unit_list.length = 0;
} else {
_local2 = false;
_local3 = 0;
while (_local3 < unit_list.length) {
if (unit_list[_local3] == _arg1){
UnitDatabase.PTR.destroy_unit(unit_list[_local3]);
unit_list[_local3] = unit_list[(unit_list.length - 1)];
_local2 = true;
break;
};
_local3++;
};
if (_local2){
unit_list.pop();
//unresolved jump
};
};
}
public function destroy(){
var _local1:int;
_local1 = 0;
while (_local1 < unit_list.length) {
if (unit_list[_local1] != null){
UnitDatabase.PTR.destroy_unit(unit_list[_local1]);
};
_local1++;
};
unit_list = null;
}
public function create_unit(_arg1:int):Unit{
var _local2:Unit;
_local2 = UnitDatabase.PTR.create_unit(_arg1);
unit_list.push(_local2);
_local2.pool = this;
return (_local2);
}
}
}//package Subterfuge
Section 94
//UnitScout (Subterfuge.UnitScout)
package Subterfuge {
public class UnitScout extends UnitArchetype {
public function UnitScout(){
name_id = "Scout";
display_power_level = 3;
movement_rate = 3;
forces_reveal = true;
display_text_1 = "Defeats leaders, scouts and bombers.";
display_text_2 = "Reveals any unit it fights.\nCan move 3 squares per turn.";
}
override public function get_visible_frame():int{
return (10);
}
}
}//package Subterfuge
Section 95
//WinChallengeWindow (Subterfuge.WinChallengeWindow)
package Subterfuge {
public class WinChallengeWindow extends WinMissionWindow {
public function WinChallengeWindow(){
name_id = "win_challenge";
= "WindowWinChallenge";
z_level = 2;
}
}
}//package Subterfuge
Section 96
//WindowManager (Subterfuge.WindowManager)
package Subterfuge {
import flash.events.*;
public class WindowManager {
var :Array;
public function initialize(){
= new Array();
}
public function clear_windows():void{
var _local1:int;
_local1 = 0;
while (_local1 < .length) {
if ([_local1]){
[_local1].hide();
[_local1] = null;
};
_local1++;
};
= null;
= new Array();
}
public function destroy(){
= null;
}
public function register_window(_arg1:IWindowComponent):void{
.push(_arg1);
}
public function mouse_down_handler(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
_local2 = -1;
_local3 = 0;
while (_local3 < .length) {
if ([_local3].active){
if ([_local3].z_level > _local2){
_local2 = [_local3].z_level;
};
};
_local3++;
};
_local3 = 0;
while (_local3 < .length) {
if ([_local3].active){
if ([_local3].z_level == _local2){
[_local3].mouse_down(_arg1);
[_local3].check_buttons(_arg1);
if ([_local3].close_pending == true){
[_local3].hide();
};
};
};
_local3++;
};
}
}
}//package Subterfuge
Section 97
//WinMissionWindow (Subterfuge.WinMissionWindow)
package Subterfuge {
import flash.events.*;
public class WinMissionWindow extends IWindowComponent {
public function WinMissionWindow(){
name_id = "win_mission";
= "WindowWinMission";
z_level = 2;
}
override public function initialize_buttons():void{
var _local1:IWindowButton;
button_list = new Array();
_local1 = new IWindowButton();
_local1.button_id = "ok_button";
_local1.button_clip = clip.ok_button;
button_list.push(_local1);
clip.mission_time.text = GameStatistics.PTR.get_mission_complete_time();
clip.units_lost.text = GameStatistics.PTR.mission_units_lost.toString();
}
override public function button_click(_arg1:IWindowButton):void{
close_pending = true;
}
override public function mouse_down(_arg1:MouseEvent):void{
}
}
}//package Subterfuge
Section 98
//MissionUIBottomFrame_8 (subterfuge_fla.MissionUIBottomFrame_8)
package subterfuge_fla {
import flash.display.*;
public dynamic class MissionUIBottomFrame_8 extends MovieClip {
public var enemy_icon:MovieClip;
}
}//package subterfuge_fla
Section 99
//Application (Application)
package {
import flash.display.*;
import Subterfuge.*;
import flash.events.*;
import flash.net.*;
public class Application extends MovieClip {
var
:Boolean;
public var
:Sprite;
var :int;
public var :Sprite;
var :ScreenWipe;
public var layer_objects:Sprite;
public var layer_mouse:Sprite;
public var window_manager:WindowManager;
public var layer_grid:Sprite;
public var :Array;
public var :ApplicationKeystate;
public var :Boolean;
public var
:MovieClip;
public var :Boolean;
public var :int;
public var :Sprite;
public var challenge_mission:int;
public var layer_menu:Sprite;
var :int;
public var :IScreen;
public var layer_objects2:Sprite;
public var current_mission:int;
public var layer_interface:Sprite;
public var :Number;
public var :SoundManager;
public var :IScreen;
public var challenge_mode:Boolean;
public static var PTR:Application;
public function Application(){
= false;
stop();
addEventListener(Event.ADDED_TO_STAGE, );
= -1;
challenge_mode = false;
}
public function mouse_down_handler(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
MouseManager.PTR.mouse_down_handler(_arg1);
window_manager.mouse_down_handler(_arg1);
if (){
.mouse_down_handler(_arg1);
};
if (.clip_switch_active == true){
if (.clip_switch_array){
_local2 = .get_clip_at_location(stage.mouseX, stage.mouseY);
if (_local2 != -1){
_local3 = .clip_switch_target[_local2];
if (_local3 == IScreen.IS_PLAY_MORE_GAMES){
navigateToURL(new URLRequest("http://www.armorgames.com"), "_blank");
return;
};
if (_local3 == IScreen.IS_GAMING_NEWS){
navigateToURL(new URLRequest("http://www.armorblog.com"), "_blank");
return;
};
(_local3);
return;
};
};
};
if (.click_transition != -1){
(.click_transition);
};
}
public function keyup_listener(_arg1:KeyboardEvent):void{
.keyup_listener(_arg1);
}
public function (_arg1:MouseEvent){
stage.removeEventListener(MouseEvent.MOUSE_MOVE, );
if (){
.mouse_enter_window();
};
MouseManager.PTR.show_mouse();
}
public function initialize(){
current_mission = 1;
PTR = this;
= false;
= null;
addEventListener(Event.ENTER_FRAME, update);
stage.scaleMode = StageScaleMode.NO_SCALE;
= new Sprite();
addChild();
layer_grid = new Sprite();
addChild(layer_grid);
layer_objects = new Sprite();
addChild(layer_objects);
layer_objects2 = new Sprite();
addChild(layer_objects2);
= new Sprite();
addChild(
);
layer_interface = new Sprite();
addChild(layer_interface);
layer_menu = new Sprite();
addChild(layer_menu);
= new Sprite();
addChild();
layer_mouse = new Sprite();
addChild(layer_mouse);
= 20;
= true;
= ;
= new ScreenWipe();
.x = 0;
.y = 0;
.blendMode = "multiply";
.addChild();
= new ApplicationKeystate();
stage.addEventListener(KeyboardEvent.KEY_DOWN, keydown_listener);
stage.addEventListener(KeyboardEvent.KEY_UP, keyup_listener);
stage.addEventListener(MouseEvent.MOUSE_DOWN, mouse_down_handler);
stage.addEventListener(MouseEvent.MOUSE_UP, mouse_up_handler);
stage.showDefaultContextMenu = false;
window_manager = new WindowManager();
window_manager.initialize();
MouseManager.PTR = new MouseManager();
MouseManager.PTR.initialize();
.enter_screen();
}
public function
(_arg1:int):IScreen{
var _local2:int;
_local2 = 0;
while (_local2 < .length) {
if ( [_local2].get_id() == _arg1){
return ( [_local2]);
};
_local2++;
};
return (null);
}
public function (_arg1:Event){
stage.addEventListener(MouseEvent.MOUSE_MOVE, );
if (){
.mouse_left_window();
};
MouseManager.PTR.hide_mouse();
}
public function mouse_up_handler(_arg1:MouseEvent):void{
if (){
.mouse_up_handler(_arg1);
};
}
public function (_arg1:Event){
= new SoundManager();
SoundManager.PTR = ;
= new Array();
.push(new MainMenuScreen());
.push(new MissionInfoScreen());
.push(new Game());
.push(new GameOverScreen());
.push(new InstructionsScreen());
.push(new SelectChallengeScreen());
.push(new CreditsScreen());
= [0];
stage.addEventListener(Event.MOUSE_LEAVE, );
MissionDatabase.PTR = new MissionDatabase();
AIDatabase.PTR = new AIDatabase();
GameStatistics.PTR = new GameStatistics();
initialize();
}
public function keydown_listener(_arg1:KeyboardEvent):void{
.keydown_listener(_arg1);
if (){
.key_down_handler(_arg1);
if (.click_transition != -1){
(.click_transition);
};
};
}
public function update(_arg1:Event):void{
var _local2:Number;
if ( > 0){
.visible = true;
--;
if ( == 0){
if (
){
.visible = false;
};
if ( != -1){
(, true);
= -1;
= ;
= true;
return;
};
};
if (
){
.x = (-900 + ( * 47));
} else {
.x = (-900 + (( - ) * 47));
};
return;
};
_local2 = (1 / 30);
if (){
.update(_local2);
if (.dynamic_transition_desired != -1){
(.dynamic_transition_desired);
};
};
MouseManager.PTR.update(_local2);
GameStatistics.PTR.update();
.update();
}
public function
(_arg1:int, _arg2:Boolean=false){
var _local3:IScreen;
_local3 =
(_arg1);
if (!_arg2){
if (_local3.request_fade){
= _arg1;
= false;
= ;
return;
};
};
if (){
.exit_screen();
};
_local3.enter_screen();
= _local3;
}
public static function get_singleton():Application{
return (PTR);
}
}
}//package
Section 100
//ApplicationKeystate (ApplicationKeystate)
package {
import flash.events.*;
public class ApplicationKeystate {
var :Object;
var :Object;
public function ApplicationKeystate(){
= new Object();
= new Object();
}
public function keyup_listener(_arg1:KeyboardEvent):void{
delete [_arg1.keyCode];
}
public function keydown_listener(_arg1:KeyboardEvent):void{
[_arg1.keyCode] = true;
[_arg1.keyCode] = true;
}
public function (_arg1:uint):Boolean{
var _local2:Boolean;
_local2 = (_arg1 in );
if (_local2){
delete [_arg1];
};
return (_local2);
}
public function (_arg1:uint):Boolean{
return (Boolean((_arg1 in )));
}
}
}//package
Section 101
//ArmorGamesIntro (ArmorGamesIntro)
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public class ArmorGamesIntro extends MovieClip {
public function ArmorGamesIntro(){
this.addEventListener(MouseEvent.CLICK, );
this.addEventListener(Event.ENTER_FRAME, update);
}
public function (_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.armorgames.com"), "_blank");
}
public function update(_arg1:Event):void{
if (this.currentFrame >= 218){
this.stop();
this.removeEventListener(MouseEvent.CLICK, );
this.removeEventListener(Event.ENTER_FRAME, update);
};
}
}
}//package
Section 102
//AudioBoardZoom (AudioBoardZoom)
package {
import flash.media.*;
public dynamic class AudioBoardZoom extends Sound {
}
}//package
Section 103
//AudioButton (AudioButton)
package {
import flash.media.*;
public dynamic class AudioButton extends Sound {
}
}//package
Section 104
//AudioEnemyCapture (AudioEnemyCapture)
package {
import flash.media.*;
public dynamic class AudioEnemyCapture extends Sound {
}
}//package
Section 105
//AudioGameWin (AudioGameWin)
package {
import flash.media.*;
public dynamic class AudioGameWin extends Sound {
}
}//package
Section 106
//AudioMainMenu (AudioMainMenu)
package {
import flash.media.*;
public dynamic class AudioMainMenu extends Sound {
}
}//package
Section 107
//AudioMatchLose (AudioMatchLose)
package {
import flash.media.*;
public dynamic class AudioMatchLose extends Sound {
}
}//package
Section 108
//AudioMatchStart (AudioMatchStart)
package {
import flash.media.*;
public dynamic class AudioMatchStart extends Sound {
}
}//package
Section 109
//AudioMatchWin (AudioMatchWin)
package {
import flash.media.*;
public dynamic class AudioMatchWin extends Sound {
}
}//package
Section 110
//AudioMissionIntro (AudioMissionIntro)
package {
import flash.media.*;
public dynamic class AudioMissionIntro extends Sound {
}
}//package
Section 111
//AudioPieceCapture (AudioPieceCapture)
package {
import flash.media.*;
public dynamic class AudioPieceCapture extends Sound {
}
}//package
Section 112
//AudioPieceLost (AudioPieceLost)
package {
import flash.media.*;
public dynamic class AudioPieceLost extends Sound {
}
}//package
Section 113
//AudioPieceMove (AudioPieceMove)
package {
import flash.media.*;
public dynamic class AudioPieceMove extends Sound {
}
}//package
Section 114
//BtnChallenge1 (BtnChallenge1)
package {
import flash.display.*;
public dynamic class BtnChallenge1 extends MovieClip {
}
}//package
Section 115
//BtnChallenge2 (BtnChallenge2)
package {
import flash.display.*;
public dynamic class BtnChallenge2 extends MovieClip {
}
}//package
Section 116
//BtnChallenge3 (BtnChallenge3)
package {
import flash.display.*;
public dynamic class BtnChallenge3 extends MovieClip {
}
}//package
Section 117
//BtnChallenge4 (BtnChallenge4)
package {
import flash.display.*;
public dynamic class BtnChallenge4 extends MovieClip {
}
}//package
Section 118
//ButtonChallenge (ButtonChallenge)
package {
import flash.display.*;
public dynamic class ButtonChallenge extends MovieClip {
}
}//package
Section 119
//ButtonCredits (ButtonCredits)
package {
import flash.display.*;
public dynamic class ButtonCredits extends MovieClip {
}
}//package
Section 120
//ButtonGamingNews (ButtonGamingNews)
package {
import flash.display.*;
public dynamic class ButtonGamingNews extends MovieClip {
}
}//package
Section 121
//ButtonInstructions (ButtonInstructions)
package {
import flash.display.*;
public dynamic class ButtonInstructions extends MovieClip {
}
}//package
Section 122
//ButtonPlayGame (ButtonPlayGame)
package {
import flash.display.*;
public dynamic class ButtonPlayGame extends MovieClip {
}
}//package
Section 123
//ButtonPlayMoreGames (ButtonPlayMoreGames)
package {
import flash.display.*;
public dynamic class ButtonPlayMoreGames extends MovieClip {
}
}//package
Section 124
//CellEmpty (CellEmpty)
package {
import flash.display.*;
public dynamic class CellEmpty extends MovieClip {
}
}//package
Section 125
//CellFilled (CellFilled)
package {
import flash.display.*;
public dynamic class CellFilled extends MovieClip {
}
}//package
Section 126
//CPMStarAdBox (CPMStarAdBox)
package {
import flash.display.*;
public dynamic class CPMStarAdBox extends MovieClip {
}
}//package
Section 127
//GridTexture (GridTexture)
package {
import flash.display.*;
public dynamic class GridTexture extends BitmapData {
public function GridTexture(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 128
//IconPiece (IconPiece)
package {
import flash.display.*;
public dynamic class IconPiece extends MovieClip {
}
}//package
Section 129
//IconPieceBackground (IconPieceBackground)
package {
import flash.display.*;
public dynamic class IconPieceBackground extends MovieClip {
}
}//package
Section 130
//IScreen (IScreen)
package {
import flash.events.*;
public class IScreen {
public var clip_switch_active:Boolean;
public var clip_switch_target:Array;
public var clip_switch_array:Array;
public var click_transition:int;
public var dynamic_transition_desired:int;
public var request_fade:Boolean;
public static const IS_CREDITS:int = 7;
public static const IS_GAME_OVER:int = 3;
public static const IS_PLAY_MORE_GAMES:int = 6;
public static const IS_GAMING_NEWS:int = 10;
public static const IS_SPLASH_SCREEN:int = 1;
public static const IS_MAIN_MENU:int = 0;
public static const IS_SELECT_CHALLENGE:int = 9;
public static const IS_SELECT_AI:int = 2;
public static const IS_PLAYING_GAME:int = 5;
public static const IS_INSTRUCTIONS:int = 4;
public static const IS_MISSION_INFO:int = 8;
public function IScreen(){
clip_switch_active = false;
click_transition = -1;
dynamic_transition_desired = -1;
request_fade = false;
}
public function mouse_up_handler(_arg1:MouseEvent):void{
}
public function update(_arg1:Number):void{
}
public function mouse_left_window():void{
}
public function mouse_enter_window():void{
}
public function key_down_handler(_arg1:KeyboardEvent):void{
}
public function enter_screen():void{
}
public function mouse_down_handler(_arg1:MouseEvent):void{
}
public function get_clip_at_location(_arg1:int, _arg2:int):int{
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
if (clip_switch_array){
_local3 = 0;
while (_local3 < clip_switch_array.length) {
if (clip_switch_array[_local3]){
_local4 = clip_switch_array[_local3].width;
_local5 = clip_switch_array[_local3].height;
_local6 = (clip_switch_array[_local3].x - (_local4 / 2));
_local7 = (clip_switch_array[_local3].x + (_local4 / 2));
_local8 = (clip_switch_array[_local3].y - (_local5 / 2));
_local9 = (clip_switch_array[_local3].y + (_local5 / 2));
if ((((((((_arg1 >= _local6)) && ((_arg1 <= _local7)))) && ((_arg2 >= _local8)))) && ((_arg2 <= _local9)))){
return (_local3);
};
};
_local3++;
};
};
return (-1);
}
public function get_id():int{
return (-1);
}
public function exit_screen():void{
}
}
}//package
Section 131
//MatchStartLogo (MatchStartLogo)
package {
import flash.display.*;
public dynamic class MatchStartLogo extends MovieClip {
public function MatchStartLogo(){
addFrameScript(103, );
}
function (){
stop();
}
}
}//package
Section 132
//MenuReturnButton (MenuReturnButton)
package {
import flash.display.*;
public dynamic class MenuReturnButton extends MovieClip {
}
}//package
Section 133
//MissionUIBackground (MissionUIBackground)
package {
import flash.display.*;
public dynamic class MissionUIBackground extends MovieClip {
public function MissionUIBackground(){
addFrameScript(119, , 239, , 359, , 479, , 599, , 719, , 839, , 959, , 1079, );
}
function (){
stop();
}
function (){
stop();
}
function (){
stop();
}
function (){
stop();
}
function (){
stop();
}
function (){
stop();
}
function (){
stop();
}
function (){
stop();
}
function (){
stop();
}
}
}//package
Section 134
//MissionUIBottom (MissionUIBottom)
package {
import flash.display.*;
import flash.text.*;
public dynamic class MissionUIBottom extends MovieClip {
public var mission_text:TextField;
public var bottom_frame:MovieClip;
public var ok_btn:MovieClip;
public function MissionUIBottom(){
addFrameScript(29, frame30);
}
function frame30(){
stop();
}
}
}//package
Section 135
//MissionUITop (MissionUITop)
package {
import flash.display.*;
import flash.text.*;
public dynamic class MissionUITop extends MovieClip {
public var mission_name:TextField;
public function MissionUITop(){
addFrameScript(29, frame30);
}
function frame30(){
stop();
}
}
}//package
Section 136
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
var _local3:MochiBot;
var _local4:String;
var _local5:URLVariables;
var _local6:String;
var _local7:URLRequest;
var _local8:Loader;
_local3 = new (MochiBot);
_arg1.addChild(_local3);
_local4 = "http://core.mochibot.com/my/core.swf";
_local5 = new URLVariables();
_local5.sb = Security.sandboxType;
_local5.v = Capabilities.version;
_local5.fv = "9";
_local5.mv = "8";
_local5.swfid = _arg2;
_local6 = _arg1.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5.url = _local6;
} else {
_local5.url = "local";
};
_local7 = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
_local8 = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package
Section 137
//MouseManager (MouseManager)
package {
import flash.display.*;
import flash.events.*;
import flash.ui.*;
public class MouseManager {
var :Boolean;
var clip:MovieClip;
public static var PTR:MouseManager;
public function show_mouse():void{
= false;
}
public function hide_mouse():void{
= true;
}
public function update(_arg1:Number):void{
if ( == false){
clip.x = Application.get_singleton().stage.mouseX;
clip.y = Application.get_singleton().stage.mouseY;
} else {
clip.x = -10000;
clip.y = -10000;
};
}
public function mouse_down_handler(_arg1:MouseEvent):void{
}
public function set_mouse_frame(_arg1:int):void{
clip.gotoAndStop(_arg1);
}
public function initialize(){
= false;
Mouse.hide();
clip = new MousePointer();
Application.get_singleton().layer_mouse.addChild(clip);
clip.stop();
}
public function destroy(){
Mouse.show();
}
}
}//package
Section 138
//MousePointer (MousePointer)
package {
import flash.display.*;
public dynamic class MousePointer extends MovieClip {
}
}//package
Section 139
//PlayBackground (PlayBackground)
package {
import flash.display.*;
public dynamic class PlayBackground extends MovieClip {
}
}//package
Section 140
//PlayerUnitIcon (PlayerUnitIcon)
package {
import flash.display.*;
public dynamic class PlayerUnitIcon extends MovieClip {
}
}//package
Section 141
//PreloadBar (PreloadBar)
package {
import flash.display.*;
public dynamic class PreloadBar extends MovieClip {
}
}//package
Section 142
//Preloader (Preloader)
package {
import flash.display.*;
import flash.events.*;
import CPMStar.*;
import flash.system.*;
public dynamic class Preloader extends MovieClip {
var :DisplayObject;
var :Application;
var
:int;
var :MovieClip;
var
:Boolean;
var :PreloaderClip;
var :Boolean;
var :Boolean;
var :int;
public static var PTR:Preloader;
public function Preloader(){
var _local1:int;
var _local2:int;
super();
addFrameScript(0, );
Security.allowDomain("*");
Security.allowInsecureDomain("*");
= 120;
= 0;
= false;
= false;
PTR = this;
= false;
= null;
= new PreloaderClip();
addChild();
.x = 350;
.y = 250;
this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, );
this.loaderInfo.addEventListener(Event.COMPLETE, );
this.addEventListener(Event.ENTER_FRAME, update);
stop();
_local1 = 1052;
_local2 = 17;
= AdLoader.LoadAd(_local1, _local2);
.ad_box.addChild();
}
public function ():void{
var _local1:Application;
_local1 = new Application();
addChild(_local1);
}
function (){
stop();
}
private function (_arg1:ProgressEvent):void{
var _local2:Number;
if (.preload_bar){
_local2 = (_arg1.bytesLoaded / _arg1.bytesTotal);
.preload_bar.scaleX = _local2;
};
}
public function update(_arg1:Event){
if (!){
++;
if (((( >
)) && (
))){
if (){
.ad_box.removeChild();
= null;
};
= true;
removeChild();
= null;
gotoAndStop(10);
= new ArmorGamesIntro();
.x = 350;
.y = 250;
this.addChild();
= true;
MochiBot.track(this, "e88aef7f");
};
} else {
if (.currentFrame >= 174){
this.removeChild();
this.removeEventListener(Event.ENTER_FRAME, update);
();
};
};
}
private function (_arg1:Event):void{
= true;
}
}
}//package
Section 143
//PreloaderClip (PreloaderClip)
package {
import flash.display.*;
public dynamic class PreloaderClip extends MovieClip {
public var ad_box:CPMStarAdBox;
public var preload_bar:PreloadBar;
}
}//package
Section 144
//ScreenCredits (ScreenCredits)
package {
import flash.display.*;
public dynamic class ScreenCredits extends MovieClip {
public var ok_btn:MovieClip;
}
}//package
Section 145
//ScreenGameOver (ScreenGameOver)
package {
import flash.display.*;
import flash.text.*;
public dynamic class ScreenGameOver extends MovieClip {
public var final_units:TextField;
public var ok_btn:MovieClip;
public var final_time:TextField;
public function ScreenGameOver(){
addFrameScript(61,
);
}
function
(){
stop();
}
}
}//package
Section 146
//ScreenInstructions (ScreenInstructions)
package {
import flash.display.*;
public dynamic class ScreenInstructions extends MovieClip {
public var ok_btn:MovieClip;
}
}//package
Section 147
//ScreenWipe (ScreenWipe)
package {
import flash.display.*;
public dynamic class ScreenWipe extends MovieClip {
}
}//package
Section 148
//SoundManager (SoundManager)
package {
import flash.media.*;
public class SoundManager {
public var :Boolean;
var
:Boolean;
var :SoundTransform;
var :Array;
var :Number;
var :SoundChannel;
var :int;
var :Number;
var :int;
public static const SM_MAIN_MENU:int = 3;
public static const SM_MATCH_START:int = 5;
public static const SM_MATCH_LOSE:int = 4;
public static const SM_PIECE_CAPTURE:int = 9;
public static const SM_MISSION_INTRO:int = 7;
public static const SM_PIECE_MOVE:int = 8;
public static const SM_ENEMY_CAPTURE:int = 11;
public static const SM_BOARD_ZOOM:int = 0;
public static const SM_PIECE_LOST:int = 10;
public static const SM_GAME_WIN:int = 2;
public static const SM_MATCH_WIN:int = 6;
public static const SM_BUTTON:int = 1;
public static var PTR:SoundManager;
public function SoundManager(){
= -1;
= true;
= false;
= 0;
= new Array();
}
public function (_arg1:uint, _arg2=0.65){
if ([_arg1] == null){
return;
};
if ( == false){
return;
};
if (_arg1 == ){
return;
};
= false;
= _arg2;
= _arg1;
= ;
= _arg2;
= new SoundTransform(, 0);
= [].play(0, 999, );
}
public function update():void{
if ( != -1){
if (
){
= ( - 0.04);
if ( < 0){
= 0;
= false;
.stop();
} else {
.volume = ;
.soundTransform = ;
};
};
};
}
public function (_arg1:Boolean):void{
if (_arg1 != ){
= _arg1;
if (_arg1 == false){
();
} else {
(, );
};
};
}
public function (){
if ( != -1){
= 0;
= false;
if (){
.stop();
};
= -1;
};
}
public function sfx_event(_arg1:int){
var _local2:Sound;
var _local3:int;
var _local4:Number;
var _local5:SoundTransform;
if ( == false){
return;
};
_local4 = 0.2;
if (_arg1 == SM_BOARD_ZOOM){
_local2 = new AudioBoardZoom();
} else {
if (_arg1 == SM_BUTTON){
_local2 = new AudioButton();
} else {
if (_arg1 == SM_GAME_WIN){
_local2 = new AudioGameWin();
} else {
if (_arg1 == SM_MAIN_MENU){
_local2 = new AudioMainMenu();
} else {
if (_arg1 == SM_MATCH_LOSE){
_local2 = new AudioMatchLose();
} else {
if (_arg1 == SM_MATCH_START){
_local2 = new AudioMatchStart();
} else {
if (_arg1 == SM_MATCH_WIN){
_local2 = new AudioMatchWin();
} else {
if (_arg1 == SM_MISSION_INTRO){
_local2 = new AudioMissionIntro();
} else {
if (_arg1 == SM_PIECE_LOST){
_local2 = new AudioPieceLost();
} else {
if (_arg1 == SM_PIECE_MOVE){
_local2 = new AudioPieceMove();
} else {
if (_arg1 == SM_PIECE_CAPTURE){
_local2 = new AudioPieceCapture();
} else {
if (_arg1 == SM_ENEMY_CAPTURE){
_local2 = new AudioEnemyCapture();
};
};
};
};
};
};
};
};
};
};
};
};
if (_local2){
if (_local4 != 1){
_local5 = new SoundTransform(_local4, 0);
_local2.play(0, 0, _local5);
} else {
_local2.play();
};
};
}
public function (){
= true;
}
}
}//package
Section 149
//UIMockup (UIMockup)
package {
import flash.display.*;
import flash.text.*;
public dynamic class UIMockup extends MovieClip {
public var unit_type:TextField;
public var unit_movement:TextField;
public var player_unit_icon:PlayerUnitIcon;
public var unit_power:TextField;
public var mission_id:TextField;
public var unit_text_1:TextField;
public var unit_text_2:TextField;
public var enemy_icon:MovieClip;
}
}//package
Section 150
//WindowChallenge (WindowChallenge)
package {
import flash.display.*;
public dynamic class WindowChallenge extends MovieClip {
public var btn_challenge3:BtnChallenge3;
public var btn_challenge4:BtnChallenge4;
public var btn_return_to_menu:MovieClip;
public var btn_challenge1:BtnChallenge1;
public var btn_challenge2:BtnChallenge2;
}
}//package
Section 151
//WindowFirstMove (WindowFirstMove)
package {
import flash.display.*;
public dynamic class WindowFirstMove extends MovieClip {
public var ok_button:MovieClip;
}
}//package
Section 152
//WindowLoseMission (WindowLoseMission)
package {
import flash.display.*;
import flash.text.*;
public dynamic class WindowLoseMission extends MovieClip {
public var ok_button:MovieClip;
public var units_lost:TextField;
public var mission_time:TextField;
}
}//package
Section 153
//WindowMainMenu (WindowMainMenu)
package {
import flash.display.*;
public dynamic class WindowMainMenu extends MovieClip {
public var btn_play_game:ButtonPlayGame;
public var btn_play_more_games:ButtonPlayMoreGames;
public var btn_challenge:ButtonChallenge;
public var btn_gaming_news:ButtonGamingNews;
public var btn_instructions:ButtonInstructions;
public var btn_credits:ButtonCredits;
}
}//package
Section 154
//WindowPieceSetup (WindowPieceSetup)
package {
import flash.display.*;
public dynamic class WindowPieceSetup extends MovieClip {
public var ok_button:MovieClip;
}
}//package
Section 155
//WindowStartMatch (WindowStartMatch)
package {
import flash.display.*;
public dynamic class WindowStartMatch extends MovieClip {
public var ok_button:MovieClip;
}
}//package
Section 156
//WindowWinChallenge (WindowWinChallenge)
package {
import flash.display.*;
import flash.text.*;
public dynamic class WindowWinChallenge extends MovieClip {
public var ok_button:MovieClip;
public var units_lost:TextField;
public var mission_time:TextField;
}
}//package
Section 157
//WindowWinMission (WindowWinMission)
package {
import flash.display.*;
import flash.text.*;
public dynamic class WindowWinMission extends MovieClip {
public var ok_button:MovieClip;
public var units_lost:TextField;
public var mission_time:TextField;
}
}//package