Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions Core/GameEngine/Include/GameClient/View.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,5 +331,40 @@ class ViewLocation
}
};

// TheSuperHackers @feature bobtista 31/01/2026
// View that does nothing. Used for Headless Mode.
class ViewDummy : public View
{
public:
virtual Drawable *pickDrawable( const ICoord2D *screen, Bool forceAttack, PickType pickType ) override
{
return nullptr;
}
virtual Int iterateDrawablesInRegion( IRegion2D *screenRegion, Bool (*callback)( Drawable *draw, void *userData ), void *userData ) override
{
return 0;
}
virtual void forceRedraw() override {}
virtual const Coord3D& get3DCameraPosition() const override
{
static Coord3D zero = {0,0,0};
return zero;
}
virtual WorldToScreenReturn worldToScreenTriReturn(const Coord3D *w, ICoord2D *s ) override
{
return WTS_INVALID;
}
virtual void screenToTerrain( const ICoord2D *screen, Coord3D *world ) override {}
virtual void screenToWorldAtZ( const ICoord2D *s, Coord3D *w, Real z ) override {}
virtual void drawView( void ) override {}
virtual void updateView(void) override {}
virtual void stepView() override {}
virtual void setGuardBandBias( const Coord2D *gb ) override {}
virtual Bool isDoingScriptedCamera() override { return false; }
virtual void stopDoingScriptedCamera() override {}

// Do not override View::xfer(). The base implementation must run to serialize valid view state for save file compatibility.
};

// EXTERNALS //////////////////////////////////////////////////////////////////////////////////////
extern View *TheTacticalView; ///< the main tactical interface to the game world
2 changes: 1 addition & 1 deletion Generals/Code/GameEngine/Include/GameClient/InGameUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ friend class Drawable; // for selection/deselection transactions

void incrementSelectCount() { ++m_selectCount; } ///< Increase by one the running total of "selected" drawables
void decrementSelectCount() { --m_selectCount; } ///< Decrease by one the running total of "selected" drawables
virtual View *createView() = 0; ///< Factory for Views
virtual View *createView(bool dummy = false) = 0; ///< Factory for Views
void evaluateSoloNexus( Drawable *newlyAddedDrawable = nullptr );

/// expire a hint from of the specified type at the hint index
Expand Down
6 changes: 3 additions & 3 deletions Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1337,17 +1337,17 @@ void InGameUI::init()
been moved to where all the other translators are attached in game client */

// create the tactical view
if (TheDisplay)
TheTacticalView = createView(TheGlobalData->m_headless);
if (TheTacticalView && TheDisplay)
{
TheTacticalView = createView();
TheTacticalView->init();
TheDisplay->attachView( TheTacticalView );

// make the tactical display the full screen width and height
TheTacticalView->setWidth( TheDisplay->getWidth() );
TheTacticalView->setHeight( TheDisplay->getHeight() );
TheTacticalView->setDefaultView(0.0f, 0.0f, 1.0f);
}
TheTacticalView->setDefaultView(0.0f, 0.0f, 1.0f);

/** @todo this may be the wrong place to create the sidebar, but for now
this is where it lives */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ class W3DInGameUI : public InGameUI
protected:

/// factory for views
virtual View *createView() { return NEW W3DView; }
virtual View *createView(bool dummy)
{
if (dummy)
return NEW ViewDummy;
return NEW W3DView;
}

virtual void drawSelectionRegion(); ///< draw the selection region on screen
virtual void drawMoveHints( View *view ); ///< draw move hint visual feedback
Expand Down
2 changes: 1 addition & 1 deletion GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ friend class Drawable; // for selection/deselection transactions

void incrementSelectCount() { ++m_selectCount; } ///< Increase by one the running total of "selected" drawables
void decrementSelectCount() { --m_selectCount; } ///< Decrease by one the running total of "selected" drawables
virtual View *createView() = 0; ///< Factory for Views
virtual View *createView(bool dummy = false) = 0; ///< Factory for Views
void evaluateSoloNexus( Drawable *newlyAddedDrawable = nullptr );

/// expire a hint from of the specified type at the hint index
Expand Down
6 changes: 3 additions & 3 deletions GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1367,17 +1367,17 @@ void InGameUI::init()
been moved to where all the other translators are attached in game client */

// create the tactical view
if (TheDisplay)
TheTacticalView = createView(TheGlobalData->m_headless);
if (TheTacticalView && TheDisplay)
{
TheTacticalView = createView();
TheTacticalView->init();
TheDisplay->attachView( TheTacticalView );

// make the tactical display the full screen width and height
TheTacticalView->setWidth( TheDisplay->getWidth() );
TheTacticalView->setHeight( TheDisplay->getHeight() );
TheTacticalView->setDefaultView(0.0f, 0.0f, 1.0f);
}
TheTacticalView->setDefaultView(0.0f, 0.0f, 1.0f);

/** @todo this may be the wrong place to create the sidebar, but for now
this is where it lives */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ class W3DInGameUI : public InGameUI
protected:

/// factory for views
virtual View *createView() { return NEW W3DView; }
virtual View *createView(bool dummy)
{
if (dummy)
return NEW ViewDummy;
return NEW W3DView;
}

virtual void drawSelectionRegion(); ///< draw the selection region on screen
virtual void drawMoveHints( View *view ); ///< draw move hint visual feedback
Expand Down
Loading