Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

BattleEntry.h

Go to the documentation of this file.
00001 /*
00002 CS Senior Project 2003
00003 Team : Leftfield
00004 Project : ModernWarfare
00005 Members :
00006 - Russ Christensen              <rchriste@cs.utah.edu>
00007 - Todd Smith                    <tcsmith@cs.utah.edu>
00008 - Usit Duongsaa                 <duongsaa@cs.utah.edu>
00009 Copyright 2003 Russ Christensen, Usit Duongsaa, and Todd Smith. All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
00012 
00013 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
00014 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 
00015 THIS SOFTWARE IS PROVIDED BY RUSS CHRISTENSEN, USIT DUONGSAA, AND TODD SMITH ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RUSS, USIT, TODD OR OTHER CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00016 */
00017 
00022 #ifndef INCLUDE_BATTLEENTRY
00023 #define INCLUDE_BATTLEENTRY
00024 
00025 #include "..\AEngine\AEngine.h"
00026 #include "BattleGroup.h"
00027 #include "BattleState.h"
00028 #include "BattleUnitStat.h"
00029 #include "UniqueID.h"
00030 
00031 //------------------------------------------------------------------------------------
00032 //------------------------------------------------------------------------------------
00035 class BattleEntry : public UniqueID
00036 {
00037 
00038 public:
00039 
00044         BattleEntry( const Vec3D teamAColor, const Vec3D teamBColor, const Vec2D location );
00045 
00047         void input();
00048 
00051         void update();
00052 
00054         void render();
00055 
00058         bool isBattleFinished();
00059 
00061         Vec3D getWinningTeamColor();
00062 
00063         Vec3D getTeamAColor() { return m_teamAColor; }
00064         Vec3D getTeamBColor() { return m_teamBColor; }
00065 
00068         vector<Int3Tuple> teamAGroups, teamBGroups;
00069 
00071         vector<Int3Tuple> getSurvivors();
00072 
00074         Vec2D getBattleLocation();
00075 
00077         bool isFoughtBy(const Vec3D& teamColor) const;
00078 
00080         void enQueueInput( string cmd );
00081 
00082         void processQueuedInput();
00083 
00085         bool maySendGroundReinforcement( Vec3D playerColor );
00086         bool maySendAirReinforcement( Vec3D playerColor );
00087 
00089         void sendGroundReinforcement( Vec3D playerColor, int unitType, int numUnits, int forceNum=0 );
00090         void sendAirReinforcement( Vec3D playerColor, int numJets, int homeTown );
00091 
00093         bool contains(Vec3D pt);
00094 
00095         void clearUnitSelection();              // de-select any units the player has selected
00096 
00097         // count the number of groups (ground,air) that belong to a specific player
00098         int countGroupsBelongingToPlayer( Vec3D playerColor );
00099 
00100         inline BattleState *getBSPtr() { return BS; };
00101 
00102         //--------------------------------------------------------------------------------
00103         //-----PROTECTED-STUFF----NOT-FOR-GENERAL-PUBLIC-CONSUMPTION----------------------
00104         //--------------------------------------------------------------------------------
00105 protected:
00106         void initBattle();
00107 
00108         Vec3D m_teamAColor, m_teamBColor;
00109         Vec2D m_location;
00110 
00111         int m_rfmCalledA, m_rfmCalledB;         // the number of reinforcement groups (ground+jets) each player has called
00112                                                                                 // in this battle
00113 
00114         bool m_firstTime;                               // first time update() is called
00115 
00116         Vec3D   m_camTarget;
00117         FLOAT   m_camHeight;
00118         bool    m_showBigMiniMap;               // whether to show a big minimap center of screen or small one in corner
00119 
00120         int m_selected;
00121         int m_ctrlGroup[10];    // so you can assign units to groups by CTRL+0..9
00122 
00123         char    m_winner;                               // either 'A', 'B' or '?'
00124         BattleState *BS;
00125 
00126         list<string> m_cmdQueue;
00127         
00128         char getTeamCode(int selected);                 // get team code ('-','A','B') of specified unit (ground or air)
00129         int  getGroupAtPos2D( Vec2D pos );              // return group# or -1
00130 
00131         void inputSelectGroups();
00132         void inputSelectJets();
00133         void inputIssueGroupCommand();
00134         void inputIssueJetsCommand();
00135         void inputCtrlGroup();                          // assigning/selecting group 0..9
00136         void inputSelectByHotKey();
00137 
00138         void updateGroups();
00139         void updateJets();
00140         void updateBullets();
00141         void updateParticles();
00142         void updateDebris();
00143 
00144         void renderEnvironment();
00145         void renderGroups();
00146         void renderJets();
00147         void renderBullets();
00148         void renderParticles();
00149         void renderDebris();
00150         void renderInterface();
00151         void renderMiniMap();
00152 
00153 };
00154 //------------------------------------------------------------------------------------
00155 
00156 #endif

Generated on Wed Apr 23 05:50:14 2003 for Modern Warfare by doxygen1.3-rc2