mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-24 12:51:09 +00:00
Merge branch 'master' of https://github.com/rheit/zdoom
This commit is contained in:
commit
ded479b1a5
5 changed files with 52 additions and 38 deletions
|
@ -109,7 +109,7 @@ void DIntermissionScreen::Init(FIntermissionAction *desc, bool first)
|
||||||
}
|
}
|
||||||
else if (*texname == '$')
|
else if (*texname == '$')
|
||||||
{
|
{
|
||||||
texname = GStrings[texname+1];
|
texname = GStrings(texname+1);
|
||||||
}
|
}
|
||||||
if (texname[0] != 0)
|
if (texname[0] != 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -120,30 +120,32 @@ void P_RandomChaseDir (AActor *actor);
|
||||||
// PROC P_RecursiveSound
|
// PROC P_RecursiveSound
|
||||||
//
|
//
|
||||||
// Called by P_NoiseAlert.
|
// Called by P_NoiseAlert.
|
||||||
// Recursively traverse adjacent sectors,
|
// Traverses adjacent sectors,
|
||||||
// sound blocking lines cut off traversal.
|
// sound blocking lines cut off traversal.
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soundblocks, AActor *emitter, double maxdist)
|
struct NoiseTarget
|
||||||
|
{
|
||||||
|
sector_t *sec;
|
||||||
|
int soundblocks;
|
||||||
|
};
|
||||||
|
static TArray<NoiseTarget> NoiseList(128);
|
||||||
|
|
||||||
|
static void NoiseMarkSector(sector_t *sec, AActor *soundtarget, bool splash, AActor *emitter, int soundblocks, double maxdist)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
line_t* check;
|
|
||||||
sector_t* other;
|
|
||||||
AActor* actor;
|
|
||||||
|
|
||||||
// wake up all monsters in this sector
|
// wake up all monsters in this sector
|
||||||
if (sec->validcount == validcount
|
if (sec->validcount == validcount
|
||||||
&& sec->soundtraversed <= soundblocks+1)
|
&& sec->soundtraversed <= soundblocks + 1)
|
||||||
{
|
{
|
||||||
return; // already flooded
|
return; // already flooded
|
||||||
}
|
}
|
||||||
|
|
||||||
sec->validcount = validcount;
|
sec->validcount = validcount;
|
||||||
sec->soundtraversed = soundblocks+1;
|
sec->soundtraversed = soundblocks + 1;
|
||||||
sec->SoundTarget = soundtarget;
|
sec->SoundTarget = soundtarget;
|
||||||
|
|
||||||
// [RH] Set this in the actors in the sector instead of the sector itself.
|
// [RH] Set this in the actors in the sector instead of the sector itself.
|
||||||
for (actor = sec->thinglist; actor != NULL; actor = actor->snext)
|
for (AActor *actor = sec->thinglist; actor != NULL; actor = actor->snext)
|
||||||
{
|
{
|
||||||
if (actor != soundtarget && (!splash || !(actor->flags4 & MF4_NOSPLASHALERT)) &&
|
if (actor != soundtarget && (!splash || !(actor->flags4 & MF4_NOSPLASHALERT)) &&
|
||||||
(!maxdist || (actor->Distance2D(emitter) <= maxdist)))
|
(!maxdist || (actor->Distance2D(emitter) <= maxdist)))
|
||||||
|
@ -151,31 +153,39 @@ void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soun
|
||||||
actor->LastHeard = soundtarget;
|
actor->LastHeard = soundtarget;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
NoiseList.Push({ sec, soundblocks });
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void P_RecursiveSound(sector_t *sec, AActor *soundtarget, bool splash, AActor *emitter, int soundblocks, double maxdist)
|
||||||
|
{
|
||||||
bool checkabove = !sec->PortalBlocksSound(sector_t::ceiling);
|
bool checkabove = !sec->PortalBlocksSound(sector_t::ceiling);
|
||||||
bool checkbelow = !sec->PortalBlocksSound(sector_t::floor);
|
bool checkbelow = !sec->PortalBlocksSound(sector_t::floor);
|
||||||
|
|
||||||
for (i = 0; i < sec->linecount; i++)
|
for (int i = 0; i < sec->linecount; i++)
|
||||||
{
|
{
|
||||||
check = sec->lines[i];
|
line_t *check = sec->lines[i];
|
||||||
|
|
||||||
|
// check sector portals
|
||||||
// I wish there was a better method to do this than randomly looking through the portal at a few places...
|
// I wish there was a better method to do this than randomly looking through the portal at a few places...
|
||||||
if (checkabove)
|
if (checkabove)
|
||||||
{
|
{
|
||||||
sector_t *upper = P_PointInSector(check->v1->fPos() + check->Delta() / 2 + sec->GetPortalDisplacement(sector_t::ceiling));
|
sector_t *upper = P_PointInSector(check->v1->fPos() + check->Delta() / 2 + sec->GetPortalDisplacement(sector_t::ceiling));
|
||||||
P_RecursiveSound(upper, soundtarget, splash, soundblocks, emitter, maxdist);
|
NoiseMarkSector(upper, soundtarget, splash, emitter, soundblocks, maxdist);
|
||||||
}
|
}
|
||||||
if (checkbelow)
|
if (checkbelow)
|
||||||
{
|
{
|
||||||
sector_t *lower = P_PointInSector(check->v1->fPos() + check->Delta() / 2 + sec->GetPortalDisplacement(sector_t::floor));
|
sector_t *lower = P_PointInSector(check->v1->fPos() + check->Delta() / 2 + sec->GetPortalDisplacement(sector_t::floor));
|
||||||
P_RecursiveSound(lower, soundtarget, splash, soundblocks, emitter, maxdist);
|
NoiseMarkSector(lower, soundtarget, splash, emitter, soundblocks, maxdist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ... and line portals;
|
||||||
FLinePortal *port = check->getPortal();
|
FLinePortal *port = check->getPortal();
|
||||||
if (port && (port->mFlags & PORTF_SOUNDTRAVERSE))
|
if (port && (port->mFlags & PORTF_SOUNDTRAVERSE))
|
||||||
{
|
{
|
||||||
if (port->mDestination)
|
if (port->mDestination)
|
||||||
{
|
{
|
||||||
P_RecursiveSound(port->mDestination->frontsector, soundtarget, splash, soundblocks, emitter, maxdist);
|
NoiseMarkSector(port->mDestination->frontsector, soundtarget, splash, emitter, soundblocks, maxdist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,28 +195,29 @@ void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soun
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Early out for intra-sector lines
|
// Early out for intra-sector lines
|
||||||
if (check->sidedef[0]->sector == check->sidedef[1]->sector) continue;
|
if (check->sidedef[0]->sector == check->sidedef[1]->sector) continue;
|
||||||
|
|
||||||
if ( check->sidedef[0]->sector == sec)
|
sector_t *other;
|
||||||
|
if (check->sidedef[0]->sector == sec)
|
||||||
other = check->sidedef[1]->sector;
|
other = check->sidedef[1]->sector;
|
||||||
else
|
else
|
||||||
other = check->sidedef[0]->sector;
|
other = check->sidedef[0]->sector;
|
||||||
|
|
||||||
// check for closed door
|
// check for closed door
|
||||||
if ((sec->floorplane.ZatPoint (check->v1->fPos()) >=
|
if ((sec->floorplane.ZatPoint(check->v1->fPos()) >=
|
||||||
other->ceilingplane.ZatPoint (check->v1->fPos()) &&
|
other->ceilingplane.ZatPoint(check->v1->fPos()) &&
|
||||||
sec->floorplane.ZatPoint (check->v2->fPos()) >=
|
sec->floorplane.ZatPoint(check->v2->fPos()) >=
|
||||||
other->ceilingplane.ZatPoint (check->v2->fPos()))
|
other->ceilingplane.ZatPoint(check->v2->fPos()))
|
||||||
|| (other->floorplane.ZatPoint (check->v1->fPos()) >=
|
|| (other->floorplane.ZatPoint(check->v1->fPos()) >=
|
||||||
sec->ceilingplane.ZatPoint (check->v1->fPos()) &&
|
sec->ceilingplane.ZatPoint(check->v1->fPos()) &&
|
||||||
other->floorplane.ZatPoint (check->v2->fPos()) >=
|
other->floorplane.ZatPoint(check->v2->fPos()) >=
|
||||||
sec->ceilingplane.ZatPoint (check->v2->fPos()))
|
sec->ceilingplane.ZatPoint(check->v2->fPos()))
|
||||||
|| (other->floorplane.ZatPoint (check->v1->fPos()) >=
|
|| (other->floorplane.ZatPoint(check->v1->fPos()) >=
|
||||||
other->ceilingplane.ZatPoint (check->v1->fPos()) &&
|
other->ceilingplane.ZatPoint(check->v1->fPos()) &&
|
||||||
other->floorplane.ZatPoint (check->v2->fPos()) >=
|
other->floorplane.ZatPoint(check->v2->fPos()) >=
|
||||||
other->ceilingplane.ZatPoint (check->v2->fPos())))
|
other->ceilingplane.ZatPoint(check->v2->fPos())))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -214,17 +225,18 @@ void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soun
|
||||||
if (check->flags & ML_SOUNDBLOCK)
|
if (check->flags & ML_SOUNDBLOCK)
|
||||||
{
|
{
|
||||||
if (!soundblocks)
|
if (!soundblocks)
|
||||||
P_RecursiveSound (other, soundtarget, splash, 1, emitter, maxdist);
|
NoiseMarkSector(other, soundtarget, splash, emitter, 1, maxdist);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
P_RecursiveSound (other, soundtarget, splash, soundblocks, emitter, maxdist);
|
NoiseMarkSector(other, soundtarget, splash, emitter, soundblocks, maxdist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// PROC P_NoiseAlert
|
// PROC P_NoiseAlert
|
||||||
|
@ -243,7 +255,11 @@ void P_NoiseAlert (AActor *target, AActor *emitter, bool splash, double maxdist)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
validcount++;
|
validcount++;
|
||||||
P_RecursiveSound (emitter->Sector, target, splash, 0, emitter, maxdist);
|
NoiseMarkSector(emitter->Sector, target, splash, emitter, 0, maxdist);
|
||||||
|
for (unsigned i = 0; i < NoiseList.Size(); i++)
|
||||||
|
{
|
||||||
|
P_RecursiveSound(NoiseList[i].sec, target, splash, emitter, NoiseList[i].soundblocks, maxdist);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,6 @@ struct FLookExParams
|
||||||
};
|
};
|
||||||
|
|
||||||
void P_DaggerAlert (AActor *target, AActor *emitter);
|
void P_DaggerAlert (AActor *target, AActor *emitter);
|
||||||
void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soundblocks, AActor *emitter=NULL, double maxdist=0);
|
|
||||||
bool P_HitFriend (AActor *self);
|
bool P_HitFriend (AActor *self);
|
||||||
void P_NoiseAlert (AActor *target, AActor *emmiter, bool splash=false, double maxdist=0);
|
void P_NoiseAlert (AActor *target, AActor *emmiter, bool splash=false, double maxdist=0);
|
||||||
|
|
||||||
|
|
|
@ -314,7 +314,7 @@ void P_SpawnLinePortal(line_t* line)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
port->mAlign = BYTE(line->args[3] >= PORG_ABSOLUTE && line->args[3] <= PORG_CEILING ? line->args[3] : PORG_ABSOLUTE);
|
port->mAlign = BYTE(line->args[3] >= PORG_ABSOLUTE && line->args[3] <= PORG_CEILING ? line->args[3] : PORG_ABSOLUTE);
|
||||||
if (port->mType == PORTT_INTERACTIVE)
|
if (port->mType == PORTT_INTERACTIVE && port->mAlign != PORG_ABSOLUTE)
|
||||||
{
|
{
|
||||||
// Due to the way z is often handled, these pose a major issue for parts of the code that needs to transparently handle interactive portals.
|
// Due to the way z is often handled, these pose a major issue for parts of the code that needs to transparently handle interactive portals.
|
||||||
Printf(TEXTCOLOR_RED "Warning: z-offsetting not allowed for interactive portals. Changing line %d to teleport-portal!\n", int(line - lines));
|
Printf(TEXTCOLOR_RED "Warning: z-offsetting not allowed for interactive portals. Changing line %d to teleport-portal!\n", int(line - lines));
|
||||||
|
|
|
@ -1226,8 +1226,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Explode)
|
||||||
P_CheckSplash(self, distance);
|
P_CheckSplash(self, distance);
|
||||||
if (alert && self->target != NULL && self->target->player != NULL)
|
if (alert && self->target != NULL && self->target->player != NULL)
|
||||||
{
|
{
|
||||||
validcount++;
|
P_NoiseAlert(self->target, self);
|
||||||
P_RecursiveSound (self->Sector, self->target, false, 0);
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue