pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

doomlegacy-devel: Bugfixes for UMAPINFO support



Module Name:	pkgsrc-wip
Committed By:	Michael Baeuerle <micha%NetBSD.org@localhost>
Pushed By:	micha
Date:		Mon Apr 3 15:00:58 2023 +0200
Changeset:	243886d55f079eb72b971cedd996ee09cb3b7a89

Modified Files:
	doomlegacy-devel/distinfo
	doomlegacy-devel/files/umapinfo.c
	doomlegacy-devel/patches/patch-src_f__finale.c
	doomlegacy-devel/patches/patch-src_g__game.c
	doomlegacy-devel/patches/patch-src_m__menu.c
	doomlegacy-devel/patches/patch-src_p__enemy.c
	doomlegacy-devel/patches/patch-src_wi__stuff.c

Log Message:
doomlegacy-devel: Bugfixes for UMAPINFO support

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=243886d55f079eb72b971cedd996ee09cb3b7a89

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 doomlegacy-devel/distinfo                      |  10 +-
 doomlegacy-devel/files/umapinfo.c              |  29 ++++-
 doomlegacy-devel/patches/patch-src_f__finale.c | 169 ++++++++++++++++++++-----
 doomlegacy-devel/patches/patch-src_g__game.c   |  92 +++++++++++---
 doomlegacy-devel/patches/patch-src_m__menu.c   |  15 ++-
 doomlegacy-devel/patches/patch-src_p__enemy.c  |  65 +++++-----
 doomlegacy-devel/patches/patch-src_wi__stuff.c | 103 ++++++++-------
 7 files changed, 342 insertions(+), 141 deletions(-)

diffs:
diff --git a/doomlegacy-devel/distinfo b/doomlegacy-devel/distinfo
index 9bc814d19f..b3e9e16ee5 100644
--- a/doomlegacy-devel/distinfo
+++ b/doomlegacy-devel/distinfo
@@ -9,14 +9,14 @@ SHA1 (patch-src_am__map.c) = 14b3c8b70c63778ad043827ab2f0b6f4fe07bcde
 SHA1 (patch-src_d__main.c) = c889d3601230f66a9cd062e80e44497dd5f69e2f
 SHA1 (patch-src_d__player.h) = 5975ea8a714aeb10dcecc7fd42fffcb8f9a2e51b
 SHA1 (patch-src_doomstat.h) = baa7387b6271d3064c12e24aaadf40cdb383e395
-SHA1 (patch-src_f__finale.c) = 675772336bd091ecdcfd32244821b7ae6fc951f6
+SHA1 (patch-src_f__finale.c) = d9f116f0830fb533fe5f72454cd905d8b289162a
 SHA1 (patch-src_f__finale.h) = 5ba7ae568be4dd97d06e4724dc7e1907f3a09cd8
-SHA1 (patch-src_g__game.c) = 1307a1dc8518646aaca9b136819ddd3e13d2b947
-SHA1 (patch-src_m__menu.c) = 7e8b564800c9b3b75f96dae3d9216f8cd6dc195f
-SHA1 (patch-src_p__enemy.c) = 910ddf9f5c7a1aa7de96c055a66228c5aa16eefa
+SHA1 (patch-src_g__game.c) = 296be562113be189c15ece8fbaffb8c7ae04df56
+SHA1 (patch-src_m__menu.c) = 81ae8b6edd90e039132e28b23fe35ff62bc4bce8
+SHA1 (patch-src_p__enemy.c) = c9ce6dbc275db474281539e7ae48a09d65627d5c
 SHA1 (patch-src_p__info.c) = 9a8061b1d183374f1ea3678c6a0ad762ff12f8bd
 SHA1 (patch-src_p__info.h) = e24772efb6b42ad5b834b1c12477f2a2feb508aa
 SHA1 (patch-src_p__setup.c) = 77ef2316b3d5ac72274ccfcf6bff3229a9245997
 SHA1 (patch-src_w__wad.c) = 9853306fd400ee53a48efa38c31e5dbec5d51d82
 SHA1 (patch-src_w__wad.h) = 683283a32222e96a6472f103d3dc51e7229e4753
-SHA1 (patch-src_wi__stuff.c) = f708ff6160762862a00fca9d52219ec649c59dfc
+SHA1 (patch-src_wi__stuff.c) = bd577ec36ef5580e65dec3befa7c7c74aeb92de2
diff --git a/doomlegacy-devel/files/umapinfo.c b/doomlegacy-devel/files/umapinfo.c
index 4296533af6..0f909f4f9c 100644
--- a/doomlegacy-devel/files/umapinfo.c
+++ b/doomlegacy-devel/files/umapinfo.c
@@ -525,7 +525,7 @@ static boolean UMI_MergeBossAction(doom_umi1_ts_state state,
         *ba    = NULL;
         result = true;
     }
