123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445 |
- #ifndef CONTROLGUI_H
- #define CONTROLGUI_H
- /*************************************************************************************************\
- ControlGui.h : Interface for the ControlGui component. This thing holds the tac map
- and everything else on the left hand side of the screen.
- //---------------------------------------------------------------------------//
- // Copyright (C) Microsoft Corporation. All rights reserved. //
- //===========================================================================//
- \*************************************************************************************************/
- #ifndef GAMETACMAP_H
- #include "GameTacMap.h"
- #endif
- #ifndef FORCEGROUPBAR_H
- #include "ForceGroupBar.h"
- #endif
- #ifndef MOVER_H
- #include "mover.h"
- #endif
- #ifndef UTILITIES_H
- #include "Utilities.h"
- #endif
- #ifndef PAUSEWINDOW_H
- #include "PauseWindow.h"
- #endif
- #ifndef AFONT_H
- #include "aFont.h"
- #endif
- #ifndef AEDIT_H
- #include "aEdit.h"
- #endif
- #ifndef MC2movie_H
- #include "mc2movie.h"
- #endif
- #ifndef MPSTATS_H
- #include "MPStats.h"
- #endif
- class CObjective;
- class InfoWindow;
- class PauseWindow;
- //*************************************************************************************************
- #define LAST_VEHICLE MAX_VEHICLE - LARGE_AIRSTRIKE
- #define OBJECTVE_MOVE_COUNT 2
- #define RESULTS_MOVE_COUNT 3
- #define MAX_CHAT_COUNT 5
- #define RPTOTAL_CALLOUT 21185
- /**************************************************************************************************
- CLASS DESCRIPTION
- ControlGui:
- **************************************************************************************************/
- struct ButtonData
- {
- long ID;
- long helpTextHeader;
- long helpTextID;
- long textID;
- long textColors[4];
- aFont textFont;
- char fileName[32];
- long stateCoords[4][2];
- long textureWidth;
- long textureHeight;
- int fileWidth;
- int fileHeight;
- unsigned long textureHandle;
- bool textureRotated;
-
- };
- class ControlButton
- {
- public:
- gos_VERTEX location[4];
- long ID;
- ButtonData* data;
- int state;
- void render();
- void press( bool );
- void toggle();
- void disable( bool );
- bool isEnabled();
- void makeAmbiguous( bool bAmbiguous );
- void hide( bool );
- void move( float deltaX, float deltaY );
- void setColor( unsigned long newColor );
- static void makeUVs( gos_VERTEX* vertices, int State, ButtonData& data );
- static void initButtons( FitIniFile& file, long buttonCount,
- ControlButton* buttons, ButtonData* buttonData, const char* str, aFont* font = 0 );
- enum States
- {
- ENABLED = 0,
- PRESSED,
- DISABLED,
- AMBIGUOUS,
- HIDDEN
- };
- };
- class ControlGui
- {
- public:
- static ControlGui* instance;
- static long hiResOffsetX;
- static long hiResOffsetY;
- ControlGui();
- ~ControlGui();
- bool inRegion( int mouseX, int mouseY, bool bPaused );
- void render( bool bPaused );
- void update( bool bPaused, bool bLOS );
- void initTacMapBuildings( unsigned char* data, int size ){ tacMap.initBuildings( data, size ); }
- void initTacMap( unsigned char* data, int size ){ tacMap.init( data, size ); }
- void initMechs();
- void unPressAllVehicleButtons();
- void disableAllVehicleButtons();
- void addMover (MoverPtr mover);
- void removeMover (MoverPtr mover);
- int updateChat();
- void beginPause();
- void endPause();
- bool resultsDone();
- void startObjectives( bool bStart );
- bool objectivesStarted() { return renderObjectives; }
- void setInfoWndMover( Mover* pMover );
- void setVehicleCommand( bool );
- bool getVehicleCommand( );
- void playMovie( const char* fileName );
- bool isMoviePlaying();
- bool playPilotVideo( MechWarrior* pPilot, char movieCode );
- void endPilotVideo();
- bool isSelectingInfoObject();
- bool isOverTacMap();
- bool isChatting() { return bChatting; }
-
- //TUTORIAL
- bool animateTacMap (long buttonId,float timeToScroll,long numFlashes);
- bool pushButton (long buttonId);
- bool flashRPTotal (long numFlashes);
- const char* getVehicleName( long& ID );
- const char* getVehicleNameFromID (long ID);
- void swapResolutions( int newResolution );
- GameTacMap tacMap;
- ForceGroupBar forceGroupBar;
- bool mouseInVehicleStopButton;
- enum Commands
- {
- DEFAULT_RANGE = 0,
- SHORT_RANGE ,
- MED_RANGE,
- LONG_RANGE,
- JUMP_COMMAND,
- RUN_COMMAND,
- GUARD_COMMAND,
- FIRE_FROM_CURRENT_POS,
- STOP_COMMAND,
- INFO_COMMAND,
- OBJECTIVES_COMMAND,
- SAVE_COMMAND,
- TACMAP_TAB,
- INFO_TAB,
- VEHICLE_TAB,
- LAYMINES,
- REPAIR,
- SALVAGE,
- GUARDTOWER,
- CUR_RANGE, // fire from right where I AM
- LAST_COMMAND
- };
- enum VehicleCommands
- {
- LARGE_AIRSTRIKE = 100,
- GUARD_TOWER,
- SENSOR_PROBE,
- REPAIR_VEHICLE,
- PEGASUS_SCOUT,
- MINELAYER,
- RECOVERY_TEAM,
- STOP_VEHICLE,
- MAX_VEHICLE
- };
- bool isDefaultSpeed();
- void toggleDefaultSpeed( );
- void toggleJump( );
- bool getJump( );
- bool getWalk( );
- bool getRun( );
- void toggleGuard( );
- bool getGuard( );
- void setDefaultSpeed();
- void toggleHoldPosition();
- void setRange( int Range );
- void doStop();
- void toggleFireFromCurrentPos();
- bool getFireFromCurrentPos(){ return fireFromCurrentPos; }
- void setFireFromCurrentPos( bool bset ) { fireFromCurrentPos = bset; }
- bool isAddingVehicle(){ return addingVehicle; }
- bool isAddingAirstrike() { return addingArtillery; }
- bool isAddingSalvage() { return addingSalvage; }
- bool isButtonPressed( int ID ) { return getButton( ID )->state & ControlButton::PRESSED; }
- bool getMines();
- bool getSalvage();
- bool getRepair();
- bool getGuardTower();
- void switchTabs( int direction );
- void renderObjective( CObjective* pObjective, long xPos, long yPos, bool bDrawTotal );
- void renderMissionStatus( bool bRender){ renderStatusInfo = bRender; }
-
- int getCurrentRange();
- void pressInfoButton( ){ handleClick( INFO_COMMAND ); }
- bool infoButtonPressed() { return getButton( INFO_COMMAND )->state & ControlButton::PRESSED; }
- void showServerMissing();
- void pressAirstrikeButton()
- {
- for ( int i = 0; i < LAST_VEHICLE; i++ )
- {
- if (( vehicleButtons[i].ID == LARGE_AIRSTRIKE) &&
- !( vehicleButtons[i].state & ControlButton::PRESSED ))
- {
- handleVehicleClick( LARGE_AIRSTRIKE );
- }
- }
- }
- void pressLargeAirstrikeButton() { handleVehicleClick( LARGE_AIRSTRIKE ); }
- void pressSensorStrikeButton()
- {
- for ( int i = 0; i < LAST_VEHICLE; i++ )
- {
- if (( vehicleButtons[i].ID == SENSOR_PROBE) &&
- !( vehicleButtons[i].state & ControlButton::PRESSED ))
- {
- handleVehicleClick( SENSOR_PROBE );
- }
- }
- }
- void setRolloverHelpText( unsigned long textID );
- void setChatText( const char* playerName, const char* message, unsigned long backgroundColor,
- unsigned long textColor );
- void toggleChat( bool setTeamOnly );
- void eatChatKey();
- void cancelInfo();
-
- ControlButton* getButton( int ID );
- struct RectInfo
- {
- GUI_RECT rect;
- long color;
- };
- private:
- struct ChatInfo
- {
- char playerName[32];
- char message[128];
- unsigned long backgroundColor;
- unsigned long time;
- unsigned long messageLength; // number of lines
- unsigned long chatTextColor;
- };
- ChatInfo chatInfos[MAX_CHAT_COUNT]; // max five lines -- could change
- RectInfo* rectInfos;
- long rectCount;
-
- //static ButtonFile vehicleFileData[LAST_VEHICLE];
- static unsigned long RUN;
- static unsigned long WALK;
- static unsigned long GUARD;
- static unsigned long JUMP;
- ControlButton* buttons;
- ControlButton* vehicleButtons;
- static ButtonData* buttonData;
- static ButtonData* vehicleData;
- static const char* vehicleNames[5];
- static long vehicleIDs[5];
- static const char* vehiclePilots[5];
- static long vehicleCosts[LAST_VEHICLE];
- InfoWindow* infoWnd;
- PauseWindow* pauseWnd;
- StaticInfo* staticInfos;
- long staticCount;
- StaticInfo* objectiveInfos; //2nd to last one is check, last is x
- long objectiveInfoCount;
- StaticInfo* missionStatusInfos;
- long missionStatusInfoCount;
- RectInfo missionStatusRect;
- bool renderStatusInfo;
- float resultsTime;
- bool renderObjectives;
- float objectiveTime;
-
- float tabFlashTime;
- static long OBJECTIVESTOP;
- static long OBJECTIVESLEFT;
- static long OBJECTIVESSKIP;
- static long OBJECTIVESTOTALRIGHT;
- static long OBJEECTIVESHEADERSKIP;
- static long OBJECTIVESHEADERTOP;
- static long OBJECTIVEBOXX;
- static long OBJECTIVEBOXSKIP;
- static long OBJECTIVECHECKSKIP;
- static long OBJECTIVEHEADERLEFT;
- static long HELPAREA_LEFT;
- static long HELPAREA_BOTTOM;
- static long RPLEFT;
- static long RPTOP;
- static MoveInfo objectiveMoveInfo[OBJECTVE_MOVE_COUNT];
- static MoveInfo missionResultsMoveInfo[RESULTS_MOVE_COUNT];
- StaticInfo* videoInfos;
- long videoInfoCount;
- GUI_RECT videoRect;
- GUI_RECT videoTextRect;
- MC2MoviePtr bMovie;
- StaticInfo* timerInfos;
- long timerInfoCount;
- RectInfo timerRect;
- //TUTORIAL!!
- RectInfo rpCallout;
- long rpNumFlashes;
- float rpFlashTime;
- long buttonToPress;
- unsigned long curOrder;
- bool fireFromCurrentPos;
- bool addingVehicle;
- bool addingArtillery;
- bool addingSalvage;
- bool wasLayingMines;
- bool moviePlaying;
- bool twoMinWarningPlayed;
- bool thirtySecondWarningPlayed;
- bool bChatting;
- long idToUnPress;
- aFont guiFont;
- aFont helpFont;
- aFont vehicleFont;
- aFont timerFont;
- aFont missionResultsFont;
-
- aText chatEdit;
- aEdit playerNameEdit;
- aEdit personalEdit;
- void handleClick( int ID );
- void updateVehicleTab( int mouseX, int mouseY, bool bLOS );
- void renderVehicleTab();
- void RenderObjectives();
- void renderResults();
- void handleVehicleClick( int ID );
- void renderHelpText();
- void renderInfoTab();
- void renderChatText();
- void initStatics( FitIniFile& file );
- void initRects( FitIniFile& file );
- void renderPlayerStatus( float delta);
- MPStatsEntry mpStats[9];
- bool chatIsTeamOnly;
- bool bServerWarningShown;
- public:
- RectInfo *getRect (long id)
- {
- if ((id >= 0) && (id < rectCount))
- {
- return &(rectInfos[id]);
- }
- if (id == RPTOTAL_CALLOUT)
- {
- return &rpCallout;
- }
- return NULL;
- }
- };
- //*************************************************************************************************
- #endif // end of file ( ControlGui.h )
|