diff --git a/src/m_menu.cpp b/src/m_menu.cpp index 49d5638ef..10ba3a336 100644 --- a/src/m_menu.cpp +++ b/src/m_menu.cpp @@ -196,6 +196,7 @@ static void M_ChangeClass (int choice); static void M_ChangeGender (int choice); static void M_ChangeSkin (int choice); static void M_ChangeAutoAim (int choice); +static void M_ChangeSwitchPickup (int choice); static void PickPlayerClass (); // EXTERNAL DATA DECLARATIONS ---------------------------------------------- @@ -203,6 +204,7 @@ static void PickPlayerClass (); EXTERN_CVAR (String, playerclass) EXTERN_CVAR (String, name) EXTERN_CVAR (Int, team) +EXTERN_CVAR(Bool, neverswitchonpickup) extern bool sendpause; extern int flagsvar; @@ -545,7 +547,8 @@ static oldmenuitem_t PlayerSetupMenu[] = { 2,0,'t',NULL,M_ChangeClass, CR_UNTRANSLATED}, { 2,0,'s',NULL,M_ChangeSkin, CR_UNTRANSLATED}, { 2,0,'e',NULL,M_ChangeGender, CR_UNTRANSLATED}, - { 2,0,'a',NULL,M_ChangeAutoAim, CR_UNTRANSLATED} + { 2,0,'a',NULL,M_ChangeAutoAim, CR_UNTRANSLATED}, + { 2,0,'p',NULL,M_ChangeSwitchPickup, CR_UNTRANSLATED} }; enum @@ -2360,6 +2363,13 @@ static void M_PlayerSetupDrawer () autoaim <= 2 ? "High" : autoaim <= 3 ? "Very High" : "Always", DTA_Clean, true, TAG_DONE); + + // Draw Switch on Pickup setting + x = SmallFont->StringWidth ("Switch on Pickup") + 8 + PSetupDef.x; + screen->DrawText (SmallFont, label, PSetupDef.x, PSetupDef.y + LINEHEIGHT*9+yo, "Switch on Pickup", DTA_Clean, true, TAG_DONE); + screen->DrawText (SmallFont, value, x, PSetupDef.y + LINEHEIGHT*9+yo, + neverswitchonpickup == false ? "Yes" : "No", + DTA_Clean, true, TAG_DONE); } // A 32x32 cloud rendered with Photoshop, plus some other filters @@ -2668,6 +2678,14 @@ static void M_ChangeAutoAim (int choice) autoaim = aim; } +static void M_ChangeSwitchPickup (int choice) +{ + if (!choice) + neverswitchonpickup = (neverswitchonpickup == 1) ? 0 : 1; + else + neverswitchonpickup = (neverswitchonpickup == 0) ? 1 : 0; +} + static void M_EditPlayerName (int choice) { // we are going to be intercepting all chars diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 28217f663..4aeb0595f 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -3033,6 +3033,7 @@ enum EACSFunctions ACSF_SoundSequenceOnPolyobj, ACSF_GetPolyobjX, ACSF_GetPolyobjY, + ACSF_CheckSight, }; int DLevelScript::SideFromID(int id, int side) @@ -3455,6 +3456,54 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args) } } return FIXED_MAX; + + case ACSF_CheckSight: + { + AActor *source; + AActor *dest; + + int flags = SF_IGNOREVISIBILITY; + + if (args[2] & 1) flags |= SF_IGNOREWATERBOUNDARY; + if (args[2] & 2) flags |= SF_SEEPASTBLOCKEVERYTHING | SF_SEEPASTSHOOTABLELINES; + + if (args[0] == 0) + { + source = (AActor *) activator; + + if (args[1] == 0) return 1; // [KS] I'm sure the activator can see itself. + + TActorIterator dstiter (args[1]); + + while ( (dest = dstiter.Next ()) ) + { + if (P_CheckSight(source, dest, flags)) return 1; + } + } + else + { + TActorIterator srciter (args[0]); + + if (args[1] == 0) dest = (AActor *) activator; + + while ( (source = srciter.Next ()) ) + { + if (args[1] != 0) + { + TActorIterator dstiter (args[1]); + while ( (dest = dstiter.Next ()) ) + { + if (P_CheckSight(source, dest, flags)) return 1; + } + } + else + { + if (P_CheckSight(source, dest, flags)) return 1; + } + } + } + return 0; + } default: break; diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 4330c204c..aacb45b18 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -826,6 +826,7 @@ enum CBA_Flags CBAF_AIMFACING = 1, CBAF_NORANDOM = 2, CBAF_EXPLICITANGLE = 4, + CBAF_NOPITCH = 8, }; DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomBulletAttack) @@ -852,7 +853,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomBulletAttack) if (!pufftype) pufftype = PClass::FindClass(NAME_BulletPuff); - bslope = P_AimLineAttack (self, bangle, MISSILERANGE); + if (!(Flags & CBAF_NOPITCH)) bslope = P_AimLineAttack (self, bangle, MISSILERANGE); S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM); for (i=0 ; i(self)->PlayAttacking2 (); - bslope = P_BulletSlope(self); + if (!(Flags & FBF_NOPITCH)) bslope = P_BulletSlope(self); bangle = self->angle; if (!PuffType) PuffType = PClass::FindClass(NAME_BulletPuff); diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index cbd91add6..05e77df2a 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -17,11 +17,13 @@ const int CMF_CHECKTARGETDEAD = 8; const int CBAF_AIMFACING = 1; const int CBAF_NORANDOM = 2; const int CBAF_EXPLICITANGLE = 4; +const int CBAF_NOPITCH = 8; // Flags for A_FireBullets const int FBF_USEAMMO = 1; const int FBF_NORANDOM = 2; const int FBF_EXPLICITANGLE = 4; +const int FBF_NOPITCH = 8; // Flags for A_SpawnItemEx const int SXF_TRANSFERTRANSLATION=1;