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
6 changes: 6 additions & 0 deletions Generals/Code/GameEngine/Include/GameClient/SelectionXlat.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ class SelectionTranslator : public GameMessageTranslator
//changes the mode of drag selecting to it's opposite
void setDragSelecting(Bool dragSelect);
void setLeftMouseButton(Bool state);

#if defined(RTS_DEBUG) || defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE)
Bool m_HandOfGodSelectionMode;
Bool isHandOfGodSelectionMode() { return m_HandOfGodSelectionMode; };
#endif

};

Bool CanSelectDrawable( const Drawable *draw, Bool dragSelecting );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
//-----------------------------------------------------------------------------
#if defined(RTS_DEBUG)
static Bool TheHurtSelectionMode = false;
static Bool TheHandOfGodSelectionMode = false;
static Bool TheDebugSelectionMode = false;
#endif

Expand Down Expand Up @@ -270,6 +269,10 @@ SelectionTranslator::SelectionTranslator()
m_selectCountMap.clear();

TheSelectionTranslator = this;

#if defined(RTS_DEBUG) || defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE)
m_HandOfGodSelectionMode = FALSE;
#endif
}

//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -637,11 +640,47 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
if (si.newCountMine > 0)
{
si.selectMine = TRUE;
if (si.newCountMine == 1 && si.newCountMineBuildings == 1)

// EXACTLY ONE CLICKED OR DRAGGED BUILDING
if ( si.newCountMineBuildings == 1 && si.newCountMine == 1 )
{
addToGroup = FALSE;
si.selectMineBuildings = TRUE;
}
else if ( si.newCountMineBuildings > 0 )////////////// SO SORRY, I KNOW THIS IS MICKEY MOUSE ///////////////////
{ // What we are after here is to allow the drag select to get the building,
// if the other things in the list are going to be ignored anyway
// so we find out whether the other things are not selectible
// this came up with the new AmericaBuildingFireBase, which shows its contained
// but does not let you select them. The selection is propagated to the container
// in new code in SelectionInfo.cpp, in the static addDrawableToList();
// -Mark Lorenzen, 6/12/03
Bool onlyTheOneBuildingIsSelectableAnyway = TRUE;
DrawableID buildingID = INVALID_DRAWABLE_ID;
for (DrawableListIt it = drawablesThatWillSelect.begin(); it != drawablesThatWillSelect.end(); ++it)
{
const Drawable *d = *it;
if ( d->isKindOf( KINDOF_STRUCTURE ) )
{// make sure there is really only the one building in the list, as it may be multiply listed

if ( buildingID == INVALID_DRAWABLE_ID ) // this is the first building
buildingID = d->getID();
else if ( buildingID != d->getID() )//oops, more than one building!
onlyTheOneBuildingIsSelectableAnyway = FALSE;
}
else if ( d->isSelectable() )
onlyTheOneBuildingIsSelectableAnyway = FALSE;

if ( ! onlyTheOneBuildingIsSelectableAnyway )
break;
}
if ( onlyTheOneBuildingIsSelectableAnyway )
{
addToGroup = FALSE;
si.selectMineBuildings = TRUE;
}
}

}
else if (si.newCountEnemies > 0 && si.newCountCivilians > 0 && si.newCountFriends > 0)
{
Expand Down Expand Up @@ -774,10 +813,15 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
}
}

if( newDrawablesSelected > 1 )
{
localPlayer->getAcademyStats()->recordDragSelection();
}

if (newDrawablesSelected == 1 && draw)
{
#if defined(RTS_DEBUG)
if (TheHandOfGodSelectionMode && draw)
#if defined(RTS_DEBUG) || defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE)
if (m_HandOfGodSelectionMode && draw)
{
Object* obj = draw->getObject();
if (obj)
Expand All @@ -789,7 +833,10 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
disp = DESTROY_MESSAGE;
break;
}
else if (TheHurtSelectionMode && draw)
#endif

#if defined(RTS_DEBUG)
if (TheHurtSelectionMode && draw)
{
Object* obj = draw->getObject();
if (obj)
Expand Down Expand Up @@ -817,8 +864,8 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
break;
}
}
#endif
#endif
#endif // DEBUG_OBJECT_ID_EXISTS
#endif // RTS_DEBUG
}
}

Expand Down Expand Up @@ -877,6 +924,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
if( !TheInGameUI->getPreventLeftClickDeselectionInAlternateMouseModeForOneClick() )
{
deselectAll();
m_lastGroupSelGroup = -1;
}
else
{
Expand Down Expand Up @@ -927,10 +975,10 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
//With a GUI command cancel, we want no other behavior.
disp = DESTROY_MESSAGE;
TheInGameUI->setScrolling( FALSE );
}
}
else
{
//In alternate mouse mode, right click still cancels building placement.
//In alternate mouse mode, right click still cancels building placement.
// TheSuperHackers @tweak Stubbjax 08/08/2025 Canceling building placement no longer deselects the builder.
if (TheInGameUI->getPendingPlaceSourceObjectID() != INVALID_ID)
{
Expand All @@ -940,12 +988,11 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
TheInGameUI->setScrolling(FALSE);
}
else if (!TheGlobalData->m_useAlternateMouse)
{
{
//No GUI command mode, so deselect everyone if we're in regular mouse mode.
deselectAll();
m_lastGroupSelGroup = -1;
}
}
deselectAll();
}
}
}

