diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h index 2300812361..518c2f62f7 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h @@ -74,38 +74,38 @@ enum RadiusCursorType CPP_11(: Int) RADIUSCURSOR_FRIENDLY_SPECIALPOWER, RADIUSCURSOR_OFFENSIVE_SPECIALPOWER, RADIUSCURSOR_SUPERWEAPON_SCATTER_AREA, - - RADIUSCURSOR_PARTICLECANNON, + + RADIUSCURSOR_PARTICLECANNON, RADIUSCURSOR_A10STRIKE, RADIUSCURSOR_CARPETBOMB, RADIUSCURSOR_DAISYCUTTER, RADIUSCURSOR_PARADROP, - RADIUSCURSOR_SPYSATELLITE, + RADIUSCURSOR_SPYSATELLITE, RADIUSCURSOR_SPECTREGUNSHIP, RADIUSCURSOR_HELIX_NAPALM_BOMB, - RADIUSCURSOR_NUCLEARMISSILE, + RADIUSCURSOR_NUCLEARMISSILE, RADIUSCURSOR_EMPPULSE, RADIUSCURSOR_ARTILLERYBARRAGE, RADIUSCURSOR_NAPALMSTRIKE, RADIUSCURSOR_CLUSTERMINES, - RADIUSCURSOR_SCUDSTORM, + RADIUSCURSOR_SCUDSTORM, RADIUSCURSOR_ANTHRAXBOMB, - RADIUSCURSOR_AMBUSH, + RADIUSCURSOR_AMBUSH, RADIUSCURSOR_RADAR, RADIUSCURSOR_SPYDRONE, RADIUSCURSOR_FRENZY, - + RADIUSCURSOR_CLEARMINES, RADIUSCURSOR_AMBULANCE, - RADIUSCURSOR_COUNT + RADIUSCURSOR_COUNT }; #ifdef DEFINE_RADIUSCURSOR_NAMES -static const char *const TheRadiusCursorNames[] = +static const char *const TheRadiusCursorNames[] = { "NONE", "ATTACK_DAMAGE_AREA", @@ -117,34 +117,34 @@ static const char *const TheRadiusCursorNames[] = "OFFENSIVE_SPECIALPOWER", //red "SUPERWEAPON_SCATTER_AREA",//red - "PARTICLECANNON", + "PARTICLECANNON", "A10STRIKE", "CARPETBOMB", "DAISYCUTTER", "PARADROP", - "SPYSATELLITE", + "SPYSATELLITE", "SPECTREGUNSHIP", "HELIX_NAPALM_BOMB", - "NUCLEARMISSILE", + "NUCLEARMISSILE", "EMPPULSE", "ARTILLERYBARRAGE", "NAPALMSTRIKE", "CLUSTERMINES", - "SCUDSTORM", + "SCUDSTORM", "ANTHRAXBOMB", - "AMBUSH", + "AMBUSH", "RADAR", "SPYDRONE", "FRENZY", - + "CLEARMINES", "AMBULANCE", - nullptr + nullptr }; -static_assert(ARRAY_SIZE(TheRadiusCursorNames) == RADIUSCURSOR_COUNT + 1, "Incorrect array size"); +static_assert(ARRAY_SIZE(TheRadiusCursorNames) == RADIUSCURSOR_COUNT + 1, "Incorrect array size"); #endif // ------------------------------------------------------------------------------------------------ @@ -169,7 +169,7 @@ typedef std::list::const_iterator DrawableListCIt; // ------------------------------------------------------------------------------------------------ class SuperweaponInfo : public MemoryPoolObject { - MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(SuperweaponInfo, "SuperweaponInfo") + MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(SuperweaponInfo, "SuperweaponInfo") private: // not saved @@ -187,10 +187,10 @@ class SuperweaponInfo : public MemoryPoolObject Bool hiddenByScience, Bool ready, Bool evaReadyPlayed, - const AsciiString& superweaponNormalFont, - Int superweaponNormalPointSize, + const AsciiString& superweaponNormalFont, + Int superweaponNormalPointSize, Bool superweaponNormalBold, - Color c, + Color c, const SpecialPowerTemplate* spt ); @@ -207,7 +207,7 @@ class SuperweaponInfo : public MemoryPoolObject UnsignedInt m_timestamp; ///< seconds shown in display string Bool m_hiddenByScript; Bool m_hiddenByScience; - Bool m_ready; ///< Stores if we were ready last draw, since readiness can change without time changing + Bool m_ready; ///< Stores if we were ready last draw, since readiness can change without time changing Bool m_evaReadyPlayed; ///< Stores if Eva announced superweapon is ready // not saved, but public Bool m_forceUpdateText; @@ -222,7 +222,7 @@ typedef std::map SuperweaponMap; // Popup message box class PopupMessageData : public MemoryPoolObject { - MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(PopupMessageData, "PopupMessageData") + MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(PopupMessageData, "PopupMessageData") public: UnicodeString message; Int x; @@ -238,7 +238,7 @@ EMPTY_DTOR(PopupMessageData) // ------------------------------------------------------------------------------------------------ class NamedTimerInfo : public MemoryPoolObject { - MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(NamedTimerInfo, "NamedTimerInfo") + MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(NamedTimerInfo, "NamedTimerInfo") public: AsciiString m_timerName; ///< Timer name, needed on Load to reconstruct Map. UnicodeString timerText; ///< timer text @@ -260,7 +260,7 @@ enum {MAX_SUBTITLE_LINES = 4}; ///< The maximum number of lines a subtitle // Floating Text Data class FloatingTextData : public MemoryPoolObject { - MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(FloatingTextData, "FloatingTextData") + MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(FloatingTextData, "FloatingTextData") public: FloatingTextData(void); //~FloatingTextData(void); @@ -276,7 +276,7 @@ class FloatingTextData : public MemoryPoolObject typedef std::list FloatingTextList; typedef FloatingTextList::iterator FloatingTextListIt; -enum +enum { DEFAULT_FLOATING_TEXT_TIMEOUT = LOGICFRAMES_PER_SECOND/3, }; @@ -316,17 +316,17 @@ typedef WorldAnimationList::iterator WorldAnimationListIterator; // ------------------------------------------------------------------------------------------------ /** Basic functionality common to all in-game user interfaces */ -// ------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ class InGameUI : public SubsystemInterface, public Snapshot { - + friend class Drawable; // for selection/deselection transactions - -protected: - - typedef std::list ObjectList; - typedef std::list::iterator ObjectListIt; - + +protected: + + typedef std::list ObjectList; + typedef std::list::iterator ObjectListIt; + public: // *************************************************************************************** enum SelectionRules @@ -366,7 +366,7 @@ friend class Drawable; // for selection/deselection transactions void refreshObserverStatsResources(); void toggleObserverStats() { m_observerStatsHidden = !m_observerStatsHidden; } // Toggle visibility of the observer stats overlay - + // Inherited from subsystem interface ----------------------------------------------------------- virtual void init( void ); ///< Initialize the in-game user interface virtual void update( void ); ///< Update the UI by calling preDraw(), draw(), and postDraw() @@ -386,20 +386,20 @@ friend class Drawable; // for selection/deselection transactions #else virtual void messageColor(const RGBColor* rgbColor, UnicodeString format, ...); ///< display a colored message to the user #endif - virtual void messageNoFormat( const UnicodeString& message ); ///< display a message to the user - virtual void messageNoFormat( const RGBColor *rgbColor, const UnicodeString& message ); ///< display a colored message to the user + virtual void messageNoFormat( const UnicodeString& message ); ///< display a message to the user + virtual void messageNoFormat( const RGBColor *rgbColor, const UnicodeString& message ); ///< display a colored message to the user virtual void message( UnicodeString format, ... ); ///< display a message to the user virtual void message( AsciiString stringManagerLabel, ... );///< display a message to the user virtual void toggleMessages( void ) { m_messagesOn = 1 - m_messagesOn; } ///< toggle messages on/off virtual Bool isMessagesOn( void ) { return m_messagesOn; } ///< are the display messages on void freeMessageResources( void ); ///< free resources for the ui messages - void freeCustomUiResources( void ); ///< free resources for custom ui elements + void freeCustomUiResources( void ); ///< free resources for custom ui elements Color getMessageColor(Bool altColor) { return (altColor)?m_messageColor2:m_messageColor1; } - + // interface for military style messages virtual void militarySubtitle( const AsciiString& label, Int duration ); // time in milliseconds virtual void removeMilitarySubtitle( void ); - + // for can't build messages virtual void displayCantBuildMessage( LegalBuildCode lbc ); ///< display message to use as to why they can't build here @@ -413,7 +413,7 @@ friend class Drawable; // for selection/deselection transactions virtual void createMouseoverHint( const GameMessage *msg ); ///< An object is mouse hovered over, start hint if any virtual void createCommandHint( const GameMessage *msg ); ///< Used by HintSpy. Someone is selected so generate the right Cursor for the potential action virtual void createGarrisonHint( const GameMessage *msg ); ///< A garrison command has occurred, start graphical "hint" - + virtual void addSuperweapon(Int playerIndex, const AsciiString& powerName, ObjectID id, const SpecialPowerTemplate *powerTemplate); virtual Bool removeSuperweapon(Int playerIndex, const AsciiString& powerName, ObjectID id, const SpecialPowerTemplate *powerTemplate); virtual void objectChangedTeam(const Object *obj, Int oldPlayerIndex, Int newPlayerIndex); // notification for superweapons, etc @@ -462,14 +462,14 @@ friend class Drawable; // for selection/deselection transactions virtual const DrawableList *getAllSelectedDrawables( void ) const; ///< Return the list of all the currently selected Drawable IDs. virtual const DrawableList *getAllSelectedLocalDrawables( void ); ///< Return the list of all the currently selected Drawable IDs owned by the current player. virtual Drawable *getFirstSelectedDrawable( void ); ///< get the first selected drawable (if any) - virtual DrawableID getSoloNexusSelectedDrawableID( void ) { return m_soloNexusSelectedDrawableID; } ///< Return the one drawable of the nexus if only 1 angry mob is selected + virtual DrawableID getSoloNexusSelectedDrawableID( void ) { return m_soloNexusSelectedDrawableID; } ///< Return the one drawable of the nexus if only 1 angry mob is selected virtual Bool isDrawableSelected( DrawableID idToCheck ) const; ///< Return true if the selected ID is in the drawable list - virtual Bool areAllObjectsSelected(const std::vector& objectsToCheck) const; ///< Return true if all of the selected objects are in the drawable list - virtual Bool isAnySelectedKindOf( KindOfType kindOf ) const; ///< is any selected object a kind of + virtual Bool areAllObjectsSelected(const std::vector& objectsToCheck) const; ///< Return true if all of the selected objects are in the drawable list + virtual Bool isAnySelectedKindOf( KindOfType kindOf ) const; ///< is any selected object a kind of virtual Bool isAllSelectedKindOf( KindOfType kindOf ) const; ///< are all selected objects a kind of virtual void setRadiusCursor(RadiusCursorType r, const SpecialPowerTemplate* sp, WeaponSlotType wslot); - virtual void setRadiusCursorNone() { setRadiusCursor(RADIUSCURSOR_NONE, nullptr, PRIMARY_WEAPON); } + virtual void setRadiusCursorNone() { setRadiusCursor(RADIUSCURSOR_NONE, nullptr, PRIMARY_WEAPON); } virtual void setInputEnabled( Bool enable ); ///< Set the input enabled or disabled virtual Bool getInputEnabled( void ) { return m_inputEnabled; } ///< Get the current input status @@ -479,21 +479,21 @@ friend class Drawable; // for selection/deselection transactions virtual void preDraw( void ); ///< Logic which needs to occur before the UI renders virtual void draw( void ) = 0; ///< Render the in-game user interface virtual void postDraw( void ); ///< Logic which needs to occur after the UI renders - virtual void postWindowDraw( void ); ///< Logic which needs to occur after the WindowManager has repainted the menus + virtual void postWindowDraw( void ); ///< Logic which needs to occur after the WindowManager has repainted the menus - /// Ingame video playback + /// Ingame video playback virtual void playMovie( const AsciiString& movieName ); virtual void stopMovie( void ); virtual VideoBuffer* videoBuffer( void ); - /// Ingame cameo video playback + /// Ingame cameo video playback virtual void playCameoMovie( const AsciiString& movieName ); virtual void stopCameoMovie( void ); virtual VideoBuffer* cameoVideoBuffer( void ); - // mouse over information + // mouse over information virtual DrawableID getMousedOverDrawableID( void ) const; ///< Get drawble ID of drawable under cursor - + /// Set the ingame flag as to if we have the Quit menu up or not virtual void setQuitMenuVisible( Bool t ) { m_isQuitMenuVisible = t; } virtual Bool isQuitMenuVisible( void ) const { return m_isQuitMenuVisible; } @@ -519,11 +519,11 @@ friend class Drawable; // for selection/deselection transactions virtual Int selectMatchingAcrossMap(); ///< selects matching units across map virtual Int selectMatchingAcrossRegion( IRegion2D *region ); // -1 = no locally-owned selection, 0+ = # of units selected - virtual Int selectAllUnitsByType(KindOfMaskType mustBeSet, KindOfMaskType mustBeClear); - virtual Int selectAllUnitsByTypeAcrossScreen(KindOfMaskType mustBeSet, KindOfMaskType mustBeClear); - virtual Int selectAllUnitsByTypeAcrossMap(KindOfMaskType mustBeSet, KindOfMaskType mustBeClear); - virtual Int selectAllUnitsByTypeAcrossRegion( IRegion2D *region, KindOfMaskType mustBeSet, KindOfMaskType mustBeClear ); - + virtual Int selectAllUnitsByType(KindOfMaskType mustBeSet, KindOfMaskType mustBeClear); + virtual Int selectAllUnitsByTypeAcrossScreen(KindOfMaskType mustBeSet, KindOfMaskType mustBeClear); + virtual Int selectAllUnitsByTypeAcrossMap(KindOfMaskType mustBeSet, KindOfMaskType mustBeClear); + virtual Int selectAllUnitsByTypeAcrossRegion( IRegion2D *region, KindOfMaskType mustBeSet, KindOfMaskType mustBeClear ); + virtual void buildRegion( const ICoord2D *anchor, const ICoord2D *dest, IRegion2D *region ); ///< builds a region around the specified coordinates virtual Bool getDisplayedMaxWarning( void ) { return m_displayedMaxWarning; } @@ -538,7 +538,7 @@ friend class Drawable; // for selection/deselection transactions Bool isDrawableCaptionBold( void ) { return m_drawableCaptionBold; } Color getDrawableCaptionColor( void ) { return m_drawableCaptionColor; } - Bool shouldMoveRMBScrollAnchor( void ) { return m_moveRMBScrollAnchor; } + Bool shouldMoveRMBScrollAnchor( void ) { return m_moveRMBScrollAnchor; } Bool isClientQuiet( void ) const { return m_clientQuiet; } Bool isInWaypointMode( void ) const { return m_waypointMode; } @@ -551,11 +551,11 @@ friend class Drawable; // for selection/deselection transactions void setForceMoveMode( Bool enabled ) { m_forceMoveToMode = enabled; } void setForceAttackMode( Bool enabled ) { m_forceAttackMode = enabled; } void setPreferSelectionMode( Bool enabled ) { m_preferSelection = enabled; } - + void toggleAttackMoveToMode( void ) { m_attackMoveToMode = !m_attackMoveToMode; } Bool isInAttackMoveToMode( void ) const { return m_attackMoveToMode; } void clearAttackMoveToMode( void ) { m_attackMoveToMode = FALSE; } - + void setCameraRotateLeft( Bool set ) { m_cameraRotatingLeft = set; } void setCameraRotateRight( Bool set ) { m_cameraRotatingRight = set; } void setCameraZoomIn( Bool set ) { m_cameraZoomingIn = set; } @@ -571,14 +571,14 @@ friend class Drawable; // for selection/deselection transactions virtual void addIdleWorker( Object *obj ); virtual void removeIdleWorker( Object *obj, Int playerNumber ); virtual void selectNextIdleWorker( void ); - static std::vector getUniqueIdleWorkers(const ObjectList& idleWorkers); + static std::vector getUniqueIdleWorkers(const ObjectList& idleWorkers); virtual void recreateControlBar( void ); - virtual void refreshCustomUiResources( void ); - virtual void refreshNetworkLatencyResources(void); - virtual void refreshRenderFpsResources(void); - virtual void refreshSystemTimeResources( void ); - virtual void refreshGameTimeResources( void ); + virtual void refreshCustomUiResources( void ); + virtual void refreshNetworkLatencyResources(void); + virtual void refreshRenderFpsResources(void); + virtual void refreshSystemTimeResources( void ); + virtual void refreshGameTimeResources( void ); virtual void disableTooltipsUntil(UnsignedInt frameNum); virtual void clearTooltipsDisabled(); @@ -599,14 +599,14 @@ friend class Drawable; // for selection/deselection transactions virtual void resetIdleWorker( void ); - void updateRenderFpsString(); - void drawNetworkLatency(Int &x, Int &y); - void drawRenderFps(Int &x, Int &y); - void drawSystemTime(Int &x, Int &y); - void drawGameTime(); - void drawObserverStats(Int &x, Int &y); - Bool m_observerStatsHidden = false; // hide/show observer overlay - + void updateRenderFpsString(); + void drawNetworkLatency(Int &x, Int &y); + void drawRenderFps(Int &x, Int &y); + void drawSystemTime(Int &x, Int &y); + void drawGameTime(); + void drawObserverStats(Int &x, Int &y); + Bool m_observerStatsHidden = false; // hide/show observer overlay + public: void registerWindowLayout(WindowLayout *layout); // register a layout for updates void unregisterWindowLayout(WindowLayout *layout); // stop updates for this layout @@ -614,16 +614,16 @@ friend class Drawable; // for selection/deselection transactions void triggerDoubleClickAttackMoveGuardHint( void ); - + public: // World 2D animation methods - void addWorldAnimation( Anim2DTemplate *animTemplate, + void addWorldAnimation( Anim2DTemplate *animTemplate, const Coord3D *pos, WorldAnimationOptions options, Real durationInSeconds, Real zRisePerSecond ); -#if defined(RTS_DEBUG) +#if defined(RTS_DEBUG) virtual void DEBUG_addFloatingText(const AsciiString& text,const Coord3D * pos, Color color); #endif @@ -633,7 +633,7 @@ friend class Drawable; // for selection/deselection transactions virtual void xfer( Xfer *xfer ); virtual void loadPostProcess( void ); -protected: +protected: // ---------------------------------------------------------------------------------------------- // Protected Types ------------------------------------------------------------------------------ @@ -649,7 +649,7 @@ friend class Drawable; // for selection/deselection transactions }; // mouse mode interface - enum MouseMode + enum MouseMode { MOUSEMODE_DEFAULT = 0, MOUSEMODE_BUILD_PLACE, @@ -665,6 +665,7 @@ friend class Drawable; // for selection/deselection transactions UnsignedInt money; UnsignedInt cpm; Int xp; + Int rank; Real kd; Int sp; Int powerValue; @@ -696,7 +697,7 @@ friend class Drawable; // for selection/deselection transactions struct MilitarySubtitleData { UnicodeString subtitle; ///< The complete subtitle to be drawn, each line is separated by L"\n" - UnsignedInt index; ///< the current index that we are at through the subtitle + UnsignedInt index; ///< the current index that we are at through the subtitle ICoord2D position; ///< Where on the screen the subtitle should be drawn DisplayString *displayStrings[MAX_SUBTITLE_LINES]; ///< We'll only allow MAX_SUBTITLE_LINES worth of display strings UnsignedInt currentDisplayString; ///< contains the current display string we're on. (also lets us know the last display string allocated @@ -719,26 +720,26 @@ friend class Drawable; // for selection/deselection transactions void incrementSelectCount( void ) { ++m_selectCount; } ///< Increase by one the running total of "selected" drawables void decrementSelectCount( void ) { --m_selectCount; } ///< Decrease by one the running total of "selected" drawables virtual View *createView( void ) = 0; ///< Factory for Views - void evaluateSoloNexus( Drawable *newlyAddedDrawable = nullptr ); + void evaluateSoloNexus( Drawable *newlyAddedDrawable = nullptr ); /// expire a hint from of the specified type at the hint index void expireHint( HintType type, UnsignedInt hintIndex ); - void createControlBar( void ); ///< create the control bar user interface - void createReplayControl( void ); ///< create the replay control window - - void setMouseCursor(Mouse::MouseCursor c); - - -#if defined(GENERALS_ONLINE) - void addMessageText( const UnicodeString& formattedMessage, const RGBColor *rgbColor = nullptr, bool bIsChatMsg = false ); ///< internal workhorse for adding plain text for messages -#else void addMessageText( const UnicodeString& formattedMessage, const RGBColor *rgbColor = nullptr ); ///< internal workhorse for adding plain text for messages -#endif - void removeMessageAtIndex( Int i ); ///< remove the message at index i - - void updateFloatingText( void ); ///< Update function to move our floating text - void drawFloatingText( void ); ///< Draw all our floating text - void clearFloatingText( void ); ///< clear the floating text list + void createControlBar( void ); ///< create the control bar user interface + void createReplayControl( void ); ///< create the replay control window + + void setMouseCursor(Mouse::MouseCursor c); + + +#if defined(GENERALS_ONLINE) + void addMessageText( const UnicodeString& formattedMessage, const RGBColor *rgbColor = nullptr, bool bIsChatMsg = false ); ///< internal workhorse for adding plain text for messages +#else void addMessageText( const UnicodeString& formattedMessage, const RGBColor *rgbColor = nullptr ); ///< internal workhorse for adding plain text for messages +#endif + void removeMessageAtIndex( Int i ); ///< remove the message at index i + + void updateFloatingText( void ); ///< Update function to move our floating text + void drawFloatingText( void ); ///< Draw all our floating text + void clearFloatingText( void ); ///< clear the floating text list void clearWorldAnimations( void ); ///< delete all world animations void updateAndDrawWorldAnimations( void ); ///< update and draw visible world animations @@ -778,9 +779,9 @@ friend class Drawable; // for selection/deselection transactions Int m_maxSelectCount; ///< Max number of objects to select UnsignedInt m_frameSelectionChanged; ///< Frame when the selection last changed. - Int m_duringDoubleClickAttackMoveGuardHintTimer; ///< Frames left to draw the doubleClickFeedbackTimer - Coord3D m_duringDoubleClickAttackMoveGuardHintStashedPosition; - + Int m_duringDoubleClickAttackMoveGuardHintTimer; ///< Frames left to draw the doubleClickFeedbackTimer + Coord3D m_duringDoubleClickAttackMoveGuardHintStashedPosition; + // Video playback data VideoBuffer* m_videoBuffer; ///< video playback buffer VideoStreamInterface* m_videoStream; ///< Video stream; @@ -789,63 +790,63 @@ friend class Drawable; // for selection/deselection transactions VideoBuffer* m_cameoVideoBuffer;///< video playback buffer VideoStreamInterface* m_cameoVideoStream;///< Video stream; - // Network Latency Counter - DisplayString * m_networkLatencyString; - AsciiString m_networkLatencyFont; - Int m_networkLatencyPointSize; - Bool m_networkLatencyBold; - Coord2D m_networkLatencyPosition; - Color m_networkLatencyColor; - Color m_networkLatencyDropColor; - UnsignedInt m_lastNetworkLatencyFrames; - - // Render FPS Counter - DisplayString * m_renderFpsString; - DisplayString * m_renderFpsLimitString; - AsciiString m_renderFpsFont; - Int m_renderFpsPointSize; - Bool m_renderFpsBold; - Coord2D m_renderFpsPosition; - Color m_renderFpsColor; - Color m_renderFpsLimitColor; - Color m_renderFpsDropColor; - UnsignedInt m_renderFpsRefreshMs; - UnsignedInt m_lastRenderFps; - UnsignedInt m_lastRenderFpsLimit; - UnsignedInt m_lastRenderFpsUpdateMs; - - // System Time - DisplayString * m_systemTimeString; - AsciiString m_systemTimeFont; - Int m_systemTimePointSize; - Bool m_systemTimeBold; - Coord2D m_systemTimePosition; - Color m_systemTimeColor; - Color m_systemTimeDropColor; - - // Game Time - DisplayString * m_gameTimeString; - DisplayString * m_gameTimeFrameString; - AsciiString m_gameTimeFont; - Int m_gameTimePointSize; - Bool m_gameTimeBold; - Coord2D m_gameTimePosition; - Color m_gameTimeColor; - Color m_gameTimeDropColor; - + // Network Latency Counter + DisplayString * m_networkLatencyString; + AsciiString m_networkLatencyFont; + Int m_networkLatencyPointSize; + Bool m_networkLatencyBold; + Coord2D m_networkLatencyPosition; + Color m_networkLatencyColor; + Color m_networkLatencyDropColor; + UnsignedInt m_lastNetworkLatencyFrames; + + // Render FPS Counter + DisplayString * m_renderFpsString; + DisplayString * m_renderFpsLimitString; + AsciiString m_renderFpsFont; + Int m_renderFpsPointSize; + Bool m_renderFpsBold; + Coord2D m_renderFpsPosition; + Color m_renderFpsColor; + Color m_renderFpsLimitColor; + Color m_renderFpsDropColor; + UnsignedInt m_renderFpsRefreshMs; + UnsignedInt m_lastRenderFps; + UnsignedInt m_lastRenderFpsLimit; + UnsignedInt m_lastRenderFpsUpdateMs; + + // System Time + DisplayString * m_systemTimeString; + AsciiString m_systemTimeFont; + Int m_systemTimePointSize; + Bool m_systemTimeBold; + Coord2D m_systemTimePosition; + Color m_systemTimeColor; + Color m_systemTimeDropColor; + + // Game Time + DisplayString * m_gameTimeString; + DisplayString * m_gameTimeFrameString; + AsciiString m_gameTimeFont; + Int m_gameTimePointSize; + Bool m_gameTimeBold; + Coord2D m_gameTimePosition; + Color m_gameTimeColor; + Color m_gameTimeDropColor; + // Observer Stats Overlay DisplayString* m_observerStatsString; AsciiString m_observerStatsFont; Int m_observerStatsPointSize; Bool m_observerStatsBold; Coord2D m_observerStatsPosition; - Int m_observerStatsLineStep; - -#if defined(GENERALS_ONLINE) + Int m_observerStatsLineStep; + +#if defined(GENERALS_ONLINE) Color m_colorGood; - Color m_colorBad; -#endif - + Color m_colorBad; +#endif + // message data UIMessage m_uiMessages[ MAX_UI_MESSAGES ];/**< messages to display to the user, the array is organized with newer messages at @@ -854,7 +855,7 @@ friend class Drawable; // for selection/deselection transactions SuperweaponMap m_superweapons[MAX_PLAYER_COUNT]; Coord2D m_superweaponPosition; Real m_superweaponFlashDuration; - + // superweapon timer font info AsciiString m_superweaponNormalFont; Int m_superweaponNormalPointSize; @@ -937,22 +938,22 @@ friend class Drawable; // for selection/deselection transactions PopupMessageData * m_popupMessageData; Color m_popupMessageColor; - + Bool m_waypointMode; ///< are we in waypoint plotting mode? Bool m_forceAttackMode; ///< are we in force attack mode? Bool m_forceMoveToMode; ///< are we in force move mode? Bool m_attackMoveToMode; ///< are we in attack move mode? Bool m_preferSelection; ///< the shift key has been depressed. - Bool m_cameraRotatingLeft; + Bool m_cameraRotatingLeft; Bool m_cameraRotatingRight; Bool m_cameraZoomingIn; Bool m_cameraTrackingDrawable; Bool m_cameraZoomingOut; - + Bool m_drawRMBScrollAnchor; Bool m_moveRMBScrollAnchor; - Bool m_clientQuiet; ///< When the user clicks exit,restart, etc. this is set true + Bool m_clientQuiet; ///< When the user clicks exit,restart, etc. this is set true ///< to skip some client sounds/fx during shutdown // World Animation Data @@ -966,8 +967,8 @@ friend class Drawable; // for selection/deselection transactions DrawableID m_soloNexusSelectedDrawableID; ///< The drawable of the nexus, if only one angry mob is selected, otherwise, null #if defined(GENERALS_ONLINE) - int m_lastFPS = -1; - int m_currentFPS = -1; + int m_lastFPS = -1; + int m_currentFPS = -1; int64_t lastFPSUpdate = -1; #endif @@ -981,3 +982,4 @@ friend class Drawable; // for selection/deselection transactions // the singleton extern InGameUI *TheInGameUI; + diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp index b38d08ddf6..1b4bf12e82 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -141,9 +141,9 @@ static UnicodeString formatIncomeValue(UnsignedInt cashPerMin) //------------------------------------------------------------------------------------------------- /// The InGameUI singleton instance. -InGameUI *TheInGameUI = nullptr; +InGameUI *TheInGameUI = nullptr; -GameWindow *m_replayWindow = nullptr; +GameWindow *m_replayWindow = nullptr; // ------------------------------------------------------------------------------------------------ struct KindOfSelectionData @@ -314,8 +314,8 @@ SuperweaponInfo::SuperweaponInfo( m_ready(ready), m_evaReadyPlayed( evaReadyPlayed ), m_forceUpdateText(false), - m_nameDisplayString(nullptr), - m_timeDisplayString(nullptr), + m_nameDisplayString(nullptr), + m_timeDisplayString(nullptr), m_color(c), m_powerTemplate(spt) { @@ -336,11 +336,11 @@ SuperweaponInfo::~SuperweaponInfo() { if (m_nameDisplayString) TheDisplayStringManager->freeDisplayString( m_nameDisplayString ); - m_nameDisplayString = nullptr; + m_nameDisplayString = nullptr; if (m_timeDisplayString) TheDisplayStringManager->freeDisplayString( m_timeDisplayString ); - m_timeDisplayString = nullptr; + m_timeDisplayString = nullptr; } // ------------------------------------------------------------------------------------------------ @@ -503,7 +503,7 @@ void InGameUI::xfer( Xfer *xfer ) AsciiString templateName; xfer->xferAsciiString(&templateName); const SpecialPowerTemplate* powerTemplate = TheSpecialPowerStore->findSpecialPowerTemplate(templateName); - if (powerTemplate == nullptr) + if (powerTemplate == nullptr) { DEBUG_CRASH(("power %s not found",templateName.str())); throw INI_INVALID_DATA; @@ -532,7 +532,7 @@ void InGameUI::xfer( Xfer *xfer ) // srj sez: due to order-of-operation stuff, sometimes these will already exist, // sometimes not. not sure why. so handle both cases. SuperweaponInfo* swInfo = findSWInfo(playerIndex, powerName, id, powerTemplate); - if (swInfo == nullptr) + if (swInfo == nullptr) { const Player* player = ThePlayerList->getNthPlayer(playerIndex); swInfo = newInstance(SuperweaponInfo)( @@ -602,19 +602,19 @@ SuperweaponInfo* InGameUI::findSWInfo(Int playerIndex, const AsciiString& powerN } } } - return nullptr; + return nullptr; } // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ void InGameUI::addSuperweapon(Int playerIndex, const AsciiString& powerName, ObjectID id, const SpecialPowerTemplate *powerTemplate) { - if (powerTemplate == nullptr) + if (powerTemplate == nullptr) return; // srj sez: don't allow adding the same superweapon more than once. it can happen. not sure how. (srj) SuperweaponInfo* swInfo = findSWInfo(playerIndex, powerName, id, powerTemplate); - if (swInfo != nullptr) + if (swInfo != nullptr) return; const Player* player = ThePlayerList->getNthPlayer(playerIndex); @@ -813,135 +813,135 @@ void InGameUI::showNamedTimerDisplay( Bool show ) //------------------------------------------------------------------------------------------------- const FieldParse InGameUI::s_fieldParseTable[] = { - { "MaxSelectionSize", INI::parseInt, nullptr, offsetof( InGameUI, m_maxSelectCount ) }, - - { "MessageColor1", INI::parseColorInt, nullptr, offsetof( InGameUI, m_messageColor1 ) }, - { "MessageColor2", INI::parseColorInt, nullptr, offsetof( InGameUI, m_messageColor2 ) }, - { "MessagePosition", INI::parseICoord2D, nullptr, offsetof( InGameUI, m_messagePosition ) }, - { "MessageFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_messageFont ) }, - { "MessagePointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_messagePointSize ) }, - { "MessageBold", INI::parseBool, nullptr, offsetof( InGameUI, m_messageBold ) }, - { "MessageDelayMS", INI::parseInt, nullptr, offsetof( InGameUI, m_messageDelayMS ) }, - - { "MilitaryCaptionColor", INI::parseRGBAColorInt, nullptr, offsetof( InGameUI, m_militaryCaptionColor ) }, - { "MilitaryCaptionPosition", INI::parseICoord2D, nullptr, offsetof( InGameUI, m_militaryCaptionPosition ) }, - - { "MilitaryCaptionTitleFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_militaryCaptionTitleFont ) }, - { "MilitaryCaptionTitlePointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_militaryCaptionTitlePointSize ) }, - { "MilitaryCaptionTitleBold", INI::parseBool, nullptr, offsetof( InGameUI, m_militaryCaptionTitleBold ) }, - - { "MilitaryCaptionFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_militaryCaptionFont ) }, - { "MilitaryCaptionPointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_militaryCaptionPointSize ) }, - { "MilitaryCaptionBold", INI::parseBool, nullptr, offsetof( InGameUI, m_militaryCaptionBold ) }, - - { "MilitaryCaptionRandomizeTyping", INI::parseBool, nullptr, offsetof( InGameUI, m_militaryCaptionRandomizeTyping ) }, - { "MilitaryCaptionSpeed", INI::parseInt, nullptr, offsetof( InGameUI, m_militaryCaptionSpeed ) }, - - { "MilitaryCaptionPosition", INI::parseICoord2D, nullptr, offsetof( InGameUI, m_militaryCaptionPosition ) }, - - { "SuperweaponCountdownPosition", INI::parseCoord2D, nullptr, offsetof( InGameUI, m_superweaponPosition ) }, - { "SuperweaponCountdownFlashDuration", INI::parseDurationReal, nullptr, offsetof( InGameUI, m_superweaponFlashDuration ) }, - { "SuperweaponCountdownFlashColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_superweaponFlashColor ) }, - - { "SuperweaponCountdownNormalFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_superweaponNormalFont ) }, - { "SuperweaponCountdownNormalPointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_superweaponNormalPointSize ) }, - { "SuperweaponCountdownNormalBold", INI::parseBool, nullptr, offsetof( InGameUI, m_superweaponNormalBold ) }, - - { "SuperweaponCountdownReadyFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_superweaponReadyFont ) }, - { "SuperweaponCountdownReadyPointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_superweaponReadyPointSize ) }, - { "SuperweaponCountdownReadyBold", INI::parseBool, nullptr, offsetof( InGameUI, m_superweaponReadyBold ) }, - - { "NamedTimerCountdownPosition", INI::parseCoord2D, nullptr, offsetof( InGameUI, m_namedTimerPosition ) }, - { "NamedTimerCountdownFlashDuration", INI::parseDurationReal, nullptr, offsetof( InGameUI, m_namedTimerFlashDuration ) }, - { "NamedTimerCountdownFlashColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_namedTimerFlashColor ) }, - - { "NamedTimerCountdownNormalFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_namedTimerNormalFont ) }, - { "NamedTimerCountdownNormalPointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_namedTimerNormalPointSize ) }, - { "NamedTimerCountdownNormalBold", INI::parseBool, nullptr, offsetof( InGameUI, m_namedTimerNormalBold ) }, - { "NamedTimerCountdownNormalColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_namedTimerNormalColor ) }, - - { "NamedTimerCountdownReadyFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_namedTimerReadyFont ) }, - { "NamedTimerCountdownReadyPointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_namedTimerReadyPointSize ) }, - { "NamedTimerCountdownReadyBold", INI::parseBool, nullptr, offsetof( InGameUI, m_namedTimerReadyBold ) }, - { "NamedTimerCountdownReadyColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_namedTimerReadyColor ) }, - - { "FloatingTextTimeOut", INI::parseDurationUnsignedInt, nullptr, offsetof( InGameUI, m_floatingTextTimeOut ) }, - { "FloatingTextMoveUpSpeed", INI::parseVelocityReal, nullptr, offsetof( InGameUI, m_floatingTextMoveUpSpeed ) }, - { "FloatingTextVanishRate", INI::parseVelocityReal, nullptr, offsetof( InGameUI, m_floatingTextMoveVanishRate ) }, - - { "PopupMessageColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_popupMessageColor ) }, - - { "DrawableCaptionFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_drawableCaptionFont ) }, - { "DrawableCaptionPointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_drawableCaptionPointSize ) }, - { "DrawableCaptionBold", INI::parseBool, nullptr, offsetof( InGameUI, m_drawableCaptionBold ) }, - { "DrawableCaptionColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_drawableCaptionColor ) }, - - { "DrawRMBScrollAnchor", INI::parseBool, nullptr, offsetof( InGameUI, m_drawRMBScrollAnchor ) }, - { "MoveRMBScrollAnchor", INI::parseBool, nullptr, offsetof( InGameUI, m_moveRMBScrollAnchor ) }, - - { "AttackDamageAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_ATTACK_DAMAGE_AREA] ) }, - { "AttackScatterAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_ATTACK_SCATTER_AREA] ) }, - { "AttackContinueAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_ATTACK_CONTINUE_AREA] ) }, - { "FriendlySpecialPowerRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_FRIENDLY_SPECIALPOWER] ) }, - { "OffensiveSpecialPowerRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_OFFENSIVE_SPECIALPOWER] ) }, - { "SuperweaponScatterAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_SUPERWEAPON_SCATTER_AREA] ) }, - - { "GuardAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_GUARD_AREA] ) }, - { "EmergencyRepairRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_EMERGENCY_REPAIR] ) }, - - { "ParticleCannonRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_PARTICLECANNON] ) }, - { "A10StrikeRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_A10STRIKE] ) }, - { "CarpetBombRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_CARPETBOMB] ) }, - { "DaisyCutterRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_DAISYCUTTER] ) }, - { "ParadropRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_PARADROP] ) }, - { "SpySatelliteRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_SPYSATELLITE] ) }, - { "SpectreGunshipRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_SPECTREGUNSHIP] ) }, - { "HelixNapalmBombRadiusCursor",RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_HELIX_NAPALM_BOMB] ) }, - - { "NuclearMissileRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_NUCLEARMISSILE] ) }, - { "EMPPulseRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_EMPPULSE] ) }, - { "ArtilleryRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_ARTILLERYBARRAGE] ) }, - { "FrenzyRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_FRENZY] ) }, - { "NapalmStrikeRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_NAPALMSTRIKE] ) }, - { "ClusterMinesRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_CLUSTERMINES] ) }, - - { "ScudStormRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_SCUDSTORM] ) }, - { "AnthraxBombRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_ANTHRAXBOMB] ) }, - { "AmbushRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_AMBUSH] ) }, - { "RadarRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_RADAR] ) }, - { "SpyDroneRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_SPYDRONE] ) }, - - { "ClearMinesRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_CLEARMINES] ) }, - { "AmbulanceRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_AMBULANCE] ) }, + { "MaxSelectionSize", INI::parseInt, nullptr, offsetof( InGameUI, m_maxSelectCount ) }, + + { "MessageColor1", INI::parseColorInt, nullptr, offsetof( InGameUI, m_messageColor1 ) }, + { "MessageColor2", INI::parseColorInt, nullptr, offsetof( InGameUI, m_messageColor2 ) }, + { "MessagePosition", INI::parseICoord2D, nullptr, offsetof( InGameUI, m_messagePosition ) }, + { "MessageFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_messageFont ) }, + { "MessagePointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_messagePointSize ) }, + { "MessageBold", INI::parseBool, nullptr, offsetof( InGameUI, m_messageBold ) }, + { "MessageDelayMS", INI::parseInt, nullptr, offsetof( InGameUI, m_messageDelayMS ) }, + + { "MilitaryCaptionColor", INI::parseRGBAColorInt, nullptr, offsetof( InGameUI, m_militaryCaptionColor ) }, + { "MilitaryCaptionPosition", INI::parseICoord2D, nullptr, offsetof( InGameUI, m_militaryCaptionPosition ) }, + + { "MilitaryCaptionTitleFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_militaryCaptionTitleFont ) }, + { "MilitaryCaptionTitlePointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_militaryCaptionTitlePointSize ) }, + { "MilitaryCaptionTitleBold", INI::parseBool, nullptr, offsetof( InGameUI, m_militaryCaptionTitleBold ) }, + + { "MilitaryCaptionFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_militaryCaptionFont ) }, + { "MilitaryCaptionPointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_militaryCaptionPointSize ) }, + { "MilitaryCaptionBold", INI::parseBool, nullptr, offsetof( InGameUI, m_militaryCaptionBold ) }, + + { "MilitaryCaptionRandomizeTyping", INI::parseBool, nullptr, offsetof( InGameUI, m_militaryCaptionRandomizeTyping ) }, + { "MilitaryCaptionSpeed", INI::parseInt, nullptr, offsetof( InGameUI, m_militaryCaptionSpeed ) }, + + { "MilitaryCaptionPosition", INI::parseICoord2D, nullptr, offsetof( InGameUI, m_militaryCaptionPosition ) }, + + { "SuperweaponCountdownPosition", INI::parseCoord2D, nullptr, offsetof( InGameUI, m_superweaponPosition ) }, + { "SuperweaponCountdownFlashDuration", INI::parseDurationReal, nullptr, offsetof( InGameUI, m_superweaponFlashDuration ) }, + { "SuperweaponCountdownFlashColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_superweaponFlashColor ) }, + + { "SuperweaponCountdownNormalFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_superweaponNormalFont ) }, + { "SuperweaponCountdownNormalPointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_superweaponNormalPointSize ) }, + { "SuperweaponCountdownNormalBold", INI::parseBool, nullptr, offsetof( InGameUI, m_superweaponNormalBold ) }, + + { "SuperweaponCountdownReadyFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_superweaponReadyFont ) }, + { "SuperweaponCountdownReadyPointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_superweaponReadyPointSize ) }, + { "SuperweaponCountdownReadyBold", INI::parseBool, nullptr, offsetof( InGameUI, m_superweaponReadyBold ) }, + + { "NamedTimerCountdownPosition", INI::parseCoord2D, nullptr, offsetof( InGameUI, m_namedTimerPosition ) }, + { "NamedTimerCountdownFlashDuration", INI::parseDurationReal, nullptr, offsetof( InGameUI, m_namedTimerFlashDuration ) }, + { "NamedTimerCountdownFlashColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_namedTimerFlashColor ) }, + + { "NamedTimerCountdownNormalFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_namedTimerNormalFont ) }, + { "NamedTimerCountdownNormalPointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_namedTimerNormalPointSize ) }, + { "NamedTimerCountdownNormalBold", INI::parseBool, nullptr, offsetof( InGameUI, m_namedTimerNormalBold ) }, + { "NamedTimerCountdownNormalColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_namedTimerNormalColor ) }, + + { "NamedTimerCountdownReadyFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_namedTimerReadyFont ) }, + { "NamedTimerCountdownReadyPointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_namedTimerReadyPointSize ) }, + { "NamedTimerCountdownReadyBold", INI::parseBool, nullptr, offsetof( InGameUI, m_namedTimerReadyBold ) }, + { "NamedTimerCountdownReadyColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_namedTimerReadyColor ) }, + + { "FloatingTextTimeOut", INI::parseDurationUnsignedInt, nullptr, offsetof( InGameUI, m_floatingTextTimeOut ) }, + { "FloatingTextMoveUpSpeed", INI::parseVelocityReal, nullptr, offsetof( InGameUI, m_floatingTextMoveUpSpeed ) }, + { "FloatingTextVanishRate", INI::parseVelocityReal, nullptr, offsetof( InGameUI, m_floatingTextMoveVanishRate ) }, + + { "PopupMessageColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_popupMessageColor ) }, + + { "DrawableCaptionFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_drawableCaptionFont ) }, + { "DrawableCaptionPointSize", INI::parseInt, nullptr, offsetof( InGameUI, m_drawableCaptionPointSize ) }, + { "DrawableCaptionBold", INI::parseBool, nullptr, offsetof( InGameUI, m_drawableCaptionBold ) }, + { "DrawableCaptionColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_drawableCaptionColor ) }, + + { "DrawRMBScrollAnchor", INI::parseBool, nullptr, offsetof( InGameUI, m_drawRMBScrollAnchor ) }, + { "MoveRMBScrollAnchor", INI::parseBool, nullptr, offsetof( InGameUI, m_moveRMBScrollAnchor ) }, + + { "AttackDamageAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_ATTACK_DAMAGE_AREA] ) }, + { "AttackScatterAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_ATTACK_SCATTER_AREA] ) }, + { "AttackContinueAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_ATTACK_CONTINUE_AREA] ) }, + { "FriendlySpecialPowerRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_FRIENDLY_SPECIALPOWER] ) }, + { "OffensiveSpecialPowerRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_OFFENSIVE_SPECIALPOWER] ) }, + { "SuperweaponScatterAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_SUPERWEAPON_SCATTER_AREA] ) }, + + { "GuardAreaRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_GUARD_AREA] ) }, + { "EmergencyRepairRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[RADIUSCURSOR_EMERGENCY_REPAIR] ) }, + + { "ParticleCannonRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_PARTICLECANNON] ) }, + { "A10StrikeRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_A10STRIKE] ) }, + { "CarpetBombRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_CARPETBOMB] ) }, + { "DaisyCutterRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_DAISYCUTTER] ) }, + { "ParadropRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_PARADROP] ) }, + { "SpySatelliteRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_SPYSATELLITE] ) }, + { "SpectreGunshipRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_SPECTREGUNSHIP] ) }, + { "HelixNapalmBombRadiusCursor",RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_HELIX_NAPALM_BOMB] ) }, + + { "NuclearMissileRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_NUCLEARMISSILE] ) }, + { "EMPPulseRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_EMPPULSE] ) }, + { "ArtilleryRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_ARTILLERYBARRAGE] ) }, + { "FrenzyRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_FRENZY] ) }, + { "NapalmStrikeRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_NAPALMSTRIKE] ) }, + { "ClusterMinesRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_CLUSTERMINES] ) }, + + { "ScudStormRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_SCUDSTORM] ) }, + { "AnthraxBombRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_ANTHRAXBOMB] ) }, + { "AmbushRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_AMBUSH] ) }, + { "RadarRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_RADAR] ) }, + { "SpyDroneRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_SPYDRONE] ) }, + + { "ClearMinesRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_CLEARMINES] ) }, + { "AmbulanceRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, nullptr, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_AMBULANCE] ) }, // TheSuperHackers @info ui enhancement configuration - { "NetworkLatencyFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_networkLatencyFont ) }, - { "NetworkLatencyBold", INI::parseBool, nullptr, offsetof( InGameUI, m_networkLatencyBold ) }, - { "NetworkLatencyPosition", INI::parseCoord2D, nullptr, offsetof( InGameUI, m_networkLatencyPosition ) }, - { "NetworkLatencyColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_networkLatencyColor ) }, - { "NetworkLatencyDropColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_networkLatencyDropColor ) }, - - { "RenderFpsFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_renderFpsFont ) }, - { "RenderFpsBold", INI::parseBool, nullptr, offsetof( InGameUI, m_renderFpsBold ) }, - { "RenderFpsPosition", INI::parseCoord2D, nullptr, offsetof( InGameUI, m_renderFpsPosition ) }, - { "RenderFpsColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_renderFpsColor ) }, - { "RenderFpsLimitColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_renderFpsLimitColor ) }, - { "RenderFpsDropColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_renderFpsDropColor ) }, - { "RenderFpsRefreshMs", INI::parseUnsignedInt, nullptr, offsetof( InGameUI, m_renderFpsRefreshMs ) }, - - { "SystemTimeFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_systemTimeFont ) }, - { "SystemTimeBold", INI::parseBool, nullptr, offsetof( InGameUI, m_systemTimeBold ) }, - { "SystemTimePosition", INI::parseCoord2D, nullptr, offsetof( InGameUI, m_systemTimePosition ) }, - { "SystemTimeColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_systemTimeColor ) }, - { "SystemTimeDropColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_systemTimeDropColor ) }, - - { "GameTimeFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_gameTimeFont ) }, - { "GameTimeBold", INI::parseBool, nullptr, offsetof( InGameUI, m_gameTimeBold ) }, - { "GameTimePosition", INI::parseCoord2D, nullptr, offsetof( InGameUI, m_gameTimePosition ) }, - { "GameTimeColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_gameTimeColor ) }, - { "GameTimeDropColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_gameTimeDropColor ) }, - - { nullptr, nullptr, nullptr, 0 } + { "NetworkLatencyFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_networkLatencyFont ) }, + { "NetworkLatencyBold", INI::parseBool, nullptr, offsetof( InGameUI, m_networkLatencyBold ) }, + { "NetworkLatencyPosition", INI::parseCoord2D, nullptr, offsetof( InGameUI, m_networkLatencyPosition ) }, + { "NetworkLatencyColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_networkLatencyColor ) }, + { "NetworkLatencyDropColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_networkLatencyDropColor ) }, + + { "RenderFpsFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_renderFpsFont ) }, + { "RenderFpsBold", INI::parseBool, nullptr, offsetof( InGameUI, m_renderFpsBold ) }, + { "RenderFpsPosition", INI::parseCoord2D, nullptr, offsetof( InGameUI, m_renderFpsPosition ) }, + { "RenderFpsColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_renderFpsColor ) }, + { "RenderFpsLimitColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_renderFpsLimitColor ) }, + { "RenderFpsDropColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_renderFpsDropColor ) }, + { "RenderFpsRefreshMs", INI::parseUnsignedInt, nullptr, offsetof( InGameUI, m_renderFpsRefreshMs ) }, + + { "SystemTimeFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_systemTimeFont ) }, + { "SystemTimeBold", INI::parseBool, nullptr, offsetof( InGameUI, m_systemTimeBold ) }, + { "SystemTimePosition", INI::parseCoord2D, nullptr, offsetof( InGameUI, m_systemTimePosition ) }, + { "SystemTimeColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_systemTimeColor ) }, + { "SystemTimeDropColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_systemTimeDropColor ) }, + + { "GameTimeFont", INI::parseAsciiString, nullptr, offsetof( InGameUI, m_gameTimeFont ) }, + { "GameTimeBold", INI::parseBool, nullptr, offsetof( InGameUI, m_gameTimeBold ) }, + { "GameTimePosition", INI::parseCoord2D, nullptr, offsetof( InGameUI, m_gameTimePosition ) }, + { "GameTimeColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_gameTimeColor ) }, + { "GameTimeDropColor", INI::parseColorInt, nullptr, offsetof( InGameUI, m_gameTimeDropColor ) }, + + { nullptr, nullptr, nullptr, 0 } }; //------------------------------------------------------------------------------------------------- @@ -988,8 +988,8 @@ InGameUI::InGameUI() m_mousedOverDrawableID = INVALID_DRAWABLE_ID; m_currentlyPlayingMovie.clear(); - m_militarySubtitle = nullptr; - m_popupMessageData = nullptr; + m_militarySubtitle = nullptr; + m_popupMessageData = nullptr; m_waypointMode = FALSE; m_clientQuiet = FALSE; @@ -1036,36 +1036,36 @@ InGameUI::InGameUI() for( i = 0; i < MAX_BUILD_PROGRESS; i++ ) { - m_buildProgress[ i ].m_thingTemplate = nullptr; + m_buildProgress[ i ].m_thingTemplate = nullptr; m_buildProgress[ i ].m_percentComplete = 0.0f; - m_buildProgress[ i ].m_control = nullptr; + m_buildProgress[ i ].m_control = nullptr; } - m_pendingGUICommand = nullptr; + m_pendingGUICommand = nullptr; // allocate an array for the placement icons m_placeIcon = NEW Drawable* [ TheGlobalData->m_maxLineBuildObjects ]; for( i = 0; i < TheGlobalData->m_maxLineBuildObjects; i++ ) - m_placeIcon[ i ] = nullptr; - m_pendingPlaceType = nullptr; + m_placeIcon[ i ] = nullptr; + m_pendingPlaceType = nullptr; m_pendingPlaceSourceObjectID = INVALID_ID; m_preventLeftClickDeselectionInAlternateMouseModeForOneClick = FALSE; m_placeAnchorStart.x = m_placeAnchorStart.y = 0; m_placeAnchorEnd.x = m_placeAnchorEnd.y = 0; m_placeAnchorInProgress = FALSE; - m_videoStream = nullptr; - m_videoBuffer = nullptr; - m_cameoVideoStream = nullptr; - m_cameoVideoBuffer = nullptr; + m_videoStream = nullptr; + m_videoBuffer = nullptr; + m_cameoVideoStream = nullptr; + m_cameoVideoBuffer = nullptr; // message info for( i = 0; i < MAX_UI_MESSAGES; i++ ) { m_uiMessages[ i ].fullText.clear(); - m_uiMessages[ i ].displayString = nullptr; + m_uiMessages[ i ].displayString = nullptr; m_uiMessages[ i ].timestamp = 0; m_uiMessages[ i ].color = 0; @@ -1074,11 +1074,11 @@ InGameUI::InGameUI() #endif } - m_replayWindow = nullptr; + m_replayWindow = nullptr; m_messagesOn = TRUE; // TheSuperHackers @info the default font, size and positions of the various counters were chosen based on GenTools implementation - m_networkLatencyString = nullptr; + m_networkLatencyString = nullptr; m_networkLatencyFont = "Tahoma"; m_networkLatencyPointSize = TheGlobalData->m_networkLatencyFontSize; m_networkLatencyBold = TRUE; @@ -1088,8 +1088,8 @@ InGameUI::InGameUI() m_networkLatencyDropColor = GameMakeColor( 0, 0, 0, 255 ); m_lastNetworkLatencyFrames = ~0u; - m_renderFpsString = nullptr; - m_renderFpsLimitString = nullptr; + m_renderFpsString = nullptr; + m_renderFpsLimitString = nullptr; m_renderFpsFont = "Tahoma"; m_renderFpsPointSize = TheGlobalData->m_renderFpsFontSize; m_renderFpsBold = TRUE; @@ -1103,7 +1103,7 @@ InGameUI::InGameUI() m_lastRenderFpsLimit = ~0u; m_lastRenderFpsUpdateMs = 0u; - m_systemTimeString = nullptr; + m_systemTimeString = nullptr; m_systemTimeFont = "Tahoma"; m_systemTimePointSize = TheGlobalData->m_systemTimeFontSize; m_systemTimeBold = TRUE; @@ -1112,8 +1112,8 @@ InGameUI::InGameUI() m_systemTimeColor = GameMakeColor( 255, 255, 255, 255 ); m_systemTimeDropColor = GameMakeColor( 0, 0, 0, 255 ); - m_gameTimeString = nullptr; - m_gameTimeFrameString = nullptr; + m_gameTimeString = nullptr; + m_gameTimeFrameString = nullptr; m_gameTimeFont = "Tahoma"; m_gameTimePointSize = TheGlobalData->m_gameTimeFontSize; m_gameTimeBold = TRUE; @@ -1181,7 +1181,7 @@ InGameUI::InGameUI() m_moveRMBScrollAnchor = FALSE; m_displayedMaxWarning = FALSE; - m_idleWorkerWin = nullptr; + m_idleWorkerWin = nullptr; m_currentIdleWorkerDisplay = -1; m_waypointMode = false; @@ -1201,7 +1201,7 @@ InGameUI::InGameUI() InGameUI::~InGameUI() { delete TheControlBar; - TheControlBar = nullptr; + TheControlBar = nullptr; // free all the display strings if we're removeMilitarySubtitle(); @@ -1210,7 +1210,7 @@ InGameUI::~InGameUI() stopCameoMovie(); // remove any build available status - placeBuildAvailable( nullptr, nullptr ); + placeBuildAvailable( nullptr, nullptr ); setRadiusCursorNone(); // delete the message resources @@ -1219,9 +1219,9 @@ InGameUI::~InGameUI() // free custom ui strings freeCustomUiResources(); - // delete the array for the drawables + // delete the array for the drawables delete [] m_placeIcon; - m_placeIcon = nullptr; + m_placeIcon = nullptr; // clear floating text clearFloatingText(); @@ -1237,7 +1237,7 @@ InGameUI::~InGameUI() void InGameUI::init( void ) { INI ini; - ini.loadFileDirectory( "Data\\INI\\InGameUI", INI_LOAD_OVERWRITE, nullptr ); + ini.loadFileDirectory( "Data\\INI\\InGameUI", INI_LOAD_OVERWRITE, nullptr ); //override INI values with language localized values: if (TheGlobalLanguageData) @@ -1340,10 +1340,10 @@ void InGameUI::setRadiusCursor(RadiusCursorType cursorType, const SpecialPowerTe if (cursorType == RADIUSCURSOR_NONE) return; - Object* obj = nullptr; + Object* obj = nullptr; if( m_pendingGUICommand && m_pendingGUICommand->getCommandType() == GUI_COMMAND_SPECIAL_POWER_FROM_SHORTCUT ) { - if( ThePlayerList && ThePlayerList->getLocalPlayer() && specPowTempl != nullptr ) + if( ThePlayerList && ThePlayerList->getLocalPlayer() && specPowTempl != nullptr ) { obj = ThePlayerList->getLocalPlayer()->findMostReadyShortcutSpecialPowerOfType( specPowTempl->getSpecialPowerType() ); } @@ -1354,21 +1354,21 @@ void InGameUI::setRadiusCursor(RadiusCursorType cursorType, const SpecialPowerTe return; Drawable *draw = getFirstSelectedDrawable(); - if (draw == nullptr) + if (draw == nullptr) return; obj = draw->getObject(); } - if (obj == nullptr) + if (obj == nullptr) return; Player* controller = obj->getControllingPlayer(); - if (controller == nullptr) + if (controller == nullptr) return; Real radius = 0.0f; - const Weapon* w = nullptr; + const Weapon* w = nullptr; switch (cursorType) { // already handled @@ -1486,7 +1486,7 @@ void InGameUI::evaluateSoloNexus( Drawable *newlyAddedDrawable ) m_soloNexusSelectedDrawableID = INVALID_DRAWABLE_ID;//failsafe... - // short test: If the thing just added is a nonmobster, bail with nullptr + // short test: If the thing just added is a nonmobster, bail with nullptr if ( newlyAddedDrawable ) { const Object *newObj = newlyAddedDrawable->getObject(); @@ -1601,7 +1601,7 @@ void InGameUI::handleBuildPlacements( void ) // // check to see if this is a legal location to build something at and tint or "un-tint" // the cursor icons as appropriate. This involves a pathfind which could be - // expensive so we don't want to do it on every frame (although that would be ideal) + // expensive so we don't want to do it on every frame (although that would be ideal) // If we discover there are cases that this is just too slow we should increase the // delay time between checks or we need to come up with a way of recording what is // valid and what isn't or "fudge" the results to feel "ok" @@ -1623,12 +1623,12 @@ void InGameUI::handleBuildPlacements( void ) BuildAssistant::SHROUD_REVEALED | BuildAssistant::IGNORE_STEALTHED, builderObject, - nullptr ); + nullptr ); if( lbc != LBC_OK ) m_placeIcon[ 0 ]->colorTint( &IllegalBuildColor ); else - m_placeIcon[ 0 ]->colorTint( nullptr ); + m_placeIcon[ 0 ]->colorTint( nullptr ); @@ -1669,7 +1669,7 @@ void InGameUI::handleBuildPlacements( void ) Int maxObjects = TheGlobalData->m_maxLineBuildObjects; // get the builder object that will be constructing things - Object *builderObject = TheGameLogic->findObjectByID( getPendingPlaceSourceObjectID() ); + Object *builderObject = TheGameLogic->findObjectByID( getPendingPlaceSourceObjectID() ); // // given the start/end points in the world and the the angle of the wall, fill @@ -1685,7 +1685,7 @@ void InGameUI::handleBuildPlacements( void ) for( i = 0; i < tileBuildInfo->tilesUsed; i++ ) { - if( m_placeIcon[ i ] == nullptr ) + if( m_placeIcon[ i ] == nullptr ) { UnsignedInt drawableStatus = DRAWABLE_STATUS_NO_STATE_PARTICLES; drawableStatus |= TheGlobalData->m_objectPlacementShadows ? DRAWABLE_STATUS_SHADOWS : 0; @@ -1701,9 +1701,9 @@ void InGameUI::handleBuildPlacements( void ) for( i = tileBuildInfo->tilesUsed; i < maxObjects; i++ ) { - if( m_placeIcon[ i ] != nullptr ) + if( m_placeIcon[ i ] != nullptr ) TheGameClient->destroyDrawable( m_placeIcon[ i ] ); - m_placeIcon[ i ] = nullptr; + m_placeIcon[ i ] = nullptr; } @@ -1885,7 +1885,7 @@ void InGameUI::update( void ) { // increment the Block position's Y value to draw it on the next line Int height; - m_militarySubtitle->displayStrings[m_militarySubtitle->currentDisplayString]->getSize(nullptr, &height); + m_militarySubtitle->displayStrings[m_militarySubtitle->currentDisplayString]->getSize(nullptr, &height); m_militarySubtitle->blockPos.y = m_militarySubtitle->blockPos.y + height; // Now add a new display string @@ -1913,7 +1913,7 @@ void InGameUI::update( void ) m_militarySubtitle->displayStrings[m_militarySubtitle->currentDisplayString]->appendChar(tempWChar); // increment the draw position of the block Int width; - m_militarySubtitle->displayStrings[m_militarySubtitle->currentDisplayString]->getSize(&width,nullptr); + m_militarySubtitle->displayStrings[m_militarySubtitle->currentDisplayString]->getSize(&width,nullptr); m_militarySubtitle->blockPos.x = m_militarySubtitle->position.x + width; // lets make a sound @@ -1957,13 +1957,13 @@ void InGameUI::update( void ) static NameKeyType moneyWindowKey = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:MoneyDisplay" ); static NameKeyType powerWindowKey = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:PowerWindow" ); - GameWindow *moneyWin = TheWindowManager->winGetWindowFromId( nullptr, moneyWindowKey ); - GameWindow *powerWin = TheWindowManager->winGetWindowFromId( nullptr, powerWindowKey ); -// if( moneyWin == nullptr ) + GameWindow *moneyWin = TheWindowManager->winGetWindowFromId( nullptr, moneyWindowKey ); + GameWindow *powerWin = TheWindowManager->winGetWindowFromId( nullptr, powerWindowKey ); +// if( moneyWin == nullptr ) // { // NameKeyType moneyWindowKey = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:MoneyDisplay" ); // -// moneyWin = TheWindowManager->winGetWindowFromId( nullptr, moneyWindowKey ); +// moneyWin = TheWindowManager->winGetWindowFromId( nullptr, moneyWindowKey ); // // } // end if Player *moneyPlayer = NULL; @@ -2090,6 +2090,9 @@ void InGameUI::reset( void ) // reset the command bar TheControlBar->reset(); + // Reset the observer overlay visibility + m_observerStatsHidden = false; + TheTacticalView->setDefaultView(0.0f, 0.0f, 1.0f); ResetInGameChat(); @@ -2098,10 +2101,10 @@ void InGameUI::reset( void ) stopMovie(); // remove any pending GUI command - setGUICommand( nullptr ); + setGUICommand( nullptr ); // remove any build available status - placeBuildAvailable( nullptr, nullptr ); + placeBuildAvailable( nullptr, nullptr ); // free any message resources allocated freeMessageResources(); @@ -2194,7 +2197,7 @@ void InGameUI::freeMessageResources( void ) // free display string if( m_uiMessages[ i ].displayString ) TheDisplayStringManager->freeDisplayString( m_uiMessages[ i ].displayString ); - m_uiMessages[ i ].displayString = nullptr; + m_uiMessages[ i ].displayString = nullptr; // set timestamp to zero m_uiMessages[ i ].timestamp = 0; @@ -2206,17 +2209,17 @@ void InGameUI::freeMessageResources( void ) void InGameUI::freeCustomUiResources( void ) { TheDisplayStringManager->freeDisplayString(m_networkLatencyString); - m_networkLatencyString = nullptr; + m_networkLatencyString = nullptr; TheDisplayStringManager->freeDisplayString(m_renderFpsString); - m_renderFpsString = nullptr; + m_renderFpsString = nullptr; TheDisplayStringManager->freeDisplayString(m_renderFpsLimitString); - m_renderFpsLimitString = nullptr; + m_renderFpsLimitString = nullptr; TheDisplayStringManager->freeDisplayString(m_systemTimeString); - m_systemTimeString = nullptr; + m_systemTimeString = nullptr; TheDisplayStringManager->freeDisplayString(m_gameTimeString); - m_gameTimeString = nullptr; + m_gameTimeString = nullptr; TheDisplayStringManager->freeDisplayString(m_gameTimeFrameString); - m_gameTimeFrameString = nullptr; + m_gameTimeFrameString = nullptr; TheDisplayStringManager->freeDisplayString(m_observerStatsString); m_observerStatsString = NULL; } @@ -2257,7 +2260,7 @@ void InGameUI::message( AsciiString stringManagerLabel, ... ) //------------------------------------------------------------------------------------------------- void InGameUI::messageNoFormat( const UnicodeString& message ) { - addMessageText( message, nullptr ); + addMessageText( message, nullptr ); } //------------------------------------------------------------------------------------------------- @@ -2352,7 +2355,7 @@ void InGameUI::addMessageText( const UnicodeString& formattedMessage, const RGBC m_uiMessages[ MAX_UI_MESSAGES - 1 ].fullText.clear(); if( m_uiMessages[ MAX_UI_MESSAGES - 1 ].displayString ) TheDisplayStringManager->freeDisplayString( m_uiMessages[ MAX_UI_MESSAGES - 1 ].displayString ); - m_uiMessages[ MAX_UI_MESSAGES - 1 ].displayString = nullptr; + m_uiMessages[ MAX_UI_MESSAGES - 1 ].displayString = nullptr; m_uiMessages[ MAX_UI_MESSAGES - 1 ].timestamp = 0; // shift all the messages down one index and remove the last one @@ -2378,7 +2381,7 @@ void InGameUI::addMessageText( const UnicodeString& formattedMessage, const RGBC // assign a color for this string instance that will stay with it no matter what // line it is rendered on // - if( m_uiMessages[ 1 ].displayString == nullptr || m_uiMessages[ 1 ].color == color2 ) + if( m_uiMessages[ 1 ].displayString == nullptr || m_uiMessages[ 1 ].color == color2 ) m_uiMessages[ 0 ].color = color1; else m_uiMessages[ 0 ].color = color2; @@ -2394,7 +2397,7 @@ void InGameUI::removeMessageAtIndex( Int i ) m_uiMessages[ i ].fullText.clear(); if( m_uiMessages[ i ].displayString ) TheDisplayStringManager->freeDisplayString( m_uiMessages[ i ].displayString ); - m_uiMessages[ i ].displayString = nullptr; + m_uiMessages[ i ].displayString = nullptr; m_uiMessages[ i ].timestamp = 0; } @@ -2433,7 +2436,7 @@ void InGameUI::createMoveHint( const GameMessage *msg ) if( getSelectCount() == 1 ) { Drawable *draw = getFirstSelectedDrawable(); - Object *obj = draw ? draw->getObject() : nullptr; + Object *obj = draw ? draw->getObject() : nullptr; if( obj && obj->isKindOf( KINDOF_IMMOBILE ) ) { //Don't allow move hints to be created if our selected object can't move! @@ -2500,7 +2503,7 @@ void InGameUI::createMouseoverHint( const GameMessage *msg ) if (m_isScrolling || m_isSelecting) return; // no mouseover for you - GameWindow *window = nullptr; + GameWindow *window = nullptr; const MouseIO *io = TheMouse->getMouseStatus(); Bool underWindow = false; if (io && TheWindowManager) @@ -2539,11 +2542,11 @@ void InGameUI::createMouseoverHint( const GameMessage *msg ) TheMouse->setCursorTooltip(UnicodeString::TheEmptyString ); m_mousedOverDrawableID = INVALID_DRAWABLE_ID; const Drawable *draw = TheGameClient->findDrawableByID(msg->getArgument(0)->drawableID); - const Object *obj = draw ? draw->getObject() : nullptr; + const Object *obj = draw ? draw->getObject() : nullptr; if( obj ) { - //Ahh, here is a weird exception: if the moused-over drawable is a mob-member + //Ahh, here is a weird exception: if the moused-over drawable is a mob-member //(e.g. AngryMob), Lets fool the UI into creating the hint for the NEXUS instead... if (obj->isKindOf( KINDOF_IGNORED_IN_GUI )) { @@ -2570,14 +2573,14 @@ void InGameUI::createMouseoverHint( const GameMessage *msg ) #endif - const Player* player = nullptr; + const Player* player = nullptr; const ThingTemplate *thingTemplate = obj->getTemplate(); ContainModuleInterface* contain = obj->getContain(); if( contain ) player = contain->getApparentControllingPlayer(ThePlayerList->getLocalPlayer()); - if (player == nullptr) + if (player == nullptr) player = obj->getControllingPlayer(); Bool disguised = false; @@ -2670,7 +2673,7 @@ void InGameUI::createMouseoverHint( const GameMessage *msg ) // Add on dollar amount of warehouse contents so people don't freak out until the art is hooked up static const NameKeyType warehouseModuleKey = TheNameKeyGenerator->nameToKey( "SupplyWarehouseDockUpdate" ); SupplyWarehouseDockUpdate *warehouseModule = (SupplyWarehouseDockUpdate *)obj->findUpdateModule( warehouseModuleKey ); - if( warehouseModule != nullptr ) + if( warehouseModule != nullptr ) { Int boxes = warehouseModule->getBoxesStored(); Int value = boxes * TheGlobalData->m_baseValuePerSupplyBox; @@ -2740,14 +2743,14 @@ void InGameUI::createMouseoverHint( const GameMessage *msg ) TheMouse->resetTooltipDelay(); } - if (m_mouseMode == MOUSEMODE_DEFAULT && !m_isScrolling && !m_isSelecting && !getSelectCount() && (TheRecorder->getMode() != RECORDERMODETYPE_PLAYBACK || TheLookAtTranslator->hasMouseMovedRecently())) + if (m_mouseMode == MOUSEMODE_DEFAULT && !m_isScrolling && !m_isSelecting && !getSelectCount() && (TheRecorder->getMode() != RECORDERMODETYPE_PLAYBACK || TheLookAtTranslator->hasMouseMovedRecently())) { if( m_mousedOverDrawableID != INVALID_DRAWABLE_ID ) { Drawable *draw = TheGameClient->findDrawableByID(m_mousedOverDrawableID); //Add basic logic to determine if we can select a unit (or hint) - const Object *obj = draw ? draw->getObject() : nullptr; + const Object *obj = draw ? draw->getObject() : nullptr; Bool drawSelectable = CanSelectDrawable(draw, FALSE); if( !obj ) { @@ -2810,7 +2813,7 @@ void InGameUI::createCommandHint( const GameMessage *msg ) { setMouseCursor(Mouse::FORCE_ATTACK_GROUND); setRadiusCursor(RADIUSCURSOR_GUARD_AREA, - nullptr, + nullptr, PRIMARY_WEAPON); return; } @@ -2821,7 +2824,7 @@ void InGameUI::createCommandHint( const GameMessage *msg ) // set cursor to normal if there is a window under the cursor - GameWindow *window = nullptr; + GameWindow *window = nullptr; const MouseIO *io = TheMouse->getMouseStatus(); Bool underWindow = false; if (io && TheWindowManager) @@ -2846,19 +2849,19 @@ void InGameUI::createCommandHint( const GameMessage *msg ) } //Add basic logic to determine if we can select a unit (or hint) - const Object *obj = draw ? draw->getObject() : nullptr; + const Object *obj = draw ? draw->getObject() : nullptr; Bool drawSelectable = CanSelectDrawable(draw, FALSE); if( !obj ) { drawSelectable = false; } - // Note: These are only non-null if there is exactly one thing selected. - const Drawable *srcDraw = nullptr; - const Object *srcObj = nullptr; + // Note: These are only non-null if there is exactly one thing selected. + const Drawable *srcDraw = nullptr; + const Object *srcObj = nullptr; if (getSelectCount() == 1) { srcDraw = getAllSelectedDrawables()->front(); - srcObj = (srcDraw ? srcDraw->getObject() : nullptr); + srcObj = (srcDraw ? srcDraw->getObject() : nullptr); } switch (m_mouseMode) @@ -3068,23 +3071,23 @@ void InGameUI::setScrolling( Bool isScrolling ) { return; } - - if (isScrolling) - { - setMouseCursor( Mouse::SCROLL ); - - // break any camera locks - TheTacticalView->setCameraLock( INVALID_ID ); - TheTacticalView->setCameraLockDrawable( nullptr ); - } - else - { - setMouseCursor( Mouse::ARROW ); - } - - m_isScrolling = isScrolling; - -} + + if (isScrolling) + { + setMouseCursor( Mouse::SCROLL ); + + // break any camera locks + TheTacticalView->setCameraLock( INVALID_ID ); + TheTacticalView->setCameraLockDrawable( nullptr ); + } + else + { + setMouseCursor( Mouse::ARROW ); + } + + m_isScrolling = isScrolling; + +} //------------------------------------------------------------------------------------------------- /// are we scrolling? @@ -3152,7 +3155,7 @@ void InGameUI::setGUICommand( const CommandButton *command ) DEBUG_ASSERTCRASH( 0, ("setGUICommand: Command '%s' does not need additional user interaction", command->getName().str()) ); - m_pendingGUICommand = nullptr; + m_pendingGUICommand = nullptr; m_mouseMode = MOUSEMODE_DEFAULT; return; @@ -3204,7 +3207,7 @@ const CommandButton *InGameUI::getGUICommand( void ) const } //------------------------------------------------------------------------------------------------- -/** Destroy any drawables we have in our placement icon array and set to null */ +/** Destroy any drawables we have in our placement icon array and set to null */ //------------------------------------------------------------------------------------------------- void InGameUI::destroyPlacementIcons( void ) { @@ -3218,7 +3221,7 @@ void InGameUI::destroyPlacementIcons( void ) TheTerrainVisual->removeFactionBibDrawable(m_placeIcon[ i ]); TheGameClient->destroyDrawable( m_placeIcon[ i ] ); } - m_placeIcon[ i ] = nullptr; + m_placeIcon[ i ] = nullptr; } TheTerrainVisual->removeAllBibs(); @@ -3230,124 +3233,122 @@ void InGameUI::destroyPlacementIcons( void ) * record what that thing is so that the we can catch the next click in the world * and try to place the object there */ //------------------------------------------------------------------------------------------------- -void InGameUI::placeBuildAvailable(const ThingTemplate* build, Drawable* buildDrawable) -{ - - if (build != nullptr) - { - // if building something, no radius cursor, thankew - setRadiusCursorNone(); - } - - // - // if we're setting another place available, but we're somehow already in the placement - // mode, get out of it before we start a new one - // - if (m_pendingPlaceType != nullptr && build != nullptr) - placeBuildAvailable(nullptr, nullptr); - - // - // keep a record of what we are trying to place, if we are already trying to - // place something, it is overwritten - // - m_pendingPlaceType = build; - - //Keep the prev pending place for left click deselection prevention in alternate mouse mode. - //We want to keep our dozer selected after initiating construction. - setPreventLeftClickDeselectionInAlternateMouseModeForOneClick(m_pendingPlaceSourceObjectID != INVALID_ID); - m_pendingPlaceSourceObjectID = INVALID_ID; - - Object* sourceObject = nullptr; - if (buildDrawable) - sourceObject = buildDrawable->getObject(); - if (sourceObject) - m_pendingPlaceSourceObjectID = sourceObject->getID(); - - // - // hack, change our cursor to at least something different ... also note that it's - // possible to not have the mouse yet, as some UI systems as part of initialization - // make sure that there isn't anything valid for to "place build" - // - if (TheMouse) - { - - if (build) - { - m_mouseMode = MOUSEMODE_BUILD_PLACE; - m_mouseModeCursor = Mouse::CROSS; - - Drawable* draw; - - // hack for changing cursor - setMouseCursor(Mouse::CROSS); - - // deselect all drawables, otherwise they move to the place we click - ///@ todo when message stream order more formalized eliminate this -// TheInGameUI->deselectAllDrawables(); - - { - // create a drawable of what we are building to be "attached" at the cursor - UnsignedInt drawableStatus = DRAWABLE_STATUS_NO_STATE_PARTICLES; - drawableStatus |= TheGlobalData->m_objectPlacementShadows ? DRAWABLE_STATUS_SHADOWS : 0; - draw = TheThingFactory->newDrawable(build, drawableStatus); - } - if (sourceObject) - { - if (TheGlobalData->m_timeOfDay == TIME_OF_DAY_NIGHT) - draw->setIndicatorColor(sourceObject->getControllingPlayer()->getPlayerNightColor()); - else - draw->setIndicatorColor(sourceObject->getControllingPlayer()->getPlayerColor()); - } - DEBUG_ASSERTCRASH(draw, ("Unable to create icon at cursor for placement '%s'", - build->getName().str())); - - // - // set the initial angle of the free floating building to the property from INI - // we have this so we can have the "cool" face the user until they click and - // pick an actual direction for placement - // - Real angle = build->getPlacementViewAngle(); - - // set the angle in the icon we just created - draw->setOrientation(angle); - - // set the build icon attached to the cursor to be "see-thru" - draw->setDrawableOpacity(TheGlobalData->m_objectPlacementOpacity); - - // set the "icon" in the icon array at the first index - DEBUG_ASSERTCRASH(m_placeIcon[0] == nullptr, ("placeBuildAvailable, build icon array is not empty!")); - m_placeIcon[0] = draw; - - } - else - { - if (m_mouseMode == MOUSEMODE_BUILD_PLACE) - { - m_mouseMode = MOUSEMODE_DEFAULT; - m_mouseModeCursor = Mouse::ARROW; - } - - setMouseCursor(Mouse::ARROW); - setPlacementStart(nullptr); - - // if we have a place icons destroy them - destroyPlacementIcons(); - - if (sourceObject) - { - ProductionUpdateInterface* puInterface = sourceObject->getProductionUpdateInterface(); - if (puInterface) - { - //Clear the special power mode for construction if we set it. Actually call it everytime - //rather than checking if it's set before clearing (cheaper). - puInterface->setSpecialPowerConstructionCommandButton(nullptr); - } - } - - } - - } - +void InGameUI::placeBuildAvailable( const ThingTemplate *build, Drawable *buildDrawable ) +{ + + if (build != nullptr) + { + // if building something, no radius cursor, thankew + setRadiusCursorNone(); + } + + // + // if we're setting another place available, but we're somehow already in the placement + // mode, get out of it before we start a new one + // + if( m_pendingPlaceType != nullptr && build != nullptr ) + placeBuildAvailable( nullptr, nullptr ); + + // + // keep a record of what we are trying to place, if we are already trying to + // place something, it is overwritten + // + m_pendingPlaceType = build; + + //Keep the prev pending place for left click deselection prevention in alternate mouse mode. + //We want to keep our dozer selected after initiating construction. + setPreventLeftClickDeselectionInAlternateMouseModeForOneClick( m_pendingPlaceSourceObjectID != INVALID_ID ); + m_pendingPlaceSourceObjectID = INVALID_ID; + + Object *sourceObject = nullptr; + if( buildDrawable ) + sourceObject = buildDrawable->getObject(); + if( sourceObject ) + m_pendingPlaceSourceObjectID = sourceObject->getID(); + + // + // hack, change our cursor to at least something different ... also note that it's + // possible to not have the mouse yet, as some UI systems as part of initialization + // make sure that there isn't anything valid for to "place build" + // + if (TheMouse) + { + + if (build) + { + m_mouseMode = MOUSEMODE_BUILD_PLACE; + m_mouseModeCursor = Mouse::CROSS; + + Drawable* draw; + + // hack for changing cursor + setMouseCursor(Mouse::CROSS); + + // deselect all drawables, otherwise they move to the place we click + ///@ todo when message stream order more formalized eliminate this +// TheInGameUI->deselectAllDrawables(); + + { + // create a drawable of what we are building to be "attached" at the cursor + UnsignedInt drawableStatus = DRAWABLE_STATUS_NO_STATE_PARTICLES; + drawableStatus |= TheGlobalData->m_objectPlacementShadows ? DRAWABLE_STATUS_SHADOWS : 0; + draw = TheThingFactory->newDrawable(build, drawableStatus); + } + if (sourceObject) + { + if (TheGlobalData->m_timeOfDay == TIME_OF_DAY_NIGHT) + draw->setIndicatorColor(sourceObject->getControllingPlayer()->getPlayerNightColor()); + else + draw->setIndicatorColor(sourceObject->getControllingPlayer()->getPlayerColor()); + } + DEBUG_ASSERTCRASH(draw, ("Unable to create icon at cursor for placement '%s'", + build->getName().str())); + + // + // set the initial angle of the free floating building to the property from INI + // we have this so we can have the "cool" face the user until they click and + // pick an actual direction for placement + // + Real angle = build->getPlacementViewAngle(); + + // set the angle in the icon we just created + draw->setOrientation(angle); + + // set the build icon attached to the cursor to be "see-thru" + + // set the "icon" in the icon array at the first index + DEBUG_ASSERTCRASH( m_placeIcon[ 0 ] == nullptr, ("placeBuildAvailable, build icon array is not empty!") ); + m_placeIcon[ 0 ] = draw; + + } + else + { + if (m_mouseMode == MOUSEMODE_BUILD_PLACE) + { + m_mouseMode = MOUSEMODE_DEFAULT; + m_mouseModeCursor = Mouse::ARROW; + } + + setMouseCursor( Mouse::ARROW ); + setPlacementStart( nullptr ); + + // if we have a place icons destroy them + destroyPlacementIcons(); + + if (sourceObject) + { + ProductionUpdateInterface* puInterface = sourceObject->getProductionUpdateInterface(); + { + //Clear the special power mode for construction if we set it. Actually call it everytime + //rather than checking if it's set before clearing (cheaper). + puInterface->setSpecialPowerConstructionCommandButton( nullptr ); + } + } + + } + + } + } //------------------------------------------------------------------------------------------------- @@ -3508,7 +3509,7 @@ void InGameUI::deselectDrawable( Drawable *draw ) //------------------------------------------------------------------------------------------------- void InGameUI::deselectAllDrawables( Bool postMsg ) { - const DrawableList *selected = getAllSelectedDrawables(); + const DrawableList *selected = getAllSelectedDrawables(); // loop through all the selected drawables for ( DrawableListCIt it = selected->begin(); it != selected->end(); ) @@ -3518,7 +3519,7 @@ void InGameUI::deselectAllDrawables( Bool postMsg ) Drawable* draw = *it++; // do the deselection - deselectDrawable( draw ); + deselectDrawable( draw ); } @@ -3570,14 +3571,14 @@ const DrawableList *InGameUI::getAllSelectedLocalDrawables( void ) } //------------------------------------------------------------------------------------------------- -/** Return pointer to the first selected drawable, if any */ +/** Return pointer to the first selected drawable, if any */ //------------------------------------------------------------------------------------------------- Drawable *InGameUI::getFirstSelectedDrawable( void ) { // sanity if( m_selectedDrawables.empty() ) - return nullptr; // this is valid, nothing is selected + return nullptr; // this is valid, nothing is selected return m_selectedDrawables.front(); @@ -3796,7 +3797,7 @@ void InGameUI::postDraw( void ) { m_militarySubtitle->displayStrings[i]->draw(pos.x,pos.y, m_militarySubtitle->color,dropColor ); Int height; - m_militarySubtitle->displayStrings[i]->getSize(nullptr, &height); + m_militarySubtitle->displayStrings[i]->getSize(nullptr, &height); pos.y += height; } if( m_militarySubtitle->blockDrawn ) @@ -3854,7 +3855,7 @@ void InGameUI::postDraw( void ) { // We don't draw our timers until we are finished with construction. - // It is important that let the SpecialPowerUpdate is add its timer in its constructor,, + // It is important that let the SpecialPowerUpdate is add its timer in its constructor,, // since the science for it could be added before construction is finished, // And thus the timer set to READY before the timer is first drawn, here if ( owningObject->testStatus( OBJECT_STATUS_UNDER_CONSTRUCTION )) @@ -3944,7 +3945,7 @@ void InGameUI::postDraw( void ) // draw the text if ( !m_superweaponHiddenByScript && !marginExceeded ) { - // Similarly, only checking timers is not truly indicative of readiness. + // Similarly, only checking timers is not truly indicative of readiness. Bool changeBolding = (readySecs != info->m_timestamp) || (isReady != info->m_ready) || info->m_forceUpdateText; if (changeBolding) { @@ -4208,7 +4209,7 @@ void InGameUI::playMovie( const AsciiString& movieName ) m_videoStream = TheVideoPlayer->open( movieName ); - if ( m_videoStream == nullptr ) + if ( m_videoStream == nullptr ) { return; } @@ -4216,7 +4217,7 @@ void InGameUI::playMovie( const AsciiString& movieName ) m_currentlyPlayingMovie = movieName; m_videoBuffer = TheDisplay->createVideoBuffer(); - if ( m_videoBuffer == nullptr || + if ( m_videoBuffer == nullptr || !m_videoBuffer->allocate( m_videoStream->width(), m_videoStream->height()) ) @@ -4231,12 +4232,12 @@ void InGameUI::playMovie( const AsciiString& movieName ) void InGameUI::stopMovie( void ) { delete m_videoBuffer; - m_videoBuffer = nullptr; + m_videoBuffer = nullptr; if ( m_videoStream ) { m_videoStream->close(); - m_videoStream = nullptr; + m_videoStream = nullptr; } if (!m_currentlyPlayingMovie.isEmpty()) { @@ -4263,14 +4264,14 @@ void InGameUI::playCameoMovie( const AsciiString& movieName ) m_cameoVideoStream = TheVideoPlayer->open( movieName ); - if ( m_cameoVideoStream == nullptr ) + if ( m_cameoVideoStream == nullptr ) { return; } m_cameoVideoBuffer = TheDisplay->createVideoBuffer(); - if ( m_cameoVideoBuffer == nullptr || + if ( m_cameoVideoBuffer == nullptr || !m_cameoVideoBuffer->allocate( m_cameoVideoStream->width(), m_cameoVideoStream->height()) ) @@ -4278,7 +4279,7 @@ void InGameUI::playCameoMovie( const AsciiString& movieName ) stopCameoMovie(); return; } - GameWindow *window = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:RightHUD" )); + GameWindow *window = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:RightHUD" )); WinInstanceData *winData = window->winGetInstanceData(); winData->setVideoBuffer(m_cameoVideoBuffer); // window->winHide(FALSE); @@ -4289,19 +4290,19 @@ void InGameUI::playCameoMovie( const AsciiString& movieName ) void InGameUI::stopCameoMovie( void ) { //RightHUD - //GameWindow *window = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:CameoMovieWindow" )); - GameWindow *window = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:RightHUD" )); + //GameWindow *window = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:CameoMovieWindow" )); + GameWindow *window = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:RightHUD" )); // window->winHide(FALSE); WinInstanceData *winData = window->winGetInstanceData(); - winData->setVideoBuffer(nullptr); + winData->setVideoBuffer(nullptr); delete m_cameoVideoBuffer; - m_cameoVideoBuffer = nullptr; + m_cameoVideoBuffer = nullptr; if ( m_cameoVideoStream ) { m_cameoVideoStream->close(); - m_cameoVideoStream = nullptr; + m_cameoVideoStream = nullptr; } } @@ -4324,39 +4325,39 @@ void InGameUI::displayCantBuildMessage( LegalBuildCode lbc ) //--------------------------------------------------------------------------------------------- case LBC_RESTRICTED_TERRAIN: - message( "GUI:CantBuildRestrictedTerrain" ); + message( "GUI:CantBuildRestrictedTerrain" ); break; //--------------------------------------------------------------------------------------------- case LBC_NOT_FLAT_ENOUGH: - message( "GUI:CantBuildNotFlatEnough" ); + message( "GUI:CantBuildNotFlatEnough" ); break; //--------------------------------------------------------------------------------------------- case LBC_OBJECTS_IN_THE_WAY: - message( "GUI:CantBuildObjectsInTheWay" ); + message( "GUI:CantBuildObjectsInTheWay" ); break; //--------------------------------------------------------------------------------------------- case LBC_TOO_CLOSE_TO_SUPPLIES: - message( "GUI:CantBuildTooCloseToSupplies" ); + message( "GUI:CantBuildTooCloseToSupplies" ); break; //--------------------------------------------------------------------------------------------- case LBC_NO_CLEAR_PATH: - message( "GUI:CantBuildNoClearPath" ); + message( "GUI:CantBuildNoClearPath" ); break; //--------------------------------------------------------------------------------------------- case LBC_SHROUD: - message( "GUI:CantBuildShroud" ); + message( "GUI:CantBuildShroud" ); break; //--------------------------------------------------------------------------------------------- case LBC_GENERIC_FAILURE: default: - message( "GUI:CantBuildThere" ); + message( "GUI:CantBuildThere" ); break; } @@ -4388,7 +4389,7 @@ void InGameUI::militarySubtitle( const AsciiString& label, Int duration ) const int messageTimeout = currLogicFrame + (Int)(((Real)LOGICFRAMES_PER_SECOND * duration)/1000.0f); // disable tooltips until this frame, cause we don't want to collide with the military subtitles. - disableTooltipsUntil(messageTimeout); + disableTooltipsUntil(messageTimeout); // calculate where this screen position should be since the position being passed in is based off 8x6 Coord2D multiplier; @@ -4413,7 +4414,7 @@ void InGameUI::militarySubtitle( const AsciiString& label, Int duration ) m_militarySubtitle->incrementOnFrame = currLogicFrame + (Int)(((Real)LOGICFRAMES_PER_SECOND * TheGlobalLanguageData->m_militaryCaptionDelayMS)/1000.0f); m_militarySubtitle->index = 0; for (int i = 1; i < MAX_SUBTITLE_LINES; i ++) - m_militarySubtitle->displayStrings[i] = nullptr; + m_militarySubtitle->displayStrings[i] = nullptr; m_militarySubtitle->currentDisplayString = 0; m_militarySubtitle->displayStrings[0] = TheDisplayStringManager->newDisplayString(); @@ -4432,18 +4433,18 @@ void InGameUI::removeMilitarySubtitle( void ) if(!m_militarySubtitle) return; - clearTooltipsDisabled(); + clearTooltipsDisabled(); // loop through and free up the display strings for(UnsignedInt i = 0; i <= m_militarySubtitle->currentDisplayString; i ++) { TheDisplayStringManager->freeDisplayString(m_militarySubtitle->displayStrings[i]); - m_militarySubtitle->displayStrings[i] = nullptr; + m_militarySubtitle->displayStrings[i] = nullptr; } //delete it man! delete m_militarySubtitle; - m_militarySubtitle= nullptr; + m_militarySubtitle= nullptr; } @@ -4451,7 +4452,7 @@ void InGameUI::removeMilitarySubtitle( void ) // ------------------------------------------------------------------------------------------------ Bool InGameUI::areSelectedObjectsControllable() const { - const DrawableList *selected = getAllSelectedDrawables(); + const DrawableList *selected = getAllSelectedDrawables(); // loop through all the selected drawables const Drawable *draw; @@ -4504,16 +4505,16 @@ CanAttackResult InGameUI::getCanSelectedObjectsAttack( ActionType action, const //Kris: Aug 16, 2003 //John McDonald added this code back in Oct 09, 2002. //Replaced it with palatable code. - //if( (objectToInteractWith == nullptr) != (action == ACTIONTYPE_SET_RALLY_POINT)) <---BAD CODE - if( (!objectToInteractWith && action != ACTIONTYPE_SET_RALLY_POINT) || //No object to interact with (and not rally point mode) - (objectToInteractWith && action == ACTIONTYPE_SET_RALLY_POINT) ) //Object to interact with (and rally point mode) + //if( (objectToInteractWith == nullptr) != (action == ACTIONTYPE_SET_RALLY_POINT)) <---BAD CODE + if( (!objectToInteractWith && action != ACTIONTYPE_SET_RALLY_POINT) || //No object to interact with (and not rally point mode) + (objectToInteractWith && action == ACTIONTYPE_SET_RALLY_POINT) ) //Object to interact with (and rally point mode) { //Sanity check OR can't set a rally point over an object. return ATTACKRESULT_NOT_POSSIBLE; } // get selected list of drawables - const DrawableList *selected = getAllSelectedDrawables(); + const DrawableList *selected = getAllSelectedDrawables(); // set up counters for rule checking Int count = 0; @@ -4603,16 +4604,16 @@ Bool InGameUI::canSelectedObjectsDoAction( ActionType action, const Object *obje //and nearly two projects. I'm fixing this now by moving it to the rally point code... //because it would be nice if a saboteur could actually sabotage a building via a //commandbutton. - //if( (objectToInteractWith == nullptr) != (action == ACTIONTYPE_SET_RALLY_POINT)) - if( (!objectToInteractWith && action != ACTIONTYPE_SET_RALLY_POINT) || //No object to interact with (and not rally point mode) - (objectToInteractWith && action == ACTIONTYPE_SET_RALLY_POINT) ) //Object to interact with (and rally point mode) + //if( (objectToInteractWith == nullptr) != (action == ACTIONTYPE_SET_RALLY_POINT)) + if( (!objectToInteractWith && action != ACTIONTYPE_SET_RALLY_POINT) || //No object to interact with (and not rally point mode) + (objectToInteractWith && action == ACTIONTYPE_SET_RALLY_POINT) ) //Object to interact with (and rally point mode) { //Sanity check OR can't set a rally point over an object. return FALSE; } // get selected list of drawables - const DrawableList *selected = getAllSelectedDrawables(); + const DrawableList *selected = getAllSelectedDrawables(); // set up counters for rule checking Int count = 0; @@ -4746,7 +4747,7 @@ Bool InGameUI::canSelectedObjectsDoSpecialPower( const CommandButton *command, c //Get the special power template. const SpecialPowerTemplate *spTemplate = command->getSpecialPowerTemplate(); - //Order of precedence: + //Order of precedence: //1) NO TARGET OR POS //2) COMMAND_OPTION_NEED_OBJECT_TARGET //3) NEED_TARGET_POS @@ -4764,13 +4765,13 @@ Bool InGameUI::canSelectedObjectsDoSpecialPower( const CommandButton *command, c } // get selected list of drawables - Drawable* ignoreSelDraw = ignoreSelObj ? ignoreSelObj->getDrawable() : nullptr; + Drawable* ignoreSelDraw = ignoreSelObj ? ignoreSelObj->getDrawable() : nullptr; DrawableList tmpList; if (ignoreSelDraw) tmpList.push_back(ignoreSelDraw); - const DrawableList* selected = (!tmpList.empty()) ? &tmpList : getAllSelectedDrawables(); + const DrawableList* selected = (!tmpList.empty()) ? &tmpList : getAllSelectedDrawables(); // set up counters for rule checking Int count = 0; @@ -4836,7 +4837,7 @@ Bool InGameUI::canSelectedObjectsOverrideSpecialPowerDestination( const Coord3D Int qualify = 0; // get selected list of drawables - const DrawableList *selected = getAllSelectedDrawables(); + const DrawableList *selected = getAllSelectedDrawables(); // loop through all the selected drawables Drawable *other; @@ -4870,7 +4871,7 @@ Bool InGameUI::canSelectedObjectsEffectivelyUseWeapon( const CommandButton *comm //Get the special power template. WeaponSlotType slot = command->getWeaponSlot(); - //Order of precedence: + //Order of precedence: //1) NO TARGET OR POS //2) COMMAND_OPTION_NEED_OBJECT_TARGET //3) NEED_TARGET_POS @@ -4888,7 +4889,7 @@ Bool InGameUI::canSelectedObjectsEffectivelyUseWeapon( const CommandButton *comm } // get selected list of drawables - const DrawableList *selected = getAllSelectedDrawables(); + const DrawableList *selected = getAllSelectedDrawables(); // set up counters for rule checking Int count = 0; @@ -5002,7 +5003,7 @@ Int InGameUI::selectAllUnitsByTypeAcrossRegion( IRegion2D *region, KindOfMaskTyp } // ------------------------------------------------------------------------------------------------ -/** Selects matching units on the screen */ +/** Selects matching units on the screen */ // ------------------------------------------------------------------------------------------------ Int InGameUI::selectMatchingAcrossRegion( IRegion2D *region ) { @@ -5024,7 +5025,7 @@ Int InGameUI::selectMatchingAcrossRegion( IRegion2D *region ) draw = *it; if( draw && draw->getObject() && draw->getObject()->isLocallyControlled() ) { - // Use the Object's thing template, doing so will prevent weirdness for disguised vehicles. + // Use the Object's thing template, doing so will prevent weirdness for disguised vehicles. drawableList.insert( draw->getObject()->getTemplate() ); if( draw->getObject()->testStatus( OBJECT_STATUS_IS_CARBOMB ) ) { @@ -5105,22 +5106,22 @@ Int InGameUI::selectAllUnitsByTypeAcrossScreen(KindOfMaskType mustBeSet, KindOfM Int numSelected = selectAllUnitsByTypeAcrossRegion(®ion, mustBeSet, mustBeClear); if (numSelected == -1) { - UnicodeString msgStr = TheGameText->fetch( "GUI:NothingSelected" ); - message( msgStr ); + UnicodeString msgStr = TheGameText->fetch( "GUI:NothingSelected" ); + message( msgStr ); } else if (numSelected == 0) { } else { - UnicodeString msgStr = TheGameText->fetch( "GUI:SelectedAcrossScreen" ); - message( msgStr ); + UnicodeString msgStr = TheGameText->fetch( "GUI:SelectedAcrossScreen" ); + message( msgStr ); } return numSelected; } // ------------------------------------------------------------------------------------------------ -/** Selects matching units on the screen */ +/** Selects matching units on the screen */ // ------------------------------------------------------------------------------------------------ Int InGameUI::selectMatchingAcrossScreen( void ) { @@ -5139,16 +5140,16 @@ Int InGameUI::selectMatchingAcrossScreen( void ) Int numSelected = selectMatchingAcrossRegion(®ion); if (numSelected == -1) { - UnicodeString msgStr = TheGameText->fetch( "GUI:NothingSelected" ); - message( msgStr ); + UnicodeString msgStr = TheGameText->fetch( "GUI:NothingSelected" ); + message( msgStr ); } else if (numSelected == 0) { } else { - UnicodeString msgStr = TheGameText->fetch( "GUI:SelectedAcrossScreen" ); - message( msgStr ); + UnicodeString msgStr = TheGameText->fetch( "GUI:SelectedAcrossScreen" ); + message( msgStr ); } return numSelected; } @@ -5157,25 +5158,25 @@ Int InGameUI::selectMatchingAcrossScreen( void ) Int InGameUI::selectAllUnitsByTypeAcrossMap(KindOfMaskType mustBeSet, KindOfMaskType mustBeClear) { /// When implementing this, obey TheInGameUI->getMaxSelectCount() if it is > 0 - Int numSelected = selectAllUnitsByTypeAcrossRegion(nullptr, mustBeSet, mustBeClear); + Int numSelected = selectAllUnitsByTypeAcrossRegion(nullptr, mustBeSet, mustBeClear); if (numSelected == -1) { - UnicodeString msgStr = TheGameText->fetch( "GUI:NothingSelected" ); - message( msgStr ); + UnicodeString msgStr = TheGameText->fetch( "GUI:NothingSelected" ); + message( msgStr ); } else if (numSelected == 0) { - Drawable *draw = getFirstSelectedDrawable(); + Drawable *draw = getFirstSelectedDrawable(); if( !draw || !draw->getObject() || !draw->getObject()->isKindOf( KINDOF_STRUCTURE ) ) { - UnicodeString msgStr = TheGameText->fetch( "GUI:SelectedAcrossMap" ); - message( msgStr ); + UnicodeString msgStr = TheGameText->fetch( "GUI:SelectedAcrossMap" ); + message( msgStr ); } } else { - UnicodeString msgStr = TheGameText->fetch( "GUI:SelectedAcrossMap" ); - message( msgStr ); + UnicodeString msgStr = TheGameText->fetch( "GUI:SelectedAcrossMap" ); + message( msgStr ); } return numSelected; } @@ -5186,25 +5187,25 @@ Int InGameUI::selectAllUnitsByTypeAcrossMap(KindOfMaskType mustBeSet, KindOfMask Int InGameUI::selectMatchingAcrossMap() { /// When implementing this, obey TheInGameUI->getMaxSelectCount() if it is > 0 - Int numSelected = selectMatchingAcrossRegion(nullptr); + Int numSelected = selectMatchingAcrossRegion(nullptr); if (numSelected == -1) { - UnicodeString msgStr = TheGameText->fetch( "GUI:NothingSelected" ); - message( msgStr ); + UnicodeString msgStr = TheGameText->fetch( "GUI:NothingSelected" ); + message( msgStr ); } else if (numSelected == 0) { - Drawable *draw = getFirstSelectedDrawable(); + Drawable *draw = getFirstSelectedDrawable(); if( !draw || !draw->getObject() || !draw->getObject()->isKindOf( KINDOF_STRUCTURE ) ) { - UnicodeString msgStr = TheGameText->fetch( "GUI:SelectedAcrossMap" ); - message( msgStr ); + UnicodeString msgStr = TheGameText->fetch( "GUI:SelectedAcrossMap" ); + message( msgStr ); } } else { - UnicodeString msgStr = TheGameText->fetch( "GUI:SelectedAcrossMap" ); - message( msgStr ); + UnicodeString msgStr = TheGameText->fetch( "GUI:SelectedAcrossMap" ); + message( msgStr ); } return numSelected; } @@ -5368,7 +5369,7 @@ void InGameUI::updateFloatingText( void ) FloatingTextData *ftd; // pointer to our floating point data UnsignedInt currLogicFrame = TheGameLogic->getFrame(); // the current logic frame UnsignedByte r, g, b, a; // we'll need to break apart our color so we can modify the alpha - Int amount; // The amount we'll change the alpha + Int amount; // The amount we'll change the alpha static UnsignedInt lastLogicFrameUpdate = currLogicFrame; // We need to make sure our current frame is different then our last frame we updated. // only update the position if we're incrementing frames @@ -5405,7 +5406,7 @@ void InGameUI::updateFloatingText( void ) } } - // increase our iterator + // increase our iterator ++it; } @@ -5442,7 +5443,7 @@ void InGameUI::drawFloatingText( void ) // make drop color black, but use the alpha setting of the fill color specified (for fading) GameGetColorComponents( ftd->m_color, &r, &g, &b, &a ); dropColor = GameMakeColor( 0, 0, 0, a ); - ftd->m_dString->getSize(&width, nullptr); + ftd->m_dString->getSize(&width, nullptr); // draw it! ftd->m_dString->draw(pos.x - (width / 2), pos.y, ftd->m_color,dropColor); } @@ -5527,12 +5528,12 @@ void InGameUI::clearPopupMessageData( void ) { m_popupMessageData->layout->destroyWindows(); deleteInstance(m_popupMessageData->layout); - m_popupMessageData->layout = nullptr; + m_popupMessageData->layout = nullptr; } if( m_popupMessageData->pause ) TheGameLogic->setGamePaused(FALSE, m_popupMessageData->pauseMusic); deleteInstance(m_popupMessageData); - m_popupMessageData = nullptr; + m_popupMessageData = nullptr; } @@ -5561,7 +5562,7 @@ FloatingTextData::~FloatingTextData(void) { if(m_dString) TheDisplayStringManager->freeDisplayString( m_dString ); - m_dString = nullptr; + m_dString = nullptr; } /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -5575,7 +5576,7 @@ FloatingTextData::~FloatingTextData(void) WorldAnimationData::WorldAnimationData( void ) { - m_anim = nullptr; + m_anim = nullptr; m_worldPos.zero(); m_expireFrame = 0; m_options = WORLD_ANIM_NO_OPTIONS; @@ -5594,13 +5595,13 @@ void InGameUI::addWorldAnimation( Anim2DTemplate *animTemplate, { // sanity - if( animTemplate == nullptr || pos == nullptr || durationInSeconds <= 0.0f ) + if( animTemplate == nullptr || pos == nullptr || durationInSeconds <= 0.0f ) return; // allocate a new world animation data struct // (huh huh, he said "wad") WorldAnimationData *wad = NEW WorldAnimationData; - if( wad == nullptr ) + if( wad == nullptr ) return; // allocate a new animation instance @@ -5748,11 +5749,11 @@ void InGameUI::updateAndDrawWorldAnimations( void ) Object *InGameUI::findIdleWorker( Object *obj) { if(!obj) - return nullptr; + return nullptr; Int index = obj->getControllingPlayer()->getPlayerIndex(); if(m_idleWorkers[index].empty()) - return nullptr; + return nullptr; ObjectListIt it = m_idleWorkers[index].begin(); while(it != m_idleWorkers[index].end()) @@ -5765,7 +5766,7 @@ Object *InGameUI::findIdleWorker( Object *obj) } ++it; } - return nullptr; + return nullptr; } void InGameUI::addIdleWorker( Object *obj ) @@ -5815,7 +5816,7 @@ void InGameUI::selectNextIdleWorker( void ) DEBUG_ASSERTCRASH(FALSE, ("InGameUI::selectNextIdleWorker We're trying to select a worker when our list is empty for player %ls", player->getPlayerDisplayName().str())); return; } - Object *selectThisObject = nullptr; + Object *selectThisObject = nullptr; if(getSelectCount() == 0 || getSelectCount() > 1) { @@ -5826,7 +5827,7 @@ void InGameUI::selectNextIdleWorker( void ) } else { - Drawable *selectedDrawable = getFirstSelectedDrawable(); + Drawable *selectedDrawable = getFirstSelectedDrawable(); // TheSuperHackers @tweak Stubbjax 22/07/2025 Idle worker iteration now correctly identifies and // iterates contained idle workers. Previous iteration logic would not go past contained workers, // and was not guaranteed to select top-level containers. @@ -5854,7 +5855,7 @@ void InGameUI::selectNextIdleWorker( void ) DEBUG_ASSERTCRASH(selectThisObject, ("InGameUI::selectNextIdleWorker Could not select the next IDLE worker")); if(selectThisObject) { - DEBUG_ASSERTCRASH(selectThisObject->getContainedBy() == nullptr, ("InGameUI::selectNextIdleWorker Selected idle object should not be contained")); + DEBUG_ASSERTCRASH(selectThisObject->getContainedBy() == nullptr, ("InGameUI::selectNextIdleWorker Selected idle object should not be contained")); deselectAllDrawables(); GameMessage *teamMsg = TheMessageStream->appendMessage( GameMessage::MSG_CREATE_SELECTED_GROUP ); @@ -5866,7 +5867,7 @@ void InGameUI::selectNextIdleWorker( void ) selectDrawable( selectThisObject->getDrawable() ); - /*// removed because we're already playing a select sound... left in, just in case i"m wrong. + /*// removed because we're already playing a select sound... left in, just in case i"m wrong. // play the units sound const AudioEventRTS *soundEvent = selectThisObject->getTemplate()->getVoiceSelect(); if (soundEvent) @@ -5908,7 +5909,7 @@ void InGameUI::showIdleWorkerLayout( void ) { if (!m_idleWorkerWin) { - m_idleWorkerWin = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonIdleWorker")); + m_idleWorkerWin = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonIdleWorker")); DEBUG_ASSERTCRASH(m_idleWorkerWin, ("InGameUI::showIdleWorkerLayout could not find IdleWorker.wnd to load")); return; } @@ -5962,11 +5963,11 @@ void InGameUI::resetIdleWorker( void ) void InGameUI::recreateControlBar( void ) { - GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd")); + GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd")); if(win) deleteInstance(win); - m_idleWorkerWin = nullptr; + m_idleWorkerWin = nullptr; createControlBar(); @@ -5991,9 +5992,7 @@ void InGameUI::drawObserverStats(Int& x, Int& y) if (!localPlayer || (TheGameLogic && TheGameLogic->getFrame() <= 1)) return; - Bool isObserver = localPlayer->isPlayerObserver(); - Bool isDefeated = TheVictoryConditions && TheVictoryConditions->hasSinglePlayerBeenDefeated(localPlayer); - if (!isObserver && !isDefeated) + if (!localPlayer->isPlayerObserver() && !localPlayer->isPlayerDead()) return; if (!isAtHudAnchorPos(m_observerStatsPosition) || m_observerStatsHidden) @@ -6010,7 +6009,7 @@ void InGameUI::drawObserverStats(Int& x, Int& y) static const Int numCols = 8; static const wchar_t* headers[numCols] = { - L"(T) Name", L"Army", L"Cash", L"Cash/m", L"XP", L"K/D", L"SP", L"Power" + L"(T) Name", L"Army", L"Cash", L"Cash/m", L"(R) XP", L"SP", L"K/D", L"Power" }; static UnsignedInt lastUpdateFrame = 0; @@ -6032,59 +6031,40 @@ void InGameUI::drawObserverStats(Int& x, Int& y) // ==================================================================== if (needUpdate) { lastUpdateFrame = currentFrame; - lastFontSize = TheGlobalData->m_observerStatsFontSize; + lastFontSize = TheWritableGlobalData->m_observerStatsFontSize; refreshObserverStatsResources(); // Gather player data players.clear(); players.reserve(MAX_PLAYER_COUNT); - // These are system players we want to skip - static const char* EXCLUDED_NAMES[] = { - "PlyrCivilian", "PlyrAmerica", "PlyrChina", "PlyrGLA", "Paradrops", - "PlyrChinaTankGeneral", "PlyrAmericaLaserGeneral", "PlyrAmericaAirForceGeneral", - "UncloakedGLA", "PlyrAmericaAirForce", "PlyrChinaTank", "PlyrNeutral" - }; + for (Int slotIndex = 0; slotIndex < MAX_SLOTS; ++slotIndex) { + const GameSlot* slot = TheGameInfo ? TheGameInfo->getConstSlot(slotIndex) : nullptr; + if (!slot || !slot->isOccupied()) + continue; - for (Int i = 0; i < MAX_PLAYER_COUNT; ++i) { - Player* p = ThePlayerList->getNthPlayer(i); + AsciiString nameKeyStr; + nameKeyStr.format("player%d", slotIndex); + const NameKeyType key = TheNameKeyGenerator->nameToKey(nameKeyStr); + Player* p = ThePlayerList->findPlayerWithNameKey(key); if (!p || !p->isPlayerActive()) continue; + if (p->isPlayerObserver()) + continue; + UnicodeString name = p->getPlayerDisplayName(); if (name.isEmpty()) continue; - // Skip system players - AsciiString asciiName; - asciiName.translate(name); - bool skip = false; - for (const char* excluded : EXCLUDED_NAMES) { - if (asciiName == excluded) { - skip = true; - break; - } - } - if (skip) continue; - - // Truncate long names - if (name.getLength() > 8) { + // Truncate long names + if (name.getLength() > 12) { UnicodeString tmp; - tmp.format(L"%.*ls.", 8, name.str()); + tmp.format(L"%.*ls.", 12, name.str()); name = tmp; } - - // Find team - Int team = -1; - if (TheGameInfo) { - for (Int s = 0; s < MAX_SLOTS; ++s) { - const GameSlot* slot = TheGameInfo->getConstSlot(s); - if (slot && slot->isOccupied() && slot->isPlayer(name)) { - team = slot->getTeamNumber(); - break; - } - } - } + + Int team = slot->getTeamNumber(); // Gather stats Money* money = p->getMoney(); @@ -6093,6 +6073,7 @@ void InGameUI::drawObserverStats(Int& x, Int& y) Int kills = sk ? sk->getTotalUnitsDestroyed() : 0; Int deaths = sk ? sk->getTotalUnitsLost() : 0; Real kd = deaths > 0 ? (Real)kills / deaths : (Real)kills; + Int rank = p->getRankLevel(); // Faction abbreviations, we don't want to show full army names like that AsciiString side = p->getSide(); @@ -6116,7 +6097,7 @@ void InGameUI::drawObserverStats(Int& x, Int& y) name, faction, team, money ? money->countMoney() : 0, money ? money->getCashPerMinute() : 0, - p->getSkillPoints(), kd, + p->getSkillPoints(), rank, kd, p->getSciencePurchasePoints(), powerDelta, hasPower, energy && !energy->hasSufficientPower(), @@ -6124,6 +6105,12 @@ void InGameUI::drawObserverStats(Int& x, Int& y) }); } + std::sort(players.begin(), players.end(), + [](const PlayerData& a, const PlayerData& b) { + if (a.team != b.team) + return a.team < b.team; // sort by team first + }); + // Format cash and cash/m with commas auto formatNum = [](UnsignedInt v) -> UnicodeString { std::wstring s = std::to_wstring(v); @@ -6150,7 +6137,11 @@ void InGameUI::drawObserverStats(Int& x, Int& y) headerStrings[i]->setFont(m_observerStatsString->getFont()); headerStrings[i]->setText(headers[i]); } - + + for (DisplayString* ds : cellStrings) { + if (ds) + TheDisplayStringManager->freeDisplayString(ds); + } cellStrings.clear(); cellStrings.reserve(players.size() * numCols); @@ -6160,14 +6151,13 @@ void InGameUI::drawObserverStats(Int& x, Int& y) cells[1] = pd.faction; cells[2] = formatNum(pd.money); cells[3].format(L"+%ls", formatNum(pd.cpm).str()); - cells[4].format(L"%d", pd.xp); - cells[5].format(L"%.1f", pd.kd); - cells[6].format(L"%d", pd.sp); - cells[7] = pd.showPower ? (pd.lowPower ? L"OFF/" : L"ON/") : L"-"; + cells[4].format(L"(%d) %d", pd.rank, pd.xp); + cells[5].format(L"%d", pd.sp); + cells[6].format(L"%.1f", pd.kd); if (pd.showPower) { - UnicodeString tmp; - tmp.format(pd.lowPower ? L"OFF/%d" : L"ON/%d", pd.powerValue); - cells[7] = tmp; + cells[7].format(pd.lowPower ? L"OFF (%d)" : L"ON (%d)", pd.powerValue); + } else { + cells[7] = L"-"; } for (Int i = 0; i < numCols; ++i) { @@ -6231,7 +6221,7 @@ void InGameUI::drawObserverStats(Int& x, Int& y) Int contentY = baseY + padY; // Draw background - TheWindowManager->winFillRect(TheWindowManager->winMakeColor(0, 0, 0, 140), 1, baseX, baseY, baseX + bgW, baseY + bgH); + TheWindowManager->winFillRect(TheWindowManager->winMakeColor(0, 0, 0, 180), 1, baseX, baseY, baseX + bgW, baseY + bgH); // Draw border Color border = TheWindowManager->winMakeColor(255, 255, 255, 225); @@ -6285,7 +6275,7 @@ void InGameUI::refreshObserverStatsResources(void) Int adjustedFontSize = TheGlobalLanguageData->adjustFontSize(m_observerStatsPointSize); GameFont* statsFont = TheWindowManager->winFindFont(m_observerStatsFont, adjustedFontSize, m_observerStatsBold); m_observerStatsString->setFont(statsFont); - m_observerStatsLineStep = adjustedFontSize + 10; // vertical spacing between lines + m_observerStatsLineStep = statsFont ? statsFont->height + 2 : adjustedFontSize + 2; // Line spacing based on real font height } void InGameUI::refreshCustomUiResources(void) @@ -6676,3 +6666,4 @@ void InGameUI::drawGameTime() } +