diff --git a/src/c_bind.cpp b/src/c_bind.cpp index a298dc296..5c1b18323 100644 --- a/src/c_bind.cpp +++ b/src/c_bind.cpp @@ -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; } diff --git a/src/g_strife/a_sentinel.cpp b/src/g_strife/a_sentinel.cpp index fa99c827f..91adbb01e 100644 --- a/src/g_strife/a_sentinel.cpp +++ b/src/g_strife/a_sentinel.cpp @@ -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; diff --git a/src/intermission/intermission.cpp b/src/intermission/intermission.cpp index 5b78ebc51..ba4566e9d 100644 --- a/src/intermission/intermission.cpp +++ b/src/intermission/intermission.cpp @@ -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) { diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index b35faa505..4568f30b7 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -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 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); + } } diff --git a/src/p_enemy.h b/src/p_enemy.h index 298c60725..1be77a4ec 100644 --- a/src/p_enemy.h +++ b/src/p_enemy.h @@ -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); diff --git a/src/p_map.cpp b/src/p_map.cpp index 36a13b040..193bbf93b 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -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); diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 7e77b0aa2..f3ee142a9 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -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); diff --git a/src/p_terrain.cpp b/src/p_terrain.cpp index 1b3226780..ca5a8b998 100644 --- a/src/p_terrain.cpp +++ b/src/p_terrain.cpp @@ -497,7 +497,7 @@ static void ParseFriction (FScanner &sc, int keyword, void *fields) friction = (0x1EB8*(sc.Float*100))/0x80 + 0xD001; friction = clamp (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; diff --git a/src/portal.cpp b/src/portal.cpp index d5e9d1c39..a414cf53b 100644 --- a/src/portal.cpp +++ b/src/portal.cpp @@ -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)); diff --git a/src/posix/cocoa/i_video.mm b/src/posix/cocoa/i_video.mm index c4595678c..3ff5b28d7 100644 --- a/src/posix/cocoa/i_video.mm +++ b/src/posix/cocoa/i_video.mm @@ -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) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index afbc036a6..feec1aceb 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -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 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); } diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 44ebb1dc3..fbb16dc80 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -237,7 +237,7 @@ ACTOR Actor native //: Thinker native state A_JumpIfInTargetInventory(class itemtype, int amount, state label, int forward_ptr = AAPTR_DEFAULT); native bool A_GiveToTarget(class itemtype, int amount = 0, int forward_ptr = AAPTR_DEFAULT); native bool A_TakeFromTarget(class itemtype, int amount = 0, int flags = 0, int forward_ptr = AAPTR_DEFAULT); - native int A_RadiusGive(class itemtype, float distance, int flags, int amount = 0, class filter = "None", name species = "None", int mindist = 0); + native int A_RadiusGive(class itemtype, float distance, int flags, int amount = 0, class 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);