break;
Expand Down Expand Up @@ -1202,9 +1249,26 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
//-----------------------------------------------------------------------------------------
case GameMessage::MSG_META_DEMO_TOGGLE_HAND_OF_GOD_MODE:
{
TheHandOfGodSelectionMode = !TheHandOfGodSelectionMode;
TheInGameUI->message( L"Hand-Of-God Mode is %s", TheHandOfGodSelectionMode ? L"ON" : L"OFF" );
disp = DESTROY_MESSAGE;
if ( !TheGameLogic->isInMultiplayerGame() )
{
m_HandOfGodSelectionMode = !m_HandOfGodSelectionMode;
TheInGameUI->message( L"Meta Hand-Of-God Mode is %s", m_HandOfGodSelectionMode ? L"ON" : L"OFF" );
disp = DESTROY_MESSAGE;
}
break;
}
#endif

#if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE)
//-----------------------------------------------------------------------------------------
case GameMessage::MSG_CHEAT_TOGGLE_HAND_OF_GOD_MODE://NOTICE THE DIFFERENT NAME!!!!!!!!!!!!!!!!!!!!!!!!!!ML
{
if ( !TheGameLogic->isInMultiplayerGame() )
{
m_HandOfGodSelectionMode = !m_HandOfGodSelectionMode;
TheInGameUI->message( L"Hand-Of-God Mode is %s", m_HandOfGodSelectionMode ? L"ON" : L"OFF" );
disp = DESTROY_MESSAGE;
}
break;
}
#endif
Expand All @@ -1213,9 +1277,12 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
//-----------------------------------------------------------------------------------------
case GameMessage::MSG_META_DEMO_TOGGLE_HURT_ME_MODE:
{
TheHurtSelectionMode = !TheHurtSelectionMode;
TheInGameUI->message( L"Hurt-Me Mode is %s", TheHurtSelectionMode ? L"ON" : L"OFF" );
disp = DESTROY_MESSAGE;
if ( !TheGameLogic->isInMultiplayerGame() )
{
TheHurtSelectionMode = !TheHurtSelectionMode;
TheInGameUI->message( L"Hurt-Me Mode is %s", TheHurtSelectionMode ? L"ON" : L"OFF" );
disp = DESTROY_MESSAGE;
}
break;
}
#endif
Expand Down
2 changes: 0 additions & 2 deletions GeneralsMD/Code/GameEngine/Include/GameClient/SelectionXlat.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ class SelectionTranslator : public GameMessageTranslator
Bool selectFriends( Drawable *draw, GameMessage *createTeamMsg, Bool dragSelecting );
Bool killThemKillThemAll( Drawable *draw, GameMessage *killThemAllMsg );



public:
SelectionTranslator();
virtual ~SelectionTranslator() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,6 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Lorenzen changed this to a member of SelectionTranslator, providing external access
// name ly in rebuildholeexposedie, where we decide whether to create GLA Holes when hand-of-Godding
//#if defined(RTS_DEBUG) || defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE)
//static Bool TheHandOfGodSelectionMode = false;
//#endif

#if defined(RTS_DEBUG)
static Bool TheHurtSelectionMode = false;
static Bool TheDebugSelectionMode = false;
Expand Down Expand Up @@ -826,11 +820,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa

if (newDrawablesSelected == 1 && draw)
{


#if defined(RTS_DEBUG)


#if defined(RTS_DEBUG) || defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE)
if (m_HandOfGodSelectionMode && draw)
{
Object* obj = draw->getObject();
Expand All @@ -843,8 +833,9 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
disp = DESTROY_MESSAGE;
break;
}
else
#endif

#if defined(RTS_DEBUG)
if (TheHurtSelectionMode && draw)
{
Object* obj = draw->getObject();
Expand All @@ -858,7 +849,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
break;
}

#ifdef DEBUG_OBJECT_ID_EXISTS
#ifdef DEBUG_OBJECT_ID_EXISTS
if (TheDebugSelectionMode && draw && draw->getObject())
{
if (TheObjectIDToDebug == 0)
Expand All @@ -873,28 +864,9 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
break;
}
}
#endif

#endif


#if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE)
if (m_HandOfGodSelectionMode && draw)
{
Object* obj = draw->getObject();
if (obj)
{
TheAudio->addAudioEvent(&TheAudio->getMiscAudio()->m_noCanDoSound);
GameMessage* msg = TheMessageStream->appendMessage( GameMessage::MSG_DEBUG_KILL_OBJECT );
msg->appendObjectIDArgument(obj->getID());
}
disp = DESTROY_MESSAGE;
break;
}
#endif


}
#endif // DEBUG_OBJECT_ID_EXISTS
#endif // RTS_DEBUG
}
}

if (disp == DESTROY_MESSAGE)
Expand Down
Loading