#ifndef __CPLASMA_H__
#define __CPLASMA_H__

#define ESC		27
class CPlasma : public C232Comm
{
public:
	DWORD m_dwStart;
	int m_nOldRank;
	int m_nOldScore;
	enum {
		ATTR_NORMAL		= 0,
		ATTR_HALF		= 1,
		ATTR_LINE		= 2,
		ATTR_REVERSE	= 4,
		ATTR_FLASH		= 8,
		ATTR_PROTECTED	= 128
	};
	enum { PLASMA_OFF, PLASMA_ON, PLASMA_FLASH };

    int m_nGlobalState;
//    Time m_timeLastPlasma2;
public:
	CPlasma () {
		Open (2);
		m_dwStart = GetTickCount ();
		PlasmaClear ();
		PlasmaCursor (CPlasma::PLASMA_OFF);
		m_nOldRank = INT_MIN;
		m_nOldScore = INT_MIN;

        m_nGlobalState = -1;
	}
	virtual ~CPlasma () { 
		PlasmaCursor (CPlasma::PLASMA_OFF);
		PlasmaClear ();
		Close (); 
	}
public:
	void SendPacket (const BYTE* pbPacket, char nLen);
	void PlasmaClear ();

	void PlasmaCursor (char n = PLASMA_OFF);
	void PlasmaCursorHome ();
	void PlasmaCursorX (char n);
	void PlasmaCursorY (char n);

	void PlasmaFontAttr (char n);
	void PlasmaFont (char n);
	
	void PlasmaText (const char *szText);	
	POINT GetFontSize (int Font);

	void PlasmaBoxDraw (RECT tag);
	void PlasmaBoxFill (RECT tag);
	void PlasmaPosText (const char *szText, char x = 0, char y = 0, char Attr = 0, char Font = 5);
	void PlasmaScoreDraw (const char *Rank, const char *Score, BOOL bFlag);

    void DoPlasma(char nMode);
private:
	void PlasmaDisplay (int Gamestate, const char *szName, const char *Rank, const char *Score);
};


#endif