// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %rbx
subq $0x58, %rsp
movapd %xmm0, %xmm2
movq %rdi, %rbx
movslq 0x14(%rdi), %rax
movq 0x8(%rdi), %rcx
imulq $0x178, %rax, %rax      # imm = 0x178
addq %rcx, %rax
addq $-0xd0, %rax
movl 0x118(%rax), %ecx
decl %ecx
cmpl $0x2, %ecx
ja 0x672f3
movl %ecx, %ecx
leaq 0x6524(%rip), %rdx      # 0x6d810
movsd (%rdx,%rcx,8), %xmm0
jmp 0x672fb
movsd 0x4b35(%rip), %xmm0     # 0x6be30
movapd %xmm0, -0x50(%rbp)
subsd 0x8(%rax), %xmm2
subsd 0x10(%rax), %xmm1
movapd 0x1cfe(%rip), %xmm3     # 0x69010
movapd %xmm2, -0x30(%rbp)
andpd %xmm3, %xmm2
movsd 0x1d1d(%rip), %xmm4     # 0x69040
ucomisd %xmm2, %xmm4
movapd %xmm1, -0x20(%rbp)
jbe 0x6733c
andpd %xmm1, %xmm3
xorpd %xmm0, %xmm0
ucomisd %xmm3, %xmm4
ja 0x673a0
movapd %xmm1, %xmm0
movapd -0x30(%rbp), %xmm1
callq 0x90d0
mulsd 0x1cf6(%rip), %xmm0     # 0x69048
divsd 0x1cf6(%rip), %xmm0     # 0x69050
movsd 0x1cfe(%rip), %xmm2     # 0x69060
ucomisd %xmm0, %xmm2
jbe 0x6737c
movsd 0x1d00(%rip), %xmm1     # 0x69070
addsd %xmm1, %xmm0
ucomisd %xmm0, %xmm2
ja 0x67370
jmp 0x673a0
ucomisd 0x1cc4(%rip), %xmm0     # 0x69048
jb 0x673a0
movsd 0x1cda(%rip), %xmm2     # 0x69068
movsd 0x1cb2(%rip), %xmm1     # 0x69048
addsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jae 0x67396
movapd %xmm0, -0x40(%rbp)
movslq 0x14(%rbx), %rax
movq 0x8(%rbx), %rcx
imulq $0x178, %rax, %rax      # imm = 0x178
leaq (%rax,%rcx), %rdi
addq $-0xd0, %rdi
callq 0x59a22
movapd -0x40(%rbp), %xmm2
subsd %xmm0, %xmm2
movsd 0x1c8b(%rip), %xmm0     # 0x69060
ucomisd %xmm2, %xmm0
jbe 0x673f4
movsd 0x1c8d(%rip), %xmm1     # 0x69070
movapd -0x20(%rbp), %xmm3
addsd %xmm1, %xmm2
ucomisd %xmm2, %xmm0
ja 0x673e8
jmp 0x67424
ucomisd 0x1c4c(%rip), %xmm2     # 0x69048
jae 0x67405
movapd -0x20(%rbp), %xmm3
jmp 0x67424
movsd 0x1c5b(%rip), %xmm0     # 0x69068
movsd 0x1c33(%rip), %xmm1     # 0x69048
movapd -0x20(%rbp), %xmm3
addsd %xmm0, %xmm2
ucomisd %xmm1, %xmm2
jae 0x6741a
mulsd %xmm3, %xmm3
movapd -0x30(%rbp), %xmm0
mulsd %xmm0, %xmm0
addsd %xmm3, %xmm0
xorps %xmm1, %xmm1
sqrtsd %xmm0, %xmm1
movsd 0x2ea4(%rip), %xmm0     # 0x6a2e8
mulsd %xmm1, %xmm0
addsd 0x2570(%rip), %xmm0     # 0x699c0
movapd %xmm1, -0x30(%rbp)
divsd %xmm1, %xmm0
ucomisd 0x2e5f(%rip), %xmm0     # 0x6a2c0
movapd %xmm2, -0x40(%rbp)
jae 0x6748d
movsd 0x2e58(%rip), %xmm1     # 0x6a2c8
ucomisd %xmm0, %xmm1
jae 0x67497
callq 0x9840
mulsd 0x1bc5(%rip), %xmm0     # 0x69048
divsd 0x1bc5(%rip), %xmm0     # 0x69050
jmp 0x6749f
movsd 0x1c1b(%rip), %xmm0     # 0x690b0
jmp 0x6749f
movsd 0x1c19(%rip), %xmm0     # 0x690b8
movsd %xmm0, -0x20(%rbp)
callq 0x49360
movsd 0x3178(%rax), %xmm0
mulsd 0x2a97(%rip), %xmm0     # 0x69f50
movapd %xmm0, -0x60(%rbp)
callq 0x49360
movapd -0x60(%rbp), %xmm2
addsd 0x3178(%rax), %xmm2
movapd -0x40(%rbp), %xmm1
andpd 0x1b33(%rip), %xmm1     # 0x69010
addsd -0x20(%rbp), %xmm1
movapd -0x50(%rbp), %xmm0
cmpnltpd %xmm1, %xmm0
movapd -0x30(%rbp), %xmm1
cmplepd %xmm2, %xmm1
orpd %xmm0, %xmm1
movd %xmm1, %eax
andb $0x1, %al
addq $0x58, %rsp
popq %rbx
popq %rbp
retq
nop