-    else if (DOOM_UMI1_TYPE_THING == type)
+    else
     {
         bossaction_t *entry = UMI_Malloc(sizeof(bossaction_t));
 
@@ -764,6 +764,10 @@ void UMI_LoadUMapInfoLump(lumpnum_t lumpnum)
 
     assert(0 <= len);
 
+    // libdoom-umapinfo needs a memory manager with realloc() equivalent
+    // The zone memory module currently does not provide such a function
+    //doom_umi1_i_register_mmanager(UMI_Realloc, UMI_Free);
+
     {
         int            retval  = DOOM_UMI1_ERROR_MEMORY;
         unsigned char *lump    = UMI_Malloc(len);
@@ -878,7 +882,7 @@ void UMI_Load_LevelInfo(void)
 
         // Key interbackdrop is handled by F_StartFinale()
 
-        // Key intermusic is handled by WI_Ticker()
+        // Key intermusic is handled by F_StartFinale()
 
         // Keys nextmap and nextsecret are handled by G_DoUMapInfo()
 
@@ -902,7 +906,8 @@ void UMI_Load_LevelInfo(void)
 
         // Key bossactions is handled by A_Bosstype_Death()
 
-        // Key endgame is handled by G_NextLevel()
+        // Key endgame is handled by G_NextLevel(), WI_Draw_ShowNextLoc(),
+        // F_Ticker() and WI_Draw_ShowNextLoc()
 
         // Key partime is mapped to info_partime
         if (gamemapinfo->partime)
@@ -913,12 +918,20 @@ void UMI_Load_LevelInfo(void)
                 info_partime = gamemapinfo->partime;
             pars_valid_bex = true;  // Abuse this flag for activation with PWAD
         }
+
+        // Key nointermission is handled by WI_Start()
+
+        // Key endcast is handled by G_NextLevel, F_Ticker() and
+        // WI_Draw_ShowNextLoc()
+
+        // Key endbunny is handled by G_NextLevel, F_Ticker() and
+        // WI_Draw_ShowNextLoc()
     }
 }
 
 
 // Strip "d_" prefix from lump name, if present
-//�(because the�function�S_AddMusic()�adds�a�"d_"�prefix)
+// (because the function S_AddMusic() adds a "d_" prefix)
 // Returns a pointer into name
 const char* UMI_GetMusicLumpName(const char* name)
 {
@@ -933,6 +946,10 @@ const char* UMI_GetMusicLumpName(const char* name)
 
 
 #include "doomincl.h"
+#include "umapinfo.h"
+
+
+umapinfo_t umapinfo = { NULL, NULL, false };
 
 
 // -----------------------------------------------------------------------------
@@ -956,7 +973,7 @@ boolean UMI_ParseMapName(const char *mapname, byte *episode, byte * map)
 }
 
 
-mapentry_t *UMI_LookupUMapinfo(byte episode, byte map)
+mapentry_t *UMI_LookupUMapInfo(byte episode, byte map)
 {
     return NULL;
 }
@@ -968,7 +985,7 @@ void UMI_Load_LevelInfo(void)
 }
 
 
-const�char*�UMI_GetMusicLumpName(const�char*�name)
+const char* UMI_GetMusicLumpName(const char* name)
 {
     return name;
 }
diff --git a/doomlegacy-devel/patches/patch-src_f__finale.c b/doomlegacy-devel/patches/patch-src_f__finale.c
index a67b322a4d..508e5daeda 100644
--- a/doomlegacy-devel/patches/patch-src_f__finale.c
+++ b/doomlegacy-devel/patches/patch-src_f__finale.c
@@ -15,13 +15,14 @@ Add support for UMAPINFO.
  static boolean keypressed=false;
  static byte    finale_palette = 0;  // [WDJ] 0 is PLAYPAL
  
-@@ -84,16 +84,39 @@ void    F_StartCast (void);
+@@ -84,27 +84,45 @@ void    F_StartCast (void);
  void    F_CastTicker (void);
  boolean F_CastResponder (event_t *ev);
  void    F_CastDrawer (void);
 -void    F_Draw_interpic_Name( char * name );
 +// [MB] 2023-02-05: Changed to static and parameter to const for UMAPINFO
 +static void F_Draw_interpic_Name( const char * name );
++
  
  //
  // F_StartFinale
