Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hack to support coop_spawns skill in Eviternity-II-RC6.wad #1885

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion src/mn_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "i_system.h"
#include "i_timer.h"
#include "i_video.h"
#include "m_argv.h"
#include "m_input.h"
#include "m_io.h"
#include "m_misc.h"
Expand Down Expand Up @@ -144,7 +145,7 @@
CHOICE_VALUE = 0,
} mchoice_t;

typedef struct

Check warning on line 148 in src/mn_menu.c

View workflow job for this annotation

GitHub Actions / Clang-Tidy

src/mn_menu.c:148:9 [clang-analyzer-optin.performance.Padding]

Excessive padding in 'menuitem_t' (15 padding bytes, where 7 is optimal). Optimal fields order: routine, alttext, flags, status, rect, alphaKey, name, consider reordering the fields or adding explicit padding members
{
short status; // 0 = no cursor here, 1 = ok, 2 = arrows ok
char name[10];
Expand Down Expand Up @@ -619,7 +620,8 @@
{1, "M_ROUGH", M_ChooseSkill, 'h', "Hey, not too rough.", NEW_GAME_RECT(1)},
{1, "M_HURT", M_ChooseSkill, 'h', "Hurt me plenty.", NEW_GAME_RECT(2)},
{1, "M_ULTRA", M_ChooseSkill, 'u', "Ultra-Violence.", NEW_GAME_RECT(3)},
{1, "M_NMARE", M_ChooseSkill, 'n', "Nightmare!", NEW_GAME_RECT(4)}
{1, "M_NMARE", M_ChooseSkill, 'n', "Nightmare!", NEW_GAME_RECT(4)},
{0, "", M_ChooseSkill, 0, NULL, NEW_GAME_RECT(5)},
};

static menu_t NewDef = {
Expand Down Expand Up @@ -693,6 +695,24 @@

static void M_ChooseSkill(int choice)
{
if (!M_ParmExists("-coop_spawns"))
{
coop_spawns = false;
}

if (W_CheckNumForName("M_ANME") >= 0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you recall the master levels M_DOOM issue, the concern there was wad or lump specific hacks. I know ports are full of them already, but maybe let's not add new ones when possible (what if another wad has a lump named M_ANME?). I think the suggestions of either a custom skill menu or some kind of standards update seems like a better way to go, but more work of course.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to add checksum for WADs to avoid lump name collision. It will also be useful for compatibility database, not all popular levels are playbale on default MBF21 compatibility, see: https://github.com/kraflab/dsda-doom/blob/master/prboom2/src/dsda/compatibility.c
Another use for it will be to check wads for multiplayer (Choco has it, I removed it).

Eviternity 2 is popular, and this new skill is actually a balanced and interesting addition.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That compatibility database will have to be updated whenever a new version of a wad is released, e.g. RC6 to final for Eviternity II, which means issues will return until yet another Woof release that adds the new checksum to a database entry. That approach works for old wads, but even then it's not guaranteed as authors like to do updates years later.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is problematic for Eviternity 2 case. Then I vote to wait until new standard, for now we can tell users to use -coop_spawn parameter. Coop spawns is not interesting in most WADs, not sure it is worth to expose it in the menu.

{
if (choice == violence + 1)
{
coop_spawns = true;
}

if (choice > violence)
{
choice--;
}
}

if (choice == nightmare)
{ // Ty 03/27/98 - externalized
M_StartMessage(s_NIGHTMARE, M_VerifyNightmare, true);
Expand All @@ -701,11 +721,11 @@

if (!EpiCustom)
{
G_DeferedInitNew(choice, epiChoice + 1, 1);

Check warning on line 724 in src/mn_menu.c

View workflow job for this annotation

GitHub Actions / Clang-Tidy

src/mn_menu.c:724:26 [clang-analyzer-optin.core.EnumCastOutOfRange]

The value provided to the cast expression is not in the valid range of values for the enum
}
else
{
G_DeferedInitNew(choice, EpiMenuEpi[epiChoice], EpiMenuMap[epiChoice]);

Check warning on line 728 in src/mn_menu.c

View workflow job for this annotation

GitHub Actions / Clang-Tidy

src/mn_menu.c:728:26 [clang-analyzer-optin.core.EnumCastOutOfRange]

The value provided to the cast expression is not in the valid range of values for the enum
}

MN_ClearMenus();
Expand Down Expand Up @@ -1994,6 +2014,13 @@
ReadMenu1[0].routine = M_FinishReadThis;
}

if (W_CheckNumForName("M_ANME") >= 0) // coop spawns skill
{
NewGameMenu[newg_end] = NewGameMenu[nightmare];
NewGameMenu[nightmare] = (menuitem_t){1, "M_ANME", M_ChooseSkill, 'a', "", NEW_GAME_RECT(4)};
NewDef.numitems = newg_end + 1;
}

// Versions of doom.exe before the Ultimate Doom release only had
// three episodes; if we're emulating one of those then don't try
// to show episode four. If we are, then do show episode four
Expand Down