22 #ifndef SCUMM_HE_BASKETBALL_COLLISION_BBALL_COLLISION_CYLINDER_H 23 #define SCUMM_HE_BASKETBALL_COLLISION_BBALL_COLLISION_CYLINDER_H 27 #include "scumm/he/basketball/collision/bball_collision_object.h" 28 #include "scumm/he/basketball/collision/bball_collision_stack.h" 32 #define MAX_STEP_HEIGHT 50 41 class CCollisionCylinder :
public ICollisionObject,
public U32Cylinder {
43 CCollisionCylinder() : ICollisionObject(kCylinder),
46 _movementType(EMovementType::kStraight),
48 _positionSaved(false) {}
50 ~CCollisionCylinder() {}
52 using ICollisionObject::getObjectDistance;
53 float getObjectDistance(
const CCollisionSphere &targetObject)
const override;
54 float getObjectDistance(
const CCollisionBox &targetObject)
const override;
55 float getObjectDistance(
const CCollisionCylinder &targetObject)
const override;
57 using ICollisionObject::testObjectIntersection;
58 bool testObjectIntersection(
const CCollisionSphere &targetObject, U32Distance3D *distance)
const override;
59 bool testObjectIntersection(
const CCollisionBox &targetObject, U32Distance3D *distance)
const override;
60 bool testObjectIntersection(
const CCollisionCylinder &targetObject, U32Distance3D *distance)
const override;
62 using ICollisionObject::validateCollision;
63 bool validateCollision(
const CCollisionCylinder &targetObject, U32Distance3D *distance)
override;
65 using ICollisionObject::backOutOfObject;
66 bool backOutOfObject(
const CCollisionBox &targetObject, U32Distance3D *distance,
float *timeUsed)
override;
67 bool backOutOfObject(
const CCollisionCylinder &targetObject, U32Distance3D *distance,
float *timeUsed)
override;
69 using ICollisionObject::nudgeObject;
70 bool nudgeObject(
const CCollisionBox &targetObject, U32Distance3D *distance,
float *timeUsed)
override;
71 bool nudgeObject(
const CCollisionCylinder &targetObject, U32Distance3D *distance,
float *timeUsed)
override;
73 using ICollisionObject::isCollisionHandled;
74 bool isCollisionHandled(
const CCollisionSphere &targetObject)
const override {
return false; };
76 void handleCollisions(CCollisionObjectVector *collisionVector,
float *timeUsed,
bool advanceObject)
override;
77 void handleCollision(
const CCollisionCylinder &targetCylinder,
float *timeUsed, U32Distance3D *distance,
bool advanceObject)
override;
78 void handleCollision(
const CCollisionBox &targetBox,
float *pTimeUsed, U32Distance3D *distance,
bool advanceObject)
override;
80 using ICollisionObject::isOnObject;
81 bool isOnObject(
const CCollisionSphere &targetObject,
const U32Distance3D &distance)
const override;
82 bool isOnObject(
const CCollisionBox &targetObject,
const U32Distance3D &distance)
const override;
83 bool isOnObject(
const CCollisionCylinder &targetObject,
const U32Distance3D &distance)
const override;
85 U32FltPoint3D findNearestPoint(
const U32FltPoint3D &testPoint)
const override;
86 int getEquidistantPoint(U32FltPoint2D inPoint1,
float distance1, U32FltPoint2D inPoint2,
float distance2, U32FltPoint2D *outPoint1, U32FltPoint2D *outPoint2);
88 U32BoundingBox getBoundingBox()
const override;
89 U32BoundingBox getBigBoundingBox()
const override;
92 void restore()
override;
99 EMovementType _movementType;
101 const ICollisionObject *_revCenter;
103 U32FltPoint2D _revCenterPt;
106 float getDimensionDistance(
const CCollisionBox &targetObject, EDimension dimension)
const;
107 float getDimensionDistance(
const CCollisionSphere &targetObject, EDimension dimension)
const;
108 float getDimensionDistance(
const CCollisionCylinder &targetObject, EDimension dimension)
const;
112 U32FltPoint3D _safetyPoint;
113 U32FltVector3D _safetyVelocity;
115 bool backStraightOutOfObject(
const ICollisionObject &targetObject, U32Distance3D *distance,
float *timeUsed);
117 bool circleOutOfObject(
const CCollisionBox &targetObject, U32Distance3D *distance,
float *timeUsed);
118 bool circleOutOfObject(
const CCollisionCylinder &targetObject, U32Distance3D *distance,
float *timeUsed);
120 ERevDirection getRevDirection()
const;
122 using ICollisionObject::getPenetrationTime;
123 float getPenetrationTime(
const CCollisionBox &targetObject,
const U32Distance3D &distance, EDimension dimension)
const override;
124 float getPenetrationTime(
const CCollisionCylinder &targetObject,
const U32Distance3D &distance, EDimension dimension)
const override;
126 float getPointOfCollision(
const CCollisionBox &targetBox, U32Distance3D distance, EDimension dimension)
const;
128 void forceOutOfObject(
const ICollisionObject &targetObject, U32Distance3D *distance);
130 bool getCornerIntersection(
const CCollisionBox &targetObject,
const U32Distance3D &distance, U32FltPoint2D *intersection);
137 #endif // SCUMM_HE_BASKETBALL_COLLISION_BBALL_COLLISION_CYLINDER_H