- getDispersionModifier and getRangeAttackDist.

This commit is contained in:
Christoph Oelckers 2021-05-06 09:04:06 +02:00
parent 9801ce25dd
commit b70368050a
2 changed files with 23 additions and 8 deletions

View file

@ -1730,10 +1730,17 @@ static void scaleDamage(DBloodActor* actor)
//viewSetSystemMessage("0: %d, 1: %d, 2: %d, 3: %d, 4: %d, 5: %d, 6: %d", dc[0], dc[1], dc[2], dc[3], dc[4], dc[5], dc[6]); //viewSetSystemMessage("0: %d, 1: %d, 2: %d, 3: %d, 4: %d, 5: %d, 6: %d", dc[0], dc[1], dc[2], dc[3], dc[4], dc[5], dc[6]);
} }
int getDispersionModifier(spritetype* pSprite, int minDisp, int maxDisp) //---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
static int getDispersionModifier(DBloodActor* actor, int minDisp, int maxDisp)
{ {
auto const pXSprite = &actor->x();
// the faster fire rate, the less frames = more dispersion // the faster fire rate, the less frames = more dispersion
Seq* pSeq = getSequence(xsprite[pSprite->extra].data2 + 6); Seq* pSeq = getSequence(pXSprite->data2 + 6);
int disp = 1; int disp = 1;
if (pSeq != nullptr) if (pSeq != nullptr)
{ {
@ -1753,9 +1760,19 @@ int getDispersionModifier(spritetype* pSprite, int minDisp, int maxDisp)
return ClipRange(disp, minDisp, maxDisp); return ClipRange(disp, minDisp, maxDisp);
} }
//---------------------------------------------------------------------------
//
// the distance counts from sprite size // the distance counts from sprite size
int getRangeAttackDist(spritetype* pSprite, int minDist, int maxDist) { //
short yrepeat = pSprite->yrepeat; int dist = 0; int seqId = xsprite[pSprite->extra].data2; //---------------------------------------------------------------------------
static int getRangeAttackDist(DBloodActor* actor, int minDist, int maxDist)
{
auto const pSprite = &actor->s();
auto const pXSprite = &actor->x();
short yrepeat = pSprite->yrepeat;
int dist = 0;
int seqId = pXSprite->data2;
int mul = 550; int mul = 550;
int picnum = pSprite->picnum; int picnum = pSprite->picnum;
@ -2330,9 +2347,9 @@ bool genDudePrepare(spritetype* pSprite, int propId) {
[[fallthrough]]; [[fallthrough]];
} }
case kGenDudePropertyAttack: case kGenDudePropertyAttack:
pExtra->fireDist = getRangeAttackDist(pSprite, 3000, 45000); pExtra->fireDist = getRangeAttackDist(actor, 3000, 45000);
pExtra->throwDist = pExtra->fireDist; // temp pExtra->throwDist = pExtra->fireDist; // temp
pExtra->baseDispersion = getDispersionModifier(pSprite, 200, 3500); pExtra->baseDispersion = getDispersionModifier(actor, 200, 3500);
if (propId) break; if (propId) break;
[[fallthrough]]; [[fallthrough]];

View file

@ -226,8 +226,6 @@ short inSearch(AISTATE* aiState);
short inChase(AISTATE* aiState); short inChase(AISTATE* aiState);
short inDuck(AISTATE* aiState); short inDuck(AISTATE* aiState);
int genDudeSeqStartId(XSPRITE* pXSprite); int genDudeSeqStartId(XSPRITE* pXSprite);
int getRangeAttackDist(spritetype* pSprite, int minDist = 3000, int maxDist = 80000);
int getDispersionModifier(spritetype* pSprite, int minDisp, int maxDisp);
bool genDudePrepare(spritetype* pSprite, int propId); bool genDudePrepare(spritetype* pSprite, int propId);
void genDudeUpdate(DBloodActor* pSprite); void genDudeUpdate(DBloodActor* pSprite);
void genDudePostDeath(spritetype* pSprite, DAMAGE_TYPE damageType, int damage); void genDudePostDeath(spritetype* pSprite, DAMAGE_TYPE damageType, int damage);