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

- added additional hires namespaces to prevent name conflicts for hires packages #873

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions src/gamedata/resourcefiles/file_wad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ bool FWadFile::Open(bool quiet)
SetNamespace("TX_START", "TX_END", ns_newtextures);
SetNamespace("V_START", "V_END", ns_strifevoices);
SetNamespace("HI_START", "HI_END", ns_hires);
SetNamespace("HF_START", "HF_END", ns_hires_flats);
SetNamespace("HS_START", "HS_END", ns_hires_sprites);
SetNamespace("HG_START", "HG_END", ns_hires_graphics);
SetNamespace("HW_START", "HW_END", ns_hires_walltextures);
SetNamespace("VX_START", "VX_END", ns_voxels);
SkinHack();
}
Expand Down
32 changes: 18 additions & 14 deletions src/gamedata/resourcefiles/resourcefile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,23 @@ void FResourceLump::LumpNameSetup(FString iname)
// Map some directories to WAD namespaces.
// Note that some of these namespaces don't exist in WADS.
// CheckNumForName will handle any request for these namespaces accordingly.
Namespace = !strncmp(iname, "flats/", 6) ? ns_flats :
!strncmp(iname, "textures/", 9) ? ns_newtextures :
!strncmp(iname, "hires/", 6) ? ns_hires :
!strncmp(iname, "sprites/", 8) ? ns_sprites :
!strncmp(iname, "voxels/", 7) ? ns_voxels :
!strncmp(iname, "colormaps/", 10) ? ns_colormaps :
!strncmp(iname, "acs/", 4) ? ns_acslibrary :
!strncmp(iname, "voices/", 7) ? ns_strifevoices :
!strncmp(iname, "patches/", 8) ? ns_patches :
!strncmp(iname, "graphics/", 9) ? ns_graphics :
!strncmp(iname, "sounds/", 7) ? ns_sounds :
!strncmp(iname, "music/", 6) ? ns_music :
!strchr(iname, '/') ? ns_global :
Namespace = !strncmp(iname, "flats/", 6) ? ns_flats :
!strncmp(iname, "textures/", 9) ? ns_newtextures :
!strncmp(iname, "hires/flats/", 12) ? ns_hires_flats :
!strncmp(iname, "hires/sprites/", 14) ? ns_hires_sprites :
!strncmp(iname, "hires/graphics/", 15) ? ns_hires_graphics :
!strncmp(iname, "hires/walltextures/", 19) ? ns_hires_walltextures :
!strncmp(iname, "hires/", 6) ? ns_hires :
!strncmp(iname, "sprites/", 8) ? ns_sprites :
!strncmp(iname, "voxels/", 7) ? ns_voxels :
!strncmp(iname, "colormaps/", 10) ? ns_colormaps :
!strncmp(iname, "acs/", 4) ? ns_acslibrary :
!strncmp(iname, "voices/", 7) ? ns_strifevoices :
!strncmp(iname, "patches/", 8) ? ns_patches :
!strncmp(iname, "graphics/", 9) ? ns_graphics :
!strncmp(iname, "sounds/", 7) ? ns_sounds :
!strncmp(iname, "music/", 6) ? ns_music :
!strchr(iname, '/') ? ns_global :
ns_hidden;

// Anything that is not in one of these subdirectories or the main directory
Expand All @@ -131,7 +135,7 @@ void FResourceLump::LumpNameSetup(FString iname)
// Since '\' can't be used as a file name's part inside a ZIP
// we have to work around this for sprites because it is a valid
// frame character.
else if (Namespace == ns_sprites || Namespace == ns_voxels || Namespace == ns_hires)
else if (Namespace == ns_sprites || Namespace == ns_hires_sprites || Namespace == ns_voxels || Namespace == ns_hires)
{
char *c;

Expand Down
38 changes: 34 additions & 4 deletions src/gamedata/textures/texturemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,8 @@ void FTextureManager::AddHiresTextures (int wadnum)
{
int firsttx = Wads.GetFirstLump(wadnum);
int lasttx = Wads.GetLastLump(wadnum);
int ns;
ETextureType type;

FString Name;
TArray<FTextureID> tlist;
Expand All @@ -639,11 +641,31 @@ void FTextureManager::AddHiresTextures (int wadnum)

for (;firsttx <= lasttx; ++firsttx)
{
if (Wads.GetLumpNamespace(firsttx) == ns_hires)
ns = Wads.GetLumpNamespace(firsttx);
switch(ns)
{
case ns_hires_flats:
type = ETextureType::Flat;
break;
case ns_hires_sprites:
type = ETextureType::Sprite;
break;
case ns_hires_graphics:
type = ETextureType::MiscPatch;
break;
case ns_hires_walltextures:
type = ETextureType::Wall;
break;
default:
type = ETextureType::Override;
break;
}

if (ns >= ns_hires && ns <= ns_hires_walltextures)
{
Wads.GetLumpName (Name, firsttx);

if (Wads.CheckNumForName (Name, ns_hires) == firsttx)
if (Wads.CheckNumForName (Name, ns) == firsttx)
{
tlist.Clear();
int amount = ListTextures(Name, tlist);
Expand All @@ -653,18 +675,22 @@ void FTextureManager::AddHiresTextures (int wadnum)
FTexture * newtex = FTexture::CreateTexture (Name, firsttx, ETextureType::Any);
if (newtex != NULL)
{
newtex->UseType=ETextureType::Override;
newtex->UseType = type;
AddTexture(newtex);
}
}
else
{
for(unsigned int i = 0; i < tlist.Size(); i++)
{
FTexture * oldtex = Textures[tlist[i].GetIndex()].Texture;
if (type != ETextureType::Override && oldtex->UseType != type)
continue;

FTexture * newtex = FTexture::CreateTexture ("", firsttx, ETextureType::Any);
if (newtex != NULL)
{
FTexture * oldtex = Textures[tlist[i].GetIndex()].Texture;
newtex->UseType = type;

// Replace the entire texture and adjust the scaling and offset factors.
newtex->bWorldPanning = true;
Expand Down Expand Up @@ -1360,6 +1386,10 @@ int FTextureManager::GuesstimateNumTextures ()
case ns_sprites:
case ns_newtextures:
case ns_hires:
case ns_hires_flats:
case ns_hires_sprites:
case ns_hires_graphics:
case ns_hires_walltextures:
case ns_patches:
case ns_graphics:
numtex++;
Expand Down
4 changes: 4 additions & 0 deletions src/gamedata/w_wad.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ typedef enum {
ns_bloodmisc,
ns_strifevoices,
ns_hires,
ns_hires_flats,
ns_hires_sprites,
ns_hires_graphics,
ns_hires_walltextures,
ns_voxels,

// These namespaces are only used to mark lumps in special subdirectories
Expand Down
4 changes: 4 additions & 0 deletions wadsrc/static/zscript/base.zs
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,10 @@ struct Wads
ns_bloodmisc,
ns_strifevoices,
ns_hires,
ns_hires_flats,
ns_hires_sprites,
ns_hires_graphics,
ns_hires_walltextures,
ns_voxels,

ns_specialzipdirectory,
Expand Down