2018-09-22 21:33 EDT


View Issue Details Jump to Notes ] Related Changesets ]
IDProjectCategoryView StatusLast Update
0002804FSSCPbeamspublic2014-09-26 22:20
ReporterSpoon 
Assigned Toniffiwan 
PriorityhighSeverityfeatureReproducibilityalways
StatusresolvedResolutionfixed 
Product Version3.6.19 
Target VersionFixed in Version 
Summary0002804: Beam damage is unaffected by Armor/Shield/Subsystem factor
DescriptionAs it says on the tin, a (player ship fighter, I haven't actually confirmed if this is also the case for turreted weapons, but I *assume* it is.) beam weapon will always deal its full 1x damage to anything it hits. It completely ignores any of the $Armor Factor and such.

I'd love it if beams would be affected by the Factors so we can get a bit more creative with beams. And to avoid breaking any backwards compatibility or whatnot, make it a game_settings.tbl flag.
TagsNo tags attached.
Attached Files
  • patch file icon mantis2804.patch (4,104 bytes) 2014-08-25 06:49 -
    commit b509a5b4ca5cbad1c2b0dfe23da2871ff69f2501
    Author: niffiwan <niffiwan.scp@gmail.com>
    Date:   Mon Aug 25 19:56:00 2014 +1000
    
        Fix mantis 2804: beams can now use factors
        
        Add game_setting.tbl option that allows beams to use tabled
        Armor/Shield/Subsystem factor values
        Contains extra debug code that'll be removed before its added to trunk
    
    diff --git a/code/mod_table/mod_table.cpp b/code/mod_table/mod_table.cpp
    index e45f4bb..f9a4530 100644
    --- a/code/mod_table/mod_table.cpp
    +++ b/code/mod_table/mod_table.cpp
    @@ -31,6 +31,7 @@ int FS2NetD_port = 0;
     float Briefing_window_FOV = 0.29375f;
     bool Disable_hc_message_ani = false;
     bool Red_alert_applies_to_delayed_ships = false;
    +bool Beams_use_armour_shield_subsys_factors = false;
     
     
     void parse_mod_table(const char *filename)
    @@ -259,6 +260,15 @@ void parse_mod_table(const char *filename)
     			mprintf(("Game Settings Table: Flight controls follow eyepoint orientation\n"));
     	}
     
    +	if (optional_string("$Beams Use Armor/Shield/Subsystem Factors:")) {
    +		stuff_boolean(&Beams_use_armour_shield_subsys_factors);
    +		if (Beams_use_armour_shield_subsys_factors) {
    +			mprintf(("Game Settings Table: Beams will use Armor/Shield/Subsystem Factors\n"));
    +		} else {
    +			mprintf(("Game Settings Table: Beams will ignore Armor/Shield/Subsystem Factors (retail behavior)\n"));
    +		}
    +	}
    +
     	required_string("#END");
     }
     
    diff --git a/code/mod_table/mod_table.h b/code/mod_table/mod_table.h
    index 129d09e..8f82725 100644
    --- a/code/mod_table/mod_table.h
    +++ b/code/mod_table/mod_table.h
    @@ -26,5 +26,6 @@ extern int FS2NetD_port;
     extern float Briefing_window_FOV;
     extern bool Disable_hc_message_ani;
     extern bool Red_alert_applies_to_delayed_ships;
    +extern bool Beams_use_armour_shield_subsys_factors;
     
     void mod_table_init();
    diff --git a/code/ship/shiphit.cpp b/code/ship/shiphit.cpp
    index 0a5438c..19cf8c1 100644
    --- a/code/ship/shiphit.cpp
    +++ b/code/ship/shiphit.cpp
    @@ -327,6 +327,11 @@ int shiphit_get_damage_weapon(object *damaging_objp)
     		case OBJ_SHOCKWAVE:
     			weapon_info_index = shockwave_get_weapon_index(damaging_objp->instance);
     			break;
    +		case OBJ_BEAM:
    +			if (Beams_use_armour_shield_subsys_factors) {
    +				weapon_info_index = beam_get_weapon_info_index(damaging_objp);
    +			}
    +			break;
     		default:
     			weapon_info_index = -1;
     			break;
    @@ -486,7 +491,8 @@ float do_subobj_hit_stuff(object *ship_objp, object *other_obj, vec3d *hitpos, i
     
     	// scale subsystem damage if appropriate
     	weapon_info_index = shiphit_get_damage_weapon(other_obj);	// Goober5000 - a NULL other_obj returns -1
    -	if ((weapon_info_index >= 0) && (other_obj->type == OBJ_WEAPON)) {
    +	if ((weapon_info_index >= 0) && ((other_obj->type == OBJ_WEAPON) ||
    +				(Beams_use_armour_shield_subsys_factors && (other_obj->type == OBJ_BEAM)))) {
     		if ( Weapon_info[weapon_info_index].wi_flags2 & WIF2_TRAINING ) {
     			return damage_left;
     		}
    @@ -729,6 +735,7 @@ float do_subobj_hit_stuff(object *ship_objp, object *other_obj, vec3d *hitpos, i
     			}
     
     			subsystem->current_hits -= damage_to_apply;
    +			nprintf(("Damage", "Damage Subsys: %.1f, %s\n", damage_to_apply, ship_p->ship_name));
     			if (!(subsystem->flags & SSF_NO_AGGREGATE)) {
     				ship_p->subsys_info[subsystem->system_info->type].aggregate_current_hits -= damage_to_apply;
     			}
    @@ -2097,8 +2104,12 @@ static void ship_do_damage(object *ship_objp, object *other_obj, vec3d *hitpos,
     				damage *= difficulty_scale_factor;
     			}
     
    +			nprintf(("Damage", "Damage Shield: %.1f", damage)); // damage applied to shield
    +
     			damage = apply_damage_to_shield(ship_objp, quadrant, damage);
     
    +			nprintf(("Damage", " (%.1f), %s\n", damage, shipp->ship_name)); // damage leftover for hull, etc
    +
     			if(damage > 0.0f){
     				subsystem_damage *= (damage / pre_shield);
     			} else {
    @@ -2200,6 +2211,7 @@ static void ship_do_damage(object *ship_objp, object *other_obj, vec3d *hitpos,
     					}
     				}
     				ship_objp->hull_strength -= damage;
    +				nprintf(("Damage", "Damage Hull  : %.1f, %s\n", damage, shipp->ship_name));
     			}
     
     			// let damage gauge know that player ship just took damage
    
    patch file icon mantis2804.patch (4,104 bytes) 2014-08-25 06:49 +
  • 7z file icon mantis2804-mod.7z (729,844 bytes) 2014-08-25 06:49
  • patch file icon mantis2804-2.patch (2,406 bytes) 2014-09-11 06:17 -
    diff --git a/code/mod_table/mod_table.cpp b/code/mod_table/mod_table.cpp
    index e45f4bb..391068a 100644
    --- a/code/mod_table/mod_table.cpp
    +++ b/code/mod_table/mod_table.cpp
    @@ -31,6 +31,7 @@ int FS2NetD_port = 0;
     float Briefing_window_FOV = 0.29375f;
     bool Disable_hc_message_ani = false;
     bool Red_alert_applies_to_delayed_ships = false;
    +bool Beams_use_damage_factors = false;
     
     
     void parse_mod_table(const char *filename)
    @@ -259,6 +260,15 @@ void parse_mod_table(const char *filename)
     			mprintf(("Game Settings Table: Flight controls follow eyepoint orientation\n"));
     	}
     
    +	if (optional_string("$Beams Use Damage Factors:")) {
    +		stuff_boolean(&Beams_use_damage_factors);
    +		if (Beams_use_damage_factors) {
    +			mprintf(("Game Settings Table: Beams will use Damage Factors\n"));
    +		} else {
    +			mprintf(("Game Settings Table: Beams will ignore Damage Factors (retail behavior)\n"));
    +		}
    +	}
    +
     	required_string("#END");
     }
     
    diff --git a/code/mod_table/mod_table.h b/code/mod_table/mod_table.h
    index 129d09e..f394813 100644
    --- a/code/mod_table/mod_table.h
    +++ b/code/mod_table/mod_table.h
    @@ -26,5 +26,6 @@ extern int FS2NetD_port;
     extern float Briefing_window_FOV;
     extern bool Disable_hc_message_ani;
     extern bool Red_alert_applies_to_delayed_ships;
    +extern bool Beams_use_damage_factors;
     
     void mod_table_init();
    diff --git a/code/ship/shiphit.cpp b/code/ship/shiphit.cpp
    index 0a5438c..6e6a9bf 100644
    --- a/code/ship/shiphit.cpp
    +++ b/code/ship/shiphit.cpp
    @@ -327,6 +327,11 @@ int shiphit_get_damage_weapon(object *damaging_objp)
     		case OBJ_SHOCKWAVE:
     			weapon_info_index = shockwave_get_weapon_index(damaging_objp->instance);
     			break;
    +		case OBJ_BEAM:
    +			if (Beams_use_damage_factors) {
    +				weapon_info_index = beam_get_weapon_info_index(damaging_objp);
    +			}
    +			break;
     		default:
     			weapon_info_index = -1;
     			break;
    @@ -486,7 +491,8 @@ float do_subobj_hit_stuff(object *ship_objp, object *other_obj, vec3d *hitpos, i
     
     	// scale subsystem damage if appropriate
     	weapon_info_index = shiphit_get_damage_weapon(other_obj);	// Goober5000 - a NULL other_obj returns -1
    -	if ((weapon_info_index >= 0) && (other_obj->type == OBJ_WEAPON)) {
    +	if ((weapon_info_index >= 0) && ((other_obj->type == OBJ_WEAPON) ||
    +				(Beams_use_damage_factors && (other_obj->type == OBJ_BEAM)))) {
     		if ( Weapon_info[weapon_info_index].wi_flags2 & WIF2_TRAINING ) {
     			return damage_left;
     		}
    
    patch file icon mantis2804-2.patch (2,406 bytes) 2014-09-11 06:17 +

-Relationships
+Relationships

-Notes

~0014755

Woolie Wool (reporter)

Last edited: 2013-03-06 20:11

View 2 revisions

Fighter beams do not appear to respect difficulty level scaling either (despite the fix of 2788).

EDIT: Subsystem damage appears to scale with difficulty, but not hull damage.

~0016256

niffiwan (developer)

Last edited: 2014-08-25 18:52

View 3 revisions

I've created a patch, see attached and on github:
https://github.com/niffiwan/fs2open.github.com/commit/b509a5b4ca5cbad1c2b0dfe23da2871ff69f2501#diff-d41d8cd98f00b204e9800998ecf8427e

This adds a new game_settings.tbl option:
$Beams Use Armor/Shield/Subsystem Factors:
(let me know if you have any betters suggestions for the name).

I've also attached a small mod that I was using to test the changes. This should test all three types of weapon factors on "normal" beams and fighter beams. Normal beams are weak vs their target (i.e. see the relevant cruisers name) and the fighter beams are stronger vs one factor (the opposite of the normal beams). Using beams vs the friendlies should test difficulty level scaling.

The code also has a new debug_filter.cfg option: +Damage to more easily let you see exactly what damage a given ship is taking.

Unfortunately my Windows laptop is refusing to build execs at the moment :( I'm hoping I can build & post them tomorrow with a different machine.

edit:
Execs are ready for testing:
http://www.mediafire.com/download/c5a5okfcf8g8end/mantis2804-execs.7z

~0016258

Spoon (reporter)

Super neat, Niffiwan! I'll make some time to test this good and proper some time during this week and then cast feedback like a protoss high templar.

~0016263

niffiwan (developer)

Niffi is a derp :(

Here are some *real* execs for testing with (not redundant trunk execs...)

http://www.mediafire.com/download/70pjspa9q9hgbro/mantis2804_execs_mk2.7z

As per the suggestion, I will also change (before committing) the game_settings.tbl flag to be:
$Beams Use Damage Factors:

~0016272

Spoon (reporter)

Okay so I have tested this quite a bit now and haven't spotted any errors, bugs or other nasty bits. As far as I can see, this new flag works greato for both player and capship mounted beams~

~0016275

niffiwan (developer)

New patch uploaded with the option name changed to "$Beams Use Damage Factors:". I also removed the nprintf statements, I'll add them in separately when I've spruced them up a bit.

The patch itself is quite simple, I suppose the most important thing to review would be to ensure I didn't miss any places where the factors should apply.

~0016304

niffiwan (developer)

Fix committed to trunk@11089.
+Notes

+Related Changesets

-Issue History
Date Modified Username Field Change
2013-03-05 21:10 Spoon New Issue
2013-03-06 20:04 Woolie Wool Note Added: 0014755
2013-03-06 20:11 Woolie Wool Note Edited: 0014755 View Revisions
2014-08-23 19:02 niffiwan Assigned To => niffiwan
2014-08-23 19:02 niffiwan Status new => assigned
2014-08-25 06:49 niffiwan File Added: mantis2804.patch
2014-08-25 06:49 niffiwan File Added: mantis2804-mod.7z
2014-08-25 06:57 niffiwan Note Added: 0016256
2014-08-25 06:57 niffiwan Note Edited: 0016256 View Revisions
2014-08-25 18:52 niffiwan Note Edited: 0016256 View Revisions
2014-08-25 18:52 niffiwan Status assigned => feedback
2014-08-25 20:38 Spoon Note Added: 0016258
2014-08-25 20:38 Spoon Status feedback => assigned
2014-08-28 22:17 niffiwan Note Added: 0016263
2014-09-07 18:26 Spoon Note Added: 0016272
2014-09-11 06:17 niffiwan File Added: mantis2804-2.patch
2014-09-11 06:23 niffiwan Note Added: 0016275
2014-09-11 06:23 niffiwan Status assigned => code review
2014-09-26 22:20 niffiwan Changeset attached => fs2open trunk r11089
2014-09-26 22:20 niffiwan Note Added: 0016304
2014-09-26 22:20 niffiwan Status code review => resolved
2014-09-26 22:20 niffiwan Resolution open => fixed
+Issue History