@@ -31,42 +32,144 @@ Add support for UMAPINFO.
  {
      gamestate = GS_FINALE;
  
--    if(info_intertext)
-+    if (gamemapinfo)
++    // [MB] 2023-01-29: Provide defaults for flat and text
++    finaleflat = text[BGFLATE1_NUM];  // Doom E1, FLOOR4_8
++    finaletext = "";  // Skip text screen
++
++    // [MB] 2023-01-29: Support for UMAPINFO added
++    if(gamemapinfo)
 +    {
-+        // [MB] 2023-01-29: Support for UMAPINFO added
-+        if (!secretexit && gamemapinfo->intertext)
++        if(!secretexit && gamemapinfo->intertext)
 +        {
++            // An empty string is set for 'clear' identifier
 +            finaletext = gamemapinfo->intertext;
-+            if (gamemapinfo->interbackdrop)
-+              finaleflat = gamemapinfo->interbackdrop;
-+            else
-+              finaleflat = text[BGFLATE1_NUM]; // Doom E1, FLOOR4_8
-+            goto umapinfo_used;
++            goto beyond_default_setup;
 +        }
-+        else if (secretexit && gamemapinfo->intertextsecret)
++        else if(secretexit && gamemapinfo->intertextsecret)
 +        {
++            // An empty string is set for 'clear' identifier
 +            finaletext = gamemapinfo->intertextsecret;
-+            if (gamemapinfo->interbackdrop)
-+              finaleflat = gamemapinfo->interbackdrop;
-+            else
-+              finaleflat = text[BGFLATE1_NUM]; // Doom E1, FLOOR4_8
-+            goto umapinfo_used;
++            goto beyond_default_setup;
 +        }
 +    }
-+    else if(info_intertext)
++
+     if(info_intertext)
      {
-       //SoM: Use FS level info intermission.
-       finaletext = info_intertext;
-@@ -248,6 +271,7 @@ void F_StartFinale (void)
+-      //SoM: Use FS level info intermission.
+-      finaletext = info_intertext;
+-      if(info_backdrop)
+-        finaleflat = info_backdrop;
+-      else
+-        finaleflat = text[BGFLATE1_NUM]; // Doom E1, FLOOR4_8
+-
+-      finalestage = 0;
+-      finalecount = 0;
+-      return;
++        //SoM: Use FS level info intermission.
++        finaletext = info_intertext;
++        if(info_backdrop)
++            finaleflat = info_backdrop;
++        goto beyond_default_setup;
+     }
+ 
+     // Okay - IWAD dependent stuff.
+@@ -139,7 +157,7 @@ void F_StartFinale (void)
+             finaletext = text[E4TEXT_NUM];
+             break;
+           default:
+-            // Ouch.
++            // [MB] Use defaults
+             break;
+         }
+         break;
+@@ -181,8 +199,8 @@ void F_StartFinale (void)
+               textnum = 5; // text[C6TEXT_NUM];
+               break;
+             default:
+-              // Ouch.
+-              break;
++              // [MB] With UMAPINFO game can end after arbitrary level
++              goto use_defaults;
+           }
+           switch( gamedesc_id )
+           {
+@@ -200,6 +218,7 @@ void F_StartFinale (void)
+              break;
+           }
+           finaletext = text[textnum];
++use_defaults:
+           break;
+       }
+ 
+@@ -248,9 +267,31 @@ void F_StartFinale (void)
          break;
      }
  
-+umapinfo_used:
++beyond_default_setup:
++    // [MB] 2023-01-29: Skip text screen for empty string
++    if (finaletext[0] == 0)
++    {
++        // Fake state when text screen terminates
++        // Use logic in F_Ticker() to decide what to do next
++        // FIXME: Screen wipe does not work correctly
++        finalestage = 0;
++        finalecount = INT_MAX - 1;
++        keypressed  = true;
++        return;
++    }
++
++    // [MB] 2023-01-29: Support for UMAPINFO added
++    if (gamemapinfo && gamemapinfo->interbackdrop)
++        finaleflat = gamemapinfo->interbackdrop;
++    if (gamemapinfo && gamemapinfo->intermusic)
++    {
++        const char *mus_umi = UMI_GetMusicLumpName(gamemapinfo->intermusic);
++
++        S_ChangeMusicName(mus_umi, true);
++    }
++
      finalestage = 0;
      finalecount = 0;
+-
+ }
  
-@@ -363,7 +387,7 @@ void F_TextWrite (void)
+ 
+@@ -314,7 +355,14 @@ void F_Ticker (void)
+                 {
+                     if (gamemode == doom2_commercial)
+                     {
+-                        if (gamemap == 30)
++                        // [MB] 2023-03-26: Support for UMAPINFO added
++                        tristate_t endgame = gamemapinfo ? gamemapinfo->endgame
++                                                         : unchanged;
++
++                        if (endgame == enabled
++                            || (gamemapinfo && gamemapinfo->endcast))
++                            F_StartCast ();
++                        else if (gamemap == 30 && endgame != disabled)
+                             F_StartCast ();
+                         else
+                         {
+@@ -328,7 +376,7 @@ void F_Ticker (void)
+                 }
+             }
+ 
+-            if( gamemode != doom2_commercial)
++            if( gamemode != doom2_commercial )
+             {
+                 uint32_t  f = finalecount;
+                 if( f >= INT_MAX/2 )
+@@ -339,7 +387,8 @@ void F_Ticker (void)
+                     finalecount = 0;
+                     finalestage = 1;
+                     wipegamestate = GS_FORCEWIPE;             // force a wipe
+-                    if (EN_doom_etc && gameepisode == 3)
++                    if ( (EN_doom_etc && gameepisode == 3)
++                         || (gamemapinfo && gamemapinfo->endbunny) )
+                         S_StartMusic (mus_bunny);
+                 }
+             }
+@@ -363,7 +412,7 @@ void F_TextWrite (void)
      // vid : from video setup
      int         w;
      int         count;
