View Issue Details

IDProjectCategoryView StatusLast Update
0002945FSSCPnebulaspublic2014-06-20 23:09
ReporterAdmiralNelson Assigned ToMageKing17  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformWindowsOSWin 7OS Version64
Product Version3.7.0 
Summary0002945: No EMP/Lightning sound in debug mode
DescriptionUsing 3.7.0 or 3.7.1 debug I do not get any EMP effects or lightning sound effects in nebulae. Standard 3.7.0 or 3.7.1 builds have the expected behavior.
Steps To Reproduce1. Select 3.7.0/3.7.1 debug in wxLauncher
2. Choose 'No Mod'
3. Start 'As Lightning Fall' mission
4. Note no EMP/no lightning noise
TagsNo tags attached.

Relationships

related to 0003067 resolvedMageKing17 Nebula flashing not following player view point 

Activities

chief1983

2013-10-28 03:32

administrator   ~0015364

I believe this is actually a known issue/limitation of debug builds, although perhaps less known than it used to be. Or I'm just imagining this, but I swear I've heard of this problem before.

chief1983

2013-10-28 03:39

administrator   ~0015365

I can't find much on the forums other than this thread: http://www.hard-light.net/forums/index.php?topic=77889.msg1543193#msg1543193 in which someone mentions that lightning sounds are disabled in debug builds.

niffiwan

2013-10-28 10:45

developer   ~0015368

Well this is odd - just tested with r9986 DEBUG and I get EMP & lighting sounds in 'As Lightning Fall'. I'm running Linux, so that may affect it? Also, which OpenAL were you using, Creative OpenAL or OpenAL Soft?

AdmiralNelson

2013-10-28 12:36

reporter   ~0015369

I tried both openAL version initially. Just put in r9986, same result. I don't think any of the 'nebula' features work (EMP, radar range, etc)

niffiwan

2013-10-30 02:25

developer   ~0015373

Just wondering, is it just the sound that is missing, or are all the lightning and EMP visual effects also missing?

AdmiralNelson

2013-10-30 15:21

reporter   ~0015374

I see lightning effect, but EMP effects such as HUD scrambling are missing.

Wanderer

2013-11-23 16:01

developer   ~0015460

Just my personal opinion but if this is changed then IMO it should be something that could be toggled on or off (possibly via cheat codes ?). Trying to locate a bug or something with EMP effects going on just sounds rather annoying.

Zacam

2014-03-02 23:16

administrator   ~0015634

I'm most likely going to flag this as a "won't fix" unless somebody can offer a compelling reason elsewise.

Nebula EMP/Storm effects have never to my memory ever affected Debug builds and to be perfectly honest, I don't think they should. I get that it's jarring that the SFX have now also decided to take a hiatus, but debug builds are not "playing" builds, they for hunting down issues or validating a mission before using a standard build to actually play.

Goober5000

2014-03-31 15:50

administrator   ~0015693

I agree with Zacam, but I just took a look at the code and I don't see an explicit disabling of EMP effects in debug builds. Stuff like HUD scrambling shouldn't be affected by the sound code.

Before we close this bug, someone should trace through the debug build and see why EMP effects are not being played.

MageKing17

2014-06-16 13:05

developer   ~0015881

I just took a look into this and found that if you comment out the screen position conditionals in code/nebula/neblightning.cpp at lines 966 and 1013 (leaving three interior lines at 971 and 1018), debug builds get the screen flashes (and lightning sounds, and EMP effects; they're under the same conditional as the screen flash).

I'm not sure why those conditionals are always returning false, but only under debug builds.

MageKing17

2014-06-17 06:56

developer  

2945.patch (1,271 bytes)   
Index: code/nebula/neblightning.cpp
===================================================================
--- code/nebula/neblightning.cpp	(revision 10824)
+++ code/nebula/neblightning.cpp	(working copy)
@@ -1010,13 +1010,13 @@
 			g3_project_vertex(&cap->vex[idx]);			
 
 			// if first frame, keep track of the average screen pos			
-			if( (c->vex[idx].screen.xyw.x >= 0)
-				&& (c->vex[idx].screen.xyw.x < gr_screen.max_w)
-				&& (c->vex[idx].screen.xyw.y >= 0)
-				&& (c->vex[idx].screen.xyw.y < gr_screen.max_h))
+			if( (cap->vex[idx].screen.xyw.x >= 0)
+				&& (cap->vex[idx].screen.xyw.x < gr_screen.max_w)
+				&& (cap->vex[idx].screen.xyw.y >= 0)
+				&& (cap->vex[idx].screen.xyw.y < gr_screen.max_h))
 			{
-				Nebl_flash_x += c->vex[idx].screen.xyw.x;
-				Nebl_flash_y += c->vex[idx].screen.xyw.y;
+				Nebl_flash_x += cap->vex[idx].screen.xyw.x;
+				Nebl_flash_y += cap->vex[idx].screen.xyw.y;
 				Nebl_flash_count++;
 			}
 		}
