<!-- SAGA-SOLID · part 45 -->
 moveMode, position it ahead */
(function(){
  var _origAnimate = window._animate || null;
  window._dynamics = window._dynamics || [];
  window._dynamics.push(function(t){
    try{
      ensureFlySword();
      if(typeof moveMode !== 'undefined' && moveMode === 'fly'){
        _flySword.visible = true;
        /* Position ahead of player, pointing in camera direction */
        var fwdX = -Math.cos(camYaw), fwdZ = -Math.sin(camYaw);
        _flySword.position.set(
          kingPos.x + fwdX * 6,
          kingPos.y + 2,
          kingPos.z + fwdZ * 6
        );
        _flySword.rotation.y = Math.atan2(fwdX, fwdZ);
      } else {
        _flySword.visible = false;
      }
    }catch(e){ console.error(e); }
  });
})();












/* 10,000 PASSES — maximum detail. Every surface, every edge. 2026-10-04. */
function detailEverything(){
  try{
    window._dynamics = window._dynamics || [];

    /* STARS in the black sky */
    var starGeo = new THREE.BufferGeometry();
    var starPos = new Float32Array(1000 * 3);
    for(var s = 0; s < 1000; s++){
      starPos[s*3] = (Math.random() - 0.5) * 1500;
      starPos[s*3+1] = 100 + Math.random() * 400;
      starPos[s*3+2] = (Math.random() - 0.5) * 1500;
    }
    starGeo.setAttribute('position', new THREE.BufferAttribute(starPos, 3));
    var starMat = new THREE.PointsMaterial({color: 0xffffff, size: 1.5, transparent: true, opacity: 0.8});
    var stars = new THREE.Points(starGeo, starMat);
    scene.add(stars);
    window._dynamics.push(function(t){
      starMat.opacity = 0.6 + Math.sin(t * 0.5) * 0.2;
    });

    /* DETAILED: Towers get doors, trim, antennas */
    scene.traverse(function(obj){
      if(obj.isMesh && obj.geometry && obj.geometry.type === 'BoxGeometry'){
        var p = obj.geometry.parameters;
        if(p && p.height > 8 && p.width < 10 && p.width > 5){
          /* Door */
          var door = new THREE.Mesh(new THREE.PlaneGeometry(2, 3),
            new THREE.MeshStandardMaterial({color: 0x0a0a0a, roughness: 0.9}));
          door.position.set(0, -p.height/2 + 1.5 + 0.13, p.depth/2 + 0.06);
          obj.add(door);
          /* Trim at top */
          var trim = new THREE.Mesh(new THREE.BoxGeometry(p.width + 0.5, 0.3, p.depth + 0.5),
            new THREE.MeshStandardMaterial({color: 0xd4a017, metalness: 0.6, roughness: 0.4}));
          trim.position.set(0, p.height/2 - 0.5, 0);
          obj.add(trim);
          /* Antenna */
          if(Math.random() > 0.5){
            var ant = new THREE.Mesh(new THREE.CylinderGeometry(0.1, 0.1, 4, 4),
              new THREE.MeshStandardMaterial({color: 0x888888}));
            ant.position.set(0, p.height/2 + 2, 0);
            obj.add(ant);
            var tip = new THREE.Mesh(new THREE.SphereGeometry(0.3, 6, 5),
              new THREE.MeshBasicMaterial({color: 0xff0000}));
            tip.position.set(0, p.height/2 + 4, 0);
            obj.add(tip);
            window._dynamics.push((function(tip){
              return function(t){ tip.material.color.setHSL(0, 1, 0.5 + Math.sin(t * 4) * 0.3); };
            })(tip));
          }
        }
      }
    });

    /* DETAILED: Trees get branches */
    if(window._trees){
      var branchMat = new THREE.MeshStandardMaterial({color: 0x3a2a0a, roughness: 0.9});
      for(var ti = 0; ti < window._trees.length; ti++){
        var tree = window._trees[ti];
        for(var br = 0; br < 3; br++){
          var branch = new THREE.Mesh(new THREE.CylinderGeometry(0.15, 0.25, 2.5, 5), branchMat);
          var ba = (br / 3) * Math.PI * 2;
          branch.position.set(Math.cos(ba) * 1.2, -1, Math.sin(ba) * 1.2);
          branch.rotation.z = Math.cos(ba) * 0.6;
          branch.rotation.x = Math.sin(ba) * 0.6;
          tree.add(branch);
        }
      }
    }

    /* DETAILED: Flowers get petals */
    scene.traverse(function(obj){
      if(obj.isMesh && obj.geometry && obj.geometry.type === 'SphereGeometry' && obj.geometry.parameters.radius === 0.5){
        /* This is a flower bloom — add petals */
        var petalMat = obj.material;
        for(var pt = 0; pt < 5; pt++){
          var pa = (pt / 5) * Math.PI * 2;
          var petal = new THREE.Mesh(new THREE.PlaneGeometry(0.4, 0.8), petalMat);
          petal.position.set(Math.cos(pa) * 0.5, 0, Math.sin(pa) * 0.5);
          petal.rotation.y = -pa;
          petal.rotation.x = -0.4;
          obj.add(petal);
        }
      }
    });

    /* DETAILED: Statues get arms and robes */
    scene.traverse(function(obj){
      if(obj.isMesh && obj.geometry && obj.geometry.type === 'CylinderGeometry' && obj.position.y === 8){
        /* Statue body — add arms */
        var armMat = obj.material;
        for(var arm = 0; arm < 2; arm++){
          var armMesh = new THREE.Mesh(new THREE.CylinderGeometry(0.4, 0.5, 6, 6), armMat);
          var side = arm === 0 ? -1 : 1;
          armMesh.position.set(side * 2.5, 2, 0);
          armMesh.rotation.z = side * 0.4;
          obj.add(arm