Fix set AI. Shouldn't die so quickly now.

This commit is contained in:
sirlemonhead 2019-11-14 22:44:31 +00:00 committed by Christoph Oelckers
parent c365a79f81
commit 19dfc45321

View file

@ -242,12 +242,7 @@ void FuncSet(int a, int nDamage, int nRun)
SetList[nSet].nHealth -= nDamage;
}
if (SetList[nSet].nHealth > 0 && nAction == 1)
{
SetList[nSet].nAction = 2;
SetList[nSet].field_2 = 0;
}
else
if (SetList[nSet].nHealth <= 0)
{
sprite[nSprite].xvel = 0;
sprite[nSprite].yvel = 0;
@ -263,6 +258,11 @@ void FuncSet(int a, int nDamage, int nRun)
SetList[nSet].nAction = 10;
}
}
else if (nAction == 1)
{
SetList[nSet].nAction = 2;
SetList[nSet].field_2 = 0;
}
}
return;
}
@ -354,8 +354,12 @@ void FuncSet(int a, int nDamage, int nRun)
{
if (FindPlayer(nSprite, 1000) >= 0)
{
SetList[nSet].nAction = 2;
SetList[nSet].field_2 = 0;
SetList[nSet].field_A--;
if (SetList[nSet].field_A <= 0)
{
SetList[nSet].nAction = 2;
SetList[nSet].field_2 = 0;
}
}
return;
@ -389,7 +393,7 @@ void FuncSet(int a, int nDamage, int nRun)
if ((nSet & 0x1F) == (totalmoves & 0x1F))
{
int nRand = RandomSize(1);
int nRand = RandomSize(3);
switch (nRand)
{
@ -439,9 +443,13 @@ void FuncSet(int a, int nDamage, int nRun)
sprite[nSprite].yvel *= 2;
}
if ((nVal & 0xC000) == 0x8000)
if ((nVal & 0xC000) < 0x8000)
{
short nWall = nVal & 0xC000;
break;
}
else if ((nVal & 0xC000) == 0x8000)
{
short nWall = nVal & 0x3FFF;
short nSector = wall[nWall].nextsector;
if (nSector >= 0)
@ -460,14 +468,14 @@ void FuncSet(int a, int nDamage, int nRun)
}
}
sprite[nSprite].ang = (sprite[nSprite].ang + 100) & kAngleMask;
sprite[nSprite].ang = (sprite[nSprite].ang + 512) & kAngleMask; // CHECKME loc_33A14
sprite[nSprite].xvel = Sin(sprite[nSprite].ang + 512) >> 1;
sprite[nSprite].yvel = Sin(sprite[nSprite].ang) >> 1;
break;
}
else if ((nVal & 0xC000) == 0xC000)
{
if (nTarget)
if (nTarget == (nVal & 0x3FFF))
{
int nAng = getangle(sprite[nTarget].x - sprite[nSprite].x, sprite[nTarget].y - sprite[nSprite].y);
if (AngleDiff(sprite[nSprite].ang, nAng) < 64)
@ -487,6 +495,8 @@ void FuncSet(int a, int nDamage, int nRun)
return;
}
}
break;
}
else
{
@ -494,8 +504,6 @@ void FuncSet(int a, int nDamage, int nRun)
SetList[nSet].field_2 = 0;
return;
}
return; // CHECKME
}
case 4:
@ -514,7 +522,6 @@ void FuncSet(int a, int nDamage, int nRun)
else if (nFlag & 0x80)
{
runlist_DamageEnemy(nTarget, nSprite, 5);
}
}
@ -542,12 +549,8 @@ void FuncSet(int a, int nDamage, int nRun)
SetList[nSet].field_E--;
if (SetList[nSet].field_E <= 0 || !RandomBit())
{
if (!RandomBit())
{
// TODO - same as block belowm
SetList[nSet].nAction = 0;
SetList[nSet].field_2 = 0;
}
SetList[nSet].nAction = 0;
SetList[nSet].field_2 = 0;
}
}
return;