Skip to content

Commit 714a30f

Browse files
authored
Merge pull request #34 from kraflab/add-comp-friendlyspawn
Add comp_friendlyspawn
2 parents 8ad2cd6 + b7007e6 commit 714a30f

File tree

6 files changed

+25
-21
lines changed

6 files changed

+25
-21
lines changed

prboom2/src/doomstat.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ enum {
123123

124124
// mbf21
125125
comp_ledgeblock,
126-
comp_placeholder_30,
126+
comp_friendlyspawn,
127127
comp_placeholder_31,
128128
comp_placeholder_32,
129129
// and more!

prboom2/src/dsda/options.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ static const dsda_options_t default_mbf_options = {
9494
// .comp_ouchface = 1,
9595
// .comp_maxhealth = 0,
9696
// .comp_translucency = 0,
97-
// .comp_ledgeblock = 0
97+
// .comp_ledgeblock = 0,
98+
// .comp_friendlyspawn = 1
9899
};
99100

100101
static const dsda_options_t default_latest_options = {
@@ -139,7 +140,8 @@ static const dsda_options_t default_latest_options = {
139140
.comp_ouchface = 0,
140141
.comp_maxhealth = 0,
141142
.comp_translucency = 0,
142-
.comp_ledgeblock = 1
143+
.comp_ledgeblock = 1,
144+
.comp_friendlyspawn = 1
143145
};
144146

145147
static dsda_options_t mbf_options;
@@ -186,6 +188,7 @@ static dsda_option_t option_list[] = {
186188
{ "comp_respawnfix", &mbf_options.comp_respawn, 0, 1 },
187189
{ "comp_soul", &mbf_options.comp_soul, 0, 1 },
188190
{ "comp_ledgeblock", &mbf_options.comp_ledgeblock, 0, 1 },
191+
{ "comp_friendlyspawn", &mbf_options.comp_friendlyspawn, 0, 1 },
189192
{ 0 }
190193
};
191194

prboom2/src/dsda/options.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ typedef struct dsda_options {
5959
int comp_maxhealth;
6060
int comp_translucency;
6161
int comp_ledgeblock;
62-
// int comp_30;
62+
int comp_friendlyspawn;
6363
// int comp_31;
6464
// int comp_32;
6565
} dsda_options_t;

prboom2/src/g_game.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -2626,8 +2626,8 @@ void G_Compatibility(void)
26262626
{ boom_compatibility_compatibility, prboom_6_compatibility },
26272627
// comp_ledgeblock - ground monsters are blocked by ledges
26282628
{ boom_compatibility, mbf21_compatibility },
2629-
// comp_placeholder_30 - Not defined yet
2630-
{ 255, 255 },
2629+
// comp_friendlyspawn - A_Spawn new mobj inherits friendliness
2630+
{ prboom_1_compatibility, mbf21_compatibility },
26312631
// comp_placeholder_31 - Not defined yet
26322632
{ 255, 255 },
26332633
// comp_placeholder_32 - Not defined yet
@@ -2771,6 +2771,7 @@ void G_ReloadDefaults(void)
27712771
comp[comp_maxhealth] = options->comp_maxhealth;
27722772
comp[comp_translucency] = options->comp_translucency;
27732773
comp[comp_ledgeblock] = options->comp_ledgeblock;
2774+
comp[comp_friendlyspawn] = options->comp_friendlyspawn;
27742775
}
27752776

27762777
G_Compatibility();

prboom2/src/mbf21.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,6 @@ This is proof-of-concept implemented in dsda-doom.
7676
- [EE](https://github.com/team-eternity/eternity/blob/0fc2a38da688d9f5001fef723b40ef92c5db0956/source/p_inter.cpp#L971)
7777
- Why? Needs investigation.
7878

79-
#### A_Spawn friendliness inheritance
80-
- Changed in pr+, but not in EE.
81-
- [code](https://github.com/kraflab/dsda-doom/blob/6006aa42d3fba0ad2822ea35b144a921678821bf/prboom2/src/p_enemy.c#L2894-L2897)
82-
- [EE](https://github.com/team-eternity/eternity/blob/0fc2a38da688d9f5001fef723b40ef92c5db0956/source/a_general.cpp#L189)
83-
- Why? Needs investigation.
84-
8579
#### A_Mushroom changes
8680
- Changed in pr+, reverted for mbf21.
8781
- [commit](https://github.com/kraflab/dsda-doom/commit/a330db45dee7f255510f6b2c06006e97dc04d578)
@@ -111,6 +105,9 @@ This is proof-of-concept implemented in dsda-doom.
111105
- comp_ledgeblock: [commit](https://github.com/kraflab/dsda-doom/commit/4423cbcf8580e4d3839ddf4403b1fb4a0f993507)
112106
- Ledges block ground enemies
113107
- Exception: movement due to scrolling / pushers / pullers disables comp_ledgeblock for the next xy movement: [commit](https://github.com/kraflab/dsda-doom/commit/db8c3d606ed23dfb6b2408c4ddbf0af91d33f3de)
108+
- comp_friendlyspawn: [PR](https://github.com/kraflab/dsda-doom/pull/34)
109+
- When on: A_Spawn new thing inherits friend flag from source thing.
110+
- When off: A_Spawn new thing keeps its default friend flag.
114111

115112
Summary of comp flags since mbf in pr+ and changes:
116113

@@ -126,6 +123,7 @@ Summary of comp flags since mbf in pr+ and changes:
126123
| comp_maxhealth- | 26 | 0 | Max health in deh only applies to potions |
127124
| comp_translucency- | 27 | 0 | Disable some predefined translucency |
128125
| comp_ledgeblock | 28 | 1 | Ledges block ground enemies |
126+
| comp_friendlyspawn | 29 | 1 | A_Spawn new thing inherits friendliness |
129127

130128
- Comp options marked with a `-` have been deoptionalized in mbf21 (forced to `0`). Many of these have nothing to do with demo compatibility - others are simple bug fixes.
131129
- Comp options marked with a `*` are already implemented in EE.

prboom2/src/p_enemy.c

+11-9
Original file line numberDiff line numberDiff line change
@@ -2893,15 +2893,17 @@ void A_Spawn(mobj_t *mo)
28932893
return;
28942894

28952895
if (mo->state->misc1)
2896-
{
2897-
mobj_t *newmobj =
2898-
P_SpawnMobj(mo->x, mo->y, (mo->state->misc2 << FRACBITS) + mo->z,
2899-
mo->state->misc1 - 1);
2900-
if (compatibility_level == mbf_compatibility &&
2901-
!prboom_comp[PC_DO_NOT_INHERIT_FRIENDLYNESS_FLAG_ON_SPAWN].state)
2902-
/* CPhipps - no friendlyness (yet)*/ //e6y: why not?
2903-
newmobj->flags = (newmobj->flags & ~MF_FRIEND) | (mo->flags & MF_FRIEND);
2904-
}
2896+
{
2897+
mobj_t *newmobj =
2898+
P_SpawnMobj(mo->x, mo->y, (mo->state->misc2 << FRACBITS) + mo->z, mo->state->misc1 - 1);
2899+
2900+
if (
2901+
mbf_features &&
2902+
comp[comp_friendlyspawn] &&
2903+
!prboom_comp[PC_DO_NOT_INHERIT_FRIENDLYNESS_FLAG_ON_SPAWN].state
2904+
)
2905+
newmobj->flags = (newmobj->flags & ~MF_FRIEND) | (mo->flags & MF_FRIEND);
2906+
}
29052907
}
29062908

29072909
void A_Turn(mobj_t *mo)

0 commit comments

Comments
 (0)