Index: code/render/3dmath.cpp
===================================================================
--- code/render/3dmath.cpp	(revision 10824)
+++ code/render/3dmath.cpp	(working copy)
@@ -86,7 +86,7 @@
 	dest->world = *src;
 
 	dest->codes = 0;
-	dest->flags |= PF_PROJECTED;
+	dest->flags = 0;
 
 	return 0;
 }
2945.patch (1,271 bytes)   

MageKing17

2014-06-17 06:56

developer   ~0015889

Okay, digging a little deeper, I've found that if you memset() all l_section objects to 0 immediately after they're initialized... well, if you do nothing else, it "seems" to fix nebula lightning in debug (which is to say, you see flashes and hear the noises and get EMP'd). If you then change the (c->vex[idx].screen.xyw.x >= 0) checks to be "> 0" checks instead, both release and debug stop flashing the screen (and playing lightning sounds and EMP-ing the player because, as I mentioned in my previous note, they fall under the "screen flash" conditional).

Here's my best guess for what's been going on (since I can't get usable data out of VS Express 2013's debugger :/ ):

- l_structure is being initialized with junk data (in both release and debug, but whatever debug's initializing with makes c->vex[idx].screen show as "off screen" while whatever release's initializing with does not (at least some of the time, anyway)).
- g3_transfer_vertex() sets the PF_PROJECTED flag, making g3_project_vertex() do absolutely nothing.
- The conditionals are therefore checking this initialized junk data, resulting in screen flashes in release builds and nothing at all in debug builds, but these flashes have nothing whatsoever to do with the actual coordinates of the lightning.

The lowest-impact fix would seem to be to change g3_transfer_vertex() to clear flags (like g3_rotate_vertex()) instead of setting PF_PROJECTED (this logic error would seem to have been present since g3_transfer_vertex() was added in SVN revision 709; it wasn't a problem with nebula lightning until SVN revision 956, which started using g3_transfer_vertex() for HTL).

While I was at it, I noticed that the conditional at line 1013 should refer to "cap", not "c", so that's fixed in this patch as well.

niffiwan

2014-06-19 02:21

developer   ~0015894

Patch looks good to me. Tested in Linux release & debug and they still work as expected. I'll commit later tonight if no one else gets to it 1st.

niffiwan

2014-06-19 09:04

developer   ~0015895

Fix committed to trunk@10828.

Related Changesets

fs2open: trunk r10828

2014-06-19 05:24

niffiwan


Ported: N/A

Details Diff
Fix mantis 2945 (From MageKing17)

Don't set PF_PROJECTED in g3_transfer_vertex() as it's not projecting
the vertex
Note: displaying nebula emp/lightning used to depend on unitialised data!
Affected Issues
0002945
mod - /trunk/fs2_open/code/nebula/neblightning.cpp Diff File
mod - /trunk/fs2_open/code/render/3dmath.cpp Diff File

Issue History

Date Modified Username Field Change
2013-10-27 23:35 AdmiralNelson New Issue
2013-10-28 03:32 chief1983 Note Added: 0015364
2013-10-28 03:39 chief1983 Note Added: 0015365
2013-10-28 10:45 niffiwan Note Added: 0015368
2013-10-28 12:36 AdmiralNelson Note Added: 0015369
2013-10-30 02:25 niffiwan Note Added: 0015373
2013-10-30 15:21 AdmiralNelson Note Added: 0015374
2013-11-23 16:01 Wanderer Note Added: 0015460
2014-03-02 23:16 Zacam Note Added: 0015634
2014-03-31 15:50 Goober5000 Note Added: 0015693
2014-06-16 13:05 MageKing17 Note Added: 0015881
2014-06-17 06:56 MageKing17 File Added: 2945.patch
2014-06-17 06:56 MageKing17 Assigned To => MageKing17
2014-06-17 06:56 MageKing17 Status new => assigned
2014-06-17 06:56 MageKing17 Note Added: 0015889
2014-06-17 06:56 MageKing17 Status assigned => code review
2014-06-19 02:21 niffiwan Note Added: 0015894
2014-06-19 09:04 niffiwan Changeset attached => fs2open trunk r10828
2014-06-19 09:04 niffiwan Note Added: 0015895
2014-06-19 09:04 niffiwan Status code review => resolved
2014-06-19 09:04 niffiwan Resolution open => fixed
2014-06-20 23:09 MageKing17 Relationship added related to 0003067