From 9d05452a07c6fe29ef99f5391c21e1e0c4b908ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Ker=C3=A4nen?= Date: Thu, 9 Jan 2014 15:38:19 +0200 Subject: [PATCH] Cleanup|Network|Client: Log levels and domains (continued) Also converted some Con_Message() calls to use LOG. --- doomsday/client/src/client/cl_frame.cpp | 129 +---------------------- doomsday/client/src/client/cl_infine.cpp | 10 +- doomsday/client/src/client/cl_main.cpp | 45 ++++---- doomsday/client/src/client/cl_mobj.cpp | 40 +++---- doomsday/client/src/client/cl_player.cpp | 103 +++++++----------- doomsday/client/src/client/cl_sound.cpp | 48 ++------- doomsday/client/src/client/cl_world.cpp | 38 +++---- 7 files changed, 111 insertions(+), 302 deletions(-) diff --git a/doomsday/client/src/client/cl_frame.cpp b/doomsday/client/src/client/cl_frame.cpp index 05f3d3bf69..5bcee272a0 100644 --- a/doomsday/client/src/client/cl_frame.cpp +++ b/doomsday/client/src/client/cl_frame.cpp @@ -132,93 +132,6 @@ float Cl_FrameGameTime(void) return frameGameTime; } -#if 0 -/** - * Add a set number to the history. - */ -void Cl_HistoryAdd(byte set) -{ - setHistory[historyIdx++] = set; - - if(historyIdx >= SET_HISTORY_SIZE) - historyIdx -= SET_HISTORY_SIZE; -} - -/** - * @return @c true, if the set is found in the recent set - * history. - */ -boolean Cl_HistoryCheck(byte set) -{ - uint i; - - for(i = 0; i < SET_HISTORY_SIZE; ++i) - { - if(setHistory[i] == set) - return true; - } - return false; -} - -/** - * Add a resend ID number to the resend history. - */ -void Cl_ResendHistoryAdd(byte id) -{ - resendHistory[resendHistoryIdx++] = id; - - if(resendHistoryIdx >= RESEND_HISTORY_SIZE) - resendHistoryIdx -= RESEND_HISTORY_SIZE; -} - -/** - * @return @c true, if the resend ID is found in the history. - */ -boolean Cl_ResendHistoryCheck(byte id) -{ - uint i; - - for(i = 0; i < RESEND_HISTORY_SIZE; ++i) - { - if(resendHistory[i] == id) - return true; - } - return false; -} - -/** - * Converts a set identifier, which ranges from 0...255, into a logical - * ordinal. Checks for set identifier wraparounds and updates the set - * ordinal base accordingly. - */ -uint Cl_ConvertSetToOrdinal(byte set) -{ - uint ordinal = 0; - - if(latestSet > 185 && set < 70) - { - // We must conclude that wraparound has occured. - setOrdinalBase += 256; -#if _NETDEBUG -VERBOSE2( Con_Printf("Cl_ConvertSetToOrdinal: Wraparound, now base is %i.\n", - setOrdinalBase) ); -#endif - } - ordinal = set + setOrdinalBase; - - if(latestSet < 35 && set > 220) - { - // This is most likely a set that came in before wraparound. - ordinal -= 256; - } - else - { - latestSet = set; - } - return ordinal; -} -#endif - /** * Read a PSV_FRAME2/PSV_FIRST_FRAME2 packet. */ @@ -248,44 +161,13 @@ void Cl_Frame2Received(int packetType) return; } - /* -#ifdef _DEBUG - VERBOSE2( Con_Printf("Cl_Frame2Received: Processing delta set %i.\n", set) ); -#endif - */ - -#if 0 - if(packetType != PSV_FIRST_FRAME2) - { - // If this is not the first frame, it will be ignored if it arrives - // out of order. - uint ordinal = Cl_ConvertSetToOrdinal(set); - - if(ordinal < latestSetOrdinal) - { - VERBOSE2( Con_Printf("==> Ignored set %i because it arrived out of order.\n", - set) ); - return; - } - latestSetOrdinal = ordinal; - - VERBOSE2( Con_Printf("Latest set ordinal is %i.\n", latestSetOrdinal) ); - } -#endif - { - //VERBOSE2( Con_Printf("Starting to process deltas in set %i.\n", set) ); - // Read and process the message. while(!Reader_AtEnd(msgReader)) { deltaType = Reader_ReadByte(msgReader); skip = false; -/* -#ifdef _DEBUG - Con_Message("Received delta %i.", deltaType); -#endif -*/ + switch(deltaType) { case DT_CREATE_MOBJ: @@ -329,17 +211,16 @@ void Cl_Frame2Received(int packetType) break; default: - Con_Error("Cl_Frame2Received: Unknown delta type %i (numtypes=%i; message size %i).\n", - deltaType, NUM_DELTA_TYPES, netBuffer.length); + LOG_NET_ERROR("Received unknown delta type %i (message size: %i bytes)") + << deltaType << netBuffer.length; + return; } } -#ifdef _DEBUG if(!gotFrame) { - Con_Message("Cl_Frame2Received: First frame received."); + LOGDEV_NET_NOTE("First frame received"); } -#endif // We have now received a frame. gotFrame = true; diff --git a/doomsday/client/src/client/cl_infine.cpp b/doomsday/client/src/client/cl_infine.cpp index 67257354ea..d9cdb820c8 100644 --- a/doomsday/client/src/client/cl_infine.cpp +++ b/doomsday/client/src/client/cl_infine.cpp @@ -43,6 +43,8 @@ void Cl_Finale(Reader* msg) int len; finaleid_t finaleId = Reader_ReadUInt32(msg); + LOG_AS("Cl_Finale"); + if(flags & FINF_SCRIPT) { // Read the script into map-scope memory. It will be freed @@ -58,9 +60,7 @@ void Cl_Finale(Reader* msg) // Start the script. currentFinale = FI_Execute((const char*)script, FF_LOCAL); remoteFinale = finaleId; -#ifdef _DEBUG - Con_Message("Cl_Finale: Started finale %i (remote id %i).", currentFinale, remoteFinale); -#endif + LOGDEV_NET_MSG("Started finale %i (remote id %i)") << currentFinale << remoteFinale; } /// @todo Wouldn't hurt to make sure that the server is talking about the @@ -89,9 +89,7 @@ void Cl_RequestFinaleSkip(void) Writer_WriteUInt16(msgWriter, 1); // skip Msg_End(); -#ifdef _DEBUG - Con_Message("Cl_RequestFinaleSkip: Requesting skip on finale %i.", remoteFinale); -#endif + LOGDEV_NET_MSG("Requesting skip on finale %i") << remoteFinale; Net_SendBuffer(0, 0); } diff --git a/doomsday/client/src/client/cl_main.cpp b/doomsday/client/src/client/cl_main.cpp index 65311f87d5..d4d44f7ec7 100644 --- a/doomsday/client/src/client/cl_main.cpp +++ b/doomsday/client/src/client/cl_main.cpp @@ -51,7 +51,7 @@ void Cl_InitID(void) if((i = CommandLine_CheckWith("-id", 1)) != 0) { clientID = strtoul(CommandLine_At(i + 1), 0, 0); - Con_Message("Cl_InitID: Using custom id 0x%08x.", clientID); + LOG_NET_NOTE("Using custom client ID: 0x%08x") << clientID; return; } @@ -86,7 +86,7 @@ int Cl_GameReady(void) void Cl_CleanUp() { - Con_Printf("Cl_CleanUp.\n"); + LOG_NET_MSG("Cleaning up client state"); clientPaused = false; handshakeReceived = false; @@ -104,6 +104,8 @@ void Cl_CleanUp() void Cl_SendHello() { + LOG_AS("Cl_SendHello"); + Msg_Begin(PCL_HELLO2); Writer_WriteUInt32(msgWriter, clientID); @@ -111,9 +113,7 @@ void Cl_SendHello() char buf[256]; zap(buf); strncpy(buf, App_CurrentGame().identityKey().toUtf8().constData(), sizeof(buf) - 1); -#ifdef _DEBUG - Con_Message("Cl_SendHello: game mode = %s", buf); -#endif + LOGDEV_NET_VERBOSE("game mode = %s") << buf; Writer_Write(msgWriter, buf, 16); Msg_End(); @@ -129,6 +129,8 @@ void Cl_AnswerHandshake(void) float remoteGameTime = Reader_ReadFloat(msgReader); int i; + LOG_AS("Cl_AnswerHandshake"); + // Immediately send an acknowledgement. This lets the server evaluate // an approximate ping time. Msg_Begin(PCL_ACK_SHAKE); @@ -138,8 +140,8 @@ void Cl_AnswerHandshake(void) // Check the version number. if(remoteVersion != SV_VERSION) { - Con_Message("Cl_AnswerHandshake: Version conflict! (you:%i, server:%i)", - SV_VERSION, remoteVersion); + LOG_NET_ERROR("Version conflict! (you:%i, server:%i)") + << SV_VERSION << remoteVersion; Con_Execute(CMDS_DDAY, "net disconnect", false, false); Demo_StopPlayback(); Con_Open(true); @@ -179,8 +181,8 @@ void Cl_AnswerHandshake(void) gameReady = false; Cl_InitFrame(); - Con_Message("Cl_AnswerHandshake: myConsole:%i, remoteGameTime:%f.", - myConsole, remoteGameTime); + LOGDEV_NET_MSG("Answering handshake: myConsole:%i, remoteGameTime:%.2f") + << myConsole << remoteGameTime; /** * Tell the game that we have arrived. The map will be changed when the @@ -210,9 +212,7 @@ void Cl_HandlePlayerInfo(void) memset(name, 0, sizeof(name)); Reader_Read(msgReader, name, len); -#ifdef _DEBUG - Con_Message("Cl_HandlePlayerInfo: console:%i name:%s", console, name); -#endif + LOG_NET_VERBOSE("Player %i named \"%s\"") << console << name; // Is the console number valid? if(console >= DDMAXPLAYERS) @@ -235,7 +235,7 @@ void Cl_HandlePlayerInfo(void) void Cl_PlayerLeaves(int plrNum) { - Con_Printf("Cl_PlayerLeaves: player %i has left.\n", plrNum); + LOG_NET_NOTE("Player %i has left the game") << plrNum; ddPlayers[plrNum].shared.inGame = false; gx.NetPlayerEvent(plrNum, DDPE_EXIT, 0); } @@ -299,7 +299,7 @@ void Cl_GetPackets(void) // The server updates our time. Latency has been taken into // account, so... gameTime = Reader_ReadFloat(msgReader); - Con_Printf("PSV_SYNC: gameTime=%.3f\n", gameTime); + LOGDEV_NET_VERBOSE("PSV_SYNC: gameTime=%.3f") << gameTime; DD_ResetTimer(); break; @@ -377,9 +377,7 @@ void Cl_GetPackets(void) } else { -#ifdef _DEBUG - Con_Message("Cl_GetPackets: Packet (type %i) was discarded!", netBuffer.msg.type); -#endif + LOG_NET_WARNING("Packet was discarded (unknown type %i)") << netBuffer.msg.type; } } @@ -407,27 +405,28 @@ void Cl_Assertions(int plrNum) if(!s->clMobjId || !plr->shared.mo) return; + LOG_AS("Cl_Assertions"); + clmo = ClMobj_Find(s->clMobjId); if(!clmo) { - Con_Message("Cl_Assertions: client %i does not have a clmobj yet [%i].", plrNum, s->clMobjId); + LOGDEV_NET_NOTE("Client %i does not have a clmobj yet [%i]") << plrNum << s->clMobjId; return; } mo = plr->shared.mo; /* - Con_Message("Assert: client %i, clmo %i (flags 0x%x)", - plrNum, clmo->thinker.id, clmo->ddFlags); - */ + ("Assert: client %i, clmo %i (flags 0x%x)", plrNum, clmo->thinker.id, clmo->ddFlags); + */ // Make sure the flags are correctly set for a client. if(mo->ddFlags & DDMF_REMOTE) { - Con_Message("Cl_Assertions: client %i, mobj should not be remote!", plrNum); + LOGDEV_NET_NOTE("Client %i's mobj should not be remote") << plrNum; } if(clmo->ddFlags & DDMF_SOLID) { - Con_Message("Cl_Assertions: client %i, clmobj should not be solid (when player is alive)!", plrNum); + LOGDEV_NET_NOTE("Client %i's clmobj should not be solid (when player is alive)") << plrNum; } } diff --git a/doomsday/client/src/client/cl_mobj.cpp b/doomsday/client/src/client/cl_mobj.cpp index 506270f728..85bed11a6c 100644 --- a/doomsday/client/src/client/cl_mobj.cpp +++ b/doomsday/client/src/client/cl_mobj.cpp @@ -393,15 +393,14 @@ void Map::expireClMobjs() // Has this mobj timed out? if(nowTime - info->time > CLMOBJ_TIMEOUT) { -#ifdef DENG_DEBUG - Con_Message("Map::expireClMobjs: Mobj %i has expired (%i << %i), in state %s [%c%c%c].", - mo->thinker.id, - info->time, nowTime, - Def_GetStateName(mo->state), - info->flags & CLMF_UNPREDICTABLE? 'U' : '_', - info->flags & CLMF_HIDDEN? 'H' : '_', - info->flags & CLMF_NULLED? '0' : '_'); -#endif + LOGDEV_MAP_MSG("Mobj %i has expired (%i << %i), in state %s [%c%c%c]") + << mo->thinker.id + << info->time << nowTime + << Def_GetStateName(mo->state) + << (info->flags & CLMF_UNPREDICTABLE? 'U' : '_') + << (info->flags & CLMF_HIDDEN? 'H' : '_') + << (info->flags & CLMF_NULLED? '0' : '_'); + // Too long. The server will probably never send anything // for this mobj, so get rid of it. (Both unpredictable // and hidden mobjs are not visible or bl/seclinked.) @@ -779,14 +778,6 @@ void ClMobj_ReadDelta2(boolean skip) d->ceilingZ = Reader_ReadFloat(msgReader); } -/*#if _DEBUG - if((df & MDF_ORIGIN_Z) && d->dPlayer && P_GetDDPlayerIdx(d->dPlayer) != consolePlayer) - { - Con_Message("ClMobj_ReadDelta2: Player=%i z=%f onFloor=%i", P_GetDDPlayerIdx(d->dPlayer), - d->pos[VZ], onFloor); - } -#endif*/ - // Momentum using 8.8 fixed point. if(df & MDF_MOM_X) { @@ -940,17 +931,13 @@ void ClMobj_ReadNullDelta2(boolean skip) if(skip) return; -#ifdef _DEBUG - Con_Printf("Cl_ReadNullMobjDelta2: Null %i\n", id); -#endif + LOG_AS("Cl_ReadNullMobjDelta2"); + LOGDEV_NET_XVERBOSE("Null %i") << id; if((mo = ClMobj_Find(id)) == NULL) { // Wasted bandwidth... -#ifdef _DEBUG - Con_Printf("Cl_ReadNullMobjDelta2: Request to remove id %i that has " - "not been received.\n", id); -#endif + LOGDEV_NET_MSG("Request to remove id %i that doesn't exist here") << id; return; } @@ -963,10 +950,7 @@ void ClMobj_ReadNullDelta2(boolean skip) } else { -#ifdef _DEBUG - Con_Message("ClMobj_ReadNullDelta2: clmobj of player %i deleted.", - P_GetDDPlayerIdx(mo->dPlayer)); -#endif + LOGDEV_NET_MSG("clmobj of player %i deleted") << P_GetDDPlayerIdx(mo->dPlayer); // The clmobjs of players aren't linked. ClPlayer_State(P_GetDDPlayerIdx(mo->dPlayer))->clMobjId = 0; diff --git a/doomsday/client/src/client/cl_player.cpp b/doomsday/client/src/client/cl_player.cpp index 5e7f09d56c..7a7422de7c 100644 --- a/doomsday/client/src/client/cl_player.cpp +++ b/doomsday/client/src/client/cl_player.cpp @@ -136,7 +136,9 @@ void ClPlayer_ApplyPendingFixes(int plrNum) if(clmo->thinker.id != state->pendingFixTargetClMobjId) return; - assert(clmo->thinker.id == state->clMobjId); + LOG_AS("ClPlayer_ApplyPendingFixes"); + + DENG_ASSERT(clmo->thinker.id == state->clMobjId); if(state->pendingFixes & DDPF_FIXANGLES) { @@ -144,10 +146,9 @@ void ClPlayer_ApplyPendingFixes(int plrNum) ddpl->fixAcked.angles = ddpl->fixCounter.angles; sendAck = true; -#ifdef _DEBUG - Con_Message("ClPlayer_ApplyPendingFixes: Applying angle %x to mobj %p and clmo %i...", - state->pendingAngleFix, mo, clmo->thinker.id); -#endif + LOGDEV_NET_MSG("Applying angle %x to mobj %p and clmo %i") + << state->pendingAngleFix << mo << clmo->thinker.id; + clmo->angle = mo->angle = state->pendingAngleFix; ddpl->lookDir = state->pendingLookDirFix; } @@ -158,11 +159,10 @@ void ClPlayer_ApplyPendingFixes(int plrNum) ddpl->fixAcked.origin = ddpl->fixCounter.origin; sendAck = true; -#ifdef _DEBUG - Con_Message("ClPlayer_ApplyPendingFixes: Applying pos (%f, %f, %f) to mobj %p and clmo %i...", - state->pendingOriginFix[VX], state->pendingOriginFix[VY], state->pendingOriginFix[VZ], - mo, clmo->thinker.id); -#endif + LOGDEV_NET_MSG("Applying pos %s to mobj %p and clmo %i") + << Vector3d(state->pendingOriginFix).asText() + << mo << clmo->thinker.id; + Mobj_SetOrigin(mo, state->pendingOriginFix[VX], state->pendingOriginFix[VY], state->pendingOriginFix[VZ]); mo->reactionTime = 18; @@ -179,11 +179,10 @@ void ClPlayer_ApplyPendingFixes(int plrNum) ddpl->fixAcked.mom = ddpl->fixCounter.mom; sendAck = true; -#ifdef _DEBUG - Con_Message("ClPlayer_ApplyPendingFixes: Applying mom (%f, %f, %f) to mobj %p and clmo %i...", - state->pendingMomFix[VX], state->pendingMomFix[VY], state->pendingMomFix[VZ], - mo, clmo->thinker.id); -#endif + LOGDEV_NET_MSG("Applying mom %s to mobj %p and clmo %i") + << Vector3d(state->pendingMomFix).asText() + << mo << clmo->thinker.id; + mo->mom[MX] = clmo->mom[VX] = state->pendingMomFix[VX]; mo->mom[MY] = clmo->mom[VY] = state->pendingMomFix[VY]; mo->mom[MZ] = clmo->mom[VZ] = state->pendingMomFix[VZ]; @@ -210,6 +209,8 @@ void ClPlayer_HandleFix(void) ddplayer_t* ddpl; clplayerstate_t* state; + LOG_AS("Cl_HandlePlayerFix"); + // Target player. plrNum = Reader_ReadByte(msgReader); plr = &ddPlayers[plrNum]; @@ -221,6 +222,8 @@ void ClPlayer_HandleFix(void) state->pendingFixTargetClMobjId = Reader_ReadUInt16(msgReader); + LOGDEV_NET_MSG("Fixing player %i") << plrNum; + if(fixes & 1) // fix angles? { ddpl->fixCounter.angles = Reader_ReadInt32(msgReader); @@ -228,10 +231,8 @@ void ClPlayer_HandleFix(void) state->pendingLookDirFix = Reader_ReadFloat(msgReader); state->pendingFixes |= DDPF_FIXANGLES; -#ifdef _DEBUG - Con_Message("Cl_HandlePlayerFix: [Plr %i] Fix angles %i. Angle=%x, lookdir=%f", plrNum, - ddpl->fixAcked.angles, state->pendingAngleFix, state->pendingLookDirFix); -#endif + LOGDEV_NET_VERBOSE("Pending fix angles %i: angle=%x, lookdir=%f") + << ddpl->fixAcked.angles << state->pendingAngleFix << state->pendingLookDirFix; } if(fixes & 2) // fix pos? @@ -242,10 +243,8 @@ void ClPlayer_HandleFix(void) state->pendingOriginFix[VZ] = Reader_ReadFloat(msgReader); state->pendingFixes |= DDPF_FIXORIGIN; -#ifdef _DEBUG - Con_Message("Cl_HandlePlayerFix: [Plr %i] Fix pos %i. Pos=%f, %f, %f", plrNum, - ddpl->fixAcked.origin, state->pendingOriginFix[VX], state->pendingOriginFix[VY], state->pendingOriginFix[VZ]); -#endif + LOGDEV_NET_VERBOSE("Pending fix pos %i: %s") + << ddpl->fixAcked.origin << Vector3d(state->pendingOriginFix).asText(); } if(fixes & 4) // fix momentum? @@ -255,6 +254,9 @@ void ClPlayer_HandleFix(void) state->pendingMomFix[VY] = Reader_ReadFloat(msgReader); state->pendingMomFix[VZ] = Reader_ReadFloat(msgReader); state->pendingFixes |= DDPF_FIXMOM; + + LOGDEV_NET_VERBOSE("Pending fix momentum %i: %s") + << ddpl->fixAcked.mom << Vector3d(state->pendingMomFix).asText(); } ClPlayer_ApplyPendingFixes(plrNum); @@ -321,6 +323,8 @@ void ClPlayer_ReadDelta2(boolean skip) ddpsprite_t *psp; unsigned short num, newId; + LOG_AS("ClPlayer_ReadDelta2"); + // The first byte consists of a player number and some flags. num = Reader_ReadByte(msgReader); df = (num & 0xf0) << 8; @@ -361,10 +365,9 @@ void ClPlayer_ReadDelta2(boolean skip) //info = ClMobj_GetInfo(clmo); if(!clmo) { -#ifdef _DEBUG - Con_Message("ClPlayer_ReadDelta2: Player %i's new clmobj is %i, but we don't know it yet.", - num, newId); -#endif + LOGDEV_NET_NOTE("Player %i's new clmobj is %i, but we haven't received it yet") + << num << newId; + // This mobj hasn't yet been sent to us. // We should be receiving the rest of the info very shortly. clmo = ClMobj_Create(s->clMobjId); @@ -397,36 +400,17 @@ void ClPlayer_ReadDelta2(boolean skip) // The update will be made when the mobj data is received. if(!justCreated) // && num != consolePlayer) { -#ifdef _DEBUG - Con_Message("ClPlayer_ReadDelta2: Copying clmo %i state to real player %i mobj %p.", - newId, num, ddpl->mo); -#endif + LOGDEV_NET_XVERBOSE("Copying clmo %i state to real player %i mobj %p") + << newId << num << ddpl->mo; + Cl_UpdateRealPlayerMobj(ddpl->mo, clmo, 0xffffffff, true); } - /* - else if(ddpl->mo) - { - // Update the new client mobj's information from the real - // mobj, which is already known. -#if _DEBUG - Con_Message("Cl_RdPlrD2: Pl%i: Copying pos&angle from real mobj to clmobj.", num); - Con_Message(" x=%g y=%g z=%g", ddpl->mo->origin[VX], ddpl->mo->origin[VY], ddpl->mo->origin[VZ]); -#endif - clmo->pos[VX] = ddpl->mo->origin[VX]; - clmo->pos[VY] = ddpl->mo->origin[VY]; - clmo->pos[VZ] = ddpl->mo->origin[VZ]; - clmo->angle = ddpl->mo->angle; - if(!skip) - ClPlayer_UpdateOrigin(num); - } - */ - -#if _DEBUG - Con_Message("ClPlr_RdD2: Pl%i: mobj=%i old=%p", num, s->clMobjId, old); - Con_Message(" x=%g y=%g z=%g fz=%g cz=%g", clmo->origin[VX], - clmo->origin[VY], clmo->origin[VZ], clmo->floorZ, clmo->ceilingZ); - Con_Message("ClPlr_RdD2: pl=%i => moid=%i", (skip? -1 : num), s->clMobjId); -#endif + + LOGDEV_NET_VERBOSE("Player %i: mobj=%i old=%p x=%.1f y=%.1f z=%.1f Fz=%.1f Cz=%.1f") + << num << s->clMobjId << old + << clmo->origin[VX] << clmo->origin[VY] << clmo->origin[VZ] + << clmo->floorZ << clmo->ceilingZ; + LOGDEV_NET_VERBOSE("Player %i using mobj id %i") << (skip? -1 : num) << s->clMobjId; } } @@ -468,13 +452,8 @@ void ClPlayer_ReadDelta2(boolean skip) { ddpl->flags &= ~DDPF_REMOTE_VIEW_FILTER; } -#ifdef _DEBUG - Con_Message("ClPlayer_ReadDelta2: Filter color set remotely to (%f,%f,%f,%f)", - ddpl->filterColor[CR], - ddpl->filterColor[CG], - ddpl->filterColor[CB], - ddpl->filterColor[CA]); -#endif + LOG_NET_XVERBOSE("View filter color set remotely to %s") + << Vector4f(ddpl->filterColor).asText(); } if(df & PDF_PSPRITES) { diff --git a/doomsday/client/src/client/cl_sound.cpp b/doomsday/client/src/client/cl_sound.cpp index 610c1a16e6..82dca2c0e7 100644 --- a/doomsday/client/src/client/cl_sound.cpp +++ b/doomsday/client/src/client/cl_sound.cpp @@ -1,4 +1,4 @@ -/** @file cl_sound.cpp Clientside Sounds. +/** @file cl_sound.cpp Clientside Sounds. * * @authors Copyright © 2003-2013 Jaakko Keränen * @authors Copyright © 2006-2013 Daniel Swanson @@ -187,10 +187,6 @@ void Cl_ReadSoundDelta2(deltatype_t type, boolean skip) info->flags |= CLMF_HIDDEN | CLMF_SOUND; info->sound = sound; info->volume = volume; - /*#ifdef _DEBUG - Con_Printf("Cl_ReadSoundDelta2(%i): Queueing: id=%i snd=%i vol=%.2f\n", - type, mobjId, sound, volume); - #endif */ // The sound will be started when the clmobj is unhidden. return; } @@ -207,9 +203,6 @@ void Cl_ReadSoundDelta2(deltatype_t type, boolean skip) // from the real player mobj. if(cmo && cmo->thinker.id == ClPlayer_State(consolePlayer)->clMobjId) { - /*#ifdef _DEBUG - Con_Printf("Cl_ReadSoundDelta2(%i): ViewMobj sound...\n", type); - #endif */ emitter = ddPlayers[consolePlayer].shared.mo; } @@ -221,16 +214,6 @@ void Cl_ReadSoundDelta2(deltatype_t type, boolean skip) } S_LocalSoundAtVolume(sound | soundFlags, emitter, volume); -/*# -ifdef _DEBUG -Con_Printf("Cl_ReadSoundDelta2(%i): Start snd=%i [%x] vol=%.2f", - type, sound, flags, volume); -if(cmo) Con_Printf(", mo=%i\n", cmo->mo.thinker.id); -else if(sector) Con_Printf(", sector=%i\n", sector->indexInMap()); -else if(poly) Con_Printf(", poly=%i\n", GET_POLYOBJ_IDX(poly)); -else Con_Printf("\n"); -#endif -*/ } else if(sound >= 0) { @@ -239,17 +222,6 @@ else Con_Printf("\n"); if(emitter) { S_StopSound(sound, emitter); - -/* -#ifdef _DEBUG -Con_Printf("Cl_ReadSoundDelta2(%i): Stop sound %i", - type, sound); -if(cmo) Con_Printf(", mo=%i\n", cmo->mo.thinker.id); -else if(sector) Con_Printf(", sector=%i\n", sector->indexInMap()); -else if(poly) Con_Printf(", poly=%i\n", GET_POLYOBJ_IDX(poly)); -else Con_Printf("\n"); -#endif -*/ } } } @@ -276,15 +248,16 @@ void Cl_Sound(void) sound = Reader_ReadByte(msgReader); } + LOG_AS("Cl_Sound"); + // Is the ID valid? if(sound < 1 || sound >= defs.count.sounds.num) { - Con_Message("Cl_Sound: Out of bounds ID %i.", sound); - return; // Bad sound ID! + LOGDEV_NET_WARNING("Invalid sound ID %i") << sound; + return; } -#ifdef _DEBUG - Con_Printf("Cl_Sound: %i\n", sound); -#endif + + LOGDEV_NET_XVERBOSE("id %i") << sound; if(flags & SNDF_VOLUME) { @@ -309,7 +282,7 @@ void Cl_Sound(void) int num = (int)Reader_ReadPackedUInt16(msgReader); if(num >= App_World().map().sectorCount()) { - Con_Message("Cl_Sound: Invalid sector number %i.", num); + LOG_NET_WARNING("Invalid sector number %i") << num; return; } mo = (mobj_t *) &App_World().map().sectors().at(num)->soundEmitter(); @@ -331,9 +304,8 @@ void Cl_Sound(void) else { // Play it from "somewhere". -#ifdef _DEBUG -Con_Printf("Cl_Sound: NULL orig sound %i\n", sound); -#endif + LOGDEV_NET_VERBOSE("Unspecified origin for sound %i") << sound; + S_LocalSoundAtVolume(sound, NULL, volume / 127.0f); } } diff --git a/doomsday/client/src/client/cl_world.cpp b/doomsday/client/src/client/cl_world.cpp index 42aa910c7d..cbf103e777 100644 --- a/doomsday/client/src/client/cl_world.cpp +++ b/doomsday/client/src/client/cl_world.cpp @@ -79,15 +79,15 @@ static indextranstable_t xlatMobjState; void Cl_ReadServerMaterials(void) { + LOG_AS("Cl_ReadServerMaterials"); + if(!serverMaterials) { serverMaterials = MaterialArchive_NewEmpty(false /*no segment check*/); } MaterialArchive_Read(serverMaterials, msgReader, -1 /*no forced version*/); -#ifdef _DEBUG - Con_Message("Cl_ReadServerMaterials: Received %i materials.", MaterialArchive_Count(serverMaterials)); -#endif + LOGDEV_NET_VERBOSE("Received %i materials") << MaterialArchive_Count(serverMaterials); } static void setTableSize(indextranstable_t* table, int size) @@ -110,9 +110,9 @@ void Cl_ReadServerMobjTypeIDs(void) int i; StringArray* ar = StringArray_New(); StringArray_Read(ar, msgReader); -#ifdef _DEBUG - Con_Message("Cl_ReadServerMobjTypeIDs: Received %i mobj type IDs.", StringArray_Size(ar)); -#endif + + LOG_AS("Cl_ReadServerMobjTypeIDs"); + LOGDEV_NET_VERBOSE("Received %i mobj type IDs") << StringArray_Size(ar); setTableSize(&xlatMobjType, StringArray_Size(ar)); @@ -122,8 +122,8 @@ void Cl_ReadServerMobjTypeIDs(void) xlatMobjType.serverToLocal[i] = Def_GetMobjNum(StringArray_At(ar, i)); if(xlatMobjType.serverToLocal[i] < 0) { - Con_Message("Could not find '%s' in local thing definitions.", - StringArray_At(ar, i)); + LOG_NET_WARNING("Could not find '%s' in local thing definitions") + << StringArray_At(ar, i); } } @@ -135,9 +135,9 @@ void Cl_ReadServerMobjStateIDs(void) int i; StringArray* ar = StringArray_New(); StringArray_Read(ar, msgReader); -#ifdef _DEBUG - Con_Message("Cl_ReadServerMobjStateIDs: Received %i mobj state IDs.", StringArray_Size(ar)); -#endif + + LOG_AS("Cl_ReadServerMobjStateIDs"); + LOGDEV_NET_VERBOSE("Received %i mobj state IDs") << StringArray_Size(ar); setTableSize(&xlatMobjState, StringArray_Size(ar)); @@ -147,8 +147,8 @@ void Cl_ReadServerMobjStateIDs(void) xlatMobjState.serverToLocal[i] = Def_GetStateNum(StringArray_At(ar, i)); if(xlatMobjState.serverToLocal[i] < 0) { - Con_Message("Could not find '%s' in local state definitions.", - StringArray_At(ar, i)); + LOG_NET_WARNING("Could not find '%s' in local state definitions") + << StringArray_At(ar, i); } } @@ -156,14 +156,14 @@ void Cl_ReadServerMobjStateIDs(void) } static Material *Cl_FindLocalMaterial(materialarchive_serialid_t archId) -{ +{ if(!serverMaterials) { // Can't do it. - Con_Message("Cl_FindLocalMaterial: Cannot translate serial id %i, server has not sent its materials!", archId); + LOGDEV_NET_WARNING("Cannot translate serial id %i, server has not sent its materials!") << archId; return 0; } - return (Material *)MaterialArchive_Find(serverMaterials, archId, 0); + return (Material *) MaterialArchive_Find(serverMaterials, archId, 0); } int Cl_LocalMobjType(int serverMobjType) @@ -556,7 +556,7 @@ void Cl_SetPolyMover(uint number, int move, int rotate) clpolyobj_t *mover = Cl_FindOrMakeActivePoly(number); if(!mover) { - Con_Message("Cl_SetPolyMover: Out of polymovers."); + LOGDEV_NET_WARNING("Out of polymovers"); return; } @@ -829,10 +829,6 @@ void Cl_ReadPolyDelta2(boolean skip) if(df & PODF_ANGSPEED) angleSpeed = ((angle_t)Reader_ReadInt16(msgReader)) << 16; -/*#ifdef _DEBUG - Con_Message("Cl_ReadPolyDelta2: PO %i, angle %f, speed %f", num, FIX2FLT(destAngle), FIX2FLT(angleSpeed)); -#endif*/ - if(skip) return;