- 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.


SVN r1070 (trunk)
This commit is contained in:
Christoph Oelckers 2008-07-12 08:16:19 +00:00
parent 87d7b3601a
commit d0031b7fe7
8 changed files with 57 additions and 16 deletions

View file

@ -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.

View file

@ -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);
//==========================================================================
//

View file

@ -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:

View file

@ -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 },

View file

@ -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} },
};

View file

@ -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;

View file

@ -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);
}

View file

@ -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);