From 1fa73503eff445004d4eee2112017c25c42aeba1 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 17 Oct 2005 22:07:26 +0000 Subject: Fix "Monsters Infight" Subversion-branch: /trunk/chocolate-doom Subversion-revision: 212 --- src/deh_misc.c | 36 ++++++++++++++++++++++++++---------- src/deh_misc.h | 7 +++++-- src/p_map.c | 19 ++++++++++++++----- 3 files changed, 45 insertions(+), 17 deletions(-) diff --git a/src/deh_misc.c b/src/deh_misc.c index af0536c8..dcfe998e 100644 --- a/src/deh_misc.c +++ b/src/deh_misc.c @@ -1,7 +1,7 @@ // Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // -// $Id: deh_misc.c 211 2005-10-17 21:20:27Z fraggle $ +// $Id: deh_misc.c 212 2005-10-17 22:07:26Z fraggle $ // // Copyright(C) 2005 Simon Howard // @@ -21,6 +21,9 @@ // 02111-1307, USA. // // $Log$ +// Revision 1.8 2005/10/17 22:07:25 fraggle +// Fix "Monsters Infight" +// // Revision 1.7 2005/10/17 21:20:27 fraggle // Add note that the "Monsters Infight" setting is not supported. // @@ -161,13 +164,15 @@ int deh_idkfa_armor_class = 2; int deh_bfg_cells_per_shot = 40; -// BROKEN: // Dehacked: "Monsters infight" -// This presumably controls monster infighting. However, it is not clear -// what the values here are supposed to be. In dehacked, this appears -// off by default, and turning it on sets the value of this to "221". +// This controls whether monsters can harm other monsters of the same +// species. For example, whether an imp fireball will damage other +// imps. The value of this in dehacked patches is weird - '202' means +// off, while '221' means on. +// +// See PIT_CheckThing in p_map.c -//int deh_monsters_infight; +int deh_species_infighting = 0; static struct { @@ -210,18 +215,29 @@ static void DEH_MiscParseLine(deh_context_t *context, char *line, void *tag) return; } - // Monsters infighting does not work + ivalue = atoi(value); if (!strcasecmp(variable_name, "Monsters Infight")) { // See notes above. - DEH_Warning(context, "The Misc setting 'Monsters Infight' is not supported."); + if (ivalue == 202) + { + deh_species_infighting = 0; + } + else if (ivalue == 221) + { + deh_species_infighting = 1; + } + else + { + DEH_Warning(context, + "Invalid value for 'Monsters Infight': %i", ivalue); + } + return; } - ivalue = atoi(value); - for (i=0; i +#include "deh_misc.h" + #include "m_bbox.h" #include "m_random.h" #include "i_system.h" @@ -309,8 +314,8 @@ boolean PIT_CheckThing (mobj_t* thing) if (tmthing->z+tmthing->height < thing->z) return true; // underneath - if (tmthing->target && ( - tmthing->target->type == thing->type || + if (tmthing->target + && (tmthing->target->type == thing->type || (tmthing->target->type == MT_KNIGHT && thing->type == MT_BRUISER)|| (tmthing->target->type == MT_BRUISER && thing->type == MT_KNIGHT) ) ) { @@ -318,7 +323,11 @@ boolean PIT_CheckThing (mobj_t* thing) if (thing == tmthing->target) return true; - if (thing->type != MT_PLAYER) + // sdh: Add deh_species_infighting here. We can override the + // "monsters of the same species cant hurt each other" behavior + // through dehacked patches + + if (thing->type != MT_PLAYER && !deh_species_infighting) { // Explode, but do no damage. // Let players missile other players. -- cgit v1.2.3