Skip to content

Commit

Permalink
Implement MBF's -dog and -dogs cmdline parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
bradharding committed Oct 29, 2023
1 parent efa3140 commit e23de84
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2534,6 +2534,16 @@ static void D_DoomMainSetup(void)
}
}

if (M_CheckParm("-dog"))
P_InitHelperDogs(1);
else if ((p = M_CheckParmWithArgs("-dogs", 1)))
{
const int dogs = strtol(myargv[p + 1], NULL, 10);

if (dogs > 0 && dogs <= 4)
P_InitHelperDogs(dogs);
}

M_Init();
R_Init();
P_Init();
Expand Down
1 change: 1 addition & 0 deletions src/p_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ void P_MobjThinker(mobj_t *mobj);

void P_SpawnMoreBlood(mobj_t *mobj);
void P_LookForFriends(void);
void P_InitHelperDogs(const int dogs);
mobj_t *P_SpawnMapThing(mapthing_t *mthing, const bool spawnmonsters);
void P_SpawnPuff(const fixed_t x, const fixed_t y, const fixed_t z, const angle_t angle);
void P_SpawnSmokeTrail(const fixed_t x, const fixed_t y, const fixed_t z, const angle_t angle);
Expand Down
9 changes: 9 additions & 0 deletions src/p_mobj.c
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,15 @@ void P_LookForFriends(void)
}
}

void P_InitHelperDogs(const int dogs)
{
for (int i = 0; i < dogs; i++)
{
friendtype[numfriends] = MT_DOGS;
friendhealth[numfriends++] = mobjinfo[MT_DOGS].spawnhealth;
}
}

static void P_SpawnFriend(const mapthing_t *mthing)
{
const short playerstart = mthing->type;
Expand Down

0 comments on commit e23de84

Please sign in to comment.