Skip to content

Commit

Permalink
Separated the enemy property "can be in-fought with" from the MF2_BOS…
Browse files Browse the repository at this point in the history
…S flag so that it can be attributed independently (implemented for WolfTC).

Fixed bug #1545024 Cyberdemon infights.
  • Loading branch information
danij committed Dec 27, 2006
1 parent 22da0a5 commit 7eccbce
Show file tree
Hide file tree
Showing 23 changed files with 89 additions and 16 deletions.
14 changes: 14 additions & 0 deletions doomsday/plugins/common/src/p_saveg.c
Expand Up @@ -708,6 +708,7 @@ static void SV_WriteMobj(mobj_t *mobj)
// 6: Added flags 2 in jDoom
// 6: Added damage
// 7: Added generator in jHeretic
// 7: Added flags3
SV_WriteByte(MOBJ_SAVEVERSION);

// A version 2 features: archive number and target.
Expand Down Expand Up @@ -792,6 +793,7 @@ static void SV_WriteMobj(mobj_t *mobj)

SV_WriteLong(mo.damage);
SV_WriteLong(mo.flags2);
SV_WriteLong(mo.flags3);
#ifdef __JHERETIC__
SV_WriteLong(mo.special1);
SV_WriteLong(mo.special2);
Expand Down Expand Up @@ -850,6 +852,14 @@ void SV_UpdateReadMobjFlags(mobj_t *mo, int ver)
mo->flags2 = mo->info->flags2;
#endif
}

if(ver < 7)
{
// flags3 was introduced in ver 7 so all we can do is to
// apply the values as set in the mobjinfo.
// Non-persistent flags might screw things up a lot worse otherwise.
mo->flags3 = mo->info->flags3;
}
}

static int SV_ReadMobj(thinker_t *th)
Expand Down Expand Up @@ -997,6 +1007,10 @@ static int SV_ReadMobj(thinker_t *th)
mo->flags2 = SV_ReadLong();
#endif

if(ver >= 7)
mo->flags3 = SV_ReadLong();
// Else flags3 will be applied from the defs.

#if __JHERETIC__
mo->special1 = SV_ReadLong();
mo->special2 = SV_ReadLong();
Expand Down
2 changes: 2 additions & 0 deletions doomsday/plugins/doom64tc/defs/objects.ded
Expand Up @@ -61,6 +61,8 @@ Flag { ID = "mf2_telestomp"; Value = 0x40000; }
Flag { ID = "mf2_floatbob"; Value = 0x80000; }
Flag { ID = "mf2_dontdraw"; Value = 0x100000; }

Flag { ID = "mf3_noinfight"; Value = 0x1; }

