View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002887 | FSSCP | SEXPs | public | 2013-06-03 22:05 | 2014-08-13 02:16 |
Reporter | FUBAR-BDHR | Assigned To | FUBAR-BDHR | ||
Priority | normal | Severity | minor | Reproducibility | N/A |
Status | resolved | Resolution | fixed | ||
Product Version | 3.6.19 | ||||
Target Version | 3.7.2 | Fixed in Version | 3.7.2 | ||
Summary | 0002887: Additional workaround for mantis 2693 | ||||
Description | http://www.hard-light.net/forums/index.php?topic=83065.0 This was a FRED/sexp option to workaround 2693. It allows turning off collisions on ships without the need to make a separate .pof. | ||||
Tags | No tags attached. | ||||
|
2693_sexp_updated.patch (10,910 bytes)
Index: ai/aiturret.cpp =================================================================== --- ai/aiturret.cpp (revision 9691) +++ ai/aiturret.cpp (working copy) @@ -479,7 +479,7 @@ } // don't shoot at ships without collision check - if (sip->flags & SIF_NO_COLLIDE) { + if (shipp->flags2 & SF2_NO_COLLIDE) { return 0; } Index: fred2/fred.rc =================================================================== --- fred2/fred.rc (revision 9691) +++ fred2/fred.rc (working copy) @@ -1830,9 +1830,10 @@ GROUPBOX "Turret Threats",IDC_STATIC,7,83,102,48 CONTROL "Does Not Move",IDC_IMMOBILE,"Button",BS_3STATE | WS_TABSTOP,7,274,66,10 CONTROL "Cloaked",IDC_CLOAKED,"Button",BS_3STATE | WS_TABSTOP,165,167,42,10 + CONTROL "No Collisions",IDC_NO_COLLIDE,"Button",BS_3STATE | WS_TABSTOP,165,179,66,10 END -IDD_ADD_VARIABLE DIALOG 0, 0, 422, 102 +IDD_ADD_VARIABLE DIALOG 0, 0, 422, 102 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Add Variable" FONT 8, "MS Sans Serif" Index: fred2/missionsave.cpp =================================================================== --- fred2/missionsave.cpp (revision 9691) +++ fred2/missionsave.cpp (working copy) @@ -1724,6 +1724,8 @@ fout(" \"ship-locked\""); if (shipp->flags2 & SF2_WEAPONS_LOCKED) fout(" \"weapons-locked\""); + if (shipp->flags2 & SF2_NO_COLLIDE) + fout(" \"no-collide\""); fout(" )"); } // ----------------------------------------------------------- Index: fred2/resource.h =================================================================== --- fred2/resource.h (revision 9691) +++ fred2/resource.h (working copy) @@ -1170,6 +1170,7 @@ #define IDC_MISSION_LOG_LAST_REPEAT 1640 #define IDC_MISSION_LOG_1ST_TRIGGER 1641 #define IDC_MISSION_LOG_LAST_TRIGGER 1642 +#define IDC_NO_COLLIDE 1643 #define ID_FILE_MISSIONNOTES 32771 #define ID_DUPLICATE 32774 #define ID_VIEW_ROTATE 32775 @@ -1463,7 +1464,7 @@ #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 320 #define _APS_NEXT_COMMAND_VALUE 33098 -#define _APS_NEXT_CONTROL_VALUE 1643 +#define _APS_NEXT_CONTROL_VALUE 1644 #define _APS_NEXT_SYMED_VALUE 105 #endif #endif Index: fred2/shipflagsdlg.cpp =================================================================== --- fred2/shipflagsdlg.cpp (revision 9691) +++ fred2/shipflagsdlg.cpp (working copy) @@ -74,6 +74,7 @@ DDX_Control(pDX, IDC_HIDE_SHIP_NAME, m_hide_ship_name); DDX_Control(pDX, IDC_DISABLE_ETS, m_disable_ets); DDX_Control(pDX, IDC_CLOAKED, m_cloaked); + DDX_Control(pDX, IDC_NO_COLLIDE, m_no_collide); DDX_Control(pDX, IDC_SET_CLASS_DYNAMICALLY, m_set_class_dynamically); //}}AFX_DATA_MAP @@ -138,6 +139,7 @@ ON_BN_CLICKED(IDC_SET_CLASS_DYNAMICALLY, OnSetClassDynamically) ON_BN_CLICKED(IDC_DISABLE_ETS, OnDisableETS) ON_BN_CLICKED(IDC_CLOAKED, OnCloaked) + ON_BN_CLICKED(IDC_NO_COLLIDE, OnNoCollide) //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -159,7 +161,7 @@ int toggle_subsystem_scanning = 0, scannable = 0, kamikaze = 0, no_dynamic = 0, red_alert_carry = 0; int special_warpin = 0, disable_messages = 0, guardian = 0, vaporize = 0, stealth = 0, friendly_stealth_invisible = 0; int no_death_scream = 0, always_death_scream = 0; - int nav_carry = 0, nav_needslink = 0, hide_ship_name = 0, set_class_dynamically = 0, no_ets = 0, cloaked = 0; + int nav_carry = 0, nav_needslink = 0, hide_ship_name = 0, set_class_dynamically = 0, no_ets = 0, cloaked = 0, no_collide = 0; object *objp; ship *shipp; @@ -207,6 +209,7 @@ hide_ship_name = (shipp->flags2 & SF2_HIDE_SHIP_NAME) ? 1 : 0; no_ets = (shipp->flags2 & SF2_NO_ETS) ? 1 : 0; cloaked = (shipp->flags2 & SF2_CLOAKED) ? 1 : 0; + no_collide = (shipp->flags2 & SF2_NO_COLLIDE) ? 1 : 0; destroy_before_mission = (shipp->flags & SF_KILL_BEFORE_MISSION) ? 1 : 0; m_destroy_value.init(shipp->final_death_time); @@ -266,6 +269,7 @@ hide_ship_name = tristate_set(shipp->flags2 & SF2_HIDE_SHIP_NAME, hide_ship_name); no_ets = tristate_set(shipp->flags2 & SF2_NO_ETS, no_ets); cloaked = tristate_set(shipp->flags2 & SF2_CLOAKED, cloaked); + no_collide = tristate_set(shipp->flags2 & SF2_NO_COLLIDE, no_collide); // check the final death time and set the internal variable according to whether or not // the final_death_time is set. Also, the value in the edit box must be set if all the @@ -339,6 +343,7 @@ m_hide_ship_name.SetCheck(hide_ship_name); m_disable_ets.SetCheck(no_ets); m_cloaked.SetCheck(cloaked); + m_no_collide.SetCheck(no_collide); m_kdamage.setup(IDC_KDAMAGE, this); m_destroy_value.setup(IDC_DESTROY_VALUE, this); @@ -956,6 +961,22 @@ break; } + switch (m_no_collide.GetCheck()) { + case 1: + if ( !(shipp->flags2 & SF2_NO_COLLIDE) ) + set_modified(); + + shipp->flags2 |= SF2_NO_COLLIDE; + break; + + case 0: + if ( shipp->flags2 & SF2_NO_COLLIDE ) + set_modified(); + + shipp->flags2 &= ~SF2_NO_COLLIDE; + break; + } + switch (m_guardian.GetCheck()) { case 1: if ( !(shipp->ship_guardian_threshold) ) @@ -1381,3 +1402,12 @@ m_cloaked.SetCheck(1); } } + +void ship_flags_dlg::OnNoCollide() +{ + if (m_no_collide.GetCheck() == 1) { + m_no_collide.SetCheck(0); + } else { + m_no_collide.SetCheck(1); + } +} Index: fred2/shipflagsdlg.h =================================================================== --- fred2/shipflagsdlg.h (revision 9691) +++ fred2/shipflagsdlg.h (working copy) @@ -65,6 +65,7 @@ CButton m_hide_ship_name; CButton m_disable_ets; CButton m_cloaked; + CButton m_no_collide; CButton m_set_class_dynamically; CSpinButtonCtrl m_destroy_spin; numeric_edit_control m_kdamage; @@ -123,6 +124,7 @@ afx_msg void OnSetClassDynamically(); afx_msg void OnDisableETS(); afx_msg void OnCloaked(); + afx_msg void OnNoCollide(); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; Index: mission/missionparse.cpp =================================================================== --- mission/missionparse.cpp (revision 9691) +++ mission/missionparse.cpp (working copy) @@ -310,6 +310,7 @@ "cloaked", "ship-locked", "weapons-locked", + "no-collide", }; char *Mission_event_log_flags[MAX_MISSION_EVENT_LOG_FLAGS] = { @@ -2556,6 +2557,9 @@ if (parse_flags2 & P2_SF2_WEAPONS_LOCKED) shipp->flags2 |= SF2_WEAPONS_LOCKED; + + if (parse_flags2 & P2_SF2_NO_COLLIDE) + shipp->flags2 |= SF2_NO_COLLIDE; } void fix_old_special_explosions(p_object *p_objp, int variable_index) Index: mission/missionparse.h =================================================================== --- mission/missionparse.h (revision 9691) +++ mission/missionparse.h (working copy) @@ -591,7 +591,7 @@ // same caveat: This list of bitfield indicators MUST correspond EXACTLY // (i.e., order and position must be the same) to its counterpart in MissionParse.cpp!!!! -#define MAX_PARSE_OBJECT_FLAGS_2 22 +#define MAX_PARSE_OBJECT_FLAGS_2 23 #define P2_SF2_PRIMITIVE_SENSORS (1<<0) #define P2_SF2_NO_SUBSPACE_DRIVE (1<<1) @@ -615,6 +615,7 @@ #define P2_SF2_CLOAKED (1<<19) #define P2_SF2_SHIP_LOCKED (1<<20) #define P2_SF2_WEAPONS_LOCKED (1<<21) +#define P2_SF2_NO_COLLIDE (1<<22) // and again: these flags do not appear in the array //#define blah (1<<29) Index: object/collideshipship.cpp =================================================================== --- object/collideshipship.cpp (revision 9691) +++ object/collideshipship.cpp (working copy) @@ -172,11 +172,11 @@ } // If either of these objects doesn't get collision checks, abort. - if (heavy_sip->flags & SIF_NO_COLLIDE) { + if (heavy_shipp->flags2 & SF2_NO_COLLIDE) { return 0; } - if (light_sip->flags & SIF_NO_COLLIDE) { + if (light_shipp->flags2 & SF2_NO_COLLIDE) { return 0; } Index: object/collideshipweapon.cpp =================================================================== --- object/collideshipweapon.cpp (revision 9691) +++ object/collideshipweapon.cpp (working copy) @@ -142,7 +142,7 @@ if ( shipp->flags & SF_ARRIVING ) return 0; // If either of these objects doesn't get collision checks, abort. - if (Ship_info[shipp->ship_info_index].flags & SIF_NO_COLLIDE) + if ( shipp->flags2 & SF2_NO_COLLIDE ) return 0; // Return information for AI to detect incoming fire. Index: ship/ship.cpp =================================================================== --- ship/ship.cpp (revision 9691) +++ ship/ship.cpp (working copy) @@ -372,6 +372,7 @@ {SF2_NO_SUBSPACE_DRIVE, "no-subspace-drive", 2, }, {SF2_DONT_COLLIDE_INVIS, "don't-collide-invisible", 2, }, {SF2_NO_ETS, "no-ets", 2, }, + {SF2_NO_COLLIDE, "no-collide", 2, } }; const int num_ai_tgt_weapon_flags = sizeof(ai_tgt_weapon_flags) / sizeof(flag_def_list); @@ -4773,6 +4774,8 @@ shipp->flags2 |= SF2_STEALTH; if (sip->flags & SIF_SHIP_CLASS_DONT_COLLIDE_INVIS) shipp->flags2 |= SF2_DONT_COLLIDE_INVIS; + if (sip->flags & SIF_NO_COLLIDE) + shipp->flags2 |= SF2_NO_COLLIDE; if (sip->flags2 & SIF2_NO_ETS) shipp->flags2 |= SF2_NO_ETS; @@ -9247,6 +9250,11 @@ else if (sip_orig->flags & SIF_SHIP_CLASS_DONT_COLLIDE_INVIS) // changing FROM a don't-collide-invisible ship class sp->flags2 &= ~SF2_DONT_COLLIDE_INVIS; + if (sip->flags & SIF_NO_COLLIDE) // changing TO a no-collision ship class + sp->flags2 |= SF2_NO_COLLIDE; + else if (sip_orig->flags & SIF_NO_COLLIDE) // changing FROM a no-collision ship class + sp->flags2 &= ~SF2_NO_COLLIDE; + if (sip->flags2 & SIF2_NO_ETS) sp->flags2 |= SF2_NO_ETS; else if (sip_orig->flags2 & SIF2_NO_ETS) Index: ship/ship.h =================================================================== --- ship/ship.h (revision 9691) +++ ship/ship.h (working copy) @@ -416,7 +416,7 @@ int flag_list; // is this flag in the 1st or 2nd ship flags list? } ship_flag_name; -#define MAX_SHIP_FLAG_NAMES 9 +#define MAX_SHIP_FLAG_NAMES 10 extern ship_flag_name Ship_flag_names[]; // states for the flags variable within the ship structure @@ -496,6 +496,7 @@ #define SF2_SHIP_LOCKED (1<<24) // Karajorma - Prevents the player from changing the ship class on loadout screen #define SF2_WEAPONS_LOCKED (1<<25) // Karajorma - Prevents the player from changing the weapons on the ship on the loadout screen #define SF2_SHIP_SELECTIVE_LINKING (1<<26) // RSAXVC - Allow pilot to pick firing configuration +#define SF2_NO_COLLIDE (1<<27) // FUBAR - Removes the ship from collision checks // If any of these bits in the ship->flags are set, ignore this ship when targeting extern int TARGET_SHIP_IGNORE_FLAGS; |
|
This one's going to need some updating by someone before it can be added, it's a little more complicated than the others I've looked at. |
|
2887_updated.diff (10,957 bytes)
Index: ai/aiturret.cpp =================================================================== --- ai/aiturret.cpp (revision 10907) +++ ai/aiturret.cpp (working copy) @@ -479,7 +479,7 @@ } // don't shoot at ships without collision check - if (sip->flags & SIF_NO_COLLIDE) { + if (shipp->flags2 & SF2_NO_COLLIDE) { return 0; } Index: fred2/fred.rc =================================================================== --- fred2/fred.rc (revision 10907) +++ fred2/fred.rc (working copy) @@ -1837,6 +1837,7 @@ CONTROL "Does Not Move",IDC_IMMOBILE,"Button",BS_3STATE | WS_TABSTOP,7,274,66,10 CONTROL "Cloaked",IDC_CLOAKED,"Button",BS_3STATE | WS_TABSTOP,165,167,42,10 CONTROL "Scramble Messages",IDC_SCRAMBLE_MESSAGES,"Button",BS_3STATE | WS_TABSTOP,165,177,79,10 + CONTROL "No Collisions",IDC_NO_COLLIDE,"Button",BS_3STATE | WS_TABSTOP,165,179,66,10 END IDD_ADD_VARIABLE DIALOG 0, 0, 422, 102 Index: fred2/missionsave.cpp =================================================================== --- fred2/missionsave.cpp (revision 10907) +++ fred2/missionsave.cpp (working copy) @@ -1742,6 +1742,8 @@ fout(" \"weapons-locked\""); if (shipp->flags2 & SF2_SCRAMBLE_MESSAGES) fout(" \"scramble-messages\""); + if (shipp->flags2 & SF2_NO_COLLIDE) + fout(" \"no-collide\""); fout(" )"); } // ----------------------------------------------------------- Index: fred2/resource.h =================================================================== --- fred2/resource.h (revision 10907) +++ fred2/resource.h (working copy) @@ -1179,6 +1179,7 @@ #define IDC_MISSION_LOG_LAST_REPEAT 1640 #define IDC_MISSION_LOG_1ST_TRIGGER 1641 #define IDC_MISSION_LOG_LAST_TRIGGER 1642 +#define IDC_NO_COLLIDE 1643 #define ID_FILE_MISSIONNOTES 32771 #define ID_DUPLICATE 32774 #define ID_VIEW_ROTATE 32775 @@ -1471,7 +1472,7 @@ #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 320 #define _APS_NEXT_COMMAND_VALUE 33098 -#define _APS_NEXT_CONTROL_VALUE 1643 +#define _APS_NEXT_CONTROL_VALUE 1644 #define _APS_NEXT_SYMED_VALUE 105 #endif #endif Index: fred2/shipflagsdlg.cpp =================================================================== --- fred2/shipflagsdlg.cpp (revision 10907) +++ fred2/shipflagsdlg.cpp (working copy) @@ -74,6 +74,7 @@ DDX_Control(pDX, IDC_HIDE_SHIP_NAME, m_hide_ship_name); DDX_Control(pDX, IDC_DISABLE_ETS, m_disable_ets); DDX_Control(pDX, IDC_CLOAKED, m_cloaked); + DDX_Control(pDX, IDC_NO_COLLIDE, m_no_collide); DDX_Control(pDX, IDC_SET_CLASS_DYNAMICALLY, m_set_class_dynamically); DDX_Control(pDX, IDC_SCRAMBLE_MESSAGES, m_scramble_messages); //}}AFX_DATA_MAP @@ -140,6 +141,7 @@ ON_BN_CLICKED(IDC_DISABLE_ETS, OnDisableETS) ON_BN_CLICKED(IDC_CLOAKED, OnCloaked) ON_BN_CLICKED(IDC_SCRAMBLE_MESSAGES, OnScrambleMessages) + ON_BN_CLICKED(IDC_NO_COLLIDE, OnNoCollide) //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -161,7 +163,7 @@ int toggle_subsystem_scanning = 0, scannable = 0, kamikaze = 0, no_dynamic = 0, red_alert_carry = 0; int special_warpin = 0, disable_messages = 0, guardian = 0, vaporize = 0, stealth = 0, friendly_stealth_invisible = 0; int no_death_scream = 0, always_death_scream = 0, scramble_messages = 0; - int nav_carry = 0, nav_needslink = 0, hide_ship_name = 0, set_class_dynamically = 0, no_ets = 0, cloaked = 0; + int nav_carry = 0, nav_needslink = 0, hide_ship_name = 0, set_class_dynamically = 0, no_ets = 0, cloaked = 0, no_collide = 0; object *objp; ship *shipp; @@ -210,6 +212,7 @@ no_ets = (shipp->flags2 & SF2_NO_ETS) ? 1 : 0; cloaked = (shipp->flags2 & SF2_CLOAKED) ? 1 : 0; scramble_messages = (shipp->flags2 & SF2_SCRAMBLE_MESSAGES) ? 1 : 0; + no_collide = (shipp->flags2 & SF2_NO_COLLIDE) ? 1 : 0; destroy_before_mission = (shipp->flags & SF_KILL_BEFORE_MISSION) ? 1 : 0; m_destroy_value.init(shipp->final_death_time); @@ -270,6 +273,7 @@ no_ets = tristate_set(shipp->flags2 & SF2_NO_ETS, no_ets); cloaked = tristate_set(shipp->flags2 & SF2_CLOAKED, cloaked); scramble_messages = tristate_set(shipp->flags2 & SF2_SCRAMBLE_MESSAGES, scramble_messages); + no_collide = tristate_set(shipp->flags2 & SF2_NO_COLLIDE, no_collide); // check the final death time and set the internal variable according to whether or not // the final_death_time is set. Also, the value in the edit box must be set if all the @@ -344,6 +348,7 @@ m_disable_ets.SetCheck(no_ets); m_cloaked.SetCheck(cloaked); m_scramble_messages.SetCheck(scramble_messages); + m_no_collide.SetCheck(no_collide); m_kdamage.setup(IDC_KDAMAGE, this); m_destroy_value.setup(IDC_DESTROY_VALUE, this); @@ -961,6 +966,22 @@ break; } + switch (m_no_collide.GetCheck()) { + case 1: + if ( !(shipp->flags2 & SF2_NO_COLLIDE) ) + set_modified(); + + shipp->flags2 |= SF2_NO_COLLIDE; + break; + + case 0: + if ( shipp->flags2 & SF2_NO_COLLIDE ) + set_modified(); + + shipp->flags2 &= ~SF2_NO_COLLIDE; + break; + } + switch (m_guardian.GetCheck()) { case 1: if ( !(shipp->ship_guardian_threshold) ) @@ -1410,3 +1431,12 @@ m_scramble_messages.SetCheck(1); } } + +void ship_flags_dlg::OnNoCollide() +{ + if (m_no_collide.GetCheck() == 1) { + m_no_collide.SetCheck(0); + } else { + m_no_collide.SetCheck(1); + } +} Index: fred2/shipflagsdlg.h =================================================================== --- fred2/shipflagsdlg.h (revision 10907) +++ fred2/shipflagsdlg.h (working copy) @@ -65,6 +65,7 @@ CButton m_hide_ship_name; CButton m_disable_ets; CButton m_cloaked; + CButton m_no_collide; CButton m_set_class_dynamically; CButton m_scramble_messages; @@ -126,6 +127,7 @@ afx_msg void OnDisableETS(); afx_msg void OnCloaked(); afx_msg void OnScrambleMessages(); + afx_msg void OnNoCollide(); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; Index: mission/missionparse.cpp =================================================================== --- mission/missionparse.cpp (revision 10907) +++ mission/missionparse.cpp (working copy) @@ -311,6 +311,7 @@ "ship-locked", "weapons-locked", "scramble-messages", + "no-collide", }; char *Mission_event_log_flags[MAX_MISSION_EVENT_LOG_FLAGS] = { @@ -2582,6 +2583,9 @@ if (parse_flags2 & P2_SF2_SCRAMBLE_MESSAGES) shipp->flags2 |= SF2_SCRAMBLE_MESSAGES; + + if (parse_flags2 & P2_SF2_NO_COLLIDE) + shipp->flags2 |= SF2_NO_COLLIDE; } void fix_old_special_explosions(p_object *p_objp, int variable_index) Index: mission/missionparse.h =================================================================== --- mission/missionparse.h (revision 10907) +++ mission/missionparse.h (working copy) @@ -487,7 +487,7 @@ // same caveat: This list of bitfield indicators MUST correspond EXACTLY // (i.e., order and position must be the same) to its counterpart in MissionParse.cpp!!!! -#define MAX_PARSE_OBJECT_FLAGS_2 23 +#define MAX_PARSE_OBJECT_FLAGS_2 24 #define P2_SF2_PRIMITIVE_SENSORS (1<<0) #define P2_SF2_NO_SUBSPACE_DRIVE (1<<1) @@ -512,6 +512,7 @@ #define P2_SF2_SHIP_LOCKED (1<<20) #define P2_SF2_WEAPONS_LOCKED (1<<21) #define P2_SF2_SCRAMBLE_MESSAGES (1<<22) +#define P2_SF2_NO_COLLIDE (1<<23) // and again: these flags do not appear in the array //#define blah (1<<28) Index: object/collideshipship.cpp =================================================================== --- object/collideshipship.cpp (revision 10907) +++ object/collideshipship.cpp (working copy) @@ -173,11 +173,11 @@ } // If either of these objects doesn't get collision checks, abort. - if (heavy_sip->flags & SIF_NO_COLLIDE) { + if (heavy_shipp->flags2 & SF2_NO_COLLIDE) { return 0; } - if (light_sip->flags & SIF_NO_COLLIDE) { + if (light_shipp->flags2 & SF2_NO_COLLIDE) { return 0; } Index: object/collideshipweapon.cpp =================================================================== --- object/collideshipweapon.cpp (revision 10907) +++ object/collideshipweapon.cpp (working copy) @@ -142,7 +142,7 @@ if ( shipp->flags & SF_ARRIVING ) return 0; // If either of these objects doesn't get collision checks, abort. - if (Ship_info[shipp->ship_info_index].flags & SIF_NO_COLLIDE) + if ( shipp->flags2 & SF2_NO_COLLIDE ) return 0; // Return information for AI to detect incoming fire. Index: ship/ship.cpp =================================================================== --- ship/ship.cpp (revision 10907) +++ ship/ship.cpp (working copy) @@ -382,6 +382,7 @@ {SF2_DONT_COLLIDE_INVIS, "don't-collide-invisible", 2, }, {SF2_NO_ETS, "no-ets", 2, }, {SF2_TOGGLE_SUBSYSTEM_SCANNING, "toggle-subsystem-scanning", 2, }, + {SF2_NO_COLLIDE, "no-collide", 2, }, }; const int num_ai_tgt_weapon_flags = sizeof(ai_tgt_weapon_flags) / sizeof(flag_def_list); @@ -4882,6 +4883,8 @@ wing_status_wing_index = -1; wing_status_wing_pos = -1; + if (sip->flags & SIF_NO_COLLIDE) + shipp->flags2 |= SF2_NO_COLLIDE; alt_type_index = -1; callsign_index = -1; @@ -9537,10 +9540,10 @@ else if (sip_orig->flags & SIF_SHIP_CLASS_DONT_COLLIDE_INVIS) // changing FROM a don't-collide-invisible ship class sp->flags2 &= ~SF2_DONT_COLLIDE_INVIS; - if (sip->flags & SIF_NO_COLLIDE) // changing TO a no_collide ship - Objects[sp->objnum].flags &= ~OF_COLLIDES; - else if (sip_orig->flags & SIF_NO_COLLIDE) // changing FROM a no_collide ship - Objects[sp->objnum].flags |= OF_COLLIDES; + if (sip->flags & SIF_NO_COLLIDE) // changing TO a no-collision ship class + sp->flags2 |= SF2_NO_COLLIDE; + else if (sip_orig->flags & SIF_NO_COLLIDE) // changing FROM a no-collision ship class + sp->flags2 &= ~SF2_NO_COLLIDE; if (sip->flags2 & SIF2_NO_ETS) sp->flags2 |= SF2_NO_ETS; Index: ship/ship.h =================================================================== --- ship/ship.h (revision 10907) +++ ship/ship.h (working copy) @@ -424,7 +424,7 @@ int flag_list; // is this flag in the 1st or 2nd ship flags list? } ship_flag_name; -#define MAX_SHIP_FLAG_NAMES 17 +#define MAX_SHIP_FLAG_NAMES 18 extern ship_flag_name Ship_flag_names[]; // states for the flags variable within the ship structure @@ -505,6 +505,7 @@ #define SF2_WEAPONS_LOCKED (1<<25) // Karajorma - Prevents the player from changing the weapons on the ship on the loadout screen #define SF2_SHIP_SELECTIVE_LINKING (1<<26) // RSAXVC - Allow pilot to pick firing configuration #define SF2_SCRAMBLE_MESSAGES (1<<27) // Goober5000 - all messages sent from this ship appear scrambled +#define SF2_NO_COLLIDE (1<<28) // FUBAR - Removes the ship from collision checks // If any of these bits in the ship->flags are set, ignore this ship when targeting extern int TARGET_SHIP_IGNORE_FLAGS; |
|
Ok, maybe I managed to resolve the conflicts myself, I think. There was a collision with Goober's 10181 commit, which I believe the code in this patch is intended to completely replace, so I did just that in resolving the conflict. The patch should reflect the code swap going on there. The FRED dialog buttons are probably in need of adjustment, I can't fix that on my Mac. But other than that, the patch I uploaded should be merged with latest trunk for consideration. |
|
Hmm, after trying to merge all that together, I end up getting this error set, so maybe I did something wrong. Might need my work checked. /Users/cliff.gordon/fs2open/code/ship/ship.cpp:4886:6: error: use of undeclared identifier 'sip'; did you mean 'sin'? if (sip->flags & SIF_NO_COLLIDE) ^~~ sin In file included from /Users/cliff.gordon/fs2open/code/ship/ship.cpp:16: In file included from ../../code/globalincs/alphacolors.h:13: In file included from ../../code/graphics/2d.h:15: In file included from ../../code/globalincs/pstypes.h:327: In file included from ../../code/math/floating.h:15: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/math.h:343:15: note: 'sin' declared here extern double sin(double); ^ /Users/cliff.gordon/fs2open/code/ship/ship.cpp:4886:9: error: member reference base type 'double (double)' is not a structure or union if (sip->flags & SIF_NO_COLLIDE) ~~~^ ~~~~~ /Users/cliff.gordon/fs2open/code/ship/ship.cpp:4887:3: error: use of undeclared identifier 'shipp' shipp->flags2 |= SF2_NO_COLLIDE; ^ 3 errors generated. |
|
The code in which the error occurs doesn't make sense. It modifies flags2 but that is set to 0 later in that function so the code doesn't have any effect. I uploaded a new patch that compiles for me. |
|
2887_updated2.diff (11,007 bytes)
Index: code/ai/aiturret.cpp =================================================================== --- code/ai/aiturret.cpp (revision 10946) +++ code/ai/aiturret.cpp (working copy) @@ -479,7 +479,7 @@ } // don't shoot at ships without collision check - if (sip->flags & SIF_NO_COLLIDE) { + if (shipp->flags2 & SF2_NO_COLLIDE) { return 0; } Index: code/fred2/fred.rc =================================================================== --- code/fred2/fred.rc (revision 10946) +++ code/fred2/fred.rc (working copy) @@ -1837,6 +1837,7 @@ CONTROL "Does Not Move",IDC_IMMOBILE,"Button",BS_3STATE | WS_TABSTOP,7,274,66,10 CONTROL "Cloaked",IDC_CLOAKED,"Button",BS_3STATE | WS_TABSTOP,165,167,42,10 CONTROL "Scramble Messages",IDC_SCRAMBLE_MESSAGES,"Button",BS_3STATE | WS_TABSTOP,165,177,79,10 + CONTROL "No Collisions",IDC_NO_COLLIDE,"Button",BS_3STATE | WS_TABSTOP,165,179,66,10 END IDD_ADD_VARIABLE DIALOG 0, 0, 422, 102 Index: code/fred2/missionsave.cpp =================================================================== --- code/fred2/missionsave.cpp (revision 10946) +++ code/fred2/missionsave.cpp (working copy) @@ -1742,6 +1742,8 @@ fout(" \"weapons-locked\""); if (shipp->flags2 & SF2_SCRAMBLE_MESSAGES) fout(" \"scramble-messages\""); + if (shipp->flags2 & SF2_NO_COLLIDE) + fout(" \"no-collide\""); fout(" )"); } // ----------------------------------------------------------- Index: code/fred2/resource.h =================================================================== --- code/fred2/resource.h (revision 10946) +++ code/fred2/resource.h (working copy) @@ -1179,6 +1179,7 @@ #define IDC_MISSION_LOG_LAST_REPEAT 1640 #define IDC_MISSION_LOG_1ST_TRIGGER 1641 #define IDC_MISSION_LOG_LAST_TRIGGER 1642 +#define IDC_NO_COLLIDE 1643 #define ID_FILE_MISSIONNOTES 32771 #define ID_DUPLICATE 32774 #define ID_VIEW_ROTATE 32775 @@ -1471,7 +1472,7 @@ #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 320 #define _APS_NEXT_COMMAND_VALUE 33098 -#define _APS_NEXT_CONTROL_VALUE 1643 +#define _APS_NEXT_CONTROL_VALUE 1644 #define _APS_NEXT_SYMED_VALUE 105 #endif #endif Index: code/fred2/shipflagsdlg.cpp =================================================================== --- code/fred2/shipflagsdlg.cpp (revision 10946) +++ code/fred2/shipflagsdlg.cpp (working copy) @@ -74,6 +74,7 @@ DDX_Control(pDX, IDC_HIDE_SHIP_NAME, m_hide_ship_name); DDX_Control(pDX, IDC_DISABLE_ETS, m_disable_ets); DDX_Control(pDX, IDC_CLOAKED, m_cloaked); + DDX_Control(pDX, IDC_NO_COLLIDE, m_no_collide); DDX_Control(pDX, IDC_SET_CLASS_DYNAMICALLY, m_set_class_dynamically); DDX_Control(pDX, IDC_SCRAMBLE_MESSAGES, m_scramble_messages); //}}AFX_DATA_MAP @@ -140,6 +141,7 @@ ON_BN_CLICKED(IDC_DISABLE_ETS, OnDisableETS) ON_BN_CLICKED(IDC_CLOAKED, OnCloaked) ON_BN_CLICKED(IDC_SCRAMBLE_MESSAGES, OnScrambleMessages) + ON_BN_CLICKED(IDC_NO_COLLIDE, OnNoCollide) //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -161,7 +163,7 @@ int toggle_subsystem_scanning = 0, scannable = 0, kamikaze = 0, no_dynamic = 0, red_alert_carry = 0; int special_warpin = 0, disable_messages = 0, guardian = 0, vaporize = 0, stealth = 0, friendly_stealth_invisible = 0; int no_death_scream = 0, always_death_scream = 0, scramble_messages = 0; - int nav_carry = 0, nav_needslink = 0, hide_ship_name = 0, set_class_dynamically = 0, no_ets = 0, cloaked = 0; + int nav_carry = 0, nav_needslink = 0, hide_ship_name = 0, set_class_dynamically = 0, no_ets = 0, cloaked = 0, no_collide = 0; object *objp; ship *shipp; @@ -210,6 +212,7 @@ no_ets = (shipp->flags2 & SF2_NO_ETS) ? 1 : 0; cloaked = (shipp->flags2 & SF2_CLOAKED) ? 1 : 0; scramble_messages = (shipp->flags2 & SF2_SCRAMBLE_MESSAGES) ? 1 : 0; + no_collide = (shipp->flags2 & SF2_NO_COLLIDE) ? 1 : 0; destroy_before_mission = (shipp->flags & SF_KILL_BEFORE_MISSION) ? 1 : 0; m_destroy_value.init(shipp->final_death_time); @@ -270,6 +273,7 @@ no_ets = tristate_set(shipp->flags2 & SF2_NO_ETS, no_ets); cloaked = tristate_set(shipp->flags2 & SF2_CLOAKED, cloaked); scramble_messages = tristate_set(shipp->flags2 & SF2_SCRAMBLE_MESSAGES, scramble_messages); + no_collide = tristate_set(shipp->flags2 & SF2_NO_COLLIDE, no_collide); // check the final death time and set the internal variable according to whether or not // the final_death_time is set. Also, the value in the edit box must be set if all the @@ -344,6 +348,7 @@ m_disable_ets.SetCheck(no_ets); m_cloaked.SetCheck(cloaked); m_scramble_messages.SetCheck(scramble_messages); + m_no_collide.SetCheck(no_collide); m_kdamage.setup(IDC_KDAMAGE, this); m_destroy_value.setup(IDC_DESTROY_VALUE, this); @@ -961,6 +966,22 @@ break; } + switch (m_no_collide.GetCheck()) { + case 1: + if ( !(shipp->flags2 & SF2_NO_COLLIDE) ) + set_modified(); + + shipp->flags2 |= SF2_NO_COLLIDE; + break; + + case 0: + if ( shipp->flags2 & SF2_NO_COLLIDE ) + set_modified(); + + shipp->flags2 &= ~SF2_NO_COLLIDE; + break; + } + switch (m_guardian.GetCheck()) { case 1: if ( !(shipp->ship_guardian_threshold) ) @@ -1410,3 +1431,12 @@ m_scramble_messages.SetCheck(1); } } + +void ship_flags_dlg::OnNoCollide() +{ + if (m_no_collide.GetCheck() == 1) { + m_no_collide.SetCheck(0); + } else { + m_no_collide.SetCheck(1); + } +} Index: code/fred2/shipflagsdlg.h =================================================================== --- code/fred2/shipflagsdlg.h (revision 10946) +++ code/fred2/shipflagsdlg.h (working copy) @@ -65,6 +65,7 @@ CButton m_hide_ship_name; CButton m_disable_ets; CButton m_cloaked; + CButton m_no_collide; CButton m_set_class_dynamically; CButton m_scramble_messages; @@ -126,6 +127,7 @@ afx_msg void OnDisableETS(); afx_msg void OnCloaked(); afx_msg void OnScrambleMessages(); + afx_msg void OnNoCollide(); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; Index: code/mission/missionparse.cpp =================================================================== --- code/mission/missionparse.cpp (revision 10946) +++ code/mission/missionparse.cpp (working copy) @@ -311,6 +311,7 @@ "ship-locked", "weapons-locked", "scramble-messages", + "no-collide", }; char *Mission_event_log_flags[MAX_MISSION_EVENT_LOG_FLAGS] = { @@ -2582,6 +2583,9 @@ if (parse_flags2 & P2_SF2_SCRAMBLE_MESSAGES) shipp->flags2 |= SF2_SCRAMBLE_MESSAGES; + + if (parse_flags2 & P2_SF2_NO_COLLIDE) + shipp->flags2 |= SF2_NO_COLLIDE; } void fix_old_special_explosions(p_object *p_objp, int variable_index) Index: code/mission/missionparse.h =================================================================== --- code/mission/missionparse.h (revision 10946) +++ code/mission/missionparse.h (working copy) @@ -487,7 +487,7 @@ // same caveat: This list of bitfield indicators MUST correspond EXACTLY // (i.e., order and position must be the same) to its counterpart in MissionParse.cpp!!!! -#define MAX_PARSE_OBJECT_FLAGS_2 23 +#define MAX_PARSE_OBJECT_FLAGS_2 24 #define P2_SF2_PRIMITIVE_SENSORS (1<<0) #define P2_SF2_NO_SUBSPACE_DRIVE (1<<1) @@ -512,6 +512,7 @@ #define P2_SF2_SHIP_LOCKED (1<<20) #define P2_SF2_WEAPONS_LOCKED (1<<21) #define P2_SF2_SCRAMBLE_MESSAGES (1<<22) +#define P2_SF2_NO_COLLIDE (1<<23) // and again: these flags do not appear in the array //#define blah (1<<28) Index: code/object/collideshipship.cpp =================================================================== --- code/object/collideshipship.cpp (revision 10946) +++ code/object/collideshipship.cpp (working copy) @@ -173,11 +173,11 @@ } // If either of these objects doesn't get collision checks, abort. - if (heavy_sip->flags & SIF_NO_COLLIDE) { + if (heavy_shipp->flags2 & SF2_NO_COLLIDE) { return 0; } - if (light_sip->flags & SIF_NO_COLLIDE) { + if (light_shipp->flags2 & SF2_NO_COLLIDE) { return 0; } Index: code/object/collideshipweapon.cpp =================================================================== --- code/object/collideshipweapon.cpp (revision 10946) +++ code/object/collideshipweapon.cpp (working copy) @@ -142,7 +142,7 @@ if ( shipp->flags & SF_ARRIVING ) return 0; // If either of these objects doesn't get collision checks, abort. - if (Ship_info[shipp->ship_info_index].flags & SIF_NO_COLLIDE) + if ( shipp->flags2 & SF2_NO_COLLIDE ) return 0; // Return information for AI to detect incoming fire. Index: code/ship/ship.cpp =================================================================== --- code/ship/ship.cpp (revision 10946) +++ code/ship/ship.cpp (working copy) @@ -381,6 +381,7 @@ {SF2_DONT_COLLIDE_INVIS, "don't-collide-invisible", 2, }, {SF2_NO_ETS, "no-ets", 2, }, {SF2_TOGGLE_SUBSYSTEM_SCANNING, "toggle-subsystem-scanning", 2, }, + {SF2_NO_COLLIDE, "no-collide", 2, }, }; const int num_ai_tgt_weapon_flags = sizeof(ai_tgt_weapon_flags) / sizeof(flag_def_list); @@ -9423,10 +9424,10 @@ else if (sip_orig->flags & SIF_SHIP_CLASS_DONT_COLLIDE_INVIS) // changing FROM a don't-collide-invisible ship class sp->flags2 &= ~SF2_DONT_COLLIDE_INVIS; - if (sip->flags & SIF_NO_COLLIDE) // changing TO a no_collide ship - Objects[sp->objnum].flags &= ~OF_COLLIDES; - else if (sip_orig->flags & SIF_NO_COLLIDE) // changing FROM a no_collide ship - Objects[sp->objnum].flags |= OF_COLLIDES; + if (sip->flags & SIF_NO_COLLIDE) // changing TO a no-collision ship class + sp->flags2 |= SF2_NO_COLLIDE; + else if (sip_orig->flags & SIF_NO_COLLIDE) // changing FROM a no-collision ship class + sp->flags2 &= ~SF2_NO_COLLIDE; if (sip->flags2 & SIF2_NO_ETS) sp->flags2 |= SF2_NO_ETS; Index: code/ship/ship.h =================================================================== --- code/ship/ship.h (revision 10946) +++ code/ship/ship.h (working copy) @@ -424,7 +424,7 @@ int flag_list; // is this flag in the 1st or 2nd ship flags list? } ship_flag_name; -#define MAX_SHIP_FLAG_NAMES 17 +#define MAX_SHIP_FLAG_NAMES 18 extern ship_flag_name Ship_flag_names[]; // states for the flags variable within the ship structure @@ -505,6 +505,7 @@ #define SF2_WEAPONS_LOCKED (1<<25) // Karajorma - Prevents the player from changing the weapons on the ship on the loadout screen #define SF2_SHIP_SELECTIVE_LINKING (1<<26) // RSAXVC - Allow pilot to pick firing configuration #define SF2_SCRAMBLE_MESSAGES (1<<27) // Goober5000 - all messages sent from this ship appear scrambled +#define SF2_NO_COLLIDE (1<<28) // FUBAR - Removes the ship from collision checks // If any of these bits in the ship->flags are set, ignore this ship when targeting extern int TARGET_SHIP_IGNORE_FLAGS; |
|
Yeah I had probably goofed something in updating the patch. I wasn't 100% on a couple of spots. I'll take a look at this soon. |
|
2887.patch (11,228 bytes)
Index: code/ai/aiturret.cpp =================================================================== --- code/ai/aiturret.cpp (revision 10953) +++ code/ai/aiturret.cpp (working copy) @@ -479,7 +479,7 @@ } // don't shoot at ships without collision check - if (sip->flags & SIF_NO_COLLIDE) { + if (shipp->flags2 & SF2_NO_COLLIDE) { return 0; } Index: code/fred2/fred.rc =================================================================== --- code/fred2/fred.rc (revision 10953) +++ code/fred2/fred.rc (working copy) @@ -1837,6 +1837,7 @@ CONTROL "Does Not Move",IDC_IMMOBILE,"Button",BS_3STATE | WS_TABSTOP,7,274,66,10 CONTROL "Cloaked",IDC_CLOAKED,"Button",BS_3STATE | WS_TABSTOP,165,167,42,10 CONTROL "Scramble Messages",IDC_SCRAMBLE_MESSAGES,"Button",BS_3STATE | WS_TABSTOP,165,177,79,10 + CONTROL "No Collisions",IDC_NO_COLLIDE,"Button",BS_3STATE | WS_TABSTOP,165,179,66,10 END IDD_ADD_VARIABLE DIALOG 0, 0, 422, 102 Index: code/fred2/missionsave.cpp =================================================================== --- code/fred2/missionsave.cpp (revision 10953) +++ code/fred2/missionsave.cpp (working copy) @@ -1742,6 +1742,8 @@ fout(" \"weapons-locked\""); if (shipp->flags2 & SF2_SCRAMBLE_MESSAGES) fout(" \"scramble-messages\""); + if (shipp->flags2 & SF2_NO_COLLIDE) + fout(" \"no-collide\""); fout(" )"); } // ----------------------------------------------------------- Index: code/fred2/resource.h =================================================================== --- code/fred2/resource.h (revision 10953) +++ code/fred2/resource.h (working copy) @@ -1179,6 +1179,7 @@ #define IDC_MISSION_LOG_LAST_REPEAT 1640 #define IDC_MISSION_LOG_1ST_TRIGGER 1641 #define IDC_MISSION_LOG_LAST_TRIGGER 1642 +#define IDC_NO_COLLIDE 1643 #define ID_FILE_MISSIONNOTES 32771 #define ID_DUPLICATE 32774 #define ID_VIEW_ROTATE 32775 @@ -1471,7 +1472,7 @@ #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 320 #define _APS_NEXT_COMMAND_VALUE 33098 -#define _APS_NEXT_CONTROL_VALUE 1643 +#define _APS_NEXT_CONTROL_VALUE 1644 #define _APS_NEXT_SYMED_VALUE 105 #endif #endif Index: code/fred2/shipflagsdlg.cpp =================================================================== --- code/fred2/shipflagsdlg.cpp (revision 10953) +++ code/fred2/shipflagsdlg.cpp (working copy) @@ -74,6 +74,7 @@ DDX_Control(pDX, IDC_HIDE_SHIP_NAME, m_hide_ship_name); DDX_Control(pDX, IDC_DISABLE_ETS, m_disable_ets); DDX_Control(pDX, IDC_CLOAKED, m_cloaked); + DDX_Control(pDX, IDC_NO_COLLIDE, m_no_collide); DDX_Control(pDX, IDC_SET_CLASS_DYNAMICALLY, m_set_class_dynamically); DDX_Control(pDX, IDC_SCRAMBLE_MESSAGES, m_scramble_messages); //}}AFX_DATA_MAP @@ -140,6 +141,7 @@ ON_BN_CLICKED(IDC_DISABLE_ETS, OnDisableETS) ON_BN_CLICKED(IDC_CLOAKED, OnCloaked) ON_BN_CLICKED(IDC_SCRAMBLE_MESSAGES, OnScrambleMessages) + ON_BN_CLICKED(IDC_NO_COLLIDE, OnNoCollide) //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -161,7 +163,7 @@ int toggle_subsystem_scanning = 0, scannable = 0, kamikaze = 0, no_dynamic = 0, red_alert_carry = 0; int special_warpin = 0, disable_messages = 0, guardian = 0, vaporize = 0, stealth = 0, friendly_stealth_invisible = 0; int no_death_scream = 0, always_death_scream = 0, scramble_messages = 0; - int nav_carry = 0, nav_needslink = 0, hide_ship_name = 0, set_class_dynamically = 0, no_ets = 0, cloaked = 0; + int nav_carry = 0, nav_needslink = 0, hide_ship_name = 0, set_class_dynamically = 0, no_ets = 0, cloaked = 0, no_collide = 0; object *objp; ship *shipp; @@ -210,6 +212,7 @@ no_ets = (shipp->flags2 & SF2_NO_ETS) ? 1 : 0; cloaked = (shipp->flags2 & SF2_CLOAKED) ? 1 : 0; scramble_messages = (shipp->flags2 & SF2_SCRAMBLE_MESSAGES) ? 1 : 0; + no_collide = (shipp->flags2 & SF2_NO_COLLIDE) ? 1 : 0; destroy_before_mission = (shipp->flags & SF_KILL_BEFORE_MISSION) ? 1 : 0; m_destroy_value.init(shipp->final_death_time); @@ -270,6 +273,7 @@ no_ets = tristate_set(shipp->flags2 & SF2_NO_ETS, no_ets); cloaked = tristate_set(shipp->flags2 & SF2_CLOAKED, cloaked); scramble_messages = tristate_set(shipp->flags2 & SF2_SCRAMBLE_MESSAGES, scramble_messages); + no_collide = tristate_set(shipp->flags2 & SF2_NO_COLLIDE, no_collide); // check the final death time and set the internal variable according to whether or not // the final_death_time is set. Also, the value in the edit box must be set if all the @@ -344,6 +348,7 @@ m_disable_ets.SetCheck(no_ets); m_cloaked.SetCheck(cloaked); m_scramble_messages.SetCheck(scramble_messages); + m_no_collide.SetCheck(no_collide); m_kdamage.setup(IDC_KDAMAGE, this); m_destroy_value.setup(IDC_DESTROY_VALUE, this); @@ -961,6 +966,22 @@ break; } + switch (m_no_collide.GetCheck()) { + case 1: + if ( !(shipp->flags2 & SF2_NO_COLLIDE) ) + set_modified(); + + shipp->flags2 |= SF2_NO_COLLIDE; + break; + + case 0: + if ( shipp->flags2 & SF2_NO_COLLIDE ) + set_modified(); + + shipp->flags2 &= ~SF2_NO_COLLIDE; + break; + } + switch (m_guardian.GetCheck()) { case 1: if ( !(shipp->ship_guardian_threshold) ) @@ -1410,3 +1431,12 @@ m_scramble_messages.SetCheck(1); } } + +void ship_flags_dlg::OnNoCollide() +{ + if (m_no_collide.GetCheck() == 1) { + m_no_collide.SetCheck(0); + } else { + m_no_collide.SetCheck(1); + } +} Index: code/fred2/shipflagsdlg.h =================================================================== --- code/fred2/shipflagsdlg.h (revision 10953) +++ code/fred2/shipflagsdlg.h (working copy) @@ -65,6 +65,7 @@ CButton m_hide_ship_name; CButton m_disable_ets; CButton m_cloaked; + CButton m_no_collide; CButton m_set_class_dynamically; CButton m_scramble_messages; @@ -126,6 +127,7 @@ afx_msg void OnDisableETS(); afx_msg void OnCloaked(); afx_msg void OnScrambleMessages(); + afx_msg void OnNoCollide(); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; Index: code/mission/missionparse.cpp =================================================================== --- code/mission/missionparse.cpp (revision 10953) +++ code/mission/missionparse.cpp (working copy) @@ -311,6 +311,7 @@ "ship-locked", "weapons-locked", "scramble-messages", + "no-collide", }; char *Mission_event_log_flags[MAX_MISSION_EVENT_LOG_FLAGS] = { @@ -2582,6 +2583,9 @@ if (parse_flags2 & P2_SF2_SCRAMBLE_MESSAGES) shipp->flags2 |= SF2_SCRAMBLE_MESSAGES; + + if (parse_flags2 & P2_SF2_NO_COLLIDE) + shipp->flags2 |= SF2_NO_COLLIDE; } void fix_old_special_explosions(p_object *p_objp, int variable_index) Index: code/mission/missionparse.h =================================================================== --- code/mission/missionparse.h (revision 10953) +++ code/mission/missionparse.h (working copy) @@ -487,7 +487,7 @@ // same caveat: This list of bitfield indicators MUST correspond EXACTLY // (i.e., order and position must be the same) to its counterpart in MissionParse.cpp!!!! -#define MAX_PARSE_OBJECT_FLAGS_2 23 +#define MAX_PARSE_OBJECT_FLAGS_2 24 #define P2_SF2_PRIMITIVE_SENSORS (1<<0) #define P2_SF2_NO_SUBSPACE_DRIVE (1<<1) @@ -512,6 +512,7 @@ #define P2_SF2_SHIP_LOCKED (1<<20) #define P2_SF2_WEAPONS_LOCKED (1<<21) #define P2_SF2_SCRAMBLE_MESSAGES (1<<22) +#define P2_SF2_NO_COLLIDE (1<<23) // and again: these flags do not appear in the array //#define blah (1<<28) Index: code/object/collideshipship.cpp =================================================================== --- code/object/collideshipship.cpp (revision 10953) +++ code/object/collideshipship.cpp (working copy) @@ -173,11 +173,11 @@ } // If either of these objects doesn't get collision checks, abort. - if (heavy_sip->flags & SIF_NO_COLLIDE) { + if (heavy_shipp->flags2 & SF2_NO_COLLIDE) { return 0; } - if (light_sip->flags & SIF_NO_COLLIDE) { + if (light_shipp->flags2 & SF2_NO_COLLIDE) { return 0; } Index: code/object/collideshipweapon.cpp =================================================================== --- code/object/collideshipweapon.cpp (revision 10953) +++ code/object/collideshipweapon.cpp (working copy) @@ -142,7 +142,7 @@ if ( shipp->flags & SF_ARRIVING ) return 0; // If either of these objects doesn't get collision checks, abort. - if (Ship_info[shipp->ship_info_index].flags & SIF_NO_COLLIDE) + if ( shipp->flags2 & SF2_NO_COLLIDE ) return 0; // Return information for AI to detect incoming fire. Index: code/ship/ship.cpp =================================================================== --- code/ship/ship.cpp (revision 10953) +++ code/ship/ship.cpp (working copy) @@ -381,6 +381,7 @@ {SF2_DONT_COLLIDE_INVIS, "don't-collide-invisible", 2, }, {SF2_NO_ETS, "no-ets", 2, }, {SF2_TOGGLE_SUBSYSTEM_SCANNING, "toggle-subsystem-scanning", 2, }, + {SF2_NO_COLLIDE, "no-collide", 2, }, }; const int num_ai_tgt_weapon_flags = sizeof(ai_tgt_weapon_flags) / sizeof(flag_def_list); @@ -5137,6 +5138,8 @@ shipp->flags2 |= SF2_STEALTH; if (sip->flags & SIF_SHIP_CLASS_DONT_COLLIDE_INVIS) shipp->flags2 |= SF2_DONT_COLLIDE_INVIS; + if (sip->flags & SIF_NO_COLLIDE) + shipp->flags2 |= SF2_NO_COLLIDE; if (sip->flags2 & SIF2_NO_ETS) shipp->flags2 |= SF2_NO_ETS; @@ -9423,10 +9426,10 @@ else if (sip_orig->flags & SIF_SHIP_CLASS_DONT_COLLIDE_INVIS) // changing FROM a don't-collide-invisible ship class sp->flags2 &= ~SF2_DONT_COLLIDE_INVIS; - if (sip->flags & SIF_NO_COLLIDE) // changing TO a no_collide ship - Objects[sp->objnum].flags &= ~OF_COLLIDES; - else if (sip_orig->flags & SIF_NO_COLLIDE) // changing FROM a no_collide ship - Objects[sp->objnum].flags |= OF_COLLIDES; + if (sip->flags & SIF_NO_COLLIDE) // changing TO a no-collision ship class + sp->flags2 |= SF2_NO_COLLIDE; + else if (sip_orig->flags & SIF_NO_COLLIDE) // changing FROM a no-collision ship class + sp->flags2 &= ~SF2_NO_COLLIDE; if (sip->flags2 & SIF2_NO_ETS) sp->flags2 |= SF2_NO_ETS; Index: code/ship/ship.h =================================================================== --- code/ship/ship.h (revision 10953) +++ code/ship/ship.h (working copy) @@ -424,7 +424,7 @@ int flag_list; // is this flag in the 1st or 2nd ship flags list? } ship_flag_name; -#define MAX_SHIP_FLAG_NAMES 17 +#define MAX_SHIP_FLAG_NAMES 18 extern ship_flag_name Ship_flag_names[]; // states for the flags variable within the ship structure @@ -505,6 +505,7 @@ #define SF2_WEAPONS_LOCKED (1<<25) // Karajorma - Prevents the player from changing the weapons on the ship on the loadout screen #define SF2_SHIP_SELECTIVE_LINKING (1<<26) // RSAXVC - Allow pilot to pick firing configuration #define SF2_SCRAMBLE_MESSAGES (1<<27) // Goober5000 - all messages sent from this ship appear scrambled +#define SF2_NO_COLLIDE (1<<28) // FUBAR - Removes the ship from collision checks // If any of these bits in the ship->flags are set, ignore this ship when targeting extern int TARGET_SHIP_IGNORE_FLAGS; |
|
I've uploaded a patch that takes the misplaced hunk from chief1983's patch (removed in m_m's patch) and places it where it seems like it should have gone, based on the original patch's context. Also made a slight formatting change to the fred.rc line (four spaces instead of a tab, for consistency with the other lines). This version of the patch compiles, but I haven't yet tested the behavior. |
|
2887_fixed.patch (11,302 bytes)
Index: code/ai/aiturret.cpp =================================================================== --- code/ai/aiturret.cpp (revision 10961) +++ code/ai/aiturret.cpp (working copy) @@ -479,7 +479,7 @@ } // don't shoot at ships without collision check - if (sip->flags & SIF_NO_COLLIDE) { + if (shipp->flags2 & SF2_NO_COLLIDE) { return 0; } Index: code/fred2/fred.rc =================================================================== --- code/fred2/fred.rc (revision 10961) +++ code/fred2/fred.rc (working copy) @@ -1837,6 +1837,7 @@ CONTROL "Does Not Move",IDC_IMMOBILE,"Button",BS_3STATE | WS_TABSTOP,7,274,66,10 CONTROL "Cloaked",IDC_CLOAKED,"Button",BS_3STATE | WS_TABSTOP,165,167,42,10 CONTROL "Scramble Messages",IDC_SCRAMBLE_MESSAGES,"Button",BS_3STATE | WS_TABSTOP,165,177,79,10 + CONTROL "No Collisions",IDC_NO_COLLIDE,"Button",BS_3STATE | WS_TABSTOP,165,188,66,10 END IDD_ADD_VARIABLE DIALOG 0, 0, 422, 102 Index: code/fred2/missionsave.cpp =================================================================== --- code/fred2/missionsave.cpp (revision 10961) +++ code/fred2/missionsave.cpp (working copy) @@ -1742,6 +1742,8 @@ fout(" \"weapons-locked\""); if (shipp->flags2 & SF2_SCRAMBLE_MESSAGES) fout(" \"scramble-messages\""); + if (shipp->flags2 & SF2_NO_COLLIDE) + fout(" \"no-collide\""); fout(" )"); } // ----------------------------------------------------------- Index: code/fred2/resource.h =================================================================== --- code/fred2/resource.h (revision 10961) +++ code/fred2/resource.h (working copy) @@ -1179,6 +1179,7 @@ #define IDC_MISSION_LOG_LAST_REPEAT 1640 #define IDC_MISSION_LOG_1ST_TRIGGER 1641 #define IDC_MISSION_LOG_LAST_TRIGGER 1642 +#define IDC_NO_COLLIDE 1643 #define ID_FILE_MISSIONNOTES 32771 #define ID_DUPLICATE 32774 #define ID_VIEW_ROTATE 32775 @@ -1471,7 +1472,7 @@ #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 320 #define _APS_NEXT_COMMAND_VALUE 33098 -#define _APS_NEXT_CONTROL_VALUE 1643 +#define _APS_NEXT_CONTROL_VALUE 1644 #define _APS_NEXT_SYMED_VALUE 105 #endif #endif Index: code/fred2/shipflagsdlg.cpp =================================================================== --- code/fred2/shipflagsdlg.cpp (revision 10961) +++ code/fred2/shipflagsdlg.cpp (working copy) @@ -74,6 +74,7 @@ DDX_Control(pDX, IDC_HIDE_SHIP_NAME, m_hide_ship_name); DDX_Control(pDX, IDC_DISABLE_ETS, m_disable_ets); DDX_Control(pDX, IDC_CLOAKED, m_cloaked); + DDX_Control(pDX, IDC_NO_COLLIDE, m_no_collide); DDX_Control(pDX, IDC_SET_CLASS_DYNAMICALLY, m_set_class_dynamically); DDX_Control(pDX, IDC_SCRAMBLE_MESSAGES, m_scramble_messages); //}}AFX_DATA_MAP @@ -140,6 +141,7 @@ ON_BN_CLICKED(IDC_DISABLE_ETS, OnDisableETS) ON_BN_CLICKED(IDC_CLOAKED, OnCloaked) ON_BN_CLICKED(IDC_SCRAMBLE_MESSAGES, OnScrambleMessages) + ON_BN_CLICKED(IDC_NO_COLLIDE, OnNoCollide) //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -161,7 +163,7 @@ int toggle_subsystem_scanning = 0, scannable = 0, kamikaze = 0, no_dynamic = 0, red_alert_carry = 0; int special_warpin = 0, disable_messages = 0, guardian = 0, vaporize = 0, stealth = 0, friendly_stealth_invisible = 0; int no_death_scream = 0, always_death_scream = 0, scramble_messages = 0; - int nav_carry = 0, nav_needslink = 0, hide_ship_name = 0, set_class_dynamically = 0, no_ets = 0, cloaked = 0; + int nav_carry = 0, nav_needslink = 0, hide_ship_name = 0, set_class_dynamically = 0, no_ets = 0, cloaked = 0, no_collide = 0; object *objp; ship *shipp; @@ -210,6 +212,7 @@ no_ets = (shipp->flags2 & SF2_NO_ETS) ? 1 : 0; cloaked = (shipp->flags2 & SF2_CLOAKED) ? 1 : 0; scramble_messages = (shipp->flags2 & SF2_SCRAMBLE_MESSAGES) ? 1 : 0; + no_collide = (shipp->flags2 & SF2_NO_COLLIDE) ? 1 : 0; destroy_before_mission = (shipp->flags & SF_KILL_BEFORE_MISSION) ? 1 : 0; m_destroy_value.init(shipp->final_death_time); @@ -270,6 +273,7 @@ no_ets = tristate_set(shipp->flags2 & SF2_NO_ETS, no_ets); cloaked = tristate_set(shipp->flags2 & SF2_CLOAKED, cloaked); scramble_messages = tristate_set(shipp->flags2 & SF2_SCRAMBLE_MESSAGES, scramble_messages); + no_collide = tristate_set(shipp->flags2 & SF2_NO_COLLIDE, no_collide); // check the final death time and set the internal variable according to whether or not // the final_death_time is set. Also, the value in the edit box must be set if all the @@ -344,6 +348,7 @@ m_disable_ets.SetCheck(no_ets); m_cloaked.SetCheck(cloaked); m_scramble_messages.SetCheck(scramble_messages); + m_no_collide.SetCheck(no_collide); m_kdamage.setup(IDC_KDAMAGE, this); m_destroy_value.setup(IDC_DESTROY_VALUE, this); @@ -961,6 +966,22 @@ break; } + switch (m_no_collide.GetCheck()) { + case 1: + if ( !(shipp->flags2 & SF2_NO_COLLIDE) ) + set_modified(); + + shipp->flags2 |= SF2_NO_COLLIDE; + break; + + case 0: + if ( shipp->flags2 & SF2_NO_COLLIDE ) + set_modified(); + + shipp->flags2 &= ~SF2_NO_COLLIDE; + break; + } + switch (m_guardian.GetCheck()) { case 1: if ( !(shipp->ship_guardian_threshold) ) @@ -1410,3 +1431,12 @@ m_scramble_messages.SetCheck(1); } } + +void ship_flags_dlg::OnNoCollide() +{ + if (m_no_collide.GetCheck() == 1) { + m_no_collide.SetCheck(0); + } else { + m_no_collide.SetCheck(1); + } +} Index: code/fred2/shipflagsdlg.h =================================================================== --- code/fred2/shipflagsdlg.h (revision 10961) +++ code/fred2/shipflagsdlg.h (working copy) @@ -65,6 +65,7 @@ CButton m_hide_ship_name; CButton m_disable_ets; CButton m_cloaked; + CButton m_no_collide; CButton m_set_class_dynamically; CButton m_scramble_messages; @@ -126,6 +127,7 @@ afx_msg void OnDisableETS(); afx_msg void OnCloaked(); afx_msg void OnScrambleMessages(); + afx_msg void OnNoCollide(); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; Index: code/mission/missionparse.cpp =================================================================== --- code/mission/missionparse.cpp (revision 10961) +++ code/mission/missionparse.cpp (working copy) @@ -311,6 +311,7 @@ "ship-locked", "weapons-locked", "scramble-messages", + "no-collide", }; char *Mission_event_log_flags[MAX_MISSION_EVENT_LOG_FLAGS] = { @@ -2582,6 +2583,9 @@ if (parse_flags2 & P2_SF2_SCRAMBLE_MESSAGES) shipp->flags2 |= SF2_SCRAMBLE_MESSAGES; + + if (parse_flags2 & P2_SF2_NO_COLLIDE) + shipp->flags2 |= SF2_NO_COLLIDE; } void fix_old_special_explosions(p_object *p_objp, int variable_index) Index: code/mission/missionparse.h =================================================================== --- code/mission/missionparse.h (revision 10961) +++ code/mission/missionparse.h (working copy) @@ -487,7 +487,7 @@ // same caveat: This list of bitfield indicators MUST correspond EXACTLY // (i.e., order and position must be the same) to its counterpart in MissionParse.cpp!!!! -#define MAX_PARSE_OBJECT_FLAGS_2 23 +#define MAX_PARSE_OBJECT_FLAGS_2 24 #define P2_SF2_PRIMITIVE_SENSORS (1<<0) #define P2_SF2_NO_SUBSPACE_DRIVE (1<<1) @@ -512,6 +512,7 @@ #define P2_SF2_SHIP_LOCKED (1<<20) #define P2_SF2_WEAPONS_LOCKED (1<<21) #define P2_SF2_SCRAMBLE_MESSAGES (1<<22) +#define P2_SF2_NO_COLLIDE (1<<23) // and again: these flags do not appear in the array //#define blah (1<<28) Index: code/object/collideshipship.cpp =================================================================== --- code/object/collideshipship.cpp (revision 10961) +++ code/object/collideshipship.cpp (working copy) @@ -173,11 +173,11 @@ } // If either of these objects doesn't get collision checks, abort. - if (heavy_sip->flags & SIF_NO_COLLIDE) { + if (heavy_shipp->flags2 & SF2_NO_COLLIDE) { return 0; } - if (light_sip->flags & SIF_NO_COLLIDE) { + if (light_shipp->flags2 & SF2_NO_COLLIDE) { return 0; } Index: code/object/collideshipweapon.cpp =================================================================== --- code/object/collideshipweapon.cpp (revision 10961) +++ code/object/collideshipweapon.cpp (working copy) @@ -142,7 +142,7 @@ if ( shipp->flags & SF_ARRIVING ) return 0; // If either of these objects doesn't get collision checks, abort. - if (Ship_info[shipp->ship_info_index].flags & SIF_NO_COLLIDE) + if ( shipp->flags2 & SF2_NO_COLLIDE ) return 0; // Return information for AI to detect incoming fire. Index: code/ship/ship.cpp =================================================================== --- code/ship/ship.cpp (revision 10961) +++ code/ship/ship.cpp (working copy) @@ -381,6 +381,7 @@ {SF2_DONT_COLLIDE_INVIS, "don't-collide-invisible", 2, }, {SF2_NO_ETS, "no-ets", 2, }, {SF2_TOGGLE_SUBSYSTEM_SCANNING, "toggle-subsystem-scanning", 2, }, + {SF2_NO_COLLIDE, "no-collide", 2, }, }; const int num_ai_tgt_weapon_flags = sizeof(ai_tgt_weapon_flags) / sizeof(flag_def_list); @@ -5137,6 +5138,8 @@ shipp->flags2 |= SF2_STEALTH; if (sip->flags & SIF_SHIP_CLASS_DONT_COLLIDE_INVIS) shipp->flags2 |= SF2_DONT_COLLIDE_INVIS; + if (sip->flags & SIF_NO_COLLIDE) + shipp->flags2 |= SF2_NO_COLLIDE; if (sip->flags2 & SIF2_NO_ETS) shipp->flags2 |= SF2_NO_ETS; @@ -9423,10 +9426,10 @@ else if (sip_orig->flags & SIF_SHIP_CLASS_DONT_COLLIDE_INVIS) // changing FROM a don't-collide-invisible ship class sp->flags2 &= ~SF2_DONT_COLLIDE_INVIS; - if (sip->flags & SIF_NO_COLLIDE) // changing TO a no_collide ship - Objects[sp->objnum].flags &= ~OF_COLLIDES; - else if (sip_orig->flags & SIF_NO_COLLIDE) // changing FROM a no_collide ship - Objects[sp->objnum].flags |= OF_COLLIDES; + if (sip->flags & SIF_NO_COLLIDE) // changing TO a no-collision ship class + sp->flags2 |= SF2_NO_COLLIDE; + else if (sip_orig->flags & SIF_NO_COLLIDE) // changing FROM a no-collision ship class + sp->flags2 &= ~SF2_NO_COLLIDE; if (sip->flags2 & SIF2_NO_ETS) sp->flags2 |= SF2_NO_ETS; Index: code/ship/ship.h =================================================================== --- code/ship/ship.h (revision 10961) +++ code/ship/ship.h (working copy) @@ -424,7 +424,7 @@ int flag_list; // is this flag in the 1st or 2nd ship flags list? } ship_flag_name; -#define MAX_SHIP_FLAG_NAMES 17 +#define MAX_SHIP_FLAG_NAMES 18 extern ship_flag_name Ship_flag_names[]; // states for the flags variable within the ship structure @@ -505,6 +505,7 @@ #define SF2_WEAPONS_LOCKED (1<<25) // Karajorma - Prevents the player from changing the weapons on the ship on the loadout screen #define SF2_SHIP_SELECTIVE_LINKING (1<<26) // RSAXVC - Allow pilot to pick firing configuration #define SF2_SCRAMBLE_MESSAGES (1<<27) // Goober5000 - all messages sent from this ship appear scrambled +#define SF2_NO_COLLIDE (1<<28) // FUBAR - Removes the ship from collision checks // If any of these bits in the ship->flags are set, ignore this ship when targeting extern int TARGET_SHIP_IGNORE_FLAGS; |
|
I tested the patch and it does what it should do. There was an issue with the layout of the checkbox which I fixed in the uploaded patch. |
|
Ok, I guess my only remaining concern is that the last chunk in ship.cpp does not break whatever behavior was the reason for the addition of the old code in that spot. That was added after FUBAR's original patch, so I would like to make sure it doesn't hurt the original purpose. I'm hoping it's just a clean behavior replacement, but maybe instead of replacing it, both should be there? |
|
I checked the lines I removed and it looks like that was a duplicated line created by the merge conflict. I searched for instances of shipp->flags2 |= SF2_NO_COLLIDE; in the original patch and there is exactly one spot where that should be present and that is also the case in the current patch version. |
|
What I mean is, that third chunk in ship.cpp, it essentially overwrites r10181 with FUBAR's patch, which was made before those lines existed. Since the if-else lines are actually the same, I'm guessing that using sp->flags2 instead of Objects[sp->objnum].flags should work fine, but wanted to make sure. |
|
I didn't notice that but it should be alright as those flags essentially do the same thing (although I'm not entirely sure why there needs to be a new ship flag if there is an object flag that already does this). |
|
From the description: "It allows turning off collisions on ships without the need to make a separate .pof" |
|
There is an object flag that controls if an object collides (OF_COLLIDES) but just setting that would not suffice so I guess a new ship flag works too. |
|
After looking at code again it seems like the ship flag isn't needed at all. Everything can be implemented with the mentioned object flag. I have uploaded a new patch that contains these changes. |
|
I've attached a version of your last patch that removes the project file change, and strips the Windows line endings from the headers. I like this approach a lot better; on #scp, conversation came to the conclusion that the SIF_NO_COLLIDE checks in collideshipship.cpp and collideshipweapon.cpp were now useless, but I wasn't sure of the correct solution. So far, I have only tested this patch inasmuch as it compiles and runs. |
|
I have tested the code with a simple test mission and everything works as expected. |
|
2887_cleaned.patch (11,594 bytes)
Index: code/ai/aiturret.cpp =================================================================== --- code/ai/aiturret.cpp (revision 10966) +++ code/ai/aiturret.cpp (working copy) @@ -479,7 +479,7 @@ } // don't shoot at ships without collision check - if (sip->flags & SIF_NO_COLLIDE) { + if (!(objp->flags & OF_COLLIDES)) { return 0; } Index: code/fred2/fred.rc =================================================================== --- code/fred2/fred.rc (revision 10966) +++ code/fred2/fred.rc (working copy) @@ -1837,6 +1837,7 @@ CONTROL "Does Not Move",IDC_IMMOBILE,"Button",BS_3STATE | WS_TABSTOP,7,274,66,10 CONTROL "Cloaked",IDC_CLOAKED,"Button",BS_3STATE | WS_TABSTOP,165,167,42,10 CONTROL "Scramble Messages",IDC_SCRAMBLE_MESSAGES,"Button",BS_3STATE | WS_TABSTOP,165,177,79,10 + CONTROL "No Collisions",IDC_NO_COLLIDE,"Button",BS_3STATE | WS_TABSTOP,165,188,66,10 END IDD_ADD_VARIABLE DIALOG 0, 0, 422, 102 Index: code/fred2/missionsave.cpp =================================================================== --- code/fred2/missionsave.cpp (revision 10966) +++ code/fred2/missionsave.cpp (working copy) @@ -1742,6 +1742,8 @@ fout(" \"weapons-locked\""); if (shipp->flags2 & SF2_SCRAMBLE_MESSAGES) fout(" \"scramble-messages\""); + if (!(objp->flags & OF_COLLIDES)) + fout(" \"no-collide\""); fout(" )"); } // ----------------------------------------------------------- Index: code/fred2/resource.h =================================================================== --- code/fred2/resource.h (revision 10966) +++ code/fred2/resource.h (working copy) @@ -1179,6 +1179,7 @@ #define IDC_MISSION_LOG_LAST_REPEAT 1640 #define IDC_MISSION_LOG_1ST_TRIGGER 1641 #define IDC_MISSION_LOG_LAST_TRIGGER 1642 +#define IDC_NO_COLLIDE 1643 #define ID_FILE_MISSIONNOTES 32771 #define ID_DUPLICATE 32774 #define ID_VIEW_ROTATE 32775 @@ -1471,7 +1472,7 @@ #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 320 #define _APS_NEXT_COMMAND_VALUE 33098 -#define _APS_NEXT_CONTROL_VALUE 1643 +#define _APS_NEXT_CONTROL_VALUE 1644 #define _APS_NEXT_SYMED_VALUE 105 #endif #endif Index: code/fred2/shipflagsdlg.cpp =================================================================== --- code/fred2/shipflagsdlg.cpp (revision 10966) +++ code/fred2/shipflagsdlg.cpp (working copy) @@ -74,6 +74,7 @@ DDX_Control(pDX, IDC_HIDE_SHIP_NAME, m_hide_ship_name); DDX_Control(pDX, IDC_DISABLE_ETS, m_disable_ets); DDX_Control(pDX, IDC_CLOAKED, m_cloaked); + DDX_Control(pDX, IDC_NO_COLLIDE, m_no_collide); DDX_Control(pDX, IDC_SET_CLASS_DYNAMICALLY, m_set_class_dynamically); DDX_Control(pDX, IDC_SCRAMBLE_MESSAGES, m_scramble_messages); //}}AFX_DATA_MAP @@ -140,6 +141,7 @@ ON_BN_CLICKED(IDC_DISABLE_ETS, OnDisableETS) ON_BN_CLICKED(IDC_CLOAKED, OnCloaked) ON_BN_CLICKED(IDC_SCRAMBLE_MESSAGES, OnScrambleMessages) + ON_BN_CLICKED(IDC_NO_COLLIDE, OnNoCollide) //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -161,7 +163,7 @@ int toggle_subsystem_scanning = 0, scannable = 0, kamikaze = 0, no_dynamic = 0, red_alert_carry = 0; int special_warpin = 0, disable_messages = 0, guardian = 0, vaporize = 0, stealth = 0, friendly_stealth_invisible = 0; int no_death_scream = 0, always_death_scream = 0, scramble_messages = 0; - int nav_carry = 0, nav_needslink = 0, hide_ship_name = 0, set_class_dynamically = 0, no_ets = 0, cloaked = 0; + int nav_carry = 0, nav_needslink = 0, hide_ship_name = 0, set_class_dynamically = 0, no_ets = 0, cloaked = 0, no_collide = 0; object *objp; ship *shipp; @@ -210,6 +212,7 @@ no_ets = (shipp->flags2 & SF2_NO_ETS) ? 1 : 0; cloaked = (shipp->flags2 & SF2_CLOAKED) ? 1 : 0; scramble_messages = (shipp->flags2 & SF2_SCRAMBLE_MESSAGES) ? 1 : 0; + no_collide = (objp->flags & OF_COLLIDES) ? 0 : 1; destroy_before_mission = (shipp->flags & SF_KILL_BEFORE_MISSION) ? 1 : 0; m_destroy_value.init(shipp->final_death_time); @@ -270,6 +273,7 @@ no_ets = tristate_set(shipp->flags2 & SF2_NO_ETS, no_ets); cloaked = tristate_set(shipp->flags2 & SF2_CLOAKED, cloaked); scramble_messages = tristate_set(shipp->flags2 & SF2_SCRAMBLE_MESSAGES, scramble_messages); + no_collide = tristate_set(!(objp->flags & OF_COLLIDES), no_collide); // check the final death time and set the internal variable according to whether or not // the final_death_time is set. Also, the value in the edit box must be set if all the @@ -344,6 +348,7 @@ m_disable_ets.SetCheck(no_ets); m_cloaked.SetCheck(cloaked); m_scramble_messages.SetCheck(scramble_messages); + m_no_collide.SetCheck(no_collide); m_kdamage.setup(IDC_KDAMAGE, this); m_destroy_value.setup(IDC_DESTROY_VALUE, this); @@ -961,6 +966,22 @@ break; } + switch (m_no_collide.GetCheck()) { + case 1: + if ( objp->flags & OF_COLLIDES ) + set_modified(); + + objp->flags &= ~OF_COLLIDES; + break; + + case 0: + if (!(objp->flags & OF_COLLIDES)) + set_modified(); + + objp->flags |= OF_COLLIDES; + break; + } + switch (m_guardian.GetCheck()) { case 1: if ( !(shipp->ship_guardian_threshold) ) @@ -1410,3 +1431,12 @@ m_scramble_messages.SetCheck(1); } } + +void ship_flags_dlg::OnNoCollide() +{ + if (m_no_collide.GetCheck() == 1) { + m_no_collide.SetCheck(0); + } else { + m_no_collide.SetCheck(1); + } +} Index: code/fred2/shipflagsdlg.h =================================================================== --- code/fred2/shipflagsdlg.h (revision 10966) +++ code/fred2/shipflagsdlg.h (working copy) @@ -65,6 +65,7 @@ CButton m_hide_ship_name; CButton m_disable_ets; CButton m_cloaked; + CButton m_no_collide; CButton m_set_class_dynamically; CButton m_scramble_messages; @@ -126,6 +127,7 @@ afx_msg void OnDisableETS(); afx_msg void OnCloaked(); afx_msg void OnScrambleMessages(); + afx_msg void OnNoCollide(); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; Index: code/mission/missionparse.cpp =================================================================== --- code/mission/missionparse.cpp (revision 10966) +++ code/mission/missionparse.cpp (working copy) @@ -311,6 +311,7 @@ "ship-locked", "weapons-locked", "scramble-messages", + "no-collide", }; char *Mission_event_log_flags[MAX_MISSION_EVENT_LOG_FLAGS] = { @@ -2582,6 +2583,12 @@ if (parse_flags2 & P2_SF2_SCRAMBLE_MESSAGES) shipp->flags2 |= SF2_SCRAMBLE_MESSAGES; + + // Make sure that the correct flag is set in any case + if (parse_flags2 & P2_OF_NO_COLLIDE) + obj_set_flags(objp, objp->flags & ~OF_COLLIDES); + else + obj_set_flags(objp, objp->flags | OF_COLLIDES); } void fix_old_special_explosions(p_object *p_objp, int variable_index) Index: code/mission/missionparse.h =================================================================== --- code/mission/missionparse.h (revision 10966) +++ code/mission/missionparse.h (working copy) @@ -487,7 +487,7 @@ // same caveat: This list of bitfield indicators MUST correspond EXACTLY // (i.e., order and position must be the same) to its counterpart in MissionParse.cpp!!!! -#define MAX_PARSE_OBJECT_FLAGS_2 23 +#define MAX_PARSE_OBJECT_FLAGS_2 24 #define P2_SF2_PRIMITIVE_SENSORS (1<<0) #define P2_SF2_NO_SUBSPACE_DRIVE (1<<1) @@ -512,6 +512,7 @@ #define P2_SF2_SHIP_LOCKED (1<<20) #define P2_SF2_WEAPONS_LOCKED (1<<21) #define P2_SF2_SCRAMBLE_MESSAGES (1<<22) +#define P2_OF_NO_COLLIDE (1<<23) // This actually changes the OF_COLLIDES object flag // and again: these flags do not appear in the array //#define blah (1<<28) Index: code/object/collideshipship.cpp =================================================================== --- code/object/collideshipship.cpp (revision 10966) +++ code/object/collideshipship.cpp (working copy) @@ -172,15 +172,6 @@ } } - // If either of these objects doesn't get collision checks, abort. - if (heavy_sip->flags & SIF_NO_COLLIDE) { - return 0; - } - - if (light_sip->flags & SIF_NO_COLLIDE) { - return 0; - } - // Set up model_collide info mc_info mc; mc_info_init(&mc); Index: code/object/collideshipweapon.cpp =================================================================== --- code/object/collideshipweapon.cpp (revision 10966) +++ code/object/collideshipweapon.cpp (working copy) @@ -140,11 +140,7 @@ // Make ships that are warping in not get collision detection done if ( shipp->flags & SF_ARRIVING ) return 0; - - // If either of these objects doesn't get collision checks, abort. - if (Ship_info[shipp->ship_info_index].flags & SIF_NO_COLLIDE) - return 0; - + // Return information for AI to detect incoming fire. // Could perhaps be done elsewhere at lower cost --MK, 11/7/97 float dist = vm_vec_dist_quick(&ship_objp->pos, &weapon_objp->pos); Index: code/object/object.cpp =================================================================== --- code/object/object.cpp (revision 10966) +++ code/object/object.cpp (working copy) @@ -104,6 +104,7 @@ {OF_LASER_PROTECTED, "laser-protect-ship", 1, }, {OF_MISSILE_PROTECTED, "missile-protect-ship", 1, }, {OF_IMMOBILE, "immobile", 1, }, + {OF_COLLIDES, "collides", 1, }, }; // all we need to set are the pointers, but type, parent, and instance are useful to set as well Index: code/object/object.h =================================================================== --- code/object/object.h (revision 10966) +++ code/object/object.h (working copy) @@ -132,7 +132,7 @@ int flag_list; } obj_flag_name; -#define MAX_OBJECT_FLAG_NAMES 9 +#define MAX_OBJECT_FLAG_NAMES 10 extern obj_flag_name Object_flag_names[]; struct dock_instance; Index: code/parse/sexp.cpp =================================================================== --- code/parse/sexp.cpp (revision 10966) +++ code/parse/sexp.cpp (working copy) @@ -12807,9 +12807,9 @@ { // set or clear? if (set_flag) - oswpt.objp->flags |= object_flag; + obj_set_flags(oswpt.objp, oswpt.objp->flags | object_flag); else - oswpt.objp->flags &= ~object_flag; + obj_set_flags(oswpt.objp, oswpt.objp->flags & ~object_flag); } // handle ETS when modifying shields Index: code/ship/ship.cpp =================================================================== --- code/ship/ship.cpp (revision 10966) +++ code/ship/ship.cpp (working copy) @@ -5138,6 +5138,11 @@ if (sip->flags & SIF_SHIP_CLASS_DONT_COLLIDE_INVIS) shipp->flags2 |= SF2_DONT_COLLIDE_INVIS; + if (sip->flags & SIF_NO_COLLIDE) + obj_set_flags(objp, objp->flags & ~OF_COLLIDES); + else + obj_set_flags(objp, objp->flags | OF_COLLIDES); + if (sip->flags2 & SIF2_NO_ETS) shipp->flags2 |= SF2_NO_ETS; @@ -9423,10 +9428,10 @@ else if (sip_orig->flags & SIF_SHIP_CLASS_DONT_COLLIDE_INVIS) // changing FROM a don't-collide-invisible ship class sp->flags2 &= ~SF2_DONT_COLLIDE_INVIS; - if (sip->flags & SIF_NO_COLLIDE) // changing TO a no_collide ship - Objects[sp->objnum].flags &= ~OF_COLLIDES; - else if (sip_orig->flags & SIF_NO_COLLIDE) // changing FROM a no_collide ship - Objects[sp->objnum].flags |= OF_COLLIDES; + if (sip->flags & SIF_NO_COLLIDE) // changing TO a no-collision ship class + objp->flags &= ~OF_COLLIDES; + else if (sip_orig->flags & SIF_NO_COLLIDE) // changing FROM a no-collision ship class + objp->flags |= OF_COLLIDES; if (sip->flags2 & SIF2_NO_ETS) sp->flags2 |= SF2_NO_ETS; |
|
|
|
Tested fine for me as well, except for FRED which I can't test. The non-FRED code looks fine to me as well. |
|
Fix committed to trunk@10969. |
|
Reopening temporarily. I haven't looked at the rest of the patch but there are two minor issues in ship.cpp... 1) I didn't realize about the obj_set_flags function when I committed r10181, but it looks like it is necessary in change_ship_type(). This is because it can be called during a mission due to the change-ship-class sexp. 2) There is a minor bug in the if() logic; the no-collision flag should only be removed if we are changing FROM a no-collision ship class AND the new ship class is not also a no-collision ship. |
|
If changing from a no-collide class to a no-collide class, the first half of the if-else will catch it. |
|
Good catch about 1) but for 2) I agree with MageKing17, the current if-else should handle that. i.e. 4x possible combinations 2x cases catch if (remove flag) 1x case catches else-if (add flag) 1x case catches neither and uses the original flag (which will be on) |
|
Derp, you both are correct. And I had already puzzled that out when I created the if() statement in the first place. >.< I've committed a patch for the first item, so I'll re-resolve the ticket. |
|
Axem reported that no-collide ship classes were broken; apparently, if missionparse.cpp didn't see the no-collide flag, it assumed the object was supposed to collide, instead of using the state of the flag as set in ship_set(). Patch attached that removes the "else" branch and fixes this issue (although now there's no way to turn collision on for a no-collide ship class... which may be beyond the scope of this issue anyway). |
|
missionparse.cpp.patch (509 bytes)
Index: code/mission/missionparse.cpp =================================================================== --- code/mission/missionparse.cpp (revision 10978) +++ code/mission/missionparse.cpp (working copy) @@ -2587,8 +2587,6 @@ // Make sure that the correct flag is set in any case if (parse_flags2 & P2_OF_NO_COLLIDE) obj_set_flags(objp, objp->flags & ~OF_COLLIDES); - else - obj_set_flags(objp, objp->flags | OF_COLLIDES); } void fix_old_special_explosions(p_object *p_objp, int variable_index) |
|
Well, m!m, can you explain the purpose of the "// Make sure that the correct flag is set in any case" block in your patch? |
|
I don't know why I added it and it's obviously wrong so the else branch should be removed. |
|
Patch from MageKing17 committed in r10989 |
fs2open: trunk r10969 2014-08-05 06:06 Ported: N/A Details Diff |
From FUBAR-BDHR, chief1983, m!m and MageKing17: Fix for Mantis 2887: Additional workaround for mantis 2693 |
Affected Issues 0002887 |
|
mod - /trunk/fs2_open/code/ai/aiturret.cpp | Diff File | ||
mod - /trunk/fs2_open/code/fred2/shipflagsdlg.cpp | Diff File | ||
mod - /trunk/fs2_open/code/object/collideshipship.cpp | Diff File | ||
mod - /trunk/fs2_open/code/parse/sexp.cpp | Diff File | ||
mod - /trunk/fs2_open/code/object/object.cpp | Diff File | ||
mod - /trunk/fs2_open/code/mission/missionparse.cpp | Diff File | ||
mod - /trunk/fs2_open/code/fred2/resource.h | Diff File | ||
mod - /trunk/fs2_open/code/fred2/shipflagsdlg.h | Diff File | ||
mod - /trunk/fs2_open/code/object/collideshipweapon.cpp | Diff File | ||
mod - /trunk/fs2_open/code/object/object.h | Diff File | ||
mod - /trunk/fs2_open/code/fred2/missionsave.cpp | Diff File | ||
mod - /trunk/fs2_open/code/mission/missionparse.h | Diff File | ||
mod - /trunk/fs2_open/code/fred2/fred.rc | Diff File | ||
mod - /trunk/fs2_open/projects/MSVC_2013/Freespace2.vcxproj | Diff File | ||
mod - /trunk/fs2_open/code/ship/ship.cpp | Diff File | ||
fs2open: trunk r10974 2014-08-06 22:29 Ported: N/A Details Diff |
Additional tweak for Mantis 0002887 and follow-up to r10181: when modifying OF_COLLIDE, need to call obj_set_flags for collision code support |
Affected Issues 0002887 |
|
mod - /trunk/fs2_open/code/ship/ship.cpp | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2013-06-03 22:05 | FUBAR-BDHR | New Issue | |
2013-06-03 22:05 | FUBAR-BDHR | Status | new => assigned |
2013-06-03 22:05 | FUBAR-BDHR | Assigned To | => FUBAR-BDHR |
2013-06-03 22:05 | FUBAR-BDHR | File Added: 2693_sexp_updated.patch | |
2013-06-03 22:05 | FUBAR-BDHR | Status | assigned => code review |
2014-07-09 21:45 | chief1983 | Note Added: 0016051 | |
2014-07-09 22:11 | chief1983 | File Added: 2887_updated.diff | |
2014-07-09 22:17 | chief1983 | Note Added: 0016052 | |
2014-07-10 14:52 | chief1983 | Note Added: 0016060 | |
2014-07-26 09:32 | m_m | Note Added: 0016134 | |
2014-07-26 09:33 | m_m | File Added: 2887_updated2.diff | |
2014-07-27 01:55 | chief1983 | Note Added: 0016135 | |
2014-07-27 09:23 | MageKing17 | File Added: 2887.patch | |
2014-07-27 09:23 | MageKing17 | Note Added: 0016137 | |
2014-07-30 12:52 | m_m | File Added: 2887_fixed.patch | |
2014-07-30 12:53 | m_m | Note Added: 0016150 | |
2014-07-30 14:07 | chief1983 | Note Added: 0016151 | |
2014-07-30 14:23 | m_m | Note Added: 0016152 | |
2014-07-30 14:35 | chief1983 | Note Added: 0016153 | |
2014-07-30 14:45 | m_m | Note Added: 0016154 | |
2014-07-30 16:27 | MageKing17 | Note Added: 0016155 | |
2014-07-30 16:37 | m_m | Note Added: 0016156 | |
2014-08-03 14:28 | m_m | Note Added: 0016166 | |
2014-08-03 14:28 | m_m | File Added: 2887_noShipFlag.patch | |
2014-08-03 14:43 | MageKing17 | File Added: 2887_cleaned.patch | |
2014-08-03 15:00 | MageKing17 | Note Added: 0016167 | |
2014-08-03 15:04 | m_m | Note Added: 0016168 | |
2014-08-03 15:51 | MageKing17 | File Deleted: 2887_cleaned.patch | |
2014-08-03 15:51 | MageKing17 | File Added: 2887_cleaned.patch | |
2014-08-03 15:54 | MageKing17 | File Deleted: 2887_cleaned.patch | |
2014-08-03 15:54 | MageKing17 | File Added: 2887_cleaned.patch | |
2014-08-03 15:56 | m_m | File Deleted: 2887_noShipFlag.patch | |
2014-08-04 19:48 | m_m | File Added: NoCollideTest.fs2 | |
2014-08-05 09:33 | niffiwan | Note Added: 0016169 | |
2014-08-05 09:39 | m_m | Changeset attached | => fs2open trunk r10969 |
2014-08-05 09:39 | m_m | Note Added: 0016170 | |
2014-08-05 09:39 | m_m | Status | code review => resolved |
2014-08-05 09:39 | m_m | Resolution | open => fixed |
2014-08-06 03:29 | Goober5000 | Note Added: 0016179 | |
2014-08-06 03:29 | Goober5000 | Status | resolved => code review |
2014-08-06 03:29 | Goober5000 | Resolution | fixed => reopened |
2014-08-06 05:33 | MageKing17 | Note Added: 0016180 | |
2014-08-06 21:09 | niffiwan | Note Added: 0016181 | |
2014-08-07 02:01 | Goober5000 | Changeset attached | => fs2open trunk r10974 |
2014-08-07 02:02 | Goober5000 | Note Added: 0016182 | |
2014-08-07 02:02 | Goober5000 | Status | code review => resolved |
2014-08-07 02:02 | Goober5000 | Resolution | reopened => fixed |
2014-08-07 02:02 | Goober5000 | Fixed in Version | => 3.7.2 |
2014-08-10 17:49 | MageKing17 | Note Added: 0016199 | |
2014-08-10 17:49 | MageKing17 | Status | resolved => feedback |
2014-08-10 17:49 | MageKing17 | Resolution | fixed => reopened |
2014-08-10 17:50 | MageKing17 | File Added: missionparse.cpp.patch | |
2014-08-10 17:50 | MageKing17 | Status | feedback => code review |
2014-08-10 17:50 | MageKing17 | Resolution | reopened => open |
2014-08-11 00:37 | Goober5000 | Note Added: 0016200 | |
2014-08-11 07:32 | m_m | Note Added: 0016202 | |
2014-08-13 02:16 | niffiwan | Note Added: 0016204 | |
2014-08-13 02:16 | niffiwan | Status | code review => resolved |
2014-08-13 02:16 | niffiwan | Resolution | open => fixed |