- reformatting.

This commit is contained in:
Christoph Oelckers 2021-05-04 18:41:59 +02:00
parent 382a68410a
commit d261d94207

View file

@ -2604,15 +2604,15 @@ static void ConcussSprite(DBloodActor* source, DBloodActor* actor, int x, int y,
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int actWallBounceVector(int *x, int *y, int nWall, int a4) int actWallBounceVector(int* x, int* y, int nWall, int a4)
{ {
int wx, wy; int wx, wy;
GetWallNormal(nWall, &wx, &wy); GetWallNormal(nWall, &wx, &wy);
int t = DMulScale(*x, wx, *y, wy, 16); int t = DMulScale(*x, wx, *y, wy, 16);
int t2 = mulscale16r(t, a4+0x10000); int t2 = mulscale16r(t, a4 + 0x10000);
*x -= MulScale(wx, t2, 16); *x -= MulScale(wx, t2, 16);
*y -= MulScale(wy, t2, 16); *y -= MulScale(wy, t2, 16);
return mulscale16r(t, 0x10000-a4); return mulscale16r(t, 0x10000 - a4);
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -2621,26 +2621,26 @@ int actWallBounceVector(int *x, int *y, int nWall, int a4)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int actFloorBounceVector(int *x, int *y, int *z, int nSector, int a5) int actFloorBounceVector(int* x, int* y, int* z, int nSector, int a5)
{ {
int t = 0x10000-a5; int t = 0x10000 - a5;
if (sector[nSector].floorheinum == 0) if (sector[nSector].floorheinum == 0)
{ {
int t2 = MulScale(*z, t, 16); int t2 = MulScale(*z, t, 16);
*z = -(*z-t2); *z = -(*z - t2);
return t2; return t2;
} }
walltype *pWall = &wall[sector[nSector].wallptr]; walltype* pWall = &wall[sector[nSector].wallptr];
walltype *pWall2 = &wall[pWall->point2]; walltype* pWall2 = &wall[pWall->point2];
int angle = getangle(pWall2->x-pWall->x, pWall2->y-pWall->y)+512; int angle = getangle(pWall2->x - pWall->x, pWall2->y - pWall->y) + 512;
int t2 = sector[nSector].floorheinum<<4; int t2 = sector[nSector].floorheinum << 4;
int t3 = approxDist(-0x10000, t2); int t3 = approxDist(-0x10000, t2);
int t4 = DivScale(-0x10000, t3, 16); int t4 = DivScale(-0x10000, t3, 16);
int t5 = DivScale(t2, t3, 16); int t5 = DivScale(t2, t3, 16);
int t6 = MulScale(t5, Cos(angle), 30); int t6 = MulScale(t5, Cos(angle), 30);
int t7 = MulScale(t5, Sin(angle), 30); int t7 = MulScale(t5, Sin(angle), 30);
int t8 = TMulScale(*x, t6, *y, t7, *z, t4, 16); int t8 = TMulScale(*x, t6, *y, t7, *z, t4, 16);
int t9 = MulScale(t8, 0x10000+a5, 16); int t9 = MulScale(t8, 0x10000 + a5, 16);
*x -= MulScale(t6, t9, 16); *x -= MulScale(t6, t9, 16);
*y -= MulScale(t7, t9, 16); *y -= MulScale(t7, t9, 16);
*z -= MulScale(t4, t9, 16); *z -= MulScale(t4, t9, 16);
@ -2766,7 +2766,7 @@ static void actNapalmMove(DBloodActor* actor)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
static DBloodActor *actSpawnFloor(DBloodActor *actor) static DBloodActor* actSpawnFloor(DBloodActor* actor)
{ {
auto pSprite = &actor->s(); auto pSprite = &actor->s();
short sector = pSprite->sectnum; short sector = pSprite->sectnum;
@ -2774,19 +2774,19 @@ static DBloodActor *actSpawnFloor(DBloodActor *actor)
int y = pSprite->y; int y = pSprite->y;
updatesector(x, y, &sector); updatesector(x, y, &sector);
int zFloor = getflorzofslope(sector, x, y); int zFloor = getflorzofslope(sector, x, y);
auto *spawned = actSpawnSprite(sector, x, y, zFloor, 3, 0); auto* spawned = actSpawnSprite(sector, x, y, zFloor, 3, 0);
if (spawned) spawned->s().cstat &= ~257; if (spawned) spawned->s().cstat &= ~257;
return spawned; return spawned;
} }
static DBloodActor *actDropAmmo(DBloodActor *actor, int nType) static DBloodActor* actDropAmmo(DBloodActor* actor, int nType)
{ {
if (!actor) return nullptr; if (!actor) return nullptr;
auto pSprite = &actor->s(); auto pSprite = &actor->s();
if (pSprite->statnum < kMaxStatus && nType >= kItemAmmoBase && nType < kItemAmmoMax) if (pSprite->statnum < kMaxStatus && nType >= kItemAmmoBase && nType < kItemAmmoMax)
{ {
auto act2 = actSpawnFloor(actor); auto act2 = actSpawnFloor(actor);
const AMMOITEMDATA *pAmmo = &gAmmoItemData[nType - kItemAmmoBase]; const AMMOITEMDATA* pAmmo = &gAmmoItemData[nType - kItemAmmoBase];
auto pSprite2 = &act2->s(); auto pSprite2 = &act2->s();
pSprite2->type = nType; pSprite2->type = nType;
pSprite2->picnum = pAmmo->picnum; pSprite2->picnum = pAmmo->picnum;
@ -2798,14 +2798,14 @@ static DBloodActor *actDropAmmo(DBloodActor *actor, int nType)
return nullptr; return nullptr;
} }
static DBloodActor *actDropWeapon(DBloodActor *actor, int nType) static DBloodActor* actDropWeapon(DBloodActor* actor, int nType)
{ {
if (!actor) return nullptr; if (!actor) return nullptr;
auto pSprite = &actor->s(); auto pSprite = &actor->s();
if (pSprite->statnum < kMaxStatus && nType >= kItemWeaponBase && nType < kItemWeaponMax) if (pSprite->statnum < kMaxStatus && nType >= kItemWeaponBase && nType < kItemWeaponMax)
{ {
auto act2 = actSpawnFloor(actor); auto act2 = actSpawnFloor(actor);
const WEAPONITEMDATA *pWeapon = &gWeaponItemData[nType - kItemWeaponBase]; const WEAPONITEMDATA* pWeapon = &gWeaponItemData[nType - kItemWeaponBase];
auto pSprite2 = &act2->s(); auto pSprite2 = &act2->s();
pSprite2->type = nType; pSprite2->type = nType;
pSprite2->picnum = pWeapon->picnum; pSprite2->picnum = pWeapon->picnum;
@ -2824,7 +2824,7 @@ static DBloodActor* actDropItem(DBloodActor* actor, int nType)
if (pSprite->statnum < kMaxStatus && nType >= kItemBase && nType < kItemMax) if (pSprite->statnum < kMaxStatus && nType >= kItemBase && nType < kItemMax)
{ {
auto act2 = actSpawnFloor(actor); auto act2 = actSpawnFloor(actor);
const ITEMDATA *pItem = &gItemData[nType - kItemBase]; const ITEMDATA* pItem = &gItemData[nType - kItemBase];
auto pSprite2 = &act2->s(); auto pSprite2 = &act2->s();
pSprite2->type = nType; pSprite2->type = nType;
pSprite2->picnum = pItem->picnum; pSprite2->picnum = pItem->picnum;
@ -2842,7 +2842,7 @@ static DBloodActor* actDropItem(DBloodActor* actor, int nType)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
static DBloodActor *actDropKey(DBloodActor *actor, int nType) static DBloodActor* actDropKey(DBloodActor* actor, int nType)
{ {
if (!actor) return nullptr; if (!actor) return nullptr;
auto pSprite = &actor->s(); auto pSprite = &actor->s();
@ -2868,7 +2868,7 @@ static DBloodActor *actDropKey(DBloodActor *actor, int nType)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
static DBloodActor*actDropFlag(DBloodActor* actor, int nType) static DBloodActor* actDropFlag(DBloodActor* actor, int nType)
{ {
if (!actor) return nullptr; if (!actor) return nullptr;
auto pSprite = &actor->s(); auto pSprite = &actor->s();
@ -2892,7 +2892,7 @@ static DBloodActor*actDropFlag(DBloodActor* actor, int nType)
static DBloodActor* actDropObject(DBloodActor* pSprite, int nType) static DBloodActor* actDropObject(DBloodActor* pSprite, int nType)
{ {
DBloodActor *act2 = nullptr; DBloodActor* act2 = nullptr;
if (nType >= kItemKeyBase && nType < kItemKeyMax) act2 = actDropKey(pSprite, nType); if (nType >= kItemKeyBase && nType < kItemKeyMax) act2 = actDropKey(pSprite, nType);
else if (nType == kItemFlagA || nType == kItemFlagB) act2 = actDropFlag(pSprite, nType); else if (nType == kItemFlagA || nType == kItemFlagB) act2 = actDropFlag(pSprite, nType);
@ -2917,7 +2917,7 @@ static DBloodActor* actDropObject(DBloodActor* pSprite, int nType)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool actHealDude(DBloodActor *actor, int add, int threshold) bool actHealDude(DBloodActor* actor, int add, int threshold)
{ {
if (!actor) return false; if (!actor) return false;
auto pXDude = &actor->x(); auto pXDude = &actor->x();
@ -2925,9 +2925,9 @@ bool actHealDude(DBloodActor *actor, int add, int threshold)
threshold <<= 4; threshold <<= 4;
if (pXDude->health < threshold) if (pXDude->health < threshold)
{ {
spritetype *pSprite = &actor->s(); spritetype* pSprite = &actor->s();
if (actor->IsPlayerActor()) sfxPlay3DSound(pSprite->x, pSprite->y, pSprite->z, 780, pSprite->sectnum); if (actor->IsPlayerActor()) sfxPlay3DSound(pSprite->x, pSprite->y, pSprite->z, 780, pSprite->sectnum);
pXDude->health = min<uint32_t>(pXDude->health+add, threshold); pXDude->health = min<uint32_t>(pXDude->health + add, threshold);
return true; return true;
} }
return false; return false;
@ -3038,7 +3038,7 @@ static bool actKillModernDude(DBloodActor* actor, DAMAGE_TYPE damageType)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
static bool actKillDudeStage1(DBloodActor* actor,DAMAGE_TYPE damageType) static bool actKillDudeStage1(DBloodActor* actor, DAMAGE_TYPE damageType)
{ {
auto pSprite = &actor->s(); auto pSprite = &actor->s();
auto pXSprite = &actor->x(); auto pXSprite = &actor->x();
@ -3437,11 +3437,11 @@ static void genericDeath(DBloodActor* actor, int nSeq, int sound1, int seqnum)
void actKillDude(DBloodActor* killerActor, DBloodActor* actor, DAMAGE_TYPE damageType, int damage) void actKillDude(DBloodActor* killerActor, DBloodActor* actor, DAMAGE_TYPE damageType, int damage)
{ {
spritetype *pKillerSprite = &killerActor->s(); spritetype* pKillerSprite = &killerActor->s();
auto pSprite = &actor->s(); auto pSprite = &actor->s();
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax && actor->hasX()); assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax&& actor->hasX());
int nType = pSprite->type-kDudeBase; int nType = pSprite->type - kDudeBase;
XSPRITE *pXSprite = &actor->x(); XSPRITE* pXSprite = &actor->x();
if (actKillDudeStage1(actor, damageType)) return; if (actKillDudeStage1(actor, damageType)) return;
@ -3459,7 +3459,7 @@ void actKillDude(DBloodActor* killerActor, DBloodActor* actor, DAMAGE_TYPE damag
int nSeq = checkDamageType(actor, damageType); int nSeq = checkDamageType(actor, damageType);
if (!getSequence(getDudeInfo(nType+kDudeBase)->seqStartID + nSeq)) if (!getSequence(getDudeInfo(nType + kDudeBase)->seqStartID + nSeq))
{ {
seqKill(actor); seqKill(actor);
gKillMgr.AddKill(pSprite); gKillMgr.AddKill(pSprite);
@ -3477,8 +3477,8 @@ void actKillDude(DBloodActor* killerActor, DBloodActor* actor, DAMAGE_TYPE damag
case kDudeCultistShotgun: case kDudeCultistShotgun:
case kDudeCultistTesla: case kDudeCultistTesla:
case kDudeCultistTNT: case kDudeCultistTNT:
sfxPlay3DSound(pSprite, 1018+Random(2), -1, 0); sfxPlay3DSound(pSprite, 1018 + Random(2), -1, 0);
seqSpawn(dudeInfo[nType].seqStartID+nSeq, actor, nSeq == 3? nDudeToGibClient2 : nDudeToGibClient1); seqSpawn(dudeInfo[nType].seqStartID + nSeq, actor, nSeq == 3 ? nDudeToGibClient2 : nDudeToGibClient1);
break; break;
case kDudeBurningCultist: case kDudeBurningCultist:
@ -3509,7 +3509,7 @@ void actKillDude(DBloodActor* killerActor, DBloodActor* actor, DAMAGE_TYPE damag
case kDudeBurningInnocent: case kDudeBurningInnocent:
damageType = DAMAGE_TYPE_3; damageType = DAMAGE_TYPE_3;
seqSpawn(dudeInfo[nType].seqStartID+7, actor, nDudeToGibClient1); seqSpawn(dudeInfo[nType].seqStartID + 7, actor, nDudeToGibClient1);
break; break;
case kDudeZombieButcher: case kDudeZombieButcher:
@ -3539,7 +3539,7 @@ void actKillDude(DBloodActor* killerActor, DBloodActor* actor, DAMAGE_TYPE damag
case kDudeSpiderBrown: case kDudeSpiderBrown:
if (pSprite->owner != -1) if (pSprite->owner != -1)
{ {
spritetype *pOwner = &sprite[pSprite->owner]; spritetype* pOwner = &sprite[pSprite->owner];
gDudeExtra[pOwner->extra].at6.u1.xval2--; gDudeExtra[pOwner->extra].at6.u1.xval2--;
} }
genericDeath(actor, nSeq, 1803, dudeInfo[nType].seqStartID + nSeq); genericDeath(actor, nSeq, 1803, dudeInfo[nType].seqStartID + nSeq);
@ -3548,7 +3548,7 @@ void actKillDude(DBloodActor* killerActor, DBloodActor* actor, DAMAGE_TYPE damag
case kDudeSpiderRed: case kDudeSpiderRed:
if (pSprite->owner != -1) if (pSprite->owner != -1)
{ {
spritetype *pOwner = &sprite[pSprite->owner]; spritetype* pOwner = &sprite[pSprite->owner];
gDudeExtra[pOwner->extra].at6.u1.xval2--; gDudeExtra[pOwner->extra].at6.u1.xval2--;
} }
genericDeath(actor, nSeq, 1803, dudeInfo[nType].seqStartID + nSeq); genericDeath(actor, nSeq, 1803, dudeInfo[nType].seqStartID + nSeq);
@ -3557,7 +3557,7 @@ void actKillDude(DBloodActor* killerActor, DBloodActor* actor, DAMAGE_TYPE damag
case kDudeSpiderBlack: case kDudeSpiderBlack:
if (pSprite->owner != -1) if (pSprite->owner != -1)
{ {
spritetype *pOwner = &sprite[pSprite->owner]; spritetype* pOwner = &sprite[pSprite->owner];
gDudeExtra[pOwner->extra].at6.u1.xval2--; gDudeExtra[pOwner->extra].at6.u1.xval2--;
} }
genericDeath(actor, nSeq, 1803, dudeInfo[nType].seqStartID + nSeq); genericDeath(actor, nSeq, 1803, dudeInfo[nType].seqStartID + nSeq);
@ -3565,7 +3565,7 @@ void actKillDude(DBloodActor* killerActor, DBloodActor* actor, DAMAGE_TYPE damag
case kDudeSpiderMother: case kDudeSpiderMother:
sfxPlay3DSound(pSprite, 1850, -1, 0); sfxPlay3DSound(pSprite, 1850, -1, 0);
seqSpawn(dudeInfo[nType].seqStartID+nSeq, actor, -1); seqSpawn(dudeInfo[nType].seqStartID + nSeq, actor, -1);
break; break;
case kDudeGillBeast: case kDudeGillBeast:
@ -3621,32 +3621,32 @@ void actKillDude(DBloodActor* killerActor, DBloodActor* actor, DAMAGE_TYPE damag
case kDudeTchernobog: case kDudeTchernobog:
sfxPlay3DSound(pSprite, 2380, -1, 0); sfxPlay3DSound(pSprite, 2380, -1, 0);
seqSpawn(dudeInfo[nType].seqStartID+nSeq, actor, -1); seqSpawn(dudeInfo[nType].seqStartID + nSeq, actor, -1);
break; break;
case kDudeBurningTinyCaleb: case kDudeBurningTinyCaleb:
damageType = DAMAGE_TYPE_3; damageType = DAMAGE_TYPE_3;
seqSpawn(dudeInfo[nType].seqStartID+11, actor, nDudeToGibClient1); seqSpawn(dudeInfo[nType].seqStartID + 11, actor, nDudeToGibClient1);
break; break;
case kDudeBeast: case kDudeBeast:
sfxPlay3DSound(pSprite, 9000+Random(2), -1, 0); sfxPlay3DSound(pSprite, 9000 + Random(2), -1, 0);
seqSpawn(dudeInfo[nType].seqStartID+nSeq, actor, nSeq == 3? nDudeToGibClient2 : nDudeToGibClient1); seqSpawn(dudeInfo[nType].seqStartID + nSeq, actor, nSeq == 3 ? nDudeToGibClient2 : nDudeToGibClient1);
break; break;
case kDudeBurningBeast: case kDudeBurningBeast:
damageType = DAMAGE_TYPE_3; damageType = DAMAGE_TYPE_3;
seqSpawn(dudeInfo[nType].seqStartID+12, actor, nDudeToGibClient1); seqSpawn(dudeInfo[nType].seqStartID + 12, actor, nDudeToGibClient1);
break; break;
default: default:
seqSpawn(getDudeInfo(nType+kDudeBase)->seqStartID+nSeq, actor, -1); seqSpawn(getDudeInfo(nType + kDudeBase)->seqStartID + nSeq, actor, -1);
break; break;
} }
if (damageType == DAMAGE_TYPE_3) if (damageType == DAMAGE_TYPE_3)
{ {
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type);
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
if (pDudeInfo->nGibType[i] > -1) if (pDudeInfo->nGibType[i] > -1)
GibSprite(pSprite, (GIBTYPE)pDudeInfo->nGibType[i], nullptr, nullptr); GibSprite(pSprite, (GIBTYPE)pDudeInfo->nGibType[i], nullptr, nullptr);