diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 02252b94d..f29f2fa17 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,12 @@ +July 12, 2008 (Changes by Graf Zahl) +- Added a compatibility option to play sector sounds from the precalculated + center because some maps apparently abuse the behavior to make the sound + play somewhere where it can't be heard by the player to fake silent movement. +- Fixed: The S_Sound variant taking an actor must check if the actor is not + NULL. +- Fixed: ACS's ActivatorSound must check if the activator is valid. +- Changed stats drawing so that multi-line strings can be used. + July 5, 2008 - Added a check to G_DoSaveGame() to prevent saving when you're not actually in a level. diff --git a/src/d_main.cpp b/src/d_main.cpp index 14771372a..f275b4e86 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -443,7 +443,7 @@ CVAR (Flag, compat_nopassover, compatflags, COMPATF_NO_PASSMOBJ); CVAR (Flag, compat_soundslots, compatflags, COMPATF_MAGICSILENCE); CVAR (Flag, compat_wallrun, compatflags, COMPATF_WALLRUN); CVAR (Flag, compat_notossdrops, compatflags, COMPATF_NOTOSSDROPS); -CVAR (Flag, compat_useblocking, compatflags, COMPATF_USEBLOCKING); +CVAR (Flag, compat_useblocking, compatflags, COMPATF_USEBLOCKING); CVAR (Flag, compat_nodoorlight, compatflags, COMPATF_NODOORLIGHT); CVAR (Flag, compat_ravenscroll, compatflags, COMPATF_RAVENSCROLL); CVAR (Flag, compat_soundtarget, compatflags, COMPATF_SOUNDTARGET); @@ -453,6 +453,7 @@ CVAR (Flag, compat_dropoff, compatflags, COMPATF_DROPOFF); CVAR (Flag, compat_boomscroll, compatflags, COMPATF_BOOMSCROLL); CVAR (Flag, compat_invisibility,compatflags, COMPATF_INVISIBILITY); CVAR (Flag, compat_silentinstantfloors,compatflags, COMPATF_SILENT_INSTANT_FLOORS); +CVAR (Flag, compat_sectorsounds,compatflags, COMPATF_SECTORSOUNDS); //========================================================================== // diff --git a/src/doomdef.h b/src/doomdef.h index 510f6bbe1..cb4f962aa 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -266,6 +266,7 @@ enum COMPATF_BOOMSCROLL = 1 << 15, // Scrolling sectors are additive like in Boom COMPATF_INVISIBILITY = 1 << 16, // Monsters can see semi-invisible players COMPATF_SILENT_INSTANT_FLOORS = 1<<17, // Instantly moving floors are not silent + COMPATF_SECTORSOUNDS = 1 << 18, // Sector sounds use original method for sound origin. }; // phares 3/20/98: diff --git a/src/g_level.cpp b/src/g_level.cpp index 7befda503..695a2ca09 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -346,6 +346,7 @@ static const char *MapInfoMapLevel[] = "compat_boomscroll", "compat_invisibility", "compat_silent_instant_floors", + "compat_sectorsounds", "bordertexture", "f1", // [RC] F1 help "noinfighting", @@ -496,6 +497,7 @@ MapHandlers[] = { MITYPE_COMPATFLAG, COMPATF_BOOMSCROLL}, { MITYPE_COMPATFLAG, COMPATF_INVISIBILITY}, { MITYPE_COMPATFLAG, COMPATF_SILENT_INSTANT_FLOORS}, + { MITYPE_COMPATFLAG, COMPATF_SECTORSOUNDS}, { MITYPE_LUMPNAME, lioffset(bordertexture), 0 }, { MITYPE_LUMPNAME, lioffset(f1), 0, }, { MITYPE_SCFLAGS, LEVEL_NOINFIGHTING, ~LEVEL_TOTALINFIGHTING }, diff --git a/src/m_options.cpp b/src/m_options.cpp index 537988ab5..42d859eff 100644 --- a/src/m_options.cpp +++ b/src/m_options.cpp @@ -1109,6 +1109,7 @@ static menuitem_t CompatibilityItems[] = { { bitflag, "Monsters see invisible players", {&compatflags}, {0}, {0}, {0}, {(value_t *)COMPATF_INVISIBILITY} }, { bitflag, "Boom scrollers are additive", {&compatflags}, {0}, {0}, {0}, {(value_t *)COMPATF_BOOMSCROLL} }, { bitflag, "Inst. moving floors are not silent", {&compatflags}, {0}, {0}, {0}, {(value_t *)COMPATF_SILENT_INSTANT_FLOORS} }, + { bitflag, "Sector sounds use center as source", {&compatflags}, {0}, {0}, {0}, {(value_t *)COMPATF_SECTORSOUNDS} }, { discrete, "Interpolate monster movement", {&nomonsterinterpolation}, {2.0}, {0.0}, {0.0}, {NoYes} }, }; diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 606b44704..c3104cd5b 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -4170,9 +4170,18 @@ int DLevelScript::RunScript () lookup = FBehavior::StaticLookupString (STACK(2)); if (lookup != NULL) { - S_Sound (activator, CHAN_AUTO, - lookup, - (float)(STACK(1)) / 127.f, ATTN_NORM); + if (activator != NULL) + { + S_Sound (activator, CHAN_AUTO, + lookup, + (float)(STACK(1)) / 127.f, ATTN_NORM); + } + else + { + S_Sound (CHAN_AUTO, + lookup, + (float)(STACK(1)) / 127.f, ATTN_NONE); + } } sp -= 2; break; diff --git a/src/s_sound.cpp b/src/s_sound.cpp index 66c7e4bbc..e8f09b405 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -714,17 +714,25 @@ static void CalcPosVel(int type, const AActor *actor, const sector_t *sector, static void CalcSectorSoundOrg(const sector_t *sec, int channum, fixed_t *x, fixed_t *y, fixed_t *z) { - // Are we inside the sector? If yes, the closest point is the one we're on. - if (P_PointInSector(*x, *y) == sec) + if (!(i_compatflags & COMPATF_SECTORSOUNDS)) { - *x = players[consoleplayer].camera->x; - *y = players[consoleplayer].camera->y; + // Are we inside the sector? If yes, the closest point is the one we're on. + if (P_PointInSector(*x, *y) == sec) + { + *x = players[consoleplayer].camera->x; + *y = players[consoleplayer].camera->y; + } + else + { + // Find the closest point on the sector's boundary lines and use + // that as the perceived origin of the sound. + sec->ClosestPoint(*x, *y, *x, *y); + } } else { - // Find the closest point on the sector's boundary lines and use - // that as the perceived origin of the sound. - sec->ClosestPoint(*x, *y, *x, *y); + *x = sec->soundorg[0]; + *y = sec->soundorg[1]; } // Set sound vertical position based on channel. @@ -1099,7 +1107,7 @@ void S_Sound (int channel, FSoundID sound_id, float volume, float attenuation) void S_Sound (AActor *ent, int channel, FSoundID sound_id, float volume, float attenuation) { - if (ent->Sector->Flags & SECF_SILENT) + if (ent == NULL || ent->Sector->Flags & SECF_SILENT) return; S_StartSound (ent, NULL, NULL, NULL, channel, sound_id, volume, attenuation); } diff --git a/src/stats.cpp b/src/stats.cpp index 07a027729..369829594 100644 --- a/src/stats.cpp +++ b/src/stats.cpp @@ -90,7 +90,8 @@ void FStat::ToggleStat () void FStat::PrintStat () { - int y = SCREENHEIGHT - SmallFont->GetHeight(); + int fontheight = ConFont->GetHeight() + 1; + int y = SCREENHEIGHT; int count = 0; screen->SetFont (ConFont); @@ -99,9 +100,18 @@ void FStat::PrintStat () if (stat->m_Active) { FString stattext(stat->GetStats()); - screen->DrawText (CR_GREEN, 5, y, stattext, TAG_DONE); - y -= SmallFont->GetHeight() + 1; - count++; + + if (stattext.Len() > 0) + { + y -= fontheight; // there's at least one line of text + for(unsigned i = 0; i < stattext.Len()-1; i++) + { + // Count number of linefeeds but ignore terminating ones. + if (stattext[i] == '\n') y -= fontheight; + } + screen->DrawText (CR_GREEN, 5, y, stattext, TAG_DONE); + count++; + } } } screen->SetFont (SmallFont);