And finally... W_CheckNumForNamePwad
This commit is contained in:
parent
24de618653
commit
91636209ff
2 changed files with 5 additions and 20 deletions
|
|
@ -6658,23 +6658,19 @@ skip_lump:
|
|||
|
||||
if (PK3)
|
||||
{
|
||||
shader_lumpname = Z_Malloc(strlen(value) + 12, PU_STATIC, NULL);
|
||||
strcpy(shader_lumpname, "Shaders/sh_");
|
||||
strcat(shader_lumpname, value);
|
||||
shader_lumpname = xva("Shaders/sh_%s", value);
|
||||
shader_lumpnum = W_CheckNumForFullNamePK3(shader_lumpname, wadnum, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
shader_lumpname = Z_Malloc(strlen(value) + 4, PU_STATIC, NULL);
|
||||
strcpy(shader_lumpname, "SH_");
|
||||
strcat(shader_lumpname, value);
|
||||
shader_lumpnum = W_CheckNumForNamePwad(shader_lumpname, wadnum, 0);
|
||||
shader_lumpname = xva("SH_%.5s", value);
|
||||
shader_lumpnum = W_CheckNumForLongNamePwad(shader_lumpname, wadnum, 0);
|
||||
}
|
||||
|
||||
if (shader_lumpnum == LUMPERROR)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "HWR_LoadCustomShadersFromFile: Missing shader source %s (file %s, line %d)\n", shader_lumpname, wadfiles[wadnum]->filename, linenum);
|
||||
Z_Free(shader_lumpname);
|
||||
free(shader_lumpname);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -6685,7 +6681,7 @@ skip_lump:
|
|||
HWD.pfnLoadCustomShader(shaderxlat[i].id, shader_source, shader_size, (shadertype == 2));
|
||||
|
||||
Z_Free(shader_source);
|
||||
Z_Free(shader_lumpname);
|
||||
free(shader_lumpname);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
11
src/w_wad.h
11
src/w_wad.h
|
|
@ -133,18 +133,7 @@ const char *W_CheckFullNameForNum(lumpnum_t lumpnum);
|
|||
|
||||
UINT16 W_FindNextEmptyInPwad(UINT16 wad, UINT16 startlump); // checks only in one pwad
|
||||
|
||||
// helper for old functions that use 8-char names
|
||||
// careful, you might be dealing with a non-terminated string!
|
||||
static inline const char *W_ShortName(const char *name)
|
||||
{
|
||||
static char shortname[8+1];
|
||||
strncpy(shortname, name, 8);
|
||||
shortname[8] = '\0';
|
||||
return shortname;
|
||||
}
|
||||
|
||||
UINT16 W_CheckNumForMapPwad(const char *name, UINT32 hash, UINT16 wad, UINT16 startlump);
|
||||
#define W_CheckNumForNamePwad(name, wad, start) W_CheckNumForLongNamePwad(W_ShortName(name), wad, start)
|
||||
UINT16 W_CheckNumForLongNamePwad(const char *name, UINT16 wad, UINT16 startlump);
|
||||
UINT16 W_CheckNumForNamePrefixPwad(const char *name, size_t namelen, UINT16 wad, UINT16 startlump);
|
||||
UINT16 W_CheckNumForNameMultiPrefixPwad(const lumpprefixes_t *prefixes, size_t numprefixes, UINT16 wad, UINT16 startlump);
|
||||
|
|
|
|||
Loading…
Reference in a new issue