// CBall - [2020-04-13 11:57:46]
#ifndef _CBALL_H_
#define _CBALL_H_

#include "common.h"
#include "XMATH.h"
#include "TGame.h"

/*

00156E3C CBall::UpdateFrame()
00156F38 CBall::CheckEvents()
001575DC CBall::ClampSpeed(int,int)
00157648 CBall::Stop()
00157668 CBall::SetVel(int,int,int)
00157678 CBall::SetVelRel(int,int,int)
00157698 CBall::AdjustKickToPos(TPoint)
001577B4 CBall::SetBallMoveToPosSpin(TPoint3D *,int,int,TPoint3D,TPoint3D,int,int)
0015799E CBall::operator=(CBall const&)
00157A3C CBall::SetBallMoveToPosLowSpin(TPoint3D *,int,int,TPoint3D,TPoint3D,int,int)
00157C94 CBall::GetPassPowerX(int,int)
00157D08 CBall::GetPassLength(int,int)
00157DA4 CBall::SetBallMoveToPos(TPoint3D *,TPoint3D,TPoint3D,int,int,int)
00157EAC CBall::SetBallMoveToPosLow(TPoint3D *,TPoint3D,TPoint3D,int,int)
00157FF4 CBall::AirResistanceInit()
0015806C CBall::ProjectionPassLengthInit()
00158148 CBall::PlayNetSound()
0015818C CBall::CornerFlagCollision(int,int)
00158228 CBall::PointBallTest(TPoint *,int)
00158254 CBall::DoBallGoalBounce()
00158638 CBall::Deflect()
001586DC CBall::CheckPostXYCol(TPoint3D)
001588E8 CBall::CheckPostYZCol(TPoint3D)
0015897C CBall::DoBallPostCollisions()
001589CC CBall::BannerCollisionX(int)
00158A60 CBall::BannerCollisionY(int)
001592A0 CBall::CounterBallSpinZ(int)
001592F8 CBall::ApplySpin(TPoint3D *,TPoint3D *,int,int)
00159334 CBall::ApplyExactSpin(TPoint3D *,TPoint3D *,int,int)
00159370 CBall::ApplyGroundSpin(TPoint3D *,TPoint3D *)
00159404 CBall::CalcSpeed()
0015946C CBall::CalcVars()
001595A4 CBall::CheckBallInGoal()

0xDC
*/

class CBall {
public:
  void UpdateFrame();                                                               // 00156E3C
  void CheckEvents();                                                               // 00156F38
  void ClampSpeed(int, int);                                                        // 001575DC
  void Stop();                                                                      // 00157648
  __attribute__((noinline)) void SetVel(int, int, int);                             // 00157668
  void SetVelRel(int, int, int);                                                    // 00157678
  void AdjustKickToPos(TPoint);                                                     // 00157698
  int SetBallMoveToPosSpin(TPoint3D *, int, int, TPoint3D, TPoint3D, int, int);     // 001577B4
  CBall &operator=(CBall const &);                                                  // 0015799E
  int SetBallMoveToPosLowSpin(TPoint3D *, int, int, TPoint3D, TPoint3D, int, int);  // 00157A3C
  int GetPassPowerX(int, int);                                                      // 00157C94
  int GetPassLength(int, int);                                                      // 00157D08
  int SetBallMoveToPos(TPoint3D *, TPoint3D, TPoint3D, int, int, int);              // 00157DA4
  int SetBallMoveToPosLow(TPoint3D *, TPoint3D, TPoint3D, int, int);                // 00157EAC
  void AirResistanceInit();                                                         // 00157FF4
  void ProjectionPassLengthInit();                                                  // 0015806C
  void PlayNetSound();                                                              // 00158148
  void CornerFlagCollision(int, int);                                               // 0015818C
  int PointBallTest(TPoint *, int);                                                 // 00158228
  void DoBallGoalBounce();                                                          // 00158254
  void Deflect();                                                                   // 00158638
  bool CheckPostXYCol(TPoint3D);                                                    // 001586DC
  bool CheckPostYZCol(TPoint3D);                                                    // 001588E8
  bool DoBallPostCollisions();                                                      // 0015897C
  bool BannerCollisionX(int);                                                       // 001589CC
  bool BannerCollisionY(int);                                                       // 00158A60
  void CounterBallSpinZ(int);                                                       // 001592A0
  void ApplySpin(TPoint3D *, TPoint3D *, int, int);                                 // 001592F8
  void ApplyExactSpin(TPoint3D *, TPoint3D *, int, int);                            // 00159334
  void ApplyGroundSpin(TPoint3D *, TPoint3D *);                                     // 00159370
  void CalcSpeed();                                                                 // 00159404
  void CalcVars();                                                                  // 0015946C
  void CheckBallInGoal();                                                           // 001595A4

  bool field_0;
  uint8 field_1;
  uint8 field_2;
  uint8 field_3;
  TPoint3D ballPosPrev_4;  // 0016FB3E 此处可断定，类型为TPoint3D
  TPoint3D ballMovePrev_10;
  TPoint3D point3D_1C;
  uint speedXY_28;  // point3D_10 的xy坐标的距离
  TPoint3D point3D_2C;
  TPoint3D point3D_38;
  TPoint3D point3D_44;
  uint speedXYZ_50;  // point3D_10 的xyz坐标的距离
  TPoint3D point3D_54;
  TPoint point_60;
  TQuat quat_68;
  TPoint3D point3D_78;
  TPoint3D point3D_84;
  int field_90;
  int HeightTime_94;
  TPoint TimePos_98;
  int field_A0;
  int field_A4;
  int field_A8;
  int field_AC;
  int field_B0;
  int field_B4;
  int field_B8;
  int field_BC;
  int field_C0;
  TPoint TimePos_C4;
  int HeightTime_CC;
  TPoint TimePos_D0;
  int HeightTime_D8;
  static uint16 s_iAirResistanceDistMult[201];
  static int16 s_iAirResistanceMult[201];
  static int s_iPassProjectionLength[180][360];
  static int s_iPassProjectionLength_COKTime[360];
};

extern CBall cBall;  // 00356A70

extern TPoint G_vGoalPos[2];

#endif  //_CBALL_H_