about summary refs log tree commit diff
path: root/src/game/editor
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2010-08-18 00:06:00 +0200
committeroy <Tom_Adams@web.de>2010-08-18 00:06:00 +0200
commitcabecb7fa937b5e4efa859ea62722468f91a5089 (patch)
treed9da92814dd049dfef7bdcfa9069955504341b8c /src/game/editor
parent16f201794de61e237b4a7644d28f043dc1b987bb (diff)
downloadzcatch-cabecb7fa937b5e4efa859ea62722468f91a5089.tar.gz
zcatch-cabecb7fa937b5e4efa859ea62722468f91a5089.zip
added output level for console print function, categorised the debug messages and merged them into the new functionality. Closes #8
Diffstat (limited to 'src/game/editor')
-rw-r--r--src/game/editor/ed_editor.cpp8
-rw-r--r--src/game/editor/ed_editor.h2
-rw-r--r--src/game/editor/ed_io.cpp14
-rw-r--r--src/game/editor/ed_layer_quads.cpp3
-rw-r--r--src/game/editor/ed_popups.cpp3
5 files changed, 21 insertions, 9 deletions
diff --git a/src/game/editor/ed_editor.cpp b/src/game/editor/ed_editor.cpp
index a2ecfb7e..aa6b7829 100644
--- a/src/game/editor/ed_editor.cpp
+++ b/src/game/editor/ed_editor.cpp
@@ -8,6 +8,7 @@
 #include <engine/shared/config.h>
 #include <engine/shared/engine.h>
 #include <engine/client.h>
+#include <engine/console.h>
 #include <engine/graphics.h>
 #include <engine/textrender.h>
 #include <engine/input.h>
@@ -1271,7 +1272,9 @@ void CEditor::DoMapEditor(CUIRect View, CUIRect ToolBar)
 					if(!UI()->MouseButton(0))
 					{
 						// grab brush
-						dbg_msg("editor", "grabbing %f %f %f %f", r.x, r.y, r.w, r.h);
+						char aBuf[256];
+						str_format(aBuf, sizeof(aBuf),"grabbing %f %f %f %f", r.x, r.y, r.w, r.h);
+						Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "editor", aBuf);
 
 						// TODO: do all layers
 						int Grabs = 0;
@@ -1820,7 +1823,7 @@ static void ExtractName(const char *pFileName, char *pName)
 	int FinalLen = End-Start;
 	mem_copy(pName, &pFileName[Start], FinalLen);
 	pName[FinalLen] = 0;
-	dbg_msg("", "%s %s %d %d", pFileName, pName, Start, End);
+	//dbg_msg("", "%s %s %d %d", pFileName, pName, Start, End);
 }
 
 void CEditor::ReplaceImage(const char *pFileName, void *pUser)
