sezero / quakespasm

QuakeSpasm -- A modern, cross-platform Quake game engine based on FitzQuake.
https://sourceforge.net/projects/quakespasm/
GNU General Public License v2.0
244 stars 97 forks source link

Quake Enhanced, Scourge of Armagon - missing texture #56

Open mooreye opened 1 year ago

mooreye commented 1 year ago

When playing Quake Enhanced, Scourge of Armagon, map hip2m4 the end gate of the level has checkered/missing texture, as seen on the screenshot. My hipnotic's pak0.pak md5sum is a9e2a6e544da7f506f6b65b0661e89a9, I use GOG purchase of Quake Enhanced.

https://imgur.com/1376s0r

sezero commented 1 year ago

Reproduced with quake enhanced update3, hipnotic pak0.pak is 79,928,584 bytes with md5sum 4dd6bf448c9c3c2615b47e2e20bedb43

Possibly a missing texture - haven't investigated. How does ironwail or vkquake work? (CC: @andrei-drexler, @Novum)

sezero commented 1 year ago

Same thing happens in vkquake for me

Novum commented 1 year ago

And I assume this does not happen in the Kex Quake?

mooreye commented 1 year ago

And I assume this does not happen in the Kex Quake?

No, it doesn't seem to happen, although it uses different texture than the retro SoA did: https://youtu.be/VS6OwwXFIc4?t=409

Novum commented 1 year ago

I'm getting a warning "Mod_LoadTexInfo: 12 textures missing from BSP file". Does not happen with the original hipnotic (non rerelease).

After debugging for like 5 minutes I have no idea how this works in Kex Quake: The texture lump just has invalid (-1) dataofs entries.

mooreye commented 1 year ago

Can anything be done to fix this with an extra pak1.pak or so?

andrey-budko commented 1 year ago

They probably use textures[0] for missed textures.

--- a/Quake/gl_model.c
+++ b/Quake/gl_model.c
@@ -1052,10 +1052,9 @@ static void Mod_LoadTexinfo (lump_t *l)
        if (miptex >= loadmodel->numtextures-1 || !loadmodel->textures[miptex])
        {
            if (out->flags & TEX_SPECIAL)
-               out->texture = loadmodel->textures[loadmodel->numtextures-1];
+               out->texture = loadmodel->textures[0];
            else
-               out->texture = loadmodel->textures[loadmodel->numtextures-2];
-           out->flags |= TEX_MISSING;
+               out->texture = loadmodel->textures[0];
            missing++;
        }
        else
rerelease ![image](https://github.com/sezero/quakespasm/assets/6490190/36ccc942-8a49-4103-a94b-899d6a25a8a5)
patched quakespasm ![image](https://github.com/sezero/quakespasm/assets/6490190/f595d5e8-cc13-4822-a3c0-5462d72b7bbd)
sezero commented 1 year ago

Huh.. Thanks @andrey-budko. Now, if we had a fool-proof way of detecting rerelease content..

sezero commented 1 year ago

@Novum, @temx, @ericwa, @andrei-drexler: What do you think of this?

andrey-budko commented 1 year ago

I think we can ask @svkaiser

sezero commented 1 year ago

FWIW, I can make a 'detection' (cough..) of remastered content like below. Combined with @andrey-budko suggestion, it would be like:

index c80450f..24781c3 100644
--- a/Quake/common.c
+++ b/Quake/common.c
@@ -39,6 +39,7 @@ cvar_t    cmdline = {"cmdline","",CVAR_ROM/*|CVAR_SERVERINFO*/}; /* sending cmdline
 static qboolean        com_modified;   // set true if using non-id files

 qboolean       fitzmode;
+qboolean       remastered = false;

 static void COM_Path_f (void);

@@ -2135,6 +2136,13 @@ _add_path:
            search->next = com_searchpaths;
            com_searchpaths = search;
        }
+       if (i == 0 && path_id == 1) {
+           if (COM_FileExists("progs/b_g_key_00_00.lmp", NULL) &&
+               file_from_pak && com_filesize == 4104) {
+               remastered = true; /* 2021 re-release content */
+               Con_Printf ("Playing remastered version.\n");
+           }
+       }
        if (qspak) {
            search = (searchpath_t *) Z_Malloc(sizeof(searchpath_t));
            search->path_id = path_id;
diff --git a/Quake/gl_model.c b/Quake/gl_model.c
index 46a83a9..0a9729c 100644
--- a/Quake/gl_model.c
+++ b/Quake/gl_model.c
@@ -1051,6 +1051,9 @@ static void Mod_LoadTexinfo (lump_t *l)
        //johnfitz -- rewrote this section
        if (miptex >= loadmodel->numtextures-1 || !loadmodel->textures[miptex])
        {
+           if (remastered)
+               out->texture = loadmodel->textures[0];
+           else
            if (out->flags & TEX_SPECIAL)
                out->texture = loadmodel->textures[loadmodel->numtextures-1];
            else
diff --git a/Quake/common.h b/Quake/common.h
index 05ff9d3..7694215 100644
--- a/Quake/common.h
+++ b/Quake/common.h
@@ -397,6 +397,7 @@ long FS_filelength (fshandle_t *fh);

 extern struct cvar_s   registered;
+extern qboolean        remastered;
 extern qboolean        standard_quake, rogue, hipnotic;
 extern qboolean        fitzmode;
    /* if true, run in fitzquake mode disabling custom quakespasm hacks */
andrey-budko commented 1 year ago

no lightmap with TEX_MISSING flag

![a](https://github.com/sezero/quakespasm/assets/6490190/8b15cb11-b6ae-4740-92f8-a810d96eb6e7)
sezero commented 1 year ago

no lightmap with TEX_MISSING flag

Well, I wasn't expecting any solutions to this thing at all to begin with.

I'm still not sure that your patch whether your patch can cause any serious side effects either. Ie.: no lightmap would be the least of issues with replacement textures, no?

andrey-budko commented 1 year ago

Just in case you didn't notice. I'm not sure about my patch too.