Skip to content

Commit

Permalink
Classic DOOM - MBF21 - Implement most new Thing flags (MF2)
Browse files Browse the repository at this point in the history
  • Loading branch information
MadDeCoDeR committed Dec 17, 2024
1 parent f71e022 commit aaa3a7c
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 40 deletions.
10 changes: 7 additions & 3 deletions doomclassic/doom/d_deh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ typedef struct{
spritenum_t* spval;
statenum_t* stval;
ammotype_t* amval;
int64* llval;
uint64* llval;
}dehobj;

dehstr strval[] = {
Expand Down Expand Up @@ -458,12 +458,16 @@ void setThing(int pos, char* varname, int varval) {
{"Infighting group", MAXINT, NULL, &mobjinfo[pos].infightingGroup},
{"Projectile group", MAXINT, NULL, &mobjinfo[pos].projectileGroup},
{"Splash group", MAXINT, NULL, &mobjinfo[pos].splashGroup},
{"MBF21 Bits ",MAXINT,NULL, &mobjinfo[pos].flags2}
{"MBF21 Bits ",MAXINT,NULL, NULL, NULL, NULL, NULL, NULL, NULL, &mobjinfo[pos].flags2}
};
for (int i = 0; i < 27; i++) {
if (!idStr::Icmp(varname, tvars[i].name)) {
if (varval < tvars[i].limit) {
*tvars[i].ival = varval;
if (tvars[i].llval != NULL) {
*tvars[i].llval = varval;
} else {
*tvars[i].ival = varval;
}
return;
}
}
Expand Down
18 changes: 9 additions & 9 deletions doomclassic/doom/info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,7 @@ extern "C"
0, //infightingGroup
0, //projectileGroup
0, //splashGroup
0 //flags2
MF2_SHORTMRANGE | MF2_DMGIGNORED | MF2_NOTHRESHOLD //flags2
},

{ // MT_FIRE
Expand Down Expand Up @@ -1329,7 +1329,7 @@ extern "C"
0, //infightingGroup
0, //projectileGroup
0, //splashGroup
0 //flags2
MF2_RANGEHALF | MF2_LONGMELEE //flags2
},

{ // MT_TRACER
Expand Down Expand Up @@ -1419,7 +1419,7 @@ extern "C"
0, //infightingGroup
0, //projectileGroup
0, //splashGroup
0 //flags2
MF2_MAP07BOSS1 //flags2
},

{ // MT_FATSHOT
Expand Down Expand Up @@ -1629,7 +1629,7 @@ extern "C"
0, //infightingGroup
1, //projectileGroup
0, //splashGroup
0 //flags2
MF2_E1M8BOSS //flags2
},

{ // MT_BRUISERSHOT
Expand Down Expand Up @@ -1657,7 +1657,7 @@ extern "C"
MF_NOBLOCKMAP | MF_MISSILE | MF_DROPOFF | MF_NOGRAVITY, // flags
S_NULL, // raisestate
0, //infightingGroup
0, //projectileGroup
1, //projectileGroup
0, //splashGroup
0 //flags2
},
Expand Down Expand Up @@ -1719,7 +1719,7 @@ extern "C"
0, //infightingGroup
0, //projectileGroup
0, //splashGroup
0 //flags2
MF2_RANGEHALF //flags2
},

{ // MT_SPIDER
Expand Down Expand Up @@ -1749,7 +1749,7 @@ extern "C"
0, //infightingGroup
0, //projectileGroup
0, //splashGroup
0 //flags2
MF2_NORADIUSDMG | MF2_RANGEHALF | MF2_E3M8BOSS | MF2_E4M8BOSS | MF2_FULLVOLSOUNDS //flags2
},

{ // MT_BABY
Expand Down Expand Up @@ -1779,7 +1779,7 @@ extern "C"
0, //infightingGroup
0, //projectileGroup
0, //splashGroup
0 //flags2
MF2_MAP07BOSS2 //flags2
},

{ // MT_CYBORG
Expand Down Expand Up @@ -1809,7 +1809,7 @@ extern "C"
0, //infightingGroup
0, //projectileGroup
0, //splashGroup
0 //flags2
MF2_NORADIUSDMG | MF2_HIGHERMPROB | MF2_RANGEHALF | MF2_E2M8BOSS | MF2_E4M6BOSS | MF2_FULLVOLSOUNDS //flags2
},

{ // MT_PAIN
Expand Down
2 changes: 1 addition & 1 deletion doomclassic/doom/info.h
Original file line number Diff line number Diff line change
Expand Up @@ -1384,7 +1384,7 @@ typedef struct
int infightingGroup;
int projectileGroup;
int splashGroup;
int flags2;
uint64 flags2;

} mobjinfo_t;

Expand Down
35 changes: 15 additions & 20 deletions doomclassic/doom/p_enemy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,32 +206,29 @@ qboolean P_CheckMissileRange (mobj_t* actor)

dist >>= 16;

if (actor->type == MT_VILE)
if (actor->flags2 & MF2_SHORTMRANGE)
{
if (dist > 14*64)
return false; // too far away
}


if (actor->type == MT_UNDEAD)
if (actor->flags2 & MF2_LONGMELEE)
{
if (dist < 196)
return false; // close for fist attack
dist >>= 1;
}


if (actor->type == MT_CYBORG
|| actor->type == MT_SPIDER
|| actor->type == MT_SKULL)
if (actor->flags2 & MF2_RANGEHALF)
{
dist >>= 1;
}

if (dist > 200)
dist = 200;

