mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-12 11:10:39 +00:00
- another formatting-only commit.
# Conflicts: # source/games/blood/src/ai.cpp
This commit is contained in:
parent
fe92188b0c
commit
6968a072ae
1 changed files with 85 additions and 49 deletions
|
@ -963,7 +963,7 @@ void aiSetTarget(DBloodActor* actor, DBloodActor* target)
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
//
|
// todo: split up and put most of its content in tables.
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -1032,8 +1032,8 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType
|
||||||
return nDamage;
|
return nDamage;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pSprite->type == kDudeModernCustomBurning) {
|
if (pSprite->type == kDudeModernCustomBurning)
|
||||||
|
{
|
||||||
if (Chance(0x2000) && actor->dudeExtra.time < PlayClock) {
|
if (Chance(0x2000) && actor->dudeExtra.time < PlayClock) {
|
||||||
playGenDudeSound(pSprite, kGenDudeSndBurning);
|
playGenDudeSound(pSprite, kGenDudeSndBurning);
|
||||||
actor->dudeExtra.time = PlayClock + 360;
|
actor->dudeExtra.time = PlayClock + 360;
|
||||||
|
@ -1255,50 +1255,63 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType
|
||||||
return nDamage;
|
return nDamage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// todo: split up and put most of its content in tables.
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void RecoilDude(DBloodActor* actor)
|
void RecoilDude(DBloodActor* actor)
|
||||||
{
|
{
|
||||||
auto pXSprite = &actor->x();
|
auto pXSprite = &actor->x();
|
||||||
auto pSprite = &actor->s();
|
auto pSprite = &actor->s();
|
||||||
char v4 = Chance(0x8000);
|
char v4 = Chance(0x8000);
|
||||||
DUDEEXTRA* pDudeExtra = &actor->dudeExtra;
|
DUDEEXTRA* pDudeExtra = &actor->dudeExtra;
|
||||||
if (pSprite->statnum == kStatDude && (pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) {
|
if (pSprite->statnum == kStatDude && (pSprite->type >= kDudeBase && pSprite->type < kDudeMax))
|
||||||
|
{
|
||||||
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
switch (pSprite->type) {
|
switch (pSprite->type)
|
||||||
|
{
|
||||||
#ifdef NOONE_EXTENSIONS
|
#ifdef NOONE_EXTENSIONS
|
||||||
case kDudeModernCustom: {
|
case kDudeModernCustom:
|
||||||
|
{
|
||||||
GENDUDEEXTRA* pExtra = genDudeExtra(pSprite); int rChance = getRecoilChance(pSprite);
|
GENDUDEEXTRA* pExtra = genDudeExtra(pSprite); int rChance = getRecoilChance(pSprite);
|
||||||
if (pExtra->canElectrocute && pDudeExtra->teslaHit && !spriteIsUnderwater(pSprite, false)) {
|
if (pExtra->canElectrocute && pDudeExtra->teslaHit && !spriteIsUnderwater(pSprite, false))
|
||||||
|
{
|
||||||
|
|
||||||
if (Chance(rChance << 3) || (dudeIsMelee(pXSprite) && Chance(rChance << 4))) aiGenDudeNewState(pSprite, &genDudeRecoilTesla);
|
if (Chance(rChance << 3) || (dudeIsMelee(pXSprite) && Chance(rChance << 4))) aiGenDudeNewState(pSprite, &genDudeRecoilTesla);
|
||||||
else if (pExtra->canRecoil && Chance(rChance)) aiGenDudeNewState(pSprite, &genDudeRecoilL);
|
else if (pExtra->canRecoil && Chance(rChance)) aiGenDudeNewState(pSprite, &genDudeRecoilL);
|
||||||
else if (canWalk(pSprite)) {
|
else if (canWalk(pSprite))
|
||||||
|
{
|
||||||
|
|
||||||
if (Chance(rChance >> 2)) aiGenDudeNewState(pSprite, &genDudeDodgeL);
|
if (Chance(rChance >> 2)) aiGenDudeNewState(pSprite, &genDudeDodgeL);
|
||||||
else if (Chance(rChance >> 1)) aiGenDudeNewState(pSprite, &genDudeDodgeShortL);
|
else if (Chance(rChance >> 1)) aiGenDudeNewState(pSprite, &genDudeDodgeShortL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (pExtra->canRecoil && Chance(rChance)) {
|
}
|
||||||
|
else if (pExtra->canRecoil && Chance(rChance))
|
||||||
|
{
|
||||||
if (inDuck(pXSprite->aiState) && Chance(rChance >> 2)) aiGenDudeNewState(pSprite, &genDudeRecoilD);
|
if (inDuck(pXSprite->aiState) && Chance(rChance >> 2)) aiGenDudeNewState(pSprite, &genDudeRecoilD);
|
||||||
else if (spriteIsUnderwater(pSprite, false)) aiGenDudeNewState(pSprite, &genDudeRecoilW);
|
else if (spriteIsUnderwater(pSprite, false)) aiGenDudeNewState(pSprite, &genDudeRecoilW);
|
||||||
else aiGenDudeNewState(pSprite, &genDudeRecoilL);
|
else aiGenDudeNewState(pSprite, &genDudeRecoilL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
short rState = inRecoil(pXSprite->aiState);
|
short rState = inRecoil(pXSprite->aiState);
|
||||||
if (rState > 0) {
|
if (rState > 0)
|
||||||
|
{
|
||||||
if (!canWalk(pSprite)) {
|
if (!canWalk(pSprite))
|
||||||
|
{
|
||||||
if (rState == 1) pXSprite->aiState->nextState = &genDudeChaseNoWalkL;
|
if (rState == 1) pXSprite->aiState->nextState = &genDudeChaseNoWalkL;
|
||||||
else if (rState == 2) pXSprite->aiState->nextState = &genDudeChaseNoWalkD;
|
else if (rState == 2) pXSprite->aiState->nextState = &genDudeChaseNoWalkD;
|
||||||
else pXSprite->aiState->nextState = &genDudeChaseNoWalkW;
|
else pXSprite->aiState->nextState = &genDudeChaseNoWalkW;
|
||||||
|
|
||||||
} else if (!dudeIsMelee(pXSprite) || Chance(rChance >> 2)) {
|
}
|
||||||
|
else if (!dudeIsMelee(pXSprite) || Chance(rChance >> 2))
|
||||||
|
{
|
||||||
if (rState == 1) pXSprite->aiState->nextState = (Chance(rChance) ? &genDudeDodgeL : &genDudeDodgeShortL);
|
if (rState == 1) pXSprite->aiState->nextState = (Chance(rChance) ? &genDudeDodgeL : &genDudeDodgeShortL);
|
||||||
else if (rState == 2) pXSprite->aiState->nextState = (Chance(rChance) ? &genDudeDodgeD : &genDudeDodgeShortD);
|
else if (rState == 2) pXSprite->aiState->nextState = (Chance(rChance) ? &genDudeDodgeD : &genDudeDodgeShortD);
|
||||||
else if (rState == 3) pXSprite->aiState->nextState = (Chance(rChance) ? &genDudeDodgeW : &genDudeDodgeShortW);
|
else if (rState == 3) pXSprite->aiState->nextState = (Chance(rChance) ? &genDudeDodgeW : &genDudeDodgeShortW);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (rState == 1) pXSprite->aiState->nextState = &genDudeChaseL;
|
else if (rState == 1) pXSprite->aiState->nextState = &genDudeChaseL;
|
||||||
else if (rState == 2) pXSprite->aiState->nextState = &genDudeChaseD;
|
else if (rState == 2) pXSprite->aiState->nextState = &genDudeChaseD;
|
||||||
|
@ -1320,11 +1333,14 @@ void RecoilDude(DBloodActor* actor)
|
||||||
if (pSprite->type == kDudeCultistTommy) aiPlay3DSound(actor, 4013 + Random(2), AI_SFX_PRIORITY_2, -1);
|
if (pSprite->type == kDudeCultistTommy) aiPlay3DSound(actor, 4013 + Random(2), AI_SFX_PRIORITY_2, -1);
|
||||||
else aiPlay3DSound(actor, 1013 + Random(2), AI_SFX_PRIORITY_2, -1);
|
else aiPlay3DSound(actor, 1013 + Random(2), AI_SFX_PRIORITY_2, -1);
|
||||||
|
|
||||||
if (!v4 && pXSprite->medium == kMediumNormal) {
|
if (!v4 && pXSprite->medium == kMediumNormal)
|
||||||
|
{
|
||||||
if (pDudeExtra->teslaHit) aiNewState(actor, &cultistTeslaRecoil);
|
if (pDudeExtra->teslaHit) aiNewState(actor, &cultistTeslaRecoil);
|
||||||
else aiNewState(actor, &cultistRecoil);
|
else aiNewState(actor, &cultistRecoil);
|
||||||
|
|
||||||
} else if (v4 && pXSprite->medium == kMediumNormal) {
|
}
|
||||||
|
else if (v4 && pXSprite->medium == kMediumNormal)
|
||||||
|
{
|
||||||
if (pDudeExtra->teslaHit) aiNewState(actor, &cultistTeslaRecoil);
|
if (pDudeExtra->teslaHit) aiNewState(actor, &cultistTeslaRecoil);
|
||||||
else if (gGameOptions.nDifficulty > 0) aiNewState(actor, &cultistProneRecoil);
|
else if (gGameOptions.nDifficulty > 0) aiNewState(actor, &cultistProneRecoil);
|
||||||
else aiNewState(actor, &cultistRecoil);
|
else aiNewState(actor, &cultistRecoil);
|
||||||
|
@ -1503,6 +1519,12 @@ void RecoilDude(DBloodActor* actor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void aiThinkTarget(DBloodActor* actor)
|
void aiThinkTarget(DBloodActor* actor)
|
||||||
{
|
{
|
||||||
auto pXSprite = &actor->x();
|
auto pXSprite = &actor->x();
|
||||||
|
@ -1527,6 +1549,7 @@ void aiThinkTarget(DBloodActor* actor)
|
||||||
continue;
|
continue;
|
||||||
if (!cansee(x, y, z, nSector, pSprite->x, pSprite->y, pSprite->z - ((pDudeInfo->eyeHeight * pSprite->yrepeat) << 2), pSprite->sectnum))
|
if (!cansee(x, y, z, nSector, pSprite->x, pSprite->y, pSprite->z - ((pDudeInfo->eyeHeight * pSprite->yrepeat) << 2), pSprite->sectnum))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
|
int nDeltaAngle = ((getangle(dx, dy) + 1024 - pSprite->ang) & 2047) - 1024;
|
||||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||||
{
|
{
|
||||||
|
@ -1544,6 +1567,12 @@ void aiThinkTarget(DBloodActor* actor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void aiLookForTarget(spritetype *pSprite, XSPRITE *pXSprite)
|
void aiLookForTarget(spritetype *pSprite, XSPRITE *pXSprite)
|
||||||
{
|
{
|
||||||
auto actor = &bloodActors[pSprite->index];
|
auto actor = &bloodActors[pSprite->index];
|
||||||
|
@ -1608,7 +1637,14 @@ void aiLookForTarget(spritetype *pSprite, XSPRITE *pXSprite)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void aiProcessDudes(void) {
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void aiProcessDudes(void)
|
||||||
|
{
|
||||||
int nSprite;
|
int nSprite;
|
||||||
StatIterator it(kStatDude);
|
StatIterator it(kStatDude);
|
||||||
while ((nSprite = it.NextIndex()) >= 0)
|
while ((nSprite = it.NextIndex()) >= 0)
|
||||||
|
|
Loading…
Reference in a new issue