package scripts;
import com.stencyl.Engine;
import com.stencyl.behavior.Script;
import com.stencyl.models.Actor; // this code makes many actors.
import com.stencyl.models.actor.ActorType; //actor type for object parts
import type_data.Object_types;
class Objdata_3 // in this version, each actor is 1 tile but objects may consist of multiple actors.
{
public var actors:Array <Dynamic>=[];
public var id0_nxny:Array <Dynamic>=[]; public var id0_nxpy:Array <Dynamic>=[];
public var id0_pxny:Array <Dynamic>=[]; public var id0_pxpy:Array <Dynamic>=[];
public var id1_nxny:Array <Dynamic>=[]; public var id1_nxpy:Array <Dynamic>=[];
public var id1_pxny:Array <Dynamic>=[]; public var id1_pxpy:Array <Dynamic>=[];
public var ids_nxny:Array <Dynamic>=[]; public var ids_nxpy:Array <Dynamic>=[];
public var ids_pxny:Array <Dynamic>=[]; public var ids_pxpy:Array <Dynamic>=[];
public var ocu_nxny:Array <Dynamic>=[]; public var ocu_nxpy:Array <Dynamic>=[];
public var ocu_pxny:Array <Dynamic>=[]; public var ocu_pxpy:Array <Dynamic>=[];
public var rfh_nxny:Array <Dynamic>=[]; public var rfh_nxpy:Array <Dynamic>=[];
public var rfh_pxny:Array <Dynamic>=[]; public var rfh_pxpy:Array <Dynamic>=[];
public var rfv_nxny:Array <Dynamic>=[]; public var rfv_nxpy:Array <Dynamic>=[];
public var rfv_pxny:Array <Dynamic>=[]; public var rfv_pxpy:Array <Dynamic>=[];
public var rot_nxny:Array <Dynamic>=[]; public var rot_nxpy:Array <Dynamic>=[];
public var rot_pxny:Array <Dynamic>=[]; public var rot_pxpy:Array <Dynamic>=[];
public var cur_obj_id0:Int=0; public var cur_obj_id1:Int=0; public var lac:Actor;
public var offsx:Float=0; public var offsy:Float=0;
public var ac_wood:Float = 0.1; public var bc_wood:Float=1; public var cc_wood:Float=0.1;
public var last_created_actor:Actor= null;
public var half_sceh:Float = Engine.sceneHeight/2; public var half_scew:Float = Engine.sceneWidth/2;
public var half_sceh_2:Float = Engine.sceneHeight /2;
public var half_scrh:Float = Engine.screenHeight/2; public var half_scrw:Float = Engine.screenWidth/2;
public var shifting: Bool = false;
public var sceh:Float = Engine.sceneHeight; public var scew:Float = Engine.sceneWidth;
public var scrh:Float = Engine.screenHeight; public var scrw:Float = Engine.screenWidth;
public var f = new F(); public var diag_ak:Int =0; public var diag_cek_get:Int=0;
public var diag_kill_line:Int; public var diag_kl_start:Int; public var diag_kl_end:Int;
public var noa:Int =0;
public function new(){this.f.f_cu = Script.getFont(19);}
public function create_actor(a:ActorType, x:Float, y:Float)
{
this.last_created_actor = Engine.engine.getRecycledActorOfTypeOnLayer(a,x,y,2); this.noa +=1;
}
public function load(){this.init();}
public function init()
{
if(this.id0_nxny==null||""+this.id0_nxny=="undefined"){this.id0_nxny=[];}
if(this.id0_nxpy==null||""+this.id0_nxpy=="undefined"){this.id0_nxpy=[];}
if(this.id0_pxny==null||""+this.id0_pxny=="undefined"){this.id0_pxny=[];}
if(this.id0_pxpy==null||""+this.id0_pxpy=="undefined"){this.id0_pxpy=[];}
if(this.id1_nxny==null||""+this.id1_nxny=="undefined"){this.id1_nxny=[];}
if(this.id1_nxpy==null||""+this.id1_nxpy=="undefined"){this.id1_nxpy=[];}
if(this.id1_pxny==null||""+this.id1_pxny=="undefined"){this.id1_pxny=[];}
if(this.id1_pxpy==null||""+this.id1_pxpy=="undefined"){this.id1_pxpy=[];}
if(this.ids_nxny==null||""+this.ids_nxny=="undefined"){this.ids_nxny=[];}
if(this.ids_nxpy==null||""+this.ids_nxpy=="undefined"){this.ids_nxpy=[];}
if(this.ids_pxny==null||""+this.ids_pxny=="undefined"){this.ids_pxny=[];}
if(this.ids_pxpy==null||""+this.ids_pxpy=="undefined"){this.ids_pxpy=[];}
if(this.ocu_nxny==null||""+this.ocu_nxny=="undefined"){this.ocu_nxny=[];}
if(this.ocu_nxpy==null||""+this.ocu_nxpy=="undefined"){this.ocu_nxpy=[];}
if(this.ocu_pxny==null||""+this.ocu_pxny=="undefined"){this.ocu_pxny=[];}
if(this.ocu_pxpy==null||""+this.ocu_pxpy=="undefined"){this.ocu_pxpy=[];}
if(this.rfh_nxny==null||""+this.rfh_nxny=="undefined"){this.rfh_nxny=[];}
if(this.rfh_nxpy==null||""+this.rfh_nxpy=="undefined"){this.rfh_nxpy=[];}
if(this.rfh_pxny==null||""+this.rfh_pxny=="undefined"){this.rfh_pxny=[];}
if(this.rfh_pxpy==null||""+this.rfh_pxpy=="undefined"){this.rfh_pxpy=[];}
if(this.rfv_nxny==null||""+this.rfv_nxny=="undefined"){this.rfv_nxny=[];}
if(this.rfv_nxpy==null||""+this.rfv_nxpy=="undefined"){this.rfv_nxpy=[];}
if(this.rfv_pxny==null||""+this.rfv_pxny=="undefined"){this.rfv_pxny=[];}
if(this.rfv_pxpy==null||""+this.rfv_pxpy=="undefined"){this.rfv_pxpy=[];}
if(this.rot_nxny==null||""+this.rot_nxny=="undefined"){this.rot_nxny=[];}
if(this.rot_nxpy==null||""+this.rot_nxpy=="undefined"){this.rot_nxpy=[];}
if(this.rot_pxny==null||""+this.rot_pxny=="undefined"){this.rot_pxny=[];}
if(this.rot_pxpy==null||""+this.rot_pxpy=="undefined"){this.rot_pxpy=[];}
}
public function cek_ocu(x:Int, y:Int):Bool
{
if(x < 0)
{
if(y < 0)
{
if(this.ocu_nxny[0-x]==null ||""+this.ocu_nxny[0-x]=="undefined"){return false;}
if(this.ocu_nxny[0-x][0-y]==null ||""+this.ocu_nxny[0-x][0-y]=="undefined"){return false;}
else if(""+this.ocu_nxny[0-x][0-y]=="true"){return true;}
}
else
{
if(this.ocu_nxpy[0-x]==null ||""+this.ocu_nxpy[0-x]=="undefined"){return false;}
if(this.ocu_nxpy[0-x][y]==null ||""+this.ocu_nxpy[0-x][y]=="undefined"){return false;}
else if(""+this.ocu_nxpy[0-x][y]=="true"){return true;}
}
}
else
{
if(y < 0)
{
if(this.ocu_pxny[x]==null ||""+this.ocu_pxny[x]=="undefined"){return false;}
if(this.ocu_pxny[x][0-y]==null ||""+this.ocu_pxny[x][0-y]=="undefined"){return false;}
else if(""+this.ocu_pxny[x][0-y]=="true"){return true;}
}
else
{
if(this.ocu_pxpy[x]==null ||""+this.ocu_pxpy[x]=="undefined"){return false;}
if(this.ocu_pxpy[x][y]==null ||""+this.ocu_pxpy[x][y]=="undefined"){return false;}
else if(""+this.ocu_pxpy[x][y]=="true"){return true;}
}
}
return false;
}
public function create_object(){}
public function diagnosis_data(x:Float,y:Float)
{
this.f.ds("number of obj actors"+this.noa,x+5,y + 20);
this.f.ds("check gate: offsx check gate"+this.diag_cek_get,x+5,y + 40);
this.f.ds("obj data offsx "+ this.offsx,x,y+70);
this.f.ds("obj data offsy "+ this.offsy,x,y+90);
}
public function get_min_int(a:Int,b:Int):Int {if(a > b)return b; else return a;}
public function remo_rnx(x,ymax,ymin):Void
{
var y:Int = ymin; if(this.actors[x]==null ||""+this.actors[x]=="undefined"){this.actors[x]=[];}
while(y < ymax)
{
if(this.actors[x][y]!=null && ""+this.actors[x][y]!= "undefined"){Script.recycleActor(this.actors[x][y]); this.actors[x][y]=null; this.noa-=1;}
y = y+1;
}
}
public function remo_rny(y:Int,xmax:Int,xmin:Int):Void
{
var x:Int = xmin;
while (x < xmax)
{
if(this.actors[x]==null ||""+this.actors[x]=="undefined"){this.actors[x]=[];}
if(this.actors[x][y]!=null && ""+this.actors[x][y]!="undefined"){Engine.engine.recycleActor(this.actors[x][y]); this.actors[x][y]=null; this.noa -=1;}
x = x+1;
}
}
public function remo_rpx(x:Int,ymax:Int,ymin:Int):Void // co ntrolled from scene behavs. bug info: called but cannot recycle actor. actors mapped correctly.
{
var y:Int = ymin;
//this.diag_kill_line = x; this.diag_kl_start = ymin; this.diag_kl_end = ymax; // diagnosis data
if(this.actors[x]==null ||""+this.actors[x]=="undefined"){this.actors[x]=[];}
while(y < ymax)
{
if(this.actors[x][y]!=null && ""+this.actors[x][y]!="undefined") // the diag_ak did not increase showing the codition is not met desipte actor exists.
{Script.recycleActor(this.actors[x][y]); this.actors[x][y]=null; this.noa -=1;}
y = y+1; // crash test shows that the process reaches here.
}
}
public function remo_rpy(y:Int,xmax:Int,xmin:Int):Void
{
var x:Int = xmin;
while (x < xmax)
{
if(this.actors[x]==null ||""+this.actors[x]=="undefined"){this.actors[x]=[];}
if(this.actors[x][y]!=null && ""+this.actors[x][y]!="undefined"){Engine.engine.recycleActor(this.actors[x][y]); this.actors[x][y]=null; this.noa -=1;}
x = x+1;
}
}
public function randgen_rfh():Bool {var a = Math.random(); if(a > 0.5){return false;} else return true;}
public function randgen_rot():Float {return Math.floor(Math.random() *3.99)*90;}
public function randgen_wood_1t():String // starting point for 1x1 obstacles.
{
var _0:Float = Math.random();
if(_0 < this.cc_wood)
{
this.cc_wood =- this.bc_wood;
var _1:Float = Math.floor(Math.random() * 3.99);
if(_1 ==0){return "tr1_1x1a";}
else if(_1 ==1){return "tr1_1x1b";}
else if(_1 ==2){return "tr1_1x1c";}
else if(_1 ==3){return "tr1_1x1d";}
}
else this.cc_wood += this.ac_wood;
return ""; // no actors.
}
public function randgen_wood_corner(end:Bool = false):String // starting point
{
var _0:Float = Math.random();
if(_0 < this.cc_wood|| end)
{
this.cc_wood =- this.bc_wood;
var _1:Int = Std.int(Math.floor(Math.random() * 3.99));
if(_1 == 0){return "tr1_c1";}
else if(_1 == 1){return "tr1_c2";}
else if(_1 == 2){return "tr1_c3";}
else if(_1 == 3){return "tr1_c4";}
}
this.cc_wood += this.ac_wood;return ""; // no actors.
}
public function randgen_wood_edge(end:Bool = false):String // not starting point
{
var a:Int = Std.int(Math.floor(Math.random() * 3.99));
this.cc_wood =- this.bc_wood;
if(a == 0) return "tr1_e1";
else if(a == 1) return "tr1_e2";
else if(a == 2) return "tr1_e3";
else if(a == 3) return "tr1_e4";
return ""; // no actors.
}
public function randgen_wood_end(end:Bool = false):String //starting point
{
var _0:Float = Math.random();
if(_0 < this.cc_wood || end)
{
this.cc_wood =- this.bc_wood;
var _1:Int = Std.int(Math.floor(Math.random() * 3.99));
if(_1 == 0){return "tr1_1t_e1";}
else if(_1 == 1){return "tr1_1t_e2";}
else if(_1 == 2){return "tr1_1t_e3";}
else if(_1 == 3){return "tr1_1t_e4";}
}
this.cc_wood += this.ac_wood; return ""; // no actors.
}
public function randgen_wood_mid():String // for middle part of the wood
{
var a:Int = Std.int(Math.floor(Math.random() * 3.999));
this.cc_wood =- this.bc_wood;
if(a == 0) return "tr1_1t_i1";
else if(a == 1) return "tr1_1t_i2";
else if(a == 2) return "tr1_1t_i3";
else if(a == 3) return "tr1_1t_i4";
return ""; // no actors.
}
public function rnx(x,ymax,ymin)
{ var sx:Int; var sy:Int; var adj:Float =0; var create_x:Float, create_y:Float;
var at:ActorType=null; var id0:Int=0; var id1:Int=0; var rfh:Bool=false; var rfv:Bool=false; var rot:Float=0;
var y:Int = ymin;
if(this.actors[x]==null || this.actors[x]=="undefined"){this.actors[x]=[];}
if(x < 0)
{
while(y < ymax) // phase 1 data initialisation
{
if(y < 0) // rnx nxny
{
if(this.id0_nxny[0-x]==null||""+this.id0_nxny[0-x]=="undefined"){this.id0_nxny[0-x]=[];}
if(this.id1_nxny[0-x]==null||""+this.id1_nxny[0-x]=="undefined"){this.id1_nxny[0-x]=[];}
if(this.ids_nxny[0-x]==null||""+this.ids_nxny[0-x]=="undefined"){this.ids_nxny[0-x]=[];}
if(this.ocu_nxny[0-x]==null||""+this.ocu_nxny[0-x]=="undefined"){this.ocu_nxny[0-x]=[];}
if(this.rfh_nxny[0-x]==null||""+this.rfh_nxny[0-x]=="undefined"){this.rfh_nxny[0-x]=[];}
if(this.rfv_nxny[0-x]==null||""+this.rfv_nxny[0-x]=="undefined"){this.rfv_nxny[0-x]=[];}
if(this.rot_nxny[0-x]==null||""+this.rot_nxny[0-x]=="undefined"){this.rot_nxny[0-x]=[];}
if(this.ocu_nxny[0-x][0-y]==null||""+this.ocu_nxny[0-x][0-y]=="undefined"){this.ocu_nxny[0-x][0-y]=false;}
if(this.ids_nxny[0-x][0-y]==null||""+this.ids_nxny[0-x][0-y]=="undefined") // undefined actor creation.
{
sx = 1 + Std.int(Math.floor(Math.random() * 3.99)); sy = 1 + Std.int(Math.floor(Math.random() * 3.99));
// vertical ocu checker
if(this.cek_ocu(x,y+1)){sy =1;}
else if(this.cek_ocu(x,y+2)){sy = Std.int(Math.min(2,sy));}
else if(this.cek_ocu(x,y+3)){sy = Std.int(Math.min(3,sy));}
if(this.cek_ocu(x-1,y)){sx = 1;}
else if(this.cek_ocu(x-2,y)){sx = Std.int(Math.min(2,sx));}
else if(this.cek_ocu(x-3,y)){sx = Std.int(Math.min(3,sx));}
if(sx ==1 && sy == 1) // 1x1
{
this.ids_nxny[0-x][0-y] = this.randgen_wood_1t();
if(this.ids_nxny[0-x][0-y] !="")
{
if(this.id0_nxny[0-x][0-y]==null||""+this.id0_nxny[0-x][0-y]=="undefined"){this.id0_nxny[0-x][0-y]=this.cur_obj_id0;}
if(this.id1_nxny[0-x][0-y]==null||""+this.id1_nxny[0-x][0-y]=="undefined"){this.id1_nxny[0-x][0-y]=this.cur_obj_id1;}
if(this.ocu_nxny[0-x][0-y]==null||""+this.ocu_nxny[0-x][0-y]=="undefined"){this.ocu_nxny[0-x][0-y]=true;}
if(this.rfh_nxny[0-x][0-y]==null||""+this.rfh_nxny[0-x][0-y]=="undefined"){this.rfh_nxny[0-x][0-y]=this.randgen_rfh();}
if(this.rfv_nxny[0-x][0-y]==null||""+this.rfv_nxny[0-x][0-y]=="undefined"){this.rfv_nxny[0-x][0-y]=this.randgen_rfh();}
if(this.rot_nxny[0-x][0-y]==null||""+this.rot_nxny[0-x][0-y]=="undefined"){this.rot_nxny[0-x][0-y]=this.randgen_rot();}
this.update_cur_obj_idn();
}
}
else if(sx ==1 && sy > 1) // rnx nxny veritcal bars
{
this.ids_nxny[0-x][0-y] = this.randgen_wood_end();
if(this.ids_nxny[0-x][0-y]!="") // creating initialising the first object tile data.
{
if(y + sy > 0) // initialize nxpy data.
{
if(this.id0_nxpy[0-x]==null||""+this.id0_nxpy[0-x]=="undefined"){this.id0_nxpy[0-x]=[];}
if(this.id1_nxpy[0-x]==null||""+this.id1_nxpy[0-x]=="undefined"){this.id1_nxpy[0-x]=[];}
if(this.ids_nxpy[0-x]==null||""+this.ids_nxpy[0-x]=="undefined"){this.ids_nxpy[0-x]=[];}
if(this.ocu_nxpy[0-x]==null||""+this.ocu_nxpy[0-x]=="undefined"){this.ocu_nxpy[0-x]=[];}
if(this.rfh_nxpy[0-x]==null||""+this.rfh_nxpy[0-x]=="undefined"){this.rfh_nxpy[0-x]=[];}
if(this.rfv_nxpy[0-x]==null||""+this.rfv_nxpy[0-x]=="undefined"){this.rfv_nxpy[0-x]=[];}
if(this.rot_nxpy[0-x]==null||""+this.rot_nxpy[0-x]=="undefined"){this.rot_nxpy[0-x]=[];}
}
var b:Int =0;
var a:Int =0; while(a < sy)
{
b = y+a;
if(b < 0) // the flips wen use by axis, not scale factor;
{
if(this.id0_nxny[0-x][0-b]==null||""+this.id0_nxny[0-x][0-b]=="undefined"){this.id0_nxny[0-x][0-b]=this.cur_obj_id0;}
if(this.id1_nxny[0-x][0-b]==null||""+this.id1_nxny[0-x][0-b]=="undefined"){this.id1_nxny[0-x][0-b]=this.cur_obj_id1;}
if(this.ocu_nxny[0-x][0-b]==null||""+this.ocu_nxny[0-x][0-b]=="undefined"){this.ocu_nxny[0-x][0-b]=true;}
if(a == 0) // problem found in data change
{
if(this.rfh_nxny[0-x][0-y]==null||""+this.rfh_nxny[0-x][0-y]=="undefined"){this.rfh_nxny[0-x][0-y]=this.randgen_rfh();}
if(this.rfv_nxny[0-x][0-y]==null||""+this.rfv_nxny[0-x][0-y]=="undefined"){this.rfv_nxny[0-x][0-y]=false;}
if(this.rot_nxny[0-x][0-y]==null||""+this.rot_nxny[0-x][0-y]=="undefined"){this.rot_nxny[0-x][0-y]=90;}
}
else if(a == sy-1) // bugs in rendering
{
if(this.ids_nxny[0-x][0-b]==null||""+this.ids_nxny[0-x][0-b]=="undefined"){this.ids_nxny[0-x][0-b]=this.randgen_wood_end(true);}
if(this.rfh_nxny[0-x][0-b]==null||""+this.rfh_nxny[0-x][0-b]=="undefined"){this.rfh_nxny[0-x][0-b]=this.randgen_rfh();}
if(this.rfv_nxny[0-x][0-b]==null||""+this.rfv_nxny[0-x][0-b]=="undefined"){this.rfv_nxny[0-x][0-b]=false;}
if(this.rot_nxny[0-x][0-b]==null||""+this.rot_nxny[0-x][0-b]=="undefined"){this.rot_nxny[0-x][0-b]=270;}
}
else // middle part for nxny;
{
if(this.ids_nxny[0-x][0-b]==null||""+this.ids_nxny[0-x][0-b]=="undefined"){this.ids_nxny[0-x][0-b]=this.randgen_wood_mid();}
if(this.rfh_nxny[0-x][0-b]==null||""+this.rfh_nxny[0-x][0-b]=="undefined"){this.rfh_nxny[0-x][0-b]=this.randgen_rfh();}
if(this.rfv_nxny[0-x][0-b]==null||""+this.rfv_nxny[0-x][0-b]=="undefined"){this.rfv_nxny[0-x][0-b]=this.randgen_rfh();}
if(this.rot_nxny[0-x][0-b]==null||""+this.rot_nxny[0-x][0-b]=="undefined"){this.rot_nxny[0-x][0-b]=90;}
}
}
else
{
if(this.id0_nxpy[0-x][b]==null||""+this.id0_nxpy[0-x][b]=="undefined"){this.id0_nxpy[0-x][b]=this.cur_obj_id0;}
if(this.id1_nxpy[0-x][b]==null||""+this.id1_nxpy[0-x][b]=="undefined"){this.id1_nxpy[0-x][b]=this.cur_obj_id1;}
if(this.ocu_nxpy[0-x][b]==null||""+this.ocu_nxpy[0-x][b]=="undefined"){this.ocu_nxpy[0-x][b]=true;}
if(a == sy -1)
{
if(this.ids_nxpy[0-x][b]==null||""+this.ids_nxpy[0-x][b]=="undefined"){this.ids_nxpy[0-x][b]=this.randgen_wood_end(true);}
if(this.rfh_nxpy[0-x][b]==null||""+this.rfh_nxpy[0-x][b]=="undefined"){this.rfh_nxpy[0-x][b]=this.randgen_rfh();}
if(this.rfv_nxpy[0-x][b]==null||""+this.rfv_nxpy[0-x][b]=="undefined"){this.rfv_nxpy[0-x][b]=false;}
if(this.rot_nxpy[0-x][b]==null||""+this.rot_nxpy[0-x][b]=="undefined"){this.rot_nxpy[0-x][b]=270;}
}
else
{
if(this.ids_nxpy[0-x][b]==null||""+this.ids_nxpy[0-x][b]=="undefined"){this.ids_nxpy[0-x][b]=this.randgen_wood_mid();}
if(this.rfh_nxpy[0-x][b]==null||""+this.rfh_nxpy[0-x][b]=="undefined"){this.rfh_nxpy[0-x][b]=this.randgen_rfh();}
if(this.rfv_nxpy[0-x][b]==null||""+this.rfv_nxpy[0-x][b]=="undefined"){this.rfv_nxpy[0-x][b]=this.randgen_rfh();}
if(this.rot_nxpy[0-x][b]==null||""+this.rot_nxpy[0-x][b]=="undefined"){this.rot_nxpy[0-x][b]=90;}
}
}
a=a+1;
}
this.update_cur_obj_idn();
}
}
else if(sx > 1 && sy==1) // horizontal bars on nxny - pxny is not required.
{
this.ids_nxny[0-x][0-y] = this.randgen_wood_end();
if(this.ids_nxny[0-x][0-y]!="")
{
var b:Int = 0;
var a:Int = 0; while(a < sx)
{ b = x-a;
if(this.id0_nxny[0-b]==null||""+this.id0_nxny[0-b]=="undefined"){this.id0_nxny[0-b]=[];}
if(this.id1_nxny[0-b]==null||""+this.id1_nxny[0-b]=="undefined"){this.id1_nxny[0-b]=[];}
if(this.ids_nxny[0-b]==null||""+this.ids_nxny[0-b]=="undefined"){this.ids_nxny[0-b]=[];}
if(this.ocu_nxny[0-b]==null||""+this.ocu_nxny[0-b]=="undefined"){this.ocu_nxny[0-b]=[];}
if(this.rfh_nxny[0-b]==null||""+this.rfh_nxny[0-b]=="undefined"){this.rfh_nxny[0-b]=[];}
if(this.rfv_nxny[0-b]==null||""+this.rfv_nxny[0-b]=="undefined"){this.rfv_nxny[0-b]=[];}
if(this.rot_nxny[0-b]==null||""+this.rot_nxny[0-b]=="undefined"){this.rot_nxny[0-b]=[];}
if(this.id0_nxny[0-b][0-y]==null||""+this.id0_nxny[0-b][0-y]=="undefined"){this.id0_nxny[0-b][0-y]=this.cur_obj_id0;}
if(this.id1_nxny[0-b][0-y]==null||""+this.id1_nxny[0-b][0-y]=="undefined"){this.id1_nxny[0-b][0-y]=this.cur_obj_id1;}
if(this.ocu_nxny[0-b][0-y]==null||""+this.ocu_nxny[0-b][0-y]=="undefined"){this.ocu_nxny[0-b][0-y]=true;}
if(a == 0)
{
if(this.rfh_nxny[0-x][0-y]==null||""+this.rfh_nxny[0-x][0-y]=="undefined"){this.rfh_nxny[0-x][0-y]=this.randgen_rfh();} // does not flip. \
if(this.rfv_nxny[0-x][0-y]==null||""+this.rfv_nxny[0-x][0-y]=="undefined"){this.rfv_nxny[0-x][0-y]=false;}
if(this.rot_nxny[0-x][0-y]==null||""+this.rot_nxny[0-x][0-y]=="undefined"){this.rot_nxny[0-x][0-y]=180;}
}
else if(a == sx -1)
{
if(this.ids_nxny[0-b][0-y]==null||""+this.ids_nxny[0-b][0-y]=="undefined"){this.ids_nxny[0-b][0-y]=this.randgen_wood_end(true);}
if(this.rfh_nxny[0-b][0-y]==null||""+this.rfh_nxny[0-b][0-y]=="undefined"){this.rfh_nxny[0-b][0-y]=this.randgen_rfh();}
if(this.rfv_nxny[0-b][0-y]==null||""+this.rfv_nxny[0-b][0-y]=="undefined"){this.rfv_nxny[0-b][0-y]=false;}
if(this.rot_nxny[0-b][0-y]==null||""+this.rot_nxny[0-b][0-y]=="undefined"){this.rot_nxny[0-b][0-y]=0;}
}
else
{
if(this.ids_nxny[0-b][0-y]==null||""+this.ids_nxny[0-b][0-y]=="undefined"){this.ids_nxny[0-b][0-y]=this.randgen_wood_mid();}
if(this.rfh_nxny[0-b][0-y]==null||""+this.rfh_nxny[0-b][0-y]=="undefined"){this.rfh_nxny[0-b][0-y]=this.randgen_rfh();}
if(this.rfv_nxny[0-b][0-y]==null||""+this.rfv_nxny[0-b][0-y]=="undefined"){this.rfv_nxny[0-b][0-y]=this.randgen_rfh();}
if(this.rot_nxny[0-b][0-y]==null||""+this.rot_nxny[0-b][0-y]=="undefined"){this.rot_nxny[0-b][0-y]=0;}
}
a = a+1;
}
this.update_cur_obj_idn();
}
}
else if(sx > 1 && sy > 1) // larger rectangle - use external functions.
{
this.ids_nxny[0-x][0-y] = this.randgen_wood_corner(); // randgen has problem.
if(this.ids_nxny[0-x][0-y]!=""){this.sub_rnx_data_mt(x,y,sx,sy);}
this.update_cur_obj_idn();
}
}
at = Object_types.get_obj_at(this.ids_nxny[0-x][0-y]);
id0 = this.id0_nxny[0-x][0-y]; id1 = this.id1_nxny[0-x][0-y];
rfh = this.rfh_nxny[0-x][0-y]; rfv = this.rfv_nxny[0-x][0-y];
rot = this.rot_nxny[0-x][0-y];
}
else // initial y >= 0
{
if(this.id0_nxpy[0-x]==null||""+this.id0_nxpy[0-x]=="undefined"){this.id0_nxpy[0-x]=[];}
if(this.id1_nxpy[0-x]==null||""+this.id1_nxpy[0-x]=="undefined"){this.id1_nxpy[0-x]=[];}
if(this.ids_nxpy[0-x]==null||""+this.ids_nxpy[0-x]=="undefined"){this.ids_nxpy[0-x]=[];}
if(this.ocu_nxpy[0-x]==null||""+this.ocu_nxpy[0-x]=="undefined"){this.ocu_nxpy[0-x]=[];}
if(this.rfh_nxpy[0-x]==null||""+this.rfh_nxpy[0-x]=="undefined"){this.rfh_nxpy[0-x]=[];}
if(this.rfv_nxpy[0-x]==null||""+this.rfv_nxpy[0-x]=="undefined"){this.rfv_nxpy[0-x]=[];}
if(this.rot_nxpy[0-x]==null||""+this.rot_nxpy[0-x]=="undefined"){this.rot_nxpy[0-x]=[];}
if(this.ids_nxpy[0-x][y]==null||""+this.ids_nxpy[0-x][y]=="undefined")
{
sx = 1+ Std.int(Math.floor(Math.random() * 3.99)); sy = 1+ Std.int(Math.floor(Math.random() * 3.99));
if(this.cek_ocu(x,y+1)){sy =1;}
else if(this.cek_ocu(x,y+2)){sy = Std.int(Math.min(2,sy));}
else if(this.cek_ocu(x,y+3)){sy = Std.int(Math.min(3,sy));}
if(sx == 1 && sy == 1)
{
this.ids_nxpy[0-x][y] = this.randgen_wood_1t();
if(this.ids_nxpy[0-x][y] !="")
{
if(this.id0_nxpy[0-x][y]==null||""+this.id0_nxpy[0-x][y]=="undefined"){this.id0_nxpy[0-x][y]=this.cur_obj_id0;}
if(this.id1_nxpy[0-x][y]==null||""+this.id1_nxpy[0-x][y]=="undefined"){this.id1_nxpy[0-x][y]=this.cur_obj_id1;}
if(this.ocu_nxpy[0-x][y]==null||""+this.ocu_nxpy[0-x][y]=="undefined"){this.ocu_nxpy[0-x][y]=true;}
if(this.rfh_nxpy[0-x][y]==null||""+this.rfh_nxpy[0-x][y]=="undefined"){this.rfh_nxpy[0-x][y]=this.randgen_rfh();}
if(this.rfv_nxpy[0-x][y]==null||""+this.rfv_nxpy[0-x][y]=="undefined"){this.rfv_nxpy[0-x][y]=this.randgen_rfh();}
if(this.rot_nxpy[0-x][y]==null||""+this.rot_nxpy[0-x][y]=="undefined"){this.rot_nxpy[0-x][y]=this.randgen_rot();}
this.update_cur_obj_idn();
}
}
else if(sx > 1 && sy == 1) // horizontals in RNX for nxpy - sunce it is nx and rnx, px is not needed.
{
this.ids_nxpy[0-x][y] = this.randgen_wood_end();
if(this.ids_nxpy[0-x][y] != "")
{
var a:Int =0; var b:Int;
while(a < sx)
{ b = x-a;
if(this.id0_nxpy[0-b]==null ||""+this.id0_nxpy[0-b]=="undefined"){this.id0_nxpy[0-b]=[];}
if(this.id1_nxpy[0-b]==null ||""+this.id1_nxpy[0-b]=="undefined"){this.id1_nxpy[0-b]=[];}
if(this.ids_nxpy[0-b]==null ||""+this.ids_nxpy[0-b]=="undefined"){this.ids_nxpy[0-b]=[];}
if(this.ocu_nxpy[0-b]==null ||""+this.ocu_nxpy[0-b]=="undefined"){this.ocu_nxpy[0-b]=[];}
if(this.rfh_nxpy[0-b]==null ||""+this.rfh_nxpy[0-b]=="undefined"){this.rfh_nxpy[0-b]=[];}
if(this.rfv_nxpy[0-b]==null ||""+this.rfv_nxpy[0-b]=="undefined"){this.rfv_nxpy[0-b]=[];}
if(this.rot_nxpy[0-b]==null ||""+this.rot_nxpy[0-b]=="undefined"){this.rot_nxpy[0-b]=[];}
if(this.id0_nxpy[0-b][y]==null ||""+this.id0_nxpy[0-b][y]=="undefined"){this.id0_nxpy[0-b][y]=this.cur_obj_id0;}
if(this.id1_nxpy[0-b][y]==null ||""+this.id1_nxpy[0-b][y]=="undefined"){this.id1_nxpy[0-b][y]=this.cur_obj_id1;}
if(this.ocu_nxpy[0-b][y]==null ||""+this.ocu_nxpy[0-b][y]=="undefined"){this.ocu_nxpy[0-b][y]=true;}
if(a == 0) // initialisation.
{
if(this.rfh_nxpy[0-x][y]==null ||""+this.rfh_nxpy[0-x][y]=="undefined"){this.rfh_nxpy[0-x][y]=this.randgen_rfh();}
if(this.rfv_nxpy[0-x][y]==null ||""+this.rfv_nxpy[0-x][y]=="undefined"){this.rfv_nxpy[0-x][y]= false;}
if(this.rot_nxpy[0-x][y]==null ||""+this.rot_nxpy[0-x][y]=="undefined"){this.rot_nxpy[0-x][y]= 180;}
}
else if(a == sx-1) // left end
{
if(this.ids_nxpy[0-b][y]==null ||""+this.ids_nxpy[0-b][y]=="undefined"){this.ids_nxpy[0-b][y]=this.randgen_wood_end(true);}
if(this.rfh_nxpy[0-b][y]==null ||""+this.rfh_nxpy[0-b][y]=="undefined"){this.rfh_nxpy[0-b][y]=this.randgen_rfh();}
if(this.rfv_nxpy[0-b][y]==null ||""+this.rfv_nxpy[0-b][y]=="undefined"){this.rfv_nxpy[0-b][y]=false;}
if(this.rot_nxpy[0-b][y]==null ||""+this.rot_nxpy[0-b][y]=="undefined"){this.rot_nxpy[0-b][y]=0;}
}
else // middle part
{
if(this.ids_nxpy[0-b][y]==null ||""+this.ids_nxpy[0-b][y]=="undefined"){this.ids_nxpy[0-b][y]=this.randgen_wood_mid();}
if(this.rfh_nxpy[0-b][y]==null ||""+this.rfh_nxpy[0-b][y]=="undefined"){this.rfh_nxpy[0-b][y]=this.randgen_rfh();}
if(this.rfv_nxpy[0-b][y]==null ||""+this.rfv_nxpy[0-b][y]=="undefined"){this.rfv_nxpy[0-b][y]=this.randgen_rfh();}
if(this.rot_nxpy[0-b][y]==null ||""+this.rot_nxpy[0-b][y]=="undefined"){this.rot_nxpy[0-b][y]=0;}
}
a = a+1;
}
this.update_cur_obj_idn();
}
}
else if(sx == 1 && sy > 1) // vertical in rnx, y > 0 so nxny will not be used.
{
this.ids_nxpy[0-x][y] = this.randgen_wood_end();
if(this.ids_nxpy[0-x][y] != "")
{
var a:Int =0; var b:Int;
while(a < sy)
{
b = y+a;
if(this.id0_nxpy[0-x][b]==null ||""+this.id0_nxpy[0-x][b]=="undefined"){this.id0_nxpy[0-x][b]=this.cur_obj_id0;}
if(this.id1_nxpy[0-x][b]==null ||""+this.id1_nxpy[0-x][b]=="undefined"){this.id1_nxpy[0-x][b]=this.cur_obj_id1;}
if(this.ocu_nxpy[0-x][b]==null ||""+this.ocu_nxpy[0-x][b]=="undefined"){this.ocu_nxpy[0-x][b]=true;}
if(a == 0) // top end.
{
if(this.rfh_nxpy[0-x][y]==null||""+this.rfh_nxpy[0-x][y]=="undefined"){this.rfh_nxpy[0-x][y]=this.randgen_rfh();}
if(this.rfh_nxpy[0-x][y]==null||""+this.rfh_nxpy[0-x][y]=="undefined"){this.rfv_nxpy[0-x][y]=false;}
if(this.rot_nxpy[0-x][y]==null||""+this.rot_nxpy[0-x][y]=="undefined"){this.rot_nxpy[0-x][y]=90;}
}
else if (a == sy-1)
{
if(this.ids_nxpy[0-x][b]==null||""+this.ids_nxpy[0-x][b]=="undefined"){this.ids_nxpy[0-x][b]=this.randgen_wood_end(true);}
if(this.rfh_nxpy[0-x][b]==null||""+this.rfh_nxpy[0-x][b]=="undefined"){this.rfh_nxpy[0-x][b]=this.randgen_rfh();}
if(this.rfv_nxpy[0-x][b]==null||""+this.rfv_nxpy[0-x][b]=="undefined"){this.rfv_nxpy[0-x][b]=false;}
if(this.rot_nxpy[0-x][b]==null||""+this.rot_nxpy[0-x][b]=="undefined"){this.rot_nxpy[0-x][b]=270;}
}
else
{
if(this.ids_nxpy[0-x][b]==null||""+this.ids_nxpy[0-x][b]=="undefined"){this.ids_nxpy[0-x][b]=this.randgen_wood_mid();}
if(this.rfh_nxpy[0-x][b]==null||""+this.rfh_nxpy[0-x][b]=="undefined"){this.rfh_nxpy[0-x][b]=this.randgen_rfh();}
if(this.rfv_nxpy[0-x][b]==null||""+this.rfv_nxpy[0-x][b]=="undefined"){this.rfv_nxpy[0-x][b]=this.randgen_rfh();}
if(this.rot_nxpy[0-x][b]==null||""+this.rot_nxpy[0-x][b]=="undefined"){this.rot_nxpy[0-x][b]=90;}
}
a = a+1;
}
this.update_cur_obj_idn();
}
}
else // all dimensions exceed 1. use outside functions.
{
this.ids_nxpy[0-x][y] = this.randgen_wood_corner(); // randgen has problem.
if(this.ids_nxpy[0-x][y]!=""){this.sub_rnx_data_mt(x,y,sx,sy);this.update_cur_obj_idn();}
}
}
at = Object_types.get_obj_at(this.ids_nxpy[0-x][y]);
id0 = this.id0_nxpy[0-x][y]; id1 = this.id1_nxpy[0-x][y];
rfh = this.rfh_nxpy[0-x][y]; rfv = this.rfv_nxpy[0-x][y];
rot = this.rot_nxpy[0-x][y];
}
// create actors
if(at != null && ""+at != "undefined") // actor type exists.
{
create_x = this.half_scew + x* 64 - this.offsx; create_y = this.half_sceh + y*64 - this.offsy;
this.create_actor(at,create_x, create_y);
this.actors[x][y] = this.last_created_actor;
this.actors[x][y].spinTo(rot,0,null);
if(rfh){this.actors[x][y].growTo(1,-1,0,null);} // axis based flipping
if(rfv){this.actors[x][y].growTo(-1,1,0,null);}
this.actors[x][y].setValue("Object_behav","id0",id0);
this.actors[x][y].setValue("Object_behav","id1",id1);
}
y = y+1;
}
}
else // positive x for rnx
{
while(y < ymax)
{
if(y < 0) // rnx pxny
{
if(this.id0_pxny[x]==null||""+this.id0_pxny[x]=="undefined"){this.id0_pxny[x]=[];}
if(this.id1_pxny[x]==null||""+this.id1_pxny[x]=="undefined"){this.id1_pxny[x]=[];}
if(this.ids_pxny[x]==null||""+this.ids_pxny[x]=="undefined"){this.ids_pxny[x]=[];}
if(this.ocu_pxny[x]==null||""+this.ocu_pxny[x]=="undefined"){this.ocu_pxny[x]=[];}
if(this.rfh_pxny[x]==null||""+this.rfh_pxny[x]=="undefined"){this.rfh_pxny[x]=[];}
if(this.rfv_pxny[x]==null||""+this.rfv_pxny[x]=="undefined"){this.rfv_pxny[x]=[];}
if(this.rot_pxny[x]==null||""+this.rot_pxny[x]=="undefined"){this.rot_pxny[x]=[];}
if(this.ids_pxny[x][0-y]==null||""+this.ids_pxny[x][0-y]=="undefined")
{
sx = 1 + Std.int(Math.floor(Math.random()*3.99)); sy = 1 + Std.int(Math.floor(Math.random()* 3.99));
if(this.cek_ocu(x,y+1)){sy = 1;}
else if(this.cek_ocu(x,y+2)){sy = Std.int(Math.min(2,sy));}
else if(this.cek_ocu(x,y+3)){sy = Std.int(Math.min(3,sy));}
if(this.cek_ocu(x-1,y)){sx = 1;}
else if(this.cek_ocu(x-2,y)){sx = Std.int(Math.min(2,sx));}
else if(this.cek_ocu(x-3,y)){sx = Std.int(Math.min(3,sx));}
if(sx == 1 && sy == 1)
{
this.ids_pxny[x][0-y] = this.randgen_wood_1t();
if(this.ids_pxny[x][0-y] !="")
{
if(this.id0_pxny[x][0-y]==null||""+this.id0_pxny[x][0-y]=="undefined"){this.id0_pxny[x][0-y]= this.cur_obj_id0;}
if(this.id1_pxny[x][0-y]==null||""+this.id1_pxny[x][0-y]=="undefined"){this.id1_pxny[x][0-y]= this.cur_obj_id1;}
if(this.ocu_pxny[x][0-y]==null||""+this.ocu_pxny[x][0-y]=="undefined"){this.ocu_pxny[x][0-y]= true;}
if(this.rfh_pxny[x][0-y]==null||""+this.rfh_pxny[x][0-y]=="undefined"){this.rfh_pxny[x][0-y]= this.randgen_rfh();}
if(this.rfv_pxny[x][0-y]==null||""+this.rfv_pxny[x][0-y]=="undefined"){this.rfv_pxny[x][0-y]= this.randgen_rfh();}
if(this.rot_pxny[x][0-y]==null||""+this.rot_pxny[x][0-y]=="undefined"){this.rot_pxny[x][0-y]= this.randgen_rot();}
this.update_cur_obj_idn();
}
}
else if(sx == 1 && sy > 1) // verticals
{
this.ids_pxny[x][0-y]= this.randgen_wood_end(); // it affects the entire creation.
if(this.ids_pxny[x][0-y] != "")
{
if(y + sy > -1)
{
if(this.id0_pxpy[x]==null||""+this.id0_pxpy[x]=="undefined"){this.id0_pxpy[x]=[];}
if(this.id1_pxpy[x]==null||""+this.id1_pxpy[x]=="undefined"){this.id1_pxpy[x]=[];}
if(this.ids_pxpy[x]==null||""+this.ids_pxpy[x]=="undefined"){this.ids_pxpy[x]=[];}
if(this.ocu_pxpy[x]==null||""+this.ocu_pxpy[x]=="undefined"){this.ocu_pxpy[x]=[];}
if(this.rfh_pxpy[x]==null||""+this.rfh_pxpy[x]=="undefined"){this.rfh_pxpy[x]=[];}
if(this.rfv_pxpy[x]==null||""+this.rfv_pxpy[x]=="undefined"){this.rfv_pxpy[x]=[];}
if(this.rot_pxpy[x]==null||""+this.rot_pxpy[x]=="undefined"){this.rot_pxpy[x]=[];}
}
var b:Int; var a:Int =0; while (a < sy)
{
b = y + a;
if(b < 0)
{
if(this.id0_pxny[x][0-b]==null||""+this.id0_pxny[x][0-b]=="undefined"){this.id0_pxny[x][0-b]=this.cur_obj_id0;}
if(this.id1_pxny[x][0-b]==null||""+this.id1_pxny[x][0-b]=="undefined"){this.id1_pxny[x][0-b]=this.cur_obj_id1;}
if(this.ocu_pxny[x][0-b]==null||""+this.ocu_pxny[x][0-b]=="undefined"){this.ocu_pxny[x][0-b]= true;}
if(a == 0)
{
if(this.rfh_pxny[x][0-y]==null||""+this.rfh_pxny[x][0-y]=="undefined"){this.rfh_pxny[x][0-y]=this.randgen_rfh();}
if(this.rfv_pxny[x][0-y]==null||""+this.rfv_pxny[x][0-y]=="undefined"){this.rfv_pxny[x][0-y]=false;}
if(this.rot_pxny[x][0-y]==null||""+this.rot_pxny[x][0-y]=="undefined"){this.rot_pxny[x][0-y]=90;}
}
else if (a == sy -1)
{
if(this.ids_pxny[x][0-b]==null||""+this.ids_pxny[x][0-b]=="undefined"){this.ids_pxny[x][0-b]=this.randgen_wood_end(true);}
if(this.rfh_pxny[x][0-b]==null||""+this.rfh_pxny[x][0-b]=="undefined"){this.rfh_pxny[x][0-b]=this.randgen_rfh();}
if(this.rfv_pxny[x][0-b]==null||""+this.rfv_pxny[x][0-b]=="undefined"){this.rfv_pxny[x][0-b]=false;}
if(this.rot_pxny[x][0-b]==null||""+this.rot_pxny[x][0-b]=="undefined"){this.rot_pxny[x][0-b]=270;}
}
else // bug: this.randgen_ids always comes out wood ends.
{
if(this.ids_pxny[x][0-b]==null||""+this.ids_pxny[x][0-b]=="undefined"){this.ids_pxny[x][0-b]=this.randgen_wood_mid();}
if(this.rfh_pxny[x][0-b]==null||""+this.rfh_pxny[x][0-b]=="undefined"){this.rfh_pxny[x][0-b]=this.randgen_rfh();}
if(this.rfv_pxny[x][0-b]==null||""+this.rfv_pxny[x][0-b]=="undefined"){this.rfv_pxny[x][0-b]=this.randgen_rfh();}
if(this.rot_pxny[x][0-b]==null||""+this.rot_pxny[x][0-b]=="undefined"){this.rot_pxny[x][0-b]=90;}
}
}
else
{
if(this.id0_pxpy[x][b]==null||""+this.id0_pxpy[x][b]=="undefined"){this.id0_pxpy[x][b]=this.cur_obj_id0;}
if(this.id1_pxpy[x][b]==null||""+this.id1_pxpy[x][b]=="undefined"){this.id1_pxpy[x][b]=this.cur_obj_id1;}
if(this.ocu_pxpy[x][b]==null||""+this.ocu_pxpy[x][b]=="undefined"){this.ocu_pxpy[x][b]= true;}
if(a == sy - 1)
{
if(this.ids_pxpy[x][b]==null||""+this.ids_pxpy[x][b]=="undefined"){this.ids_pxpy[x][b]=this.randgen_wood_end(true);}
if(this.rfh_pxpy[x][b]==null||""+this.rfh_pxpy[x][b]=="undefined"){this.rfh_pxpy[x][b]=this.randgen_rfh();}
if(this.rfv_pxpy[x][b]==null||""+this.rfv_pxpy[x][b]=="undefined"){this.rfv_pxpy[x][b]=false;}
if(this.rot_pxpy[x][b]==null||""+this.rot_pxpy[x][b]=="undefined"){this.rot_pxpy[x][b]=270;}
}
else
{
if(this.ids_pxpy[x][b]==null||""+this.ids_pxpy[x][b]=="undefined"){this.ids_pxpy[x][b]=this.randgen_wood_mid();}
if(this.rfh_pxpy[x][b]==null||""+this.rfh_pxpy[x][b]=="undefined"){this.rfh_pxpy[x][b]=this.randgen_rfh();}
if(this.rfv_pxpy[x][b]==null||""+this.rfv_pxpy[x][b]=="undefined"){this.rfv_pxpy[x][b]=this.randgen_rfh();}
if(this.rot_pxpy[x][b]==null||""+this.rot_pxpy[x][b]=="undefined"){this.rot_pxpy[x][b]=90;}
}
}
a = a + 1;
}
this.update_cur_obj_idn();
}
}
else if(sx > 1 && sy == 1) // horizontals
{
this.ids_pxny[x][0-y]= this.randgen_wood_end();
if(this.ids_pxny[x][0-y] != "")
{
var a:Int = 0; var b:Int; while(a < sx)
{
b = x-a;
if(b < 0)
{
if(this.id0_nxny[0-b]==null||""+this.id0_nxny[0-b]=="undefined"){this.id0_nxny[0-b]=[];}
if(this.id1_nxny[0-b]==null||""+this.id1_nxny[0-b]=="undefined"){this.id1_nxny[0-b]=[];}
if(this.ids_nxny[0-b]==null||""+this.ids_nxny[0-b]=="undefined"){this.ids_nxny[0-b]=[];}
if(this.ocu_nxny[0-b]==null||""+this.ocu_nxny[0-b]=="undefined"){this.ocu_nxny[0-b]=[];}
if(this.rfh_nxny[0-b]==null||""+this.rfh_nxny[0-b]=="undefined"){this.rfh_nxny[0-b]=[];}
if(this.rfv_nxny[0-b]==null||""+this.rfv_nxny[0-b]=="undefined"){this.rfv_nxny[0-b]=[];}
if(this.rot_nxny[0-b]==null||""+this.rot_nxny[0-b]=="undefined"){this.rot_nxny[0-b]=[];}
if(this.id0_nxny[0-b][0-y]==null||""+this.id0_nxny[0-b][0-y]=="undefined"){this.id0_nxny[0-b][0-y]=this.cur_obj_id0;}
if(this.id1_nxny[0-b][0-y]==null||""+this.id1_nxny[0-b][0-y]=="undefined"){this.id1_nxny[0-b][0-y]=this.cur_obj_id1;}
if(this.ocu_nxny[0-b][0-y]==null||""+this.ocu_nxny[0-b][0-y]=="undefined"){this.ocu_nxny[0-b][0-y]=true;}
if(a == sx -1)
{
if(this.ids_nxny[0-b][0-y]==null||""+this.ids_nxny[0-b][0-y]=="undefined"){this.ids_nxny[0-b][0-y]=this.randgen_wood_end(true);}
if(this.rfh_nxny[0-b][0-y]==null||""+this.rfh_nxny[0-b][0-y]=="undefined"){this.rfh_nxny[0-b][0-y]=this.randgen_rfh();}
if(this.rfv_nxny[0-b][0-y]==null||""+this.rfv_nxny[0-b][0-y]=="undefined"){this.rfv_nxny[0-b][0-y]=false;}
if(this.rot_nxny[0-b][0-y]==null||""+this.rot_nxny[0-b][0-y]=="undefined"){this.rot_nxny[0-b][0-y]=0;}
}
else
{
if(this.ids_nxny[0-b][0-y]==null||""+this.ids_nxny[0-b][0-y]=="undefined"){this.ids_nxny[0-b][0-y]=this.randgen_wood_mid();}
if(this.rfh_nxny[0-b][0-y]==null||""+this.rfh_nxny[0-b][0-y]=="undefined"){this.rfh_nxny[0-b][0-y]=this.randgen_rfh();}
if(this.rfv_nxny[0-b][0-y]==null||""+this.rfv_nxny[0-b][0-y]=="undefined"){this.rfv_nxny[0-b][0-y]=this.randgen_rfh();}
if(this.rot_nxny[0-b][0-y]==null||""+this.rot_nxny[0-b][0-y]=="undefined"){this.rot_nxny[0-b][0-y]=0;}
}
}
else
{
if(this.id0_pxny[b]==null||""+this.id0_pxny[b]=="undefined"){this.id0_pxny[b]=[];}
if(this.id1_pxny[b]==null||""+this.id1_pxny[b]=="undefined"){this.id1_pxny[b]=[];}
if(this.ids_pxny[b]==null||""+this.ids_pxny[b]=="undefined"){this.ids_pxny[b]=[];}
if(this.ocu_pxny[b]==null||""+this.ocu_pxny[b]=="undefined"){this.ocu_pxny[b]=[];}
if(this.rfh_pxny[b]==null||""+this.rfh_pxny[b]=="undefined"){this.rfh_pxny[b]=[];}
if(this.rfv_pxny[b]==null||""+this.rfv_pxny[b]=="undefined"){this.rfv_pxny[b]=[];}
if(this.rot_pxny[b]==null||""+this.rot_pxny[b]=="undefined"){this.rot_pxny[b]=[];}
if(this.id0_pxny[b][0-y]==null||""+this.id0_pxny[b][0-y]=="undefined"){this.id0_pxny[b][0-y]=this.cur_obj_id0;}
if(this.id1_pxny[b][0-y]==null||""+this.id1_pxny[b][0-y]=="undefined"){this.id1_pxny[b][0-y]=this.cur_obj_id1;}
if(this.ocu_pxny[b][0-y]==null||""+this.ocu_pxny[b][0-y]=="undefined"){this.ocu_pxny[b][0-y]=true;}
if(a == 0) // right end
{
if(this.rfh_pxny[x][0-y]==null||""+this.rfh_pxny[x][0-y]=="undefined"){this.rfh_pxny[x][0-y]=this.randgen_rfh();}
if(this.rfv_pxny[x][0-y]==null||""+this.rfv_pxny[x][0-y]=="undefined"){this.rfv_pxny[x][0-y]=false;}
if(this.rot_pxny[x][0-y]==null||""+this.rot_pxny[x][0-y]=="undefined"){this.rot_pxny[x][0-y]=180;}
}
else if (a == sx -1) // left end
{
if(this.ids_pxny[b][0-y]==null||""+this.ids_pxny[b][0-y]=="undefined"){this.ids_pxny[b][0-y]=this.randgen_wood_end(true);}
if(this.rfh_pxny[b][0-y]==null||""+this.rfh_pxny[b][0-y]=="undefined"){this.rfh_pxny[b][0-y]=this.randgen_rfh();}
if(this.rfv_pxny[b][0-y]==null||""+this.rfv_pxny[b][0-y]=="undefined"){this.rfv_pxny[b][0-y]=false;}
if(this.rot_pxny[b][0-y]==null||""+this.rot_pxny[b][0-y]=="undefined"){this.rot_pxny[b][0-y]=0;}
}
else
{
if(this.ids_pxny[b][0-y]==null||""+this.ids_pxny[b][0-y]=="undefined"){this.ids_pxny[b][0-y]=this.randgen_wood_mid();}
if(this.rfh_pxny[b][0-y]==null||""+this.rfh_pxny[b][0-y]=="undefined"){this.rfh_pxny[b][0-y]=this.randgen_rfh();}
if(this.rfv_pxny[b][0-y]==null||""+this.rfv_pxny[b][0-y]=="undefined"){this.rfv_pxny[b][0-y]=this.randgen_rfh();}
if(this.rot_pxny[b][0-y]==null||""+this.rot_pxny[b][0-y]=="undefined"){this.rot_pxny[b][0-y]=0;}
}
}
a = a+1;
}
this.update_cur_obj_idn();
}
}
else if(sx > 1 && sy > 1)// rnx for pxny. size > 1 for both dimensions - bug : the wood is not created in unoccupied zone however, all actors are registered.
{
this.ids_pxny[x][0-y] = this.randgen_wood_corner();
if(this.ids_pxny[x][0-y] != ""){this.sub_rnx_data_mt(x,y,sx,sy); this.update_cur_obj_idn();}
}
}
at = Object_types.get_obj_at(this.ids_pxny[x][0-y]);
id0 = this.id0_pxny[x][0-y]; id1 = this.id1_pxny[x][0-y];
rfh = this.rfh_pxny[x][0-y]; rfv = this.rfv_pxny[x][0-y];
rot = this.rot_pxny[x][0-y];
}
else
{
if(this.id0_pxpy[x]==null||""+this.id0_pxpy[x]=="undefined"){this.id0_pxpy[x]=[];}
if(this.id1_pxpy[x]==null||""+this.id1_pxpy[x]=="undefined"){this.id1_pxpy[x]=[];}
if(this.ids_pxpy[x]==null||""+this.ids_pxpy[x]=="undefined"){this.ids_pxpy[x]=[];}
if(this.ocu_pxpy[x]==null||""+this.ocu_pxpy[x]=="undefined"){this.ocu_pxpy[x]=[];}
if(this.rfh_pxpy[x]==null||""+this.rfh_pxpy[x]=="undefined"){this.rfh_pxpy[x]=[];}
if(this.rfv_pxpy[x]==null||""+this.rfv_pxpy[x]=="undefined"){this.rfv_pxpy[x]=[];}
if(this.rot_pxpy[x]==null||""+this.rot_pxpy[x]=="undefined"){this.rot_pxpy[x]=[];}
if(this.ids_pxpy[x][y]==null||""+this.ids_pxpy[x][y]=="undefined")
{
sx = 1 + Std.int(Math.floor(Math.random()*3.99)); sy = 1 + Std.int(Math.floor(Math.random()* 3.99));
if(this.cek_ocu(x,y+1)){sy = 1;}
else if (this.cek_ocu(x,y+2)){sy = Std.int(Math.min(2,sy));}
else if (this.cek_ocu(x,y+3)){sy = Std.int(Math.min(3,sy));}
if(sx == 1 && sy == 1)
{
this.ids_pxpy[x][y] = this.randgen_wood_1t();
if(this.ids_pxpy[x][y]!=null)
{
if(this.id0_pxpy[x][y]==null ||""+this.id0_pxpy[x][y]=="undefined"){this.id0_pxpy[x][y]=this.cur_obj_id0;}
if(this.id1_pxpy[x][y]==null ||""+this.id1_pxpy[x][y]=="undefined"){this.id1_pxpy[x][y]=this.cur_obj_id1;}
if(this.ocu_pxpy[x][y]==null ||""+this.ocu_pxpy[x][y]=="undefined"){this.ocu_pxpy[x][y]=true;}
if(this.rfh_pxpy[x][y]==null ||""+this.rfh_pxpy[x][y]=="undefined"){this.rfh_pxpy[x][y]=this.randgen_rfh();}
if(this.rfv_pxpy[x][y]==null ||""+this.rfv_pxpy[x][y]=="undefined"){this.rfv_pxpy[x][y]=this.randgen_rfh();}
if(this.rot_pxpy[x][y]==null ||""+this.rot_pxpy[x][y]=="undefined"){this.rot_pxpy[x][y]=this.randgen_rot();}
this.update_cur_obj_idn();
}
}
else if(sx == 1 && sy > 1) // vertical
{
this.ids_pxpy[x][y] = this.randgen_wood_end();
if(this.ids_pxpy[x][y] != "")
{
var a:Int =0, b:Int; while(a < sy)
{
b = y + a;
if(this.id0_pxpy[x][b] == null ||""+this.id0_pxpy[x][b] == "undefined"){this.id0_pxpy[x][b] = this.cur_obj_id0;}
if(this.id1_pxpy[x][b] == null ||""+this.id1_pxpy[x][b] == "undefined"){this.id1_pxpy[x][b] = this.cur_obj_id1;}
if(this.ocu_pxpy[x][b] == null ||""+this.ocu_pxpy[x][b] == "undefined"){this.ocu_pxpy[x][b] = true;}
if(a == 0) // upper end
{
if(this.rfh_pxpy[x][y]==null ||""+this.rfh_pxpy[x][y]=="undefined"){this.rfh_pxpy[x][y] = this.randgen_rfh();}
if(this.rfv_pxpy[x][y]==null ||""+this.rfv_pxpy[x][y]=="undefined"){this.rfv_pxpy[x][y] = false; }
if(this.rot_pxpy[x][y]==null ||""+this.rot_pxpy[x][y]=="undefined"){this.rot_pxpy[x][y] = 90;}
}
else if (a == sy -1) // lower end
{
if(this.ids_pxpy[x][b]==null ||""+this.ids_pxpy[x][b]=="undefined"){this.ids_pxpy[x][b] = this.randgen_wood_end(true);}
if(this.rfh_pxpy[x][b]==null ||""+this.rfh_pxpy[x][b]=="undefined"){this.rfh_pxpy[x][b] = this.randgen_rfh();}
if(this.rfv_pxpy[x][b]==null ||""+this.rfv_pxpy[x][b]=="undefined"){this.rfv_pxpy[x][b] = false; }
if(this.rot_pxpy[x][b]==null ||""+this.rot_pxpy[x][b]=="undefined"){this.rot_pxpy[x][b] = 270;}
}
else // middle part
{
if(this.ids_pxpy[x][b]==null ||""+this.ids_pxpy[x][b]=="undefined"){this.ids_pxpy[x][b] = this.randgen_wood_mid();}
if(this.rfh_pxpy[x][b]==null ||""+this.rfh_pxpy[x][b]=="undefined"){this.rfh_pxpy[x][b] = this.randgen_rfh();}
if(this.rfv_pxpy[x][b]==null ||""+this.rfv_pxpy[x][b]=="undefined"){this.rfv_pxpy[x][b] = false; }
if(this.rot_pxpy[x][b]==null ||""+this.rot_pxpy[x][b]=="undefined"){this.rot_pxpy[x][b] = 90;}
}
a = a + 1;
}
this.update_cur_obj_idn();
}
}
else if(sx > 1 && sy == 1) // horizontal
{
this.ids_pxpy[x][y] = this.randgen_wood_end();
if(this.ids_pxpy[x][y] != "")
{
var a:Int = 0; var b:Int; while (a < sx)
{
b = x - a;
if(b < 0)
{
if(this.id0_nxpy[0-b]==null ||""+this.id0_nxpy[0-b]=="undefined"){this.id0_nxpy[0-b] = [];}
if(this.id1_nxpy[0-b]==null ||""+this.id1_nxpy[0-b]=="undefined"){this.id1_nxpy[0-b] = [];}
if(this.ids_nxpy[0-b]==null ||""+this.ids_nxpy[0-b]=="undefined"){this.ids_nxpy[0-b] = [];}
if(this.ocu_nxpy[0-b]==null ||""+this.ocu_nxpy[0-b]=="undefined"){this.ocu_nxpy[0-b] = [];}
if(this.rfh_nxpy[0-b]==null ||""+this.rfh_nxpy[0-b]=="undefined"){this.rfh_nxpy[0-b] = [];}
if(this.rfv_nxpy[0-b]==null ||""+this.rfv_nxpy[0-b]=="undefined"){this.rfv_nxpy[0-b] = [];}
if(this.rot_nxpy[0-b]==null ||""+this.rot_nxpy[0-b]=="undefined"){this.rot_nxpy[0-b] = [];}
if(this.id0_nxpy[0-b][y]==null ||""+this.id0_nxpy[0-b][y]=="undefined"){this.id0_nxpy[0-b][y] = this.cur_obj_id0;}
if(this.id1_nxpy[0-b][y]==null ||""+this.id1_nxpy[0-b][y]=="undefined"){this.id1_nxpy[0-b][y] = this.cur_obj_id1;}
if(this.ocu_nxpy[0-b][y]==null ||""+this.ocu_nxpy[0-b][y]=="undefined"){this.ocu_nxpy[0-b][y] = true;}
if(a == sx -1) // left end
{
if(this.ids_nxpy[0-b][y]==null ||""+this.ids_nxpy[0-b][y]=="undefined"){this.ids_nxpy[0-b][y]= this.randgen_wood_end(true);}
if(this.rfh_nxpy[0-b][y]==null ||""+this.rfh_nxpy[0-b][y]=="undefined"){this.rfh_nxpy[0-b][y]= this.randgen_rfh();}
if(this.rfv_nxpy[0-b][y]==null ||""+this.rfv_nxpy[0-b][y]=="undefined"){this.rfv_nxpy[0-b][y]= false;}
if(this.rot_nxpy[0-b][y]==null ||""+this.rot_nxpy[0-b][y]=="undefined"){this.rot_nxpy[0-b][y]= 0;}
}
else // middle
{
if(this.ids_nxpy[0-b][y]==null ||""+this.ids_nxpy[0-b][y]=="undefined"){this.ids_nxpy[0-b][y]= this.randgen_wood_mid();}
if(this.rfh_nxpy[0-b][y]==null ||""+this.rfh_nxpy[0-b][y]=="undefined"){this.rfh_nxpy[0-b][y]= this.randgen_rfh();}
if(this.rfv_nxpy[0-b][y]==null ||""+this.rfv_nxpy[0-b][y]=="undefined"){this.rfv_nxpy[0-b][y]= this.randgen_rfh();}
if(this.rot_nxpy[0-b][y]==null ||""+this.rot_nxpy[0-b][y]=="undefined"){this.rot_nxpy[0-b][y]= 0;}
}
}
else
{
if(this.id0_pxpy[b]==null ||""+this.id0_pxpy[b]=="undefined"){this.id0_pxpy[b] = [];}
if(this.id1_pxpy[b]==null ||""+this.id1_pxpy[b]=="undefined"){this.id1_pxpy[b] = [];}
if(this.ids_pxpy[b]==null ||""+this.ids_pxpy[b]=="undefined"){this.ids_pxpy[b] = [];}
if(this.ocu_pxpy[b]==null ||""+this.ocu_pxpy[b]=="undefined"){this.ocu_pxpy[b] = [];}
if(this.rfh_pxpy[b]==null ||""+this.rfh_pxpy[b]=="undefined"){this.rfh_pxpy[b] = [];}
if(this.rfv_pxpy[b]==null ||""+this.rfv_pxpy[b]=="undefined"){this.rfv_pxpy[b] = [];}
if(this.rot_pxpy[b]==null ||""+this.rot_pxpy[b]=="undefined"){this.rot_pxpy[b] = [];}
if(this.id0_pxpy[b][y]==null ||""+this.id0_pxpy[b][y]=="undefined"){this.id0_pxpy[b][y] = this.cur_obj_id0;}
if(this.id1_pxpy[b][y]==null ||""+this.id1_pxpy[b][y]=="undefined"){this.id1_pxpy[b][y] = this.cur_obj_id1;}
if(this.ocu_pxpy[b][y]==null ||""+this.ocu_pxpy[b][y]=="undefined"){this.ocu_pxpy[b][y] = true;}
if(a == 0)
{
if(this.rfh_pxpy[x][y]==null ||""+this.rfh_pxpy[x][y]=="undefined"){this.rfh_pxpy[x][y]= this.randgen_rfh();}
if(this.rfv_pxpy[x][y]==null ||""+this.rfv_pxpy[x][y]=="undefined"){this.rfv_pxpy[x][y]= false; }
if(this.rot_pxpy[x][y]==null ||""+this.rot_pxpy[x][y]=="undefined"){this.rot_pxpy[x][y]= 180;}
}
else if(a == sx -1) // bugs.
{
if(this.ids_pxpy[b][y]==null ||""+this.ids_pxpy[b][y]=="undefined"){this.ids_pxpy[b][y]= this.randgen_wood_end(true);}
if(this.rfh_pxpy[b][y]==null ||""+this.rfh_pxpy[b][y]=="undefined"){this.rfh_pxpy[b][y]= this.randgen_rfh();}
if(this.rfv_pxpy[b][y]==null ||""+this.rfv_pxpy[b][y]=="undefined"){this.rfv_pxpy[b][y]= false;}
if(this.rot_pxpy[b][y]==null ||""+this.rot_pxpy[b][y]=="undefined"){this.rot_pxpy[b][y]= 0;}
}
else
{
if(this.ids_pxpy[b][y]==null ||""+this.ids_pxpy[b][y]=="undefined"){this.ids_pxpy[b][y]= this.randgen_wood_mid();}
if(this.rfh_pxpy[b][y]==null ||""+this.rfh_pxpy[b][y]=="undefined"){this.rfh_pxpy[b][y]= this.randgen_rfh();}
if(this.rfv_pxpy[b][y]==null ||""+this.rfv_pxpy[b][y]=="undefined"){this.rfv_pxpy[b][y]= this.randgen_rfh();}
if(this.rot_pxpy[b][y]==null ||""+this.rot_pxpy[b][y]=="undefined"){this.rot_pxpy[b][y]= 0;}
}
}
a = a + 1;
}
this.update_cur_obj_idn();
}
}
else // sx >1 and sy > 1
{
this.ids_pxpy[x][y] = this.randgen_wood_corner();
if(this.ids_pxpy[x][y] != ""){this.sub_rnx_data_mt(x,y,sx,sy); this.update_cur_obj_idn(); }
}
}
at = Object_types.get_obj_at(this.ids_pxpy[x][y]);
id0 = this.id0_pxpy[x][y]; id1 = this.id1_pxpy[x][y];
rfh = this.rfh_pxpy[x][y]; rfv = this.rfv_pxpy[x][y];
rot = this.rot_pxpy[x][y];
}
// create actors
if(at != null && ""+at != "undefined")
{
create_x = this.half_scew + x* 64 - this.offsx; create_y = this.half_sceh + y*64 - this.offsy;
this.create_actor(at,create_x, create_y);
this.actors[x][y] = this.last_created_actor;
this.actors[x][y].spinTo(rot,0,null);
if(rfh){this.actors[x][y].growTo(1,-1,0,null);} // axis based flipping
if(rfv){this.actors[x][y].growTo(-1,1,0,null);}
this.actors[x][y].setValue("Object_behav","id0",id0);
this.actors[x][y].setValue("Object_behav","id1",id1);
}
y = y+1;
}
}
}
public function rny(y:Int,xmax:Int,xmin:Int):Void
{ var x:Int = xmin; var id0:Int =0, id1:Int =0; var at:ActorType = null; var rfh:Bool = false, rfv:Bool = false; var rot:Float = 0;
var create_x:Float = 0, create_y:Float =0;
var sx:Int=1; var sy:Int = 1; var at:ActorType = null;
if(y < 0)
{
while(x < xmax)
{
if(this.actors[x] == null ||""+this.actors[x] == "undefined") {this.actors[x] = [];}
if(x < 0)
{
if(this.id0_nxny[0-x]==null||""+this.id0_nxny[0-x]=="undefined"){this.id0_nxny[0-x]=[];}
if(this.id1_nxny[0-x]==null||""+this.id1_nxny[0-x]=="undefined"){this.id1_nxny[0-x]=[];}
if(this.ids_nxny[0-x]==null||""+this.ids_nxny[0-x]=="undefined"){this.ids_nxny[0-x]=[];}
if(this.ocu_nxny[0-x]==null||""+this.ocu_nxny[0-x]=="undefined"){this.ocu_nxny[0-x]=[];}
if(this.rfh_nxny[0-x]==null||""+this.rfh_nxny[0-x]=="undefined"){this.rfh_nxny[0-x]=[];}
if(this.rfv_nxny[0-x]==null||""+this.rfv_nxny[0-x]=="undefined"){this.rfv_nxny[0-x]=[];}
if(this.rot_nxny[0-x]==null||""+this.rot_nxny[0-x]=="undefined"){this.rot_nxny[0-x]=[];}
if(this.ids_nxny[0-x][0-y]==null||""+this.ids_nxny[0-x][0-y]=="undefined") // undefined actor creation.
{
sx = 1 + Std.int(Math.floor(Math.random() * 3.99)); sy = 1 + Std.int(Math.floor(Math.random() * 3.99));
if(this.cek_ocu(x,y-1)){sy = 1;}
else if(cek_ocu(x,y-2)){sy = Std.int(Math.min(sy,2));}
else if(cek_ocu(x,y-3)){sy = Std.int(Math.min(sy,3));}
if(this.cek_ocu(x+1,y)){sx = 1;}
else if(cek_ocu(x+2,y)){sx = Std.int(Math.min(sx,2));}
else if(cek_ocu(x+3,y)){sx = Std.int(Math.min(sx,3));}
if(sx == 1 && sy == 1)
{
this.ids_nxny[0-x][0-y] = this.randgen_wood_1t();
if(this.ids_nxny[0-x][0-y] != "")
{
if(this.id0_nxny[0-x][0-y]==null||""+this.id0_nxny[0-x][0-y]=="undefined"){this.id0_nxny[0-x][0-y]=this.cur_obj_id0;}
if(this.id1_nxny[0-x][0-y]==null||""+this.id1_nxny[0-x][0-y]=="undefined"){this.id1_nxny[0-x][0-y]=this.cur_obj_id1;}
if(this.ocu_nxny[0-x][0-y]==null||""+this.ocu_nxny[0-x][0-y]=="undefined"){this.ocu_nxny[0-x][0-y]=true;}
if(this.rfh_nxny[0-x][0-y]==null||""+this.rfh_nxny[0-x][0-y]=="undefined"){this.rfh_nxny[0-x][0-y]=this.randgen_rfh();}
if(this.rfv_nxny[0-x][0-y]==null||""+this.rfv_nxny[0-x][0-y]=="undefined"){this.rfv_nxny[0-x][0-y]=this.randgen_rfh();}
if(this.rot_nxny[0-x][0-y]==null||""+this.rot_nxny[0-x][0-y]=="undefined"){this.rot_nxny[0-x][0-y]=this.randgen_rot();}
this.update_cur_obj_idn();
}
}
else if(sx == 1 && sy > 1) // verti9cal
{
this.ids_nxny[0-x][0-y]= this.randgen_wood_end(); // it affects the entire creation.
if(this.ids_nxny[0-x][0-y] != "")
{
var a:Int = 0; var b:Int; while(a < sy)
{ b = y - a; // rendering upwards
if(this.id0_nxny[0-x][0-b]==null ||""+this.id0_nxny[0-x][0-b]=="undefined"){this.id0_nxny[0-x][0-b]= this.cur_obj_id0;}
if(this.id1_nxny[0-x][0-b]==null ||""+this.id1_nxny[0-x][0-b]=="undefined"){this.id1_nxny[0-x][0-b]= this.cur_obj_id1;}
if(this.ocu_nxny[0-x][0-b]==null ||""+this.ocu_nxny[0-x][0-b]=="undefined"){this.ocu_nxny[0-x][0-b]= true;}
if(a == 0)
{
if(this.rfh_nxny[0-x][0-y]== null ||""+this.rfh_nxny[0-x][0-y]=="undefined"){this.rfh_nxny[0-x][0-y] = this.randgen_rfh();}
if(this.rfv_nxny[0-x][0-y]== null ||""+this.rfv_nxny[0-x][0-y]=="undefined"){this.rfv_nxny[0-x][0-y] = false;}
if(this.rot_nxny[0-x][0-y]== null ||""+this.rot_nxny[0-x][0-y]=="undefined"){this.rot_nxny[0-x][0-y] = 270;}
}
else if (a == sy -1)
{
if(this.ids_nxny[0-x][0-b]== null ||""+this.ids_nxny[0-x][0-b]=="undefined"){this.ids_nxny[0-x][0-b] = this.randgen_wood_end(true);}
if(this.rfh_nxny[0-x][0-b]== null ||""+this.rfh_nxny[0-x][0-b]=="undefined"){this.rfh_nxny[0-x][0-b] = this.randgen_rfh();}
if(this.rfv_nxny[0-x][0-b]== null ||""+this.rfv_nxny[0-x][0-b]=="undefined"){this.rfv_nxny[0-x][0-b] = false;}
if(this.rot_nxny[0-x][0-b]== null ||""+this.rot_nxny[0-x][0-b]=="undefined"){this.rot_nxny[0-x][0-b] = 90;}
}
else
{
if(this.ids_nxny[0-x][0-b]== null ||""+this.ids_nxny[0-x][0-b]=="undefined"){this.ids_nxny[0-x][0-b] = this.randgen_wood_mid();}
if(this.rfh_nxny[0-x][0-b]== null ||""+this.rfh_nxny[0-x][0-b]=="undefined"){this.rfh_nxny[0-x][0-b] = this.randgen_rfh();}
if(this.rfv_nxny[0-x][0-b]== null ||""+this.rfv_nxny[0-x][0-b]=="undefined"){this.rfv_nxny[0-x][0-b] = this.randgen_rfh();}
if(this.rot_nxny[0-x][0-b]== null ||""+this.rot_nxny[0-x][0-b]=="undefined"){this.rot_nxny[0-x][0-b] = 90;}
}
a = a + 1;
}
this.update_cur_obj_idn();
}
}
else if(sx > 1 && sy == 1) // horizontal
{
this.ids_nxny[0-x][0-y] = this.randgen_wood_end();
{
if(this.ids_nxny[0-x][0-y] !="")
{
var a:Int = 0; var b:Int; while(a < sx)
{ b = x + a; // rendering to the right.
if(b < 0)
{
if(this.id0_nxny[0-b]==null ||""+this.id0_nxny[0-b]=="undefined"){this.id0_nxny[0-b]=[];}
if(this.id1_nxny[0-b]==null ||""+this.id1_nxny[0-b]=="undefined"){this.id1_nxny[0-b]=[];}
if(this.ids_nxny[0-b]==null ||""+this.ids_nxny[0-b]=="undefined"){this.ids_nxny[0-b]=[];}
if(this.ocu_nxny[0-b]==null ||""+this.ocu_nxny[0-b]=="undefined"){this.ocu_nxny[0-b]=[];}
if(this.rfh_nxny[0-b]==null ||""+this.rfh_nxny[0-b]=="undefined"){this.rfh_nxny[0-b]=[];}
if(this.rfv_nxny[0-b]==null ||""+this.rfv_nxny[0-b]=="undefined"){this.rfv_nxny[0-b]=[];}
if(this.rot_nxny[0-b]==null ||""+this.rot_nxny[0-b]=="undefined"){this.rot_nxny[0-b]=[];}
if(this.id0_nxny[0-b][0-y]==null ||""+this.id0_nxny[0-b][0-y]=="undefined"){this.id0_nxny[0-b][0-y]= this.cur_obj_id0;}
if(this.id1_nxny[0-b][0-y]==null ||""+this.id1_nxny[0-b][0-y]=="undefined"){this.id1_nxny[0-b][0-y]= this.cur_obj_id1;}
if(this.ocu_nxny[0-b][0-y]==null ||""+this.ocu_nxny[0-b][0-y]=="undefined"){this.ocu_nxny[0-b][0-y]= true;}
if(a == 0)
{
if(this.rfh_nxny[0-x][0-y]== null ||""+this.rfh_nxny[0-x][0-y]=="undefined"){this.rfh_nxny[0-x][0-y] = this.randgen_rfh();}
if(this.rfv_nxny[0-x][0-y]== null ||""+this.rfv_nxny[0-x][0-y]=="undefined"){this.rfv_nxny[0-x][0-y] = false;}
if(this.rot_nxny[0-x][0-y]== null ||""+this.rot_nxny[0-x][0-y]=="undefined"){this.rot_nxny[0-x][0-y] = 0;}
}
else if (a == sx -1)
{
if(this.ids_nxny[0-b][0-y]== null ||""+this.ids_nxny[0-b][0-y]=="undefined"){this.ids_nxny[0-b][0-y] = this.randgen_wood_end(true);}
if(this.rfh_nxny[0-b][0-y]== null ||""+this.rfh_nxny[0-b][0-y]=="undefined"){this.rfh_nxny[0-b][0-y] = this.randgen_rfh();}
if(this.rfv_nxny[0-b][0-y]== null ||""+this.rfv_nxny[0-b][0-y]=="undefined"){this.rfv_nxny[0-b][0-y] = false;}
if(this.rot_nxny[0-b][0-y]== null ||""+this.rot_nxny[0-b][0-y]=="undefined"){this.rot_nxny[0-b][0-y] = 180;}
}
else
{
if(this.ids_nxny[0-b][0-y]== null ||""+this.ids_nxny[0-b][0-y]=="undefined"){this.ids_nxny[0-b][0-y] = this.randgen_wood_mid();}
if(this.rfh_nxny[0-b][0-y]== null ||""+this.rfh_nxny[0-b][0-y]=="undefined"){this.rfh_nxny[0-b][0-y] = this.randgen_rfh();}
if(this.rfv_nxny[0-b][0-y]== null ||""+this.rfv_nxny[0-b][0-y]=="undefined"){this.rfv_nxny[0-b][0-y] = this.randgen_rfh();}
if(this.rot_nxny[0-b][0-y]== null ||""+this.rot_nxny[0-b][0-y]=="undefined"){this.rot_nxny[0-b][0-y] = 0;}
}
}
else
{
if(this.id0_pxny[b]==null ||""+this.id0_pxny[b]=="undefined"){this.id0_pxny[b]=[];}
if(this.id1_pxny[b]==null ||""+this.id1_pxny[b]=="undefined"){this.id1_pxny[b]=[];}
if(this.ids_pxny[b]==null ||""+this.ids_pxny[b]=="undefined"){this.ids_pxny[b]=[];}
if(this.ocu_pxny[b]==null ||""+this.ocu_pxny[b]=="undefined"){this.ocu_pxny[b]=[];}
if(this.rfh_pxny[b]==null ||""+this.rfh_pxny[b]=="undefined"){this.rfh_pxny[b]=[];}
if(this.rfv_pxny[b]==null ||""+this.rfv_pxny[b]=="undefined"){this.rfv_pxny[b]=[];}
if(this.rot_pxny[b]==null ||""+this.rot_pxny[b]=="undefined"){this.rot_pxny[b]=[];}
if(this.id0_pxny[b][0-y]==null ||""+this.id0_pxny[b][0-y]=="undefined"){this.id0_pxny[b][0-y]= this.cur_obj_id0;}
if(this.id1_pxny[b][0-y]==null ||""+this.id1_pxny[b][0-y]=="undefined"){this.id1_pxny[b][0-y]= this.cur_obj_id1;}
if(this.ocu_pxny[b][0-y]==null ||""+this.ocu_pxny[b][0-y]=="undefined"){this.ocu_pxny[b][0-y]= true;}
if (a == sx -1)
{
if(this.ids_pxny[b][0-y]== null ||""+this.ids_pxny[b][0-y]=="undefined"){this.ids_pxny[b][0-y] = this.randgen_wood_end(true);}
if(this.rfh_pxny[b][0-y]== null ||""+this.rfh_pxny[b][0-y]=="undefined"){this.rfh_pxny[b][0-y] = this.randgen_rfh();}
if(this.rfv_pxny[b][0-y]== null ||""+this.rfv_pxny[b][0-y]=="undefined"){this.rfv_pxny[b][0-y] = false;}
if(this.rot_pxny[b][0-y]== null ||""+this.rot_pxny[b][0-y]=="undefined"){this.rot_pxny[b][0-y] = 180;}
}
else
{
if(this.ids_pxny[b][0-y]== null ||""+this.ids_pxny[b][0-y]=="undefined"){this.ids_pxny[b][0-y] = this.randgen_wood_mid();}
if(this.rfh_pxny[b][0-y]== null ||""+this.rfh_pxny[b][0-y]=="undefined"){this.rfh_pxny[b][0-y] = this.randgen_rfh();}
if(this.rfv_pxny[b][0-y]== null ||""+this.rfv_pxny[b][0-y]=="undefined"){this.rfv_pxny[b][0-y] = this.randgen_rfh();}
if(this.rot_pxny[b][0-y]== null ||""+this.rot_pxny[b][0-y]=="undefined"){this.rot_pxny[b][0-y] = 0;}
}
}
a = a+1;
}
this.update_cur_obj_idn();
}
}
}
else //sx > 1 and sy > 1
{
this.ids_nxny[0-x][0-y] = this.randgen_wood_corner();
if(this.ids_nxny[0-x][0-y] != ""){this.sub_rny_data_mt(x,y,sx,sy); this.update_cur_obj_idn();}
}
}
at = Object_types.get_obj_at(this.ids_nxny[0-x][0-y]);
id0 = this.id0_nxny[0-x][0-y]; id1 = this.id1_nxny[0-x][0-y];
rfh = this.rfh_nxny[0-x][0-y]; rfv = this.rfv_nxny[0-x][0-y];
rot = this.rot_nxny[0-x][0-y];
}
else // pxny
{
if(this.id0_pxny[x]==null||""+this.id0_pxny[x]=="undefined"){this.id0_pxny[x]=[];}
if(this.id1_pxny[x]==null||""+this.id1_pxny[x]=="undefined"){this.id1_pxny[x]=[];}
if(this.ids_pxny[x]==null||""+this.ids_pxny[x]=="undefined"){this.ids_pxny[x]=[];}
if(this.ocu_pxny[x]==null||""+this.ocu_pxny[x]=="undefined"){this.ocu_pxny[x]=[];}
if(this.rfh_pxny[x]==null||""+this.rfh_pxny[x]=="undefined"){this.rfh_pxny[x]=[];}
if(this.rfv_pxny[x]==null||""+this.rfv_pxny[x]=="undefined"){this.rfv_pxny[x]=[];}
if(this.rot_pxny[x]==null||""+this.rot_pxny[x]=="undefined"){this.rot_pxny[x]=[];}
if(this.ids_pxny[x][0-y]==null||""+this.ids_pxny[x][0-y]=="undefined")
{
sx = 1 + Std.int(Math.floor(Math.random() * 3.99)); sy = 1 + Std.int(Math.floor(Math.random() * 3.99));
if(this.cek_ocu(x,y-1)){sy = 1;}
else if(cek_ocu(x,y-2)){sy = Std.int(Math.min(sy,2));}
else if(cek_ocu(x,y-3)){sy = Std.int(Math.min(sy,3));}
if(this.cek_ocu(x+1,y)){sx = 1;}
else if(cek_ocu(x+2,y)){sx = Std.int(Math.min(sx,2));}
else if(cek_ocu(x+3,y)){sx = Std.int(Math.min(sx,3));}
if(sx == 1 && sy == 1)
{
this.ids_pxny[x][0-y] = this.randgen_wood_1t();
if(this.ids_pxny[x][0-y] != "")
{
if(this.id0_pxny[x][0-y] == null ||""+this.id0_pxny[x][0-y]=="undefined"){this.id0_pxny[x][0-y] = this.cur_obj_id0;}
if(this.id1_pxny[x][0-y] == null ||""+this.id1_pxny[x][0-y]=="undefined"){this.id1_pxny[x][0-y] = this.cur_obj_id1;}
if(this.ocu_pxny[x][0-y] == null ||""+this.ocu_pxny[x][0-y]=="undefined"){this.ocu_pxny[x][0-y] = true;}
if(this.rfh_pxny[x][0-y] == null ||""+this.rfh_pxny[x][0-y]=="undefined"){this.rfh_pxny[x][0-y] = this.randgen_rfh();}
if(this.rfv_pxny[x][0-y] == null ||""+this.rfv_pxny[x][0-y]=="undefined"){this.rfv_pxny[x][0-y] = this.randgen_rfh();}
if(this.rot_pxny[x][0-y] == null ||""+this.rot_pxny[x][0-y]=="undefined"){this.rot_pxny[x][0-y] = this.randgen_rot();}
this.update_cur_obj_idn();
}
}
else if (sx == 1 && sy > 1) // vertical renders upwards
{
this.ids_pxny[x][0-y] = this.randgen_wood_end();
if(this.ids_pxny[x][0-y] != "")
{
var a:Int =0, b:Int; while(a < sy)
{
b = y-a;
if(this.id0_pxny[x][0-b] == null ||""+this.id0_pxny[x][0-b]=="undefined"){this.id0_pxny[x][0-b]= this.cur_obj_id0;}
if(this.id1_pxny[x][0-b] == null ||""+this.id1_pxny[x][0-b]=="undefined"){this.id1_pxny[x][0-b]= this.cur_obj_id1;}
if(this.ocu_pxny[x][0-b] == null ||""+this.ocu_pxny[x][0-b]=="undefined"){this.ocu_pxny[x][0-b]= true;}
if(a == 0)
{
if(this.rfh_pxny[x][0-y]== null ||""+this.rfh_pxny[x][0-y]=="undefined"){this.rfh_pxny[x][0-y] = this.randgen_rfh();}
if(this.rfv_pxny[x][0-y]== null ||""+this.rfv_pxny[x][0-y]=="undefined"){this.rfv_pxny[x][0-y] = false;}
if(this.rot_pxny[x][0-y]== null ||""+this.rot_pxny[x][0-y]=="undefined"){this.rot_pxny[x][0-y] = 270;}
}
else if(a == sy -1)
{
if(this.ids_pxny[x][0-b]== null ||""+this.ids_pxny[x][0-b]=="undefined"){this.ids_pxny[x][0-b] = this.randgen_wood_end(true);}
if(this.rfh_pxny[x][0-b]== null ||""+this.rfh_pxny[x][0-b]=="undefined"){this.rfh_pxny[x][0-b] = this.randgen_rfh();}
if(this.rfv_pxny[x][0-b]== null ||""+this.rfv_pxny[x][0-b]=="undefined"){this.rfv_pxny[x][0-b] = false;}
if(this.rot_pxny[x][0-b]== null ||""+this.rot_pxny[x][0-b]=="undefined"){this.rot_pxny[x][0-b] = 90;}
}
else
{
if(this.ids_pxny[x][0-b]== null ||""+this.ids_pxny[x][0-b]=="undefined"){this.ids_pxny[x][0-b] = this.randgen_wood_mid();}
if(this.rfh_pxny[x][0-b]== null ||""+this.rfh_pxny[x][0-b]=="undefined"){this.rfh_pxny[x][0-b] = this.randgen_rfh();}
if(this.rfv_pxny[x][0-b]== null ||""+this.rfv_pxny[x][0-b]=="undefined"){this.rfv_pxny[x][0-b] = this.randgen_rfh();}
if(this.rot_pxny[x][0-b]== null ||""+this.rot_pxny[x][0-b]=="undefined"){this.rot_pxny[x][0-b] = 90;}
}
a = a+1;
}
this.update_cur_obj_idn();
}
}
else if (sx > 1 && sy == 1) // horizontal render right
{
this.ids_pxny[x][0-y] = this.randgen_wood_end();
if(this.ids_pxny[x][0-y] != "")
{
var a:Int =0, b:Int; while (a < sx)
{
b = x + a;
if(this.id0_pxny[b]==null ||""+this.id0_pxny[b]=="undefined"){this.id0_pxny[b] = [];}
if(this.id1_pxny[b]==null ||""+this.id1_pxny[b]=="undefined"){this.id1_pxny[b] = [];}
if(this.ids_pxny[b]==null ||""+this.ids_pxny[b]=="undefined"){this.ids_pxny[b] = [];}
if(this.ocu_pxny[b]==null ||""+this.ocu_pxny[b]=="undefined"){this.ocu_pxny[b] = [];}
if(this.rfh_pxny[b]==null ||""+this.rfh_pxny[b]=="undefined"){this.rfh_pxny[b] = [];}
if(this.rfv_pxny[b]==null ||""+this.rfv_pxny[b]=="undefined"){this.rfv_pxny[b] = [];}
if(this.rot_pxny[b]==null ||""+this.rot_pxny[b]=="undefined"){this.rot_pxny[b] = [];}
if(this.id0_pxny[b][0-y]==null ||""+this.id0_pxny[b][0-y]=="undefined"){this.id0_pxny[b][0-y] = this.cur_obj_id0;}
if(this.id1_pxny[b][0-y]==null ||""+this.id1_pxny[b][0-y]=="undefined"){this.id1_pxny[b][0-y] = this.cur_obj_id1;}
if(this.ocu_pxny[b][0-y]==null ||""+this.ocu_pxny[b][0-y]=="undefined"){this.ocu_pxny[b][0-y] = true;}
if(a == 0)
{
if(this.rfh_pxny[x][0-y]== null ||""+this.rfh_pxny[x][0-y]=="undefined"){this.rfh_pxny[x][0-y] = this.randgen_rfh();}
if(this.rfv_pxny[x][0-y]== null ||""+this.rfv_pxny[x][0-y]=="undefined"){this.rfv_pxny[x][0-y] = false;}
if(this.rot_pxny[x][0-y]== null ||""+this.rot_pxny[x][0-y]=="undefined"){this.rot_pxny[x][0-y] = 0;}
}
else if (a == sx-1)
{
if(this.ids_pxny[b][0-y]== null ||""+this.ids_pxny[b][0-y]=="undefined"){this.ids_pxny[b][0-y] = this.randgen_wood_end(true);}
if(this.rfh_pxny[b][0-y]== null ||""+this.rfh_pxny[b][0-y]=="undefined"){this.rfh_pxny[b][0-y] = this.randgen_rfh();}
if(this.rfv_pxny[b][0-y]== null ||""+this.rfv_pxny[b][0-y]=="undefined"){this.rfv_pxny[b][0-y] = false;}
if(this.rot_pxny[b][0-y]== null ||""+this.rot_pxny[b][0-y]=="undefined"){this.rot_pxny[b][0-y] = 180;}
}
else
{
if(this.ids_pxny[b][0-y]== null ||""+this.ids_pxny[b][0-y]=="undefined"){this.ids_pxny[b][0-y] = this.randgen_wood_mid();}
if(this.rfh_pxny[b][0-y]== null ||""+this.rfh_pxny[b][0-y]=="undefined"){this.rfh_pxny[b][0-y] = this.randgen_rfh();}
if(this.rfv_pxny[b][0-y]== null ||""+this.rfv_pxny[b][0-y]=="undefined"){this.rfv_pxny[b][0-y] = this.randgen_rfh();}
if(this.rot_pxny[b][0-y]== null ||""+this.rot_pxny[b][0-y]=="undefined"){this.rot_pxny[b][0-y] = 0;}
}
a = a+1;
}
this.update_cur_obj_idn();
}
}
else
{
this.ids_pxny[x][0-y] = this.randgen_wood_corner();
if(this.ids_pxny[x][0-y] != ""){this.sub_rny_data_mt(x,y,sx,sy); this.update_cur_obj_idn();}
}
}
at = Object_types.get_obj_at(this.ids_pxny[x][0-y]);
id0 = this.id0_pxny[x][0-y]; id1 = this.id1_pxny[x][0-y];
rfh = this.rfh_pxny[x][0-y]; rfv = this.rfv_pxny[x][0-y];
rot = this.rot_pxny[x][0-y];
}
if(at != null && ""+at != "undefined") //rny for x < 0
{
create_x = this.half_scew + x* 64 - this.offsx; create_y = this.half_sceh + y*64 - this.offsy;
this.create_actor(at,create_x, create_y); this.actors[x][y] = this.last_created_actor;
this.actors[x][y].spinTo(rot,0,null);
if(rfh){this.actors[x][y].growTo(1,-1,0,null);} // axis based flipping
if(rfv){this.actors[x][y].growTo(-1,1,0,null);}
this.actors[x][y].setValue("Object_behav","id0",id0);
this.actors[x][y].setValue("Object_behav","id1",id1);
}
x = x + 1;
}
}
else // rny for y > 0
{
while(x < xmax)
{
if(this.actors[x] == null ||""+this.actors[x] == "undefined") {this.actors[x] = [];}
if(x < 0)
{
if(this.id0_nxpy[0-x]==null||""+this.id0_nxpy[0-x]=="undefined"){this.id0_nxpy[0-x]=[];}
if(this.id1_nxpy[0-x]==null||""+this.id1_nxpy[0-x]=="undefined"){this.id1_nxpy[0-x]=[];}
if(this.ids_nxpy[0-x]==null||""+this.ids_nxpy[0-x]=="undefined"){this.ids_nxpy[0-x]=[];}
if(this.ocu_nxpy[0-x]==null||""+this.ocu_nxpy[0-x]=="undefined"){this.ocu_nxpy[0-x]=[];}
if(this.rfh_nxpy[0-x]==null||""+this.rfh_nxpy[0-x]=="undefined"){this.rfh_nxpy[0-x]=[];}
if(this.rfv_nxpy[0-x]==null||""+this.rfv_nxpy[0-x]=="undefined"){this.rfv_nxpy[0-x]=[];}
if(this.rot_nxpy[0-x]==null||""+this.rot_nxpy[0-x]=="undefined"){this.rot_nxpy[0-x]=[];}
if(this.ids_nxpy[0-x][y]==null||""+this.ids_nxpy[0-x][y]=="undefined")
{
sx = 1 + Std.int(Math.floor(Math.random() * 3.99)); sy = 1 + Std.int(Math.floor(Math.random() * 3.99));
if(this.cek_ocu(x,y-1)){sy = 1;}
else if(cek_ocu(x,y-2)){sy = Std.int(Math.min(sy,2));}
else if(cek_ocu(x,y-3)){sy = Std.int(Math.min(sy,3));}
if(this.cek_ocu(x+1,y)){sx = 1;}
else if(cek_ocu(x+2,y)){sx = Std.int(Math.min(sx,2));}
else if(cek_ocu(x+3,y)){sx = Std.int(Math.min(sx,3));}
if(sx == 1 && sy == 1)
{
this.ids_nxpy[0-x][y] = this.randgen_wood_1t();
if(this.ids_nxpy[0-x][y] != "")
{
if(this.id0_nxpy[0-x][y] == null ||""+this.id0_nxpy[0-x][y]=="undefined"){this.id0_nxpy[0-x][y] = this.cur_obj_id0;}
if(this.id1_nxpy[0-x][y] == null ||""+this.id1_nxpy[0-x][y]=="undefined"){this.id1_nxpy[0-x][y] = this.cur_obj_id1;}
if(this.ocu_nxpy[0-x][y] == null ||""+this.ocu_nxpy[0-x][y]=="undefined"){this.ocu_nxpy[0-x][y] = true;}
if(this.rfh_nxpy[0-x][y] == null ||""+this.rfh_nxpy[0-x][y]=="undefined"){this.rfh_nxpy[0-x][y] = this.randgen_rfh();}
if(this.rfv_nxpy[0-x][y] == null ||""+this.rfv_nxpy[0-x][y]=="undefined"){this.rfv_nxpy[0-x][y] = this.randgen_rfh();}
if(this.rot_nxpy[0-x][y] == null ||""+this.rot_nxpy[0-x][y]=="undefined"){this.rot_nxpy[0-x][y] = this.randgen_rot();}
this.update_cur_obj_idn();
}
}
else if(sx == 1 && sy > 1) // vertical rny for nxpy .
{
this.ids_nxpy[0-x][y] = this.randgen_wood_end();
if(this.ids_nxpy[0-x][y] != "")
{
if(y - sy < 0) // nxny initialisation
{
if(this.id0_nxny[0-x]==null ||""+this.id0_nxny[0-x] == "undefined"){this.id0_nxny[0-x]=[];}
if(this.id1_nxny[0-x]==null ||""+this.id1_nxny[0-x] == "undefined"){this.id1_nxny[0-x]=[];}
if(this.ids_nxny[0-x]==null ||""+this.ids_nxny[0-x] == "undefined"){this.ids_nxny[0-x]=[];}
if(this.ocu_nxny[0-x]==null ||""+this.ocu_nxny[0-x] == "undefined"){this.ocu_nxny[0-x]=[];}
if(this.rfh_nxny[0-x]==null ||""+this.rfh_nxny[0-x] == "undefined"){this.rfh_nxny[0-x]=[];}
if(this.rfv_nxny[0-x]==null ||""+this.rfv_nxny[0-x] == "undefined"){this.rfv_nxny[0-x]=[];}
if(this.rot_nxny[0-x]==null ||""+this.rot_nxny[0-x] == "undefined"){this.rot_nxny[0-x]=[];}
}
var a:Int =0, b:Int; while(a < sy)
{
b = y - a;
if(b < 0) //nxny
{
if(this.id0_nxny[0-x][0-b]==null ||""+this.id0_nxny[0-x][0-b] == "undefined"){this.id0_nxny[0-x][0-b] = this.cur_obj_id0;}
if(this.id1_nxny[0-x][0-b]==null ||""+this.id1_nxny[0-x][0-b] == "undefined"){this.id1_nxny[0-x][0-b] = this.cur_obj_id1;}
if(this.ocu_nxny[0-x][0-b]==null ||""+this.id1_nxny[0-x][0-b] == "undefined"){this.ocu_nxny[0-x][0-b] = true;}
if(a == sy -1) // top end
{
if(this.ids_nxny[0-x][0-b]==null ||""+this.ids_nxny[0-x][0-b] == "undefined"){this.ids_nxny[0-x][0-b] = this.randgen_wood_end(true);}
if(this.rfh_nxny[0-x][0-b]==null ||""+this.rfh_nxny[0-x][0-b] == "undefined"){this.rfh_nxny[0-x][0-b] = this.randgen_rfh();}
if(this.rfv_nxny[0-x][0-b]==null ||""+this.rfv_nxny[0-x][0-b] == "undefined"){this.rfv_nxny[0-x][0-b] = false;}
if(this.rot_nxny[0-x][0-b]==null ||""+this.rot_nxny[0-x][0-b] == "undefined"){this.rot_nxny[0-x][0-b] = 90;}
}
else // mid pat
{
if(this.ids_nxny[0-x][0-b]==null ||""+this.ids_nxny[0-x][0-b] == "undefined"){this.ids_nxny[0-x][0-b] = this.randgen_wood_mid();}
if(this.rfh_nxny[0-x][0-b]==null ||""+this.rfh_nxny[0-x][0-b] == "undefined"){this.rfh_nxny[0-x][0-b] = this.randgen_rfh();}
if(this.rfv_nxny[0-x][0-b]==null ||""+this.rfv_nxny[0-x][0-b] == "undefined"){this.rfv_nxny[0-x][0-b] = this.randgen_rfh();}
if(this.rot_nxny[0-x][0-b]==null ||""+this.rot_nxny[0-x][0-b] == "undefined"){this.rot_nxny[0-x][0-b] = 90;}
}
}
else // nxpy
{
if(this.id0_nxpy[0-x][b]==null ||""+this.id0_nxpy[0-x][b]=="undefined"){this.id0_nxpy[0-x][b]= this.cur_obj_id0;}
if(this.id1_nxpy[0-x][b]==null ||""+this.id1_nxpy[0-x][b]=="undefined"){this.id1_nxpy[0-x][b]= this.cur_obj_id1;}
if(this.ocu_nxpy[0-x][b]==null ||""+this.ocu_nxpy[0-x][b]=="undefined"){this.ocu_nxpy[0-x][b]= true;}
if(a == 0)
{
if(this.rfh_nxpy[0-x][y]==null||""+this.rfh_nxpy[0-x][y]=="undefined"){this.rfh_nxpy[0-x][y]= this.randgen_rfh();}
if(this.rfv_nxpy[0-x][y]==null||""+this.rfv_nxpy[0-x][y]=="undefined"){this.rfv_nxpy[0-x][y]= false;}
if(this.rot_nxpy[0-x][y]==null||""+this.rot_nxpy[0-x][y]=="undefined"){this.rot_nxpy[0-x][y]= 270;}
}
else if(a == sy-1)
{
if(this.ids_nxpy[0-x][b]==null||""+this.ids_nxpy[0-x][b]=="undefined"){this.ids_nxpy[0-x][b]= this.randgen_wood_end(true);}
if(this.rfh_nxpy[0-x][b]==null||""+this.rfh_nxpy[0-x][b]=="undefined"){this.rfh_nxpy[0-x][b]= this.randgen_rfh();}
if(this.rfv_nxpy[0-x][b]==null||""+this.rfv_nxpy[0-x][b]=="undefined"){this.rfv_nxpy[0-x][b]= false;}
if(this.rot_nxpy[0-x][b]==null||""+this.rot_nxpy[0-x][b]=="undefined"){this.rot_nxpy[0-x][b]= 90;}
}
else
{
if(this.ids_nxpy[0-x][b]==null||""+this.ids_nxpy[0-x][b]=="undefined"){this.ids_nxpy[0-x][b]= this.randgen_wood_mid();}
if(this.rfh_nxpy[0-x][b]==null||""+this.rfh_nxpy[0-x][b]=="undefined"){this.rfh_nxpy[0-x][b]= this.randgen_rfh();}
if(this.rfv_nxpy[0-x][b]==null||""+this.rfv_nxpy[0-x][b]=="undefined"){this.rfv_nxpy[0-x][b]= this.randgen_rfh();}
if(this.rot_nxpy[0-x][b]==null||""+this.rot_nxpy[0-x][b]=="undefined"){this.rot_nxpy[0-x][b]= 90;}
}
}
a = a + 1;
}
this.update_cur_obj_idn();
}
}
else if(sx > 1 && sy == 1) // horizontal rny nxpy
{
this.ids_nxpy[0-x][y] = this.randgen_wood_end();
if(this.ids_nxpy[0-x][y] !="")
{
var a:Int =0, b:Int;
while(a < sx)
{
b = x+a;
if(b < 0) // nxpy
{
if(this.id0_nxpy[0-b]==null||""+this.id0_nxpy[0-b]=="undefined"){this.id0_nxpy[0-b]=[];}
if(this.id1_nxpy[0-b]==null||""+this.id1_nxpy[0-b]=="undefined"){this.id1_nxpy[0-b]=[];}
if(this.ids_nxpy[0-b]==null||""+this.ids_nxpy[0-b]=="undefined"){this.ids_nxpy[0-b]=[];}
if(this.ocu_nxpy[0-b]==null||""+this.ocu_nxpy[0-b]=="undefined"){this.ocu_nxpy[0-b]=[];}
if(this.rfh_nxpy[0-b]==null||""+this.rfh_nxpy[0-b]=="undefined"){this.rfh_nxpy[0-b]=[];}
if(this.rfv_nxpy[0-b]==null||""+this.rfv_nxpy[0-b]=="undefined"){this.rfv_nxpy[0-b]=[];}
if(this.rot_nxpy[0-b]==null||""+this.rot_nxpy[0-b]=="undefined"){this.rot_nxpy[0-b]=[];}
if(this.id0_nxpy[0-b][y]==null||""+this.id0_nxpy[0-b][y]=="undefined"){this.id0_nxpy[0-b][y] = this.cur_obj_id0;} // problem detected here
if(this.id1_nxpy[0-b][y]==null||""+this.id1_nxpy[0-b][y]=="undefined"){this.id1_nxpy[0-b][y] = this.cur_obj_id1;} // problem detected here
if(this.ocu_nxpy[0-b][y]==null||""+this.ocu_nxpy[0-b][y]=="undefined"){this.ocu_nxpy[0-b][y] = true;}
if(a == 0)
{
if(this.rfh_nxpy[0-x][y]==null||""+this.rfh_nxpy[0-x][y]=="undefined"){this.rfh_nxpy[0-x][y] = this.randgen_rfh();}
if(this.rfv_nxpy[0-x][y]==null||""+this.rfv_nxpy[0-x][y]=="undefined"){this.rfv_nxpy[0-x][y] = false;}
if(this.rot_nxpy[0-x][y]==null||""+this.rot_nxpy[0-x][y]=="undefined"){this.rot_nxpy[0-x][y] = 0;}
}
else if(a == sx -1)
{
if(this.ids_nxpy[0-b][y]==null||""+this.ids_nxpy[0-b][y]=="undefined"){this.ids_nxpy[0-b][y] = this.randgen_wood_end(true);}
if(this.rfh_nxpy[0-b][y]==null||""+this.rfh_nxpy[0-b][y]=="undefined"){this.rfh_nxpy[0-b][y] = this.randgen_rfh();}
if(this.rfv_nxpy[0-b][y]==null||""+this.rfv_nxpy[0-b][y]=="undefined"){this.rfv_nxpy[0-b][y] = false;}
if(this.rot_nxpy[0-b][y]==null||""+this.rot_nxpy[0-b][y]=="undefined"){this.rot_nxpy[0-b][y] = 180;}
}
else
{
if(this.ids_nxpy[0-b][y]==null||""+this.ids_nxpy[0-b][y]=="undefined"){this.ids_nxpy[0-b][y] = this.randgen_wood_mid();}
if(this.rfh_nxpy[0-b][y]==null||""+this.rfh_nxpy[0-b][y]=="undefined"){this.rfh_nxpy[0-b][y] = this.randgen_rfh();}
if(this.rfv_nxpy[0-b][y]==null||""+this.rfv_nxpy[0-b][y]=="undefined"){this.rfv_nxpy[0-b][y] = this.randgen_rfh();}
if(this.rot_nxpy[0-b][y]==null||""+this.rot_nxpy[0-b][y]=="undefined"){this.rot_nxpy[0-b][y] = 0;}
}
}
else // pxpy
{
if(this.id0_pxpy[b]==null||""+this.id0_pxpy[b]=="undefined"){this.id0_pxpy[b]=[];}
if(this.id1_pxpy[b]==null||""+this.id1_pxpy[b]=="undefined"){this.id1_pxpy[b]=[];}
if(this.ids_pxpy[b]==null||""+this.ids_pxpy[b]=="undefined"){this.ids_pxpy[b]=[];}
if(this.ocu_pxpy[b]==null||""+this.ocu_pxpy[b]=="undefined"){this.ocu_pxpy[b]=[];}
if(this.rfh_pxpy[b]==null||""+this.rfh_pxpy[b]=="undefined"){this.rfh_pxpy[b]=[];}
if(this.rfv_pxpy[b]==null||""+this.rfv_pxpy[b]=="undefined"){this.rfv_pxpy[b]=[];}
if(this.rot_pxpy[b]==null||""+this.rot_pxpy[b]=="undefined"){this.rot_pxpy[b]=[];}
if(this.id0_pxpy[b][y]==null||""+this.id0_pxpy[b][y]=="undefined"){this.id0_pxpy[b][y] = this.cur_obj_id0;}
if(this.id1_pxpy[b][y]==null||""+this.id1_pxpy[b][y]=="undefined"){this.id1_pxpy[b][y] = this.cur_obj_id1;}
if(this.ocu_pxpy[b][y]==null||""+this.ocu_pxpy[b][y]=="undefined"){this.ocu_pxpy[b][y] = true;}
if(a == sx- 1)
{
if(this.ids_pxpy[b][y]==null ||""+this.ids_pxpy[b][y]=="undefined"){this.ids_pxpy[b][y]=this.randgen_wood_end(true);}
if(this.rfh_pxpy[b][y]==null ||""+this.rfh_pxpy[b][y]=="undefined"){this.rfh_pxpy[b][y]=this.randgen_rfh();}
if(this.rfv_pxpy[b][y]==null ||""+this.rfv_pxpy[b][y]=="undefined"){this.rfv_pxpy[b][y]= false;}
if(this.rot_pxpy[b][y]==null ||""+this.rot_pxpy[b][y]=="undefined"){this.rot_pxpy[b][y]=180;}
}
else
{
if(this.ids_pxpy[b][y]==null ||""+this.ids_pxpy[b][y]=="undefined"){this.ids_pxpy[b][y]=this.randgen_wood_mid();}
if(this.rfh_pxpy[b][y]==null ||""+this.rfh_pxpy[b][y]=="undefined"){this.rfh_pxpy[b][y]=this.randgen_rfh();}
if(this.rfv_pxpy[b][y]==null ||""+this.rfv_pxpy[b][y]=="undefined"){this.rfv_pxpy[b][y]=this.randgen_rfh();}
if(this.rot_pxpy[b][y]==null ||""+this.rot_pxpy[b][y]=="undefined"){this.rot_pxpy[b][y]=0;}
}
}
a = a+1;
}
this.update_cur_obj_idn();
}
}
else // larger than
{
this.ids_nxpy[0-x][y] = this.randgen_wood_corner();
if(this.ids_nxpy[0-x][y] != ""){this.sub_rny_data_mt(x,y,sx,sy); this.update_cur_obj_idn();}
}
}
at = Object_types.get_obj_at(this.ids_nxpy[0-x][y]);
id0 = this.id0_nxpy[0-x][y]; id1 = this.id1_nxpy[0-x][y];
rfh = this.rfh_nxpy[0-x][y]; rfv = this.rfv_nxpy[0-x][y];
rot = this.rot_nxpy[0-x][y];
}
else
{
if(this.id0_pxpy[x]==null||""+this.id0_pxpy[x]=="undefined"){this.id0_pxpy[x]=[];}
if(this.id1_pxpy[x]==null||""+this.id1_pxpy[x]=="undefined"){this.id1_pxpy[x]=[];}
if(this.ids_pxpy[x]==null||""+this.ids_pxpy[x]=="undefined"){this.ids_pxpy[x]=[];}
if(this.ocu_pxpy[x]==null||""+this.ocu_pxpy[x]=="undefined"){this.ocu_pxpy[x]=[];}
if(this.rfh_pxpy[x]==null||""+this.rfh_pxpy[x]=="undefined"){this.rfh_pxpy[x]=[];}
if(this.rfv_pxpy[x]==null||""+this.rfv_pxpy[x]=="undefined"){this.rfv_pxpy[x]=[];}
if(this.rot_pxpy[x]==null||""+this.rot_pxpy[x]=="undefined"){this.rot_pxpy[x]=[];}
if(this.ids_pxpy[x][y] == null ||""+this.ids_pxpy[x][y]=="undefined")
{
sx = 1 + Std.int(Math.floor(Math.random()* 3.99)); sy = 1 + Std.int(Math.floor(Math.random()* 3.99));
if(this.cek_ocu(x+1,y)){sx = 1;}
else if(this.cek_ocu(x+2,y)){sx = Std.int(Math.min(2,sx));}
else if(this.cek_ocu(x+3,y)){sx = Std.int(Math.min(3,sx));}
if(this.cek_ocu(x,y+1)){sy = 1;}
else if(this.cek_ocu(x,y+2)){sy = Std.int(Math.min(2,sy));}
else if(this.cek_ocu(x,y+3)){sy = Std.int(Math.min(3,sy));}
if(sx == 1 && sy == 1)
{
this.ids_pxpy[x][y] = this.randgen_wood_1t();
if(this.ids_pxpy[x][y] != null)
{
if(this.id0_pxpy[x][y]==null ||""+this.id0_pxpy[x][y]=="undefined"){this.id0_pxpy[x][y]=this.cur_obj_id0;}
if(this.id1_pxpy[x][y]==null ||""+this.id1_pxpy[x][y]=="undefined"){this.id1_pxpy[x][y]=this.cur_obj_id1;}
if(this.ocu_pxpy[x][y]==null ||""+this.ocu_pxpy[x][y]=="undefined"){this.ocu_pxpy[x][y]=true;}
if(this.rfh_pxpy[x][y]==null ||""+this.rfh_pxpy[x][y]=="undefined"){this.rfh_pxpy[x][y]=this.randgen_rfh();}
if(this.rfv_pxpy[x][y]==null ||""+this.rfv_pxpy[x][y]=="undefined"){this.rfv_pxpy[x][y]=this.randgen_rfh();}
if(this.rot_pxpy[x][y]==null ||""+this.rot_pxpy[x][y]=="undefined"){this.rot_pxpy[x][y]=this.randgen_rot();}
this.update_cur_obj_idn();
}
}
else if(sx == 1 && sy > 1) // veritcal rny for pxny
{
this.ids_pxpy[x][y] = this.randgen_wood_end();
if(this.ids_pxpy[x][y] !="")
{
if(y - sy < 0)
{
if(this.id0_pxny[x]==null ||""+this.id0_pxny[x]=="undefined"){this.id0_pxny[x]=[];}
if(this.id1_pxny[x]==null ||""+this.id1_pxny[x]=="undefined"){this.id1_pxny[x]=[];}
if(this.ids_pxny[x]==null ||""+this.ids_pxny[x]=="undefined"){this.ids_pxny[x]=[];}
if(this.ocu_pxny[x]==null ||""+this.ocu_pxny[x]=="undefined"){this.ocu_pxny[x]=[];}
if(this.rfh_pxny[x]==null ||""+this.rfh_pxny[x]=="undefined"){this.rfh_pxny[x]=[];}
if(this.rfv_pxny[x]==null ||""+this.rfv_pxny[x]=="undefined"){this.rfv_pxny[x]=[];}
if(this.rot_pxny[x]==null ||""+this.rot_pxny[x]=="undefined"){this.rot_pxny[x]=[];}
}
var a:Int =0, b:Int;
while(a < sy)
{
b = y - a;
if(b < 0)
{
if(this.id0_pxny[x][0-b]==null ||""+this.id0_pxny[x][0-b]=="undefined"){this.id0_pxny[x][0-b]=this.cur_obj_id0;}
if(this.id1_pxny[x][0-b]==null ||""+this.id1_pxny[x][0-b]=="undefined"){this.id1_pxny[x][0-b]=this.cur_obj_id1;}
if(this.ocu_pxny[x][0-b]==null ||""+this.ocu_pxny[x][0-b]=="undefined"){this.ocu_pxny[x][0-b]=true;}
if (a == sy-1)
{
if(this.ids_pxny[x][0-b]==null ||""+this.ids_pxny[x][0-b]=="undefined"){this.ids_pxny[x][0-b]=this.randgen_wood_end(true);}
if(this.rfh_pxny[x][0-b]==null ||""+this.rfh_pxny[x][0-b]=="undefined"){this.rfh_pxny[x][0-b]=this.randgen_rfh();}
if(this.rfv_pxny[x][0-b]==null ||""+this.rfv_pxny[x][0-b]=="undefined"){this.rfv_pxny[x][0-b]=false;}
if(this.rot_pxny[x][0-b]==null ||""+this.rot_pxny[x][0-b]=="undefined"){this.rot_pxny[x][0-b]=90;}
}
else
{
if(this.ids_pxny[x][0-b]==null ||""+this.ids_pxny[x][0-b]=="undefined"){this.ids_pxny[x][0-b]=this.randgen_wood_mid();}
if(this.rfh_pxny[x][0-b]==null ||""+this.rfh_pxny[x][0-b]=="undefined"){this.rfh_pxny[x][0-b]=this.randgen_rfh();}
if(this.rfv_pxny[x][0-b]==null ||""+this.rfv_pxny[x][0-b]=="undefined"){this.rfv_pxny[x][0-b]=this.randgen_rfh();}
if(this.rot_pxny[x][0-b]==null ||""+this.rot_pxny[x][0-b]=="undefined"){this.rot_pxny[x][0-b]=90;}
}
}
else
{
if(this.id0_pxpy[x][b]==null ||""+this.id0_pxpy[x][b]=="undefined"){this.id0_pxpy[x][b]=this.cur_obj_id0;}
if(this.id1_pxpy[x][b]==null ||""+this.id1_pxpy[x][b]=="undefined"){this.id1_pxpy[x][b]=this.cur_obj_id1;}
if(this.ocu_pxpy[x][b]==null ||""+this.ocu_pxpy[x][b]=="undefined"){this.ocu_pxpy[x][b]=true;}
if(a == 0) // starting point bottom
{
if(this.rfh_pxpy[x][y]==null ||""+this.rfh_pxpy[x][y]=="undefined"){this.rfh_pxpy[x][y]=this.randgen_rfh();}
if(this.rfv_pxpy[x][y]==null ||""+this.rfv_pxpy[x][y]=="undefined"){this.rfv_pxpy[x][y]=false;}
if(this.rot_pxpy[x][y]==null ||""+this.rot_pxpy[x][y]=="undefined"){this.rot_pxpy[x][y]=270;}
}
else if (a == sy -1)
{
if(this.ids_pxpy[x][b]==null ||""+this.ids_pxpy[x][b]=="undefined"){this.ids_pxpy[x][b]=this.randgen_wood_end(true);}
if(this.rfh_pxpy[x][b]==null ||""+this.rfh_pxpy[x][b]=="undefined"){this.rfh_pxpy[x][b]=this.randgen_rfh();}
if(this.rfv_pxpy[x][b]==null ||""+this.rfv_pxpy[x][b]=="undefined"){this.rfv_pxpy[x][b]=false;}
if(this.rot_pxpy[x][b]==null ||""+this.rot_pxpy[x][b]=="undefined"){this.rot_pxpy[x][b]=90;}
}
else
{
if(this.ids_pxpy[x][b]==null ||""+this.ids_pxpy[x][b]=="undefined"){this.ids_pxpy[x][b]=this.randgen_wood_mid();}
if(this.rfh_pxpy[x][b]==null ||""+this.rfh_pxpy[x][b]=="undefined"){this.rfh_pxpy[x][b]=this.randgen_rfh();}
if(this.rfv_pxpy[x][b]==null ||""+this.rfv_pxpy[x][b]=="undefined"){this.rfv_pxpy[x][b]=this.randgen_rfh();}
if(this.rot_pxpy[x][b]==null ||""+this.rot_pxpy[x][b]=="undefined"){this.rot_pxpy[x][b]=90;}
}
}
a = a+1;
}
this.update_cur_obj_idn();
}
}
else if(sx > 1 && sy == 1) // horizontal rny for pxpy
{
this.ids_pxpy[x][y] = this.randgen_wood_end();
if(this.ids_pxpy[x][y] != "")
{
var a:Int=0, b:Int;
while(a < sx)
{
b = x+a;
if(this.id0_pxpy[b]==null ||""+this.id0_pxpy[b]=="undefined"){this.id0_pxpy[b] = [];}
if(this.id1_pxpy[b]==null ||""+this.id1_pxpy[b]=="undefined"){this.id1_pxpy[b] = [];}
if(this.ids_pxpy[b]==null ||""+this.ids_pxpy[b]=="undefined"){this.ids_pxpy[b] = [];}
if(this.ocu_pxpy[b]==null ||""+this.ocu_pxpy[b]=="undefined"){this.ocu_pxpy[b] = [];}
if(this.rfh_pxpy[b]==null ||""+this.rfh_pxpy[b]=="undefined"){this.rfh_pxpy[b] = [];}
if(this.rfv_pxpy[b]==null ||""+this.rfv_pxpy[b]=="undefined"){this.rfv_pxpy[b] = [];}
if(this.rot_pxpy[b]==null ||""+this.rot_pxpy[b]=="undefined"){this.rot_pxpy[b] = [];}
if(this.id0_pxpy[b][y]==null ||""+this.id0_pxpy[b][y]=="undefined"){this.id0_pxpy[b][y] = this.cur_obj_id0;}
if(this.id1_pxpy[b][y]==null ||""+this.id1_pxpy[b][y]=="undefined"){this.id1_pxpy[b][y] = this.cur_obj_id1;}
if(this.ocu_pxpy[b][y]==null ||""+this.ocu_pxpy[b][y]=="undefined"){this.ocu_pxpy[b][y] = true;}
if(a == 0)
{
if(this.rfh_pxpy[x][y]==null ||""+this.rfh_pxpy[x][y]=="undefined"){this.rfh_pxpy[x][y]= this.randgen_rfh();}
if(this.rfv_pxpy[x][y]==null ||""+this.rfv_pxpy[x][y]=="undefined"){this.rfv_pxpy[x][y]= false;}
if(this.rot_pxpy[x][y]==null ||""+this.rot_pxpy[x][y]=="undefined"){this.rot_pxpy[x][y]= 0;}
}
else if(a == sx -1)
{
if(this.ids_pxpy[b][y]==null ||""+this.ids_pxpy[b][y]=="undefined"){this.ids_pxpy[b][y]= this.randgen_wood_end(true);}
if(this.rfh_pxpy[b][y]==null ||""+this.rfh_pxpy[b][y]=="undefined"){this.rfh_pxpy[b][y]= this.randgen_rfh();}
if(this.rfv_pxpy[b][y]==null ||""+this.rfv_pxpy[b][y]=="undefined"){this.rfv_pxpy[b][y]= false;}
if(this.rot_pxpy[b][y]==null ||""+this.rot_pxpy[b][y]=="undefined"){this.rot_pxpy[b][y]= 180;}
}
else
{
if(this.ids_pxpy[b][y]==null ||""+this.ids_pxpy[b][y]=="undefined"){this.ids_pxpy[b][y]= this.randgen_wood_mid();}
if(this.rfh_pxpy[b][y]==null ||""+this.rfh_pxpy[b][y]=="undefined"){this.rfh_pxpy[b][y]= this.randgen_rfh();}
if(this.rfv_pxpy[b][y]==null ||""+this.rfv_pxpy[b][y]=="undefined"){this.rfv_pxpy[b][y]= this.randgen_rfh();}
if(this.rot_pxpy[b][y]==null ||""+this.rot_pxpy[b][y]=="undefined"){this.rot_pxpy[b][y]= 0;}
}
a = a +1;
}
this.update_cur_obj_idn();
}
}
else
{
this.ids_pxpy[x][y] = this.randgen_wood_corner();
if(this.ids_pxpy[x][y] != ""){this.sub_rny_data_mt(x,y,sx,sy);this.update_cur_obj_idn();}
}
}
at = Object_types.get_obj_at(this.ids_pxpy[x][y]);
id0 = this.id0_pxpy[x][y]; id1 = this.id1_pxpy[x][y];
rfh = this.rfh_pxpy[x][y]; rfv = this.rfv_pxpy[x][y];
rot = this.rot_pxpy[x][y];
}
if(at != null && ""+ at != "undefined")
{
create_x = this.half_scew + x* 64 - this.offsx; create_y = this.half_sceh + y*64 - this.offsy;
this.create_actor(at,create_x, create_y); this.actors[x][y] = this.last_created_actor;
this.actors[x][y].spinTo(rot,0,null);
if(rfh){this.actors[x][y].growTo(1,-1,0,null);} // axis based flipping
if(rfv){this.actors[x][y].growTo(-1,1,0,null);}
this.actors[x][y].setValue("Object_behav","id0",id0);
this.actors[x][y].setValue("Object_behav","id1",id1);
}
x = x + 1;
}
}
}
public function rpx(x,ymax,ymin) // vertical rendering
{
var id0:Int, id1:Int; var ids:String, at:ActorType, ocu: Bool, rfh:Bool, rfv:Bool, rot:Bool;
var sx:Int, sy:Int; var y:Int = ymin; var create_x:Float; var create_y:Float;
if(this.actors[x]==null || ""+this.actors[x]=="undefined"){this.actors[x]=[];}
if (x < 0) // rpx x<0
{
while(y < ymax)
{
if(y < 0)
{
if(this.id0_nxny[0-x]==null ||""+ this.id0_nxny[0-x]== "undefined"){this.id0_nxny[0-x]=[];}
if(this.id1_nxny[0-x]==null ||""+ this.id1_nxny[0-x]== "undefined"){this.id1_nxny[0-x]=[];}
if(this.ids_nxny[0-x]==null ||""+ this.ids_nxny[0-x]== "undefined"){this.ids_nxny[0-x]=[];}
if(this.ocu_nxny[0-x]==null ||""+ this.ocu_nxny[0-x]== "undefined"){this.ocu_nxny[0-x]=[];}
if(this.rfh_nxny[0-x]==null ||""+ this.rfh_nxny[0-x]== "undefined"){this.rfh_nxny[0-x]=[];}
if(this.rfv_nxny[0-x]==null ||""+ this.rfv_nxny[0-x]== "undefined"){this.rfv_nxny[0-x]=[];}
if(this.rot_nxny[0-x]==null ||""+ this.rot_nxny[0-x]== "undefined"){this.rot_nxny[0-x]=[];}
if(this.ids_nxny[0-x][0-y]==null ||""+this.ids_nxny[0-x][0-y]=="undefined")
{
sx = 1 + Std.int(Math.floor(Math.random() * 3.99)); sy = 1 + Std.int(Math.floor(Math.random() * 3.99));
if(this.cek_ocu(x+1,y)){sx =1;}
else if(this.cek_ocu(x+2,y)){sx = Std.int(Math.min(2,sx));}
else if(this.cek_ocu(x+3,y)){sx = Std.int(Math.min(3,sx));}
if(this.cek_ocu(x,y+1)){sy = 1;}
else if(this.cek_ocu(x,y+2)){sy = Std.int(Math.min(2,sy));}
else if(this.cek_ocu(x,y+3)){sy = Std.int(Math.min(3,sy));}
if (sx == 1 && sy == 1)
{
this.ids_nxny[0-x][0-y] = this.randgen_wood_1t();
if(this.ids_nxny[0-x][0-y] != "")
{
if(this.id0_nxny[0-x][0-y] == null ||""+this.id0_nxny[0-x][0-y] =="undefined"){this.id0_nxny[0-x][0-y]= this.cur_obj_id0;}
if(this.id1_nxny[0-x][0-y] == null ||""+this.id1_nxny[0-x][0-y] =="undefined"){this.id1_nxny[0-x][0-y]= this.cur_obj_id1;}
if(this.ocu_nxny[0-x][0-y] == null ||""+this.ocu_nxny[0-x][0-y] =="undefined"){this.ocu_nxny[0-x][0-y]= true;}
if(this.rfh_nxny[0-x][0-y] == null ||""+this.rfh_nxny[0-x][0-y] =="undefined"){this.rfh_nxny[0-x][0-y]= this.randgen_rfh();}
if(this.rfv_nxny[0-x][0-y] == null ||""+this.rfv_nxny[0-x][0-y] =="undefined"){this.rfv_nxny[0-x][0-y]= this.randgen_rfh();}
if(this.rot_nxny[0-x][0-y] == null ||""+this.rot_nxny[0-x][0-y] =="undefined"){this.rot_nxny[0-x][0-y]= this.randgen_rot();}
this.update_cur_obj_idn();
}
}
else if(sx == 1 && sy > 1) // rpx nxny vertical
{
this.ids_nxny[0-x][0-y] = this.randgen_wood_end();
if(this.ids_nxny[0-x][0-y]!="") // creating initialising the first object tile data.
{
if(y + sy > 0) // initialize nxpy data.
{
if(this.id0_nxpy[0-x]==null||""+this.id0_nxpy[0-x]=="undefined"){this.id0_nxpy[0-x]=[];}
if(this.id1_nxpy[0-x]==null||""+this.id1_nxpy[0-x]=="undefined"){this.id1_nxpy[0-x]=[];}
if(this.ids_nxpy[0-x]==null||""+this.ids_nxpy[0-x]=="undefined"){this.ids_nxpy[0-x]=[];}
if(this.ocu_nxpy[0-x]==null||""+this.ocu_nxpy[0-x]=="undefined"){this.ocu_nxpy[0-x]=[];}
if(this.rfh_nxpy[0-x]==null||""+this.rfh_nxpy[0-x]=="undefined"){this.rfh_nxpy[0-x]=[];}
if(this.rfv_nxpy[0-x]==null||""+this.rfv_nxpy[0-x]=="undefined"){this.rfv_nxpy[0-x]=[];}
if(this.rot_nxpy[0-x]==null||""+this.rot_nxpy[0-x]=="undefined"){this.rot_nxpy[0-x]=[];}
}
var b:Int =0;
var a:Int =0; while(a < sy)
{
b = y+a;
if(b < 0) // the flips wen use by axis, not scale factor;
{
if(this.id0_nxny[0-x][0-b]==null||""+this.id0_nxny[0-x][0-b]=="undefined"){this.id0_nxny[0-x][0-b]=this.cur_obj_id0;}
if(this.id1_nxny[0-x][0-b]==null||""+this.id1_nxny[0-x][0-b]=="undefined"){this.id1_nxny[0-x][0-b]=this.cur_obj_id1;}
if(this.ocu_nxny[0-x][0-b]==null||""+this.ocu_nxny[0-x][0-b]=="undefined"){this.ocu_nxny[0-x][0-b]=true;}
if(a == 0) // problem found in data change
{
if(this.rfh_nxny[0-x][0-y]==null||""+this.rfh_nxny[0-x][0-y]=="undefined"){this.rfh_nxny[0-x][0-y]=this.randgen_rfh();}
if(this.rfv_nxny[0-x][0-y]==null||""+this.rfv_nxny[0-x][0-y]=="undefined"){this.rfv_nxny[0-x][0-y]=false;}
if(this.rot_nxny[0-x][0-y]==null||""+this.rot_nxny[0-x][0-y]=="undefined"){this.rot_nxny[0-x][0-y]=90;}
}
else if(a == sy-1) // bugs in rendering
{
if(this.ids_nxny[0-x][0-b]==null||""+this.ids_nxny[0-x][0-b]=="undefined"){this.ids_nxny[0-x][0-b]=this.randgen_wood_end(true);}
if(this.rfh_nxny[0-x][0-b]==null||""+this.rfh_nxny[0-x][0-b]=="undefined"){this.rfh_nxny[0-x][0-b]=this.randgen_rfh();}
if(this.rfv_nxny[0-x][0-b]==null||""+this.rfv_nxny[0-x][0-b]=="undefined"){this.rfv_nxny[0-x][0-b]=false;}
if(this.rot_nxny[0-x][0-b]==null||""+this.rot_nxny[0-x][0-b]=="undefined"){this.rot_nxny[0-x][0-b]=270;}
}
else // middle part for nxny;
{
if(this.ids_nxny[0-x][0-b]==null||""+this.ids_nxny[0-x][0-b]=="undefined"){this.ids_nxny[0-x][0-b]=this.randgen_wood_mid();}
if(this.rfh_nxny[0-x][0-b]==null||""+this.rfh_nxny[0-x][0-b]=="undefined"){this.rfh_nxny[0-x][0-b]=this.randgen_rfh();}
if(this.rfv_nxny[0-x][0-b]==null||""+this.rfv_nxny[0-x][0-b]=="undefined"){this.rfv_nxny[0-x][0-b]=this.randgen_rfh();}
if(this.rot_nxny[0-x][0-b]==null||""+this.rot_nxny[0-x][0-b]=="undefined"){this.rot_nxny[0-x][0-b]=90;}
}
}
else
{
if(this.id0_nxpy[0-x][b]==null||""+this.id0_nxpy[0-x][b]=="undefined"){this.id0_nxpy[0-x][b]=this.cur_obj_id0;}
if(this.id1_nxpy[0-x][b]==null||""+this.id1_nxpy[0-x][b]=="undefined"){this.id1_nxpy[0-x][b]=this.cur_obj_id1;}
if(this.ocu_nxpy[0-x][b]==null||""+this.ocu_nxpy[0-x][b]=="undefined"){this.ocu_nxpy[0-x][b]=true;}
if(a == sy -1)
{
if(this.ids_nxpy[0-x][b]==null||""+this.ids_nxpy[0-x][b]=="undefined"){this.ids_nxpy[0-x][b]=this.randgen_wood_end(true);}
if(this.rfh_nxpy[0-x][b]==null||""+this.rfh_nxpy[0-x][b]=="undefined"){this.rfh_nxpy[0-x][b]=this.randgen_rfh();}
if(this.rfv_nxpy[0-x][b]==null||""+this.rfv_nxpy[0-x][b]=="undefined"){this.rfv_nxpy[0-x][b]=false;}
if(this.rot_nxpy[0-x][b]==null||""+this.rot_nxpy[0-x][b]=="undefined"){this.rot_nxpy[0-x][b]=270;}
}
else
{
if(this.ids_nxpy[0-x][b]==null||""+this.ids_nxpy[0-x][b]=="undefined"){this.ids_nxpy[0-x][b]=this.randgen_wood_mid();}
if(this.rfh_nxpy[0-x][b]==null||""+this.rfh_nxpy[0-x][b]=="undefined"){this.rfh_nxpy[0-x][b]=this.randgen_rfh();}
if(this.rfv_nxpy[0-x][b]==null||""+this.rfv_nxpy[0-x][b]=="undefined"){this.rfv_nxpy[0-x][b]=this.randgen_rfh();}
if(this.rot_nxpy[0-x][b]==null||""+this.rot_nxpy[0-x][b]=="undefined"){this.rot_nxpy[0-x][b]=90;}
}
}
a=a+1;
}
this.update_cur_obj_idn();
}
}
else if(sx > 1 && sy == 1) // rpx nxny horizontal
{
this.ids_nxny[0-x][0-y] = this.randgen_wood_end();
{
if(this.ids_nxny[0-x][0-y] !="")
{
var a:Int = 0; var b:Int; while(a < sx)
{ b = x + a; // rendering to the right.
if(b < 0)
{
if(this.id0_nxny[0-b]==null ||""+this.id0_nxny[0-b]=="undefined"){this.id0_nxny[0-b]=[];}
if(this.id1_nxny[0-b]==null ||""+this.id1_nxny[0-b]=="undefined"){this.id1_nxny[0-b]=[];}
if(this.ids_nxny[0-b]==null ||""+this.ids_nxny[0-b]=="undefined"){this.ids_nxny[0-b]=[];}
if(this.ocu_nxny[0-b]==null ||""+this.ocu_nxny[0-b]=="undefined"){this.ocu_nxny[0-b]=[];}
if(this.rfh_nxny[0-b]==null ||""+this.rfh_nxny[0-b]=="undefined"){this.rfh_nxny[0-b]=[];}
if(this.rfv_nxny[0-b]==null ||""+this.rfv_nxny[0-b]=="undefined"){this.rfv_nxny[0-b]=[];}
if(this.rot_nxny[0-b]==null ||""+this.rot_nxny[0-b]=="undefined"){this.rot_nxny[0-b]=[];}
if(this.id0_nxny[0-b][0-y]==null ||""+this.id0_nxny[0-b][0-y]=="undefined"){this.id0_nxny[0-b][0-y]= this.cur_obj_id0;}
if(this.id1_nxny[0-b][0-y]==null ||""+this.id1_nxny[0-b][0-y]=="undefined"){this.id1_nxny[0-b][0-y]= this.cur_obj_id1;}
if(this.ocu_nxny[0-b][0-y]==null ||""+this.ocu_nxny[0-b][0-y]=="undefined"){this.ocu_nxny[0-b][0-y]= true;}
if(a == 0)
{
if(this.rfh_nxny[0-x][0-y]== null ||""+this.rfh_nxny[0-x][0-y]=="undefined"){this.rfh_nxny[0-x][0-y] = this.randgen_rfh();}
if(this.rfv_nxny[0-x][0-y]== null ||""+this.rfv_nxny[0-x][0-y]=="undefined"){this.rfv_nxny[0-x][0-y] = false;}
if(this.rot_nxny[0-x][0-y]== null ||""+this.rot_nxny[0-x][0-y]=="undefined"){this.rot_nxny[0-x][0-y] = 0;}
}
else if (a == sx -1)
{
if(this.ids_nxny[0-b][0-y]== null ||""+this.ids_nxny[0-b][0-y]=="undefined"){this.ids_nxny[0-b][0-y] = this.randgen_wood_end(true);}
if(this.rfh_nxny[0-b][0-y]== null ||""+this.rfh_nxny[0-b][0-y]=="undefined"){this.rfh_nxny[0-b][0-y] = this.randgen_rfh();}
if(this.rfv_nxny[0-b][0-y]== null ||""+this.rfv_nxny[0-b][0-y]=="undefined"){this.rfv_nxny[0-b][0-y] = false;}
if(this.rot_nxny[0-b][0-y]== null ||""+this.rot_nxny[0-b][0-y]=="undefined"){this.rot_nxny[0-b][0-y] = 180;}
}
else
{
if(this.ids_nxny[0-b][0-y]== null ||""+this.ids_nxny[0-b][0-y]=="undefined"){this.ids_nxny[0-b][0-y] = this.randgen_wood_mid();}
if(this.rfh_nxny[0-b][0-y]== null ||""+this.rfh_nxny[0-b][0-y]=="undefined"){this.rfh_nxny[0-b][0-y] = this.randgen_rfh();}
if(this.rfv_nxny[0-b][0-y]== null ||""+this.rfv_nxny[0-b][0-y]=="undefined"){this.rfv_nxny[0-b][0-y] = this.randgen_rfh();}
if(this.rot_nxny[0-b][0-y]== null ||""+this.rot_nxny[0-b][0-y]=="undefined"){this.rot_nxny[0-b][0-y] = 0;}
}
}
else
{
if(this.id0_pxny[b]==null ||""+this.id0_pxny[b]=="undefined"){this.id0_pxny[b]=[];}
if(this.id1_pxny[b]==null ||""+this.id1_pxny[b]=="undefined"){this.id1_pxny[b]=[];}
if(this.ids_pxny[b]==null ||""+this.ids_pxny[b]=="undefined"){this.ids_pxny[b]=[];}
if(this.ocu_pxny[b]==null ||""+this.ocu_pxny[b]=="undefined"){this.ocu_pxny[b]=[];}
if(this.rfh_pxny[b]==null ||""+this.rfh_pxny[b]=="undefined"){this.rfh_pxny[b]=[];}
if(this.rfv_pxny[b]==null ||""+this.rfv_pxny[b]=="undefined"){this.rfv_pxny[b]=[];}
if(this.rot_pxny[b]==null ||""+this.rot_pxny[b]=="undefined"){this.rot_pxny[b]=[];}
if(this.id0_pxny[b][0-y]==null ||""+this.id0_pxny[b][0-y]=="undefined"){this.id0_pxny[b][0-y]= this.cur_obj_id0;}
if(this.id1_pxny[b][0-y]==null ||""+this.id1_pxny[b][0-y]=="undefined"){this.id1_pxny[b][0-y]= this.cur_obj_id1;}
if(this.ocu_pxny[b][0-y]==null ||""+this.ocu_pxny[b][0-y]=="undefined"){this.ocu_pxny[b][0-y]= true;}
if (a == sx -1)
{
if(this.ids_pxny[b][0-y]== null ||""+this.ids_pxny[b][0-y]=="undefined"){this.ids_pxny[b][0-y] = this.randgen_wood_end(true);}
if(this.rfh_pxny[b][0-y]== null ||""+this.rfh_pxny[b][0-y]=="undefined"){this.rfh_pxny[b][0-y] = this.randgen_rfh();}
if(this.rfv_pxny[b][0-y]== null ||""+this.rfv_pxny[b][0-y]=="undefined"){this.rfv_pxny[b][0-y] = false;}
if(this.rot_pxny[b][0-y]== null ||""+this.rot_pxny[b][0-y]=="undefined"){this.rot_pxny[b][0-y] = 180;}
}
else
{
if(this.ids_pxny[b][0-y]== null ||""+this.ids_pxny[b][0-y]=="undefined"){this.ids_pxny[b][0-y] = this.randgen_wood_mid();}
if(this.rfh_pxny[b][0-y]== null ||""+this.rfh_pxny[b][0-y]=="undefined"){this.rfh_pxny[b][0-y] = this.randgen_rfh();}
if(this.rfv_pxny[b][0-y]== null ||""+this.rfv_pxny[b][0-y]=="undefined"){this.rfv_pxny[b][0-y] = this.randgen_rfh();}
if(this.rot_pxny[b][0-y]== null ||""+this.rot_pxny[b][0-y]=="undefined"){this.rot_pxny[b][0-y] = 0;}
}
}
a = a+1;
}
this.update_cur_obj_idn();
}
}
}
else // rpx nxny for 2x2 or larger
{
this.ids_nxny[0-x][0-y] = this.randgen_wood_corner();
if(this.ids_nxny[0-x][0-y] != ""){this.sub_rpx_data_mt(x,y,sx,sy); this.update_cur_obj_idn();}
}
}
at = Object_types.get_obj_at(this.ids_nxny[0-x][0-y]);
id0 = this.id0_nxny[0-x][0-y]; id1 = this.id1_nxny[0-x][0-y];
rfh = this.rfh_nxny[0-x][0-y]; rfv = this.rfv_nxny[0-x][0-y];
rot = this.rot_nxny[0-x][0-y];
}
else // rpx_nxpy
{
if(this.id0_nxpy[0-x]==null ||""+ this.id0_nxpy[0-x] == "undefined"){this.id0_nxpy[0-x]=[];}
if(this.id1_nxpy[0-x]==null ||""+ this.id1_nxpy[0-x] == "undefined"){this.id1_nxpy[0-x]=[];}
if(this.ids_nxpy[0-x]==null ||""+ this.ids_nxpy[0-x] == "undefined"){this.ids_nxpy[0-x]=[];}
if(this.ocu_nxpy[0-x]==null ||""+ this.ocu_nxpy[0-x] == "undefined"){this.ocu_nxpy[0-x]=[];}
if(this.rfh_nxpy[0-x]==null ||""+ this.rfh_nxpy[0-x] == "undefined"){this.rfh_nxpy[0-x]=[];}
if(this.rfv_nxpy[0-x]==null ||""+ this.rfv_nxpy[0-x] == "undefined"){this.rfv_nxpy[0-x]=[];}
if(this.rot_nxpy[0-x]==null ||""+ this.rot_nxpy[0-x] == "undefined"){this.rot_nxpy[0-x]=[];}
if(this.ids_nxpy[0-x][y] ==null ||""+ this.ids_nxpy[0-x][y] == "undefined")
{
sx = 1 + Std.int(Math.floor(Math.random() * 3.99)); sy = 1 + Std.int(Math.floor(Math.random() * 3.99));
if(this.cek_ocu(x+1,y)){sx =1;}
else if(this.cek_ocu(x+2,y)){sx = Std.int(Math.min(2,sx));}
else if(this.cek_ocu(x+3,y)){sx = Std.int(Math.min(3,sx));}
if(this.cek_ocu(x,y+1)){sy = 1;}
else if(this.cek_ocu(x,y+2)){sy = Std.int(Math.min(2,sy));}
else if(this.cek_ocu(x,y+3)){sy = Std.int(Math.min(3,sy));}
if (sx == 1 && sy == 1)
{
this.ids_nxpy[0-x][y] = this.randgen_wood_1t();
if(this.ids_nxpy[0-x][y] != "")
{
if(this.id0_nxpy[0-x][y] == null ||""+this.id0_nxpy[0-x][y] =="undefined"){this.id0_nxpy[0-x][y]= this.cur_obj_id0;}
if(this.id1_nxpy[0-x][y] == null ||""+this.id1_nxpy[0-x][y] =="undefined"){this.id1_nxpy[0-x][y]= this.cur_obj_id1;}
if(this.ocu_nxpy[0-x][y] == null ||""+this.ocu_nxpy[0-x][y] =="undefined"){this.ocu_nxpy[0-x][y]= true;}
if(this.rfh_nxpy[0-x][y] == null ||""+this.rfh_nxpy[0-x][y] =="undefined"){this.rfh_nxpy[0-x][y]= this.randgen_rfh();}
if(this.rfv_nxpy[0-x][y] == null ||""+this.rfv_nxpy[0-x][y] =="undefined"){this.rfv_nxpy[0-x][y]= this.randgen_rfh();}
if(this.rot_nxpy[0-x][y] == null ||""+this.rot_nxpy[0-x][y] =="undefined"){this.rot_nxpy[0-x][y]= this.randgen_rot();}
this.update_cur_obj_idn();
}
}
else if(sx == 1 && sy > 1) // rpx nxpy vertical
{
this.ids_nxpy[0-x][y] = this.randgen_wood_end();
if(this.ids_nxpy[0-x][y] != "")
{
var a:Int =0; var b:Int=0; this.diag_cek_get = 0; // diagnosis shows the loop went through.
while(a < sy)
{
b = y+a;
if(this.id0_nxpy[0-x][b] == null ||""+ this.id0_nxpy[0-x][b]=="undefined"){this.id0_nxpy[0-x][b] = this.cur_obj_id0;}
if(this.id1_nxpy[0-x][b] == null ||""+ this.id1_nxpy[0-x][b]=="undefined"){this.id1_nxpy[0-x][b] = this.cur_obj_id1;}
if(this.ocu_nxpy[0-x][b] == null ||""+ this.ocu_nxpy[0-x][b]=="undefined"){this.ocu_nxpy[0-x][b] = true;}
if(a == 0) // upper end
{
if(this.rfh_nxpy[0-x][y]== null ||""+ this.rfh_nxpy[0-x][y]=="undefined"){this.rfh_nxpy[0-x][y] = this.randgen_rfh();}
if(this.rfv_nxpy[0-x][y]== null ||""+ this.rfv_nxpy[0-x][y]=="undefined"){this.rfv_nxpy[0-x][y] = false;}
if(this.rot_nxpy[0-x][y]== null ||""+ this.rot_nxpy[0-x][y]=="undefined"){this.rot_nxpy[0-x][y] = 90;}
}
else if (a == sy -1)
{
if(this.ids_nxpy[0-x][b]== null ||""+ this.ids_nxpy[0-x][b]=="undefined"){this.ids_nxpy[0-x][b] = this.randgen_wood_end(true); }
if(this.rfh_nxpy[0-x][b]== null ||""+ this.rfh_nxpy[0-x][b]=="undefined"){this.rfh_nxpy[0-x][b] = this.randgen_rfh();}
if(this.rfv_nxpy[0-x][b]== null ||""+ this.rfv_nxpy[0-x][b]=="undefined"){this.rfv_nxpy[0-x][b] = false;}
if(this.rot_nxpy[0-x][b]== null ||""+ this.rot_nxpy[0-x][b]=="undefined"){this.rot_nxpy[0-x][b] = 270;}
}
else
{ // bugs here
if(this.ids_nxpy[0-x][b]== null ||""+ this.ids_nxpy[0-x][b]=="undefined"){this.ids_nxpy[0-x][b] = this.randgen_wood_mid();}
if(this.rfh_nxpy[0-x][b]== null ||""+ this.rfh_nxpy[0-x][b]=="undefined"){this.rfh_nxpy[0-x][b] = this.randgen_rfh();}
if(this.rfv_nxpy[0-x][b]== null ||""+ this.rfv_nxpy[0-x][b]=="undefined"){this.rfv_nxpy[0-x][b] = this.randgen_rfh();}
if(this.rot_nxpy[0-x][b]== null ||""+ this.rot_nxpy[0-x][b]=="undefined"){this.rot_nxpy[0-x][b] = 90;}
}
a = a+1;
}
this.update_cur_obj_idn();
}
}
else if(sx > 1 && sy == 1) // rpx nxpy horizontal
{
this.ids_nxpy[0-x][y] = this.randgen_wood_end();
if(this.ids_nxpy[0-x][y] !="")
{
var a:Int =0, b:Int=0;
while(a < sx)
{
b = x+a;
if(b < 0) // nxpy
{
if(this.id0_nxpy[0-b]==null||""+this.id0_nxpy[0-b]=="undefined"){this.id0_nxpy[0-b]=[];}
if(this.id1_nxpy[0-b]==null||""+this.id1_nxpy[0-b]=="undefined"){this.id1_nxpy[0-b]=[];}
if(this.ids_nxpy[0-b]==null||""+this.ids_nxpy[0-b]=="undefined"){this.ids_nxpy[0-b]=[];}
if(this.ocu_nxpy[0-b]==null||""+this.ocu_nxpy[0-b]=="undefined"){this.ocu_nxpy[0-b]=[];}
if(this.rfh_nxpy[0-b]==null||""+this.rfh_nxpy[0-b]=="undefined"){this.rfh_nxpy[0-b]=[];}
if(this.rfv_nxpy[0-b]==null||""+this.rfv_nxpy[0-b]=="undefined"){this.rfv_nxpy[0-b]=[];}
if(this.rot_nxpy[0-b]==null||""+this.rot_nxpy[0-b]=="undefined"){this.rot_nxpy[0-b]=[];}
if(this.id0_nxpy[0-b][y]==null||""+this.id0_nxpy[0-b][y]=="undefined"){this.id0_nxpy[0-b][y] = this.cur_obj_id0;} // problem detected here
if(this.id1_nxpy[0-b][y]==null||""+this.id1_nxpy[0-b][y]=="undefined"){this.id1_nxpy[0-b][y] = this.cur_obj_id1;} // problem detected here
if(this.ocu_nxpy[0-b][y]==null||""+this.ocu_nxpy[0-b][y]=="undefined"){this.ocu_nxpy[0-b][y] = true;}
if(a == 0)
{
if(this.rfh_nxpy[0-x][y]==null||""+this.rfh_nxpy[0-x][y]=="undefined"){this.rfh_nxpy[0-x][y] = this.randgen_rfh();}
if(this.rfv_nxpy[0-x][y]==null||""+this.rfv_nxpy[0-x][y]=="undefined"){this.rfv_nxpy[0-x][y] = false;}
if(this.rot_nxpy[0-x][y]==null||""+this.rot_nxpy[0-x][y]=="undefined"){this.rot_nxpy[0-x][y] = 0;}
}
else if(a == sx -1)
{
if(this.ids_nxpy[0-b][y]==null||""+this.ids_nxpy[0-b][y]=="undefined"){this.ids_nxpy[0-b][y] = this.randgen_wood_end(true);}
if(this.rfh_nxpy[0-b][y]==null||""+this.rfh_nxpy[0-b][y]=="undefined"){this.rfh_nxpy[0-b][y] = this.randgen_rfh();}
if(this.rfv_nxpy[0-b][y]==null||""+this.rfv_nxpy[0-b][y]=="undefined"){this.rfv_nxpy[0-b][y] = false;}
if(this.rot_nxpy[0-b][y]==null||""+this.rot_nxpy[0-b][y]=="undefined"){this.rot_nxpy[0-b][y] = 180;}
}
else
{
if(this.ids_nxpy[0-b][y]==null||""+this.ids_nxpy[0-b][y]=="undefined"){this.ids_nxpy[0-b][y] = this.randgen_wood_mid();}
if(this.rfh_nxpy[0-b][y]==null||""+this.rfh_nxpy[0-b][y]=="undefined"){this.rfh_nxpy[0-b][y] = this.randgen_rfh();}
if(this.rfv_nxpy[0-b][y]==null||""+this.rfv_nxpy[0-b][y]=="undefined"){this.rfv_nxpy[0-b][y] = this.randgen_rfh();}
if(this.rot_nxpy[0-b][y]==null||""+this.rot_nxpy[0-b][y]=="undefined"){this.rot_nxpy[0-b][y] = 0;}
}
}
else // pxpy
{
if(this.id0_pxpy[b]==null||""+this.id0_pxpy[b]=="undefined"){this.id0_pxpy[b]=[];}
if(this.id1_pxpy[b]==null||""+this.id1_pxpy[b]=="undefined"){this.id1_pxpy[b]=[];}
if(this.ids_pxpy[b]==null||""+this.ids_pxpy[b]=="undefined"){this.ids_pxpy[b]=[];}
if(this.ocu_pxpy[b]==null||""+this.ocu_pxpy[b]=="undefined"){this.ocu_pxpy[b]=[];}
if(this.rfh_pxpy[b]==null||""+this.rfh_pxpy[b]=="undefined"){this.rfh_pxpy[b]=[];}
if(this.rfv_pxpy[b]==null||""+this.rfv_pxpy[b]=="undefined"){this.rfv_pxpy[b]=[];}
if(this.rot_pxpy[b]==null||""+this.rot_pxpy[b]=="undefined"){this.rot_pxpy[b]=[];}
if(this.id0_pxpy[b][y]==null||""+this.id0_pxpy[b][y]=="undefined"){this.id0_pxpy[b][y] = this.cur_obj_id0;}
if(this.id1_pxpy[b][y]==null||""+this.id1_pxpy[b][y]=="undefined"){this.id1_pxpy[b][y] = this.cur_obj_id1;}
if(this.ocu_pxpy[b][y]==null||""+this.ocu_pxpy[b][y]=="undefined"){this.ocu_pxpy[b][y] = true;}
if(a == sx- 1)
{
if(this.ids_pxpy[b][y]==null ||""+this.ids_pxpy[b][y]=="undefined"){this.ids_pxpy[b][y]=this.randgen_wood_end(true);}
if(this.rfh_pxpy[b][y]==null ||""+this.rfh_pxpy[b][y]=="undefined"){this.rfh_pxpy[b][y]=this.randgen_rfh();}
if(this.rfv_pxpy[b][y]==null ||""+this.rfv_pxpy[b][y]=="undefined"){this.rfv_pxpy[b][y]= false;}
if(this.rot_pxpy[b][y]==null ||""+this.rot_pxpy[b][y]=="undefined"){this.rot_pxpy[b][y]=180;}
}
else
{
if(this.ids_pxpy[b][y]==null ||""+this.ids_pxpy[b][y]=="undefined"){this.ids_pxpy[b][y]=this.randgen_wood_mid();}
if(this.rfh_pxpy[b][y]==null ||""+this.rfh_pxpy[b][y]=="undefined"){this.rfh_pxpy[b][y]=this.randgen_rfh();}
if(this.rfv_pxpy[b][y]==null ||""+this.rfv_pxpy[b][y]=="undefined"){this.rfv_pxpy[b][y]=this.randgen_rfh();}
if(this.rot_pxpy[b][y]==null ||""+this.rot_pxpy[b][y]=="undefined"){this.rot_pxpy[b][y]=0;}
}
}
a = a+1;
}
this.update_cur_obj_idn();
}
}
else // rpx nxpy 2x2 or bigger
{
this.ids_nxpy[0-x][y] = this.randgen_wood_corner();
if(this.ids_nxpy[0-x][y]){this.sub_rpx_data_mt(x,y,sx,sy); this.update_cur_obj_idn();}
}
}
at = Object_types.get_obj_at(this.ids_nxpy[0-x][y]);
id0 = this.id0_nxpy[0-x][y]; id1 = this.id1_nxpy[0-x][y];
rfh = this.rfh_nxpy[0-x][y]; rfv = this.rfv_nxpy[0-x][y];
rot = this.rot_nxpy[0-x][y];
}
if(at != null && ""+at!="undefined")
{
create_x = this.half_scew + x* 64 - this.offsx; create_y = this.half_sceh + y*64 - this.offsy;
this.create_actor(at,create_x, create_y); this.actors[x][y] = this.last_created_actor;
this.actors[x][y].spinTo(rot,0,null);
if(rfh){this.actors[x][y].growTo(1,-1,0,null);} // axis based flipping
if(rfv){this.actors[x][y].growTo(-1,1,0,null);}
this.actors[x][y].setValue("Object_behav","id0",id0);
this.actors[x][y].setValue("Object_behav","id1",id1);
}
y = y+1;
}
}
else // rpx x > 0
{
while(y < ymax)
{
if(y < 0)
{
if(this.id0_pxny[x]==null ||""+ this.id0_pxny[x] == "undefined"){this.id0_pxny[x]=[];}
if(this.id1_pxny[x]==null ||""+ this.id1_pxny[x] == "undefined"){this.id1_pxny[x]=[];}
if(this.ids_pxny[x]==null ||""+ this.ids_pxny[x] == "undefined"){this.ids_pxny[x]=[];}
if(this.ocu_pxny[x]==null ||""+ this.ocu_pxny[x] == "undefined"){this.ocu_pxny[x]=[];}
if(this.rfh_pxny[x]==null ||""+ this.rfh_pxny[x] == "undefined"){this.rfh_pxny[x]=[];}
if(this.rfv_pxny[x]==null ||""+ this.rfv_pxny[x] == "undefined"){this.rfv_pxny[x]=[];}
if(this.rot_pxny[x]==null ||""+ this.rot_pxny[x] == "undefined"){this.rot_pxny[x]=[];}
if(this.ids_pxny[x][0-y] == null ||""+this.ids_pxny[x][0-y] == "undefined")
{
sx = 1 + Std.int(Math.floor(Math.random() * 3.99)); sy = 1 + Std.int(Math.floor(Math.random() * 3.99));
if(this.cek_ocu(x+1,y)){sx =1;}
else if(this.cek_ocu(x+2,y)){sx = Std.int(Math.min(2,sx));}
else if(this.cek_ocu(x+3,y)){sx = Std.int(Math.min(3,sx));}
if(this.cek_ocu(x,y+1)){sy = 1;}
else if(this.cek_ocu(x,y+2)){sy = Std.int(Math.min(2,sy));}
else if(this.cek_ocu(x,y+3)){sy = Std.int(Math.min(3,sy));}
if(sx == 1 && sy == 1)
{
this.ids_pxny[x][0-y] = this.randgen_wood_1t();
if(this.ids_pxny[x][0-y] != "")
{
if(this.id0_pxny[x][0-y]==null ||""+this.id0_pxny[x][0-y] == "undefined"){this.id0_pxny[x][0-y] = this.cur_obj_id0;}
if(this.id1_pxny[x][0-y]==null ||""+this.id1_pxny[x][0-y] == "undefined"){this.id1_pxny[x][0-y] = this.cur_obj_id0;}
if(this.ocu_pxny[x][0-y]==null ||""+this.ocu_pxny[x][0-y] == "undefined"){this.ocu_pxny[x][0-y] = true;}
if(this.rfh_pxny[x][0-y]==null ||""+this.rfh_pxny[x][0-y] == "undefined"){this.rfh_pxny[x][0-y] = this.randgen_rfh();}
if(this.rfv_pxny[x][0-y]==null ||""+this.rfv_pxny[x][0-y] == "undefined"){this.rfv_pxny[x][0-y] = this.randgen_rfh();}
if(this.rot_pxny[x][0-y]==null ||""+this.rot_pxny[x][0-y] == "undefined"){this.rot_pxny[x][0-y] = this.randgen_rot();}
this.update_cur_obj_idn();
}
}
else if (sx == 1 && sy > 1) // rpx pxny vertical
{
this.ids_pxny[x][0-y] = this.randgen_wood_end();
if(this.ids_pxny[x][0-y] != "")
{
if(y + sy > 0)
{
if(this.id0_pxpy[x] == null ||""+ this.id0_pxpy[x] == "undefined"){this.id0_pxpy[x] = [];}
if(this.id1_pxpy[x] == null ||""+ this.id1_pxpy[x] == "undefined"){this.id1_pxpy[x] = [];}
if(this.ids_pxpy[x] == null ||""+ this.ids_pxpy[x] == "undefined"){this.ids_pxpy[x] = [];}
if(this.ocu_pxpy[x] == null ||""+ this.ocu_pxpy[x] == "undefined"){this.ocu_pxpy[x] = [];}
if(this.rfh_pxpy[x] == null ||""+ this.rfh_pxpy[x] == "undefined"){this.rfh_pxpy[x] = [];}
if(this.rfv_pxpy[x] == null ||""+ this.rfv_pxpy[x] == "undefined"){this.rfv_pxpy[x] = [];}
if(this.rot_pxpy[x] == null ||""+ this.rot_pxpy[x] == "undefined"){this.rot_pxpy[x] = [];}
}
var a:Int =0, b:Int; while(a < sy)
{
b = y + a;
if(b < 0)
{
if(this.id0_pxny[x][0-b] == null ||""+ this.id0_pxny[x][0-b] == "undefined"){this.id0_pxny[x][0-b] = this.cur_obj_id0;}
if(this.id1_pxny[x][0-b] == null ||""+ this.id1_pxny[x][0-b] == "undefined"){this.id1_pxny[x][0-b] = this.cur_obj_id1;}
if(this.ocu_pxny[x][0-b] == null ||""+ this.ocu_pxny[x][0-b] == "undefined"){this.ocu_pxny[x][0-b] = true;}
if(a == 0)
{
if(this.rfh_pxny[x][0-y] == null ||""+ this.rfh_pxny[x][0-y] == "undefined"){this.rfh_pxny[x][0-y] = this.randgen_rfh();}
if(this.rfv_pxny[x][0-y] == null ||""+ this.rfv_pxny[x][0-y] == "undefined"){this.rfv_pxny[x][0-y] = false;}
if(this.rot_pxny[x][0-y] == null ||""+ this.rot_pxny[x][0-y] == "undefined"){this.rot_pxny[x][0-y] = 90;}
}
else if (a == sy - 1)
{
if(this.ids_pxny[x][0-b] == null ||""+ this.ids_pxny[x][0-b] == "undefined"){this.ids_pxny[x][0-b] = this.randgen_wood_end(true);}
if(this.rfh_pxny[x][0-b] == null ||""+ this.rfh_pxny[x][0-b] == "undefined"){this.rfh_pxny[x][0-b] = this.randgen_rfh();}
if(this.rfv_pxny[x][0-b] == null ||""+ this.rfv_pxny[x][0-b] == "undefined"){this.rfv_pxny[x][0-b] = false;}
if(this.rot_pxny[x][0-b] == null ||""+ this.rot_pxny[x][0-b] == "undefined"){this.rot_pxny[x][0-b] = 270;}
}
else
{
if(this.ids_pxny[x][0-b] == null ||""+ this.ids_pxny[x][0-b] == "undefined"){this.ids_pxny[x][0-b] = this.randgen_wood_mid();}
if(this.rfh_pxny[x][0-b] == null ||""+ this.rfh_pxny[x][0-b] == "undefined"){this.rfh_pxny[x][0-b] = this.randgen_rfh();}
if(this.rfv_pxny[x][0-b] == null ||""+ this.rfv_pxny[x][0-b] == "undefined"){this.rfv_pxny[x][0-b] = this.randgen_rfh();}
if(this.rot_pxny[x][0-b] == null ||""+ this.rot_pxny[x][0-b] == "undefined"){this.rot_pxny[x][0-b] = 90;}
}
}
else // bugs.
{ //
if(this.id0_pxpy[x][b] == null ||""+ this.id0_pxpy[x][b] == "undefined"){this.id0_pxpy[x][b] = this.cur_obj_id0;}
if(this.id1_pxpy[x][b] == null ||""+ this.id1_pxpy[x][b] == "undefined"){this.id1_pxpy[x][b] = this.cur_obj_id1;}
if(this.ocu_pxpy[x][b] == null ||""+ this.ocu_pxpy[x][b] == "undefined"){this.ocu_pxpy[x][b] = true;}
if (a == sy -1)
{ this.diag_cek_get +=1;
if(this.ids_pxpy[x][b] == null ||""+ this.ids_pxpy[x][b] == "undefined"){this.ids_pxpy[x][b] = this.randgen_wood_end(true);}
if(this.rfh_pxpy[x][b] == null ||""+ this.rfh_pxpy[x][b] == "undefined"){this.rfh_pxpy[x][b] = this.randgen_rfh();}
if(this.rfv_pxpy[x][b] == null ||""+ this.rfv_pxpy[x][b] == "undefined"){this.rfv_pxpy[x][b] = false;}
if(this.rot_pxpy[x][b] == null ||""+ this.rot_pxpy[x][b] == "undefined"){this.rot_pxpy[x][b] = 270;}
}
else
{
if(this.ids_pxpy[x][b] == null ||""+ this.ids_pxpy[x][b] == "undefined"){this.ids_pxpy[x][b] = this.randgen_wood_mid();}
if(this.rfh_pxpy[x][b] == null ||""+ this.rfh_pxpy[x][b] == "undefined"){this.rfh_pxpy[x][b] = this.randgen_rfh();}
if(this.rfv_pxpy[x][b] == null ||""+ this.rfv_pxpy[x][b] == "undefined"){this.rfv_pxpy[x][b] = false;}
if(this.rot_pxpy[x][b] == null ||""+ this.rot_pxpy[x][b] == "undefined"){this.rot_pxpy[x][b] = 270;}
}
}
a = a+1;
}
this.update_cur_obj_idn();
}
}
else if (sx > 1 && sy == 1) //rpx pxny horizontals - does not need to coinsider another side,
{
this.ids_pxny[x][0-y] = this.randgen_wood_end();
if(this.ids_pxny[x][0-y] != "")
{
var a: Int =0, b:Int; while(a < sx)
{
b = x+a;
if(this.id0_pxny[b] == null ||""+this.id0_pxny[b]=="undefined"){this.id0_pxny[b]=[];}
if(this.id1_pxny[b] == null ||""+this.id1_pxny[b]=="undefined"){this.id1_pxny[b]=[];}
if(this.ids_pxny[b] == null ||""+this.ids_pxny[b]=="undefined"){this.ids_pxny[b]=[];}
if(this.ocu_pxny[b] == null ||""+this.ocu_pxny[b]=="undefined"){this.ocu_pxny[b]=[];}
if(this.rfh_pxny[b] == null ||""+this.rfh_pxny[b]=="undefined"){this.rfh_pxny[b]=[];}
if(this.rfv_pxny[b] == null ||""+this.rfv_pxny[b]=="undefined"){this.rfv_pxny[b]=[];}
if(this.rot_pxny[b] == null ||""+this.rot_pxny[b]=="undefined"){this.rot_pxny[b]=[];}
if(this.id0_pxny[b][0-y] == null ||""+this.id0_pxny[b][0-y]=="undefined"){this.id0_pxny[b][0-y]= this.cur_obj_id0;}
if(this.id1_pxny[b][0-y] == null ||""+this.id1_pxny[b][0-y]=="undefined"){this.id1_pxny[b][0-y]= this.cur_obj_id1;}
if(this.ocu_pxny[b][0-y] == null ||""+this.ocu_pxny[b][0-y]=="undefined"){this.ocu_pxny[b][0-y]= true;}
if (a == 0)
{
if(this.rfh_pxny[x][0-y] == null ||""+this.rfh_pxny[x][0-y] == "undefined"){this.rfh_pxny[x][0-y] = this.randgen_rfh();}
if(this.rfv_pxny[x][0-y] == null ||""+this.rfv_pxny[x][0-y] == "undefined"){this.rfv_pxny[x][0-y] = false;}
if(this.rot_pxny[x][0-y] == null ||""+this.rot_pxny[x][0-y] == "undefined"){this.rot_pxny[x][0-y] = 0;}
}
else if (a == sx -1)
{
if(this.ids_pxny[b][0-y] == null ||""+this.ids_pxny[b][0-y] == "undefined"){this.ids_pxny[b][0-y] = this.randgen_wood_end(true);}
if(this.rfh_pxny[b][0-y] == null ||""+this.rfh_pxny[b][0-y] == "undefined"){this.rfh_pxny[b][0-y] = this.randgen_rfh();}
if(this.rfv_pxny[b][0-y] == null ||""+this.rfv_pxny[b][0-y] == "undefined"){this.rfv_pxny[b][0-y] = false;}
if(this.rot_pxny[b][0-y] == null ||""+this.rot_pxny[b][0-y] == "undefined"){this.rot_pxny[b][0-y] = 180;}
}
else
{
if(this.ids_pxny[b][0-y] == null ||""+this.ids_pxny[b][0-y] == "undefined"){this.ids_pxny[b][0-y] = this.randgen_wood_mid();}
if(this.rfh_pxny[b][0-y] == null ||""+this.rfh_pxny[b][0-y] == "undefined"){this.rfh_pxny[b][0-y] = this.randgen_rfh();}
if(this.rfv_pxny[b][0-y] == null ||""+this.rfv_pxny[b][0-y] == "undefined"){this.rfv_pxny[b][0-y] = this.randgen_rfh();}
if(this.rot_pxny[b][0-y] == null ||""+this.rot_pxny[b][0-y] == "undefined"){this.rot_pxny[b][0-y] = 0;}
}
a = a+1;
}
this.update_cur_obj_idn();
}
}
else
{
this.ids_pxny[x][0-y] = this.randgen_wood_corner();
if(this.ids_pxny[x][0-y] != ""){this.sub_rpx_data_mt(x,y,sx,sy); this.update_cur_obj_idn(); }
}
}
at = Object_types.get_obj_at(this.ids_pxny[x][0-y]);
id0 = this.id0_pxny[x][0-y]; id1 = this.id1_pxny[x][0-y];
rfh = this.rfh_pxny[x][0-y]; rfv = this.rfv_pxny[x][0-y];
rot = this.rot_pxny[x][0-y];
}
else
{
if(this.id0_pxpy[x]==null ||""+ this.id0_pxpy[x] == "undefined"){this.id0_pxpy[x]=[];}
if(this.id1_pxpy[x]==null ||""+ this.id1_pxpy[x] == "undefined"){this.id1_pxpy[x]=[];}
if(this.ids_pxpy[x]==null ||""+ this.ids_pxpy[x] == "undefined"){this.ids_pxpy[x]=[];}
if(this.ocu_pxpy[x]==null ||""+ this.ocu_pxpy[x] == "undefined"){this.ocu_pxpy[x]=[];}
if(this.rfh_pxpy[x]==null ||""+ this.rfh_pxpy[x] == "undefined"){this.rfh_pxpy[x]=[];}
if(this.rfv_pxpy[x]==null ||""+ this.rfv_pxpy[x] == "undefined"){this.rfv_pxpy[x]=[];}
if(this.rot_pxpy[x]==null ||""+ this.rot_pxpy[x] == "undefined"){this.rot_pxpy[x]=[];}
if(this.ids_pxpy[x][y] == null ||""+this.ids_pxpy[x][y] == "undefined")
{
sx = 1 + Std.int(Math.floor(Math.random() * 3.99)); sy = 1 + Std.int(Math.floor(Math.random() * 3.99));
if(this.cek_ocu(x+1,y)){sx =1;}
else if(this.cek_ocu(x+2,y)){sx = Std.int(Math.min(2,sx));}
else if(this.cek_ocu(x+3,y)){sx = Std.int(Math.min(3,sx));}
if(this.cek_ocu(x,y+1)){sy = 1;}
else if(this.cek_ocu(x,y+2)){sy = Std.int(Math.min(2,sy));}
else if(this.cek_ocu(x,y+3)){sy = Std.int(Math.min(3,sy));}
if(sx == 1 && sy == 1)
{
this.ids_pxpy[x][y] = this.randgen_wood_1t();
if(this.ids_pxpy[x][y] != null)
{
if(this.id0_pxpy[x][y]==null ||""+this.id0_pxpy[x][y]=="undefined"){this.id0_pxpy[x][y]=this.cur_obj_id0;}
if(this.id1_pxpy[x][y]==null ||""+this.id1_pxpy[x][y]=="undefined"){this.id1_pxpy[x][y]=this.cur_obj_id1;}
if(this.ocu_pxpy[x][y]==null ||""+this.ocu_pxpy[x][y]=="undefined"){this.ocu_pxpy[x][y]=true;}
if(this.rfh_pxpy[x][y]==null ||""+this.rfh_pxpy[x][y]=="undefined"){this.rfh_pxpy[x][y]=this.randgen_rfh();}
if(this.rfv_pxpy[x][y]==null ||""+this.rfv_pxpy[x][y]=="undefined"){this.rfv_pxpy[x][y]=this.randgen_rfh();}
if(this.rot_pxpy[x][y]==null ||""+this.rot_pxpy[x][y]=="undefined"){this.rot_pxpy[x][y]=this.randgen_rot();}
this.update_cur_obj_idn();
}
}
else if(sx == 1 && sy > 1) // rpx pxpy vertical - renders downwards no pxny
{
this.ids_pxpy[x][y] = this.randgen_wood_end();
if(this.ids_pxpy[x][y] != "")
{
var a:Int =0; var b: Int; while (a < sy)
{
b = y+a;
if(this.id0_pxpy[x][b] == null ||""+ this.id0_pxpy[x][b] == "undefined"){this.id0_pxpy[x][b] = this.cur_obj_id0;}
if(this.id1_pxpy[x][b] == null ||""+ this.id1_pxpy[x][b] == "undefined"){this.id1_pxpy[x][b] = this.cur_obj_id1;}
if(this.ocu_pxpy[x][b] == null ||""+ this.ocu_pxpy[x][b] == "undefined"){this.ocu_pxpy[x][b] = true;}
if(a == 0) // top end
{
if(this.rfh_pxpy[x][y] == null ||""+ this.rfh_pxpy[x][y] == "undefined"){this.rfh_pxpy[x][y] = this.randgen_rfh();}
if(this.rfv_pxpy[x][y] == null ||""+ this.rfv_pxpy[x][y] == "undefined"){this.rfv_pxpy[x][y] = false;}
if(this.rot_pxpy[x][y] == null ||""+ this.rot_pxpy[x][y] == "undefined"){this.rot_pxpy[x][y] = 90;}
}
else if (a == sy -1)
{
if(this.ids_pxpy[x][b] == null ||""+ this.ids_pxpy[x][b] == "undefined"){this.ids_pxpy[x][b] = this.randgen_wood_end(true);}
if(this.rfh_pxpy[x][b] == null ||""+ this.rfh_pxpy[x][b] == "undefined"){this.rfh_pxpy[x][b] = this.randgen_rfh();}
if(this.rfv_pxpy[x][b] == null ||""+ this.rfv_pxpy[x][b] == "undefined"){this.rfv_pxpy[x][b] = false;}
if(this.rot_pxpy[x][b] == null ||""+ this.rot_pxpy[x][b] == "undefined"){this.rot_pxpy[x][b] = 270;}
}
else
{
if(this.ids_pxpy[x][b] == null ||""+ this.ids_pxpy[x][b] == "undefined"){this.ids_pxpy[x][b] = this.randgen_wood_mid();}
if(this.rfh_pxpy[x][b] == null ||""+ this.rfh_pxpy[x][b] == "undefined"){this.rfh_pxpy[x][b] = this.randgen_rfh();}
if(this.rfv_pxpy[x][b] == null ||""+ this.rfv_pxpy[x][b] == "undefined"){this.rfv_pxpy[x][b] = this.randgen_rfh();}
if(this.rot_pxpy[x][b] == null ||""+ this.rot_pxpy[x][b] == "undefined"){this.rot_pxpy[x][b] = 90;}
}
a = a+1;
}
this.update_cur_obj_idn();
}
}
else if(sx > 1 && sy == 1) // rpy pxpy horizontal
{
this.ids_pxpy[x][y] = this.randgen_wood_end();
if(this.ids_pxpy[x][y] != "")
{
var a:Int =0; var b: Int; while (a < sx)
{
b = x+a;
if(this.id0_pxpy[b]==null ||""+ this.id0_pxpy[b] == "undefined"){this.id0_pxpy[b]=[];}
if(this.id1_pxpy[b]==null ||""+ this.id1_pxpy[b] == "undefined"){this.id1_pxpy[b]=[];}
if(this.ids_pxpy[b]==null ||""+ this.ids_pxpy[b] == "undefined"){this.ids_pxpy[b]=[];}
if(this.ocu_pxpy[b]==null ||""+ this.ocu_pxpy[b] == "undefined"){this.ocu_pxpy[b]=[];}
if(this.rfh_pxpy[b]==null ||""+ this.rfh_pxpy[b] == "undefined"){this.rfh_pxpy[b]=[];}
if(this.rfv_pxpy[b]==null ||""+ this.rfv_pxpy[b] == "undefined"){this.rfv_pxpy[b]=[];}
if(this.rot_pxpy[b]==null ||""+ this.rot_pxpy[b] == "undefined"){this.rot_pxpy[b]=[];}
if(this.id0_pxpy[b][y]==null ||""+ this.id0_pxpy[b][y] == "undefined"){this.id0_pxpy[b][y]=this.cur_obj_id0;}
if(this.id1_pxpy[b][y]==null ||""+ this.id1_pxpy[b][y] == "undefined"){this.id1_pxpy[b][y]=this.cur_obj_id1;}
if(this.ocu_pxpy[b][y]==null ||""+ this.ocu_pxpy[b][y] == "undefined"){this.ocu_pxpy[b][y]=true;}
if(a == 0)
{
if(this.rfh_pxpy[x][y] == null ||""+ this.rfh_pxpy[x][y] == "undefined"){this.rfh_pxpy[x][y] = this.randgen_rfh();}
if(this.rfv_pxpy[x][y] == null ||""+ this.rfv_pxpy[x][y] == "undefined"){this.rfv_pxpy[x][y] = false;}
if(this.rot_pxpy[x][y] == null ||""+ this.rot_pxpy[x][y] == "undefined"){this.rot_pxpy[x][y] = 0;}
}
else if (a == sx-1)
{
if(this.ids_pxpy[b][y] == null ||""+ this.ids_pxpy[b][y] == "undefined"){this.ids_pxpy[b][y] = this.randgen_wood_end(true);}
if(this.rfh_pxpy[b][y] == null ||""+ this.rfh_pxpy[b][y] == "undefined"){this.rfh_pxpy[b][y] = this.randgen_rfh();}
if(this.rfv_pxpy[b][y] == null ||""+ this.rfv_pxpy[b][y] == "undefined"){this.rfv_pxpy[b][y] = false;}
if(this.rot_pxpy[b][y] == null ||""+ this.rot_pxpy[b][y] == "undefined"){this.rot_pxpy[b][y] = 180;}
}
else
{
if(this.ids_pxpy[b][y] == null ||""+ this.ids_pxpy[b][y] == "undefined"){this.ids_pxpy[b][y] = this.randgen_wood_mid();}
if(this.rfh_pxpy[b][y] == null ||""+ this.rfh_pxpy[b][y] == "undefined"){this.rfh_pxpy[b][y] = this.randgen_rfh();}
if(this.rfv_pxpy[b][y] == null ||""+ this.rfv_pxpy[b][y] == "undefined"){this.rfv_pxpy[b][y] = this.randgen_rfh();}
if(this.rot_pxpy[b][y] == null ||""+ this.rot_pxpy[b][y] == "undefined"){this.rot_pxpy[b][y] = 0;}
}
a = a+1;
}
this.update_cur_obj_idn();
}
}
else
{
this.ids_pxpy[x][y] = this.randgen_wood_corner();
if(this.ids_pxpy[x][y] != ""){this.sub_rpx_data_mt(x,y,sx,sy); this.update_cur_obj_idn();}
}
}
at = Object_types.get_obj_at(this.ids_pxpy[x][y]);
id0 = this.id0_pxpy[x][y]; id1 = this.id1_pxpy[x][y];
rfh = this.rfh_pxpy[x][y]; rfv = this.rfv_pxpy[x][y];
rot = this.rot_pxpy[x][y];
}
if(at != null && ""+at!="undefined")
{
create_x = this.half_scew + x* 64 - this.offsx; create_y = this.half_sceh + y*64 - this.offsy;
this.create_actor(at,create_x, create_y); this.actors[x][y] = this.last_created_actor;
this.actors[x][y].spinTo(rot,0,null);
if(rfh){this.actors[x][y].growTo(1,-1,0,null);} // axis based flipping
if(rfv){this.actors[x][y].growTo(-1,1,0,null);}
this.actors[x][y].setValue("Object_behav","id0",id0);
this.actors[x][y].setValue("Object_behav","id1",id1);
}
y = y+1;
}
}
}
public function rpy(y,xmax,xmin) // horizontal reading
{
var x:Int = xmin; var id0:Int, id1:Int; var create_x:Float, create_y:Float; var rfh:Bool, rfv:Bool; var rot:Float;
var sx:Int, sy:Int; var at:ActorType = null;
if(y < 0)
{
while(x < xmax)
{
if(this.actors[x]==null ||""+ this.actors[x] == "undefined"){this.actors[x] = [];}
if(x < 0) //nxny
{
if(this.id0_nxny[0-x]==null ||""+ this.id0_nxny[0-x]== "undefined"){this.id0_nxny[0-x]=[];}
if(this.id1_nxny[0-x]==null ||""+ this.id1_nxny[0-x]== "undefined"){this.id1_nxny[0-x]=[];}
if(this.ids_nxny[0-x]==null ||""+ this.ids_nxny[0-x]== "undefined"){this.ids_nxny[0-x]=[];}
if(this.ocu_nxny[0-x]==null ||""+ this.ocu_nxny[0-x]== "undefined"){this.ocu_nxny[0-x]=[];}
if(this.rfh_nxny[0-x]==null ||""+ this.rfh_nxny[0-x]== "undefined"){this.rfh_nxny[0-x]=[];}
if(this.rfv_nxny[0-x]==null ||""+ this.rfv_nxny[0-x]== "undefined"){this.rfv_nxny[0-x]=[];}
if(this.rot_nxny[0-x]==null ||""+ this.rot_nxny[0-x]== "undefined"){this.rot_nxny[0-x]=[];}
if(this.ids_nxny[0-x][0-y]==null ||""+ this.ids_nxny[0-x][0-y]== "undefined")
{
sx = 1 + Std.int(Math.floor(Math.random() * 3.99)); sy = 1 + Std.int(Math.floor(Math.random() * 3.99));
if(this.cek_ocu(x+1,y)){sx =1;}
else if(this.cek_ocu(x+2,y)){sx = Std.int(Math.min(2,sx));}
else if(this.cek_ocu(x+3,y)){sx = Std.int(Math.min(3,sx));}
if(this.cek_ocu(x,y+1)){sy = 1;}
else if(this.cek_ocu(x,y+2)){sy = Std.int(Math.min(2,sy));}
else if(this.cek_ocu(x,y+3)){sy = Std.int(Math.min(3,sy));}
if (sx == 1 && sy == 1)
{
this.ids_nxny[0-x][0-y] = this.randgen_wood_1t();
if(this.ids_nxny[0-x][0-y] != "")
{
if(this.id0_nxny[0-x][0-y] == null ||""+this.id0_nxny[0-x][0-y] =="undefined"){this.id0_nxny[0-x][0-y]= this.cur_obj_id0;}
if(this.id1_nxny[0-x][0-y] == null ||""+this.id1_nxny[0-x][0-y] =="undefined"){this.id1_nxny[0-x][0-y]= this.cur_obj_id1;}
if(this.ocu_nxny[0-x][0-y] == null ||""+this.ocu_nxny[0-x][0-y] =="undefined"){this.ocu_nxny[0-x][0-y]= true;}
if(this.rfh_nxny[0-x][0-y] == null ||""+this.rfh_nxny[0-x][0-y] =="undefined"){this.rfh_nxny[0-x][0-y]= this.randgen_rfh();}
if(this.rfv_nxny[0-x][0-y] == null ||""+this.rfv_nxny[0-x][0-y] =="undefined"){this.rfv_nxny[0-x][0-y]= this.randgen_rfh();}
if(this.rot_nxny[0-x][0-y] == null ||""+this.rot_nxny[0-x][0-y] =="undefined"){this.rot_nxny[0-x][0-y]= this.randgen_rot();}
this.update_cur_obj_idn();
}
}
else if(sx == 1 && sy > 1) // rpy nxny vertical
{
this.ids_nxny[0-x][0-y] = this.randgen_wood_end();
if(this.ids_nxny[0-x][0-y]!="") // creating initialising the first object tile data.
{
if(y + sy > 0) // initialize nxpy data.
{
if(this.id0_nxpy[0-x]==null||""+this.id0_nxpy[0-x]=="undefined"){this.id0_nxpy[0-x]=[];}
if(this.id1_nxpy[0-x]==null||""+this.id1_nxpy[0-x]=="undefined"){this.id1_nxpy[0-x]=[];}
if(this.ids_nxpy[0-x]==null||""+this.ids_nxpy[0-x]=="undefined"){this.ids_nxpy[0-x]=[];}
if(this.ocu_nxpy[0-x]==null||""+this.ocu_nxpy[0-x]=="undefined"){this.ocu_nxpy[0-x]=[];}
if(this.rfh_nxpy[0-x]==null||""+this.rfh_nxpy[0-x]=="undefined"){this.rfh_nxpy[0-x]=[];}
if(this.rfv_nxpy[0-x]==null||""+this.rfv_nxpy[0-x]=="undefined"){this.rfv_nxpy[0-x]=[];}
if(this.rot_nxpy[0-x]==null||""+this.rot_nxpy[0-x]=="undefined"){this.rot_nxpy[0-x]=[];}
}
var b:Int =0;
var a:Int =0; while(a < sy)
{
b = y+a;
if(b < 0) // the flips wen use by axis, not scale factor;
{
if(this.id0_nxny[0-x][0-b]==null||""+this.id0_nxny[0-x][0-b]=="undefined"){this.id0_nxny[0-x][0-b]=this.cur_obj_id0;}
if(this.id1_nxny[0-x][0-b]==null||""+this.id1_nxny[0-x][0-b]=="undefined"){this.id1_nxny[0-x][0-b]=this.cur_obj_id1;}
if(this.ocu_nxny[0-x][0-b]==null||""+this.ocu_nxny[0-x][0-b]=="undefined"){this.ocu_nxny[0-x][0-b]=true;}
if(a == 0) // problem found in data change
{
if(this.rfh_nxny[0-x][0-y]==null||""+this.rfh_nxny[0-x][0-y]=="undefined"){this.rfh_nxny[0-x][0-y]=this.randgen_rfh();}
if(this.rfv_nxny[0-x][0-y]==null||""+this.rfv_nxny[0-x][0-y]=="undefined"){this.rfv_nxny[0-x][0-y]=false;}
if(this.rot_nxny[0-x][0-y]==null||""+this.rot_nxny[0-x][0-y]=="undefined"){this.rot_nxny[0-x][0-y]=90;}
}
else if(a == sy-1) // bugs in rendering
{
if(this.ids_nxny[0-x][0-b]==null||""+this.ids_nxny[0-x][0-b]=="undefined"){this.ids_nxny[0-x][0-b]=this.randgen_wood_end(true);}
if(this.rfh_nxny[0-x][0-b]==null||""+this.rfh_nxny[0-x][0-b]=="undefined"){this.rfh_nxny[0-x][0-b]=this.randgen_rfh();}
if(this.rfv_nxny[0-x][0-b]==null||""+this.rfv_nxny[0-x][0-b]=="undefined"){this.rfv_nxny[0-x][0-b]=false;}
if(this.rot_nxny[0-x][0-b]==null||""+this.rot_nxny[0-x][0-b]=="undefined"){this.rot_nxny[0-x][0-b]=270;}
}
else // middle part for nxny;
{
if(this.ids_nxny[0-x][0-b]==null||""+this.ids_nxny[0-x][0-b]=="undefined"){this.ids_nxny[0-x][0-b]=this.randgen_wood_mid();}
if(this.rfh_nxny[0-x][0-b]==null||""+this.rfh_nxny[0-x][0-b]=="undefined"){this.rfh_nxny[0-x][0-b]=this.randgen_rfh();}
if(this.rfv_nxny[0-x][0-b]==null||""+this.rfv_nxny[0-x][0-b]=="undefined"){this.rfv_nxny[0-x][0-b]=this.randgen_rfh();}
if(this.rot_nxny[0-x][0-b]==null||""+this.rot_nxny[0-x][0-b]=="undefined"){this.rot_nxny[0-x][0-b]=90;}
}
}
else
{
if(this.id0_nxpy[0-x][b]==null||""+this.id0_nxpy[0-x][b]=="undefined"){this.id0_nxpy[0-x][b]=this.cur_obj_id0;}
if(this.id1_nxpy[0-x][b]==null||""+this.id1_nxpy[0-x][b]=="undefined"){this.id1_nxpy[0-x][b]=this.cur_obj_id1;}
if(this.ocu_nxpy[0-x][b]==null||""+this.ocu_nxpy[0-x][b]=="undefined"){this.ocu_nxpy[0-x][b]=true;}
if(a == sy -1)
{
if(this.ids_nxpy[0-x][b]==null||""+this.ids_nxpy[0-x][b]=="undefined"){this.ids_nxpy[0-x][b]=this.randgen_wood_end(true);}
if(this.rfh_nxpy[0-x][b]==null||""+this.rfh_nxpy[0-x][b]=="undefined"){this.rfh_nxpy[0-x][b]=false;}
if(this.rfv_nxpy[0-x][b]==null||""+this.rfv_nxpy[0-x][b]=="undefined"){this.rfv_nxpy[0-x][b]=this.randgen_rfh();}
if(this.rot_nxpy[0-x][b]==null||""+this.rot_nxpy[0-x][b]=="undefined"){this.rot_nxpy[0-x][b]=270;}
}
else
{
if(this.ids_nxpy[0-x][b]==null||""+this.ids_nxpy[0-x][b]=="undefined"){this.ids_nxpy[0-x][b]=this.randgen_wood_mid();}
if(this.rfh_nxpy[0-x][b]==null||""+this.rfh_nxpy[0-x][b]=="undefined"){this.rfh_nxpy[0-x][b]=this.randgen_rfh();}
if(this.rfv_nxpy[0-x][b]==null||""+this.rfv_nxpy[0-x][b]=="undefined"){this.rfv_nxpy[0-x][b]=this.randgen_rfh();}
if(this.rot_nxpy[0-x][b]==null||""+this.rot_nxpy[0-x][b]=="undefined"){this.rot_nxpy[0-x][b]=90;}
}
}
a=a+1;
}
this.update_cur_obj_idn();
}
}
else if(sx > 1 && sy == 1) // rpy nxny horizontal
{
this.ids_nxny[0-x][0-y] = this.randgen_wood_end();
{
if(this.ids_nxny[0-x][0-y] !="")
{
var a:Int = 0; var b:Int; while(a < sx)
{ b = x + a; // rendering to the right.
if(b < 0)
{
if(this.id0_nxny[0-b]==null ||""+this.id0_nxny[0-b]=="undefined"){this.id0_nxny[0-b]=[];}
if(this.id1_nxny[0-b]==null ||""+this.id1_nxny[0-b]=="undefined"){this.id1_nxny[0-b]=[];}
if(this.ids_nxny[0-b]==null ||""+this.ids_nxny[0-b]=="undefined"){this.ids_nxny[0-b]=[];}
if(this.ocu_nxny[0-b]==null ||""+this.ocu_nxny[0-b]=="undefined"){this.ocu_nxny[0-b]=[];}
if(this.rfh_nxny[0-b]==null ||""+this.rfh_nxny[0-b]=="undefined"){this.rfh_nxny[0-b]=[];}
if(this.rfv_nxny[0-b]==null ||""+this.rfv_nxny[0-b]=="undefined"){this.rfv_nxny[0-b]=[];}
if(this.rot_nxny[0-b]==null ||""+this.rot_nxny[0-b]=="undefined"){this.rot_nxny[0-b]=[];}
if(this.id0_nxny[0-b][0-y]==null ||""+this.id0_nxny[0-b][0-y]=="undefined"){this.id0_nxny[0-b][0-y]= this.cur_obj_id0;}
if(this.id1_nxny[0-b][0-y]==null ||""+this.id1_nxny[0-b][0-y]=="undefined"){this.id1_nxny[0-b][0-y]= this.cur_obj_id1;}
if(this.ocu_nxny[0-b][0-y]==null ||""+this.ocu_nxny[0-b][0-y]=="undefined"){this.ocu_nxny[0-b][0-y]= true;}
if(a == 0)
{
if(this.rfh_nxny[0-x][0-y]== null ||""+this.rfh_nxny[0-x][0-y]=="undefined"){this.rfh_nxny[0-x][0-y] = this.randgen_rfh();}
if(this.rfv_nxny[0-x][0-y]== null ||""+this.rfv_nxny[0-x][0-y]=="undefined"){this.rfv_nxny[0-x][0-y] = false;}
if(this.rot_nxny[0-x][0-y]== null ||""+this.rot_nxny[0-x][0-y]=="undefined"){this.rot_nxny[0-x][0-y] = 0;}
}
else if (a == sx -1)
{
if(this.ids_nxny[0-b][0-y]== null ||""+this.ids_nxny[0-b][0-y]=="undefined"){this.ids_nxny[0-b][0-y] = this.randgen_wood_end(true);}
if(this.rfh_nxny[0-b][0-y]== null ||""+this.rfh_nxny[0-b][0-y]=="undefined"){this.rfh_nxny[0-b][0-y] = this.randgen_rfh();}
if(this.rfv_nxny[0-b][0-y]== null ||""+this.rfv_nxny[0-b][0-y]=="undefined"){this.rfv_nxny[0-b][0-y] = false;}
if(this.rot_nxny[0-b][0-y]== null ||""+this.rot_nxny[0-b][0-y]=="undefined"){this.rot_nxny[0-b][0-y] = 180;}
}
else
{
if(this.ids_nxny[0-b][0-y]== null ||""+this.ids_nxny[0-b][0-y]=="undefined"){this.ids_nxny[0-b][0-y] = this.randgen_wood_mid();}
if(this.rfh_nxny[0-b][0-y]== null ||""+this.rfh_nxny[0-b][0-y]=="undefined"){this.rfh_nxny[0-b][0-y] = this.randgen_rfh();}
if(this.rfv_nxny[0-b][0-y]== null ||""+this.rfv_nxny[0-b][0-y]=="undefined"){this.rfv_nxny[0-b][0-y] = this.randgen_rfh();}
if(this.rot_nxny[0-b][0-y]== null ||""+this.rot_nxny[0-b][0-y]=="undefined"){this.rot_nxny[0-b][0-y] = 0;}
}
}
else
{
if(this.id0_pxny[b]==null ||""+this.id0_pxny[b]=="undefined"){this.id0_pxny[b]=[];}
if(this.id1_pxny[b]==null ||""+this.id1_pxny[b]=="undefined"){this.id1_pxny[b]=[];}
if(this.ids_pxny[b]==null ||""+this.ids_pxny[b]=="undefined"){this.ids_pxny[b]=[];}
if(this.ocu_pxny[b]==null ||""+this.ocu_pxny[b]=="undefined"){this.ocu_pxny[b]=[];}
if(this.rfh_pxny[b]==null ||""+this.rfh_pxny[b]=="undefined"){this.rfh_pxny[b]=[];}
if(this.rfv_pxny[b]==null ||""+this.rfv_pxny[b]=="undefined"){this.rfv_pxny[b]=[];}
if(this.rot_pxny[b]==null ||""+this.rot_pxny[b]=="undefined"){this.rot_pxny[b]=[];}
if(this.id0_pxny[b][0-y]==null ||""+this.id0_pxny[b][0-y]=="undefined"){this.id0_pxny[b][0-y]= this.cur_obj_id0;}
if(this.id1_pxny[b][0-y]==null ||""+this.id1_pxny[b][0-y]=="undefined"){this.id1_pxny[b][0-y]= this.cur_obj_id1;}
if(this.ocu_pxny[b][0-y]==null ||""+this.ocu_pxny[b][0-y]=="undefined"){this.ocu_pxny[b][0-y]= true;}
if (a == sx -1)
{
if(this.ids_pxny[b][0-y]== null ||""+this.ids_pxny[b][0-y]=="undefined"){this.ids_pxny[b][0-y] = this.randgen_wood_end(true);}
if(this.rfh_pxny[b][0-y]== null ||""+this.rfh_pxny[b][0-y]=="undefined"){this.rfh_pxny[b][0-y] = this.randgen_rfh();}
if(this.rfv_pxny[b][0-y]== null ||""+this.rfv_pxny[b][0-y]=="undefined"){this.rfv_pxny[b][0-y] = false;}
if(this.rot_pxny[b][0-y]== null ||""+this.rot_pxny[b][0-y]=="undefined"){this.rot_pxny[b][0-y] = 180;}
}
else
{
if(this.ids_pxny[b][0-y]== null ||""+this.ids_pxny[b][0-y]=="undefined"){this.ids_pxny[b][0-y] = this.randgen_wood_mid();}
if(this.rfh_pxny[b][0-y]== null ||""+this.rfh_pxny[b][0-y]=="undefined"){this.rfh_pxny[b][0-y] = this.randgen_rfh();}
if(this.rfv_pxny[b][0-y]== null ||""+this.rfv_pxny[b][0-y]=="undefined"){this.rfv_pxny[b][0-y] = this.randgen_rfh();}
if(this.rot_pxny[b][0-y]== null ||""+this.rot_pxny[b][0-y]=="undefined"){this.rot_pxny[b][0-y] = 0;}
}
}
a = a+1;
}
this.update_cur_obj_idn();
}
}
}
else // rpy nxny for 2x2 or larger
{
this.ids_nxny[0-x][0-y] = this.randgen_wood_corner();
if(this.ids_nxny[0-x][0-y] != ""){this.sub_rpx_data_mt(x,y,sx,sy); this.update_cur_obj_idn();}
}
}
at = Object_types.get_obj_at(this.ids_nxny[0-x][0-y]);
id0 = this.id0_nxny[0-x][0-y]; id1 = this.id1_nxny[0-x][0-y];
rfh = this.rfh_nxny[0-x][0-y]; rfv = this.rfv_nxny[0-x][0-y];
rot = this.rot_nxny[0-x][0-y];
}
else // pxny
{
if(this.id0_pxny[x]==null ||""+ this.id0_pxny[x]== "undefined"){this.id0_pxny[x]=[];}
if(this.id1_pxny[x]==null ||""+ this.id1_pxny[x]== "undefined"){this.id1_pxny[x]=[];}
if(this.ids_pxny[x]==null ||""+ this.ids_pxny[x]== "undefined"){this.ids_pxny[x]=[];}
if(this.ocu_pxny[x]==null ||""+ this.ocu_pxny[x]== "undefined"){this.ocu_pxny[x]=[];}
if(this.rfh_pxny[x]==null ||""+ this.rfh_pxny[x]== "undefined"){this.rfh_pxny[x]=[];}
if(this.rfv_pxny[x]==null ||""+ this.rfv_pxny[x]== "undefined"){this.rfv_pxny[x]=[];}
if(this.rot_pxny[x]==null ||""+ this.rot_pxny[x]== "undefined"){this.rot_pxny[x]=[];}
if(this.ids_pxny[x][0-y]==null ||""+ this.ids_pxny[x][0-y]== "undefined")
{
sx = 1 + Std.int(Math.floor(Math.random() * 3.99)); sy = 1 + Std.int(Math.floor(Math.random() * 3.99));
if(this.cek_ocu(x+1,y)){sx =1;}
else if(this.cek_ocu(x+2,y)){sx = Std.int(Math.min(2,sx));}
else if(this.cek_ocu(x+3,y)){sx = Std.int(Math.min(3,sx));}
if(this.cek_ocu(x,y+1)){sy = 1;}
else if(this.cek_ocu(x,y+2)){sy = Std.int(Math.min(2,sy));}
else if(this.cek_ocu(x,y+3)){sy = Std.int(Math.min(3,sy));}
if(sx == 1 && sy == 1)
{
this.ids_pxny[x][0-y] = this.randgen_wood_1t();
if(this.ids_pxny[x][0-y] != "")
{
if(this.id0_pxny[x][0-y]==null ||""+this.id0_pxny[x][0-y] == "undefined"){this.id0_pxny[x][0-y] = this.cur_obj_id0;}
if(this.id1_pxny[x][0-y]==null ||""+this.id1_pxny[x][0-y] == "undefined"){this.id1_pxny[x][0-y] = this.cur_obj_id1;}
if(this.ocu_pxny[x][0-y]==null ||""+this.ocu_pxny[x][0-y] == "undefined"){this.ocu_pxny[x][0-y] = true;}
if(this.rfh_pxny[x][0-y]==null ||""+this.rfh_pxny[x][0-y] == "undefined"){this.rfh_pxny[x][0-y] = this.randgen_rfh();}
if(this.rfv_pxny[x][0-y]==null ||""+this.rfv_pxny[x][0-y] == "undefined"){this.rfv_pxny[x][0-y] = this.randgen_rfh();}
if(this.rot_pxny[x][0-y]==null ||""+this.rot_pxny[x][0-y] == "undefined"){this.rot_pxny[x][0-y] = this.randgen_rot();}
this.update_cur_obj_idn();
}
}
else if (sx == 1 && sy > 1) // rpy pxny vertical
{
this.ids_pxny[x][0-y] = this.randgen_wood_end();
if(this.ids_pxny[x][0-y] != "")
{
if(y + sy > 0)
{
if(this.id0_pxpy[x] == null ||""+ this.id0_pxpy[x] == "undefined"){this.id0_pxpy[x] = [];}
if(this.id1_pxpy[x] == null ||""+ this.id1_pxpy[x] == "undefined"){this.id1_pxpy[x] = [];}
if(this.ids_pxpy[x] == null ||""+ this.ids_pxpy[x] == "undefined"){this.ids_pxpy[x] = [];}
if(this.ocu_pxpy[x] == null ||""+ this.ocu_pxpy[x] == "undefined"){this.ocu_pxpy[x] = [];}
if(this.rfh_pxpy[x] == null ||""+ this.rfh_pxpy[x] == "undefined"){this.rfh_pxpy[x] = [];}
if(this.rfv_pxpy[x] == null ||""+ this.rfv_pxpy[x] == "undefined"){this.rfv_pxpy[x] = [];}
if(this.rot_pxpy[x] == null ||""+ this.rot_pxpy[x] == "undefined"){this.rot_pxpy[x] = [];}
}
var a:Int =0, b:Int; while(a < sy)
{
b = y + a;
if(b < 0)
{
if(this.id0_pxny[x][0-b] == null ||""+ this.id0_pxny[x][0-b] == "undefined"){this.id0_pxny[x][0-b] = this.cur_obj_id0;}
if(this.id1_pxny[x][0-b] == null ||""+ this.id1_pxny[x][0-b] == "undefined"){this.id1_pxny[x][0-b] = this.cur_obj_id1;}
if(this.ocu_pxny[x][0-b] == null ||""+ this.ocu_pxny[x][0-b] == "undefined"){this.ocu_pxny[x][0-b] = true;}
if(a == 0)
{
if(this.rfh_pxny[x][0-y] == null ||""+ this.rfh_pxny[x][0-y] == "undefined"){this.rfh_pxny[x][0-y] = this.randgen_rfh();}
if(this.rfv_pxny[x][0-y] == null ||""+ this.rfv_pxny[x][0-y] == "undefined"){this.rfv_pxny[x][0-y] = false;}
if(this.rot_pxny[x][0-y] == null ||""+ this.rot_pxny[x][0-y] == "undefined"){this.rot_pxny[x][0-y] = 90;}
}
else if (a == sy - 1)
{
if(this.ids_pxny[x][0-b] == null ||""+ this.ids_pxny[x][0-b] == "undefined"){this.ids_pxny[x][0-b] = this.randgen_wood_end(true);}
if(this.rfh_pxny[x][0-b] == null ||""+ this.rfh_pxny[x][0-b] == "undefined"){this.rfh_pxny[x][0-b] = this.randgen_rfh();}
if(this.rfv_pxny[x][0-b] == null ||""+ this.rfv_pxny[x][0-b] == "undefined"){this.rfv_pxny[x][0-b] = false;}
if(this.rot_pxny[x][0-b] == null ||""+ this.rot_pxny[x][0-b] == "undefined"){this.rot_pxny[x][0-b] = 270;}
}
else
{
if(this.ids_pxny[x][0-b] == null ||""+ this.ids_pxny[x][0-b] == "undefined"){this.ids_pxny[x][0-b] = this.randgen_wood_mid();}
if(this.rfh_pxny[x][0-b] == null ||""+ this.rfh_pxny[x][0-b] == "undefined"){this.rfh_pxny[x][0-b] = this.randgen_rfh();}
if(this.rfv_pxny[x][0-b] == null ||""+ this.rfv_pxny[x][0-b] == "undefined"){this.rfv_pxny[x][0-b] = this.randgen_rfh();}
if(this.rot_pxny[x][0-b] == null ||""+ this.rot_pxny[x][0-b] == "undefined"){this.rot_pxny[x][0-b] = 90;}
}
}
else // bugs.
{ //
if(this.id0_pxpy[x][b] == null ||""+ this.id0_pxpy[x][b] == "undefined"){this.id0_pxpy[x][b] = this.cur_obj_id0;}
if(this.id1_pxpy[x][b] == null ||""+ this.id1_pxpy[x][b] == "undefined"){this.id1_pxpy[x][b] = this.cur_obj_id1;}
if(this.ocu_pxpy[x][b] == null ||""+ this.ocu_pxpy[x][b] == "undefined"){this.ocu_pxpy[x][b] = true;}
if (a == sy -1)
{ this.diag_cek_get +=1;
if(this.ids_pxpy[x][b] == null ||""+ this.ids_pxpy[x][b] == "undefined"){this.ids_pxpy[x][b] = this.randgen_wood_end(true);}
if(this.rfh_pxpy[x][b] == null ||""+ this.rfh_pxpy[x][b] == "undefined"){this.rfh_pxpy[x][b] = this.randgen_rfh();}
if(this.rfv_pxpy[x][b] == null ||""+ this.rfv_pxpy[x][b] == "undefined"){this.rfv_pxpy[x][b] = false;}
if(this.rot_pxpy[x][b] == null ||""+ this.rot_pxpy[x][b] == "undefined"){this.rot_pxpy[x][b] = 270;}
}
else
{
if(this.ids_pxpy[x][b] == null ||""+ this.ids_pxpy[x][b] == "undefined"){this.ids_pxpy[x][b] = this.randgen_wood_mid();}
if(this.rfh_pxpy[x][b] == null ||""+ this.rfh_pxpy[x][b] == "undefined"){this.rfh_pxpy[x][b] = this.randgen_rfh();}
if(this.rfv_pxpy[x][b] == null ||""+ this.rfv_pxpy[x][b] == "undefined"){this.rfv_pxpy[x][b] = false;}
if(this.rot_pxpy[x][b] == null ||""+ this.rot_pxpy[x][b] == "undefined"){this.rot_pxpy[x][b] = 270;}
}
}
a = a+1;
}
this.update_cur_obj_idn();
}
}
else if (sx > 1 && sy == 1) //rpy pxny horizontals - does not need to coinsider another side,
{
this.ids_pxny[x][0-y] = this.randgen_wood_end();
if(this.ids_pxny[x][0-y] != "")
{
var a: Int =0, b:Int; while(a < sx)
{
b = x+a;
if(this.id0_pxny[b] == null ||""+this.id0_pxny[b]=="undefined"){this.id0_pxny[b]=[];}
if(this.id1_pxny[b] == null ||""+this.id1_pxny[b]=="undefined"){this.id1_pxny[b]=[];}
if(this.ids_pxny[b] == null ||""+this.ids_pxny[b]=="undefined"){this.ids_pxny[b]=[];}
if(this.ocu_pxny[b] == null ||""+this.ocu_pxny[b]=="undefined"){this.ocu_pxny[b]=[];}
if(this.rfh_pxny[b] == null ||""+this.rfh_pxny[b]=="undefined"){this.rfh_pxny[b]=[];}
if(this.rfv_pxny[b] == null ||""+this.rfv_pxny[b]=="undefined"){this.rfv_pxny[b]=[];}
if(this.rot_pxny[b] == null ||""+this.rot_pxny[b]=="undefined"){this.rot_pxny[b]=[];}
if(this.id0_pxny[b][0-y] == null ||""+this.id0_pxny[b][0-y]=="undefined"){this.id0_pxny[b][0-y]= this.cur_obj_id0;}
if(this.id1_pxny[b][0-y] == null ||""+this.id1_pxny[b][0-y]=="undefined"){this.id1_pxny[b][0-y]= this.cur_obj_id1;}
if(this.ocu_pxny[b][0-y] == null ||""+this.ocu_pxny[b][0-y]=="undefined"){this.ocu_pxny[b][0-y]= true;}
if (a == 0)
{
if(this.rfh_pxny[x][0-y] == null ||""+this.rfh_pxny[x][0-y] == "undefined"){this.rfh_pxny[x][0-y] = this.randgen_rfh();}
if(this.rfv_pxny[x][0-y] == null ||""+this.rfv_pxny[x][0-y] == "undefined"){this.rfv_pxny[x][0-y] = false;}
if(this.rot_pxny[x][0-y] == null ||""+this.rot_pxny[x][0-y] == "undefined"){this.rot_pxny[x][0-y] = 0;}
}
else if (a == sx -1)
{
if(this.ids_pxny[b][0-y] == null ||""+this.ids_pxny[b][0-y] == "undefined"){this.ids_pxny[b][0-y] = this.randgen_wood_end(true);}
if(this.rfh_pxny[b][0-y] == null ||""+this.rfh_pxny[b][0-y] == "undefined"){this.rfh_pxny[b][0-y] = this.randgen_rfh();}
if(this.rfv_pxny[b][0-y] == null ||""+this.rfv_pxny[b][0-y] == "undefined"){this.rfv_pxny[b][0-y] = false;}
if(this.rot_pxny[b][0-y] == null ||""+this.rot_pxny[b][0-y] == "undefined"){this.rot_pxny[b][0-y] = 180;}
}
else
{
if(this.ids_pxny[b][0-y] == null ||""+this.ids_pxny[b][0-y] == "undefined"){this.ids_pxny[b][0-y] = this.randgen_wood_mid();}
if(this.rfh_pxny[b][0-y] == null ||""+this.rfh_pxny[b][0-y] == "undefined"){this.rfh_pxny[b][0-y] = this.randgen_rfh();}
if(this.rfv_pxny[b][0-y] == null ||""+this.rfv_pxny[b][0-y] == "undefined"){this.rfv_pxny[b][0-y] = this.randgen_rfh();}
if(this.rot_pxny[b][0-y] == null ||""+this.rot_pxny[b][0-y] == "undefined"){this.rot_pxny[b][0-y] = 0;}
}
a = a+1;
}
this.update_cur_obj_idn();
}
}
else
{
this.ids_pxny[x][0-y] = this.randgen_wood_corner();
if(this.ids_pxny[x][0-y] != ""){this.sub_rpx_data_mt(x,y,sx,sy); this.update_cur_obj_idn(); }
}
}
at = Object_types.get_obj_at(this.ids_pxny[x][0-y]);
id0 = this.id0_pxny[x][0-y]; id1 = this.id1_pxny[x][0-y];
rfh = this.rfh_pxny[x][0-y]; rfv = this.rfv_pxny[x][0-y];
rot = this.rot_pxny[x][0-y];
}
if(at != null && ""+at!="undefined")
{
create_x = this.half_scew + x* 64 - this.offsx; create_y = this.half_sceh + y*64 - this.offsy;
this.create_actor(at,create_x, create_y); this.actors[x][y] = this.last_created_actor;
this.actors[x][y].spinTo(rot,0,null);
if(rfh){this.actors[x][y].growTo(1,-1,0,null);} // axis based flipping
if(rfv){this.actors[x][y].growTo(-1,1,0,null);}
this.actors[x][y].setValue("Object_behav","id0",id0);
this.actors[x][y].setValue("Object_behav","id1",id1);
}
x = x +1;
}
}
else
{
while(x < xmax)
{
if(this.actors[x]==null ||""+this.actors[x]=="undefined"){this.actors[x]=[];}
if(x < 0) // nxpy
{
if(this.id0_nxpy[0-x]==null ||""+ this.id0_nxpy[0-x]== "undefined"){this.id0_nxpy[0-x]=[];}
if(this.id1_nxpy[0-x]==null ||""+ this.id1_nxpy[0-x]== "undefined"){this.id1_nxpy[0-x]=[];}
if(this.ids_nxpy[0-x]==null ||""+ this.ids_nxpy[0-x]== "undefined"){this.ids_nxpy[0-x]=[];}
if(this.ocu_nxpy[0-x]==null ||""+ this.ocu_nxpy[0-x]== "undefined"){this.ocu_nxpy[0-x]=[];}
if(this.rfh_nxpy[0-x]==null ||""+ this.rfh_nxpy[0-x]== "undefined"){this.rfh_nxpy[0-x]=[];}
if(this.rfv_nxpy[0-x]==null ||""+ this.rfv_nxpy[0-x]== "undefined"){this.rfv_nxpy[0-x]=[];}
if(this.rot_nxpy[0-x]==null ||""+ this.rot_nxpy[0-x]== "undefined"){this.rot_nxpy[0-x]=[];}
if(this.ids_nxpy[0-x][y]==null ||""+ this.ids_nxpy[0-x][y]== "undefined")
{
sx = 1 + Std.int(Math.floor(Math.random() * 3.99)); sy = 1 + Std.int(Math.floor(Math.random() * 3.99));
if(this.cek_ocu(x+1,y)){sx =1;}
else if(this.cek_ocu(x+2,y)){sx = Std.int(Math.min(2,sx));}
else if(this.cek_ocu(x+3,y)){sx = Std.int(Math.min(3,sx));}
if(this.cek_ocu(x,y+1)){sy = 1;}
else if(this.cek_ocu(x,y+2)){sy = Std.int(Math.min(2,sy));}
else if(this.cek_ocu(x,y+3)){sy = Std.int(Math.min(3,sy));}
if (sx == 1 && sy == 1)
{
this.ids_nxpy[0-x][y] = this.randgen_wood_1t();
if(this.ids_nxpy[0-x][y] != "")
{
if(this.id0_nxpy[0-x][y] == null ||""+this.id0_nxpy[0-x][y] =="undefined"){this.id0_nxpy[0-x][y]= this.cur_obj_id0;}
if(this.id1_nxpy[0-x][y] == null ||""+this.id1_nxpy[0-x][y] =="undefined"){this.id1_nxpy[0-x][y]= this.cur_obj_id1;}
if(this.ocu_nxpy[0-x][y] == null ||""+this.ocu_nxpy[0-x][y] =="undefined"){this.ocu_nxpy[0-x][y]= true;}
if(this.rfh_nxpy[0-x][y] == null ||""+this.rfh_nxpy[0-x][y] =="undefined"){this.rfh_nxpy[0-x][y]= this.randgen_rfh();}
if(this.rfv_nxpy[0-x][y] == null ||""+this.rfv_nxpy[0-x][y] =="undefined"){this.rfv_nxpy[0-x][y]= this.randgen_rfh();}
if(this.rot_nxpy[0-x][y] == null ||""+this.rot_nxpy[0-x][y] =="undefined"){this.rot_nxpy[0-x][y]= this.randgen_rot();}
this.update_cur_obj_idn();
}
}
else if(sx == 1 && sy > 1) // rpy nxpy vertical
{
this.ids_nxpy[0-x][y] = this.randgen_wood_end();
if(this.ids_nxpy[0-x][y] != "")
{
var a:Int =0; var b:Int=0; this.diag_cek_get = 0; // diagnosis shows the loop went through.
while(a < sy)
{
b = y+a;
if(this.id0_nxpy[0-x][b] == null ||""+ this.id0_nxpy[0-x][b]=="undefined"){this.id0_nxpy[0-x][b] = this.cur_obj_id0;}
if(this.id1_nxpy[0-x][b] == null ||""+ this.id1_nxpy[0-x][b]=="undefined"){this.id1_nxpy[0-x][b] = this.cur_obj_id1;}
if(this.ocu_nxpy[0-x][b] == null ||""+ this.ocu_nxpy[0-x][b]=="undefined"){this.ocu_nxpy[0-x][b] = true;}
if(a == 0) // upper end
{
if(this.rfh_nxpy[0-x][y]== null ||""+ this.rfh_nxpy[0-x][y]=="undefined"){this.rfh_nxpy[0-x][y] = this.randgen_rfh();}
if(this.rfv_nxpy[0-x][y]== null ||""+ this.rfv_nxpy[0-x][y]=="undefined"){this.rfv_nxpy[0-x][y] = false;}
if(this.rot_nxpy[0-x][y]== null ||""+ this.rot_nxpy[0-x][y]=="undefined"){this.rot_nxpy[0-x][y] = 90;}
}
else if (a == sy -1)
{
if(this.ids_nxpy[0-x][b]== null ||""+ this.ids_nxpy[0-x][b]=="undefined"){this.ids_nxpy[0-x][b] = this.randgen_wood_end(true); }
if(this.rfh_nxpy[0-x][b]== null ||""+ this.rfh_nxpy[0-x][b]=="undefined"){this.rfh_nxpy[0-x][b] = this.randgen_rfh();}
if(this.rfv_nxpy[0-x][b]== null ||""+ this.rfv_nxpy[0-x][b]=="undefined"){this.rfv_nxpy[0-x][b] = false;}
if(this.rot_nxpy[0-x][b]== null ||""+ this.rot_nxpy[0-x][b]=="undefined"){this.rot_nxpy[0-x][b] = 270;}
}
else
{ // bugs here
if(this.ids_nxpy[0-x][b]== null ||""+ this.ids_nxpy[0-x][b]=="undefined"){this.ids_nxpy[0-x][b] = this.randgen_wood_mid();}
if(this.rfh_nxpy[0-x][b]== null ||""+ this.rfh_nxpy[0-x][b]=="undefined"){this.rfh_nxpy[0-x][b] = this.randgen_rfh();}
if(this.rfv_nxpy[0-x][b]== null ||""+ this.rfv_nxpy[0-x][b]=="undefined"){this.rfv_nxpy[0-x][b] = this.randgen_rfh();}
if(this.rot_nxpy[0-x][b]== null ||""+ this.rot_nxpy[0-x][b]=="undefined"){this.rot_nxpy[0-x][b] = 90;}
}
a = a+1;
}
this.update_cur_obj_idn();
}
}
else if(sx > 1 && sy == 1) // rpy nxpy horizontal
{
this.ids_nxpy[0-x][y] = this.randgen_wood_end();
if(this.ids_nxpy[0-x][y] !="")
{
var a:Int =0, b:Int=0;
while(a < sx)
{
b = x+a;
if(b < 0) // nxpy
{
if(this.id0_nxpy[0-b]==null||""+this.id0_nxpy[0-b]=="undefined"){this.id0_nxpy[0-b]=[];}
if(this.id1_nxpy[0-b]==null||""+this.id1_nxpy[0-b]=="undefined"){this.id1_nxpy[0-b]=[];}
if(this.ids_nxpy[0-b]==null||""+this.ids_nxpy[0-b]=="undefined"){this.ids_nxpy[0-b]=[];}
if(this.ocu_nxpy[0-b]==null||""+this.ocu_nxpy[0-b]=="undefined"){this.ocu_nxpy[0-b]=[];}
if(this.rfh_nxpy[0-b]==null||""+this.rfh_nxpy[0-b]=="undefined"){this.rfh_nxpy[0-b]=[];}
if(this.rfv_nxpy[0-b]==null||""+this.rfv_nxpy[0-b]=="undefined"){this.rfv_nxpy[0-b]=[];}
if(this.rot_nxpy[0-b]==null||""+this.rot_nxpy[0-b]=="undefined"){this.rot_nxpy[0-b]=[];}
if(this.id0_nxpy[0-b][y]==null||""+this.id0_nxpy[0-b][y]=="undefined"){this.id0_nxpy[0-b][y] = this.cur_obj_id0;} // problem detected here
if(this.id1_nxpy[0-b][y]==null||""+this.id1_nxpy[0-b][y]=="undefined"){this.id1_nxpy[0-b][y] = this.cur_obj_id1;} // problem detected here
if(this.ocu_nxpy[0-b][y]==null||""+this.ocu_nxpy[0-b][y]=="undefined"){this.ocu_nxpy[0-b][y] = true;}
if(a == 0)
{
if(this.rfh_nxpy[0-x][y]==null||""+this.rfh_nxpy[0-x][y]=="undefined"){this.rfh_nxpy[0-x][y] = this.randgen_rfh();}
if(this.rfv_nxpy[0-x][y]==null||""+this.rfv_nxpy[0-x][y]=="undefined"){this.rfv_nxpy[0-x][y] = false;}
if(this.rot_nxpy[0-x][y]==null||""+this.rot_nxpy[0-x][y]=="undefined"){this.rot_nxpy[0-x][y] = 0;}
}
else if(a == sx -1)
{
if(this.ids_nxpy[0-b][y]==null||""+this.ids_nxpy[0-b][y]=="undefined"){this.ids_nxpy[0-b][y] = this.randgen_wood_end(true);}
if(this.rfh_nxpy[0-b][y]==null||""+this.rfh_nxpy[0-b][y]=="undefined"){this.rfh_nxpy[0-b][y] = this.randgen_rfh();}
if(this.rfv_nxpy[0-b][y]==null||""+this.rfv_nxpy[0-b][y]=="undefined"){this.rfv_nxpy[0-b][y] = false;}
if(this.rot_nxpy[0-b][y]==null||""+this.rot_nxpy[0-b][y]=="undefined"){this.rot_nxpy[0-b][y] = 180;}
}
else
{
if(this.ids_nxpy[0-b][y]==null||""+this.ids_nxpy[0-b][y]=="undefined"){this.ids_nxpy[0-b][y] = this.randgen_wood_mid();}
if(this.rfh_nxpy[0-b][y]==null||""+this.rfh_nxpy[0-b][y]=="undefined"){this.rfh_nxpy[0-b][y] = this.randgen_rfh();}
if(this.rfv_nxpy[0-b][y]==null||""+this.rfv_nxpy[0-b][y]=="undefined"){this.rfv_nxpy[0-b][y] = this.randgen_rfh();}
if(this.rot_nxpy[0-b][y]==null||""+this.rot_nxpy[0-b][y]=="undefined"){this.rot_nxpy[0-b][y] = 0;}
}
}
else // pxpy
{
if(this.id0_pxpy[b]==null||""+this.id0_pxpy[b]=="undefined"){this.id0_pxpy[b]=[];}
if(this.id1_pxpy[b]==null||""+this.id1_pxpy[b]=="undefined"){this.id1_pxpy[b]=[];}
if(this.ids_pxpy[b]==null||""+this.ids_pxpy[b]=="undefined"){this.ids_pxpy[b]=[];}
if(this.ocu_pxpy[b]==null||""+this.ocu_pxpy[b]=="undefined"){this.ocu_pxpy[b]=[];}
if(this.rfh_pxpy[b]==null||""+this.rfh_pxpy[b]=="undefined"){this.rfh_pxpy[b]=[];}
if(this.rfv_pxpy[b]==null||""+this.rfv_pxpy[b]=="undefined"){this.rfv_pxpy[b]=[];}
if(this.rot_pxpy[b]==null||""+this.rot_pxpy[b]=="undefined"){this.rot_pxpy[b]=[];}
if(this.id0_pxpy[b][y]==null||""+this.id0_pxpy[b][y]=="undefined"){this.id0_pxpy[b][y] = this.cur_obj_id0;}
if(this.id1_pxpy[b][y]==null||""+this.id1_pxpy[b][y]=="undefined"){this.id1_pxpy[b][y] = this.cur_obj_id1;}
if(this.ocu_pxpy[b][y]==null||""+this.ocu_pxpy[b][y]=="undefined"){this.ocu_pxpy[b][y] = true;}
if(a == sx- 1)
{
if(this.ids_pxpy[b][y]==null ||""+this.ids_pxpy[b][y]=="undefined"){this.ids_pxpy[b][y]=this.randgen_wood_end(true);}
if(this.rfh_pxpy[b][y]==null ||""+this.rfh_pxpy[b][y]=="undefined"){this.rfh_pxpy[b][y]=this.randgen_rfh();}
if(this.rfv_pxpy[b][y]==null ||""+this.rfv_pxpy[b][y]=="undefined"){this.rfv_pxpy[b][y]= false;}
if(this.rot_pxpy[b][y]==null ||""+this.rot_pxpy[b][y]=="undefined"){this.rot_pxpy[b][y]=180;}
}
else
{
if(this.ids_pxpy[b][y]==null ||""+this.ids_pxpy[b][y]=="undefined"){this.ids_pxpy[b][y]=this.randgen_wood_mid();}
if(this.rfh_pxpy[b][y]==null ||""+this.rfh_pxpy[b][y]=="undefined"){this.rfh_pxpy[b][y]=this.randgen_rfh();}
if(this.rfv_pxpy[b][y]==null ||""+this.rfv_pxpy[b][y]=="undefined"){this.rfv_pxpy[b][y]=this.randgen_rfh();}
if(this.rot_pxpy[b][y]==null ||""+this.rot_pxpy[b][y]=="undefined"){this.rot_pxpy[b][y]=0;}
}
}
a = a+1;
}
this.update_cur_obj_idn();
}
}
else // rpy nxpy 2x2 or bigger
{
this.ids_nxpy[0-x][y] = this.randgen_wood_corner();
if(this.ids_nxpy[0-x][y]){this.sub_rpx_data_mt(x,y,sx,sy); this.update_cur_obj_idn();}
}
}
at = Object_types.get_obj_at(this.ids_nxpy[0-x][y]);
id0 = this.id0_nxpy[0-x][y]; id1 = this.id1_nxpy[0-x][y];
rfh = this.rfh_nxpy[0-x][y]; rfv = this.rfv_nxpy[0-x][y];
rot = this.rot_nxpy[0-x][y];
}
else // rpy pxpy
{
if(this.id0_pxpy[x]==null ||""+ this.id0_pxpy[x]== "undefined"){this.id0_pxpy[x]=[];}
if(this.id1_pxpy[x]==null ||""+ this.id1_pxpy[x]== "undefined"){this.id1_pxpy[x]=[];}
if(this.ids_pxpy[x]==null ||""+ this.ids_pxpy[x]== "undefined"){this.ids_pxpy[x]=[];}
if(this.ocu_pxpy[x]==null ||""+ this.ocu_pxpy[x]== "undefined"){this.ocu_pxpy[x]=[];}
if(this.rfh_pxpy[x]==null ||""+ this.rfh_pxpy[x]== "undefined"){this.rfh_pxpy[x]=[];}
if(this.rfv_pxpy[x]==null ||""+ this.rfv_pxpy[x]== "undefined"){this.rfv_pxpy[x]=[];}
if(this.rot_pxpy[x]==null ||""+ this.rot_pxpy[x]== "undefined"){this.rot_pxpy[x]=[];}
if(this.ids_pxpy[x][y]==null ||""+ this.ids_pxpy[x][y]== "undefined")
{
sx = 1 + Std.int(Math.floor(Math.random() * 3.99)); sy = 1 + Std.int(Math.floor(Math.random() * 3.99));
if(this.cek_ocu(x+1,y)){sx =1;}
else if(this.cek_ocu(x+2,y)){sx = Std.int(Math.min(2,sx));}
else if(this.cek_ocu(x+3,y)){sx = Std.int(Math.min(3,sx));}
if(this.cek_ocu(x,y+1)){sy = 1;}
else if(this.cek_ocu(x,y+2)){sy = Std.int(Math.min(2,sy));}
else if(this.cek_ocu(x,y+3)){sy = Std.int(Math.min(3,sy));}
if(sx == 1 && sy == 1)
{
this.ids_pxpy[x][y] = this.randgen_wood_1t();
if(this.ids_pxpy[x][y] != null)
{
if(this.id0_pxpy[x][y]==null ||""+this.id0_pxpy[x][y]=="undefined"){this.id0_pxpy[x][y]=this.cur_obj_id0;}
if(this.id1_pxpy[x][y]==null ||""+this.id1_pxpy[x][y]=="undefined"){this.id1_pxpy[x][y]=this.cur_obj_id1;}
if(this.ocu_pxpy[x][y]==null ||""+this.ocu_pxpy[x][y]=="undefined"){this.ocu_pxpy[x][y]=true;}
if(this.rfh_pxpy[x][y]==null ||""+this.rfh_pxpy[x][y]=="undefined"){this.rfh_pxpy[x][y]=this.randgen_rfh();}
if(this.rfv_pxpy[x][y]==null ||""+this.rfv_pxpy[x][y]=="undefined"){this.rfv_pxpy[x][y]=this.randgen_rfh();}
if(this.rot_pxpy[x][y]==null ||""+this.rot_pxpy[x][y]=="undefined"){this.rot_pxpy[x][y]=this.randgen_rot();}
this.update_cur_obj_idn();
}
}
else if(sx == 1 && sy > 1) // rpy pxpy vertical - renders downwards no pxny
{
this.ids_pxpy[x][y] = this.randgen_wood_end();
if(this.ids_pxpy[x][y] != "")
{
var a:Int =0; var b: Int; while (a < sy)
{
b = y+a;
if(this.id0_pxpy[x][b] == null ||""+ this.id0_pxpy[x][b] == "undefined"){this.id0_pxpy[x][b] = this.cur_obj_id0;}
if(this.id1_pxpy[x][b] == null ||""+ this.id1_pxpy[x][b] == "undefined"){this.id1_pxpy[x][b] = this.cur_obj_id1;}
if(this.ocu_pxpy[x][b] == null ||""+ this.ocu_pxpy[x][b] == "undefined"){this.ocu_pxpy[x][b] = true;}
if(a == 0) // top end
{
if(this.rfh_pxpy[x][y] == null ||""+ this.rfh_pxpy[x][y] == "undefined"){this.rfh_pxpy[x][y] = this.randgen_rfh();}
if(this.rfv_pxpy[x][y] == null ||""+ this.rfv_pxpy[x][y] == "undefined"){this.rfv_pxpy[x][y] = false;}
if(this.rot_pxpy[x][y] == null ||""+ this.rot_pxpy[x][y] == "undefined"){this.rot_pxpy[x][y] = 90;}
}
else if (a == sy -1)
{
if(this.ids_pxpy[x][b] == null ||""+ this.ids_pxpy[x][b] == "undefined"){this.ids_pxpy[x][b] = this.randgen_wood_end(true);}
if(this.rfh_pxpy[x][b] == null ||""+ this.rfh_pxpy[x][b] == "undefined"){this.rfh_pxpy[x][b] = this.randgen_rfh();}
if(this.rfv_pxpy[x][b] == null ||""+ this.rfv_pxpy[x][b] == "undefined"){this.rfv_pxpy[x][b] = false;}
if(this.rot_pxpy[x][b] == null ||""+ this.rot_pxpy[x][b] == "undefined"){this.rot_pxpy[x][b] = 270;}
}
else
{
if(this.ids_pxpy[x][b] == null ||""+ this.ids_pxpy[x][b] == "undefined"){this.ids_pxpy[x][b] = this.randgen_wood_mid();}
if(this.rfh_pxpy[x][b] == null ||""+ this.rfh_pxpy[x][b] == "undefined"){this.rfh_pxpy[x][b] = this.randgen_rfh();}
if(this.rfv_pxpy[x][b] == null ||""+ this.rfv_pxpy[x][b] == "undefined"){this.rfv_pxpy[x][b] = this.randgen_rfh();}
if(this.rot_pxpy[x][b] == null ||""+ this.rot_pxpy[x][b] == "undefined"){this.rot_pxpy[x][b] = 90;}
}
a = a+1;
}
this.update_cur_obj_idn();
}
}
else if(sx > 1 && sy == 1) // rpy pxpy horizontal
{
this.ids_pxpy[x][y] = this.randgen_wood_end();
if(this.ids_pxpy[x][y] != "")
{
var a:Int =0; var b: Int; while (a < sx)
{
b = x+a;
if(this.id0_pxpy[b]==null ||""+ this.id0_pxpy[b] == "undefined"){this.id0_pxpy[b]=[];}
if(this.id1_pxpy[b]==null ||""+ this.id1_pxpy[b] == "undefined"){this.id1_pxpy[b]=[];}
if(this.ids_pxpy[b]==null ||""+ this.ids_pxpy[b] == "undefined"){this.ids_pxpy[b]=[];}
if(this.ocu_pxpy[b]==null ||""+ this.ocu_pxpy[b] == "undefined"){this.ocu_pxpy[b]=[];}
if(this.rfh_pxpy[b]==null ||""+ this.rfh_pxpy[b] == "undefined"){this.rfh_pxpy[b]=[];}
if(this.rfv_pxpy[b]==null ||""+ this.rfv_pxpy[b] == "undefined"){this.rfv_pxpy[b]=[];}
if(this.rot_pxpy[b]==null ||""+ this.rot_pxpy[b] == "undefined"){this.rot_pxpy[b]=[];}
if(this.id0_pxpy[b][y]==null ||""+ this.id0_pxpy[b][y] == "undefined"){this.id0_pxpy[b][y]=this.cur_obj_id0;}
if(this.id1_pxpy[b][y]==null ||""+ this.id1_pxpy[b][y] == "undefined"){this.id1_pxpy[b][y]=this.cur_obj_id1;}
if(this.ocu_pxpy[b][y]==null ||""+ this.ocu_pxpy[b][y] == "undefined"){this.ocu_pxpy[b][y]=true;}
if(a == 0)
{
if(this.rfh_pxpy[x][y] == null ||""+ this.rfh_pxpy[x][y] == "undefined"){this.rfh_pxpy[x][y] = this.randgen_rfh();}
if(this.rfv_pxpy[x][y] == null ||""+ this.rfv_pxpy[x][y] == "undefined"){this.rfv_pxpy[x][y] = false;}
if(this.rot_pxpy[x][y] == null ||""+ this.rot_pxpy[x][y] == "undefined"){this.rot_pxpy[x][y] = 0;}
}
else if (a == sx-1)
{
if(this.ids_pxpy[b][y] == null ||""+ this.ids_pxpy[b][y] == "undefined"){this.ids_pxpy[b][y] = this.randgen_wood_end(true);}
if(this.rfh_pxpy[b][y] == null ||""+ this.rfh_pxpy[b][y] == "undefined"){this.rfh_pxpy[b][y] = this.randgen_rfh();}
if(this.rfv_pxpy[b][y] == null ||""+ this.rfv_pxpy[b][y] == "undefined"){this.rfv_pxpy[b][y] = false;}
if(this.rot_pxpy[b][y] == null ||""+ this.rot_pxpy[b][y] == "undefined"){this.rot_pxpy[b][y] = 180;}
}
else
{
if(this.ids_pxpy[b][y] == null ||""+ this.ids_pxpy[b][y] == "undefined"){this.ids_pxpy[b][y] = this.randgen_wood_mid();}
if(this.rfh_pxpy[b][y] == null ||""+ this.rfh_pxpy[b][y] == "undefined"){this.rfh_pxpy[b][y] = this.randgen_rfh();}
if(this.rfv_pxpy[b][y] == null ||""+ this.rfv_pxpy[b][y] == "undefined"){this.rfv_pxpy[b][y] = this.randgen_rfh();}
if(this.rot_pxpy[b][y] == null ||""+ this.rot_pxpy[b][y] == "undefined"){this.rot_pxpy[b][y] = 0;}
}
a = a+1;
}
this.update_cur_obj_idn();
}
}
else
{
this.ids_pxpy[x][y] = this.randgen_wood_corner();
if(this.ids_pxpy[x][y] != ""){this.sub_rpx_data_mt(x,y,sx,sy); this.update_cur_obj_idn();}
}
}
at = Object_types.get_obj_at(this.ids_pxpy[x][y]);
id0 = this.id0_pxpy[x][y]; id1 = this.id1_pxpy[x][y];
rfh = this.rfh_pxpy[x][y]; rfv = this.rfv_pxpy[x][y];
rot = this.rot_pxpy[x][y];
}
if(at != null && ""+at!="undefined")
{
create_x = this.half_scew + x* 64 - this.offsx; create_y = this.half_sceh + y*64 - this.offsy;
this.create_actor(at,create_x, create_y); this.actors[x][y] = this.last_created_actor;
this.actors[x][y].spinTo(rot,0,null);
if(rfh){this.actors[x][y].growTo(1,-1,0,null);} // axis based flipping
if(rfv){this.actors[x][y].growTo(-1,1,0,null);}
this.actors[x][y].setValue("Object_behav","id0",id0);
this.actors[x][y].setValue("Object_behav","id1",id1);
}
x = x +1;
}
}
}
public function shift_nx(xmax,xmin,ymax,ymin) // reaches right edge of the scene
{
var x:Int = xmin; var y:Int = ymin;
this.offsx = this.offsx + this.half_scew;
while(x < xmax)
{
if(this.actors[x] == null ||""+this.actors[x] == "undefined"){this.actors[x] = [];}
y = ymin; while(y < ymax)
{
if(Std.is(this.actors[x][y],Actor)){this.actors[x][y].setX(this.actors[x][y].getX() - this.half_scew);}y = y+1;
}
x = x+1;
}
}
public function shift_ny(xmax,xmin,ymax,ymin)// reaches the bottom of the scene
{
var x:Int = xmin; var y:Int = ymin;
this.offsy += this.half_sceh;
while(x < xmax)
{
if(this.actors[x] == null ||""+this.actors[x] == "undefined"){this.actors[x] = [];}
y = ymin; while(y < ymax)
{
if(Std.is(this.actors[x][y],Actor)){this.actors[x][y].setY(this.actors[x][y].getY() - this.half_sceh);}
y = y+1;
}
x = x+1;
}
}
public function shift_px(xmax,xmin,ymax,ymin) // reaches the left side of the screen
{
var x:Int = xmin; var y:Int = ymin;
this.offsx = this.offsx - this.half_scew;
while(x < xmax)
{
if(this.actors[x] == null ||""+this.actors[x] == "undefined"){this.actors[x] = [];}
y = ymin; while(y < ymax)
{
if(Std.is(this.actors[x][y],Actor)){this.actors[x][y].setX(this.actors[x][y].getX() + this.half_scew);}y = y+1;
}
x = x+1;
}
}
public function shift_py(xmax,xmin,ymax,ymin)
{
var x:Int = xmin; var y:Int = ymin;
this.offsy -= this.half_sceh;
while(x < xmax)
{
if(this.actors[x] == null ||""+this.actors[x] == "undefined"){this.actors[x] = [];}
y = ymin; while(y < ymax)
{
if(Std.is(this.actors[x][y],Actor)){this.actors[x][y].setY(this.actors[x][y].getY() + this.half_sceh);}
y = y+1;
}
x = x+1;
}
}
public function sub_rnx_data_mt(x,y,w,h) // direction, left and bottom.
{
var a:Int=0; var b:Int; var c:Int; var d:Int;
while(a < w)
{
b = x - a; // renders leftwards
if(b < 0)
{
c=0; while(c < h)
{ d = y + c;
if(d < 0) // nxny.
{
if(this.id0_nxny[0-b]==null ||""+this.id0_nxny[0-b]=="undefined"){this.id0_nxny[0-b]=[];}
if(this.id1_nxny[0-b]==null ||""+this.id1_nxny[0-b]=="undefined"){this.id1_nxny[0-b]=[];}
if(this.ids_nxny[0-b]==null ||""+this.ids_nxny[0-b]=="undefined"){this.ids_nxny[0-b]=[];}
if(this.ocu_nxny[0-b]==null ||""+this.ocu_nxny[0-b]=="undefined"){this.ocu_nxny[0-b]=[];}
if(this.rfh_nxny[0-b]==null ||""+this.rfh_nxny[0-b]=="undefined"){this.rfh_nxny[0-b]=[];}
if(this.rfv_nxny[0-b]==null ||""+this.rfv_nxny[0-b]=="undefined"){this.rfv_nxny[0-b]=[];}
if(this.rot_nxny[0-b]==null ||""+this.rot_nxny[0-b]=="undefined"){this.rot_nxny[0-b]=[];}
if(this.id0_nxny[0-b][0-d]==null ||""+this.id0_nxny[0-b][0-d]=="undefoned"){this.id0_nxny[0-b][0-d]=this.cur_obj_id0;}
if(this.id1_nxny[0-b][0-d]==null ||""+this.id1_nxny[0-b][0-d]=="undefoned"){this.id1_nxny[0-b][0-d]=this.cur_obj_id1;}
if(this.ocu_nxny[0-b][0-d]==null ||""+this.ocu_nxny[0-b][0-d]=="undefined"){this.ocu_nxny[0-b][0-d]=true;}
if(a == 0) // right edge
{
if(c == 0)
{
if(this.rfh_nxny[0-x][0-y]==null ||""+this.rfh_nxny[0-x][0-y]=="undefined"){this.rfh_nxny[0-x][0-y]= false;}
if(this.rfv_nxny[0-x][0-y]==null ||""+this.rfv_nxny[0-x][0-y]=="undefined"){this.rfv_nxny[0-x][0-y]= false;}
if(this.rot_nxny[0-x][0-y]==null ||""+this.rot_nxny[0-x][0-y]=="undefined"){this.rot_nxny[0-x][0-y]= 90;}
}
else if(c == h-1) // end.
{
if(this.ids_nxny[0-b][0-d]==null ||""+this.ids_nxny[0-b][0-d]=="undefined"){this.ids_nxny[0-b][0-d]= this.randgen_wood_corner(true);}
if(this.rfh_nxny[0-b][0-d]==null ||""+this.rfh_nxny[0-b][0-d]=="undefined"){this.rfh_nxny[0-b][0-d]= false;}
if(this.rfv_nxny[0-b][0-d]==null ||""+this.rfv_nxny[0-b][0-d]=="undefined"){this.rfv_nxny[0-b][0-d]= false;}
if(this.rot_nxny[0-b][0-d]==null ||""+this.rot_nxny[0-b][0-d]=="undefined"){this.rot_nxny[0-b][0-d]= 180;}
}
else // edge
{
if(this.ids_nxny[0-b][0-d]==null ||""+this.ids_nxny[0-b][0-d]=="undefined"){this.ids_nxny[0-b][0-d]= this.randgen_wood_edge();}
if(this.rfh_nxny[0-b][0-d]==null ||""+this.rfh_nxny[0-b][0-d]=="undefined"){this.rfh_nxny[0-b][0-d]= false;}
if(this.rfv_nxny[0-b][0-d]==null ||""+this.rfv_nxny[0-b][0-d]=="undefined"){this.rfv_nxny[0-b][0-d]= this.randgen_rfh();}
if(this.rot_nxny[0-b][0-d]==null ||""+this.rot_nxny[0-b][0-d]=="undefined"){this.rot_nxny[0-b][0-d]= 90;}
}
}
else if (a == w-1) // left side
{
if(c == 0) // upper left corner
{
if(this.ids_nxny[0-b][0-d]==null ||""+this.ids_nxny[0-b][0-d]=="undefined"){this.ids_nxny[0-b][0-d]= this.randgen_wood_corner(true);}
if(this.rfh_nxny[0-b][0-d]==null ||""+this.rfh_nxny[0-b][0-d]=="undefined"){this.rfh_nxny[0-b][0-d]= false;}
if(this.rfv_nxny[0-b][0-d]==null ||""+this.rfv_nxny[0-b][0-d]=="undefined"){this.rfv_nxny[0-b][0-d]= false;}
if(this.rot_nxny[0-b][0-d]==null ||""+this.rot_nxny[0-b][0-d]=="undefined"){this.rot_nxny[0-b][0-d]= 0;}
}
else if(c == h-1)
{
if(this.ids_nxny[0-b][0-d]==null ||""+this.ids_nxny[0-b][0-d]=="undefined"){this.ids_nxny[0-b][0-d]= this.randgen_wood_corner(true);}
if(this.rfh_nxny[0-b][0-d]==null ||""+this.rfh_nxny[0-b][0-d]=="undefined"){this.rfh_nxny[0-b][0-d]= false;}
if(this.rfv_nxny[0-b][0-d]==null ||""+this.rfv_nxny[0-b][0-d]=="undefined"){this.rfv_nxny[0-b][0-d]= false;}
if(this.rot_nxny[0-b][0-d]==null ||""+this.rot_nxny[0-b][0-d]=="undefined"){this.rot_nxny[0-b][0-d]= 270;}
}
else // left edge
{
if(this.ids_nxny[0-b][0-d]==null ||""+this.ids_nxny[0-b][0-d]=="undefined"){this.ids_nxny[0-b][0-d]= this.randgen_wood_edge();}
if(this.rfh_nxny[0-b][0-d]==null ||""+this.rfh_nxny[0-b][0-d]=="undefined"){this.rfh_nxny[0-b][0-d]= false;}
if(this.rfv_nxny[0-b][0-d]==null ||""+this.rfv_nxny[0-b][0-d]=="undefined"){this.rfv_nxny[0-b][0-d]= this.randgen_rfh();}
if(this.rot_nxny[0-b][0-d]==null ||""+this.rot_nxny[0-b][0-d]=="undefined"){this.rot_nxny[0-b][0-d]= 270;}
}
}
else // middle columns
{
if(c == 0)
{
if(this.ids_nxny[0-b][0-d]==null ||""+this.ids_nxny[0-b][0-d]=="undefined"){this.ids_nxny[0-b][0-d]=this.randgen_wood_edge();}
if(this.rfh_nxny[0-b][0-d]==null ||""+this.rfh_nxny[0-b][0-d]=="undefined"){this.rfh_nxny[0-b][0-d]= false;}
if(this.rfv_nxny[0-b][0-d]==null ||""+this.rfv_nxny[0-b][0-d]=="undefined"){this.rfv_nxny[0-b][0-d]= this.randgen_rfh();}
if(this.rot_nxny[0-b][0-d]==null ||""+this.rot_nxny[0-b][0-d]=="undefined"){this.rot_nxny[0-b][0-d]= 0;}
}
else if (c == h-1) // lower edge
{
if(this.ids_nxny[0-b][0-d]==null ||""+this.ids_nxny[0-b][0-d]=="undefined"){this.ids_nxny[0-b][0-d]=this.randgen_wood_edge();}
if(this.rfh_nxny[0-b][0-d]==null ||""+this.rfh_nxny[0-b][0-d]=="undefined"){this.rfh_nxny[0-b][0-d]= false;}
if(this.rfv_nxny[0-b][0-d]==null ||""+this.rfv_nxny[0-b][0-d]=="undefined"){this.rfv_nxny[0-b][0-d]= this.randgen_rfh();}
if(this.rot_nxny[0-b][0-d]==null ||""+this.rot_nxny[0-b][0-d]=="undefined"){this.rot_nxny[0-b][0-d]= 180;}
}
else
{
if(this.ids_nxny[0-b][0-d]==null ||""+this.ids_nxny[0-b][0-d]=="undefined"){this.ids_nxny[0-b][0-d]= "tr1_core";}
if(this.rfh_nxny[0-b][0-d]==null ||""+this.rfh_nxny[0-b][0-d]=="undefined"){this.rfh_nxny[0-b][0-d]= false;}
if(this.rfv_nxny[0-b][0-d]==null ||""+this.rfv_nxny[0-b][0-d]=="undefined"){this.rfv_nxny[0-b][0-d]= false;}
if(this.rot_nxny[0-b][0-d]==null ||""+this.rot_nxny[0-b][0-d]=="undefined"){this.rot_nxny[0-b][0-d]= 0;}
}
}
}
else // nxpy
{
if(this.id0_nxpy[0-b]==null ||""+this.id0_nxpy[0-b]=="undefined"){this.id0_nxpy[0-b]=[];}
if(this.id1_nxpy[0-b]==null ||""+this.id1_nxpy[0-b]=="undefined"){this.id1_nxpy[0-b]=[];}
if(this.ids_nxpy[0-b]==null ||""+this.ids_nxpy[0-b]=="undefined"){this.ids_nxpy[0-b]=[];}
if(this.ocu_nxpy[0-b]==null ||""+this.ocu_nxpy[0-b]=="undefined"){this.ocu_nxpy[0-b]=[];}
if(this.rfh_nxpy[0-b]==null ||""+this.rfh_nxpy[0-b]=="undefined"){this.rfh_nxpy[0-b]=[];}
if(this.rfv_nxpy[0-b]==null ||""+this.rfv_nxpy[0-b]=="undefined"){this.rfv_nxpy[0-b]=[];}
if(this.rot_nxpy[0-b]==null ||""+this.rot_nxpy[0-b]=="undefined"){this.rot_nxpy[0-b]=[];}
if(this.id0_nxpy[0-b][d]==null ||""+this.id0_nxpy[0-b][d]=="undefined"){this.id0_nxpy[0-b][d]= this.cur_obj_id0;}
if(this.id1_nxpy[0-b][d]==null ||""+this.id1_nxpy[0-b][d]=="undefined"){this.id1_nxpy[0-b][d]= this.cur_obj_id1;}
if(this.ocu_nxpy[0-b][d]==null ||""+this.ocu_nxpy[0-b][d]=="undefined"){this.ocu_nxpy[0-b][d]=true;}
if(a == 0) // right column
{
if(c == 0)
{
if(this.rfh_nxpy[0-x][y]==null ||""+this.rfh_nxpy[0-x][y]=="undefined"){this.rfh_nxpy[0-x][y]= false;}
if(this.rfv_nxpy[0-x][y]==null ||""+this.rfv_nxpy[0-x][y]=="undefined"){this.rfv_nxpy[0-x][y]= false;}
if(this.rot_nxpy[0-x][y]==null ||""+this.rot_nxpy[0-x][y]=="undefined"){this.rot_nxpy[0-x][y]= 90;}
}
else if(c == h-1) // end.
{
if(this.ids_nxpy[0-b][d]==null ||""+this.ids_nxpy[0-b][d]=="undefined"){this.ids_nxpy[0-b][d]= this.randgen_wood_corner(true);}
if(this.rfh_nxpy[0-b][d]==null ||""+this.rfh_nxpy[0-b][d]=="undefined"){this.rfh_nxpy[0-b][d]= false;}
if(this.rfv_nxpy[0-b][d]==null ||""+this.rfv_nxpy[0-b][d]=="undefined"){this.rfv_nxpy[0-b][d]= false;}
if(this.rot_nxpy[0-b][d]==null ||""+this.rot_nxpy[0-b][d]=="undefined"){this.rot_nxpy[0-b][d]= 180;}
}
else // edge
{
if(this.ids_nxpy[0-b][d]==null ||""+this.ids_nxpy[0-b][d]=="undefined"){this.ids_nxpy[0-b][d]= this.randgen_wood_edge();}
if(this.rfh_nxpy[0-b][d]==null ||""+this.rfh_nxpy[0-b][d]=="undefined"){this.rfh_nxpy[0-b][d]= false;}
if(this.rfv_nxpy[0-b][d]==null ||""+this.rfv_nxpy[0-b][d]=="undefined"){this.rfv_nxpy[0-b][d]= this.randgen_rfh();}
if(this.rot_nxpy[0-b][d]==null ||""+this.rot_nxpy[0-b][d]=="undefined"){this.rot_nxpy[0-b][d]= 90;}
}
}
else if (a == w-1) // left column
{
if(c == 0) // upper left corner
{
if(this.ids_nxpy[0-b][d]==null ||""+this.ids_nxpy[0-b][d]=="undefined"){this.ids_nxpy[0-b][d]= this.randgen_wood_corner(true);}
if(this.rfh_nxpy[0-b][d]==null ||""+this.rfh_nxpy[0-b][d]=="undefined"){this.rfh_nxpy[0-b][d]= false;}
if(this.rfv_nxpy[0-b][d]==null ||""+this.rfv_nxpy[0-b][d]=="undefined"){this.rfv_nxpy[0-b][d]= false;}
if(this.rot_nxpy[0-b][d]==null ||""+this.rot_nxpy[0-b][d]=="undefined"){this.rot_nxpy[0-b][d]= 0;}
}
else if(c == h-1)
{
if(this.ids_nxpy[0-b][d]==null ||""+this.ids_nxpy[0-b][d]=="undefined"){this.ids_nxpy[0-b][d]= this.randgen_wood_corner(true);}
if(this.rfh_nxpy[0-b][d]==null ||""+this.rfh_nxpy[0-b][d]=="undefined"){this.rfh_nxpy[0-b][d]= false;}
if(this.rfv_nxpy[0-b][d]==null ||""+this.rfv_nxpy[0-b][d]=="undefined"){this.rfv_nxpy[0-b][d]= false;}
if(this.rot_nxpy[0-b][d]==null ||""+this.rot_nxpy[0-b][d]=="undefined"){this.rot_nxpy[0-b][d]= 270;}
}
else // left edge
{
if(this.ids_nxpy[0-b][d]==null ||""+this.ids_nxpy[0-b][d]=="undefined"){this.ids_nxpy[0-b][d]= this.randgen_wood_edge();}
if(this.rfh_nxpy[0-b][d]==null ||""+this.rfh_nxpy[0-b][d]=="undefined"){this.rfh_nxpy[0-b][d]= false;}
if(this.rfv_nxpy[0-b][d]==null ||""+this.rfv_nxpy[0-b][d]=="undefined"){this.rfv_nxpy[0-b][d]= this.randgen_rfh();}
if(this.rot_nxpy[0-b][d]==null ||""+this.rot_nxpy[0-b][d]=="undefined"){this.rot_nxpy[0-b][d]= 270;}
}
}
else
{
if(c == 0)
{
if(this.ids_nxpy[0-b][d]==null ||""+this.ids_nxpy[0-b][d]=="undefined"){this.ids_nxpy[0-b][d]=this.randgen_wood_edge();}
if(this.rfh_nxpy[0-b][d]==null ||""+this.rfh_nxpy[0-b][d]=="undefined"){this.rfh_nxpy[0-b][d]= false;}
if(this.rfv_nxpy[0-b][d]==null ||""+this.rfv_nxpy[0-b][d]=="undefined"){this.rfv_nxpy[0-b][d]= this.randgen_rfh();}
if(this.rot_nxpy[0-b][d]==null ||""+this.rot_nxpy[0-b][d]=="undefined"){this.rot_nxpy[0-b][d]= 0;}
}
else if (c == h-1) // lower edge
{
if(this.ids_nxpy[0-b][d]==null ||""+this.ids_nxpy[0-b][d]=="undefined"){this.ids_nxpy[0-b][d]=this.randgen_wood_edge();}
if(this.rfh_nxpy[0-b][d]==null ||""+this.rfh_nxpy[0-b][d]=="undefined"){this.rfh_nxpy[0-b][d]= false;}
if(this.rfv_nxpy[0-b][d]==null ||""+this.rfv_nxpy[0-b][d]=="undefined"){this.rfv_nxpy[0-b][d]= this.randgen_rfh();}
if(this.rot_nxpy[0-b][d]==null ||""+this.rot_nxpy[0-b][d]=="undefined"){this.rot_nxpy[0-b][d]= 180;}
}
else
{
if(this.ids_nxpy[0-b][d]==null ||""+this.ids_nxpy[0-b][d]=="undefined"){this.ids_nxpy[0-b][d]= "tr1_core";}
if(this.rfh_nxpy[0-b][d]==null ||""+this.rfh_nxpy[0-b][d]=="undefined"){this.rfh_nxpy[0-b][d]= false;}
if(this.rfv_nxpy[0-b][d]==null ||""+this.rfv_nxpy[0-b][d]=="undefined"){this.rfv_nxpy[0-b][d]= false;}
if(this.rot_nxpy[0-b][d]==null ||""+this.rot_nxpy[0-b][d]=="undefined"){this.rot_nxpy[0-b][d]= 0;}
}
}
}
c = c+1;
}
}
else // rnx for x > 0,
{
c=0; while(c < h)
{
d = y + c;
if(d < 0)
{
if(this.id0_pxny[b]==null ||""+this.id0_pxny[b]=="undefined"){this.id0_pxny[b]=[];}
if(this.id1_pxny[b]==null ||""+this.id1_pxny[b]=="undefined"){this.id1_pxny[b]=[];}
if(this.ids_pxny[b]==null ||""+this.ids_pxny[b]=="undefined"){this.ids_pxny[b]=[];}
if(this.ocu_pxny[b]==null ||""+this.ocu_pxny[b]=="undefined"){this.ocu_pxny[b]=[];}
if(this.rfh_pxny[b]==null ||""+this.rfh_pxny[b]=="undefined"){this.rfh_pxny[b]=[];}
if(this.rfv_pxny[b]==null ||""+this.rfv_pxny[b]=="undefined"){this.rfv_pxny[b]=[];}
if(this.rot_pxny[b]==null ||""+this.rot_pxny[b]=="undefined"){this.rot_pxny[b]=[];}
if(this.id0_pxny[b][0-d]==null ||""+this.id0_pxny[b][0-d]=="undefined"){this.id0_pxny[b][0-d]=this.cur_obj_id0;} // last stuck here
if(this.id1_pxny[b][0-d]==null ||""+this.id1_pxny[b][0-d]=="undefined"){this.id1_pxny[b][0-d]=this.cur_obj_id1;}
if(this.ocu_pxny[b][0-d]==null ||""+this.ocu_pxny[b][0-d]=="undefined"){this.ocu_pxny[b][0-d]=true;}
if(a == 0)
{
if(c == 0) //upper right corner
{
if(this.rfh_pxny[x][0-y]==null ||""+this.rfh_pxny[x][0-y]=="undefined"){this.rfh_pxny[x][0-y]=false;}
if(this.rfv_pxny[x][0-y]==null ||""+this.rfv_pxny[x][0-y]=="undefined"){this.rfv_pxny[x][0-y]=false;}
if(this.rot_pxny[x][0-y]==null ||""+this.rot_pxny[x][0-y]=="undefined"){this.rot_pxny[x][0-y]=90;}
}
else if(c == h -1) // bottom left corner
{
if(this.ids_pxny[b][0-d]==null ||""+this.ids_pxny[b][0-d]=="undefined"){this.ids_pxny[b][0-d]=this.randgen_wood_corner(true);}
if(this.rfh_pxny[b][0-d]==null ||""+this.rfh_pxny[b][0-d]=="undefined"){this.rfh_pxny[b][0-d]=false;}
if(this.rfv_pxny[b][0-d]==null ||""+this.rfv_pxny[b][0-d]=="undefined"){this.rfv_pxny[b][0-d]=false;}
if(this.rot_pxny[b][0-d]==null ||""+this.rot_pxny[b][0-d]=="undefined"){this.rot_pxny[b][0-d]=180;}
}
else // right edge
{
if(this.ids_pxny[b][0-d]==null ||""+this.ids_pxny[b][0-d]=="undefined"){this.ids_pxny[b][0-d]=this.randgen_wood_edge();}
if(this.rfh_pxny[b][0-d]==null ||""+this.rfh_pxny[b][0-d]=="undefined"){this.rfh_pxny[b][0-d]=false;}
if(this.rfv_pxny[b][0-d]==null ||""+this.rfv_pxny[b][0-d]=="undefined"){this.rfv_pxny[b][0-d]=this.randgen_rfh();}
if(this.rot_pxny[b][0-d]==null ||""+this.rot_pxny[b][0-d]=="undefined"){this.rot_pxny[b][0-d]=90;}
}
}
else if(a == w - 1)
{
if(c == 0)
{
if(this.ids_pxny[b][0-y]==null ||""+this.ids_pxny[b][0-y]=="undefined"){this.ids_pxny[b][0-y]=this.randgen_wood_corner(true);}
if(this.rfh_pxny[b][0-y]==null ||""+this.rfh_pxny[b][0-y]=="undefined"){this.rfh_pxny[b][0-y]=false;}
if(this.rfv_pxny[b][0-y]==null ||""+this.rfv_pxny[b][0-y]=="undefined"){this.rfv_pxny[b][0-y]=false;}
if(this.rot_pxny[b][0-y]==null ||""+this.rot_pxny[b][0-y]=="undefined"){this.rot_pxny[b][0-y]=0;}
}
else if(c == h -1)
{
if(this.ids_pxny[b][0-d]==null ||""+this.ids_pxny[b][0-d]=="undefined"){this.ids_pxny[b][0-d]=this.randgen_wood_corner(true);}
if(this.rfh_pxny[b][0-d]==null ||""+this.rfh_pxny[b][0-d]=="undefined"){this.rfh_pxny[b][0-d]=false;}
if(this.rfv_pxny[b][0-d]==null ||""+this.rfv_pxny[b][0-d]=="undefined"){this.rfv_pxny[b][0-d]=false;}
if(this.rot_pxny[b][0-d]==null ||""+this.rot_pxny[b][0-d]=="undefined"){this.rot_pxny[b][0-d]=270;}
}
else
{
if(this.ids_pxny[b][0-d]==null ||""+this.ids_pxny[b][0-d]=="undefined"){this.ids_pxny[b][0-d]=this.randgen_wood_edge();}
if(this.rfh_pxny[b][0-d]==null ||""+this.rfh_pxny[b][0-d]=="undefined"){this.rfh_pxny[b][0-d]= false;}
if(this.rfv_pxny[b][0-d]==null ||""+this.rfv_pxny[b][0-d]=="undefined"){this.rfv_pxny[b][0-d]= this.randgen_rfh();}
if(this.rot_pxny[b][0-d]==null ||""+this.rot_pxny[b][0-d]=="undefined"){this.rot_pxny[b][0-d]=270;}
}
}
else
{
if(c == 0)
{
if(this.ids_pxny[b][0-d]==null ||""+this.ids_pxny[b][0-d]=="undefined"){this.ids_pxny[b][0-d]=this.randgen_wood_edge();}
if(this.rfh_pxny[b][0-d]==null ||""+this.rfh_pxny[b][0-d]=="undefined"){this.rfh_pxny[b][0-d]=false;}
if(this.rfv_pxny[b][0-d]==null ||""+this.rfv_pxny[b][0-d]=="undefined"){this.rfv_pxny[b][0-d]=this.randgen_rfh();}
if(this.rot_pxny[b][0-d]==null ||""+this.rot_pxny[b][0-d]=="undefined"){this.rot_pxny[b][0-d]=0;}
}
else if(c == h -1)
{
if(this.ids_pxny[b][0-d]==null ||""+this.ids_pxny[b][0-d]=="undefined"){this.ids_pxny[b][0-d]=this.randgen_wood_edge();}
if(this.rfh_pxny[b][0-d]==null ||""+this.rfh_pxny[b][0-d]=="undefined"){this.rfh_pxny[b][0-d]=false;}
if(this.rfv_pxny[b][0-d]==null ||""+this.rfv_pxny[b][0-d]=="undefined"){this.rfv_pxny[b][0-d]=this.randgen_rfh();}
if(this.rot_pxny[b][0-d]==null ||""+this.rot_pxny[b][0-d]=="undefined"){this.rot_pxny[b][0-d]=180;}
}
else
{
if(this.ids_pxny[b][0-d]==null ||""+this.ids_pxny[b][0-d]=="undefined"){this.ids_pxny[b][0-d]="tr1_core";}
if(this.rfh_pxny[b][0-d]==null ||""+this.rfh_pxny[b][0-d]=="undefined"){this.rfh_pxny[b][0-d]=this.randgen_rfh();}
if(this.rfv_pxny[b][0-d]==null ||""+this.rfv_pxny[b][0-d]=="undefined"){this.rfv_pxny[b][0-d]=this.randgen_rfh();}
if(this.rot_pxny[b][0-d]==null ||""+this.rot_pxny[b][0-d]=="undefined"){this.rot_pxny[b][0-d]=this.randgen_rot();}
}
}
}
else // pxpy
{
if(this.id0_pxpy[b]==null ||""+this.id0_pxpy[b]=="undefined"){this.id0_pxpy[b]=[];}
if(this.id1_pxpy[b]==null ||""+this.id1_pxpy[b]=="undefined"){this.id1_pxpy[b]=[];}
if(this.ids_pxpy[b]==null ||""+this.ids_pxpy[b]=="undefined"){this.ids_pxpy[b]=[];}
if(this.ocu_pxpy[b]==null ||""+this.ocu_pxpy[b]=="undefined"){this.ocu_pxpy[b]=[];}
if(this.rfh_pxpy[b]==null ||""+this.rfh_pxpy[b]=="undefined"){this.rfh_pxpy[b]=[];}
if(this.rfv_pxpy[b]==null ||""+this.rfv_pxpy[b]=="undefined"){this.rfv_pxpy[b]=[];}
if(this.rot_pxpy[b]==null ||""+this.rot_pxpy[b]=="undefined"){this.rot_pxpy[b]=[];}
if(this.id0_pxpy[b][d]==null ||""+this.id0_pxpy[b][d]=="undefined"){this.id0_pxpy[b][d]= this.cur_obj_id0;}
if(this.id1_pxpy[b][d]==null ||""+this.id1_pxpy[b][d]=="undefined"){this.id1_pxpy[b][d]= this.cur_obj_id1;}
if(this.ocu_pxpy[b][d]==null ||""+this.ocu_pxpy[b][d]=="undefined"){this.ocu_pxpy[b][d]= true;}
if(a == 0)
{
if(c == 0) // initial strting point.
{
if(this.rfh_pxpy[x][y]==null ||""+this.rfh_pxpy[x][y]=="undefined"){this.rfh_pxpy[x][y]=false;}
if(this.rfv_pxpy[x][y]==null ||""+this.rfv_pxpy[x][y]=="undefined"){this.rfv_pxpy[x][y]=false;}
if(this.rot_pxpy[x][y]==null ||""+this.rot_pxpy[x][y]=="undefined"){this.rot_pxpy[x][y]=90;}
}
else if (c == h -1)
{
if(this.ids_pxpy[b][d]==null ||""+this.ids_pxpy[b][d]=="undefined"){this.ids_pxpy[b][d]=this.randgen_wood_corner(true);}
if(this.rfh_pxpy[b][d]==null ||""+this.rfh_pxpy[b][d]=="undefined"){this.rfh_pxpy[b][d]=false;}
if(this.rfv_pxpy[b][d]==null ||""+this.rfv_pxpy[b][d]=="undefined"){this.rfv_pxpy[b][d]=false;}
if(this.rot_pxpy[b][d]==null ||""+this.rot_pxpy[b][d]=="undefined"){this.rot_pxpy[b][d]=180;}
}
else
{
if(this.ids_pxpy[b][d]==null ||""+this.ids_pxpy[b][d]=="undefined"){this.ids_pxpy[b][d]=this.randgen_wood_edge();}
if(this.rfh_pxpy[b][d]==null ||""+this.rfh_pxpy[b][d]=="undefined"){this.rfh_pxpy[b][d]=false;}
if(this.rfv_pxpy[b][d]==null ||""+this.rfv_pxpy[b][d]=="undefined"){this.rfv_pxpy[b][d]=this.randgen_rfh();}
if(this.rot_pxpy[b][d]==null ||""+this.rot_pxpy[b][d]=="undefined"){this.rot_pxpy[b][d]=90;}
}
}
else if (a == w -1) // left line.
{
if(c == 0)
{
if(this.ids_pxpy[b][y]==null ||""+this.ids_pxpy[b][y]=="undefined"){this.ids_pxpy[b][y]=this.randgen_wood_corner(true);}
if(this.rfh_pxpy[b][y]==null ||""+this.rfh_pxpy[b][y]=="undefined"){this.rfh_pxpy[b][y]=false;}
if(this.rfv_pxpy[b][y]==null ||""+this.rfv_pxpy[b][y]=="undefined"){this.rfv_pxpy[b][y]=false;}
if(this.rot_pxpy[b][y]==null ||""+this.rot_pxpy[b][y]=="undefined"){this.rot_pxpy[b][y]=0;}
}
else if (c == h -1)
{
if(this.ids_pxpy[b][d]==null ||""+this.ids_pxpy[b][d]=="undefined"){this.ids_pxpy[b][d]=this.randgen_wood_corner(true);}
if(this.rfh_pxpy[b][d]==null ||""+this.rfh_pxpy[b][d]=="undefined"){this.rfh_pxpy[b][d]=false;}
if(this.rfv_pxpy[b][d]==null ||""+this.rfv_pxpy[b][d]=="undefined"){this.rfv_pxpy[b][d]=false;}
if(this.rot_pxpy[b][d]==null ||""+this.rot_pxpy[b][d]=="undefined"){this.rot_pxpy[b][d]=270;}
}
else
{
if(this.ids_pxpy[b][d]==null ||""+this.ids_pxpy[b][d]=="undefined"){this.ids_pxpy[b][d]=this.randgen_wood_edge();}
if(this.rfh_pxpy[b][d]==null ||""+this.rfh_pxpy[b][d]=="undefined"){this.rfh_pxpy[b][d]=false;}
if(this.rfv_pxpy[b][d]==null ||""+this.rfv_pxpy[b][d]=="undefined"){this.rfv_pxpy[b][d]=this.randgen_rfh();}
if(this.rot_pxpy[b][d]==null ||""+this.rot_pxpy[b][d]=="undefined"){this.rot_pxpy[b][d]=270;}
}
}
else
{
if(c == 0)
{
if(this.ids_pxpy[b][y]==null ||""+this.ids_pxpy[b][y]=="undefined"){this.ids_pxpy[b][y]=this.randgen_wood_edge();}
if(this.rfh_pxpy[b][y]==null ||""+this.rfh_pxpy[b][y]=="undefined"){this.rfh_pxpy[b][y]=false;}
if(this.rfv_pxpy[b][y]==null ||""+this.rfv_pxpy[b][y]=="undefined"){this.rfv_pxpy[b][y]=this.randgen_rfh();}
if(this.rot_pxpy[b][y]==null ||""+this.rot_pxpy[b][y]=="undefined"){this.rot_pxpy[b][y]= 0;}
}
else if (c == h -1)
{
if(this.ids_pxpy[b][d]==null ||""+this.ids_pxpy[b][d]=="undefined"){this.ids_pxpy[b][d]=this.randgen_wood_edge();}
if(this.rfh_pxpy[b][d]==null ||""+this.rfh_pxpy[b][d]=="undefined"){this.rfh_pxpy[b][d]=false;}
if(this.rfv_pxpy[b][d]==null ||""+this.rfv_pxpy[b][d]=="undefined"){this.rfv_pxpy[b][d]=this.randgen_rfh();}
if(this.rot_pxpy[b][d]==null ||""+this.rot_pxpy[b][d]=="undefined"){this.rot_pxpy[b][d]=180;}
}
else
{
if(this.ids_pxpy[b][d]==null ||""+this.ids_pxpy[b][d]=="undefined"){this.ids_pxpy[b][d]="tr1_core";}
if(this.rfh_pxpy[b][d]==null ||""+this.rfh_pxpy[b][d]=="undefined"){this.rfh_pxpy[b][d]=this.randgen_rfh();}
if(this.rfv_pxpy[b][d]==null ||""+this.rfv_pxpy[b][d]=="undefined"){this.rfv_pxpy[b][d]=this.randgen_rfh();}
if(this.rot_pxpy[b][d]==null ||""+this.rot_pxpy[b][d]=="undefined"){this.rot_pxpy[b][d]=this.randgen_rot();}
}
}
}
c = c+1;
}
}
a = a+1;
}
}
public function sub_rny_data_mt(x,y,w,h) // horizontal rendering.
{
var a:Int=0, b:Int,c:Int=0, d:Int;
while(a < w)
{
b = x + a;
if(b < 0)
{
c = 0; while(c < h)
{
d = y - c;
if(d < 0) // nxny;
{
if(this.id0_nxny[0-b] == null ||""+this.id0_nxny[0-b] == "undefined"){this.id0_nxny[0-b] = [];}
if(this.id1_nxny[0-b] == null ||""+this.id1_nxny[0-b] == "undefined"){this.id1_nxny[0-b] = [];}
if(this.ids_nxny[0-b] == null ||""+this.ids_nxny[0-b] == "undefined"){this.ids_nxny[0-b] = [];}
if(this.ocu_nxny[0-b] == null ||""+this.ocu_nxny[0-b] == "undefined"){this.ocu_nxny[0-b] = [];}
if(this.rfh_nxny[0-b] == null ||""+this.rfh_nxny[0-b] == "undefined"){this.rfh_nxny[0-b] = [];}
if(this.rfv_nxny[0-b] == null ||""+this.rfv_nxny[0-b] == "undefined"){this.rfv_nxny[0-b] = [];}
if(this.rot_nxny[0-b] == null ||""+this.rot_nxny[0-b] == "undefined"){this.rot_nxny[0-b] = [];}
if(this.id0_nxny[0-b][0-d]==null ||""+this.id0_nxny[0-b][0-d]=="undefined"){this.id0_nxny[0-b][0-d]=this.cur_obj_id0;} // last stuck here
if(this.id1_nxny[0-b][0-d]==null ||""+this.id1_nxny[0-b][0-d]=="undefined"){this.id1_nxny[0-b][0-d]=this.cur_obj_id1;}
if(this.ocu_nxny[0-b][0-d]==null ||""+this.ocu_nxny[0-b][0-d]=="undefined"){this.ocu_nxny[0-b][0-d]=true;}
if(a == 0) // left side
{
if(c == 0) // lower left corner
{
if(this.rfh_nxny[0-x][0-y]==null ||""+this.rfh_nxny[0-x][0-y]=="undefined"){this.rfh_nxny[0-x][0-y]=false;}
if(this.rfv_nxny[0-x][0-y]==null ||""+this.rfv_nxny[0-x][0-y]=="undefined"){this.rfv_nxny[0-x][0-y]=false;}
if(this.rot_nxny[0-x][0-y]==null ||""+this.rot_nxny[0-x][0-y]=="undefined"){this.rot_nxny[0-x][0-y]=270;}
}
else if (c == h -1) // upper left corner
{
if(this.ids_nxny[0-x][0-d]==null ||""+this.ids_nxny[0-x][0-d]=="undefined"){this.ids_nxny[0-x][0-d]=this.randgen_wood_corner(true);}
if(this.rfh_nxny[0-x][0-d]==null ||""+this.rfh_nxny[0-x][0-d]=="undefined"){this.rfh_nxny[0-x][0-d]=false;}
if(this.rfv_nxny[0-x][0-d]==null ||""+this.rfv_nxny[0-x][0-d]=="undefined"){this.rfv_nxny[0-x][0-d]=false;}
if(this.rot_nxny[0-x][0-d]==null ||""+this.rot_nxny[0-x][0-d]=="undefined"){this.rot_nxny[0-x][0-d]=0;}
}
else // left edge
{
if(this.ids_nxny[0-x][0-d]==null ||""+this.ids_nxny[0-x][0-d]=="undefined"){this.ids_nxny[0-x][0-d]=this.randgen_wood_edge();}
if(this.rfh_nxny[0-x][0-d]==null ||""+this.rfh_nxny[0-x][0-d]=="undefined"){this.rfh_nxny[0-x][0-d]=false;}
if(this.rfv_nxny[0-x][0-d]==null ||""+this.rfv_nxny[0-x][0-d]=="undefined"){this.rfv_nxny[0-x][0-d]=this.randgen_rfh();}
if(this.rot_nxny[0-x][0-d]==null ||""+this.rot_nxny[0-x][0-d]=="undefined"){this.rot_nxny[0-x][0-d]=270;}
}
}
else if(a == w -1) // right side.
{
if(c == 0) // lower right corner
{
if(this.ids_nxny[0-b][0-y]==null ||""+this.ids_nxny[0-b][0-y]=="undefined"){this.ids_nxny[0-b][0-y]=this.randgen_wood_corner(true);}
if(this.rfh_nxny[0-b][0-y]==null ||""+this.rfh_nxny[0-b][0-y]=="undefined"){this.rfh_nxny[0-b][0-y]=false;}
if(this.rfv_nxny[0-b][0-y]==null ||""+this.rfv_nxny[0-b][0-y]=="undefined"){this.rfv_nxny[0-b][0-y]=false;}
if(this.rot_nxny[0-b][0-y]==null ||""+this.rot_nxny[0-b][0-y]=="undefined"){this.rot_nxny[0-b][0-y]=180;}
}
else if (c == h -1) // upper right corner
{
if(this.ids_nxny[0-b][0-d]==null ||""+this.ids_nxny[0-b][0-d]=="undefined"){this.ids_nxny[0-b][0-d]=this.randgen_wood_corner(true);}
if(this.rfh_nxny[0-b][0-d]==null ||""+this.rfh_nxny[0-b][0-d]=="undefined"){this.rfh_nxny[0-b][0-d]=false;}
if(this.rfv_nxny[0-b][0-d]==null ||""+this.rfv_nxny[0-b][0-d]=="undefined"){this.rfv_nxny[0-b][0-d]=false;}
if(this.rot_nxny[0-b][0-d]==null ||""+this.rot_nxny[0-b][0-d]=="undefined"){this.rot_nxny[0-b][0-d]=90;}
}
else // right edge
{
if(this.ids_nxny[0-b][0-d]==null ||""+this.ids_nxny[0-b][0-d]=="undefined"){this.ids_nxny[0-b][0-d]=this.randgen_wood_edge();}
if(this.rfh_nxny[0-b][0-d]==null ||""+this.rfh_nxny[0-b][0-d]=="undefined"){this.rfh_nxny[0-b][0-d]=false;}
if(this.rfv_nxny[0-b][0-d]==null ||""+this.rfv_nxny[0-b][0-d]=="undefined"){this.rfv_nxny[0-b][0-d]=this.randgen_rfh();}
if(this.rot_nxny[0-b][0-d]==null ||""+this.rot_nxny[0-b][0-d]=="undefined"){this.rot_nxny[0-b][0-d]=90;}
}
}
else // middle strip
{
if(c == 0)
{
if(this.ids_nxny[0-b][0-d]==null ||""+this.ids_nxny[0-b][0-d]=="undefined"){this.ids_nxny[0-b][0-d]=this.randgen_wood_edge();}
if(this.rfh_nxny[0-b][0-d]==null ||""+this.rfh_nxny[0-b][0-d]=="undefined"){this.rfh_nxny[0-b][0-d]=false;}
if(this.rfv_nxny[0-b][0-d]==null ||""+this.rfv_nxny[0-b][0-d]=="undefined"){this.rfv_nxny[0-b][0-d]=this.randgen_rfh();}
if(this.rot_nxny[0-b][0-d]==null ||""+this.rot_nxny[0-b][0-d]=="undefined"){this.rot_nxny[0-b][0-d]=180;}
}
else if (c == h -1)
{
if(this.ids_nxny[0-b][0-d]==null ||""+this.ids_nxny[0-b][0-d]=="undefined"){this.ids_nxny[0-b][0-d]=this.randgen_wood_edge();}
if(this.rfh_nxny[0-b][0-d]==null ||""+this.rfh_nxny[0-b][0-d]=="undefined"){this.rfh_nxny[0-b][0-d]=false;}
if(this.rfv_nxny[0-b][0-d]==null ||""+this.rfv_nxny[0-b][0-d]=="undefined"){this.rfv_nxny[0-b][0-d]=this.randgen_rfh();}
if(this.rot_nxny[0-b][0-d]==null ||""+this.rot_nxny[0-b][0-d]=="undefined"){this.rot_nxny[0-b][0-d]=0;}
}
else
{
if(this.ids_nxny[0-b][0-d]==null ||""+this.ids_nxny[0-b][0-d]=="undefined"){this.ids_nxny[0-b][0-d]="tr1_core";}
if(this.rfh_nxny[0-b][0-d]==null ||""+this.rfh_nxny[0-b][0-d]=="undefined"){this.rfh_nxny[0-b][0-d]=false;}
if(this.rfv_nxny[0-b][0-d]==null ||""+this.rfv_nxny[0-b][0-d]=="undefined"){this.rfv_nxny[0-b][0-d]=this.randgen_rfh();}
if(this.rot_nxny[0-b][0-d]==null ||""+this.rot_nxny[0-b][0-d]=="undefined"){this.rot_nxny[0-b][0-d]=180;}
}
}
}
else
{
if(this.id0_nxpy[0-b] == null ||""+this.id0_nxpy[0-b] == "undefined"){this.id0_nxpy[0-b] = [];}
if(this.id1_nxpy[0-b] == null ||""+this.id1_nxpy[0-b] == "undefined"){this.id1_nxpy[0-b] = [];}
if(this.ids_nxpy[0-b] == null ||""+this.ids_nxpy[0-b] == "undefined"){this.ids_nxpy[0-b] = [];}
if(this.ocu_nxpy[0-b] == null ||""+this.ocu_nxpy[0-b] == "undefined"){this.ocu_nxpy[0-b] = [];}
if(this.rfh_nxpy[0-b] == null ||""+this.rfh_nxpy[0-b] == "undefined"){this.rfh_nxpy[0-b] = [];}
if(this.rfv_nxpy[0-b] == null ||""+this.rfv_nxpy[0-b] == "undefined"){this.rfv_nxpy[0-b] = [];}
if(this.rot_nxpy[0-b] == null ||""+this.rot_nxpy[0-b] == "undefined"){this.rot_nxpy[0-b] = [];}
if(this.id0_nxpy[0-b][d]==null ||""+ this.id0_nxpy[0-b][d]=="undefined"){this.id0_nxpy[0-b][d] = this.cur_obj_id0;}
if(this.id1_nxpy[0-b][d]==null ||""+ this.id1_nxpy[0-b][d]=="undefined"){this.id1_nxpy[0-b][d] = this.cur_obj_id1;}
if(this.ocu_nxpy[0-b][d]==null ||""+ this.ocu_nxpy[0-b][d]=="undefined"){this.ocu_nxpy[0-b][d] = true;}
if(a == 0) // left side
{
if(c == 0) // bottom left
{
if(this.rfh_nxpy[0-x][y]==null||""+this.rfh_nxpy[0-x][y]=="undefined"){this.rfh_nxpy[0-x][y]= false;}
if(this.rfv_nxpy[0-x][y]==null||""+this.rfv_nxpy[0-x][y]=="undefined"){this.rfv_nxpy[0-x][y]= false;}
if(this.rot_nxpy[0-x][y]==null||""+this.rot_nxpy[0-x][y]=="undefined"){this.rot_nxpy[0-x][y]= 270;}
}
else if(c == h-1) // upper left corner
{
if(this.ids_nxpy[0-x][d]==null||""+this.ids_nxpy[0-x][d]=="undefined"){this.ids_nxpy[0-x][d]= this.randgen_wood_corner(true);}
if(this.rfh_nxpy[0-x][d]==null||""+this.rfh_nxpy[0-x][d]=="undefined"){this.rfh_nxpy[0-x][d]= false;}
if(this.rfv_nxpy[0-x][d]==null||""+this.rfv_nxpy[0-x][d]=="undefined"){this.rfv_nxpy[0-x][d]= false;}
if(this.rot_nxpy[0-x][d]==null||""+this.rot_nxpy[0-x][d]=="undefined"){this.rot_nxpy[0-x][d]= 0;}
}
else // left strip
{
if(this.ids_nxpy[0-x][d]==null||""+this.ids_nxpy[0-x][d]=="undefined"){this.ids_nxpy[0-x][d]= this.randgen_wood_edge();}
if(this.rfh_nxpy[0-x][d]==null||""+this.rfh_nxpy[0-x][d]=="undefined"){this.rfh_nxpy[0-x][d]= false;}
if(this.rfv_nxpy[0-x][d]==null||""+this.rfv_nxpy[0-x][d]=="undefined"){this.rfv_nxpy[0-x][d]= this.randgen_rfh();}
if(this.rot_nxpy[0-x][d]==null||""+this.rot_nxpy[0-x][d]=="undefined"){this.rot_nxpy[0-x][d]= 270;}
}
}
else if(a == w-1) // right side
{
if(c == 0) // lower right corner
{
if(this.ids_nxpy[0-b][y]==null||""+this.ids_nxpy[0-b][y]=="undefined"){this.ids_nxpy[0-b][y]= this.randgen_wood_corner(true);}
if(this.rfh_nxpy[0-b][y]==null||""+this.rfh_nxpy[0-b][y]=="undefined"){this.rfh_nxpy[0-b][y]= false;}
if(this.rfv_nxpy[0-b][y]==null||""+this.rfv_nxpy[0-b][y]=="undefined"){this.rfv_nxpy[0-b][y]= false;}
if(this.rot_nxpy[0-b][y]==null||""+this.rot_nxpy[0-b][y]=="undefined"){this.rot_nxpy[0-b][y]= 180;}
}
else if(c == h-1) // upper right corner
{
if(this.ids_nxpy[0-b][d]==null||""+this.ids_nxpy[0-b][d]=="undefined"){this.ids_nxpy[0-b][d]= this.randgen_wood_corner(true);}
if(this.rfh_nxpy[0-b][d]==null||""+this.rfh_nxpy[0-b][d]=="undefined"){this.rfh_nxpy[0-b][d]= false;}
if(this.rfv_nxpy[0-b][d]==null||""+this.rfv_nxpy[0-b][d]=="undefined"){this.rfv_nxpy[0-b][d]= false;}
if(this.rot_nxpy[0-b][d]==null||""+this.rot_nxpy[0-b][d]=="undefined"){this.rot_nxpy[0-b][d]= 90;}
}
else
{
if(this.ids_nxpy[0-b][d]==null||""+this.ids_nxpy[0-b][d]=="undefined"){this.ids_nxpy[0-b][d]= this.randgen_wood_edge();}
if(this.rfh_nxpy[0-b][d]==null||""+this.rfh_nxpy[0-b][d]=="undefined"){this.rfh_nxpy[0-b][d]= false;}
if(this.rfv_nxpy[0-b][d]==null||""+this.rfv_nxpy[0-b][d]=="undefined"){this.rfv_nxpy[0-b][d]= this.randgen_rfh();}
if(this.rot_nxpy[0-b][d]==null||""+this.rot_nxpy[0-b][d]=="undefined"){this.rot_nxpy[0-b][d]= 90;}
}
}
else // middle
{
if(c == 0) // bottom edge
{
if(this.ids_nxpy[0-b][y]==null||""+this.ids_nxpy[0-b][y]=="undefined"){this.ids_nxpy[0-b][y]= this.randgen_wood_edge();}
if(this.rfh_nxpy[0-b][y]==null||""+this.rfh_nxpy[0-b][y]=="undefined"){this.rfh_nxpy[0-b][y]= false;}
if(this.rfv_nxpy[0-b][y]==null||""+this.rfv_nxpy[0-b][y]=="undefined"){this.rfv_nxpy[0-b][y]= this.randgen_rfh();}
if(this.rot_nxpy[0-b][y]==null||""+this.rot_nxpy[0-b][y]=="undefined"){this.rot_nxpy[0-b][y]= 180;}
}
else if (c == h-1) // upper edge
{
if(this.ids_nxpy[0-b][d]==null||""+this.ids_nxpy[0-b][d]=="undefined"){this.ids_nxpy[0-b][d]= this.randgen_wood_edge();}
if(this.rfh_nxpy[0-b][d]==null||""+this.rfh_nxpy[0-b][d]=="undefined"){this.rfh_nxpy[0-b][d]= false;}
if(this.rfv_nxpy[0-b][d]==null||""+this.rfv_nxpy[0-b][d]=="undefined"){this.rfv_nxpy[0-b][d]= this.randgen_rfh();}
if(this.rot_nxpy[0-b][d]==null||""+this.rot_nxpy[0-b][d]=="undefined"){this.rot_nxpy[0-b][d]= 0;}
}
else
{
if(this.ids_nxpy[0-b][d]==null||""+this.ids_nxpy[0-b][d]=="undefined"){this.ids_nxpy[0-b][d]= "tr1_core";}
if(this.rfh_nxpy[0-b][d]==null||""+this.rfh_nxpy[0-b][d]=="undefined"){this.rfh_nxpy[0-b][d]= this.randgen_rfh();}
if(this.rfv_nxpy[0-b][d]==null||""+this.rfv_nxpy[0-b][d]=="undefined"){this.rfv_nxpy[0-b][d]= this.randgen_rfh();}
if(this.rot_nxpy[0-b][d]==null||""+this.rot_nxpy[0-b][d]=="undefined"){this.rot_nxpy[0-b][d]= this.randgen_rot();}
}
}
}
c = c+1;
}
}
else // rny for x >= 0
{
c =0; while(c < h)
{
d = y - c;
if(d < 0)
{
if(this.id0_pxny[b] == null ||""+this.id0_pxny[b] == "undefined"){this.id0_pxny[b] = [];}
if(this.id1_pxny[b] == null ||""+this.id1_pxny[b] == "undefined"){this.id1_pxny[b] = [];}
if(this.ids_pxny[b] == null ||""+this.ids_pxny[b] == "undefined"){this.ids_pxny[b] = [];}
if(this.ocu_pxny[b] == null ||""+this.ocu_pxny[b] == "undefined"){this.ocu_pxny[b] = [];}
if(this.rfh_pxny[b] == null ||""+this.rfh_pxny[b] == "undefined"){this.rfh_pxny[b] = [];}
if(this.rfv_pxny[b] == null ||""+this.rfv_pxny[b] == "undefined"){this.rfv_pxny[b] = [];}
if(this.rot_pxny[b] == null ||""+this.rot_pxny[b] == "undefined"){this.rot_pxny[b] = [];}
if(this.id0_pxny[b][0-d]==null ||""+this.id0_pxny[b][0-d]=="undefined"){this.id0_pxny[b][0-d]=this.cur_obj_id0;} // last stuck here
if(this.id1_pxny[b][0-d]==null ||""+this.id1_pxny[b][0-d]=="undefined"){this.id1_pxny[b][0-d]=this.cur_obj_id1;}
if(this.ocu_pxny[b][0-d]==null ||""+this.ocu_pxny[b][0-d]=="undefined"){this.ocu_pxny[b][0-d]=true;}
if(a == 0) // left side
{
if(c == 0) // bottom left
{
if(this.rfh_pxny[x][0-y]==null ||""+this.rfh_pxny[x][0-y]=="undefined"){this.rfh_pxny[x][0-y]=false;}
if(this.rfv_pxny[x][0-y]==null ||""+this.rfv_pxny[x][0-y]=="undefined"){this.rfv_pxny[x][0-y]=false;}
if(this.rot_pxny[x][0-y]==null ||""+this.rot_pxny[x][0-y]=="undefined"){this.rot_pxny[x][0-y]=270;}
}
else if(c == h-1) // iupper left
{
if(this.ids_pxny[x][0-d]==null ||""+this.ids_pxny[x][0-d]=="undefined"){this.ids_pxny[x][0-d]=this.randgen_wood_corner(true);}
if(this.rfh_pxny[x][0-d]==null ||""+this.rfh_pxny[x][0-d]=="undefined"){this.rfh_pxny[x][0-d]=false;}
if(this.rfv_pxny[x][0-d]==null ||""+this.rfv_pxny[x][0-d]=="undefined"){this.rfv_pxny[x][0-d]=false;}
if(this.rot_pxny[x][0-d]==null ||""+this.rot_pxny[x][0-d]=="undefined"){this.rot_pxny[x][0-d]=0;}
}
else
{
if(this.ids_pxny[x][0-d]==null ||""+this.ids_pxny[x][0-d]=="undefined"){this.ids_pxny[x][0-d]=this.randgen_wood_edge();}
if(this.rfh_pxny[x][0-d]==null ||""+this.rfh_pxny[x][0-d]=="undefined"){this.rfh_pxny[x][0-d]=false;}
if(this.rfv_pxny[x][0-d]==null ||""+this.rfv_pxny[x][0-d]=="undefined"){this.rfv_pxny[x][0-d]=this.randgen_rfh();}
if(this.rot_pxny[x][0-d]==null ||""+this.rot_pxny[x][0-d]=="undefined"){this.rot_pxny[x][0-d]=270;}
}
}
else if(a == w -1) // right side
{
if(c == 0) // bottom right
{
if(this.ids_pxny[b][0-y]==null ||""+this.ids_pxny[b][0-y]=="undefined"){this.ids_pxny[b][0-y]=this.randgen_wood_corner(true);}
if(this.rfh_pxny[b][0-y]==null ||""+this.rfh_pxny[b][0-y]=="undefined"){this.rfh_pxny[b][0-y]=false;}
if(this.rfv_pxny[b][0-y]==null ||""+this.rfv_pxny[b][0-y]=="undefined"){this.rfv_pxny[b][0-y]=false;}
if(this.rot_pxny[b][0-y]==null ||""+this.rot_pxny[b][0-y]=="undefined"){this.rot_pxny[b][0-y]=180;}
}
else if(c == h-1) // iupper right
{
if(this.ids_pxny[b][0-d]==null ||""+this.ids_pxny[b][0-d]=="undefined"){this.ids_pxny[b][0-d]=this.randgen_wood_corner(true);}
if(this.rfh_pxny[b][0-d]==null ||""+this.rfh_pxny[b][0-d]=="undefined"){this.rfh_pxny[b][0-d]=false;}
if(this.rfv_pxny[b][0-d]==null ||""+this.rfv_pxny[b][0-d]=="undefined"){this.rfv_pxny[b][0-d]=false;}
if(this.rot_pxny[b][0-d]==null ||""+this.rot_pxny[b][0-d]=="undefined"){this.rot_pxny[b][0-d]=90;}
}
else
{
if(this.ids_pxny[b][0-d]==null ||""+this.ids_pxny[b][0-d]=="undefined"){this.ids_pxny[b][0-d]=this.randgen_wood_edge();}
if(this.rfh_pxny[b][0-d]==null ||""+this.rfh_pxny[b][0-d]=="undefined"){this.rfh_pxny[b][0-d]=false;}
if(this.rfv_pxny[b][0-d]==null ||""+this.rfv_pxny[b][0-d]=="undefined"){this.rfv_pxny[b][0-d]=this.randgen_rfh();}
if(this.rot_pxny[b][0-d]==null ||""+this.rot_pxny[b][0-d]=="undefined"){this.rot_pxny[b][0-d]=90;}
}
}
else
{
if(c == 0) // bottom side
{
if(this.ids_pxny[b][0-y]==null ||""+this.ids_pxny[b][0-y]=="undefined"){this.ids_pxny[b][0-y]=this.randgen_wood_edge();}
if(this.rfh_pxny[b][0-y]==null ||""+this.rfh_pxny[b][0-y]=="undefined"){this.rfh_pxny[b][0-y]=false;}
if(this.rfv_pxny[b][0-y]==null ||""+this.rfv_pxny[b][0-y]=="undefined"){this.rfv_pxny[b][0-y]=this.randgen_rfh();}
if(this.rot_pxny[b][0-y]==null ||""+this.rot_pxny[b][0-y]=="undefined"){this.rot_pxny[b][0-y]=180;}
}
else if (c == h -1)
{
if(this.ids_pxny[b][0-d]==null ||""+this.ids_pxny[b][0-d]=="undefined"){this.ids_pxny[b][0-d]=this.randgen_wood_edge();}
if(this.rfh_pxny[b][0-d]==null ||""+this.rfh_pxny[b][0-d]=="undefined"){this.rfh_pxny[b][0-d]=false;}
if(this.rfv_pxny[b][0-d]==null ||""+this.rfv_pxny[b][0-d]=="undefined"){this.rfv_pxny[b][0-d]=this.randgen_rfh();}
if(this.rot_pxny[b][0-d]==null ||""+this.rot_pxny[b][0-d]=="undefined"){this.rot_pxny[b][0-d]=0;}
}
else // center
{
if(this.ids_pxny[b][0-d]==null ||""+this.ids_pxny[b][0-d]=="undefined"){this.ids_pxny[b][0-d]="tr1_core";}
if(this.rfh_pxny[b][0-d]==null ||""+this.rfh_pxny[b][0-d]=="undefined"){this.rfh_pxny[b][0-d]=this.randgen_rfh();}
if(this.rfv_pxny[b][0-d]==null ||""+this.rfv_pxny[b][0-d]=="undefined"){this.rfv_pxny[b][0-d]=this.randgen_rfh();}
if(this.rot_pxny[b][0-d]==null ||""+this.rot_pxny[b][0-d]=="undefined"){this.rot_pxny[b][0-d]=this.randgen_rot();}
}
}
}
else
{
if(this.id0_pxpy[b] == null ||""+this.id0_pxpy[b] == "undefined"){this.id0_pxpy[b] = [];}
if(this.id1_pxpy[b] == null ||""+this.id1_pxpy[b] == "undefined"){this.id1_pxpy[b] = [];}
if(this.ids_pxpy[b] == null ||""+this.ids_pxpy[b] == "undefined"){this.ids_pxpy[b] = [];}
if(this.ocu_pxpy[b] == null ||""+this.ocu_pxpy[b] == "undefined"){this.ocu_pxpy[b] = [];}
if(this.rfh_pxpy[b] == null ||""+this.rfh_pxpy[b] == "undefined"){this.rfh_pxpy[b] = [];}
if(this.rfv_pxpy[b] == null ||""+this.rfv_pxpy[b] == "undefined"){this.rfv_pxpy[b] = [];}
if(this.rot_pxpy[b] == null ||""+this.rot_pxpy[b] == "undefined"){this.rot_pxpy[b] = [];}
if(this.id0_pxpy[b][d] == null ||""+this.id0_pxpy[b][d] == "undefined"){this.id0_pxpy[b][d] = this.cur_obj_id0;}
if(this.id1_pxpy[b][d] == null ||""+this.id1_pxpy[b][d] == "undefined"){this.id1_pxpy[b][d] = this.cur_obj_id1;}
if(this.ocu_pxpy[b][d] == null ||""+this.ocu_pxpy[b][d] == "undefined"){this.ocu_pxpy[b][d] = true;}
if(a == 0) // left side
{
if(c == 0) // bottom left
{
if(this.rfh_pxpy[x][y] == null ||""+this.rfh_pxpy[x][y] == "undefined"){this.rfh_pxpy[x][y] = false;}
if(this.rfv_pxpy[x][y] == null ||""+this.rfv_pxpy[x][y] == "undefined"){this.rfv_pxpy[x][y] = false;}
if(this.rot_pxpy[x][y] == null ||""+this.rot_pxpy[x][y] == "undefined"){this.rot_pxpy[x][y] = 270;}
}
else if (c == h-1) // topledt
{
if(this.ids_pxpy[x][d] == null ||""+this.ids_pxpy[x][d] == "undefined"){this.ids_pxpy[x][d] = this.randgen_wood_corner(true);}
if(this.rfh_pxpy[x][d] == null ||""+this.rfh_pxpy[x][d] == "undefined"){this.rfh_pxpy[x][d] = false;}
if(this.rfv_pxpy[x][d] == null ||""+this.rfv_pxpy[x][d] == "undefined"){this.rfv_pxpy[x][d] = false;}
if(this.rot_pxpy[x][d] == null ||""+this.rot_pxpy[x][d] == "undefined"){this.rot_pxpy[x][d] = 0;}
}
else // left edge
{
if(this.ids_pxpy[x][d] == null ||""+this.ids_pxpy[x][d] == "undefined"){this.ids_pxpy[x][d] = this.randgen_wood_edge();}
if(this.rfh_pxpy[x][d] == null ||""+this.rfh_pxpy[x][d] == "undefined"){this.rfh_pxpy[x][d] = false;}
if(this.rfv_pxpy[x][d] == null ||""+this.rfv_pxpy[x][d] == "undefined"){this.rfv_pxpy[x][d] = this.randgen_rfh();}
if(this.rot_pxpy[x][d] == null ||""+this.rot_pxpy[x][d] == "undefined"){this.rot_pxpy[x][d] = 270;}
}
}
else if (a == w-1) // right column - rny
{
if(c == 0)
{
if(this.ids_pxpy[b][d] == null ||""+this.ids_pxpy[b][d] == "undefined"){this.ids_pxpy[b][d] = this.randgen_wood_corner(true);}
if(this.rfh_pxpy[b][d] == null ||""+this.rfh_pxpy[b][d] == "undefined"){this.rfh_pxpy[b][d] = false;}
if(this.rfv_pxpy[b][d] == null ||""+this.rfv_pxpy[b][d] == "undefined"){this.rfv_pxpy[b][d] = false;}
if(this.rot_pxpy[b][d] == null ||""+this.rot_pxpy[b][d] == "undefined"){this.rot_pxpy[b][d] = 180;}
}
else if (c == h-1)
{
if(this.ids_pxpy[b][d] == null ||""+this.ids_pxpy[b][d] == "undefined"){this.ids_pxpy[b][d] = this.randgen_wood_corner(true);}
if(this.rfh_pxpy[b][d] == null ||""+this.rfh_pxpy[b][d] == "undefined"){this.rfh_pxpy[b][d] = false;}
if(this.rfv_pxpy[b][d] == null ||""+this.rfv_pxpy[b][d] == "undefined"){this.rfv_pxpy[b][d] = false;}
if(this.rot_pxpy[b][d] == null ||""+this.rot_pxpy[b][d] == "undefined"){this.rot_pxpy[b][d] = 90;}
}
else
{
if(this.ids_pxpy[b][d] == null ||""+this.ids_pxpy[b][d] == "undefined"){this.ids_pxpy[b][d] = this.randgen_wood_edge();}
if(this.rfh_pxpy[b][d] == null ||""+this.rfh_pxpy[b][d] == "undefined"){this.rfh_pxpy[b][d] = false;}
if(this.rfv_pxpy[b][d] == null ||""+this.rfv_pxpy[b][d] == "undefined"){this.rfv_pxpy[b][d] = this.randgen_rfh();}
if(this.rot_pxpy[b][d] == null ||""+this.rot_pxpy[b][d] == "undefined"){this.rot_pxpy[b][d] = 90;}
}
}
else
{
if(c == 0) // upper edge
{
if(this.ids_pxpy[b][d] == null ||""+this.ids_pxpy[b][d] == "undefined"){this.ids_pxpy[b][d] = this.randgen_wood_edge();}
if(this.rfh_pxpy[b][d] == null ||""+this.rfh_pxpy[b][d] == "undefined"){this.rfh_pxpy[b][d] = false;}
if(this.rfv_pxpy[b][d] == null ||""+this.rfv_pxpy[b][d] == "undefined"){this.rfv_pxpy[b][d] = this.randgen_rfh();}
if(this.rot_pxpy[b][d] == null ||""+this.rot_pxpy[b][d] == "undefined"){this.rot_pxpy[b][d] = 180;}
}
else if (c == h-1)
{
if(this.ids_pxpy[b][d] == null ||""+this.ids_pxpy[b][d] == "undefined"){this.ids_pxpy[b][d] = this.randgen_wood_edge();}
if(this.rfh_pxpy[b][d] == null ||""+this.rfh_pxpy[b][d] == "undefined"){this.rfh_pxpy[b][d] = false;}
if(this.rfv_pxpy[b][d] == null ||""+this.rfv_pxpy[b][d] == "undefined"){this.rfv_pxpy[b][d] = this.randgen_rfh();}
if(this.rot_pxpy[b][d] == null ||""+this.rot_pxpy[b][d] == "undefined"){this.rot_pxpy[b][d] = 0;}
}
else
{
if(this.ids_pxpy[b][d] == null ||""+this.ids_pxpy[b][d] == "undefined"){this.ids_pxpy[b][d] = "tr1_core";}
if(this.rfh_pxpy[b][d] == null ||""+this.rfh_pxpy[b][d] == "undefined"){this.rfh_pxpy[b][d] = this.randgen_rfh();}
if(this.rfv_pxpy[b][d] == null ||""+this.rfv_pxpy[b][d] == "undefined"){this.rfv_pxpy[b][d] = this.randgen_rfh();}
if(this.rot_pxpy[b][d] == null ||""+this.rot_pxpy[b][d] == "undefined"){this.rot_pxpy[b][d] = this.randgen_rot();}
}
}
}
c = c+1;
}
}
a = a +1;
}
}
public function sub_rpx_data_mt(x,y,w,h)
{
var a:Int=0, b:Int; var c:Int=0, d:Int;
while(a < w)
{
b = x+a; c=0;
if (b < 0)
{
while (c < h)
{
d = y+c;
if(d < 0) //rpx nxny
{
if(this.id0_nxny[0-b]==null ||""+ this.id0_nxny[0-b]== "undefined"){this.id0_nxny[0-b]=[];}
if(this.id1_nxny[0-b]==null ||""+ this.id1_nxny[0-b]== "undefined"){this.id1_nxny[0-b]=[];}
if(this.ids_nxny[0-b]==null ||""+ this.ids_nxny[0-b]== "undefined"){this.ids_nxny[0-b]=[];}
if(this.ocu_nxny[0-b]==null ||""+ this.ocu_nxny[0-b]== "undefined"){this.ocu_nxny[0-b]=[];}
if(this.rfh_nxny[0-b]==null ||""+ this.rfh_nxny[0-b]== "undefined"){this.rfh_nxny[0-b]=[];}
if(this.rfv_nxny[0-b]==null ||""+ this.rfv_nxny[0-b]== "undefined"){this.rfv_nxny[0-b]=[];}
if(this.rot_nxny[0-b]==null ||""+ this.rot_nxny[0-b]== "undefined"){this.rot_nxny[0-b]=[];}
if(this.id0_nxny[0-b][0-d]==null ||""+ this.id0_nxny[0-b][0-d]== "undefined"){this.id0_nxny[0-b][0-d]= this.cur_obj_id0;}
if(this.id1_nxny[0-b][0-d]==null ||""+ this.id1_nxny[0-b][0-d]== "undefined"){this.id1_nxny[0-b][0-d]= this.cur_obj_id1;}
if(this.ocu_nxny[0-b][0-d]==null ||""+ this.ocu_nxny[0-b][0-d]== "undefined"){this.ocu_nxny[0-b][0-d]= true;}
if(a == 0) // left side
{
if(c == 0) // upper left corner
{
if(this.rfh_nxny[0-x][0-y]==null ||""+this.rfh_nxny[0-x][0-y]=="undefined"){this.rfh_nxny[0-x][0-y]=false;}
if(this.rfv_nxny[0-x][0-y]==null ||""+this.rfv_nxny[0-x][0-y]=="undefined"){this.rfv_nxny[0-x][0-y]=false;}
if(this.rot_nxny[0-x][0-y]==null ||""+this.rot_nxny[0-x][0-y]=="undefined"){this.rot_nxny[0-x][0-y]=0;}
}
else if (c == h -1) // lower left corner
{
if(this.ids_nxny[0-x][0-d]==null ||""+this.ids_nxny[0-x][0-d]=="undefined"){this.ids_nxny[0-x][0-d]=this.randgen_wood_corner(true);}
if(this.rfh_nxny[0-x][0-d]==null ||""+this.rfh_nxny[0-x][0-d]=="undefined"){this.rfh_nxny[0-x][0-d]=false;}
if(this.rfv_nxny[0-x][0-d]==null ||""+this.rfv_nxny[0-x][0-d]=="undefined"){this.rfv_nxny[0-x][0-d]=false;}
if(this.rot_nxny[0-x][0-d]==null ||""+this.rot_nxny[0-x][0-d]=="undefined"){this.rot_nxny[0-x][0-d]=270;}
}
else // left edge
{
if(this.ids_nxny[0-x][0-d]==null ||""+this.ids_nxny[0-x][0-d]=="undefined"){this.ids_nxny[0-x][0-d]=this.randgen_wood_edge();}
if(this.rfh_nxny[0-x][0-d]==null ||""+this.rfh_nxny[0-x][0-d]=="undefined"){this.rfh_nxny[0-x][0-d]=false;}
if(this.rfv_nxny[0-x][0-d]==null ||""+this.rfv_nxny[0-x][0-d]=="undefined"){this.rfv_nxny[0-x][0-d]=this.randgen_rfh();}
if(this.rot_nxny[0-x][0-d]==null ||""+this.rot_nxny[0-x][0-d]=="undefined"){this.rot_nxny[0-x][0-d]=270;}
}
}
else if(a == w -1) // right side.
{
if(c == 0) // upper right corner
{
if(this.ids_nxny[0-b][0-y]==null ||""+this.ids_nxny[0-b][0-y]=="undefined"){this.ids_nxny[0-b][0-y]=this.randgen_wood_corner(true);}
if(this.rfh_nxny[0-b][0-y]==null ||""+this.rfh_nxny[0-b][0-y]=="undefined"){this.rfh_nxny[0-b][0-y]=false;}
if(this.rfv_nxny[0-b][0-y]==null ||""+this.rfv_nxny[0-b][0-y]=="undefined"){this.rfv_nxny[0-b][0-y]=false;}
if(this.rot_nxny[0-b][0-y]==null ||""+this.rot_nxny[0-b][0-y]=="undefined"){this.rot_nxny[0-b][0-y]=90;}
}
else if (c == h -1) // lower right corner
{
if(this.ids_nxny[0-b][0-d]==null ||""+this.ids_nxny[0-b][0-d]=="undefined"){this.ids_nxny[0-b][0-d]=this.randgen_wood_corner(true);}
if(this.rfh_nxny[0-b][0-d]==null ||""+this.rfh_nxny[0-b][0-d]=="undefined"){this.rfh_nxny[0-b][0-d]=false;}
if(this.rfv_nxny[0-b][0-d]==null ||""+this.rfv_nxny[0-b][0-d]=="undefined"){this.rfv_nxny[0-b][0-d]=false;}
if(this.rot_nxny[0-b][0-d]==null ||""+this.rot_nxny[0-b][0-d]=="undefined"){this.rot_nxny[0-b][0-d]=180;}
}
else // right edge
{
if(this.ids_nxny[0-b][0-d]==null ||""+this.ids_nxny[0-b][0-d]=="undefined"){this.ids_nxny[0-b][0-d]=this.randgen_wood_edge();}
if(this.rfh_nxny[0-b][0-d]==null ||""+this.rfh_nxny[0-b][0-d]=="undefined"){this.rfh_nxny[0-b][0-d]=false;}
if(this.rfv_nxny[0-b][0-d]==null ||""+this.rfv_nxny[0-b][0-d]=="undefined"){this.rfv_nxny[0-b][0-d]=this.randgen_rfh();}
if(this.rot_nxny[0-b][0-d]==null ||""+this.rot_nxny[0-b][0-d]=="undefined"){this.rot_nxny[0-b][0-d]=90;}
}
}
else // middle strip
{
if(c == 0)
{
if(this.ids_nxny[0-b][0-d]==null ||""+this.ids_nxny[0-b][0-d]=="undefined"){this.ids_nxny[0-b][0-d]=this.randgen_wood_edge();}
if(this.rfh_nxny[0-b][0-d]==null ||""+this.rfh_nxny[0-b][0-d]=="undefined"){this.rfh_nxny[0-b][0-d]=false;}
if(this.rfv_nxny[0-b][0-d]==null ||""+this.rfv_nxny[0-b][0-d]=="undefined"){this.rfv_nxny[0-b][0-d]=this.randgen_rfh();}
if(this.rot_nxny[0-b][0-d]==null ||""+this.rot_nxny[0-b][0-d]=="undefined"){this.rot_nxny[0-b][0-d]=0;}
}
else if (c == h -1) // lower edge
{
if(this.ids_nxny[0-b][0-d]==null ||""+this.ids_nxny[0-b][0-d]=="undefined"){this.ids_nxny[0-b][0-d]=this.randgen_wood_edge();}
if(this.rfh_nxny[0-b][0-d]==null ||""+this.rfh_nxny[0-b][0-d]=="undefined"){this.rfh_nxny[0-b][0-d]=false;}
if(this.rfv_nxny[0-b][0-d]==null ||""+this.rfv_nxny[0-b][0-d]=="undefined"){this.rfv_nxny[0-b][0-d]=this.randgen_rfh();}
if(this.rot_nxny[0-b][0-d]==null ||""+this.rot_nxny[0-b][0-d]=="undefined"){this.rot_nxny[0-b][0-d]=180;}
}
else
{
if(this.ids_nxny[0-b][0-d]==null ||""+this.ids_nxny[0-b][0-d]=="undefined"){this.ids_nxny[0-b][0-d]="tr1_core";}
if(this.rfh_nxny[0-b][0-d]==null ||""+this.rfh_nxny[0-b][0-d]=="undefined"){this.rfh_nxny[0-b][0-d]=false;}
if(this.rfv_nxny[0-b][0-d]==null ||""+this.rfv_nxny[0-b][0-d]=="undefined"){this.rfv_nxny[0-b][0-d]=this.randgen_rfh();}
if(this.rot_nxny[0-b][0-d]==null ||""+this.rot_nxny[0-b][0-d]=="undefined"){this.rot_nxny[0-b][0-d]=180;}
}
}
}
else
{
if(this.id0_nxpy[0-b]==null ||""+ this.id0_nxpy[0-b]== "undefined"){this.id0_nxpy[0-b]=[];}
if(this.id1_nxpy[0-b]==null ||""+ this.id1_nxpy[0-b]== "undefined"){this.id1_nxpy[0-b]=[];}
if(this.ids_nxpy[0-b]==null ||""+ this.ids_nxpy[0-b]== "undefined"){this.ids_nxpy[0-b]=[];}
if(this.ocu_nxpy[0-b]==null ||""+ this.ocu_nxpy[0-b]== "undefined"){this.ocu_nxpy[0-b]=[];}
if(this.rfh_nxpy[0-b]==null ||""+ this.rfh_nxpy[0-b]== "undefined"){this.rfh_nxpy[0-b]=[];}
if(this.rfv_nxpy[0-b]==null ||""+ this.rfv_nxpy[0-b]== "undefined"){this.rfv_nxpy[0-b]=[];}
if(this.rot_nxpy[0-b]==null ||""+ this.rot_nxpy[0-b]== "undefined"){this.rot_nxpy[0-b]=[];}
if(this.id0_nxpy[0-b][d]==null ||""+ this.id0_nxpy[0-b][d]== "undefined"){this.id0_nxpy[0-b][d]= this.cur_obj_id0;}
if(this.id1_nxpy[0-b][d]==null ||""+ this.id1_nxpy[0-b][d]== "undefined"){this.id1_nxpy[0-b][d]= this.cur_obj_id1;}
if(this.ocu_nxpy[0-b][d]==null ||""+ this.ocu_nxpy[0-b][d]== "undefined"){this.ocu_nxpy[0-b][d]= true;}
if(a == 0) // left side
{
if(c == 0) // upper left
{
if(this.rfh_nxpy[0-x][y]==null||""+this.rfh_nxpy[0-x][y]=="undefined"){this.rfh_nxpy[0-x][y]= false;}
if(this.rfv_nxpy[0-x][y]==null||""+this.rfv_nxpy[0-x][y]=="undefined"){this.rfv_nxpy[0-x][y]= false;}
if(this.rot_nxpy[0-x][y]==null||""+this.rot_nxpy[0-x][y]=="undefined"){this.rot_nxpy[0-x][y]= 0;}
}
else if(c == h-1) // lower left corner
{
if(this.ids_nxpy[0-x][d]==null||""+this.ids_nxpy[0-x][d]=="undefined"){this.ids_nxpy[0-x][d]= this.randgen_wood_corner(true);}
if(this.rfh_nxpy[0-x][d]==null||""+this.rfh_nxpy[0-x][d]=="undefined"){this.rfh_nxpy[0-x][d]= false;}
if(this.rfv_nxpy[0-x][d]==null||""+this.rfv_nxpy[0-x][d]=="undefined"){this.rfv_nxpy[0-x][d]= false;}
if(this.rot_nxpy[0-x][d]==null||""+this.rot_nxpy[0-x][d]=="undefined"){this.rot_nxpy[0-x][d]= 270;}
}
else // left strip
{
if(this.ids_nxpy[0-x][d]==null||""+this.ids_nxpy[0-x][d]=="undefined"){this.ids_nxpy[0-x][d]= this.randgen_wood_edge();}
if(this.rfh_nxpy[0-x][d]==null||""+this.rfh_nxpy[0-x][d]=="undefined"){this.rfh_nxpy[0-x][d]= false;}
if(this.rfv_nxpy[0-x][d]==null||""+this.rfv_nxpy[0-x][d]=="undefined"){this.rfv_nxpy[0-x][d]= this.randgen_rfh();}
if(this.rot_nxpy[0-x][d]==null||""+this.rot_nxpy[0-x][d]=="undefined"){this.rot_nxpy[0-x][d]= 270;}
}
}
else if(a == w-1) // right side
{
if(c == 0) // upper right corner
{
if(this.ids_nxpy[0-b][y]==null||""+this.ids_nxpy[0-b][y]=="undefined"){this.ids_nxpy[0-b][y]= this.randgen_wood_corner(true);}
if(this.rfh_nxpy[0-b][y]==null||""+this.rfh_nxpy[0-b][y]=="undefined"){this.rfh_nxpy[0-b][y]= false;}
if(this.rfv_nxpy[0-b][y]==null||""+this.rfv_nxpy[0-b][y]=="undefined"){this.rfv_nxpy[0-b][y]= false;}
if(this.rot_nxpy[0-b][y]==null||""+this.rot_nxpy[0-b][y]=="undefined"){this.rot_nxpy[0-b][y]= 90;}
}
else if(c == h-1) // lower right corner
{
if(this.ids_nxpy[0-b][d]==null||""+this.ids_nxpy[0-b][d]=="undefined"){this.ids_nxpy[0-b][d]= this.randgen_wood_corner(true);}
if(this.rfh_nxpy[0-b][d]==null||""+this.rfh_nxpy[0-b][d]=="undefined"){this.rfh_nxpy[0-b][d]= false;}
if(this.rfv_nxpy[0-b][d]==null||""+this.rfv_nxpy[0-b][d]=="undefined"){this.rfv_nxpy[0-b][d]= false;}
if(this.rot_nxpy[0-b][d]==null||""+this.rot_nxpy[0-b][d]=="undefined"){this.rot_nxpy[0-b][d]= 180;}
}
else
{
if(this.ids_nxpy[0-b][d]==null||""+this.ids_nxpy[0-b][d]=="undefined"){this.ids_nxpy[0-b][d]= this.randgen_wood_edge();}
if(this.rfh_nxpy[0-b][d]==null||""+this.rfh_nxpy[0-b][d]=="undefined"){this.rfh_nxpy[0-b][d]= false;}
if(this.rfv_nxpy[0-b][d]==null||""+this.rfv_nxpy[0-b][d]=="undefined"){this.rfv_nxpy[0-b][d]= this.randgen_rfh();}
if(this.rot_nxpy[0-b][d]==null||""+this.rot_nxpy[0-b][d]=="undefined"){this.rot_nxpy[0-b][d]= 90;}
}
}
else // middle
{
if(c == 0) // bottom edge
{
if(this.ids_nxpy[0-b][y]==null||""+this.ids_nxpy[0-b][y]=="undefined"){this.ids_nxpy[0-b][y]= this.randgen_wood_edge();}
if(this.rfh_nxpy[0-b][y]==null||""+this.rfh_nxpy[0-b][y]=="undefined"){this.rfh_nxpy[0-b][y]= false;}
if(this.rfv_nxpy[0-b][y]==null||""+this.rfv_nxpy[0-b][y]=="undefined"){this.rfv_nxpy[0-b][y]= this.randgen_rfh();}
if(this.rot_nxpy[0-b][y]==null||""+this.rot_nxpy[0-b][y]=="undefined"){this.rot_nxpy[0-b][y]= 0;}
}
else if (c == h-1) // upper edge
{
if(this.ids_nxpy[0-b][d]==null||""+this.ids_nxpy[0-b][d]=="undefined"){this.ids_nxpy[0-b][d]= this.randgen_wood_edge();}
if(this.rfh_nxpy[0-b][d]==null||""+this.rfh_nxpy[0-b][d]=="undefined"){this.rfh_nxpy[0-b][d]= false;}
if(this.rfv_nxpy[0-b][d]==null||""+this.rfv_nxpy[0-b][d]=="undefined"){this.rfv_nxpy[0-b][d]= this.randgen_rfh();}
if(this.rot_nxpy[0-b][d]==null||""+this.rot_nxpy[0-b][d]=="undefined"){this.rot_nxpy[0-b][d]= 180;}
}
else
{
if(this.ids_nxpy[0-b][d]==null||""+this.ids_nxpy[0-b][d]=="undefined"){this.ids_nxpy[0-b][d]= "tr1_core";}
if(this.rfh_nxpy[0-b][d]==null||""+this.rfh_nxpy[0-b][d]=="undefined"){this.rfh_nxpy[0-b][d]= this.randgen_rfh();}
if(this.rfv_nxpy[0-b][d]==null||""+this.rfv_nxpy[0-b][d]=="undefined"){this.rfv_nxpy[0-b][d]= this.randgen_rfh();}
if(this.rot_nxpy[0-b][d]==null||""+this.rot_nxpy[0-b][d]=="undefined"){this.rot_nxpy[0-b][d]= this.randgen_rot();}
}
}
}
c = c+1;
}
}
else
{
while (c < h)
{
d = y+c;
if(d < 0)
{
if(this.id0_pxny[b]==null ||""+ this.id0_pxny[b]== "undefined"){this.id0_pxny[b]=[];}
if(this.id1_pxny[b]==null ||""+ this.id1_pxny[b]== "undefined"){this.id1_pxny[b]=[];}
if(this.ids_pxny[b]==null ||""+ this.ids_pxny[b]== "undefined"){this.ids_pxny[b]=[];}
if(this.ocu_pxny[b]==null ||""+ this.ocu_pxny[b]== "undefined"){this.ocu_pxny[b]=[];}
if(this.rfh_pxny[b]==null ||""+ this.rfh_pxny[b]== "undefined"){this.rfh_pxny[b]=[];}
if(this.rfv_pxny[b]==null ||""+ this.rfv_pxny[b]== "undefined"){this.rfv_pxny[b]=[];}
if(this.rot_pxny[b]==null ||""+ this.rot_pxny[b]== "undefined"){this.rot_pxny[b]=[];}
if(this.id0_pxny[b][0-d]==null ||""+ this.id0_pxny[b][0-d]== "undefined"){this.id0_pxny[b][0-d]= this.cur_obj_id0;}
if(this.id1_pxny[b][0-d]==null ||""+ this.id1_pxny[b][0-d]== "undefined"){this.id1_pxny[b][0-d]= this.cur_obj_id1;}
if(this.ocu_pxny[b][0-d]==null ||""+ this.ocu_pxny[b][0-d]== "undefined"){this.ocu_pxny[b][0-d]= true;}
if(a == 0) // left side
{
if(c == 0) // upper left
{
if(this.rfh_pxny[x][0-y]==null ||""+this.rfh_pxny[x][0-y]=="undefined"){this.rfh_pxny[x][0-y]=false;}
if(this.rfv_pxny[x][0-y]==null ||""+this.rfv_pxny[x][0-y]=="undefined"){this.rfv_pxny[x][0-y]=false;}
if(this.rot_pxny[x][0-y]==null ||""+this.rot_pxny[x][0-y]=="undefined"){this.rot_pxny[x][0-y]=0;}
}
else if(c == h-1) // lower left
{
if(this.ids_pxny[x][0-d]==null ||""+this.ids_pxny[x][0-d]=="undefined"){this.ids_pxny[x][0-d]=this.randgen_wood_corner(true);}
if(this.rfh_pxny[x][0-d]==null ||""+this.rfh_pxny[x][0-d]=="undefined"){this.rfh_pxny[x][0-d]=false;}
if(this.rfv_pxny[x][0-d]==null ||""+this.rfv_pxny[x][0-d]=="undefined"){this.rfv_pxny[x][0-d]=false;}
if(this.rot_pxny[x][0-d]==null ||""+this.rot_pxny[x][0-d]=="undefined"){this.rot_pxny[x][0-d]=270;}
}
else
{
if(this.ids_pxny[x][0-d]==null ||""+this.ids_pxny[x][0-d]=="undefined"){this.ids_pxny[x][0-d]=this.randgen_wood_edge();}
if(this.rfh_pxny[x][0-d]==null ||""+this.rfh_pxny[x][0-d]=="undefined"){this.rfh_pxny[x][0-d]=false;}
if(this.rfv_pxny[x][0-d]==null ||""+this.rfv_pxny[x][0-d]=="undefined"){this.rfv_pxny[x][0-d]=this.randgen_rfh();}
if(this.rot_pxny[x][0-d]==null ||""+this.rot_pxny[x][0-d]=="undefined"){this.rot_pxny[x][0-d]=270;}
}
}
else if(a == w -1) // right side
{
if(c == 0) // upper right
{
if(this.ids_pxny[b][0-y]==null ||""+this.ids_pxny[b][0-y]=="undefined"){this.ids_pxny[b][0-y]=this.randgen_wood_corner(true);}
if(this.rfh_pxny[b][0-y]==null ||""+this.rfh_pxny[b][0-y]=="undefined"){this.rfh_pxny[b][0-y]=false;}
if(this.rfv_pxny[b][0-y]==null ||""+this.rfv_pxny[b][0-y]=="undefined"){this.rfv_pxny[b][0-y]=false;}
if(this.rot_pxny[b][0-y]==null ||""+this.rot_pxny[b][0-y]=="undefined"){this.rot_pxny[b][0-y]=90;}
}
else if(c == h-1) // lower right
{
if(this.ids_pxny[b][0-d]==null ||""+this.ids_pxny[b][0-d]=="undefined"){this.ids_pxny[b][0-d]=this.randgen_wood_corner(true);}
if(this.rfh_pxny[b][0-d]==null ||""+this.rfh_pxny[b][0-d]=="undefined"){this.rfh_pxny[b][0-d]=false;}
if(this.rfv_pxny[b][0-d]==null ||""+this.rfv_pxny[b][0-d]=="undefined"){this.rfv_pxny[b][0-d]=false;}
if(this.rot_pxny[b][0-d]==null ||""+this.rot_pxny[b][0-d]=="undefined"){this.rot_pxny[b][0-d]=180;}
}
else
{
if(this.ids_pxny[b][0-d]==null ||""+this.ids_pxny[b][0-d]=="undefined"){this.ids_pxny[b][0-d]=this.randgen_wood_edge();}
if(this.rfh_pxny[b][0-d]==null ||""+this.rfh_pxny[b][0-d]=="undefined"){this.rfh_pxny[b][0-d]=false;}
if(this.rfv_pxny[b][0-d]==null ||""+this.rfv_pxny[b][0-d]=="undefined"){this.rfv_pxny[b][0-d]=this.randgen_rfh();}
if(this.rot_pxny[b][0-d]==null ||""+this.rot_pxny[b][0-d]=="undefined"){this.rot_pxny[b][0-d]=90;}
}
}
else
{
if(c == 0) // upper side
{
if(this.ids_pxny[b][0-y]==null ||""+this.ids_pxny[b][0-y]=="undefined"){this.ids_pxny[b][0-y]=this.randgen_wood_edge();}
if(this.rfh_pxny[b][0-y]==null ||""+this.rfh_pxny[b][0-y]=="undefined"){this.rfh_pxny[b][0-y]=false;}
if(this.rfv_pxny[b][0-y]==null ||""+this.rfv_pxny[b][0-y]=="undefined"){this.rfv_pxny[b][0-y]=this.randgen_rfh();}
if(this.rot_pxny[b][0-y]==null ||""+this.rot_pxny[b][0-y]=="undefined"){this.rot_pxny[b][0-y]=0;}
}
else if (c == h -1)
{
if(this.ids_pxny[b][0-d]==null ||""+this.ids_pxny[b][0-d]=="undefined"){this.ids_pxny[b][0-d]=this.randgen_wood_edge();}
if(this.rfh_pxny[b][0-d]==null ||""+this.rfh_pxny[b][0-d]=="undefined"){this.rfh_pxny[b][0-d]=false;}
if(this.rfv_pxny[b][0-d]==null ||""+this.rfv_pxny[b][0-d]=="undefined"){this.rfv_pxny[b][0-d]=this.randgen_rfh();}
if(this.rot_pxny[b][0-d]==null ||""+this.rot_pxny[b][0-d]=="undefined"){this.rot_pxny[b][0-d]=180;}
}
else // center
{
if(this.ids_pxny[b][0-d]==null ||""+this.ids_pxny[b][0-d]=="undefined"){this.ids_pxny[b][0-d]="tr1_core";}
if(this.rfh_pxny[b][0-d]==null ||""+this.rfh_pxny[b][0-d]=="undefined"){this.rfh_pxny[b][0-d]=this.randgen_rfh();}
if(this.rfv_pxny[b][0-d]==null ||""+this.rfv_pxny[b][0-d]=="undefined"){this.rfv_pxny[b][0-d]=this.randgen_rfh();}
if(this.rot_pxny[b][0-d]==null ||""+this.rot_pxny[b][0-d]=="undefined"){this.rot_pxny[b][0-d]=this.randgen_rot();}
}
}
}
else
{
if(this.id0_pxpy[b] == null ||""+ this.id0_pxpy[b] == "undefined"){this.id0_pxpy[b] = [];}
if(this.id1_pxpy[b] == null ||""+ this.id1_pxpy[b] == "undefined"){this.id1_pxpy[b] = [];}
if(this.ids_pxpy[b] == null ||""+ this.ids_pxpy[b] == "undefined"){this.ids_pxpy[b] = [];}
if(this.ocu_pxpy[b] == null ||""+ this.ocu_pxpy[b] == "undefined"){this.ocu_pxpy[b] = [];}
if(this.rfh_pxpy[b] == null ||""+ this.rfh_pxpy[b] == "undefined"){this.rfh_pxpy[b] = [];}
if(this.rfv_pxpy[b] == null ||""+ this.rfv_pxpy[b] == "undefined"){this.rfv_pxpy[b] = [];}
if(this.rot_pxpy[b] == null ||""+ this.rot_pxpy[b] == "undefined"){this.rot_pxpy[b] = [];}
if(this.id0_pxpy[b][d] == null ||""+ this.id0_pxpy[b][d] == "undefined"){this.id0_pxpy[b][d] = this.cur_obj_id0;}
if(this.id1_pxpy[b][d] == null ||""+ this.id1_pxpy[b][d] == "undefined"){this.id1_pxpy[b][d] = this.cur_obj_id1;}
if(this.ocu_pxpy[b][d] == null ||""+ this.ocu_pxpy[b][d] == "undefined"){this.ocu_pxpy[b][d] = true;}
if(a == 0) // left side
{
if(c == 0) // bottom left
{
if(this.rfh_pxpy[x][y] == null ||""+this.rfh_pxpy[x][y] == "undefined"){this.rfh_pxpy[x][y] = false;}
if(this.rfv_pxpy[x][y] == null ||""+this.rfv_pxpy[x][y] == "undefined"){this.rfv_pxpy[x][y] = false;}
if(this.rot_pxpy[x][y] == null ||""+this.rot_pxpy[x][y] == "undefined"){this.rot_pxpy[x][y] = 0;}
}
else if (c == h-1) // topledt
{
if(this.ids_pxpy[x][d] == null ||""+this.ids_pxpy[x][d] == "undefined"){this.ids_pxpy[x][d] = this.randgen_wood_corner(true);}
if(this.rfh_pxpy[x][d] == null ||""+this.rfh_pxpy[x][d] == "undefined"){this.rfh_pxpy[x][d] = false;}
if(this.rfv_pxpy[x][d] == null ||""+this.rfv_pxpy[x][d] == "undefined"){this.rfv_pxpy[x][d] = false;}
if(this.rot_pxpy[x][d] == null ||""+this.rot_pxpy[x][d] == "undefined"){this.rot_pxpy[x][d] = 270;}
}
else // left edge
{
if(this.ids_pxpy[x][d] == null ||""+this.ids_pxpy[x][d] == "undefined"){this.ids_pxpy[x][d] = this.randgen_wood_edge();}
if(this.rfh_pxpy[x][d] == null ||""+this.rfh_pxpy[x][d] == "undefined"){this.rfh_pxpy[x][d] = false;}
if(this.rfv_pxpy[x][d] == null ||""+this.rfv_pxpy[x][d] == "undefined"){this.rfv_pxpy[x][d] = this.randgen_rfh();}
if(this.rot_pxpy[x][d] == null ||""+this.rot_pxpy[x][d] == "undefined"){this.rot_pxpy[x][d] = 270;}
}
}
else if (a == w-1) // right column - rny
{
if(c == 0)
{
if(this.ids_pxpy[b][d] == null ||""+this.ids_pxpy[b][d] == "undefined"){this.ids_pxpy[b][d] = this.randgen_wood_corner(true);}
if(this.rfh_pxpy[b][d] == null ||""+this.rfh_pxpy[b][d] == "undefined"){this.rfh_pxpy[b][d] = false;}
if(this.rfv_pxpy[b][d] == null ||""+this.rfv_pxpy[b][d] == "undefined"){this.rfv_pxpy[b][d] = false;}
if(this.rot_pxpy[b][d] == null ||""+this.rot_pxpy[b][d] == "undefined"){this.rot_pxpy[b][d] = 90;}
}
else if (c == h-1)
{
if(this.ids_pxpy[b][d] == null ||""+this.ids_pxpy[b][d] == "undefined"){this.ids_pxpy[b][d] = this.randgen_wood_corner(true);}
if(this.rfh_pxpy[b][d] == null ||""+this.rfh_pxpy[b][d] == "undefined"){this.rfh_pxpy[b][d] = false;}
if(this.rfv_pxpy[b][d] == null ||""+this.rfv_pxpy[b][d] == "undefined"){this.rfv_pxpy[b][d] = false;}
if(this.rot_pxpy[b][d] == null ||""+this.rot_pxpy[b][d] == "undefined"){this.rot_pxpy[b][d] = 180;}
}
else
{
if(this.ids_pxpy[b][d] == null ||""+this.ids_pxpy[b][d] == "undefined"){this.ids_pxpy[b][d] = this.randgen_wood_edge();}
if(this.rfh_pxpy[b][d] == null ||""+this.rfh_pxpy[b][d] == "undefined"){this.rfh_pxpy[b][d] = false;}
if(this.rfv_pxpy[b][d] == null ||""+this.rfv_pxpy[b][d] == "undefined"){this.rfv_pxpy[b][d] = this.randgen_rfh();}
if(this.rot_pxpy[b][d] == null ||""+this.rot_pxpy[b][d] == "undefined"){this.rot_pxpy[b][d] = 90;}
}
}
else
{
if(c == 0) // upper edge
{
if(this.ids_pxpy[b][d] == null ||""+this.ids_pxpy[b][d] == "undefined"){this.ids_pxpy[b][d] = this.randgen_wood_edge();}
if(this.rfh_pxpy[b][d] == null ||""+this.rfh_pxpy[b][d] == "undefined"){this.rfh_pxpy[b][d] = false;}
if(this.rfv_pxpy[b][d] == null ||""+this.rfv_pxpy[b][d] == "undefined"){this.rfv_pxpy[b][d] = this.randgen_rfh();}
if(this.rot_pxpy[b][d] == null ||""+this.rot_pxpy[b][d] == "undefined"){this.rot_pxpy[b][d] = 0;}
}
else if (c == h-1)
{
if(this.ids_pxpy[b][d] == null ||""+this.ids_pxpy[b][d] == "undefined"){this.ids_pxpy[b][d] = this.randgen_wood_edge();}
if(this.rfh_pxpy[b][d] == null ||""+this.rfh_pxpy[b][d] == "undefined"){this.rfh_pxpy[b][d] = false;}
if(this.rfv_pxpy[b][d] == null ||""+this.rfv_pxpy[b][d] == "undefined"){this.rfv_pxpy[b][d] = this.randgen_rfh();}
if(this.rot_pxpy[b][d] == null ||""+this.rot_pxpy[b][d] == "undefined"){this.rot_pxpy[b][d] = 180;}
}
else
{
if(this.ids_pxpy[b][d] == null ||""+this.ids_pxpy[b][d] == "undefined"){this.ids_pxpy[b][d] = "tr1_core";}
if(this.rfh_pxpy[b][d] == null ||""+this.rfh_pxpy[b][d] == "undefined"){this.rfh_pxpy[b][d] = this.randgen_rfh();}
if(this.rfv_pxpy[b][d] == null ||""+this.rfv_pxpy[b][d] == "undefined"){this.rfv_pxpy[b][d] = this.randgen_rfh();}
if(this.rot_pxpy[b][d] == null ||""+this.rot_pxpy[b][d] == "undefined"){this.rot_pxpy[b][d] = this.randgen_rot();}
}
}
}
c = c+1;
}
}
a = a+1;
}
}
public function sub_rpy_dat_mt(x,y,w,h) // not needed .
{
}
public function update_cur_obj_idn()
{
this.cur_obj_id0 +=1;
if(this.cur_obj_id0 > 2147000999){this.cur_obj_id0 = 0; this.cur_obj_id1+=1;}
}
}
No comments:
Post a Comment