* Updated to ZDoom r3198:

- Fixed: P_CheckPosition() should checks all lines contacted by the actor. Stopping once it finds one blocking line will prevent any further lines with specials from activating their specials.
- Add the wad a map is defined in to the output of listmaps.
- Fixed: DDrawFB::Lock() should only act on NeedResRecreate when going from LockCount 0 -> 1.
- Fixed: When DDrawFB::Lock() has to recreate resources, it left the LockCount at 0. This causes problems if something else locks it before it is unlocked, because the second locker will think it is the first. This happens in R_RenderViewToCanvas(). See DDrawFB::PaletteChanged() for the most common reason why Lock() would need to recreate resources.
- Fixed: DDrawFB::CreateSurfacesComplex() had debugging cruft left in that skipped all but the last attempts.
- Fixed logging of video debug info to a file to not multiply define dbg.
- Fixed: Building with NOASM defined no longer worked, because the DrawSlab routines in a.asm conflicted with the ones in r_draw.cpp.
- Colorize missing texture messages.
- Place a limit on the number of reports per missing texture. On maps with many lines and many sides of missing textures, this can take a very long time, because each missing textures causes a scan of every single line (for the sake of packed sidedefs), and each output line also requires an update of the hidden RichEdit logging control.

git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@1212 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
gez 2011-05-09 07:31:04 +00:00
parent 3a68b80933
commit 84ef9ea80c
13 changed files with 152 additions and 65 deletions

View file

@ -29,8 +29,8 @@
%define mvlineasm1 _mvlineasm1
%define mvlineasm4 _mvlineasm4
%define R_SetupDrawSlab _R_SetupDrawSlab
%define R_DrawSlab _R_DrawSlab
%define R_SetupDrawSlabA _R_SetupDrawSlabA
%define R_DrawSlabA _R_DrawSlabA
%endif
EXTERN ylookup ; near
@ -79,11 +79,11 @@ lastslabcolormap:
SECTION .text
GLOBAL R_SetupDrawSlab
GLOBAL @R_SetupDrawSlab@4
R_SetupDrawSlab:
GLOBAL R_SetupDrawSlabA
GLOBAL @R_SetupDrawSlabA@4
R_SetupDrawSlabA:
mov ecx, [esp+4]
@R_SetupDrawSlab@4:
@R_SetupDrawSlabA@4:
cmp [lastslabcolormap], ecx
je .done
mov [lastslabcolormap], ecx
@ -591,8 +591,8 @@ align 16
;***************************** Voxel Slabs *******************************
;*************************************************************************
GLOBAL R_DrawSlab
R_DrawSlab:
GLOBAL R_DrawSlabA
R_DrawSlabA:
push ebx
push ebp
push esi

View file

@ -1861,10 +1861,13 @@ CCMD(listmaps)
for(unsigned i = 0; i < wadlevelinfos.Size(); i++)
{
level_info_t *info = &wadlevelinfos[i];
MapData *map = P_OpenMapData(info->mapname);
if (P_CheckMapData(info->mapname))
if (map != NULL)
{
Printf("%s: '%s'\n", info->mapname, info->LookupLevelName().GetChars());
Printf("%s: '%s' (%s)\n", info->mapname, info->LookupLevelName().GetChars(),
Wads.GetWadName(Wads.GetLumpFile(map->lumpnum)));
delete map;
}
}
}

View file

