View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002226 | FSSCP | turrets | public | 2010-06-18 07:12 | 2014-10-07 03:03 |
Reporter | Galemp | Assigned To | Goober5000 | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | unable to reproduce | ||
Product Version | 3.6.12 RC2 | ||||
Target Version | 3.7.2 | ||||
Summary | 0002226: Turrets without assigned weapon target as 'Beam Turret' | ||||
Description | I 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 Information | Whatever retail behavior was, let's do that. | ||||
Tags | No tags attached. | ||||
|
Here's the forum thread about this issue: http://www.hard-light.net/forums/index.php?topic=68288.0 |
|
Well did some testing on this and retail behavior is you can't target a turret that doesn't have a weapon assigned. |
|
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 |
|
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? |
|
Assigning to FUBAR since he tracked down the problematic line. |
|
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. |
2010-10-06 20:30
|
retail_compat_turret_target.patch (1,242 bytes)
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; |
|
Attached patch for this but still not sure how much stuff fixing it will break. |
|
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 |
|
|
|
|
|
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. |
|
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. |
Date Modified | Username | Field | Change |
---|---|---|---|
2010-06-18 07:12 | Galemp | New Issue | |
2010-06-20 21:59 | Goober5000 | Note Added: 0012096 | |
2010-10-06 00:13 | FUBAR-BDHR | Note Added: 0012384 | |
2010-10-06 01:48 | FUBAR-BDHR | Note Added: 0012385 | |
2010-10-06 01:48 | FUBAR-BDHR | Note Edited: 0012385 | |
2010-10-06 03:58 | Goober5000 | Note Added: 0012386 | |
2010-10-06 03:59 | Goober5000 | Status | new => assigned |
2010-10-06 03:59 | Goober5000 | Assigned To | => FUBAR-BDHR |
2010-10-06 03:59 | Goober5000 | Note Added: 0012387 | |
2010-10-06 04:28 | FUBAR-BDHR | Note Added: 0012389 | |
2010-10-06 20:30 | FUBAR-BDHR | File Added: retail_compat_turret_target.patch | |
2010-10-06 20:30 | FUBAR-BDHR | Note Added: 0012392 | |
2010-10-07 05:01 | Zacam | Note Added: 0012394 | |
2012-12-15 19:54 | MjnMixael | File Added: 2226.fs2 | |
2012-12-15 19:54 | MjnMixael | File Added: ships.tbl | |
2012-12-15 19:55 | MjnMixael | Note Added: 0014476 | |
2012-12-16 21:05 | Goober5000 | Assigned To | FUBAR-BDHR => Goober5000 |
2014-10-01 04:28 | Goober5000 | Target Version | => 3.7.2 |
2014-10-07 02:57 | Goober5000 | Note Added: 0016329 | |
2014-10-07 02:57 | Goober5000 | Status | assigned => closed |
2014-10-07 02:57 | Goober5000 | Resolution | open => unable to reproduce |
2014-10-07 03:03 | Goober5000 | Changeset attached | => fs2open trunk r11109 |