View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0002755 | FSSCP | gameplay | public | 2012-12-16 00:47 | 2012-12-16 13:53 |
| Reporter | Spoon | Assigned To | Valathil | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | resolved | Resolution | fixed | ||
| Product Version | 3.6.15 | ||||
| Summary | 0002755: #Subsitute takes info from original weapon | ||||
| Description | When using #Subsitute, the thruster and sound etc. data is used from the table of the original weapon and not from the weapon that it is being replaced with. | ||||
| Additional Information | I have a vague feeling a certain wizard knows magic that will fix this. | ||||
| Tags | No tags attached. | ||||
|
|
2755.patch (2,507 bytes)
Index: code/ai/aiturret.cpp
===================================================================
--- code/ai/aiturret.cpp (revision 9439)
+++ code/ai/aiturret.cpp (working copy)
@@ -1814,6 +1814,7 @@
objp=&Objects[weapon_objnum];
wp=&Weapons[objp->instance];
+ wip=&Weapon_info[wp->weapon_info_index];
//nprintf(("AI", "Turret_time_enemy_in_range = %7.3f\n", ss->turret_time_enemy_in_range));
if (weapon_objnum != -1) {
Index: code/network/multimsgs.cpp
===================================================================
--- code/network/multimsgs.cpp (revision 9439)
+++ code/network/multimsgs.cpp (working copy)
@@ -3328,6 +3328,8 @@
}
weapon_objnum = weapon_create( &pos, &orient, wid, OBJ_INDEX(objp), -1, 1, 0, 0.0f, ssp);
+ wid = Weapons[Objects[weapon_objnum].instance].weapon_info_index;
+
if (weapon_objnum != -1) {
if ( Weapon_info[wid].launch_snd != -1 ) {
snd_play_3d( &Snds[Weapon_info[wid].launch_snd], &pos, &View_position );
@@ -8384,6 +8386,7 @@
// create the weapon object
weapon_objnum = weapon_create( &pos, &orient, wid, OBJ_INDEX(objp), -1, 1, 0, 0.0f, ssp);
+ wid = Weapons[Objects[weapon_objnum].instance].weapon_info_index;
if (weapon_objnum != -1) {
if ( Weapon_info[wid].launch_snd != -1 ) {
snd_play_3d( &Snds[Weapon_info[wid].launch_snd], &pos, &View_position );
Index: code/ship/ship.cpp
===================================================================
--- code/ship/ship.cpp (revision 9439)
+++ code/ship/ship.cpp (working copy)
@@ -10295,6 +10295,7 @@
// of weapon_create
weapon_objnum = weapon_create( &firing_pos, &firing_orient, weapon, OBJ_INDEX(obj), new_group_id,
0, 0, swp->primary_bank_fof_cooldown[bank_to_fire] );
+ winfo_p = &Weapon_info[Weapons[Objects[weapon_objnum].instance].weapon_info_index];
has_fired = true;
weapon_set_tracking_info(weapon_objnum, OBJ_INDEX(obj), aip->target_objnum, aip->current_target_is_locked, aip->targeted_subsys);
@@ -11030,6 +11031,7 @@
// create the weapon -- for multiplayer, the net_signature is assigned inside
// of weapon_create
weapon_num = weapon_create( &firing_pos, &firing_orient, weapon, OBJ_INDEX(obj), -1, aip->current_target_is_locked);
+ weapon = Weapons[Objects[weapon_num].instance].weapon_info_index;
weapon_set_tracking_info(weapon_num, OBJ_INDEX(obj), aip->target_objnum, aip->current_target_is_locked, aip->targeted_subsys);
has_fired = true;
|
|
|
Problem comes from the substitution happening in weapon_create and the calling functions not updating their weapon_info struct references. Added that to all relevant points in the attached patch. Please review. |
|
|
Approved. |
|
|
Fix committed to trunk@9441. |
|
fs2open: trunk r9441 2012-12-16 09:25 Ported: N/A Details Diff |
Fix for Mantis 2755: Update weapon_info references after weapon_create to get updates from possible substitution |
Affected Issues 0002755 |
|
| mod - /trunk/fs2_open/code/ai/aiturret.cpp | Diff File | ||
| mod - /trunk/fs2_open/code/network/multimsgs.cpp | Diff File | ||
| mod - /trunk/fs2_open/code/ship/ship.cpp | Diff File | ||
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2012-12-16 00:47 | Spoon | New Issue | |
| 2012-12-16 00:48 | Valathil | Assigned To | => Valathil |
| 2012-12-16 00:48 | Valathil | Status | new => assigned |
| 2012-12-16 00:50 | Valathil | File Added: 2755.patch | |
| 2012-12-16 00:52 | Valathil | Note Added: 0014482 | |
| 2012-12-16 00:52 | Valathil | Status | assigned => code review |
| 2012-12-16 11:26 | The_E | Note Added: 0014483 | |
| 2012-12-16 13:53 | Valathil | Changeset attached | => fs2open trunk r9441 |
| 2012-12-16 13:53 | Valathil | Note Added: 0014484 | |
| 2012-12-16 13:53 | Valathil | Status | code review => resolved |
| 2012-12-16 13:53 | Valathil | Resolution | open => fixed |