Author Topic: Assert: "n >= 0" File: bmpman.cpp Line: 748 in WCSOpen  (Read 1513 times)

0 Members and 1 Guest are viewing this topic.

Assert: "n >= 0" File: bmpman.cpp Line: 748 in WCSOpen
Whenever a fighter explodes with the -fb_explosions flag set in WCSO it causes this assertion. If the -3Dshockwave flag is set it will happen only on the 2nd mission loaded or when a mission is restarted, the first run will be fine.
If the -3Dshockwave flag isn't set it will happen on the first load.

Replacing the custom shockwave assets with MediaVPs ones seems to make no difference. Removing the shockwave name entry from the ships.tbl seems to make no difference. Some help on demystifying this would be highly appreciated.

I was running On the June 5th nightly fastdebug, but this was happening on June 2 as well.

I'm attaching a debug log from the crash as well as a very simple test mission. It will, obviously, require WCSOpen.




[attachment stolen by Russian hackers]
« Last Edit: June 05, 2017, 03:19:02 pm by FrikgFeek »
[19:31] <MatthTheGeek> you all high up on your mointain looking down at everyone who doesn't beam everything on insane blindfolded

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: Assert: "n >= 0" File: bmpman.cpp Line: 748 in WCSOpen
Quote from: MageKing17
TIL the entire homing shockwave code is held up with shoestrings hope and duct tape wishes, basically.
Which is to say, it isn't held up at all. Framebuffer shockwaves just... don't really work. Unless you're using 3D shockwaves, and only play one mission at a time. Or you define and use (in every mission) custom 2D shockwaves, that might also work.

Point is, my earlier fix of the shockwave code's wonky handling of vectors only fixed a specific issue and now it looks like I'll have to rewrite a significant chunk of it to fix this problem.
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: Assert: "n >= 0" File: bmpman.cpp Line: 748 in WCSOpen
Okay, so after further investigation it turns out I overlooked that 2D shockwaves have their own code branch for using their own bitmap for the distortion, so they worked fine. It's just 3D shockwaves that cause this problem... however, even if the 3D shockwave command-line flag isn't used, custom 3D shockwaves can still be defined, and if one winds up loaded before any custom 2D shockwaves, you'd hit this assertion (because it tries to find out how many frames are in a nonexistant animation).

I've opened a PR to fix this problem by simply keeping track of which index the default 2D shockwave got loaded into and, equally as importantly, making sure that if both the 3D and 2D default shockwaves are loaded, the 2D one doesn't get unloaded at the end of the first mission played in a session.
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 

Offline Admiral Nelson

  • Resurrecter of Campaigns
  • 211
  • The GTA expects that every man will do his duty.
Re: Assert: "n >= 0" File: bmpman.cpp Line: 748 in WCSOpen
Error seems squashed now.  Thanks! :yes:
If a man consults whether he is to fight, when he has the power in his own hands, it is certain that his opinion is against fighting.