From b9beee549f4c4e8f269677bbc538a8f418307a54 Mon Sep 17 00:00:00 2001 From: genxium Date: Thu, 2 Mar 2023 10:22:27 +0800 Subject: [PATCH] Simplified resolv_tailored. --- frontend/assets/scenes/offline_map.fire | 2 +- frontend/assets/scripts/modules/jsexport.js | 6 +- jsexport/battle/battle.go | 2 +- resolv_tailored/collision.go | 8 +- resolv_tailored/object.go | 16 ++- resolv_tailored/ringbuf.go | 7 +- resolv_tailored/shape.go | 33 +----- resolv_tailored/simple_math.go | 112 ++++++++++++++++++++ resolv_tailored/space.go | 20 ++-- resolv_tailored/vector.go | 54 +++------- 10 files changed, 157 insertions(+), 103 deletions(-) create mode 100644 resolv_tailored/simple_math.go diff --git a/frontend/assets/scenes/offline_map.fire b/frontend/assets/scenes/offline_map.fire index 4dd19fa..9434572 100644 --- a/frontend/assets/scenes/offline_map.fire +++ b/frontend/assets/scenes/offline_map.fire @@ -518,7 +518,7 @@ "array": [ 0, 0, - 210.43877906529718, + 210.4441731196186, 0, 0, 0, diff --git a/frontend/assets/scripts/modules/jsexport.js b/frontend/assets/scripts/modules/jsexport.js index f6796a8..9e5bb10 100644 --- a/frontend/assets/scripts/modules/jsexport.js +++ b/frontend/assets/scripts/modules/jsexport.js @@ -7,9 +7,9 @@ Error.stackTraceLimit=1/0;var $global,$module,$NaN=NaN;if("undefined"!=typeof wi $packages["github.com/gopherjs/gopherjs/js"]=(function(){var $pkg={},$init,A,B,J,K,M,O,P,Q,R,S,T,G,H,L;A=$pkg.Object=$newType(0,$kindStruct,"js.Object",true,"github.com/gopherjs/gopherjs/js",true,function(object_){this.$val=this;if(arguments.length===0){this.object=null;return;}this.object=object_;});B=$pkg.Error=$newType(0,$kindStruct,"js.Error",true,"github.com/gopherjs/gopherjs/js",true,function(Object_){this.$val=this;if(arguments.length===0){this.Object=null;return;}this.Object=Object_;});J=$pkg.M=$newType(4,$kindMap,"js.M",true,"github.com/gopherjs/gopherjs/js",true,null);K=$pkg.S=$newType(12,$kindSlice,"js.S",true,"github.com/gopherjs/gopherjs/js",true,null);M=$sliceType($emptyInterface);O=$ptrType(A);P=$sliceType(O);Q=$funcType([P],[O],true);R=$funcType([],[O],false);S=$funcType([O],[],false);T=$ptrType(B);A.ptr.prototype.Get=function(a){var a,b;b=this;return b.object[$externalize(a,$String)];};A.prototype.Get=function(a){return this.$val.Get(a);};A.ptr.prototype.Set=function(a,b){var a,b,c;c=this;c.object[$externalize(a,$String)]=$externalize(b,$emptyInterface);};A.prototype.Set=function(a,b){return this.$val.Set(a,b);};A.ptr.prototype.Delete=function(a){var a,b;b=this;delete b.object[$externalize(a,$String)];};A.prototype.Delete=function(a){return this.$val.Delete(a);};A.ptr.prototype.Length=function(){var a;a=this;return $parseInt(a.object.length);};A.prototype.Length=function(){return this.$val.Length();};A.ptr.prototype.Index=function(a){var a,b;b=this;return b.object[a];};A.prototype.Index=function(a){return this.$val.Index(a);};A.ptr.prototype.SetIndex=function(a,b){var a,b,c;c=this;c.object[a]=$externalize(b,$emptyInterface);};A.prototype.SetIndex=function(a,b){return this.$val.SetIndex(a,b);};A.ptr.prototype.Call=function(a,b){var a,b,c,d;c=this;return(d=c.object,d[$externalize(a,$String)].apply(d,$externalize(b,M)));};A.prototype.Call=function(a,b){return this.$val.Call(a,b);};A.ptr.prototype.Invoke=function(a){var a,b;b=this;return b.object.apply(undefined,$externalize(a,M));};A.prototype.Invoke=function(a){return this.$val.Invoke(a);};A.ptr.prototype.New=function(a){var a,b;b=this;return new($global.Function.prototype.bind.apply(b.object,[undefined].concat($externalize(a,M))));};A.prototype.New=function(a){return this.$val.New(a);};A.ptr.prototype.Bool=function(){var a;a=this;return!!(a.object);};A.prototype.Bool=function(){return this.$val.Bool();};A.ptr.prototype.String=function(){var a;a=this;return $internalize(a.object,$String);};A.prototype.String=function(){return this.$val.String();};A.ptr.prototype.Int=function(){var a;a=this;return $parseInt(a.object)>>0;};A.prototype.Int=function(){return this.$val.Int();};A.ptr.prototype.Int64=function(){var a;a=this;return $internalize(a.object,$Int64);};A.prototype.Int64=function(){return this.$val.Int64();};A.ptr.prototype.Uint64=function(){var a;a=this;return $internalize(a.object,$Uint64);};A.prototype.Uint64=function(){return this.$val.Uint64();};A.ptr.prototype.Float=function(){var a;a=this;return $parseFloat(a.object);};A.prototype.Float=function(){return this.$val.Float();};A.ptr.prototype.Interface=function(){var a;a=this;return $internalize(a.object,$emptyInterface);};A.prototype.Interface=function(){return this.$val.Interface();};A.ptr.prototype.Unsafe=function(){var a;a=this;return a.object;};A.prototype.Unsafe=function(){return this.$val.Unsafe();};B.ptr.prototype.Error=function(){var a;a=this;return"JavaScript error: "+$internalize(a.Object.message,$String);};B.prototype.Error=function(){return this.$val.Error();};B.ptr.prototype.Stack=function(){var a;a=this;return $internalize(a.Object.stack,$String);};B.prototype.Stack=function(){return this.$val.Stack();};G=function(a){var a,b,c,d,e,f;b=a;c=new($global.Object)();c.__internal_object__=b;d=b.constructor.methods;e=0;while(true){if(!(e<$parseInt(d.length))){break;}f=[f];f[0]=d[e];if(!($internalize(f[0].pkg,$String)==="")){e=e+(1)>>0;continue;}c[$externalize($internalize(f[0].name,$String),$String)]=$externalize((function(f){return function(g){var g;return $externalizeFunction(b[$externalize($internalize(f[0].prop,$String),$String)],f[0].typ,$externalize(true,$Bool)).apply(b,$externalize(g,P));};})(f),Q);e=e+(1)>>0;}return c;};$pkg.MakeWrapper=G;H=function(a){var{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,$s,$r,$c}=$restore(this,{a});$s=$s||0;s:while(true){switch($s){case 0:b=[b];c=[c];b[0]=a;d=b[0].constructor;c[0]=new($global.Object)();e=(function(b,c){return function(e,f){var e,f;$global.Object.defineProperty(c[0],$externalize(e,$String),$externalize(f,J));};})(b,c);$r=e("__internal_object__",$makeMap($String.keyFor,[{k:"value",v:new $jsObjectPtr(b[0])}]));$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}f=$internalize(d.string,$String);g=$internalize(d.pkg,$String);h="";if(f.charCodeAt(0)===42){h="*";}i=0;while(true){if(!(i>0));break;}i=i+(1)>>0;}j=g+"."+h+f;$r=e("$type",$makeMap($String.keyFor,[{k:"value",v:new $String(j)}]));$s=2;case 2:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}k=null;l=new($global.Array)();m=d.methods;if(!(m===undefined)){l=l.concat(m);}n=d.elem;if(!(n===undefined)){k=n.fields;l=l.concat(n.methods);}else{k=d.fields;}o=0;case 3:if(!(o<$parseInt(l.length))){$s=4;continue;}p=[p];p[0]=l[o];if(!($internalize(p[0].pkg,$String)==="")){o=o+(1)>>0;$s=3;continue;}$r=e($internalize(p[0].prop,$String),$makeMap($String.keyFor,[{k:"value",v:new Q((function(b,c,p){return function(q){var q;return $externalizeFunction(b[0][$externalize($internalize(p[0].prop,$String),$String)],p[0].typ,$externalize(true,$Bool),H).apply(b[0],$externalize(q,P));};})(b,c,p))}]));$s=5;case 5:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}o=o+(1)>>0;$s=3;continue;case 4:if(!(k===undefined)){$s=6;continue;}$s=7;continue;case 6:q=0;case 8:if(!(q<$parseInt(k.length))){$s=9;continue;}r=[r];r[0]=k[q];if(!!!(r[0].exported)){q=q+(1)>>0;$s=8;continue;}$r=e($internalize(r[0].prop,$String),$makeMap($String.keyFor,[{k:"get",v:new R((function(b,c,r){return function(){var s;s=$copyIfRequired(b[0].$val[$externalize($internalize(r[0].prop,$String),$String)],r[0].typ);return $externalize(s,r[0].typ,H);};})(b,c,r))},{k:"set",v:new S((function(b,c,r){return function(s){var s,t;t=$internalize(s,r[0].typ,H);b[0].$val[$externalize($internalize(r[0].prop,$String),$String)]=t;};})(b,c,r))}]));$s=10;case 10:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}q=q+(1)>>0;$s=8;continue;case 9:case 7:$s=-1;return c[0];}return;}var $f={$blk:H,$c:true,$r,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,$s};return $f;};$pkg.MakeFullWrapper=H;L=function(){var a;a=new B.ptr(null);$unused(a);};O.methods=[{prop:"Get",name:"Get",pkg:"",typ:$funcType([$String],[O],false)},{prop:"Set",name:"Set",pkg:"",typ:$funcType([$String,$emptyInterface],[],false)},{prop:"Delete",name:"Delete",pkg:"",typ:$funcType([$String],[],false)},{prop:"Length",name:"Length",pkg:"",typ:$funcType([],[$Int],false)},{prop:"Index",name:"Index",pkg:"",typ:$funcType([$Int],[O],false)},{prop:"SetIndex",name:"SetIndex",pkg:"",typ:$funcType([$Int,$emptyInterface],[],false)},{prop:"Call",name:"Call",pkg:"",typ:$funcType([$String,M],[O],true)},{prop:"Invoke",name:"Invoke",pkg:"",typ:$funcType([M],[O],true)},{prop:"New",name:"New",pkg:"",typ:$funcType([M],[O],true)},{prop:"Bool",name:"Bool",pkg:"",typ:$funcType([],[$Bool],false)},{prop:"String",name:"String",pkg:"",typ:$funcType([],[$String],false)},{prop:"Int",name:"Int",pkg:"",typ:$funcType([],[$Int],false)},{prop:"Int64",name:"Int64",pkg:"",typ:$funcType([],[$Int64],false)},{prop:"Uint64",name:"Uint64",pkg:"",typ:$funcType([],[$Uint64],false)},{prop:"Float",name:"Float",pkg:"",typ:$funcType([],[$Float64],false)},{prop:"Interface",name:"Interface",pkg:"",typ:$funcType([],[$emptyInterface],false)},{prop:"Unsafe",name:"Unsafe",pkg:"",typ:$funcType([],[$Uintptr],false)}];T.methods=[{prop:"Error",name:"Error",pkg:"",typ:$funcType([],[$String],false)},{prop:"Stack",name:"Stack",pkg:"",typ:$funcType([],[$String],false)}];A.init("github.com/gopherjs/gopherjs/js",[{prop:"object",name:"object",embedded:false,exported:false,typ:O,tag:""}]);B.init("",[{prop:"Object",name:"Object",embedded:true,exported:true,typ:O,tag:""}]);J.init($String,$emptyInterface);K.init($emptyInterface);$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:L();}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})(); $packages["runtime"]=(function(){var $pkg={},$init,A,C,D,AT,AZ,BD,AM,E,AU;A=$packages["github.com/gopherjs/gopherjs/js"];C=$pkg._type=$newType(0,$kindStruct,"runtime._type",true,"runtime",false,function(str_){this.$val=this;if(arguments.length===0){this.str="";return;}this.str=str_;});D=$pkg.TypeAssertionError=$newType(0,$kindStruct,"runtime.TypeAssertionError",true,"runtime",true,function(_interface_,concrete_,asserted_,missingMethod_){this.$val=this;if(arguments.length===0){this._interface=AZ.nil;this.concrete=AZ.nil;this.asserted=AZ.nil;this.missingMethod="";return;}this._interface=_interface_;this.concrete=concrete_;this.asserted=asserted_;this.missingMethod=missingMethod_;});AT=$pkg.errorString=$newType(8,$kindString,"runtime.errorString",true,"runtime",false,null);AZ=$ptrType(C);BD=$ptrType(D);C.ptr.prototype.string=function(){var a;a=this;return a.str;};C.prototype.string=function(){return this.$val.string();};C.ptr.prototype.pkgpath=function(){var a;a=this;return"";};C.prototype.pkgpath=function(){return this.$val.pkgpath();};D.ptr.prototype.RuntimeError=function(){};D.prototype.RuntimeError=function(){return this.$val.RuntimeError();};D.ptr.prototype.Error=function(){var a,b,c,d,e;a=this;b="interface";if(!(a._interface===AZ.nil)){b=a._interface.string();}c=a.asserted.string();if(a.concrete===AZ.nil){return"interface conversion: "+b+" is nil, not "+c;}d=a.concrete.string();if(a.missingMethod===""){e="interface conversion: "+b+" is "+d+", not "+c;if(d===c){if(!(a.concrete.pkgpath()===a.asserted.pkgpath())){e=e+(" (types from different packages)");}else{e=e+(" (types from different scopes)");}}return e;}return"interface conversion: "+d+" is not "+c+": missing method "+a.missingMethod;};D.prototype.Error=function(){return this.$val.Error();};E=function(){var a,b;a=$packages[$externalize("github.com/gopherjs/gopherjs/js",$String)];$jsObjectPtr=a.Object.ptr;$jsErrorPtr=a.Error.ptr;$throwRuntimeError=AU;AM=$internalize($goVersion,$String);b=$ifaceNil;b=new D.ptr(AZ.nil,AZ.nil,AZ.nil,"");$unused(b);};AT.prototype.RuntimeError=function(){var a;a=this.$val;};$ptrType(AT).prototype.RuntimeError=function(){return new AT(this.$get()).RuntimeError();};AT.prototype.Error=function(){var a;a=this.$val;return"runtime error: "+(a);};$ptrType(AT).prototype.Error=function(){return new AT(this.$get()).Error();};AU=function(a){var a;$panic(new AT((a)));};AZ.methods=[{prop:"string",name:"string",pkg:"runtime",typ:$funcType([],[$String],false)},{prop:"pkgpath",name:"pkgpath",pkg:"runtime",typ:$funcType([],[$String],false)}];BD.methods=[{prop:"RuntimeError",name:"RuntimeError",pkg:"",typ:$funcType([],[],false)},{prop:"Error",name:"Error",pkg:"",typ:$funcType([],[$String],false)}];AT.methods=[{prop:"RuntimeError",name:"RuntimeError",pkg:"",typ:$funcType([],[],false)},{prop:"Error",name:"Error",pkg:"",typ:$funcType([],[$String],false)}];C.init("runtime",[{prop:"str",name:"str",embedded:false,exported:false,typ:$String,tag:""}]);D.init("runtime",[{prop:"_interface",name:"_interface",embedded:false,exported:false,typ:AZ,tag:""},{prop:"concrete",name:"concrete",embedded:false,exported:false,typ:AZ,tag:""},{prop:"asserted",name:"asserted",embedded:false,exported:false,typ:AZ,tag:""},{prop:"missingMethod",name:"missingMethod",embedded:false,exported:false,typ:$String,tag:""}]);$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=A.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}AM="";E();}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})(); $packages["math/bits"]=(function(){var $pkg={},$init;$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})(); -$packages["math"]=(function(){var $pkg={},$init,B,A,IT,IU,IV,IW,FL,FM,FN,FO,FP,HH,EI,EX,EY,FK,GH,GK,GL,GM,GS,GT,GW,GZ,HD,HI,HL,HM;B=$packages["github.com/gopherjs/gopherjs/js"];A=$packages["math/bits"];IT=$arrayType($Uint32,2);IU=$arrayType($Float32,2);IV=$arrayType($Float64,1);IW=$structType("math",[{prop:"uint32array",name:"uint32array",embedded:false,exported:false,typ:IT,tag:""},{prop:"float32array",name:"float32array",embedded:false,exported:false,typ:IU,tag:""},{prop:"float64array",name:"float64array",embedded:false,exported:false,typ:IV,tag:""}]);EI=function(av){var av,aw,ax,ay,az,ba,bb;aw=HL(av);ax=((($shiftRightUint64(aw,52).$low>>>0))&2047)>>>0;if(ax<1023){aw=(ay=new $Uint64(2147483648,0),new $Uint64(aw.$high&ay.$high,(aw.$low&ay.$low)>>>0));if(ax===1022){aw=(az=new $Uint64(1072693248,0),new $Uint64(aw.$high|az.$high,(aw.$low|az.$low)>>>0));}}else if(ax<1075){ax=ax-(1023)>>>0;aw=(ba=$shiftRightUint64(new $Uint64(524288,0),ax),new $Uint64(aw.$high+ba.$high,aw.$low+ba.$low));aw=(bb=$shiftRightUint64(new $Uint64(1048575,4294967295),ax),new $Uint64(aw.$high&~bb.$high,(aw.$low&~bb.$low)>>>0));}return HM(aw);};$pkg.Round=EI;EX=function(av,aw){var av,aw;if(GL(av,1)||GL(aw,1)){return GK(1);}else if(GM(av)||GM(aw)){return GW();}else if((av===0)&&(av===aw)){if(GZ(av)){return aw;}return av;}if(av>aw){return av;}return aw;};EY=function(av,aw){var av,aw;if(GL(av,-1)||GL(aw,-1)){return GK(-1);}else if(GM(av)||GM(aw)){return GW();}else if((av===0)&&(av===aw)){if(GZ(av)){return av;}return aw;}if(av>>0)));};$pkg.Abs=FK;GH=function(av){var av;return $parseFloat(FL.floor(av));};$pkg.Floor=GH;GK=function(av){var av;if(av>=0){return FN;}else{return FO;}};$pkg.Inf=GK;GL=function(av,aw){var av,aw;if(av===FN){return aw>=0;}if(av===FO){return aw<=0;}return false;};$pkg.IsInf=GL;GM=function(av){var av,aw;aw=false;aw=!((av===av));return aw;};$pkg.IsNaN=GM;GS=function(av,aw){var av,aw;return EX(av,aw);};$pkg.Max=GS;GT=function(av,aw){var av,aw;return EY(av,aw);};$pkg.Min=GT;GW=function(){return FP;};$pkg.NaN=GW;GZ=function(av){var av;return av<0||(1/av===FO);};$pkg.Signbit=GZ;HD=function(av){var av;return $parseFloat(FL.sqrt(av));};$pkg.Sqrt=HD;HI=function(){var av;av=new($global.ArrayBuffer)(8);HH.uint32array=new($global.Uint32Array)(av);HH.float32array=new($global.Float32Array)(av);HH.float64array=new($global.Float64Array)(av);};HL=function(av){var av,aw,ax;HH.float64array[0]=av;return(aw=$shiftLeft64((new $Uint64(0,HH.uint32array[1])),32),ax=(new $Uint64(0,HH.uint32array[0])),new $Uint64(aw.$high+ax.$high,aw.$low+ax.$low));};$pkg.Float64bits=HL;HM=function(av){var av;HH.uint32array[0]=((av.$low>>>0));HH.uint32array[1]=(($shiftRightUint64(av,32).$low>>>0));return HH.float64array[0];};$pkg.Float64frombits=HM;$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=B.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=A.$init();$s=2;case 2:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}HH=new IW.ptr(IT.zero(),IU.zero(),IV.zero());FL=$global.Math;FM=0;FN=1/FM;FO=-1/FM;FP=$parseFloat($NaN);HI();}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})(); -$packages["resolv"]=(function(){var $pkg={},$init,A,B,G,I,J,L,N,R,S,U,X,Z,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO,AP,AQ,AR,AS,H,K,M,O,P,T,V,W,Y,AA;A=$packages["math"];B=$pkg.Vector=$newType(12,$kindSlice,"resolv.Vector",true,"resolv",true,null);G=$pkg.Space=$newType(0,$kindStruct,"resolv.Space",true,"resolv",true,function(Cells_,CellWidth_,CellHeight_){this.$val=this;if(arguments.length===0){this.Cells=AD.nil;this.CellWidth=0;this.CellHeight=0;return;}this.Cells=Cells_;this.CellWidth=CellWidth_;this.CellHeight=CellHeight_;});I=$pkg.Shape=$newType(8,$kindInterface,"resolv.Shape",true,"resolv",true,null);J=$pkg.Line=$newType(0,$kindStruct,"resolv.Line",true,"resolv",true,function(Start_,End_){this.$val=this;if(arguments.length===0){this.Start=B.nil;this.End=B.nil;return;}this.Start=Start_;this.End=End_;});L=$pkg.ConvexPolygon=$newType(0,$kindStruct,"resolv.ConvexPolygon",true,"resolv",true,function(Points_,X_,Y_,Closed_){this.$val=this;if(arguments.length===0){this.Points=AH.nil;this.X=0;this.Y=0;this.Closed=false;return;}this.Points=Points_;this.X=X_;this.Y=Y_;this.Closed=Closed_;});N=$pkg.ContactSet=$newType(0,$kindStruct,"resolv.ContactSet",true,"resolv",true,function(Points_,MTV_,Center_){this.$val=this;if(arguments.length===0){this.Points=AL.nil;this.MTV=B.nil;this.Center=B.nil;return;}this.Points=Points_;this.MTV=MTV_;this.Center=Center_;});R=$pkg.AnyObj=$newType(8,$kindInterface,"resolv.AnyObj",true,"resolv",true,null);S=$pkg.RingBuffer=$newType(0,$kindStruct,"resolv.RingBuffer",true,"resolv",true,function(Ed_,St_,EdFrameId_,StFrameId_,N_,Cnt_,Eles_){this.$val=this;if(arguments.length===0){this.Ed=0;this.St=0;this.EdFrameId=0;this.StFrameId=0;this.N=0;this.Cnt=0;this.Eles=AO.nil;return;}this.Ed=Ed_;this.St=St_;this.EdFrameId=EdFrameId_;this.StFrameId=StFrameId_;this.N=N_;this.Cnt=Cnt_;this.Eles=Eles_;});U=$pkg.Object=$newType(0,$kindStruct,"resolv.Object",true,"resolv",true,function(Shape_,Space_,X_,Y_,W_,H_,TouchingCells_,Data_,ignoreList_,tags_){this.$val=this;if(arguments.length===0){this.Shape=$ifaceNil;this.Space=AE.nil;this.X=0;this.Y=0;this.W=0;this.H=0;this.TouchingCells=AH.nil;this.Data=$ifaceNil;this.ignoreList=false;this.tags=AP.nil;return;}this.Shape=Shape_;this.Space=Space_;this.X=X_;this.Y=Y_;this.W=W_;this.H=H_;this.TouchingCells=TouchingCells_;this.Data=Data_;this.ignoreList=ignoreList_;this.tags=tags_;});X=$pkg.Collision=$newType(0,$kindStruct,"resolv.Collision",true,"resolv",true,function(checkingObject_,dx_,dy_,Objects_,Cells_){this.$val=this;if(arguments.length===0){this.checkingObject=AF.nil;this.dx=0;this.dy=0;this.Objects=AH.nil;this.Cells=AH.nil;return;}this.checkingObject=checkingObject_;this.dx=dx_;this.dy=dy_;this.Objects=Objects_;this.Cells=Cells_;});Z=$pkg.Cell=$newType(0,$kindStruct,"resolv.Cell",true,"resolv",true,function(X_,Y_,Objects_){this.$val=this;if(arguments.length===0){this.X=0;this.Y=0;this.Objects=AH.nil;return;}this.X=X_;this.Y=Y_;this.Objects=Objects_;});AB=$ptrType(Z);AC=$sliceType(AB);AD=$sliceType(AC);AE=$ptrType(G);AF=$ptrType(U);AG=$sliceType(AF);AH=$ptrType(S);AI=$sliceType($Float64);AJ=$ptrType(J);AK=$sliceType(AJ);AL=$sliceType(B);AM=$ptrType(L);AN=$ptrType(N);AO=$sliceType(R);AP=$sliceType($String);AQ=$ptrType(I);AR=$ptrType(X);AS=$mapType(AF,$Bool);B.prototype.Clone=function(){var a,b;a=this;b=$makeSlice(B,a.$length);$copySlice(b,a);return b;};$ptrType(B).prototype.Clone=function(){return this.$get().Clone();};B.prototype.Magnitude=function(){var a;a=this;return A.Sqrt(a.Magnitude2());};$ptrType(B).prototype.Magnitude=function(){return this.$get().Magnitude();};B.prototype.Magnitude2=function(){var a,b,c,d,e;a=this;b=0;c=a;d=0;while(true){if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);b=b+(e*e);d++;}return b;};$ptrType(B).prototype.Magnitude2=function(){return this.$get().Magnitude2();};B.prototype.Unit=function(){var a,b,c;a=this;b=a.Magnitude();if(b<1e-08){return a;}c=0;while(true){if(!(c=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+c]=((c<0||c>=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+c])/b);c=c+(1)>>0;}return a;};$ptrType(B).prototype.Unit=function(){return this.$get().Unit();};B.prototype.X=function(){var a;a=this;if(a.$length<1){return 0;}return(0>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+0]);};$ptrType(B).prototype.X=function(){return this.$get().X();};B.prototype.Y=function(){var a;a=this;if(a.$length<2){return 0;}return(1>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+1]);};$ptrType(B).prototype.Y=function(){return this.$get().Y();};B.prototype.Z=function(){var a;a=this;if(a.$length<3){return 0;}return(2>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+2]);};$ptrType(B).prototype.Z=function(){return this.$get().Z();};H=function(a,b,c,d){var a,b,c,d,e,f,g;e=new G.ptr(AD.nil,0,0);e.CellWidth=c;e.CellHeight=d;e.Resize((f=a/c,(f===f&&f!==1/0&&f!==-1/0)?f>>0:$throwRuntimeError("integer divide by zero")),(g=b/d,(g===g&&g!==1/0&&g!==-1/0)?g>>0:$throwRuntimeError("integer divide by zero")));return e;};$pkg.NewSpace=H;G.ptr.prototype.AddSingle=function(a){var{a,b,$s,$r,$c}=$restore(this,{a});$s=$s||0;s:while(true){switch($s){case 0:b=this;if(b===AE.nil){$panic(new $String("ERROR: space is nil"));}a.Space=b;$r=a.Update();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=-1;return;}return;}var $f={$blk:G.ptr.prototype.AddSingle,$c:true,$r,a,b,$s};return $f;};G.prototype.AddSingle=function(a){return this.$val.AddSingle(a);};G.ptr.prototype.Add=function(a){var{a,b,c,d,e,$s,$r,$c}=$restore(this,{a});$s=$s||0;s:while(true){switch($s){case 0:b=this;if(b===AE.nil){$panic(new $String("ERROR: space is nil"));}c=a;d=0;case 1:if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);e.Space=b;$r=e.Update();$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}d++;$s=1;continue;case 2:$s=-1;return;}return;}var $f={$blk:G.ptr.prototype.Add,$c:true,$r,a,b,c,d,e,$s};return $f;};G.prototype.Add=function(a){return this.$val.Add(a);};G.ptr.prototype.RemoveSingle=function(a){var a,b,c;b=this;if(b===AE.nil){$panic(new $String("ERROR: space is nil"));}while(true){if(!(0=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);while(true){if(!(0=f.$length)?($throwRuntimeError("index out of range"),undefined):f.$array[f.$offset+e])).$length;h=0;while(true){if(!(h=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+e])),((h<0||h>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+h])).Objects;l=k.StFrameId;while(true){if(!(l>0;}h=h+(1)>>0;}e=e+(1)>>0;}return c;};G.prototype.Objects=function(){return this.$val.Objects();};G.ptr.prototype.Resize=function(a,b){var a,b,c,d,e,f,g,h;c=this;c.Cells=$makeSlice(AD,b);d=0;while(true){if(!(d=e.$length)?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+d]=$makeSlice(AC,a)));f=0;while(true){if(!(f=h.$length)?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+d])),((f<0||f>=g.$length)?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+f]=AA(f,d)));f=f+(1)>>0;}d=d+(1)>>0;}};G.prototype.Resize=function(a,b){return this.$val.Resize(a,b);};G.ptr.prototype.Cell=function(a,b){var a,b,c,d,e,f;c=this;if(b>=0&&b=0&&a<(d=c.Cells,((b<0||b>=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+b])).$length){return(e=(f=c.Cells,((b<0||b>=f.$length)?($throwRuntimeError("index out of range"),undefined):f.$array[f.$offset+b])),((a<0||a>=e.$length)?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+a]));}return AB.nil;};G.prototype.Cell=function(a,b){return this.$val.Cell(a,b);};G.ptr.prototype.CheckCells=function(a,b,c,d,e){var a,b,c,d,e,f,g,h,i,j,k,l;f=this;g=a;while(true){if(!(g<(a+c>>0))){break;}h=b;while(true){if(!(h<(b+d>>0))){break;}i=f.Cell(g,h);if(!(i===AB.nil)){j=i.Objects;if(e.$length>0){if(i.ContainsTags(e)){k=j.StFrameId;while(true){if(!(k>0;}}}else if(i.Occupied()){return $assertType(j.GetByFrameId(j.StFrameId),AF);}}h=h+(1)>>0;}g=g+(1)>>0;}return AF.nil;};G.prototype.CheckCells=function(a,b,c,d,e){return this.$val.CheckCells(a,b,c,d,e);};G.ptr.prototype.CheckCellsWorld=function(a,b,c,d,e){var a,b,c,d,e,f,g,h,i,j,k,l;f=this;g=f.WorldToSpace(a,b);h=g[0];i=g[1];j=f.WorldToSpace(c,d);k=j[0];l=j[1];return f.CheckCells(h,i,k,l,e);};G.prototype.CheckCellsWorld=function(a,b,c,d,e){return this.$val.CheckCellsWorld(a,b,c,d,e);};G.ptr.prototype.UnregisterAllObjects=function(){var a,b,c,d,e,f,g,h,i,j;a=this;b=0;while(true){if(!(b=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+b])).$length)){break;}g=(e=(f=a.Cells,((b<0||b>=f.$length)?($throwRuntimeError("index out of range"),undefined):f.$array[f.$offset+b])),((c<0||c>=e.$length)?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+c]));h=g.Objects;i=h.StFrameId;while(true){if(!(i>0;}c=c+(1)>>0;}b=b+(1)>>0;}};G.prototype.UnregisterAllObjects=function(){return this.$val.UnregisterAllObjects();};G.ptr.prototype.WorldToSpace=function(a,b){var a,b,c,d,e;c=this;d=((A.Floor(a/(c.CellWidth))>>0));e=((A.Floor(b/(c.CellHeight))>>0));return[d,e];};G.prototype.WorldToSpace=function(a,b){return this.$val.WorldToSpace(a,b);};G.ptr.prototype.SpaceToWorld=function(a,b){var a,b,c,d,e;c=this;d=(($imul(a,c.CellWidth)));e=(($imul(b,c.CellHeight)));return[d,e];};G.prototype.SpaceToWorld=function(a,b){return this.$val.SpaceToWorld(a,b);};G.ptr.prototype.Height=function(){var a;a=this;return a.Cells.$length;};G.prototype.Height=function(){return this.$val.Height();};G.ptr.prototype.Width=function(){var a,b;a=this;if(a.Cells.$length>0){return(b=a.Cells,(0>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+0])).$length;}return 0;};G.prototype.Width=function(){return this.$val.Width();};G.ptr.prototype.CellsInLine=function(a,b,c,d){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;e=this;f=new AC([]);g=e.Cell(a,b);h=e.Cell(c,d);if(!(g===AB.nil)&&!(h===AB.nil)){i=new B([((c-a>>0)),((d-b>>0))]).Unit();(0>=i.$length?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+0]=(0>=i.$length?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+0])*(((j=e.CellWidth/2,(j===j&&j!==1/0&&j!==-1/0)?j>>0:$throwRuntimeError("integer divide by zero")))));(1>=i.$length?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+1]=(1>=i.$length?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+1])*(((k=e.CellHeight/2,(k===k&&k!==1/0&&k!==-1/0)?k>>0:$throwRuntimeError("integer divide by zero")))));l=e.SpaceToWorld(a,b);m=l[0];n=l[1];q=new B([m+((o=e.CellWidth/2,(o===o&&o!==1/0&&o!==-1/0)?o>>0:$throwRuntimeError("integer divide by zero"))),n+((p=e.CellHeight/2,(p===p&&p!==1/0&&p!==-1/0)?p>>0:$throwRuntimeError("integer divide by zero")))]);r=false;while(true){if(!(!(g===AB.nil))){break;}if(g===h){f=$append(f,g);break;}f=$append(f,g);if(r){(1>=q.$length?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+1]=(1>=q.$length?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+1])+((1>=i.$length?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+1])));}else{(0>=q.$length?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+0]=(0>=q.$length?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+0])+((0>=i.$length?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+0])));}s=e.WorldToSpace((0>=q.$length?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+0]),(1>=q.$length?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+1]));t=s[0];u=s[1];v=e.Cell(t,u);if(!(v===g)){g=v;}r=!r;}}return f;};G.prototype.CellsInLine=function(a,b,c,d){return this.$val.CellsInLine(a,b,c,d);};K=function(a,b,c,d){var a,b,c,d,e;e=new J.ptr(B.nil,B.nil);e.Start=new B([a,b]);e.End=new B([c,d]);return e;};$pkg.NewLine=K;J.ptr.prototype.Normal=function(){var a,b,c,d,e,f,g;a=this;d=(b=a.End,(1>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+1]))-(c=a.Start,(1>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+1]));g=(e=a.End,(0>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+0]))-(f=a.Start,(0>=f.$length?($throwRuntimeError("index out of range"),undefined):f.$array[f.$offset+0]));return new B([d,-g]).Unit();};J.prototype.Normal=function(){return this.$val.Normal();};J.ptr.prototype.IntersectionPointsLine=function(a){var a,aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;b=this;k=((c=b.End,(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0]))-(d=b.Start,(0>=d.$length?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+0])))*((e=a.End,(1>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+1]))-(f=a.Start,(1>=f.$length?($throwRuntimeError("index out of range"),undefined):f.$array[f.$offset+1])))-((g=a.End,(0>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+0]))-(h=a.Start,(0>=h.$length?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+0])))*((i=b.End,(1>=i.$length?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+1]))-(j=b.Start,(1>=j.$length?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+1])));if(!((k===0))){t=((((l=b.Start,(1>=l.$length?($throwRuntimeError("index out of range"),undefined):l.$array[l.$offset+1]))-(m=a.Start,(1>=m.$length?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+1])))*((n=a.End,(0>=n.$length?($throwRuntimeError("index out of range"),undefined):n.$array[n.$offset+0]))-(o=a.Start,(0>=o.$length?($throwRuntimeError("index out of range"),undefined):o.$array[o.$offset+0]))))-(((p=b.Start,(0>=p.$length?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+0]))-(q=a.Start,(0>=q.$length?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+0])))*((r=a.End,(1>=r.$length?($throwRuntimeError("index out of range"),undefined):r.$array[r.$offset+1]))-(s=a.Start,(1>=s.$length?($throwRuntimeError("index out of range"),undefined):s.$array[s.$offset+1]))))+1)/k;ac=((((u=b.Start,(1>=u.$length?($throwRuntimeError("index out of range"),undefined):u.$array[u.$offset+1]))-(v=a.Start,(1>=v.$length?($throwRuntimeError("index out of range"),undefined):v.$array[v.$offset+1])))*((w=b.End,(0>=w.$length?($throwRuntimeError("index out of range"),undefined):w.$array[w.$offset+0]))-(x=b.Start,(0>=x.$length?($throwRuntimeError("index out of range"),undefined):x.$array[x.$offset+0]))))-(((y=b.Start,(0>=y.$length?($throwRuntimeError("index out of range"),undefined):y.$array[y.$offset+0]))-(z=a.Start,(0>=z.$length?($throwRuntimeError("index out of range"),undefined):z.$array[z.$offset+0])))*((aa=b.End,(1>=aa.$length?($throwRuntimeError("index out of range"),undefined):aa.$array[aa.$offset+1]))-(ab=b.Start,(1>=ab.$length?($throwRuntimeError("index out of range"),undefined):ab.$array[ab.$offset+1]))))+1)/k;if((0=ad.$length?($throwRuntimeError("index out of range"),undefined):ad.$array[ad.$offset+0]))-(ae=b.Start,(0>=ae.$length?($throwRuntimeError("index out of range"),undefined):ae.$array[ae.$offset+0]));ai=(ag=b.End,(1>=ag.$length?($throwRuntimeError("index out of range"),undefined):ag.$array[ag.$offset+1]))-(ah=b.Start,(1>=ah.$length?($throwRuntimeError("index out of range"),undefined):ah.$array[ah.$offset+1]));return new B([(aj=b.Start,(0>=aj.$length?($throwRuntimeError("index out of range"),undefined):aj.$array[aj.$offset+0]))+(t*af),(ak=b.Start,(1>=ak.$length?($throwRuntimeError("index out of range"),undefined):ak.$array[ak.$offset+1]))+(t*ai)]);}}return B.nil;};J.prototype.IntersectionPointsLine=function(a){return this.$val.IntersectionPointsLine(a);};M=function(a){var a,b;b=new L.ptr(AH.nil,0,0,false);b.Points=T(6);b.Closed=true;b.AddPoints(a);return b;};$pkg.NewConvexPolygon=M;L.ptr.prototype.GetPointByOffset=function(a){var a,b;b=this;if(b.Points.Cnt<=a){return B.nil;}return $assertType(b.Points.GetByFrameId(b.Points.StFrameId+a>>0),B);};L.prototype.GetPointByOffset=function(a){return this.$val.GetPointByOffset(a);};L.ptr.prototype.Clone=function(){var a,b,c;a=this;b=M(AI.nil);b.X=a.X;b.Y=a.Y;c=0;while(true){if(!(c>0;}b.Closed=a.Closed;return b;};L.prototype.Clone=function(){return this.$val.Clone();};L.ptr.prototype.AddPoints=function(a){var a,b,c,d;b=this;c=0;while(true){if(!(c=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+c]),(d=c+1>>0,((d<0||d>=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+d]))]));c=c+(2)>>0;}};L.prototype.AddPoints=function(a){return this.$val.AddPoints(a);};L.ptr.prototype.UpdateAsRectangle=function(a,b,c,d){var a,b,c,d,e,f,g,h;e=this;if(!((4===e.Points.Cnt))){$panic(new $String("ConvexPolygon not having exactly 4 vertices to form a rectangle#1!"));}f=0;while(true){if(!(f=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+0]=a);(1>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+1]=b);}else if(h===(1)){(0>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+0]=a+c);(1>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+1]=b);}else if(h===(2)){(0>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+0]=a+c);(1>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+1]=b+d);}else if(h===(3)){(0>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+0]=a);(1>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+1]=b+d);}f=f+(1)>>0;}return true;};L.prototype.UpdateAsRectangle=function(a,b,c,d){return this.$val.UpdateAsRectangle(a,b,c,d);};L.ptr.prototype.Lines=function(){var a,b,c,d,e,f,g,h,i,j,k;a=this;b=a.Transformed();c=b.$length;if(!a.Closed){c=c-(1)>>0;}d=$makeSlice(AK,c);e=0;while(true){if(!(e=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+e]);g=(0>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+0]);h=f;i=g;if(e<(b.$length-1>>0)){i=(j=e+1>>0,((j<0||j>=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+j]));}k=K((0>=h.$length?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+0]),(1>=h.$length?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+1]),(0>=i.$length?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+0]),(1>=i.$length?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+1]));((e<0||e>=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+e]=k);e=e+(1)>>0;}return d;};L.prototype.Lines=function(){return this.$val.Lines();};L.ptr.prototype.Transformed=function(){var a,b,c,d;a=this;b=$makeSlice(AL,a.Points.Cnt);c=0;while(true){if(!(c=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+c]=new B([(0>=d.$length?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+0])+a.X,(1>=d.$length?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+1])+a.Y]));c=c+(1)>>0;}return b;};L.prototype.Transformed=function(){return this.$val.Transformed();};L.ptr.prototype.Bounds=function(){var a,b,c,d,e,f,g,h;a=this;b=a.Transformed();e=new B([(c=(0>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+0]),(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0])),(d=(0>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+0]),(1>=d.$length?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+1]))]);f=e.Clone();g=0;while(true){if(!(g=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+g]);if((0>=h.$length?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+0])<(0>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+0])){(0>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+0]=(0>=h.$length?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+0]));}else if((0>=h.$length?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+0])>(0>=f.$length?($throwRuntimeError("index out of range"),undefined):f.$array[f.$offset+0])){(0>=f.$length?($throwRuntimeError("index out of range"),undefined):f.$array[f.$offset+0]=(0>=h.$length?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+0]));}if((1>=h.$length?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+1])<(1>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+1])){(1>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+1]=(1>=h.$length?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+1]));}else if((1>=h.$length?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+1])>(1>=f.$length?($throwRuntimeError("index out of range"),undefined):f.$array[f.$offset+1])){(1>=f.$length?($throwRuntimeError("index out of range"),undefined):f.$array[f.$offset+1]=(1>=h.$length?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+1]));}g=g+(1)>>0;}return[e,f];};L.prototype.Bounds=function(){return this.$val.Bounds();};L.ptr.prototype.Position=function(){var a;a=this;return[a.X,a.Y];};L.prototype.Position=function(){return this.$val.Position();};L.ptr.prototype.SetPosition=function(a,b){var a,b,c;c=this;c.X=a;c.Y=b;};L.prototype.SetPosition=function(a,b){return this.$val.SetPosition(a,b);};L.ptr.prototype.SetPositionVec=function(a){var a,b;b=this;b.X=a.X();b.Y=a.Y();};L.prototype.SetPositionVec=function(a){return this.$val.SetPositionVec(a);};L.ptr.prototype.Move=function(a,b){var a,b,c;c=this;c.X=c.X+(a);c.Y=c.Y+(b);};L.prototype.Move=function(a,b){return this.$val.Move(a,b);};L.ptr.prototype.MoveVec=function(a){var a,b;b=this;b.X=b.X+(a.X());b.Y=b.Y+(a.Y());};L.prototype.MoveVec=function(a){return this.$val.MoveVec(a);};L.ptr.prototype.SATAxes=function(){var a,b,c,d,e,f,g;a=this;b=a.Lines();c=$makeSlice(AL,b.$length);d=b;e=0;while(true){if(!(e=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+e]);((f<0||f>=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+f]=g.Normal());e++;}return c;};L.prototype.SATAxes=function(){return this.$val.SATAxes();};L.ptr.prototype.PointInside=function(a){var a,b,c,d,e,f,g;b=this;c=K((0>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+0]),(1>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+1]),(0>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+0])+9.99999999999e+11,(1>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+1]));d=0;e=b.Lines();f=0;while(true){if(!(f=e.$length)?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+f]);if(!(g.IntersectionPointsLine(c)===B.nil)){d=d+(1)>>0;}f++;}return d===1;};L.prototype.PointInside=function(a){return this.$val.PointInside(a);};O=function(){var a;a=new N.ptr(AL.nil,B.nil,B.nil);a.Points=new AL([]);a.MTV=new B([0,0]);a.Center=new B([]);return a;};$pkg.NewContactSet=O;N.ptr.prototype.LeftmostPoint=function(){var a,b,c,d,e;a=this;b=B.nil;c=a.Points;d=0;while(true){if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);if(b===B.nil||(0>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+0])<(0>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+0])){b=e;}d++;}return b;};N.prototype.LeftmostPoint=function(){return this.$val.LeftmostPoint();};N.ptr.prototype.RightmostPoint=function(){var a,b,c,d,e;a=this;b=B.nil;c=a.Points;d=0;while(true){if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);if(b===B.nil||(0>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+0])>(0>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+0])){b=e;}d++;}return b;};N.prototype.RightmostPoint=function(){return this.$val.RightmostPoint();};N.ptr.prototype.TopmostPoint=function(){var a,b,c,d,e;a=this;b=B.nil;c=a.Points;d=0;while(true){if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);if(b===B.nil||(1>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+1])<(1>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+1])){b=e;}d++;}return b;};N.prototype.TopmostPoint=function(){return this.$val.TopmostPoint();};N.ptr.prototype.BottommostPoint=function(){var a,b,c,d,e;a=this;b=B.nil;c=a.Points;d=0;while(true){if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);if(b===B.nil||(1>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+1])>(1>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+1])){b=e;}d++;}return b;};N.prototype.BottommostPoint=function(){return this.$val.BottommostPoint();};L.ptr.prototype.Intersection=function(a,b,c){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;d=this;e=O();f=d.X;g=d.Y;d.X=d.X+(a);d.Y=d.Y+(b);h=$assertType(c,AM,true);i=h[0];j=h[1];if(j){k=d.Lines();l=0;while(true){if(!(l=k.$length)?($throwRuntimeError("index out of range"),undefined):k.$array[k.$offset+l]);n=i.Lines();o=0;while(true){if(!(o=n.$length)?($throwRuntimeError("index out of range"),undefined):n.$array[n.$offset+o]);q=m.IntersectionPointsLine(p);if(!(q===B.nil)){e.Points=$append(e.Points,q);}o++;}l++;}}if(e.Points.$length>0){}else{e=AN.nil;}d.X=f;d.Y=g;return e;};L.prototype.Intersection=function(a,b,c){return this.$val.Intersection(a,b,c);};P=function(a,b,c,d){var a,b,c,d;return M(new AI([a,b,a+c,b,a+c,b+d,a,b+d]));};$pkg.NewRectangle=P;T=function(a){var a,b;b=new S.ptr(0,0,0,0,0,0,AO.nil);b.Ed=0;b.St=0;b.EdFrameId=0;b.StFrameId=0;b.N=a;b.Cnt=0;b.Eles=$makeSlice(AO,a);return b;};$pkg.NewRingBuffer=T;S.ptr.prototype.DryPut=function(){var a;a=this;while(true){if(!(0=a.N)){break;}a.Pop();}a.EdFrameId=a.EdFrameId+(1)>>0;a.Cnt=a.Cnt+(1)>>0;a.Ed=a.Ed+(1)>>0;if(a.Ed>=a.N){a.Ed=a.Ed-(a.N)>>0;}};S.prototype.DryPut=function(){return this.$val.DryPut();};S.ptr.prototype.Put=function(a){var a,b,c,d;b=this;while(true){if(!(0=b.N)){break;}b.Pop();}(c=b.Eles,d=b.Ed,((d<0||d>=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]=a));b.EdFrameId=b.EdFrameId+(1)>>0;b.Cnt=b.Cnt+(1)>>0;b.Ed=b.Ed+(1)>>0;if(b.Ed>=b.N){b.Ed=b.Ed-(b.N)>>0;}};S.prototype.Put=function(a){return this.$val.Put(a);};S.ptr.prototype.Pop=function(){var a,b,c,d;a=this;if(0===a.Cnt){return $ifaceNil;}d=(b=a.Eles,c=a.St,((c<0||c>=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+c]));a.StFrameId=a.StFrameId+(1)>>0;a.Cnt=a.Cnt-(1)>>0;a.St=a.St+(1)>>0;if(a.St>=a.N){a.St=a.St-(a.N)>>0;}return d;};S.prototype.Pop=function(){return this.$val.Pop();};S.ptr.prototype.GetArrIdxByOffset=function(a){var a,b,c;b=this;if((0===b.Cnt)||0>a){return-1;}c=b.St+a>>0;if(b.St=b.N){c=c-(b.N)>>0;}if(c>=b.St||c=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+c]));};S.prototype.GetByOffset=function(a){return this.$val.GetByOffset(a);};S.ptr.prototype.GetByFrameId=function(a){var a,b;b=this;if(a>=b.EdFrameId||a>0);};S.prototype.GetByFrameId=function(a){return this.$val.GetByFrameId(a);};S.ptr.prototype.SetByFrameId=function(a,b){var a,b,c,d,e,f,g,h,i,j,k,l,m,n;c=this;d=c.StFrameId;e=c.EdFrameId;f=d;g=e;if(bb){h=c.GetArrIdxByOffset(b-c.StFrameId>>0);if(!((-1===h))){(i=c.Eles,((h<0||h>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+h]=a));return[0,f,g];}}j=0;if(g0){f.AddTags(e);}return f;};$pkg.NewObject=W;U.ptr.prototype.GetData=function(){var a;a=this;return a.Data;};U.prototype.GetData=function(){return this.$val.GetData();};U.ptr.prototype.GetShape=function(){var a;a=this;return(a.$ptr_Shape||(a.$ptr_Shape=new AQ(function(){return this.$target.Shape;},function($v){this.$target.Shape=$v;},a)));};U.prototype.GetShape=function(){return this.$val.GetShape();};U.ptr.prototype.Position=function(){var a;a=this;return[a.X,a.Y];};U.prototype.Position=function(){return this.$val.Position();};U.ptr.prototype.Clone=function(){var{a,b,c,d,e,f,g,h,$s,$r,$c}=$restore(this,{});$s=$s||0;s:while(true){switch($s){case 0:a=this;b=W(a.X,a.Y,a.W,a.H,a.Tags());b.Data=a.Data;if(!($interfaceIsEqual(a.Shape,$ifaceNil))){$s=1;continue;}$s=2;continue;case 1:c=a.Shape.Clone();$s=3;case 3:if($c){$c=false;c=c.$blk();}if(c&&c.$blk!==undefined){break s;}$r=b.SetShape(c);$s=4;case 4:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}case 2:d=a.ignoreList;e=0;f=$keys(d);while(true){if(!(e>0;}h=h+(1)>>0;}}if(!($interfaceIsEqual(a.Shape,$ifaceNil))){$s=1;continue;}$s=2;continue;case 1:$r=a.Shape.SetPosition(a.X,a.Y);$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}case 2:$s=-1;return;}return;}var $f={$blk:U.ptr.prototype.Update,$c:true,$r,a,b,c,d,e,f,g,h,i,j,$s};return $f;};U.prototype.Update=function(){return this.$val.Update();};U.ptr.prototype.AddTags=function(a){var a,b;b=this;b.tags=$appendSlice(b.tags,a);};U.prototype.AddTags=function(a){return this.$val.AddTags(a);};U.ptr.prototype.RemoveTags=function(a){var a,b,c,d,e,f,g,h,i;b=this;c=a;d=0;while(true){if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);f=b.tags;g=0;while(true){if(!(g=f.$length)?($throwRuntimeError("index out of range"),undefined):f.$array[f.$offset+g]);if(i===e){b.tags=$appendSlice($subslice(b.tags,0,h),$subslice(b.tags,(h+1>>0)));break;}g++;}d++;}};U.prototype.RemoveTags=function(a){return this.$val.RemoveTags(a);};U.ptr.prototype.HasTags=function(a){var a,b,c,d,e,f,g,h;b=this;c=a;d=0;while(true){if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);f=b.tags;g=0;while(true){if(!(g=f.$length)?($throwRuntimeError("index out of range"),undefined):f.$array[f.$offset+g]);if(h===e){return true;}g++;}d++;}return false;};U.prototype.HasTags=function(a){return this.$val.HasTags(a);};U.ptr.prototype.Tags=function(){var a;a=this;return $appendSlice(new AP([]),a.tags);};U.prototype.Tags=function(){return this.$val.Tags();};U.ptr.prototype.SetShape=function(a){var{a,b,$s,$r,$c}=$restore(this,{a});$s=$s||0;s:while(true){switch($s){case 0:b=this;if(!($interfaceIsEqual(b.Shape,a))){$s=1;continue;}$s=2;continue;case 1:b.Shape=a;$r=b.Update();$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}case 2:$s=-1;return;}return;}var $f={$blk:U.ptr.prototype.SetShape,$c:true,$r,a,b,$s};return $f;};U.prototype.SetShape=function(a){return this.$val.SetShape(a);};U.ptr.prototype.BoundsToSpace=function(a,b){var a,b,c,d,e,f,g,h,i;c=this;d=c.Space.WorldToSpace(c.X+a,c.Y+b);e=d[0];f=d[1];g=c.Space.WorldToSpace(c.X+c.W+a-1,c.Y+c.H+b-1);h=g[0];i=g[1];return[e,f,h,i];};U.prototype.BoundsToSpace=function(a,b){return this.$val.BoundsToSpace(a,b);};U.ptr.prototype.SharesCells=function(a){var a,b,c,d,e;b=this;c=b.TouchingCells;d=c.StFrameId;while(true){if(!(d>0;}return false;};U.prototype.SharesCells=function(a){return this.$val.SharesCells(a);};U.ptr.prototype.SharesCellsTags=function(a){var a,b,c,d,e;b=this;c=b.TouchingCells;d=c.StFrameId;while(true){if(!(d>0;}return false;};U.prototype.SharesCellsTags=function(a){return this.$val.SharesCellsTags(a);};U.ptr.prototype.Center=function(){var a;a=this;return[a.X+(a.W/2),a.Y+(a.H/2)];};U.prototype.Center=function(){return this.$val.Center();};U.ptr.prototype.SetCenter=function(a,b){var a,b,c;c=this;c.X=a-(c.W/2);c.Y=b-(c.H/2);};U.prototype.SetCenter=function(a,b){return this.$val.SetCenter(a,b);};U.ptr.prototype.CellPosition=function(){var a,b;a=this;b=a.Center();return a.Space.WorldToSpace(b[0],b[1]);};U.prototype.CellPosition=function(){return this.$val.CellPosition();};U.ptr.prototype.SetRight=function(a){var a,b;b=this;b.X=a-b.W;};U.prototype.SetRight=function(a){return this.$val.SetRight(a);};U.ptr.prototype.SetBottom=function(a){var a,b;b=this;b.Y=a-b.H;};U.prototype.SetBottom=function(a){return this.$val.SetBottom(a);};U.ptr.prototype.Bottom=function(){var a;a=this;return a.Y+a.H;};U.prototype.Bottom=function(){return this.$val.Bottom();};U.ptr.prototype.Right=function(){var a;a=this;return a.X+a.W;};U.prototype.Right=function(){return this.$val.Right();};U.ptr.prototype.SetBounds=function(a,b){var a,b,c;c=this;c.X=(0>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+0]);c.Y=(1>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+1]);c.W=(0>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+0])-c.X;c.H=(1>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+1])-c.Y;};U.prototype.SetBounds=function(a,b){return this.$val.SetBounds(a,b);};U.ptr.prototype.CheckAllWithHolder=function(a,b,c){var a,aa,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;d=this;if(d.Space===AE.nil){return false;}c.Clear();c.checkingObject=d;if(a<0){a=A.Min(a,-1);}else if(a>0){a=A.Max(a,1);}if(b<0){b=A.Min(b,-1);}else if(b>0){b=A.Max(b,1);}c.dx=a;c.dy=b;e=d.BoundsToSpace(a,b);f=e[0];g=e[1];h=e[2];i=e[3];j=$makeMap(AF.keyFor,[]);k=$makeMap(AB.keyFor,[]);l=g;while(true){if(!(l<=i)){break;}m=f;while(true){if(!(m<=h)){break;}n=d.Space.Cell(m,l);if(!(n===AB.nil)){o=n.Objects;p=o.StFrameId;while(true){if(!(p>0;continue;}t=(u=j[AF.keyFor(q)],u!==undefined?[u.v,true]:[false,false]);v=t[1];if(!v){c.Objects.Put(q);w=q;(j||$throwRuntimeError("assignment to entry in nil map"))[AF.keyFor(w)]={k:w,v:true};x=(y=k[AB.keyFor(n)],y!==undefined?[y.v,true]:[false,false]);z=x[1];if(!z){c.Cells.Put(n);aa=n;(k||$throwRuntimeError("assignment to entry in nil map"))[AB.keyFor(aa)]={k:aa,v:true};}p=p+(1)>>0;continue;}p=p+(1)>>0;}}m=m+(1)>>0;}l=l+(1)>>0;}if(0>=c.Objects.Cnt){return false;}return true;};U.prototype.CheckAllWithHolder=function(a,b,c){return this.$val.CheckAllWithHolder(a,b,c);};U.ptr.prototype.Overlaps=function(a){var a,b;b=this;return a.X<=b.X+b.W&&a.X+a.W>=b.X&&a.Y<=b.Y+b.H&&a.Y+a.H>=b.Y;};U.prototype.Overlaps=function(a){return this.$val.Overlaps(a);};U.ptr.prototype.AddToIgnoreList=function(a){var a,b,c;b=this;c=a;(b.ignoreList||$throwRuntimeError("assignment to entry in nil map"))[AF.keyFor(c)]={k:c,v:true};};U.prototype.AddToIgnoreList=function(a){return this.$val.AddToIgnoreList(a);};U.ptr.prototype.RemoveFromIgnoreList=function(a){var a,b;b=this;delete b.ignoreList[AF.keyFor(a)];};U.prototype.RemoveFromIgnoreList=function(a){return this.$val.RemoveFromIgnoreList(a);};Y=function(){var a;a=new X.ptr(AF.nil,0,0,AH.nil,AH.nil);a.Objects=T(16);a.Cells=T(16);return a;};$pkg.NewCollision=Y;X.ptr.prototype.Clear=function(){var a;a=this;a.checkingObject=AF.nil;a.dx=0;a.dy=0;a.Objects.Clear();a.Cells.Clear();};X.prototype.Clear=function(){return this.$val.Clear();};X.ptr.prototype.PopFirstCollidedObject=function(){var a;a=this;if(0>=a.Objects.Cnt){return AF.nil;}return $assertType(a.Objects.Pop(),AF);};X.prototype.PopFirstCollidedObject=function(){return this.$val.PopFirstCollidedObject();};X.ptr.prototype.HasTags=function(a){var a,b,c,d,e;b=this;c=b.Objects;d=c.StFrameId;while(true){if(!(d>0;continue;}if(e.HasTags(a)){return true;}d=d+(1)>>0;}return false;};X.prototype.HasTags=function(a){return this.$val.HasTags(a);};X.ptr.prototype.ObjectsByTags=function(a){var a,b,c,d,e,f;b=this;c=new AG([]);d=b.Objects;e=d.StFrameId;while(true){if(!(e>0;continue;}if(f.HasTags(a)){c=$append(c,f);}e=e+(1)>>0;}return c;};X.prototype.ObjectsByTags=function(a){return this.$val.ObjectsByTags(a);};X.ptr.prototype.ContactWithObject=function(a){var a,b,c;b=this;c=new B([0,0]);if(b.dx<0){(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0]=a.X+a.W-b.checkingObject.X);}else if(b.dx>0){(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0]=a.X-b.checkingObject.W-b.checkingObject.X);}if(b.dy<0){(1>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+1]=a.Y+a.H-b.checkingObject.Y);}else if(b.dy>0){(1>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+1]=a.Y-b.checkingObject.H-b.checkingObject.Y);}return c;};X.prototype.ContactWithObject=function(a){return this.$val.ContactWithObject(a);};X.ptr.prototype.ContactWithCell=function(a){var a,b,c,d,e;b=this;c=new B([0,0]);d=(($imul(a.X,b.checkingObject.Space.CellWidth)));e=(($imul(a.Y,b.checkingObject.Space.CellHeight)));if(b.dx<0){(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0]=d+(b.checkingObject.Space.CellWidth)-b.checkingObject.X);}else if(b.dx>0){(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0]=d-b.checkingObject.W-b.checkingObject.X);}if(b.dy<0){(1>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+1]=e+(b.checkingObject.Space.CellHeight)-b.checkingObject.Y);}else if(b.dy>0){(1>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+1]=e-b.checkingObject.H-b.checkingObject.Y);}return c;};X.prototype.ContactWithCell=function(a){return this.$val.ContactWithCell(a);};X.ptr.prototype.SlideAgainstCell=function(a,b){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t;c=this;d=c.checkingObject.Space;e=$assertType(c.Cells.GetByFrameId(c.Cells.StFrameId),AB);f=d.SpaceToWorld(e.X,e.Y);g=f[0];h=f[1];i=(d.CellWidth)/2;j=(d.CellHeight)/2;g=g+(i);h=h+(j);k=c.checkingObject.Center();l=k[0];m=k[1];n=l-g;o=m-h;p=d.Cell(e.X-1>>0,e.Y);q=d.Cell(e.X+1>>0,e.Y);r=d.Cell(e.X,e.Y-1>>0);s=d.Cell(e.X,e.Y+1>>0);t=new B([0,0]);if(!((c.dy===0))){if(n>0&&(q===AB.nil||!q.ContainsTags(b))){(0>=t.$length?($throwRuntimeError("index out of range"),undefined):t.$array[t.$offset+0]=g+i-c.checkingObject.X);}else if(n<0&&(p===AB.nil||!p.ContainsTags(b))){(0>=t.$length?($throwRuntimeError("index out of range"),undefined):t.$array[t.$offset+0]=g-i-(c.checkingObject.X+c.checkingObject.W));}else{return B.nil;}}if(!((c.dx===0))){if(o>0&&(s===AB.nil||!s.ContainsTags(b))){(1>=t.$length?($throwRuntimeError("index out of range"),undefined):t.$array[t.$offset+1]=h+j-c.checkingObject.Y);}else if(o<0&&(r===AB.nil||!r.ContainsTags(b))){(1>=t.$length?($throwRuntimeError("index out of range"),undefined):t.$array[t.$offset+1]=h-j-(c.checkingObject.Y+c.checkingObject.H));}else{return B.nil;}}return t;};X.prototype.SlideAgainstCell=function(a,b){return this.$val.SlideAgainstCell(a,b);};AA=function(a,b){var a,b,c;c=new Z.ptr(0,0,AH.nil);c.X=a;c.Y=b;c.Objects=T(16);return c;};Z.ptr.prototype.register=function(a){var a,b;b=this;if(!b.Contains(a)){b.Objects.Put(a);}};Z.prototype.register=function(a){return this.$val.register(a);};Z.ptr.prototype.unregister=function(a){var a,b,c,d,e;b=this;c=b.Objects;d=c.StFrameId;while(true){if(!(d>0;}};Z.prototype.unregister=function(a){return this.$val.unregister(a);};Z.ptr.prototype.Contains=function(a){var a,b,c,d,e;b=this;c=b.Objects;d=c.StFrameId;while(true){if(!(d>0;}return false;};Z.prototype.Contains=function(a){return this.$val.Contains(a);};Z.ptr.prototype.ContainsTags=function(a){var a,b,c,d,e;b=this;c=b.Objects;d=c.StFrameId;while(true){if(!(d>0;}return false;};Z.prototype.ContainsTags=function(a){return this.$val.ContainsTags(a);};Z.ptr.prototype.Occupied=function(){var a;a=this;return 0>0)))],f!==undefined?[f.v,true]:[BS.nil,false]);g=e[0];h=e[1];if(h){i=(j=g.Hits,k=b.ActiveSkillHit,((k<0||k>=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+k]));if($assertType(i,BT,true)[1]){l=i.$val;if(l.Bullet.CancellableStFrame<=b.FramesInChState&&b.FramesInChState>0)))],r!==undefined?[r.v,true]:[BS.nil,false]);s=q[0];t=q[1];if(t){u=(v=s.Hits,w=b.ActiveSkillHit,((w<0||w>=v.$length)?($throwRuntimeError("index out of range"),undefined):v.$array[v.$offset+w]));if($assertType(u,BT,true)[1]){x=u.$val;if(x.Bullet.CancellableStFrame<=b.FramesInChState&&b.FramesInChState>0)))],ad!==undefined?[ad.v,true]:[BS.nil,false]);ae=ac[0];af=ac[1];if(af){ag=(ah=ae.Hits,ai=b.ActiveSkillHit,((ai<0||ai>=ah.$length)?($throwRuntimeError("index out of range"),undefined):ah.$array[ah.$offset+ai]));if($assertType(ag,BT,true)[1]){aj=ag.$val;if(aj.Bullet.CancellableStFrame<=b.FramesInChState&&b.FramesInChState>0))>>2>>0);};$pkg.ConvertToDelayedInputFrameId=AC;AD=function(a){var a;return(a>>2>>0);};$pkg.ConvertToNoDelayInputFrameId=AD;AE=function(a){var a;return(((a<<2>>0))+4>>0);};$pkg.ConvertToFirstUsedRenderFrameId=AE;AF=function(a){var a;return(((((a<<2>>0))+4>>0)+4>>0)-1>>0);};$pkg.ConvertToLastUsedRenderFrameId=AF;AG=function(a){var a,b,c,d,e,f,g,h;b=new $Uint64(a.$high&0,(a.$low&15)>>>0);d=(((c=$shiftRightUint64(a,4),new $Uint64(c.$high&0,(c.$low&1)>>>0)).$low>>0));f=(((e=$shiftRightUint64(a,5),new $Uint64(e.$high&0,(e.$low&1)>>>0)).$low>>0));return new G.ptr((g=(($flatten64(b)<0||$flatten64(b)>=$pkg.DIRECTION_DECODER.$length)?($throwRuntimeError("index out of range"),undefined):$pkg.DIRECTION_DECODER.$array[$pkg.DIRECTION_DECODER.$offset+$flatten64(b)]),(0>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+0])),(h=(($flatten64(b)<0||$flatten64(b)>=$pkg.DIRECTION_DECODER.$length)?($throwRuntimeError("index out of range"),undefined):$pkg.DIRECTION_DECODER.$array[$pkg.DIRECTION_DECODER.$offset+$flatten64(b)]),(1>=h.$length?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+1])),d,f);};AI=function(a,b,c,d){var{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,$s,$deferred,$r,$c}=$restore(this,{a,b,c,d});$s=$s||0;var $err=null;try{s:while(true){switch($s){case 0:$deferred=[];$curGoroutine.deferStack.push($deferred);c=[c];e=[e];f=[f];g=c[0].Position();e[0]=g[0];f[0]=g[1];$deferred.push([(function(c,e,f){return function(){c[0].SetPosition(e[0],f[0]);};})(c,e,f),[]]);c[0].SetPosition(e[0]+a,f[0]+b);h=new AH.ptr(0,0,0,true,true,new B.Vector([0,0]));i=AJ(c[0],d,h);if(i){$s=1;continue;}$s=2;continue;case 1:j=h.Overlap*h.OverlapX;k=h.Overlap*h.OverlapY;l=j;m=k;n=[true,l,m,h];$s=4;case 4:return n;case 2:o=[false,0,0,h];$s=5;case 5:return o;case 3:$s=-1;return[false,0,0,BU.nil];}return;}}catch(err){$err=err;$s=-1;return[false,0,0,BU.nil];}finally{$callDeferred($deferred,$err);if($curGoroutine.asleep){var $f={$blk:AI,$c:true,$r,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,$s,$deferred};return $f;}}};AJ=function(a,b,c){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y;d=a.Points.Cnt;e=b.Points.Cnt;f=d;g=e;if((1===f)&&(1===g)){if(!(BU.nil===c)){c.Overlap=0;}h=a.GetPointByOffset(0);i=b.GetPointByOffset(0);return((0>=h.$length?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+0])===(0>=i.$length?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+0]))&&((1>=h.$length?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+1])===(1>=i.$length?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+1]));}if(1>0)))){n=a.GetPointByOffset(j+1>>0);}o=(1>=n.$length?($throwRuntimeError("index out of range"),undefined):n.$array[n.$offset+1])-(1>=m.$length?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+1]);p=(0>=n.$length?($throwRuntimeError("index out of range"),undefined):n.$array[n.$offset+0])-(0>=m.$length?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+0]);q=new B.Vector([o,-p]).Unit();if(AP(a,b,q,c)){return false;}j=j+(1)>>0;}}if(1>0)))){v=b.GetPointByOffset(r+1>>0);}w=(1>=v.$length?($throwRuntimeError("index out of range"),undefined):v.$array[v.$offset+1])-(1>=u.$length?($throwRuntimeError("index out of range"),undefined):u.$array[u.$offset+1]);x=(0>=v.$length?($throwRuntimeError("index out of range"),undefined):v.$array[v.$offset+0])-(0>=u.$length?($throwRuntimeError("index out of range"),undefined):u.$array[u.$offset+0]);y=new B.Vector([w,-x]).Unit();if(AP(a,b,y,c)){return false;}r=r+(1)>>0;}}return true;};AK=function(a,b,c,d,e){var a,b,c,d,e;if(2===a){return false;}return((b+c>>0)>0)+d>>0)>e);};$pkg.IsGeneralBulletActive=AK;AL=function(a,b){var a,b;return AK(a.BlState,a.BattleAttr.OriginatedRenderFrameId,a.Bullet.StartupFrames,a.Bullet.ActiveFrames,b.Id);};$pkg.IsMeleeBulletActive=AL;AM=function(a,b){var a,b;if(2===a.BlState){return a.FramesInBlState>0)+a.Bullet.ActiveFrames>>0)>b.Id;};$pkg.IsMeleeBulletAlive=AM;AN=function(a,b){var a,b;return AK(a.BlState,a.BattleAttr.OriginatedRenderFrameId,a.Bullet.StartupFrames,a.Bullet.ActiveFrames,b.Id);};$pkg.IsFireballBulletActive=AN;AO=function(a,b){var a,b;if(2===a.BlState){return a.FramesInBlState>0)+a.Bullet.ActiveFrames>>0)>b.Id;};$pkg.IsFireballBulletAlive=AO;AP=function(a,b,c,d){var a,aa,ab,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;e=1.7e+308;f=-1.7e+308;g=1.7e+308;h=-1.7e+308;i=e;j=f;k=g;l=h;m=0;while(true){if(!(m=n.$length?($throwRuntimeError("index out of range"),undefined):n.$array[n.$offset+0])+a.X)*(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0])+((1>=n.$length?($throwRuntimeError("index out of range"),undefined):n.$array[n.$offset+1])+a.Y)*(1>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+1]);if(i>o){i=o;}if(j>0;}p=0;while(true){if(!(p=q.$length?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+0])+b.X)*(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0])+((1>=q.$length?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+1])+b.Y)*(1>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+1]);if(k>r){k=r;}if(l>0;}if(i>l||jl){s=i-l;d.AContainedInB=false;}else{v=j-k;w=l-i;if(v=z.$length?($throwRuntimeError("index out of range"),undefined):z.$array[z.$offset+0])))&&(0===(aa=d.Axis,(1>=aa.$length?($throwRuntimeError("index out of range"),undefined):aa.$array[aa.$offset+1]))))||x>y){ab=1;if(s<0){ab=-1;}d.Overlap=y;d.OverlapX=(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0])*ab;d.OverlapY=(1>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+1])*ab;}d.Axis=c;}return false;};AQ=function(a,b){var a,b,c,d;c=((A.Round(a*10)>>0));d=((A.Round(b*10)>>0));return[c,d];};$pkg.WorldToVirtualGridPos=AQ;AR=function(a,b){var a,b,c,d;c=(a)*0.1;d=(b)*0.1;return[c,d];};$pkg.VirtualGridToWorldPos=AR;AS=function(a,b,c,d,e,f,g,h,i,j){var a,b,c,d,e,f,g,h,i,j;return[a-c-g+i,b-d-f+j];};$pkg.WorldToPolygonColliderBLPos=AS;AT=function(a,b,c,d,e,f,g,h,i,j){var a,b,c,d,e,f,g,h,i,j;return[a+c+g-i,b+d+f-j];};$pkg.PolygonColliderBLToWorldPos=AT;AU=function(a,b,c,d,e,f,g,h,i,j){var a,b,c,d,e,f,g,h,i,j,k,l,m;k=AT(a,b,c,d,e,f,g,h,i,j);l=k[0];m=k[1];return AQ(l,m);};$pkg.PolygonColliderBLToVirtualGridPos=AU;AW=function(a,b,c,d,e,f,g,h,i){var{a,aa,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,$s,$r,$c}=$restore(this,{a,b,c,d,e,f,g,h,i});$s=$s||0;s:while(true){switch($s){case 0:j=0;if((16===b.CharacterState)&&(0===c.VelX)&&(b.DirX===c.DirX)){k=1;if(0>c.DirX){k=-k;}j=k*(b.Speed)*0.1;}l=0;m=d.CheckAllWithHolder(j,0,i);if(!m){$s=-1;return l;}case 1:n=i.PopFirstCollidedObject();if(BV.nil===n){$s=2;continue;}o=false;p=n.Data;if($assertType(p,BW,true)[1]||$assertType(p,BT,true)[1]||$assertType(p,BX,true)[1]){}else{o=true;}if(!o){$s=1;continue;}q=$assertType(n.Shape,BY);s=AI(0,0,e,q);$s=3;case 3:if($c){$c=false;s=s.$blk();}if(s&&s.$blk!==undefined){break s;}r=s;t=r[0];u=r[1];v=r[2];w=r[3];if(!t){$s=1;continue;}x=(w.Overlap-f)*w.OverlapX;y=(w.Overlap-f)*w.OverlapY;u=x;v=y;z=w.OverlapX;aa=w.OverlapY;((l<0||l>=h.$length)?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+l]).X=z;((l<0||l>=h.$length)?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+l]).Y=aa;g.X=g.X+(u);g.Y=g.Y+(v);l=l+(1)>>0;$s=1;continue;case 2:$s=-1;return l;}return;}var $f={$blk:AW,$c:true,$r,a,aa,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,$s};return $f;};AX=function(a,b,c,d,e,f,g){var a,b,c,d,e,f,g,h,i,j,k,l,m,n;h=false;i=0;while(true){if(!(i>0)>>0))===g){i=i+(1)>>0;continue;}if((j=(k=$shiftLeft64(new $Uint64(0,1),((i>>>0))),new $Uint64(c.$high&k.$high,(c.$low&k.$low)>>>0)),(0>0;continue;}if(((i<0||i>=e.$length)?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+i])>=a){i=i+(1)>>0;continue;}m=(l=((i<0||i>=f.$length)?($throwRuntimeError("index out of range"),undefined):f.$array[f.$offset+i]),new $Uint64(l.$high&0,(l.$low&15)>>>0));if(!((n=((i<0||i>=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+i]),(m.$high===n.$high&&m.$low===n.$low)))){((i<0||i>=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+i]=m);h=true;}i=i+(1)>>0;}return h;};$pkg.UpdateInputFrameInPlaceUponDynamics=AX;AY=function(a,b,c,d,e){var a,aa,ab,ac,ad,ae,af,ag,ah,ai,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;f=AC(c.Id);g=AC(c.Id-1>>0);if(0>=f){return[-2,false,0,0];}h=(i=W[$Int32.keyFor(a.CharacterState)],i!==undefined?[i.v,true]:[false,false]);j=h[1];if(j){return[-2,false,0,0];}k=$assertType(e.GetByFrameId(f),BZ);l=k.InputList;m=CA.nil;if(0>0,((q<0||q>=l.$length)?($throwRuntimeError("index out of range"),undefined):l.$array[l.$offset+q])));s=0;t=0;u=s;v=t;w=0;x=0;y=w;z=x;if(!(CA.nil===m)){ab=AG((aa=p-1>>0,((aa<0||aa>=m.$length)?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+aa])));y=ab.BtnALevel;z=ab.BtnBLevel;}if(0===a.FramesToRecover){ac=r.Dx;ad=r.Dy;u=ac;v=ad;}ae=-1;af=a.CapturedByInertia&&(((d.InertiaFramesToRecover>>1>>0))>a.FramesToRecover);if((0===a.FramesToRecover)||af){if(r.BtnBLevel>z){if(d.DashingEnabled&&0>r.Dy&&!((15===a.CharacterState))){ae=5;}else{ag=(ah=V[$Int32.keyFor(a.CharacterState)],ah!==undefined?[ah.v,true]:[false,false]);ai=ag[1];if(!ai){o=true;}else if(16===a.CharacterState){o=true;}}}}if(-1===ae){if(0y){if(0>r.Dy){ae=3;}else if(0>0;u=s.PlayersArr.$length;v=CB.nil;w=h.GetByFrameId(t);if($interfaceIsEqual($ifaceNil,w)){if(t===h.EdFrameId){h.DryPut();w=h.GetByFrameId(t);if($interfaceIsEqual($ifaceNil,w)){v=BM(u,64,64);h.SetByFrameId(v,t);}else{v=$assertType(w,CB);}}else{$panic(new $String("Invalid nextRenderFrameId="+($encodeRune(t))+"!"));}}else{v=$assertType(w,CB);}x=v.PlayersArr;y=s.PlayersArr;z=0;while(true){if(!(z=y.$length)?($throwRuntimeError("index out of range"),undefined):y.$array[y.$offset+z]);ac=ab.FramesToRecover-1>>0;ad=ab.FramesInChState+1>>0;ae=ab.FramesInvinsible-1>>0;if(ac<0){ac=0;}if(ae<0){ae=0;}BK(ab.Id,ab.VirtualGridX,ab.VirtualGridY,ab.DirX,ab.DirY,ab.VelX,ab.VelY,ac,ad,ab.ActiveSkillId,ab.ActiveSkillHit,ae,ab.Speed,ab.BattleState,ab.CharacterState,ab.JoinIndex,ab.Hp,ab.MaxHp,ab.ColliderRadius,true,false,ab.OnWallNormX,ab.OnWallNormY,ab.CapturedByInertia,ab.BulletTeamId,ab.ChCollisionTeamId,ab.RevivalVirtualGridX,ab.RevivalVirtualGridY,((aa<0||aa>=x.$length)?($throwRuntimeError("index out of range"),undefined):x.$array[x.$offset+aa]));z++;}af=0;ag=v.MeleeBullets;ah=0;ai=v.FireballBullets;aj=s.BulletLocalIdCounter;ak=AC(s.Id);if(0=ao.$length)?($throwRuntimeError("index out of range"),undefined):ao.$array[ao.$offset+ap]);as=((aq<0||aq>=g.$length)?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+aq]);at=((aq<0||aq>=x.$length)?($throwRuntimeError("index out of range"),undefined):x.$array[x.$offset+aq]);au=AY(ar,at,s,as,a);av=au[0];aw=au[1];ax=au[2];ay=au[3];((aq<0||aq>=l.$length)?($throwRuntimeError("index out of range"),undefined):l.$array[l.$offset+aq]=aw);az=ar.JoinIndex;ba=as.SkillMapper(av,ar,as.SpeciesId);$s=3;case 3:if($c){$c=false;ba=ba.$blk();}if(ba&&ba.$blk!==undefined){break s;}bb=ba;bc=(bd=U[$Int.keyFor(bb)],bd!==undefined?[bd.v,true]:[BS.nil,false]);be=bc[0];bf=bc[1];if(bf){at.ActiveSkillId=((bb>>0));at.ActiveSkillHit=0;at.FramesToRecover=be.RecoveryFrames;bg=1;if(0>at.DirX){bg=-bg;}bh=false;bi=(bj=be.Hits,bk=at.ActiveSkillHit,((bk<0||bk>=bj.$length)?($throwRuntimeError("index out of range"),undefined):bj.$array[bj.$offset+bk]));if($assertType(bi,BT,true)[1]){bl=bi.$val;BI(0,0,aj,b,az,ar.BulletTeamId,bl.Bullet,((af<0||af>=ag.$length)?($throwRuntimeError("index out of range"),undefined):ag.$array[ag.$offset+af]));aj=aj+(1)>>0;af=af+(1)>>0;if(!((-1===bl.Bullet.SelfLockVelX))){bh=true;at.VelX=$imul(bg,bl.Bullet.SelfLockVelX);}if(!((-1===bl.Bullet.SelfLockVelY))){bh=true;at.VelY=bl.Bullet.SelfLockVelY;}}else if($assertType(bi,BX,true)[1]){bm=bi.$val;BJ(0,0,ar.VirtualGridX+($imul(bg,bm.Bullet.HitboxOffsetX))>>0,ar.VirtualGridY+bm.Bullet.HitboxOffsetY>>0,bg,0,$imul(bm.Speed,bg),0,bm.Speed,aj,b,az,ar.BulletTeamId,bm.Bullet,((ah<0||ah>=ai.$length)?($throwRuntimeError("index out of range"),undefined):ai.$array[ai.$offset+ah]));aj=aj+(1)>>0;ah=ah+(1)>>0;if(!((-1===bm.Bullet.SelfLockVelX))){bh=true;at.VelX=$imul(bg,bm.Bullet.SelfLockVelX);}if(!((-1===bm.Bullet.SelfLockVelY))){bh=true;at.VelY=bm.Bullet.SelfLockVelY;}}if(false===bh&&false===ar.InAir){at.VelX=0;}at.CharacterState=be.BoundChState;ap++;$s=1;continue;}if(0===ar.FramesToRecover){bn=ar.CapturedByInertia;bo=as.OnWallEnabled&&(as.WallJumpingInitVelX===Z(ar.VelX));bp=true;bq=false;br=false;if(!((0===ax))&&(0===at.VelX)){bp=false;}else if((0===ax)&&!((0===at.VelX))){bp=false;br=true;}else if(0>($imul(ax,at.VelX))){bp=false;bq=true;}if(!aw&&!bo&&!bn&&!bp){at.CapturedByInertia=true;if(bq){at.CharacterState=17;at.FramesToRecover=as.InertiaFramesToRecover;}else if(br){at.FramesToRecover=as.InertiaFramesToRecover;}else{at.CharacterState=1;at.FramesToRecover=(as.InertiaFramesToRecover>>1>>0);}}else{at.CapturedByInertia=false;if(!((0===ax))){bs=1;if(0>ax){bs=-bs;}at.DirX=ax;at.DirY=ay;if(bo){at.VelX=$imul(bs,Z(ar.VelX));}else{at.VelX=$imul(bs,ar.Speed);}at.CharacterState=1;}else{at.CharacterState=0;at.VelX=0;}}}ap++;$s=1;continue;case 2:bt=0;bu=s.PlayersArr;bv=0;case 4:if(!(bv=bu.$length)?($throwRuntimeError("index out of range"),undefined):bu.$array[bu.$offset+bv]);by=bx.JoinIndex;bz=0;ca=0;(cb=by-1>>0,((cb<0||cb>=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+cb])).X=bz;(cc=by-1>>0,((cc<0||cc>=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+cc])).Y=ca;cd=((bw<0||bw>=x.$length)?($throwRuntimeError("index out of range"),undefined):x.$array[x.$offset+bw]);ce=((bw<0||bw>=g.$length)?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+bw]);cf=bx.VirtualGridX+bx.VelX>>0;cg=bx.VirtualGridY+bx.VelY>>0;ch=cf;ci=cg;if(0>=cd.Hp&&(0===cd.FramesToRecover)){cj=bx.RevivalVirtualGridX;ck=bx.RevivalVirtualGridY;ch=cj;ci=ck;cd.CharacterState=10;cd.FramesInChState=10;cd.FramesToRecover=ce.GetUpFramesToRecover;cd.FramesInvinsible=ce.GetUpInvinsibleFrames;cd.Hp=bx.MaxHp;if(0===((cl=cd.JoinIndex%2,cl===cl?cl:$throwRuntimeError("integer divide by zero")))){cd.DirX=-2;cd.DirY=0;}else{cd.DirX=2;cd.DirY=0;}}if(((bw<0||bw>=l.$length)?($throwRuntimeError("index out of range"),undefined):l.$array[l.$offset+bw])){if(16===bx.CharacterState){if(0<($imul(bx.VelX,bx.OnWallNormX))){ch=ch-(bx.VelX)>>0;}cm=-1;if(0>bx.OnWallNormX){cm=-cm;}ch=ch+(($imul(cm,ce.WallJumpingInitVelX)))>>0;ci=ci+(ce.WallJumpingInitVelY)>>0;cd.VelX=(($imul(cm,ce.WallJumpingInitVelX)));cd.VelY=(ce.WallJumpingInitVelY);cd.FramesToRecover=ce.WallJumpingFramesToRecover;}else{cd.VelY=(ce.JumpingInitVelY);ci=ci+(ce.JumpingInitVelY)>>0;}}cn=AR(ch,ci);co=cn[0];cp=cn[1];cq=$imul(bx.ColliderRadius,2);cr=$imul(bx.ColliderRadius,4);cs=cq;ct=cr;cu=bx.CharacterState;if(cu===(9)){cv=$imul(bx.ColliderRadius,4);cw=$imul(bx.ColliderRadius,2);cs=cv;ct=cw;}else if((cu===(8))||(cu===(4))||(cu===(5))||(cu===(16))){cx=$imul(bx.ColliderRadius,2);cy=$imul(bx.ColliderRadius,2);cs=cx;ct=cy;}cz=AR(cs,ct);da=cz[0];db=cz[1];dc=((bt<0||bt>=m.$length)?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+bt]);BC(dc,co,cp,da,db,0.1,0.1,0.1,0.1,e,f,bx,"Player");bt=bt+(1)>>0;$r=c.AddSingle(dc);$s=6;case 6:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}if(bx.InAir){if((16===bx.CharacterState)&&!((bw<0||bw>=l.$length)?($throwRuntimeError("index out of range"),undefined):l.$array[l.$offset+bw])){cd.VelX=cd.VelX+(0)>>0;cd.VelY=ce.WallSlidingVelY;}else if(15===bx.CharacterState){cd.VelX=cd.VelX+(0)>>0;}else{cd.VelX=cd.VelX+(0)>>0;cd.VelY=cd.VelY+(-5)>>0;}}bv++;$s=4;continue;case 5:dd=s.FireballBullets;de=0;case 7:if(!(de=dd.$length)?($throwRuntimeError("index out of range"),undefined):dd.$array[dd.$offset+de]);if(-1===df.BattleAttr.BulletLocalId){$s=8;continue;}dg=((ah<0||ah>=ai.$length)?($throwRuntimeError("index out of range"),undefined):ai.$array[ai.$offset+ah]);BJ(df.BlState,df.FramesInBlState+1>>0,df.VirtualGridX,df.VirtualGridY,df.DirX,df.DirY,df.VelX,df.VelY,df.Speed,df.BattleAttr.BulletLocalId,df.BattleAttr.OriginatedRenderFrameId,df.BattleAttr.OffenderJoinIndex,df.BattleAttr.TeamId,df.Bullet,dg);if(AO(dg,s)){$s=9;continue;}$s=10;continue;case 9:if(AN(dg,s)){$s=11;continue;}$s=12;continue;case 11:dh=AR(dg.VirtualGridX,dg.VirtualGridY);di=dh[0];dj=dh[1];dk=AR(dg.Bullet.HitboxSizeX,dg.Bullet.HitboxSizeY);dl=dk[0];dm=dk[1];dn=((bt<0||bt>=m.$length)?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+bt]);BC(dn,di,dj,dl,dm,0.1,0.1,0.1,0.1,e,f,dg,"FireballBullet");bt=bt+(1)>>0;$r=c.AddSingle(dn);$s=14;case 14:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}dg.BlState=1;if(!((dg.BlState===df.BlState))){dg.FramesInBlState=0;}dp=dg.VirtualGridX+dg.VelX>>0;dq=dg.VirtualGridY+dg.VelY>>0;dg.VirtualGridX=dp;dg.VirtualGridY=dq;$s=13;continue;case 12:dt=(dr=s.PlayersArr,ds=dg.BattleAttr.OffenderJoinIndex-1>>0,((ds<0||ds>=dr.$length)?($throwRuntimeError("index out of range"),undefined):dr.$array[dr.$offset+ds]));du=(dv=W[$Int32.keyFor(dt.CharacterState)],dv!==undefined?[dv.v,true]:[false,false]);dw=du[1];if(dw){de++;$s=7;continue;}case 13:ah=ah+(1)>>0;case 10:de++;$s=7;continue;case 8:((ah<0||ah>=ai.$length)?($throwRuntimeError("index out of range"),undefined):ai.$array[ai.$offset+ah]).BattleAttr.BulletLocalId=-1;dx=s.MeleeBullets;dy=0;case 15:if(!(dy=dx.$length)?($throwRuntimeError("index out of range"),undefined):dx.$array[dx.$offset+dy]);if(-1===dz.BattleAttr.BulletLocalId){$s=16;continue;}ea=((af<0||af>=ag.$length)?($throwRuntimeError("index out of range"),undefined):ag.$array[ag.$offset+af]);BI(dz.BlState,dz.FramesInBlState+1>>0,dz.BattleAttr.BulletLocalId,dz.BattleAttr.OriginatedRenderFrameId,dz.BattleAttr.OffenderJoinIndex,dz.BattleAttr.TeamId,dz.Bullet,ea);if(AM(ea,s)){$s=17;continue;}$s=18;continue;case 17:ed=(eb=s.PlayersArr,ec=ea.BattleAttr.OffenderJoinIndex-1>>0,((ec<0||ec>=eb.$length)?($throwRuntimeError("index out of range"),undefined):eb.$array[eb.$offset+ec]));ee=(ef=W[$Int32.keyFor(ed.CharacterState)],ef!==undefined?[ef.v,true]:[false,false]);eg=ee[1];if(eg){dy++;$s=15;continue;}if(AL(ea,s)){$s=19;continue;}$s=20;continue;case 19:eh=1;if(0>ed.DirX){eh=-eh;}ei=AR(ed.VirtualGridX+($imul(eh,ea.Bullet.HitboxOffsetX))>>0,ed.VirtualGridY);ej=ei[0];ek=ei[1];el=AR(ea.Bullet.HitboxSizeX,ea.Bullet.HitboxSizeY);em=el[0];en=el[1];eo=((bt<0||bt>=m.$length)?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+bt]);BC(eo,ej,ek,em,en,0.1,0.1,0.1,0.1,e,f,ea,"MeleeBullet");bt=bt+(1)>>0;$r=c.AddSingle(eo);$s=21;case 21:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}ea.BlState=1;if(!((ea.BlState===dz.BlState))){ea.FramesInBlState=0;}case 20:af=af+(1)>>0;case 18:dy++;$s=15;continue;case 16:((af<0||af>=ag.$length)?($throwRuntimeError("index out of range"),undefined):ag.$array[ag.$offset+af]).BattleAttr.BulletLocalId=-1;ep=s.PlayersArr;eq=0;case 22:if(!(eq=ep.$length)?($throwRuntimeError("index out of range"),undefined):ep.$array[ep.$offset+eq]);et=es.JoinIndex;eu=((er<0||er>=m.$length)?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+er]);ev=$assertType(eu.Shape,BY);ew=((er<0||er>=x.$length)?($throwRuntimeError("index out of range"),undefined):x.$array[x.$offset+er]);ez=AW(et,es,ew,eu,ev,0.1,(ex=et-1>>0,((ex<0||ex>=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+ex])),(ey=et-1>>0,((ey<0||ey>=k.$length)?($throwRuntimeError("index out of range"),undefined):k.$array[k.$offset+ey])),i);$s=24;case 24:if($c){$c=false;ez=ez.$blk();}if(ez&&ez.$blk!==undefined){break s;}fa=ez;fb=((er<0||er>=g.$length)?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+er]);fc=false;fd=eu.CheckAllWithHolder(0,0,i);if(fd){$s=25;continue;}$s=26;continue;case 25:case 27:fe=i.PopFirstCollidedObject();if(BV.nil===fe){$s=28;continue;}ff=false;fg=false;fh=false;fi=ff;fj=fg;fk=fh;fl=fe.Data;if($assertType(fl,BW,true)[1]){fm=fl.$val;if(18===fm.CharacterState){$s=27;continue;}fj=true;}else if($assertType(fl,BT,true)[1]||$assertType(fl,BX,true)[1]){fn=fl;fk=true;}else{fo=fl;fi=true;}if(fk){$s=27;continue;}fp=$assertType(fe.Shape,BY);fr=AI(0,0,ev,fp);$s=29;case 29:if($c){$c=false;fr=fr.$blk();}if(fr&&fr.$blk!==undefined){break s;}fq=fr;fs=fq[0];ft=fq[1];fu=fq[2];fv=fq[3];if(!fs){$s=27;continue;}fw=fv.OverlapX*0+fv.OverlapY*-1;if(fj){fx=(fv.Overlap-0.2)*fv.OverlapX;fy=(fv.Overlap-0.2)*fv.OverlapY;ft=fx;fu=fy;}fz=0;while(true){if(!(fz>0,((gb<0||gb>=k.$length)?($throwRuntimeError("index out of range"),undefined):k.$array[k.$offset+gb])),((fz<0||fz>=ga.$length)?($throwRuntimeError("index out of range"),undefined):ga.$array[ga.$offset+fz]));gd=ft*gc.X+fu*gc.Y;if(fi||(fj&&0>gd)){ft=ft-(gd*gc.X);fu=fu-(gd*gc.Y);}fz=fz+(1)>>0;}ge=et-1>>0;((ge<0||ge>=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+ge]).X=((ge<0||ge>=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+ge]).X+(ft);gf=et-1>>0;((gf<0||gf>=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+gf]).Y=((gf<0||gf>=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+gf]).Y+(fu);if(0.5=es.VelY;if(gg){ew.VelY=0;ew.VelX=0;if(18===ew.CharacterState){}else if(8===ew.CharacterState){ew.CharacterState=9;ew.FramesToRecover=fb.LayDownFramesToRecover;}else{gh=es.CharacterState;if((gh===(8))||(gh===(4))||(gh===(5))||(gh===(16))){gi=0;gj=es.ColliderRadius;gk=gi;gl=gj;gm=AR(gk,gl);gn=gm[1];go=et-1>>0;((go<0||go>=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+go]).Y=((go<0||go>=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+go]).Y-(gn);}ew.CharacterState=0;ew.FramesToRecover=0;}}else{gp=(gq=Y[$Int32.keyFor(ew.CharacterState)],gq!==undefined?[gq.v,true]:[false,false]);gr=gp[1];if(gr){if(18===ew.CharacterState){ew.VelY=0;ew.VelX=0;}else if(9===ew.CharacterState){if(0===ew.FramesToRecover){ew.CharacterState=10;ew.FramesToRecover=fb.GetUpFramesToRecover;}}else if(10===ew.CharacterState){if(0===ew.FramesToRecover){ew.CharacterState=0;ew.FramesInvinsible=fb.GetUpInvinsibleFrames;}}}}}if(fb.OnWallEnabled){if(ew.InAir){gs=(gt=W[$Int32.keyFor(es.CharacterState)],gt!==undefined?[gt.v,true]:[false,false]);gu=gs[1];if(!gu){gv=0;while(true){if(!(gv>0,((gx<0||gx>=k.$length)?($throwRuntimeError("index out of range"),undefined):k.$array[k.$offset+gx])),((gv<0||gv>=gw.$length)?($throwRuntimeError("index out of range"),undefined):gw.$array[gw.$offset+gv]));gz=gy.X*1+gy.Y*0;ha=gy.X*-1+gy.Y*0;if(0.9>0));hc=((gy.Y>>0));ew.OnWallNormX=hb;ew.OnWallNormY=hc;break;}if(0.9>0));he=((gy.Y>>0));ew.OnWallNormX=hd;ew.OnWallNormY=he;break;}gv=gv+(1)>>0;}}}if(!ew.OnWall){hf=0;hg=0;ew.OnWallNormX=hf;ew.OnWallNormY=hg;}}eq++;$s=22;continue;case 23:hh=x.$length;case 30:if(!(hh=m.$length)?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+hh]);hj=hi.CheckAllWithHolder(0,0,i);if(!hj){hh=hh+(1)>>0;$s=30;continue;}hk=false;hl=false;hm=BR.nil;hn=BQ.nil;ho=hi.Data;if($assertType(ho,BT,true)[1]){hp=ho.$val;hm=hp.Bullet;hn=hp.BattleAttr;}else if($assertType(ho,BX,true)[1]){hq=ho.$val;hm=hq.Bullet;hn=hq.BattleAttr;}hr=$assertType(hi.Shape,BY);hu=(hs=s.PlayersArr,ht=hn.OffenderJoinIndex-1>>0,((ht<0||ht>=hs.$length)?($throwRuntimeError("index out of range"),undefined):hs.$array[hs.$offset+ht]));case 32:hv=i.PopFirstCollidedObject();if(BV.nil===hv){$s=33;continue;}hw=$assertType(hv.Shape,BY);hx=hv.Data;if($assertType(hx,BW,true)[1]){$s=34;continue;}$s=35;continue;case 34:hy=hx.$val;if(hn.OffenderJoinIndex===hy.JoinIndex){$s=32;continue;}ib=AI(0,0,hr,hw);$s=37;case 37:if($c){$c=false;ib=ib.$blk();}if(ib&&ib.$blk!==undefined){break s;}ia=ib;ic=ia[0];if(!ic){$s=32;continue;}id=(ie=X[$Int32.keyFor(hy.CharacterState)],ie!==undefined?[ie.v,true]:[false,false]);ig=id[1];if(ig){$s=32;continue;}if(0hu.DirX){ih=-ih;}ij=(ii=hy.JoinIndex-1>>0,((ii<0||ii>=x.$length)?($throwRuntimeError("index out of range"),undefined):x.$array[x.$offset+ii]));ij.Hp=ij.Hp-(hm.Damage)>>0;ik=$imul(ih,hm.PushbackVelX);il=hm.PushbackVelY;im=ik;io=il;ij.VelX=im;ij.VelY=io;if(0>=ij.Hp){ij.Hp=0;ij.CharacterState=18;ij.FramesToRecover=60;}else{if(hm.BlowUp){ij.CharacterState=8;}else{ij.CharacterState=3;}iq=(ip=hy.JoinIndex-1>>0,((ip<0||ip>=x.$length)?($throwRuntimeError("index out of range"),undefined):x.$array[x.$offset+ip])).FramesToRecover;if(hm.HitStunFrames>iq){ij.FramesToRecover=hm.HitStunFrames;}}$s=36;continue;case 35:hz=hx;hk=true;case 36:$s=32;continue;case 33:if(hk){ir=hi.Data;if($assertType(ir,BT,true)[1]){is=ir.$val;is.BlState=2;if(hl){is.FramesInBlState=0;}else{is.FramesInBlState=is.Bullet.ExplosionFrames+1>>0;}}else if($assertType(ir,BX,true)[1]){it=ir.$val;it.BlState=2;it.FramesInBlState=0;}}hh=hh+(1)>>0;$s=30;continue;case 31:iu=s.PlayersArr;iv=0;while(true){if(!(iv=iu.$length)?($throwRuntimeError("index out of range"),undefined):iu.$array[iu.$offset+iv]);iy=ix.JoinIndex;iz=((iw<0||iw>=m.$length)?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+iw]);ja=((iw<0||iw>=x.$length)?($throwRuntimeError("index out of range"),undefined):x.$array[x.$offset+iw]);jb=AU(iz.X-(jc=iy-1>>0,((jc<0||jc>=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+jc])).X,iz.Y-(jd=iy-1>>0,((jd<0||jd>=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+jd])).Y,iz.W*0.5,iz.H*0.5,0,0,0,0,e,f);ja.VirtualGridX=jb[0];ja.VirtualGridY=jb[1];if(ja.InAir){je=ja.CharacterState;jf=je;if((jf===(0))||(jf===(1))||(jf===(17))){if(((iw<0||iw>=l.$length)?($throwRuntimeError("index out of range"),undefined):l.$array[l.$offset+iw])||(5===ix.CharacterState)){ja.CharacterState=5;}else{ja.CharacterState=4;}}else if(jf===(2)){ja.CharacterState=6;}else if(jf===(3)){ja.CharacterState=7;}}if(ja.OnWall){jg=ja.CharacterState;if((jg===(1))||(jg===(5))||(jg===(4))){jh=(16===ix.CharacterState);ji=ix.OnWall&&12<=ja.FramesInChState;if(jh||ji){ja.CharacterState=16;}}}if(!((ja.CharacterState===ix.CharacterState))){ja.FramesInChState=0;}jj=(jk=Y[$Int32.keyFor(ja.CharacterState)],jk!==undefined?[jk.v,true]:[false,false]);jl=jj[1];if(jl){ja.ActiveSkillId=-1;ja.ActiveSkillHit=-1;}iv++;}jm=0;while(true){if(!(jm=m.$length)?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+jm]);jn.Space.RemoveSingle(jn);jm=jm+(1)>>0;}v.Id=t;v.BulletLocalIdCounter=aj;$s=-1;return r;}return;}var $f={$blk:AZ,$c:true,$r,a,aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,al,am,an,ao,ap,aq,ar,as,at,au,av,aw,ax,ay,az,b,ba,bb,bc,bd,be,bf,bg,bh,bi,bj,bk,bl,bm,bn,bo,bp,bq,br,bs,bt,bu,bv,bw,bx,by,bz,c,ca,cb,cc,cd,ce,cf,cg,ch,ci,cj,ck,cl,cm,cn,co,cp,cq,cr,cs,ct,cu,cv,cw,cx,cy,cz,d,da,db,dc,dd,de,df,dg,dh,di,dj,dk,dl,dm,dn,dp,dq,dr,ds,dt,du,dv,dw,dx,dy,dz,e,ea,eb,ec,ed,ee,ef,eg,eh,ei,ej,ek,el,em,en,eo,ep,eq,er,es,et,eu,ev,ew,ex,ey,ez,f,fa,fb,fc,fd,fe,ff,fg,fh,fi,fj,fk,fl,fm,fn,fo,fp,fq,fr,fs,ft,fu,fv,fw,fx,fy,fz,g,ga,gb,gc,gd,ge,gf,gg,gh,gi,gj,gk,gl,gm,gn,go,gp,gq,gr,gs,gt,gu,gv,gw,gx,gy,gz,h,ha,hb,hc,hd,he,hf,hg,hh,hi,hj,hk,hl,hm,hn,ho,hp,hq,hr,hs,ht,hu,hv,hw,hx,hy,hz,i,ia,ib,ic,id,ie,ig,ih,ii,ij,ik,il,im,io,ip,iq,ir,is,it,iu,iv,iw,ix,iy,iz,j,ja,jb,jc,jd,je,jf,jg,jh,ji,jj,jk,jl,jm,jn,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,$s};return $f;};$pkg.ApplyInputFrameDownsyncDynamicsOnSingleRenderFrame=AZ;BA=function(a,b,c,d,e,f,g,h,i,j,k,l){var{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,$s,$r,$c}=$restore(this,{a,b,c,d,e,f,g,h,i,j,k,l});$s=$s||0;s:while(true){switch($s){case 0:m=AS(a,b,c*0.5,d*0.5,e,f,g,h,i,j);n=m[0];o=m[1];p=BB(n,o,g+c+h,f+d+e,k,l);$s=1;case 1:if($c){$c=false;p=p.$blk();}if(p&&p.$blk!==undefined){break s;}q=p;$s=2;case 2:return q;}return;}var $f={$blk:BA,$c:true,$r,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,$s};return $f;};$pkg.GenerateRectCollider=BA;BB=function(a,b,c,d,e,f){var{a,b,c,d,e,f,g,h,$s,$r,$c}=$restore(this,{a,b,c,d,e,f});$s=$s||0;s:while(true){switch($s){case 0:g=B.NewObjectSingleTag(a,b,c,d,f);h=B.NewRectangle(0,0,c,d);$r=g.SetShape(h);$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}g.Data=e;$s=-1;return g;}return;}var $f={$blk:BB,$c:true,$r,a,b,c,d,e,f,g,h,$s};return $f;};BC=function(a,b,c,d,e,f,g,h,i,j,k,l,m){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y;n=AS(b,c,d*0.5,e*0.5,f,g,h,i,j,k);o=n[0];p=n[1];q=h+d+i;r=g+e+f;s=q;t=r;u=o;v=p;w=s;x=t;a.X=u;a.Y=v;a.W=w;a.H=x;y=$assertType(a.Shape,BY);y.UpdateAsRectangle(0,0,s,t);a.Data=l;};$pkg.UpdateRectCollider=BC;BD=function(a,b,c,d,e){var{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,$s,$r,$c}=$restore(this,{a,b,c,d,e});$s=$s||0;s:while(true){switch($s){case 0:f=BE(a);g=0;h=0;i=g;j=h;k=B.NewConvexPolygon(CC.nil);l=f.Points;m=0;while(true){if(!(m=l.$length)?($throwRuntimeError("index out of range"),undefined):l.$array[l.$offset+m]);p=f.Points;q=0;while(true){if(!(q=p.$length)?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+q]);if(n===r){q++;continue;}if(A.Abs(s.X-o.X)>i){i=A.Abs(s.X-o.X);}if(A.Abs(s.Y-o.Y)>j){j=A.Abs(s.Y-o.Y);}q++;}m++;}t=0;while(true){if(!(t=u.$length)?($throwRuntimeError("index out of range"),undefined):u.$array[u.$offset+t]));k.AddPoints(new CC([v.X,v.Y]));t=t+(1)>>0;}w=B.NewObject(f.Anchor.X+b,f.Anchor.Y+c,i,j,new CD([e]));$r=w.SetShape(k);$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}w.Data=d;$s=-1;return w;}return;}var $f={$blk:BD,$c:true,$r,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,$s};return $f;};$pkg.GenerateConvexPolygonCollider=BD;BE=function(a){var a,b,c,d,e,f,g,h,i,j,k;b=new D.ptr(1.7e+308,1.7e+308);c=a.Points;d=0;while(true){if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);if(e.X=g.$length)?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+h]);(k=f.Points,((i<0||i>=k.$length)?($throwRuntimeError("index out of range"),undefined):k.$array[k.$offset+i]=new D.ptr(j.X-b.X,j.Y-b.Y)));h++;}return f;};$pkg.AlignPolygon2DToBoundingBox=BE;BF=function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x;return new L.ptr(u,v,new K.ptr(a,b,c,t),new J.ptr(d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,w,x,false));};$pkg.NewMeleeBullet=BF;BG=function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,ab,ac,ad,ae){var a,aa,ab,ac,ad,ae,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;return new M.ptr(u,v,w,x,y,z,aa,ab,ac,new K.ptr(a,b,c,t),new J.ptr(d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,ad,ae,false));};$pkg.NewFireballBullet=BG;BH=function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,ab){var a,aa,ab,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;return new F.ptr(a,b,c,d,e,f,g,m,n,p,s,false,0,0,h,i,q,r,o,t,u,v,w,x,j,k,l,y,z,aa,ab);};$pkg.NewPlayerDownsync=BH;BI=function(a,b,c,d,e,f,g,h){var a,b,c,d,e,f,g,h;h.BlState=a;h.FramesInBlState=b;h.BattleAttr.BulletLocalId=c;h.BattleAttr.OriginatedRenderFrameId=d;h.BattleAttr.OffenderJoinIndex=e;h.BattleAttr.TeamId=f;h.Bullet=g;};$pkg.CloneMeleeBullet=BI;BJ=function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o;o.BlState=a;o.FramesInBlState=b;o.VirtualGridX=c;o.VirtualGridY=d;o.DirX=e;o.DirY=f;o.VelX=g;o.VelY=h;o.Speed=i;o.BattleAttr.BulletLocalId=j;o.BattleAttr.OriginatedRenderFrameId=k;o.BattleAttr.OffenderJoinIndex=l;o.BattleAttr.TeamId=m;o.Bullet=n;};$pkg.CloneFireballBullet=BJ;BK=function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,ab,ac){var a,aa,ab,ac,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;ac.Id=a;ac.VirtualGridX=b;ac.VirtualGridY=c;ac.DirX=d;ac.DirY=e;ac.VelX=f;ac.VelY=g;ac.FramesToRecover=h;ac.FramesInChState=i;ac.ActiveSkillId=j;ac.ActiveSkillHit=k;ac.FramesInvinsible=l;ac.Speed=m;ac.BattleState=n;ac.CharacterState=o;ac.JoinIndex=p;ac.Hp=q;ac.MaxHp=r;ac.ColliderRadius=s;ac.InAir=t;ac.OnWall=u;ac.OnWallNormX=v;ac.OnWallNormY=w;ac.CapturedByInertia=x;ac.BulletTeamId=y;ac.ChCollisionTeamId=z;ac.RevivalVirtualGridX=aa;ac.RevivalVirtualGridY=ab;};$pkg.ClonePlayerDownsync=BK;BL=function(a,b,c,d,e,f){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o;f.Id=a;f.BulletLocalIdCounter=c;g=0;while(true){if(!(g=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+g]);if(BW.nil===h||(-1===h.Id)){break;}BK(h.Id,h.VirtualGridX,h.VirtualGridY,h.DirX,h.DirY,h.VelX,h.VelY,h.FramesToRecover,h.FramesInChState,h.ActiveSkillId,h.ActiveSkillHit,h.FramesInvinsible,h.Speed,h.BattleState,h.CharacterState,h.JoinIndex,h.Hp,h.MaxHp,h.ColliderRadius,h.InAir,h.OnWall,h.OnWallNormX,h.OnWallNormY,h.CapturedByInertia,h.BulletTeamId,h.ChCollisionTeamId,h.RevivalVirtualGridX,h.RevivalVirtualGridY,(i=f.PlayersArr,((g<0||g>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+g])));g=g+(1)>>0;}j=0;while(true){if(!(j=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+j]);if(BT.nil===k||(-1===k.BattleAttr.BulletLocalId)){break;}BI(k.BlState,k.FramesInBlState,k.BattleAttr.BulletLocalId,k.BattleAttr.OriginatedRenderFrameId,k.BattleAttr.OffenderJoinIndex,k.BattleAttr.TeamId,k.Bullet,(l=f.MeleeBullets,((j<0||j>=l.$length)?($throwRuntimeError("index out of range"),undefined):l.$array[l.$offset+j])));j=j+(1)>>0;}m=0;while(true){if(!(m=e.$length)?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+m]);if(BX.nil===n||(-1===n.BattleAttr.BulletLocalId)){break;}BJ(n.BlState,n.FramesInBlState,n.VirtualGridX,n.VirtualGridY,n.DirX,n.DirY,n.VelX,n.VelY,n.Speed,n.BattleAttr.BulletLocalId,n.BattleAttr.OriginatedRenderFrameId,n.BattleAttr.OffenderJoinIndex,n.BattleAttr.TeamId,n.Bullet,(o=f.FireballBullets,((m<0||m>=o.$length)?($throwRuntimeError("index out of range"),undefined):o.$array[o.$offset+m])));m=m+(1)>>0;}};$pkg.CloneRoomDownsyncFrame=BL;BM=function(a,b,c){var a,b,c,d,e,f,g,h,i,j,k,l;d=$makeSlice(CG,a);e=0;while(true){if(!(e=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+e]=f);e=e+(1)>>0;}g=$makeSlice(CH,b);h=0;while(true){if(!(h=g.$length)?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+h]=i);h=h+(1)>>0;}j=$makeSlice(CI,c);k=0;while(true){if(!(k=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+k]=l);k=k+(1)>>0;}return new O.ptr(-1,d,new $Int64(0,0),g,j,new $Uint64(0,0),false,-1);};$pkg.NewPreallocatedRoomDownsyncFrame=BM;BW.methods=[{prop:"GetId",name:"GetId",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetJoinIndex",name:"GetJoinIndex",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetVirtualGridX",name:"GetVirtualGridX",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetVirtualGridY",name:"GetVirtualGridY",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetDirX",name:"GetDirX",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetDirY",name:"GetDirY",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetVelX",name:"GetVelX",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetVelY",name:"GetVelY",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetSpeed",name:"GetSpeed",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetHp",name:"GetHp",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetMaxHp",name:"GetMaxHp",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetCharacterState",name:"GetCharacterState",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetFramesToRecover",name:"GetFramesToRecover",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetFramesInChState",name:"GetFramesInChState",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetInAir",name:"GetInAir",pkg:"",typ:$funcType([],[$Bool],false)},{prop:"GetOnWall",name:"GetOnWall",pkg:"",typ:$funcType([],[$Bool],false)},{prop:"GetOnWallNormX",name:"GetOnWallNormX",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetColliderRadius",name:"GetColliderRadius",pkg:"",typ:$funcType([],[$Int32],false)}];BT.methods=[{prop:"GetBlState",name:"GetBlState",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetFramesInBlState",name:"GetFramesInBlState",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetBulletLocalId",name:"GetBulletLocalId",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetOffenderJoinIndex",name:"GetOffenderJoinIndex",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetOriginatedRenderFrameId",name:"GetOriginatedRenderFrameId",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetStartupFrames",name:"GetStartupFrames",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetActiveFrames",name:"GetActiveFrames",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetHitboxSizeX",name:"GetHitboxSizeX",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetHitboxSizeY",name:"GetHitboxSizeY",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetHitboxOffsetX",name:"GetHitboxOffsetX",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetHitboxOffsetY",name:"GetHitboxOffsetY",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetExplosionFrames",name:"GetExplosionFrames",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetSpeciesId",name:"GetSpeciesId",pkg:"",typ:$funcType([],[$Int32],false)}];BX.methods=[{prop:"GetVirtualGridX",name:"GetVirtualGridX",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetVirtualGridY",name:"GetVirtualGridY",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetDirX",name:"GetDirX",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetDirY",name:"GetDirY",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetVelX",name:"GetVelX",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetVelY",name:"GetVelY",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetSpeed",name:"GetSpeed",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetBlState",name:"GetBlState",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetFramesInBlState",name:"GetFramesInBlState",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetBulletLocalId",name:"GetBulletLocalId",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetOffenderJoinIndex",name:"GetOffenderJoinIndex",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetOriginatedRenderFrameId",name:"GetOriginatedRenderFrameId",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetStartupFrames",name:"GetStartupFrames",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetActiveFrames",name:"GetActiveFrames",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetHitboxSizeX",name:"GetHitboxSizeX",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetHitboxSizeY",name:"GetHitboxSizeY",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetHitboxOffsetX",name:"GetHitboxOffsetX",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetHitboxOffsetY",name:"GetHitboxOffsetY",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetExplosionFrames",name:"GetExplosionFrames",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetSpeciesId",name:"GetSpeciesId",pkg:"",typ:$funcType([],[$Int32],false)}];CB.methods=[{prop:"GetId",name:"GetId",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetCountdownNanos",name:"GetCountdownNanos",pkg:"",typ:$funcType([],[$Int64],false)},{prop:"GetBackendUnconfirmedMask",name:"GetBackendUnconfirmedMask",pkg:"",typ:$funcType([],[$Uint64],false)},{prop:"GetBulletLocalIdCounter",name:"GetBulletLocalIdCounter",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetShouldForceResync",name:"GetShouldForceResync",pkg:"",typ:$funcType([],[$Bool],false)},{prop:"GetPlayersArr",name:"GetPlayersArr",pkg:"",typ:$funcType([],[CG],false)},{prop:"GetMeleeBullets",name:"GetMeleeBullets",pkg:"",typ:$funcType([],[CH],false)},{prop:"GetFireballBullets",name:"GetFireballBullets",pkg:"",typ:$funcType([],[CI],false)}];BZ.methods=[{prop:"GetInputFrameId",name:"GetInputFrameId",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetInputList",name:"GetInputList",pkg:"",typ:$funcType([],[CA],false)},{prop:"GetConfirmedList",name:"GetConfirmedList",pkg:"",typ:$funcType([],[$Uint64],false)}];CL.methods=[{prop:"GetSpeed",name:"GetSpeed",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetSpeciesId",name:"GetSpeciesId",pkg:"",typ:$funcType([],[$Int],false)},{prop:"GetSpeciesName",name:"GetSpeciesName",pkg:"",typ:$funcType([],[$String],false)}];C.init([]);D.init("",[{prop:"X",name:"X",embedded:false,exported:true,typ:$Float64,tag:""},{prop:"Y",name:"Y",embedded:false,exported:true,typ:$Float64,tag:""}]);E.init("",[{prop:"Anchor",name:"Anchor",embedded:false,exported:true,typ:CE,tag:""},{prop:"Points",name:"Points",embedded:false,exported:true,typ:CF,tag:""}]);F.init("",[{prop:"Id",name:"Id",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"VirtualGridX",name:"VirtualGridX",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"VirtualGridY",name:"VirtualGridY",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"DirX",name:"DirX",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"DirY",name:"DirY",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"VelX",name:"VelX",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"VelY",name:"VelY",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"Speed",name:"Speed",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"BattleState",name:"BattleState",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"JoinIndex",name:"JoinIndex",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"ColliderRadius",name:"ColliderRadius",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"Removed",name:"Removed",embedded:false,exported:true,typ:$Bool,tag:""},{prop:"Score",name:"Score",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"LastMoveGmtMillis",name:"LastMoveGmtMillis",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"FramesToRecover",name:"FramesToRecover",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"FramesInChState",name:"FramesInChState",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"Hp",name:"Hp",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"MaxHp",name:"MaxHp",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"CharacterState",name:"CharacterState",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"InAir",name:"InAir",embedded:false,exported:true,typ:$Bool,tag:""},{prop:"OnWall",name:"OnWall",embedded:false,exported:true,typ:$Bool,tag:""},{prop:"OnWallNormX",name:"OnWallNormX",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"OnWallNormY",name:"OnWallNormY",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"CapturedByInertia",name:"CapturedByInertia",embedded:false,exported:true,typ:$Bool,tag:""},{prop:"ActiveSkillId",name:"ActiveSkillId",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"ActiveSkillHit",name:"ActiveSkillHit",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"FramesInvinsible",name:"FramesInvinsible",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"BulletTeamId",name:"BulletTeamId",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"ChCollisionTeamId",name:"ChCollisionTeamId",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"RevivalVirtualGridX",name:"RevivalVirtualGridX",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"RevivalVirtualGridY",name:"RevivalVirtualGridY",embedded:false,exported:true,typ:$Int32,tag:""}]);G.init("",[{prop:"Dx",name:"Dx",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"Dy",name:"Dy",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"BtnALevel",name:"BtnALevel",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"BtnBLevel",name:"BtnBLevel",embedded:false,exported:true,typ:$Int32,tag:""}]);I.init("",[{prop:"Boundary",name:"Boundary",embedded:false,exported:true,typ:CJ,tag:""}]);J.init("",[{prop:"StartupFrames",name:"StartupFrames",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"CancellableStFrame",name:"CancellableStFrame",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"CancellableEdFrame",name:"CancellableEdFrame",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"ActiveFrames",name:"ActiveFrames",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"HitStunFrames",name:"HitStunFrames",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"BlockStunFrames",name:"BlockStunFrames",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"PushbackVelX",name:"PushbackVelX",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"PushbackVelY",name:"PushbackVelY",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"Damage",name:"Damage",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"SelfLockVelX",name:"SelfLockVelX",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"SelfLockVelY",name:"SelfLockVelY",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"HitboxOffsetX",name:"HitboxOffsetX",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"HitboxOffsetY",name:"HitboxOffsetY",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"HitboxSizeX",name:"HitboxSizeX",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"HitboxSizeY",name:"HitboxSizeY",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"BlowUp",name:"BlowUp",embedded:false,exported:true,typ:$Bool,tag:""},{prop:"ExplosionFrames",name:"ExplosionFrames",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"SpeciesId",name:"SpeciesId",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"CancelTransit",name:"CancelTransit",embedded:false,exported:true,typ:CK,tag:""}]);K.init("",[{prop:"BulletLocalId",name:"BulletLocalId",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"OriginatedRenderFrameId",name:"OriginatedRenderFrameId",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"OffenderJoinIndex",name:"OffenderJoinIndex",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"TeamId",name:"TeamId",embedded:false,exported:true,typ:$Int32,tag:""}]);L.init("",[{prop:"BlState",name:"BlState",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"FramesInBlState",name:"FramesInBlState",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"BattleAttr",name:"BattleAttr",embedded:false,exported:true,typ:BQ,tag:""},{prop:"Bullet",name:"Bullet",embedded:false,exported:true,typ:BR,tag:""}]);M.init("",[{prop:"VirtualGridX",name:"VirtualGridX",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"VirtualGridY",name:"VirtualGridY",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"DirX",name:"DirX",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"DirY",name:"DirY",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"VelX",name:"VelX",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"VelY",name:"VelY",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"Speed",name:"Speed",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"BlState",name:"BlState",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"FramesInBlState",name:"FramesInBlState",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"BattleAttr",name:"BattleAttr",embedded:false,exported:true,typ:BQ,tag:""},{prop:"Bullet",name:"Bullet",embedded:false,exported:true,typ:BR,tag:""}]);N.init("",[{prop:"BattleLocalId",name:"BattleLocalId",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"RecoveryFrames",name:"RecoveryFrames",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"RecoveryFramesOnBlock",name:"RecoveryFramesOnBlock",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"RecoveryFramesOnHit",name:"RecoveryFramesOnHit",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"ReleaseTriggerType",name:"ReleaseTriggerType",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"BoundChState",name:"BoundChState",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"Hits",name:"Hits",embedded:false,exported:true,typ:BP,tag:""}]);O.init("",[{prop:"Id",name:"Id",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"PlayersArr",name:"PlayersArr",embedded:false,exported:true,typ:CG,tag:""},{prop:"CountdownNanos",name:"CountdownNanos",embedded:false,exported:true,typ:$Int64,tag:""},{prop:"MeleeBullets",name:"MeleeBullets",embedded:false,exported:true,typ:CH,tag:""},{prop:"FireballBullets",name:"FireballBullets",embedded:false,exported:true,typ:CI,tag:""},{prop:"BackendUnconfirmedMask",name:"BackendUnconfirmedMask",embedded:false,exported:true,typ:$Uint64,tag:""},{prop:"ShouldForceResync",name:"ShouldForceResync",embedded:false,exported:true,typ:$Bool,tag:""},{prop:"BulletLocalIdCounter",name:"BulletLocalIdCounter",embedded:false,exported:true,typ:$Int32,tag:""}]);P.init("",[{prop:"InputFrameId",name:"InputFrameId",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"InputList",name:"InputList",embedded:false,exported:true,typ:CA,tag:""},{prop:"ConfirmedList",name:"ConfirmedList",embedded:false,exported:true,typ:$Uint64,tag:""}]);Q.init("",[{prop:"FlAct",name:"FlAct",embedded:false,exported:true,typ:$Uint64,tag:""},{prop:"FrAct",name:"FrAct",embedded:false,exported:true,typ:$Uint64,tag:""},{prop:"X",name:"X",embedded:false,exported:true,typ:$Float64,tag:""},{prop:"Y",name:"Y",embedded:false,exported:true,typ:$Float64,tag:""}]);S.init("",[{prop:"SpeciesId",name:"SpeciesId",embedded:false,exported:true,typ:$Int,tag:""},{prop:"SpeciesName",name:"SpeciesName",embedded:false,exported:true,typ:$String,tag:""},{prop:"InAirIdleFrameIdxTurningPoint",name:"InAirIdleFrameIdxTurningPoint",embedded:false,exported:true,typ:$Int,tag:""},{prop:"InAirIdleFrameIdxTurnedCycle",name:"InAirIdleFrameIdxTurnedCycle",embedded:false,exported:true,typ:$Int,tag:""},{prop:"LayDownFrames",name:"LayDownFrames",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"LayDownFramesToRecover",name:"LayDownFramesToRecover",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"GetUpInvinsibleFrames",name:"GetUpInvinsibleFrames",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"GetUpFramesToRecover",name:"GetUpFramesToRecover",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"Speed",name:"Speed",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"JumpingInitVelY",name:"JumpingInitVelY",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"JumpingFramesToRecover",name:"JumpingFramesToRecover",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"DashingEnabled",name:"DashingEnabled",embedded:false,exported:true,typ:$Bool,tag:""},{prop:"OnWallEnabled",name:"OnWallEnabled",embedded:false,exported:true,typ:$Bool,tag:""},{prop:"WallJumpingFramesToRecover",name:"WallJumpingFramesToRecover",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"WallJumpingInitVelX",name:"WallJumpingInitVelX",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"WallJumpingInitVelY",name:"WallJumpingInitVelY",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"WallSlidingVelY",name:"WallSlidingVelY",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"InertiaFramesToRecover",name:"InertiaFramesToRecover",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"SkillMapper",name:"SkillMapper",embedded:false,exported:true,typ:CM,tag:""}]);AH.init("",[{prop:"Overlap",name:"Overlap",embedded:false,exported:true,typ:$Float64,tag:""},{prop:"OverlapX",name:"OverlapX",embedded:false,exported:true,typ:$Float64,tag:""},{prop:"OverlapY",name:"OverlapY",embedded:false,exported:true,typ:$Float64,tag:""},{prop:"AContainedInB",name:"AContainedInB",embedded:false,exported:true,typ:$Bool,tag:""},{prop:"BContainedInA",name:"BContainedInA",embedded:false,exported:true,typ:$Bool,tag:""},{prop:"Axis",name:"Axis",embedded:false,exported:true,typ:B.Vector,tag:""}]);$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=A.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=B.$init();$s=2;case 2:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$pkg.DIRECTION_DECODER=new BO([new BN([0,0]),new BN([0,2]),new BN([0,-2]),new BN([2,0]),new BN([-2,0]),new BN([1,1]),new BN([-1,-1]),new BN([1,-1]),new BN([-1,1])]);U=$makeMap($Int.keyFor,[{k:1,v:new N.ptr(0,30,30,30,1,2,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(7,13,30,22,13,9,5,0,5,1,-1,120,0,240,320,false,9,1,$makeMap($Int.keyFor,[{k:1,v:2}])))]))},{k:2,v:new N.ptr(0,36,36,36,1,11,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(18,22,36,18,18,9,5,0,5,1,-1,180,0,240,320,false,9,1,$makeMap($Int.keyFor,[{k:1,v:3}])))]))},{k:3,v:new N.ptr(0,50,50,50,1,12,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(8,0,0,30,999999999,9,20,70,10,5,50,160,80,320,320,true,9,1,false))]))},{k:4,v:new N.ptr(0,30,30,30,1,2,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(7,13,30,22,13,9,5,0,5,1,-1,120,0,240,320,false,15,2,$makeMap($Int.keyFor,[{k:1,v:5}])))]))},{k:5,v:new N.ptr(0,36,36,36,1,11,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(18,23,36,18,18,9,5,0,5,1,-1,180,0,240,320,false,15,2,$makeMap($Int.keyFor,[{k:1,v:6}])))]))},{k:6,v:new N.ptr(0,45,45,45,1,12,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(8,0,0,28,999999999,9,20,30,10,-1,-1,240,0,320,320,true,15,2,false))]))},{k:7,v:new N.ptr(0,30,30,30,1,2,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(7,13,30,22,13,9,5,0,5,-1,-1,120,0,240,320,false,9,1,$makeMap($Int.keyFor,[{k:1,v:8}])))]))},{k:8,v:new N.ptr(0,36,36,36,1,11,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(18,22,36,18,18,9,5,0,5,1,-1,180,0,240,320,false,9,1,$makeMap($Int.keyFor,[{k:1,v:9}])))]))},{k:9,v:new N.ptr(0,40,40,40,1,12,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(7,0,0,30,999999999,9,20,40,10,10,-1,100,0,320,320,true,9,1,false))]))},{k:10,v:new N.ptr(0,38,38,38,1,13,new BP([new M.ptr(0,0,0,0,0,0,60,0,0,BQ.nil,new J.ptr(10,0,0,999999999,15,9,20,0,22,-1,-1,320,100,640,480,false,30,1,false))]))},{k:11,v:new N.ptr(0,60,60,60,1,14,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(3,0,0,25,999999999,9,20,70,35,10,80,80,0,400,640,true,15,3,false))]))},{k:12,v:new N.ptr(0,10,10,10,1,15,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(3,0,0,0,0,0,-1,-1,0,60,0,0,0,0,0,false,0,0,false))]))},{k:13,v:new N.ptr(0,12,12,12,1,15,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(3,0,0,0,0,0,-1,-1,0,80,0,0,0,0,0,false,0,0,false))]))},{k:14,v:new N.ptr(0,8,8,8,1,15,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(4,0,0,0,999999999,0,-1,-1,0,50,0,0,0,0,0,false,0,0,false))]))},{k:15,v:new N.ptr(0,48,48,48,1,13,new BP([new M.ptr(0,0,0,0,0,0,40,0,0,BQ.nil,new J.ptr(12,0,0,999999999,15,9,30,0,18,-1,-1,240,80,480,320,false,30,2,false))]))},{k:16,v:new N.ptr(0,60,60,60,1,13,new BP([new M.ptr(0,0,0,0,0,0,40,0,0,BQ.nil,new J.ptr(16,0,0,999999999,999999999,9,30,70,30,-1,-1,240,80,480,320,true,30,3,false))]))},{k:255,v:new N.ptr(0,30,30,30,1,6,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(3,0,0,20,18,9,5,0,5,-1,-1,120,0,320,240,false,9,1,false))]))},{k:256,v:new N.ptr(0,20,20,20,1,6,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(3,0,0,10,15,9,5,0,5,-1,-1,120,0,320,240,false,15,2,false))]))},{k:257,v:new N.ptr(0,30,30,30,1,6,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(4,0,0,20,9,5,5,0,5,-1,-1,120,0,320,240,false,9,1,false))]))}]);$pkg.Characters=$makeMap($Int.keyFor,[{k:0,v:new S.ptr(0,"MonkGirl",11,1,16,16,10,27,21,80,2,true,true,8,28,70,-10,9,T)},{k:1,v:new S.ptr(1,"KnifeGirl",9,1,16,16,10,27,22,75,2,true,true,8,28,70,-10,9,T)},{k:4096,v:new S.ptr(4096,"Monk",42,2,14,14,8,30,18,78,2,true,false,0,0,0,0,9,T)}]);V=$makeMap($Int32.keyFor,[{k:4,v:true},{k:5,v:true},{k:6,v:true},{k:7,v:true},{k:8,v:true},{k:16,v:true},{k:15,v:true}]);W=$makeMap($Int32.keyFor,[{k:3,v:true},{k:7,v:true},{k:8,v:true},{k:9,v:true},{k:18,v:true}]);X=$makeMap($Int32.keyFor,[{k:8,v:true},{k:9,v:true},{k:10,v:true},{k:18,v:true}]);Y=$makeMap($Int32.keyFor,[{k:0,v:true},{k:1,v:true},{k:4,v:true},{k:5,v:true},{k:3,v:true},{k:7,v:true},{k:8,v:true},{k:9,v:true},{k:10,v:true},{k:18,v:true}]);}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})(); +$packages["math"]=(function(){var $pkg={},$init,B,A,IT,IU,IV,IW,FL,FP,HH,EI,FK,HD,HI,HL,HM;B=$packages["github.com/gopherjs/gopherjs/js"];A=$packages["math/bits"];IT=$arrayType($Uint32,2);IU=$arrayType($Float32,2);IV=$arrayType($Float64,1);IW=$structType("math",[{prop:"uint32array",name:"uint32array",embedded:false,exported:false,typ:IT,tag:""},{prop:"float32array",name:"float32array",embedded:false,exported:false,typ:IU,tag:""},{prop:"float64array",name:"float64array",embedded:false,exported:false,typ:IV,tag:""}]);EI=function(av){var av,aw,ax,ay,az,ba,bb;aw=HL(av);ax=((($shiftRightUint64(aw,52).$low>>>0))&2047)>>>0;if(ax<1023){aw=(ay=new $Uint64(2147483648,0),new $Uint64(aw.$high&ay.$high,(aw.$low&ay.$low)>>>0));if(ax===1022){aw=(az=new $Uint64(1072693248,0),new $Uint64(aw.$high|az.$high,(aw.$low|az.$low)>>>0));}}else if(ax<1075){ax=ax-(1023)>>>0;aw=(ba=$shiftRightUint64(new $Uint64(524288,0),ax),new $Uint64(aw.$high+ba.$high,aw.$low+ba.$low));aw=(bb=$shiftRightUint64(new $Uint64(1048575,4294967295),ax),new $Uint64(aw.$high&~bb.$high,(aw.$low&~bb.$low)>>>0));}return HM(aw);};$pkg.Round=EI;FK=function(av){var av,aw;return HM((aw=HL(av),new $Uint64(aw.$high&~2147483648,(aw.$low&~0)>>>0)));};$pkg.Abs=FK;HD=function(av){var av;return $parseFloat(FL.sqrt(av));};$pkg.Sqrt=HD;HI=function(){var av;av=new($global.ArrayBuffer)(8);HH.uint32array=new($global.Uint32Array)(av);HH.float32array=new($global.Float32Array)(av);HH.float64array=new($global.Float64Array)(av);};HL=function(av){var av,aw,ax;HH.float64array[0]=av;return(aw=$shiftLeft64((new $Uint64(0,HH.uint32array[1])),32),ax=(new $Uint64(0,HH.uint32array[0])),new $Uint64(aw.$high+ax.$high,aw.$low+ax.$low));};$pkg.Float64bits=HL;HM=function(av){var av;HH.uint32array[0]=((av.$low>>>0));HH.uint32array[1]=(($shiftRightUint64(av,32).$low>>>0));return HH.float64array[0];};$pkg.Float64frombits=HM;$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=B.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=A.$init();$s=2;case 2:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}HH=new IW.ptr(IT.zero(),IU.zero(),IV.zero());FL=$global.Math;FP=$parseFloat($NaN);HI();}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})(); +$packages["resolv"]=(function(){var $pkg={},$init,A,B,D,S,T,V,X,AA,AB,AD,AG,AI,AK,AL,AM,AN,AO,AP,AQ,AR,AS,AT,AU,AV,AW,AX,AY,AZ,BA,BB,E,F,G,H,I,L,M,O,P,U,W,Y,Z,AC,AE,AF,AH,AJ;A=$packages["math"];B=$pkg.Vector=$newType(12,$kindSlice,"resolv.Vector",true,"resolv",true,null);D=$pkg.Space=$newType(0,$kindStruct,"resolv.Space",true,"resolv",true,function(Cells_,CellWidth_,CellHeight_){this.$val=this;if(arguments.length===0){this.Cells=AM.nil;this.CellWidth=0;this.CellHeight=0;return;}this.Cells=Cells_;this.CellWidth=CellWidth_;this.CellHeight=CellHeight_;});S=$pkg.Shape=$newType(8,$kindInterface,"resolv.Shape",true,"resolv",true,null);T=$pkg.Line=$newType(0,$kindStruct,"resolv.Line",true,"resolv",true,function(Start_,End_){this.$val=this;if(arguments.length===0){this.Start=B.nil;this.End=B.nil;return;}this.Start=Start_;this.End=End_;});V=$pkg.ConvexPolygon=$newType(0,$kindStruct,"resolv.ConvexPolygon",true,"resolv",true,function(Points_,X_,Y_,Closed_){this.$val=this;if(arguments.length===0){this.Points=AQ.nil;this.X=0;this.Y=0;this.Closed=false;return;}this.Points=Points_;this.X=X_;this.Y=Y_;this.Closed=Closed_;});X=$pkg.ContactSet=$newType(0,$kindStruct,"resolv.ContactSet",true,"resolv",true,function(Points_,MTV_,Center_){this.$val=this;if(arguments.length===0){this.Points=AU.nil;this.MTV=B.nil;this.Center=B.nil;return;}this.Points=Points_;this.MTV=MTV_;this.Center=Center_;});AA=$pkg.AnyObj=$newType(8,$kindInterface,"resolv.AnyObj",true,"resolv",true,null);AB=$pkg.RingBuffer=$newType(0,$kindStruct,"resolv.RingBuffer",true,"resolv",true,function(Ed_,St_,EdFrameId_,StFrameId_,N_,Cnt_,Eles_){this.$val=this;if(arguments.length===0){this.Ed=0;this.St=0;this.EdFrameId=0;this.StFrameId=0;this.N=0;this.Cnt=0;this.Eles=AX.nil;return;}this.Ed=Ed_;this.St=St_;this.EdFrameId=EdFrameId_;this.StFrameId=StFrameId_;this.N=N_;this.Cnt=Cnt_;this.Eles=Eles_;});AD=$pkg.Object=$newType(0,$kindStruct,"resolv.Object",true,"resolv",true,function(Shape_,Space_,X_,Y_,W_,H_,TouchingCells_,Data_,ignoreList_,tags_){this.$val=this;if(arguments.length===0){this.Shape=$ifaceNil;this.Space=AN.nil;this.X=0;this.Y=0;this.W=0;this.H=0;this.TouchingCells=AQ.nil;this.Data=$ifaceNil;this.ignoreList=false;this.tags=AY.nil;return;}this.Shape=Shape_;this.Space=Space_;this.X=X_;this.Y=Y_;this.W=W_;this.H=H_;this.TouchingCells=TouchingCells_;this.Data=Data_;this.ignoreList=ignoreList_;this.tags=tags_;});AG=$pkg.Collision=$newType(0,$kindStruct,"resolv.Collision",true,"resolv",true,function(checkingObject_,dx_,dy_,Objects_,Cells_){this.$val=this;if(arguments.length===0){this.checkingObject=AO.nil;this.dx=0;this.dy=0;this.Objects=AQ.nil;this.Cells=AQ.nil;return;}this.checkingObject=checkingObject_;this.dx=dx_;this.dy=dy_;this.Objects=Objects_;this.Cells=Cells_;});AI=$pkg.Cell=$newType(0,$kindStruct,"resolv.Cell",true,"resolv",true,function(X_,Y_,Objects_){this.$val=this;if(arguments.length===0){this.X=0;this.Y=0;this.Objects=AQ.nil;return;}this.X=X_;this.Y=Y_;this.Objects=Objects_;});AK=$ptrType(AI);AL=$sliceType(AK);AM=$sliceType(AL);AN=$ptrType(D);AO=$ptrType(AD);AP=$sliceType(AO);AQ=$ptrType(AB);AR=$sliceType($Float64);AS=$ptrType(T);AT=$sliceType(AS);AU=$sliceType(B);AV=$ptrType(V);AW=$ptrType(X);AX=$sliceType(AA);AY=$sliceType($String);AZ=$ptrType(S);BA=$ptrType(AG);BB=$mapType(AO,$Bool);B.prototype.Magnitude2=function(){var a,b,c,d,e;a=this;b=0;c=a;d=0;while(true){if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);b=b+(e*e);d++;}return b;};$ptrType(B).prototype.Magnitude2=function(){return this.$get().Magnitude2();};B.prototype.Unit=function(){var a,b,c,d;a=this;b=a.Magnitude2();if(b<1e-16){return a;}c=A.Sqrt(b);d=0;while(true){if(!(d=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+d]=((d<0||d>=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+d])/c);d=d+(1)>>0;}return a;};$ptrType(B).prototype.Unit=function(){return this.$get().Unit();};B.prototype.GetX=function(){var a;a=this;if(a.$length<1){return 0;}return(0>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+0]);};$ptrType(B).prototype.GetX=function(){return this.$get().GetX();};B.prototype.GetY=function(){var a;a=this;if(a.$length<2){return 0;}return(1>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+1]);};$ptrType(B).prototype.GetY=function(){return this.$get().GetY();};B.prototype.GetZ=function(){var a;a=this;if(a.$length<3){return 0;}return(2>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+2]);};$ptrType(B).prototype.GetZ=function(){return this.$get().GetZ();};E=function(a,b,c,d){var a,b,c,d,e,f,g;e=new D.ptr(AM.nil,0,0);e.CellWidth=c;e.CellHeight=d;e.Resize((f=a/c,(f===f&&f!==1/0&&f!==-1/0)?f>>0:$throwRuntimeError("integer divide by zero")),(g=b/d,(g===g&&g!==1/0&&g!==-1/0)?g>>0:$throwRuntimeError("integer divide by zero")));return e;};$pkg.NewSpace=E;D.ptr.prototype.AddSingle=function(a){var{a,b,$s,$r,$c}=$restore(this,{a});$s=$s||0;s:while(true){switch($s){case 0:b=this;if(b===AN.nil){$panic(new $String("ERROR: space is nil"));}a.Space=b;$r=a.Update();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=-1;return;}return;}var $f={$blk:D.ptr.prototype.AddSingle,$c:true,$r,a,b,$s};return $f;};D.prototype.AddSingle=function(a){return this.$val.AddSingle(a);};D.ptr.prototype.Add=function(a){var{a,b,c,d,e,$s,$r,$c}=$restore(this,{a});$s=$s||0;s:while(true){switch($s){case 0:b=this;if(b===AN.nil){$panic(new $String("ERROR: space is nil"));}c=a;d=0;case 1:if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);e.Space=b;$r=e.Update();$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}d++;$s=1;continue;case 2:$s=-1;return;}return;}var $f={$blk:D.ptr.prototype.Add,$c:true,$r,a,b,c,d,e,$s};return $f;};D.prototype.Add=function(a){return this.$val.Add(a);};D.ptr.prototype.RemoveSingle=function(a){var a,b,c;b=this;if(b===AN.nil){$panic(new $String("ERROR: space is nil"));}while(true){if(!(0=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);while(true){if(!(0=f.$length)?($throwRuntimeError("index out of range"),undefined):f.$array[f.$offset+e])).$length;h=0;while(true){if(!(h=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+e])),((h<0||h>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+h])).Objects;l=k.StFrameId;while(true){if(!(l>0;}h=h+(1)>>0;}e=e+(1)>>0;}return c;};D.prototype.Objects=function(){return this.$val.Objects();};D.ptr.prototype.Resize=function(a,b){var a,b,c,d,e,f,g,h;c=this;c.Cells=$makeSlice(AM,b);d=0;while(true){if(!(d=e.$length)?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+d]=$makeSlice(AL,a)));f=0;while(true){if(!(f=h.$length)?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+d])),((f<0||f>=g.$length)?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+f]=AJ(f,d)));f=f+(1)>>0;}d=d+(1)>>0;}};D.prototype.Resize=function(a,b){return this.$val.Resize(a,b);};D.ptr.prototype.GetCell=function(a,b){var a,b,c,d,e,f;c=this;if(b>=0&&b=0&&a<(d=c.Cells,((b<0||b>=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+b])).$length){return(e=(f=c.Cells,((b<0||b>=f.$length)?($throwRuntimeError("index out of range"),undefined):f.$array[f.$offset+b])),((a<0||a>=e.$length)?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+a]));}return AK.nil;};D.prototype.GetCell=function(a,b){return this.$val.GetCell(a,b);};D.ptr.prototype.CheckCells=function(a,b,c,d,e){var a,b,c,d,e,f,g,h,i,j,k,l;f=this;g=a;while(true){if(!(g<(a+c>>0))){break;}h=b;while(true){if(!(h<(b+d>>0))){break;}i=f.GetCell(g,h);if(!(i===AK.nil)){j=i.Objects;if(e.$length>0){if(i.ContainsTags(e)){k=j.StFrameId;while(true){if(!(k>0;}}}else if(i.Occupied()){return $assertType(j.GetByFrameId(j.StFrameId),AO);}}h=h+(1)>>0;}g=g+(1)>>0;}return AO.nil;};D.prototype.CheckCells=function(a,b,c,d,e){return this.$val.CheckCells(a,b,c,d,e);};D.ptr.prototype.CheckCellsWorld=function(a,b,c,d,e){var a,b,c,d,e,f,g,h,i,j,k,l;f=this;g=f.WorldToSpace(a,b);h=g[0];i=g[1];j=f.WorldToSpace(c,d);k=j[0];l=j[1];return f.CheckCells(h,i,k,l,e);};D.prototype.CheckCellsWorld=function(a,b,c,d,e){return this.$val.CheckCellsWorld(a,b,c,d,e);};D.ptr.prototype.UnregisterAllObjects=function(){var a,b,c,d,e,f,g,h,i,j;a=this;b=0;while(true){if(!(b=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+b])).$length)){break;}g=(e=(f=a.Cells,((b<0||b>=f.$length)?($throwRuntimeError("index out of range"),undefined):f.$array[f.$offset+b])),((c<0||c>=e.$length)?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+c]));h=g.Objects;i=h.StFrameId;while(true){if(!(i>0;}c=c+(1)>>0;}b=b+(1)>>0;}};D.prototype.UnregisterAllObjects=function(){return this.$val.UnregisterAllObjects();};D.ptr.prototype.WorldToSpace=function(a,b){var a,b,c,d,e;c=this;d=((H(a/(c.CellWidth))>>0));e=((H(b/(c.CellHeight))>>0));return[d,e];};D.prototype.WorldToSpace=function(a,b){return this.$val.WorldToSpace(a,b);};D.ptr.prototype.SpaceToWorld=function(a,b){var a,b,c,d,e;c=this;d=(($imul(a,c.CellWidth)));e=(($imul(b,c.CellHeight)));return[d,e];};D.prototype.SpaceToWorld=function(a,b){return this.$val.SpaceToWorld(a,b);};D.ptr.prototype.Height=function(){var a;a=this;return a.Cells.$length;};D.prototype.Height=function(){return this.$val.Height();};D.ptr.prototype.Width=function(){var a,b;a=this;if(a.Cells.$length>0){return(b=a.Cells,(0>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+0])).$length;}return 0;};D.prototype.Width=function(){return this.$val.Width();};D.ptr.prototype.CellsInLine=function(a,b,c,d){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;e=this;f=new AL([]);g=e.GetCell(a,b);h=e.GetCell(c,d);if(!(g===AK.nil)&&!(h===AK.nil)){i=new B([((c-a>>0)),((d-b>>0))]).Unit();(0>=i.$length?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+0]=(0>=i.$length?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+0])*(((j=e.CellWidth/2,(j===j&&j!==1/0&&j!==-1/0)?j>>0:$throwRuntimeError("integer divide by zero")))));(1>=i.$length?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+1]=(1>=i.$length?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+1])*(((k=e.CellHeight/2,(k===k&&k!==1/0&&k!==-1/0)?k>>0:$throwRuntimeError("integer divide by zero")))));l=e.SpaceToWorld(a,b);m=l[0];n=l[1];q=new B([m+((o=e.CellWidth/2,(o===o&&o!==1/0&&o!==-1/0)?o>>0:$throwRuntimeError("integer divide by zero"))),n+((p=e.CellHeight/2,(p===p&&p!==1/0&&p!==-1/0)?p>>0:$throwRuntimeError("integer divide by zero")))]);r=false;while(true){if(!(!(g===AK.nil))){break;}if(g===h){f=$append(f,g);break;}f=$append(f,g);if(r){(1>=q.$length?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+1]=(1>=q.$length?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+1])+((1>=i.$length?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+1])));}else{(0>=q.$length?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+0]=(0>=q.$length?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+0])+((0>=i.$length?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+0])));}s=e.WorldToSpace((0>=q.$length?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+0]),(1>=q.$length?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+1]));t=s[0];u=s[1];v=e.GetCell(t,u);if(!(v===g)){g=v;}r=!r;}}return f;};D.prototype.CellsInLine=function(a,b,c,d){return this.$val.CellsInLine(a,b,c,d);};F=function(a,b){var a,b;if(a>b){return a;}else{return b;}};$pkg.Max=F;G=function(a,b){var a,b;if(a>>0)))&2047)>>>0)-1023>>>0;if(n<52){m=(o=(p=$shiftLeft64(new $Uint64(0,1),((52-n>>>0))),new $Uint64(p.$high-0,p.$low-1)),new $Uint64(m.$high&~o.$high,(m.$low&~o.$low)>>>0));}b=M(m);c=a-b;return[b,c];};$pkg.Modf=I;L=function(a){var a;return a;};$pkg.Float64bits=L;M=function(a){var a;return a;};$pkg.Float64frombits=M;O=function(a){var a,b;b=false;b=!((a===a));return b;};$pkg.IsNaN=O;P=function(a,b){var a,b;return b>=0&&a>1.79e+308||b<=0&&a<-1.79e+308;};$pkg.IsInf=P;U=function(a,b,c,d){var a,b,c,d,e;e=new T.ptr(B.nil,B.nil);e.Start=new B([a,b]);e.End=new B([c,d]);return e;};$pkg.NewLine=U;T.ptr.prototype.Normal=function(){var a,b,c,d,e,f,g;a=this;d=(b=a.End,(1>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+1]))-(c=a.Start,(1>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+1]));g=(e=a.End,(0>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+0]))-(f=a.Start,(0>=f.$length?($throwRuntimeError("index out of range"),undefined):f.$array[f.$offset+0]));return new B([d,-g]).Unit();};T.prototype.Normal=function(){return this.$val.Normal();};T.ptr.prototype.IntersectionPointsLine=function(a){var a,aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;b=this;k=((c=b.End,(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0]))-(d=b.Start,(0>=d.$length?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+0])))*((e=a.End,(1>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+1]))-(f=a.Start,(1>=f.$length?($throwRuntimeError("index out of range"),undefined):f.$array[f.$offset+1])))-((g=a.End,(0>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+0]))-(h=a.Start,(0>=h.$length?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+0])))*((i=b.End,(1>=i.$length?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+1]))-(j=b.Start,(1>=j.$length?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+1])));if(!((k===0))){t=((((l=b.Start,(1>=l.$length?($throwRuntimeError("index out of range"),undefined):l.$array[l.$offset+1]))-(m=a.Start,(1>=m.$length?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+1])))*((n=a.End,(0>=n.$length?($throwRuntimeError("index out of range"),undefined):n.$array[n.$offset+0]))-(o=a.Start,(0>=o.$length?($throwRuntimeError("index out of range"),undefined):o.$array[o.$offset+0]))))-(((p=b.Start,(0>=p.$length?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+0]))-(q=a.Start,(0>=q.$length?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+0])))*((r=a.End,(1>=r.$length?($throwRuntimeError("index out of range"),undefined):r.$array[r.$offset+1]))-(s=a.Start,(1>=s.$length?($throwRuntimeError("index out of range"),undefined):s.$array[s.$offset+1]))))+1)/k;ac=((((u=b.Start,(1>=u.$length?($throwRuntimeError("index out of range"),undefined):u.$array[u.$offset+1]))-(v=a.Start,(1>=v.$length?($throwRuntimeError("index out of range"),undefined):v.$array[v.$offset+1])))*((w=b.End,(0>=w.$length?($throwRuntimeError("index out of range"),undefined):w.$array[w.$offset+0]))-(x=b.Start,(0>=x.$length?($throwRuntimeError("index out of range"),undefined):x.$array[x.$offset+0]))))-(((y=b.Start,(0>=y.$length?($throwRuntimeError("index out of range"),undefined):y.$array[y.$offset+0]))-(z=a.Start,(0>=z.$length?($throwRuntimeError("index out of range"),undefined):z.$array[z.$offset+0])))*((aa=b.End,(1>=aa.$length?($throwRuntimeError("index out of range"),undefined):aa.$array[aa.$offset+1]))-(ab=b.Start,(1>=ab.$length?($throwRuntimeError("index out of range"),undefined):ab.$array[ab.$offset+1]))))+1)/k;if((0=ad.$length?($throwRuntimeError("index out of range"),undefined):ad.$array[ad.$offset+0]))-(ae=b.Start,(0>=ae.$length?($throwRuntimeError("index out of range"),undefined):ae.$array[ae.$offset+0]));ai=(ag=b.End,(1>=ag.$length?($throwRuntimeError("index out of range"),undefined):ag.$array[ag.$offset+1]))-(ah=b.Start,(1>=ah.$length?($throwRuntimeError("index out of range"),undefined):ah.$array[ah.$offset+1]));return new B([(aj=b.Start,(0>=aj.$length?($throwRuntimeError("index out of range"),undefined):aj.$array[aj.$offset+0]))+(t*af),(ak=b.Start,(1>=ak.$length?($throwRuntimeError("index out of range"),undefined):ak.$array[ak.$offset+1]))+(t*ai)]);}}return B.nil;};T.prototype.IntersectionPointsLine=function(a){return this.$val.IntersectionPointsLine(a);};W=function(a){var a,b;b=new V.ptr(AQ.nil,0,0,false);b.Points=AC(6);b.Closed=true;b.AddPoints(a);return b;};$pkg.NewConvexPolygon=W;V.ptr.prototype.GetPointByOffset=function(a){var a,b;b=this;if(b.Points.Cnt<=a){return B.nil;}return $assertType(b.Points.GetByFrameId(b.Points.StFrameId+a>>0),B);};V.prototype.GetPointByOffset=function(a){return this.$val.GetPointByOffset(a);};V.ptr.prototype.Clone=function(){var a,b,c;a=this;b=W(AR.nil);b.X=a.X;b.Y=a.Y;c=0;while(true){if(!(c>0;}b.Closed=a.Closed;return b;};V.prototype.Clone=function(){return this.$val.Clone();};V.ptr.prototype.AddPoints=function(a){var a,b,c,d;b=this;c=0;while(true){if(!(c=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+c]),(d=c+1>>0,((d<0||d>=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+d]))]));c=c+(2)>>0;}};V.prototype.AddPoints=function(a){return this.$val.AddPoints(a);};V.ptr.prototype.UpdateAsRectangle=function(a,b,c,d){var a,b,c,d,e,f,g,h;e=this;if(!((4===e.Points.Cnt))){$panic(new $String("ConvexPolygon not having exactly 4 vertices to form a rectangle#1!"));}f=0;while(true){if(!(f=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+0]=a);(1>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+1]=b);}else if(h===(1)){(0>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+0]=a+c);(1>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+1]=b);}else if(h===(2)){(0>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+0]=a+c);(1>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+1]=b+d);}else if(h===(3)){(0>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+0]=a);(1>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+1]=b+d);}f=f+(1)>>0;}return true;};V.prototype.UpdateAsRectangle=function(a,b,c,d){return this.$val.UpdateAsRectangle(a,b,c,d);};V.ptr.prototype.Lines=function(){var a,b,c,d,e,f,g,h,i,j,k;a=this;b=a.Transformed();c=b.$length;if(!a.Closed){c=c-(1)>>0;}d=$makeSlice(AT,c);e=0;while(true){if(!(e=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+e]);g=(0>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+0]);h=f;i=g;if(e<(b.$length-1>>0)){i=(j=e+1>>0,((j<0||j>=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+j]));}k=U((0>=h.$length?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+0]),(1>=h.$length?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+1]),(0>=i.$length?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+0]),(1>=i.$length?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+1]));((e<0||e>=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+e]=k);e=e+(1)>>0;}return d;};V.prototype.Lines=function(){return this.$val.Lines();};V.ptr.prototype.Transformed=function(){var a,b,c,d;a=this;b=$makeSlice(AU,a.Points.Cnt);c=0;while(true){if(!(c=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+c]=new B([(0>=d.$length?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+0])+a.X,(1>=d.$length?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+1])+a.Y]));c=c+(1)>>0;}return b;};V.prototype.Transformed=function(){return this.$val.Transformed();};V.ptr.prototype.Bounds=function(){var a,b,c,d,e,f,g,h,i,j;a=this;b=a.Transformed();e=new B([(c=(0>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+0]),(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0])),(d=(0>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+0]),(1>=d.$length?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+1]))]);h=new B([(f=(0>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+0]),(0>=f.$length?($throwRuntimeError("index out of range"),undefined):f.$array[f.$offset+0])),(g=(0>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+0]),(1>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+1]))]);i=0;while(true){if(!(i=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+i]);if((0>=j.$length?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+0])<(0>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+0])){(0>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+0]=(0>=j.$length?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+0]));}else if((0>=j.$length?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+0])>(0>=h.$length?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+0])){(0>=h.$length?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+0]=(0>=j.$length?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+0]));}if((1>=j.$length?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+1])<(1>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+1])){(1>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+1]=(1>=j.$length?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+1]));}else if((1>=j.$length?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+1])>(1>=h.$length?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+1])){(1>=h.$length?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+1]=(1>=j.$length?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+1]));}i=i+(1)>>0;}return[e,h];};V.prototype.Bounds=function(){return this.$val.Bounds();};V.ptr.prototype.Position=function(){var a;a=this;return[a.X,a.Y];};V.prototype.Position=function(){return this.$val.Position();};V.ptr.prototype.SetPosition=function(a,b){var a,b,c;c=this;c.X=a;c.Y=b;};V.prototype.SetPosition=function(a,b){return this.$val.SetPosition(a,b);};V.ptr.prototype.SetPositionVec=function(a){var a,b;b=this;b.X=a.GetX();b.Y=a.GetY();};V.prototype.SetPositionVec=function(a){return this.$val.SetPositionVec(a);};V.ptr.prototype.Move=function(a,b){var a,b,c;c=this;c.X=c.X+(a);c.Y=c.Y+(b);};V.prototype.Move=function(a,b){return this.$val.Move(a,b);};V.ptr.prototype.MoveVec=function(a){var a,b;b=this;b.X=b.X+(a.GetX());b.Y=b.Y+(a.GetY());};V.prototype.MoveVec=function(a){return this.$val.MoveVec(a);};V.ptr.prototype.SATAxes=function(){var a,b,c,d,e,f,g;a=this;b=a.Lines();c=$makeSlice(AU,b.$length);d=b;e=0;while(true){if(!(e=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+e]);((f<0||f>=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+f]=g.Normal());e++;}return c;};V.prototype.SATAxes=function(){return this.$val.SATAxes();};V.ptr.prototype.PointInside=function(a){var a,b,c,d,e,f,g;b=this;c=U((0>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+0]),(1>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+1]),(0>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+0])+9.99999999999e+11,(1>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+1]));d=0;e=b.Lines();f=0;while(true){if(!(f=e.$length)?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+f]);if(!(g.IntersectionPointsLine(c)===B.nil)){d=d+(1)>>0;}f++;}return d===1;};V.prototype.PointInside=function(a){return this.$val.PointInside(a);};Y=function(){var a;a=new X.ptr(AU.nil,B.nil,B.nil);a.Points=new AU([]);a.MTV=new B([0,0]);a.Center=new B([]);return a;};$pkg.NewContactSet=Y;X.ptr.prototype.LeftmostPoint=function(){var a,b,c,d,e;a=this;b=B.nil;c=a.Points;d=0;while(true){if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);if(b===B.nil||(0>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+0])<(0>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+0])){b=e;}d++;}return b;};X.prototype.LeftmostPoint=function(){return this.$val.LeftmostPoint();};X.ptr.prototype.RightmostPoint=function(){var a,b,c,d,e;a=this;b=B.nil;c=a.Points;d=0;while(true){if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);if(b===B.nil||(0>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+0])>(0>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+0])){b=e;}d++;}return b;};X.prototype.RightmostPoint=function(){return this.$val.RightmostPoint();};X.ptr.prototype.TopmostPoint=function(){var a,b,c,d,e;a=this;b=B.nil;c=a.Points;d=0;while(true){if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);if(b===B.nil||(1>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+1])<(1>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+1])){b=e;}d++;}return b;};X.prototype.TopmostPoint=function(){return this.$val.TopmostPoint();};X.ptr.prototype.BottommostPoint=function(){var a,b,c,d,e;a=this;b=B.nil;c=a.Points;d=0;while(true){if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);if(b===B.nil||(1>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+1])>(1>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+1])){b=e;}d++;}return b;};X.prototype.BottommostPoint=function(){return this.$val.BottommostPoint();};V.ptr.prototype.Intersection=function(a,b,c){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;d=this;e=Y();f=d.X;g=d.Y;d.X=d.X+(a);d.Y=d.Y+(b);h=$assertType(c,AV,true);i=h[0];j=h[1];if(j){k=d.Lines();l=0;while(true){if(!(l=k.$length)?($throwRuntimeError("index out of range"),undefined):k.$array[k.$offset+l]);n=i.Lines();o=0;while(true){if(!(o=n.$length)?($throwRuntimeError("index out of range"),undefined):n.$array[n.$offset+o]);q=m.IntersectionPointsLine(p);if(!(q===B.nil)){e.Points=$append(e.Points,q);}o++;}l++;}}if(e.Points.$length>0){}else{e=AW.nil;}d.X=f;d.Y=g;return e;};V.prototype.Intersection=function(a,b,c){return this.$val.Intersection(a,b,c);};Z=function(a,b,c,d){var a,b,c,d;return W(new AR([a,b,a+c,b,a+c,b+d,a,b+d]));};$pkg.NewRectangle=Z;AC=function(a){var a,b;b=new AB.ptr(0,0,0,0,0,0,AX.nil);b.Ed=0;b.St=0;b.EdFrameId=0;b.StFrameId=0;b.N=a;b.Cnt=0;b.Eles=$makeSlice(AX,a);return b;};$pkg.NewRingBuffer=AC;AB.ptr.prototype.DryPut=function(){var a;a=this;while(true){if(!(0=a.N)){break;}a.Pop();}a.EdFrameId=a.EdFrameId+(1)>>0;a.Cnt=a.Cnt+(1)>>0;a.Ed=a.Ed+(1)>>0;if(a.Ed>=a.N){a.Ed=a.Ed-(a.N)>>0;}};AB.prototype.DryPut=function(){return this.$val.DryPut();};AB.ptr.prototype.Put=function(a){var a,b,c,d;b=this;while(true){if(!(0=b.N)){break;}b.Pop();}(c=b.Eles,d=b.Ed,((d<0||d>=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]=a));b.EdFrameId=b.EdFrameId+(1)>>0;b.Cnt=b.Cnt+(1)>>0;b.Ed=b.Ed+(1)>>0;if(b.Ed>=b.N){b.Ed=b.Ed-(b.N)>>0;}};AB.prototype.Put=function(a){return this.$val.Put(a);};AB.ptr.prototype.Pop=function(){var a,b,c,d;a=this;if(0===a.Cnt){return $ifaceNil;}d=(b=a.Eles,c=a.St,((c<0||c>=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+c]));a.StFrameId=a.StFrameId+(1)>>0;a.Cnt=a.Cnt-(1)>>0;a.St=a.St+(1)>>0;if(a.St>=a.N){a.St=a.St-(a.N)>>0;}return d;};AB.prototype.Pop=function(){return this.$val.Pop();};AB.ptr.prototype.GetArrIdxByOffset=function(a){var a,b,c;b=this;if((0===b.Cnt)||0>a){return-1;}c=b.St+a>>0;if(b.St=b.N){c=c-(b.N)>>0;}if(c>=b.St||c=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+c]));};AB.prototype.GetByOffset=function(a){return this.$val.GetByOffset(a);};AB.ptr.prototype.GetByFrameId=function(a){var a,b;b=this;if(a>=b.EdFrameId||a>0);};AB.prototype.GetByFrameId=function(a){return this.$val.GetByFrameId(a);};AB.ptr.prototype.SetByFrameId=function(a,b){var a,b,c,d,e,f,g,h,i,j,k,l,m,n;c=this;d=c.StFrameId;e=c.EdFrameId;f=d;g=e;if(bb){h=c.GetArrIdxByOffset(b-c.StFrameId>>0);if(!((-1===h))){(i=c.Eles,((h<0||h>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+h]=a));return[0,f,g];}}j=0;if(g0){f.AddTags(e);}return f;};$pkg.NewObject=AF;AD.ptr.prototype.GetData=function(){var a;a=this;return a.Data;};AD.prototype.GetData=function(){return this.$val.GetData();};AD.ptr.prototype.GetShape=function(){var a;a=this;return(a.$ptr_Shape||(a.$ptr_Shape=new AZ(function(){return this.$target.Shape;},function($v){this.$target.Shape=$v;},a)));};AD.prototype.GetShape=function(){return this.$val.GetShape();};AD.ptr.prototype.Position=function(){var a;a=this;return[a.X,a.Y];};AD.prototype.Position=function(){return this.$val.Position();};AD.ptr.prototype.Clone=function(){var{a,b,c,d,e,f,g,h,$s,$r,$c}=$restore(this,{});$s=$s||0;s:while(true){switch($s){case 0:a=this;b=AF(a.X,a.Y,a.W,a.H,a.Tags());b.Data=a.Data;if(!($interfaceIsEqual(a.Shape,$ifaceNil))){$s=1;continue;}$s=2;continue;case 1:c=a.Shape.Clone();$s=3;case 3:if($c){$c=false;c=c.$blk();}if(c&&c.$blk!==undefined){break s;}$r=b.SetShape(c);$s=4;case 4:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}case 2:d=a.ignoreList;e=0;f=$keys(d);while(true){if(!(e>0;}h=h+(1)>>0;}}if(!($interfaceIsEqual(a.Shape,$ifaceNil))){$s=1;continue;}$s=2;continue;case 1:$r=a.Shape.SetPosition(a.X,a.Y);$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}case 2:$s=-1;return;}return;}var $f={$blk:AD.ptr.prototype.Update,$c:true,$r,a,b,c,d,e,f,g,h,i,j,$s};return $f;};AD.prototype.Update=function(){return this.$val.Update();};AD.ptr.prototype.AddTags=function(a){var a,b;b=this;b.tags=$appendSlice(b.tags,a);};AD.prototype.AddTags=function(a){return this.$val.AddTags(a);};AD.ptr.prototype.RemoveTags=function(a){var a,b,c,d,e,f,g,h,i;b=this;c=a;d=0;while(true){if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);f=b.tags;g=0;while(true){if(!(g=f.$length)?($throwRuntimeError("index out of range"),undefined):f.$array[f.$offset+g]);if(i===e){b.tags=$appendSlice($subslice(b.tags,0,h),$subslice(b.tags,(h+1>>0)));break;}g++;}d++;}};AD.prototype.RemoveTags=function(a){return this.$val.RemoveTags(a);};AD.ptr.prototype.HasTags=function(a){var a,b,c,d,e,f,g,h;b=this;c=a;d=0;while(true){if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);f=b.tags;g=0;while(true){if(!(g=f.$length)?($throwRuntimeError("index out of range"),undefined):f.$array[f.$offset+g]);if(h===e){return true;}g++;}d++;}return false;};AD.prototype.HasTags=function(a){return this.$val.HasTags(a);};AD.ptr.prototype.Tags=function(){var a;a=this;return $appendSlice(new AY([]),a.tags);};AD.prototype.Tags=function(){return this.$val.Tags();};AD.ptr.prototype.SetShape=function(a){var{a,b,$s,$r,$c}=$restore(this,{a});$s=$s||0;s:while(true){switch($s){case 0:b=this;if(!($interfaceIsEqual(b.Shape,a))){$s=1;continue;}$s=2;continue;case 1:b.Shape=a;$r=b.Update();$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}case 2:$s=-1;return;}return;}var $f={$blk:AD.ptr.prototype.SetShape,$c:true,$r,a,b,$s};return $f;};AD.prototype.SetShape=function(a){return this.$val.SetShape(a);};AD.ptr.prototype.BoundsToSpace=function(a,b){var a,b,c,d,e,f,g,h,i;c=this;d=c.Space.WorldToSpace(c.X+a,c.Y+b);e=d[0];f=d[1];g=c.Space.WorldToSpace(c.X+c.W+a-1,c.Y+c.H+b-1);h=g[0];i=g[1];return[e,f,h,i];};AD.prototype.BoundsToSpace=function(a,b){return this.$val.BoundsToSpace(a,b);};AD.ptr.prototype.SharesCells=function(a){var a,b,c,d,e;b=this;c=b.TouchingCells;d=c.StFrameId;while(true){if(!(d>0;}return false;};AD.prototype.SharesCells=function(a){return this.$val.SharesCells(a);};AD.ptr.prototype.SharesCellsTags=function(a){var a,b,c,d,e;b=this;c=b.TouchingCells;d=c.StFrameId;while(true){if(!(d>0;}return false;};AD.prototype.SharesCellsTags=function(a){return this.$val.SharesCellsTags(a);};AD.ptr.prototype.Center=function(){var a;a=this;return[a.X+(a.W/2),a.Y+(a.H/2)];};AD.prototype.Center=function(){return this.$val.Center();};AD.ptr.prototype.SetCenter=function(a,b){var a,b,c;c=this;c.X=a-(c.W/2);c.Y=b-(c.H/2);};AD.prototype.SetCenter=function(a,b){return this.$val.SetCenter(a,b);};AD.ptr.prototype.CellPosition=function(){var a,b;a=this;b=a.Center();return a.Space.WorldToSpace(b[0],b[1]);};AD.prototype.CellPosition=function(){return this.$val.CellPosition();};AD.ptr.prototype.SetRight=function(a){var a,b;b=this;b.X=a-b.W;};AD.prototype.SetRight=function(a){return this.$val.SetRight(a);};AD.ptr.prototype.SetBottom=function(a){var a,b;b=this;b.Y=a-b.H;};AD.prototype.SetBottom=function(a){return this.$val.SetBottom(a);};AD.ptr.prototype.Bottom=function(){var a;a=this;return a.Y+a.H;};AD.prototype.Bottom=function(){return this.$val.Bottom();};AD.ptr.prototype.Right=function(){var a;a=this;return a.X+a.W;};AD.prototype.Right=function(){return this.$val.Right();};AD.ptr.prototype.SetBounds=function(a,b){var a,b,c;c=this;c.X=(0>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+0]);c.Y=(1>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+1]);c.W=(0>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+0])-c.X;c.H=(1>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+1])-c.Y;};AD.prototype.SetBounds=function(a,b){return this.$val.SetBounds(a,b);};AD.ptr.prototype.CheckAllWithHolder=function(a,b,c){var a,aa,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;d=this;if(d.Space===AN.nil){return false;}c.Clear();c.checkingObject=d;if(a<0){a=G(a,-1);}else if(a>0){a=F(a,1);}if(b<0){b=G(b,-1);}else if(b>0){b=F(b,1);}c.dx=a;c.dy=b;e=d.BoundsToSpace(a,b);f=e[0];g=e[1];h=e[2];i=e[3];j=$makeMap(AO.keyFor,[]);k=$makeMap(AK.keyFor,[]);l=g;while(true){if(!(l<=i)){break;}m=f;while(true){if(!(m<=h)){break;}n=d.Space.GetCell(m,l);if(!(n===AK.nil)){o=n.Objects;p=o.StFrameId;while(true){if(!(p>0;continue;}t=(u=j[AO.keyFor(q)],u!==undefined?[u.v,true]:[false,false]);v=t[1];if(!v){c.Objects.Put(q);w=q;(j||$throwRuntimeError("assignment to entry in nil map"))[AO.keyFor(w)]={k:w,v:true};x=(y=k[AK.keyFor(n)],y!==undefined?[y.v,true]:[false,false]);z=x[1];if(!z){c.Cells.Put(n);aa=n;(k||$throwRuntimeError("assignment to entry in nil map"))[AK.keyFor(aa)]={k:aa,v:true};}p=p+(1)>>0;continue;}p=p+(1)>>0;}}m=m+(1)>>0;}l=l+(1)>>0;}if(0>=c.Objects.Cnt){return false;}return true;};AD.prototype.CheckAllWithHolder=function(a,b,c){return this.$val.CheckAllWithHolder(a,b,c);};AD.ptr.prototype.Overlaps=function(a){var a,b;b=this;return a.X<=b.X+b.W&&a.X+a.W>=b.X&&a.Y<=b.Y+b.H&&a.Y+a.H>=b.Y;};AD.prototype.Overlaps=function(a){return this.$val.Overlaps(a);};AD.ptr.prototype.AddToIgnoreList=function(a){var a,b,c;b=this;c=a;(b.ignoreList||$throwRuntimeError("assignment to entry in nil map"))[AO.keyFor(c)]={k:c,v:true};};AD.prototype.AddToIgnoreList=function(a){return this.$val.AddToIgnoreList(a);};AD.ptr.prototype.RemoveFromIgnoreList=function(a){var a,b;b=this;delete b.ignoreList[AO.keyFor(a)];};AD.prototype.RemoveFromIgnoreList=function(a){return this.$val.RemoveFromIgnoreList(a);};AH=function(){var a;a=new AG.ptr(AO.nil,0,0,AQ.nil,AQ.nil);a.Objects=AC(16);a.Cells=AC(16);return a;};$pkg.NewCollision=AH;AG.ptr.prototype.Clear=function(){var a;a=this;a.checkingObject=AO.nil;a.dx=0;a.dy=0;a.Objects.Clear();a.Cells.Clear();};AG.prototype.Clear=function(){return this.$val.Clear();};AG.ptr.prototype.PopFirstCollidedObject=function(){var a;a=this;if(0>=a.Objects.Cnt){return AO.nil;}return $assertType(a.Objects.Pop(),AO);};AG.prototype.PopFirstCollidedObject=function(){return this.$val.PopFirstCollidedObject();};AG.ptr.prototype.HasTags=function(a){var a,b,c,d,e;b=this;c=b.Objects;d=c.StFrameId;while(true){if(!(d>0;continue;}if(e.HasTags(a)){return true;}d=d+(1)>>0;}return false;};AG.prototype.HasTags=function(a){return this.$val.HasTags(a);};AG.ptr.prototype.ObjectsByTags=function(a){var a,b,c,d,e,f;b=this;c=new AP([]);d=b.Objects;e=d.StFrameId;while(true){if(!(e>0;continue;}if(f.HasTags(a)){c=$append(c,f);}e=e+(1)>>0;}return c;};AG.prototype.ObjectsByTags=function(a){return this.$val.ObjectsByTags(a);};AG.ptr.prototype.ContactWithObject=function(a){var a,b,c;b=this;c=new B([0,0]);if(b.dx<0){(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0]=a.X+a.W-b.checkingObject.X);}else if(b.dx>0){(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0]=a.X-b.checkingObject.W-b.checkingObject.X);}if(b.dy<0){(1>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+1]=a.Y+a.H-b.checkingObject.Y);}else if(b.dy>0){(1>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+1]=a.Y-b.checkingObject.H-b.checkingObject.Y);}return c;};AG.prototype.ContactWithObject=function(a){return this.$val.ContactWithObject(a);};AG.ptr.prototype.ContactWithCell=function(a){var a,b,c,d,e;b=this;c=new B([0,0]);d=(($imul(a.X,b.checkingObject.Space.CellWidth)));e=(($imul(a.Y,b.checkingObject.Space.CellHeight)));if(b.dx<0){(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0]=d+(b.checkingObject.Space.CellWidth)-b.checkingObject.X);}else if(b.dx>0){(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0]=d-b.checkingObject.W-b.checkingObject.X);}if(b.dy<0){(1>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+1]=e+(b.checkingObject.Space.CellHeight)-b.checkingObject.Y);}else if(b.dy>0){(1>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+1]=e-b.checkingObject.H-b.checkingObject.Y);}return c;};AG.prototype.ContactWithCell=function(a){return this.$val.ContactWithCell(a);};AG.ptr.prototype.SlideAgainstCell=function(a,b){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t;c=this;d=c.checkingObject.Space;e=$assertType(c.Cells.GetByFrameId(c.Cells.StFrameId),AK);f=d.SpaceToWorld(e.X,e.Y);g=f[0];h=f[1];i=(d.CellWidth)/2;j=(d.CellHeight)/2;g=g+(i);h=h+(j);k=c.checkingObject.Center();l=k[0];m=k[1];n=l-g;o=m-h;p=d.GetCell(e.X-1>>0,e.Y);q=d.GetCell(e.X+1>>0,e.Y);r=d.GetCell(e.X,e.Y-1>>0);s=d.GetCell(e.X,e.Y+1>>0);t=new B([0,0]);if(!((c.dy===0))){if(n>0&&(q===AK.nil||!q.ContainsTags(b))){(0>=t.$length?($throwRuntimeError("index out of range"),undefined):t.$array[t.$offset+0]=g+i-c.checkingObject.X);}else if(n<0&&(p===AK.nil||!p.ContainsTags(b))){(0>=t.$length?($throwRuntimeError("index out of range"),undefined):t.$array[t.$offset+0]=g-i-(c.checkingObject.X+c.checkingObject.W));}else{return B.nil;}}if(!((c.dx===0))){if(o>0&&(s===AK.nil||!s.ContainsTags(b))){(1>=t.$length?($throwRuntimeError("index out of range"),undefined):t.$array[t.$offset+1]=h+j-c.checkingObject.Y);}else if(o<0&&(r===AK.nil||!r.ContainsTags(b))){(1>=t.$length?($throwRuntimeError("index out of range"),undefined):t.$array[t.$offset+1]=h-j-(c.checkingObject.Y+c.checkingObject.H));}else{return B.nil;}}return t;};AG.prototype.SlideAgainstCell=function(a,b){return this.$val.SlideAgainstCell(a,b);};AJ=function(a,b){var a,b,c;c=new AI.ptr(0,0,AQ.nil);c.X=a;c.Y=b;c.Objects=AC(16);return c;};AI.ptr.prototype.register=function(a){var a,b;b=this;if(!b.Contains(a)){b.Objects.Put(a);}};AI.prototype.register=function(a){return this.$val.register(a);};AI.ptr.prototype.unregister=function(a){var a,b,c,d,e;b=this;c=b.Objects;d=c.StFrameId;while(true){if(!(d>0;}};AI.prototype.unregister=function(a){return this.$val.unregister(a);};AI.ptr.prototype.Contains=function(a){var a,b,c,d,e;b=this;c=b.Objects;d=c.StFrameId;while(true){if(!(d>0;}return false;};AI.prototype.Contains=function(a){return this.$val.Contains(a);};AI.ptr.prototype.ContainsTags=function(a){var a,b,c,d,e;b=this;c=b.Objects;d=c.StFrameId;while(true){if(!(d>0;}return false;};AI.prototype.ContainsTags=function(a){return this.$val.ContainsTags(a);};AI.ptr.prototype.Occupied=function(){var a;a=this;return 0>0)))],f!==undefined?[f.v,true]:[BS.nil,false]);g=e[0];h=e[1];if(h){i=(j=g.Hits,k=b.ActiveSkillHit,((k<0||k>=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+k]));if($assertType(i,BT,true)[1]){l=i.$val;if(l.Bullet.CancellableStFrame<=b.FramesInChState&&b.FramesInChState>0)))],r!==undefined?[r.v,true]:[BS.nil,false]);s=q[0];t=q[1];if(t){u=(v=s.Hits,w=b.ActiveSkillHit,((w<0||w>=v.$length)?($throwRuntimeError("index out of range"),undefined):v.$array[v.$offset+w]));if($assertType(u,BT,true)[1]){x=u.$val;if(x.Bullet.CancellableStFrame<=b.FramesInChState&&b.FramesInChState>0)))],ad!==undefined?[ad.v,true]:[BS.nil,false]);ae=ac[0];af=ac[1];if(af){ag=(ah=ae.Hits,ai=b.ActiveSkillHit,((ai<0||ai>=ah.$length)?($throwRuntimeError("index out of range"),undefined):ah.$array[ah.$offset+ai]));if($assertType(ag,BT,true)[1]){aj=ag.$val;if(aj.Bullet.CancellableStFrame<=b.FramesInChState&&b.FramesInChState>0))>>2>>0);};$pkg.ConvertToDelayedInputFrameId=AC;AD=function(a){var a;return(a>>2>>0);};$pkg.ConvertToNoDelayInputFrameId=AD;AE=function(a){var a;return(((a<<2>>0))+4>>0);};$pkg.ConvertToFirstUsedRenderFrameId=AE;AF=function(a){var a;return(((((a<<2>>0))+4>>0)+4>>0)-1>>0);};$pkg.ConvertToLastUsedRenderFrameId=AF;AG=function(a){var a,b,c,d,e,f,g,h;b=new $Uint64(a.$high&0,(a.$low&15)>>>0);d=(((c=$shiftRightUint64(a,4),new $Uint64(c.$high&0,(c.$low&1)>>>0)).$low>>0));f=(((e=$shiftRightUint64(a,5),new $Uint64(e.$high&0,(e.$low&1)>>>0)).$low>>0));return new G.ptr((g=(($flatten64(b)<0||$flatten64(b)>=$pkg.DIRECTION_DECODER.$length)?($throwRuntimeError("index out of range"),undefined):$pkg.DIRECTION_DECODER.$array[$pkg.DIRECTION_DECODER.$offset+$flatten64(b)]),(0>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+0])),(h=(($flatten64(b)<0||$flatten64(b)>=$pkg.DIRECTION_DECODER.$length)?($throwRuntimeError("index out of range"),undefined):$pkg.DIRECTION_DECODER.$array[$pkg.DIRECTION_DECODER.$offset+$flatten64(b)]),(1>=h.$length?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+1])),d,f);};AI=function(a,b,c,d){var{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,$s,$deferred,$r,$c}=$restore(this,{a,b,c,d});$s=$s||0;var $err=null;try{s:while(true){switch($s){case 0:$deferred=[];$curGoroutine.deferStack.push($deferred);c=[c];e=[e];f=[f];g=c[0].Position();e[0]=g[0];f[0]=g[1];$deferred.push([(function(c,e,f){return function(){c[0].SetPosition(e[0],f[0]);};})(c,e,f),[]]);c[0].SetPosition(e[0]+a,f[0]+b);h=new AH.ptr(0,0,0,true,true,new B.Vector([0,0]));i=AJ(c[0],d,h);if(i){$s=1;continue;}$s=2;continue;case 1:j=h.Overlap*h.OverlapX;k=h.Overlap*h.OverlapY;l=j;m=k;n=[true,l,m,h];$s=4;case 4:return n;case 2:o=[false,0,0,h];$s=5;case 5:return o;case 3:$s=-1;return[false,0,0,BU.nil];}return;}}catch(err){$err=err;$s=-1;return[false,0,0,BU.nil];}finally{$callDeferred($deferred,$err);if($curGoroutine.asleep){var $f={$blk:AI,$c:true,$r,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,$s,$deferred};return $f;}}};AJ=function(a,b,c){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y;d=a.Points.Cnt;e=b.Points.Cnt;f=d;g=e;if((1===f)&&(1===g)){if(!(BU.nil===c)){c.Overlap=0;}h=a.GetPointByOffset(0);i=b.GetPointByOffset(0);return((0>=h.$length?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+0])===(0>=i.$length?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+0]))&&((1>=h.$length?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+1])===(1>=i.$length?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+1]));}if(1>0)))){n=a.GetPointByOffset(j+1>>0);}o=(1>=n.$length?($throwRuntimeError("index out of range"),undefined):n.$array[n.$offset+1])-(1>=m.$length?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+1]);p=(0>=n.$length?($throwRuntimeError("index out of range"),undefined):n.$array[n.$offset+0])-(0>=m.$length?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+0]);q=new B.Vector([o,-p]).Unit();if(AP(a,b,q,c)){return false;}j=j+(1)>>0;}}if(1>0)))){v=b.GetPointByOffset(r+1>>0);}w=(1>=v.$length?($throwRuntimeError("index out of range"),undefined):v.$array[v.$offset+1])-(1>=u.$length?($throwRuntimeError("index out of range"),undefined):u.$array[u.$offset+1]);x=(0>=v.$length?($throwRuntimeError("index out of range"),undefined):v.$array[v.$offset+0])-(0>=u.$length?($throwRuntimeError("index out of range"),undefined):u.$array[u.$offset+0]);y=new B.Vector([w,-x]).Unit();if(AP(a,b,y,c)){return false;}r=r+(1)>>0;}}return true;};AK=function(a,b,c,d,e){var a,b,c,d,e;if(2===a){return false;}return((b+c>>0)>0)+d>>0)>e);};$pkg.IsGeneralBulletActive=AK;AL=function(a,b){var a,b;return AK(a.BlState,a.BattleAttr.OriginatedRenderFrameId,a.Bullet.StartupFrames,a.Bullet.ActiveFrames,b.Id);};$pkg.IsMeleeBulletActive=AL;AM=function(a,b){var a,b;if(2===a.BlState){return a.FramesInBlState>0)+a.Bullet.ActiveFrames>>0)>b.Id;};$pkg.IsMeleeBulletAlive=AM;AN=function(a,b){var a,b;return AK(a.BlState,a.BattleAttr.OriginatedRenderFrameId,a.Bullet.StartupFrames,a.Bullet.ActiveFrames,b.Id);};$pkg.IsFireballBulletActive=AN;AO=function(a,b){var a,b;if(2===a.BlState){return a.FramesInBlState>0)+a.Bullet.ActiveFrames>>0)>b.Id;};$pkg.IsFireballBulletAlive=AO;AP=function(a,b,c,d){var a,aa,ab,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;e=1.79e+308;f=-1.79e+308;g=1.79e+308;h=-1.79e+308;i=e;j=f;k=g;l=h;m=0;while(true){if(!(m=n.$length?($throwRuntimeError("index out of range"),undefined):n.$array[n.$offset+0])+a.X)*(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0])+((1>=n.$length?($throwRuntimeError("index out of range"),undefined):n.$array[n.$offset+1])+a.Y)*(1>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+1]);if(i>o){i=o;}if(j>0;}p=0;while(true){if(!(p=q.$length?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+0])+b.X)*(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0])+((1>=q.$length?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+1])+b.Y)*(1>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+1]);if(k>r){k=r;}if(l>0;}if(i>l||jl){s=i-l;d.AContainedInB=false;}else{v=j-k;w=l-i;if(v=z.$length?($throwRuntimeError("index out of range"),undefined):z.$array[z.$offset+0])))&&(0===(aa=d.Axis,(1>=aa.$length?($throwRuntimeError("index out of range"),undefined):aa.$array[aa.$offset+1]))))||x>y){ab=1;if(s<0){ab=-1;}d.Overlap=y;d.OverlapX=(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0])*ab;d.OverlapY=(1>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+1])*ab;}d.Axis=c;}return false;};AQ=function(a,b){var a,b,c,d;c=((A.Round(a*10)>>0));d=((A.Round(b*10)>>0));return[c,d];};$pkg.WorldToVirtualGridPos=AQ;AR=function(a,b){var a,b,c,d;c=(a)*0.1;d=(b)*0.1;return[c,d];};$pkg.VirtualGridToWorldPos=AR;AS=function(a,b,c,d,e,f,g,h,i,j){var a,b,c,d,e,f,g,h,i,j;return[a-c-g+i,b-d-f+j];};$pkg.WorldToPolygonColliderBLPos=AS;AT=function(a,b,c,d,e,f,g,h,i,j){var a,b,c,d,e,f,g,h,i,j;return[a+c+g-i,b+d+f-j];};$pkg.PolygonColliderBLToWorldPos=AT;AU=function(a,b,c,d,e,f,g,h,i,j){var a,b,c,d,e,f,g,h,i,j,k,l,m;k=AT(a,b,c,d,e,f,g,h,i,j);l=k[0];m=k[1];return AQ(l,m);};$pkg.PolygonColliderBLToVirtualGridPos=AU;AW=function(a,b,c,d,e,f,g,h,i){var{a,aa,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,$s,$r,$c}=$restore(this,{a,b,c,d,e,f,g,h,i});$s=$s||0;s:while(true){switch($s){case 0:j=0;if((16===b.CharacterState)&&(0===c.VelX)&&(b.DirX===c.DirX)){k=1;if(0>c.DirX){k=-k;}j=k*(b.Speed)*0.1;}l=0;m=d.CheckAllWithHolder(j,0,i);if(!m){$s=-1;return l;}case 1:n=i.PopFirstCollidedObject();if(BV.nil===n){$s=2;continue;}o=false;p=n.Data;if($assertType(p,BW,true)[1]||$assertType(p,BT,true)[1]||$assertType(p,BX,true)[1]){}else{o=true;}if(!o){$s=1;continue;}q=$assertType(n.Shape,BY);s=AI(0,0,e,q);$s=3;case 3:if($c){$c=false;s=s.$blk();}if(s&&s.$blk!==undefined){break s;}r=s;t=r[0];u=r[1];v=r[2];w=r[3];if(!t){$s=1;continue;}x=(w.Overlap-f)*w.OverlapX;y=(w.Overlap-f)*w.OverlapY;u=x;v=y;z=w.OverlapX;aa=w.OverlapY;((l<0||l>=h.$length)?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+l]).X=z;((l<0||l>=h.$length)?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+l]).Y=aa;g.X=g.X+(u);g.Y=g.Y+(v);l=l+(1)>>0;$s=1;continue;case 2:$s=-1;return l;}return;}var $f={$blk:AW,$c:true,$r,a,aa,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,$s};return $f;};AX=function(a,b,c,d,e,f,g){var a,b,c,d,e,f,g,h,i,j,k,l,m,n;h=false;i=0;while(true){if(!(i>0)>>0))===g){i=i+(1)>>0;continue;}if((j=(k=$shiftLeft64(new $Uint64(0,1),((i>>>0))),new $Uint64(c.$high&k.$high,(c.$low&k.$low)>>>0)),(0>0;continue;}if(((i<0||i>=e.$length)?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+i])>=a){i=i+(1)>>0;continue;}m=(l=((i<0||i>=f.$length)?($throwRuntimeError("index out of range"),undefined):f.$array[f.$offset+i]),new $Uint64(l.$high&0,(l.$low&15)>>>0));if(!((n=((i<0||i>=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+i]),(m.$high===n.$high&&m.$low===n.$low)))){((i<0||i>=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+i]=m);h=true;}i=i+(1)>>0;}return h;};$pkg.UpdateInputFrameInPlaceUponDynamics=AX;AY=function(a,b,c,d,e){var a,aa,ab,ac,ad,ae,af,ag,ah,ai,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;f=AC(c.Id);g=AC(c.Id-1>>0);if(0>=f){return[-2,false,0,0];}h=(i=W[$Int32.keyFor(a.CharacterState)],i!==undefined?[i.v,true]:[false,false]);j=h[1];if(j){return[-2,false,0,0];}k=$assertType(e.GetByFrameId(f),BZ);l=k.InputList;m=CA.nil;if(0>0,((q<0||q>=l.$length)?($throwRuntimeError("index out of range"),undefined):l.$array[l.$offset+q])));s=0;t=0;u=s;v=t;w=0;x=0;y=w;z=x;if(!(CA.nil===m)){ab=AG((aa=p-1>>0,((aa<0||aa>=m.$length)?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+aa])));y=ab.BtnALevel;z=ab.BtnBLevel;}if(0===a.FramesToRecover){ac=r.Dx;ad=r.Dy;u=ac;v=ad;}ae=-1;af=a.CapturedByInertia&&(((d.InertiaFramesToRecover>>1>>0))>a.FramesToRecover);if((0===a.FramesToRecover)||af){if(r.BtnBLevel>z){if(d.DashingEnabled&&0>r.Dy&&!((15===a.CharacterState))){ae=5;}else{ag=(ah=V[$Int32.keyFor(a.CharacterState)],ah!==undefined?[ah.v,true]:[false,false]);ai=ag[1];if(!ai){o=true;}else if(16===a.CharacterState){o=true;}}}}if(-1===ae){if(0y){if(0>r.Dy){ae=3;}else if(0>0;u=s.PlayersArr.$length;v=CB.nil;w=h.GetByFrameId(t);if($interfaceIsEqual($ifaceNil,w)){if(t===h.EdFrameId){h.DryPut();w=h.GetByFrameId(t);if($interfaceIsEqual($ifaceNil,w)){v=BM(u,64,64);h.SetByFrameId(v,t);}else{v=$assertType(w,CB);}}else{$panic(new $String("Invalid nextRenderFrameId="+($encodeRune(t))+"!"));}}else{v=$assertType(w,CB);}x=v.PlayersArr;y=s.PlayersArr;z=0;while(true){if(!(z=y.$length)?($throwRuntimeError("index out of range"),undefined):y.$array[y.$offset+z]);ac=ab.FramesToRecover-1>>0;ad=ab.FramesInChState+1>>0;ae=ab.FramesInvinsible-1>>0;if(ac<0){ac=0;}if(ae<0){ae=0;}BK(ab.Id,ab.VirtualGridX,ab.VirtualGridY,ab.DirX,ab.DirY,ab.VelX,ab.VelY,ac,ad,ab.ActiveSkillId,ab.ActiveSkillHit,ae,ab.Speed,ab.BattleState,ab.CharacterState,ab.JoinIndex,ab.Hp,ab.MaxHp,ab.ColliderRadius,true,false,ab.OnWallNormX,ab.OnWallNormY,ab.CapturedByInertia,ab.BulletTeamId,ab.ChCollisionTeamId,ab.RevivalVirtualGridX,ab.RevivalVirtualGridY,((aa<0||aa>=x.$length)?($throwRuntimeError("index out of range"),undefined):x.$array[x.$offset+aa]));z++;}af=0;ag=v.MeleeBullets;ah=0;ai=v.FireballBullets;aj=s.BulletLocalIdCounter;ak=AC(s.Id);if(0=ao.$length)?($throwRuntimeError("index out of range"),undefined):ao.$array[ao.$offset+ap]);as=((aq<0||aq>=g.$length)?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+aq]);at=((aq<0||aq>=x.$length)?($throwRuntimeError("index out of range"),undefined):x.$array[x.$offset+aq]);au=AY(ar,at,s,as,a);av=au[0];aw=au[1];ax=au[2];ay=au[3];((aq<0||aq>=l.$length)?($throwRuntimeError("index out of range"),undefined):l.$array[l.$offset+aq]=aw);az=ar.JoinIndex;ba=as.SkillMapper(av,ar,as.SpeciesId);$s=3;case 3:if($c){$c=false;ba=ba.$blk();}if(ba&&ba.$blk!==undefined){break s;}bb=ba;bc=(bd=U[$Int.keyFor(bb)],bd!==undefined?[bd.v,true]:[BS.nil,false]);be=bc[0];bf=bc[1];if(bf){at.ActiveSkillId=((bb>>0));at.ActiveSkillHit=0;at.FramesToRecover=be.RecoveryFrames;bg=1;if(0>at.DirX){bg=-bg;}bh=false;bi=(bj=be.Hits,bk=at.ActiveSkillHit,((bk<0||bk>=bj.$length)?($throwRuntimeError("index out of range"),undefined):bj.$array[bj.$offset+bk]));if($assertType(bi,BT,true)[1]){bl=bi.$val;BI(0,0,aj,b,az,ar.BulletTeamId,bl.Bullet,((af<0||af>=ag.$length)?($throwRuntimeError("index out of range"),undefined):ag.$array[ag.$offset+af]));aj=aj+(1)>>0;af=af+(1)>>0;if(!((-1===bl.Bullet.SelfLockVelX))){bh=true;at.VelX=$imul(bg,bl.Bullet.SelfLockVelX);}if(!((-1===bl.Bullet.SelfLockVelY))){bh=true;at.VelY=bl.Bullet.SelfLockVelY;}}else if($assertType(bi,BX,true)[1]){bm=bi.$val;BJ(0,0,ar.VirtualGridX+($imul(bg,bm.Bullet.HitboxOffsetX))>>0,ar.VirtualGridY+bm.Bullet.HitboxOffsetY>>0,bg,0,$imul(bm.Speed,bg),0,bm.Speed,aj,b,az,ar.BulletTeamId,bm.Bullet,((ah<0||ah>=ai.$length)?($throwRuntimeError("index out of range"),undefined):ai.$array[ai.$offset+ah]));aj=aj+(1)>>0;ah=ah+(1)>>0;if(!((-1===bm.Bullet.SelfLockVelX))){bh=true;at.VelX=$imul(bg,bm.Bullet.SelfLockVelX);}if(!((-1===bm.Bullet.SelfLockVelY))){bh=true;at.VelY=bm.Bullet.SelfLockVelY;}}if(false===bh&&false===ar.InAir){at.VelX=0;}at.CharacterState=be.BoundChState;ap++;$s=1;continue;}if(0===ar.FramesToRecover){bn=ar.CapturedByInertia;bo=as.OnWallEnabled&&(as.WallJumpingInitVelX===Z(ar.VelX));bp=true;bq=false;br=false;if(!((0===ax))&&(0===at.VelX)){bp=false;}else if((0===ax)&&!((0===at.VelX))){bp=false;br=true;}else if(0>($imul(ax,at.VelX))){bp=false;bq=true;}if(!aw&&!bo&&!bn&&!bp){at.CapturedByInertia=true;if(bq){at.CharacterState=17;at.FramesToRecover=as.InertiaFramesToRecover;}else if(br){at.FramesToRecover=as.InertiaFramesToRecover;}else{at.CharacterState=1;at.FramesToRecover=(as.InertiaFramesToRecover>>1>>0);}}else{at.CapturedByInertia=false;if(!((0===ax))){bs=1;if(0>ax){bs=-bs;}at.DirX=ax;at.DirY=ay;if(bo){at.VelX=$imul(bs,Z(ar.VelX));}else{at.VelX=$imul(bs,ar.Speed);}at.CharacterState=1;}else{at.CharacterState=0;at.VelX=0;}}}ap++;$s=1;continue;case 2:bt=0;bu=s.PlayersArr;bv=0;case 4:if(!(bv=bu.$length)?($throwRuntimeError("index out of range"),undefined):bu.$array[bu.$offset+bv]);by=bx.JoinIndex;bz=0;ca=0;(cb=by-1>>0,((cb<0||cb>=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+cb])).X=bz;(cc=by-1>>0,((cc<0||cc>=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+cc])).Y=ca;cd=((bw<0||bw>=x.$length)?($throwRuntimeError("index out of range"),undefined):x.$array[x.$offset+bw]);ce=((bw<0||bw>=g.$length)?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+bw]);cf=bx.VirtualGridX+bx.VelX>>0;cg=bx.VirtualGridY+bx.VelY>>0;ch=cf;ci=cg;if(0>=cd.Hp&&(0===cd.FramesToRecover)){cj=bx.RevivalVirtualGridX;ck=bx.RevivalVirtualGridY;ch=cj;ci=ck;cd.CharacterState=10;cd.FramesInChState=10;cd.FramesToRecover=ce.GetUpFramesToRecover;cd.FramesInvinsible=ce.GetUpInvinsibleFrames;cd.Hp=bx.MaxHp;if(0===((cl=cd.JoinIndex%2,cl===cl?cl:$throwRuntimeError("integer divide by zero")))){cd.DirX=-2;cd.DirY=0;}else{cd.DirX=2;cd.DirY=0;}}if(((bw<0||bw>=l.$length)?($throwRuntimeError("index out of range"),undefined):l.$array[l.$offset+bw])){if(16===bx.CharacterState){if(0<($imul(bx.VelX,bx.OnWallNormX))){ch=ch-(bx.VelX)>>0;}cm=-1;if(0>bx.OnWallNormX){cm=-cm;}ch=ch+(($imul(cm,ce.WallJumpingInitVelX)))>>0;ci=ci+(ce.WallJumpingInitVelY)>>0;cd.VelX=(($imul(cm,ce.WallJumpingInitVelX)));cd.VelY=(ce.WallJumpingInitVelY);cd.FramesToRecover=ce.WallJumpingFramesToRecover;}else{cd.VelY=(ce.JumpingInitVelY);ci=ci+(ce.JumpingInitVelY)>>0;}}cn=AR(ch,ci);co=cn[0];cp=cn[1];cq=$imul(bx.ColliderRadius,2);cr=$imul(bx.ColliderRadius,4);cs=cq;ct=cr;cu=bx.CharacterState;if(cu===(9)){cv=$imul(bx.ColliderRadius,4);cw=$imul(bx.ColliderRadius,2);cs=cv;ct=cw;}else if((cu===(8))||(cu===(4))||(cu===(5))||(cu===(16))){cx=$imul(bx.ColliderRadius,2);cy=$imul(bx.ColliderRadius,2);cs=cx;ct=cy;}cz=AR(cs,ct);da=cz[0];db=cz[1];dc=((bt<0||bt>=m.$length)?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+bt]);BC(dc,co,cp,da,db,0.1,0.1,0.1,0.1,e,f,bx,"Player");bt=bt+(1)>>0;$r=c.AddSingle(dc);$s=6;case 6:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}if(bx.InAir){if((16===bx.CharacterState)&&!((bw<0||bw>=l.$length)?($throwRuntimeError("index out of range"),undefined):l.$array[l.$offset+bw])){cd.VelX=cd.VelX+(0)>>0;cd.VelY=ce.WallSlidingVelY;}else if(15===bx.CharacterState){cd.VelX=cd.VelX+(0)>>0;}else{cd.VelX=cd.VelX+(0)>>0;cd.VelY=cd.VelY+(-5)>>0;}}bv++;$s=4;continue;case 5:dd=s.FireballBullets;de=0;case 7:if(!(de=dd.$length)?($throwRuntimeError("index out of range"),undefined):dd.$array[dd.$offset+de]);if(-1===df.BattleAttr.BulletLocalId){$s=8;continue;}dg=((ah<0||ah>=ai.$length)?($throwRuntimeError("index out of range"),undefined):ai.$array[ai.$offset+ah]);BJ(df.BlState,df.FramesInBlState+1>>0,df.VirtualGridX,df.VirtualGridY,df.DirX,df.DirY,df.VelX,df.VelY,df.Speed,df.BattleAttr.BulletLocalId,df.BattleAttr.OriginatedRenderFrameId,df.BattleAttr.OffenderJoinIndex,df.BattleAttr.TeamId,df.Bullet,dg);if(AO(dg,s)){$s=9;continue;}$s=10;continue;case 9:if(AN(dg,s)){$s=11;continue;}$s=12;continue;case 11:dh=AR(dg.VirtualGridX,dg.VirtualGridY);di=dh[0];dj=dh[1];dk=AR(dg.Bullet.HitboxSizeX,dg.Bullet.HitboxSizeY);dl=dk[0];dm=dk[1];dn=((bt<0||bt>=m.$length)?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+bt]);BC(dn,di,dj,dl,dm,0.1,0.1,0.1,0.1,e,f,dg,"FireballBullet");bt=bt+(1)>>0;$r=c.AddSingle(dn);$s=14;case 14:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}dg.BlState=1;if(!((dg.BlState===df.BlState))){dg.FramesInBlState=0;}dp=dg.VirtualGridX+dg.VelX>>0;dq=dg.VirtualGridY+dg.VelY>>0;dg.VirtualGridX=dp;dg.VirtualGridY=dq;$s=13;continue;case 12:dt=(dr=s.PlayersArr,ds=dg.BattleAttr.OffenderJoinIndex-1>>0,((ds<0||ds>=dr.$length)?($throwRuntimeError("index out of range"),undefined):dr.$array[dr.$offset+ds]));du=(dv=W[$Int32.keyFor(dt.CharacterState)],dv!==undefined?[dv.v,true]:[false,false]);dw=du[1];if(dw){de++;$s=7;continue;}case 13:ah=ah+(1)>>0;case 10:de++;$s=7;continue;case 8:((ah<0||ah>=ai.$length)?($throwRuntimeError("index out of range"),undefined):ai.$array[ai.$offset+ah]).BattleAttr.BulletLocalId=-1;dx=s.MeleeBullets;dy=0;case 15:if(!(dy=dx.$length)?($throwRuntimeError("index out of range"),undefined):dx.$array[dx.$offset+dy]);if(-1===dz.BattleAttr.BulletLocalId){$s=16;continue;}ea=((af<0||af>=ag.$length)?($throwRuntimeError("index out of range"),undefined):ag.$array[ag.$offset+af]);BI(dz.BlState,dz.FramesInBlState+1>>0,dz.BattleAttr.BulletLocalId,dz.BattleAttr.OriginatedRenderFrameId,dz.BattleAttr.OffenderJoinIndex,dz.BattleAttr.TeamId,dz.Bullet,ea);if(AM(ea,s)){$s=17;continue;}$s=18;continue;case 17:ed=(eb=s.PlayersArr,ec=ea.BattleAttr.OffenderJoinIndex-1>>0,((ec<0||ec>=eb.$length)?($throwRuntimeError("index out of range"),undefined):eb.$array[eb.$offset+ec]));ee=(ef=W[$Int32.keyFor(ed.CharacterState)],ef!==undefined?[ef.v,true]:[false,false]);eg=ee[1];if(eg){dy++;$s=15;continue;}if(AL(ea,s)){$s=19;continue;}$s=20;continue;case 19:eh=1;if(0>ed.DirX){eh=-eh;}ei=AR(ed.VirtualGridX+($imul(eh,ea.Bullet.HitboxOffsetX))>>0,ed.VirtualGridY);ej=ei[0];ek=ei[1];el=AR(ea.Bullet.HitboxSizeX,ea.Bullet.HitboxSizeY);em=el[0];en=el[1];eo=((bt<0||bt>=m.$length)?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+bt]);BC(eo,ej,ek,em,en,0.1,0.1,0.1,0.1,e,f,ea,"MeleeBullet");bt=bt+(1)>>0;$r=c.AddSingle(eo);$s=21;case 21:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}ea.BlState=1;if(!((ea.BlState===dz.BlState))){ea.FramesInBlState=0;}case 20:af=af+(1)>>0;case 18:dy++;$s=15;continue;case 16:((af<0||af>=ag.$length)?($throwRuntimeError("index out of range"),undefined):ag.$array[ag.$offset+af]).BattleAttr.BulletLocalId=-1;ep=s.PlayersArr;eq=0;case 22:if(!(eq=ep.$length)?($throwRuntimeError("index out of range"),undefined):ep.$array[ep.$offset+eq]);et=es.JoinIndex;eu=((er<0||er>=m.$length)?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+er]);ev=$assertType(eu.Shape,BY);ew=((er<0||er>=x.$length)?($throwRuntimeError("index out of range"),undefined):x.$array[x.$offset+er]);ez=AW(et,es,ew,eu,ev,0.1,(ex=et-1>>0,((ex<0||ex>=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+ex])),(ey=et-1>>0,((ey<0||ey>=k.$length)?($throwRuntimeError("index out of range"),undefined):k.$array[k.$offset+ey])),i);$s=24;case 24:if($c){$c=false;ez=ez.$blk();}if(ez&&ez.$blk!==undefined){break s;}fa=ez;fb=((er<0||er>=g.$length)?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+er]);fc=false;fd=eu.CheckAllWithHolder(0,0,i);if(fd){$s=25;continue;}$s=26;continue;case 25:case 27:fe=i.PopFirstCollidedObject();if(BV.nil===fe){$s=28;continue;}ff=false;fg=false;fh=false;fi=ff;fj=fg;fk=fh;fl=fe.Data;if($assertType(fl,BW,true)[1]){fm=fl.$val;if(18===fm.CharacterState){$s=27;continue;}fj=true;}else if($assertType(fl,BT,true)[1]||$assertType(fl,BX,true)[1]){fn=fl;fk=true;}else{fo=fl;fi=true;}if(fk){$s=27;continue;}fp=$assertType(fe.Shape,BY);fr=AI(0,0,ev,fp);$s=29;case 29:if($c){$c=false;fr=fr.$blk();}if(fr&&fr.$blk!==undefined){break s;}fq=fr;fs=fq[0];ft=fq[1];fu=fq[2];fv=fq[3];if(!fs){$s=27;continue;}fw=fv.OverlapX*0+fv.OverlapY*-1;if(fj){fx=(fv.Overlap-0.2)*fv.OverlapX;fy=(fv.Overlap-0.2)*fv.OverlapY;ft=fx;fu=fy;}fz=0;while(true){if(!(fz>0,((gb<0||gb>=k.$length)?($throwRuntimeError("index out of range"),undefined):k.$array[k.$offset+gb])),((fz<0||fz>=ga.$length)?($throwRuntimeError("index out of range"),undefined):ga.$array[ga.$offset+fz]));gd=ft*gc.X+fu*gc.Y;if(fi||(fj&&0>gd)){ft=ft-(gd*gc.X);fu=fu-(gd*gc.Y);}fz=fz+(1)>>0;}ge=et-1>>0;((ge<0||ge>=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+ge]).X=((ge<0||ge>=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+ge]).X+(ft);gf=et-1>>0;((gf<0||gf>=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+gf]).Y=((gf<0||gf>=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+gf]).Y+(fu);if(0.5=es.VelY;if(gg){ew.VelY=0;ew.VelX=0;if(18===ew.CharacterState){}else if(8===ew.CharacterState){ew.CharacterState=9;ew.FramesToRecover=fb.LayDownFramesToRecover;}else{gh=es.CharacterState;if((gh===(8))||(gh===(4))||(gh===(5))||(gh===(16))){gi=0;gj=es.ColliderRadius;gk=gi;gl=gj;gm=AR(gk,gl);gn=gm[1];go=et-1>>0;((go<0||go>=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+go]).Y=((go<0||go>=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+go]).Y-(gn);}ew.CharacterState=0;ew.FramesToRecover=0;}}else{gp=(gq=Y[$Int32.keyFor(ew.CharacterState)],gq!==undefined?[gq.v,true]:[false,false]);gr=gp[1];if(gr){if(18===ew.CharacterState){ew.VelY=0;ew.VelX=0;}else if(9===ew.CharacterState){if(0===ew.FramesToRecover){ew.CharacterState=10;ew.FramesToRecover=fb.GetUpFramesToRecover;}}else if(10===ew.CharacterState){if(0===ew.FramesToRecover){ew.CharacterState=0;ew.FramesInvinsible=fb.GetUpInvinsibleFrames;}}}}}if(fb.OnWallEnabled){if(ew.InAir){gs=(gt=W[$Int32.keyFor(es.CharacterState)],gt!==undefined?[gt.v,true]:[false,false]);gu=gs[1];if(!gu){gv=0;while(true){if(!(gv>0,((gx<0||gx>=k.$length)?($throwRuntimeError("index out of range"),undefined):k.$array[k.$offset+gx])),((gv<0||gv>=gw.$length)?($throwRuntimeError("index out of range"),undefined):gw.$array[gw.$offset+gv]));gz=gy.X*1+gy.Y*0;ha=gy.X*-1+gy.Y*0;if(0.9>0));hc=((gy.Y>>0));ew.OnWallNormX=hb;ew.OnWallNormY=hc;break;}if(0.9>0));he=((gy.Y>>0));ew.OnWallNormX=hd;ew.OnWallNormY=he;break;}gv=gv+(1)>>0;}}}if(!ew.OnWall){hf=0;hg=0;ew.OnWallNormX=hf;ew.OnWallNormY=hg;}}eq++;$s=22;continue;case 23:hh=x.$length;case 30:if(!(hh=m.$length)?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+hh]);hj=hi.CheckAllWithHolder(0,0,i);if(!hj){hh=hh+(1)>>0;$s=30;continue;}hk=false;hl=false;hm=BR.nil;hn=BQ.nil;ho=hi.Data;if($assertType(ho,BT,true)[1]){hp=ho.$val;hm=hp.Bullet;hn=hp.BattleAttr;}else if($assertType(ho,BX,true)[1]){hq=ho.$val;hm=hq.Bullet;hn=hq.BattleAttr;}hr=$assertType(hi.Shape,BY);hu=(hs=s.PlayersArr,ht=hn.OffenderJoinIndex-1>>0,((ht<0||ht>=hs.$length)?($throwRuntimeError("index out of range"),undefined):hs.$array[hs.$offset+ht]));case 32:hv=i.PopFirstCollidedObject();if(BV.nil===hv){$s=33;continue;}hw=$assertType(hv.Shape,BY);hx=hv.Data;if($assertType(hx,BW,true)[1]){$s=34;continue;}$s=35;continue;case 34:hy=hx.$val;if(hn.OffenderJoinIndex===hy.JoinIndex){$s=32;continue;}ib=AI(0,0,hr,hw);$s=37;case 37:if($c){$c=false;ib=ib.$blk();}if(ib&&ib.$blk!==undefined){break s;}ia=ib;ic=ia[0];if(!ic){$s=32;continue;}id=(ie=X[$Int32.keyFor(hy.CharacterState)],ie!==undefined?[ie.v,true]:[false,false]);ig=id[1];if(ig){$s=32;continue;}if(0hu.DirX){ih=-ih;}ij=(ii=hy.JoinIndex-1>>0,((ii<0||ii>=x.$length)?($throwRuntimeError("index out of range"),undefined):x.$array[x.$offset+ii]));ij.Hp=ij.Hp-(hm.Damage)>>0;ik=$imul(ih,hm.PushbackVelX);il=hm.PushbackVelY;im=ik;io=il;ij.VelX=im;ij.VelY=io;if(0>=ij.Hp){ij.Hp=0;ij.CharacterState=18;ij.FramesToRecover=60;}else{if(hm.BlowUp){ij.CharacterState=8;}else{ij.CharacterState=3;}iq=(ip=hy.JoinIndex-1>>0,((ip<0||ip>=x.$length)?($throwRuntimeError("index out of range"),undefined):x.$array[x.$offset+ip])).FramesToRecover;if(hm.HitStunFrames>iq){ij.FramesToRecover=hm.HitStunFrames;}}$s=36;continue;case 35:hz=hx;hk=true;case 36:$s=32;continue;case 33:if(hk){ir=hi.Data;if($assertType(ir,BT,true)[1]){is=ir.$val;is.BlState=2;if(hl){is.FramesInBlState=0;}else{is.FramesInBlState=is.Bullet.ExplosionFrames+1>>0;}}else if($assertType(ir,BX,true)[1]){it=ir.$val;it.BlState=2;it.FramesInBlState=0;}}hh=hh+(1)>>0;$s=30;continue;case 31:iu=s.PlayersArr;iv=0;while(true){if(!(iv=iu.$length)?($throwRuntimeError("index out of range"),undefined):iu.$array[iu.$offset+iv]);iy=ix.JoinIndex;iz=((iw<0||iw>=m.$length)?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+iw]);ja=((iw<0||iw>=x.$length)?($throwRuntimeError("index out of range"),undefined):x.$array[x.$offset+iw]);jb=AU(iz.X-(jc=iy-1>>0,((jc<0||jc>=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+jc])).X,iz.Y-(jd=iy-1>>0,((jd<0||jd>=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+jd])).Y,iz.W*0.5,iz.H*0.5,0,0,0,0,e,f);ja.VirtualGridX=jb[0];ja.VirtualGridY=jb[1];if(ja.InAir){je=ja.CharacterState;jf=je;if((jf===(0))||(jf===(1))||(jf===(17))){if(((iw<0||iw>=l.$length)?($throwRuntimeError("index out of range"),undefined):l.$array[l.$offset+iw])||(5===ix.CharacterState)){ja.CharacterState=5;}else{ja.CharacterState=4;}}else if(jf===(2)){ja.CharacterState=6;}else if(jf===(3)){ja.CharacterState=7;}}if(ja.OnWall){jg=ja.CharacterState;if((jg===(1))||(jg===(5))||(jg===(4))){jh=(16===ix.CharacterState);ji=ix.OnWall&&12<=ja.FramesInChState;if(jh||ji){ja.CharacterState=16;}}}if(!((ja.CharacterState===ix.CharacterState))){ja.FramesInChState=0;}jj=(jk=Y[$Int32.keyFor(ja.CharacterState)],jk!==undefined?[jk.v,true]:[false,false]);jl=jj[1];if(jl){ja.ActiveSkillId=-1;ja.ActiveSkillHit=-1;}iv++;}jm=0;while(true){if(!(jm=m.$length)?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+jm]);jn.Space.RemoveSingle(jn);jm=jm+(1)>>0;}v.Id=t;v.BulletLocalIdCounter=aj;$s=-1;return r;}return;}var $f={$blk:AZ,$c:true,$r,a,aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,al,am,an,ao,ap,aq,ar,as,at,au,av,aw,ax,ay,az,b,ba,bb,bc,bd,be,bf,bg,bh,bi,bj,bk,bl,bm,bn,bo,bp,bq,br,bs,bt,bu,bv,bw,bx,by,bz,c,ca,cb,cc,cd,ce,cf,cg,ch,ci,cj,ck,cl,cm,cn,co,cp,cq,cr,cs,ct,cu,cv,cw,cx,cy,cz,d,da,db,dc,dd,de,df,dg,dh,di,dj,dk,dl,dm,dn,dp,dq,dr,ds,dt,du,dv,dw,dx,dy,dz,e,ea,eb,ec,ed,ee,ef,eg,eh,ei,ej,ek,el,em,en,eo,ep,eq,er,es,et,eu,ev,ew,ex,ey,ez,f,fa,fb,fc,fd,fe,ff,fg,fh,fi,fj,fk,fl,fm,fn,fo,fp,fq,fr,fs,ft,fu,fv,fw,fx,fy,fz,g,ga,gb,gc,gd,ge,gf,gg,gh,gi,gj,gk,gl,gm,gn,go,gp,gq,gr,gs,gt,gu,gv,gw,gx,gy,gz,h,ha,hb,hc,hd,he,hf,hg,hh,hi,hj,hk,hl,hm,hn,ho,hp,hq,hr,hs,ht,hu,hv,hw,hx,hy,hz,i,ia,ib,ic,id,ie,ig,ih,ii,ij,ik,il,im,io,ip,iq,ir,is,it,iu,iv,iw,ix,iy,iz,j,ja,jb,jc,jd,je,jf,jg,jh,ji,jj,jk,jl,jm,jn,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,$s};return $f;};$pkg.ApplyInputFrameDownsyncDynamicsOnSingleRenderFrame=AZ;BA=function(a,b,c,d,e,f,g,h,i,j,k,l){var{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,$s,$r,$c}=$restore(this,{a,b,c,d,e,f,g,h,i,j,k,l});$s=$s||0;s:while(true){switch($s){case 0:m=AS(a,b,c*0.5,d*0.5,e,f,g,h,i,j);n=m[0];o=m[1];p=BB(n,o,g+c+h,f+d+e,k,l);$s=1;case 1:if($c){$c=false;p=p.$blk();}if(p&&p.$blk!==undefined){break s;}q=p;$s=2;case 2:return q;}return;}var $f={$blk:BA,$c:true,$r,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,$s};return $f;};$pkg.GenerateRectCollider=BA;BB=function(a,b,c,d,e,f){var{a,b,c,d,e,f,g,h,$s,$r,$c}=$restore(this,{a,b,c,d,e,f});$s=$s||0;s:while(true){switch($s){case 0:g=B.NewObjectSingleTag(a,b,c,d,f);h=B.NewRectangle(0,0,c,d);$r=g.SetShape(h);$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}g.Data=e;$s=-1;return g;}return;}var $f={$blk:BB,$c:true,$r,a,b,c,d,e,f,g,h,$s};return $f;};BC=function(a,b,c,d,e,f,g,h,i,j,k,l,m){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y;n=AS(b,c,d*0.5,e*0.5,f,g,h,i,j,k);o=n[0];p=n[1];q=h+d+i;r=g+e+f;s=q;t=r;u=o;v=p;w=s;x=t;a.X=u;a.Y=v;a.W=w;a.H=x;y=$assertType(a.Shape,BY);y.UpdateAsRectangle(0,0,s,t);a.Data=l;};$pkg.UpdateRectCollider=BC;BD=function(a,b,c,d,e){var{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,$s,$r,$c}=$restore(this,{a,b,c,d,e});$s=$s||0;s:while(true){switch($s){case 0:f=BE(a);g=0;h=0;i=g;j=h;k=B.NewConvexPolygon(CC.nil);l=f.Points;m=0;while(true){if(!(m=l.$length)?($throwRuntimeError("index out of range"),undefined):l.$array[l.$offset+m]);p=f.Points;q=0;while(true){if(!(q=p.$length)?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+q]);if(n===r){q++;continue;}if(A.Abs(s.X-o.X)>i){i=A.Abs(s.X-o.X);}if(A.Abs(s.Y-o.Y)>j){j=A.Abs(s.Y-o.Y);}q++;}m++;}t=0;while(true){if(!(t=u.$length)?($throwRuntimeError("index out of range"),undefined):u.$array[u.$offset+t]));k.AddPoints(new CC([v.X,v.Y]));t=t+(1)>>0;}w=B.NewObject(f.Anchor.X+b,f.Anchor.Y+c,i,j,new CD([e]));$r=w.SetShape(k);$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}w.Data=d;$s=-1;return w;}return;}var $f={$blk:BD,$c:true,$r,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,$s};return $f;};$pkg.GenerateConvexPolygonCollider=BD;BE=function(a){var a,b,c,d,e,f,g,h,i,j,k;b=new D.ptr(1.79e+308,1.79e+308);c=a.Points;d=0;while(true){if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);if(e.X=g.$length)?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+h]);(k=f.Points,((i<0||i>=k.$length)?($throwRuntimeError("index out of range"),undefined):k.$array[k.$offset+i]=new D.ptr(j.X-b.X,j.Y-b.Y)));h++;}return f;};$pkg.AlignPolygon2DToBoundingBox=BE;BF=function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x;return new L.ptr(u,v,new K.ptr(a,b,c,t),new J.ptr(d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,w,x,false));};$pkg.NewMeleeBullet=BF;BG=function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,ab,ac,ad,ae){var a,aa,ab,ac,ad,ae,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;return new M.ptr(u,v,w,x,y,z,aa,ab,ac,new K.ptr(a,b,c,t),new J.ptr(d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,ad,ae,false));};$pkg.NewFireballBullet=BG;BH=function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,ab){var a,aa,ab,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;return new F.ptr(a,b,c,d,e,f,g,m,n,p,s,false,0,0,h,i,q,r,o,t,u,v,w,x,j,k,l,y,z,aa,ab);};$pkg.NewPlayerDownsync=BH;BI=function(a,b,c,d,e,f,g,h){var a,b,c,d,e,f,g,h;h.BlState=a;h.FramesInBlState=b;h.BattleAttr.BulletLocalId=c;h.BattleAttr.OriginatedRenderFrameId=d;h.BattleAttr.OffenderJoinIndex=e;h.BattleAttr.TeamId=f;h.Bullet=g;};$pkg.CloneMeleeBullet=BI;BJ=function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o;o.BlState=a;o.FramesInBlState=b;o.VirtualGridX=c;o.VirtualGridY=d;o.DirX=e;o.DirY=f;o.VelX=g;o.VelY=h;o.Speed=i;o.BattleAttr.BulletLocalId=j;o.BattleAttr.OriginatedRenderFrameId=k;o.BattleAttr.OffenderJoinIndex=l;o.BattleAttr.TeamId=m;o.Bullet=n;};$pkg.CloneFireballBullet=BJ;BK=function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,ab,ac){var a,aa,ab,ac,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;ac.Id=a;ac.VirtualGridX=b;ac.VirtualGridY=c;ac.DirX=d;ac.DirY=e;ac.VelX=f;ac.VelY=g;ac.FramesToRecover=h;ac.FramesInChState=i;ac.ActiveSkillId=j;ac.ActiveSkillHit=k;ac.FramesInvinsible=l;ac.Speed=m;ac.BattleState=n;ac.CharacterState=o;ac.JoinIndex=p;ac.Hp=q;ac.MaxHp=r;ac.ColliderRadius=s;ac.InAir=t;ac.OnWall=u;ac.OnWallNormX=v;ac.OnWallNormY=w;ac.CapturedByInertia=x;ac.BulletTeamId=y;ac.ChCollisionTeamId=z;ac.RevivalVirtualGridX=aa;ac.RevivalVirtualGridY=ab;};$pkg.ClonePlayerDownsync=BK;BL=function(a,b,c,d,e,f){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o;f.Id=a;f.BulletLocalIdCounter=c;g=0;while(true){if(!(g=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+g]);if(BW.nil===h||(-1===h.Id)){break;}BK(h.Id,h.VirtualGridX,h.VirtualGridY,h.DirX,h.DirY,h.VelX,h.VelY,h.FramesToRecover,h.FramesInChState,h.ActiveSkillId,h.ActiveSkillHit,h.FramesInvinsible,h.Speed,h.BattleState,h.CharacterState,h.JoinIndex,h.Hp,h.MaxHp,h.ColliderRadius,h.InAir,h.OnWall,h.OnWallNormX,h.OnWallNormY,h.CapturedByInertia,h.BulletTeamId,h.ChCollisionTeamId,h.RevivalVirtualGridX,h.RevivalVirtualGridY,(i=f.PlayersArr,((g<0||g>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+g])));g=g+(1)>>0;}j=0;while(true){if(!(j=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+j]);if(BT.nil===k||(-1===k.BattleAttr.BulletLocalId)){break;}BI(k.BlState,k.FramesInBlState,k.BattleAttr.BulletLocalId,k.BattleAttr.OriginatedRenderFrameId,k.BattleAttr.OffenderJoinIndex,k.BattleAttr.TeamId,k.Bullet,(l=f.MeleeBullets,((j<0||j>=l.$length)?($throwRuntimeError("index out of range"),undefined):l.$array[l.$offset+j])));j=j+(1)>>0;}m=0;while(true){if(!(m=e.$length)?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+m]);if(BX.nil===n||(-1===n.BattleAttr.BulletLocalId)){break;}BJ(n.BlState,n.FramesInBlState,n.VirtualGridX,n.VirtualGridY,n.DirX,n.DirY,n.VelX,n.VelY,n.Speed,n.BattleAttr.BulletLocalId,n.BattleAttr.OriginatedRenderFrameId,n.BattleAttr.OffenderJoinIndex,n.BattleAttr.TeamId,n.Bullet,(o=f.FireballBullets,((m<0||m>=o.$length)?($throwRuntimeError("index out of range"),undefined):o.$array[o.$offset+m])));m=m+(1)>>0;}};$pkg.CloneRoomDownsyncFrame=BL;BM=function(a,b,c){var a,b,c,d,e,f,g,h,i,j,k,l;d=$makeSlice(CG,a);e=0;while(true){if(!(e=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+e]=f);e=e+(1)>>0;}g=$makeSlice(CH,b);h=0;while(true){if(!(h=g.$length)?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+h]=i);h=h+(1)>>0;}j=$makeSlice(CI,c);k=0;while(true){if(!(k=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+k]=l);k=k+(1)>>0;}return new O.ptr(-1,d,new $Int64(0,0),g,j,new $Uint64(0,0),false,-1);};$pkg.NewPreallocatedRoomDownsyncFrame=BM;BW.methods=[{prop:"GetId",name:"GetId",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetJoinIndex",name:"GetJoinIndex",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetVirtualGridX",name:"GetVirtualGridX",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetVirtualGridY",name:"GetVirtualGridY",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetDirX",name:"GetDirX",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetDirY",name:"GetDirY",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetVelX",name:"GetVelX",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetVelY",name:"GetVelY",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetSpeed",name:"GetSpeed",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetHp",name:"GetHp",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetMaxHp",name:"GetMaxHp",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetCharacterState",name:"GetCharacterState",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetFramesToRecover",name:"GetFramesToRecover",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetFramesInChState",name:"GetFramesInChState",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetInAir",name:"GetInAir",pkg:"",typ:$funcType([],[$Bool],false)},{prop:"GetOnWall",name:"GetOnWall",pkg:"",typ:$funcType([],[$Bool],false)},{prop:"GetOnWallNormX",name:"GetOnWallNormX",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetColliderRadius",name:"GetColliderRadius",pkg:"",typ:$funcType([],[$Int32],false)}];BT.methods=[{prop:"GetBlState",name:"GetBlState",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetFramesInBlState",name:"GetFramesInBlState",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetBulletLocalId",name:"GetBulletLocalId",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetOffenderJoinIndex",name:"GetOffenderJoinIndex",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetOriginatedRenderFrameId",name:"GetOriginatedRenderFrameId",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetStartupFrames",name:"GetStartupFrames",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetActiveFrames",name:"GetActiveFrames",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetHitboxSizeX",name:"GetHitboxSizeX",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetHitboxSizeY",name:"GetHitboxSizeY",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetHitboxOffsetX",name:"GetHitboxOffsetX",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetHitboxOffsetY",name:"GetHitboxOffsetY",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetExplosionFrames",name:"GetExplosionFrames",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetSpeciesId",name:"GetSpeciesId",pkg:"",typ:$funcType([],[$Int32],false)}];BX.methods=[{prop:"GetVirtualGridX",name:"GetVirtualGridX",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetVirtualGridY",name:"GetVirtualGridY",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetDirX",name:"GetDirX",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetDirY",name:"GetDirY",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetVelX",name:"GetVelX",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetVelY",name:"GetVelY",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetSpeed",name:"GetSpeed",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetBlState",name:"GetBlState",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetFramesInBlState",name:"GetFramesInBlState",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetBulletLocalId",name:"GetBulletLocalId",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetOffenderJoinIndex",name:"GetOffenderJoinIndex",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetOriginatedRenderFrameId",name:"GetOriginatedRenderFrameId",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetStartupFrames",name:"GetStartupFrames",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetActiveFrames",name:"GetActiveFrames",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetHitboxSizeX",name:"GetHitboxSizeX",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetHitboxSizeY",name:"GetHitboxSizeY",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetHitboxOffsetX",name:"GetHitboxOffsetX",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetHitboxOffsetY",name:"GetHitboxOffsetY",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetExplosionFrames",name:"GetExplosionFrames",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetSpeciesId",name:"GetSpeciesId",pkg:"",typ:$funcType([],[$Int32],false)}];CB.methods=[{prop:"GetId",name:"GetId",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetCountdownNanos",name:"GetCountdownNanos",pkg:"",typ:$funcType([],[$Int64],false)},{prop:"GetBackendUnconfirmedMask",name:"GetBackendUnconfirmedMask",pkg:"",typ:$funcType([],[$Uint64],false)},{prop:"GetBulletLocalIdCounter",name:"GetBulletLocalIdCounter",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetShouldForceResync",name:"GetShouldForceResync",pkg:"",typ:$funcType([],[$Bool],false)},{prop:"GetPlayersArr",name:"GetPlayersArr",pkg:"",typ:$funcType([],[CG],false)},{prop:"GetMeleeBullets",name:"GetMeleeBullets",pkg:"",typ:$funcType([],[CH],false)},{prop:"GetFireballBullets",name:"GetFireballBullets",pkg:"",typ:$funcType([],[CI],false)}];BZ.methods=[{prop:"GetInputFrameId",name:"GetInputFrameId",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetInputList",name:"GetInputList",pkg:"",typ:$funcType([],[CA],false)},{prop:"GetConfirmedList",name:"GetConfirmedList",pkg:"",typ:$funcType([],[$Uint64],false)}];CL.methods=[{prop:"GetSpeed",name:"GetSpeed",pkg:"",typ:$funcType([],[$Int32],false)},{prop:"GetSpeciesId",name:"GetSpeciesId",pkg:"",typ:$funcType([],[$Int],false)},{prop:"GetSpeciesName",name:"GetSpeciesName",pkg:"",typ:$funcType([],[$String],false)}];C.init([]);D.init("",[{prop:"X",name:"X",embedded:false,exported:true,typ:$Float64,tag:""},{prop:"Y",name:"Y",embedded:false,exported:true,typ:$Float64,tag:""}]);E.init("",[{prop:"Anchor",name:"Anchor",embedded:false,exported:true,typ:CE,tag:""},{prop:"Points",name:"Points",embedded:false,exported:true,typ:CF,tag:""}]);F.init("",[{prop:"Id",name:"Id",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"VirtualGridX",name:"VirtualGridX",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"VirtualGridY",name:"VirtualGridY",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"DirX",name:"DirX",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"DirY",name:"DirY",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"VelX",name:"VelX",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"VelY",name:"VelY",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"Speed",name:"Speed",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"BattleState",name:"BattleState",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"JoinIndex",name:"JoinIndex",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"ColliderRadius",name:"ColliderRadius",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"Removed",name:"Removed",embedded:false,exported:true,typ:$Bool,tag:""},{prop:"Score",name:"Score",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"LastMoveGmtMillis",name:"LastMoveGmtMillis",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"FramesToRecover",name:"FramesToRecover",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"FramesInChState",name:"FramesInChState",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"Hp",name:"Hp",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"MaxHp",name:"MaxHp",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"CharacterState",name:"CharacterState",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"InAir",name:"InAir",embedded:false,exported:true,typ:$Bool,tag:""},{prop:"OnWall",name:"OnWall",embedded:false,exported:true,typ:$Bool,tag:""},{prop:"OnWallNormX",name:"OnWallNormX",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"OnWallNormY",name:"OnWallNormY",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"CapturedByInertia",name:"CapturedByInertia",embedded:false,exported:true,typ:$Bool,tag:""},{prop:"ActiveSkillId",name:"ActiveSkillId",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"ActiveSkillHit",name:"ActiveSkillHit",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"FramesInvinsible",name:"FramesInvinsible",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"BulletTeamId",name:"BulletTeamId",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"ChCollisionTeamId",name:"ChCollisionTeamId",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"RevivalVirtualGridX",name:"RevivalVirtualGridX",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"RevivalVirtualGridY",name:"RevivalVirtualGridY",embedded:false,exported:true,typ:$Int32,tag:""}]);G.init("",[{prop:"Dx",name:"Dx",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"Dy",name:"Dy",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"BtnALevel",name:"BtnALevel",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"BtnBLevel",name:"BtnBLevel",embedded:false,exported:true,typ:$Int32,tag:""}]);I.init("",[{prop:"Boundary",name:"Boundary",embedded:false,exported:true,typ:CJ,tag:""}]);J.init("",[{prop:"StartupFrames",name:"StartupFrames",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"CancellableStFrame",name:"CancellableStFrame",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"CancellableEdFrame",name:"CancellableEdFrame",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"ActiveFrames",name:"ActiveFrames",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"HitStunFrames",name:"HitStunFrames",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"BlockStunFrames",name:"BlockStunFrames",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"PushbackVelX",name:"PushbackVelX",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"PushbackVelY",name:"PushbackVelY",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"Damage",name:"Damage",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"SelfLockVelX",name:"SelfLockVelX",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"SelfLockVelY",name:"SelfLockVelY",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"HitboxOffsetX",name:"HitboxOffsetX",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"HitboxOffsetY",name:"HitboxOffsetY",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"HitboxSizeX",name:"HitboxSizeX",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"HitboxSizeY",name:"HitboxSizeY",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"BlowUp",name:"BlowUp",embedded:false,exported:true,typ:$Bool,tag:""},{prop:"ExplosionFrames",name:"ExplosionFrames",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"SpeciesId",name:"SpeciesId",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"CancelTransit",name:"CancelTransit",embedded:false,exported:true,typ:CK,tag:""}]);K.init("",[{prop:"BulletLocalId",name:"BulletLocalId",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"OriginatedRenderFrameId",name:"OriginatedRenderFrameId",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"OffenderJoinIndex",name:"OffenderJoinIndex",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"TeamId",name:"TeamId",embedded:false,exported:true,typ:$Int32,tag:""}]);L.init("",[{prop:"BlState",name:"BlState",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"FramesInBlState",name:"FramesInBlState",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"BattleAttr",name:"BattleAttr",embedded:false,exported:true,typ:BQ,tag:""},{prop:"Bullet",name:"Bullet",embedded:false,exported:true,typ:BR,tag:""}]);M.init("",[{prop:"VirtualGridX",name:"VirtualGridX",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"VirtualGridY",name:"VirtualGridY",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"DirX",name:"DirX",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"DirY",name:"DirY",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"VelX",name:"VelX",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"VelY",name:"VelY",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"Speed",name:"Speed",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"BlState",name:"BlState",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"FramesInBlState",name:"FramesInBlState",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"BattleAttr",name:"BattleAttr",embedded:false,exported:true,typ:BQ,tag:""},{prop:"Bullet",name:"Bullet",embedded:false,exported:true,typ:BR,tag:""}]);N.init("",[{prop:"BattleLocalId",name:"BattleLocalId",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"RecoveryFrames",name:"RecoveryFrames",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"RecoveryFramesOnBlock",name:"RecoveryFramesOnBlock",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"RecoveryFramesOnHit",name:"RecoveryFramesOnHit",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"ReleaseTriggerType",name:"ReleaseTriggerType",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"BoundChState",name:"BoundChState",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"Hits",name:"Hits",embedded:false,exported:true,typ:BP,tag:""}]);O.init("",[{prop:"Id",name:"Id",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"PlayersArr",name:"PlayersArr",embedded:false,exported:true,typ:CG,tag:""},{prop:"CountdownNanos",name:"CountdownNanos",embedded:false,exported:true,typ:$Int64,tag:""},{prop:"MeleeBullets",name:"MeleeBullets",embedded:false,exported:true,typ:CH,tag:""},{prop:"FireballBullets",name:"FireballBullets",embedded:false,exported:true,typ:CI,tag:""},{prop:"BackendUnconfirmedMask",name:"BackendUnconfirmedMask",embedded:false,exported:true,typ:$Uint64,tag:""},{prop:"ShouldForceResync",name:"ShouldForceResync",embedded:false,exported:true,typ:$Bool,tag:""},{prop:"BulletLocalIdCounter",name:"BulletLocalIdCounter",embedded:false,exported:true,typ:$Int32,tag:""}]);P.init("",[{prop:"InputFrameId",name:"InputFrameId",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"InputList",name:"InputList",embedded:false,exported:true,typ:CA,tag:""},{prop:"ConfirmedList",name:"ConfirmedList",embedded:false,exported:true,typ:$Uint64,tag:""}]);Q.init("",[{prop:"FlAct",name:"FlAct",embedded:false,exported:true,typ:$Uint64,tag:""},{prop:"FrAct",name:"FrAct",embedded:false,exported:true,typ:$Uint64,tag:""},{prop:"X",name:"X",embedded:false,exported:true,typ:$Float64,tag:""},{prop:"Y",name:"Y",embedded:false,exported:true,typ:$Float64,tag:""}]);S.init("",[{prop:"SpeciesId",name:"SpeciesId",embedded:false,exported:true,typ:$Int,tag:""},{prop:"SpeciesName",name:"SpeciesName",embedded:false,exported:true,typ:$String,tag:""},{prop:"InAirIdleFrameIdxTurningPoint",name:"InAirIdleFrameIdxTurningPoint",embedded:false,exported:true,typ:$Int,tag:""},{prop:"InAirIdleFrameIdxTurnedCycle",name:"InAirIdleFrameIdxTurnedCycle",embedded:false,exported:true,typ:$Int,tag:""},{prop:"LayDownFrames",name:"LayDownFrames",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"LayDownFramesToRecover",name:"LayDownFramesToRecover",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"GetUpInvinsibleFrames",name:"GetUpInvinsibleFrames",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"GetUpFramesToRecover",name:"GetUpFramesToRecover",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"Speed",name:"Speed",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"JumpingInitVelY",name:"JumpingInitVelY",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"JumpingFramesToRecover",name:"JumpingFramesToRecover",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"DashingEnabled",name:"DashingEnabled",embedded:false,exported:true,typ:$Bool,tag:""},{prop:"OnWallEnabled",name:"OnWallEnabled",embedded:false,exported:true,typ:$Bool,tag:""},{prop:"WallJumpingFramesToRecover",name:"WallJumpingFramesToRecover",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"WallJumpingInitVelX",name:"WallJumpingInitVelX",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"WallJumpingInitVelY",name:"WallJumpingInitVelY",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"WallSlidingVelY",name:"WallSlidingVelY",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"InertiaFramesToRecover",name:"InertiaFramesToRecover",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"SkillMapper",name:"SkillMapper",embedded:false,exported:true,typ:CM,tag:""}]);AH.init("",[{prop:"Overlap",name:"Overlap",embedded:false,exported:true,typ:$Float64,tag:""},{prop:"OverlapX",name:"OverlapX",embedded:false,exported:true,typ:$Float64,tag:""},{prop:"OverlapY",name:"OverlapY",embedded:false,exported:true,typ:$Float64,tag:""},{prop:"AContainedInB",name:"AContainedInB",embedded:false,exported:true,typ:$Bool,tag:""},{prop:"BContainedInA",name:"BContainedInA",embedded:false,exported:true,typ:$Bool,tag:""},{prop:"Axis",name:"Axis",embedded:false,exported:true,typ:B.Vector,tag:""}]);$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=A.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=B.$init();$s=2;case 2:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$pkg.DIRECTION_DECODER=new BO([new BN([0,0]),new BN([0,2]),new BN([0,-2]),new BN([2,0]),new BN([-2,0]),new BN([1,1]),new BN([-1,-1]),new BN([1,-1]),new BN([-1,1])]);U=$makeMap($Int.keyFor,[{k:1,v:new N.ptr(0,30,30,30,1,2,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(7,13,30,22,13,9,5,0,5,1,-1,120,0,240,320,false,9,1,$makeMap($Int.keyFor,[{k:1,v:2}])))]))},{k:2,v:new N.ptr(0,36,36,36,1,11,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(18,22,36,18,18,9,5,0,5,1,-1,180,0,240,320,false,9,1,$makeMap($Int.keyFor,[{k:1,v:3}])))]))},{k:3,v:new N.ptr(0,50,50,50,1,12,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(8,0,0,30,999999999,9,20,70,10,5,50,160,80,320,320,true,9,1,false))]))},{k:4,v:new N.ptr(0,30,30,30,1,2,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(7,13,30,22,13,9,5,0,5,1,-1,120,0,240,320,false,15,2,$makeMap($Int.keyFor,[{k:1,v:5}])))]))},{k:5,v:new N.ptr(0,36,36,36,1,11,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(18,23,36,18,18,9,5,0,5,1,-1,180,0,240,320,false,15,2,$makeMap($Int.keyFor,[{k:1,v:6}])))]))},{k:6,v:new N.ptr(0,45,45,45,1,12,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(8,0,0,28,999999999,9,20,30,10,-1,-1,240,0,320,320,true,15,2,false))]))},{k:7,v:new N.ptr(0,30,30,30,1,2,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(7,13,30,22,13,9,5,0,5,-1,-1,120,0,240,320,false,9,1,$makeMap($Int.keyFor,[{k:1,v:8}])))]))},{k:8,v:new N.ptr(0,36,36,36,1,11,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(18,22,36,18,18,9,5,0,5,1,-1,180,0,240,320,false,9,1,$makeMap($Int.keyFor,[{k:1,v:9}])))]))},{k:9,v:new N.ptr(0,40,40,40,1,12,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(7,0,0,30,999999999,9,20,40,10,10,-1,100,0,320,320,true,9,1,false))]))},{k:10,v:new N.ptr(0,38,38,38,1,13,new BP([new M.ptr(0,0,0,0,0,0,60,0,0,BQ.nil,new J.ptr(10,0,0,999999999,15,9,20,0,22,-1,-1,320,100,640,480,false,30,1,false))]))},{k:11,v:new N.ptr(0,60,60,60,1,14,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(3,0,0,25,999999999,9,20,70,35,10,80,80,0,400,640,true,15,3,false))]))},{k:12,v:new N.ptr(0,10,10,10,1,15,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(3,0,0,0,0,0,-1,-1,0,60,0,0,0,0,0,false,0,0,false))]))},{k:13,v:new N.ptr(0,12,12,12,1,15,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(3,0,0,0,0,0,-1,-1,0,80,0,0,0,0,0,false,0,0,false))]))},{k:14,v:new N.ptr(0,8,8,8,1,15,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(4,0,0,0,999999999,0,-1,-1,0,50,0,0,0,0,0,false,0,0,false))]))},{k:15,v:new N.ptr(0,48,48,48,1,13,new BP([new M.ptr(0,0,0,0,0,0,40,0,0,BQ.nil,new J.ptr(12,0,0,999999999,15,9,30,0,18,-1,-1,240,80,480,320,false,30,2,false))]))},{k:16,v:new N.ptr(0,60,60,60,1,13,new BP([new M.ptr(0,0,0,0,0,0,40,0,0,BQ.nil,new J.ptr(16,0,0,999999999,999999999,9,30,70,30,-1,-1,240,80,480,320,true,30,3,false))]))},{k:255,v:new N.ptr(0,30,30,30,1,6,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(3,0,0,20,18,9,5,0,5,-1,-1,120,0,320,240,false,9,1,false))]))},{k:256,v:new N.ptr(0,20,20,20,1,6,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(3,0,0,10,15,9,5,0,5,-1,-1,120,0,320,240,false,15,2,false))]))},{k:257,v:new N.ptr(0,30,30,30,1,6,new BP([new L.ptr(0,0,BQ.nil,new J.ptr(4,0,0,20,9,5,5,0,5,-1,-1,120,0,320,240,false,9,1,false))]))}]);$pkg.Characters=$makeMap($Int.keyFor,[{k:0,v:new S.ptr(0,"MonkGirl",11,1,16,16,10,27,21,80,2,true,true,8,28,70,-10,9,T)},{k:1,v:new S.ptr(1,"KnifeGirl",9,1,16,16,10,27,22,75,2,true,true,8,28,70,-10,9,T)},{k:4096,v:new S.ptr(4096,"Monk",42,2,14,14,8,30,18,78,2,true,false,0,0,0,0,9,T)}]);V=$makeMap($Int32.keyFor,[{k:4,v:true},{k:5,v:true},{k:6,v:true},{k:7,v:true},{k:8,v:true},{k:16,v:true},{k:15,v:true}]);W=$makeMap($Int32.keyFor,[{k:3,v:true},{k:7,v:true},{k:8,v:true},{k:9,v:true},{k:18,v:true}]);X=$makeMap($Int32.keyFor,[{k:8,v:true},{k:9,v:true},{k:10,v:true},{k:18,v:true}]);Y=$makeMap($Int32.keyFor,[{k:0,v:true},{k:1,v:true},{k:4,v:true},{k:5,v:true},{k:3,v:true},{k:7,v:true},{k:8,v:true},{k:9,v:true},{k:10,v:true},{k:18,v:true}]);}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})(); $packages["jsexport"]=(function(){var $pkg={},$init,A,B,C,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO,AP,AQ,AR,AS,AT,AU,AV,AW,AX,AY,AZ,BA,BB,BC,BD,BE,BF,BG,BH,BI,BJ,BK,BL,BM,BN,BO,BP,BQ,BR,BS,BT,BU,BV,BW,BX,BY,BZ,CA,CB,CC,CD,CE,CF,CG,CH,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,AB,AC,AD;A=$packages["github.com/gopherjs/gopherjs/js"];B=$packages["jsexport/battle"];C=$packages["resolv"];AE=$ptrType(A.Object);AF=$sliceType(AE);AG=$sliceType($Uint64);AH=$ptrType(B.Vec2D);AI=$sliceType(AH);AJ=$ptrType(B.Polygon2D);AK=$ptrType(B.CharacterConfig);AL=$ptrType(B.RoomDownsyncFrame);AM=$ptrType(B.InputFrameDownsync);AN=$funcType([$Float64,$Float64],[AE],false);AO=$funcType([AH,AI],[AE],false);AP=$funcType([AJ],[AE],false);AQ=$funcType([$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Bool,$Bool,$Int32,$Int32,$Bool,$Int32,$Int32,$Int32,$Int32],[AE],false);AR=$funcType([$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Bool,$Int32,$Int32,$Int32,$Int32,$Int32],[AE],false);AS=$funcType([$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Bool,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32,$Int32],[AE],false);AT=$funcType([$Uint64,$Uint64,$Float64,$Float64],[AE],false);AU=$ptrType(B.PlayerDownsync);AV=$sliceType(AU);AW=$ptrType(B.MeleeBullet);AX=$sliceType(AW);AY=$ptrType(B.FireballBullet);AZ=$sliceType(AY);BA=$funcType([$Int32,AV,$Int32,AX,AZ],[AE],false);BB=$funcType([$Int,$Int,$Int,$Int],[AE],false);BC=$funcType([],[AE],false);BD=$funcType([$Int32,AG,$Uint64],[AE],false);BE=$funcType([$Int32],[AE],false);BF=$funcType([AJ,$Float64,$Float64,$emptyInterface,$String],[AE],false);BG=$ptrType(C.Space);BH=$funcType([BG],[AF],false);BI=$funcType([$Float64,$Float64,$Float64,$Float64,$Float64,$Float64,$Float64,$Float64,$Float64,$Float64],[$Float64,$Float64],false);BJ=$funcType([$Float64,$Float64],[$Int32,$Int32],false);BK=$funcType([$Int32,$Int32],[$Float64,$Float64],false);BL=$sliceType($Int);BM=$funcType([BL],[AF],false);BN=$ptrType(C.RingBuffer);BO=$ptrType(C.Object);BP=$mapType($Int32,BO);BQ=$sliceType(AK);BR=$ptrType(C.Collision);BS=$sliceType(AI);BT=$sliceType($Bool);BU=$sliceType(BO);BV=$sliceType($Int32);BW=$funcType([BN,$Int32,BG,BP,$Float64,$Float64,BQ,BN,BR,AI,BS,BT,BU,BV,AG,$Bool,$Int32],[$Bool],false);BX=$funcType([$Int32],[$Int32],false);BY=$funcType([$Int32],[$Bool],false);BZ=$funcType([$Int32,$Int32,$Int32,$Int32,$Int32],[$Bool],false);CA=$funcType([BN,$Int32],[AE],false);CB=$funcType([AL,$Int],[AE],false);CC=$funcType([AM,$Int],[$Uint64],false);CD=$funcType([$Int],[AF],false);CE=$funcType([AM,$Int32],[$Bool],false);CF=$funcType([AM,$Int,$Uint64],[$Bool],false);CG=$funcType([AM,$Uint64],[$Bool],false);CH=$mapType($String,$emptyInterface);D=function(a){var{a,b,c,d,e,$s,$r,$c}=$restore(this,{a});$s=$s||0;s:while(true){switch($s){case 0:b=$makeSlice(AF,a);c=0;case 1:if(!(c=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+c]=e);c=c+(1)>>0;$s=1;continue;case 2:$s=-1;return b;}return;}var $f={$blk:D,$c:true,$r,a,b,c,d,e,$s};return $f;};$pkg.NewDynamicRectangleColliders=D;E=function(){return A.MakeWrapper(C.NewCollision());};$pkg.NewCollisionHolder=E;F=function(a,b,c){var a,b,c;return A.MakeWrapper(new B.InputFrameDownsync.ptr(a,b,c));};$pkg.NewInputFrameDownsync=F;G=function(a){var a;return A.MakeWrapper(C.NewRingBuffer(a));};$pkg.NewRingBufferJs=G;H=function(a,b,c,d){var a,b,c,d;return A.MakeWrapper(C.NewSpace(a,b,c,d));};$pkg.NewCollisionSpaceJs=H;I=function(a,b){var a,b;return A.MakeWrapper(new B.Vec2D.ptr(a,b));};$pkg.NewVec2DJs=I;J=function(a,b){var a,b;return A.MakeWrapper(new B.Polygon2D.ptr(a,b));};$pkg.NewPolygon2DJs=J;K=function(a){var a;return A.MakeWrapper(new B.Barrier.ptr(a));};$pkg.NewBarrierJs=K;L=function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,ab){var a,aa,ab,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;return A.MakeWrapper(B.NewPlayerDownsync(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,ab));};$pkg.NewPlayerDownsyncJs=L;M=function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x;return A.MakeWrapper(B.NewMeleeBullet(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x));};$pkg.NewMeleeBulletJs=M;N=function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,ab,ac,ad,ae){var a,aa,ab,ac,ad,ae,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;return A.MakeWrapper(B.NewFireballBullet(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,ab,ac,ad,ae));};$pkg.NewFireballBulletJs=N;O=function(a,b,c,d){var a,b,c,d;return A.MakeWrapper(new B.NpcPatrolCue.ptr(a,b,c,d));};$pkg.NewNpcPatrolCue=O;P=function(a,b,c,d,e){var a,b,c,d,e,f;f=B.NewPreallocatedRoomDownsyncFrame(b.$length,64,64);B.CloneRoomDownsyncFrame(a,b,c,d,e,f);return A.MakeWrapper(f);};$pkg.NewRoomDownsyncFrameJs=P;Q=function(a){var a,b,c,d,e,f,g;b=a.Objects();c=$makeSlice(AF,b.$length);d=b;e=0;while(true){if(!(e=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+e]);((f<0||f>=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+f]=A.MakeWrapper(g));e++;}return c;};$pkg.GetCollisionSpaceObjsJs=Q;R=function(a,b,c,d,e){var{a,b,c,d,e,f,g,h,$s,$r,$c}=$restore(this,{a,b,c,d,e});$s=$s||0;s:while(true){switch($s){case 0:f=B.GenerateConvexPolygonCollider(a,b,c,d,e);$s=1;case 1:if($c){$c=false;f=f.$blk();}if(f&&f.$blk!==undefined){break s;}g=A.MakeWrapper(f);$s=2;case 2:if($c){$c=false;g=g.$blk();}if(g&&g.$blk!==undefined){break s;}h=g;$s=3;case 3:return h;}return;}var $f={$blk:R,$c:true,$r,a,b,c,d,e,f,g,h,$s};return $f;};$pkg.GenerateConvexPolygonColliderJs=R;S=function(a){var{a,b,c,d,e,f,g,h,$s,$r,$c}=$restore(this,{a});$s=$s||0;s:while(true){switch($s){case 0:b=$makeSlice(AF,a.$length,a.$length);c=a;d=0;case 1:if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);h=A.MakeFullWrapper((g=B.Characters[$Int.keyFor(f)],g!==undefined?g.v:AK.nil));$s=3;case 3:if($c){$c=false;h=h.$blk();}if(h&&h.$blk!==undefined){break s;}((e<0||e>=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+e]=h);d++;$s=1;continue;case 2:$s=-1;return b;}return;}var $f={$blk:S,$c:true,$r,a,b,c,d,e,f,g,h,$s};return $f;};$pkg.GetCharacterConfigsOrderedByJoinIndex=S;T=function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q){var{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,$s,$r,$c}=$restore(this,{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q});$s=$s||0;s:while(true){switch($s){case 0:r=B.ApplyInputFrameDownsyncDynamicsOnSingleRenderFrame(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q);$s=1;case 1:if($c){$c=false;r=r.$blk();}if(r&&r.$blk!==undefined){break s;}s=r;$s=2;case 2:return s;}return;}var $f={$blk:T,$c:true,$r,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,$s};return $f;};$pkg.ApplyInputFrameDownsyncDynamicsOnSingleRenderFrameJs=T;U=function(a,b){var a,b,c;c=a.GetByFrameId(b);if($interfaceIsEqual($ifaceNil,c)){return null;}return A.MakeWrapper($assertType(c,AL));};$pkg.GetRoomDownsyncFrame=U;V=function(a,b){var a,b,c;c=a.GetByFrameId(b);if($interfaceIsEqual($ifaceNil,c)){return null;}return A.MakeWrapper($assertType(c,AM));};$pkg.GetInputFrameDownsync=V;W=function(a,b){var a,b,c;return(c=a.InputList,((b<0||b>=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+b]));};$pkg.GetInput=W;X=function(a,b){var a,b;a.InputFrameId=b;return true;};$pkg.SetInputFrameId=X;Y=function(a,b,c){var a,b,c,d;if(b>=a.InputList.$length){return false;}(d=a.InputList,((b<0||b>=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+b]=c));return true;};$pkg.SetInput=Y;Z=function(a,b){var a,b;a.ConfirmedList=b;return true;};$pkg.SetConfirmedList=Z;AA=function(a,b){var a,b,c;return A.MakeWrapper((c=a.PlayersArr,((b<0||b>=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+b])));};$pkg.GetPlayer=AA;AB=function(a,b){var a,b,c,d;if(-1===(c=a.MeleeBullets,((b<0||b>=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+b])).GetBulletLocalId()){return null;}return A.MakeWrapper((d=a.MeleeBullets,((b<0||b>=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+b])));};$pkg.GetMeleeBullet=AB;AC=function(a,b){var a,b,c,d;if(-1===(c=a.FireballBullets,((b<0||b>=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+b])).GetBulletLocalId()){return null;}return A.MakeWrapper((d=a.FireballBullets,((b<0||b>=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+b])));};$pkg.GetFireballBullet=AC;AD=function(){$global.gopkgs=$externalize($makeMap($String.keyFor,[{k:"NewVec2DJs",v:new AN(I)},{k:"NewPolygon2DJs",v:new AO(J)},{k:"NewBarrierJs",v:new AP(K)},{k:"NewPlayerDownsyncJs",v:new AQ(L)},{k:"NewMeleeBulletJs",v:new AR(M)},{k:"NewFireballBulletJs",v:new AS(N)},{k:"NewNpcPatrolCue",v:new AT(O)},{k:"NewRoomDownsyncFrameJs",v:new BA(P)},{k:"NewCollisionSpaceJs",v:new BB(H)},{k:"NewCollisionHolder",v:new BC(E)},{k:"NewInputFrameDownsync",v:new BD(F)},{k:"NewRingBufferJs",v:new BE(G)},{k:"GenerateConvexPolygonColliderJs",v:new BF(R)},{k:"GetCollisionSpaceObjsJs",v:new BH(Q)},{k:"WorldToPolygonColliderBLPos",v:new BI(B.WorldToPolygonColliderBLPos)},{k:"PolygonColliderBLToWorldPos",v:new BI(B.PolygonColliderBLToWorldPos)},{k:"WorldToVirtualGridPos",v:new BJ(B.WorldToVirtualGridPos)},{k:"VirtualGridToWorldPos",v:new BK(B.VirtualGridToWorldPos)},{k:"GetCharacterConfigsOrderedByJoinIndex",v:new BM(S)},{k:"ApplyInputFrameDownsyncDynamicsOnSingleRenderFrameJs",v:new BW(T)},{k:"ConvertToDelayedInputFrameId",v:new BX(B.ConvertToDelayedInputFrameId)},{k:"ConvertToNoDelayInputFrameId",v:new BX(B.ConvertToNoDelayInputFrameId)},{k:"ConvertToFirstUsedRenderFrameId",v:new BX(B.ConvertToFirstUsedRenderFrameId)},{k:"ConvertToLastUsedRenderFrameId",v:new BX(B.ConvertToLastUsedRenderFrameId)},{k:"ShouldGenerateInputFrameUpsync",v:new BY(B.ShouldGenerateInputFrameUpsync)},{k:"IsGeneralBulletActive",v:new BZ(B.IsGeneralBulletActive)},{k:"GetRoomDownsyncFrame",v:new CA(U)},{k:"GetInputFrameDownsync",v:new CA(V)},{k:"GetPlayer",v:new CB(AA)},{k:"GetMeleeBullet",v:new CB(AB)},{k:"GetFireballBullet",v:new CB(AC)},{k:"GetInput",v:new CC(W)},{k:"NewDynamicRectangleColliders",v:new CD(D)},{k:"SetInputFrameId",v:new CE(X)},{k:"SetInput",v:new CF(Y)},{k:"SetConfirmedList",v:new CG(Z)}]),CH);};$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=A.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=B.$init();$s=2;case 2:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=C.$init();$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}if($pkg===$mainPkg){AD();$mainFinished=true;}}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})(); $synthesizeMethods(); $initAllLinknames(); diff --git a/jsexport/battle/battle.go b/jsexport/battle/battle.go index 6076cf4..916d137 100644 --- a/jsexport/battle/battle.go +++ b/jsexport/battle/battle.go @@ -7,7 +7,7 @@ import ( ) const ( - MAX_FLOAT64 = 1.7e+308 + MAX_FLOAT64 = resolv.MaxFloat64 MAX_INT32 = int32(999999999) COLLISION_PLAYER_INDEX_PREFIX = (1 << 17) COLLISION_BARRIER_INDEX_PREFIX = (1 << 16) diff --git a/resolv_tailored/collision.go b/resolv_tailored/collision.go index d66348d..6a59415 100644 --- a/resolv_tailored/collision.go +++ b/resolv_tailored/collision.go @@ -135,10 +135,10 @@ func (cc *Collision) SlideAgainstCell(cell *Cell, avoidTags ...string) Vector { diffX := oX - ccX diffY := oY - ccY - left := sp.Cell(collidingCell.X-1, collidingCell.Y) - right := sp.Cell(collidingCell.X+1, collidingCell.Y) - up := sp.Cell(collidingCell.X, collidingCell.Y-1) - down := sp.Cell(collidingCell.X, collidingCell.Y+1) + left := sp.GetCell(collidingCell.X-1, collidingCell.Y) + right := sp.GetCell(collidingCell.X+1, collidingCell.Y) + up := sp.GetCell(collidingCell.X, collidingCell.Y-1) + down := sp.GetCell(collidingCell.X, collidingCell.Y+1) slide := Vector{0, 0} diff --git a/resolv_tailored/object.go b/resolv_tailored/object.go index 85be10e..26b97c1 100644 --- a/resolv_tailored/object.go +++ b/resolv_tailored/object.go @@ -1,9 +1,5 @@ package resolv -import ( - "math" -) - // Object represents an object that can be spread across one or more Cells in a Space. An Object is essentially an AABB (Axis-Aligned Bounding Box) Rectangle. type Object struct { Shape Shape // A shape for more specific collision-checking. @@ -93,7 +89,7 @@ func (obj *Object) Update() { for x := cx; x <= ex; x++ { - c := obj.Space.Cell(x, y) + c := obj.Space.GetCell(x, y) if c != nil { c.register(obj) @@ -256,15 +252,15 @@ func (obj *Object) CheckAllWithHolder(dx, dy float64, cc *Collision) bool { cc.checkingObject = obj if dx < 0 { - dx = math.Min(dx, -1) + dx = Min(dx, -1) } else if dx > 0 { - dx = math.Max(dx, 1) + dx = Max(dx, 1) } if dy < 0 { - dy = math.Min(dy, -1) + dy = Min(dy, -1) } else if dy > 0 { - dy = math.Max(dy, 1) + dy = Max(dy, 1) } cc.dx = dx @@ -279,7 +275,7 @@ func (obj *Object) CheckAllWithHolder(dx, dy float64, cc *Collision) bool { for x := cx; x <= ex; x++ { - if c := obj.Space.Cell(x, y); c != nil { + if c := obj.Space.GetCell(x, y); c != nil { rb := c.Objects for i := rb.StFrameId; i < rb.EdFrameId; i++ { diff --git a/resolv_tailored/ringbuf.go b/resolv_tailored/ringbuf.go index 06d7144..031ae68 100644 --- a/resolv_tailored/ringbuf.go +++ b/resolv_tailored/ringbuf.go @@ -1,9 +1,10 @@ package resolv const ( - RING_BUFF_CONSECUTIVE_SET = int32(0) - RING_BUFF_NON_CONSECUTIVE_SET = int32(1) - RING_BUFF_FAILED_TO_SET = int32(2) + // Declare type "int32" explicitly to prevent go2cs from transpiling them to "var" + RING_BUFF_CONSECUTIVE_SET int32 = 0 + RING_BUFF_NON_CONSECUTIVE_SET int32 = 1 + RING_BUFF_FAILED_TO_SET int32 = 2 ) type AnyObj interface{} diff --git a/resolv_tailored/shape.go b/resolv_tailored/shape.go index 6aba68c..620babd 100644 --- a/resolv_tailored/shape.go +++ b/resolv_tailored/shape.go @@ -1,9 +1,5 @@ package resolv -import ( - "math" -) - type Shape interface { // Intersection tests to see if a Shape intersects with the other given Shape. dx and dy are delta movement variables indicating // movement to be applied before the intersection check (thereby allowing you to see if a Shape would collide with another if it @@ -187,7 +183,7 @@ func (cp *ConvexPolygon) Bounds() (Vector, Vector) { transformed := cp.Transformed() topLeft := Vector{transformed[0][0], transformed[0][1]} - bottomRight := topLeft.Clone() + bottomRight := Vector{transformed[0][0], transformed[0][1]} for i := 0; i < len(transformed); i++ { @@ -224,8 +220,8 @@ func (cp *ConvexPolygon) SetPosition(x, y float64) { // SetPositionVec allows you to set the position of the ConvexPolygon using a Vector. The offset of the vertices compared to the X and Y // position is relative to however you initially defined the polygon and added the vertices. func (cp *ConvexPolygon) SetPositionVec(vec Vector) { - cp.X = vec.X() - cp.Y = vec.Y() + cp.X = vec.GetX() + cp.Y = vec.GetY() } // Move translates the ConvexPolygon by the designated X and Y values. @@ -236,8 +232,8 @@ func (cp *ConvexPolygon) Move(x, y float64) { // MoveVec translates the ConvexPolygon by the designated Vector. func (cp *ConvexPolygon) MoveVec(vec Vector) { - cp.X += vec.X() - cp.Y += vec.Y() + cp.X += vec.GetX() + cp.Y += vec.GetY() } // SATAxes returns the axes of the ConvexPolygon for SAT intersection testing. @@ -403,22 +399,3 @@ func NewRectangle(x, y, w, h float64) *ConvexPolygon { x, y+h, ) } - -type Projection struct { - Min, Max float64 -} - -// Overlapping returns whether a Projection is overlapping with the other, provided Projection. Credit to https://www.sevenson.com.au/programming/sat/ -func (projection Projection) Overlapping(other Projection) bool { - return projection.Overlap(other) > 0 -} - -// Overlap returns the amount that a Projection is overlapping with the other, provided Projection. Credit to https://dyn4j.org/2010/01/sat/#sat-nointer -func (projection Projection) Overlap(other Projection) float64 { - return math.Min(projection.Max, other.Max) - math.Max(projection.Min, other.Min) -} - -// IsInside returns whether the Projection is wholly inside of the other, provided Projection. -func (projection Projection) IsInside(other Projection) bool { - return projection.Min >= other.Min && projection.Max <= other.Max -} diff --git a/resolv_tailored/simple_math.go b/resolv_tailored/simple_math.go new file mode 100644 index 0000000..4867273 --- /dev/null +++ b/resolv_tailored/simple_math.go @@ -0,0 +1,112 @@ +package resolv + +import "unsafe" + +const ( + uvnan = 0x7FF8000000000001 + uvinf = 0x7FF0000000000000 + uvneginf = 0xFFF0000000000000 + uvone = 0x3FF0000000000000 + mask = 0x7FF + shift = 64 - 11 - 1 + bias = 1023 + signMask = 1 << 63 + fracMask = 1< b { + return a + } else { + return b + } +} + +func Min(a, b float64) float64 { + if a < b { + return a + } else { + return b + } +} + +func Floor(x float64) float64 { + if x == 0 || IsInf(x, 0) || IsNaN(x) { + return x + } + if x < 0 { + d, fract := Modf(-x) + if fract != 0.0 { + d = d + 1 + } + return -d + } + d, _ := Modf(x) + return d +} + +func Modf(f float64) (outval float64, frac float64) { + if f < 1 { + if f < 0 { + outval1, frac1 := Modf(-f) + return -outval1, -frac1 + } else if f == 0 { + return f, f // Return -0, -0 when f == -0 + } + return 0, f + } + + x := Float64bits(f) + e := ((uint)(x>>shift))&mask - bias + + // Keep the top 12+e bits, the integer part; clear the rest. + if e < 64-12 { + x &^= 1<<(64-12-e) - 1 + } + outval = Float64frombits(x) + frac = f - outval + return +} + +func Float32bits(f float32) uint32 { return *(*uint32)(unsafe.Pointer(&f)) } +func Float32frombits(b uint32) float32 { return *(*float32)(unsafe.Pointer(&b)) } +func Float64bits(f float64) uint64 { return *(*uint64)(unsafe.Pointer(&f)) } +func Float64frombits(b uint64) float64 { return *(*float64)(unsafe.Pointer(&b)) } + +func NaN() float64 { return Float64frombits(uvnan) } + +func IsNaN(f float64) (is bool) { + return f != f +} + +func IsInf(f float64, sign int) bool { + return sign >= 0 && f > MaxFloat64 || sign <= 0 && f < -MaxFloat64 +} + +// FastInvSqrt reference https://medium.com/@adrien.za/fast-inverse-square-root-in-go-and-javascript-for-fun-6b891e74e5a8 +func FastInvSqrt32(n float32) float32 { + if n < 0 { + return float32(NaN()) + } + n2, th := n*0.5, float32(1.5) + b := Float32bits(n) + b = magic32 - (b >> 1) + f := Float32frombits(b) + f *= th - (n2 * f * f) + return f +} + +func FastInvSqrt64(n float64) float64 { + if n < 0 { + return NaN() + } + n2, th := n*0.5, float64(1.5) + b := Float64bits(n) + b = magic64 - (b >> 1) + f := Float64frombits(b) + f *= th - (n2 * f * f) + return f +} diff --git a/resolv_tailored/space.go b/resolv_tailored/space.go index a7390f8..b5927ee 100644 --- a/resolv_tailored/space.go +++ b/resolv_tailored/space.go @@ -1,9 +1,5 @@ package resolv -import ( - "math" -) - // Space represents a collision space. Internally, each Space contains a 2D array of Cells, with each Cell being the same size. Cells contain information on which // Objects occupy those spaces. type Space struct { @@ -128,9 +124,7 @@ func (sp *Space) Resize(width, height int) { } } -// Cell returns the Cell at the given cellular / spatial (not world) X and Y position in the Space. If the X and Y position are -// out of bounds, Cell() will return nil. -func (sp *Space) Cell(x, y int) *Cell { +func (sp *Space) GetCell(x, y int) *Cell { if y >= 0 && y < len(sp.Cells) && x >= 0 && x < len(sp.Cells[y]) { return sp.Cells[y][x] @@ -147,7 +141,7 @@ func (sp *Space) CheckCells(x, y, w, h int, tags ...string) *Object { for iy := y; iy < y+h; iy++ { - cell := sp.Cell(ix, iy) + cell := sp.GetCell(ix, iy) if cell != nil { rb := cell.Objects @@ -205,8 +199,8 @@ func (sp *Space) UnregisterAllObjects() { // WorldToSpace converts from a world position (x, y) to a position in the Space (a grid-based position). func (sp *Space) WorldToSpace(x, y float64) (int, int) { // [WARNING] DON'T use "int(...)" syntax to convert float to int, it's not supported by go2cs! - var fx int = (int)(math.Floor(x / float64(sp.CellWidth))) - var fy int = (int)(math.Floor(y / float64(sp.CellHeight))) + var fx int = (int)(Floor(x / float64(sp.CellWidth))) + var fy int = (int)(Floor(y / float64(sp.CellHeight))) return fx, fy } @@ -233,8 +227,8 @@ func (sp *Space) Width() int { func (sp *Space) CellsInLine(startX, startY, endX, endY int) []*Cell { cells := []*Cell{} - cell := sp.Cell(startX, startY) - endCell := sp.Cell(endX, endY) + cell := sp.GetCell(startX, startY) + endCell := sp.GetCell(endX, endY) if cell != nil && endCell != nil { @@ -263,7 +257,7 @@ func (sp *Space) CellsInLine(startX, startY, endX, endY int) []*Cell { } cx, cy := sp.WorldToSpace(p[0], p[1]) - c := sp.Cell(cx, cy) + c := sp.GetCell(cx, cy) if c != cell { cell = c } diff --git a/resolv_tailored/vector.go b/resolv_tailored/vector.go index db12eed..775c48f 100644 --- a/resolv_tailored/vector.go +++ b/resolv_tailored/vector.go @@ -1,8 +1,6 @@ package resolv -import ( - "math" -) +import "math" // Vector is the definition of a row vector that contains scalars as // 64 bit floats @@ -14,35 +12,13 @@ type Axis int const ( // the consts below are used to represent vector axis, they are useful // to lookup values within the vector. - X Axis = iota - Y - Z + X Axis = 0 + Y Axis = 1 + Z Axis = 2 ) -// Clone a vector -func Clone(v Vector) Vector { - return v.Clone() -} - -// Clone a vector -func (v Vector) Clone() Vector { - clone := make(Vector, len(v)) - copy(clone, v) - return clone -} - -// Magnitude of a vector -func Magnitude(v Vector) float64 { - return v.Magnitude() -} - -// Magnitude of a vector -func (v Vector) Magnitude() float64 { - return math.Sqrt(v.Magnitude2()) -} - func (v Vector) Magnitude2() float64 { - var result float64 + var result float64 = 0. for _, scalar := range v { result += scalar * scalar @@ -51,21 +27,19 @@ func (v Vector) Magnitude2() float64 { return result } -// Unit returns a direction vector with the length of one. -func Unit(v Vector) Vector { - return v.Clone().Unit() -} - // Unit returns a direction vector with the length of one. func (v Vector) Unit() Vector { - l := v.Magnitude() - - if l < 1e-8 { + l2 := v.Magnitude2() + if l2 < 1e-16 { return v } + l := math.Sqrt(l2) + //inv := FastInvSqrt64(l2) // "Fast Inverse Square Root" is arch dependent, it's by far non-trivial to use it in Golang as well as make it feasible in the transpiled JavaScript. + for i := 0; i < len(v); i++ { v[i] = v[i] / l + //v[i] = v[i] * inv } return v @@ -73,7 +47,7 @@ func (v Vector) Unit() Vector { // X is corresponding to doing a v[0] lookup, if index 0 does not exist yet, a // 0 will be returned instead -func (v Vector) X() float64 { +func (v Vector) GetX() float64 { if len(v) < 1 { return 0. } @@ -83,7 +57,7 @@ func (v Vector) X() float64 { // Y is corresponding to doing a v[1] lookup, if index 1 does not exist yet, a // 0 will be returned instead -func (v Vector) Y() float64 { +func (v Vector) GetY() float64 { if len(v) < 2 { return 0. } @@ -93,7 +67,7 @@ func (v Vector) Y() float64 { // Z is corresponding to doing a v[2] lookup, if index 2 does not exist yet, a // 0 will be returned instead -func (v Vector) Z() float64 { +func (v Vector) GetZ() float64 { if len(v) < 3 { return 0. }