mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 04:20:42 +00:00
- getSpriteMassBySize
This commit is contained in:
parent
81c3443af9
commit
6f8fe44bb0
4 changed files with 56 additions and 35 deletions
|
@ -2571,7 +2571,7 @@ static void ConcussSprite(DBloodActor* source, DBloodActor* actor, int x, int y,
|
|||
#ifdef NOONE_EXTENSIONS
|
||||
if (pSprite->type == kDudeModernCustom || pSprite->type == kDudeModernCustomBurning)
|
||||
{
|
||||
mass = getSpriteMassBySize(pSprite);
|
||||
mass = getSpriteMassBySize(actor);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -4267,7 +4267,7 @@ static void checkCeilHit(DBloodActor* actor)
|
|||
{
|
||||
case kDudeModernCustom:
|
||||
case kDudeModernCustomBurning:
|
||||
mass2 = getSpriteMassBySize(pSprite);
|
||||
mass2 = getSpriteMassBySize(actor);
|
||||
break;
|
||||
}
|
||||
if (mass1 > mass2)
|
||||
|
@ -4292,7 +4292,7 @@ static void checkCeilHit(DBloodActor* actor)
|
|||
case kDudeModernCustom:
|
||||
case kDudeModernCustomBurning:
|
||||
int dmg = 0;
|
||||
if (!actor->IsDudeActor() || (dmg = ClipLow((getSpriteMassBySize(pSprite2) - getSpriteMassBySize(pSprite)) >> 1, 0)) == 0)
|
||||
if (!actor->IsDudeActor() || (dmg = ClipLow((getSpriteMassBySize(actor2) - getSpriteMassBySize(actor)) >> 1, 0)) == 0)
|
||||
break;
|
||||
|
||||
if (!actor->IsPlayerActor())
|
||||
|
@ -4359,7 +4359,7 @@ static void checkHit(DBloodActor* actor)
|
|||
{
|
||||
case kDudeModernCustom:
|
||||
case kDudeModernCustomBurning:
|
||||
mass2 = getSpriteMassBySize(pSprite2);
|
||||
mass2 = getSpriteMassBySize(actor2);
|
||||
break;
|
||||
}
|
||||
if (mass1 > mass2)
|
||||
|
@ -4436,7 +4436,7 @@ static void checkFloorHit(DBloodActor* actor)
|
|||
{
|
||||
case kDudeModernCustom:
|
||||
case kDudeModernCustomBurning:
|
||||
mass2 = getSpriteMassBySize(pSprite2);
|
||||
mass2 = getSpriteMassBySize(actor2);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -5241,8 +5241,8 @@ void MoveDude(DBloodActor* actor)
|
|||
pSprite->flags &= ~4;
|
||||
}
|
||||
else
|
||||
|
||||
pSprite->flags |= 4;
|
||||
|
||||
switch (tileGetSurfType(floorHit))
|
||||
{
|
||||
case kSurfWater:
|
||||
|
@ -7046,7 +7046,7 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6,
|
|||
{
|
||||
case kDudeModernCustom:
|
||||
case kDudeModernCustomBurning:
|
||||
t = getSpriteMassBySize(pSprite);
|
||||
t = getSpriteMassBySize(actor);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -256,7 +256,7 @@ void genDudeAttack1(int, DBloodActor* actor)
|
|||
|
||||
actFireVector(actor, 0, 0, dx, dy, dz,(VECTOR_TYPE)pExtra->curWeapon);
|
||||
if (!playGenDudeSound(actor, kGenDudeSndAttackNormal))
|
||||
sfxPlayVectorSound(pSprite, pExtra->curWeapon);
|
||||
sfxPlayVectorSound(actor, pExtra->curWeapon);
|
||||
}
|
||||
else if (pExtra->weaponType == kGenDudeWeaponSummon)
|
||||
{
|
||||
|
@ -292,7 +292,7 @@ void genDudeAttack1(int, DBloodActor* actor)
|
|||
|
||||
actFireMissile(actor, 0, 0, dx, dy, dz, pExtra->curWeapon);
|
||||
if (!playGenDudeSound(actor, kGenDudeSndAttackNormal))
|
||||
sfxPlayMissileSound(pSprite, pExtra->curWeapon);
|
||||
sfxPlayMissileSound(actor, pExtra->curWeapon);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1809,9 +1809,8 @@ int getBaseChanceModifier(int baseChance)
|
|||
|
||||
int getRecoilChance(DBloodActor* actor)
|
||||
{
|
||||
auto const pSprite = &actor->s();
|
||||
auto const pXSprite = &actor->x();
|
||||
int mass = getSpriteMassBySize(pSprite);
|
||||
int mass = getSpriteMassBySize(actor);
|
||||
int baseChance = (!dudeIsMelee(actor) ? 0x8000 : 0x4000);
|
||||
baseChance = getBaseChanceModifier(baseChance) + pXSprite->data3;
|
||||
|
||||
|
@ -1821,9 +1820,8 @@ int getRecoilChance(DBloodActor* actor)
|
|||
|
||||
int getDodgeChance(DBloodActor* actor)
|
||||
{
|
||||
auto const pSprite = &actor->s();
|
||||
auto const pXSprite = &actor->x();
|
||||
int mass = getSpriteMassBySize(pSprite);
|
||||
int mass = getSpriteMassBySize(actor);
|
||||
int baseChance = (!dudeIsMelee(actor) ? 0x6000 : 0x1000);
|
||||
baseChance = getBaseChanceModifier(baseChance) + pXSprite->data3;
|
||||
|
||||
|
@ -2417,7 +2415,7 @@ bool genDudePrepare(DBloodActor* actor, int propId)
|
|||
SPRITEMASS* pMass = &actor->spriteMass;
|
||||
pMass->seqId = pMass->picnum = pMass->xrepeat = pMass->yrepeat = pMass->clipdist = 0;
|
||||
pMass->mass = pMass->airVel = pMass->fraction = 0;
|
||||
getSpriteMassBySize(pSprite);
|
||||
getSpriteMassBySize(actor);
|
||||
if (propId) break;
|
||||
[[fallthrough]];
|
||||
}
|
||||
|
|
|
@ -559,7 +559,7 @@ void nnExtInitModernStuff(bool bSaveLoad)
|
|||
break;
|
||||
case kDudeModernCustom:
|
||||
case kDudeModernCustomBurning:
|
||||
getSpriteMassBySize(pSprite); // create mass cache
|
||||
getSpriteMassBySize(actor); // create mass cache
|
||||
break;
|
||||
case kModernCondition:
|
||||
case kModernConditionFalse:
|
||||
|
@ -579,7 +579,7 @@ void nnExtInitModernStuff(bool bSaveLoad)
|
|||
if (pXSprite->physAttr != 0)
|
||||
{
|
||||
gPhysSpritesList[gPhysSpritesCount++] = &bloodActors[pSprite->index]; // add sprite index
|
||||
getSpriteMassBySize(pSprite); // create mass cache
|
||||
getSpriteMassBySize(actor); // create mass cache
|
||||
}
|
||||
|
||||
if (pXSprite->data3 != pXSprite->sysData1)
|
||||
|
@ -1146,9 +1146,10 @@ static void windGenDoVerticalWind(int factor, int nSector)
|
|||
void nnExtProcessSuperSprites()
|
||||
{
|
||||
// process tracking conditions
|
||||
if (gTrackingCondsCount > 0) {
|
||||
for (int i = 0; i < gTrackingCondsCount; i++) {
|
||||
|
||||
if (gTrackingCondsCount > 0)
|
||||
{
|
||||
for (int i = 0; i < gTrackingCondsCount; i++)
|
||||
{
|
||||
TRCONDITION* pCond = &gCondition[i];
|
||||
XSPRITE* pXCond = &pCond->actor->x();
|
||||
if (pXCond->locked || pXCond->isTriggered || ++pXCond->busy < pXCond->busyTime)
|
||||
|
@ -1466,25 +1467,46 @@ void nnExtProcessSuperSprites()
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// this function plays sound predefined in missile info
|
||||
void sfxPlayMissileSound(spritetype* pSprite, int missileId) {
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void sfxPlayMissileSound(DBloodActor* actor, int missileId)
|
||||
{
|
||||
const MISSILEINFO_EXTRA* pMissType = &gMissileInfoExtra[missileId - kMissileBase];
|
||||
sfxPlay3DSound(pSprite, Chance(0x5000) ? pMissType->fireSound[0] : pMissType->fireSound[1], -1, 0);
|
||||
sfxPlay3DSound(actor, Chance(0x5000) ? pMissType->fireSound[0] : pMissType->fireSound[1], -1, 0);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// this function plays sound predefined in vector info
|
||||
void sfxPlayVectorSound(spritetype* pSprite, int vectorId) {
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void sfxPlayVectorSound(DBloodActor* actor, int vectorId)
|
||||
{
|
||||
const VECTORINFO_EXTRA* pVectorData = &gVectorInfoExtra[vectorId];
|
||||
sfxPlay3DSound(pSprite, Chance(0x5000) ? pVectorData->fireSound[0] : pVectorData->fireSound[1], -1, 0);
|
||||
sfxPlay3DSound(actor, Chance(0x5000) ? pVectorData->fireSound[0] : pVectorData->fireSound[1], -1, 0);
|
||||
}
|
||||
|
||||
int getSpriteMassBySize(spritetype* pSprite) {
|
||||
auto actor = &bloodActors[pSprite->index];
|
||||
int mass = 0; int seqId = -1; int clipDist = pSprite->clipdist; Seq* pSeq = NULL;
|
||||
if (pSprite->extra < 0) {
|
||||
I_Error("getSpriteMassBySize: pSprite->extra < 0");
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
} else if (IsDudeSprite(pSprite)) {
|
||||
int getSpriteMassBySize(DBloodActor* actor)
|
||||
{
|
||||
auto pSprite = &actor->s();
|
||||
int mass = 0; int seqId = -1; int clipDist = pSprite->clipdist; Seq* pSeq = NULL;
|
||||
if (!actor->hasX())
|
||||
{
|
||||
I_Error("getSpriteMassBySize: pSprite->extra < 0");
|
||||
}
|
||||
else if (actor->IsDudeActor())
|
||||
{
|
||||
|
||||
switch (pSprite->type) {
|
||||
case kDudePodMother: // fake dude, no seq
|
||||
|
@ -2447,6 +2469,7 @@ void usePropertiesChanger(XSPRITE* pXSource, short objType, int objIndex) {
|
|||
}
|
||||
break;
|
||||
case OBJ_SPRITE: {
|
||||
auto actor = &bloodActors[objIndex];
|
||||
spritetype* pSprite = &sprite[objIndex]; bool thing2debris = false;
|
||||
XSPRITE* pXSprite = &xsprite[pSprite->extra]; int old = -1;
|
||||
|
||||
|
@ -2624,7 +2647,7 @@ void usePropertiesChanger(XSPRITE* pXSource, short objType, int objIndex) {
|
|||
|
||||
gPhysSpritesList[nIndex] = &bloodActors[objIndex];
|
||||
if (nIndex >= gPhysSpritesCount) gPhysSpritesCount++;
|
||||
getSpriteMassBySize(pSprite); // create physics cache
|
||||
getSpriteMassBySize(actor); // create physics cache
|
||||
|
||||
}
|
||||
|
||||
|
@ -4223,7 +4246,7 @@ bool condCheckSprite(XSPRITE* pXCond, int cmpOp, bool PUSH) {
|
|||
return false;
|
||||
}
|
||||
case 70:
|
||||
return condCmp(getSpriteMassBySize(pSpr), arg1, arg2, cmpOp); // mass of the sprite in a range?
|
||||
return condCmp(getSpriteMassBySize(spractor), arg1, arg2, cmpOp); // mass of the sprite in a range?
|
||||
}
|
||||
} else {
|
||||
switch (cond) {
|
||||
|
@ -5629,7 +5652,7 @@ void useRandomItemGen(spritetype* pSource, XSPRITE* pXSource) {
|
|||
|
||||
gPhysSpritesList[nIndex] = &bloodActors[pDrop->index];
|
||||
if (nIndex >= gPhysSpritesCount) gPhysSpritesCount++;
|
||||
getSpriteMassBySize(pDrop); // create mass cache
|
||||
getSpriteMassBySize(dropactor); // create mass cache
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -300,8 +300,8 @@ int nnExtRandom(int a, int b);
|
|||
void nnExtResetGlobals();
|
||||
void nnExtTriggerObject(int objType, int objIndex, int command);
|
||||
// ------------------------------------------------------------------------- //
|
||||
void sfxPlayMissileSound(spritetype* pSprite, int missileId);
|
||||
void sfxPlayVectorSound(spritetype* pSprite, int vectorId);
|
||||
void sfxPlayMissileSound(DBloodActor* pSprite, int missileId);
|
||||
void sfxPlayVectorSound(DBloodActor* pSprite, int vectorId);
|
||||
// ------------------------------------------------------------------------- //
|
||||
int debrisGetIndex(int nSprite);
|
||||
int debrisGetFreeIndex(void);
|
||||
|
@ -398,7 +398,7 @@ int getDataFieldOfObject(int objType, int objIndex, DBloodActor* objActor, int d
|
|||
bool setDataValueOfObject(int objType, int objIndex, int dataIndex, int value);
|
||||
bool incDecGoalValueIsReached(XSPRITE* pXSprite);
|
||||
void windGenStopWindOnSectors(XSPRITE* pXSource);
|
||||
int getSpriteMassBySize(spritetype* pSprite);
|
||||
int getSpriteMassBySize(DBloodActor* pSprite);
|
||||
bool ceilIsTooLow(spritetype* pSprite);
|
||||
void levelEndLevelCustom(int nLevel);
|
||||
int useCondition(spritetype* pSource, XSPRITE* pXSource, EVENT event);
|
||||
|
|
Loading…
Reference in a new issue