Implement gravity resolution and fast area calculations in collision handling
This commit is contained in:
parent
b3975ca41b
commit
2e16b2d524
8 changed files with 301 additions and 26 deletions
|
|
@ -36,12 +36,18 @@ struct SweepItemImpact {
|
|||
struct SweepCandidateImpact {
|
||||
u16 itemNumber = 0;
|
||||
SweepItemImpact impact{};
|
||||
bool damaging = false;
|
||||
std::optional<u8> floorGap;
|
||||
};
|
||||
|
||||
struct SweepCollisionResult {
|
||||
WorldPoint destination{};
|
||||
u16 firstCollision = 0;
|
||||
u8 failedDirections = 0;
|
||||
std::vector<u16> damagingContacts;
|
||||
u16 supportItem = 0;
|
||||
std::optional<u8> supportGap;
|
||||
bool failed = false;
|
||||
};
|
||||
|
||||
struct FastAreaRange {
|
||||
|
|
@ -51,6 +57,7 @@ struct FastAreaRange {
|
|||
s32 maxDifference = 0;
|
||||
};
|
||||
|
||||
FastAreaRange calculateFastAreaRange(WorldPoint center);
|
||||
bool isWorldPointInFastArea(s32 x, s32 y, const FastAreaRange& range);
|
||||
bool isSweepFootprintInFastArea(WorldPoint from, WorldPoint destination,
|
||||
s32 extentX, s32 extentY, const FastAreaRange& range);
|
||||
|
|
@ -62,14 +69,16 @@ CollisionBody makeCollisionBody(WorldPoint location, const ShapeTypeInfo& shapeI
|
|||
CollisionBody makeSweepItemBody(WorldPoint location, const ShapeTypeInfo& shapeInfo, bool flipped = false);
|
||||
std::optional<SweepItemImpact> sweepSolidItemImpact(
|
||||
const CollisionBody& moving, WorldPoint destination, const CollisionBody& obstacle);
|
||||
std::optional<std::vector<SweepCandidateImpact>> collectSolidSweepImpacts(
|
||||
std::optional<std::vector<SweepCandidateImpact>> collectSweepItemImpacts(
|
||||
const LiveFixedMapItems& items, u16 movingItemNumber, WorldPoint destination,
|
||||
const std::vector<ShapeTypeInfo>& shapes, const FastAreaRange& fastArea);
|
||||
const std::vector<ShapeTypeInfo>& shapes, const FastAreaRange& fastArea,
|
||||
std::optional<u8> floorGapLimit = std::nullopt);
|
||||
SweepCollisionResult selectSolidSweepImpact(WorldPoint from, WorldPoint destination,
|
||||
const std::vector<SweepCandidateImpact>& impacts);
|
||||
std::optional<SweepCollisionResult> resolveSolidLiveSweep(
|
||||
const LiveFixedMapItems& items, u16 movingItemNumber, WorldPoint destination,
|
||||
const std::vector<ShapeTypeInfo>& shapes, const FastAreaRange& fastArea);
|
||||
const std::vector<ShapeTypeInfo>& shapes, const FastAreaRange& fastArea,
|
||||
std::optional<u8> floorGapLimit = std::nullopt);
|
||||
bool collisionBodiesOverlap(const CollisionBody& left, const CollisionBody& right);
|
||||
bool canMoveCollisionBody(
|
||||
const CollisionBody& body,
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ namespace remorse {
|
|||
class LiveFixedMapItems;
|
||||
struct ShapeTypeInfo;
|
||||
struct WorldPoint;
|
||||
struct FastAreaRange;
|
||||
|
||||
CR_PACK_PUSH_1
|
||||
struct EntityDispatchEntryBase {
|
||||
|
|
@ -87,6 +88,12 @@ public:
|
|||
bool (*approveSweep)(u16 itemNumber, const WorldPoint& from, const WorldPoint& to, void* context),
|
||||
void* context, const std::vector<ShapeTypeInfo>* shapes = nullptr,
|
||||
u16 (*groupCounts)[32] = nullptr);
|
||||
bool runResolvedGravity(u16 processId, LiveFixedMapItems& items,
|
||||
const std::vector<ShapeTypeInfo>& shapes, const FastAreaRange& fastArea,
|
||||
u32 timeScale, u32 timerTick, u16 (&groupCounts)[32]);
|
||||
u32 scanResolvedGravity(u8 activeGroup, LiveFixedMapItems& items,
|
||||
const std::vector<ShapeTypeInfo>& shapes, const FastAreaRange& fastArea,
|
||||
u32 timeScale, u32 timerTick, u16 (&groupCounts)[32]);
|
||||
SystemTimerProcessEntry* createSystemTimerProcess(u8 activeGroup, u16 (&groupCounts)[32]);
|
||||
KeyboardProcessEntry* createKeyboardProcess(u8 activeGroup, u16 (&groupCounts)[32]);
|
||||
KeyDaemonProcessEntry* createKeyDaemonProcess(u8 activeGroup, u16 (&groupCounts)[32]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue