Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Goober5000 on December 03, 2002, 05:09:30 pm

Title: WOOT! Beam-free-all-by-default mission flag!
Post by: Goober5000 on December 03, 2002, 05:09:30 pm
I updated missionparse.cpp and missionparse.h to incorporate a beam-free-all-by-default mission flag.  Missions with this flag will load up with all capital ships having all of their turrets beam-free'd. :cool: No FRED2 update, but you can easily convert all your missions by adding 128 to the value next to the +Flags: option in your .FS2 file. :)

EDIT: It was surprisingly easy, too - I'm rather surprised no one investigated it before.  All I had to do was steal the beam-free-all code from sexp.cpp and run it for every ship that was loaded into the mission. :)

I've also added an anti-frustration beam-lock-all to run whenever a ship is destroyed, but this needed to go in ship.cpp.  Since I'm still messing around with ship.cpp for my ballistic primary conversion, I didn't commit it yet.
Title: WOOT! Beam-free-all-by-default!
Post by: Galemp on December 03, 2002, 05:13:06 pm
Ack. We've been over this before; having it on by default would break backwards compatibility. What we want is a simple checkbox in the ship properties to beam free it, instead of using SEXPs.
Title: WOOT! Beam-free-all-by-default!
Post by: Goober5000 on December 03, 2002, 05:14:27 pm
No, no, no - that's exactly what I did - except that the checkbox goes in the Mission Specs dialog instead of the ship dialog. (I would never want to break backwards compatibility.) The default default is to have the beams locked.  By adding the "beam-free-all-by-default" mission flag, the beams become automatically freed by default.  You have to specify the flag on a per-mission basis.

Does that make sense? :) It works the same way as the "support-ships-repair-hull" flag.
Title: WOOT! Beam-free-all-by-default!
Post by: RandomTiger on December 03, 2002, 05:25:07 pm
Quote
Originally posted by Goober5000
No, no, no - that's exactly what I did - except that the checkbox goes in the Mission Specs dialog instead of the ship dialog. (I would never want to break backwards compatibility.) The default default is to have the beams locked.  By adding the "beam-free-all-by-default" mission flag, the beams become automatically freed by default.  You have to specify the flag on a per-mission basis.

Does that make sense? :) It works the same way as the "support-ships-repair-hull" flag.


If you have done it right, well done.
Title: WOOT! Beam-free-all-by-default!
Post by: Sesquipedalian on December 03, 2002, 05:25:43 pm
Quote
Originally posted by Goober5000
second post
Ah.  Very good then.
Title: WOOT! Beam-free-all-by-default!
Post by: Galemp on December 03, 2002, 05:46:07 pm
Oh, I see. MUCH better. :):yes:
Title: WOOT! Beam-free-all-by-default!
Post by: EdrickV on December 03, 2002, 06:14:15 pm
Assuming it works (And I'm sure you tested it before comitting it) then all we need is someone to add a checkbox and code for it in FRED2. One thing though, what happens if you try to run a mission with this flag using the original exe? (I probably would have added an entry after flags to be read with optional string rather then modify the existing flag stuff. The extra entry should be ignored by the original exe.)
Title: WOOT! Beam-free-all-by-default!
Post by: Goober5000 on December 03, 2002, 06:28:45 pm
It works - I checked. :) As for working with the original EXE, I see no reason why it wouldn't.  This addition simply checks to see if there is a 2^7 bit included in the mission flag, and if it is, it runs through the beam-free-all stuff.  The original EXE doesn't check for this bit, so it ought to work just fine.

...except that you wouldn't want to run this with the original EXE anyhow, because it wouldn't recognize the beam-free-all flag and so none of your ships would be beam-freed. :)
Title: WOOT! Beam-free-all-by-default!
Post by: EdrickV on December 03, 2002, 06:54:34 pm
Dang, didn't know there were any flag bits (for anything) that weren't being used. :) And a value of 128 (for a mission that originally had 0 for flags) doesn't crash the original exe, which is good and bad. It means people wouldn't know that the mission's not working right, but on the other hand it doesn't look like the mission/FS2 is screwed up. Any missions built to use this feature would have to note that they require fs2_open version x or later. (Where x would probably be 3.4.) The method you chose is a lot easier then at least one of the methods previously discussed. (Which would have been an option thing that, when checked, would have FRED2 generate the needed beam-free-all SEXP code for the mission when it's saved.)

Hmm, another thing I just thought of, does the code work for ships that haven't entered the mission yet? (Normally you have to do beam-free-all once the ship has entered.) And does it work for ships in the second/third/etc. wave, not just the first? (This isn't a big thing for cap ships, but for fighters with beams it could make a difference.)
Title: WOOT! Beam-free-all-by-default!
Post by: mikhael on December 03, 2002, 07:11:54 pm
Quote
Originally posted by EdrickV
It means people wouldn't know that the mission's not working right, but on the other hand it doesn't look like the mission/FS2 is screwed up. Any missions built to use this feature would have to note that they require fs2_open version x or later.


