mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-27 22:33:17 +00:00
Merge branch 'master' of https://github.com/rheit/zdoom
# By Christoph Oelckers (2) and Edward Richardson (1) # Via Christoph Oelckers * 'master' of https://github.com/rheit/zdoom: - fixed: The map setup code was still truncating texture names in several places. Fix nettic run-out at end of demo playback - fixed: ACS's check...Texture functions must use the same search flags as the texture initialization code in p_setup.cpp and p_udmf.cpp. It also should not create textures that don't exist yet. We are only doing a comparison so it's not relevant if the texture exists or not.
This commit is contained in:
commit
ae8995e65b
7 changed files with 52 additions and 42 deletions
|
@ -1054,7 +1054,7 @@ void NetUpdate (void)
|
||||||
|
|
||||||
if (demoplayback)
|
if (demoplayback)
|
||||||
{
|
{
|
||||||
nettics[0] = (maketic / ticdup);
|
resendto[0] = nettics[0] = (maketic / ticdup);
|
||||||
return; // Don't touch netcmd data while playing a demo, as it'll already exist.
|
return; // Don't touch netcmd data while playing a demo, as it'll already exist.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,14 @@ struct mapsidedef_t
|
||||||
short sector; // Front sector, towards viewer.
|
short sector; // Front sector, towards viewer.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct intmapsidedef_t
|
||||||
|
{
|
||||||
|
FString toptexture;
|
||||||
|
FString bottomtexture;
|
||||||
|
FString midtexture;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// A LineDef, as used for editing, and as input to the BSP builder.
|
// A LineDef, as used for editing, and as input to the BSP builder.
|
||||||
struct maplinedef_t
|
struct maplinedef_t
|
||||||
{
|
{
|
||||||
|
|
|
@ -3944,7 +3944,9 @@ bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, b
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
FTexture *tex = TexMan.FindTexture(FBehavior::StaticLookupString(string));
|
FTexture *tex = TexMan.FindTexture(FBehavior::StaticLookupString(string), FTexture::TEX_Flat,
|
||||||
|
FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny|FTextureManager::TEXMAN_DontCreate);
|
||||||
|
|
||||||
if (tex == NULL)
|
if (tex == NULL)
|
||||||
{ // If the texture we want to check against doesn't exist, then
|
{ // If the texture we want to check against doesn't exist, then
|
||||||
// they're obviously not the same.
|
// they're obviously not the same.
|
||||||
|
|
|
@ -577,13 +577,11 @@ void MapData::GetChecksum(BYTE cksum[16])
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
static void SetTexture (side_t *side, int position, const char *name8, FMissingTextureTracker &track)
|
static void SetTexture (side_t *side, int position, const char *name, FMissingTextureTracker &track)
|
||||||
{
|
{
|
||||||
static const char *positionnames[] = { "top", "middle", "bottom" };
|
static const char *positionnames[] = { "top", "middle", "bottom" };
|
||||||
static const char *sidenames[] = { "first", "second" };
|
static const char *sidenames[] = { "first", "second" };
|
||||||
char name[9];
|
|
||||||
strncpy (name, name8, 8);
|
|
||||||
name[8] = 0;
|
|
||||||
FTextureID texture = TexMan.CheckForTexture (name, FTexture::TEX_Wall,
|
FTextureID texture = TexMan.CheckForTexture (name, FTexture::TEX_Wall,
|
||||||
FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny);
|
FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny);
|
||||||
|
|
||||||
|
@ -619,12 +617,17 @@ static void SetTexture (side_t *side, int position, const char *name8, FMissingT
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void SetTexture (sector_t *sector, int index, int position, const char *name8, FMissingTextureTracker &track)
|
void SetTexture (sector_t *sector, int index, int position, const char *name, FMissingTextureTracker &track, bool truncate)
|
||||||
{
|
{
|
||||||
static const char *positionnames[] = { "floor", "ceiling" };
|
static const char *positionnames[] = { "floor", "ceiling" };
|
||||||
char name[9];
|
char name8[9];
|
||||||
strncpy (name, name8, 8);
|
if (truncate)
|
||||||
name[8] = 0;
|
{
|
||||||
|
strncpy(name8, name, 8);
|
||||||
|
name8[8] = 0;
|
||||||
|
name = name8;
|
||||||
|
}
|
||||||
|
|
||||||
FTextureID texture = TexMan.CheckForTexture (name, FTexture::TEX_Flat,
|
FTextureID texture = TexMan.CheckForTexture (name, FTexture::TEX_Flat,
|
||||||
FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny);
|
FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny);
|
||||||
|
|
||||||
|
@ -674,11 +677,8 @@ static void SummarizeMissingTextures(const FMissingTextureTracker &missing)
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
static void SetTexture (side_t *side, int position, DWORD *blend, char *name8)
|
static void SetTexture (side_t *side, int position, DWORD *blend, const char *name)
|
||||||
{
|
{
|
||||||
char name[9];
|
|
||||||
strncpy (name, name8, 8);
|
|
||||||
name[8] = 0;
|
|
||||||
FTextureID texture;
|
FTextureID texture;
|
||||||
if ((*blend = R_ColormapNumForName (name)) == 0)
|
if ((*blend = R_ColormapNumForName (name)) == 0)
|
||||||
{
|
{
|
||||||
|
@ -705,12 +705,9 @@ static void SetTexture (side_t *side, int position, DWORD *blend, char *name8)
|
||||||
side->SetTexture(position, texture);
|
side->SetTexture(position, texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetTextureNoErr (side_t *side, int position, DWORD *color, char *name8, bool *validcolor, bool isFog)
|
static void SetTextureNoErr (side_t *side, int position, DWORD *color, const char *name, bool *validcolor, bool isFog)
|
||||||
{
|
{
|
||||||
char name[9];
|
|
||||||
FTextureID texture;
|
FTextureID texture;
|
||||||
strncpy (name, name8, 8);
|
|
||||||
name[8] = 0;
|
|
||||||
*validcolor = false;
|
*validcolor = false;
|
||||||
texture = TexMan.CheckForTexture (name, FTexture::TEX_Wall,
|
texture = TexMan.CheckForTexture (name, FTexture::TEX_Wall,
|
||||||
FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny);
|
FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny);
|
||||||
|
@ -1515,8 +1512,8 @@ void P_LoadSectors (MapData *map, FMissingTextureTracker &missingtex)
|
||||||
ss->ceilingplane.d = ss->GetPlaneTexZ(sector_t::ceiling);
|
ss->ceilingplane.d = ss->GetPlaneTexZ(sector_t::ceiling);
|
||||||
ss->ceilingplane.c = -FRACUNIT;
|
ss->ceilingplane.c = -FRACUNIT;
|
||||||
ss->ceilingplane.ic = -FRACUNIT;
|
ss->ceilingplane.ic = -FRACUNIT;
|
||||||
SetTexture(ss, i, sector_t::floor, ms->floorpic, missingtex);
|
SetTexture(ss, i, sector_t::floor, ms->floorpic, missingtex, true);
|
||||||
SetTexture(ss, i, sector_t::ceiling, ms->ceilingpic, missingtex);
|
SetTexture(ss, i, sector_t::ceiling, ms->ceilingpic, missingtex, true);
|
||||||
ss->lightlevel = LittleShort(ms->lightlevel);
|
ss->lightlevel = LittleShort(ms->lightlevel);
|
||||||
if (map->HasBehavior)
|
if (map->HasBehavior)
|
||||||
ss->special = LittleShort(ms->special);
|
ss->special = LittleShort(ms->special);
|
||||||
|
@ -2473,11 +2470,8 @@ int P_DetermineTranslucency (int lumpnum)
|
||||||
return newcolor.r;
|
return newcolor.r;
|
||||||
}
|
}
|
||||||
|
|
||||||
void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, mapsidedef_t *msd, int special, int tag, short *alpha, FMissingTextureTracker &missingtex)
|
void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, intmapsidedef_t *msd, int special, int tag, short *alpha, FMissingTextureTracker &missingtex)
|
||||||
{
|
{
|
||||||
char name[9];
|
|
||||||
name[8] = 0;
|
|
||||||
|
|
||||||
switch (special)
|
switch (special)
|
||||||
{
|
{
|
||||||
case Transfer_Heights: // variable colormap via 242 linedef
|
case Transfer_Heights: // variable colormap via 242 linedef
|
||||||
|
@ -2503,7 +2497,6 @@ void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, mapside
|
||||||
|
|
||||||
SetTextureNoErr (sd, side_t::bottom, &fog, msd->bottomtexture, &foggood, true);
|
SetTextureNoErr (sd, side_t::bottom, &fog, msd->bottomtexture, &foggood, true);
|
||||||
SetTextureNoErr (sd, side_t::top, &color, msd->toptexture, &colorgood, false);
|
SetTextureNoErr (sd, side_t::top, &color, msd->toptexture, &colorgood, false);
|
||||||
strncpy (name, msd->midtexture, 8);
|
|
||||||
SetTexture(sd, side_t::mid, msd->midtexture, missingtex);
|
SetTexture(sd, side_t::mid, msd->midtexture, missingtex);
|
||||||
|
|
||||||
if (colorgood | foggood)
|
if (colorgood | foggood)
|
||||||
|
@ -2534,8 +2527,7 @@ void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, mapside
|
||||||
case Sector_Set3DFloor:
|
case Sector_Set3DFloor:
|
||||||
if (msd->toptexture[0]=='#')
|
if (msd->toptexture[0]=='#')
|
||||||
{
|
{
|
||||||
strncpy (name, msd->toptexture, 8);
|
sd->SetTexture(side_t::top, FNullTextureID() +(-strtol(&msd->toptexture[1], NULL, 10))); // store the alpha as a negative texture index
|
||||||
sd->SetTexture(side_t::top, FNullTextureID() +(-strtol(name+1, NULL, 10))); // store the alpha as a negative texture index
|
|
||||||
// This will be sorted out by the 3D-floor code later.
|
// This will be sorted out by the 3D-floor code later.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2629,7 +2621,13 @@ void P_LoadSideDefs2 (MapData *map, FMissingTextureTracker &missingtex)
|
||||||
{
|
{
|
||||||
sd->sector = sec = §ors[LittleShort(msd->sector)];
|
sd->sector = sec = §ors[LittleShort(msd->sector)];
|
||||||
}
|
}
|
||||||
P_ProcessSideTextures(!map->HasBehavior, sd, sec, msd,
|
|
||||||
|
intmapsidedef_t imsd;
|
||||||
|
imsd.toptexture.CopyCStrPart(msd->toptexture, 8);
|
||||||
|
imsd.midtexture.CopyCStrPart(msd->midtexture, 8);
|
||||||
|
imsd.bottomtexture.CopyCStrPart(msd->bottomtexture, 8);
|
||||||
|
|
||||||
|
P_ProcessSideTextures(!map->HasBehavior, sd, sec, &imsd,
|
||||||
sidetemp[i].a.special, sidetemp[i].a.tag, &sidetemp[i].a.alpha, missingtex);
|
sidetemp[i].a.special, sidetemp[i].a.tag, &sidetemp[i].a.alpha, missingtex);
|
||||||
}
|
}
|
||||||
delete[] msdf;
|
delete[] msdf;
|
||||||
|
|
|
@ -118,8 +118,8 @@ enum
|
||||||
// namespace for each game
|
// namespace for each game
|
||||||
};
|
};
|
||||||
|
|
||||||
void SetTexture (sector_t *sector, int index, int position, const char *name8, FMissingTextureTracker &);
|
void SetTexture (sector_t *sector, int index, int position, const char *name, FMissingTextureTracker &, bool truncate);
|
||||||
void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, mapsidedef_t *msd, int special, int tag, short *alpha, FMissingTextureTracker &);
|
void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, intmapsidedef_t *msd, int special, int tag, short *alpha, FMissingTextureTracker &);
|
||||||
void P_AdjustLine (line_t *ld);
|
void P_AdjustLine (line_t *ld);
|
||||||
void P_FinishLoadingLineDef(line_t *ld, int alpha);
|
void P_FinishLoadingLineDef(line_t *ld, int alpha);
|
||||||
void SpawnMapThing(int index, FMapThing *mt, int position);
|
void SpawnMapThing(int index, FMapThing *mt, int position);
|
||||||
|
@ -394,7 +394,7 @@ class UDMFParser : public UDMFParserBase
|
||||||
|
|
||||||
TArray<line_t> ParsedLines;
|
TArray<line_t> ParsedLines;
|
||||||
TArray<side_t> ParsedSides;
|
TArray<side_t> ParsedSides;
|
||||||
TArray<mapsidedef_t> ParsedSideTextures;
|
TArray<intmapsidedef_t> ParsedSideTextures;
|
||||||
TArray<sector_t> ParsedSectors;
|
TArray<sector_t> ParsedSectors;
|
||||||
TArray<vertex_t> ParsedVertices;
|
TArray<vertex_t> ParsedVertices;
|
||||||
TArray<vertexdata_t> ParsedVertexDatas;
|
TArray<vertexdata_t> ParsedVertexDatas;
|
||||||
|
@ -1089,14 +1089,14 @@ public:
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void ParseSidedef(side_t *sd, mapsidedef_t *sdt, int index)
|
void ParseSidedef(side_t *sd, intmapsidedef_t *sdt, int index)
|
||||||
{
|
{
|
||||||
fixed_t texofs[2]={0,0};
|
fixed_t texofs[2]={0,0};
|
||||||
|
|
||||||
memset(sd, 0, sizeof(*sd));
|
memset(sd, 0, sizeof(*sd));
|
||||||
strncpy(sdt->bottomtexture, "-", 8);
|
sdt->bottomtexture = "-";
|
||||||
strncpy(sdt->toptexture, "-", 8);
|
sdt->toptexture = "-";
|
||||||
strncpy(sdt->midtexture, "-", 8);
|
sdt->midtexture = "-";
|
||||||
sd->SetTextureXScale(FRACUNIT);
|
sd->SetTextureXScale(FRACUNIT);
|
||||||
sd->SetTextureYScale(FRACUNIT);
|
sd->SetTextureYScale(FRACUNIT);
|
||||||
|
|
||||||
|
@ -1115,15 +1115,15 @@ public:
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case NAME_Texturetop:
|
case NAME_Texturetop:
|
||||||
strncpy(sdt->toptexture, CheckString(key), 8);
|
sdt->toptexture = CheckString(key);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case NAME_Texturebottom:
|
case NAME_Texturebottom:
|
||||||
strncpy(sdt->bottomtexture, CheckString(key), 8);
|
sdt->bottomtexture = CheckString(key);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case NAME_Texturemiddle:
|
case NAME_Texturemiddle:
|
||||||
strncpy(sdt->midtexture, CheckString(key), 8);
|
sdt->midtexture = CheckString(key);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case NAME_Sector:
|
case NAME_Sector:
|
||||||
|
@ -1287,11 +1287,11 @@ public:
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case NAME_Texturefloor:
|
case NAME_Texturefloor:
|
||||||
SetTexture(sec, index, sector_t::floor, CheckString(key), missingTex);
|
SetTexture(sec, index, sector_t::floor, CheckString(key), missingTex, false);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case NAME_Textureceiling:
|
case NAME_Textureceiling:
|
||||||
SetTexture(sec, index, sector_t::ceiling, CheckString(key), missingTex);
|
SetTexture(sec, index, sector_t::ceiling, CheckString(key), missingTex, false);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case NAME_Lightlevel:
|
case NAME_Lightlevel:
|
||||||
|
@ -1799,7 +1799,7 @@ public:
|
||||||
else if (sc.Compare("sidedef"))
|
else if (sc.Compare("sidedef"))
|
||||||
{
|
{
|
||||||
side_t si;
|
side_t si;
|
||||||
mapsidedef_t st;
|
intmapsidedef_t st;
|
||||||
ParseSidedef(&si, &st, ParsedSides.Size());
|
ParseSidedef(&si, &st, ParsedSides.Size());
|
||||||
ParsedSides.Push(si);
|
ParsedSides.Push(si);
|
||||||
ParsedSideTextures.Push(st);
|
ParsedSideTextures.Push(st);
|
||||||
|
|
|
@ -238,6 +238,7 @@ FTextureID FTextureManager::CheckForTexture (const char *name, int usetype, BITF
|
||||||
FTexture *tex = Wads.GetLinkedTexture(lump);
|
FTexture *tex = Wads.GetLinkedTexture(lump);
|
||||||
if (tex == NO_TEXTURE) return FTextureID(-1);
|
if (tex == NO_TEXTURE) return FTextureID(-1);
|
||||||
if (tex != NULL) return tex->id;
|
if (tex != NULL) return tex->id;
|
||||||
|
if (flags & TEXMAN_DontCreate) return FTextureID(-1); // we only want to check, there's no need to create a texture if we don't have one yet.
|
||||||
tex = FTexture::CreateTexture("", lump, FTexture::TEX_Override);
|
tex = FTexture::CreateTexture("", lump, FTexture::TEX_Override);
|
||||||
if (tex != NULL)
|
if (tex != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -363,7 +363,8 @@ public:
|
||||||
TEXMAN_Overridable = 2,
|
TEXMAN_Overridable = 2,
|
||||||
TEXMAN_ReturnFirst = 4,
|
TEXMAN_ReturnFirst = 4,
|
||||||
TEXMAN_AllowSkins = 8,
|
TEXMAN_AllowSkins = 8,
|
||||||
TEXMAN_ShortNameOnly = 16
|
TEXMAN_ShortNameOnly = 16,
|
||||||
|
TEXMAN_DontCreate = 32
|
||||||
};
|
};
|
||||||
|
|
||||||
FTextureID CheckForTexture (const char *name, int usetype, BITFIELD flags=TEXMAN_TryAny);
|
FTextureID CheckForTexture (const char *name, int usetype, BITFIELD flags=TEXMAN_TryAny);
|
||||||
|
|
Loading…
Reference in a new issue