- use collision struct in ActorMoveHitReact

This commit is contained in:
Christoph Oelckers 2021-10-30 01:15:32 +02:00
parent 2a897c0582
commit ec9ab56ece
3 changed files with 14 additions and 31 deletions

View file

@ -699,10 +699,6 @@ enum EHitBits
kHitSector = 0x4000, kHitSector = 0x4000,
kHitWall = 0x8000, kHitWall = 0x8000,
kHitSprite = 0xC000, kHitSprite = 0xC000,
kHitSky = 0x10000, // SW only
kHitFloor = 0x18000, // Exhumed only
kHitCeiling = 0x1c000, // Exhumed only
}; };
void updateModelInterpolation(); void updateModelInterpolation();

View file

@ -118,42 +118,22 @@ bool ActorMoveHitReact(DSWActor* actor)
// Should only return true if there is a reaction to what was hit that // Should only return true if there is a reaction to what was hit that
// would cause the calling function to abort // would cause the calling function to abort
switch (TEST(u->ret, HIT_MASK)) auto coll = u->hitCode();
if (coll.type == kHitSprite)
{ {
case HIT_SPRITE: auto hitActor = coll.actor;
{ if (hitActor->hasU() && hitActor->u()->PlayerP)
short HitSprite = NORM_SPRITE(u->ret);
USERp hu;
ANIMATORp action;
hu = User[HitSprite].Data();
// if you ran into a player - call close range functions
if (hu && hu->PlayerP)
{ {
// if you ran into a player - call close range functions
DoActorPickClosePlayer(SpriteNum); DoActorPickClosePlayer(SpriteNum);
action = ChooseAction(u->Personality->TouchTarget); auto action = ChooseAction(u->Personality->TouchTarget);
if (action) if (action)
{ {
(*action)(actor); (*action)(actor);
return true; return true;
} }
} }
break;
} }
case HIT_WALL:
{
break;
}
case HIT_SECTOR:
{
break;
}
}
return false; return false;
} }

View file

@ -137,6 +137,13 @@ public:
}; };
enum EHitBitsSW
{
kHitTypeMaskSW = 0x1C000,
kHitSky = 0x10000, // SW only
};
// Wrapper around the insane collision info mess from Build. // Wrapper around the insane collision info mess from Build.
struct Collision struct Collision
{ {
@ -185,7 +192,7 @@ struct Collision
int setFromEngine(int value) int setFromEngine(int value)
{ {
legacyVal = value; legacyVal = value;
type = value & kHitTypeMask; type = value & kHitTypeMaskSW;
if (type == 0) { index = -1; actor = nullptr; } if (type == 0) { index = -1; actor = nullptr; }
else if (type != kHitSprite) { index = value & kHitIndexMask; actor = nullptr; } else if (type != kHitSprite) { index = value & kHitIndexMask; actor = nullptr; }
else { index = -1; actor = &swActors[value & kHitIndexMask]; } else { index = -1; actor = &swActors[value & kHitIndexMask]; }