Skip to content

Commit

Permalink
Add comp_reservedlineflag
Browse files Browse the repository at this point in the history
  • Loading branch information
kraflab committed Oct 20, 2021
1 parent baf3389 commit 5287a80
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
1 change: 1 addition & 0 deletions prboom2/src/doomstat.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ enum {
comp_ledgeblock,
comp_friendlyspawn,
comp_voodooscroller,
comp_reservedlineflag,

MBF_COMP_TOTAL = 32 // limit in MBF format
};
Expand Down
10 changes: 9 additions & 1 deletion prboom2/src/dsda/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ static const dsda_options_t default_mbf_options = {
// .comp_ledgeblock = 0,
// .comp_friendlyspawn = 1,
// .comp_voodooscroller = 1,
// .comp_reservedlineflag = 1,
};

static const dsda_options_t default_latest_options = {
Expand Down Expand Up @@ -144,6 +145,7 @@ static const dsda_options_t default_latest_options = {
.comp_ledgeblock = 1,
.comp_friendlyspawn = 1,
.comp_voodooscroller = 0,
.comp_reservedlineflag = 1,
};

static dsda_options_t mbf_options;
Expand Down Expand Up @@ -192,6 +194,7 @@ static dsda_option_t option_list[] = {
{ "comp_ledgeblock", &mbf_options.comp_ledgeblock, 0, 1 },
{ "comp_friendlyspawn", &mbf_options.comp_friendlyspawn, 0, 1 },
{ "comp_voodooscroller", &mbf_options.comp_voodooscroller, 0, 1 },
{ "comp_reservedlineflag", &mbf_options.comp_reservedlineflag, 0, 1 },
{ 0 }
};

Expand Down Expand Up @@ -281,7 +284,7 @@ const dsda_options_t* dsda_Options(void) {
return dsda_MBFOptions();
}

#define MBF21_COMP_TOTAL 24
#define MBF21_COMP_TOTAL 25

static int mbf21_comp_translation[MBF21_COMP_TOTAL] = {
comp_telefrag,
Expand All @@ -308,6 +311,7 @@ static int mbf21_comp_translation[MBF21_COMP_TOTAL] = {
comp_ledgeblock,
comp_friendlyspawn,
comp_voodooscroller,
comp_reservedlineflag,
};

// killough 5/2/98: number of bytes reserved for saving options
Expand Down Expand Up @@ -407,6 +411,10 @@ const byte *dsda_ReadOptions21(const byte *demo_p) {
if (count < 24)
comp[mbf21_comp_translation[23]] = 1;

// comp_reservedlineflag
if (count < 25)
comp[mbf21_comp_translation[24]] = 1;

G_Compatibility();

return demo_p;
Expand Down
2 changes: 1 addition & 1 deletion prboom2/src/dsda/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ typedef struct dsda_options {
int comp_ledgeblock;
int comp_friendlyspawn;
int comp_voodooscroller;
// int comp_32;
int comp_reservedlineflag;
} dsda_options_t;

const dsda_options_t* dsda_Options(void);
Expand Down
5 changes: 3 additions & 2 deletions prboom2/src/g_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -2773,8 +2773,8 @@ void G_Compatibility(void)
{ prboom_1_compatibility, mbf21_compatibility },
// comp_voodooscroller - Voodoo dolls on slow scrollers move too slowly
{ mbf21_compatibility, mbf21_compatibility },
// comp_placeholder_32 - Not defined yet
{ 255, 255 }
// comp_reservedlineflag - ML_RESERVED clears extended flags
{ mbf21_compatibility, mbf21_compatibility }
};
unsigned int i;

Expand Down Expand Up @@ -2916,6 +2916,7 @@ void G_ReloadDefaults(void)
comp[comp_ledgeblock] = options->comp_ledgeblock;
comp[comp_friendlyspawn] = options->comp_friendlyspawn;
comp[comp_voodooscroller] = options->comp_voodooscroller;
comp[comp_reservedlineflag] = options->comp_reservedlineflag;
}

G_Compatibility();
Expand Down
9 changes: 8 additions & 1 deletion prboom2/src/p_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1676,7 +1676,14 @@ void P_TranslateHexenLineFlags(unsigned int *flags)

void P_TranslateCompatibleLineFlags(unsigned int *flags)
{
*flags = *flags & (mbf21 ? 0x3fff : 0x03ff);
int filter;

if (mbf21)
filter = (*flags & ML_RESERVED && comp[comp_reservedlineflag]) ? 0x01ff : 0x3fff;
else
filter = 0x03ff;

*flags = *flags & filter;
}

static void P_LoadLineDefs (int lump)
Expand Down

0 comments on commit 5287a80

Please sign in to comment.