@@ -3006,6 +3009,7 @@ void CEditor::Init()
 {
 	m_pInput = Kernel()->RequestInterface<IInput>();
 	m_pClient = Kernel()->RequestInterface<IClient>();
+	m_pConsole = Kernel()->RequestInterface<IConsole>();
 	m_pGraphics = Kernel()->RequestInterface<IGraphics>();
 	m_pTextRender = Kernel()->RequestInterface<ITextRender>();
 	m_RenderTools.m_pGraphics = m_pGraphics;
diff --git a/src/game/editor/ed_editor.h b/src/game/editor/ed_editor.h
index 9ccb3203..bbc3c45f 100644
--- a/src/game/editor/ed_editor.h
+++ b/src/game/editor/ed_editor.h
@@ -427,6 +427,7 @@ class CEditor : public IEditor
 {
 	class IInput *m_pInput;
 	class IClient *m_pClient;
+	class IConsole *m_pConsole;
 	class IGraphics *m_pGraphics;
 	class ITextRender *m_pTextRender;
 	CRenderTools m_RenderTools;
@@ -434,6 +435,7 @@ class CEditor : public IEditor
 public:
 	class IInput *Input() { return m_pInput; };
 	class IClient *Client() { return m_pClient; };
+	class IConsole *Console() { return m_pConsole; };
 	class IGraphics *Graphics() { return m_pGraphics; };
 	class ITextRender *TextRender() { return m_pTextRender; };
 	CUI *UI() { return &m_UI; }
diff --git a/src/game/editor/ed_io.cpp b/src/game/editor/ed_io.cpp
index 4d514051..6eae9fb5 100644
--- a/src/game/editor/ed_io.cpp
+++ b/src/game/editor/ed_io.cpp
@@ -1,3 +1,4 @@
+#include <engine/console.h>
 #include <engine/graphics.h>
 #include <engine/storage.h>
 #include <game/gamecore.h>
@@ -197,11 +198,14 @@ int CEditor::Save(const char *pFilename)
 
 int CEditorMap::Save(class IStorage *pStorage, const char *pFileName)
 {
-	dbg_msg("editor", "saving to '%s'...", pFileName);
+	char aBuf[256];
+	str_format(aBuf, sizeof(aBuf), "saving to '%s'...", pFileName);
+	m_pEditor->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "editor", aBuf);
 	CDataFileWriter df;
 	if(!df.Open(pStorage, pFileName))
 	{
-		dbg_msg("editor", "failed to open file '%s'...", pFileName);
+		str_format(aBuf, sizeof(aBuf), "failed to open file '%s'...", pFileName);
+		m_pEditor->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "editor", aBuf);
 		return 0;
 	}
 		
@@ -259,7 +263,7 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName)
 		{
 			if(pGroup->m_lLayers[l]->m_Type == LAYERTYPE_TILES)
 			{
-				dbg_msg("editor", "saving tiles layer");
+				m_pEditor->Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "editor", "saving tiles layer");
 				CLayerTiles *pLayer = (CLayerTiles *)pGroup->m_lLayers[l];
 				pLayer->PrepareForSave();
 				
@@ -288,7 +292,7 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName)
 			}
 			else if(pGroup->m_lLayers[l]->m_Type == LAYERTYPE_QUADS)
 			{
-				dbg_msg("editor", "saving quads layer");
+				m_pEditor->Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "editor", "saving quads layer");
 				CLayerQuads *pLayer = (CLayerQuads *)pGroup->m_lLayers[l];
 				if(pLayer->m_lQuads.size())
 				{
@@ -346,7 +350,7 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName)
 	
 	// finish the data file
 	df.Finish();
-	dbg_msg("editor", "done");
+	m_pEditor->Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "editor", "saving done");
 	
 	// send rcon.. if we can
 	/*
diff --git a/src/game/editor/ed_layer_quads.cpp b/src/game/editor/ed_layer_quads.cpp
index 023fd29f..83fd4392 100644
--- a/src/game/editor/ed_layer_quads.cpp
+++ b/src/game/editor/ed_layer_quads.cpp
@@ -1,5 +1,6 @@
 #include <base/math.h>
 
+#include <engine/console.h>
 #include <engine/graphics.h>
 
 #include "ed_editor.h"
@@ -124,7 +125,7 @@ int CLayerQuads::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
 		
 		if(px > Rect.x && px < Rect.x+Rect.w && py > Rect.y && py < Rect.y+Rect.h)
 		{
-			dbg_msg("", "grabbed one");
+			m_pEditor->Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "editor", "grabbed one");
 			CQuad n;
 			n = *q;
 			
diff --git a/src/game/editor/ed_popups.cpp b/src/game/editor/ed_popups.cpp
index 8152c67c..68f804b5 100644
--- a/src/game/editor/ed_popups.cpp
+++ b/src/game/editor/ed_popups.cpp
@@ -1,3 +1,4 @@
+#include <engine/console.h>
 #include <engine/graphics.h>
 #include <engine/input.h>
 #include <engine/keys.h>
@@ -19,7 +20,7 @@ static int g_UiNumPopups = 0;
 
 void CEditor::UiInvokePopupMenu(void *Id, int Flags, float x, float y, float w, float h, int (*pfnFunc)(CEditor *pEditor, CUIRect Rect), void *pExtra)
 {
-	dbg_msg("", "invoked");
+	Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "editor", "invoked");
 	if(x + w > UI()->Screen()->w)
 		x -= w;
 	if(y + h > UI()->Screen()->h)