#ifndef GAMEHEROESOFCIS
#define GAMEHEROESOFCIS

/*
	The heroesproto.h file is the header file for the prototype of the HeroesOfCIS arcade game.
	This file is heavily based off the gamestub.h file that is distributed with the POP
	framework and includes a lot of code and comments from that file.

	In the code below, we put the word virtual in front of all the methods that we have
	inherited from the base classes and which we plan to overload.  (These methods were
	already declared as virtual in the base classes, so that our overloads can take effect.
	Declaring them virtual in this child class only means that they could be further overloaded 
	in the children of the child.)
*/

#include "game.h"
#include "critterarmed.h"

//=== cGameHeroesOfCIS Critters ====================================

class cCritterHeroesPlayer : public cCritterPlayer //Our player.
{
DECLARE_SERIAL(cCritterHeroesPlayer);

/* Constants for Player Class */
static Real MAX_SPEED;

private:
	int _wrench;

public:
	cCritterHeroesPlayer(cGame *pownergame = NULL);

	int wrench()const{return _wrench;}

//overloads
	virtual void reset();
	virtual int damage(int hitstrength);
	virtual BOOL collide(cCritter *pcritter); 
	virtual void update(CPopView *pactiveview, Real dt);
//	virtual void setWrapflag(int wrapflag){}//Don't allow _wrapflag to change from cCritter::BOUNCE.
};

class cCritterPrintQueue : public cCritter
{
DECLARE_SERIAL(cCritterPrintQueue);

private:
	int _queue;

public:
	cCritterPrintQueue(cGame *pownergame = NULL);

//accessors
	int queue(){return _queue;}
	void setQueue(int value){_queue = value;}
	void incQueue(int value){_queue += value;}
	void decQueue(int value){_queue = max(0, _queue - value);}

//overloads
	virtual void update(CPopView *pactiveview, Real dt);
};

class cCritterSupplyCabinet : public cCritter
{
DECLARE_SERIAL(cCritterSupplyCabinet);
public:
	cCritterSupplyCabinet(cGame *pownergame = NULL);

//overloads
//	virtual int damage(int hitstrength);
	virtual BOOL collide(cCritter *pcritter); 
	virtual void update(CPopView *pactiveview, Real dt);
};

class cCritterPrinter : public cCritter
{
DECLARE_SERIAL(cCritterPrinter);

private:
	BOOL _broken;
	cCritterPrintQueue* _pprintqueue;

public:
	cCritterPrinter(cGame *pownergame = NULL);

	BOOL isBroken();
	void breakMe();
	void fixMe();

//accessors
	cCritterPrintQueue* pprintqueue(){return _pprintqueue;}

//overloads
	virtual BOOL collide(cCritter *pcritter); 
	virtual void update(CPopView *pactiveview, Real dt);
};

//======================= cGameHeroesOfCIS ================


class cGameHeroesOfCIS : public cGame
{
DECLARE_SERIAL(cGameHeroesOfCIS);
//Name your statics here
//static int PLAYERHEALTH;
static int DEFAULTRIVALCOUNT;
static int DEFAULTSEEDCOUNT;

static int MAXQUEUE;

/* Game world parameters */

	static Real BLANK_EDGE_WEIGHT; 
	static Real PLAYFIELD_WEIGHT;
	static Real PLAYFIELD_STATUSBOX_SPACER_WEIGHT; 
	static Real BOX_LINEWIDTH_WEIGHT; 
	static COLORREF PLAYFIELD_FILLCOLOR;
	static COLORREF PLAYFIELD_LINECOLOR;
	static COLORREF STATUSBOX_FILLCOLOR;
	static COLORREF STATUSBOX_LINECOLOR;

protected:
	int _level;

	int _rivalcount; //possible param, don't have to use it.
	int _printercount;

	cRealBox _playfield;
	cRealBox _statusbox;

	cCritterPrinter* _pprinter[8];
	cCritterSupplyCabinet* _psupplycabinet[4];

	BOOL printerExploded();

public:
	cGameHeroesOfCIS();

 //Accessors
	cRealBox playfield(){return _playfield;}
	cRealBox statusbox(){return _statusbox;}

 //Player stats
	int wrench();

 //overloads
	virtual void Serialize(CArchive& ar); //Overload for _rivalcount
	virtual void reset();
	virtual void adjustGameParameters();
	virtual CString statusMessage();
	virtual void initializeView(CPopView *pview);
	virtual void initializeViewpoint(cCritterViewer *pviewer); //To change the default view direction.
	virtual void drawBackground(cGraphics *pgraphics, int drawflags);
	virtual void drawForeground(cGraphics *pgraphics, int drawflags);
	virtual void seedCritters();
};

#endif //GAMEHEROESOFCIS