# Conflicts:
#	src/r_bsp.cpp
This commit is contained in:
nashmuhandes 2016-05-26 18:22:55 +08:00
commit 6baecf5009
12 changed files with 67 additions and 53 deletions

View file

@ -228,7 +228,7 @@ static const char *KeyName (int key)
if (KeyNames[key])
return KeyNames[key];
mysnprintf (name, countof(name), "#%d", key);
mysnprintf (name, countof(name), "Key_%d", key);
return name;
}

View file

@ -60,7 +60,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SentinelAttack)
for (int i = 8; i > 1; --i)
{
trail = Spawn("SentinelFX1",
self->Vec3Angle(missile->radius*i, missile->Angles.Yaw, missile->Vel.Z / 4 * i), ALLOW_REPLACE);
self->Vec3Angle(missile->radius*i, missile->Angles.Yaw, 32 + missile->Vel.Z / 4 * i), ALLOW_REPLACE);
if (trail != NULL)
{
trail->target = self;

View file

@ -109,7 +109,7 @@ void DIntermissionScreen::Init(FIntermissionAction *desc, bool first)
}
else if (*texname == '$')
{
texname = GStrings[texname+1];
texname = GStrings(texname+1);
}
if (texname[0] != 0)
{

View file

@ -121,30 +121,32 @@ void P_RandomChaseDir (AActor *actor);
// PROC P_RecursiveSound
//
// Called by P_NoiseAlert.
// Recursively traverse adjacent sectors,
// Traverses adjacent sectors,
// 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
if (sec->validcount == validcount
&& sec->soundtraversed <= soundblocks+1)
&& sec->soundtraversed <= soundblocks + 1)
{
return; // already flooded
}
sec->validcount = validcount;
sec->soundtraversed = soundblocks+1;
sec->soundtraversed = soundblocks + 1;
sec->SoundTarget = soundtarget;
// [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)) &&
(!maxdist || (actor->Distance2D(emitter) <= maxdist)))
@ -152,31 +154,39 @@ void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soun
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 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...
if (checkabove)
{
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)
{
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();
if (port && (port->mFlags & PORTF_SOUNDTRAVERSE))
{
if (port->mDestination)
{
P_RecursiveSound(port->mDestination->frontsector, soundtarget, splash, soundblocks, emitter, maxdist);
NoiseMarkSector(port->mDestination->frontsector, soundtarget, splash, emitter, soundblocks, maxdist);
}
}
@ -186,28 +196,29 @@ void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soun
{
continue;
}
// Early out for intra-sector lines
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;
else
other = check->sidedef[0]->sector;
// check for closed door
if ((sec->floorplane.ZatPoint (check->v1->fPos()) >=
other->ceilingplane.ZatPoint (check->v1->fPos()) &&
sec->floorplane.ZatPoint (check->v2->fPos()) >=
other->ceilingplane.ZatPoint (check->v2->fPos()))
|| (other->floorplane.ZatPoint (check->v1->fPos()) >=
sec->ceilingplane.ZatPoint (check->v1->fPos()) &&
other->floorplane.ZatPoint (check->v2->fPos()) >=
sec->ceilingplane.ZatPoint (check->v2->fPos()))
|| (other->floorplane.ZatPoint (check->v1->fPos()) >=
other->ceilingplane.ZatPoint (check->v1->fPos()) &&
other->floorplane.ZatPoint (check->v2->fPos()) >=
other->ceilingplane.ZatPoint (check->v2->fPos())))
if ((sec->floorplane.ZatPoint(check->v1->fPos()) >=
other->ceilingplane.ZatPoint(check->v1->fPos()) &&
sec->floorplane.ZatPoint(check->v2->fPos()) >=
other->ceilingplane.ZatPoint(check->v2->fPos()))
|| (other->floorplane.ZatPoint(check->v1->fPos()) >=
sec->ceilingplane.ZatPoint(check->v1->fPos()) &&
other->floorplane.ZatPoint(check->v2->fPos()) >=
sec->ceilingplane.ZatPoint(check->v2->fPos()))
|| (other->floorplane.ZatPoint(check->v1->fPos()) >=
other->ceilingplane.ZatPoint(check->v1->fPos()) &&
other->floorplane.ZatPoint(check->v2->fPos()) >=
other->ceilingplane.ZatPoint(check->v2->fPos())))
{
continue;
}
@ -215,17 +226,18 @@ void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soun
if (check->flags & ML_SOUNDBLOCK)
{
if (!soundblocks)
P_RecursiveSound (other, soundtarget, splash, 1, emitter, maxdist);
NoiseMarkSector(other, soundtarget, splash, emitter, 1, maxdist);
}
else
{
P_RecursiveSound (other, soundtarget, splash, soundblocks, emitter, maxdist);
NoiseMarkSector(other, soundtarget, splash, emitter, soundblocks, maxdist);
}
}
}
//----------------------------------------------------------------------------
//
// PROC P_NoiseAlert
@ -244,7 +256,11 @@ void P_NoiseAlert (AActor *target, AActor *emitter, bool splash, double maxdist)
return;
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);
}
}

