- Fixed: FMOD calls for setting the water reverb must check the return code

for errors.
- Fixed: Hexen's dual attack weapons must check distance to targets in 3D,
  not 2D.


SVN r1336 (trunk)
This commit is contained in:
Christoph Oelckers 2008-12-30 23:27:27 +00:00
parent aeaf94c1c4
commit 987c878a9a
7 changed files with 70 additions and 30 deletions

View file

@ -1,4 +1,8 @@
December 30, 2008 (Changes by Graf Zahl) December 30, 2008 (Changes by Graf Zahl)
- Fixed: FMOD calls for setting the water reverb must check the return code
for errors.
- Fixed: Hexen's dual attack weapons must check distance to targets in 3D,
not 2D.
- Made several DECORATE errors which do not involve parsing non-fatal. - Made several DECORATE errors which do not involve parsing non-fatal.
- Added a static error counter to FScriptPosition class. - Added a static error counter to FScriptPosition class.
- Changed initialization of actor class type properties: fuglyname is gone as - Changed initialization of actor class type properties: fuglyname is gone as

View file

@ -66,7 +66,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheck)
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
{ {
angle = pmo->angle+i*(ANG45/16); angle = pmo->angle+i*(ANG45/16);
slope = P_AimLineAttack (pmo, angle, fixed_t(1.5*MELEERANGE), &linetarget); slope = P_AimLineAttack (pmo, angle, fixed_t(1.5*MELEERANGE), &linetarget, 0, false, true);
if (linetarget) if (linetarget)
{ {
P_LineAttack (pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, PClass::FindClass ("CStaffPuff")); P_LineAttack (pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, PClass::FindClass ("CStaffPuff"));
@ -90,7 +90,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheck)
break; break;
} }
angle = pmo->angle-i*(ANG45/16); angle = pmo->angle-i*(ANG45/16);
slope = P_AimLineAttack (player->mo, angle, fixed_t(1.5*MELEERANGE), &linetarget); slope = P_AimLineAttack (player->mo, angle, fixed_t(1.5*MELEERANGE), &linetarget, 0, false, true);
if (linetarget) if (linetarget)
{ {
P_LineAttack (pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, PClass::FindClass ("CStaffPuff")); P_LineAttack (pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, PClass::FindClass ("CStaffPuff"));

View file

@ -46,7 +46,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FHammerAttack)
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
{ {
angle = pmo->angle + i*(ANG45/32); angle = pmo->angle + i*(ANG45/32);
slope = P_AimLineAttack (pmo, angle, HAMMER_RANGE, &linetarget); slope = P_AimLineAttack (pmo, angle, HAMMER_RANGE, &linetarget, 0, false, true);
if (linetarget) if (linetarget)
{ {
P_LineAttack (pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, PClass::FindClass ("HammerPuff"), true); P_LineAttack (pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, PClass::FindClass ("HammerPuff"), true);
@ -59,7 +59,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FHammerAttack)
goto hammerdone; goto hammerdone;
} }
angle = pmo->angle-i*(ANG45/32); angle = pmo->angle-i*(ANG45/32);
slope = P_AimLineAttack(pmo, angle, HAMMER_RANGE, &linetarget); slope = P_AimLineAttack(pmo, angle, HAMMER_RANGE, &linetarget, 0, false, true);
if(linetarget) if(linetarget)
{ {
P_LineAttack(pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, PClass::FindClass ("HammerPuff"), true); P_LineAttack(pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, PClass::FindClass ("HammerPuff"), true);
@ -74,7 +74,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FHammerAttack)
} }
// didn't find any targets in meleerange, so set to throw out a hammer // didn't find any targets in meleerange, so set to throw out a hammer
angle = pmo->angle; angle = pmo->angle;
slope = P_AimLineAttack (pmo, angle, HAMMER_RANGE, &linetarget); slope = P_AimLineAttack (pmo, angle, HAMMER_RANGE, &linetarget, 0, false, true);
if (P_LineAttack (pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, PClass::FindClass ("HammerPuff"), true) != NULL) if (P_LineAttack (pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, PClass::FindClass ("HammerPuff"), true) != NULL)
{ {
pmo->special1 = false; pmo->special1 = false;

View file

@ -77,7 +77,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireConePL1)
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
{ {
angle = self->angle+i*(ANG45/16); angle = self->angle+i*(ANG45/16);
slope = P_AimLineAttack (self, angle, MELEERANGE, &linetarget); slope = P_AimLineAttack (self, angle, MELEERANGE, &linetarget, 0, false, true);
if (linetarget) if (linetarget)
{ {
P_DamageMobj (linetarget, self, self, damage, NAME_Ice); P_DamageMobj (linetarget, self, self, damage, NAME_Ice);

View file

@ -380,7 +380,7 @@ void P_FindFloorCeiling (AActor *actor, bool onlymidtex = false);
bool P_ChangeSector (sector_t* sector, int crunch, int amt, int floorOrCeil, bool isreset); bool P_ChangeSector (sector_t* sector, int crunch, int amt, int floorOrCeil, bool isreset);
fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, AActor **pLineTarget = NULL, fixed_t vrange=0, bool forcenosmart=false); fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, AActor **pLineTarget = NULL, fixed_t vrange=0, bool forcenosmart=false, bool check3d = false);
AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, int pitch, int damage, FName damageType, const PClass *pufftype, bool ismelee = false); AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, int pitch, int damage, FName damageType, const PClass *pufftype, bool ismelee = false);
AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, int pitch, int damage, FName damageType, FName pufftype, bool ismelee = false); AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, int pitch, int damage, FName damageType, FName pufftype, bool ismelee = false);
void P_TraceBleed (int damage, fixed_t x, fixed_t y, fixed_t z, AActor *target, angle_t angle, int pitch); void P_TraceBleed (int damage, fixed_t x, fixed_t y, fixed_t z, AActor *target, angle_t angle, int pitch);

View file

@ -2359,6 +2359,7 @@ struct aim_t
AActor * thing_friend, * thing_other; AActor * thing_friend, * thing_other;
angle_t pitch_friend, pitch_other; angle_t pitch_friend, pitch_other;
bool notsmart; bool notsmart;
bool check3d;
void AimTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t endy); void AimTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t endy);
@ -2397,7 +2398,7 @@ void aim_t::AimTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t e
// A two sided line will restrict the possible target ranges. // A two sided line will restrict the possible target ranges.
FLineOpening open; FLineOpening open;
P_LineOpening (open, NULL, li, it.Trace().x + FixedMul (it.Trace().dx, in->frac), P_LineOpening (open, NULL, li, it.Trace().x + FixedMul (it.Trace().dx, in->frac),
it.Trace().y + FixedMul (it.Trace().dy, in->frac)); it.Trace().y + FixedMul (it.Trace().dy, in->frac));
if (open.bottom >= open.top) if (open.bottom >= open.top)
return; // stop return; // stop
@ -2457,6 +2458,23 @@ void aim_t::AimTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t e
thingpitch = thingtoppitch/2 + thingbottompitch/2; thingpitch = thingtoppitch/2 + thingbottompitch/2;
if (check3d)
{
// We need to do a 3D distance check here because this is nearly always used in
// combination with P_LineAttack. P_LineAttack uses 3D distance but FPathTraverse
// only 2D. This causes some problems with Hexen's weapons that use different
// attack modes based on distance to target
fixed_t cosine = finecosine[thingpitch >> ANGLETOFINESHIFT];
if (cosine != 0)
{
fixed_t d3 = FixedDiv( FixedMul( P_AproxDistance(it.Trace().dx, it.Trace().dy), in->frac), cosine);
if (d3 > attackrange)
{
return;
}
}
}
if (sv_smartaim && !notsmart) if (sv_smartaim && !notsmart)
{ {
// try to be a little smarter about what to aim at! // try to be a little smarter about what to aim at!
@ -2500,7 +2518,7 @@ void aim_t::AimTraverse (fixed_t startx, fixed_t starty, fixed_t endx, fixed_t e
// P_AimLineAttack // P_AimLineAttack
// //
//============================================================================ //============================================================================
fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, AActor **pLineTarget, fixed_t vrange, bool forcenosmart) fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, AActor **pLineTarget, fixed_t vrange, bool forcenosmart, bool check3d)
{ {
fixed_t x2; fixed_t x2;
fixed_t y2; fixed_t y2;
@ -2508,6 +2526,7 @@ fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, AActor **p
angle >>= ANGLETOFINESHIFT; angle >>= ANGLETOFINESHIFT;
aim.shootthing = t1; aim.shootthing = t1;
aim.check3d = check3d;
x2 = t1->x + (distance>>FRACBITS)*finecosine[angle]; x2 = t1->x + (distance>>FRACBITS)*finecosine[angle];
y2 = t1->y + (distance>>FRACBITS)*finesine[angle]; y2 = t1->y + (distance>>FRACBITS)*finesine[angle];

View file

@ -903,26 +903,43 @@ bool FMODSoundRenderer::Init()
FMOD::DSP *sfx_head, *pausable_head; FMOD::DSP *sfx_head, *pausable_head;
result = SfxGroup->getDSPHead(&sfx_head); result = SfxGroup->getDSPHead(&sfx_head);
result = sfx_head->getInput(0, &pausable_head, &SfxConnection); if (result == FMOD_OK)
result = WaterLP->addInput(pausable_head, NULL);
WaterLP->setActive(false);
WaterLP->setParameter(FMOD_DSP_LOWPASS_CUTOFF, snd_waterlp);
WaterLP->setParameter(FMOD_DSP_LOWPASS_RESONANCE, 2);
if (WaterReverb != NULL)
{ {
FMOD::DSPConnection *dry; result = sfx_head->getInput(0, &pausable_head, &SfxConnection);
result = WaterReverb->addInput(pausable_head, &dry); if (result == FMOD_OK)
result = dry->setMix(0.1f); {
result = WaterReverb->addInput(WaterLP, NULL); result = WaterLP->addInput(pausable_head, NULL);
result = sfx_head->addInput(WaterReverb, NULL); WaterLP->setActive(false);
WaterReverb->setParameter(FMOD_DSP_REVERB_ROOMSIZE, 0.001f); WaterLP->setParameter(FMOD_DSP_LOWPASS_CUTOFF, snd_waterlp);
WaterReverb->setParameter(FMOD_DSP_REVERB_DAMP, 0.2f); WaterLP->setParameter(FMOD_DSP_LOWPASS_RESONANCE, 2);
WaterReverb->setActive(false); if (WaterReverb != NULL)
} {
else FMOD::DSPConnection *dry;
{ result = WaterReverb->addInput(pausable_head, &dry);
result = sfx_head->addInput(WaterLP, NULL); if (result == FMOD_OK)
{
result = dry->setMix(0.1f);
if (result == FMOD_OK)
{
result = WaterReverb->addInput(WaterLP, NULL);
if (result == FMOD_OK)
{
result = sfx_head->addInput(WaterReverb, NULL);
if (result == FMOD_OK)
{
WaterReverb->setParameter(FMOD_DSP_REVERB_ROOMSIZE, 0.001f);
WaterReverb->setParameter(FMOD_DSP_REVERB_DAMP, 0.2f);
WaterReverb->setActive(false);
}
}
}
}
}
else
{
result = sfx_head->addInput(WaterLP, NULL);
}
}
} }
} }
LastWaterLP = snd_waterlp; LastWaterLP = snd_waterlp;