//
// Asura_EntityWatch_System.h
//
// Created by Richard Rice - 28/04/2005
// 
// Copyright (C) 2005 Rebellion, All Rights Reserved.
//

#ifdef ASURA_USE_PRAGMA_ONCE
    #pragma once
#endif

#ifndef __ASURA_ENTITYWATCH_SYSTEM_H__
#define __ASURA_ENTITYWATCH_SYSTEM_H__


//If enabled , then the command console and debug text must also be enabled
#ifdef ASURA_SUPPORT_ENTITYWATCH

#include "Network/Asura_Guid.h"

//Maximum number of entities to watch at once
#define ASURA_ENTITYWATCH_MAXENTITIES 16

#define ASURA_ENTITYWATCH_MAXWIDTH 100

//System for displaying some debugging text for various entities , accessible via console commands.

class Asura_EntityWatch_System
{
public :

	static void Update();

	//adds the console commands for the system
	static void AddConsoleCommands();

	//Called by the entities in DisplayEntityWatchText to display debug text
	//uFieldWidth is the maximum number of characters to use for this entry
	//If 0 , then the field is sized to fit the string (up to maximum allowed)
	static void PrintText(u_int uFieldWidth,const char* pszString,...);

	//forces printing to go onto next line
	static void NextLine();

	static bool ShouldDisplayMessageFor(Asura_Guid uGuid);
	

private :

	//console commands
	static bool ConsoleCmd_EntityWatchOn(const char* pszText,bool bInterrogate, bool bHelp);
	static bool ConsoleCmd_EntityWatchOff(const char* pszText,bool bInterrogate, bool bHelp);
	static bool ConsoleCmd_EnableEntityWatch(bool bEnable,bool bInterrogate, bool bHelp);
	static bool ConsoleCmd_EntityWatchSetBox(const char* pszText,bool bInterrogate, bool bHelp);
	static bool ConsoleCmd_ShowMessages(bool bEnable,bool bInterrogate, bool bHelp);


	static class Asura_Entity_Server* FindEntity(const char* pszText);

	static void AddEntity(const class Asura_Entity_Server* pxEntity);
	static void RemoveEntity(const class Asura_Entity_Server* pxEntity);

	static bool s_bEnabled;
	static u_int s_uNumberWatched;
	static Asura_Guid s_auWatchedEntity[ASURA_ENTITYWATCH_MAXENTITIES];
	static bool s_bWatchMessages;//Causes text to be displayed for messages sent to and from the watched entities

	//point to start rendering text each frame
	static u_int s_uTopLeftPrintX;
	static u_int s_uTopLeftPrintY;

	static u_int s_uPrintWidth;//width of box in which printing is allowed
	static u_int s_uPrintHeight;//height of box in which printing is allowed

	//current rendering positions
	static u_int s_uCurPrintY;
	static u_int s_uXOffset;

	static char s_szText[ASURA_ENTITYWATCH_MAXWIDTH+1];


};



#endif //ASURA_SUPPORT_ENTITYWATCH

#endif //__ASURA_ENTITYWATCH_SYSTEM_H__


