mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-12 11:10:39 +00:00
- reformatting commit
This commit is contained in:
parent
6f8a5ee2d2
commit
bbe49eee7c
1 changed files with 117 additions and 37 deletions
|
@ -113,6 +113,12 @@ short gCustomDudeDebrisPics[6] = {
|
|||
|
||||
GENDUDEEXTRA gGenDudeExtra[kMaxSprites]; // savegame handling in ai.cpp
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void forcePunch(DBloodActor* actor)
|
||||
{
|
||||
auto pXSprite = &actor->x();
|
||||
|
@ -126,7 +132,13 @@ static void forcePunch(DBloodActor* actor)
|
|||
return true;
|
||||
}*/
|
||||
|
||||
static bool genDudeAdjustSlope(DBloodActor* actor, int dist, int weaponType, int by = 64)
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static bool genDudeAdjustSlope(DBloodActor* actor, int dist, int weaponType, int by = 64)
|
||||
{
|
||||
spritetype* pSprite = &actor->s();
|
||||
XSPRITE* pXSprite = &actor->x();
|
||||
|
@ -179,10 +191,16 @@ void genDudeUpdate(spritetype* pSprite) {
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void punchCallback(int, DBloodActor* actor)
|
||||
{
|
||||
XSPRITE* pXSprite = &actor->x();
|
||||
spritetype* pSprite = &actor->s();
|
||||
auto const pXSprite = &actor->x();
|
||||
auto const pSprite = &actor->s();
|
||||
auto const target = actor->GetTarget();
|
||||
if (target != nullptr)
|
||||
{
|
||||
|
@ -190,7 +208,7 @@ void punchCallback(int, DBloodActor* actor)
|
|||
int nZOffset2 = 0;
|
||||
|
||||
|
||||
spritetype* pTarget = &target->s();
|
||||
auto const pTarget = &target->s();
|
||||
if(target->IsDudeActor())
|
||||
nZOffset2 = getDudeInfo(pTarget->type)->eyeHeight * pTarget->yrepeat << 2;
|
||||
|
||||
|
@ -205,10 +223,16 @@ void punchCallback(int, DBloodActor* actor)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void genDudeAttack1(int, DBloodActor* actor)
|
||||
{
|
||||
XSPRITE* pXSprite = &actor->x();
|
||||
spritetype* pSprite = &actor->s();
|
||||
auto const pXSprite = &actor->x();
|
||||
auto const pSprite = &actor->s();
|
||||
|
||||
if (pXSprite->target_i < 0) return;
|
||||
|
||||
|
@ -220,23 +244,25 @@ void genDudeAttack1(int, DBloodActor* actor)
|
|||
if (inDuck(pXSprite->aiState))
|
||||
dispersion = ClipLow(dispersion >> 1, kGenDudeMinDispesion);
|
||||
|
||||
if (pExtra->weaponType == kGenDudeWeaponHitscan) {
|
||||
|
||||
if (pExtra->weaponType == kGenDudeWeaponHitscan)
|
||||
{
|
||||
dx = CosScale16(pSprite->ang); dy = SinScale16(pSprite->ang); dz = actor->dudeSlope;
|
||||
// dispersal modifiers here in case if non-melee enemy
|
||||
if (!dudeIsMelee(pXSprite)) {
|
||||
if (!dudeIsMelee(pXSprite))
|
||||
{
|
||||
dx += Random3(dispersion); dy += Random3(dispersion); dz += Random3(dispersion);
|
||||
}
|
||||
|
||||
actFireVector(actor, 0, 0, dx, dy, dz,(VECTOR_TYPE)pExtra->curWeapon);
|
||||
if (!playGenDudeSound(pSprite, kGenDudeSndAttackNormal))
|
||||
sfxPlayVectorSound(pSprite, pExtra->curWeapon);
|
||||
|
||||
} else if (pExtra->weaponType == kGenDudeWeaponSummon) {
|
||||
|
||||
}
|
||||
else if (pExtra->weaponType == kGenDudeWeaponSummon)
|
||||
{
|
||||
DBloodActor* spawned = nullptr;
|
||||
int dist = pSprite->clipdist << 4;
|
||||
if (pExtra->slaveCount <= gGameOptions.nDifficulty) {
|
||||
if (pExtra->slaveCount <= gGameOptions.nDifficulty)
|
||||
{
|
||||
if ((spawned = actSpawnDude(actor, pExtra->curWeapon, dist + Random(dist), 0)) != NULL)
|
||||
{
|
||||
spritetype* pSpawned = &spawned->s();
|
||||
|
@ -254,9 +280,9 @@ void genDudeAttack1(int, DBloodActor* actor)
|
|||
sfxPlay3DSoundCP(pSprite, 379, 1, 0, 0x10000 - Random3(0x3000));
|
||||
}
|
||||
}
|
||||
|
||||
} else if (pExtra->weaponType == kGenDudeWeaponMissile) {
|
||||
|
||||
}
|
||||
else if (pExtra->weaponType == kGenDudeWeaponMissile)
|
||||
{
|
||||
dx = CosScale16(pSprite->ang); dy = SinScale16(pSprite->ang); dz = actor->dudeSlope;
|
||||
|
||||
// dispersal modifiers here
|
||||
|
@ -268,6 +294,12 @@ void genDudeAttack1(int, DBloodActor* actor)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void ThrowCallback1(int, DBloodActor* actor)
|
||||
{
|
||||
ThrowThing(actor, true);
|
||||
|
@ -381,6 +413,12 @@ static void ThrowThing(DBloodActor* actor, bool impact)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void unicultThinkSearch(DBloodActor* actor)
|
||||
{
|
||||
auto pXSprite = &actor->x();
|
||||
|
@ -391,11 +429,18 @@ static void unicultThinkSearch(DBloodActor* actor)
|
|||
aiLookForTarget(actor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void unicultThinkGoto(DBloodActor* actor)
|
||||
{
|
||||
auto pXSprite = &actor->x();
|
||||
auto pSprite = &actor->s();
|
||||
if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) {
|
||||
auto const pXSprite = &actor->x();
|
||||
auto const pSprite = &actor->s();
|
||||
if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax))
|
||||
{
|
||||
Printf(PRINT_HIGH, "pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
|
||||
return;
|
||||
}
|
||||
|
@ -414,6 +459,12 @@ static void unicultThinkGoto(DBloodActor* actor)
|
|||
aiThinkTarget(actor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void unicultThinkChase(DBloodActor* actor)
|
||||
{
|
||||
auto const pXSprite = &actor->x();
|
||||
|
@ -470,7 +521,8 @@ static void unicultThinkChase(DBloodActor* actor)
|
|||
aiGenDudeChooseDirection(pSprite, pXSprite, getangle(dx, dy), xvelocity, yvelocity);
|
||||
|
||||
GENDUDEEXTRA* pExtra = &gGenDudeExtra[pSprite->index];
|
||||
if (!pExtra->canAttack) {
|
||||
if (!pExtra->canAttack)
|
||||
{
|
||||
if (pExtra->canWalk) aiSetTarget(actor, actor); // targeting self???
|
||||
if (spriteIsUnderwater(pSprite, false)) aiGenDudeNewState(pSprite, &genDudeGotoW);
|
||||
else aiGenDudeNewState(pSprite, &genDudeGotoL);
|
||||
|
@ -506,11 +558,16 @@ static void unicultThinkChase(DBloodActor* actor)
|
|||
|
||||
actor->dudeSlope = DivScale(pTarget->z - pSprite->z, dist, 10);
|
||||
|
||||
short curWeapon = gGenDudeExtra[pSprite->index].curWeapon; short weaponType = gGenDudeExtra[pSprite->index].weaponType;
|
||||
spritetype* pLeech = leechIsDropped(pSprite); const VECTORDATA* meleeVector = &gVectorData[22];
|
||||
if (weaponType == kGenDudeWeaponThrow) {
|
||||
if (abs(losAngle) < kAng15) {
|
||||
if (!gThingInfoExtra[curWeapon - kThingBase].allowThrow) {
|
||||
short curWeapon = gGenDudeExtra[pSprite->index].curWeapon;
|
||||
short weaponType = gGenDudeExtra[pSprite->index].weaponType;
|
||||
spritetype* pLeech = leechIsDropped(pSprite);
|
||||
const VECTORDATA* meleeVector = &gVectorData[22];
|
||||
if (weaponType == kGenDudeWeaponThrow)
|
||||
{
|
||||
if (abs(losAngle) < kAng15)
|
||||
{
|
||||
if (!gThingInfoExtra[curWeapon - kThingBase].allowThrow)
|
||||
{
|
||||
if (spriteIsUnderwater(pSprite)) aiGenDudeNewState(pSprite, &genDudeChaseW);
|
||||
else aiGenDudeNewState(pSprite, &genDudeChaseL);
|
||||
return;
|
||||
|
@ -526,10 +583,15 @@ static void unicultThinkChase(DBloodActor* actor)
|
|||
return;
|
||||
}
|
||||
|
||||
} else if (dist > 4072 && dist <= 11072 && !spriteIsUnderwater(pSprite, false) && pSprite->owner != (kMaxSprites - 1)) {
|
||||
switch (curWeapon) {
|
||||
case kModernThingEnemyLifeLeech: {
|
||||
if (pLeech == NULL) {
|
||||
}
|
||||
else if (dist > 4072 && dist <= 11072 && !spriteIsUnderwater(pSprite, false) && pSprite->owner != (kMaxSprites - 1))
|
||||
{
|
||||
switch (curWeapon)
|
||||
{
|
||||
case kModernThingEnemyLifeLeech:
|
||||
{
|
||||
if (pLeech == NULL)
|
||||
{
|
||||
aiGenDudeNewState(pSprite, &genDudeThrow2);
|
||||
genDudeThrow2.nextState = &genDudeDodgeShortL;
|
||||
return;
|
||||
|
@ -604,8 +666,11 @@ static void unicultThinkChase(DBloodActor* actor)
|
|||
{
|
||||
aiSetTarget(actor, pSprite->x, pSprite->y, pSprite->z);
|
||||
return;
|
||||
} else if (gGenDudeExtra[pSprite->index].slaveCount > gGameOptions.nDifficulty || dist < meleeVector->maxDist) {
|
||||
if (dist <= meleeVector->maxDist) {
|
||||
}
|
||||
else if (gGenDudeExtra[pSprite->index].slaveCount > gGameOptions.nDifficulty || dist < meleeVector->maxDist)
|
||||
{
|
||||
if (dist <= meleeVector->maxDist)
|
||||
{
|
||||
aiGenDudeNewState(pSprite, &genDudePunch);
|
||||
return;
|
||||
} else {
|
||||
|
@ -1009,8 +1074,8 @@ void aiGenDudeMoveForward(DBloodActor* actor)
|
|||
GENDUDEEXTRA* pExtra = &gGenDudeExtra[pSprite->index];
|
||||
int maxTurn = pDudeInfo->angSpeed * 4 >> 4;
|
||||
|
||||
|
||||
if (pExtra->canFly) {
|
||||
if (pExtra->canFly)
|
||||
{
|
||||
int nAng = ((pXSprite->goalAng + 1024 - pSprite->ang) & 2047) - 1024;
|
||||
int nTurnRange = (pDudeInfo->angSpeed << 2) >> 4;
|
||||
pSprite->ang = (pSprite->ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047;
|
||||
|
@ -1036,7 +1101,9 @@ void aiGenDudeMoveForward(DBloodActor* actor)
|
|||
t1 += nAccel >> 1;
|
||||
xvel[pSprite->index] = DMulScale(t1, nCos, t2, nSin, 30);
|
||||
yvel[pSprite->index] = DMulScale(t1, nSin, -t2, nCos, 30);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
int dang = ((kAng180 + pXSprite->goalAng - pSprite->ang) & 2047) - kAng180;
|
||||
pSprite->ang = ((pSprite->ang + ClipRange(dang, -maxTurn, maxTurn)) & 2047);
|
||||
|
||||
|
@ -1053,6 +1120,12 @@ void aiGenDudeMoveForward(DBloodActor* actor)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void aiGenDudeChooseDirection(spritetype* pSprite, XSPRITE* pXSprite, int a3, int xvel, int yvel) {
|
||||
if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) {
|
||||
Printf(PRINT_HIGH, "pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
|
||||
|
@ -1130,7 +1203,8 @@ void aiGenDudeNewState(spritetype* pSprite, AISTATE* pAIState) {
|
|||
|
||||
}
|
||||
|
||||
if (!gGenDudeExtra[pSprite->index].canRecoil) {
|
||||
if (!gGenDudeExtra[pSprite->index].canRecoil)
|
||||
{
|
||||
if (pAIState == &genDudeRecoilL || pAIState == &genDudeRecoilD) pAIState = &genDudeIdleL;
|
||||
else if (pAIState == &genDudeRecoilW) pAIState = &genDudeIdleW;
|
||||
}
|
||||
|
@ -1138,7 +1212,8 @@ void aiGenDudeNewState(spritetype* pSprite, AISTATE* pAIState) {
|
|||
pXSprite->stateTimer = pAIState->stateTicks; pXSprite->aiState = pAIState;
|
||||
|
||||
int stateSeq = pXSprite->data2 + pAIState->seqId;
|
||||
if (pAIState->seqId >= 0 && getSequence(stateSeq)) {
|
||||
if (pAIState->seqId >= 0 && getSequence(stateSeq))
|
||||
{
|
||||
seqSpawn(stateSeq, 3, pSprite->extra, pAIState->funcId);
|
||||
}
|
||||
|
||||
|
@ -1146,7 +1221,12 @@ void aiGenDudeNewState(spritetype* pSprite, AISTATE* pAIState) {
|
|||
pAIState->enterFunc(&bloodActors[pXSprite->reference]);
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool playGenDudeSound(spritetype* pSprite, int mode) {
|
||||
|
||||
if (mode < kGenDudeSndTargetSpot || mode >= kGenDudeSndMax) return false;
|
||||
|
|
Loading…
Reference in a new issue