commit bd4f94ef99289761a5c665a8fed392083fc0dbda
parent a1a99ebc8d2626f0a22a2922259be4c0f490eadd
Author: Erick Vásquez García <41172072+Erick194@users.noreply.github.com>
Date: Sun, 3 Jan 2021 18:50:27 -0600
Enable Nightmare difficulty
Diffstat:
7 files changed, 106 insertions(+), 25 deletions(-)
diff --git a/doom64/doomdef.h b/doom64/doomdef.h
@@ -29,7 +29,11 @@ extern u32 cfb[2][SCREEN_WD*SCREEN_HT]; // 8036A000
/*============================================================================= */
/* Fixes and Version Update Here*/
-//FIXES
+
+// NEWS Updates
+#define ENABLE_NIGHTMARE 1 // Originally Activated in the project [GEC] Master Edition.
+
+// FIXES
#define FIX_LINEDEFS_DELETION 1 // Fixes for the 'linedef deletion' bug. From PsyDoom
/*============================================================================= */
diff --git a/doom64/g_game.c b/doom64/g_game.c
@@ -168,28 +168,36 @@ void G_InitNew (skill_t skill, int map, gametype_t gametype) // 800046F4
BT_DATA[0] = (buttons_t *)ActualConfiguration;
- /*if (skill == sk_nightmare)
+ #if ENABLE_NIGHTMARE == 1
+ if (skill == sk_nightmare)
{
- states[S_SARG_ATK1].tics = 2;
- states[S_SARG_ATK2].tics = 2;
- states[S_SARG_ATK3].tics = 2;
- mobjinfo[MT_SERGEANT].speed = 15;
-
- mobjinfo[MT_BRUISERSHOT].speed = 40*FRACUNIT;
- mobjinfo[MT_HEADSHOT].speed = 40*FRACUNIT;
- mobjinfo[MT_TROOPSHOT].speed = 40*FRACUNIT;
+ states[S_054].tics = 4; // S_SARG_ATK1
+ states[S_055].tics = 4; // S_SARG_ATK2
+ states[S_056].tics = 4; // S_SARG_ATK3
+ mobjinfo[MT_DEMON1].speed = 17; // MT_SERGEANT
+ mobjinfo[MT_DEMON2].speed = 17; // MT_SERGEANT2
+
+ mobjinfo[MT_PROJ_BRUISER1].speed = 20; // MT_BRUISERSHOT
+ mobjinfo[MT_PROJ_BRUISER2].speed = 20; // MT_BRUISERSHOT2
+ mobjinfo[MT_PROJ_HEAD].speed = 30; // MT_HEADSHOT value like Doom 64 Ex
+ mobjinfo[MT_PROJ_IMP1].speed = 20; // MT_TROOPSHOT
+ mobjinfo[MT_PROJ_IMP2].speed = 35; // MT_TROOPSHOT2 value like Doom 64 Ex
}
else
{
- states[S_SARG_ATK1].tics = 4;
- states[S_SARG_ATK2].tics = 4;
- states[S_SARG_ATK3].tics = 4;
- mobjinfo[MT_SERGEANT].speed = 10;
-
- mobjinfo[MT_BRUISERSHOT].speed = 30*FRACUNIT;
- mobjinfo[MT_HEADSHOT].speed = 20*FRACUNIT;
- mobjinfo[MT_TROOPSHOT].speed = 20*FRACUNIT;
- }*/
+ states[S_054].tics = 8; // S_SARG_ATK1
+ states[S_055].tics = 8; // S_SARG_ATK2
+ states[S_056].tics = 8; // S_SARG_ATK3
+ mobjinfo[MT_DEMON1].speed = 12; // MT_SERGEANT
+ mobjinfo[MT_DEMON2].speed = 12; // MT_SERGEANT2
+
+ mobjinfo[MT_PROJ_BRUISER1].speed = 15; // MT_BRUISERSHOT
+ mobjinfo[MT_PROJ_BRUISER2].speed = 15; // MT_BRUISERSHOT2
+ mobjinfo[MT_PROJ_HEAD].speed = 20; // MT_HEADSHOT
+ mobjinfo[MT_PROJ_IMP1].speed = 10; // MT_TROOPSHOT
+ mobjinfo[MT_PROJ_IMP2].speed = 20; // MT_TROOPSHOT2
+ }
+ #endif // ENABLE_NIGHTMARE
}
/*============================================================================ */
diff --git a/doom64/m_main.c b/doom64/m_main.c
@@ -103,14 +103,20 @@ menuitem_t Menu_Title[2] = // 8005A978
{ 11, 115, 210 }, // Options
};
+#if ENABLE_NIGHTMARE == 1
+menuitem_t Menu_Skill[5] = // 8005A990
+#else
menuitem_t Menu_Skill[4] = // 8005A990
+#endif // ENABLE_NIGHTMARE
{
{ 15, 102, 80 }, // Be Gentle!
{ 16, 102, 100}, // Bring it on!
{ 17, 102, 120}, // I own Doom!
{ 18, 102, 140}, // Watch me die!
/* Disable on Doom 64 Original */
- //{ 19, 102, 160}, // Nightmare
+ #if ENABLE_NIGHTMARE == 1
+ { 19, 102, 160}, // Nightmare
+ #endif // ENABLE_NIGHTMARE
};
menuitem_t Menu_Options[6] = // 8005A9C0
@@ -1008,7 +1014,11 @@ int M_MenuTicker(void) // 80007E0C
EnableExpPak = (M_ControllerPak() == 0);
MenuItem = Menu_Skill;
+ #if ENABLE_NIGHTMARE == 1
+ itemlines = 5;
+ #else
itemlines = 4;
+ #endif // ENABLE_NIGHTMARE
MenuCall = M_MenuTitleDrawer;
cursorpos = 1; // Set Default Bring it on!
diff --git a/doom64/m_password.c b/doom64/m_password.c
@@ -20,6 +20,9 @@ int CurPasswordSlot = 0; // 8005ACBC
char *passFeatures = "3n4bl3f34tvr3s??"; // New Pass Code By [GEC]
+// [GEC] NEW FLAGS
+#define NIGHTMARE 0x40
+
void M_EncodePassword(byte *buff) // 8000BC10
{
byte encode[10];
@@ -31,9 +34,22 @@ void M_EncodePassword(byte *buff) // 8000BC10
int maxclip, maxshell, maxcell, maxmisl;
player_t* player;
+ #if ENABLE_NIGHTMARE == 1
+ int skillnightmare;
+ #endif // ENABLE_NIGHTMARE
+
player = &players[0];
D_memset(encode, 0, sizeof(encode));
+ #if ENABLE_NIGHTMARE == 1
+ //Check the nightmare difficulty
+ skillnightmare = 0;
+ if(gameskill == sk_nightmare)
+ {
+ skillnightmare = sk_nightmare;
+ }
+ #endif // ENABLE_NIGHTMARE
+
//
// Map and Skill
//
@@ -129,6 +145,13 @@ void M_EncodePassword(byte *buff) // 8000BC10
//
encode[5] |= (player->artifacts << 2);
+ #if ENABLE_NIGHTMARE == 1
+ //I used the ArmorType space to add the 0x40 flag to identify that the difficulty is nightmare
+ if(skillnightmare != 0) {
+ encode[5] |= NIGHTMARE;
+ }
+ #endif // ENABLE_NIGHTMARE
+
decodebit[0] = (*(short*)&encode[0]);
decodebit[1] = (*(short*)&encode[2]);
decodebit[2] = (*(short*)&encode[4]);
@@ -307,6 +330,15 @@ int M_DecodePassword(byte *inbuff, int *levelnum, int *skill, player_t *player)
//
*skill = (decode[0] & 3);
+ #if ENABLE_NIGHTMARE == 1
+ //Check that the flag is 0x40, add the nightmare difficulty and remove the flag 0x80
+ if (decode[5] & NIGHTMARE)
+ {
+ decode[5] &= ~NIGHTMARE;
+ *skill = sk_nightmare;
+ }
+ #endif // ENABLE_NIGHTMARE
+
//
// Verify Skill
//
diff --git a/doom64/p_enemy.c b/doom64/p_enemy.c
@@ -515,6 +515,16 @@ void A_Chase (mobj_t *actor) // 8001146C
/* */
/* check for missile attack */
/* */
+ #if ENABLE_NIGHTMARE == 1
+ if ((gameskill == sk_nightmare || !actor->movecount) && actor->info->missilestate
+ && P_CheckMissileRange (actor))
+ {
+ P_SetMobjState (actor, actor->info->missilestate);
+ if (gameskill != sk_nightmare)
+ actor->flags |= MF_JUSTATTACKED;
+ return;
+ }
+ #else
if ( (/*gameskill == sk_nightmare || */!actor->movecount) && actor->info->missilestate
&& P_CheckMissileRange (actor))
{
@@ -523,6 +533,8 @@ void A_Chase (mobj_t *actor) // 8001146C
actor->flags |= MF_JUSTATTACKED;
return;
}
+ #endif // ENABLE_NIGHTMARE
+
/* */
/* chase towards player */
diff --git a/doom64/p_inter.c b/doom64/p_inter.c
@@ -56,8 +56,13 @@ boolean P_GiveAmmo (player_t *player, ammotype_t ammo, int num) // 800143E0
num = num/2;
}
- if (gameskill == sk_baby)
+ #if ENABLE_NIGHTMARE == 1 // Like PC Doom / Doom 64 EX
+ if (gameskill == sk_baby || gameskill == sk_nightmare)
num <<= 1; /* give double ammo in trainer mode */
+ #else
+ if (gameskill == sk_baby)
+ num <<= 1; /* give double ammo in trainer mode */
+ #endif // ENABLE_NIGHTMARE
oldammo = player->ammo[ammo];
player->ammo[ammo] += num;
@@ -361,10 +366,17 @@ void P_TouchSpecialThing (mobj_t *special, mobj_t *toucher) // 80014810
case MT_AMMO_SHELL:
if (!P_GiveAmmo (player, am_shell,1))
return;
+ #if ENABLE_NIGHTMARE == 1
+ if (gameskill == sk_baby || gameskill == sk_nightmare)
+ message = "Picked up 8 shotgun shells.";
+ else
+ message = "Picked up 4 shotgun shells.";
+ #else
if (gameskill == sk_baby)
message = "Picked up 8 shotgun shells.";
else
message = "Picked up 4 shotgun shells.";
+ #endif // ENABLE_NIGHTMARE
break;
case MT_AMMO_SHELLBOX:
if (!P_GiveAmmo (player, am_shell,5))
diff --git a/doom64/p_mobj.c b/doom64/p_mobj.c
@@ -108,20 +108,23 @@ mobj_t *P_SpawnMapThing (mapthing_t *mthing) // 80018C24
return NULL;
}
- /*if (gameskill == sk_baby)
+ #if ENABLE_NIGHTMARE == 1
+ if (gameskill == sk_baby)
bit = 1;
else if (gameskill == sk_nightmare)
bit = 4;
else
- bit = 1<<(gameskill-1);*/
-
- if (gameskill == sk_baby || gameskill == sk_easy)
+ bit = 1<<(gameskill-1);
+ #else
+ if (gameskill == sk_baby || gameskill == sk_easy)
bit = 1;
else if (gameskill == sk_medium)
bit = 2;
else if (gameskill == sk_hard)
bit = 4;
+ #endif // ENABLE_NIGHTMARE
+
if (!(mthing->options & bit) )
return NULL;