@@ -75,7 +178,7 @@ Add support for UMAPINFO.
      int         c;
      int         cx, cy;
  
-@@ -840,7 +864,8 @@ credit_page:
+@@ -840,7 +889,8 @@ credit_page:
  
  
  // Called from F_Drawer, to draw full screen
@@ -85,7 +188,7 @@ Add support for UMAPINFO.
  {
     patch_t*  pic = W_CachePatchName( name, PU_CACHE );  // endian fix
     // Intercept some doom pictures that chex.wad left in (a young kids game).
-@@ -858,14 +883,14 @@ void F_Drawer (void)
+@@ -858,14 +908,18 @@ void F_Drawer (void)
      // Draw to screen0, scaled
      V_SetupDraw( 0 | V_SCALESTART | V_SCALEPATCH | V_CENTERHORZ );
  
@@ -100,18 +203,24 @@ Add support for UMAPINFO.
 -    if (!finalestage)
 -        F_TextWrite ();
 +    if( !finalestage )
-+        F_TextWrite();
++    {
++        // [MB] 2023-03-29: Skip for empty string
++        if( finaletext[0] )
++            F_TextWrite();
++    }
      else
      {
          if( gamemode == heretic )
-@@ -874,10 +899,13 @@ void F_Drawer (void)
+@@ -874,10 +928,15 @@ void F_Drawer (void)
          }
          else
          {
 -           switch (gameepisode)
-+           // [MB] 2023-02-05: Support for UMAPINFO added
-+           if( gamemapinfo && gamemapinfo->endpic )
-+              F_Draw_interpic_Name( gamemapinfo->endpic );
++           // [MB] 2023-03-29: Support for UMAPINFO added
++           if( gamemapinfo && gamemapinfo->endbunny )
++               F_BunnyScroll();
++           else if( gamemapinfo && gamemapinfo->endpic )
++               F_Draw_interpic_Name( gamemapinfo->endpic );
 +           else switch( gameepisode )
             {
              case 1:
@@ -120,7 +229,7 @@ Add support for UMAPINFO.
                  F_Draw_interpic_Name( text[CREDIT_NUM] );
                else
                  F_Draw_interpic_Name( text[HELP2_NUM] );
-@@ -894,5 +922,4 @@ void F_Drawer (void)
+@@ -894,5 +953,4 @@ void F_Drawer (void)
             }
          }
      }
diff --git a/doomlegacy-devel/patches/patch-src_g__game.c b/doomlegacy-devel/patches/patch-src_g__game.c
index e2f19356a3..958e5c4383 100644
--- a/doomlegacy-devel/patches/patch-src_g__game.c
+++ b/doomlegacy-devel/patches/patch-src_g__game.c
@@ -12,14 +12,14 @@ Add support for UMAPINFO.
  char            game_map_filename[MAX_WADPATH];      // an external wad filename
  
  
-@@ -2384,10 +2385,80 @@ void G_DoCompleted (void)
+@@ -2384,10 +2385,91 @@ void G_DoCompleted (void)
      automapactive = false;
  }
  
 +
 +// [MB] 2023-01-22: Support for UMAPINFO added
 +// Returns true if default setup should be skipped
-+static boolean G_DoUMapInfo(void)
++static boolean G_DoUMapInfo (void)
 +{
 +    boolean result = false;
 +
@@ -67,6 +67,17 @@ Add support for UMAPINFO.
 +                    players[i].didsecret = false;
 +            }
 +        }
++
++        // Explicitly check for endgame too
++        // UMAPINFO may contain nonsense (example from 2022ado.wad map E5M8):
++        //     next    = "E5M8"
++        //     endgame = true
++        // Give endgame priority (and do not skip default setup) in such cases
++        if ( result == true && (gamemapinfo->endgame == enabled ||
++             gamemapinfo->endbunny || gamemapinfo->endcast) )
++        {
++            result = false;
++        }
 +    }
 +
 +    return result;
@@ -93,7 +104,7 @@ Add support for UMAPINFO.
      if (gamemode != doom2_commercial)
      {
          switch(gamemap)
-@@ -2401,7 +2472,7 @@ void G_Start_Intermission( void )
+@@ -2401,7 +2483,7 @@ void G_Start_Intermission( void )
                  // also for heretic
                  // disconnect from network
                  CL_Reset();
@@ -102,7 +113,7 @@ Add support for UMAPINFO.
                  return;
              }
              break; // [WDJ] 4/11/2012  map 8 is not secret level, and prboom and boom do not fall thru here.
-@@ -2421,7 +2492,7 @@ void G_Start_Intermission( void )
+@@ -2421,7 +2503,7 @@ void G_Start_Intermission( void )
              else
              {
                  CL_Reset();
@@ -111,7 +122,7 @@ Add support for UMAPINFO.
                  return;
              }
          }
-@@ -2429,14 +2500,11 @@ void G_Start_Intermission( void )
+@@ -2429,14 +2511,11 @@ void G_Start_Intermission( void )
  
      if(!dedicated)
          wminfo.didsecret = consoleplayer_ptr->didsecret;
