mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-12 03:00:38 +00:00
- reformatting noise split from a larger commit.
This commit is contained in:
parent
c715ded287
commit
544145fe4b
1 changed files with 58 additions and 35 deletions
|
@ -235,7 +235,7 @@ void genDudeAttack1(int, DBloodActor* actor)
|
||||||
auto const pXSprite = &actor->x();
|
auto const pXSprite = &actor->x();
|
||||||
auto const pSprite = &actor->s();
|
auto const pSprite = &actor->s();
|
||||||
|
|
||||||
if (pXSprite->target_i < 0) return;
|
if (actor->GetTarget() == nullptr) return;
|
||||||
|
|
||||||
int dx, dy, dz;
|
int dx, dy, dz;
|
||||||
actor->xvel() = actor->yvel() = 0;
|
actor->xvel() = actor->yvel() = 0;
|
||||||
|
@ -400,7 +400,7 @@ static void ThrowThing(DBloodActor* actor, bool impact)
|
||||||
pSpawned->cstat &= ~CSTAT_SPRITE_BLOCK;
|
pSpawned->cstat &= ~CSTAT_SPRITE_BLOCK;
|
||||||
pSpawned->pal = 6;
|
pSpawned->pal = 6;
|
||||||
pSpawned->clipdist = 0;
|
pSpawned->clipdist = 0;
|
||||||
pXSpawned->target_i = pTarget->index;
|
spawned->SetTarget(actor->GetTarget());
|
||||||
pXSpawned->Proximity = true;
|
pXSpawned->Proximity = true;
|
||||||
pXSpawned->stateTimer = 1;
|
pXSpawned->stateTimer = 1;
|
||||||
|
|
||||||
|
@ -662,7 +662,7 @@ static void unicultThinkChase(DBloodActor* actor)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int state = checkAttackState(&bloodActors[pXSprite->reference]);
|
int state = checkAttackState(actor);
|
||||||
if (state == 1) aiGenDudeNewState(actor, &genDudeChaseW);
|
if (state == 1) aiGenDudeNewState(actor, &genDudeChaseW);
|
||||||
else if (state == 2)
|
else if (state == 2)
|
||||||
{
|
{
|
||||||
|
@ -724,7 +724,7 @@ static void unicultThinkChase(DBloodActor* actor)
|
||||||
break;
|
break;
|
||||||
case kMissileFlareAlt:
|
case kMissileFlareAlt:
|
||||||
mdist = 2500;
|
mdist = 2500;
|
||||||
fallthrough__;
|
[[fallthrough]];
|
||||||
case kMissileFireball:
|
case kMissileFireball:
|
||||||
case kMissileFireballNapalm:
|
case kMissileFireballNapalm:
|
||||||
case kMissileFireballCerberus:
|
case kMissileFireballCerberus:
|
||||||
|
@ -764,7 +764,7 @@ static void unicultThinkChase(DBloodActor* actor)
|
||||||
{
|
{
|
||||||
actor->xvel() = actor->yvel() = actor->zvel() = 0;
|
actor->xvel() = actor->yvel() = actor->zvel() = 0;
|
||||||
if (doExplosion(pSprite, nType) && pXSprite->health > 0)
|
if (doExplosion(pSprite, nType) && pXSprite->health > 0)
|
||||||
actDamageSprite(&bloodActors[pSprite->index], &bloodActors[pSprite->index], kDamageExplode, 65535);
|
actDamageSprite(actor, actor, kDamageExplode, 65535);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1179,16 +1179,16 @@ void aiGenDudeMoveForward(DBloodActor* actor)
|
||||||
return;
|
return;
|
||||||
int nCos = Cos(pSprite->ang);
|
int nCos = Cos(pSprite->ang);
|
||||||
int nSin = Sin(pSprite->ang);
|
int nSin = Sin(pSprite->ang);
|
||||||
int vx = xvel[pSprite->index];
|
int vx = actor->xvel();
|
||||||
int vy = yvel[pSprite->index];
|
int vy = actor->yvel();
|
||||||
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
|
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
|
||||||
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
|
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
|
||||||
if (actor->GetTarget() == nullptr)
|
if (actor->GetTarget() == nullptr)
|
||||||
t1 += nAccel;
|
t1 += nAccel;
|
||||||
else
|
else
|
||||||
t1 += nAccel >> 1;
|
t1 += nAccel >> 1;
|
||||||
xvel[pSprite->index] = DMulScale(t1, nCos, t2, nSin, 30);
|
actor->xvel() = DMulScale(t1, nCos, t2, nSin, 30);
|
||||||
yvel[pSprite->index] = DMulScale(t1, nSin, -t2, nCos, 30);
|
actor->yvel() = DMulScale(t1, nSin, -t2, nCos, 30);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1203,8 +1203,8 @@ void aiGenDudeMoveForward(DBloodActor* actor)
|
||||||
int cos = Cos(pSprite->ang);
|
int cos = Cos(pSprite->ang);
|
||||||
|
|
||||||
int frontSpeed = gGenDudeExtra[pSprite->index].moveSpeed;
|
int frontSpeed = gGenDudeExtra[pSprite->index].moveSpeed;
|
||||||
xvel[pSprite->index] += MulScale(cos, frontSpeed, 30);
|
actor->xvel() += MulScale(cos, frontSpeed, 30);
|
||||||
yvel[pSprite->index] += MulScale(sin, frontSpeed, 30);
|
actor->yvel() += MulScale(sin, frontSpeed, 30);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1319,7 +1319,7 @@ void aiGenDudeNewState(DBloodActor* actor, AISTATE* pAIState)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pAIState->enterFunc)
|
if (pAIState->enterFunc)
|
||||||
pAIState->enterFunc(&bloodActors[pXSprite->reference]);
|
pAIState->enterFunc(actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -1551,10 +1551,11 @@ void scaleDamage(XSPRITE* pXSprite) {
|
||||||
break;
|
break;
|
||||||
case kGenDudeWeaponMissile:
|
case kGenDudeWeaponMissile:
|
||||||
case kGenDudeWeaponThrow:
|
case kGenDudeWeaponThrow:
|
||||||
switch (curWeapon) {
|
switch (curWeapon)
|
||||||
|
{
|
||||||
case kMissileButcherKnife:
|
case kMissileButcherKnife:
|
||||||
curScale[kDmgBullet] = 100;
|
curScale[kDmgBullet] = 100;
|
||||||
fallthrough__;
|
[[fallthrough]];
|
||||||
case kMissileEctoSkull:
|
case kMissileEctoSkull:
|
||||||
curScale[kDmgSpirit] = 32;
|
curScale[kDmgSpirit] = 32;
|
||||||
break;
|
break;
|
||||||
|
@ -1575,7 +1576,7 @@ void scaleDamage(XSPRITE* pXSprite) {
|
||||||
break;
|
break;
|
||||||
case kMissileLifeLeechRegular:
|
case kMissileLifeLeechRegular:
|
||||||
curScale[kDmgBurn] = 60 + Random(4);
|
curScale[kDmgBurn] = 60 + Random(4);
|
||||||
fallthrough__;
|
[[fallthrough]];
|
||||||
case kThingDroppedLifeLeech:
|
case kThingDroppedLifeLeech:
|
||||||
case kModernThingEnemyLifeLeech:
|
case kModernThingEnemyLifeLeech:
|
||||||
curScale[kDmgSpirit] = 32 + Random(18);
|
curScale[kDmgSpirit] = 32 + Random(18);
|
||||||
|
@ -1608,8 +1609,10 @@ void scaleDamage(XSPRITE* pXSprite) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// add resistance if have an armor item to drop
|
// add resistance if have an armor item to drop
|
||||||
if (pXSprite->dropMsg >= kItemArmorAsbest && pXSprite->dropMsg <= kItemArmorSuper) {
|
if (pXSprite->dropMsg >= kItemArmorAsbest && pXSprite->dropMsg <= kItemArmorSuper)
|
||||||
switch (pXSprite->dropMsg) {
|
{
|
||||||
|
switch (pXSprite->dropMsg)
|
||||||
|
{
|
||||||
case kItemArmorAsbest:
|
case kItemArmorAsbest:
|
||||||
curScale[kDmgBurn] = 0;
|
curScale[kDmgBurn] = 0;
|
||||||
curScale[kDmgExplode] -= 30;
|
curScale[kDmgExplode] -= 30;
|
||||||
|
@ -1641,15 +1644,19 @@ void scaleDamage(XSPRITE* pXSprite) {
|
||||||
|
|
||||||
// take in account yrepeat of sprite
|
// take in account yrepeat of sprite
|
||||||
short yrepeat = sprite[pXSprite->reference].yrepeat;
|
short yrepeat = sprite[pXSprite->reference].yrepeat;
|
||||||
if (yrepeat < 64) {
|
if (yrepeat < 64)
|
||||||
|
{
|
||||||
for (int i = 0; i < kDmgMax; i++) curScale[i] += (64 - yrepeat);
|
for (int i = 0; i < kDmgMax; i++) curScale[i] += (64 - yrepeat);
|
||||||
} else if (yrepeat > 64) {
|
}
|
||||||
|
else if (yrepeat > 64)
|
||||||
|
{
|
||||||
for (int i = 0; i < kDmgMax; i++) curScale[i] -= ((yrepeat - 64) >> 2);
|
for (int i = 0; i < kDmgMax; i++) curScale[i] -= ((yrepeat - 64) >> 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// take surface type into account
|
// take surface type into account
|
||||||
int surfType = tileGetSurfType(sprite[pXSprite->reference].index + 0xc000);
|
int surfType = tileGetSurfType(sprite[pXSprite->reference].index + 0xc000);
|
||||||
switch (surfType) {
|
switch (surfType)
|
||||||
|
{
|
||||||
case 1: // stone
|
case 1: // stone
|
||||||
curScale[kDmgFall] = 0;
|
curScale[kDmgFall] = 0;
|
||||||
curScale[kDmgBullet] -= 200;
|
curScale[kDmgBullet] -= 200;
|
||||||
|
@ -1748,12 +1755,16 @@ int getDispersionModifier(spritetype* pSprite, int minDisp, int maxDisp)
|
||||||
// the distance counts from sprite size
|
// the distance counts from sprite size
|
||||||
int getRangeAttackDist(spritetype* pSprite, int minDist, int maxDist) {
|
int getRangeAttackDist(spritetype* pSprite, int minDist, int maxDist) {
|
||||||
short yrepeat = pSprite->yrepeat; int dist = 0; int seqId = xsprite[pSprite->extra].data2;
|
short yrepeat = pSprite->yrepeat; int dist = 0; int seqId = xsprite[pSprite->extra].data2;
|
||||||
short mul = 550; int picnum = pSprite->picnum;
|
int mul = 550;
|
||||||
|
int picnum = pSprite->picnum;
|
||||||
|
|
||||||
if (yrepeat > 0) {
|
if (yrepeat > 0)
|
||||||
if (seqId >= 0) {
|
{
|
||||||
|
if (seqId >= 0)
|
||||||
|
{
|
||||||
Seq* pSeq = getSequence(seqId);
|
Seq* pSeq = getSequence(seqId);
|
||||||
if (pSeq) {
|
if (pSeq)
|
||||||
|
{
|
||||||
picnum = seqGetTile(&pSeq->frames[0]);
|
picnum = seqGetTile(&pSeq->frames[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1768,7 +1779,14 @@ int getRangeAttackDist(spritetype* pSprite, int minDist, int maxDist) {
|
||||||
return dist;
|
return dist;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getBaseChanceModifier(int baseChance) {
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
int getBaseChanceModifier(int baseChance)
|
||||||
|
{
|
||||||
return ((gGameOptions.nDifficulty > 0) ? baseChance - (0x0500 * gGameOptions.nDifficulty) : baseChance);
|
return ((gGameOptions.nDifficulty > 0) ? baseChance - (0x0500 * gGameOptions.nDifficulty) : baseChance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1884,10 +1902,15 @@ bool doExplosion(spritetype* pSprite, int nType)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
// this function allows to spawn new custom dude and inherit spawner settings,
|
// this function allows to spawn new custom dude and inherit spawner settings,
|
||||||
// so custom dude can have different weapons, hp and so on...
|
// so custom dude can have different weapons, hp and so on...
|
||||||
spritetype* genDudeSpawn(XSPRITE* pXSource, spritetype* pSprite, int nDist) {
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
spritetype* genDudeSpawn(XSPRITE* pXSource, spritetype* pSprite, int nDist)
|
||||||
|
{
|
||||||
DBloodActor* actor = &bloodActors[pSprite->index];
|
DBloodActor* actor = &bloodActors[pSprite->index];
|
||||||
spritetype* pSource = &sprite[pXSource->reference];
|
spritetype* pSource = &sprite[pXSource->reference];
|
||||||
auto spawned = actSpawnSprite(actor, kStatDude);
|
auto spawned = actSpawnSprite(actor, kStatDude);
|
||||||
|
@ -2059,7 +2082,7 @@ void genDudeTransform(spritetype* pSprite) {
|
||||||
case kDudeModernCustomBurning:
|
case kDudeModernCustomBurning:
|
||||||
seqId = genDudeSeqStartId(pXSprite);
|
seqId = genDudeSeqStartId(pXSprite);
|
||||||
genDudePrepare(pSprite, kGenDudePropertyMass);
|
genDudePrepare(pSprite, kGenDudePropertyMass);
|
||||||
fallthrough__; // go below
|
[[fallthrough]]; // go below
|
||||||
default:
|
default:
|
||||||
seqSpawn(seqId, 3, pSprite->extra, -1);
|
seqSpawn(seqId, 3, pSprite->extra, -1);
|
||||||
|
|
||||||
|
@ -2258,7 +2281,7 @@ bool genDudePrepare(spritetype* pSprite, int propId) {
|
||||||
pExtra->initVals[1] = pSprite->yrepeat;
|
pExtra->initVals[1] = pSprite->yrepeat;
|
||||||
pExtra->initVals[2] = pSprite->clipdist;
|
pExtra->initVals[2] = pSprite->clipdist;
|
||||||
if (propId) break;
|
if (propId) break;
|
||||||
fallthrough__;
|
[[fallthrough]];
|
||||||
|
|
||||||
case kGenDudePropertyWeapon: {
|
case kGenDudePropertyWeapon: {
|
||||||
pExtra->curWeapon = pXSprite->data1;
|
pExtra->curWeapon = pXSprite->data1;
|
||||||
|
@ -2288,13 +2311,13 @@ bool genDudePrepare(spritetype* pSprite, int propId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (propId) break;
|
if (propId) break;
|
||||||
fallthrough__;
|
[[fallthrough]];
|
||||||
|
|
||||||
}
|
}
|
||||||
case kGenDudePropertyDmgScale:
|
case kGenDudePropertyDmgScale:
|
||||||
scaleDamage(pXSprite);
|
scaleDamage(pXSprite);
|
||||||
if (propId) break;
|
if (propId) break;
|
||||||
fallthrough__;
|
[[fallthrough]];
|
||||||
|
|
||||||
case kGenDudePropertyMass: {
|
case kGenDudePropertyMass: {
|
||||||
// to ensure mass gets updated, let's clear all cache
|
// to ensure mass gets updated, let's clear all cache
|
||||||
|
@ -2303,14 +2326,14 @@ bool genDudePrepare(spritetype* pSprite, int propId) {
|
||||||
pMass->mass = pMass->airVel = pMass->fraction = 0;
|
pMass->mass = pMass->airVel = pMass->fraction = 0;
|
||||||
getSpriteMassBySize(pSprite);
|
getSpriteMassBySize(pSprite);
|
||||||
if (propId) break;
|
if (propId) break;
|
||||||
fallthrough__;
|
[[fallthrough]];
|
||||||
}
|
}
|
||||||
case kGenDudePropertyAttack:
|
case kGenDudePropertyAttack:
|
||||||
pExtra->fireDist = getRangeAttackDist(pSprite, 3000, 45000);
|
pExtra->fireDist = getRangeAttackDist(pSprite, 3000, 45000);
|
||||||
pExtra->throwDist = pExtra->fireDist; // temp
|
pExtra->throwDist = pExtra->fireDist; // temp
|
||||||
pExtra->baseDispersion = getDispersionModifier(pSprite, 200, 3500);
|
pExtra->baseDispersion = getDispersionModifier(pSprite, 200, 3500);
|
||||||
if (propId) break;
|
if (propId) break;
|
||||||
fallthrough__;
|
[[fallthrough]];
|
||||||
|
|
||||||
case kGenDudePropertyStates: {
|
case kGenDudePropertyStates: {
|
||||||
|
|
||||||
|
@ -2417,7 +2440,7 @@ bool genDudePrepare(spritetype* pSprite, int propId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (propId) break;
|
if (propId) break;
|
||||||
fallthrough__;
|
[[fallthrough]];
|
||||||
}
|
}
|
||||||
case kGenDudePropertyLeech:
|
case kGenDudePropertyLeech:
|
||||||
pExtra->pLifeLeech = nullptr;
|
pExtra->pLifeLeech = nullptr;
|
||||||
|
@ -2433,7 +2456,7 @@ bool genDudePrepare(spritetype* pSprite, int propId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (propId) break;
|
if (propId) break;
|
||||||
fallthrough__;
|
[[fallthrough]];
|
||||||
|
|
||||||
case kGenDudePropertySlaves:
|
case kGenDudePropertySlaves:
|
||||||
{
|
{
|
||||||
|
@ -2453,7 +2476,7 @@ bool genDudePrepare(spritetype* pSprite, int propId) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (propId) break;
|
if (propId) break;
|
||||||
fallthrough__;
|
[[fallthrough]];
|
||||||
}
|
}
|
||||||
case kGenDudePropertySpriteSize: {
|
case kGenDudePropertySpriteSize: {
|
||||||
if (seqGetStatus(3, pSprite->extra) == -1)
|
if (seqGetStatus(3, pSprite->extra) == -1)
|
||||||
|
|
Loading…
Reference in a new issue