- formatting

This commit is contained in:
Christoph Oelckers 2021-09-05 19:10:50 +02:00
parent 2f5be23171
commit e11f118d3c

View file

@ -7704,6 +7704,12 @@ bool aiPatrolMarkerReached(DBloodActor* actor)
return false; return false;
} }
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int findNextMarker(XSPRITE* pXMark, bool back) { int findNextMarker(XSPRITE* pXMark, bool back) {
XSPRITE* pXNext = NULL; int i; XSPRITE* pXNext = NULL; int i;
@ -7722,6 +7728,12 @@ int findNextMarker(XSPRITE* pXMark, bool back) {
} }
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
bool markerIsNode(XSPRITE* pXMark, bool back) { bool markerIsNode(XSPRITE* pXMark, bool back) {
XSPRITE* pXNext = NULL; int i; int cnt = 0; XSPRITE* pXNext = NULL; int i; int cnt = 0;
@ -7736,11 +7748,15 @@ bool markerIsNode(XSPRITE* pXMark, bool back) {
if (++cnt > 1) if (++cnt > 1)
return true; return true;
} }
return false; return false;
} }
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void aiPatrolSetMarker(spritetype* pSprite, XSPRITE* pXSprite) { void aiPatrolSetMarker(spritetype* pSprite, XSPRITE* pXSprite) {
@ -7768,7 +7784,6 @@ void aiPatrolSetMarker(spritetype* pSprite, XSPRITE* pXSprite) {
closest = dist; closest = dist;
path = pNext->index; path = pNext->index;
} }
} }
// set next marker // set next marker
@ -7839,12 +7854,17 @@ void aiPatrolSetMarker(spritetype* pSprite, XSPRITE* pXSprite) {
} }
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void aiPatrolStop(spritetype* pSprite, int target, bool alarm) void aiPatrolStop(spritetype* pSprite, int target, bool alarm)
{ {
auto actor = &bloodActors[pSprite->index]; auto actor = &bloodActors[pSprite->index];
if (xspriRangeIsFine(pSprite->extra)) if (xspriRangeIsFine(pSprite->extra))
{ {
XSPRITE* pXSprite = &xsprite[pSprite->extra]; XSPRITE* pXSprite = &xsprite[pSprite->extra];
pXSprite->data3 = 0; // reset spot progress pXSprite->data3 = 0; // reset spot progress
pXSprite->unused1 &= ~kDudeFlagCrouch; // reset the crouch status pXSprite->unused1 &= ~kDudeFlagCrouch; // reset the crouch status
@ -7870,22 +7890,25 @@ void aiPatrolStop(spritetype* pSprite, int target, bool alarm)
else aiPatrolAlarmLite(pSprite, &xsprite[sprite[target].extra]); else aiPatrolAlarmLite(pSprite, &xsprite[sprite[target].extra]);
//} //}
} else { }
else
{
aiInitSprite(actor); aiInitSprite(actor);
aiSetTarget_(pXSprite, pXSprite->targetX, pXSprite->targetY, pXSprite->targetZ); aiSetTarget_(pXSprite, pXSprite->targetX, pXSprite->targetY, pXSprite->targetZ);
} }
pXSprite->dudeFlag4 = patrol; // this must be kept so enemy can patrol after respawn again pXSprite->dudeFlag4 = patrol; // this must be kept so enemy can patrol after respawn again
} }
return;
} }
void aiPatrolRandGoalAng(DBloodActor* actor) { //---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void aiPatrolRandGoalAng(DBloodActor* actor)
{
auto pXSprite = &actor->x(); auto pXSprite = &actor->x();
auto pSprite = &actor->s(); auto pSprite = &actor->s();
@ -7902,8 +7925,14 @@ void aiPatrolRandGoalAng(DBloodActor* actor) {
pXSprite->goalAng = (pSprite->ang + goal) & 2047; pXSprite->goalAng = (pSprite->ang + goal) & 2047;
} }
void aiPatrolTurn(DBloodActor* actor) { //---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void aiPatrolTurn(DBloodActor* actor)
{
auto pXSprite = &actor->x(); auto pXSprite = &actor->x();
auto pSprite = &actor->s(); auto pSprite = &actor->s();
@ -7913,8 +7942,14 @@ void aiPatrolTurn(DBloodActor* actor) {
} }
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void aiPatrolMove(DBloodActor* actor) { void aiPatrolMove(DBloodActor* actor)
{
auto pXSprite = &actor->x(); auto pXSprite = &actor->x();
auto pSprite = &actor->s(); auto pSprite = &actor->s();
@ -7923,7 +7958,8 @@ void aiPatrolMove(DBloodActor* actor) {
int dudeIdx = pSprite->type - kDudeBase; int dudeIdx = pSprite->type - kDudeBase;
switch (pSprite->type) { switch (pSprite->type)
{
case kDudeCultistShotgunProne: dudeIdx = kDudeCultistShotgun - kDudeBase; break; case kDudeCultistShotgunProne: dudeIdx = kDudeCultistShotgun - kDudeBase; break;
case kDudeCultistTommyProne: dudeIdx = kDudeCultistTommy - kDudeBase; break; case kDudeCultistTommyProne: dudeIdx = kDudeCultistTommy - kDudeBase; break;
} }
@ -7939,18 +7975,16 @@ void aiPatrolMove(DBloodActor* actor) {
int vel = (pXSprite->unused1 & kDudeFlagCrouch) ? kMaxPatrolCrouchVelocity : kMaxPatrolVelocity; int vel = (pXSprite->unused1 & kDudeFlagCrouch) ? kMaxPatrolCrouchVelocity : kMaxPatrolVelocity;
int goalAng = 341; int goalAng = 341;
if (pExtra->flying || spriteIsUnderwater(actor)) { if (pExtra->flying || spriteIsUnderwater(actor))
{
goalAng >>= 1; goalAng >>= 1;
zvel[pSprite->index] = dz; zvel[pSprite->index] = dz;
if (pSprite->flags & kPhysGravity) if (pSprite->flags & kPhysGravity)
pSprite->flags &= ~kPhysGravity; pSprite->flags &= ~kPhysGravity;
}
else if (!pExtra->flying)
} else if (!pExtra->flying) { {
pSprite->flags |= kPhysGravity | kPhysFalling; pSprite->flags |= kPhysGravity | kPhysFalling;
} }
int nTurnRange = (pDudeInfo->angSpeed << 2) >> 4; int nTurnRange = (pDudeInfo->angSpeed << 2) >> 4;
@ -7967,18 +8001,15 @@ void aiPatrolMove(DBloodActor* actor) {
if (gSpriteHit[pSprite->extra].hit.type == kHitSprite) if (gSpriteHit[pSprite->extra].hit.type == kHitSprite)
{ {
auto hitactor = gSpriteHit[pSprite->extra].hit.actor; auto hitactor = gSpriteHit[pSprite->extra].hit.actor;
hitactor->x().dodgeDir = -1; hitactor->x().dodgeDir = -1;
pXSprite->dodgeDir = 1; pXSprite->dodgeDir = 1;
aiMoveDodge(hitactor); aiMoveDodge(hitactor);
}
} else { else
{
int frontSpeed = aiPatrolGetVelocity(pDudeInfo->frontSpeed, pXTarget->busyTime); int frontSpeed = aiPatrolGetVelocity(pDudeInfo->frontSpeed, pXTarget->busyTime);
xvel[pSprite->index] += MulScale(frontSpeed, Cos(pSprite->ang), 30); xvel[pSprite->index] += MulScale(frontSpeed, Cos(pSprite->ang), 30);
yvel[pSprite->index] += MulScale(frontSpeed, Sin(pSprite->ang), 30); yvel[pSprite->index] += MulScale(frontSpeed, Sin(pSprite->ang), 30);
} }
vel = MulScale(vel, approxDist(dx, dy) << 6, 16); vel = MulScale(vel, approxDist(dx, dy) << 6, 16);
@ -7987,6 +8018,11 @@ void aiPatrolMove(DBloodActor* actor) {
return; return;
} }
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void aiPatrolAlarmLite(spritetype* pSprite, XSPRITE* pXTarget) { void aiPatrolAlarmLite(spritetype* pSprite, XSPRITE* pXTarget) {