Skip to content

Commit

Permalink
Client|Cleanup: Continued updated logging with domain-specific LOG ma…
Browse files Browse the repository at this point in the history
…cros

Also, removed old client-specific VERBOSE or other log-related macros.
  • Loading branch information
skyjake committed Jan 5, 2014
1 parent 785c077 commit 0fe54fa
Show file tree
Hide file tree
Showing 31 changed files with 190 additions and 203 deletions.
14 changes: 0 additions & 14 deletions doomsday/client/include/dd_main.h
Expand Up @@ -43,20 +43,6 @@
#include <de/String>
#include "resourceclass.h"

// Verbose messages.
#define VERBOSE(code) { if(verbose >= 1) { code; } }
#define VERBOSE2(code) { if(verbose >= 2) { code; } }

#ifdef _DEBUG
# define DEBUG_Message(code) {Con_Message code;}
# define DEBUG_VERBOSE_Message(code) {if(verbose >= 1) {Con_Message code;}}
# define DEBUG_VERBOSE2_Message(code) {if(verbose >= 2) {Con_Message code;}}
#else
# define DEBUG_Message(code)
# define DEBUG_VERBOSE_Message(code)
# define DEBUG_VERBOSE2_Message(code)
#endif

struct game_s;

extern int verbose;
Expand Down
7 changes: 3 additions & 4 deletions doomsday/client/src/audio/s_main.cpp
Expand Up @@ -329,9 +329,8 @@ int S_LocalSoundAtVolumeFrom(int soundIdAndFlags, mobj_t *origin,
{
if(sfxAvail)
{
VERBOSE(Con_Message
("S_LocalSoundAtVolumeFrom: Sound %i " "caching failed.",
soundId));
LOG_AUDIO_VERBOSE("S_LocalSoundAtVolumeFrom: Caching of sound %i failed")
<< soundId;
}
return false;
}
Expand Down Expand Up @@ -533,7 +532,7 @@ int S_StartMusicNum(int id, boolean looped)
if(id < 0 || id >= defs.count.music.num) return false;
ded_music_t *def = &defs.music[id];

VERBOSE( Con_Message("Starting music '%s'...", def->id) )
LOG_AUDIO_VERBOSE("Starting music '%s'...") << def->id;

return Mus_Start(def, looped);

Expand Down
17 changes: 9 additions & 8 deletions doomsday/client/src/audio/s_mus.cpp
Expand Up @@ -82,11 +82,11 @@ boolean Mus_Init(void)

if(isDedicated || CommandLine_Exists("-nomusic"))
{
Con_Message("Music disabled.");
LOG_AUDIO_NOTE("Music disabled");
return true;
}

VERBOSE( Con_Message("Initializing Music subsystem...") );
LOG_AUDIO_VERBOSE("Initializing Music subsystem...");

// Let's see which interfaces are available for music playback.
count = getInterfaces(iMusic);
Expand All @@ -103,8 +103,8 @@ boolean Mus_Init(void)
{
if(!iMusic[i]->Init())
{
Con_Message("Warning: Failed to initialize %s for music playback.",
Str_Text(AudioDriver_InterfaceName(iMusic[i])));
LOG_AUDIO_WARNING("Failed to initialize %s for music playback")
<< Str_Text(AudioDriver_InterfaceName(iMusic[i]));
}
}

Expand Down Expand Up @@ -355,7 +355,8 @@ int Mus_Start(ded_music_t* def, boolean looped)

songID = def - defs.music;

DEBUG_Message(("Mus_Start: Starting ID:%i looped:%i, currentSong ID:%i\n", songID, looped, currentSong));
LOG_AS("Mus_Start");
LOG_AUDIO_VERBOSE("Starting ID:%i looped:%i, currentSong ID:%i") << songID << looped << currentSong;

if(songID == currentSong && AudioDriver_Music_IsPlaying())
{
Expand Down Expand Up @@ -410,8 +411,8 @@ int Mus_Start(ded_music_t* def, boolean looped)
Str_Init(&path);
if(Mus_GetExt(def, &path))
{
VERBOSE( Con_Message("Attempting to play song '%s' (file \"%s\").",
def->id, F_PrettyPath(Str_Text(&path))) )
LOG_AUDIO_VERBOSE("Attempting to play song '%s' (file \"%s\")")
<< def->id << F_PrettyPath(Str_Text(&path));

// Its an external file.
return AudioDriver_Music_PlayFile(Str_Text(&path), looped);
Expand All @@ -436,7 +437,7 @@ int Mus_Start(ded_music_t* def, boolean looped)
break;

default:
Con_Error("Mus_Start: Invalid value order[i] = %i.", order[i]);
DENG_ASSERT(!"Mus_Start: Invalid value for order[i]");
break;
}
}
Expand Down
16 changes: 8 additions & 8 deletions doomsday/client/src/audio/s_wav.cpp
Expand Up @@ -197,13 +197,13 @@ void* WAV_Load(const char* filename, int* bits, int* rate, int* samples)
// Read in the whole thing.
size = FileHandle_Length(file);

DEBUG_Message(("WAV_Load: Loading from \"%s\" (size %i, fpos %i)\n",
F_PrettyPath(Str_Text(F_ComposePath(FileHandle_File_const(file)))),
(int)size, (int)FileHandle_Tell(file)));
LOG_AS("WAV_Load");
LOG_RES_XVERBOSE("Loading from \"%s\" (size %i, fpos %i)")
<< F_PrettyPath(Str_Text(F_ComposePath(FileHandle_File_const(file))))
<< size
<< FileHandle_Tell(file);

data = (uint8_t*)malloc(size);
if(!data) Con_Error("WAV_Load: Failed on allocation of %lu bytes for sample load buffer.",
(unsigned long) size);
data = (uint8_t*) M_Malloc(size);

FileHandle_Read(file, data, size);
F_Delete(file);
Expand All @@ -213,9 +213,9 @@ void* WAV_Load(const char* filename, int* bits, int* rate, int* samples)
sampledata = WAV_MemoryLoad((const byte*) data, size, bits, rate, samples);
if(!sampledata)
{
Con_Message("WAV_Load: Failed to load %s.", filename);
LOG_RES_WARNING("Failed to load \"%s\"") << filename;
}

free(data);
M_Free(data);
return sampledata;
}
6 changes: 0 additions & 6 deletions doomsday/client/src/client/cl_frame.cpp
Expand Up @@ -240,17 +240,11 @@ void Cl_Frame2Received(int packetType)
if(packetType == PSV_FIRST_FRAME2)
{
gotFirstFrame = true;
/*#ifdef _DEBUG
VERBOSE( Con_Printf("*** GOT THE FIRST FRAME (%i) ***\n", set) );
#endif*/
}
else if(!gotFirstFrame)
{
// Just ignore. If this was a legitimate frame, the server will
// send it again when it notices no ack is coming.
/*#ifdef _DEBUG
VERBOSE( Con_Printf("==> Ignored set %i\n", set) );
#endif*/
return;
}