This would have to be done anyway. If someone makes a mission that uses an FS2_Open feature, nine times out of ten its going to generate bogons and blue smoke when loaded into the original FS2. You can (and should) ensure that  FS2_open loads FS2 original missions, but you can't ever expect FS2 to open FS2_Open missions properly.
Title: WOOT! Beam-free-all-by-default!
Post by: Inquisitor on December 03, 2002, 09:17:18 pm
Committ it, we'll make a test exe and see what happens.

If it's fubar, I'll just roll it back :)
Title: WOOT! Beam-free-all-by-default!
Post by: Goober5000 on December 03, 2002, 11:38:41 pm
It's committed and works fine on my machine. :)

As for the flag - keep in mind that since +Flags: is a bitfield, 128 is simply ORed to the existing flag.  In practical terms this simply means add 128.  The flag value doesn't necessarily need to equal 128.

Quote
Originally posted by EdrickV
Hmm, another thing I just thought of, does the code work for ships that haven't entered the mission yet? (Normally you have to do beam-free-all once the ship has entered.) And does it work for ships in the second/third/etc. wave, not just the first? (This isn't a big thing for cap ships, but for fighters with beams it could make a difference.)


The code is in the mission parsing routine, which means that upon loading the mission, the parser sets the default status of every ship to beam-free-all.  This should work with ships that haven't arrived yet as well as ships that start out in the mission.

As for whether it works for waves - I honestly don't know.  I can think of reasons why it could go either way.  If each successive wave of ships are simply duplicate instances of the original ships, it ought to work, because it will duplicate the beam-free-all flag along with everything else.  But this may not be the case.  The only way to know for sure is to load it up and test it. :) I'll generously leave this task to someone else, as I'll have a boatload of exam work over the next few days. :D
Title: WOOT! Beam-free-all-by-default!
Post by: Joey_21 on December 04, 2002, 11:44:37 am
:yes: Good work. :nod:

One of the exact things I've been waiting for.
Title: WOOT! Beam-free-all-by-default!
Post by: Kazan on December 04, 2002, 01:03:48 pm
i can forsee this contributing to Battle Of Endor syndrome


but it kicks ass anyway :P
Title: WOOT! Beam-free-all-by-default!
Post by: mikhael on December 04, 2002, 01:30:58 pm
Quote
Originally posted by Kazan
... Battle Of Endor syndrome...

What's that?
Title: WOOT! Beam-free-all-by-default!
Post by: Kazan on December 04, 2002, 01:43:56 pm
2638 posts and you don't know what battle of endor syndrome is? lol


that's where you put WAAAY TO DAMN MANY cap ships in a mission
Title: WOOT! Beam-free-all-by-default!
Post by: Bobboau on December 04, 2002, 02:11:32 pm
one Sathanus is good, twenty must be better :)
Title: WOOT! Beam-free-all-by-default!
Post by: mikhael on December 04, 2002, 02:17:19 pm
Quote
Originally posted by Kazan

that's where you put WAAAY TO DAMN MANY cap ships in a mission


I was envisioning the vast swarm of millions of TIEs seen from the bridge of the Falcon, actually. I hadn't even given a thought to capships yet.

The first time I'd even hear the phrase was a few days ago. I guess I don't read the threads you do.
Title: WOOT! Beam-free-all-by-default!
Post by: Bobboau on December 04, 2002, 02:20:29 pm
it's been in fred termonology for years, so I gues you comeing more from the Iwar sect wouldn't have been exposed to it quite as much
Title: WOOT! Beam-free-all-by-default!
Post by: Petrarch of the VBB on December 04, 2002, 02:30:18 pm
There is one symbol for this revelation of beamage:;7
Title: WOOT! Beam-free-all-by-default!
Post by: Goober5000 on December 04, 2002, 02:54:46 pm
I just realized...

It's going to be impossible to test this with ship waves until someone fixes the ModelRead.cpp error.

http://www.hard-light.net/forums/index.php/topic,11843.0.html

Somebody fix it!  Please? :)