View file

@ -46,7 +46,6 @@ struct FLookExParams
};
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);
void P_NoiseAlert (AActor *target, AActor *emmiter, bool splash=false, double maxdist=0);

View file

@ -6498,7 +6498,7 @@ void AActor::UpdateRenderSectorList()
while (!sec->PortalBlocksMovement(sector_t::ceiling))
{
double planeh = sec->GetPortalPlaneZ(sector_t::ceiling);
if (planeh < lasth) break; // broken setup.
if (planeh <= lasth) break; // broken setup.
if (Top() + SPRITE_SPACE < planeh) break;
lasth = planeh;
DVector2 newpos = Pos() + sec->GetPortalDisplacement(sector_t::ceiling);
@ -6509,7 +6509,7 @@ void AActor::UpdateRenderSectorList()
while (!sec->PortalBlocksMovement(sector_t::floor))
{
double planeh = sec->GetPortalPlaneZ(sector_t::floor);
if (planeh > lasth) break; // broken setup.
if (planeh >= lasth) break; // broken setup.
if (Z() - SPRITE_SPACE > planeh) break;
lasth = planeh;
DVector2 newpos = Pos() + sec->GetPortalDisplacement(sector_t::floor);

View file

@ -3561,10 +3561,10 @@ void AActor::Tick ()
scrolltype -= Carry_East5;
BYTE dir = HereticScrollDirs[scrolltype / 5];
double carryspeed = HereticSpeedMuls[scrolltype % 5] * (1. / (32 * CARRYFACTOR));
if (scrolltype<=Carry_East35 && !(i_compatflags&COMPATF_RAVENSCROLL))
if (scrolltype < 5 && !(i_compatflags&COMPATF_RAVENSCROLL))
{
// Use speeds that actually match the scrolling textures!
carryspeed = (1 << ((scrolltype%5) - 1));
carryspeed = (1 << ((scrolltype % 5) + 15)) / 65536.;
}
scrollv.X += carryspeed * ((dir & 3) - 1);
scrollv.Y += carryspeed * (((dir & 12) >> 2) - 1);

View file

@ -497,7 +497,7 @@ static void ParseFriction (FScanner &sc, int keyword, void *fields)
friction = (0x1EB8*(sc.Float*100))/0x80 + 0xD001;
friction = clamp<double> (friction, 0, 65536.);
if (friction > ORIG_FRICTION) // ice
if (friction > ORIG_FRICTION * 65536.) // ice
movefactor = ((0x10092 - friction) * 1024) / 4352 + 568;
else
movefactor = ((friction - 0xDB34)*(0xA))/0x80;

View file

@ -312,7 +312,7 @@ void P_SpawnLinePortal(line_t* line)
else
{
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.
Printf(TEXTCOLOR_RED "Warning: z-offsetting not allowed for interactive portals. Changing line %d to teleport-portal!\n", int(line - lines));

View file

@ -789,7 +789,6 @@ void CocoaVideo::SetFullscreenMode(const int width, const int height)
}
[m_window setFrame:screenFrame display:YES];
[m_window setFrameOrigin:NSMakePoint(0.0f, 0.0f)];
}
void CocoaVideo::SetWindowedMode(const int width, const int height)

View file

@ -1226,8 +1226,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Explode)
P_CheckSplash(self, distance);
if (alert && self->target != NULL && self->target->player != NULL)
{
validcount++;
P_RecursiveSound (self->Sector, self->target, false, 0);
P_NoiseAlert(self->target, self);
}
return 0;
}
@ -3439,7 +3438,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Burst)
if (mo)
{
mo->Vel.Z = 4 * (mo->Z() - self->Z()) * self->Height;
mo->Vel.Z = 4 * (mo->Z() - self->Z()) / self->Height;
mo->Vel.X = pr_burst.Random2() / 128.;
mo->Vel.Y = pr_burst.Random2() / 128.;
mo->RenderStyle = self->RenderStyle;
@ -5635,16 +5634,17 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive)
PARAM_FLOAT (distance);
PARAM_INT (flags);
PARAM_INT_OPT (amount) { amount = 0; }
PARAM_CLASS_OPT (filter, AActor) { filter = NULL; }
PARAM_CLASS_OPT (filter, AActor) { filter = nullptr; }
PARAM_NAME_OPT (species) { species = NAME_None; }
PARAM_FLOAT_OPT (mindist) { mindist = 0; }
PARAM_INT_OPT (limit) { limit = 0; }
// We need a valid item, valid targets, and a valid range
if (item == NULL || (flags & RGF_MASK) == 0 || !flags || distance <= 0 || mindist >= distance)
if (item == nullptr || (flags & RGF_MASK) == 0 || !flags || distance <= 0 || mindist >= distance)
{
ACTION_RETURN_INT(0);
}
bool unlimited = (limit <= 0);
if (amount == 0)
{
amount = 1;
@ -5654,7 +5654,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive)
if (flags & RGF_MISSILES)
{
TThinkerIterator<AActor> it;
while ((thing = it.Next()))
while ((thing = it.Next()) && ((unlimited) || (given < limit)))
{
given += DoRadiusGive(self, thing, item, amount, distance, flags, filter, species, mindist);
}
@ -5666,7 +5666,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive)
FMultiBlockThingsIterator it(check, self->X(), self->Y(), mid-distance, mid+distance, distance, false, self->Sector);
FMultiBlockThingsIterator::CheckResult cres;
while ((it.Next(&cres)))
while ((it.Next(&cres)) && ((unlimited) || (given < limit)))
{
given += DoRadiusGive(self, cres.thing, item, amount, distance, flags, filter, species, mindist);
}

View file

@ -237,7 +237,7 @@ ACTOR Actor native //: Thinker
native state A_JumpIfInTargetInventory(class<Inventory> itemtype, int amount, state label, int forward_ptr = AAPTR_DEFAULT);
native bool A_GiveToTarget(class<Inventory> itemtype, int amount = 0, int forward_ptr = AAPTR_DEFAULT);
native bool A_TakeFromTarget(class<Inventory> itemtype, int amount = 0, int flags = 0, int forward_ptr = AAPTR_DEFAULT);
native int A_RadiusGive(class<Inventory> itemtype, float distance, int flags, int amount = 0, class<Actor> filter = "None", name species = "None", int mindist = 0);
native int A_RadiusGive(class<Inventory> itemtype, float distance, int flags, int amount = 0, class<Actor> filter = "None", name species = "None", int mindist = 0, int limit = 0);
native state A_CheckSpecies(state jump, name species = "", int ptr = AAPTR_DEFAULT);
native void A_CountdownArg(int argnum, state targstate = "");
action native A_CustomMeleeAttack(int damage = 0, sound meleesound = "", sound misssound = "", name damagetype = "none", bool bleed = true);