Expand Down
52 changes: 26 additions & 26 deletions doomsday/client/src/client/cl_mobj.cpp
Expand Up @@ -208,8 +208,9 @@ void ClMobj_Link(mobj_t *mo)
// Client mobjs that belong to players remain unlinked.
return;
}
DEBUG_VERBOSE2_Message(("ClMobj_Link: id %i, x%f Y%f, solid:%s\n", mo->thinker.id,
mo->origin[VX], mo->origin[VY], mo->ddFlags & DDMF_SOLID? "yes" : "no"));
LOG_MAP_XVERBOSE("ClMobj_Link: id %i, x%f Y%f, solid:%b")
<< mo->thinker.id << mo->origin[VX] << mo->origin[VY]
<< (mo->ddFlags & DDMF_SOLID);

Mobj_Link(mo, (mo->ddFlags & DDMF_DONTDRAW ? 0 : MLF_SECTOR) |
(mo->ddFlags & DDMF_SOLID ? MLF_BLOCKMAP : 0));
Expand All @@ -218,16 +219,18 @@ void ClMobj_Link(mobj_t *mo)
#undef ClMobj_EnableLocalActions
void ClMobj_EnableLocalActions(struct mobj_s *mo, boolean enable)
{
LOG_AS("ClMobj_EnableLocalActions");

clmoinfo_t *info = ClMobj_GetInfo(mo);
if(!isClient || !info) return;
if(enable)
{
DEBUG_Message(("ClMobj_EnableLocalActions: Enabled for mobj %i.\n", mo->thinker.id));
LOG_NET_VERBOSE("Enabled for clmobj %i") << mo->thinker.id;
info->flags |= CLMF_LOCAL_ACTIONS;
}
else
{
DEBUG_Message(("ClMobj_EnableLocalActions: Disabled for mobj %i.\n", mo->thinker.id));
LOG_NET_VERBOSE("Disabled for clmobj %i") << mo->thinker.id;
info->flags &= ~CLMF_LOCAL_ACTIONS;
}
}
Expand Down Expand Up @@ -257,7 +260,7 @@ void Cl_UpdateRealPlayerMobj(mobj_t *localMobj, mobj_t *remoteClientMobj,
{
if(!localMobj || !remoteClientMobj)
{
DEBUG_VERBOSE_Message(("Cl_UpdateRealPlayerMobj: mo=%p clmo=%p\n", localMobj, remoteClientMobj));
LOG_DEV_VERBOSE("Cl_UpdateRealPlayerMobj: mo=%p clmo=%p") << localMobj << remoteClientMobj;
return;
}

Expand All @@ -269,9 +272,9 @@ void Cl_UpdateRealPlayerMobj(mobj_t *localMobj, mobj_t *remoteClientMobj,
if(flags & MDF_ANGLE)
{
localMobj->angle = remoteClientMobj->angle;
#ifdef _DEBUG
VERBOSE2( Con_Message("Cl_UpdateRealPlayerMobj: localMobj=%p angle=%x", localMobj, localMobj->angle) );
#endif

LOG_DEV_TRACE_DEBUGONLY("Cl_UpdateRealPlayerMobj: localMobj=%p angle=%x",
localMobj << localMobj->angle);
}
localMobj->sprite = remoteClientMobj->sprite;
localMobj->frame = remoteClientMobj->frame;
Expand Down Expand Up @@ -516,7 +519,8 @@ void ClMobj_Destroy(mobj_t *mo)
checkMobjHash();
#endif

DEBUG_VERBOSE2_Message(("ClMobj_Destroy: mobj %i being destroyed.\n", mo->thinker.id));
LOG_AS("ClMobj_Destroy");
LOG_NET_XVERBOSE("mobj %i being destroyed") << mo->thinker.id;

CL_ASSERT_CLMOBJ(mo);
clmoinfo_t *info = ClMobj_GetInfo(mo);
Expand Down Expand Up @@ -574,6 +578,8 @@ clmoinfo_t *ClMobj_GetInfo(mobj_t *mo)

boolean ClMobj_Reveal(mobj_t *mo)
{
LOG_AS("Cl_RevealMobj");

clmoinfo_t *info = ClMobj_GetInfo(mo);

CL_ASSERT_CLMOBJ(mo);
Expand All @@ -588,9 +594,8 @@ boolean ClMobj_Reveal(mobj_t *mo)
// Don't reveal just yet. We lack a vital piece of information.
return false;
}
#ifdef _DEBUG
VERBOSE2( Con_Message("Cl_RevealMobj: clmobj %i Hidden status lifted (z=%f).", mo->thinker.id, mo->origin[VZ]) );
#endif

LOG_NET_XVERBOSE("clmobj %i 'Hidden' status lifted (z=%f)") << mo->thinker.id << mo->origin[VZ];

info->flags &= ~CLMF_HIDDEN;

Expand All @@ -603,10 +608,8 @@ boolean ClMobj_Reveal(mobj_t *mo)
S_StartSoundAtVolume(info->sound, mo, info->volume);
}

#ifdef _DEBUG
VERBOSE2( Con_Printf("Cl_RevealMobj: Revealing id %i, state %p (%i)\n",
mo->thinker.id, mo->state, (int)(mo->state - states)) );
#endif
LOG_DEV_XVERBOSE("Revealing id %i, state %p (%i)")
<< mo->thinker.id << mo->state << (int)(mo->state - states);

return true;
}
Expand Down Expand Up @@ -675,9 +678,8 @@ void ClMobj_ReadDelta2(boolean skip)
fastMom = true;
}

