<!-- RUBY-BACKUP · part 536 -->
function" && !FLYM){ setFly(true); codeStatus("shoes left the land — flying"); } meVel.y = Math.max(meVel.y, 0); onGround = false; } /* shoes pass the land → fly */
      var _half = (typeof MAP_UNITS!=='undefined' ? MAP_UNITS/2 : 600) - 2;
      mePos.x = Math.max(-_half, Math.min(_half, mePos.x));
      mePos.z = Math.max(-_half, Math.min(_half, mePos.z));
      if(_a3.lengthSq()>0.001){
        var wantFace = Math.atan2(_a3.x, _a3.z), df = wantFace-faceYaw;
        while(df>Math.PI) df -= Math.PI*2; while(df<-Math.PI) df += Math.PI*2;
        faceYaw += df*Math.min(1, dt*10);
      }
    }
    mePos.x = Math.max(-((typeof MAP_UNITS!=='undefined'?MAP_UNITS/2:600)-2), Math.min(((typeof MAP_UNITS!=='undefined'?MAP_UNITS/2:600)-2), mePos.x));
    mePos.z = Math.max(-((typeof MAP_UNITS!=='undefined'?MAP_UNITS/2:600)-2), Math.min(((typeof MAP_UNITS!=='undefined'?MAP_UNITS/2:600)-2), mePos.z));
    if(WALKLINE && WALK){
      var wlx = Math.round(mePos.x), wlz = Math.round(mePos.z);
      if(!walkLineLast || Math.abs(wlx-walkLineLast.x)+Math.abs(wlz-walkLineLast.z) >= 2){
        walkLineLast = {x:wlx, z:wlz};
        if(!(wlx===0 && wlz===0) && !stoneAt(wlx, wlz, 0)){
          var wlg = placeStone(wlx, wlz, 1, curShapeKey, false, true, 0);
          if(wlg){ addSeamsFor(wlg); shareStones([wlg]); }
        }
      }
    }
    var cpw = Math.cos(camPitch);
    if(MIRROR){
      /* the mirror — the camera stands before you, so you see yourself */
      var mhh = AVATAR==='king' ? 0.75 : 0.2;
      _a1.set(Math.sin(camYaw), 0, Math.cos(camYaw));
      (function(){
      var cgy=(typeof groundY==='function')?groundY(mePos.x, mePos.z):0;
      camera.position.set(mePos.x + _a1.x*2.4, Math.max(mePos.y + mhh, cgy+0.6), mePos.z + _a1.z*2.4);
    })();
      camera.lookAt(mePos.x, mePos.y + 0.5, mePos.z);
      if(myAvatar) myAvatar.visible = true;
      if(myWearGrp) myWearGrp.visible = true;
    }else if(CROWN){
      /* the camera sits in the crown — through your own eyes */
      var hh = AVATAR==='king' ? 0.95 : (AVATAR==='provolta' ? 1.75 : 0.2);
      if(crownIntro){
        /* startup: glide in from outside — the gaze lifts from his face to the horizon
           as the camera settles into the crown. never stares at his feet. */
        if(crownIntroT === 0 || !crownIntroFrom){
          crownIntroFrom = new T.Vector3(mePos.x - 20*Math.sin(camYaw), mePos.y + 11, mePos.z - 20*Math.cos(camYaw));
          camera.position.copy(crownIntroFrom);
        }
        crownIntroT += dt;
        var cik = Math.min(1, crownIntroT/2.5), cie = cik*cik*(3-2*cik);
        _a1.set(mePos.x, mePos.y + hh, mePos.z);
        camera.position.lerpVectors(crownIntroFrom, _a1, cie);
        var igy = groundY(camera.position.x, camera.position.z);
        if(camera.position.y < igy + 0.6) camera.position.y = igy + 0.6;
        _a2.set(Math.sin(camYaw)*Math.cos(camPitch), Math.sin(camPitch), Math.cos(camYaw)*Math.cos(camPitch));
        _a3.set(mePos.x, mePos.y + 0.6, mePos.z);
        _a2.add(_a1);
        _a3.lerp(_a2, cie);
        camera.lookAt(_a3);
        if(myAvatar) myAvatar.visible = true;
        if(myWearGrp) myWearGrp.visible = true;
        if(cik >= 1){ crownIntro = false; crownIntroT = 0; crownIntroFrom = null; }
      }else{
        var cgy = groundY(mePos.x, mePos.z);
        camera.position.set(mePos.x, Math.max(mePos.y + hh, cgy + 0.6), mePos.z);
        _a1.set(Math.sin(camYaw)*Math.cos(camPitch), Math.sin(camPitch), Math.cos(camYaw)*Math.cos(camPitch));
        _a2.copy(camera.position).add(_a1);
        camera.lookAt(_a2);
        if(myAvatar) myAvatar.visible = false;
        if(myWearGrp) myWearGrp.visible = false;
      }
    }else{
      var wgy = groundY(mePos.x + camDist*Math.sin(camYaw)*cpw, mePos.z + camDist*Math.cos(camYaw)*cpw);
      camera.position.set(
        mePos.x + camDist*Math.sin(camYaw)*cpw,
        Math.max(mePos.y + 0.22 + camDist*Math.sin(camPitch), wgy + 0.6),
        mePos.z + camDist*Math.cos(camYaw)*cpw
      );
      camera.lookAt(mePos.x, mePos.y+0.16, mePos.z);
      if(myAvatar) myAvatar.visible = true;
      if(myWearGrp) myWearGrp.visible = true;
    }
    /* the floating sword, its point seeking */
    if(swordGrp){
      swordGrp.visible = FLYM;
      if(FLYM){
        _a1.set(Math.sin(aimYaw)*Math.cos(aimPitch), Math.sin(aimPitch), Math.cos(aimYaw)*Math.cos(aimPitch));
        _a2.set(-Math.cos(aimYaw), 0, Math.sin(aimYaw));
        _a3.copy(mePos).addScaledVector(_a1, -0.12);
        _a3.y += 0.30 + Math.sin(t*2.2)*0.02;
        _a3.addScaledVector(_a2, 0.16);
        swordGrp.position.copy(_a3);
        _a3.add(_a1); swordGrp.lookAt(_a3);
        aimTick += dt;
        if(aimTick > 0.25){
          aimTick = 0;
          _a2.copy(swordGrp.position).addScaledVector(_a1, 0.58);
          rayc.set(_a2, _a1);
          var ah = rayc.intersectObjects(stones.children, true);
          var ng = ah.length ? stoneGroupOf(ah[0].object) : null;
         