From b395193aed02632856182f1989b2133057ce8966 Mon Sep 17 00:00:00 2001 From: Dasperal Date: Sun, 21 Jan 2024 03:15:54 +0300 Subject: [PATCH] Heretic & Hexen: Add option in the Gameplay options menu for the skip of the unusable artifact Vanilla behavior: if you try to use an artifact that can't be used (e.g., Quartz flask while having 100 HP), then the previous artifact in inventory will be selected Always enabled in `-vanilla`, netgame and demo playback/recording --- src/heretic/hr_main.c | 2 ++ src/heretic/mn_menu.c | 33 +++++++++++++++++++++++++-------- src/heretic/p_user.c | 5 +++-- src/hexen/h2_main.c | 2 ++ src/hexen/mn_menu.c | 43 +++++++++++++++++++++++++++++-------------- src/hexen/p_user.c | 5 +++-- src/jn.h | 1 + src/m_config.c | 1 + 8 files changed, 66 insertions(+), 26 deletions(-) diff --git a/src/heretic/hr_main.c b/src/heretic/hr_main.c index de182d347..fcfa70558 100644 --- a/src/heretic/hr_main.c +++ b/src/heretic/hr_main.c @@ -221,6 +221,7 @@ int fix_map_errors = 1; int flip_levels = 0; int breathing = 0; int pistol_start = 0; +int skip_unusable_artifact = 0; // Gameplay: Demos int demotimer = 0; @@ -1157,6 +1158,7 @@ void D_BindVariables(void) M_BindIntVariable("flip_levels", &flip_levels); M_BindIntVariable("breathing", &breathing); M_BindIntVariable("pistol_start", &pistol_start); + M_BindIntVariable("skip_unusable_artifact", &skip_unusable_artifact); // Gameplay: Demos M_BindIntVariable("demotimer", &demotimer); diff --git a/src/heretic/mn_menu.c b/src/heretic/mn_menu.c index 91fd04dcd..bac5597f4 100644 --- a/src/heretic/mn_menu.c +++ b/src/heretic/mn_menu.c @@ -263,6 +263,7 @@ static void M_RD_FlipLevels(); static void M_RD_Breathing(); static void M_RD_WandStart(); static void M_RD_CenterInventoryCursor(); +static void M_RD_SkipUnusableArtifact(); static void M_RD_DemoTimer(Direction_t direction); static void M_RD_DemoTimerDir(); static void M_RD_DemoBar(); @@ -1334,6 +1335,7 @@ static MenuItem_t Gameplay4Items[] = { I_SWITCH("IMITATE PLAYER'S BREATHING:", "BVBNFWBZ LS[FYBZ BUHJRF:", M_RD_Breathing), // ИМИТАЦИЯ ДЫХАНИЯ ИГРОКА I_SWITCH("WAND START GAME MODE:", NULL, /* [JN] Joint EN/RU string*/ M_RD_WandStart), // РЕЖИМ ИГРЫ "WAND START" I_SWITCH("CENTER INVENTORY CURSOR:", "WTYNHBHJDFNM REHCJH BYDTYNFHZ:", M_RD_CenterInventoryCursor), // ЦЕНТРИРОВАТЬ КУРСОР ИНВЕНТАРЯ + I_SWITCH("SKIP UNUSABLE ARTIFACT:", "CRBG YTGHBVTYBVJUJ FHNTAFRNF:", M_RD_SkipUnusableArtifact), // СКИП НЕПРИМЕНИМОГО АРТEФАКТА I_TITLE( "DEMOS", "LTVJPFGBCB"), // ДЕМОЗАПИСИ I_LRFUNC("SHOW DEMO TIMER:", "JNJ,HF;FNM NFQVTH:", M_RD_DemoTimer), // ОТОБРАЖАТЬ ТАЙМЕР I_SWITCH("TIMER DIRECTION:", "DHTVZ NFQVTHF:", M_RD_DemoTimerDir), // ВРЕМЯ ТАЙМЕРА @@ -4999,6 +5001,10 @@ static void DrawGameplay4Menu(void) RD_M_DrawTextSmallENG(center_inventory_cursor ? "ON" : "OFF", 216 + wide_delta, 86, center_inventory_cursor ? CR_GREEN : CR_RED); + // Skip unusable artifact + RD_M_DrawTextSmallENG(skip_unusable_artifact ? "ON" : "OFF", 202 + wide_delta, 96, + skip_unusable_artifact ? CR_GREEN : CR_RED); + // // DEMOS // @@ -5007,20 +5013,20 @@ static void DrawGameplay4Menu(void) RD_M_DrawTextSmallENG(demotimer == 1 ? "PLAYBACK" : demotimer == 2 ? "RECORDING" : demotimer == 3 ? "ALWAYS" : - "OFF", 153 + wide_delta, 106, + "OFF", 153 + wide_delta, 116, demotimer > 0 ? CR_GREEN : CR_RED); // Timer direction - RD_M_DrawTextSmallENG(demotimerdir ? "BACKWARD" : "FORWARD", 147 + wide_delta, 116, + RD_M_DrawTextSmallENG(demotimerdir ? "BACKWARD" : "FORWARD", 147 + wide_delta, 126, demotimer > 0 ? CR_GREEN : CR_RED); // Show progress bar - RD_M_DrawTextSmallENG(demobar ? "ON" : "OFF", 174 + wide_delta, 126, + RD_M_DrawTextSmallENG(demobar ? "ON" : "OFF", 174 + wide_delta, 136, demobar ? CR_GREEN : CR_RED); // Play internal demos RD_M_DrawTextSmallENG(no_internal_demos ? "OFF" : "ON", - 179 + wide_delta, 136, + 179 + wide_delta, 146, no_internal_demos ? CR_RED : CR_GREEN); } else @@ -5059,6 +5065,10 @@ static void DrawGameplay4Menu(void) RD_M_DrawTextSmallRUS(center_inventory_cursor ? "DRK" : "DSRK", 257 + wide_delta, 86, center_inventory_cursor ? CR_GREEN : CR_RED); + // Скип неприменимого артефакта + RD_M_DrawTextSmallRUS(skip_unusable_artifact ? "DRK" : "DSRK", 253 + wide_delta, 96, + skip_unusable_artifact ? CR_GREEN : CR_RED); + // // ДЕМОЗАПИСИ // @@ -5067,20 +5077,20 @@ static void DrawGameplay4Menu(void) RD_M_DrawTextSmallRUS(demotimer == 1 ? "GHB GHJBUHSDFYBB" : demotimer == 2 ? "GHB PFGBCB" : demotimer == 3 ? "DCTULF" : - "DSRK", 175 + wide_delta, 106, + "DSRK", 175 + wide_delta, 116, demotimer > 0 ? CR_GREEN : CR_DARKRED); // Время таймера - RD_M_DrawTextSmallRUS(demotimerdir ? "JCNFDITTCZ" : "GHJITLITT", 142 + wide_delta, 116, + RD_M_DrawTextSmallRUS(demotimerdir ? "JCNFDITTCZ" : "GHJITLITT", 142 + wide_delta, 126, demotimer > 0 ? CR_GREEN : CR_DARKRED); // Шкала прогресса - RD_M_DrawTextSmallRUS(demobar ? "DRK" : "DSRK", 161 + wide_delta, 126, + RD_M_DrawTextSmallRUS(demobar ? "DRK" : "DSRK", 161 + wide_delta, 136, demobar ? CR_GREEN : CR_RED); // Проигрывать демозаписи RD_M_DrawTextSmallRUS(no_internal_demos ? "DSRK" : "DRK", - 211 + wide_delta, 136, + 211 + wide_delta, 146, no_internal_demos ? CR_RED : CR_GREEN); } @@ -5120,6 +5130,11 @@ static void M_RD_CenterInventoryCursor() center_inventory_cursor ^= 1; } +static void M_RD_SkipUnusableArtifact() +{ + skip_unusable_artifact ^= 1; +} + static void M_RD_DemoTimer(Direction_t direction) { RD_Menu_SpinInt(&demotimer, 0, 3, direction); @@ -5845,6 +5860,7 @@ static void M_RD_BackToDefaults_Recommended(void) breathing = 0; pistol_start = 0; center_inventory_cursor = 1; + skip_unusable_artifact = 0; demotimer = 0; demotimerdir = 0; demobar = 0; @@ -6005,6 +6021,7 @@ static void M_RD_BackToDefaults_Original(void) breathing = 0; pistol_start = 0; center_inventory_cursor = 0; + skip_unusable_artifact = 1; demotimer = 0; demotimerdir = 0; demobar = 0; diff --git a/src/heretic/p_user.c b/src/heretic/p_user.c index 5c675ec21..baf176378 100644 --- a/src/heretic/p_user.c +++ b/src/heretic/p_user.c @@ -973,8 +973,9 @@ void P_PlayerUseArtifact (player_t *player, artitype_t arti) ArtifactFlash = 4; } } - else - { // Unable to use artifact, advance pointer + else if(skip_unusable_artifact || vanillaparm || !singleplayer) + { + // Unable to use artifact, advance pointer P_PlayerNextArtifact(player); } break; diff --git a/src/hexen/h2_main.c b/src/hexen/h2_main.c index a5edec198..36667bdb9 100644 --- a/src/hexen/h2_main.c +++ b/src/hexen/h2_main.c @@ -240,6 +240,7 @@ int fix_map_errors = 1; int flip_levels = 0; int no_internal_demos = 0; int breathing = 0; +int skip_unusable_artifact = 0; int selective_class = 0; int selective_skill = 2; @@ -404,6 +405,7 @@ void D_BindVariables(void) M_BindIntVariable("flip_levels", &flip_levels); M_BindIntVariable("no_internal_demos", &no_internal_demos); M_BindIntVariable("breathing", &breathing); + M_BindIntVariable("skip_unusable_artifact", &skip_unusable_artifact); // Gameplay: Crosshair M_BindIntVariable("crosshair_draw", &crosshair_draw); diff --git a/src/hexen/mn_menu.c b/src/hexen/mn_menu.c index 6673fabf1..e1f8b7a2c 100644 --- a/src/hexen/mn_menu.c +++ b/src/hexen/mn_menu.c @@ -247,6 +247,7 @@ static void M_RD_FixMapErrors(); static void M_RD_FlipLevels(); static void M_RD_NoDemos(); static void M_RD_Breathing(); +static void M_RD_SkipUnusableArtifact(); // Level Select (1) static void DrawLevelSelect1Menu(void); @@ -1318,6 +1319,7 @@ MENU_STATIC_PAGED(Gameplay2Menu, static MenuItem_t Gameplay3Items[] = { I_SWITCH("IMITATE PLAYER'S BREATHING:", "BVBNFWBZ LS[FYBZ BUHJRF:", M_RD_Breathing), // ИМИТАЦИЯ ДЫХАНИЯ ИГРОКА + I_SWITCH("SKIP UNUSABLE ARTIFACT:", "CRBG YTGHBVTYBVJUJ FHNTAFRNF:", M_RD_SkipUnusableArtifact), // СКИП НЕПРИМЕНИМОГО АРТEФАКТА I_TITLE( "CROSSHAIR", "GHBWTK"), // ПРИЦЕЛ I_SWITCH("DRAW CROSSHAIR:", "JNJ,HF;FNM GHBWTK:", M_RD_CrossHairDraw), // ОТОБРАЖАТЬ ПРИЦЕЛ I_LRFUNC("SHAPE:", "AJHVF:", M_RD_CrossHairShape), // ФОРМА @@ -1329,7 +1331,6 @@ static MenuItem_t Gameplay3Items[] = { I_EMPTY, I_EMPTY, I_EMPTY, - I_EMPTY, I_SETMENU("FIRST PAGE >", "GTHDFZ CNHFYBWF `", &Gameplay1Menu), // ПЕРВАЯ СТРАНИЦА > I_SETMENU("< PREV PAGE", "^ GHTLSLEOFZ CNHFYBWF", &Gameplay2Menu) // < ПРЕДЫДУЩАЯ СТРАНИЦА }; @@ -4733,12 +4734,16 @@ static void DrawGameplay3Menu(void) RD_M_DrawTextSmallENG(breathing ? "ON" : "OFF", 224 + wide_delta, 32, breathing ? CR_GREEN : CR_RED); + // Skip unusable artifact + RD_M_DrawTextSmallENG(skip_unusable_artifact ? "ON" : "OFF", 202 + wide_delta, 42, + skip_unusable_artifact ? CR_GREEN : CR_RED); + // // CROSSHAIR // // Draw crosshair - RD_M_DrawTextSmallENG(crosshair_draw ? "ON" : "OFF", 150 + wide_delta, 52, + RD_M_DrawTextSmallENG(crosshair_draw ? "ON" : "OFF", 150 + wide_delta, 62, crosshair_draw ? CR_GREEN : CR_RED); // Shape @@ -4748,14 +4753,14 @@ static void DrawGameplay3Menu(void) crosshair_shape == 4 ? "ANGLE" : crosshair_shape == 5 ? "TRIANGLE" : crosshair_shape == 6 ? "DOT" : "CROSS", - 84 + wide_delta, 62, CR_GREEN); + 84 + wide_delta, 72, CR_GREEN); // Indication - RD_M_DrawTextSmallENG(crosshair_type == 1 ? "HEALTH" : "STATIC", 111 + wide_delta, 72, + RD_M_DrawTextSmallENG(crosshair_type == 1 ? "HEALTH" : "STATIC", 111 + wide_delta, 82, crosshair_type ? CR_GREEN : CR_RED); // Increased size - RD_M_DrawTextSmallENG(crosshair_scale ? "ON" : "OFF", 146 + wide_delta, 82, + RD_M_DrawTextSmallENG(crosshair_scale ? "ON" : "OFF", 146 + wide_delta, 92, crosshair_scale ? CR_GREEN : CR_RED); } else @@ -4764,12 +4769,16 @@ static void DrawGameplay3Menu(void) RD_M_DrawTextSmallRUS(breathing ? "DRK": "DSRK", 214 + wide_delta, 32, breathing ? CR_GREEN : CR_RED); + // Скип неприменимого артефакта + RD_M_DrawTextSmallRUS(skip_unusable_artifact ? "DRK" : "DSRK", 253 + wide_delta, 42, + skip_unusable_artifact ? CR_GREEN : CR_RED); + // // ПРИЦЕЛ // // Отображать прицел - RD_M_DrawTextSmallRUS(crosshair_draw ? "DRK" : "DSRK", 175 + wide_delta, 52, + RD_M_DrawTextSmallRUS(crosshair_draw ? "DRK" : "DSRK", 175 + wide_delta, 62, crosshair_draw ? CR_GREEN : CR_RED); // Форма @@ -4780,30 +4789,30 @@ static void DrawGameplay3Menu(void) crosshair_shape == 5 ? "NHTEUJKMYBR" : // ТРЕУГОЛЬНИК crosshair_shape == 6 ? "NJXRF" : // ТОЧКА "RHTCN", // КРЕСТ - 87 + wide_delta, 62, CR_GREEN); + 87 + wide_delta, 72, CR_GREEN); // Индикация RD_M_DrawTextSmallRUS(crosshair_type == 1 ? "PLJHJDMT" : // ЗДОРОВЬЕ "CNFNBXYFZ", // СТАТИЧНАЯ - 111 + wide_delta, 72, crosshair_type ? CR_GREEN : CR_RED); + 111 + wide_delta, 82, crosshair_type ? CR_GREEN : CR_RED); // Увеличенный размер - RD_M_DrawTextSmallRUS(crosshair_scale ? "DRK" : "DSRK", 181 + wide_delta, 82, + RD_M_DrawTextSmallRUS(crosshair_scale ? "DRK" : "DSRK", 181 + wide_delta, 92, crosshair_scale ? CR_GREEN : CR_RED); } // Draw crosshair background. - V_DrawPatch(235 + wide_delta, 63, W_CacheLumpName("XHAIRBOX", PU_CACHE), NULL); + V_DrawPatch(235 + wide_delta, 73, W_CacheLumpName("XHAIRBOX", PU_CACHE), NULL); // Colorize crosshair depending on it's type. Crosshair_Colorize_inMenu(); // Draw crosshair preview. if (crosshair_scale) { - V_DrawPatch(250 + wide_delta, 78, CrosshairPatch, CrosshairOpacity); + V_DrawPatch(250 + wide_delta, 88, CrosshairPatch, CrosshairOpacity); } else { - V_DrawPatchUnscaled(500 + wide_delta*2, 156, CrosshairPatch, CrosshairOpacity); + V_DrawPatchUnscaled(500 + wide_delta*2, 176, CrosshairPatch, CrosshairOpacity); } // Clear colorization. dp_translation = NULL; @@ -4817,8 +4826,8 @@ static void DrawGameplay3Menu(void) crosshair_opacity == 5 ? "70%" : crosshair_opacity == 6 ? "80%" : crosshair_opacity == 7 ? "90%" : "100%", - (english_language ? 95 : 149) + wide_delta, - 92, CR_GRAY); + (english_language ? 95 : 159) + wide_delta, + 102, CR_GRAY); } static void M_RD_FixMapErrors() @@ -4844,6 +4853,10 @@ static void M_RD_Breathing() breathing ^= 1; } +static void M_RD_SkipUnusableArtifact() +{ + skip_unusable_artifact ^= 1; +} //--------------------------------------------------------------------------- // DrawLevelSelect1Menu @@ -5886,6 +5899,7 @@ void M_RD_BackToDefaults_Recommended (void) show_all_artifacts = 0; show_artifacts_timer = 0; weapon_widget = 0; + skip_unusable_artifact = 0; // Gameplay (4) crosshair_draw = 0; crosshair_shape = 0; @@ -6003,6 +6017,7 @@ static void M_RD_BackToDefaults_Original(void) show_all_artifacts = 0; show_artifacts_timer = 0; weapon_widget = 0; + skip_unusable_artifact = 1; // Gameplay (4) crosshair_draw = 0; crosshair_shape = 0; diff --git a/src/hexen/p_user.c b/src/hexen/p_user.c index fd1a51773..36c097da8 100644 --- a/src/hexen/p_user.c +++ b/src/hexen/p_user.c @@ -1492,8 +1492,9 @@ void P_PlayerUseArtifact(player_t * player, artitype_t arti) ArtifactFlash = 4; } } - else if (arti < arti_firstpuzzitem) - { // Unable to use artifact, advance pointer + else if(arti < arti_firstpuzzitem && (skip_unusable_artifact || vanillaparm || !singleplayer)) + { + // Unable to use artifact, advance pointer P_PlayerNextArtifact(player); } break; diff --git a/src/jn.h b/src/jn.h index d38a2cfbb..b6eec59f3 100644 --- a/src/jn.h +++ b/src/jn.h @@ -330,6 +330,7 @@ extern int pistol_start; extern int breathing; extern int unlimited_lost_souls; extern int fast_quickload; +extern int skip_unusable_artifact; // Gameplay: Demos extern int demotimer; diff --git a/src/m_config.c b/src/m_config.c index 8b44a8d33..aa26cb2b8 100644 --- a/src/m_config.c +++ b/src/m_config.c @@ -670,6 +670,7 @@ static default_t defaults_list[] = CONFIG_VARIABLE_INT(breathing), CONFIG_VARIABLE_INT(unlimited_lost_souls), CONFIG_VARIABLE_INT(fast_quickload), + CONFIG_VARIABLE_INT(skip_unusable_artifact), // Gameplay: Demos CONFIG_VARIABLE_INT(demotimer),