2018-06-25 14:35 EDT


View Issue Details Jump to Notes ] Related Changesets ]
IDProjectCategoryView StatusLast Update
0002226FSSCPturretspublic2014-10-06 23:03
ReporterGalemp 
Assigned ToGoober5000 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionunable to reproduce 
Product Version3.6.12 RC2 
Target Version3.7.2Fixed in Version 
Summary0002226: Turrets without assigned weapon target as 'Beam Turret'
DescriptionI have reproduced this in FreeSpace Port but I believe it is present using retail data. Try targeting the Ma'at (Vasudan Freighter 2) in FSPort mission 3, Small Deadly Space. By design, one of the turrets has no weapon assigned to it; the turret targets as 'Beam Turret.'
Additional InformationWhatever retail behavior was, let's do that.
TagsNo tags attached.
Attached Files
  • patch file icon retail_compat_turret_target.patch (1,242 bytes) 2010-10-06 16:30 -
    Index: hud/hudtarget.cpp
    ===================================================================
    --- hud/hudtarget.cpp	(revision 6575)
    +++ hud/hudtarget.cpp	(working copy)
    @@ -1777,8 +1777,18 @@
     	for (A=GET_FIRST(&target_shipp->subsys_list); A!=END_OF_LIST(&target_shipp->subsys_list); A=GET_NEXT(A))  {
     		// get a turret
     		if (A->system_info->type == SUBSYSTEM_TURRET) {
    -			// check turret has hit points and has a weapon
    -			if ( (A->current_hits > 0) && (A->weapons.num_primary_banks > 0 || A->weapons.num_secondary_banks > 0) ) {
    +			// turret banks wihtout a weapon assigned don't count in targeting so we need to check for weapons assigned
    +			int banks_with_weapons = 0;
    +			for (int i=0; i < A->weapons.num_primary_banks; i++) {
    +				if (A->weapons.primary_bank_weapons[i] >= 0)
    +					banks_with_weapons++;
    +			}
    +			for (int i=0; i < A->weapons.num_secondary_banks; i++) {
    +				if (A->weapons.secondary_bank_weapons[i] >= 0)
    +					banks_with_weapons++;
    +			}
    +			// check turret has hit points and has a weapon				
    +			if ( (A->current_hits > 0) && (banks_with_weapons > 0) ) {
     				if ( !only_player_target || (A->turret_enemy_objnum == OBJ_INDEX(Player_obj)) ) {
     					vec3d gsubpos, vec_to_subsys;
     					float distance, dot;
    
    patch file icon retail_compat_turret_target.patch (1,242 bytes) 2010-10-06 16:30 +
  • ? file icon 2226.fs2 (5,820 bytes) 2012-12-15 14:54
  • ? file icon ships.tbl (383,624 bytes) 2012-12-15 14:54

-Relationships
+Relationships

-Notes

~0012096

Goober5000 (administrator)

Here's the forum thread about this issue:
http://www.hard-light.net/forums/index.php?topic=68288.0

~0012384

FUBAR-BDHR (developer)

Well did some testing on this and retail behavior is you can't target a turret that doesn't have a weapon assigned.

~0012385

FUBAR-BDHR (developer)

Last edited: 2010-10-05 21:48

Looks like this goes clear back to r1601 where this:

    if ( (A->current_hits > 0) && (A->system_info->turret_weapon_type >= 0) ) {

was changed to this:

    if ( (A->current_hits > 0) && (A->system_info->primary_banks[0] >= 0 || A->system_info->secondary_banks[0] >= 0) ) {

in a couple of places. I have no way of compiling something that old to test though.

That's in hudtarget.cpp

~0012386

Goober5000 (administrator)

That >= should be a >. It was fixed a few lines down, later on. I've fixed the first line. Can you test it to see if it fixes the problem?

~0012387

Goober5000 (administrator)

Assigning to FUBAR since he tracked down the problematic line.

~0012389

FUBAR-BDHR (developer)

No good. Those values for primary and secondary are always set to the number of banks not if they actually contain anything. So in the test case even with no weapon assigned primary_banks are still 1 as it's one bank with no weapon.

~0012392

FUBAR-BDHR (developer)

Attached patch for this but still not sure how much stuff fixing it will break.

~0012394

Zacam (administrator)

For completeness sake, posting my forum reply here:

While it may have been Retail behaviour to not allow targeting an empty turret, there is the weapon change sexp to think about.

You would either have to change the sexp to do a refresh to allow targeting of a changed turret, or (probably easier) instead of having it say "Beam Turret" have it just say "Empty Turret".

As for Retail Compatibility, no mission goals or events would be invalidated (that I can think of) from destroying an empty turret (which we've already been able to do since 2005 anyway) so since it's broken now any way in a fashion that makes it more of a feature, either edit the change weapon sexp to suit, or just have it class empty turrets as such when they are targeted

~0014476

MjnMixael (manager)

Turrets without weapons are untargetable on current builds. Use the attached mission and ships.tbl to show that. Not sure what the next steps are on this, though.

~0016329

Goober5000 (administrator)

Actually, the problem lies with turrets that are tabled to have weapons but that are unassigned weapons in the actual mission. So the ships.tbl test data is inapplicable (though I appreciate the help).

Even so, the 2014 state of SVN has empty turrets just display as "Turret" rather than "Beam turret" or anything unexpected. I looked at the SVN log and can't see any relevant change between 2010 and 2012 that would have affected this.

I'm therefore closing this as "Unable to reproduce". However I have an SVN change incoming that will make this function work a bit better.
+Notes

+Related Changesets

-Issue History
Date Modified Username Field Change
2010-06-18 03:12 Galemp New Issue
2010-06-20 17:59 Goober5000 Note Added: 0012096
2010-10-05 20:13 FUBAR-BDHR Note Added: 0012384
2010-10-05 21:48 FUBAR-BDHR Note Added: 0012385
2010-10-05 21:48 FUBAR-BDHR Note Edited: 0012385
2010-10-05 23:58 Goober5000 Note Added: 0012386
2010-10-05 23:59 Goober5000 Status new => assigned
2010-10-05 23:59 Goober5000 Assigned To => FUBAR-BDHR
2010-10-05 23:59 Goober5000 Note Added: 0012387
2010-10-06 00:28 FUBAR-BDHR Note Added: 0012389
2010-10-06 16:30 FUBAR-BDHR File Added: retail_compat_turret_target.patch
2010-10-06 16:30 FUBAR-BDHR Note Added: 0012392
2010-10-07 01:01 Zacam Note Added: 0012394
2012-12-15 14:54 MjnMixael File Added: 2226.fs2
2012-12-15 14:54 MjnMixael File Added: ships.tbl
2012-12-15 14:55 MjnMixael Note Added: 0014476
2012-12-16 16:05 Goober5000 Assigned To FUBAR-BDHR => Goober5000
2014-10-01 00:28 Goober5000 Target Version => 3.7.2
2014-10-06 22:57 Goober5000 Note Added: 0016329
2014-10-06 22:57 Goober5000 Status assigned => closed
2014-10-06 22:57 Goober5000 Resolution open => unable to reproduce
2014-10-06 23:03 Goober5000 Changeset attached => fs2open trunk r11109
+Issue History