@ -1401,15 +1401,20 @@ bool P_CheckPosition (AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm)
//bool onthing = (thingdropoffz != tmdropoffz);
tm.floorz = tm.dropoffz;
bool good = true;
while ((ld = it.Next()))
{
if (!PIT_CheckLine(ld, box, tm))
return false;
good &= PIT_CheckLine(ld, box, tm);
}
if (tm.ceilingz - tm.floorz < thing->height)
if (!good)
{
return false;
}
if (tm.ceilingz - tm.floorz < thing->height)
{
return false;
}
if (tm.touchmidtex)
{
tm.dropoffz = tm.floorz;

View file

@ -71,6 +71,8 @@
#include "fragglescript/t_fs.h"
#define MISSING_TEXTURE_WARN_LIMIT 20
void P_SpawnSlopeMakers (FMapThing *firstmt, FMapThing *lastmt);
void P_SetSlopes ();
void P_CopySlopes();
@ -82,7 +84,7 @@ extern bool P_LoadBuildMap (BYTE *mapdata, size_t len, FMapThing **things, int *
extern void P_TranslateTeleportThings (void);
void P_ParseTextMap(MapData *map);
void P_ParseTextMap(MapData *map, FMissingTextureTracker &);
extern int numinterpolations;
extern unsigned int R_OldBlend;
@ -562,7 +564,7 @@ void MapData::GetChecksum(BYTE cksum[16])
//
//===========================================================================
static void SetTexture (side_t *side, int position, const char *name8)
static void SetTexture (side_t *side, int position, const char *name8, FMissingTextureTracker &track)
{
static const char *positionnames[] = { "top", "middle", "bottom" };
static const char *sidenames[] = { "first", "second" };
@ -574,16 +576,21 @@ static void SetTexture (side_t *side, int position, const char *name8)
if (!texture.Exists())
{
// Print an error that lists all references to this sidedef.
// We must scan the linedefs manually for all references to this sidedef.
for(int i = 0; i < numlines; i++)
if (++track[name].Count <= MISSING_TEXTURE_WARN_LIMIT)
{
for(int j = 0; j < 2; j++)
// Print an error that lists all references to this sidedef.
// We must scan the linedefs manually for all references to this sidedef.
for(int i = 0; i < numlines; i++)
{
if (lines[i].sidedef[j] == side)
for(int j = 0; j < 2; j++)
{
Printf("Unknown %s texture '%s' on %s side of linedef %d\n",
positionnames[position], name, sidenames[j], i);
if (lines[i].sidedef[j] == side)
{
Printf(TEXTCOLOR_RED"Unknown %s texture '"
TEXTCOLOR_ORANGE "%s" TEXTCOLOR_RED
"' on %s side of linedef %d\n",
positionnames[position], name, sidenames[j], i);
}
}
}
}
@ -599,7 +606,7 @@ static void SetTexture (side_t *side, int position, const char *name8)
//
//===========================================================================
void SetTexture (sector_t *sector, int index, int position, const char *name8)
void SetTexture (sector_t *sector, int index, int position, const char *name8, FMissingTextureTracker &track)
{
static const char *positionnames[] = { "floor", "ceiling" };
char name[9];
@ -610,13 +617,44 @@ void SetTexture (sector_t *sector, int index, int position, const char *name8)
if (!texture.Exists())
{
Printf("Unknown %s texture '%s' in sector %d\n",
positionnames[position], name, index);
if (++track[name].Count <= MISSING_TEXTURE_WARN_LIMIT)
{
Printf(TEXTCOLOR_RED"Unknown %s texture '"
TEXTCOLOR_ORANGE "%s" TEXTCOLOR_RED
"' in sector %d\n",
positionnames[position], name, index);
}
texture = TexMan.GetDefaultTexture();
}
sector->SetTexture(position, texture);
}
//===========================================================================
//
// SummarizeMissingTextures
//
// Lists textures that were missing more than MISSING_TEXTURE_WARN_LIMIT
// times.
//
//===========================================================================
static void SummarizeMissingTextures(const FMissingTextureTracker &missing)
{
FMissingTextureTracker::ConstIterator it(missing);
FMissingTextureTracker::ConstPair *pair;
while (it.NextPair(pair))
{
if (pair->Value.Count > MISSING_TEXTURE_WARN_LIMIT)
{
Printf(TEXTCOLOR_RED "Missing texture '"
TEXTCOLOR_ORANGE "%s" TEXTCOLOR_RED
"' is used %d more times\n",
pair->Key.GetChars(), pair->Value.Count - MISSING_TEXTURE_WARN_LIMIT);
}
}
}
//===========================================================================
//
// [RH] Figure out blends for deep water sectors
@ -1402,7 +1440,7 @@ void P_LoadSubsectors (MapData * map)
//
//===========================================================================
void P_LoadSectors (MapData * map)
void P_LoadSectors (MapData *map, FMissingTextureTracker &missingtex)
{
char fname[9];
int i;
@ -1445,8 +1483,8 @@ void P_LoadSectors (MapData * map)
ss->ceilingplane.d = ss->GetPlaneTexZ(sector_t::ceiling);
ss->ceilingplane.c = -FRACUNIT;
ss->ceilingplane.ic = -FRACUNIT;
SetTexture(ss, i, sector_t::floor, ms->floorpic);
SetTexture(ss, i, sector_t::ceiling, ms->ceilingpic);
SetTexture(ss, i, sector_t::floor, ms->floorpic, missingtex);
SetTexture(ss, i, sector_t::ceiling, ms->ceilingpic, missingtex);
ss->lightlevel = (BYTE)clamp (LittleShort(ms->lightlevel), (short)0, (short)255);
if (map->HasBehavior)
ss->special = LittleShort(ms->special);
@ -2346,7 +2384,7 @@ 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)
void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, mapsidedef_t *msd, int special, int tag, short *alpha, FMissingTextureTracker &missingtex)
{
char name[9];
name[8] = 0;
@ -2377,7 +2415,7 @@ 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);
SetTexture(sd, side_t::mid, msd->midtexture, missingtex);
if (colorgood | foggood)
{
@ -2413,11 +2451,11 @@ void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, mapside
}
else
{
SetTexture(sd, side_t::top, msd->toptexture);
SetTexture(sd, side_t::top, msd->toptexture, missingtex);
}
SetTexture(sd, side_t::mid, msd->midtexture);
SetTexture(sd, side_t::bottom, msd->bottomtexture);
SetTexture(sd, side_t::mid, msd->midtexture, missingtex);
SetTexture(sd, side_t::bottom, msd->bottomtexture, missingtex);
break;
#endif
@ -2439,20 +2477,20 @@ void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, mapside
}
else
{
SetTexture(sd, side_t::mid, msd->midtexture);
SetTexture(sd, side_t::mid, msd->midtexture, missingtex);
}
SetTexture(sd, side_t::top, msd->toptexture);
SetTexture(sd, side_t::bottom, msd->bottomtexture);
SetTexture(sd, side_t::top, msd->toptexture, missingtex);
SetTexture(sd, side_t::bottom, msd->bottomtexture, missingtex);
break;
}
// Fallthrough for Hexen maps is intentional
default: // normal cases
SetTexture(sd, side_t::mid, msd->midtexture);
SetTexture(sd, side_t::top, msd->toptexture);
SetTexture(sd, side_t::bottom, msd->bottomtexture);
SetTexture(sd, side_t::mid, msd->midtexture, missingtex);
SetTexture(sd, side_t::top, msd->toptexture, missingtex);
SetTexture(sd, side_t::bottom, msd->bottomtexture, missingtex);
break;
}
}
@ -2461,7 +2499,7 @@ void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, mapside
// after linedefs are loaded, to allow overloading.
// killough 5/3/98: reformatted, cleaned up
void P_LoadSideDefs2 (MapData * map)
void P_LoadSideDefs2 (MapData *map, FMissingTextureTracker &missingtex)
{
int i;
char * msdf = new char[map->Size(ML_SIDEDEFS)];
@ -2503,7 +2541,7 @@ void P_LoadSideDefs2 (MapData * map)
sd->sector = sec = &sectors[LittleShort(msd->sector)];
}
P_ProcessSideTextures(!map->HasBehavior, sd, sec, msd,
sidetemp[i].a.special, sidetemp[i].a.tag, &sidetemp[i].a.alpha);
sidetemp[i].a.special, sidetemp[i].a.tag, &sidetemp[i].a.alpha, missingtex);
}
delete[] msdf;
}
@ -3554,6 +3592,8 @@ void P_SetupLevel (char *lumpname, int position)
P_LoadStrifeConversations (map, lumpname);
FMissingTextureTracker missingtex;
if (!map->isText)
{
times[0].Clock();
@ -3562,7 +3602,7 @@ void P_SetupLevel (char *lumpname, int position)
// Check for maps without any BSP data at all (e.g. SLIGE)
times[1].Clock();
P_LoadSectors (map);
P_LoadSectors (map, missingtex);
times[1].Unclock();
times[2].Clock();
@ -3577,7 +3617,7 @@ void P_SetupLevel (char *lumpname, int position)
times[3].Unclock();
times[4].Clock();
P_LoadSideDefs2 (map);
P_LoadSideDefs2 (map, missingtex);
times[4].Unclock();
times[5].Clock();
@ -3593,7 +3633,7 @@ void P_SetupLevel (char *lumpname, int position)
}
else
{
P_ParseTextMap(map);
P_ParseTextMap(map, missingtex);
}
times[6].Clock();
@ -3602,6 +3642,8 @@ void P_SetupLevel (char *lumpname, int position)
linemap.Clear();
linemap.ShrinkToFit();
SummarizeMissingTextures(missingtex);
}
else
{

View file

@ -142,4 +142,11 @@ extern sidei_t *sidetemp;
extern bool hasglnodes;
extern struct glsegextra_t *glsegextras;
struct FMissingCount
{
FMissingCount() : Count(0) {}
int Count;
};
typedef TMap<FString,FMissingCount> FMissingTextureTracker;
#endif

View file

@ -110,9 +110,8 @@ enum
// namespace for each game
};
void SetTexture (sector_t *sector, int index, int position, const char *name8);
void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, mapsidedef_t *msd, int special, int tag, short *alpha);
void SetTexture (sector_t *sector, int index, int position, const char *name8, FMissingTextureTracker &);
void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, mapsidedef_t *msd, int special, int tag, short *alpha, FMissingTextureTracker &);
void P_AdjustLine (line_t *ld);
void P_FinishLoadingLineDef(line_t *ld, int alpha);
void SpawnMapThing(int index, FMapThing *mt, int position);
@ -393,9 +392,11 @@ class UDMFParser : public UDMFParserBase
TArray<vertexdata_t> ParsedVertexDatas;
FDynamicColormap *fogMap, *normMap;
FMissingTextureTracker &missingTex;
public:
UDMFParser()
UDMFParser(FMissingTextureTracker &missing)
: missingTex(missing)
{
linemap.Clear();
fogMap = normMap = NULL;
@ -1113,11 +1114,11 @@ public:
continue;
case NAME_Texturefloor:
SetTexture(sec, index, sector_t::floor, CheckString(key));
SetTexture(sec, index, sector_t::floor, CheckString(key), missingTex);
continue;
case NAME_Textureceiling:
SetTexture(sec, index, sector_t::ceiling, CheckString(key));
SetTexture(sec, index, sector_t::ceiling, CheckString(key), missingTex);
continue;
case NAME_Lightlevel:
@ -1427,7 +1428,7 @@ public:
lines[line].sidedef[sd] = &sides[side];
P_ProcessSideTextures(!isExtended, &sides[side], sides[side].sector, &ParsedSideTextures[mapside],
lines[line].special, lines[line].args[0], &tempalpha[sd]);
lines[line].special, lines[line].args[0], &tempalpha[sd], missingTex);
side++;
}
@ -1592,9 +1593,9 @@ public:
}
};
void P_ParseTextMap(MapData *map)
void P_ParseTextMap(MapData *map, FMissingTextureTracker &missingtex)
{
UDMFParser parse;
UDMFParser parse(missingtex);
parse.ParseTextMap(map);
}