#ifdef _DEBUG
VERBOSE2( Con_Message("Cl_ReadMobjDelta: Reading mobj delta for %i (df:0x%x edf:0x%x skip:%i)", id, df, moreFlags, skip) );
#endif
LOG_NET_XVERBOSE("Reading mobj delta for %i (df:0x%x edf:0x%x skip:%i)")
<< id << df << moreFlags << skip;

if(!skip)
{
Expand All @@ -686,9 +688,7 @@ void ClMobj_ReadDelta2(boolean skip)
info = ClMobj_GetInfo(mo);
if(!mo)
{
#ifdef _DEBUG
VERBOSE2( Con_Message("Cl_ReadMobjDelta: Creating new clmobj %i (hidden).", id) );
#endif
LOG_NET_XVERBOSE("Creating new clmobj %i (hidden)") << id;

// This is a new ID, allocate a new mobj.
mo = ClMobj_Create(id);
Expand Down Expand Up @@ -918,10 +918,10 @@ void ClMobj_ReadDelta2(boolean skip)
// Update players.
if(d->dPlayer)
{
#ifdef _DEBUG
VERBOSE2( Con_Message("ClMobj_ReadDelta2: Updating player %i local mobj with new clmobj state {%f, %f, %f}.",
P_GetDDPlayerIdx(d->dPlayer), d->origin[VX], d->origin[VY], d->origin[VZ]) );
#endif
LOG_NET_XVERBOSE("Updating player %i local mobj with new clmobj state {%f, %f, %f}")
<< P_GetDDPlayerIdx(d->dPlayer)
<< d->origin[VX] << d->origin[VY] << d->origin[VZ];

// Players have real mobjs. The client mobj is hidden (unlinked).
Cl_UpdateRealPlayerMobj(d->dPlayer->mo, d, df, onFloor);
}
Expand Down
16 changes: 9 additions & 7 deletions doomsday/client/src/client/cl_world.cpp
Expand Up @@ -309,10 +309,12 @@ void Cl_MoverThinker(clplane_t *mover)
// Can we think yet?
if(!Cl_GameReady()) return;

LOG_AS("Cl_MoverThinker");

#ifdef _DEBUG
if(map.clPlaneIndex(mover) < 0)
{
LOG_MAP_WARNING("Cl_MoverThinker: Running a mover that is not in activemovers!");
LOG_MAP_WARNING("Running a mover that is not in activemovers!");
}
#endif

Expand All @@ -336,9 +338,9 @@ void Cl_MoverThinker(clplane_t *mover)
remove = true;
}

DEBUG_VERBOSE2_Message(("Cl_MoverThinker: plane height %f in sector #%i\n",
P_GetDouble(DMU_SECTOR, mover->sectorIndex, mover->property),
mover->sectorIndex));
LOG_DEV_TRACE_DEBUGONLY("plane height %f in sector #%i",
P_GetDouble(DMU_SECTOR, mover->sectorIndex, mover->property)
<< mover->sectorIndex);

// Let the game know of this.
if(gx.SectorHeightChangeNotification)
Expand All @@ -349,7 +351,7 @@ void Cl_MoverThinker(clplane_t *mover)
// Make sure the client didn't get stuck as a result of this move.
if(freeMove != ClPlayer_IsFreeToMove(consolePlayer))
{
DEBUG_Message(("Cl_MoverThinker: move blocked in sector %i, undoing\n", mover->sectorIndex));
LOG_MAP_VERBOSE("move blocked in sector #%i, undoing move") << mover->sectorIndex;

// Something was blocking the way! Go back to original height.
P_SetDouble(DMU_SECTOR, mover->sectorIndex, mover->property, original);
Expand All @@ -364,7 +366,7 @@ void Cl_MoverThinker(clplane_t *mover)
// Can we remove this thinker?
if(remove)
{
DEBUG_Message(("Cl_MoverThinker: finished in %i\n", mover->sectorIndex));
LOG_MAP_VERBOSE("finished in sector #%i") << mover->sectorIndex;

// It stops.
P_SetDouble(DMU_SECTOR, mover->sectorIndex, mover->dmuPlane | DMU_SPEED, 0);
Expand Down Expand Up @@ -527,7 +529,7 @@ clpolyobj_t *Map::newClPolyobj(int polyobjIndex)
{
if(clActivePolyobjs[i]) continue;

LOG_DEBUG("New polymover [%i] for polyobj #%i.") << i << polyobjIndex;
LOG_MAP_XVERBOSE("New polymover [%i] for polyobj #%i.") << i << polyobjIndex;

clpolyobj_t *mover = (clpolyobj_t *) Z_Calloc(sizeof(clpolyobj_t), PU_MAP, &clActivePolyobjs[i]);
clActivePolyobjs[i] = mover;
Expand Down
6 changes: 3 additions & 3 deletions doomsday/client/src/clientapp.cpp
Expand Up @@ -106,18 +106,18 @@ Value *Binding_App_LoadFont(Context &, Function::ArgumentValues const &args)
id = QFontDatabase::addApplicationFontFromData(data);
if(id < 0)
{
LOG_WARNING("Failed to load font:");
LOG_RES_WARNING("Failed to load font:");
}
else
{
LOG_VERBOSE("Loaded font: %s") << args.at(0)->asText();
LOG_RES_VERBOSE("Loaded font: %s") << args.at(0)->asText();
//qDebug() << args.at(0)->asText();
//qDebug() << "Families:" << QFontDatabase::applicationFontFamilies(id);
}
}
catch(Error const &er)
{
LOG_WARNING("Failed to load font:\n") << er.asText();
LOG_RES_WARNING("Failed to load font:\n") << er.asText();
}
return 0;
}
Expand Down

0 comments on commit 0fe54fa

Please sign in to comment.