- fixed: The map setup code was still truncating texture names in several places.

This commit is contained in:
Christoph Oelckers 2014-05-16 22:48:37 +02:00
commit e92032e8ff
3 changed files with 45 additions and 39 deletions

View file

@ -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 *sidenames[] = { "first", "second" };
char name[9];
strncpy (name, name8, 8);
name[8] = 0;
FTextureID texture = TexMan.CheckForTexture (name, FTexture::TEX_Wall,
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" };
char name[9];
strncpy (name, name8, 8);
name[8] = 0;
char name8[9];
if (truncate)
{
strncpy(name8, name, 8);
name8[8] = 0;
name = name8;
}
FTextureID texture = TexMan.CheckForTexture (name, FTexture::TEX_Flat,
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;
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);
}
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;
strncpy (name, name8, 8);
name[8] = 0;
*validcolor = false;
texture = TexMan.CheckForTexture (name, FTexture::TEX_Wall,
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.c = -FRACUNIT;
ss->ceilingplane.ic = -FRACUNIT;
SetTexture(ss, i, sector_t::floor, ms->floorpic, missingtex);
SetTexture(ss, i, sector_t::ceiling, ms->ceilingpic, missingtex);
SetTexture(ss, i, sector_t::floor, ms->floorpic, missingtex, true);
SetTexture(ss, i, sector_t::ceiling, ms->ceilingpic, missingtex, true);
ss->lightlevel = LittleShort(ms->lightlevel);
if (map->HasBehavior)
ss->special = LittleShort(ms->special);
@ -2473,11 +2470,8 @@ int P_DetermineTranslucency (int lumpnum)
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)
{
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::top, &color, msd->toptexture, &colorgood, false);
strncpy (name, msd->midtexture, 8);
SetTexture(sd, side_t::mid, msd->midtexture, missingtex);
if (colorgood | foggood)
@ -2534,8 +2527,7 @@ void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, mapside
case Sector_Set3DFloor:
if (msd->toptexture[0]=='#')
{
strncpy (name, msd->toptexture, 8);
sd->SetTexture(side_t::top, FNullTextureID() +(-strtol(name+1, NULL, 10))); // store the alpha as a negative texture index
sd->SetTexture(side_t::top, FNullTextureID() +(-strtol(&msd->toptexture[1], NULL, 10))); // store the alpha as a negative texture index
// This will be sorted out by the 3D-floor code later.
}
else
@ -2629,7 +2621,13 @@ void P_LoadSideDefs2 (MapData *map, FMissingTextureTracker &missingtex)
{
sd->sector = sec = &sectors[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);
}
delete[] msdf;