diff --git a/frontend/assets/scripts/modules/jsexport.js b/frontend/assets/scripts/modules/jsexport.js index 8b0b0ff..aba7dfd 100644 --- a/frontend/assets/scripts/modules/jsexport.js +++ b/frontend/assets/scripts/modules/jsexport.js @@ -9,7 +9,7 @@ $packages["runtime"]=(function(){var $pkg={},$init,A,C,D,AT,AZ,BD,AM,E,AU;A=$pac $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,GA,GH,GK,GL,GM,GS,GT,GW,GX,GZ,HA,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;GA=function(av){var av;return $parseFloat(FL.cos(av));};$pkg.Cos=GA;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;GX=function(av,aw){var av,aw;if((av===1)||((av===-1)&&((aw===FN)||(aw===FO)))){return 1;}return $parseFloat(FL.pow(av,aw));};$pkg.Pow=GX;GZ=function(av){var av;return av<0||(1/av===FO);};$pkg.Signbit=GZ;HA=function(av){var av;return $parseFloat(FL.sin(av));};$pkg.Sin=HA;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,C,N,P,Q,S,U,X,Z,AA,AE,AG,AI,AJ,AK,AL,AM,AN,AO,AP,AQ,AR,AS,AT,AU,AV,AW,AX,AY,K,O,R,T,V,W,Y,AB,AC,AD,AF,AH;A=$packages["math"];B=$pkg.Vector=$newType(12,$kindSlice,"resolv.Vector",true,"resolv",true,null);C=$pkg.Axis=$newType(4,$kindInt,"resolv.Axis",true,"resolv",true,null);N=$pkg.Space=$newType(0,$kindStruct,"resolv.Space",true,"resolv",true,function(Cells_,CellWidth_,CellHeight_){this.$val=this;if(arguments.length===0){this.Cells=AL.nil;this.CellWidth=0;this.CellHeight=0;return;}this.Cells=Cells_;this.CellWidth=CellWidth_;this.CellHeight=CellHeight_;});P=$pkg.Shape=$newType(8,$kindInterface,"resolv.Shape",true,"resolv",true,null);Q=$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_;});S=$pkg.ConvexPolygon=$newType(0,$kindStruct,"resolv.ConvexPolygon",true,"resolv",true,function(Points_,X_,Y_,Closed_){this.$val=this;if(arguments.length===0){this.Points=AP.nil;this.X=0;this.Y=0;this.Closed=false;return;}this.Points=Points_;this.X=X_;this.Y=Y_;this.Closed=Closed_;});U=$pkg.ContactSet=$newType(0,$kindStruct,"resolv.ContactSet",true,"resolv",true,function(Points_,MTV_,Center_){this.$val=this;if(arguments.length===0){this.Points=AP.nil;this.MTV=B.nil;this.Center=B.nil;return;}this.Points=Points_;this.MTV=MTV_;this.Center=Center_;});X=$pkg.Circle=$newType(0,$kindStruct,"resolv.Circle",true,"resolv",true,function(X_,Y_,Radius_){this.$val=this;if(arguments.length===0){this.X=0;this.Y=0;this.Radius=0;return;}this.X=X_;this.Y=Y_;this.Radius=Radius_;});Z=$pkg.Projection=$newType(0,$kindStruct,"resolv.Projection",true,"resolv",true,function(Min_,Max_){this.$val=this;if(arguments.length===0){this.Min=0;this.Max=0;return;}this.Min=Min_;this.Max=Max_;});AA=$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=AM.nil;this.X=0;this.Y=0;this.W=0;this.H=0;this.TouchingCells=AK.nil;this.Data=$ifaceNil;this.ignoreList=false;this.tags=AV.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_;});AE=$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=AN.nil;this.dx=0;this.dy=0;this.Objects=AO.nil;this.Cells=AK.nil;return;}this.checkingObject=checkingObject_;this.dx=dx_;this.dy=dy_;this.Objects=Objects_;this.Cells=Cells_;});AG=$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=AO.nil;return;}this.X=X_;this.Y=Y_;this.Objects=Objects_;});AI=$sliceType($Float64);AJ=$ptrType(AG);AK=$sliceType(AJ);AL=$sliceType(AK);AM=$ptrType(N);AN=$ptrType(AA);AO=$sliceType(AN);AP=$sliceType(B);AQ=$ptrType(Q);AR=$sliceType(AQ);AS=$ptrType(X);AT=$ptrType(S);AU=$ptrType(U);AV=$sliceType($String);AW=$ptrType(AE);AX=$sliceType(C);AY=$mapType(AN,$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.Add=function(a){var a,b,c,d,e,f;b=this;c=b.$length;d=a;e=0;while(true){if(!(e=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+f]).$length>c){AC($convertSliceType(b,AI),1,$convertSliceType(b,AI),$convertSliceType($subslice(((f<0||f>=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+f]),0,c),AI));}else{AC($convertSliceType(b,AI),1,$convertSliceType(b,AI),$convertSliceType(((f<0||f>=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+f]),AI));}e++;}return b;};$ptrType(B).prototype.Add=function(a){return this.$get().Add(a);};B.prototype.Sub=function(a){var a,b,c,d,e,f;b=this;c=b.$length;d=a;e=0;while(true){if(!(e=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+f]).$length>c){AC($convertSliceType(b,AI),-1,$convertSliceType($subslice(((f<0||f>=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+f]),0,c),AI),$convertSliceType(b,AI));}else{AC($convertSliceType(b,AI),-1,$convertSliceType(((f<0||f>=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+f]),AI),$convertSliceType(b,AI));}e++;}return b;};$ptrType(B).prototype.Sub=function(a){return this.$get().Sub(a);};B.prototype.Scale=function(a){var a,b;b=this;AD($convertSliceType(b,AI),a,$convertSliceType(b,AI));return b;};$ptrType(B).prototype.Scale=function(a){return this.$get().Scale(a);};B.prototype.Equal=function(a){var a,b,c,d,e;b=this;if(!((b.$length===a.$length))){return false;}c=b;d=0;while(true){if(!(d=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+e])-((e<0||e>=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+e]))>1e-08){return false;}d++;}return true;};$ptrType(B).prototype.Equal=function(a){return this.$get().Equal(a);};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,d,e;a=this;b=a.Magnitude();if(b<1e-08){return a;}c=a;d=0;while(true){if(!(d=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+e]=((e<0||e>=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+e])/b);d++;}return a;};$ptrType(B).prototype.Unit=function(){return this.$get().Unit();};K=function(a,b){var a,b,c,d,e,f,g,h,i,j,k;c=0;d=a.$length;e=b.$length;f=c;g=d;h=e;if(g>h){b=$appendSlice(b,$convertSliceType($makeSlice(B,(g-h>>0)),AI));}if(g>0)),AI));}i=a;j=0;while(true){if(!(j=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+k])*((k<0||k>=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+k]));j++;}return f;};$pkg.Dot=K;B.prototype.Dot=function(a){var a,b;b=this;return K(b,a);};$ptrType(B).prototype.Dot=function(a){return this.$get().Dot(a);};B.prototype.Cross=function(a){var a,b;b=this;if(!((b.$length===3))||!((a.$length===3))){return B.nil;}return new B([(1>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+1])*(2>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+2])-(2>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+2])*(1>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+1]),(2>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+2])*(0>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+0])-(0>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+0])*(2>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+2]),(0>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+0])*(2>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+2])-(2>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+2])*(0>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+0])]);};$ptrType(B).prototype.Cross=function(a){return this.$get().Cross(a);};B.prototype.Rotate=function(a,b){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;c=this;d=2;e=c.$length;f=d;g=e;if(g===0){return c;}if(b.$length>0){f=(0>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+0]);}if((g===1)&&!((f===2))){c=$append(c,0,0);}if((g<2&&(f===2))||((g===2)&&!((f===2)))){c=$append(c,0);}h=(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0]);i=(1>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+1]);j=h;k=i;l=A.Cos(a);m=A.Sin(a);n=l;o=m;p=f;if(p===(0)){q=(2>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+2]);(1>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+1]=k*n-q*o);(2>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+2]=k*o+q*n);}else if(p===(1)){r=(2>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+2]);(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0]=j*n+r*o);(2>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+2]=-j*o+r*n);}else if(p===(2)){(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0]=j*n-k*o);(1>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+1]=j*o+k*n);}if(g>3){return $subslice(c,0,3);}return c;};$ptrType(B).prototype.Rotate=function(a,b){return this.$get().Rotate(a,b);};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();};O=function(a,b,c,d){var a,b,c,d,e,f,g;e=new N.ptr(AL.nil,c,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=O;N.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===AM.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:N.ptr.prototype.Add,$c:true,$r,a,b,c,d,e,$s};return $f;};N.prototype.Add=function(a){return this.$val.Add(a);};N.ptr.prototype.Remove=function(a){var a,b,c,d,e,f,g,h;b=this;if(b===AM.nil){$panic(new $String("ERROR: space is nil"));}c=a;d=0;while(true){if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);f=e.TouchingCells;g=0;while(true){if(!(g=f.$length)?($throwRuntimeError("index out of range"),undefined):f.$array[f.$offset+g]);h.unregister(e);g++;}e.TouchingCells=new AK([]);e.Space=AM.nil;d++;}};N.prototype.Remove=function(a){return this.$val.Remove(a);};N.ptr.prototype.Objects=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;a=this;b=$makeMap(AN.keyFor,[]);c=new AO([]);d=a.Cells;e=0;while(true){if(!(e=h.$length)?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+f]));i=0;while(true){if(!(i=m.$length)?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+f])),((j<0||j>=l.$length)?($throwRuntimeError("index out of range"),undefined):l.$array[l.$offset+j])).Objects;n=0;while(true){if(!(n=k.$length)?($throwRuntimeError("index out of range"),undefined):k.$array[k.$offset+n]);p=(q=b[AN.keyFor(o)],q!==undefined?[q.v,true]:[false,false]);r=p[1];if(!r){c=$append(c,o);s=o;(b||$throwRuntimeError("assignment to entry in nil map"))[AN.keyFor(s)]={k:s,v:true};}n++;}i++;}e++;}return c;};N.prototype.Objects=function(){return this.$val.Objects();};N.ptr.prototype.Resize=function(a,b){var a,b,c,d,e,f,g;c=this;c.Cells=new AL([]);d=0;while(true){if(!(d=g.$length)?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+d]=$append((f=c.Cells,((d<0||d>=f.$length)?($throwRuntimeError("index out of range"),undefined):f.$array[f.$offset+d])),AH(e,d))));e=e+(1)>>0;}d=d+(1)>>0;}};N.prototype.Resize=function(a,b){return this.$val.Resize(a,b);};N.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 AJ.nil;};N.prototype.Cell=function(a,b){return this.$val.Cell(a,b);};N.ptr.prototype.CheckCells=function(a,b,c,d,e){var a,b,c,d,e,f,g,h,i,j,k,l,m;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===AJ.nil)){if(e.$length>0){if(i.ContainsTags(e)){j=i.Objects;k=0;while(true){if(!(k=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+k]);if(l.HasTags(e)){return l;}k++;}}}else if(i.Occupied()){return(m=i.Objects,(0>=m.$length?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+0]));}}h=h+(1)>>0;}g=g+(1)>>0;}return AN.nil;};N.prototype.CheckCells=function(a,b,c,d,e){return this.$val.CheckCells(a,b,c,d,e);};N.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);};N.prototype.CheckCellsWorld=function(a,b,c,d,e){return this.$val.CheckCellsWorld(a,b,c,d,e);};N.ptr.prototype.UnregisterAllObjects=function(){var a,b,c,d,e,f,g;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]));a.Remove(g.Objects);c=c+(1)>>0;}b=b+(1)>>0;}};N.prototype.UnregisterAllObjects=function(){return this.$val.UnregisterAllObjects();};N.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];};N.prototype.WorldToSpace=function(a,b){return this.$val.WorldToSpace(a,b);};N.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];};N.prototype.SpaceToWorld=function(a,b){return this.$val.SpaceToWorld(a,b);};N.ptr.prototype.Height=function(){var a;a=this;return a.Cells.$length;};N.prototype.Height=function(){return this.$val.Height();};N.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;};N.prototype.Width=function(){return this.$val.Width();};N.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 AK([]);g=e.Cell(a,b);h=e.Cell(c,d);if(!(g===AJ.nil)&&!(h===AJ.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===AJ.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;};N.prototype.CellsInLine=function(a,b,c,d){return this.$val.CellsInLine(a,b,c,d);};R=function(a,b,c,d){var a,b,c,d;return new Q.ptr(new B([a,b]),new B([c,d]));};$pkg.NewLine=R;Q.ptr.prototype.Project=function(a){var a,b;b=this;return b.Vector().Scale(a.Dot(b.Start.Sub(new AP([b.End]))));};Q.prototype.Project=function(a){return this.$val.Project(a);};Q.ptr.prototype.Normal=function(){var a,b;a=this;b=a.Vector();return new B([(1>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+1]),-(0>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+0])]).Unit();};Q.prototype.Normal=function(){return this.$val.Normal();};Q.ptr.prototype.Vector=function(){var a;a=this;return a.End.Clone().Sub(new AP([a.Start])).Unit();};Q.prototype.Vector=function(){return this.$val.Vector();};Q.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;};Q.prototype.IntersectionPointsLine=function(a){return this.$val.IntersectionPointsLine(a);};Q.ptr.prototype.IntersectionPointsCircle=function(a){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;b=this;c=new AP([]);d=new B([a.X,a.Y]);e=b.Start.Sub(new AP([d]));f=b.End.Sub(new AP([d]));g=f.Sub(new AP([e]));h=(0>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+0])*(0>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+0])+(1>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+1])*(1>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+1]);i=2*(((0>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+0])*(0>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+0]))+((1>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+1])*(1>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+1])));j=((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]))+((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]))-(a.Radius*a.Radius);k=i*i-(4*h*j);if(k<0){}else if(k===0){l=-i/(2*h);if(l>=0&&l<=1){c=$append(c,new B([(m=b.Start,(0>=m.$length?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+0]))+l*(0>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+0]),(n=b.Start,(1>=n.$length?($throwRuntimeError("index out of range"),undefined):n.$array[n.$offset+1]))+l*(1>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+1])]));}}else{o=(-i+A.Sqrt(k))/(2*h);if(o>=0&&o<=1){c=$append(c,new B([(p=b.Start,(0>=p.$length?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+0]))+o*(0>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+0]),(q=b.Start,(1>=q.$length?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+1]))+o*(1>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+1])]));}o=(-i-A.Sqrt(k))/(2*h);if(o>=0&&o<=1){c=$append(c,new B([(r=b.Start,(0>=r.$length?($throwRuntimeError("index out of range"),undefined):r.$array[r.$offset+0]))+o*(0>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+0]),(s=b.Start,(1>=s.$length?($throwRuntimeError("index out of range"),undefined):s.$array[s.$offset+1]))+o*(1>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+1])]));}}return c;};Q.prototype.IntersectionPointsCircle=function(a){return this.$val.IntersectionPointsCircle(a);};T=function(a){var a,b;b=new S.ptr(new AP([]),0,0,true);b.AddPoints(a);return b;};$pkg.NewConvexPolygon=T;S.ptr.prototype.Clone=function(){var a,b,c,d,e,f;a=this;b=new AP([]);c=a.Points;d=0;while(true){if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);b=$append(b,e.Clone());d++;}f=T(AI.nil);f.X=a.X;f.Y=a.Y;f.AddPointsVec(b);f.Closed=a.Closed;return f;};S.prototype.Clone=function(){return this.$val.Clone();};S.ptr.prototype.AddPointsVec=function(a){var a,b;b=this;b.Points=$appendSlice(b.Points,a);};S.prototype.AddPointsVec=function(a){return this.$val.AddPointsVec(a);};S.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;}};S.prototype.AddPoints=function(a){return this.$val.AddPoints(a);};S.ptr.prototype.Lines=function(){var a,b,c,d,e,f,g,h,i,j;a=this;b=new AR([]);c=a.Transformed();d=0;while(true){if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);f=(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0]);g=e;h=f;if(d<(c.$length-1>>0)){h=(i=d+1>>0,((i<0||i>=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+i]));}else if(!a.Closed){break;}j=R((0>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+0]),(1>=g.$length?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+1]),(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]));b=$append(b,j);d=d+(1)>>0;}return b;};S.prototype.Lines=function(){return this.$val.Lines();};S.ptr.prototype.Transformed=function(){var a,b,c,d,e;a=this;b=new AP([]);c=a.Points;d=0;while(true){if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);b=$append(b,new B([(0>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+0])+a.X,(1>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+1])+a.Y]));d++;}return b;};S.prototype.Transformed=function(){return this.$val.Transformed();};S.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];};S.prototype.Bounds=function(){return this.$val.Bounds();};S.ptr.prototype.Position=function(){var a;a=this;return[a.X,a.Y];};S.prototype.Position=function(){return this.$val.Position();};S.ptr.prototype.SetPosition=function(a,b){var a,b,c;c=this;c.X=a;c.Y=b;};S.prototype.SetPosition=function(a,b){return this.$val.SetPosition(a,b);};S.ptr.prototype.SetPositionVec=function(a){var a,b;b=this;b.X=a.X();b.Y=a.Y();};S.prototype.SetPositionVec=function(a){return this.$val.SetPositionVec(a);};S.ptr.prototype.Move=function(a,b){var a,b,c;c=this;c.X=c.X+(a);c.Y=c.Y+(b);};S.prototype.Move=function(a,b){return this.$val.Move(a,b);};S.ptr.prototype.MoveVec=function(a){var a,b;b=this;b.X=b.X+(a.X());b.Y=b.Y+(a.Y());};S.prototype.MoveVec=function(a){return this.$val.MoveVec(a);};S.ptr.prototype.Center=function(){var a,b,c,d,e;a=this;b=new B([0,0]);c=a.Transformed();d=0;while(true){if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);b.Add(new AP([e]));d++;}(0>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+0]=(0>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+0])/((a.Transformed().$length)));(1>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+1]=(1>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+1])/((a.Transformed().$length)));return b;};S.prototype.Center=function(){return this.$val.Center();};S.ptr.prototype.Project=function(a){var a,b,c,d,e,f,g,h,i,j,k;b=this;a=a.Unit();c=b.Transformed();f=a.Dot(new B([(d=(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0]),(0>=d.$length?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+0])),(e=(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0]),(1>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+1]))]));g=f;h=1;while(true){if(!(h=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+h]),(0>=i.$length?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+0])),(j=((h<0||h>=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+h]),(1>=j.$length?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+1]))]));if(kg){g=k;}h=h+(1)>>0;}return new Z.ptr(f,g);};S.prototype.Project=function(a){return this.$val.Project(a);};S.ptr.prototype.SATAxes=function(){var a,b,c,d,e;a=this;b=new AP([]);c=a.Lines();d=0;while(true){if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);b=$append(b,e.Normal());d++;}return b;};S.prototype.SATAxes=function(){return this.$val.SATAxes();};S.ptr.prototype.PointInside=function(a){var a,b,c,d,e,f,g;b=this;c=R((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;};S.prototype.PointInside=function(a){return this.$val.PointInside(a);};V=function(){return new U.ptr(new AP([]),new B([0,0]),new B([0,0]));};$pkg.NewContactSet=V;U.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;};U.prototype.LeftmostPoint=function(){return this.$val.LeftmostPoint();};U.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;};U.prototype.RightmostPoint=function(){return this.$val.RightmostPoint();};U.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;};U.prototype.TopmostPoint=function(){return this.$val.TopmostPoint();};U.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;};U.prototype.BottommostPoint=function(){return this.$val.BottommostPoint();};S.ptr.prototype.Intersection=function(a,b,c){var a,aa,ab,ac,ad,ae,af,ag,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;e=V();f=d.X;g=d.Y;d.X=d.X+(a);d.Y=d.Y+(b);h=$assertType(c,AS,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]);e.Points=$appendSlice(e.Points,m.IntersectionPointsCircle(i));l++;}}else{n=$assertType(c,AT,true);o=n[0];p=n[1];if(p){q=d.Lines();r=0;while(true){if(!(r=q.$length)?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+r]);t=o.Lines();u=0;while(true){if(!(u=t.$length)?($throwRuntimeError("index out of range"),undefined):t.$array[t.$offset+u]);w=s.IntersectionPointsLine(v);if(!(w===B.nil)){e.Points=$append(e.Points,w);}u++;}r++;}}}if(e.Points.$length>0){x=e.Points;y=0;while(true){if(!(y=x.$length)?($throwRuntimeError("index out of range"),undefined):x.$array[x.$offset+y]);e.Center=e.Center.Add(new AP([z]));y++;}(ab=e.Center,(0>=ab.$length?($throwRuntimeError("index out of range"),undefined):ab.$array[ab.$offset+0]=(aa=e.Center,(0>=aa.$length?($throwRuntimeError("index out of range"),undefined):aa.$array[aa.$offset+0]))/((e.Points.$length))));(ad=e.Center,(1>=ad.$length?($throwRuntimeError("index out of range"),undefined):ad.$array[ad.$offset+1]=(ac=e.Center,(1>=ac.$length?($throwRuntimeError("index out of range"),undefined):ac.$array[ac.$offset+1]))/((e.Points.$length))));ae=d.calculateMTV(e,c);if(!(ae===B.nil)){e.MTV=ae;}}else{e=AU.nil;}if(!(e===AU.nil)&&(!((a===0))||!((b===0)))){af=new B([a,b]).Magnitude();ag=e.MTV.Magnitude();e.MTV=e.MTV.Unit().Scale(ag-af);}d.X=f;d.Y=g;return e;};S.prototype.Intersection=function(a,b,c){return this.$val.Intersection(a,b,c);};S.ptr.prototype.calculateMTV=function(a,b){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o;c=this;d=new B([0,0]);e=new B([1.7976931348623157e+308,0]);f=b;if($assertType(f,AT,true)[1]){g=f.$val;h=c.SATAxes();i=0;while(true){if(!(i=h.$length)?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+i]);if(!$clone(c.Project(j),Z).Overlapping($clone(g.Project(j),Z))){return B.nil;}k=$clone(c.Project(j),Z).Overlap($clone(g.Project(j),Z));if(e.Magnitude()>k){e=j.Scale(k);}i++;}l=g.SATAxes();m=0;while(true){if(!(m=l.$length)?($throwRuntimeError("index out of range"),undefined):l.$array[l.$offset+m]);if(!$clone(c.Project(n),Z).Overlapping($clone(g.Project(n),Z))){return B.nil;}o=$clone(c.Project(n),Z).Overlap($clone(g.Project(n),Z));if(e.Magnitude()>o){e=n.Scale(o);}m++;}}(0>=d.$length?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+0]=(0>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+0]));(1>=d.$length?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+1]=(1>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+1]));return d;};S.prototype.calculateMTV=function(a,b){return this.$val.calculateMTV(a,b);};S.ptr.prototype.ContainedBy=function(a){var a,b,c,d,e,f,g,h,i,j;b=this;c=a;if($assertType(c,AT,true)[1]){d=c.$val;e=b.SATAxes();f=0;while(true){if(!(f=e.$length)?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+f]);if(!$clone(b.Project(g),Z).IsInside($clone(d.Project(g),Z))){return false;}f++;}h=d.SATAxes();i=0;while(true){if(!(i=h.$length)?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+i]);if(!$clone(b.Project(j),Z).IsInside($clone(d.Project(j),Z))){return false;}i++;}}return true;};S.prototype.ContainedBy=function(a){return this.$val.ContainedBy(a);};S.ptr.prototype.FlipH=function(){var a,b,c,d;a=this;b=a.Points;c=0;while(true){if(!(c=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+c]);(0>=d.$length?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+0]=-(0>=d.$length?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+0]));c++;}a.ReverseVertexOrder();};S.prototype.FlipH=function(){return this.$val.FlipH();};S.ptr.prototype.FlipV=function(){var a,b,c,d;a=this;b=a.Points;c=0;while(true){if(!(c=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+c]);(1>=d.$length?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+1]=-(1>=d.$length?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+1]));c++;}a.ReverseVertexOrder();};S.prototype.FlipV=function(){return this.$val.FlipV();};S.ptr.prototype.ReverseVertexOrder=function(){var a,b,c,d,e;a=this;c=new AP([(b=a.Points,(0>=b.$length?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+0]))]);d=a.Points.$length-1>>0;while(true){if(!(d>=1)){break;}c=$append(c,(e=a.Points,((d<0||d>=e.$length)?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+d])));d=d-(1)>>0;}a.Points=c;};S.prototype.ReverseVertexOrder=function(){return this.$val.ReverseVertexOrder();};W=function(a,b,c,d){var a,b,c,d;return T(new AI([a,b,a+c,b,a+c,b+d,a,b+d]));};$pkg.NewRectangle=W;Y=function(a,b,c){var a,b,c,d;d=new X.ptr(a,b,c);return d;};$pkg.NewCircle=Y;X.ptr.prototype.Clone=function(){var a;a=this;return Y(a.X,a.Y,a.Radius);};X.prototype.Clone=function(){return this.$val.Clone();};X.ptr.prototype.Bounds=function(){var a;a=this;return[new B([a.X-a.Radius,a.Y-a.Radius]),new B([a.X+a.Radius,a.Y+a.Radius])];};X.prototype.Bounds=function(){return this.$val.Bounds();};X.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,r;d=this;e=AU.nil;f=d.X;g=d.Y;d.X=d.X+(a);d.Y=d.Y+(b);h=c;if($assertType(h,AT,true)[1]){i=h.$val;e=i.Intersection(-a,-b,d);if(!(e===AU.nil)){e.MTV=e.MTV.Scale(-1);}}else if($assertType(h,AS,true)[1]){j=h.$val;e=V();e.Points=d.IntersectionPointsCircle(j);if(e.Points.$length===0){return AU.nil;}e.MTV=new B([d.X-j.X,d.Y-j.Y]);k=e.MTV.Magnitude();e.MTV=e.MTV.Unit().Scale(d.Radius+j.Radius-k);l=e.Points;m=0;while(true){if(!(m=l.$length)?($throwRuntimeError("index out of range"),undefined):l.$array[l.$offset+m]);e.Center=e.Center.Add(new AP([n]));m++;}(p=e.Center,(0>=p.$length?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+0]=(o=e.Center,(0>=o.$length?($throwRuntimeError("index out of range"),undefined):o.$array[o.$offset+0]))/((e.Points.$length))));(r=e.Center,(1>=r.$length?($throwRuntimeError("index out of range"),undefined):r.$array[r.$offset+1]=(q=e.Center,(1>=q.$length?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+1]))/((e.Points.$length))));}d.X=f;d.Y=g;return e;};X.prototype.Intersection=function(a,b,c){return this.$val.Intersection(a,b,c);};X.ptr.prototype.Move=function(a,b){var a,b,c;c=this;c.X=c.X+(a);c.Y=c.Y+(b);};X.prototype.Move=function(a,b){return this.$val.Move(a,b);};X.ptr.prototype.MoveVec=function(a){var a,b;b=this;b.X=b.X+(a.X());b.Y=b.Y+(a.Y());};X.prototype.MoveVec=function(a){return this.$val.MoveVec(a);};X.ptr.prototype.SetPosition=function(a,b){var a,b,c;c=this;c.X=a;c.Y=b;};X.prototype.SetPosition=function(a,b){return this.$val.SetPosition(a,b);};X.ptr.prototype.SetPositionVec=function(a){var a,b;b=this;b.X=a.X();b.Y=a.Y();};X.prototype.SetPositionVec=function(a){return this.$val.SetPositionVec(a);};X.ptr.prototype.Position=function(){var a;a=this;return[a.X,a.Y];};X.prototype.Position=function(){return this.$val.Position();};X.ptr.prototype.PointInside=function(a){var a,b;b=this;return a.Sub(new AP([new B([b.X,b.Y])])).Magnitude()<=b.Radius;};X.prototype.PointInside=function(a){return this.$val.PointInside(a);};X.ptr.prototype.IntersectionPointsCircle=function(a){var a,b,c,d,e,f,g;b=this;c=A.Sqrt(A.Pow(a.X-b.X,2)+A.Pow(a.Y-b.Y,2));if(c>b.Radius+a.Radius||c0;};Z.prototype.Overlapping=function(a){return this.$val.Overlapping(a);};Z.ptr.prototype.Overlap=function(a){var a,b;b=this;return A.Min(b.Max,a.Max)-A.Max(b.Min,a.Min);};Z.prototype.Overlap=function(a){return this.$val.Overlap(a);};Z.ptr.prototype.IsInside=function(a){var a,b;b=this;return b.Min>=a.Min&&b.Max<=a.Max;};Z.prototype.IsInside=function(a){return this.$val.IsInside(a);};AB=function(a,b,c,d,e){var a,b,c,d,e,f;f=new AA.ptr($ifaceNil,AM.nil,a,b,c,d,AK.nil,$ifaceNil,$makeMap(AN.keyFor,[]),new AV([]));if(e.$length>0){f.AddTags(e);}return f;};$pkg.NewObject=AB;AA.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=AB(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:AA.ptr.prototype.Update,$c:true,$r,a,b,c,d,e,f,g,h,i,j,$s};return $f;};AA.prototype.Update=function(){return this.$val.Update();};AA.ptr.prototype.AddTags=function(a){var a,b;b=this;b.tags=$appendSlice(b.tags,a);};AA.prototype.AddTags=function(a){return this.$val.AddTags(a);};AA.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++;}};AA.prototype.RemoveTags=function(a){return this.$val.RemoveTags(a);};AA.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;};AA.prototype.HasTags=function(a){return this.$val.HasTags(a);};AA.ptr.prototype.Tags=function(){var a;a=this;return $appendSlice(new AV([]),a.tags);};AA.prototype.Tags=function(){return this.$val.Tags();};AA.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:AA.ptr.prototype.SetShape,$c:true,$r,a,b,$s};return $f;};AA.prototype.SetShape=function(a){return this.$val.SetShape(a);};AA.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];};AA.prototype.BoundsToSpace=function(a,b){return this.$val.BoundsToSpace(a,b);};AA.ptr.prototype.SharesCells=function(a){var a,b,c,d,e;b=this;c=b.TouchingCells;d=0;while(true){if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);if(e.Contains(a)){return true;}d++;}return false;};AA.prototype.SharesCells=function(a){return this.$val.SharesCells(a);};AA.ptr.prototype.SharesCellsTags=function(a){var a,b,c,d,e;b=this;c=b.TouchingCells;d=0;while(true){if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);if(e.ContainsTags(a)){return true;}d++;}return false;};AA.prototype.SharesCellsTags=function(a){return this.$val.SharesCellsTags(a);};AA.ptr.prototype.Center=function(){var a;a=this;return[a.X+(a.W/2),a.Y+(a.H/2)];};AA.prototype.Center=function(){return this.$val.Center();};AA.ptr.prototype.SetCenter=function(a,b){var a,b,c;c=this;c.X=a-(c.W/2);c.Y=b-(c.H/2);};AA.prototype.SetCenter=function(a,b){return this.$val.SetCenter(a,b);};AA.ptr.prototype.CellPosition=function(){var a,b;a=this;b=a.Center();return a.Space.WorldToSpace(b[0],b[1]);};AA.prototype.CellPosition=function(){return this.$val.CellPosition();};AA.ptr.prototype.SetRight=function(a){var a,b;b=this;b.X=a-b.W;};AA.prototype.SetRight=function(a){return this.$val.SetRight(a);};AA.ptr.prototype.SetBottom=function(a){var a,b;b=this;b.Y=a-b.H;};AA.prototype.SetBottom=function(a){return this.$val.SetBottom(a);};AA.ptr.prototype.Bottom=function(){var a;a=this;return a.Y+a.H;};AA.prototype.Bottom=function(){return this.$val.Bottom();};AA.ptr.prototype.Right=function(){var a;a=this;return a.X+a.W;};AA.prototype.Right=function(){return this.$val.Right();};AA.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;};AA.prototype.SetBounds=function(a,b){return this.$val.SetBounds(a,b);};AA.ptr.prototype.Check=function(a,b,c){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;d=this;if(d.Space===AM.nil){return AW.nil;}e=AF();e.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);}e.dx=a;e.dy=b;f=d.BoundsToSpace(a,b);g=f[0];h=f[1];i=f[2];j=f[3];k=$makeMap(AN.keyFor,[]);l=$makeMap(AJ.keyFor,[]);m=h;while(true){if(!(m<=j)){break;}n=g;while(true){if(!(n<=i)){break;}o=d.Space.Cell(n,m);if(!(o===AJ.nil)){p=o.Objects;q=0;while(true){if(!(q=p.$length)?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+q]);t=(s=d.ignoreList[AN.keyFor(r)],s!==undefined?s.v:false);if(r===d||t){q++;continue;}u=(v=k[AN.keyFor(r)],v!==undefined?[v.v,true]:[false,false]);w=u[1];if(((c.$length===0)||r.HasTags(c))&&!w){e.Objects=$append(e.Objects,r);x=r;(k||$throwRuntimeError("assignment to entry in nil map"))[AN.keyFor(x)]={k:x,v:true};y=(z=l[AJ.keyFor(o)],z!==undefined?[z.v,true]:[false,false]);aa=y[1];if(!aa){e.Cells=$append(e.Cells,o);ab=o;(l||$throwRuntimeError("assignment to entry in nil map"))[AJ.keyFor(ab)]={k:ab,v:true};}q++;continue;}q++;}}n=n+(1)>>0;}m=m+(1)>>0;}if(e.Objects.$length===0){return AW.nil;}return e;};AA.prototype.Check=function(a,b,c){return this.$val.Check(a,b,c);};AA.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;};AA.prototype.Overlaps=function(a){return this.$val.Overlaps(a);};AA.ptr.prototype.AddToIgnoreList=function(a){var a,b,c;b=this;c=a;(b.ignoreList||$throwRuntimeError("assignment to entry in nil map"))[AN.keyFor(c)]={k:c,v:true};};AA.prototype.AddToIgnoreList=function(a){return this.$val.AddToIgnoreList(a);};AA.ptr.prototype.RemoveFromIgnoreList=function(a){var a,b;b=this;delete b.ignoreList[AN.keyFor(a)];};AA.prototype.RemoveFromIgnoreList=function(a){return this.$val.RemoveFromIgnoreList(a);};AC=function(a,b,c,d){var a,b,c,d,e,f,g,h,i;e=d.$length;f=c;g=0;while(true){if(!(g=f.$length)?($throwRuntimeError("index out of range"),undefined):f.$array[f.$offset+g]);if(h===e){return;}((h<0||h>=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+h]=b*i+((h<0||h>=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+h]));g++;}};AD=function(a,b,c){var a,b,c,d,e,f;d=c;e=0;while(true){if(!(e=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+f]=((f<0||f>=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+f])*(b));e++;}};AF=function(){return new AE.ptr(AN.nil,0,0,new AO([]),AK.nil);};$pkg.NewCollision=AF;AE.ptr.prototype.HasTags=function(a){var a,b,c,d,e;b=this;c=b.Objects;d=0;while(true){if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);if(e===b.checkingObject){d++;continue;}if(e.HasTags(a)){return true;}d++;}return false;};AE.prototype.HasTags=function(a){return this.$val.HasTags(a);};AE.ptr.prototype.ObjectsByTags=function(a){var a,b,c,d,e,f;b=this;c=new AO([]);d=b.Objects;e=0;while(true){if(!(e=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+e]);if(f===b.checkingObject){e++;continue;}if(f.HasTags(a)){c=$append(c,f);}e++;}return c;};AE.prototype.ObjectsByTags=function(a){return this.$val.ObjectsByTags(a);};AE.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;};AE.prototype.ContactWithObject=function(a){return this.$val.ContactWithObject(a);};AE.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;};AE.prototype.ContactWithCell=function(a){return this.$val.ContactWithCell(a);};AE.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,u;c=this;d=c.checkingObject.Space;f=(e=c.Cells,(0>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+0]));g=d.SpaceToWorld(f.X,f.Y);h=g[0];i=g[1];j=(d.CellWidth)/2;k=(d.CellHeight)/2;h=h+(j);i=i+(k);l=c.checkingObject.Center();m=l[0];n=l[1];o=m-h;p=n-i;q=d.Cell(f.X-1>>0,f.Y);r=d.Cell(f.X+1>>0,f.Y);s=d.Cell(f.X,f.Y-1>>0);t=d.Cell(f.X,f.Y+1>>0);u=new B([0,0]);if(!((c.dy===0))){if(o>0&&(r===AJ.nil||!r.ContainsTags(b))){(0>=u.$length?($throwRuntimeError("index out of range"),undefined):u.$array[u.$offset+0]=h+j-c.checkingObject.X);}else if(o<0&&(q===AJ.nil||!q.ContainsTags(b))){(0>=u.$length?($throwRuntimeError("index out of range"),undefined):u.$array[u.$offset+0]=h-j-(c.checkingObject.X+c.checkingObject.W));}else{return B.nil;}}if(!((c.dx===0))){if(p>0&&(t===AJ.nil||!t.ContainsTags(b))){(1>=u.$length?($throwRuntimeError("index out of range"),undefined):u.$array[u.$offset+1]=i+k-c.checkingObject.Y);}else if(p<0&&(s===AJ.nil||!s.ContainsTags(b))){(1>=u.$length?($throwRuntimeError("index out of range"),undefined):u.$array[u.$offset+1]=i-k-(c.checkingObject.Y+c.checkingObject.H));}else{return B.nil;}}return u;};AE.prototype.SlideAgainstCell=function(a,b){return this.$val.SlideAgainstCell(a,b);};AH=function(a,b){var a,b;return new AG.ptr(a,b,new AO([]));};AG.ptr.prototype.register=function(a){var a,b;b=this;if(!b.Contains(a)){b.Objects=$append(b.Objects,a);}};AG.prototype.register=function(a){return this.$val.register(a);};AG.ptr.prototype.unregister=function(a){var a,b,c,d,e,f,g,h,i;b=this;c=b.Objects;d=0;while(true){if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);if(f===a){(i=b.Objects,((e<0||e>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+e]=(g=b.Objects,h=b.Objects.$length-1>>0,((h<0||h>=g.$length)?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+h]))));b.Objects=$subslice(b.Objects,0,(b.Objects.$length-1>>0));break;}d++;}};AG.prototype.unregister=function(a){return this.$val.unregister(a);};AG.ptr.prototype.Contains=function(a){var a,b,c,d,e;b=this;c=b.Objects;d=0;while(true){if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);if(e===a){return true;}d++;}return false;};AG.prototype.Contains=function(a){return this.$val.Contains(a);};AG.ptr.prototype.ContainsTags=function(a){var a,b,c,d,e;b=this;c=b.Objects;d=0;while(true){if(!(d=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);if(e.HasTags(a)){return true;}d++;}return false;};AG.prototype.ContainsTags=function(a){return this.$val.ContainsTags(a);};AG.ptr.prototype.Occupied=function(){var a;a=this;return a.Objects.$length>0;};AG.prototype.Occupied=function(){return this.$val.Occupied();};B.methods=[{prop:"Clone",name:"Clone",pkg:"",typ:$funcType([],[B],false)},{prop:"Add",name:"Add",pkg:"",typ:$funcType([AP],[B],true)},{prop:"Sub",name:"Sub",pkg:"",typ:$funcType([AP],[B],true)},{prop:"Scale",name:"Scale",pkg:"",typ:$funcType([$Float64],[B],false)},{prop:"Equal",name:"Equal",pkg:"",typ:$funcType([B],[$Bool],false)},{prop:"Magnitude",name:"Magnitude",pkg:"",typ:$funcType([],[$Float64],false)},{prop:"Magnitude2",name:"Magnitude2",pkg:"",typ:$funcType([],[$Float64],false)},{prop:"Unit",name:"Unit",pkg:"",typ:$funcType([],[B],false)},{prop:"Dot",name:"Dot",pkg:"",typ:$funcType([B],[$Float64],false)},{prop:"Cross",name:"Cross",pkg:"",typ:$funcType([B],[B],false)},{prop:"Rotate",name:"Rotate",pkg:"",typ:$funcType([$Float64,AX],[B],true)},{prop:"X",name:"X",pkg:"",typ:$funcType([],[$Float64],false)},{prop:"Y",name:"Y",pkg:"",typ:$funcType([],[$Float64],false)},{prop:"Z",name:"Z",pkg:"",typ:$funcType([],[$Float64],false)}];AM.methods=[{prop:"Add",name:"Add",pkg:"",typ:$funcType([AO],[],true)},{prop:"Remove",name:"Remove",pkg:"",typ:$funcType([AO],[],true)},{prop:"Objects",name:"Objects",pkg:"",typ:$funcType([],[AO],false)},{prop:"Resize",name:"Resize",pkg:"",typ:$funcType([$Int,$Int],[],false)},{prop:"Cell",name:"Cell",pkg:"",typ:$funcType([$Int,$Int],[AJ],false)},{prop:"CheckCells",name:"CheckCells",pkg:"",typ:$funcType([$Int,$Int,$Int,$Int,AV],[AN],true)},{prop:"CheckCellsWorld",name:"CheckCellsWorld",pkg:"",typ:$funcType([$Float64,$Float64,$Float64,$Float64,AV],[AN],true)},{prop:"UnregisterAllObjects",name:"UnregisterAllObjects",pkg:"",typ:$funcType([],[],false)},{prop:"WorldToSpace",name:"WorldToSpace",pkg:"",typ:$funcType([$Float64,$Float64],[$Int,$Int],false)},{prop:"SpaceToWorld",name:"SpaceToWorld",pkg:"",typ:$funcType([$Int,$Int],[$Float64,$Float64],false)},{prop:"Height",name:"Height",pkg:"",typ:$funcType([],[$Int],false)},{prop:"Width",name:"Width",pkg:"",typ:$funcType([],[$Int],false)},{prop:"CellsInLine",name:"CellsInLine",pkg:"",typ:$funcType([$Int,$Int,$Int,$Int],[AK],false)}];AQ.methods=[{prop:"Project",name:"Project",pkg:"",typ:$funcType([B],[B],false)},{prop:"Normal",name:"Normal",pkg:"",typ:$funcType([],[B],false)},{prop:"Vector",name:"Vector",pkg:"",typ:$funcType([],[B],false)},{prop:"IntersectionPointsLine",name:"IntersectionPointsLine",pkg:"",typ:$funcType([AQ],[B],false)},{prop:"IntersectionPointsCircle",name:"IntersectionPointsCircle",pkg:"",typ:$funcType([AS],[AP],false)}];AT.methods=[{prop:"Clone",name:"Clone",pkg:"",typ:$funcType([],[P],false)},{prop:"AddPointsVec",name:"AddPointsVec",pkg:"",typ:$funcType([AP],[],true)},{prop:"AddPoints",name:"AddPoints",pkg:"",typ:$funcType([AI],[],true)},{prop:"Lines",name:"Lines",pkg:"",typ:$funcType([],[AR],false)},{prop:"Transformed",name:"Transformed",pkg:"",typ:$funcType([],[AP],false)},{prop:"Bounds",name:"Bounds",pkg:"",typ:$funcType([],[B,B],false)},{prop:"Position",name:"Position",pkg:"",typ:$funcType([],[$Float64,$Float64],false)},{prop:"SetPosition",name:"SetPosition",pkg:"",typ:$funcType([$Float64,$Float64],[],false)},{prop:"SetPositionVec",name:"SetPositionVec",pkg:"",typ:$funcType([B],[],false)},{prop:"Move",name:"Move",pkg:"",typ:$funcType([$Float64,$Float64],[],false)},{prop:"MoveVec",name:"MoveVec",pkg:"",typ:$funcType([B],[],false)},{prop:"Center",name:"Center",pkg:"",typ:$funcType([],[B],false)},{prop:"Project",name:"Project",pkg:"",typ:$funcType([B],[Z],false)},{prop:"SATAxes",name:"SATAxes",pkg:"",typ:$funcType([],[AP],false)},{prop:"PointInside",name:"PointInside",pkg:"",typ:$funcType([B],[$Bool],false)},{prop:"Intersection",name:"Intersection",pkg:"",typ:$funcType([$Float64,$Float64,P],[AU],false)},{prop:"calculateMTV",name:"calculateMTV",pkg:"resolv",typ:$funcType([AU,P],[B],false)},{prop:"ContainedBy",name:"ContainedBy",pkg:"",typ:$funcType([P],[$Bool],false)},{prop:"FlipH",name:"FlipH",pkg:"",typ:$funcType([],[],false)},{prop:"FlipV",name:"FlipV",pkg:"",typ:$funcType([],[],false)},{prop:"ReverseVertexOrder",name:"ReverseVertexOrder",pkg:"",typ:$funcType([],[],false)}];AU.methods=[{prop:"LeftmostPoint",name:"LeftmostPoint",pkg:"",typ:$funcType([],[B],false)},{prop:"RightmostPoint",name:"RightmostPoint",pkg:"",typ:$funcType([],[B],false)},{prop:"TopmostPoint",name:"TopmostPoint",pkg:"",typ:$funcType([],[B],false)},{prop:"BottommostPoint",name:"BottommostPoint",pkg:"",typ:$funcType([],[B],false)}];AS.methods=[{prop:"Clone",name:"Clone",pkg:"",typ:$funcType([],[P],false)},{prop:"Bounds",name:"Bounds",pkg:"",typ:$funcType([],[B,B],false)},{prop:"Intersection",name:"Intersection",pkg:"",typ:$funcType([$Float64,$Float64,P],[AU],false)},{prop:"Move",name:"Move",pkg:"",typ:$funcType([$Float64,$Float64],[],false)},{prop:"MoveVec",name:"MoveVec",pkg:"",typ:$funcType([B],[],false)},{prop:"SetPosition",name:"SetPosition",pkg:"",typ:$funcType([$Float64,$Float64],[],false)},{prop:"SetPositionVec",name:"SetPositionVec",pkg:"",typ:$funcType([B],[],false)},{prop:"Position",name:"Position",pkg:"",typ:$funcType([],[$Float64,$Float64],false)},{prop:"PointInside",name:"PointInside",pkg:"",typ:$funcType([B],[$Bool],false)},{prop:"IntersectionPointsCircle",name:"IntersectionPointsCircle",pkg:"",typ:$funcType([AS],[AP],false)}];Z.methods=[{prop:"Overlapping",name:"Overlapping",pkg:"",typ:$funcType([Z],[$Bool],false)},{prop:"Overlap",name:"Overlap",pkg:"",typ:$funcType([Z],[$Float64],false)},{prop:"IsInside",name:"IsInside",pkg:"",typ:$funcType([Z],[$Bool],false)}];AN.methods=[{prop:"Clone",name:"Clone",pkg:"",typ:$funcType([],[AN],false)},{prop:"Update",name:"Update",pkg:"",typ:$funcType([],[],false)},{prop:"AddTags",name:"AddTags",pkg:"",typ:$funcType([AV],[],true)},{prop:"RemoveTags",name:"RemoveTags",pkg:"",typ:$funcType([AV],[],true)},{prop:"HasTags",name:"HasTags",pkg:"",typ:$funcType([AV],[$Bool],true)},{prop:"Tags",name:"Tags",pkg:"",typ:$funcType([],[AV],false)},{prop:"SetShape",name:"SetShape",pkg:"",typ:$funcType([P],[],false)},{prop:"BoundsToSpace",name:"BoundsToSpace",pkg:"",typ:$funcType([$Float64,$Float64],[$Int,$Int,$Int,$Int],false)},{prop:"SharesCells",name:"SharesCells",pkg:"",typ:$funcType([AN],[$Bool],false)},{prop:"SharesCellsTags",name:"SharesCellsTags",pkg:"",typ:$funcType([AV],[$Bool],true)},{prop:"Center",name:"Center",pkg:"",typ:$funcType([],[$Float64,$Float64],false)},{prop:"SetCenter",name:"SetCenter",pkg:"",typ:$funcType([$Float64,$Float64],[],false)},{prop:"CellPosition",name:"CellPosition",pkg:"",typ:$funcType([],[$Int,$Int],false)},{prop:"SetRight",name:"SetRight",pkg:"",typ:$funcType([$Float64],[],false)},{prop:"SetBottom",name:"SetBottom",pkg:"",typ:$funcType([$Float64],[],false)},{prop:"Bottom",name:"Bottom",pkg:"",typ:$funcType([],[$Float64],false)},{prop:"Right",name:"Right",pkg:"",typ:$funcType([],[$Float64],false)},{prop:"SetBounds",name:"SetBounds",pkg:"",typ:$funcType([B,B],[],false)},{prop:"Check",name:"Check",pkg:"",typ:$funcType([$Float64,$Float64,AV],[AW],true)},{prop:"Overlaps",name:"Overlaps",pkg:"",typ:$funcType([AN],[$Bool],false)},{prop:"AddToIgnoreList",name:"AddToIgnoreList",pkg:"",typ:$funcType([AN],[],false)},{prop:"RemoveFromIgnoreList",name:"RemoveFromIgnoreList",pkg:"",typ:$funcType([AN],[],false)}];AW.methods=[{prop:"HasTags",name:"HasTags",pkg:"",typ:$funcType([AV],[$Bool],true)},{prop:"ObjectsByTags",name:"ObjectsByTags",pkg:"",typ:$funcType([AV],[AO],true)},{prop:"ContactWithObject",name:"ContactWithObject",pkg:"",typ:$funcType([AN],[B],false)},{prop:"ContactWithCell",name:"ContactWithCell",pkg:"",typ:$funcType([AJ],[B],false)},{prop:"SlideAgainstCell",name:"SlideAgainstCell",pkg:"",typ:$funcType([AJ,AV],[B],true)}];AJ.methods=[{prop:"register",name:"register",pkg:"resolv",typ:$funcType([AN],[],false)},{prop:"unregister",name:"unregister",pkg:"resolv",typ:$funcType([AN],[],false)},{prop:"Contains",name:"Contains",pkg:"",typ:$funcType([AN],[$Bool],false)},{prop:"ContainsTags",name:"ContainsTags",pkg:"",typ:$funcType([AV],[$Bool],true)},{prop:"Occupied",name:"Occupied",pkg:"",typ:$funcType([],[$Bool],false)}];B.init($Float64);N.init("",[{prop:"Cells",name:"Cells",embedded:false,exported:true,typ:AL,tag:""},{prop:"CellWidth",name:"CellWidth",embedded:false,exported:true,typ:$Int,tag:""},{prop:"CellHeight",name:"CellHeight",embedded:false,exported:true,typ:$Int,tag:""}]);P.init([{prop:"Bounds",name:"Bounds",pkg:"",typ:$funcType([],[B,B],false)},{prop:"Clone",name:"Clone",pkg:"",typ:$funcType([],[P],false)},{prop:"Intersection",name:"Intersection",pkg:"",typ:$funcType([$Float64,$Float64,P],[AU],false)},{prop:"Position",name:"Position",pkg:"",typ:$funcType([],[$Float64,$Float64],false)},{prop:"SetPosition",name:"SetPosition",pkg:"",typ:$funcType([$Float64,$Float64],[],false)}]);Q.init("",[{prop:"Start",name:"Start",embedded:false,exported:true,typ:B,tag:""},{prop:"End",name:"End",embedded:false,exported:true,typ:B,tag:""}]);S.init("",[{prop:"Points",name:"Points",embedded:false,exported:true,typ:AP,tag:""},{prop:"X",name:"X",embedded:false,exported:true,typ:$Float64,tag:""},{prop:"Y",name:"Y",embedded:false,exported:true,typ:$Float64,tag:""},{prop:"Closed",name:"Closed",embedded:false,exported:true,typ:$Bool,tag:""}]);U.init("",[{prop:"Points",name:"Points",embedded:false,exported:true,typ:AP,tag:""},{prop:"MTV",name:"MTV",embedded:false,exported:true,typ:B,tag:""},{prop:"Center",name:"Center",embedded:false,exported:true,typ:B,tag:""}]);X.init("",[{prop:"X",name:"X",embedded:false,exported:true,typ:$Float64,tag:""},{prop:"Y",name:"Y",embedded:false,exported:true,typ:$Float64,tag:""},{prop:"Radius",name:"Radius",embedded:false,exported:true,typ:$Float64,tag:""}]);Z.init("",[{prop:"Min",name:"Min",embedded:false,exported:true,typ:$Float64,tag:""},{prop:"Max",name:"Max",embedded:false,exported:true,typ:$Float64,tag:""}]);AA.init("resolv",[{prop:"Shape",name:"Shape",embedded:false,exported:true,typ:P,tag:""},{prop:"Space",name:"Space",embedded:false,exported:true,typ:AM,tag:""},{prop:"X",name:"X",embedded:false,exported:true,typ:$Float64,tag:""},{prop:"Y",name:"Y",embedded:false,exported:true,typ:$Float64,tag:""},{prop:"W",name:"W",embedded:false,exported:true,typ:$Float64,tag:""},{prop:"H",name:"H",embedded:false,exported:true,typ:$Float64,tag:""},{prop:"TouchingCells",name:"TouchingCells",embedded:false,exported:true,typ:AK,tag:""},{prop:"Data",name:"Data",embedded:false,exported:true,typ:$emptyInterface,tag:""},{prop:"ignoreList",name:"ignoreList",embedded:false,exported:false,typ:AY,tag:""},{prop:"tags",name:"tags",embedded:false,exported:false,typ:AV,tag:""}]);AE.init("resolv",[{prop:"checkingObject",name:"checkingObject",embedded:false,exported:false,typ:AN,tag:""},{prop:"dx",name:"dx",embedded:false,exported:false,typ:$Float64,tag:""},{prop:"dy",name:"dy",embedded:false,exported:false,typ:$Float64,tag:""},{prop:"Objects",name:"Objects",embedded:false,exported:true,typ:AO,tag:""},{prop:"Cells",name:"Cells",embedded:false,exported:true,typ:AK,tag:""}]);AG.init("",[{prop:"X",name:"X",embedded:false,exported:true,typ:$Int,tag:""},{prop:"Y",name:"Y",embedded:false,exported:true,typ:$Int,tag:""},{prop:"Objects",name:"Objects",embedded:false,exported:true,typ:AO,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;}}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})(); -$packages["jsexport/battle"]=(function(){var $pkg={},$init,A,B,C,D,E,F,H,I,J,K,L,M,N,O,P,Q,S,T,AH,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,U,V,W,X,Y,R,Z,AB,AC,AD,AE,AF,AG,AI,AJ,AK,AL,AM,AN,AO,AP,AQ,AR,AS,AT,AV,AW,AX,AY,AZ,BA,BB,BC,BD;A=$packages["math"];B=$packages["resolv"];C=$pkg.Vec2D=$newType(0,$kindStruct,"battle.Vec2D",true,"jsexport/battle",true,function(X_,Y_){this.$val=this;if(arguments.length===0){this.X=0;this.Y=0;return;}this.X=X_;this.Y=Y_;});D=$pkg.Polygon2D=$newType(0,$kindStruct,"battle.Polygon2D",true,"jsexport/battle",true,function(Anchor_,Points_){this.$val=this;if(arguments.length===0){this.Anchor=CD.nil;this.Points=CE.nil;return;}this.Anchor=Anchor_;this.Points=Points_;});E=$pkg.PlayerDownsync=$newType(0,$kindStruct,"battle.PlayerDownsync",true,"jsexport/battle",true,function(Id_,VirtualGridX_,VirtualGridY_,DirX_,DirY_,VelX_,VelY_,Speed_,BattleState_,JoinIndex_,ColliderRadius_,Removed_,Score_,LastMoveGmtMillis_,FramesToRecover_,FramesInChState_,Hp_,MaxHp_,CharacterState_,InAir_,OnWall_,OnWallNormX_,OnWallNormY_,CapturedByInertia_,ActiveSkillId_,ActiveSkillHit_,FramesInvinsible_,BulletTeamId_,ChCollisionTeamId_,RevivalVirtualGridX_,RevivalVirtualGridY_){this.$val=this;if(arguments.length===0){this.Id=0;this.VirtualGridX=0;this.VirtualGridY=0;this.DirX=0;this.DirY=0;this.VelX=0;this.VelY=0;this.Speed=0;this.BattleState=0;this.JoinIndex=0;this.ColliderRadius=0;this.Removed=false;this.Score=0;this.LastMoveGmtMillis=0;this.FramesToRecover=0;this.FramesInChState=0;this.Hp=0;this.MaxHp=0;this.CharacterState=0;this.InAir=false;this.OnWall=false;this.OnWallNormX=0;this.OnWallNormY=0;this.CapturedByInertia=false;this.ActiveSkillId=0;this.ActiveSkillHit=0;this.FramesInvinsible=0;this.BulletTeamId=0;this.ChCollisionTeamId=0;this.RevivalVirtualGridX=0;this.RevivalVirtualGridY=0;return;}this.Id=Id_;this.VirtualGridX=VirtualGridX_;this.VirtualGridY=VirtualGridY_;this.DirX=DirX_;this.DirY=DirY_;this.VelX=VelX_;this.VelY=VelY_;this.Speed=Speed_;this.BattleState=BattleState_;this.JoinIndex=JoinIndex_;this.ColliderRadius=ColliderRadius_;this.Removed=Removed_;this.Score=Score_;this.LastMoveGmtMillis=LastMoveGmtMillis_;this.FramesToRecover=FramesToRecover_;this.FramesInChState=FramesInChState_;this.Hp=Hp_;this.MaxHp=MaxHp_;this.CharacterState=CharacterState_;this.InAir=InAir_;this.OnWall=OnWall_;this.OnWallNormX=OnWallNormX_;this.OnWallNormY=OnWallNormY_;this.CapturedByInertia=CapturedByInertia_;this.ActiveSkillId=ActiveSkillId_;this.ActiveSkillHit=ActiveSkillHit_;this.FramesInvinsible=FramesInvinsible_;this.BulletTeamId=BulletTeamId_;this.ChCollisionTeamId=ChCollisionTeamId_;this.RevivalVirtualGridX=RevivalVirtualGridX_;this.RevivalVirtualGridY=RevivalVirtualGridY_;});F=$pkg.InputFrameDecoded=$newType(0,$kindStruct,"battle.InputFrameDecoded",true,"jsexport/battle",true,function(Dx_,Dy_,BtnALevel_,BtnBLevel_){this.$val=this;if(arguments.length===0){this.Dx=0;this.Dy=0;this.BtnALevel=0;this.BtnBLevel=0;return;}this.Dx=Dx_;this.Dy=Dy_;this.BtnALevel=BtnALevel_;this.BtnBLevel=BtnBLevel_;});H=$pkg.Barrier=$newType(0,$kindStruct,"battle.Barrier",true,"jsexport/battle",true,function(Boundary_){this.$val=this;if(arguments.length===0){this.Boundary=CF.nil;return;}this.Boundary=Boundary_;});I=$pkg.BulletConfig=$newType(0,$kindStruct,"battle.BulletConfig",true,"jsexport/battle",true,function(StartupFrames_,CancellableStFrame_,CancellableEdFrame_,ActiveFrames_,HitStunFrames_,BlockStunFrames_,PushbackVelX_,PushbackVelY_,Damage_,SelfLockVelX_,SelfLockVelY_,HitboxOffsetX_,HitboxOffsetY_,HitboxSizeX_,HitboxSizeY_,BlowUp_,ExplosionFrames_,SpeciesId_,CancelTransit_){this.$val=this;if(arguments.length===0){this.StartupFrames=0;this.CancellableStFrame=0;this.CancellableEdFrame=0;this.ActiveFrames=0;this.HitStunFrames=0;this.BlockStunFrames=0;this.PushbackVelX=0;this.PushbackVelY=0;this.Damage=0;this.SelfLockVelX=0;this.SelfLockVelY=0;this.HitboxOffsetX=0;this.HitboxOffsetY=0;this.HitboxSizeX=0;this.HitboxSizeY=0;this.BlowUp=false;this.ExplosionFrames=0;this.SpeciesId=0;this.CancelTransit=false;return;}this.StartupFrames=StartupFrames_;this.CancellableStFrame=CancellableStFrame_;this.CancellableEdFrame=CancellableEdFrame_;this.ActiveFrames=ActiveFrames_;this.HitStunFrames=HitStunFrames_;this.BlockStunFrames=BlockStunFrames_;this.PushbackVelX=PushbackVelX_;this.PushbackVelY=PushbackVelY_;this.Damage=Damage_;this.SelfLockVelX=SelfLockVelX_;this.SelfLockVelY=SelfLockVelY_;this.HitboxOffsetX=HitboxOffsetX_;this.HitboxOffsetY=HitboxOffsetY_;this.HitboxSizeX=HitboxSizeX_;this.HitboxSizeY=HitboxSizeY_;this.BlowUp=BlowUp_;this.ExplosionFrames=ExplosionFrames_;this.SpeciesId=SpeciesId_;this.CancelTransit=CancelTransit_;});J=$pkg.BulletBattleAttr=$newType(0,$kindStruct,"battle.BulletBattleAttr",true,"jsexport/battle",true,function(BulletLocalId_,OriginatedRenderFrameId_,OffenderJoinIndex_,TeamId_){this.$val=this;if(arguments.length===0){this.BulletLocalId=0;this.OriginatedRenderFrameId=0;this.OffenderJoinIndex=0;this.TeamId=0;return;}this.BulletLocalId=BulletLocalId_;this.OriginatedRenderFrameId=OriginatedRenderFrameId_;this.OffenderJoinIndex=OffenderJoinIndex_;this.TeamId=TeamId_;});K=$pkg.MeleeBullet=$newType(0,$kindStruct,"battle.MeleeBullet",true,"jsexport/battle",true,function(BlState_,FramesInBlState_,BattleAttr_,Bullet_){this.$val=this;if(arguments.length===0){this.BlState=0;this.FramesInBlState=0;this.BattleAttr=BH.nil;this.Bullet=BI.nil;return;}this.BlState=BlState_;this.FramesInBlState=FramesInBlState_;this.BattleAttr=BattleAttr_;this.Bullet=Bullet_;});L=$pkg.FireballBullet=$newType(0,$kindStruct,"battle.FireballBullet",true,"jsexport/battle",true,function(VirtualGridX_,VirtualGridY_,DirX_,DirY_,VelX_,VelY_,Speed_,BlState_,FramesInBlState_,BattleAttr_,Bullet_){this.$val=this;if(arguments.length===0){this.VirtualGridX=0;this.VirtualGridY=0;this.DirX=0;this.DirY=0;this.VelX=0;this.VelY=0;this.Speed=0;this.BlState=0;this.FramesInBlState=0;this.BattleAttr=BH.nil;this.Bullet=BI.nil;return;}this.VirtualGridX=VirtualGridX_;this.VirtualGridY=VirtualGridY_;this.DirX=DirX_;this.DirY=DirY_;this.VelX=VelX_;this.VelY=VelY_;this.Speed=Speed_;this.BlState=BlState_;this.FramesInBlState=FramesInBlState_;this.BattleAttr=BattleAttr_;this.Bullet=Bullet_;});M=$pkg.Skill=$newType(0,$kindStruct,"battle.Skill",true,"jsexport/battle",true,function(BattleLocalId_,RecoveryFrames_,RecoveryFramesOnBlock_,RecoveryFramesOnHit_,ReleaseTriggerType_,BoundChState_,Hits_){this.$val=this;if(arguments.length===0){this.BattleLocalId=0;this.RecoveryFrames=0;this.RecoveryFramesOnBlock=0;this.RecoveryFramesOnHit=0;this.ReleaseTriggerType=0;this.BoundChState=0;this.Hits=BG.nil;return;}this.BattleLocalId=BattleLocalId_;this.RecoveryFrames=RecoveryFrames_;this.RecoveryFramesOnBlock=RecoveryFramesOnBlock_;this.RecoveryFramesOnHit=RecoveryFramesOnHit_;this.ReleaseTriggerType=ReleaseTriggerType_;this.BoundChState=BoundChState_;this.Hits=Hits_;});N=$pkg.RoomDownsyncFrame=$newType(0,$kindStruct,"battle.RoomDownsyncFrame",true,"jsexport/battle",true,function(Id_,PlayersArr_,CountdownNanos_,MeleeBullets_,FireballBullets_,BackendUnconfirmedMask_,ShouldForceResync_,BulletLocalIdCounter_){this.$val=this;if(arguments.length===0){this.Id=0;this.PlayersArr=BV.nil;this.CountdownNanos=new $Int64(0,0);this.MeleeBullets=BW.nil;this.FireballBullets=BX.nil;this.BackendUnconfirmedMask=new $Uint64(0,0);this.ShouldForceResync=false;this.BulletLocalIdCounter=0;return;}this.Id=Id_;this.PlayersArr=PlayersArr_;this.CountdownNanos=CountdownNanos_;this.MeleeBullets=MeleeBullets_;this.FireballBullets=FireballBullets_;this.BackendUnconfirmedMask=BackendUnconfirmedMask_;this.ShouldForceResync=ShouldForceResync_;this.BulletLocalIdCounter=BulletLocalIdCounter_;});O=$pkg.InputFrameDownsync=$newType(0,$kindStruct,"battle.InputFrameDownsync",true,"jsexport/battle",true,function(InputFrameId_,InputList_,ConfirmedList_){this.$val=this;if(arguments.length===0){this.InputFrameId=0;this.InputList=BU.nil;this.ConfirmedList=new $Uint64(0,0);return;}this.InputFrameId=InputFrameId_;this.InputList=InputList_;this.ConfirmedList=ConfirmedList_;});P=$pkg.NpcPatrolCue=$newType(0,$kindStruct,"battle.NpcPatrolCue",true,"jsexport/battle",true,function(FlAct_,FrAct_,X_,Y_){this.$val=this;if(arguments.length===0){this.FlAct=new $Uint64(0,0);this.FrAct=new $Uint64(0,0);this.X=0;this.Y=0;return;}this.FlAct=FlAct_;this.FrAct=FrAct_;this.X=X_;this.Y=Y_;});Q=$pkg.RingBuffer=$newType(0,$kindStruct,"battle.RingBuffer",true,"jsexport/battle",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=BG.nil;return;}this.Ed=Ed_;this.St=St_;this.EdFrameId=EdFrameId_;this.StFrameId=StFrameId_;this.N=N_;this.Cnt=Cnt_;this.Eles=Eles_;});S=$pkg.SkillMapperType=$newType(4,$kindFunc,"battle.SkillMapperType",true,"jsexport/battle",true,null);T=$pkg.CharacterConfig=$newType(0,$kindStruct,"battle.CharacterConfig",true,"jsexport/battle",true,function(SpeciesId_,SpeciesName_,InAirIdleFrameIdxTurningPoint_,InAirIdleFrameIdxTurnedCycle_,LayDownFrames_,LayDownFramesToRecover_,GetUpInvinsibleFrames_,GetUpFramesToRecover_,Speed_,JumpingInitVelY_,JumpingFramesToRecover_,DashingEnabled_,OnWallEnabled_,WallJumpingFramesToRecover_,WallJumpingInitVelX_,WallJumpingInitVelY_,WallSlidingVelY_,InertiaFramesToRecover_,SkillMapper_){this.$val=this;if(arguments.length===0){this.SpeciesId=0;this.SpeciesName="";this.InAirIdleFrameIdxTurningPoint=0;this.InAirIdleFrameIdxTurnedCycle=0;this.LayDownFrames=0;this.LayDownFramesToRecover=0;this.GetUpInvinsibleFrames=0;this.GetUpFramesToRecover=0;this.Speed=0;this.JumpingInitVelY=0;this.JumpingFramesToRecover=0;this.DashingEnabled=false;this.OnWallEnabled=false;this.WallJumpingFramesToRecover=0;this.WallJumpingInitVelX=0;this.WallJumpingInitVelY=0;this.WallSlidingVelY=0;this.InertiaFramesToRecover=0;this.SkillMapper=$throwNilPointerError;return;}this.SpeciesId=SpeciesId_;this.SpeciesName=SpeciesName_;this.InAirIdleFrameIdxTurningPoint=InAirIdleFrameIdxTurningPoint_;this.InAirIdleFrameIdxTurnedCycle=InAirIdleFrameIdxTurnedCycle_;this.LayDownFrames=LayDownFrames_;this.LayDownFramesToRecover=LayDownFramesToRecover_;this.GetUpInvinsibleFrames=GetUpInvinsibleFrames_;this.GetUpFramesToRecover=GetUpFramesToRecover_;this.Speed=Speed_;this.JumpingInitVelY=JumpingInitVelY_;this.JumpingFramesToRecover=JumpingFramesToRecover_;this.DashingEnabled=DashingEnabled_;this.OnWallEnabled=OnWallEnabled_;this.WallJumpingFramesToRecover=WallJumpingFramesToRecover_;this.WallJumpingInitVelX=WallJumpingInitVelX_;this.WallJumpingInitVelY=WallJumpingInitVelY_;this.WallSlidingVelY=WallSlidingVelY_;this.InertiaFramesToRecover=InertiaFramesToRecover_;this.SkillMapper=SkillMapper_;});AH=$pkg.SatResult=$newType(0,$kindStruct,"battle.SatResult",true,"jsexport/battle",true,function(Overlap_,OverlapX_,OverlapY_,AContainedInB_,BContainedInA_,Axis_){this.$val=this;if(arguments.length===0){this.Overlap=0;this.OverlapX=0;this.OverlapY=0;this.AContainedInB=false;this.BContainedInA=false;this.Axis=B.Vector.nil;return;}this.Overlap=Overlap_;this.OverlapX=OverlapX_;this.OverlapY=OverlapY_;this.AContainedInB=AContainedInB_;this.BContainedInA=BContainedInA_;this.Axis=Axis_;});BE=$sliceType($Int32);BF=$sliceType(BE);BG=$sliceType($emptyInterface);BH=$ptrType(J);BI=$ptrType(I);BJ=$ptrType(M);BK=$ptrType(K);BL=$ptrType(AH);BM=$sliceType(C);BN=$sliceType($String);BO=$ptrType(B.Collision);BP=$ptrType(BM);BQ=$ptrType(E);BR=$ptrType(L);BS=$ptrType(B.ConvexPolygon);BT=$ptrType(O);BU=$sliceType($Uint64);BV=$sliceType(BQ);BW=$sliceType(BK);BX=$sliceType(BR);BY=$sliceType(BP);BZ=$sliceType($Bool);CA=$ptrType(B.Object);CB=$sliceType(CA);CC=$sliceType($Float64);CD=$ptrType(C);CE=$sliceType(CD);CF=$ptrType(D);CG=$mapType($Int,$Int);CH=$ptrType(Q);R=function(a){var a;return new Q.ptr(0,0,0,0,a,0,$makeSlice(BG,a));};$pkg.NewRingBuffer=R;Q.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;}};Q.prototype.Put=function(a){return this.$val.Put(a);};Q.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;};Q.prototype.Pop=function(){return this.$val.Pop();};Q.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]));};Q.prototype.GetByOffset=function(a){return this.$val.GetByOffset(a);};Q.ptr.prototype.GetByFrameId=function(a){var a,b;b=this;if(a>=b.EdFrameId||a>0);};Q.prototype.GetByFrameId=function(a){return this.$val.GetByFrameId(a);};Q.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(g>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))+6>>0);};$pkg.ConvertToFirstUsedRenderFrameId=AE;AF=function(a){var a;return(((((a<<2>>0))+6>>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 F.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,BL.nil];}return;}}catch(err){$err=err;$s=-1;return[false,0,0,BL.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;d=a.Points.$length;e=b.Points.$length;f=d;g=e;if((1===f)&&(1===g)){if(!(BL.nil===c)){c.Overlap=0;}return((h=(i=a.Points,(0>=i.$length?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+0])),(0>=h.$length?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+0]))===(j=(k=b.Points,(0>=k.$length?($throwRuntimeError("index out of range"),undefined):k.$array[k.$offset+0])),(0>=j.$length?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+0])))&&((l=(m=a.Points,(0>=m.$length?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+0])),(1>=l.$length?($throwRuntimeError("index out of range"),undefined):l.$array[l.$offset+1]))===(n=(o=b.Points,(0>=o.$length?($throwRuntimeError("index out of range"),undefined):o.$array[o.$offset+0])),(1>=n.$length?($throwRuntimeError("index out of range"),undefined):n.$array[n.$offset+1])));}if(1=p.$length)?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+q]);if(AO(a,b,r.Unit(),c)){return false;}q++;}}if(1=s.$length)?($throwRuntimeError("index out of range"),undefined):s.$array[s.$offset+t]);if(AO(a,b,u.Unit(),c)){return false;}t++;}}return true;};AK=function(a,b){var a,b;if(2===a.BlState){return false;}return((a.BattleAttr.OriginatedRenderFrameId+a.Bullet.StartupFrames>>0)<=b.Id)&&(((a.BattleAttr.OriginatedRenderFrameId+a.Bullet.StartupFrames>>0)+a.Bullet.ActiveFrames>>0)>b.Id);};$pkg.IsMeleeBulletActive=AK;AL=function(a,b){var a,b;if(2===a.BlState){return a.FramesInBlState>0)+a.Bullet.ActiveFrames>>0)>b.Id;};$pkg.IsMeleeBulletAlive=AL;AM=function(a,b){var a,b;if(2===a.BlState){return false;}return((a.BattleAttr.OriginatedRenderFrameId+a.Bullet.StartupFrames>>0)>0)+a.Bullet.ActiveFrames>>0)>b.Id);};$pkg.IsFireballBulletActive=AM;AN=function(a,b){var a,b;if(2===a.BlState){return a.FramesInBlState>0)+a.Bullet.ActiveFrames>>0)>b.Id;};$pkg.IsFireballBulletAlive=AN;AO=function(a,b,c,d){var a,aa,ab,ac,ad,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=a.Points;n=0;while(true){if(!(n=m.$length)?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+n]);p=((0>=o.$length?($throwRuntimeError("index out of range"),undefined):o.$array[o.$offset+0])+a.X)*(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0])+((1>=o.$length?($throwRuntimeError("index out of range"),undefined):o.$array[o.$offset+1])+a.Y)*(1>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+1]);if(i>p){i=p;}if(j=q.$length)?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+r]);t=((0>=s.$length?($throwRuntimeError("index out of range"),undefined):s.$array[s.$offset+0])+b.X)*(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0])+((1>=s.$length?($throwRuntimeError("index out of range"),undefined):s.$array[s.$offset+1])+b.Y)*(1>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+1]);if(k>t){k=t;}if(ll||jl){u=i-l;d.AContainedInB=false;}else{x=j-k;y=l-i;if(x=ab.$length?($throwRuntimeError("index out of range"),undefined):ab.$array[ab.$offset+0])))&&(0===(ac=d.Axis,(1>=ac.$length?($throwRuntimeError("index out of range"),undefined):ac.$array[ac.$offset+1]))))||z>aa){ad=1;if(u<0){ad=-1;}d.Overlap=aa;d.OverlapX=(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0])*ad;d.OverlapY=(1>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+1])*ad;}d.Axis=c;}return false;};AP=function(a,b){var a,b,c,d;c=((A.Round(a*100)>>0));d=((A.Round(b*100)>>0));return[c,d];};$pkg.WorldToVirtualGridPos=AP;AQ=function(a,b){var a,b,c,d;c=(a)*0.01;d=(b)*0.01;return[c,d];};$pkg.VirtualGridToWorldPos=AQ;AR=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=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.PolygonColliderBLToWorldPos=AS;AT=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=AS(a,b,c,d,e,f,g,h,i,j);l=k[0];m=k[1];return AP(l,m);};$pkg.PolygonColliderBLToVirtualGridPos=AT;AV=function(a,b,c,d,e,f,g){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,$s,$r,$c}=$restore(this,{a,b,c,d,e,f,g});$s=$s||0;s:while(true){switch($s){case 0:h=[h];h[0]=$makeSlice(BM,0,10);i=0;if((16===b.CharacterState)&&(0===c.VelX)&&(b.DirX===c.DirX)){j=1;if(0>c.DirX){j=-j;}i=j*(b.Speed)*0.01;}k=d.Check(i,0,new BN([]));if(BO.nil===k){$s=-1;return(h.$ptr||(h.$ptr=new BP(function(){return this.$target[0];},function($v){this.$target[0]=$v;},h)));}l=k.Objects;m=0;case 1:if(!(m=l.$length)?($throwRuntimeError("index out of range"),undefined):l.$array[l.$offset+m]);o=false;p=n.Data;if($assertType(p,BQ,true)[1]||$assertType(p,BK,true)[1]||$assertType(p,BR,true)[1]){}else{o=true;}if(!o){m++;$s=1;continue;}q=$assertType(n.Shape,BS);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){m++;$s=1;continue;}x=(w.Overlap-f)*w.OverlapX;y=(w.Overlap-f)*w.OverlapY;u=x;v=y;h[0]=$append(h[0],new C.ptr(w.OverlapX,w.OverlapY));g.X=g.X+(u);g.Y=g.Y+(v);m++;$s=1;continue;case 2:$s=-1;return(h.$ptr||(h.$ptr=new BP(function(){return this.$target[0];},function($v){this.$target[0]=$v;},h)));}return;}var $f={$blk:AV,$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,x,y,$s};return $f;};AW=function(a,b,c,d,e){var a,aa,ab,ac,ad,ae,af,ag,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),BT).InputList;l=BU.nil;if(0>0,((o<0||o>=k.$length)?($throwRuntimeError("index out of range"),undefined):k.$array[k.$offset+o])));q=0;r=0;s=q;t=r;u=0;v=0;w=u;x=v;if(!(BU.nil===l)){z=AG((y=n-1>>0,((y<0||y>=l.$length)?($throwRuntimeError("index out of range"),undefined):l.$array[l.$offset+y])));w=z.BtnALevel;x=z.BtnBLevel;}if(0===a.FramesToRecover){aa=p.Dx;ab=p.Dy;s=aa;t=ab;}ac=-1;ad=a.CapturedByInertia&&(((d.InertiaFramesToRecover>>1>>0))>a.FramesToRecover);if((0===a.FramesToRecover)||ad){if(p.BtnBLevel>x){if(d.DashingEnabled&&0>p.Dy&&!((15===a.CharacterState))){ac=5;}else{ae=(af=V[$Int32.keyFor(a.CharacterState)],af!==undefined?[af.v,true]:[false,false]);ag=ae[1];if(!ag){m=true;}else if(16===a.CharacterState){m=true;}}}}if(-1===ac){if(0w){if(0>p.Dy){ac=3;}else if(0=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+k]);((l<0||l>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+l]=new E.ptr(m.Id,m.VirtualGridX,m.VirtualGridY,m.DirX,m.DirY,m.VelX,m.VelY,m.Speed,m.BattleState,m.JoinIndex,m.ColliderRadius,m.Removed,m.Score,0,m.FramesToRecover-1>>0,m.FramesInChState+1>>0,m.Hp,m.MaxHp,m.CharacterState,true,false,m.OnWallNormX,m.OnWallNormY,m.CapturedByInertia,m.ActiveSkillId,m.ActiveSkillHit,m.FramesInvinsible-1>>0,m.BulletTeamId,m.ChCollisionTeamId,m.RevivalVirtualGridX,m.RevivalVirtualGridY));if(((l<0||l>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+l]).FramesToRecover<0){((l<0||l>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+l]).FramesToRecover=0;}if(((l<0||l>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+l]).FramesInvinsible<0){((l<0||l>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+l]).FramesInvinsible=0;}k++;}n=$makeSlice(BW,0,b.MeleeBullets.$length);o=$makeSlice(BX,0,b.FireballBullets.$length);p=$makeSlice(BM,h);q=$makeSlice(BY,h);r=$makeSlice(BZ,h);s=b.BulletLocalIdCounter;t=b.PlayersArr;u=0;case 1:if(!(u=t.$length)?($throwRuntimeError("index out of range"),undefined):t.$array[t.$offset+u]);z=((x<0||x>=g.$length)?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+x]);aa=((x<0||x>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+x]);ab=AW(y,aa,b,z,a);ac=ab[0];ad=ab[1];ae=ab[2];af=ab[3];((x<0||x>=r.$length)?($throwRuntimeError("index out of range"),undefined):r.$array[r.$offset+x]=ad);ag=y.JoinIndex;ah=z.SkillMapper(ac,y);$s=3;case 3:if($c){$c=false;ah=ah.$blk();}if(ah&&ah.$blk!==undefined){break s;}ai=ah;aj=(ak=U[$Int.keyFor(ai)],ak!==undefined?[ak.v,true]:[BJ.nil,false]);al=aj[0];am=aj[1];if(am){aa.ActiveSkillId=((ai>>0));aa.ActiveSkillHit=0;aa.FramesToRecover=al.RecoveryFrames;an=1;if(0>aa.DirX){an=-an;}ao=false;ap=(aq=al.Hits,ar=aa.ActiveSkillHit,((ar<0||ar>=aq.$length)?($throwRuntimeError("index out of range"),undefined):aq.$array[aq.$offset+ar]));if($assertType(ap,BK,true)[1]){as=ap.$val;v[0]=$clone(as,K);v[0].BattleAttr=new J.ptr(s,b.Id,ag,y.BulletTeamId);s=s+(1)>>0;v[0].BlState=0;n=$append(n,v[0]);if(!((-1===as.Bullet.SelfLockVelX))){ao=true;aa.VelX=$imul(an,as.Bullet.SelfLockVelX);}if(!((-1===as.Bullet.SelfLockVelY))){ao=true;aa.VelY=as.Bullet.SelfLockVelY;}}else if($assertType(ap,BR,true)[1]){at=ap.$val;w[0]=$clone(at,L);w[0].BattleAttr=new J.ptr(s,b.Id,ag,y.BulletTeamId);s=s+(1)>>0;au=y.VirtualGridX+($imul(an,w[0].Bullet.HitboxOffsetX))>>0;av=y.VirtualGridY+w[0].Bullet.HitboxOffsetY>>0;w[0].VirtualGridX=au;w[0].VirtualGridY=av;w[0].DirX=an;w[0].DirY=0;w[0].VelX=$imul(w[0].Speed,an);w[0].VelY=0;w[0].BlState=0;o=$append(o,w[0]);if(!((-1===at.Bullet.SelfLockVelX))){ao=true;aa.VelX=$imul(an,at.Bullet.SelfLockVelX);}if(!((-1===at.Bullet.SelfLockVelY))){ao=true;aa.VelY=at.Bullet.SelfLockVelY;}}if(false===ao&&false===y.InAir){aa.VelX=0;}aa.CharacterState=al.BoundChState;u++;$s=1;continue;}if(0===y.FramesToRecover){aw=y.CapturedByInertia;ax=z.OnWallEnabled&&(z.WallJumpingInitVelX===Z(y.VelX));ay=true;az=false;ba=false;if(!((0===ae))&&(0===aa.VelX)){ay=false;}else if((0===ae)&&!((0===aa.VelX))){ay=false;ba=true;}else if(0>($imul(ae,aa.VelX))){ay=false;az=true;}if(!ad&&!ax&&!aw&&!ay){aa.CapturedByInertia=true;if(az){aa.CharacterState=17;aa.FramesToRecover=z.InertiaFramesToRecover;}else if(ba){aa.FramesToRecover=z.InertiaFramesToRecover;}else{aa.FramesToRecover=(z.InertiaFramesToRecover>>1>>0);}}else{aa.CapturedByInertia=false;if(!((0===ae))){bb=1;if(0>ae){bb=-bb;}aa.DirX=ae;aa.DirY=af;if(ax){aa.VelX=$imul(bb,Z(y.VelX));}else{aa.VelX=$imul(bb,y.Speed);}aa.CharacterState=1;}else{aa.CharacterState=0;aa.VelX=0;}}}u++;$s=1;continue;case 2:bc=$makeSlice(CB,b.PlayersArr.$length,b.PlayersArr.$length);bd=b.PlayersArr;be=0;case 4:if(!(be=bd.$length)?($throwRuntimeError("index out of range"),undefined):bd.$array[bd.$offset+be]);bh=bg.JoinIndex;bi=0;bj=0;(bk=bh-1>>0,((bk<0||bk>=p.$length)?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+bk])).X=bi;(bl=bh-1>>0,((bl<0||bl>=p.$length)?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+bl])).Y=bj;bm=((bf<0||bf>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+bf]);bn=((bf<0||bf>=g.$length)?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+bf]);bo=bg.VirtualGridX+bg.VelX>>0;bp=bg.VirtualGridY+bg.VelY>>0;bq=bo;br=bp;if(0>=bm.Hp&&(0===bm.FramesToRecover)){bs=bg.RevivalVirtualGridX;bt=bg.RevivalVirtualGridY;bq=bs;br=bt;bm.CharacterState=0;bm.Hp=bg.MaxHp;}if(((bf<0||bf>=r.$length)?($throwRuntimeError("index out of range"),undefined):r.$array[r.$offset+bf])){if(16===bg.CharacterState){if(0<($imul(bg.VelX,bg.OnWallNormX))){bq=bq-(bg.VelX)>>0;}bu=-1;if(0>bg.OnWallNormX){bu=-bu;}bq=bq+(($imul(bu,bn.WallJumpingInitVelX)))>>0;br=br+(bn.WallJumpingInitVelY)>>0;bm.VelX=(($imul(bu,bn.WallJumpingInitVelX)));bm.VelY=(bn.WallJumpingInitVelY);bm.FramesToRecover=bn.WallJumpingFramesToRecover;}else{bm.VelY=(bn.JumpingInitVelY);br=br+(bn.JumpingInitVelY)>>0;}}bv=AQ(bq,br);bw=bv[0];bx=bv[1];by=$imul(bg.ColliderRadius,2);bz=$imul(bg.ColliderRadius,4);ca=by;cb=bz;cc=bg.CharacterState;if(cc===(9)){cd=$imul(bg.ColliderRadius,4);ce=$imul(bg.ColliderRadius,2);ca=cd;cb=ce;}else if((cc===(8))||(cc===(4))||(cc===(5))||(cc===(16))){cf=$imul(bg.ColliderRadius,2);cg=$imul(bg.ColliderRadius,2);ca=cf;cb=cg;}ch=AQ(ca,cb);ci=ch[0];cj=ch[1];ck=AY(bw,bx,ci,cj,0.1,0.1,0.1,0.1,e,f,bg,"Player");$s=6;case 6:if($c){$c=false;ck=ck.$blk();}if(ck&&ck.$blk!==undefined){break s;}cl=ck;((bf<0||bf>=bc.$length)?($throwRuntimeError("index out of range"),undefined):bc.$array[bc.$offset+bf]=cl);$r=c.Add(new CB([cl]));$s=7;case 7:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}if(bg.InAir){if((16===bg.CharacterState)&&!((bf<0||bf>=r.$length)?($throwRuntimeError("index out of range"),undefined):r.$array[r.$offset+bf])){bm.VelX=bm.VelX+(0)>>0;bm.VelY=bn.WallSlidingVelY;}else if(15===bg.CharacterState){bm.VelX=bm.VelX+(0)>>0;}else{bm.VelX=bm.VelX+(0)>>0;bm.VelY=bm.VelY+(-50)>>0;}}be++;$s=4;continue;case 5:cm=$makeSlice(CB,0,((((b.MeleeBullets.$length+b.FireballBullets.$length>>0))<<1>>0)));cn=b.FireballBullets;co=0;case 8:if(!(co=cn.$length)?($throwRuntimeError("index out of range"),undefined):cn.$array[cn.$offset+co]);cq=new L.ptr(cp.VirtualGridX,cp.VirtualGridY,cp.DirX,cp.DirY,cp.VelX,cp.VelY,cp.Speed,cp.BlState,cp.FramesInBlState+1>>0,cp.BattleAttr,cp.Bullet);if(AN(cq,b)){$s=10;continue;}$s=11;continue;case 10:if(AM(cq,b)){$s=12;continue;}$s=13;continue;case 12:cr=AQ(cq.VirtualGridX,cq.VirtualGridY);cs=cr[0];ct=cr[1];cu=AQ(cq.Bullet.HitboxSizeX,cq.Bullet.HitboxSizeY);cv=cu[0];cw=cu[1];cx=AY(cs,ct,cv,cw,0.1,0.1,0.1,0.1,e,f,cq,"FireballBullet");$s=15;case 15:if($c){$c=false;cx=cx.$blk();}if(cx&&cx.$blk!==undefined){break s;}cy=cx;$r=c.Add(new CB([cy]));$s=16;case 16:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}cm=$append(cm,cy);cq.BlState=1;if(!((cq.BlState===cp.BlState))){cq.FramesInBlState=0;}cz=cq.VirtualGridX+cq.VelX>>0;da=cq.VirtualGridY+cq.VelY>>0;cq.VirtualGridX=cz;cq.VirtualGridY=da;$s=14;continue;case 13:dd=(db=b.PlayersArr,dc=cq.BattleAttr.OffenderJoinIndex-1>>0,((dc<0||dc>=db.$length)?($throwRuntimeError("index out of range"),undefined):db.$array[db.$offset+dc]));de=(df=W[$Int32.keyFor(dd.CharacterState)],df!==undefined?[df.v,true]:[false,false]);dg=de[1];if(dg){co++;$s=8;continue;}case 14:o=$append(o,cq);case 11:co++;$s=8;continue;case 9:dh=b.MeleeBullets;di=0;case 17:if(!(di=dh.$length)?($throwRuntimeError("index out of range"),undefined):dh.$array[dh.$offset+di]);dk=new K.ptr(dj.BlState,dj.FramesInBlState+1>>0,dj.BattleAttr,dj.Bullet);if(AL(dk,b)){$s=19;continue;}$s=20;continue;case 19:dn=(dl=b.PlayersArr,dm=dk.BattleAttr.OffenderJoinIndex-1>>0,((dm<0||dm>=dl.$length)?($throwRuntimeError("index out of range"),undefined):dl.$array[dl.$offset+dm]));dp=(dq=W[$Int32.keyFor(dn.CharacterState)],dq!==undefined?[dq.v,true]:[false,false]);dr=dp[1];if(dr){di++;$s=17;continue;}if(AK(dk,b)){$s=21;continue;}$s=22;continue;case 21:ds=1;if(0>dn.DirX){ds=-ds;}dt=AQ(dn.VirtualGridX+($imul(ds,dk.Bullet.HitboxOffsetX))>>0,dn.VirtualGridY);du=dt[0];dv=dt[1];dw=AQ(dk.Bullet.HitboxSizeX,dk.Bullet.HitboxSizeY);dx=dw[0];dy=dw[1];dz=AY(du,dv,dx,dy,0.1,0.1,0.1,0.1,e,f,dk,"MeleeBullet");$s=23;case 23:if($c){$c=false;dz=dz.$blk();}if(dz&&dz.$blk!==undefined){break s;}ea=dz;$r=c.Add(new CB([ea]));$s=24;case 24:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}cm=$append(cm,ea);dk.BlState=1;if(!((dk.BlState===dj.BlState))){dk.FramesInBlState=0;}case 22:n=$append(n,dk);case 20:di++;$s=17;continue;case 18:eb=b.PlayersArr;ec=0;case 25:if(!(ec=eb.$length)?($throwRuntimeError("index out of range"),undefined):eb.$array[eb.$offset+ec]);ef=ee.JoinIndex;eg=((ed<0||ed>=bc.$length)?($throwRuntimeError("index out of range"),undefined):bc.$array[bc.$offset+ed]);eh=$assertType(eg.Shape,BS);ei=((ed<0||ed>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+ed]);ek=AV(ef,ee,ei,eg,eh,0.1,(ej=ef-1>>0,((ej<0||ej>=p.$length)?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+ej])));$s=27;case 27:if($c){$c=false;ek=ek.$blk();}if(ek&&ek.$blk!==undefined){break s;}(el=ef-1>>0,((el<0||el>=q.$length)?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+el]=ek));em=((ed<0||ed>=g.$length)?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+ed]);en=false;eo=eg.Check(0,0,new BN([]));if(!(BO.nil===eo)){$s=28;continue;}$s=29;continue;case 28:ep=eo.Objects;eq=0;case 30:if(!(eq=ep.$length)?($throwRuntimeError("index out of range"),undefined):ep.$array[ep.$offset+eq]);es=false;et=false;eu=false;ev=es;ew=et;ex=eu;ey=er.Data;if($assertType(ey,BQ,true)[1]){ew=true;}else if($assertType(ey,BK,true)[1]||$assertType(ey,BR,true)[1]){ex=true;}else{ev=true;}if(ex){eq++;$s=30;continue;}ez=$assertType(er.Shape,BS);fb=AI(0,0,eh,ez);$s=32;case 32:if($c){$c=false;fb=fb.$blk();}if(fb&&fb.$blk!==undefined){break s;}fa=fb;fc=fa[0];fd=fa[1];fe=fa[2];ff=fa[3];if(!fc){eq++;$s=30;continue;}fg=ff.OverlapX*0+ff.OverlapY*-1;if(ew){fh=(ff.Overlap-0.2)*ff.OverlapX;fi=(ff.Overlap-0.2)*ff.OverlapY;fd=fh;fe=fi;}fj=(fk=ef-1>>0,((fk<0||fk>=q.$length)?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+fk])).$get();fl=0;while(true){if(!(fl=fj.$length)?($throwRuntimeError("index out of range"),undefined):fj.$array[fj.$offset+fl]),C);fn=fd*fm.X+fe*fm.Y;if(ev||(ew&&0>fn)){fd=fd-(fn*fm.X);fe=fe-(fn*fm.Y);}fl++;}fo=ef-1>>0;((fo<0||fo>=p.$length)?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+fo]).X=((fo<0||fo>=p.$length)?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+fo]).X+(fd);fp=ef-1>>0;((fp<0||fp>=p.$length)?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+fp]).Y=((fp<0||fp>=p.$length)?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+fp]).Y+(fe);if(0.5=ee.VelY;if(fq){ei.VelY=0;ei.VelX=0;if(8===ei.CharacterState){ei.CharacterState=9;ei.FramesToRecover=em.LayDownFramesToRecover;}else{fr=ee.CharacterState;if((fr===(8))||(fr===(4))||(fr===(5))||(fr===(16))){fs=0;ft=ee.ColliderRadius;fu=fs;fv=ft;fw=AQ(fu,fv);fx=fw[1];fy=ef-1>>0;((fy<0||fy>=p.$length)?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+fy]).Y=((fy<0||fy>=p.$length)?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+fy]).Y-(fx);}ei.CharacterState=0;ei.FramesToRecover=0;}}else{fz=(ga=Y[$Int32.keyFor(ei.CharacterState)],ga!==undefined?[ga.v,true]:[false,false]);gb=fz[1];if(gb){if(9===ei.CharacterState){if(0===ei.FramesToRecover){ei.CharacterState=10;ei.FramesToRecover=em.GetUpFramesToRecover;}}else if(10===ei.CharacterState){if(0===ei.FramesToRecover){ei.CharacterState=0;ei.FramesInvinsible=em.GetUpInvinsibleFrames;}}}}}if(em.OnWallEnabled){if(ei.InAir){gc=(gd=W[$Int32.keyFor(ee.CharacterState)],gd!==undefined?[gd.v,true]:[false,false]);ge=gc[1];if(!ge){gf=(gg=ef-1>>0,((gg<0||gg>=q.$length)?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+gg])).$get();gh=0;while(true){if(!(gh=gf.$length)?($throwRuntimeError("index out of range"),undefined):gf.$array[gf.$offset+gh]),C);gj=gi.X*1+gi.Y*0;gk=gi.X*-1+gi.Y*0;if(0.9>0));gm=((gi.Y>>0));ei.OnWallNormX=gl;ei.OnWallNormY=gm;break;}if(0.9>0));go=((gi.Y>>0));ei.OnWallNormX=gn;ei.OnWallNormY=go;break;}gh++;}}}if(!ei.OnWall){gp=0;gq=0;ei.OnWallNormX=gp;ei.OnWallNormY=gq;}}ec++;$s=25;continue;case 26:gr=cm;gs=0;case 33:if(!(gs=gr.$length)?($throwRuntimeError("index out of range"),undefined):gr.$array[gr.$offset+gs]);gu=gt.Check(0,0,new BN([]));gt.Space.Remove(new CB([gt]));gv=false;if(!(BO.nil===gu)){$s=35;continue;}$s=36;continue;case 35:gw=gt.Data;if($assertType(gw,BK,true)[1]){$s=37;continue;}if($assertType(gw,BR,true)[1]){$s=38;continue;}$s=39;continue;case 37:gx=gw.$val;gz=$assertType(gt.Shape,BS);hc=(ha=b.PlayersArr,hb=gx.BattleAttr.OffenderJoinIndex-1>>0,((hb<0||hb>=ha.$length)?($throwRuntimeError("index out of range"),undefined):ha.$array[ha.$offset+hb]));hd=gu.Objects;he=0;case 40:if(!(he=hd.$length)?($throwRuntimeError("index out of range"),undefined):hd.$array[hd.$offset+he]);hg=$assertType(hf.Shape,BS);hh=hf.Data;if($assertType(hh,BQ,true)[1]){$s=42;continue;}$s=43;continue;case 42:hi=hh.$val;if(gx.BattleAttr.OffenderJoinIndex===hi.JoinIndex){he++;$s=40;continue;}hk=AI(0,0,gz,hg);$s=44;case 44:if($c){$c=false;hk=hk.$blk();}if(hk&&hk.$blk!==undefined){break s;}hj=hk;hl=hj[0];if(!hl){he++;$s=40;continue;}gv=true;hm=(hn=X[$Int32.keyFor(hi.CharacterState)],hn!==undefined?[hn.v,true]:[false,false]);ho=hm[1];if(ho){he++;$s=40;continue;}if(0hc.DirX){hp=-hp;}hr=(hq=hi.JoinIndex-1>>0,((hq<0||hq>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+hq]));hr.Hp=hr.Hp-(gx.Bullet.Damage)>>0;if(0>=hr.Hp){hr.Hp=0;hr.CharacterState=18;hr.FramesToRecover=60;}else{hs=$imul(hp,gx.Bullet.PushbackVelX);ht=gx.Bullet.PushbackVelY;hu=hs;hv=ht;hr.VelX=hu;hr.VelY=hv;if(gx.Bullet.BlowUp){hr.CharacterState=8;}else{hr.CharacterState=3;}hx=(hw=hi.JoinIndex-1>>0,((hw<0||hw>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+hw])).FramesToRecover;if(gx.Bullet.HitStunFrames>hx){hr.FramesToRecover=gx.Bullet.HitStunFrames;}}case 43:he++;$s=40;continue;case 41:$s=39;continue;case 38:gy=gw.$val;hy=$assertType(gt.Shape,BS);ib=(hz=b.PlayersArr,ia=gy.BattleAttr.OffenderJoinIndex-1>>0,((ia<0||ia>=hz.$length)?($throwRuntimeError("index out of range"),undefined):hz.$array[hz.$offset+ia]));ic=gu.Objects;id=0;case 45:if(!(id=ic.$length)?($throwRuntimeError("index out of range"),undefined):ic.$array[ic.$offset+id]);ig=$assertType(ie.Shape,BS);ih=ie.Data;if($assertType(ih,BQ,true)[1]){$s=47;continue;}$s=48;continue;case 47:ii=ih.$val;if(gy.BattleAttr.OffenderJoinIndex===ii.JoinIndex){id++;$s=45;continue;}il=AI(0,0,hy,ig);$s=50;case 50:if($c){$c=false;il=il.$blk();}if(il&&il.$blk!==undefined){break s;}ik=il;im=ik[0];if(!im){id++;$s=45;continue;}gv=true;io=(ip=X[$Int32.keyFor(ii.CharacterState)],ip!==undefined?[ip.v,true]:[false,false]);iq=io[1];if(iq){id++;$s=45;continue;}if(0ib.DirX){ir=-ir;}it=(is=ii.JoinIndex-1>>0,((is<0||is>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+is]));it.Hp=it.Hp-(gy.Bullet.Damage)>>0;if(0>=it.Hp){it.Hp=0;it.CharacterState=18;it.FramesToRecover=60;}else{iu=$imul(ir,gy.Bullet.PushbackVelX);iv=gy.Bullet.PushbackVelY;iw=iu;ix=iv;it.VelX=iw;it.VelY=ix;if(gy.Bullet.BlowUp){it.CharacterState=8;}else{it.CharacterState=3;}iz=(iy=ii.JoinIndex-1>>0,((iy<0||iy>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+iy])).FramesToRecover;if(gy.Bullet.HitStunFrames>iz){it.FramesToRecover=gy.Bullet.HitStunFrames;}}$s=49;continue;case 48:ij=ih;gv=true;case 49:id++;$s=45;continue;case 46:case 39:case 36:if(gv){ja=gt.Data;if($assertType(ja,BK,true)[1]){jb=ja.$val;jb.BlState=2;jb.FramesInBlState=0;}else if($assertType(ja,BR,true)[1]){jc=ja.$val;jc.BlState=2;jc.FramesInBlState=0;}}gs++;$s=33;continue;case 34:jd=b.PlayersArr;je=0;while(true){if(!(je=jd.$length)?($throwRuntimeError("index out of range"),undefined):jd.$array[jd.$offset+je]);jh=jg.JoinIndex;ji=((jf<0||jf>=bc.$length)?($throwRuntimeError("index out of range"),undefined):bc.$array[bc.$offset+jf]);jj=((jf<0||jf>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+jf]);jk=AT(ji.X-(jl=jh-1>>0,((jl<0||jl>=p.$length)?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+jl])).X,ji.Y-(jm=jh-1>>0,((jm<0||jm>=p.$length)?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+jm])).Y,ji.W*0.5,ji.H*0.5,0,0,0,0,e,f);jj.VirtualGridX=jk[0];jj.VirtualGridY=jk[1];if(jj.InAir){jn=jj.CharacterState;jo=jn;if((jo===(0))||(jo===(1))||(jo===(17))){if(((jf<0||jf>=r.$length)?($throwRuntimeError("index out of range"),undefined):r.$array[r.$offset+jf])||(5===jg.CharacterState)){jj.CharacterState=5;}else{jj.CharacterState=4;}}else if(jo===(2)){jj.CharacterState=6;}else if(jo===(3)){jj.CharacterState=7;}}if(jj.OnWall){jp=jj.CharacterState;if((jp===(1))||(jp===(5))||(jp===(4))){jq=(16===jg.CharacterState);jr=jg.OnWall&&12<=jj.FramesInChState;if(jq||jr){jj.CharacterState=16;}}}if(!((jj.CharacterState===jg.CharacterState))){jj.FramesInChState=0;}js=(jt=Y[$Int32.keyFor(jj.CharacterState)],jt!==undefined?[jt.v,true]:[false,false]);ju=js[1];if(ju){jj.ActiveSkillId=-1;jj.ActiveSkillHit=-1;}je++;}jv=bc;jw=0;while(true){if(!(jw=jv.$length)?($throwRuntimeError("index out of range"),undefined):jv.$array[jv.$offset+jw]);jx.Space.Remove(new CB([jx]));jw++;}$s=-1;return new N.ptr(b.Id+1>>0,i,new $Int64(0,0),n,o,new $Uint64(0,0),false,s);}return;}var $f={$blk:AX,$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,jo,jp,jq,jr,js,jt,ju,jv,jw,jx,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,$s};return $f;};$pkg.ApplyInputFrameDownsyncDynamicsOnSingleRenderFrame=AX;AY=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=AR(a,b,c*0.5,d*0.5,e,f,g,h,i,j);n=m[0];o=m[1];p=AZ(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:AY,$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=AY;AZ=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.NewObject(a,b,c,d,new BN([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:AZ,$c:true,$r,a,b,c,d,e,f,g,h,$s};return $f;};BA=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=BB(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 BN([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:BA,$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=BA;BB=function(a){var a,b,c,d,e,f,g,h,i,j,k;b=new C.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 C.ptr(j.X-b.X,j.Y-b.Y)));h++;}return f;};$pkg.AlignPolygon2DToBoundingBox=BB;BC=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 K.ptr(u,v,new J.ptr(a,b,c,t),new I.ptr(d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,w,x,false));};$pkg.NewMeleeBullet=BC;BD=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 L.ptr(u,v,w,x,y,z,aa,0,0,new J.ptr(a,b,c,t),new I.ptr(d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,ad,ae,false));};$pkg.NewFireballBullet=BD;CH.methods=[{prop:"Put",name:"Put",pkg:"",typ:$funcType([$emptyInterface],[],false)},{prop:"Pop",name:"Pop",pkg:"",typ:$funcType([],[$emptyInterface],false)},{prop:"GetArrIdxByOffset",name:"GetArrIdxByOffset",pkg:"",typ:$funcType([$Int32],[$Int32],false)},{prop:"GetByOffset",name:"GetByOffset",pkg:"",typ:$funcType([$Int32],[$emptyInterface],false)},{prop:"GetByFrameId",name:"GetByFrameId",pkg:"",typ:$funcType([$Int32],[$emptyInterface],false)},{prop:"SetByFrameId",name:"SetByFrameId",pkg:"",typ:$funcType([$emptyInterface,$Int32],[$Int32,$Int32,$Int32],false)}];C.init("",[{prop:"X",name:"X",embedded:false,exported:true,typ:$Float64,tag:""},{prop:"Y",name:"Y",embedded:false,exported:true,typ:$Float64,tag:""}]);D.init("",[{prop:"Anchor",name:"Anchor",embedded:false,exported:true,typ:CD,tag:""},{prop:"Points",name:"Points",embedded:false,exported:true,typ:CE,tag:""}]);E.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:""}]);F.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:""}]);H.init("",[{prop:"Boundary",name:"Boundary",embedded:false,exported:true,typ:CF,tag:""}]);I.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:CG,tag:""}]);J.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:""}]);K.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:BH,tag:""},{prop:"Bullet",name:"Bullet",embedded:false,exported:true,typ:BI,tag:""}]);L.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:BH,tag:""},{prop:"Bullet",name:"Bullet",embedded:false,exported:true,typ:BI,tag:""}]);M.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:BG,tag:""}]);N.init("",[{prop:"Id",name:"Id",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"PlayersArr",name:"PlayersArr",embedded:false,exported:true,typ:BV,tag:""},{prop:"CountdownNanos",name:"CountdownNanos",embedded:false,exported:true,typ:$Int64,tag:""},{prop:"MeleeBullets",name:"MeleeBullets",embedded:false,exported:true,typ:BW,tag:""},{prop:"FireballBullets",name:"FireballBullets",embedded:false,exported:true,typ:BX,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:""}]);O.init("",[{prop:"InputFrameId",name:"InputFrameId",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"InputList",name:"InputList",embedded:false,exported:true,typ:BU,tag:""},{prop:"ConfirmedList",name:"ConfirmedList",embedded:false,exported:true,typ:$Uint64,tag:""}]);P.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:""}]);Q.init("",[{prop:"Ed",name:"Ed",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"St",name:"St",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"EdFrameId",name:"EdFrameId",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"StFrameId",name:"StFrameId",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"N",name:"N",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"Cnt",name:"Cnt",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"Eles",name:"Eles",embedded:false,exported:true,typ:BG,tag:""}]);S.init([$Int,BQ],[$Int],false);T.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:S,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 BF([new BE([0,0]),new BE([0,2]),new BE([0,-2]),new BE([2,0]),new BE([-2,0]),new BE([1,1]),new BE([-1,-1]),new BE([1,-1]),new BE([-1,1])]);U=$makeMap($Int.keyFor,[{k:1,v:new M.ptr(0,30,30,30,1,2,new BG([new K.ptr(0,0,BH.nil,new I.ptr(7,13,30,22,13,9,50,0,5,5,-1,1200,0,2400,3200,false,9,1,$makeMap($Int.keyFor,[{k:1,v:2}])))]))},{k:2,v:new M.ptr(0,36,36,36,1,11,new BG([new K.ptr(0,0,BH.nil,new I.ptr(18,22,36,18,18,9,50,0,5,10,-1,1800,0,2400,3200,false,9,1,$makeMap($Int.keyFor,[{k:1,v:3}])))]))},{k:3,v:new M.ptr(0,50,50,50,1,12,new BG([new K.ptr(0,0,BH.nil,new I.ptr(8,0,0,30,999999999,9,200,700,10,50,500,1600,800,3200,3200,true,9,1,false))]))},{k:4,v:new M.ptr(0,30,30,30,1,2,new BG([new K.ptr(0,0,BH.nil,new I.ptr(7,13,30,22,13,9,50,0,5,5,-1,1200,0,2400,3200,false,15,2,$makeMap($Int.keyFor,[{k:1,v:5}])))]))},{k:5,v:new M.ptr(0,36,36,36,1,11,new BG([new K.ptr(0,0,BH.nil,new I.ptr(18,23,36,18,18,9,50,0,5,10,-1,1800,0,2400,3200,false,15,2,$makeMap($Int.keyFor,[{k:1,v:6}])))]))},{k:6,v:new M.ptr(0,45,45,45,1,12,new BG([new K.ptr(0,0,BH.nil,new I.ptr(8,0,0,28,999999999,9,200,300,10,-1,-1,2400,0,3200,3200,true,15,2,false))]))},{k:7,v:new M.ptr(0,30,30,30,1,2,new BG([new K.ptr(0,0,BH.nil,new I.ptr(7,13,30,22,13,9,50,0,5,-1,-1,1200,0,2400,3200,false,9,1,$makeMap($Int.keyFor,[{k:1,v:8}])))]))},{k:8,v:new M.ptr(0,36,36,36,1,11,new BG([new K.ptr(0,0,BH.nil,new I.ptr(18,22,36,18,18,9,50,0,5,10,-1,1800,0,2400,3200,false,9,1,$makeMap($Int.keyFor,[{k:1,v:9}])))]))},{k:9,v:new M.ptr(0,40,40,40,1,12,new BG([new K.ptr(0,0,BH.nil,new I.ptr(7,0,0,30,999999999,9,200,400,10,100,-1,1000,0,3200,3200,true,9,1,false))]))},{k:10,v:new M.ptr(0,38,38,38,1,13,new BG([new L.ptr(0,0,0,0,0,0,600,0,0,BH.nil,new I.ptr(10,0,0,999999999,15,9,200,0,22,-1,-1,3200,1000,6400,4800,false,10,1,false))]))},{k:11,v:new M.ptr(0,60,60,60,1,14,new BG([new K.ptr(0,0,BH.nil,new I.ptr(3,0,0,25,999999999,9,200,700,35,100,800,800,0,4000,6400,true,15,3,false))]))},{k:12,v:new M.ptr(0,10,10,10,1,15,new BG([new K.ptr(0,0,BH.nil,new I.ptr(3,0,0,0,0,0,-1,-1,0,600,0,0,0,0,0,false,0,0,false))]))},{k:13,v:new M.ptr(0,12,12,12,1,15,new BG([new K.ptr(0,0,BH.nil,new I.ptr(3,0,0,0,0,0,-1,-1,0,800,0,0,0,0,0,false,0,0,false))]))},{k:14,v:new M.ptr(0,8,8,8,1,15,new BG([new K.ptr(0,0,BH.nil,new I.ptr(4,0,0,0,999999999,0,-1,-1,0,500,0,0,0,0,0,false,0,0,false))]))},{k:15,v:new M.ptr(0,48,48,48,1,13,new BG([new L.ptr(0,0,0,0,0,0,400,0,0,BH.nil,new I.ptr(12,0,0,999999999,15,9,300,0,18,-1,-1,2400,800,4800,3200,false,30,2,false))]))},{k:16,v:new M.ptr(0,60,60,60,1,13,new BG([new L.ptr(0,0,0,0,0,0,400,0,0,BH.nil,new I.ptr(16,0,0,999999999,999999999,9,300,700,30,-1,-1,2400,800,4800,3200,true,30,3,false))]))},{k:255,v:new M.ptr(0,30,30,30,1,6,new BG([new K.ptr(0,0,BH.nil,new I.ptr(3,0,0,20,18,9,50,0,5,-1,-1,1200,0,3200,2400,false,9,1,false))]))},{k:256,v:new M.ptr(0,20,20,20,1,6,new BG([new K.ptr(0,0,BH.nil,new I.ptr(3,0,0,10,15,9,50,0,5,-1,-1,1200,0,3200,2400,false,15,2,false))]))},{k:257,v:new M.ptr(0,30,30,30,1,6,new BG([new K.ptr(0,0,BH.nil,new I.ptr(3,0,0,20,18,9,50,0,5,-1,-1,1200,0,3200,2400,false,9,1,false))]))}]);$pkg.Characters=$makeMap($Int.keyFor,[{k:0,v:new T.ptr(0,"MonkGirl",11,1,16,16,10,27,210,800,2,true,true,8,280,700,-100,9,(function(a,b){var a,b,c,d,e,f,g,h,i,j,k,l,m,n;if(1===a){if(0===b.FramesToRecover){if(b.InAir){return 255;}else{return 1;}}else{c=(d=U[$Int.keyFor(((b.ActiveSkillId>>0)))],d!==undefined?[d.v,true]:[BJ.nil,false]);e=c[0];f=c[1];if(f){g=(h=e.Hits,i=b.ActiveSkillHit,((i<0||i>=h.$length)?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+i]));if($assertType(g,BK,true)[1]){j=g.$val;if(j.Bullet.CancellableStFrame<=b.FramesInChState&&b.FramesInChState>0)))],d!==undefined?[d.v,true]:[BJ.nil,false]);e=c[0];f=c[1];if(f){g=(h=e.Hits,i=b.ActiveSkillHit,((i<0||i>=h.$length)?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+i]));if($assertType(g,BK,true)[1]){j=g.$val;if(j.Bullet.CancellableStFrame<=b.FramesInChState&&b.FramesInChState>0)))],d!==undefined?[d.v,true]:[BJ.nil,false]);e=c[0];f=c[1];if(f){g=(h=e.Hits,i=b.ActiveSkillHit,((i<0||i>=h.$length)?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+i]));if($assertType(g,BK,true)[1]){j=g.$val;if(j.Bullet.CancellableStFrame<=b.FramesInChState&&b.FramesInChState=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;}};Q.prototype.Put=function(a){return this.$val.Put(a);};Q.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;};Q.prototype.Pop=function(){return this.$val.Pop();};Q.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]));};Q.prototype.GetByOffset=function(a){return this.$val.GetByOffset(a);};Q.ptr.prototype.GetByFrameId=function(a){var a,b;b=this;if(a>=b.EdFrameId||a>0);};Q.prototype.GetByFrameId=function(a){return this.$val.GetByFrameId(a);};Q.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(g>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))+6>>0);};$pkg.ConvertToFirstUsedRenderFrameId=AE;AF=function(a){var a;return(((((a<<2>>0))+6>>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 F.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,BL.nil];}return;}}catch(err){$err=err;$s=-1;return[false,0,0,BL.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;d=a.Points.$length;e=b.Points.$length;f=d;g=e;if((1===f)&&(1===g)){if(!(BL.nil===c)){c.Overlap=0;}return((h=(i=a.Points,(0>=i.$length?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+0])),(0>=h.$length?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+0]))===(j=(k=b.Points,(0>=k.$length?($throwRuntimeError("index out of range"),undefined):k.$array[k.$offset+0])),(0>=j.$length?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+0])))&&((l=(m=a.Points,(0>=m.$length?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+0])),(1>=l.$length?($throwRuntimeError("index out of range"),undefined):l.$array[l.$offset+1]))===(n=(o=b.Points,(0>=o.$length?($throwRuntimeError("index out of range"),undefined):o.$array[o.$offset+0])),(1>=n.$length?($throwRuntimeError("index out of range"),undefined):n.$array[n.$offset+1])));}if(1=p.$length)?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+q]);if(AO(a,b,r.Unit(),c)){return false;}q++;}}if(1=s.$length)?($throwRuntimeError("index out of range"),undefined):s.$array[s.$offset+t]);if(AO(a,b,u.Unit(),c)){return false;}t++;}}return true;};AK=function(a,b){var a,b;if(2===a.BlState){return false;}return((a.BattleAttr.OriginatedRenderFrameId+a.Bullet.StartupFrames>>0)<=b.Id)&&(((a.BattleAttr.OriginatedRenderFrameId+a.Bullet.StartupFrames>>0)+a.Bullet.ActiveFrames>>0)>b.Id);};$pkg.IsMeleeBulletActive=AK;AL=function(a,b){var a,b;if(2===a.BlState){return a.FramesInBlState>0)+a.Bullet.ActiveFrames>>0)>b.Id;};$pkg.IsMeleeBulletAlive=AL;AM=function(a,b){var a,b;if(2===a.BlState){return false;}return((a.BattleAttr.OriginatedRenderFrameId+a.Bullet.StartupFrames>>0)>0)+a.Bullet.ActiveFrames>>0)>b.Id);};$pkg.IsFireballBulletActive=AM;AN=function(a,b){var a,b;if(2===a.BlState){return a.FramesInBlState>0)+a.Bullet.ActiveFrames>>0)>b.Id;};$pkg.IsFireballBulletAlive=AN;AO=function(a,b,c,d){var a,aa,ab,ac,ad,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=a.Points;n=0;while(true){if(!(n=m.$length)?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+n]);p=((0>=o.$length?($throwRuntimeError("index out of range"),undefined):o.$array[o.$offset+0])+a.X)*(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0])+((1>=o.$length?($throwRuntimeError("index out of range"),undefined):o.$array[o.$offset+1])+a.Y)*(1>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+1]);if(i>p){i=p;}if(j=q.$length)?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+r]);t=((0>=s.$length?($throwRuntimeError("index out of range"),undefined):s.$array[s.$offset+0])+b.X)*(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0])+((1>=s.$length?($throwRuntimeError("index out of range"),undefined):s.$array[s.$offset+1])+b.Y)*(1>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+1]);if(k>t){k=t;}if(ll||jl){u=i-l;d.AContainedInB=false;}else{x=j-k;y=l-i;if(x=ab.$length?($throwRuntimeError("index out of range"),undefined):ab.$array[ab.$offset+0])))&&(0===(ac=d.Axis,(1>=ac.$length?($throwRuntimeError("index out of range"),undefined):ac.$array[ac.$offset+1]))))||z>aa){ad=1;if(u<0){ad=-1;}d.Overlap=aa;d.OverlapX=(0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0])*ad;d.OverlapY=(1>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+1])*ad;}d.Axis=c;}return false;};AP=function(a,b){var a,b,c,d;c=((A.Round(a*100)>>0));d=((A.Round(b*100)>>0));return[c,d];};$pkg.WorldToVirtualGridPos=AP;AQ=function(a,b){var a,b,c,d;c=(a)*0.01;d=(b)*0.01;return[c,d];};$pkg.VirtualGridToWorldPos=AQ;AR=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=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.PolygonColliderBLToWorldPos=AS;AT=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=AS(a,b,c,d,e,f,g,h,i,j);l=k[0];m=k[1];return AP(l,m);};$pkg.PolygonColliderBLToVirtualGridPos=AT;AV=function(a,b,c,d,e,f,g){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,$s,$r,$c}=$restore(this,{a,b,c,d,e,f,g});$s=$s||0;s:while(true){switch($s){case 0:h=[h];h[0]=$makeSlice(BM,0,10);i=0;if((16===b.CharacterState)&&(0===c.VelX)&&(b.DirX===c.DirX)){j=1;if(0>c.DirX){j=-j;}i=j*(b.Speed)*0.01;}k=d.Check(i,0,new BN([]));if(BO.nil===k){$s=-1;return(h.$ptr||(h.$ptr=new BP(function(){return this.$target[0];},function($v){this.$target[0]=$v;},h)));}l=k.Objects;m=0;case 1:if(!(m=l.$length)?($throwRuntimeError("index out of range"),undefined):l.$array[l.$offset+m]);o=false;p=n.Data;if($assertType(p,BQ,true)[1]||$assertType(p,BK,true)[1]||$assertType(p,BR,true)[1]){}else{o=true;}if(!o){m++;$s=1;continue;}q=$assertType(n.Shape,BS);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){m++;$s=1;continue;}x=(w.Overlap-f)*w.OverlapX;y=(w.Overlap-f)*w.OverlapY;u=x;v=y;h[0]=$append(h[0],new C.ptr(w.OverlapX,w.OverlapY));g.X=g.X+(u);g.Y=g.Y+(v);m++;$s=1;continue;case 2:$s=-1;return(h.$ptr||(h.$ptr=new BP(function(){return this.$target[0];},function($v){this.$target[0]=$v;},h)));}return;}var $f={$blk:AV,$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,x,y,$s};return $f;};AW=function(a,b,c,d,e){var a,aa,ab,ac,ad,ae,af,ag,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),BT).InputList;l=BU.nil;if(0>0,((o<0||o>=k.$length)?($throwRuntimeError("index out of range"),undefined):k.$array[k.$offset+o])));q=0;r=0;s=q;t=r;u=0;v=0;w=u;x=v;if(!(BU.nil===l)){z=AG((y=n-1>>0,((y<0||y>=l.$length)?($throwRuntimeError("index out of range"),undefined):l.$array[l.$offset+y])));w=z.BtnALevel;x=z.BtnBLevel;}if(0===a.FramesToRecover){aa=p.Dx;ab=p.Dy;s=aa;t=ab;}ac=-1;ad=a.CapturedByInertia&&(((d.InertiaFramesToRecover>>1>>0))>a.FramesToRecover);if((0===a.FramesToRecover)||ad){if(p.BtnBLevel>x){if(d.DashingEnabled&&0>p.Dy&&!((15===a.CharacterState))){ac=5;}else{ae=(af=V[$Int32.keyFor(a.CharacterState)],af!==undefined?[af.v,true]:[false,false]);ag=ae[1];if(!ag){m=true;}else if(16===a.CharacterState){m=true;}}}}if(-1===ac){if(0w){if(0>p.Dy){ac=3;}else if(0=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+k]);((l<0||l>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+l]=new E.ptr(m.Id,m.VirtualGridX,m.VirtualGridY,m.DirX,m.DirY,m.VelX,m.VelY,m.Speed,m.BattleState,m.JoinIndex,m.ColliderRadius,m.Removed,m.Score,0,m.FramesToRecover-1>>0,m.FramesInChState+1>>0,m.Hp,m.MaxHp,m.CharacterState,true,false,m.OnWallNormX,m.OnWallNormY,m.CapturedByInertia,m.ActiveSkillId,m.ActiveSkillHit,m.FramesInvinsible-1>>0,m.BulletTeamId,m.ChCollisionTeamId,m.RevivalVirtualGridX,m.RevivalVirtualGridY));if(((l<0||l>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+l]).FramesToRecover<0){((l<0||l>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+l]).FramesToRecover=0;}if(((l<0||l>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+l]).FramesInvinsible<0){((l<0||l>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+l]).FramesInvinsible=0;}k++;}n=$makeSlice(BW,0,b.MeleeBullets.$length);o=$makeSlice(BX,0,b.FireballBullets.$length);p=$makeSlice(BM,h);q=$makeSlice(BY,h);r=$makeSlice(BZ,h);s=b.BulletLocalIdCounter;t=b.PlayersArr;u=0;case 1:if(!(u=t.$length)?($throwRuntimeError("index out of range"),undefined):t.$array[t.$offset+u]);z=((x<0||x>=g.$length)?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+x]);aa=((x<0||x>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+x]);ab=AW(y,aa,b,z,a);ac=ab[0];ad=ab[1];ae=ab[2];af=ab[3];((x<0||x>=r.$length)?($throwRuntimeError("index out of range"),undefined):r.$array[r.$offset+x]=ad);ag=y.JoinIndex;ah=z.SkillMapper(ac,y);$s=3;case 3:if($c){$c=false;ah=ah.$blk();}if(ah&&ah.$blk!==undefined){break s;}ai=ah;aj=(ak=U[$Int.keyFor(ai)],ak!==undefined?[ak.v,true]:[BJ.nil,false]);al=aj[0];am=aj[1];if(am){aa.ActiveSkillId=((ai>>0));aa.ActiveSkillHit=0;aa.FramesToRecover=al.RecoveryFrames;an=1;if(0>aa.DirX){an=-an;}ao=false;ap=(aq=al.Hits,ar=aa.ActiveSkillHit,((ar<0||ar>=aq.$length)?($throwRuntimeError("index out of range"),undefined):aq.$array[aq.$offset+ar]));if($assertType(ap,BK,true)[1]){as=ap.$val;v[0]=$clone(as,K);v[0].BattleAttr=new J.ptr(s,b.Id,ag,y.BulletTeamId);s=s+(1)>>0;v[0].BlState=0;n=$append(n,v[0]);if(!((-1===as.Bullet.SelfLockVelX))){ao=true;aa.VelX=$imul(an,as.Bullet.SelfLockVelX);}if(!((-1===as.Bullet.SelfLockVelY))){ao=true;aa.VelY=as.Bullet.SelfLockVelY;}}else if($assertType(ap,BR,true)[1]){at=ap.$val;w[0]=$clone(at,L);w[0].BattleAttr=new J.ptr(s,b.Id,ag,y.BulletTeamId);s=s+(1)>>0;au=y.VirtualGridX+($imul(an,w[0].Bullet.HitboxOffsetX))>>0;av=y.VirtualGridY+w[0].Bullet.HitboxOffsetY>>0;w[0].VirtualGridX=au;w[0].VirtualGridY=av;w[0].DirX=an;w[0].DirY=0;w[0].VelX=$imul(w[0].Speed,an);w[0].VelY=0;w[0].BlState=0;o=$append(o,w[0]);if(!((-1===at.Bullet.SelfLockVelX))){ao=true;aa.VelX=$imul(an,at.Bullet.SelfLockVelX);}if(!((-1===at.Bullet.SelfLockVelY))){ao=true;aa.VelY=at.Bullet.SelfLockVelY;}}if(false===ao&&false===y.InAir){aa.VelX=0;}aa.CharacterState=al.BoundChState;u++;$s=1;continue;}if(0===y.FramesToRecover){aw=y.CapturedByInertia;ax=z.OnWallEnabled&&(z.WallJumpingInitVelX===Z(y.VelX));ay=true;az=false;ba=false;if(!((0===ae))&&(0===aa.VelX)){ay=false;}else if((0===ae)&&!((0===aa.VelX))){ay=false;ba=true;}else if(0>($imul(ae,aa.VelX))){ay=false;az=true;}if(!ad&&!ax&&!aw&&!ay){aa.CapturedByInertia=true;if(az){aa.CharacterState=17;aa.FramesToRecover=z.InertiaFramesToRecover;}else if(ba){aa.FramesToRecover=z.InertiaFramesToRecover;}else{aa.FramesToRecover=(z.InertiaFramesToRecover>>1>>0);}}else{aa.CapturedByInertia=false;if(!((0===ae))){bb=1;if(0>ae){bb=-bb;}aa.DirX=ae;aa.DirY=af;if(ax){aa.VelX=$imul(bb,Z(y.VelX));}else{aa.VelX=$imul(bb,y.Speed);}aa.CharacterState=1;}else{aa.CharacterState=0;aa.VelX=0;}}}u++;$s=1;continue;case 2:bc=$makeSlice(CB,b.PlayersArr.$length,b.PlayersArr.$length);bd=b.PlayersArr;be=0;case 4:if(!(be=bd.$length)?($throwRuntimeError("index out of range"),undefined):bd.$array[bd.$offset+be]);bh=bg.JoinIndex;bi=0;bj=0;(bk=bh-1>>0,((bk<0||bk>=p.$length)?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+bk])).X=bi;(bl=bh-1>>0,((bl<0||bl>=p.$length)?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+bl])).Y=bj;bm=((bf<0||bf>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+bf]);bn=((bf<0||bf>=g.$length)?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+bf]);bo=bg.VirtualGridX+bg.VelX>>0;bp=bg.VirtualGridY+bg.VelY>>0;bq=bo;br=bp;if(0>=bm.Hp&&(0===bm.FramesToRecover)){bs=bg.RevivalVirtualGridX;bt=bg.RevivalVirtualGridY;bq=bs;br=bt;bm.CharacterState=0;bm.Hp=bg.MaxHp;}if(((bf<0||bf>=r.$length)?($throwRuntimeError("index out of range"),undefined):r.$array[r.$offset+bf])){if(16===bg.CharacterState){if(0<($imul(bg.VelX,bg.OnWallNormX))){bq=bq-(bg.VelX)>>0;}bu=-1;if(0>bg.OnWallNormX){bu=-bu;}bq=bq+(($imul(bu,bn.WallJumpingInitVelX)))>>0;br=br+(bn.WallJumpingInitVelY)>>0;bm.VelX=(($imul(bu,bn.WallJumpingInitVelX)));bm.VelY=(bn.WallJumpingInitVelY);bm.FramesToRecover=bn.WallJumpingFramesToRecover;}else{bm.VelY=(bn.JumpingInitVelY);br=br+(bn.JumpingInitVelY)>>0;}}bv=AQ(bq,br);bw=bv[0];bx=bv[1];by=$imul(bg.ColliderRadius,2);bz=$imul(bg.ColliderRadius,4);ca=by;cb=bz;cc=bg.CharacterState;if(cc===(9)){cd=$imul(bg.ColliderRadius,4);ce=$imul(bg.ColliderRadius,2);ca=cd;cb=ce;}else if((cc===(8))||(cc===(4))||(cc===(5))||(cc===(16))){cf=$imul(bg.ColliderRadius,2);cg=$imul(bg.ColliderRadius,2);ca=cf;cb=cg;}ch=AQ(ca,cb);ci=ch[0];cj=ch[1];ck=AY(bw,bx,ci,cj,0.1,0.1,0.1,0.1,e,f,bg,"Player");$s=6;case 6:if($c){$c=false;ck=ck.$blk();}if(ck&&ck.$blk!==undefined){break s;}cl=ck;((bf<0||bf>=bc.$length)?($throwRuntimeError("index out of range"),undefined):bc.$array[bc.$offset+bf]=cl);$r=c.Add(new CB([cl]));$s=7;case 7:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}if(bg.InAir){if((16===bg.CharacterState)&&!((bf<0||bf>=r.$length)?($throwRuntimeError("index out of range"),undefined):r.$array[r.$offset+bf])){bm.VelX=bm.VelX+(0)>>0;bm.VelY=bn.WallSlidingVelY;}else if(15===bg.CharacterState){bm.VelX=bm.VelX+(0)>>0;}else{bm.VelX=bm.VelX+(0)>>0;bm.VelY=bm.VelY+(-50)>>0;}}be++;$s=4;continue;case 5:cm=$makeSlice(CB,0,((((b.MeleeBullets.$length+b.FireballBullets.$length>>0))<<1>>0)));cn=b.FireballBullets;co=0;case 8:if(!(co=cn.$length)?($throwRuntimeError("index out of range"),undefined):cn.$array[cn.$offset+co]);cq=new L.ptr(cp.VirtualGridX,cp.VirtualGridY,cp.DirX,cp.DirY,cp.VelX,cp.VelY,cp.Speed,cp.BlState,cp.FramesInBlState+1>>0,cp.BattleAttr,cp.Bullet);if(AN(cq,b)){$s=10;continue;}$s=11;continue;case 10:if(AM(cq,b)){$s=12;continue;}$s=13;continue;case 12:cr=AQ(cq.VirtualGridX,cq.VirtualGridY);cs=cr[0];ct=cr[1];cu=AQ(cq.Bullet.HitboxSizeX,cq.Bullet.HitboxSizeY);cv=cu[0];cw=cu[1];cx=AY(cs,ct,cv,cw,0.1,0.1,0.1,0.1,e,f,cq,"FireballBullet");$s=15;case 15:if($c){$c=false;cx=cx.$blk();}if(cx&&cx.$blk!==undefined){break s;}cy=cx;$r=c.Add(new CB([cy]));$s=16;case 16:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}cm=$append(cm,cy);cq.BlState=1;if(!((cq.BlState===cp.BlState))){cq.FramesInBlState=0;}cz=cq.VirtualGridX+cq.VelX>>0;da=cq.VirtualGridY+cq.VelY>>0;cq.VirtualGridX=cz;cq.VirtualGridY=da;$s=14;continue;case 13:dd=(db=b.PlayersArr,dc=cq.BattleAttr.OffenderJoinIndex-1>>0,((dc<0||dc>=db.$length)?($throwRuntimeError("index out of range"),undefined):db.$array[db.$offset+dc]));de=(df=W[$Int32.keyFor(dd.CharacterState)],df!==undefined?[df.v,true]:[false,false]);dg=de[1];if(dg){co++;$s=8;continue;}case 14:o=$append(o,cq);case 11:co++;$s=8;continue;case 9:dh=b.MeleeBullets;di=0;case 17:if(!(di=dh.$length)?($throwRuntimeError("index out of range"),undefined):dh.$array[dh.$offset+di]);dk=new K.ptr(dj.BlState,dj.FramesInBlState+1>>0,dj.BattleAttr,dj.Bullet);if(AL(dk,b)){$s=19;continue;}$s=20;continue;case 19:dn=(dl=b.PlayersArr,dm=dk.BattleAttr.OffenderJoinIndex-1>>0,((dm<0||dm>=dl.$length)?($throwRuntimeError("index out of range"),undefined):dl.$array[dl.$offset+dm]));dp=(dq=W[$Int32.keyFor(dn.CharacterState)],dq!==undefined?[dq.v,true]:[false,false]);dr=dp[1];if(dr){di++;$s=17;continue;}if(AK(dk,b)){$s=21;continue;}$s=22;continue;case 21:ds=1;if(0>dn.DirX){ds=-ds;}dt=AQ(dn.VirtualGridX+($imul(ds,dk.Bullet.HitboxOffsetX))>>0,dn.VirtualGridY);du=dt[0];dv=dt[1];dw=AQ(dk.Bullet.HitboxSizeX,dk.Bullet.HitboxSizeY);dx=dw[0];dy=dw[1];dz=AY(du,dv,dx,dy,0.1,0.1,0.1,0.1,e,f,dk,"MeleeBullet");$s=23;case 23:if($c){$c=false;dz=dz.$blk();}if(dz&&dz.$blk!==undefined){break s;}ea=dz;$r=c.Add(new CB([ea]));$s=24;case 24:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}cm=$append(cm,ea);dk.BlState=1;if(!((dk.BlState===dj.BlState))){dk.FramesInBlState=0;}case 22:n=$append(n,dk);case 20:di++;$s=17;continue;case 18:eb=b.PlayersArr;ec=0;case 25:if(!(ec=eb.$length)?($throwRuntimeError("index out of range"),undefined):eb.$array[eb.$offset+ec]);ef=ee.JoinIndex;eg=((ed<0||ed>=bc.$length)?($throwRuntimeError("index out of range"),undefined):bc.$array[bc.$offset+ed]);eh=$assertType(eg.Shape,BS);ei=((ed<0||ed>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+ed]);ek=AV(ef,ee,ei,eg,eh,0.1,(ej=ef-1>>0,((ej<0||ej>=p.$length)?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+ej])));$s=27;case 27:if($c){$c=false;ek=ek.$blk();}if(ek&&ek.$blk!==undefined){break s;}(el=ef-1>>0,((el<0||el>=q.$length)?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+el]=ek));em=((ed<0||ed>=g.$length)?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+ed]);en=false;eo=eg.Check(0,0,new BN([]));if(!(BO.nil===eo)){$s=28;continue;}$s=29;continue;case 28:ep=eo.Objects;eq=0;case 30:if(!(eq=ep.$length)?($throwRuntimeError("index out of range"),undefined):ep.$array[ep.$offset+eq]);es=false;et=false;eu=false;ev=es;ew=et;ex=eu;ey=er.Data;if($assertType(ey,BQ,true)[1]){ew=true;}else if($assertType(ey,BK,true)[1]||$assertType(ey,BR,true)[1]){ex=true;}else{ev=true;}if(ex){eq++;$s=30;continue;}ez=$assertType(er.Shape,BS);fb=AI(0,0,eh,ez);$s=32;case 32:if($c){$c=false;fb=fb.$blk();}if(fb&&fb.$blk!==undefined){break s;}fa=fb;fc=fa[0];fd=fa[1];fe=fa[2];ff=fa[3];if(!fc){eq++;$s=30;continue;}fg=ff.OverlapX*0+ff.OverlapY*-1;if(ew){fh=(ff.Overlap-0.2)*ff.OverlapX;fi=(ff.Overlap-0.2)*ff.OverlapY;fd=fh;fe=fi;}fj=(fk=ef-1>>0,((fk<0||fk>=q.$length)?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+fk])).$get();fl=0;while(true){if(!(fl=fj.$length)?($throwRuntimeError("index out of range"),undefined):fj.$array[fj.$offset+fl]),C);fn=fd*fm.X+fe*fm.Y;if(ev||(ew&&0>fn)){fd=fd-(fn*fm.X);fe=fe-(fn*fm.Y);}fl++;}fo=ef-1>>0;((fo<0||fo>=p.$length)?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+fo]).X=((fo<0||fo>=p.$length)?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+fo]).X+(fd);fp=ef-1>>0;((fp<0||fp>=p.$length)?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+fp]).Y=((fp<0||fp>=p.$length)?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+fp]).Y+(fe);if(0.5=ee.VelY;if(fq){ei.VelY=0;ei.VelX=0;if(18===ei.CharacterState){}else if(8===ei.CharacterState){ei.CharacterState=9;ei.FramesToRecover=em.LayDownFramesToRecover;}else{fr=ee.CharacterState;if((fr===(8))||(fr===(4))||(fr===(5))||(fr===(16))){fs=0;ft=ee.ColliderRadius;fu=fs;fv=ft;fw=AQ(fu,fv);fx=fw[1];fy=ef-1>>0;((fy<0||fy>=p.$length)?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+fy]).Y=((fy<0||fy>=p.$length)?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+fy]).Y-(fx);}ei.CharacterState=0;ei.FramesToRecover=0;}}else{fz=(ga=Y[$Int32.keyFor(ei.CharacterState)],ga!==undefined?[ga.v,true]:[false,false]);gb=fz[1];if(gb){if(18===ei.CharacterState){}else if(9===ei.CharacterState){if(0===ei.FramesToRecover){ei.CharacterState=10;ei.FramesToRecover=em.GetUpFramesToRecover;}}else if(10===ei.CharacterState){if(0===ei.FramesToRecover){ei.CharacterState=0;ei.FramesInvinsible=em.GetUpInvinsibleFrames;}}}}}if(em.OnWallEnabled){if(ei.InAir){gc=(gd=W[$Int32.keyFor(ee.CharacterState)],gd!==undefined?[gd.v,true]:[false,false]);ge=gc[1];if(!ge){gf=(gg=ef-1>>0,((gg<0||gg>=q.$length)?($throwRuntimeError("index out of range"),undefined):q.$array[q.$offset+gg])).$get();gh=0;while(true){if(!(gh=gf.$length)?($throwRuntimeError("index out of range"),undefined):gf.$array[gf.$offset+gh]),C);gj=gi.X*1+gi.Y*0;gk=gi.X*-1+gi.Y*0;if(0.9>0));gm=((gi.Y>>0));ei.OnWallNormX=gl;ei.OnWallNormY=gm;break;}if(0.9>0));go=((gi.Y>>0));ei.OnWallNormX=gn;ei.OnWallNormY=go;break;}gh++;}}}if(!ei.OnWall){gp=0;gq=0;ei.OnWallNormX=gp;ei.OnWallNormY=gq;}}ec++;$s=25;continue;case 26:gr=cm;gs=0;case 33:if(!(gs=gr.$length)?($throwRuntimeError("index out of range"),undefined):gr.$array[gr.$offset+gs]);gu=gt.Check(0,0,new BN([]));gt.Space.Remove(new CB([gt]));gv=false;if(!(BO.nil===gu)){$s=35;continue;}$s=36;continue;case 35:gw=gt.Data;if($assertType(gw,BK,true)[1]){$s=37;continue;}if($assertType(gw,BR,true)[1]){$s=38;continue;}$s=39;continue;case 37:gx=gw.$val;gz=$assertType(gt.Shape,BS);hc=(ha=b.PlayersArr,hb=gx.BattleAttr.OffenderJoinIndex-1>>0,((hb<0||hb>=ha.$length)?($throwRuntimeError("index out of range"),undefined):ha.$array[ha.$offset+hb]));hd=gu.Objects;he=0;case 40:if(!(he=hd.$length)?($throwRuntimeError("index out of range"),undefined):hd.$array[hd.$offset+he]);hg=$assertType(hf.Shape,BS);hh=hf.Data;if($assertType(hh,BQ,true)[1]){$s=42;continue;}$s=43;continue;case 42:hi=hh.$val;if(gx.BattleAttr.OffenderJoinIndex===hi.JoinIndex){he++;$s=40;continue;}hk=AI(0,0,gz,hg);$s=44;case 44:if($c){$c=false;hk=hk.$blk();}if(hk&&hk.$blk!==undefined){break s;}hj=hk;hl=hj[0];if(!hl){he++;$s=40;continue;}gv=true;hm=(hn=X[$Int32.keyFor(hi.CharacterState)],hn!==undefined?[hn.v,true]:[false,false]);ho=hm[1];if(ho){he++;$s=40;continue;}if(0hc.DirX){hp=-hp;}hr=(hq=hi.JoinIndex-1>>0,((hq<0||hq>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+hq]));hr.Hp=hr.Hp-(gx.Bullet.Damage)>>0;if(0>=hr.Hp){hr.Hp=0;hr.CharacterState=18;hr.FramesToRecover=60;}else{hs=$imul(hp,gx.Bullet.PushbackVelX);ht=gx.Bullet.PushbackVelY;hu=hs;hv=ht;hr.VelX=hu;hr.VelY=hv;if(gx.Bullet.BlowUp){hr.CharacterState=8;}else{hr.CharacterState=3;}hx=(hw=hi.JoinIndex-1>>0,((hw<0||hw>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+hw])).FramesToRecover;if(gx.Bullet.HitStunFrames>hx){hr.FramesToRecover=gx.Bullet.HitStunFrames;}}case 43:he++;$s=40;continue;case 41:$s=39;continue;case 38:gy=gw.$val;hy=$assertType(gt.Shape,BS);ib=(hz=b.PlayersArr,ia=gy.BattleAttr.OffenderJoinIndex-1>>0,((ia<0||ia>=hz.$length)?($throwRuntimeError("index out of range"),undefined):hz.$array[hz.$offset+ia]));ic=gu.Objects;id=0;case 45:if(!(id=ic.$length)?($throwRuntimeError("index out of range"),undefined):ic.$array[ic.$offset+id]);ig=$assertType(ie.Shape,BS);ih=ie.Data;if($assertType(ih,BQ,true)[1]){$s=47;continue;}$s=48;continue;case 47:ii=ih.$val;if(gy.BattleAttr.OffenderJoinIndex===ii.JoinIndex){id++;$s=45;continue;}il=AI(0,0,hy,ig);$s=50;case 50:if($c){$c=false;il=il.$blk();}if(il&&il.$blk!==undefined){break s;}ik=il;im=ik[0];if(!im){id++;$s=45;continue;}gv=true;io=(ip=X[$Int32.keyFor(ii.CharacterState)],ip!==undefined?[ip.v,true]:[false,false]);iq=io[1];if(iq){id++;$s=45;continue;}if(0ib.DirX){ir=-ir;}it=(is=ii.JoinIndex-1>>0,((is<0||is>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+is]));it.Hp=it.Hp-(gy.Bullet.Damage)>>0;if(0>=it.Hp){it.Hp=0;it.CharacterState=18;it.FramesToRecover=60;}else{iu=$imul(ir,gy.Bullet.PushbackVelX);iv=gy.Bullet.PushbackVelY;iw=iu;ix=iv;it.VelX=iw;it.VelY=ix;if(gy.Bullet.BlowUp){it.CharacterState=8;}else{it.CharacterState=3;}iz=(iy=ii.JoinIndex-1>>0,((iy<0||iy>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+iy])).FramesToRecover;if(gy.Bullet.HitStunFrames>iz){it.FramesToRecover=gy.Bullet.HitStunFrames;}}$s=49;continue;case 48:ij=ih;gv=true;case 49:id++;$s=45;continue;case 46:case 39:case 36:if(gv){ja=gt.Data;if($assertType(ja,BK,true)[1]){jb=ja.$val;jb.BlState=2;jb.FramesInBlState=0;}else if($assertType(ja,BR,true)[1]){jc=ja.$val;jc.BlState=2;jc.FramesInBlState=0;}}gs++;$s=33;continue;case 34:jd=b.PlayersArr;je=0;while(true){if(!(je=jd.$length)?($throwRuntimeError("index out of range"),undefined):jd.$array[jd.$offset+je]);jh=jg.JoinIndex;ji=((jf<0||jf>=bc.$length)?($throwRuntimeError("index out of range"),undefined):bc.$array[bc.$offset+jf]);jj=((jf<0||jf>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+jf]);jk=AT(ji.X-(jl=jh-1>>0,((jl<0||jl>=p.$length)?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+jl])).X,ji.Y-(jm=jh-1>>0,((jm<0||jm>=p.$length)?($throwRuntimeError("index out of range"),undefined):p.$array[p.$offset+jm])).Y,ji.W*0.5,ji.H*0.5,0,0,0,0,e,f);jj.VirtualGridX=jk[0];jj.VirtualGridY=jk[1];if(jj.InAir){jn=jj.CharacterState;jo=jn;if((jo===(0))||(jo===(1))||(jo===(17))){if(((jf<0||jf>=r.$length)?($throwRuntimeError("index out of range"),undefined):r.$array[r.$offset+jf])||(5===jg.CharacterState)){jj.CharacterState=5;}else{jj.CharacterState=4;}}else if(jo===(2)){jj.CharacterState=6;}else if(jo===(3)){jj.CharacterState=7;}}if(jj.OnWall){jp=jj.CharacterState;if((jp===(1))||(jp===(5))||(jp===(4))){jq=(16===jg.CharacterState);jr=jg.OnWall&&12<=jj.FramesInChState;if(jq||jr){jj.CharacterState=16;}}}if(!((jj.CharacterState===jg.CharacterState))){jj.FramesInChState=0;}js=(jt=Y[$Int32.keyFor(jj.CharacterState)],jt!==undefined?[jt.v,true]:[false,false]);ju=js[1];if(ju){jj.ActiveSkillId=-1;jj.ActiveSkillHit=-1;}je++;}jv=bc;jw=0;while(true){if(!(jw=jv.$length)?($throwRuntimeError("index out of range"),undefined):jv.$array[jv.$offset+jw]);jx.Space.Remove(new CB([jx]));jw++;}$s=-1;return new N.ptr(b.Id+1>>0,i,new $Int64(0,0),n,o,new $Uint64(0,0),false,s);}return;}var $f={$blk:AX,$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,jo,jp,jq,jr,js,jt,ju,jv,jw,jx,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,$s};return $f;};$pkg.ApplyInputFrameDownsyncDynamicsOnSingleRenderFrame=AX;AY=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=AR(a,b,c*0.5,d*0.5,e,f,g,h,i,j);n=m[0];o=m[1];p=AZ(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:AY,$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=AY;AZ=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.NewObject(a,b,c,d,new BN([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:AZ,$c:true,$r,a,b,c,d,e,f,g,h,$s};return $f;};BA=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=BB(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 BN([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:BA,$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=BA;BB=function(a){var a,b,c,d,e,f,g,h,i,j,k;b=new C.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 C.ptr(j.X-b.X,j.Y-b.Y)));h++;}return f;};$pkg.AlignPolygon2DToBoundingBox=BB;BC=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 K.ptr(u,v,new J.ptr(a,b,c,t),new I.ptr(d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,w,x,false));};$pkg.NewMeleeBullet=BC;BD=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 L.ptr(u,v,w,x,y,z,aa,0,0,new J.ptr(a,b,c,t),new I.ptr(d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,ad,ae,false));};$pkg.NewFireballBullet=BD;CH.methods=[{prop:"Put",name:"Put",pkg:"",typ:$funcType([$emptyInterface],[],false)},{prop:"Pop",name:"Pop",pkg:"",typ:$funcType([],[$emptyInterface],false)},{prop:"GetArrIdxByOffset",name:"GetArrIdxByOffset",pkg:"",typ:$funcType([$Int32],[$Int32],false)},{prop:"GetByOffset",name:"GetByOffset",pkg:"",typ:$funcType([$Int32],[$emptyInterface],false)},{prop:"GetByFrameId",name:"GetByFrameId",pkg:"",typ:$funcType([$Int32],[$emptyInterface],false)},{prop:"SetByFrameId",name:"SetByFrameId",pkg:"",typ:$funcType([$emptyInterface,$Int32],[$Int32,$Int32,$Int32],false)}];C.init("",[{prop:"X",name:"X",embedded:false,exported:true,typ:$Float64,tag:""},{prop:"Y",name:"Y",embedded:false,exported:true,typ:$Float64,tag:""}]);D.init("",[{prop:"Anchor",name:"Anchor",embedded:false,exported:true,typ:CD,tag:""},{prop:"Points",name:"Points",embedded:false,exported:true,typ:CE,tag:""}]);E.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:""}]);F.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:""}]);H.init("",[{prop:"Boundary",name:"Boundary",embedded:false,exported:true,typ:CF,tag:""}]);I.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:CG,tag:""}]);J.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:""}]);K.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:BH,tag:""},{prop:"Bullet",name:"Bullet",embedded:false,exported:true,typ:BI,tag:""}]);L.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:BH,tag:""},{prop:"Bullet",name:"Bullet",embedded:false,exported:true,typ:BI,tag:""}]);M.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:BG,tag:""}]);N.init("",[{prop:"Id",name:"Id",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"PlayersArr",name:"PlayersArr",embedded:false,exported:true,typ:BV,tag:""},{prop:"CountdownNanos",name:"CountdownNanos",embedded:false,exported:true,typ:$Int64,tag:""},{prop:"MeleeBullets",name:"MeleeBullets",embedded:false,exported:true,typ:BW,tag:""},{prop:"FireballBullets",name:"FireballBullets",embedded:false,exported:true,typ:BX,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:""}]);O.init("",[{prop:"InputFrameId",name:"InputFrameId",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"InputList",name:"InputList",embedded:false,exported:true,typ:BU,tag:""},{prop:"ConfirmedList",name:"ConfirmedList",embedded:false,exported:true,typ:$Uint64,tag:""}]);P.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:""}]);Q.init("",[{prop:"Ed",name:"Ed",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"St",name:"St",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"EdFrameId",name:"EdFrameId",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"StFrameId",name:"StFrameId",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"N",name:"N",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"Cnt",name:"Cnt",embedded:false,exported:true,typ:$Int32,tag:""},{prop:"Eles",name:"Eles",embedded:false,exported:true,typ:BG,tag:""}]);S.init([$Int,BQ],[$Int],false);T.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:S,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 BF([new BE([0,0]),new BE([0,2]),new BE([0,-2]),new BE([2,0]),new BE([-2,0]),new BE([1,1]),new BE([-1,-1]),new BE([1,-1]),new BE([-1,1])]);U=$makeMap($Int.keyFor,[{k:1,v:new M.ptr(0,30,30,30,1,2,new BG([new K.ptr(0,0,BH.nil,new I.ptr(7,13,30,22,13,9,50,0,5,5,-1,1200,0,2400,3200,false,9,1,$makeMap($Int.keyFor,[{k:1,v:2}])))]))},{k:2,v:new M.ptr(0,36,36,36,1,11,new BG([new K.ptr(0,0,BH.nil,new I.ptr(18,22,36,18,18,9,50,0,5,10,-1,1800,0,2400,3200,false,9,1,$makeMap($Int.keyFor,[{k:1,v:3}])))]))},{k:3,v:new M.ptr(0,50,50,50,1,12,new BG([new K.ptr(0,0,BH.nil,new I.ptr(8,0,0,30,999999999,9,200,700,10,50,500,1600,800,3200,3200,true,9,1,false))]))},{k:4,v:new M.ptr(0,30,30,30,1,2,new BG([new K.ptr(0,0,BH.nil,new I.ptr(7,13,30,22,13,9,50,0,5,5,-1,1200,0,2400,3200,false,15,2,$makeMap($Int.keyFor,[{k:1,v:5}])))]))},{k:5,v:new M.ptr(0,36,36,36,1,11,new BG([new K.ptr(0,0,BH.nil,new I.ptr(18,23,36,18,18,9,50,0,5,10,-1,1800,0,2400,3200,false,15,2,$makeMap($Int.keyFor,[{k:1,v:6}])))]))},{k:6,v:new M.ptr(0,45,45,45,1,12,new BG([new K.ptr(0,0,BH.nil,new I.ptr(8,0,0,28,999999999,9,200,300,10,-1,-1,2400,0,3200,3200,true,15,2,false))]))},{k:7,v:new M.ptr(0,30,30,30,1,2,new BG([new K.ptr(0,0,BH.nil,new I.ptr(7,13,30,22,13,9,50,0,5,-1,-1,1200,0,2400,3200,false,9,1,$makeMap($Int.keyFor,[{k:1,v:8}])))]))},{k:8,v:new M.ptr(0,36,36,36,1,11,new BG([new K.ptr(0,0,BH.nil,new I.ptr(18,22,36,18,18,9,50,0,5,10,-1,1800,0,2400,3200,false,9,1,$makeMap($Int.keyFor,[{k:1,v:9}])))]))},{k:9,v:new M.ptr(0,40,40,40,1,12,new BG([new K.ptr(0,0,BH.nil,new I.ptr(7,0,0,30,999999999,9,200,400,10,100,-1,1000,0,3200,3200,true,9,1,false))]))},{k:10,v:new M.ptr(0,38,38,38,1,13,new BG([new L.ptr(0,0,0,0,0,0,600,0,0,BH.nil,new I.ptr(10,0,0,999999999,15,9,200,0,22,-1,-1,3200,1000,6400,4800,false,10,1,false))]))},{k:11,v:new M.ptr(0,60,60,60,1,14,new BG([new K.ptr(0,0,BH.nil,new I.ptr(3,0,0,25,999999999,9,200,700,35,100,800,800,0,4000,6400,true,15,3,false))]))},{k:12,v:new M.ptr(0,10,10,10,1,15,new BG([new K.ptr(0,0,BH.nil,new I.ptr(3,0,0,0,0,0,-1,-1,0,600,0,0,0,0,0,false,0,0,false))]))},{k:13,v:new M.ptr(0,12,12,12,1,15,new BG([new K.ptr(0,0,BH.nil,new I.ptr(3,0,0,0,0,0,-1,-1,0,800,0,0,0,0,0,false,0,0,false))]))},{k:14,v:new M.ptr(0,8,8,8,1,15,new BG([new K.ptr(0,0,BH.nil,new I.ptr(4,0,0,0,999999999,0,-1,-1,0,500,0,0,0,0,0,false,0,0,false))]))},{k:15,v:new M.ptr(0,48,48,48,1,13,new BG([new L.ptr(0,0,0,0,0,0,400,0,0,BH.nil,new I.ptr(12,0,0,999999999,15,9,300,0,18,-1,-1,2400,800,4800,3200,false,30,2,false))]))},{k:16,v:new M.ptr(0,60,60,60,1,13,new BG([new L.ptr(0,0,0,0,0,0,400,0,0,BH.nil,new I.ptr(16,0,0,999999999,999999999,9,300,700,30,-1,-1,2400,800,4800,3200,true,30,3,false))]))},{k:255,v:new M.ptr(0,30,30,30,1,6,new BG([new K.ptr(0,0,BH.nil,new I.ptr(3,0,0,20,18,9,50,0,5,-1,-1,1200,0,3200,2400,false,9,1,false))]))},{k:256,v:new M.ptr(0,20,20,20,1,6,new BG([new K.ptr(0,0,BH.nil,new I.ptr(3,0,0,10,15,9,50,0,5,-1,-1,1200,0,3200,2400,false,15,2,false))]))},{k:257,v:new M.ptr(0,30,30,30,1,6,new BG([new K.ptr(0,0,BH.nil,new I.ptr(3,0,0,20,18,9,50,0,5,-1,-1,1200,0,3200,2400,false,9,1,false))]))}]);$pkg.Characters=$makeMap($Int.keyFor,[{k:0,v:new T.ptr(0,"MonkGirl",11,1,16,16,10,27,210,800,2,true,true,8,280,700,-100,9,(function(a,b){var a,b,c,d,e,f,g,h,i,j,k,l,m,n;if(1===a){if(0===b.FramesToRecover){if(b.InAir){return 255;}else{return 1;}}else{c=(d=U[$Int.keyFor(((b.ActiveSkillId>>0)))],d!==undefined?[d.v,true]:[BJ.nil,false]);e=c[0];f=c[1];if(f){g=(h=e.Hits,i=b.ActiveSkillHit,((i<0||i>=h.$length)?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+i]));if($assertType(g,BK,true)[1]){j=g.$val;if(j.Bullet.CancellableStFrame<=b.FramesInChState&&b.FramesInChState>0)))],d!==undefined?[d.v,true]:[BJ.nil,false]);e=c[0];f=c[1];if(f){g=(h=e.Hits,i=b.ActiveSkillHit,((i<0||i>=h.$length)?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+i]));if($assertType(g,BK,true)[1]){j=g.$val;if(j.Bullet.CancellableStFrame<=b.FramesInChState&&b.FramesInChState>0)))],d!==undefined?[d.v,true]:[BJ.nil,false]);e=c[0];f=c[1];if(f){g=(h=e.Hits,i=b.ActiveSkillHit,((i<0||i>=h.$length)?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+i]));if($assertType(g,BK,true)[1]){j=g.$val;if(j.Bullet.CancellableStFrame<=b.FramesInChState&&b.FramesInChState=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+e]);g=A.MakeFullWrapper(f);$s=3;case 3:if($c){$c=false;g=g.$blk();}if(g&&g.$blk!==undefined){break s;}c=$append(c,g);e++;$s=1;continue;case 2:$s=-1;return c;}return;}var $f={$blk:O,$c:true,$r,a,b,c,d,e,f,g,$s};return $f;};$pkg.GetCollisionSpaceObjsJs=O;P=function(a,b,c,d,e,f,g,h){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});$s=$s||0;s:while(true){switch($s){case 0:i=0.1;j=0.1;k=0.1;l=0.1;m=i;n=j;o=k;p=l;q=B.GenerateRectCollider(a,b,c,d,m,n,o,p,e,f,g,h);$s=1;case 1:if($c){$c=false;q=q.$blk();}if(q&&q.$blk!==undefined){break s;}r=A.MakeFullWrapper(q);$s=2;case 2:if($c){$c=false;r=r.$blk();}if(r&&r.$blk!==undefined){break s;}s=r;$s=3;case 3:return s;}return;}var $f={$blk:P,$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.GenerateRectColliderJs=P;Q=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.MakeFullWrapper(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:Q,$c:true,$r,a,b,c,d,e,f,g,h,$s};return $f;};$pkg.GenerateConvexPolygonColliderJs=Q;R=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:AG.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:R,$c:true,$r,a,b,c,d,e,f,g,h,$s};return $f;};$pkg.GetCharacterConfigsOrderedByJoinIndex=R;S=function(a,b,c,d,e,f,g){var{a,b,c,d,e,f,g,h,i,j,$s,$r,$c}=$restore(this,{a,b,c,d,e,f,g});$s=$s||0;s:while(true){switch($s){case 0:h=B.ApplyInputFrameDownsyncDynamicsOnSingleRenderFrame(a,b,c,d,e,f,g);$s=1;case 1:if($c){$c=false;h=h.$blk();}if(h&&h.$blk!==undefined){break s;}i=A.MakeFullWrapper(h);$s=2;case 2:if($c){$c=false;i=i.$blk();}if(i&&i.$blk!==undefined){break s;}j=i;$s=3;case 3:return j;}return;}var $f={$blk:S,$c:true,$r,a,b,c,d,e,f,g,h,i,j,$s};return $f;};$pkg.ApplyInputFrameDownsyncDynamicsOnSingleRenderFrameJs=S;T=function(){$global.gopkgs=$externalize($makeMap($String.keyFor,[{k:"NewVec2DJs",v:new AH(G)},{k:"NewPolygon2DJs",v:new AI(H)},{k:"NewBarrierJs",v:new AJ(I)},{k:"NewPlayerDownsyncJs",v:new AK(J)},{k:"NewMeleeBulletJs",v:new AL(K)},{k:"NewFireballBulletJs",v:new AM(L)},{k:"NewNpcPatrolCue",v:new AN(M)},{k:"NewRoomDownsyncFrameJs",v:new AO(N)},{k:"NewCollisionSpaceJs",v:new AP(F)},{k:"NewInputFrameDownsync",v:new AQ(D)},{k:"NewRingBufferJs",v:new AR(E)},{k:"GenerateRectColliderJs",v:new AS(P)},{k:"GenerateConvexPolygonColliderJs",v:new AT(Q)},{k:"GetCollisionSpaceObjsJs",v:new AV(O)},{k:"WorldToPolygonColliderBLPos",v:new AW(B.WorldToPolygonColliderBLPos)},{k:"PolygonColliderBLToWorldPos",v:new AW(B.PolygonColliderBLToWorldPos)},{k:"WorldToVirtualGridPos",v:new AX(B.WorldToVirtualGridPos)},{k:"VirtualGridToWorldPos",v:new AY(B.VirtualGridToWorldPos)},{k:"GetCharacterConfigsOrderedByJoinIndex",v:new BA(R)},{k:"ApplyInputFrameDownsyncDynamicsOnSingleRenderFrameJs",v:new BG(S)},{k:"ConvertToDelayedInputFrameId",v:new BH(B.ConvertToDelayedInputFrameId)},{k:"ConvertToNoDelayInputFrameId",v:new BH(B.ConvertToNoDelayInputFrameId)},{k:"ConvertToFirstUsedRenderFrameId",v:new BH(B.ConvertToFirstUsedRenderFrameId)},{k:"ConvertToLastUsedRenderFrameId",v:new BH(B.ConvertToLastUsedRenderFrameId)},{k:"ShouldGenerateInputFrameUpsync",v:new BI(B.ShouldGenerateInputFrameUpsync)},{k:"IsMeleeBulletActive",v:new BJ(B.IsMeleeBulletActive)},{k:"IsMeleeBulletAlive",v:new BJ(B.IsMeleeBulletAlive)},{k:"IsFireballBulletActive",v:new BK(B.IsFireballBulletActive)},{k:"IsFireballBulletAlive",v:new BK(B.IsFireballBulletAlive)}]),BL);};$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){T();$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/frontend/build-templates/jsb-link/frameworks/runtime-src/Classes/send_ring_buff.cpp b/frontend/build-templates/jsb-link/frameworks/runtime-src/Classes/send_ring_buff.cpp index 052eee5..fe0a486 100644 --- a/frontend/build-templates/jsb-link/frameworks/runtime-src/Classes/send_ring_buff.cpp +++ b/frontend/build-templates/jsb-link/frameworks/runtime-src/Classes/send_ring_buff.cpp @@ -33,31 +33,70 @@ SendWork* SendRingBuff::pop() { // Recving void RecvRingBuff::put(char* newBytes, size_t newBytesLen) { - while (0 < cnt && cnt >= n) { + RecvWork* slotEle = (&eles[ed.load()]); // Save for later update + + int oldCnt = cnt.load(); + int oldSt = st.load(); // Used to guard against "cnt decremented in pop(...), but st not yet incremented and thus return value not yet copied to avoid contamination" + int tried = 0; + while (n <= oldCnt && !ed.compare_exchange_weak(oldSt, oldSt) && 3 > tried) { // Make room for the new element - this->pop(); + this->pop(NULL); + oldCnt = cnt.load(); // If "pop()" above failed, it'd only be due to concurrent calls to "pop()", either way the updated "cnt" should be good to go + oldSt = st.load(); + ++tried; } - eles[ed].bytesLen = newBytesLen; - memset(eles[ed].ui8Arr, 0, sizeof eles[ed].ui8Arr); + if (n <= oldCnt && !ed.compare_exchange_weak(oldSt, oldSt) && 3 == tried) { + // Failed silently, UDP packet can be dropped. + return; + } + slotEle->bytesLen = newBytesLen; + memset(slotEle->ui8Arr, 0, sizeof slotEle->ui8Arr); for (int i = 0; i < newBytesLen; i++) { - *(eles[ed].ui8Arr + i) = *(newBytes + i); + *(slotEle->ui8Arr + i) = *(newBytes + i); } + + // No need to compare-and-swap, only "UvRecvThread" will access "RecvRingBuff.ed". ed++; - cnt++; if (ed >= n) { ed -= n; // Deliberately not using "%" operator for performance concern } + + // Only increment cnt when the putting of new element is fully done. + cnt++; } -RecvWork* RecvRingBuff::pop() { - if (0 == cnt) { +bool RecvRingBuff::pop(RecvWork* out) { + int oldCnt = std::atomic_fetch_sub(&cnt, 1); + /* + [WARNING] + + After here, two cases should be taken care of. + 1. If "n == oldCnt", we need guard against "put" to avoid contaminating "ret" by the "putting". + 2. If "0 >= oldCnt", we need guard against another "pop" to avoid over-popping. + */ + if (0 >= oldCnt) { + // "pop" could be accessed by either "GameThread/pollUdpRecvRingBuff" or "UvRecvThread/put", thus we should be proactively guard against concurrent popping while "1 == cnt" + ++cnt; return NULL; } - RecvWork* ret = &(eles[st]); - cnt--; - st++; - if (st >= n) { - st -= n; + + // When concurrent "pop"s reach here, over-popping is definitely avoided. + int oldSt = st.load(); + if (out) { + RecvWork* src = (&eles[oldSt]); + memset(out->ui8Arr, 0, sizeof out->ui8Arr); + memcpy(out->ui8Arr, src, src->bytesLen); + out->bytesLen = src->bytesLen; + } + int newSt = oldSt + 1; + if (newSt >= n) { + newSt -= n; + } + if (st.compare_exchange_weak(oldSt, newSt)) { + return true; + } else { + // Failed concurrent access should recover the "cnt" + ++cnt; + return false; } - return ret; } \ No newline at end of file diff --git a/frontend/build-templates/jsb-link/frameworks/runtime-src/Classes/send_ring_buff.hpp b/frontend/build-templates/jsb-link/frameworks/runtime-src/Classes/send_ring_buff.hpp index 90fbae6..3ca025b 100644 --- a/frontend/build-templates/jsb-link/frameworks/runtime-src/Classes/send_ring_buff.hpp +++ b/frontend/build-templates/jsb-link/frameworks/runtime-src/Classes/send_ring_buff.hpp @@ -4,6 +4,8 @@ #include "uv/uv.h" #define __SSIZE_T // Otherwise "ssize_t" would have conflicting macros error that stops compiling +#include + int const RING_BUFF_CONSECUTIVE_SET = 0; int const RING_BUFF_NON_CONSECUTIVE_SET = 1; int const RING_BUFF_FAILED_TO_SET = 2; @@ -48,10 +50,17 @@ public: size_t bytesLen; }; -// [WARNING] This class is specific to "RecvWork" +/* +[WARNING] This class is specific to "RecvWork"; its "put" and "pop" methods are designed to be thread-safe & lock-free for our particular case, i.e. only concurrent access from "UvRecvThread" & "GameThread", in a sense more sophisticated than the Golang or JavaScript versions. + +There's yet no plan to support thread-safe & lock-free "getByFrameId/setByFrameId" -- being thread-safe is easy by use of mutex, which is very SLOWWWWW when used in 60fps race-conditions. + +The generic "thread-safe, lock-free ring buffer or circular buffer" is a big problem, widely discussed over the internet and in literatures, search "lock-free circular buffer" for more information. +*/ class RecvRingBuff { public: - int ed, st, n, cnt; + int n; + std::atomic_int ed, st, cnt; RecvWork eles[maxBuffedMsgs]; // preallocated on stack to save heap alloc/dealloc time RecvRingBuff(int newN) { this->n = newN; @@ -60,6 +69,6 @@ public: void put(char* newBytes, size_t newBytesLen); - RecvWork* pop(); + bool pop(RecvWork* out); }; #endif diff --git a/frontend/build-templates/jsb-link/frameworks/runtime-src/Classes/udp_session.cpp b/frontend/build-templates/jsb-link/frameworks/runtime-src/Classes/udp_session.cpp index 7681014..e737ede 100644 --- a/frontend/build-templates/jsb-link/frameworks/runtime-src/Classes/udp_session.cpp +++ b/frontend/build-templates/jsb-link/frameworks/runtime-src/Classes/udp_session.cpp @@ -72,9 +72,9 @@ void _onRead(uv_udp_t* req, ssize_t nread, uv_buf_t const* buf, struct sockaddr #if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0) CCLOG("UDP received %u bytes inputFrameUpsync from %s:%d", nread, ip, port); #endif - uv_mutex_lock(&recvRingBuffLock); + //uv_mutex_lock(&recvRingBuffLock); recvRingBuff->put(buf->base, nread); - uv_mutex_unlock(&recvRingBuffLock); + //uv_mutex_unlock(&recvRingBuffLock); } free(buf->base); @@ -352,15 +352,12 @@ bool DelayNoMore::UdpSession::broadcastInputFrameUpsync(BYTEC* const bytes, size bool DelayNoMore::UdpSession::pollUdpRecvRingBuff() { // This function is called by GameThread 60 fps. - if (0 >= recvRingBuff->cnt) { - // This check is NOT thread-safe, but as "pollUdpRecvRingBuff" is called by GameThread, we want it to lock as few as possible. - return true; - } + //uv_mutex_lock(&recvRingBuffLock); + while (true) { + RecvWork f; + bool res = recvRingBuff->pop(&f); + if (!res) return false; - uv_mutex_lock(&recvRingBuffLock); - RecvWork* f = NULL; - while (0 < recvRingBuff->cnt) { - f = recvRingBuff->pop(); // [WARNING] Declaring "AutoHandleScope" is critical here, otherwise "onUdpMessageCb.toObject()" wouldn't be recognized as a function of the ScriptEngine! se::AutoHandleScope hs; // [WARNING] Use of the "ScriptEngine" is only allowed in "GameThread a.k.a. CocosThread"! @@ -368,7 +365,7 @@ bool DelayNoMore::UdpSession::pollUdpRecvRingBuff() { se::ScriptEngine::getInstance()->getGlobalObject()->getProperty("onUdpMessage", &onUdpMessageCb); if (onUdpMessageCb.isObject() && onUdpMessageCb.toObject()->isFunction()) { //CCLOG("UDP received %d bytes upsync -- 1", nread); - se::Object* const gameThreadMsg = se::Object::createTypedArray(se::Object::TypedArrayType::UINT8, f->ui8Arr, f->bytesLen); + se::Object* const gameThreadMsg = se::Object::createTypedArray(se::Object::TypedArrayType::UINT8, f.ui8Arr, f.bytesLen); //CCLOG("UDP received %d bytes upsync -- 2", nread); se::ValueArray args = { se::Value(gameThreadMsg) }; @@ -382,6 +379,6 @@ bool DelayNoMore::UdpSession::pollUdpRecvRingBuff() { //CCLOG("UDP received %d bytes upsync -- 4", nread); } } - uv_mutex_unlock(&recvRingBuffLock); + //uv_mutex_unlock(&recvRingBuffLock); return true; } \ No newline at end of file diff --git a/jsexport/battle/battle.go b/jsexport/battle/battle.go index cde43c8..64838e9 100644 --- a/jsexport/battle/battle.go +++ b/jsexport/battle/battle.go @@ -755,7 +755,7 @@ func ApplyInputFrameDownsyncDynamicsOnSingleRenderFrame(inputsBuffer *RingBuffer // Reset playerCollider position from the "virtual grid position" newVx, newVy := currPlayerDownsync.VirtualGridX+currPlayerDownsync.VelX, currPlayerDownsync.VirtualGridY+currPlayerDownsync.VelY if 0 >= thatPlayerInNextFrame.Hp && 0 == thatPlayerInNextFrame.FramesToRecover { - // Revive + // Revive from Dying newVx, newVy = currPlayerDownsync.RevivalVirtualGridX, currPlayerDownsync.RevivalVirtualGridY thatPlayerInNextFrame.CharacterState = ATK_CHARACTER_STATE_IDLE1 thatPlayerInNextFrame.Hp = currPlayerDownsync.MaxHp @@ -945,7 +945,8 @@ func ApplyInputFrameDownsyncDynamicsOnSingleRenderFrame(inputsBuffer *RingBuffer if fallStopping { thatPlayerInNextFrame.VelY = 0 thatPlayerInNextFrame.VelX = 0 - if ATK_CHARACTER_STATE_BLOWN_UP1 == thatPlayerInNextFrame.CharacterState { + if ATK_CHARACTER_STATE_DYING == thatPlayerInNextFrame.CharacterState { + } else if ATK_CHARACTER_STATE_BLOWN_UP1 == thatPlayerInNextFrame.CharacterState { thatPlayerInNextFrame.CharacterState = ATK_CHARACTER_STATE_LAY_DOWN1 thatPlayerInNextFrame.FramesToRecover = chConfig.LayDownFramesToRecover } else { @@ -960,9 +961,11 @@ func ApplyInputFrameDownsyncDynamicsOnSingleRenderFrame(inputsBuffer *RingBuffer thatPlayerInNextFrame.FramesToRecover = 0 } } else { - // landedOnGravityPushback not fallStopping, could be in LayDown or GetUp + // landedOnGravityPushback not fallStopping, could be in LayDown or GetUp or Dying if _, existent := nonAttackingSet[thatPlayerInNextFrame.CharacterState]; existent { - if ATK_CHARACTER_STATE_LAY_DOWN1 == thatPlayerInNextFrame.CharacterState { + if ATK_CHARACTER_STATE_DYING == thatPlayerInNextFrame.CharacterState { + // No update needed for Dying + } else if ATK_CHARACTER_STATE_LAY_DOWN1 == thatPlayerInNextFrame.CharacterState { if 0 == thatPlayerInNextFrame.FramesToRecover { thatPlayerInNextFrame.CharacterState = ATK_CHARACTER_STATE_GET_UP1 thatPlayerInNextFrame.FramesToRecover = chConfig.GetUpFramesToRecover