@@ -127,7 +138,7 @@ Add support for UMAPINFO.
      // overwrite next level in some cases
      if (gamemode == doom2_commercial)
      {
-@@ -2490,6 +2558,21 @@ void G_Start_Intermission( void )
+@@ -2490,6 +2569,21 @@ void G_Start_Intermission( void )
                  wminfo.lev_next = 0; // wrap around in deathmatch
          }
      }
@@ -149,29 +160,70 @@ Add support for UMAPINFO.
  
      wminfo.maxkills = totalkills;
      wminfo.maxitems = totalitems;
-@@ -2542,6 +2625,16 @@ void G_NextLevel (void)
-             if( gamemap == 30 )
-                 wminfo.lev_next = 0; // wrap around in deathmatch
-         }
-+        // [MB] 2023-01-29: Support for UMAPINFO added
-+        else if (gamemapinfo && gamemapinfo->endgame)
+@@ -2535,7 +2629,31 @@ void G_NextLevel (void)
+     if (secretexit)
+         consoleplayer_ptr->didsecret = true;
+ 
+-    if ( gamemode == doom2_commercial)
++    // [MB] 2023-04-01: Support for UMAPINFO added
++    if( gamemapinfo )
++    {
++        boolean finished = false;
++
++        if( gamemapinfo->endbunny )
++            finished = true;
++        if( gamemapinfo->endcast )
++            finished = true;
++        if( gamemapinfo->endgame != unchanged )
 +        {
-+            tristate_t end = gamemapinfo->endgame;
++            if( gamemapinfo->endgame == enabled )
++                finished = true;
++            // Do nothing for 'disabled'
++        }
 +
-+            if( (end == unchanged && gamemap == 30) || end == enabled )
-+                CL_Reset(); // end of game disconnect from server
++        if (finished)
++        {
++            CL_Reset (); // end of game disconnect from server
 +            gameaction = ga_nothing;
-+            F_StartFinale(secretexit);  // [MB] 2023-03-04: Parameter added
++            F_StartFinale (secretexit);  // [MB] 2023-03-04: Parameter added
 +        }
-         else
++    }
++
++    if ( gamemode == doom2_commercial )
+     {
+         if( deathmatch )
          {
-             switch (gamemap)
-@@ -2557,7 +2650,7 @@ void G_NextLevel (void)
+@@ -2555,9 +2673,9 @@ void G_NextLevel (void)
+             case 20:
+             case 30:
                  if( gamemap == 30 )
-                     CL_Reset(); // end of game disconnect from server
+-                    CL_Reset(); // end of game disconnect from server
++                    CL_Reset (); // end of game disconnect from server
                  gameaction = ga_nothing;
 -                F_StartFinale ();
 +                F_StartFinale (secretexit);  // [MB] 2023-03-04: Parameter added
                  break;
              }
          }
+@@ -2574,17 +2692,19 @@ void G_DoWorldDone (void)
+     else
+     {
+         // not in demo because demo have the mapcommand on it
++        // [MB] 2023-03-26: Replaced gameepisode with wminfo.epsd_next+1
++        //                  Crossing episodes is possible with UMAPINFO
+         if(server && !demoplayback) 
+         {
+             if( ! deathmatch )
+             {
+                 // don't reset player between maps
+-                COM_BufAddText (va("map \"%s\" -noresetplayers\n",G_BuildMapName(gameepisode, wminfo.lev_next+1)));
++                COM_BufAddText (va("map \"%s\" -noresetplayers\n",G_BuildMapName(wminfo.epsd_next+1, wminfo.lev_next+1)));
+             }
+             else
+             {
+                 // resetplayer in deathmatch for more equality
+-                COM_BufAddText (va("map \"%s\"\n",G_BuildMapName(gameepisode, wminfo.lev_next+1)));
++                COM_BufAddText (va("map \"%s\"\n",G_BuildMapName(wminfo.epsd_next+1, wminfo.lev_next+1)));
+             }
+         }
+     }
diff --git a/doomlegacy-devel/patches/patch-src_m__menu.c b/doomlegacy-devel/patches/patch-src_m__menu.c
index c93a0065f6..99a0975986 100644
--- a/doomlegacy-devel/patches/patch-src_m__menu.c
+++ b/doomlegacy-devel/patches/patch-src_m__menu.c
@@ -2,9 +2,9 @@ $NetBSD$
 
 Add support for UMAPINFO.
 
---- src/m_menu.c.orig	2023-02-26 17:42:09.000000000 +0000
+--- src/m_menu.c.orig	2023-02-10 15:50:57.000000000 +0000
 +++ src/m_menu.c
-@@ -6300,6 +6300,83 @@ void M_Init (void)
+@@ -6300,6 +6300,88 @@ void M_Init (void)
      CV_RegisterVar(&cv_oof_2s);
  }
  
@@ -56,10 +56,15 @@ Add support for UMAPINFO.
 +        boolean  use_patches = true;
 +        uint16_t i;
 +