Thing {
ID = "PLAYER";
DoomEd number = -1;
Expand Down
5 changes: 5 additions & 0 deletions doomsday/plugins/doom64tc/include/p_mobj.h
Expand Up @@ -218,6 +218,10 @@
#define MF2_FLOATBOB 0x00080000 // (p) use float bobbing z movement
#define MF2_DONTDRAW 0X00100000 // don't generate a vissprite

// --- mobj.flags3 ---

#define MF3_NOINFIGHT 0x00000001 // Mobj will never be targeted for in-fighting

// --- mobj.intflags ---
// Internal mobj flags cannot be set using an external definition.

Expand All @@ -241,6 +245,7 @@ typedef struct mobj_s {
int damage; // For missiles
int flags;
int flags2;
int flags3;
int health;

// Movement direction, movement generation (zig-zagging).
Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/doom64tc/src/p_inter.c
Expand Up @@ -1179,7 +1179,7 @@ void P_DamageMobj2(mobj_t *target, mobj_t *inflictor, mobj_t *source,
target->reactiontime = 0; // we're awake now...

if(source &&
(!target->threshold && !(source->flags2 & MF2_BOSS)) && source != target)
(!target->threshold && !(source->flags3 & MF3_NOINFIGHT)) && source != target)
{
// if not intent on another player,
// chase after this one
Expand Down
1 change: 1 addition & 0 deletions doomsday/plugins/doom64tc/src/p_mobj.c
Expand Up @@ -977,6 +977,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
mobj->height = info->height;
mobj->flags = info->flags;
mobj->flags2 = info->flags2;
mobj->flags3 = info->flags3;

mobj->damage = info->damage;

Expand Down
2 changes: 2 additions & 0 deletions doomsday/plugins/jdoom/defs/objects.ded
Expand Up @@ -57,6 +57,8 @@ Flag { ID = "mf2_telestomp"; Value = 0x40000; }
Flag { ID = "mf2_floatbob"; Value = 0x80000; }
Flag { ID = "mf2_dontdraw"; Value = 0x100000; }

Flag { ID = "mf3_noinfight"; Value = 0x1; }

Thing {
ID = "PLAYER";
DoomEd number = -1;
Expand Down
9 changes: 7 additions & 2 deletions doomsday/plugins/jdoom/include/p_mobj.h
Expand Up @@ -19,7 +19,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301 USA
*/

Expand Down Expand Up @@ -212,10 +212,14 @@
#define MF2_FLOATBOB 0x00080000 // (p) use float bobbing z movement
#define MF2_DONTDRAW 0X00100000 // don't generate a vissprite

// --- mobj.flags3 ---

#define MF3_NOINFIGHT 0x00000001 // Mobj will never be targeted for in-fighting

// --- mobj.intflags ---
// Internal mobj flags cannot be set using an external definition.

#define MIF_FALLING 0x00000001 // $dropoff_fix: Object is falling from a ledge.
#define MIF_FALLING 0x00000001 // $dropoff_fix: Object is falling from a ledge

/*
* end mobj flags
Expand All @@ -234,6 +238,7 @@ typedef struct mobj_s {
int damage; // For missiles
int flags;
int flags2;
int flags3;
int health;

// Movement direction, movement generation (zig-zagging).
Expand Down
12 changes: 7 additions & 5 deletions doomsday/plugins/jdoom/src/p_enemy.c
Expand Up @@ -1229,13 +1229,15 @@ void C_DECL A_VileChase(mobj_t *actor)

P_SetMobjState(corpsehit, info->raisestate);

if (cfg.raiseghosts) // DJS - raiseghosts
if(cfg.raiseghosts) // DJS - raiseghosts
{
corpsehit->height <<= 2;
} else {
corpsehit->height = info->height;
corpsehit->radius = info->radius;
} // raiseghosts
}
else
{
corpsehit->height = info->height;
corpsehit->radius = info->radius;
} // raiseghosts

corpsehit->flags = info->flags;
corpsehit->health = info->spawnhealth;
Expand Down
5 changes: 3 additions & 2 deletions doomsday/plugins/jdoom/src/p_inter.c
Expand Up @@ -832,7 +832,7 @@ void P_DamageMobj2(mobj_t *target, mobj_t *inflictor, mobj_t *source,
// We're done here.
return;
}

// Clients can't harm anybody.
if(IS_CLIENT)
return;
Expand Down Expand Up @@ -988,13 +988,14 @@ void P_DamageMobj2(mobj_t *target, mobj_t *inflictor, mobj_t *source,
target->reactiontime = 0; // we're awake now...

if(source &&
((!target->threshold && !(source->flags2 & MF2_BOSS))|| target->type == MT_VILE) &&
((!target->threshold && !(source->flags3 & MF3_NOINFIGHT))|| target->type == MT_VILE) &&
source != target && source->type != MT_VILE)
{
// if not intent on another player,
// chase after this one
target->target = source;
target->threshold = BASETHRESHOLD;

if(target->state == &states[target->info->spawnstate] &&
target->info->seestate != S_NULL)
P_SetMobjState(target, target->info->seestate);
Expand Down
1 change: 1 addition & 0 deletions doomsday/plugins/jdoom/src/p_mobj.c
Expand Up @@ -849,6 +849,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
mobj->height = info->height;
mobj->flags = info->flags;
mobj->flags2 = info->flags2;
mobj->flags3 = info->flags3;

mobj->damage = info->damage;

Expand Down
5 changes: 5 additions & 0 deletions doomsday/plugins/jheretic/defs/objects.ded
Expand Up @@ -60,6 +60,8 @@ Flag { ID = "mf2_telestomp"; Value = 0x40000; }
Flag { ID = "mf2_floatbob"; Value = 0x80000; }
Flag { ID = "mf2_dontdraw"; Value = 0x100000; }

Flag { ID = "mf3_noinfight"; Value = 0x1; }

Thing {
ID = "MISC0";
DoomEd number = 81;
Expand Down Expand Up @@ -3436,6 +3438,7 @@ Thing {
Mass = 800;
Flags = "mf_solid mf_shootable mf_countkill";
Flags2 = "mf2_footclip mf2_passmobj mf2_boss";
Flags3 = "mf3_noinfight";
}

Thing {
Expand Down Expand Up @@ -3490,6 +3493,7 @@ Thing {
Mass = 300;
Flags = "mf_solid mf_shootable mf_countkill mf_dropoff";
Flags2 = "mf2_footclip mf2_passmobj mf2_boss";
Flags3 = "mf3_noinfight";
}

Thing {
Expand Down Expand Up @@ -3621,6 +3625,7 @@ Thing {
Damage = 7;
Flags = "mf_solid mf_shootable mf_countkill mf_dropoff";
Flags2 = "mf2_footclip mf2_passmobj mf2_boss";
Flags3 = "mf3_noinfight";
}

Thing {
Expand Down
7 changes: 6 additions & 1 deletion doomsday/plugins/jheretic/include/p_mobj.h
Expand Up @@ -19,7 +19,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301 USA
*/

Expand Down Expand Up @@ -212,6 +212,10 @@
#define MF2_FLOATBOB 0x00080000 // (p) use float bobbing z movement
#define MF2_DONTDRAW 0X00100000 // don't generate a vissprite

// --- mobj.flags3 ---

#define MF3_NOINFIGHT 0x00000001 // Mobj will never be targeted for in-fighting

// --- mobj.intflags --- (added in MOBJ_SAVEVERSION 6)
// Internal mobj flags cannot be set using an external definition.

Expand All @@ -234,6 +238,7 @@ typedef struct mobj_s {
int damage; // For missiles
int flags;
int flags2; // Heretic flags
int flags3;
int special1; // Special info
int special2; // Special info
int health;
Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/jheretic/src/p_inter.c
Expand Up @@ -1353,7 +1353,7 @@ void P_DamageMobj2(mobj_t *target, mobj_t *inflictor, mobj_t *source,

// we're awake now...
target->reactiontime = 0;
if(!target->threshold && source && !(source->flags2 & MF2_BOSS) &&
if(!target->threshold && source && !(source->flags3 & MF3_NOINFIGHT) &&
!(target->type == MT_SORCERER2 && source->type == MT_WIZARD))
{
// Target actor is not intent on another actor,
Expand Down
1 change: 1 addition & 0 deletions doomsday/plugins/jheretic/src/p_mobj.c
Expand Up @@ -1067,6 +1067,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
mobj->height = info->height;
mobj->flags = info->flags;
mobj->flags2 = info->flags2;
mobj->flags3 = info->flags3;

// Let the engine know about solid objects.
if(mobj->flags & MF_SOLID)
Expand Down
6 changes: 6 additions & 0 deletions doomsday/plugins/jhexen/defs/objects.ded
Expand Up @@ -37,6 +37,7 @@ Flag { ID = "mf_local"; Value = 0x20000000; }
Flag { ID = "mf_brightexplode"; Value = 0x40000000; }
Flag { ID = "mf_viewalign"; Value = 0x80000000; }
Flag { ID = "mf_brightshadow"; Value = 0x60000; }

Flag { ID = "mf2_lograv"; Value = 0x1; }
Flag { ID = "mf2_windthrust"; Value = 0x2; }
Flag { ID = "mf2_floorbounce"; Value = 0x4; }
Expand Down Expand Up @@ -70,6 +71,8 @@ Flag { ID = "mf2_icedamage"; Value = 0x20000000; }
Flag { ID = "mf2_seekermissile"; Value = 0x40000000; }
Flag { ID = "mf2_reflective"; Value = 0x80000000; }

Flag { ID = "mf3_noinfight"; Value = 0x1; }

Thing {
ID = "MAPSPOT";
DoomEd number = 9001;
Expand Down Expand Up @@ -8173,6 +8176,7 @@ Thing {
Mass = 2147483647;
Flags = "mf_solid mf_shootable mf_countkill mf_float mf_nogravity mf_noblood";
Flags2 = "mf2_passmobj mf2_boss";
Flags3 = "mf3_noinfight";
}

Thing {
Expand Down Expand Up @@ -9290,6 +9294,7 @@ Thing {
Damage = 9;
Flags = "mf_solid mf_shootable mf_countkill mf_noblood";
Flags2 = "mf2_floorclip mf2_passmobj mf2_pushwall mf2_boss mf2_mcross";
Flags3 = "mf3_noinfight";
}

Thing {
Expand Down Expand Up @@ -9625,6 +9630,7 @@ Thing {
Damage = 15;
Flags = "mf_solid mf_shootable mf_countkill";
Flags2 = "mf2_floorclip mf2_pushwall mf2_mcross mf2_telestomp mf2_boss";
Flags3 = "mf3_noinfight";
}

Thing {
Expand Down
5 changes: 5 additions & 0 deletions doomsday/plugins/jhexen/include/h2def.h
Expand Up @@ -220,6 +220,7 @@ typedef struct mobj_s {
int damage; // For missiles
int flags;
int flags2; // Heretic flags
int flags3;
int special1; // Special info
int special2; // Special info
int health;
Expand Down Expand Up @@ -347,6 +348,10 @@ typedef struct mobj_s {
#define MF2_SEEKERMISSILE 0x40000000 // is a seeker (for reflection)
#define MF2_REFLECTIVE 0x80000000 // reflects missiles

// --- mobj.flags3 ---

#define MF3_NOINFIGHT 0x00000001 // Mobj will never be targeted for in-fighting

//=============================================================================

typedef enum {
Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/jhexen/src/p_inter.c
Expand Up @@ -2085,7 +2085,7 @@ void P_DamageMobj2(mobj_t *target, mobj_t *inflictor, mobj_t *source,
}
}
target->reactiontime = 0; // we're awake now...
if(!target->threshold && source && !(source->flags2 & MF2_BOSS) &&
if(!target->threshold && source && !(source->flags3 & MF3_NOINFIGHT) &&
!(target->type == MT_BISHOP) && !(target->type == MT_MINOTAUR))
{
// Target actor is not intent on another actor,
Expand Down
1 change: 1 addition & 0 deletions doomsday/plugins/jhexen/src/p_mobj.c
Expand Up @@ -1374,6 +1374,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
mobj->height = info->height;
mobj->flags = info->flags;
mobj->flags2 = info->flags2;
mobj->flags3 = info->flags3;
mobj->damage = info->damage; // this doesn't appear to actually be used
// see P_DamageMobj in P_inter.c

Expand Down
12 changes: 11 additions & 1 deletion doomsday/plugins/jhexen/src/sv_save.c
Expand Up @@ -1476,7 +1476,8 @@ void ArchiveMobj(mobj_t *original)
// 3: Added byte 'vistarget'
// 4: Added long 'tracer'
// 4: Added long 'lastenemy'
StreamOutByte(4);
// 5: Added flags3
StreamOutByte(5);

StreamOutLong(mo->pos[VX]);
StreamOutLong(mo->pos[VY]);
Expand All @@ -1498,6 +1499,7 @@ void ArchiveMobj(mobj_t *original)
StreamOutLong(mo->damage);
StreamOutLong(mo->flags);
StreamOutLong(mo->flags2);
StreamOutLong(mo->flags3);
StreamOutLong(mo->special1);
StreamOutLong(mo->special2);
StreamOutLong(mo->health);
Expand Down Expand Up @@ -1549,6 +1551,8 @@ void UnarchiveMobj(mobj_t *mo)
mo->damage = GET_LONG;
mo->flags = GET_LONG;
mo->flags2 = GET_LONG;
if(version >= 5)
mo->flags3 = GET_LONG;
mo->special1 = GET_LONG;
mo->special2 = GET_LONG;
mo->health = GET_LONG;
Expand Down Expand Up @@ -1872,6 +1876,12 @@ static void RestoreMobj(mobj_t *mobj, int ver)
default:
break;
}

// flags3 was introduced in ver 5 so all we can do is to
// apply the values as set in the mobjinfo.
// Non-persistent flags might screw things up a lot worse otherwise.
if(ver < 5)
mo->flags3 = mo->info->flags3;
}

//==========================================================================
Expand Down
2 changes: 2 additions & 0 deletions doomsday/plugins/wolftc/defs/objects.ded
Expand Up @@ -58,6 +58,8 @@ Flag { ID = "mf2_telestomp"; Value = 0x40000; }
Flag { ID = "mf2_floatbob"; Value = 0x80000; }
Flag { ID = "mf2_dontdraw"; Value = 0x100000; }

Flag { ID = "mf3_noinfight"; Value = 0x1; }

Thing {
ID = "PLAYER";
DoomEd number = -1;
Expand Down

0 comments on commit 7eccbce

Please sign in to comment.