View file

@ -1363,12 +1363,12 @@ void R_FillSpan (void)
#ifndef X86_ASM
static const BYTE *slabcolormap;
extern "C" void R_SetupDrawSlab(const BYTE *colormap)
extern "C" void R_SetupDrawSlabC(const BYTE *colormap)
{
slabcolormap = colormap;
}
extern "C" void STACK_ARGS R_DrawSlab(int dx, fixed_t v, int dy, fixed_t vi, const BYTE *vptr, BYTE *p)
extern "C" void STACK_ARGS R_DrawSlabC(int dx, fixed_t v, int dy, fixed_t vi, const BYTE *vptr, BYTE *p)
{
int x;
const BYTE *colormap = slabcolormap;

View file

@ -216,6 +216,14 @@ void R_FillColumnP (void);
void R_FillColumnHorizP (void);
void R_FillSpan (void);
#ifdef X86_ASM
#define R_SetupDrawSlab R_SetupDrawSlabA
#define R_DrawSlab R_DrawSlabA
#else
#define R_SetupDrawSlab R_SetupDrawSlabC
#define R_DrawSlab R_DrawSlabC
#endif
extern "C" void R_SetupDrawSlab(const BYTE *colormap);
extern "C" void STACK_ARGS R_DrawSlab(int dx, fixed_t v, int dy, fixed_t vi, const BYTE *vptr, BYTE *p);

View file

@ -3,5 +3,5 @@
// This file was automatically generated by the
// updaterevision tool. Do not edit by hand.
#define ZD_SVN_REVISION_STRING "3191"
#define ZD_SVN_REVISION_NUMBER 3191
#define ZD_SVN_REVISION_STRING "3198"
#define ZD_SVN_REVISION_NUMBER 3198

View file

@ -461,7 +461,7 @@ bool DDrawFB::CreateSurfacesComplex ()
{
DDSURFACEDESC ddsd = { sizeof(ddsd), };
HRESULT hr;
int tries = 2;
int tries = 0;
LOG ("creating surfaces using a complex primary\n");
@ -801,10 +801,14 @@ bool DDrawFB::Lock ()
bool DDrawFB::Lock (bool useSimpleCanvas)
{
static int lock_num;
bool wasLost;
// LOG2 (" Lock (%d) <%d>\n", buffered, LockCount);
LOG3("Lock %5x <%d> %d\n", (AppActive << 16) | (SessionState << 12) | (MustBuffer << 8) |
(useSimpleCanvas << 4) | (int)UseBlitter, LockCount, lock_num++);
if (LockCount++ > 0)
{
return false;
@ -812,15 +816,16 @@ bool DDrawFB::Lock (bool useSimpleCanvas)
wasLost = false;
if (NeedResRecreate)
if (NeedResRecreate && LockCount == 1)
{
LOG("Recreating resources\n");
NeedResRecreate = false;
ReleaseResources ();
CreateResources ();
// ReleaseResources sets LockCount to 0.
LockCount = 1;
}
LOG5 ("Lock %d %d %d %d %d\n", AppActive, SessionState, MustBuffer, useSimpleCanvas, UseBlitter);
if (!AppActive || SessionState || MustBuffer || useSimpleCanvas || !UseBlitter)
{
Buffer = MemBuffer;
@ -859,6 +864,7 @@ void DDrawFB::Unlock ()
if (LockCount == 0)
{
LOG("Unlock called when already unlocked\n");
return;
}
@ -895,6 +901,7 @@ DDrawFB::LockSurfRes DDrawFB::LockSurf (LPRECT lockrect, LPDIRECTDRAWSURFACE toL
lockingLocker = true;
if (LockingSurf == NULL)
{
LOG("LockingSurf lost\n");
if (!CreateResources ())
{
if (LastHR != DDERR_UNSUPPORTEDMODE)

View file

@ -498,7 +498,7 @@ enum
};
#if 0
#define STARTLOG do { if (!dbg) dbg = fopen ("k:/vid.log", "w"); } while(0)
#define STARTLOG do { if (!dbg) dbg = fopen ("e:/vid.log", "w"); } while(0)
#define STOPLOG do { if (dbg) { fclose (dbg); dbg=NULL; } } while(0)
#define LOG(x) do { if (dbg) { fprintf (dbg, x); fflush (dbg); } } while(0)
#define LOG1(x,y) do { if (dbg) { fprintf (dbg, x, y); fflush (dbg); } } while(0)
@ -506,7 +506,8 @@ enum
#define LOG3(x,y,z,zz) do { if (dbg) { fprintf (dbg, x, y, z, zz); fflush (dbg); } } while(0)
#define LOG4(x,y,z,a,b) do { if (dbg) { fprintf (dbg, x, y, z, a, b); fflush (dbg); } } while(0)
#define LOG5(x,y,z,a,b,c) do { if (dbg) { fprintf (dbg, x, y, z, a, b, c); fflush (dbg); } } while(0)
FILE *dbg;
extern FILE *dbg;
#define VID_FILE_DEBUG 1
#elif _DEBUG && 0
#define STARTLOG
#define STOPLOG

View file

@ -112,6 +112,10 @@ IDirect3DDevice9 *D3Device;
CVAR (Bool, vid_forceddraw, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR (Int, vid_adapter, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
#if VID_FILE_DEBUG
FILE *dbg;
#endif
// CODE --------------------------------------------------------------------
Win32Video::Win32Video (int parm)

View file

@ -315,5 +315,14 @@ inline FName::FName(const FString &text, bool noCreate) { Index = NameData.FindN
inline FName &FName::operator = (const FString &text) { Index = NameData.FindName (text, text.Len(), false); return *this; }
inline FName &FNameNoInit::operator = (const FString &text) { Index = NameData.FindName (text, text.Len(), false); return *this; }
// Hash for TMap
extern unsigned int SuperFastHash(const char *data, size_t len);
template<> struct THashTraits<FString>
{
hash_t Hash(const FString &key) { return (hash_t)SuperFastHash(key, key.Len()+1); }
// Compares two keys, returning zero if they are the same.
int Compare(const FString &left, const FString &right) { return left.Compare(right); }
};
#endif