-+        // FIXME: This should check if the patches are valid too
++        // FIXME: This should check if patches are really usable
 +        for( i = 0; i < EpiDef.numitems; i++ )
-+            if( EpisodeMenu[i].patch == NULL )
++        {
++            if( EpisodeMenu[i].patch == NULL || EpisodeMenu[i].patch[0] == 0 )
++            {
 +                use_patches = false;
++                break;
++            }
++        }
 +
 +        GenPrintf(EMSG_debug, "UMAPINFO: Modified episode menu ");
 +        if( use_patches )
@@ -88,7 +93,7 @@ Add support for UMAPINFO.
  // Called once after gamemode has been determined, game dependent
  void M_Configure (void)
  {
-@@ -6382,6 +6459,9 @@ void M_Configure (void)
+@@ -6382,6 +6464,9 @@ void M_Configure (void)
            cv_nextmap.defaultvalue = "11";
            // We need to remove the fifth episode.
            EpiDef.numitems--;
diff --git a/doomlegacy-devel/patches/patch-src_p__enemy.c b/doomlegacy-devel/patches/patch-src_p__enemy.c
index bc8a760aac..2544544667 100644
--- a/doomlegacy-devel/patches/patch-src_p__enemy.c
+++ b/doomlegacy-devel/patches/patch-src_p__enemy.c
@@ -2,9 +2,9 @@ $NetBSD$
 
 Add support for UMAPINFO.
 
---- src/p_enemy.c.orig	2023-02-10 15:51:01.000000000 +0000
+--- src/p_enemy.c.orig	2023-02-26 17:42:27.000000000 +0000
 +++ src/p_enemy.c
-@@ -3401,6 +3401,66 @@ static state_t *P_FinalState(statenum_t 
+@@ -3401,6 +3401,66 @@ static state_t *P_FinalState(statenum_t
      return &states[state];
  }
  
@@ -71,7 +71,7 @@ Add support for UMAPINFO.
  //
  // A_BossDeath
  // Possibly trigger special effects
-@@ -3412,13 +3472,73 @@ static state_t *P_FinalState(statenum_t 
+@@ -3412,13 +3472,74 @@ static state_t *P_FinalState(statenum_t
  // [WDJ]  Keen death does not have tests for mo->type and thus allows
  // Dehacked monsters to trigger Keen death and BossDeath effects.
  // Should duplicate that ability in Doom maps.
@@ -86,43 +86,26 @@ Add support for UMAPINFO.
 +    line_t lineop;  // operation performed when all bosses are dead.
 +
 +    // [MB] 2023-03-19: Support for UMAPINFO added
++    GenPrintf(EMSG_debug, "Boss died (Type: %d)\n", boss_type);
 +    if( gamemapinfo && gamemapinfo->bossactions )
 +    {
-+        struct bossaction_t*  umi_ba = gamemapinfo->bossactions;
-+        boolean               found  = false;
++        struct bossaction_t* umi_ba = gamemapinfo->bossactions;
 +
-+        do
-+        {
-+            if( boss_type == umi_ba->thing)
-+            {
-+                found = true;
-+                break;
-+            }
-+            umi_ba = umi_ba->next;
-+        }
-+        while( umi_ba );
-+
-+        if( !found )
-+            return;
-+
-+        // DEHEXTRA is not supported
-+        if( boss_type > ENDDOOM_MT )
-+        {
-+            GenPrintf(EMSG_debug,
-+                      "UMAPINFO: Thing for bossaction not supported\n");
++        if( ! A_Player_Alive() )
 +            return;
-+        }
 +
 +        if( ! A_All_Bosses_Dead(mo, boss_type) )
 +            return;
 +
-+        // Execute (potentially multiple) actions defined by UMAPINFO
-+        umi_ba = gamemapinfo->bossactions;
 +        do
 +        {
-+            if( boss_type == umi_ba->thing)
++            if( boss_type >= 0 && (unsigned int)boss_type == umi_ba->thing)
 +            {
-+                // FIXME: Is this allowed for the xxxSpecialLine() functions?
++                GenPrintf(EMSG_debug, "UMAPINFO: Matching bossaction found\n");
++                GenPrintf(EMSG_debug, "UMAPINFO: (Line: %u, Tag: %u)\n",
++                          umi_ba->special, umi_ba->tag);
++
++                // FIXME: Is this sufficient for the xxxSpecialLine() functions?
 +                memset(&lineop, 0, sizeof(line_t));
 +                if (umi_ba->special > (unsigned int)SHRT_MAX)
 +                    continue;
@@ -132,8 +115,26 @@ Add support for UMAPINFO.
 +                lineop.tag = (uint16_t)umi_ba->tag;
 +
 +                // Try to use the line first, cross it if not successful
-+                if( ! P_UseSpecialLine(mo, &lineop, 0) )
-+                    P_CrossSpecialLine(&lineop, 0, mo);
++                {
++                    // Prepare fake player (as modified copy of boss map object)
++                    mobj_t fake_player_mo = *mo;
++
++                    fake_player_mo.type   = MT_PLAYER;
++                    fake_player_mo.player = &players[0];
++
++#if 0
++                    // Does not return false, if there is nothing to use
++                    if( ! P_UseSpecialLine(&fake_player_mo, &lineop, 0) )
++                    {
++                        GenPrintf(EMSG_debug, "UMAPINFO: Cross special line\n");
++                        P_CrossSpecialLine(&lineop, 0, &fake_player_mo);
++                    }
++#else
++                    // Workaround (do both unconditionally)
++                    (void)P_UseSpecialLine(&fake_player_mo, &lineop, 0);
++                    P_CrossSpecialLine(&lineop, 0, &fake_player_mo);
++#endif
++                }
 +            }
 +            umi_ba = umi_ba->next;
 +        }
@@ -151,7 +152,7 @@ Add support for UMAPINFO.
      if ( gamemode == doom2_commercial)
      {
          // Doom2 MAP07: When last Mancubus is dead,
-@@ -3515,45 +3635,14 @@ void A_Bosstype_Death (mobj_t* mo, int b
+@@ -3515,45 +3636,14 @@ void A_Bosstype_Death (mobj_t* mo, int b
  
      }
  
diff --git a/doomlegacy-devel/patches/patch-src_wi__stuff.c b/doomlegacy-devel/patches/patch-src_wi__stuff.c
index f06abd204e..4ed7156532 100644
--- a/doomlegacy-devel/patches/patch-src_wi__stuff.c
+++ b/doomlegacy-devel/patches/patch-src_wi__stuff.c
@@ -51,7 +51,10 @@ Add support for UMAPINFO.
 +    // suitable font (PrBoom uses STFxxx) to ensure that the proper name is
 +    // used. If the author field is set, it will also be shown.
 +    if (wbs->lastmapinfo && wbs->lastmapinfo->levelpic)
-+    {
+     {
+-        V_DrawTextB(P_LevelName(), (BASEVIDWIDTH - V_TextBWidth(P_LevelName()))/2, y);
+-        y += (5*V_TextBHeight(P_LevelName()))/4;
+-        V_DrawTextB("Finished", (BASEVIDWIDTH - V_TextBWidth("Finished"))/2, y);
 +        pp = W_CachePatchName(wbs->lastmapinfo->levelpic, PU_CACHE);
 +        pf = V_patch(pp);  // access patch fields
 +        x = (BASEVIDWIDTH - pf->width) / 2;
@@ -61,12 +64,9 @@ Add support for UMAPINFO.
 +
 +        x = (BASEVIDWIDTH - (V_patch(finished)->width)) / 2;
 +        V_DrawScaledPatch(x, y, finished);
-+    }
+     }
 +    else if (wbs->lastmapinfo && wbs->lastmapinfo->levelname)
-     {
--        V_DrawTextB(P_LevelName(), (BASEVIDWIDTH - V_TextBWidth(P_LevelName()))/2, y);
--        y += (5*V_TextBHeight(P_LevelName()))/4;
--        V_DrawTextB("Finished", (BASEVIDWIDTH - V_TextBWidth("Finished"))/2, y);
++    {
 +        const char * level_string = wbs->lastmapinfo->levelname;
 +
 +        x = (BASEVIDWIDTH - V_StringWidth(level_string)) / 2;
@@ -86,7 +86,7 @@ Add support for UMAPINFO.
 +
 +        x = (BASEVIDWIDTH - (V_patch(finished)->width)) / 2;
 +        V_DrawScaledPatch(x, y, finished);
-     }
++    }
 +    // Normal behaviour without UMAPINFO
      else
      {
@@ -136,7 +136,7 @@ Add support for UMAPINFO.
 -    // draw "Entering"
 -    if( FontBBaseLump )
 +    // [MB] 2023-03-12: Support for UMAPINFO added
-+    // See WI_Draw_LF() for additional notes.
++    // See WI_Draw_LF() for additional notes about levelpic
 +    if (wbs->nextmapinfo && wbs->nextmapinfo->levelpic)
      {
 -        const char * levname = P_LevelNameByNum(wbs->epsd+1, wbs->lev_next+1);
@@ -164,8 +164,7 @@ Add support for UMAPINFO.
 -        pf = V_patch( pp );  // access patch fields
 -        y += (5 * pf->height)/4;
 +        const char * level_string = wbs->nextmapinfo->levelname;
- 
--        V_DrawScaledPatch((BASEVIDWIDTH - pf->width)/2, y, pp);
++
 +        x = (BASEVIDWIDTH - (V_patch(entering)->width)) / 2;
 +        V_DrawScaledPatch(x, y, entering);
 +
@@ -173,7 +172,8 @@ Add support for UMAPINFO.
 +
 +        x = (BASEVIDWIDTH - V_StringWidth(level_string)) / 2;
 +        V_DrawString(x, y, V_WHITEMAP, level_string);
-+
+ 
+-        V_DrawScaledPatch((BASEVIDWIDTH - pf->width)/2, y, pp);
 +        if (wbs->nextmapinfo && wbs->nextmapinfo->author)
 +        {
 +            const char * author_string = wbs->nextmapinfo->author;
@@ -192,7 +192,7 @@ Add support for UMAPINFO.
 +        {
 +            const char * level_string = P_LevelNameByNum(wbs->epsd + 1,
 +                                                         wbs->lev_next + 1);
- 
++
 +            x = (BASEVIDWIDTH - V_TextBWidth("Entering")) / 2;
 +            V_DrawTextB("Entering", x, y);
 +
@@ -210,7 +210,7 @@ Add support for UMAPINFO.
 +            // draw level
 +            pp = lnames[wbs->lev_next];
 +            pf = V_patch(pp);  // access patch fields
-+
+ 
 +            y += (5 * pf->height) / 4;
 +
 +            x = (BASEVIDWIDTH - pf->width) / 2;
@@ -223,11 +223,18 @@ Add support for UMAPINFO.
  // [WDJ] Made more resistent to segfault.
  // Doom YAH draw
  //  n : YAH index
-@@ -958,6 +1084,13 @@ static void WI_Draw_ShowNextLoc(void)
+@@ -958,6 +1084,20 @@ static void WI_Draw_ShowNextLoc(void)
      if (cnt<=0)  // all removed no draw !!!
          return;
  
-+    // [MB] 2023-03-19: Support for UMAPINFO added
++    // [MB] 2023-04-01: Support for UMAPINFO added
++    if (wbs->lastmapinfo)
++    {
++        if ( (wbs->lastmapinfo->endgame == enabled) ||
++             (wbs->lastmapinfo->endbunny) ||
++             (wbs->lastmapinfo->endcast) )
++            return;
++    }
 +    if (wbs->nextmapinfo && wbs->nextmapinfo->enterpic)
 +    {
 +        strcpy(bgname, wbs->nextmapinfo->enterpic);
@@ -237,7 +244,28 @@ Add support for UMAPINFO.
      WI_Slam_Background();
  
      // draw animated background
-@@ -1977,7 +2110,6 @@ static void WI_checkForAccelerate(void)
+@@ -990,10 +1130,16 @@ static void WI_Draw_ShowNextLoc(void)
+     }
+ 
+     // draws which level you are entering..
+-    if ( EN_doom_etc
+-         && !((gamemode == doom2_commercial) && (wbs->lev_next == 30)) )
+-        WI_Draw_EL();
+-
++    if (EN_doom_etc)
++    {
++        boolean map30 = (gamemode == doom2_commercial) && (wbs->lev_next == 30);
++        boolean do_el = wbs->lastmapinfo
++                        && (wbs->lastmapinfo->endgame == disabled);
++
++        // [MB] 2023-04-02: Draw EL if UMAPINFO has disabled endgame
++        if (!map30 || do_el)
++            WI_Draw_EL();
++    }
+ }
+ 
+ // Called by WI_Drawer
+@@ -1977,7 +2123,6 @@ static void WI_checkForAccelerate(void)
  }
  
  
@@ -245,33 +273,7 @@ Add support for UMAPINFO.
  // Updates stuff each client tick.
  void WI_Ticker(void)
  {
-@@ -1986,11 +2118,21 @@ void WI_Ticker(void)
- 
-     if (bcnt == 1)
-     {
--        // intermission music
--        if ( gamemode == doom2_commercial )
--          S_ChangeMusic(mus_dm2int, true);
-+        // [MB] 2023-01-22: Support for UMAPINFO added
-+        if (gamemapinfo && gamemapinfo->intermusic)
-+        {
-+            const char *mus_umi = UMI_GetMusicLumpName(gamemapinfo->intermusic);
-+
-+            S_ChangeMusicName(mus_umi, true);
-+        }
-         else
--          S_ChangeMusic(mus_inter, true);
-+        {
-+            // intermission music
-+            if ( gamemode == doom2_commercial )
-+              S_ChangeMusic(mus_dm2int, true);
-+            else
-+              S_ChangeMusic(mus_inter, true);
-+        }
-     }
- 
-     WI_checkForAccelerate();
-@@ -2097,20 +2239,8 @@ void WI_Load_Data(void)
+@@ -2097,20 +2242,8 @@ void WI_Load_Data(void)
          if (wb_epsd == 3)
              strcpy(bgname,"INTERPIC");
      }
@@ -293,3 +295,18 @@ Add support for UMAPINFO.
  
      // UNUSED unsigned char *pic = screens[1];
      // if (gamemode == doom2_commercial)
+@@ -2333,6 +2466,14 @@ void WI_Start(wb_start_t * wb_start)
+         WI_Init_NetgameStats();
+         // wait_game_start_timer will be set by network
+     }
++    // [MB] 2023-03-29: Support for UMAPINFO added
++    else if( gamemapinfo && gamemapinfo->nointermission )
++    {
++        if ( gamemode == doom2_commercial )
++            WI_Init_NoState();
++        else
++            WI_Init_ShowNextLoc();
++    }
+     else
+         WI_Init_Stats();
+ }


Home | Main Index | Thread Index | Old Index