kevansevans

Untitled

Feb 29th, 2020
584
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function recursiveNodeTraversalVisibility(_nodeIndex:Int) {
  2.        
  3.         node_visited[_nodeIndex] = true;
  4.        
  5.         trace(_nodeIndex);
  6.        
  7.         var node = nodes[_nodeIndex];
  8.        
  9.         var fronsubsec:Bool = false;
  10.         var backsubsec:Bool = false;
  11.        
  12.         //Check if we've gone down both nodes
  13.         if (node_visited[node.frontChildID] && node_visited[node.backChildID]) {
  14.             if (node.parent == -1) {
  15.                 trace("I didn't continue, top of tree, both visited!");
  16.                 return;
  17.             }
  18.             trace("Both nodes visited, visiting my mama!");
  19.             recursiveNodeTraversalVisibility(node.parent);
  20.             return;
  21.         }
  22.         if (node_visited[node.frontChildID]) {
  23.             fronsubsec = true;
  24.             trace("Front was visited"); //<- Won't continue past here if met
  25.         }
  26.         if (node_visited[node.backChildID]) {
  27.             backsubsec = true;
  28.             trace("back was visited"); //<- Won't continue past here if met
  29.         }
  30.        
  31.         if (fronsubsec == true && backsubsec == true) {
  32.             recursiveNodeTraversalVisibility(node.parent);
  33.             trace("I went back up!");
  34.             return;
  35.         } else {
  36.            
  37.             if (node.frontChildID & Node.SUBSECTORIDENTIFIER > 0) {
  38.                 fronsubsec = true;
  39.                 subsectorVisibilityCheck(node.frontChildID & (~Node.SUBSECTORIDENTIFIER));
  40.                 trace("Front side is a node!");
  41.             }
  42.             if (node.backChildID & Node.SUBSECTORIDENTIFIER > 0) {
  43.                 backsubsec = true;
  44.                 subsectorVisibilityCheck(node.backChildID & (~Node.SUBSECTORIDENTIFIER));
  45.                 trace("Back side is a node!");
  46.             }
  47.         }
  48.        
  49.         //Do we need to keep searching down the tree?
  50.         if (fronsubsec == true && backsubsec == false) {
  51.             recursiveNodeTraversalVisibility(node.backChildID);
  52.             trace("I went down front, but not back");
  53.             return;
  54.         }
  55.         if (fronsubsec == false && backsubsec == true) {
  56.             recursiveNodeTraversalVisibility(node.frontChildID);
  57.             trace("I went down back, but not front");
  58.             return;
  59.         }
  60.         if (fronsubsec == true && backsubsec == true) {
  61.             recursiveNodeTraversalVisibility(node.parent);
  62.             trace("Let's visit papa just in case");
  63.             return;
  64.         }
  65.        
  66.         //neither have been visited, neither are subsectors, so which one is closer?
  67.         var isOnBack:Bool = isPointOnBackSide(actors_players[0].xpos, actors_players[0].ypos, _nodeIndex);
  68.         trace(isOnBack);
  69.         if (isOnBack) {
  70.             trace("Back was closer, so I went that way");
  71.             recursiveNodeTraversalVisibility(node.backChildID);
  72.         } else {
  73.             trace("Front was closer, so I went that way");
  74.             recursiveNodeTraversalVisibility(node.frontChildID);
  75.         }
  76.     }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×