// File: wrighteagle2d[P]wrighteaglebase/Debug/../src/WorldState.cpp
// Function: WorldStateUpdater::ComputeShouldSeeOrNot(Vector)
bool WorldStateUpdater::ComputeShouldSeeOrNot(Vector pos) {
  double view_angle = 0;
  switch (GetSelf().GetViewWidth()) {
  case VW_Narrow:
    view_angle = 60;
    break;
  case VW_Normal:
    view_angle = 120;
    break;
  case VW_Wide:
    view_angle = 180;
    break;
  default:
    view_angle = 120;
    break;
  }

  //获得位置相对自己的夹角
  Vector dist_vec = pos - GetSelf().GetPos();
  double angle = GetNormalizeAngleDeg(dist_vec.Dir());
  angle = ::fabs(::GetNormalizeAngleDeg(angle - GetSelf().GetNeckGlobalDir()));
  double anglebuf = ASin((1 * 0.6 + 0.05 * dist_vec.Mod()) / dist_vec.Mod());
  angle += anglebuf; // different from ComputePlayerMaySeeOrNot

  //完全视角内可见
  double distbuf = 0.05 * ServerParam::instance().visibleDistance();
  if (dist_vec.Mod() <= ServerParam::instance().visibleDistance() - distbuf) {
    return true;
  }

  //角度在视角内
  if (angle > view_angle / 2) {
    return false;
  }

  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movsd %xmm0, -0x18(%rbp)
movsd %xmm1, -0x10(%rbp)
movq %rdi, -0x20(%rbp)
movq -0x20(%rbp), %rdi
movq %rdi, -0x78(%rbp)
movq $0x0, -0x28(%rbp)
callq 0xbcea0
movq %rax, %rdi
callq 0x11070
movl %eax, %ecx
movl %ecx, -0x6c(%rbp)
subl $0x1, %eax
je 0xbc286
jmp 0xbc272
movl -0x6c(%rbp), %eax
subl $0x2, %eax
je 0xbc295
jmp 0xbc27c
movl -0x6c(%rbp), %eax
subl $0x3, %eax
je 0xbc2a4
jmp 0xbc2b3
movsd 0x5a02(%rip), %xmm0     # 0xc1c90
movsd %xmm0, -0x28(%rbp)
jmp 0xbc2c0
movsd 0x664b(%rip), %xmm0     # 0xc28e8
movsd %xmm0, -0x28(%rbp)
jmp 0xbc2c0
movsd 0x4d7c(%rip), %xmm0     # 0xc1028
movsd %xmm0, -0x28(%rbp)
jmp 0xbc2c0
movsd 0x662d(%rip), %xmm0     # 0xc28e8
movsd %xmm0, -0x28(%rbp)
movq -0x78(%rbp), %rdi
callq 0xbcea0
movq %rax, %rdi
addq $0x8, %rdi
callq 0x11090
movq %rax, %rsi
leaq -0x18(%rbp), %rdi
callq 0x110a0
movsd %xmm0, -0x38(%rbp)
movsd %xmm1, -0x30(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x10520
movsd 0x4d34(%rip), %xmm1     # 0xc1030
movsd %xmm1, -0x48(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x116b0
movq -0x78(%rbp), %rdi
movsd %xmm0, -0x40(%rbp)
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
callq 0xbcea0
movq %rax, %rdi
callq 0xa95b0
movaps %xmm0, %xmm1
movsd -0x90(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd 0x4cec(%rip), %xmm1     # 0xc1030
movsd %xmm1, -0x50(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x116b0
movaps 0x4d07(%rip), %xmm1     # 0xc1060
pand %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x104e0
movsd 0x5b65(%rip), %xmm1     # 0xc1ed8
mulsd %xmm1, %xmm0
movsd 0x55e9(%rip), %xmm1     # 0xc1968
addsd %xmm1, %xmm0
movsd %xmm0, -0x88(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x104e0
movaps %xmm0, %xmm1
movsd -0x88(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x60(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x32500
movsd %xmm0, -0x58(%rbp)
movsd -0x58(%rbp), %xmm0
addsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
callq 0x855e0
movq %rax, %rdi
callq 0x8b250
movsd 0x5afe(%rip), %xmm0     # 0xc1ed8
mulsd (%rax), %xmm0
movsd %xmm0, -0x68(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x104e0
movsd %xmm0, -0x80(%rbp)
callq 0x855e0
movq %rax, %rdi
callq 0x8b250
movsd -0x80(%rbp), %xmm1
movsd (%rax), %xmm0
subsd -0x68(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0xbc418
movb $0x1, -0x1(%rbp)
jmp 0xbc43e
movsd -0x40(%rbp), %xmm0
movsd -0x28(%rbp), %xmm1
movsd 0x5086(%rip), %xmm2     # 0xc14b0
divsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0xbc43a
movb $0x0, -0x1(%rbp)
jmp 0xbc43e
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax)