SpewRetval_t NewSpew(SpewType_t Type, const char *What) { if (Removed || (!What || !ml_Lua)) { return SPEW_CONTINUE; } Color tempColor = GetSpewOutputColor(); tempColor.GetColor(Red,Green,Blue,Alpha); ILuaObject* hook = ml_Lua->GetGlobal("hook"); ILuaObject* hookCall = hook->GetMember("Call"); ml_Lua->Push(hookCall); ml_Lua->Push("SimpleSpew"); ml_Lua->PushNil(); ml_Lua->PushLong(Type); ml_Lua->Push(What); ml_Lua->Push( GetSpewOutputGroup() ); ml_Lua->PushLong( GetSpewOutputLevel() ); ml_Lua->PushLong(Red); ml_Lua->PushLong(Green); ml_Lua->PushLong(Blue); ml_Lua->PushLong(Alpha); ml_Lua->Call(10,0); hookCall->UnReference(); hook->UnReference(); if (OldSpew) { return OldSpew(Type, What); } else { return (SpewRetval_t)0; } }
//----------------------------------------------------------------------------- // Spew func //----------------------------------------------------------------------------- SpewRetval_t ModelBrowserSpewFunc( SpewType_t spewType, const tchar *pMsg ) { OutputDebugString( pMsg ); switch( spewType ) { case SPEW_ASSERT: g_pCVar->ConsoleColorPrintf( Color( 255, 192, 0, 255 ), pMsg ); #ifdef _DEBUG return SPEW_DEBUGGER; #else return SPEW_CONTINUE; #endif case SPEW_ERROR: g_pCVar->ConsoleColorPrintf( Color( 255, 0, 0, 255 ), pMsg ); return SPEW_ABORT; case SPEW_WARNING: g_pCVar->ConsoleColorPrintf( Color( 192, 192, 0, 255 ), pMsg ); break; case SPEW_MESSAGE: { Color c = GetSpewOutputColor(); if ( !Q_stricmp( GetSpewOutputGroup(), "developer" ) ) g_pCVar->ConsoleDPrintf( pMsg ); else g_pCVar->ConsoleColorPrintf( c, pMsg ); } break; } return SPEW_CONTINUE; }