2018-03-23 15:22 EDT

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002169FSSCPgameplaypublic2010-12-13 02:33
Assigned ToGoober5000 
Product Version 
Target VersionFixed in Version 
Summary0002169: Stealth fighters do not have the stealth flag set in FRED
DescriptionCreate a new mission in FRED. Place a stealthy ship, such as the Pegasus. Go into the ship flags editor... the stealth flag is not set.
TagsNo tags attached.
Attached Files
  • patch file icon 2169.patch (889 bytes) 2010-12-09 17:26 -
    Index: code/ship/ship.cpp
    --- code/ship/ship.cpp	(revision 6813)
    +++ code/ship/ship.cpp	(working copy)
    @@ -4737,6 +4737,11 @@
     	shipp->armor_type_idx = sip->armor_type_idx;
     	shipp->shield_armor_type_idx = sip->shield_armor_type_idx;
    +	//Stealth business
    +	if (sip->flags & SIF_STEALTH) {
    +		shipp->flags2 |= SF2_STEALTH;
    +	}
     // function which recalculates the overall strength of subsystems.  Needed because
    @@ -8545,6 +8550,11 @@
    +	// If the new class is stealthy, make this ship stealthy as well
    +	if (sip->flags & SIF_STEALTH) {
    +		sp->flags2 |= SF2_STEALTH;
    +	}
     	// Reset physics to previous values
     	if (by_sexp) {
     		Objects[sp->objnum].phys_info.desired_rotvel = ph_inf.desired_rotvel;
    patch file icon 2169.patch (889 bytes) 2010-12-09 17:26 +




The_E (administrator)

Now, the real issue here is that the code sort of ignores SIF_STEALTH completely. It's parsed in ships.cpp, but the rest of the code only looks at the ship flag (SF2_STEALTH) to see if a ship is supposed to be stealthy. This is per design, as any ship might be designated stealthy in FRED, but it also makes the ships.tbl flag completely useless.

The attached patch fixes this, but it opens up another can of worms. For one, ships tabled as being stealth will actually _be_ stealthy now, even if a mission designer has not checked the requisite flag in FRED. This may have unintended consequences.


Goober5000 (administrator)

Whoa, wait a minute. This bug isn't even supposed to exist. See missionparse.cpp, line 2800:

    // set certain flags that used to be in ship_info - Goober5000
    if (Ship_info[p_objp->ship_class].flags & SIF_STEALTH)
        p_objp->flags |= P_SF2_STEALTH;
    if (Ship_info[p_objp->ship_class].flags & SIF_SHIP_CLASS_DONT_COLLIDE_INVIS)
        p_objp->flags |= P_SF2_DONT_COLLIDE_INVIS;

All ships that are tabled as stealthy in ships.tbl should *also* appear as stealthy in FRED. I think this is exclusively a FRED bug, because AFAIK stealth ships work properly in FSO.

And note that your "can of worms" is actually the other way around. Stealth was always a class-specific flag in retail FS2; it wasn't until FSO came along that it became a ship-specific flag. So ships tabled as stealthy (e.g. Pegasus, Ptah) *should be stealthy*, and if not, we have problems.


The_E (administrator)

And yet, it does exist. The problem, I think, is that parse_object() is only called when parsing a mission (If you save the mission and load it again, the stealth flag is checked correctly). However, when adding a ship or changing the ship class in the ships editor, the code goes through ship_set() and ship_change_class() respectively, neither of which will transfer the stealth flag correctly.


Goober5000 (administrator)

Tested and committed in 6847.

-Issue History
Date Modified Username Field Change
2010-03-30 23:16 Goober5000 New Issue
2010-12-09 17:26 The_E File Added: 2169.patch
2010-12-09 17:27 The_E Note Added: 0012525
2010-12-10 03:47 Goober5000 Note Added: 0012532
2010-12-10 09:35 The_E Note Added: 0012533
2010-12-13 02:33 Goober5000 Note Added: 0012550
2010-12-13 02:33 Goober5000 Assigned To => Goober5000
2010-12-13 02:33 Goober5000 Status new => resolved
2010-12-13 02:33 Goober5000 Resolution open => fixed
+Issue History