/*
===========================================================================

Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.

This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").

Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code.  If not, see <http://www.gnu.org/licenses/>.

In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code.  If not, please request a copy in writing from id Software at the address below.

If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.

===========================================================================
*/
#ifndef __GAME_BEARSHOOT_WINDOW_H__
#define __GAME_BEARSHOOT_WINDOW_H__

class idGameBearShootWindow;

class BSEntity
{
public:
	const idMaterial* 		material;
	idStr					materialName;
	float					width, height;
	bool					visible;
	
	idVec4					entColor;
	idVec2					position;
	float					rotation;
	float					rotationSpeed;
	idVec2					velocity;
	
	bool					fadeIn;
	bool					fadeOut;
	
	idGameBearShootWindow* 	game;
	
public:
	BSEntity( idGameBearShootWindow* _game );
	virtual				~BSEntity();
	
	virtual void		WriteToSaveGame( idFile* savefile );
	virtual void		ReadFromSaveGame( idFile* savefile, idGameBearShootWindow* _game );
	
	void				SetMaterial( const char* name );
	void				SetSize( float _width, float _height );
	void				SetVisible( bool isVisible );
	
	virtual void		Update( float timeslice );
	virtual void		Draw();
	
private:
};


class idGameBearShootWindow : public idWindow
{
public:
	idGameBearShootWindow( idUserInterfaceLocal* gui );
	~idGameBearShootWindow();
	
	virtual void		WriteToSaveGame( idFile* savefile );
	virtual void		ReadFromSaveGame( idFile* savefile );
	
	virtual const char*	HandleEvent( const sysEvent_t* event, bool* updateVisuals );
	virtual void		PostParse();
	virtual void		Draw( int time, float x, float y );
	virtual const char*	Activate( bool activate );
	virtual idWinVar* 	GetWinVarByName( const char* _name, bool winLookup = false, drawWin_t** owner = NULL );
	
private:
	void				CommonInit();
	void				ResetGameState();
	
	void				UpdateBear();
	void				UpdateHelicopter();
	void				UpdateTurret();
	void				UpdateButtons();
	void				UpdateGame();
	void				UpdateScore();
	
	virtual bool		ParseInternalVar( const char* name, idTokenParser* src );
	
private:

	idWinBool			gamerunning;
	idWinBool			onFire;
	idWinBool			onContinue;
	idWinBool			onNewGame;
	
	float				timeSlice;
	float				timeRemaining;
	bool				gameOver;
	
	int					currentLevel;
	int					goalsHit;
	bool				updateScore;
	bool				bearHitTarget;
	
	float				bearScale;
	bool				bearIsShrinking;
	int					bearShrinkStartTime;
	
	float				turretAngle;
	float				turretForce;
	
	float				windForce;
	int					windUpdateTime;
	
	idList<BSEntity*>	entities;
	
	BSEntity*			turret;
	BSEntity*			bear;
	BSEntity*			helicopter;
	BSEntity*			goal;
	BSEntity*			wind;
	BSEntity*			gunblast;
};

#endif //__GAME_BEARSHOOT_WINDOW_H__
