// File: /workspace/github_cpp_makefile_star2_O2/wrighteagle2d[P]wrighteaglebase/Debug/../src/Kicker.cpp
// Function: Kicker::Kicker()
Kicker::Kicker() {
  /** POINTS_NUM = 81 = 18 + 27 + 36 */
  mNlayer[0] = 18;
  mNlayer[1] = 27;
  mNlayer[2] = 36;

  mD1 = 0.585; /** (mDlayer[0] + mDlayer[1]) / 2.0 */
  mD2 = 0.835; /** (mDlayer[1] + mDlayer[2]) / 2.0 */
  mDlayer[0] = 0.46;
  mDlayer[1] = 0.71;
  mDlayer[2] = 0.96; /** 球员的kick_area是0.985到1.185之间 */

  /** 计算所有的点 */
  int k = 0;
  AngleDeg angle = 0.0;
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < mNlayer[i]; ++j) {
      angle = 360.0 * j / mNlayer[i];
      mPoint[k] = Polar2Vector(mDlayer[i], angle);
      ++k;
    }
  }

  mOppCurve.SetOutMinMax(0.0, 1.0);
  mOppCurve.Interpolate(0.0, 0.0, 1.0, 0.8, 2.0,
                        1.0); /** 输入为近身对手离球的距离减去球员的kick_area */
  mRandCurve.SetOutMinMax(0.6, 1.0);
  mRandCurve.Interpolate(0.0, 1.0, 1.0, 0.9, 2.0,
                         0.6); /** 输入为max_rand中属于球位置因素的部分 */
  mSpeedCurve.SetOutMinMax(0.0, 1.0);
  mSpeedCurve.Interpolate(0.0, 0.0, 1.6, 0.8,
                          ServerParam::instance().ballSpeedMax(), 1.0);

  //==========================================================================

  mInput.mPlayerType = -1;
  mKickSpeed = 0.0;
  mKickTarget = Vector(0.0, 0.0);

  for (int i = 0; i < POINTS_NUM; ++i) {
    mKickRate[i] = 0.0;
    mMaxAccel[i] = 0.0;
    mRandEva[i] = 0.0;
    mPointEva[i] = 0.0;
  }

  mMaxRandFactor = 0.0;

  for (int i = 0; i < 360; ++i) {
    for (int j = 0; j < 3; ++j) {
      mMaxSpeed[i][j] = 0.0;
    }
  }

  /** 将要读取或计算mKickerValue表 */
  memset(mKickerValue, 0, sizeof(mKickerValue));

  if (PlayerParam::instance().KickerMode() == 0) {
    ReadUtilityTable();
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rbx
andl $0x0, (%rdi)
movl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
movq %rax, 0x4(%rdi)
movb $0x0, 0xc(%rdi)
leaq 0x30(%rdi), %rax
movq %rax, -0x78(%rbp)
addq $0x48, %rdi
xorl %r12d, %r12d
movl $0x510, %edx            # imm = 0x510
xorl %esi, %esi
callq 0x92c0
leaq 0x2b4508(%rbx), %rax
movq %rax, -0x58(%rbp)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x2b4508(%rbx)
movupd %xmm0, 0x2b4518(%rbx)
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, 0x2b4528(%rbx)
leaq 0x2b4530(%rbx), %rax
movq %rax, -0x60(%rbp)
movupd %xmm0, 0x2b4530(%rbx)
movupd %xmm0, 0x2b4540(%rbx)
movq %rcx, 0x2b4550(%rbx)
leaq 0x2b4558(%rbx), %rax
movq %rax, -0x68(%rbp)
movupd %xmm0, 0x2b4558(%rbx)
movupd %xmm0, 0x2b4568(%rbx)
movq %rcx, 0x2b4578(%rbx)
movupd %xmm0, 0x2b4588(%rbx)
movupd %xmm0, 0x2b4598(%rbx)
movupd %xmm0, 0x2b45b0(%rbx)
movupd %xmm0, 0x2b45c0(%rbx)
leaq 0x2b5010(%rbx), %rdi
movupd %xmm0, 0x2b45d8(%rbx)
callq 0x2a70c
leaq 0x2bb550(%rbx), %rdi
movl $0xca80, %edx           # imm = 0xCA80
xorl %esi, %esi
callq 0x92c0
movq %rbx, %rcx
movabsq $0x1b00000012, %rax     # imm = 0x1B00000012
movq %rax, 0x10(%rbx)
movl $0x24, 0x18(%rbx)
movabsq $0x3fe2b851eb851eb8, %rax # imm = 0x3FE2B851EB851EB8
movq %rax, 0x20(%rbx)
movabsq $0x3feab851eb851eb8, %rax # imm = 0x3FEAB851EB851EB8
movq %rax, 0x28(%rbx)
movabsq $0x3fdd70a3d70a3d71, %rax # imm = 0x3FDD70A3D70A3D71
movq %rax, 0x30(%rbx)
movabsq $0x3fe6b851eb851eb8, %rax # imm = 0x3FE6B851EB851EB8
movq %rax, 0x38(%rbx)
movabsq $0x3feeb851eb851eb8, %rax # imm = 0x3FEEB851EB851EB8
movq %rax, 0x40(%rbx)
leaq -0x50(%rbp), %rax
andq $0x0, (%rax)
leaq 0x50(%rbx), %rax
movq %rax, -0x70(%rbp)
xorl %r15d, %r15d
movq %rbx, %r13
cmpq $0x3, %r12
je 0x26c96
movq -0x78(%rbp), %rax
leaq (%rax,%r12,8), %r14
movslq %r15d, %r15
movq %r15, -0x80(%rbp)
shlq $0x4, %r15
addq -0x70(%rbp), %r15
xorl %ebx, %ebx
movl 0x10(%rcx,%r12,4), %eax
cmpl %eax, %ebx
jge 0x26c8a
cvtsi2sd %ebx, %xmm0
mulsd 0x3043e(%rip), %xmm0    # 0x57098
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
movq %r14, %rdi
leaq -0x50(%rbp), %rsi
callq 0xd15b
movq %r13, %rcx
movsd %xmm0, -0x8(%r15)
movsd %xmm1, (%r15)
incq %rbx
addq $0x10, %r15
jmp 0x26c45
incq %r12
movq -0x80(%rbp), %r15
addq %rbx, %r15
jmp 0x26c26
andq $0x0, 0x2b4520(%rcx)
movabsq $0x3ff0000000000000, %r15 # imm = 0x3FF0000000000000
movq %r15, 0x2b4528(%rcx)
leaq -0x48(%rbp), %rax
andq $0x0, (%rax)
movq %rax, %rsi
leaq -0x40(%rbp), %rax
andq $0x0, (%rax)
movq %rax, %rdx
leaq -0x30(%rbp), %rax
movq %r15, (%rax)
movq %rax, %rcx
movabsq $0x3fe999999999999a, %rax # imm = 0x3FE999999999999A
leaq -0x38(%rbp), %r12
movq %rax, (%r12)
movabsq $0x4000000000000000, %rax # imm = 0x4000000000000000
leaq -0x88(%rbp), %r14
movq %rax, (%r14)
leaq -0x90(%rbp), %rbx
movq %r15, (%rbx)
movq %rbx, (%rsp)
movq -0x58(%rbp), %rdi
movq %r12, %r8
movq %r14, %r9
callq 0x2a734
movabsq $0x3fe3333333333333, %rax # imm = 0x3FE3333333333333
movq %rax, 0x2b4548(%r13)
movq %r15, 0x2b4550(%r13)
leaq -0x48(%rbp), %rcx
andq $0x0, (%rcx)
leaq -0x40(%rbp), %rcx
movq %r15, (%rcx)
leaq -0x30(%rbp), %rcx
movq %r15, (%rcx)
movabsq $0x3feccccccccccccd, %rcx # imm = 0x3FECCCCCCCCCCCCD
movq %rcx, (%r12)
movabsq $0x4000000000000000, %rcx # imm = 0x4000000000000000
movq %rcx, (%r14)
movq %rax, (%rbx)
movq %rbx, (%rsp)
leaq -0x48(%rbp), %r14
leaq -0x40(%rbp), %rbx
leaq -0x30(%rbp), %rcx
leaq -0x38(%rbp), %r8
leaq -0x88(%rbp), %r12
movq -0x60(%rbp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r12, %r9
callq 0x2a734
andq $0x0, 0x2b4570(%r13)
movq %r15, 0x2b4578(%r13)
andq $0x0, (%r14)
andq $0x0, (%rbx)
movabsq $0x3ff999999999999a, %rax # imm = 0x3FF999999999999A
leaq -0x30(%rbp), %rcx
movq %rax, (%rcx)
movabsq $0x3fe999999999999a, %rax # imm = 0x3FE999999999999A
leaq -0x38(%rbp), %rcx
movq %rax, (%rcx)
callq 0x3db2c
leaq 0x30f8(%rax), %r9
movq %r15, (%r12)
movq %r12, (%rsp)
leaq -0x48(%rbp), %rsi
leaq -0x40(%rbp), %rdx
leaq -0x30(%rbp), %rcx
leaq -0x38(%rbp), %r8
movq -0x68(%rbp), %rdi
callq 0x2a734
orl $-0x1, 0x2b4580(%r13)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x2b45d0(%r13)
andq $0x0, 0x2b45e0(%r13)
movl $0x568bd, %eax          # imm = 0x568BD
cmpq $0x5690e, %rax          # imm = 0x5690E
je 0x26e41
andq $0x0, (%r13,%rax,8)
andq $0x0, 0x288(%r13,%rax,8)
andq $0x0, 0x510(%r13,%rax,8)
andq $0x0, 0x798(%r13,%rax,8)
incq %rax
jmp 0x26e13
leaq 0x2b9390(%r13), %rax
andq $0x0, 0x2b5008(%r13)
xorl %ecx, %ecx
cmpq $0x168, %rcx            # imm = 0x168
je 0x26e76
xorl %edx, %edx
cmpq $0x3, %rdx
je 0x26e6d
andq $0x0, (%rax,%rdx,8)
incq %rdx
jmp 0x26e5d
incq %rcx
addq $0x18, %rax
jmp 0x26e52
leaq 0x558(%r13), %rdi
movl $0x2b3fb0, %edx         # imm = 0x2B3FB0
xorl %esi, %esi
callq 0x92c0
callq 0x38d94
cmpl $0x0, 0x5c78(%rax)
jne 0x26e9f
movq %r13, %rdi
callq 0x26eae
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq