r1069 Crash with QNA (sound?)

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: r1069 Crash with QNA (sound?)

Re: r1069 Crash with QNA (sound?)

by Graf Zahl » Sat Jul 12, 2008 1:32 am

Fixed

Re: r1069 Crash with QNA (sound?)

by randi » Thu Jul 10, 2008 12:43 pm

Hence the reason I wrote:
randy wrote:Assuming the instances where S_Sound is passed a user-specified actor are limited, I think it would be better to add NULL checks to those spots

Re: r1069 Crash with QNA (sound?)

by Graf Zahl » Thu Jul 10, 2008 12:16 pm

But then the ACS function needs to be changed - because there's inevitably some WADs that expect this behavior to remain.

Re: r1069 Crash with QNA (sound?)

by randi » Thu Jul 10, 2008 12:13 pm

I don't consider passing a NULL actor a valid way to produce a global sound anymore, since there is an emitter-less version of the function for just that purpose. Assuming the instances where S_Sound is passed a user-specified actor are limited, I think it would be better to add NULL checks to those spots and keep S_Sound silent when passed a NULL actor, for the sake of having a less redundant interface to the sound system.

Re: r1069 Crash with QNA (sound?)

by Ghastly » Thu Jul 10, 2008 11:53 am

Would a fix for this work with the other activator-based sounds? I was going to change ActivatorSound to LocalAmbientSound (Other players shouldn't be able to hear it, since players could use it to spam sounds).

Re: r1069 Crash with QNA (sound?)

by Graf Zahl » Thu Jul 10, 2008 6:41 am

Nope. With a NULL activator the sound must be made global.

Re: r1069 Crash with QNA (sound?)

by Gez » Thu Jul 10, 2008 6:22 am

Yeah, but the real bug isn't in the script. Pointers should always be checked for NULLdom.

Code: Select all

//==========================================================================
//
// S_Sound - An actor is source
//
//==========================================================================

void S_Sound (AActor *ent, int channel, FSoundID sound_id, float volume, float attenuation)
{
   if (!ent || (ent->Sector->Flags & SECF_SILENT))
      return;
   S_StartSound (ent, NULL, NULL, NULL, channel, sound_id, volume, attenuation);
}
With such a change, the function does nothing if ent equals NULL or if ent points to an existing actor which is in a silent sector. Otherwise (ent is not null but points to a n actor in a sector which isn't silent), it calls S_StartSound.

Re: r1069 Crash with QNA (sound?)

by Enjay » Thu Jul 10, 2008 6:06 am

I think this is it. Script 310 is run by script 23, an open script. Script 310 has the line "ActivatorSound("NewObjective", 127);" and if I comment it out, the crash no longer happens. Presumably the "activator" for the "ActivatorSound" cannot be the world, which, again presumably, it is in this case because of the open script calling script 310.

Code: Select all

//Objective script
script 310 (void) Net
{   
	If ( GameType() == Game_Net_DeathMatch )
		{
		}
	Else
		{
		ActivatorSound("NewObjective", 127);
		SetFont("MAP1GOAL");
		SetHudSize(1024, 768, 0);
		HudMessage(s:"A"; HUDMSG_FADEOUT, 0, 0, 865.0, 160.0, 3.5, 0.5);
		}
}

//Exit Perimeter Defense Station and proceed to Strogg Medical Facility, eliminate all resistance

Script 23 OPEN
{
	ACS_Execute (310, 0, 0, 0, 0);
}

Re: r1069 Crash with QNA (sound?)

by Graf Zahl » Thu Jul 10, 2008 1:13 am

From a quick look my guess would be an ACS ActivatorSound with a NULL activator. I have no time to investigate it right now though.

r1069 Crash with QNA (sound?)

by Enjay » Wed Jul 09, 2008 8:20 pm

With the "Quake: Nexus Aftermath" demo from this thread,
http://forum.zdoom.org/viewtopic.php?f= ... a&start=15

Zdoom r1069 and GZdoom r131 crash shortly after starting a game for me. I load up Zdoom with the file loaded, pick a player class then start a game and shortly afterwards, Zdoom crashes.

I made a debug build and here's what I got. It seems to be pointing at something in the sound code?
Spoiler:
s_sound.cpp was loaded by the debugger and the little yellow arrow was beside this bit:

Code: Select all

//==========================================================================
//
// S_Sound - An actor is source
//
//==========================================================================

void S_Sound (AActor *ent, int channel, FSoundID sound_id, float volume, float attenuation)
{
	if (ent->Sector->Flags & SECF_SILENT)
		return;
	S_StartSound (ent, NULL, NULL, NULL, channel, sound_id, volume, attenuation);
}
Specifically

Code: Select all

if (ent->Sector->Flags & SECF_SILENT)

Top