if (actor->type == MT_CYBORG && dist > 160)
if (actor->flags2 & MF2_HIGHERMPROB && dist > 160)
dist = 160;

if (P_Random () < dist)
Expand Down Expand Up @@ -633,8 +630,7 @@ void A_Look (mobj_t* actor, void * )
break;
}

if (actor->type==MT_SPIDER
|| actor->type == MT_CYBORG)
if ((actor->flags2 & MF2_BOSS) || (actor->flags2 & MF2_FULLVOLSOUNDS))
{
// full volume
S_StartSound (NULL, sound);
Expand Down Expand Up @@ -1537,8 +1533,7 @@ void A_Scream (mobj_t* actor, void * )
}

// Check for bosses.
if (actor->type==MT_SPIDER
|| actor->type == MT_CYBORG)
if ((actor->flags2 & MF2_BOSS) || (actor->flags2 & MF2_FULLVOLSOUNDS))
{
// full volume
S_StartSound (NULL, sound);
Expand Down Expand Up @@ -1640,8 +1635,8 @@ void A_BossDeath (mobj_t* mo, void * )
return;

idLib::Printf("%d %d\n", ::g->gamemission, ::g->gamemap);
if ((mo->type != MT_FATSO)
&& (mo->type != MT_BABY))
if (!(mo->flags2 & MF2_MAP07BOSS1)
&& !(mo->flags2 & MF2_MAP07BOSS2))
return;
}
else
Expand All @@ -1652,23 +1647,23 @@ void A_BossDeath (mobj_t* mo, void * )
if (::g->gamemap != 8)
return;

if (mo->type != MT_BRUISER)
if (!(mo->flags2 & MF2_E1M8BOSS))
return;
break;

case 2:
if (::g->gamemap != 8)
return;

if (mo->type != MT_CYBORG)
if (!(mo->flags2 & MF2_E2M8BOSS))
return;
break;

case 3:
if (::g->gamemap != 8)
return;

if (mo->type != MT_SPIDER)
if (!(mo->flags2 & MF2_E3M8BOSS))
return;

break;
Expand All @@ -1677,12 +1672,12 @@ void A_BossDeath (mobj_t* mo, void * )
switch(::g->gamemap)
{
case 6:
if (mo->type != MT_CYBORG)
if (!(mo->flags2 & MF2_E4M6BOSS))
return;
break;

case 8:
if (mo->type != MT_SPIDER)
if (!(mo->flags2 & MF2_E4M8BOSS))
return;
break;

Expand Down Expand Up @@ -1731,14 +1726,14 @@ void A_BossDeath (mobj_t* mo, void * )
{
if (::g->gamemap == 7 || ok) // GK: Take in account the 14th ,15th and 16th levels on master Levels Expansion since they are using MAP07 special logic
{
if (mo->type == MT_FATSO)
if (mo->flags2 & MF2_MAP07BOSS1)
{
junk.tag = 666;
EV_DoFloor(&junk,lowerFloorToLowest);
return;
}

if (mo->type == MT_BABY)
if (mo->flags2 & MF2_MAP07BOSS2)
{
junk.tag = 667;
EV_DoFloor(&junk,raiseToTexture);
Expand Down
4 changes: 2 additions & 2 deletions doomclassic/doom/p_inter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1108,9 +1108,9 @@ P_DamageMobj

target->reactiontime = 0; // we're awake now...

if ( (!target->threshold || target->type == MT_VILE)
if ( (!target->threshold || target->flags2 & MF2_NOTHRESHOLD)
&& source && source != target
&& source->type != MT_VILE
&& !(source->flags2 & MF2_DMGIGNORED)
&& (source->type != MT_PLAYER && !P_InfightingImmune(target, source)))
{
// if not intent on another player,
Expand Down
5 changes: 2 additions & 3 deletions doomclassic/doom/p_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ qboolean PIT_CheckThing (mobj_t* thing)
if (::g->tmthing->z+::g->tmthing->height < thing->z)
return true; // underneath

if (::g->tmthing->target && !P_ProjectileImmune(thing, ::g->tmthing->target))
if (::g->tmthing->target && P_ProjectileImmune(thing, ::g->tmthing->target))
// (
// ::g->tmthing->target->type == thing->type ||
// (::g->tmthing->target->type == MT_KNIGHT && thing->type == MT_BRUISER)||
Expand Down Expand Up @@ -1506,8 +1506,7 @@ qboolean PIT_RadiusAttack (mobj_t* thing)

// Boss spider and cyborg
// take no damage from concussion.
if (thing->type == MT_CYBORG
|| thing->type == MT_SPIDER)
if (((thing->flags2 & MF2_NORADIUSDMG) || (thing->flags2 & MF2_BOSS)) && !(thing->flags2 & MF2_FORCERADIUSDMG))
return true;

dx = abs(thing->x - ::g->bombspot->x);
Expand Down
4 changes: 2 additions & 2 deletions doomclassic/doom/p_mobj.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ struct mobj_t
int tics; // state tic counter
const state_t* state;
int flags;
int flags2;
uint64 flags2;
int health;

// Movement direction, movement generation (zig-zagging).
Expand Down Expand Up @@ -322,7 +322,7 @@ struct mobj_t

};

#define MF2_NEUTRAL_SPLASH int(0x0000001000000000) // splash damage does not account for group
#define MF2_NEUTRAL_SPLASH uint64(0x0000001000000000) // splash damage does not account for group

#endif

0 comments on commit aaa3a7c

Please sign in to comment.